| ofs | hex dump | ascii |
|---|
| 0000 | 73 69 63 70 2d 32 30 32 30 30 35 31 32 2e 31 31 33 37 2f 00 00 00 00 00 00 00 00 00 00 00 00 00 | sicp-20200512.1137/............. |
| 0020 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0060 | 00 00 00 00 30 30 30 30 37 35 35 00 30 30 30 30 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 | ....0000755.0000000.0000000.0000 |
| 0080 | 30 30 30 30 30 30 30 00 30 30 30 30 30 30 30 30 30 30 30 00 30 31 31 37 33 36 00 20 35 00 00 00 | 0000000.00000000000.011736..5... |
| 00a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 00c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 00e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0100 | 00 75 73 74 61 72 20 20 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .ustar...root................... |
| 0120 | 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .........root................... |
| 0140 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0160 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0180 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 01a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 01c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 01e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0200 | 73 69 63 70 2d 32 30 32 30 30 35 31 32 2e 31 31 33 37 2f 64 69 72 00 00 00 00 00 00 00 00 00 00 | sicp-20200512.1137/dir.......... |
| 0220 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0240 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0260 | 00 00 00 00 30 30 30 30 36 34 34 00 30 30 30 30 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 | ....0000644.0000000.0000000.0000 |
| 0280 | 30 30 30 31 32 36 33 00 30 30 30 30 30 30 30 30 30 30 30 00 30 31 32 34 34 31 00 20 30 00 00 00 | 0001263.00000000000.012441..0... |
| 02a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 02c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 02e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0300 | 00 75 73 74 61 72 20 20 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .ustar...root................... |
| 0320 | 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .........root................... |
| 0340 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0360 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0380 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 03a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 03c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 03e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0400 | 54 68 69 73 20 69 73 20 74 68 65 20 66 69 6c 65 20 2e 2e 2e 2f 69 6e 66 6f 2f 64 69 72 2c 20 77 | This.is.the.file..../info/dir,.w |
| 0420 | 68 69 63 68 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 0a 74 6f 70 6d 6f 73 74 20 6e 6f 64 65 20 6f | hich.contains.the.topmost.node.o |
| 0440 | 66 20 74 68 65 20 49 6e 66 6f 20 68 69 65 72 61 72 63 68 79 2c 20 63 61 6c 6c 65 64 20 28 64 69 | f.the.Info.hierarchy,.called.(di |
| 0460 | 72 29 54 6f 70 2e 0a 54 68 65 20 66 69 72 73 74 20 74 69 6d 65 20 79 6f 75 20 69 6e 76 6f 6b 65 | r)Top..The.first.time.you.invoke |
| 0480 | 20 49 6e 66 6f 20 79 6f 75 20 73 74 61 72 74 20 6f 66 66 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 74 | .Info.you.start.off.looking.at.t |
| 04a0 | 68 69 73 20 6e 6f 64 65 2e 0a 1f 0a 46 69 6c 65 3a 20 64 69 72 2c 09 4e 6f 64 65 3a 20 54 6f 70 | his.node....File:.dir,.Node:.Top |
| 04c0 | 09 54 68 69 73 20 69 73 20 74 68 65 20 74 6f 70 20 6f 66 20 74 68 65 20 49 4e 46 4f 20 74 72 65 | .This.is.the.top.of.the.INFO.tre |
| 04e0 | 65 0a 0a 20 20 54 68 69 73 20 28 74 68 65 20 44 69 72 65 63 74 6f 72 79 20 6e 6f 64 65 29 20 67 | e....This.(the.Directory.node).g |
| 0500 | 69 76 65 73 20 61 20 6d 65 6e 75 20 6f 66 20 6d 61 6a 6f 72 20 74 6f 70 69 63 73 2e 0a 20 20 54 | ives.a.menu.of.major.topics....T |
| 0520 | 79 70 69 6e 67 20 22 71 22 20 65 78 69 74 73 2c 20 22 3f 22 20 6c 69 73 74 73 20 61 6c 6c 20 49 | yping."q".exits,."?".lists.all.I |
| 0540 | 6e 66 6f 20 63 6f 6d 6d 61 6e 64 73 2c 20 22 64 22 20 72 65 74 75 72 6e 73 20 68 65 72 65 2c 0a | nfo.commands,."d".returns.here,. |
| 0560 | 20 20 22 68 22 20 67 69 76 65 73 20 61 20 70 72 69 6d 65 72 20 66 6f 72 20 66 69 72 73 74 2d 74 | .."h".gives.a.primer.for.first-t |
| 0580 | 69 6d 65 72 73 2c 0a 20 20 22 6d 45 6d 61 63 73 3c 52 65 74 75 72 6e 3e 22 20 76 69 73 69 74 73 | imers,..."mEmacs<Return>".visits |
| 05a0 | 20 74 68 65 20 45 6d 61 63 73 20 6d 61 6e 75 61 6c 2c 20 65 74 63 2e 0a 0a 20 20 49 6e 20 45 6d | .the.Emacs.manual,.etc.....In.Em |
| 05c0 | 61 63 73 2c 20 79 6f 75 20 63 61 6e 20 63 6c 69 63 6b 20 6d 6f 75 73 65 20 62 75 74 74 6f 6e 20 | acs,.you.can.click.mouse.button. |
| 05e0 | 32 20 6f 6e 20 61 20 6d 65 6e 75 20 69 74 65 6d 20 6f 72 20 63 72 6f 73 73 20 72 65 66 65 72 65 | 2.on.a.menu.item.or.cross.refere |
| 0600 | 6e 63 65 0a 20 20 74 6f 20 73 65 6c 65 63 74 20 69 74 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 54 68 | nce...to.select.it...*.Menu:..Th |
| 0620 | 65 20 41 6c 67 6f 72 69 74 68 6d 69 63 20 4c 61 6e 67 75 61 67 65 20 53 63 68 65 6d 65 0a 2a 20 | e.Algorithmic.Language.Scheme.*. |
| 0640 | 53 49 43 50 3a 20 28 73 69 63 70 29 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 74 | SICP:.(sicp)..................St |
| 0660 | 72 75 63 74 75 72 65 20 61 6e 64 20 49 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 43 6f | ructure.and.Interpretation.of.Co |
| 0680 | 6d 70 75 74 65 72 20 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | mputer.......................... |
| 06a0 | 20 20 20 20 20 20 20 20 20 20 50 72 6f 67 72 61 6d 73 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 | ..........Programs.............. |
| 06c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 06e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0700 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0720 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0740 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0760 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0780 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 07a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 07c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 07e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0800 | 73 69 63 70 2d 32 30 32 30 30 35 31 32 2e 31 31 33 37 2f 73 69 63 70 2d 70 6b 67 2e 65 6c 00 00 | sicp-20200512.1137/sicp-pkg.el.. |
| 0820 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0840 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0860 | 00 00 00 00 30 30 30 30 36 34 34 00 30 30 30 30 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 | ....0000644.0000000.0000000.0000 |
| 0880 | 30 30 30 30 36 31 33 00 30 30 30 30 30 30 30 30 30 30 30 00 30 31 33 37 37 35 00 20 30 00 00 00 | 0000613.00000000000.013775..0... |
| 08a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 08c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 08e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0900 | 00 75 73 74 61 72 20 20 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .ustar...root................... |
| 0920 | 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .........root................... |
| 0940 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0960 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0980 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 09a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 09c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 09e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0a00 | 28 64 65 66 69 6e 65 2d 70 61 63 6b 61 67 65 20 22 73 69 63 70 22 20 22 32 30 32 30 30 35 31 32 | (define-package."sicp"."20200512 |
| 0a20 | 2e 31 31 33 37 22 20 22 53 74 72 75 63 74 75 72 65 20 61 6e 64 20 49 6e 74 65 72 70 72 65 74 61 | .1137"."Structure.and.Interpreta |
| 0a40 | 74 69 6f 6e 20 6f 66 20 43 6f 6d 70 75 74 65 72 20 50 72 6f 67 72 61 6d 73 20 69 6e 20 69 6e 66 | tion.of.Computer.Programs.in.inf |
| 0a60 | 6f 20 66 6f 72 6d 61 74 22 20 27 6e 69 6c 20 3a 63 6f 6d 6d 69 74 20 22 34 30 30 32 64 38 33 30 | o.format".'nil.:commit."4002d830 |
| 0a80 | 38 33 64 35 32 30 63 36 62 35 65 64 65 32 64 66 33 36 63 63 32 63 65 65 38 38 35 64 34 35 30 61 | 83d520c6b5ede2df36cc2cee885d450a |
| 0aa0 | 22 20 3a 61 75 74 68 6f 72 73 0a 20 20 27 28 28 22 48 61 6c 20 41 62 65 6c 73 6f 6e 22 29 0a 20 | ".:authors...'(("Hal.Abelson").. |
| 0ac0 | 20 20 20 28 22 4a 65 72 72 79 20 53 75 73 73 6d 61 6e 22 29 0a 20 20 20 20 28 22 4a 75 6c 69 65 | ...("Jerry.Sussman").....("Julie |
| 0ae0 | 20 53 75 73 73 6d 61 6e 22 29 29 0a 20 20 3a 6d 61 69 6e 74 61 69 6e 65 72 73 0a 20 20 27 28 28 | .Sussman"))...:maintainers...'(( |
| 0b00 | 22 48 61 6c 20 41 62 65 6c 73 6f 6e 22 29 29 0a 20 20 3a 6d 61 69 6e 74 61 69 6e 65 72 0a 20 20 | "Hal.Abelson"))...:maintainer... |
| 0b20 | 27 28 22 48 61 6c 20 41 62 65 6c 73 6f 6e 22 29 0a 20 20 3a 75 72 6c 20 22 68 74 74 70 73 3a 2f | '("Hal.Abelson")...:url."https:/ |
| 0b40 | 2f 6d 69 74 70 72 65 73 73 2e 6d 69 74 2e 65 64 75 2f 73 69 63 70 22 29 0a 3b 3b 20 4c 6f 63 61 | /mitpress.mit.edu/sicp").;;.Loca |
| 0b60 | 6c 20 56 61 72 69 61 62 6c 65 73 3a 0a 3b 3b 20 6e 6f 2d 62 79 74 65 2d 63 6f 6d 70 69 6c 65 3a | l.Variables:.;;.no-byte-compile: |
| 0b80 | 20 74 0a 3b 3b 20 45 6e 64 3a 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .t.;;.End:...................... |
| 0ba0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0bc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0be0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0c00 | 73 69 63 70 2d 32 30 32 30 30 35 31 32 2e 31 31 33 37 2f 73 69 63 70 2e 65 6c 00 00 00 00 00 00 | sicp-20200512.1137/sicp.el...... |
| 0c20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0c40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0c60 | 00 00 00 00 30 30 30 30 36 34 34 00 30 30 30 30 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 | ....0000644.0000000.0000000.0000 |
| 0c80 | 30 30 30 33 33 34 30 00 30 30 30 30 30 30 30 30 30 30 30 00 30 31 33 32 31 36 00 20 30 00 00 00 | 0003340.00000000000.013216..0... |
| 0ca0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0cc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0ce0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0d00 | 00 75 73 74 61 72 20 20 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .ustar...root................... |
| 0d20 | 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .........root................... |
| 0d40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0d60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0d80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0da0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0dc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0de0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 0e00 | 3b 3b 3b 20 73 69 63 70 2e 65 6c 20 2d 2d 2d 20 53 74 72 75 63 74 75 72 65 20 61 6e 64 20 49 6e | ;;;.sicp.el.---.Structure.and.In |
| 0e20 | 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 43 6f 6d 70 75 74 65 72 20 50 72 6f 67 72 61 6d | terpretation.of.Computer.Program |
| 0e40 | 73 20 69 6e 20 69 6e 66 6f 20 66 6f 72 6d 61 74 0a 0a 3b 3b 3b 20 43 6f 70 79 72 69 67 68 74 20 | s.in.info.format..;;;.Copyright. |
| 0e60 | 28 43 29 20 31 39 39 33 20 20 48 61 6c 20 41 62 65 6c 73 6f 6e 2c 20 4a 65 72 72 79 20 53 75 73 | (C).1993..Hal.Abelson,.Jerry.Sus |
| 0e80 | 73 6d 61 6e 2c 20 61 6e 64 20 4a 75 6c 69 65 20 53 75 73 73 6d 61 6e 0a 0a 3b 3b 20 41 75 74 68 | sman,.and.Julie.Sussman..;;.Auth |
| 0ea0 | 6f 72 3a 20 48 61 6c 20 41 62 65 6c 73 6f 6e 0a 3b 3b 09 4a 65 72 72 79 20 53 75 73 73 6d 61 6e | or:.Hal.Abelson.;;.Jerry.Sussman |
| 0ec0 | 0a 3b 3b 09 4a 75 6c 69 65 20 53 75 73 73 6d 61 6e 0a 3b 3b 20 48 6f 6d 65 70 61 67 65 3a 20 68 | .;;.Julie.Sussman.;;.Homepage:.h |
| 0ee0 | 74 74 70 73 3a 2f 2f 6d 69 74 70 72 65 73 73 2e 6d 69 74 2e 65 64 75 2f 73 69 63 70 0a 0a 3b 3b | ttps://mitpress.mit.edu/sicp..;; |
| 0f00 | 20 54 68 69 73 20 66 69 6c 65 20 69 73 20 6e 6f 74 20 70 61 72 74 20 6f 66 20 47 4e 55 20 45 6d | .This.file.is.not.part.of.GNU.Em |
| 0f20 | 61 63 73 2e 0a 0a 3b 3b 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 66 72 65 65 20 73 6f | acs...;;.This.program.is.free.so |
| 0f40 | 66 74 77 61 72 65 3b 20 79 6f 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 62 75 74 65 20 69 74 20 | ftware;.you.can.redistribute.it. |
| 0f60 | 61 6e 64 2f 6f 72 20 6d 6f 64 69 66 79 0a 3b 3b 20 69 74 20 75 6e 64 65 72 20 74 68 65 20 74 65 | and/or.modify.;;.it.under.the.te |
| 0f80 | 72 6d 73 20 6f 66 20 74 68 65 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 | rms.of.the.GNU.General.Public.Li |
| 0fa0 | 63 65 6e 73 65 20 61 73 20 70 75 62 6c 69 73 68 65 64 20 62 79 0a 3b 3b 20 74 68 65 20 46 72 65 | cense.as.published.by.;;.the.Fre |
| 0fc0 | 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 61 74 69 6f 6e 2c 20 65 69 74 68 65 72 20 76 65 | e.Software.Foundation,.either.ve |
| 0fe0 | 72 73 69 6f 6e 20 33 20 6f 66 20 74 68 65 20 4c 69 63 65 6e 73 65 2c 20 6f 72 0a 3b 3b 20 28 61 | rsion.3.of.the.License,.or.;;.(a |
| 1000 | 74 20 79 6f 75 72 20 6f 70 74 69 6f 6e 29 20 61 6e 79 20 6c 61 74 65 72 20 76 65 72 73 69 6f 6e | t.your.option).any.later.version |
| 1020 | 2e 0a 0a 3b 3b 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73 74 72 69 62 75 74 65 | ...;;.This.program.is.distribute |
| 1040 | 64 20 69 6e 20 74 68 65 20 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c 6c 20 62 65 20 75 73 | d.in.the.hope.that.it.will.be.us |
| 1060 | 65 66 75 6c 2c 0a 3b 3b 20 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e 59 20 57 41 52 52 41 4e 54 | eful,.;;.but.WITHOUT.ANY.WARRANT |
| 1080 | 59 3b 20 77 69 74 68 6f 75 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69 65 64 20 77 61 72 72 | Y;.without.even.the.implied.warr |
| 10a0 | 61 6e 74 79 20 6f 66 0a 3b 3b 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 59 20 6f 72 20 46 49 | anty.of.;;.MERCHANTABILITY.or.FI |
| 10c0 | 54 4e 45 53 53 20 46 4f 52 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55 52 50 4f 53 45 2e 20 | TNESS.FOR.A.PARTICULAR.PURPOSE.. |
| 10e0 | 20 53 65 65 20 74 68 65 0a 3b 3b 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 4c | .See.the.;;.GNU.General.Public.L |
| 1100 | 69 63 65 6e 73 65 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 3b 3b 20 59 6f 75 | icense.for.more.details...;;.You |
| 1120 | 20 73 68 6f 75 6c 64 20 68 61 76 65 20 72 65 63 65 69 76 65 64 20 61 20 63 6f 70 79 20 6f 66 20 | .should.have.received.a.copy.of. |
| 1140 | 74 68 65 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 0a 3b | the.GNU.General.Public.License.; |
| 1160 | 3b 20 61 6c 6f 6e 67 20 77 69 74 68 20 74 68 69 73 20 70 72 6f 67 72 61 6d 2e 20 20 49 66 20 6e | ;.along.with.this.program...If.n |
| 1180 | 6f 74 2c 20 73 65 65 20 3c 68 74 74 70 3a 2f 2f 77 77 77 2e 67 6e 75 2e 6f 72 67 2f 6c 69 63 65 | ot,.see.<http://www.gnu.org/lice |
| 11a0 | 6e 73 65 73 2f 3e 2e 0a 0a 3b 3b 20 54 68 65 20 69 6e 63 6c 75 64 65 64 20 73 69 63 70 2e 69 6e | nses/>...;;.The.included.sicp.in |
| 11c0 | 66 6f 20 61 6e 64 20 73 69 63 70 2e 74 65 78 69 20 66 69 6c 65 73 20 72 65 61 74 61 69 6e 20 74 | fo.and.sicp.texi.files.reatain.t |
| 11e0 | 68 65 69 72 0a 3b 3b 20 6f 72 69 67 69 6e 20 43 72 65 61 74 69 76 65 20 43 6f 6d 6d 6f 6e 73 20 | heir.;;.origin.Creative.Commons. |
| 1200 | 41 74 74 72 69 62 75 74 69 6f 6e 2d 53 68 61 72 65 41 6c 69 6b 65 20 34 2e 30 0a 3b 3b 20 49 6e | Attribution-ShareAlike.4.0.;;.In |
| 1220 | 74 65 72 6e 61 74 69 6f 6e 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 0a 3b 3b 20 53 65 | ternational.Public.License.;;.Se |
| 1240 | 65 20 68 74 74 70 3a 2f 2f 63 72 65 61 74 69 76 65 63 6f 6d 6d 6f 6e 73 2e 6f 72 67 2f 6c 69 63 | e.http://creativecommons.org/lic |
| 1260 | 65 6e 73 65 73 2f 62 79 2d 73 61 2f 34 2e 30 2f 0a 3b 3b 20 61 6e 64 20 68 74 74 70 3a 2f 2f 63 | enses/by-sa/4.0/.;;.and.http://c |
| 1280 | 72 65 61 74 69 76 65 63 6f 6d 6d 6f 6e 73 2e 6f 72 67 2f 6c 69 63 65 6e 73 65 73 2f 62 79 2d 73 | reativecommons.org/licenses/by-s |
| 12a0 | 61 2f 34 2e 30 2f 6c 65 67 61 6c 63 6f 64 65 2e 0a 0a 0a 3b 3b 3b 20 43 6f 6d 6d 65 6e 74 61 72 | a/4.0/legalcode....;;;.Commentar |
| 12c0 | 79 3a 0a 0a 3b 3b 20 54 68 65 20 73 65 63 6f 6e 64 20 65 64 69 74 69 6f 6e 20 6f 66 20 74 68 65 | y:..;;.The.second.edition.of.the |
| 12e0 | 20 62 6f 6f 6b 20 53 74 72 75 63 74 75 72 65 20 61 6e 64 20 49 6e 74 65 72 70 72 65 74 61 74 69 | .book.Structure.and.Interpretati |
| 1300 | 6f 6e 20 6f 66 0a 3b 3b 20 43 6f 6d 70 75 74 65 72 20 50 72 6f 67 72 61 6d 73 20 28 53 49 43 50 | on.of.;;.Computer.Programs.(SICP |
| 1320 | 29 20 69 6e 20 69 6e 66 6f 20 66 6f 72 6d 61 74 2e 0a 0a 3b 3b 20 54 68 69 73 20 6c 69 62 72 61 | ).in.info.format...;;.This.libra |
| 1340 | 72 79 20 70 72 6f 76 69 64 65 73 20 74 68 65 20 66 65 61 74 75 72 65 20 60 73 69 63 70 27 20 61 | ry.provides.the.feature.`sicp'.a |
| 1360 | 6e 64 20 64 6f 65 73 20 6e 6f 74 68 69 6e 67 20 65 6c 73 65 2e 0a 3b 3b 20 54 68 69 73 20 61 6c | nd.does.nothing.else..;;.This.al |
| 1380 | 6c 6f 77 73 20 6d 61 6b 69 6e 67 20 74 68 65 20 69 6e 66 6f 20 66 69 6c 65 20 61 76 61 69 6c 61 | lows.making.the.info.file.availa |
| 13a0 | 62 6c 65 20 6f 6e 20 4d 65 6c 70 61 2e 20 20 54 68 65 20 74 65 78 69 0a 3b 3b 20 66 69 6c 65 20 | ble.on.Melpa...The.texi.;;.file. |
| 13c0 | 77 61 73 20 74 61 6b 65 6e 20 66 72 6f 6d 20 68 74 74 70 3a 2f 2f 77 77 77 2e 6e 65 69 6c 76 61 | was.taken.from.http://www.neilva |
| 13e0 | 6e 64 79 6b 65 2e 6f 72 67 2f 73 69 63 70 2d 74 65 78 69 2e 20 20 54 68 65 0a 3b 3b 20 68 74 6d | ndyke.org/sicp-texi...The.;;.htm |
| 1400 | 6c 20 76 65 72 73 69 6f 6e 20 63 61 6e 20 62 65 20 66 6f 75 6e 64 20 61 74 20 68 74 74 70 73 3a | l.version.can.be.found.at.https: |
| 1420 | 2f 2f 6d 69 74 70 72 65 73 73 2e 6d 69 74 2e 65 64 75 2f 73 69 63 70 2e 0a 0a 3b 3b 20 49 66 20 | //mitpress.mit.edu/sicp...;;.If. |
| 1440 | 79 6f 75 20 77 61 6e 74 20 74 6f 20 72 65 63 72 65 61 74 65 20 74 68 65 20 69 6e 66 6f 20 66 69 | you.want.to.recreate.the.info.fi |
| 1460 | 6c 65 2c 20 79 6f 75 20 63 61 6e 20 64 6f 20 73 6f 20 75 73 69 6e 67 0a 3b 3b 0a 3b 3b 20 20 20 | le,.you.can.do.so.using.;;.;;... |
| 1480 | 6d 61 6b 65 69 6e 66 6f 20 2d e2 80 93 6e 6f 2d 73 70 6c 69 74 20 73 69 63 70 2e 74 65 78 69 20 | makeinfo.-...no-split.sicp.texi. |
| 14a0 | 2d 6f 20 73 69 63 70 2e 69 6e 66 6f 0a 0a 3b 3b 3b 20 43 6f 64 65 3a 0a 0a 28 70 72 6f 76 69 64 | -o.sicp.info..;;;.Code:..(provid |
| 14c0 | 65 20 27 73 69 63 70 29 0a 0a 3b 3b 3b 20 73 69 63 70 2e 65 6c 20 65 6e 64 73 20 68 65 72 65 0a | e.'sicp)..;;;.sicp.el.ends.here. |
| 14e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1500 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1520 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1540 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1560 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1580 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 15a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 15c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 15e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1600 | 73 69 63 70 2d 32 30 32 30 30 35 31 32 2e 31 31 33 37 2f 73 69 63 70 2e 69 6e 66 6f 00 00 00 00 | sicp-20200512.1137/sicp.info.... |
| 1620 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1640 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1660 | 00 00 00 00 30 30 30 30 36 34 34 00 30 30 30 30 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 | ....0000644.0000000.0000000.0000 |
| 1680 | 35 35 33 32 30 37 30 00 30 30 30 30 30 30 30 30 30 30 30 00 30 31 33 35 36 35 00 20 30 00 00 00 | 5532070.00000000000.013565..0... |
| 16a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1700 | 00 75 73 74 61 72 20 20 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .ustar...root................... |
| 1720 | 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | .........root................... |
| 1740 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1760 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1780 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 17a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 17c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 17e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 1800 | 54 68 69 73 20 69 73 20 73 69 63 70 2e 69 6e 66 6f 2c 20 70 72 6f 64 75 63 65 64 20 62 79 20 6d | This.is.sicp.info,.produced.by.m |
| 1820 | 61 6b 65 69 6e 66 6f 20 76 65 72 73 69 6f 6e 20 34 2e 38 20 66 72 6f 6d 20 73 69 63 70 2e 74 65 | akeinfo.version.4.8.from.sicp.te |
| 1840 | 78 69 2e 0a 0a 49 4e 46 4f 2d 44 49 52 2d 53 45 43 54 49 4f 4e 20 54 68 65 20 41 6c 67 6f 72 69 | xi...INFO-DIR-SECTION.The.Algori |
| 1860 | 74 68 6d 69 63 20 4c 61 6e 67 75 61 67 65 20 53 63 68 65 6d 65 0a 53 54 41 52 54 2d 49 4e 46 4f | thmic.Language.Scheme.START-INFO |
| 1880 | 2d 44 49 52 2d 45 4e 54 52 59 0a 2a 20 53 49 43 50 3a 20 28 73 69 63 70 29 2e 20 53 74 72 75 63 | -DIR-ENTRY.*.SICP:.(sicp)..Struc |
| 18a0 | 74 75 72 65 20 61 6e 64 20 49 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 43 6f 6d 70 75 | ture.and.Interpretation.of.Compu |
| 18c0 | 74 65 72 20 50 72 6f 67 72 61 6d 73 0a 45 4e 44 2d 49 4e 46 4f 2d 44 49 52 2d 45 4e 54 52 59 0a | ter.Programs.END-INFO-DIR-ENTRY. |
| 18e0 | 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 54 6f 70 2c 20 | ...File:.sicp.info,..Node:.Top,. |
| 1900 | 20 4e 65 78 74 3a 20 55 54 46 2c 20 20 50 72 65 76 3a 20 28 64 69 72 29 2c 20 20 55 70 3a 20 28 | .Next:.UTF,..Prev:.(dir),..Up:.( |
| 1920 | 64 69 72 29 0a 0a 53 74 72 75 63 74 75 72 65 20 61 6e 64 20 49 6e 74 65 72 70 72 65 74 61 74 69 | dir)..Structure.and.Interpretati |
| 1940 | 6f 6e 20 6f 66 20 43 6f 6d 70 75 74 65 72 20 50 72 6f 67 72 61 6d 73 0a 3d 3d 3d 3d 3d 3d 3d 3d | on.of.Computer.Programs.======== |
| 1960 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ================================ |
| 1980 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 53 65 63 6f 6e 64 20 45 64 69 74 69 6f 6e 0a 62 79 20 48 61 72 | =========..Second.Edition.by.Har |
| 19a0 | 6f 6c 64 20 41 62 65 6c 73 6f 6e 20 61 6e 64 20 47 65 72 61 6c 64 20 4a 61 79 20 53 75 73 73 6d | old.Abelson.and.Gerald.Jay.Sussm |
| 19c0 | 61 6e 2c 20 77 69 74 68 20 4a 75 6c 69 65 20 53 75 73 73 6d 61 6e 0a 66 6f 72 65 77 6f 72 64 20 | an,.with.Julie.Sussman.foreword. |
| 19e0 | 62 79 20 41 6c 61 6e 20 4a 2e 20 50 65 72 6c 69 73 0a 28 43 29 20 31 39 39 36 20 4d 61 73 73 61 | by.Alan.J..Perlis.(C).1996.Massa |
| 1a00 | 63 68 75 73 65 74 74 73 20 49 6e 73 74 69 74 75 74 65 20 6f 66 20 54 65 63 68 6e 6f 6c 6f 67 79 | chusetts.Institute.of.Technology |
| 1a20 | 0a 0a 55 6e 6f 66 66 69 63 69 61 6c 20 54 65 78 69 6e 66 6f 20 46 6f 72 6d 61 74 20 76 65 72 73 | ..Unofficial.Texinfo.Format.vers |
| 1a40 | 69 6f 6e 20 32 2e 6e 65 69 6c 76 61 6e 64 79 6b 65 34 20 28 4a 61 6e 75 61 72 79 20 31 30 2c 20 | ion.2.neilvandyke4.(January.10,. |
| 1a60 | 32 30 30 37 29 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 55 54 46 3a 3a 20 20 20 20 20 20 20 20 20 | 2007)..*.Menu:..*.UTF::......... |
| 1a80 | 20 20 20 20 20 55 6e 6f 66 66 69 63 69 61 6c 20 54 65 78 69 6e 66 6f 20 46 6f 72 6d 61 74 0a 2a | .....Unofficial.Texinfo.Format.* |
| 1aa0 | 20 44 65 64 69 63 61 74 69 6f 6e 3a 3a 20 20 20 20 20 20 20 44 65 64 69 63 61 74 69 6f 6e 0a 2a | .Dedication::.......Dedication.* |
| 1ac0 | 20 46 6f 72 65 77 6f 72 64 3a 3a 20 20 20 20 20 20 20 20 20 46 6f 72 65 77 6f 72 64 0a 2a 20 50 | .Foreword::.........Foreword.*.P |
| 1ae0 | 72 65 66 61 63 65 3a 3a 20 20 20 20 20 20 20 20 20 20 50 72 65 66 61 63 65 20 74 6f 20 74 68 65 | reface::..........Preface.to.the |
| 1b00 | 20 53 65 63 6f 6e 64 20 45 64 69 74 69 6f 6e 0a 2a 20 50 72 65 66 61 63 65 20 31 65 3a 3a 20 20 | .Second.Edition.*.Preface.1e::.. |
| 1b20 | 20 20 20 20 20 50 72 65 66 61 63 65 20 74 6f 20 74 68 65 20 46 69 72 73 74 20 45 64 69 74 69 6f | .....Preface.to.the.First.Editio |
| 1b40 | 6e 0a 2a 20 41 63 6b 6e 6f 77 6c 65 64 67 65 6d 65 6e 74 73 3a 3a 20 41 63 6b 6e 6f 77 6c 65 64 | n.*.Acknowledgements::.Acknowled |
| 1b60 | 67 65 6d 65 6e 74 73 0a 2a 20 43 68 61 70 74 65 72 20 31 3a 3a 20 20 20 20 20 20 20 20 42 75 69 | gements.*.Chapter.1::........Bui |
| 1b80 | 6c 64 69 6e 67 20 41 62 73 74 72 61 63 74 69 6f 6e 73 20 77 69 74 68 20 50 72 6f 63 65 64 75 72 | lding.Abstractions.with.Procedur |
| 1ba0 | 65 73 0a 2a 20 43 68 61 70 74 65 72 20 32 3a 3a 20 20 20 20 20 20 20 20 42 75 69 6c 64 69 6e 67 | es.*.Chapter.2::........Building |
| 1bc0 | 20 41 62 73 74 72 61 63 74 69 6f 6e 73 20 77 69 74 68 20 44 61 74 61 0a 2a 20 43 68 61 70 74 65 | .Abstractions.with.Data.*.Chapte |
| 1be0 | 72 20 33 3a 3a 20 20 20 20 20 20 20 20 4d 6f 64 75 6c 61 72 69 74 79 2c 20 4f 62 6a 65 63 74 73 | r.3::........Modularity,.Objects |
| 1c00 | 2c 20 61 6e 64 20 53 74 61 74 65 0a 2a 20 43 68 61 70 74 65 72 20 34 3a 3a 20 20 20 20 20 20 20 | ,.and.State.*.Chapter.4::....... |
| 1c20 | 20 4d 65 74 61 6c 69 6e 67 75 69 73 74 69 63 20 41 62 73 74 72 61 63 74 69 6f 6e 0a 2a 20 43 68 | .Metalinguistic.Abstraction.*.Ch |
| 1c40 | 61 70 74 65 72 20 35 3a 3a 20 20 20 20 20 20 20 20 43 6f 6d 70 75 74 69 6e 67 20 77 69 74 68 20 | apter.5::........Computing.with. |
| 1c60 | 52 65 67 69 73 74 65 72 20 4d 61 63 68 69 6e 65 73 0a 2a 20 52 65 66 65 72 65 6e 63 65 73 3a 3a | Register.Machines.*.References:: |
| 1c80 | 20 20 20 20 20 20 20 52 65 66 65 72 65 6e 63 65 73 0a 2a 20 49 6e 64 65 78 3a 3a 20 20 20 20 20 | .......References.*.Index::..... |
| 1ca0 | 20 20 20 20 20 20 20 49 6e 64 65 78 0a 0a 20 2d 2d 2d 20 54 68 65 20 44 65 74 61 69 6c 65 64 20 | .......Index...---.The.Detailed. |
| 1cc0 | 4e 6f 64 65 20 4c 69 73 74 69 6e 67 20 2d 2d 2d 0a 0a 50 72 6f 67 72 61 6d 6d 69 6e 67 20 69 6e | Node.Listing.---..Programming.in |
| 1ce0 | 20 4c 69 73 70 0a 0a 2a 20 31 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 | .Lisp..*.1-1::..............The. |
| 1d00 | 45 6c 65 6d 65 6e 74 73 20 6f 66 20 50 72 6f 67 72 61 6d 6d 69 6e 67 0a 2a 20 31 2d 32 3a 3a 20 | Elements.of.Programming.*.1-2::. |
| 1d20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 50 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 74 68 65 20 | .............Procedures.and.the. |
| 1d40 | 50 72 6f 63 65 73 73 65 73 20 54 68 65 79 20 47 65 6e 65 72 61 74 65 0a 2a 20 31 2d 33 3a 3a 20 | Processes.They.Generate.*.1-3::. |
| 1d60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 46 6f 72 6d 75 6c 61 74 69 6e 67 20 41 62 73 74 72 61 63 | .............Formulating.Abstrac |
| 1d80 | 74 69 6f 6e 73 20 77 69 74 68 20 48 69 67 68 65 72 2d 4f 72 64 65 72 20 50 72 6f 63 65 64 75 72 | tions.with.Higher-Order.Procedur |
| 1da0 | 65 73 0a 0a 54 68 65 20 45 6c 65 6d 65 6e 74 73 20 6f 66 20 50 72 6f 67 72 61 6d 6d 69 6e 67 0a | es..The.Elements.of.Programming. |
| 1dc0 | 0a 2a 20 31 2d 31 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 70 72 65 73 73 69 6f 6e | .*.1-1-1::............Expression |
| 1de0 | 73 0a 2a 20 31 2d 31 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4e 61 6d 69 6e 67 20 61 6e | s.*.1-1-2::............Naming.an |
| 1e00 | 64 20 74 68 65 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 0a 2a 20 31 2d 31 2d 33 3a 3a 20 20 20 20 20 | d.the.Environment.*.1-1-3::..... |
| 1e20 | 20 20 20 20 20 20 20 45 76 61 6c 75 61 74 69 6e 67 20 43 6f 6d 62 69 6e 61 74 69 6f 6e 73 0a 2a | .......Evaluating.Combinations.* |
| 1e40 | 20 31 2d 31 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6d 70 6f 75 6e 64 20 50 72 6f | .1-1-4::............Compound.Pro |
| 1e60 | 63 65 64 75 72 65 73 0a 2a 20 31 2d 31 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 | cedures.*.1-1-5::............The |
| 1e80 | 20 53 75 62 73 74 69 74 75 74 69 6f 6e 20 4d 6f 64 65 6c 20 66 6f 72 20 50 72 6f 63 65 64 75 72 | .Substitution.Model.for.Procedur |
| 1ea0 | 65 20 41 70 70 6c 69 63 61 74 69 6f 6e 0a 2a 20 31 2d 31 2d 36 3a 3a 20 20 20 20 20 20 20 20 20 | e.Application.*.1-1-6::......... |
| 1ec0 | 20 20 20 43 6f 6e 64 69 74 69 6f 6e 61 6c 20 45 78 70 72 65 73 73 69 6f 6e 73 20 61 6e 64 20 50 | ...Conditional.Expressions.and.P |
| 1ee0 | 72 65 64 69 63 61 74 65 73 0a 2a 20 31 2d 31 2d 37 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 | redicates.*.1-1-7::............E |
| 1f00 | 78 61 6d 70 6c 65 3a 20 53 71 75 61 72 65 20 52 6f 6f 74 73 20 62 79 20 4e 65 77 74 6f 6e 27 73 | xample:.Square.Roots.by.Newton's |
| 1f20 | 20 4d 65 74 68 6f 64 0a 2a 20 31 2d 31 2d 38 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 50 72 6f | .Method.*.1-1-8::............Pro |
| 1f40 | 63 65 64 75 72 65 73 20 61 73 20 42 6c 61 63 6b 2d 42 6f 78 20 41 62 73 74 72 61 63 74 69 6f 6e | cedures.as.Black-Box.Abstraction |
| 1f60 | 73 0a 0a 50 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 74 68 65 20 50 72 6f 63 65 73 73 65 73 20 | s..Procedures.and.the.Processes. |
| 1f80 | 54 68 65 79 20 47 65 6e 65 72 61 74 65 0a 0a 2a 20 31 2d 32 2d 31 3a 3a 20 20 20 20 20 20 20 20 | They.Generate..*.1-2-1::........ |
| 1fa0 | 20 20 20 20 4c 69 6e 65 61 72 20 52 65 63 75 72 73 69 6f 6e 20 61 6e 64 20 49 74 65 72 61 74 69 | ....Linear.Recursion.and.Iterati |
| 1fc0 | 6f 6e 0a 2a 20 31 2d 32 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 72 65 65 20 52 65 63 | on.*.1-2-2::............Tree.Rec |
| 1fe0 | 75 72 73 69 6f 6e 0a 2a 20 31 2d 32 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4f 72 64 65 | ursion.*.1-2-3::............Orde |
| 2000 | 72 73 20 6f 66 20 47 72 6f 77 74 68 0a 2a 20 31 2d 32 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 | rs.of.Growth.*.1-2-4::.......... |
| 2020 | 20 20 45 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 0a 2a 20 31 2d 32 2d 35 3a 3a 20 20 20 20 20 20 | ..Exponentiation.*.1-2-5::...... |
| 2040 | 20 20 20 20 20 20 47 72 65 61 74 65 73 74 20 43 6f 6d 6d 6f 6e 20 44 69 76 69 73 6f 72 73 0a 2a | ......Greatest.Common.Divisors.* |
| 2060 | 20 31 2d 32 2d 36 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 54 65 73 | .1-2-6::............Example:.Tes |
| 2080 | 74 69 6e 67 20 66 6f 72 20 50 72 69 6d 61 6c 69 74 79 0a 0a 46 6f 72 6d 75 6c 61 74 69 6e 67 20 | ting.for.Primality..Formulating. |
| 20a0 | 41 62 73 74 72 61 63 74 69 6f 6e 73 20 77 69 74 68 20 48 69 67 68 65 72 2d 4f 72 64 65 72 20 50 | Abstractions.with.Higher-Order.P |
| 20c0 | 72 6f 63 65 64 75 72 65 73 0a 0a 2a 20 31 2d 33 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 | rocedures..*.1-3-1::............ |
| 20e0 | 50 72 6f 63 65 64 75 72 65 73 20 61 73 20 41 72 67 75 6d 65 6e 74 73 0a 2a 20 31 2d 33 2d 32 3a | Procedures.as.Arguments.*.1-3-2: |
| 2100 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6e 73 74 72 75 63 74 69 6e 67 20 50 72 6f 63 65 64 | :............Constructing.Proced |
| 2120 | 75 72 65 73 20 55 73 69 6e 67 20 60 4c 61 6d 62 64 61 27 0a 2a 20 31 2d 33 2d 33 3a 3a 20 20 20 | ures.Using.`Lambda'.*.1-3-3::... |
| 2140 | 20 20 20 20 20 20 20 20 20 50 72 6f 63 65 64 75 72 65 73 20 61 73 20 47 65 6e 65 72 61 6c 20 4d | .........Procedures.as.General.M |
| 2160 | 65 74 68 6f 64 73 0a 2a 20 31 2d 33 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 50 72 6f 63 | ethods.*.1-3-4::............Proc |
| 2180 | 65 64 75 72 65 73 20 61 73 20 52 65 74 75 72 6e 65 64 20 56 61 6c 75 65 73 0a 0a 42 75 69 6c 64 | edures.as.Returned.Values..Build |
| 21a0 | 69 6e 67 20 41 62 73 74 72 61 63 74 69 6f 6e 73 20 77 69 74 68 20 44 61 74 61 0a 0a 2a 20 32 2d | ing.Abstractions.with.Data..*.2- |
| 21c0 | 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 49 6e 74 72 6f 64 75 63 74 69 6f 6e 20 74 6f | 1::..............Introduction.to |
| 21e0 | 20 44 61 74 61 20 41 62 73 74 72 61 63 74 69 6f 6e 0a 2a 20 32 2d 32 3a 3a 20 20 20 20 20 20 20 | .Data.Abstraction.*.2-2::....... |
| 2200 | 20 20 20 20 20 20 20 48 69 65 72 61 72 63 68 69 63 61 6c 20 44 61 74 61 20 61 6e 64 20 74 68 65 | .......Hierarchical.Data.and.the |
| 2220 | 20 43 6c 6f 73 75 72 65 20 50 72 6f 70 65 72 74 79 0a 2a 20 32 2d 33 3a 3a 20 20 20 20 20 20 20 | .Closure.Property.*.2-3::....... |
| 2240 | 20 20 20 20 20 20 20 53 79 6d 62 6f 6c 69 63 20 44 61 74 61 0a 2a 20 32 2d 34 3a 3a 20 20 20 20 | .......Symbolic.Data.*.2-4::.... |
| 2260 | 20 20 20 20 20 20 20 20 20 20 4d 75 6c 74 69 70 6c 65 20 52 65 70 72 65 73 65 6e 74 61 74 69 6f | ..........Multiple.Representatio |
| 2280 | 6e 73 20 66 6f 72 20 41 62 73 74 72 61 63 74 20 44 61 74 61 0a 2a 20 32 2d 35 3a 3a 20 20 20 20 | ns.for.Abstract.Data.*.2-5::.... |
| 22a0 | 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 73 20 77 69 74 68 20 47 65 6e 65 72 69 63 20 4f | ..........Systems.with.Generic.O |
| 22c0 | 70 65 72 61 74 69 6f 6e 73 0a 0a 49 6e 74 72 6f 64 75 63 74 69 6f 6e 20 74 6f 20 44 61 74 61 20 | perations..Introduction.to.Data. |
| 22e0 | 41 62 73 74 72 61 63 74 69 6f 6e 0a 0a 2a 20 32 2d 31 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 | Abstraction..*.2-1-1::.......... |
| 2300 | 20 20 45 78 61 6d 70 6c 65 3a 20 41 72 69 74 68 6d 65 74 69 63 20 4f 70 65 72 61 74 69 6f 6e 73 | ..Example:.Arithmetic.Operations |
| 2320 | 20 66 6f 72 20 52 61 74 69 6f 6e 61 6c 20 4e 75 6d 62 65 72 73 0a 2a 20 32 2d 31 2d 32 3a 3a 20 | .for.Rational.Numbers.*.2-1-2::. |
| 2340 | 20 20 20 20 20 20 20 20 20 20 20 41 62 73 74 72 61 63 74 69 6f 6e 20 42 61 72 72 69 65 72 73 0a | ...........Abstraction.Barriers. |
| 2360 | 2a 20 32 2d 31 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 57 68 61 74 20 49 73 20 4d 65 61 | *.2-1-3::............What.Is.Mea |
| 2380 | 6e 74 20 62 79 20 44 61 74 61 3f 0a 2a 20 32 2d 31 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 | nt.by.Data?.*.2-1-4::........... |
| 23a0 | 20 45 78 74 65 6e 64 65 64 20 45 78 65 72 63 69 73 65 3a 20 49 6e 74 65 72 76 61 6c 20 41 72 69 | .Extended.Exercise:.Interval.Ari |
| 23c0 | 74 68 6d 65 74 69 63 0a 0a 48 69 65 72 61 72 63 68 69 63 61 6c 20 44 61 74 61 20 61 6e 64 20 74 | thmetic..Hierarchical.Data.and.t |
| 23e0 | 68 65 20 43 6c 6f 73 75 72 65 20 50 72 6f 70 65 72 74 79 0a 0a 2a 20 32 2d 32 2d 31 3a 3a 20 20 | he.Closure.Property..*.2-2-1::.. |
| 2400 | 20 20 20 20 20 20 20 20 20 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 53 65 71 75 65 6e 63 65 73 | ..........Representing.Sequences |
| 2420 | 0a 2a 20 32 2d 32 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 48 69 65 72 61 72 63 68 69 63 | .*.2-2-2::............Hierarchic |
| 2440 | 61 6c 20 53 74 72 75 63 74 75 72 65 73 0a 2a 20 32 2d 32 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 | al.Structures.*.2-2-3::......... |
| 2460 | 20 20 20 53 65 71 75 65 6e 63 65 73 20 61 73 20 43 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 49 6e 74 | ...Sequences.as.Conventional.Int |
| 2480 | 65 72 66 61 63 65 73 0a 2a 20 32 2d 32 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 61 | erfaces.*.2-2-4::............Exa |
| 24a0 | 6d 70 6c 65 3a 20 41 20 50 69 63 74 75 72 65 20 4c 61 6e 67 75 61 67 65 0a 0a 53 79 6d 62 6f 6c | mple:.A.Picture.Language..Symbol |
| 24c0 | 69 63 20 44 61 74 61 0a 0a 2a 20 32 2d 33 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 51 75 | ic.Data..*.2-3-1::............Qu |
| 24e0 | 6f 74 61 74 69 6f 6e 0a 2a 20 32 2d 33 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 61 | otation.*.2-3-2::............Exa |
| 2500 | 6d 70 6c 65 3a 20 53 79 6d 62 6f 6c 69 63 20 44 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 0a 2a | mple:.Symbolic.Differentiation.* |
| 2520 | 20 32 2d 33 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 52 65 70 | .2-3-3::............Example:.Rep |
| 2540 | 72 65 73 65 6e 74 69 6e 67 20 53 65 74 73 0a 2a 20 32 2d 33 2d 34 3a 3a 20 20 20 20 20 20 20 20 | resenting.Sets.*.2-3-4::........ |
| 2560 | 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 48 75 66 66 6d 61 6e 20 45 6e 63 6f 64 69 6e 67 20 54 72 | ....Example:.Huffman.Encoding.Tr |
| 2580 | 65 65 73 0a 0a 4d 75 6c 74 69 70 6c 65 20 52 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 66 6f | ees..Multiple.Representations.fo |
| 25a0 | 72 20 41 62 73 74 72 61 63 74 20 44 61 74 61 0a 0a 2a 20 32 2d 34 2d 31 3a 3a 20 20 20 20 20 20 | r.Abstract.Data..*.2-4-1::...... |
| 25c0 | 20 20 20 20 20 20 52 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 43 6f 6d 70 6c 65 | ......Representations.for.Comple |
| 25e0 | 78 20 4e 75 6d 62 65 72 73 0a 2a 20 32 2d 34 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 | x.Numbers.*.2-4-2::............T |
| 2600 | 61 67 67 65 64 20 64 61 74 61 0a 2a 20 32 2d 34 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 | agged.data.*.2-4-3::............ |
| 2620 | 44 61 74 61 2d 44 69 72 65 63 74 65 64 20 50 72 6f 67 72 61 6d 6d 69 6e 67 20 61 6e 64 20 41 64 | Data-Directed.Programming.and.Ad |
| 2640 | 64 69 74 69 76 69 74 79 0a 0a 53 79 73 74 65 6d 73 20 77 69 74 68 20 47 65 6e 65 72 69 63 20 4f | ditivity..Systems.with.Generic.O |
| 2660 | 70 65 72 61 74 69 6f 6e 73 0a 0a 2a 20 32 2d 35 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 | perations..*.2-5-1::............ |
| 2680 | 47 65 6e 65 72 69 63 20 41 72 69 74 68 6d 65 74 69 63 20 4f 70 65 72 61 74 69 6f 6e 73 0a 2a 20 | Generic.Arithmetic.Operations.*. |
| 26a0 | 32 2d 35 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6d 62 69 6e 69 6e 67 20 44 61 74 | 2-5-2::............Combining.Dat |
| 26c0 | 61 20 6f 66 20 44 69 66 66 65 72 65 6e 74 20 54 79 70 65 73 0a 2a 20 32 2d 35 2d 33 3a 3a 20 20 | a.of.Different.Types.*.2-5-3::.. |
| 26e0 | 20 20 20 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 53 79 6d 62 6f 6c 69 63 20 41 6c 67 65 | ..........Example:.Symbolic.Alge |
| 2700 | 62 72 61 0a 0a 4d 6f 64 75 6c 61 72 69 74 79 2c 20 4f 62 6a 65 63 74 73 2c 20 61 6e 64 20 53 74 | bra..Modularity,.Objects,.and.St |
| 2720 | 61 74 65 0a 0a 2a 20 33 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 41 73 73 69 67 6e | ate..*.3-1::..............Assign |
| 2740 | 6d 65 6e 74 20 61 6e 64 20 4c 6f 63 61 6c 20 53 74 61 74 65 0a 2a 20 33 2d 32 3a 3a 20 20 20 20 | ment.and.Local.State.*.3-2::.... |
| 2760 | 20 20 20 20 20 20 20 20 20 20 54 68 65 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 4d 6f 64 65 6c 20 | ..........The.Environment.Model. |
| 2780 | 6f 66 20 45 76 61 6c 75 61 74 69 6f 6e 0a 2a 20 33 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 | of.Evaluation.*.3-3::........... |
| 27a0 | 20 20 20 4d 6f 64 65 6c 69 6e 67 20 77 69 74 68 20 4d 75 74 61 62 6c 65 20 44 61 74 61 0a 2a 20 | ...Modeling.with.Mutable.Data.*. |
| 27c0 | 33 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6e 63 75 72 72 65 6e 63 79 3a 20 | 3-4::..............Concurrency:. |
| 27e0 | 54 69 6d 65 20 49 73 20 6f 66 20 74 68 65 20 45 73 73 65 6e 63 65 0a 2a 20 33 2d 35 3a 3a 20 20 | Time.Is.of.the.Essence.*.3-5::.. |
| 2800 | 20 20 20 20 20 20 20 20 20 20 20 20 53 74 72 65 61 6d 73 0a 0a 41 73 73 69 67 6e 6d 65 6e 74 20 | ............Streams..Assignment. |
| 2820 | 61 6e 64 20 4c 6f 63 61 6c 20 53 74 61 74 65 0a 0a 2a 20 33 2d 31 2d 31 3a 3a 20 20 20 20 20 20 | and.Local.State..*.3-1-1::...... |
| 2840 | 20 20 20 20 20 20 4c 6f 63 61 6c 20 53 74 61 74 65 20 56 61 72 69 61 62 6c 65 73 0a 2a 20 33 2d | ......Local.State.Variables.*.3- |
| 2860 | 31 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 42 65 6e 65 66 69 74 73 20 6f 66 | 1-2::............The.Benefits.of |
| 2880 | 20 49 6e 74 72 6f 64 75 63 69 6e 67 20 41 73 73 69 67 6e 6d 65 6e 74 0a 2a 20 33 2d 31 2d 33 3a | .Introducing.Assignment.*.3-1-3: |
| 28a0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 43 6f 73 74 73 20 6f 66 20 49 6e 74 72 6f 64 | :............The.Costs.of.Introd |
| 28c0 | 75 63 69 6e 67 20 41 73 73 69 67 6e 6d 65 6e 74 0a 0a 54 68 65 20 45 6e 76 69 72 6f 6e 6d 65 6e | ucing.Assignment..The.Environmen |
| 28e0 | 74 20 4d 6f 64 65 6c 20 6f 66 20 45 76 61 6c 75 61 74 69 6f 6e 0a 0a 2a 20 33 2d 32 2d 31 3a 3a | t.Model.of.Evaluation..*.3-2-1:: |
| 2900 | 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 52 75 6c 65 73 20 66 6f 72 20 45 76 61 6c 75 61 | ............The.Rules.for.Evalua |
| 2920 | 74 69 6f 6e 0a 2a 20 33 2d 32 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 41 70 70 6c 79 69 | tion.*.3-2-2::............Applyi |
| 2940 | 6e 67 20 53 69 6d 70 6c 65 20 50 72 6f 63 65 64 75 72 65 73 0a 2a 20 33 2d 32 2d 33 3a 3a 20 20 | ng.Simple.Procedures.*.3-2-3::.. |
| 2960 | 20 20 20 20 20 20 20 20 20 20 46 72 61 6d 65 73 20 61 73 20 74 68 65 20 52 65 70 6f 73 69 74 6f | ..........Frames.as.the.Reposito |
| 2980 | 72 79 20 6f 66 20 4c 6f 63 61 6c 20 53 74 61 74 65 0a 2a 20 33 2d 32 2d 34 3a 3a 20 20 20 20 20 | ry.of.Local.State.*.3-2-4::..... |
| 29a0 | 20 20 20 20 20 20 20 49 6e 74 65 72 6e 61 6c 20 44 65 66 69 6e 69 74 69 6f 6e 73 0a 0a 4d 6f 64 | .......Internal.Definitions..Mod |
| 29c0 | 65 6c 69 6e 67 20 77 69 74 68 20 4d 75 74 61 62 6c 65 20 44 61 74 61 0a 0a 2a 20 33 2d 33 2d 31 | eling.with.Mutable.Data..*.3-3-1 |
| 29e0 | 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4d 75 74 61 62 6c 65 20 4c 69 73 74 20 53 74 72 75 63 | ::............Mutable.List.Struc |
| 2a00 | 74 75 72 65 0a 2a 20 33 2d 33 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 52 65 70 72 65 73 | ture.*.3-3-2::............Repres |
| 2a20 | 65 6e 74 69 6e 67 20 51 75 65 75 65 73 0a 2a 20 33 2d 33 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 | enting.Queues.*.3-3-3::......... |
| 2a40 | 20 20 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 54 61 62 6c 65 73 0a 2a 20 33 2d 33 2d 34 3a 3a | ...Representing.Tables.*.3-3-4:: |
| 2a60 | 20 20 20 20 20 20 20 20 20 20 20 20 41 20 53 69 6d 75 6c 61 74 6f 72 20 66 6f 72 20 44 69 67 69 | ............A.Simulator.for.Digi |
| 2a80 | 74 61 6c 20 43 69 72 63 75 69 74 73 0a 2a 20 33 2d 33 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 | tal.Circuits.*.3-3-5::.......... |
| 2aa0 | 20 20 50 72 6f 70 61 67 61 74 69 6f 6e 20 6f 66 20 43 6f 6e 73 74 72 61 69 6e 74 73 0a 0a 43 6f | ..Propagation.of.Constraints..Co |
| 2ac0 | 6e 63 75 72 72 65 6e 63 79 3a 20 54 69 6d 65 20 49 73 20 6f 66 20 74 68 65 20 45 73 73 65 6e 63 | ncurrency:.Time.Is.of.the.Essenc |
| 2ae0 | 65 0a 0a 2a 20 33 2d 34 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 4e 61 74 75 | e..*.3-4-1::............The.Natu |
| 2b00 | 72 65 20 6f 66 20 54 69 6d 65 20 69 6e 20 43 6f 6e 63 75 72 72 65 6e 74 20 53 79 73 74 65 6d 73 | re.of.Time.in.Concurrent.Systems |
| 2b20 | 0a 2a 20 33 2d 34 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4d 65 63 68 61 6e 69 73 6d 73 | .*.3-4-2::............Mechanisms |
| 2b40 | 20 66 6f 72 20 43 6f 6e 74 72 6f 6c 6c 69 6e 67 20 43 6f 6e 63 75 72 72 65 6e 63 79 0a 0a 53 74 | .for.Controlling.Concurrency..St |
| 2b60 | 72 65 61 6d 73 0a 0a 2a 20 33 2d 35 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 53 74 72 65 | reams..*.3-5-1::............Stre |
| 2b80 | 61 6d 73 20 41 72 65 20 44 65 6c 61 79 65 64 20 4c 69 73 74 73 0a 2a 20 33 2d 35 2d 32 3a 3a 20 | ams.Are.Delayed.Lists.*.3-5-2::. |
| 2ba0 | 20 20 20 20 20 20 20 20 20 20 20 49 6e 66 69 6e 69 74 65 20 53 74 72 65 61 6d 73 0a 2a 20 33 2d | ...........Infinite.Streams.*.3- |
| 2bc0 | 35 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 70 6c 6f 69 74 69 6e 67 20 74 68 65 20 | 5-3::............Exploiting.the. |
| 2be0 | 53 74 72 65 61 6d 20 50 61 72 61 64 69 67 6d 0a 2a 20 33 2d 35 2d 34 3a 3a 20 20 20 20 20 20 20 | Stream.Paradigm.*.3-5-4::....... |
| 2c00 | 20 20 20 20 20 53 74 72 65 61 6d 73 20 61 6e 64 20 44 65 6c 61 79 65 64 20 45 76 61 6c 75 61 74 | .....Streams.and.Delayed.Evaluat |
| 2c20 | 69 6f 6e 0a 2a 20 33 2d 35 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4d 6f 64 75 6c 61 72 | ion.*.3-5-5::............Modular |
| 2c40 | 69 74 79 20 6f 66 20 46 75 6e 63 74 69 6f 6e 61 6c 20 50 72 6f 67 72 61 6d 73 20 61 6e 64 20 4d | ity.of.Functional.Programs.and.M |
| 2c60 | 6f 64 75 6c 61 72 69 74 79 20 6f 66 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | odularity.of.................... |
| 2c80 | 20 20 4f 62 6a 65 63 74 73 0a 0a 4d 65 74 61 6c 69 6e 67 75 69 73 74 69 63 20 41 62 73 74 72 61 | ..Objects..Metalinguistic.Abstra |
| 2ca0 | 63 74 69 6f 6e 0a 0a 2a 20 34 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 | ction..*.4-1::..............The. |
| 2cc0 | 4d 65 74 61 63 69 72 63 75 6c 61 72 20 45 76 61 6c 75 61 74 6f 72 0a 2a 20 34 2d 32 3a 3a 20 20 | Metacircular.Evaluator.*.4-2::.. |
| 2ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 56 61 72 69 61 74 69 6f 6e 73 20 6f 6e 20 61 20 53 63 68 65 | ............Variations.on.a.Sche |
| 2d00 | 6d 65 20 2d 2d 20 4c 61 7a 79 20 45 76 61 6c 75 61 74 69 6f 6e 0a 2a 20 34 2d 33 3a 3a 20 20 20 | me.--.Lazy.Evaluation.*.4-3::... |
| 2d20 | 20 20 20 20 20 20 20 20 20 20 20 56 61 72 69 61 74 69 6f 6e 73 20 6f 6e 20 61 20 53 63 68 65 6d | ...........Variations.on.a.Schem |
| 2d40 | 65 20 2d 2d 20 4e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 43 6f 6d 70 75 74 69 6e 67 0a | e.--.Nondeterministic.Computing. |
| 2d60 | 2a 20 34 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4c 6f 67 69 63 20 50 72 6f 67 72 | *.4-4::..............Logic.Progr |
| 2d80 | 61 6d 6d 69 6e 67 0a 0a 54 68 65 20 4d 65 74 61 63 69 72 63 75 6c 61 72 20 45 76 61 6c 75 61 74 | amming..The.Metacircular.Evaluat |
| 2da0 | 6f 72 0a 0a 2a 20 34 2d 31 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 43 6f 72 | or..*.4-1-1::............The.Cor |
| 2dc0 | 65 20 6f 66 20 74 68 65 20 45 76 61 6c 75 61 74 6f 72 0a 2a 20 34 2d 31 2d 32 3a 3a 20 20 20 20 | e.of.the.Evaluator.*.4-1-2::.... |
| 2de0 | 20 20 20 20 20 20 20 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 45 78 70 72 65 73 73 69 6f 6e 73 | ........Representing.Expressions |
| 2e00 | 0a 2a 20 34 2d 31 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 76 61 6c 75 61 74 6f 72 20 | .*.4-1-3::............Evaluator. |
| 2e20 | 44 61 74 61 20 53 74 72 75 63 74 75 72 65 73 0a 2a 20 34 2d 31 2d 34 3a 3a 20 20 20 20 20 20 20 | Data.Structures.*.4-1-4::....... |
| 2e40 | 20 20 20 20 20 52 75 6e 6e 69 6e 67 20 74 68 65 20 45 76 61 6c 75 61 74 6f 72 20 61 73 20 61 20 | .....Running.the.Evaluator.as.a. |
| 2e60 | 50 72 6f 67 72 61 6d 0a 2a 20 34 2d 31 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 44 61 74 | Program.*.4-1-5::............Dat |
| 2e80 | 61 20 61 73 20 50 72 6f 67 72 61 6d 73 0a 2a 20 34 2d 31 2d 36 3a 3a 20 20 20 20 20 20 20 20 20 | a.as.Programs.*.4-1-6::......... |
| 2ea0 | 20 20 20 49 6e 74 65 72 6e 61 6c 20 44 65 66 69 6e 69 74 69 6f 6e 73 0a 2a 20 34 2d 31 2d 37 3a | ...Internal.Definitions.*.4-1-7: |
| 2ec0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 53 65 70 61 72 61 74 69 6e 67 20 53 79 6e 74 61 63 74 69 | :............Separating.Syntacti |
| 2ee0 | 63 20 41 6e 61 6c 79 73 69 73 20 66 72 6f 6d 20 45 78 65 63 75 74 69 6f 6e 0a 0a 56 61 72 69 61 | c.Analysis.from.Execution..Varia |
| 2f00 | 74 69 6f 6e 73 20 6f 6e 20 61 20 53 63 68 65 6d 65 20 2d 2d 20 4c 61 7a 79 20 45 76 61 6c 75 61 | tions.on.a.Scheme.--.Lazy.Evalua |
| 2f20 | 74 69 6f 6e 0a 0a 2a 20 34 2d 32 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4e 6f 72 6d 61 | tion..*.4-2-1::............Norma |
| 2f40 | 6c 20 4f 72 64 65 72 20 61 6e 64 20 41 70 70 6c 69 63 61 74 69 76 65 20 4f 72 64 65 72 0a 2a 20 | l.Order.and.Applicative.Order.*. |
| 2f60 | 34 2d 32 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 41 6e 20 49 6e 74 65 72 70 72 65 74 65 | 4-2-2::............An.Interprete |
| 2f80 | 72 20 77 69 74 68 20 4c 61 7a 79 20 45 76 61 6c 75 61 74 69 6f 6e 0a 2a 20 34 2d 32 2d 33 3a 3a | r.with.Lazy.Evaluation.*.4-2-3:: |
| 2fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 53 74 72 65 61 6d 73 20 61 73 20 4c 61 7a 79 20 4c 69 73 74 | ............Streams.as.Lazy.List |
| 2fc0 | 73 0a 0a 56 61 72 69 61 74 69 6f 6e 73 20 6f 6e 20 61 20 53 63 68 65 6d 65 20 2d 2d 20 4e 6f 6e | s..Variations.on.a.Scheme.--.Non |
| 2fe0 | 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 43 6f 6d 70 75 74 69 6e 67 0a 0a 2a 20 34 2d 33 2d 31 | deterministic.Computing..*.4-3-1 |
| 3000 | 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 41 6d 62 20 61 6e 64 20 53 65 61 72 63 68 0a 2a 20 34 | ::............Amb.and.Search.*.4 |
| 3020 | 2d 33 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 73 20 6f 66 20 4e 6f | -3-2::............Examples.of.No |
| 3040 | 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 50 72 6f 67 72 61 6d 73 0a 2a 20 34 2d 33 2d 33 3a | ndeterministic.Programs.*.4-3-3: |
| 3060 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 49 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 60 41 | :............Implementing.the.`A |
| 3080 | 6d 62 27 20 45 76 61 6c 75 61 74 6f 72 0a 0a 4c 6f 67 69 63 20 50 72 6f 67 72 61 6d 6d 69 6e 67 | mb'.Evaluator..Logic.Programming |
| 30a0 | 0a 0a 2a 20 34 2d 34 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 44 65 64 75 63 74 69 76 65 | ..*.4-4-1::............Deductive |
| 30c0 | 20 49 6e 66 6f 72 6d 61 74 69 6f 6e 20 52 65 74 72 69 65 76 61 6c 0a 2a 20 34 2d 34 2d 32 3a 3a | .Information.Retrieval.*.4-4-2:: |
| 30e0 | 20 20 20 20 20 20 20 20 20 20 20 20 48 6f 77 20 74 68 65 20 51 75 65 72 79 20 53 79 73 74 65 6d | ............How.the.Query.System |
| 3100 | 20 57 6f 72 6b 73 0a 2a 20 34 2d 34 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 49 73 20 4c | .Works.*.4-4-3::............Is.L |
| 3120 | 6f 67 69 63 20 50 72 6f 67 72 61 6d 6d 69 6e 67 20 4d 61 74 68 65 6d 61 74 69 63 61 6c 20 4c 6f | ogic.Programming.Mathematical.Lo |
| 3140 | 67 69 63 3f 0a 2a 20 34 2d 34 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 49 6d 70 6c 65 6d | gic?.*.4-4-4::............Implem |
| 3160 | 65 6e 74 69 6e 67 20 74 68 65 20 51 75 65 72 79 20 53 79 73 74 65 6d 0a 0a 49 6d 70 6c 65 6d 65 | enting.the.Query.System..Impleme |
| 3180 | 6e 74 69 6e 67 20 74 68 65 20 51 75 65 72 79 20 53 79 73 74 65 6d 0a 0a 2a 20 34 2d 34 2d 34 2d | nting.the.Query.System..*.4-4-4- |
| 31a0 | 31 3a 3a 20 20 20 20 20 20 20 20 20 20 54 68 65 20 44 72 69 76 65 72 20 4c 6f 6f 70 20 61 6e 64 | 1::..........The.Driver.Loop.and |
| 31c0 | 20 49 6e 73 74 61 6e 74 69 61 74 69 6f 6e 0a 2a 20 34 2d 34 2d 34 2d 32 3a 3a 20 20 20 20 20 20 | .Instantiation.*.4-4-4-2::...... |
| 31e0 | 20 20 20 20 54 68 65 20 45 76 61 6c 75 61 74 6f 72 0a 2a 20 34 2d 34 2d 34 2d 33 3a 3a 20 20 20 | ....The.Evaluator.*.4-4-4-3::... |
| 3200 | 20 20 20 20 20 20 20 46 69 6e 64 69 6e 67 20 41 73 73 65 72 74 69 6f 6e 73 20 62 79 20 50 61 74 | .......Finding.Assertions.by.Pat |
| 3220 | 74 65 72 6e 20 4d 61 74 63 68 69 6e 67 0a 2a 20 34 2d 34 2d 34 2d 34 3a 3a 20 20 20 20 20 20 20 | tern.Matching.*.4-4-4-4::....... |
| 3240 | 20 20 20 52 75 6c 65 73 20 61 6e 64 20 55 6e 69 66 69 63 61 74 69 6f 6e 0a 2a 20 34 2d 34 2d 34 | ...Rules.and.Unification.*.4-4-4 |
| 3260 | 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 4d 61 69 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 44 61 | -5::..........Maintaining.the.Da |
| 3280 | 74 61 20 42 61 73 65 0a 2a 20 34 2d 34 2d 34 2d 36 3a 3a 20 20 20 20 20 20 20 20 20 20 53 74 72 | ta.Base.*.4-4-4-6::..........Str |
| 32a0 | 65 61 6d 20 4f 70 65 72 61 74 69 6f 6e 73 0a 2a 20 34 2d 34 2d 34 2d 37 3a 3a 20 20 20 20 20 20 | eam.Operations.*.4-4-4-7::...... |
| 32c0 | 20 20 20 20 51 75 65 72 79 20 53 79 6e 74 61 78 20 50 72 6f 63 65 64 75 72 65 73 0a 2a 20 34 2d | ....Query.Syntax.Procedures.*.4- |
| 32e0 | 34 2d 34 2d 38 3a 3a 20 20 20 20 20 20 20 20 20 20 46 72 61 6d 65 73 20 61 6e 64 20 42 69 6e 64 | 4-4-8::..........Frames.and.Bind |
| 3300 | 69 6e 67 73 0a 0a 43 6f 6d 70 75 74 69 6e 67 20 77 69 74 68 20 52 65 67 69 73 74 65 72 20 4d 61 | ings..Computing.with.Register.Ma |
| 3320 | 63 68 69 6e 65 73 0a 0a 2a 20 35 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 44 65 73 | chines..*.5-1::..............Des |
| 3340 | 69 67 6e 69 6e 67 20 52 65 67 69 73 74 65 72 20 4d 61 63 68 69 6e 65 73 0a 2a 20 35 2d 32 3a 3a | igning.Register.Machines.*.5-2:: |
| 3360 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 41 20 52 65 67 69 73 74 65 72 2d 4d 61 63 68 69 6e 65 | ..............A.Register-Machine |
| 3380 | 20 53 69 6d 75 6c 61 74 6f 72 0a 2a 20 35 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .Simulator.*.5-3::.............. |
| 33a0 | 53 74 6f 72 61 67 65 20 41 6c 6c 6f 63 61 74 69 6f 6e 20 61 6e 64 20 47 61 72 62 61 67 65 20 43 | Storage.Allocation.and.Garbage.C |
| 33c0 | 6f 6c 6c 65 63 74 69 6f 6e 0a 2a 20 35 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54 | ollection.*.5-4::..............T |
| 33e0 | 68 65 20 45 78 70 6c 69 63 69 74 2d 43 6f 6e 74 72 6f 6c 20 45 76 61 6c 75 61 74 6f 72 0a 2a 20 | he.Explicit-Control.Evaluator.*. |
| 3400 | 35 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6d 70 69 6c 61 74 69 6f 6e 0a 0a | 5-5::..............Compilation.. |
| 3420 | 44 65 73 69 67 6e 69 6e 67 20 52 65 67 69 73 74 65 72 20 4d 61 63 68 69 6e 65 73 0a 0a 2a 20 35 | Designing.Register.Machines..*.5 |
| 3440 | 2d 31 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 41 20 4c 61 6e 67 75 61 67 65 20 66 6f 72 | -1-1::............A.Language.for |
| 3460 | 20 44 65 73 63 72 69 62 69 6e 67 20 52 65 67 69 73 74 65 72 20 4d 61 63 68 69 6e 65 73 0a 2a 20 | .Describing.Register.Machines.*. |
| 3480 | 35 2d 31 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 41 62 73 74 72 61 63 74 69 6f 6e 20 69 | 5-1-2::............Abstraction.i |
| 34a0 | 6e 20 4d 61 63 68 69 6e 65 20 44 65 73 69 67 6e 0a 2a 20 35 2d 31 2d 33 3a 3a 20 20 20 20 20 20 | n.Machine.Design.*.5-1-3::...... |
| 34c0 | 20 20 20 20 20 20 53 75 62 72 6f 75 74 69 6e 65 73 0a 2a 20 35 2d 31 2d 34 3a 3a 20 20 20 20 20 | ......Subroutines.*.5-1-4::..... |
| 34e0 | 20 20 20 20 20 20 20 55 73 69 6e 67 20 61 20 53 74 61 63 6b 20 74 6f 20 49 6d 70 6c 65 6d 65 6e | .......Using.a.Stack.to.Implemen |
| 3500 | 74 20 52 65 63 75 72 73 69 6f 6e 0a 2a 20 35 2d 31 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 | t.Recursion.*.5-1-5::........... |
| 3520 | 20 49 6e 73 74 72 75 63 74 69 6f 6e 20 53 75 6d 6d 61 72 79 0a 0a 41 20 52 65 67 69 73 74 65 72 | .Instruction.Summary..A.Register |
| 3540 | 2d 4d 61 63 68 69 6e 65 20 53 69 6d 75 6c 61 74 6f 72 0a 0a 2a 20 35 2d 32 2d 31 3a 3a 20 20 20 | -Machine.Simulator..*.5-2-1::... |
| 3560 | 20 20 20 20 20 20 20 20 20 54 68 65 20 4d 61 63 68 69 6e 65 20 4d 6f 64 65 6c 0a 2a 20 35 2d 32 | .........The.Machine.Model.*.5-2 |
| 3580 | 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 41 73 73 65 6d 62 6c 65 72 0a 2a 20 | -2::............The.Assembler.*. |
| 35a0 | 35 2d 32 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 47 65 6e 65 72 61 74 69 6e 67 20 45 78 | 5-2-3::............Generating.Ex |
| 35c0 | 65 63 75 74 69 6f 6e 20 50 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 49 6e 73 74 72 75 63 74 69 | ecution.Procedures.for.Instructi |
| 35e0 | 6f 6e 73 0a 2a 20 35 2d 32 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4d 6f 6e 69 74 6f 72 | ons.*.5-2-4::............Monitor |
| 3600 | 69 6e 67 20 4d 61 63 68 69 6e 65 20 50 65 72 66 6f 72 6d 61 6e 63 65 0a 0a 53 74 6f 72 61 67 65 | ing.Machine.Performance..Storage |
| 3620 | 20 41 6c 6c 6f 63 61 74 69 6f 6e 20 61 6e 64 20 47 61 72 62 61 67 65 20 43 6f 6c 6c 65 63 74 69 | .Allocation.and.Garbage.Collecti |
| 3640 | 6f 6e 0a 0a 2a 20 35 2d 33 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4d 65 6d 6f 72 79 20 | on..*.5-3-1::............Memory. |
| 3660 | 61 73 20 56 65 63 74 6f 72 73 0a 2a 20 35 2d 33 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 | as.Vectors.*.5-3-2::............ |
| 3680 | 4d 61 69 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 49 6c 6c 75 73 69 6f 6e 20 6f 66 20 49 6e 66 69 | Maintaining.the.Illusion.of.Infi |
| 36a0 | 6e 69 74 65 20 4d 65 6d 6f 72 79 0a 0a 52 65 67 69 73 74 65 72 73 20 61 6e 64 20 6f 70 65 72 61 | nite.Memory..Registers.and.opera |
| 36c0 | 74 69 6f 6e 73 0a 0a 2a 20 35 2d 34 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 | tions..*.5-4-1::............The. |
| 36e0 | 43 6f 72 65 20 6f 66 20 74 68 65 20 45 78 70 6c 69 63 69 74 2d 43 6f 6e 74 72 6f 6c 20 45 76 61 | Core.of.the.Explicit-Control.Eva |
| 3700 | 6c 75 61 74 6f 72 0a 2a 20 35 2d 34 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 53 65 71 75 | luator.*.5-4-2::............Sequ |
| 3720 | 65 6e 63 65 20 45 76 61 6c 75 61 74 69 6f 6e 20 61 6e 64 20 54 61 69 6c 20 52 65 63 75 72 73 69 | ence.Evaluation.and.Tail.Recursi |
| 3740 | 6f 6e 0a 2a 20 35 2d 34 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6e 64 69 74 69 6f | on.*.5-4-3::............Conditio |
| 3760 | 6e 61 6c 73 2c 20 41 73 73 69 67 6e 6d 65 6e 74 73 2c 20 61 6e 64 20 44 65 66 69 6e 69 74 69 6f | nals,.Assignments,.and.Definitio |
| 3780 | 6e 73 0a 2a 20 35 2d 34 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 52 75 6e 6e 69 6e 67 20 | ns.*.5-4-4::............Running. |
| 37a0 | 74 68 65 20 45 76 61 6c 75 61 74 6f 72 0a 0a 41 6e 20 6f 76 65 72 76 69 65 77 20 6f 66 20 74 68 | the.Evaluator..An.overview.of.th |
| 37c0 | 65 20 63 6f 6d 70 69 6c 65 72 0a 0a 2a 20 35 2d 35 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 | e.compiler..*.5-5-1::........... |
| 37e0 | 20 53 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 43 6f 6d 70 69 6c 65 72 0a 2a 20 35 2d 35 | .Structure.of.the.Compiler.*.5-5 |
| 3800 | 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6d 70 69 6c 69 6e 67 20 45 78 70 72 65 73 | -2::............Compiling.Expres |
| 3820 | 73 69 6f 6e 73 0a 2a 20 35 2d 35 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6d 70 69 | sions.*.5-5-3::............Compi |
| 3840 | 6c 69 6e 67 20 43 6f 6d 62 69 6e 61 74 69 6f 6e 73 0a 2a 20 35 2d 35 2d 34 3a 3a 20 20 20 20 20 | ling.Combinations.*.5-5-4::..... |
| 3860 | 20 20 20 20 20 20 20 43 6f 6d 62 69 6e 69 6e 67 20 49 6e 73 74 72 75 63 74 69 6f 6e 20 53 65 71 | .......Combining.Instruction.Seq |
| 3880 | 75 65 6e 63 65 73 0a 2a 20 35 2d 35 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 41 6e 20 45 | uences.*.5-5-5::............An.E |
| 38a0 | 78 61 6d 70 6c 65 20 6f 66 20 43 6f 6d 70 69 6c 65 64 20 43 6f 64 65 0a 2a 20 35 2d 35 2d 36 3a | xample.of.Compiled.Code.*.5-5-6: |
| 38c0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 4c 65 78 69 63 61 6c 20 41 64 64 72 65 73 73 69 6e 67 0a | :............Lexical.Addressing. |
| 38e0 | 2a 20 35 2d 35 2d 37 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 49 6e 74 65 72 66 61 63 69 6e 67 | *.5-5-7::............Interfacing |
| 3900 | 20 43 6f 6d 70 69 6c 65 64 20 43 6f 64 65 20 74 6f 20 74 68 65 20 45 76 61 6c 75 61 74 6f 72 0a | .Compiled.Code.to.the.Evaluator. |
| 3920 | 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 55 54 46 2c 20 | ...File:.sicp.info,..Node:.UTF,. |
| 3940 | 20 4e 65 78 74 3a 20 44 65 64 69 63 61 74 69 6f 6e 2c 20 20 50 72 65 76 3a 20 54 6f 70 2c 20 20 | .Next:.Dedication,..Prev:.Top,.. |
| 3960 | 55 70 3a 20 54 6f 70 0a 0a 55 6e 6f 66 66 69 63 69 61 6c 20 54 65 78 69 6e 66 6f 20 46 6f 72 6d | Up:.Top..Unofficial.Texinfo.Form |
| 3980 | 61 74 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 0a 54 68 | at.*************************..Th |
| 39a0 | 69 73 20 69 73 20 74 68 65 20 73 65 63 6f 6e 64 20 65 64 69 74 69 6f 6e 20 53 49 43 50 20 62 6f | is.is.the.second.edition.SICP.bo |
| 39c0 | 6f 6b 2c 20 66 72 6f 6d 20 55 6e 6f 66 66 69 63 69 61 6c 20 54 65 78 69 6e 66 6f 20 46 6f 72 6d | ok,.from.Unofficial.Texinfo.Form |
| 39e0 | 61 74 2e 0a 0a 20 20 20 59 6f 75 20 61 72 65 20 70 72 6f 62 61 62 6c 79 20 72 65 61 64 69 6e 67 | at......You.are.probably.reading |
| 3a00 | 20 69 74 20 69 6e 20 61 6e 20 49 6e 66 6f 20 68 79 70 65 72 74 65 78 74 20 62 72 6f 77 73 65 72 | .it.in.an.Info.hypertext.browser |
| 3a20 | 2c 20 73 75 63 68 20 61 73 0a 74 68 65 20 49 6e 66 6f 20 6d 6f 64 65 20 6f 66 20 45 6d 61 63 73 | ,.such.as.the.Info.mode.of.Emacs |
| 3a40 | 2e 20 20 59 6f 75 20 6d 69 67 68 74 20 61 6c 74 65 72 6e 61 74 69 76 65 6c 79 20 62 65 20 72 65 | ...You.might.alternatively.be.re |
| 3a60 | 61 64 69 6e 67 20 69 74 0a 54 65 58 2d 66 6f 72 6d 61 74 74 65 64 20 6f 6e 20 79 6f 75 72 20 73 | ading.it.TeX-formatted.on.your.s |
| 3a80 | 63 72 65 65 6e 20 6f 72 20 70 72 69 6e 74 65 72 2c 20 74 68 6f 75 67 68 20 74 68 61 74 20 77 6f | creen.or.printer,.though.that.wo |
| 3aa0 | 75 6c 64 20 62 65 20 73 69 6c 6c 79 2e 0a 41 6e 64 2c 20 69 66 20 70 72 69 6e 74 65 64 2c 20 65 | uld.be.silly..And,.if.printed,.e |
| 3ac0 | 78 70 65 6e 73 69 76 65 2e 0a 0a 20 20 20 54 68 65 20 66 72 65 65 6c 79 2d 64 69 73 74 72 69 62 | xpensive......The.freely-distrib |
| 3ae0 | 75 74 65 64 20 6f 66 66 69 63 69 61 6c 20 48 54 4d 4c 2d 61 6e 64 2d 47 49 46 20 66 6f 72 6d 61 | uted.official.HTML-and-GIF.forma |
| 3b00 | 74 20 77 61 73 20 66 69 72 73 74 0a 63 6f 6e 76 65 72 74 65 64 20 70 65 72 73 6f 6e 75 61 6c 6c | t.was.first.converted.personuall |
| 3b20 | 79 20 74 6f 20 55 6e 6f 66 66 69 63 69 61 6c 20 54 65 78 69 6e 66 6f 20 46 6f 72 6d 61 74 20 28 | y.to.Unofficial.Texinfo.Format.( |
| 3b40 | 55 54 46 29 20 76 65 72 73 69 6f 6e 20 31 20 62 79 0a 4c 79 73 73 61 20 41 79 74 68 20 64 75 72 | UTF).version.1.by.Lyssa.Ayth.dur |
| 3b60 | 69 6e 67 20 61 20 6c 6f 6e 67 20 45 6d 61 63 73 20 6c 6f 76 65 66 65 73 74 20 77 65 65 6b 65 6e | ing.a.long.Emacs.lovefest.weeken |
| 3b80 | 64 20 69 6e 20 41 70 72 69 6c 2c 20 32 30 30 31 2e 0a 0a 20 20 20 54 68 65 20 55 54 46 20 69 73 | d.in.April,.2001......The.UTF.is |
| 3ba0 | 20 65 61 73 69 65 72 20 74 6f 20 73 65 61 72 63 68 20 74 68 61 6e 20 74 68 65 20 48 54 4d 4c 20 | .easier.to.search.than.the.HTML. |
| 3bc0 | 66 6f 72 6d 61 74 2e 20 20 49 74 20 69 73 20 61 6c 73 6f 20 6d 75 63 68 0a 6d 6f 72 65 20 61 63 | format...It.is.also.much.more.ac |
| 3be0 | 63 65 73 73 69 62 6c 65 20 74 6f 20 70 65 6f 70 6c 65 20 72 75 6e 6e 69 6e 67 20 6f 6e 20 6d 6f | cessible.to.people.running.on.mo |
| 3c00 | 64 65 73 74 20 63 6f 6d 70 75 74 65 72 73 2c 20 73 75 63 68 20 61 73 20 64 6f 6e 61 74 65 64 0a | dest.computers,.such.as.donated. |
| 3c20 | 27 33 38 36 2d 62 61 73 65 64 20 50 43 73 2e 20 20 41 20 33 38 36 20 63 61 6e 2c 20 69 6e 20 74 | '386-based.PCs...A.386.can,.in.t |
| 3c40 | 68 65 6f 72 79 2c 20 72 75 6e 20 4c 69 6e 75 78 2c 20 45 6d 61 63 73 2c 20 61 6e 64 20 61 20 53 | heory,.run.Linux,.Emacs,.and.a.S |
| 3c60 | 63 68 65 6d 65 0a 69 6e 74 65 72 70 72 65 74 65 72 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 6c 79 | cheme.interpreter.simultaneously |
| 3c80 | 2c 20 62 75 74 20 6d 6f 73 74 20 33 38 36 73 20 70 72 6f 62 61 62 6c 79 20 63 61 6e 27 74 20 61 | ,.but.most.386s.probably.can't.a |
| 3ca0 | 6c 73 6f 20 72 75 6e 20 62 6f 74 68 0a 4e 65 74 73 63 61 70 65 20 61 6e 64 20 74 68 65 20 6e 65 | lso.run.both.Netscape.and.the.ne |
| 3cc0 | 63 65 73 73 61 72 79 20 58 20 57 69 6e 64 6f 77 20 53 79 73 74 65 6d 20 77 69 74 68 6f 75 74 20 | cessary.X.Window.System.without. |
| 3ce0 | 70 72 65 6d 61 74 75 72 65 6c 79 0a 69 6e 74 72 6f 64 75 63 69 6e 67 20 62 75 64 64 69 6e 67 20 | prematurely.introducing.budding. |
| 3d00 | 79 6f 75 6e 67 20 75 6e 64 65 72 66 75 6e 64 65 64 20 68 61 63 6b 65 72 73 20 74 6f 20 74 68 65 | young.underfunded.hackers.to.the |
| 3d20 | 20 63 6f 6e 63 65 70 74 20 6f 66 20 22 74 68 72 61 73 68 69 6e 67 22 2e 0a 55 54 46 20 63 61 6e | .concept.of."thrashing"..UTF.can |
| 3d40 | 20 61 6c 73 6f 20 66 69 74 20 75 6e 63 6f 6d 70 72 65 73 73 65 64 20 6f 6e 20 61 20 31 2e 34 34 | .also.fit.uncompressed.on.a.1.44 |
| 3d60 | 4d 42 20 66 6c 6f 70 70 79 20 64 69 73 6b 65 74 74 65 2c 20 77 68 69 63 68 20 6d 61 79 0a 63 6f | MB.floppy.diskette,.which.may.co |
| 3d80 | 6d 65 20 69 6e 20 68 61 6e 64 79 20 66 6f 72 20 69 6e 73 74 61 6c 6c 69 6e 67 20 55 54 46 20 6f | me.in.handy.for.installing.UTF.o |
| 3da0 | 6e 20 50 43 73 20 74 68 61 74 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 49 6e 74 65 72 6e 65 74 20 | n.PCs.that.do.not.have.Internet. |
| 3dc0 | 6f 72 0a 4c 41 4e 20 61 63 63 65 73 73 2e 0a 0a 20 20 20 54 68 65 20 54 65 78 69 6e 66 6f 20 63 | or.LAN.access......The.Texinfo.c |
| 3de0 | 6f 6e 76 65 72 73 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 61 20 73 74 72 61 69 67 68 74 20 74 72 | onversion.has.been.a.straight.tr |
| 3e00 | 61 6e 73 6c 69 74 65 72 61 74 69 6f 6e 2c 20 74 6f 20 74 68 65 0a 65 78 74 65 6e 74 20 70 6f 73 | ansliteration,.to.the.extent.pos |
| 3e20 | 73 69 62 6c 65 2e 20 20 4c 69 6b 65 20 74 68 65 20 54 65 58 2d 74 6f 2d 48 54 4d 4c 20 63 6f 6e | sible...Like.the.TeX-to-HTML.con |
| 3e40 | 76 65 72 73 69 6f 6e 2c 20 74 68 69 73 20 77 61 73 20 6e 6f 74 20 77 69 74 68 6f 75 74 0a 73 6f | version,.this.was.not.without.so |
| 3e60 | 6d 65 20 69 6e 74 72 6f 64 75 63 74 69 6f 6e 20 6f 66 20 62 72 65 61 6b 61 67 65 2e 20 20 49 6e | me.introduction.of.breakage...In |
| 3e80 | 20 74 68 65 20 63 61 73 65 20 6f 66 20 55 6e 6f 66 66 69 63 69 61 6c 20 54 65 78 69 6e 66 6f 0a | .the.case.of.Unofficial.Texinfo. |
| 3ea0 | 46 6f 72 6d 61 74 2c 20 66 69 67 75 72 65 73 20 68 61 76 65 20 73 75 66 66 65 72 65 64 20 61 6e | Format,.figures.have.suffered.an |
| 3ec0 | 20 61 6d 61 74 65 75 72 69 73 68 20 72 65 73 75 72 72 65 63 74 69 6f 6e 20 6f 66 20 74 68 65 20 | .amateurish.resurrection.of.the. |
| 3ee0 | 6c 6f 73 74 0a 61 72 74 20 6f 66 20 41 53 43 49 49 20 61 72 74 2e 20 20 41 6c 73 6f 2c 20 69 74 | lost.art.of.ASCII.art...Also,.it |
| 3f00 | 27 73 20 71 75 69 74 65 20 70 6f 73 73 69 62 6c 65 20 74 68 61 74 20 73 6f 6d 65 20 65 72 72 6f | 's.quite.possible.that.some.erro |
| 3f20 | 72 73 20 6f 66 0a 61 6d 62 69 67 75 69 74 79 20 77 65 72 65 20 69 6e 74 72 6f 64 75 63 65 64 20 | rs.of.ambiguity.were.introduced. |
| 3f40 | 64 75 72 69 6e 67 20 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e 20 6f 66 20 73 6f 6d 65 20 6f 66 | during.the.conversion.of.some.of |
| 3f60 | 20 74 68 65 20 63 6f 70 69 6f 75 73 0a 73 75 70 65 72 73 63 72 69 70 74 73 20 28 60 5e 27 29 20 | .the.copious.superscripts.(`^'). |
| 3f80 | 61 6e 64 20 73 75 62 73 63 72 69 70 74 73 20 28 60 5f 27 29 2e 20 20 44 69 76 69 6e 69 6e 67 20 | and.subscripts.(`_')...Divining. |
| 3fa0 | 5f 77 68 69 63 68 5f 20 68 61 73 20 62 65 65 6e 0a 6c 65 66 74 20 61 73 20 61 6e 20 65 78 65 72 | _which_.has.been.left.as.an.exer |
| 3fc0 | 63 69 73 65 20 74 6f 20 74 68 65 20 72 65 61 64 65 72 2e 20 20 42 75 74 20 61 74 20 6c 65 61 73 | cise.to.the.reader...But.at.leas |
| 3fe0 | 74 20 77 65 20 64 6f 6e 27 74 20 70 75 74 20 6f 75 72 20 62 72 61 76 65 0a 61 73 74 72 6f 6e 61 | t.we.don't.put.our.brave.astrona |
| 4000 | 75 74 73 20 61 74 20 72 69 73 6b 20 62 79 20 65 6e 63 6f 64 69 6e 67 20 74 68 65 20 5f 67 72 65 | uts.at.risk.by.encoding.the._gre |
| 4020 | 61 74 65 72 2d 74 68 61 6e 2d 6f 72 2d 65 71 75 61 6c 5f 20 73 79 6d 62 6f 6c 20 61 73 0a 60 3c | ater-than-or-equal_.symbol.as.`< |
| 4040 | 75 3e 26 67 74 3b 3c 2f 75 3e 27 2e 0a 0a 20 20 20 49 66 20 79 6f 75 20 6d 6f 64 69 66 79 20 60 | u>></u>'......If.you.modify.` |
| 4060 | 73 69 63 70 2e 74 65 78 69 27 20 74 6f 20 63 6f 72 72 65 63 74 20 65 72 72 6f 72 73 20 6f 72 20 | sicp.texi'.to.correct.errors.or. |
| 4080 | 69 6d 70 72 6f 76 65 20 74 68 65 20 41 53 43 49 49 0a 61 72 74 2c 20 74 68 65 6e 20 75 70 64 61 | improve.the.ASCII.art,.then.upda |
| 40a0 | 74 65 20 74 68 65 20 60 40 73 65 74 20 75 74 66 76 65 72 73 69 6f 6e 20 32 2e 6e 65 69 6c 76 61 | te.the.`@set.utfversion.2.neilva |
| 40c0 | 6e 64 79 6b 65 34 27 20 6c 69 6e 65 20 74 6f 20 72 65 66 6c 65 63 74 0a 79 6f 75 72 20 64 65 6c | ndyke4'.line.to.reflect.your.del |
| 40e0 | 74 61 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 79 6f 75 20 73 74 61 72 74 65 64 | ta...For.example,.if.you.started |
| 4100 | 20 77 69 74 68 20 4c 79 74 68 61 27 73 20 76 65 72 73 69 6f 6e 20 60 31 27 2c 20 61 6e 64 0a 79 | .with.Lytha's.version.`1',.and.y |
| 4120 | 6f 75 72 20 6e 61 6d 65 20 69 73 20 42 6f 62 2c 20 74 68 65 6e 20 79 6f 75 20 63 6f 75 6c 64 20 | our.name.is.Bob,.then.you.could. |
| 4140 | 6e 61 6d 65 20 79 6f 75 72 20 73 75 63 63 65 73 73 69 76 65 20 76 65 72 73 69 6f 6e 73 0a 60 31 | name.your.successive.versions.`1 |
| 4160 | 2e 62 6f 62 31 27 2c 20 60 31 2e 62 6f 62 32 27 2c 20 2e 2e 2e 20 60 31 2e 62 6f 62 6e 27 2e 20 | .bob1',.`1.bob2',.....`1.bobn'.. |
| 4180 | 20 41 6c 73 6f 20 75 70 64 61 74 65 20 60 75 74 66 76 65 72 73 69 6f 6e 64 61 74 65 27 2e 20 20 | .Also.update.`utfversiondate'... |
| 41a0 | 49 66 0a 79 6f 75 20 77 61 6e 74 20 74 6f 20 64 69 73 74 72 69 62 75 74 65 20 79 6f 75 72 20 76 | If.you.want.to.distribute.your.v |
| 41c0 | 65 72 73 69 6f 6e 20 6f 6e 20 74 68 65 20 57 65 62 2c 20 74 68 65 6e 20 65 6d 62 65 64 64 69 6e | ersion.on.the.Web,.then.embeddin |
| 41e0 | 67 20 74 68 65 0a 73 74 72 69 6e 67 20 22 73 69 63 70 2e 74 65 78 69 22 20 73 6f 6d 65 77 68 65 | g.the.string."sicp.texi".somewhe |
| 4200 | 72 65 20 69 6e 20 74 68 65 20 66 69 6c 65 20 6f 72 20 57 65 62 20 70 61 67 65 20 77 69 6c 6c 20 | re.in.the.file.or.Web.page.will. |
| 4220 | 6d 61 6b 65 20 69 74 0a 65 61 73 69 65 72 20 66 6f 72 20 70 65 6f 70 6c 65 20 74 6f 20 66 69 6e | make.it.easier.for.people.to.fin |
| 4240 | 64 20 77 69 74 68 20 57 65 62 20 73 65 61 72 63 68 20 65 6e 67 69 6e 65 73 2e 0a 0a 20 20 20 49 | d.with.Web.search.engines......I |
| 4260 | 74 20 69 73 20 62 65 6c 69 65 76 65 64 20 74 68 61 74 20 74 68 65 20 55 6e 6f 66 66 69 63 69 61 | t.is.believed.that.the.Unofficia |
| 4280 | 6c 20 54 65 78 69 6e 66 6f 20 46 6f 72 6d 61 74 20 69 73 20 69 6e 20 6b 65 65 70 69 6e 67 20 77 | l.Texinfo.Format.is.in.keeping.w |
| 42a0 | 69 74 68 0a 74 68 65 20 73 70 69 72 69 74 20 6f 66 20 74 68 65 20 67 72 61 63 69 6f 75 73 6c 79 | ith.the.spirit.of.the.graciously |
| 42c0 | 20 66 72 65 65 6c 79 2d 64 69 73 74 72 69 62 75 74 65 64 20 48 54 4d 4c 20 76 65 72 73 69 6f 6e | .freely-distributed.HTML.version |
| 42e0 | 2e 20 20 42 75 74 20 79 6f 75 0a 6e 65 76 65 72 20 6b 6e 6f 77 20 77 68 65 6e 20 73 6f 6d 65 6f | ...But.you.never.know.when.someo |
| 4300 | 6e 65 27 73 20 61 72 6d 61 64 61 20 6f 66 20 6c 61 77 79 65 72 73 20 6d 69 67 68 74 20 6e 65 65 | ne's.armada.of.lawyers.might.nee |
| 4320 | 64 20 73 6f 6d 65 74 68 69 6e 67 20 74 6f 20 64 6f 2c 0a 61 6e 64 20 67 65 74 20 74 68 65 69 72 | d.something.to.do,.and.get.their |
| 4340 | 20 73 68 6f 72 74 73 20 61 6c 6c 20 69 6e 20 61 20 6b 6e 6f 74 20 6f 76 65 72 20 73 6f 6d 65 20 | .shorts.all.in.a.knot.over.some. |
| 4360 | 62 65 6e 69 67 6e 20 6c 69 74 74 6c 65 20 74 68 69 6e 67 2c 20 73 6f 0a 74 68 69 6e 6b 20 74 77 | benign.little.thing,.so.think.tw |
| 4380 | 69 63 65 20 62 65 66 6f 72 65 20 79 6f 75 20 75 73 65 20 79 6f 75 72 20 66 75 6c 6c 20 6e 61 6d | ice.before.you.use.your.full.nam |
| 43a0 | 65 20 6f 72 20 64 69 73 74 72 69 62 75 74 65 20 49 6e 66 6f 2c 20 44 56 49 2c 0a 50 6f 73 74 53 | e.or.distribute.Info,.DVI,.PostS |
| 43c0 | 63 72 69 70 74 2c 20 6f 72 20 50 44 46 20 66 6f 72 6d 61 74 73 20 74 68 61 74 20 6d 69 67 68 74 | cript,.or.PDF.formats.that.might |
| 43e0 | 20 65 6d 62 65 64 20 79 6f 75 72 20 61 63 63 6f 75 6e 74 20 6f 72 20 6d 61 63 68 69 6e 65 0a 6e | .embed.your.account.or.machine.n |
| 4400 | 61 6d 65 2e 0a 0a 50 65 61 74 68 2c 0a 0a 4c 79 74 68 61 20 41 79 74 68 0a 0a 20 20 20 41 64 64 | ame...Peath,..Lytha.Ayth.....Add |
| 4420 | 65 6e 64 75 6d 3a 20 53 65 65 20 61 6c 73 6f 20 74 68 65 20 53 49 43 50 20 76 69 64 65 6f 20 6c | endum:.See.also.the.SICP.video.l |
| 4440 | 65 63 74 75 72 65 73 20 62 79 20 41 62 65 6c 73 6f 6e 20 61 6e 64 20 53 75 73 73 6d 61 6e 3a 0a | ectures.by.Abelson.and.Sussman:. |
| 4460 | 60 68 74 74 70 3a 2f 2f 77 77 77 2e 73 77 69 73 73 2e 61 69 2e 6d 69 74 2e 65 64 75 2f 63 6c 61 | `http://www.swiss.ai.mit.edu/cla |
| 4480 | 73 73 65 73 2f 36 2e 30 30 31 2f 61 62 65 6c 73 6f 6e 2d 73 75 73 73 6d 61 6e 2d 6c 65 63 74 75 | sses/6.001/abelson-sussman-lectu |
| 44a0 | 72 65 73 2f 27 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a | res/'....File:.sicp.info,..Node: |
| 44c0 | 20 44 65 64 69 63 61 74 69 6f 6e 2c 20 20 4e 65 78 74 3a 20 46 6f 72 65 77 6f 72 64 2c 20 20 50 | .Dedication,..Next:.Foreword,..P |
| 44e0 | 72 65 76 3a 20 55 54 46 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 44 65 64 69 63 61 74 69 6f 6e 0a 2a | rev:.UTF,..Up:.Top..Dedication.* |
| 4500 | 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 0a 54 68 69 73 20 62 6f 6f 6b 20 69 73 20 64 65 64 69 63 61 74 65 | *********..This.book.is.dedicate |
| 4520 | 64 2c 20 69 6e 20 72 65 73 70 65 63 74 20 61 6e 64 20 61 64 6d 69 72 61 74 69 6f 6e 2c 20 74 6f | d,.in.respect.and.admiration,.to |
| 4540 | 20 74 68 65 20 73 70 69 72 69 74 20 74 68 61 74 0a 6c 69 76 65 73 20 69 6e 20 74 68 65 20 63 6f | .the.spirit.that.lives.in.the.co |
| 4560 | 6d 70 75 74 65 72 2e 0a 0a 20 20 20 20 20 22 49 20 74 68 69 6e 6b 20 74 68 61 74 20 69 74 27 73 | mputer........"I.think.that.it's |
| 4580 | 20 65 78 74 72 61 6f 72 64 69 6e 61 72 69 6c 79 20 69 6d 70 6f 72 74 61 6e 74 20 74 68 61 74 20 | .extraordinarily.important.that. |
| 45a0 | 77 65 20 69 6e 20 63 6f 6d 70 75 74 65 72 0a 20 20 20 20 20 73 63 69 65 6e 63 65 20 6b 65 65 70 | we.in.computer......science.keep |
| 45c0 | 20 66 75 6e 20 69 6e 20 63 6f 6d 70 75 74 69 6e 67 2e 20 20 57 68 65 6e 20 69 74 20 73 74 61 72 | .fun.in.computing...When.it.star |
| 45e0 | 74 65 64 20 6f 75 74 2c 20 69 74 20 77 61 73 20 61 6e 0a 20 20 20 20 20 61 77 66 75 6c 20 6c 6f | ted.out,.it.was.an......awful.lo |
| 4600 | 74 20 6f 66 20 66 75 6e 2e 20 20 4f 66 20 63 6f 75 72 73 65 2c 20 74 68 65 20 70 61 79 69 6e 67 | t.of.fun...Of.course,.the.paying |
| 4620 | 20 63 75 73 74 6f 6d 65 72 73 20 67 6f 74 20 73 68 61 66 74 65 64 0a 20 20 20 20 20 65 76 65 72 | .customers.got.shafted......ever |
| 4640 | 79 20 6e 6f 77 20 61 6e 64 20 74 68 65 6e 2c 20 61 6e 64 20 61 66 74 65 72 20 61 20 77 68 69 6c | y.now.and.then,.and.after.a.whil |
| 4660 | 65 20 77 65 20 62 65 67 61 6e 20 74 6f 20 74 61 6b 65 20 74 68 65 69 72 0a 20 20 20 20 20 63 6f | e.we.began.to.take.their......co |
| 4680 | 6d 70 6c 61 69 6e 74 73 20 73 65 72 69 6f 75 73 6c 79 2e 20 20 57 65 20 62 65 67 61 6e 20 74 6f | mplaints.seriously...We.began.to |
| 46a0 | 20 66 65 65 6c 20 61 73 20 69 66 20 77 65 20 72 65 61 6c 6c 79 20 77 65 72 65 0a 20 20 20 20 20 | .feel.as.if.we.really.were...... |
| 46c0 | 72 65 73 70 6f 6e 73 69 62 6c 65 20 66 6f 72 20 74 68 65 20 73 75 63 63 65 73 73 66 75 6c 2c 20 | responsible.for.the.successful,. |
| 46e0 | 65 72 72 6f 72 2d 66 72 65 65 20 70 65 72 66 65 63 74 20 75 73 65 20 6f 66 20 74 68 65 73 65 0a | error-free.perfect.use.of.these. |
| 4700 | 20 20 20 20 20 6d 61 63 68 69 6e 65 73 2e 20 20 49 20 64 6f 6e 27 74 20 74 68 69 6e 6b 20 77 65 | .....machines...I.don't.think.we |
| 4720 | 20 61 72 65 2e 20 20 49 20 74 68 69 6e 6b 20 77 65 27 72 65 20 72 65 73 70 6f 6e 73 69 62 6c 65 | .are...I.think.we're.responsible |
| 4740 | 20 66 6f 72 0a 20 20 20 20 20 73 74 72 65 74 63 68 69 6e 67 20 74 68 65 6d 2c 20 73 65 74 74 69 | .for......stretching.them,.setti |
| 4760 | 6e 67 20 74 68 65 6d 20 6f 66 66 20 69 6e 20 6e 65 77 20 64 69 72 65 63 74 69 6f 6e 73 2c 20 61 | ng.them.off.in.new.directions,.a |
| 4780 | 6e 64 20 6b 65 65 70 69 6e 67 0a 20 20 20 20 20 66 75 6e 20 69 6e 20 74 68 65 20 68 6f 75 73 65 | nd.keeping......fun.in.the.house |
| 47a0 | 2e 20 20 49 20 68 6f 70 65 20 74 68 65 20 66 69 65 6c 64 20 6f 66 20 63 6f 6d 70 75 74 65 72 20 | ...I.hope.the.field.of.computer. |
| 47c0 | 73 63 69 65 6e 63 65 20 6e 65 76 65 72 0a 20 20 20 20 20 6c 6f 73 65 73 20 69 74 73 20 73 65 6e | science.never......loses.its.sen |
| 47e0 | 73 65 20 6f 66 20 66 75 6e 2e 20 20 41 62 6f 76 65 20 61 6c 6c 2c 20 49 20 68 6f 70 65 20 77 65 | se.of.fun...Above.all,.I.hope.we |
| 4800 | 20 64 6f 6e 27 74 20 62 65 63 6f 6d 65 0a 20 20 20 20 20 6d 69 73 73 69 6f 6e 61 72 69 65 73 2e | .don't.become......missionaries. |
| 4820 | 20 20 44 6f 6e 27 74 20 66 65 65 6c 20 61 73 20 69 66 20 79 6f 75 27 72 65 20 42 69 62 6c 65 20 | ..Don't.feel.as.if.you're.Bible. |
| 4840 | 73 61 6c 65 73 6d 65 6e 2e 20 20 54 68 65 20 77 6f 72 6c 64 0a 20 20 20 20 20 68 61 73 20 74 6f | salesmen...The.world......has.to |
| 4860 | 6f 20 6d 61 6e 79 20 6f 66 20 74 68 6f 73 65 20 61 6c 72 65 61 64 79 2e 20 20 57 68 61 74 20 79 | o.many.of.those.already...What.y |
| 4880 | 6f 75 20 6b 6e 6f 77 20 61 62 6f 75 74 20 63 6f 6d 70 75 74 69 6e 67 0a 20 20 20 20 20 6f 74 68 | ou.know.about.computing......oth |
| 48a0 | 65 72 20 70 65 6f 70 6c 65 20 77 69 6c 6c 20 6c 65 61 72 6e 2e 20 20 44 6f 6e 27 74 20 66 65 65 | er.people.will.learn...Don't.fee |
| 48c0 | 6c 20 61 73 20 69 66 20 74 68 65 20 6b 65 79 20 74 6f 20 73 75 63 63 65 73 73 66 75 6c 0a 20 20 | l.as.if.the.key.to.successful... |
| 48e0 | 20 20 20 63 6f 6d 70 75 74 69 6e 67 20 69 73 20 6f 6e 6c 79 20 69 6e 20 79 6f 75 72 20 68 61 6e | ...computing.is.only.in.your.han |
| 4900 | 64 73 2e 20 20 57 68 61 74 27 73 20 69 6e 20 79 6f 75 72 20 68 61 6e 64 73 2c 20 49 20 74 68 69 | ds...What's.in.your.hands,.I.thi |
| 4920 | 6e 6b 0a 20 20 20 20 20 61 6e 64 20 68 6f 70 65 2c 20 69 73 20 69 6e 74 65 6c 6c 69 67 65 6e 63 | nk......and.hope,.is.intelligenc |
| 4940 | 65 3a 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 73 65 65 20 74 68 65 20 6d 61 63 68 69 6e | e:.the.ability.to.see.the.machin |
| 4960 | 65 20 61 73 20 6d 6f 72 65 0a 20 20 20 20 20 74 68 61 6e 20 77 68 65 6e 20 79 6f 75 20 77 65 72 | e.as.more......than.when.you.wer |
| 4980 | 65 20 66 69 72 73 74 20 6c 65 64 20 75 70 20 74 6f 20 69 74 2c 20 74 68 61 74 20 79 6f 75 20 63 | e.first.led.up.to.it,.that.you.c |
| 49a0 | 61 6e 20 6d 61 6b 65 20 69 74 20 6d 6f 72 65 2e 22 0a 0a 20 20 20 20 20 2d 2d 41 6c 61 6e 20 4a | an.make.it.more.".......--Alan.J |
| 49c0 | 2e 20 50 65 72 6c 69 73 20 28 41 70 72 69 6c 20 31 2c 20 31 39 32 32 20 20 46 65 62 72 75 61 72 | ..Perlis.(April.1,.1922..Februar |
| 49e0 | 79 20 37 2c 20 31 39 39 30 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 | y.7,.1990)....File:.sicp.info,.. |
| 4a00 | 4e 6f 64 65 3a 20 46 6f 72 65 77 6f 72 64 2c 20 20 4e 65 78 74 3a 20 50 72 65 66 61 63 65 2c 20 | Node:.Foreword,..Next:.Preface,. |
| 4a20 | 20 50 72 65 76 3a 20 44 65 64 69 63 61 74 69 6f 6e 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 46 6f 72 | .Prev:.Dedication,..Up:.Top..For |
| 4a40 | 65 77 6f 72 64 0a 2a 2a 2a 2a 2a 2a 2a 2a 0a 0a 45 64 75 63 61 74 6f 72 73 2c 20 67 65 6e 65 72 | eword.********..Educators,.gener |
| 4a60 | 61 6c 73 2c 20 64 69 65 74 69 63 69 61 6e 73 2c 20 70 73 79 63 68 6f 6c 6f 67 69 73 74 73 2c 20 | als,.dieticians,.psychologists,. |
| 4a80 | 61 6e 64 20 70 61 72 65 6e 74 73 20 70 72 6f 67 72 61 6d 2e 0a 41 72 6d 69 65 73 2c 20 73 74 75 | and.parents.program..Armies,.stu |
| 4aa0 | 64 65 6e 74 73 2c 20 61 6e 64 20 73 6f 6d 65 20 73 6f 63 69 65 74 69 65 73 20 61 72 65 20 70 72 | dents,.and.some.societies.are.pr |
| 4ac0 | 6f 67 72 61 6d 6d 65 64 2e 20 20 41 6e 20 61 73 73 61 75 6c 74 20 6f 6e 0a 6c 61 72 67 65 20 70 | ogrammed...An.assault.on.large.p |
| 4ae0 | 72 6f 62 6c 65 6d 73 20 65 6d 70 6c 6f 79 73 20 61 20 73 75 63 63 65 73 73 69 6f 6e 20 6f 66 20 | roblems.employs.a.succession.of. |
| 4b00 | 70 72 6f 67 72 61 6d 73 2c 20 6d 6f 73 74 20 6f 66 20 77 68 69 63 68 20 73 70 72 69 6e 67 0a 69 | programs,.most.of.which.spring.i |
| 4b20 | 6e 74 6f 20 65 78 69 73 74 65 6e 63 65 20 65 6e 20 72 6f 75 74 65 2e 20 20 54 68 65 73 65 20 70 | nto.existence.en.route...These.p |
| 4b40 | 72 6f 67 72 61 6d 73 20 61 72 65 20 72 69 66 65 20 77 69 74 68 20 69 73 73 75 65 73 20 74 68 61 | rograms.are.rife.with.issues.tha |
| 4b60 | 74 0a 61 70 70 65 61 72 20 74 6f 20 62 65 20 70 61 72 74 69 63 75 6c 61 72 20 74 6f 20 74 68 65 | t.appear.to.be.particular.to.the |
| 4b80 | 20 70 72 6f 62 6c 65 6d 20 61 74 20 68 61 6e 64 2e 20 20 54 6f 20 61 70 70 72 65 63 69 61 74 65 | .problem.at.hand...To.appreciate |
| 4ba0 | 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 61 73 20 61 6e 20 69 6e 74 65 6c 6c 65 63 74 75 61 6c 20 | .programming.as.an.intellectual. |
| 4bc0 | 61 63 74 69 76 69 74 79 20 69 6e 20 69 74 73 20 6f 77 6e 20 72 69 67 68 74 20 79 6f 75 20 6d 75 | activity.in.its.own.right.you.mu |
| 4be0 | 73 74 20 74 75 72 6e 0a 74 6f 20 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 3b | st.turn.to.computer.programming; |
| 4c00 | 20 79 6f 75 20 6d 75 73 74 20 72 65 61 64 20 61 6e 64 20 77 72 69 74 65 20 63 6f 6d 70 75 74 65 | .you.must.read.and.write.compute |
| 4c20 | 72 0a 70 72 6f 67 72 61 6d 73 2d 2d 6d 61 6e 79 20 6f 66 20 74 68 65 6d 2e 20 20 49 74 20 64 6f | r.programs--many.of.them...It.do |
| 4c40 | 65 73 6e 27 74 20 6d 61 74 74 65 72 20 6d 75 63 68 20 77 68 61 74 20 74 68 65 20 70 72 6f 67 72 | esn't.matter.much.what.the.progr |
| 4c60 | 61 6d 73 20 61 72 65 0a 61 62 6f 75 74 20 6f 72 20 77 68 61 74 20 61 70 70 6c 69 63 61 74 69 6f | ams.are.about.or.what.applicatio |
| 4c80 | 6e 73 20 74 68 65 79 20 73 65 72 76 65 2e 20 20 57 68 61 74 20 64 6f 65 73 20 6d 61 74 74 65 72 | ns.they.serve...What.does.matter |
| 4ca0 | 20 69 73 20 68 6f 77 20 77 65 6c 6c 0a 74 68 65 79 20 70 65 72 66 6f 72 6d 20 61 6e 64 20 68 6f | .is.how.well.they.perform.and.ho |
| 4cc0 | 77 20 73 6d 6f 6f 74 68 6c 79 20 74 68 65 79 20 66 69 74 20 77 69 74 68 20 6f 74 68 65 72 20 70 | w.smoothly.they.fit.with.other.p |
| 4ce0 | 72 6f 67 72 61 6d 73 20 69 6e 20 74 68 65 0a 63 72 65 61 74 69 6f 6e 20 6f 66 20 73 74 69 6c 6c | rograms.in.the.creation.of.still |
| 4d00 | 20 67 72 65 61 74 65 72 20 70 72 6f 67 72 61 6d 73 2e 20 20 54 68 65 20 70 72 6f 67 72 61 6d 6d | .greater.programs...The.programm |
| 4d20 | 65 72 20 6d 75 73 74 20 73 65 65 6b 20 62 6f 74 68 0a 70 65 72 66 65 63 74 69 6f 6e 20 6f 66 20 | er.must.seek.both.perfection.of. |
| 4d40 | 70 61 72 74 20 61 6e 64 20 61 64 65 71 75 61 63 79 20 6f 66 20 63 6f 6c 6c 65 63 74 69 6f 6e 2e | part.and.adequacy.of.collection. |
| 4d60 | 20 20 49 6e 20 74 68 69 73 20 62 6f 6f 6b 20 74 68 65 20 75 73 65 20 6f 66 0a 22 70 72 6f 67 72 | ..In.this.book.the.use.of."progr |
| 4d80 | 61 6d 22 20 69 73 20 66 6f 63 75 73 65 64 20 6f 6e 20 74 68 65 20 63 72 65 61 74 69 6f 6e 2c 20 | am".is.focused.on.the.creation,. |
| 4da0 | 65 78 65 63 75 74 69 6f 6e 2c 20 61 6e 64 20 73 74 75 64 79 20 6f 66 20 70 72 6f 67 72 61 6d 73 | execution,.and.study.of.programs |
| 4dc0 | 0a 77 72 69 74 74 65 6e 20 69 6e 20 61 20 64 69 61 6c 65 63 74 20 6f 66 20 4c 69 73 70 20 66 6f | .written.in.a.dialect.of.Lisp.fo |
| 4de0 | 72 20 65 78 65 63 75 74 69 6f 6e 20 6f 6e 20 61 20 64 69 67 69 74 61 6c 20 63 6f 6d 70 75 74 65 | r.execution.on.a.digital.compute |
| 4e00 | 72 2e 0a 55 73 69 6e 67 20 4c 69 73 70 20 77 65 20 72 65 73 74 72 69 63 74 20 6f 72 20 6c 69 6d | r..Using.Lisp.we.restrict.or.lim |
| 4e20 | 69 74 20 6e 6f 74 20 77 68 61 74 20 77 65 20 6d 61 79 20 70 72 6f 67 72 61 6d 2c 20 62 75 74 20 | it.not.what.we.may.program,.but. |
| 4e40 | 6f 6e 6c 79 20 74 68 65 0a 6e 6f 74 61 74 69 6f 6e 20 66 6f 72 20 6f 75 72 20 70 72 6f 67 72 61 | only.the.notation.for.our.progra |
| 4e60 | 6d 20 64 65 73 63 72 69 70 74 69 6f 6e 73 2e 0a 0a 20 20 20 4f 75 72 20 74 72 61 66 66 69 63 20 | m.descriptions......Our.traffic. |
| 4e80 | 77 69 74 68 20 74 68 65 20 73 75 62 6a 65 63 74 20 6d 61 74 74 65 72 20 6f 66 20 74 68 69 73 20 | with.the.subject.matter.of.this. |
| 4ea0 | 62 6f 6f 6b 20 69 6e 76 6f 6c 76 65 73 20 75 73 20 77 69 74 68 0a 74 68 72 65 65 20 66 6f 63 69 | book.involves.us.with.three.foci |
| 4ec0 | 20 6f 66 20 70 68 65 6e 6f 6d 65 6e 61 3a 20 74 68 65 20 68 75 6d 61 6e 20 6d 69 6e 64 2c 20 63 | .of.phenomena:.the.human.mind,.c |
| 4ee0 | 6f 6c 6c 65 63 74 69 6f 6e 73 20 6f 66 20 63 6f 6d 70 75 74 65 72 0a 70 72 6f 67 72 61 6d 73 2c | ollections.of.computer.programs, |
| 4f00 | 20 61 6e 64 20 74 68 65 20 63 6f 6d 70 75 74 65 72 2e 20 20 45 76 65 72 79 20 63 6f 6d 70 75 74 | .and.the.computer...Every.comput |
| 4f20 | 65 72 20 70 72 6f 67 72 61 6d 20 69 73 20 61 20 6d 6f 64 65 6c 2c 20 68 61 74 63 68 65 64 0a 69 | er.program.is.a.model,.hatched.i |
| 4f40 | 6e 20 74 68 65 20 6d 69 6e 64 2c 20 6f 66 20 61 20 72 65 61 6c 20 6f 72 20 6d 65 6e 74 61 6c 20 | n.the.mind,.of.a.real.or.mental. |
| 4f60 | 70 72 6f 63 65 73 73 2e 20 20 54 68 65 73 65 20 70 72 6f 63 65 73 73 65 73 2c 20 61 72 69 73 69 | process...These.processes,.arisi |
| 4f80 | 6e 67 0a 66 72 6f 6d 20 68 75 6d 61 6e 20 65 78 70 65 72 69 65 6e 63 65 20 61 6e 64 20 74 68 6f | ng.from.human.experience.and.tho |
| 4fa0 | 75 67 68 74 2c 20 61 72 65 20 68 75 67 65 20 69 6e 20 6e 75 6d 62 65 72 2c 20 69 6e 74 72 69 63 | ught,.are.huge.in.number,.intric |
| 4fc0 | 61 74 65 20 69 6e 0a 64 65 74 61 69 6c 2c 20 61 6e 64 20 61 74 20 61 6e 79 20 74 69 6d 65 20 6f | ate.in.detail,.and.at.any.time.o |
| 4fe0 | 6e 6c 79 20 70 61 72 74 69 61 6c 6c 79 20 75 6e 64 65 72 73 74 6f 6f 64 2e 20 20 54 68 65 79 20 | nly.partially.understood...They. |
| 5000 | 61 72 65 20 6d 6f 64 65 6c 65 64 20 74 6f 0a 6f 75 72 20 70 65 72 6d 61 6e 65 6e 74 20 73 61 74 | are.modeled.to.our.permanent.sat |
| 5020 | 69 73 66 61 63 74 69 6f 6e 20 72 61 72 65 6c 79 20 62 79 20 6f 75 72 20 63 6f 6d 70 75 74 65 72 | isfaction.rarely.by.our.computer |
| 5040 | 20 70 72 6f 67 72 61 6d 73 2e 20 20 54 68 75 73 20 65 76 65 6e 0a 74 68 6f 75 67 68 20 6f 75 72 | .programs...Thus.even.though.our |
| 5060 | 20 70 72 6f 67 72 61 6d 73 20 61 72 65 20 63 61 72 65 66 75 6c 6c 79 20 68 61 6e 64 63 72 61 66 | .programs.are.carefully.handcraf |
| 5080 | 74 65 64 20 64 69 73 63 72 65 74 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 73 20 6f 66 0a 73 79 6d 62 | ted.discrete.collections.of.symb |
| 50a0 | 6f 6c 73 2c 20 6d 6f 73 61 69 63 73 20 6f 66 20 69 6e 74 65 72 6c 6f 63 6b 69 6e 67 20 66 75 6e | ols,.mosaics.of.interlocking.fun |
| 50c0 | 63 74 69 6f 6e 73 2c 20 74 68 65 79 20 63 6f 6e 74 69 6e 75 61 6c 6c 79 20 65 76 6f 6c 76 65 3a | ctions,.they.continually.evolve: |
| 50e0 | 20 77 65 0a 63 68 61 6e 67 65 20 74 68 65 6d 20 61 73 20 6f 75 72 20 70 65 72 63 65 70 74 69 6f | .we.change.them.as.our.perceptio |
| 5100 | 6e 20 6f 66 20 74 68 65 20 6d 6f 64 65 6c 20 64 65 65 70 65 6e 73 2c 20 65 6e 6c 61 72 67 65 73 | n.of.the.model.deepens,.enlarges |
| 5120 | 2c 0a 67 65 6e 65 72 61 6c 69 7a 65 73 20 75 6e 74 69 6c 20 74 68 65 20 6d 6f 64 65 6c 20 75 6c | ,.generalizes.until.the.model.ul |
| 5140 | 74 69 6d 61 74 65 6c 79 20 61 74 74 61 69 6e 73 20 61 20 6d 65 74 61 73 74 61 62 6c 65 20 70 6c | timately.attains.a.metastable.pl |
| 5160 | 61 63 65 0a 77 69 74 68 69 6e 20 73 74 69 6c 6c 20 61 6e 6f 74 68 65 72 20 6d 6f 64 65 6c 20 77 | ace.within.still.another.model.w |
| 5180 | 69 74 68 20 77 68 69 63 68 20 77 65 20 73 74 72 75 67 67 6c 65 2e 20 20 54 68 65 20 73 6f 75 72 | ith.which.we.struggle...The.sour |
| 51a0 | 63 65 20 6f 66 20 74 68 65 0a 65 78 68 69 6c 61 72 61 74 69 6f 6e 20 61 73 73 6f 63 69 61 74 65 | ce.of.the.exhilaration.associate |
| 51c0 | 64 20 77 69 74 68 20 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 74 | d.with.computer.programming.is.t |
| 51e0 | 68 65 20 63 6f 6e 74 69 6e 75 61 6c 0a 75 6e 66 6f 6c 64 69 6e 67 20 77 69 74 68 69 6e 20 74 68 | he.continual.unfolding.within.th |
| 5200 | 65 20 6d 69 6e 64 20 61 6e 64 20 6f 6e 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 6f 66 20 6d 65 | e.mind.and.on.the.computer.of.me |
| 5220 | 63 68 61 6e 69 73 6d 73 20 65 78 70 72 65 73 73 65 64 0a 61 73 20 70 72 6f 67 72 61 6d 73 20 61 | chanisms.expressed.as.programs.a |
| 5240 | 6e 64 20 74 68 65 20 65 78 70 6c 6f 73 69 6f 6e 20 6f 66 20 70 65 72 63 65 70 74 69 6f 6e 20 74 | nd.the.explosion.of.perception.t |
| 5260 | 68 65 79 20 67 65 6e 65 72 61 74 65 2e 20 20 49 66 20 61 72 74 0a 69 6e 74 65 72 70 72 65 74 73 | hey.generate...If.art.interprets |
| 5280 | 20 6f 75 72 20 64 72 65 61 6d 73 2c 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 65 78 65 63 75 74 | .our.dreams,.the.computer.execut |
| 52a0 | 65 73 20 74 68 65 6d 20 69 6e 20 74 68 65 20 67 75 69 73 65 20 6f 66 0a 70 72 6f 67 72 61 6d 73 | es.them.in.the.guise.of.programs |
| 52c0 | 21 0a 0a 20 20 20 46 6f 72 20 61 6c 6c 20 69 74 73 20 70 6f 77 65 72 2c 20 74 68 65 20 63 6f 6d | !.....For.all.its.power,.the.com |
| 52e0 | 70 75 74 65 72 20 69 73 20 61 20 68 61 72 73 68 20 74 61 73 6b 6d 61 73 74 65 72 2e 20 20 49 74 | puter.is.a.harsh.taskmaster...It |
| 5300 | 73 20 70 72 6f 67 72 61 6d 73 0a 6d 75 73 74 20 62 65 20 63 6f 72 72 65 63 74 2c 20 61 6e 64 20 | s.programs.must.be.correct,.and. |
| 5320 | 77 68 61 74 20 77 65 20 77 69 73 68 20 74 6f 20 73 61 79 20 6d 75 73 74 20 62 65 20 73 61 69 64 | what.we.wish.to.say.must.be.said |
| 5340 | 20 61 63 63 75 72 61 74 65 6c 79 20 69 6e 0a 65 76 65 72 79 20 64 65 74 61 69 6c 2e 20 20 41 73 | .accurately.in.every.detail...As |
| 5360 | 20 69 6e 20 65 76 65 72 79 20 6f 74 68 65 72 20 73 79 6d 62 6f 6c 69 63 20 61 63 74 69 76 69 74 | .in.every.other.symbolic.activit |
| 5380 | 79 2c 20 77 65 20 62 65 63 6f 6d 65 20 63 6f 6e 76 69 6e 63 65 64 0a 6f 66 20 70 72 6f 67 72 61 | y,.we.become.convinced.of.progra |
| 53a0 | 6d 20 74 72 75 74 68 20 74 68 72 6f 75 67 68 20 61 72 67 75 6d 65 6e 74 2e 20 20 4c 69 73 70 20 | m.truth.through.argument...Lisp. |
| 53c0 | 69 74 73 65 6c 66 20 63 61 6e 20 62 65 20 61 73 73 69 67 6e 65 64 20 61 0a 73 65 6d 61 6e 74 69 | itself.can.be.assigned.a.semanti |
| 53e0 | 63 73 20 28 61 6e 6f 74 68 65 72 20 6d 6f 64 65 6c 2c 20 62 79 20 74 68 65 20 77 61 79 29 2c 20 | cs.(another.model,.by.the.way),. |
| 5400 | 61 6e 64 20 69 66 20 61 20 70 72 6f 67 72 61 6d 27 73 20 66 75 6e 63 74 69 6f 6e 20 63 61 6e 0a | and.if.a.program's.function.can. |
| 5420 | 62 65 20 73 70 65 63 69 66 69 65 64 2c 20 73 61 79 2c 20 69 6e 20 74 68 65 20 70 72 65 64 69 63 | be.specified,.say,.in.the.predic |
| 5440 | 61 74 65 20 63 61 6c 63 75 6c 75 73 2c 20 74 68 65 20 70 72 6f 6f 66 20 6d 65 74 68 6f 64 73 20 | ate.calculus,.the.proof.methods. |
| 5460 | 6f 66 0a 6c 6f 67 69 63 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 6d 61 6b 65 20 61 6e 20 | of.logic.can.be.used.to.make.an. |
| 5480 | 61 63 63 65 70 74 61 62 6c 65 20 63 6f 72 72 65 63 74 6e 65 73 73 20 61 72 67 75 6d 65 6e 74 2e | acceptable.correctness.argument. |
| 54a0 | 0a 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 61 73 20 70 72 6f 67 72 61 6d 73 20 67 65 74 20 | .Unfortunately,.as.programs.get. |
| 54c0 | 6c 61 72 67 65 20 61 6e 64 20 63 6f 6d 70 6c 69 63 61 74 65 64 2c 20 61 73 20 74 68 65 79 20 61 | large.and.complicated,.as.they.a |
| 54e0 | 6c 6d 6f 73 74 0a 61 6c 77 61 79 73 20 64 6f 2c 20 74 68 65 20 61 64 65 71 75 61 63 79 2c 20 63 | lmost.always.do,.the.adequacy,.c |
| 5500 | 6f 6e 73 69 73 74 65 6e 63 79 2c 20 61 6e 64 20 63 6f 72 72 65 63 74 6e 65 73 73 20 6f 66 20 74 | onsistency,.and.correctness.of.t |
| 5520 | 68 65 0a 73 70 65 63 69 66 69 63 61 74 69 6f 6e 73 20 74 68 65 6d 73 65 6c 76 65 73 20 62 65 63 | he.specifications.themselves.bec |
| 5540 | 6f 6d 65 20 6f 70 65 6e 20 74 6f 20 64 6f 75 62 74 2c 20 73 6f 20 74 68 61 74 20 63 6f 6d 70 6c | ome.open.to.doubt,.so.that.compl |
| 5560 | 65 74 65 20 66 6f 72 6d 61 6c 0a 61 72 67 75 6d 65 6e 74 73 20 6f 66 20 63 6f 72 72 65 63 74 6e | ete.formal.arguments.of.correctn |
| 5580 | 65 73 73 20 73 65 6c 64 6f 6d 20 61 63 63 6f 6d 70 61 6e 79 20 6c 61 72 67 65 20 70 72 6f 67 72 | ess.seldom.accompany.large.progr |
| 55a0 | 61 6d 73 2e 20 20 53 69 6e 63 65 20 6c 61 72 67 65 0a 70 72 6f 67 72 61 6d 73 20 67 72 6f 77 20 | ams...Since.large.programs.grow. |
| 55c0 | 66 72 6f 6d 20 73 6d 61 6c 6c 20 6f 6e 65 73 2c 20 69 74 20 69 73 20 63 72 75 63 69 61 6c 20 74 | from.small.ones,.it.is.crucial.t |
| 55e0 | 68 61 74 20 77 65 20 64 65 76 65 6c 6f 70 20 61 6e 20 61 72 73 65 6e 61 6c 0a 6f 66 20 73 74 61 | hat.we.develop.an.arsenal.of.sta |
| 5600 | 6e 64 61 72 64 20 70 72 6f 67 72 61 6d 20 73 74 72 75 63 74 75 72 65 73 20 6f 66 20 77 68 6f 73 | ndard.program.structures.of.whos |
| 5620 | 65 20 63 6f 72 72 65 63 74 6e 65 73 73 20 77 65 20 68 61 76 65 20 62 65 63 6f 6d 65 0a 73 75 72 | e.correctness.we.have.become.sur |
| 5640 | 65 2d 2d 77 65 20 63 61 6c 6c 20 74 68 65 6d 20 69 64 69 6f 6d 73 2d 2d 61 6e 64 20 6c 65 61 72 | e--we.call.them.idioms--and.lear |
| 5660 | 6e 20 74 6f 20 63 6f 6d 62 69 6e 65 20 74 68 65 6d 20 69 6e 74 6f 20 6c 61 72 67 65 72 0a 73 74 | n.to.combine.them.into.larger.st |
| 5680 | 72 75 63 74 75 72 65 73 20 75 73 69 6e 67 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 61 6c 20 74 65 | ructures.using.organizational.te |
| 56a0 | 63 68 6e 69 71 75 65 73 20 6f 66 20 70 72 6f 76 65 6e 20 76 61 6c 75 65 2e 20 20 54 68 65 73 65 | chniques.of.proven.value...These |
| 56c0 | 0a 74 65 63 68 6e 69 71 75 65 73 20 61 72 65 20 74 72 65 61 74 65 64 20 61 74 20 6c 65 6e 67 74 | .techniques.are.treated.at.lengt |
| 56e0 | 68 20 69 6e 20 74 68 69 73 20 62 6f 6f 6b 2c 20 61 6e 64 20 75 6e 64 65 72 73 74 61 6e 64 69 6e | h.in.this.book,.and.understandin |
| 5700 | 67 20 74 68 65 6d 0a 69 73 20 65 73 73 65 6e 74 69 61 6c 20 74 6f 20 70 61 72 74 69 63 69 70 61 | g.them.is.essential.to.participa |
| 5720 | 74 69 6f 6e 20 69 6e 20 74 68 65 20 50 72 6f 6d 65 74 68 65 61 6e 20 65 6e 74 65 72 70 72 69 73 | tion.in.the.Promethean.enterpris |
| 5740 | 65 20 63 61 6c 6c 65 64 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 2e 20 20 4d 6f 72 65 20 74 68 61 6e | e.called.programming...More.than |
| 5760 | 20 61 6e 79 74 68 69 6e 67 20 65 6c 73 65 2c 20 74 68 65 20 75 6e 63 6f 76 65 72 69 6e 67 20 61 | .anything.else,.the.uncovering.a |
| 5780 | 6e 64 20 6d 61 73 74 65 72 79 20 6f 66 0a 70 6f 77 65 72 66 75 6c 20 6f 72 67 61 6e 69 7a 61 74 | nd.mastery.of.powerful.organizat |
| 57a0 | 69 6f 6e 61 6c 20 74 65 63 68 6e 69 71 75 65 73 20 61 63 63 65 6c 65 72 61 74 65 73 20 6f 75 72 | ional.techniques.accelerates.our |
| 57c0 | 20 61 62 69 6c 69 74 79 20 74 6f 20 63 72 65 61 74 65 0a 6c 61 72 67 65 2c 20 73 69 67 6e 69 66 | .ability.to.create.large,.signif |
| 57e0 | 69 63 61 6e 74 20 70 72 6f 67 72 61 6d 73 2e 20 20 43 6f 6e 76 65 72 73 65 6c 79 2c 20 73 69 6e | icant.programs...Conversely,.sin |
| 5800 | 63 65 20 77 72 69 74 69 6e 67 20 6c 61 72 67 65 20 70 72 6f 67 72 61 6d 73 0a 69 73 20 76 65 72 | ce.writing.large.programs.is.ver |
| 5820 | 79 20 74 61 78 69 6e 67 2c 20 77 65 20 61 72 65 20 73 74 69 6d 75 6c 61 74 65 64 20 74 6f 20 69 | y.taxing,.we.are.stimulated.to.i |
| 5840 | 6e 76 65 6e 74 20 6e 65 77 20 6d 65 74 68 6f 64 73 20 6f 66 20 72 65 64 75 63 69 6e 67 20 74 68 | nvent.new.methods.of.reducing.th |
| 5860 | 65 0a 6d 61 73 73 20 6f 66 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 64 65 74 61 69 6c 20 74 6f | e.mass.of.function.and.detail.to |
| 5880 | 20 62 65 20 66 69 74 74 65 64 20 69 6e 74 6f 20 6c 61 72 67 65 20 70 72 6f 67 72 61 6d 73 2e 0a | .be.fitted.into.large.programs.. |
| 58a0 | 0a 20 20 20 55 6e 6c 69 6b 65 20 70 72 6f 67 72 61 6d 73 2c 20 63 6f 6d 70 75 74 65 72 73 20 6d | ....Unlike.programs,.computers.m |
| 58c0 | 75 73 74 20 6f 62 65 79 20 74 68 65 20 6c 61 77 73 20 6f 66 20 70 68 79 73 69 63 73 2e 20 20 49 | ust.obey.the.laws.of.physics...I |
| 58e0 | 66 20 74 68 65 79 0a 77 69 73 68 20 74 6f 20 70 65 72 66 6f 72 6d 20 72 61 70 69 64 6c 79 2d 2d | f.they.wish.to.perform.rapidly-- |
| 5900 | 61 20 66 65 77 20 6e 61 6e 6f 73 65 63 6f 6e 64 73 20 70 65 72 20 73 74 61 74 65 20 63 68 61 6e | a.few.nanoseconds.per.state.chan |
| 5920 | 67 65 2d 2d 74 68 65 79 20 6d 75 73 74 0a 74 72 61 6e 73 6d 69 74 20 65 6c 65 63 74 72 6f 6e 73 | ge--they.must.transmit.electrons |
| 5940 | 20 6f 6e 6c 79 20 73 6d 61 6c 6c 20 64 69 73 74 61 6e 63 65 73 20 28 61 74 20 6d 6f 73 74 20 31 | .only.small.distances.(at.most.1 |
| 5960 | 31 20 6f 76 65 72 20 32 20 66 65 65 74 29 2e 20 20 54 68 65 0a 68 65 61 74 20 67 65 6e 65 72 61 | 1.over.2.feet)...The.heat.genera |
| 5980 | 74 65 64 20 62 79 20 74 68 65 20 68 75 67 65 20 6e 75 6d 62 65 72 20 6f 66 20 64 65 76 69 63 65 | ted.by.the.huge.number.of.device |
| 59a0 | 73 20 73 6f 20 63 6f 6e 63 65 6e 74 72 61 74 65 64 20 69 6e 20 73 70 61 63 65 0a 68 61 73 20 74 | s.so.concentrated.in.space.has.t |
| 59c0 | 6f 20 62 65 20 72 65 6d 6f 76 65 64 2e 20 20 41 6e 20 65 78 71 75 69 73 69 74 65 20 65 6e 67 69 | o.be.removed...An.exquisite.engi |
| 59e0 | 6e 65 65 72 69 6e 67 20 61 72 74 20 68 61 73 20 62 65 65 6e 20 64 65 76 65 6c 6f 70 65 64 0a 62 | neering.art.has.been.developed.b |
| 5a00 | 61 6c 61 6e 63 69 6e 67 20 62 65 74 77 65 65 6e 20 6d 75 6c 74 69 70 6c 69 63 69 74 79 20 6f 66 | alancing.between.multiplicity.of |
| 5a20 | 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 64 65 6e 73 69 74 79 20 6f 66 20 64 65 76 69 63 65 73 | .function.and.density.of.devices |
| 5a40 | 2e 20 20 49 6e 0a 61 6e 79 20 65 76 65 6e 74 2c 20 68 61 72 64 77 61 72 65 20 61 6c 77 61 79 73 | ...In.any.event,.hardware.always |
| 5a60 | 20 6f 70 65 72 61 74 65 73 20 61 74 20 61 20 6c 65 76 65 6c 20 6d 6f 72 65 20 70 72 69 6d 69 74 | .operates.at.a.level.more.primit |
| 5a80 | 69 76 65 20 74 68 61 6e 20 74 68 61 74 0a 61 74 20 77 68 69 63 68 20 77 65 20 63 61 72 65 20 74 | ive.than.that.at.which.we.care.t |
| 5aa0 | 6f 20 70 72 6f 67 72 61 6d 2e 20 20 54 68 65 20 70 72 6f 63 65 73 73 65 73 20 74 68 61 74 20 74 | o.program...The.processes.that.t |
| 5ac0 | 72 61 6e 73 66 6f 72 6d 20 6f 75 72 20 4c 69 73 70 0a 70 72 6f 67 72 61 6d 73 20 74 6f 20 22 6d | ransform.our.Lisp.programs.to."m |
| 5ae0 | 61 63 68 69 6e 65 22 20 70 72 6f 67 72 61 6d 73 20 61 72 65 20 74 68 65 6d 73 65 6c 76 65 73 20 | achine".programs.are.themselves. |
| 5b00 | 61 62 73 74 72 61 63 74 20 6d 6f 64 65 6c 73 20 77 68 69 63 68 20 77 65 0a 70 72 6f 67 72 61 6d | abstract.models.which.we.program |
| 5b20 | 2e 20 20 54 68 65 69 72 20 73 74 75 64 79 20 61 6e 64 20 63 72 65 61 74 69 6f 6e 20 67 69 76 65 | ...Their.study.and.creation.give |
| 5b40 | 20 61 20 67 72 65 61 74 20 64 65 61 6c 20 6f 66 20 69 6e 73 69 67 68 74 20 69 6e 74 6f 0a 74 68 | .a.great.deal.of.insight.into.th |
| 5b60 | 65 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 73 20 61 73 73 6f 63 69 | e.organizational.programs.associ |
| 5b80 | 61 74 65 64 20 77 69 74 68 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 61 72 62 69 74 72 61 72 79 0a | ated.with.programming.arbitrary. |
| 5ba0 | 6d 6f 64 65 6c 73 2e 20 20 4f 66 20 63 6f 75 72 73 65 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 | models...Of.course.the.computer. |
| 5bc0 | 69 74 73 65 6c 66 20 63 61 6e 20 62 65 20 73 6f 20 6d 6f 64 65 6c 65 64 2e 20 20 54 68 69 6e 6b | itself.can.be.so.modeled...Think |
| 5be0 | 20 6f 66 20 69 74 3a 0a 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 20 73 6d 61 6c | .of.it:.the.behavior.of.the.smal |
| 5c00 | 6c 65 73 74 20 70 68 79 73 69 63 61 6c 20 73 77 69 74 63 68 69 6e 67 20 65 6c 65 6d 65 6e 74 20 | lest.physical.switching.element. |
| 5c20 | 69 73 20 6d 6f 64 65 6c 65 64 20 62 79 0a 71 75 61 6e 74 75 6d 20 6d 65 63 68 61 6e 69 63 73 20 | is.modeled.by.quantum.mechanics. |
| 5c40 | 64 65 73 63 72 69 62 65 64 20 62 79 20 64 69 66 66 65 72 65 6e 74 69 61 6c 20 65 71 75 61 74 69 | described.by.differential.equati |
| 5c60 | 6f 6e 73 20 77 68 6f 73 65 20 64 65 74 61 69 6c 65 64 0a 62 65 68 61 76 69 6f 72 20 69 73 20 63 | ons.whose.detailed.behavior.is.c |
| 5c80 | 61 70 74 75 72 65 64 20 62 79 20 6e 75 6d 65 72 69 63 61 6c 20 61 70 70 72 6f 78 69 6d 61 74 69 | aptured.by.numerical.approximati |
| 5ca0 | 6f 6e 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 0a 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 | ons.represented.in.computer.prog |
| 5cc0 | 72 61 6d 73 20 65 78 65 63 75 74 69 6e 67 20 6f 6e 20 63 6f 6d 70 75 74 65 72 73 20 63 6f 6d 70 | rams.executing.on.computers.comp |
| 5ce0 | 6f 73 65 64 20 6f 66 20 2e 2e 2e 21 0a 0a 20 20 20 49 74 20 69 73 20 6e 6f 74 20 6d 65 72 65 6c | osed.of....!.....It.is.not.merel |
| 5d00 | 79 20 61 20 6d 61 74 74 65 72 20 6f 66 20 74 61 63 74 69 63 61 6c 20 63 6f 6e 76 65 6e 69 65 6e | y.a.matter.of.tactical.convenien |
| 5d20 | 63 65 20 74 6f 20 73 65 70 61 72 61 74 65 6c 79 0a 69 64 65 6e 74 69 66 79 20 74 68 65 20 74 68 | ce.to.separately.identify.the.th |
| 5d40 | 72 65 65 20 66 6f 63 69 2e 20 20 45 76 65 6e 20 74 68 6f 75 67 68 2c 20 61 73 20 74 68 65 79 20 | ree.foci...Even.though,.as.they. |
| 5d60 | 73 61 79 2c 20 69 74 27 73 20 61 6c 6c 20 69 6e 20 74 68 65 0a 68 65 61 64 2c 20 74 68 69 73 20 | say,.it's.all.in.the.head,.this. |
| 5d80 | 6c 6f 67 69 63 61 6c 20 73 65 70 61 72 61 74 69 6f 6e 20 69 6e 64 75 63 65 73 20 61 6e 20 61 63 | logical.separation.induces.an.ac |
| 5da0 | 63 65 6c 65 72 61 74 69 6f 6e 20 6f 66 20 73 79 6d 62 6f 6c 69 63 0a 74 72 61 66 66 69 63 20 62 | celeration.of.symbolic.traffic.b |
| 5dc0 | 65 74 77 65 65 6e 20 74 68 65 73 65 20 66 6f 63 69 20 77 68 6f 73 65 20 72 69 63 68 6e 65 73 73 | etween.these.foci.whose.richness |
| 5de0 | 2c 20 76 69 74 61 6c 69 74 79 2c 20 61 6e 64 20 70 6f 74 65 6e 74 69 61 6c 20 69 73 0a 65 78 63 | ,.vitality,.and.potential.is.exc |
| 5e00 | 65 65 64 65 64 20 69 6e 20 68 75 6d 61 6e 20 65 78 70 65 72 69 65 6e 63 65 20 6f 6e 6c 79 20 62 | eeded.in.human.experience.only.b |
| 5e20 | 79 20 74 68 65 20 65 76 6f 6c 75 74 69 6f 6e 20 6f 66 20 6c 69 66 65 20 69 74 73 65 6c 66 2e 20 | y.the.evolution.of.life.itself.. |
| 5e40 | 20 41 74 0a 62 65 73 74 2c 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 73 20 62 65 74 77 65 65 6e 20 | .At.best,.relationships.between. |
| 5e60 | 74 68 65 20 66 6f 63 69 20 61 72 65 20 6d 65 74 61 73 74 61 62 6c 65 2e 20 20 54 68 65 20 63 6f | the.foci.are.metastable...The.co |
| 5e80 | 6d 70 75 74 65 72 73 20 61 72 65 0a 6e 65 76 65 72 20 6c 61 72 67 65 20 65 6e 6f 75 67 68 20 6f | mputers.are.never.large.enough.o |
| 5ea0 | 72 20 66 61 73 74 20 65 6e 6f 75 67 68 2e 20 20 45 61 63 68 20 62 72 65 61 6b 74 68 72 6f 75 67 | r.fast.enough...Each.breakthroug |
| 5ec0 | 68 20 69 6e 20 68 61 72 64 77 61 72 65 0a 74 65 63 68 6e 6f 6c 6f 67 79 20 6c 65 61 64 73 20 74 | h.in.hardware.technology.leads.t |
| 5ee0 | 6f 20 6d 6f 72 65 20 6d 61 73 73 69 76 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 65 6e 74 65 72 | o.more.massive.programming.enter |
| 5f00 | 70 72 69 73 65 73 2c 20 6e 65 77 0a 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 61 6c 20 70 72 69 6e 63 | prises,.new.organizational.princ |
| 5f20 | 69 70 6c 65 73 2c 20 61 6e 64 20 61 6e 20 65 6e 72 69 63 68 6d 65 6e 74 20 6f 66 20 61 62 73 74 | iples,.and.an.enrichment.of.abst |
| 5f40 | 72 61 63 74 20 6d 6f 64 65 6c 73 2e 20 20 45 76 65 72 79 0a 72 65 61 64 65 72 20 73 68 6f 75 6c | ract.models...Every.reader.shoul |
| 5f60 | 64 20 61 73 6b 20 68 69 6d 73 65 6c 66 20 70 65 72 69 6f 64 69 63 61 6c 6c 79 20 22 54 6f 77 61 | d.ask.himself.periodically."Towa |
| 5f80 | 72 64 20 77 68 61 74 20 65 6e 64 2c 20 74 6f 77 61 72 64 20 77 68 61 74 0a 65 6e 64 3f 22 2d 2d | rd.what.end,.toward.what.end?"-- |
| 5fa0 | 62 75 74 20 64 6f 20 6e 6f 74 20 61 73 6b 20 69 74 20 74 6f 6f 20 6f 66 74 65 6e 20 6c 65 73 74 | but.do.not.ask.it.too.often.lest |
| 5fc0 | 20 79 6f 75 20 70 61 73 73 20 75 70 20 74 68 65 20 66 75 6e 20 6f 66 0a 70 72 6f 67 72 61 6d 6d | .you.pass.up.the.fun.of.programm |
| 5fe0 | 69 6e 67 20 66 6f 72 20 74 68 65 20 63 6f 6e 73 74 69 70 61 74 69 6f 6e 20 6f 66 20 62 69 74 74 | ing.for.the.constipation.of.bitt |
| 6000 | 65 72 73 77 65 65 74 20 70 68 69 6c 6f 73 6f 70 68 79 2e 0a 0a 20 20 20 41 6d 6f 6e 67 20 74 68 | ersweet.philosophy......Among.th |
| 6020 | 65 20 70 72 6f 67 72 61 6d 73 20 77 65 20 77 72 69 74 65 2c 20 73 6f 6d 65 20 28 62 75 74 20 6e | e.programs.we.write,.some.(but.n |
| 6040 | 65 76 65 72 20 65 6e 6f 75 67 68 29 20 70 65 72 66 6f 72 6d 20 61 0a 70 72 65 63 69 73 65 20 6d | ever.enough).perform.a.precise.m |
| 6060 | 61 74 68 65 6d 61 74 69 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 73 75 63 68 20 61 73 20 73 6f 72 | athematical.function.such.as.sor |
| 6080 | 74 69 6e 67 20 6f 72 20 66 69 6e 64 69 6e 67 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 6f 66 0a 61 | ting.or.finding.the.maximum.of.a |
| 60a0 | 20 73 65 71 75 65 6e 63 65 20 6f 66 20 6e 75 6d 62 65 72 73 2c 20 64 65 74 65 72 6d 69 6e 69 6e | .sequence.of.numbers,.determinin |
| 60c0 | 67 20 70 72 69 6d 61 6c 69 74 79 2c 20 6f 72 20 66 69 6e 64 69 6e 67 20 74 68 65 20 73 71 75 61 | g.primality,.or.finding.the.squa |
| 60e0 | 72 65 0a 72 6f 6f 74 2e 20 20 57 65 20 63 61 6c 6c 20 73 75 63 68 20 70 72 6f 67 72 61 6d 73 20 | re.root...We.call.such.programs. |
| 6100 | 61 6c 67 6f 72 69 74 68 6d 73 2c 20 61 6e 64 20 61 20 67 72 65 61 74 20 64 65 61 6c 20 69 73 20 | algorithms,.and.a.great.deal.is. |
| 6120 | 6b 6e 6f 77 6e 20 6f 66 0a 74 68 65 69 72 20 6f 70 74 69 6d 61 6c 20 62 65 68 61 76 69 6f 72 2c | known.of.their.optimal.behavior, |
| 6140 | 20 70 61 72 74 69 63 75 6c 61 72 6c 79 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 74 68 | .particularly.with.respect.to.th |
| 6160 | 65 20 74 77 6f 20 69 6d 70 6f 72 74 61 6e 74 0a 70 61 72 61 6d 65 74 65 72 73 20 6f 66 20 65 78 | e.two.important.parameters.of.ex |
| 6180 | 65 63 75 74 69 6f 6e 20 74 69 6d 65 20 61 6e 64 20 64 61 74 61 20 73 74 6f 72 61 67 65 20 72 65 | ecution.time.and.data.storage.re |
| 61a0 | 71 75 69 72 65 6d 65 6e 74 73 2e 20 20 41 0a 70 72 6f 67 72 61 6d 6d 65 72 20 73 68 6f 75 6c 64 | quirements...A.programmer.should |
| 61c0 | 20 61 63 71 75 69 72 65 20 67 6f 6f 64 20 61 6c 67 6f 72 69 74 68 6d 73 20 61 6e 64 20 69 64 69 | .acquire.good.algorithms.and.idi |
| 61e0 | 6f 6d 73 2e 20 20 45 76 65 6e 20 74 68 6f 75 67 68 20 73 6f 6d 65 0a 70 72 6f 67 72 61 6d 73 20 | oms...Even.though.some.programs. |
| 6200 | 72 65 73 69 73 74 20 70 72 65 63 69 73 65 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 73 2c 20 69 | resist.precise.specifications,.i |
| 6220 | 74 20 69 73 20 74 68 65 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 20 6f 66 20 74 68 65 0a 70 | t.is.the.responsibility.of.the.p |
| 6240 | 72 6f 67 72 61 6d 6d 65 72 20 74 6f 20 65 73 74 69 6d 61 74 65 2c 20 61 6e 64 20 61 6c 77 61 79 | rogrammer.to.estimate,.and.alway |
| 6260 | 73 20 74 6f 20 61 74 74 65 6d 70 74 20 74 6f 20 69 6d 70 72 6f 76 65 2c 20 74 68 65 69 72 0a 70 | s.to.attempt.to.improve,.their.p |
| 6280 | 65 72 66 6f 72 6d 61 6e 63 65 2e 0a 0a 20 20 20 4c 69 73 70 20 69 73 20 61 20 73 75 72 76 69 76 | erformance......Lisp.is.a.surviv |
| 62a0 | 6f 72 2c 20 68 61 76 69 6e 67 20 62 65 65 6e 20 69 6e 20 75 73 65 20 66 6f 72 20 61 62 6f 75 74 | or,.having.been.in.use.for.about |
| 62c0 | 20 61 20 71 75 61 72 74 65 72 20 6f 66 20 61 0a 63 65 6e 74 75 72 79 2e 20 20 41 6d 6f 6e 67 20 | .a.quarter.of.a.century...Among. |
| 62e0 | 74 68 65 20 61 63 74 69 76 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 | the.active.programming.languages |
| 6300 | 20 6f 6e 6c 79 20 46 6f 72 74 72 61 6e 20 68 61 73 20 68 61 64 20 61 0a 6c 6f 6e 67 65 72 20 6c | .only.Fortran.has.had.a.longer.l |
| 6320 | 69 66 65 2e 20 20 42 6f 74 68 20 6c 61 6e 67 75 61 67 65 73 20 68 61 76 65 20 73 75 70 70 6f 72 | ife...Both.languages.have.suppor |
| 6340 | 74 65 64 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6e 65 65 64 73 20 6f 66 0a 69 6d 70 | ted.the.programming.needs.of.imp |
| 6360 | 6f 72 74 61 6e 74 20 61 72 65 61 73 20 6f 66 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 46 6f 72 | ortant.areas.of.application,.For |
| 6380 | 74 72 61 6e 20 66 6f 72 20 73 63 69 65 6e 74 69 66 69 63 20 61 6e 64 20 65 6e 67 69 6e 65 65 72 | tran.for.scientific.and.engineer |
| 63a0 | 69 6e 67 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 20 61 6e 64 20 4c 69 73 70 20 66 6f 72 20 61 72 74 | ing.computation.and.Lisp.for.art |
| 63c0 | 69 66 69 63 69 61 6c 20 69 6e 74 65 6c 6c 69 67 65 6e 63 65 2e 20 20 54 68 65 73 65 20 74 77 6f | ificial.intelligence...These.two |
| 63e0 | 20 61 72 65 61 73 0a 63 6f 6e 74 69 6e 75 65 20 74 6f 20 62 65 20 69 6d 70 6f 72 74 61 6e 74 2c | .areas.continue.to.be.important, |
| 6400 | 20 61 6e 64 20 74 68 65 69 72 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 61 72 65 20 73 6f 20 64 65 | .and.their.programmers.are.so.de |
| 6420 | 76 6f 74 65 64 20 74 6f 20 74 68 65 73 65 0a 74 77 6f 20 6c 61 6e 67 75 61 67 65 73 20 74 68 61 | voted.to.these.two.languages.tha |
| 6440 | 74 20 4c 69 73 70 20 61 6e 64 20 46 6f 72 74 72 61 6e 20 6d 61 79 20 77 65 6c 6c 20 63 6f 6e 74 | t.Lisp.and.Fortran.may.well.cont |
| 6460 | 69 6e 75 65 20 69 6e 20 61 63 74 69 76 65 20 75 73 65 20 66 6f 72 0a 61 74 20 6c 65 61 73 74 20 | inue.in.active.use.for.at.least. |
| 6480 | 61 6e 6f 74 68 65 72 20 71 75 61 72 74 65 72 2d 63 65 6e 74 75 72 79 2e 0a 0a 20 20 20 4c 69 73 | another.quarter-century......Lis |
| 64a0 | 70 20 63 68 61 6e 67 65 73 2e 20 20 54 68 65 20 53 63 68 65 6d 65 20 64 69 61 6c 65 63 74 20 75 | p.changes...The.Scheme.dialect.u |
| 64c0 | 73 65 64 20 69 6e 20 74 68 69 73 20 74 65 78 74 20 68 61 73 20 65 76 6f 6c 76 65 64 20 66 72 6f | sed.in.this.text.has.evolved.fro |
| 64e0 | 6d 0a 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 4c 69 73 70 20 61 6e 64 20 64 69 66 66 65 72 73 20 | m.the.original.Lisp.and.differs. |
| 6500 | 66 72 6f 6d 20 74 68 65 20 6c 61 74 74 65 72 20 69 6e 20 73 65 76 65 72 61 6c 20 69 6d 70 6f 72 | from.the.latter.in.several.impor |
| 6520 | 74 61 6e 74 0a 77 61 79 73 2c 20 69 6e 63 6c 75 64 69 6e 67 20 73 74 61 74 69 63 20 73 63 6f 70 | tant.ways,.including.static.scop |
| 6540 | 69 6e 67 20 66 6f 72 20 76 61 72 69 61 62 6c 65 20 62 69 6e 64 69 6e 67 20 61 6e 64 20 70 65 72 | ing.for.variable.binding.and.per |
| 6560 | 6d 69 74 74 69 6e 67 0a 66 75 6e 63 74 69 6f 6e 73 20 74 6f 20 79 69 65 6c 64 20 66 75 6e 63 74 | mitting.functions.to.yield.funct |
| 6580 | 69 6f 6e 73 20 61 73 20 76 61 6c 75 65 73 2e 20 20 49 6e 20 69 74 73 20 73 65 6d 61 6e 74 69 63 | ions.as.values...In.its.semantic |
| 65a0 | 20 73 74 72 75 63 74 75 72 65 0a 53 63 68 65 6d 65 20 69 73 20 61 73 20 63 6c 6f 73 65 6c 79 20 | .structure.Scheme.is.as.closely. |
| 65c0 | 61 6b 69 6e 20 74 6f 20 41 6c 67 6f 6c 20 36 30 20 61 73 20 74 6f 20 65 61 72 6c 79 20 4c 69 73 | akin.to.Algol.60.as.to.early.Lis |
| 65e0 | 70 73 2e 20 20 41 6c 67 6f 6c 20 36 30 2c 0a 6e 65 76 65 72 20 74 6f 20 62 65 20 61 6e 20 61 63 | ps...Algol.60,.never.to.be.an.ac |
| 6600 | 74 69 76 65 20 6c 61 6e 67 75 61 67 65 20 61 67 61 69 6e 2c 20 6c 69 76 65 73 20 6f 6e 20 69 6e | tive.language.again,.lives.on.in |
| 6620 | 20 74 68 65 20 67 65 6e 65 73 20 6f 66 20 53 63 68 65 6d 65 0a 61 6e 64 20 50 61 73 63 61 6c 2e | .the.genes.of.Scheme.and.Pascal. |
| 6640 | 20 20 49 74 20 77 6f 75 6c 64 20 62 65 20 64 69 66 66 69 63 75 6c 74 20 74 6f 20 66 69 6e 64 20 | ..It.would.be.difficult.to.find. |
| 6660 | 74 77 6f 20 6c 61 6e 67 75 61 67 65 73 20 74 68 61 74 20 61 72 65 20 74 68 65 0a 63 6f 6d 6d 75 | two.languages.that.are.the.commu |
| 6680 | 6e 69 63 61 74 69 6e 67 20 63 6f 69 6e 20 6f 66 20 74 77 6f 20 6d 6f 72 65 20 64 69 66 66 65 72 | nicating.coin.of.two.more.differ |
| 66a0 | 65 6e 74 20 63 75 6c 74 75 72 65 73 20 74 68 61 6e 20 74 68 6f 73 65 20 67 61 74 68 65 72 65 64 | ent.cultures.than.those.gathered |
| 66c0 | 0a 61 72 6f 75 6e 64 20 74 68 65 73 65 20 74 77 6f 20 6c 61 6e 67 75 61 67 65 73 2e 20 20 50 61 | .around.these.two.languages...Pa |
| 66e0 | 73 63 61 6c 20 69 73 20 66 6f 72 20 62 75 69 6c 64 69 6e 67 20 70 79 72 61 6d 69 64 73 2d 2d 69 | scal.is.for.building.pyramids--i |
| 6700 | 6d 70 6f 73 69 6e 67 2c 0a 62 72 65 61 74 68 74 61 6b 69 6e 67 2c 20 73 74 61 74 69 63 20 73 74 | mposing,.breathtaking,.static.st |
| 6720 | 72 75 63 74 75 72 65 73 20 62 75 69 6c 74 20 62 79 20 61 72 6d 69 65 73 20 70 75 73 68 69 6e 67 | ructures.built.by.armies.pushing |
| 6740 | 20 68 65 61 76 79 20 62 6c 6f 63 6b 73 0a 69 6e 74 6f 20 70 6c 61 63 65 2e 20 20 4c 69 73 70 20 | .heavy.blocks.into.place...Lisp. |
| 6760 | 69 73 20 66 6f 72 20 62 75 69 6c 64 69 6e 67 20 6f 72 67 61 6e 69 73 6d 73 2d 2d 69 6d 70 6f 73 | is.for.building.organisms--impos |
| 6780 | 69 6e 67 2c 20 62 72 65 61 74 68 74 61 6b 69 6e 67 2c 0a 64 79 6e 61 6d 69 63 20 73 74 72 75 63 | ing,.breathtaking,.dynamic.struc |
| 67a0 | 74 75 72 65 73 20 62 75 69 6c 74 20 62 79 20 73 71 75 61 64 73 20 66 69 74 74 69 6e 67 20 66 6c | tures.built.by.squads.fitting.fl |
| 67c0 | 75 63 74 75 61 74 69 6e 67 20 6d 79 72 69 61 64 73 20 6f 66 0a 73 69 6d 70 6c 65 72 20 6f 72 67 | uctuating.myriads.of.simpler.org |
| 67e0 | 61 6e 69 73 6d 73 20 69 6e 74 6f 20 70 6c 61 63 65 2e 20 20 54 68 65 20 6f 72 67 61 6e 69 7a 69 | anisms.into.place...The.organizi |
| 6800 | 6e 67 20 70 72 69 6e 63 69 70 6c 65 73 20 75 73 65 64 20 61 72 65 20 74 68 65 0a 73 61 6d 65 20 | ng.principles.used.are.the.same. |
| 6820 | 69 6e 20 62 6f 74 68 20 63 61 73 65 73 2c 20 65 78 63 65 70 74 20 66 6f 72 20 6f 6e 65 20 65 78 | in.both.cases,.except.for.one.ex |
| 6840 | 74 72 61 6f 72 64 69 6e 61 72 69 6c 79 20 69 6d 70 6f 72 74 61 6e 74 0a 64 69 66 66 65 72 65 6e | traordinarily.important.differen |
| 6860 | 63 65 3a 20 54 68 65 20 64 69 73 63 72 65 74 69 6f 6e 61 72 79 20 65 78 70 6f 72 74 61 62 6c 65 | ce:.The.discretionary.exportable |
| 6880 | 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 65 6e 74 72 75 73 74 65 64 20 74 6f 20 74 68 65 0a | .functionality.entrusted.to.the. |
| 68a0 | 69 6e 64 69 76 69 64 75 61 6c 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 6d 65 72 20 69 73 20 6d 6f | individual.Lisp.programmer.is.mo |
| 68c0 | 72 65 20 74 68 61 6e 20 61 6e 20 6f 72 64 65 72 20 6f 66 20 6d 61 67 6e 69 74 75 64 65 20 67 72 | re.than.an.order.of.magnitude.gr |
| 68e0 | 65 61 74 65 72 0a 74 68 61 6e 20 74 68 61 74 20 74 6f 20 62 65 20 66 6f 75 6e 64 20 77 69 74 68 | eater.than.that.to.be.found.with |
| 6900 | 69 6e 20 50 61 73 63 61 6c 20 65 6e 74 65 72 70 72 69 73 65 73 2e 20 20 4c 69 73 70 20 70 72 6f | in.Pascal.enterprises...Lisp.pro |
| 6920 | 67 72 61 6d 73 20 69 6e 66 6c 61 74 65 0a 6c 69 62 72 61 72 69 65 73 20 77 69 74 68 20 66 75 6e | grams.inflate.libraries.with.fun |
| 6940 | 63 74 69 6f 6e 73 20 77 68 6f 73 65 20 75 74 69 6c 69 74 79 20 74 72 61 6e 73 63 65 6e 64 73 20 | ctions.whose.utility.transcends. |
| 6960 | 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 74 68 61 74 0a 70 72 6f 64 75 63 65 64 20 74 68 | the.application.that.produced.th |
| 6980 | 65 6d 2e 20 20 54 68 65 20 6c 69 73 74 2c 20 4c 69 73 70 27 73 20 6e 61 74 69 76 65 20 64 61 74 | em...The.list,.Lisp's.native.dat |
| 69a0 | 61 20 73 74 72 75 63 74 75 72 65 2c 20 69 73 20 6c 61 72 67 65 6c 79 0a 72 65 73 70 6f 6e 73 69 | a.structure,.is.largely.responsi |
| 69c0 | 62 6c 65 20 66 6f 72 20 73 75 63 68 20 67 72 6f 77 74 68 20 6f 66 20 75 74 69 6c 69 74 79 2e 20 | ble.for.such.growth.of.utility.. |
| 69e0 | 20 54 68 65 20 73 69 6d 70 6c 65 20 73 74 72 75 63 74 75 72 65 20 61 6e 64 0a 6e 61 74 75 72 61 | .The.simple.structure.and.natura |
| 6a00 | 6c 20 61 70 70 6c 69 63 61 62 69 6c 69 74 79 20 6f 66 20 6c 69 73 74 73 20 61 72 65 20 72 65 66 | l.applicability.of.lists.are.ref |
| 6a20 | 6c 65 63 74 65 64 20 69 6e 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 0a 61 6d 61 | lected.in.functions.that.are.ama |
| 6a40 | 7a 69 6e 67 6c 79 20 6e 6f 6e 69 64 69 6f 73 79 6e 63 72 61 74 69 63 2e 20 20 49 6e 20 50 61 73 | zingly.nonidiosyncratic...In.Pas |
| 6a60 | 63 61 6c 20 74 68 65 20 70 6c 65 74 68 6f 72 61 20 6f 66 20 64 65 63 6c 61 72 61 62 6c 65 20 64 | cal.the.plethora.of.declarable.d |
| 6a80 | 61 74 61 0a 73 74 72 75 63 74 75 72 65 73 20 69 6e 64 75 63 65 73 20 61 20 73 70 65 63 69 61 6c | ata.structures.induces.a.special |
| 6aa0 | 69 7a 61 74 69 6f 6e 20 77 69 74 68 69 6e 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 69 6e | ization.within.functions.that.in |
| 6ac0 | 68 69 62 69 74 73 20 61 6e 64 0a 70 65 6e 61 6c 69 7a 65 73 20 63 61 73 75 61 6c 20 63 6f 6f 70 | hibits.and.penalizes.casual.coop |
| 6ae0 | 65 72 61 74 69 6f 6e 2e 20 20 49 74 20 69 73 20 62 65 74 74 65 72 20 74 6f 20 68 61 76 65 20 31 | eration...It.is.better.to.have.1 |
| 6b00 | 30 30 20 66 75 6e 63 74 69 6f 6e 73 0a 6f 70 65 72 61 74 65 20 6f 6e 20 6f 6e 65 20 64 61 74 61 | 00.functions.operate.on.one.data |
| 6b20 | 20 73 74 72 75 63 74 75 72 65 20 74 68 61 6e 20 74 6f 20 68 61 76 65 20 31 30 20 66 75 6e 63 74 | .structure.than.to.have.10.funct |
| 6b40 | 69 6f 6e 73 20 6f 70 65 72 61 74 65 20 6f 6e 20 31 30 0a 64 61 74 61 20 73 74 72 75 63 74 75 72 | ions.operate.on.10.data.structur |
| 6b60 | 65 73 2e 20 20 41 73 20 61 20 72 65 73 75 6c 74 20 74 68 65 20 70 79 72 61 6d 69 64 20 6d 75 73 | es...As.a.result.the.pyramid.mus |
| 6b80 | 74 20 73 74 61 6e 64 20 75 6e 63 68 61 6e 67 65 64 20 66 6f 72 20 61 0a 6d 69 6c 6c 65 6e 6e 69 | t.stand.unchanged.for.a.millenni |
| 6ba0 | 75 6d 3b 20 74 68 65 20 6f 72 67 61 6e 69 73 6d 20 6d 75 73 74 20 65 76 6f 6c 76 65 20 6f 72 20 | um;.the.organism.must.evolve.or. |
| 6bc0 | 70 65 72 69 73 68 2e 0a 0a 20 20 20 54 6f 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 69 73 20 64 | perish......To.illustrate.this.d |
| 6be0 | 69 66 66 65 72 65 6e 63 65 2c 20 63 6f 6d 70 61 72 65 20 74 68 65 20 74 72 65 61 74 6d 65 6e 74 | ifference,.compare.the.treatment |
| 6c00 | 20 6f 66 20 6d 61 74 65 72 69 61 6c 20 61 6e 64 0a 65 78 65 72 63 69 73 65 73 20 77 69 74 68 69 | .of.material.and.exercises.withi |
| 6c20 | 6e 20 74 68 69 73 20 62 6f 6f 6b 20 77 69 74 68 20 74 68 61 74 20 69 6e 20 61 6e 79 20 66 69 72 | n.this.book.with.that.in.any.fir |
| 6c40 | 73 74 2d 63 6f 75 72 73 65 20 74 65 78 74 20 75 73 69 6e 67 0a 50 61 73 63 61 6c 2e 20 20 44 6f | st-course.text.using.Pascal...Do |
| 6c60 | 20 6e 6f 74 20 6c 61 62 6f 72 20 75 6e 64 65 72 20 74 68 65 20 69 6c 6c 75 73 69 6f 6e 20 74 68 | .not.labor.under.the.illusion.th |
| 6c80 | 61 74 20 74 68 69 73 20 69 73 20 61 20 74 65 78 74 20 64 69 67 65 73 74 69 62 6c 65 0a 61 74 20 | at.this.is.a.text.digestible.at. |
| 6ca0 | 4d 49 54 20 6f 6e 6c 79 2c 20 70 65 63 75 6c 69 61 72 20 74 6f 20 74 68 65 20 62 72 65 65 64 20 | MIT.only,.peculiar.to.the.breed. |
| 6cc0 | 66 6f 75 6e 64 20 74 68 65 72 65 2e 20 20 49 74 20 69 73 20 70 72 65 63 69 73 65 6c 79 20 77 68 | found.there...It.is.precisely.wh |
| 6ce0 | 61 74 20 61 0a 73 65 72 69 6f 75 73 20 62 6f 6f 6b 20 6f 6e 20 70 72 6f 67 72 61 6d 6d 69 6e 67 | at.a.serious.book.on.programming |
| 6d00 | 20 4c 69 73 70 20 6d 75 73 74 20 62 65 2c 20 6e 6f 20 6d 61 74 74 65 72 20 77 68 6f 20 74 68 65 | .Lisp.must.be,.no.matter.who.the |
| 6d20 | 20 73 74 75 64 65 6e 74 20 69 73 0a 6f 72 20 77 68 65 72 65 20 69 74 20 69 73 20 75 73 65 64 2e | .student.is.or.where.it.is.used. |
| 6d40 | 0a 0a 20 20 20 4e 6f 74 65 20 74 68 61 74 20 74 68 69 73 20 69 73 20 61 20 74 65 78 74 20 61 62 | .....Note.that.this.is.a.text.ab |
| 6d60 | 6f 75 74 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 20 75 6e 6c 69 6b 65 20 6d 6f 73 74 20 4c 69 73 | out.programming,.unlike.most.Lis |
| 6d80 | 70 20 62 6f 6f 6b 73 2c 0a 77 68 69 63 68 20 61 72 65 20 75 73 65 64 20 61 73 20 61 20 70 72 65 | p.books,.which.are.used.as.a.pre |
| 6da0 | 70 61 72 61 74 69 6f 6e 20 66 6f 72 20 77 6f 72 6b 20 69 6e 20 61 72 74 69 66 69 63 69 61 6c 20 | paration.for.work.in.artificial. |
| 6dc0 | 69 6e 74 65 6c 6c 69 67 65 6e 63 65 2e 0a 41 66 74 65 72 20 61 6c 6c 2c 20 74 68 65 20 63 72 69 | intelligence..After.all,.the.cri |
| 6de0 | 74 69 63 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 63 6f 6e 63 65 72 6e 73 20 6f 66 20 73 6f | tical.programming.concerns.of.so |
| 6e00 | 66 74 77 61 72 65 20 65 6e 67 69 6e 65 65 72 69 6e 67 0a 61 6e 64 20 61 72 74 69 66 69 63 69 61 | ftware.engineering.and.artificia |
| 6e20 | 6c 20 69 6e 74 65 6c 6c 69 67 65 6e 63 65 20 74 65 6e 64 20 74 6f 20 63 6f 61 6c 65 73 63 65 20 | l.intelligence.tend.to.coalesce. |
| 6e40 | 61 73 20 74 68 65 20 73 79 73 74 65 6d 73 20 75 6e 64 65 72 0a 69 6e 76 65 73 74 69 67 61 74 69 | as.the.systems.under.investigati |
| 6e60 | 6f 6e 20 62 65 63 6f 6d 65 20 6c 61 72 67 65 72 2e 20 20 54 68 69 73 20 65 78 70 6c 61 69 6e 73 | on.become.larger...This.explains |
| 6e80 | 20 77 68 79 20 74 68 65 72 65 20 69 73 20 73 75 63 68 20 67 72 6f 77 69 6e 67 0a 69 6e 74 65 72 | .why.there.is.such.growing.inter |
| 6ea0 | 65 73 74 20 69 6e 20 4c 69 73 70 20 6f 75 74 73 69 64 65 20 6f 66 20 61 72 74 69 66 69 63 69 61 | est.in.Lisp.outside.of.artificia |
| 6ec0 | 6c 20 69 6e 74 65 6c 6c 69 67 65 6e 63 65 2e 0a 0a 20 20 20 41 73 20 6f 6e 65 20 77 6f 75 6c 64 | l.intelligence......As.one.would |
| 6ee0 | 20 65 78 70 65 63 74 20 66 72 6f 6d 20 69 74 73 20 67 6f 61 6c 73 2c 20 61 72 74 69 66 69 63 69 | .expect.from.its.goals,.artifici |
| 6f00 | 61 6c 20 69 6e 74 65 6c 6c 69 67 65 6e 63 65 20 72 65 73 65 61 72 63 68 0a 67 65 6e 65 72 61 74 | al.intelligence.research.generat |
| 6f20 | 65 73 20 6d 61 6e 79 20 73 69 67 6e 69 66 69 63 61 6e 74 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 | es.many.significant.programming. |
| 6f40 | 70 72 6f 62 6c 65 6d 73 2e 20 20 49 6e 20 6f 74 68 65 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 0a | problems...In.other.programming. |
| 6f60 | 63 75 6c 74 75 72 65 73 20 74 68 69 73 20 73 70 61 74 65 20 6f 66 20 70 72 6f 62 6c 65 6d 73 20 | cultures.this.spate.of.problems. |
| 6f80 | 73 70 61 77 6e 73 20 6e 65 77 20 6c 61 6e 67 75 61 67 65 73 2e 20 20 49 6e 64 65 65 64 2c 20 69 | spawns.new.languages...Indeed,.i |
| 6fa0 | 6e 20 61 6e 79 0a 76 65 72 79 20 6c 61 72 67 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 74 61 73 | n.any.very.large.programming.tas |
| 6fc0 | 6b 20 61 20 75 73 65 66 75 6c 20 6f 72 67 61 6e 69 7a 69 6e 67 20 70 72 69 6e 63 69 70 6c 65 20 | k.a.useful.organizing.principle. |
| 6fe0 | 69 73 20 74 6f 20 63 6f 6e 74 72 6f 6c 0a 61 6e 64 20 69 73 6f 6c 61 74 65 20 74 72 61 66 66 69 | is.to.control.and.isolate.traffi |
| 7000 | 63 20 77 69 74 68 69 6e 20 74 68 65 20 74 61 73 6b 20 6d 6f 64 75 6c 65 73 20 76 69 61 20 74 68 | c.within.the.task.modules.via.th |
| 7020 | 65 20 69 6e 76 65 6e 74 69 6f 6e 20 6f 66 0a 6c 61 6e 67 75 61 67 65 2e 20 20 54 68 65 73 65 20 | e.invention.of.language...These. |
| 7040 | 6c 61 6e 67 75 61 67 65 73 20 74 65 6e 64 20 74 6f 20 62 65 63 6f 6d 65 20 6c 65 73 73 20 70 72 | languages.tend.to.become.less.pr |
| 7060 | 69 6d 69 74 69 76 65 20 61 73 20 6f 6e 65 0a 61 70 70 72 6f 61 63 68 65 73 20 74 68 65 20 62 6f | imitive.as.one.approaches.the.bo |
| 7080 | 75 6e 64 61 72 69 65 73 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 20 77 68 65 72 65 20 77 65 20 | undaries.of.the.system.where.we. |
| 70a0 | 68 75 6d 61 6e 73 20 69 6e 74 65 72 61 63 74 20 6d 6f 73 74 0a 6f 66 74 65 6e 2e 20 20 41 73 20 | humans.interact.most.often...As. |
| 70c0 | 61 20 72 65 73 75 6c 74 2c 20 73 75 63 68 20 73 79 73 74 65 6d 73 20 63 6f 6e 74 61 69 6e 20 63 | a.result,.such.systems.contain.c |
| 70e0 | 6f 6d 70 6c 65 78 20 6c 61 6e 67 75 61 67 65 2d 70 72 6f 63 65 73 73 69 6e 67 0a 66 75 6e 63 74 | omplex.language-processing.funct |
| 7100 | 69 6f 6e 73 20 72 65 70 6c 69 63 61 74 65 64 20 6d 61 6e 79 20 74 69 6d 65 73 2e 20 20 4c 69 73 | ions.replicated.many.times...Lis |
| 7120 | 70 20 68 61 73 20 73 75 63 68 20 61 20 73 69 6d 70 6c 65 20 73 79 6e 74 61 78 20 61 6e 64 0a 73 | p.has.such.a.simple.syntax.and.s |
| 7140 | 65 6d 61 6e 74 69 63 73 20 74 68 61 74 20 70 61 72 73 69 6e 67 20 63 61 6e 20 62 65 20 74 72 65 | emantics.that.parsing.can.be.tre |
| 7160 | 61 74 65 64 20 61 73 20 61 6e 20 65 6c 65 6d 65 6e 74 61 72 79 20 74 61 73 6b 2e 20 20 54 68 75 | ated.as.an.elementary.task...Thu |
| 7180 | 73 0a 70 61 72 73 69 6e 67 20 74 65 63 68 6e 6f 6c 6f 67 79 20 70 6c 61 79 73 20 61 6c 6d 6f 73 | s.parsing.technology.plays.almos |
| 71a0 | 74 20 6e 6f 20 72 6f 6c 65 20 69 6e 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 73 2c 20 61 6e 64 20 | t.no.role.in.Lisp.programs,.and. |
| 71c0 | 74 68 65 0a 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 6f 66 20 6c 61 6e 67 75 61 67 65 20 70 72 6f | the.construction.of.language.pro |
| 71e0 | 63 65 73 73 6f 72 73 20 69 73 20 72 61 72 65 6c 79 20 61 6e 20 69 6d 70 65 64 69 6d 65 6e 74 20 | cessors.is.rarely.an.impediment. |
| 7200 | 74 6f 20 74 68 65 20 72 61 74 65 0a 6f 66 20 67 72 6f 77 74 68 20 61 6e 64 20 63 68 61 6e 67 65 | to.the.rate.of.growth.and.change |
| 7220 | 20 6f 66 20 6c 61 72 67 65 20 4c 69 73 70 20 73 79 73 74 65 6d 73 2e 20 20 46 69 6e 61 6c 6c 79 | .of.large.Lisp.systems...Finally |
| 7240 | 2c 20 69 74 20 69 73 20 74 68 69 73 20 76 65 72 79 0a 73 69 6d 70 6c 69 63 69 74 79 20 6f 66 20 | ,.it.is.this.very.simplicity.of. |
| 7260 | 73 79 6e 74 61 78 20 61 6e 64 20 73 65 6d 61 6e 74 69 63 73 20 74 68 61 74 20 69 73 20 72 65 73 | syntax.and.semantics.that.is.res |
| 7280 | 70 6f 6e 73 69 62 6c 65 20 66 6f 72 20 74 68 65 20 62 75 72 64 65 6e 0a 61 6e 64 20 66 72 65 65 | ponsible.for.the.burden.and.free |
| 72a0 | 64 6f 6d 20 62 6f 72 6e 65 20 62 79 20 61 6c 6c 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 6d 65 72 | dom.borne.by.all.Lisp.programmer |
| 72c0 | 73 2e 20 20 4e 6f 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 20 6f 66 20 61 6e 79 20 73 69 7a 65 0a | s...No.Lisp.program.of.any.size. |
| 72e0 | 62 65 79 6f 6e 64 20 61 20 66 65 77 20 6c 69 6e 65 73 20 63 61 6e 20 62 65 20 77 72 69 74 74 65 | beyond.a.few.lines.can.be.writte |
| 7300 | 6e 20 77 69 74 68 6f 75 74 20 62 65 69 6e 67 20 73 61 74 75 72 61 74 65 64 20 77 69 74 68 0a 64 | n.without.being.saturated.with.d |
| 7320 | 69 73 63 72 65 74 69 6f 6e 61 72 79 20 66 75 6e 63 74 69 6f 6e 73 2e 20 20 49 6e 76 65 6e 74 20 | iscretionary.functions...Invent. |
| 7340 | 61 6e 64 20 66 69 74 3b 20 68 61 76 65 20 66 69 74 73 20 61 6e 64 20 72 65 69 6e 76 65 6e 74 21 | and.fit;.have.fits.and.reinvent! |
| 7360 | 20 20 57 65 0a 74 6f 61 73 74 20 74 68 65 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 6d 65 72 20 77 | ..We.toast.the.Lisp.programmer.w |
| 7380 | 68 6f 20 70 65 6e 73 20 68 69 73 20 74 68 6f 75 67 68 74 73 20 77 69 74 68 69 6e 20 6e 65 73 74 | ho.pens.his.thoughts.within.nest |
| 73a0 | 73 20 6f 66 0a 70 61 72 65 6e 74 68 65 73 65 73 2e 0a 0a 41 6c 61 6e 20 4a 2e 20 50 65 72 6c 69 | s.of.parentheses...Alan.J..Perli |
| 73c0 | 73 0a 4e 65 77 20 48 61 76 65 6e 2c 20 43 6f 6e 6e 65 63 74 69 63 75 74 0a 0a 1f 0a 46 69 6c 65 | s.New.Haven,.Connecticut....File |
| 73e0 | 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 50 72 65 66 61 63 65 2c 20 20 4e 65 | :.sicp.info,..Node:.Preface,..Ne |
| 7400 | 78 74 3a 20 50 72 65 66 61 63 65 20 31 65 2c 20 20 50 72 65 76 3a 20 46 6f 72 65 77 6f 72 64 2c | xt:.Preface.1e,..Prev:.Foreword, |
| 7420 | 20 20 55 70 3a 20 54 6f 70 0a 0a 50 72 65 66 61 63 65 20 74 6f 20 74 68 65 20 53 65 63 6f 6e 64 | ..Up:.Top..Preface.to.the.Second |
| 7440 | 20 45 64 69 74 69 6f 6e 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a | .Edition.*********************** |
| 7460 | 2a 2a 2a 2a 2a 2a 0a 0a 20 20 20 20 20 49 73 20 69 74 20 70 6f 73 73 69 62 6c 65 20 74 68 61 74 | ******.......Is.it.possible.that |
| 7480 | 20 73 6f 66 74 77 61 72 65 20 69 73 20 6e 6f 74 20 6c 69 6b 65 20 61 6e 79 74 68 69 6e 67 20 65 | .software.is.not.like.anything.e |
| 74a0 | 6c 73 65 2c 20 74 68 61 74 20 69 74 20 69 73 0a 20 20 20 20 20 6d 65 61 6e 74 20 74 6f 20 62 65 | lse,.that.it.is......meant.to.be |
| 74c0 | 20 64 69 73 63 61 72 64 65 64 3a 20 74 68 61 74 20 74 68 65 20 77 68 6f 6c 65 20 70 6f 69 6e 74 | .discarded:.that.the.whole.point |
| 74e0 | 20 69 73 20 74 6f 20 61 6c 77 61 79 73 20 73 65 65 20 69 74 20 61 73 0a 20 20 20 20 20 61 20 73 | .is.to.always.see.it.as......a.s |
| 7500 | 6f 61 70 20 62 75 62 62 6c 65 3f 0a 0a 20 20 20 20 20 2d 2d 41 6c 61 6e 20 4a 2e 20 50 65 72 6c | oap.bubble?.......--Alan.J..Perl |
| 7520 | 69 73 0a 0a 20 20 20 54 68 65 20 6d 61 74 65 72 69 61 6c 20 69 6e 20 74 68 69 73 20 62 6f 6f 6b | is.....The.material.in.this.book |
| 7540 | 20 68 61 73 20 62 65 65 6e 20 74 68 65 20 62 61 73 69 73 20 6f 66 20 4d 49 54 27 73 20 65 6e 74 | .has.been.the.basis.of.MIT's.ent |
| 7560 | 72 79 2d 6c 65 76 65 6c 0a 63 6f 6d 70 75 74 65 72 20 73 63 69 65 6e 63 65 20 73 75 62 6a 65 63 | ry-level.computer.science.subjec |
| 7580 | 74 20 73 69 6e 63 65 20 31 39 38 30 2e 20 20 57 65 20 68 61 64 20 62 65 65 6e 20 74 65 61 63 68 | t.since.1980...We.had.been.teach |
| 75a0 | 69 6e 67 20 74 68 69 73 0a 6d 61 74 65 72 69 61 6c 20 66 6f 72 20 66 6f 75 72 20 79 65 61 72 73 | ing.this.material.for.four.years |
| 75c0 | 20 77 68 65 6e 20 74 68 65 20 66 69 72 73 74 20 65 64 69 74 69 6f 6e 20 77 61 73 20 70 75 62 6c | .when.the.first.edition.was.publ |
| 75e0 | 69 73 68 65 64 2c 20 61 6e 64 0a 74 77 65 6c 76 65 20 6d 6f 72 65 20 79 65 61 72 73 20 68 61 76 | ished,.and.twelve.more.years.hav |
| 7600 | 65 20 65 6c 61 70 73 65 64 20 75 6e 74 69 6c 20 74 68 65 20 61 70 70 65 61 72 61 6e 63 65 20 6f | e.elapsed.until.the.appearance.o |
| 7620 | 66 20 74 68 69 73 20 73 65 63 6f 6e 64 0a 65 64 69 74 69 6f 6e 2e 20 20 57 65 20 61 72 65 20 70 | f.this.second.edition...We.are.p |
| 7640 | 6c 65 61 73 65 64 20 74 68 61 74 20 6f 75 72 20 77 6f 72 6b 20 68 61 73 20 62 65 65 6e 20 77 69 | leased.that.our.work.has.been.wi |
| 7660 | 64 65 6c 79 20 61 64 6f 70 74 65 64 20 61 6e 64 0a 69 6e 63 6f 72 70 6f 72 61 74 65 64 20 69 6e | dely.adopted.and.incorporated.in |
| 7680 | 74 6f 20 6f 74 68 65 72 20 74 65 78 74 73 2e 20 20 57 65 20 68 61 76 65 20 73 65 65 6e 20 6f 75 | to.other.texts...We.have.seen.ou |
| 76a0 | 72 20 73 74 75 64 65 6e 74 73 20 74 61 6b 65 20 74 68 65 0a 69 64 65 61 73 20 61 6e 64 20 70 72 | r.students.take.the.ideas.and.pr |
| 76c0 | 6f 67 72 61 6d 73 20 69 6e 20 74 68 69 73 20 62 6f 6f 6b 20 61 6e 64 20 62 75 69 6c 64 20 74 68 | ograms.in.this.book.and.build.th |
| 76e0 | 65 6d 20 69 6e 20 61 73 20 74 68 65 20 63 6f 72 65 20 6f 66 20 6e 65 77 0a 63 6f 6d 70 75 74 65 | em.in.as.the.core.of.new.compute |
| 7700 | 72 20 73 79 73 74 65 6d 73 20 61 6e 64 20 6c 61 6e 67 75 61 67 65 73 2e 20 20 49 6e 20 6c 69 74 | r.systems.and.languages...In.lit |
| 7720 | 65 72 61 6c 20 72 65 61 6c 69 7a 61 74 69 6f 6e 20 6f 66 20 61 6e 20 61 6e 63 69 65 6e 74 0a 54 | eral.realization.of.an.ancient.T |
| 7740 | 61 6c 6d 75 64 69 63 20 70 75 6e 2c 20 6f 75 72 20 73 74 75 64 65 6e 74 73 20 68 61 76 65 20 62 | almudic.pun,.our.students.have.b |
| 7760 | 65 63 6f 6d 65 20 6f 75 72 20 62 75 69 6c 64 65 72 73 2e 20 20 57 65 20 61 72 65 20 6c 75 63 6b | ecome.our.builders...We.are.luck |
| 7780 | 79 20 74 6f 0a 68 61 76 65 20 73 75 63 68 20 63 61 70 61 62 6c 65 20 73 74 75 64 65 6e 74 73 20 | y.to.have.such.capable.students. |
| 77a0 | 61 6e 64 20 73 75 63 68 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 75 69 6c 64 65 72 73 2e 0a | and.such.accomplished.builders.. |
| 77c0 | 0a 20 20 20 49 6e 20 70 72 65 70 61 72 69 6e 67 20 74 68 69 73 20 65 64 69 74 69 6f 6e 2c 20 77 | ....In.preparing.this.edition,.w |
| 77e0 | 65 20 68 61 76 65 20 69 6e 63 6f 72 70 6f 72 61 74 65 64 20 68 75 6e 64 72 65 64 73 20 6f 66 0a | e.have.incorporated.hundreds.of. |
| 7800 | 63 6c 61 72 69 66 69 63 61 74 69 6f 6e 73 20 73 75 67 67 65 73 74 65 64 20 62 79 20 6f 75 72 20 | clarifications.suggested.by.our. |
| 7820 | 6f 77 6e 20 74 65 61 63 68 69 6e 67 20 65 78 70 65 72 69 65 6e 63 65 20 61 6e 64 20 74 68 65 0a | own.teaching.experience.and.the. |
| 7840 | 63 6f 6d 6d 65 6e 74 73 20 6f 66 20 63 6f 6c 6c 65 61 67 75 65 73 20 61 74 20 4d 49 54 20 61 6e | comments.of.colleagues.at.MIT.an |
| 7860 | 64 20 65 6c 73 65 77 68 65 72 65 2e 20 20 57 65 20 68 61 76 65 20 72 65 64 65 73 69 67 6e 65 64 | d.elsewhere...We.have.redesigned |
| 7880 | 20 6d 6f 73 74 0a 6f 66 20 74 68 65 20 6d 61 6a 6f 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 73 | .most.of.the.major.programming.s |
| 78a0 | 79 73 74 65 6d 73 20 69 6e 20 74 68 65 20 62 6f 6f 6b 2c 20 69 6e 63 6c 75 64 69 6e 67 20 74 68 | ystems.in.the.book,.including.th |
| 78c0 | 65 0a 67 65 6e 65 72 69 63 2d 61 72 69 74 68 6d 65 74 69 63 20 73 79 73 74 65 6d 2c 20 74 68 65 | e.generic-arithmetic.system,.the |
| 78e0 | 20 69 6e 74 65 72 70 72 65 74 65 72 73 2c 20 74 68 65 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 | .interpreters,.the.register-mach |
| 7900 | 69 6e 65 0a 73 69 6d 75 6c 61 74 6f 72 2c 20 61 6e 64 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 3b | ine.simulator,.and.the.compiler; |
| 7920 | 20 61 6e 64 20 77 65 20 68 61 76 65 20 72 65 77 72 69 74 74 65 6e 20 61 6c 6c 20 74 68 65 20 70 | .and.we.have.rewritten.all.the.p |
| 7940 | 72 6f 67 72 61 6d 0a 65 78 61 6d 70 6c 65 73 20 74 6f 20 65 6e 73 75 72 65 20 74 68 61 74 20 61 | rogram.examples.to.ensure.that.a |
| 7960 | 6e 79 20 53 63 68 65 6d 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 63 6f 6e 66 6f 72 6d | ny.Scheme.implementation.conform |
| 7980 | 69 6e 67 20 74 6f 20 74 68 65 0a 49 45 45 45 20 53 63 68 65 6d 65 20 73 74 61 6e 64 61 72 64 20 | ing.to.the.IEEE.Scheme.standard. |
| 79a0 | 28 49 45 45 45 20 31 39 39 30 29 20 77 69 6c 6c 20 62 65 20 61 62 6c 65 20 74 6f 20 72 75 6e 20 | (IEEE.1990).will.be.able.to.run. |
| 79c0 | 74 68 65 20 63 6f 64 65 2e 0a 0a 20 20 20 54 68 69 73 20 65 64 69 74 69 6f 6e 20 65 6d 70 68 61 | the.code......This.edition.empha |
| 79e0 | 73 69 7a 65 73 20 73 65 76 65 72 61 6c 20 6e 65 77 20 74 68 65 6d 65 73 2e 20 20 54 68 65 20 6d | sizes.several.new.themes...The.m |
| 7a00 | 6f 73 74 20 69 6d 70 6f 72 74 61 6e 74 20 6f 66 0a 74 68 65 73 65 20 69 73 20 74 68 65 20 63 65 | ost.important.of.these.is.the.ce |
| 7a20 | 6e 74 72 61 6c 20 72 6f 6c 65 20 70 6c 61 79 65 64 20 62 79 20 64 69 66 66 65 72 65 6e 74 20 61 | ntral.role.played.by.different.a |
| 7a40 | 70 70 72 6f 61 63 68 65 73 20 74 6f 20 64 65 61 6c 69 6e 67 0a 77 69 74 68 20 74 69 6d 65 20 69 | pproaches.to.dealing.with.time.i |
| 7a60 | 6e 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 3a 20 6f 62 6a 65 63 74 73 20 | n.computational.models:.objects. |
| 7a80 | 77 69 74 68 20 73 74 61 74 65 2c 20 63 6f 6e 63 75 72 72 65 6e 74 0a 70 72 6f 67 72 61 6d 6d 69 | with.state,.concurrent.programmi |
| 7aa0 | 6e 67 2c 20 66 75 6e 63 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 20 6c 61 7a 79 | ng,.functional.programming,.lazy |
| 7ac0 | 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 61 6e 64 0a 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 | .evaluation,.and.nondeterministi |
| 7ae0 | 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2e 20 20 57 65 20 68 61 76 65 20 69 6e 63 6c 75 64 65 64 | c.programming...We.have.included |
| 7b00 | 20 6e 65 77 20 73 65 63 74 69 6f 6e 73 20 6f 6e 0a 63 6f 6e 63 75 72 72 65 6e 63 79 20 61 6e 64 | .new.sections.on.concurrency.and |
| 7b20 | 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 6d 2c 20 61 6e 64 20 77 65 20 68 61 76 65 20 74 72 69 | .nondeterminism,.and.we.have.tri |
| 7b40 | 65 64 20 74 6f 20 69 6e 74 65 67 72 61 74 65 20 74 68 69 73 0a 74 68 65 6d 65 20 74 68 72 6f 75 | ed.to.integrate.this.theme.throu |
| 7b60 | 67 68 6f 75 74 20 74 68 65 20 62 6f 6f 6b 2e 0a 0a 20 20 20 54 68 65 20 66 69 72 73 74 20 65 64 | ghout.the.book......The.first.ed |
| 7b80 | 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 6f 6f 6b 20 63 6c 6f 73 65 6c 79 20 66 6f 6c 6c 6f 77 | ition.of.the.book.closely.follow |
| 7ba0 | 65 64 20 74 68 65 20 73 79 6c 6c 61 62 75 73 20 6f 66 20 6f 75 72 0a 4d 49 54 20 6f 6e 65 2d 73 | ed.the.syllabus.of.our.MIT.one-s |
| 7bc0 | 65 6d 65 73 74 65 72 20 73 75 62 6a 65 63 74 2e 20 20 57 69 74 68 20 61 6c 6c 20 74 68 65 20 6e | emester.subject...With.all.the.n |
| 7be0 | 65 77 20 6d 61 74 65 72 69 61 6c 20 69 6e 20 74 68 65 20 73 65 63 6f 6e 64 0a 65 64 69 74 69 6f | ew.material.in.the.second.editio |
| 7c00 | 6e 2c 20 69 74 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 63 6f | n,.it.will.not.be.possible.to.co |
| 7c20 | 76 65 72 20 65 76 65 72 79 74 68 69 6e 67 20 69 6e 20 61 20 73 69 6e 67 6c 65 0a 73 65 6d 65 73 | ver.everything.in.a.single.semes |
| 7c40 | 74 65 72 2c 20 73 6f 20 74 68 65 20 69 6e 73 74 72 75 63 74 6f 72 20 77 69 6c 6c 20 68 61 76 65 | ter,.so.the.instructor.will.have |
| 7c60 | 20 74 6f 20 70 69 63 6b 20 61 6e 64 20 63 68 6f 6f 73 65 2e 20 20 49 6e 20 6f 75 72 20 6f 77 6e | .to.pick.and.choose...In.our.own |
| 7c80 | 0a 74 65 61 63 68 69 6e 67 2c 20 77 65 20 73 6f 6d 65 74 69 6d 65 73 20 73 6b 69 70 20 74 68 65 | .teaching,.we.sometimes.skip.the |
| 7ca0 | 20 73 65 63 74 69 6f 6e 20 6f 6e 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 28 73 | .section.on.logic.programming.(s |
| 7cc0 | 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 34 2d 34 3a 3a 29 2c 20 77 65 20 68 61 76 65 20 73 74 75 | ection.*Note.4-4::),.we.have.stu |
| 7ce0 | 64 65 6e 74 73 20 75 73 65 20 74 68 65 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 73 | dents.use.the.register-machine.s |
| 7d00 | 69 6d 75 6c 61 74 6f 72 20 62 75 74 0a 77 65 20 64 6f 20 6e 6f 74 20 63 6f 76 65 72 20 69 74 73 | imulator.but.we.do.not.cover.its |
| 7d20 | 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 | .implementation.(section.*Note.5 |
| 7d40 | 2d 32 3a 3a 29 2c 20 61 6e 64 20 77 65 20 67 69 76 65 0a 6f 6e 6c 79 20 61 20 63 75 72 73 6f 72 | -2::),.and.we.give.only.a.cursor |
| 7d60 | 79 20 6f 76 65 72 76 69 65 77 20 6f 66 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 28 73 65 63 74 | y.overview.of.the.compiler.(sect |
| 7d80 | 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 3a 3a 29 2e 20 20 45 76 65 6e 0a 73 6f 2c 20 74 68 69 73 | ion.*Note.5-5::)...Even.so,.this |
| 7da0 | 20 69 73 20 73 74 69 6c 6c 20 61 6e 20 69 6e 74 65 6e 73 65 20 63 6f 75 72 73 65 2e 20 20 53 6f | .is.still.an.intense.course...So |
| 7dc0 | 6d 65 20 69 6e 73 74 72 75 63 74 6f 72 73 20 6d 61 79 20 77 69 73 68 20 74 6f 0a 63 6f 76 65 72 | me.instructors.may.wish.to.cover |
| 7de0 | 20 6f 6e 6c 79 20 74 68 65 20 66 69 72 73 74 20 74 68 72 65 65 20 6f 72 20 66 6f 75 72 20 63 68 | .only.the.first.three.or.four.ch |
| 7e00 | 61 70 74 65 72 73 2c 20 6c 65 61 76 69 6e 67 20 74 68 65 20 6f 74 68 65 72 20 6d 61 74 65 72 69 | apters,.leaving.the.other.materi |
| 7e20 | 61 6c 0a 66 6f 72 20 73 75 62 73 65 71 75 65 6e 74 20 63 6f 75 72 73 65 73 2e 0a 0a 20 20 20 54 | al.for.subsequent.courses......T |
| 7e40 | 68 65 20 57 6f 72 6c 64 2d 57 69 64 65 2d 57 65 62 20 73 69 74 65 20 60 68 74 74 70 3a 2f 2f 6d | he.World-Wide-Web.site.`http://m |
| 7e60 | 69 74 70 72 65 73 73 2e 6d 69 74 2e 65 64 75 2f 73 69 63 70 2f 27 20 70 72 6f 76 69 64 65 73 0a | itpress.mit.edu/sicp/'.provides. |
| 7e80 | 73 75 70 70 6f 72 74 20 66 6f 72 20 75 73 65 72 73 20 6f 66 20 74 68 69 73 20 62 6f 6f 6b 2e 20 | support.for.users.of.this.book.. |
| 7ea0 | 20 54 68 69 73 20 69 6e 63 6c 75 64 65 73 20 70 72 6f 67 72 61 6d 73 20 66 72 6f 6d 20 74 68 65 | .This.includes.programs.from.the |
| 7ec0 | 20 62 6f 6f 6b 2c 0a 73 61 6d 70 6c 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 61 73 73 69 67 6e | .book,.sample.programming.assign |
| 7ee0 | 6d 65 6e 74 73 2c 20 73 75 70 70 6c 65 6d 65 6e 74 61 72 79 20 6d 61 74 65 72 69 61 6c 73 2c 20 | ments,.supplementary.materials,. |
| 7f00 | 61 6e 64 0a 64 6f 77 6e 6c 6f 61 64 61 62 6c 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 | and.downloadable.implementations |
| 7f20 | 20 6f 66 20 74 68 65 20 53 63 68 65 6d 65 20 64 69 61 6c 65 63 74 20 6f 66 20 4c 69 73 70 2e 0a | .of.the.Scheme.dialect.of.Lisp.. |
| 7f40 | 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 50 72 65 66 61 | ...File:.sicp.info,..Node:.Prefa |
| 7f60 | 63 65 20 31 65 2c 20 20 4e 65 78 74 3a 20 41 63 6b 6e 6f 77 6c 65 64 67 65 6d 65 6e 74 73 2c 20 | ce.1e,..Next:.Acknowledgements,. |
| 7f80 | 20 50 72 65 76 3a 20 50 72 65 66 61 63 65 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 50 72 65 66 61 63 | .Prev:.Preface,..Up:.Top..Prefac |
| 7fa0 | 65 20 74 6f 20 74 68 65 20 46 69 72 73 74 20 45 64 69 74 69 6f 6e 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a | e.to.the.First.Edition.********* |
| 7fc0 | 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 0a 20 20 20 20 20 41 20 63 6f 6d 70 | *******************.......A.comp |
| 7fe0 | 75 74 65 72 20 69 73 20 6c 69 6b 65 20 61 20 76 69 6f 6c 69 6e 2e 20 20 59 6f 75 20 63 61 6e 20 | uter.is.like.a.violin...You.can. |
| 8000 | 69 6d 61 67 69 6e 65 20 61 20 6e 6f 76 69 63 65 20 74 72 79 69 6e 67 0a 20 20 20 20 20 66 69 72 | imagine.a.novice.trying......fir |
| 8020 | 73 74 20 61 20 70 68 6f 6e 6f 67 72 61 70 68 20 61 6e 64 20 74 68 65 6e 20 61 20 76 69 6f 6c 69 | st.a.phonograph.and.then.a.violi |
| 8040 | 6e 2e 20 20 54 68 65 20 6c 61 74 74 65 72 2c 20 68 65 20 73 61 79 73 2c 20 73 6f 75 6e 64 73 0a | n...The.latter,.he.says,.sounds. |
| 8060 | 20 20 20 20 20 74 65 72 72 69 62 6c 65 2e 20 20 54 68 61 74 20 69 73 20 74 68 65 20 61 72 67 75 | .....terrible...That.is.the.argu |
| 8080 | 6d 65 6e 74 20 77 65 20 68 61 76 65 20 68 65 61 72 64 20 66 72 6f 6d 20 6f 75 72 20 68 75 6d 61 | ment.we.have.heard.from.our.huma |
| 80a0 | 6e 69 73 74 73 0a 20 20 20 20 20 61 6e 64 20 6d 6f 73 74 20 6f 66 20 6f 75 72 20 63 6f 6d 70 75 | nists......and.most.of.our.compu |
| 80c0 | 74 65 72 20 73 63 69 65 6e 74 69 73 74 73 2e 20 20 43 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 | ter.scientists...Computer.progra |
| 80e0 | 6d 73 20 61 72 65 20 67 6f 6f 64 2c 0a 20 20 20 20 20 74 68 65 79 20 73 61 79 2c 20 66 6f 72 20 | ms.are.good,......they.say,.for. |
| 8100 | 70 61 72 74 69 63 75 6c 61 72 20 70 75 72 70 6f 73 65 73 2c 20 62 75 74 20 74 68 65 79 20 61 72 | particular.purposes,.but.they.ar |
| 8120 | 65 6e 27 74 20 66 6c 65 78 69 62 6c 65 2e 0a 20 20 20 20 20 4e 65 69 74 68 65 72 20 69 73 20 61 | en't.flexible.......Neither.is.a |
| 8140 | 20 76 69 6f 6c 69 6e 2c 20 6f 72 20 61 20 74 79 70 65 77 72 69 74 65 72 2c 20 75 6e 74 69 6c 20 | .violin,.or.a.typewriter,.until. |
| 8160 | 79 6f 75 20 6c 65 61 72 6e 20 68 6f 77 20 74 6f 20 75 73 65 0a 20 20 20 20 20 69 74 2e 0a 0a 20 | you.learn.how.to.use......it.... |
| 8180 | 20 20 20 20 2d 2d 4d 61 72 76 69 6e 20 4d 69 6e 73 6b 79 2c 20 22 57 68 79 20 50 72 6f 67 72 61 | ....--Marvin.Minsky,."Why.Progra |
| 81a0 | 6d 6d 69 6e 67 20 49 73 20 61 20 47 6f 6f 64 20 4d 65 64 69 75 6d 20 66 6f 72 20 45 78 70 72 65 | mming.Is.a.Good.Medium.for.Expre |
| 81c0 | 73 73 69 6e 67 0a 20 20 20 20 20 50 6f 6f 72 6c 79 2d 55 6e 64 65 72 73 74 6f 6f 64 20 61 6e 64 | ssing......Poorly-Understood.and |
| 81e0 | 20 53 6c 6f 70 70 69 6c 79 2d 46 6f 72 6d 75 6c 61 74 65 64 20 49 64 65 61 73 22 0a 0a 20 20 20 | .Sloppily-Formulated.Ideas"..... |
| 8200 | 22 54 68 65 20 53 74 72 75 63 74 75 72 65 20 61 6e 64 20 49 6e 74 65 72 70 72 65 74 61 74 69 6f | "The.Structure.and.Interpretatio |
| 8220 | 6e 20 6f 66 20 43 6f 6d 70 75 74 65 72 20 50 72 6f 67 72 61 6d 73 22 20 69 73 20 74 68 65 0a 65 | n.of.Computer.Programs".is.the.e |
| 8240 | 6e 74 72 79 2d 6c 65 76 65 6c 20 73 75 62 6a 65 63 74 20 69 6e 20 63 6f 6d 70 75 74 65 72 20 73 | ntry-level.subject.in.computer.s |
| 8260 | 63 69 65 6e 63 65 20 61 74 20 74 68 65 20 4d 61 73 73 61 63 68 75 73 65 74 74 73 20 49 6e 73 74 | cience.at.the.Massachusetts.Inst |
| 8280 | 69 74 75 74 65 0a 6f 66 20 54 65 63 68 6e 6f 6c 6f 67 79 2e 20 20 49 74 20 69 73 20 72 65 71 75 | itute.of.Technology...It.is.requ |
| 82a0 | 69 72 65 64 20 6f 66 20 61 6c 6c 20 73 74 75 64 65 6e 74 73 20 61 74 20 4d 49 54 20 77 68 6f 20 | ired.of.all.students.at.MIT.who. |
| 82c0 | 6d 61 6a 6f 72 20 69 6e 0a 65 6c 65 63 74 72 69 63 61 6c 20 65 6e 67 69 6e 65 65 72 69 6e 67 20 | major.in.electrical.engineering. |
| 82e0 | 6f 72 20 69 6e 20 63 6f 6d 70 75 74 65 72 20 73 63 69 65 6e 63 65 2c 20 61 73 20 6f 6e 65 2d 66 | or.in.computer.science,.as.one-f |
| 8300 | 6f 75 72 74 68 20 6f 66 20 74 68 65 0a 22 63 6f 6d 6d 6f 6e 20 63 6f 72 65 20 63 75 72 72 69 63 | ourth.of.the."common.core.curric |
| 8320 | 75 6c 75 6d 2c 22 20 77 68 69 63 68 20 61 6c 73 6f 20 69 6e 63 6c 75 64 65 73 20 74 77 6f 20 73 | ulum,".which.also.includes.two.s |
| 8340 | 75 62 6a 65 63 74 73 20 6f 6e 20 63 69 72 63 75 69 74 73 0a 61 6e 64 20 6c 69 6e 65 61 72 20 73 | ubjects.on.circuits.and.linear.s |
| 8360 | 79 73 74 65 6d 73 20 61 6e 64 20 61 20 73 75 62 6a 65 63 74 20 6f 6e 20 74 68 65 20 64 65 73 69 | ystems.and.a.subject.on.the.desi |
| 8380 | 67 6e 20 6f 66 20 64 69 67 69 74 61 6c 20 73 79 73 74 65 6d 73 2e 20 20 57 65 0a 68 61 76 65 20 | gn.of.digital.systems...We.have. |
| 83a0 | 62 65 65 6e 20 69 6e 76 6f 6c 76 65 64 20 69 6e 20 74 68 65 20 64 65 76 65 6c 6f 70 6d 65 6e 74 | been.involved.in.the.development |
| 83c0 | 20 6f 66 20 74 68 69 73 20 73 75 62 6a 65 63 74 20 73 69 6e 63 65 20 31 39 37 38 2c 20 61 6e 64 | .of.this.subject.since.1978,.and |
| 83e0 | 0a 77 65 20 68 61 76 65 20 74 61 75 67 68 74 20 74 68 69 73 20 6d 61 74 65 72 69 61 6c 20 69 6e | .we.have.taught.this.material.in |
| 8400 | 20 69 74 73 20 70 72 65 73 65 6e 74 20 66 6f 72 6d 20 73 69 6e 63 65 20 74 68 65 20 66 61 6c 6c | .its.present.form.since.the.fall |
| 8420 | 20 6f 66 20 31 39 38 30 0a 74 6f 20 62 65 74 77 65 65 6e 20 36 30 30 20 61 6e 64 20 37 30 30 20 | .of.1980.to.between.600.and.700. |
| 8440 | 73 74 75 64 65 6e 74 73 20 65 61 63 68 20 79 65 61 72 2e 20 20 4d 6f 73 74 20 6f 66 20 74 68 65 | students.each.year...Most.of.the |
| 8460 | 73 65 20 73 74 75 64 65 6e 74 73 20 68 61 76 65 0a 68 61 64 20 6c 69 74 74 6c 65 20 6f 72 20 6e | se.students.have.had.little.or.n |
| 8480 | 6f 20 70 72 69 6f 72 20 66 6f 72 6d 61 6c 20 74 72 61 69 6e 69 6e 67 20 69 6e 20 63 6f 6d 70 75 | o.prior.formal.training.in.compu |
| 84a0 | 74 61 74 69 6f 6e 2c 20 61 6c 74 68 6f 75 67 68 20 6d 61 6e 79 0a 68 61 76 65 20 70 6c 61 79 65 | tation,.although.many.have.playe |
| 84c0 | 64 20 77 69 74 68 20 63 6f 6d 70 75 74 65 72 73 20 61 20 62 69 74 20 61 6e 64 20 61 20 66 65 77 | d.with.computers.a.bit.and.a.few |
| 84e0 | 20 68 61 76 65 20 68 61 64 20 65 78 74 65 6e 73 69 76 65 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 | .have.had.extensive.programming. |
| 8500 | 6f 72 20 68 61 72 64 77 61 72 65 2d 64 65 73 69 67 6e 20 65 78 70 65 72 69 65 6e 63 65 2e 0a 0a | or.hardware-design.experience... |
| 8520 | 20 20 20 4f 75 72 20 64 65 73 69 67 6e 20 6f 66 20 74 68 69 73 20 69 6e 74 72 6f 64 75 63 74 6f | ...Our.design.of.this.introducto |
| 8540 | 72 79 20 63 6f 6d 70 75 74 65 72 2d 73 63 69 65 6e 63 65 20 73 75 62 6a 65 63 74 20 72 65 66 6c | ry.computer-science.subject.refl |
| 8560 | 65 63 74 73 0a 74 77 6f 20 6d 61 6a 6f 72 20 63 6f 6e 63 65 72 6e 73 2e 20 20 46 69 72 73 74 2c | ects.two.major.concerns...First, |
| 8580 | 20 77 65 20 77 61 6e 74 20 74 6f 20 65 73 74 61 62 6c 69 73 68 20 74 68 65 20 69 64 65 61 20 74 | .we.want.to.establish.the.idea.t |
| 85a0 | 68 61 74 20 61 0a 63 6f 6d 70 75 74 65 72 20 6c 61 6e 67 75 61 67 65 20 69 73 20 6e 6f 74 20 6a | hat.a.computer.language.is.not.j |
| 85c0 | 75 73 74 20 61 20 77 61 79 20 6f 66 20 67 65 74 74 69 6e 67 20 61 20 63 6f 6d 70 75 74 65 72 20 | ust.a.way.of.getting.a.computer. |
| 85e0 | 74 6f 20 70 65 72 66 6f 72 6d 0a 6f 70 65 72 61 74 69 6f 6e 73 20 62 75 74 20 72 61 74 68 65 72 | to.perform.operations.but.rather |
| 8600 | 20 74 68 61 74 20 69 74 20 69 73 20 61 20 6e 6f 76 65 6c 20 66 6f 72 6d 61 6c 20 6d 65 64 69 75 | .that.it.is.a.novel.formal.mediu |
| 8620 | 6d 20 66 6f 72 20 65 78 70 72 65 73 73 69 6e 67 0a 69 64 65 61 73 20 61 62 6f 75 74 20 6d 65 74 | m.for.expressing.ideas.about.met |
| 8640 | 68 6f 64 6f 6c 6f 67 79 2e 20 20 54 68 75 73 2c 20 70 72 6f 67 72 61 6d 73 20 6d 75 73 74 20 62 | hodology...Thus,.programs.must.b |
| 8660 | 65 20 77 72 69 74 74 65 6e 20 66 6f 72 20 70 65 6f 70 6c 65 20 74 6f 0a 72 65 61 64 2c 20 61 6e | e.written.for.people.to.read,.an |
| 8680 | 64 20 6f 6e 6c 79 20 69 6e 63 69 64 65 6e 74 61 6c 6c 79 20 66 6f 72 20 6d 61 63 68 69 6e 65 73 | d.only.incidentally.for.machines |
| 86a0 | 20 74 6f 20 65 78 65 63 75 74 65 2e 20 20 53 65 63 6f 6e 64 2c 20 77 65 0a 62 65 6c 69 65 76 65 | .to.execute...Second,.we.believe |
| 86c0 | 20 74 68 61 74 20 74 68 65 20 65 73 73 65 6e 74 69 61 6c 20 6d 61 74 65 72 69 61 6c 20 74 6f 20 | .that.the.essential.material.to. |
| 86e0 | 62 65 20 61 64 64 72 65 73 73 65 64 20 62 79 20 61 20 73 75 62 6a 65 63 74 20 61 74 0a 74 68 69 | be.addressed.by.a.subject.at.thi |
| 8700 | 73 20 6c 65 76 65 6c 20 69 73 20 6e 6f 74 20 74 68 65 20 73 79 6e 74 61 78 20 6f 66 20 70 61 72 | s.level.is.not.the.syntax.of.par |
| 8720 | 74 69 63 75 6c 61 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2d 6c 61 6e 67 75 61 67 65 0a 63 6f 6e | ticular.programming-language.con |
| 8740 | 73 74 72 75 63 74 73 2c 20 6e 6f 72 20 63 6c 65 76 65 72 20 61 6c 67 6f 72 69 74 68 6d 73 20 66 | structs,.nor.clever.algorithms.f |
| 8760 | 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 70 61 72 74 69 63 75 6c 61 72 20 66 75 6e 63 74 69 6f 6e | or.computing.particular.function |
| 8780 | 73 0a 65 66 66 69 63 69 65 6e 74 6c 79 2c 20 6e 6f 72 20 65 76 65 6e 20 74 68 65 20 6d 61 74 68 | s.efficiently,.nor.even.the.math |
| 87a0 | 65 6d 61 74 69 63 61 6c 20 61 6e 61 6c 79 73 69 73 20 6f 66 20 61 6c 67 6f 72 69 74 68 6d 73 20 | ematical.analysis.of.algorithms. |
| 87c0 | 61 6e 64 20 74 68 65 0a 66 6f 75 6e 64 61 74 69 6f 6e 73 20 6f 66 20 63 6f 6d 70 75 74 69 6e 67 | and.the.foundations.of.computing |
| 87e0 | 2c 20 62 75 74 20 72 61 74 68 65 72 20 74 68 65 20 74 65 63 68 6e 69 71 75 65 73 20 75 73 65 64 | ,.but.rather.the.techniques.used |
| 8800 | 20 74 6f 20 63 6f 6e 74 72 6f 6c 20 74 68 65 0a 69 6e 74 65 6c 6c 65 63 74 75 61 6c 20 63 6f 6d | .to.control.the.intellectual.com |
| 8820 | 70 6c 65 78 69 74 79 20 6f 66 20 6c 61 72 67 65 20 73 6f 66 74 77 61 72 65 20 73 79 73 74 65 6d | plexity.of.large.software.system |
| 8840 | 73 2e 0a 0a 20 20 20 4f 75 72 20 67 6f 61 6c 20 69 73 20 74 68 61 74 20 73 74 75 64 65 6e 74 73 | s......Our.goal.is.that.students |
| 8860 | 20 77 68 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 69 73 20 73 75 62 6a 65 63 74 20 73 68 6f 75 6c | .who.complete.this.subject.shoul |
| 8880 | 64 20 68 61 76 65 20 61 0a 67 6f 6f 64 20 66 65 65 6c 20 66 6f 72 20 74 68 65 20 65 6c 65 6d 65 | d.have.a.good.feel.for.the.eleme |
| 88a0 | 6e 74 73 20 6f 66 20 73 74 79 6c 65 20 61 6e 64 20 74 68 65 20 61 65 73 74 68 65 74 69 63 73 20 | nts.of.style.and.the.aesthetics. |
| 88c0 | 6f 66 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2e 0a 54 68 65 79 20 73 68 6f 75 6c 64 20 68 61 76 65 | of.programming..They.should.have |
| 88e0 | 20 63 6f 6d 6d 61 6e 64 20 6f 66 20 74 68 65 20 6d 61 6a 6f 72 20 74 65 63 68 6e 69 71 75 65 73 | .command.of.the.major.techniques |
| 8900 | 20 66 6f 72 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 0a 63 6f 6d 70 6c 65 78 69 74 79 20 69 6e 20 61 | .for.controlling.complexity.in.a |
| 8920 | 20 6c 61 72 67 65 20 73 79 73 74 65 6d 2e 20 54 68 65 79 20 73 68 6f 75 6c 64 20 62 65 20 63 61 | .large.system..They.should.be.ca |
| 8940 | 70 61 62 6c 65 20 6f 66 20 72 65 61 64 69 6e 67 20 61 0a 35 30 2d 70 61 67 65 2d 6c 6f 6e 67 20 | pable.of.reading.a.50-page-long. |
| 8960 | 70 72 6f 67 72 61 6d 2c 20 69 66 20 69 74 20 69 73 20 77 72 69 74 74 65 6e 20 69 6e 20 61 6e 20 | program,.if.it.is.written.in.an. |
| 8980 | 65 78 65 6d 70 6c 61 72 79 20 73 74 79 6c 65 2e 20 54 68 65 79 0a 73 68 6f 75 6c 64 20 6b 6e 6f | exemplary.style..They.should.kno |
| 89a0 | 77 20 77 68 61 74 20 6e 6f 74 20 74 6f 20 72 65 61 64 2c 20 61 6e 64 20 77 68 61 74 20 74 68 65 | w.what.not.to.read,.and.what.the |
| 89c0 | 79 20 6e 65 65 64 20 6e 6f 74 20 75 6e 64 65 72 73 74 61 6e 64 20 61 74 20 61 6e 79 0a 6d 6f 6d | y.need.not.understand.at.any.mom |
| 89e0 | 65 6e 74 2e 20 20 54 68 65 79 20 73 68 6f 75 6c 64 20 66 65 65 6c 20 73 65 63 75 72 65 20 61 62 | ent...They.should.feel.secure.ab |
| 8a00 | 6f 75 74 20 6d 6f 64 69 66 79 69 6e 67 20 61 20 70 72 6f 67 72 61 6d 2c 20 72 65 74 61 69 6e 69 | out.modifying.a.program,.retaini |
| 8a20 | 6e 67 0a 74 68 65 20 73 70 69 72 69 74 20 61 6e 64 20 73 74 79 6c 65 20 6f 66 20 74 68 65 20 6f | ng.the.spirit.and.style.of.the.o |
| 8a40 | 72 69 67 69 6e 61 6c 20 61 75 74 68 6f 72 2e 0a 0a 20 20 20 54 68 65 73 65 20 73 6b 69 6c 6c 73 | riginal.author......These.skills |
| 8a60 | 20 61 72 65 20 62 79 20 6e 6f 20 6d 65 61 6e 73 20 75 6e 69 71 75 65 20 74 6f 20 63 6f 6d 70 75 | .are.by.no.means.unique.to.compu |
| 8a80 | 74 65 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2e 20 20 54 68 65 0a 74 65 63 68 6e 69 71 75 65 73 | ter.programming...The.techniques |
| 8aa0 | 20 77 65 20 74 65 61 63 68 20 61 6e 64 20 64 72 61 77 20 75 70 6f 6e 20 61 72 65 20 63 6f 6d 6d | .we.teach.and.draw.upon.are.comm |
| 8ac0 | 6f 6e 20 74 6f 20 61 6c 6c 20 6f 66 20 65 6e 67 69 6e 65 65 72 69 6e 67 0a 64 65 73 69 67 6e 2e | on.to.all.of.engineering.design. |
| 8ae0 | 20 20 57 65 20 63 6f 6e 74 72 6f 6c 20 63 6f 6d 70 6c 65 78 69 74 79 20 62 79 20 62 75 69 6c 64 | ..We.control.complexity.by.build |
| 8b00 | 69 6e 67 20 61 62 73 74 72 61 63 74 69 6f 6e 73 20 74 68 61 74 20 68 69 64 65 0a 64 65 74 61 69 | ing.abstractions.that.hide.detai |
| 8b20 | 6c 73 20 77 68 65 6e 20 61 70 70 72 6f 70 72 69 61 74 65 2e 20 20 57 65 20 63 6f 6e 74 72 6f 6c | ls.when.appropriate...We.control |
| 8b40 | 20 63 6f 6d 70 6c 65 78 69 74 79 20 62 79 20 65 73 74 61 62 6c 69 73 68 69 6e 67 0a 63 6f 6e 76 | .complexity.by.establishing.conv |
| 8b60 | 65 6e 74 69 6f 6e 61 6c 20 69 6e 74 65 72 66 61 63 65 73 20 74 68 61 74 20 65 6e 61 62 6c 65 20 | entional.interfaces.that.enable. |
| 8b80 | 75 73 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 73 79 73 74 65 6d 73 20 62 79 0a 63 6f 6d 62 69 | us.to.construct.systems.by.combi |
| 8ba0 | 6e 69 6e 67 20 73 74 61 6e 64 61 72 64 2c 20 77 65 6c 6c 2d 75 6e 64 65 72 73 74 6f 6f 64 20 70 | ning.standard,.well-understood.p |
| 8bc0 | 69 65 63 65 73 20 69 6e 20 61 20 22 6d 69 78 20 61 6e 64 20 6d 61 74 63 68 22 20 77 61 79 2e 0a | ieces.in.a."mix.and.match".way.. |
| 8be0 | 57 65 20 63 6f 6e 74 72 6f 6c 20 63 6f 6d 70 6c 65 78 69 74 79 20 62 79 20 65 73 74 61 62 6c 69 | We.control.complexity.by.establi |
| 8c00 | 73 68 69 6e 67 20 6e 65 77 20 6c 61 6e 67 75 61 67 65 73 20 66 6f 72 20 64 65 73 63 72 69 62 69 | shing.new.languages.for.describi |
| 8c20 | 6e 67 20 61 0a 64 65 73 69 67 6e 2c 20 65 61 63 68 20 6f 66 20 77 68 69 63 68 20 65 6d 70 68 61 | ng.a.design,.each.of.which.empha |
| 8c40 | 73 69 7a 65 73 20 70 61 72 74 69 63 75 6c 61 72 20 61 73 70 65 63 74 73 20 6f 66 20 74 68 65 20 | sizes.particular.aspects.of.the. |
| 8c60 | 64 65 73 69 67 6e 20 61 6e 64 0a 64 65 65 6d 70 68 61 73 69 7a 65 73 20 6f 74 68 65 72 73 2e 0a | design.and.deemphasizes.others.. |
| 8c80 | 0a 20 20 20 55 6e 64 65 72 6c 79 69 6e 67 20 6f 75 72 20 61 70 70 72 6f 61 63 68 20 74 6f 20 74 | ....Underlying.our.approach.to.t |
| 8ca0 | 68 69 73 20 73 75 62 6a 65 63 74 20 69 73 20 6f 75 72 20 63 6f 6e 76 69 63 74 69 6f 6e 20 74 68 | his.subject.is.our.conviction.th |
| 8cc0 | 61 74 0a 22 63 6f 6d 70 75 74 65 72 20 73 63 69 65 6e 63 65 22 20 69 73 20 6e 6f 74 20 61 20 73 | at."computer.science".is.not.a.s |
| 8ce0 | 63 69 65 6e 63 65 20 61 6e 64 20 74 68 61 74 20 69 74 73 20 73 69 67 6e 69 66 69 63 61 6e 63 65 | cience.and.that.its.significance |
| 8d00 | 20 68 61 73 0a 6c 69 74 74 6c 65 20 74 6f 20 64 6f 20 77 69 74 68 20 63 6f 6d 70 75 74 65 72 73 | .has.little.to.do.with.computers |
| 8d20 | 2e 20 20 54 68 65 20 63 6f 6d 70 75 74 65 72 20 72 65 76 6f 6c 75 74 69 6f 6e 20 69 73 20 61 20 | ...The.computer.revolution.is.a. |
| 8d40 | 72 65 76 6f 6c 75 74 69 6f 6e 0a 69 6e 20 74 68 65 20 77 61 79 20 77 65 20 74 68 69 6e 6b 20 61 | revolution.in.the.way.we.think.a |
| 8d60 | 6e 64 20 69 6e 20 74 68 65 20 77 61 79 20 77 65 20 65 78 70 72 65 73 73 20 77 68 61 74 20 77 65 | nd.in.the.way.we.express.what.we |
| 8d80 | 20 74 68 69 6e 6b 2e 20 20 54 68 65 0a 65 73 73 65 6e 63 65 20 6f 66 20 74 68 69 73 20 63 68 61 | .think...The.essence.of.this.cha |
| 8da0 | 6e 67 65 20 69 73 20 74 68 65 20 65 6d 65 72 67 65 6e 63 65 20 6f 66 20 77 68 61 74 20 6d 69 67 | nge.is.the.emergence.of.what.mig |
| 8dc0 | 68 74 20 62 65 73 74 20 62 65 20 63 61 6c 6c 65 64 20 22 70 72 6f 63 65 64 75 72 61 6c 0a 65 70 | ht.best.be.called."procedural.ep |
| 8de0 | 69 73 74 65 6d 6f 6c 6f 67 79 22 2d 2d 74 68 65 20 73 74 75 64 79 20 6f 66 20 74 68 65 20 73 74 | istemology"--the.study.of.the.st |
| 8e00 | 72 75 63 74 75 72 65 20 6f 66 20 6b 6e 6f 77 6c 65 64 67 65 20 66 72 6f 6d 20 61 6e 0a 69 6d 70 | ructure.of.knowledge.from.an.imp |
| 8e20 | 65 72 61 74 69 76 65 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 2c 20 61 73 20 6f 70 70 6f 73 65 | erative.point.of.view,.as.oppose |
| 8e40 | 64 20 74 6f 20 74 68 65 20 6d 6f 72 65 20 64 65 63 6c 61 72 61 74 69 76 65 20 70 6f 69 6e 74 20 | d.to.the.more.declarative.point. |
| 8e60 | 6f 66 0a 76 69 65 77 20 74 61 6b 65 6e 20 62 79 20 63 6c 61 73 73 69 63 61 6c 20 6d 61 74 68 65 | of.view.taken.by.classical.mathe |
| 8e80 | 6d 61 74 69 63 61 6c 20 73 75 62 6a 65 63 74 73 2e 20 20 4d 61 74 68 65 6d 61 74 69 63 73 20 70 | matical.subjects...Mathematics.p |
| 8ea0 | 72 6f 76 69 64 65 73 20 61 0a 66 72 61 6d 65 77 6f 72 6b 20 66 6f 72 20 64 65 61 6c 69 6e 67 20 | rovides.a.framework.for.dealing. |
| 8ec0 | 70 72 65 63 69 73 65 6c 79 20 77 69 74 68 20 6e 6f 74 69 6f 6e 73 20 6f 66 20 22 77 68 61 74 20 | precisely.with.notions.of."what. |
| 8ee0 | 69 73 2e 22 20 20 43 6f 6d 70 75 74 61 74 69 6f 6e 0a 70 72 6f 76 69 64 65 73 20 61 20 66 72 61 | is."..Computation.provides.a.fra |
| 8f00 | 6d 65 77 6f 72 6b 20 66 6f 72 20 64 65 61 6c 69 6e 67 20 70 72 65 63 69 73 65 6c 79 20 77 69 74 | mework.for.dealing.precisely.wit |
| 8f20 | 68 20 6e 6f 74 69 6f 6e 73 20 6f 66 20 22 68 6f 77 20 74 6f 2e 22 0a 0a 20 20 20 49 6e 20 74 65 | h.notions.of."how.to.".....In.te |
| 8f40 | 61 63 68 69 6e 67 20 6f 75 72 20 6d 61 74 65 72 69 61 6c 20 77 65 20 75 73 65 20 61 20 64 69 61 | aching.our.material.we.use.a.dia |
| 8f60 | 6c 65 63 74 20 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 0a 6c 61 6e 67 75 61 67 65 | lect.of.the.programming.language |
| 8f80 | 20 4c 69 73 70 2e 20 20 57 65 20 6e 65 76 65 72 20 66 6f 72 6d 61 6c 6c 79 20 74 65 61 63 68 20 | .Lisp...We.never.formally.teach. |
| 8fa0 | 74 68 65 20 6c 61 6e 67 75 61 67 65 2c 20 62 65 63 61 75 73 65 20 77 65 20 64 6f 6e 27 74 0a 68 | the.language,.because.we.don't.h |
| 8fc0 | 61 76 65 20 74 6f 2e 20 20 57 65 20 6a 75 73 74 20 75 73 65 20 69 74 2c 20 61 6e 64 20 73 74 75 | ave.to...We.just.use.it,.and.stu |
| 8fe0 | 64 65 6e 74 73 20 70 69 63 6b 20 69 74 20 75 70 20 69 6e 20 61 20 66 65 77 20 64 61 79 73 2e 20 | dents.pick.it.up.in.a.few.days.. |
| 9000 | 20 54 68 69 73 0a 69 73 20 6f 6e 65 20 67 72 65 61 74 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 | .This.is.one.great.advantage.of. |
| 9020 | 4c 69 73 70 2d 6c 69 6b 65 20 6c 61 6e 67 75 61 67 65 73 3a 20 54 68 65 79 20 68 61 76 65 20 76 | Lisp-like.languages:.They.have.v |
| 9040 | 65 72 79 20 66 65 77 20 77 61 79 73 0a 6f 66 20 66 6f 72 6d 69 6e 67 20 63 6f 6d 70 6f 75 6e 64 | ery.few.ways.of.forming.compound |
| 9060 | 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 61 6e 64 20 61 6c 6d 6f 73 74 20 6e 6f 20 73 79 6e 74 | .expressions,.and.almost.no.synt |
| 9080 | 61 63 74 69 63 20 73 74 72 75 63 74 75 72 65 2e 0a 41 6c 6c 20 6f 66 20 74 68 65 20 66 6f 72 6d | actic.structure..All.of.the.form |
| 90a0 | 61 6c 20 70 72 6f 70 65 72 74 69 65 73 20 63 61 6e 20 62 65 20 63 6f 76 65 72 65 64 20 69 6e 20 | al.properties.can.be.covered.in. |
| 90c0 | 61 6e 20 68 6f 75 72 2c 20 6c 69 6b 65 20 74 68 65 20 72 75 6c 65 73 0a 6f 66 20 63 68 65 73 73 | an.hour,.like.the.rules.of.chess |
| 90e0 | 2e 20 20 41 66 74 65 72 20 61 20 73 68 6f 72 74 20 74 69 6d 65 20 77 65 20 66 6f 72 67 65 74 20 | ...After.a.short.time.we.forget. |
| 9100 | 61 62 6f 75 74 20 73 79 6e 74 61 63 74 69 63 20 64 65 74 61 69 6c 73 20 6f 66 20 74 68 65 0a 6c | about.syntactic.details.of.the.l |
| 9120 | 61 6e 67 75 61 67 65 20 28 62 65 63 61 75 73 65 20 74 68 65 72 65 20 61 72 65 20 6e 6f 6e 65 29 | anguage.(because.there.are.none) |
| 9140 | 20 61 6e 64 20 67 65 74 20 6f 6e 20 77 69 74 68 20 74 68 65 20 72 65 61 6c 0a 69 73 73 75 65 73 | .and.get.on.with.the.real.issues |
| 9160 | 2d 2d 66 69 67 75 72 69 6e 67 20 6f 75 74 20 77 68 61 74 20 77 65 20 77 61 6e 74 20 74 6f 20 63 | --figuring.out.what.we.want.to.c |
| 9180 | 6f 6d 70 75 74 65 2c 20 68 6f 77 20 77 65 20 77 69 6c 6c 20 64 65 63 6f 6d 70 6f 73 65 0a 70 72 | ompute,.how.we.will.decompose.pr |
| 91a0 | 6f 62 6c 65 6d 73 20 69 6e 74 6f 20 6d 61 6e 61 67 65 61 62 6c 65 20 70 61 72 74 73 2c 20 61 6e | oblems.into.manageable.parts,.an |
| 91c0 | 64 20 68 6f 77 20 77 65 20 77 69 6c 6c 20 77 6f 72 6b 20 6f 6e 20 74 68 65 20 70 61 72 74 73 2e | d.how.we.will.work.on.the.parts. |
| 91e0 | 0a 41 6e 6f 74 68 65 72 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 4c 69 73 70 20 69 73 20 74 68 | .Another.advantage.of.Lisp.is.th |
| 9200 | 61 74 20 69 74 20 73 75 70 70 6f 72 74 73 20 28 62 75 74 20 64 6f 65 73 20 6e 6f 74 20 65 6e 66 | at.it.supports.(but.does.not.enf |
| 9220 | 6f 72 63 65 29 0a 6d 6f 72 65 20 6f 66 20 74 68 65 20 6c 61 72 67 65 2d 73 63 61 6c 65 20 73 74 | orce).more.of.the.large-scale.st |
| 9240 | 72 61 74 65 67 69 65 73 20 66 6f 72 20 6d 6f 64 75 6c 61 72 20 64 65 63 6f 6d 70 6f 73 69 74 69 | rategies.for.modular.decompositi |
| 9260 | 6f 6e 20 6f 66 0a 70 72 6f 67 72 61 6d 73 20 74 68 61 6e 20 61 6e 79 20 6f 74 68 65 72 20 6c 61 | on.of.programs.than.any.other.la |
| 9280 | 6e 67 75 61 67 65 20 77 65 20 6b 6e 6f 77 2e 20 20 57 65 20 63 61 6e 20 6d 61 6b 65 20 70 72 6f | nguage.we.know...We.can.make.pro |
| 92a0 | 63 65 64 75 72 61 6c 20 61 6e 64 0a 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 73 2c 20 77 | cedural.and.data.abstractions,.w |
| 92c0 | 65 20 63 61 6e 20 75 73 65 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 66 75 6e 63 74 69 6f 6e 73 | e.can.use.higher-order.functions |
| 92e0 | 20 74 6f 20 63 61 70 74 75 72 65 20 63 6f 6d 6d 6f 6e 0a 70 61 74 74 65 72 6e 73 20 6f 66 20 75 | .to.capture.common.patterns.of.u |
| 9300 | 73 61 67 65 2c 20 77 65 20 63 61 6e 20 6d 6f 64 65 6c 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 75 | sage,.we.can.model.local.state.u |
| 9320 | 73 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e 74 20 61 6e 64 20 64 61 74 61 0a 6d 75 74 61 74 69 6f | sing.assignment.and.data.mutatio |
| 9340 | 6e 2c 20 77 65 20 63 61 6e 20 6c 69 6e 6b 20 70 61 72 74 73 20 6f 66 20 61 20 70 72 6f 67 72 61 | n,.we.can.link.parts.of.a.progra |
| 9360 | 6d 20 77 69 74 68 20 73 74 72 65 61 6d 73 20 61 6e 64 20 64 65 6c 61 79 65 64 0a 65 76 61 6c 75 | m.with.streams.and.delayed.evalu |
| 9380 | 61 74 69 6f 6e 2c 20 61 6e 64 20 77 65 20 63 61 6e 20 65 61 73 69 6c 79 20 69 6d 70 6c 65 6d 65 | ation,.and.we.can.easily.impleme |
| 93a0 | 6e 74 20 65 6d 62 65 64 64 65 64 20 6c 61 6e 67 75 61 67 65 73 2e 20 20 41 6c 6c 20 6f 66 0a 74 | nt.embedded.languages...All.of.t |
| 93c0 | 68 69 73 20 69 73 20 65 6d 62 65 64 64 65 64 20 69 6e 20 61 6e 20 69 6e 74 65 72 61 63 74 69 76 | his.is.embedded.in.an.interactiv |
| 93e0 | 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 77 69 74 68 20 65 78 63 65 6c 6c 65 6e 74 20 73 75 70 | e.environment.with.excellent.sup |
| 9400 | 70 6f 72 74 0a 66 6f 72 20 69 6e 63 72 65 6d 65 6e 74 61 6c 20 70 72 6f 67 72 61 6d 20 64 65 73 | port.for.incremental.program.des |
| 9420 | 69 67 6e 2c 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 2c 20 74 65 73 74 69 6e 67 2c 20 61 6e 64 20 | ign,.construction,.testing,.and. |
| 9440 | 64 65 62 75 67 67 69 6e 67 2e 0a 57 65 20 74 68 61 6e 6b 20 61 6c 6c 20 74 68 65 20 67 65 6e 65 | debugging..We.thank.all.the.gene |
| 9460 | 72 61 74 69 6f 6e 73 20 6f 66 20 4c 69 73 70 20 77 69 7a 61 72 64 73 2c 20 73 74 61 72 74 69 6e | rations.of.Lisp.wizards,.startin |
| 9480 | 67 20 77 69 74 68 20 4a 6f 68 6e 0a 4d 63 43 61 72 74 68 79 2c 20 77 68 6f 20 68 61 76 65 20 66 | g.with.John.McCarthy,.who.have.f |
| 94a0 | 61 73 68 69 6f 6e 65 64 20 61 20 66 69 6e 65 20 74 6f 6f 6c 20 6f 66 20 75 6e 70 72 65 63 65 64 | ashioned.a.fine.tool.of.unpreced |
| 94c0 | 65 6e 74 65 64 20 70 6f 77 65 72 20 61 6e 64 0a 65 6c 65 67 61 6e 63 65 2e 0a 0a 20 20 20 53 63 | ented.power.and.elegance......Sc |
| 94e0 | 68 65 6d 65 2c 20 74 68 65 20 64 69 61 6c 65 63 74 20 6f 66 20 4c 69 73 70 20 74 68 61 74 20 77 | heme,.the.dialect.of.Lisp.that.w |
| 9500 | 65 20 75 73 65 2c 20 69 73 20 61 6e 20 61 74 74 65 6d 70 74 20 74 6f 20 62 72 69 6e 67 0a 74 6f | e.use,.is.an.attempt.to.bring.to |
| 9520 | 67 65 74 68 65 72 20 74 68 65 20 70 6f 77 65 72 20 61 6e 64 20 65 6c 65 67 61 6e 63 65 20 6f 66 | gether.the.power.and.elegance.of |
| 9540 | 20 4c 69 73 70 20 61 6e 64 20 41 6c 67 6f 6c 2e 20 20 46 72 6f 6d 20 4c 69 73 70 20 77 65 20 74 | .Lisp.and.Algol...From.Lisp.we.t |
| 9560 | 61 6b 65 0a 74 68 65 20 6d 65 74 61 6c 69 6e 67 75 69 73 74 69 63 20 70 6f 77 65 72 20 74 68 61 | ake.the.metalinguistic.power.tha |
| 9580 | 74 20 64 65 72 69 76 65 73 20 66 72 6f 6d 20 74 68 65 20 73 69 6d 70 6c 65 20 73 79 6e 74 61 78 | t.derives.from.the.simple.syntax |
| 95a0 | 2c 20 74 68 65 0a 75 6e 69 66 6f 72 6d 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 | ,.the.uniform.representation.of. |
| 95c0 | 70 72 6f 67 72 61 6d 73 20 61 73 20 64 61 74 61 20 6f 62 6a 65 63 74 73 2c 20 61 6e 64 20 74 68 | programs.as.data.objects,.and.th |
| 95e0 | 65 0a 67 61 72 62 61 67 65 2d 63 6f 6c 6c 65 63 74 65 64 20 68 65 61 70 2d 61 6c 6c 6f 63 61 74 | e.garbage-collected.heap-allocat |
| 9600 | 65 64 20 64 61 74 61 2e 20 20 46 72 6f 6d 20 41 6c 67 6f 6c 20 77 65 20 74 61 6b 65 20 6c 65 78 | ed.data...From.Algol.we.take.lex |
| 9620 | 69 63 61 6c 0a 73 63 6f 70 69 6e 67 20 61 6e 64 20 62 6c 6f 63 6b 20 73 74 72 75 63 74 75 72 65 | ical.scoping.and.block.structure |
| 9640 | 2c 20 77 68 69 63 68 20 61 72 65 20 67 69 66 74 73 20 66 72 6f 6d 20 74 68 65 20 70 69 6f 6e 65 | ,.which.are.gifts.from.the.pione |
| 9660 | 65 72 73 20 6f 66 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 2d 6c 61 6e 67 75 61 67 65 20 64 65 73 69 | ers.of.programming-language.desi |
| 9680 | 67 6e 20 77 68 6f 20 77 65 72 65 20 6f 6e 20 74 68 65 20 41 6c 67 6f 6c 20 63 6f 6d 6d 69 74 74 | gn.who.were.on.the.Algol.committ |
| 96a0 | 65 65 2e 20 20 57 65 20 77 69 73 68 0a 74 6f 20 63 69 74 65 20 4a 6f 68 6e 20 52 65 79 6e 6f 6c | ee...We.wish.to.cite.John.Reynol |
| 96c0 | 64 73 20 61 6e 64 20 50 65 74 65 72 20 4c 61 6e 64 69 6e 20 66 6f 72 20 74 68 65 69 72 20 69 6e | ds.and.Peter.Landin.for.their.in |
| 96e0 | 73 69 67 68 74 73 20 69 6e 74 6f 20 74 68 65 0a 72 65 6c 61 74 69 6f 6e 73 68 69 70 20 6f 66 20 | sights.into.the.relationship.of. |
| 9700 | 43 68 75 72 63 68 27 73 20 5b 6c 61 6d 62 64 61 5d 20 63 61 6c 63 75 6c 75 73 20 74 6f 20 74 68 | Church's.[lambda].calculus.to.th |
| 9720 | 65 20 73 74 72 75 63 74 75 72 65 20 6f 66 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 | e.structure.of.programming.langu |
| 9740 | 61 67 65 73 2e 20 20 57 65 20 61 6c 73 6f 20 72 65 63 6f 67 6e 69 7a 65 20 6f 75 72 20 64 65 62 | ages...We.also.recognize.our.deb |
| 9760 | 74 20 74 6f 20 74 68 65 0a 6d 61 74 68 65 6d 61 74 69 63 69 61 6e 73 20 77 68 6f 20 73 63 6f 75 | t.to.the.mathematicians.who.scou |
| 9780 | 74 65 64 20 6f 75 74 20 74 68 69 73 20 74 65 72 72 69 74 6f 72 79 20 64 65 63 61 64 65 73 20 62 | ted.out.this.territory.decades.b |
| 97a0 | 65 66 6f 72 65 20 63 6f 6d 70 75 74 65 72 73 0a 61 70 70 65 61 72 65 64 20 6f 6e 20 74 68 65 20 | efore.computers.appeared.on.the. |
| 97c0 | 73 63 65 6e 65 2e 20 20 54 68 65 73 65 20 70 69 6f 6e 65 65 72 73 20 69 6e 63 6c 75 64 65 20 41 | scene...These.pioneers.include.A |
| 97e0 | 6c 6f 6e 7a 6f 20 43 68 75 72 63 68 2c 20 42 61 72 6b 6c 65 79 0a 52 6f 73 73 65 72 2c 20 53 74 | lonzo.Church,.Barkley.Rosser,.St |
| 9800 | 65 70 68 65 6e 20 4b 6c 65 65 6e 65 2c 20 61 6e 64 20 48 61 73 6b 65 6c 6c 20 43 75 72 72 79 2e | ephen.Kleene,.and.Haskell.Curry. |
| 9820 | 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 41 63 6b 6e | ....File:.sicp.info,..Node:.Ackn |
| 9840 | 6f 77 6c 65 64 67 65 6d 65 6e 74 73 2c 20 20 4e 65 78 74 3a 20 43 68 61 70 74 65 72 20 31 2c 20 | owledgements,..Next:.Chapter.1,. |
| 9860 | 20 50 72 65 76 3a 20 50 72 65 66 61 63 65 20 31 65 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 41 63 6b | .Prev:.Preface.1e,..Up:.Top..Ack |
| 9880 | 6e 6f 77 6c 65 64 67 65 6d 65 6e 74 73 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 0a | nowledgements.****************.. |
| 98a0 | 57 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 20 74 68 61 6e 6b 20 74 68 65 20 6d 61 6e 79 20 | We.would.like.to.thank.the.many. |
| 98c0 | 70 65 6f 70 6c 65 20 77 68 6f 20 68 61 76 65 20 68 65 6c 70 65 64 20 75 73 20 64 65 76 65 6c 6f | people.who.have.helped.us.develo |
| 98e0 | 70 20 74 68 69 73 0a 62 6f 6f 6b 20 61 6e 64 20 74 68 69 73 20 63 75 72 72 69 63 75 6c 75 6d 2e | p.this.book.and.this.curriculum. |
| 9900 | 0a 0a 20 20 20 4f 75 72 20 73 75 62 6a 65 63 74 20 69 73 20 61 20 63 6c 65 61 72 20 69 6e 74 65 | .....Our.subject.is.a.clear.inte |
| 9920 | 6c 6c 65 63 74 75 61 6c 20 64 65 73 63 65 6e 64 61 6e 74 20 6f 66 20 22 36 2e 32 33 31 2c 22 20 | llectual.descendant.of."6.231,". |
| 9940 | 61 0a 77 6f 6e 64 65 72 66 75 6c 20 73 75 62 6a 65 63 74 20 6f 6e 20 70 72 6f 67 72 61 6d 6d 69 | a.wonderful.subject.on.programmi |
| 9960 | 6e 67 20 6c 69 6e 67 75 69 73 74 69 63 73 20 61 6e 64 20 74 68 65 20 5b 6c 61 6d 62 64 61 5d 20 | ng.linguistics.and.the.[lambda]. |
| 9980 | 63 61 6c 63 75 6c 75 73 0a 74 61 75 67 68 74 20 61 74 20 4d 49 54 20 69 6e 20 74 68 65 20 6c 61 | calculus.taught.at.MIT.in.the.la |
| 99a0 | 74 65 20 31 39 36 30 73 20 62 79 20 4a 61 63 6b 20 57 6f 7a 65 6e 63 72 61 66 74 20 61 6e 64 20 | te.1960s.by.Jack.Wozencraft.and. |
| 99c0 | 41 72 74 68 75 72 20 45 76 61 6e 73 2c 20 4a 72 2e 0a 0a 20 20 20 57 65 20 6f 77 65 20 61 20 67 | Arthur.Evans,.Jr......We.owe.a.g |
| 99e0 | 72 65 61 74 20 64 65 62 74 20 74 6f 20 52 6f 62 65 72 74 20 46 61 6e 6f 2c 20 77 68 6f 20 72 65 | reat.debt.to.Robert.Fano,.who.re |
| 9a00 | 6f 72 67 61 6e 69 7a 65 64 20 4d 49 54 27 73 0a 69 6e 74 72 6f 64 75 63 74 6f 72 79 20 63 75 72 | organized.MIT's.introductory.cur |
| 9a20 | 72 69 63 75 6c 75 6d 20 69 6e 20 65 6c 65 63 74 72 69 63 61 6c 20 65 6e 67 69 6e 65 65 72 69 6e | riculum.in.electrical.engineerin |
| 9a40 | 67 20 61 6e 64 20 63 6f 6d 70 75 74 65 72 20 73 63 69 65 6e 63 65 0a 74 6f 20 65 6d 70 68 61 73 | g.and.computer.science.to.emphas |
| 9a60 | 69 7a 65 20 74 68 65 20 70 72 69 6e 63 69 70 6c 65 73 20 6f 66 20 65 6e 67 69 6e 65 65 72 69 6e | ize.the.principles.of.engineerin |
| 9a80 | 67 20 64 65 73 69 67 6e 2e 20 20 48 65 20 6c 65 64 20 75 73 20 69 6e 0a 73 74 61 72 74 69 6e 67 | g.design...He.led.us.in.starting |
| 9aa0 | 20 6f 75 74 20 6f 6e 20 74 68 69 73 20 65 6e 74 65 72 70 72 69 73 65 20 61 6e 64 20 77 72 6f 74 | .out.on.this.enterprise.and.wrot |
| 9ac0 | 65 20 74 68 65 20 66 69 72 73 74 20 73 65 74 20 6f 66 20 73 75 62 6a 65 63 74 0a 6e 6f 74 65 73 | e.the.first.set.of.subject.notes |
| 9ae0 | 20 66 72 6f 6d 20 77 68 69 63 68 20 74 68 69 73 20 62 6f 6f 6b 20 65 76 6f 6c 76 65 64 2e 0a 0a | .from.which.this.book.evolved... |
| 9b00 | 20 20 20 4d 75 63 68 20 6f 66 20 74 68 65 20 73 74 79 6c 65 20 61 6e 64 20 61 65 73 74 68 65 74 | ...Much.of.the.style.and.aesthet |
| 9b20 | 69 63 73 20 6f 66 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 74 68 61 74 20 77 65 20 74 72 79 20 74 | ics.of.programming.that.we.try.t |
| 9b40 | 6f 20 74 65 61 63 68 0a 77 65 72 65 20 64 65 76 65 6c 6f 70 65 64 20 69 6e 20 63 6f 6e 6a 75 6e | o.teach.were.developed.in.conjun |
| 9b60 | 63 74 69 6f 6e 20 77 69 74 68 20 47 75 79 20 4c 65 77 69 73 20 53 74 65 65 6c 65 20 4a 72 2e 2c | ction.with.Guy.Lewis.Steele.Jr., |
| 9b80 | 20 77 68 6f 0a 63 6f 6c 6c 61 62 6f 72 61 74 65 64 20 77 69 74 68 20 47 65 72 61 6c 64 20 4a 61 | .who.collaborated.with.Gerald.Ja |
| 9ba0 | 79 20 53 75 73 73 6d 61 6e 20 69 6e 20 74 68 65 20 69 6e 69 74 69 61 6c 20 64 65 76 65 6c 6f 70 | y.Sussman.in.the.initial.develop |
| 9bc0 | 6d 65 6e 74 20 6f 66 20 74 68 65 0a 53 63 68 65 6d 65 20 6c 61 6e 67 75 61 67 65 2e 20 20 49 6e | ment.of.the.Scheme.language...In |
| 9be0 | 20 61 64 64 69 74 69 6f 6e 2c 20 44 61 76 69 64 20 54 75 72 6e 65 72 2c 20 50 65 74 65 72 20 48 | .addition,.David.Turner,.Peter.H |
| 9c00 | 65 6e 64 65 72 73 6f 6e 2c 20 44 61 6e 0a 46 72 69 65 64 6d 61 6e 2c 20 44 61 76 69 64 20 57 69 | enderson,.Dan.Friedman,.David.Wi |
| 9c20 | 73 65 2c 20 61 6e 64 20 57 69 6c 6c 20 43 6c 69 6e 67 65 72 20 68 61 76 65 20 74 61 75 67 68 74 | se,.and.Will.Clinger.have.taught |
| 9c40 | 20 75 73 20 6d 61 6e 79 20 6f 66 20 74 68 65 0a 74 65 63 68 6e 69 71 75 65 73 20 6f 66 20 74 68 | .us.many.of.the.techniques.of.th |
| 9c60 | 65 20 66 75 6e 63 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 63 6f 6d 6d 75 6e 69 | e.functional.programming.communi |
| 9c80 | 74 79 20 74 68 61 74 20 61 70 70 65 61 72 20 69 6e 20 74 68 69 73 0a 62 6f 6f 6b 2e 0a 0a 20 20 | ty.that.appear.in.this.book..... |
| 9ca0 | 20 4a 6f 65 6c 20 4d 6f 73 65 73 20 74 61 75 67 68 74 20 75 73 20 61 62 6f 75 74 20 73 74 72 75 | .Joel.Moses.taught.us.about.stru |
| 9cc0 | 63 74 75 72 69 6e 67 20 6c 61 72 67 65 20 73 79 73 74 65 6d 73 2e 20 20 48 69 73 0a 65 78 70 65 | cturing.large.systems...His.expe |
| 9ce0 | 72 69 65 6e 63 65 20 77 69 74 68 20 74 68 65 20 4d 61 63 73 79 6d 61 20 73 79 73 74 65 6d 20 66 | rience.with.the.Macsyma.system.f |
| 9d00 | 6f 72 20 73 79 6d 62 6f 6c 69 63 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 70 72 6f 76 69 64 65 64 | or.symbolic.computation.provided |
| 9d20 | 0a 74 68 65 20 69 6e 73 69 67 68 74 20 74 68 61 74 20 6f 6e 65 20 73 68 6f 75 6c 64 20 61 76 6f | .the.insight.that.one.should.avo |
| 9d40 | 69 64 20 63 6f 6d 70 6c 65 78 69 74 69 65 73 20 6f 66 20 63 6f 6e 74 72 6f 6c 20 61 6e 64 0a 63 | id.complexities.of.control.and.c |
| 9d60 | 6f 6e 63 65 6e 74 72 61 74 65 20 6f 6e 20 6f 72 67 61 6e 69 7a 69 6e 67 20 74 68 65 20 64 61 74 | oncentrate.on.organizing.the.dat |
| 9d80 | 61 20 74 6f 20 72 65 66 6c 65 63 74 20 74 68 65 20 72 65 61 6c 20 73 74 72 75 63 74 75 72 65 20 | a.to.reflect.the.real.structure. |
| 9da0 | 6f 66 20 74 68 65 0a 77 6f 72 6c 64 20 62 65 69 6e 67 20 6d 6f 64 65 6c 65 64 2e 0a 0a 20 20 20 | of.the.world.being.modeled...... |
| 9dc0 | 4d 61 72 76 69 6e 20 4d 69 6e 73 6b 79 20 61 6e 64 20 53 65 79 6d 6f 75 72 20 50 61 70 65 72 74 | Marvin.Minsky.and.Seymour.Papert |
| 9de0 | 20 66 6f 72 6d 65 64 20 6d 61 6e 79 20 6f 66 20 6f 75 72 20 61 74 74 69 74 75 64 65 73 20 61 62 | .formed.many.of.our.attitudes.ab |
| 9e00 | 6f 75 74 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 61 6e 64 20 69 74 73 20 70 6c 61 63 65 20 69 6e | out.programming.and.its.place.in |
| 9e20 | 20 6f 75 72 20 69 6e 74 65 6c 6c 65 63 74 75 61 6c 20 6c 69 76 65 73 2e 20 20 54 6f 20 74 68 65 | .our.intellectual.lives...To.the |
| 9e40 | 6d 20 77 65 20 6f 77 65 0a 74 68 65 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 74 68 61 74 20 | m.we.owe.the.understanding.that. |
| 9e60 | 63 6f 6d 70 75 74 61 74 69 6f 6e 20 70 72 6f 76 69 64 65 73 20 61 20 6d 65 61 6e 73 20 6f 66 20 | computation.provides.a.means.of. |
| 9e80 | 65 78 70 72 65 73 73 69 6f 6e 20 66 6f 72 0a 65 78 70 6c 6f 72 69 6e 67 20 69 64 65 61 73 20 74 | expression.for.exploring.ideas.t |
| 9ea0 | 68 61 74 20 77 6f 75 6c 64 20 6f 74 68 65 72 77 69 73 65 20 62 65 20 74 6f 6f 20 63 6f 6d 70 6c | hat.would.otherwise.be.too.compl |
| 9ec0 | 65 78 20 74 6f 20 64 65 61 6c 20 77 69 74 68 0a 70 72 65 63 69 73 65 6c 79 2e 20 20 54 68 65 79 | ex.to.deal.with.precisely...They |
| 9ee0 | 20 65 6d 70 68 61 73 69 7a 65 20 74 68 61 74 20 61 20 73 74 75 64 65 6e 74 27 73 20 61 62 69 6c | .emphasize.that.a.student's.abil |
| 9f00 | 69 74 79 20 74 6f 20 77 72 69 74 65 20 61 6e 64 20 6d 6f 64 69 66 79 0a 70 72 6f 67 72 61 6d 73 | ity.to.write.and.modify.programs |
| 9f20 | 20 70 72 6f 76 69 64 65 73 20 61 20 70 6f 77 65 72 66 75 6c 20 6d 65 64 69 75 6d 20 69 6e 20 77 | .provides.a.powerful.medium.in.w |
| 9f40 | 68 69 63 68 20 65 78 70 6c 6f 72 69 6e 67 20 62 65 63 6f 6d 65 73 20 61 0a 6e 61 74 75 72 61 6c | hich.exploring.becomes.a.natural |
| 9f60 | 20 61 63 74 69 76 69 74 79 2e 0a 0a 20 20 20 57 65 20 61 6c 73 6f 20 73 74 72 6f 6e 67 6c 79 20 | .activity......We.also.strongly. |
| 9f80 | 61 67 72 65 65 20 77 69 74 68 20 41 6c 61 6e 20 50 65 72 6c 69 73 20 74 68 61 74 20 70 72 6f 67 | agree.with.Alan.Perlis.that.prog |
| 9fa0 | 72 61 6d 6d 69 6e 67 20 69 73 20 6c 6f 74 73 20 6f 66 0a 66 75 6e 20 61 6e 64 20 77 65 20 68 61 | ramming.is.lots.of.fun.and.we.ha |
| 9fc0 | 64 20 62 65 74 74 65 72 20 62 65 20 63 61 72 65 66 75 6c 20 74 6f 20 73 75 70 70 6f 72 74 20 74 | d.better.be.careful.to.support.t |
| 9fe0 | 68 65 20 6a 6f 79 20 6f 66 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2e 0a 50 61 72 74 20 6f 66 20 74 | he.joy.of.programming..Part.of.t |
| a000 | 68 69 73 20 6a 6f 79 20 64 65 72 69 76 65 73 20 66 72 6f 6d 20 6f 62 73 65 72 76 69 6e 67 20 67 | his.joy.derives.from.observing.g |
| a020 | 72 65 61 74 20 6d 61 73 74 65 72 73 20 61 74 20 77 6f 72 6b 2e 20 20 57 65 20 61 72 65 0a 66 6f | reat.masters.at.work...We.are.fo |
| a040 | 72 74 75 6e 61 74 65 20 74 6f 20 68 61 76 65 20 62 65 65 6e 20 61 70 70 72 65 6e 74 69 63 65 20 | rtunate.to.have.been.apprentice. |
| a060 | 70 72 6f 67 72 61 6d 6d 65 72 73 20 61 74 20 74 68 65 20 66 65 65 74 20 6f 66 20 42 69 6c 6c 0a | programmers.at.the.feet.of.Bill. |
| a080 | 47 6f 73 70 65 72 20 61 6e 64 20 52 69 63 68 61 72 64 20 47 72 65 65 6e 62 6c 61 74 74 2e 0a 0a | Gosper.and.Richard.Greenblatt... |
| a0a0 | 20 20 20 49 74 20 69 73 20 64 69 66 66 69 63 75 6c 74 20 74 6f 20 69 64 65 6e 74 69 66 79 20 61 | ...It.is.difficult.to.identify.a |
| a0c0 | 6c 6c 20 74 68 65 20 70 65 6f 70 6c 65 20 77 68 6f 20 68 61 76 65 20 63 6f 6e 74 72 69 62 75 74 | ll.the.people.who.have.contribut |
| a0e0 | 65 64 20 74 6f 0a 74 68 65 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 6f 66 20 6f 75 72 20 63 75 72 | ed.to.the.development.of.our.cur |
| a100 | 72 69 63 75 6c 75 6d 2e 20 20 57 65 20 74 68 61 6e 6b 20 61 6c 6c 20 74 68 65 20 6c 65 63 74 75 | riculum...We.thank.all.the.lectu |
| a120 | 72 65 72 73 2c 0a 72 65 63 69 74 61 74 69 6f 6e 20 69 6e 73 74 72 75 63 74 6f 72 73 2c 20 61 6e | rers,.recitation.instructors,.an |
| a140 | 64 20 74 75 74 6f 72 73 20 77 68 6f 20 68 61 76 65 20 77 6f 72 6b 65 64 20 77 69 74 68 20 75 73 | d.tutors.who.have.worked.with.us |
| a160 | 20 6f 76 65 72 20 74 68 65 0a 70 61 73 74 20 66 69 66 74 65 65 6e 20 79 65 61 72 73 20 61 6e 64 | .over.the.past.fifteen.years.and |
| a180 | 20 70 75 74 20 69 6e 20 6d 61 6e 79 20 65 78 74 72 61 20 68 6f 75 72 73 20 6f 6e 20 6f 75 72 20 | .put.in.many.extra.hours.on.our. |
| a1a0 | 73 75 62 6a 65 63 74 2c 0a 65 73 70 65 63 69 61 6c 6c 79 20 42 69 6c 6c 20 53 69 65 62 65 72 74 | subject,.especially.Bill.Siebert |
| a1c0 | 2c 20 41 6c 62 65 72 74 20 4d 65 79 65 72 2c 20 4a 6f 65 20 53 74 6f 79 2c 20 52 61 6e 64 79 20 | ,.Albert.Meyer,.Joe.Stoy,.Randy. |
| a1e0 | 44 61 76 69 73 2c 20 4c 6f 75 69 73 0a 42 72 61 69 64 61 2c 20 45 72 69 63 20 47 72 69 6d 73 6f | Davis,.Louis.Braida,.Eric.Grimso |
| a200 | 6e 2c 20 52 6f 64 20 42 72 6f 6f 6b 73 2c 20 4c 79 6e 6e 20 53 74 65 69 6e 2c 20 61 6e 64 20 50 | n,.Rod.Brooks,.Lynn.Stein,.and.P |
| a220 | 65 74 65 72 20 53 7a 6f 6c 6f 76 69 74 73 2e 20 20 57 65 0a 77 6f 75 6c 64 20 6c 69 6b 65 20 74 | eter.Szolovits...We.would.like.t |
| a240 | 6f 20 73 70 65 63 69 61 6c 6c 79 20 61 63 6b 6e 6f 77 6c 65 64 67 65 20 74 68 65 20 6f 75 74 73 | o.specially.acknowledge.the.outs |
| a260 | 74 61 6e 64 69 6e 67 20 74 65 61 63 68 69 6e 67 0a 63 6f 6e 74 72 69 62 75 74 69 6f 6e 73 20 6f | tanding.teaching.contributions.o |
| a280 | 66 20 46 72 61 6e 6b 6c 79 6e 20 54 75 72 62 61 6b 2c 20 6e 6f 77 20 61 74 20 57 65 6c 6c 65 73 | f.Franklyn.Turbak,.now.at.Welles |
| a2a0 | 6c 65 79 3b 20 68 69 73 20 77 6f 72 6b 20 69 6e 0a 75 6e 64 65 72 67 72 61 64 75 61 74 65 20 69 | ley;.his.work.in.undergraduate.i |
| a2c0 | 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 74 20 61 20 73 74 61 6e 64 61 72 64 20 74 68 61 74 20 77 | nstruction.set.a.standard.that.w |
| a2e0 | 65 20 63 61 6e 20 61 6c 6c 20 61 73 70 69 72 65 20 74 6f 2e 20 20 57 65 0a 61 72 65 20 67 72 61 | e.can.all.aspire.to...We.are.gra |
| a300 | 74 65 66 75 6c 20 74 6f 20 4a 65 72 72 79 20 53 61 6c 74 7a 65 72 20 61 6e 64 20 4a 69 6d 20 4d | teful.to.Jerry.Saltzer.and.Jim.M |
| a320 | 69 6c 6c 65 72 20 66 6f 72 20 68 65 6c 70 69 6e 67 20 75 73 20 67 72 61 70 70 6c 65 0a 77 69 74 | iller.for.helping.us.grapple.wit |
| a340 | 68 20 74 68 65 20 6d 79 73 74 65 72 69 65 73 20 6f 66 20 63 6f 6e 63 75 72 72 65 6e 63 79 2c 20 | h.the.mysteries.of.concurrency,. |
| a360 | 61 6e 64 20 74 6f 20 50 65 74 65 72 20 53 7a 6f 6c 6f 76 69 74 73 20 61 6e 64 20 44 61 76 69 64 | and.to.Peter.Szolovits.and.David |
| a380 | 0a 4d 63 41 6c 6c 65 73 74 65 72 20 66 6f 72 20 74 68 65 69 72 20 63 6f 6e 74 72 69 62 75 74 69 | .McAllester.for.their.contributi |
| a3a0 | 6f 6e 73 20 74 6f 20 74 68 65 20 65 78 70 6f 73 69 74 69 6f 6e 20 6f 66 0a 6e 6f 6e 64 65 74 65 | ons.to.the.exposition.of.nondete |
| a3c0 | 72 6d 69 6e 69 73 74 69 63 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 6e 20 2a 4e 6f 74 65 20 43 68 | rministic.evaluation.in.*Note.Ch |
| a3e0 | 61 70 74 65 72 20 34 3a 3a 2e 0a 0a 20 20 20 4d 61 6e 79 20 70 65 6f 70 6c 65 20 68 61 76 65 20 | apter.4::......Many.people.have. |
| a400 | 70 75 74 20 69 6e 20 73 69 67 6e 69 66 69 63 61 6e 74 20 65 66 66 6f 72 74 20 70 72 65 73 65 6e | put.in.significant.effort.presen |
| a420 | 74 69 6e 67 20 74 68 69 73 20 6d 61 74 65 72 69 61 6c 0a 61 74 20 6f 74 68 65 72 20 75 6e 69 76 | ting.this.material.at.other.univ |
| a440 | 65 72 73 69 74 69 65 73 2e 20 20 53 6f 6d 65 20 6f 66 20 74 68 65 20 70 65 6f 70 6c 65 20 77 65 | ersities...Some.of.the.people.we |
| a460 | 20 68 61 76 65 20 77 6f 72 6b 65 64 20 63 6c 6f 73 65 6c 79 20 77 69 74 68 0a 61 72 65 20 4a 61 | .have.worked.closely.with.are.Ja |
| a480 | 63 6f 62 20 4b 61 74 7a 65 6e 65 6c 73 6f 6e 20 61 74 20 74 68 65 20 54 65 63 68 6e 69 6f 6e 2c | cob.Katzenelson.at.the.Technion, |
| a4a0 | 20 48 61 72 64 79 20 4d 61 79 65 72 20 61 74 20 74 68 65 20 55 6e 69 76 65 72 73 69 74 79 20 6f | .Hardy.Mayer.at.the.University.o |
| a4c0 | 66 0a 43 61 6c 69 66 6f 72 6e 69 61 20 61 74 20 49 72 76 69 6e 65 2c 20 4a 6f 65 20 53 74 6f 79 | f.California.at.Irvine,.Joe.Stoy |
| a4e0 | 20 61 74 20 4f 78 66 6f 72 64 2c 20 45 6c 69 73 68 61 20 53 61 63 6b 73 20 61 74 20 50 75 72 64 | .at.Oxford,.Elisha.Sacks.at.Purd |
| a500 | 75 65 2c 20 61 6e 64 0a 4a 61 6e 20 4b 6f 6d 6f 72 6f 77 73 6b 69 20 61 74 20 74 68 65 20 4e 6f | ue,.and.Jan.Komorowski.at.the.No |
| a520 | 72 77 65 67 69 61 6e 20 55 6e 69 76 65 72 73 69 74 79 20 6f 66 20 53 63 69 65 6e 63 65 20 61 6e | rwegian.University.of.Science.an |
| a540 | 64 20 54 65 63 68 6e 6f 6c 6f 67 79 2e 0a 57 65 20 61 72 65 20 65 78 63 65 70 74 69 6f 6e 61 6c | d.Technology..We.are.exceptional |
| a560 | 6c 79 20 70 72 6f 75 64 20 6f 66 20 6f 75 72 20 63 6f 6c 6c 65 61 67 75 65 73 20 77 68 6f 20 68 | ly.proud.of.our.colleagues.who.h |
| a580 | 61 76 65 20 72 65 63 65 69 76 65 64 20 6d 61 6a 6f 72 0a 74 65 61 63 68 69 6e 67 20 61 77 61 72 | ave.received.major.teaching.awar |
| a5a0 | 64 73 20 66 6f 72 20 74 68 65 69 72 20 61 64 61 70 74 61 74 69 6f 6e 73 20 6f 66 20 74 68 69 73 | ds.for.their.adaptations.of.this |
| a5c0 | 20 73 75 62 6a 65 63 74 20 61 74 20 6f 74 68 65 72 0a 75 6e 69 76 65 72 73 69 74 69 65 73 2c 20 | .subject.at.other.universities,. |
| a5e0 | 69 6e 63 6c 75 64 69 6e 67 20 4b 65 6e 6e 65 74 68 20 59 69 70 20 61 74 20 59 61 6c 65 2c 20 42 | including.Kenneth.Yip.at.Yale,.B |
| a600 | 72 69 61 6e 20 48 61 72 76 65 79 20 61 74 20 74 68 65 0a 55 6e 69 76 65 72 73 69 74 79 20 6f 66 | rian.Harvey.at.the.University.of |
| a620 | 20 43 61 6c 69 66 6f 72 6e 69 61 20 61 74 20 42 65 72 6b 65 6c 65 79 2c 20 61 6e 64 20 44 61 6e | .California.at.Berkeley,.and.Dan |
| a640 | 20 48 75 74 74 65 6e 6c 6f 63 68 65 72 20 61 74 20 43 6f 72 6e 65 6c 6c 2e 0a 0a 20 20 20 41 6c | .Huttenlocher.at.Cornell......Al |
| a660 | 20 4d 6f 79 65 27 20 61 72 72 61 6e 67 65 64 20 66 6f 72 20 75 73 20 74 6f 20 74 65 61 63 68 20 | .Moye'.arranged.for.us.to.teach. |
| a680 | 74 68 69 73 20 6d 61 74 65 72 69 61 6c 20 74 6f 20 65 6e 67 69 6e 65 65 72 73 20 61 74 0a 48 65 | this.material.to.engineers.at.He |
| a6a0 | 77 6c 65 74 74 2d 50 61 63 6b 61 72 64 2c 20 61 6e 64 20 66 6f 72 20 74 68 65 20 70 72 6f 64 75 | wlett-Packard,.and.for.the.produ |
| a6c0 | 63 74 69 6f 6e 20 6f 66 20 76 69 64 65 6f 74 61 70 65 73 20 6f 66 20 74 68 65 73 65 0a 6c 65 63 | ction.of.videotapes.of.these.lec |
| a6e0 | 74 75 72 65 73 2e 20 20 57 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 20 74 68 61 6e 6b 20 74 | tures...We.would.like.to.thank.t |
| a700 | 68 65 20 74 61 6c 65 6e 74 65 64 20 69 6e 73 74 72 75 63 74 6f 72 73 2d 2d 69 6e 0a 70 61 72 74 | he.talented.instructors--in.part |
| a720 | 69 63 75 6c 61 72 20 4a 69 6d 20 4d 69 6c 6c 65 72 2c 20 42 69 6c 6c 20 53 69 65 62 65 72 74 2c | icular.Jim.Miller,.Bill.Siebert, |
| a740 | 20 61 6e 64 20 4d 69 6b 65 20 45 69 73 65 6e 62 65 72 67 2d 2d 77 68 6f 20 68 61 76 65 0a 64 65 | .and.Mike.Eisenberg--who.have.de |
| a760 | 73 69 67 6e 65 64 20 63 6f 6e 74 69 6e 75 69 6e 67 20 65 64 75 63 61 74 69 6f 6e 20 63 6f 75 72 | signed.continuing.education.cour |
| a780 | 73 65 73 20 69 6e 63 6f 72 70 6f 72 61 74 69 6e 67 20 74 68 65 73 65 20 74 61 70 65 73 20 61 6e | ses.incorporating.these.tapes.an |
| a7a0 | 64 0a 74 61 75 67 68 74 20 74 68 65 6d 20 61 74 20 75 6e 69 76 65 72 73 69 74 69 65 73 20 61 6e | d.taught.them.at.universities.an |
| a7c0 | 64 20 69 6e 64 75 73 74 72 79 20 61 6c 6c 20 6f 76 65 72 20 74 68 65 20 77 6f 72 6c 64 2e 0a 0a | d.industry.all.over.the.world... |
| a7e0 | 20 20 20 4d 61 6e 79 20 65 64 75 63 61 74 6f 72 73 20 69 6e 20 6f 74 68 65 72 20 63 6f 75 6e 74 | ...Many.educators.in.other.count |
| a800 | 72 69 65 73 20 68 61 76 65 20 70 75 74 20 69 6e 20 73 69 67 6e 69 66 69 63 61 6e 74 20 77 6f 72 | ries.have.put.in.significant.wor |
| a820 | 6b 0a 74 72 61 6e 73 6c 61 74 69 6e 67 20 74 68 65 20 66 69 72 73 74 20 65 64 69 74 69 6f 6e 2e | k.translating.the.first.edition. |
| a840 | 20 20 4d 69 63 68 65 6c 20 42 72 69 61 6e 64 2c 20 50 69 65 72 72 65 20 43 68 61 6d 61 72 64 2c | ..Michel.Briand,.Pierre.Chamard, |
| a860 | 20 61 6e 64 0a 41 6e 64 72 65 27 20 50 69 63 20 70 72 6f 64 75 63 65 64 20 61 20 46 72 65 6e 63 | .and.Andre'.Pic.produced.a.Frenc |
| a880 | 68 20 65 64 69 74 69 6f 6e 3b 20 53 75 73 61 6e 6e 65 20 44 61 6e 69 65 6c 73 2d 48 65 72 6f 6c | h.edition;.Susanne.Daniels-Herol |
| a8a0 | 64 20 70 72 6f 64 75 63 65 64 20 61 0a 47 65 72 6d 61 6e 20 65 64 69 74 69 6f 6e 3b 20 61 6e 64 | d.produced.a.German.edition;.and |
| a8c0 | 20 46 75 6d 69 6f 20 4d 6f 74 6f 79 6f 73 68 69 20 70 72 6f 64 75 63 65 64 20 61 20 4a 61 70 61 | .Fumio.Motoyoshi.produced.a.Japa |
| a8e0 | 6e 65 73 65 20 65 64 69 74 69 6f 6e 2e 20 20 57 65 20 64 6f 0a 6e 6f 74 20 6b 6e 6f 77 20 77 68 | nese.edition...We.do.not.know.wh |
| a900 | 6f 20 70 72 6f 64 75 63 65 64 20 74 68 65 20 43 68 69 6e 65 73 65 20 65 64 69 74 69 6f 6e 2c 20 | o.produced.the.Chinese.edition,. |
| a920 | 62 75 74 20 77 65 20 63 6f 6e 73 69 64 65 72 20 69 74 20 61 6e 20 68 6f 6e 6f 72 0a 74 6f 20 68 | but.we.consider.it.an.honor.to.h |
| a940 | 61 76 65 20 62 65 65 6e 20 73 65 6c 65 63 74 65 64 20 61 73 20 74 68 65 20 73 75 62 6a 65 63 74 | ave.been.selected.as.the.subject |
| a960 | 20 6f 66 20 61 6e 20 22 75 6e 61 75 74 68 6f 72 69 7a 65 64 22 20 74 72 61 6e 73 6c 61 74 69 6f | .of.an."unauthorized".translatio |
| a980 | 6e 2e 0a 0a 20 20 20 49 74 20 69 73 20 68 61 72 64 20 74 6f 20 65 6e 75 6d 65 72 61 74 65 20 61 | n......It.is.hard.to.enumerate.a |
| a9a0 | 6c 6c 20 74 68 65 20 70 65 6f 70 6c 65 20 77 68 6f 20 68 61 76 65 20 6d 61 64 65 20 74 65 63 68 | ll.the.people.who.have.made.tech |
| a9c0 | 6e 69 63 61 6c 0a 63 6f 6e 74 72 69 62 75 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 64 65 76 65 6c | nical.contributions.to.the.devel |
| a9e0 | 6f 70 6d 65 6e 74 20 6f 66 20 74 68 65 20 53 63 68 65 6d 65 20 73 79 73 74 65 6d 73 20 77 65 20 | opment.of.the.Scheme.systems.we. |
| aa00 | 75 73 65 20 66 6f 72 0a 69 6e 73 74 72 75 63 74 69 6f 6e 61 6c 20 70 75 72 70 6f 73 65 73 2e 20 | use.for.instructional.purposes.. |
| aa20 | 20 49 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 47 75 79 20 53 74 65 65 6c 65 2c 20 70 72 69 6e | .In.addition.to.Guy.Steele,.prin |
| aa40 | 63 69 70 61 6c 20 77 69 7a 61 72 64 73 0a 68 61 76 65 20 69 6e 63 6c 75 64 65 64 20 43 68 72 69 | cipal.wizards.have.included.Chri |
| aa60 | 73 20 48 61 6e 73 6f 6e 2c 20 4a 6f 65 20 42 6f 77 62 65 65 72 2c 20 4a 69 6d 20 4d 69 6c 6c 65 | s.Hanson,.Joe.Bowbeer,.Jim.Mille |
| aa80 | 72 2c 20 47 75 69 6c 6c 65 72 6d 6f 20 52 6f 7a 61 73 2c 0a 61 6e 64 20 53 74 65 70 68 65 6e 20 | r,.Guillermo.Rozas,.and.Stephen. |
| aaa0 | 41 64 61 6d 73 2e 20 20 4f 74 68 65 72 73 20 77 68 6f 20 68 61 76 65 20 70 75 74 20 69 6e 20 73 | Adams...Others.who.have.put.in.s |
| aac0 | 69 67 6e 69 66 69 63 61 6e 74 20 74 69 6d 65 20 61 72 65 20 52 69 63 68 61 72 64 0a 53 74 61 6c | ignificant.time.are.Richard.Stal |
| aae0 | 6c 6d 61 6e 2c 20 41 6c 61 6e 20 42 61 77 64 65 6e 2c 20 4b 65 6e 74 20 50 69 74 6d 61 6e 2c 20 | lman,.Alan.Bawden,.Kent.Pitman,. |
| ab00 | 4a 6f 6e 20 54 61 66 74 2c 20 4e 65 69 6c 20 4d 61 79 6c 65 2c 20 4a 6f 68 6e 20 4c 61 6d 70 69 | Jon.Taft,.Neil.Mayle,.John.Lampi |
| ab20 | 6e 67 2c 0a 47 77 79 6e 20 4f 73 6e 6f 73 2c 20 54 72 61 63 79 20 4c 61 72 72 61 62 65 65 2c 20 | ng,.Gwyn.Osnos,.Tracy.Larrabee,. |
| ab40 | 47 65 6f 72 67 65 20 43 61 72 72 65 74 74 65 2c 20 53 6f 6d 61 20 43 68 61 75 64 68 75 72 69 2c | George.Carrette,.Soma.Chaudhuri, |
| ab60 | 20 42 69 6c 6c 0a 43 68 69 61 72 63 68 69 61 72 6f 2c 20 53 74 65 76 65 6e 20 4b 69 72 73 63 68 | .Bill.Chiarchiaro,.Steven.Kirsch |
| ab80 | 2c 20 4c 65 69 67 68 20 4b 6c 6f 74 7a 2c 20 57 61 79 6e 65 20 4e 6f 73 73 2c 20 54 6f 64 64 20 | ,.Leigh.Klotz,.Wayne.Noss,.Todd. |
| aba0 | 43 61 73 73 2c 20 50 61 74 72 69 63 6b 0a 4f 27 44 6f 6e 6e 65 6c 6c 2c 20 4b 65 76 69 6e 20 54 | Cass,.Patrick.O'Donnell,.Kevin.T |
| abc0 | 68 65 6f 62 61 6c 64 2c 20 44 61 6e 69 65 6c 20 57 65 69 73 65 2c 20 4b 65 6e 6e 65 74 68 20 53 | heobald,.Daniel.Weise,.Kenneth.S |
| abe0 | 69 6e 63 6c 61 69 72 2c 20 41 6e 74 68 6f 6e 79 0a 43 6f 75 72 74 65 6d 61 6e 63 68 65 2c 20 48 | inclair,.Anthony.Courtemanche,.H |
| ac00 | 65 6e 72 79 20 4d 2e 20 57 75 2c 20 41 6e 64 72 65 77 20 42 65 72 6c 69 6e 2c 20 61 6e 64 20 52 | enry.M..Wu,.Andrew.Berlin,.and.R |
| ac20 | 75 74 68 20 53 68 79 75 2e 0a 0a 20 20 20 42 65 79 6f 6e 64 20 74 68 65 20 4d 49 54 20 69 6d 70 | uth.Shyu......Beyond.the.MIT.imp |
| ac40 | 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 20 77 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 20 74 68 | lementation,.we.would.like.to.th |
| ac60 | 61 6e 6b 20 74 68 65 20 6d 61 6e 79 20 70 65 6f 70 6c 65 0a 77 68 6f 20 77 6f 72 6b 65 64 20 6f | ank.the.many.people.who.worked.o |
| ac80 | 6e 20 74 68 65 20 49 45 45 45 20 53 63 68 65 6d 65 20 73 74 61 6e 64 61 72 64 2c 20 69 6e 63 6c | n.the.IEEE.Scheme.standard,.incl |
| aca0 | 75 64 69 6e 67 20 57 69 6c 6c 69 61 6d 20 43 6c 69 6e 67 65 72 20 61 6e 64 0a 4a 6f 6e 61 74 68 | uding.William.Clinger.and.Jonath |
| acc0 | 61 6e 20 52 65 65 73 2c 20 77 68 6f 20 65 64 69 74 65 64 20 74 68 65 20 52 5e 34 52 53 2c 20 61 | an.Rees,.who.edited.the.R^4RS,.a |
| ace0 | 6e 64 20 43 68 72 69 73 20 48 61 79 6e 65 73 2c 20 44 61 76 69 64 20 42 61 72 74 6c 65 79 2c 0a | nd.Chris.Haynes,.David.Bartley,. |
| ad00 | 43 68 72 69 73 20 48 61 6e 73 6f 6e 2c 20 61 6e 64 20 4a 69 6d 20 4d 69 6c 6c 65 72 2c 20 77 68 | Chris.Hanson,.and.Jim.Miller,.wh |
| ad20 | 6f 20 70 72 65 70 61 72 65 64 20 74 68 65 20 49 45 45 45 20 73 74 61 6e 64 61 72 64 2e 0a 0a 20 | o.prepared.the.IEEE.standard.... |
| ad40 | 20 20 44 61 6e 20 46 72 69 65 64 6d 61 6e 20 68 61 73 20 62 65 65 6e 20 61 20 6c 6f 6e 67 2d 74 | ..Dan.Friedman.has.been.a.long-t |
| ad60 | 69 6d 65 20 6c 65 61 64 65 72 20 6f 66 20 74 68 65 20 53 63 68 65 6d 65 20 63 6f 6d 6d 75 6e 69 | ime.leader.of.the.Scheme.communi |
| ad80 | 74 79 2e 0a 54 68 65 20 63 6f 6d 6d 75 6e 69 74 79 27 73 20 62 72 6f 61 64 65 72 20 77 6f 72 6b | ty..The.community's.broader.work |
| ada0 | 20 67 6f 65 73 20 62 65 79 6f 6e 64 20 69 73 73 75 65 73 20 6f 66 20 6c 61 6e 67 75 61 67 65 20 | .goes.beyond.issues.of.language. |
| adc0 | 64 65 73 69 67 6e 20 74 6f 0a 65 6e 63 6f 6d 70 61 73 73 20 73 69 67 6e 69 66 69 63 61 6e 74 20 | design.to.encompass.significant. |
| ade0 | 65 64 75 63 61 74 69 6f 6e 61 6c 20 69 6e 6e 6f 76 61 74 69 6f 6e 73 2c 20 73 75 63 68 20 61 73 | educational.innovations,.such.as |
| ae00 | 20 74 68 65 20 68 69 67 68 2d 73 63 68 6f 6f 6c 0a 63 75 72 72 69 63 75 6c 75 6d 20 62 61 73 65 | .the.high-school.curriculum.base |
| ae20 | 64 20 6f 6e 20 45 64 53 63 68 65 6d 65 20 62 79 20 53 63 68 65 6d 65 72 27 73 20 49 6e 63 2e 2c | d.on.EdScheme.by.Schemer's.Inc., |
| ae40 | 20 61 6e 64 20 74 68 65 20 77 6f 6e 64 65 72 66 75 6c 20 62 6f 6f 6b 73 0a 62 79 20 4d 69 6b 65 | .and.the.wonderful.books.by.Mike |
| ae60 | 20 45 69 73 65 6e 62 65 72 67 20 61 6e 64 20 62 79 20 42 72 69 61 6e 20 48 61 72 76 65 79 20 61 | .Eisenberg.and.by.Brian.Harvey.a |
| ae80 | 6e 64 20 4d 61 74 74 68 65 77 20 57 72 69 67 68 74 2e 0a 0a 20 20 20 57 65 20 61 70 70 72 65 63 | nd.Matthew.Wright......We.apprec |
| aea0 | 69 61 74 65 20 74 68 65 20 77 6f 72 6b 20 6f 66 20 74 68 6f 73 65 20 77 68 6f 20 63 6f 6e 74 72 | iate.the.work.of.those.who.contr |
| aec0 | 69 62 75 74 65 64 20 74 6f 20 6d 61 6b 69 6e 67 20 74 68 69 73 20 61 0a 72 65 61 6c 20 62 6f 6f | ibuted.to.making.this.a.real.boo |
| aee0 | 6b 2c 20 65 73 70 65 63 69 61 6c 6c 79 20 54 65 72 72 79 20 45 68 6c 69 6e 67 2c 20 4c 61 72 72 | k,.especially.Terry.Ehling,.Larr |
| af00 | 79 20 43 6f 68 65 6e 2c 20 61 6e 64 20 50 61 75 6c 20 42 65 74 68 67 65 20 61 74 20 74 68 65 0a | y.Cohen,.and.Paul.Bethge.at.the. |
| af20 | 4d 49 54 20 50 72 65 73 73 2e 20 20 45 6c 6c 61 20 4d 61 7a 65 6c 20 66 6f 75 6e 64 20 74 68 65 | MIT.Press...Ella.Mazel.found.the |
| af40 | 20 77 6f 6e 64 65 72 66 75 6c 20 63 6f 76 65 72 20 69 6d 61 67 65 2e 20 20 46 6f 72 20 74 68 65 | .wonderful.cover.image...For.the |
| af60 | 20 73 65 63 6f 6e 64 0a 65 64 69 74 69 6f 6e 20 77 65 20 61 72 65 20 70 61 72 74 69 63 75 6c 61 | .second.edition.we.are.particula |
| af80 | 72 6c 79 20 67 72 61 74 65 66 75 6c 20 74 6f 20 42 65 72 6e 61 72 64 20 61 6e 64 20 45 6c 6c 61 | rly.grateful.to.Bernard.and.Ella |
| afa0 | 20 4d 61 7a 65 6c 20 66 6f 72 20 68 65 6c 70 0a 77 69 74 68 20 74 68 65 20 62 6f 6f 6b 20 64 65 | .Mazel.for.help.with.the.book.de |
| afc0 | 73 69 67 6e 2c 20 61 6e 64 20 74 6f 20 44 61 76 69 64 20 4a 6f 6e 65 73 2c 20 54 65 58 20 77 69 | sign,.and.to.David.Jones,.TeX.wi |
| afe0 | 7a 61 72 64 20 65 78 74 72 61 6f 72 64 69 6e 61 69 72 65 2e 0a 57 65 20 61 6c 73 6f 20 61 72 65 | zard.extraordinaire..We.also.are |
| b000 | 20 69 6e 64 65 62 74 65 64 20 74 6f 20 74 68 6f 73 65 20 72 65 61 64 65 72 73 20 77 68 6f 20 6d | .indebted.to.those.readers.who.m |
| b020 | 61 64 65 20 70 65 6e 65 74 72 61 74 69 6e 67 20 63 6f 6d 6d 65 6e 74 73 20 6f 6e 0a 74 68 65 20 | ade.penetrating.comments.on.the. |
| b040 | 6e 65 77 20 64 72 61 66 74 3a 20 4a 61 63 6f 62 20 4b 61 74 7a 65 6e 65 6c 73 6f 6e 2c 20 48 61 | new.draft:.Jacob.Katzenelson,.Ha |
| b060 | 72 64 79 20 4d 61 79 65 72 2c 20 4a 69 6d 20 4d 69 6c 6c 65 72 2c 20 61 6e 64 0a 65 73 70 65 63 | rdy.Mayer,.Jim.Miller,.and.espec |
| b080 | 69 61 6c 6c 79 20 42 72 69 61 6e 20 48 61 72 76 65 79 2c 20 77 68 6f 20 64 69 64 20 75 6e 74 6f | ially.Brian.Harvey,.who.did.unto |
| b0a0 | 20 74 68 69 73 20 62 6f 6f 6b 20 61 73 20 4a 75 6c 69 65 20 64 69 64 20 75 6e 74 6f 20 68 69 73 | .this.book.as.Julie.did.unto.his |
| b0c0 | 0a 62 6f 6f 6b 20 60 53 69 6d 70 6c 79 20 53 63 68 65 6d 65 27 2e 0a 0a 20 20 20 46 69 6e 61 6c | .book.`Simply.Scheme'......Final |
| b0e0 | 6c 79 2c 20 77 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 20 61 63 6b 6e 6f 77 6c 65 64 67 65 | ly,.we.would.like.to.acknowledge |
| b100 | 20 74 68 65 20 73 75 70 70 6f 72 74 20 6f 66 20 74 68 65 0a 6f 72 67 61 6e 69 7a 61 74 69 6f 6e | .the.support.of.the.organization |
| b120 | 73 20 74 68 61 74 20 68 61 76 65 20 65 6e 63 6f 75 72 61 67 65 64 20 74 68 69 73 20 77 6f 72 6b | s.that.have.encouraged.this.work |
| b140 | 20 6f 76 65 72 20 74 68 65 20 79 65 61 72 73 2c 20 69 6e 63 6c 75 64 69 6e 67 0a 73 75 70 70 70 | .over.the.years,.including.suppp |
| b160 | 6f 72 74 20 66 72 6f 6d 20 48 65 77 6c 65 74 74 2d 50 61 63 6b 61 72 64 2c 20 6d 61 64 65 20 70 | ort.from.Hewlett-Packard,.made.p |
| b180 | 6f 73 73 69 62 6c 65 20 62 79 20 49 72 61 20 47 6f 6c 64 73 74 65 69 6e 20 61 6e 64 20 4a 6f 65 | ossible.by.Ira.Goldstein.and.Joe |
| b1a0 | 6c 0a 42 69 72 6e 62 61 75 6d 2c 20 61 6e 64 20 73 75 70 70 6f 72 74 20 66 72 6f 6d 20 44 41 52 | l.Birnbaum,.and.support.from.DAR |
| b1c0 | 50 41 2c 20 6d 61 64 65 20 70 6f 73 73 69 62 6c 65 20 62 79 20 42 6f 62 20 4b 61 68 6e 2e 0a 0a | PA,.made.possible.by.Bob.Kahn... |
| b1e0 | 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 43 68 61 70 74 65 | ..File:.sicp.info,..Node:.Chapte |
| b200 | 72 20 31 2c 20 20 4e 65 78 74 3a 20 43 68 61 70 74 65 72 20 32 2c 20 20 50 72 65 76 3a 20 41 63 | r.1,..Next:.Chapter.2,..Prev:.Ac |
| b220 | 6b 6e 6f 77 6c 65 64 67 65 6d 65 6e 74 73 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 31 20 42 75 69 6c | knowledgements,..Up:.Top..1.Buil |
| b240 | 64 69 6e 67 20 41 62 73 74 72 61 63 74 69 6f 6e 73 20 77 69 74 68 20 50 72 6f 63 65 64 75 72 65 | ding.Abstractions.with.Procedure |
| b260 | 73 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a | s.****************************** |
| b280 | 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 0a 20 20 20 20 20 54 68 65 20 61 63 74 73 20 6f 66 20 74 68 65 20 | *********.......The.acts.of.the. |
| b2a0 | 6d 69 6e 64 2c 20 77 68 65 72 65 69 6e 20 69 74 20 65 78 65 72 74 73 20 69 74 73 20 70 6f 77 65 | mind,.wherein.it.exerts.its.powe |
| b2c0 | 72 20 6f 76 65 72 20 73 69 6d 70 6c 65 0a 20 20 20 20 20 69 64 65 61 73 2c 20 61 72 65 20 63 68 | r.over.simple......ideas,.are.ch |
| b2e0 | 69 65 66 6c 79 20 74 68 65 73 65 20 74 68 72 65 65 3a 20 31 2e 20 43 6f 6d 62 69 6e 69 6e 67 20 | iefly.these.three:.1..Combining. |
| b300 | 73 65 76 65 72 61 6c 20 73 69 6d 70 6c 65 20 69 64 65 61 73 0a 20 20 20 20 20 69 6e 74 6f 20 6f | several.simple.ideas......into.o |
| b320 | 6e 65 20 63 6f 6d 70 6f 75 6e 64 20 6f 6e 65 2c 20 61 6e 64 20 74 68 75 73 20 61 6c 6c 20 63 6f | ne.compound.one,.and.thus.all.co |
| b340 | 6d 70 6c 65 78 20 69 64 65 61 73 20 61 72 65 20 6d 61 64 65 2e 20 20 32 2e 0a 20 20 20 20 20 54 | mplex.ideas.are.made...2.......T |
| b360 | 68 65 20 73 65 63 6f 6e 64 20 69 73 20 62 72 69 6e 67 69 6e 67 20 74 77 6f 20 69 64 65 61 73 2c | he.second.is.bringing.two.ideas, |
| b380 | 20 77 68 65 74 68 65 72 20 73 69 6d 70 6c 65 20 6f 72 20 63 6f 6d 70 6c 65 78 2c 0a 20 20 20 20 | .whether.simple.or.complex,..... |
| b3a0 | 20 74 6f 67 65 74 68 65 72 2c 20 61 6e 64 20 73 65 74 74 69 6e 67 20 74 68 65 6d 20 62 79 20 6f | .together,.and.setting.them.by.o |
| b3c0 | 6e 65 20 61 6e 6f 74 68 65 72 20 73 6f 20 61 73 20 74 6f 20 74 61 6b 65 20 61 20 76 69 65 77 20 | ne.another.so.as.to.take.a.view. |
| b3e0 | 6f 66 0a 20 20 20 20 20 74 68 65 6d 20 61 74 20 6f 6e 63 65 2c 20 77 69 74 68 6f 75 74 20 75 6e | of......them.at.once,.without.un |
| b400 | 69 74 69 6e 67 20 74 68 65 6d 20 69 6e 74 6f 20 6f 6e 65 2c 20 62 79 20 77 68 69 63 68 20 69 74 | iting.them.into.one,.by.which.it |
| b420 | 20 67 65 74 73 20 61 6c 6c 0a 20 20 20 20 20 69 74 73 20 69 64 65 61 73 20 6f 66 20 72 65 6c 61 | .gets.all......its.ideas.of.rela |
| b440 | 74 69 6f 6e 73 2e 20 20 33 2e 20 20 54 68 65 20 74 68 69 72 64 20 69 73 20 73 65 70 61 72 61 74 | tions...3...The.third.is.separat |
| b460 | 69 6e 67 20 74 68 65 6d 20 66 72 6f 6d 20 61 6c 6c 0a 20 20 20 20 20 6f 74 68 65 72 20 69 64 65 | ing.them.from.all......other.ide |
| b480 | 61 73 20 74 68 61 74 20 61 63 63 6f 6d 70 61 6e 79 20 74 68 65 6d 20 69 6e 20 74 68 65 69 72 20 | as.that.accompany.them.in.their. |
| b4a0 | 72 65 61 6c 20 65 78 69 73 74 65 6e 63 65 3a 20 74 68 69 73 20 69 73 0a 20 20 20 20 20 63 61 6c | real.existence:.this.is......cal |
| b4c0 | 6c 65 64 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 61 6e 64 20 74 68 75 73 20 61 6c 6c 20 69 74 | led.abstraction,.and.thus.all.it |
| b4e0 | 73 20 67 65 6e 65 72 61 6c 20 69 64 65 61 73 20 61 72 65 20 6d 61 64 65 2e 0a 0a 20 20 20 20 20 | s.general.ideas.are.made........ |
| b500 | 2d 2d 4a 6f 68 6e 20 4c 6f 63 6b 65 2c 20 5f 41 6e 20 45 73 73 61 79 20 43 6f 6e 63 65 72 6e 69 | --John.Locke,._An.Essay.Concerni |
| b520 | 6e 67 20 48 75 6d 61 6e 20 55 6e 64 65 72 73 74 61 6e 64 69 6e 67 5f 20 28 31 36 39 30 29 0a 0a | ng.Human.Understanding_.(1690).. |
| b540 | 20 20 20 57 65 20 61 72 65 20 61 62 6f 75 74 20 74 6f 20 73 74 75 64 79 20 74 68 65 20 69 64 65 | ...We.are.about.to.study.the.ide |
| b560 | 61 20 6f 66 20 61 20 22 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 70 72 6f 63 65 73 73 22 2e 0a | a.of.a."computational.process".. |
| b580 | 43 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 70 72 6f 63 65 73 73 65 73 20 61 72 65 20 61 62 73 74 | Computational.processes.are.abst |
| b5a0 | 72 61 63 74 20 62 65 69 6e 67 73 20 74 68 61 74 20 69 6e 68 61 62 69 74 20 63 6f 6d 70 75 74 65 | ract.beings.that.inhabit.compute |
| b5c0 | 72 73 2e 20 20 41 73 0a 74 68 65 79 20 65 76 6f 6c 76 65 2c 20 70 72 6f 63 65 73 73 65 73 20 6d | rs...As.they.evolve,.processes.m |
| b5e0 | 61 6e 69 70 75 6c 61 74 65 20 6f 74 68 65 72 20 61 62 73 74 72 61 63 74 20 74 68 69 6e 67 73 20 | anipulate.other.abstract.things. |
| b600 | 63 61 6c 6c 65 64 20 22 64 61 74 61 22 2e 0a 54 68 65 20 65 76 6f 6c 75 74 69 6f 6e 20 6f 66 20 | called."data"..The.evolution.of. |
| b620 | 61 20 70 72 6f 63 65 73 73 20 69 73 20 64 69 72 65 63 74 65 64 20 62 79 20 61 20 70 61 74 74 65 | a.process.is.directed.by.a.patte |
| b640 | 72 6e 20 6f 66 20 72 75 6c 65 73 20 63 61 6c 6c 65 64 20 61 20 22 70 72 6f 67 72 61 6d 22 2e 0a | rn.of.rules.called.a."program".. |
| b660 | 50 65 6f 70 6c 65 20 63 72 65 61 74 65 20 70 72 6f 67 72 61 6d 73 20 74 6f 20 64 69 72 65 63 74 | People.create.programs.to.direct |
| b680 | 20 70 72 6f 63 65 73 73 65 73 2e 20 20 49 6e 20 65 66 66 65 63 74 2c 20 77 65 20 63 6f 6e 6a 75 | .processes...In.effect,.we.conju |
| b6a0 | 72 65 20 74 68 65 0a 73 70 69 72 69 74 73 20 6f 66 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 77 | re.the.spirits.of.the.computer.w |
| b6c0 | 69 74 68 20 6f 75 72 20 73 70 65 6c 6c 73 2e 0a 0a 20 20 20 41 20 63 6f 6d 70 75 74 61 74 69 6f | ith.our.spells......A.computatio |
| b6e0 | 6e 61 6c 20 70 72 6f 63 65 73 73 20 69 73 20 69 6e 64 65 65 64 20 6d 75 63 68 20 6c 69 6b 65 20 | nal.process.is.indeed.much.like. |
| b700 | 61 20 73 6f 72 63 65 72 65 72 27 73 20 69 64 65 61 20 6f 66 20 61 0a 73 70 69 72 69 74 2e 20 20 | a.sorcerer's.idea.of.a.spirit... |
| b720 | 49 74 20 63 61 6e 6e 6f 74 20 62 65 20 73 65 65 6e 20 6f 72 20 74 6f 75 63 68 65 64 2e 20 20 49 | It.cannot.be.seen.or.touched...I |
| b740 | 74 20 69 73 20 6e 6f 74 20 63 6f 6d 70 6f 73 65 64 20 6f 66 20 6d 61 74 74 65 72 20 61 74 0a 61 | t.is.not.composed.of.matter.at.a |
| b760 | 6c 6c 2e 20 20 48 6f 77 65 76 65 72 2c 20 69 74 20 69 73 20 76 65 72 79 20 72 65 61 6c 2e 20 20 | ll...However,.it.is.very.real... |
| b780 | 49 74 20 63 61 6e 20 70 65 72 66 6f 72 6d 20 69 6e 74 65 6c 6c 65 63 74 75 61 6c 20 77 6f 72 6b | It.can.perform.intellectual.work |
| b7a0 | 2e 20 20 49 74 0a 63 61 6e 20 61 6e 73 77 65 72 20 71 75 65 73 74 69 6f 6e 73 2e 20 20 49 74 20 | ...It.can.answer.questions...It. |
| b7c0 | 63 61 6e 20 61 66 66 65 63 74 20 74 68 65 20 77 6f 72 6c 64 20 62 79 20 64 69 73 62 75 72 73 69 | can.affect.the.world.by.disbursi |
| b7e0 | 6e 67 20 6d 6f 6e 65 79 20 61 74 20 61 0a 62 61 6e 6b 20 6f 72 20 62 79 20 63 6f 6e 74 72 6f 6c | ng.money.at.a.bank.or.by.control |
| b800 | 6c 69 6e 67 20 61 20 72 6f 62 6f 74 20 61 72 6d 20 69 6e 20 61 20 66 61 63 74 6f 72 79 2e 20 20 | ling.a.robot.arm.in.a.factory... |
| b820 | 54 68 65 20 70 72 6f 67 72 61 6d 73 20 77 65 20 75 73 65 0a 74 6f 20 63 6f 6e 6a 75 72 65 20 70 | The.programs.we.use.to.conjure.p |
| b840 | 72 6f 63 65 73 73 65 73 20 61 72 65 20 6c 69 6b 65 20 61 20 73 6f 72 63 65 72 65 72 27 73 20 73 | rocesses.are.like.a.sorcerer's.s |
| b860 | 70 65 6c 6c 73 2e 20 20 54 68 65 79 20 61 72 65 20 63 61 72 65 66 75 6c 6c 79 0a 63 6f 6d 70 6f | pells...They.are.carefully.compo |
| b880 | 73 65 64 20 66 72 6f 6d 20 73 79 6d 62 6f 6c 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e | sed.from.symbolic.expressions.in |
| b8a0 | 20 61 72 63 61 6e 65 20 61 6e 64 20 65 73 6f 74 65 72 69 63 20 22 70 72 6f 67 72 61 6d 6d 69 6e | .arcane.and.esoteric."programmin |
| b8c0 | 67 0a 6c 61 6e 67 75 61 67 65 73 22 20 74 68 61 74 20 70 72 65 73 63 72 69 62 65 20 74 68 65 20 | g.languages".that.prescribe.the. |
| b8e0 | 74 61 73 6b 73 20 77 65 20 77 61 6e 74 20 6f 75 72 20 70 72 6f 63 65 73 73 65 73 20 74 6f 20 70 | tasks.we.want.our.processes.to.p |
| b900 | 65 72 66 6f 72 6d 2e 0a 0a 20 20 20 41 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 70 72 6f 63 | erform......A.computational.proc |
| b920 | 65 73 73 2c 20 69 6e 20 61 20 63 6f 72 72 65 63 74 6c 79 20 77 6f 72 6b 69 6e 67 20 63 6f 6d 70 | ess,.in.a.correctly.working.comp |
| b940 | 75 74 65 72 2c 20 65 78 65 63 75 74 65 73 0a 70 72 6f 67 72 61 6d 73 20 70 72 65 63 69 73 65 6c | uter,.executes.programs.precisel |
| b960 | 79 20 61 6e 64 20 61 63 63 75 72 61 74 65 6c 79 2e 20 20 54 68 75 73 2c 20 6c 69 6b 65 20 74 68 | y.and.accurately...Thus,.like.th |
| b980 | 65 20 73 6f 72 63 65 72 65 72 27 73 0a 61 70 70 72 65 6e 74 69 63 65 2c 20 6e 6f 76 69 63 65 20 | e.sorcerer's.apprentice,.novice. |
| b9a0 | 70 72 6f 67 72 61 6d 6d 65 72 73 20 6d 75 73 74 20 6c 65 61 72 6e 20 74 6f 20 75 6e 64 65 72 73 | programmers.must.learn.to.unders |
| b9c0 | 74 61 6e 64 20 61 6e 64 20 74 6f 0a 61 6e 74 69 63 69 70 61 74 65 20 74 68 65 20 63 6f 6e 73 65 | tand.and.to.anticipate.the.conse |
| b9e0 | 71 75 65 6e 63 65 73 20 6f 66 20 74 68 65 69 72 20 63 6f 6e 6a 75 72 69 6e 67 2e 20 20 45 76 65 | quences.of.their.conjuring...Eve |
| ba00 | 6e 20 73 6d 61 6c 6c 20 65 72 72 6f 72 73 0a 28 75 73 75 61 6c 6c 79 20 63 61 6c 6c 65 64 20 22 | n.small.errors.(usually.called." |
| ba20 | 62 75 67 73 22 20 6f 72 20 22 67 6c 69 74 63 68 65 73 22 29 20 69 6e 20 70 72 6f 67 72 61 6d 73 | bugs".or."glitches").in.programs |
| ba40 | 20 63 61 6e 20 68 61 76 65 20 63 6f 6d 70 6c 65 78 20 61 6e 64 0a 75 6e 61 6e 74 69 63 69 70 61 | .can.have.complex.and.unanticipa |
| ba60 | 74 65 64 20 63 6f 6e 73 65 71 75 65 6e 63 65 73 2e 0a 0a 20 20 20 46 6f 72 74 75 6e 61 74 65 6c | ted.consequences......Fortunatel |
| ba80 | 79 2c 20 6c 65 61 72 6e 69 6e 67 20 74 6f 20 70 72 6f 67 72 61 6d 20 69 73 20 63 6f 6e 73 69 64 | y,.learning.to.program.is.consid |
| baa0 | 65 72 61 62 6c 79 20 6c 65 73 73 20 64 61 6e 67 65 72 6f 75 73 20 74 68 61 6e 0a 6c 65 61 72 6e | erably.less.dangerous.than.learn |
| bac0 | 69 6e 67 20 73 6f 72 63 65 72 79 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 73 70 69 72 69 74 73 | ing.sorcery,.because.the.spirits |
| bae0 | 20 77 65 20 64 65 61 6c 20 77 69 74 68 20 61 72 65 20 63 6f 6e 76 65 6e 69 65 6e 74 6c 79 0a 63 | .we.deal.with.are.conveniently.c |
| bb00 | 6f 6e 74 61 69 6e 65 64 20 69 6e 20 61 20 73 65 63 75 72 65 20 77 61 79 2e 20 20 52 65 61 6c 2d | ontained.in.a.secure.way...Real- |
| bb20 | 77 6f 72 6c 64 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 20 68 6f 77 65 76 65 72 2c 20 72 65 71 75 | world.programming,.however,.requ |
| bb40 | 69 72 65 73 0a 63 61 72 65 2c 20 65 78 70 65 72 74 69 73 65 2c 20 61 6e 64 20 77 69 73 64 6f 6d | ires.care,.expertise,.and.wisdom |
| bb60 | 2e 20 20 41 20 73 6d 61 6c 6c 20 62 75 67 20 69 6e 20 61 20 63 6f 6d 70 75 74 65 72 2d 61 69 64 | ...A.small.bug.in.a.computer-aid |
| bb80 | 65 64 20 64 65 73 69 67 6e 0a 70 72 6f 67 72 61 6d 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 | ed.design.program,.for.example,. |
| bba0 | 63 61 6e 20 6c 65 61 64 20 74 6f 20 74 68 65 20 63 61 74 61 73 74 72 6f 70 68 69 63 20 63 6f 6c | can.lead.to.the.catastrophic.col |
| bbc0 | 6c 61 70 73 65 20 6f 66 20 61 6e 0a 61 69 72 70 6c 61 6e 65 20 6f 72 20 61 20 64 61 6d 20 6f 72 | lapse.of.an.airplane.or.a.dam.or |
| bbe0 | 20 74 68 65 20 73 65 6c 66 2d 64 65 73 74 72 75 63 74 69 6f 6e 20 6f 66 20 61 6e 20 69 6e 64 75 | .the.self-destruction.of.an.indu |
| bc00 | 73 74 72 69 61 6c 20 72 6f 62 6f 74 2e 0a 0a 20 20 20 4d 61 73 74 65 72 20 73 6f 66 74 77 61 72 | strial.robot......Master.softwar |
| bc20 | 65 20 65 6e 67 69 6e 65 65 72 73 20 68 61 76 65 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 | e.engineers.have.the.ability.to. |
| bc40 | 6f 72 67 61 6e 69 7a 65 20 70 72 6f 67 72 61 6d 73 20 73 6f 0a 74 68 61 74 20 74 68 65 79 20 63 | organize.programs.so.that.they.c |
| bc60 | 61 6e 20 62 65 20 72 65 61 73 6f 6e 61 62 6c 79 20 73 75 72 65 20 74 68 61 74 20 74 68 65 20 72 | an.be.reasonably.sure.that.the.r |
| bc80 | 65 73 75 6c 74 69 6e 67 20 70 72 6f 63 65 73 73 65 73 20 77 69 6c 6c 0a 70 65 72 66 6f 72 6d 20 | esulting.processes.will.perform. |
| bca0 | 74 68 65 20 74 61 73 6b 73 20 69 6e 74 65 6e 64 65 64 2e 20 20 54 68 65 79 20 63 61 6e 20 76 69 | the.tasks.intended...They.can.vi |
| bcc0 | 73 75 61 6c 69 7a 65 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 69 72 0a 73 79 | sualize.the.behavior.of.their.sy |
| bce0 | 73 74 65 6d 73 20 69 6e 20 61 64 76 61 6e 63 65 2e 20 20 54 68 65 79 20 6b 6e 6f 77 20 68 6f 77 | stems.in.advance...They.know.how |
| bd00 | 20 74 6f 20 73 74 72 75 63 74 75 72 65 20 70 72 6f 67 72 61 6d 73 20 73 6f 20 74 68 61 74 0a 75 | .to.structure.programs.so.that.u |
| bd20 | 6e 61 6e 74 69 63 69 70 61 74 65 64 20 70 72 6f 62 6c 65 6d 73 20 64 6f 20 6e 6f 74 20 6c 65 61 | nanticipated.problems.do.not.lea |
| bd40 | 64 20 74 6f 20 63 61 74 61 73 74 72 6f 70 68 69 63 20 63 6f 6e 73 65 71 75 65 6e 63 65 73 2c 20 | d.to.catastrophic.consequences,. |
| bd60 | 61 6e 64 0a 77 68 65 6e 20 70 72 6f 62 6c 65 6d 73 20 64 6f 20 61 72 69 73 65 2c 20 74 68 65 79 | and.when.problems.do.arise,.they |
| bd80 | 20 63 61 6e 20 22 64 65 62 75 67 22 20 74 68 65 69 72 20 70 72 6f 67 72 61 6d 73 2e 20 20 57 65 | .can."debug".their.programs...We |
| bda0 | 6c 6c 2d 64 65 73 69 67 6e 65 64 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 73 79 73 74 65 6d | ll-designed.computational.system |
| bdc0 | 73 2c 20 6c 69 6b 65 20 77 65 6c 6c 2d 64 65 73 69 67 6e 65 64 20 61 75 74 6f 6d 6f 62 69 6c 65 | s,.like.well-designed.automobile |
| bde0 | 73 20 6f 72 20 6e 75 63 6c 65 61 72 0a 72 65 61 63 74 6f 72 73 2c 20 61 72 65 20 64 65 73 69 67 | s.or.nuclear.reactors,.are.desig |
| be00 | 6e 65 64 20 69 6e 20 61 20 6d 6f 64 75 6c 61 72 20 6d 61 6e 6e 65 72 2c 20 73 6f 20 74 68 61 74 | ned.in.a.modular.manner,.so.that |
| be20 | 20 74 68 65 20 70 61 72 74 73 20 63 61 6e 20 62 65 0a 63 6f 6e 73 74 72 75 63 74 65 64 2c 20 72 | .the.parts.can.be.constructed,.r |
| be40 | 65 70 6c 61 63 65 64 2c 20 61 6e 64 20 64 65 62 75 67 67 65 64 20 73 65 70 61 72 61 74 65 6c 79 | eplaced,.and.debugged.separately |
| be60 | 2e 0a 0a 50 72 6f 67 72 61 6d 6d 69 6e 67 20 69 6e 20 4c 69 73 70 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e | ...Programming.in.Lisp.......... |
| be80 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 20 6e 65 65 64 20 61 6e 20 61 70 70 72 6f 70 72 69 61 | ............We.need.an.appropria |
| bea0 | 74 65 20 6c 61 6e 67 75 61 67 65 20 66 6f 72 20 64 65 73 63 72 69 62 69 6e 67 20 70 72 6f 63 65 | te.language.for.describing.proce |
| bec0 | 73 73 65 73 2c 20 61 6e 64 20 77 65 20 77 69 6c 6c 0a 75 73 65 20 66 6f 72 20 74 68 69 73 20 70 | sses,.and.we.will.use.for.this.p |
| bee0 | 75 72 70 6f 73 65 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 | urpose.the.programming.language. |
| bf00 | 4c 69 73 70 2e 20 20 4a 75 73 74 20 61 73 20 6f 75 72 0a 65 76 65 72 79 64 61 79 20 74 68 6f 75 | Lisp...Just.as.our.everyday.thou |
| bf20 | 67 68 74 73 20 61 72 65 20 75 73 75 61 6c 6c 79 20 65 78 70 72 65 73 73 65 64 20 69 6e 20 6f 75 | ghts.are.usually.expressed.in.ou |
| bf40 | 72 20 6e 61 74 75 72 61 6c 20 6c 61 6e 67 75 61 67 65 20 28 73 75 63 68 0a 61 73 20 45 6e 67 6c | r.natural.language.(such.as.Engl |
| bf60 | 69 73 68 2c 20 46 72 65 6e 63 68 2c 20 6f 72 20 4a 61 70 61 6e 65 73 65 29 2c 20 61 6e 64 20 64 | ish,.French,.or.Japanese),.and.d |
| bf80 | 65 73 63 72 69 70 74 69 6f 6e 73 20 6f 66 20 71 75 61 6e 74 69 74 61 74 69 76 65 0a 70 68 65 6e | escriptions.of.quantitative.phen |
| bfa0 | 6f 6d 65 6e 61 20 61 72 65 20 65 78 70 72 65 73 73 65 64 20 77 69 74 68 20 6d 61 74 68 65 6d 61 | omena.are.expressed.with.mathema |
| bfc0 | 74 69 63 61 6c 20 6e 6f 74 61 74 69 6f 6e 73 2c 20 6f 75 72 20 70 72 6f 63 65 64 75 72 61 6c 0a | tical.notations,.our.procedural. |
| bfe0 | 74 68 6f 75 67 68 74 73 20 77 69 6c 6c 20 62 65 20 65 78 70 72 65 73 73 65 64 20 69 6e 20 4c 69 | thoughts.will.be.expressed.in.Li |
| c000 | 73 70 2e 20 20 4c 69 73 70 20 77 61 73 20 69 6e 76 65 6e 74 65 64 20 69 6e 20 74 68 65 20 6c 61 | sp...Lisp.was.invented.in.the.la |
| c020 | 74 65 0a 31 39 35 30 73 20 61 73 20 61 20 66 6f 72 6d 61 6c 69 73 6d 20 66 6f 72 20 72 65 61 73 | te.1950s.as.a.formalism.for.reas |
| c040 | 6f 6e 69 6e 67 20 61 62 6f 75 74 20 74 68 65 20 75 73 65 20 6f 66 20 63 65 72 74 61 69 6e 20 6b | oning.about.the.use.of.certain.k |
| c060 | 69 6e 64 73 20 6f 66 0a 6c 6f 67 69 63 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 63 61 6c | inds.of.logical.expressions,.cal |
| c080 | 6c 65 64 20 22 72 65 63 75 72 73 69 6f 6e 20 65 71 75 61 74 69 6f 6e 73 22 2c 20 61 73 20 61 20 | led."recursion.equations",.as.a. |
| c0a0 | 6d 6f 64 65 6c 20 66 6f 72 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 54 68 65 20 6c 61 6e 67 | model.for.computation...The.lang |
| c0c0 | 75 61 67 65 20 77 61 73 20 63 6f 6e 63 65 69 76 65 64 20 62 79 20 4a 6f 68 6e 20 4d 63 43 61 72 | uage.was.conceived.by.John.McCar |
| c0e0 | 74 68 79 20 61 6e 64 20 69 73 20 62 61 73 65 64 0a 6f 6e 20 68 69 73 20 70 61 70 65 72 20 22 52 | thy.and.is.based.on.his.paper."R |
| c100 | 65 63 75 72 73 69 76 65 20 46 75 6e 63 74 69 6f 6e 73 20 6f 66 20 53 79 6d 62 6f 6c 69 63 20 45 | ecursive.Functions.of.Symbolic.E |
| c120 | 78 70 72 65 73 73 69 6f 6e 73 20 61 6e 64 20 54 68 65 69 72 0a 43 6f 6d 70 75 74 61 74 69 6f 6e | xpressions.and.Their.Computation |
| c140 | 20 62 79 20 4d 61 63 68 69 6e 65 22 20 28 4d 63 43 61 72 74 68 79 20 31 39 36 30 29 2e 0a 0a 20 | .by.Machine".(McCarthy.1960).... |
| c160 | 20 20 44 65 73 70 69 74 65 20 69 74 73 20 69 6e 63 65 70 74 69 6f 6e 20 61 73 20 61 20 6d 61 74 | ..Despite.its.inception.as.a.mat |
| c180 | 68 65 6d 61 74 69 63 61 6c 20 66 6f 72 6d 61 6c 69 73 6d 2c 20 4c 69 73 70 20 69 73 20 61 0a 70 | hematical.formalism,.Lisp.is.a.p |
| c1a0 | 72 61 63 74 69 63 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 20 20 | ractical.programming.language... |
| c1c0 | 41 20 4c 69 73 70 20 22 69 6e 74 65 72 70 72 65 74 65 72 22 20 69 73 20 61 20 6d 61 63 68 69 6e | A.Lisp."interpreter".is.a.machin |
| c1e0 | 65 20 74 68 61 74 0a 63 61 72 72 69 65 73 20 6f 75 74 20 70 72 6f 63 65 73 73 65 73 20 64 65 73 | e.that.carries.out.processes.des |
| c200 | 63 72 69 62 65 64 20 69 6e 20 74 68 65 20 4c 69 73 70 20 6c 61 6e 67 75 61 67 65 2e 20 20 54 68 | cribed.in.the.Lisp.language...Th |
| c220 | 65 20 66 69 72 73 74 20 4c 69 73 70 0a 69 6e 74 65 72 70 72 65 74 65 72 20 77 61 73 20 69 6d 70 | e.first.Lisp.interpreter.was.imp |
| c240 | 6c 65 6d 65 6e 74 65 64 20 62 79 20 4d 63 43 61 72 74 68 79 20 77 69 74 68 20 74 68 65 20 68 65 | lemented.by.McCarthy.with.the.he |
| c260 | 6c 70 20 6f 66 20 63 6f 6c 6c 65 61 67 75 65 73 20 61 6e 64 0a 73 74 75 64 65 6e 74 73 20 69 6e | lp.of.colleagues.and.students.in |
| c280 | 20 74 68 65 20 41 72 74 69 66 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 20 47 72 6f | .the.Artificial.Intelligence.Gro |
| c2a0 | 75 70 20 6f 66 20 74 68 65 20 4d 49 54 20 52 65 73 65 61 72 63 68 0a 4c 61 62 6f 72 61 74 6f 72 | up.of.the.MIT.Research.Laborator |
| c2c0 | 79 20 6f 66 20 45 6c 65 63 74 72 6f 6e 69 63 73 20 61 6e 64 20 69 6e 20 74 68 65 20 4d 49 54 20 | y.of.Electronics.and.in.the.MIT. |
| c2e0 | 43 6f 6d 70 75 74 61 74 69 6f 6e 20 43 65 6e 74 65 72 2e 28 31 29 20 20 4c 69 73 70 2c 0a 77 68 | Computation.Center.(1)..Lisp,.wh |
| c300 | 6f 73 65 20 6e 61 6d 65 20 69 73 20 61 6e 20 61 63 72 6f 6e 79 6d 20 66 6f 72 20 4c 49 53 74 20 | ose.name.is.an.acronym.for.LISt. |
| c320 | 50 72 6f 63 65 73 73 69 6e 67 2c 20 77 61 73 20 64 65 73 69 67 6e 65 64 20 74 6f 20 70 72 6f 76 | Processing,.was.designed.to.prov |
| c340 | 69 64 65 0a 73 79 6d 62 6f 6c 2d 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 63 61 70 61 62 69 6c 69 | ide.symbol-manipulating.capabili |
| c360 | 74 69 65 73 20 66 6f 72 20 61 74 74 61 63 6b 69 6e 67 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 70 | ties.for.attacking.programming.p |
| c380 | 72 6f 62 6c 65 6d 73 0a 73 75 63 68 20 61 73 20 74 68 65 20 73 79 6d 62 6f 6c 69 63 20 64 69 66 | roblems.such.as.the.symbolic.dif |
| c3a0 | 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 61 6e 64 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 6f 66 20 | ferentiation.and.integration.of. |
| c3c0 | 61 6c 67 65 62 72 61 69 63 0a 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 49 74 20 69 6e 63 6c 75 | algebraic.expressions...It.inclu |
| c3e0 | 64 65 64 20 66 6f 72 20 74 68 69 73 20 70 75 72 70 6f 73 65 20 6e 65 77 20 64 61 74 61 20 6f 62 | ded.for.this.purpose.new.data.ob |
| c400 | 6a 65 63 74 73 20 6b 6e 6f 77 6e 20 61 73 0a 61 74 6f 6d 73 20 61 6e 64 20 6c 69 73 74 73 2c 20 | jects.known.as.atoms.and.lists,. |
| c420 | 77 68 69 63 68 20 6d 6f 73 74 20 73 74 72 69 6b 69 6e 67 6c 79 20 73 65 74 20 69 74 20 61 70 61 | which.most.strikingly.set.it.apa |
| c440 | 72 74 20 66 72 6f 6d 20 61 6c 6c 20 6f 74 68 65 72 0a 6c 61 6e 67 75 61 67 65 73 20 6f 66 20 74 | rt.from.all.other.languages.of.t |
| c460 | 68 65 20 70 65 72 69 6f 64 2e 0a 0a 20 20 20 4c 69 73 70 20 77 61 73 20 6e 6f 74 20 74 68 65 20 | he.period......Lisp.was.not.the. |
| c480 | 70 72 6f 64 75 63 74 20 6f 66 20 61 20 63 6f 6e 63 65 72 74 65 64 20 64 65 73 69 67 6e 20 65 66 | product.of.a.concerted.design.ef |
| c4a0 | 66 6f 72 74 2e 20 20 49 6e 73 74 65 61 64 2c 20 69 74 0a 65 76 6f 6c 76 65 64 20 69 6e 66 6f 72 | fort...Instead,.it.evolved.infor |
| c4c0 | 6d 61 6c 6c 79 20 69 6e 20 61 6e 20 65 78 70 65 72 69 6d 65 6e 74 61 6c 20 6d 61 6e 6e 65 72 20 | mally.in.an.experimental.manner. |
| c4e0 | 69 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 20 75 73 65 72 73 27 0a 6e 65 65 64 73 20 61 6e 64 20 | in.response.to.users'.needs.and. |
| c500 | 74 6f 20 70 72 61 67 6d 61 74 69 63 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 63 6f 6e 73 | to.pragmatic.implementation.cons |
| c520 | 69 64 65 72 61 74 69 6f 6e 73 2e 20 20 4c 69 73 70 27 73 20 69 6e 66 6f 72 6d 61 6c 0a 65 76 6f | iderations...Lisp's.informal.evo |
| c540 | 6c 75 74 69 6f 6e 20 68 61 73 20 63 6f 6e 74 69 6e 75 65 64 20 74 68 72 6f 75 67 68 20 74 68 65 | lution.has.continued.through.the |
| c560 | 20 79 65 61 72 73 2c 20 61 6e 64 20 74 68 65 20 63 6f 6d 6d 75 6e 69 74 79 20 6f 66 20 4c 69 73 | .years,.and.the.community.of.Lis |
| c580 | 70 0a 75 73 65 72 73 20 68 61 73 20 74 72 61 64 69 74 69 6f 6e 61 6c 6c 79 20 72 65 73 69 73 74 | p.users.has.traditionally.resist |
| c5a0 | 65 64 20 61 74 74 65 6d 70 74 73 20 74 6f 20 70 72 6f 6d 75 6c 67 61 74 65 20 61 6e 79 20 22 6f | ed.attempts.to.promulgate.any."o |
| c5c0 | 66 66 69 63 69 61 6c 22 0a 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 6c 61 6e 67 75 | fficial".definition.of.the.langu |
| c5e0 | 61 67 65 2e 20 20 54 68 69 73 20 65 76 6f 6c 75 74 69 6f 6e 2c 20 74 6f 67 65 74 68 65 72 20 77 | age...This.evolution,.together.w |
| c600 | 69 74 68 20 74 68 65 0a 66 6c 65 78 69 62 69 6c 69 74 79 20 61 6e 64 20 65 6c 65 67 61 6e 63 65 | ith.the.flexibility.and.elegance |
| c620 | 20 6f 66 20 74 68 65 20 69 6e 69 74 69 61 6c 20 63 6f 6e 63 65 70 74 69 6f 6e 2c 20 68 61 73 20 | .of.the.initial.conception,.has. |
| c640 | 65 6e 61 62 6c 65 64 20 4c 69 73 70 2c 0a 77 68 69 63 68 20 69 73 20 74 68 65 20 73 65 63 6f 6e | enabled.Lisp,.which.is.the.secon |
| c660 | 64 20 6f 6c 64 65 73 74 20 6c 61 6e 67 75 61 67 65 20 69 6e 20 77 69 64 65 73 70 72 65 61 64 20 | d.oldest.language.in.widespread. |
| c680 | 75 73 65 20 74 6f 64 61 79 20 28 6f 6e 6c 79 0a 46 6f 72 74 72 61 6e 20 69 73 20 6f 6c 64 65 72 | use.today.(only.Fortran.is.older |
| c6a0 | 29 2c 20 74 6f 20 63 6f 6e 74 69 6e 75 61 6c 6c 79 20 61 64 61 70 74 20 74 6f 20 65 6e 63 6f 6d | ),.to.continually.adapt.to.encom |
| c6c0 | 70 61 73 73 20 74 68 65 20 6d 6f 73 74 20 6d 6f 64 65 72 6e 0a 69 64 65 61 73 20 61 62 6f 75 74 | pass.the.most.modern.ideas.about |
| c6e0 | 20 70 72 6f 67 72 61 6d 20 64 65 73 69 67 6e 2e 20 20 54 68 75 73 2c 20 4c 69 73 70 20 69 73 20 | .program.design...Thus,.Lisp.is. |
| c700 | 62 79 20 6e 6f 77 20 61 20 66 61 6d 69 6c 79 20 6f 66 20 64 69 61 6c 65 63 74 73 2c 0a 77 68 69 | by.now.a.family.of.dialects,.whi |
| c720 | 63 68 2c 20 77 68 69 6c 65 20 73 68 61 72 69 6e 67 20 6d 6f 73 74 20 6f 66 20 74 68 65 20 6f 72 | ch,.while.sharing.most.of.the.or |
| c740 | 69 67 69 6e 61 6c 20 66 65 61 74 75 72 65 73 2c 20 6d 61 79 20 64 69 66 66 65 72 20 66 72 6f 6d | iginal.features,.may.differ.from |
| c760 | 20 6f 6e 65 0a 61 6e 6f 74 68 65 72 20 69 6e 20 73 69 67 6e 69 66 69 63 61 6e 74 20 77 61 79 73 | .one.another.in.significant.ways |
| c780 | 2e 20 20 54 68 65 20 64 69 61 6c 65 63 74 20 6f 66 20 4c 69 73 70 20 75 73 65 64 20 69 6e 20 74 | ...The.dialect.of.Lisp.used.in.t |
| c7a0 | 68 69 73 20 62 6f 6f 6b 20 69 73 0a 63 61 6c 6c 65 64 20 53 63 68 65 6d 65 2e 28 32 29 0a 0a 20 | his.book.is.called.Scheme.(2)... |
| c7c0 | 20 20 42 65 63 61 75 73 65 20 6f 66 20 69 74 73 20 65 78 70 65 72 69 6d 65 6e 74 61 6c 20 63 68 | ..Because.of.its.experimental.ch |
| c7e0 | 61 72 61 63 74 65 72 20 61 6e 64 20 69 74 73 20 65 6d 70 68 61 73 69 73 20 6f 6e 20 73 79 6d 62 | aracter.and.its.emphasis.on.symb |
| c800 | 6f 6c 0a 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 2c 20 4c 69 73 70 20 77 61 73 20 61 74 20 66 69 72 | ol.manipulation,.Lisp.was.at.fir |
| c820 | 73 74 20 76 65 72 79 20 69 6e 65 66 66 69 63 69 65 6e 74 20 66 6f 72 20 6e 75 6d 65 72 69 63 61 | st.very.inefficient.for.numerica |
| c840 | 6c 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 73 2c 20 61 74 20 6c 65 61 73 74 20 69 6e 20 63 6f 6d 70 | l.computations,.at.least.in.comp |
| c860 | 61 72 69 73 6f 6e 20 77 69 74 68 20 46 6f 72 74 72 61 6e 2e 20 20 4f 76 65 72 20 74 68 65 20 79 | arison.with.Fortran...Over.the.y |
| c880 | 65 61 72 73 2c 0a 68 6f 77 65 76 65 72 2c 20 4c 69 73 70 20 63 6f 6d 70 69 6c 65 72 73 20 68 61 | ears,.however,.Lisp.compilers.ha |
| c8a0 | 76 65 20 62 65 65 6e 20 64 65 76 65 6c 6f 70 65 64 20 74 68 61 74 20 74 72 61 6e 73 6c 61 74 65 | ve.been.developed.that.translate |
| c8c0 | 20 70 72 6f 67 72 61 6d 73 0a 69 6e 74 6f 20 6d 61 63 68 69 6e 65 20 63 6f 64 65 20 74 68 61 74 | .programs.into.machine.code.that |
| c8e0 | 20 63 61 6e 20 70 65 72 66 6f 72 6d 20 6e 75 6d 65 72 69 63 61 6c 20 63 6f 6d 70 75 74 61 74 69 | .can.perform.numerical.computati |
| c900 | 6f 6e 73 20 72 65 61 73 6f 6e 61 62 6c 79 0a 65 66 66 69 63 69 65 6e 74 6c 79 2e 20 20 41 6e 64 | ons.reasonably.efficiently...And |
| c920 | 20 66 6f 72 20 73 70 65 63 69 61 6c 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 2c 20 4c 69 73 70 20 | .for.special.applications,.Lisp. |
| c940 | 68 61 73 20 62 65 65 6e 20 75 73 65 64 20 77 69 74 68 0a 67 72 65 61 74 20 65 66 66 65 63 74 69 | has.been.used.with.great.effecti |
| c960 | 76 65 6e 65 73 73 2e 28 33 29 20 20 41 6c 74 68 6f 75 67 68 20 4c 69 73 70 20 68 61 73 20 6e 6f | veness.(3)..Although.Lisp.has.no |
| c980 | 74 20 79 65 74 20 6f 76 65 72 63 6f 6d 65 20 69 74 73 20 6f 6c 64 0a 72 65 70 75 74 61 74 69 6f | t.yet.overcome.its.old.reputatio |
| c9a0 | 6e 20 61 73 20 68 6f 70 65 6c 65 73 73 6c 79 20 69 6e 65 66 66 69 63 69 65 6e 74 2c 20 4c 69 73 | n.as.hopelessly.inefficient,.Lis |
| c9c0 | 70 20 69 73 20 6e 6f 77 20 75 73 65 64 20 69 6e 20 6d 61 6e 79 0a 61 70 70 6c 69 63 61 74 69 6f | p.is.now.used.in.many.applicatio |
| c9e0 | 6e 73 20 77 68 65 72 65 20 65 66 66 69 63 69 65 6e 63 79 20 69 73 20 6e 6f 74 20 74 68 65 20 63 | ns.where.efficiency.is.not.the.c |
| ca00 | 65 6e 74 72 61 6c 20 63 6f 6e 63 65 72 6e 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 4c 69 | entral.concern...For.example,.Li |
| ca20 | 73 70 20 68 61 73 20 62 65 63 6f 6d 65 20 61 20 6c 61 6e 67 75 61 67 65 20 6f 66 20 63 68 6f 69 | sp.has.become.a.language.of.choi |
| ca40 | 63 65 20 66 6f 72 20 6f 70 65 72 61 74 69 6e 67 2d 73 79 73 74 65 6d 20 73 68 65 6c 6c 0a 6c 61 | ce.for.operating-system.shell.la |
| ca60 | 6e 67 75 61 67 65 73 20 61 6e 64 20 66 6f 72 20 65 78 74 65 6e 73 69 6f 6e 20 6c 61 6e 67 75 61 | nguages.and.for.extension.langua |
| ca80 | 67 65 73 20 66 6f 72 20 65 64 69 74 6f 72 73 20 61 6e 64 20 63 6f 6d 70 75 74 65 72 2d 61 69 64 | ges.for.editors.and.computer-aid |
| caa0 | 65 64 0a 64 65 73 69 67 6e 20 73 79 73 74 65 6d 73 2e 0a 0a 20 20 20 49 66 20 4c 69 73 70 20 69 | ed.design.systems......If.Lisp.i |
| cac0 | 73 20 6e 6f 74 20 61 20 6d 61 69 6e 73 74 72 65 61 6d 20 6c 61 6e 67 75 61 67 65 2c 20 77 68 79 | s.not.a.mainstream.language,.why |
| cae0 | 20 61 72 65 20 77 65 20 75 73 69 6e 67 20 69 74 20 61 73 20 74 68 65 0a 66 72 61 6d 65 77 6f 72 | .are.we.using.it.as.the.framewor |
| cb00 | 6b 20 66 6f 72 20 6f 75 72 20 64 69 73 63 75 73 73 69 6f 6e 20 6f 66 20 70 72 6f 67 72 61 6d 6d | k.for.our.discussion.of.programm |
| cb20 | 69 6e 67 3f 20 20 42 65 63 61 75 73 65 20 74 68 65 20 6c 61 6e 67 75 61 67 65 0a 70 6f 73 73 65 | ing?..Because.the.language.posse |
| cb40 | 73 73 65 73 20 75 6e 69 71 75 65 20 66 65 61 74 75 72 65 73 20 74 68 61 74 20 6d 61 6b 65 20 69 | sses.unique.features.that.make.i |
| cb60 | 74 20 61 6e 20 65 78 63 65 6c 6c 65 6e 74 20 6d 65 64 69 75 6d 20 66 6f 72 20 73 74 75 64 79 69 | t.an.excellent.medium.for.studyi |
| cb80 | 6e 67 0a 69 6d 70 6f 72 74 61 6e 74 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 63 6f 6e 73 74 72 75 | ng.important.programming.constru |
| cba0 | 63 74 73 20 61 6e 64 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 61 6e 64 20 66 6f 72 20 | cts.and.data.structures.and.for. |
| cbc0 | 72 65 6c 61 74 69 6e 67 0a 74 68 65 6d 20 74 6f 20 74 68 65 20 6c 69 6e 67 75 69 73 74 69 63 20 | relating.them.to.the.linguistic. |
| cbe0 | 66 65 61 74 75 72 65 73 20 74 68 61 74 20 73 75 70 70 6f 72 74 20 74 68 65 6d 2e 20 20 54 68 65 | features.that.support.them...The |
| cc00 | 20 6d 6f 73 74 0a 73 69 67 6e 69 66 69 63 61 6e 74 20 6f 66 20 74 68 65 73 65 20 66 65 61 74 75 | .most.significant.of.these.featu |
| cc20 | 72 65 73 20 69 73 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 4c 69 73 70 20 64 65 73 63 72 69 | res.is.the.fact.that.Lisp.descri |
| cc40 | 70 74 69 6f 6e 73 20 6f 66 0a 70 72 6f 63 65 73 73 65 73 2c 20 63 61 6c 6c 65 64 20 22 70 72 6f | ptions.of.processes,.called."pro |
| cc60 | 63 65 64 75 72 65 73 22 2c 20 63 61 6e 20 74 68 65 6d 73 65 6c 76 65 73 20 62 65 20 72 65 70 72 | cedures",.can.themselves.be.repr |
| cc80 | 65 73 65 6e 74 65 64 20 61 6e 64 0a 6d 61 6e 69 70 75 6c 61 74 65 64 20 61 73 20 4c 69 73 70 20 | esented.and.manipulated.as.Lisp. |
| cca0 | 64 61 74 61 2e 20 20 54 68 65 20 69 6d 70 6f 72 74 61 6e 63 65 20 6f 66 20 74 68 69 73 20 69 73 | data...The.importance.of.this.is |
| ccc0 | 20 74 68 61 74 20 74 68 65 72 65 20 61 72 65 0a 70 6f 77 65 72 66 75 6c 20 70 72 6f 67 72 61 6d | .that.there.are.powerful.program |
| cce0 | 2d 64 65 73 69 67 6e 20 74 65 63 68 6e 69 71 75 65 73 20 74 68 61 74 20 72 65 6c 79 20 6f 6e 20 | -design.techniques.that.rely.on. |
| cd00 | 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 62 6c 75 72 20 74 68 65 0a 74 72 61 64 69 74 69 6f | the.ability.to.blur.the.traditio |
| cd20 | 6e 61 6c 20 64 69 73 74 69 6e 63 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 22 70 61 73 73 69 76 65 | nal.distinction.between."passive |
| cd40 | 22 20 64 61 74 61 20 61 6e 64 20 22 61 63 74 69 76 65 22 20 70 72 6f 63 65 73 73 65 73 2e 0a 41 | ".data.and."active".processes..A |
| cd60 | 73 20 77 65 20 73 68 61 6c 6c 20 64 69 73 63 6f 76 65 72 2c 20 4c 69 73 70 27 73 20 66 6c 65 78 | s.we.shall.discover,.Lisp's.flex |
| cd80 | 69 62 69 6c 69 74 79 20 69 6e 20 68 61 6e 64 6c 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 61 | ibility.in.handling.procedures.a |
| cda0 | 73 20 64 61 74 61 0a 6d 61 6b 65 73 20 69 74 20 6f 6e 65 20 6f 66 20 74 68 65 20 6d 6f 73 74 20 | s.data.makes.it.one.of.the.most. |
| cdc0 | 63 6f 6e 76 65 6e 69 65 6e 74 20 6c 61 6e 67 75 61 67 65 73 20 69 6e 20 65 78 69 73 74 65 6e 63 | convenient.languages.in.existenc |
| cde0 | 65 20 66 6f 72 0a 65 78 70 6c 6f 72 69 6e 67 20 74 68 65 73 65 20 74 65 63 68 6e 69 71 75 65 73 | e.for.exploring.these.techniques |
| ce00 | 2e 20 20 54 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 70 72 6f 63 | ...The.ability.to.represent.proc |
| ce20 | 65 64 75 72 65 73 20 61 73 0a 64 61 74 61 20 61 6c 73 6f 20 6d 61 6b 65 73 20 4c 69 73 70 20 61 | edures.as.data.also.makes.Lisp.a |
| ce40 | 6e 20 65 78 63 65 6c 6c 65 6e 74 20 6c 61 6e 67 75 61 67 65 20 66 6f 72 20 77 72 69 74 69 6e 67 | n.excellent.language.for.writing |
| ce60 | 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 0a 6d 75 73 74 20 6d 61 6e 69 70 75 6c 61 74 65 20 6f | .programs.that.must.manipulate.o |
| ce80 | 74 68 65 72 20 70 72 6f 67 72 61 6d 73 20 61 73 20 64 61 74 61 2c 20 73 75 63 68 20 61 73 20 74 | ther.programs.as.data,.such.as.t |
| cea0 | 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 73 20 61 6e 64 0a 63 6f 6d 70 69 6c 65 72 73 20 74 68 | he.interpreters.and.compilers.th |
| cec0 | 61 74 20 73 75 70 70 6f 72 74 20 63 6f 6d 70 75 74 65 72 20 6c 61 6e 67 75 61 67 65 73 2e 20 20 | at.support.computer.languages... |
| cee0 | 41 62 6f 76 65 20 61 6e 64 20 62 65 79 6f 6e 64 20 74 68 65 73 65 0a 63 6f 6e 73 69 64 65 72 61 | Above.and.beyond.these.considera |
| cf00 | 74 69 6f 6e 73 2c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 6e 20 4c 69 73 70 20 69 73 20 67 72 | tions,.programming.in.Lisp.is.gr |
| cf20 | 65 61 74 20 66 75 6e 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 31 2d 31 3a 3a 20 20 20 20 20 20 | eat.fun...*.Menu:..*.1-1::...... |
| cf40 | 20 20 20 20 20 20 20 20 54 68 65 20 45 6c 65 6d 65 6e 74 73 20 6f 66 20 50 72 6f 67 72 61 6d 6d | ........The.Elements.of.Programm |
| cf60 | 69 6e 67 0a 2a 20 31 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 72 6f 63 65 64 75 | ing.*.1-2::..............Procedu |
| cf80 | 72 65 73 20 61 6e 64 20 74 68 65 20 50 72 6f 63 65 73 73 65 73 20 54 68 65 79 20 47 65 6e 65 72 | res.and.the.Processes.They.Gener |
| cfa0 | 61 74 65 0a 2a 20 31 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 46 6f 72 6d 75 6c 61 | ate.*.1-3::..............Formula |
| cfc0 | 74 69 6e 67 20 41 62 73 74 72 61 63 74 69 6f 6e 73 20 77 69 74 68 20 48 69 67 68 65 72 2d 4f 72 | ting.Abstractions.with.Higher-Or |
| cfe0 | 64 65 72 20 50 72 6f 63 65 64 75 72 65 73 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f | der.Procedures.....----------.Fo |
| d000 | 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 65 20 60 | otnotes.----------.....(1).The.` |
| d020 | 4c 69 73 70 20 31 20 50 72 6f 67 72 61 6d 6d 65 72 27 73 20 4d 61 6e 75 61 6c 27 20 61 70 70 65 | Lisp.1.Programmer's.Manual'.appe |
| d040 | 61 72 65 64 20 69 6e 20 31 39 36 30 2c 20 61 6e 64 20 74 68 65 20 60 4c 69 73 70 0a 31 2e 35 20 | ared.in.1960,.and.the.`Lisp.1.5. |
| d060 | 50 72 6f 67 72 61 6d 6d 65 72 27 73 20 4d 61 6e 75 61 6c 27 20 28 4d 63 43 61 72 74 68 79 20 31 | Programmer's.Manual'.(McCarthy.1 |
| d080 | 39 36 35 29 20 77 61 73 20 70 75 62 6c 69 73 68 65 64 20 69 6e 20 31 39 36 32 2e 20 20 54 68 65 | 965).was.published.in.1962...The |
| d0a0 | 0a 65 61 72 6c 79 20 68 69 73 74 6f 72 79 20 6f 66 20 4c 69 73 70 20 69 73 20 64 65 73 63 72 69 | .early.history.of.Lisp.is.descri |
| d0c0 | 62 65 64 20 69 6e 20 4d 63 43 61 72 74 68 79 20 31 39 37 38 2e 0a 0a 20 20 20 28 32 29 20 54 68 | bed.in.McCarthy.1978......(2).Th |
| d0e0 | 65 20 74 77 6f 20 64 69 61 6c 65 63 74 73 20 69 6e 20 77 68 69 63 68 20 6d 6f 73 74 20 6d 61 6a | e.two.dialects.in.which.most.maj |
| d100 | 6f 72 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 73 20 6f 66 20 74 68 65 20 31 39 37 30 73 0a 77 65 | or.Lisp.programs.of.the.1970s.we |
| d120 | 72 65 20 77 72 69 74 74 65 6e 20 61 72 65 20 4d 61 63 4c 69 73 70 20 28 4d 6f 6f 6e 20 31 39 37 | re.written.are.MacLisp.(Moon.197 |
| d140 | 38 3b 20 50 69 74 6d 61 6e 20 31 39 38 33 29 2c 20 64 65 76 65 6c 6f 70 65 64 20 61 74 20 74 68 | 8;.Pitman.1983),.developed.at.th |
| d160 | 65 20 4d 49 54 0a 50 72 6f 6a 65 63 74 20 4d 41 43 2c 20 61 6e 64 20 49 6e 74 65 72 6c 69 73 70 | e.MIT.Project.MAC,.and.Interlisp |
| d180 | 20 28 54 65 69 74 65 6c 6d 61 6e 20 31 39 37 34 29 2c 20 64 65 76 65 6c 6f 70 65 64 20 61 74 20 | .(Teitelman.1974),.developed.at. |
| d1a0 | 42 6f 6c 74 20 42 65 72 61 6e 65 6b 0a 61 6e 64 20 4e 65 77 6d 61 6e 20 49 6e 63 2e 20 61 6e 64 | Bolt.Beranek.and.Newman.Inc..and |
| d1c0 | 20 74 68 65 20 58 65 72 6f 78 20 50 61 6c 6f 20 41 6c 74 6f 20 52 65 73 65 61 72 63 68 20 43 65 | .the.Xerox.Palo.Alto.Research.Ce |
| d1e0 | 6e 74 65 72 2e 20 20 50 6f 72 74 61 62 6c 65 0a 53 74 61 6e 64 61 72 64 20 4c 69 73 70 20 28 48 | nter...Portable.Standard.Lisp.(H |
| d200 | 65 61 72 6e 20 31 39 36 39 3b 20 47 72 69 73 73 20 31 39 38 31 29 20 77 61 73 20 61 20 4c 69 73 | earn.1969;.Griss.1981).was.a.Lis |
| d220 | 70 20 64 69 61 6c 65 63 74 20 64 65 73 69 67 6e 65 64 20 74 6f 0a 62 65 20 65 61 73 69 6c 79 20 | p.dialect.designed.to.be.easily. |
| d240 | 70 6f 72 74 61 62 6c 65 20 62 65 74 77 65 65 6e 20 64 69 66 66 65 72 65 6e 74 20 6d 61 63 68 69 | portable.between.different.machi |
| d260 | 6e 65 73 2e 20 20 4d 61 63 4c 69 73 70 20 73 70 61 77 6e 65 64 20 61 0a 6e 75 6d 62 65 72 20 6f | nes...MacLisp.spawned.a.number.o |
| d280 | 66 20 73 75 62 64 69 61 6c 65 63 74 73 2c 20 73 75 63 68 20 61 73 20 46 72 61 6e 7a 20 4c 69 73 | f.subdialects,.such.as.Franz.Lis |
| d2a0 | 70 2c 20 77 68 69 63 68 20 77 61 73 20 64 65 76 65 6c 6f 70 65 64 20 61 74 20 74 68 65 0a 55 6e | p,.which.was.developed.at.the.Un |
| d2c0 | 69 76 65 72 73 69 74 79 20 6f 66 20 43 61 6c 69 66 6f 72 6e 69 61 20 61 74 20 42 65 72 6b 65 6c | iversity.of.California.at.Berkel |
| d2e0 | 65 79 2c 20 61 6e 64 20 5a 65 74 61 6c 69 73 70 20 28 4d 6f 6f 6e 20 31 39 38 31 29 2c 20 77 68 | ey,.and.Zetalisp.(Moon.1981),.wh |
| d300 | 69 63 68 0a 77 61 73 20 62 61 73 65 64 20 6f 6e 20 61 20 73 70 65 63 69 61 6c 2d 70 75 72 70 6f | ich.was.based.on.a.special-purpo |
| d320 | 73 65 20 70 72 6f 63 65 73 73 6f 72 20 64 65 73 69 67 6e 65 64 20 61 74 20 74 68 65 20 4d 49 54 | se.processor.designed.at.the.MIT |
| d340 | 20 41 72 74 69 66 69 63 69 61 6c 0a 49 6e 74 65 6c 6c 69 67 65 6e 63 65 20 4c 61 62 6f 72 61 74 | .Artificial.Intelligence.Laborat |
| d360 | 6f 72 79 20 74 6f 20 72 75 6e 20 4c 69 73 70 20 76 65 72 79 20 65 66 66 69 63 69 65 6e 74 6c 79 | ory.to.run.Lisp.very.efficiently |
| d380 | 2e 20 20 54 68 65 20 4c 69 73 70 20 64 69 61 6c 65 63 74 0a 75 73 65 64 20 69 6e 20 74 68 69 73 | ...The.Lisp.dialect.used.in.this |
| d3a0 | 20 62 6f 6f 6b 2c 20 63 61 6c 6c 65 64 20 53 63 68 65 6d 65 20 28 53 74 65 65 6c 65 20 31 39 37 | .book,.called.Scheme.(Steele.197 |
| d3c0 | 35 29 2c 20 77 61 73 20 69 6e 76 65 6e 74 65 64 20 69 6e 20 31 39 37 35 20 62 79 0a 47 75 79 20 | 5),.was.invented.in.1975.by.Guy. |
| d3e0 | 4c 65 77 69 73 20 53 74 65 65 6c 65 20 4a 72 2e 20 61 6e 64 20 47 65 72 61 6c 64 20 4a 61 79 20 | Lewis.Steele.Jr..and.Gerald.Jay. |
| d400 | 53 75 73 73 6d 61 6e 20 6f 66 20 74 68 65 20 4d 49 54 20 41 72 74 69 66 69 63 69 61 6c 0a 49 6e | Sussman.of.the.MIT.Artificial.In |
| d420 | 74 65 6c 6c 69 67 65 6e 63 65 20 4c 61 62 6f 72 61 74 6f 72 79 20 61 6e 64 20 6c 61 74 65 72 20 | telligence.Laboratory.and.later. |
| d440 | 72 65 69 6d 70 6c 65 6d 65 6e 74 65 64 20 66 6f 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 61 6c 20 | reimplemented.for.instructional. |
| d460 | 75 73 65 0a 61 74 20 4d 49 54 2e 20 20 53 63 68 65 6d 65 20 62 65 63 61 6d 65 20 61 6e 20 49 45 | use.at.MIT...Scheme.became.an.IE |
| d480 | 45 45 20 73 74 61 6e 64 61 72 64 20 69 6e 20 31 39 39 30 20 28 49 45 45 45 20 31 39 39 30 29 2e | EE.standard.in.1990.(IEEE.1990). |
| d4a0 | 20 20 54 68 65 0a 43 6f 6d 6d 6f 6e 20 4c 69 73 70 20 64 69 61 6c 65 63 74 20 28 53 74 65 65 6c | ..The.Common.Lisp.dialect.(Steel |
| d4c0 | 65 20 31 39 38 32 2c 20 53 74 65 65 6c 65 20 31 39 39 30 29 20 77 61 73 20 64 65 76 65 6c 6f 70 | e.1982,.Steele.1990).was.develop |
| d4e0 | 65 64 20 62 79 20 74 68 65 0a 4c 69 73 70 20 63 6f 6d 6d 75 6e 69 74 79 20 74 6f 20 63 6f 6d 62 | ed.by.the.Lisp.community.to.comb |
| d500 | 69 6e 65 20 66 65 61 74 75 72 65 73 20 66 72 6f 6d 20 74 68 65 20 65 61 72 6c 69 65 72 20 4c 69 | ine.features.from.the.earlier.Li |
| d520 | 73 70 20 64 69 61 6c 65 63 74 73 20 74 6f 0a 6d 61 6b 65 20 61 6e 20 69 6e 64 75 73 74 72 69 61 | sp.dialects.to.make.an.industria |
| d540 | 6c 20 73 74 61 6e 64 61 72 64 20 66 6f 72 20 4c 69 73 70 2e 20 20 43 6f 6d 6d 6f 6e 20 4c 69 73 | l.standard.for.Lisp...Common.Lis |
| d560 | 70 20 62 65 63 61 6d 65 20 61 6e 20 41 4e 53 49 0a 73 74 61 6e 64 61 72 64 20 69 6e 20 31 39 39 | p.became.an.ANSI.standard.in.199 |
| d580 | 34 20 28 41 4e 53 49 20 31 39 39 34 29 2e 0a 0a 20 20 20 28 33 29 20 4f 6e 65 20 73 75 63 68 20 | 4.(ANSI.1994)......(3).One.such. |
| d5a0 | 73 70 65 63 69 61 6c 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 77 61 73 20 61 20 62 72 65 61 6b 74 | special.application.was.a.breakt |
| d5c0 | 68 72 6f 75 67 68 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 6f 66 0a 73 63 69 65 6e 74 69 66 69 63 | hrough.computation.of.scientific |
| d5e0 | 20 69 6d 70 6f 72 74 61 6e 63 65 2d 2d 61 6e 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 6f 66 20 74 | .importance--an.integration.of.t |
| d600 | 68 65 20 6d 6f 74 69 6f 6e 20 6f 66 20 74 68 65 20 53 6f 6c 61 72 20 53 79 73 74 65 6d 0a 74 68 | he.motion.of.the.Solar.System.th |
| d620 | 61 74 20 65 78 74 65 6e 64 65 64 20 70 72 65 76 69 6f 75 73 20 72 65 73 75 6c 74 73 20 62 79 20 | at.extended.previous.results.by. |
| d640 | 6e 65 61 72 6c 79 20 74 77 6f 20 6f 72 64 65 72 73 20 6f 66 20 6d 61 67 6e 69 74 75 64 65 2c 20 | nearly.two.orders.of.magnitude,. |
| d660 | 61 6e 64 0a 64 65 6d 6f 6e 73 74 72 61 74 65 64 20 74 68 61 74 20 74 68 65 20 64 79 6e 61 6d 69 | and.demonstrated.that.the.dynami |
| d680 | 63 73 20 6f 66 20 74 68 65 20 53 6f 6c 61 72 20 53 79 73 74 65 6d 20 69 73 20 63 68 61 6f 74 69 | cs.of.the.Solar.System.is.chaoti |
| d6a0 | 63 2e 20 20 54 68 69 73 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 20 77 61 73 20 6d 61 64 65 20 70 6f | c...This.computation.was.made.po |
| d6c0 | 73 73 69 62 6c 65 20 62 79 20 6e 65 77 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 61 6c 67 6f 72 69 | ssible.by.new.integration.algori |
| d6e0 | 74 68 6d 73 2c 20 61 0a 73 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 63 6f 6d 70 69 6c 65 72 | thms,.a.special-purpose.compiler |
| d700 | 2c 20 61 6e 64 20 61 20 73 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 63 6f 6d 70 75 74 65 72 | ,.and.a.special-purpose.computer |
| d720 | 20 61 6c 6c 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 77 69 74 68 20 74 68 65 20 61 69 64 20 6f 66 | .all.implemented.with.the.aid.of |
| d740 | 20 73 6f 66 74 77 61 72 65 20 74 6f 6f 6c 73 20 77 72 69 74 74 65 6e 20 69 6e 20 4c 69 73 70 20 | .software.tools.written.in.Lisp. |
| d760 | 28 41 62 65 6c 73 6f 6e 20 65 74 0a 61 6c 2e 20 31 39 39 32 3b 20 53 75 73 73 6d 61 6e 20 61 6e | (Abelson.et.al..1992;.Sussman.an |
| d780 | 64 20 57 69 73 64 6f 6d 20 31 39 39 32 29 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e | d.Wisdom.1992).....File:.sicp.in |
| d7a0 | 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 31 2c 20 20 4e 65 78 74 3a 20 31 2d 32 2c 20 20 50 72 65 | fo,..Node:.1-1,..Next:.1-2,..Pre |
| d7c0 | 76 3a 20 43 68 61 70 74 65 72 20 31 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 31 0a 0a 31 2e | v:.Chapter.1,..Up:.Chapter.1..1. |
| d7e0 | 31 20 54 68 65 20 45 6c 65 6d 65 6e 74 73 20 6f 66 20 50 72 6f 67 72 61 6d 6d 69 6e 67 0a 3d 3d | 1.The.Elements.of.Programming.== |
| d800 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 41 | =============================..A |
| d820 | 20 70 6f 77 65 72 66 75 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 69 | .powerful.programming.language.i |
| d840 | 73 20 6d 6f 72 65 20 74 68 61 6e 20 6a 75 73 74 20 61 20 6d 65 61 6e 73 20 66 6f 72 0a 69 6e 73 | s.more.than.just.a.means.for.ins |
| d860 | 74 72 75 63 74 69 6e 67 20 61 20 63 6f 6d 70 75 74 65 72 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 | tructing.a.computer.to.perform.t |
| d880 | 61 73 6b 73 2e 20 20 54 68 65 20 6c 61 6e 67 75 61 67 65 20 61 6c 73 6f 20 73 65 72 76 65 73 20 | asks...The.language.also.serves. |
| d8a0 | 61 73 20 61 0a 66 72 61 6d 65 77 6f 72 6b 20 77 69 74 68 69 6e 20 77 68 69 63 68 20 77 65 20 6f | as.a.framework.within.which.we.o |
| d8c0 | 72 67 61 6e 69 7a 65 20 6f 75 72 20 69 64 65 61 73 20 61 62 6f 75 74 20 70 72 6f 63 65 73 73 65 | rganize.our.ideas.about.processe |
| d8e0 | 73 2e 20 20 54 68 75 73 2c 0a 77 68 65 6e 20 77 65 20 64 65 73 63 72 69 62 65 20 61 20 6c 61 6e | s...Thus,.when.we.describe.a.lan |
| d900 | 67 75 61 67 65 2c 20 77 65 20 73 68 6f 75 6c 64 20 70 61 79 20 70 61 72 74 69 63 75 6c 61 72 20 | guage,.we.should.pay.particular. |
| d920 | 61 74 74 65 6e 74 69 6f 6e 20 74 6f 20 74 68 65 0a 6d 65 61 6e 73 20 74 68 61 74 20 74 68 65 20 | attention.to.the.means.that.the. |
| d940 | 6c 61 6e 67 75 61 67 65 20 70 72 6f 76 69 64 65 73 20 66 6f 72 20 63 6f 6d 62 69 6e 69 6e 67 20 | language.provides.for.combining. |
| d960 | 73 69 6d 70 6c 65 20 69 64 65 61 73 20 74 6f 20 66 6f 72 6d 0a 6d 6f 72 65 20 63 6f 6d 70 6c 65 | simple.ideas.to.form.more.comple |
| d980 | 78 20 69 64 65 61 73 2e 20 20 45 76 65 72 79 20 70 6f 77 65 72 66 75 6c 20 6c 61 6e 67 75 61 67 | x.ideas...Every.powerful.languag |
| d9a0 | 65 20 68 61 73 20 74 68 72 65 65 20 6d 65 63 68 61 6e 69 73 6d 73 20 66 6f 72 0a 61 63 63 6f 6d | e.has.three.mechanisms.for.accom |
| d9c0 | 70 6c 69 73 68 69 6e 67 20 74 68 69 73 3a 0a 0a 22 70 72 69 6d 69 74 69 76 65 20 65 78 70 72 65 | plishing.this:.."primitive.expre |
| d9e0 | 73 73 69 6f 6e 73 22 0a 20 20 20 20 20 77 68 69 63 68 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 | ssions"......which.represent.the |
| da00 | 20 73 69 6d 70 6c 65 73 74 20 65 6e 74 69 74 69 65 73 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 | .simplest.entities.the.language. |
| da20 | 69 73 20 63 6f 6e 63 65 72 6e 65 64 0a 20 20 20 20 20 77 69 74 68 2c 0a 0a 22 6d 65 61 6e 73 20 | is.concerned......with,.."means. |
| da40 | 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 22 0a 20 20 20 20 20 62 79 20 77 68 69 63 68 20 63 6f | of.combination"......by.which.co |
| da60 | 6d 70 6f 75 6e 64 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 20 62 75 69 6c 74 20 66 72 6f 6d 20 73 | mpound.elements.are.built.from.s |
| da80 | 69 6d 70 6c 65 72 20 6f 6e 65 73 2c 20 61 6e 64 0a 0a 22 6d 65 61 6e 73 20 6f 66 20 61 62 73 74 | impler.ones,.and.."means.of.abst |
| daa0 | 72 61 63 74 69 6f 6e 22 0a 20 20 20 20 20 62 79 20 77 68 69 63 68 20 63 6f 6d 70 6f 75 6e 64 20 | raction"......by.which.compound. |
| dac0 | 65 6c 65 6d 65 6e 74 73 20 63 61 6e 20 62 65 20 6e 61 6d 65 64 20 61 6e 64 20 6d 61 6e 69 70 75 | elements.can.be.named.and.manipu |
| dae0 | 6c 61 74 65 64 20 61 73 20 75 6e 69 74 73 2e 0a 0a 0a 20 20 20 49 6e 20 70 72 6f 67 72 61 6d 6d | lated.as.units.......In.programm |
| db00 | 69 6e 67 2c 20 77 65 20 64 65 61 6c 20 77 69 74 68 20 74 77 6f 20 6b 69 6e 64 73 20 6f 66 20 65 | ing,.we.deal.with.two.kinds.of.e |
| db20 | 6c 65 6d 65 6e 74 73 3a 20 70 72 6f 63 65 64 75 72 65 73 20 61 6e 64 0a 64 61 74 61 2e 20 28 4c | lements:.procedures.and.data..(L |
| db40 | 61 74 65 72 20 77 65 20 77 69 6c 6c 20 64 69 73 63 6f 76 65 72 20 74 68 61 74 20 74 68 65 79 20 | ater.we.will.discover.that.they. |
| db60 | 61 72 65 20 72 65 61 6c 6c 79 20 6e 6f 74 20 73 6f 20 64 69 73 74 69 6e 63 74 2e 29 0a 49 6e 66 | are.really.not.so.distinct.).Inf |
| db80 | 6f 72 6d 61 6c 6c 79 2c 20 64 61 74 61 20 69 73 20 22 73 74 75 66 66 22 20 74 68 61 74 20 77 65 | ormally,.data.is."stuff".that.we |
| dba0 | 20 77 61 6e 74 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 2c 20 61 6e 64 20 70 72 6f 63 65 64 75 | .want.to.manipulate,.and.procedu |
| dbc0 | 72 65 73 0a 61 72 65 20 64 65 73 63 72 69 70 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 72 75 6c 65 | res.are.descriptions.of.the.rule |
| dbe0 | 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 74 68 65 20 64 61 74 61 2e 20 20 54 68 | s.for.manipulating.the.data...Th |
| dc00 | 75 73 2c 20 61 6e 79 0a 70 6f 77 65 72 66 75 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e | us,.any.powerful.programming.lan |
| dc20 | 67 75 61 67 65 20 73 68 6f 75 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 64 65 73 63 72 69 62 65 | guage.should.be.able.to.describe |
| dc40 | 20 70 72 69 6d 69 74 69 76 65 20 64 61 74 61 0a 61 6e 64 20 70 72 69 6d 69 74 69 76 65 20 70 72 | .primitive.data.and.primitive.pr |
| dc60 | 6f 63 65 64 75 72 65 73 20 61 6e 64 20 73 68 6f 75 6c 64 20 68 61 76 65 20 6d 65 74 68 6f 64 73 | ocedures.and.should.have.methods |
| dc80 | 20 66 6f 72 20 63 6f 6d 62 69 6e 69 6e 67 20 61 6e 64 0a 61 62 73 74 72 61 63 74 69 6e 67 20 70 | .for.combining.and.abstracting.p |
| dca0 | 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 64 61 74 61 2e 0a 0a 20 20 20 49 6e 20 74 68 69 73 20 | rocedures.and.data......In.this. |
| dcc0 | 63 68 61 70 74 65 72 20 77 65 20 77 69 6c 6c 20 64 65 61 6c 20 6f 6e 6c 79 20 77 69 74 68 20 73 | chapter.we.will.deal.only.with.s |
| dce0 | 69 6d 70 6c 65 20 6e 75 6d 65 72 69 63 61 6c 20 64 61 74 61 20 73 6f 20 74 68 61 74 0a 77 65 20 | imple.numerical.data.so.that.we. |
| dd00 | 63 61 6e 20 66 6f 63 75 73 20 6f 6e 20 74 68 65 20 72 75 6c 65 73 20 66 6f 72 20 62 75 69 6c 64 | can.focus.on.the.rules.for.build |
| dd20 | 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 2e 28 31 29 20 49 6e 20 6c 61 74 65 72 20 63 68 61 70 | ing.procedures.(1).In.later.chap |
| dd40 | 74 65 72 73 0a 77 65 20 77 69 6c 6c 20 73 65 65 20 74 68 61 74 20 74 68 65 73 65 20 73 61 6d 65 | ters.we.will.see.that.these.same |
| dd60 | 20 72 75 6c 65 73 20 61 6c 6c 6f 77 20 75 73 20 74 6f 20 62 75 69 6c 64 20 70 72 6f 63 65 64 75 | .rules.allow.us.to.build.procedu |
| dd80 | 72 65 73 20 74 6f 0a 6d 61 6e 69 70 75 6c 61 74 65 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 | res.to.manipulate.compound.data. |
| dda0 | 61 73 20 77 65 6c 6c 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 31 2d 31 2d 31 3a 3a 20 20 20 20 | as.well...*.Menu:..*.1-1-1::.... |
| ddc0 | 20 20 20 20 20 20 20 20 45 78 70 72 65 73 73 69 6f 6e 73 0a 2a 20 31 2d 31 2d 32 3a 3a 20 20 20 | ........Expressions.*.1-1-2::... |
| dde0 | 20 20 20 20 20 20 20 20 20 4e 61 6d 69 6e 67 20 61 6e 64 20 74 68 65 20 45 6e 76 69 72 6f 6e 6d | .........Naming.and.the.Environm |
| de00 | 65 6e 74 0a 2a 20 31 2d 31 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 76 61 6c 75 61 74 | ent.*.1-1-3::............Evaluat |
| de20 | 69 6e 67 20 43 6f 6d 62 69 6e 61 74 69 6f 6e 73 0a 2a 20 31 2d 31 2d 34 3a 3a 20 20 20 20 20 20 | ing.Combinations.*.1-1-4::...... |
| de40 | 20 20 20 20 20 20 43 6f 6d 70 6f 75 6e 64 20 50 72 6f 63 65 64 75 72 65 73 0a 2a 20 31 2d 31 2d | ......Compound.Procedures.*.1-1- |
| de60 | 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 53 75 62 73 74 69 74 75 74 69 6f 6e 20 | 5::............The.Substitution. |
| de80 | 4d 6f 64 65 6c 20 66 6f 72 20 50 72 6f 63 65 64 75 72 65 20 41 70 70 6c 69 63 61 74 69 6f 6e 0a | Model.for.Procedure.Application. |
| dea0 | 2a 20 31 2d 31 2d 36 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6e 64 69 74 69 6f 6e 61 6c | *.1-1-6::............Conditional |
| dec0 | 20 45 78 70 72 65 73 73 69 6f 6e 73 20 61 6e 64 20 50 72 65 64 69 63 61 74 65 73 0a 2a 20 31 2d | .Expressions.and.Predicates.*.1- |
| dee0 | 31 2d 37 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 53 71 75 61 72 65 | 1-7::............Example:.Square |
| df00 | 20 52 6f 6f 74 73 20 62 79 20 4e 65 77 74 6f 6e 27 73 20 4d 65 74 68 6f 64 0a 2a 20 31 2d 31 2d | .Roots.by.Newton's.Method.*.1-1- |
| df20 | 38 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 50 72 6f 63 65 64 75 72 65 73 20 61 73 20 42 6c 61 | 8::............Procedures.as.Bla |
| df40 | 63 6b 2d 42 6f 78 20 41 62 73 74 72 61 63 74 69 6f 6e 73 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d | ck-Box.Abstractions.....-------- |
| df60 | 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 | --.Footnotes.----------.....(1). |
| df80 | 54 68 65 20 63 68 61 72 61 63 74 65 72 69 7a 61 74 69 6f 6e 20 6f 66 20 6e 75 6d 62 65 72 73 20 | The.characterization.of.numbers. |
| dfa0 | 61 73 20 22 73 69 6d 70 6c 65 20 64 61 74 61 22 20 69 73 20 61 20 62 61 72 65 66 61 63 65 64 0a | as."simple.data".is.a.barefaced. |
| dfc0 | 62 6c 75 66 66 2e 20 20 49 6e 20 66 61 63 74 2c 20 74 68 65 20 74 72 65 61 74 6d 65 6e 74 20 6f | bluff...In.fact,.the.treatment.o |
| dfe0 | 66 20 6e 75 6d 62 65 72 73 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 74 72 69 63 6b 69 65 73 | f.numbers.is.one.of.the.trickies |
| e000 | 74 20 61 6e 64 0a 6d 6f 73 74 20 63 6f 6e 66 75 73 69 6e 67 20 61 73 70 65 63 74 73 20 6f 66 20 | t.and.most.confusing.aspects.of. |
| e020 | 61 6e 79 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 20 20 53 6f 6d 65 20 | any.programming.language...Some. |
| e040 | 74 79 70 69 63 61 6c 0a 69 73 73 75 65 73 20 69 6e 76 6f 6c 76 65 64 20 61 72 65 20 74 68 65 73 | typical.issues.involved.are.thes |
| e060 | 65 3a 20 53 6f 6d 65 20 63 6f 6d 70 75 74 65 72 20 73 79 73 74 65 6d 73 20 64 69 73 74 69 6e 67 | e:.Some.computer.systems.disting |
| e080 | 75 69 73 68 20 22 69 6e 74 65 67 65 72 73 22 2c 0a 73 75 63 68 20 61 73 20 32 2c 20 66 72 6f 6d | uish."integers",.such.as.2,.from |
| e0a0 | 20 22 72 65 61 6c 20 6e 75 6d 62 65 72 73 22 2c 20 73 75 63 68 20 61 73 20 32 2e 37 31 2e 20 20 | ."real.numbers",.such.as.2.71... |
| e0c0 | 49 73 20 74 68 65 20 72 65 61 6c 20 6e 75 6d 62 65 72 20 32 2e 30 30 0a 64 69 66 66 65 72 65 6e | Is.the.real.number.2.00.differen |
| e0e0 | 74 20 66 72 6f 6d 20 74 68 65 20 69 6e 74 65 67 65 72 20 32 3f 20 20 41 72 65 20 74 68 65 20 61 | t.from.the.integer.2?..Are.the.a |
| e100 | 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 75 73 65 64 20 66 6f 72 0a 69 6e | rithmetic.operations.used.for.in |
| e120 | 74 65 67 65 72 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e | tegers.the.same.as.the.operation |
| e140 | 73 20 75 73 65 64 20 66 6f 72 20 72 65 61 6c 20 6e 75 6d 62 65 72 73 3f 20 20 44 6f 65 73 20 36 | s.used.for.real.numbers?..Does.6 |
| e160 | 0a 64 69 76 69 64 65 64 20 62 79 20 32 20 70 72 6f 64 75 63 65 20 33 2c 20 6f 72 20 33 2e 30 3f | .divided.by.2.produce.3,.or.3.0? |
| e180 | 20 20 48 6f 77 20 6c 61 72 67 65 20 61 20 6e 75 6d 62 65 72 20 63 61 6e 20 77 65 20 72 65 70 72 | ..How.large.a.number.can.we.repr |
| e1a0 | 65 73 65 6e 74 3f 0a 48 6f 77 20 6d 61 6e 79 20 64 65 63 69 6d 61 6c 20 70 6c 61 63 65 73 20 6f | esent?.How.many.decimal.places.o |
| e1c0 | 66 20 61 63 63 75 72 61 63 79 20 63 61 6e 20 77 65 20 72 65 70 72 65 73 65 6e 74 3f 20 20 49 73 | f.accuracy.can.we.represent?..Is |
| e1e0 | 20 74 68 65 20 72 61 6e 67 65 20 6f 66 0a 69 6e 74 65 67 65 72 73 20 74 68 65 20 73 61 6d 65 20 | .the.range.of.integers.the.same. |
| e200 | 61 73 20 74 68 65 20 72 61 6e 67 65 20 6f 66 20 72 65 61 6c 20 6e 75 6d 62 65 72 73 3f 20 20 41 | as.the.range.of.real.numbers?..A |
| e220 | 62 6f 76 65 20 61 6e 64 20 62 65 79 6f 6e 64 20 74 68 65 73 65 0a 71 75 65 73 74 69 6f 6e 73 2c | bove.and.beyond.these.questions, |
| e240 | 20 6f 66 20 63 6f 75 72 73 65 2c 20 6c 69 65 73 20 61 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 | .of.course,.lies.a.collection.of |
| e260 | 20 69 73 73 75 65 73 20 63 6f 6e 63 65 72 6e 69 6e 67 20 72 6f 75 6e 64 6f 66 66 0a 61 6e 64 20 | .issues.concerning.roundoff.and. |
| e280 | 74 72 75 6e 63 61 74 69 6f 6e 20 65 72 72 6f 72 73 20 2d 20 74 68 65 20 65 6e 74 69 72 65 20 73 | truncation.errors.-.the.entire.s |
| e2a0 | 63 69 65 6e 63 65 20 6f 66 20 6e 75 6d 65 72 69 63 61 6c 20 61 6e 61 6c 79 73 69 73 2e 0a 53 69 | cience.of.numerical.analysis..Si |
| e2c0 | 6e 63 65 20 6f 75 72 20 66 6f 63 75 73 20 69 6e 20 74 68 69 73 20 62 6f 6f 6b 20 69 73 20 6f 6e | nce.our.focus.in.this.book.is.on |
| e2e0 | 20 6c 61 72 67 65 2d 73 63 61 6c 65 20 70 72 6f 67 72 61 6d 20 64 65 73 69 67 6e 20 72 61 74 68 | .large-scale.program.design.rath |
| e300 | 65 72 0a 74 68 61 6e 20 6f 6e 20 6e 75 6d 65 72 69 63 61 6c 20 74 65 63 68 6e 69 71 75 65 73 2c | er.than.on.numerical.techniques, |
| e320 | 20 77 65 20 61 72 65 20 67 6f 69 6e 67 20 74 6f 20 69 67 6e 6f 72 65 20 74 68 65 73 65 20 70 72 | .we.are.going.to.ignore.these.pr |
| e340 | 6f 62 6c 65 6d 73 2e 0a 54 68 65 20 6e 75 6d 65 72 69 63 61 6c 20 65 78 61 6d 70 6c 65 73 20 69 | oblems..The.numerical.examples.i |
| e360 | 6e 20 74 68 69 73 20 63 68 61 70 74 65 72 20 77 69 6c 6c 20 65 78 68 69 62 69 74 20 74 68 65 20 | n.this.chapter.will.exhibit.the. |
| e380 | 75 73 75 61 6c 20 72 6f 75 6e 64 6f 66 66 0a 62 65 68 61 76 69 6f 72 20 74 68 61 74 20 6f 6e 65 | usual.roundoff.behavior.that.one |
| e3a0 | 20 6f 62 73 65 72 76 65 73 20 77 68 65 6e 20 75 73 69 6e 67 20 61 72 69 74 68 6d 65 74 69 63 20 | .observes.when.using.arithmetic. |
| e3c0 | 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 0a 70 72 65 73 65 72 76 65 20 61 20 6c 69 6d 69 74 | operations.that.preserve.a.limit |
| e3e0 | 65 64 20 6e 75 6d 62 65 72 20 6f 66 20 64 65 63 69 6d 61 6c 20 70 6c 61 63 65 73 20 6f 66 20 61 | ed.number.of.decimal.places.of.a |
| e400 | 63 63 75 72 61 63 79 20 69 6e 20 6e 6f 6e 69 6e 74 65 67 65 72 0a 6f 70 65 72 61 74 69 6f 6e 73 | ccuracy.in.noninteger.operations |
| e420 | 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 31 | .....File:.sicp.info,..Node:.1-1 |
| e440 | 2d 31 2c 20 20 4e 65 78 74 3a 20 31 2d 31 2d 32 2c 20 20 50 72 65 76 3a 20 31 2d 31 2c 20 20 55 | -1,..Next:.1-1-2,..Prev:.1-1,..U |
| e460 | 70 3a 20 31 2d 31 0a 0a 31 2e 31 2e 31 20 45 78 70 72 65 73 73 69 6f 6e 73 0a 2d 2d 2d 2d 2d 2d | p:.1-1..1.1.1.Expressions.------ |
| e480 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 4f 6e 65 20 65 61 73 79 20 77 61 79 20 74 6f 20 67 65 74 | -----------..One.easy.way.to.get |
| e4a0 | 20 73 74 61 72 74 65 64 20 61 74 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 74 6f 20 65 78 | .started.at.programming.is.to.ex |
| e4c0 | 61 6d 69 6e 65 20 73 6f 6d 65 20 74 79 70 69 63 61 6c 0a 69 6e 74 65 72 61 63 74 69 6f 6e 73 20 | amine.some.typical.interactions. |
| e4e0 | 77 69 74 68 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 66 6f 72 20 74 68 65 20 53 63 68 65 | with.an.interpreter.for.the.Sche |
| e500 | 6d 65 20 64 69 61 6c 65 63 74 20 6f 66 20 4c 69 73 70 2e 0a 49 6d 61 67 69 6e 65 20 74 68 61 74 | me.dialect.of.Lisp..Imagine.that |
| e520 | 20 79 6f 75 20 61 72 65 20 73 69 74 74 69 6e 67 20 61 74 20 61 20 63 6f 6d 70 75 74 65 72 20 74 | .you.are.sitting.at.a.computer.t |
| e540 | 65 72 6d 69 6e 61 6c 2e 20 20 59 6f 75 20 74 79 70 65 20 61 6e 20 22 65 78 70 72 65 73 73 69 6f | erminal...You.type.an."expressio |
| e560 | 6e 22 2c 0a 61 6e 64 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 72 65 73 70 6f 6e 64 73 | n",.and.the.interpreter.responds |
| e580 | 20 62 79 20 64 69 73 70 6c 61 79 69 6e 67 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 69 74 73 | .by.displaying.the.result.of.its |
| e5a0 | 20 22 65 76 61 6c 75 61 74 69 6e 67 22 0a 74 68 61 74 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 0a | ."evaluating".that.expression... |
| e5c0 | 20 20 20 4f 6e 65 20 6b 69 6e 64 20 6f 66 20 70 72 69 6d 69 74 69 76 65 20 65 78 70 72 65 73 73 | ...One.kind.of.primitive.express |
| e5e0 | 69 6f 6e 20 79 6f 75 20 6d 69 67 68 74 20 74 79 70 65 20 69 73 20 61 20 6e 75 6d 62 65 72 2e 20 | ion.you.might.type.is.a.number.. |
| e600 | 20 28 4d 6f 72 65 0a 70 72 65 63 69 73 65 6c 79 2c 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e | .(More.precisely,.the.expression |
| e620 | 20 74 68 61 74 20 79 6f 75 20 74 79 70 65 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 74 68 65 20 6e | .that.you.type.consists.of.the.n |
| e640 | 75 6d 65 72 61 6c 73 20 74 68 61 74 0a 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 6e 75 6d 62 65 | umerals.that.represent.the.numbe |
| e660 | 72 20 69 6e 20 62 61 73 65 20 31 30 2e 29 20 20 49 66 20 79 6f 75 20 70 72 65 73 65 6e 74 20 4c | r.in.base.10.)..If.you.present.L |
| e680 | 69 73 70 20 77 69 74 68 20 61 20 6e 75 6d 62 65 72 0a 0a 20 20 20 20 20 34 38 36 0a 0a 74 68 65 | isp.with.a.number.......486..the |
| e6a0 | 20 69 6e 74 65 72 70 72 65 74 65 72 20 77 69 6c 6c 20 72 65 73 70 6f 6e 64 20 62 79 20 70 72 69 | .interpreter.will.respond.by.pri |
| e6c0 | 6e 74 69 6e 67 20 28 31 29 0a 0a 20 20 20 20 20 34 38 36 0a 0a 20 20 20 45 78 70 72 65 73 73 69 | nting.(1).......486.....Expressi |
| e6e0 | 6f 6e 73 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 6e 75 6d 62 65 72 73 20 6d 61 79 20 62 65 20 | ons.representing.numbers.may.be. |
| e700 | 63 6f 6d 62 69 6e 65 64 20 77 69 74 68 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 0a 72 65 70 72 | combined.with.an.expression.repr |
| e720 | 65 73 65 6e 74 69 6e 67 20 61 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 28 | esenting.a.primitive.procedure.( |
| e740 | 73 75 63 68 20 61 73 20 60 2b 27 20 6f 72 20 60 2a 27 29 20 74 6f 20 66 6f 72 6d 20 61 0a 63 6f | such.as.`+'.or.`*').to.form.a.co |
| e760 | 6d 70 6f 75 6e 64 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 72 65 70 72 65 73 65 6e 74 | mpound.expression.that.represent |
| e780 | 73 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 | s.the.application.of.the.procedu |
| e7a0 | 72 65 20 74 6f 0a 74 68 6f 73 65 20 6e 75 6d 62 65 72 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c | re.to.those.numbers...For.exampl |
| e7c0 | 65 3a 0a 0a 20 20 20 20 20 28 2b 20 31 33 37 20 33 34 39 29 0a 20 20 20 20 20 34 38 36 0a 0a 20 | e:.......(+.137.349)......486... |
| e7e0 | 20 20 20 20 28 2d 20 31 30 30 30 20 33 33 34 29 0a 20 20 20 20 20 36 36 36 0a 0a 20 20 20 20 20 | ....(-.1000.334)......666....... |
| e800 | 28 2a 20 35 20 39 39 29 0a 20 20 20 20 20 34 39 35 0a 0a 20 20 20 20 20 28 2f 20 31 30 20 35 29 | (*.5.99)......495.......(/.10.5) |
| e820 | 0a 20 20 20 20 20 32 0a 0a 20 20 20 20 20 28 2b 20 32 2e 37 20 31 30 29 0a 20 20 20 20 20 31 32 | ......2.......(+.2.7.10)......12 |
| e840 | 2e 37 0a 0a 20 20 20 45 78 70 72 65 73 73 69 6f 6e 73 20 73 75 63 68 20 61 73 20 74 68 65 73 65 | .7.....Expressions.such.as.these |
| e860 | 2c 20 66 6f 72 6d 65 64 20 62 79 20 64 65 6c 69 6d 69 74 69 6e 67 20 61 20 6c 69 73 74 20 6f 66 | ,.formed.by.delimiting.a.list.of |
| e880 | 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 77 69 74 68 69 6e 20 70 61 72 65 6e 74 68 65 73 65 73 20 | .expressions.within.parentheses. |
| e8a0 | 69 6e 20 6f 72 64 65 72 20 74 6f 20 64 65 6e 6f 74 65 20 70 72 6f 63 65 64 75 72 65 0a 61 70 70 | in.order.to.denote.procedure.app |
| e8c0 | 6c 69 63 61 74 69 6f 6e 2c 20 61 72 65 20 63 61 6c 6c 65 64 20 22 63 6f 6d 62 69 6e 61 74 69 6f | lication,.are.called."combinatio |
| e8e0 | 6e 73 22 2e 20 20 54 68 65 20 6c 65 66 74 6d 6f 73 74 20 65 6c 65 6d 65 6e 74 20 69 6e 20 74 68 | ns"...The.leftmost.element.in.th |
| e900 | 65 0a 6c 69 73 74 20 69 73 20 63 61 6c 6c 65 64 20 74 68 65 20 22 6f 70 65 72 61 74 6f 72 22 2c | e.list.is.called.the."operator", |
| e920 | 20 61 6e 64 20 74 68 65 20 6f 74 68 65 72 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 20 63 61 6c 6c | .and.the.other.elements.are.call |
| e940 | 65 64 20 22 6f 70 65 72 61 6e 64 73 22 2e 0a 54 68 65 20 76 61 6c 75 65 20 6f 66 20 61 20 63 6f | ed."operands"..The.value.of.a.co |
| e960 | 6d 62 69 6e 61 74 69 6f 6e 20 69 73 20 6f 62 74 61 69 6e 65 64 20 62 79 20 61 70 70 6c 79 69 6e | mbination.is.obtained.by.applyin |
| e980 | 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 | g.the.procedure.specified.by.the |
| e9a0 | 20 6f 70 65 72 61 74 6f 72 20 74 6f 20 74 68 65 20 22 61 72 67 75 6d 65 6e 74 73 22 20 74 68 61 | .operator.to.the."arguments".tha |
| e9c0 | 74 20 61 72 65 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 0a 6f 70 65 72 61 6e 64 73 | t.are.the.values.of.the.operands |
| e9e0 | 2e 0a 0a 20 20 20 54 68 65 20 63 6f 6e 76 65 6e 74 69 6f 6e 20 6f 66 20 70 6c 61 63 69 6e 67 20 | ......The.convention.of.placing. |
| ea00 | 74 68 65 20 6f 70 65 72 61 74 6f 72 20 74 6f 20 74 68 65 20 6c 65 66 74 20 6f 66 20 74 68 65 20 | the.operator.to.the.left.of.the. |
| ea20 | 6f 70 65 72 61 6e 64 73 0a 69 73 20 6b 6e 6f 77 6e 20 61 73 20 22 70 72 65 66 69 78 20 6e 6f 74 | operands.is.known.as."prefix.not |
| ea40 | 61 74 69 6f 6e 22 2c 20 61 6e 64 20 69 74 20 6d 61 79 20 62 65 20 73 6f 6d 65 77 68 61 74 20 63 | ation",.and.it.may.be.somewhat.c |
| ea60 | 6f 6e 66 75 73 69 6e 67 20 61 74 0a 66 69 72 73 74 20 62 65 63 61 75 73 65 20 69 74 20 64 65 70 | onfusing.at.first.because.it.dep |
| ea80 | 61 72 74 73 20 73 69 67 6e 69 66 69 63 61 6e 74 6c 79 20 66 72 6f 6d 20 74 68 65 20 63 75 73 74 | arts.significantly.from.the.cust |
| eaa0 | 6f 6d 61 72 79 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 0a 63 6f 6e 76 65 6e 74 69 6f 6e 2e 20 20 | omary.mathematical.convention... |
| eac0 | 50 72 65 66 69 78 20 6e 6f 74 61 74 69 6f 6e 20 68 61 73 20 73 65 76 65 72 61 6c 20 61 64 76 61 | Prefix.notation.has.several.adva |
| eae0 | 6e 74 61 67 65 73 2c 20 68 6f 77 65 76 65 72 2e 20 20 4f 6e 65 20 6f 66 0a 74 68 65 6d 20 69 73 | ntages,.however...One.of.them.is |
| eb00 | 20 74 68 61 74 20 69 74 20 63 61 6e 20 61 63 63 6f 6d 6d 6f 64 61 74 65 20 70 72 6f 63 65 64 75 | .that.it.can.accommodate.procedu |
| eb20 | 72 65 73 20 74 68 61 74 20 6d 61 79 20 74 61 6b 65 20 61 6e 20 61 72 62 69 74 72 61 72 79 0a 6e | res.that.may.take.an.arbitrary.n |
| eb40 | 75 6d 62 65 72 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 2c 20 61 73 20 69 6e 20 74 68 65 20 66 6f | umber.of.arguments,.as.in.the.fo |
| eb60 | 6c 6c 6f 77 69 6e 67 20 65 78 61 6d 70 6c 65 73 3a 0a 0a 20 20 20 20 20 28 2b 20 32 31 20 33 35 | llowing.examples:.......(+.21.35 |
| eb80 | 20 31 32 20 37 29 0a 20 20 20 20 20 37 35 0a 0a 20 20 20 20 20 28 2a 20 32 35 20 34 20 31 32 29 | .12.7)......75.......(*.25.4.12) |
| eba0 | 0a 20 20 20 20 20 31 32 30 30 0a 0a 20 20 20 4e 6f 20 61 6d 62 69 67 75 69 74 79 20 63 61 6e 20 | ......1200.....No.ambiguity.can. |
| ebc0 | 61 72 69 73 65 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 69 73 20 61 | arise,.because.the.operator.is.a |
| ebe0 | 6c 77 61 79 73 20 74 68 65 20 6c 65 66 74 6d 6f 73 74 0a 65 6c 65 6d 65 6e 74 20 61 6e 64 20 74 | lways.the.leftmost.element.and.t |
| ec00 | 68 65 20 65 6e 74 69 72 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 69 73 20 64 65 6c 69 6d 69 74 | he.entire.combination.is.delimit |
| ec20 | 65 64 20 62 79 20 74 68 65 20 70 61 72 65 6e 74 68 65 73 65 73 2e 0a 0a 20 20 20 41 20 73 65 63 | ed.by.the.parentheses......A.sec |
| ec40 | 6f 6e 64 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 70 72 65 66 69 78 20 6e 6f 74 61 74 69 6f 6e | ond.advantage.of.prefix.notation |
| ec60 | 20 69 73 20 74 68 61 74 20 69 74 20 65 78 74 65 6e 64 73 20 69 6e 20 61 0a 73 74 72 61 69 67 68 | .is.that.it.extends.in.a.straigh |
| ec80 | 74 66 6f 72 77 61 72 64 20 77 61 79 20 74 6f 20 61 6c 6c 6f 77 20 63 6f 6d 62 69 6e 61 74 69 6f | tforward.way.to.allow.combinatio |
| eca0 | 6e 73 20 74 6f 20 62 65 20 6e 65 73 74 65 64 2c 20 74 68 61 74 20 69 73 2c 20 74 6f 0a 68 61 76 | ns.to.be.nested,.that.is,.to.hav |
| ecc0 | 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 77 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 61 72 | e.combinations.whose.elements.ar |
| ece0 | 65 20 74 68 65 6d 73 65 6c 76 65 73 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 | e.themselves.combinations:...... |
| ed00 | 20 28 2b 20 28 2a 20 33 20 35 29 20 28 2d 20 31 30 20 36 29 29 0a 20 20 20 20 20 31 39 0a 0a 20 | .(+.(*.3.5).(-.10.6))......19... |
| ed20 | 20 20 54 68 65 72 65 20 69 73 20 6e 6f 20 6c 69 6d 69 74 20 28 69 6e 20 70 72 69 6e 63 69 70 6c | ..There.is.no.limit.(in.principl |
| ed40 | 65 29 20 74 6f 20 74 68 65 20 64 65 70 74 68 20 6f 66 20 73 75 63 68 20 6e 65 73 74 69 6e 67 20 | e).to.the.depth.of.such.nesting. |
| ed60 | 61 6e 64 20 74 6f 0a 74 68 65 20 6f 76 65 72 61 6c 6c 20 63 6f 6d 70 6c 65 78 69 74 79 20 6f 66 | and.to.the.overall.complexity.of |
| ed80 | 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 68 61 74 20 74 68 65 20 4c 69 73 70 20 69 | .the.expressions.that.the.Lisp.i |
| eda0 | 6e 74 65 72 70 72 65 74 65 72 20 63 61 6e 0a 65 76 61 6c 75 61 74 65 2e 20 20 49 74 20 69 73 20 | nterpreter.can.evaluate...It.is. |
| edc0 | 77 65 20 68 75 6d 61 6e 73 20 77 68 6f 20 67 65 74 20 63 6f 6e 66 75 73 65 64 20 62 79 20 73 74 | we.humans.who.get.confused.by.st |
| ede0 | 69 6c 6c 20 72 65 6c 61 74 69 76 65 6c 79 20 73 69 6d 70 6c 65 0a 65 78 70 72 65 73 73 69 6f 6e | ill.relatively.simple.expression |
| ee00 | 73 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 20 28 2b 20 28 2a 20 33 20 28 2b 20 28 2a 20 32 20 | s.such.as.......(+.(*.3.(+.(*.2. |
| ee20 | 34 29 20 28 2b 20 33 20 35 29 29 29 20 28 2b 20 28 2d 20 31 30 20 37 29 20 36 29 29 0a 0a 77 68 | 4).(+.3.5))).(+.(-.10.7).6))..wh |
| ee40 | 69 63 68 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 77 6f 75 6c 64 20 72 65 61 64 69 6c | ich.the.interpreter.would.readil |
| ee60 | 79 20 65 76 61 6c 75 61 74 65 20 74 6f 20 62 65 20 35 37 2e 20 20 57 65 20 63 61 6e 20 68 65 6c | y.evaluate.to.be.57...We.can.hel |
| ee80 | 70 0a 6f 75 72 73 65 6c 76 65 73 20 62 79 20 77 72 69 74 69 6e 67 20 73 75 63 68 20 61 6e 20 65 | p.ourselves.by.writing.such.an.e |
| eea0 | 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 28 2b 20 28 | xpression.in.the.form.......(+.( |
| eec0 | 2a 20 33 0a 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 2a 20 32 20 34 29 0a 20 20 20 20 20 20 | *.3............(+.(*.2.4)....... |
| eee0 | 20 20 20 20 20 20 20 20 28 2b 20 33 20 35 29 29 29 0a 20 20 20 20 20 20 20 20 28 2b 20 28 2d 20 | ........(+.3.5))).........(+.(-. |
| ef00 | 31 30 20 37 29 0a 20 20 20 20 20 20 20 20 20 20 20 36 29 29 0a 0a 66 6f 6c 6c 6f 77 69 6e 67 20 | 10.7)............6))..following. |
| ef20 | 61 20 66 6f 72 6d 61 74 74 69 6e 67 20 63 6f 6e 76 65 6e 74 69 6f 6e 20 6b 6e 6f 77 6e 20 61 73 | a.formatting.convention.known.as |
| ef40 | 20 22 70 72 65 74 74 79 2d 70 72 69 6e 74 69 6e 67 22 2c 20 69 6e 20 77 68 69 63 68 0a 65 61 63 | ."pretty-printing",.in.which.eac |
| ef60 | 68 20 6c 6f 6e 67 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 69 73 20 77 72 69 74 74 65 6e 20 73 6f | h.long.combination.is.written.so |
| ef80 | 20 74 68 61 74 20 74 68 65 20 6f 70 65 72 61 6e 64 73 20 61 72 65 20 61 6c 69 67 6e 65 64 0a 76 | .that.the.operands.are.aligned.v |
| efa0 | 65 72 74 69 63 61 6c 6c 79 2e 20 20 54 68 65 20 72 65 73 75 6c 74 69 6e 67 20 69 6e 64 65 6e 74 | ertically...The.resulting.indent |
| efc0 | 61 74 69 6f 6e 73 20 64 69 73 70 6c 61 79 20 63 6c 65 61 72 6c 79 20 74 68 65 20 73 74 72 75 63 | ations.display.clearly.the.struc |
| efe0 | 74 75 72 65 0a 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 28 32 29 0a 0a 20 20 20 45 | ture.of.the.expression.(2).....E |
| f000 | 76 65 6e 20 77 69 74 68 20 63 6f 6d 70 6c 65 78 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 74 68 | ven.with.complex.expressions,.th |
| f020 | 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 61 6c 77 61 79 73 20 6f 70 65 72 61 74 65 73 20 69 6e | e.interpreter.always.operates.in |
| f040 | 0a 74 68 65 20 73 61 6d 65 20 62 61 73 69 63 20 63 79 63 6c 65 3a 20 49 74 20 72 65 61 64 73 20 | .the.same.basic.cycle:.It.reads. |
| f060 | 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 74 65 72 6d 69 6e 61 6c 2c | an.expression.from.the.terminal, |
| f080 | 0a 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 61 6e 64 20 70 | .evaluates.the.expression,.and.p |
| f0a0 | 72 69 6e 74 73 20 74 68 65 20 72 65 73 75 6c 74 2e 20 20 54 68 69 73 20 6d 6f 64 65 20 6f 66 0a | rints.the.result...This.mode.of. |
| f0c0 | 6f 70 65 72 61 74 69 6f 6e 20 69 73 20 6f 66 74 65 6e 20 65 78 70 72 65 73 73 65 64 20 62 79 20 | operation.is.often.expressed.by. |
| f0e0 | 73 61 79 69 6e 67 20 74 68 61 74 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 72 75 6e 73 | saying.that.the.interpreter.runs |
| f100 | 20 69 6e 20 61 20 22 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 6e 74 0a 6c 6f 6f 70 22 2e 20 20 4f | .in.a."read-eval-print.loop"...O |
| f120 | 62 73 65 72 76 65 20 69 6e 20 70 61 72 74 69 63 75 6c 61 72 20 74 68 61 74 20 69 74 20 69 73 20 | bserve.in.particular.that.it.is. |
| f140 | 6e 6f 74 20 6e 65 63 65 73 73 61 72 79 20 74 6f 20 65 78 70 6c 69 63 69 74 6c 79 0a 69 6e 73 74 | not.necessary.to.explicitly.inst |
| f160 | 72 75 63 74 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 6f 20 70 72 69 6e 74 20 74 68 | ruct.the.interpreter.to.print.th |
| f180 | 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 28 33 29 0a 0a 20 | e.value.of.the.expression.(3)... |
| f1a0 | 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..----------.Footnotes.--------- |
| f1c0 | 2d 0a 0a 20 20 20 28 31 29 20 54 68 72 6f 75 67 68 6f 75 74 20 74 68 69 73 20 62 6f 6f 6b 2c 20 | -.....(1).Throughout.this.book,. |
| f1e0 | 77 68 65 6e 20 77 65 20 77 69 73 68 20 74 6f 20 65 6d 70 68 61 73 69 7a 65 20 74 68 65 20 64 69 | when.we.wish.to.emphasize.the.di |
| f200 | 73 74 69 6e 63 74 69 6f 6e 0a 62 65 74 77 65 65 6e 20 74 68 65 20 69 6e 70 75 74 20 74 79 70 65 | stinction.between.the.input.type |
| f220 | 64 20 62 79 20 74 68 65 20 75 73 65 72 20 61 6e 64 20 74 68 65 20 72 65 73 70 6f 6e 73 65 20 70 | d.by.the.user.and.the.response.p |
| f240 | 72 69 6e 74 65 64 20 62 79 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 72 2c 20 77 65 20 77 69 | rinted.by.the.interpreter,.we.wi |
| f260 | 6c 6c 20 73 68 6f 77 20 74 68 65 20 6c 61 74 74 65 72 20 69 6e 20 73 6c 61 6e 74 65 64 20 63 68 | ll.show.the.latter.in.slanted.ch |
| f280 | 61 72 61 63 74 65 72 73 2e 0a 0a 20 20 20 28 32 29 20 4c 69 73 70 20 73 79 73 74 65 6d 73 20 74 | aracters......(2).Lisp.systems.t |
| f2a0 | 79 70 69 63 61 6c 6c 79 20 70 72 6f 76 69 64 65 20 66 65 61 74 75 72 65 73 20 74 6f 20 61 69 64 | ypically.provide.features.to.aid |
| f2c0 | 20 74 68 65 20 75 73 65 72 20 69 6e 0a 66 6f 72 6d 61 74 74 69 6e 67 20 65 78 70 72 65 73 73 69 | .the.user.in.formatting.expressi |
| f2e0 | 6f 6e 73 2e 20 20 54 77 6f 20 65 73 70 65 63 69 61 6c 6c 79 20 75 73 65 66 75 6c 20 66 65 61 74 | ons...Two.especially.useful.feat |
| f300 | 75 72 65 73 20 61 72 65 20 6f 6e 65 20 74 68 61 74 0a 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 | ures.are.one.that.automatically. |
| f320 | 69 6e 64 65 6e 74 73 20 74 6f 20 74 68 65 20 70 72 6f 70 65 72 20 70 72 65 74 74 79 2d 70 72 69 | indents.to.the.proper.pretty-pri |
| f340 | 6e 74 20 70 6f 73 69 74 69 6f 6e 20 77 68 65 6e 65 76 65 72 20 61 0a 6e 65 77 20 6c 69 6e 65 20 | nt.position.whenever.a.new.line. |
| f360 | 69 73 20 73 74 61 72 74 65 64 20 61 6e 64 20 6f 6e 65 20 74 68 61 74 20 68 69 67 68 6c 69 67 68 | is.started.and.one.that.highligh |
| f380 | 74 73 20 74 68 65 20 6d 61 74 63 68 69 6e 67 20 6c 65 66 74 0a 70 61 72 65 6e 74 68 65 73 69 73 | ts.the.matching.left.parenthesis |
| f3a0 | 20 77 68 65 6e 65 76 65 72 20 61 20 72 69 67 68 74 20 70 61 72 65 6e 74 68 65 73 69 73 20 69 73 | .whenever.a.right.parenthesis.is |
| f3c0 | 20 74 79 70 65 64 2e 0a 0a 20 20 20 28 33 29 20 4c 69 73 70 20 6f 62 65 79 73 20 74 68 65 20 63 | .typed......(3).Lisp.obeys.the.c |
| f3e0 | 6f 6e 76 65 6e 74 69 6f 6e 20 74 68 61 74 20 65 76 65 72 79 20 65 78 70 72 65 73 73 69 6f 6e 20 | onvention.that.every.expression. |
| f400 | 68 61 73 20 61 20 76 61 6c 75 65 2e 0a 54 68 69 73 20 63 6f 6e 76 65 6e 74 69 6f 6e 2c 20 74 6f | has.a.value..This.convention,.to |
| f420 | 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 20 6f 6c 64 20 72 65 70 75 74 61 74 69 6f 6e 20 6f | gether.with.the.old.reputation.o |
| f440 | 66 20 4c 69 73 70 20 61 73 20 61 6e 0a 69 6e 65 66 66 69 63 69 65 6e 74 20 6c 61 6e 67 75 61 67 | f.Lisp.as.an.inefficient.languag |
| f460 | 65 2c 20 69 73 20 74 68 65 20 73 6f 75 72 63 65 20 6f 66 20 74 68 65 20 71 75 69 70 20 62 79 20 | e,.is.the.source.of.the.quip.by. |
| f480 | 41 6c 61 6e 20 50 65 72 6c 69 73 0a 28 70 61 72 61 70 68 72 61 73 69 6e 67 20 4f 73 63 61 72 20 | Alan.Perlis.(paraphrasing.Oscar. |
| f4a0 | 57 69 6c 64 65 29 20 74 68 61 74 20 22 4c 69 73 70 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 6b 6e | Wilde).that."Lisp.programmers.kn |
| f4c0 | 6f 77 20 74 68 65 20 76 61 6c 75 65 20 6f 66 0a 65 76 65 72 79 74 68 69 6e 67 20 62 75 74 20 74 | ow.the.value.of.everything.but.t |
| f4e0 | 68 65 20 63 6f 73 74 20 6f 66 20 6e 6f 74 68 69 6e 67 2e 22 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 | he.cost.of.nothing."....File:.si |
| f500 | 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 31 2d 32 2c 20 20 4e 65 78 74 3a 20 31 2d | cp.info,..Node:.1-1-2,..Next:.1- |
| f520 | 31 2d 33 2c 20 20 50 72 65 76 3a 20 31 2d 31 2d 31 2c 20 20 55 70 3a 20 31 2d 31 0a 0a 31 2e 31 | 1-3,..Prev:.1-1-1,..Up:.1-1..1.1 |
| f540 | 2e 32 20 4e 61 6d 69 6e 67 20 61 6e 64 20 74 68 65 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 0a 2d 2d | .2.Naming.and.the.Environment.-- |
| f560 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a | ------------------------------.. |
| f580 | 41 20 63 72 69 74 69 63 61 6c 20 61 73 70 65 63 74 20 6f 66 20 61 20 70 72 6f 67 72 61 6d 6d 69 | A.critical.aspect.of.a.programmi |
| f5a0 | 6e 67 20 6c 61 6e 67 75 61 67 65 20 69 73 20 74 68 65 20 6d 65 61 6e 73 20 69 74 20 70 72 6f 76 | ng.language.is.the.means.it.prov |
| f5c0 | 69 64 65 73 0a 66 6f 72 20 75 73 69 6e 67 20 6e 61 6d 65 73 20 74 6f 20 72 65 66 65 72 20 74 6f | ides.for.using.names.to.refer.to |
| f5e0 | 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 2e 20 20 57 65 20 73 61 79 20 | .computational.objects...We.say. |
| f600 | 74 68 61 74 20 74 68 65 0a 6e 61 6d 65 20 69 64 65 6e 74 69 66 69 65 73 20 61 20 22 76 61 72 69 | that.the.name.identifies.a."vari |
| f620 | 61 62 6c 65 22 20 77 68 6f 73 65 20 22 76 61 6c 75 65 22 20 69 73 20 74 68 65 20 6f 62 6a 65 63 | able".whose."value".is.the.objec |
| f640 | 74 2e 0a 0a 20 20 20 49 6e 20 74 68 65 20 53 63 68 65 6d 65 20 64 69 61 6c 65 63 74 20 6f 66 20 | t......In.the.Scheme.dialect.of. |
| f660 | 4c 69 73 70 2c 20 77 65 20 6e 61 6d 65 20 74 68 69 6e 67 73 20 77 69 74 68 20 60 64 65 66 69 6e | Lisp,.we.name.things.with.`defin |
| f680 | 65 27 2e 20 20 54 79 70 69 6e 67 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 69 7a 65 20 32 | e'...Typing.......(define.size.2 |
| f6a0 | 29 0a 0a 63 61 75 73 65 73 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 6f 20 61 73 73 | )..causes.the.interpreter.to.ass |
| f6c0 | 6f 63 69 61 74 65 20 74 68 65 20 76 61 6c 75 65 20 32 20 77 69 74 68 20 74 68 65 20 6e 61 6d 65 | ociate.the.value.2.with.the.name |
| f6e0 | 0a 60 73 69 7a 65 27 2e 28 31 29 20 4f 6e 63 65 20 74 68 65 20 6e 61 6d 65 20 60 73 69 7a 65 27 | .`size'.(1).Once.the.name.`size' |
| f700 | 20 68 61 73 20 62 65 65 6e 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 65 20 6e 75 | .has.been.associated.with.the.nu |
| f720 | 6d 62 65 72 20 32 2c 0a 77 65 20 63 61 6e 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 76 61 6c 75 | mber.2,.we.can.refer.to.the.valu |
| f740 | 65 20 32 20 62 79 20 6e 61 6d 65 3a 0a 0a 20 20 20 20 20 73 69 7a 65 0a 20 20 20 20 20 32 0a 0a | e.2.by.name:.......size......2.. |
| f760 | 20 20 20 20 20 28 2a 20 35 20 73 69 7a 65 29 0a 20 20 20 20 20 31 30 0a 0a 20 20 20 48 65 72 65 | .....(*.5.size)......10.....Here |
| f780 | 20 61 72 65 20 66 75 72 74 68 65 72 20 65 78 61 6d 70 6c 65 73 20 6f 66 20 74 68 65 20 75 73 65 | .are.further.examples.of.the.use |
| f7a0 | 20 6f 66 20 60 64 65 66 69 6e 65 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 70 69 20 33 | .of.`define':.......(define.pi.3 |
| f7c0 | 2e 31 34 31 35 39 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 72 61 64 69 75 73 20 31 30 29 | .14159).......(define.radius.10) |
| f7e0 | 0a 0a 20 20 20 20 20 28 2a 20 70 69 20 28 2a 20 72 61 64 69 75 73 20 72 61 64 69 75 73 29 29 0a | .......(*.pi.(*.radius.radius)). |
| f800 | 20 20 20 20 20 33 31 34 2e 31 35 39 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 63 69 72 63 75 | .....314.159.......(define.circu |
| f820 | 6d 66 65 72 65 6e 63 65 20 28 2a 20 32 20 70 69 20 72 61 64 69 75 73 29 29 0a 0a 20 20 20 20 20 | mference.(*.2.pi.radius))....... |
| f840 | 63 69 72 63 75 6d 66 65 72 65 6e 63 65 0a 20 20 20 20 20 36 32 2e 38 33 31 38 0a 0a 20 20 20 60 | circumference......62.8318.....` |
| f860 | 44 65 66 69 6e 65 27 20 69 73 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 27 73 20 73 69 6d 70 6c 65 | Define'.is.our.language's.simple |
| f880 | 73 74 20 6d 65 61 6e 73 20 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 66 6f 72 20 69 74 0a | st.means.of.abstraction,.for.it. |
| f8a0 | 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20 75 73 65 20 73 69 6d 70 6c 65 20 6e 61 6d 65 73 20 74 6f | allows.us.to.use.simple.names.to |
| f8c0 | 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 20 63 6f 6d 70 6f 75 6e | .refer.to.the.results.of.compoun |
| f8e0 | 64 0a 6f 70 65 72 61 74 69 6f 6e 73 2c 20 73 75 63 68 20 61 73 20 74 68 65 20 60 63 69 72 63 75 | d.operations,.such.as.the.`circu |
| f900 | 6d 66 65 72 65 6e 63 65 27 20 63 6f 6d 70 75 74 65 64 20 61 62 6f 76 65 2e 20 20 49 6e 20 67 65 | mference'.computed.above...In.ge |
| f920 | 6e 65 72 61 6c 2c 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 20 6d 61 79 | neral,.computational.objects.may |
| f940 | 20 68 61 76 65 20 76 65 72 79 20 63 6f 6d 70 6c 65 78 20 73 74 72 75 63 74 75 72 65 73 2c 20 61 | .have.very.complex.structures,.a |
| f960 | 6e 64 20 69 74 20 77 6f 75 6c 64 20 62 65 0a 65 78 74 72 65 6d 65 6c 79 20 69 6e 63 6f 6e 76 65 | nd.it.would.be.extremely.inconve |
| f980 | 6e 69 65 6e 74 20 74 6f 20 68 61 76 65 20 74 6f 20 72 65 6d 65 6d 62 65 72 20 61 6e 64 20 72 65 | nient.to.have.to.remember.and.re |
| f9a0 | 70 65 61 74 20 74 68 65 69 72 20 64 65 74 61 69 6c 73 0a 65 61 63 68 20 74 69 6d 65 20 77 65 20 | peat.their.details.each.time.we. |
| f9c0 | 77 61 6e 74 20 74 6f 20 75 73 65 20 74 68 65 6d 2e 20 20 49 6e 64 65 65 64 2c 20 63 6f 6d 70 6c | want.to.use.them...Indeed,.compl |
| f9e0 | 65 78 20 70 72 6f 67 72 61 6d 73 20 61 72 65 0a 63 6f 6e 73 74 72 75 63 74 65 64 20 62 79 20 62 | ex.programs.are.constructed.by.b |
| fa00 | 75 69 6c 64 69 6e 67 2c 20 73 74 65 70 20 62 79 20 73 74 65 70 2c 20 63 6f 6d 70 75 74 61 74 69 | uilding,.step.by.step,.computati |
| fa20 | 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 20 6f 66 0a 69 6e 63 72 65 61 73 69 6e 67 20 63 6f 6d 70 6c | onal.objects.of.increasing.compl |
| fa40 | 65 78 69 74 79 2e 20 54 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 6d 61 6b 65 73 20 74 68 69 | exity..The.interpreter.makes.thi |
| fa60 | 73 20 73 74 65 70 2d 62 79 2d 73 74 65 70 20 70 72 6f 67 72 61 6d 0a 63 6f 6e 73 74 72 75 63 74 | s.step-by-step.program.construct |
| fa80 | 69 6f 6e 20 70 61 72 74 69 63 75 6c 61 72 6c 79 20 63 6f 6e 76 65 6e 69 65 6e 74 20 62 65 63 61 | ion.particularly.convenient.beca |
| faa0 | 75 73 65 20 6e 61 6d 65 2d 6f 62 6a 65 63 74 20 61 73 73 6f 63 69 61 74 69 6f 6e 73 0a 63 61 6e | use.name-object.associations.can |
| fac0 | 20 62 65 20 63 72 65 61 74 65 64 20 69 6e 63 72 65 6d 65 6e 74 61 6c 6c 79 20 69 6e 20 73 75 63 | .be.created.incrementally.in.suc |
| fae0 | 63 65 73 73 69 76 65 20 69 6e 74 65 72 61 63 74 69 6f 6e 73 2e 20 20 54 68 69 73 20 66 65 61 74 | cessive.interactions...This.feat |
| fb00 | 75 72 65 0a 65 6e 63 6f 75 72 61 67 65 73 20 74 68 65 20 69 6e 63 72 65 6d 65 6e 74 61 6c 20 64 | ure.encourages.the.incremental.d |
| fb20 | 65 76 65 6c 6f 70 6d 65 6e 74 20 61 6e 64 20 74 65 73 74 69 6e 67 20 6f 66 20 70 72 6f 67 72 61 | evelopment.and.testing.of.progra |
| fb40 | 6d 73 20 61 6e 64 20 69 73 0a 6c 61 72 67 65 6c 79 20 72 65 73 70 6f 6e 73 69 62 6c 65 20 66 6f | ms.and.is.largely.responsible.fo |
| fb60 | 72 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 61 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 20 75 | r.the.fact.that.a.Lisp.program.u |
| fb80 | 73 75 61 6c 6c 79 20 63 6f 6e 73 69 73 74 73 0a 6f 66 20 61 20 6c 61 72 67 65 20 6e 75 6d 62 65 | sually.consists.of.a.large.numbe |
| fba0 | 72 20 6f 66 20 72 65 6c 61 74 69 76 65 6c 79 20 73 69 6d 70 6c 65 20 70 72 6f 63 65 64 75 72 65 | r.of.relatively.simple.procedure |
| fbc0 | 73 2e 0a 0a 20 20 20 49 74 20 73 68 6f 75 6c 64 20 62 65 20 63 6c 65 61 72 20 74 68 61 74 20 74 | s......It.should.be.clear.that.t |
| fbe0 | 68 65 20 70 6f 73 73 69 62 69 6c 69 74 79 20 6f 66 20 61 73 73 6f 63 69 61 74 69 6e 67 20 76 61 | he.possibility.of.associating.va |
| fc00 | 6c 75 65 73 20 77 69 74 68 0a 73 79 6d 62 6f 6c 73 20 61 6e 64 20 6c 61 74 65 72 20 72 65 74 72 | lues.with.symbols.and.later.retr |
| fc20 | 69 65 76 69 6e 67 20 74 68 65 6d 20 6d 65 61 6e 73 20 74 68 61 74 20 74 68 65 20 69 6e 74 65 72 | ieving.them.means.that.the.inter |
| fc40 | 70 72 65 74 65 72 20 6d 75 73 74 0a 6d 61 69 6e 74 61 69 6e 20 73 6f 6d 65 20 73 6f 72 74 20 6f | preter.must.maintain.some.sort.o |
| fc60 | 66 20 6d 65 6d 6f 72 79 20 74 68 61 74 20 6b 65 65 70 73 20 74 72 61 63 6b 20 6f 66 20 74 68 65 | f.memory.that.keeps.track.of.the |
| fc80 | 20 6e 61 6d 65 2d 6f 62 6a 65 63 74 20 70 61 69 72 73 2e 0a 54 68 69 73 20 6d 65 6d 6f 72 79 20 | .name-object.pairs..This.memory. |
| fca0 | 69 73 20 63 61 6c 6c 65 64 20 74 68 65 20 22 65 6e 76 69 72 6f 6e 6d 65 6e 74 22 20 28 6d 6f 72 | is.called.the."environment".(mor |
| fcc0 | 65 20 70 72 65 63 69 73 65 6c 79 20 74 68 65 20 22 67 6c 6f 62 61 6c 0a 65 6e 76 69 72 6f 6e 6d | e.precisely.the."global.environm |
| fce0 | 65 6e 74 22 2c 20 73 69 6e 63 65 20 77 65 20 77 69 6c 6c 20 73 65 65 20 6c 61 74 65 72 20 74 68 | ent",.since.we.will.see.later.th |
| fd00 | 61 74 20 61 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 6d 61 79 20 69 6e 76 6f 6c 76 65 20 61 0a 6e | at.a.computation.may.involve.a.n |
| fd20 | 75 6d 62 65 72 20 6f 66 20 64 69 66 66 65 72 65 6e 74 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 29 | umber.of.different.environments) |
| fd40 | 2e 28 32 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d | .(2).....----------.Footnotes.-- |
| fd60 | 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 6e 20 74 68 69 73 20 62 6f 6f 6b 2c 20 77 | --------.....(1).In.this.book,.w |
| fd80 | 65 20 64 6f 20 6e 6f 74 20 73 68 6f 77 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 27 73 20 | e.do.not.show.the.interpreter's. |
| fda0 | 72 65 73 70 6f 6e 73 65 20 74 6f 0a 65 76 61 6c 75 61 74 69 6e 67 20 64 65 66 69 6e 69 74 69 6f | response.to.evaluating.definitio |
| fdc0 | 6e 73 2c 20 73 69 6e 63 65 20 74 68 69 73 20 69 73 20 68 69 67 68 6c 79 20 69 6d 70 6c 65 6d 65 | ns,.since.this.is.highly.impleme |
| fde0 | 6e 74 61 74 69 6f 6e 2d 64 65 70 65 6e 64 65 6e 74 2e 0a 0a 20 20 20 28 32 29 20 2a 4e 6f 74 65 | ntation-dependent......(2).*Note |
| fe00 | 20 43 68 61 70 74 65 72 20 33 3a 3a 20 77 69 6c 6c 20 73 68 6f 77 20 74 68 61 74 20 74 68 69 73 | .Chapter.3::.will.show.that.this |
| fe20 | 20 6e 6f 74 69 6f 6e 20 6f 66 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 0a 63 72 75 63 69 61 | .notion.of.environment.is.crucia |
| fe40 | 6c 2c 20 62 6f 74 68 20 66 6f 72 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 68 6f 77 20 74 68 | l,.both.for.understanding.how.th |
| fe60 | 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 77 6f 72 6b 73 20 61 6e 64 20 66 6f 72 0a 69 6d 70 6c | e.interpreter.works.and.for.impl |
| fe80 | 65 6d 65 6e 74 69 6e 67 20 69 6e 74 65 72 70 72 65 74 65 72 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 | ementing.interpreters.....File:. |
| fea0 | 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 31 2d 33 2c 20 20 4e 65 78 74 3a 20 | sicp.info,..Node:.1-1-3,..Next:. |
| fec0 | 31 2d 31 2d 34 2c 20 20 50 72 65 76 3a 20 31 2d 31 2d 32 2c 20 20 55 70 3a 20 31 2d 31 0a 0a 31 | 1-1-4,..Prev:.1-1-2,..Up:.1-1..1 |
| fee0 | 2e 31 2e 33 20 45 76 61 6c 75 61 74 69 6e 67 20 43 6f 6d 62 69 6e 61 74 69 6f 6e 73 0a 2d 2d 2d | .1.3.Evaluating.Combinations.--- |
| ff00 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 4f 6e 65 20 | --------------------------..One. |
| ff20 | 6f 66 20 6f 75 72 20 67 6f 61 6c 73 20 69 6e 20 74 68 69 73 20 63 68 61 70 74 65 72 20 69 73 20 | of.our.goals.in.this.chapter.is. |
| ff40 | 74 6f 20 69 73 6f 6c 61 74 65 20 69 73 73 75 65 73 20 61 62 6f 75 74 20 74 68 69 6e 6b 69 6e 67 | to.isolate.issues.about.thinking |
| ff60 | 0a 70 72 6f 63 65 64 75 72 61 6c 6c 79 2e 20 20 41 73 20 61 20 63 61 73 65 20 69 6e 20 70 6f 69 | .procedurally...As.a.case.in.poi |
| ff80 | 6e 74 2c 20 6c 65 74 20 75 73 20 63 6f 6e 73 69 64 65 72 20 74 68 61 74 2c 20 69 6e 20 65 76 61 | nt,.let.us.consider.that,.in.eva |
| ffa0 | 6c 75 61 74 69 6e 67 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 2c 20 74 68 65 20 69 6e 74 65 72 70 | luating.combinations,.the.interp |
| ffc0 | 72 65 74 65 72 20 69 73 20 69 74 73 65 6c 66 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 20 70 72 6f 63 | reter.is.itself.following.a.proc |
| ffe0 | 65 64 75 72 65 2e 0a 0a 20 20 20 20 20 54 6f 20 65 76 61 6c 75 61 74 65 20 61 20 63 6f 6d 62 69 | edure........To.evaluate.a.combi |
| 10000 | 6e 61 74 69 6f 6e 2c 20 64 6f 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 0a 20 20 20 20 20 | nation,.do.the.following:....... |
| 10020 | 20 20 31 2e 20 45 76 61 6c 75 61 74 65 20 74 68 65 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 | ..1..Evaluate.the.subexpressions |
| 10040 | 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 20 20 32 2e 20 | .of.the.combination..........2.. |
| 10060 | 41 70 70 6c 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 69 73 20 74 68 65 20 | Apply.the.procedure.that.is.the. |
| 10080 | 76 61 6c 75 65 20 6f 66 20 74 68 65 20 6c 65 66 74 6d 6f 73 74 0a 20 20 20 20 20 20 20 20 20 20 | value.of.the.leftmost........... |
| 100a0 | 73 75 62 65 78 70 72 65 73 73 69 6f 6e 20 28 74 68 65 20 6f 70 65 72 61 74 6f 72 29 20 74 6f 20 | subexpression.(the.operator).to. |
| 100c0 | 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 68 61 74 20 61 72 65 20 74 68 65 0a 20 20 20 20 20 | the.arguments.that.are.the...... |
| 100e0 | 20 20 20 20 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 6f 74 68 65 72 20 73 75 62 65 78 70 72 | .....values.of.the.other.subexpr |
| 10100 | 65 73 73 69 6f 6e 73 20 28 74 68 65 20 6f 70 65 72 61 6e 64 73 29 2e 0a 0a 0a 20 20 20 45 76 65 | essions.(the.operands).......Eve |
| 10120 | 6e 20 74 68 69 73 20 73 69 6d 70 6c 65 20 72 75 6c 65 20 69 6c 6c 75 73 74 72 61 74 65 73 20 73 | n.this.simple.rule.illustrates.s |
| 10140 | 6f 6d 65 20 69 6d 70 6f 72 74 61 6e 74 20 70 6f 69 6e 74 73 20 61 62 6f 75 74 0a 70 72 6f 63 65 | ome.important.points.about.proce |
| 10160 | 73 73 65 73 20 69 6e 20 67 65 6e 65 72 61 6c 2e 20 20 46 69 72 73 74 2c 20 6f 62 73 65 72 76 65 | sses.in.general...First,.observe |
| 10180 | 20 74 68 61 74 20 74 68 65 20 66 69 72 73 74 20 73 74 65 70 20 64 69 63 74 61 74 65 73 20 74 68 | .that.the.first.step.dictates.th |
| 101a0 | 61 74 0a 69 6e 20 6f 72 64 65 72 20 74 6f 20 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 65 20 65 76 | at.in.order.to.accomplish.the.ev |
| 101c0 | 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 66 6f 72 20 61 20 63 6f 6d 62 69 6e 61 74 69 | aluation.process.for.a.combinati |
| 101e0 | 6f 6e 20 77 65 20 6d 75 73 74 0a 66 69 72 73 74 20 70 65 72 66 6f 72 6d 20 74 68 65 20 65 76 61 | on.we.must.first.perform.the.eva |
| 10200 | 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 6f 6e 20 65 61 63 68 20 65 6c 65 6d 65 6e 74 20 | luation.process.on.each.element. |
| 10220 | 6f 66 20 74 68 65 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 2e 20 20 54 68 75 73 2c 20 74 68 65 20 65 | of.the.combination...Thus,.the.e |
| 10240 | 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 20 69 73 20 22 72 65 63 75 72 73 69 76 65 22 20 69 6e | valuation.rule.is."recursive".in |
| 10260 | 20 6e 61 74 75 72 65 3b 20 74 68 61 74 0a 69 73 2c 20 69 74 20 69 6e 63 6c 75 64 65 73 2c 20 61 | .nature;.that.is,.it.includes,.a |
| 10280 | 73 20 6f 6e 65 20 6f 66 20 69 74 73 20 73 74 65 70 73 2c 20 74 68 65 20 6e 65 65 64 20 74 6f 20 | s.one.of.its.steps,.the.need.to. |
| 102a0 | 69 6e 76 6f 6b 65 20 74 68 65 20 72 75 6c 65 0a 69 74 73 65 6c 66 2e 28 31 29 0a 0a 20 20 20 4e | invoke.the.rule.itself.(1).....N |
| 102c0 | 6f 74 69 63 65 20 68 6f 77 20 73 75 63 63 69 6e 63 74 6c 79 20 74 68 65 20 69 64 65 61 20 6f 66 | otice.how.succinctly.the.idea.of |
| 102e0 | 20 72 65 63 75 72 73 69 6f 6e 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 65 78 70 72 65 73 | .recursion.can.be.used.to.expres |
| 10300 | 73 0a 77 68 61 74 2c 20 69 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 61 20 64 65 65 70 6c 79 20 | s.what,.in.the.case.of.a.deeply. |
| 10320 | 6e 65 73 74 65 64 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 2c 20 77 6f 75 6c 64 20 6f 74 68 65 72 77 | nested.combination,.would.otherw |
| 10340 | 69 73 65 20 62 65 0a 76 69 65 77 65 64 20 61 73 20 61 20 72 61 74 68 65 72 20 63 6f 6d 70 6c 69 | ise.be.viewed.as.a.rather.compli |
| 10360 | 63 61 74 65 64 20 70 72 6f 63 65 73 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 65 76 61 | cated.process...For.example,.eva |
| 10380 | 6c 75 61 74 69 6e 67 0a 0a 20 20 20 20 20 28 2a 20 28 2b 20 32 20 28 2a 20 34 20 36 29 29 0a 20 | luating.......(*.(+.2.(*.4.6)).. |
| 103a0 | 20 20 20 20 20 20 20 28 2b 20 33 20 35 20 37 29 29 0a 0a 72 65 71 75 69 72 65 73 20 74 68 61 74 | .......(+.3.5.7))..requires.that |
| 103c0 | 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 20 62 65 20 61 70 70 6c 69 65 64 20 | .the.evaluation.rule.be.applied. |
| 103e0 | 74 6f 20 66 6f 75 72 20 64 69 66 66 65 72 65 6e 74 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 2e 20 | to.four.different.combinations.. |
| 10400 | 20 57 65 20 63 61 6e 20 6f 62 74 61 69 6e 20 61 20 70 69 63 74 75 72 65 20 6f 66 20 74 68 69 73 | .We.can.obtain.a.picture.of.this |
| 10420 | 20 70 72 6f 63 65 73 73 20 62 79 20 72 65 70 72 65 73 65 6e 74 69 6e 67 0a 74 68 65 20 63 6f 6d | .process.by.representing.the.com |
| 10440 | 62 69 6e 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 66 6f 72 6d 20 6f 66 20 61 20 74 72 65 65 2c 20 | bination.in.the.form.of.a.tree,. |
| 10460 | 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 31 2d 31 3a 3a 2e 0a | as.shown.in.*Note.Figure.1-1::.. |
| 10480 | 45 61 63 68 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 | Each.combination.is.represented. |
| 104a0 | 62 79 20 61 20 6e 6f 64 65 20 77 69 74 68 20 62 72 61 6e 63 68 65 73 20 63 6f 72 72 65 73 70 6f | by.a.node.with.branches.correspo |
| 104c0 | 6e 64 69 6e 67 0a 74 6f 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 61 6e 64 20 74 68 65 20 6f 70 | nding.to.the.operator.and.the.op |
| 104e0 | 65 72 61 6e 64 73 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 73 74 65 6d 6d 69 | erands.of.the.combination.stemmi |
| 10500 | 6e 67 20 66 72 6f 6d 20 69 74 2e 0a 54 68 65 20 74 65 72 6d 69 6e 61 6c 20 6e 6f 64 65 73 20 28 | ng.from.it..The.terminal.nodes.( |
| 10520 | 74 68 61 74 20 69 73 2c 20 6e 6f 64 65 73 20 77 69 74 68 20 6e 6f 20 62 72 61 6e 63 68 65 73 20 | that.is,.nodes.with.no.branches. |
| 10540 | 73 74 65 6d 6d 69 6e 67 20 66 72 6f 6d 20 74 68 65 6d 29 0a 72 65 70 72 65 73 65 6e 74 20 65 69 | stemming.from.them).represent.ei |
| 10560 | 74 68 65 72 20 6f 70 65 72 61 74 6f 72 73 20 6f 72 20 6e 75 6d 62 65 72 73 2e 20 20 56 69 65 77 | ther.operators.or.numbers...View |
| 10580 | 69 6e 67 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 6e 20 74 65 72 6d 73 20 6f 66 0a 74 68 65 20 74 | ing.evaluation.in.terms.of.the.t |
| 105a0 | 72 65 65 2c 20 77 65 20 63 61 6e 20 69 6d 61 67 69 6e 65 20 74 68 61 74 20 74 68 65 20 76 61 6c | ree,.we.can.imagine.that.the.val |
| 105c0 | 75 65 73 20 6f 66 20 74 68 65 20 6f 70 65 72 61 6e 64 73 20 70 65 72 63 6f 6c 61 74 65 0a 75 70 | ues.of.the.operands.percolate.up |
| 105e0 | 77 61 72 64 2c 20 73 74 61 72 74 69 6e 67 20 66 72 6f 6d 20 74 68 65 20 74 65 72 6d 69 6e 61 6c | ward,.starting.from.the.terminal |
| 10600 | 20 6e 6f 64 65 73 20 61 6e 64 20 74 68 65 6e 20 63 6f 6d 62 69 6e 69 6e 67 20 61 74 20 68 69 67 | .nodes.and.then.combining.at.hig |
| 10620 | 68 65 72 0a 61 6e 64 20 68 69 67 68 65 72 20 6c 65 76 65 6c 73 2e 20 20 49 6e 20 67 65 6e 65 72 | her.and.higher.levels...In.gener |
| 10640 | 61 6c 2c 20 77 65 20 73 68 61 6c 6c 20 73 65 65 20 74 68 61 74 20 72 65 63 75 72 73 69 6f 6e 20 | al,.we.shall.see.that.recursion. |
| 10660 | 69 73 20 61 20 76 65 72 79 0a 70 6f 77 65 72 66 75 6c 20 74 65 63 68 6e 69 71 75 65 20 66 6f 72 | is.a.very.powerful.technique.for |
| 10680 | 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 68 69 65 72 61 72 63 68 69 63 61 6c 2c 20 74 72 65 65 | .dealing.with.hierarchical,.tree |
| 106a0 | 6c 69 6b 65 20 6f 62 6a 65 63 74 73 2e 20 20 49 6e 0a 66 61 63 74 2c 20 74 68 65 20 22 70 65 72 | like.objects...In.fact,.the."per |
| 106c0 | 63 6f 6c 61 74 65 20 76 61 6c 75 65 73 20 75 70 77 61 72 64 22 20 66 6f 72 6d 20 6f 66 20 74 68 | colate.values.upward".form.of.th |
| 106e0 | 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 20 69 73 20 61 6e 0a 65 78 61 6d 70 6c 65 20 | e.evaluation.rule.is.an.example. |
| 10700 | 6f 66 20 61 20 67 65 6e 65 72 61 6c 20 6b 69 6e 64 20 6f 66 20 70 72 6f 63 65 73 73 20 6b 6e 6f | of.a.general.kind.of.process.kno |
| 10720 | 77 6e 20 61 73 20 22 74 72 65 65 20 61 63 63 75 6d 75 6c 61 74 69 6f 6e 22 2e 0a 0a 20 20 20 20 | wn.as."tree.accumulation"....... |
| 10740 | 20 2a 46 69 67 75 72 65 20 31 2e 31 3a 2a 20 54 72 65 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 | .*Figure.1.1:*.Tree.representati |
| 10760 | 6f 6e 2c 20 73 68 6f 77 69 6e 67 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 65 61 63 68 0a 20 20 | on,.showing.the.value.of.each... |
| 10780 | 20 20 20 73 75 62 63 6f 6d 62 69 6e 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ...subcombination............... |
| 107a0 | 20 33 39 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 7c 5c 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f | .390............../|\___________ |
| 107c0 | 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 0a | _............./.|.............\. |
| 107e0 | 20 20 20 20 20 20 20 20 20 20 20 2a 20 20 32 36 20 20 20 20 20 20 20 20 20 20 20 20 31 35 0a 20 | ...........*..26............15.. |
| 10800 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 7c 5c 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | ............./|\............|... |
| 10820 | 20 20 20 20 20 20 20 20 20 20 20 2f 20 7c 20 5c 20 20 20 20 20 20 20 20 20 2f 2f 20 5c 5c 0a 20 | .........../.|.\.........//.\\.. |
| 10840 | 20 20 20 20 20 20 20 20 20 20 20 2b 20 20 32 20 20 32 34 20 20 20 20 20 20 2f 20 7c 20 20 7c 20 | ...........+..2..24....../.|..|. |
| 10860 | 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 7c 5c 20 20 20 20 2b 20 20 33 20 | \.................../|\....+..3. |
| 10880 | 20 35 20 20 37 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 7c 20 5c 0a 20 20 20 | .5..7................../.|.\.... |
| 108a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 20 20 34 20 20 36 0a 0a 20 20 20 4e 65 78 74 2c 20 6f | .............*..4..6.....Next,.o |
| 108c0 | 62 73 65 72 76 65 20 74 68 61 74 20 74 68 65 20 72 65 70 65 61 74 65 64 20 61 70 70 6c 69 63 61 | bserve.that.the.repeated.applica |
| 108e0 | 74 69 6f 6e 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 73 74 65 70 20 62 72 69 6e 67 73 0a 75 73 | tion.of.the.first.step.brings.us |
| 10900 | 20 74 6f 20 74 68 65 20 70 6f 69 6e 74 20 77 68 65 72 65 20 77 65 20 6e 65 65 64 20 74 6f 20 65 | .to.the.point.where.we.need.to.e |
| 10920 | 76 61 6c 75 61 74 65 2c 20 6e 6f 74 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 2c 20 62 75 74 0a 70 | valuate,.not.combinations,.but.p |
| 10940 | 72 69 6d 69 74 69 76 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 73 75 63 68 20 61 73 20 6e 75 6d | rimitive.expressions.such.as.num |
| 10960 | 65 72 61 6c 73 2c 20 62 75 69 6c 74 2d 69 6e 20 6f 70 65 72 61 74 6f 72 73 2c 20 6f 72 20 6f 74 | erals,.built-in.operators,.or.ot |
| 10980 | 68 65 72 0a 6e 61 6d 65 73 2e 20 20 57 65 20 74 61 6b 65 20 63 61 72 65 20 6f 66 20 74 68 65 20 | her.names...We.take.care.of.the. |
| 109a0 | 70 72 69 6d 69 74 69 76 65 20 63 61 73 65 73 20 62 79 20 73 74 69 70 75 6c 61 74 69 6e 67 20 74 | primitive.cases.by.stipulating.t |
| 109c0 | 68 61 74 0a 0a 20 20 20 2a 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 6e 75 6d 65 72 61 6c 73 | hat.....*.the.values.of.numerals |
| 109e0 | 20 61 72 65 20 74 68 65 20 6e 75 6d 62 65 72 73 20 74 68 61 74 20 74 68 65 79 20 6e 61 6d 65 2c | .are.the.numbers.that.they.name, |
| 10a00 | 0a 0a 20 20 20 2a 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 62 75 69 6c 74 2d 69 6e 20 6f 70 | .....*.the.values.of.built-in.op |
| 10a20 | 65 72 61 74 6f 72 73 20 61 72 65 20 74 68 65 20 6d 61 63 68 69 6e 65 20 69 6e 73 74 72 75 63 74 | erators.are.the.machine.instruct |
| 10a40 | 69 6f 6e 0a 20 20 20 20 20 73 65 71 75 65 6e 63 65 73 20 74 68 61 74 20 63 61 72 72 79 20 6f 75 | ion......sequences.that.carry.ou |
| 10a60 | 74 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 | t.the.corresponding.operations,. |
| 10a80 | 61 6e 64 0a 0a 20 20 20 2a 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 6f 74 68 65 72 20 6e 61 | and.....*.the.values.of.other.na |
| 10aa0 | 6d 65 73 20 61 72 65 20 74 68 65 20 6f 62 6a 65 63 74 73 20 61 73 73 6f 63 69 61 74 65 64 20 77 | mes.are.the.objects.associated.w |
| 10ac0 | 69 74 68 20 74 68 6f 73 65 0a 20 20 20 20 20 6e 61 6d 65 73 20 69 6e 20 74 68 65 20 65 6e 76 69 | ith.those......names.in.the.envi |
| 10ae0 | 72 6f 6e 6d 65 6e 74 2e 0a 0a 0a 20 20 20 57 65 20 6d 61 79 20 72 65 67 61 72 64 20 74 68 65 20 | ronment.......We.may.regard.the. |
| 10b00 | 73 65 63 6f 6e 64 20 72 75 6c 65 20 61 73 20 61 20 73 70 65 63 69 61 6c 20 63 61 73 65 20 6f 66 | second.rule.as.a.special.case.of |
| 10b20 | 20 74 68 65 20 74 68 69 72 64 20 6f 6e 65 20 62 79 0a 73 74 69 70 75 6c 61 74 69 6e 67 20 74 68 | .the.third.one.by.stipulating.th |
| 10b40 | 61 74 20 73 79 6d 62 6f 6c 73 20 73 75 63 68 20 61 73 20 60 2b 27 20 61 6e 64 20 60 2a 27 20 61 | at.symbols.such.as.`+'.and.`*'.a |
| 10b60 | 72 65 20 61 6c 73 6f 20 69 6e 63 6c 75 64 65 64 20 69 6e 20 74 68 65 0a 67 6c 6f 62 61 6c 20 65 | re.also.included.in.the.global.e |
| 10b80 | 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 61 6e 64 20 61 72 65 20 61 73 73 6f 63 69 61 74 65 64 20 77 | nvironment,.and.are.associated.w |
| 10ba0 | 69 74 68 20 74 68 65 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 6d 61 63 68 69 6e 65 0a 69 6e 73 | ith.the.sequences.of.machine.ins |
| 10bc0 | 74 72 75 63 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 74 68 65 69 72 20 22 76 61 6c 75 65 73 | tructions.that.are.their."values |
| 10be0 | 2e 22 20 20 54 68 65 20 6b 65 79 20 70 6f 69 6e 74 20 74 6f 20 6e 6f 74 69 63 65 20 69 73 20 74 | ."..The.key.point.to.notice.is.t |
| 10c00 | 68 65 0a 72 6f 6c 65 20 6f 66 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 64 65 | he.role.of.the.environment.in.de |
| 10c20 | 74 65 72 6d 69 6e 69 6e 67 20 74 68 65 20 6d 65 61 6e 69 6e 67 20 6f 66 20 74 68 65 20 73 79 6d | termining.the.meaning.of.the.sym |
| 10c40 | 62 6f 6c 73 20 69 6e 0a 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 49 6e 20 61 6e 20 69 6e 74 65 | bols.in.expressions...In.an.inte |
| 10c60 | 72 61 63 74 69 76 65 20 6c 61 6e 67 75 61 67 65 20 73 75 63 68 20 61 73 20 4c 69 73 70 2c 20 69 | ractive.language.such.as.Lisp,.i |
| 10c80 | 74 20 69 73 0a 6d 65 61 6e 69 6e 67 6c 65 73 73 20 74 6f 20 73 70 65 61 6b 20 6f 66 20 74 68 65 | t.is.meaningless.to.speak.of.the |
| 10ca0 | 20 76 61 6c 75 65 20 6f 66 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 73 75 63 68 20 61 73 20 | .value.of.an.expression.such.as. |
| 10cc0 | 60 28 2b 20 78 20 31 29 27 0a 77 69 74 68 6f 75 74 20 73 70 65 63 69 66 79 69 6e 67 20 61 6e 79 | `(+.x.1)'.without.specifying.any |
| 10ce0 | 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 | .information.about.the.environme |
| 10d00 | 6e 74 20 74 68 61 74 20 77 6f 75 6c 64 0a 70 72 6f 76 69 64 65 20 61 20 6d 65 61 6e 69 6e 67 20 | nt.that.would.provide.a.meaning. |
| 10d20 | 66 6f 72 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 78 27 20 28 6f 72 20 65 76 65 6e 20 66 6f 72 20 | for.the.symbol.`x'.(or.even.for. |
| 10d40 | 74 68 65 20 73 79 6d 62 6f 6c 20 60 2b 27 29 2e 20 20 41 73 0a 77 65 20 73 68 61 6c 6c 20 73 65 | the.symbol.`+')...As.we.shall.se |
| 10d60 | 65 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 2c 20 74 68 65 20 67 65 6e 65 | e.in.*Note.Chapter.3::,.the.gene |
| 10d80 | 72 61 6c 20 6e 6f 74 69 6f 6e 20 6f 66 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 73 | ral.notion.of.the.environment.as |
| 10da0 | 20 70 72 6f 76 69 64 69 6e 67 20 61 20 63 6f 6e 74 65 78 74 20 69 6e 20 77 68 69 63 68 20 65 76 | .providing.a.context.in.which.ev |
| 10dc0 | 61 6c 75 61 74 69 6f 6e 20 74 61 6b 65 73 20 70 6c 61 63 65 20 77 69 6c 6c 0a 70 6c 61 79 20 61 | aluation.takes.place.will.play.a |
| 10de0 | 6e 20 69 6d 70 6f 72 74 61 6e 74 20 72 6f 6c 65 20 69 6e 20 6f 75 72 20 75 6e 64 65 72 73 74 61 | n.important.role.in.our.understa |
| 10e00 | 6e 64 69 6e 67 20 6f 66 20 70 72 6f 67 72 61 6d 20 65 78 65 63 75 74 69 6f 6e 2e 0a 0a 20 20 20 | nding.of.program.execution...... |
| 10e20 | 4e 6f 74 69 63 65 20 74 68 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 20 | Notice.that.the.evaluation.rule. |
| 10e40 | 67 69 76 65 6e 20 61 62 6f 76 65 20 64 6f 65 73 20 6e 6f 74 20 68 61 6e 64 6c 65 0a 64 65 66 69 | given.above.does.not.handle.defi |
| 10e60 | 6e 69 74 69 6f 6e 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 65 76 61 6c 75 61 74 69 | nitions...For.instance,.evaluati |
| 10e80 | 6e 67 20 60 28 64 65 66 69 6e 65 20 78 20 33 29 27 20 64 6f 65 73 20 6e 6f 74 20 61 70 70 6c 79 | ng.`(define.x.3)'.does.not.apply |
| 10ea0 | 0a 60 64 65 66 69 6e 65 27 20 74 6f 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 2c 20 6f 6e 65 20 | .`define'.to.two.arguments,.one. |
| 10ec0 | 6f 66 20 77 68 69 63 68 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 73 79 6d | of.which.is.the.value.of.the.sym |
| 10ee0 | 62 6f 6c 20 60 78 27 0a 61 6e 64 20 74 68 65 20 6f 74 68 65 72 20 6f 66 20 77 68 69 63 68 20 69 | bol.`x'.and.the.other.of.which.i |
| 10f00 | 73 20 33 2c 20 73 69 6e 63 65 20 74 68 65 20 70 75 72 70 6f 73 65 20 6f 66 20 74 68 65 20 60 64 | s.3,.since.the.purpose.of.the.`d |
| 10f20 | 65 66 69 6e 65 27 20 69 73 0a 70 72 65 63 69 73 65 6c 79 20 74 6f 20 61 73 73 6f 63 69 61 74 65 | efine'.is.precisely.to.associate |
| 10f40 | 20 60 78 27 20 77 69 74 68 20 61 20 76 61 6c 75 65 2e 20 20 28 54 68 61 74 20 69 73 2c 20 60 28 | .`x'.with.a.value...(That.is,.`( |
| 10f60 | 64 65 66 69 6e 65 20 78 20 33 29 27 20 69 73 0a 6e 6f 74 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f | define.x.3)'.is.not.a.combinatio |
| 10f80 | 6e 2e 29 0a 0a 20 20 20 53 75 63 68 20 65 78 63 65 70 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 67 | n.).....Such.exceptions.to.the.g |
| 10fa0 | 65 6e 65 72 61 6c 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 20 61 72 65 20 63 61 6c 6c 65 | eneral.evaluation.rule.are.calle |
| 10fc0 | 64 20 66 6f 72 6d 73 0a 22 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 22 2e 20 20 60 44 65 66 69 6e | d.forms."special.forms"...`Defin |
| 10fe0 | 65 27 20 69 73 20 74 68 65 20 6f 6e 6c 79 20 65 78 61 6d 70 6c 65 20 6f 66 20 61 20 73 70 65 63 | e'.is.the.only.example.of.a.spec |
| 11000 | 69 61 6c 20 66 6f 72 6d 20 74 68 61 74 0a 77 65 20 68 61 76 65 20 73 65 65 6e 20 73 6f 20 66 61 | ial.form.that.we.have.seen.so.fa |
| 11020 | 72 2c 20 62 75 74 20 77 65 20 77 69 6c 6c 20 6d 65 65 74 20 6f 74 68 65 72 73 20 73 68 6f 72 74 | r,.but.we.will.meet.others.short |
| 11040 | 6c 79 2e 20 20 45 61 63 68 20 73 70 65 63 69 61 6c 0a 66 6f 72 6d 20 68 61 73 20 69 74 73 20 6f | ly...Each.special.form.has.its.o |
| 11060 | 77 6e 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 2e 20 54 68 65 20 76 61 72 69 6f 75 73 20 | wn.evaluation.rule..The.various. |
| 11080 | 6b 69 6e 64 73 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 0a 28 65 61 63 68 20 77 69 74 68 20 | kinds.of.expressions.(each.with. |
| 110a0 | 69 74 73 20 61 73 73 6f 63 69 61 74 65 64 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 29 20 | its.associated.evaluation.rule). |
| 110c0 | 63 6f 6e 73 74 69 74 75 74 65 20 74 68 65 20 73 79 6e 74 61 78 20 6f 66 20 74 68 65 0a 70 72 6f | constitute.the.syntax.of.the.pro |
| 110e0 | 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 20 20 49 6e 20 63 6f 6d 70 61 72 69 73 6f | gramming.language...In.compariso |
| 11100 | 6e 20 77 69 74 68 20 6d 6f 73 74 20 6f 74 68 65 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 0a 6c 61 | n.with.most.other.programming.la |
| 11120 | 6e 67 75 61 67 65 73 2c 20 4c 69 73 70 20 68 61 73 20 61 20 76 65 72 79 20 73 69 6d 70 6c 65 20 | nguages,.Lisp.has.a.very.simple. |
| 11140 | 73 79 6e 74 61 78 3b 20 74 68 61 74 20 69 73 2c 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 | syntax;.that.is,.the.evaluation. |
| 11160 | 72 75 6c 65 0a 66 6f 72 20 65 78 70 72 65 73 73 69 6f 6e 73 20 63 61 6e 20 62 65 20 64 65 73 63 | rule.for.expressions.can.be.desc |
| 11180 | 72 69 62 65 64 20 62 79 20 61 20 73 69 6d 70 6c 65 20 67 65 6e 65 72 61 6c 20 72 75 6c 65 20 74 | ribed.by.a.simple.general.rule.t |
| 111a0 | 6f 67 65 74 68 65 72 20 77 69 74 68 0a 73 70 65 63 69 61 6c 69 7a 65 64 20 72 75 6c 65 73 20 66 | ogether.with.specialized.rules.f |
| 111c0 | 6f 72 20 61 20 73 6d 61 6c 6c 20 6e 75 6d 62 65 72 20 6f 66 20 73 70 65 63 69 61 6c 20 66 6f 72 | or.a.small.number.of.special.for |
| 111e0 | 6d 73 2e 28 32 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 | ms.(2).....----------.Footnotes. |
| 11200 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 74 20 6d 61 79 20 73 65 65 6d 20 73 | ----------.....(1).It.may.seem.s |
| 11220 | 74 72 61 6e 67 65 20 74 68 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 20 | trange.that.the.evaluation.rule. |
| 11240 | 73 61 79 73 2c 20 61 73 20 70 61 72 74 20 6f 66 0a 74 68 65 20 66 69 72 73 74 20 73 74 65 70 2c | says,.as.part.of.the.first.step, |
| 11260 | 20 74 68 61 74 20 77 65 20 73 68 6f 75 6c 64 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 6c 65 66 | .that.we.should.evaluate.the.lef |
| 11280 | 74 6d 6f 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 61 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 2c 20 | tmost.element.of.a.combination,. |
| 112a0 | 73 69 6e 63 65 20 61 74 20 74 68 69 73 20 70 6f 69 6e 74 20 74 68 61 74 20 63 61 6e 20 6f 6e 6c | since.at.this.point.that.can.onl |
| 112c0 | 79 20 62 65 20 61 6e 20 6f 70 65 72 61 74 6f 72 20 73 75 63 68 20 61 73 0a 60 2b 27 20 6f 72 20 | y.be.an.operator.such.as.`+'.or. |
| 112e0 | 60 2a 27 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 20 62 75 69 6c 74 2d 69 6e 20 70 72 69 6d | `*'.representing.a.built-in.prim |
| 11300 | 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 73 75 63 68 20 61 73 20 61 64 64 69 74 69 6f 6e | itive.procedure.such.as.addition |
| 11320 | 0a 6f 72 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 2e 20 20 57 65 20 77 69 6c 6c 20 73 65 65 | .or.multiplication...We.will.see |
| 11340 | 20 6c 61 74 65 72 20 74 68 61 74 20 69 74 20 69 73 20 75 73 65 66 75 6c 20 74 6f 20 62 65 20 61 | .later.that.it.is.useful.to.be.a |
| 11360 | 62 6c 65 20 74 6f 0a 77 6f 72 6b 20 77 69 74 68 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 77 68 | ble.to.work.with.combinations.wh |
| 11380 | 6f 73 65 20 6f 70 65 72 61 74 6f 72 73 20 61 72 65 20 74 68 65 6d 73 65 6c 76 65 73 20 63 6f 6d | ose.operators.are.themselves.com |
| 113a0 | 70 6f 75 6e 64 0a 65 78 70 72 65 73 73 69 6f 6e 73 2e 0a 0a 20 20 20 28 32 29 20 53 70 65 63 69 | pound.expressions......(2).Speci |
| 113c0 | 61 6c 20 73 79 6e 74 61 63 74 69 63 20 66 6f 72 6d 73 20 74 68 61 74 20 61 72 65 20 73 69 6d 70 | al.syntactic.forms.that.are.simp |
| 113e0 | 6c 79 20 63 6f 6e 76 65 6e 69 65 6e 74 20 61 6c 74 65 72 6e 61 74 69 76 65 0a 73 75 72 66 61 63 | ly.convenient.alternative.surfac |
| 11400 | 65 20 73 74 72 75 63 74 75 72 65 73 20 66 6f 72 20 74 68 69 6e 67 73 20 74 68 61 74 20 63 61 6e | e.structures.for.things.that.can |
| 11420 | 20 62 65 20 77 72 69 74 74 65 6e 20 69 6e 20 6d 6f 72 65 20 75 6e 69 66 6f 72 6d 20 77 61 79 73 | .be.written.in.more.uniform.ways |
| 11440 | 0a 61 72 65 20 73 6f 6d 65 74 69 6d 65 73 20 63 61 6c 6c 65 64 20 22 73 79 6e 74 61 63 74 69 63 | .are.sometimes.called."syntactic |
| 11460 | 20 73 75 67 61 72 22 2c 20 74 6f 20 75 73 65 20 61 20 70 68 72 61 73 65 20 63 6f 69 6e 65 64 20 | .sugar",.to.use.a.phrase.coined. |
| 11480 | 62 79 20 50 65 74 65 72 0a 4c 61 6e 64 69 6e 2e 20 20 49 6e 20 63 6f 6d 70 61 72 69 73 6f 6e 20 | by.Peter.Landin...In.comparison. |
| 114a0 | 77 69 74 68 20 75 73 65 72 73 20 6f 66 20 6f 74 68 65 72 20 6c 61 6e 67 75 61 67 65 73 2c 20 4c | with.users.of.other.languages,.L |
| 114c0 | 69 73 70 20 70 72 6f 67 72 61 6d 6d 65 72 73 2c 0a 61 73 20 61 20 72 75 6c 65 2c 20 61 72 65 20 | isp.programmers,.as.a.rule,.are. |
| 114e0 | 6c 65 73 73 20 63 6f 6e 63 65 72 6e 65 64 20 77 69 74 68 20 6d 61 74 74 65 72 73 20 6f 66 20 73 | less.concerned.with.matters.of.s |
| 11500 | 79 6e 74 61 78 2e 20 20 28 42 79 20 63 6f 6e 74 72 61 73 74 2c 0a 65 78 61 6d 69 6e 65 20 61 6e | yntax...(By.contrast,.examine.an |
| 11520 | 79 20 50 61 73 63 61 6c 20 6d 61 6e 75 61 6c 20 61 6e 64 20 6e 6f 74 69 63 65 20 68 6f 77 20 6d | y.Pascal.manual.and.notice.how.m |
| 11540 | 75 63 68 20 6f 66 20 69 74 20 69 73 20 64 65 76 6f 74 65 64 20 74 6f 0a 64 65 73 63 72 69 70 74 | uch.of.it.is.devoted.to.descript |
| 11560 | 69 6f 6e 73 20 6f 66 20 73 79 6e 74 61 78 2e 29 20 20 54 68 69 73 20 64 69 73 64 61 69 6e 20 66 | ions.of.syntax.)..This.disdain.f |
| 11580 | 6f 72 20 73 79 6e 74 61 78 20 69 73 20 64 75 65 20 70 61 72 74 6c 79 20 74 6f 20 74 68 65 0a 66 | or.syntax.is.due.partly.to.the.f |
| 115a0 | 6c 65 78 69 62 69 6c 69 74 79 20 6f 66 20 4c 69 73 70 2c 20 77 68 69 63 68 20 6d 61 6b 65 73 20 | lexibility.of.Lisp,.which.makes. |
| 115c0 | 69 74 20 65 61 73 79 20 74 6f 20 63 68 61 6e 67 65 20 73 75 72 66 61 63 65 20 73 79 6e 74 61 78 | it.easy.to.change.surface.syntax |
| 115e0 | 2c 20 61 6e 64 0a 70 61 72 74 6c 79 20 74 6f 20 74 68 65 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 | ,.and.partly.to.the.observation. |
| 11600 | 74 68 61 74 20 6d 61 6e 79 20 22 63 6f 6e 76 65 6e 69 65 6e 74 22 20 73 79 6e 74 61 63 74 69 63 | that.many."convenient".syntactic |
| 11620 | 20 63 6f 6e 73 74 72 75 63 74 73 2c 0a 77 68 69 63 68 20 6d 61 6b 65 20 74 68 65 20 6c 61 6e 67 | .constructs,.which.make.the.lang |
| 11640 | 75 61 67 65 20 6c 65 73 73 20 75 6e 69 66 6f 72 6d 2c 20 65 6e 64 20 75 70 20 63 61 75 73 69 6e | uage.less.uniform,.end.up.causin |
| 11660 | 67 20 6d 6f 72 65 20 74 72 6f 75 62 6c 65 20 74 68 61 6e 0a 74 68 65 79 20 61 72 65 20 77 6f 72 | g.more.trouble.than.they.are.wor |
| 11680 | 74 68 20 77 68 65 6e 20 70 72 6f 67 72 61 6d 73 20 62 65 63 6f 6d 65 20 6c 61 72 67 65 20 61 6e | th.when.programs.become.large.an |
| 116a0 | 64 20 63 6f 6d 70 6c 65 78 2e 20 20 49 6e 20 74 68 65 20 77 6f 72 64 73 20 6f 66 0a 41 6c 61 6e | d.complex...In.the.words.of.Alan |
| 116c0 | 20 50 65 72 6c 69 73 2c 20 22 53 79 6e 74 61 63 74 69 63 20 73 75 67 61 72 20 63 61 75 73 65 73 | .Perlis,."Syntactic.sugar.causes |
| 116e0 | 20 63 61 6e 63 65 72 20 6f 66 20 74 68 65 20 73 65 6d 69 63 6f 6c 6f 6e 2e 22 0a 0a 1f 0a 46 69 | .cancer.of.the.semicolon."....Fi |
| 11700 | 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 31 2d 34 2c 20 20 4e 65 | le:.sicp.info,..Node:.1-1-4,..Ne |
| 11720 | 78 74 3a 20 31 2d 31 2d 35 2c 20 20 50 72 65 76 3a 20 31 2d 31 2d 33 2c 20 20 55 70 3a 20 31 2d | xt:.1-1-5,..Prev:.1-1-3,..Up:.1- |
| 11740 | 31 0a 0a 31 2e 31 2e 34 20 43 6f 6d 70 6f 75 6e 64 20 50 72 6f 63 65 64 75 72 65 73 0a 2d 2d 2d | 1..1.1.4.Compound.Procedures.--- |
| 11760 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 65 20 68 61 76 65 20 | ----------------------..We.have. |
| 11780 | 69 64 65 6e 74 69 66 69 65 64 20 69 6e 20 4c 69 73 70 20 73 6f 6d 65 20 6f 66 20 74 68 65 20 65 | identified.in.Lisp.some.of.the.e |
| 117a0 | 6c 65 6d 65 6e 74 73 20 74 68 61 74 20 6d 75 73 74 20 61 70 70 65 61 72 20 69 6e 20 61 6e 79 0a | lements.that.must.appear.in.any. |
| 117c0 | 70 6f 77 65 72 66 75 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 3a 0a 0a | powerful.programming.language:.. |
| 117e0 | 20 20 20 2a 20 4e 75 6d 62 65 72 73 20 61 6e 64 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 | ...*.Numbers.and.arithmetic.oper |
| 11800 | 61 74 69 6f 6e 73 20 61 72 65 20 70 72 69 6d 69 74 69 76 65 20 64 61 74 61 20 61 6e 64 0a 20 20 | ations.are.primitive.data.and... |
| 11820 | 20 20 20 70 72 6f 63 65 64 75 72 65 73 2e 0a 0a 20 20 20 2a 20 4e 65 73 74 69 6e 67 20 6f 66 20 | ...procedures......*.Nesting.of. |
| 11840 | 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 70 72 6f 76 69 64 65 73 20 61 20 6d 65 61 6e 73 20 6f 66 | combinations.provides.a.means.of |
| 11860 | 20 63 6f 6d 62 69 6e 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 2a 20 44 65 66 | .combining.operations......*.Def |
| 11880 | 69 6e 69 74 69 6f 6e 73 20 74 68 61 74 20 61 73 73 6f 63 69 61 74 65 20 6e 61 6d 65 73 20 77 69 | initions.that.associate.names.wi |
| 118a0 | 74 68 20 76 61 6c 75 65 73 20 70 72 6f 76 69 64 65 20 61 20 6c 69 6d 69 74 65 64 0a 20 20 20 20 | th.values.provide.a.limited..... |
| 118c0 | 20 6d 65 61 6e 73 20 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 2e 0a 0a 0a 20 20 20 4e 6f 77 20 | .means.of.abstraction.......Now. |
| 118e0 | 77 65 20 77 69 6c 6c 20 6c 65 61 72 6e 20 61 62 6f 75 74 20 22 70 72 6f 63 65 64 75 72 65 20 64 | we.will.learn.about."procedure.d |
| 11900 | 65 66 69 6e 69 74 69 6f 6e 73 22 2c 20 61 20 6d 75 63 68 20 6d 6f 72 65 20 70 6f 77 65 72 66 75 | efinitions",.a.much.more.powerfu |
| 11920 | 6c 0a 61 62 73 74 72 61 63 74 69 6f 6e 20 74 65 63 68 6e 69 71 75 65 20 62 79 20 77 68 69 63 68 | l.abstraction.technique.by.which |
| 11940 | 20 61 20 63 6f 6d 70 6f 75 6e 64 20 6f 70 65 72 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 67 69 76 | .a.compound.operation.can.be.giv |
| 11960 | 65 6e 20 61 20 6e 61 6d 65 0a 61 6e 64 20 74 68 65 6e 20 72 65 66 65 72 72 65 64 20 74 6f 20 61 | en.a.name.and.then.referred.to.a |
| 11980 | 73 20 61 20 75 6e 69 74 2e 0a 0a 20 20 20 57 65 20 62 65 67 69 6e 20 62 79 20 65 78 61 6d 69 6e | s.a.unit......We.begin.by.examin |
| 119a0 | 69 6e 67 20 68 6f 77 20 74 6f 20 65 78 70 72 65 73 73 20 74 68 65 20 69 64 65 61 20 6f 66 20 22 | ing.how.to.express.the.idea.of." |
| 119c0 | 73 71 75 61 72 69 6e 67 2e 22 20 20 57 65 0a 6d 69 67 68 74 20 73 61 79 2c 20 22 54 6f 20 73 71 | squaring."..We.might.say,."To.sq |
| 119e0 | 75 61 72 65 20 73 6f 6d 65 74 68 69 6e 67 2c 20 6d 75 6c 74 69 70 6c 79 20 69 74 20 62 79 20 69 | uare.something,.multiply.it.by.i |
| 11a00 | 74 73 65 6c 66 2e 22 20 20 54 68 69 73 20 69 73 0a 65 78 70 72 65 73 73 65 64 20 69 6e 20 6f 75 | tself."..This.is.expressed.in.ou |
| 11a20 | 72 20 6c 61 6e 67 75 61 67 65 20 61 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 | r.language.as.......(define.(squ |
| 11a40 | 61 72 65 20 78 29 20 28 2a 20 78 20 78 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 75 6e 64 65 72 | are.x).(*.x.x)).....We.can.under |
| 11a60 | 73 74 61 6e 64 20 74 68 69 73 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 77 61 79 3a | stand.this.in.the.following.way: |
| 11a80 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 20 20 20 78 29 20 20 20 20 | .......(define.(square....x).... |
| 11aa0 | 20 20 20 20 20 28 2a 20 20 20 20 20 20 78 20 20 20 20 20 20 20 20 20 78 29 29 0a 20 20 20 20 20 | .....(*......x.........x))...... |
| 11ac0 | 20 20 7c 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 7c | ..|........|.......|...........| |
| 11ae0 | 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 54 6f 20 20 20 20 20 73 | ......|.........|.......To.....s |
| 11b00 | 71 75 61 72 65 20 20 73 6f 6d 65 74 68 69 6e 67 2c 20 20 6d 75 6c 74 69 70 6c 79 20 20 69 74 20 | quare..something,..multiply..it. |
| 11b20 | 20 62 79 20 20 69 74 73 65 6c 66 2e 0a 0a 20 20 20 57 65 20 68 61 76 65 20 68 65 72 65 20 61 20 | .by..itself......We.have.here.a. |
| 11b40 | 22 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 22 2c 20 77 68 69 63 68 20 68 61 73 20 | "compound.procedure",.which.has. |
| 11b60 | 62 65 65 6e 20 67 69 76 65 6e 20 74 68 65 20 6e 61 6d 65 0a 60 73 71 75 61 72 65 27 2e 20 20 54 | been.given.the.name.`square'...T |
| 11b80 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 20 6f 70 65 72 | he.procedure.represents.the.oper |
| 11ba0 | 61 74 69 6f 6e 20 6f 66 20 6d 75 6c 74 69 70 6c 79 69 6e 67 0a 73 6f 6d 65 74 68 69 6e 67 20 62 | ation.of.multiplying.something.b |
| 11bc0 | 79 20 69 74 73 65 6c 66 2e 20 20 54 68 65 20 74 68 69 6e 67 20 74 6f 20 62 65 20 6d 75 6c 74 69 | y.itself...The.thing.to.be.multi |
| 11be0 | 70 6c 69 65 64 20 69 73 20 67 69 76 65 6e 20 61 20 6c 6f 63 61 6c 20 6e 61 6d 65 2c 0a 60 78 27 | plied.is.given.a.local.name,.`x' |
| 11c00 | 2c 20 77 68 69 63 68 20 70 6c 61 79 73 20 74 68 65 20 73 61 6d 65 20 72 6f 6c 65 20 74 68 61 74 | ,.which.plays.the.same.role.that |
| 11c20 | 20 61 20 70 72 6f 6e 6f 75 6e 20 70 6c 61 79 73 20 69 6e 20 6e 61 74 75 72 61 6c 0a 6c 61 6e 67 | .a.pronoun.plays.in.natural.lang |
| 11c40 | 75 61 67 65 2e 20 20 45 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e | uage...Evaluating.the.definition |
| 11c60 | 20 63 72 65 61 74 65 73 20 74 68 69 73 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 | .creates.this.compound.procedure |
| 11c80 | 0a 61 6e 64 20 61 73 73 6f 63 69 61 74 65 73 20 69 74 20 77 69 74 68 20 74 68 65 20 6e 61 6d 65 | .and.associates.it.with.the.name |
| 11ca0 | 20 60 73 71 75 61 72 65 27 2e 28 31 29 0a 0a 20 20 20 54 68 65 20 67 65 6e 65 72 61 6c 20 66 6f | .`square'.(1).....The.general.fo |
| 11cc0 | 72 6d 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 73 0a | rm.of.a.procedure.definition.is. |
| 11ce0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 3c 4e 41 4d 45 3e 20 3c 46 4f 52 4d 41 4c 20 50 41 | ......(define.(<NAME>.<FORMAL.PA |
| 11d00 | 52 41 4d 45 54 45 52 53 3e 29 20 3c 42 4f 44 59 3e 29 0a 0a 20 20 20 54 68 65 20 3c 4e 41 4d 45 | RAMETERS>).<BODY>).....The.<NAME |
| 11d20 | 3e 20 69 73 20 61 20 73 79 6d 62 6f 6c 20 74 6f 20 62 65 20 61 73 73 6f 63 69 61 74 65 64 20 77 | >.is.a.symbol.to.be.associated.w |
| 11d40 | 69 74 68 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 64 65 66 69 6e 69 74 69 6f 6e 20 69 6e 20 | ith.the.procedure.definition.in. |
| 11d60 | 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 28 32 29 20 54 68 65 20 3c 46 4f 52 4d 41 4c 20 | the.environment.(2).The.<FORMAL. |
| 11d80 | 50 41 52 41 4d 45 54 45 52 53 3e 20 61 72 65 20 74 68 65 20 6e 61 6d 65 73 0a 75 73 65 64 20 77 | PARAMETERS>.are.the.names.used.w |
| 11da0 | 69 74 68 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 | ithin.the.body.of.the.procedure. |
| 11dc0 | 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 0a 61 72 | to.refer.to.the.corresponding.ar |
| 11de0 | 67 75 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 65 20 3c | guments.of.the.procedure...The.< |
| 11e00 | 42 4f 44 59 3e 20 69 73 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 77 69 6c 6c | BODY>.is.an.expression.that.will |
| 11e20 | 0a 79 69 65 6c 64 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 | .yield.the.value.of.the.procedur |
| 11e40 | 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 77 68 65 6e 20 74 68 65 20 66 6f 72 6d 61 6c 20 70 61 | e.application.when.the.formal.pa |
| 11e60 | 72 61 6d 65 74 65 72 73 0a 61 72 65 20 72 65 70 6c 61 63 65 64 20 62 79 20 74 68 65 20 61 63 74 | rameters.are.replaced.by.the.act |
| 11e80 | 75 61 6c 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 77 68 69 63 68 20 74 68 65 20 70 72 6f 63 65 | ual.arguments.to.which.the.proce |
| 11ea0 | 64 75 72 65 20 69 73 0a 61 70 70 6c 69 65 64 2e 28 33 29 20 20 54 68 65 20 3c 4e 41 4d 45 3e 20 | dure.is.applied.(3)..The.<NAME>. |
| 11ec0 | 61 6e 64 20 74 68 65 20 3c 46 4f 52 4d 41 4c 20 50 41 52 41 4d 45 54 45 52 53 3e 20 61 72 65 20 | and.the.<FORMAL.PARAMETERS>.are. |
| 11ee0 | 67 72 6f 75 70 65 64 20 77 69 74 68 69 6e 0a 70 61 72 65 6e 74 68 65 73 65 73 2c 20 6a 75 73 74 | grouped.within.parentheses,.just |
| 11f00 | 20 61 73 20 74 68 65 79 20 77 6f 75 6c 64 20 62 65 20 69 6e 20 61 6e 20 61 63 74 75 61 6c 20 63 | .as.they.would.be.in.an.actual.c |
| 11f20 | 61 6c 6c 20 74 6f 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 62 65 69 6e 67 20 64 65 66 69 6e | all.to.the.procedure.being.defin |
| 11f40 | 65 64 2e 0a 0a 20 20 20 48 61 76 69 6e 67 20 64 65 66 69 6e 65 64 20 60 73 71 75 61 72 65 27 2c | ed......Having.defined.`square', |
| 11f60 | 20 77 65 20 63 61 6e 20 6e 6f 77 20 75 73 65 20 69 74 3a 0a 0a 20 20 20 20 20 28 73 71 75 61 72 | .we.can.now.use.it:.......(squar |
| 11f80 | 65 20 32 31 29 0a 20 20 20 20 20 34 34 31 0a 0a 20 20 20 20 20 28 73 71 75 61 72 65 20 28 2b 20 | e.21)......441.......(square.(+. |
| 11fa0 | 32 20 35 29 29 0a 20 20 20 20 20 34 39 0a 0a 20 20 20 20 20 28 73 71 75 61 72 65 20 28 73 71 75 | 2.5))......49.......(square.(squ |
| 11fc0 | 61 72 65 20 33 29 29 0a 20 20 20 20 20 38 31 0a 0a 20 20 20 57 65 20 63 61 6e 20 61 6c 73 6f 20 | are.3))......81.....We.can.also. |
| 11fe0 | 75 73 65 20 60 73 71 75 61 72 65 27 20 61 73 20 61 20 62 75 69 6c 64 69 6e 67 20 62 6c 6f 63 6b | use.`square'.as.a.building.block |
| 12000 | 20 69 6e 20 64 65 66 69 6e 69 6e 67 20 6f 74 68 65 72 0a 70 72 6f 63 65 64 75 72 65 73 2e 20 20 | .in.defining.other.procedures... |
| 12020 | 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 78 5e 32 20 2b 20 79 5e 32 20 63 61 6e 20 62 65 20 65 78 | For.example,.x^2.+.y^2.can.be.ex |
| 12040 | 70 72 65 73 73 65 64 20 61 73 0a 0a 20 20 20 20 20 28 2b 20 28 73 71 75 61 72 65 20 78 29 20 28 | pressed.as.......(+.(square.x).( |
| 12060 | 73 71 75 61 72 65 20 79 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 65 61 73 69 6c 79 20 64 65 66 | square.y)).....We.can.easily.def |
| 12080 | 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 | ine.a.procedure.`sum-of-squares' |
| 120a0 | 20 74 68 61 74 2c 20 67 69 76 65 6e 20 61 6e 79 20 74 77 6f 0a 6e 75 6d 62 65 72 73 20 61 73 20 | .that,.given.any.two.numbers.as. |
| 120c0 | 61 72 67 75 6d 65 6e 74 73 2c 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 73 75 6d 20 6f 66 20 74 | arguments,.produces.the.sum.of.t |
| 120e0 | 68 65 69 72 20 73 71 75 61 72 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d | heir.squares:.......(define.(sum |
| 12100 | 2d 6f 66 2d 73 71 75 61 72 65 73 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 2b 20 28 73 71 75 61 | -of-squares.x.y)........(+.(squa |
| 12120 | 72 65 20 78 29 20 28 73 71 75 61 72 65 20 79 29 29 29 0a 20 20 20 20 20 28 73 75 6d 2d 6f 66 2d | re.x).(square.y)))......(sum-of- |
| 12140 | 73 71 75 61 72 65 73 20 33 20 34 29 0a 20 20 20 20 20 32 35 0a 0a 20 20 20 4e 6f 77 20 77 65 20 | squares.3.4)......25.....Now.we. |
| 12160 | 63 61 6e 20 75 73 65 20 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 20 61 73 20 61 20 62 75 | can.use.`sum-of-squares'.as.a.bu |
| 12180 | 69 6c 64 69 6e 67 20 62 6c 6f 63 6b 20 69 6e 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 0a 66 75 72 | ilding.block.in.constructing.fur |
| 121a0 | 74 68 65 72 20 70 72 6f 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | ther.procedures:.......(define.( |
| 121c0 | 66 20 61 29 0a 20 20 20 20 20 20 20 28 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 20 28 2b 20 61 | f.a)........(sum-of-squares.(+.a |
| 121e0 | 20 31 29 20 28 2a 20 61 20 32 29 29 29 0a 0a 20 20 20 20 20 28 66 20 35 29 0a 20 20 20 20 20 31 | .1).(*.a.2))).......(f.5)......1 |
| 12200 | 33 36 0a 0a 20 20 20 43 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 75 | 36.....Compound.procedures.are.u |
| 12220 | 73 65 64 20 69 6e 20 65 78 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20 77 61 79 20 61 73 20 70 | sed.in.exactly.the.same.way.as.p |
| 12240 | 72 69 6d 69 74 69 76 65 0a 70 72 6f 63 65 64 75 72 65 73 2e 20 20 49 6e 64 65 65 64 2c 20 6f 6e | rimitive.procedures...Indeed,.on |
| 12260 | 65 20 63 6f 75 6c 64 20 6e 6f 74 20 74 65 6c 6c 20 62 79 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 74 | e.could.not.tell.by.looking.at.t |
| 12280 | 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 0a 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 | he.definition.of.`sum-of-squares |
| 122a0 | 27 20 67 69 76 65 6e 20 61 62 6f 76 65 20 77 68 65 74 68 65 72 20 60 73 71 75 61 72 65 27 20 77 | '.given.above.whether.`square'.w |
| 122c0 | 61 73 20 62 75 69 6c 74 20 69 6e 74 6f 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 72 2c 20 6c | as.built.into.the.interpreter,.l |
| 122e0 | 69 6b 65 20 60 2b 27 20 61 6e 64 20 60 2a 27 2c 20 6f 72 20 64 65 66 69 6e 65 64 20 61 73 20 61 | ike.`+'.and.`*',.or.defined.as.a |
| 12300 | 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d | .compound.procedure......------- |
| 12320 | 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 | ---.Footnotes.----------.....(1) |
| 12340 | 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 74 68 65 72 65 20 61 72 65 20 74 77 6f 20 64 69 66 66 | .Observe.that.there.are.two.diff |
| 12360 | 65 72 65 6e 74 20 6f 70 65 72 61 74 69 6f 6e 73 20 62 65 69 6e 67 20 63 6f 6d 62 69 6e 65 64 0a | erent.operations.being.combined. |
| 12380 | 68 65 72 65 3a 20 77 65 20 61 72 65 20 63 72 65 61 74 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 | here:.we.are.creating.the.proced |
| 123a0 | 75 72 65 2c 20 61 6e 64 20 77 65 20 61 72 65 20 67 69 76 69 6e 67 20 69 74 20 74 68 65 20 6e 61 | ure,.and.we.are.giving.it.the.na |
| 123c0 | 6d 65 0a 60 73 71 75 61 72 65 27 2e 20 20 49 74 20 69 73 20 70 6f 73 73 69 62 6c 65 2c 20 69 6e | me.`square'...It.is.possible,.in |
| 123e0 | 64 65 65 64 20 69 6d 70 6f 72 74 61 6e 74 2c 20 74 6f 20 62 65 20 61 62 6c 65 20 74 6f 20 73 65 | deed.important,.to.be.able.to.se |
| 12400 | 70 61 72 61 74 65 0a 74 68 65 73 65 20 74 77 6f 20 6e 6f 74 69 6f 6e 73 2d 2d 74 6f 20 63 72 65 | parate.these.two.notions--to.cre |
| 12420 | 61 74 65 20 70 72 6f 63 65 64 75 72 65 73 20 77 69 74 68 6f 75 74 20 6e 61 6d 69 6e 67 20 74 68 | ate.procedures.without.naming.th |
| 12440 | 65 6d 2c 20 61 6e 64 20 74 6f 0a 67 69 76 65 20 6e 61 6d 65 73 20 74 6f 20 70 72 6f 63 65 64 75 | em,.and.to.give.names.to.procedu |
| 12460 | 72 65 73 20 74 68 61 74 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 63 72 65 61 74 | res.that.have.already.been.creat |
| 12480 | 65 64 2e 20 20 57 65 20 77 69 6c 6c 20 73 65 65 0a 68 6f 77 20 74 6f 20 64 6f 20 74 68 69 73 20 | ed...We.will.see.how.to.do.this. |
| 124a0 | 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 33 2d 32 3a 3a 2e 0a 0a 20 20 20 28 32 | in.section.*Note.1-3-2::......(2 |
| 124c0 | 29 20 54 68 72 6f 75 67 68 6f 75 74 20 74 68 69 73 20 62 6f 6f 6b 2c 20 77 65 20 77 69 6c 6c 20 | ).Throughout.this.book,.we.will. |
| 124e0 | 64 65 73 63 72 69 62 65 20 74 68 65 20 67 65 6e 65 72 61 6c 20 73 79 6e 74 61 78 20 6f 66 0a 65 | describe.the.general.syntax.of.e |
| 12500 | 78 70 72 65 73 73 69 6f 6e 73 20 62 79 20 75 73 69 6e 67 20 69 74 61 6c 69 63 20 73 79 6d 62 6f | xpressions.by.using.italic.symbo |
| 12520 | 6c 73 20 64 65 6c 69 6d 69 74 65 64 20 62 79 20 61 6e 67 6c 65 20 62 72 61 63 6b 65 74 73 2d 2d | ls.delimited.by.angle.brackets-- |
| 12540 | 65 2e 67 2e 2c 0a 3c 4e 41 4d 45 3e 2d 2d 74 6f 20 64 65 6e 6f 74 65 20 74 68 65 20 22 73 6c 6f | e.g.,.<NAME>--to.denote.the."slo |
| 12560 | 74 73 22 20 69 6e 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 62 65 20 66 69 6c 6c | ts".in.the.expression.to.be.fill |
| 12580 | 65 64 20 69 6e 20 77 68 65 6e 0a 73 75 63 68 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 | ed.in.when.such.an.expression.is |
| 125a0 | 20 61 63 74 75 61 6c 6c 79 20 75 73 65 64 2e 0a 0a 20 20 20 28 33 29 20 4d 6f 72 65 20 67 65 6e | .actually.used......(3).More.gen |
| 125c0 | 65 72 61 6c 6c 79 2c 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 | erally,.the.body.of.the.procedur |
| 125e0 | 65 20 63 61 6e 20 62 65 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 65 78 70 72 65 73 73 69 6f | e.can.be.a.sequence.of.expressio |
| 12600 | 6e 73 2e 20 20 49 6e 20 74 68 69 73 20 63 61 73 65 2c 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 | ns...In.this.case,.the.interpret |
| 12620 | 65 72 20 65 76 61 6c 75 61 74 65 73 20 65 61 63 68 20 65 78 70 72 65 73 73 69 6f 6e 0a 69 6e 20 | er.evaluates.each.expression.in. |
| 12640 | 74 68 65 20 73 65 71 75 65 6e 63 65 20 69 6e 20 74 75 72 6e 20 61 6e 64 20 72 65 74 75 72 6e 73 | the.sequence.in.turn.and.returns |
| 12660 | 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 66 69 6e 61 6c 20 65 78 70 72 65 73 73 69 | .the.value.of.the.final.expressi |
| 12680 | 6f 6e 0a 61 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 | on.as.the.value.of.the.procedure |
| 126a0 | 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f | .application.....File:.sicp.info |
| 126c0 | 2c 20 20 4e 6f 64 65 3a 20 31 2d 31 2d 35 2c 20 20 4e 65 78 74 3a 20 31 2d 31 2d 36 2c 20 20 50 | ,..Node:.1-1-5,..Next:.1-1-6,..P |
| 126e0 | 72 65 76 3a 20 31 2d 31 2d 34 2c 20 20 55 70 3a 20 31 2d 31 0a 0a 31 2e 31 2e 35 20 54 68 65 20 | rev:.1-1-4,..Up:.1-1..1.1.5.The. |
| 12700 | 53 75 62 73 74 69 74 75 74 69 6f 6e 20 4d 6f 64 65 6c 20 66 6f 72 20 50 72 6f 63 65 64 75 72 65 | Substitution.Model.for.Procedure |
| 12720 | 20 41 70 70 6c 69 63 61 74 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .Application.------------------- |
| 12740 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 12760 | 2d 2d 2d 0a 0a 54 6f 20 65 76 61 6c 75 61 74 65 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 77 | ---..To.evaluate.a.combination.w |
| 12780 | 68 6f 73 65 20 6f 70 65 72 61 74 6f 72 20 6e 61 6d 65 73 20 61 20 63 6f 6d 70 6f 75 6e 64 20 70 | hose.operator.names.a.compound.p |
| 127a0 | 72 6f 63 65 64 75 72 65 2c 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 72 20 66 6f 6c 6c 6f 77 | rocedure,.the.interpreter.follow |
| 127c0 | 73 20 6d 75 63 68 20 74 68 65 20 73 61 6d 65 20 70 72 6f 63 65 73 73 20 61 73 20 66 6f 72 20 63 | s.much.the.same.process.as.for.c |
| 127e0 | 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 77 68 6f 73 65 0a 6f 70 65 72 61 74 6f 72 73 20 6e 61 6d 65 | ombinations.whose.operators.name |
| 12800 | 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 2c 20 77 68 69 63 68 20 77 65 20 | .primitive.procedures,.which.we. |
| 12820 | 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 31 2d 31 2d 33 | described.in.section.*Note.1-1-3 |
| 12840 | 3a 3a 2e 20 20 54 68 61 74 20 69 73 2c 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 65 76 | ::...That.is,.the.interpreter.ev |
| 12860 | 61 6c 75 61 74 65 73 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 65 0a 63 6f 6d 62 | aluates.the.elements.of.the.comb |
| 12880 | 69 6e 61 74 69 6f 6e 20 61 6e 64 20 61 70 70 6c 69 65 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 | ination.and.applies.the.procedur |
| 128a0 | 65 20 28 77 68 69 63 68 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 6f 70 65 | e.(which.is.the.value.of.the.ope |
| 128c0 | 72 61 74 6f 72 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 29 20 74 6f 20 74 68 65 | rator.of.the.combination).to.the |
| 128e0 | 20 61 72 67 75 6d 65 6e 74 73 20 28 77 68 69 63 68 20 61 72 65 20 74 68 65 20 76 61 6c 75 65 73 | .arguments.(which.are.the.values |
| 12900 | 20 6f 66 0a 74 68 65 20 6f 70 65 72 61 6e 64 73 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 | .of.the.operands.of.the.combinat |
| 12920 | 69 6f 6e 29 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 61 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 | ion)......We.can.assume.that.the |
| 12940 | 20 6d 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 61 70 70 6c 79 69 6e 67 20 70 72 69 6d 69 74 69 76 | .mechanism.for.applying.primitiv |
| 12960 | 65 20 70 72 6f 63 65 64 75 72 65 73 0a 74 6f 20 61 72 67 75 6d 65 6e 74 73 20 69 73 20 62 75 69 | e.procedures.to.arguments.is.bui |
| 12980 | 6c 74 20 69 6e 74 6f 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20 20 46 6f 72 20 63 6f | lt.into.the.interpreter...For.co |
| 129a0 | 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 2c 0a 74 68 65 20 61 70 70 6c 69 63 61 74 69 | mpound.procedures,.the.applicati |
| 129c0 | 6f 6e 20 70 72 6f 63 65 73 73 20 69 73 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 | on.process.is.as.follows:....... |
| 129e0 | 54 6f 20 61 70 70 6c 79 20 61 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 20 74 6f | To.apply.a.compound.procedure.to |
| 12a00 | 20 61 72 67 75 6d 65 6e 74 73 2c 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 62 6f 64 79 20 6f 66 | .arguments,.evaluate.the.body.of |
| 12a20 | 0a 20 20 20 20 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 65 61 63 68 20 66 6f | ......the.procedure.with.each.fo |
| 12a40 | 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 20 72 65 70 6c 61 63 65 64 20 62 79 20 74 68 65 0a 20 | rmal.parameter.replaced.by.the.. |
| 12a60 | 20 20 20 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 61 72 67 75 6d 65 6e 74 2e 0a 0a 20 20 20 | ....corresponding.argument...... |
| 12a80 | 54 6f 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 69 73 20 70 72 6f 63 65 73 73 2c 20 6c 65 74 27 | To.illustrate.this.process,.let' |
| 12aa0 | 73 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 0a 0a 20 20 20 20 | s.evaluate.the.combination...... |
| 12ac0 | 20 28 66 20 35 29 0a 0a 77 68 65 72 65 20 60 66 27 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 | .(f.5)..where.`f'.is.the.procedu |
| 12ae0 | 72 65 20 64 65 66 69 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d | re.defined.in.section.*Note.1-1- |
| 12b00 | 34 3a 3a 2e 20 20 57 65 20 62 65 67 69 6e 0a 62 79 20 72 65 74 72 69 65 76 69 6e 67 20 74 68 65 | 4::...We.begin.by.retrieving.the |
| 12b20 | 20 62 6f 64 79 20 6f 66 20 60 66 27 3a 0a 0a 20 20 20 20 20 28 73 75 6d 2d 6f 66 2d 73 71 75 61 | .body.of.`f':.......(sum-of-squa |
| 12b40 | 72 65 73 20 28 2b 20 61 20 31 29 20 28 2a 20 61 20 32 29 29 0a 0a 20 20 20 54 68 65 6e 20 77 65 | res.(+.a.1).(*.a.2)).....Then.we |
| 12b60 | 20 72 65 70 6c 61 63 65 20 74 68 65 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 20 60 61 | .replace.the.formal.parameter.`a |
| 12b80 | 27 20 62 79 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 35 3a 0a 0a 20 20 20 20 20 28 73 75 6d 2d | '.by.the.argument.5:.......(sum- |
| 12ba0 | 6f 66 2d 73 71 75 61 72 65 73 20 28 2b 20 35 20 31 29 20 28 2a 20 35 20 32 29 29 0a 0a 20 20 20 | of-squares.(+.5.1).(*.5.2))..... |
| 12bc0 | 54 68 75 73 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 72 65 64 75 63 65 73 20 74 6f 20 74 68 65 20 | Thus.the.problem.reduces.to.the. |
| 12be0 | 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 77 69 74 68 | evaluation.of.a.combination.with |
| 12c00 | 20 74 77 6f 0a 6f 70 65 72 61 6e 64 73 20 61 6e 64 20 61 6e 20 6f 70 65 72 61 74 6f 72 20 60 73 | .two.operands.and.an.operator.`s |
| 12c20 | 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 2e 20 20 45 76 61 6c 75 61 74 69 6e 67 20 74 68 69 73 | um-of-squares'...Evaluating.this |
| 12c40 | 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 0a 69 6e 76 6f 6c 76 65 73 20 74 68 72 65 65 20 73 75 62 70 | .combination.involves.three.subp |
| 12c60 | 72 6f 62 6c 65 6d 73 2e 20 20 57 65 20 6d 75 73 74 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 6f | roblems...We.must.evaluate.the.o |
| 12c80 | 70 65 72 61 74 6f 72 20 74 6f 20 67 65 74 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 74 6f 20 | perator.to.get.the.procedure.to. |
| 12ca0 | 62 65 20 61 70 70 6c 69 65 64 2c 20 61 6e 64 20 77 65 20 6d 75 73 74 20 65 76 61 6c 75 61 74 65 | be.applied,.and.we.must.evaluate |
| 12cc0 | 20 74 68 65 20 6f 70 65 72 61 6e 64 73 20 74 6f 20 67 65 74 20 74 68 65 0a 61 72 67 75 6d 65 6e | .the.operands.to.get.the.argumen |
| 12ce0 | 74 73 2e 20 20 4e 6f 77 20 60 28 2b 20 35 20 31 29 27 20 70 72 6f 64 75 63 65 73 20 36 20 61 6e | ts...Now.`(+.5.1)'.produces.6.an |
| 12d00 | 64 20 60 28 2a 20 35 20 32 29 27 20 70 72 6f 64 75 63 65 73 20 31 30 2c 20 73 6f 20 77 65 0a 6d | d.`(*.5.2)'.produces.10,.so.we.m |
| 12d20 | 75 73 74 20 61 70 70 6c 79 20 74 68 65 20 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 20 70 | ust.apply.the.`sum-of-squares'.p |
| 12d40 | 72 6f 63 65 64 75 72 65 20 74 6f 20 36 20 61 6e 64 20 31 30 2e 20 20 54 68 65 73 65 20 76 61 6c | rocedure.to.6.and.10...These.val |
| 12d60 | 75 65 73 0a 61 72 65 20 73 75 62 73 74 69 74 75 74 65 64 20 66 6f 72 20 74 68 65 20 66 6f 72 6d | ues.are.substituted.for.the.form |
| 12d80 | 61 6c 20 70 61 72 61 6d 65 74 65 72 73 20 60 78 27 20 61 6e 64 20 60 79 27 20 69 6e 20 74 68 65 | al.parameters.`x'.and.`y'.in.the |
| 12da0 | 20 62 6f 64 79 20 6f 66 0a 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 2c 20 72 65 64 75 63 | .body.of.`sum-of-squares',.reduc |
| 12dc0 | 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 0a 0a 20 20 20 20 20 28 2b 20 28 | ing.the.expression.to.......(+.( |
| 12de0 | 73 71 75 61 72 65 20 36 29 20 28 73 71 75 61 72 65 20 31 30 29 29 0a 0a 20 20 20 49 66 20 77 65 | square.6).(square.10)).....If.we |
| 12e00 | 20 75 73 65 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 73 71 75 61 72 65 27 2c | .use.the.definition.of.`square', |
| 12e20 | 20 74 68 69 73 20 72 65 64 75 63 65 73 20 74 6f 0a 0a 20 20 20 20 20 28 2b 20 28 2a 20 36 20 36 | .this.reduces.to.......(+.(*.6.6 |
| 12e40 | 29 20 28 2a 20 31 30 20 31 30 29 29 0a 0a 77 68 69 63 68 20 72 65 64 75 63 65 73 20 62 79 20 6d | ).(*.10.10))..which.reduces.by.m |
| 12e60 | 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 20 74 6f 0a 0a 20 20 20 20 20 28 2b 20 33 36 20 31 30 30 | ultiplication.to.......(+.36.100 |
| 12e80 | 29 0a 0a 61 6e 64 20 66 69 6e 61 6c 6c 79 20 74 6f 0a 0a 20 20 20 20 20 31 33 36 0a 0a 20 20 20 | )..and.finally.to.......136..... |
| 12ea0 | 54 68 65 20 70 72 6f 63 65 73 73 20 77 65 20 68 61 76 65 20 6a 75 73 74 20 64 65 73 63 72 69 62 | The.process.we.have.just.describ |
| 12ec0 | 65 64 20 69 73 20 63 61 6c 6c 65 64 20 74 68 65 20 22 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d | ed.is.called.the."substitution.m |
| 12ee0 | 6f 64 65 6c 22 0a 66 6f 72 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e | odel".for.procedure.application. |
| 12f00 | 20 20 49 74 20 63 61 6e 20 62 65 20 74 61 6b 65 6e 20 61 73 20 61 20 6d 6f 64 65 6c 20 74 68 61 | ..It.can.be.taken.as.a.model.tha |
| 12f20 | 74 20 64 65 74 65 72 6d 69 6e 65 73 0a 74 68 65 20 22 6d 65 61 6e 69 6e 67 22 20 6f 66 20 70 72 | t.determines.the."meaning".of.pr |
| 12f40 | 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 69 6e 73 6f 66 61 72 20 61 73 20 | ocedure.application,.insofar.as. |
| 12f60 | 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 0a 74 68 69 73 20 63 68 61 70 74 65 72 20 61 | the.procedures.in.this.chapter.a |
| 12f80 | 72 65 20 63 6f 6e 63 65 72 6e 65 64 2e 20 20 48 6f 77 65 76 65 72 2c 20 74 68 65 72 65 20 61 72 | re.concerned...However,.there.ar |
| 12fa0 | 65 20 74 77 6f 20 70 6f 69 6e 74 73 20 74 68 61 74 20 73 68 6f 75 6c 64 0a 62 65 20 73 74 72 65 | e.two.points.that.should.be.stre |
| 12fc0 | 73 73 65 64 3a 0a 0a 20 20 20 2a 20 54 68 65 20 70 75 72 70 6f 73 65 20 6f 66 20 74 68 65 20 73 | ssed:.....*.The.purpose.of.the.s |
| 12fe0 | 75 62 73 74 69 74 75 74 69 6f 6e 20 69 73 20 74 6f 20 68 65 6c 70 20 75 73 20 74 68 69 6e 6b 20 | ubstitution.is.to.help.us.think. |
| 13000 | 61 62 6f 75 74 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 61 70 70 6c 69 63 61 74 69 6f 6e | about.procedure......application |
| 13020 | 2c 20 6e 6f 74 20 74 6f 20 70 72 6f 76 69 64 65 20 61 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f | ,.not.to.provide.a.description.o |
| 13040 | 66 20 68 6f 77 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 0a 20 20 20 20 20 72 65 61 6c 6c | f.how.the.interpreter......reall |
| 13060 | 79 20 77 6f 72 6b 73 2e 20 20 54 79 70 69 63 61 6c 20 69 6e 74 65 72 70 72 65 74 65 72 73 20 64 | y.works...Typical.interpreters.d |
| 13080 | 6f 20 6e 6f 74 20 65 76 61 6c 75 61 74 65 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 61 70 | o.not.evaluate.procedure......ap |
| 130a0 | 70 6c 69 63 61 74 69 6f 6e 73 20 62 79 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 74 68 65 20 74 | plications.by.manipulating.the.t |
| 130c0 | 65 78 74 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 73 75 62 73 74 69 74 75 74 65 | ext.of.a.procedure.to.substitute |
| 130e0 | 0a 20 20 20 20 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 20 66 6f 72 6d 61 6c 20 70 61 72 61 | ......values.for.the.formal.para |
| 13100 | 6d 65 74 65 72 73 2e 20 20 49 6e 20 70 72 61 63 74 69 63 65 2c 20 74 68 65 20 22 73 75 62 73 74 | meters...In.practice,.the."subst |
| 13120 | 69 74 75 74 69 6f 6e 22 0a 20 20 20 20 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 | itution"......is.accomplished.by |
| 13140 | 20 75 73 69 6e 67 20 61 20 6c 6f 63 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 66 6f 72 20 74 | .using.a.local.environment.for.t |
| 13160 | 68 65 20 66 6f 72 6d 61 6c 0a 20 20 20 20 20 70 61 72 61 6d 65 74 65 72 73 2e 20 20 57 65 20 77 | he.formal......parameters...We.w |
| 13180 | 69 6c 6c 20 64 69 73 63 75 73 73 20 74 68 69 73 20 6d 6f 72 65 20 66 75 6c 6c 79 20 69 6e 20 2a | ill.discuss.this.more.fully.in.* |
| 131a0 | 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 0a 20 20 20 20 20 61 6e 64 20 2a 4e 6f 74 65 20 | Note.Chapter.3::......and.*Note. |
| 131c0 | 43 68 61 70 74 65 72 20 34 3a 3a 20 77 68 65 6e 20 77 65 20 65 78 61 6d 69 6e 65 20 74 68 65 20 | Chapter.4::.when.we.examine.the. |
| 131e0 | 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 6e 0a 20 20 20 20 20 69 6e 74 65 72 70 | implementation.of.an......interp |
| 13200 | 72 65 74 65 72 20 69 6e 20 64 65 74 61 69 6c 2e 0a 0a 20 20 20 2a 20 4f 76 65 72 20 74 68 65 20 | reter.in.detail......*.Over.the. |
| 13220 | 63 6f 75 72 73 65 20 6f 66 20 74 68 69 73 20 62 6f 6f 6b 2c 20 77 65 20 77 69 6c 6c 20 70 72 65 | course.of.this.book,.we.will.pre |
| 13240 | 73 65 6e 74 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 20 20 20 20 20 69 6e 63 72 65 61 73 69 | sent.a.sequence.of......increasi |
| 13260 | 6e 67 6c 79 20 65 6c 61 62 6f 72 61 74 65 20 6d 6f 64 65 6c 73 20 6f 66 20 68 6f 77 20 69 6e 74 | ngly.elaborate.models.of.how.int |
| 13280 | 65 72 70 72 65 74 65 72 73 20 77 6f 72 6b 2c 0a 20 20 20 20 20 63 75 6c 6d 69 6e 61 74 69 6e 67 | erpreters.work,......culminating |
| 132a0 | 20 77 69 74 68 20 61 20 63 6f 6d 70 6c 65 74 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 | .with.a.complete.implementation. |
| 132c0 | 6f 66 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 61 6e 64 0a 20 20 20 20 20 63 6f 6d 70 69 | of.an.interpreter.and......compi |
| 132e0 | 6c 65 72 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 35 3a 3a 2e 20 20 54 68 65 20 73 | ler.in.*Note.Chapter.5::...The.s |
| 13300 | 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 69 73 20 6f 6e 6c 79 20 74 68 65 0a 20 20 | ubstitution.model.is.only.the... |
| 13320 | 20 20 20 66 69 72 73 74 20 6f 66 20 74 68 65 73 65 20 6d 6f 64 65 6c 73 2d 2d 61 20 77 61 79 20 | ...first.of.these.models--a.way. |
| 13340 | 74 6f 20 67 65 74 20 73 74 61 72 74 65 64 20 74 68 69 6e 6b 69 6e 67 20 66 6f 72 6d 61 6c 6c 79 | to.get.started.thinking.formally |
| 13360 | 0a 20 20 20 20 20 61 62 6f 75 74 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 | ......about.the.evaluation.proce |
| 13380 | 73 73 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 77 68 65 6e 20 6d 6f 64 65 6c 69 6e 67 20 70 | ss...In.general,.when.modeling.p |
| 133a0 | 68 65 6e 6f 6d 65 6e 61 0a 20 20 20 20 20 69 6e 20 73 63 69 65 6e 63 65 20 61 6e 64 20 65 6e 67 | henomena......in.science.and.eng |
| 133c0 | 69 6e 65 65 72 69 6e 67 2c 20 77 65 20 62 65 67 69 6e 20 77 69 74 68 20 73 69 6d 70 6c 69 66 69 | ineering,.we.begin.with.simplifi |
| 133e0 | 65 64 2c 20 69 6e 63 6f 6d 70 6c 65 74 65 0a 20 20 20 20 20 6d 6f 64 65 6c 73 2e 20 20 41 73 20 | ed,.incomplete......models...As. |
| 13400 | 77 65 20 65 78 61 6d 69 6e 65 20 74 68 69 6e 67 73 20 69 6e 20 67 72 65 61 74 65 72 20 64 65 74 | we.examine.things.in.greater.det |
| 13420 | 61 69 6c 2c 20 74 68 65 73 65 20 73 69 6d 70 6c 65 0a 20 20 20 20 20 6d 6f 64 65 6c 73 20 62 65 | ail,.these.simple......models.be |
| 13440 | 63 6f 6d 65 20 69 6e 61 64 65 71 75 61 74 65 20 61 6e 64 20 6d 75 73 74 20 62 65 20 72 65 70 6c | come.inadequate.and.must.be.repl |
| 13460 | 61 63 65 64 20 62 79 20 6d 6f 72 65 20 72 65 66 69 6e 65 64 0a 20 20 20 20 20 6d 6f 64 65 6c 73 | aced.by.more.refined......models |
| 13480 | 2e 20 20 54 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 69 73 20 6e 6f 20 | ...The.substitution.model.is.no. |
| 134a0 | 65 78 63 65 70 74 69 6f 6e 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 0a 20 20 20 20 20 | exception...In.particular,...... |
| 134c0 | 77 68 65 6e 20 77 65 20 61 64 64 72 65 73 73 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 | when.we.address.in.*Note.Chapter |
| 134e0 | 20 33 3a 3a 20 74 68 65 20 75 73 65 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 77 69 74 68 0a | .3::.the.use.of.procedures.with. |
| 13500 | 20 20 20 20 20 22 6d 75 74 61 62 6c 65 20 64 61 74 61 2c 22 20 77 65 20 77 69 6c 6c 20 73 65 65 | ....."mutable.data,".we.will.see |
| 13520 | 20 74 68 61 74 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 62 72 65 | .that.the.substitution.model.bre |
| 13540 | 61 6b 73 0a 20 20 20 20 20 64 6f 77 6e 20 61 6e 64 20 6d 75 73 74 20 62 65 20 72 65 70 6c 61 63 | aks......down.and.must.be.replac |
| 13560 | 65 64 20 62 79 20 61 20 6d 6f 72 65 20 63 6f 6d 70 6c 69 63 61 74 65 64 20 6d 6f 64 65 6c 20 6f | ed.by.a.more.complicated.model.o |
| 13580 | 66 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 28 31 29 | f.procedure......application.(1) |
| 135a0 | 0a 0a 0a 41 70 70 6c 69 63 61 74 69 76 65 20 6f 72 64 65 72 20 76 65 72 73 75 73 20 6e 6f 72 6d | ...Applicative.order.versus.norm |
| 135c0 | 61 6c 20 6f 72 64 65 72 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | al.order........................ |
| 135e0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 63 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 | ................According.to.the |
| 13600 | 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 67 69 76 65 6e | .description.of.evaluation.given |
| 13620 | 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 31 2d 31 2d 33 3a 3a 2c 20 74 68 65 20 69 | .in.section.*Note.1-1-3::,.the.i |
| 13640 | 6e 74 65 72 70 72 65 74 65 72 20 66 69 72 73 74 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 6f | nterpreter.first.evaluates.the.o |
| 13660 | 70 65 72 61 74 6f 72 20 61 6e 64 20 6f 70 65 72 61 6e 64 73 20 61 6e 64 0a 74 68 65 6e 20 61 70 | perator.and.operands.and.then.ap |
| 13680 | 70 6c 69 65 73 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 74 6f | plies.the.resulting.procedure.to |
| 136a0 | 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 54 68 69 73 0a | .the.resulting.arguments...This. |
| 136c0 | 69 73 20 6e 6f 74 20 74 68 65 20 6f 6e 6c 79 20 77 61 79 20 74 6f 20 70 65 72 66 6f 72 6d 20 65 | is.not.the.only.way.to.perform.e |
| 136e0 | 76 61 6c 75 61 74 69 6f 6e 2e 20 20 41 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 65 76 61 6c 75 | valuation...An.alternative.evalu |
| 13700 | 61 74 69 6f 6e 0a 6d 6f 64 65 6c 20 77 6f 75 6c 64 20 6e 6f 74 20 65 76 61 6c 75 61 74 65 20 74 | ation.model.would.not.evaluate.t |
| 13720 | 68 65 20 6f 70 65 72 61 6e 64 73 20 75 6e 74 69 6c 20 74 68 65 69 72 20 76 61 6c 75 65 73 20 77 | he.operands.until.their.values.w |
| 13740 | 65 72 65 20 6e 65 65 64 65 64 2e 0a 49 6e 73 74 65 61 64 20 69 74 20 77 6f 75 6c 64 20 66 69 72 | ere.needed..Instead.it.would.fir |
| 13760 | 73 74 20 73 75 62 73 74 69 74 75 74 65 20 6f 70 65 72 61 6e 64 20 65 78 70 72 65 73 73 69 6f 6e | st.substitute.operand.expression |
| 13780 | 73 20 66 6f 72 20 70 61 72 61 6d 65 74 65 72 73 0a 75 6e 74 69 6c 20 69 74 20 6f 62 74 61 69 6e | s.for.parameters.until.it.obtain |
| 137a0 | 65 64 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 76 6f 6c 76 69 6e 67 20 6f 6e 6c 79 20 | ed.an.expression.involving.only. |
| 137c0 | 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 74 6f 72 73 2c 20 61 6e 64 0a 77 6f 75 6c 64 20 74 | primitive.operators,.and.would.t |
| 137e0 | 68 65 6e 20 70 65 72 66 6f 72 6d 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 2e 20 20 49 66 20 | hen.perform.the.evaluation...If. |
| 13800 | 77 65 20 75 73 65 64 20 74 68 69 73 20 6d 65 74 68 6f 64 2c 20 74 68 65 0a 65 76 61 6c 75 61 74 | we.used.this.method,.the.evaluat |
| 13820 | 69 6f 6e 20 6f 66 20 60 28 66 20 35 29 27 20 77 6f 75 6c 64 20 70 72 6f 63 65 65 64 20 61 63 63 | ion.of.`(f.5)'.would.proceed.acc |
| 13840 | 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 65 78 70 61 6e 73 | ording.to.the.sequence.of.expans |
| 13860 | 69 6f 6e 73 0a 0a 20 20 20 20 20 28 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 20 28 2b 20 35 20 | ions.......(sum-of-squares.(+.5. |
| 13880 | 31 29 20 28 2a 20 35 20 32 29 29 0a 0a 20 20 20 20 20 28 2b 20 20 20 20 28 73 71 75 61 72 65 20 | 1).(*.5.2)).......(+....(square. |
| 138a0 | 28 2b 20 35 20 31 29 29 20 20 20 20 20 20 28 73 71 75 61 72 65 20 28 2a 20 35 20 32 29 29 20 20 | (+.5.1))......(square.(*.5.2)).. |
| 138c0 | 29 0a 0a 20 20 20 20 20 28 2b 20 20 20 20 28 2a 20 28 2b 20 35 20 31 29 20 28 2b 20 35 20 31 29 | ).......(+....(*.(+.5.1).(+.5.1) |
| 138e0 | 29 20 20 20 28 2a 20 28 2a 20 35 20 32 29 20 28 2a 20 35 20 32 29 29 29 0a 0a 66 6f 6c 6c 6f 77 | )...(*.(*.5.2).(*.5.2)))..follow |
| 13900 | 65 64 20 62 79 20 74 68 65 20 72 65 64 75 63 74 69 6f 6e 73 0a 0a 20 20 20 20 20 28 2b 20 20 20 | ed.by.the.reductions.......(+... |
| 13920 | 20 20 20 20 20 20 28 2a 20 36 20 36 29 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 31 30 20 | ......(*.6.6).............(*.10. |
| 13940 | 31 30 29 29 0a 0a 20 20 20 20 20 28 2b 20 20 20 20 20 20 20 20 20 20 20 33 36 20 20 20 20 20 20 | 10)).......(+...........36...... |
| 13960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 31 30 30 29 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............100)............... |
| 13980 | 20 20 20 20 20 20 20 20 20 20 20 20 31 33 36 0a 0a 20 20 20 54 68 69 73 20 67 69 76 65 73 20 74 | ............136.....This.gives.t |
| 139a0 | 68 65 20 73 61 6d 65 20 61 6e 73 77 65 72 20 61 73 20 6f 75 72 20 70 72 65 76 69 6f 75 73 20 65 | he.same.answer.as.our.previous.e |
| 139c0 | 76 61 6c 75 61 74 69 6f 6e 20 6d 6f 64 65 6c 2c 20 62 75 74 20 74 68 65 0a 70 72 6f 63 65 73 73 | valuation.model,.but.the.process |
| 139e0 | 20 69 73 20 64 69 66 66 65 72 65 6e 74 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 74 | .is.different...In.particular,.t |
| 13a00 | 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 73 20 6f 66 20 60 28 2b 20 35 20 31 29 27 20 61 6e 64 0a | he.evaluations.of.`(+.5.1)'.and. |
| 13a20 | 60 28 2a 20 35 20 32 29 27 20 61 72 65 20 65 61 63 68 20 70 65 72 66 6f 72 6d 65 64 20 74 77 69 | `(*.5.2)'.are.each.performed.twi |
| 13a40 | 63 65 20 68 65 72 65 2c 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 74 68 65 20 72 65 | ce.here,.corresponding.to.the.re |
| 13a60 | 64 75 63 74 69 6f 6e 0a 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 2a 20 78 20 | duction.of.the.expression.`(*.x. |
| 13a80 | 78 29 27 20 77 69 74 68 20 60 78 27 20 72 65 70 6c 61 63 65 64 20 72 65 73 70 65 63 74 69 76 65 | x)'.with.`x'.replaced.respective |
| 13aa0 | 6c 79 20 62 79 20 60 28 2b 20 35 20 31 29 27 0a 61 6e 64 20 60 28 2a 20 35 20 32 29 27 2e 0a 0a | ly.by.`(+.5.1)'.and.`(*.5.2)'... |
| 13ac0 | 20 20 20 54 68 69 73 20 61 6c 74 65 72 6e 61 74 69 76 65 20 22 66 75 6c 6c 79 20 65 78 70 61 6e | ...This.alternative."fully.expan |
| 13ae0 | 64 20 61 6e 64 20 74 68 65 6e 20 72 65 64 75 63 65 22 20 65 76 61 6c 75 61 74 69 6f 6e 20 6d 65 | d.and.then.reduce".evaluation.me |
| 13b00 | 74 68 6f 64 20 69 73 0a 6b 6e 6f 77 6e 20 61 73 20 22 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 65 | thod.is.known.as."normal-order.e |
| 13b20 | 76 61 6c 75 61 74 69 6f 6e 22 2c 20 69 6e 20 63 6f 6e 74 72 61 73 74 20 74 6f 20 74 68 65 20 22 | valuation",.in.contrast.to.the." |
| 13b40 | 65 76 61 6c 75 61 74 65 20 74 68 65 0a 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 74 68 65 6e 20 | evaluate.the.arguments.and.then. |
| 13b60 | 61 70 70 6c 79 22 20 6d 65 74 68 6f 64 20 74 68 61 74 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 | apply".method.that.the.interpret |
| 13b80 | 65 72 20 61 63 74 75 61 6c 6c 79 20 75 73 65 73 2c 0a 77 68 69 63 68 20 69 73 20 63 61 6c 6c 65 | er.actually.uses,.which.is.calle |
| 13ba0 | 64 20 22 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 22 | d."applicative-order.evaluation" |
| 13bc0 | 2e 20 20 49 74 20 63 61 6e 20 62 65 20 73 68 6f 77 6e 20 74 68 61 74 2c 0a 66 6f 72 20 70 72 6f | ...It.can.be.shown.that,.for.pro |
| 13be0 | 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 74 68 61 74 20 63 61 6e 20 62 65 20 | cedure.applications.that.can.be. |
| 13c00 | 6d 6f 64 65 6c 65 64 20 75 73 69 6e 67 20 73 75 62 73 74 69 74 75 74 69 6f 6e 0a 28 69 6e 63 6c | modeled.using.substitution.(incl |
| 13c20 | 75 64 69 6e 67 20 61 6c 6c 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 65 20 | uding.all.the.procedures.in.the. |
| 13c40 | 66 69 72 73 74 20 74 77 6f 20 63 68 61 70 74 65 72 73 20 6f 66 20 74 68 69 73 20 62 6f 6f 6b 29 | first.two.chapters.of.this.book) |
| 13c60 | 0a 61 6e 64 20 74 68 61 74 20 79 69 65 6c 64 20 6c 65 67 69 74 69 6d 61 74 65 20 76 61 6c 75 65 | .and.that.yield.legitimate.value |
| 13c80 | 73 2c 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 61 6e 64 20 61 70 70 6c 69 63 61 74 69 76 65 2d | s,.normal-order.and.applicative- |
| 13ca0 | 6f 72 64 65 72 0a 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 64 75 63 65 20 74 68 65 20 73 61 6d | order.evaluation.produce.the.sam |
| 13cc0 | 65 20 76 61 6c 75 65 2e 20 20 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d | e.value...(See.*Note.Exercise.1- |
| 13ce0 | 35 3a 3a 20 66 6f 72 20 61 6e 0a 69 6e 73 74 61 6e 63 65 20 6f 66 20 61 6e 20 22 69 6c 6c 65 67 | 5::.for.an.instance.of.an."illeg |
| 13d00 | 69 74 69 6d 61 74 65 22 20 76 61 6c 75 65 20 77 68 65 72 65 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 | itimate".value.where.normal-orde |
| 13d20 | 72 20 61 6e 64 0a 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 | r.and.applicative-order.evaluati |
| 13d40 | 6f 6e 20 64 6f 20 6e 6f 74 20 67 69 76 65 20 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 2e 29 | on.do.not.give.the.same.result.) |
| 13d60 | 0a 0a 20 20 20 4c 69 73 70 20 75 73 65 73 20 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 | .....Lisp.uses.applicative-order |
| 13d80 | 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 70 61 72 74 6c 79 20 62 65 63 61 75 73 65 20 6f 66 20 74 | .evaluation,.partly.because.of.t |
| 13da0 | 68 65 0a 61 64 64 69 74 69 6f 6e 61 6c 20 65 66 66 69 63 69 65 6e 63 79 20 6f 62 74 61 69 6e 65 | he.additional.efficiency.obtaine |
| 13dc0 | 64 20 66 72 6f 6d 20 61 76 6f 69 64 69 6e 67 20 6d 75 6c 74 69 70 6c 65 20 65 76 61 6c 75 61 74 | d.from.avoiding.multiple.evaluat |
| 13de0 | 69 6f 6e 73 20 6f 66 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 73 75 63 68 20 61 73 20 74 68 6f 73 | ions.of.expressions.such.as.thos |
| 13e00 | 65 20 69 6c 6c 75 73 74 72 61 74 65 64 20 77 69 74 68 20 60 28 2b 20 35 20 31 29 27 20 61 6e 64 | e.illustrated.with.`(+.5.1)'.and |
| 13e20 | 20 60 28 2a 20 35 20 32 29 27 0a 61 62 6f 76 65 20 61 6e 64 2c 20 6d 6f 72 65 20 73 69 67 6e 69 | .`(*.5.2)'.above.and,.more.signi |
| 13e40 | 66 69 63 61 6e 74 6c 79 2c 20 62 65 63 61 75 73 65 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 65 | ficantly,.because.normal-order.e |
| 13e60 | 76 61 6c 75 61 74 69 6f 6e 20 62 65 63 6f 6d 65 73 0a 6d 75 63 68 20 6d 6f 72 65 20 63 6f 6d 70 | valuation.becomes.much.more.comp |
| 13e80 | 6c 69 63 61 74 65 64 20 74 6f 20 64 65 61 6c 20 77 69 74 68 20 77 68 65 6e 20 77 65 20 6c 65 61 | licated.to.deal.with.when.we.lea |
| 13ea0 | 76 65 20 74 68 65 20 72 65 61 6c 6d 20 6f 66 0a 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 | ve.the.realm.of.procedures.that. |
| 13ec0 | 63 61 6e 20 62 65 20 6d 6f 64 65 6c 65 64 20 62 79 20 73 75 62 73 74 69 74 75 74 69 6f 6e 2e 20 | can.be.modeled.by.substitution.. |
| 13ee0 | 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 0a 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 | .On.the.other.hand,.normal-order |
| 13f00 | 20 65 76 61 6c 75 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 61 6e 20 65 78 74 72 65 6d 65 6c 79 20 | .evaluation.can.be.an.extremely. |
| 13f20 | 76 61 6c 75 61 62 6c 65 20 74 6f 6f 6c 2c 20 61 6e 64 20 77 65 20 77 69 6c 6c 0a 69 6e 76 65 73 | valuable.tool,.and.we.will.inves |
| 13f40 | 74 69 67 61 74 65 20 73 6f 6d 65 20 6f 66 20 69 74 73 20 69 6d 70 6c 69 63 61 74 69 6f 6e 73 20 | tigate.some.of.its.implications. |
| 13f60 | 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 0a 43 | in.*Note.Chapter.3::.and.*Note.C |
| 13f80 | 68 61 70 74 65 72 20 34 3a 3a 2e 28 32 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f | hapter.4::.(2).....----------.Fo |
| 13fa0 | 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 44 65 73 70 69 | otnotes.----------.....(1).Despi |
| 13fc0 | 74 65 20 74 68 65 20 73 69 6d 70 6c 69 63 69 74 79 20 6f 66 20 74 68 65 20 73 75 62 73 74 69 74 | te.the.simplicity.of.the.substit |
| 13fe0 | 75 74 69 6f 6e 20 69 64 65 61 2c 20 69 74 20 74 75 72 6e 73 20 6f 75 74 20 74 6f 0a 62 65 20 73 | ution.idea,.it.turns.out.to.be.s |
| 14000 | 75 72 70 72 69 73 69 6e 67 6c 79 20 63 6f 6d 70 6c 69 63 61 74 65 64 20 74 6f 20 67 69 76 65 20 | urprisingly.complicated.to.give. |
| 14020 | 61 20 72 69 67 6f 72 6f 75 73 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 64 65 66 69 6e 69 74 69 | a.rigorous.mathematical.definiti |
| 14040 | 6f 6e 0a 6f 66 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 70 72 6f 63 65 73 73 2e 20 | on.of.the.substitution.process.. |
| 14060 | 20 54 68 65 20 70 72 6f 62 6c 65 6d 20 61 72 69 73 65 73 20 66 72 6f 6d 20 74 68 65 20 70 6f 73 | .The.problem.arises.from.the.pos |
| 14080 | 73 69 62 69 6c 69 74 79 20 6f 66 0a 63 6f 6e 66 75 73 69 6f 6e 20 62 65 74 77 65 65 6e 20 74 68 | sibility.of.confusion.between.th |
| 140a0 | 65 20 6e 61 6d 65 73 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 66 6f 72 6d 61 6c 20 70 61 72 61 | e.names.used.for.the.formal.para |
| 140c0 | 6d 65 74 65 72 73 20 6f 66 20 61 0a 70 72 6f 63 65 64 75 72 65 20 61 6e 64 20 74 68 65 20 28 70 | meters.of.a.procedure.and.the.(p |
| 140e0 | 6f 73 73 69 62 6c 79 20 69 64 65 6e 74 69 63 61 6c 29 20 6e 61 6d 65 73 20 75 73 65 64 20 69 6e | ossibly.identical).names.used.in |
| 14100 | 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 6f 0a 77 68 69 63 68 20 74 68 65 20 70 72 | .the.expressions.to.which.the.pr |
| 14120 | 6f 63 65 64 75 72 65 20 6d 61 79 20 62 65 20 61 70 70 6c 69 65 64 2e 20 20 49 6e 64 65 65 64 2c | ocedure.may.be.applied...Indeed, |
| 14140 | 20 74 68 65 72 65 20 69 73 20 61 20 6c 6f 6e 67 20 68 69 73 74 6f 72 79 20 6f 66 0a 65 72 72 6f | .there.is.a.long.history.of.erro |
| 14160 | 6e 65 6f 75 73 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 22 73 75 62 73 74 69 74 75 74 69 | neous.definitions.of."substituti |
| 14180 | 6f 6e 22 20 69 6e 20 74 68 65 20 6c 69 74 65 72 61 74 75 72 65 20 6f 66 20 6c 6f 67 69 63 20 61 | on".in.the.literature.of.logic.a |
| 141a0 | 6e 64 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 73 65 6d 61 6e 74 69 63 73 2e 20 20 53 65 65 20 53 | nd.programming.semantics...See.S |
| 141c0 | 74 6f 79 20 31 39 37 37 20 66 6f 72 20 61 20 63 61 72 65 66 75 6c 20 64 69 73 63 75 73 73 69 6f | toy.1977.for.a.careful.discussio |
| 141e0 | 6e 20 6f 66 0a 73 75 62 73 74 69 74 75 74 69 6f 6e 2e 0a 0a 20 20 20 28 32 29 20 49 6e 20 2a 4e | n.of.substitution......(2).In.*N |
| 14200 | 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 20 77 65 20 77 69 6c 6c 20 69 6e 74 72 6f 64 75 63 | ote.Chapter.3::.we.will.introduc |
| 14220 | 65 20 22 73 74 72 65 61 6d 20 70 72 6f 63 65 73 73 69 6e 67 22 2c 0a 77 68 69 63 68 20 69 73 20 | e."stream.processing",.which.is. |
| 14240 | 61 20 77 61 79 20 6f 66 20 68 61 6e 64 6c 69 6e 67 20 61 70 70 61 72 65 6e 74 6c 79 20 22 69 6e | a.way.of.handling.apparently."in |
| 14260 | 66 69 6e 69 74 65 22 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 62 79 0a 69 6e 63 6f 72 | finite".data.structures.by.incor |
| 14280 | 70 6f 72 61 74 69 6e 67 20 61 20 6c 69 6d 69 74 65 64 20 66 6f 72 6d 20 6f 66 20 6e 6f 72 6d 61 | porating.a.limited.form.of.norma |
| 142a0 | 6c 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 2e 20 20 49 6e 20 73 65 63 74 69 6f 6e 0a | l-order.evaluation...In.section. |
| 142c0 | 2a 4e 6f 74 65 20 34 2d 32 3a 3a 20 77 65 20 77 69 6c 6c 20 6d 6f 64 69 66 79 20 74 68 65 20 53 | *Note.4-2::.we.will.modify.the.S |
| 142e0 | 63 68 65 6d 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 6f 20 70 72 6f 64 75 63 65 20 61 0a 6e | cheme.interpreter.to.produce.a.n |
| 14300 | 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 76 61 72 69 61 6e 74 20 6f 66 20 53 63 68 65 6d 65 2e 0a 0a | ormal-order.variant.of.Scheme... |
| 14320 | 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 31 2d 36 2c | ..File:.sicp.info,..Node:.1-1-6, |
| 14340 | 20 20 4e 65 78 74 3a 20 31 2d 31 2d 37 2c 20 20 50 72 65 76 3a 20 31 2d 31 2d 35 2c 20 20 55 70 | ..Next:.1-1-7,..Prev:.1-1-5,..Up |
| 14360 | 3a 20 31 2d 31 0a 0a 31 2e 31 2e 36 20 43 6f 6e 64 69 74 69 6f 6e 61 6c 20 45 78 70 72 65 73 73 | :.1-1..1.1.6.Conditional.Express |
| 14380 | 69 6f 6e 73 20 61 6e 64 20 50 72 65 64 69 63 61 74 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ions.and.Predicates.------------ |
| 143a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 143c0 | 0a 0a 54 68 65 20 65 78 70 72 65 73 73 69 76 65 20 70 6f 77 65 72 20 6f 66 20 74 68 65 20 63 6c | ..The.expressive.power.of.the.cl |
| 143e0 | 61 73 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 77 65 20 63 61 6e 20 64 65 | ass.of.procedures.that.we.can.de |
| 14400 | 66 69 6e 65 20 61 74 0a 74 68 69 73 20 70 6f 69 6e 74 20 69 73 20 76 65 72 79 20 6c 69 6d 69 74 | fine.at.this.point.is.very.limit |
| 14420 | 65 64 2c 20 62 65 63 61 75 73 65 20 77 65 20 68 61 76 65 20 6e 6f 20 77 61 79 20 74 6f 20 6d 61 | ed,.because.we.have.no.way.to.ma |
| 14440 | 6b 65 20 74 65 73 74 73 20 61 6e 64 20 74 6f 0a 70 65 72 66 6f 72 6d 20 64 69 66 66 65 72 65 6e | ke.tests.and.to.perform.differen |
| 14460 | 74 20 6f 70 65 72 61 74 69 6f 6e 73 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68 65 20 72 65 | t.operations.depending.on.the.re |
| 14480 | 73 75 6c 74 20 6f 66 20 61 20 74 65 73 74 2e 20 20 46 6f 72 0a 69 6e 73 74 61 6e 63 65 2c 20 77 | sult.of.a.test...For.instance,.w |
| 144a0 | 65 20 63 61 6e 6e 6f 74 20 64 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 | e.cannot.define.a.procedure.that |
| 144c0 | 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 61 62 73 6f 6c 75 74 65 20 76 61 6c 75 65 0a 6f 66 20 | .computes.the.absolute.value.of. |
| 144e0 | 61 20 6e 75 6d 62 65 72 20 62 79 20 74 65 73 74 69 6e 67 20 77 68 65 74 68 65 72 20 74 68 65 20 | a.number.by.testing.whether.the. |
| 14500 | 6e 75 6d 62 65 72 20 69 73 20 70 6f 73 69 74 69 76 65 2c 20 6e 65 67 61 74 69 76 65 2c 20 6f 72 | number.is.positive,.negative,.or |
| 14520 | 0a 7a 65 72 6f 20 61 6e 64 20 74 61 6b 69 6e 67 20 64 69 66 66 65 72 65 6e 74 20 61 63 74 69 6f | .zero.and.taking.different.actio |
| 14540 | 6e 73 20 69 6e 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 20 63 61 73 65 73 20 61 63 63 6f 72 64 | ns.in.the.different.cases.accord |
| 14560 | 69 6e 67 20 74 6f 0a 74 68 65 20 72 75 6c 65 0a 0a 20 20 20 20 20 20 20 20 20 20 20 2f 0a 20 20 | ing.to.the.rule............./... |
| 14580 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 78 20 20 69 66 20 78 20 3e 20 30 0a 20 20 20 20 20 7c 78 | .........|...x..if.x.>.0......|x |
| 145a0 | 7c 20 3d 20 3c 20 20 20 30 20 20 69 66 20 78 20 3d 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 7c | |.=.<...0..if.x.=.0............| |
| 145c0 | 20 20 2d 78 20 20 69 66 20 78 20 3c 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 5c 0a 0a 20 20 20 | ..-x..if.x.<.0............\..... |
| 145e0 | 54 68 69 73 20 63 6f 6e 73 74 72 75 63 74 20 69 73 20 63 61 6c 6c 65 64 20 61 20 22 63 61 73 65 | This.construct.is.called.a."case |
| 14600 | 20 61 6e 61 6c 79 73 69 73 22 2c 20 61 6e 64 20 74 68 65 72 65 20 69 73 20 61 20 73 70 65 63 69 | .analysis",.and.there.is.a.speci |
| 14620 | 61 6c 0a 66 6f 72 6d 20 69 6e 20 4c 69 73 70 20 66 6f 72 20 6e 6f 74 61 74 69 6e 67 20 73 75 63 | al.form.in.Lisp.for.notating.suc |
| 14640 | 68 20 61 20 63 61 73 65 20 61 6e 61 6c 79 73 69 73 2e 20 20 49 74 20 69 73 20 63 61 6c 6c 65 64 | h.a.case.analysis...It.is.called |
| 14660 | 20 60 63 6f 6e 64 27 0a 28 77 68 69 63 68 20 73 74 61 6e 64 73 20 66 6f 72 20 22 63 6f 6e 64 69 | .`cond'.(which.stands.for."condi |
| 14680 | 74 69 6f 6e 61 6c 22 29 2c 20 61 6e 64 20 69 74 20 69 73 20 75 73 65 64 20 61 73 20 66 6f 6c 6c | tional"),.and.it.is.used.as.foll |
| 146a0 | 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 62 73 20 78 29 0a 20 20 20 20 20 | ows:.......(define.(abs.x)...... |
| 146c0 | 20 20 28 63 6f 6e 64 20 28 28 3e 20 78 20 30 29 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..(cond.((>.x.0).x)............. |
| 146e0 | 20 28 28 3d 20 78 20 30 29 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3c 20 78 20 | .((=.x.0).0)..............((<.x. |
| 14700 | 30 29 20 28 2d 20 78 29 29 29 29 0a 0a 20 20 20 54 68 65 20 67 65 6e 65 72 61 6c 20 66 6f 72 6d | 0).(-.x)))).....The.general.form |
| 14720 | 20 6f 66 20 61 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 0a | .of.a.conditional.expression.is. |
| 14740 | 0a 20 20 20 20 20 28 63 6f 6e 64 20 28 3c 50 31 3e 20 3c 45 31 3e 29 0a 20 20 20 20 20 20 20 20 | ......(cond.(<P1>.<E1>)......... |
| 14760 | 20 20 20 28 3c 50 32 3e 20 3c 45 32 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 0a 20 20 | ...(<P2>.<E2>).................. |
| 14780 | 20 20 20 20 20 20 20 20 20 28 3c 50 4e 3e 20 3c 45 4e 3e 29 29 0a 0a 63 6f 6e 73 69 73 74 69 6e | .........(<PN>.<EN>))..consistin |
| 147a0 | 67 20 6f 66 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 63 6f 6e 64 27 20 66 6f 6c 6c 6f 77 65 64 20 | g.of.the.symbol.`cond'.followed. |
| 147c0 | 62 79 20 70 61 72 65 6e 74 68 65 73 69 7a 65 64 20 70 61 69 72 73 20 6f 66 0a 65 78 70 72 65 73 | by.parenthesized.pairs.of.expres |
| 147e0 | 73 69 6f 6e 73 0a 0a 20 20 20 20 20 28 3c 50 3e 20 3c 45 3e 29 0a 0a 63 61 6c 6c 65 64 20 22 63 | sions.......(<P>.<E>)..called."c |
| 14800 | 6c 61 75 73 65 73 22 2e 20 54 68 65 20 66 69 72 73 74 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e | lauses"..The.first.expression.in |
| 14820 | 20 65 61 63 68 20 70 61 69 72 20 69 73 20 61 20 22 70 72 65 64 69 63 61 74 65 22 2d 2d 74 68 61 | .each.pair.is.a."predicate"--tha |
| 14840 | 74 0a 69 73 2c 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 77 68 6f 73 65 20 76 61 6c 75 65 20 | t.is,.an.expression.whose.value. |
| 14860 | 69 73 20 69 6e 74 65 72 70 72 65 74 65 64 20 61 73 20 65 69 74 68 65 72 20 74 72 75 65 20 6f 72 | is.interpreted.as.either.true.or |
| 14880 | 20 66 61 6c 73 65 2e 28 31 29 0a 0a 20 20 20 43 6f 6e 64 69 74 69 6f 6e 61 6c 20 65 78 70 72 65 | .false.(1).....Conditional.expre |
| 148a0 | 73 73 69 6f 6e 73 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 20 61 73 20 66 6f 6c 6c 6f 77 73 2e | ssions.are.evaluated.as.follows. |
| 148c0 | 20 20 54 68 65 20 70 72 65 64 69 63 61 74 65 0a 3c 50 31 3e 20 69 73 20 65 76 61 6c 75 61 74 65 | ..The.predicate.<P1>.is.evaluate |
| 148e0 | 64 20 66 69 72 73 74 2e 20 20 49 66 20 69 74 73 20 76 61 6c 75 65 20 69 73 20 66 61 6c 73 65 2c | d.first...If.its.value.is.false, |
| 14900 | 20 74 68 65 6e 20 3c 50 32 3e 20 69 73 0a 65 76 61 6c 75 61 74 65 64 2e 20 20 49 66 20 3c 50 32 | .then.<P2>.is.evaluated...If.<P2 |
| 14920 | 3e 27 73 20 76 61 6c 75 65 20 69 73 20 61 6c 73 6f 20 66 61 6c 73 65 2c 20 74 68 65 6e 20 3c 50 | >'s.value.is.also.false,.then.<P |
| 14940 | 33 3e 20 69 73 20 65 76 61 6c 75 61 74 65 64 2e 0a 54 68 69 73 20 70 72 6f 63 65 73 73 20 63 6f | 3>.is.evaluated..This.process.co |
| 14960 | 6e 74 69 6e 75 65 73 20 75 6e 74 69 6c 20 61 20 70 72 65 64 69 63 61 74 65 20 69 73 20 66 6f 75 | ntinues.until.a.predicate.is.fou |
| 14980 | 6e 64 20 77 68 6f 73 65 20 76 61 6c 75 65 20 69 73 20 74 72 75 65 2c 0a 69 6e 20 77 68 69 63 68 | nd.whose.value.is.true,.in.which |
| 149a0 | 20 63 61 73 65 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 72 65 74 75 72 6e 73 20 74 68 | .case.the.interpreter.returns.th |
| 149c0 | 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 65 78 70 | e.value.of.the.corresponding.exp |
| 149e0 | 72 65 73 73 69 6f 6e 0a 22 63 6f 6e 73 65 71 75 65 6e 74 20 65 78 70 72 65 73 73 69 6f 6e 22 20 | ression."consequent.expression". |
| 14a00 | 3c 45 3e 20 6f 66 20 74 68 65 20 63 6c 61 75 73 65 20 61 73 20 74 68 65 20 76 61 6c 75 65 20 6f | <E>.of.the.clause.as.the.value.o |
| 14a20 | 66 20 74 68 65 0a 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 49 | f.the.conditional.expression...I |
| 14a40 | 66 20 6e 6f 6e 65 20 6f 66 20 74 68 65 20 3c 50 3e 27 73 20 69 73 20 66 6f 75 6e 64 20 74 6f 20 | f.none.of.the.<P>'s.is.found.to. |
| 14a60 | 62 65 20 74 72 75 65 2c 20 74 68 65 0a 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 63 6f 6e 64 27 | be.true,.the.value.of.the.`cond' |
| 14a80 | 20 69 73 20 75 6e 64 65 66 69 6e 65 64 2e 0a 0a 20 20 20 54 68 65 20 77 6f 72 64 20 22 70 72 65 | .is.undefined......The.word."pre |
| 14aa0 | 64 69 63 61 74 65 22 20 69 73 20 75 73 65 64 20 66 6f 72 20 70 72 6f 63 65 64 75 72 65 73 20 74 | dicate".is.used.for.procedures.t |
| 14ac0 | 68 61 74 20 72 65 74 75 72 6e 20 74 72 75 65 20 6f 72 0a 66 61 6c 73 65 2c 20 61 73 20 77 65 6c | hat.return.true.or.false,.as.wel |
| 14ae0 | 6c 20 61 73 20 66 6f 72 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 68 61 74 20 65 76 61 6c 75 61 | l.as.for.expressions.that.evalua |
| 14b00 | 74 65 20 74 6f 20 74 72 75 65 20 6f 72 20 66 61 6c 73 65 2e 20 20 54 68 65 0a 61 62 73 6f 6c 75 | te.to.true.or.false...The.absolu |
| 14b20 | 74 65 2d 76 61 6c 75 65 20 70 72 6f 63 65 64 75 72 65 20 60 61 62 73 27 20 6d 61 6b 65 73 20 75 | te-value.procedure.`abs'.makes.u |
| 14b40 | 73 65 20 6f 66 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 65 64 69 63 61 74 65 73 0a 60 | se.of.the.primitive.predicates.` |
| 14b60 | 3e 27 2c 20 60 3c 27 2c 20 61 6e 64 20 60 3d 27 2e 28 32 29 20 54 68 65 73 65 20 74 61 6b 65 20 | >',.`<',.and.`='.(2).These.take. |
| 14b80 | 74 77 6f 20 6e 75 6d 62 65 72 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 74 65 73 | two.numbers.as.arguments.and.tes |
| 14ba0 | 74 0a 77 68 65 74 68 65 72 20 74 68 65 20 66 69 72 73 74 20 6e 75 6d 62 65 72 20 69 73 2c 20 72 | t.whether.the.first.number.is,.r |
| 14bc0 | 65 73 70 65 63 74 69 76 65 6c 79 2c 20 67 72 65 61 74 65 72 20 74 68 61 6e 2c 20 6c 65 73 73 20 | espectively,.greater.than,.less. |
| 14be0 | 74 68 61 6e 2c 20 6f 72 0a 65 71 75 61 6c 20 74 6f 20 74 68 65 20 73 65 63 6f 6e 64 20 6e 75 6d | than,.or.equal.to.the.second.num |
| 14c00 | 62 65 72 2c 20 72 65 74 75 72 6e 69 6e 67 20 74 72 75 65 20 6f 72 20 66 61 6c 73 65 20 61 63 63 | ber,.returning.true.or.false.acc |
| 14c20 | 6f 72 64 69 6e 67 6c 79 2e 0a 0a 20 20 20 41 6e 6f 74 68 65 72 20 77 61 79 20 74 6f 20 77 72 69 | ordingly......Another.way.to.wri |
| 14c40 | 74 65 20 74 68 65 20 61 62 73 6f 6c 75 74 65 2d 76 61 6c 75 65 20 70 72 6f 63 65 64 75 72 65 20 | te.the.absolute-value.procedure. |
| 14c60 | 69 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 62 73 20 78 29 0a 20 20 20 20 20 20 20 | is.......(define.(abs.x)........ |
| 14c80 | 28 63 6f 6e 64 20 28 28 3c 20 78 20 30 29 20 28 2d 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 | (cond.((<.x.0).(-.x))........... |
| 14ca0 | 20 20 20 28 65 6c 73 65 20 78 29 29 29 0a 0a 77 68 69 63 68 20 63 6f 75 6c 64 20 62 65 20 65 78 | ...(else.x)))..which.could.be.ex |
| 14cc0 | 70 72 65 73 73 65 64 20 69 6e 20 45 6e 67 6c 69 73 68 20 61 73 20 22 49 66 20 78 20 69 73 20 6c | pressed.in.English.as."If.x.is.l |
| 14ce0 | 65 73 73 20 74 68 61 6e 20 7a 65 72 6f 20 72 65 74 75 72 6e 20 2d 0a 78 3b 20 6f 74 68 65 72 77 | ess.than.zero.return.-.x;.otherw |
| 14d00 | 69 73 65 20 72 65 74 75 72 6e 20 78 2e 22 20 20 60 45 6c 73 65 27 20 69 73 20 61 20 73 70 65 63 | ise.return.x."..`Else'.is.a.spec |
| 14d20 | 69 61 6c 20 73 79 6d 62 6f 6c 20 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 69 6e 0a 70 | ial.symbol.that.can.be.used.in.p |
| 14d40 | 6c 61 63 65 20 6f 66 20 74 68 65 20 3c 50 3e 20 69 6e 20 74 68 65 20 66 69 6e 61 6c 20 63 6c 61 | lace.of.the.<P>.in.the.final.cla |
| 14d60 | 75 73 65 20 6f 66 20 61 20 60 63 6f 6e 64 27 2e 20 20 54 68 69 73 20 63 61 75 73 65 73 20 74 68 | use.of.a.`cond'...This.causes.th |
| 14d80 | 65 0a 60 63 6f 6e 64 27 20 74 6f 20 72 65 74 75 72 6e 20 61 73 20 69 74 73 20 76 61 6c 75 65 20 | e.`cond'.to.return.as.its.value. |
| 14da0 | 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 3c | the.value.of.the.corresponding.< |
| 14dc0 | 45 3e 0a 77 68 65 6e 65 76 65 72 20 61 6c 6c 20 70 72 65 76 69 6f 75 73 20 63 6c 61 75 73 65 73 | E>.whenever.all.previous.clauses |
| 14de0 | 20 68 61 76 65 20 62 65 65 6e 20 62 79 70 61 73 73 65 64 2e 20 20 49 6e 20 66 61 63 74 2c 20 61 | .have.been.bypassed...In.fact,.a |
| 14e00 | 6e 79 0a 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 61 6c 77 61 79 73 20 65 76 61 6c 75 61 | ny.expression.that.always.evalua |
| 14e20 | 74 65 73 20 74 6f 20 61 20 74 72 75 65 20 76 61 6c 75 65 20 63 6f 75 6c 64 20 62 65 20 75 73 65 | tes.to.a.true.value.could.be.use |
| 14e40 | 64 20 61 73 20 74 68 65 0a 3c 50 3e 20 68 65 72 65 2e 0a 0a 20 20 20 48 65 72 65 20 69 73 20 79 | d.as.the.<P>.here......Here.is.y |
| 14e60 | 65 74 20 61 6e 6f 74 68 65 72 20 77 61 79 20 74 6f 20 77 72 69 74 65 20 74 68 65 20 61 62 73 6f | et.another.way.to.write.the.abso |
| 14e80 | 6c 75 74 65 2d 76 61 6c 75 65 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 | lute-value.procedure:.......(def |
| 14ea0 | 69 6e 65 20 28 61 62 73 20 78 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3c 20 78 20 30 29 0a 20 | ine.(abs.x)........(if.(<.x.0).. |
| 14ec0 | 20 20 20 20 20 20 20 20 20 20 28 2d 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 78 29 29 0a 0a | ..........(-.x)............x)).. |
| 14ee0 | 20 20 20 54 68 69 73 20 75 73 65 73 20 74 68 65 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 60 69 | ...This.uses.the.special.form.`i |
| 14f00 | 66 27 2c 20 61 20 72 65 73 74 72 69 63 74 65 64 20 74 79 70 65 20 6f 66 20 63 6f 6e 64 69 74 69 | f',.a.restricted.type.of.conditi |
| 14f20 | 6f 6e 61 6c 0a 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 77 68 65 6e 20 74 68 65 72 65 | onal.that.can.be.used.when.there |
| 14f40 | 20 61 72 65 20 70 72 65 63 69 73 65 6c 79 20 74 77 6f 20 63 61 73 65 73 20 69 6e 20 74 68 65 20 | .are.precisely.two.cases.in.the. |
| 14f60 | 63 61 73 65 0a 61 6e 61 6c 79 73 69 73 2e 20 20 54 68 65 20 67 65 6e 65 72 61 6c 20 66 6f 72 6d | case.analysis...The.general.form |
| 14f80 | 20 6f 66 20 61 6e 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 0a 0a 20 20 20 20 20 | .of.an.`if'.expression.is....... |
| 14fa0 | 28 69 66 20 3c 50 52 45 44 49 43 41 54 45 3e 20 3c 43 4f 4e 53 45 51 55 45 4e 54 3e 20 3c 41 4c | (if.<PREDICATE>.<CONSEQUENT>.<AL |
| 14fc0 | 54 45 52 4e 41 54 49 56 45 3e 29 0a 0a 20 20 20 54 6f 20 65 76 61 6c 75 61 74 65 20 61 6e 20 60 | TERNATIVE>).....To.evaluate.an.` |
| 14fe0 | 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 | if'.expression,.the.interpreter. |
| 15000 | 73 74 61 72 74 73 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 0a 74 68 65 20 3c 50 52 45 44 49 43 | starts.by.evaluating.the.<PREDIC |
| 15020 | 41 54 45 3e 20 70 61 72 74 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 49 66 | ATE>.part.of.the.expression...If |
| 15040 | 20 74 68 65 20 3c 50 52 45 44 49 43 41 54 45 3e 20 65 76 61 6c 75 61 74 65 73 0a 74 6f 20 61 20 | .the.<PREDICATE>.evaluates.to.a. |
| 15060 | 74 72 75 65 20 76 61 6c 75 65 2c 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 68 65 6e | true.value,.the.interpreter.then |
| 15080 | 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 3c 43 4f 4e 53 45 51 55 45 4e 54 3e 20 61 6e 64 0a | .evaluates.the.<CONSEQUENT>.and. |
| 150a0 | 72 65 74 75 72 6e 73 20 69 74 73 20 76 61 6c 75 65 2e 20 20 4f 74 68 65 72 77 69 73 65 20 69 74 | returns.its.value...Otherwise.it |
| 150c0 | 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 3c 41 4c 54 45 52 4e 41 54 49 56 45 3e 20 61 6e 64 | .evaluates.the.<ALTERNATIVE>.and |
| 150e0 | 20 72 65 74 75 72 6e 73 0a 69 74 73 20 76 61 6c 75 65 2e 28 33 29 0a 0a 20 20 20 49 6e 20 61 64 | .returns.its.value.(3).....In.ad |
| 15100 | 64 69 74 69 6f 6e 20 74 6f 20 70 72 69 6d 69 74 69 76 65 20 70 72 65 64 69 63 61 74 65 73 20 73 | dition.to.primitive.predicates.s |
| 15120 | 75 63 68 20 61 73 20 60 3c 27 2c 20 60 3d 27 2c 20 61 6e 64 20 60 3e 27 2c 20 74 68 65 72 65 0a | uch.as.`<',.`=',.and.`>',.there. |
| 15140 | 61 72 65 20 6c 6f 67 69 63 61 6c 20 63 6f 6d 70 6f 73 69 74 69 6f 6e 20 6f 70 65 72 61 74 69 6f | are.logical.composition.operatio |
| 15160 | 6e 73 2c 20 77 68 69 63 68 20 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 | ns,.which.enable.us.to.construct |
| 15180 | 0a 63 6f 6d 70 6f 75 6e 64 20 70 72 65 64 69 63 61 74 65 73 2e 20 20 54 68 65 20 74 68 72 65 65 | .compound.predicates...The.three |
| 151a0 | 20 6d 6f 73 74 20 66 72 65 71 75 65 6e 74 6c 79 20 75 73 65 64 20 61 72 65 20 74 68 65 73 65 3a | .most.frequently.used.are.these: |
| 151c0 | 0a 0a 20 20 20 2a 20 60 28 61 6e 64 20 3c 45 31 3e 20 2e 2e 2e 20 3c 45 4e 3e 29 27 0a 0a 20 20 | .....*.`(and.<E1>.....<EN>)'.... |
| 151e0 | 20 20 20 54 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 | ...The.interpreter.evaluates.the |
| 15200 | 20 65 78 70 72 65 73 73 69 6f 6e 73 20 3c 45 3e 20 6f 6e 65 20 61 74 20 61 20 74 69 6d 65 2c 20 | .expressions.<E>.one.at.a.time,. |
| 15220 | 69 6e 0a 20 20 20 20 20 6c 65 66 74 2d 74 6f 2d 72 69 67 68 74 20 6f 72 64 65 72 2e 20 20 49 66 | in......left-to-right.order...If |
| 15240 | 20 61 6e 79 20 3c 45 3e 20 65 76 61 6c 75 61 74 65 73 20 74 6f 20 66 61 6c 73 65 2c 20 74 68 65 | .any.<E>.evaluates.to.false,.the |
| 15260 | 20 76 61 6c 75 65 20 6f 66 0a 20 20 20 20 20 74 68 65 20 60 61 6e 64 27 20 65 78 70 72 65 73 73 | .value.of......the.`and'.express |
| 15280 | 69 6f 6e 20 69 73 20 66 61 6c 73 65 2c 20 61 6e 64 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 | ion.is.false,.and.the.rest.of.th |
| 152a0 | 65 20 3c 45 3e 27 73 20 61 72 65 20 6e 6f 74 0a 20 20 20 20 20 65 76 61 6c 75 61 74 65 64 2e 20 | e.<E>'s.are.not......evaluated.. |
| 152c0 | 20 49 66 20 61 6c 6c 20 3c 45 3e 27 73 20 65 76 61 6c 75 61 74 65 20 74 6f 20 74 72 75 65 20 76 | .If.all.<E>'s.evaluate.to.true.v |
| 152e0 | 61 6c 75 65 73 2c 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 20 20 20 20 20 60 61 6e | alues,.the.value.of.the......`an |
| 15300 | 64 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 | d'.expression.is.the.value.of.th |
| 15320 | 65 20 6c 61 73 74 20 6f 6e 65 2e 0a 0a 20 20 20 2a 20 60 28 6f 72 20 3c 45 31 3e 20 2e 2e 2e 20 | e.last.one......*.`(or.<E1>..... |
| 15340 | 3c 45 4e 3e 29 27 0a 0a 20 20 20 20 20 54 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 65 76 61 | <EN>)'.......The.interpreter.eva |
| 15360 | 6c 75 61 74 65 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 3c 45 3e 20 6f 6e 65 20 61 | luates.the.expressions.<E>.one.a |
| 15380 | 74 20 61 20 74 69 6d 65 2c 20 69 6e 0a 20 20 20 20 20 6c 65 66 74 2d 74 6f 2d 72 69 67 68 74 20 | t.a.time,.in......left-to-right. |
| 153a0 | 6f 72 64 65 72 2e 20 20 49 66 20 61 6e 79 20 3c 45 3e 20 65 76 61 6c 75 61 74 65 73 20 74 6f 20 | order...If.any.<E>.evaluates.to. |
| 153c0 | 61 20 74 72 75 65 20 76 61 6c 75 65 2c 20 74 68 61 74 0a 20 20 20 20 20 76 61 6c 75 65 20 69 73 | a.true.value,.that......value.is |
| 153e0 | 20 72 65 74 75 72 6e 65 64 20 61 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 6f | .returned.as.the.value.of.the.`o |
| 15400 | 72 27 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 61 6e 64 20 74 68 65 0a 20 20 20 20 20 72 65 73 74 | r'.expression,.and.the......rest |
| 15420 | 20 6f 66 20 74 68 65 20 3c 45 3e 27 73 20 61 72 65 20 6e 6f 74 20 65 76 61 6c 75 61 74 65 64 2e | .of.the.<E>'s.are.not.evaluated. |
| 15440 | 20 20 49 66 20 61 6c 6c 20 3c 45 3e 27 73 20 65 76 61 6c 75 61 74 65 20 74 6f 0a 20 20 20 20 20 | ..If.all.<E>'s.evaluate.to...... |
| 15460 | 66 61 6c 73 65 2c 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 6f 72 27 20 65 78 70 | false,.the.value.of.the.`or'.exp |
| 15480 | 72 65 73 73 69 6f 6e 20 69 73 20 66 61 6c 73 65 2e 0a 0a 20 20 20 2a 20 60 28 6e 6f 74 20 3c 45 | ression.is.false......*.`(not.<E |
| 154a0 | 3e 29 27 0a 0a 20 20 20 20 20 54 68 65 20 76 61 6c 75 65 20 6f 66 20 61 20 60 6e 6f 74 27 20 65 | >)'.......The.value.of.a.`not'.e |
| 154c0 | 78 70 72 65 73 73 69 6f 6e 20 69 73 20 74 72 75 65 20 77 68 65 6e 20 74 68 65 20 65 78 70 72 65 | xpression.is.true.when.the.expre |
| 154e0 | 73 73 69 6f 6e 20 3c 45 3e 0a 20 20 20 20 20 65 76 61 6c 75 61 74 65 73 20 74 6f 20 66 61 6c 73 | ssion.<E>......evaluates.to.fals |
| 15500 | 65 2c 20 61 6e 64 20 66 61 6c 73 65 20 6f 74 68 65 72 77 69 73 65 2e 0a 0a 0a 20 20 20 4e 6f 74 | e,.and.false.otherwise.......Not |
| 15520 | 69 63 65 20 74 68 61 74 20 60 61 6e 64 27 20 61 6e 64 20 60 6f 72 27 20 61 72 65 20 73 70 65 63 | ice.that.`and'.and.`or'.are.spec |
| 15540 | 69 61 6c 20 66 6f 72 6d 73 2c 20 6e 6f 74 20 70 72 6f 63 65 64 75 72 65 73 2c 20 62 65 63 61 75 | ial.forms,.not.procedures,.becau |
| 15560 | 73 65 0a 74 68 65 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 6e 6f 74 20 6e 65 | se.the.subexpressions.are.not.ne |
| 15580 | 63 65 73 73 61 72 69 6c 79 20 61 6c 6c 20 65 76 61 6c 75 61 74 65 64 2e 20 20 60 4e 6f 74 27 20 | cessarily.all.evaluated...`Not'. |
| 155a0 | 69 73 20 61 6e 0a 6f 72 64 69 6e 61 72 79 20 70 72 6f 63 65 64 75 72 65 2e 0a 0a 20 20 20 41 73 | is.an.ordinary.procedure......As |
| 155c0 | 20 61 6e 20 65 78 61 6d 70 6c 65 20 6f 66 20 68 6f 77 20 74 68 65 73 65 20 61 72 65 20 75 73 65 | .an.example.of.how.these.are.use |
| 155e0 | 64 2c 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 20 74 68 61 74 20 61 20 6e 75 6d 62 65 72 20 78 | d,.the.condition.that.a.number.x |
| 15600 | 0a 62 65 20 69 6e 20 74 68 65 20 72 61 6e 67 65 20 35 20 3c 20 78 20 3c 20 31 30 20 6d 61 79 20 | .be.in.the.range.5.<.x.<.10.may. |
| 15620 | 62 65 20 65 78 70 72 65 73 73 65 64 20 61 73 0a 0a 20 20 20 20 20 28 61 6e 64 20 28 3e 20 78 20 | be.expressed.as.......(and.(>.x. |
| 15640 | 35 29 20 28 3c 20 78 20 31 30 29 29 0a 0a 20 20 20 41 73 20 61 6e 6f 74 68 65 72 20 65 78 61 6d | 5).(<.x.10)).....As.another.exam |
| 15660 | 70 6c 65 2c 20 77 65 20 63 61 6e 20 64 65 66 69 6e 65 20 61 20 70 72 65 64 69 63 61 74 65 20 74 | ple,.we.can.define.a.predicate.t |
| 15680 | 6f 20 74 65 73 74 20 77 68 65 74 68 65 72 20 6f 6e 65 0a 6e 75 6d 62 65 72 20 69 73 20 67 72 65 | o.test.whether.one.number.is.gre |
| 156a0 | 61 74 65 72 20 74 68 61 6e 20 6f 72 20 65 71 75 61 6c 20 74 6f 20 61 6e 6f 74 68 65 72 20 61 73 | ater.than.or.equal.to.another.as |
| 156c0 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 3e 3d 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 | .......(define.(>=.x.y)........( |
| 156e0 | 6f 72 20 28 3e 20 78 20 79 29 20 28 3d 20 78 20 79 29 29 29 0a 0a 6f 72 20 61 6c 74 65 72 6e 61 | or.(>.x.y).(=.x.y)))..or.alterna |
| 15700 | 74 69 76 65 6c 79 20 61 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 3e 3d 20 78 20 79 29 | tively.as.......(define.(>=.x.y) |
| 15720 | 0a 20 20 20 20 20 20 20 28 6e 6f 74 20 28 3c 20 78 20 79 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 | ........(not.(<.x.y))).......*Ex |
| 15740 | 65 72 63 69 73 65 20 31 2e 31 3a 2a 20 42 65 6c 6f 77 20 69 73 20 61 20 73 65 71 75 65 6e 63 65 | ercise.1.1:*.Below.is.a.sequence |
| 15760 | 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 57 68 61 74 20 69 73 20 74 68 65 0a 20 20 | .of.expressions...What.is.the... |
| 15780 | 20 20 20 72 65 73 75 6c 74 20 70 72 69 6e 74 65 64 20 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 | ...result.printed.by.the.interpr |
| 157a0 | 65 74 65 72 20 69 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 20 65 61 63 68 20 65 78 70 72 65 73 73 | eter.in.response.to.each.express |
| 157c0 | 69 6f 6e 3f 0a 20 20 20 20 20 41 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 20 73 65 71 75 65 6e | ion?......Assume.that.the.sequen |
| 157e0 | 63 65 20 69 73 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 74 68 65 20 6f 72 64 | ce.is.to.be.evaluated.in.the.ord |
| 15800 | 65 72 20 69 6e 20 77 68 69 63 68 0a 20 20 20 20 20 69 74 20 69 73 20 70 72 65 73 65 6e 74 65 64 | er.in.which......it.is.presented |
| 15820 | 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 31 30 0a 0a 20 20 20 20 20 20 20 20 20 20 28 2b 20 35 20 | .............10............(+.5. |
| 15840 | 33 20 34 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 2d 20 39 20 31 29 0a 0a 20 20 20 20 20 20 20 | 3.4)............(-.9.1)......... |
| 15860 | 20 20 20 28 2f 20 36 20 32 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 2a 20 32 20 34 29 | ...(/.6.2)............(+.(*.2.4) |
| 15880 | 20 28 2d 20 34 20 36 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 61 20 33 | .(-.4.6))............(define.a.3 |
| 158a0 | 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 62 20 28 2b 20 61 20 31 29 29 0a | )............(define.b.(+.a.1)). |
| 158c0 | 0a 20 20 20 20 20 20 20 20 20 20 28 2b 20 61 20 62 20 28 2a 20 61 20 62 29 29 0a 0a 20 20 20 20 | ...........(+.a.b.(*.a.b))...... |
| 158e0 | 20 20 20 20 20 20 28 3d 20 61 20 62 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 61 6e | ......(=.a.b)............(if.(an |
| 15900 | 64 20 28 3e 20 62 20 61 29 20 28 3c 20 62 20 28 2a 20 61 20 62 29 29 29 0a 20 20 20 20 20 20 20 | d.(>.b.a).(<.b.(*.a.b)))........ |
| 15920 | 20 20 20 20 20 20 20 62 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 29 0a 0a 20 20 20 20 20 | .......b...............a)....... |
| 15940 | 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d 20 61 20 34 29 20 36 29 0a 20 20 20 20 20 20 20 20 20 | .....(cond.((=.a.4).6).......... |
| 15960 | 20 20 20 20 20 20 20 28 28 3d 20 62 20 34 29 20 28 2b 20 36 20 37 20 61 29 29 0a 20 20 20 20 20 | .......((=.b.4).(+.6.7.a))...... |
| 15980 | 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 32 35 29 29 0a 0a 20 20 20 20 20 20 20 20 20 | ...........(else.25))........... |
| 159a0 | 20 28 2b 20 32 20 28 69 66 20 28 3e 20 62 20 61 29 20 62 20 61 29 29 0a 0a 20 20 20 20 20 20 20 | .(+.2.(if.(>.b.a).b.a))......... |
| 159c0 | 20 20 20 28 2a 20 28 63 6f 6e 64 20 28 28 3e 20 61 20 62 29 20 61 29 0a 20 20 20 20 20 20 20 20 | ...(*.(cond.((>.a.b).a)......... |
| 159e0 | 20 20 20 20 20 20 20 20 20 20 20 28 28 3c 20 61 20 62 29 20 62 29 0a 20 20 20 20 20 20 20 20 20 | ...........((<.a.b).b).......... |
| 15a00 | 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 2d 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ..........(else.-1))............ |
| 15a20 | 20 20 28 2b 20 61 20 31 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 32 3a 2a | ..(+.a.1)).......*Exercise.1.2:* |
| 15a40 | 20 54 72 61 6e 73 6c 61 74 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 78 70 72 65 73 73 | .Translate.the.following.express |
| 15a60 | 69 6f 6e 20 69 6e 74 6f 20 70 72 65 66 69 78 0a 20 20 20 20 20 66 6f 72 6d 2e 0a 0a 20 20 20 20 | ion.into.prefix......form....... |
| 15a80 | 20 20 20 20 20 20 35 20 2b 20 34 20 2b 20 28 32 20 2d 20 28 33 20 2d 20 28 36 20 2b 20 34 2f 35 | ......5.+.4.+.(2.-.(3.-.(6.+.4/5 |
| 15aa0 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | )))...........------------------ |
| 15ac0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 28 36 | -----------..................3(6 |
| 15ae0 | 20 2d 20 32 29 28 32 20 2d 20 37 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 33 | .-.2)(2.-.7).......*Exercise.1.3 |
| 15b00 | 3a 2a 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 | :*.Define.a.procedure.that.takes |
| 15b20 | 20 74 68 72 65 65 20 6e 75 6d 62 65 72 73 20 61 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 | .three.numbers.as......arguments |
| 15b40 | 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 73 71 75 61 | .and.returns.the.sum.of.the.squa |
| 15b60 | 72 65 73 20 6f 66 20 74 68 65 20 74 77 6f 20 6c 61 72 67 65 72 0a 20 20 20 20 20 6e 75 6d 62 65 | res.of.the.two.larger......numbe |
| 15b80 | 72 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 34 3a 2a 20 4f 62 73 65 72 76 | rs........*Exercise.1.4:*.Observ |
| 15ba0 | 65 20 74 68 61 74 20 6f 75 72 20 6d 6f 64 65 6c 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 61 | e.that.our.model.of.evaluation.a |
| 15bc0 | 6c 6c 6f 77 73 20 66 6f 72 0a 20 20 20 20 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 77 68 6f 73 | llows.for......combinations.whos |
| 15be0 | 65 20 6f 70 65 72 61 74 6f 72 73 20 61 72 65 20 63 6f 6d 70 6f 75 6e 64 20 65 78 70 72 65 73 73 | e.operators.are.compound.express |
| 15c00 | 69 6f 6e 73 2e 20 20 55 73 65 20 74 68 69 73 0a 20 20 20 20 20 6f 62 73 65 72 76 61 74 69 6f 6e | ions...Use.this......observation |
| 15c20 | 20 74 6f 20 64 65 73 63 72 69 62 65 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 | .to.describe.the.behavior.of.the |
| 15c40 | 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 | .following.procedure:........... |
| 15c60 | 20 28 64 65 66 69 6e 65 20 28 61 2d 70 6c 75 73 2d 61 62 73 2d 62 20 61 20 62 29 0a 20 20 20 20 | .(define.(a-plus-abs-b.a.b)..... |
| 15c80 | 20 20 20 20 20 20 20 20 28 28 69 66 20 28 3e 20 62 20 30 29 20 2b 20 2d 29 20 61 20 62 29 29 0a | ........((if.(>.b.0).+.-).a.b)). |
| 15ca0 | 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 35 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 | ......*Exercise.1.5:*.Ben.Bitdid |
| 15cc0 | 64 6c 65 20 68 61 73 20 69 6e 76 65 6e 74 65 64 20 61 20 74 65 73 74 20 74 6f 20 64 65 74 65 72 | dle.has.invented.a.test.to.deter |
| 15ce0 | 6d 69 6e 65 0a 20 20 20 20 20 77 68 65 74 68 65 72 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 | mine......whether.the.interprete |
| 15d00 | 72 20 68 65 20 69 73 20 66 61 63 65 64 20 77 69 74 68 20 69 73 20 75 73 69 6e 67 0a 20 20 20 20 | r.he.is.faced.with.is.using..... |
| 15d20 | 20 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 72 | .applicative-order.evaluation.or |
| 15d40 | 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 2e 20 20 48 65 0a 20 20 | .normal-order.evaluation...He... |
| 15d60 | 20 20 20 64 65 66 69 6e 65 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 77 6f 20 70 72 6f | ...defines.the.following.two.pro |
| 15d80 | 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 29 20 | cedures:............(define.(p). |
| 15da0 | 28 70 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 65 73 74 20 78 20 | (p))............(define.(test.x. |
| 15dc0 | 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 78 20 30 29 0a 20 20 20 20 20 | y).............(if.(=.x.0)...... |
| 15de0 | 20 20 20 20 20 20 20 20 20 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 29 29 | ...........0.................y)) |
| 15e00 | 0a 0a 20 20 20 20 20 54 68 65 6e 20 68 65 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 65 78 70 | .......Then.he.evaluates.the.exp |
| 15e20 | 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 30 20 28 70 29 29 0a | ression............(test.0.(p)). |
| 15e40 | 0a 20 20 20 20 20 57 68 61 74 20 62 65 68 61 76 69 6f 72 20 77 69 6c 6c 20 42 65 6e 20 6f 62 73 | ......What.behavior.will.Ben.obs |
| 15e60 | 65 72 76 65 20 77 69 74 68 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 68 61 74 20 75 73 | erve.with.an.interpreter.that.us |
| 15e80 | 65 73 0a 20 20 20 20 20 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 | es......applicative-order.evalua |
| 15ea0 | 74 69 6f 6e 3f 20 20 57 68 61 74 20 62 65 68 61 76 69 6f 72 20 77 69 6c 6c 20 68 65 20 6f 62 73 | tion?..What.behavior.will.he.obs |
| 15ec0 | 65 72 76 65 20 77 69 74 68 0a 20 20 20 20 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 68 | erve.with......an.interpreter.th |
| 15ee0 | 61 74 20 75 73 65 73 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 3f | at.uses.normal-order.evaluation? |
| 15f00 | 20 20 45 78 70 6c 61 69 6e 20 79 6f 75 72 0a 20 20 20 20 20 61 6e 73 77 65 72 2e 20 20 28 41 73 | ..Explain.your......answer...(As |
| 15f20 | 73 75 6d 65 20 74 68 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 20 66 6f | sume.that.the.evaluation.rule.fo |
| 15f40 | 72 20 74 68 65 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 0a 20 20 20 20 20 60 69 66 27 20 69 73 20 | r.the.special.form......`if'.is. |
| 15f60 | 74 68 65 20 73 61 6d 65 20 77 68 65 74 68 65 72 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 | the.same.whether.the.interpreter |
| 15f80 | 20 69 73 20 75 73 69 6e 67 20 6e 6f 72 6d 61 6c 20 6f 72 0a 20 20 20 20 20 61 70 70 6c 69 63 61 | .is.using.normal.or......applica |
| 15fa0 | 74 69 76 65 20 6f 72 64 65 72 3a 20 54 68 65 20 70 72 65 64 69 63 61 74 65 20 65 78 70 72 65 73 | tive.order:.The.predicate.expres |
| 15fc0 | 73 69 6f 6e 20 69 73 20 65 76 61 6c 75 61 74 65 64 20 66 69 72 73 74 2c 0a 20 20 20 20 20 61 6e | sion.is.evaluated.first,......an |
| 15fe0 | 64 20 74 68 65 20 72 65 73 75 6c 74 20 64 65 74 65 72 6d 69 6e 65 73 20 77 68 65 74 68 65 72 20 | d.the.result.determines.whether. |
| 16000 | 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 63 6f 6e 73 65 71 75 65 6e 74 20 6f 72 0a 20 20 | to.evaluate.the.consequent.or... |
| 16020 | 20 20 20 74 68 65 20 61 6c 74 65 72 6e 61 74 69 76 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 29 0a | ...the.alternative.expression.). |
| 16040 | 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d | ....----------.Footnotes.------- |
| 16060 | 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 22 49 6e 74 65 72 70 72 65 74 65 64 20 61 73 20 65 69 74 68 | ---.....(1)."Interpreted.as.eith |
| 16080 | 65 72 20 74 72 75 65 20 6f 72 20 66 61 6c 73 65 22 20 6d 65 61 6e 73 20 74 68 69 73 3a 20 49 6e | er.true.or.false".means.this:.In |
| 160a0 | 20 53 63 68 65 6d 65 2c 0a 74 68 65 72 65 20 61 72 65 20 74 77 6f 20 64 69 73 74 69 6e 67 75 69 | .Scheme,.there.are.two.distingui |
| 160c0 | 73 68 65 64 20 76 61 6c 75 65 73 20 74 68 61 74 20 61 72 65 20 64 65 6e 6f 74 65 64 20 62 79 20 | shed.values.that.are.denoted.by. |
| 160e0 | 74 68 65 20 63 6f 6e 73 74 61 6e 74 73 0a 60 23 74 27 20 61 6e 64 20 60 23 66 27 2e 20 20 57 68 | the.constants.`#t'.and.`#f'...Wh |
| 16100 | 65 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 63 68 65 63 6b 73 20 61 20 70 72 65 64 | en.the.interpreter.checks.a.pred |
| 16120 | 69 63 61 74 65 27 73 20 76 61 6c 75 65 2c 20 69 74 0a 69 6e 74 65 72 70 72 65 74 73 20 60 23 66 | icate's.value,.it.interprets.`#f |
| 16140 | 27 20 61 73 20 66 61 6c 73 65 2e 20 20 41 6e 79 20 6f 74 68 65 72 20 76 61 6c 75 65 20 69 73 20 | '.as.false...Any.other.value.is. |
| 16160 | 74 72 65 61 74 65 64 20 61 73 20 74 72 75 65 2e 20 20 28 54 68 75 73 2c 0a 70 72 6f 76 69 64 69 | treated.as.true...(Thus,.providi |
| 16180 | 6e 67 20 60 23 74 27 20 69 73 20 6c 6f 67 69 63 61 6c 6c 79 20 75 6e 6e 65 63 65 73 73 61 72 79 | ng.`#t'.is.logically.unnecessary |
| 161a0 | 2c 20 62 75 74 20 69 74 20 69 73 20 63 6f 6e 76 65 6e 69 65 6e 74 2e 29 20 20 49 6e 0a 74 68 69 | ,.but.it.is.convenient.)..In.thi |
| 161c0 | 73 20 62 6f 6f 6b 20 77 65 20 77 69 6c 6c 20 75 73 65 20 6e 61 6d 65 73 20 60 74 72 75 65 27 20 | s.book.we.will.use.names.`true'. |
| 161e0 | 61 6e 64 20 60 66 61 6c 73 65 27 2c 20 77 68 69 63 68 20 61 72 65 20 61 73 73 6f 63 69 61 74 65 | and.`false',.which.are.associate |
| 16200 | 64 0a 77 69 74 68 20 74 68 65 20 76 61 6c 75 65 73 20 60 23 74 27 20 61 6e 64 20 60 23 66 27 20 | d.with.the.values.`#t'.and.`#f'. |
| 16220 | 72 65 73 70 65 63 74 69 76 65 6c 79 2e 0a 0a 20 20 20 28 32 29 20 60 41 62 73 27 20 61 6c 73 6f | respectively......(2).`Abs'.also |
| 16240 | 20 75 73 65 73 20 74 68 65 20 22 6d 69 6e 75 73 22 20 6f 70 65 72 61 74 6f 72 20 60 2d 27 2c 20 | .uses.the."minus".operator.`-',. |
| 16260 | 77 68 69 63 68 2c 20 77 68 65 6e 20 75 73 65 64 20 77 69 74 68 0a 61 20 73 69 6e 67 6c 65 20 6f | which,.when.used.with.a.single.o |
| 16280 | 70 65 72 61 6e 64 2c 20 61 73 20 69 6e 20 60 28 2d 20 78 29 27 2c 20 69 6e 64 69 63 61 74 65 73 | perand,.as.in.`(-.x)',.indicates |
| 162a0 | 20 6e 65 67 61 74 69 6f 6e 2e 0a 0a 20 20 20 28 33 29 20 41 20 6d 69 6e 6f 72 20 64 69 66 66 65 | .negation......(3).A.minor.diffe |
| 162c0 | 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 60 69 66 27 20 61 6e 64 20 60 63 6f 6e 64 27 20 69 73 | rence.between.`if'.and.`cond'.is |
| 162e0 | 20 74 68 61 74 20 74 68 65 20 3c 45 3e 20 70 61 72 74 0a 6f 66 20 65 61 63 68 20 60 63 6f 6e 64 | .that.the.<E>.part.of.each.`cond |
| 16300 | 27 20 63 6c 61 75 73 65 20 6d 61 79 20 62 65 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 65 78 | '.clause.may.be.a.sequence.of.ex |
| 16320 | 70 72 65 73 73 69 6f 6e 73 2e 20 20 49 66 20 74 68 65 0a 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 | pressions...If.the.corresponding |
| 16340 | 20 3c 50 3e 20 69 73 20 66 6f 75 6e 64 20 74 6f 20 62 65 20 74 72 75 65 2c 20 74 68 65 20 65 78 | .<P>.is.found.to.be.true,.the.ex |
| 16360 | 70 72 65 73 73 69 6f 6e 73 20 3c 45 3e 20 61 72 65 0a 65 76 61 6c 75 61 74 65 64 20 69 6e 20 73 | pressions.<E>.are.evaluated.in.s |
| 16380 | 65 71 75 65 6e 63 65 20 61 6e 64 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 66 69 6e | equence.and.the.value.of.the.fin |
| 163a0 | 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 0a 73 65 71 75 65 6e 63 65 20 69 73 | al.expression.in.the.sequence.is |
| 163c0 | 20 72 65 74 75 72 6e 65 64 20 61 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 63 | .returned.as.the.value.of.the.`c |
| 163e0 | 6f 6e 64 27 2e 20 20 49 6e 20 61 6e 20 60 69 66 27 0a 65 78 70 72 65 73 73 69 6f 6e 2c 20 68 6f | ond'...In.an.`if'.expression,.ho |
| 16400 | 77 65 76 65 72 2c 20 74 68 65 20 3c 43 4f 4e 53 45 51 55 45 4e 54 3e 20 61 6e 64 20 3c 41 4c 54 | wever,.the.<CONSEQUENT>.and.<ALT |
| 16420 | 45 52 4e 41 54 49 56 45 3e 20 6d 75 73 74 20 62 65 20 73 69 6e 67 6c 65 0a 65 78 70 72 65 73 73 | ERNATIVE>.must.be.single.express |
| 16440 | 69 6f 6e 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a | ions.....File:.sicp.info,..Node: |
| 16460 | 20 31 2d 31 2d 37 2c 20 20 4e 65 78 74 3a 20 31 2d 31 2d 38 2c 20 20 50 72 65 76 3a 20 31 2d 31 | .1-1-7,..Next:.1-1-8,..Prev:.1-1 |
| 16480 | 2d 36 2c 20 20 55 70 3a 20 31 2d 31 0a 0a 31 2e 31 2e 37 20 45 78 61 6d 70 6c 65 3a 20 53 71 75 | -6,..Up:.1-1..1.1.7.Example:.Squ |
| 164a0 | 61 72 65 20 52 6f 6f 74 73 20 62 79 20 4e 65 77 74 6f 6e 27 73 20 4d 65 74 68 6f 64 0a 2d 2d 2d | are.Roots.by.Newton's.Method.--- |
| 164c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 164e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 50 72 6f 63 65 64 75 72 65 73 2c 20 61 73 20 69 6e 74 72 | -----------..Procedures,.as.intr |
| 16500 | 6f 64 75 63 65 64 20 61 62 6f 76 65 2c 20 61 72 65 20 6d 75 63 68 20 6c 69 6b 65 20 6f 72 64 69 | oduced.above,.are.much.like.ordi |
| 16520 | 6e 61 72 79 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 0a 66 75 6e 63 74 69 6f 6e 73 2e 20 20 54 68 | nary.mathematical.functions...Th |
| 16540 | 65 79 20 73 70 65 63 69 66 79 20 61 20 76 61 6c 75 65 20 74 68 61 74 20 69 73 20 64 65 74 65 72 | ey.specify.a.value.that.is.deter |
| 16560 | 6d 69 6e 65 64 20 62 79 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 0a 70 61 72 61 6d 65 74 65 72 73 2e | mined.by.one.or.more.parameters. |
| 16580 | 20 20 42 75 74 20 74 68 65 72 65 20 69 73 20 61 6e 20 69 6d 70 6f 72 74 61 6e 74 20 64 69 66 66 | ..But.there.is.an.important.diff |
| 165a0 | 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 0a 66 75 6e 63 | erence.between.mathematical.func |
| 165c0 | 74 69 6f 6e 73 20 61 6e 64 20 63 6f 6d 70 75 74 65 72 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 | tions.and.computer.procedures... |
| 165e0 | 50 72 6f 63 65 64 75 72 65 73 20 6d 75 73 74 20 62 65 20 65 66 66 65 63 74 69 76 65 2e 0a 0a 20 | Procedures.must.be.effective.... |
| 16600 | 20 20 41 73 20 61 20 63 61 73 65 20 69 6e 20 70 6f 69 6e 74 2c 20 63 6f 6e 73 69 64 65 72 20 74 | ..As.a.case.in.point,.consider.t |
| 16620 | 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 63 6f 6d 70 75 74 69 6e 67 20 73 71 75 61 72 65 20 72 | he.problem.of.computing.square.r |
| 16640 | 6f 6f 74 73 2e 0a 57 65 20 63 61 6e 20 64 65 66 69 6e 65 20 74 68 65 20 73 71 75 61 72 65 2d 72 | oots..We.can.define.the.square-r |
| 16660 | 6f 6f 74 20 66 75 6e 63 74 69 6f 6e 20 61 73 0a 0a 20 20 20 20 20 73 71 72 74 28 78 29 20 3d 20 | oot.function.as.......sqrt(x).=. |
| 16680 | 74 68 65 20 79 20 73 75 63 68 20 74 68 61 74 20 79 20 3e 3d 20 30 20 61 6e 64 20 79 5e 32 20 3d | the.y.such.that.y.>=.0.and.y^2.= |
| 166a0 | 20 78 0a 0a 20 20 20 54 68 69 73 20 64 65 73 63 72 69 62 65 73 20 61 20 70 65 72 66 65 63 74 6c | .x.....This.describes.a.perfectl |
| 166c0 | 79 20 6c 65 67 69 74 69 6d 61 74 65 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 66 75 6e 63 74 69 | y.legitimate.mathematical.functi |
| 166e0 | 6f 6e 2e 20 20 57 65 0a 63 6f 75 6c 64 20 75 73 65 20 69 74 20 74 6f 20 72 65 63 6f 67 6e 69 7a | on...We.could.use.it.to.recogniz |
| 16700 | 65 20 77 68 65 74 68 65 72 20 6f 6e 65 20 6e 75 6d 62 65 72 20 69 73 20 74 68 65 20 73 71 75 61 | e.whether.one.number.is.the.squa |
| 16720 | 72 65 20 72 6f 6f 74 20 6f 66 0a 61 6e 6f 74 68 65 72 2c 20 6f 72 20 74 6f 20 64 65 72 69 76 65 | re.root.of.another,.or.to.derive |
| 16740 | 20 66 61 63 74 73 20 61 62 6f 75 74 20 73 71 75 61 72 65 20 72 6f 6f 74 73 20 69 6e 20 67 65 6e | .facts.about.square.roots.in.gen |
| 16760 | 65 72 61 6c 2e 20 20 4f 6e 20 74 68 65 0a 6f 74 68 65 72 20 68 61 6e 64 2c 20 74 68 65 20 64 65 | eral...On.the.other.hand,.the.de |
| 16780 | 66 69 6e 69 74 69 6f 6e 20 64 6f 65 73 20 6e 6f 74 20 64 65 73 63 72 69 62 65 20 61 20 70 72 6f | finition.does.not.describe.a.pro |
| 167a0 | 63 65 64 75 72 65 2e 20 20 49 6e 64 65 65 64 2c 20 69 74 0a 74 65 6c 6c 73 20 75 73 20 61 6c 6d | cedure...Indeed,.it.tells.us.alm |
| 167c0 | 6f 73 74 20 6e 6f 74 68 69 6e 67 20 61 62 6f 75 74 20 68 6f 77 20 74 6f 20 61 63 74 75 61 6c 6c | ost.nothing.about.how.to.actuall |
| 167e0 | 79 20 66 69 6e 64 20 74 68 65 20 73 71 75 61 72 65 20 72 6f 6f 74 20 6f 66 20 61 0a 67 69 76 65 | y.find.the.square.root.of.a.give |
| 16800 | 6e 20 6e 75 6d 62 65 72 2e 20 20 49 74 20 77 69 6c 6c 20 6e 6f 74 20 68 65 6c 70 20 6d 61 74 74 | n.number...It.will.not.help.matt |
| 16820 | 65 72 73 20 74 6f 20 72 65 70 68 72 61 73 65 20 74 68 69 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 | ers.to.rephrase.this.definition. |
| 16840 | 69 6e 0a 70 73 65 75 64 6f 2d 4c 69 73 70 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 | in.pseudo-Lisp:.......(define.(s |
| 16860 | 71 72 74 20 78 29 0a 20 20 20 20 20 20 20 28 74 68 65 20 79 20 28 61 6e 64 20 28 3e 3d 20 79 20 | qrt.x)........(the.y.(and.(>=.y. |
| 16880 | 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 3d 20 28 73 71 75 61 72 65 | 0)....................(=.(square |
| 168a0 | 20 79 29 20 78 29 29 29 29 0a 0a 20 20 20 54 68 69 73 20 6f 6e 6c 79 20 62 65 67 73 20 74 68 65 | .y).x)))).....This.only.begs.the |
| 168c0 | 20 71 75 65 73 74 69 6f 6e 2e 0a 0a 20 20 20 54 68 65 20 63 6f 6e 74 72 61 73 74 20 62 65 74 77 | .question......The.contrast.betw |
| 168e0 | 65 65 6e 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 61 20 | een.function.and.procedure.is.a. |
| 16900 | 72 65 66 6c 65 63 74 69 6f 6e 20 6f 66 20 74 68 65 0a 67 65 6e 65 72 61 6c 20 64 69 73 74 69 6e | reflection.of.the.general.distin |
| 16920 | 63 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 64 65 73 63 72 69 62 69 6e 67 20 70 72 6f 70 65 72 74 | ction.between.describing.propert |
| 16940 | 69 65 73 20 6f 66 20 74 68 69 6e 67 73 20 61 6e 64 0a 64 65 73 63 72 69 62 69 6e 67 20 68 6f 77 | ies.of.things.and.describing.how |
| 16960 | 20 74 6f 20 64 6f 20 74 68 69 6e 67 73 2c 20 6f 72 2c 20 61 73 20 69 74 20 69 73 20 73 6f 6d 65 | .to.do.things,.or,.as.it.is.some |
| 16980 | 74 69 6d 65 73 20 72 65 66 65 72 72 65 64 20 74 6f 2c 20 74 68 65 0a 64 69 73 74 69 6e 63 74 69 | times.referred.to,.the.distincti |
| 169a0 | 6f 6e 20 62 65 74 77 65 65 6e 20 64 65 63 6c 61 72 61 74 69 76 65 20 6b 6e 6f 77 6c 65 64 67 65 | on.between.declarative.knowledge |
| 169c0 | 20 61 6e 64 20 69 6d 70 65 72 61 74 69 76 65 20 6b 6e 6f 77 6c 65 64 67 65 2e 20 20 49 6e 0a 6d | .and.imperative.knowledge...In.m |
| 169e0 | 61 74 68 65 6d 61 74 69 63 73 20 77 65 20 61 72 65 20 75 73 75 61 6c 6c 79 20 63 6f 6e 63 65 72 | athematics.we.are.usually.concer |
| 16a00 | 6e 65 64 20 77 69 74 68 20 64 65 63 6c 61 72 61 74 69 76 65 20 28 77 68 61 74 20 69 73 29 0a 64 | ned.with.declarative.(what.is).d |
| 16a20 | 65 73 63 72 69 70 74 69 6f 6e 73 2c 20 77 68 65 72 65 61 73 20 69 6e 20 63 6f 6d 70 75 74 65 72 | escriptions,.whereas.in.computer |
| 16a40 | 20 73 63 69 65 6e 63 65 20 77 65 20 61 72 65 20 75 73 75 61 6c 6c 79 20 63 6f 6e 63 65 72 6e 65 | .science.we.are.usually.concerne |
| 16a60 | 64 20 77 69 74 68 0a 69 6d 70 65 72 61 74 69 76 65 20 28 68 6f 77 20 74 6f 29 20 64 65 73 63 72 | d.with.imperative.(how.to).descr |
| 16a80 | 69 70 74 69 6f 6e 73 2e 28 31 29 0a 0a 20 20 20 48 6f 77 20 64 6f 65 73 20 6f 6e 65 20 63 6f 6d | iptions.(1).....How.does.one.com |
| 16aa0 | 70 75 74 65 20 73 71 75 61 72 65 20 72 6f 6f 74 73 3f 20 20 54 68 65 20 6d 6f 73 74 20 63 6f 6d | pute.square.roots?..The.most.com |
| 16ac0 | 6d 6f 6e 20 77 61 79 20 69 73 20 74 6f 20 75 73 65 0a 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f | mon.way.is.to.use.Newton's.metho |
| 16ae0 | 64 20 6f 66 20 73 75 63 63 65 73 73 69 76 65 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 2c 20 | d.of.successive.approximations,. |
| 16b00 | 77 68 69 63 68 20 73 61 79 73 20 74 68 61 74 20 77 68 65 6e 65 76 65 72 0a 77 65 20 68 61 76 65 | which.says.that.whenever.we.have |
| 16b20 | 20 61 20 67 75 65 73 73 20 79 20 66 6f 72 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 | .a.guess.y.for.the.value.of.the. |
| 16b40 | 73 71 75 61 72 65 20 72 6f 6f 74 20 6f 66 20 61 20 6e 75 6d 62 65 72 20 78 2c 20 77 65 0a 63 61 | square.root.of.a.number.x,.we.ca |
| 16b60 | 6e 20 70 65 72 66 6f 72 6d 20 61 20 73 69 6d 70 6c 65 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 | n.perform.a.simple.manipulation. |
| 16b80 | 74 6f 20 67 65 74 20 61 20 62 65 74 74 65 72 20 67 75 65 73 73 20 28 6f 6e 65 20 63 6c 6f 73 65 | to.get.a.better.guess.(one.close |
| 16ba0 | 72 20 74 6f 0a 74 68 65 20 61 63 74 75 61 6c 20 73 71 75 61 72 65 20 72 6f 6f 74 29 20 62 79 20 | r.to.the.actual.square.root).by. |
| 16bc0 | 61 76 65 72 61 67 69 6e 67 20 79 20 77 69 74 68 20 78 2f 79 2e 28 32 29 20 46 6f 72 20 65 78 61 | averaging.y.with.x/y.(2).For.exa |
| 16be0 | 6d 70 6c 65 2c 20 77 65 20 63 61 6e 0a 63 6f 6d 70 75 74 65 20 74 68 65 20 73 71 75 61 72 65 20 | mple,.we.can.compute.the.square. |
| 16c00 | 72 6f 6f 74 20 6f 66 20 32 20 61 73 20 66 6f 6c 6c 6f 77 73 2e 20 20 53 75 70 70 6f 73 65 20 6f | root.of.2.as.follows...Suppose.o |
| 16c20 | 75 72 20 69 6e 69 74 69 61 6c 20 67 75 65 73 73 20 69 73 0a 31 3a 0a 0a 20 20 20 20 20 47 75 65 | ur.initial.guess.is.1:.......Gue |
| 16c40 | 73 73 20 20 51 75 6f 74 69 65 6e 74 20 20 20 20 20 20 20 20 20 20 20 20 20 41 76 65 72 61 67 65 | ss..Quotient.............Average |
| 16c60 | 0a 20 20 20 20 20 31 20 20 20 20 20 20 28 32 2f 31 29 20 3d 20 32 20 20 20 20 20 20 20 20 20 20 | ......1......(2/1).=.2.......... |
| 16c80 | 20 20 28 28 32 20 2b 20 31 29 2f 32 29 20 3d 20 31 2e 35 0a 20 20 20 20 20 31 2e 35 20 20 20 20 | ..((2.+.1)/2).=.1.5......1.5.... |
| 16ca0 | 28 32 2f 31 2e 35 29 20 3d 20 31 2e 33 33 33 33 20 20 20 20 20 28 28 31 2e 33 33 33 33 20 2b 20 | (2/1.5).=.1.3333.....((1.3333.+. |
| 16cc0 | 31 2e 35 29 2f 32 29 20 3d 20 31 2e 34 31 36 37 0a 20 20 20 20 20 31 2e 34 31 36 37 20 28 32 2f | 1.5)/2).=.1.4167......1.4167.(2/ |
| 16ce0 | 31 2e 34 31 36 37 29 20 3d 20 31 2e 34 31 31 38 20 20 28 28 31 2e 34 31 36 37 20 2b 20 31 2e 34 | 1.4167).=.1.4118..((1.4167.+.1.4 |
| 16d00 | 31 31 38 29 2f 32 29 20 3d 20 31 2e 34 31 34 32 0a 20 20 20 20 20 31 2e 34 31 34 32 20 2e 2e 2e | 118)/2).=.1.4142......1.4142.... |
| 16d20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 0a 0a 43 6f 6e 74 69 6e 75 69 6e | .......................Continuin |
| 16d40 | 67 20 74 68 69 73 20 70 72 6f 63 65 73 73 2c 20 77 65 20 6f 62 74 61 69 6e 20 62 65 74 74 65 72 | g.this.process,.we.obtain.better |
| 16d60 | 20 61 6e 64 20 62 65 74 74 65 72 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 74 6f 0a 74 68 | .and.better.approximations.to.th |
| 16d80 | 65 20 73 71 75 61 72 65 20 72 6f 6f 74 2e 0a 0a 20 20 20 4e 6f 77 20 6c 65 74 27 73 20 66 6f 72 | e.square.root......Now.let's.for |
| 16da0 | 6d 61 6c 69 7a 65 20 74 68 65 20 70 72 6f 63 65 73 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 70 | malize.the.process.in.terms.of.p |
| 16dc0 | 72 6f 63 65 64 75 72 65 73 2e 20 20 57 65 20 73 74 61 72 74 0a 77 69 74 68 20 61 20 76 61 6c 75 | rocedures...We.start.with.a.valu |
| 16de0 | 65 20 66 6f 72 20 74 68 65 20 72 61 64 69 63 61 6e 64 20 28 74 68 65 20 6e 75 6d 62 65 72 20 77 | e.for.the.radicand.(the.number.w |
| 16e00 | 68 6f 73 65 20 73 71 75 61 72 65 20 72 6f 6f 74 20 77 65 20 61 72 65 0a 74 72 79 69 6e 67 20 74 | hose.square.root.we.are.trying.t |
| 16e20 | 6f 20 63 6f 6d 70 75 74 65 29 20 61 6e 64 20 61 20 76 61 6c 75 65 20 66 6f 72 20 74 68 65 20 67 | o.compute).and.a.value.for.the.g |
| 16e40 | 75 65 73 73 2e 20 20 49 66 20 74 68 65 20 67 75 65 73 73 20 69 73 20 67 6f 6f 64 0a 65 6e 6f 75 | uess...If.the.guess.is.good.enou |
| 16e60 | 67 68 20 66 6f 72 20 6f 75 72 20 70 75 72 70 6f 73 65 73 2c 20 77 65 20 61 72 65 20 64 6f 6e 65 | gh.for.our.purposes,.we.are.done |
| 16e80 | 3b 20 69 66 20 6e 6f 74 2c 20 77 65 20 6d 75 73 74 20 72 65 70 65 61 74 20 74 68 65 0a 70 72 6f | ;.if.not,.we.must.repeat.the.pro |
| 16ea0 | 63 65 73 73 20 77 69 74 68 20 61 6e 20 69 6d 70 72 6f 76 65 64 20 67 75 65 73 73 2e 20 20 57 65 | cess.with.an.improved.guess...We |
| 16ec0 | 20 77 72 69 74 65 20 74 68 69 73 20 62 61 73 69 63 20 73 74 72 61 74 65 67 79 20 61 73 20 61 0a | .write.this.basic.strategy.as.a. |
| 16ee0 | 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 2d 69 | procedure:.......(define.(sqrt-i |
| 16f00 | 74 65 72 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 67 6f 6f 64 2d 65 6e | ter.guess.x)........(if.(good-en |
| 16f20 | 6f 75 67 68 3f 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 67 75 65 73 73 0a | ough?.guess.x)............guess. |
| 16f40 | 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 28 69 6d 70 72 6f 76 65 20 67 | ...........(sqrt-iter.(improve.g |
| 16f60 | 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 29 | uess.x).......................x) |
| 16f80 | 29 29 0a 0a 20 20 20 41 20 67 75 65 73 73 20 69 73 20 69 6d 70 72 6f 76 65 64 20 62 79 20 61 76 | )).....A.guess.is.improved.by.av |
| 16fa0 | 65 72 61 67 69 6e 67 20 69 74 20 77 69 74 68 20 74 68 65 20 71 75 6f 74 69 65 6e 74 20 6f 66 20 | eraging.it.with.the.quotient.of. |
| 16fc0 | 74 68 65 0a 72 61 64 69 63 61 6e 64 20 61 6e 64 20 74 68 65 20 6f 6c 64 20 67 75 65 73 73 3a 0a | the.radicand.and.the.old.guess:. |
| 16fe0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 70 72 6f 76 65 20 67 75 65 73 73 20 78 29 0a | ......(define.(improve.guess.x). |
| 17000 | 20 20 20 20 20 20 20 28 61 76 65 72 61 67 65 20 67 75 65 73 73 20 28 2f 20 78 20 67 75 65 73 73 | .......(average.guess.(/.x.guess |
| 17020 | 29 29 29 0a 0a 77 68 65 72 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 76 65 72 61 67 | )))..where.......(define.(averag |
| 17040 | 65 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 2f 20 28 2b 20 78 20 79 29 20 32 29 29 0a 0a 20 20 | e.x.y)........(/.(+.x.y).2)).... |
| 17060 | 20 57 65 20 61 6c 73 6f 20 68 61 76 65 20 74 6f 20 73 61 79 20 77 68 61 74 20 77 65 20 6d 65 61 | .We.also.have.to.say.what.we.mea |
| 17080 | 6e 20 62 79 20 22 67 6f 6f 64 20 65 6e 6f 75 67 68 2e 22 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 | n.by."good.enough."..The.followi |
| 170a0 | 6e 67 0a 77 69 6c 6c 20 64 6f 20 66 6f 72 20 69 6c 6c 75 73 74 72 61 74 69 6f 6e 2c 20 62 75 74 | ng.will.do.for.illustration,.but |
| 170c0 | 20 69 74 20 69 73 20 6e 6f 74 20 72 65 61 6c 6c 79 20 61 20 76 65 72 79 20 67 6f 6f 64 20 74 65 | .it.is.not.really.a.very.good.te |
| 170e0 | 73 74 2e 20 20 28 53 65 65 0a 65 78 65 72 63 69 73 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 | st...(See.exercise.*Note.Exercis |
| 17100 | 65 20 31 2d 37 3a 3a 2e 29 20 20 54 68 65 20 69 64 65 61 20 69 73 20 74 6f 20 69 6d 70 72 6f 76 | e.1-7::.)..The.idea.is.to.improv |
| 17120 | 65 20 74 68 65 20 61 6e 73 77 65 72 0a 75 6e 74 69 6c 20 69 74 20 69 73 20 63 6c 6f 73 65 20 65 | e.the.answer.until.it.is.close.e |
| 17140 | 6e 6f 75 67 68 20 73 6f 20 74 68 61 74 20 69 74 73 20 73 71 75 61 72 65 20 64 69 66 66 65 72 73 | nough.so.that.its.square.differs |
| 17160 | 20 66 72 6f 6d 20 74 68 65 20 72 61 64 69 63 61 6e 64 0a 62 79 20 6c 65 73 73 20 74 68 61 6e 20 | .from.the.radicand.by.less.than. |
| 17180 | 61 20 70 72 65 64 65 74 65 72 6d 69 6e 65 64 20 74 6f 6c 65 72 61 6e 63 65 20 28 68 65 72 65 20 | a.predetermined.tolerance.(here. |
| 171a0 | 30 2e 30 30 31 29 3a 28 33 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 67 6f 6f 64 2d 65 | 0.001):(3).......(define.(good-e |
| 171c0 | 6e 6f 75 67 68 3f 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 28 3c 20 28 61 62 73 20 28 | nough?.guess.x)........(<.(abs.( |
| 171e0 | 2d 20 28 73 71 75 61 72 65 20 67 75 65 73 73 29 20 78 29 29 20 30 2e 30 30 31 29 29 0a 0a 20 20 | -.(square.guess).x)).0.001)).... |
| 17200 | 20 46 69 6e 61 6c 6c 79 2c 20 77 65 20 6e 65 65 64 20 61 20 77 61 79 20 74 6f 20 67 65 74 20 73 | .Finally,.we.need.a.way.to.get.s |
| 17220 | 74 61 72 74 65 64 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 77 65 20 63 61 6e 20 61 6c | tarted...For.instance,.we.can.al |
| 17240 | 77 61 79 73 0a 67 75 65 73 73 20 74 68 61 74 20 74 68 65 20 73 71 75 61 72 65 20 72 6f 6f 74 20 | ways.guess.that.the.square.root. |
| 17260 | 6f 66 20 61 6e 79 20 6e 75 6d 62 65 72 20 69 73 20 31 3a 28 34 29 0a 0a 20 20 20 20 20 28 64 65 | of.any.number.is.1:(4).......(de |
| 17280 | 66 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 | fine.(sqrt.x)........(sqrt-iter. |
| 172a0 | 31 2e 30 20 78 29 29 0a 0a 20 20 20 49 66 20 77 65 20 74 79 70 65 20 74 68 65 73 65 20 64 65 66 | 1.0.x)).....If.we.type.these.def |
| 172c0 | 69 6e 69 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2c 20 77 65 20 | initions.to.the.interpreter,.we. |
| 172e0 | 63 61 6e 20 75 73 65 20 60 73 71 72 74 27 0a 6a 75 73 74 20 61 73 20 77 65 20 63 61 6e 20 75 73 | can.use.`sqrt'.just.as.we.can.us |
| 17300 | 65 20 61 6e 79 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 73 71 72 74 20 39 29 0a | e.any.procedure:.......(sqrt.9). |
| 17320 | 20 20 20 20 20 33 2e 30 30 30 30 39 31 35 35 34 31 33 31 33 38 0a 0a 20 20 20 20 20 28 73 71 72 | .....3.00009155413138.......(sqr |
| 17340 | 74 20 28 2b 20 31 30 30 20 33 37 29 29 0a 20 20 20 20 20 31 31 2e 37 30 34 36 39 39 39 31 37 37 | t.(+.100.37))......11.7046999177 |
| 17360 | 35 38 31 34 35 0a 0a 20 20 20 20 20 28 73 71 72 74 20 28 2b 20 28 73 71 72 74 20 32 29 20 28 73 | 58145.......(sqrt.(+.(sqrt.2).(s |
| 17380 | 71 72 74 20 33 29 29 29 0a 20 20 20 20 20 31 2e 37 37 33 39 32 37 39 30 32 33 32 30 37 38 39 32 | qrt.3)))......1.7739279023207892 |
| 173a0 | 0a 0a 20 20 20 20 20 28 73 71 75 61 72 65 20 28 73 71 72 74 20 31 30 30 30 29 29 0a 20 20 20 20 | .......(square.(sqrt.1000))..... |
| 173c0 | 20 31 30 30 30 2e 30 30 30 33 36 39 39 32 34 33 36 36 0a 0a 20 20 20 54 68 65 20 60 73 71 72 74 | .1000.000369924366.....The.`sqrt |
| 173e0 | 27 20 70 72 6f 67 72 61 6d 20 61 6c 73 6f 20 69 6c 6c 75 73 74 72 61 74 65 73 20 74 68 61 74 20 | '.program.also.illustrates.that. |
| 17400 | 74 68 65 20 73 69 6d 70 6c 65 20 70 72 6f 63 65 64 75 72 61 6c 0a 6c 61 6e 67 75 61 67 65 20 77 | the.simple.procedural.language.w |
| 17420 | 65 20 68 61 76 65 20 69 6e 74 72 6f 64 75 63 65 64 20 73 6f 20 66 61 72 20 69 73 20 73 75 66 66 | e.have.introduced.so.far.is.suff |
| 17440 | 69 63 69 65 6e 74 20 66 6f 72 20 77 72 69 74 69 6e 67 20 61 6e 79 20 70 75 72 65 6c 79 0a 6e 75 | icient.for.writing.any.purely.nu |
| 17460 | 6d 65 72 69 63 61 6c 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 6f 6e 65 20 63 6f 75 6c 64 20 77 | merical.program.that.one.could.w |
| 17480 | 72 69 74 65 20 69 6e 2c 20 73 61 79 2c 20 43 20 6f 72 20 50 61 73 63 61 6c 2e 20 20 54 68 69 73 | rite.in,.say,.C.or.Pascal...This |
| 174a0 | 0a 6d 69 67 68 74 20 73 65 65 6d 20 73 75 72 70 72 69 73 69 6e 67 2c 20 73 69 6e 63 65 20 77 65 | .might.seem.surprising,.since.we |
| 174c0 | 20 68 61 76 65 20 6e 6f 74 20 69 6e 63 6c 75 64 65 64 20 69 6e 20 6f 75 72 20 6c 61 6e 67 75 61 | .have.not.included.in.our.langua |
| 174e0 | 67 65 20 61 6e 79 0a 69 74 65 72 61 74 69 76 65 20 28 6c 6f 6f 70 69 6e 67 29 20 63 6f 6e 73 74 | ge.any.iterative.(looping).const |
| 17500 | 72 75 63 74 73 20 74 68 61 74 20 64 69 72 65 63 74 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 74 | ructs.that.direct.the.computer.t |
| 17520 | 6f 20 64 6f 20 73 6f 6d 65 74 68 69 6e 67 0a 6f 76 65 72 20 61 6e 64 20 6f 76 65 72 20 61 67 61 | o.do.something.over.and.over.aga |
| 17540 | 69 6e 2e 20 20 60 53 71 72 74 2d 69 74 65 72 27 2c 20 6f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 | in...`Sqrt-iter',.on.the.other.h |
| 17560 | 61 6e 64 2c 20 64 65 6d 6f 6e 73 74 72 61 74 65 73 20 68 6f 77 0a 69 74 65 72 61 74 69 6f 6e 20 | and,.demonstrates.how.iteration. |
| 17580 | 63 61 6e 20 62 65 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 75 73 69 6e 67 20 6e 6f 20 73 70 65 | can.be.accomplished.using.no.spe |
| 175a0 | 63 69 61 6c 20 63 6f 6e 73 74 72 75 63 74 20 6f 74 68 65 72 20 74 68 61 6e 20 74 68 65 0a 6f 72 | cial.construct.other.than.the.or |
| 175c0 | 64 69 6e 61 72 79 20 61 62 69 6c 69 74 79 20 74 6f 20 63 61 6c 6c 20 61 20 70 72 6f 63 65 64 75 | dinary.ability.to.call.a.procedu |
| 175e0 | 72 65 2e 28 35 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 36 3a 2a 20 41 6c 79 | re.(5).......*Exercise.1.6:*.Aly |
| 17600 | 73 73 61 20 50 2e 20 48 61 63 6b 65 72 20 64 6f 65 73 6e 27 74 20 73 65 65 20 77 68 79 20 60 69 | ssa.P..Hacker.doesn't.see.why.`i |
| 17620 | 66 27 20 6e 65 65 64 73 20 74 6f 20 62 65 0a 20 20 20 20 20 70 72 6f 76 69 64 65 64 20 61 73 20 | f'.needs.to.be......provided.as. |
| 17640 | 61 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 2e 20 20 22 57 68 79 20 63 61 6e 27 74 20 49 20 6a 75 | a.special.form..."Why.can't.I.ju |
| 17660 | 73 74 20 64 65 66 69 6e 65 20 69 74 20 61 73 20 61 6e 0a 20 20 20 20 20 6f 72 64 69 6e 61 72 79 | st.define.it.as.an......ordinary |
| 17680 | 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 60 63 6f 6e 64 27 3f 22 20 | .procedure.in.terms.of.`cond'?". |
| 176a0 | 73 68 65 20 61 73 6b 73 2e 20 20 41 6c 79 73 73 61 27 73 20 66 72 69 65 6e 64 0a 20 20 20 20 20 | she.asks...Alyssa's.friend...... |
| 176c0 | 45 76 61 20 4c 75 20 41 74 6f 72 20 63 6c 61 69 6d 73 20 74 68 69 73 20 63 61 6e 20 69 6e 64 65 | Eva.Lu.Ator.claims.this.can.inde |
| 176e0 | 65 64 20 62 65 20 64 6f 6e 65 2c 20 61 6e 64 20 73 68 65 20 64 65 66 69 6e 65 73 20 61 20 6e 65 | ed.be.done,.and.she.defines.a.ne |
| 17700 | 77 0a 20 20 20 20 20 76 65 72 73 69 6f 6e 20 6f 66 20 60 69 66 27 3a 0a 0a 20 20 20 20 20 20 20 | w......version.of.`if':......... |
| 17720 | 20 20 20 28 64 65 66 69 6e 65 20 28 6e 65 77 2d 69 66 20 70 72 65 64 69 63 61 74 65 20 74 68 65 | ...(define.(new-if.predicate.the |
| 17740 | 6e 2d 63 6c 61 75 73 65 20 65 6c 73 65 2d 63 6c 61 75 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 | n-clause.else-clause)........... |
| 17760 | 20 20 28 63 6f 6e 64 20 28 70 72 65 64 69 63 61 74 65 20 74 68 65 6e 2d 63 6c 61 75 73 65 29 0a | ..(cond.(predicate.then-clause). |
| 17780 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 65 6c 73 65 2d 63 6c 61 | ..................(else.else-cla |
| 177a0 | 75 73 65 29 29 29 0a 0a 20 20 20 20 20 45 76 61 20 64 65 6d 6f 6e 73 74 72 61 74 65 73 20 74 68 | use))).......Eva.demonstrates.th |
| 177c0 | 65 20 70 72 6f 67 72 61 6d 20 66 6f 72 20 41 6c 79 73 73 61 3a 0a 0a 20 20 20 20 20 20 20 20 20 | e.program.for.Alyssa:........... |
| 177e0 | 20 28 6e 65 77 2d 69 66 20 28 3d 20 32 20 33 29 20 30 20 35 29 0a 20 20 20 20 20 20 20 20 20 20 | .(new-if.(=.2.3).0.5)........... |
| 17800 | 35 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6e 65 77 2d 69 66 20 28 3d 20 31 20 31 29 20 30 20 35 | 5............(new-if.(=.1.1).0.5 |
| 17820 | 29 0a 20 20 20 20 20 20 20 20 20 20 30 0a 0a 20 20 20 20 20 44 65 6c 69 67 68 74 65 64 2c 20 41 | )...........0.......Delighted,.A |
| 17840 | 6c 79 73 73 61 20 75 73 65 73 20 60 6e 65 77 2d 69 66 27 20 74 6f 20 72 65 77 72 69 74 65 20 74 | lyssa.uses.`new-if'.to.rewrite.t |
| 17860 | 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 70 72 6f 67 72 61 6d 3a 0a 0a 20 20 20 20 20 20 20 | he.square-root.program:......... |
| 17880 | 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 2d 69 74 65 72 20 67 75 65 73 73 20 78 29 0a 20 | ...(define.(sqrt-iter.guess.x).. |
| 178a0 | 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 77 2d 69 66 20 28 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f | ...........(new-if.(good-enough? |
| 178c0 | 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 67 75 | .guess.x).....................gu |
| 178e0 | 65 73 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 | ess.....................(sqrt-it |
| 17900 | 65 72 20 28 69 6d 70 72 6f 76 65 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 | er.(improve.guess.x)............ |
| 17920 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 29 29 29 0a 0a 20 20 20 20 20 57 | ....................x))).......W |
| 17940 | 68 61 74 20 68 61 70 70 65 6e 73 20 77 68 65 6e 20 41 6c 79 73 73 61 20 61 74 74 65 6d 70 74 73 | hat.happens.when.Alyssa.attempts |
| 17960 | 20 74 6f 20 75 73 65 20 74 68 69 73 20 74 6f 20 63 6f 6d 70 75 74 65 20 73 71 75 61 72 65 0a 20 | .to.use.this.to.compute.square.. |
| 17980 | 20 20 20 20 72 6f 6f 74 73 3f 20 20 45 78 70 6c 61 69 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 | ....roots?..Explain........*Exer |
| 179a0 | 63 69 73 65 20 31 2e 37 3a 2a 20 54 68 65 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 74 65 | cise.1.7:*.The.`good-enough?'.te |
| 179c0 | 73 74 20 75 73 65 64 20 69 6e 20 63 6f 6d 70 75 74 69 6e 67 20 73 71 75 61 72 65 0a 20 20 20 20 | st.used.in.computing.square..... |
| 179e0 | 20 72 6f 6f 74 73 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 76 65 72 79 20 65 66 66 65 63 74 69 76 | .roots.will.not.be.very.effectiv |
| 17a00 | 65 20 66 6f 72 20 66 69 6e 64 69 6e 67 20 74 68 65 20 73 71 75 61 72 65 20 72 6f 6f 74 73 20 6f | e.for.finding.the.square.roots.o |
| 17a20 | 66 0a 20 20 20 20 20 76 65 72 79 20 73 6d 61 6c 6c 20 6e 75 6d 62 65 72 73 2e 20 20 41 6c 73 6f | f......very.small.numbers...Also |
| 17a40 | 2c 20 69 6e 20 72 65 61 6c 20 63 6f 6d 70 75 74 65 72 73 2c 20 61 72 69 74 68 6d 65 74 69 63 20 | ,.in.real.computers,.arithmetic. |
| 17a60 | 6f 70 65 72 61 74 69 6f 6e 73 0a 20 20 20 20 20 61 72 65 20 61 6c 6d 6f 73 74 20 61 6c 77 61 79 | operations......are.almost.alway |
| 17a80 | 73 20 70 65 72 66 6f 72 6d 65 64 20 77 69 74 68 20 6c 69 6d 69 74 65 64 20 70 72 65 63 69 73 69 | s.performed.with.limited.precisi |
| 17aa0 | 6f 6e 2e 20 20 54 68 69 73 20 6d 61 6b 65 73 0a 20 20 20 20 20 6f 75 72 20 74 65 73 74 20 69 6e | on...This.makes......our.test.in |
| 17ac0 | 61 64 65 71 75 61 74 65 20 66 6f 72 20 76 65 72 79 20 6c 61 72 67 65 20 6e 75 6d 62 65 72 73 2e | adequate.for.very.large.numbers. |
| 17ae0 | 20 20 45 78 70 6c 61 69 6e 20 74 68 65 73 65 0a 20 20 20 20 20 73 74 61 74 65 6d 65 6e 74 73 2c | ..Explain.these......statements, |
| 17b00 | 20 77 69 74 68 20 65 78 61 6d 70 6c 65 73 20 73 68 6f 77 69 6e 67 20 68 6f 77 20 74 68 65 20 74 | .with.examples.showing.how.the.t |
| 17b20 | 65 73 74 20 66 61 69 6c 73 20 66 6f 72 20 73 6d 61 6c 6c 20 61 6e 64 0a 20 20 20 20 20 6c 61 72 | est.fails.for.small.and......lar |
| 17b40 | 67 65 20 6e 75 6d 62 65 72 73 2e 20 20 41 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 73 74 72 61 | ge.numbers...An.alternative.stra |
| 17b60 | 74 65 67 79 20 66 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 0a 20 20 20 20 20 60 67 6f 6f 64 | tegy.for.implementing......`good |
| 17b80 | 2d 65 6e 6f 75 67 68 3f 27 20 69 73 20 74 6f 20 77 61 74 63 68 20 68 6f 77 20 60 67 75 65 73 73 | -enough?'.is.to.watch.how.`guess |
| 17ba0 | 27 20 63 68 61 6e 67 65 73 20 66 72 6f 6d 20 6f 6e 65 20 69 74 65 72 61 74 69 6f 6e 0a 20 20 20 | '.changes.from.one.iteration.... |
| 17bc0 | 20 20 74 6f 20 74 68 65 20 6e 65 78 74 20 61 6e 64 20 74 6f 20 73 74 6f 70 20 77 68 65 6e 20 74 | ..to.the.next.and.to.stop.when.t |
| 17be0 | 68 65 20 63 68 61 6e 67 65 20 69 73 20 61 20 76 65 72 79 20 73 6d 61 6c 6c 20 66 72 61 63 74 69 | he.change.is.a.very.small.fracti |
| 17c00 | 6f 6e 0a 20 20 20 20 20 6f 66 20 74 68 65 20 67 75 65 73 73 2e 20 20 44 65 73 69 67 6e 20 61 20 | on......of.the.guess...Design.a. |
| 17c20 | 73 71 75 61 72 65 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 75 73 65 73 20 | square-root.procedure.that.uses. |
| 17c40 | 74 68 69 73 20 6b 69 6e 64 0a 20 20 20 20 20 6f 66 20 65 6e 64 20 74 65 73 74 2e 20 20 44 6f 65 | this.kind......of.end.test...Doe |
| 17c60 | 73 20 74 68 69 73 20 77 6f 72 6b 20 62 65 74 74 65 72 20 66 6f 72 20 73 6d 61 6c 6c 20 61 6e 64 | s.this.work.better.for.small.and |
| 17c80 | 20 6c 61 72 67 65 20 6e 75 6d 62 65 72 73 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 | .large.numbers?.......*Exercise. |
| 17ca0 | 31 2e 38 3a 2a 20 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 20 66 6f 72 20 63 75 62 65 20 72 | 1.8:*.Newton's.method.for.cube.r |
| 17cc0 | 6f 6f 74 73 20 69 73 20 62 61 73 65 64 20 6f 6e 20 74 68 65 0a 20 20 20 20 20 66 61 63 74 20 74 | oots.is.based.on.the......fact.t |
| 17ce0 | 68 61 74 20 69 66 20 79 20 69 73 20 61 6e 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 74 6f 20 | hat.if.y.is.an.approximation.to. |
| 17d00 | 74 68 65 20 63 75 62 65 20 72 6f 6f 74 20 6f 66 20 78 2c 20 74 68 65 6e 20 61 0a 20 20 20 20 20 | the.cube.root.of.x,.then.a...... |
| 17d20 | 62 65 74 74 65 72 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 69 73 20 67 69 76 65 6e 20 62 79 | better.approximation.is.given.by |
| 17d40 | 20 74 68 65 20 76 61 6c 75 65 0a 0a 20 20 20 20 20 20 20 20 20 20 78 2f 79 5e 32 20 2b 20 32 79 | .the.value............x/y^2.+.2y |
| 17d60 | 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 | ...........----------........... |
| 17d80 | 20 20 20 20 33 0a 0a 20 20 20 20 20 55 73 65 20 74 68 69 73 20 66 6f 72 6d 75 6c 61 20 74 6f 20 | ....3.......Use.this.formula.to. |
| 17da0 | 69 6d 70 6c 65 6d 65 6e 74 20 61 20 63 75 62 65 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 20 | implement.a.cube-root.procedure. |
| 17dc0 | 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 0a 20 20 20 20 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f | analogous.to......the.square-roo |
| 17de0 | 74 20 70 72 6f 63 65 64 75 72 65 2e 20 20 28 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 | t.procedure...(In.section.*Note. |
| 17e00 | 31 2d 33 2d 34 3a 3a 20 77 65 20 77 69 6c 6c 20 73 65 65 0a 20 20 20 20 20 68 6f 77 20 74 6f 20 | 1-3-4::.we.will.see......how.to. |
| 17e20 | 69 6d 70 6c 65 6d 65 6e 74 20 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 20 69 6e 20 67 65 6e | implement.Newton's.method.in.gen |
| 17e40 | 65 72 61 6c 20 61 73 20 61 6e 20 61 62 73 74 72 61 63 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 74 | eral.as.an.abstraction.of......t |
| 17e60 | 68 65 73 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 61 6e 64 20 63 75 62 65 2d 72 6f 6f 74 20 70 | hese.square-root.and.cube-root.p |
| 17e80 | 72 6f 63 65 64 75 72 65 73 2e 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e | rocedures.).....----------.Footn |
| 17ea0 | 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 44 65 63 6c 61 72 61 74 | otes.----------.....(1).Declarat |
| 17ec0 | 69 76 65 20 61 6e 64 20 69 6d 70 65 72 61 74 69 76 65 20 64 65 73 63 72 69 70 74 69 6f 6e 73 20 | ive.and.imperative.descriptions. |
| 17ee0 | 61 72 65 20 69 6e 74 69 6d 61 74 65 6c 79 20 72 65 6c 61 74 65 64 2c 0a 61 73 20 69 6e 64 65 65 | are.intimately.related,.as.indee |
| 17f00 | 64 20 61 72 65 20 6d 61 74 68 65 6d 61 74 69 63 73 20 61 6e 64 20 63 6f 6d 70 75 74 65 72 20 73 | d.are.mathematics.and.computer.s |
| 17f20 | 63 69 65 6e 63 65 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 6f 20 73 61 79 0a 74 68 | cience...For.instance,.to.say.th |
| 17f40 | 61 74 20 74 68 65 20 61 6e 73 77 65 72 20 70 72 6f 64 75 63 65 64 20 62 79 20 61 20 70 72 6f 67 | at.the.answer.produced.by.a.prog |
| 17f60 | 72 61 6d 20 69 73 20 22 63 6f 72 72 65 63 74 22 20 69 73 20 74 6f 20 6d 61 6b 65 20 61 0a 64 65 | ram.is."correct".is.to.make.a.de |
| 17f80 | 63 6c 61 72 61 74 69 76 65 20 73 74 61 74 65 6d 65 6e 74 20 61 62 6f 75 74 20 74 68 65 20 70 72 | clarative.statement.about.the.pr |
| 17fa0 | 6f 67 72 61 6d 2e 20 20 54 68 65 72 65 20 69 73 20 61 20 6c 61 72 67 65 20 61 6d 6f 75 6e 74 20 | ogram...There.is.a.large.amount. |
| 17fc0 | 6f 66 0a 72 65 73 65 61 72 63 68 20 61 69 6d 65 64 20 61 74 20 65 73 74 61 62 6c 69 73 68 69 6e | of.research.aimed.at.establishin |
| 17fe0 | 67 20 74 65 63 68 6e 69 71 75 65 73 20 66 6f 72 20 70 72 6f 76 69 6e 67 20 74 68 61 74 20 70 72 | g.techniques.for.proving.that.pr |
| 18000 | 6f 67 72 61 6d 73 20 61 72 65 0a 63 6f 72 72 65 63 74 2c 20 61 6e 64 20 6d 75 63 68 20 6f 66 20 | ograms.are.correct,.and.much.of. |
| 18020 | 74 68 65 20 74 65 63 68 6e 69 63 61 6c 20 64 69 66 66 69 63 75 6c 74 79 20 6f 66 20 74 68 69 73 | the.technical.difficulty.of.this |
| 18040 | 20 73 75 62 6a 65 63 74 20 68 61 73 20 74 6f 20 64 6f 0a 77 69 74 68 20 6e 65 67 6f 74 69 61 74 | .subject.has.to.do.with.negotiat |
| 18060 | 69 6e 67 20 74 68 65 20 74 72 61 6e 73 69 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 69 6d 70 65 72 | ing.the.transition.between.imper |
| 18080 | 61 74 69 76 65 20 73 74 61 74 65 6d 65 6e 74 73 20 28 66 72 6f 6d 0a 77 68 69 63 68 20 70 72 6f | ative.statements.(from.which.pro |
| 180a0 | 67 72 61 6d 73 20 61 72 65 20 63 6f 6e 73 74 72 75 63 74 65 64 29 20 61 6e 64 20 64 65 63 6c 61 | grams.are.constructed).and.decla |
| 180c0 | 72 61 74 69 76 65 20 73 74 61 74 65 6d 65 6e 74 73 20 28 77 68 69 63 68 20 63 61 6e 20 62 65 0a | rative.statements.(which.can.be. |
| 180e0 | 75 73 65 64 20 74 6f 20 64 65 64 75 63 65 20 74 68 69 6e 67 73 29 2e 20 20 49 6e 20 61 20 72 65 | used.to.deduce.things)...In.a.re |
| 18100 | 6c 61 74 65 64 20 76 65 69 6e 2c 20 61 6e 20 69 6d 70 6f 72 74 61 6e 74 20 63 75 72 72 65 6e 74 | lated.vein,.an.important.current |
| 18120 | 20 61 72 65 61 20 69 6e 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 2d 6c 61 6e 67 75 61 67 65 20 64 65 | .area.in.programming-language.de |
| 18140 | 73 69 67 6e 20 69 73 20 74 68 65 20 65 78 70 6c 6f 72 61 74 69 6f 6e 20 6f 66 20 73 6f 2d 63 61 | sign.is.the.exploration.of.so-ca |
| 18160 | 6c 6c 65 64 20 76 65 72 79 0a 68 69 67 68 2d 6c 65 76 65 6c 20 6c 61 6e 67 75 61 67 65 73 2c 20 | lled.very.high-level.languages,. |
| 18180 | 69 6e 20 77 68 69 63 68 20 6f 6e 65 20 61 63 74 75 61 6c 6c 79 20 70 72 6f 67 72 61 6d 73 20 69 | in.which.one.actually.programs.i |
| 181a0 | 6e 20 74 65 72 6d 73 20 6f 66 0a 64 65 63 6c 61 72 61 74 69 76 65 20 73 74 61 74 65 6d 65 6e 74 | n.terms.of.declarative.statement |
| 181c0 | 73 2e 20 20 54 68 65 20 69 64 65 61 20 69 73 20 74 6f 20 6d 61 6b 65 20 69 6e 74 65 72 70 72 65 | s...The.idea.is.to.make.interpre |
| 181e0 | 74 65 72 73 20 73 6f 70 68 69 73 74 69 63 61 74 65 64 0a 65 6e 6f 75 67 68 20 73 6f 20 74 68 61 | ters.sophisticated.enough.so.tha |
| 18200 | 74 2c 20 67 69 76 65 6e 20 22 77 68 61 74 20 69 73 22 20 6b 6e 6f 77 6c 65 64 67 65 20 73 70 65 | t,.given."what.is".knowledge.spe |
| 18220 | 63 69 66 69 65 64 20 62 79 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 65 72 2c 0a 74 68 65 79 20 63 | cified.by.the.programmer,.they.c |
| 18240 | 61 6e 20 67 65 6e 65 72 61 74 65 20 22 68 6f 77 20 74 6f 22 20 6b 6e 6f 77 6c 65 64 67 65 20 61 | an.generate."how.to".knowledge.a |
| 18260 | 75 74 6f 6d 61 74 69 63 61 6c 6c 79 2e 20 20 54 68 69 73 20 63 61 6e 6e 6f 74 20 62 65 0a 64 6f | utomatically...This.cannot.be.do |
| 18280 | 6e 65 20 69 6e 20 67 65 6e 65 72 61 6c 2c 20 62 75 74 20 74 68 65 72 65 20 61 72 65 20 69 6d 70 | ne.in.general,.but.there.are.imp |
| 182a0 | 6f 72 74 61 6e 74 20 61 72 65 61 73 20 77 68 65 72 65 20 70 72 6f 67 72 65 73 73 20 68 61 73 20 | ortant.areas.where.progress.has. |
| 182c0 | 62 65 65 6e 0a 6d 61 64 65 2e 20 20 57 65 20 73 68 61 6c 6c 20 72 65 76 69 73 69 74 20 74 68 69 | been.made...We.shall.revisit.thi |
| 182e0 | 73 20 69 64 65 61 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 34 3a 3a 2e 0a 0a 20 20 | s.idea.in.*Note.Chapter.4::..... |
| 18300 | 20 28 32 29 20 54 68 69 73 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 61 6c 67 6f 72 69 74 68 6d 20 | .(2).This.square-root.algorithm. |
| 18320 | 69 73 20 61 63 74 75 61 6c 6c 79 20 61 20 73 70 65 63 69 61 6c 20 63 61 73 65 20 6f 66 0a 4e 65 | is.actually.a.special.case.of.Ne |
| 18340 | 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 2c 20 77 68 69 63 68 20 69 73 20 61 20 67 65 6e 65 72 61 | wton's.method,.which.is.a.genera |
| 18360 | 6c 20 74 65 63 68 6e 69 71 75 65 20 66 6f 72 20 66 69 6e 64 69 6e 67 20 72 6f 6f 74 73 20 6f 66 | l.technique.for.finding.roots.of |
| 18380 | 0a 65 71 75 61 74 69 6f 6e 73 2e 20 20 54 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 61 6c 67 | .equations...The.square-root.alg |
| 183a0 | 6f 72 69 74 68 6d 20 69 74 73 65 6c 66 20 77 61 73 20 64 65 76 65 6c 6f 70 65 64 20 62 79 20 48 | orithm.itself.was.developed.by.H |
| 183c0 | 65 72 6f 6e 20 6f 66 0a 41 6c 65 78 61 6e 64 72 69 61 20 69 6e 20 74 68 65 20 66 69 72 73 74 20 | eron.of.Alexandria.in.the.first. |
| 183e0 | 63 65 6e 74 75 72 79 20 41 2e 44 2e 20 20 57 65 20 77 69 6c 6c 20 73 65 65 20 68 6f 77 20 74 6f | century.A.D...We.will.see.how.to |
| 18400 | 20 65 78 70 72 65 73 73 20 74 68 65 0a 67 65 6e 65 72 61 6c 20 4e 65 77 74 6f 6e 27 73 20 6d 65 | .express.the.general.Newton's.me |
| 18420 | 74 68 6f 64 20 61 73 20 61 20 4c 69 73 70 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 73 65 63 74 | thod.as.a.Lisp.procedure.in.sect |
| 18440 | 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 33 2d 34 3a 3a 2e 0a 0a 20 20 20 28 33 29 20 57 65 20 77 69 | ion.*Note.1-3-4::......(3).We.wi |
| 18460 | 6c 6c 20 75 73 75 61 6c 6c 79 20 67 69 76 65 20 70 72 65 64 69 63 61 74 65 73 20 6e 61 6d 65 73 | ll.usually.give.predicates.names |
| 18480 | 20 65 6e 64 69 6e 67 20 77 69 74 68 20 71 75 65 73 74 69 6f 6e 0a 6d 61 72 6b 73 2c 20 74 6f 20 | .ending.with.question.marks,.to. |
| 184a0 | 68 65 6c 70 20 75 73 20 72 65 6d 65 6d 62 65 72 20 74 68 61 74 20 74 68 65 79 20 61 72 65 20 70 | help.us.remember.that.they.are.p |
| 184c0 | 72 65 64 69 63 61 74 65 73 2e 20 20 54 68 69 73 20 69 73 20 6a 75 73 74 20 61 0a 73 74 79 6c 69 | redicates...This.is.just.a.styli |
| 184e0 | 73 74 69 63 20 63 6f 6e 76 65 6e 74 69 6f 6e 2e 20 20 41 73 20 66 61 72 20 61 73 20 74 68 65 20 | stic.convention...As.far.as.the. |
| 18500 | 69 6e 74 65 72 70 72 65 74 65 72 20 69 73 20 63 6f 6e 63 65 72 6e 65 64 2c 20 74 68 65 0a 71 75 | interpreter.is.concerned,.the.qu |
| 18520 | 65 73 74 69 6f 6e 20 6d 61 72 6b 20 69 73 20 6a 75 73 74 20 61 6e 20 6f 72 64 69 6e 61 72 79 20 | estion.mark.is.just.an.ordinary. |
| 18540 | 63 68 61 72 61 63 74 65 72 2e 0a 0a 20 20 20 28 34 29 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 | character......(4).Observe.that. |
| 18560 | 77 65 20 65 78 70 72 65 73 73 20 6f 75 72 20 69 6e 69 74 69 61 6c 20 67 75 65 73 73 20 61 73 20 | we.express.our.initial.guess.as. |
| 18580 | 31 2e 30 20 72 61 74 68 65 72 20 74 68 61 6e 20 31 2e 0a 54 68 69 73 20 77 6f 75 6c 64 20 6e 6f | 1.0.rather.than.1..This.would.no |
| 185a0 | 74 20 6d 61 6b 65 20 61 6e 79 20 64 69 66 66 65 72 65 6e 63 65 20 69 6e 20 6d 61 6e 79 20 4c 69 | t.make.any.difference.in.many.Li |
| 185c0 | 73 70 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 20 20 4d 49 54 0a 53 63 68 65 6d 65 2c | sp.implementations...MIT.Scheme, |
| 185e0 | 20 68 6f 77 65 76 65 72 2c 20 64 69 73 74 69 6e 67 75 69 73 68 65 73 20 62 65 74 77 65 65 6e 20 | .however,.distinguishes.between. |
| 18600 | 65 78 61 63 74 20 69 6e 74 65 67 65 72 73 20 61 6e 64 20 64 65 63 69 6d 61 6c 0a 76 61 6c 75 65 | exact.integers.and.decimal.value |
| 18620 | 73 2c 20 61 6e 64 20 64 69 76 69 64 69 6e 67 20 74 77 6f 20 69 6e 74 65 67 65 72 73 20 70 72 6f | s,.and.dividing.two.integers.pro |
| 18640 | 64 75 63 65 73 20 61 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 72 61 74 68 65 72 0a 74 | duces.a.rational.number.rather.t |
| 18660 | 68 61 6e 20 61 20 64 65 63 69 6d 61 6c 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 64 69 76 | han.a.decimal...For.example,.div |
| 18680 | 69 64 69 6e 67 20 31 30 20 62 79 20 36 20 79 69 65 6c 64 73 20 35 2f 33 2c 20 77 68 69 6c 65 0a | iding.10.by.6.yields.5/3,.while. |
| 186a0 | 64 69 76 69 64 69 6e 67 20 31 30 2e 30 20 62 79 20 36 2e 30 20 79 69 65 6c 64 73 20 31 2e 36 36 | dividing.10.0.by.6.0.yields.1.66 |
| 186c0 | 36 36 36 36 36 36 36 36 36 36 36 36 36 37 2e 20 20 28 57 65 20 77 69 6c 6c 20 6c 65 61 72 6e 20 | 66666666666667...(We.will.learn. |
| 186e0 | 68 6f 77 20 74 6f 0a 69 6d 70 6c 65 6d 65 6e 74 20 61 72 69 74 68 6d 65 74 69 63 20 6f 6e 20 72 | how.to.implement.arithmetic.on.r |
| 18700 | 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | ational.numbers.in.section.*Note |
| 18720 | 20 32 2d 31 2d 31 3a 3a 2e 29 20 20 49 66 0a 77 65 20 73 74 61 72 74 20 77 69 74 68 20 61 6e 20 | .2-1-1::.)..If.we.start.with.an. |
| 18740 | 69 6e 69 74 69 61 6c 20 67 75 65 73 73 20 6f 66 20 31 20 69 6e 20 6f 75 72 20 73 71 75 61 72 65 | initial.guess.of.1.in.our.square |
| 18760 | 2d 72 6f 6f 74 20 70 72 6f 67 72 61 6d 2c 20 61 6e 64 20 78 0a 69 73 20 61 6e 20 65 78 61 63 74 | -root.program,.and.x.is.an.exact |
| 18780 | 20 69 6e 74 65 67 65 72 2c 20 61 6c 6c 20 73 75 62 73 65 71 75 65 6e 74 20 76 61 6c 75 65 73 20 | .integer,.all.subsequent.values. |
| 187a0 | 70 72 6f 64 75 63 65 64 20 69 6e 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 0a 63 6f 6d 70 | produced.in.the.square-root.comp |
| 187c0 | 75 74 61 74 69 6f 6e 20 77 69 6c 6c 20 62 65 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 | utation.will.be.rational.numbers |
| 187e0 | 20 72 61 74 68 65 72 20 74 68 61 6e 20 64 65 63 69 6d 61 6c 73 2e 20 20 4d 69 78 65 64 0a 6f 70 | .rather.than.decimals...Mixed.op |
| 18800 | 65 72 61 74 69 6f 6e 73 20 6f 6e 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 61 6e 64 | erations.on.rational.numbers.and |
| 18820 | 20 64 65 63 69 6d 61 6c 73 20 61 6c 77 61 79 73 20 79 69 65 6c 64 20 64 65 63 69 6d 61 6c 73 2c | .decimals.always.yield.decimals, |
| 18840 | 20 73 6f 0a 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 61 6e 20 69 6e 69 74 69 61 6c 20 67 75 65 | .so.starting.with.an.initial.gue |
| 18860 | 73 73 20 6f 66 20 31 2e 30 20 66 6f 72 63 65 73 20 61 6c 6c 20 73 75 62 73 65 71 75 65 6e 74 20 | ss.of.1.0.forces.all.subsequent. |
| 18880 | 76 61 6c 75 65 73 20 74 6f 0a 62 65 20 64 65 63 69 6d 61 6c 73 2e 0a 0a 20 20 20 28 35 29 20 52 | values.to.be.decimals......(5).R |
| 188a0 | 65 61 64 65 72 73 20 77 68 6f 20 61 72 65 20 77 6f 72 72 69 65 64 20 61 62 6f 75 74 20 74 68 65 | eaders.who.are.worried.about.the |
| 188c0 | 20 65 66 66 69 63 69 65 6e 63 79 20 69 73 73 75 65 73 20 69 6e 76 6f 6c 76 65 64 20 69 6e 0a 75 | .efficiency.issues.involved.in.u |
| 188e0 | 73 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e | sing.procedure.calls.to.implemen |
| 18900 | 74 20 69 74 65 72 61 74 69 6f 6e 20 73 68 6f 75 6c 64 20 6e 6f 74 65 20 74 68 65 20 72 65 6d 61 | t.iteration.should.note.the.rema |
| 18920 | 72 6b 73 20 6f 6e 0a 22 74 61 69 6c 20 72 65 63 75 72 73 69 6f 6e 22 20 69 6e 20 73 65 63 74 69 | rks.on."tail.recursion".in.secti |
| 18940 | 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 31 3a 3a 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e | on.*Note.1-2-1::.....File:.sicp. |
| 18960 | 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 31 2d 38 2c 20 20 50 72 65 76 3a 20 31 2d 31 2d 37 | info,..Node:.1-1-8,..Prev:.1-1-7 |
| 18980 | 2c 20 20 55 70 3a 20 31 2d 31 0a 0a 31 2e 31 2e 38 20 50 72 6f 63 65 64 75 72 65 73 20 61 73 20 | ,..Up:.1-1..1.1.8.Procedures.as. |
| 189a0 | 42 6c 61 63 6b 2d 42 6f 78 20 41 62 73 74 72 61 63 74 69 6f 6e 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d | Black-Box.Abstractions.--------- |
| 189c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 189e0 | 2d 0a 0a 60 53 71 72 74 27 20 69 73 20 6f 75 72 20 66 69 72 73 74 20 65 78 61 6d 70 6c 65 20 6f | -..`Sqrt'.is.our.first.example.o |
| 18a00 | 66 20 61 20 70 72 6f 63 65 73 73 20 64 65 66 69 6e 65 64 20 62 79 20 61 20 73 65 74 20 6f 66 20 | f.a.process.defined.by.a.set.of. |
| 18a20 | 6d 75 74 75 61 6c 6c 79 0a 64 65 66 69 6e 65 64 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 4e 6f | mutually.defined.procedures...No |
| 18a40 | 74 69 63 65 20 74 68 61 74 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 73 71 72 | tice.that.the.definition.of.`sqr |
| 18a60 | 74 2d 69 74 65 72 27 20 69 73 20 22 72 65 63 75 72 73 69 76 65 22 3b 0a 74 68 61 74 20 69 73 2c | t-iter'.is."recursive";.that.is, |
| 18a80 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 64 65 66 69 6e 65 64 20 69 6e 20 74 65 72 | .the.procedure.is.defined.in.ter |
| 18aa0 | 6d 73 20 6f 66 20 69 74 73 65 6c 66 2e 20 20 54 68 65 20 69 64 65 61 20 6f 66 0a 62 65 69 6e 67 | ms.of.itself...The.idea.of.being |
| 18ac0 | 20 61 62 6c 65 20 74 6f 20 64 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 74 | .able.to.define.a.procedure.in.t |
| 18ae0 | 65 72 6d 73 20 6f 66 20 69 74 73 65 6c 66 20 6d 61 79 20 62 65 20 64 69 73 74 75 72 62 69 6e 67 | erms.of.itself.may.be.disturbing |
| 18b00 | 3b 0a 69 74 20 6d 61 79 20 73 65 65 6d 20 75 6e 63 6c 65 61 72 20 68 6f 77 20 73 75 63 68 20 61 | ;.it.may.seem.unclear.how.such.a |
| 18b20 | 20 22 63 69 72 63 75 6c 61 72 22 20 64 65 66 69 6e 69 74 69 6f 6e 20 63 6f 75 6c 64 20 6d 61 6b | ."circular".definition.could.mak |
| 18b40 | 65 20 73 65 6e 73 65 0a 61 74 20 61 6c 6c 2c 20 6d 75 63 68 20 6c 65 73 73 20 73 70 65 63 69 66 | e.sense.at.all,.much.less.specif |
| 18b60 | 79 20 61 20 77 65 6c 6c 2d 64 65 66 69 6e 65 64 20 70 72 6f 63 65 73 73 20 74 6f 20 62 65 20 63 | y.a.well-defined.process.to.be.c |
| 18b80 | 61 72 72 69 65 64 20 6f 75 74 20 62 79 20 61 0a 63 6f 6d 70 75 74 65 72 2e 20 20 54 68 69 73 20 | arried.out.by.a.computer...This. |
| 18ba0 | 77 69 6c 6c 20 62 65 20 61 64 64 72 65 73 73 65 64 20 6d 6f 72 65 20 63 61 72 65 66 75 6c 6c 79 | will.be.addressed.more.carefully |
| 18bc0 | 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 31 2d 32 3a 3a 2e 20 20 42 75 74 20 66 69 | .in.section.*Note.1-2::...But.fi |
| 18be0 | 72 73 74 20 6c 65 74 27 73 20 63 6f 6e 73 69 64 65 72 20 73 6f 6d 65 20 6f 74 68 65 72 20 69 6d | rst.let's.consider.some.other.im |
| 18c00 | 70 6f 72 74 61 6e 74 20 70 6f 69 6e 74 73 0a 69 6c 6c 75 73 74 72 61 74 65 64 20 62 79 20 74 68 | portant.points.illustrated.by.th |
| 18c20 | 65 20 60 73 71 72 74 27 20 65 78 61 6d 70 6c 65 2e 0a 0a 20 20 20 4f 62 73 65 72 76 65 20 74 68 | e.`sqrt'.example......Observe.th |
| 18c40 | 61 74 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 63 6f 6d 70 75 74 69 6e 67 20 73 71 75 61 | at.the.problem.of.computing.squa |
| 18c60 | 72 65 20 72 6f 6f 74 73 20 62 72 65 61 6b 73 20 75 70 0a 6e 61 74 75 72 61 6c 6c 79 20 69 6e 74 | re.roots.breaks.up.naturally.int |
| 18c80 | 6f 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 73 75 62 70 72 6f 62 6c 65 6d 73 3a 20 68 6f 77 20 74 | o.a.number.of.subproblems:.how.t |
| 18ca0 | 6f 20 74 65 6c 6c 20 77 68 65 74 68 65 72 20 61 20 67 75 65 73 73 20 69 73 0a 67 6f 6f 64 20 65 | o.tell.whether.a.guess.is.good.e |
| 18cc0 | 6e 6f 75 67 68 2c 20 68 6f 77 20 74 6f 20 69 6d 70 72 6f 76 65 20 61 20 67 75 65 73 73 2c 20 61 | nough,.how.to.improve.a.guess,.a |
| 18ce0 | 6e 64 20 73 6f 20 6f 6e 2e 20 20 45 61 63 68 20 6f 66 20 74 68 65 73 65 20 74 61 73 6b 73 20 69 | nd.so.on...Each.of.these.tasks.i |
| 18d00 | 73 0a 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 61 20 73 65 70 61 72 61 74 65 20 70 72 6f | s.accomplished.by.a.separate.pro |
| 18d20 | 63 65 64 75 72 65 2e 20 20 54 68 65 20 65 6e 74 69 72 65 20 60 73 71 72 74 27 20 70 72 6f 67 72 | cedure...The.entire.`sqrt'.progr |
| 18d40 | 61 6d 20 63 61 6e 20 62 65 0a 76 69 65 77 65 64 20 61 73 20 61 20 63 6c 75 73 74 65 72 20 6f 66 | am.can.be.viewed.as.a.cluster.of |
| 18d60 | 20 70 72 6f 63 65 64 75 72 65 73 20 28 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 | .procedures.(shown.in.*Note.Figu |
| 18d80 | 72 65 20 31 2d 32 3a 3a 29 20 74 68 61 74 0a 6d 69 72 72 6f 72 73 20 74 68 65 20 64 65 63 6f 6d | re.1-2::).that.mirrors.the.decom |
| 18da0 | 70 6f 73 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 69 6e 74 6f 20 73 75 62 | position.of.the.problem.into.sub |
| 18dc0 | 70 72 6f 62 6c 65 6d 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 31 2e 32 3a 2a 20 50 72 | problems........*Figure.1.2:*.Pr |
| 18de0 | 6f 63 65 64 75 72 61 6c 20 64 65 63 6f 6d 70 6f 73 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 60 73 | ocedural.decomposition.of.the.`s |
| 18e00 | 71 72 74 27 20 70 72 6f 67 72 61 6d 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | qrt'.program.................... |
| 18e20 | 20 20 20 20 20 73 71 72 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....sqrt....................... |
| 18e40 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 71 72 74 2d 69 74 65 72 0a | .|....................sqrt-iter. |
| 18e60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 20 20 20 5c 0a 20 20 20 | .................../.......\.... |
| 18e80 | 20 20 20 20 20 20 20 20 67 6f 6f 64 2d 65 6e 6f 75 67 68 20 20 20 20 69 6d 70 72 6f 76 65 0a 20 | ........good-enough....improve.. |
| 18ea0 | 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 5c 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | ............/....\..........|... |
| 18ec0 | 20 20 20 20 20 20 20 20 73 71 75 61 72 65 20 20 61 62 73 20 20 20 20 20 61 76 65 72 61 67 65 0a | ........square..abs.....average. |
| 18ee0 | 0a 20 20 20 54 68 65 20 69 6d 70 6f 72 74 61 6e 63 65 20 6f 66 20 74 68 69 73 20 64 65 63 6f 6d | ....The.importance.of.this.decom |
| 18f00 | 70 6f 73 69 74 69 6f 6e 20 73 74 72 61 74 65 67 79 20 69 73 20 6e 6f 74 20 73 69 6d 70 6c 79 20 | position.strategy.is.not.simply. |
| 18f20 | 74 68 61 74 20 6f 6e 65 0a 69 73 20 64 69 76 69 64 69 6e 67 20 74 68 65 20 70 72 6f 67 72 61 6d | that.one.is.dividing.the.program |
| 18f40 | 20 69 6e 74 6f 20 70 61 72 74 73 2e 20 20 41 66 74 65 72 20 61 6c 6c 2c 20 77 65 20 63 6f 75 6c | .into.parts...After.all,.we.coul |
| 18f60 | 64 20 74 61 6b 65 20 61 6e 79 20 6c 61 72 67 65 0a 70 72 6f 67 72 61 6d 20 61 6e 64 20 64 69 76 | d.take.any.large.program.and.div |
| 18f80 | 69 64 65 20 69 74 20 69 6e 74 6f 20 70 61 72 74 73 2d 2d 74 68 65 20 66 69 72 73 74 20 74 65 6e | ide.it.into.parts--the.first.ten |
| 18fa0 | 20 6c 69 6e 65 73 2c 20 74 68 65 20 6e 65 78 74 20 74 65 6e 0a 6c 69 6e 65 73 2c 20 74 68 65 20 | .lines,.the.next.ten.lines,.the. |
| 18fc0 | 6e 65 78 74 20 74 65 6e 20 6c 69 6e 65 73 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 20 52 61 74 68 | next.ten.lines,.and.so.on...Rath |
| 18fe0 | 65 72 2c 20 69 74 20 69 73 20 63 72 75 63 69 61 6c 20 74 68 61 74 20 65 61 63 68 0a 70 72 6f 63 | er,.it.is.crucial.that.each.proc |
| 19000 | 65 64 75 72 65 20 61 63 63 6f 6d 70 6c 69 73 68 65 73 20 61 6e 20 69 64 65 6e 74 69 66 69 61 62 | edure.accomplishes.an.identifiab |
| 19020 | 6c 65 20 74 61 73 6b 20 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 61 0a 6d 6f | le.task.that.can.be.used.as.a.mo |
| 19040 | 64 75 6c 65 20 69 6e 20 64 65 66 69 6e 69 6e 67 20 6f 74 68 65 72 20 70 72 6f 63 65 64 75 72 65 | dule.in.defining.other.procedure |
| 19060 | 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 68 65 6e 20 77 65 20 64 65 66 69 6e 65 20 | s...For.example,.when.we.define. |
| 19080 | 74 68 65 0a 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 | the.`good-enough?'.procedure.in. |
| 190a0 | 74 65 72 6d 73 20 6f 66 20 60 73 71 75 61 72 65 27 2c 20 77 65 20 61 72 65 20 61 62 6c 65 20 74 | terms.of.`square',.we.are.able.t |
| 190c0 | 6f 20 72 65 67 61 72 64 0a 74 68 65 20 60 73 71 75 61 72 65 27 20 70 72 6f 63 65 64 75 72 65 20 | o.regard.the.`square'.procedure. |
| 190e0 | 61 73 20 61 20 22 62 6c 61 63 6b 20 62 6f 78 2e 22 20 20 57 65 20 61 72 65 20 6e 6f 74 20 61 74 | as.a."black.box."..We.are.not.at |
| 19100 | 20 74 68 61 74 20 6d 6f 6d 65 6e 74 0a 63 6f 6e 63 65 72 6e 65 64 20 77 69 74 68 20 5f 68 6f 77 | .that.moment.concerned.with._how |
| 19120 | 5f 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 63 6f 6d 70 75 74 65 73 20 69 74 73 20 72 65 73 | _.the.procedure.computes.its.res |
| 19140 | 75 6c 74 2c 20 6f 6e 6c 79 20 77 69 74 68 20 74 68 65 0a 66 61 63 74 20 74 68 61 74 20 69 74 20 | ult,.only.with.the.fact.that.it. |
| 19160 | 63 6f 6d 70 75 74 65 73 20 74 68 65 20 73 71 75 61 72 65 2e 20 20 54 68 65 20 64 65 74 61 69 6c | computes.the.square...The.detail |
| 19180 | 73 20 6f 66 20 68 6f 77 20 74 68 65 20 73 71 75 61 72 65 20 69 73 0a 63 6f 6d 70 75 74 65 64 20 | s.of.how.the.square.is.computed. |
| 191a0 | 63 61 6e 20 62 65 20 73 75 70 70 72 65 73 73 65 64 2c 20 74 6f 20 62 65 20 63 6f 6e 73 69 64 65 | can.be.suppressed,.to.be.conside |
| 191c0 | 72 65 64 20 61 74 20 61 20 6c 61 74 65 72 20 74 69 6d 65 2e 20 20 49 6e 64 65 65 64 2c 0a 61 73 | red.at.a.later.time...Indeed,.as |
| 191e0 | 20 66 61 72 20 61 73 20 74 68 65 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 70 72 6f 63 65 | .far.as.the.`good-enough?'.proce |
| 19200 | 64 75 72 65 20 69 73 20 63 6f 6e 63 65 72 6e 65 64 2c 20 60 73 71 75 61 72 65 27 20 69 73 20 6e | dure.is.concerned,.`square'.is.n |
| 19220 | 6f 74 0a 71 75 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 62 75 74 20 72 61 74 68 65 72 20 | ot.quite.a.procedure.but.rather. |
| 19240 | 61 6e 20 61 62 73 74 72 61 63 74 69 6f 6e 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 61 | an.abstraction.of.a.procedure,.a |
| 19260 | 20 73 6f 2d 63 61 6c 6c 65 64 20 22 70 72 6f 63 65 64 75 72 61 6c 0a 61 62 73 74 72 61 63 74 69 | .so-called."procedural.abstracti |
| 19280 | 6f 6e 22 2e 20 20 41 74 20 74 68 69 73 20 6c 65 76 65 6c 20 6f 66 20 61 62 73 74 72 61 63 74 69 | on"...At.this.level.of.abstracti |
| 192a0 | 6f 6e 2c 20 61 6e 79 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 63 6f 6d 70 75 74 65 73 20 | on,.any.procedure.that.computes. |
| 192c0 | 74 68 65 20 73 71 75 61 72 65 20 69 73 20 65 71 75 61 6c 6c 79 20 67 6f 6f 64 2e 0a 0a 20 20 20 | the.square.is.equally.good...... |
| 192e0 | 54 68 75 73 2c 20 63 6f 6e 73 69 64 65 72 69 6e 67 20 6f 6e 6c 79 20 74 68 65 20 76 61 6c 75 65 | Thus,.considering.only.the.value |
| 19300 | 73 20 74 68 65 79 20 72 65 74 75 72 6e 2c 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 77 6f | s.they.return,.the.following.two |
| 19320 | 0a 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 73 71 75 61 72 69 6e 67 20 61 20 6e 75 6d 62 65 | .procedures.for.squaring.a.numbe |
| 19340 | 72 20 73 68 6f 75 6c 64 20 62 65 20 69 6e 64 69 73 74 69 6e 67 75 69 73 68 61 62 6c 65 2e 20 20 | r.should.be.indistinguishable... |
| 19360 | 45 61 63 68 0a 74 61 6b 65 73 20 61 20 6e 75 6d 65 72 69 63 61 6c 20 61 72 67 75 6d 65 6e 74 20 | Each.takes.a.numerical.argument. |
| 19380 | 61 6e 64 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 73 71 75 61 72 65 20 6f 66 20 74 68 61 74 20 | and.produces.the.square.of.that. |
| 193a0 | 6e 75 6d 62 65 72 20 61 73 0a 74 68 65 20 76 61 6c 75 65 2e 28 31 29 0a 0a 20 20 20 20 20 28 64 | number.as.the.value.(1).......(d |
| 193c0 | 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 78 29 20 28 2a 20 78 20 78 29 29 0a 0a 20 20 20 20 20 | efine.(square.x).(*.x.x))....... |
| 193e0 | 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 78 29 0a 20 20 20 20 20 20 20 28 65 78 70 20 28 | (define.(square.x)........(exp.( |
| 19400 | 64 6f 75 62 6c 65 20 28 6c 6f 67 20 78 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | double.(log.x)))).......(define. |
| 19420 | 28 64 6f 75 62 6c 65 20 78 29 20 28 2b 20 78 20 78 29 29 0a 0a 20 20 20 53 6f 20 61 20 70 72 6f | (double.x).(+.x.x)).....So.a.pro |
| 19440 | 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 73 68 6f 75 6c 64 20 62 65 20 61 62 6c 65 | cedure.definition.should.be.able |
| 19460 | 20 74 6f 20 73 75 70 70 72 65 73 73 20 64 65 74 61 69 6c 2e 20 20 54 68 65 0a 75 73 65 72 73 20 | .to.suppress.detail...The.users. |
| 19480 | 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 6d 61 79 20 6e 6f 74 20 68 61 76 65 20 77 72 | of.the.procedure.may.not.have.wr |
| 194a0 | 69 74 74 65 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 68 65 6d 73 65 6c 76 65 73 2c 0a | itten.the.procedure.themselves,. |
| 194c0 | 62 75 74 20 6d 61 79 20 68 61 76 65 20 6f 62 74 61 69 6e 65 64 20 69 74 20 66 72 6f 6d 20 61 6e | but.may.have.obtained.it.from.an |
| 194e0 | 6f 74 68 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 20 61 73 20 61 20 62 6c 61 63 6b 20 62 6f 78 2e | other.programmer.as.a.black.box. |
| 19500 | 20 20 41 0a 75 73 65 72 20 73 68 6f 75 6c 64 20 6e 6f 74 20 6e 65 65 64 20 74 6f 20 6b 6e 6f 77 | ..A.user.should.not.need.to.know |
| 19520 | 20 68 6f 77 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 | .how.the.procedure.is.implemente |
| 19540 | 64 20 69 6e 20 6f 72 64 65 72 0a 74 6f 20 75 73 65 20 69 74 2e 0a 0a 4c 6f 63 61 6c 20 6e 61 6d | d.in.order.to.use.it...Local.nam |
| 19560 | 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 4f 6e 65 20 64 65 74 61 69 6c 20 6f 66 20 61 20 | es..............One.detail.of.a. |
| 19580 | 70 72 6f 63 65 64 75 72 65 27 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 74 68 61 74 20 | procedure's.implementation.that. |
| 195a0 | 73 68 6f 75 6c 64 20 6e 6f 74 20 6d 61 74 74 65 72 20 74 6f 0a 74 68 65 20 75 73 65 72 20 6f 66 | should.not.matter.to.the.user.of |
| 195c0 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 65 | .the.procedure.is.the.implemente |
| 195e0 | 72 27 73 20 63 68 6f 69 63 65 20 6f 66 20 6e 61 6d 65 73 20 66 6f 72 20 74 68 65 0a 70 72 6f 63 | r's.choice.of.names.for.the.proc |
| 19600 | 65 64 75 72 65 27 73 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 73 2e 20 20 54 68 75 73 | edure's.formal.parameters...Thus |
| 19620 | 2c 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 73 68 6f 75 6c | ,.the.following.procedures.shoul |
| 19640 | 64 0a 6e 6f 74 20 62 65 20 64 69 73 74 69 6e 67 75 69 73 68 61 62 6c 65 3a 0a 0a 20 20 20 20 20 | d.not.be.distinguishable:....... |
| 19660 | 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 78 29 20 28 2a 20 78 20 78 29 29 0a 0a 20 20 20 | (define.(square.x).(*.x.x))..... |
| 19680 | 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 79 29 20 28 2a 20 79 20 79 29 29 0a 0a 20 | ..(define.(square.y).(*.y.y))... |
| 196a0 | 20 20 54 68 69 73 20 70 72 69 6e 63 69 70 6c 65 2d 2d 74 68 61 74 20 74 68 65 20 6d 65 61 6e 69 | ..This.principle--that.the.meani |
| 196c0 | 6e 67 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 62 65 0a 69 6e 64 65 | ng.of.a.procedure.should.be.inde |
| 196e0 | 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 20 6e 61 6d 65 73 20 75 | pendent.of.the.parameter.names.u |
| 19700 | 73 65 64 20 62 79 20 69 74 73 20 61 75 74 68 6f 72 2d 2d 73 65 65 6d 73 20 6f 6e 20 74 68 65 0a | sed.by.its.author--seems.on.the. |
| 19720 | 73 75 72 66 61 63 65 20 74 6f 20 62 65 20 73 65 6c 66 2d 65 76 69 64 65 6e 74 2c 20 62 75 74 20 | surface.to.be.self-evident,.but. |
| 19740 | 69 74 73 20 63 6f 6e 73 65 71 75 65 6e 63 65 73 20 61 72 65 20 70 72 6f 66 6f 75 6e 64 2e 20 20 | its.consequences.are.profound... |
| 19760 | 54 68 65 0a 73 69 6d 70 6c 65 73 74 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 69 73 20 74 68 61 74 | The.simplest.consequence.is.that |
| 19780 | 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 20 6e 61 6d 65 73 20 6f 66 20 61 20 70 72 6f 63 65 64 | .the.parameter.names.of.a.proced |
| 197a0 | 75 72 65 20 6d 75 73 74 20 62 65 0a 6c 6f 63 61 6c 20 74 6f 20 74 68 65 20 62 6f 64 79 20 6f 66 | ure.must.be.local.to.the.body.of |
| 197c0 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 | .the.procedure...For.example,.we |
| 197e0 | 20 75 73 65 64 20 60 73 71 75 61 72 65 27 20 69 6e 0a 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e | .used.`square'.in.the.definition |
| 19800 | 20 6f 66 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 69 6e 20 6f 75 72 20 73 71 75 61 72 65 | .of.`good-enough?'.in.our.square |
| 19820 | 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | -root.procedure:.......(define.( |
| 19840 | 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 28 3c 20 | good-enough?.guess.x)........(<. |
| 19860 | 28 61 62 73 20 28 2d 20 28 73 71 75 61 72 65 20 67 75 65 73 73 29 20 78 29 29 20 30 2e 30 30 31 | (abs.(-.(square.guess).x)).0.001 |
| 19880 | 29 29 0a 0a 20 20 20 54 68 65 20 69 6e 74 65 6e 74 69 6f 6e 20 6f 66 20 74 68 65 20 61 75 74 68 | )).....The.intention.of.the.auth |
| 198a0 | 6f 72 20 6f 66 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 69 73 20 74 6f 20 64 65 74 65 72 | or.of.`good-enough?'.is.to.deter |
| 198c0 | 6d 69 6e 65 20 69 66 20 74 68 65 0a 73 71 75 61 72 65 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 | mine.if.the.square.of.the.first. |
| 198e0 | 61 72 67 75 6d 65 6e 74 20 69 73 20 77 69 74 68 69 6e 20 61 20 67 69 76 65 6e 20 74 6f 6c 65 72 | argument.is.within.a.given.toler |
| 19900 | 61 6e 63 65 20 6f 66 20 74 68 65 20 73 65 63 6f 6e 64 0a 61 72 67 75 6d 65 6e 74 2e 20 20 57 65 | ance.of.the.second.argument...We |
| 19920 | 20 73 65 65 20 74 68 61 74 20 74 68 65 20 61 75 74 68 6f 72 20 6f 66 20 60 67 6f 6f 64 2d 65 6e | .see.that.the.author.of.`good-en |
| 19940 | 6f 75 67 68 3f 27 20 75 73 65 64 20 74 68 65 20 6e 61 6d 65 0a 60 67 75 65 73 73 27 20 74 6f 20 | ough?'.used.the.name.`guess'.to. |
| 19960 | 72 65 66 65 72 20 74 6f 20 74 68 65 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 | refer.to.the.first.argument.and. |
| 19980 | 60 78 27 20 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 73 65 63 6f 6e 64 0a 61 72 67 75 6d | `x'.to.refer.to.the.second.argum |
| 199a0 | 65 6e 74 2e 20 20 54 68 65 20 61 72 67 75 6d 65 6e 74 20 6f 66 20 60 73 71 75 61 72 65 27 20 69 | ent...The.argument.of.`square'.i |
| 199c0 | 73 20 60 67 75 65 73 73 27 2e 20 20 49 66 20 74 68 65 20 61 75 74 68 6f 72 20 6f 66 0a 60 73 71 | s.`guess'...If.the.author.of.`sq |
| 199e0 | 75 61 72 65 27 20 75 73 65 64 20 60 78 27 20 28 61 73 20 61 62 6f 76 65 29 20 74 6f 20 72 65 66 | uare'.used.`x'.(as.above).to.ref |
| 19a00 | 65 72 20 74 6f 20 74 68 61 74 20 61 72 67 75 6d 65 6e 74 2c 20 77 65 20 73 65 65 20 74 68 61 74 | er.to.that.argument,.we.see.that |
| 19a20 | 20 74 68 65 0a 60 78 27 20 69 6e 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 6d 75 73 74 20 | .the.`x'.in.`good-enough?'.must. |
| 19a40 | 62 65 20 61 20 64 69 66 66 65 72 65 6e 74 20 60 78 27 20 74 68 61 6e 20 74 68 65 20 6f 6e 65 20 | be.a.different.`x'.than.the.one. |
| 19a60 | 69 6e 20 60 73 71 75 61 72 65 27 2e 0a 52 75 6e 6e 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 | in.`square'..Running.the.procedu |
| 19a80 | 72 65 20 60 73 71 75 61 72 65 27 20 6d 75 73 74 20 6e 6f 74 20 61 66 66 65 63 74 20 74 68 65 20 | re.`square'.must.not.affect.the. |
| 19aa0 | 76 61 6c 75 65 20 6f 66 20 60 78 27 20 74 68 61 74 0a 69 73 20 75 73 65 64 20 62 79 20 60 67 6f | value.of.`x'.that.is.used.by.`go |
| 19ac0 | 6f 64 2d 65 6e 6f 75 67 68 3f 27 2c 20 62 65 63 61 75 73 65 20 74 68 61 74 20 76 61 6c 75 65 20 | od-enough?',.because.that.value. |
| 19ae0 | 6f 66 20 60 78 27 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 62 79 0a 60 67 6f 6f 64 2d 65 6e | of.`x'.may.be.needed.by.`good-en |
| 19b00 | 6f 75 67 68 3f 27 20 61 66 74 65 72 20 60 73 71 75 61 72 65 27 20 69 73 20 64 6f 6e 65 20 63 6f | ough?'.after.`square'.is.done.co |
| 19b20 | 6d 70 75 74 69 6e 67 2e 0a 0a 20 20 20 49 66 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 73 20 77 | mputing......If.the.parameters.w |
| 19b40 | 65 72 65 20 6e 6f 74 20 6c 6f 63 61 6c 20 74 6f 20 74 68 65 20 62 6f 64 69 65 73 20 6f 66 20 74 | ere.not.local.to.the.bodies.of.t |
| 19b60 | 68 65 69 72 20 72 65 73 70 65 63 74 69 76 65 0a 70 72 6f 63 65 64 75 72 65 73 2c 20 74 68 65 6e | heir.respective.procedures,.then |
| 19b80 | 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 20 60 78 27 20 69 6e 20 60 73 71 75 61 72 65 27 20 63 | .the.parameter.`x'.in.`square'.c |
| 19ba0 | 6f 75 6c 64 20 62 65 20 63 6f 6e 66 75 73 65 64 20 77 69 74 68 0a 74 68 65 20 70 61 72 61 6d 65 | ould.be.confused.with.the.parame |
| 19bc0 | 74 65 72 20 60 78 27 20 69 6e 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 2c 20 61 6e 64 20 74 | ter.`x'.in.`good-enough?',.and.t |
| 19be0 | 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 0a 77 6f | he.behavior.of.`good-enough?'.wo |
| 19c00 | 75 6c 64 20 64 65 70 65 6e 64 20 75 70 6f 6e 20 77 68 69 63 68 20 76 65 72 73 69 6f 6e 20 6f 66 | uld.depend.upon.which.version.of |
| 19c20 | 20 60 73 71 75 61 72 65 27 20 77 65 20 75 73 65 64 2e 20 20 54 68 75 73 2c 20 60 73 71 75 61 72 | .`square'.we.used...Thus,.`squar |
| 19c40 | 65 27 0a 77 6f 75 6c 64 20 6e 6f 74 20 62 65 20 74 68 65 20 62 6c 61 63 6b 20 62 6f 78 20 77 65 | e'.would.not.be.the.black.box.we |
| 19c60 | 20 64 65 73 69 72 65 64 2e 0a 0a 20 20 20 41 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 | .desired......A.formal.parameter |
| 19c80 | 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 68 61 73 20 61 20 76 65 72 79 20 73 70 65 63 69 | .of.a.procedure.has.a.very.speci |
| 19ca0 | 61 6c 20 72 6f 6c 65 20 69 6e 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 | al.role.in.the.procedure.definit |
| 19cc0 | 69 6f 6e 2c 20 69 6e 20 74 68 61 74 20 69 74 20 64 6f 65 73 6e 27 74 20 6d 61 74 74 65 72 20 77 | ion,.in.that.it.doesn't.matter.w |
| 19ce0 | 68 61 74 20 6e 61 6d 65 20 74 68 65 20 66 6f 72 6d 61 6c 0a 70 61 72 61 6d 65 74 65 72 20 68 61 | hat.name.the.formal.parameter.ha |
| 19d00 | 73 2e 20 20 53 75 63 68 20 61 20 6e 61 6d 65 20 69 73 20 63 61 6c 6c 65 64 20 61 20 22 62 6f 75 | s...Such.a.name.is.called.a."bou |
| 19d20 | 6e 64 20 76 61 72 69 61 62 6c 65 22 2c 20 61 6e 64 20 77 65 20 73 61 79 0a 74 68 61 74 20 74 68 | nd.variable",.and.we.say.that.th |
| 19d40 | 65 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 22 62 69 6e 64 73 22 20 69 | e.procedure.definition."binds".i |
| 19d60 | 74 73 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 73 2e 20 20 54 68 65 0a 6d 65 61 6e 69 | ts.formal.parameters...The.meani |
| 19d80 | 6e 67 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 73 20 | ng.of.a.procedure.definition.is. |
| 19da0 | 75 6e 63 68 61 6e 67 65 64 20 69 66 20 61 20 62 6f 75 6e 64 20 76 61 72 69 61 62 6c 65 20 69 73 | unchanged.if.a.bound.variable.is |
| 19dc0 | 0a 63 6f 6e 73 69 73 74 65 6e 74 6c 79 20 72 65 6e 61 6d 65 64 20 74 68 72 6f 75 67 68 6f 75 74 | .consistently.renamed.throughout |
| 19de0 | 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 2e 28 32 29 20 20 49 66 20 61 20 76 61 72 69 61 62 | .the.definition.(2)..If.a.variab |
| 19e00 | 6c 65 20 69 73 0a 6e 6f 74 20 62 6f 75 6e 64 2c 20 77 65 20 73 61 79 20 74 68 61 74 20 69 74 20 | le.is.not.bound,.we.say.that.it. |
| 19e20 | 69 73 20 22 66 72 65 65 22 2e 20 20 54 68 65 20 73 65 74 20 6f 66 20 65 78 70 72 65 73 73 69 6f | is."free"...The.set.of.expressio |
| 19e40 | 6e 73 20 66 6f 72 20 77 68 69 63 68 0a 61 20 62 69 6e 64 69 6e 67 20 64 65 66 69 6e 65 73 20 61 | ns.for.which.a.binding.defines.a |
| 19e60 | 20 6e 61 6d 65 20 69 73 20 63 61 6c 6c 65 64 20 74 68 65 20 22 73 63 6f 70 65 22 20 6f 66 20 74 | .name.is.called.the."scope".of.t |
| 19e80 | 68 61 74 20 6e 61 6d 65 2e 20 20 49 6e 20 61 0a 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 | hat.name...In.a.procedure.defini |
| 19ea0 | 74 69 6f 6e 2c 20 74 68 65 20 62 6f 75 6e 64 20 76 61 72 69 61 62 6c 65 73 20 64 65 63 6c 61 72 | tion,.the.bound.variables.declar |
| 19ec0 | 65 64 20 61 73 20 74 68 65 20 66 6f 72 6d 61 6c 0a 70 61 72 61 6d 65 74 65 72 73 20 6f 66 20 74 | ed.as.the.formal.parameters.of.t |
| 19ee0 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 68 61 76 65 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 | he.procedure.have.the.body.of.th |
| 19f00 | 65 20 70 72 6f 63 65 64 75 72 65 20 61 73 20 74 68 65 69 72 0a 73 63 6f 70 65 2e 0a 0a 20 20 20 | e.procedure.as.their.scope...... |
| 19f20 | 49 6e 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 | In.the.definition.of.`good-enoug |
| 19f40 | 68 3f 27 20 61 62 6f 76 65 2c 20 60 67 75 65 73 73 27 20 61 6e 64 20 60 78 27 20 61 72 65 20 62 | h?'.above,.`guess'.and.`x'.are.b |
| 19f60 | 6f 75 6e 64 0a 76 61 72 69 61 62 6c 65 73 20 62 75 74 20 60 3c 27 2c 20 60 2d 27 2c 20 60 61 62 | ound.variables.but.`<',.`-',.`ab |
| 19f80 | 73 27 2c 20 61 6e 64 20 60 73 71 75 61 72 65 27 20 61 72 65 20 66 72 65 65 2e 20 20 54 68 65 20 | s',.and.`square'.are.free...The. |
| 19fa0 | 6d 65 61 6e 69 6e 67 20 6f 66 0a 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 73 68 6f 75 6c 64 | meaning.of.`good-enough?'.should |
| 19fc0 | 20 62 65 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 6e 61 6d 65 73 20 77 65 20 | .be.independent.of.the.names.we. |
| 19fe0 | 63 68 6f 6f 73 65 20 66 6f 72 20 60 67 75 65 73 73 27 0a 61 6e 64 20 60 78 27 20 73 6f 20 6c 6f | choose.for.`guess'.and.`x'.so.lo |
| 1a000 | 6e 67 20 61 73 20 74 68 65 79 20 61 72 65 20 64 69 73 74 69 6e 63 74 20 61 6e 64 20 64 69 66 66 | ng.as.they.are.distinct.and.diff |
| 1a020 | 65 72 65 6e 74 20 66 72 6f 6d 20 60 3c 27 2c 20 60 2d 27 2c 0a 60 61 62 73 27 2c 20 61 6e 64 20 | erent.from.`<',.`-',.`abs',.and. |
| 1a040 | 60 73 71 75 61 72 65 27 2e 20 20 28 49 66 20 77 65 20 72 65 6e 61 6d 65 64 20 60 67 75 65 73 73 | `square'...(If.we.renamed.`guess |
| 1a060 | 27 20 74 6f 20 60 61 62 73 27 20 77 65 20 77 6f 75 6c 64 20 68 61 76 65 0a 69 6e 74 72 6f 64 75 | '.to.`abs'.we.would.have.introdu |
| 1a080 | 63 65 64 20 61 20 62 75 67 20 62 79 20 22 63 61 70 74 75 72 69 6e 67 22 20 74 68 65 20 76 61 72 | ced.a.bug.by."capturing".the.var |
| 1a0a0 | 69 61 62 6c 65 20 60 61 62 73 27 2e 20 20 49 74 20 77 6f 75 6c 64 20 68 61 76 65 0a 63 68 61 6e | iable.`abs'...It.would.have.chan |
| 1a0c0 | 67 65 64 20 66 72 6f 6d 20 66 72 65 65 20 74 6f 20 62 6f 75 6e 64 2e 29 20 20 54 68 65 20 6d 65 | ged.from.free.to.bound.)..The.me |
| 1a0e0 | 61 6e 69 6e 67 20 6f 66 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 69 73 20 6e 6f 74 0a 69 | aning.of.`good-enough?'.is.not.i |
| 1a100 | 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 69 74 73 20 66 | ndependent.of.the.names.of.its.f |
| 1a120 | 72 65 65 20 76 61 72 69 61 62 6c 65 73 2c 20 68 6f 77 65 76 65 72 2e 20 20 49 74 20 73 75 72 65 | ree.variables,.however...It.sure |
| 1a140 | 6c 79 0a 64 65 70 65 6e 64 73 20 75 70 6f 6e 20 74 68 65 20 66 61 63 74 20 28 65 78 74 65 72 6e | ly.depends.upon.the.fact.(extern |
| 1a160 | 61 6c 20 74 6f 20 74 68 69 73 20 64 65 66 69 6e 69 74 69 6f 6e 29 20 74 68 61 74 20 74 68 65 20 | al.to.this.definition).that.the. |
| 1a180 | 73 79 6d 62 6f 6c 0a 60 61 62 73 27 20 6e 61 6d 65 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 66 | symbol.`abs'.names.a.procedure.f |
| 1a1a0 | 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 61 62 73 6f 6c 75 74 65 20 76 61 6c 75 65 20 | or.computing.the.absolute.value. |
| 1a1c0 | 6f 66 20 61 20 6e 75 6d 62 65 72 2e 0a 60 47 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 77 69 6c 6c | of.a.number..`Good-enough?'.will |
| 1a1e0 | 20 63 6f 6d 70 75 74 65 20 61 20 64 69 66 66 65 72 65 6e 74 20 66 75 6e 63 74 69 6f 6e 20 69 66 | .compute.a.different.function.if |
| 1a200 | 20 77 65 20 73 75 62 73 74 69 74 75 74 65 20 60 63 6f 73 27 0a 66 6f 72 20 60 61 62 73 27 20 69 | .we.substitute.`cos'.for.`abs'.i |
| 1a220 | 6e 20 69 74 73 20 64 65 66 69 6e 69 74 69 6f 6e 2e 0a 0a 49 6e 74 65 72 6e 61 6c 20 64 65 66 69 | n.its.definition...Internal.defi |
| 1a240 | 6e 69 74 69 6f 6e 73 20 61 6e 64 20 62 6c 6f 63 6b 20 73 74 72 75 63 74 75 72 65 0a 2e 2e 2e 2e | nitions.and.block.structure..... |
| 1a260 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ................................ |
| 1a280 | 2e 2e 2e 2e 0a 0a 57 65 20 68 61 76 65 20 6f 6e 65 20 6b 69 6e 64 20 6f 66 20 6e 61 6d 65 20 69 | ......We.have.one.kind.of.name.i |
| 1a2a0 | 73 6f 6c 61 74 69 6f 6e 20 61 76 61 69 6c 61 62 6c 65 20 74 6f 20 75 73 20 73 6f 20 66 61 72 3a | solation.available.to.us.so.far: |
| 1a2c0 | 20 54 68 65 20 66 6f 72 6d 61 6c 0a 70 61 72 61 6d 65 74 65 72 73 20 6f 66 20 61 20 70 72 6f 63 | .The.formal.parameters.of.a.proc |
| 1a2e0 | 65 64 75 72 65 20 61 72 65 20 6c 6f 63 61 6c 20 74 6f 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 | edure.are.local.to.the.body.of.t |
| 1a300 | 68 65 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 65 0a 73 71 75 61 72 65 2d 72 6f 6f 74 20 70 | he.procedure...The.square-root.p |
| 1a320 | 72 6f 67 72 61 6d 20 69 6c 6c 75 73 74 72 61 74 65 73 20 61 6e 6f 74 68 65 72 20 77 61 79 20 69 | rogram.illustrates.another.way.i |
| 1a340 | 6e 20 77 68 69 63 68 20 77 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 0a 63 6f 6e 74 72 6f 6c | n.which.we.would.like.to.control |
| 1a360 | 20 74 68 65 20 75 73 65 20 6f 66 20 6e 61 6d 65 73 2e 20 20 54 68 65 20 65 78 69 73 74 69 6e 67 | .the.use.of.names...The.existing |
| 1a380 | 20 70 72 6f 67 72 61 6d 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 73 65 70 61 72 61 74 65 0a 70 72 | .program.consists.of.separate.pr |
| 1a3a0 | 6f 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 78 29 | ocedures:.......(define.(sqrt.x) |
| 1a3c0 | 0a 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 31 2e 30 20 78 29 29 0a 0a 20 20 20 20 | ........(sqrt-iter.1.0.x))...... |
| 1a3e0 | 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 2d 69 74 65 72 20 67 75 65 73 73 20 78 29 0a 20 20 20 | .(define.(sqrt-iter.guess.x).... |
| 1a400 | 20 20 20 20 28 69 66 20 28 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 20 78 29 0a 20 | ....(if.(good-enough?.guess.x).. |
| 1a420 | 20 20 20 20 20 20 20 20 20 20 67 75 65 73 73 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 | ..........guess............(sqrt |
| 1a440 | 2d 69 74 65 72 20 28 69 6d 70 72 6f 76 65 20 67 75 65 73 73 20 78 29 20 78 29 29 29 0a 0a 20 20 | -iter.(improve.guess.x).x))).... |
| 1a460 | 20 20 20 28 64 65 66 69 6e 65 20 28 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 20 78 | ...(define.(good-enough?.guess.x |
| 1a480 | 29 0a 20 20 20 20 20 20 20 28 3c 20 28 61 62 73 20 28 2d 20 28 73 71 75 61 72 65 20 67 75 65 73 | )........(<.(abs.(-.(square.gues |
| 1a4a0 | 73 29 20 78 29 29 20 30 2e 30 30 31 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d | s).x)).0.001)).......(define.(im |
| 1a4c0 | 70 72 6f 76 65 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 28 61 76 65 72 61 67 65 20 67 | prove.guess.x)........(average.g |
| 1a4e0 | 75 65 73 73 20 28 2f 20 78 20 67 75 65 73 73 29 29 29 0a 0a 20 20 20 54 68 65 20 70 72 6f 62 6c | uess.(/.x.guess))).....The.probl |
| 1a500 | 65 6d 20 77 69 74 68 20 74 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 74 68 61 74 20 74 68 65 | em.with.this.program.is.that.the |
| 1a520 | 20 6f 6e 6c 79 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 69 73 0a 69 6d 70 6f 72 74 61 6e | .only.procedure.that.is.importan |
| 1a540 | 74 20 74 6f 20 75 73 65 72 73 20 6f 66 20 60 73 71 72 74 27 20 69 73 20 60 73 71 72 74 27 2e 20 | t.to.users.of.`sqrt'.is.`sqrt'.. |
| 1a560 | 20 54 68 65 20 6f 74 68 65 72 20 70 72 6f 63 65 64 75 72 65 73 0a 28 60 73 71 72 74 2d 69 74 65 | .The.other.procedures.(`sqrt-ite |
| 1a580 | 72 27 2c 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 2c 20 61 6e 64 20 60 69 6d 70 72 6f 76 65 | r',.`good-enough?',.and.`improve |
| 1a5a0 | 27 29 20 6f 6e 6c 79 20 63 6c 75 74 74 65 72 20 75 70 20 74 68 65 69 72 0a 6d 69 6e 64 73 2e 20 | ').only.clutter.up.their.minds.. |
| 1a5c0 | 20 54 68 65 79 20 6d 61 79 20 6e 6f 74 20 64 65 66 69 6e 65 20 61 6e 79 20 6f 74 68 65 72 20 70 | .They.may.not.define.any.other.p |
| 1a5e0 | 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 65 64 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 0a 61 | rocedure.called.`good-enough?'.a |
| 1a600 | 73 20 70 61 72 74 20 6f 66 20 61 6e 6f 74 68 65 72 20 70 72 6f 67 72 61 6d 20 74 6f 20 77 6f 72 | s.part.of.another.program.to.wor |
| 1a620 | 6b 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 0a | k.together.with.the.square-root. |
| 1a640 | 70 72 6f 67 72 61 6d 2c 20 62 65 63 61 75 73 65 20 60 73 71 72 74 27 20 6e 65 65 64 73 20 69 74 | program,.because.`sqrt'.needs.it |
| 1a660 | 2e 20 20 54 68 65 20 70 72 6f 62 6c 65 6d 20 69 73 20 65 73 70 65 63 69 61 6c 6c 79 20 73 65 76 | ...The.problem.is.especially.sev |
| 1a680 | 65 72 65 20 69 6e 0a 74 68 65 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 6f 66 20 6c 61 72 67 65 | ere.in.the.construction.of.large |
| 1a6a0 | 20 73 79 73 74 65 6d 73 20 62 79 20 6d 61 6e 79 20 73 65 70 61 72 61 74 65 20 70 72 6f 67 72 61 | .systems.by.many.separate.progra |
| 1a6c0 | 6d 6d 65 72 73 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 69 6e 20 74 68 65 20 63 6f 6e 73 | mmers...For.example,.in.the.cons |
| 1a6e0 | 74 72 75 63 74 69 6f 6e 20 6f 66 20 61 20 6c 61 72 67 65 20 6c 69 62 72 61 72 79 20 6f 66 20 6e | truction.of.a.large.library.of.n |
| 1a700 | 75 6d 65 72 69 63 61 6c 0a 70 72 6f 63 65 64 75 72 65 73 2c 20 6d 61 6e 79 20 6e 75 6d 65 72 69 | umerical.procedures,.many.numeri |
| 1a720 | 63 61 6c 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 63 6f 6d 70 75 74 65 64 20 61 73 20 73 75 | cal.functions.are.computed.as.su |
| 1a740 | 63 63 65 73 73 69 76 65 0a 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 61 6e 64 20 74 68 75 73 | ccessive.approximations.and.thus |
| 1a760 | 20 6d 69 67 68 74 20 68 61 76 65 20 70 72 6f 63 65 64 75 72 65 73 20 6e 61 6d 65 64 20 60 67 6f | .might.have.procedures.named.`go |
| 1a780 | 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 61 6e 64 0a 60 69 6d 70 72 6f 76 65 27 20 61 73 20 61 75 78 | od-enough?'.and.`improve'.as.aux |
| 1a7a0 | 69 6c 69 61 72 79 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 57 65 20 77 6f 75 6c 64 20 6c 69 6b | iliary.procedures...We.would.lik |
| 1a7c0 | 65 20 74 6f 20 6c 6f 63 61 6c 69 7a 65 20 74 68 65 0a 73 75 62 70 72 6f 63 65 64 75 72 65 73 2c | e.to.localize.the.subprocedures, |
| 1a7e0 | 20 68 69 64 69 6e 67 20 74 68 65 6d 20 69 6e 73 69 64 65 20 60 73 71 72 74 27 20 73 6f 20 74 68 | .hiding.them.inside.`sqrt'.so.th |
| 1a800 | 61 74 20 60 73 71 72 74 27 20 63 6f 75 6c 64 20 63 6f 65 78 69 73 74 0a 77 69 74 68 20 6f 74 68 | at.`sqrt'.could.coexist.with.oth |
| 1a820 | 65 72 20 73 75 63 63 65 73 73 69 76 65 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 2c 20 65 61 | er.successive.approximations,.ea |
| 1a840 | 63 68 20 68 61 76 69 6e 67 20 69 74 73 20 6f 77 6e 20 70 72 69 76 61 74 65 0a 60 67 6f 6f 64 2d | ch.having.its.own.private.`good- |
| 1a860 | 65 6e 6f 75 67 68 3f 27 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 6f 20 6d 61 6b 65 20 74 68 69 | enough?'.procedure...To.make.thi |
| 1a880 | 73 20 70 6f 73 73 69 62 6c 65 2c 20 77 65 20 61 6c 6c 6f 77 20 61 20 70 72 6f 63 65 64 75 72 65 | s.possible,.we.allow.a.procedure |
| 1a8a0 | 0a 74 6f 20 68 61 76 65 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 74 68 | .to.have.internal.definitions.th |
| 1a8c0 | 61 74 20 61 72 65 20 6c 6f 63 61 6c 20 74 6f 20 74 68 61 74 20 70 72 6f 63 65 64 75 72 65 2e 20 | at.are.local.to.that.procedure.. |
| 1a8e0 | 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 69 6e 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 | .For.example,.in.the.square-root |
| 1a900 | 20 70 72 6f 62 6c 65 6d 20 77 65 20 63 61 6e 20 77 72 69 74 65 0a 0a 20 20 20 20 20 28 64 65 66 | .problem.we.can.write.......(def |
| 1a920 | 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 67 6f 6f | ine.(sqrt.x)........(define.(goo |
| 1a940 | 64 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 20 20 28 3c 20 28 | d-enough?.guess.x)..........(<.( |
| 1a960 | 61 62 73 20 28 2d 20 28 73 71 75 61 72 65 20 67 75 65 73 73 29 20 78 29 29 20 30 2e 30 30 31 29 | abs.(-.(square.guess).x)).0.001) |
| 1a980 | 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 70 72 6f 76 65 20 67 75 65 73 73 20 | )........(define.(improve.guess. |
| 1a9a0 | 78 29 0a 20 20 20 20 20 20 20 20 20 28 61 76 65 72 61 67 65 20 67 75 65 73 73 20 28 2f 20 78 20 | x)..........(average.guess.(/.x. |
| 1a9c0 | 67 75 65 73 73 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 2d 69 74 | guess)))........(define.(sqrt-it |
| 1a9e0 | 65 72 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 67 6f 6f 64 2d 65 | er.guess.x)..........(if.(good-e |
| 1aa00 | 6e 6f 75 67 68 3f 20 67 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 67 75 65 | nough?.guess.x)..............gue |
| 1aa20 | 73 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 28 69 6d 70 72 | ss..............(sqrt-iter.(impr |
| 1aa40 | 6f 76 65 20 67 75 65 73 73 20 78 29 20 78 29 29 29 0a 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 | ove.guess.x).x)))........(sqrt-i |
| 1aa60 | 74 65 72 20 31 2e 30 20 78 29 29 0a 0a 20 20 20 53 75 63 68 20 6e 65 73 74 69 6e 67 20 6f 66 20 | ter.1.0.x)).....Such.nesting.of. |
| 1aa80 | 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 63 61 6c 6c 65 64 20 22 62 6c 6f 63 6b 20 73 74 72 75 63 | definitions,.called."block.struc |
| 1aaa0 | 74 75 72 65 22 2c 20 69 73 20 62 61 73 69 63 61 6c 6c 79 0a 74 68 65 20 72 69 67 68 74 20 73 6f | ture",.is.basically.the.right.so |
| 1aac0 | 6c 75 74 69 6f 6e 20 74 6f 20 74 68 65 20 73 69 6d 70 6c 65 73 74 20 6e 61 6d 65 2d 70 61 63 6b | lution.to.the.simplest.name-pack |
| 1aae0 | 61 67 69 6e 67 20 70 72 6f 62 6c 65 6d 2e 20 20 42 75 74 20 74 68 65 72 65 0a 69 73 20 61 20 62 | aging.problem...But.there.is.a.b |
| 1ab00 | 65 74 74 65 72 20 69 64 65 61 20 6c 75 72 6b 69 6e 67 20 68 65 72 65 2e 20 20 49 6e 20 61 64 64 | etter.idea.lurking.here...In.add |
| 1ab20 | 69 74 69 6f 6e 20 74 6f 20 69 6e 74 65 72 6e 61 6c 69 7a 69 6e 67 20 74 68 65 0a 64 65 66 69 6e | ition.to.internalizing.the.defin |
| 1ab40 | 69 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 61 75 78 69 6c 69 61 72 79 20 70 72 6f 63 65 64 75 72 | itions.of.the.auxiliary.procedur |
| 1ab60 | 65 73 2c 20 77 65 20 63 61 6e 20 73 69 6d 70 6c 69 66 79 20 74 68 65 6d 2e 20 20 53 69 6e 63 65 | es,.we.can.simplify.them...Since |
| 1ab80 | 0a 60 78 27 20 69 73 20 62 6f 75 6e 64 20 69 6e 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 | .`x'.is.bound.in.the.definition. |
| 1aba0 | 6f 66 20 60 73 71 72 74 27 2c 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 0a 60 67 6f 6f 64 2d | of.`sqrt',.the.procedures.`good- |
| 1abc0 | 65 6e 6f 75 67 68 3f 27 2c 20 60 69 6d 70 72 6f 76 65 27 2c 20 61 6e 64 20 60 73 71 72 74 2d 69 | enough?',.`improve',.and.`sqrt-i |
| 1abe0 | 74 65 72 27 2c 20 77 68 69 63 68 20 61 72 65 20 64 65 66 69 6e 65 64 0a 69 6e 74 65 72 6e 61 6c | ter',.which.are.defined.internal |
| 1ac00 | 6c 79 20 74 6f 20 60 73 71 72 74 27 2c 20 61 72 65 20 69 6e 20 74 68 65 20 73 63 6f 70 65 20 6f | ly.to.`sqrt',.are.in.the.scope.o |
| 1ac20 | 66 20 60 78 27 2e 20 20 54 68 75 73 2c 20 69 74 20 69 73 20 6e 6f 74 0a 6e 65 63 65 73 73 61 72 | f.`x'...Thus,.it.is.not.necessar |
| 1ac40 | 79 20 74 6f 20 70 61 73 73 20 60 78 27 20 65 78 70 6c 69 63 69 74 6c 79 20 74 6f 20 65 61 63 68 | y.to.pass.`x'.explicitly.to.each |
| 1ac60 | 20 6f 66 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 49 6e 73 74 65 61 64 2c 0a | .of.these.procedures...Instead,. |
| 1ac80 | 77 65 20 61 6c 6c 6f 77 20 60 78 27 20 74 6f 20 62 65 20 61 20 66 72 65 65 20 76 61 72 69 61 62 | we.allow.`x'.to.be.a.free.variab |
| 1aca0 | 6c 65 20 69 6e 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 | le.in.the.internal.definitions,. |
| 1acc0 | 61 73 0a 73 68 6f 77 6e 20 62 65 6c 6f 77 2e 20 54 68 65 6e 20 60 78 27 20 67 65 74 73 20 69 74 | as.shown.below..Then.`x'.gets.it |
| 1ace0 | 73 20 76 61 6c 75 65 20 66 72 6f 6d 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 77 69 74 68 20 77 | s.value.from.the.argument.with.w |
| 1ad00 | 68 69 63 68 20 74 68 65 0a 65 6e 63 6c 6f 73 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 60 73 71 | hich.the.enclosing.procedure.`sq |
| 1ad20 | 72 74 27 20 69 73 20 63 61 6c 6c 65 64 2e 20 20 54 68 69 73 20 64 69 73 63 69 70 6c 69 6e 65 20 | rt'.is.called...This.discipline. |
| 1ad40 | 69 73 20 63 61 6c 6c 65 64 20 22 6c 65 78 69 63 61 6c 0a 73 63 6f 70 69 6e 67 22 2e 28 33 29 0a | is.called."lexical.scoping".(3). |
| 1ad60 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 20 20 20 20 20 28 64 | ......(define.(sqrt.x)........(d |
| 1ad80 | 65 66 69 6e 65 20 28 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 29 0a 20 20 20 20 20 | efine.(good-enough?.guess)...... |
| 1ada0 | 20 20 20 20 28 3c 20 28 61 62 73 20 28 2d 20 28 73 71 75 61 72 65 20 67 75 65 73 73 29 20 78 29 | ....(<.(abs.(-.(square.guess).x) |
| 1adc0 | 29 20 30 2e 30 30 31 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 70 72 6f 76 | ).0.001))........(define.(improv |
| 1ade0 | 65 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 28 61 76 65 72 61 67 65 20 67 75 65 73 73 | e.guess)..........(average.guess |
| 1ae00 | 20 28 2f 20 78 20 67 75 65 73 73 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 | .(/.x.guess)))........(define.(s |
| 1ae20 | 71 72 74 2d 69 74 65 72 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 67 6f | qrt-iter.guess)..........(if.(go |
| 1ae40 | 6f 64 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 67 | od-enough?.guess)..............g |
| 1ae60 | 75 65 73 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 28 69 6d | uess..............(sqrt-iter.(im |
| 1ae80 | 70 72 6f 76 65 20 67 75 65 73 73 29 29 29 29 0a 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 | prove.guess))))........(sqrt-ite |
| 1aea0 | 72 20 31 2e 30 29 29 0a 0a 20 20 20 57 65 20 77 69 6c 6c 20 75 73 65 20 62 6c 6f 63 6b 20 73 74 | r.1.0)).....We.will.use.block.st |
| 1aec0 | 72 75 63 74 75 72 65 20 65 78 74 65 6e 73 69 76 65 6c 79 20 74 6f 20 68 65 6c 70 20 75 73 20 62 | ructure.extensively.to.help.us.b |
| 1aee0 | 72 65 61 6b 20 75 70 20 6c 61 72 67 65 0a 70 72 6f 67 72 61 6d 73 20 69 6e 74 6f 20 74 72 61 63 | reak.up.large.programs.into.trac |
| 1af00 | 74 61 62 6c 65 20 70 69 65 63 65 73 2e 28 34 29 20 54 68 65 20 69 64 65 61 20 6f 66 20 62 6c 6f | table.pieces.(4).The.idea.of.blo |
| 1af20 | 63 6b 20 73 74 72 75 63 74 75 72 65 0a 6f 72 69 67 69 6e 61 74 65 64 20 77 69 74 68 20 74 68 65 | ck.structure.originated.with.the |
| 1af40 | 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 41 6c 67 6f 6c 20 36 30 2e 20 | .programming.language.Algol.60.. |
| 1af60 | 49 74 20 61 70 70 65 61 72 73 20 69 6e 20 6d 6f 73 74 0a 61 64 76 61 6e 63 65 64 20 70 72 6f 67 | It.appears.in.most.advanced.prog |
| 1af80 | 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 61 6e 64 20 69 73 20 61 6e 20 69 6d 70 6f | ramming.languages.and.is.an.impo |
| 1afa0 | 72 74 61 6e 74 20 74 6f 6f 6c 20 66 6f 72 20 68 65 6c 70 69 6e 67 20 74 6f 0a 6f 72 67 61 6e 69 | rtant.tool.for.helping.to.organi |
| 1afc0 | 7a 65 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 6f 66 20 6c 61 72 67 65 20 70 72 6f | ze.the.construction.of.large.pro |
| 1afe0 | 67 72 61 6d 73 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 | grams......----------.Footnotes. |
| 1b000 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 74 20 69 73 20 6e 6f 74 20 65 76 65 | ----------.....(1).It.is.not.eve |
| 1b020 | 6e 20 63 6c 65 61 72 20 77 68 69 63 68 20 6f 66 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 | n.clear.which.of.these.procedure |
| 1b040 | 73 20 69 73 20 61 20 6d 6f 72 65 0a 65 66 66 69 63 69 65 6e 74 20 69 6d 70 6c 65 6d 65 6e 74 61 | s.is.a.more.efficient.implementa |
| 1b060 | 74 69 6f 6e 2e 20 20 54 68 69 73 20 64 65 70 65 6e 64 73 20 75 70 6f 6e 20 74 68 65 20 68 61 72 | tion...This.depends.upon.the.har |
| 1b080 | 64 77 61 72 65 20 61 76 61 69 6c 61 62 6c 65 2e 0a 54 68 65 72 65 20 61 72 65 20 6d 61 63 68 69 | dware.available..There.are.machi |
| 1b0a0 | 6e 65 73 20 66 6f 72 20 77 68 69 63 68 20 74 68 65 20 22 6f 62 76 69 6f 75 73 22 20 69 6d 70 6c | nes.for.which.the."obvious".impl |
| 1b0c0 | 65 6d 65 6e 74 61 74 69 6f 6e 20 69 73 20 74 68 65 20 6c 65 73 73 0a 65 66 66 69 63 69 65 6e 74 | ementation.is.the.less.efficient |
| 1b0e0 | 20 6f 6e 65 2e 20 20 43 6f 6e 73 69 64 65 72 20 61 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 68 | .one...Consider.a.machine.that.h |
| 1b100 | 61 73 20 65 78 74 65 6e 73 69 76 65 20 74 61 62 6c 65 73 20 6f 66 0a 6c 6f 67 61 72 69 74 68 6d | as.extensive.tables.of.logarithm |
| 1b120 | 73 20 61 6e 64 20 61 6e 74 69 6c 6f 67 61 72 69 74 68 6d 73 20 73 74 6f 72 65 64 20 69 6e 20 61 | s.and.antilogarithms.stored.in.a |
| 1b140 | 20 76 65 72 79 20 65 66 66 69 63 69 65 6e 74 20 6d 61 6e 6e 65 72 2e 0a 0a 20 20 20 28 32 29 20 | .very.efficient.manner......(2). |
| 1b160 | 54 68 65 20 63 6f 6e 63 65 70 74 20 6f 66 20 63 6f 6e 73 69 73 74 65 6e 74 20 72 65 6e 61 6d 69 | The.concept.of.consistent.renami |
| 1b180 | 6e 67 20 69 73 20 61 63 74 75 61 6c 6c 79 20 73 75 62 74 6c 65 20 61 6e 64 0a 64 69 66 66 69 63 | ng.is.actually.subtle.and.diffic |
| 1b1a0 | 75 6c 74 20 74 6f 20 64 65 66 69 6e 65 20 66 6f 72 6d 61 6c 6c 79 2e 20 20 46 61 6d 6f 75 73 20 | ult.to.define.formally...Famous. |
| 1b1c0 | 6c 6f 67 69 63 69 61 6e 73 20 68 61 76 65 20 6d 61 64 65 20 65 6d 62 61 72 72 61 73 73 69 6e 67 | logicians.have.made.embarrassing |
| 1b1e0 | 0a 65 72 72 6f 72 73 20 68 65 72 65 2e 0a 0a 20 20 20 28 33 29 20 5b 46 6f 6f 74 6e 6f 74 65 20 | .errors.here......(3).[Footnote. |
| 1b200 | 32 38 5d 20 4c 65 78 69 63 61 6c 20 73 63 6f 70 69 6e 67 20 64 69 63 74 61 74 65 73 20 74 68 61 | 28].Lexical.scoping.dictates.tha |
| 1b220 | 74 20 66 72 65 65 20 76 61 72 69 61 62 6c 65 73 20 69 6e 20 61 0a 70 72 6f 63 65 64 75 72 65 20 | t.free.variables.in.a.procedure. |
| 1b240 | 61 72 65 20 74 61 6b 65 6e 20 74 6f 20 72 65 66 65 72 20 74 6f 20 62 69 6e 64 69 6e 67 73 20 6d | are.taken.to.refer.to.bindings.m |
| 1b260 | 61 64 65 20 62 79 20 65 6e 63 6c 6f 73 69 6e 67 20 70 72 6f 63 65 64 75 72 65 0a 64 65 66 69 6e | ade.by.enclosing.procedure.defin |
| 1b280 | 69 74 69 6f 6e 73 3b 20 74 68 61 74 20 69 73 2c 20 74 68 65 79 20 61 72 65 20 6c 6f 6f 6b 65 64 | itions;.that.is,.they.are.looked |
| 1b2a0 | 20 75 70 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 | .up.in.the.environment.in.which. |
| 1b2c0 | 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 77 61 73 20 64 65 66 69 6e 65 64 2e 20 57 65 20 77 69 | the.procedure.was.defined..We.wi |
| 1b2e0 | 6c 6c 20 73 65 65 20 68 6f 77 20 74 68 69 73 20 77 6f 72 6b 73 20 69 6e 20 64 65 74 61 69 6c 20 | ll.see.how.this.works.in.detail. |
| 1b300 | 69 6e 20 63 68 61 70 74 65 72 0a 33 20 77 68 65 6e 20 77 65 20 73 74 75 64 79 20 65 6e 76 69 72 | in.chapter.3.when.we.study.envir |
| 1b320 | 6f 6e 6d 65 6e 74 73 20 61 6e 64 20 74 68 65 20 64 65 74 61 69 6c 65 64 20 62 65 68 61 76 69 6f | onments.and.the.detailed.behavio |
| 1b340 | 72 20 6f 66 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 72 2e 0a 0a 20 20 20 28 34 29 20 45 6d | r.of.the.interpreter......(4).Em |
| 1b360 | 62 65 64 64 65 64 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6d 75 73 74 20 63 6f 6d 65 20 66 69 72 | bedded.definitions.must.come.fir |
| 1b380 | 73 74 20 69 6e 20 61 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 2e 20 54 68 65 0a 6d 61 6e 61 | st.in.a.procedure.body..The.mana |
| 1b3a0 | 67 65 6d 65 6e 74 20 69 73 20 6e 6f 74 20 72 65 73 70 6f 6e 73 69 62 6c 65 20 66 6f 72 20 74 68 | gement.is.not.responsible.for.th |
| 1b3c0 | 65 20 63 6f 6e 73 65 71 75 65 6e 63 65 73 20 6f 66 20 72 75 6e 6e 69 6e 67 20 70 72 6f 67 72 61 | e.consequences.of.running.progra |
| 1b3e0 | 6d 73 0a 74 68 61 74 20 69 6e 74 65 72 74 77 69 6e 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 61 6e | ms.that.intertwine.definition.an |
| 1b400 | 64 20 75 73 65 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 | d.use.....File:.sicp.info,..Node |
| 1b420 | 3a 20 31 2d 32 2c 20 20 4e 65 78 74 3a 20 31 2d 33 2c 20 20 50 72 65 76 3a 20 31 2d 31 2c 20 20 | :.1-2,..Next:.1-3,..Prev:.1-1,.. |
| 1b440 | 55 70 3a 20 43 68 61 70 74 65 72 20 31 0a 0a 31 2e 32 20 50 72 6f 63 65 64 75 72 65 73 20 61 6e | Up:.Chapter.1..1.2.Procedures.an |
| 1b460 | 64 20 74 68 65 20 50 72 6f 63 65 73 73 65 73 20 54 68 65 79 20 47 65 6e 65 72 61 74 65 0a 3d 3d | d.the.Processes.They.Generate.== |
| 1b480 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ================================ |
| 1b4a0 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 57 65 20 68 61 76 65 20 6e 6f 77 20 63 6f 6e 73 69 64 | ============..We.have.now.consid |
| 1b4c0 | 65 72 65 64 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 70 72 6f 67 72 61 6d 6d 69 6e 67 | ered.the.elements.of.programming |
| 1b4e0 | 3a 20 57 65 20 68 61 76 65 20 75 73 65 64 0a 70 72 69 6d 69 74 69 76 65 20 61 72 69 74 68 6d 65 | :.We.have.used.primitive.arithme |
| 1b500 | 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 77 65 20 68 61 76 65 20 63 6f 6d 62 69 6e 65 64 | tic.operations,.we.have.combined |
| 1b520 | 20 74 68 65 73 65 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 61 6e 64 0a 77 65 20 68 61 76 65 20 61 | .these.operations,.and.we.have.a |
| 1b540 | 62 73 74 72 61 63 74 65 64 20 74 68 65 73 65 20 63 6f 6d 70 6f 73 69 74 65 20 6f 70 65 72 61 74 | bstracted.these.composite.operat |
| 1b560 | 69 6f 6e 73 20 62 79 20 64 65 66 69 6e 69 6e 67 20 74 68 65 6d 20 61 73 0a 63 6f 6d 70 6f 75 6e | ions.by.defining.them.as.compoun |
| 1b580 | 64 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 42 75 74 20 74 68 61 74 20 69 73 20 6e 6f 74 20 65 | d.procedures...But.that.is.not.e |
| 1b5a0 | 6e 6f 75 67 68 20 74 6f 20 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 73 61 79 20 74 68 61 74 0a 77 | nough.to.enable.us.to.say.that.w |
| 1b5c0 | 65 20 6b 6e 6f 77 20 68 6f 77 20 74 6f 20 70 72 6f 67 72 61 6d 2e 20 20 4f 75 72 20 73 69 74 75 | e.know.how.to.program...Our.situ |
| 1b5e0 | 61 74 69 6f 6e 20 69 73 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 74 68 61 74 20 6f 66 20 73 6f | ation.is.analogous.to.that.of.so |
| 1b600 | 6d 65 6f 6e 65 0a 77 68 6f 20 68 61 73 20 6c 65 61 72 6e 65 64 20 74 68 65 20 72 75 6c 65 73 20 | meone.who.has.learned.the.rules. |
| 1b620 | 66 6f 72 20 68 6f 77 20 74 68 65 20 70 69 65 63 65 73 20 6d 6f 76 65 20 69 6e 20 63 68 65 73 73 | for.how.the.pieces.move.in.chess |
| 1b640 | 20 62 75 74 20 6b 6e 6f 77 73 0a 6e 6f 74 68 69 6e 67 20 6f 66 20 74 79 70 69 63 61 6c 20 6f 70 | .but.knows.nothing.of.typical.op |
| 1b660 | 65 6e 69 6e 67 73 2c 20 74 61 63 74 69 63 73 2c 20 6f 72 20 73 74 72 61 74 65 67 79 2e 20 20 4c | enings,.tactics,.or.strategy...L |
| 1b680 | 69 6b 65 20 74 68 65 20 6e 6f 76 69 63 65 0a 63 68 65 73 73 20 70 6c 61 79 65 72 2c 20 77 65 20 | ike.the.novice.chess.player,.we. |
| 1b6a0 | 64 6f 6e 27 74 20 79 65 74 20 6b 6e 6f 77 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 70 61 74 74 65 72 | don't.yet.know.the.common.patter |
| 1b6c0 | 6e 73 20 6f 66 20 75 73 61 67 65 20 69 6e 20 74 68 65 0a 64 6f 6d 61 69 6e 2e 20 20 57 65 20 6c | ns.of.usage.in.the.domain...We.l |
| 1b6e0 | 61 63 6b 20 74 68 65 20 6b 6e 6f 77 6c 65 64 67 65 20 6f 66 20 77 68 69 63 68 20 6d 6f 76 65 73 | ack.the.knowledge.of.which.moves |
| 1b700 | 20 61 72 65 20 77 6f 72 74 68 20 6d 61 6b 69 6e 67 20 28 77 68 69 63 68 0a 70 72 6f 63 65 64 75 | .are.worth.making.(which.procedu |
| 1b720 | 72 65 73 20 61 72 65 20 77 6f 72 74 68 20 64 65 66 69 6e 69 6e 67 29 2e 20 20 57 65 20 6c 61 63 | res.are.worth.defining)...We.lac |
| 1b740 | 6b 20 74 68 65 20 65 78 70 65 72 69 65 6e 63 65 20 74 6f 20 70 72 65 64 69 63 74 20 74 68 65 0a | k.the.experience.to.predict.the. |
| 1b760 | 63 6f 6e 73 65 71 75 65 6e 63 65 73 20 6f 66 20 6d 61 6b 69 6e 67 20 61 20 6d 6f 76 65 20 28 65 | consequences.of.making.a.move.(e |
| 1b780 | 78 65 63 75 74 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 29 2e 0a 0a 20 20 20 54 68 65 20 61 | xecuting.a.procedure)......The.a |
| 1b7a0 | 62 69 6c 69 74 79 20 74 6f 20 76 69 73 75 61 6c 69 7a 65 20 74 68 65 20 63 6f 6e 73 65 71 75 65 | bility.to.visualize.the.conseque |
| 1b7c0 | 6e 63 65 73 20 6f 66 20 74 68 65 20 61 63 74 69 6f 6e 73 20 75 6e 64 65 72 0a 63 6f 6e 73 69 64 | nces.of.the.actions.under.consid |
| 1b7e0 | 65 72 61 74 69 6f 6e 20 69 73 20 63 72 75 63 69 61 6c 20 74 6f 20 62 65 63 6f 6d 69 6e 67 20 61 | eration.is.crucial.to.becoming.a |
| 1b800 | 6e 20 65 78 70 65 72 74 20 70 72 6f 67 72 61 6d 6d 65 72 2c 20 6a 75 73 74 20 61 73 20 69 74 0a | n.expert.programmer,.just.as.it. |
| 1b820 | 69 73 20 69 6e 20 61 6e 79 20 73 79 6e 74 68 65 74 69 63 2c 20 63 72 65 61 74 69 76 65 20 61 63 | is.in.any.synthetic,.creative.ac |
| 1b840 | 74 69 76 69 74 79 2e 20 20 49 6e 20 62 65 63 6f 6d 69 6e 67 20 61 6e 20 65 78 70 65 72 74 0a 70 | tivity...In.becoming.an.expert.p |
| 1b860 | 68 6f 74 6f 67 72 61 70 68 65 72 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 6f 6e 65 20 6d 75 | hotographer,.for.example,.one.mu |
| 1b880 | 73 74 20 6c 65 61 72 6e 20 68 6f 77 20 74 6f 20 6c 6f 6f 6b 20 61 74 20 61 20 73 63 65 6e 65 20 | st.learn.how.to.look.at.a.scene. |
| 1b8a0 | 61 6e 64 0a 6b 6e 6f 77 20 68 6f 77 20 64 61 72 6b 20 65 61 63 68 20 72 65 67 69 6f 6e 20 77 69 | and.know.how.dark.each.region.wi |
| 1b8c0 | 6c 6c 20 61 70 70 65 61 72 20 6f 6e 20 61 20 70 72 69 6e 74 20 66 6f 72 20 65 61 63 68 20 70 6f | ll.appear.on.a.print.for.each.po |
| 1b8e0 | 73 73 69 62 6c 65 0a 63 68 6f 69 63 65 20 6f 66 20 65 78 70 6f 73 75 72 65 20 61 6e 64 20 64 65 | ssible.choice.of.exposure.and.de |
| 1b900 | 76 65 6c 6f 70 6d 65 6e 74 20 63 6f 6e 64 69 74 69 6f 6e 73 2e 20 20 4f 6e 6c 79 20 74 68 65 6e | velopment.conditions...Only.then |
| 1b920 | 20 63 61 6e 20 6f 6e 65 0a 72 65 61 73 6f 6e 20 62 61 63 6b 77 61 72 64 2c 20 70 6c 61 6e 6e 69 | .can.one.reason.backward,.planni |
| 1b940 | 6e 67 20 66 72 61 6d 69 6e 67 2c 20 6c 69 67 68 74 69 6e 67 2c 20 65 78 70 6f 73 75 72 65 2c 20 | ng.framing,.lighting,.exposure,. |
| 1b960 | 61 6e 64 20 64 65 76 65 6c 6f 70 6d 65 6e 74 0a 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 64 65 | and.development.to.obtain.the.de |
| 1b980 | 73 69 72 65 64 20 65 66 66 65 63 74 73 2e 20 20 53 6f 20 69 74 20 69 73 20 77 69 74 68 20 70 72 | sired.effects...So.it.is.with.pr |
| 1b9a0 | 6f 67 72 61 6d 6d 69 6e 67 2c 20 77 68 65 72 65 20 77 65 20 61 72 65 0a 70 6c 61 6e 6e 69 6e 67 | ogramming,.where.we.are.planning |
| 1b9c0 | 20 74 68 65 20 63 6f 75 72 73 65 20 6f 66 20 61 63 74 69 6f 6e 20 74 6f 20 62 65 20 74 61 6b 65 | .the.course.of.action.to.be.take |
| 1b9e0 | 6e 20 62 79 20 61 20 70 72 6f 63 65 73 73 20 61 6e 64 20 77 68 65 72 65 20 77 65 0a 63 6f 6e 74 | n.by.a.process.and.where.we.cont |
| 1ba00 | 72 6f 6c 20 74 68 65 20 70 72 6f 63 65 73 73 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 61 20 70 72 | rol.the.process.by.means.of.a.pr |
| 1ba20 | 6f 67 72 61 6d 2e 20 20 54 6f 20 62 65 63 6f 6d 65 20 65 78 70 65 72 74 73 2c 20 77 65 20 6d 75 | ogram...To.become.experts,.we.mu |
| 1ba40 | 73 74 0a 6c 65 61 72 6e 20 74 6f 20 76 69 73 75 61 6c 69 7a 65 20 74 68 65 20 70 72 6f 63 65 73 | st.learn.to.visualize.the.proces |
| 1ba60 | 73 65 73 20 67 65 6e 65 72 61 74 65 64 20 62 79 20 76 61 72 69 6f 75 73 20 74 79 70 65 73 20 6f | ses.generated.by.various.types.o |
| 1ba80 | 66 0a 70 72 6f 63 65 64 75 72 65 73 2e 20 20 4f 6e 6c 79 20 61 66 74 65 72 20 77 65 20 68 61 76 | f.procedures...Only.after.we.hav |
| 1baa0 | 65 20 64 65 76 65 6c 6f 70 65 64 20 73 75 63 68 20 61 20 73 6b 69 6c 6c 20 63 61 6e 20 77 65 20 | e.developed.such.a.skill.can.we. |
| 1bac0 | 6c 65 61 72 6e 20 74 6f 0a 72 65 6c 69 61 62 6c 79 20 63 6f 6e 73 74 72 75 63 74 20 70 72 6f 67 | learn.to.reliably.construct.prog |
| 1bae0 | 72 61 6d 73 20 74 68 61 74 20 65 78 68 69 62 69 74 20 74 68 65 20 64 65 73 69 72 65 64 20 62 65 | rams.that.exhibit.the.desired.be |
| 1bb00 | 68 61 76 69 6f 72 2e 0a 0a 20 20 20 41 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 61 20 70 61 74 | havior......A.procedure.is.a.pat |
| 1bb20 | 74 65 72 6e 20 66 6f 72 20 74 68 65 20 22 6c 6f 63 61 6c 20 65 76 6f 6c 75 74 69 6f 6e 22 20 6f | tern.for.the."local.evolution".o |
| 1bb40 | 66 20 61 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 0a 70 72 6f 63 65 73 73 2e 20 20 49 74 20 73 | f.a.computational.process...It.s |
| 1bb60 | 70 65 63 69 66 69 65 73 20 68 6f 77 20 65 61 63 68 20 73 74 61 67 65 20 6f 66 20 74 68 65 20 70 | pecifies.how.each.stage.of.the.p |
| 1bb80 | 72 6f 63 65 73 73 20 69 73 20 62 75 69 6c 74 20 75 70 6f 6e 20 74 68 65 0a 70 72 65 76 69 6f 75 | rocess.is.built.upon.the.previou |
| 1bba0 | 73 20 73 74 61 67 65 2e 20 20 57 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 20 62 65 20 61 62 | s.stage...We.would.like.to.be.ab |
| 1bbc0 | 6c 65 20 74 6f 20 6d 61 6b 65 20 73 74 61 74 65 6d 65 6e 74 73 20 61 62 6f 75 74 20 74 68 65 0a | le.to.make.statements.about.the. |
| 1bbe0 | 6f 76 65 72 61 6c 6c 2c 20 6f 72 20 22 67 6c 6f 62 61 6c 22 2c 20 62 65 68 61 76 69 6f 72 20 6f | overall,.or."global",.behavior.o |
| 1bc00 | 66 20 61 20 70 72 6f 63 65 73 73 20 77 68 6f 73 65 20 6c 6f 63 61 6c 20 65 76 6f 6c 75 74 69 6f | f.a.process.whose.local.evolutio |
| 1bc20 | 6e 20 68 61 73 0a 62 65 65 6e 20 73 70 65 63 69 66 69 65 64 20 62 79 20 61 20 70 72 6f 63 65 64 | n.has.been.specified.by.a.proced |
| 1bc40 | 75 72 65 2e 20 20 54 68 69 73 20 69 73 20 76 65 72 79 20 64 69 66 66 69 63 75 6c 74 20 74 6f 20 | ure...This.is.very.difficult.to. |
| 1bc60 | 64 6f 20 69 6e 0a 67 65 6e 65 72 61 6c 2c 20 62 75 74 20 77 65 20 63 61 6e 20 61 74 20 6c 65 61 | do.in.general,.but.we.can.at.lea |
| 1bc80 | 73 74 20 74 72 79 20 74 6f 20 64 65 73 63 72 69 62 65 20 73 6f 6d 65 20 74 79 70 69 63 61 6c 20 | st.try.to.describe.some.typical. |
| 1bca0 | 70 61 74 74 65 72 6e 73 20 6f 66 0a 70 72 6f 63 65 73 73 20 65 76 6f 6c 75 74 69 6f 6e 2e 0a 0a | patterns.of.process.evolution... |
| 1bcc0 | 20 20 20 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 77 65 20 77 69 6c 6c 20 65 78 61 6d 69 | ...In.this.section.we.will.exami |
| 1bce0 | 6e 65 20 73 6f 6d 65 20 63 6f 6d 6d 6f 6e 20 22 73 68 61 70 65 73 22 20 66 6f 72 20 70 72 6f 63 | ne.some.common."shapes".for.proc |
| 1bd00 | 65 73 73 65 73 0a 67 65 6e 65 72 61 74 65 64 20 62 79 20 73 69 6d 70 6c 65 20 70 72 6f 63 65 64 | esses.generated.by.simple.proced |
| 1bd20 | 75 72 65 73 2e 20 20 57 65 20 77 69 6c 6c 20 61 6c 73 6f 20 69 6e 76 65 73 74 69 67 61 74 65 20 | ures...We.will.also.investigate. |
| 1bd40 | 74 68 65 20 72 61 74 65 73 20 61 74 0a 77 68 69 63 68 20 74 68 65 73 65 20 70 72 6f 63 65 73 73 | the.rates.at.which.these.process |
| 1bd60 | 65 73 20 63 6f 6e 73 75 6d 65 20 74 68 65 20 69 6d 70 6f 72 74 61 6e 74 20 63 6f 6d 70 75 74 61 | es.consume.the.important.computa |
| 1bd80 | 74 69 6f 6e 61 6c 20 72 65 73 6f 75 72 63 65 73 20 6f 66 0a 74 69 6d 65 20 61 6e 64 20 73 70 61 | tional.resources.of.time.and.spa |
| 1bda0 | 63 65 2e 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 77 65 20 77 69 6c 6c 20 63 6f 6e 73 | ce...The.procedures.we.will.cons |
| 1bdc0 | 69 64 65 72 20 61 72 65 20 76 65 72 79 20 73 69 6d 70 6c 65 2e 0a 54 68 65 69 72 20 72 6f 6c 65 | ider.are.very.simple..Their.role |
| 1bde0 | 20 69 73 20 6c 69 6b 65 20 74 68 61 74 20 70 6c 61 79 65 64 20 62 79 20 74 65 73 74 20 70 61 74 | .is.like.that.played.by.test.pat |
| 1be00 | 74 65 72 6e 73 20 69 6e 20 70 68 6f 74 6f 67 72 61 70 68 79 3a 20 61 73 0a 6f 76 65 72 73 69 6d | terns.in.photography:.as.oversim |
| 1be20 | 70 6c 69 66 69 65 64 20 70 72 6f 74 6f 74 79 70 69 63 61 6c 20 70 61 74 74 65 72 6e 73 2c 20 72 | plified.prototypical.patterns,.r |
| 1be40 | 61 74 68 65 72 20 74 68 61 6e 20 70 72 61 63 74 69 63 61 6c 20 65 78 61 6d 70 6c 65 73 20 69 6e | ather.than.practical.examples.in |
| 1be60 | 0a 74 68 65 69 72 20 6f 77 6e 20 72 69 67 68 74 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 31 2d | .their.own.right...*.Menu:..*.1- |
| 1be80 | 32 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4c 69 6e 65 61 72 20 52 65 63 75 72 73 69 6f | 2-1::............Linear.Recursio |
| 1bea0 | 6e 20 61 6e 64 20 49 74 65 72 61 74 69 6f 6e 0a 2a 20 31 2d 32 2d 32 3a 3a 20 20 20 20 20 20 20 | n.and.Iteration.*.1-2-2::....... |
| 1bec0 | 20 20 20 20 20 54 72 65 65 20 52 65 63 75 72 73 69 6f 6e 0a 2a 20 31 2d 32 2d 33 3a 3a 20 20 20 | .....Tree.Recursion.*.1-2-3::... |
| 1bee0 | 20 20 20 20 20 20 20 20 20 4f 72 64 65 72 73 20 6f 66 20 47 72 6f 77 74 68 0a 2a 20 31 2d 32 2d | .........Orders.of.Growth.*.1-2- |
| 1bf00 | 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 0a 2a 20 | 4::............Exponentiation.*. |
| 1bf20 | 31 2d 32 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 47 72 65 61 74 65 73 74 20 43 6f 6d 6d | 1-2-5::............Greatest.Comm |
| 1bf40 | 6f 6e 20 44 69 76 69 73 6f 72 73 0a 2a 20 31 2d 32 2d 36 3a 3a 20 20 20 20 20 20 20 20 20 20 20 | on.Divisors.*.1-2-6::........... |
| 1bf60 | 20 45 78 61 6d 70 6c 65 3a 20 54 65 73 74 69 6e 67 20 66 6f 72 20 50 72 69 6d 61 6c 69 74 79 0a | .Example:.Testing.for.Primality. |
| 1bf80 | 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 32 2d 31 | ...File:.sicp.info,..Node:.1-2-1 |
| 1bfa0 | 2c 20 20 4e 65 78 74 3a 20 31 2d 32 2d 32 2c 20 20 50 72 65 76 3a 20 31 2d 32 2c 20 20 55 70 3a | ,..Next:.1-2-2,..Prev:.1-2,..Up: |
| 1bfc0 | 20 31 2d 32 0a 0a 31 2e 32 2e 31 20 4c 69 6e 65 61 72 20 52 65 63 75 72 73 69 6f 6e 20 61 6e 64 | .1-2..1.2.1.Linear.Recursion.and |
| 1bfe0 | 20 49 74 65 72 61 74 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .Iteration.--------------------- |
| 1c000 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 31 2e | ---------------.......*Figure.1. |
| 1c020 | 33 3a 2a 20 41 20 6c 69 6e 65 61 72 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 20 66 | 3:*.A.linear.recursive.process.f |
| 1c040 | 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 36 21 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 | or.computing.6!.............(fac |
| 1c060 | 74 6f 72 69 61 6c 20 36 29 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | torial.6)........--------------- |
| 1c080 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2e 0a 20 20 20 20 20 20 20 20 20 20 28 2a 20 36 20 28 66 61 63 74 6f | ---------............(*.6.(facto |
| 1c0a0 | 72 69 61 6c 20 35 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rial.5))........................ |
| 1c0c0 | 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 2a 20 36 20 28 2a 20 35 20 28 66 61 63 74 6f 72 69 | ..|...........(*.6.(*.5.(factori |
| 1c0e0 | 61 6c 20 34 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 | al.4)))....................|.... |
| 1c100 | 20 20 20 20 20 20 20 28 2a 20 36 20 28 2a 20 35 20 28 2a 20 34 20 28 66 61 63 74 6f 72 69 61 6c | .......(*.6.(*.5.(*.4.(factorial |
| 1c120 | 20 33 29 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | .3))))..............|........... |
| 1c140 | 28 2a 20 36 20 28 2a 20 35 20 28 2a 20 34 20 28 2a 20 33 20 28 66 61 63 74 6f 72 69 61 6c 20 32 | (*.6.(*.5.(*.4.(*.3.(factorial.2 |
| 1c160 | 29 29 29 29 29 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 2a 20 36 20 28 2a | )))))........|...........(*.6.(* |
| 1c180 | 20 35 20 28 2a 20 34 20 28 2a 20 33 20 28 2a 20 32 20 28 66 61 63 74 6f 72 69 61 6c 20 31 29 29 | .5.(*.4.(*.3.(*.2.(factorial.1)) |
| 1c1a0 | 29 29 29 29 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 2a 20 36 20 28 2a 20 35 20 28 2a 20 34 | ))))..|...........(*.6.(*.5.(*.4 |
| 1c1c0 | 20 28 2a 20 33 20 28 2a 20 32 20 31 29 29 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | .(*.3.(*.2.1)))))..............| |
| 1c1e0 | 0a 20 20 20 20 20 20 20 20 20 20 28 2a 20 36 20 28 2a 20 35 20 28 2a 20 34 20 28 2a 20 33 20 32 | ...........(*.6.(*.5.(*.4.(*.3.2 |
| 1c200 | 29 29 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 | ))))....................|....... |
| 1c220 | 20 20 20 20 28 2a 20 36 20 28 2a 20 35 20 28 2a 20 34 20 36 29 29 29 20 20 20 20 20 20 20 20 20 | ....(*.6.(*.5.(*.4.6)))......... |
| 1c240 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 2a 20 | .................|...........(*. |
| 1c260 | 36 20 28 2a 20 35 20 32 34 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 6.(*.5.24))..................... |
| 1c280 | 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 2a 20 36 20 31 32 30 29 20 | ..........|...........(*.6.120). |
| 1c2a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 1c2c0 | 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 37 32 30 20 20 20 20 20 20 20 20 20 20 3c 2d 2d 2d | ...|...........720..........<--- |
| 1c2e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 27 0a 0a 57 | ----------------------------'..W |
| 1c300 | 65 20 62 65 67 69 6e 20 62 79 20 63 6f 6e 73 69 64 65 72 69 6e 67 20 74 68 65 20 66 61 63 74 6f | e.begin.by.considering.the.facto |
| 1c320 | 72 69 61 6c 20 66 75 6e 63 74 69 6f 6e 2c 20 64 65 66 69 6e 65 64 20 62 79 0a 0a 20 20 20 20 20 | rial.function,.defined.by....... |
| 1c340 | 6e 21 20 3d 20 6e 20 2a 20 28 6e 20 2d 20 31 29 20 2a 20 28 6e 20 2d 20 32 29 20 2e 2e 2e 20 33 | n!.=.n.*.(n.-.1).*.(n.-.2).....3 |
| 1c360 | 20 2a 20 32 20 2a 20 31 0a 0a 20 20 20 54 68 65 72 65 20 61 72 65 20 6d 61 6e 79 20 77 61 79 73 | .*.2.*.1.....There.are.many.ways |
| 1c380 | 20 74 6f 20 63 6f 6d 70 75 74 65 20 66 61 63 74 6f 72 69 61 6c 73 2e 20 20 4f 6e 65 20 77 61 79 | .to.compute.factorials...One.way |
| 1c3a0 | 20 69 73 20 74 6f 20 6d 61 6b 65 20 75 73 65 0a 6f 66 20 74 68 65 20 6f 62 73 65 72 76 61 74 69 | .is.to.make.use.of.the.observati |
| 1c3c0 | 6f 6e 20 74 68 61 74 20 6e 21 20 69 73 20 65 71 75 61 6c 20 74 6f 20 6e 20 74 69 6d 65 73 20 28 | on.that.n!.is.equal.to.n.times.( |
| 1c3e0 | 6e 20 2d 20 31 29 21 20 66 6f 72 20 61 6e 79 20 70 6f 73 69 74 69 76 65 0a 69 6e 74 65 67 65 72 | n.-.1)!.for.any.positive.integer |
| 1c400 | 20 6e 3a 0a 0a 20 20 20 20 20 6e 21 20 3d 20 6e 20 2a 20 5b 28 6e 20 2d 20 31 29 20 2a 20 28 6e | .n:.......n!.=.n.*.[(n.-.1).*.(n |
| 1c420 | 20 2d 20 32 29 20 2e 2e 2e 20 33 20 2a 20 32 20 2a 20 31 5d 20 3d 20 6e 20 2a 20 28 6e 20 2d 20 | .-.2).....3.*.2.*.1].=.n.*.(n.-. |
| 1c440 | 31 29 21 0a 0a 20 20 20 54 68 75 73 2c 20 77 65 20 63 61 6e 20 63 6f 6d 70 75 74 65 20 6e 21 20 | 1)!.....Thus,.we.can.compute.n!. |
| 1c460 | 62 79 20 63 6f 6d 70 75 74 69 6e 67 20 28 6e 20 2d 20 31 29 21 20 61 6e 64 20 6d 75 6c 74 69 70 | by.computing.(n.-.1)!.and.multip |
| 1c480 | 6c 79 69 6e 67 20 74 68 65 0a 72 65 73 75 6c 74 20 62 79 20 6e 2e 20 20 49 66 20 77 65 20 61 64 | lying.the.result.by.n...If.we.ad |
| 1c4a0 | 64 20 74 68 65 20 73 74 69 70 75 6c 61 74 69 6f 6e 20 74 68 61 74 20 31 21 20 69 73 20 65 71 75 | d.the.stipulation.that.1!.is.equ |
| 1c4c0 | 61 6c 20 74 6f 20 31 2c 20 74 68 69 73 0a 6f 62 73 65 72 76 61 74 69 6f 6e 20 74 72 61 6e 73 6c | al.to.1,.this.observation.transl |
| 1c4e0 | 61 74 65 73 20 64 69 72 65 63 74 6c 79 20 69 6e 74 6f 20 61 20 70 72 6f 63 65 64 75 72 65 3a 0a | ates.directly.into.a.procedure:. |
| 1c500 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 | ......(define.(factorial.n)..... |
| 1c520 | 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 | ...(if.(=.n.1)............1..... |
| 1c540 | 20 20 20 20 20 20 20 28 2a 20 6e 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 29 | .......(*.n.(factorial.(-.n.1))) |
| 1c560 | 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 75 73 65 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 | )).....We.can.use.the.substituti |
| 1c580 | 6f 6e 20 6d 6f 64 65 6c 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 35 3a | on.model.of.section.*Note.1-1-5: |
| 1c5a0 | 3a 20 74 6f 20 77 61 74 63 68 0a 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 61 63 74 | :.to.watch.this.procedure.in.act |
| 1c5c0 | 69 6f 6e 20 63 6f 6d 70 75 74 69 6e 67 20 36 21 2c 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e | ion.computing.6!,.as.shown.in.*N |
| 1c5e0 | 6f 74 65 20 46 69 67 75 72 65 20 31 2d 33 3a 3a 2e 0a 0a 20 20 20 4e 6f 77 20 6c 65 74 27 73 20 | ote.Figure.1-3::......Now.let's. |
| 1c600 | 74 61 6b 65 20 61 20 64 69 66 66 65 72 65 6e 74 20 70 65 72 73 70 65 63 74 69 76 65 20 6f 6e 20 | take.a.different.perspective.on. |
| 1c620 | 63 6f 6d 70 75 74 69 6e 67 20 66 61 63 74 6f 72 69 61 6c 73 2e 20 20 57 65 0a 63 6f 75 6c 64 20 | computing.factorials...We.could. |
| 1c640 | 64 65 73 63 72 69 62 65 20 61 20 72 75 6c 65 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 6e 21 | describe.a.rule.for.computing.n! |
| 1c660 | 20 62 79 20 73 70 65 63 69 66 79 69 6e 67 20 74 68 61 74 20 77 65 20 66 69 72 73 74 0a 6d 75 6c | .by.specifying.that.we.first.mul |
| 1c680 | 74 69 70 6c 79 20 31 20 62 79 20 32 2c 20 74 68 65 6e 20 6d 75 6c 74 69 70 6c 79 20 74 68 65 20 | tiply.1.by.2,.then.multiply.the. |
| 1c6a0 | 72 65 73 75 6c 74 20 62 79 20 33 2c 20 74 68 65 6e 20 62 79 20 34 2c 20 61 6e 64 20 73 6f 20 6f | result.by.3,.then.by.4,.and.so.o |
| 1c6c0 | 6e 0a 75 6e 74 69 6c 20 77 65 20 72 65 61 63 68 20 6e 2e 20 20 4d 6f 72 65 20 66 6f 72 6d 61 6c | n.until.we.reach.n...More.formal |
| 1c6e0 | 6c 79 2c 20 77 65 20 6d 61 69 6e 74 61 69 6e 20 61 20 72 75 6e 6e 69 6e 67 20 70 72 6f 64 75 63 | ly,.we.maintain.a.running.produc |
| 1c700 | 74 2c 0a 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 20 63 6f 75 6e 74 65 72 20 74 68 61 74 20 | t,.together.with.a.counter.that. |
| 1c720 | 63 6f 75 6e 74 73 20 66 72 6f 6d 20 31 20 75 70 20 74 6f 20 6e 2e 20 20 57 65 20 63 61 6e 20 64 | counts.from.1.up.to.n...We.can.d |
| 1c740 | 65 73 63 72 69 62 65 0a 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 62 79 20 73 61 79 69 6e | escribe.the.computation.by.sayin |
| 1c760 | 67 20 74 68 61 74 20 74 68 65 20 63 6f 75 6e 74 65 72 20 61 6e 64 20 74 68 65 20 70 72 6f 64 75 | g.that.the.counter.and.the.produ |
| 1c780 | 63 74 0a 73 69 6d 75 6c 74 61 6e 65 6f 75 73 6c 79 20 63 68 61 6e 67 65 20 66 72 6f 6d 20 6f 6e | ct.simultaneously.change.from.on |
| 1c7a0 | 65 20 73 74 65 70 20 74 6f 20 74 68 65 20 6e 65 78 74 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 | e.step.to.the.next.according.to. |
| 1c7c0 | 74 68 65 20 72 75 6c 65 0a 0a 20 20 20 20 20 70 72 6f 64 75 63 74 20 20 3c 2d 20 20 63 6f 75 6e | the.rule.......product..<-..coun |
| 1c7e0 | 74 65 72 20 20 2e 2e 2e 20 20 70 72 6f 64 75 63 74 0a 0a 20 20 20 20 20 63 6f 75 6e 74 65 72 20 | ter.......product.......counter. |
| 1c800 | 20 3c 2d 20 20 63 6f 75 6e 74 65 72 20 20 2b 20 20 31 0a 0a 61 6e 64 20 73 74 69 70 75 6c 61 74 | .<-..counter..+..1..and.stipulat |
| 1c820 | 69 6e 67 20 74 68 61 74 20 6e 21 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 | ing.that.n!.is.the.value.of.the. |
| 1c840 | 70 72 6f 64 75 63 74 20 77 68 65 6e 20 74 68 65 20 63 6f 75 6e 74 65 72 0a 65 78 63 65 65 64 73 | product.when.the.counter.exceeds |
| 1c860 | 20 6e 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 31 2e 34 3a 2a 20 41 20 6c 69 6e 65 61 72 | .n........*Figure.1.4:*.A.linear |
| 1c880 | 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 | .iterative.process.for.computing |
| 1c8a0 | 20 36 21 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 6f 72 69 61 6c 20 36 29 20 20 20 | .6!.............(factorial.6)... |
| 1c8c0 | 2d 2d 2d 2d 2d 2e 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 2d 69 74 65 72 20 20 20 31 20 | -----............(fact-iter...1. |
| 1c8e0 | 31 20 36 29 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 2d 69 74 65 72 20 20 20 31 | 1.6)..|...........(fact-iter...1 |
| 1c900 | 20 32 20 36 29 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 2d 69 74 65 72 20 20 20 | .2.6)..|...........(fact-iter... |
| 1c920 | 32 20 33 20 36 29 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 2d 69 74 65 72 20 20 | 2.3.6)..|...........(fact-iter.. |
| 1c940 | 20 36 20 34 20 36 29 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 2d 69 74 65 72 20 | .6.4.6)..|...........(fact-iter. |
| 1c960 | 20 32 34 20 35 20 36 29 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 2d 69 74 65 72 | .24.5.6)..|...........(fact-iter |
| 1c980 | 20 31 32 30 20 36 20 36 29 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 2d 69 74 65 | .120.6.6)..|...........(fact-ite |
| 1c9a0 | 72 20 37 32 30 20 37 20 36 29 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 37 32 30 0a 0a 20 20 20 | r.720.7.6)..V...........720..... |
| 1c9c0 | 4f 6e 63 65 20 61 67 61 69 6e 2c 20 77 65 20 63 61 6e 20 72 65 63 61 73 74 20 6f 75 72 20 64 65 | Once.again,.we.can.recast.our.de |
| 1c9e0 | 73 63 72 69 70 74 69 6f 6e 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 0a 63 6f 6d | scription.as.a.procedure.for.com |
| 1ca00 | 70 75 74 69 6e 67 20 66 61 63 74 6f 72 69 61 6c 73 3a 28 31 29 0a 0a 20 20 20 20 20 28 64 65 66 | puting.factorials:(1).......(def |
| 1ca20 | 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 28 66 61 63 74 2d 69 | ine.(factorial.n)........(fact-i |
| 1ca40 | 74 65 72 20 31 20 31 20 6e 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 2d | ter.1.1.n)).......(define.(fact- |
| 1ca60 | 69 74 65 72 20 70 72 6f 64 75 63 74 20 63 6f 75 6e 74 65 72 20 6d 61 78 2d 63 6f 75 6e 74 29 0a | iter.product.counter.max-count). |
| 1ca80 | 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 63 6f 75 6e 74 65 72 20 6d 61 78 2d 63 6f 75 6e 74 29 | .......(if.(>.counter.max-count) |
| 1caa0 | 0a 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 20 20 20 20 28 | ............product............( |
| 1cac0 | 66 61 63 74 2d 69 74 65 72 20 28 2a 20 63 6f 75 6e 74 65 72 20 70 72 6f 64 75 63 74 29 0a 20 20 | fact-iter.(*.counter.product)... |
| 1cae0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 63 6f 75 6e 74 65 72 20 31 | ....................(+.counter.1 |
| 1cb00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 61 78 2d 63 6f 75 6e | ).......................max-coun |
| 1cb20 | 74 29 29 29 0a 0a 20 20 20 41 73 20 62 65 66 6f 72 65 2c 20 77 65 20 63 61 6e 20 75 73 65 20 74 | t))).....As.before,.we.can.use.t |
| 1cb40 | 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 74 6f 20 76 69 73 75 61 6c 69 | he.substitution.model.to.visuali |
| 1cb60 | 7a 65 20 74 68 65 0a 70 72 6f 63 65 73 73 20 6f 66 20 63 6f 6d 70 75 74 69 6e 67 20 36 21 2c 20 | ze.the.process.of.computing.6!,. |
| 1cb80 | 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 31 2d 34 3a 3a 2e 0a | as.shown.in.*Note.Figure.1-4::.. |
| 1cba0 | 0a 20 20 20 43 6f 6d 70 61 72 65 20 74 68 65 20 74 77 6f 20 70 72 6f 63 65 73 73 65 73 2e 20 20 | ....Compare.the.two.processes... |
| 1cbc0 | 46 72 6f 6d 20 6f 6e 65 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 2c 20 74 68 65 79 20 73 65 65 | From.one.point.of.view,.they.see |
| 1cbe0 | 6d 20 68 61 72 64 6c 79 0a 64 69 66 66 65 72 65 6e 74 20 61 74 20 61 6c 6c 2e 20 20 42 6f 74 68 | m.hardly.different.at.all...Both |
| 1cc00 | 20 63 6f 6d 70 75 74 65 20 74 68 65 20 73 61 6d 65 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 66 | .compute.the.same.mathematical.f |
| 1cc20 | 75 6e 63 74 69 6f 6e 20 6f 6e 20 74 68 65 0a 73 61 6d 65 20 64 6f 6d 61 69 6e 2c 20 61 6e 64 20 | unction.on.the.same.domain,.and. |
| 1cc40 | 65 61 63 68 20 72 65 71 75 69 72 65 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 | each.requires.a.number.of.steps. |
| 1cc60 | 70 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 6e 20 74 6f 0a 63 6f 6d 70 75 74 65 20 6e 21 2e | proportional.to.n.to.compute.n!. |
| 1cc80 | 20 20 49 6e 64 65 65 64 2c 20 62 6f 74 68 20 70 72 6f 63 65 73 73 65 73 20 65 76 65 6e 20 63 61 | ..Indeed,.both.processes.even.ca |
| 1cca0 | 72 72 79 20 6f 75 74 20 74 68 65 20 73 61 6d 65 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 6d 75 6c | rry.out.the.same.sequence.of.mul |
| 1ccc0 | 74 69 70 6c 69 63 61 74 69 6f 6e 73 2c 20 6f 62 74 61 69 6e 69 6e 67 20 74 68 65 20 73 61 6d 65 | tiplications,.obtaining.the.same |
| 1cce0 | 20 73 65 71 75 65 6e 63 65 20 6f 66 20 70 61 72 74 69 61 6c 20 70 72 6f 64 75 63 74 73 2e 20 20 | .sequence.of.partial.products... |
| 1cd00 | 4f 6e 0a 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 77 68 65 6e 20 77 65 20 63 6f 6e 73 69 | On.the.other.hand,.when.we.consi |
| 1cd20 | 64 65 72 20 74 68 65 20 22 73 68 61 70 65 73 22 20 6f 66 20 74 68 65 20 74 77 6f 20 70 72 6f 63 | der.the."shapes".of.the.two.proc |
| 1cd40 | 65 73 73 65 73 2c 20 77 65 0a 66 69 6e 64 20 74 68 61 74 20 74 68 65 79 20 65 76 6f 6c 76 65 20 | esses,.we.find.that.they.evolve. |
| 1cd60 | 71 75 69 74 65 20 64 69 66 66 65 72 65 6e 74 6c 79 2e 0a 0a 20 20 20 43 6f 6e 73 69 64 65 72 20 | quite.differently......Consider. |
| 1cd80 | 74 68 65 20 66 69 72 73 74 20 70 72 6f 63 65 73 73 2e 20 20 54 68 65 20 73 75 62 73 74 69 74 75 | the.first.process...The.substitu |
| 1cda0 | 74 69 6f 6e 20 6d 6f 64 65 6c 20 72 65 76 65 61 6c 73 20 61 20 73 68 61 70 65 0a 6f 66 20 65 78 | tion.model.reveals.a.shape.of.ex |
| 1cdc0 | 70 61 6e 73 69 6f 6e 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 63 6f 6e 74 72 61 63 74 69 6f 6e 2c | pansion.followed.by.contraction, |
| 1cde0 | 20 69 6e 64 69 63 61 74 65 64 20 62 79 20 74 68 65 20 61 72 72 6f 77 20 69 6e 20 2a 4e 6f 74 65 | .indicated.by.the.arrow.in.*Note |
| 1ce00 | 0a 46 69 67 75 72 65 20 31 2d 33 3a 3a 2e 20 20 54 68 65 20 65 78 70 61 6e 73 69 6f 6e 20 6f 63 | .Figure.1-3::...The.expansion.oc |
| 1ce20 | 63 75 72 73 20 61 73 20 74 68 65 20 70 72 6f 63 65 73 73 20 62 75 69 6c 64 73 20 75 70 20 61 20 | curs.as.the.process.builds.up.a. |
| 1ce40 | 63 68 61 69 6e 20 6f 66 20 6f 70 65 72 61 74 69 6f 6e 73 0a 22 64 65 66 65 72 72 65 64 20 6f 70 | chain.of.operations."deferred.op |
| 1ce60 | 65 72 61 74 69 6f 6e 73 22 20 28 69 6e 20 74 68 69 73 20 63 61 73 65 2c 20 61 20 63 68 61 69 6e | erations".(in.this.case,.a.chain |
| 1ce80 | 20 6f 66 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 29 2e 20 20 54 68 65 0a 63 6f 6e 74 72 | .of.multiplications)...The.contr |
| 1cea0 | 61 63 74 69 6f 6e 20 6f 63 63 75 72 73 20 61 73 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 | action.occurs.as.the.operations. |
| 1cec0 | 61 72 65 20 61 63 74 75 61 6c 6c 79 20 70 65 72 66 6f 72 6d 65 64 2e 20 20 54 68 69 73 20 74 79 | are.actually.performed...This.ty |
| 1cee0 | 70 65 0a 6f 66 20 70 72 6f 63 65 73 73 2c 20 63 68 61 72 61 63 74 65 72 69 7a 65 64 20 62 79 20 | pe.of.process,.characterized.by. |
| 1cf00 | 61 20 63 68 61 69 6e 20 6f 66 20 64 65 66 65 72 72 65 64 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 | a.chain.of.deferred.operations,. |
| 1cf20 | 69 73 20 63 61 6c 6c 65 64 0a 61 20 22 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 22 2e | is.called.a."recursive.process". |
| 1cf40 | 20 20 43 61 72 72 79 69 6e 67 20 6f 75 74 20 74 68 69 73 20 70 72 6f 63 65 73 73 20 72 65 71 75 | ..Carrying.out.this.process.requ |
| 1cf60 | 69 72 65 73 20 74 68 61 74 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 72 20 6b 65 65 70 20 74 | ires.that.the.interpreter.keep.t |
| 1cf80 | 72 61 63 6b 20 6f 66 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 6f 20 62 65 20 70 65 72 | rack.of.the.operations.to.be.per |
| 1cfa0 | 66 6f 72 6d 65 64 20 6c 61 74 65 72 20 6f 6e 2e 20 20 49 6e 0a 74 68 65 20 63 6f 6d 70 75 74 61 | formed.later.on...In.the.computa |
| 1cfc0 | 74 69 6f 6e 20 6f 66 20 6e 21 2c 20 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 63 68 | tion.of.n!,.the.length.of.the.ch |
| 1cfe0 | 61 69 6e 20 6f 66 20 64 65 66 65 72 72 65 64 0a 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 2c | ain.of.deferred.multiplications, |
| 1d000 | 20 61 6e 64 20 68 65 6e 63 65 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66 20 69 6e 66 6f 72 6d 61 | .and.hence.the.amount.of.informa |
| 1d020 | 74 69 6f 6e 20 6e 65 65 64 65 64 20 74 6f 20 6b 65 65 70 0a 74 72 61 63 6b 20 6f 66 20 69 74 2c | tion.needed.to.keep.track.of.it, |
| 1d040 | 20 67 72 6f 77 73 20 6c 69 6e 65 61 72 6c 79 20 77 69 74 68 20 6e 20 28 69 73 20 70 72 6f 70 6f | .grows.linearly.with.n.(is.propo |
| 1d060 | 72 74 69 6f 6e 61 6c 20 74 6f 20 6e 29 2c 20 6a 75 73 74 20 6c 69 6b 65 0a 74 68 65 20 6e 75 6d | rtional.to.n),.just.like.the.num |
| 1d080 | 62 65 72 20 6f 66 20 73 74 65 70 73 2e 20 20 53 75 63 68 20 61 20 70 72 6f 63 65 73 73 20 69 73 | ber.of.steps...Such.a.process.is |
| 1d0a0 | 20 63 61 6c 6c 65 64 20 61 20 22 6c 69 6e 65 61 72 20 72 65 63 75 72 73 69 76 65 0a 70 72 6f 63 | .called.a."linear.recursive.proc |
| 1d0c0 | 65 73 73 22 2e 0a 0a 20 20 20 42 79 20 63 6f 6e 74 72 61 73 74 2c 20 74 68 65 20 73 65 63 6f 6e | ess"......By.contrast,.the.secon |
| 1d0e0 | 64 20 70 72 6f 63 65 73 73 20 64 6f 65 73 20 6e 6f 74 20 67 72 6f 77 20 61 6e 64 20 73 68 72 69 | d.process.does.not.grow.and.shri |
| 1d100 | 6e 6b 2e 20 20 41 74 20 65 61 63 68 0a 73 74 65 70 2c 20 61 6c 6c 20 77 65 20 6e 65 65 64 20 74 | nk...At.each.step,.all.we.need.t |
| 1d120 | 6f 20 6b 65 65 70 20 74 72 61 63 6b 20 6f 66 2c 20 66 6f 72 20 61 6e 79 20 6e 2c 20 61 72 65 20 | o.keep.track.of,.for.any.n,.are. |
| 1d140 | 74 68 65 20 63 75 72 72 65 6e 74 20 76 61 6c 75 65 73 0a 6f 66 20 74 68 65 20 76 61 72 69 61 62 | the.current.values.of.the.variab |
| 1d160 | 6c 65 73 20 60 70 72 6f 64 75 63 74 27 2c 20 60 63 6f 75 6e 74 65 72 27 2c 20 61 6e 64 20 60 6d | les.`product',.`counter',.and.`m |
| 1d180 | 61 78 2d 63 6f 75 6e 74 27 2e 20 20 57 65 20 63 61 6c 6c 20 74 68 69 73 20 61 6e 20 22 69 74 65 | ax-count'...We.call.this.an."ite |
| 1d1a0 | 72 61 74 69 76 65 0a 70 72 6f 63 65 73 73 22 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 61 6e | rative.process"...In.general,.an |
| 1d1c0 | 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 20 69 73 20 6f 6e 65 20 77 68 6f 73 65 20 | .iterative.process.is.one.whose. |
| 1d1e0 | 73 74 61 74 65 20 63 61 6e 20 62 65 0a 73 75 6d 6d 61 72 69 7a 65 64 20 62 79 20 61 20 66 69 78 | state.can.be.summarized.by.a.fix |
| 1d200 | 65 64 20 6e 75 6d 62 65 72 20 6f 66 20 22 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 22 2c 20 | ed.number.of."state.variables",. |
| 1d220 | 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 0a 66 69 78 65 64 20 72 75 6c 65 20 74 68 61 74 20 | together.with.a.fixed.rule.that. |
| 1d240 | 64 65 73 63 72 69 62 65 73 20 68 6f 77 20 74 68 65 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 | describes.how.the.state.variable |
| 1d260 | 73 20 73 68 6f 75 6c 64 20 62 65 20 75 70 64 61 74 65 64 20 61 73 0a 74 68 65 20 70 72 6f 63 65 | s.should.be.updated.as.the.proce |
| 1d280 | 73 73 20 6d 6f 76 65 73 20 66 72 6f 6d 20 73 74 61 74 65 20 74 6f 20 73 74 61 74 65 20 61 6e 64 | ss.moves.from.state.to.state.and |
| 1d2a0 | 20 61 6e 20 28 6f 70 74 69 6f 6e 61 6c 29 20 65 6e 64 20 74 65 73 74 20 74 68 61 74 0a 73 70 65 | .an.(optional).end.test.that.spe |
| 1d2c0 | 63 69 66 69 65 73 20 63 6f 6e 64 69 74 69 6f 6e 73 20 75 6e 64 65 72 20 77 68 69 63 68 20 74 68 | cifies.conditions.under.which.th |
| 1d2e0 | 65 20 70 72 6f 63 65 73 73 20 73 68 6f 75 6c 64 20 74 65 72 6d 69 6e 61 74 65 2e 20 20 49 6e 0a | e.process.should.terminate...In. |
| 1d300 | 63 6f 6d 70 75 74 69 6e 67 20 6e 21 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 | computing.n!,.the.number.of.step |
| 1d320 | 73 20 72 65 71 75 69 72 65 64 20 67 72 6f 77 73 20 6c 69 6e 65 61 72 6c 79 20 77 69 74 68 20 6e | s.required.grows.linearly.with.n |
| 1d340 | 2e 20 20 53 75 63 68 0a 61 20 70 72 6f 63 65 73 73 20 69 73 20 63 61 6c 6c 65 64 20 61 20 22 6c | ...Such.a.process.is.called.a."l |
| 1d360 | 69 6e 65 61 72 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 22 2e 0a 0a 20 20 20 54 68 | inear.iterative.process"......Th |
| 1d380 | 65 20 63 6f 6e 74 72 61 73 74 20 62 65 74 77 65 65 6e 20 74 68 65 20 74 77 6f 20 70 72 6f 63 65 | e.contrast.between.the.two.proce |
| 1d3a0 | 73 73 65 73 20 63 61 6e 20 62 65 20 73 65 65 6e 20 69 6e 20 61 6e 6f 74 68 65 72 20 77 61 79 2e | sses.can.be.seen.in.another.way. |
| 1d3c0 | 0a 49 6e 20 74 68 65 20 69 74 65 72 61 74 69 76 65 20 63 61 73 65 2c 20 74 68 65 20 70 72 6f 67 | .In.the.iterative.case,.the.prog |
| 1d3e0 | 72 61 6d 20 76 61 72 69 61 62 6c 65 73 20 70 72 6f 76 69 64 65 20 61 20 63 6f 6d 70 6c 65 74 65 | ram.variables.provide.a.complete |
| 1d400 | 0a 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 74 68 65 | .description.of.the.state.of.the |
| 1d420 | 20 70 72 6f 63 65 73 73 20 61 74 20 61 6e 79 20 70 6f 69 6e 74 2e 20 20 49 66 20 77 65 20 73 74 | .process.at.any.point...If.we.st |
| 1d440 | 6f 70 70 65 64 0a 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 73 74 | opped.the.computation.between.st |
| 1d460 | 65 70 73 2c 20 61 6c 6c 20 77 65 20 77 6f 75 6c 64 20 6e 65 65 64 20 74 6f 20 64 6f 20 74 6f 20 | eps,.all.we.would.need.to.do.to. |
| 1d480 | 72 65 73 75 6d 65 20 74 68 65 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 20 69 73 20 74 6f 20 73 75 70 | resume.the.computation.is.to.sup |
| 1d4a0 | 70 6c 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 77 69 74 68 20 74 68 65 20 76 61 6c | ply.the.interpreter.with.the.val |
| 1d4c0 | 75 65 73 20 6f 66 20 74 68 65 20 74 68 72 65 65 0a 70 72 6f 67 72 61 6d 20 76 61 72 69 61 62 6c | ues.of.the.three.program.variabl |
| 1d4e0 | 65 73 2e 20 20 4e 6f 74 20 73 6f 20 77 69 74 68 20 74 68 65 20 72 65 63 75 72 73 69 76 65 20 70 | es...Not.so.with.the.recursive.p |
| 1d500 | 72 6f 63 65 73 73 2e 20 20 49 6e 20 74 68 69 73 20 63 61 73 65 0a 74 68 65 72 65 20 69 73 20 73 | rocess...In.this.case.there.is.s |
| 1d520 | 6f 6d 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 22 68 69 64 64 65 6e 22 20 69 6e 66 6f 72 6d 61 74 | ome.additional."hidden".informat |
| 1d540 | 69 6f 6e 2c 20 6d 61 69 6e 74 61 69 6e 65 64 20 62 79 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 | ion,.maintained.by.the.interpret |
| 1d560 | 65 72 20 61 6e 64 20 6e 6f 74 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 20 74 68 65 20 70 72 6f 67 | er.and.not.contained.in.the.prog |
| 1d580 | 72 61 6d 20 76 61 72 69 61 62 6c 65 73 2c 20 77 68 69 63 68 20 69 6e 64 69 63 61 74 65 73 0a 22 | ram.variables,.which.indicates." |
| 1d5a0 | 77 68 65 72 65 20 74 68 65 20 70 72 6f 63 65 73 73 20 69 73 22 20 69 6e 20 6e 65 67 6f 74 69 61 | where.the.process.is".in.negotia |
| 1d5c0 | 74 69 6e 67 20 74 68 65 20 63 68 61 69 6e 20 6f 66 20 64 65 66 65 72 72 65 64 20 6f 70 65 72 61 | ting.the.chain.of.deferred.opera |
| 1d5e0 | 74 69 6f 6e 73 2e 0a 54 68 65 20 6c 6f 6e 67 65 72 20 74 68 65 20 63 68 61 69 6e 2c 20 74 68 65 | tions..The.longer.the.chain,.the |
| 1d600 | 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6d 75 73 74 20 62 65 20 6d 61 69 6e 74 61 | .more.information.must.be.mainta |
| 1d620 | 69 6e 65 64 2e 28 32 29 0a 0a 20 20 20 49 6e 20 63 6f 6e 74 72 61 73 74 69 6e 67 20 69 74 65 72 | ined.(2).....In.contrasting.iter |
| 1d640 | 61 74 69 6f 6e 20 61 6e 64 20 72 65 63 75 72 73 69 6f 6e 2c 20 77 65 20 6d 75 73 74 20 62 65 20 | ation.and.recursion,.we.must.be. |
| 1d660 | 63 61 72 65 66 75 6c 20 6e 6f 74 20 74 6f 0a 63 6f 6e 66 75 73 65 20 74 68 65 20 6e 6f 74 69 6f | careful.not.to.confuse.the.notio |
| 1d680 | 6e 20 6f 66 20 61 20 72 65 63 75 72 73 69 76 65 20 22 70 72 6f 63 65 73 73 22 20 77 69 74 68 20 | n.of.a.recursive."process".with. |
| 1d6a0 | 74 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 20 61 0a 72 65 63 75 72 73 69 76 65 20 22 70 72 6f 63 65 | the.notion.of.a.recursive."proce |
| 1d6c0 | 64 75 72 65 22 2e 20 20 57 68 65 6e 20 77 65 20 64 65 73 63 72 69 62 65 20 61 20 70 72 6f 63 65 | dure"...When.we.describe.a.proce |
| 1d6e0 | 64 75 72 65 20 61 73 20 72 65 63 75 72 73 69 76 65 2c 20 77 65 0a 61 72 65 20 72 65 66 65 72 72 | dure.as.recursive,.we.are.referr |
| 1d700 | 69 6e 67 20 74 6f 20 74 68 65 20 73 79 6e 74 61 63 74 69 63 20 66 61 63 74 20 74 68 61 74 20 74 | ing.to.the.syntactic.fact.that.t |
| 1d720 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 0a 72 65 66 65 72 73 20 28 | he.procedure.definition.refers.( |
| 1d740 | 65 69 74 68 65 72 20 64 69 72 65 63 74 6c 79 20 6f 72 20 69 6e 64 69 72 65 63 74 6c 79 29 20 74 | either.directly.or.indirectly).t |
| 1d760 | 6f 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 74 73 65 6c 66 2e 20 20 42 75 74 0a 77 68 65 | o.the.procedure.itself...But.whe |
| 1d780 | 6e 20 77 65 20 64 65 73 63 72 69 62 65 20 61 20 70 72 6f 63 65 73 73 20 61 73 20 66 6f 6c 6c 6f | n.we.describe.a.process.as.follo |
| 1d7a0 | 77 69 6e 67 20 61 20 70 61 74 74 65 72 6e 20 74 68 61 74 20 69 73 2c 20 73 61 79 2c 0a 6c 69 6e | wing.a.pattern.that.is,.say,.lin |
| 1d7c0 | 65 61 72 6c 79 20 72 65 63 75 72 73 69 76 65 2c 20 77 65 20 61 72 65 20 73 70 65 61 6b 69 6e 67 | early.recursive,.we.are.speaking |
| 1d7e0 | 20 61 62 6f 75 74 20 68 6f 77 20 74 68 65 20 70 72 6f 63 65 73 73 20 65 76 6f 6c 76 65 73 2c 20 | .about.how.the.process.evolves,. |
| 1d800 | 6e 6f 74 0a 61 62 6f 75 74 20 74 68 65 20 73 79 6e 74 61 78 20 6f 66 20 68 6f 77 20 61 20 70 72 | not.about.the.syntax.of.how.a.pr |
| 1d820 | 6f 63 65 64 75 72 65 20 69 73 20 77 72 69 74 74 65 6e 2e 20 20 49 74 20 6d 61 79 20 73 65 65 6d | ocedure.is.written...It.may.seem |
| 1d840 | 20 64 69 73 74 75 72 62 69 6e 67 0a 74 68 61 74 20 77 65 20 72 65 66 65 72 20 74 6f 20 61 20 72 | .disturbing.that.we.refer.to.a.r |
| 1d860 | 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 73 75 63 68 20 61 73 20 60 66 61 63 74 | ecursive.procedure.such.as.`fact |
| 1d880 | 2d 69 74 65 72 27 20 61 73 0a 67 65 6e 65 72 61 74 69 6e 67 20 61 6e 20 69 74 65 72 61 74 69 76 | -iter'.as.generating.an.iterativ |
| 1d8a0 | 65 20 70 72 6f 63 65 73 73 2e 20 20 48 6f 77 65 76 65 72 2c 20 74 68 65 20 70 72 6f 63 65 73 73 | e.process...However,.the.process |
| 1d8c0 | 20 72 65 61 6c 6c 79 20 69 73 0a 69 74 65 72 61 74 69 76 65 3a 20 49 74 73 20 73 74 61 74 65 20 | .really.is.iterative:.Its.state. |
| 1d8e0 | 69 73 20 63 61 70 74 75 72 65 64 20 63 6f 6d 70 6c 65 74 65 6c 79 20 62 79 20 69 74 73 20 74 68 | is.captured.completely.by.its.th |
| 1d900 | 72 65 65 20 73 74 61 74 65 0a 76 61 72 69 61 62 6c 65 73 2c 20 61 6e 64 20 61 6e 20 69 6e 74 65 | ree.state.variables,.and.an.inte |
| 1d920 | 72 70 72 65 74 65 72 20 6e 65 65 64 20 6b 65 65 70 20 74 72 61 63 6b 20 6f 66 20 6f 6e 6c 79 20 | rpreter.need.keep.track.of.only. |
| 1d940 | 74 68 72 65 65 20 76 61 72 69 61 62 6c 65 73 0a 69 6e 20 6f 72 64 65 72 20 74 6f 20 65 78 65 63 | three.variables.in.order.to.exec |
| 1d960 | 75 74 65 20 74 68 65 20 70 72 6f 63 65 73 73 2e 0a 0a 20 20 20 4f 6e 65 20 72 65 61 73 6f 6e 20 | ute.the.process......One.reason. |
| 1d980 | 74 68 61 74 20 74 68 65 20 64 69 73 74 69 6e 63 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 70 72 6f | that.the.distinction.between.pro |
| 1d9a0 | 63 65 73 73 20 61 6e 64 20 70 72 6f 63 65 64 75 72 65 20 6d 61 79 20 62 65 0a 63 6f 6e 66 75 73 | cess.and.procedure.may.be.confus |
| 1d9c0 | 69 6e 67 20 69 73 20 74 68 61 74 20 6d 6f 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 | ing.is.that.most.implementations |
| 1d9e0 | 20 6f 66 20 63 6f 6d 6d 6f 6e 20 6c 61 6e 67 75 61 67 65 73 20 28 69 6e 63 6c 75 64 69 6e 67 0a | .of.common.languages.(including. |
| 1da00 | 41 64 61 2c 20 50 61 73 63 61 6c 2c 20 61 6e 64 20 43 29 20 61 72 65 20 64 65 73 69 67 6e 65 64 | Ada,.Pascal,.and.C).are.designed |
| 1da20 | 20 69 6e 20 73 75 63 68 20 61 20 77 61 79 20 74 68 61 74 20 74 68 65 20 69 6e 74 65 72 70 72 65 | .in.such.a.way.that.the.interpre |
| 1da40 | 74 61 74 69 6f 6e 0a 6f 66 20 61 6e 79 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 64 75 72 | tation.of.any.recursive.procedur |
| 1da60 | 65 20 63 6f 6e 73 75 6d 65 73 20 61 6e 20 61 6d 6f 75 6e 74 20 6f 66 20 6d 65 6d 6f 72 79 20 74 | e.consumes.an.amount.of.memory.t |
| 1da80 | 68 61 74 20 67 72 6f 77 73 20 77 69 74 68 0a 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 72 6f | hat.grows.with.the.number.of.pro |
| 1daa0 | 63 65 64 75 72 65 20 63 61 6c 6c 73 2c 20 65 76 65 6e 20 77 68 65 6e 20 74 68 65 20 70 72 6f 63 | cedure.calls,.even.when.the.proc |
| 1dac0 | 65 73 73 20 64 65 73 63 72 69 62 65 64 20 69 73 2c 20 69 6e 0a 70 72 69 6e 63 69 70 6c 65 2c 20 | ess.described.is,.in.principle,. |
| 1dae0 | 69 74 65 72 61 74 69 76 65 2e 20 20 41 73 20 61 20 63 6f 6e 73 65 71 75 65 6e 63 65 2c 20 74 68 | iterative...As.a.consequence,.th |
| 1db00 | 65 73 65 20 6c 61 6e 67 75 61 67 65 73 20 63 61 6e 20 64 65 73 63 72 69 62 65 0a 69 74 65 72 61 | ese.languages.can.describe.itera |
| 1db20 | 74 69 76 65 20 70 72 6f 63 65 73 73 65 73 20 6f 6e 6c 79 20 62 79 20 72 65 73 6f 72 74 69 6e 67 | tive.processes.only.by.resorting |
| 1db40 | 20 74 6f 20 73 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 22 6c 6f 6f 70 69 6e 67 0a 63 6f 6e | .to.special-purpose."looping.con |
| 1db60 | 73 74 72 75 63 74 73 22 20 73 75 63 68 20 61 73 20 60 64 6f 27 2c 20 60 72 65 70 65 61 74 27 2c | structs".such.as.`do',.`repeat', |
| 1db80 | 20 60 75 6e 74 69 6c 27 2c 20 60 66 6f 72 27 2c 20 61 6e 64 20 60 77 68 69 6c 65 27 2e 20 20 54 | .`until',.`for',.and.`while'...T |
| 1dba0 | 68 65 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 53 63 68 65 6d 65 20 77 65 20 73 | he.implementation.of.Scheme.we.s |
| 1dbc0 | 68 61 6c 6c 20 63 6f 6e 73 69 64 65 72 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 35 | hall.consider.in.*Note.Chapter.5 |
| 1dbe0 | 3a 3a 20 64 6f 65 73 0a 6e 6f 74 20 73 68 61 72 65 20 74 68 69 73 20 64 65 66 65 63 74 2e 20 20 | ::.does.not.share.this.defect... |
| 1dc00 | 49 74 20 77 69 6c 6c 20 65 78 65 63 75 74 65 20 61 6e 20 69 74 65 72 61 74 69 76 65 20 70 72 6f | It.will.execute.an.iterative.pro |
| 1dc20 | 63 65 73 73 20 69 6e 0a 63 6f 6e 73 74 61 6e 74 20 73 70 61 63 65 2c 20 65 76 65 6e 20 69 66 20 | cess.in.constant.space,.even.if. |
| 1dc40 | 74 68 65 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 20 69 73 20 64 65 73 63 72 69 62 | the.iterative.process.is.describ |
| 1dc60 | 65 64 20 62 79 20 61 0a 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 64 75 72 65 2e 20 20 41 6e | ed.by.a.recursive.procedure...An |
| 1dc80 | 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 77 69 74 68 20 74 68 69 73 20 70 72 6f 70 65 72 | .implementation.with.this.proper |
| 1dca0 | 74 79 20 69 73 20 63 61 6c 6c 65 64 20 22 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 22 2e 0a 57 | ty.is.called."tail-recursive"..W |
| 1dcc0 | 69 74 68 20 61 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 | ith.a.tail-recursive.implementat |
| 1dce0 | 69 6f 6e 2c 20 69 74 65 72 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 65 78 70 72 65 73 73 65 64 20 | ion,.iteration.can.be.expressed. |
| 1dd00 | 75 73 69 6e 67 0a 74 68 65 20 6f 72 64 69 6e 61 72 79 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c | using.the.ordinary.procedure.cal |
| 1dd20 | 6c 20 6d 65 63 68 61 6e 69 73 6d 2c 20 73 6f 20 74 68 61 74 20 73 70 65 63 69 61 6c 20 69 74 65 | l.mechanism,.so.that.special.ite |
| 1dd40 | 72 61 74 69 6f 6e 0a 63 6f 6e 73 74 72 75 63 74 73 20 61 72 65 20 75 73 65 66 75 6c 20 6f 6e 6c | ration.constructs.are.useful.onl |
| 1dd60 | 79 20 61 73 20 73 79 6e 74 61 63 74 69 63 20 73 75 67 61 72 2e 28 33 29 0a 0a 20 20 20 20 20 2a | y.as.syntactic.sugar.(3).......* |
| 1dd80 | 45 78 65 72 63 69 73 65 20 31 2e 39 3a 2a 20 45 61 63 68 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f | Exercise.1.9:*.Each.of.the.follo |
| 1dda0 | 77 69 6e 67 20 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 20 64 65 66 69 6e 65 73 20 61 0a 20 20 | wing.two.procedures.defines.a... |
| 1ddc0 | 20 20 20 6d 65 74 68 6f 64 20 66 6f 72 20 61 64 64 69 6e 67 20 74 77 6f 20 70 6f 73 69 74 69 76 | ...method.for.adding.two.positiv |
| 1dde0 | 65 20 69 6e 74 65 67 65 72 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 70 72 6f 63 65 | e.integers.in.terms.of.the.proce |
| 1de00 | 64 75 72 65 73 0a 20 20 20 20 20 60 69 6e 63 27 2c 20 77 68 69 63 68 20 69 6e 63 72 65 6d 65 6e | dures......`inc',.which.incremen |
| 1de20 | 74 73 20 69 74 73 20 61 72 67 75 6d 65 6e 74 20 62 79 20 31 2c 20 61 6e 64 20 60 64 65 63 27 2c | ts.its.argument.by.1,.and.`dec', |
| 1de40 | 20 77 68 69 63 68 0a 20 20 20 20 20 64 65 63 72 65 6d 65 6e 74 73 20 69 74 73 20 61 72 67 75 6d | .which......decrements.its.argum |
| 1de60 | 65 6e 74 20 62 79 20 31 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 2b 20 | ent.by.1.............(define.(+. |
| 1de80 | 61 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 61 20 30 29 0a 20 20 20 | a.b).............(if.(=.a.0).... |
| 1dea0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 62 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .............b.................( |
| 1dec0 | 69 6e 63 20 28 2b 20 28 64 65 63 20 61 29 20 62 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 | inc.(+.(dec.a).b))))............ |
| 1dee0 | 28 64 65 66 69 6e 65 20 28 2b 20 61 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 | (define.(+.a.b).............(if. |
| 1df00 | 28 3d 20 61 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 0a 20 20 20 20 20 20 | (=.a.0).................b....... |
| 1df20 | 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 64 65 63 20 61 29 20 28 69 6e 63 20 62 29 29 29 29 0a | ..........(+.(dec.a).(inc.b)))). |
| 1df40 | 0a 20 20 20 20 20 55 73 69 6e 67 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 | ......Using.the.substitution.mod |
| 1df60 | 65 6c 2c 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 65 20 70 72 6f 63 65 73 73 20 67 65 6e 65 72 | el,.illustrate.the.process.gener |
| 1df80 | 61 74 65 64 20 62 79 0a 20 20 20 20 20 65 61 63 68 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 65 | ated.by......each.procedure.in.e |
| 1dfa0 | 76 61 6c 75 61 74 69 6e 67 20 60 28 2b 20 34 20 35 29 27 2e 20 20 41 72 65 20 74 68 65 73 65 20 | valuating.`(+.4.5)'...Are.these. |
| 1dfc0 | 70 72 6f 63 65 73 73 65 73 0a 20 20 20 20 20 69 74 65 72 61 74 69 76 65 20 6f 72 20 72 65 63 75 | processes......iterative.or.recu |
| 1dfe0 | 72 73 69 76 65 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 31 30 3a 2a 20 54 68 | rsive?.......*Exercise.1.10:*.Th |
| 1e000 | 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 63 6f 6d 70 75 74 65 73 20 61 | e.following.procedure.computes.a |
| 1e020 | 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 0a 20 20 20 20 20 66 75 6e 63 74 69 6f 6e 20 63 61 6c 6c | .mathematical......function.call |
| 1e040 | 65 64 20 41 63 6b 65 72 6d 61 6e 6e 27 73 20 66 75 6e 63 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 20 | ed.Ackermann's.function......... |
| 1e060 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 41 20 78 20 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ....(define.(A.x.y)............. |
| 1e080 | 28 63 6f 6e 64 20 28 28 3d 20 79 20 30 29 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (cond.((=.y.0).0)............... |
| 1e0a0 | 20 20 20 20 28 28 3d 20 78 20 30 29 20 28 2a 20 32 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 | ....((=.x.0).(*.2.y))........... |
| 1e0c0 | 20 20 20 20 20 20 20 20 28 28 3d 20 79 20 31 29 20 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ........((=.y.1).2)............. |
| 1e0e0 | 20 20 20 20 20 20 28 65 6c 73 65 20 28 41 20 28 2d 20 78 20 31 29 0a 20 20 20 20 20 20 20 20 20 | ......(else.(A.(-.x.1).......... |
| 1e100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 41 20 78 20 28 2d 20 79 20 31 29 29 29 | ..................(A.x.(-.y.1))) |
| 1e120 | 29 29 29 0a 0a 20 20 20 20 20 57 68 61 74 20 61 72 65 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 | ))).......What.are.the.values.of |
| 1e140 | 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 3f 0a 0a 20 20 20 | .the.following.expressions?..... |
| 1e160 | 20 20 20 20 20 20 20 28 41 20 31 20 31 30 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 41 20 32 20 | .......(A.1.10)............(A.2. |
| 1e180 | 34 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 41 20 33 20 33 29 0a 0a 20 20 20 20 20 43 6f 6e 73 | 4)............(A.3.3).......Cons |
| 1e1a0 | 69 64 65 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 2c 20 77 | ider.the.following.procedures,.w |
| 1e1c0 | 68 65 72 65 20 60 41 27 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 64 | here.`A'.is.the.procedure......d |
| 1e1e0 | 65 66 69 6e 65 64 20 61 62 6f 76 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | efined.above:............(define |
| 1e200 | 20 28 66 20 6e 29 20 28 41 20 30 20 6e 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 | .(f.n).(A.0.n))............(defi |
| 1e220 | 6e 65 20 28 67 20 6e 29 20 28 41 20 31 20 6e 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | ne.(g.n).(A.1.n))............(de |
| 1e240 | 66 69 6e 65 20 28 68 20 6e 29 20 28 41 20 32 20 6e 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 | fine.(h.n).(A.2.n))............( |
| 1e260 | 64 65 66 69 6e 65 20 28 6b 20 6e 29 20 28 2a 20 35 20 6e 20 6e 29 29 0a 0a 20 20 20 20 20 47 69 | define.(k.n).(*.5.n.n)).......Gi |
| 1e280 | 76 65 20 63 6f 6e 63 69 73 65 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 64 65 66 69 6e 69 74 69 | ve.concise.mathematical.definiti |
| 1e2a0 | 6f 6e 73 20 66 6f 72 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 73 20 63 6f 6d 70 75 74 65 64 0a 20 | ons.for.the.functions.computed.. |
| 1e2c0 | 20 20 20 20 62 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 66 27 2c 20 60 67 27 2c 20 | ....by.the.procedures.`f',.`g',. |
| 1e2e0 | 61 6e 64 20 60 68 27 20 66 6f 72 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 20 76 61 6c | and.`h'.for.positive.integer.val |
| 1e300 | 75 65 73 20 6f 66 0a 20 20 20 20 20 6e 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 60 28 6b | ues.of......n...For.example,.`(k |
| 1e320 | 20 6e 29 27 20 63 6f 6d 70 75 74 65 73 20 35 6e 5e 32 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d | .n)'.computes.5n^2......-------- |
| 1e340 | 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 | --.Footnotes.----------.....(1). |
| 1e360 | 49 6e 20 61 20 72 65 61 6c 20 70 72 6f 67 72 61 6d 20 77 65 20 77 6f 75 6c 64 20 70 72 6f 62 61 | In.a.real.program.we.would.proba |
| 1e380 | 62 6c 79 20 75 73 65 20 74 68 65 20 62 6c 6f 63 6b 20 73 74 72 75 63 74 75 72 65 0a 69 6e 74 72 | bly.use.the.block.structure.intr |
| 1e3a0 | 6f 64 75 63 65 64 20 69 6e 20 74 68 65 20 6c 61 73 74 20 73 65 63 74 69 6f 6e 20 74 6f 20 68 69 | oduced.in.the.last.section.to.hi |
| 1e3c0 | 64 65 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 66 61 63 74 2d 69 74 65 72 27 | de.the.definition.of.`fact-iter' |
| 1e3e0 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 | :.......(define.(factorial.n)... |
| 1e400 | 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 20 70 72 6f 64 75 63 74 | ...........(define.(iter.product |
| 1e420 | 20 63 6f 75 6e 74 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .counter)......................( |
| 1e440 | 69 66 20 28 3e 20 63 6f 75 6e 74 65 72 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | if.(>.counter.n)................ |
| 1e460 | 20 20 20 20 20 20 20 20 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..........product............... |
| 1e480 | 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 28 2a 20 63 6f 75 6e 74 65 72 20 70 72 6f 64 | ...........(iter.(*.counter.prod |
| 1e4a0 | 75 63 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | uct)............................ |
| 1e4c0 | 20 20 20 20 28 2b 20 63 6f 75 6e 74 65 72 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ....(+.counter.1))))............ |
| 1e4e0 | 20 20 28 69 74 65 72 20 31 20 31 29 29 0a 0a 20 20 20 57 65 20 61 76 6f 69 64 65 64 20 64 6f 69 | ..(iter.1.1)).....We.avoided.doi |
| 1e500 | 6e 67 20 74 68 69 73 20 68 65 72 65 20 73 6f 20 61 73 20 74 6f 20 6d 69 6e 69 6d 69 7a 65 20 74 | ng.this.here.so.as.to.minimize.t |
| 1e520 | 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 0a 74 68 69 6e 6b 20 61 62 6f | he.number.of.things.to.think.abo |
| 1e540 | 75 74 20 61 74 20 6f 6e 63 65 2e 0a 0a 20 20 20 28 32 29 20 57 68 65 6e 20 77 65 20 64 69 73 63 | ut.at.once......(2).When.we.disc |
| 1e560 | 75 73 73 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 72 6f 63 65 64 | uss.the.implementation.of.proced |
| 1e580 | 75 72 65 73 20 6f 6e 20 72 65 67 69 73 74 65 72 0a 6d 61 63 68 69 6e 65 73 20 69 6e 20 2a 4e 6f | ures.on.register.machines.in.*No |
| 1e5a0 | 74 65 20 43 68 61 70 74 65 72 20 35 3a 3a 2c 20 77 65 20 77 69 6c 6c 20 73 65 65 20 74 68 61 74 | te.Chapter.5::,.we.will.see.that |
| 1e5c0 | 20 61 6e 79 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 0a 63 61 6e 20 62 65 20 72 65 | .any.iterative.process.can.be.re |
| 1e5e0 | 61 6c 69 7a 65 64 20 22 69 6e 20 68 61 72 64 77 61 72 65 22 20 61 73 20 61 20 6d 61 63 68 69 6e | alized."in.hardware".as.a.machin |
| 1e600 | 65 20 74 68 61 74 20 68 61 73 20 61 20 66 69 78 65 64 20 73 65 74 20 6f 66 0a 72 65 67 69 73 74 | e.that.has.a.fixed.set.of.regist |
| 1e620 | 65 72 73 20 61 6e 64 20 6e 6f 20 61 75 78 69 6c 69 61 72 79 20 6d 65 6d 6f 72 79 2e 20 20 49 6e | ers.and.no.auxiliary.memory...In |
| 1e640 | 20 63 6f 6e 74 72 61 73 74 2c 20 72 65 61 6c 69 7a 69 6e 67 20 61 20 72 65 63 75 72 73 69 76 65 | .contrast,.realizing.a.recursive |
| 1e660 | 0a 70 72 6f 63 65 73 73 20 72 65 71 75 69 72 65 73 20 61 20 6d 61 63 68 69 6e 65 20 74 68 61 74 | .process.requires.a.machine.that |
| 1e680 | 20 75 73 65 73 20 61 6e 20 61 75 78 69 6c 69 61 72 79 20 64 61 74 61 20 73 74 72 75 63 74 75 72 | .uses.an.auxiliary.data.structur |
| 1e6a0 | 65 20 6b 6e 6f 77 6e 0a 61 73 20 61 20 22 73 74 61 63 6b 22 2e 0a 0a 20 20 20 28 33 29 20 54 61 | e.known.as.a."stack"......(3).Ta |
| 1e6c0 | 69 6c 20 72 65 63 75 72 73 69 6f 6e 20 68 61 73 20 6c 6f 6e 67 20 62 65 65 6e 20 6b 6e 6f 77 6e | il.recursion.has.long.been.known |
| 1e6e0 | 20 61 73 20 61 20 63 6f 6d 70 69 6c 65 72 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 0a 74 72 69 63 | .as.a.compiler.optimization.tric |
| 1e700 | 6b 2e 20 20 41 20 63 6f 68 65 72 65 6e 74 20 73 65 6d 61 6e 74 69 63 20 62 61 73 69 73 20 66 6f | k...A.coherent.semantic.basis.fo |
| 1e720 | 72 20 74 61 69 6c 20 72 65 63 75 72 73 69 6f 6e 20 77 61 73 20 70 72 6f 76 69 64 65 64 20 62 79 | r.tail.recursion.was.provided.by |
| 1e740 | 0a 43 61 72 6c 20 48 65 77 69 74 74 20 28 31 39 37 37 29 2c 20 77 68 6f 20 65 78 70 6c 61 69 6e | .Carl.Hewitt.(1977),.who.explain |
| 1e760 | 65 64 20 69 74 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 22 6d 65 73 73 61 67 65 2d 70 | ed.it.in.terms.of.the."message-p |
| 1e780 | 61 73 73 69 6e 67 22 0a 6d 6f 64 65 6c 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 74 68 61 | assing".model.of.computation.tha |
| 1e7a0 | 74 20 77 65 20 73 68 61 6c 6c 20 64 69 73 63 75 73 73 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 | t.we.shall.discuss.in.*Note.Chap |
| 1e7c0 | 74 65 72 20 33 3a 3a 2e 0a 49 6e 73 70 69 72 65 64 20 62 79 20 74 68 69 73 2c 20 47 65 72 61 6c | ter.3::..Inspired.by.this,.Geral |
| 1e7e0 | 64 20 4a 61 79 20 53 75 73 73 6d 61 6e 20 61 6e 64 20 47 75 79 20 4c 65 77 69 73 20 53 74 65 65 | d.Jay.Sussman.and.Guy.Lewis.Stee |
| 1e800 | 6c 65 20 4a 72 2e 20 28 73 65 65 0a 53 74 65 65 6c 65 20 31 39 37 35 29 20 63 6f 6e 73 74 72 75 | le.Jr..(see.Steele.1975).constru |
| 1e820 | 63 74 65 64 20 61 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 20 69 6e 74 65 72 70 72 65 74 65 | cted.a.tail-recursive.interprete |
| 1e840 | 72 20 66 6f 72 20 53 63 68 65 6d 65 2e 0a 53 74 65 65 6c 65 20 6c 61 74 65 72 20 73 68 6f 77 65 | r.for.Scheme..Steele.later.showe |
| 1e860 | 64 20 68 6f 77 20 74 61 69 6c 20 72 65 63 75 72 73 69 6f 6e 20 69 73 20 61 20 63 6f 6e 73 65 71 | d.how.tail.recursion.is.a.conseq |
| 1e880 | 75 65 6e 63 65 20 6f 66 20 74 68 65 20 6e 61 74 75 72 61 6c 0a 77 61 79 20 74 6f 20 63 6f 6d 70 | uence.of.the.natural.way.to.comp |
| 1e8a0 | 69 6c 65 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 73 20 28 53 74 65 65 6c 65 20 31 39 37 37 | ile.procedure.calls.(Steele.1977 |
| 1e8c0 | 29 2e 20 20 54 68 65 20 49 45 45 45 20 73 74 61 6e 64 61 72 64 20 66 6f 72 0a 53 63 68 65 6d 65 | )...The.IEEE.standard.for.Scheme |
| 1e8e0 | 20 72 65 71 75 69 72 65 73 20 74 68 61 74 20 53 63 68 65 6d 65 20 69 6d 70 6c 65 6d 65 6e 74 61 | .requires.that.Scheme.implementa |
| 1e900 | 74 69 6f 6e 73 20 62 65 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 2e 0a 0a 1f 0a 46 69 6c 65 | tions.be.tail-recursive.....File |
| 1e920 | 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 32 2d 32 2c 20 20 4e 65 78 74 | :.sicp.info,..Node:.1-2-2,..Next |
| 1e940 | 3a 20 31 2d 32 2d 33 2c 20 20 50 72 65 76 3a 20 31 2d 32 2d 31 2c 20 20 55 70 3a 20 31 2d 32 0a | :.1-2-3,..Prev:.1-2-1,..Up:.1-2. |
| 1e960 | 0a 31 2e 32 2e 32 20 54 72 65 65 20 52 65 63 75 72 73 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .1.2.2.Tree.Recursion.---------- |
| 1e980 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 41 6e 6f 74 68 65 72 20 63 6f 6d 6d 6f 6e 20 70 61 74 74 65 | ----------..Another.common.patte |
| 1e9a0 | 72 6e 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 69 73 20 63 61 6c 6c 65 64 20 22 74 72 65 | rn.of.computation.is.called."tre |
| 1e9c0 | 65 20 72 65 63 75 72 73 69 6f 6e 22 2e 20 20 41 73 0a 61 6e 20 65 78 61 6d 70 6c 65 2c 20 63 6f | e.recursion"...As.an.example,.co |
| 1e9e0 | 6e 73 69 64 65 72 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 | nsider.computing.the.sequence.of |
| 1ea00 | 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 2c 20 69 6e 0a 77 68 69 63 68 20 65 61 63 | .Fibonacci.numbers,.in.which.eac |
| 1ea20 | 68 20 6e 75 6d 62 65 72 20 69 73 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 70 72 65 63 65 | h.number.is.the.sum.of.the.prece |
| 1ea40 | 64 69 6e 67 20 74 77 6f 3a 0a 0a 20 20 20 30 2c 20 31 2c 20 31 2c 20 32 2c 20 33 2c 20 34 2c 20 | ding.two:.....0,.1,.1,.2,.3,.4,. |
| 1ea60 | 38 2c 20 31 33 2c 20 32 31 2c 20 2e 2e 2e 0a 0a 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 74 | 8,.13,.21,.........In.general,.t |
| 1ea80 | 68 65 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 20 63 61 6e 20 62 65 20 64 65 66 69 | he.Fibonacci.numbers.can.be.defi |
| 1eaa0 | 6e 65 64 20 62 79 20 74 68 65 20 72 75 6c 65 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f | ned.by.the.rule................/ |
| 1eac0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...............|..0............. |
| 1eae0 | 20 20 20 20 20 20 20 20 20 20 20 69 66 20 6e 20 3d 20 30 0a 20 20 20 20 20 46 69 62 28 6e 29 20 | ...........if.n.=.0......Fib(n). |
| 1eb00 | 3d 20 3c 20 20 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 66 | =.<..1........................if |
| 1eb20 | 20 6e 20 3d 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 46 69 62 28 6e 20 2d 20 | .n.=.1...............|..Fib(n.-. |
| 1eb40 | 31 29 20 2b 20 46 69 62 28 6e 20 2d 20 32 29 20 20 6f 74 68 65 72 77 69 73 65 0a 20 20 20 20 20 | 1).+.Fib(n.-.2)..otherwise...... |
| 1eb60 | 20 20 20 20 20 20 20 20 20 5c 0a 0a 20 20 20 57 65 20 63 61 6e 20 69 6d 6d 65 64 69 61 74 65 6c | .........\.....We.can.immediatel |
| 1eb80 | 79 20 74 72 61 6e 73 6c 61 74 65 20 74 68 69 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 6e 74 6f | y.translate.this.definition.into |
| 1eba0 | 20 61 20 72 65 63 75 72 73 69 76 65 0a 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 63 6f 6d 70 75 | .a.recursive.procedure.for.compu |
| 1ebc0 | 74 69 6e 67 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 3a 0a 0a 20 20 20 20 20 28 64 | ting.Fibonacci.numbers:.......(d |
| 1ebe0 | 65 66 69 6e 65 20 28 66 69 62 20 6e 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d 20 6e | efine.(fib.n)........(cond.((=.n |
| 1ec00 | 20 30 29 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 20 6e 20 31 29 20 31 29 0a | .0).0)..............((=.n.1).1). |
| 1ec20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 2b 20 28 66 69 62 20 28 2d 20 6e 20 | .............(else.(+.(fib.(-.n. |
| 1ec40 | 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 62 20 28 | 1)).......................(fib.( |
| 1ec60 | 2d 20 6e 20 32 29 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 31 2e 35 3a 2a 20 | -.n.2)))))).......*Figure.1.5:*. |
| 1ec80 | 54 68 65 20 74 72 65 65 2d 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 20 67 65 6e 65 72 | The.tree-recursive.process.gener |
| 1eca0 | 61 74 65 64 20 69 6e 20 63 6f 6d 70 75 74 69 6e 67 0a 20 20 20 20 20 60 28 66 69 62 20 35 29 27 | ated.in.computing......`(fib.5)' |
| 1ecc0 | 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 1ece0 | 2e 2e 3c 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 20 66 69 62 35 20 20 20 3c 2e 2e 2e 2e 2e 2e 2e 2e | ..<.............fib5...<........ |
| 1ed00 | 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e | ................................ |
| 1ed20 | 20 20 20 20 20 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 2f 20 20 5c 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 20 | .....___________/..\___________. |
| 1ed40 | 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 20 20 | ................................ |
| 1ed60 | 20 20 20 20 20 2f 20 20 20 20 20 20 20 2e 20 2e 2e 2e 2e 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ...../.......................... |
| 1ed80 | 5c 20 20 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 20 20 | \............................... |
| 1eda0 | 20 20 20 20 20 66 69 62 34 20 20 20 20 20 2e 20 20 20 20 20 20 20 20 2e 20 2e 20 2e 20 2e 20 20 | .....fib4....................... |
| 1edc0 | 20 20 20 66 69 62 33 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e | ...fib3......................... |
| 1ede0 | 20 20 20 20 20 5f 5f 5f 5f 2f 2e 20 5c 5f 5f 5f 5f 20 20 2e 2e 20 20 20 20 20 20 20 20 20 20 20 | .....____/..\____............... |
| 1ee00 | 20 20 2e 20 20 5f 5f 2f 20 20 5c 5f 5f 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....__/..\__................... |
| 1ee20 | 20 20 2e 2e 20 20 20 20 20 20 2f 20 20 2e 20 2e 20 20 2e 2e 20 20 20 5c 20 20 20 20 2e 20 20 20 | ........../............\........ |
| 1ee40 | 20 20 20 20 20 2e 2e 20 20 20 2f 20 20 2e 20 2e 20 20 20 5c 20 20 20 2e 0a 20 20 20 20 20 20 20 | ........../........\............ |
| 1ee60 | 20 20 20 20 20 20 20 20 2e 2e 20 20 20 20 20 66 69 62 33 20 2e 20 20 20 20 20 20 20 2e 20 20 66 | ...............fib3............f |
| 1ee80 | 69 62 32 20 2e 20 20 20 20 20 20 20 20 2e 20 66 69 62 32 20 2e 20 20 20 2e 20 20 66 69 62 31 20 | ib2............fib2........fib1. |
| 1eea0 | 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 20 20 20 20 20 20 2f 20 2e 20 5c 20 20 2e 20 | ......................./...\.... |
| 1eec0 | 20 20 20 20 2e 20 20 20 2f 20 20 5c 20 20 2e 20 20 20 20 20 20 2e 20 20 2f 20 20 5c 20 2e 2e 2e | ......../..\............/..\.... |
| 1eee0 | 20 20 2e 20 20 7c 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 2e 2e 20 20 20 20 20 20 20 2f 20 | .....|......................../. |
| 1ef00 | 2e 20 2e 20 5c 20 20 20 2e 20 20 2e 20 20 20 2f 20 20 2e 20 5c 20 20 20 2e 20 20 2e 20 20 20 2f | ....\........../....\........../ |
| 1ef20 | 20 2e 20 20 5c 20 20 20 2e 20 20 2e 20 31 20 2e 0a 20 20 20 20 20 20 20 20 20 20 2e 20 20 20 20 | ....\........1.................. |
| 1ef40 | 20 20 66 69 62 32 20 2e 20 2e 20 66 69 62 31 2e 20 20 2e 66 69 62 31 20 2e 20 20 66 69 62 30 20 | ..fib2.....fib1....fib1....fib0. |
| 1ef60 | 2e 20 2e 66 69 62 31 2e 20 2e 20 66 69 62 30 20 2e 20 20 2e 20 20 2e 0a 20 20 20 20 20 20 20 20 | ...fib1....fib0................. |
| 1ef80 | 20 20 2e 20 20 20 20 20 20 2f 20 20 5c 20 20 2e 20 2e 20 7c 20 20 2e 20 20 2e 20 7c 20 20 2e 20 | ........./..\......|.......|.... |
| 1efa0 | 20 2e 20 7c 20 20 20 2e 20 2e 20 7c 20 20 20 2e 20 2e 20 7c 20 20 20 2e 20 20 20 2e 3e 0a 20 20 | ...|.......|.......|........>... |
| 1efc0 | 20 20 20 20 20 20 20 20 56 20 20 20 20 20 2f 20 20 2e 20 5c 20 20 20 2e 20 31 20 20 2e 20 20 2e | ........V...../....\.....1...... |
| 1efe0 | 20 31 20 20 2e 20 20 2e 20 30 20 20 2e 20 20 2e 20 31 20 20 2e 20 20 2e 20 30 20 20 2e 2e 0a 20 | .1.......0.......1.......0...... |
| 1f000 | 20 20 20 20 20 20 20 20 20 2e 20 20 66 69 62 31 20 2e 2e 20 66 69 62 30 2e 2e 20 20 2e 20 20 20 | ............fib1....fib0........ |
| 1f020 | 2e 20 20 20 2e 20 20 20 2e 20 20 20 2e 20 20 20 56 20 20 20 2e 20 20 20 2e 2e 20 20 2e 0a 20 20 | ................V............... |
| 1f040 | 20 20 20 20 20 20 20 20 2e 20 20 20 7c 20 20 2e 20 20 2e 20 7c 20 20 2e 20 2e 3e 20 20 20 20 20 | ............|.......|.....>..... |
| 1f060 | 2e 3e 2e 20 20 20 20 20 2e 20 2e 20 20 20 20 2e 2e 3e 2e 20 20 20 20 20 20 2e 3e 0a 20 20 20 20 | .>...............>........>..... |
| 1f080 | 20 20 20 20 20 20 2e 20 20 20 31 20 2e 20 20 20 2e 20 30 20 20 2e 0a 20 20 20 20 20 20 20 20 20 | ..........1.......0............. |
| 1f0a0 | 20 20 2e 20 20 20 2e 20 20 20 20 20 2e 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 2e 3e 2e | ..............................>. |
| 1f0c0 | 20 20 20 20 20 20 20 2e 2e 0a 0a 20 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 70 61 74 74 65 | ..............Consider.the.patte |
| 1f0e0 | 72 6e 20 6f 66 20 74 68 69 73 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 54 6f 20 63 6f 6d 70 | rn.of.this.computation...To.comp |
| 1f100 | 75 74 65 20 60 28 66 69 62 20 35 29 27 2c 20 77 65 0a 63 6f 6d 70 75 74 65 20 60 28 66 69 62 20 | ute.`(fib.5)',.we.compute.`(fib. |
| 1f120 | 34 29 27 20 61 6e 64 20 60 28 66 69 62 20 33 29 27 2e 20 20 54 6f 20 63 6f 6d 70 75 74 65 20 60 | 4)'.and.`(fib.3)'...To.compute.` |
| 1f140 | 28 66 69 62 20 34 29 27 2c 20 77 65 20 63 6f 6d 70 75 74 65 0a 60 28 66 69 62 20 33 29 27 20 61 | (fib.4)',.we.compute.`(fib.3)'.a |
| 1f160 | 6e 64 20 60 28 66 69 62 20 32 29 27 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 74 68 65 20 65 | nd.`(fib.2)'...In.general,.the.e |
| 1f180 | 76 6f 6c 76 65 64 20 70 72 6f 63 65 73 73 20 6c 6f 6f 6b 73 20 6c 69 6b 65 20 61 0a 74 72 65 65 | volved.process.looks.like.a.tree |
| 1f1a0 | 2c 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 31 2d 35 3a 3a | ,.as.shown.in.*Note.Figure.1-5:: |
| 1f1c0 | 2e 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 73 70 6c 69 | ...Notice.that.the.branches.spli |
| 1f1e0 | 74 0a 69 6e 74 6f 20 74 77 6f 20 61 74 20 65 61 63 68 20 6c 65 76 65 6c 20 28 65 78 63 65 70 74 | t.into.two.at.each.level.(except |
| 1f200 | 20 61 74 20 74 68 65 20 62 6f 74 74 6f 6d 29 3b 20 74 68 69 73 20 72 65 66 6c 65 63 74 73 20 74 | .at.the.bottom);.this.reflects.t |
| 1f220 | 68 65 20 66 61 63 74 0a 74 68 61 74 20 74 68 65 20 60 66 69 62 27 20 70 72 6f 63 65 64 75 72 65 | he.fact.that.the.`fib'.procedure |
| 1f240 | 20 63 61 6c 6c 73 20 69 74 73 65 6c 66 20 74 77 69 63 65 20 65 61 63 68 20 74 69 6d 65 20 69 74 | .calls.itself.twice.each.time.it |
| 1f260 | 20 69 73 20 69 6e 76 6f 6b 65 64 2e 0a 0a 20 20 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 | .is.invoked......This.procedure. |
| 1f280 | 69 73 20 69 6e 73 74 72 75 63 74 69 76 65 20 61 73 20 61 20 70 72 6f 74 6f 74 79 70 69 63 61 6c | is.instructive.as.a.prototypical |
| 1f2a0 | 20 74 72 65 65 20 72 65 63 75 72 73 69 6f 6e 2c 20 62 75 74 0a 69 74 20 69 73 20 61 20 74 65 72 | .tree.recursion,.but.it.is.a.ter |
| 1f2c0 | 72 69 62 6c 65 20 77 61 79 20 74 6f 20 63 6f 6d 70 75 74 65 20 46 69 62 6f 6e 61 63 63 69 20 6e | rible.way.to.compute.Fibonacci.n |
| 1f2e0 | 75 6d 62 65 72 73 20 62 65 63 61 75 73 65 20 69 74 20 64 6f 65 73 20 73 6f 0a 6d 75 63 68 20 72 | umbers.because.it.does.so.much.r |
| 1f300 | 65 64 75 6e 64 61 6e 74 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 4e 6f 74 69 63 65 20 69 6e | edundant.computation...Notice.in |
| 1f320 | 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 31 2d 35 3a 3a 20 74 68 61 74 20 74 68 65 0a 65 6e 74 | .*Note.Figure.1-5::.that.the.ent |
| 1f340 | 69 72 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 6f 66 20 60 28 66 69 62 20 33 29 27 2d 2d 61 6c | ire.computation.of.`(fib.3)'--al |
| 1f360 | 6d 6f 73 74 20 68 61 6c 66 20 74 68 65 20 77 6f 72 6b 2d 2d 69 73 20 64 75 70 6c 69 63 61 74 65 | most.half.the.work--is.duplicate |
| 1f380 | 64 2e 0a 49 6e 20 66 61 63 74 2c 20 69 74 20 69 73 20 6e 6f 74 20 68 61 72 64 20 74 6f 20 73 68 | d..In.fact,.it.is.not.hard.to.sh |
| 1f3a0 | 6f 77 20 74 68 61 74 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 74 69 6d 65 73 20 74 68 65 20 | ow.that.the.number.of.times.the. |
| 1f3c0 | 70 72 6f 63 65 64 75 72 65 0a 77 69 6c 6c 20 63 6f 6d 70 75 74 65 20 60 28 66 69 62 20 31 29 27 | procedure.will.compute.`(fib.1)' |
| 1f3e0 | 20 6f 72 20 60 28 66 69 62 20 30 29 27 20 28 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 6c 65 61 | .or.`(fib.0)'.(the.number.of.lea |
| 1f400 | 76 65 73 20 69 6e 20 74 68 65 20 61 62 6f 76 65 0a 74 72 65 65 2c 20 69 6e 20 67 65 6e 65 72 61 | ves.in.the.above.tree,.in.genera |
| 1f420 | 6c 29 20 69 73 20 70 72 65 63 69 73 65 6c 79 20 5f 46 69 62 5f 28 6e 20 2b 20 31 29 2e 20 20 54 | l).is.precisely._Fib_(n.+.1)...T |
| 1f440 | 6f 20 67 65 74 20 61 6e 20 69 64 65 61 20 6f 66 20 68 6f 77 20 62 61 64 0a 74 68 69 73 20 69 73 | o.get.an.idea.of.how.bad.this.is |
| 1f460 | 2c 20 6f 6e 65 20 63 61 6e 20 73 68 6f 77 20 74 68 61 74 20 74 68 65 20 76 61 6c 75 65 20 6f 66 | ,.one.can.show.that.the.value.of |
| 1f480 | 20 5f 46 69 62 5f 28 6e 29 20 67 72 6f 77 73 20 65 78 70 6f 6e 65 6e 74 69 61 6c 6c 79 0a 77 69 | ._Fib_(n).grows.exponentially.wi |
| 1f4a0 | 74 68 20 6e 2e 20 20 4d 6f 72 65 20 70 72 65 63 69 73 65 6c 79 20 28 73 65 65 20 2a 4e 6f 74 65 | th.n...More.precisely.(see.*Note |
| 1f4c0 | 20 45 78 65 72 63 69 73 65 20 31 2d 31 33 3a 3a 29 2c 20 5f 46 69 62 5f 28 6e 29 20 69 73 20 74 | .Exercise.1-13::),._Fib_(n).is.t |
| 1f4e0 | 68 65 0a 63 6c 6f 73 65 73 74 20 69 6e 74 65 67 65 72 20 74 6f 20 5b 70 68 69 5d 5e 6e 20 2f 5b | he.closest.integer.to.[phi]^n./[ |
| 1f500 | 73 71 72 74 5d 28 35 29 2c 20 77 68 65 72 65 0a 0a 20 20 20 20 20 5b 70 68 69 5d 20 3d 20 28 31 | sqrt](5),.where.......[phi].=.(1 |
| 1f520 | 20 2b 20 5b 73 71 72 74 5d 35 29 2f 32 20 7e 3d 20 31 2e 36 31 38 30 0a 0a 69 73 20 74 68 65 20 | .+.[sqrt]5)/2.~=.1.6180..is.the. |
| 1f540 | 22 67 6f 6c 64 65 6e 20 72 61 74 69 6f 22 2c 20 77 68 69 63 68 20 73 61 74 69 73 66 69 65 73 20 | "golden.ratio",.which.satisfies. |
| 1f560 | 74 68 65 20 65 71 75 61 74 69 6f 6e 0a 0a 20 20 20 20 20 5b 70 68 69 5d 5e 32 20 3d 20 5b 70 68 | the.equation.......[phi]^2.=.[ph |
| 1f580 | 69 5d 20 2b 20 31 0a 0a 20 20 20 54 68 75 73 2c 20 74 68 65 20 70 72 6f 63 65 73 73 20 75 73 65 | i].+.1.....Thus,.the.process.use |
| 1f5a0 | 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 74 68 61 74 20 67 72 6f 77 73 20 65 | s.a.number.of.steps.that.grows.e |
| 1f5c0 | 78 70 6f 6e 65 6e 74 69 61 6c 6c 79 0a 77 69 74 68 20 74 68 65 20 69 6e 70 75 74 2e 20 20 4f 6e | xponentially.with.the.input...On |
| 1f5e0 | 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 74 68 65 20 73 70 61 63 65 20 72 65 71 75 69 | .the.other.hand,.the.space.requi |
| 1f600 | 72 65 64 20 67 72 6f 77 73 20 6f 6e 6c 79 0a 6c 69 6e 65 61 72 6c 79 20 77 69 74 68 20 74 68 65 | red.grows.only.linearly.with.the |
| 1f620 | 20 69 6e 70 75 74 2c 20 62 65 63 61 75 73 65 20 77 65 20 6e 65 65 64 20 6b 65 65 70 20 74 72 61 | .input,.because.we.need.keep.tra |
| 1f640 | 63 6b 20 6f 6e 6c 79 20 6f 66 20 77 68 69 63 68 20 6e 6f 64 65 73 0a 61 72 65 20 61 62 6f 76 65 | ck.only.of.which.nodes.are.above |
| 1f660 | 20 75 73 20 69 6e 20 74 68 65 20 74 72 65 65 20 61 74 20 61 6e 79 20 70 6f 69 6e 74 20 69 6e 20 | .us.in.the.tree.at.any.point.in. |
| 1f680 | 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 0a 74 68 | the.computation...In.general,.th |
| 1f6a0 | 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 72 65 71 75 69 72 65 64 20 62 79 20 61 20 | e.number.of.steps.required.by.a. |
| 1f6c0 | 74 72 65 65 2d 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 20 77 69 6c 6c 20 62 65 0a 70 | tree-recursive.process.will.be.p |
| 1f6e0 | 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 6e 6f 64 | roportional.to.the.number.of.nod |
| 1f700 | 65 73 20 69 6e 20 74 68 65 20 74 72 65 65 2c 20 77 68 69 6c 65 20 74 68 65 20 73 70 61 63 65 0a | es.in.the.tree,.while.the.space. |
| 1f720 | 72 65 71 75 69 72 65 64 20 77 69 6c 6c 20 62 65 20 70 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f | required.will.be.proportional.to |
| 1f740 | 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 64 65 70 74 68 20 6f 66 20 74 68 65 20 74 72 65 65 2e 0a | .the.maximum.depth.of.the.tree.. |
| 1f760 | 0a 20 20 20 57 65 20 63 61 6e 20 61 6c 73 6f 20 66 6f 72 6d 75 6c 61 74 65 20 61 6e 20 69 74 65 | ....We.can.also.formulate.an.ite |
| 1f780 | 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 | rative.process.for.computing.the |
| 1f7a0 | 0a 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 2e 20 20 54 68 65 20 69 64 65 61 20 69 73 | .Fibonacci.numbers...The.idea.is |
| 1f7c0 | 20 74 6f 20 75 73 65 20 61 20 70 61 69 72 20 6f 66 20 69 6e 74 65 67 65 72 73 20 61 20 61 6e 64 | .to.use.a.pair.of.integers.a.and |
| 1f7e0 | 20 62 2c 0a 69 6e 69 74 69 61 6c 69 7a 65 64 20 74 6f 20 5f 46 69 62 5f 28 31 29 20 3d 20 31 20 | .b,.initialized.to._Fib_(1).=.1. |
| 1f800 | 61 6e 64 20 5f 46 69 62 5f 28 30 29 20 3d 20 30 2c 20 61 6e 64 20 74 6f 20 72 65 70 65 61 74 65 | and._Fib_(0).=.0,.and.to.repeate |
| 1f820 | 64 6c 79 20 61 70 70 6c 79 0a 74 68 65 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 20 74 72 61 6e 73 | dly.apply.the.simultaneous.trans |
| 1f840 | 66 6f 72 6d 61 74 69 6f 6e 73 0a 0a 20 20 20 20 20 61 20 3c 2d 20 61 20 2b 20 62 0a 20 20 20 20 | formations.......a.<-.a.+.b..... |
| 1f860 | 20 62 20 3c 2d 20 61 0a 0a 49 74 20 69 73 20 6e 6f 74 20 68 61 72 64 20 74 6f 20 73 68 6f 77 20 | .b.<-.a..It.is.not.hard.to.show. |
| 1f880 | 74 68 61 74 2c 20 61 66 74 65 72 20 61 70 70 6c 79 69 6e 67 20 74 68 69 73 20 74 72 61 6e 73 66 | that,.after.applying.this.transf |
| 1f8a0 | 6f 72 6d 61 74 69 6f 6e 20 6e 20 74 69 6d 65 73 2c 0a 61 20 61 6e 64 20 62 20 77 69 6c 6c 20 62 | ormation.n.times,.a.and.b.will.b |
| 1f8c0 | 65 20 65 71 75 61 6c 2c 20 72 65 73 70 65 63 74 69 76 65 6c 79 2c 20 74 6f 20 5f 46 69 62 5f 28 | e.equal,.respectively,.to._Fib_( |
| 1f8e0 | 6e 20 2b 20 31 29 20 61 6e 64 20 5f 46 69 62 5f 28 6e 29 2e 0a 54 68 75 73 2c 20 77 65 20 63 61 | n.+.1).and._Fib_(n)..Thus,.we.ca |
| 1f900 | 6e 20 63 6f 6d 70 75 74 65 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 20 69 74 65 72 | n.compute.Fibonacci.numbers.iter |
| 1f920 | 61 74 69 76 65 6c 79 20 75 73 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 | atively.using.the.procedure..... |
| 1f940 | 20 20 28 64 65 66 69 6e 65 20 28 66 69 62 20 6e 29 0a 20 20 20 20 20 20 20 28 66 69 62 2d 69 74 | ..(define.(fib.n)........(fib-it |
| 1f960 | 65 72 20 31 20 30 20 6e 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 62 2d 69 74 | er.1.0.n)).......(define.(fib-it |
| 1f980 | 65 72 20 61 20 62 20 63 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 63 6f 75 6e | er.a.b.count)........(if.(=.coun |
| 1f9a0 | 74 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 62 0a 20 20 20 20 20 20 20 20 20 20 20 28 66 69 | t.0)............b............(fi |
| 1f9c0 | 62 2d 69 74 65 72 20 28 2b 20 61 20 62 29 20 61 20 28 2d 20 63 6f 75 6e 74 20 31 29 29 29 29 0a | b-iter.(+.a.b).a.(-.count.1)))). |
| 1f9e0 | 0a 20 20 20 54 68 69 73 20 73 65 63 6f 6e 64 20 6d 65 74 68 6f 64 20 66 6f 72 20 63 6f 6d 70 75 | ....This.second.method.for.compu |
| 1fa00 | 74 69 6e 67 20 5f 46 69 62 5f 28 6e 29 20 69 73 20 61 20 6c 69 6e 65 61 72 20 69 74 65 72 61 74 | ting._Fib_(n).is.a.linear.iterat |
| 1fa20 | 69 6f 6e 2e 20 20 54 68 65 0a 64 69 66 66 65 72 65 6e 63 65 20 69 6e 20 6e 75 6d 62 65 72 20 6f | ion...The.difference.in.number.o |
| 1fa40 | 66 20 73 74 65 70 73 20 72 65 71 75 69 72 65 64 20 62 79 20 74 68 65 20 74 77 6f 20 6d 65 74 68 | f.steps.required.by.the.two.meth |
| 1fa60 | 6f 64 73 2d 2d 6f 6e 65 20 6c 69 6e 65 61 72 20 69 6e 0a 6e 2c 20 6f 6e 65 20 67 72 6f 77 69 6e | ods--one.linear.in.n,.one.growin |
| 1fa80 | 67 20 61 73 20 66 61 73 74 20 61 73 20 5f 46 69 62 5f 28 6e 29 20 69 74 73 65 6c 66 2d 2d 69 73 | g.as.fast.as._Fib_(n).itself--is |
| 1faa0 | 20 65 6e 6f 72 6d 6f 75 73 2c 20 65 76 65 6e 20 66 6f 72 20 73 6d 61 6c 6c 0a 69 6e 70 75 74 73 | .enormous,.even.for.small.inputs |
| 1fac0 | 2e 0a 0a 20 20 20 4f 6e 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 63 6f 6e 63 6c 75 64 65 20 66 72 | ......One.should.not.conclude.fr |
| 1fae0 | 6f 6d 20 74 68 69 73 20 74 68 61 74 20 74 72 65 65 2d 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 | om.this.that.tree-recursive.proc |
| 1fb00 | 65 73 73 65 73 20 61 72 65 0a 75 73 65 6c 65 73 73 2e 20 20 57 68 65 6e 20 77 65 20 63 6f 6e 73 | esses.are.useless...When.we.cons |
| 1fb20 | 69 64 65 72 20 70 72 6f 63 65 73 73 65 73 20 74 68 61 74 20 6f 70 65 72 61 74 65 20 6f 6e 20 68 | ider.processes.that.operate.on.h |
| 1fb40 | 69 65 72 61 72 63 68 69 63 61 6c 6c 79 0a 73 74 72 75 63 74 75 72 65 64 20 64 61 74 61 20 72 61 | ierarchically.structured.data.ra |
| 1fb60 | 74 68 65 72 20 74 68 61 6e 20 6e 75 6d 62 65 72 73 2c 20 77 65 20 77 69 6c 6c 20 66 69 6e 64 20 | ther.than.numbers,.we.will.find. |
| 1fb80 | 74 68 61 74 20 74 72 65 65 20 72 65 63 75 72 73 69 6f 6e 0a 69 73 20 61 20 6e 61 74 75 72 61 6c | that.tree.recursion.is.a.natural |
| 1fba0 | 20 61 6e 64 20 70 6f 77 65 72 66 75 6c 20 74 6f 6f 6c 2e 28 31 29 20 42 75 74 20 65 76 65 6e 20 | .and.powerful.tool.(1).But.even. |
| 1fbc0 | 69 6e 20 6e 75 6d 65 72 69 63 61 6c 20 6f 70 65 72 61 74 69 6f 6e 73 2c 0a 74 72 65 65 2d 72 65 | in.numerical.operations,.tree-re |
| 1fbe0 | 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 65 73 20 63 61 6e 20 62 65 20 75 73 65 66 75 6c 20 | cursive.processes.can.be.useful. |
| 1fc00 | 69 6e 20 68 65 6c 70 69 6e 67 20 75 73 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 61 6e 64 0a | in.helping.us.to.understand.and. |
| 1fc20 | 64 65 73 69 67 6e 20 70 72 6f 67 72 61 6d 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 | design.programs...For.instance,. |
| 1fc40 | 61 6c 74 68 6f 75 67 68 20 74 68 65 20 66 69 72 73 74 20 60 66 69 62 27 20 70 72 6f 63 65 64 75 | although.the.first.`fib'.procedu |
| 1fc60 | 72 65 20 69 73 0a 6d 75 63 68 20 6c 65 73 73 20 65 66 66 69 63 69 65 6e 74 20 74 68 61 6e 20 74 | re.is.much.less.efficient.than.t |
| 1fc80 | 68 65 20 73 65 63 6f 6e 64 20 6f 6e 65 2c 20 69 74 20 69 73 20 6d 6f 72 65 20 73 74 72 61 69 67 | he.second.one,.it.is.more.straig |
| 1fca0 | 68 74 66 6f 72 77 61 72 64 2c 0a 62 65 69 6e 67 20 6c 69 74 74 6c 65 20 6d 6f 72 65 20 74 68 61 | htforward,.being.little.more.tha |
| 1fcc0 | 6e 20 61 20 74 72 61 6e 73 6c 61 74 69 6f 6e 20 69 6e 74 6f 20 4c 69 73 70 20 6f 66 20 74 68 65 | n.a.translation.into.Lisp.of.the |
| 1fce0 | 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 0a 46 69 62 6f 6e 61 63 63 69 20 73 65 71 | .definition.of.the.Fibonacci.seq |
| 1fd00 | 75 65 6e 63 65 2e 20 20 54 6f 20 66 6f 72 6d 75 6c 61 74 65 20 74 68 65 20 69 74 65 72 61 74 69 | uence...To.formulate.the.iterati |
| 1fd20 | 76 65 20 61 6c 67 6f 72 69 74 68 6d 20 72 65 71 75 69 72 65 64 0a 6e 6f 74 69 63 69 6e 67 20 74 | ve.algorithm.required.noticing.t |
| 1fd40 | 68 61 74 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 63 6f 75 6c 64 20 62 65 20 72 65 63 | hat.the.computation.could.be.rec |
| 1fd60 | 61 73 74 20 61 73 20 61 6e 20 69 74 65 72 61 74 69 6f 6e 20 77 69 74 68 0a 74 68 72 65 65 20 73 | ast.as.an.iteration.with.three.s |
| 1fd80 | 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 2e 0a 0a 45 78 61 6d 70 6c 65 3a 20 43 6f 75 6e 74 69 | tate.variables...Example:.Counti |
| 1fda0 | 6e 67 20 63 68 61 6e 67 65 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ng.change....................... |
| 1fdc0 | 2e 2e 0a 0a 49 74 20 74 61 6b 65 73 20 6f 6e 6c 79 20 61 20 62 69 74 20 6f 66 20 63 6c 65 76 65 | ....It.takes.only.a.bit.of.cleve |
| 1fde0 | 72 6e 65 73 73 20 74 6f 20 63 6f 6d 65 20 75 70 20 77 69 74 68 20 74 68 65 20 69 74 65 72 61 74 | rness.to.come.up.with.the.iterat |
| 1fe00 | 69 76 65 0a 46 69 62 6f 6e 61 63 63 69 20 61 6c 67 6f 72 69 74 68 6d 2e 20 20 49 6e 20 63 6f 6e | ive.Fibonacci.algorithm...In.con |
| 1fe20 | 74 72 61 73 74 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 | trast,.consider.the.following.pr |
| 1fe40 | 6f 62 6c 65 6d 3a 20 48 6f 77 0a 6d 61 6e 79 20 64 69 66 66 65 72 65 6e 74 20 77 61 79 73 20 63 | oblem:.How.many.different.ways.c |
| 1fe60 | 61 6e 20 77 65 20 6d 61 6b 65 20 63 68 61 6e 67 65 20 6f 66 20 24 20 31 2e 30 30 2c 20 67 69 76 | an.we.make.change.of.$.1.00,.giv |
| 1fe80 | 65 6e 20 68 61 6c 66 2d 64 6f 6c 6c 61 72 73 2c 0a 71 75 61 72 74 65 72 73 2c 20 64 69 6d 65 73 | en.half-dollars,.quarters,.dimes |
| 1fea0 | 2c 20 6e 69 63 6b 65 6c 73 2c 20 61 6e 64 20 70 65 6e 6e 69 65 73 3f 20 20 4d 6f 72 65 20 67 65 | ,.nickels,.and.pennies?..More.ge |
| 1fec0 | 6e 65 72 61 6c 6c 79 2c 20 63 61 6e 20 77 65 20 77 72 69 74 65 20 61 0a 70 72 6f 63 65 64 75 72 | nerally,.can.we.write.a.procedur |
| 1fee0 | 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 77 61 79 73 20 | e.to.compute.the.number.of.ways. |
| 1ff00 | 74 6f 20 63 68 61 6e 67 65 20 61 6e 79 20 67 69 76 65 6e 20 61 6d 6f 75 6e 74 20 6f 66 0a 6d 6f | to.change.any.given.amount.of.mo |
| 1ff20 | 6e 65 79 3f 0a 0a 20 20 20 54 68 69 73 20 70 72 6f 62 6c 65 6d 20 68 61 73 20 61 20 73 69 6d 70 | ney?.....This.problem.has.a.simp |
| 1ff40 | 6c 65 20 73 6f 6c 75 74 69 6f 6e 20 61 73 20 61 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 | le.solution.as.a.recursive.proce |
| 1ff60 | 64 75 72 65 2e 0a 53 75 70 70 6f 73 65 20 77 65 20 74 68 69 6e 6b 20 6f 66 20 74 68 65 20 74 79 | dure..Suppose.we.think.of.the.ty |
| 1ff80 | 70 65 73 20 6f 66 20 63 6f 69 6e 73 20 61 76 61 69 6c 61 62 6c 65 20 61 73 20 61 72 72 61 6e 67 | pes.of.coins.available.as.arrang |
| 1ffa0 | 65 64 20 69 6e 20 73 6f 6d 65 0a 6f 72 64 65 72 2e 20 20 54 68 65 6e 20 74 68 65 20 66 6f 6c 6c | ed.in.some.order...Then.the.foll |
| 1ffc0 | 6f 77 69 6e 67 20 72 65 6c 61 74 69 6f 6e 20 68 6f 6c 64 73 3a 0a 0a 20 20 20 54 68 65 20 6e 75 | owing.relation.holds:.....The.nu |
| 1ffe0 | 6d 62 65 72 20 6f 66 20 77 61 79 73 20 74 6f 20 63 68 61 6e 67 65 20 61 6d 6f 75 6e 74 20 61 20 | mber.of.ways.to.change.amount.a. |
| 20000 | 75 73 69 6e 67 20 6e 20 6b 69 6e 64 73 20 6f 66 20 63 6f 69 6e 73 20 65 71 75 61 6c 73 0a 0a 20 | using.n.kinds.of.coins.equals... |
| 20020 | 20 20 2a 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 77 61 79 73 20 74 6f 20 63 68 61 6e 67 65 | ..*.the.number.of.ways.to.change |
| 20040 | 20 61 6d 6f 75 6e 74 20 61 20 75 73 69 6e 67 20 61 6c 6c 20 62 75 74 20 74 68 65 20 66 69 72 73 | .amount.a.using.all.but.the.firs |
| 20060 | 74 20 6b 69 6e 64 0a 20 20 20 20 20 6f 66 20 63 6f 69 6e 2c 20 70 6c 75 73 0a 0a 20 20 20 2a 20 | t.kind......of.coin,.plus.....*. |
| 20080 | 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 77 61 79 73 20 74 6f 20 63 68 61 6e 67 65 20 61 6d 6f | the.number.of.ways.to.change.amo |
| 200a0 | 75 6e 74 20 61 20 2d 20 64 20 75 73 69 6e 67 20 61 6c 6c 20 6e 20 6b 69 6e 64 73 20 6f 66 0a 20 | unt.a.-.d.using.all.n.kinds.of.. |
| 200c0 | 20 20 20 20 63 6f 69 6e 73 2c 20 77 68 65 72 65 20 64 20 69 73 20 74 68 65 20 64 65 6e 6f 6d 69 | ....coins,.where.d.is.the.denomi |
| 200e0 | 6e 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 6b 69 6e 64 20 6f 66 20 63 6f 69 6e | nation.of.the.first.kind.of.coin |
| 20100 | 2e 0a 0a 0a 20 20 20 54 6f 20 73 65 65 20 77 68 79 20 74 68 69 73 20 69 73 20 74 72 75 65 2c 20 | .......To.see.why.this.is.true,. |
| 20120 | 6f 62 73 65 72 76 65 20 74 68 61 74 20 74 68 65 20 77 61 79 73 20 74 6f 20 6d 61 6b 65 20 63 68 | observe.that.the.ways.to.make.ch |
| 20140 | 61 6e 67 65 20 63 61 6e 20 62 65 0a 64 69 76 69 64 65 64 20 69 6e 74 6f 20 74 77 6f 20 67 72 6f | ange.can.be.divided.into.two.gro |
| 20160 | 75 70 73 3a 20 74 68 6f 73 65 20 74 68 61 74 20 64 6f 20 6e 6f 74 20 75 73 65 20 61 6e 79 20 6f | ups:.those.that.do.not.use.any.o |
| 20180 | 66 20 74 68 65 20 66 69 72 73 74 20 6b 69 6e 64 20 6f 66 0a 63 6f 69 6e 2c 20 61 6e 64 20 74 68 | f.the.first.kind.of.coin,.and.th |
| 201a0 | 6f 73 65 20 74 68 61 74 20 64 6f 2e 20 20 54 68 65 72 65 66 6f 72 65 2c 20 74 68 65 20 74 6f 74 | ose.that.do...Therefore,.the.tot |
| 201c0 | 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 77 61 79 73 20 74 6f 20 6d 61 6b 65 0a 63 68 61 6e 67 65 | al.number.of.ways.to.make.change |
| 201e0 | 20 66 6f 72 20 73 6f 6d 65 20 61 6d 6f 75 6e 74 20 69 73 20 65 71 75 61 6c 20 74 6f 20 74 68 65 | .for.some.amount.is.equal.to.the |
| 20200 | 20 6e 75 6d 62 65 72 20 6f 66 20 77 61 79 73 20 74 6f 20 6d 61 6b 65 20 63 68 61 6e 67 65 0a 66 | .number.of.ways.to.make.change.f |
| 20220 | 6f 72 20 74 68 65 20 61 6d 6f 75 6e 74 20 77 69 74 68 6f 75 74 20 75 73 69 6e 67 20 61 6e 79 20 | or.the.amount.without.using.any. |
| 20240 | 6f 66 20 74 68 65 20 66 69 72 73 74 20 6b 69 6e 64 20 6f 66 20 63 6f 69 6e 2c 20 70 6c 75 73 20 | of.the.first.kind.of.coin,.plus. |
| 20260 | 74 68 65 0a 6e 75 6d 62 65 72 20 6f 66 20 77 61 79 73 20 74 6f 20 6d 61 6b 65 20 63 68 61 6e 67 | the.number.of.ways.to.make.chang |
| 20280 | 65 20 61 73 73 75 6d 69 6e 67 20 74 68 61 74 20 77 65 20 64 6f 20 75 73 65 20 74 68 65 20 66 69 | e.assuming.that.we.do.use.the.fi |
| 202a0 | 72 73 74 20 6b 69 6e 64 20 6f 66 0a 63 6f 69 6e 2e 20 20 42 75 74 20 74 68 65 20 6c 61 74 74 65 | rst.kind.of.coin...But.the.latte |
| 202c0 | 72 20 6e 75 6d 62 65 72 20 69 73 20 65 71 75 61 6c 20 74 6f 20 74 68 65 20 6e 75 6d 62 65 72 20 | r.number.is.equal.to.the.number. |
| 202e0 | 6f 66 20 77 61 79 73 20 74 6f 20 6d 61 6b 65 0a 63 68 61 6e 67 65 20 66 6f 72 20 74 68 65 20 61 | of.ways.to.make.change.for.the.a |
| 20300 | 6d 6f 75 6e 74 20 74 68 61 74 20 72 65 6d 61 69 6e 73 20 61 66 74 65 72 20 75 73 69 6e 67 20 61 | mount.that.remains.after.using.a |
| 20320 | 20 63 6f 69 6e 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 6b 69 6e 64 2e 0a 0a 20 20 20 54 68 75 | .coin.of.the.first.kind......Thu |
| 20340 | 73 2c 20 77 65 20 63 61 6e 20 72 65 63 75 72 73 69 76 65 6c 79 20 72 65 64 75 63 65 20 74 68 65 | s,.we.can.recursively.reduce.the |
| 20360 | 20 70 72 6f 62 6c 65 6d 20 6f 66 20 63 68 61 6e 67 69 6e 67 20 61 20 67 69 76 65 6e 0a 61 6d 6f | .problem.of.changing.a.given.amo |
| 20380 | 75 6e 74 20 74 6f 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 63 68 61 6e 67 69 6e 67 20 73 | unt.to.the.problem.of.changing.s |
| 203a0 | 6d 61 6c 6c 65 72 20 61 6d 6f 75 6e 74 73 20 75 73 69 6e 67 20 66 65 77 65 72 20 6b 69 6e 64 73 | maller.amounts.using.fewer.kinds |
| 203c0 | 20 6f 66 0a 63 6f 69 6e 73 2e 20 20 43 6f 6e 73 69 64 65 72 20 74 68 69 73 20 72 65 64 75 63 74 | .of.coins...Consider.this.reduct |
| 203e0 | 69 6f 6e 20 72 75 6c 65 20 63 61 72 65 66 75 6c 6c 79 2c 20 61 6e 64 20 63 6f 6e 76 69 6e 63 65 | ion.rule.carefully,.and.convince |
| 20400 | 20 79 6f 75 72 73 65 6c 66 0a 74 68 61 74 20 77 65 20 63 61 6e 20 75 73 65 20 69 74 20 74 6f 20 | .yourself.that.we.can.use.it.to. |
| 20420 | 64 65 73 63 72 69 62 65 20 61 6e 20 61 6c 67 6f 72 69 74 68 6d 20 69 66 20 77 65 20 73 70 65 63 | describe.an.algorithm.if.we.spec |
| 20440 | 69 66 79 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 64 65 67 65 6e 65 72 61 74 65 20 63 61 73 | ify.the.following.degenerate.cas |
| 20460 | 65 73 3a 28 32 29 0a 0a 20 20 20 2a 20 49 66 20 61 20 69 73 20 65 78 61 63 74 6c 79 20 30 2c 20 | es:(2).....*.If.a.is.exactly.0,. |
| 20480 | 77 65 20 73 68 6f 75 6c 64 20 63 6f 75 6e 74 20 74 68 61 74 20 61 73 20 31 20 77 61 79 20 74 6f | we.should.count.that.as.1.way.to |
| 204a0 | 20 6d 61 6b 65 20 63 68 61 6e 67 65 2e 0a 0a 20 20 20 2a 20 49 66 20 61 20 69 73 20 6c 65 73 73 | .make.change......*.If.a.is.less |
| 204c0 | 20 74 68 61 6e 20 30 2c 20 77 65 20 73 68 6f 75 6c 64 20 63 6f 75 6e 74 20 74 68 61 74 20 61 73 | .than.0,.we.should.count.that.as |
| 204e0 | 20 30 20 77 61 79 73 20 74 6f 20 6d 61 6b 65 20 63 68 61 6e 67 65 2e 0a 0a 20 20 20 2a 20 49 66 | .0.ways.to.make.change......*.If |
| 20500 | 20 6e 20 69 73 20 30 2c 20 77 65 20 73 68 6f 75 6c 64 20 63 6f 75 6e 74 20 74 68 61 74 20 61 73 | .n.is.0,.we.should.count.that.as |
| 20520 | 20 30 20 77 61 79 73 20 74 6f 20 6d 61 6b 65 20 63 68 61 6e 67 65 2e 0a 0a 0a 20 20 20 57 65 20 | .0.ways.to.make.change.......We. |
| 20540 | 63 61 6e 20 65 61 73 69 6c 79 20 74 72 61 6e 73 6c 61 74 65 20 74 68 69 73 20 64 65 73 63 72 69 | can.easily.translate.this.descri |
| 20560 | 70 74 69 6f 6e 20 69 6e 74 6f 20 61 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 64 75 72 65 | ption.into.a.recursive.procedure |
| 20580 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 75 6e 74 2d 63 68 61 6e 67 65 20 61 6d | :.......(define.(count-change.am |
| 205a0 | 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 28 63 63 20 61 6d 6f 75 6e 74 20 35 29 29 0a 0a 20 20 20 | ount)........(cc.amount.5))..... |
| 205c0 | 20 20 28 64 65 66 69 6e 65 20 28 63 63 20 61 6d 6f 75 6e 74 20 6b 69 6e 64 73 2d 6f 66 2d 63 6f | ..(define.(cc.amount.kinds-of-co |
| 205e0 | 69 6e 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d 20 61 6d 6f 75 6e 74 20 30 29 20 | ins)........(cond.((=.amount.0). |
| 20600 | 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6f 72 20 28 3c 20 61 6d 6f 75 6e 74 20 30 | 1)..............((or.(<.amount.0 |
| 20620 | 29 20 28 3d 20 6b 69 6e 64 73 2d 6f 66 2d 63 6f 69 6e 73 20 30 29 29 20 30 29 0a 20 20 20 20 20 | ).(=.kinds-of-coins.0)).0)...... |
| 20640 | 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 2b 20 28 63 63 20 61 6d 6f 75 6e 74 0a 20 20 20 20 | ........(else.(+.(cc.amount..... |
| 20660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2d 20 6b 69 6e 64 73 2d 6f | ......................(-.kinds-o |
| 20680 | 66 2d 63 6f 69 6e 73 20 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | f-coins.1))..................... |
| 206a0 | 20 20 28 63 63 20 28 2d 20 61 6d 6f 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..(cc.(-.amount................. |
| 206c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 72 73 74 2d 64 65 6e 6f 6d 69 6e 61 74 69 6f 6e | .............(first-denomination |
| 206e0 | 20 6b 69 6e 64 73 2d 6f 66 2d 63 6f 69 6e 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .kinds-of-coins))............... |
| 20700 | 20 20 20 20 20 20 20 20 20 20 20 20 6b 69 6e 64 73 2d 6f 66 2d 63 6f 69 6e 73 29 29 29 29 29 0a | ............kinds-of-coins))))). |
| 20720 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 72 73 74 2d 64 65 6e 6f 6d 69 6e 61 74 69 6f | ......(define.(first-denominatio |
| 20740 | 6e 20 6b 69 6e 64 73 2d 6f 66 2d 63 6f 69 6e 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 | n.kinds-of-coins)........(cond.( |
| 20760 | 28 3d 20 6b 69 6e 64 73 2d 6f 66 2d 63 6f 69 6e 73 20 31 29 20 31 29 0a 20 20 20 20 20 20 20 20 | (=.kinds-of-coins.1).1)......... |
| 20780 | 20 20 20 20 20 28 28 3d 20 6b 69 6e 64 73 2d 6f 66 2d 63 6f 69 6e 73 20 32 29 20 35 29 0a 20 20 | .....((=.kinds-of-coins.2).5)... |
| 207a0 | 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 20 6b 69 6e 64 73 2d 6f 66 2d 63 6f 69 6e 73 20 33 29 | ...........((=.kinds-of-coins.3) |
| 207c0 | 20 31 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 20 6b 69 6e 64 73 2d 6f 66 2d 63 | .10)..............((=.kinds-of-c |
| 207e0 | 6f 69 6e 73 20 34 29 20 32 35 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 20 6b 69 6e | oins.4).25)..............((=.kin |
| 20800 | 64 73 2d 6f 66 2d 63 6f 69 6e 73 20 35 29 20 35 30 29 29 29 0a 0a 20 20 20 28 54 68 65 20 60 66 | ds-of-coins.5).50))).....(The.`f |
| 20820 | 69 72 73 74 2d 64 65 6e 6f 6d 69 6e 61 74 69 6f 6e 27 20 70 72 6f 63 65 64 75 72 65 20 74 61 6b | irst-denomination'.procedure.tak |
| 20840 | 65 73 20 61 73 20 69 6e 70 75 74 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 0a 6b 69 6e 64 73 20 | es.as.input.the.number.of.kinds. |
| 20860 | 6f 66 20 63 6f 69 6e 73 20 61 76 61 69 6c 61 62 6c 65 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 | of.coins.available.and.returns.t |
| 20880 | 68 65 20 64 65 6e 6f 6d 69 6e 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 66 69 72 73 74 0a 6b 69 6e | he.denomination.of.the.first.kin |
| 208a0 | 64 2e 20 20 48 65 72 65 20 77 65 20 61 72 65 20 74 68 69 6e 6b 69 6e 67 20 6f 66 20 74 68 65 20 | d...Here.we.are.thinking.of.the. |
| 208c0 | 63 6f 69 6e 73 20 61 73 20 61 72 72 61 6e 67 65 64 20 69 6e 20 6f 72 64 65 72 20 66 72 6f 6d 0a | coins.as.arranged.in.order.from. |
| 208e0 | 6c 61 72 67 65 73 74 20 74 6f 20 73 6d 61 6c 6c 65 73 74 2c 20 62 75 74 20 61 6e 79 20 6f 72 64 | largest.to.smallest,.but.any.ord |
| 20900 | 65 72 20 77 6f 75 6c 64 20 64 6f 20 61 73 20 77 65 6c 6c 2e 29 20 20 57 65 20 63 61 6e 20 6e 6f | er.would.do.as.well.)..We.can.no |
| 20920 | 77 0a 61 6e 73 77 65 72 20 6f 75 72 20 6f 72 69 67 69 6e 61 6c 20 71 75 65 73 74 69 6f 6e 20 61 | w.answer.our.original.question.a |
| 20940 | 62 6f 75 74 20 63 68 61 6e 67 69 6e 67 20 61 20 64 6f 6c 6c 61 72 3a 0a 0a 20 20 20 20 20 28 63 | bout.changing.a.dollar:.......(c |
| 20960 | 6f 75 6e 74 2d 63 68 61 6e 67 65 20 31 30 30 29 0a 20 20 20 20 20 32 39 32 0a 0a 20 20 20 60 43 | ount-change.100)......292.....`C |
| 20980 | 6f 75 6e 74 2d 63 68 61 6e 67 65 27 20 67 65 6e 65 72 61 74 65 73 20 61 20 74 72 65 65 2d 72 65 | ount-change'.generates.a.tree-re |
| 209a0 | 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 20 77 69 74 68 20 72 65 64 75 6e 64 61 6e 63 69 65 | cursive.process.with.redundancie |
| 209c0 | 73 0a 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 6f 73 65 20 69 6e 20 6f 75 72 20 66 69 72 73 74 20 | s.similar.to.those.in.our.first. |
| 209e0 | 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 60 66 69 62 27 2e 20 20 28 49 74 20 77 69 | implementation.of.`fib'...(It.wi |
| 20a00 | 6c 6c 20 74 61 6b 65 0a 71 75 69 74 65 20 61 20 77 68 69 6c 65 20 66 6f 72 20 74 68 61 74 20 32 | ll.take.quite.a.while.for.that.2 |
| 20a20 | 39 32 20 74 6f 20 62 65 20 63 6f 6d 70 75 74 65 64 2e 29 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 | 92.to.be.computed.)..On.the.othe |
| 20a40 | 72 20 68 61 6e 64 2c 20 69 74 20 69 73 0a 6e 6f 74 20 6f 62 76 69 6f 75 73 20 68 6f 77 20 74 6f | r.hand,.it.is.not.obvious.how.to |
| 20a60 | 20 64 65 73 69 67 6e 20 61 20 62 65 74 74 65 72 20 61 6c 67 6f 72 69 74 68 6d 20 66 6f 72 20 63 | .design.a.better.algorithm.for.c |
| 20a80 | 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 72 65 73 75 6c 74 2c 0a 61 6e 64 20 77 65 20 6c 65 61 76 | omputing.the.result,.and.we.leav |
| 20aa0 | 65 20 74 68 69 73 20 70 72 6f 62 6c 65 6d 20 61 73 20 61 20 63 68 61 6c 6c 65 6e 67 65 2e 20 20 | e.this.problem.as.a.challenge... |
| 20ac0 | 54 68 65 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 74 68 61 74 20 61 0a 74 72 65 65 2d 72 65 63 75 | The.observation.that.a.tree-recu |
| 20ae0 | 72 73 69 76 65 20 70 72 6f 63 65 73 73 20 6d 61 79 20 62 65 20 68 69 67 68 6c 79 20 69 6e 65 66 | rsive.process.may.be.highly.inef |
| 20b00 | 66 69 63 69 65 6e 74 20 62 75 74 20 6f 66 74 65 6e 20 65 61 73 79 20 74 6f 0a 73 70 65 63 69 66 | ficient.but.often.easy.to.specif |
| 20b20 | 79 20 61 6e 64 20 75 6e 64 65 72 73 74 61 6e 64 20 68 61 73 20 6c 65 64 20 70 65 6f 70 6c 65 20 | y.and.understand.has.led.people. |
| 20b40 | 74 6f 20 70 72 6f 70 6f 73 65 20 74 68 61 74 20 6f 6e 65 20 63 6f 75 6c 64 20 67 65 74 20 74 68 | to.propose.that.one.could.get.th |
| 20b60 | 65 0a 62 65 73 74 20 6f 66 20 62 6f 74 68 20 77 6f 72 6c 64 73 20 62 79 20 64 65 73 69 67 6e 69 | e.best.of.both.worlds.by.designi |
| 20b80 | 6e 67 20 61 20 22 73 6d 61 72 74 20 63 6f 6d 70 69 6c 65 72 22 20 74 68 61 74 20 63 6f 75 6c 64 | ng.a."smart.compiler".that.could |
| 20ba0 | 0a 74 72 61 6e 73 66 6f 72 6d 20 74 72 65 65 2d 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 64 | .transform.tree-recursive.proced |
| 20bc0 | 75 72 65 73 20 69 6e 74 6f 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20 70 72 6f 63 65 64 75 | ures.into.more.efficient.procedu |
| 20be0 | 72 65 73 20 74 68 61 74 0a 63 6f 6d 70 75 74 65 20 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 | res.that.compute.the.same.result |
| 20c00 | 2e 28 33 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 31 31 3a 2a 20 41 20 66 75 | .(3).......*Exercise.1.11:*.A.fu |
| 20c20 | 6e 63 74 69 6f 6e 20 66 20 69 73 20 64 65 66 69 6e 65 64 20 62 79 20 74 68 65 20 72 75 6c 65 20 | nction.f.is.defined.by.the.rule. |
| 20c40 | 74 68 61 74 20 66 28 6e 29 20 3d 20 6e 0a 20 20 20 20 20 69 66 20 6e 3c 33 20 61 6e 64 20 66 28 | that.f(n).=.n......if.n<3.and.f( |
| 20c60 | 6e 29 20 3d 20 66 28 6e 20 2d 20 31 29 20 2b 20 32 66 28 6e 20 2d 20 32 29 20 2b 20 33 66 28 6e | n).=.f(n.-.1).+.2f(n.-.2).+.3f(n |
| 20c80 | 20 2d 20 33 29 20 69 66 20 6e 3e 3d 20 33 2e 0a 20 20 20 20 20 57 72 69 74 65 20 61 20 70 72 6f | .-.3).if.n>=.3.......Write.a.pro |
| 20ca0 | 63 65 64 75 72 65 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 66 20 62 79 20 6d 65 61 6e 73 20 | cedure.that.computes.f.by.means. |
| 20cc0 | 6f 66 20 61 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 2e 0a 20 20 20 20 20 57 72 69 | of.a.recursive.process.......Wri |
| 20ce0 | 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 66 20 62 | te.a.procedure.that.computes.f.b |
| 20d00 | 79 20 6d 65 61 6e 73 20 6f 66 20 61 6e 20 69 74 65 72 61 74 69 76 65 0a 20 20 20 20 20 70 72 6f | y.means.of.an.iterative......pro |
| 20d20 | 63 65 73 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 31 32 3a 2a 20 54 68 65 | cess........*Exercise.1.12:*.The |
| 20d40 | 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 61 74 74 65 72 6e 20 6f 66 20 6e 75 6d 62 65 72 73 20 69 73 | .following.pattern.of.numbers.is |
| 20d60 | 20 63 61 6c 6c 65 64 20 22 50 61 73 63 61 6c 27 73 0a 20 20 20 20 20 74 72 69 61 6e 67 6c 65 22 | .called."Pascal's......triangle" |
| 20d80 | 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 | .....................1.......... |
| 20da0 | 20 20 20 20 20 20 20 31 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 20 20 20 32 | .......1...1...............1...2 |
| 20dc0 | 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 31 20 20 20 33 20 20 20 33 20 20 20 31 0a 20 | ...1.............1...3...3...1.. |
| 20de0 | 20 20 20 20 20 20 20 20 20 31 20 20 20 34 20 20 20 36 20 20 20 34 20 20 20 31 0a 0a 20 20 20 20 | .........1...4...6...4...1...... |
| 20e00 | 20 54 68 65 20 6e 75 6d 62 65 72 73 20 61 74 20 74 68 65 20 65 64 67 65 20 6f 66 20 74 68 65 20 | .The.numbers.at.the.edge.of.the. |
| 20e20 | 74 72 69 61 6e 67 6c 65 20 61 72 65 20 61 6c 6c 20 31 2c 20 61 6e 64 20 65 61 63 68 20 6e 75 6d | triangle.are.all.1,.and.each.num |
| 20e40 | 62 65 72 0a 20 20 20 20 20 69 6e 73 69 64 65 20 74 68 65 20 74 72 69 61 6e 67 6c 65 20 69 73 20 | ber......inside.the.triangle.is. |
| 20e60 | 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 74 77 6f 20 6e 75 6d 62 65 72 73 20 61 62 6f 76 65 | the.sum.of.the.two.numbers.above |
| 20e80 | 20 69 74 2e 28 34 29 0a 20 20 20 20 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 | .it.(4)......Write.a.procedure.t |
| 20ea0 | 68 61 74 20 63 6f 6d 70 75 74 65 73 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 50 61 73 63 61 6c 27 | hat.computes.elements.of.Pascal' |
| 20ec0 | 73 20 74 72 69 61 6e 67 6c 65 20 62 79 0a 20 20 20 20 20 6d 65 61 6e 73 20 6f 66 20 61 20 72 65 | s.triangle.by......means.of.a.re |
| 20ee0 | 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | cursive.process........*Exercise |
| 20f00 | 20 31 2e 31 33 3a 2a 20 50 72 6f 76 65 20 74 68 61 74 20 5f 46 69 62 5f 28 6e 29 20 69 73 20 74 | .1.13:*.Prove.that._Fib_(n).is.t |
| 20f20 | 68 65 20 63 6c 6f 73 65 73 74 20 69 6e 74 65 67 65 72 20 74 6f 0a 20 20 20 20 20 5b 70 68 69 5d | he.closest.integer.to......[phi] |
| 20f40 | 5e 6e 2f 5b 73 71 72 74 5d 28 35 29 2c 20 77 68 65 72 65 20 5b 70 68 69 5d 20 3d 20 28 31 20 2b | ^n/[sqrt](5),.where.[phi].=.(1.+ |
| 20f60 | 20 5b 73 71 72 74 5d 28 35 29 29 2f 32 2e 20 20 48 69 6e 74 3a 20 4c 65 74 0a 20 20 20 20 20 5b | .[sqrt](5))/2...Hint:.Let......[ |
| 20f80 | 69 6c 6c 65 67 69 62 6c 65 73 79 6d 62 6f 6c 5d 20 3d 20 28 31 20 2d 20 5b 73 71 72 74 5d 28 35 | illegiblesymbol].=.(1.-.[sqrt](5 |
| 20fa0 | 29 29 2f 32 2e 20 20 55 73 65 20 69 6e 64 75 63 74 69 6f 6e 20 61 6e 64 20 74 68 65 0a 20 20 20 | ))/2...Use.induction.and.the.... |
| 20fc0 | 20 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 | ..definition.of.the.Fibonacci.nu |
| 20fe0 | 6d 62 65 72 73 20 28 73 65 65 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 32 3a 3a | mbers.(see.section.*Note.1-2-2:: |
| 21000 | 29 20 74 6f 0a 20 20 20 20 20 70 72 6f 76 65 20 74 68 61 74 20 5f 46 69 62 5f 28 6e 29 20 3d 20 | ).to......prove.that._Fib_(n).=. |
| 21020 | 28 5b 70 68 69 5d 5e 6e 20 2d 20 5b 69 6c 6c 65 67 69 62 6c 65 73 79 6d 62 6f 6c 5d 5e 6e 29 2f | ([phi]^n.-.[illegiblesymbol]^n)/ |
| 21040 | 5b 73 71 72 74 5d 28 35 29 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f | [sqrt](5)......----------.Footno |
| 21060 | 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 41 6e 20 65 78 61 6d 70 6c | tes.----------.....(1).An.exampl |
| 21080 | 65 20 6f 66 20 74 68 69 73 20 77 61 73 20 68 69 6e 74 65 64 20 61 74 20 69 6e 20 73 65 63 74 69 | e.of.this.was.hinted.at.in.secti |
| 210a0 | 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 33 3a 3a 3a 20 54 68 65 0a 69 6e 74 65 72 70 72 65 74 65 | on.*Note.1-1-3:::.The.interprete |
| 210c0 | 72 20 69 74 73 65 6c 66 20 65 76 61 6c 75 61 74 65 73 20 65 78 70 72 65 73 73 69 6f 6e 73 20 75 | r.itself.evaluates.expressions.u |
| 210e0 | 73 69 6e 67 20 61 20 74 72 65 65 2d 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 2e 0a 0a | sing.a.tree-recursive.process... |
| 21100 | 20 20 20 28 32 29 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 6f 72 6b 20 74 68 72 6f 75 67 68 | ...(2).For.example,.work.through |
| 21120 | 20 69 6e 20 64 65 74 61 69 6c 20 68 6f 77 20 74 68 65 20 72 65 64 75 63 74 69 6f 6e 20 72 75 6c | .in.detail.how.the.reduction.rul |
| 21140 | 65 0a 61 70 70 6c 69 65 73 20 74 6f 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 6d 61 6b 69 | e.applies.to.the.problem.of.maki |
| 21160 | 6e 67 20 63 68 61 6e 67 65 20 66 6f 72 20 31 30 20 63 65 6e 74 73 20 75 73 69 6e 67 20 70 65 6e | ng.change.for.10.cents.using.pen |
| 21180 | 6e 69 65 73 20 61 6e 64 0a 6e 69 63 6b 65 6c 73 2e 0a 0a 20 20 20 28 33 29 20 4f 6e 65 20 61 70 | nies.and.nickels......(3).One.ap |
| 211a0 | 70 72 6f 61 63 68 20 74 6f 20 63 6f 70 69 6e 67 20 77 69 74 68 20 72 65 64 75 6e 64 61 6e 74 20 | proach.to.coping.with.redundant. |
| 211c0 | 63 6f 6d 70 75 74 61 74 69 6f 6e 73 20 69 73 20 74 6f 20 61 72 72 61 6e 67 65 0a 6d 61 74 74 65 | computations.is.to.arrange.matte |
| 211e0 | 72 73 20 73 6f 20 74 68 61 74 20 77 65 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 63 6f 6e 73 | rs.so.that.we.automatically.cons |
| 21200 | 74 72 75 63 74 20 61 20 74 61 62 6c 65 20 6f 66 20 76 61 6c 75 65 73 20 61 73 20 74 68 65 79 0a | truct.a.table.of.values.as.they. |
| 21220 | 61 72 65 20 63 6f 6d 70 75 74 65 64 2e 20 20 45 61 63 68 20 74 69 6d 65 20 77 65 20 61 72 65 20 | are.computed...Each.time.we.are. |
| 21240 | 61 73 6b 65 64 20 74 6f 20 61 70 70 6c 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 | asked.to.apply.the.procedure.to. |
| 21260 | 73 6f 6d 65 0a 61 72 67 75 6d 65 6e 74 2c 20 77 65 20 66 69 72 73 74 20 6c 6f 6f 6b 20 74 6f 20 | some.argument,.we.first.look.to. |
| 21280 | 73 65 65 20 69 66 20 74 68 65 20 76 61 6c 75 65 20 69 73 20 61 6c 72 65 61 64 79 20 73 74 6f 72 | see.if.the.value.is.already.stor |
| 212a0 | 65 64 20 69 6e 20 74 68 65 0a 74 61 62 6c 65 2c 20 69 6e 20 77 68 69 63 68 20 63 61 73 65 20 77 | ed.in.the.table,.in.which.case.w |
| 212c0 | 65 20 61 76 6f 69 64 20 70 65 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 72 65 64 75 6e 64 61 6e 74 | e.avoid.performing.the.redundant |
| 212e0 | 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 0a 54 68 69 73 20 73 74 72 61 74 65 67 79 2c 20 6b 6e 6f | .computation..This.strategy,.kno |
| 21300 | 77 6e 20 61 73 20 22 74 61 62 75 6c 61 74 69 6f 6e 22 20 6f 72 20 22 6d 65 6d 6f 69 7a 61 74 69 | wn.as."tabulation".or."memoizati |
| 21320 | 6f 6e 22 2c 20 63 61 6e 20 62 65 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 61 20 73 74 72 | on",.can.be.implemented.in.a.str |
| 21340 | 61 69 67 68 74 66 6f 72 77 61 72 64 20 77 61 79 2e 20 20 54 61 62 75 6c 61 74 69 6f 6e 20 63 61 | aightforward.way...Tabulation.ca |
| 21360 | 6e 20 73 6f 6d 65 74 69 6d 65 73 20 62 65 20 75 73 65 64 0a 74 6f 20 74 72 61 6e 73 66 6f 72 6d | n.sometimes.be.used.to.transform |
| 21380 | 20 70 72 6f 63 65 73 73 65 73 20 74 68 61 74 20 72 65 71 75 69 72 65 20 61 6e 20 65 78 70 6f 6e | .processes.that.require.an.expon |
| 213a0 | 65 6e 74 69 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 0a 28 73 75 63 68 20 61 73 20 | ential.number.of.steps.(such.as. |
| 213c0 | 60 63 6f 75 6e 74 2d 63 68 61 6e 67 65 27 29 20 69 6e 74 6f 20 70 72 6f 63 65 73 73 65 73 20 77 | `count-change').into.processes.w |
| 213e0 | 68 6f 73 65 20 73 70 61 63 65 20 61 6e 64 20 74 69 6d 65 0a 72 65 71 75 69 72 65 6d 65 6e 74 73 | hose.space.and.time.requirements |
| 21400 | 20 67 72 6f 77 20 6c 69 6e 65 61 72 6c 79 20 77 69 74 68 20 74 68 65 20 69 6e 70 75 74 2e 20 20 | .grow.linearly.with.the.input... |
| 21420 | 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 32 37 3a 3a 2e 0a 0a 20 20 20 28 | See.*Note.Exercise.3-27::......( |
| 21440 | 34 29 20 54 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 50 61 73 63 61 6c 27 73 20 74 72 69 61 | 4).The.elements.of.Pascal's.tria |
| 21460 | 6e 67 6c 65 20 61 72 65 20 63 61 6c 6c 65 64 20 74 68 65 20 22 62 69 6e 6f 6d 69 61 6c 0a 63 6f | ngle.are.called.the."binomial.co |
| 21480 | 65 66 66 69 63 69 65 6e 74 73 22 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 6e 74 68 20 72 6f 77 | efficients",.because.the.nth.row |
| 214a0 | 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 6f 66 | .consists.of.the.coefficients.of |
| 214c0 | 20 74 68 65 0a 74 65 72 6d 73 20 69 6e 20 74 68 65 20 65 78 70 61 6e 73 69 6f 6e 20 6f 66 20 28 | .the.terms.in.the.expansion.of.( |
| 214e0 | 78 20 2b 20 79 29 5e 6e 2e 20 20 54 68 69 73 20 70 61 74 74 65 72 6e 20 66 6f 72 20 63 6f 6d 70 | x.+.y)^n...This.pattern.for.comp |
| 21500 | 75 74 69 6e 67 20 74 68 65 0a 63 6f 65 66 66 69 63 69 65 6e 74 73 20 61 70 70 65 61 72 65 64 20 | uting.the.coefficients.appeared. |
| 21520 | 69 6e 20 42 6c 61 69 73 65 20 50 61 73 63 61 6c 27 73 20 31 36 35 33 20 73 65 6d 69 6e 61 6c 20 | in.Blaise.Pascal's.1653.seminal. |
| 21540 | 77 6f 72 6b 20 6f 6e 0a 70 72 6f 62 61 62 69 6c 69 74 79 20 74 68 65 6f 72 79 2c 20 60 54 72 61 | work.on.probability.theory,.`Tra |
| 21560 | 69 74 65 27 20 64 75 20 74 72 69 61 6e 67 6c 65 20 61 72 69 74 68 6d 65 27 74 69 71 75 65 27 2e | ite'.du.triangle.arithme'tique'. |
| 21580 | 20 20 41 63 63 6f 72 64 69 6e 67 20 74 6f 0a 4b 6e 75 74 68 20 28 31 39 37 33 29 2c 20 74 68 65 | ..According.to.Knuth.(1973),.the |
| 215a0 | 20 73 61 6d 65 20 70 61 74 74 65 72 6e 20 61 70 70 65 61 72 73 20 69 6e 20 74 68 65 20 60 53 7a | .same.pattern.appears.in.the.`Sz |
| 215c0 | 75 2d 79 75 65 6e 20 59 75 22 2d 63 68 69 65 6e 27 0a 28 22 54 68 65 20 50 72 65 63 69 6f 75 73 | u-yuen.Yu"-chien'.("The.Precious |
| 215e0 | 20 4d 69 72 72 6f 72 20 6f 66 20 74 68 65 20 46 6f 75 72 20 45 6c 65 6d 65 6e 74 73 22 29 2c 20 | .Mirror.of.the.Four.Elements"),. |
| 21600 | 70 75 62 6c 69 73 68 65 64 20 62 79 20 74 68 65 20 43 68 69 6e 65 73 65 0a 6d 61 74 68 65 6d 61 | published.by.the.Chinese.mathema |
| 21620 | 74 69 63 69 61 6e 20 43 68 75 20 53 68 69 68 2d 63 68 69 65 68 20 69 6e 20 31 33 30 33 2c 20 69 | tician.Chu.Shih-chieh.in.1303,.i |
| 21640 | 6e 20 74 68 65 20 77 6f 72 6b 73 20 6f 66 20 74 68 65 0a 74 77 65 6c 66 74 68 2d 63 65 6e 74 75 | n.the.works.of.the.twelfth-centu |
| 21660 | 72 79 20 50 65 72 73 69 61 6e 20 70 6f 65 74 20 61 6e 64 20 6d 61 74 68 65 6d 61 74 69 63 69 61 | ry.Persian.poet.and.mathematicia |
| 21680 | 6e 20 4f 6d 61 72 20 4b 68 61 79 79 61 6d 2c 20 61 6e 64 20 69 6e 20 74 68 65 0a 77 6f 72 6b 73 | n.Omar.Khayyam,.and.in.the.works |
| 216a0 | 20 6f 66 20 74 68 65 20 74 77 65 6c 66 74 68 2d 63 65 6e 74 75 72 79 20 48 69 6e 64 75 20 6d 61 | .of.the.twelfth-century.Hindu.ma |
| 216c0 | 74 68 65 6d 61 74 69 63 69 61 6e 20 42 68 61 27 73 63 61 72 61 20 41 27 63 68 61 27 72 79 61 2e | thematician.Bha'scara.A'cha'rya. |
| 216e0 | 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 32 2d | ....File:.sicp.info,..Node:.1-2- |
| 21700 | 33 2c 20 20 4e 65 78 74 3a 20 31 2d 32 2d 34 2c 20 20 50 72 65 76 3a 20 31 2d 32 2d 32 2c 20 20 | 3,..Next:.1-2-4,..Prev:.1-2-2,.. |
| 21720 | 55 70 3a 20 31 2d 32 0a 0a 31 2e 32 2e 33 20 4f 72 64 65 72 73 20 6f 66 20 47 72 6f 77 74 68 0a | Up:.1-2..1.2.3.Orders.of.Growth. |
| 21740 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 70 72 65 76 | ----------------------..The.prev |
| 21760 | 69 6f 75 73 20 65 78 61 6d 70 6c 65 73 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 61 74 20 70 72 | ious.examples.illustrate.that.pr |
| 21780 | 6f 63 65 73 73 65 73 20 63 61 6e 20 64 69 66 66 65 72 20 63 6f 6e 73 69 64 65 72 61 62 6c 79 0a | ocesses.can.differ.considerably. |
| 217a0 | 69 6e 20 74 68 65 20 72 61 74 65 73 20 61 74 20 77 68 69 63 68 20 74 68 65 79 20 63 6f 6e 73 75 | in.the.rates.at.which.they.consu |
| 217c0 | 6d 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 72 65 73 6f 75 72 63 65 73 2e 20 20 4f 6e 65 | me.computational.resources...One |
| 217e0 | 0a 63 6f 6e 76 65 6e 69 65 6e 74 20 77 61 79 20 74 6f 20 64 65 73 63 72 69 62 65 20 74 68 69 73 | .convenient.way.to.describe.this |
| 21800 | 20 64 69 66 66 65 72 65 6e 63 65 20 69 73 20 74 6f 20 75 73 65 20 74 68 65 20 6e 6f 74 69 6f 6e | .difference.is.to.use.the.notion |
| 21820 | 20 6f 66 20 22 6f 72 64 65 72 0a 6f 66 20 67 72 6f 77 74 68 22 20 74 6f 20 6f 62 74 61 69 6e 20 | .of."order.of.growth".to.obtain. |
| 21840 | 61 20 67 72 6f 73 73 20 6d 65 61 73 75 72 65 20 6f 66 20 74 68 65 20 72 65 73 6f 75 72 63 65 73 | a.gross.measure.of.the.resources |
| 21860 | 20 72 65 71 75 69 72 65 64 20 62 79 20 61 0a 70 72 6f 63 65 73 73 20 61 73 20 74 68 65 20 69 6e | .required.by.a.process.as.the.in |
| 21880 | 70 75 74 73 20 62 65 63 6f 6d 65 20 6c 61 72 67 65 72 2e 0a 0a 20 20 20 4c 65 74 20 6e 20 62 65 | puts.become.larger......Let.n.be |
| 218a0 | 20 61 20 70 61 72 61 6d 65 74 65 72 20 74 68 61 74 20 6d 65 61 73 75 72 65 73 20 74 68 65 20 73 | .a.parameter.that.measures.the.s |
| 218c0 | 69 7a 65 20 6f 66 20 74 68 65 20 70 72 6f 62 6c 65 6d 2c 20 61 6e 64 20 6c 65 74 0a 52 28 6e 29 | ize.of.the.problem,.and.let.R(n) |
| 218e0 | 20 62 65 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66 20 72 65 73 6f 75 72 63 65 73 20 74 68 65 20 | .be.the.amount.of.resources.the. |
| 21900 | 70 72 6f 63 65 73 73 20 72 65 71 75 69 72 65 73 20 66 6f 72 20 61 20 70 72 6f 62 6c 65 6d 20 6f | process.requires.for.a.problem.o |
| 21920 | 66 0a 73 69 7a 65 20 6e 2e 20 20 49 6e 20 6f 75 72 20 70 72 65 76 69 6f 75 73 20 65 78 61 6d 70 | f.size.n...In.our.previous.examp |
| 21940 | 6c 65 73 20 77 65 20 74 6f 6f 6b 20 6e 20 74 6f 20 62 65 20 74 68 65 20 6e 75 6d 62 65 72 20 66 | les.we.took.n.to.be.the.number.f |
| 21960 | 6f 72 20 77 68 69 63 68 0a 61 20 67 69 76 65 6e 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 74 6f 20 | or.which.a.given.function.is.to. |
| 21980 | 62 65 20 63 6f 6d 70 75 74 65 64 2c 20 62 75 74 20 74 68 65 72 65 20 61 72 65 20 6f 74 68 65 72 | be.computed,.but.there.are.other |
| 219a0 | 20 70 6f 73 73 69 62 69 6c 69 74 69 65 73 2e 0a 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 66 | .possibilities..For.instance,.if |
| 219c0 | 20 6f 75 72 20 67 6f 61 6c 20 69 73 20 74 6f 20 63 6f 6d 70 75 74 65 20 61 6e 20 61 70 70 72 6f | .our.goal.is.to.compute.an.appro |
| 219e0 | 78 69 6d 61 74 69 6f 6e 20 74 6f 20 74 68 65 20 73 71 75 61 72 65 0a 72 6f 6f 74 20 6f 66 20 61 | ximation.to.the.square.root.of.a |
| 21a00 | 20 6e 75 6d 62 65 72 2c 20 77 65 20 6d 69 67 68 74 20 74 61 6b 65 20 6e 20 74 6f 20 62 65 20 74 | .number,.we.might.take.n.to.be.t |
| 21a20 | 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 64 69 67 69 74 73 20 61 63 63 75 72 61 63 79 0a 72 65 71 | he.number.of.digits.accuracy.req |
| 21a40 | 75 69 72 65 64 2e 20 20 46 6f 72 20 6d 61 74 72 69 78 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f | uired...For.matrix.multiplicatio |
| 21a60 | 6e 20 77 65 20 6d 69 67 68 74 20 74 61 6b 65 20 6e 20 74 6f 20 62 65 20 74 68 65 20 6e 75 6d 62 | n.we.might.take.n.to.be.the.numb |
| 21a80 | 65 72 0a 6f 66 20 72 6f 77 73 20 69 6e 20 74 68 65 20 6d 61 74 72 69 63 65 73 2e 20 20 49 6e 20 | er.of.rows.in.the.matrices...In. |
| 21aa0 | 67 65 6e 65 72 61 6c 20 74 68 65 72 65 20 61 72 65 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 72 | general.there.are.a.number.of.pr |
| 21ac0 | 6f 70 65 72 74 69 65 73 0a 6f 66 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 77 69 74 68 20 72 65 73 | operties.of.the.problem.with.res |
| 21ae0 | 70 65 63 74 20 74 6f 20 77 68 69 63 68 20 69 74 20 77 69 6c 6c 20 62 65 20 64 65 73 69 72 61 62 | pect.to.which.it.will.be.desirab |
| 21b00 | 6c 65 20 74 6f 20 61 6e 61 6c 79 7a 65 20 61 0a 67 69 76 65 6e 20 70 72 6f 63 65 73 73 2e 20 20 | le.to.analyze.a.given.process... |
| 21b20 | 53 69 6d 69 6c 61 72 6c 79 2c 20 52 28 6e 29 20 6d 69 67 68 74 20 6d 65 61 73 75 72 65 20 74 68 | Similarly,.R(n).might.measure.th |
| 21b40 | 65 20 6e 75 6d 62 65 72 20 6f 66 20 69 6e 74 65 72 6e 61 6c 0a 73 74 6f 72 61 67 65 20 72 65 67 | e.number.of.internal.storage.reg |
| 21b60 | 69 73 74 65 72 73 20 75 73 65 64 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 65 6c 65 6d 65 | isters.used,.the.number.of.eleme |
| 21b80 | 6e 74 61 72 79 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 0a 70 65 72 66 6f 72 6d | ntary.machine.operations.perform |
| 21ba0 | 65 64 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 20 49 6e 20 63 6f 6d 70 75 74 65 72 73 20 74 68 61 | ed,.and.so.on...In.computers.tha |
| 21bc0 | 74 20 64 6f 20 6f 6e 6c 79 20 61 20 66 69 78 65 64 20 6e 75 6d 62 65 72 20 6f 66 0a 6f 70 65 72 | t.do.only.a.fixed.number.of.oper |
| 21be0 | 61 74 69 6f 6e 73 20 61 74 20 61 20 74 69 6d 65 2c 20 74 68 65 20 74 69 6d 65 20 72 65 71 75 69 | ations.at.a.time,.the.time.requi |
| 21c00 | 72 65 64 20 77 69 6c 6c 20 62 65 20 70 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 74 68 65 0a | red.will.be.proportional.to.the. |
| 21c20 | 6e 75 6d 62 65 72 20 6f 66 20 65 6c 65 6d 65 6e 74 61 72 79 20 6d 61 63 68 69 6e 65 20 6f 70 65 | number.of.elementary.machine.ope |
| 21c40 | 72 61 74 69 6f 6e 73 20 70 65 72 66 6f 72 6d 65 64 2e 0a 0a 20 20 20 57 65 20 73 61 79 20 74 68 | rations.performed......We.say.th |
| 21c60 | 61 74 20 52 28 6e 29 20 68 61 73 20 6f 72 64 65 72 20 6f 66 20 67 72 6f 77 74 68 20 5b 74 68 65 | at.R(n).has.order.of.growth.[the |
| 21c80 | 74 61 5d 28 66 28 6e 29 29 2c 20 77 72 69 74 74 65 6e 20 52 28 6e 29 20 3d 0a 5b 74 68 65 74 61 | ta](f(n)),.written.R(n).=.[theta |
| 21ca0 | 5d 28 66 28 6e 29 29 20 28 70 72 6f 6e 6f 75 6e 63 65 64 20 22 74 68 65 74 61 20 6f 66 20 66 28 | ](f(n)).(pronounced."theta.of.f( |
| 21cc0 | 6e 29 22 29 2c 20 69 66 20 74 68 65 72 65 20 61 72 65 20 70 6f 73 69 74 69 76 65 0a 63 6f 6e 73 | n)"),.if.there.are.positive.cons |
| 21ce0 | 74 61 6e 74 73 20 6b 5f 31 20 61 6e 64 20 6b 5f 32 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 | tants.k_1.and.k_2.independent.of |
| 21d00 | 20 6e 20 73 75 63 68 20 74 68 61 74 0a 0a 20 20 20 20 20 6b 5f 31 20 66 28 6e 29 20 3c 3d 20 52 | .n.such.that.......k_1.f(n).<=.R |
| 21d20 | 28 6e 29 20 3c 3d 20 6b 5f 32 20 66 28 6e 29 0a 0a 66 6f 72 20 61 6e 79 20 73 75 66 66 69 63 69 | (n).<=.k_2.f(n)..for.any.suffici |
| 21d40 | 65 6e 74 6c 79 20 6c 61 72 67 65 20 76 61 6c 75 65 20 6f 66 20 6e 2e 20 20 28 49 6e 20 6f 74 68 | ently.large.value.of.n...(In.oth |
| 21d60 | 65 72 20 77 6f 72 64 73 2c 20 66 6f 72 20 6c 61 72 67 65 20 6e 2c 0a 74 68 65 20 76 61 6c 75 65 | er.words,.for.large.n,.the.value |
| 21d80 | 20 52 28 6e 29 20 69 73 20 73 61 6e 64 77 69 63 68 65 64 20 62 65 74 77 65 65 6e 20 6b 5f 31 66 | .R(n).is.sandwiched.between.k_1f |
| 21da0 | 28 6e 29 20 61 6e 64 20 6b 5f 32 66 28 6e 29 2e 29 0a 0a 20 20 20 46 6f 72 20 69 6e 73 74 61 6e | (n).and.k_2f(n).).....For.instan |
| 21dc0 | 63 65 2c 20 77 69 74 68 20 74 68 65 20 6c 69 6e 65 61 72 20 72 65 63 75 72 73 69 76 65 20 70 72 | ce,.with.the.linear.recursive.pr |
| 21de0 | 6f 63 65 73 73 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 0a 66 61 63 74 6f 72 69 61 6c 20 64 65 | ocess.for.computing.factorial.de |
| 21e00 | 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 31 3a 3a | scribed.in.section.*Note.1-2-1:: |
| 21e20 | 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 67 72 6f 77 73 0a 70 72 6f 70 6f | .the.number.of.steps.grows.propo |
| 21e40 | 72 74 69 6f 6e 61 6c 6c 79 20 74 6f 20 74 68 65 20 69 6e 70 75 74 20 6e 2e 20 20 54 68 75 73 2c | rtionally.to.the.input.n...Thus, |
| 21e60 | 20 74 68 65 20 73 74 65 70 73 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 74 68 69 73 0a 70 72 6f | .the.steps.required.for.this.pro |
| 21e80 | 63 65 73 73 20 67 72 6f 77 73 20 61 73 20 5b 74 68 65 74 61 5d 28 6e 29 2e 20 20 57 65 20 61 6c | cess.grows.as.[theta](n)...We.al |
| 21ea0 | 73 6f 20 73 61 77 20 74 68 61 74 20 74 68 65 20 73 70 61 63 65 20 72 65 71 75 69 72 65 64 20 67 | so.saw.that.the.space.required.g |
| 21ec0 | 72 6f 77 73 0a 61 73 20 5b 74 68 65 74 61 5d 28 6e 29 2e 20 20 46 6f 72 20 74 68 65 20 69 74 65 | rows.as.[theta](n)...For.the.ite |
| 21ee0 | 72 61 74 69 76 65 20 66 61 63 74 6f 72 69 61 6c 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 | rative.factorial,.the.number.of. |
| 21f00 | 73 74 65 70 73 20 69 73 0a 73 74 69 6c 6c 20 5b 74 68 65 74 61 5d 28 6e 29 20 62 75 74 20 74 68 | steps.is.still.[theta](n).but.th |
| 21f20 | 65 20 73 70 61 63 65 20 69 73 20 5b 74 68 65 74 61 5d 28 31 29 2d 2d 74 68 61 74 20 69 73 2c 20 | e.space.is.[theta](1)--that.is,. |
| 21f40 | 63 6f 6e 73 74 61 6e 74 2e 28 31 29 20 54 68 65 0a 74 72 65 65 2d 72 65 63 75 72 73 69 76 65 20 | constant.(1).The.tree-recursive. |
| 21f60 | 46 69 62 6f 6e 61 63 63 69 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 72 65 71 75 69 72 65 73 20 5b | Fibonacci.computation.requires.[ |
| 21f80 | 74 68 65 74 61 5d 28 5b 70 68 69 5d 5e 6e 29 20 73 74 65 70 73 0a 61 6e 64 20 73 70 61 63 65 20 | theta]([phi]^n).steps.and.space. |
| 21fa0 | 5b 74 68 65 74 61 5d 28 6e 29 2c 20 77 68 65 72 65 20 5b 70 68 69 5d 20 69 73 20 74 68 65 20 67 | [theta](n),.where.[phi].is.the.g |
| 21fc0 | 6f 6c 64 65 6e 20 72 61 74 69 6f 20 64 65 73 63 72 69 62 65 64 20 69 6e 0a 73 65 63 74 69 6f 6e | olden.ratio.described.in.section |
| 21fe0 | 20 2a 4e 6f 74 65 20 31 2d 32 2d 32 3a 3a 2e 0a 0a 20 20 20 4f 72 64 65 72 73 20 6f 66 20 67 72 | .*Note.1-2-2::......Orders.of.gr |
| 22000 | 6f 77 74 68 20 70 72 6f 76 69 64 65 20 6f 6e 6c 79 20 61 20 63 72 75 64 65 20 64 65 73 63 72 69 | owth.provide.only.a.crude.descri |
| 22020 | 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 0a 61 20 70 72 6f 63 65 | ption.of.the.behavior.of.a.proce |
| 22040 | 73 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 20 70 72 6f 63 65 73 73 20 72 65 71 75 | ss...For.example,.a.process.requ |
| 22060 | 69 72 69 6e 67 20 6e 5e 32 20 73 74 65 70 73 20 61 6e 64 20 61 20 70 72 6f 63 65 73 73 0a 72 65 | iring.n^2.steps.and.a.process.re |
| 22080 | 71 75 69 72 69 6e 67 20 31 30 30 30 6e 5e 32 20 73 74 65 70 73 20 61 6e 64 20 61 20 70 72 6f 63 | quiring.1000n^2.steps.and.a.proc |
| 220a0 | 65 73 73 20 72 65 71 75 69 72 69 6e 67 20 33 6e 5e 32 20 2b 20 31 30 6e 20 2b 20 31 37 20 73 74 | ess.requiring.3n^2.+.10n.+.17.st |
| 220c0 | 65 70 73 0a 61 6c 6c 20 68 61 76 65 20 5b 74 68 65 74 61 5d 28 6e 5e 32 29 20 6f 72 64 65 72 20 | eps.all.have.[theta](n^2).order. |
| 220e0 | 6f 66 20 67 72 6f 77 74 68 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 6f | of.growth...On.the.other.hand,.o |
| 22100 | 72 64 65 72 20 6f 66 0a 67 72 6f 77 74 68 20 70 72 6f 76 69 64 65 73 20 61 20 75 73 65 66 75 6c | rder.of.growth.provides.a.useful |
| 22120 | 20 69 6e 64 69 63 61 74 69 6f 6e 20 6f 66 20 68 6f 77 20 77 65 20 6d 61 79 20 65 78 70 65 63 74 | .indication.of.how.we.may.expect |
| 22140 | 20 74 68 65 20 62 65 68 61 76 69 6f 72 0a 6f 66 20 74 68 65 20 70 72 6f 63 65 73 73 20 74 6f 20 | .the.behavior.of.the.process.to. |
| 22160 | 63 68 61 6e 67 65 20 61 73 20 77 65 20 63 68 61 6e 67 65 20 74 68 65 20 73 69 7a 65 20 6f 66 20 | change.as.we.change.the.size.of. |
| 22180 | 74 68 65 20 70 72 6f 62 6c 65 6d 2e 20 20 46 6f 72 20 61 0a 5b 74 68 65 74 61 5d 28 6e 29 20 28 | the.problem...For.a.[theta](n).( |
| 221a0 | 6c 69 6e 65 61 72 29 20 70 72 6f 63 65 73 73 2c 20 64 6f 75 62 6c 69 6e 67 20 74 68 65 20 73 69 | linear).process,.doubling.the.si |
| 221c0 | 7a 65 20 77 69 6c 6c 20 72 6f 75 67 68 6c 79 20 64 6f 75 62 6c 65 20 74 68 65 0a 61 6d 6f 75 6e | ze.will.roughly.double.the.amoun |
| 221e0 | 74 20 6f 66 20 72 65 73 6f 75 72 63 65 73 20 75 73 65 64 2e 20 20 46 6f 72 20 61 6e 20 65 78 70 | t.of.resources.used...For.an.exp |
| 22200 | 6f 6e 65 6e 74 69 61 6c 20 70 72 6f 63 65 73 73 2c 20 65 61 63 68 20 69 6e 63 72 65 6d 65 6e 74 | onential.process,.each.increment |
| 22220 | 0a 69 6e 20 70 72 6f 62 6c 65 6d 20 73 69 7a 65 20 77 69 6c 6c 20 6d 75 6c 74 69 70 6c 79 20 74 | .in.problem.size.will.multiply.t |
| 22240 | 68 65 20 72 65 73 6f 75 72 63 65 20 75 74 69 6c 69 7a 61 74 69 6f 6e 20 62 79 20 61 20 63 6f 6e | he.resource.utilization.by.a.con |
| 22260 | 73 74 61 6e 74 0a 66 61 63 74 6f 72 2e 20 20 49 6e 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 | stant.factor...In.the.remainder. |
| 22280 | 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 3a 3a 20 77 65 20 77 69 6c 6c 20 65 | of.section.*Note.1-2::.we.will.e |
| 222a0 | 78 61 6d 69 6e 65 20 74 77 6f 0a 61 6c 67 6f 72 69 74 68 6d 73 20 77 68 6f 73 65 20 6f 72 64 65 | xamine.two.algorithms.whose.orde |
| 222c0 | 72 20 6f 66 20 67 72 6f 77 74 68 20 69 73 20 6c 6f 67 61 72 69 74 68 6d 69 63 2c 20 73 6f 20 74 | r.of.growth.is.logarithmic,.so.t |
| 222e0 | 68 61 74 20 64 6f 75 62 6c 69 6e 67 20 74 68 65 0a 70 72 6f 62 6c 65 6d 20 73 69 7a 65 20 69 6e | hat.doubling.the.problem.size.in |
| 22300 | 63 72 65 61 73 65 73 20 74 68 65 20 72 65 73 6f 75 72 63 65 20 72 65 71 75 69 72 65 6d 65 6e 74 | creases.the.resource.requirement |
| 22320 | 20 62 79 20 61 20 63 6f 6e 73 74 61 6e 74 20 61 6d 6f 75 6e 74 2e 0a 0a 20 20 20 20 20 2a 45 78 | .by.a.constant.amount........*Ex |
| 22340 | 65 72 63 69 73 65 20 31 2e 31 34 3a 2a 20 44 72 61 77 20 74 68 65 20 74 72 65 65 20 69 6c 6c 75 | ercise.1.14:*.Draw.the.tree.illu |
| 22360 | 73 74 72 61 74 69 6e 67 20 74 68 65 20 70 72 6f 63 65 73 73 20 67 65 6e 65 72 61 74 65 64 0a 20 | strating.the.process.generated.. |
| 22380 | 20 20 20 20 62 79 20 74 68 65 20 60 63 6f 75 6e 74 2d 63 68 61 6e 67 65 27 20 70 72 6f 63 65 64 | ....by.the.`count-change'.proced |
| 223a0 | 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 32 3a 3a 20 69 6e 20 | ure.of.section.*Note.1-2-2::.in. |
| 223c0 | 6d 61 6b 69 6e 67 0a 20 20 20 20 20 63 68 61 6e 67 65 20 66 6f 72 20 31 31 20 63 65 6e 74 73 2e | making......change.for.11.cents. |
| 223e0 | 20 20 57 68 61 74 20 61 72 65 20 74 68 65 20 6f 72 64 65 72 73 20 6f 66 20 67 72 6f 77 74 68 20 | ..What.are.the.orders.of.growth. |
| 22400 | 6f 66 20 74 68 65 20 73 70 61 63 65 0a 20 20 20 20 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 | of.the.space......and.number.of. |
| 22420 | 73 74 65 70 73 20 75 73 65 64 20 62 79 20 74 68 69 73 20 70 72 6f 63 65 73 73 20 61 73 20 74 68 | steps.used.by.this.process.as.th |
| 22440 | 65 20 61 6d 6f 75 6e 74 20 74 6f 20 62 65 0a 20 20 20 20 20 63 68 61 6e 67 65 64 20 69 6e 63 72 | e.amount.to.be......changed.incr |
| 22460 | 65 61 73 65 73 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 31 35 3a 2a 20 54 68 | eases?.......*Exercise.1.15:*.Th |
| 22480 | 65 20 73 69 6e 65 20 6f 66 20 61 6e 20 61 6e 67 6c 65 20 28 73 70 65 63 69 66 69 65 64 20 69 6e | e.sine.of.an.angle.(specified.in |
| 224a0 | 20 72 61 64 69 61 6e 73 29 20 63 61 6e 0a 20 20 20 20 20 62 65 20 63 6f 6d 70 75 74 65 64 20 62 | .radians).can......be.computed.b |
| 224c0 | 79 20 6d 61 6b 69 6e 67 20 75 73 65 20 6f 66 20 74 68 65 20 61 70 70 72 6f 78 69 6d 61 74 69 6f | y.making.use.of.the.approximatio |
| 224e0 | 6e 20 60 73 69 6e 27 20 78 61 70 70 72 6f 78 20 78 20 69 66 0a 20 20 20 20 20 78 20 69 73 20 73 | n.`sin'.xapprox.x.if......x.is.s |
| 22500 | 75 66 66 69 63 69 65 6e 74 6c 79 20 73 6d 61 6c 6c 2c 20 61 6e 64 20 74 68 65 20 74 72 69 67 6f | ufficiently.small,.and.the.trigo |
| 22520 | 6e 6f 6d 65 74 72 69 63 20 69 64 65 6e 74 69 74 79 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | nometric.identity............... |
| 22540 | 20 20 20 20 20 20 20 20 20 20 20 20 78 20 20 20 20 20 20 20 20 20 20 20 20 20 78 0a 20 20 20 20 | ............x.............x..... |
| 22560 | 20 20 20 20 20 20 73 69 6e 20 78 20 3d 20 33 20 73 69 6e 20 2d 2d 2d 20 2d 20 34 20 73 69 6e 5e | ......sin.x.=.3.sin.---.-.4.sin^ |
| 22580 | 33 20 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 | 3.---..........................3 |
| 225a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 33 0a 0a 20 20 20 20 20 74 6f 20 72 65 64 75 63 65 20 74 | .............3.......to.reduce.t |
| 225c0 | 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 6f 66 20 60 73 69 6e 27 | he.size.of.the.argument.of.`sin' |
| 225e0 | 2e 20 20 28 46 6f 72 20 70 75 72 70 6f 73 65 73 20 6f 66 20 74 68 69 73 0a 20 20 20 20 20 65 78 | ...(For.purposes.of.this......ex |
| 22600 | 65 72 63 69 73 65 20 61 6e 20 61 6e 67 6c 65 20 69 73 20 63 6f 6e 73 69 64 65 72 65 64 20 22 73 | ercise.an.angle.is.considered."s |
| 22620 | 75 66 66 69 63 69 65 6e 74 6c 79 20 73 6d 61 6c 6c 22 20 69 66 20 69 74 73 0a 20 20 20 20 20 6d | ufficiently.small".if.its......m |
| 22640 | 61 67 6e 69 74 75 64 65 20 69 73 20 6e 6f 74 20 67 72 65 61 74 65 72 20 74 68 61 6e 20 30 2e 31 | agnitude.is.not.greater.than.0.1 |
| 22660 | 20 72 61 64 69 61 6e 73 2e 29 20 54 68 65 73 65 20 69 64 65 61 73 20 61 72 65 0a 20 20 20 20 20 | .radians.).These.ideas.are...... |
| 22680 | 69 6e 63 6f 72 70 6f 72 61 74 65 64 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 | incorporated.in.the.following.pr |
| 226a0 | 6f 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 75 | ocedures:............(define.(cu |
| 226c0 | 62 65 20 78 29 20 28 2a 20 78 20 78 20 78 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | be.x).(*.x.x.x))............(def |
| 226e0 | 69 6e 65 20 28 70 20 78 29 20 28 2d 20 28 2a 20 33 20 78 29 20 28 2a 20 34 20 28 63 75 62 65 20 | ine.(p.x).(-.(*.3.x).(*.4.(cube. |
| 22700 | 78 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 69 6e 65 20 61 | x))))............(define.(sine.a |
| 22720 | 6e 67 6c 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 3e 20 28 | ngle)..............(if.(not.(>.( |
| 22740 | 61 62 73 20 61 6e 67 6c 65 29 20 30 2e 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | abs.angle).0.1))................ |
| 22760 | 20 20 61 6e 67 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 20 28 73 69 6e | ..angle..................(p.(sin |
| 22780 | 65 20 28 2f 20 61 6e 67 6c 65 20 33 2e 30 29 29 29 29 29 0a 0a 20 20 20 20 20 20 20 61 2e 20 48 | e.(/.angle.3.0))))).........a..H |
| 227a0 | 6f 77 20 6d 61 6e 79 20 74 69 6d 65 73 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 | ow.many.times.is.the.procedure.` |
| 227c0 | 70 27 20 61 70 70 6c 69 65 64 20 77 68 65 6e 20 60 28 73 69 6e 65 0a 20 20 20 20 20 20 20 20 20 | p'.applied.when.`(sine.......... |
| 227e0 | 20 31 32 2e 31 35 29 27 20 69 73 20 65 76 61 6c 75 61 74 65 64 3f 0a 0a 20 20 20 20 20 20 20 62 | .12.15)'.is.evaluated?.........b |
| 22800 | 2e 20 57 68 61 74 20 69 73 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 67 72 6f 77 74 68 20 69 6e | ..What.is.the.order.of.growth.in |
| 22820 | 20 73 70 61 63 65 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 28 61 73 0a 20 | .space.and.number.of.steps.(as.. |
| 22840 | 20 20 20 20 20 20 20 20 20 61 20 66 75 6e 63 74 69 6f 6e 20 6f 66 20 61 29 20 75 73 65 64 20 62 | .........a.function.of.a).used.b |
| 22860 | 79 20 74 68 65 20 70 72 6f 63 65 73 73 20 67 65 6e 65 72 61 74 65 64 20 62 79 20 74 68 65 20 60 | y.the.process.generated.by.the.` |
| 22880 | 73 69 6e 65 27 0a 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 77 68 65 6e 20 60 | sine'...........procedure.when.` |
| 228a0 | 28 73 69 6e 65 20 61 29 27 20 69 73 20 65 76 61 6c 75 61 74 65 64 3f 0a 0a 0a 20 20 20 2d 2d 2d | (sine.a)'.is.evaluated?......--- |
| 228c0 | 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 | -------.Footnotes.----------.... |
| 228e0 | 20 28 31 29 20 54 68 65 73 65 20 73 74 61 74 65 6d 65 6e 74 73 20 6d 61 73 6b 20 61 20 67 72 65 | .(1).These.statements.mask.a.gre |
| 22900 | 61 74 20 64 65 61 6c 20 6f 66 20 6f 76 65 72 73 69 6d 70 6c 69 66 69 63 61 74 69 6f 6e 2e 20 20 | at.deal.of.oversimplification... |
| 22920 | 46 6f 72 0a 69 6e 73 74 61 6e 63 65 2c 20 69 66 20 77 65 20 63 6f 75 6e 74 20 70 72 6f 63 65 73 | For.instance,.if.we.count.proces |
| 22940 | 73 20 73 74 65 70 73 20 61 73 20 22 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 22 20 | s.steps.as."machine.operations". |
| 22960 | 77 65 20 61 72 65 0a 6d 61 6b 69 6e 67 20 74 68 65 20 61 73 73 75 6d 70 74 69 6f 6e 20 74 68 61 | we.are.making.the.assumption.tha |
| 22980 | 74 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f | t.the.number.of.machine.operatio |
| 229a0 | 6e 73 20 6e 65 65 64 65 64 20 74 6f 0a 70 65 72 66 6f 72 6d 2c 20 73 61 79 2c 20 61 20 6d 75 6c | ns.needed.to.perform,.say,.a.mul |
| 229c0 | 74 69 70 6c 69 63 61 74 69 6f 6e 20 69 73 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 | tiplication.is.independent.of.th |
| 229e0 | 65 20 73 69 7a 65 20 6f 66 20 74 68 65 0a 6e 75 6d 62 65 72 73 20 74 6f 20 62 65 20 6d 75 6c 74 | e.size.of.the.numbers.to.be.mult |
| 22a00 | 69 70 6c 69 65 64 2c 20 77 68 69 63 68 20 69 73 20 66 61 6c 73 65 20 69 66 20 74 68 65 20 6e 75 | iplied,.which.is.false.if.the.nu |
| 22a20 | 6d 62 65 72 73 20 61 72 65 0a 73 75 66 66 69 63 69 65 6e 74 6c 79 20 6c 61 72 67 65 2e 20 20 53 | mbers.are.sufficiently.large...S |
| 22a40 | 69 6d 69 6c 61 72 20 72 65 6d 61 72 6b 73 20 68 6f 6c 64 20 66 6f 72 20 74 68 65 20 65 73 74 69 | imilar.remarks.hold.for.the.esti |
| 22a60 | 6d 61 74 65 73 20 6f 66 20 73 70 61 63 65 2e 0a 4c 69 6b 65 20 74 68 65 20 64 65 73 69 67 6e 20 | mates.of.space..Like.the.design. |
| 22a80 | 61 6e 64 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 61 20 70 72 6f 63 65 73 73 2c 20 74 68 | and.description.of.a.process,.th |
| 22aa0 | 65 20 61 6e 61 6c 79 73 69 73 20 6f 66 20 61 20 70 72 6f 63 65 73 73 0a 63 61 6e 20 62 65 20 63 | e.analysis.of.a.process.can.be.c |
| 22ac0 | 61 72 72 69 65 64 20 6f 75 74 20 61 74 20 76 61 72 69 6f 75 73 20 6c 65 76 65 6c 73 20 6f 66 20 | arried.out.at.various.levels.of. |
| 22ae0 | 61 62 73 74 72 61 63 74 69 6f 6e 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c | abstraction.....File:.sicp.info, |
| 22b00 | 20 20 4e 6f 64 65 3a 20 31 2d 32 2d 34 2c 20 20 4e 65 78 74 3a 20 31 2d 32 2d 35 2c 20 20 50 72 | ..Node:.1-2-4,..Next:.1-2-5,..Pr |
| 22b20 | 65 76 3a 20 31 2d 32 2d 33 2c 20 20 55 70 3a 20 31 2d 32 0a 0a 31 2e 32 2e 34 20 45 78 70 6f 6e | ev:.1-2-3,..Up:.1-2..1.2.4.Expon |
| 22b40 | 65 6e 74 69 61 74 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a | entiation.--------------------.. |
| 22b60 | 43 6f 6e 73 69 64 65 72 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 63 6f 6d 70 75 74 69 6e | Consider.the.problem.of.computin |
| 22b80 | 67 20 74 68 65 20 65 78 70 6f 6e 65 6e 74 69 61 6c 20 6f 66 20 61 20 67 69 76 65 6e 20 6e 75 6d | g.the.exponential.of.a.given.num |
| 22ba0 | 62 65 72 2e 0a 57 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 | ber..We.would.like.a.procedure.t |
| 22bc0 | 68 61 74 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 20 62 61 73 65 20 62 20 | hat.takes.as.arguments.a.base.b. |
| 22be0 | 61 6e 64 20 61 0a 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 20 65 78 70 6f 6e 65 6e 74 20 | and.a.positive.integer.exponent. |
| 22c00 | 6e 20 61 6e 64 20 63 6f 6d 70 75 74 65 73 20 62 5e 6e 2e 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 | n.and.computes.b^n...One.way.to. |
| 22c20 | 64 6f 20 74 68 69 73 20 69 73 0a 76 69 61 20 74 68 65 20 72 65 63 75 72 73 69 76 65 20 64 65 66 | do.this.is.via.the.recursive.def |
| 22c40 | 69 6e 69 74 69 6f 6e 0a 0a 20 20 20 20 20 62 5e 6e 20 3d 20 62 20 2a 20 62 5e 28 6e 20 2d 20 31 | inition.......b^n.=.b.*.b^(n.-.1 |
| 22c60 | 29 0a 20 20 20 20 20 62 5e 30 20 3d 20 31 0a 0a 77 68 69 63 68 20 74 72 61 6e 73 6c 61 74 65 73 | )......b^0.=.1..which.translates |
| 22c80 | 20 72 65 61 64 69 6c 79 20 69 6e 74 6f 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 | .readily.into.the.procedure..... |
| 22ca0 | 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 74 20 62 20 6e 29 0a 20 20 20 20 20 20 20 28 69 66 20 | ..(define.(expt.b.n)........(if. |
| 22cc0 | 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 | (=.n.0)............1............ |
| 22ce0 | 28 2a 20 62 20 28 65 78 70 74 20 62 20 28 2d 20 6e 20 31 29 29 29 29 29 0a 0a 20 20 20 54 68 69 | (*.b.(expt.b.(-.n.1))))).....Thi |
| 22d00 | 73 20 69 73 20 61 20 6c 69 6e 65 61 72 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 2c | s.is.a.linear.recursive.process, |
| 22d20 | 20 77 68 69 63 68 20 72 65 71 75 69 72 65 73 20 5b 74 68 65 74 61 5d 28 6e 29 20 73 74 65 70 73 | .which.requires.[theta](n).steps |
| 22d40 | 0a 61 6e 64 20 5b 74 68 65 74 61 5d 28 6e 29 20 73 70 61 63 65 2e 20 20 4a 75 73 74 20 61 73 20 | .and.[theta](n).space...Just.as. |
| 22d60 | 77 69 74 68 20 66 61 63 74 6f 72 69 61 6c 2c 20 77 65 20 63 61 6e 20 72 65 61 64 69 6c 79 20 66 | with.factorial,.we.can.readily.f |
| 22d80 | 6f 72 6d 75 6c 61 74 65 0a 61 6e 20 65 71 75 69 76 61 6c 65 6e 74 20 6c 69 6e 65 61 72 20 69 74 | ormulate.an.equivalent.linear.it |
| 22da0 | 65 72 61 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 74 20 62 20 6e | eration:.......(define.(expt.b.n |
| 22dc0 | 29 0a 20 20 20 20 20 20 20 28 65 78 70 74 2d 69 74 65 72 20 62 20 6e 20 31 29 29 0a 0a 20 20 20 | )........(expt-iter.b.n.1))..... |
| 22de0 | 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 74 2d 69 74 65 72 20 62 20 63 6f 75 6e 74 65 72 20 70 | ..(define.(expt-iter.b.counter.p |
| 22e00 | 72 6f 64 75 63 74 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 63 6f 75 6e 74 65 72 20 30 29 | roduct)........(if.(=.counter.0) |
| 22e20 | 0a 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 20 20 20 20 28 | ............product............( |
| 22e40 | 65 78 70 74 2d 69 74 65 72 20 62 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | expt-iter.b..................... |
| 22e60 | 20 28 2d 20 63 6f 75 6e 74 65 72 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(-.counter.1).................. |
| 22e80 | 20 20 20 20 28 2a 20 62 20 70 72 6f 64 75 63 74 29 29 29 29 0a 0a 20 20 20 54 68 69 73 20 76 65 | ....(*.b.product)))).....This.ve |
| 22ea0 | 72 73 69 6f 6e 20 72 65 71 75 69 72 65 73 20 5b 74 68 65 74 61 5d 28 6e 29 20 73 74 65 70 73 20 | rsion.requires.[theta](n).steps. |
| 22ec0 | 61 6e 64 20 5b 74 68 65 74 61 5d 28 31 29 20 73 70 61 63 65 2e 0a 0a 20 20 20 57 65 20 63 61 6e | and.[theta](1).space......We.can |
| 22ee0 | 20 63 6f 6d 70 75 74 65 20 65 78 70 6f 6e 65 6e 74 69 61 6c 73 20 69 6e 20 66 65 77 65 72 20 73 | .compute.exponentials.in.fewer.s |
| 22f00 | 74 65 70 73 20 62 79 20 75 73 69 6e 67 20 73 75 63 63 65 73 73 69 76 65 0a 73 71 75 61 72 69 6e | teps.by.using.successive.squarin |
| 22f20 | 67 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 63 6f | g...For.instance,.rather.than.co |
| 22f40 | 6d 70 75 74 69 6e 67 20 62 5e 38 20 61 73 0a 0a 20 20 20 20 20 62 20 2a 20 28 62 20 2a 20 28 62 | mputing.b^8.as.......b.*.(b.*.(b |
| 22f60 | 20 2a 20 28 62 20 2a 20 28 62 20 2a 20 28 62 20 2a 20 28 62 20 2a 20 62 29 29 29 29 29 29 0a 0a | .*.(b.*.(b.*.(b.*.(b.*.b)))))).. |
| 22f80 | 77 65 20 63 61 6e 20 63 6f 6d 70 75 74 65 20 69 74 20 75 73 69 6e 67 20 74 68 72 65 65 20 6d 75 | we.can.compute.it.using.three.mu |
| 22fa0 | 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 62 5e 32 20 3d 20 62 20 2a 20 62 | ltiplications:.......b^2.=.b.*.b |
| 22fc0 | 0a 20 20 20 20 20 62 5e 34 20 3d 20 62 5e 32 20 2a 20 62 5e 32 0a 20 20 20 20 20 62 5e 38 20 3d | ......b^4.=.b^2.*.b^2......b^8.= |
| 22fe0 | 20 62 5e 34 20 2a 20 62 5e 34 0a 0a 20 20 20 54 68 69 73 20 6d 65 74 68 6f 64 20 77 6f 72 6b 73 | .b^4.*.b^4.....This.method.works |
| 23000 | 20 66 69 6e 65 20 66 6f 72 20 65 78 70 6f 6e 65 6e 74 73 20 74 68 61 74 20 61 72 65 20 70 6f 77 | .fine.for.exponents.that.are.pow |
| 23020 | 65 72 73 20 6f 66 20 32 2e 20 20 57 65 20 63 61 6e 0a 61 6c 73 6f 20 74 61 6b 65 20 61 64 76 61 | ers.of.2...We.can.also.take.adva |
| 23040 | 6e 74 61 67 65 20 6f 66 20 73 75 63 63 65 73 73 69 76 65 20 73 71 75 61 72 69 6e 67 20 69 6e 20 | ntage.of.successive.squaring.in. |
| 23060 | 63 6f 6d 70 75 74 69 6e 67 20 65 78 70 6f 6e 65 6e 74 69 61 6c 73 20 69 6e 0a 67 65 6e 65 72 61 | computing.exponentials.in.genera |
| 23080 | 6c 20 69 66 20 77 65 20 75 73 65 20 74 68 65 20 72 75 6c 65 0a 0a 20 20 20 20 20 62 5e 6e 20 3d | l.if.we.use.the.rule.......b^n.= |
| 230a0 | 20 28 62 5e 28 62 2f 32 29 29 5e 32 20 20 20 20 69 66 20 6e 20 69 73 20 65 76 65 6e 0a 20 20 20 | .(b^(b/2))^2....if.n.is.even.... |
| 230c0 | 20 20 62 5e 6e 20 3d 20 62 20 2a 20 62 5e 28 6e 20 2d 20 31 29 20 20 69 66 20 6e 20 69 73 20 6f | ..b^n.=.b.*.b^(n.-.1)..if.n.is.o |
| 230e0 | 64 64 0a 0a 20 20 20 57 65 20 63 61 6e 20 65 78 70 72 65 73 73 20 74 68 69 73 20 6d 65 74 68 6f | dd.....We.can.express.this.metho |
| 23100 | 64 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | d.as.a.procedure:.......(define. |
| 23120 | 28 66 61 73 74 2d 65 78 70 74 20 62 20 6e 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d | (fast-expt.b.n)........(cond.((= |
| 23140 | 20 6e 20 30 29 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 76 65 6e 3f 20 6e 29 | .n.0).1)..............((even?.n) |
| 23160 | 20 28 73 71 75 61 72 65 20 28 66 61 73 74 2d 65 78 70 74 20 62 20 28 2f 20 6e 20 32 29 29 29 29 | .(square.(fast-expt.b.(/.n.2)))) |
| 23180 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 2a 20 62 20 28 66 61 73 74 2d 65 | ..............(else.(*.b.(fast-e |
| 231a0 | 78 70 74 20 62 20 28 2d 20 6e 20 31 29 29 29 29 29 29 0a 0a 77 68 65 72 65 20 74 68 65 20 70 72 | xpt.b.(-.n.1))))))..where.the.pr |
| 231c0 | 65 64 69 63 61 74 65 20 74 6f 20 74 65 73 74 20 77 68 65 74 68 65 72 20 61 6e 20 69 6e 74 65 67 | edicate.to.test.whether.an.integ |
| 231e0 | 65 72 20 69 73 20 65 76 65 6e 20 69 73 20 64 65 66 69 6e 65 64 20 69 6e 0a 74 65 72 6d 73 20 6f | er.is.even.is.defined.in.terms.o |
| 23200 | 66 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 60 72 65 6d 61 69 | f.the.primitive.procedure.`remai |
| 23220 | 6e 64 65 72 27 20 62 79 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 65 6e 3f 20 6e 29 | nder'.by.......(define.(even?.n) |
| 23240 | 0a 20 20 20 20 20 20 20 28 3d 20 28 72 65 6d 61 69 6e 64 65 72 20 6e 20 32 29 20 30 29 29 0a 0a | ........(=.(remainder.n.2).0)).. |
| 23260 | 20 20 20 54 68 65 20 70 72 6f 63 65 73 73 20 65 76 6f 6c 76 65 64 20 62 79 20 60 66 61 73 74 2d | ...The.process.evolved.by.`fast- |
| 23280 | 65 78 70 74 27 20 67 72 6f 77 73 20 6c 6f 67 61 72 69 74 68 6d 69 63 61 6c 6c 79 20 77 69 74 68 | expt'.grows.logarithmically.with |
| 232a0 | 20 6e 20 69 6e 0a 62 6f 74 68 20 73 70 61 63 65 20 61 6e 64 20 6e 75 6d 62 65 72 20 6f 66 20 73 | .n.in.both.space.and.number.of.s |
| 232c0 | 74 65 70 73 2e 20 20 54 6f 20 73 65 65 20 74 68 69 73 2c 20 6f 62 73 65 72 76 65 20 74 68 61 74 | teps...To.see.this,.observe.that |
| 232e0 | 20 63 6f 6d 70 75 74 69 6e 67 0a 62 5e 28 32 6e 29 20 75 73 69 6e 67 20 60 66 61 73 74 2d 65 78 | .computing.b^(2n).using.`fast-ex |
| 23300 | 70 74 27 20 72 65 71 75 69 72 65 73 20 6f 6e 6c 79 20 6f 6e 65 20 6d 6f 72 65 20 6d 75 6c 74 69 | pt'.requires.only.one.more.multi |
| 23320 | 70 6c 69 63 61 74 69 6f 6e 20 74 68 61 6e 0a 63 6f 6d 70 75 74 69 6e 67 20 62 5e 6e 2e 20 20 54 | plication.than.computing.b^n...T |
| 23340 | 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 65 78 70 6f 6e 65 6e 74 20 77 65 20 63 61 6e 20 63 | he.size.of.the.exponent.we.can.c |
| 23360 | 6f 6d 70 75 74 65 20 74 68 65 72 65 66 6f 72 65 0a 64 6f 75 62 6c 65 73 20 28 61 70 70 72 6f 78 | ompute.therefore.doubles.(approx |
| 23380 | 69 6d 61 74 65 6c 79 29 20 77 69 74 68 20 65 76 65 72 79 20 6e 65 77 20 6d 75 6c 74 69 70 6c 69 | imately).with.every.new.multipli |
| 233a0 | 63 61 74 69 6f 6e 20 77 65 20 61 72 65 20 61 6c 6c 6f 77 65 64 2e 0a 54 68 75 73 2c 20 74 68 65 | cation.we.are.allowed..Thus,.the |
| 233c0 | 20 6e 75 6d 62 65 72 20 6f 66 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 20 72 65 71 75 69 | .number.of.multiplications.requi |
| 233e0 | 72 65 64 20 66 6f 72 20 61 6e 20 65 78 70 6f 6e 65 6e 74 20 6f 66 20 6e 20 67 72 6f 77 73 0a 61 | red.for.an.exponent.of.n.grows.a |
| 23400 | 62 6f 75 74 20 61 73 20 66 61 73 74 20 61 73 20 74 68 65 20 6c 6f 67 61 72 69 74 68 6d 20 6f 66 | bout.as.fast.as.the.logarithm.of |
| 23420 | 20 6e 20 74 6f 20 74 68 65 20 62 61 73 65 20 32 2e 20 20 54 68 65 20 70 72 6f 63 65 73 73 20 68 | .n.to.the.base.2...The.process.h |
| 23440 | 61 73 0a 5b 74 68 65 74 61 5d 28 60 6c 6f 67 27 20 6e 29 20 67 72 6f 77 74 68 2e 28 31 29 0a 0a | as.[theta](`log'.n).growth.(1).. |
| 23460 | 20 20 20 54 68 65 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 5b 74 68 65 74 61 | ...The.difference.between.[theta |
| 23480 | 5d 28 60 6c 6f 67 27 20 6e 29 20 67 72 6f 77 74 68 20 61 6e 64 20 5b 74 68 65 74 61 5d 28 6e 29 | ](`log'.n).growth.and.[theta](n) |
| 234a0 | 20 67 72 6f 77 74 68 0a 62 65 63 6f 6d 65 73 20 73 74 72 69 6b 69 6e 67 20 61 73 20 6e 20 62 65 | .growth.becomes.striking.as.n.be |
| 234c0 | 63 6f 6d 65 73 20 6c 61 72 67 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 60 66 61 73 74 | comes.large...For.example,.`fast |
| 234e0 | 2d 65 78 70 74 27 20 66 6f 72 20 6e 20 3d 0a 31 30 30 30 20 72 65 71 75 69 72 65 73 20 6f 6e 6c | -expt'.for.n.=.1000.requires.onl |
| 23500 | 79 20 31 34 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 2e 28 32 29 20 49 74 20 69 73 20 61 | y.14.multiplications.(2).It.is.a |
| 23520 | 6c 73 6f 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 75 73 65 0a 74 68 65 20 69 64 65 61 20 6f 66 20 | lso.possible.to.use.the.idea.of. |
| 23540 | 73 75 63 63 65 73 73 69 76 65 20 73 71 75 61 72 69 6e 67 20 74 6f 20 64 65 76 69 73 65 20 61 6e | successive.squaring.to.devise.an |
| 23560 | 20 69 74 65 72 61 74 69 76 65 20 61 6c 67 6f 72 69 74 68 6d 20 74 68 61 74 0a 63 6f 6d 70 75 74 | .iterative.algorithm.that.comput |
| 23580 | 65 73 20 65 78 70 6f 6e 65 6e 74 69 61 6c 73 20 77 69 74 68 20 61 20 6c 6f 67 61 72 69 74 68 6d | es.exponentials.with.a.logarithm |
| 235a0 | 69 63 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 28 73 65 65 20 2a 4e 6f 74 65 0a 45 78 | ic.number.of.steps.(see.*Note.Ex |
| 235c0 | 65 72 63 69 73 65 20 31 2d 31 36 3a 3a 29 2c 20 61 6c 74 68 6f 75 67 68 2c 20 61 73 20 69 73 20 | ercise.1-16::),.although,.as.is. |
| 235e0 | 6f 66 74 65 6e 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20 69 74 65 72 61 74 69 76 65 0a 61 6c | often.the.case.with.iterative.al |
| 23600 | 67 6f 72 69 74 68 6d 73 2c 20 74 68 69 73 20 69 73 20 6e 6f 74 20 77 72 69 74 74 65 6e 20 64 6f | gorithms,.this.is.not.written.do |
| 23620 | 77 6e 20 73 6f 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 6c 79 20 61 73 20 74 68 65 0a 72 | wn.so.straightforwardly.as.the.r |
| 23640 | 65 63 75 72 73 69 76 65 20 61 6c 67 6f 72 69 74 68 6d 2e 28 33 29 0a 0a 20 20 20 20 20 2a 45 78 | ecursive.algorithm.(3).......*Ex |
| 23660 | 65 72 63 69 73 65 20 31 2e 31 36 3a 2a 20 44 65 73 69 67 6e 20 61 20 70 72 6f 63 65 64 75 72 65 | ercise.1.16:*.Design.a.procedure |
| 23680 | 20 74 68 61 74 20 65 76 6f 6c 76 65 73 20 61 6e 20 69 74 65 72 61 74 69 76 65 0a 20 20 20 20 20 | .that.evolves.an.iterative...... |
| 236a0 | 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 74 68 61 74 20 75 73 65 73 | exponentiation.process.that.uses |
| 236c0 | 20 73 75 63 63 65 73 73 69 76 65 20 73 71 75 61 72 69 6e 67 20 61 6e 64 20 75 73 65 73 20 61 0a | .successive.squaring.and.uses.a. |
| 236e0 | 20 20 20 20 20 6c 6f 67 61 72 69 74 68 6d 69 63 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 | .....logarithmic.number.of.steps |
| 23700 | 2c 20 61 73 20 64 6f 65 73 20 60 66 61 73 74 2d 65 78 70 74 27 2e 20 20 28 48 69 6e 74 3a 20 55 | ,.as.does.`fast-expt'...(Hint:.U |
| 23720 | 73 69 6e 67 20 74 68 65 0a 20 20 20 20 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 74 68 61 74 20 28 | sing.the......observation.that.( |
| 23740 | 62 5e 28 6e 2f 32 29 29 5e 32 20 3d 20 28 62 5e 32 29 5e 28 6e 2f 32 29 2c 20 6b 65 65 70 2c 20 | b^(n/2))^2.=.(b^2)^(n/2),.keep,. |
| 23760 | 61 6c 6f 6e 67 20 77 69 74 68 20 74 68 65 0a 20 20 20 20 20 65 78 70 6f 6e 65 6e 74 20 6e 20 61 | along.with.the......exponent.n.a |
| 23780 | 6e 64 20 74 68 65 20 62 61 73 65 20 62 2c 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 6c 20 73 74 61 | nd.the.base.b,.an.additional.sta |
| 237a0 | 74 65 20 76 61 72 69 61 62 6c 65 20 61 2c 20 61 6e 64 0a 20 20 20 20 20 64 65 66 69 6e 65 20 74 | te.variable.a,.and......define.t |
| 237c0 | 68 65 20 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 20 73 75 63 68 20 | he.state.transformation.in.such. |
| 237e0 | 61 20 77 61 79 20 74 68 61 74 20 74 68 65 20 70 72 6f 64 75 63 74 20 61 0a 20 20 20 20 20 62 5e | a.way.that.the.product.a......b^ |
| 23800 | 6e 20 69 73 20 75 6e 63 68 61 6e 67 65 64 20 66 72 6f 6d 20 73 74 61 74 65 20 74 6f 20 73 74 61 | n.is.unchanged.from.state.to.sta |
| 23820 | 74 65 2e 20 20 41 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65 0a 20 20 20 | te...At.the.beginning.of.the.... |
| 23840 | 20 20 70 72 6f 63 65 73 73 20 61 20 69 73 20 74 61 6b 65 6e 20 74 6f 20 62 65 20 31 2c 20 61 6e | ..process.a.is.taken.to.be.1,.an |
| 23860 | 64 20 74 68 65 20 61 6e 73 77 65 72 20 69 73 20 67 69 76 65 6e 20 62 79 20 74 68 65 20 76 61 6c | d.the.answer.is.given.by.the.val |
| 23880 | 75 65 0a 20 20 20 20 20 6f 66 20 61 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 70 | ue......of.a.at.the.end.of.the.p |
| 238a0 | 72 6f 63 65 73 73 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 74 68 65 20 74 65 63 68 6e 69 71 | rocess...In.general,.the.techniq |
| 238c0 | 75 65 20 6f 66 0a 20 20 20 20 20 64 65 66 69 6e 69 6e 67 20 61 6e 20 22 69 6e 76 61 72 69 61 6e | ue.of......defining.an."invarian |
| 238e0 | 74 20 71 75 61 6e 74 69 74 79 22 20 74 68 61 74 20 72 65 6d 61 69 6e 73 20 75 6e 63 68 61 6e 67 | t.quantity".that.remains.unchang |
| 23900 | 65 64 20 66 72 6f 6d 20 73 74 61 74 65 0a 20 20 20 20 20 74 6f 20 73 74 61 74 65 20 69 73 20 61 | ed.from.state......to.state.is.a |
| 23920 | 20 70 6f 77 65 72 66 75 6c 20 77 61 79 20 74 6f 20 74 68 69 6e 6b 20 61 62 6f 75 74 20 74 68 65 | .powerful.way.to.think.about.the |
| 23940 | 20 64 65 73 69 67 6e 20 6f 66 20 69 74 65 72 61 74 69 76 65 0a 20 20 20 20 20 61 6c 67 6f 72 69 | .design.of.iterative......algori |
| 23960 | 74 68 6d 73 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 31 37 3a 2a 20 54 68 | thms.).......*Exercise.1.17:*.Th |
| 23980 | 65 20 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 73 20 69 6e 20 74 | e.exponentiation.algorithms.in.t |
| 239a0 | 68 69 73 20 73 65 63 74 69 6f 6e 20 61 72 65 0a 20 20 20 20 20 62 61 73 65 64 20 6f 6e 20 70 65 | his.section.are......based.on.pe |
| 239c0 | 72 66 6f 72 6d 69 6e 67 20 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 20 62 79 20 6d 65 61 6e 73 | rforming.exponentiation.by.means |
| 239e0 | 20 6f 66 20 72 65 70 65 61 74 65 64 0a 20 20 20 20 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e | .of.repeated......multiplication |
| 23a00 | 2e 20 20 49 6e 20 61 20 73 69 6d 69 6c 61 72 20 77 61 79 2c 20 6f 6e 65 20 63 61 6e 20 70 65 72 | ...In.a.similar.way,.one.can.per |
| 23a20 | 66 6f 72 6d 20 69 6e 74 65 67 65 72 0a 20 20 20 20 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e | form.integer......multiplication |
| 23a40 | 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 72 65 70 65 61 74 65 64 20 61 64 64 69 74 69 6f 6e 2e 20 | .by.means.of.repeated.addition.. |
| 23a60 | 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 20 20 20 20 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 | .The.following......multiplicati |
| 23a80 | 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 28 69 6e 20 77 68 69 63 68 20 69 74 20 69 73 20 61 73 73 | on.procedure.(in.which.it.is.ass |
| 23aa0 | 75 6d 65 64 20 74 68 61 74 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 0a 20 20 20 20 20 63 61 6e 20 | umed.that.our.language......can. |
| 23ac0 | 6f 6e 6c 79 20 61 64 64 2c 20 6e 6f 74 20 6d 75 6c 74 69 70 6c 79 29 20 69 73 20 61 6e 61 6c 6f | only.add,.not.multiply).is.analo |
| 23ae0 | 67 6f 75 73 20 74 6f 20 74 68 65 20 60 65 78 70 74 27 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 | gous.to.the.`expt'.procedure:... |
| 23b00 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 2a 20 61 20 62 29 0a 20 20 20 20 20 20 20 | .........(define.(*.a.b)........ |
| 23b20 | 20 20 20 20 20 28 69 66 20 28 3d 20 62 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....(if.(=.b.0)................ |
| 23b40 | 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 61 20 28 2a 20 61 20 28 2d 20 | .0.................(+.a.(*.a.(-. |
| 23b60 | 62 20 31 29 29 29 29 29 0a 0a 20 20 20 20 20 54 68 69 73 20 61 6c 67 6f 72 69 74 68 6d 20 74 61 | b.1))))).......This.algorithm.ta |
| 23b80 | 6b 65 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 74 68 61 74 20 69 73 20 6c 69 | kes.a.number.of.steps.that.is.li |
| 23ba0 | 6e 65 61 72 20 69 6e 20 60 62 27 2e 20 20 4e 6f 77 0a 20 20 20 20 20 73 75 70 70 6f 73 65 20 77 | near.in.`b'...Now......suppose.w |
| 23bc0 | 65 20 69 6e 63 6c 75 64 65 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 64 64 69 74 69 6f | e.include,.together.with.additio |
| 23be0 | 6e 2c 20 6f 70 65 72 61 74 69 6f 6e 73 20 60 64 6f 75 62 6c 65 27 2c 0a 20 20 20 20 20 77 68 69 | n,.operations.`double',......whi |
| 23c00 | 63 68 20 64 6f 75 62 6c 65 73 20 61 6e 20 69 6e 74 65 67 65 72 2c 20 61 6e 64 20 60 68 61 6c 76 | ch.doubles.an.integer,.and.`halv |
| 23c20 | 65 27 2c 20 77 68 69 63 68 20 64 69 76 69 64 65 73 20 61 6e 20 28 65 76 65 6e 29 0a 20 20 20 20 | e',.which.divides.an.(even)..... |
| 23c40 | 20 69 6e 74 65 67 65 72 20 62 79 20 32 2e 20 20 55 73 69 6e 67 20 74 68 65 73 65 2c 20 64 65 73 | .integer.by.2...Using.these,.des |
| 23c60 | 69 67 6e 20 61 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 0a 20 | ign.a.multiplication.procedure.. |
| 23c80 | 20 20 20 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 60 66 61 73 74 2d 65 78 70 74 27 20 74 68 61 | ....analogous.to.`fast-expt'.tha |
| 23ca0 | 74 20 75 73 65 73 20 61 20 6c 6f 67 61 72 69 74 68 6d 69 63 20 6e 75 6d 62 65 72 20 6f 66 20 73 | t.uses.a.logarithmic.number.of.s |
| 23cc0 | 74 65 70 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 31 38 3a 2a 20 55 73 69 | teps........*Exercise.1.18:*.Usi |
| 23ce0 | 6e 67 20 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | ng.the.results.of.*Note.Exercise |
| 23d00 | 20 31 2d 31 36 3a 3a 20 61 6e 64 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 | .1-16::.and......*Note.Exercise. |
| 23d20 | 31 2d 31 37 3a 3a 2c 20 64 65 76 69 73 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 | 1-17::,.devise.a.procedure.that. |
| 23d40 | 67 65 6e 65 72 61 74 65 73 20 61 6e 0a 20 20 20 20 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 | generates.an......iterative.proc |
| 23d60 | 65 73 73 20 66 6f 72 20 6d 75 6c 74 69 70 6c 79 69 6e 67 20 74 77 6f 20 69 6e 74 65 67 65 72 73 | ess.for.multiplying.two.integers |
| 23d80 | 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 61 64 64 69 6e 67 2c 0a 20 20 20 20 20 64 6f 75 62 6c 69 | .in.terms.of.adding,......doubli |
| 23da0 | 6e 67 2c 20 61 6e 64 20 68 61 6c 76 69 6e 67 20 61 6e 64 20 75 73 65 73 20 61 20 6c 6f 67 61 72 | ng,.and.halving.and.uses.a.logar |
| 23dc0 | 69 74 68 6d 69 63 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 2e 28 34 29 0a 0a 20 20 20 20 | ithmic.number.of.steps.(4)...... |
| 23de0 | 20 2a 45 78 65 72 63 69 73 65 20 31 2e 31 39 3a 2a 20 54 68 65 72 65 20 69 73 20 61 20 63 6c 65 | .*Exercise.1.19:*.There.is.a.cle |
| 23e00 | 76 65 72 20 61 6c 67 6f 72 69 74 68 6d 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 0a | ver.algorithm.for.computing.the. |
| 23e20 | 20 20 20 20 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 20 69 6e 20 61 20 6c 6f 67 61 | .....Fibonacci.numbers.in.a.loga |
| 23e40 | 72 69 74 68 6d 69 63 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 2e 20 20 52 65 63 61 6c 6c | rithmic.number.of.steps...Recall |
| 23e60 | 20 74 68 65 0a 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 | .the......transformation.of.the. |
| 23e80 | 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 20 61 20 61 6e 64 20 62 20 69 6e 20 74 68 65 20 60 | state.variables.a.and.b.in.the.` |
| 23ea0 | 66 69 62 2d 69 74 65 72 27 0a 20 20 20 20 20 70 72 6f 63 65 73 73 20 6f 66 20 73 65 63 74 69 6f | fib-iter'......process.of.sectio |
| 23ec0 | 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 32 3a 3a 3a 20 61 20 3c 2d 20 61 20 2b 20 62 20 61 6e 64 20 | n.*Note.1-2-2:::.a.<-.a.+.b.and. |
| 23ee0 | 62 20 3c 2d 20 61 2e 20 20 43 61 6c 6c 0a 20 20 20 20 20 74 68 69 73 20 74 72 61 6e 73 66 6f 72 | b.<-.a...Call......this.transfor |
| 23f00 | 6d 61 74 69 6f 6e 20 54 2c 20 61 6e 64 20 6f 62 73 65 72 76 65 20 74 68 61 74 20 61 70 70 6c 79 | mation.T,.and.observe.that.apply |
| 23f20 | 69 6e 67 20 54 20 6f 76 65 72 20 61 6e 64 20 6f 76 65 72 0a 20 20 20 20 20 61 67 61 69 6e 20 6e | ing.T.over.and.over......again.n |
| 23f40 | 20 74 69 6d 65 73 2c 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 31 20 61 6e 64 20 30 2c 20 70 | .times,.starting.with.1.and.0,.p |
| 23f60 | 72 6f 64 75 63 65 73 20 74 68 65 20 70 61 69 72 20 5f 46 69 62 5f 28 6e 20 2b 0a 20 20 20 20 20 | roduces.the.pair._Fib_(n.+...... |
| 23f80 | 31 29 20 61 6e 64 20 5f 46 69 62 5f 28 6e 29 2e 20 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 | 1).and._Fib_(n)...In.other.words |
| 23fa0 | 2c 20 74 68 65 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 20 61 72 65 0a 20 20 20 20 | ,.the.Fibonacci.numbers.are..... |
| 23fc0 | 20 70 72 6f 64 75 63 65 64 20 62 79 20 61 70 70 6c 79 69 6e 67 20 54 5e 6e 2c 20 74 68 65 20 6e | .produced.by.applying.T^n,.the.n |
| 23fe0 | 74 68 20 70 6f 77 65 72 20 6f 66 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 54 | th.power.of.the.transformation.T |
| 24000 | 2c 0a 20 20 20 20 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 74 68 65 20 70 61 69 72 20 28 31 | ,......starting.with.the.pair.(1 |
| 24020 | 2c 30 29 2e 20 20 4e 6f 77 20 63 6f 6e 73 69 64 65 72 20 54 20 74 6f 20 62 65 20 74 68 65 20 73 | ,0)...Now.consider.T.to.be.the.s |
| 24040 | 70 65 63 69 61 6c 0a 20 20 20 20 20 63 61 73 65 20 6f 66 20 70 20 3d 20 30 20 61 6e 64 20 71 20 | pecial......case.of.p.=.0.and.q. |
| 24060 | 3d 20 31 20 69 6e 20 61 20 66 61 6d 69 6c 79 20 6f 66 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f | =.1.in.a.family.of.transformatio |
| 24080 | 6e 73 20 54 5f 28 70 71 29 2c 0a 20 20 20 20 20 77 68 65 72 65 20 54 5f 28 70 71 29 20 74 72 61 | ns.T_(pq),......where.T_(pq).tra |
| 240a0 | 6e 73 66 6f 72 6d 73 20 74 68 65 20 70 61 69 72 20 28 61 2c 62 29 20 61 63 63 6f 72 64 69 6e 67 | nsforms.the.pair.(a,b).according |
| 240c0 | 20 74 6f 20 61 20 3c 2d 20 62 71 20 2b 20 61 71 20 2b 0a 20 20 20 20 20 61 70 20 61 6e 64 20 62 | .to.a.<-.bq.+.aq.+......ap.and.b |
| 240e0 | 20 3c 2d 20 62 70 20 2b 20 61 71 2e 20 20 53 68 6f 77 20 74 68 61 74 20 69 66 20 77 65 20 61 70 | .<-.bp.+.aq...Show.that.if.we.ap |
| 24100 | 70 6c 79 20 73 75 63 68 20 61 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 0a 20 20 20 20 20 54 | ply.such.a.transformation......T |
| 24120 | 5f 28 70 71 29 20 74 77 69 63 65 2c 20 74 68 65 20 65 66 66 65 63 74 20 69 73 20 74 68 65 20 73 | _(pq).twice,.the.effect.is.the.s |
| 24140 | 61 6d 65 20 61 73 20 75 73 69 6e 67 20 61 20 73 69 6e 67 6c 65 0a 20 20 20 20 20 74 72 61 6e 73 | ame.as.using.a.single......trans |
| 24160 | 66 6f 72 6d 61 74 69 6f 6e 20 54 5f 28 70 27 71 27 29 20 6f 66 20 74 68 65 20 73 61 6d 65 20 66 | formation.T_(p'q').of.the.same.f |
| 24180 | 6f 72 6d 2c 20 61 6e 64 20 63 6f 6d 70 75 74 65 20 70 27 20 61 6e 64 20 71 27 20 69 6e 0a 20 20 | orm,.and.compute.p'.and.q'.in... |
| 241a0 | 20 20 20 74 65 72 6d 73 20 6f 66 20 70 20 61 6e 64 20 71 2e 20 20 54 68 69 73 20 67 69 76 65 73 | ...terms.of.p.and.q...This.gives |
| 241c0 | 20 75 73 20 61 6e 20 65 78 70 6c 69 63 69 74 20 77 61 79 20 74 6f 20 73 71 75 61 72 65 20 74 68 | .us.an.explicit.way.to.square.th |
| 241e0 | 65 73 65 0a 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 73 2c 20 61 6e 64 20 74 68 | ese......transformations,.and.th |
| 24200 | 75 73 20 77 65 20 63 61 6e 20 63 6f 6d 70 75 74 65 20 54 5e 6e 20 75 73 69 6e 67 20 73 75 63 63 | us.we.can.compute.T^n.using.succ |
| 24220 | 65 73 73 69 76 65 0a 20 20 20 20 20 73 71 75 61 72 69 6e 67 2c 20 61 73 20 69 6e 20 74 68 65 20 | essive......squaring,.as.in.the. |
| 24240 | 60 66 61 73 74 2d 65 78 70 74 27 20 70 72 6f 63 65 64 75 72 65 2e 20 20 50 75 74 20 74 68 69 73 | `fast-expt'.procedure...Put.this |
| 24260 | 20 61 6c 6c 20 74 6f 67 65 74 68 65 72 0a 20 20 20 20 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 74 | .all.together......to.complete.t |
| 24280 | 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 72 75 | he.following.procedure,.which.ru |
| 242a0 | 6e 73 20 69 6e 20 61 20 6c 6f 67 61 72 69 74 68 6d 69 63 0a 20 20 20 20 20 6e 75 6d 62 65 72 20 | ns.in.a.logarithmic......number. |
| 242c0 | 6f 66 20 73 74 65 70 73 3a 28 35 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | of.steps:(5)............(define. |
| 242e0 | 28 66 69 62 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 62 2d 69 74 65 72 20 31 20 | (fib.n).............(fib-iter.1. |
| 24300 | 30 20 30 20 31 20 6e 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 | 0.0.1.n))............(define.(fi |
| 24320 | 62 2d 69 74 65 72 20 61 20 62 20 70 20 71 20 63 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 | b-iter.a.b.p.q.count)........... |
| 24340 | 20 20 28 63 6f 6e 64 20 28 28 3d 20 63 6f 75 6e 74 20 30 29 20 62 29 0a 20 20 20 20 20 20 20 20 | ..(cond.((=.count.0).b)......... |
| 24360 | 20 20 20 20 20 20 20 20 20 20 28 28 65 76 65 6e 3f 20 63 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 | ..........((even?.count)........ |
| 24380 | 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 62 2d 69 74 65 72 20 61 0a 20 20 20 20 20 20 20 20 | ............(fib-iter.a......... |
| 243a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 0a 20 20 20 20 20 20 20 20 20 | .....................b.......... |
| 243c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 3f 3f 3e 20 20 20 20 20 20 3b 20 | ....................<??>......;. |
| 243e0 | 63 6f 6d 70 75 74 65 20 70 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | compute.p'...................... |
| 24400 | 20 20 20 20 20 20 20 20 3c 3f 3f 3e 20 20 20 20 20 20 3b 20 63 6f 6d 70 75 74 65 20 71 27 0a 20 | ........<??>......;.compute.q'.. |
| 24420 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2f 20 63 | ............................(/.c |
| 24440 | 6f 75 6e 74 20 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 | ount.2)))...................(els |
| 24460 | 65 20 28 66 69 62 2d 69 74 65 72 20 28 2b 20 28 2a 20 62 20 71 29 20 28 2a 20 61 20 71 29 20 28 | e.(fib-iter.(+.(*.b.q).(*.a.q).( |
| 24480 | 2a 20 61 20 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | *.a.p))......................... |
| 244a0 | 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 2a 20 62 20 70 29 20 28 2a 20 61 20 71 29 29 0a 20 20 | ..........(+.(*.b.p).(*.a.q))... |
| 244c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 244e0 | 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | p............................... |
| 24500 | 20 20 20 20 71 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....q........................... |
| 24520 | 20 20 20 20 20 20 20 20 28 2d 20 63 6f 75 6e 74 20 31 29 29 29 29 29 0a 0a 20 20 20 2d 2d 2d 2d | ........(-.count.1))))).....---- |
| 24540 | 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 | ------.Footnotes.----------..... |
| 24560 | 28 31 29 20 4d 6f 72 65 20 70 72 65 63 69 73 65 6c 79 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 6f | (1).More.precisely,.the.number.o |
| 24580 | 66 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 20 72 65 71 75 69 72 65 64 20 69 73 20 65 71 | f.multiplications.required.is.eq |
| 245a0 | 75 61 6c 0a 74 6f 20 31 20 6c 65 73 73 20 74 68 61 6e 20 74 68 65 20 6c 6f 67 20 62 61 73 65 20 | ual.to.1.less.than.the.log.base. |
| 245c0 | 32 20 6f 66 20 6e 20 70 6c 75 73 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 6f 6e 65 73 20 69 | 2.of.n.plus.the.number.of.ones.i |
| 245e0 | 6e 20 74 68 65 0a 62 69 6e 61 72 79 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 6e | n.the.binary.representation.of.n |
| 24600 | 2e 20 20 54 68 69 73 20 74 6f 74 61 6c 20 69 73 20 61 6c 77 61 79 73 20 6c 65 73 73 20 74 68 61 | ...This.total.is.always.less.tha |
| 24620 | 6e 20 74 77 69 63 65 20 74 68 65 0a 6c 6f 67 20 62 61 73 65 20 32 20 6f 66 20 6e 2e 20 20 54 68 | n.twice.the.log.base.2.of.n...Th |
| 24640 | 65 20 61 72 62 69 74 72 61 72 79 20 63 6f 6e 73 74 61 6e 74 73 20 6b 5f 31 20 61 6e 64 20 6b 5f | e.arbitrary.constants.k_1.and.k_ |
| 24660 | 32 20 69 6e 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 0a 6f 66 20 6f 72 64 65 72 20 6e 6f 74 | 2.in.the.definition.of.order.not |
| 24680 | 61 74 69 6f 6e 20 69 6d 70 6c 79 20 74 68 61 74 2c 20 66 6f 72 20 61 20 6c 6f 67 61 72 69 74 68 | ation.imply.that,.for.a.logarith |
| 246a0 | 6d 69 63 20 70 72 6f 63 65 73 73 2c 20 74 68 65 20 62 61 73 65 20 74 6f 0a 77 68 69 63 68 20 6c | mic.process,.the.base.to.which.l |
| 246c0 | 6f 67 61 72 69 74 68 6d 73 20 61 72 65 20 74 61 6b 65 6e 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 | ogarithms.are.taken.does.not.mat |
| 246e0 | 74 65 72 2c 20 73 6f 20 61 6c 6c 20 73 75 63 68 20 70 72 6f 63 65 73 73 65 73 20 61 72 65 0a 64 | ter,.so.all.such.processes.are.d |
| 24700 | 65 73 63 72 69 62 65 64 20 61 73 20 5b 74 68 65 74 61 5d 28 60 6c 6f 67 27 20 6e 29 2e 0a 0a 20 | escribed.as.[theta](`log'.n).... |
| 24720 | 20 20 28 32 29 20 59 6f 75 20 6d 61 79 20 77 6f 6e 64 65 72 20 77 68 79 20 61 6e 79 6f 6e 65 20 | ..(2).You.may.wonder.why.anyone. |
| 24740 | 77 6f 75 6c 64 20 63 61 72 65 20 61 62 6f 75 74 20 72 61 69 73 69 6e 67 20 6e 75 6d 62 65 72 73 | would.care.about.raising.numbers |
| 24760 | 20 74 6f 0a 74 68 65 20 31 30 30 30 74 68 20 70 6f 77 65 72 2e 20 20 53 65 65 20 73 65 63 74 69 | .to.the.1000th.power...See.secti |
| 24780 | 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 36 3a 3a 2e 0a 0a 20 20 20 28 33 29 20 54 68 69 73 20 69 | on.*Note.1-2-6::......(3).This.i |
| 247a0 | 74 65 72 61 74 69 76 65 20 61 6c 67 6f 72 69 74 68 6d 20 69 73 20 61 6e 63 69 65 6e 74 2e 20 20 | terative.algorithm.is.ancient... |
| 247c0 | 49 74 20 61 70 70 65 61 72 73 20 69 6e 20 74 68 65 0a 60 43 68 61 6e 64 61 68 2d 73 75 74 72 61 | It.appears.in.the.`Chandah-sutra |
| 247e0 | 27 20 62 79 20 41 27 63 68 61 27 72 79 61 20 50 69 6e 67 61 6c 61 2c 20 77 72 69 74 74 65 6e 20 | '.by.A'cha'rya.Pingala,.written. |
| 24800 | 62 65 66 6f 72 65 20 32 30 30 20 42 2e 43 2e 20 53 65 65 20 4b 6e 75 74 68 0a 31 39 38 31 2c 20 | before.200.B.C..See.Knuth.1981,. |
| 24820 | 73 65 63 74 69 6f 6e 20 34 2e 36 2e 33 2c 20 66 6f 72 20 61 20 66 75 6c 6c 20 64 69 73 63 75 73 | section.4.6.3,.for.a.full.discus |
| 24840 | 73 69 6f 6e 20 61 6e 64 20 61 6e 61 6c 79 73 69 73 20 6f 66 20 74 68 69 73 20 61 6e 64 0a 6f 74 | sion.and.analysis.of.this.and.ot |
| 24860 | 68 65 72 20 6d 65 74 68 6f 64 73 20 6f 66 20 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 2e 0a 0a | her.methods.of.exponentiation... |
| 24880 | 20 20 20 28 34 29 20 54 68 69 73 20 61 6c 67 6f 72 69 74 68 6d 2c 20 77 68 69 63 68 20 69 73 20 | ...(4).This.algorithm,.which.is. |
| 248a0 | 73 6f 6d 65 74 69 6d 65 73 20 6b 6e 6f 77 6e 20 61 73 20 74 68 65 20 22 52 75 73 73 69 61 6e 20 | sometimes.known.as.the."Russian. |
| 248c0 | 70 65 61 73 61 6e 74 0a 6d 65 74 68 6f 64 22 20 6f 66 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f | peasant.method".of.multiplicatio |
| 248e0 | 6e 2c 20 69 73 20 61 6e 63 69 65 6e 74 2e 20 20 45 78 61 6d 70 6c 65 73 20 6f 66 20 69 74 73 20 | n,.is.ancient...Examples.of.its. |
| 24900 | 75 73 65 20 61 72 65 20 66 6f 75 6e 64 0a 69 6e 20 74 68 65 20 52 68 69 6e 64 20 50 61 70 79 72 | use.are.found.in.the.Rhind.Papyr |
| 24920 | 75 73 2c 20 6f 6e 65 20 6f 66 20 74 68 65 20 74 77 6f 20 6f 6c 64 65 73 74 20 6d 61 74 68 65 6d | us,.one.of.the.two.oldest.mathem |
| 24940 | 61 74 69 63 61 6c 20 64 6f 63 75 6d 65 6e 74 73 20 69 6e 0a 65 78 69 73 74 65 6e 63 65 2c 20 77 | atical.documents.in.existence,.w |
| 24960 | 72 69 74 74 65 6e 20 61 62 6f 75 74 20 31 37 30 30 20 42 2e 43 2e 20 20 28 61 6e 64 20 63 6f 70 | ritten.about.1700.B.C...(and.cop |
| 24980 | 69 65 64 20 66 72 6f 6d 20 61 6e 20 65 76 65 6e 20 6f 6c 64 65 72 0a 64 6f 63 75 6d 65 6e 74 29 | ied.from.an.even.older.document) |
| 249a0 | 20 62 79 20 61 6e 20 45 67 79 70 74 69 61 6e 20 73 63 72 69 62 65 20 6e 61 6d 65 64 20 41 27 68 | .by.an.Egyptian.scribe.named.A'h |
| 249c0 | 2d 6d 6f 73 65 2e 0a 0a 20 20 20 28 35 29 20 54 68 69 73 20 65 78 65 72 63 69 73 65 20 77 61 73 | -mose......(5).This.exercise.was |
| 249e0 | 20 73 75 67 67 65 73 74 65 64 20 74 6f 20 75 73 20 62 79 20 4a 6f 65 20 53 74 6f 79 2c 20 62 61 | .suggested.to.us.by.Joe.Stoy,.ba |
| 24a00 | 73 65 64 20 6f 6e 20 61 6e 0a 65 78 61 6d 70 6c 65 20 69 6e 20 4b 61 6c 64 65 77 61 69 6a 20 31 | sed.on.an.example.in.Kaldewaij.1 |
| 24a20 | 39 39 30 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 | 990.....File:.sicp.info,..Node:. |
| 24a40 | 31 2d 32 2d 35 2c 20 20 4e 65 78 74 3a 20 31 2d 32 2d 36 2c 20 20 50 72 65 76 3a 20 31 2d 32 2d | 1-2-5,..Next:.1-2-6,..Prev:.1-2- |
| 24a60 | 34 2c 20 20 55 70 3a 20 31 2d 32 0a 0a 31 2e 32 2e 35 20 47 72 65 61 74 65 73 74 20 43 6f 6d 6d | 4,..Up:.1-2..1.2.5.Greatest.Comm |
| 24a80 | 6f 6e 20 44 69 76 69 73 6f 72 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | on.Divisors.-------------------- |
| 24aa0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 67 72 65 61 74 65 73 74 20 63 6f 6d 6d 6f 6e 20 | ----------..The.greatest.common. |
| 24ac0 | 64 69 76 69 73 6f 72 20 28 47 43 44 29 20 6f 66 20 74 77 6f 20 69 6e 74 65 67 65 72 73 20 61 20 | divisor.(GCD).of.two.integers.a. |
| 24ae0 | 61 6e 64 20 62 20 69 73 20 64 65 66 69 6e 65 64 20 74 6f 0a 62 65 20 74 68 65 20 6c 61 72 67 65 | and.b.is.defined.to.be.the.large |
| 24b00 | 73 74 20 69 6e 74 65 67 65 72 20 74 68 61 74 20 64 69 76 69 64 65 73 20 62 6f 74 68 20 61 20 61 | st.integer.that.divides.both.a.a |
| 24b20 | 6e 64 20 62 20 77 69 74 68 20 6e 6f 20 72 65 6d 61 69 6e 64 65 72 2e 0a 46 6f 72 20 65 78 61 6d | nd.b.with.no.remainder..For.exam |
| 24b40 | 70 6c 65 2c 20 74 68 65 20 47 43 44 20 6f 66 20 31 36 20 61 6e 64 20 32 38 20 69 73 20 34 2e 20 | ple,.the.GCD.of.16.and.28.is.4.. |
| 24b60 | 20 49 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 32 3a 3a 2c 20 77 68 65 6e 20 77 65 0a 69 | .In.*Note.Chapter.2::,.when.we.i |
| 24b80 | 6e 76 65 73 74 69 67 61 74 65 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 72 61 74 69 | nvestigate.how.to.implement.rati |
| 24ba0 | 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 61 72 69 74 68 6d 65 74 69 63 2c 20 77 65 20 77 69 6c 6c 20 | onal-number.arithmetic,.we.will. |
| 24bc0 | 6e 65 65 64 0a 74 6f 20 62 65 20 61 62 6c 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 47 43 44 73 20 | need.to.be.able.to.compute.GCDs. |
| 24be0 | 69 6e 20 6f 72 64 65 72 20 74 6f 20 72 65 64 75 63 65 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 | in.order.to.reduce.rational.numb |
| 24c00 | 65 72 73 20 74 6f 0a 6c 6f 77 65 73 74 20 74 65 72 6d 73 2e 20 20 28 54 6f 20 72 65 64 75 63 65 | ers.to.lowest.terms...(To.reduce |
| 24c20 | 20 61 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 74 6f 20 6c 6f 77 65 73 74 20 74 65 72 | .a.rational.number.to.lowest.ter |
| 24c40 | 6d 73 2c 20 77 65 20 6d 75 73 74 0a 64 69 76 69 64 65 20 62 6f 74 68 20 74 68 65 20 6e 75 6d 65 | ms,.we.must.divide.both.the.nume |
| 24c60 | 72 61 74 6f 72 20 61 6e 64 20 74 68 65 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 20 62 79 20 74 68 65 | rator.and.the.denominator.by.the |
| 24c80 | 69 72 20 47 43 44 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 31 36 2f 32 38 20 72 65 64 75 | ir.GCD...For.example,.16/28.redu |
| 24ca0 | 63 65 73 20 74 6f 20 34 2f 37 2e 29 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 66 69 6e 64 20 74 68 | ces.to.4/7.)..One.way.to.find.th |
| 24cc0 | 65 20 47 43 44 20 6f 66 20 74 77 6f 0a 69 6e 74 65 67 65 72 73 20 69 73 20 74 6f 20 66 61 63 74 | e.GCD.of.two.integers.is.to.fact |
| 24ce0 | 6f 72 20 74 68 65 6d 20 61 6e 64 20 73 65 61 72 63 68 20 66 6f 72 20 63 6f 6d 6d 6f 6e 20 66 61 | or.them.and.search.for.common.fa |
| 24d00 | 63 74 6f 72 73 2c 20 62 75 74 20 74 68 65 72 65 20 69 73 0a 61 20 66 61 6d 6f 75 73 20 61 6c 67 | ctors,.but.there.is.a.famous.alg |
| 24d20 | 6f 72 69 74 68 6d 20 74 68 61 74 20 69 73 20 6d 75 63 68 20 6d 6f 72 65 20 65 66 66 69 63 69 65 | orithm.that.is.much.more.efficie |
| 24d40 | 6e 74 2e 0a 0a 20 20 20 54 68 65 20 69 64 65 61 20 6f 66 20 74 68 65 20 61 6c 67 6f 72 69 74 68 | nt......The.idea.of.the.algorith |
| 24d60 | 6d 20 69 73 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 74 68 | m.is.based.on.the.observation.th |
| 24d80 | 61 74 2c 20 69 66 20 72 20 69 73 0a 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 77 68 65 6e 20 61 | at,.if.r.is.the.remainder.when.a |
| 24da0 | 20 69 73 20 64 69 76 69 64 65 64 20 62 79 20 62 2c 20 74 68 65 6e 20 74 68 65 20 63 6f 6d 6d 6f | .is.divided.by.b,.then.the.commo |
| 24dc0 | 6e 20 64 69 76 69 73 6f 72 73 20 6f 66 20 61 20 61 6e 64 0a 62 20 61 72 65 20 70 72 65 63 69 73 | n.divisors.of.a.and.b.are.precis |
| 24de0 | 65 6c 79 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 64 69 76 69 73 | ely.the.same.as.the.common.divis |
| 24e00 | 6f 72 73 20 6f 66 20 62 20 61 6e 64 20 72 2e 20 20 54 68 75 73 2c 20 77 65 0a 63 61 6e 20 75 73 | ors.of.b.and.r...Thus,.we.can.us |
| 24e20 | 65 20 74 68 65 20 65 71 75 61 74 69 6f 6e 0a 0a 20 20 20 20 20 47 43 44 28 61 2c 62 29 20 3d 20 | e.the.equation.......GCD(a,b).=. |
| 24e40 | 47 43 44 28 62 2c 72 29 0a 0a 74 6f 20 73 75 63 63 65 73 73 69 76 65 6c 79 20 72 65 64 75 63 65 | GCD(b,r)..to.successively.reduce |
| 24e60 | 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 63 6f 6d 70 75 74 69 6e 67 20 61 20 47 43 44 20 | .the.problem.of.computing.a.GCD. |
| 24e80 | 74 6f 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 0a 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 | to.the.problem.of.computing.the. |
| 24ea0 | 47 43 44 20 6f 66 20 73 6d 61 6c 6c 65 72 20 61 6e 64 20 73 6d 61 6c 6c 65 72 20 70 61 69 72 73 | GCD.of.smaller.and.smaller.pairs |
| 24ec0 | 20 6f 66 20 69 6e 74 65 67 65 72 73 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 | .of.integers...For.example,..... |
| 24ee0 | 20 20 47 43 44 28 32 30 36 2c 34 30 29 20 3d 20 47 43 44 28 34 30 2c 36 29 0a 20 20 20 20 20 20 | ..GCD(206,40).=.GCD(40,6)....... |
| 24f00 | 20 20 20 20 20 20 20 20 20 20 20 3d 20 47 43 44 28 36 2c 34 29 0a 20 20 20 20 20 20 20 20 20 20 | ...........=.GCD(6,4)........... |
| 24f20 | 20 20 20 20 20 20 20 3d 20 47 43 44 28 34 2c 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......=.GCD(4,2)............... |
| 24f40 | 20 20 20 3d 20 47 43 44 28 32 2c 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3d | ...=.GCD(2,0)..................= |
| 24f60 | 20 32 0a 0a 72 65 64 75 63 65 73 20 47 43 44 28 32 30 36 2c 34 30 29 20 74 6f 20 47 43 44 28 32 | .2..reduces.GCD(206,40).to.GCD(2 |
| 24f80 | 2c 30 29 2c 20 77 68 69 63 68 20 69 73 20 32 2e 20 20 49 74 20 69 73 20 70 6f 73 73 69 62 6c 65 | ,0),.which.is.2...It.is.possible |
| 24fa0 | 20 74 6f 20 73 68 6f 77 0a 74 68 61 74 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 61 6e 79 20 | .to.show.that.starting.with.any. |
| 24fc0 | 74 77 6f 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 73 20 61 6e 64 20 70 65 72 66 6f 72 | two.positive.integers.and.perfor |
| 24fe0 | 6d 69 6e 67 20 72 65 70 65 61 74 65 64 0a 72 65 64 75 63 74 69 6f 6e 73 20 77 69 6c 6c 20 61 6c | ming.repeated.reductions.will.al |
| 25000 | 77 61 79 73 20 65 76 65 6e 74 75 61 6c 6c 79 20 70 72 6f 64 75 63 65 20 61 20 70 61 69 72 20 77 | ways.eventually.produce.a.pair.w |
| 25020 | 68 65 72 65 20 74 68 65 20 73 65 63 6f 6e 64 0a 6e 75 6d 62 65 72 20 69 73 20 30 2e 20 20 54 68 | here.the.second.number.is.0...Th |
| 25040 | 65 6e 20 74 68 65 20 47 43 44 20 69 73 20 74 68 65 20 6f 74 68 65 72 20 6e 75 6d 62 65 72 20 69 | en.the.GCD.is.the.other.number.i |
| 25060 | 6e 20 74 68 65 20 70 61 69 72 2e 20 20 54 68 69 73 0a 6d 65 74 68 6f 64 20 66 6f 72 20 63 6f 6d | n.the.pair...This.method.for.com |
| 25080 | 70 75 74 69 6e 67 20 74 68 65 20 47 43 44 20 69 73 20 6b 6e 6f 77 6e 20 61 73 20 41 6c 67 6f 72 | puting.the.GCD.is.known.as.Algor |
| 250a0 | 69 74 68 6d 20 22 45 75 63 6c 69 64 27 73 0a 41 6c 67 6f 72 69 74 68 6d 22 2e 28 31 29 0a 0a 20 | ithm."Euclid's.Algorithm".(1)... |
| 250c0 | 20 20 49 74 20 69 73 20 65 61 73 79 20 74 6f 20 65 78 70 72 65 73 73 20 45 75 63 6c 69 64 27 73 | ..It.is.easy.to.express.Euclid's |
| 250e0 | 20 41 6c 67 6f 72 69 74 68 6d 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 | .Algorithm.as.a.procedure:...... |
| 25100 | 20 28 64 65 66 69 6e 65 20 28 67 63 64 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d | .(define.(gcd.a.b)........(if.(= |
| 25120 | 20 62 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 61 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 | .b.0)............a............(g |
| 25140 | 63 64 20 62 20 28 72 65 6d 61 69 6e 64 65 72 20 61 20 62 29 29 29 29 0a 0a 20 20 20 54 68 69 73 | cd.b.(remainder.a.b)))).....This |
| 25160 | 20 67 65 6e 65 72 61 74 65 73 20 61 6e 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 2c | .generates.an.iterative.process, |
| 25180 | 20 77 68 6f 73 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 67 72 6f 77 73 20 61 73 0a | .whose.number.of.steps.grows.as. |
| 251a0 | 74 68 65 20 6c 6f 67 61 72 69 74 68 6d 20 6f 66 20 74 68 65 20 6e 75 6d 62 65 72 73 20 69 6e 76 | the.logarithm.of.the.numbers.inv |
| 251c0 | 6f 6c 76 65 64 2e 0a 0a 20 20 20 54 68 65 20 66 61 63 74 20 74 68 61 74 20 74 68 65 20 6e 75 6d | olved......The.fact.that.the.num |
| 251e0 | 62 65 72 20 6f 66 20 73 74 65 70 73 20 72 65 71 75 69 72 65 64 20 62 79 20 45 75 63 6c 69 64 27 | ber.of.steps.required.by.Euclid' |
| 25200 | 73 20 41 6c 67 6f 72 69 74 68 6d 20 68 61 73 0a 6c 6f 67 61 72 69 74 68 6d 69 63 20 67 72 6f 77 | s.Algorithm.has.logarithmic.grow |
| 25220 | 74 68 20 62 65 61 72 73 20 61 6e 20 69 6e 74 65 72 65 73 74 69 6e 67 20 72 65 6c 61 74 69 6f 6e | th.bears.an.interesting.relation |
| 25240 | 20 74 6f 20 74 68 65 20 46 69 62 6f 6e 61 63 63 69 0a 6e 75 6d 62 65 72 73 3a 0a 0a 20 20 20 20 | .to.the.Fibonacci.numbers:...... |
| 25260 | 20 2a 4c 61 6d 65 27 27 73 20 54 68 65 6f 72 65 6d 3a 2a 20 49 66 20 45 75 63 6c 69 64 27 73 20 | .*Lame''s.Theorem:*.If.Euclid's. |
| 25280 | 41 6c 67 6f 72 69 74 68 6d 20 72 65 71 75 69 72 65 73 20 6b 20 73 74 65 70 73 20 74 6f 0a 20 20 | Algorithm.requires.k.steps.to... |
| 252a0 | 20 20 20 63 6f 6d 70 75 74 65 20 74 68 65 20 47 43 44 20 6f 66 20 73 6f 6d 65 20 70 61 69 72 2c | ...compute.the.GCD.of.some.pair, |
| 252c0 | 20 74 68 65 6e 20 74 68 65 20 73 6d 61 6c 6c 65 72 20 6e 75 6d 62 65 72 20 69 6e 20 74 68 65 20 | .then.the.smaller.number.in.the. |
| 252e0 | 70 61 69 72 0a 20 20 20 20 20 6d 75 73 74 20 62 65 20 67 72 65 61 74 65 72 20 74 68 61 6e 20 6f | pair......must.be.greater.than.o |
| 25300 | 72 20 65 71 75 61 6c 20 74 6f 20 74 68 65 20 6b 74 68 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d | r.equal.to.the.kth.Fibonacci.num |
| 25320 | 62 65 72 2e 28 32 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 75 73 65 20 74 68 69 73 20 74 68 65 6f | ber.(2).....We.can.use.this.theo |
| 25340 | 72 65 6d 20 74 6f 20 67 65 74 20 61 6e 20 6f 72 64 65 72 2d 6f 66 2d 67 72 6f 77 74 68 20 65 73 | rem.to.get.an.order-of-growth.es |
| 25360 | 74 69 6d 61 74 65 20 66 6f 72 0a 45 75 63 6c 69 64 27 73 20 41 6c 67 6f 72 69 74 68 6d 2e 20 20 | timate.for.Euclid's.Algorithm... |
| 25380 | 4c 65 74 20 6e 20 62 65 20 74 68 65 20 73 6d 61 6c 6c 65 72 20 6f 66 20 74 68 65 20 74 77 6f 20 | Let.n.be.the.smaller.of.the.two. |
| 253a0 | 69 6e 70 75 74 73 20 74 6f 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 2e 20 20 49 66 20 74 68 65 | inputs.to.the.procedure...If.the |
| 253c0 | 20 70 72 6f 63 65 73 73 20 74 61 6b 65 73 20 6b 20 73 74 65 70 73 2c 20 74 68 65 6e 20 77 65 20 | .process.takes.k.steps,.then.we. |
| 253e0 | 6d 75 73 74 20 68 61 76 65 20 6e 3e 3d 20 5f 46 69 62 5f 28 6b 29 0a 61 70 70 72 6f 78 20 5b 70 | must.have.n>=._Fib_(k).approx.[p |
| 25400 | 68 69 5d 5e 6b 2f 5b 73 71 72 74 5d 28 35 29 2e 20 20 54 68 65 72 65 66 6f 72 65 20 74 68 65 20 | hi]^k/[sqrt](5)...Therefore.the. |
| 25420 | 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 6b 20 67 72 6f 77 73 20 61 73 20 74 68 65 0a 6c | number.of.steps.k.grows.as.the.l |
| 25440 | 6f 67 61 72 69 74 68 6d 20 28 74 6f 20 74 68 65 20 62 61 73 65 20 5b 70 68 69 5d 29 20 6f 66 20 | ogarithm.(to.the.base.[phi]).of. |
| 25460 | 6e 2e 20 20 48 65 6e 63 65 2c 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 67 72 6f 77 74 68 20 69 | n...Hence,.the.order.of.growth.i |
| 25480 | 73 0a 5b 74 68 65 74 61 5d 28 60 6c 6f 67 27 20 6e 29 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | s.[theta](`log'.n)........*Exerc |
| 254a0 | 69 73 65 20 31 2e 32 30 3a 2a 20 54 68 65 20 70 72 6f 63 65 73 73 20 74 68 61 74 20 61 20 70 72 | ise.1.20:*.The.process.that.a.pr |
| 254c0 | 6f 63 65 64 75 72 65 20 67 65 6e 65 72 61 74 65 73 20 69 73 20 6f 66 0a 20 20 20 20 20 63 6f 75 | ocedure.generates.is.of......cou |
| 254e0 | 72 73 65 20 64 65 70 65 6e 64 65 6e 74 20 6f 6e 20 74 68 65 20 72 75 6c 65 73 20 75 73 65 64 20 | rse.dependent.on.the.rules.used. |
| 25500 | 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20 20 41 73 20 61 6e 0a 20 20 20 20 20 | by.the.interpreter...As.an...... |
| 25520 | 65 78 61 6d 70 6c 65 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 69 74 65 72 61 74 69 76 65 20 | example,.consider.the.iterative. |
| 25540 | 60 67 63 64 27 20 70 72 6f 63 65 64 75 72 65 20 67 69 76 65 6e 20 61 62 6f 76 65 2e 0a 20 20 20 | `gcd'.procedure.given.above..... |
| 25560 | 20 20 53 75 70 70 6f 73 65 20 77 65 20 77 65 72 65 20 74 6f 20 69 6e 74 65 72 70 72 65 74 20 74 | ..Suppose.we.were.to.interpret.t |
| 25580 | 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 75 73 69 6e 67 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 | his.procedure.using.normal-order |
| 255a0 | 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 61 73 20 64 69 73 63 75 73 73 65 64 20 69 | ......evaluation,.as.discussed.i |
| 255c0 | 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 35 3a 3a 2e 20 20 28 54 68 65 0a 20 | n.section.*Note.1-1-5::...(The.. |
| 255e0 | 20 20 20 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 2d 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 | ....normal-order-evaluation.rule |
| 25600 | 20 66 6f 72 20 60 69 66 27 20 69 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f 74 65 0a | .for.`if'.is.described.in.*Note. |
| 25620 | 20 20 20 20 20 45 78 65 72 63 69 73 65 20 31 2d 35 3a 3a 2e 29 20 20 55 73 69 6e 67 20 74 68 65 | .....Exercise.1-5::.)..Using.the |
| 25640 | 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 65 74 68 6f 64 20 28 66 6f 72 20 6e 6f 72 6d 61 6c | .substitution.method.(for.normal |
| 25660 | 0a 20 20 20 20 20 6f 72 64 65 72 29 2c 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 65 20 70 72 6f | ......order),.illustrate.the.pro |
| 25680 | 63 65 73 73 20 67 65 6e 65 72 61 74 65 64 20 69 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 60 28 67 | cess.generated.in.evaluating.`(g |
| 256a0 | 63 64 20 32 30 36 0a 20 20 20 20 20 34 30 29 27 20 61 6e 64 20 69 6e 64 69 63 61 74 65 20 74 68 | cd.206......40)'.and.indicate.th |
| 256c0 | 65 20 60 72 65 6d 61 69 6e 64 65 72 27 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 61 72 | e.`remainder'.operations.that.ar |
| 256e0 | 65 20 61 63 74 75 61 6c 6c 79 0a 20 20 20 20 20 70 65 72 66 6f 72 6d 65 64 2e 20 20 48 6f 77 20 | e.actually......performed...How. |
| 25700 | 6d 61 6e 79 20 60 72 65 6d 61 69 6e 64 65 72 27 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 72 65 20 | many.`remainder'.operations.are. |
| 25720 | 61 63 74 75 61 6c 6c 79 20 70 65 72 66 6f 72 6d 65 64 0a 20 20 20 20 20 69 6e 20 74 68 65 20 6e | actually.performed......in.the.n |
| 25740 | 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 60 28 67 63 64 20 | ormal-order.evaluation.of.`(gcd. |
| 25760 | 32 30 36 20 34 30 29 27 3f 20 20 49 6e 20 74 68 65 0a 20 20 20 20 20 61 70 70 6c 69 63 61 74 69 | 206.40)'?..In.the......applicati |
| 25780 | 76 65 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 3f 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d | ve-order.evaluation?.....------- |
| 257a0 | 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 | ---.Footnotes.----------.....(1) |
| 257c0 | 20 45 75 63 6c 69 64 27 73 20 41 6c 67 6f 72 69 74 68 6d 20 69 73 20 73 6f 20 63 61 6c 6c 65 64 | .Euclid's.Algorithm.is.so.called |
| 257e0 | 20 62 65 63 61 75 73 65 20 69 74 20 61 70 70 65 61 72 73 20 69 6e 20 45 75 63 6c 69 64 27 73 0a | .because.it.appears.in.Euclid's. |
| 25800 | 60 45 6c 65 6d 65 6e 74 73 27 20 28 42 6f 6f 6b 20 37 2c 20 63 61 2e 20 33 30 30 20 42 2e 43 2e | `Elements'.(Book.7,.ca..300.B.C. |
| 25820 | 29 2e 20 20 41 63 63 6f 72 64 69 6e 67 20 74 6f 20 4b 6e 75 74 68 20 28 31 39 37 33 29 2c 20 69 | )...According.to.Knuth.(1973),.i |
| 25840 | 74 20 63 61 6e 0a 62 65 20 63 6f 6e 73 69 64 65 72 65 64 20 74 68 65 20 6f 6c 64 65 73 74 20 6b | t.can.be.considered.the.oldest.k |
| 25860 | 6e 6f 77 6e 20 6e 6f 6e 74 72 69 76 69 61 6c 20 61 6c 67 6f 72 69 74 68 6d 2e 20 20 54 68 65 20 | nown.nontrivial.algorithm...The. |
| 25880 | 61 6e 63 69 65 6e 74 0a 45 67 79 70 74 69 61 6e 20 6d 65 74 68 6f 64 20 6f 66 20 6d 75 6c 74 69 | ancient.Egyptian.method.of.multi |
| 258a0 | 70 6c 69 63 61 74 69 6f 6e 20 28 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 31 38 3a 3a | plication.(*Note.Exercise.1-18:: |
| 258c0 | 29 20 69 73 20 73 75 72 65 6c 79 0a 6f 6c 64 65 72 2c 20 62 75 74 2c 20 61 73 20 4b 6e 75 74 68 | ).is.surely.older,.but,.as.Knuth |
| 258e0 | 20 65 78 70 6c 61 69 6e 73 2c 20 45 75 63 6c 69 64 27 73 20 61 6c 67 6f 72 69 74 68 6d 20 69 73 | .explains,.Euclid's.algorithm.is |
| 25900 | 20 74 68 65 20 6f 6c 64 65 73 74 20 6b 6e 6f 77 6e 0a 74 6f 20 68 61 76 65 20 62 65 65 6e 20 70 | .the.oldest.known.to.have.been.p |
| 25920 | 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 67 65 6e 65 72 61 6c 20 61 6c 67 6f 72 69 74 68 6d 2c | resented.as.a.general.algorithm, |
| 25940 | 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 73 20 61 20 73 65 74 20 6f 66 0a 69 6c 6c 75 73 74 72 | .rather.than.as.a.set.of.illustr |
| 25960 | 61 74 69 76 65 20 65 78 61 6d 70 6c 65 73 2e 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 74 68 65 | ative.examples......(2).This.the |
| 25980 | 6f 72 65 6d 20 77 61 73 20 70 72 6f 76 65 64 20 69 6e 20 31 38 34 35 20 62 79 20 47 61 62 72 69 | orem.was.proved.in.1845.by.Gabri |
| 259a0 | 65 6c 20 4c 61 6d 65 27 2c 20 61 20 46 72 65 6e 63 68 0a 6d 61 74 68 65 6d 61 74 69 63 69 61 6e | el.Lame',.a.French.mathematician |
| 259c0 | 20 61 6e 64 20 65 6e 67 69 6e 65 65 72 20 6b 6e 6f 77 6e 20 63 68 69 65 66 6c 79 20 66 6f 72 20 | .and.engineer.known.chiefly.for. |
| 259e0 | 68 69 73 20 63 6f 6e 74 72 69 62 75 74 69 6f 6e 73 20 74 6f 0a 6d 61 74 68 65 6d 61 74 69 63 61 | his.contributions.to.mathematica |
| 25a00 | 6c 20 70 68 79 73 69 63 73 2e 20 20 54 6f 20 70 72 6f 76 65 20 74 68 65 20 74 68 65 6f 72 65 6d | l.physics...To.prove.the.theorem |
| 25a20 | 2c 20 77 65 20 63 6f 6e 73 69 64 65 72 20 70 61 69 72 73 20 28 61 5f 6b 0a 2c 62 5f 6b 29 2c 20 | ,.we.consider.pairs.(a_k.,b_k),. |
| 25a40 | 77 68 65 72 65 20 61 5f 6b 3e 3d 20 62 5f 6b 2c 20 66 6f 72 20 77 68 69 63 68 20 45 75 63 6c 69 | where.a_k>=.b_k,.for.which.Eucli |
| 25a60 | 64 27 73 20 41 6c 67 6f 72 69 74 68 6d 20 74 65 72 6d 69 6e 61 74 65 73 20 69 6e 20 6b 0a 73 74 | d's.Algorithm.terminates.in.k.st |
| 25a80 | 65 70 73 2e 20 20 54 68 65 20 70 72 6f 6f 66 20 69 73 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 | eps...The.proof.is.based.on.the. |
| 25aa0 | 63 6c 61 69 6d 20 74 68 61 74 2c 20 69 66 20 28 61 5f 28 6b 2b 31 29 2c 20 62 5f 28 6b 2b 31 29 | claim.that,.if.(a_(k+1),.b_(k+1) |
| 25ac0 | 29 20 2d 3e 0a 28 61 5f 6b 2c 20 62 5f 6b 29 20 2d 3e 20 28 61 5f 28 6b 2d 31 29 2c 20 62 5f 28 | ).->.(a_k,.b_k).->.(a_(k-1),.b_( |
| 25ae0 | 6b 2d 31 29 29 20 61 72 65 20 74 68 72 65 65 20 73 75 63 63 65 73 73 69 76 65 20 70 61 69 72 73 | k-1)).are.three.successive.pairs |
| 25b00 | 20 69 6e 20 74 68 65 0a 72 65 64 75 63 74 69 6f 6e 20 70 72 6f 63 65 73 73 2c 20 74 68 65 6e 20 | .in.the.reduction.process,.then. |
| 25b20 | 77 65 20 6d 75 73 74 20 68 61 76 65 20 62 5f 28 6b 2b 31 29 3e 3d 20 62 5f 6b 20 2b 20 62 5f 28 | we.must.have.b_(k+1)>=.b_k.+.b_( |
| 25b40 | 6b 2d 31 29 2e 20 20 54 6f 0a 76 65 72 69 66 79 20 74 68 65 20 63 6c 61 69 6d 2c 20 63 6f 6e 73 | k-1)...To.verify.the.claim,.cons |
| 25b60 | 69 64 65 72 20 74 68 61 74 20 61 20 72 65 64 75 63 74 69 6f 6e 20 73 74 65 70 20 69 73 20 64 65 | ider.that.a.reduction.step.is.de |
| 25b80 | 66 69 6e 65 64 20 62 79 20 61 70 70 6c 79 69 6e 67 0a 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 | fined.by.applying.the.transforma |
| 25ba0 | 74 69 6f 6e 20 61 5f 28 6b 2d 31 29 20 3d 20 62 5f 6b 2c 20 62 5f 28 6b 2d 31 29 20 3d 20 72 65 | tion.a_(k-1).=.b_k,.b_(k-1).=.re |
| 25bc0 | 6d 61 69 6e 64 65 72 20 6f 66 20 61 5f 6b 20 64 69 76 69 64 65 64 20 62 79 0a 62 5f 6b 2e 20 20 | mainder.of.a_k.divided.by.b_k... |
| 25be0 | 54 68 65 20 73 65 63 6f 6e 64 20 65 71 75 61 74 69 6f 6e 20 6d 65 61 6e 73 20 74 68 61 74 20 61 | The.second.equation.means.that.a |
| 25c00 | 5f 6b 20 3d 20 71 62 5f 6b 20 2b 20 62 5f 28 6b 2d 31 29 20 66 6f 72 20 73 6f 6d 65 0a 70 6f 73 | _k.=.qb_k.+.b_(k-1).for.some.pos |
| 25c20 | 69 74 69 76 65 20 69 6e 74 65 67 65 72 20 71 2e 20 20 41 6e 64 20 73 69 6e 63 65 20 71 20 6d 75 | itive.integer.q...And.since.q.mu |
| 25c40 | 73 74 20 62 65 20 61 74 20 6c 65 61 73 74 20 31 20 77 65 20 68 61 76 65 20 61 5f 6b 20 3d 20 71 | st.be.at.least.1.we.have.a_k.=.q |
| 25c60 | 62 5f 6b 0a 2b 20 62 5f 28 6b 2d 31 29 20 3e 3d 20 62 5f 6b 20 2b 20 62 5f 28 6b 2d 31 29 2e 20 | b_k.+.b_(k-1).>=.b_k.+.b_(k-1).. |
| 25c80 | 20 42 75 74 20 69 6e 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 72 65 64 75 63 74 69 6f 6e 20 73 | .But.in.the.previous.reduction.s |
| 25ca0 | 74 65 70 20 77 65 20 68 61 76 65 0a 62 5f 28 6b 2b 31 29 20 3d 20 61 5f 6b 2e 20 20 54 68 65 72 | tep.we.have.b_(k+1).=.a_k...Ther |
| 25cc0 | 65 66 6f 72 65 2c 20 62 5f 28 6b 2b 31 29 20 3d 20 61 5f 6b 3e 3d 20 62 5f 6b 20 2b 20 62 5f 28 | efore,.b_(k+1).=.a_k>=.b_k.+.b_( |
| 25ce0 | 6b 2d 31 29 2e 20 20 54 68 69 73 20 76 65 72 69 66 69 65 73 0a 74 68 65 20 63 6c 61 69 6d 2e 20 | k-1)...This.verifies.the.claim.. |
| 25d00 | 20 4e 6f 77 20 77 65 20 63 61 6e 20 70 72 6f 76 65 20 74 68 65 20 74 68 65 6f 72 65 6d 20 62 79 | .Now.we.can.prove.the.theorem.by |
| 25d20 | 20 69 6e 64 75 63 74 69 6f 6e 20 6f 6e 20 6b 2c 20 74 68 65 20 6e 75 6d 62 65 72 0a 6f 66 20 73 | .induction.on.k,.the.number.of.s |
| 25d40 | 74 65 70 73 20 74 68 61 74 20 74 68 65 20 61 6c 67 6f 72 69 74 68 6d 20 72 65 71 75 69 72 65 73 | teps.that.the.algorithm.requires |
| 25d60 | 20 74 6f 20 74 65 72 6d 69 6e 61 74 65 2e 20 20 54 68 65 20 72 65 73 75 6c 74 20 69 73 20 74 72 | .to.terminate...The.result.is.tr |
| 25d80 | 75 65 0a 66 6f 72 20 6b 20 3d 20 31 2c 20 73 69 6e 63 65 20 74 68 69 73 20 6d 65 72 65 6c 79 20 | ue.for.k.=.1,.since.this.merely. |
| 25da0 | 72 65 71 75 69 72 65 73 20 74 68 61 74 20 62 20 62 65 20 61 74 20 6c 65 61 73 74 20 61 73 20 6c | requires.that.b.be.at.least.as.l |
| 25dc0 | 61 72 67 65 20 61 73 0a 5f 46 69 62 5f 28 31 29 20 3d 20 31 2e 20 20 4e 6f 77 2c 20 61 73 73 75 | arge.as._Fib_(1).=.1...Now,.assu |
| 25de0 | 6d 65 20 74 68 61 74 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 20 74 72 75 65 20 66 6f 72 20 61 | me.that.the.result.is.true.for.a |
| 25e00 | 6c 6c 20 69 6e 74 65 67 65 72 73 0a 6c 65 73 73 20 74 68 61 6e 20 6f 72 20 65 71 75 61 6c 20 74 | ll.integers.less.than.or.equal.t |
| 25e20 | 6f 20 6b 20 61 6e 64 20 65 73 74 61 62 6c 69 73 68 20 74 68 65 20 72 65 73 75 6c 74 20 66 6f 72 | o.k.and.establish.the.result.for |
| 25e40 | 20 6b 20 2b 20 31 2e 20 20 4c 65 74 0a 28 61 5f 28 6b 2b 31 29 2c 20 62 5f 28 6b 2b 31 29 29 20 | .k.+.1...Let.(a_(k+1),.b_(k+1)). |
| 25e60 | 2d 3e 20 28 61 5f 6b 2c 20 62 5f 6b 29 20 2d 3e 20 28 61 5f 6b 2d 31 29 2c 20 62 5f 28 6b 2d 31 | ->.(a_k,.b_k).->.(a_k-1),.b_(k-1 |
| 25e80 | 29 29 20 62 65 20 73 75 63 63 65 73 73 69 76 65 0a 70 61 69 72 73 20 69 6e 20 74 68 65 20 72 65 | )).be.successive.pairs.in.the.re |
| 25ea0 | 64 75 63 74 69 6f 6e 20 70 72 6f 63 65 73 73 2e 20 20 42 79 20 6f 75 72 20 69 6e 64 75 63 74 69 | duction.process...By.our.inducti |
| 25ec0 | 6f 6e 20 68 79 70 6f 74 68 65 73 65 73 2c 20 77 65 20 68 61 76 65 0a 62 5f 28 6b 2d 31 29 20 3e | on.hypotheses,.we.have.b_(k-1).> |
| 25ee0 | 3d 20 5f 46 69 62 5f 28 6b 20 2d 20 31 29 20 61 6e 64 20 62 5f 6b 20 3e 3d 20 5f 46 69 62 5f 28 | =._Fib_(k.-.1).and.b_k.>=._Fib_( |
| 25f00 | 6b 29 2e 20 20 54 68 75 73 2c 20 61 70 70 6c 79 69 6e 67 20 74 68 65 20 63 6c 61 69 6d 0a 77 65 | k)...Thus,.applying.the.claim.we |
| 25f20 | 20 6a 75 73 74 20 70 72 6f 76 65 64 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 20 64 | .just.proved.together.with.the.d |
| 25f40 | 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 | efinition.of.the.Fibonacci.numbe |
| 25f60 | 72 73 0a 67 69 76 65 73 20 62 5f 28 6b 2b 31 29 20 3e 3d 20 62 5f 6b 20 2b 20 62 5f 28 6b 2d 31 | rs.gives.b_(k+1).>=.b_k.+.b_(k-1 |
| 25f80 | 29 20 3e 3d 20 5f 46 69 62 5f 28 6b 29 20 2b 20 5f 46 69 62 5f 28 6b 20 2d 20 31 29 20 3d 20 5f | ).>=._Fib_(k).+._Fib_(k.-.1).=._ |
| 25fa0 | 46 69 62 5f 28 6b 20 2b 0a 31 29 2c 20 77 68 69 63 68 20 63 6f 6d 70 6c 65 74 65 73 20 74 68 65 | Fib_(k.+.1),.which.completes.the |
| 25fc0 | 20 70 72 6f 6f 66 20 6f 66 20 4c 61 6d 65 27 27 73 20 54 68 65 6f 72 65 6d 2e 0a 0a 1f 0a 46 69 | .proof.of.Lame''s.Theorem.....Fi |
| 25fe0 | 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 32 2d 36 2c 20 20 50 72 | le:.sicp.info,..Node:.1-2-6,..Pr |
| 26000 | 65 76 3a 20 31 2d 32 2d 35 2c 20 20 55 70 3a 20 31 2d 32 0a 0a 31 2e 32 2e 36 20 45 78 61 6d 70 | ev:.1-2-5,..Up:.1-2..1.2.6.Examp |
| 26020 | 6c 65 3a 20 54 65 73 74 69 6e 67 20 66 6f 72 20 50 72 69 6d 61 6c 69 74 79 0a 2d 2d 2d 2d 2d 2d | le:.Testing.for.Primality.------ |
| 26040 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a | ------------------------------.. |
| 26060 | 54 68 69 73 20 73 65 63 74 69 6f 6e 20 64 65 73 63 72 69 62 65 73 20 74 77 6f 20 6d 65 74 68 6f | This.section.describes.two.metho |
| 26080 | 64 73 20 66 6f 72 20 63 68 65 63 6b 69 6e 67 20 74 68 65 20 70 72 69 6d 61 6c 69 74 79 20 6f 66 | ds.for.checking.the.primality.of |
| 260a0 | 20 61 6e 0a 69 6e 74 65 67 65 72 20 6e 2c 20 6f 6e 65 20 77 69 74 68 20 6f 72 64 65 72 20 6f 66 | .an.integer.n,.one.with.order.of |
| 260c0 | 20 67 72 6f 77 74 68 20 5b 74 68 65 74 61 5d 28 5f 5b 73 71 72 74 5d 5f 28 6e 29 29 2c 20 61 6e | .growth.[theta](_[sqrt]_(n)),.an |
| 260e0 | 64 20 61 0a 22 70 72 6f 62 61 62 69 6c 69 73 74 69 63 22 20 61 6c 67 6f 72 69 74 68 6d 20 77 69 | d.a."probabilistic".algorithm.wi |
| 26100 | 74 68 20 6f 72 64 65 72 20 6f 66 20 67 72 6f 77 74 68 20 5b 74 68 65 74 61 5d 28 60 6c 6f 67 27 | th.order.of.growth.[theta](`log' |
| 26120 | 20 6e 29 2e 20 20 54 68 65 0a 65 78 65 72 63 69 73 65 73 20 61 74 20 74 68 65 20 65 6e 64 20 6f | .n)...The.exercises.at.the.end.o |
| 26140 | 66 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 73 75 67 67 65 73 74 20 70 72 6f 67 72 61 6d 6d 69 | f.this.section.suggest.programmi |
| 26160 | 6e 67 20 70 72 6f 6a 65 63 74 73 20 62 61 73 65 64 0a 6f 6e 20 74 68 65 73 65 20 61 6c 67 6f 72 | ng.projects.based.on.these.algor |
| 26180 | 69 74 68 6d 73 2e 0a 0a 53 65 61 72 63 68 69 6e 67 20 66 6f 72 20 64 69 76 69 73 6f 72 73 0a 2e | ithms...Searching.for.divisors.. |
| 261a0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 53 69 6e 63 65 20 61 6e 63 | .......................Since.anc |
| 261c0 | 69 65 6e 74 20 74 69 6d 65 73 2c 20 6d 61 74 68 65 6d 61 74 69 63 69 61 6e 73 20 68 61 76 65 20 | ient.times,.mathematicians.have. |
| 261e0 | 62 65 65 6e 20 66 61 73 63 69 6e 61 74 65 64 20 62 79 20 70 72 6f 62 6c 65 6d 73 0a 63 6f 6e 63 | been.fascinated.by.problems.conc |
| 26200 | 65 72 6e 69 6e 67 20 70 72 69 6d 65 20 6e 75 6d 62 65 72 73 2c 20 61 6e 64 20 6d 61 6e 79 20 70 | erning.prime.numbers,.and.many.p |
| 26220 | 65 6f 70 6c 65 20 68 61 76 65 20 77 6f 72 6b 65 64 20 6f 6e 20 74 68 65 20 70 72 6f 62 6c 65 6d | eople.have.worked.on.the.problem |
| 26240 | 20 6f 66 0a 64 65 74 65 72 6d 69 6e 69 6e 67 20 77 61 79 73 20 74 6f 20 74 65 73 74 20 69 66 20 | .of.determining.ways.to.test.if. |
| 26260 | 6e 75 6d 62 65 72 73 20 61 72 65 20 70 72 69 6d 65 2e 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 74 | numbers.are.prime...One.way.to.t |
| 26280 | 65 73 74 20 69 66 20 61 0a 6e 75 6d 62 65 72 20 69 73 20 70 72 69 6d 65 20 69 73 20 74 6f 20 66 | est.if.a.number.is.prime.is.to.f |
| 262a0 | 69 6e 64 20 74 68 65 20 6e 75 6d 62 65 72 27 73 20 64 69 76 69 73 6f 72 73 2e 20 20 54 68 65 20 | ind.the.number's.divisors...The. |
| 262c0 | 66 6f 6c 6c 6f 77 69 6e 67 0a 70 72 6f 67 72 61 6d 20 66 69 6e 64 73 20 74 68 65 20 73 6d 61 6c | following.program.finds.the.smal |
| 262e0 | 6c 65 73 74 20 69 6e 74 65 67 72 61 6c 20 64 69 76 69 73 6f 72 20 28 67 72 65 61 74 65 72 20 74 | lest.integral.divisor.(greater.t |
| 26300 | 68 61 6e 20 31 29 20 6f 66 20 61 20 67 69 76 65 6e 0a 6e 75 6d 62 65 72 20 6e 2e 20 20 49 74 20 | han.1).of.a.given.number.n...It. |
| 26320 | 64 6f 65 73 20 74 68 69 73 20 69 6e 20 61 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 77 | does.this.in.a.straightforward.w |
| 26340 | 61 79 2c 20 62 79 20 74 65 73 74 69 6e 67 20 6e 20 66 6f 72 0a 64 69 76 69 73 69 62 69 6c 69 74 | ay,.by.testing.n.for.divisibilit |
| 26360 | 79 20 62 79 20 73 75 63 63 65 73 73 69 76 65 20 69 6e 74 65 67 65 72 73 20 73 74 61 72 74 69 6e | y.by.successive.integers.startin |
| 26380 | 67 20 77 69 74 68 20 32 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 6d 61 6c 6c 65 73 | g.with.2........(define.(smalles |
| 263a0 | 74 2d 64 69 76 69 73 6f 72 20 6e 29 0a 20 20 20 20 20 20 20 28 66 69 6e 64 2d 64 69 76 69 73 6f | t-divisor.n)........(find-diviso |
| 263c0 | 72 20 6e 20 32 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 6e 64 2d 64 69 76 69 | r.n.2)).......(define.(find-divi |
| 263e0 | 73 6f 72 20 6e 20 74 65 73 74 2d 64 69 76 69 73 6f 72 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 | sor.n.test-divisor)........(cond |
| 26400 | 20 28 28 3e 20 28 73 71 75 61 72 65 20 74 65 73 74 2d 64 69 76 69 73 6f 72 29 20 6e 29 20 6e 29 | .((>.(square.test-divisor).n).n) |
| 26420 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 64 69 76 69 64 65 73 3f 20 74 65 73 74 2d 64 69 | ..............((divides?.test-di |
| 26440 | 76 69 73 6f 72 20 6e 29 20 74 65 73 74 2d 64 69 76 69 73 6f 72 29 0a 20 20 20 20 20 20 20 20 20 | visor.n).test-divisor).......... |
| 26460 | 20 20 20 20 28 65 6c 73 65 20 28 66 69 6e 64 2d 64 69 76 69 73 6f 72 20 6e 20 28 2b 20 74 65 73 | ....(else.(find-divisor.n.(+.tes |
| 26480 | 74 2d 64 69 76 69 73 6f 72 20 31 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | t-divisor.1))))).......(define.( |
| 264a0 | 64 69 76 69 64 65 73 3f 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 3d 20 28 72 65 6d 61 69 6e 64 | divides?.a.b)........(=.(remaind |
| 264c0 | 65 72 20 62 20 61 29 20 30 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 74 65 73 74 20 77 68 65 74 | er.b.a).0)).....We.can.test.whet |
| 264e0 | 68 65 72 20 61 20 6e 75 6d 62 65 72 20 69 73 20 70 72 69 6d 65 20 61 73 20 66 6f 6c 6c 6f 77 73 | her.a.number.is.prime.as.follows |
| 26500 | 3a 20 6e 20 69 73 20 70 72 69 6d 65 20 69 66 20 61 6e 64 0a 6f 6e 6c 79 20 69 66 20 6e 20 69 73 | :.n.is.prime.if.and.only.if.n.is |
| 26520 | 20 69 74 73 20 6f 77 6e 20 73 6d 61 6c 6c 65 73 74 20 64 69 76 69 73 6f 72 2e 0a 0a 20 20 20 20 | .its.own.smallest.divisor....... |
| 26540 | 20 28 64 65 66 69 6e 65 20 28 70 72 69 6d 65 3f 20 6e 29 0a 20 20 20 20 20 20 20 28 3d 20 6e 20 | .(define.(prime?.n)........(=.n. |
| 26560 | 28 73 6d 61 6c 6c 65 73 74 2d 64 69 76 69 73 6f 72 20 6e 29 29 29 0a 0a 20 20 20 54 68 65 20 65 | (smallest-divisor.n))).....The.e |
| 26580 | 6e 64 20 74 65 73 74 20 66 6f 72 20 60 66 69 6e 64 2d 64 69 76 69 73 6f 72 27 20 69 73 20 62 61 | nd.test.for.`find-divisor'.is.ba |
| 265a0 | 73 65 64 20 6f 6e 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 69 66 20 6e 20 69 73 20 6e 6f 74 | sed.on.the.fact.that.if.n.is.not |
| 265c0 | 0a 70 72 69 6d 65 20 69 74 20 6d 75 73 74 20 68 61 76 65 20 61 20 64 69 76 69 73 6f 72 20 6c 65 | .prime.it.must.have.a.divisor.le |
| 265e0 | 73 73 20 74 68 61 6e 20 6f 72 20 65 71 75 61 6c 20 74 6f 20 5f 5b 73 71 72 74 5d 5f 28 6e 29 2e | ss.than.or.equal.to._[sqrt]_(n). |
| 26600 | 28 31 29 0a 54 68 69 73 20 6d 65 61 6e 73 20 74 68 61 74 20 74 68 65 20 61 6c 67 6f 72 69 74 68 | (1).This.means.that.the.algorith |
| 26620 | 6d 20 6e 65 65 64 20 6f 6e 6c 79 20 74 65 73 74 20 64 69 76 69 73 6f 72 73 20 62 65 74 77 65 65 | m.need.only.test.divisors.betwee |
| 26640 | 6e 20 31 20 61 6e 64 0a 5f 5b 73 71 72 74 5d 5f 28 6e 29 2e 20 20 43 6f 6e 73 65 71 75 65 6e 74 | n.1.and._[sqrt]_(n)...Consequent |
| 26660 | 6c 79 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 72 65 71 75 69 72 65 64 | ly,.the.number.of.steps.required |
| 26680 | 20 74 6f 20 69 64 65 6e 74 69 66 79 20 6e 0a 61 73 20 70 72 69 6d 65 20 77 69 6c 6c 20 68 61 76 | .to.identify.n.as.prime.will.hav |
| 266a0 | 65 20 6f 72 64 65 72 20 6f 66 20 67 72 6f 77 74 68 20 5b 74 68 65 74 61 5d 28 5f 5b 73 71 72 74 | e.order.of.growth.[theta](_[sqrt |
| 266c0 | 5d 5f 28 6e 29 29 2e 0a 0a 54 68 65 20 46 65 72 6d 61 74 20 74 65 73 74 0a 2e 2e 2e 2e 2e 2e 2e | ]_(n))...The.Fermat.test........ |
| 266e0 | 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 5b 74 68 65 74 61 5d 28 60 6c 6f 67 27 20 6e 29 20 70 | ..........The.[theta](`log'.n).p |
| 26700 | 72 69 6d 61 6c 69 74 79 20 74 65 73 74 20 69 73 20 62 61 73 65 64 20 6f 6e 20 61 20 72 65 73 75 | rimality.test.is.based.on.a.resu |
| 26720 | 6c 74 20 66 72 6f 6d 20 6e 75 6d 62 65 72 0a 74 68 65 6f 72 79 20 6b 6e 6f 77 6e 20 61 73 20 46 | lt.from.number.theory.known.as.F |
| 26740 | 65 72 6d 61 74 27 73 20 4c 69 74 74 6c 65 20 54 68 65 6f 72 65 6d 2e 28 32 29 0a 0a 20 20 20 20 | ermat's.Little.Theorem.(2)...... |
| 26760 | 20 2a 46 65 72 6d 61 74 27 73 20 4c 69 74 74 6c 65 20 54 68 65 6f 72 65 6d 3a 2a 20 49 66 20 6e | .*Fermat's.Little.Theorem:*.If.n |
| 26780 | 20 69 73 20 61 20 70 72 69 6d 65 20 6e 75 6d 62 65 72 20 61 6e 64 20 61 20 69 73 20 61 6e 79 0a | .is.a.prime.number.and.a.is.any. |
| 267a0 | 20 20 20 20 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 20 6c 65 73 73 20 74 68 61 6e 20 | .....positive.integer.less.than. |
| 267c0 | 6e 2c 20 74 68 65 6e 20 61 20 72 61 69 73 65 64 20 74 6f 20 74 68 65 20 6e 74 68 20 70 6f 77 65 | n,.then.a.raised.to.the.nth.powe |
| 267e0 | 72 20 69 73 0a 20 20 20 20 20 63 6f 6e 67 72 75 65 6e 74 20 74 6f 20 61 20 6d 6f 64 75 6c 6f 20 | r.is......congruent.to.a.modulo. |
| 26800 | 6e 2e 0a 0a 20 20 20 28 54 77 6f 20 6e 75 6d 62 65 72 73 20 61 72 65 20 73 61 69 64 20 74 6f 20 | n......(Two.numbers.are.said.to. |
| 26820 | 62 65 20 22 63 6f 6e 67 72 75 65 6e 74 20 6d 6f 64 75 6c 6f 22 20 6e 20 69 66 20 74 68 65 79 20 | be."congruent.modulo".n.if.they. |
| 26840 | 62 6f 74 68 20 68 61 76 65 0a 74 68 65 20 73 61 6d 65 20 72 65 6d 61 69 6e 64 65 72 20 77 68 65 | both.have.the.same.remainder.whe |
| 26860 | 6e 20 64 69 76 69 64 65 64 20 62 79 20 6e 2e 20 20 54 68 65 20 72 65 6d 61 69 6e 64 65 72 20 6f | n.divided.by.n...The.remainder.o |
| 26880 | 66 20 61 20 6e 75 6d 62 65 72 20 61 20 77 68 65 6e 0a 64 69 76 69 64 65 64 20 62 79 20 6e 20 69 | f.a.number.a.when.divided.by.n.i |
| 268a0 | 73 20 61 6c 73 6f 20 72 65 66 65 72 72 65 64 20 74 6f 20 61 73 20 74 68 65 20 22 72 65 6d 61 69 | s.also.referred.to.as.the."remai |
| 268c0 | 6e 64 65 72 20 6f 66 22 20 61 20 22 6d 6f 64 75 6c 6f 22 20 6e 2c 20 6f 72 0a 73 69 6d 70 6c 79 | nder.of".a."modulo".n,.or.simply |
| 268e0 | 20 61 73 20 61 20 22 6d 6f 64 75 6c 6f 22 20 6e 2e 29 0a 0a 20 20 20 49 66 20 6e 20 69 73 20 6e | .as.a."modulo".n.).....If.n.is.n |
| 26900 | 6f 74 20 70 72 69 6d 65 2c 20 74 68 65 6e 2c 20 69 6e 20 67 65 6e 65 72 61 6c 2c 20 6d 6f 73 74 | ot.prime,.then,.in.general,.most |
| 26920 | 20 6f 66 20 74 68 65 20 6e 75 6d 62 65 72 73 20 61 3c 20 6e 20 77 69 6c 6c 0a 6e 6f 74 20 73 61 | .of.the.numbers.a<.n.will.not.sa |
| 26940 | 74 69 73 66 79 20 74 68 65 20 61 62 6f 76 65 20 72 65 6c 61 74 69 6f 6e 2e 20 20 54 68 69 73 20 | tisfy.the.above.relation...This. |
| 26960 | 6c 65 61 64 73 20 74 6f 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d | leads.to.the.following.algorithm |
| 26980 | 0a 66 6f 72 20 74 65 73 74 69 6e 67 20 70 72 69 6d 61 6c 69 74 79 3a 20 47 69 76 65 6e 20 61 20 | .for.testing.primality:.Given.a. |
| 269a0 | 6e 75 6d 62 65 72 20 6e 2c 20 70 69 63 6b 20 61 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 20 61 | number.n,.pick.a.random.number.a |
| 269c0 | 20 3c 20 6e 20 61 6e 64 0a 63 6f 6d 70 75 74 65 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 6f | .<.n.and.compute.the.remainder.o |
| 269e0 | 66 20 61 5e 6e 20 6d 6f 64 75 6c 6f 20 6e 2e 20 20 49 66 20 74 68 65 20 72 65 73 75 6c 74 20 69 | f.a^n.modulo.n...If.the.result.i |
| 26a00 | 73 20 6e 6f 74 20 65 71 75 61 6c 20 74 6f 0a 61 2c 20 74 68 65 6e 20 6e 20 69 73 20 63 65 72 74 | s.not.equal.to.a,.then.n.is.cert |
| 26a20 | 61 69 6e 6c 79 20 6e 6f 74 20 70 72 69 6d 65 2e 20 20 49 66 20 69 74 20 69 73 20 61 2c 20 74 68 | ainly.not.prime...If.it.is.a,.th |
| 26a40 | 65 6e 20 63 68 61 6e 63 65 73 20 61 72 65 20 67 6f 6f 64 0a 74 68 61 74 20 6e 20 69 73 20 70 72 | en.chances.are.good.that.n.is.pr |
| 26a60 | 69 6d 65 2e 20 20 4e 6f 77 20 70 69 63 6b 20 61 6e 6f 74 68 65 72 20 72 61 6e 64 6f 6d 20 6e 75 | ime...Now.pick.another.random.nu |
| 26a80 | 6d 62 65 72 20 61 20 61 6e 64 20 74 65 73 74 20 69 74 20 77 69 74 68 20 74 68 65 0a 73 61 6d 65 | mber.a.and.test.it.with.the.same |
| 26aa0 | 20 6d 65 74 68 6f 64 2e 20 20 49 66 20 69 74 20 61 6c 73 6f 20 73 61 74 69 73 66 69 65 73 20 74 | .method...If.it.also.satisfies.t |
| 26ac0 | 68 65 20 65 71 75 61 74 69 6f 6e 2c 20 74 68 65 6e 20 77 65 20 63 61 6e 20 62 65 20 65 76 65 6e | he.equation,.then.we.can.be.even |
| 26ae0 | 0a 6d 6f 72 65 20 63 6f 6e 66 69 64 65 6e 74 20 74 68 61 74 20 6e 20 69 73 20 70 72 69 6d 65 2e | .more.confident.that.n.is.prime. |
| 26b00 | 20 20 42 79 20 74 72 79 69 6e 67 20 6d 6f 72 65 20 61 6e 64 20 6d 6f 72 65 20 76 61 6c 75 65 73 | ..By.trying.more.and.more.values |
| 26b20 | 20 6f 66 20 61 2c 0a 77 65 20 63 61 6e 20 69 6e 63 72 65 61 73 65 20 6f 75 72 20 63 6f 6e 66 69 | .of.a,.we.can.increase.our.confi |
| 26b40 | 64 65 6e 63 65 20 69 6e 20 74 68 65 20 72 65 73 75 6c 74 2e 20 20 54 68 69 73 20 61 6c 67 6f 72 | dence.in.the.result...This.algor |
| 26b60 | 69 74 68 6d 20 69 73 20 6b 6e 6f 77 6e 0a 61 73 20 74 68 65 20 46 65 72 6d 61 74 20 74 65 73 74 | ithm.is.known.as.the.Fermat.test |
| 26b80 | 2e 0a 0a 20 20 20 54 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 46 65 72 6d 61 74 20 74 65 | ......To.implement.the.Fermat.te |
| 26ba0 | 73 74 2c 20 77 65 20 6e 65 65 64 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 6f 6d | st,.we.need.a.procedure.that.com |
| 26bc0 | 70 75 74 65 73 20 74 68 65 0a 65 78 70 6f 6e 65 6e 74 69 61 6c 20 6f 66 20 61 20 6e 75 6d 62 65 | putes.the.exponential.of.a.numbe |
| 26be0 | 72 20 6d 6f 64 75 6c 6f 20 61 6e 6f 74 68 65 72 20 6e 75 6d 62 65 72 3a 0a 0a 20 20 20 20 20 28 | r.modulo.another.number:.......( |
| 26c00 | 64 65 66 69 6e 65 20 28 65 78 70 6d 6f 64 20 62 61 73 65 20 65 78 70 20 6d 29 0a 20 20 20 20 20 | define.(expmod.base.exp.m)...... |
| 26c20 | 20 20 28 63 6f 6e 64 20 28 28 3d 20 65 78 70 20 30 29 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 | ..(cond.((=.exp.0).1)........... |
| 26c40 | 20 20 20 28 28 65 76 65 6e 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 | ...((even?.exp)...............(r |
| 26c60 | 65 6d 61 69 6e 64 65 72 20 28 73 71 75 61 72 65 20 28 65 78 70 6d 6f 64 20 62 61 73 65 20 28 2f | emainder.(square.(expmod.base.(/ |
| 26c80 | 20 65 78 70 20 32 29 20 6d 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .exp.2).m))..................... |
| 26ca0 | 20 20 20 20 20 6d 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 | .....m))..............(else..... |
| 26cc0 | 20 20 20 20 20 20 20 20 20 20 28 72 65 6d 61 69 6e 64 65 72 20 28 2a 20 62 61 73 65 20 28 65 78 | ..........(remainder.(*.base.(ex |
| 26ce0 | 70 6d 6f 64 20 62 61 73 65 20 28 2d 20 65 78 70 20 31 29 20 6d 29 29 0a 20 20 20 20 20 20 20 20 | pmod.base.(-.exp.1).m))......... |
| 26d00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 29 29 29 29 0a 0a 20 20 20 54 68 69 73 20 | .................m)))).....This. |
| 26d20 | 69 73 20 76 65 72 79 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 60 66 61 73 74 2d 65 78 70 | is.very.similar.to.the.`fast-exp |
| 26d40 | 74 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 31 2d | t'.procedure.of.section.*Note.1- |
| 26d60 | 32 2d 34 3a 3a 2e 20 20 49 74 20 75 73 65 73 20 73 75 63 63 65 73 73 69 76 65 20 73 71 75 61 72 | 2-4::...It.uses.successive.squar |
| 26d80 | 69 6e 67 2c 20 73 6f 20 74 68 61 74 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 | ing,.so.that.the.number.of.steps |
| 26da0 | 0a 67 72 6f 77 73 20 6c 6f 67 61 72 69 74 68 6d 69 63 61 6c 6c 79 20 77 69 74 68 20 74 68 65 20 | .grows.logarithmically.with.the. |
| 26dc0 | 65 78 70 6f 6e 65 6e 74 2e 28 33 29 0a 0a 20 20 20 54 68 65 20 46 65 72 6d 61 74 20 74 65 73 74 | exponent.(3).....The.Fermat.test |
| 26de0 | 20 69 73 20 70 65 72 66 6f 72 6d 65 64 20 62 79 20 63 68 6f 6f 73 69 6e 67 20 61 74 20 72 61 6e | .is.performed.by.choosing.at.ran |
| 26e00 | 64 6f 6d 20 61 20 6e 75 6d 62 65 72 20 61 0a 62 65 74 77 65 65 6e 20 31 20 61 6e 64 20 6e 20 2d | dom.a.number.a.between.1.and.n.- |
| 26e20 | 20 31 20 69 6e 63 6c 75 73 69 76 65 20 61 6e 64 20 63 68 65 63 6b 69 6e 67 20 77 68 65 74 68 65 | .1.inclusive.and.checking.whethe |
| 26e40 | 72 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 6d 6f 64 75 6c 6f 0a 6e 20 6f 66 20 74 68 65 20 | r.the.remainder.modulo.n.of.the. |
| 26e60 | 6e 74 68 20 70 6f 77 65 72 20 6f 66 20 61 20 69 73 20 65 71 75 61 6c 20 74 6f 20 61 2e 20 20 54 | nth.power.of.a.is.equal.to.a...T |
| 26e80 | 68 65 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 20 61 20 69 73 20 63 68 6f 73 65 6e 0a 75 73 69 | he.random.number.a.is.chosen.usi |
| 26ea0 | 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 72 61 6e 64 6f 6d 27 2c 20 77 68 69 63 68 | ng.the.procedure.`random',.which |
| 26ec0 | 20 77 65 20 61 73 73 75 6d 65 20 69 73 20 69 6e 63 6c 75 64 65 64 20 61 73 20 61 20 70 72 69 6d | .we.assume.is.included.as.a.prim |
| 26ee0 | 69 74 69 76 65 0a 69 6e 20 53 63 68 65 6d 65 2e 20 60 52 61 6e 64 6f 6d 27 20 72 65 74 75 72 6e | itive.in.Scheme..`Random'.return |
| 26f00 | 73 20 61 20 6e 6f 6e 6e 65 67 61 74 69 76 65 20 69 6e 74 65 67 65 72 20 6c 65 73 73 20 74 68 61 | s.a.nonnegative.integer.less.tha |
| 26f20 | 6e 20 69 74 73 20 69 6e 74 65 67 65 72 0a 69 6e 70 75 74 2e 20 20 48 65 6e 63 65 2c 20 74 6f 20 | n.its.integer.input...Hence,.to. |
| 26f40 | 6f 62 74 61 69 6e 20 61 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 20 62 65 74 77 65 65 6e 20 31 | obtain.a.random.number.between.1 |
| 26f60 | 20 61 6e 64 20 6e 20 2d 20 31 2c 20 77 65 20 63 61 6c 6c 0a 60 72 61 6e 64 6f 6d 27 20 77 69 74 | .and.n.-.1,.we.call.`random'.wit |
| 26f80 | 68 20 61 6e 20 69 6e 70 75 74 20 6f 66 20 6e 20 2d 20 31 20 61 6e 64 20 61 64 64 20 31 20 74 6f | h.an.input.of.n.-.1.and.add.1.to |
| 26fa0 | 20 74 68 65 20 72 65 73 75 6c 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 65 72 6d | .the.result:.......(define.(ferm |
| 26fc0 | 61 74 2d 74 65 73 74 20 6e 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 79 2d 69 | at-test.n)........(define.(try-i |
| 26fe0 | 74 20 61 29 0a 20 20 20 20 20 20 20 20 20 28 3d 20 28 65 78 70 6d 6f 64 20 61 20 6e 20 6e 29 20 | t.a)..........(=.(expmod.a.n.n). |
| 27000 | 61 29 29 0a 20 20 20 20 20 20 20 28 74 72 79 2d 69 74 20 28 2b 20 31 20 28 72 61 6e 64 6f 6d 20 | a))........(try-it.(+.1.(random. |
| 27020 | 28 2d 20 6e 20 31 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 | (-.n.1))))).....The.following.pr |
| 27040 | 6f 63 65 64 75 72 65 20 72 75 6e 73 20 74 68 65 20 74 65 73 74 20 61 20 67 69 76 65 6e 20 6e 75 | ocedure.runs.the.test.a.given.nu |
| 27060 | 6d 62 65 72 20 6f 66 20 74 69 6d 65 73 2c 20 61 73 0a 73 70 65 63 69 66 69 65 64 20 62 79 20 61 | mber.of.times,.as.specified.by.a |
| 27080 | 20 70 61 72 61 6d 65 74 65 72 2e 20 20 49 74 73 20 76 61 6c 75 65 20 69 73 20 74 72 75 65 20 69 | .parameter...Its.value.is.true.i |
| 270a0 | 66 20 74 68 65 20 74 65 73 74 20 73 75 63 63 65 65 64 73 20 65 76 65 72 79 0a 74 69 6d 65 2c 20 | f.the.test.succeeds.every.time,. |
| 270c0 | 61 6e 64 20 66 61 6c 73 65 20 6f 74 68 65 72 77 69 73 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 | and.false.otherwise........(defi |
| 270e0 | 6e 65 20 28 66 61 73 74 2d 70 72 69 6d 65 3f 20 6e 20 74 69 6d 65 73 29 0a 20 20 20 20 20 20 20 | ne.(fast-prime?.n.times)........ |
| 27100 | 28 63 6f 6e 64 20 28 28 3d 20 74 69 6d 65 73 20 30 29 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 | (cond.((=.times.0).true)........ |
| 27120 | 20 20 20 20 20 20 28 28 66 65 72 6d 61 74 2d 74 65 73 74 20 6e 29 20 28 66 61 73 74 2d 70 72 69 | ......((fermat-test.n).(fast-pri |
| 27140 | 6d 65 3f 20 6e 20 28 2d 20 74 69 6d 65 73 20 31 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | me?.n.(-.times.1)))............. |
| 27160 | 20 28 65 6c 73 65 20 66 61 6c 73 65 29 29 29 0a 0a 50 72 6f 62 61 62 69 6c 69 73 74 69 63 20 6d | .(else.false)))..Probabilistic.m |
| 27180 | 65 74 68 6f 64 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 | ethods........................Th |
| 271a0 | 65 20 46 65 72 6d 61 74 20 74 65 73 74 20 64 69 66 66 65 72 73 20 69 6e 20 63 68 61 72 61 63 74 | e.Fermat.test.differs.in.charact |
| 271c0 | 65 72 20 66 72 6f 6d 20 6d 6f 73 74 20 66 61 6d 69 6c 69 61 72 20 61 6c 67 6f 72 69 74 68 6d 73 | er.from.most.familiar.algorithms |
| 271e0 | 2c 20 69 6e 0a 77 68 69 63 68 20 6f 6e 65 20 63 6f 6d 70 75 74 65 73 20 61 6e 20 61 6e 73 77 65 | ,.in.which.one.computes.an.answe |
| 27200 | 72 20 74 68 61 74 20 69 73 20 67 75 61 72 61 6e 74 65 65 64 20 74 6f 20 62 65 20 63 6f 72 72 65 | r.that.is.guaranteed.to.be.corre |
| 27220 | 63 74 2e 20 20 48 65 72 65 2c 0a 74 68 65 20 61 6e 73 77 65 72 20 6f 62 74 61 69 6e 65 64 20 69 | ct...Here,.the.answer.obtained.i |
| 27240 | 73 20 6f 6e 6c 79 20 70 72 6f 62 61 62 6c 79 20 63 6f 72 72 65 63 74 2e 20 20 4d 6f 72 65 20 70 | s.only.probably.correct...More.p |
| 27260 | 72 65 63 69 73 65 6c 79 2c 20 69 66 20 6e 0a 65 76 65 72 20 66 61 69 6c 73 20 74 68 65 20 46 65 | recisely,.if.n.ever.fails.the.Fe |
| 27280 | 72 6d 61 74 20 74 65 73 74 2c 20 77 65 20 63 61 6e 20 62 65 20 63 65 72 74 61 69 6e 20 74 68 61 | rmat.test,.we.can.be.certain.tha |
| 272a0 | 74 20 6e 20 69 73 20 6e 6f 74 20 70 72 69 6d 65 2e 20 20 42 75 74 0a 74 68 65 20 66 61 63 74 20 | t.n.is.not.prime...But.the.fact. |
| 272c0 | 74 68 61 74 20 6e 20 70 61 73 73 65 73 20 74 68 65 20 74 65 73 74 2c 20 77 68 69 6c 65 20 61 6e | that.n.passes.the.test,.while.an |
| 272e0 | 20 65 78 74 72 65 6d 65 6c 79 20 73 74 72 6f 6e 67 20 69 6e 64 69 63 61 74 69 6f 6e 2c 0a 69 73 | .extremely.strong.indication,.is |
| 27300 | 20 73 74 69 6c 6c 20 6e 6f 74 20 61 20 67 75 61 72 61 6e 74 65 65 20 74 68 61 74 20 6e 20 69 73 | .still.not.a.guarantee.that.n.is |
| 27320 | 20 70 72 69 6d 65 2e 20 20 57 68 61 74 20 77 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 20 73 | .prime...What.we.would.like.to.s |
| 27340 | 61 79 20 69 73 0a 74 68 61 74 20 66 6f 72 20 61 6e 79 20 6e 75 6d 62 65 72 20 6e 2c 20 69 66 20 | ay.is.that.for.any.number.n,.if. |
| 27360 | 77 65 20 70 65 72 66 6f 72 6d 20 74 68 65 20 74 65 73 74 20 65 6e 6f 75 67 68 20 74 69 6d 65 73 | we.perform.the.test.enough.times |
| 27380 | 20 61 6e 64 20 66 69 6e 64 0a 74 68 61 74 20 6e 20 61 6c 77 61 79 73 20 70 61 73 73 65 73 20 74 | .and.find.that.n.always.passes.t |
| 273a0 | 68 65 20 74 65 73 74 2c 20 74 68 65 6e 20 74 68 65 20 70 72 6f 62 61 62 69 6c 69 74 79 20 6f 66 | he.test,.then.the.probability.of |
| 273c0 | 20 65 72 72 6f 72 20 69 6e 20 6f 75 72 0a 70 72 69 6d 61 6c 69 74 79 20 74 65 73 74 20 63 61 6e | .error.in.our.primality.test.can |
| 273e0 | 20 62 65 20 6d 61 64 65 20 61 73 20 73 6d 61 6c 6c 20 61 73 20 77 65 20 6c 69 6b 65 2e 0a 0a 20 | .be.made.as.small.as.we.like.... |
| 27400 | 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 74 68 69 73 20 61 73 73 65 72 74 69 6f 6e 20 | ..Unfortunately,.this.assertion. |
| 27420 | 69 73 20 6e 6f 74 20 71 75 69 74 65 20 63 6f 72 72 65 63 74 2e 20 20 54 68 65 72 65 20 64 6f 20 | is.not.quite.correct...There.do. |
| 27440 | 65 78 69 73 74 0a 6e 75 6d 62 65 72 73 20 74 68 61 74 20 66 6f 6f 6c 20 74 68 65 20 46 65 72 6d | exist.numbers.that.fool.the.Ferm |
| 27460 | 61 74 20 74 65 73 74 3a 20 6e 75 6d 62 65 72 73 20 6e 20 74 68 61 74 20 61 72 65 20 6e 6f 74 20 | at.test:.numbers.n.that.are.not. |
| 27480 | 70 72 69 6d 65 20 61 6e 64 20 79 65 74 0a 68 61 76 65 20 74 68 65 20 70 72 6f 70 65 72 74 79 20 | prime.and.yet.have.the.property. |
| 274a0 | 74 68 61 74 20 61 5e 6e 20 69 73 20 63 6f 6e 67 72 75 65 6e 74 20 74 6f 20 61 20 6d 6f 64 75 6c | that.a^n.is.congruent.to.a.modul |
| 274c0 | 6f 20 6e 20 66 6f 72 20 61 6c 6c 20 69 6e 74 65 67 65 72 73 0a 61 20 3c 20 6e 2e 20 20 53 75 63 | o.n.for.all.integers.a.<.n...Suc |
| 274e0 | 68 20 6e 75 6d 62 65 72 73 20 61 72 65 20 65 78 74 72 65 6d 65 6c 79 20 72 61 72 65 2c 20 73 6f | h.numbers.are.extremely.rare,.so |
| 27500 | 20 74 68 65 20 46 65 72 6d 61 74 20 74 65 73 74 20 69 73 20 71 75 69 74 65 0a 72 65 6c 69 61 62 | .the.Fermat.test.is.quite.reliab |
| 27520 | 6c 65 20 69 6e 20 70 72 61 63 74 69 63 65 2e 28 34 29 0a 0a 20 20 20 54 68 65 72 65 20 61 72 65 | le.in.practice.(4).....There.are |
| 27540 | 20 76 61 72 69 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 46 65 72 6d 61 74 20 74 65 73 74 20 74 | .variations.of.the.Fermat.test.t |
| 27560 | 68 61 74 20 63 61 6e 6e 6f 74 20 62 65 20 66 6f 6f 6c 65 64 2e 20 20 49 6e 0a 74 68 65 73 65 20 | hat.cannot.be.fooled...In.these. |
| 27580 | 74 65 73 74 73 2c 20 61 73 20 77 69 74 68 20 74 68 65 20 46 65 72 6d 61 74 20 6d 65 74 68 6f 64 | tests,.as.with.the.Fermat.method |
| 275a0 | 2c 20 6f 6e 65 20 74 65 73 74 73 20 74 68 65 20 70 72 69 6d 61 6c 69 74 79 20 6f 66 20 61 6e 0a | ,.one.tests.the.primality.of.an. |
| 275c0 | 69 6e 74 65 67 65 72 20 6e 20 62 79 20 63 68 6f 6f 73 69 6e 67 20 61 20 72 61 6e 64 6f 6d 20 69 | integer.n.by.choosing.a.random.i |
| 275e0 | 6e 74 65 67 65 72 20 61 3c 6e 20 61 6e 64 20 63 68 65 63 6b 69 6e 67 20 73 6f 6d 65 20 63 6f 6e | nteger.a<n.and.checking.some.con |
| 27600 | 64 69 74 69 6f 6e 0a 74 68 61 74 20 64 65 70 65 6e 64 73 20 75 70 6f 6e 20 6e 20 61 6e 64 20 61 | dition.that.depends.upon.n.and.a |
| 27620 | 2e 20 20 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 32 38 3a 3a 20 66 6f | ...(See.*Note.Exercise.1-28::.fo |
| 27640 | 72 20 61 6e 20 65 78 61 6d 70 6c 65 0a 6f 66 20 73 75 63 68 20 61 20 74 65 73 74 2e 29 20 20 4f | r.an.example.of.such.a.test.)..O |
| 27660 | 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 69 6e 20 63 6f 6e 74 72 61 73 74 20 74 6f | n.the.other.hand,.in.contrast.to |
| 27680 | 20 74 68 65 20 46 65 72 6d 61 74 20 74 65 73 74 2c 0a 6f 6e 65 20 63 61 6e 20 70 72 6f 76 65 20 | .the.Fermat.test,.one.can.prove. |
| 276a0 | 74 68 61 74 2c 20 66 6f 72 20 61 6e 79 20 6e 2c 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 20 64 | that,.for.any.n,.the.condition.d |
| 276c0 | 6f 65 73 20 6e 6f 74 20 68 6f 6c 64 20 66 6f 72 20 6d 6f 73 74 20 6f 66 0a 74 68 65 20 69 6e 74 | oes.not.hold.for.most.of.the.int |
| 276e0 | 65 67 65 72 73 20 61 3c 6e 20 75 6e 6c 65 73 73 20 6e 20 69 73 20 70 72 69 6d 65 2e 20 20 54 68 | egers.a<n.unless.n.is.prime...Th |
| 27700 | 75 73 2c 20 69 66 20 6e 20 70 61 73 73 65 73 20 74 68 65 20 74 65 73 74 20 66 6f 72 0a 73 6f 6d | us,.if.n.passes.the.test.for.som |
| 27720 | 65 20 72 61 6e 64 6f 6d 20 63 68 6f 69 63 65 20 6f 66 20 61 2c 20 74 68 65 20 63 68 61 6e 63 65 | e.random.choice.of.a,.the.chance |
| 27740 | 73 20 61 72 65 20 62 65 74 74 65 72 20 74 68 61 6e 20 65 76 65 6e 20 74 68 61 74 20 6e 20 69 73 | s.are.better.than.even.that.n.is |
| 27760 | 0a 70 72 69 6d 65 2e 20 20 49 66 20 6e 20 70 61 73 73 65 73 20 74 68 65 20 74 65 73 74 20 66 6f | .prime...If.n.passes.the.test.fo |
| 27780 | 72 20 74 77 6f 20 72 61 6e 64 6f 6d 20 63 68 6f 69 63 65 73 20 6f 66 20 61 2c 20 74 68 65 20 63 | r.two.random.choices.of.a,.the.c |
| 277a0 | 68 61 6e 63 65 73 0a 61 72 65 20 62 65 74 74 65 72 20 74 68 61 6e 20 33 20 6f 75 74 20 6f 66 20 | hances.are.better.than.3.out.of. |
| 277c0 | 34 20 74 68 61 74 20 6e 20 69 73 20 70 72 69 6d 65 2e 20 42 79 20 72 75 6e 6e 69 6e 67 20 74 68 | 4.that.n.is.prime..By.running.th |
| 277e0 | 65 20 74 65 73 74 20 77 69 74 68 0a 6d 6f 72 65 20 61 6e 64 20 6d 6f 72 65 20 72 61 6e 64 6f 6d | e.test.with.more.and.more.random |
| 27800 | 6c 79 20 63 68 6f 73 65 6e 20 76 61 6c 75 65 73 20 6f 66 20 61 20 77 65 20 63 61 6e 20 6d 61 6b | ly.chosen.values.of.a.we.can.mak |
| 27820 | 65 20 74 68 65 20 70 72 6f 62 61 62 69 6c 69 74 79 0a 6f 66 20 65 72 72 6f 72 20 61 73 20 73 6d | e.the.probability.of.error.as.sm |
| 27840 | 61 6c 6c 20 61 73 20 77 65 20 6c 69 6b 65 2e 0a 0a 20 20 20 54 68 65 20 65 78 69 73 74 65 6e 63 | all.as.we.like......The.existenc |
| 27860 | 65 20 6f 66 20 74 65 73 74 73 20 66 6f 72 20 77 68 69 63 68 20 6f 6e 65 20 63 61 6e 20 70 72 6f | e.of.tests.for.which.one.can.pro |
| 27880 | 76 65 20 74 68 61 74 20 74 68 65 20 63 68 61 6e 63 65 20 6f 66 0a 65 72 72 6f 72 20 62 65 63 6f | ve.that.the.chance.of.error.beco |
| 278a0 | 6d 65 73 20 61 72 62 69 74 72 61 72 69 6c 79 20 73 6d 61 6c 6c 20 68 61 73 20 73 70 61 72 6b 65 | mes.arbitrarily.small.has.sparke |
| 278c0 | 64 20 69 6e 74 65 72 65 73 74 20 69 6e 20 61 6c 67 6f 72 69 74 68 6d 73 20 6f 66 0a 74 68 69 73 | d.interest.in.algorithms.of.this |
| 278e0 | 20 74 79 70 65 2c 20 77 68 69 63 68 20 68 61 76 65 20 63 6f 6d 65 20 74 6f 20 62 65 20 6b 6e 6f | .type,.which.have.come.to.be.kno |
| 27900 | 77 6e 20 61 73 20 22 70 72 6f 62 61 62 69 6c 69 73 74 69 63 20 61 6c 67 6f 72 69 74 68 6d 73 22 | wn.as."probabilistic.algorithms" |
| 27920 | 2e 0a 54 68 65 72 65 20 69 73 20 61 20 67 72 65 61 74 20 64 65 61 6c 20 6f 66 20 72 65 73 65 61 | ..There.is.a.great.deal.of.resea |
| 27940 | 72 63 68 20 61 63 74 69 76 69 74 79 20 69 6e 20 74 68 69 73 20 61 72 65 61 2c 20 61 6e 64 0a 70 | rch.activity.in.this.area,.and.p |
| 27960 | 72 6f 62 61 62 69 6c 69 73 74 69 63 20 61 6c 67 6f 72 69 74 68 6d 73 20 68 61 76 65 20 62 65 65 | robabilistic.algorithms.have.bee |
| 27980 | 6e 20 66 72 75 69 74 66 75 6c 6c 79 20 61 70 70 6c 69 65 64 20 74 6f 20 6d 61 6e 79 20 66 69 65 | n.fruitfully.applied.to.many.fie |
| 279a0 | 6c 64 73 2e 28 35 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 32 31 3a 2a 20 55 | lds.(5).......*Exercise.1.21:*.U |
| 279c0 | 73 65 20 74 68 65 20 60 73 6d 61 6c 6c 65 73 74 2d 64 69 76 69 73 6f 72 27 20 70 72 6f 63 65 64 | se.the.`smallest-divisor'.proced |
| 279e0 | 75 72 65 20 74 6f 20 66 69 6e 64 20 74 68 65 0a 20 20 20 20 20 73 6d 61 6c 6c 65 73 74 20 64 69 | ure.to.find.the......smallest.di |
| 27a00 | 76 69 73 6f 72 20 6f 66 20 65 61 63 68 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6e | visor.of.each.of.the.following.n |
| 27a20 | 75 6d 62 65 72 73 3a 20 31 39 39 2c 20 31 39 39 39 2c 0a 20 20 20 20 20 31 39 39 39 39 2e 0a 0a | umbers:.199,.1999,......19999... |
| 27a40 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 32 32 3a 2a 20 4d 6f 73 74 20 4c 69 73 70 20 | .....*Exercise.1.22:*.Most.Lisp. |
| 27a60 | 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 69 6e 63 6c 75 64 65 20 61 20 70 72 69 6d 69 74 | implementations.include.a.primit |
| 27a80 | 69 76 65 0a 20 20 20 20 20 63 61 6c 6c 65 64 20 60 72 75 6e 74 69 6d 65 27 20 74 68 61 74 20 72 | ive......called.`runtime'.that.r |
| 27aa0 | 65 74 75 72 6e 73 20 61 6e 20 69 6e 74 65 67 65 72 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 | eturns.an.integer.that.specifies |
| 27ac0 | 20 74 68 65 20 61 6d 6f 75 6e 74 0a 20 20 20 20 20 6f 66 20 74 69 6d 65 20 74 68 65 20 73 79 73 | .the.amount......of.time.the.sys |
| 27ae0 | 74 65 6d 20 68 61 73 20 62 65 65 6e 20 72 75 6e 6e 69 6e 67 20 28 6d 65 61 73 75 72 65 64 2c 20 | tem.has.been.running.(measured,. |
| 27b00 | 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 6e 0a 20 20 20 20 20 6d 69 63 72 6f 73 65 63 6f 6e 64 | for.example,.in......microsecond |
| 27b20 | 73 29 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 60 74 69 6d 65 64 2d 70 72 69 6d 65 2d | s)...The.following.`timed-prime- |
| 27b40 | 74 65 73 74 27 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 65 6e 0a 20 20 20 20 20 63 61 6c 6c 65 | test'.procedure,.when......calle |
| 27b60 | 64 20 77 69 74 68 20 61 6e 20 69 6e 74 65 67 65 72 20 6e 2c 20 70 72 69 6e 74 73 20 6e 20 61 6e | d.with.an.integer.n,.prints.n.an |
| 27b80 | 64 20 63 68 65 63 6b 73 20 74 6f 20 73 65 65 20 69 66 20 6e 20 69 73 0a 20 20 20 20 20 70 72 69 | d.checks.to.see.if.n.is......pri |
| 27ba0 | 6d 65 2e 20 20 49 66 20 6e 20 69 73 20 70 72 69 6d 65 2c 20 74 68 65 20 70 72 6f 63 65 64 75 72 | me...If.n.is.prime,.the.procedur |
| 27bc0 | 65 20 70 72 69 6e 74 73 20 74 68 72 65 65 20 61 73 74 65 72 69 73 6b 73 0a 20 20 20 20 20 66 6f | e.prints.three.asterisks......fo |
| 27be0 | 6c 6c 6f 77 65 64 20 62 79 20 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66 20 74 69 6d 65 20 75 73 65 | llowed.by.the.amount.of.time.use |
| 27c00 | 64 20 69 6e 20 70 65 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 74 65 73 74 2e 0a 0a 20 20 20 20 20 | d.in.performing.the.test........ |
| 27c20 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 69 6d 65 64 2d 70 72 69 6d 65 2d 74 65 73 74 20 6e | .....(define.(timed-prime-test.n |
| 27c40 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 20 20 | ).............(newline)......... |
| 27c60 | 20 20 20 20 28 64 69 73 70 6c 61 79 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 61 | ....(display.n).............(sta |
| 27c80 | 72 74 2d 70 72 69 6d 65 2d 74 65 73 74 20 6e 20 28 72 75 6e 74 69 6d 65 29 29 29 0a 0a 20 20 20 | rt-prime-test.n.(runtime)))..... |
| 27ca0 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 61 72 74 2d 70 72 69 6d 65 2d 74 65 73 74 | .......(define.(start-prime-test |
| 27cc0 | 20 6e 20 73 74 61 72 74 2d 74 69 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 | .n.start-time).............(if.( |
| 27ce0 | 70 72 69 6d 65 3f 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 70 6f 72 | prime?.n).................(repor |
| 27d00 | 74 2d 70 72 69 6d 65 20 28 2d 20 28 72 75 6e 74 69 6d 65 29 20 73 74 61 72 74 2d 74 69 6d 65 29 | t-prime.(-.(runtime).start-time) |
| 27d20 | 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 70 6f 72 74 2d 70 | )))............(define.(report-p |
| 27d40 | 72 69 6d 65 20 65 6c 61 70 73 65 64 2d 74 69 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | rime.elapsed-time).............( |
| 27d60 | 64 69 73 70 6c 61 79 20 22 20 2a 2a 2a 20 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 | display.".***.").............(di |
| 27d80 | 73 70 6c 61 79 20 65 6c 61 70 73 65 64 2d 74 69 6d 65 29 29 0a 0a 20 20 20 20 20 55 73 69 6e 67 | splay.elapsed-time)).......Using |
| 27da0 | 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 2c 20 77 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 | .this.procedure,.write.a.procedu |
| 27dc0 | 72 65 20 60 73 65 61 72 63 68 2d 66 6f 72 2d 70 72 69 6d 65 73 27 20 74 68 61 74 0a 20 20 20 20 | re.`search-for-primes'.that..... |
| 27de0 | 20 63 68 65 63 6b 73 20 74 68 65 20 70 72 69 6d 61 6c 69 74 79 20 6f 66 20 63 6f 6e 73 65 63 75 | .checks.the.primality.of.consecu |
| 27e00 | 74 69 76 65 20 6f 64 64 20 69 6e 74 65 67 65 72 73 20 69 6e 20 61 20 73 70 65 63 69 66 69 65 64 | tive.odd.integers.in.a.specified |
| 27e20 | 0a 20 20 20 20 20 72 61 6e 67 65 2e 20 20 55 73 65 20 79 6f 75 72 20 70 72 6f 63 65 64 75 72 65 | ......range...Use.your.procedure |
| 27e40 | 20 74 6f 20 66 69 6e 64 20 74 68 65 20 74 68 72 65 65 20 73 6d 61 6c 6c 65 73 74 20 70 72 69 6d | .to.find.the.three.smallest.prim |
| 27e60 | 65 73 0a 20 20 20 20 20 6c 61 72 67 65 72 20 74 68 61 6e 20 31 30 30 30 3b 20 6c 61 72 67 65 72 | es......larger.than.1000;.larger |
| 27e80 | 20 74 68 61 6e 20 31 30 2c 30 30 30 3b 20 6c 61 72 67 65 72 20 74 68 61 6e 20 31 30 30 2c 30 30 | .than.10,000;.larger.than.100,00 |
| 27ea0 | 30 3b 20 6c 61 72 67 65 72 0a 20 20 20 20 20 74 68 61 6e 20 31 2c 30 30 30 2c 30 30 30 2e 20 20 | 0;.larger......than.1,000,000... |
| 27ec0 | 4e 6f 74 65 20 74 68 65 20 74 69 6d 65 20 6e 65 65 64 65 64 20 74 6f 20 74 65 73 74 20 65 61 63 | Note.the.time.needed.to.test.eac |
| 27ee0 | 68 20 70 72 69 6d 65 2e 20 20 53 69 6e 63 65 0a 20 20 20 20 20 74 68 65 20 74 65 73 74 69 6e 67 | h.prime...Since......the.testing |
| 27f00 | 20 61 6c 67 6f 72 69 74 68 6d 20 68 61 73 20 6f 72 64 65 72 20 6f 66 20 67 72 6f 77 74 68 20 6f | .algorithm.has.order.of.growth.o |
| 27f20 | 66 20 5b 74 68 65 74 61 5d 28 5f 5b 73 71 72 74 5d 5f 28 6e 29 29 2c 0a 20 20 20 20 20 79 6f 75 | f.[theta](_[sqrt]_(n)),......you |
| 27f40 | 20 73 68 6f 75 6c 64 20 65 78 70 65 63 74 20 74 68 61 74 20 74 65 73 74 69 6e 67 20 66 6f 72 20 | .should.expect.that.testing.for. |
| 27f60 | 70 72 69 6d 65 73 20 61 72 6f 75 6e 64 20 31 30 2c 30 30 30 20 73 68 6f 75 6c 64 0a 20 20 20 20 | primes.around.10,000.should..... |
| 27f80 | 20 74 61 6b 65 20 61 62 6f 75 74 20 5f 5b 73 71 72 74 5d 5f 28 31 30 29 20 74 69 6d 65 73 20 61 | .take.about._[sqrt]_(10).times.a |
| 27fa0 | 73 20 6c 6f 6e 67 20 61 73 20 74 65 73 74 69 6e 67 20 66 6f 72 20 70 72 69 6d 65 73 20 61 72 6f | s.long.as.testing.for.primes.aro |
| 27fc0 | 75 6e 64 0a 20 20 20 20 20 31 30 30 30 2e 20 20 44 6f 20 79 6f 75 72 20 74 69 6d 69 6e 67 20 64 | und......1000...Do.your.timing.d |
| 27fe0 | 61 74 61 20 62 65 61 72 20 74 68 69 73 20 6f 75 74 3f 20 20 48 6f 77 20 77 65 6c 6c 20 64 6f 20 | ata.bear.this.out?..How.well.do. |
| 28000 | 74 68 65 20 64 61 74 61 0a 20 20 20 20 20 66 6f 72 20 31 30 30 2c 30 30 30 20 61 6e 64 20 31 2c | the.data......for.100,000.and.1, |
| 28020 | 30 30 30 2c 30 30 30 20 73 75 70 70 6f 72 74 20 74 68 65 20 5f 5b 73 71 72 74 5d 5f 28 6e 29 20 | 000,000.support.the._[sqrt]_(n). |
| 28040 | 70 72 65 64 69 63 74 69 6f 6e 3f 20 20 49 73 0a 20 20 20 20 20 79 6f 75 72 20 72 65 73 75 6c 74 | prediction?..Is......your.result |
| 28060 | 20 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68 20 74 68 65 20 6e 6f 74 69 6f 6e 20 74 68 61 74 | .compatible.with.the.notion.that |
| 28080 | 20 70 72 6f 67 72 61 6d 73 20 6f 6e 20 79 6f 75 72 0a 20 20 20 20 20 6d 61 63 68 69 6e 65 20 72 | .programs.on.your......machine.r |
| 280a0 | 75 6e 20 69 6e 20 74 69 6d 65 20 70 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 74 68 65 20 6e | un.in.time.proportional.to.the.n |
| 280c0 | 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 72 65 71 75 69 72 65 64 0a 20 20 20 20 20 66 6f 72 | umber.of.steps.required......for |
| 280e0 | 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | .the.computation?.......*Exercis |
| 28100 | 65 20 31 2e 32 33 3a 2a 20 54 68 65 20 60 73 6d 61 6c 6c 65 73 74 2d 64 69 76 69 73 6f 72 27 20 | e.1.23:*.The.`smallest-divisor'. |
| 28120 | 70 72 6f 63 65 64 75 72 65 20 73 68 6f 77 6e 20 61 74 20 74 68 65 0a 20 20 20 20 20 73 74 61 72 | procedure.shown.at.the......star |
| 28140 | 74 20 6f 66 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 64 6f 65 73 20 6c 6f 74 73 20 6f 66 20 6e | t.of.this.section.does.lots.of.n |
| 28160 | 65 65 64 6c 65 73 73 20 74 65 73 74 69 6e 67 3a 20 41 66 74 65 72 20 69 74 0a 20 20 20 20 20 63 | eedless.testing:.After.it......c |
| 28180 | 68 65 63 6b 73 20 74 6f 20 73 65 65 20 69 66 20 74 68 65 20 6e 75 6d 62 65 72 20 69 73 20 64 69 | hecks.to.see.if.the.number.is.di |
| 281a0 | 76 69 73 69 62 6c 65 20 62 79 20 32 20 74 68 65 72 65 20 69 73 20 6e 6f 20 70 6f 69 6e 74 20 69 | visible.by.2.there.is.no.point.i |
| 281c0 | 6e 0a 20 20 20 20 20 63 68 65 63 6b 69 6e 67 20 74 6f 20 73 65 65 20 69 66 20 69 74 20 69 73 20 | n......checking.to.see.if.it.is. |
| 281e0 | 64 69 76 69 73 69 62 6c 65 20 62 79 20 61 6e 79 20 6c 61 72 67 65 72 20 65 76 65 6e 20 6e 75 6d | divisible.by.any.larger.even.num |
| 28200 | 62 65 72 73 2e 0a 20 20 20 20 20 54 68 69 73 20 73 75 67 67 65 73 74 73 20 74 68 61 74 20 74 68 | bers.......This.suggests.that.th |
| 28220 | 65 20 76 61 6c 75 65 73 20 75 73 65 64 20 66 6f 72 20 60 74 65 73 74 2d 64 69 76 69 73 6f 72 27 | e.values.used.for.`test-divisor' |
| 28240 | 20 73 68 6f 75 6c 64 20 6e 6f 74 0a 20 20 20 20 20 62 65 20 32 2c 20 33 2c 20 34 2c 20 35 2c 20 | .should.not......be.2,.3,.4,.5,. |
| 28260 | 36 2c 20 2e 2e 2e 2c 20 62 75 74 20 72 61 74 68 65 72 20 32 2c 20 33 2c 20 35 2c 20 37 2c 20 39 | 6,....,.but.rather.2,.3,.5,.7,.9 |
| 28280 | 2c 20 2e 2e 2e 2e 20 20 54 6f 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 69 73 20 63 | ,.......To......implement.this.c |
| 282a0 | 68 61 6e 67 65 2c 20 64 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 6e 65 78 74 27 | hange,.define.a.procedure.`next' |
| 282c0 | 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 33 20 69 66 0a 20 20 20 20 20 69 74 73 20 69 6e 70 75 | .that.returns.3.if......its.inpu |
| 282e0 | 74 20 69 73 20 65 71 75 61 6c 20 74 6f 20 32 20 61 6e 64 20 6f 74 68 65 72 77 69 73 65 20 72 65 | t.is.equal.to.2.and.otherwise.re |
| 28300 | 74 75 72 6e 73 20 69 74 73 20 69 6e 70 75 74 20 70 6c 75 73 20 32 2e 0a 20 20 20 20 20 4d 6f 64 | turns.its.input.plus.2.......Mod |
| 28320 | 69 66 79 20 74 68 65 20 60 73 6d 61 6c 6c 65 73 74 2d 64 69 76 69 73 6f 72 27 20 70 72 6f 63 65 | ify.the.`smallest-divisor'.proce |
| 28340 | 64 75 72 65 20 74 6f 20 75 73 65 20 60 28 6e 65 78 74 0a 20 20 20 20 20 74 65 73 74 2d 64 69 76 | dure.to.use.`(next......test-div |
| 28360 | 69 73 6f 72 29 27 20 69 6e 73 74 65 61 64 20 6f 66 20 60 28 2b 20 74 65 73 74 2d 64 69 76 69 73 | isor)'.instead.of.`(+.test-divis |
| 28380 | 6f 72 20 31 29 27 2e 20 20 57 69 74 68 0a 20 20 20 20 20 60 74 69 6d 65 64 2d 70 72 69 6d 65 2d | or.1)'...With......`timed-prime- |
| 283a0 | 74 65 73 74 27 20 69 6e 63 6f 72 70 6f 72 61 74 69 6e 67 20 74 68 69 73 20 6d 6f 64 69 66 69 65 | test'.incorporating.this.modifie |
| 283c0 | 64 20 76 65 72 73 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 73 6d 61 6c 6c 65 73 74 2d 64 69 76 69 | d.version.of......`smallest-divi |
| 283e0 | 73 6f 72 27 2c 20 72 75 6e 20 74 68 65 20 74 65 73 74 20 66 6f 72 20 65 61 63 68 20 6f 66 20 74 | sor',.run.the.test.for.each.of.t |
| 28400 | 68 65 20 31 32 20 70 72 69 6d 65 73 20 66 6f 75 6e 64 20 69 6e 0a 20 20 20 20 20 2a 4e 6f 74 65 | he.12.primes.found.in......*Note |
| 28420 | 20 45 78 65 72 63 69 73 65 20 31 2d 32 32 3a 3a 2e 20 20 53 69 6e 63 65 20 74 68 69 73 20 6d 6f | .Exercise.1-22::...Since.this.mo |
| 28440 | 64 69 66 69 63 61 74 69 6f 6e 20 68 61 6c 76 65 73 20 74 68 65 20 6e 75 6d 62 65 72 0a 20 20 20 | dification.halves.the.number.... |
| 28460 | 20 20 6f 66 20 74 65 73 74 20 73 74 65 70 73 2c 20 79 6f 75 20 73 68 6f 75 6c 64 20 65 78 70 65 | ..of.test.steps,.you.should.expe |
| 28480 | 63 74 20 69 74 20 74 6f 20 72 75 6e 20 61 62 6f 75 74 20 74 77 69 63 65 20 61 73 20 66 61 73 74 | ct.it.to.run.about.twice.as.fast |
| 284a0 | 2e 0a 20 20 20 20 20 49 73 20 74 68 69 73 20 65 78 70 65 63 74 61 74 69 6f 6e 20 63 6f 6e 66 69 | .......Is.this.expectation.confi |
| 284c0 | 72 6d 65 64 3f 20 20 49 66 20 6e 6f 74 2c 20 77 68 61 74 20 69 73 20 74 68 65 20 6f 62 73 65 72 | rmed?..If.not,.what.is.the.obser |
| 284e0 | 76 65 64 20 72 61 74 69 6f 0a 20 20 20 20 20 6f 66 20 74 68 65 20 73 70 65 65 64 73 20 6f 66 20 | ved.ratio......of.the.speeds.of. |
| 28500 | 74 68 65 20 74 77 6f 20 61 6c 67 6f 72 69 74 68 6d 73 2c 20 61 6e 64 20 68 6f 77 20 64 6f 20 79 | the.two.algorithms,.and.how.do.y |
| 28520 | 6f 75 20 65 78 70 6c 61 69 6e 20 74 68 65 0a 20 20 20 20 20 66 61 63 74 20 74 68 61 74 20 69 74 | ou.explain.the......fact.that.it |
| 28540 | 20 69 73 20 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d 20 32 3f 0a 0a 20 20 20 20 20 2a 45 78 65 | .is.different.from.2?.......*Exe |
| 28560 | 72 63 69 73 65 20 31 2e 32 34 3a 2a 20 4d 6f 64 69 66 79 20 74 68 65 20 60 74 69 6d 65 64 2d 70 | rcise.1.24:*.Modify.the.`timed-p |
| 28580 | 72 69 6d 65 2d 74 65 73 74 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 2a 4e 6f 74 65 0a 20 20 | rime-test'.procedure.of.*Note... |
| 285a0 | 20 20 20 45 78 65 72 63 69 73 65 20 31 2d 32 32 3a 3a 20 74 6f 20 75 73 65 20 60 66 61 73 74 2d | ...Exercise.1-22::.to.use.`fast- |
| 285c0 | 70 72 69 6d 65 3f 27 20 28 74 68 65 20 46 65 72 6d 61 74 20 6d 65 74 68 6f 64 29 2c 20 61 6e 64 | prime?'.(the.Fermat.method),.and |
| 285e0 | 20 74 65 73 74 0a 20 20 20 20 20 65 61 63 68 20 6f 66 20 74 68 65 20 31 32 20 70 72 69 6d 65 73 | .test......each.of.the.12.primes |
| 28600 | 20 79 6f 75 20 66 6f 75 6e 64 20 69 6e 20 74 68 61 74 20 65 78 65 72 63 69 73 65 2e 20 20 53 69 | .you.found.in.that.exercise...Si |
| 28620 | 6e 63 65 20 74 68 65 0a 20 20 20 20 20 46 65 72 6d 61 74 20 74 65 73 74 20 68 61 73 20 5b 74 68 | nce.the......Fermat.test.has.[th |
| 28640 | 65 74 61 5d 28 60 6c 6f 67 27 20 6e 29 20 67 72 6f 77 74 68 2c 20 68 6f 77 20 77 6f 75 6c 64 20 | eta](`log'.n).growth,.how.would. |
| 28660 | 79 6f 75 20 65 78 70 65 63 74 20 74 68 65 0a 20 20 20 20 20 74 69 6d 65 20 74 6f 20 74 65 73 74 | you.expect.the......time.to.test |
| 28680 | 20 70 72 69 6d 65 73 20 6e 65 61 72 20 31 2c 30 30 30 2c 30 30 30 20 74 6f 20 63 6f 6d 70 61 72 | .primes.near.1,000,000.to.compar |
| 286a0 | 65 20 77 69 74 68 20 74 68 65 20 74 69 6d 65 20 6e 65 65 64 65 64 0a 20 20 20 20 20 74 6f 20 74 | e.with.the.time.needed......to.t |
| 286c0 | 65 73 74 20 70 72 69 6d 65 73 20 6e 65 61 72 20 31 30 30 30 3f 20 20 44 6f 20 79 6f 75 72 20 64 | est.primes.near.1000?..Do.your.d |
| 286e0 | 61 74 61 20 62 65 61 72 20 74 68 69 73 20 6f 75 74 3f 20 20 43 61 6e 20 79 6f 75 0a 20 20 20 20 | ata.bear.this.out?..Can.you..... |
| 28700 | 20 65 78 70 6c 61 69 6e 20 61 6e 79 20 64 69 73 63 72 65 70 61 6e 63 79 20 79 6f 75 20 66 69 6e | .explain.any.discrepancy.you.fin |
| 28720 | 64 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 32 35 3a 2a 20 41 6c 79 73 73 61 | d?.......*Exercise.1.25:*.Alyssa |
| 28740 | 20 50 2e 20 48 61 63 6b 65 72 20 63 6f 6d 70 6c 61 69 6e 73 20 74 68 61 74 20 77 65 20 77 65 6e | .P..Hacker.complains.that.we.wen |
| 28760 | 74 20 74 6f 20 61 20 6c 6f 74 0a 20 20 20 20 20 6f 66 20 65 78 74 72 61 20 77 6f 72 6b 20 69 6e | t.to.a.lot......of.extra.work.in |
| 28780 | 20 77 72 69 74 69 6e 67 20 60 65 78 70 6d 6f 64 27 2e 20 20 41 66 74 65 72 20 61 6c 6c 2c 20 73 | .writing.`expmod'...After.all,.s |
| 287a0 | 68 65 20 73 61 79 73 2c 20 73 69 6e 63 65 20 77 65 0a 20 20 20 20 20 61 6c 72 65 61 64 79 20 6b | he.says,.since.we......already.k |
| 287c0 | 6e 6f 77 20 68 6f 77 20 74 6f 20 63 6f 6d 70 75 74 65 20 65 78 70 6f 6e 65 6e 74 69 61 6c 73 2c | now.how.to.compute.exponentials, |
| 287e0 | 20 77 65 20 63 6f 75 6c 64 20 68 61 76 65 20 73 69 6d 70 6c 79 0a 20 20 20 20 20 77 72 69 74 74 | .we.could.have.simply......writt |
| 28800 | 65 6e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 6d 6f 64 20 62 61 | en............(define.(expmod.ba |
| 28820 | 73 65 20 65 78 70 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 6d 61 69 6e 64 65 72 | se.exp.m).............(remainder |
| 28840 | 20 28 66 61 73 74 2d 65 78 70 74 20 62 61 73 65 20 65 78 70 29 20 6d 29 29 0a 0a 20 20 20 20 20 | .(fast-expt.base.exp).m))....... |
| 28860 | 49 73 20 73 68 65 20 63 6f 72 72 65 63 74 3f 20 20 57 6f 75 6c 64 20 74 68 69 73 20 70 72 6f 63 | Is.she.correct?..Would.this.proc |
| 28880 | 65 64 75 72 65 20 73 65 72 76 65 20 61 73 20 77 65 6c 6c 20 66 6f 72 20 6f 75 72 20 66 61 73 74 | edure.serve.as.well.for.our.fast |
| 288a0 | 0a 20 20 20 20 20 70 72 69 6d 65 20 74 65 73 74 65 72 3f 20 20 45 78 70 6c 61 69 6e 2e 0a 0a 20 | ......prime.tester?..Explain.... |
| 288c0 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 32 36 3a 2a 20 4c 6f 75 69 73 20 52 65 61 73 6f | ....*Exercise.1.26:*.Louis.Reaso |
| 288e0 | 6e 65 72 20 69 73 20 68 61 76 69 6e 67 20 67 72 65 61 74 20 64 69 66 66 69 63 75 6c 74 79 20 64 | ner.is.having.great.difficulty.d |
| 28900 | 6f 69 6e 67 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 32 34 3a 3a 2e | oing......*Note.Exercise.1-24::. |
| 28920 | 20 20 48 69 73 20 60 66 61 73 74 2d 70 72 69 6d 65 3f 27 20 74 65 73 74 20 73 65 65 6d 73 20 74 | ..His.`fast-prime?'.test.seems.t |
| 28940 | 6f 20 72 75 6e 20 6d 6f 72 65 0a 20 20 20 20 20 73 6c 6f 77 6c 79 20 74 68 61 6e 20 68 69 73 20 | o.run.more......slowly.than.his. |
| 28960 | 60 70 72 69 6d 65 3f 27 20 74 65 73 74 2e 20 20 4c 6f 75 69 73 20 63 61 6c 6c 73 20 68 69 73 20 | `prime?'.test...Louis.calls.his. |
| 28980 | 66 72 69 65 6e 64 20 45 76 61 20 4c 75 20 41 74 6f 72 0a 20 20 20 20 20 6f 76 65 72 20 74 6f 20 | friend.Eva.Lu.Ator......over.to. |
| 289a0 | 68 65 6c 70 2e 20 20 57 68 65 6e 20 74 68 65 79 20 65 78 61 6d 69 6e 65 20 4c 6f 75 69 73 27 73 | help...When.they.examine.Louis's |
| 289c0 | 20 63 6f 64 65 2c 20 74 68 65 79 20 66 69 6e 64 20 74 68 61 74 20 68 65 0a 20 20 20 20 20 68 61 | .code,.they.find.that.he......ha |
| 289e0 | 73 20 72 65 77 72 69 74 74 65 6e 20 74 68 65 20 60 65 78 70 6d 6f 64 27 20 70 72 6f 63 65 64 75 | s.rewritten.the.`expmod'.procedu |
| 28a00 | 72 65 20 74 6f 20 75 73 65 20 61 6e 20 65 78 70 6c 69 63 69 74 0a 20 20 20 20 20 6d 75 6c 74 69 | re.to.use.an.explicit......multi |
| 28a20 | 70 6c 69 63 61 74 69 6f 6e 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 63 61 6c 6c 69 6e 67 20 60 | plication,.rather.than.calling.` |
| 28a40 | 73 71 75 61 72 65 27 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 | square':............(define.(exp |
| 28a60 | 6d 6f 64 20 62 61 73 65 20 65 78 70 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e | mod.base.exp.m).............(con |
| 28a80 | 64 20 28 28 3d 20 65 78 70 20 30 29 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | d.((=.exp.0).1)................. |
| 28aa0 | 20 20 28 28 65 76 65 6e 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..((even?.exp).................. |
| 28ac0 | 20 20 28 72 65 6d 61 69 6e 64 65 72 20 28 2a 20 28 65 78 70 6d 6f 64 20 62 61 73 65 20 28 2f 20 | ..(remainder.(*.(expmod.base.(/. |
| 28ae0 | 65 78 70 20 32 29 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | exp.2).m)....................... |
| 28b00 | 20 20 20 20 20 20 20 20 20 20 20 28 65 78 70 6d 6f 64 20 62 61 73 65 20 28 2f 20 65 78 70 20 32 | ...........(expmod.base.(/.exp.2 |
| 28b20 | 29 20 6d 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).m))........................... |
| 28b40 | 20 20 20 20 6d 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a | ....m))...................(else. |
| 28b60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 6d 61 69 6e 64 65 72 20 28 2a | ...................(remainder.(* |
| 28b80 | 20 62 61 73 65 20 28 65 78 70 6d 6f 64 20 62 61 73 65 20 28 2d 20 65 78 70 20 31 29 20 6d 29 29 | .base.(expmod.base.(-.exp.1).m)) |
| 28ba0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d | ...............................m |
| 28bc0 | 29 29 29 29 0a 0a 20 20 20 20 20 22 49 20 64 6f 6e 27 74 20 73 65 65 20 77 68 61 74 20 64 69 66 | ))))......."I.don't.see.what.dif |
| 28be0 | 66 65 72 65 6e 63 65 20 74 68 61 74 20 63 6f 75 6c 64 20 6d 61 6b 65 2c 22 20 73 61 79 73 20 4c | ference.that.could.make,".says.L |
| 28c00 | 6f 75 69 73 2e 20 20 22 49 0a 20 20 20 20 20 64 6f 2e 22 20 20 73 61 79 73 20 45 76 61 2e 20 20 | ouis..."I......do."..says.Eva... |
| 28c20 | 22 42 79 20 77 72 69 74 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 6c 69 6b 65 20 74 | "By.writing.the.procedure.like.t |
| 28c40 | 68 61 74 2c 20 79 6f 75 20 68 61 76 65 0a 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 74 | hat,.you.have......transformed.t |
| 28c60 | 68 65 20 5b 74 68 65 74 61 5d 28 60 6c 6f 67 27 20 6e 29 20 70 72 6f 63 65 73 73 20 69 6e 74 6f | he.[theta](`log'.n).process.into |
| 28c80 | 20 61 20 5b 74 68 65 74 61 5d 28 6e 29 0a 20 20 20 20 20 70 72 6f 63 65 73 73 2e 22 20 20 45 78 | .a.[theta](n)......process."..Ex |
| 28ca0 | 70 6c 61 69 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 32 37 3a 2a 20 44 65 | plain........*Exercise.1.27:*.De |
| 28cc0 | 6d 6f 6e 73 74 72 61 74 65 20 74 68 61 74 20 74 68 65 20 43 61 72 6d 69 63 68 61 65 6c 20 6e 75 | monstrate.that.the.Carmichael.nu |
| 28ce0 | 6d 62 65 72 73 20 6c 69 73 74 65 64 20 69 6e 0a 20 20 20 20 20 2a 4e 6f 74 65 20 46 6f 6f 74 6e | mbers.listed.in......*Note.Footn |
| 28d00 | 6f 74 65 20 31 2d 34 37 3a 3a 20 72 65 61 6c 6c 79 20 64 6f 20 66 6f 6f 6c 20 74 68 65 20 46 65 | ote.1-47::.really.do.fool.the.Fe |
| 28d20 | 72 6d 61 74 20 74 65 73 74 2e 20 20 54 68 61 74 20 69 73 2c 0a 20 20 20 20 20 77 72 69 74 65 20 | rmat.test...That.is,......write. |
| 28d40 | 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 20 61 6e 20 69 6e 74 65 67 65 | a.procedure.that.takes.an.intege |
| 28d60 | 72 20 6e 20 61 6e 64 20 74 65 73 74 73 20 77 68 65 74 68 65 72 20 61 5e 6e 20 69 73 0a 20 20 20 | r.n.and.tests.whether.a^n.is.... |
| 28d80 | 20 20 63 6f 6e 67 72 75 65 6e 74 20 74 6f 20 61 20 6d 6f 64 75 6c 6f 20 6e 20 66 6f 72 20 65 76 | ..congruent.to.a.modulo.n.for.ev |
| 28da0 | 65 72 79 20 61 3c 6e 2c 20 61 6e 64 20 74 72 79 20 79 6f 75 72 20 70 72 6f 63 65 64 75 72 65 20 | ery.a<n,.and.try.your.procedure. |
| 28dc0 | 6f 6e 0a 20 20 20 20 20 74 68 65 20 67 69 76 65 6e 20 43 61 72 6d 69 63 68 61 65 6c 20 6e 75 6d | on......the.given.Carmichael.num |
| 28de0 | 62 65 72 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 32 38 3a 2a 20 4f 6e 65 | bers........*Exercise.1.28:*.One |
| 28e00 | 20 76 61 72 69 61 6e 74 20 6f 66 20 74 68 65 20 46 65 72 6d 61 74 20 74 65 73 74 20 74 68 61 74 | .variant.of.the.Fermat.test.that |
| 28e20 | 20 63 61 6e 6e 6f 74 20 62 65 0a 20 20 20 20 20 66 6f 6f 6c 65 64 20 69 73 20 63 61 6c 6c 65 64 | .cannot.be......fooled.is.called |
| 28e40 | 20 74 68 65 20 22 4d 69 6c 6c 65 72 2d 52 61 62 69 6e 20 74 65 73 74 22 20 28 4d 69 6c 6c 65 72 | .the."Miller-Rabin.test".(Miller |
| 28e60 | 20 31 39 37 36 3b 20 52 61 62 69 6e 0a 20 20 20 20 20 31 39 38 30 29 2e 20 20 54 68 69 73 20 73 | .1976;.Rabin......1980)...This.s |
| 28e80 | 74 61 72 74 73 20 66 72 6f 6d 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 20 66 6f 72 6d 20 6f 66 20 | tarts.from.an.alternate.form.of. |
| 28ea0 | 46 65 72 6d 61 74 27 73 20 4c 69 74 74 6c 65 0a 20 20 20 20 20 54 68 65 6f 72 65 6d 2c 20 77 68 | Fermat's.Little......Theorem,.wh |
| 28ec0 | 69 63 68 20 73 74 61 74 65 73 20 74 68 61 74 20 69 66 20 6e 20 69 73 20 61 20 70 72 69 6d 65 20 | ich.states.that.if.n.is.a.prime. |
| 28ee0 | 6e 75 6d 62 65 72 20 61 6e 64 20 61 20 69 73 20 61 6e 79 0a 20 20 20 20 20 70 6f 73 69 74 69 76 | number.and.a.is.any......positiv |
| 28f00 | 65 20 69 6e 74 65 67 65 72 20 6c 65 73 73 20 74 68 61 6e 20 6e 2c 20 74 68 65 6e 20 61 20 72 61 | e.integer.less.than.n,.then.a.ra |
| 28f20 | 69 73 65 64 20 74 6f 20 74 68 65 20 28 6e 20 2d 20 31 29 73 74 20 70 6f 77 65 72 0a 20 20 20 20 | ised.to.the.(n.-.1)st.power..... |
| 28f40 | 20 69 73 20 63 6f 6e 67 72 75 65 6e 74 20 74 6f 20 31 20 6d 6f 64 75 6c 6f 20 6e 2e 20 20 54 6f | .is.congruent.to.1.modulo.n...To |
| 28f60 | 20 74 65 73 74 20 74 68 65 20 70 72 69 6d 61 6c 69 74 79 20 6f 66 20 61 20 6e 75 6d 62 65 72 20 | .test.the.primality.of.a.number. |
| 28f80 | 6e 0a 20 20 20 20 20 62 79 20 74 68 65 20 4d 69 6c 6c 65 72 2d 52 61 62 69 6e 20 74 65 73 74 2c | n......by.the.Miller-Rabin.test, |
| 28fa0 | 20 77 65 20 70 69 63 6b 20 61 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 20 61 3c 6e 20 61 6e 64 | .we.pick.a.random.number.a<n.and |
| 28fc0 | 20 72 61 69 73 65 20 61 0a 20 20 20 20 20 74 6f 20 74 68 65 20 28 6e 20 2d 20 31 29 73 74 20 70 | .raise.a......to.the.(n.-.1)st.p |
| 28fe0 | 6f 77 65 72 20 6d 6f 64 75 6c 6f 20 6e 20 75 73 69 6e 67 20 74 68 65 20 60 65 78 70 6d 6f 64 27 | ower.modulo.n.using.the.`expmod' |
| 29000 | 20 70 72 6f 63 65 64 75 72 65 2e 0a 20 20 20 20 20 48 6f 77 65 76 65 72 2c 20 77 68 65 6e 65 76 | .procedure.......However,.whenev |
| 29020 | 65 72 20 77 65 20 70 65 72 66 6f 72 6d 20 74 68 65 20 73 71 75 61 72 69 6e 67 20 73 74 65 70 20 | er.we.perform.the.squaring.step. |
| 29040 | 69 6e 20 60 65 78 70 6d 6f 64 27 2c 20 77 65 0a 20 20 20 20 20 63 68 65 63 6b 20 74 6f 20 73 65 | in.`expmod',.we......check.to.se |
| 29060 | 65 20 69 66 20 77 65 20 68 61 76 65 20 64 69 73 63 6f 76 65 72 65 64 20 61 20 22 6e 6f 6e 74 72 | e.if.we.have.discovered.a."nontr |
| 29080 | 69 76 69 61 6c 20 73 71 75 61 72 65 20 72 6f 6f 74 20 6f 66 20 31 0a 20 20 20 20 20 6d 6f 64 75 | ivial.square.root.of.1......modu |
| 290a0 | 6c 6f 20 6e 2c 22 20 74 68 61 74 20 69 73 2c 20 61 20 6e 75 6d 62 65 72 20 6e 6f 74 20 65 71 75 | lo.n,".that.is,.a.number.not.equ |
| 290c0 | 61 6c 20 74 6f 20 31 20 6f 72 20 6e 20 2d 20 31 20 77 68 6f 73 65 20 73 71 75 61 72 65 0a 20 20 | al.to.1.or.n.-.1.whose.square... |
| 290e0 | 20 20 20 69 73 20 65 71 75 61 6c 20 74 6f 20 31 20 6d 6f 64 75 6c 6f 20 6e 2e 20 20 49 74 20 69 | ...is.equal.to.1.modulo.n...It.i |
| 29100 | 73 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 70 72 6f 76 65 20 74 68 61 74 20 69 66 20 73 75 63 68 | s.possible.to.prove.that.if.such |
| 29120 | 20 61 0a 20 20 20 20 20 6e 6f 6e 74 72 69 76 69 61 6c 20 73 71 75 61 72 65 20 72 6f 6f 74 20 6f | .a......nontrivial.square.root.o |
| 29140 | 66 20 31 20 65 78 69 73 74 73 2c 20 74 68 65 6e 20 6e 20 69 73 20 6e 6f 74 20 70 72 69 6d 65 2e | f.1.exists,.then.n.is.not.prime. |
| 29160 | 20 20 49 74 20 69 73 0a 20 20 20 20 20 61 6c 73 6f 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 70 72 | ..It.is......also.possible.to.pr |
| 29180 | 6f 76 65 20 74 68 61 74 20 69 66 20 6e 20 69 73 20 61 6e 20 6f 64 64 20 6e 75 6d 62 65 72 20 74 | ove.that.if.n.is.an.odd.number.t |
| 291a0 | 68 61 74 20 69 73 20 6e 6f 74 0a 20 20 20 20 20 70 72 69 6d 65 2c 20 74 68 65 6e 2c 20 66 6f 72 | hat.is.not......prime,.then,.for |
| 291c0 | 20 61 74 20 6c 65 61 73 74 20 68 61 6c 66 20 74 68 65 20 6e 75 6d 62 65 72 73 20 61 3c 6e 2c 20 | .at.least.half.the.numbers.a<n,. |
| 291e0 | 63 6f 6d 70 75 74 69 6e 67 20 61 5e 28 6e 2d 31 29 0a 20 20 20 20 20 69 6e 20 74 68 69 73 20 77 | computing.a^(n-1)......in.this.w |
| 29200 | 61 79 20 77 69 6c 6c 20 72 65 76 65 61 6c 20 61 20 6e 6f 6e 74 72 69 76 69 61 6c 20 73 71 75 61 | ay.will.reveal.a.nontrivial.squa |
| 29220 | 72 65 20 72 6f 6f 74 20 6f 66 20 31 20 6d 6f 64 75 6c 6f 20 6e 2e 0a 20 20 20 20 20 28 54 68 69 | re.root.of.1.modulo.n.......(Thi |
| 29240 | 73 20 69 73 20 77 68 79 20 74 68 65 20 4d 69 6c 6c 65 72 2d 52 61 62 69 6e 20 74 65 73 74 20 63 | s.is.why.the.Miller-Rabin.test.c |
| 29260 | 61 6e 6e 6f 74 20 62 65 20 66 6f 6f 6c 65 64 2e 29 20 20 4d 6f 64 69 66 79 20 74 68 65 0a 20 20 | annot.be.fooled.)..Modify.the... |
| 29280 | 20 20 20 60 65 78 70 6d 6f 64 27 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 73 69 67 6e 61 6c 20 | ...`expmod'.procedure.to.signal. |
| 292a0 | 69 66 20 69 74 20 64 69 73 63 6f 76 65 72 73 20 61 20 6e 6f 6e 74 72 69 76 69 61 6c 20 73 71 75 | if.it.discovers.a.nontrivial.squ |
| 292c0 | 61 72 65 0a 20 20 20 20 20 72 6f 6f 74 20 6f 66 20 31 2c 20 61 6e 64 20 75 73 65 20 74 68 69 73 | are......root.of.1,.and.use.this |
| 292e0 | 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 4d 69 6c 6c 65 72 2d 52 61 62 69 6e 20 74 | .to.implement.the.Miller-Rabin.t |
| 29300 | 65 73 74 20 77 69 74 68 20 61 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 61 6e 61 6c 6f 67 | est.with.a......procedure.analog |
| 29320 | 6f 75 73 20 74 6f 20 60 66 65 72 6d 61 74 2d 74 65 73 74 27 2e 20 20 43 68 65 63 6b 20 79 6f 75 | ous.to.`fermat-test'...Check.you |
| 29340 | 72 20 70 72 6f 63 65 64 75 72 65 20 62 79 0a 20 20 20 20 20 74 65 73 74 69 6e 67 20 76 61 72 69 | r.procedure.by......testing.vari |
| 29360 | 6f 75 73 20 6b 6e 6f 77 6e 20 70 72 69 6d 65 73 20 61 6e 64 20 6e 6f 6e 2d 70 72 69 6d 65 73 2e | ous.known.primes.and.non-primes. |
| 29380 | 20 20 48 69 6e 74 3a 20 4f 6e 65 20 63 6f 6e 76 65 6e 69 65 6e 74 0a 20 20 20 20 20 77 61 79 20 | ..Hint:.One.convenient......way. |
| 293a0 | 74 6f 20 6d 61 6b 65 20 60 65 78 70 6d 6f 64 27 20 73 69 67 6e 61 6c 20 69 73 20 74 6f 20 68 61 | to.make.`expmod'.signal.is.to.ha |
| 293c0 | 76 65 20 69 74 20 72 65 74 75 72 6e 20 30 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 | ve.it.return.0......----------.F |
| 293e0 | 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 66 20 64 | ootnotes.----------.....(1).If.d |
| 29400 | 20 69 73 20 61 20 64 69 76 69 73 6f 72 20 6f 66 20 6e 2c 20 74 68 65 6e 20 73 6f 20 69 73 20 6e | .is.a.divisor.of.n,.then.so.is.n |
| 29420 | 2f 64 2e 20 20 42 75 74 20 64 20 61 6e 64 20 6e 2f 64 20 63 61 6e 6e 6f 74 0a 62 6f 74 68 20 62 | /d...But.d.and.n/d.cannot.both.b |
| 29440 | 65 20 67 72 65 61 74 65 72 20 74 68 61 6e 20 5f 5b 73 71 72 74 5d 5f 28 6e 29 2e 0a 0a 20 20 20 | e.greater.than._[sqrt]_(n)...... |
| 29460 | 28 32 29 20 50 69 65 72 72 65 20 64 65 20 46 65 72 6d 61 74 20 28 31 36 30 31 2d 31 36 36 35 29 | (2).Pierre.de.Fermat.(1601-1665) |
| 29480 | 20 69 73 20 63 6f 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65 20 74 68 65 20 66 6f 75 6e 64 65 72 | .is.considered.to.be.the.founder |
| 294a0 | 20 6f 66 0a 6d 6f 64 65 72 6e 20 6e 75 6d 62 65 72 20 74 68 65 6f 72 79 2e 20 20 48 65 20 6f 62 | .of.modern.number.theory...He.ob |
| 294c0 | 74 61 69 6e 65 64 20 6d 61 6e 79 20 69 6d 70 6f 72 74 61 6e 74 20 6e 75 6d 62 65 72 2d 74 68 65 | tained.many.important.number-the |
| 294e0 | 6f 72 65 74 69 63 0a 72 65 73 75 6c 74 73 2c 20 62 75 74 20 68 65 20 75 73 75 61 6c 6c 79 20 61 | oretic.results,.but.he.usually.a |
| 29500 | 6e 6e 6f 75 6e 63 65 64 20 6a 75 73 74 20 74 68 65 20 72 65 73 75 6c 74 73 2c 20 77 69 74 68 6f | nnounced.just.the.results,.witho |
| 29520 | 75 74 20 70 72 6f 76 69 64 69 6e 67 0a 68 69 73 20 70 72 6f 6f 66 73 2e 20 20 46 65 72 6d 61 74 | ut.providing.his.proofs...Fermat |
| 29540 | 27 73 20 4c 69 74 74 6c 65 20 54 68 65 6f 72 65 6d 20 77 61 73 20 73 74 61 74 65 64 20 69 6e 20 | 's.Little.Theorem.was.stated.in. |
| 29560 | 61 20 6c 65 74 74 65 72 20 68 65 20 77 72 6f 74 65 20 69 6e 0a 31 36 34 30 2e 20 20 54 68 65 20 | a.letter.he.wrote.in.1640...The. |
| 29580 | 66 69 72 73 74 20 70 75 62 6c 69 73 68 65 64 20 70 72 6f 6f 66 20 77 61 73 20 67 69 76 65 6e 20 | first.published.proof.was.given. |
| 295a0 | 62 79 20 45 75 6c 65 72 20 69 6e 20 31 37 33 36 20 28 61 6e 64 20 61 6e 0a 65 61 72 6c 69 65 72 | by.Euler.in.1736.(and.an.earlier |
| 295c0 | 2c 20 69 64 65 6e 74 69 63 61 6c 20 70 72 6f 6f 66 20 77 61 73 20 64 69 73 63 6f 76 65 72 65 64 | ,.identical.proof.was.discovered |
| 295e0 | 20 69 6e 20 74 68 65 20 75 6e 70 75 62 6c 69 73 68 65 64 20 6d 61 6e 75 73 63 72 69 70 74 73 0a | .in.the.unpublished.manuscripts. |
| 29600 | 6f 66 20 4c 65 69 62 6e 69 7a 29 2e 20 20 54 68 65 20 6d 6f 73 74 20 66 61 6d 6f 75 73 20 6f 66 | of.Leibniz)...The.most.famous.of |
| 29620 | 20 46 65 72 6d 61 74 27 73 20 72 65 73 75 6c 74 73 2d 2d 6b 6e 6f 77 6e 20 61 73 20 46 65 72 6d | .Fermat's.results--known.as.Ferm |
| 29640 | 61 74 27 73 0a 4c 61 73 74 20 54 68 65 6f 72 65 6d 2d 2d 77 61 73 20 6a 6f 74 74 65 64 20 64 6f | at's.Last.Theorem--was.jotted.do |
| 29660 | 77 6e 20 69 6e 20 31 36 33 37 20 69 6e 20 68 69 73 20 63 6f 70 79 20 6f 66 20 74 68 65 20 62 6f | wn.in.1637.in.his.copy.of.the.bo |
| 29680 | 6f 6b 0a 60 41 72 69 74 68 6d 65 74 69 63 27 20 28 62 79 20 74 68 65 20 74 68 69 72 64 2d 63 65 | ok.`Arithmetic'.(by.the.third-ce |
| 296a0 | 6e 74 75 72 79 20 47 72 65 65 6b 20 6d 61 74 68 65 6d 61 74 69 63 69 61 6e 20 44 69 6f 70 68 61 | ntury.Greek.mathematician.Diopha |
| 296c0 | 6e 74 75 73 29 20 77 69 74 68 0a 74 68 65 20 72 65 6d 61 72 6b 20 22 49 20 68 61 76 65 20 64 69 | ntus).with.the.remark."I.have.di |
| 296e0 | 73 63 6f 76 65 72 65 64 20 61 20 74 72 75 6c 79 20 72 65 6d 61 72 6b 61 62 6c 65 20 70 72 6f 6f | scovered.a.truly.remarkable.proo |
| 29700 | 66 2c 20 62 75 74 20 74 68 69 73 20 6d 61 72 67 69 6e 0a 69 73 20 74 6f 6f 20 73 6d 61 6c 6c 20 | f,.but.this.margin.is.too.small. |
| 29720 | 74 6f 20 63 6f 6e 74 61 69 6e 20 69 74 2e 22 20 20 46 69 6e 64 69 6e 67 20 61 20 70 72 6f 6f 66 | to.contain.it."..Finding.a.proof |
| 29740 | 20 6f 66 20 46 65 72 6d 61 74 27 73 20 4c 61 73 74 20 54 68 65 6f 72 65 6d 0a 62 65 63 61 6d 65 | .of.Fermat's.Last.Theorem.became |
| 29760 | 20 6f 6e 65 20 6f 66 20 74 68 65 20 6d 6f 73 74 20 66 61 6d 6f 75 73 20 63 68 61 6c 6c 65 6e 67 | .one.of.the.most.famous.challeng |
| 29780 | 65 73 20 69 6e 20 6e 75 6d 62 65 72 20 74 68 65 6f 72 79 2e 20 20 41 20 63 6f 6d 70 6c 65 74 65 | es.in.number.theory...A.complete |
| 297a0 | 0a 73 6f 6c 75 74 69 6f 6e 20 77 61 73 20 66 69 6e 61 6c 6c 79 20 67 69 76 65 6e 20 69 6e 20 31 | .solution.was.finally.given.in.1 |
| 297c0 | 39 39 35 20 62 79 20 41 6e 64 72 65 77 20 57 69 6c 65 73 20 6f 66 20 50 72 69 6e 63 65 74 6f 6e | 995.by.Andrew.Wiles.of.Princeton |
| 297e0 | 0a 55 6e 69 76 65 72 73 69 74 79 2e 0a 0a 20 20 20 28 33 29 20 54 68 65 20 72 65 64 75 63 74 69 | .University......(3).The.reducti |
| 29800 | 6f 6e 20 73 74 65 70 73 20 69 6e 20 74 68 65 20 63 61 73 65 73 20 77 68 65 72 65 20 74 68 65 20 | on.steps.in.the.cases.where.the. |
| 29820 | 65 78 70 6f 6e 65 6e 74 20 65 20 69 73 20 67 72 65 61 74 65 72 0a 74 68 61 6e 20 31 20 61 72 65 | exponent.e.is.greater.than.1.are |
| 29840 | 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 66 61 63 74 20 74 68 61 74 2c 20 66 6f 72 20 61 6e 79 | .based.on.the.fact.that,.for.any |
| 29860 | 20 69 6e 74 65 67 65 72 73 20 78 2c 20 79 2c 20 61 6e 64 20 6d 2c 20 77 65 20 63 61 6e 0a 66 69 | .integers.x,.y,.and.m,.we.can.fi |
| 29880 | 6e 64 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 78 20 74 69 6d 65 73 20 79 20 6d 6f | nd.the.remainder.of.x.times.y.mo |
| 298a0 | 64 75 6c 6f 20 6d 20 62 79 20 63 6f 6d 70 75 74 69 6e 67 20 73 65 70 61 72 61 74 65 6c 79 20 74 | dulo.m.by.computing.separately.t |
| 298c0 | 68 65 0a 72 65 6d 61 69 6e 64 65 72 73 20 6f 66 20 78 20 6d 6f 64 75 6c 6f 20 6d 20 61 6e 64 20 | he.remainders.of.x.modulo.m.and. |
| 298e0 | 79 20 6d 6f 64 75 6c 6f 20 6d 2c 20 6d 75 6c 74 69 70 6c 79 69 6e 67 20 74 68 65 73 65 2c 20 61 | y.modulo.m,.multiplying.these,.a |
| 29900 | 6e 64 20 74 68 65 6e 0a 74 61 6b 69 6e 67 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 | nd.then.taking.the.remainder.of. |
| 29920 | 74 68 65 20 72 65 73 75 6c 74 20 6d 6f 64 75 6c 6f 20 6d 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e | the.result.modulo.m...For.instan |
| 29940 | 63 65 2c 20 69 6e 20 74 68 65 20 63 61 73 65 0a 77 68 65 72 65 20 65 20 69 73 20 65 76 65 6e 2c | ce,.in.the.case.where.e.is.even, |
| 29960 | 20 77 65 20 63 6f 6d 70 75 74 65 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 62 5e 28 | .we.compute.the.remainder.of.b^( |
| 29980 | 65 2f 32 29 20 6d 6f 64 75 6c 6f 20 6d 2c 20 73 71 75 61 72 65 0a 74 68 69 73 2c 20 61 6e 64 20 | e/2).modulo.m,.square.this,.and. |
| 299a0 | 74 61 6b 65 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 6d 6f 64 75 6c 6f 20 6d 2e 20 20 54 68 | take.the.remainder.modulo.m...Th |
| 299c0 | 69 73 20 74 65 63 68 6e 69 71 75 65 20 69 73 20 75 73 65 66 75 6c 0a 62 65 63 61 75 73 65 20 69 | is.technique.is.useful.because.i |
| 299e0 | 74 20 6d 65 61 6e 73 20 77 65 20 63 61 6e 20 70 65 72 66 6f 72 6d 20 6f 75 72 20 63 6f 6d 70 75 | t.means.we.can.perform.our.compu |
| 29a00 | 74 61 74 69 6f 6e 20 77 69 74 68 6f 75 74 20 65 76 65 72 20 68 61 76 69 6e 67 20 74 6f 0a 64 65 | tation.without.ever.having.to.de |
| 29a20 | 61 6c 20 77 69 74 68 20 6e 75 6d 62 65 72 73 20 6d 75 63 68 20 6c 61 72 67 65 72 20 74 68 61 6e | al.with.numbers.much.larger.than |
| 29a40 | 20 6d 2e 20 20 28 43 6f 6d 70 61 72 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 32 | .m...(Compare.*Note.Exercise.1-2 |
| 29a60 | 35 3a 3a 2e 29 0a 0a 20 20 20 28 34 29 20 5b 46 6f 6f 74 6e 6f 74 65 20 31 2e 34 37 5d 20 4e 75 | 5::.).....(4).[Footnote.1.47].Nu |
| 29a80 | 6d 62 65 72 73 20 74 68 61 74 20 66 6f 6f 6c 20 74 68 65 20 46 65 72 6d 61 74 20 74 65 73 74 20 | mbers.that.fool.the.Fermat.test. |
| 29aa0 | 61 72 65 20 63 61 6c 6c 65 64 20 22 43 61 72 6d 69 63 68 61 65 6c 0a 6e 75 6d 62 65 72 73 22 2c | are.called."Carmichael.numbers", |
| 29ac0 | 20 61 6e 64 20 6c 69 74 74 6c 65 20 69 73 20 6b 6e 6f 77 6e 20 61 62 6f 75 74 20 74 68 65 6d 20 | .and.little.is.known.about.them. |
| 29ae0 | 6f 74 68 65 72 20 74 68 61 6e 20 74 68 61 74 20 74 68 65 79 20 61 72 65 0a 65 78 74 72 65 6d 65 | other.than.that.they.are.extreme |
| 29b00 | 6c 79 20 72 61 72 65 2e 20 20 54 68 65 72 65 20 61 72 65 20 32 35 35 20 43 61 72 6d 69 63 68 61 | ly.rare...There.are.255.Carmicha |
| 29b20 | 65 6c 20 6e 75 6d 62 65 72 73 20 62 65 6c 6f 77 20 31 30 30 2c 30 30 30 2c 30 30 30 2e 0a 54 68 | el.numbers.below.100,000,000..Th |
| 29b40 | 65 20 73 6d 61 6c 6c 65 73 74 20 66 65 77 20 61 72 65 20 35 36 31 2c 20 31 31 30 35 2c 20 31 37 | e.smallest.few.are.561,.1105,.17 |
| 29b60 | 32 39 2c 20 32 34 36 35 2c 20 32 38 32 31 2c 20 61 6e 64 20 36 36 30 31 2e 20 20 49 6e 20 74 65 | 29,.2465,.2821,.and.6601...In.te |
| 29b80 | 73 74 69 6e 67 0a 70 72 69 6d 61 6c 69 74 79 20 6f 66 20 76 65 72 79 20 6c 61 72 67 65 20 6e 75 | sting.primality.of.very.large.nu |
| 29ba0 | 6d 62 65 72 73 20 63 68 6f 73 65 6e 20 61 74 20 72 61 6e 64 6f 6d 2c 20 74 68 65 20 63 68 61 6e | mbers.chosen.at.random,.the.chan |
| 29bc0 | 63 65 20 6f 66 0a 73 74 75 6d 62 6c 69 6e 67 20 75 70 6f 6e 20 61 20 76 61 6c 75 65 20 74 68 61 | ce.of.stumbling.upon.a.value.tha |
| 29be0 | 74 20 66 6f 6f 6c 73 20 74 68 65 20 46 65 72 6d 61 74 20 74 65 73 74 20 69 73 20 6c 65 73 73 20 | t.fools.the.Fermat.test.is.less. |
| 29c00 | 74 68 61 6e 20 74 68 65 0a 63 68 61 6e 63 65 20 74 68 61 74 20 63 6f 73 6d 69 63 20 72 61 64 69 | than.the.chance.that.cosmic.radi |
| 29c20 | 61 74 69 6f 6e 20 77 69 6c 6c 20 63 61 75 73 65 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 74 6f | ation.will.cause.the.computer.to |
| 29c40 | 20 6d 61 6b 65 20 61 6e 20 65 72 72 6f 72 0a 69 6e 20 63 61 72 72 79 69 6e 67 20 6f 75 74 20 61 | .make.an.error.in.carrying.out.a |
| 29c60 | 20 22 63 6f 72 72 65 63 74 22 20 61 6c 67 6f 72 69 74 68 6d 2e 20 20 43 6f 6e 73 69 64 65 72 69 | ."correct".algorithm...Consideri |
| 29c80 | 6e 67 20 61 6e 20 61 6c 67 6f 72 69 74 68 6d 20 74 6f 20 62 65 0a 69 6e 61 64 65 71 75 61 74 65 | ng.an.algorithm.to.be.inadequate |
| 29ca0 | 20 66 6f 72 20 74 68 65 20 66 69 72 73 74 20 72 65 61 73 6f 6e 20 62 75 74 20 6e 6f 74 20 66 6f | .for.the.first.reason.but.not.fo |
| 29cc0 | 72 20 74 68 65 20 73 65 63 6f 6e 64 20 69 6c 6c 75 73 74 72 61 74 65 73 20 74 68 65 0a 64 69 66 | r.the.second.illustrates.the.dif |
| 29ce0 | 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 6d 61 74 68 65 6d 61 74 69 63 73 20 61 6e 64 20 | ference.between.mathematics.and. |
| 29d00 | 65 6e 67 69 6e 65 65 72 69 6e 67 2e 0a 0a 20 20 20 28 35 29 20 4f 6e 65 20 6f 66 20 74 68 65 20 | engineering......(5).One.of.the. |
| 29d20 | 6d 6f 73 74 20 73 74 72 69 6b 69 6e 67 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 6f 66 20 70 72 | most.striking.applications.of.pr |
| 29d40 | 6f 62 61 62 69 6c 69 73 74 69 63 20 70 72 69 6d 65 0a 74 65 73 74 69 6e 67 20 68 61 73 20 62 65 | obabilistic.prime.testing.has.be |
| 29d60 | 65 6e 20 74 6f 20 74 68 65 20 66 69 65 6c 64 20 6f 66 20 63 72 79 70 74 6f 67 72 61 70 68 79 2e | en.to.the.field.of.cryptography. |
| 29d80 | 20 20 41 6c 74 68 6f 75 67 68 20 69 74 20 69 73 20 6e 6f 77 0a 63 6f 6d 70 75 74 61 74 69 6f 6e | ..Although.it.is.now.computation |
| 29da0 | 61 6c 6c 79 20 69 6e 66 65 61 73 69 62 6c 65 20 74 6f 20 66 61 63 74 6f 72 20 61 6e 20 61 72 62 | ally.infeasible.to.factor.an.arb |
| 29dc0 | 69 74 72 61 72 79 20 32 30 30 2d 64 69 67 69 74 20 6e 75 6d 62 65 72 2c 20 74 68 65 0a 70 72 69 | itrary.200-digit.number,.the.pri |
| 29de0 | 6d 61 6c 69 74 79 20 6f 66 20 73 75 63 68 20 61 20 6e 75 6d 62 65 72 20 63 61 6e 20 62 65 20 63 | mality.of.such.a.number.can.be.c |
| 29e00 | 68 65 63 6b 65 64 20 69 6e 20 61 20 66 65 77 20 73 65 63 6f 6e 64 73 20 77 69 74 68 20 74 68 65 | hecked.in.a.few.seconds.with.the |
| 29e20 | 0a 46 65 72 6d 61 74 20 74 65 73 74 2e 20 20 54 68 69 73 20 66 61 63 74 20 66 6f 72 6d 73 20 74 | .Fermat.test...This.fact.forms.t |
| 29e40 | 68 65 20 62 61 73 69 73 20 6f 66 20 61 20 74 65 63 68 6e 69 71 75 65 20 66 6f 72 20 63 6f 6e 73 | he.basis.of.a.technique.for.cons |
| 29e60 | 74 72 75 63 74 69 6e 67 0a 22 75 6e 62 72 65 61 6b 61 62 6c 65 20 63 6f 64 65 73 22 20 73 75 67 | tructing."unbreakable.codes".sug |
| 29e80 | 67 65 73 74 65 64 20 62 79 20 52 69 76 65 73 74 2c 20 53 68 61 6d 69 72 2c 20 61 6e 64 20 41 64 | gested.by.Rivest,.Shamir,.and.Ad |
| 29ea0 | 6c 65 6d 61 6e 20 28 31 39 37 37 29 2e 0a 54 68 65 20 72 65 73 75 6c 74 69 6e 67 20 22 52 53 41 | leman.(1977)..The.resulting."RSA |
| 29ec0 | 20 61 6c 67 6f 72 69 74 68 6d 22 20 68 61 73 20 62 65 63 6f 6d 65 20 61 20 77 69 64 65 6c 79 20 | .algorithm".has.become.a.widely. |
| 29ee0 | 75 73 65 64 20 74 65 63 68 6e 69 71 75 65 20 66 6f 72 0a 65 6e 68 61 6e 63 69 6e 67 20 74 68 65 | used.technique.for.enhancing.the |
| 29f00 | 20 73 65 63 75 72 69 74 79 20 6f 66 20 65 6c 65 63 74 72 6f 6e 69 63 20 63 6f 6d 6d 75 6e 69 63 | .security.of.electronic.communic |
| 29f20 | 61 74 69 6f 6e 73 2e 20 20 42 65 63 61 75 73 65 20 6f 66 20 74 68 69 73 0a 61 6e 64 20 72 65 6c | ations...Because.of.this.and.rel |
| 29f40 | 61 74 65 64 20 64 65 76 65 6c 6f 70 6d 65 6e 74 73 2c 20 74 68 65 20 73 74 75 64 79 20 6f 66 20 | ated.developments,.the.study.of. |
| 29f60 | 70 72 69 6d 65 20 6e 75 6d 62 65 72 73 2c 20 6f 6e 63 65 20 63 6f 6e 73 69 64 65 72 65 64 0a 74 | prime.numbers,.once.considered.t |
| 29f80 | 68 65 20 65 70 69 74 6f 6d 65 20 6f 66 20 61 20 74 6f 70 69 63 20 69 6e 20 22 70 75 72 65 22 20 | he.epitome.of.a.topic.in."pure". |
| 29fa0 | 6d 61 74 68 65 6d 61 74 69 63 73 20 74 6f 20 62 65 20 73 74 75 64 69 65 64 20 6f 6e 6c 79 20 66 | mathematics.to.be.studied.only.f |
| 29fc0 | 6f 72 20 69 74 73 0a 6f 77 6e 20 73 61 6b 65 2c 20 6e 6f 77 20 74 75 72 6e 73 20 6f 75 74 20 74 | or.its.own.sake,.now.turns.out.t |
| 29fe0 | 6f 20 68 61 76 65 20 69 6d 70 6f 72 74 61 6e 74 20 70 72 61 63 74 69 63 61 6c 20 61 70 70 6c 69 | o.have.important.practical.appli |
| 2a000 | 63 61 74 69 6f 6e 73 20 74 6f 0a 63 72 79 70 74 6f 67 72 61 70 68 79 2c 20 65 6c 65 63 74 72 6f | cations.to.cryptography,.electro |
| 2a020 | 6e 69 63 20 66 75 6e 64 73 20 74 72 61 6e 73 66 65 72 2c 20 61 6e 64 20 69 6e 66 6f 72 6d 61 74 | nic.funds.transfer,.and.informat |
| 2a040 | 69 6f 6e 20 72 65 74 72 69 65 76 61 6c 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 | ion.retrieval.....File:.sicp.inf |
| 2a060 | 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 33 2c 20 20 50 72 65 76 3a 20 31 2d 32 2c 20 20 55 70 3a 20 | o,..Node:.1-3,..Prev:.1-2,..Up:. |
| 2a080 | 43 68 61 70 74 65 72 20 31 0a 0a 31 2e 33 20 46 6f 72 6d 75 6c 61 74 69 6e 67 20 41 62 73 74 72 | Chapter.1..1.3.Formulating.Abstr |
| 2a0a0 | 61 63 74 69 6f 6e 73 20 77 69 74 68 20 48 69 67 68 65 72 2d 4f 72 64 65 72 20 50 72 6f 63 65 64 | actions.with.Higher-Order.Proced |
| 2a0c0 | 75 72 65 73 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ures.=========================== |
| 2a0e0 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a | ==============================.. |
| 2a100 | 57 65 20 68 61 76 65 20 73 65 65 6e 20 74 68 61 74 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 | We.have.seen.that.procedures.are |
| 2a120 | 2c 20 69 6e 20 65 66 66 65 63 74 2c 20 61 62 73 74 72 61 63 74 69 6f 6e 73 20 74 68 61 74 20 64 | ,.in.effect,.abstractions.that.d |
| 2a140 | 65 73 63 72 69 62 65 0a 63 6f 6d 70 6f 75 6e 64 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 6e | escribe.compound.operations.on.n |
| 2a160 | 75 6d 62 65 72 73 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 70 61 72 74 69 63 | umbers.independent.of.the.partic |
| 2a180 | 75 6c 61 72 20 6e 75 6d 62 65 72 73 2e 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 68 65 6e 20 | ular.numbers..For.example,.when. |
| 2a1a0 | 77 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 75 62 65 20 78 29 20 28 2a 20 78 20 78 | we.......(define.(cube.x).(*.x.x |
| 2a1c0 | 20 78 29 29 0a 0a 77 65 20 61 72 65 20 6e 6f 74 20 74 61 6c 6b 69 6e 67 20 61 62 6f 75 74 20 74 | .x))..we.are.not.talking.about.t |
| 2a1e0 | 68 65 20 63 75 62 65 20 6f 66 20 61 20 70 61 72 74 69 63 75 6c 61 72 20 6e 75 6d 62 65 72 2c 20 | he.cube.of.a.particular.number,. |
| 2a200 | 62 75 74 20 72 61 74 68 65 72 0a 61 62 6f 75 74 20 61 20 6d 65 74 68 6f 64 20 66 6f 72 20 6f 62 | but.rather.about.a.method.for.ob |
| 2a220 | 74 61 69 6e 69 6e 67 20 74 68 65 20 63 75 62 65 20 6f 66 20 61 6e 79 20 6e 75 6d 62 65 72 2e 20 | taining.the.cube.of.any.number.. |
| 2a240 | 20 4f 66 20 63 6f 75 72 73 65 20 77 65 0a 63 6f 75 6c 64 20 67 65 74 20 61 6c 6f 6e 67 20 77 69 | .Of.course.we.could.get.along.wi |
| 2a260 | 74 68 6f 75 74 20 65 76 65 72 20 64 65 66 69 6e 69 6e 67 20 74 68 69 73 20 70 72 6f 63 65 64 75 | thout.ever.defining.this.procedu |
| 2a280 | 72 65 2c 20 62 79 20 61 6c 77 61 79 73 20 77 72 69 74 69 6e 67 0a 65 78 70 72 65 73 73 69 6f 6e | re,.by.always.writing.expression |
| 2a2a0 | 73 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 20 28 2a 20 33 20 33 20 33 29 0a 20 20 20 20 20 28 | s.such.as.......(*.3.3.3)......( |
| 2a2c0 | 2a 20 78 20 78 20 78 29 0a 20 20 20 20 20 28 2a 20 79 20 79 20 79 29 0a 0a 61 6e 64 20 6e 65 76 | *.x.x.x)......(*.y.y.y)..and.nev |
| 2a2e0 | 65 72 20 6d 65 6e 74 69 6f 6e 69 6e 67 20 60 63 75 62 65 27 20 65 78 70 6c 69 63 69 74 6c 79 2e | er.mentioning.`cube'.explicitly. |
| 2a300 | 20 20 54 68 69 73 20 77 6f 75 6c 64 20 70 6c 61 63 65 20 75 73 20 61 74 20 61 0a 73 65 72 69 6f | ..This.would.place.us.at.a.serio |
| 2a320 | 75 73 20 64 69 73 61 64 76 61 6e 74 61 67 65 2c 20 66 6f 72 63 69 6e 67 20 75 73 20 74 6f 20 77 | us.disadvantage,.forcing.us.to.w |
| 2a340 | 6f 72 6b 20 61 6c 77 61 79 73 20 61 74 20 74 68 65 20 6c 65 76 65 6c 20 6f 66 20 74 68 65 0a 70 | ork.always.at.the.level.of.the.p |
| 2a360 | 61 72 74 69 63 75 6c 61 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 68 61 70 70 65 6e | articular.operations.that.happen |
| 2a380 | 20 74 6f 20 62 65 20 70 72 69 6d 69 74 69 76 65 73 20 69 6e 20 74 68 65 20 6c 61 6e 67 75 61 67 | .to.be.primitives.in.the.languag |
| 2a3a0 | 65 0a 28 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 2c 20 69 6e 20 74 68 69 73 20 63 61 73 65 29 | e.(multiplication,.in.this.case) |
| 2a3c0 | 20 72 61 74 68 65 72 20 74 68 61 6e 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 68 69 67 68 65 72 2d | .rather.than.in.terms.of.higher- |
| 2a3e0 | 6c 65 76 65 6c 0a 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 4f 75 72 20 70 72 6f 67 72 61 6d 73 20 | level.operations...Our.programs. |
| 2a400 | 77 6f 75 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 63 75 62 65 73 2c 20 | would.be.able.to.compute.cubes,. |
| 2a420 | 62 75 74 20 6f 75 72 0a 6c 61 6e 67 75 61 67 65 20 77 6f 75 6c 64 20 6c 61 63 6b 20 74 68 65 20 | but.our.language.would.lack.the. |
| 2a440 | 61 62 69 6c 69 74 79 20 74 6f 20 65 78 70 72 65 73 73 20 74 68 65 20 63 6f 6e 63 65 70 74 20 6f | ability.to.express.the.concept.o |
| 2a460 | 66 20 63 75 62 69 6e 67 2e 20 20 4f 6e 65 0a 6f 66 20 74 68 65 20 74 68 69 6e 67 73 20 77 65 20 | f.cubing...One.of.the.things.we. |
| 2a480 | 73 68 6f 75 6c 64 20 64 65 6d 61 6e 64 20 66 72 6f 6d 20 61 20 70 6f 77 65 72 66 75 6c 20 70 72 | should.demand.from.a.powerful.pr |
| 2a4a0 | 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 69 73 0a 74 68 65 20 61 62 69 6c 69 74 | ogramming.language.is.the.abilit |
| 2a4c0 | 79 20 74 6f 20 62 75 69 6c 64 20 61 62 73 74 72 61 63 74 69 6f 6e 73 20 62 79 20 61 73 73 69 67 | y.to.build.abstractions.by.assig |
| 2a4e0 | 6e 69 6e 67 20 6e 61 6d 65 73 20 74 6f 20 63 6f 6d 6d 6f 6e 20 70 61 74 74 65 72 6e 73 0a 61 6e | ning.names.to.common.patterns.an |
| 2a500 | 64 20 74 68 65 6e 20 74 6f 20 77 6f 72 6b 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 61 | d.then.to.work.in.terms.of.the.a |
| 2a520 | 62 73 74 72 61 63 74 69 6f 6e 73 20 64 69 72 65 63 74 6c 79 2e 20 20 50 72 6f 63 65 64 75 72 65 | bstractions.directly...Procedure |
| 2a540 | 73 0a 70 72 6f 76 69 64 65 20 74 68 69 73 20 61 62 69 6c 69 74 79 2e 20 20 54 68 69 73 20 69 73 | s.provide.this.ability...This.is |
| 2a560 | 20 77 68 79 20 61 6c 6c 20 62 75 74 20 74 68 65 20 6d 6f 73 74 20 70 72 69 6d 69 74 69 76 65 0a | .why.all.but.the.most.primitive. |
| 2a580 | 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 69 6e 63 6c 75 64 65 20 6d 65 | programming.languages.include.me |
| 2a5a0 | 63 68 61 6e 69 73 6d 73 20 66 6f 72 20 64 65 66 69 6e 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 | chanisms.for.defining.procedures |
| 2a5c0 | 2e 0a 0a 20 20 20 59 65 74 20 65 76 65 6e 20 69 6e 20 6e 75 6d 65 72 69 63 61 6c 20 70 72 6f 63 | ......Yet.even.in.numerical.proc |
| 2a5e0 | 65 73 73 69 6e 67 20 77 65 20 77 69 6c 6c 20 62 65 20 73 65 76 65 72 65 6c 79 20 6c 69 6d 69 74 | essing.we.will.be.severely.limit |
| 2a600 | 65 64 20 69 6e 20 6f 75 72 0a 61 62 69 6c 69 74 79 20 74 6f 20 63 72 65 61 74 65 20 61 62 73 74 | ed.in.our.ability.to.create.abst |
| 2a620 | 72 61 63 74 69 6f 6e 73 20 69 66 20 77 65 20 61 72 65 20 72 65 73 74 72 69 63 74 65 64 20 74 6f | ractions.if.we.are.restricted.to |
| 2a640 | 20 70 72 6f 63 65 64 75 72 65 73 20 77 68 6f 73 65 0a 70 61 72 61 6d 65 74 65 72 73 20 6d 75 73 | .procedures.whose.parameters.mus |
| 2a660 | 74 20 62 65 20 6e 75 6d 62 65 72 73 2e 20 20 4f 66 74 65 6e 20 74 68 65 20 73 61 6d 65 20 70 72 | t.be.numbers...Often.the.same.pr |
| 2a680 | 6f 67 72 61 6d 6d 69 6e 67 20 70 61 74 74 65 72 6e 20 77 69 6c 6c 20 62 65 0a 75 73 65 64 20 77 | ogramming.pattern.will.be.used.w |
| 2a6a0 | 69 74 68 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 63 65 64 | ith.a.number.of.different.proced |
| 2a6c0 | 75 72 65 73 2e 20 20 54 6f 20 65 78 70 72 65 73 73 20 73 75 63 68 20 70 61 74 74 65 72 6e 73 0a | ures...To.express.such.patterns. |
| 2a6e0 | 61 73 20 63 6f 6e 63 65 70 74 73 2c 20 77 65 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 63 6f 6e | as.concepts,.we.will.need.to.con |
| 2a700 | 73 74 72 75 63 74 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 63 61 6e 20 61 63 63 65 70 | struct.procedures.that.can.accep |
| 2a720 | 74 0a 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 6f 72 20 72 65 74 | t.procedures.as.arguments.or.ret |
| 2a740 | 75 72 6e 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 76 61 6c 75 65 73 2e 20 20 50 72 6f 63 65 | urn.procedures.as.values...Proce |
| 2a760 | 64 75 72 65 73 0a 74 68 61 74 20 6d 61 6e 69 70 75 6c 61 74 65 20 70 72 6f 63 65 64 75 72 65 73 | dures.that.manipulate.procedures |
| 2a780 | 20 61 72 65 20 63 61 6c 6c 65 64 20 22 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 | .are.called."higher-order.proced |
| 2a7a0 | 75 72 65 73 22 2e 20 20 54 68 69 73 0a 73 65 63 74 69 6f 6e 20 73 68 6f 77 73 20 68 6f 77 20 68 | ures"...This.section.shows.how.h |
| 2a7c0 | 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 73 20 63 61 6e 20 73 65 72 76 65 | igher-order.procedures.can.serve |
| 2a7e0 | 20 61 73 20 70 6f 77 65 72 66 75 6c 0a 61 62 73 74 72 61 63 74 69 6f 6e 20 6d 65 63 68 61 6e 69 | .as.powerful.abstraction.mechani |
| 2a800 | 73 6d 73 2c 20 76 61 73 74 6c 79 20 69 6e 63 72 65 61 73 69 6e 67 20 74 68 65 20 65 78 70 72 65 | sms,.vastly.increasing.the.expre |
| 2a820 | 73 73 69 76 65 20 70 6f 77 65 72 20 6f 66 20 6f 75 72 0a 6c 61 6e 67 75 61 67 65 2e 0a 0a 2a 20 | ssive.power.of.our.language...*. |
| 2a840 | 4d 65 6e 75 3a 0a 0a 2a 20 31 2d 33 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 50 72 6f 63 | Menu:..*.1-3-1::............Proc |
| 2a860 | 65 64 75 72 65 73 20 61 73 20 41 72 67 75 6d 65 6e 74 73 0a 2a 20 31 2d 33 2d 32 3a 3a 20 20 20 | edures.as.Arguments.*.1-3-2::... |
| 2a880 | 20 20 20 20 20 20 20 20 20 43 6f 6e 73 74 72 75 63 74 69 6e 67 20 50 72 6f 63 65 64 75 72 65 73 | .........Constructing.Procedures |
| 2a8a0 | 20 55 73 69 6e 67 20 60 4c 61 6d 62 64 61 27 0a 2a 20 31 2d 33 2d 33 3a 3a 20 20 20 20 20 20 20 | .Using.`Lambda'.*.1-3-3::....... |
| 2a8c0 | 20 20 20 20 20 50 72 6f 63 65 64 75 72 65 73 20 61 73 20 47 65 6e 65 72 61 6c 20 4d 65 74 68 6f | .....Procedures.as.General.Metho |
| 2a8e0 | 64 73 0a 2a 20 31 2d 33 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 50 72 6f 63 65 64 75 72 | ds.*.1-3-4::............Procedur |
| 2a900 | 65 73 20 61 73 20 52 65 74 75 72 6e 65 64 20 56 61 6c 75 65 73 0a 0a 1f 0a 46 69 6c 65 3a 20 73 | es.as.Returned.Values....File:.s |
| 2a920 | 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 33 2d 31 2c 20 20 4e 65 78 74 3a 20 31 | icp.info,..Node:.1-3-1,..Next:.1 |
| 2a940 | 2d 33 2d 32 2c 20 20 50 72 65 76 3a 20 31 2d 33 2c 20 20 55 70 3a 20 31 2d 33 0a 0a 31 2e 33 2e | -3-2,..Prev:.1-3,..Up:.1-3..1.3. |
| 2a960 | 31 20 50 72 6f 63 65 64 75 72 65 73 20 61 73 20 41 72 67 75 6d 65 6e 74 73 0a 2d 2d 2d 2d 2d 2d | 1.Procedures.as.Arguments.------ |
| 2a980 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 43 6f 6e 73 69 64 65 | -----------------------..Conside |
| 2a9a0 | 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 72 65 65 20 70 72 6f 63 65 64 75 72 65 73 | r.the.following.three.procedures |
| 2a9c0 | 2e 20 20 54 68 65 20 66 69 72 73 74 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 73 75 6d 20 6f 66 | ...The.first.computes.the.sum.of |
| 2a9e0 | 0a 74 68 65 20 69 6e 74 65 67 65 72 73 20 66 72 6f 6d 20 60 61 27 20 74 68 72 6f 75 67 68 20 60 | .the.integers.from.`a'.through.` |
| 2aa00 | 62 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d 2d 69 6e 74 65 67 65 72 73 20 | b':.......(define.(sum-integers. |
| 2aa20 | 61 20 62 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 61 20 62 29 0a 20 20 20 20 20 20 20 20 | a.b)........(if.(>.a.b)......... |
| 2aa40 | 20 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 61 20 28 73 75 6d 2d 69 6e 74 65 67 65 | ...0............(+.a.(sum-intege |
| 2aa60 | 72 73 20 28 2b 20 61 20 31 29 20 62 29 29 29 29 0a 0a 20 20 20 54 68 65 20 73 65 63 6f 6e 64 20 | rs.(+.a.1).b)))).....The.second. |
| 2aa80 | 63 6f 6d 70 75 74 65 73 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 63 75 62 65 73 20 6f 66 | computes.the.sum.of.the.cubes.of |
| 2aaa0 | 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 69 6e 20 74 68 65 0a 67 69 76 65 6e 20 72 61 6e 67 65 | .the.integers.in.the.given.range |
| 2aac0 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d 2d 63 75 62 65 73 20 61 20 62 29 0a | :.......(define.(sum-cubes.a.b). |
| 2aae0 | 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 61 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 20 30 0a | .......(if.(>.a.b)............0. |
| 2ab00 | 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 63 75 62 65 20 61 29 20 28 73 75 6d 2d 63 75 62 65 | ...........(+.(cube.a).(sum-cube |
| 2ab20 | 73 20 28 2b 20 61 20 31 29 20 62 29 29 29 29 0a 0a 20 20 20 54 68 65 20 74 68 69 72 64 20 63 6f | s.(+.a.1).b)))).....The.third.co |
| 2ab40 | 6d 70 75 74 65 73 20 74 68 65 20 73 75 6d 20 6f 66 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 | mputes.the.sum.of.a.sequence.of. |
| 2ab60 | 74 65 72 6d 73 20 69 6e 20 74 68 65 20 73 65 72 69 65 73 0a 0a 20 20 20 20 20 20 20 31 20 20 20 | terms.in.the.series.........1... |
| 2ab80 | 20 20 20 20 31 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 2d 2d 2d 2d 2d 20 2b 20 2d 2d 2d 2d 2d | ....1.......1......-----.+.----- |
| 2aba0 | 20 2b 20 2d 2d 2d 2d 2d 2d 20 2b 20 2e 2e 2e 0a 20 20 20 20 20 31 20 2a 20 33 20 20 20 35 20 2a | .+.------.+..........1.*.3...5.* |
| 2abc0 | 20 37 20 20 20 39 20 2a 20 31 31 0a 0a 77 68 69 63 68 20 63 6f 6e 76 65 72 67 65 73 20 74 6f 20 | .7...9.*.11..which.converges.to. |
| 2abe0 | 5b 70 69 5d 2f 38 20 28 76 65 72 79 20 73 6c 6f 77 6c 79 29 3a 28 31 29 0a 0a 20 20 20 20 20 28 | [pi]/8.(very.slowly):(1).......( |
| 2ac00 | 64 65 66 69 6e 65 20 28 70 69 2d 73 75 6d 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 | define.(pi-sum.a.b)........(if.( |
| 2ac20 | 3e 20 61 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 28 | >.a.b)............0............( |
| 2ac40 | 2b 20 28 2f 20 31 2e 30 20 28 2a 20 61 20 28 2b 20 61 20 32 29 29 29 20 28 70 69 2d 73 75 6d 20 | +.(/.1.0.(*.a.(+.a.2))).(pi-sum. |
| 2ac60 | 28 2b 20 61 20 34 29 20 62 29 29 29 29 0a 0a 20 20 20 54 68 65 73 65 20 74 68 72 65 65 20 70 72 | (+.a.4).b)))).....These.three.pr |
| 2ac80 | 6f 63 65 64 75 72 65 73 20 63 6c 65 61 72 6c 79 20 73 68 61 72 65 20 61 20 63 6f 6d 6d 6f 6e 20 | ocedures.clearly.share.a.common. |
| 2aca0 | 75 6e 64 65 72 6c 79 69 6e 67 20 70 61 74 74 65 72 6e 2e 0a 54 68 65 79 20 61 72 65 20 66 6f 72 | underlying.pattern..They.are.for |
| 2acc0 | 20 74 68 65 20 6d 6f 73 74 20 70 61 72 74 20 69 64 65 6e 74 69 63 61 6c 2c 20 64 69 66 66 65 72 | .the.most.part.identical,.differ |
| 2ace0 | 69 6e 67 20 6f 6e 6c 79 20 69 6e 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 0a 70 72 6f 63 | ing.only.in.the.name.of.the.proc |
| 2ad00 | 65 64 75 72 65 2c 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 6f 66 20 60 61 27 20 75 73 65 64 20 | edure,.the.function.of.`a'.used. |
| 2ad20 | 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 74 65 72 6d 20 74 6f 20 62 65 20 61 64 64 65 64 2c | to.compute.the.term.to.be.added, |
| 2ad40 | 0a 61 6e 64 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 74 68 61 74 20 70 72 6f 76 69 64 65 73 20 | .and.the.function.that.provides. |
| 2ad60 | 74 68 65 20 6e 65 78 74 20 76 61 6c 75 65 20 6f 66 20 60 61 27 2e 20 20 57 65 20 63 6f 75 6c 64 | the.next.value.of.`a'...We.could |
| 2ad80 | 0a 67 65 6e 65 72 61 74 65 20 65 61 63 68 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 | .generate.each.of.the.procedures |
| 2ada0 | 20 62 79 20 66 69 6c 6c 69 6e 67 20 69 6e 20 73 6c 6f 74 73 20 69 6e 20 74 68 65 20 73 61 6d 65 | .by.filling.in.slots.in.the.same |
| 2adc0 | 0a 74 65 6d 70 6c 61 74 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 3c 4e 41 4d 45 3e | .template:.......(define.(<NAME> |
| 2ade0 | 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 61 20 62 29 0a 20 20 20 20 20 20 20 | .a.b)........(if.(>.a.b)........ |
| 2ae00 | 20 20 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 3c 54 45 52 4d 3e 20 61 29 0a 20 | ....0............(+.(<TERM>.a).. |
| 2ae20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 3c 4e 41 4d 45 3e 20 28 3c 4e 45 58 54 3e 20 61 29 20 | .............(<NAME>.(<NEXT>.a). |
| 2ae40 | 62 29 29 29 29 0a 0a 20 20 20 54 68 65 20 70 72 65 73 65 6e 63 65 20 6f 66 20 73 75 63 68 20 61 | b)))).....The.presence.of.such.a |
| 2ae60 | 20 63 6f 6d 6d 6f 6e 20 70 61 74 74 65 72 6e 20 69 73 20 73 74 72 6f 6e 67 20 65 76 69 64 65 6e | .common.pattern.is.strong.eviden |
| 2ae80 | 63 65 20 74 68 61 74 20 74 68 65 72 65 0a 69 73 20 61 20 75 73 65 66 75 6c 20 61 62 73 74 72 61 | ce.that.there.is.a.useful.abstra |
| 2aea0 | 63 74 69 6f 6e 20 77 61 69 74 69 6e 67 20 74 6f 20 62 65 20 62 72 6f 75 67 68 74 20 74 6f 20 74 | ction.waiting.to.be.brought.to.t |
| 2aec0 | 68 65 20 73 75 72 66 61 63 65 2e 20 20 49 6e 64 65 65 64 2c 0a 6d 61 74 68 65 6d 61 74 69 63 69 | he.surface...Indeed,.mathematici |
| 2aee0 | 61 6e 73 20 6c 6f 6e 67 20 61 67 6f 20 69 64 65 6e 74 69 66 69 65 64 20 74 68 65 20 61 62 73 74 | ans.long.ago.identified.the.abst |
| 2af00 | 72 61 63 74 69 6f 6e 20 6f 66 20 22 73 75 6d 6d 61 74 69 6f 6e 20 6f 66 20 61 0a 73 65 72 69 65 | raction.of."summation.of.a.serie |
| 2af20 | 73 22 20 61 6e 64 20 69 6e 76 65 6e 74 65 64 20 22 73 69 67 6d 61 20 6e 6f 74 61 74 69 6f 6e 2c | s".and.invented."sigma.notation, |
| 2af40 | 22 20 66 6f 72 20 65 78 61 6d 70 6c 65 0a 0a 20 20 20 20 20 20 20 62 0a 20 20 20 20 20 20 2d 2d | ".for.example.........b.......-- |
| 2af60 | 2d 0a 20 20 20 20 20 20 3e 20 20 20 20 66 28 6e 29 20 3d 20 66 28 61 29 20 2b 20 2e 2e 2e 20 2b | -.......>....f(n).=.f(a).+.....+ |
| 2af80 | 20 66 28 62 29 0a 20 20 20 20 20 20 2d 2d 2d 0a 20 20 20 20 20 20 6e 3d 61 0a 0a 74 6f 20 65 78 | .f(b).......---.......n=a..to.ex |
| 2afa0 | 70 72 65 73 73 20 74 68 69 73 20 63 6f 6e 63 65 70 74 2e 20 20 54 68 65 20 70 6f 77 65 72 20 6f | press.this.concept...The.power.o |
| 2afc0 | 66 20 73 69 67 6d 61 20 6e 6f 74 61 74 69 6f 6e 20 69 73 20 74 68 61 74 20 69 74 20 61 6c 6c 6f | f.sigma.notation.is.that.it.allo |
| 2afe0 | 77 73 0a 6d 61 74 68 65 6d 61 74 69 63 69 61 6e 73 20 74 6f 20 64 65 61 6c 20 77 69 74 68 20 74 | ws.mathematicians.to.deal.with.t |
| 2b000 | 68 65 20 63 6f 6e 63 65 70 74 20 6f 66 20 73 75 6d 6d 61 74 69 6f 6e 20 69 74 73 65 6c 66 20 72 | he.concept.of.summation.itself.r |
| 2b020 | 61 74 68 65 72 20 74 68 61 6e 0a 6f 6e 6c 79 20 77 69 74 68 20 70 61 72 74 69 63 75 6c 61 72 20 | ather.than.only.with.particular. |
| 2b040 | 73 75 6d 73 2d 2d 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 6f 20 66 6f 72 6d 75 6c 61 74 65 20 | sums--for.example,.to.formulate. |
| 2b060 | 67 65 6e 65 72 61 6c 20 72 65 73 75 6c 74 73 0a 61 62 6f 75 74 20 73 75 6d 73 20 74 68 61 74 20 | general.results.about.sums.that. |
| 2b080 | 61 72 65 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 70 61 72 74 69 63 75 6c 61 | are.independent.of.the.particula |
| 2b0a0 | 72 20 73 65 72 69 65 73 20 62 65 69 6e 67 20 73 75 6d 6d 65 64 2e 0a 0a 20 20 20 53 69 6d 69 6c | r.series.being.summed......Simil |
| 2b0c0 | 61 72 6c 79 2c 20 61 73 20 70 72 6f 67 72 61 6d 20 64 65 73 69 67 6e 65 72 73 2c 20 77 65 20 77 | arly,.as.program.designers,.we.w |
| 2b0e0 | 6f 75 6c 64 20 6c 69 6b 65 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 74 6f 20 62 65 0a 70 6f 77 | ould.like.our.language.to.be.pow |
| 2b100 | 65 72 66 75 6c 20 65 6e 6f 75 67 68 20 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e 20 77 72 69 74 | erful.enough.so.that.we.can.writ |
| 2b120 | 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 65 78 70 72 65 73 73 65 73 20 74 68 65 | e.a.procedure.that.expresses.the |
| 2b140 | 0a 63 6f 6e 63 65 70 74 20 6f 66 20 73 75 6d 6d 61 74 69 6f 6e 20 69 74 73 65 6c 66 20 72 61 74 | .concept.of.summation.itself.rat |
| 2b160 | 68 65 72 20 74 68 61 6e 20 6f 6e 6c 79 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 63 6f | her.than.only.procedures.that.co |
| 2b180 | 6d 70 75 74 65 0a 70 61 72 74 69 63 75 6c 61 72 20 73 75 6d 73 2e 20 20 57 65 20 63 61 6e 20 64 | mpute.particular.sums...We.can.d |
| 2b1a0 | 6f 20 73 6f 20 72 65 61 64 69 6c 79 20 69 6e 20 6f 75 72 20 70 72 6f 63 65 64 75 72 61 6c 20 6c | o.so.readily.in.our.procedural.l |
| 2b1c0 | 61 6e 67 75 61 67 65 20 62 79 0a 74 61 6b 69 6e 67 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 74 65 6d | anguage.by.taking.the.common.tem |
| 2b1e0 | 70 6c 61 74 65 20 73 68 6f 77 6e 20 61 62 6f 76 65 20 61 6e 64 20 74 72 61 6e 73 66 6f 72 6d 69 | plate.shown.above.and.transformi |
| 2b200 | 6e 67 20 74 68 65 20 22 73 6c 6f 74 73 22 0a 69 6e 74 6f 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d | ng.the."slots".into.formal.param |
| 2b220 | 65 74 65 72 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d 20 74 65 72 6d 20 61 | eters:.......(define.(sum.term.a |
| 2b240 | 20 6e 65 78 74 20 62 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 61 20 62 29 0a 20 20 20 20 | .next.b)........(if.(>.a.b)..... |
| 2b260 | 20 20 20 20 20 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 74 65 72 6d 20 61 29 0a | .......0............(+.(term.a). |
| 2b280 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 75 6d 20 74 65 72 6d 20 28 6e 65 78 74 20 61 29 | ..............(sum.term.(next.a) |
| 2b2a0 | 20 6e 65 78 74 20 62 29 29 29 29 0a 0a 20 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 60 73 75 6d | .next.b)))).....Notice.that.`sum |
| 2b2c0 | 27 20 74 61 6b 65 73 20 61 73 20 69 74 73 20 61 72 67 75 6d 65 6e 74 73 20 74 68 65 20 6c 6f 77 | '.takes.as.its.arguments.the.low |
| 2b2e0 | 65 72 20 61 6e 64 20 75 70 70 65 72 20 62 6f 75 6e 64 73 0a 60 61 27 20 61 6e 64 20 60 62 27 20 | er.and.upper.bounds.`a'.and.`b'. |
| 2b300 | 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 74 65 | together.with.the.procedures.`te |
| 2b320 | 72 6d 27 20 61 6e 64 20 60 6e 65 78 74 27 2e 20 20 57 65 20 63 61 6e 20 75 73 65 0a 60 73 75 6d | rm'.and.`next'...We.can.use.`sum |
| 2b340 | 27 20 6a 75 73 74 20 61 73 20 77 65 20 77 6f 75 6c 64 20 61 6e 79 20 70 72 6f 63 65 64 75 72 65 | '.just.as.we.would.any.procedure |
| 2b360 | 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 75 73 65 20 69 74 0a 28 61 | ...For.example,.we.can.use.it.(a |
| 2b380 | 6c 6f 6e 67 20 77 69 74 68 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 69 6e 63 27 20 74 68 61 74 | long.with.a.procedure.`inc'.that |
| 2b3a0 | 20 69 6e 63 72 65 6d 65 6e 74 73 20 69 74 73 20 61 72 67 75 6d 65 6e 74 20 62 79 20 31 29 20 74 | .increments.its.argument.by.1).t |
| 2b3c0 | 6f 0a 64 65 66 69 6e 65 20 60 73 75 6d 2d 63 75 62 65 73 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 | o.define.`sum-cubes':.......(def |
| 2b3e0 | 69 6e 65 20 28 69 6e 63 20 6e 29 20 28 2b 20 6e 20 31 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 | ine.(inc.n).(+.n.1)).......(defi |
| 2b400 | 6e 65 20 28 73 75 6d 2d 63 75 62 65 73 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 73 75 6d 20 63 | ne.(sum-cubes.a.b)........(sum.c |
| 2b420 | 75 62 65 20 61 20 69 6e 63 20 62 29 29 0a 0a 20 20 20 55 73 69 6e 67 20 74 68 69 73 2c 20 77 65 | ube.a.inc.b)).....Using.this,.we |
| 2b440 | 20 63 61 6e 20 63 6f 6d 70 75 74 65 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 63 75 62 65 | .can.compute.the.sum.of.the.cube |
| 2b460 | 73 20 6f 66 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 66 72 6f 6d 0a 31 20 74 6f 20 31 30 3a 0a | s.of.the.integers.from.1.to.10:. |
| 2b480 | 0a 20 20 20 20 20 28 73 75 6d 2d 63 75 62 65 73 20 31 20 31 30 29 0a 20 20 20 20 20 33 30 32 35 | ......(sum-cubes.1.10)......3025 |
| 2b4a0 | 0a 0a 20 20 20 57 69 74 68 20 74 68 65 20 61 69 64 20 6f 66 20 61 6e 20 69 64 65 6e 74 69 74 79 | .....With.the.aid.of.an.identity |
| 2b4c0 | 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 74 65 72 6d 2c 20 | .procedure.to.compute.the.term,. |
| 2b4e0 | 77 65 20 63 61 6e 0a 64 65 66 69 6e 65 20 60 73 75 6d 2d 69 6e 74 65 67 65 72 73 27 20 69 6e 20 | we.can.define.`sum-integers'.in. |
| 2b500 | 74 65 72 6d 73 20 6f 66 20 60 73 75 6d 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 | terms.of.`sum':.......(define.(i |
| 2b520 | 64 65 6e 74 69 74 79 20 78 29 20 78 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d | dentity.x).x).......(define.(sum |
| 2b540 | 2d 69 6e 74 65 67 65 72 73 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 73 75 6d 20 69 64 65 6e 74 | -integers.a.b)........(sum.ident |
| 2b560 | 69 74 79 20 61 20 69 6e 63 20 62 29 29 0a 0a 20 20 20 54 68 65 6e 20 77 65 20 63 61 6e 20 61 64 | ity.a.inc.b)).....Then.we.can.ad |
| 2b580 | 64 20 75 70 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 66 72 6f 6d 20 31 20 74 6f 20 31 30 3a 0a | d.up.the.integers.from.1.to.10:. |
| 2b5a0 | 0a 20 20 20 20 20 28 73 75 6d 2d 69 6e 74 65 67 65 72 73 20 31 20 31 30 29 0a 20 20 20 20 20 35 | ......(sum-integers.1.10)......5 |
| 2b5c0 | 35 0a 0a 20 20 20 57 65 20 63 61 6e 20 61 6c 73 6f 20 64 65 66 69 6e 65 20 60 70 69 2d 73 75 6d | 5.....We.can.also.define.`pi-sum |
| 2b5e0 | 27 20 69 6e 20 74 68 65 20 73 61 6d 65 20 77 61 79 3a 28 32 29 0a 0a 20 20 20 20 20 28 64 65 66 | '.in.the.same.way:(2).......(def |
| 2b600 | 69 6e 65 20 28 70 69 2d 73 75 6d 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ine.(pi-sum.a.b)........(define. |
| 2b620 | 28 70 69 2d 74 65 72 6d 20 78 29 0a 20 20 20 20 20 20 20 20 20 28 2f 20 31 2e 30 20 28 2a 20 78 | (pi-term.x)..........(/.1.0.(*.x |
| 2b640 | 20 28 2b 20 78 20 32 29 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 69 2d 6e | .(+.x.2))))........(define.(pi-n |
| 2b660 | 65 78 74 20 78 29 0a 20 20 20 20 20 20 20 20 20 28 2b 20 78 20 34 29 29 0a 20 20 20 20 20 20 20 | ext.x)..........(+.x.4))........ |
| 2b680 | 28 73 75 6d 20 70 69 2d 74 65 72 6d 20 61 20 70 69 2d 6e 65 78 74 20 62 29 29 0a 0a 20 20 20 55 | (sum.pi-term.a.pi-next.b)).....U |
| 2b6a0 | 73 69 6e 67 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 2c 20 77 65 20 63 61 6e 20 63 6f | sing.these.procedures,.we.can.co |
| 2b6c0 | 6d 70 75 74 65 20 61 6e 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 74 6f 20 5b 70 69 5d 3a 0a | mpute.an.approximation.to.[pi]:. |
| 2b6e0 | 0a 20 20 20 20 20 28 2a 20 38 20 28 70 69 2d 73 75 6d 20 31 20 31 30 30 30 29 29 0a 20 20 20 20 | ......(*.8.(pi-sum.1.1000))..... |
| 2b700 | 20 33 2e 31 33 39 35 39 32 36 35 35 35 38 39 37 38 33 0a 0a 20 20 20 4f 6e 63 65 20 77 65 20 68 | .3.139592655589783.....Once.we.h |
| 2b720 | 61 76 65 20 60 73 75 6d 27 2c 20 77 65 20 63 61 6e 20 75 73 65 20 69 74 20 61 73 20 61 20 62 75 | ave.`sum',.we.can.use.it.as.a.bu |
| 2b740 | 69 6c 64 69 6e 67 20 62 6c 6f 63 6b 20 69 6e 20 66 6f 72 6d 75 6c 61 74 69 6e 67 0a 66 75 72 74 | ilding.block.in.formulating.furt |
| 2b760 | 68 65 72 20 63 6f 6e 63 65 70 74 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 68 65 | her.concepts...For.instance,.the |
| 2b780 | 20 64 65 66 69 6e 69 74 65 20 69 6e 74 65 67 72 61 6c 20 6f 66 20 61 20 66 75 6e 63 74 69 6f 6e | .definite.integral.of.a.function |
| 2b7a0 | 20 66 0a 62 65 74 77 65 65 6e 20 74 68 65 20 6c 69 6d 69 74 73 20 61 20 61 6e 64 20 62 20 63 61 | .f.between.the.limits.a.and.b.ca |
| 2b7c0 | 6e 20 62 65 20 61 70 70 72 6f 78 69 6d 61 74 65 64 20 6e 75 6d 65 72 69 63 61 6c 6c 79 20 75 73 | n.be.approximated.numerically.us |
| 2b7e0 | 69 6e 67 20 74 68 65 0a 66 6f 72 6d 75 6c 61 0a 0a 20 20 20 20 20 2f 62 20 20 20 20 20 2f 20 20 | ing.the.formula......./b...../.. |
| 2b800 | 2f 20 20 20 20 20 64 78 20 5c 20 20 20 20 2f 20 20 20 20 20 20 20 20 20 20 64 78 20 5c 20 20 20 | /.....dx.\..../..........dx.\... |
| 2b820 | 20 2f 20 20 20 20 20 20 20 20 20 20 20 64 78 20 5c 20 20 20 20 20 20 5c 0a 20 20 20 20 20 7c 20 | ./...........dx.\......\......|. |
| 2b840 | 20 66 20 3d 20 7c 20 66 7c 20 61 20 2b 20 2d 2d 20 7c 20 2b 20 66 7c 20 61 20 2b 20 64 78 20 2b | .f.=.|.f|.a.+.--.|.+.f|.a.+.dx.+ |
| 2b860 | 20 2d 2d 20 7c 20 2b 20 66 7c 20 61 20 2b 20 32 64 78 20 2b 20 2d 2d 20 7c 20 2b 20 2e 2e 2e 7c | .--.|.+.f|.a.+.2dx.+.--.|.+....| |
| 2b880 | 20 64 78 0a 20 20 20 20 20 2f 61 20 20 20 20 20 5c 20 20 5c 20 20 20 20 20 32 20 20 2f 20 20 20 | .dx....../a.....\..\.....2../... |
| 2b8a0 | 20 5c 20 20 20 20 20 20 20 20 20 20 32 20 20 2f 20 20 20 20 5c 20 20 20 20 20 20 20 20 20 20 20 | .\..........2../....\........... |
| 2b8c0 | 32 20 20 2f 20 20 20 20 20 20 2f 0a 0a 66 6f 72 20 73 6d 61 6c 6c 20 76 61 6c 75 65 73 20 6f 66 | 2../....../..for.small.values.of |
| 2b8e0 | 20 64 78 2e 20 20 57 65 20 63 61 6e 20 65 78 70 72 65 73 73 20 74 68 69 73 20 64 69 72 65 63 74 | .dx...We.can.express.this.direct |
| 2b900 | 6c 79 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | ly.as.a.procedure:.......(define |
| 2b920 | 20 28 69 6e 74 65 67 72 61 6c 20 66 20 61 20 62 20 64 78 29 0a 20 20 20 20 20 20 20 28 64 65 66 | .(integral.f.a.b.dx)........(def |
| 2b940 | 69 6e 65 20 28 61 64 64 2d 64 78 20 78 29 20 28 2b 20 78 20 64 78 29 29 0a 20 20 20 20 20 20 20 | ine.(add-dx.x).(+.x.dx))........ |
| 2b960 | 28 2a 20 28 73 75 6d 20 66 20 28 2b 20 61 20 28 2f 20 64 78 20 32 2e 30 29 29 20 61 64 64 2d 64 | (*.(sum.f.(+.a.(/.dx.2.0)).add-d |
| 2b980 | 78 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 64 78 29 29 0a 0a 20 20 20 20 20 28 69 6e 74 65 67 | x.b)...........dx)).......(integ |
| 2b9a0 | 72 61 6c 20 63 75 62 65 20 30 20 31 20 30 2e 30 31 29 0a 20 20 20 20 20 2e 32 34 39 39 38 37 35 | ral.cube.0.1.0.01).......2499875 |
| 2b9c0 | 30 30 30 30 30 30 30 30 34 32 0a 0a 20 20 20 20 20 28 69 6e 74 65 67 72 61 6c 20 63 75 62 65 20 | 0000000042.......(integral.cube. |
| 2b9e0 | 30 20 31 20 30 2e 30 30 31 29 0a 20 20 20 20 20 2e 32 34 39 39 39 39 38 37 35 30 30 30 30 30 31 | 0.1.0.001).......249999875000001 |
| 2ba00 | 0a 0a 28 54 68 65 20 65 78 61 63 74 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 69 6e 74 65 67 72 | ..(The.exact.value.of.the.integr |
| 2ba20 | 61 6c 20 6f 66 20 60 63 75 62 65 27 20 62 65 74 77 65 65 6e 20 30 20 61 6e 64 20 31 20 69 73 20 | al.of.`cube'.between.0.and.1.is. |
| 2ba40 | 31 2f 34 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 32 39 3a 2a 20 53 69 6d | 1/4.).......*Exercise.1.29:*.Sim |
| 2ba60 | 70 73 6f 6e 27 73 20 52 75 6c 65 20 69 73 20 61 20 6d 6f 72 65 20 61 63 63 75 72 61 74 65 20 6d | pson's.Rule.is.a.more.accurate.m |
| 2ba80 | 65 74 68 6f 64 20 6f 66 0a 20 20 20 20 20 6e 75 6d 65 72 69 63 61 6c 20 69 6e 74 65 67 72 61 74 | ethod.of......numerical.integrat |
| 2baa0 | 69 6f 6e 20 74 68 61 6e 20 74 68 65 20 6d 65 74 68 6f 64 20 69 6c 6c 75 73 74 72 61 74 65 64 20 | ion.than.the.method.illustrated. |
| 2bac0 | 61 62 6f 76 65 2e 20 20 55 73 69 6e 67 0a 20 20 20 20 20 53 69 6d 70 73 6f 6e 27 73 20 52 75 6c | above...Using......Simpson's.Rul |
| 2bae0 | 65 2c 20 74 68 65 20 69 6e 74 65 67 72 61 6c 20 6f 66 20 61 20 66 75 6e 63 74 69 6f 6e 20 66 20 | e,.the.integral.of.a.function.f. |
| 2bb00 | 62 65 74 77 65 65 6e 20 61 20 61 6e 64 20 62 20 69 73 0a 20 20 20 20 20 61 70 70 72 6f 78 69 6d | between.a.and.b.is......approxim |
| 2bb20 | 61 74 65 64 20 61 73 0a 0a 20 20 20 20 20 20 20 20 20 20 68 0a 20 20 20 20 20 20 20 20 20 20 2d | ated.as............h...........- |
| 2bb40 | 20 28 79 5f 30 20 2b 20 34 79 5f 31 20 2b 20 32 79 5f 32 20 2b 20 34 79 5f 33 20 2b 20 32 79 5f | .(y_0.+.4y_1.+.2y_2.+.4y_3.+.2y_ |
| 2bb60 | 34 20 2b 20 2e 2e 2e 20 2b 20 32 79 5f 28 6e 2d 32 29 20 2b 20 34 79 5f 28 6e 2d 31 29 20 2b 20 | 4.+.....+.2y_(n-2).+.4y_(n-1).+. |
| 2bb80 | 79 5f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 33 0a 0a 20 20 20 20 20 77 68 65 72 65 20 68 20 3d | y_n)...........3.......where.h.= |
| 2bba0 | 20 28 62 20 2d 20 61 29 2f 6e 2c 20 66 6f 72 20 73 6f 6d 65 20 65 76 65 6e 20 69 6e 74 65 67 65 | .(b.-.a)/n,.for.some.even.intege |
| 2bbc0 | 72 20 6e 2c 20 61 6e 64 20 79 5f 6b 20 3d 20 66 28 61 20 2b 20 6b 68 29 2e 0a 20 20 20 20 20 28 | r.n,.and.y_k.=.f(a.+.kh).......( |
| 2bbe0 | 49 6e 63 72 65 61 73 69 6e 67 20 6e 20 69 6e 63 72 65 61 73 65 73 20 74 68 65 20 61 63 63 75 72 | Increasing.n.increases.the.accur |
| 2bc00 | 61 63 79 20 6f 66 20 74 68 65 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 2e 29 0a 20 20 20 20 20 | acy.of.the.approximation.)...... |
| 2bc20 | 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 | Define.a.procedure.that.takes.as |
| 2bc40 | 20 61 72 67 75 6d 65 6e 74 73 20 66 2c 20 61 2c 20 62 2c 20 61 6e 64 20 6e 20 61 6e 64 0a 20 20 | .arguments.f,.a,.b,.and.n.and... |
| 2bc60 | 20 20 20 72 65 74 75 72 6e 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 69 6e 74 65 | ...returns.the.value.of.the.inte |
| 2bc80 | 67 72 61 6c 2c 20 63 6f 6d 70 75 74 65 64 20 75 73 69 6e 67 20 53 69 6d 70 73 6f 6e 27 73 20 52 | gral,.computed.using.Simpson's.R |
| 2bca0 | 75 6c 65 2e 0a 20 20 20 20 20 55 73 65 20 79 6f 75 72 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 | ule.......Use.your.procedure.to. |
| 2bcc0 | 69 6e 74 65 67 72 61 74 65 20 60 63 75 62 65 27 20 62 65 74 77 65 65 6e 20 30 20 61 6e 64 20 31 | integrate.`cube'.between.0.and.1 |
| 2bce0 | 20 28 77 69 74 68 20 6e 20 3d 0a 20 20 20 20 20 31 30 30 20 61 6e 64 20 6e 20 3d 20 31 30 30 30 | .(with.n.=......100.and.n.=.1000 |
| 2bd00 | 29 2c 20 61 6e 64 20 63 6f 6d 70 61 72 65 20 74 68 65 20 72 65 73 75 6c 74 73 20 74 6f 20 74 68 | ),.and.compare.the.results.to.th |
| 2bd20 | 6f 73 65 20 6f 66 20 74 68 65 0a 20 20 20 20 20 60 69 6e 74 65 67 72 61 6c 27 20 70 72 6f 63 65 | ose.of.the......`integral'.proce |
| 2bd40 | 64 75 72 65 20 73 68 6f 77 6e 20 61 62 6f 76 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | dure.shown.above........*Exercis |
| 2bd60 | 65 20 31 2e 33 30 3a 2a 20 54 68 65 20 60 73 75 6d 27 20 70 72 6f 63 65 64 75 72 65 20 61 62 6f | e.1.30:*.The.`sum'.procedure.abo |
| 2bd80 | 76 65 20 67 65 6e 65 72 61 74 65 73 20 61 20 6c 69 6e 65 61 72 0a 20 20 20 20 20 72 65 63 75 72 | ve.generates.a.linear......recur |
| 2bda0 | 73 69 6f 6e 2e 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 63 61 6e 20 62 65 20 72 65 77 72 | sion...The.procedure.can.be.rewr |
| 2bdc0 | 69 74 74 65 6e 20 73 6f 20 74 68 61 74 20 74 68 65 20 73 75 6d 20 69 73 0a 20 20 20 20 20 70 65 | itten.so.that.the.sum.is......pe |
| 2bde0 | 72 66 6f 72 6d 65 64 20 69 74 65 72 61 74 69 76 65 6c 79 2e 20 20 53 68 6f 77 20 68 6f 77 20 74 | rformed.iteratively...Show.how.t |
| 2be00 | 6f 20 64 6f 20 74 68 69 73 20 62 79 20 66 69 6c 6c 69 6e 67 20 69 6e 20 74 68 65 0a 20 20 20 20 | o.do.this.by.filling.in.the..... |
| 2be20 | 20 6d 69 73 73 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 66 6f 6c 6c | .missing.expressions.in.the.foll |
| 2be40 | 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | owing.definition:............(de |
| 2be60 | 66 69 6e 65 20 28 73 75 6d 20 74 65 72 6d 20 61 20 6e 65 78 74 20 62 29 0a 20 20 20 20 20 20 20 | fine.(sum.term.a.next.b)........ |
| 2be80 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 20 61 20 72 65 73 75 6c 74 29 0a 20 20 20 | .....(define.(iter.a.result).... |
| 2bea0 | 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 3c 3f 3f 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ...........(if.<??>............. |
| 2bec0 | 20 20 20 20 20 20 3c 3f 3f 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 | ......<??>...................(it |
| 2bee0 | 65 72 20 3c 3f 3f 3e 20 3c 3f 3f 3e 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 | er.<??>.<??>))).............(ite |
| 2bf00 | 72 20 3c 3f 3f 3e 20 3c 3f 3f 3e 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e | r.<??>.<??>)).......*Exercise.1. |
| 2bf20 | 33 31 3a 2a 0a 20 20 20 20 20 20 20 61 2e 20 54 68 65 20 60 73 75 6d 27 20 70 72 6f 63 65 64 75 | 31:*........a..The.`sum'.procedu |
| 2bf40 | 72 65 20 69 73 20 6f 6e 6c 79 20 74 68 65 20 73 69 6d 70 6c 65 73 74 20 6f 66 20 61 20 76 61 73 | re.is.only.the.simplest.of.a.vas |
| 2bf60 | 74 20 6e 75 6d 62 65 72 20 6f 66 0a 20 20 20 20 20 20 20 20 20 20 73 69 6d 69 6c 61 72 20 61 62 | t.number.of...........similar.ab |
| 2bf80 | 73 74 72 61 63 74 69 6f 6e 73 20 74 68 61 74 20 63 61 6e 20 62 65 20 63 61 70 74 75 72 65 64 20 | stractions.that.can.be.captured. |
| 2bfa0 | 61 73 20 68 69 67 68 65 72 2d 6f 72 64 65 72 0a 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 64 | as.higher-order...........proced |
| 2bfc0 | 75 72 65 73 2e 28 33 29 20 20 57 72 69 74 65 20 61 6e 20 61 6e 61 6c 6f 67 6f 75 73 20 70 72 6f | ures.(3)..Write.an.analogous.pro |
| 2bfe0 | 63 65 64 75 72 65 20 63 61 6c 6c 65 64 20 60 70 72 6f 64 75 63 74 27 0a 20 20 20 20 20 20 20 20 | cedure.called.`product'......... |
| 2c000 | 20 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 70 72 6f 64 75 63 74 20 6f 66 20 74 68 | ..that.returns.the.product.of.th |
| 2c020 | 65 20 76 61 6c 75 65 73 20 6f 66 20 61 20 66 75 6e 63 74 69 6f 6e 20 61 74 0a 20 20 20 20 20 20 | e.values.of.a.function.at....... |
| 2c040 | 20 20 20 20 70 6f 69 6e 74 73 20 6f 76 65 72 20 61 20 67 69 76 65 6e 20 72 61 6e 67 65 2e 20 20 | ....points.over.a.given.range... |
| 2c060 | 53 68 6f 77 20 68 6f 77 20 74 6f 20 64 65 66 69 6e 65 20 60 66 61 63 74 6f 72 69 61 6c 27 20 69 | Show.how.to.define.`factorial'.i |
| 2c080 | 6e 0a 20 20 20 20 20 20 20 20 20 20 74 65 72 6d 73 20 6f 66 20 60 70 72 6f 64 75 63 74 27 2e 20 | n...........terms.of.`product'.. |
| 2c0a0 | 20 41 6c 73 6f 20 75 73 65 20 60 70 72 6f 64 75 63 74 27 20 74 6f 20 63 6f 6d 70 75 74 65 0a 20 | .Also.use.`product'.to.compute.. |
| 2c0c0 | 20 20 20 20 20 20 20 20 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 74 6f 20 5b 70 69 5d 20 | .........approximations.to.[pi]. |
| 2c0e0 | 75 73 69 6e 67 20 74 68 65 20 66 6f 72 6d 75 6c 61 28 34 29 0a 0a 20 20 20 20 20 20 20 20 20 20 | using.the.formula(4)............ |
| 2c100 | 20 20 20 20 20 70 69 20 20 20 32 20 2a 20 34 20 2a 20 34 20 2a 20 36 20 2a 20 36 20 2a 20 38 20 | .....pi...2.*.4.*.4.*.6.*.6.*.8. |
| 2c120 | 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 3d 20 2d 2d 2d 2d 2d 2d 2d 2d | ...................--.=.-------- |
| 2c140 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -----------------............... |
| 2c160 | 20 20 34 20 20 20 33 20 2a 20 33 20 2a 20 35 20 2a 20 35 20 2a 20 37 20 2a 20 37 20 2e 2e 2e 0a | ..4...3.*.3.*.5.*.5.*.7.*.7..... |
| 2c180 | 0a 20 20 20 20 20 20 20 62 2e 20 49 66 20 79 6f 75 72 20 60 70 72 6f 64 75 63 74 27 20 70 72 6f | ........b..If.your.`product'.pro |
| 2c1a0 | 63 65 64 75 72 65 20 67 65 6e 65 72 61 74 65 73 20 61 20 72 65 63 75 72 73 69 76 65 20 70 72 6f | cedure.generates.a.recursive.pro |
| 2c1c0 | 63 65 73 73 2c 0a 20 20 20 20 20 20 20 20 20 20 77 72 69 74 65 20 6f 6e 65 20 74 68 61 74 20 67 | cess,...........write.one.that.g |
| 2c1e0 | 65 6e 65 72 61 74 65 73 20 61 6e 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 2e 20 20 | enerates.an.iterative.process... |
| 2c200 | 49 66 20 69 74 0a 20 20 20 20 20 20 20 20 20 20 67 65 6e 65 72 61 74 65 73 20 61 6e 20 69 74 65 | If.it...........generates.an.ite |
| 2c220 | 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 2c 20 77 72 69 74 65 20 6f 6e 65 20 74 68 61 74 20 67 | rative.process,.write.one.that.g |
| 2c240 | 65 6e 65 72 61 74 65 73 20 61 0a 20 20 20 20 20 20 20 20 20 20 72 65 63 75 72 73 69 76 65 20 70 | enerates.a...........recursive.p |
| 2c260 | 72 6f 63 65 73 73 2e 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 33 32 3a 2a 0a | rocess.........*Exercise.1.32:*. |
| 2c280 | 20 20 20 20 20 20 20 61 2e 20 53 68 6f 77 20 74 68 61 74 20 60 73 75 6d 27 20 61 6e 64 20 60 70 | .......a..Show.that.`sum'.and.`p |
| 2c2a0 | 72 6f 64 75 63 74 27 20 28 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 33 31 3a 3a 29 20 | roduct'.(*Note.Exercise.1-31::). |
| 2c2c0 | 61 72 65 0a 20 20 20 20 20 20 20 20 20 20 62 6f 74 68 20 73 70 65 63 69 61 6c 20 63 61 73 65 73 | are...........both.special.cases |
| 2c2e0 | 20 6f 66 20 61 20 73 74 69 6c 6c 20 6d 6f 72 65 20 67 65 6e 65 72 61 6c 20 6e 6f 74 69 6f 6e 20 | .of.a.still.more.general.notion. |
| 2c300 | 63 61 6c 6c 65 64 0a 20 20 20 20 20 20 20 20 20 20 60 61 63 63 75 6d 75 6c 61 74 65 27 20 74 68 | called...........`accumulate'.th |
| 2c320 | 61 74 20 63 6f 6d 62 69 6e 65 73 20 61 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 74 65 72 6d | at.combines.a.collection.of.term |
| 2c340 | 73 2c 20 75 73 69 6e 67 20 73 6f 6d 65 0a 20 20 20 20 20 20 20 20 20 20 67 65 6e 65 72 61 6c 20 | s,.using.some...........general. |
| 2c360 | 61 63 63 75 6d 75 6c 61 74 69 6f 6e 20 66 75 6e 63 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 20 20 20 | accumulation.function:.......... |
| 2c380 | 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 63 6f 6d 62 69 6e 65 72 20 6e 75 6c 6c | .......(accumulate.combiner.null |
| 2c3a0 | 2d 76 61 6c 75 65 20 74 65 72 6d 20 61 20 6e 65 78 74 20 62 29 0a 0a 20 20 20 20 20 20 20 20 20 | -value.term.a.next.b)........... |
| 2c3c0 | 20 60 41 63 63 75 6d 75 6c 61 74 65 27 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 | .`Accumulate'.takes.as.arguments |
| 2c3e0 | 20 74 68 65 20 73 61 6d 65 20 74 65 72 6d 20 61 6e 64 20 72 61 6e 67 65 0a 20 20 20 20 20 20 20 | .the.same.term.and.range........ |
| 2c400 | 20 20 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 73 20 61 73 20 60 73 75 6d 27 20 61 6e 64 20 60 | ...specifications.as.`sum'.and.` |
| 2c420 | 70 72 6f 64 75 63 74 27 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 0a 20 20 20 20 20 20 | product',.together.with.a....... |
| 2c440 | 20 20 20 20 60 63 6f 6d 62 69 6e 65 72 27 20 70 72 6f 63 65 64 75 72 65 20 28 6f 66 20 74 77 6f | ....`combiner'.procedure.(of.two |
| 2c460 | 20 61 72 67 75 6d 65 6e 74 73 29 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 68 6f 77 0a 20 | .arguments).that.specifies.how.. |
| 2c480 | 20 20 20 20 20 20 20 20 20 74 68 65 20 63 75 72 72 65 6e 74 20 74 65 72 6d 20 69 73 20 74 6f 20 | .........the.current.term.is.to. |
| 2c4a0 | 62 65 20 63 6f 6d 62 69 6e 65 64 20 77 69 74 68 20 74 68 65 20 61 63 63 75 6d 75 6c 61 74 69 6f | be.combined.with.the.accumulatio |
| 2c4c0 | 6e 20 6f 66 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 20 70 72 65 63 65 64 69 6e 67 20 74 65 72 | n.of...........the.preceding.ter |
| 2c4e0 | 6d 73 20 61 6e 64 20 61 20 60 6e 75 6c 6c 2d 76 61 6c 75 65 27 20 74 68 61 74 20 73 70 65 63 69 | ms.and.a.`null-value'.that.speci |
| 2c500 | 66 69 65 73 20 77 68 61 74 0a 20 20 20 20 20 20 20 20 20 20 62 61 73 65 20 76 61 6c 75 65 20 74 | fies.what...........base.value.t |
| 2c520 | 6f 20 75 73 65 20 77 68 65 6e 20 74 68 65 20 74 65 72 6d 73 20 72 75 6e 20 6f 75 74 2e 20 20 57 | o.use.when.the.terms.run.out...W |
| 2c540 | 72 69 74 65 20 60 61 63 63 75 6d 75 6c 61 74 65 27 0a 20 20 20 20 20 20 20 20 20 20 61 6e 64 20 | rite.`accumulate'...........and. |
| 2c560 | 73 68 6f 77 20 68 6f 77 20 60 73 75 6d 27 20 61 6e 64 20 60 70 72 6f 64 75 63 74 27 20 63 61 6e | show.how.`sum'.and.`product'.can |
| 2c580 | 20 62 6f 74 68 20 62 65 20 64 65 66 69 6e 65 64 20 61 73 0a 20 20 20 20 20 20 20 20 20 20 73 69 | .both.be.defined.as...........si |
| 2c5a0 | 6d 70 6c 65 20 63 61 6c 6c 73 20 74 6f 20 60 61 63 63 75 6d 75 6c 61 74 65 27 2e 0a 0a 20 20 20 | mple.calls.to.`accumulate'...... |
| 2c5c0 | 20 20 20 20 62 2e 20 49 66 20 79 6f 75 72 20 60 61 63 63 75 6d 75 6c 61 74 65 27 20 70 72 6f 63 | ....b..If.your.`accumulate'.proc |
| 2c5e0 | 65 64 75 72 65 20 67 65 6e 65 72 61 74 65 73 20 61 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 | edure.generates.a.recursive.proc |
| 2c600 | 65 73 73 2c 0a 20 20 20 20 20 20 20 20 20 20 77 72 69 74 65 20 6f 6e 65 20 74 68 61 74 20 67 65 | ess,...........write.one.that.ge |
| 2c620 | 6e 65 72 61 74 65 73 20 61 6e 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 2e 20 20 49 | nerates.an.iterative.process...I |
| 2c640 | 66 20 69 74 0a 20 20 20 20 20 20 20 20 20 20 67 65 6e 65 72 61 74 65 73 20 61 6e 20 69 74 65 72 | f.it...........generates.an.iter |
| 2c660 | 61 74 69 76 65 20 70 72 6f 63 65 73 73 2c 20 77 72 69 74 65 20 6f 6e 65 20 74 68 61 74 20 67 65 | ative.process,.write.one.that.ge |
| 2c680 | 6e 65 72 61 74 65 73 20 61 0a 20 20 20 20 20 20 20 20 20 20 72 65 63 75 72 73 69 76 65 20 70 72 | nerates.a...........recursive.pr |
| 2c6a0 | 6f 63 65 73 73 2e 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 33 33 3a 2a 20 59 | ocess.........*Exercise.1.33:*.Y |
| 2c6c0 | 6f 75 20 63 61 6e 20 6f 62 74 61 69 6e 20 61 6e 20 65 76 65 6e 20 6d 6f 72 65 20 67 65 6e 65 72 | ou.can.obtain.an.even.more.gener |
| 2c6e0 | 61 6c 20 76 65 72 73 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 61 63 63 75 6d 75 6c 61 74 65 27 20 | al.version.of......`accumulate'. |
| 2c700 | 28 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 33 32 3a 3a 29 20 62 79 20 69 6e 74 72 6f | (*Note.Exercise.1-32::).by.intro |
| 2c720 | 64 75 63 69 6e 67 20 74 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 61 20 22 66 69 6c | ducing.the.notion.of......a."fil |
| 2c740 | 74 65 72 22 20 6f 6e 20 74 68 65 20 74 65 72 6d 73 20 74 6f 20 62 65 20 63 6f 6d 62 69 6e 65 64 | ter".on.the.terms.to.be.combined |
| 2c760 | 2e 20 20 54 68 61 74 20 69 73 2c 20 63 6f 6d 62 69 6e 65 20 6f 6e 6c 79 0a 20 20 20 20 20 74 68 | ...That.is,.combine.only......th |
| 2c780 | 6f 73 65 20 74 65 72 6d 73 20 64 65 72 69 76 65 64 20 66 72 6f 6d 20 76 61 6c 75 65 73 20 69 6e | ose.terms.derived.from.values.in |
| 2c7a0 | 20 74 68 65 20 72 61 6e 67 65 20 74 68 61 74 20 73 61 74 69 73 66 79 20 61 0a 20 20 20 20 20 73 | .the.range.that.satisfy.a......s |
| 2c7c0 | 70 65 63 69 66 69 65 64 20 63 6f 6e 64 69 74 69 6f 6e 2e 20 20 54 68 65 20 72 65 73 75 6c 74 69 | pecified.condition...The.resulti |
| 2c7e0 | 6e 67 20 60 66 69 6c 74 65 72 65 64 2d 61 63 63 75 6d 75 6c 61 74 65 27 0a 20 20 20 20 20 61 62 | ng.`filtered-accumulate'......ab |
| 2c800 | 73 74 72 61 63 74 69 6f 6e 20 74 61 6b 65 73 20 74 68 65 20 73 61 6d 65 20 61 72 67 75 6d 65 6e | straction.takes.the.same.argumen |
| 2c820 | 74 73 20 61 73 20 61 63 63 75 6d 75 6c 61 74 65 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 0a | ts.as.accumulate,.together.with. |
| 2c840 | 20 20 20 20 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 6c 20 70 72 65 64 69 63 61 74 65 20 6f 66 20 | .....an.additional.predicate.of. |
| 2c860 | 6f 6e 65 20 61 72 67 75 6d 65 6e 74 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 74 68 65 20 | one.argument.that.specifies.the. |
| 2c880 | 66 69 6c 74 65 72 2e 0a 20 20 20 20 20 57 72 69 74 65 20 60 66 69 6c 74 65 72 65 64 2d 61 63 63 | filter.......Write.`filtered-acc |
| 2c8a0 | 75 6d 75 6c 61 74 65 27 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 2e 20 20 53 68 6f 77 20 68 | umulate'.as.a.procedure...Show.h |
| 2c8c0 | 6f 77 20 74 6f 20 65 78 70 72 65 73 73 0a 20 20 20 20 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 | ow.to.express......the.following |
| 2c8e0 | 20 75 73 69 6e 67 20 60 66 69 6c 74 65 72 65 64 2d 61 63 63 75 6d 75 6c 61 74 65 27 3a 0a 0a 20 | .using.`filtered-accumulate':... |
| 2c900 | 20 20 20 20 20 20 61 2e 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 73 71 75 61 72 65 73 20 | ......a..the.sum.of.the.squares. |
| 2c920 | 6f 66 20 74 68 65 20 70 72 69 6d 65 20 6e 75 6d 62 65 72 73 20 69 6e 20 74 68 65 20 69 6e 74 65 | of.the.prime.numbers.in.the.inte |
| 2c940 | 72 76 61 6c 20 61 0a 20 20 20 20 20 20 20 20 20 20 74 6f 20 62 20 28 61 73 73 75 6d 69 6e 67 20 | rval.a...........to.b.(assuming. |
| 2c960 | 74 68 61 74 20 79 6f 75 20 68 61 76 65 20 61 20 60 70 72 69 6d 65 3f 27 20 70 72 65 64 69 63 61 | that.you.have.a.`prime?'.predica |
| 2c980 | 74 65 20 61 6c 72 65 61 64 79 0a 20 20 20 20 20 20 20 20 20 20 77 72 69 74 74 65 6e 29 0a 0a 20 | te.already...........written)... |
| 2c9a0 | 20 20 20 20 20 20 62 2e 20 74 68 65 20 70 72 6f 64 75 63 74 20 6f 66 20 61 6c 6c 20 74 68 65 20 | ......b..the.product.of.all.the. |
| 2c9c0 | 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 73 20 6c 65 73 73 20 74 68 61 6e 20 6e 20 74 68 | positive.integers.less.than.n.th |
| 2c9e0 | 61 74 20 61 72 65 0a 20 20 20 20 20 20 20 20 20 20 72 65 6c 61 74 69 76 65 6c 79 20 70 72 69 6d | at.are...........relatively.prim |
| 2ca00 | 65 20 74 6f 20 6e 20 28 69 2e 65 2e 2c 20 61 6c 6c 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 | e.to.n.(i.e.,.all.positive.integ |
| 2ca20 | 65 72 73 20 69 20 3c 20 6e 20 73 75 63 68 0a 20 20 20 20 20 20 20 20 20 20 74 68 61 74 20 47 43 | ers.i.<.n.such...........that.GC |
| 2ca40 | 44 28 69 2c 6e 29 20 3d 20 31 29 2e 0a 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f | D(i,n).=.1).......----------.Foo |
| 2ca60 | 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 69 73 20 73 | tnotes.----------.....(1).This.s |
| 2ca80 | 65 72 69 65 73 2c 20 75 73 75 61 6c 6c 79 20 77 72 69 74 74 65 6e 20 69 6e 20 74 68 65 20 65 71 | eries,.usually.written.in.the.eq |
| 2caa0 | 75 69 76 61 6c 65 6e 74 20 66 6f 72 6d 20 28 5b 70 69 5d 2f 34 29 20 3d 20 31 0a 2d 20 28 31 2f | uivalent.form.([pi]/4).=.1.-.(1/ |
| 2cac0 | 33 29 20 2b 20 28 31 2f 35 29 20 2d 20 28 31 2f 37 29 20 2b 20 2e 2e 2e 2c 20 69 73 20 64 75 65 | 3).+.(1/5).-.(1/7).+....,.is.due |
| 2cae0 | 20 74 6f 20 4c 65 69 62 6e 69 7a 2e 20 20 57 65 27 6c 6c 20 73 65 65 20 68 6f 77 20 74 6f 20 75 | .to.Leibniz...We'll.see.how.to.u |
| 2cb00 | 73 65 0a 74 68 69 73 20 61 73 20 74 68 65 20 62 61 73 69 73 20 66 6f 72 20 73 6f 6d 65 20 66 61 | se.this.as.the.basis.for.some.fa |
| 2cb20 | 6e 63 79 20 6e 75 6d 65 72 69 63 61 6c 20 74 72 69 63 6b 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 | ncy.numerical.tricks.in.section. |
| 2cb40 | 2a 4e 6f 74 65 0a 33 2d 35 2d 33 3a 3a 2e 0a 0a 20 20 20 28 32 29 20 4e 6f 74 69 63 65 20 74 68 | *Note.3-5-3::......(2).Notice.th |
| 2cb60 | 61 74 20 77 65 20 68 61 76 65 20 75 73 65 64 20 62 6c 6f 63 6b 20 73 74 72 75 63 74 75 72 65 20 | at.we.have.used.block.structure. |
| 2cb80 | 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 38 3a 3a 29 0a 74 6f 20 65 6d 62 65 64 | (section.*Note.1-1-8::).to.embed |
| 2cba0 | 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 60 70 69 2d 6e 65 78 74 27 20 61 6e | .the.definitions.of.`pi-next'.an |
| 2cbc0 | 64 20 60 70 69 2d 74 65 72 6d 27 20 77 69 74 68 69 6e 20 60 70 69 2d 73 75 6d 27 2c 0a 73 69 6e | d.`pi-term'.within.`pi-sum',.sin |
| 2cbe0 | 63 65 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 75 6e 6c 69 6b 65 6c 79 | ce.these.procedures.are.unlikely |
| 2cc00 | 20 74 6f 20 62 65 20 75 73 65 66 75 6c 20 66 6f 72 20 61 6e 79 20 6f 74 68 65 72 20 70 75 72 70 | .to.be.useful.for.any.other.purp |
| 2cc20 | 6f 73 65 2e 0a 57 65 20 77 69 6c 6c 20 73 65 65 20 68 6f 77 20 74 6f 20 67 65 74 20 72 69 64 20 | ose..We.will.see.how.to.get.rid. |
| 2cc40 | 6f 66 20 74 68 65 6d 20 61 6c 74 6f 67 65 74 68 65 72 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e | of.them.altogether.in.section.*N |
| 2cc60 | 6f 74 65 20 31 2d 33 2d 32 3a 3a 2e 0a 0a 20 20 20 28 33 29 20 54 68 65 20 69 6e 74 65 6e 74 20 | ote.1-3-2::......(3).The.intent. |
| 2cc80 | 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 33 31 3a 3a 20 74 68 72 6f 75 67 68 | of.*Note.Exercise.1-31::.through |
| 2cca0 | 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 31 2d 33 33 3a 3a 20 69 73 20 74 6f 20 64 65 6d | .*Note.Exercise.1-33::.is.to.dem |
| 2ccc0 | 6f 6e 73 74 72 61 74 65 20 74 68 65 20 65 78 70 72 65 73 73 69 76 65 20 70 6f 77 65 72 20 74 68 | onstrate.the.expressive.power.th |
| 2cce0 | 61 74 20 69 73 20 61 74 74 61 69 6e 65 64 20 62 79 20 75 73 69 6e 67 0a 61 6e 20 61 70 70 72 6f | at.is.attained.by.using.an.appro |
| 2cd00 | 70 72 69 61 74 65 20 61 62 73 74 72 61 63 74 69 6f 6e 20 74 6f 20 63 6f 6e 73 6f 6c 69 64 61 74 | priate.abstraction.to.consolidat |
| 2cd20 | 65 20 6d 61 6e 79 20 73 65 65 6d 69 6e 67 6c 79 20 64 69 73 70 61 72 61 74 65 0a 6f 70 65 72 61 | e.many.seemingly.disparate.opera |
| 2cd40 | 74 69 6f 6e 73 2e 20 20 48 6f 77 65 76 65 72 2c 20 74 68 6f 75 67 68 20 61 63 63 75 6d 75 6c 61 | tions...However,.though.accumula |
| 2cd60 | 74 69 6f 6e 20 61 6e 64 20 66 69 6c 74 65 72 69 6e 67 20 61 72 65 20 65 6c 65 67 61 6e 74 0a 69 | tion.and.filtering.are.elegant.i |
| 2cd80 | 64 65 61 73 2c 20 6f 75 72 20 68 61 6e 64 73 20 61 72 65 20 73 6f 6d 65 77 68 61 74 20 74 69 65 | deas,.our.hands.are.somewhat.tie |
| 2cda0 | 64 20 69 6e 20 75 73 69 6e 67 20 74 68 65 6d 20 61 74 20 74 68 69 73 20 70 6f 69 6e 74 20 73 69 | d.in.using.them.at.this.point.si |
| 2cdc0 | 6e 63 65 20 77 65 0a 64 6f 20 6e 6f 74 20 79 65 74 20 68 61 76 65 20 64 61 74 61 20 73 74 72 75 | nce.we.do.not.yet.have.data.stru |
| 2cde0 | 63 74 75 72 65 73 20 74 6f 20 70 72 6f 76 69 64 65 20 73 75 69 74 61 62 6c 65 20 6d 65 61 6e 73 | ctures.to.provide.suitable.means |
| 2ce00 | 20 6f 66 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 73 65 20 61 62 73 74 72 61 | .of.combination.for.these.abstra |
| 2ce20 | 63 74 69 6f 6e 73 2e 20 20 57 65 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 6f 20 74 68 65 73 65 | ctions...We.will.return.to.these |
| 2ce40 | 20 69 64 65 61 73 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 20 | .ideas.in.section.*Note.2-2-3::. |
| 2ce60 | 77 68 65 6e 20 77 65 20 73 68 6f 77 20 68 6f 77 20 74 6f 20 75 73 65 20 22 73 65 71 75 65 6e 63 | when.we.show.how.to.use."sequenc |
| 2ce80 | 65 73 22 20 61 73 20 69 6e 74 65 72 66 61 63 65 73 0a 66 6f 72 20 63 6f 6d 62 69 6e 69 6e 67 20 | es".as.interfaces.for.combining. |
| 2cea0 | 66 69 6c 74 65 72 73 20 61 6e 64 20 61 63 63 75 6d 75 6c 61 74 6f 72 73 20 74 6f 20 62 75 69 6c | filters.and.accumulators.to.buil |
| 2cec0 | 64 20 65 76 65 6e 20 6d 6f 72 65 20 70 6f 77 65 72 66 75 6c 0a 61 62 73 74 72 61 63 74 69 6f 6e | d.even.more.powerful.abstraction |
| 2cee0 | 73 2e 20 20 57 65 20 77 69 6c 6c 20 73 65 65 20 74 68 65 72 65 20 68 6f 77 20 74 68 65 73 65 20 | s...We.will.see.there.how.these. |
| 2cf00 | 6d 65 74 68 6f 64 73 20 72 65 61 6c 6c 79 20 63 6f 6d 65 20 69 6e 74 6f 0a 74 68 65 69 72 20 6f | methods.really.come.into.their.o |
| 2cf20 | 77 6e 20 61 73 20 61 20 70 6f 77 65 72 66 75 6c 20 61 6e 64 20 65 6c 65 67 61 6e 74 20 61 70 70 | wn.as.a.powerful.and.elegant.app |
| 2cf40 | 72 6f 61 63 68 20 74 6f 20 64 65 73 69 67 6e 69 6e 67 20 70 72 6f 67 72 61 6d 73 2e 0a 0a 20 20 | roach.to.designing.programs..... |
| 2cf60 | 20 28 34 29 20 54 68 69 73 20 66 6f 72 6d 75 6c 61 20 77 61 73 20 64 69 73 63 6f 76 65 72 65 64 | .(4).This.formula.was.discovered |
| 2cf80 | 20 62 79 20 74 68 65 20 73 65 76 65 6e 74 65 65 6e 74 68 2d 63 65 6e 74 75 72 79 20 45 6e 67 6c | .by.the.seventeenth-century.Engl |
| 2cfa0 | 69 73 68 0a 6d 61 74 68 65 6d 61 74 69 63 69 61 6e 20 4a 6f 68 6e 20 57 61 6c 6c 69 73 2e 0a 0a | ish.mathematician.John.Wallis... |
| 2cfc0 | 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 33 2d 32 2c | ..File:.sicp.info,..Node:.1-3-2, |
| 2cfe0 | 20 20 4e 65 78 74 3a 20 31 2d 33 2d 33 2c 20 20 50 72 65 76 3a 20 31 2d 33 2d 31 2c 20 20 55 70 | ..Next:.1-3-3,..Prev:.1-3-1,..Up |
| 2d000 | 3a 20 31 2d 33 0a 0a 31 2e 33 2e 32 20 43 6f 6e 73 74 72 75 63 74 69 6e 67 20 50 72 6f 63 65 64 | :.1-3..1.3.2.Constructing.Proced |
| 2d020 | 75 72 65 73 20 55 73 69 6e 67 20 60 4c 61 6d 62 64 61 27 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ures.Using.`Lambda'.------------ |
| 2d040 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 2d060 | 0a 0a 49 6e 20 75 73 69 6e 67 20 60 73 75 6d 27 20 61 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a | ..In.using.`sum'.as.in.section.* |
| 2d080 | 4e 6f 74 65 20 31 2d 33 2d 31 3a 3a 2c 20 69 74 20 73 65 65 6d 73 20 74 65 72 72 69 62 6c 79 20 | Note.1-3-1::,.it.seems.terribly. |
| 2d0a0 | 61 77 6b 77 61 72 64 20 74 6f 0a 68 61 76 65 20 74 6f 20 64 65 66 69 6e 65 20 74 72 69 76 69 61 | awkward.to.have.to.define.trivia |
| 2d0c0 | 6c 20 70 72 6f 63 65 64 75 72 65 73 20 73 75 63 68 20 61 73 20 60 70 69 2d 74 65 72 6d 27 20 61 | l.procedures.such.as.`pi-term'.a |
| 2d0e0 | 6e 64 20 60 70 69 2d 6e 65 78 74 27 20 6a 75 73 74 0a 73 6f 20 77 65 20 63 61 6e 20 75 73 65 20 | nd.`pi-next'.just.so.we.can.use. |
| 2d100 | 74 68 65 6d 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 6f 75 72 20 68 69 67 68 65 72 2d | them.as.arguments.to.our.higher- |
| 2d120 | 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 2e 20 20 52 61 74 68 65 72 0a 74 68 61 6e 20 64 65 | order.procedure...Rather.than.de |
| 2d140 | 66 69 6e 65 20 60 70 69 2d 6e 65 78 74 27 20 61 6e 64 20 60 70 69 2d 74 65 72 6d 27 2c 20 69 74 | fine.`pi-next'.and.`pi-term',.it |
| 2d160 | 20 77 6f 75 6c 64 20 62 65 20 6d 6f 72 65 20 63 6f 6e 76 65 6e 69 65 6e 74 20 74 6f 0a 68 61 76 | .would.be.more.convenient.to.hav |
| 2d180 | 65 20 61 20 77 61 79 20 74 6f 20 64 69 72 65 63 74 6c 79 20 73 70 65 63 69 66 79 20 22 74 68 65 | e.a.way.to.directly.specify."the |
| 2d1a0 | 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 69 74 73 20 69 6e 70 75 | .procedure.that.returns.its.inpu |
| 2d1c0 | 74 0a 69 6e 63 72 65 6d 65 6e 74 65 64 20 62 79 20 34 22 20 61 6e 64 20 22 74 68 65 20 70 72 6f | t.incremented.by.4".and."the.pro |
| 2d1e0 | 63 65 64 75 72 65 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 72 65 63 69 70 72 6f 63 | cedure.that.returns.the.reciproc |
| 2d200 | 61 6c 20 6f 66 20 69 74 73 0a 69 6e 70 75 74 20 74 69 6d 65 73 20 69 74 73 20 69 6e 70 75 74 20 | al.of.its.input.times.its.input. |
| 2d220 | 70 6c 75 73 20 32 2e 22 20 20 57 65 20 63 61 6e 20 64 6f 20 74 68 69 73 20 62 79 20 69 6e 74 72 | plus.2."..We.can.do.this.by.intr |
| 2d240 | 6f 64 75 63 69 6e 67 20 74 68 65 0a 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 60 6c 61 6d 62 64 61 | oducing.the.special.form.`lambda |
| 2d260 | 27 2c 20 77 68 69 63 68 20 63 72 65 61 74 65 73 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 55 73 | ',.which.creates.procedures...Us |
| 2d280 | 69 6e 67 20 60 6c 61 6d 62 64 61 27 20 77 65 20 63 61 6e 0a 64 65 73 63 72 69 62 65 20 77 68 61 | ing.`lambda'.we.can.describe.wha |
| 2d2a0 | 74 20 77 65 20 77 61 6e 74 20 61 73 0a 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 | t.we.want.as.......(lambda.(x).( |
| 2d2c0 | 2b 20 78 20 34 29 29 0a 0a 61 6e 64 0a 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 | +.x.4))..and.......(lambda.(x).( |
| 2d2e0 | 2f 20 31 2e 30 20 28 2a 20 78 20 28 2b 20 78 20 32 29 29 29 29 0a 0a 20 20 20 54 68 65 6e 20 6f | /.1.0.(*.x.(+.x.2)))).....Then.o |
| 2d300 | 75 72 20 60 70 69 2d 73 75 6d 27 20 70 72 6f 63 65 64 75 72 65 20 63 61 6e 20 62 65 20 65 78 70 | ur.`pi-sum'.procedure.can.be.exp |
| 2d320 | 72 65 73 73 65 64 20 77 69 74 68 6f 75 74 20 64 65 66 69 6e 69 6e 67 20 61 6e 79 0a 61 75 78 69 | ressed.without.defining.any.auxi |
| 2d340 | 6c 69 61 72 79 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | liary.procedures.as.......(defin |
| 2d360 | 65 20 28 70 69 2d 73 75 6d 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 73 75 6d 20 28 6c 61 6d 62 | e.(pi-sum.a.b)........(sum.(lamb |
| 2d380 | 64 61 20 28 78 29 20 28 2f 20 31 2e 30 20 28 2a 20 78 20 28 2b 20 78 20 32 29 29 29 29 0a 20 20 | da.(x).(/.1.0.(*.x.(+.x.2))))... |
| 2d3a0 | 20 20 20 20 20 20 20 20 20 20 61 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 | ..........a.............(lambda. |
| 2d3c0 | 28 78 29 20 28 2b 20 78 20 34 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 62 29 29 0a 0a 20 20 | (x).(+.x.4)).............b)).... |
| 2d3e0 | 20 41 67 61 69 6e 20 75 73 69 6e 67 20 60 6c 61 6d 62 64 61 27 2c 20 77 65 20 63 61 6e 20 77 72 | .Again.using.`lambda',.we.can.wr |
| 2d400 | 69 74 65 20 74 68 65 20 60 69 6e 74 65 67 72 61 6c 27 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 | ite.the.`integral'.procedure.wit |
| 2d420 | 68 6f 75 74 0a 68 61 76 69 6e 67 20 74 6f 20 64 65 66 69 6e 65 20 74 68 65 20 61 75 78 69 6c 69 | hout.having.to.define.the.auxili |
| 2d440 | 61 72 79 20 70 72 6f 63 65 64 75 72 65 20 60 61 64 64 2d 64 78 27 3a 0a 0a 20 20 20 20 20 28 64 | ary.procedure.`add-dx':.......(d |
| 2d460 | 65 66 69 6e 65 20 28 69 6e 74 65 67 72 61 6c 20 66 20 61 20 62 20 64 78 29 0a 20 20 20 20 20 20 | efine.(integral.f.a.b.dx)....... |
| 2d480 | 20 28 2a 20 28 73 75 6d 20 66 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 61 20 28 | .(*.(sum.f................(+.a.( |
| 2d4a0 | 2f 20 64 78 20 32 2e 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 | /.dx.2.0))................(lambd |
| 2d4c0 | 61 20 28 78 29 20 28 2b 20 78 20 64 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 | a.(x).(+.x.dx))................b |
| 2d4e0 | 29 0a 20 20 20 20 20 20 20 20 20 20 64 78 29 29 0a 0a 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c | )...........dx)).....In.general, |
| 2d500 | 20 60 6c 61 6d 62 64 61 27 20 69 73 20 75 73 65 64 20 74 6f 20 63 72 65 61 74 65 20 70 72 6f 63 | .`lambda'.is.used.to.create.proc |
| 2d520 | 65 64 75 72 65 73 20 69 6e 20 74 68 65 20 73 61 6d 65 20 77 61 79 20 61 73 0a 60 64 65 66 69 6e | edures.in.the.same.way.as.`defin |
| 2d540 | 65 27 2c 20 65 78 63 65 70 74 20 74 68 61 74 20 6e 6f 20 6e 61 6d 65 20 69 73 20 73 70 65 63 69 | e',.except.that.no.name.is.speci |
| 2d560 | 66 69 65 64 20 66 6f 72 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 6c | fied.for.the.procedure:.......(l |
| 2d580 | 61 6d 62 64 61 20 28 3c 46 4f 52 4d 41 4c 2d 50 41 52 41 4d 45 54 45 52 53 3e 29 20 3c 42 4f 44 | ambda.(<FORMAL-PARAMETERS>).<BOD |
| 2d5a0 | 59 3e 29 0a 0a 20 20 20 54 68 65 20 72 65 73 75 6c 74 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 | Y>).....The.resulting.procedure. |
| 2d5c0 | 69 73 20 6a 75 73 74 20 61 73 20 6d 75 63 68 20 61 20 70 72 6f 63 65 64 75 72 65 20 61 73 20 6f | is.just.as.much.a.procedure.as.o |
| 2d5e0 | 6e 65 20 74 68 61 74 20 69 73 0a 63 72 65 61 74 65 64 20 75 73 69 6e 67 20 60 64 65 66 69 6e 65 | ne.that.is.created.using.`define |
| 2d600 | 27 2e 20 20 54 68 65 20 6f 6e 6c 79 20 64 69 66 66 65 72 65 6e 63 65 20 69 73 20 74 68 61 74 20 | '...The.only.difference.is.that. |
| 2d620 | 69 74 20 68 61 73 20 6e 6f 74 20 62 65 65 6e 0a 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 | it.has.not.been.associated.with. |
| 2d640 | 61 6e 79 20 6e 61 6d 65 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 49 6e | any.name.in.the.environment...In |
| 2d660 | 20 66 61 63 74 2c 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 6c 75 73 34 20 78 29 20 28 | .fact,.......(define.(plus4.x).( |
| 2d680 | 2b 20 78 20 34 29 29 0a 0a 69 73 20 65 71 75 69 76 61 6c 65 6e 74 20 74 6f 0a 0a 20 20 20 20 20 | +.x.4))..is.equivalent.to....... |
| 2d6a0 | 28 64 65 66 69 6e 65 20 70 6c 75 73 34 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 2b 20 78 20 34 | (define.plus4.(lambda.(x).(+.x.4 |
| 2d6c0 | 29 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 72 65 61 64 20 61 20 60 6c 61 6d 62 64 61 27 20 65 | ))).....We.can.read.a.`lambda'.e |
| 2d6e0 | 78 70 72 65 73 73 69 6f 6e 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 6c 61 6d | xpression.as.follows:.......(lam |
| 2d700 | 62 64 61 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 78 29 20 20 20 20 20 | bda.....................(x)..... |
| 2d720 | 28 2b 20 20 20 78 20 20 20 20 20 34 29 29 0a 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 | (+...x.....4))..........|....... |
| 2d740 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 | .................|.......|...|.. |
| 2d760 | 20 20 20 7c 0a 20 20 20 20 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 61 6e 20 61 72 | ...|......the.procedure.of.an.ar |
| 2d780 | 67 75 6d 65 6e 74 20 78 20 74 68 61 74 20 61 64 64 73 20 78 20 61 6e 64 20 34 0a 0a 20 20 20 4c | gument.x.that.adds.x.and.4.....L |
| 2d7a0 | 69 6b 65 20 61 6e 79 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 68 61 73 20 61 20 70 72 | ike.any.expression.that.has.a.pr |
| 2d7c0 | 6f 63 65 64 75 72 65 20 61 73 20 69 74 73 20 76 61 6c 75 65 2c 20 61 20 60 6c 61 6d 62 64 61 27 | ocedure.as.its.value,.a.`lambda' |
| 2d7e0 | 0a 65 78 70 72 65 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 74 68 65 20 6f | .expression.can.be.used.as.the.o |
| 2d800 | 70 65 72 61 74 6f 72 20 69 6e 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 73 75 63 68 20 61 73 | perator.in.a.combination.such.as |
| 2d820 | 0a 0a 20 20 20 20 20 28 28 6c 61 6d 62 64 61 20 28 78 20 79 20 7a 29 20 28 2b 20 78 20 79 20 28 | .......((lambda.(x.y.z).(+.x.y.( |
| 2d840 | 73 71 75 61 72 65 20 7a 29 29 29 20 31 20 32 20 33 29 0a 20 20 20 20 20 31 32 0a 0a 6f 72 2c 20 | square.z))).1.2.3)......12..or,. |
| 2d860 | 6d 6f 72 65 20 67 65 6e 65 72 61 6c 6c 79 2c 20 69 6e 20 61 6e 79 20 63 6f 6e 74 65 78 74 20 77 | more.generally,.in.any.context.w |
| 2d880 | 68 65 72 65 20 77 65 20 77 6f 75 6c 64 20 6e 6f 72 6d 61 6c 6c 79 20 75 73 65 20 61 0a 70 72 6f | here.we.would.normally.use.a.pro |
| 2d8a0 | 63 65 64 75 72 65 20 6e 61 6d 65 2e 28 31 29 0a 0a 55 73 69 6e 67 20 60 6c 65 74 27 20 74 6f 20 | cedure.name.(1)..Using.`let'.to. |
| 2d8c0 | 63 72 65 61 74 65 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e | create.local.variables.......... |
| 2d8e0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 6e | ..............................An |
| 2d900 | 6f 74 68 65 72 20 75 73 65 20 6f 66 20 60 6c 61 6d 62 64 61 27 20 69 73 20 69 6e 20 63 72 65 61 | other.use.of.`lambda'.is.in.crea |
| 2d920 | 74 69 6e 67 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 2e 20 20 57 65 20 6f 66 74 65 6e 20 | ting.local.variables...We.often. |
| 2d940 | 6e 65 65 64 0a 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 20 69 6e 20 6f 75 72 20 70 72 6f 63 | need.local.variables.in.our.proc |
| 2d960 | 65 64 75 72 65 73 20 6f 74 68 65 72 20 74 68 61 6e 20 74 68 6f 73 65 20 74 68 61 74 20 68 61 76 | edures.other.than.those.that.hav |
| 2d980 | 65 20 62 65 65 6e 20 62 6f 75 6e 64 0a 61 73 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 | e.been.bound.as.formal.parameter |
| 2d9a0 | 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 73 75 70 70 6f 73 65 20 77 65 20 77 69 73 68 | s...For.example,.suppose.we.wish |
| 2d9c0 | 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 0a 66 75 6e 63 74 69 6f 6e 0a 0a 20 20 20 20 20 66 | .to.compute.the.function.......f |
| 2d9e0 | 28 78 2c 79 29 20 3d 20 78 28 31 20 2b 20 78 79 29 5e 32 20 2b 20 79 28 31 20 2d 20 79 29 20 2b | (x,y).=.x(1.+.xy)^2.+.y(1.-.y).+ |
| 2da00 | 20 28 31 20 2b 20 78 79 29 28 31 20 2d 20 79 29 0a 0a 77 68 69 63 68 20 77 65 20 63 6f 75 6c 64 | .(1.+.xy)(1.-.y)..which.we.could |
| 2da20 | 20 61 6c 73 6f 20 65 78 70 72 65 73 73 20 61 73 0a 0a 20 20 20 20 20 20 20 20 20 20 61 20 3d 20 | .also.express.as............a.=. |
| 2da40 | 31 20 2b 20 78 79 0a 20 20 20 20 20 20 20 20 20 20 62 20 3d 20 31 20 2d 20 79 0a 20 20 20 20 20 | 1.+.xy...........b.=.1.-.y...... |
| 2da60 | 66 28 78 2c 79 29 20 3d 20 78 61 5e 32 20 2b 20 79 62 20 2b 20 61 62 0a 0a 20 20 20 49 6e 20 77 | f(x,y).=.xa^2.+.yb.+.ab.....In.w |
| 2da80 | 72 69 74 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 66 2c | riting.a.procedure.to.compute.f, |
| 2daa0 | 20 77 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 20 69 6e 63 6c 75 64 65 20 61 73 0a 6c 6f 63 | .we.would.like.to.include.as.loc |
| 2dac0 | 61 6c 20 76 61 72 69 61 62 6c 65 73 20 6e 6f 74 20 6f 6e 6c 79 20 78 20 61 6e 64 20 79 20 62 75 | al.variables.not.only.x.and.y.bu |
| 2dae0 | 74 20 61 6c 73 6f 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 69 6e 74 65 72 6d 65 64 69 61 74 65 | t.also.the.names.of.intermediate |
| 2db00 | 0a 71 75 61 6e 74 69 74 69 65 73 20 6c 69 6b 65 20 61 20 61 6e 64 20 62 2e 20 20 4f 6e 65 20 77 | .quantities.like.a.and.b...One.w |
| 2db20 | 61 79 20 74 6f 20 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 20 69 73 20 74 6f 20 75 73 65 20 | ay.to.accomplish.this.is.to.use. |
| 2db40 | 61 6e 0a 61 75 78 69 6c 69 61 72 79 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 62 69 6e 64 20 74 | an.auxiliary.procedure.to.bind.t |
| 2db60 | 68 65 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | he.local.variables:.......(defin |
| 2db80 | 65 20 28 66 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 2d 68 65 6c 70 | e.(f.x.y)........(define.(f-help |
| 2dba0 | 65 72 20 61 20 62 29 0a 20 20 20 20 20 20 20 20 20 28 2b 20 28 2a 20 78 20 28 73 71 75 61 72 65 | er.a.b)..........(+.(*.x.(square |
| 2dbc0 | 20 61 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 79 20 62 29 0a 20 20 20 20 20 20 20 | .a)).............(*.y.b)........ |
| 2dbe0 | 20 20 20 20 20 28 2a 20 61 20 62 29 29 29 0a 20 20 20 20 20 20 20 28 66 2d 68 65 6c 70 65 72 20 | .....(*.a.b)))........(f-helper. |
| 2dc00 | 28 2b 20 31 20 28 2a 20 78 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | (+.1.(*.x.y))..................( |
| 2dc20 | 2d 20 31 20 79 29 29 29 0a 0a 20 20 20 4f 66 20 63 6f 75 72 73 65 2c 20 77 65 20 63 6f 75 6c 64 | -.1.y))).....Of.course,.we.could |
| 2dc40 | 20 75 73 65 20 61 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 73 70 | .use.a.`lambda'.expression.to.sp |
| 2dc60 | 65 63 69 66 79 20 61 6e 20 61 6e 6f 6e 79 6d 6f 75 73 0a 70 72 6f 63 65 64 75 72 65 20 66 6f 72 | ecify.an.anonymous.procedure.for |
| 2dc80 | 20 62 69 6e 64 69 6e 67 20 6f 75 72 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 2e 20 20 54 | .binding.our.local.variables...T |
| 2dca0 | 68 65 20 62 6f 64 79 20 6f 66 20 60 66 27 20 74 68 65 6e 0a 62 65 63 6f 6d 65 73 20 61 20 73 69 | he.body.of.`f'.then.becomes.a.si |
| 2dcc0 | 6e 67 6c 65 20 63 61 6c 6c 20 74 6f 20 74 68 61 74 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 | ngle.call.to.that.procedure:.... |
| 2dce0 | 20 20 20 28 64 65 66 69 6e 65 20 28 66 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 28 6c 61 6d 62 | ...(define.(f.x.y)........((lamb |
| 2dd00 | 64 61 20 28 61 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 2a 20 78 20 28 73 71 75 61 | da.(a.b)...........(+.(*.x.(squa |
| 2dd20 | 72 65 20 61 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 79 20 62 29 0a 20 20 20 20 | re.a))..............(*.y.b)..... |
| 2dd40 | 20 20 20 20 20 20 20 20 20 28 2a 20 61 20 62 29 29 29 0a 20 20 20 20 20 20 20 20 28 2b 20 31 20 | .........(*.a.b))).........(+.1. |
| 2dd60 | 28 2a 20 78 20 79 29 29 0a 20 20 20 20 20 20 20 20 28 2d 20 31 20 79 29 29 29 0a 0a 20 20 20 54 | (*.x.y)).........(-.1.y))).....T |
| 2dd80 | 68 69 73 20 63 6f 6e 73 74 72 75 63 74 20 69 73 20 73 6f 20 75 73 65 66 75 6c 20 74 68 61 74 20 | his.construct.is.so.useful.that. |
| 2dda0 | 74 68 65 72 65 20 69 73 20 61 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 63 61 6c 6c 65 64 0a 60 | there.is.a.special.form.called.` |
| 2ddc0 | 6c 65 74 27 20 74 6f 20 6d 61 6b 65 20 69 74 73 20 75 73 65 20 6d 6f 72 65 20 63 6f 6e 76 65 6e | let'.to.make.its.use.more.conven |
| 2dde0 | 69 65 6e 74 2e 20 20 55 73 69 6e 67 20 60 6c 65 74 27 2c 20 74 68 65 20 60 66 27 20 70 72 6f 63 | ient...Using.`let',.the.`f'.proc |
| 2de00 | 65 64 75 72 65 0a 63 6f 75 6c 64 20 62 65 20 77 72 69 74 74 65 6e 20 61 73 0a 0a 20 20 20 20 20 | edure.could.be.written.as....... |
| 2de20 | 28 64 65 66 69 6e 65 20 28 66 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 61 20 | (define.(f.x.y)........(let.((a. |
| 2de40 | 28 2b 20 31 20 28 2a 20 78 20 79 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 20 28 | (+.1.(*.x.y)))..............(b.( |
| 2de60 | 2d 20 31 20 79 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 2b 20 28 2a 20 78 20 28 73 71 75 61 72 | -.1.y)))..........(+.(*.x.(squar |
| 2de80 | 65 20 61 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 79 20 62 29 0a 20 20 20 20 20 20 | e.a)).............(*.y.b)....... |
| 2dea0 | 20 20 20 20 20 20 28 2a 20 61 20 62 29 29 29 29 0a 0a 20 20 20 54 68 65 20 67 65 6e 65 72 61 6c | ......(*.a.b)))).....The.general |
| 2dec0 | 20 66 6f 72 6d 20 6f 66 20 61 20 60 6c 65 74 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 0a 0a | .form.of.a.`let'.expression.is.. |
| 2dee0 | 20 20 20 20 20 28 6c 65 74 20 28 28 3c 56 41 52 31 3e 20 3c 45 58 50 31 3e 29 0a 20 20 20 20 20 | .....(let.((<VAR1>.<EXP1>)...... |
| 2df00 | 20 20 20 20 20 20 28 3c 56 41 52 32 3e 20 3c 45 58 50 32 3e 29 0a 20 20 20 20 20 20 20 20 20 20 | ......(<VAR2>.<EXP2>)........... |
| 2df20 | 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 28 3c 56 41 52 4e 3e 20 3c 56 41 52 4e 3e 29 29 | ................(<VARN>.<VARN>)) |
| 2df40 | 0a 20 20 20 20 20 20 20 20 3c 42 4f 44 59 3e 29 0a 0a 77 68 69 63 68 20 63 61 6e 20 62 65 20 74 | .........<BODY>)..which.can.be.t |
| 2df60 | 68 6f 75 67 68 74 20 6f 66 20 61 73 20 73 61 79 69 6e 67 0a 0a 20 20 20 20 20 6c 65 74 20 3c 56 | hought.of.as.saying.......let.<V |
| 2df80 | 41 52 5f 31 3e 20 68 61 76 65 20 74 68 65 20 76 61 6c 75 65 20 3c 45 58 50 5f 31 3e 20 61 6e 64 | AR_1>.have.the.value.<EXP_1>.and |
| 2dfa0 | 0a 20 20 20 20 20 20 20 20 20 3c 56 41 52 5f 32 3e 20 68 61 76 65 20 74 68 65 20 76 61 6c 75 65 | ..........<VAR_2>.have.the.value |
| 2dfc0 | 20 3c 45 58 50 5f 32 3e 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 2e 2e 2e 0a 20 20 20 20 20 20 | .<EXP_2>.and.................... |
| 2dfe0 | 20 20 20 3c 56 41 52 5f 4e 3e 20 68 61 76 65 20 74 68 65 20 76 61 6c 75 65 20 3c 45 58 50 5f 4e | ...<VAR_N>.have.the.value.<EXP_N |
| 2e000 | 3e 0a 20 20 20 20 20 69 6e 20 20 3c 42 4f 44 59 3e 0a 0a 20 20 20 54 68 65 20 66 69 72 73 74 20 | >......in..<BODY>.....The.first. |
| 2e020 | 70 61 72 74 20 6f 66 20 74 68 65 20 60 6c 65 74 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 | part.of.the.`let'.expression.is. |
| 2e040 | 61 20 6c 69 73 74 20 6f 66 20 6e 61 6d 65 2d 65 78 70 72 65 73 73 69 6f 6e 0a 70 61 69 72 73 2e | a.list.of.name-expression.pairs. |
| 2e060 | 20 20 57 68 65 6e 20 74 68 65 20 60 6c 65 74 27 20 69 73 20 65 76 61 6c 75 61 74 65 64 2c 20 65 | ..When.the.`let'.is.evaluated,.e |
| 2e080 | 61 63 68 20 6e 61 6d 65 20 69 73 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 65 0a | ach.name.is.associated.with.the. |
| 2e0a0 | 76 61 6c 75 65 20 6f 66 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 65 78 70 72 65 | value.of.the.corresponding.expre |
| 2e0c0 | 73 73 69 6f 6e 2e 20 20 54 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 20 60 6c 65 74 27 20 69 73 | ssion...The.body.of.the.`let'.is |
| 2e0e0 | 0a 65 76 61 6c 75 61 74 65 64 20 77 69 74 68 20 74 68 65 73 65 20 6e 61 6d 65 73 20 62 6f 75 6e | .evaluated.with.these.names.boun |
| 2e100 | 64 20 61 73 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 2e 20 20 54 68 65 20 77 61 79 20 74 | d.as.local.variables...The.way.t |
| 2e120 | 68 69 73 0a 68 61 70 70 65 6e 73 20 69 73 20 74 68 61 74 20 74 68 65 20 60 6c 65 74 27 20 65 78 | his.happens.is.that.the.`let'.ex |
| 2e140 | 70 72 65 73 73 69 6f 6e 20 69 73 20 69 6e 74 65 72 70 72 65 74 65 64 20 61 73 20 61 6e 20 61 6c | pression.is.interpreted.as.an.al |
| 2e160 | 74 65 72 6e 61 74 65 0a 73 79 6e 74 61 78 20 66 6f 72 0a 0a 20 20 20 20 20 28 28 6c 61 6d 62 64 | ternate.syntax.for.......((lambd |
| 2e180 | 61 20 28 3c 56 41 52 5f 31 3e 20 2e 2e 2e 20 3c 56 41 52 5f 4e 3e 29 0a 20 20 20 20 20 20 20 20 | a.(<VAR_1>.....<VAR_N>)......... |
| 2e1a0 | 20 3c 42 4f 44 59 3e 29 0a 20 20 20 20 20 20 3c 45 58 50 5f 31 3e 0a 20 20 20 20 20 20 2e 2e 2e | .<BODY>).......<EXP_1>.......... |
| 2e1c0 | 0a 20 20 20 20 20 20 3c 45 58 50 5f 4e 3e 29 0a 0a 20 20 20 4e 6f 20 6e 65 77 20 6d 65 63 68 61 | .......<EXP_N>).....No.new.mecha |
| 2e1e0 | 6e 69 73 6d 20 69 73 20 72 65 71 75 69 72 65 64 20 69 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 | nism.is.required.in.the.interpre |
| 2e200 | 74 65 72 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 70 72 6f 76 69 64 65 0a 6c 6f 63 61 6c 20 76 61 | ter.in.order.to.provide.local.va |
| 2e220 | 72 69 61 62 6c 65 73 2e 20 20 41 20 60 6c 65 74 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 | riables...A.`let'.expression.is. |
| 2e240 | 73 69 6d 70 6c 79 20 73 79 6e 74 61 63 74 69 63 20 73 75 67 61 72 20 66 6f 72 20 74 68 65 0a 75 | simply.syntactic.sugar.for.the.u |
| 2e260 | 6e 64 65 72 6c 79 69 6e 67 20 60 6c 61 6d 62 64 61 27 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 0a | nderlying.`lambda'.application.. |
| 2e280 | 0a 20 20 20 57 65 20 63 61 6e 20 73 65 65 20 66 72 6f 6d 20 74 68 69 73 20 65 71 75 69 76 61 6c | ....We.can.see.from.this.equival |
| 2e2a0 | 65 6e 63 65 20 74 68 61 74 20 74 68 65 20 73 63 6f 70 65 20 6f 66 20 61 20 76 61 72 69 61 62 6c | ence.that.the.scope.of.a.variabl |
| 2e2c0 | 65 0a 73 70 65 63 69 66 69 65 64 20 62 79 20 61 20 60 6c 65 74 27 20 65 78 70 72 65 73 73 69 6f | e.specified.by.a.`let'.expressio |
| 2e2e0 | 6e 20 69 73 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 20 60 6c 65 74 27 2e 20 20 54 68 69 | n.is.the.body.of.the.`let'...Thi |
| 2e300 | 73 20 69 6d 70 6c 69 65 73 0a 74 68 61 74 3a 0a 0a 20 20 20 2a 20 60 4c 65 74 27 20 61 6c 6c 6f | s.implies.that:.....*.`Let'.allo |
| 2e320 | 77 73 20 6f 6e 65 20 74 6f 20 62 69 6e 64 20 76 61 72 69 61 62 6c 65 73 20 61 73 20 6c 6f 63 61 | ws.one.to.bind.variables.as.loca |
| 2e340 | 6c 6c 79 20 61 73 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 77 68 65 72 65 0a 20 20 20 20 20 74 68 | lly.as.possible.to.where......th |
| 2e360 | 65 79 20 61 72 65 20 74 6f 20 62 65 20 75 73 65 64 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c | ey.are.to.be.used...For.example, |
| 2e380 | 20 69 66 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 78 27 20 69 73 20 35 2c 20 74 68 65 0a 20 | .if.the.value.of.`x'.is.5,.the.. |
| 2e3a0 | 20 20 20 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 | ....value.of.the.expression..... |
| 2e3c0 | 20 20 20 20 20 20 20 28 2b 20 28 6c 65 74 20 28 28 78 20 33 29 29 0a 20 20 20 20 20 20 20 20 20 | .......(+.(let.((x.3)).......... |
| 2e3e0 | 20 20 20 20 20 20 28 2b 20 78 20 28 2a 20 78 20 31 30 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | ......(+.x.(*.x.10)))........... |
| 2e400 | 20 20 20 78 29 0a 0a 20 20 20 20 20 69 73 20 33 38 2e 20 20 48 65 72 65 2c 20 74 68 65 20 60 78 | ...x).......is.38...Here,.the.`x |
| 2e420 | 27 20 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 20 60 6c 65 74 27 20 69 73 20 33 2c | '.in.the.body.of.the.`let'.is.3, |
| 2e440 | 20 73 6f 20 74 68 65 20 76 61 6c 75 65 0a 20 20 20 20 20 6f 66 20 74 68 65 20 60 6c 65 74 27 20 | .so.the.value......of.the.`let'. |
| 2e460 | 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 33 33 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 | expression.is.33...On.the.other. |
| 2e480 | 68 61 6e 64 2c 20 74 68 65 20 60 78 27 20 74 68 61 74 20 69 73 0a 20 20 20 20 20 74 68 65 20 73 | hand,.the.`x'.that.is......the.s |
| 2e4a0 | 65 63 6f 6e 64 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 74 68 65 20 6f 75 74 65 72 6d 6f 73 74 20 | econd.argument.to.the.outermost. |
| 2e4c0 | 60 2b 27 20 69 73 20 73 74 69 6c 6c 20 35 2e 0a 0a 20 20 20 2a 20 54 68 65 20 76 61 72 69 61 62 | `+'.is.still.5......*.The.variab |
| 2e4e0 | 6c 65 73 27 20 76 61 6c 75 65 73 20 61 72 65 20 63 6f 6d 70 75 74 65 64 20 6f 75 74 73 69 64 65 | les'.values.are.computed.outside |
| 2e500 | 20 74 68 65 20 60 6c 65 74 27 2e 20 20 54 68 69 73 0a 20 20 20 20 20 6d 61 74 74 65 72 73 20 77 | .the.`let'...This......matters.w |
| 2e520 | 68 65 6e 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 68 61 74 20 70 72 6f 76 69 64 65 | hen.the.expressions.that.provide |
| 2e540 | 20 74 68 65 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 20 6c 6f 63 61 6c 0a 20 20 20 20 20 76 | .the.values.for.the.local......v |
| 2e560 | 61 72 69 61 62 6c 65 73 20 64 65 70 65 6e 64 20 75 70 6f 6e 20 76 61 72 69 61 62 6c 65 73 20 68 | ariables.depend.upon.variables.h |
| 2e580 | 61 76 69 6e 67 20 74 68 65 20 73 61 6d 65 20 6e 61 6d 65 73 20 61 73 20 74 68 65 20 6c 6f 63 61 | aving.the.same.names.as.the.loca |
| 2e5a0 | 6c 0a 20 20 20 20 20 76 61 72 69 61 62 6c 65 73 20 74 68 65 6d 73 65 6c 76 65 73 2e 20 20 46 6f | l......variables.themselves...Fo |
| 2e5c0 | 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 78 27 20 69 | r.example,.if.the.value.of.`x'.i |
| 2e5e0 | 73 20 32 2c 20 74 68 65 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 20 | s.2,.the......expression........ |
| 2e600 | 20 20 20 20 28 6c 65 74 20 28 28 78 20 33 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....(let.((x.3)................. |
| 2e620 | 28 79 20 28 2b 20 78 20 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 78 20 79 29 | (y.(+.x.2))).............(*.x.y) |
| 2e640 | 29 0a 0a 20 20 20 20 20 77 69 6c 6c 20 68 61 76 65 20 74 68 65 20 76 61 6c 75 65 20 31 32 20 62 | ).......will.have.the.value.12.b |
| 2e660 | 65 63 61 75 73 65 2c 20 69 6e 73 69 64 65 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 20 60 | ecause,.inside.the.body.of.the.` |
| 2e680 | 6c 65 74 27 2c 20 60 78 27 0a 20 20 20 20 20 77 69 6c 6c 20 62 65 20 33 20 61 6e 64 20 60 79 27 | let',.`x'......will.be.3.and.`y' |
| 2e6a0 | 20 77 69 6c 6c 20 62 65 20 34 20 28 77 68 69 63 68 20 69 73 20 74 68 65 20 6f 75 74 65 72 20 60 | .will.be.4.(which.is.the.outer.` |
| 2e6c0 | 78 27 20 70 6c 75 73 20 32 29 2e 0a 0a 0a 20 20 20 53 6f 6d 65 74 69 6d 65 73 20 77 65 20 63 61 | x'.plus.2).......Sometimes.we.ca |
| 2e6e0 | 6e 20 75 73 65 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 74 6f 20 67 65 | n.use.internal.definitions.to.ge |
| 2e700 | 74 20 74 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 20 61 73 0a 77 69 74 68 20 60 6c 65 74 27 2e | t.the.same.effect.as.with.`let'. |
| 2e720 | 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 6f 75 6c 64 20 68 61 76 65 20 64 65 66 | ..For.example,.we.could.have.def |
| 2e740 | 69 6e 65 64 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 66 27 20 61 62 6f 76 65 0a 61 73 0a | ined.the.procedure.`f'.above.as. |
| 2e760 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 64 65 | ......(define.(f.x.y)........(de |
| 2e780 | 66 69 6e 65 20 61 20 28 2b 20 31 20 28 2a 20 78 20 79 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 | fine.a.(+.1.(*.x.y)))........(de |
| 2e7a0 | 66 69 6e 65 20 62 20 28 2d 20 31 20 79 29 29 0a 20 20 20 20 20 20 20 28 2b 20 28 2a 20 78 20 28 | fine.b.(-.1.y))........(+.(*.x.( |
| 2e7c0 | 73 71 75 61 72 65 20 61 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 2a 20 79 20 62 29 0a 20 20 20 | square.a))...........(*.y.b).... |
| 2e7e0 | 20 20 20 20 20 20 20 28 2a 20 61 20 62 29 29 29 0a 0a 20 20 20 57 65 20 70 72 65 66 65 72 2c 20 | .......(*.a.b))).....We.prefer,. |
| 2e800 | 68 6f 77 65 76 65 72 2c 20 74 6f 20 75 73 65 20 60 6c 65 74 27 20 69 6e 20 73 69 74 75 61 74 69 | however,.to.use.`let'.in.situati |
| 2e820 | 6f 6e 73 20 6c 69 6b 65 20 74 68 69 73 20 61 6e 64 20 74 6f 20 75 73 65 0a 69 6e 74 65 72 6e 61 | ons.like.this.and.to.use.interna |
| 2e840 | 6c 20 60 64 65 66 69 6e 65 27 20 6f 6e 6c 79 20 66 6f 72 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f | l.`define'.only.for.internal.pro |
| 2e860 | 63 65 64 75 72 65 73 2e 28 32 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 33 34 | cedures.(2).......*Exercise.1.34 |
| 2e880 | 3a 2a 20 53 75 70 70 6f 73 65 20 77 65 20 64 65 66 69 6e 65 20 74 68 65 20 70 72 6f 63 65 64 75 | :*.Suppose.we.define.the.procedu |
| 2e8a0 | 72 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 20 67 29 0a 20 20 20 20 | re............(define.(f.g)..... |
| 2e8c0 | 20 20 20 20 20 20 20 20 28 67 20 32 29 29 0a 0a 20 20 20 20 20 54 68 65 6e 20 77 65 20 68 61 76 | ........(g.2)).......Then.we.hav |
| 2e8e0 | 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 20 73 71 75 61 72 65 29 0a 20 20 20 20 20 20 20 20 | e............(f.square)......... |
| 2e900 | 20 20 34 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 20 28 6c 61 6d 62 64 61 20 28 7a 29 20 28 2a | ..4............(f.(lambda.(z).(* |
| 2e920 | 20 7a 20 28 2b 20 7a 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 36 0a 0a 20 20 20 20 20 | .z.(+.z.1))))...........6....... |
| 2e940 | 57 68 61 74 20 68 61 70 70 65 6e 73 20 69 66 20 77 65 20 28 70 65 72 76 65 72 73 65 6c 79 29 20 | What.happens.if.we.(perversely). |
| 2e960 | 61 73 6b 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 6f 20 65 76 61 6c 75 61 74 65 0a | ask.the.interpreter.to.evaluate. |
| 2e980 | 20 20 20 20 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 60 28 66 20 66 29 27 3f 20 20 45 | .....the.combination.`(f.f)'?..E |
| 2e9a0 | 78 70 6c 61 69 6e 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 | xplain......----------.Footnotes |
| 2e9c0 | 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 74 20 77 6f 75 6c 64 20 62 65 20 | .----------.....(1).It.would.be. |
| 2e9e0 | 63 6c 65 61 72 65 72 20 61 6e 64 20 6c 65 73 73 20 69 6e 74 69 6d 69 64 61 74 69 6e 67 20 74 6f | clearer.and.less.intimidating.to |
| 2ea00 | 20 70 65 6f 70 6c 65 20 6c 65 61 72 6e 69 6e 67 0a 4c 69 73 70 20 69 66 20 61 20 6e 61 6d 65 20 | .people.learning.Lisp.if.a.name. |
| 2ea20 | 6d 6f 72 65 20 6f 62 76 69 6f 75 73 20 74 68 61 6e 20 60 6c 61 6d 62 64 61 27 2c 20 73 75 63 68 | more.obvious.than.`lambda',.such |
| 2ea40 | 20 61 73 20 60 6d 61 6b 65 2d 70 72 6f 63 65 64 75 72 65 27 2c 0a 77 65 72 65 20 75 73 65 64 2e | .as.`make-procedure',.were.used. |
| 2ea60 | 20 20 42 75 74 20 74 68 65 20 63 6f 6e 76 65 6e 74 69 6f 6e 20 69 73 20 66 69 72 6d 6c 79 20 65 | ..But.the.convention.is.firmly.e |
| 2ea80 | 6e 74 72 65 6e 63 68 65 64 2e 20 20 54 68 65 20 6e 6f 74 61 74 69 6f 6e 20 69 73 0a 61 64 6f 70 | ntrenched...The.notation.is.adop |
| 2eaa0 | 74 65 64 20 66 72 6f 6d 20 74 68 65 20 5b 6c 61 6d 62 64 61 5d 20 63 61 6c 63 75 6c 75 73 2c 20 | ted.from.the.[lambda].calculus,. |
| 2eac0 | 61 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 66 6f 72 6d 61 6c 69 73 6d 20 69 6e 74 72 6f 64 75 | a.mathematical.formalism.introdu |
| 2eae0 | 63 65 64 0a 62 79 20 74 68 65 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6c 6f 67 69 63 69 61 6e | ced.by.the.mathematical.logician |
| 2eb00 | 20 41 6c 6f 6e 7a 6f 20 43 68 75 72 63 68 20 28 31 39 34 31 29 2e 20 20 43 68 75 72 63 68 20 64 | .Alonzo.Church.(1941)...Church.d |
| 2eb20 | 65 76 65 6c 6f 70 65 64 0a 74 68 65 20 5b 6c 61 6d 62 64 61 5d 20 63 61 6c 63 75 6c 75 73 20 74 | eveloped.the.[lambda].calculus.t |
| 2eb40 | 6f 20 70 72 6f 76 69 64 65 20 61 20 72 69 67 6f 72 6f 75 73 20 66 6f 75 6e 64 61 74 69 6f 6e 20 | o.provide.a.rigorous.foundation. |
| 2eb60 | 66 6f 72 20 73 74 75 64 79 69 6e 67 20 74 68 65 0a 6e 6f 74 69 6f 6e 73 20 6f 66 20 66 75 6e 63 | for.studying.the.notions.of.func |
| 2eb80 | 74 69 6f 6e 20 61 6e 64 20 66 75 6e 63 74 69 6f 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 20 20 | tion.and.function.application... |
| 2eba0 | 54 68 65 20 5b 6c 61 6d 62 64 61 5d 20 63 61 6c 63 75 6c 75 73 0a 68 61 73 20 62 65 63 6f 6d 65 | The.[lambda].calculus.has.become |
| 2ebc0 | 20 61 20 62 61 73 69 63 20 74 6f 6f 6c 20 66 6f 72 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 69 | .a.basic.tool.for.mathematical.i |
| 2ebe0 | 6e 76 65 73 74 69 67 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 0a 73 65 6d 61 6e 74 69 63 73 20 6f | nvestigations.of.the.semantics.o |
| 2ec00 | 66 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 2e 0a 0a 20 20 20 28 32 29 | f.programming.languages......(2) |
| 2ec20 | 20 55 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 | .Understanding.internal.definiti |
| 2ec40 | 6f 6e 73 20 77 65 6c 6c 20 65 6e 6f 75 67 68 20 74 6f 20 62 65 20 73 75 72 65 20 61 0a 70 72 6f | ons.well.enough.to.be.sure.a.pro |
| 2ec60 | 67 72 61 6d 20 6d 65 61 6e 73 20 77 68 61 74 20 77 65 20 69 6e 74 65 6e 64 20 69 74 20 74 6f 20 | gram.means.what.we.intend.it.to. |
| 2ec80 | 6d 65 61 6e 20 72 65 71 75 69 72 65 73 20 61 20 6d 6f 72 65 20 65 6c 61 62 6f 72 61 74 65 20 6d | mean.requires.a.more.elaborate.m |
| 2eca0 | 6f 64 65 6c 0a 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 74 | odel.of.the.evaluation.process.t |
| 2ecc0 | 68 61 6e 20 77 65 20 68 61 76 65 20 70 72 65 73 65 6e 74 65 64 20 69 6e 20 74 68 69 73 20 63 68 | han.we.have.presented.in.this.ch |
| 2ece0 | 61 70 74 65 72 2e 20 20 54 68 65 0a 73 75 62 74 6c 65 74 69 65 73 20 64 6f 20 6e 6f 74 20 61 72 | apter...The.subtleties.do.not.ar |
| 2ed00 | 69 73 65 20 77 69 74 68 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 | ise.with.internal.definitions.of |
| 2ed20 | 20 70 72 6f 63 65 64 75 72 65 73 2c 0a 68 6f 77 65 76 65 72 2e 20 20 57 65 20 77 69 6c 6c 20 72 | .procedures,.however...We.will.r |
| 2ed40 | 65 74 75 72 6e 20 74 6f 20 74 68 69 73 20 69 73 73 75 65 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a | eturn.to.this.issue.in.section.* |
| 2ed60 | 4e 6f 74 65 20 34 2d 31 2d 36 3a 3a 2c 20 61 66 74 65 72 0a 77 65 20 6c 65 61 72 6e 20 6d 6f 72 | Note.4-1-6::,.after.we.learn.mor |
| 2ed80 | 65 20 61 62 6f 75 74 20 65 76 61 6c 75 61 74 69 6f 6e 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 | e.about.evaluation.....File:.sic |
| 2eda0 | 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 33 2d 33 2c 20 20 4e 65 78 74 3a 20 31 2d 33 | p.info,..Node:.1-3-3,..Next:.1-3 |
| 2edc0 | 2d 34 2c 20 20 50 72 65 76 3a 20 31 2d 33 2d 32 2c 20 20 55 70 3a 20 31 2d 33 0a 0a 31 2e 33 2e | -4,..Prev:.1-3-2,..Up:.1-3..1.3. |
| 2ede0 | 33 20 50 72 6f 63 65 64 75 72 65 73 20 61 73 20 47 65 6e 65 72 61 6c 20 4d 65 74 68 6f 64 73 0a | 3.Procedures.as.General.Methods. |
| 2ee00 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 2ee20 | 2d 2d 2d 0a 0a 57 65 20 69 6e 74 72 6f 64 75 63 65 64 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 | ---..We.introduced.compound.proc |
| 2ee40 | 65 64 75 72 65 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 34 3a 3a 20 | edures.in.section.*Note.1-1-4::. |
| 2ee60 | 61 73 20 61 0a 6d 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 61 62 73 74 72 61 63 74 69 6e 67 20 70 | as.a.mechanism.for.abstracting.p |
| 2ee80 | 61 74 74 65 72 6e 73 20 6f 66 20 6e 75 6d 65 72 69 63 61 6c 20 6f 70 65 72 61 74 69 6f 6e 73 20 | atterns.of.numerical.operations. |
| 2eea0 | 73 6f 20 61 73 20 74 6f 0a 6d 61 6b 65 20 74 68 65 6d 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f | so.as.to.make.them.independent.o |
| 2eec0 | 66 20 74 68 65 20 70 61 72 74 69 63 75 6c 61 72 20 6e 75 6d 62 65 72 73 20 69 6e 76 6f 6c 76 65 | f.the.particular.numbers.involve |
| 2eee0 | 64 2e 20 20 57 69 74 68 0a 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 73 | d...With.higher-order.procedures |
| 2ef00 | 2c 20 73 75 63 68 20 61 73 20 74 68 65 20 60 69 6e 74 65 67 72 61 6c 27 20 70 72 6f 63 65 64 75 | ,.such.as.the.`integral'.procedu |
| 2ef20 | 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 31 2d 33 2d 31 3a 3a 2c 20 77 65 20 | re.of.section.*Note.1-3-1::,.we. |
| 2ef40 | 62 65 67 61 6e 20 74 6f 20 73 65 65 20 61 20 6d 6f 72 65 20 70 6f 77 65 72 66 75 6c 20 6b 69 6e | began.to.see.a.more.powerful.kin |
| 2ef60 | 64 20 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 3a 0a 70 72 6f 63 65 64 75 72 65 73 20 75 73 65 | d.of.abstraction:.procedures.use |
| 2ef80 | 64 20 74 6f 20 65 78 70 72 65 73 73 20 67 65 6e 65 72 61 6c 20 6d 65 74 68 6f 64 73 20 6f 66 20 | d.to.express.general.methods.of. |
| 2efa0 | 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 69 6e 64 65 70 65 6e 64 65 6e 74 0a 6f 66 20 74 68 65 20 | computation,.independent.of.the. |
| 2efc0 | 70 61 72 74 69 63 75 6c 61 72 20 66 75 6e 63 74 69 6f 6e 73 20 69 6e 76 6f 6c 76 65 64 2e 20 20 | particular.functions.involved... |
| 2efe0 | 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 77 65 20 64 69 73 63 75 73 73 20 74 77 6f 0a 6d | In.this.section.we.discuss.two.m |
| 2f000 | 6f 72 65 20 65 6c 61 62 6f 72 61 74 65 20 65 78 61 6d 70 6c 65 73 2d 2d 67 65 6e 65 72 61 6c 20 | ore.elaborate.examples--general. |
| 2f020 | 6d 65 74 68 6f 64 73 20 66 6f 72 20 66 69 6e 64 69 6e 67 20 7a 65 72 6f 73 20 61 6e 64 20 66 69 | methods.for.finding.zeros.and.fi |
| 2f040 | 78 65 64 0a 70 6f 69 6e 74 73 20 6f 66 20 66 75 6e 63 74 69 6f 6e 73 2d 2d 61 6e 64 20 73 68 6f | xed.points.of.functions--and.sho |
| 2f060 | 77 20 68 6f 77 20 74 68 65 73 65 20 6d 65 74 68 6f 64 73 20 63 61 6e 20 62 65 20 65 78 70 72 65 | w.how.these.methods.can.be.expre |
| 2f080 | 73 73 65 64 0a 64 69 72 65 63 74 6c 79 20 61 73 20 70 72 6f 63 65 64 75 72 65 73 2e 0a 0a 46 69 | ssed.directly.as.procedures...Fi |
| 2f0a0 | 6e 64 69 6e 67 20 72 6f 6f 74 73 20 6f 66 20 65 71 75 61 74 69 6f 6e 73 20 62 79 20 74 68 65 20 | nding.roots.of.equations.by.the. |
| 2f0c0 | 68 61 6c 66 2d 69 6e 74 65 72 76 61 6c 20 6d 65 74 68 6f 64 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | half-interval.method............ |
| 2f0e0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ................................ |
| 2f100 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 22 68 61 6c 66 2d 69 6e 74 65 72 76 61 6c 20 | .............The."half-interval. |
| 2f120 | 6d 65 74 68 6f 64 22 20 69 73 20 61 20 73 69 6d 70 6c 65 20 62 75 74 20 70 6f 77 65 72 66 75 6c | method".is.a.simple.but.powerful |
| 2f140 | 20 74 65 63 68 6e 69 71 75 65 20 66 6f 72 0a 66 69 6e 64 69 6e 67 20 72 6f 6f 74 73 20 6f 66 20 | .technique.for.finding.roots.of. |
| 2f160 | 61 6e 20 65 71 75 61 74 69 6f 6e 20 66 28 78 29 20 3d 20 30 2c 20 77 68 65 72 65 20 66 20 69 73 | an.equation.f(x).=.0,.where.f.is |
| 2f180 | 20 61 20 63 6f 6e 74 69 6e 75 6f 75 73 0a 66 75 6e 63 74 69 6f 6e 2e 20 20 54 68 65 20 69 64 65 | .a.continuous.function...The.ide |
| 2f1a0 | 61 20 69 73 20 74 68 61 74 2c 20 69 66 20 77 65 20 61 72 65 20 67 69 76 65 6e 20 70 6f 69 6e 74 | a.is.that,.if.we.are.given.point |
| 2f1c0 | 73 20 61 20 61 6e 64 20 62 20 73 75 63 68 20 74 68 61 74 0a 66 28 61 29 20 3c 20 30 20 3c 20 66 | s.a.and.b.such.that.f(a).<.0.<.f |
| 2f1e0 | 28 62 29 2c 20 74 68 65 6e 20 66 20 6d 75 73 74 20 68 61 76 65 20 61 74 20 6c 65 61 73 74 20 6f | (b),.then.f.must.have.at.least.o |
| 2f200 | 6e 65 20 7a 65 72 6f 20 62 65 74 77 65 65 6e 20 61 20 61 6e 64 20 62 2e 0a 54 6f 20 6c 6f 63 61 | ne.zero.between.a.and.b..To.loca |
| 2f220 | 74 65 20 61 20 7a 65 72 6f 2c 20 6c 65 74 20 78 20 62 65 20 74 68 65 20 61 76 65 72 61 67 65 20 | te.a.zero,.let.x.be.the.average. |
| 2f240 | 6f 66 20 61 20 61 6e 64 20 62 20 61 6e 64 20 63 6f 6d 70 75 74 65 20 66 28 78 29 2e 20 20 49 66 | of.a.and.b.and.compute.f(x)...If |
| 2f260 | 0a 66 28 78 29 20 3e 20 30 2c 20 74 68 65 6e 20 66 20 6d 75 73 74 20 68 61 76 65 20 61 20 7a 65 | .f(x).>.0,.then.f.must.have.a.ze |
| 2f280 | 72 6f 20 62 65 74 77 65 65 6e 20 61 20 61 6e 64 20 78 2e 20 20 49 66 20 66 28 78 29 20 3c 20 30 | ro.between.a.and.x...If.f(x).<.0 |
| 2f2a0 | 2c 20 74 68 65 6e 20 66 0a 6d 75 73 74 20 68 61 76 65 20 61 20 7a 65 72 6f 20 62 65 74 77 65 65 | ,.then.f.must.have.a.zero.betwee |
| 2f2c0 | 6e 20 78 20 61 6e 64 20 62 2e 20 20 43 6f 6e 74 69 6e 75 69 6e 67 20 69 6e 20 74 68 69 73 20 77 | n.x.and.b...Continuing.in.this.w |
| 2f2e0 | 61 79 2c 20 77 65 20 63 61 6e 0a 69 64 65 6e 74 69 66 79 20 73 6d 61 6c 6c 65 72 20 61 6e 64 20 | ay,.we.can.identify.smaller.and. |
| 2f300 | 73 6d 61 6c 6c 65 72 20 69 6e 74 65 72 76 61 6c 73 20 6f 6e 20 77 68 69 63 68 20 66 20 6d 75 73 | smaller.intervals.on.which.f.mus |
| 2f320 | 74 20 68 61 76 65 20 61 20 7a 65 72 6f 2e 0a 57 68 65 6e 20 77 65 20 72 65 61 63 68 20 61 20 70 | t.have.a.zero..When.we.reach.a.p |
| 2f340 | 6f 69 6e 74 20 77 68 65 72 65 20 74 68 65 20 69 6e 74 65 72 76 61 6c 20 69 73 20 73 6d 61 6c 6c | oint.where.the.interval.is.small |
| 2f360 | 20 65 6e 6f 75 67 68 2c 20 74 68 65 20 70 72 6f 63 65 73 73 0a 73 74 6f 70 73 2e 20 20 53 69 6e | .enough,.the.process.stops...Sin |
| 2f380 | 63 65 20 74 68 65 20 69 6e 74 65 72 76 61 6c 20 6f 66 20 75 6e 63 65 72 74 61 69 6e 74 79 20 69 | ce.the.interval.of.uncertainty.i |
| 2f3a0 | 73 20 72 65 64 75 63 65 64 20 62 79 20 68 61 6c 66 20 61 74 20 65 61 63 68 0a 73 74 65 70 20 6f | s.reduced.by.half.at.each.step.o |
| 2f3c0 | 66 20 74 68 65 20 70 72 6f 63 65 73 73 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 | f.the.process,.the.number.of.ste |
| 2f3e0 | 70 73 20 72 65 71 75 69 72 65 64 20 67 72 6f 77 73 20 61 73 0a 5b 74 68 65 74 61 5d 28 60 6c 6f | ps.required.grows.as.[theta](`lo |
| 2f400 | 67 27 28 20 4c 2f 54 29 29 2c 20 77 68 65 72 65 20 4c 20 69 73 20 74 68 65 20 6c 65 6e 67 74 68 | g'(.L/T)),.where.L.is.the.length |
| 2f420 | 20 6f 66 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 69 6e 74 65 72 76 61 6c 0a 61 6e 64 20 54 20 | .of.the.original.interval.and.T. |
| 2f440 | 69 73 20 74 68 65 20 65 72 72 6f 72 20 74 6f 6c 65 72 61 6e 63 65 20 28 74 68 61 74 20 69 73 2c | is.the.error.tolerance.(that.is, |
| 2f460 | 20 74 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 69 6e 74 65 72 76 61 6c 20 77 65 20 77 69 6c | .the.size.of.the.interval.we.wil |
| 2f480 | 6c 0a 63 6f 6e 73 69 64 65 72 20 22 73 6d 61 6c 6c 20 65 6e 6f 75 67 68 22 29 2e 20 20 48 65 72 | l.consider."small.enough")...Her |
| 2f4a0 | 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 73 | e.is.a.procedure.that.implements |
| 2f4c0 | 20 74 68 69 73 0a 73 74 72 61 74 65 67 79 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 | .this.strategy:.......(define.(s |
| 2f4e0 | 65 61 72 63 68 20 66 20 6e 65 67 2d 70 6f 69 6e 74 20 70 6f 73 2d 70 6f 69 6e 74 29 0a 20 20 20 | earch.f.neg-point.pos-point).... |
| 2f500 | 20 20 20 20 28 6c 65 74 20 28 28 6d 69 64 70 6f 69 6e 74 20 28 61 76 65 72 61 67 65 20 6e 65 67 | ....(let.((midpoint.(average.neg |
| 2f520 | 2d 70 6f 69 6e 74 20 70 6f 73 2d 70 6f 69 6e 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 | -point.pos-point)))..........(if |
| 2f540 | 20 28 63 6c 6f 73 65 2d 65 6e 6f 75 67 68 3f 20 6e 65 67 2d 70 6f 69 6e 74 20 70 6f 73 2d 70 6f | .(close-enough?.neg-point.pos-po |
| 2f560 | 69 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 69 64 70 6f 69 6e 74 0a 20 20 20 20 20 | int)..............midpoint...... |
| 2f580 | 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 65 73 74 2d 76 61 6c 75 65 20 28 66 20 6d 69 64 | ........(let.((test-value.(f.mid |
| 2f5a0 | 70 6f 69 6e 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 | point)))................(cond.(( |
| 2f5c0 | 70 6f 73 69 74 69 76 65 3f 20 74 65 73 74 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 | positive?.test-value)........... |
| 2f5e0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 61 72 63 68 20 66 20 6e 65 67 2d 70 6f 69 6e 74 20 | ............(search.f.neg-point. |
| 2f600 | 6d 69 64 70 6f 69 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | midpoint))...................... |
| 2f620 | 28 28 6e 65 67 61 74 69 76 65 3f 20 74 65 73 74 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 | ((negative?.test-value)......... |
| 2f640 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 61 72 63 68 20 66 20 6d 69 64 70 6f 69 6e 74 | ..............(search.f.midpoint |
| 2f660 | 20 70 6f 73 2d 70 6f 69 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .pos-point)).................... |
| 2f680 | 20 20 28 65 6c 73 65 20 6d 69 64 70 6f 69 6e 74 29 29 29 29 29 29 0a 0a 20 20 20 57 65 20 61 73 | ..(else.midpoint)))))).....We.as |
| 2f6a0 | 73 75 6d 65 20 74 68 61 74 20 77 65 20 61 72 65 20 69 6e 69 74 69 61 6c 6c 79 20 67 69 76 65 6e | sume.that.we.are.initially.given |
| 2f6c0 | 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 66 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 0a 70 6f | .the.function.f.together.with.po |
| 2f6e0 | 69 6e 74 73 20 61 74 20 77 68 69 63 68 20 69 74 73 20 76 61 6c 75 65 73 20 61 72 65 20 6e 65 67 | ints.at.which.its.values.are.neg |
| 2f700 | 61 74 69 76 65 20 61 6e 64 20 70 6f 73 69 74 69 76 65 2e 20 20 57 65 20 66 69 72 73 74 20 63 6f | ative.and.positive...We.first.co |
| 2f720 | 6d 70 75 74 65 0a 74 68 65 20 6d 69 64 70 6f 69 6e 74 20 6f 66 20 74 68 65 20 74 77 6f 20 67 69 | mpute.the.midpoint.of.the.two.gi |
| 2f740 | 76 65 6e 20 70 6f 69 6e 74 73 2e 20 20 4e 65 78 74 20 77 65 20 63 68 65 63 6b 20 74 6f 20 73 65 | ven.points...Next.we.check.to.se |
| 2f760 | 65 20 69 66 20 74 68 65 0a 67 69 76 65 6e 20 69 6e 74 65 72 76 61 6c 20 69 73 20 73 6d 61 6c 6c | e.if.the.given.interval.is.small |
| 2f780 | 20 65 6e 6f 75 67 68 2c 20 61 6e 64 20 69 66 20 73 6f 20 77 65 20 73 69 6d 70 6c 79 20 72 65 74 | .enough,.and.if.so.we.simply.ret |
| 2f7a0 | 75 72 6e 20 74 68 65 20 6d 69 64 70 6f 69 6e 74 0a 61 73 20 6f 75 72 20 61 6e 73 77 65 72 2e 20 | urn.the.midpoint.as.our.answer.. |
| 2f7c0 | 20 4f 74 68 65 72 77 69 73 65 2c 20 77 65 20 63 6f 6d 70 75 74 65 20 61 73 20 61 20 74 65 73 74 | .Otherwise,.we.compute.as.a.test |
| 2f7e0 | 20 76 61 6c 75 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 66 20 61 74 0a 74 68 65 20 6d 69 64 | .value.the.value.of.f.at.the.mid |
| 2f800 | 70 6f 69 6e 74 2e 20 20 49 66 20 74 68 65 20 74 65 73 74 20 76 61 6c 75 65 20 69 73 20 70 6f 73 | point...If.the.test.value.is.pos |
| 2f820 | 69 74 69 76 65 2c 20 74 68 65 6e 20 77 65 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 0a 70 72 6f 63 | itive,.then.we.continue.the.proc |
| 2f840 | 65 73 73 20 77 69 74 68 20 61 20 6e 65 77 20 69 6e 74 65 72 76 61 6c 20 72 75 6e 6e 69 6e 67 20 | ess.with.a.new.interval.running. |
| 2f860 | 66 72 6f 6d 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 6e 65 67 61 74 69 76 65 20 70 6f 69 6e 74 | from.the.original.negative.point |
| 2f880 | 20 74 6f 0a 74 68 65 20 6d 69 64 70 6f 69 6e 74 2e 20 20 49 66 20 74 68 65 20 74 65 73 74 20 76 | .to.the.midpoint...If.the.test.v |
| 2f8a0 | 61 6c 75 65 20 69 73 20 6e 65 67 61 74 69 76 65 2c 20 77 65 20 63 6f 6e 74 69 6e 75 65 20 77 69 | alue.is.negative,.we.continue.wi |
| 2f8c0 | 74 68 20 74 68 65 0a 69 6e 74 65 72 76 61 6c 20 66 72 6f 6d 20 74 68 65 20 6d 69 64 70 6f 69 6e | th.the.interval.from.the.midpoin |
| 2f8e0 | 74 20 74 6f 20 74 68 65 20 70 6f 73 69 74 69 76 65 20 70 6f 69 6e 74 2e 20 20 46 69 6e 61 6c 6c | t.to.the.positive.point...Finall |
| 2f900 | 79 2c 20 74 68 65 72 65 20 69 73 0a 74 68 65 20 70 6f 73 73 69 62 69 6c 69 74 79 20 74 68 61 74 | y,.there.is.the.possibility.that |
| 2f920 | 20 74 68 65 20 74 65 73 74 20 76 61 6c 75 65 20 69 73 20 30 2c 20 69 6e 20 77 68 69 63 68 20 63 | .the.test.value.is.0,.in.which.c |
| 2f940 | 61 73 65 20 74 68 65 20 6d 69 64 70 6f 69 6e 74 20 69 73 0a 69 74 73 65 6c 66 20 74 68 65 20 72 | ase.the.midpoint.is.itself.the.r |
| 2f960 | 6f 6f 74 20 77 65 20 61 72 65 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 2e 0a 0a 20 20 20 54 6f | oot.we.are.searching.for......To |
| 2f980 | 20 74 65 73 74 20 77 68 65 74 68 65 72 20 74 68 65 20 65 6e 64 70 6f 69 6e 74 73 20 61 72 65 20 | .test.whether.the.endpoints.are. |
| 2f9a0 | 22 63 6c 6f 73 65 20 65 6e 6f 75 67 68 22 20 77 65 20 63 61 6e 20 75 73 65 20 61 0a 70 72 6f 63 | "close.enough".we.can.use.a.proc |
| 2f9c0 | 65 64 75 72 65 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 6f 6e 65 20 75 73 65 64 20 69 6e | edure.similar.to.the.one.used.in |
| 2f9e0 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 37 3a 3a 20 66 6f 72 0a 63 6f 6d 70 75 | .section.*Note.1-1-7::.for.compu |
| 2fa00 | 74 69 6e 67 20 73 71 75 61 72 65 20 72 6f 6f 74 73 3a 28 31 29 0a 0a 20 20 20 20 20 28 64 65 66 | ting.square.roots:(1).......(def |
| 2fa20 | 69 6e 65 20 28 63 6c 6f 73 65 2d 65 6e 6f 75 67 68 3f 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 | ine.(close-enough?.x.y)........( |
| 2fa40 | 3c 20 28 61 62 73 20 28 2d 20 78 20 79 29 29 20 30 2e 30 30 31 29 29 0a 0a 20 20 20 60 53 65 61 | <.(abs.(-.x.y)).0.001)).....`Sea |
| 2fa60 | 72 63 68 27 20 69 73 20 61 77 6b 77 61 72 64 20 74 6f 20 75 73 65 20 64 69 72 65 63 74 6c 79 2c | rch'.is.awkward.to.use.directly, |
| 2fa80 | 20 62 65 63 61 75 73 65 20 77 65 20 63 61 6e 20 61 63 63 69 64 65 6e 74 61 6c 6c 79 0a 67 69 76 | .because.we.can.accidentally.giv |
| 2faa0 | 65 20 69 74 20 70 6f 69 6e 74 73 20 61 74 20 77 68 69 63 68 20 66 27 73 20 76 61 6c 75 65 73 20 | e.it.points.at.which.f's.values. |
| 2fac0 | 64 6f 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 72 65 71 75 69 72 65 64 20 73 69 67 6e 2c 20 69 | do.not.have.the.required.sign,.i |
| 2fae0 | 6e 0a 77 68 69 63 68 20 63 61 73 65 20 77 65 20 67 65 74 20 61 20 77 72 6f 6e 67 20 61 6e 73 77 | n.which.case.we.get.a.wrong.answ |
| 2fb00 | 65 72 2e 20 20 49 6e 73 74 65 61 64 20 77 65 20 77 69 6c 6c 20 75 73 65 20 60 73 65 61 72 63 68 | er...Instead.we.will.use.`search |
| 2fb20 | 27 20 76 69 61 20 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 2c 20 77 | '.via.the.following.procedure,.w |
| 2fb40 | 68 69 63 68 20 63 68 65 63 6b 73 20 74 6f 20 73 65 65 20 77 68 69 63 68 20 6f 66 20 74 68 65 20 | hich.checks.to.see.which.of.the. |
| 2fb60 | 65 6e 64 70 6f 69 6e 74 73 20 68 61 73 20 61 0a 6e 65 67 61 74 69 76 65 20 66 75 6e 63 74 69 6f | endpoints.has.a.negative.functio |
| 2fb80 | 6e 20 76 61 6c 75 65 20 61 6e 64 20 77 68 69 63 68 20 68 61 73 20 61 20 70 6f 73 69 74 69 76 65 | n.value.and.which.has.a.positive |
| 2fba0 | 20 76 61 6c 75 65 2c 20 61 6e 64 20 63 61 6c 6c 73 20 74 68 65 0a 60 73 65 61 72 63 68 27 20 70 | .value,.and.calls.the.`search'.p |
| 2fbc0 | 72 6f 63 65 64 75 72 65 20 61 63 63 6f 72 64 69 6e 67 6c 79 2e 20 20 49 66 20 74 68 65 20 66 75 | rocedure.accordingly...If.the.fu |
| 2fbe0 | 6e 63 74 69 6f 6e 20 68 61 73 20 74 68 65 20 73 61 6d 65 20 73 69 67 6e 20 6f 6e 0a 74 68 65 20 | nction.has.the.same.sign.on.the. |
| 2fc00 | 74 77 6f 20 67 69 76 65 6e 20 70 6f 69 6e 74 73 2c 20 74 68 65 20 68 61 6c 66 2d 69 6e 74 65 72 | two.given.points,.the.half-inter |
| 2fc20 | 76 61 6c 20 6d 65 74 68 6f 64 20 63 61 6e 6e 6f 74 20 62 65 20 75 73 65 64 2c 20 69 6e 20 77 68 | val.method.cannot.be.used,.in.wh |
| 2fc40 | 69 63 68 0a 63 61 73 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 73 69 67 6e 61 6c 73 20 61 | ich.case.the.procedure.signals.a |
| 2fc60 | 6e 20 65 72 72 6f 72 2e 28 32 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 68 61 6c 66 2d | n.error.(2).......(define.(half- |
| 2fc80 | 69 6e 74 65 72 76 61 6c 2d 6d 65 74 68 6f 64 20 66 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 6c | interval-method.f.a.b)........(l |
| 2fca0 | 65 74 20 28 28 61 2d 76 61 6c 75 65 20 28 66 20 61 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | et.((a-value.(f.a))............. |
| 2fcc0 | 20 28 62 2d 76 61 6c 75 65 20 28 66 20 62 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 | .(b-value.(f.b)))..........(cond |
| 2fce0 | 20 28 28 61 6e 64 20 28 6e 65 67 61 74 69 76 65 3f 20 61 2d 76 61 6c 75 65 29 20 28 70 6f 73 69 | .((and.(negative?.a-value).(posi |
| 2fd00 | 74 69 76 65 3f 20 62 2d 76 61 6c 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tive?.b-value))................. |
| 2fd20 | 28 73 65 61 72 63 68 20 66 20 61 20 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | (search.f.a.b))................( |
| 2fd40 | 28 61 6e 64 20 28 6e 65 67 61 74 69 76 65 3f 20 62 2d 76 61 6c 75 65 29 20 28 70 6f 73 69 74 69 | (and.(negative?.b-value).(positi |
| 2fd60 | 76 65 3f 20 61 2d 76 61 6c 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 | ve?.a-value)).................(s |
| 2fd80 | 65 61 72 63 68 20 66 20 62 20 61 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c | earch.f.b.a))................(el |
| 2fda0 | 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 56 61 6c 75 65 | se.................(error."Value |
| 2fdc0 | 73 20 61 72 65 20 6e 6f 74 20 6f 66 20 6f 70 70 6f 73 69 74 65 20 73 69 67 6e 22 20 61 20 62 29 | s.are.not.of.opposite.sign".a.b) |
| 2fde0 | 29 29 29 29 0a 0a 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 78 61 6d 70 6c 65 20 75 | )))).....The.following.example.u |
| 2fe00 | 73 65 73 20 74 68 65 20 68 61 6c 66 2d 69 6e 74 65 72 76 61 6c 20 6d 65 74 68 6f 64 20 74 6f 20 | ses.the.half-interval.method.to. |
| 2fe20 | 61 70 70 72 6f 78 69 6d 61 74 65 0a 5b 70 69 5d 20 61 73 20 74 68 65 20 72 6f 6f 74 20 62 65 74 | approximate.[pi].as.the.root.bet |
| 2fe40 | 77 65 65 6e 20 32 20 61 6e 64 20 34 20 6f 66 20 60 73 69 6e 27 20 78 20 3d 20 30 3a 0a 0a 20 20 | ween.2.and.4.of.`sin'.x.=.0:.... |
| 2fe60 | 20 20 20 28 68 61 6c 66 2d 69 6e 74 65 72 76 61 6c 2d 6d 65 74 68 6f 64 20 73 69 6e 20 32 2e 30 | ...(half-interval-method.sin.2.0 |
| 2fe80 | 20 34 2e 30 29 0a 20 20 20 20 20 33 2e 31 34 31 31 31 33 32 38 31 32 35 0a 0a 20 20 20 48 65 72 | .4.0)......3.14111328125.....Her |
| 2fea0 | 65 20 69 73 20 61 6e 6f 74 68 65 72 20 65 78 61 6d 70 6c 65 2c 20 75 73 69 6e 67 20 74 68 65 20 | e.is.another.example,.using.the. |
| 2fec0 | 68 61 6c 66 2d 69 6e 74 65 72 76 61 6c 20 6d 65 74 68 6f 64 20 74 6f 20 73 65 61 72 63 68 0a 66 | half-interval.method.to.search.f |
| 2fee0 | 6f 72 20 61 20 72 6f 6f 74 20 6f 66 20 74 68 65 20 65 71 75 61 74 69 6f 6e 20 78 5e 33 20 2d 20 | or.a.root.of.the.equation.x^3.-. |
| 2ff00 | 32 78 20 2d 20 33 20 3d 20 30 20 62 65 74 77 65 65 6e 20 31 20 61 6e 64 20 32 3a 0a 0a 20 20 20 | 2x.-.3.=.0.between.1.and.2:..... |
| 2ff20 | 20 20 28 68 61 6c 66 2d 69 6e 74 65 72 76 61 6c 2d 6d 65 74 68 6f 64 20 28 6c 61 6d 62 64 61 20 | ..(half-interval-method.(lambda. |
| 2ff40 | 28 78 29 20 28 2d 20 28 2a 20 78 20 78 20 78 29 20 28 2a 20 32 20 78 29 20 33 29 29 0a 20 20 20 | (x).(-.(*.x.x.x).(*.2.x).3)).... |
| 2ff60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2e 30 0a 20 20 20 20 | ........................1.0..... |
| 2ff80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2e 30 29 0a 20 20 20 20 | .......................2.0)..... |
| 2ffa0 | 20 31 2e 38 39 33 30 36 36 34 30 36 32 35 0a 0a 46 69 6e 64 69 6e 67 20 66 69 78 65 64 20 70 6f | .1.89306640625..Finding.fixed.po |
| 2ffc0 | 69 6e 74 73 20 6f 66 20 66 75 6e 63 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ints.of.functions............... |
| 2ffe0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 20 6e 75 6d 62 65 72 20 78 20 | .....................A.number.x. |
| 30000 | 69 73 20 63 61 6c 6c 65 64 20 61 20 22 66 69 78 65 64 20 70 6f 69 6e 74 22 20 6f 66 20 61 20 66 | is.called.a."fixed.point".of.a.f |
| 30020 | 75 6e 63 74 69 6f 6e 20 66 20 69 66 20 78 20 73 61 74 69 73 66 69 65 73 20 74 68 65 0a 65 71 75 | unction.f.if.x.satisfies.the.equ |
| 30040 | 61 74 69 6f 6e 20 66 28 78 29 20 3d 20 78 2e 20 20 46 6f 72 20 73 6f 6d 65 20 66 75 6e 63 74 69 | ation.f(x).=.x...For.some.functi |
| 30060 | 6f 6e 73 20 66 20 77 65 20 63 61 6e 20 6c 6f 63 61 74 65 20 61 20 66 69 78 65 64 20 70 6f 69 6e | ons.f.we.can.locate.a.fixed.poin |
| 30080 | 74 20 62 79 0a 62 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 61 6e 20 69 6e 69 74 69 61 6c 20 67 | t.by.beginning.with.an.initial.g |
| 300a0 | 75 65 73 73 20 61 6e 64 20 61 70 70 6c 79 69 6e 67 20 66 20 72 65 70 65 61 74 65 64 6c 79 2c 0a | uess.and.applying.f.repeatedly,. |
| 300c0 | 0a 20 20 20 20 20 66 28 78 29 2c 20 66 28 66 28 78 29 2c 20 28 66 28 66 28 66 28 78 29 29 29 29 | ......f(x),.f(f(x),.(f(f(f(x)))) |
| 300e0 | 0a 0a 75 6e 74 69 6c 20 74 68 65 20 76 61 6c 75 65 20 64 6f 65 73 20 6e 6f 74 20 63 68 61 6e 67 | ..until.the.value.does.not.chang |
| 30100 | 65 20 76 65 72 79 20 6d 75 63 68 2e 20 20 55 73 69 6e 67 20 74 68 69 73 20 69 64 65 61 2c 20 77 | e.very.much...Using.this.idea,.w |
| 30120 | 65 20 63 61 6e 0a 64 65 76 69 73 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 66 69 78 65 64 2d | e.can.devise.a.procedure.`fixed- |
| 30140 | 70 6f 69 6e 74 27 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 73 20 61 20 66 75 | point'.that.takes.as.inputs.a.fu |
| 30160 | 6e 63 74 69 6f 6e 20 61 6e 64 20 61 6e 0a 69 6e 69 74 69 61 6c 20 67 75 65 73 73 20 61 6e 64 20 | nction.and.an.initial.guess.and. |
| 30180 | 70 72 6f 64 75 63 65 73 20 61 6e 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 74 6f 20 61 20 66 | produces.an.approximation.to.a.f |
| 301a0 | 69 78 65 64 20 70 6f 69 6e 74 20 6f 66 20 74 68 65 0a 66 75 6e 63 74 69 6f 6e 2e 20 20 57 65 20 | ixed.point.of.the.function...We. |
| 301c0 | 61 70 70 6c 79 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 72 65 70 65 61 74 65 64 6c 79 20 75 6e | apply.the.function.repeatedly.un |
| 301e0 | 74 69 6c 20 77 65 20 66 69 6e 64 20 74 77 6f 0a 73 75 63 63 65 73 73 69 76 65 20 76 61 6c 75 65 | til.we.find.two.successive.value |
| 30200 | 73 20 77 68 6f 73 65 20 64 69 66 66 65 72 65 6e 63 65 20 69 73 20 6c 65 73 73 20 74 68 61 6e 20 | s.whose.difference.is.less.than. |
| 30220 | 73 6f 6d 65 20 70 72 65 73 63 72 69 62 65 64 0a 74 6f 6c 65 72 61 6e 63 65 3a 0a 0a 20 20 20 20 | some.prescribed.tolerance:...... |
| 30240 | 20 28 64 65 66 69 6e 65 20 74 6f 6c 65 72 61 6e 63 65 20 30 2e 30 30 30 30 31 29 0a 0a 20 20 20 | .(define.tolerance.0.00001)..... |
| 30260 | 20 20 28 64 65 66 69 6e 65 20 28 66 69 78 65 64 2d 70 6f 69 6e 74 20 66 20 66 69 72 73 74 2d 67 | ..(define.(fixed-point.f.first-g |
| 30280 | 75 65 73 73 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6c 6f 73 65 2d 65 6e 6f 75 | uess)........(define.(close-enou |
| 302a0 | 67 68 3f 20 76 31 20 76 32 29 0a 20 20 20 20 20 20 20 20 20 28 3c 20 28 61 62 73 20 28 2d 20 76 | gh?.v1.v2)..........(<.(abs.(-.v |
| 302c0 | 31 20 76 32 29 29 20 74 6f 6c 65 72 61 6e 63 65 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e | 1.v2)).tolerance))........(defin |
| 302e0 | 65 20 28 74 72 79 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 | e.(try.guess)..........(let.((ne |
| 30300 | 78 74 20 28 66 20 67 75 65 73 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 63 | xt.(f.guess)))............(if.(c |
| 30320 | 6c 6f 73 65 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 20 6e 65 78 74 29 0a 20 20 20 20 20 20 20 | lose-enough?.guess.next)........ |
| 30340 | 20 20 20 20 20 20 20 20 6e 65 78 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 72 79 | ........next................(try |
| 30360 | 20 6e 65 78 74 29 29 29 29 0a 20 20 20 20 20 20 20 28 74 72 79 20 66 69 72 73 74 2d 67 75 65 73 | .next))))........(try.first-gues |
| 30380 | 73 29 29 0a 0a 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 75 73 65 20 | s)).....For.example,.we.can.use. |
| 303a0 | 74 68 69 73 20 6d 65 74 68 6f 64 20 74 6f 20 61 70 70 72 6f 78 69 6d 61 74 65 20 74 68 65 20 66 | this.method.to.approximate.the.f |
| 303c0 | 69 78 65 64 20 70 6f 69 6e 74 0a 6f 66 20 74 68 65 20 63 6f 73 69 6e 65 20 66 75 6e 63 74 69 6f | ixed.point.of.the.cosine.functio |
| 303e0 | 6e 2c 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 31 20 61 73 20 61 6e 20 69 6e 69 74 69 61 6c | n,.starting.with.1.as.an.initial |
| 30400 | 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 3a 28 33 29 0a 0a 20 20 20 20 20 28 66 69 78 65 64 2d | .approximation:(3).......(fixed- |
| 30420 | 70 6f 69 6e 74 20 63 6f 73 20 31 2e 30 29 0a 20 20 20 20 20 2e 37 33 39 30 38 32 32 39 38 35 32 | point.cos.1.0).......73908229852 |
| 30440 | 32 34 30 32 33 0a 0a 20 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 77 65 20 63 61 6e 20 66 69 6e 64 | 24023.....Similarly,.we.can.find |
| 30460 | 20 61 20 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 74 68 65 20 65 71 75 61 74 69 6f 6e 20 79 20 3d 20 | .a.solution.to.the.equation.y.=. |
| 30480 | 60 73 69 6e 27 20 79 20 2b 0a 60 63 6f 73 27 20 79 3a 0a 0a 20 20 20 20 20 28 66 69 78 65 64 2d | `sin'.y.+.`cos'.y:.......(fixed- |
| 304a0 | 70 6f 69 6e 74 20 28 6c 61 6d 62 64 61 20 28 79 29 20 28 2b 20 28 73 69 6e 20 79 29 20 28 63 6f | point.(lambda.(y).(+.(sin.y).(co |
| 304c0 | 73 20 79 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2e 30 29 0a 20 20 | s.y)))...................1.0)... |
| 304e0 | 20 20 20 31 2e 32 35 38 37 33 31 35 39 36 32 39 37 31 31 37 33 0a 0a 20 20 20 54 68 65 20 66 69 | ...1.2587315962971173.....The.fi |
| 30500 | 78 65 64 2d 70 6f 69 6e 74 20 70 72 6f 63 65 73 73 20 69 73 20 72 65 6d 69 6e 69 73 63 65 6e 74 | xed-point.process.is.reminiscent |
| 30520 | 20 6f 66 20 74 68 65 20 70 72 6f 63 65 73 73 20 77 65 20 75 73 65 64 20 66 6f 72 0a 66 69 6e 64 | .of.the.process.we.used.for.find |
| 30540 | 69 6e 67 20 73 71 75 61 72 65 20 72 6f 6f 74 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 | ing.square.roots.in.section.*Not |
| 30560 | 65 20 31 2d 31 2d 37 3a 3a 2e 20 20 42 6f 74 68 20 61 72 65 20 62 61 73 65 64 20 6f 6e 20 74 68 | e.1-1-7::...Both.are.based.on.th |
| 30580 | 65 0a 69 64 65 61 20 6f 66 20 72 65 70 65 61 74 65 64 6c 79 20 69 6d 70 72 6f 76 69 6e 67 20 61 | e.idea.of.repeatedly.improving.a |
| 305a0 | 20 67 75 65 73 73 20 75 6e 74 69 6c 20 74 68 65 20 72 65 73 75 6c 74 20 73 61 74 69 73 66 69 65 | .guess.until.the.result.satisfie |
| 305c0 | 73 20 73 6f 6d 65 0a 63 72 69 74 65 72 69 6f 6e 2e 20 20 49 6e 20 66 61 63 74 2c 20 77 65 20 63 | s.some.criterion...In.fact,.we.c |
| 305e0 | 61 6e 20 72 65 61 64 69 6c 79 20 66 6f 72 6d 75 6c 61 74 65 20 74 68 65 20 73 71 75 61 72 65 2d | an.readily.formulate.the.square- |
| 30600 | 72 6f 6f 74 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 20 61 73 20 61 20 66 69 78 65 64 2d 70 6f 69 6e | root.computation.as.a.fixed-poin |
| 30620 | 74 20 73 65 61 72 63 68 2e 20 20 43 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 73 71 75 61 72 65 20 | t.search...Computing.the.square. |
| 30640 | 72 6f 6f 74 20 6f 66 20 73 6f 6d 65 0a 6e 75 6d 62 65 72 20 78 20 72 65 71 75 69 72 65 73 20 66 | root.of.some.number.x.requires.f |
| 30660 | 69 6e 64 69 6e 67 20 61 20 79 20 73 75 63 68 20 74 68 61 74 20 79 5e 32 20 3d 20 78 2e 20 20 50 | inding.a.y.such.that.y^2.=.x...P |
| 30680 | 75 74 74 69 6e 67 20 74 68 69 73 20 65 71 75 61 74 69 6f 6e 0a 69 6e 74 6f 20 74 68 65 20 65 71 | utting.this.equation.into.the.eq |
| 306a0 | 75 69 76 61 6c 65 6e 74 20 66 6f 72 6d 20 79 20 3d 20 78 2f 79 2c 20 77 65 20 72 65 63 6f 67 6e | uivalent.form.y.=.x/y,.we.recogn |
| 306c0 | 69 7a 65 20 74 68 61 74 20 77 65 20 61 72 65 20 6c 6f 6f 6b 69 6e 67 20 66 6f 72 0a 61 20 66 69 | ize.that.we.are.looking.for.a.fi |
| 306e0 | 78 65 64 20 70 6f 69 6e 74 20 6f 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 28 34 29 20 79 20 7c | xed.point.of.the.function(4).y.| |
| 30700 | 2d 3e 20 78 2f 79 2c 20 61 6e 64 20 77 65 20 63 61 6e 20 74 68 65 72 65 66 6f 72 65 20 74 72 79 | ->.x/y,.and.we.can.therefore.try |
| 30720 | 20 74 6f 0a 63 6f 6d 70 75 74 65 20 73 71 75 61 72 65 20 72 6f 6f 74 73 20 61 73 0a 0a 20 20 20 | .to.compute.square.roots.as..... |
| 30740 | 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 20 20 20 20 20 28 66 69 78 65 64 | ..(define.(sqrt.x)........(fixed |
| 30760 | 2d 70 6f 69 6e 74 20 28 6c 61 6d 62 64 61 20 28 79 29 20 28 2f 20 78 20 79 29 29 0a 20 20 20 20 | -point.(lambda.(y).(/.x.y))..... |
| 30780 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2e 30 29 29 0a 0a 20 20 20 55 6e 66 6f 72 74 | ................1.0)).....Unfort |
| 307a0 | 75 6e 61 74 65 6c 79 2c 20 74 68 69 73 20 66 69 78 65 64 2d 70 6f 69 6e 74 20 73 65 61 72 63 68 | unately,.this.fixed-point.search |
| 307c0 | 20 64 6f 65 73 20 6e 6f 74 20 63 6f 6e 76 65 72 67 65 2e 20 20 43 6f 6e 73 69 64 65 72 0a 61 6e | .does.not.converge...Consider.an |
| 307e0 | 20 69 6e 69 74 69 61 6c 20 67 75 65 73 73 20 79 5f 31 2e 20 20 54 68 65 20 6e 65 78 74 20 67 75 | .initial.guess.y_1...The.next.gu |
| 30800 | 65 73 73 20 69 73 20 79 5f 32 20 3d 20 78 2f 79 5f 31 20 61 6e 64 20 74 68 65 20 6e 65 78 74 20 | ess.is.y_2.=.x/y_1.and.the.next. |
| 30820 | 67 75 65 73 73 0a 69 73 20 79 5f 33 20 3d 20 78 2f 79 5f 32 20 3d 20 78 2f 28 78 2f 79 5f 31 29 | guess.is.y_3.=.x/y_2.=.x/(x/y_1) |
| 30840 | 20 3d 20 79 5f 31 2e 20 20 54 68 69 73 20 72 65 73 75 6c 74 73 20 69 6e 20 61 6e 20 69 6e 66 69 | .=.y_1...This.results.in.an.infi |
| 30860 | 6e 69 74 65 20 6c 6f 6f 70 20 69 6e 0a 77 68 69 63 68 20 74 68 65 20 74 77 6f 20 67 75 65 73 73 | nite.loop.in.which.the.two.guess |
| 30880 | 65 73 20 79 5f 31 20 61 6e 64 20 79 5f 32 20 72 65 70 65 61 74 20 6f 76 65 72 20 61 6e 64 20 6f | es.y_1.and.y_2.repeat.over.and.o |
| 308a0 | 76 65 72 2c 20 6f 73 63 69 6c 6c 61 74 69 6e 67 0a 61 62 6f 75 74 20 74 68 65 20 61 6e 73 77 65 | ver,.oscillating.about.the.answe |
| 308c0 | 72 2e 0a 0a 20 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 63 6f 6e 74 72 6f 6c 20 73 75 63 68 20 6f | r......One.way.to.control.such.o |
| 308e0 | 73 63 69 6c 6c 61 74 69 6f 6e 73 20 69 73 20 74 6f 20 70 72 65 76 65 6e 74 20 74 68 65 20 67 75 | scillations.is.to.prevent.the.gu |
| 30900 | 65 73 73 65 73 20 66 72 6f 6d 0a 63 68 61 6e 67 69 6e 67 20 73 6f 20 6d 75 63 68 2e 20 20 53 69 | esses.from.changing.so.much...Si |
| 30920 | 6e 63 65 20 74 68 65 20 61 6e 73 77 65 72 20 69 73 20 61 6c 77 61 79 73 20 62 65 74 77 65 65 6e | nce.the.answer.is.always.between |
| 30940 | 20 6f 75 72 20 67 75 65 73 73 20 79 20 61 6e 64 0a 78 2f 79 2c 20 77 65 20 63 61 6e 20 6d 61 6b | .our.guess.y.and.x/y,.we.can.mak |
| 30960 | 65 20 61 20 6e 65 77 20 67 75 65 73 73 20 74 68 61 74 20 69 73 20 6e 6f 74 20 61 73 20 66 61 72 | e.a.new.guess.that.is.not.as.far |
| 30980 | 20 66 72 6f 6d 20 79 20 61 73 20 78 2f 79 20 62 79 0a 61 76 65 72 61 67 69 6e 67 20 79 20 77 69 | .from.y.as.x/y.by.averaging.y.wi |
| 309a0 | 74 68 20 78 2f 79 2c 20 73 6f 20 74 68 61 74 20 74 68 65 20 6e 65 78 74 20 67 75 65 73 73 20 61 | th.x/y,.so.that.the.next.guess.a |
| 309c0 | 66 74 65 72 20 79 20 69 73 20 28 31 2f 32 29 28 79 20 2b 20 78 2f 79 29 0a 69 6e 73 74 65 61 64 | fter.y.is.(1/2)(y.+.x/y).instead |
| 309e0 | 20 6f 66 20 78 2f 79 2e 20 20 54 68 65 20 70 72 6f 63 65 73 73 20 6f 66 20 6d 61 6b 69 6e 67 20 | .of.x/y...The.process.of.making. |
| 30a00 | 73 75 63 68 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 67 75 65 73 73 65 73 20 69 73 0a 73 69 | such.a.sequence.of.guesses.is.si |
| 30a20 | 6d 70 6c 79 20 74 68 65 20 70 72 6f 63 65 73 73 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 66 6f 72 20 | mply.the.process.of.looking.for. |
| 30a40 | 61 20 66 69 78 65 64 20 70 6f 69 6e 74 20 6f 66 20 79 20 7c 2d 3e 20 28 31 2f 32 29 28 79 20 2b | a.fixed.point.of.y.|->.(1/2)(y.+ |
| 30a60 | 20 78 2f 79 29 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 | .x/y):.......(define.(sqrt.x)... |
| 30a80 | 20 20 20 20 20 28 66 69 78 65 64 2d 70 6f 69 6e 74 20 28 6c 61 6d 62 64 61 20 28 79 29 20 28 61 | .....(fixed-point.(lambda.(y).(a |
| 30aa0 | 76 65 72 61 67 65 20 79 20 28 2f 20 78 20 79 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | verage.y.(/.x.y))).............. |
| 30ac0 | 20 20 20 20 20 20 20 31 2e 30 29 29 0a 0a 20 20 20 28 4e 6f 74 65 20 74 68 61 74 20 79 20 3d 20 | .......1.0)).....(Note.that.y.=. |
| 30ae0 | 28 31 2f 32 29 28 79 20 2b 20 78 2f 79 29 20 69 73 20 61 20 73 69 6d 70 6c 65 20 74 72 61 6e 73 | (1/2)(y.+.x/y).is.a.simple.trans |
| 30b00 | 66 6f 72 6d 61 74 69 6f 6e 20 6f 66 20 74 68 65 0a 65 71 75 61 74 69 6f 6e 20 79 20 3d 20 78 2f | formation.of.the.equation.y.=.x/ |
| 30b20 | 79 3b 20 74 6f 20 64 65 72 69 76 65 20 69 74 2c 20 61 64 64 20 79 20 74 6f 20 62 6f 74 68 20 73 | y;.to.derive.it,.add.y.to.both.s |
| 30b40 | 69 64 65 73 20 6f 66 20 74 68 65 20 65 71 75 61 74 69 6f 6e 20 61 6e 64 0a 64 69 76 69 64 65 20 | ides.of.the.equation.and.divide. |
| 30b60 | 62 79 20 32 2e 29 0a 0a 20 20 20 57 69 74 68 20 74 68 69 73 20 6d 6f 64 69 66 69 63 61 74 69 6f | by.2.).....With.this.modificatio |
| 30b80 | 6e 2c 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 20 77 6f 72 | n,.the.square-root.procedure.wor |
| 30ba0 | 6b 73 2e 20 20 49 6e 20 66 61 63 74 2c 0a 69 66 20 77 65 20 75 6e 72 61 76 65 6c 20 74 68 65 20 | ks...In.fact,.if.we.unravel.the. |
| 30bc0 | 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 77 65 20 63 61 6e 20 73 65 65 20 74 68 61 74 20 74 68 65 | definitions,.we.can.see.that.the |
| 30be0 | 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 74 6f 20 74 | .sequence.of.approximations.to.t |
| 30c00 | 68 65 20 73 71 75 61 72 65 20 72 6f 6f 74 20 67 65 6e 65 72 61 74 65 64 20 68 65 72 65 20 69 73 | he.square.root.generated.here.is |
| 30c20 | 20 70 72 65 63 69 73 65 6c 79 20 74 68 65 20 73 61 6d 65 0a 61 73 20 74 68 65 20 6f 6e 65 20 67 | .precisely.the.same.as.the.one.g |
| 30c40 | 65 6e 65 72 61 74 65 64 20 62 79 20 6f 75 72 20 6f 72 69 67 69 6e 61 6c 20 73 71 75 61 72 65 2d | enerated.by.our.original.square- |
| 30c60 | 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 | root.procedure.of.section.*Note. |
| 30c80 | 31 2d 31 2d 37 3a 3a 2e 20 20 54 68 69 73 20 61 70 70 72 6f 61 63 68 20 6f 66 20 61 76 65 72 61 | 1-1-7::...This.approach.of.avera |
| 30ca0 | 67 69 6e 67 20 73 75 63 63 65 73 73 69 76 65 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 74 | ging.successive.approximations.t |
| 30cc0 | 6f 0a 61 20 73 6f 6c 75 74 69 6f 6e 2c 20 61 20 74 65 63 68 6e 69 71 75 65 20 77 65 20 74 68 61 | o.a.solution,.a.technique.we.tha |
| 30ce0 | 74 20 77 65 20 63 61 6c 6c 20 22 61 76 65 72 61 67 65 20 64 61 6d 70 69 6e 67 22 2c 20 6f 66 74 | t.we.call."average.damping",.oft |
| 30d00 | 65 6e 20 61 69 64 73 0a 74 68 65 20 63 6f 6e 76 65 72 67 65 6e 63 65 20 6f 66 20 66 69 78 65 64 | en.aids.the.convergence.of.fixed |
| 30d20 | 2d 70 6f 69 6e 74 20 73 65 61 72 63 68 65 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | -point.searches........*Exercise |
| 30d40 | 20 31 2e 33 35 3a 2a 20 53 68 6f 77 20 74 68 61 74 20 74 68 65 20 67 6f 6c 64 65 6e 20 72 61 74 | .1.35:*.Show.that.the.golden.rat |
| 30d60 | 69 6f 20 5b 70 68 69 5d 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 31 2d 32 | io.[phi].(section.*Note......1-2 |
| 30d80 | 2d 32 3a 3a 29 20 69 73 20 61 20 66 69 78 65 64 20 70 6f 69 6e 74 20 6f 66 20 74 68 65 20 74 72 | -2::).is.a.fixed.point.of.the.tr |
| 30da0 | 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 78 20 7c 2d 3e 20 31 20 2b 20 31 2f 78 2c 20 61 6e 64 0a | ansformation.x.|->.1.+.1/x,.and. |
| 30dc0 | 20 20 20 20 20 75 73 65 20 74 68 69 73 20 66 61 63 74 20 74 6f 20 63 6f 6d 70 75 74 65 20 5b 70 | .....use.this.fact.to.compute.[p |
| 30de0 | 68 69 5d 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 74 68 65 20 60 66 69 78 65 64 2d 70 6f 69 6e 74 | hi].by.means.of.the.`fixed-point |
| 30e00 | 27 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | '......procedure........*Exercis |
| 30e20 | 65 20 31 2e 33 36 3a 2a 20 4d 6f 64 69 66 79 20 60 66 69 78 65 64 2d 70 6f 69 6e 74 27 20 73 6f | e.1.36:*.Modify.`fixed-point'.so |
| 30e40 | 20 74 68 61 74 20 69 74 20 70 72 69 6e 74 73 20 74 68 65 0a 20 20 20 20 20 73 65 71 75 65 6e 63 | .that.it.prints.the......sequenc |
| 30e60 | 65 20 6f 66 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 69 74 20 67 65 6e 65 72 61 74 65 73 | e.of.approximations.it.generates |
| 30e80 | 2c 20 75 73 69 6e 67 20 74 68 65 20 60 6e 65 77 6c 69 6e 65 27 20 61 6e 64 0a 20 20 20 20 20 60 | ,.using.the.`newline'.and......` |
| 30ea0 | 64 69 73 70 6c 61 79 27 20 70 72 69 6d 69 74 69 76 65 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f | display'.primitives.shown.in.*No |
| 30ec0 | 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 32 32 3a 3a 2e 20 20 54 68 65 6e 20 66 69 6e 64 20 61 | te.Exercise.1-22::...Then.find.a |
| 30ee0 | 0a 20 20 20 20 20 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 78 5e 78 20 3d 20 31 30 30 30 20 62 79 20 | ......solution.to.x^x.=.1000.by. |
| 30f00 | 66 69 6e 64 69 6e 67 20 61 20 66 69 78 65 64 20 70 6f 69 6e 74 20 6f 66 20 78 20 7c 2d 3e 0a 20 | finding.a.fixed.point.of.x.|->.. |
| 30f20 | 20 20 20 20 60 6c 6f 67 27 28 31 30 30 30 29 2f 60 6c 6f 67 27 28 78 29 2e 20 20 28 55 73 65 20 | ....`log'(1000)/`log'(x)...(Use. |
| 30f40 | 53 63 68 65 6d 65 27 73 20 70 72 69 6d 69 74 69 76 65 20 60 6c 6f 67 27 20 70 72 6f 63 65 64 75 | Scheme's.primitive.`log'.procedu |
| 30f60 | 72 65 2c 0a 20 20 20 20 20 77 68 69 63 68 20 63 6f 6d 70 75 74 65 73 20 6e 61 74 75 72 61 6c 20 | re,......which.computes.natural. |
| 30f80 | 6c 6f 67 61 72 69 74 68 6d 73 2e 29 20 20 43 6f 6d 70 61 72 65 20 74 68 65 20 6e 75 6d 62 65 72 | logarithms.)..Compare.the.number |
| 30fa0 | 20 6f 66 20 73 74 65 70 73 0a 20 20 20 20 20 74 68 69 73 20 74 61 6b 65 73 20 77 69 74 68 20 61 | .of.steps......this.takes.with.a |
| 30fc0 | 6e 64 20 77 69 74 68 6f 75 74 20 61 76 65 72 61 67 65 20 64 61 6d 70 69 6e 67 2e 20 20 28 4e 6f | nd.without.average.damping...(No |
| 30fe0 | 74 65 20 74 68 61 74 20 79 6f 75 0a 20 20 20 20 20 63 61 6e 6e 6f 74 20 73 74 61 72 74 20 60 66 | te.that.you......cannot.start.`f |
| 31000 | 69 78 65 64 2d 70 6f 69 6e 74 27 20 77 69 74 68 20 61 20 67 75 65 73 73 20 6f 66 20 31 2c 20 61 | ixed-point'.with.a.guess.of.1,.a |
| 31020 | 73 20 74 68 69 73 20 77 6f 75 6c 64 20 63 61 75 73 65 0a 20 20 20 20 20 64 69 76 69 73 69 6f 6e | s.this.would.cause......division |
| 31040 | 20 62 79 20 60 6c 6f 67 27 28 31 29 20 3d 20 30 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | .by.`log'(1).=.0.).......*Exerci |
| 31060 | 73 65 20 31 2e 33 37 3a 2a 0a 20 20 20 20 20 20 20 61 2e 20 41 6e 20 69 6e 66 69 6e 69 74 65 20 | se.1.37:*........a..An.infinite. |
| 31080 | 22 63 6f 6e 74 69 6e 75 65 64 20 66 72 61 63 74 69 6f 6e 22 20 69 73 20 61 6e 20 65 78 70 72 65 | "continued.fraction".is.an.expre |
| 310a0 | 73 73 69 6f 6e 20 6f 66 20 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ssion.of.the.form............... |
| 310c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 4e 5f 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............N_1................ |
| 310e0 | 66 20 3d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 | f.=.---------------------....... |
| 31100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4e 5f 32 0a 20 20 20 20 | ........................N_2..... |
| 31120 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 44 5f 31 20 2b 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ...............D_1.+.----------- |
| 31140 | 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ----............................ |
| 31160 | 20 20 20 20 20 20 20 4e 5f 33 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......N_3...................... |
| 31180 | 20 20 20 20 44 5f 32 20 2b 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ....D_2.+.---------............. |
| 311a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 44 5f 33 20 2b 20 2e 2e 2e 0a 0a 20 20 | ...................D_3.+........ |
| 311c0 | 20 20 20 20 20 20 20 20 41 73 20 61 6e 20 65 78 61 6d 70 6c 65 2c 20 6f 6e 65 20 63 61 6e 20 73 | ........As.an.example,.one.can.s |
| 311e0 | 68 6f 77 20 74 68 61 74 20 74 68 65 20 69 6e 66 69 6e 69 74 65 20 63 6f 6e 74 69 6e 75 65 64 0a | how.that.the.infinite.continued. |
| 31200 | 20 20 20 20 20 20 20 20 20 20 66 72 61 63 74 69 6f 6e 20 65 78 70 61 6e 73 69 6f 6e 20 77 69 74 | ..........fraction.expansion.wit |
| 31220 | 68 20 74 68 65 20 6e 5f 69 20 61 6e 64 20 74 68 65 20 44 5f 69 20 61 6c 6c 20 65 71 75 61 6c 20 | h.the.n_i.and.the.D_i.all.equal. |
| 31240 | 74 6f 20 31 0a 20 20 20 20 20 20 20 20 20 20 70 72 6f 64 75 63 65 73 20 31 2f 5b 70 68 69 5d 2c | to.1...........produces.1/[phi], |
| 31260 | 20 77 68 65 72 65 20 5b 70 68 69 5d 20 69 73 20 74 68 65 20 67 6f 6c 64 65 6e 20 72 61 74 69 6f | .where.[phi].is.the.golden.ratio |
| 31280 | 20 28 64 65 73 63 72 69 62 65 64 0a 20 20 20 20 20 20 20 20 20 20 69 6e 20 73 65 63 74 69 6f 6e | .(described...........in.section |
| 312a0 | 20 2a 4e 6f 74 65 20 31 2d 32 2d 32 3a 3a 29 2e 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 61 70 70 | .*Note.1-2-2::)...One.way.to.app |
| 312c0 | 72 6f 78 69 6d 61 74 65 20 61 6e 0a 20 20 20 20 20 20 20 20 20 20 69 6e 66 69 6e 69 74 65 20 63 | roximate.an...........infinite.c |
| 312e0 | 6f 6e 74 69 6e 75 65 64 20 66 72 61 63 74 69 6f 6e 20 69 73 20 74 6f 20 74 72 75 6e 63 61 74 65 | ontinued.fraction.is.to.truncate |
| 31300 | 20 74 68 65 20 65 78 70 61 6e 73 69 6f 6e 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 20 61 | .the.expansion...........after.a |
| 31320 | 20 67 69 76 65 6e 20 6e 75 6d 62 65 72 20 6f 66 20 74 65 72 6d 73 2e 20 20 53 75 63 68 20 61 20 | .given.number.of.terms...Such.a. |
| 31340 | 74 72 75 6e 63 61 74 69 6f 6e 2d 2d 61 0a 20 20 20 20 20 20 20 20 20 20 73 6f 2d 63 61 6c 6c 65 | truncation--a...........so-calle |
| 31360 | 64 20 66 69 6e 69 74 65 20 63 6f 6e 74 69 6e 75 65 64 20 66 72 61 63 74 69 6f 6e 20 22 6b 2d 74 | d.finite.continued.fraction."k-t |
| 31380 | 65 72 6d 20 66 69 6e 69 74 65 20 63 6f 6e 74 69 6e 75 65 64 0a 20 20 20 20 20 20 20 20 20 20 66 | erm.finite.continued...........f |
| 313a0 | 72 61 63 74 69 6f 6e 22 2d 2d 68 61 73 20 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 20 20 20 | raction"--has.the.form.......... |
| 313c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4e 5f 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............N_1............... |
| 313e0 | 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .-----------------.............. |
| 31400 | 20 20 20 20 20 20 20 20 20 20 20 20 4e 5f 32 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 44 | ............N_2................D |
| 31420 | 5f 31 20 2b 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | _1.+.-----------................ |
| 31440 | 20 20 20 20 20 20 2e 2e 2e 20 20 20 20 4e 5f 4b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............N_K................ |
| 31460 | 20 20 20 20 20 20 20 20 20 20 2b 20 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..........+.-----............... |
| 31480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 44 5f 4b 0a 0a 20 20 20 20 20 20 20 20 20 20 53 75 70 | ..............D_K............Sup |
| 314a0 | 70 6f 73 65 20 74 68 61 74 20 60 6e 27 20 61 6e 64 20 60 64 27 20 61 72 65 20 70 72 6f 63 65 64 | pose.that.`n'.and.`d'.are.proced |
| 314c0 | 75 72 65 73 20 6f 66 20 6f 6e 65 20 61 72 67 75 6d 65 6e 74 20 28 74 68 65 0a 20 20 20 20 20 20 | ures.of.one.argument.(the....... |
| 314e0 | 20 20 20 20 74 65 72 6d 20 69 6e 64 65 78 20 69 29 20 74 68 61 74 20 72 65 74 75 72 6e 20 74 68 | ....term.index.i).that.return.th |
| 31500 | 65 20 6e 5f 69 20 61 6e 64 20 44 5f 69 20 6f 66 20 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 | e.n_i.and.D_i.of.the.terms.of.th |
| 31520 | 65 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6e 74 69 6e 75 65 64 20 66 72 61 63 74 69 6f 6e 2e 20 | e...........continued.fraction.. |
| 31540 | 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 63 6f 6e 74 2d 66 72 61 63 27 20 | .Define.a.procedure.`cont-frac'. |
| 31560 | 73 75 63 68 20 74 68 61 74 0a 20 20 20 20 20 20 20 20 20 20 65 76 61 6c 75 61 74 69 6e 67 20 60 | such.that...........evaluating.` |
| 31580 | 28 63 6f 6e 74 2d 66 72 61 63 20 6e 20 64 20 6b 29 27 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 | (cont-frac.n.d.k)'.computes.the. |
| 315a0 | 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 6b 2d 74 65 72 6d 20 66 69 | value.of.the...........k-term.fi |
| 315c0 | 6e 69 74 65 20 63 6f 6e 74 69 6e 75 65 64 20 66 72 61 63 74 69 6f 6e 2e 20 20 43 68 65 63 6b 20 | nite.continued.fraction...Check. |
| 315e0 | 79 6f 75 72 20 70 72 6f 63 65 64 75 72 65 20 62 79 0a 20 20 20 20 20 20 20 20 20 20 61 70 70 72 | your.procedure.by...........appr |
| 31600 | 6f 78 69 6d 61 74 69 6e 67 20 31 2f 5b 70 68 69 5d 20 75 73 69 6e 67 0a 0a 20 20 20 20 20 20 20 | oximating.1/[phi].using......... |
| 31620 | 20 20 20 20 20 20 20 20 28 63 6f 6e 74 2d 66 72 61 63 20 28 6c 61 6d 62 64 61 20 28 69 29 20 31 | ........(cont-frac.(lambda.(i).1 |
| 31640 | 2e 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .0)...........................(l |
| 31660 | 61 6d 62 64 61 20 28 69 29 20 31 2e 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ambda.(i).1.0).................. |
| 31680 | 20 20 20 20 20 20 20 20 20 6b 29 0a 0a 20 20 20 20 20 20 20 20 20 20 66 6f 72 20 73 75 63 63 65 | .........k)............for.succe |
| 316a0 | 73 73 69 76 65 20 76 61 6c 75 65 73 20 6f 66 20 60 6b 27 2e 20 20 48 6f 77 20 6c 61 72 67 65 20 | ssive.values.of.`k'...How.large. |
| 316c0 | 6d 75 73 74 20 79 6f 75 20 6d 61 6b 65 20 60 6b 27 20 69 6e 0a 20 20 20 20 20 20 20 20 20 20 6f | must.you.make.`k'.in...........o |
| 316e0 | 72 64 65 72 20 74 6f 20 67 65 74 20 61 6e 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 74 68 61 | rder.to.get.an.approximation.tha |
| 31700 | 74 20 69 73 20 61 63 63 75 72 61 74 65 20 74 6f 20 34 20 64 65 63 69 6d 61 6c 0a 20 20 20 20 20 | t.is.accurate.to.4.decimal...... |
| 31720 | 20 20 20 20 20 70 6c 61 63 65 73 3f 0a 0a 20 20 20 20 20 20 20 62 2e 20 49 66 20 79 6f 75 72 20 | .....places?.........b..If.your. |
| 31740 | 60 63 6f 6e 74 2d 66 72 61 63 27 20 70 72 6f 63 65 64 75 72 65 20 67 65 6e 65 72 61 74 65 73 20 | `cont-frac'.procedure.generates. |
| 31760 | 61 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 2c 0a 20 20 20 20 20 20 20 20 20 20 77 | a.recursive.process,...........w |
| 31780 | 72 69 74 65 20 6f 6e 65 20 74 68 61 74 20 67 65 6e 65 72 61 74 65 73 20 61 6e 20 69 74 65 72 61 | rite.one.that.generates.an.itera |
| 317a0 | 74 69 76 65 20 70 72 6f 63 65 73 73 2e 20 20 49 66 20 69 74 0a 20 20 20 20 20 20 20 20 20 20 67 | tive.process...If.it...........g |
| 317c0 | 65 6e 65 72 61 74 65 73 20 61 6e 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 2c 20 77 | enerates.an.iterative.process,.w |
| 317e0 | 72 69 74 65 20 6f 6e 65 20 74 68 61 74 20 67 65 6e 65 72 61 74 65 73 20 61 0a 20 20 20 20 20 20 | rite.one.that.generates.a....... |
| 31800 | 20 20 20 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 2e 0a 0a 0a 20 20 20 20 20 2a 45 | ....recursive.process.........*E |
| 31820 | 78 65 72 63 69 73 65 20 31 2e 33 38 3a 2a 20 49 6e 20 31 37 33 37 2c 20 74 68 65 20 53 77 69 73 | xercise.1.38:*.In.1737,.the.Swis |
| 31840 | 73 20 6d 61 74 68 65 6d 61 74 69 63 69 61 6e 20 4c 65 6f 6e 68 61 72 64 20 45 75 6c 65 72 0a 20 | s.mathematician.Leonhard.Euler.. |
| 31860 | 20 20 20 20 70 75 62 6c 69 73 68 65 64 20 61 20 6d 65 6d 6f 69 72 20 60 44 65 20 46 72 61 63 74 | ....published.a.memoir.`De.Fract |
| 31880 | 69 6f 6e 69 62 75 73 20 43 6f 6e 74 69 6e 75 69 73 27 2c 20 77 68 69 63 68 20 69 6e 63 6c 75 64 | ionibus.Continuis',.which.includ |
| 318a0 | 65 64 20 61 0a 20 20 20 20 20 63 6f 6e 74 69 6e 75 65 64 20 66 72 61 63 74 69 6f 6e 20 65 78 70 | ed.a......continued.fraction.exp |
| 318c0 | 61 6e 73 69 6f 6e 20 66 6f 72 20 65 20 2d 20 32 2c 20 77 68 65 72 65 20 65 20 69 73 20 74 68 65 | ansion.for.e.-.2,.where.e.is.the |
| 318e0 | 20 62 61 73 65 20 6f 66 20 74 68 65 0a 20 20 20 20 20 6e 61 74 75 72 61 6c 20 6c 6f 67 61 72 69 | .base.of.the......natural.logari |
| 31900 | 74 68 6d 73 2e 20 20 49 6e 20 74 68 69 73 20 66 72 61 63 74 69 6f 6e 2c 20 74 68 65 20 6e 5f 69 | thms...In.this.fraction,.the.n_i |
| 31920 | 20 61 72 65 20 61 6c 6c 20 31 2c 20 61 6e 64 20 74 68 65 0a 20 20 20 20 20 44 5f 69 20 61 72 65 | .are.all.1,.and.the......D_i.are |
| 31940 | 20 73 75 63 63 65 73 73 69 76 65 6c 79 20 31 2c 20 32 2c 20 31 2c 20 31 2c 20 34 2c 20 31 2c 20 | .successively.1,.2,.1,.1,.4,.1,. |
| 31960 | 31 2c 20 36 2c 20 31 2c 20 31 2c 20 38 2c 20 2e 2e 2e 2e 20 20 57 72 69 74 65 0a 20 20 20 20 20 | 1,.6,.1,.1,.8,.......Write...... |
| 31980 | 61 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 75 73 65 73 20 79 6f 75 72 20 60 63 6f 6e 74 2d 66 | a.program.that.uses.your.`cont-f |
| 319a0 | 72 61 63 27 20 70 72 6f 63 65 64 75 72 65 20 66 72 6f 6d 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 | rac'.procedure.from.*Note.Exerci |
| 319c0 | 73 65 0a 20 20 20 20 20 31 2d 33 37 3a 3a 20 74 6f 20 61 70 70 72 6f 78 69 6d 61 74 65 20 65 2c | se......1-37::.to.approximate.e, |
| 319e0 | 20 62 61 73 65 64 20 6f 6e 20 45 75 6c 65 72 27 73 20 65 78 70 61 6e 73 69 6f 6e 2e 0a 0a 20 20 | .based.on.Euler's.expansion..... |
| 31a00 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 33 39 3a 2a 20 41 20 63 6f 6e 74 69 6e 75 65 64 20 | ...*Exercise.1.39:*.A.continued. |
| 31a20 | 66 72 61 63 74 69 6f 6e 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 0a 20 | fraction.representation.of.the.. |
| 31a40 | 20 20 20 20 74 61 6e 67 65 6e 74 20 66 75 6e 63 74 69 6f 6e 20 77 61 73 20 70 75 62 6c 69 73 68 | ....tangent.function.was.publish |
| 31a60 | 65 64 20 69 6e 20 31 37 37 30 20 62 79 20 74 68 65 20 47 65 72 6d 61 6e 20 6d 61 74 68 65 6d 61 | ed.in.1770.by.the.German.mathema |
| 31a80 | 74 69 63 69 61 6e 0a 20 20 20 20 20 4a 2e 48 2e 20 4c 61 6d 62 65 72 74 3a 0a 0a 20 20 20 20 20 | tician......J.H..Lambert:....... |
| 31aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 0a 20 20 20 20 20 20 20 20 20 20 74 | ...................x...........t |
| 31ac0 | 61 6e 20 78 20 3d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 | an.x.=.---------------.......... |
| 31ae0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 5e 32 0a 20 20 20 20 20 20 20 20 20 20 20 | .................x^2............ |
| 31b00 | 20 20 20 20 20 20 20 31 20 2d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 | .......1.-.-----------.......... |
| 31b20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 5e 32 0a 20 20 20 20 20 20 20 20 20 | ...................x^2.......... |
| 31b40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 33 20 2d 20 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 | .............3.-.-------........ |
| 31b60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 20 2d 20 2e 2e 2e 0a 0a 20 20 20 20 | ...................5.-.......... |
| 31b80 | 20 77 68 65 72 65 20 78 20 69 73 20 69 6e 20 72 61 64 69 61 6e 73 2e 20 20 44 65 66 69 6e 65 20 | .where.x.is.in.radians...Define. |
| 31ba0 | 61 20 70 72 6f 63 65 64 75 72 65 20 60 28 74 61 6e 2d 63 66 20 78 20 6b 29 27 20 74 68 61 74 0a | a.procedure.`(tan-cf.x.k)'.that. |
| 31bc0 | 20 20 20 20 20 63 6f 6d 70 75 74 65 73 20 61 6e 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 74 | .....computes.an.approximation.t |
| 31be0 | 6f 20 74 68 65 20 74 61 6e 67 65 6e 74 20 66 75 6e 63 74 69 6f 6e 20 62 61 73 65 64 20 6f 6e 0a | o.the.tangent.function.based.on. |
| 31c00 | 20 20 20 20 20 4c 61 6d 62 65 72 74 27 73 20 66 6f 72 6d 75 6c 61 2e 20 20 60 4b 27 20 73 70 65 | .....Lambert's.formula...`K'.spe |
| 31c20 | 63 69 66 69 65 73 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 74 65 72 6d 73 20 74 6f 20 63 6f | cifies.the.number.of.terms.to.co |
| 31c40 | 6d 70 75 74 65 2c 0a 20 20 20 20 20 61 73 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | mpute,......as.in.*Note.Exercise |
| 31c60 | 20 31 2d 33 37 3a 3a 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 | .1-37::......----------.Footnote |
| 31c80 | 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 57 65 20 68 61 76 65 20 75 73 65 | s.----------.....(1).We.have.use |
| 31ca0 | 64 20 30 2e 30 30 31 20 61 73 20 61 20 72 65 70 72 65 73 65 6e 74 61 74 69 76 65 20 22 73 6d 61 | d.0.001.as.a.representative."sma |
| 31cc0 | 6c 6c 22 20 6e 75 6d 62 65 72 20 74 6f 0a 69 6e 64 69 63 61 74 65 20 61 20 74 6f 6c 65 72 61 6e | ll".number.to.indicate.a.toleran |
| 31ce0 | 63 65 20 66 6f 72 20 74 68 65 20 61 63 63 65 70 74 61 62 6c 65 20 65 72 72 6f 72 20 69 6e 20 61 | ce.for.the.acceptable.error.in.a |
| 31d00 | 20 63 61 6c 63 75 6c 61 74 69 6f 6e 2e 20 20 54 68 65 0a 61 70 70 72 6f 70 72 69 61 74 65 20 74 | .calculation...The.appropriate.t |
| 31d20 | 6f 6c 65 72 61 6e 63 65 20 66 6f 72 20 61 20 72 65 61 6c 20 63 61 6c 63 75 6c 61 74 69 6f 6e 20 | olerance.for.a.real.calculation. |
| 31d40 | 64 65 70 65 6e 64 73 20 75 70 6f 6e 20 74 68 65 20 70 72 6f 62 6c 65 6d 0a 74 6f 20 62 65 20 73 | depends.upon.the.problem.to.be.s |
| 31d60 | 6f 6c 76 65 64 20 61 6e 64 20 74 68 65 20 6c 69 6d 69 74 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 | olved.and.the.limitations.of.the |
| 31d80 | 20 63 6f 6d 70 75 74 65 72 20 61 6e 64 20 74 68 65 20 61 6c 67 6f 72 69 74 68 6d 2e 0a 54 68 69 | .computer.and.the.algorithm..Thi |
| 31da0 | 73 20 69 73 20 6f 66 74 65 6e 20 61 20 76 65 72 79 20 73 75 62 74 6c 65 20 63 6f 6e 73 69 64 65 | s.is.often.a.very.subtle.conside |
| 31dc0 | 72 61 74 69 6f 6e 2c 20 72 65 71 75 69 72 69 6e 67 20 68 65 6c 70 20 66 72 6f 6d 20 61 0a 6e 75 | ration,.requiring.help.from.a.nu |
| 31de0 | 6d 65 72 69 63 61 6c 20 61 6e 61 6c 79 73 74 20 6f 72 20 73 6f 6d 65 20 6f 74 68 65 72 20 6b 69 | merical.analyst.or.some.other.ki |
| 31e00 | 6e 64 20 6f 66 20 6d 61 67 69 63 69 61 6e 2e 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 63 61 6e | nd.of.magician......(2).This.can |
| 31e20 | 20 62 65 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 75 73 69 6e 67 20 60 65 72 72 6f 72 27 2c 20 | .be.accomplished.using.`error',. |
| 31e40 | 77 68 69 63 68 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 0a 61 20 6e 75 6d 62 65 | which.takes.as.arguments.a.numbe |
| 31e60 | 72 20 6f 66 20 69 74 65 6d 73 20 74 68 61 74 20 61 72 65 20 70 72 69 6e 74 65 64 20 61 73 20 65 | r.of.items.that.are.printed.as.e |
| 31e80 | 72 72 6f 72 20 6d 65 73 73 61 67 65 73 2e 0a 0a 20 20 20 28 33 29 20 54 72 79 20 74 68 69 73 20 | rror.messages......(3).Try.this. |
| 31ea0 | 64 75 72 69 6e 67 20 61 20 62 6f 72 69 6e 67 20 6c 65 63 74 75 72 65 3a 20 53 65 74 20 79 6f 75 | during.a.boring.lecture:.Set.you |
| 31ec0 | 72 20 63 61 6c 63 75 6c 61 74 6f 72 20 74 6f 20 72 61 64 69 61 6e 73 0a 6d 6f 64 65 20 61 6e 64 | r.calculator.to.radians.mode.and |
| 31ee0 | 20 74 68 65 6e 20 72 65 70 65 61 74 65 64 6c 79 20 70 72 65 73 73 20 74 68 65 20 60 63 6f 73 27 | .then.repeatedly.press.the.`cos' |
| 31f00 | 20 62 75 74 74 6f 6e 20 75 6e 74 69 6c 20 79 6f 75 20 6f 62 74 61 69 6e 20 74 68 65 0a 66 69 78 | .button.until.you.obtain.the.fix |
| 31f20 | 65 64 20 70 6f 69 6e 74 2e 0a 0a 20 20 20 28 34 29 20 7c 2d 3e 20 28 70 72 6f 6e 6f 75 6e 63 65 | ed.point......(4).|->.(pronounce |
| 31f40 | 64 20 22 6d 61 70 73 20 74 6f 22 29 20 69 73 20 74 68 65 20 6d 61 74 68 65 6d 61 74 69 63 69 61 | d."maps.to").is.the.mathematicia |
| 31f60 | 6e 27 73 20 77 61 79 20 6f 66 20 77 72 69 74 69 6e 67 0a 60 6c 61 6d 62 64 61 27 2e 20 20 79 20 | n's.way.of.writing.`lambda'...y. |
| 31f80 | 7c 2d 3e 20 78 2f 79 20 6d 65 61 6e 73 20 60 28 6c 61 6d 62 64 61 28 79 29 20 28 2f 20 78 20 79 | |->.x/y.means.`(lambda(y).(/.x.y |
| 31fa0 | 29 29 27 2c 20 74 68 61 74 20 69 73 2c 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 0a 77 68 6f 73 65 | ))',.that.is,.the.function.whose |
| 31fc0 | 20 76 61 6c 75 65 20 61 74 20 79 20 69 73 20 78 2f 79 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 | .value.at.y.is.x/y.....File:.sic |
| 31fe0 | 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 31 2d 33 2d 34 2c 20 20 50 72 65 76 3a 20 31 2d 33 | p.info,..Node:.1-3-4,..Prev:.1-3 |
| 32000 | 2d 33 2c 20 20 55 70 3a 20 31 2d 33 0a 0a 31 2e 33 2e 34 20 50 72 6f 63 65 64 75 72 65 73 20 61 | -3,..Up:.1-3..1.3.4.Procedures.a |
| 32020 | 73 20 52 65 74 75 72 6e 65 64 20 56 61 6c 75 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | s.Returned.Values.-------------- |
| 32040 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 61 62 6f 76 65 | ---------------------..The.above |
| 32060 | 20 65 78 61 6d 70 6c 65 73 20 64 65 6d 6f 6e 73 74 72 61 74 65 20 68 6f 77 20 74 68 65 20 61 62 | .examples.demonstrate.how.the.ab |
| 32080 | 69 6c 69 74 79 20 74 6f 20 70 61 73 73 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 0a 61 72 67 75 | ility.to.pass.procedures.as.argu |
| 320a0 | 6d 65 6e 74 73 20 73 69 67 6e 69 66 69 63 61 6e 74 6c 79 20 65 6e 68 61 6e 63 65 73 20 74 68 65 | ments.significantly.enhances.the |
| 320c0 | 20 65 78 70 72 65 73 73 69 76 65 20 70 6f 77 65 72 20 6f 66 20 6f 75 72 0a 70 72 6f 67 72 61 6d | .expressive.power.of.our.program |
| 320e0 | 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 20 20 57 65 20 63 61 6e 20 61 63 68 69 65 76 65 20 65 | ming.language...We.can.achieve.e |
| 32100 | 76 65 6e 20 6d 6f 72 65 20 65 78 70 72 65 73 73 69 76 65 20 70 6f 77 65 72 20 62 79 0a 63 72 65 | ven.more.expressive.power.by.cre |
| 32120 | 61 74 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 77 68 6f 73 65 20 72 65 74 75 72 6e 65 64 20 | ating.procedures.whose.returned. |
| 32140 | 76 61 6c 75 65 73 20 61 72 65 20 74 68 65 6d 73 65 6c 76 65 73 20 70 72 6f 63 65 64 75 72 65 73 | values.are.themselves.procedures |
| 32160 | 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 69 73 20 69 64 65 | ......We.can.illustrate.this.ide |
| 32180 | 61 20 62 79 20 6c 6f 6f 6b 69 6e 67 20 61 67 61 69 6e 20 61 74 20 74 68 65 20 66 69 78 65 64 2d | a.by.looking.again.at.the.fixed- |
| 321a0 | 70 6f 69 6e 74 0a 65 78 61 6d 70 6c 65 20 64 65 73 63 72 69 62 65 64 20 61 74 20 74 68 65 20 65 | point.example.described.at.the.e |
| 321c0 | 6e 64 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 33 2d 33 3a 3a 2e 20 20 57 65 | nd.of.section.*Note.1-3-3::...We |
| 321e0 | 20 66 6f 72 6d 75 6c 61 74 65 64 20 61 0a 6e 65 77 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 | .formulated.a.new.version.of.the |
| 32200 | 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 20 61 73 20 61 20 66 69 78 65 | .square-root.procedure.as.a.fixe |
| 32220 | 64 2d 70 6f 69 6e 74 20 73 65 61 72 63 68 2c 0a 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 74 68 | d-point.search,.starting.with.th |
| 32240 | 65 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 74 68 61 74 20 5b 73 71 72 74 5d 78 20 69 73 20 61 20 | e.observation.that.[sqrt]x.is.a. |
| 32260 | 66 69 78 65 64 2d 70 6f 69 6e 74 20 6f 66 20 74 68 65 0a 66 75 6e 63 74 69 6f 6e 20 79 20 7c 2d | fixed-point.of.the.function.y.|- |
| 32280 | 3e 20 78 2f 79 2e 20 20 54 68 65 6e 20 77 65 20 75 73 65 64 20 61 76 65 72 61 67 65 20 64 61 6d | >.x/y...Then.we.used.average.dam |
| 322a0 | 70 69 6e 67 20 74 6f 20 6d 61 6b 65 20 74 68 65 0a 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 | ping.to.make.the.approximations. |
| 322c0 | 63 6f 6e 76 65 72 67 65 2e 20 20 41 76 65 72 61 67 65 20 64 61 6d 70 69 6e 67 20 69 73 20 61 20 | converge...Average.damping.is.a. |
| 322e0 | 75 73 65 66 75 6c 20 67 65 6e 65 72 61 6c 20 74 65 63 68 6e 69 71 75 65 0a 69 6e 20 69 74 73 65 | useful.general.technique.in.itse |
| 32300 | 6c 66 2e 20 20 4e 61 6d 65 6c 79 2c 20 67 69 76 65 6e 20 61 20 66 75 6e 63 74 69 6f 6e 20 66 2c | lf...Namely,.given.a.function.f, |
| 32320 | 20 77 65 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 77 68 6f 73 65 0a | .we.consider.the.function.whose. |
| 32340 | 76 61 6c 75 65 20 61 74 20 78 20 69 73 20 65 71 75 61 6c 20 74 6f 20 74 68 65 20 61 76 65 72 61 | value.at.x.is.equal.to.the.avera |
| 32360 | 67 65 20 6f 66 20 78 20 61 6e 64 20 66 28 78 29 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 65 78 70 | ge.of.x.and.f(x)......We.can.exp |
| 32380 | 72 65 73 73 20 74 68 65 20 69 64 65 61 20 6f 66 20 61 76 65 72 61 67 65 20 64 61 6d 70 69 6e 67 | ress.the.idea.of.average.damping |
| 323a0 | 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 70 72 6f 63 65 | .by.means.of.the.following.proce |
| 323c0 | 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 76 65 72 61 67 65 2d 64 61 6d | dure:.......(define.(average-dam |
| 323e0 | 70 20 66 29 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 61 76 65 72 61 67 65 | p.f)........(lambda.(x).(average |
| 32400 | 20 78 20 28 66 20 78 29 29 29 29 0a 0a 20 20 20 60 41 76 65 72 61 67 65 2d 64 61 6d 70 27 20 69 | .x.(f.x)))).....`Average-damp'.i |
| 32420 | 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 69 74 73 20 | s.a.procedure.that.takes.as.its. |
| 32440 | 61 72 67 75 6d 65 6e 74 20 61 20 70 72 6f 63 65 64 75 72 65 0a 60 66 27 20 61 6e 64 20 72 65 74 | argument.a.procedure.`f'.and.ret |
| 32460 | 75 72 6e 73 20 61 73 20 69 74 73 20 76 61 6c 75 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 28 70 | urns.as.its.value.a.procedure.(p |
| 32480 | 72 6f 64 75 63 65 64 20 62 79 20 74 68 65 20 60 6c 61 6d 62 64 61 27 29 0a 74 68 61 74 2c 20 77 | roduced.by.the.`lambda').that,.w |
| 324a0 | 68 65 6e 20 61 70 70 6c 69 65 64 20 74 6f 20 61 20 6e 75 6d 62 65 72 20 60 78 27 2c 20 70 72 6f | hen.applied.to.a.number.`x',.pro |
| 324c0 | 64 75 63 65 73 20 74 68 65 20 61 76 65 72 61 67 65 20 6f 66 20 60 78 27 20 61 6e 64 20 60 28 66 | duces.the.average.of.`x'.and.`(f |
| 324e0 | 0a 78 29 27 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 70 70 6c 79 69 6e 67 20 60 61 76 | .x)'...For.example,.applying.`av |
| 32500 | 65 72 61 67 65 2d 64 61 6d 70 27 20 74 6f 20 74 68 65 20 60 73 71 75 61 72 65 27 20 70 72 6f 63 | erage-damp'.to.the.`square'.proc |
| 32520 | 65 64 75 72 65 0a 70 72 6f 64 75 63 65 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 77 68 6f 73 65 | edure.produces.a.procedure.whose |
| 32540 | 20 76 61 6c 75 65 20 61 74 20 73 6f 6d 65 20 6e 75 6d 62 65 72 20 78 20 69 73 20 74 68 65 20 61 | .value.at.some.number.x.is.the.a |
| 32560 | 76 65 72 61 67 65 20 6f 66 20 78 0a 61 6e 64 20 78 5e 32 2e 20 20 41 70 70 6c 79 69 6e 67 20 74 | verage.of.x.and.x^2...Applying.t |
| 32580 | 68 69 73 20 72 65 73 75 6c 74 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 31 30 20 72 65 | his.resulting.procedure.to.10.re |
| 325a0 | 74 75 72 6e 73 20 74 68 65 20 61 76 65 72 61 67 65 0a 6f 66 20 31 30 20 61 6e 64 20 31 30 30 2c | turns.the.average.of.10.and.100, |
| 325c0 | 20 6f 72 20 35 35 3a 28 31 29 0a 0a 20 20 20 20 20 28 28 61 76 65 72 61 67 65 2d 64 61 6d 70 20 | .or.55:(1).......((average-damp. |
| 325e0 | 73 71 75 61 72 65 29 20 31 30 29 0a 20 20 20 20 20 35 35 0a 0a 20 20 20 55 73 69 6e 67 20 60 61 | square).10)......55.....Using.`a |
| 32600 | 76 65 72 61 67 65 2d 64 61 6d 70 27 2c 20 77 65 20 63 61 6e 20 72 65 66 6f 72 6d 75 6c 61 74 65 | verage-damp',.we.can.reformulate |
| 32620 | 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 20 61 73 0a 66 6f | .the.square-root.procedure.as.fo |
| 32640 | 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 | llows:.......(define.(sqrt.x)... |
| 32660 | 20 20 20 20 20 28 66 69 78 65 64 2d 70 6f 69 6e 74 20 28 61 76 65 72 61 67 65 2d 64 61 6d 70 20 | .....(fixed-point.(average-damp. |
| 32680 | 28 6c 61 6d 62 64 61 20 28 79 29 20 28 2f 20 78 20 79 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | (lambda.(y).(/.x.y)))........... |
| 326a0 | 20 20 20 20 20 20 20 20 20 20 31 2e 30 29 29 0a 0a 20 20 20 4e 6f 74 69 63 65 20 68 6f 77 20 74 | ..........1.0)).....Notice.how.t |
| 326c0 | 68 69 73 20 66 6f 72 6d 75 6c 61 74 69 6f 6e 20 6d 61 6b 65 73 20 65 78 70 6c 69 63 69 74 20 74 | his.formulation.makes.explicit.t |
| 326e0 | 68 65 20 74 68 72 65 65 20 69 64 65 61 73 20 69 6e 20 74 68 65 0a 6d 65 74 68 6f 64 3a 20 66 69 | he.three.ideas.in.the.method:.fi |
| 32700 | 78 65 64 2d 70 6f 69 6e 74 20 73 65 61 72 63 68 2c 20 61 76 65 72 61 67 65 20 64 61 6d 70 69 6e | xed-point.search,.average.dampin |
| 32720 | 67 2c 20 61 6e 64 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 79 20 7c 2d 3e 20 78 2f 79 2e 0a 49 | g,.and.the.function.y.|->.x/y..I |
| 32740 | 74 20 69 73 20 69 6e 73 74 72 75 63 74 69 76 65 20 74 6f 20 63 6f 6d 70 61 72 65 20 74 68 69 73 | t.is.instructive.to.compare.this |
| 32760 | 20 66 6f 72 6d 75 6c 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 | .formulation.of.the.square-root. |
| 32780 | 6d 65 74 68 6f 64 0a 77 69 74 68 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 76 65 72 73 69 6f 6e | method.with.the.original.version |
| 327a0 | 20 67 69 76 65 6e 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 37 3a 3a 2e | .given.in.section.*Note.1-1-7::. |
| 327c0 | 20 20 42 65 61 72 20 69 6e 20 6d 69 6e 64 0a 74 68 61 74 20 74 68 65 73 65 20 70 72 6f 63 65 64 | ..Bear.in.mind.that.these.proced |
| 327e0 | 75 72 65 73 20 65 78 70 72 65 73 73 20 74 68 65 20 73 61 6d 65 20 70 72 6f 63 65 73 73 2c 20 61 | ures.express.the.same.process,.a |
| 32800 | 6e 64 20 6e 6f 74 69 63 65 20 68 6f 77 20 6d 75 63 68 0a 63 6c 65 61 72 65 72 20 74 68 65 20 69 | nd.notice.how.much.clearer.the.i |
| 32820 | 64 65 61 20 62 65 63 6f 6d 65 73 20 77 68 65 6e 20 77 65 20 65 78 70 72 65 73 73 20 74 68 65 20 | dea.becomes.when.we.express.the. |
| 32840 | 70 72 6f 63 65 73 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 73 65 0a 61 62 73 74 72 61 | process.in.terms.of.these.abstra |
| 32860 | 63 74 69 6f 6e 73 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 74 68 65 72 65 20 61 72 65 20 6d | ctions...In.general,.there.are.m |
| 32880 | 61 6e 79 20 77 61 79 73 20 74 6f 20 66 6f 72 6d 75 6c 61 74 65 20 61 20 70 72 6f 63 65 73 73 0a | any.ways.to.formulate.a.process. |
| 328a0 | 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 2e 20 20 45 78 70 65 72 69 65 6e 63 65 64 20 70 72 6f | as.a.procedure...Experienced.pro |
| 328c0 | 67 72 61 6d 6d 65 72 73 20 6b 6e 6f 77 20 68 6f 77 20 74 6f 20 63 68 6f 6f 73 65 20 70 72 6f 63 | grammers.know.how.to.choose.proc |
| 328e0 | 65 64 75 72 61 6c 0a 66 6f 72 6d 75 6c 61 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 70 61 72 | edural.formulations.that.are.par |
| 32900 | 74 69 63 75 6c 61 72 6c 79 20 70 65 72 73 70 69 63 75 6f 75 73 2c 20 61 6e 64 20 77 68 65 72 65 | ticularly.perspicuous,.and.where |
| 32920 | 20 75 73 65 66 75 6c 0a 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 70 72 6f 63 65 73 73 20 | .useful.elements.of.the.process. |
| 32940 | 61 72 65 20 65 78 70 6f 73 65 64 20 61 73 20 73 65 70 61 72 61 74 65 20 65 6e 74 69 74 69 65 73 | are.exposed.as.separate.entities |
| 32960 | 20 74 68 61 74 20 63 61 6e 20 62 65 0a 72 65 75 73 65 64 20 69 6e 20 6f 74 68 65 72 20 61 70 70 | .that.can.be.reused.in.other.app |
| 32980 | 6c 69 63 61 74 69 6f 6e 73 2e 20 20 41 73 20 61 20 73 69 6d 70 6c 65 20 65 78 61 6d 70 6c 65 20 | lications...As.a.simple.example. |
| 329a0 | 6f 66 20 72 65 75 73 65 2c 20 6e 6f 74 69 63 65 0a 74 68 61 74 20 74 68 65 20 63 75 62 65 20 72 | of.reuse,.notice.that.the.cube.r |
| 329c0 | 6f 6f 74 20 6f 66 20 78 20 69 73 20 61 20 66 69 78 65 64 20 70 6f 69 6e 74 20 6f 66 20 74 68 65 | oot.of.x.is.a.fixed.point.of.the |
| 329e0 | 20 66 75 6e 63 74 69 6f 6e 20 79 20 7c 2d 3e 20 78 2f 79 5e 32 2c 0a 73 6f 20 77 65 20 63 61 6e | .function.y.|->.x/y^2,.so.we.can |
| 32a00 | 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 67 65 6e 65 72 61 6c 69 7a 65 20 6f 75 72 20 73 71 75 61 | .immediately.generalize.our.squa |
| 32a20 | 72 65 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 6f 6e 65 20 74 68 61 74 0a 65 78 | re-root.procedure.to.one.that.ex |
| 32a40 | 74 72 61 63 74 73 20 63 75 62 65 20 72 6f 6f 74 73 3a 28 32 29 0a 0a 20 20 20 20 20 28 64 65 66 | tracts.cube.roots:(2).......(def |
| 32a60 | 69 6e 65 20 28 63 75 62 65 2d 72 6f 6f 74 20 78 29 0a 20 20 20 20 20 20 20 28 66 69 78 65 64 2d | ine.(cube-root.x)........(fixed- |
| 32a80 | 70 6f 69 6e 74 20 28 61 76 65 72 61 67 65 2d 64 61 6d 70 20 28 6c 61 6d 62 64 61 20 28 79 29 20 | point.(average-damp.(lambda.(y). |
| 32aa0 | 28 2f 20 78 20 28 73 71 75 61 72 65 20 79 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | (/.x.(square.y)))).............. |
| 32ac0 | 20 20 20 20 20 20 20 31 2e 30 29 29 0a 0a 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 0a 2e 2e | .......1.0))..Newton's.method... |
| 32ae0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 68 65 6e 20 77 65 20 66 69 72 73 74 20 69 6e 74 | ...............When.we.first.int |
| 32b00 | 72 6f 64 75 63 65 64 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 | roduced.the.square-root.procedur |
| 32b20 | 65 2c 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 31 2d 31 2d 37 3a 3a 2c 20 77 65 20 | e,.in.section.*Note.1-1-7::,.we. |
| 32b40 | 6d 65 6e 74 69 6f 6e 65 64 20 74 68 61 74 20 74 68 69 73 20 77 61 73 20 61 20 73 70 65 63 69 61 | mentioned.that.this.was.a.specia |
| 32b60 | 6c 20 63 61 73 65 20 6f 66 20 22 4e 65 77 74 6f 6e 27 73 0a 6d 65 74 68 6f 64 22 2e 20 20 49 66 | l.case.of."Newton's.method"...If |
| 32b80 | 20 78 20 7c 2d 3e 20 67 28 78 29 20 69 73 20 61 20 64 69 66 66 65 72 65 6e 74 69 61 62 6c 65 20 | .x.|->.g(x).is.a.differentiable. |
| 32ba0 | 66 75 6e 63 74 69 6f 6e 2c 20 74 68 65 6e 20 61 20 73 6f 6c 75 74 69 6f 6e 0a 6f 66 20 74 68 65 | function,.then.a.solution.of.the |
| 32bc0 | 20 65 71 75 61 74 69 6f 6e 20 67 28 78 29 20 3d 20 30 20 69 73 20 61 20 66 69 78 65 64 20 70 6f | .equation.g(x).=.0.is.a.fixed.po |
| 32be0 | 69 6e 74 20 6f 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 78 20 7c 2d 3e 20 66 28 78 29 0a 77 | int.of.the.function.x.|->.f(x).w |
| 32c00 | 68 65 72 65 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 67 28 78 29 0a 20 20 20 20 20 | here..................g(x)...... |
| 32c20 | 66 28 78 29 20 3d 20 78 20 2d 20 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | f(x).=.x.-.-----................ |
| 32c40 | 20 44 67 28 78 29 0a 0a 61 6e 64 20 44 67 28 78 29 20 69 73 20 74 68 65 20 64 65 72 69 76 61 74 | .Dg(x)..and.Dg(x).is.the.derivat |
| 32c60 | 69 76 65 20 6f 66 20 67 20 65 76 61 6c 75 61 74 65 64 20 61 74 20 78 2e 20 20 4e 65 77 74 6f 6e | ive.of.g.evaluated.at.x...Newton |
| 32c80 | 27 73 20 6d 65 74 68 6f 64 20 69 73 0a 74 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 66 69 78 65 | 's.method.is.the.use.of.the.fixe |
| 32ca0 | 64 2d 70 6f 69 6e 74 20 6d 65 74 68 6f 64 20 77 65 20 73 61 77 20 61 62 6f 76 65 20 74 6f 20 61 | d-point.method.we.saw.above.to.a |
| 32cc0 | 70 70 72 6f 78 69 6d 61 74 65 20 61 0a 73 6f 6c 75 74 69 6f 6e 20 6f 66 20 74 68 65 20 65 71 75 | pproximate.a.solution.of.the.equ |
| 32ce0 | 61 74 69 6f 6e 20 62 79 20 66 69 6e 64 69 6e 67 20 61 20 66 69 78 65 64 20 70 6f 69 6e 74 20 6f | ation.by.finding.a.fixed.point.o |
| 32d00 | 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 66 2e 28 33 29 0a 0a 20 20 20 46 6f 72 20 6d 61 6e | f.the.function.f.(3).....For.man |
| 32d20 | 79 20 66 75 6e 63 74 69 6f 6e 73 20 67 20 61 6e 64 20 66 6f 72 20 73 75 66 66 69 63 69 65 6e 74 | y.functions.g.and.for.sufficient |
| 32d40 | 6c 79 20 67 6f 6f 64 20 69 6e 69 74 69 61 6c 20 67 75 65 73 73 65 73 20 66 6f 72 20 78 2c 0a 4e | ly.good.initial.guesses.for.x,.N |
| 32d60 | 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 20 63 6f 6e 76 65 72 67 65 73 20 76 65 72 79 20 72 61 | ewton's.method.converges.very.ra |
| 32d80 | 70 69 64 6c 79 20 74 6f 20 61 20 73 6f 6c 75 74 69 6f 6e 20 6f 66 20 67 28 78 29 20 3d 20 30 2e | pidly.to.a.solution.of.g(x).=.0. |
| 32da0 | 28 34 29 0a 0a 20 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 4e 65 | (4).....In.order.to.implement.Ne |
| 32dc0 | 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 65 | wton's.method.as.a.procedure,.we |
| 32de0 | 20 6d 75 73 74 20 66 69 72 73 74 0a 65 78 70 72 65 73 73 20 74 68 65 20 69 64 65 61 20 6f 66 20 | .must.first.express.the.idea.of. |
| 32e00 | 64 65 72 69 76 61 74 69 76 65 2e 20 20 4e 6f 74 65 20 74 68 61 74 20 22 64 65 72 69 76 61 74 69 | derivative...Note.that."derivati |
| 32e20 | 76 65 2c 22 20 6c 69 6b 65 20 61 76 65 72 61 67 65 0a 64 61 6d 70 69 6e 67 2c 20 69 73 20 73 6f | ve,".like.average.damping,.is.so |
| 32e40 | 6d 65 74 68 69 6e 67 20 74 68 61 74 20 74 72 61 6e 73 66 6f 72 6d 73 20 61 20 66 75 6e 63 74 69 | mething.that.transforms.a.functi |
| 32e60 | 6f 6e 20 69 6e 74 6f 20 61 6e 6f 74 68 65 72 20 66 75 6e 63 74 69 6f 6e 2e 0a 46 6f 72 20 69 6e | on.into.another.function..For.in |
| 32e80 | 73 74 61 6e 63 65 2c 20 74 68 65 20 64 65 72 69 76 61 74 69 76 65 20 6f 66 20 74 68 65 20 66 75 | stance,.the.derivative.of.the.fu |
| 32ea0 | 6e 63 74 69 6f 6e 20 78 20 7c 2d 3e 20 78 5e 33 20 69 73 20 74 68 65 20 66 75 6e 63 74 69 6f 6e | nction.x.|->.x^3.is.the.function |
| 32ec0 | 0a 78 20 7c 2d 3e 20 33 78 5e 32 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 69 66 20 67 20 69 | .x.|->.3x^2...In.general,.if.g.i |
| 32ee0 | 73 20 61 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 64 78 20 69 73 20 61 20 73 6d 61 6c 6c 20 6e | s.a.function.and.dx.is.a.small.n |
| 32f00 | 75 6d 62 65 72 2c 0a 74 68 65 6e 20 74 68 65 20 64 65 72 69 76 61 74 69 76 65 20 44 67 20 6f 66 | umber,.then.the.derivative.Dg.of |
| 32f20 | 20 67 20 69 73 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 77 68 6f 73 65 20 76 61 6c 75 65 20 61 | .g.is.the.function.whose.value.a |
| 32f40 | 74 20 61 6e 79 20 6e 75 6d 62 65 72 20 78 0a 69 73 20 67 69 76 65 6e 20 28 69 6e 20 74 68 65 20 | t.any.number.x.is.given.(in.the. |
| 32f60 | 6c 69 6d 69 74 20 6f 66 20 73 6d 61 6c 6c 20 64 78 29 20 62 79 0a 0a 20 20 20 20 20 20 20 20 20 | limit.of.small.dx).by........... |
| 32f80 | 20 20 20 20 67 28 78 20 2b 20 64 78 29 20 2d 20 67 28 78 29 0a 20 20 20 20 20 44 67 28 63 29 20 | ....g(x.+.dx).-.g(x)......Dg(c). |
| 32fa0 | 3d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | =.----------------.............. |
| 32fc0 | 20 20 20 20 20 20 20 64 78 0a 0a 54 68 75 73 2c 20 77 65 20 63 61 6e 20 65 78 70 72 65 73 73 20 | .......dx..Thus,.we.can.express. |
| 32fe0 | 74 68 65 20 69 64 65 61 20 6f 66 20 64 65 72 69 76 61 74 69 76 65 20 28 74 61 6b 69 6e 67 20 64 | the.idea.of.derivative.(taking.d |
| 33000 | 78 20 74 6f 20 62 65 2c 20 73 61 79 2c 0a 30 2e 30 30 30 30 31 29 20 61 73 20 74 68 65 20 70 72 | x.to.be,.say,.0.00001).as.the.pr |
| 33020 | 6f 63 65 64 75 72 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 72 69 76 20 67 29 0a | ocedure.......(define.(deriv.g). |
| 33040 | 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 20 20 20 20 20 20 20 20 20 28 2f 20 28 | .......(lambda.(x)..........(/.( |
| 33060 | 2d 20 28 67 20 28 2b 20 78 20 64 78 29 29 20 28 67 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 | -.(g.(+.x.dx)).(g.x))........... |
| 33080 | 20 20 64 78 29 29 29 0a 0a 61 6c 6f 6e 67 20 77 69 74 68 20 74 68 65 20 64 65 66 69 6e 69 74 69 | ..dx)))..along.with.the.definiti |
| 330a0 | 6f 6e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 64 78 20 30 2e 30 30 30 30 31 29 0a 0a 20 20 | on.......(define.dx.0.00001).... |
| 330c0 | 20 4c 69 6b 65 20 60 61 76 65 72 61 67 65 2d 64 61 6d 70 27 2c 20 60 64 65 72 69 76 27 20 69 73 | .Like.`average-damp',.`deriv'.is |
| 330e0 | 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 20 61 20 70 72 6f 63 65 64 | .a.procedure.that.takes.a.proced |
| 33100 | 75 72 65 20 61 73 0a 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 20 70 72 | ure.as.argument.and.returns.a.pr |
| 33120 | 6f 63 65 64 75 72 65 20 61 73 20 76 61 6c 75 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 | ocedure.as.value...For.example,. |
| 33140 | 74 6f 20 61 70 70 72 6f 78 69 6d 61 74 65 0a 74 68 65 20 64 65 72 69 76 61 74 69 76 65 20 6f 66 | to.approximate.the.derivative.of |
| 33160 | 20 78 20 7c 2d 3e 20 78 5e 33 20 61 74 20 35 20 28 77 68 6f 73 65 20 65 78 61 63 74 20 76 61 6c | .x.|->.x^3.at.5.(whose.exact.val |
| 33180 | 75 65 20 69 73 20 37 35 29 20 77 65 20 63 61 6e 0a 65 76 61 6c 75 61 74 65 0a 0a 20 20 20 20 20 | ue.is.75).we.can.evaluate....... |
| 331a0 | 28 64 65 66 69 6e 65 20 28 63 75 62 65 20 78 29 20 28 2a 20 78 20 78 20 78 29 29 0a 0a 20 20 20 | (define.(cube.x).(*.x.x.x))..... |
| 331c0 | 20 20 28 28 64 65 72 69 76 20 63 75 62 65 29 20 35 29 0a 20 20 20 20 20 37 35 2e 30 30 30 31 34 | ..((deriv.cube).5)......75.00014 |
| 331e0 | 39 39 39 36 36 34 30 31 38 0a 0a 20 20 20 57 69 74 68 20 74 68 65 20 61 69 64 20 6f 66 20 60 64 | 999664018.....With.the.aid.of.`d |
| 33200 | 65 72 69 76 27 2c 20 77 65 20 63 61 6e 20 65 78 70 72 65 73 73 20 4e 65 77 74 6f 6e 27 73 20 6d | eriv',.we.can.express.Newton's.m |
| 33220 | 65 74 68 6f 64 20 61 73 20 61 0a 66 69 78 65 64 2d 70 6f 69 6e 74 20 70 72 6f 63 65 73 73 3a 0a | ethod.as.a.fixed-point.process:. |
| 33240 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6e 65 77 74 6f 6e 2d 74 72 61 6e 73 66 6f 72 6d 20 | ......(define.(newton-transform. |
| 33260 | 67 29 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 20 20 20 20 20 20 20 20 20 28 | g)........(lambda.(x)..........( |
| 33280 | 2d 20 78 20 28 2f 20 28 67 20 78 29 20 28 28 64 65 72 69 76 20 67 29 20 78 29 29 29 29 29 0a 0a | -.x.(/.(g.x).((deriv.g).x))))).. |
| 332a0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6e 65 77 74 6f 6e 73 2d 6d 65 74 68 6f 64 20 67 20 67 | .....(define.(newtons-method.g.g |
| 332c0 | 75 65 73 73 29 0a 20 20 20 20 20 20 20 28 66 69 78 65 64 2d 70 6f 69 6e 74 20 28 6e 65 77 74 6f | uess)........(fixed-point.(newto |
| 332e0 | 6e 2d 74 72 61 6e 73 66 6f 72 6d 20 67 29 20 67 75 65 73 73 29 29 0a 0a 20 20 20 54 68 65 20 60 | n-transform.g).guess)).....The.` |
| 33300 | 6e 65 77 74 6f 6e 2d 74 72 61 6e 73 66 6f 72 6d 27 20 70 72 6f 63 65 64 75 72 65 20 65 78 70 72 | newton-transform'.procedure.expr |
| 33320 | 65 73 73 65 73 20 74 68 65 20 66 6f 72 6d 75 6c 61 20 61 74 20 74 68 65 0a 62 65 67 69 6e 6e 69 | esses.the.formula.at.the.beginni |
| 33340 | 6e 67 20 6f 66 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 20 61 6e 64 20 60 6e 65 77 74 6f 6e 73 | ng.of.this.section,.and.`newtons |
| 33360 | 2d 6d 65 74 68 6f 64 27 20 69 73 20 72 65 61 64 69 6c 79 20 64 65 66 69 6e 65 64 20 69 6e 0a 74 | -method'.is.readily.defined.in.t |
| 33380 | 65 72 6d 73 20 6f 66 20 74 68 69 73 2e 20 20 49 74 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d | erms.of.this...It.takes.as.argum |
| 333a0 | 65 6e 74 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 74 | ents.a.procedure.that.computes.t |
| 333c0 | 68 65 0a 66 75 6e 63 74 69 6f 6e 20 66 6f 72 20 77 68 69 63 68 20 77 65 20 77 61 6e 74 20 74 6f | he.function.for.which.we.want.to |
| 333e0 | 20 66 69 6e 64 20 61 20 7a 65 72 6f 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 6e 20 69 | .find.a.zero,.together.with.an.i |
| 33400 | 6e 69 74 69 61 6c 0a 67 75 65 73 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 6f 20 | nitial.guess...For.instance,.to. |
| 33420 | 66 69 6e 64 20 74 68 65 20 73 71 75 61 72 65 20 72 6f 6f 74 20 6f 66 20 78 2c 20 77 65 20 63 61 | find.the.square.root.of.x,.we.ca |
| 33440 | 6e 20 75 73 65 20 4e 65 77 74 6f 6e 27 73 0a 6d 65 74 68 6f 64 20 74 6f 20 66 69 6e 64 20 61 20 | n.use.Newton's.method.to.find.a. |
| 33460 | 7a 65 72 6f 20 6f 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 79 20 7c 2d 3e 20 79 5e 32 20 2d | zero.of.the.function.y.|->.y^2.- |
| 33480 | 20 78 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 61 6e 0a 69 6e 69 74 69 61 6c 20 67 75 65 73 | .x.starting.with.an.initial.gues |
| 334a0 | 73 20 6f 66 20 31 2e 28 35 29 0a 0a 20 20 20 54 68 69 73 20 70 72 6f 76 69 64 65 73 20 79 65 74 | s.of.1.(5).....This.provides.yet |
| 334c0 | 20 61 6e 6f 74 68 65 72 20 66 6f 72 6d 20 6f 66 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 | .another.form.of.the.square-root |
| 334e0 | 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 | .procedure:.......(define.(sqrt. |
| 33500 | 78 29 0a 20 20 20 20 20 20 20 28 6e 65 77 74 6f 6e 73 2d 6d 65 74 68 6f 64 20 28 6c 61 6d 62 64 | x)........(newtons-method.(lambd |
| 33520 | 61 20 28 79 29 20 28 2d 20 28 73 71 75 61 72 65 20 79 29 20 78 29 29 0a 20 20 20 20 20 20 20 20 | a.(y).(-.(square.y).x))......... |
| 33540 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2e 30 29 29 0a 0a 41 62 73 74 72 61 63 74 69 6f | ...............1.0))..Abstractio |
| 33560 | 6e 73 20 61 6e 64 20 66 69 72 73 74 2d 63 6c 61 73 73 20 70 72 6f 63 65 64 75 72 65 73 0a 2e 2e | ns.and.first-class.procedures... |
| 33580 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ................................ |
| 335a0 | 2e 2e 2e 2e 2e 0a 0a 57 65 27 76 65 20 73 65 65 6e 20 74 77 6f 20 77 61 79 73 20 74 6f 20 65 78 | .......We've.seen.two.ways.to.ex |
| 335c0 | 70 72 65 73 73 20 74 68 65 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 63 6f 6d 70 75 74 61 74 69 6f | press.the.square-root.computatio |
| 335e0 | 6e 20 61 73 20 61 6e 0a 69 6e 73 74 61 6e 63 65 20 6f 66 20 61 20 6d 6f 72 65 20 67 65 6e 65 72 | n.as.an.instance.of.a.more.gener |
| 33600 | 61 6c 20 6d 65 74 68 6f 64 2c 20 6f 6e 63 65 20 61 73 20 61 20 66 69 78 65 64 2d 70 6f 69 6e 74 | al.method,.once.as.a.fixed-point |
| 33620 | 20 73 65 61 72 63 68 20 61 6e 64 0a 6f 6e 63 65 20 75 73 69 6e 67 20 4e 65 77 74 6f 6e 27 73 20 | .search.and.once.using.Newton's. |
| 33640 | 6d 65 74 68 6f 64 2e 20 20 53 69 6e 63 65 20 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 20 77 | method...Since.Newton's.method.w |
| 33660 | 61 73 20 69 74 73 65 6c 66 20 65 78 70 72 65 73 73 65 64 0a 61 73 20 61 20 66 69 78 65 64 2d 70 | as.itself.expressed.as.a.fixed-p |
| 33680 | 6f 69 6e 74 20 70 72 6f 63 65 73 73 2c 20 77 65 20 61 63 74 75 61 6c 6c 79 20 73 61 77 20 74 77 | oint.process,.we.actually.saw.tw |
| 336a0 | 6f 20 77 61 79 73 20 74 6f 20 63 6f 6d 70 75 74 65 20 73 71 75 61 72 65 0a 72 6f 6f 74 73 20 61 | o.ways.to.compute.square.roots.a |
| 336c0 | 73 20 66 69 78 65 64 20 70 6f 69 6e 74 73 2e 20 20 45 61 63 68 20 6d 65 74 68 6f 64 20 62 65 67 | s.fixed.points...Each.method.beg |
| 336e0 | 69 6e 73 20 77 69 74 68 20 61 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 66 69 6e 64 73 20 61 0a | ins.with.a.function.and.finds.a. |
| 33700 | 66 69 78 65 64 20 70 6f 69 6e 74 20 6f 66 20 73 6f 6d 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 | fixed.point.of.some.transformati |
| 33720 | 6f 6e 20 6f 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 2e 20 20 57 65 20 63 61 6e 20 65 78 70 72 | on.of.the.function...We.can.expr |
| 33740 | 65 73 73 0a 74 68 69 73 20 67 65 6e 65 72 61 6c 20 69 64 65 61 20 69 74 73 65 6c 66 20 61 73 20 | ess.this.general.idea.itself.as. |
| 33760 | 61 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 78 65 | a.procedure:.......(define.(fixe |
| 33780 | 64 2d 70 6f 69 6e 74 2d 6f 66 2d 74 72 61 6e 73 66 6f 72 6d 20 67 20 74 72 61 6e 73 66 6f 72 6d | d-point-of-transform.g.transform |
| 337a0 | 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 28 66 69 78 65 64 2d 70 6f 69 6e 74 20 28 74 72 61 | .guess)........(fixed-point.(tra |
| 337c0 | 6e 73 66 6f 72 6d 20 67 29 20 67 75 65 73 73 29 29 0a 0a 20 20 20 54 68 69 73 20 76 65 72 79 20 | nsform.g).guess)).....This.very. |
| 337e0 | 67 65 6e 65 72 61 6c 20 70 72 6f 63 65 64 75 72 65 20 74 61 6b 65 73 20 61 73 20 69 74 73 20 61 | general.procedure.takes.as.its.a |
| 33800 | 72 67 75 6d 65 6e 74 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 67 27 0a 74 68 61 74 20 63 6f | rguments.a.procedure.`g'.that.co |
| 33820 | 6d 70 75 74 65 73 20 73 6f 6d 65 20 66 75 6e 63 74 69 6f 6e 2c 20 61 20 70 72 6f 63 65 64 75 72 | mputes.some.function,.a.procedur |
| 33840 | 65 20 74 68 61 74 20 74 72 61 6e 73 66 6f 72 6d 73 20 60 67 27 2c 20 61 6e 64 20 61 6e 0a 69 6e | e.that.transforms.`g',.and.an.in |
| 33860 | 69 74 69 61 6c 20 67 75 65 73 73 2e 20 20 54 68 65 20 72 65 74 75 72 6e 65 64 20 72 65 73 75 6c | itial.guess...The.returned.resul |
| 33880 | 74 20 69 73 20 61 20 66 69 78 65 64 20 70 6f 69 6e 74 20 6f 66 20 74 68 65 20 74 72 61 6e 73 66 | t.is.a.fixed.point.of.the.transf |
| 338a0 | 6f 72 6d 65 64 0a 66 75 6e 63 74 69 6f 6e 2e 0a 0a 20 20 20 55 73 69 6e 67 20 74 68 69 73 20 61 | ormed.function......Using.this.a |
| 338c0 | 62 73 74 72 61 63 74 69 6f 6e 2c 20 77 65 20 63 61 6e 20 72 65 63 61 73 74 20 74 68 65 20 66 69 | bstraction,.we.can.recast.the.fi |
| 338e0 | 72 73 74 20 73 71 75 61 72 65 2d 72 6f 6f 74 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 20 66 72 6f 6d | rst.square-root.computation.from |
| 33900 | 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 28 77 68 65 72 65 20 77 65 20 6c 6f 6f 6b 20 66 6f 72 | .this.section.(where.we.look.for |
| 33920 | 20 61 20 66 69 78 65 64 20 70 6f 69 6e 74 20 6f 66 20 74 68 65 0a 61 76 65 72 61 67 65 2d 64 61 | .a.fixed.point.of.the.average-da |
| 33940 | 6d 70 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 79 20 7c 2d 3e 20 78 2f 79 29 20 61 73 20 61 6e | mped.version.of.y.|->.x/y).as.an |
| 33960 | 20 69 6e 73 74 61 6e 63 65 20 6f 66 20 74 68 69 73 20 67 65 6e 65 72 61 6c 0a 6d 65 74 68 6f 64 | .instance.of.this.general.method |
| 33980 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 20 20 20 20 20 | :.......(define.(sqrt.x)........ |
| 339a0 | 28 66 69 78 65 64 2d 70 6f 69 6e 74 2d 6f 66 2d 74 72 61 6e 73 66 6f 72 6d 20 28 6c 61 6d 62 64 | (fixed-point-of-transform.(lambd |
| 339c0 | 61 20 28 79 29 20 28 2f 20 78 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | a.(y).(/.x.y)).................. |
| 339e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 76 65 72 61 67 65 2d 64 61 6d 70 0a 20 20 20 | ................average-damp.... |
| 33a00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2e | ..............................1. |
| 33a20 | 30 29 29 0a 0a 20 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 77 65 20 63 61 6e 20 65 78 70 72 65 73 | 0)).....Similarly,.we.can.expres |
| 33a40 | 73 20 74 68 65 20 73 65 63 6f 6e 64 20 73 71 75 61 72 65 2d 72 6f 6f 74 20 63 6f 6d 70 75 74 61 | s.the.second.square-root.computa |
| 33a60 | 74 69 6f 6e 20 66 72 6f 6d 0a 74 68 69 73 20 73 65 63 74 69 6f 6e 20 28 61 6e 20 69 6e 73 74 61 | tion.from.this.section.(an.insta |
| 33a80 | 6e 63 65 20 6f 66 20 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 20 74 68 61 74 20 66 69 6e 64 | nce.of.Newton's.method.that.find |
| 33aa0 | 73 20 61 20 66 69 78 65 64 20 70 6f 69 6e 74 0a 6f 66 20 74 68 65 20 4e 65 77 74 6f 6e 20 74 72 | s.a.fixed.point.of.the.Newton.tr |
| 33ac0 | 61 6e 73 66 6f 72 6d 20 6f 66 20 79 20 7c 2d 3e 20 79 5e 32 20 2d 20 78 29 20 61 73 0a 0a 20 20 | ansform.of.y.|->.y^2.-.x).as.... |
| 33ae0 | 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 20 20 20 20 20 28 66 69 78 65 | ...(define.(sqrt.x)........(fixe |
| 33b00 | 64 2d 70 6f 69 6e 74 2d 6f 66 2d 74 72 61 6e 73 66 6f 72 6d 20 28 6c 61 6d 62 64 61 20 28 79 29 | d-point-of-transform.(lambda.(y) |
| 33b20 | 20 28 2d 20 28 73 71 75 61 72 65 20 79 29 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(-.(square.y).x)).............. |
| 33b40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 65 77 74 6f 6e 2d 74 72 61 6e 73 | ....................newton-trans |
| 33b60 | 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | form............................ |
| 33b80 | 20 20 20 20 20 20 31 2e 30 29 29 0a 0a 20 20 20 57 65 20 62 65 67 61 6e 20 73 65 63 74 69 6f 6e | ......1.0)).....We.began.section |
| 33ba0 | 20 2a 4e 6f 74 65 20 31 2d 33 3a 3a 20 77 69 74 68 20 74 68 65 20 6f 62 73 65 72 76 61 74 69 6f | .*Note.1-3::.with.the.observatio |
| 33bc0 | 6e 20 74 68 61 74 20 63 6f 6d 70 6f 75 6e 64 0a 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 61 | n.that.compound.procedures.are.a |
| 33be0 | 20 63 72 75 63 69 61 6c 20 61 62 73 74 72 61 63 74 69 6f 6e 20 6d 65 63 68 61 6e 69 73 6d 2c 20 | .crucial.abstraction.mechanism,. |
| 33c00 | 62 65 63 61 75 73 65 20 74 68 65 79 20 70 65 72 6d 69 74 20 75 73 0a 74 6f 20 65 78 70 72 65 73 | because.they.permit.us.to.expres |
| 33c20 | 73 20 67 65 6e 65 72 61 6c 20 6d 65 74 68 6f 64 73 20 6f 66 20 63 6f 6d 70 75 74 69 6e 67 20 61 | s.general.methods.of.computing.a |
| 33c40 | 73 20 65 78 70 6c 69 63 69 74 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 6f 75 72 0a 70 72 6f 67 72 | s.explicit.elements.in.our.progr |
| 33c60 | 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 20 20 4e 6f 77 20 77 65 27 76 65 20 73 65 65 6e | amming.language...Now.we've.seen |
| 33c80 | 20 68 6f 77 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 73 0a 70 65 72 | .how.higher-order.procedures.per |
| 33ca0 | 6d 69 74 20 75 73 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 68 65 73 65 20 67 65 6e 65 72 | mit.us.to.manipulate.these.gener |
| 33cc0 | 61 6c 20 6d 65 74 68 6f 64 73 20 74 6f 20 63 72 65 61 74 65 20 66 75 72 74 68 65 72 0a 61 62 73 | al.methods.to.create.further.abs |
| 33ce0 | 74 72 61 63 74 69 6f 6e 73 2e 0a 0a 20 20 20 41 73 20 70 72 6f 67 72 61 6d 6d 65 72 73 2c 20 77 | tractions......As.programmers,.w |
| 33d00 | 65 20 73 68 6f 75 6c 64 20 62 65 20 61 6c 65 72 74 20 74 6f 20 6f 70 70 6f 72 74 75 6e 69 74 69 | e.should.be.alert.to.opportuniti |
| 33d20 | 65 73 20 74 6f 20 69 64 65 6e 74 69 66 79 20 74 68 65 0a 75 6e 64 65 72 6c 79 69 6e 67 20 61 62 | es.to.identify.the.underlying.ab |
| 33d40 | 73 74 72 61 63 74 69 6f 6e 73 20 69 6e 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 61 6e 64 20 74 | stractions.in.our.programs.and.t |
| 33d60 | 6f 20 62 75 69 6c 64 20 75 70 6f 6e 20 74 68 65 6d 20 61 6e 64 0a 67 65 6e 65 72 61 6c 69 7a 65 | o.build.upon.them.and.generalize |
| 33d80 | 20 74 68 65 6d 20 74 6f 20 63 72 65 61 74 65 20 6d 6f 72 65 20 70 6f 77 65 72 66 75 6c 20 61 62 | .them.to.create.more.powerful.ab |
| 33da0 | 73 74 72 61 63 74 69 6f 6e 73 2e 20 20 54 68 69 73 20 69 73 20 6e 6f 74 20 74 6f 0a 73 61 79 20 | stractions...This.is.not.to.say. |
| 33dc0 | 74 68 61 74 20 6f 6e 65 20 73 68 6f 75 6c 64 20 61 6c 77 61 79 73 20 77 72 69 74 65 20 70 72 6f | that.one.should.always.write.pro |
| 33de0 | 67 72 61 6d 73 20 69 6e 20 74 68 65 20 6d 6f 73 74 20 61 62 73 74 72 61 63 74 20 77 61 79 0a 70 | grams.in.the.most.abstract.way.p |
| 33e00 | 6f 73 73 69 62 6c 65 3b 20 65 78 70 65 72 74 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 6b 6e 6f 77 | ossible;.expert.programmers.know |
| 33e20 | 20 68 6f 77 20 74 6f 20 63 68 6f 6f 73 65 20 74 68 65 20 6c 65 76 65 6c 20 6f 66 0a 61 62 73 74 | .how.to.choose.the.level.of.abst |
| 33e40 | 72 61 63 74 69 6f 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20 74 6f 20 74 68 65 69 72 20 74 61 73 | raction.appropriate.to.their.tas |
| 33e60 | 6b 2e 20 20 42 75 74 20 69 74 20 69 73 20 69 6d 70 6f 72 74 61 6e 74 20 74 6f 20 62 65 20 61 62 | k...But.it.is.important.to.be.ab |
| 33e80 | 6c 65 0a 74 6f 20 74 68 69 6e 6b 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 73 65 20 61 62 | le.to.think.in.terms.of.these.ab |
| 33ea0 | 73 74 72 61 63 74 69 6f 6e 73 2c 20 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e 20 62 65 20 72 65 | stractions,.so.that.we.can.be.re |
| 33ec0 | 61 64 79 20 74 6f 0a 61 70 70 6c 79 20 74 68 65 6d 20 69 6e 20 6e 65 77 20 63 6f 6e 74 65 78 74 | ady.to.apply.them.in.new.context |
| 33ee0 | 73 2e 20 20 54 68 65 20 73 69 67 6e 69 66 69 63 61 6e 63 65 20 6f 66 20 68 69 67 68 65 72 2d 6f | s...The.significance.of.higher-o |
| 33f00 | 72 64 65 72 0a 70 72 6f 63 65 64 75 72 65 73 20 69 73 20 74 68 61 74 20 74 68 65 79 20 65 6e 61 | rder.procedures.is.that.they.ena |
| 33f20 | 62 6c 65 20 75 73 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 73 65 20 61 62 73 74 72 61 | ble.us.to.represent.these.abstra |
| 33f40 | 63 74 69 6f 6e 73 0a 65 78 70 6c 69 63 69 74 6c 79 20 61 73 20 65 6c 65 6d 65 6e 74 73 20 69 6e | ctions.explicitly.as.elements.in |
| 33f60 | 20 6f 75 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2c 20 73 6f 20 74 68 | .our.programming.language,.so.th |
| 33f80 | 61 74 20 74 68 65 79 20 63 61 6e 20 62 65 0a 68 61 6e 64 6c 65 64 20 6a 75 73 74 20 6c 69 6b 65 | at.they.can.be.handled.just.like |
| 33fa0 | 20 6f 74 68 65 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 65 6c 65 6d 65 6e 74 73 2e 0a 0a | .other.computational.elements... |
| 33fc0 | 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 | ...In.general,.programming.langu |
| 33fe0 | 61 67 65 73 20 69 6d 70 6f 73 65 20 72 65 73 74 72 69 63 74 69 6f 6e 73 20 6f 6e 20 74 68 65 20 | ages.impose.restrictions.on.the. |
| 34000 | 77 61 79 73 20 69 6e 0a 77 68 69 63 68 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 65 6c 65 6d | ways.in.which.computational.elem |
| 34020 | 65 6e 74 73 20 63 61 6e 20 62 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 2e 20 20 45 6c 65 6d 65 6e | ents.can.be.manipulated...Elemen |
| 34040 | 74 73 20 77 69 74 68 20 74 68 65 0a 66 65 77 65 73 74 20 72 65 73 74 72 69 63 74 69 6f 6e 73 20 | ts.with.the.fewest.restrictions. |
| 34060 | 61 72 65 20 73 61 69 64 20 74 6f 20 68 61 76 65 20 22 66 69 72 73 74 2d 63 6c 61 73 73 22 20 73 | are.said.to.have."first-class".s |
| 34080 | 74 61 74 75 73 2e 20 20 53 6f 6d 65 20 6f 66 20 74 68 65 0a 22 72 69 67 68 74 73 20 61 6e 64 20 | tatus...Some.of.the."rights.and. |
| 340a0 | 70 72 69 76 69 6c 65 67 65 73 22 20 6f 66 20 66 69 72 73 74 2d 63 6c 61 73 73 20 65 6c 65 6d 65 | privileges".of.first-class.eleme |
| 340c0 | 6e 74 73 20 61 72 65 3a 28 36 29 0a 0a 20 20 20 2a 20 54 68 65 79 20 6d 61 79 20 62 65 20 6e 61 | nts.are:(6).....*.They.may.be.na |
| 340e0 | 6d 65 64 20 62 79 20 76 61 72 69 61 62 6c 65 73 2e 0a 0a 20 20 20 2a 20 54 68 65 79 20 6d 61 79 | med.by.variables......*.They.may |
| 34100 | 20 62 65 20 70 61 73 73 65 64 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 70 72 6f 63 65 | .be.passed.as.arguments.to.proce |
| 34120 | 64 75 72 65 73 2e 0a 0a 20 20 20 2a 20 54 68 65 79 20 6d 61 79 20 62 65 20 72 65 74 75 72 6e 65 | dures......*.They.may.be.returne |
| 34140 | 64 20 61 73 20 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 2e 0a | d.as.the.results.of.procedures.. |
| 34160 | 0a 20 20 20 2a 20 54 68 65 79 20 6d 61 79 20 62 65 20 69 6e 63 6c 75 64 65 64 20 69 6e 20 64 61 | ....*.They.may.be.included.in.da |
| 34180 | 74 61 20 73 74 72 75 63 74 75 72 65 73 2e 28 37 29 0a 0a 0a 20 20 20 4c 69 73 70 2c 20 75 6e 6c | ta.structures.(7)......Lisp,.unl |
| 341a0 | 69 6b 65 20 6f 74 68 65 72 20 63 6f 6d 6d 6f 6e 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e | ike.other.common.programming.lan |
| 341c0 | 67 75 61 67 65 73 2c 20 61 77 61 72 64 73 20 70 72 6f 63 65 64 75 72 65 73 0a 66 75 6c 6c 20 66 | guages,.awards.procedures.full.f |
| 341e0 | 69 72 73 74 2d 63 6c 61 73 73 20 73 74 61 74 75 73 2e 20 20 54 68 69 73 20 70 6f 73 65 73 20 63 | irst-class.status...This.poses.c |
| 34200 | 68 61 6c 6c 65 6e 67 65 73 20 66 6f 72 20 65 66 66 69 63 69 65 6e 74 0a 69 6d 70 6c 65 6d 65 6e | hallenges.for.efficient.implemen |
| 34220 | 74 61 74 69 6f 6e 2c 20 62 75 74 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 67 61 69 6e 20 69 | tation,.but.the.resulting.gain.i |
| 34240 | 6e 20 65 78 70 72 65 73 73 69 76 65 20 70 6f 77 65 72 20 69 73 0a 65 6e 6f 72 6d 6f 75 73 2e 28 | n.expressive.power.is.enormous.( |
| 34260 | 38 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 34 30 3a 2a 20 44 65 66 69 6e 65 | 8).......*Exercise.1.40:*.Define |
| 34280 | 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 63 75 62 69 63 27 20 74 68 61 74 20 63 61 6e 20 62 65 | .a.procedure.`cubic'.that.can.be |
| 342a0 | 20 75 73 65 64 0a 20 20 20 20 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 20 60 6e 65 | .used......together.with.the.`ne |
| 342c0 | 77 74 6f 6e 73 2d 6d 65 74 68 6f 64 27 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 65 78 70 72 65 | wtons-method'.procedure.in.expre |
| 342e0 | 73 73 69 6f 6e 73 20 6f 66 20 74 68 65 0a 20 20 20 20 20 66 6f 72 6d 0a 0a 20 20 20 20 20 20 20 | ssions.of.the......form......... |
| 34300 | 20 20 20 28 6e 65 77 74 6f 6e 73 2d 6d 65 74 68 6f 64 20 28 63 75 62 69 63 20 61 20 62 20 63 29 | ...(newtons-method.(cubic.a.b.c) |
| 34320 | 20 31 29 0a 0a 20 20 20 20 20 74 6f 20 61 70 70 72 6f 78 69 6d 61 74 65 20 7a 65 72 6f 73 20 6f | .1).......to.approximate.zeros.o |
| 34340 | 66 20 74 68 65 20 63 75 62 69 63 20 78 5e 33 20 2b 20 61 78 5e 32 20 2b 20 62 78 20 2b 20 63 2e | f.the.cubic.x^3.+.ax^2.+.bx.+.c. |
| 34360 | 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 34 31 3a 2a 20 44 65 66 69 6e 65 20 61 | .......*Exercise.1.41:*.Define.a |
| 34380 | 20 70 72 6f 63 65 64 75 72 65 20 60 64 6f 75 62 6c 65 27 20 74 68 61 74 20 74 61 6b 65 73 20 61 | .procedure.`double'.that.takes.a |
| 343a0 | 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 6f 6e 65 20 61 72 67 75 6d 65 6e 74 20 | ......procedure.of.one.argument. |
| 343c0 | 61 73 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 20 70 72 6f 63 65 64 | as.argument.and.returns.a.proced |
| 343e0 | 75 72 65 20 74 68 61 74 0a 20 20 20 20 20 61 70 70 6c 69 65 73 20 74 68 65 20 6f 72 69 67 69 6e | ure.that......applies.the.origin |
| 34400 | 61 6c 20 70 72 6f 63 65 64 75 72 65 20 74 77 69 63 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 | al.procedure.twice...For.example |
| 34420 | 2c 20 69 66 20 60 69 6e 63 27 20 69 73 20 61 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 74 | ,.if.`inc'.is.a......procedure.t |
| 34440 | 68 61 74 20 61 64 64 73 20 31 20 74 6f 20 69 74 73 20 61 72 67 75 6d 65 6e 74 2c 20 74 68 65 6e | hat.adds.1.to.its.argument,.then |
| 34460 | 20 60 28 64 6f 75 62 6c 65 20 69 6e 63 29 27 20 73 68 6f 75 6c 64 0a 20 20 20 20 20 62 65 20 61 | .`(double.inc)'.should......be.a |
| 34480 | 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 61 64 64 73 20 32 2e 20 20 57 68 61 74 20 76 61 | .procedure.that.adds.2...What.va |
| 344a0 | 6c 75 65 20 69 73 20 72 65 74 75 72 6e 65 64 20 62 79 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 | lue.is.returned.by............(( |
| 344c0 | 28 64 6f 75 62 6c 65 20 28 64 6f 75 62 6c 65 20 64 6f 75 62 6c 65 29 29 20 69 6e 63 29 20 35 29 | (double.(double.double)).inc).5) |
| 344e0 | 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 34 32 3a 2a 20 4c 65 74 20 66 20 61 6e | .......*Exercise.1.42:*.Let.f.an |
| 34500 | 64 20 67 20 62 65 20 74 77 6f 20 6f 6e 65 2d 61 72 67 75 6d 65 6e 74 20 66 75 6e 63 74 69 6f 6e | d.g.be.two.one-argument.function |
| 34520 | 73 2e 20 20 54 68 65 20 22 63 6f 6d 70 6f 73 69 74 69 6f 6e 22 0a 20 20 20 20 20 66 20 61 66 74 | s...The."composition"......f.aft |
| 34540 | 65 72 20 67 20 69 73 20 64 65 66 69 6e 65 64 20 74 6f 20 62 65 20 74 68 65 20 66 75 6e 63 74 69 | er.g.is.defined.to.be.the.functi |
| 34560 | 6f 6e 20 78 20 7c 2d 3e 20 66 28 67 28 78 29 29 2e 20 20 44 65 66 69 6e 65 20 61 0a 20 20 20 20 | on.x.|->.f(g(x))...Define.a..... |
| 34580 | 20 70 72 6f 63 65 64 75 72 65 20 60 63 6f 6d 70 6f 73 65 27 20 74 68 61 74 20 69 6d 70 6c 65 6d | .procedure.`compose'.that.implem |
| 345a0 | 65 6e 74 73 20 63 6f 6d 70 6f 73 69 74 69 6f 6e 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 | ents.composition...For.example,. |
| 345c0 | 69 66 0a 20 20 20 20 20 60 69 6e 63 27 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 | if......`inc'.is.a.procedure.tha |
| 345e0 | 74 20 61 64 64 73 20 31 20 74 6f 20 69 74 73 20 61 72 67 75 6d 65 6e 74 2c 0a 0a 20 20 20 20 20 | t.adds.1.to.its.argument,....... |
| 34600 | 20 20 20 20 20 28 28 63 6f 6d 70 6f 73 65 20 73 71 75 61 72 65 20 69 6e 63 29 20 36 29 0a 20 20 | .....((compose.square.inc).6)... |
| 34620 | 20 20 20 20 20 20 20 20 34 39 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 34 33 3a | ........49.......*Exercise.1.43: |
| 34640 | 2a 20 49 66 20 66 20 69 73 20 61 20 6e 75 6d 65 72 69 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 61 | *.If.f.is.a.numerical.function.a |
| 34660 | 6e 64 20 6e 20 69 73 20 61 20 70 6f 73 69 74 69 76 65 0a 20 20 20 20 20 69 6e 74 65 67 65 72 2c | nd.n.is.a.positive......integer, |
| 34680 | 20 74 68 65 6e 20 77 65 20 63 61 6e 20 66 6f 72 6d 20 74 68 65 20 6e 74 68 20 72 65 70 65 61 74 | .then.we.can.form.the.nth.repeat |
| 346a0 | 65 64 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 66 2c 20 77 68 69 63 68 0a 20 20 20 20 20 | ed.application.of.f,.which...... |
| 346c0 | 69 73 20 64 65 66 69 6e 65 64 20 74 6f 20 62 65 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 77 68 | is.defined.to.be.the.function.wh |
| 346e0 | 6f 73 65 20 76 61 6c 75 65 20 61 74 20 78 20 69 73 0a 20 20 20 20 20 66 28 66 28 2e 2e 2e 28 66 | ose.value.at.x.is......f(f(...(f |
| 34700 | 28 78 29 29 2e 2e 2e 29 29 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 66 20 69 73 | (x))...))...For.example,.if.f.is |
| 34720 | 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 78 20 7c 2d 3e 20 78 20 2b 0a 20 20 20 20 20 31 2c 20 | .the.function.x.|->.x.+......1,. |
| 34740 | 74 68 65 6e 20 74 68 65 20 6e 74 68 20 72 65 70 65 61 74 65 64 20 61 70 70 6c 69 63 61 74 69 6f | then.the.nth.repeated.applicatio |
| 34760 | 6e 20 6f 66 20 66 20 69 73 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 78 20 7c 2d 3e 20 78 0a 20 | n.of.f.is.the.function.x.|->.x.. |
| 34780 | 20 20 20 20 2b 20 6e 2e 20 20 49 66 20 66 20 69 73 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 | ....+.n...If.f.is.the.operation. |
| 347a0 | 6f 66 20 73 71 75 61 72 69 6e 67 20 61 20 6e 75 6d 62 65 72 2c 20 74 68 65 6e 20 74 68 65 20 6e | of.squaring.a.number,.then.the.n |
| 347c0 | 74 68 0a 20 20 20 20 20 72 65 70 65 61 74 65 64 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 | th......repeated.application.of. |
| 347e0 | 66 20 69 73 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 74 68 61 74 20 72 61 69 73 65 73 20 69 74 | f.is.the.function.that.raises.it |
| 34800 | 73 20 61 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 74 6f 20 74 68 65 20 32 5e 6e 74 68 20 70 6f 77 | s.argument......to.the.2^nth.pow |
| 34820 | 65 72 2e 20 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 | er...Write.a.procedure.that.take |
| 34840 | 73 20 61 73 20 69 6e 70 75 74 73 20 61 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 | s.as.inputs.a......procedure.tha |
| 34860 | 74 20 63 6f 6d 70 75 74 65 73 20 66 20 61 6e 64 20 61 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 | t.computes.f.and.a.positive.inte |
| 34880 | 67 65 72 20 6e 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 0a 20 20 20 20 20 70 72 6f 63 65 | ger.n.and.returns.the......proce |
| 348a0 | 64 75 72 65 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 6e 74 68 20 72 65 70 65 61 | dure.that.computes.the.nth.repea |
| 348c0 | 74 65 64 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 66 2e 20 20 59 6f 75 72 0a 20 20 20 20 | ted.application.of.f...Your..... |
| 348e0 | 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 62 65 20 | .procedure.should.be.able.to.be. |
| 34900 | 75 73 65 64 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 72 65 | used.as.follows:............((re |
| 34920 | 70 65 61 74 65 64 20 73 71 75 61 72 65 20 32 29 20 35 29 0a 20 20 20 20 20 20 20 20 20 20 36 32 | peated.square.2).5)...........62 |
| 34940 | 35 0a 0a 20 20 20 20 20 48 69 6e 74 3a 20 59 6f 75 20 6d 61 79 20 66 69 6e 64 20 69 74 20 63 6f | 5.......Hint:.You.may.find.it.co |
| 34960 | 6e 76 65 6e 69 65 6e 74 20 74 6f 20 75 73 65 20 60 63 6f 6d 70 6f 73 65 27 20 66 72 6f 6d 20 2a | nvenient.to.use.`compose'.from.* |
| 34980 | 4e 6f 74 65 0a 20 20 20 20 20 45 78 65 72 63 69 73 65 20 31 2d 34 32 3a 3a 2e 0a 0a 20 20 20 20 | Note......Exercise.1-42::....... |
| 349a0 | 20 2a 45 78 65 72 63 69 73 65 20 31 2e 34 34 3a 2a 20 54 68 65 20 69 64 65 61 20 6f 66 20 22 73 | .*Exercise.1.44:*.The.idea.of."s |
| 349c0 | 6d 6f 6f 74 68 69 6e 67 22 20 61 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 61 6e 0a 20 20 20 20 20 | moothing".a.function.is.an...... |
| 349e0 | 69 6d 70 6f 72 74 61 6e 74 20 63 6f 6e 63 65 70 74 20 69 6e 20 73 69 67 6e 61 6c 20 70 72 6f 63 | important.concept.in.signal.proc |
| 34a00 | 65 73 73 69 6e 67 2e 20 20 49 66 20 66 20 69 73 20 61 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 | essing...If.f.is.a.function.and. |
| 34a20 | 64 78 0a 20 20 20 20 20 69 73 20 73 6f 6d 65 20 73 6d 61 6c 6c 20 6e 75 6d 62 65 72 2c 20 74 68 | dx......is.some.small.number,.th |
| 34a40 | 65 6e 20 74 68 65 20 73 6d 6f 6f 74 68 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 66 20 69 73 20 | en.the.smoothed.version.of.f.is. |
| 34a60 | 74 68 65 0a 20 20 20 20 20 66 75 6e 63 74 69 6f 6e 20 77 68 6f 73 65 20 76 61 6c 75 65 20 61 74 | the......function.whose.value.at |
| 34a80 | 20 61 20 70 6f 69 6e 74 20 78 20 69 73 20 74 68 65 20 61 76 65 72 61 67 65 20 6f 66 20 66 28 78 | .a.point.x.is.the.average.of.f(x |
| 34aa0 | 20 2d 20 64 78 29 2c 0a 20 20 20 20 20 66 28 78 29 2c 20 61 6e 64 20 66 28 78 20 2b 20 64 78 29 | .-.dx),......f(x),.and.f(x.+.dx) |
| 34ac0 | 2e 20 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 73 6d 6f 6f 74 68 27 20 74 68 | ...Write.a.procedure.`smooth'.th |
| 34ae0 | 61 74 20 74 61 6b 65 73 20 61 73 0a 20 20 20 20 20 69 6e 70 75 74 20 61 20 70 72 6f 63 65 64 75 | at.takes.as......input.a.procedu |
| 34b00 | 72 65 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 66 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 | re.that.computes.f.and.returns.a |
| 34b20 | 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 20 20 20 20 20 63 6f 6d 70 75 74 65 73 20 74 68 | .procedure.that......computes.th |
| 34b40 | 65 20 73 6d 6f 6f 74 68 65 64 20 66 2e 20 20 49 74 20 69 73 20 73 6f 6d 65 74 69 6d 65 73 20 76 | e.smoothed.f...It.is.sometimes.v |
| 34b60 | 61 6c 75 61 62 6c 65 20 74 6f 20 72 65 70 65 61 74 65 64 6c 79 0a 20 20 20 20 20 73 6d 6f 6f 74 | aluable.to.repeatedly......smoot |
| 34b80 | 68 20 61 20 66 75 6e 63 74 69 6f 6e 20 28 74 68 61 74 20 69 73 2c 20 73 6d 6f 6f 74 68 20 74 68 | h.a.function.(that.is,.smooth.th |
| 34ba0 | 65 20 73 6d 6f 6f 74 68 65 64 20 66 75 6e 63 74 69 6f 6e 2c 20 61 6e 64 20 73 6f 0a 20 20 20 20 | e.smoothed.function,.and.so..... |
| 34bc0 | 20 6f 6e 29 20 74 6f 20 6f 62 74 61 69 6e 65 64 20 74 68 65 20 22 6e 2d 66 6f 6c 64 20 73 6d 6f | .on).to.obtained.the."n-fold.smo |
| 34be0 | 6f 74 68 65 64 20 66 75 6e 63 74 69 6f 6e 22 2e 20 20 53 68 6f 77 20 68 6f 77 20 74 6f 0a 20 20 | othed.function"...Show.how.to... |
| 34c00 | 20 20 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 6e 2d 66 6f 6c 64 20 73 6d 6f 6f 74 68 65 64 20 | ...generate.the.n-fold.smoothed. |
| 34c20 | 66 75 6e 63 74 69 6f 6e 20 6f 66 20 61 6e 79 20 67 69 76 65 6e 20 66 75 6e 63 74 69 6f 6e 20 75 | function.of.any.given.function.u |
| 34c40 | 73 69 6e 67 0a 20 20 20 20 20 60 73 6d 6f 6f 74 68 27 20 61 6e 64 20 60 72 65 70 65 61 74 65 64 | sing......`smooth'.and.`repeated |
| 34c60 | 27 20 66 72 6f 6d 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 34 33 3a 3a 2e 0a 0a 20 | '.from.*Note.Exercise.1-43::.... |
| 34c80 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 31 2e 34 35 3a 2a 20 57 65 20 73 61 77 20 69 6e 20 73 | ....*Exercise.1.45:*.We.saw.in.s |
| 34ca0 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 33 2d 33 3a 3a 20 74 68 61 74 20 61 74 74 65 6d 70 | ection.*Note.1-3-3::.that.attemp |
| 34cc0 | 74 69 6e 67 0a 20 20 20 20 20 74 6f 20 63 6f 6d 70 75 74 65 20 73 71 75 61 72 65 20 72 6f 6f 74 | ting......to.compute.square.root |
| 34ce0 | 73 20 62 79 20 6e 61 69 76 65 6c 79 20 66 69 6e 64 69 6e 67 20 61 20 66 69 78 65 64 20 70 6f 69 | s.by.naively.finding.a.fixed.poi |
| 34d00 | 6e 74 20 6f 66 20 79 20 7c 2d 3e 0a 20 20 20 20 20 78 2f 79 20 64 6f 65 73 20 6e 6f 74 20 63 6f | nt.of.y.|->......x/y.does.not.co |
| 34d20 | 6e 76 65 72 67 65 2c 20 61 6e 64 20 74 68 61 74 20 74 68 69 73 20 63 61 6e 20 62 65 20 66 69 78 | nverge,.and.that.this.can.be.fix |
| 34d40 | 65 64 20 62 79 20 61 76 65 72 61 67 65 0a 20 20 20 20 20 64 61 6d 70 69 6e 67 2e 20 20 54 68 65 | ed.by.average......damping...The |
| 34d60 | 20 73 61 6d 65 20 6d 65 74 68 6f 64 20 77 6f 72 6b 73 20 66 6f 72 20 66 69 6e 64 69 6e 67 20 63 | .same.method.works.for.finding.c |
| 34d80 | 75 62 65 20 72 6f 6f 74 73 20 61 73 20 66 69 78 65 64 0a 20 20 20 20 20 70 6f 69 6e 74 73 20 6f | ube.roots.as.fixed......points.o |
| 34da0 | 66 20 74 68 65 20 61 76 65 72 61 67 65 2d 64 61 6d 70 65 64 20 79 20 7c 2d 3e 20 78 2f 79 5e 32 | f.the.average-damped.y.|->.x/y^2 |
| 34dc0 | 2e 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 74 68 65 0a 20 20 20 20 20 70 72 6f 63 65 | ...Unfortunately,.the......proce |
| 34de0 | 73 73 20 64 6f 65 73 20 6e 6f 74 20 77 6f 72 6b 20 66 6f 72 20 66 6f 75 72 74 68 20 72 6f 6f 74 | ss.does.not.work.for.fourth.root |
| 34e00 | 73 2d 2d 61 20 73 69 6e 67 6c 65 20 61 76 65 72 61 67 65 20 64 61 6d 70 20 69 73 0a 20 20 20 20 | s--a.single.average.damp.is..... |
| 34e20 | 20 6e 6f 74 20 65 6e 6f 75 67 68 20 74 6f 20 6d 61 6b 65 20 61 20 66 69 78 65 64 2d 70 6f 69 6e | .not.enough.to.make.a.fixed-poin |
| 34e40 | 74 20 73 65 61 72 63 68 20 66 6f 72 20 79 20 7c 2d 3e 20 78 2f 79 5e 33 20 63 6f 6e 76 65 72 67 | t.search.for.y.|->.x/y^3.converg |
| 34e60 | 65 2e 0a 20 20 20 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 69 66 20 77 65 | e.......On.the.other.hand,.if.we |
| 34e80 | 20 61 76 65 72 61 67 65 20 64 61 6d 70 20 74 77 69 63 65 20 28 69 2e 65 2e 2c 20 75 73 65 20 74 | .average.damp.twice.(i.e.,.use.t |
| 34ea0 | 68 65 20 61 76 65 72 61 67 65 0a 20 20 20 20 20 64 61 6d 70 20 6f 66 20 74 68 65 20 61 76 65 72 | he.average......damp.of.the.aver |
| 34ec0 | 61 67 65 20 64 61 6d 70 20 6f 66 20 79 20 7c 2d 3e 20 78 2f 79 5e 33 29 20 74 68 65 20 66 69 78 | age.damp.of.y.|->.x/y^3).the.fix |
| 34ee0 | 65 64 2d 70 6f 69 6e 74 20 73 65 61 72 63 68 0a 20 20 20 20 20 64 6f 65 73 20 63 6f 6e 76 65 72 | ed-point.search......does.conver |
| 34f00 | 67 65 2e 20 20 44 6f 20 73 6f 6d 65 20 65 78 70 65 72 69 6d 65 6e 74 73 20 74 6f 20 64 65 74 65 | ge...Do.some.experiments.to.dete |
| 34f20 | 72 6d 69 6e 65 20 68 6f 77 20 6d 61 6e 79 20 61 76 65 72 61 67 65 0a 20 20 20 20 20 64 61 6d 70 | rmine.how.many.average......damp |
| 34f40 | 73 20 61 72 65 20 72 65 71 75 69 72 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 6e 74 68 20 72 6f | s.are.required.to.compute.nth.ro |
| 34f60 | 6f 74 73 20 61 73 20 61 20 66 69 78 65 64 2d 70 6f 69 6e 74 20 73 65 61 72 63 68 0a 20 20 20 20 | ots.as.a.fixed-point.search..... |
| 34f80 | 20 62 61 73 65 64 20 75 70 6f 6e 20 72 65 70 65 61 74 65 64 20 61 76 65 72 61 67 65 20 64 61 6d | .based.upon.repeated.average.dam |
| 34fa0 | 70 69 6e 67 20 6f 66 20 79 20 7c 2d 3e 20 78 2f 79 5e 28 6e 2d 31 29 2e 20 20 55 73 65 20 74 68 | ping.of.y.|->.x/y^(n-1)...Use.th |
| 34fc0 | 69 73 0a 20 20 20 20 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 61 20 73 69 6d 70 6c 65 20 70 72 | is......to.implement.a.simple.pr |
| 34fe0 | 6f 63 65 64 75 72 65 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 6e 74 68 20 72 6f 6f 74 73 20 | ocedure.for.computing.nth.roots. |
| 35000 | 75 73 69 6e 67 0a 20 20 20 20 20 60 66 69 78 65 64 2d 70 6f 69 6e 74 27 2c 20 60 61 76 65 72 61 | using......`fixed-point',.`avera |
| 35020 | 67 65 2d 64 61 6d 70 27 2c 20 61 6e 64 20 74 68 65 20 60 72 65 70 65 61 74 65 64 27 20 70 72 6f | ge-damp',.and.the.`repeated'.pro |
| 35040 | 63 65 64 75 72 65 20 6f 66 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d | cedure.of......*Note.Exercise.1- |
| 35060 | 34 33 3a 3a 2e 20 20 41 73 73 75 6d 65 20 74 68 61 74 20 61 6e 79 20 61 72 69 74 68 6d 65 74 69 | 43::...Assume.that.any.arithmeti |
| 35080 | 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 79 6f 75 0a 20 20 20 20 20 6e 65 65 64 20 61 72 65 20 61 | c.operations.you......need.are.a |
| 350a0 | 76 61 69 6c 61 62 6c 65 20 61 73 20 70 72 69 6d 69 74 69 76 65 73 2e 0a 0a 20 20 20 20 20 2a 45 | vailable.as.primitives........*E |
| 350c0 | 78 65 72 63 69 73 65 20 31 2e 34 36 3a 2a 20 53 65 76 65 72 61 6c 20 6f 66 20 74 68 65 20 6e 75 | xercise.1.46:*.Several.of.the.nu |
| 350e0 | 6d 65 72 69 63 61 6c 20 6d 65 74 68 6f 64 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 0a 20 20 20 | merical.methods.described.in.... |
| 35100 | 20 20 74 68 69 73 20 63 68 61 70 74 65 72 20 61 72 65 20 69 6e 73 74 61 6e 63 65 73 20 6f 66 20 | ..this.chapter.are.instances.of. |
| 35120 | 61 6e 20 65 78 74 72 65 6d 65 6c 79 20 67 65 6e 65 72 61 6c 20 63 6f 6d 70 75 74 61 74 69 6f 6e | an.extremely.general.computation |
| 35140 | 61 6c 0a 20 20 20 20 20 73 74 72 61 74 65 67 79 20 6b 6e 6f 77 6e 20 61 73 20 22 69 74 65 72 61 | al......strategy.known.as."itera |
| 35160 | 74 69 76 65 20 69 6d 70 72 6f 76 65 6d 65 6e 74 22 2e 20 20 49 74 65 72 61 74 69 76 65 20 69 6d | tive.improvement"...Iterative.im |
| 35180 | 70 72 6f 76 65 6d 65 6e 74 0a 20 20 20 20 20 73 61 79 73 20 74 68 61 74 2c 20 74 6f 20 63 6f 6d | provement......says.that,.to.com |
| 351a0 | 70 75 74 65 20 73 6f 6d 65 74 68 69 6e 67 2c 20 77 65 20 73 74 61 72 74 20 77 69 74 68 20 61 6e | pute.something,.we.start.with.an |
| 351c0 | 20 69 6e 69 74 69 61 6c 20 67 75 65 73 73 0a 20 20 20 20 20 66 6f 72 20 74 68 65 20 61 6e 73 77 | .initial.guess......for.the.answ |
| 351e0 | 65 72 2c 20 74 65 73 74 20 69 66 20 74 68 65 20 67 75 65 73 73 20 69 73 20 67 6f 6f 64 20 65 6e | er,.test.if.the.guess.is.good.en |
| 35200 | 6f 75 67 68 2c 20 61 6e 64 20 6f 74 68 65 72 77 69 73 65 0a 20 20 20 20 20 69 6d 70 72 6f 76 65 | ough,.and.otherwise......improve |
| 35220 | 20 74 68 65 20 67 75 65 73 73 20 61 6e 64 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 70 72 6f 63 | .the.guess.and.continue.the.proc |
| 35240 | 65 73 73 20 75 73 69 6e 67 20 74 68 65 20 69 6d 70 72 6f 76 65 64 0a 20 20 20 20 20 67 75 65 73 | ess.using.the.improved......gues |
| 35260 | 73 20 61 73 20 74 68 65 20 6e 65 77 20 67 75 65 73 73 2e 20 20 57 72 69 74 65 20 61 20 70 72 6f | s.as.the.new.guess...Write.a.pro |
| 35280 | 63 65 64 75 72 65 20 60 69 74 65 72 61 74 69 76 65 2d 69 6d 70 72 6f 76 65 27 0a 20 20 20 20 20 | cedure.`iterative-improve'...... |
| 352a0 | 74 68 61 74 20 74 61 6b 65 73 20 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 61 72 67 | that.takes.two.procedures.as.arg |
| 352c0 | 75 6d 65 6e 74 73 3a 20 61 20 6d 65 74 68 6f 64 20 66 6f 72 20 74 65 6c 6c 69 6e 67 0a 20 20 20 | uments:.a.method.for.telling.... |
| 352e0 | 20 20 77 68 65 74 68 65 72 20 61 20 67 75 65 73 73 20 69 73 20 67 6f 6f 64 20 65 6e 6f 75 67 68 | ..whether.a.guess.is.good.enough |
| 35300 | 20 61 6e 64 20 61 20 6d 65 74 68 6f 64 20 66 6f 72 20 69 6d 70 72 6f 76 69 6e 67 20 61 20 67 75 | .and.a.method.for.improving.a.gu |
| 35320 | 65 73 73 2e 0a 20 20 20 20 20 60 49 74 65 72 61 74 69 76 65 2d 69 6d 70 72 6f 76 65 27 20 73 68 | ess.......`Iterative-improve'.sh |
| 35340 | 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 73 20 69 74 73 20 76 61 6c 75 65 20 61 20 70 72 6f 63 65 | ould.return.as.its.value.a.proce |
| 35360 | 64 75 72 65 20 74 68 61 74 0a 20 20 20 20 20 74 61 6b 65 73 20 61 20 67 75 65 73 73 20 61 73 20 | dure.that......takes.a.guess.as. |
| 35380 | 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 6b 65 65 70 73 20 69 6d 70 72 6f 76 69 6e 67 20 74 68 65 | argument.and.keeps.improving.the |
| 353a0 | 20 67 75 65 73 73 20 75 6e 74 69 6c 20 69 74 0a 20 20 20 20 20 69 73 20 67 6f 6f 64 20 65 6e 6f | .guess.until.it......is.good.eno |
| 353c0 | 75 67 68 2e 20 20 52 65 77 72 69 74 65 20 74 68 65 20 60 73 71 72 74 27 20 70 72 6f 63 65 64 75 | ugh...Rewrite.the.`sqrt'.procedu |
| 353e0 | 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 31 2d 31 2d 37 3a 3a | re.of.section.*Note......1-1-7:: |
| 35400 | 20 61 6e 64 20 74 68 65 20 60 66 69 78 65 64 2d 70 6f 69 6e 74 27 20 70 72 6f 63 65 64 75 72 65 | .and.the.`fixed-point'.procedure |
| 35420 | 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 33 2d 33 3a 3a 0a 20 20 20 20 20 69 | .of.section.*Note.1-3-3::......i |
| 35440 | 6e 20 74 65 72 6d 73 20 6f 66 20 60 69 74 65 72 61 74 69 76 65 2d 69 6d 70 72 6f 76 65 27 2e 0a | n.terms.of.`iterative-improve'.. |
| 35460 | 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d | ....----------.Footnotes.------- |
| 35480 | 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 74 68 69 73 20 69 73 | ---.....(1).Observe.that.this.is |
| 354a0 | 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 77 68 6f 73 65 20 6f 70 65 72 61 74 6f 72 20 69 73 | .a.combination.whose.operator.is |
| 354c0 | 20 69 74 73 65 6c 66 20 61 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 2e 20 20 2a 4e 6f 74 65 20 45 78 | .itself.a.combination...*Note.Ex |
| 354e0 | 65 72 63 69 73 65 20 31 2d 34 3a 3a 20 61 6c 72 65 61 64 79 20 64 65 6d 6f 6e 73 74 72 61 74 65 | ercise.1-4::.already.demonstrate |
| 35500 | 64 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 0a 66 6f 72 6d 20 73 75 63 68 20 63 6f 6d 62 69 | d.the.ability.to.form.such.combi |
| 35520 | 6e 61 74 69 6f 6e 73 2c 20 62 75 74 20 74 68 61 74 20 77 61 73 20 6f 6e 6c 79 20 61 20 74 6f 79 | nations,.but.that.was.only.a.toy |
| 35540 | 20 65 78 61 6d 70 6c 65 2e 20 20 48 65 72 65 20 77 65 20 62 65 67 69 6e 0a 74 6f 20 73 65 65 20 | .example...Here.we.begin.to.see. |
| 35560 | 74 68 65 20 72 65 61 6c 20 6e 65 65 64 20 66 6f 72 20 73 75 63 68 20 63 6f 6d 62 69 6e 61 74 69 | the.real.need.for.such.combinati |
| 35580 | 6f 6e 73 2d 2d 77 68 65 6e 20 61 70 70 6c 79 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 0a 74 | ons--when.applying.a.procedure.t |
| 355a0 | 68 61 74 20 69 73 20 6f 62 74 61 69 6e 65 64 20 61 73 20 74 68 65 20 76 61 6c 75 65 20 72 65 74 | hat.is.obtained.as.the.value.ret |
| 355c0 | 75 72 6e 65 64 20 62 79 20 61 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 | urned.by.a.higher-order.procedur |
| 355e0 | 65 2e 0a 0a 20 20 20 28 32 29 20 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d | e......(2).See.*Note.Exercise.1- |
| 35600 | 34 35 3a 3a 20 66 6f 72 20 61 20 66 75 72 74 68 65 72 20 67 65 6e 65 72 61 6c 69 7a 61 74 69 6f | 45::.for.a.further.generalizatio |
| 35620 | 6e 2e 0a 0a 20 20 20 28 33 29 20 45 6c 65 6d 65 6e 74 61 72 79 20 63 61 6c 63 75 6c 75 73 20 62 | n......(3).Elementary.calculus.b |
| 35640 | 6f 6f 6b 73 20 75 73 75 61 6c 6c 79 20 64 65 73 63 72 69 62 65 20 4e 65 77 74 6f 6e 27 73 20 6d | ooks.usually.describe.Newton's.m |
| 35660 | 65 74 68 6f 64 20 69 6e 0a 74 65 72 6d 73 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f | ethod.in.terms.of.the.sequence.o |
| 35680 | 66 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 78 5f 28 6e 2b 31 29 20 3d 20 78 5f 6e 20 2d | f.approximations.x_(n+1).=.x_n.- |
| 356a0 | 20 67 28 78 5f 6e 29 2f 44 67 28 78 5f 6e 29 2e 0a 48 61 76 69 6e 67 20 6c 61 6e 67 75 61 67 65 | .g(x_n)/Dg(x_n)..Having.language |
| 356c0 | 20 66 6f 72 20 74 61 6c 6b 69 6e 67 20 61 62 6f 75 74 20 70 72 6f 63 65 73 73 65 73 20 61 6e 64 | .for.talking.about.processes.and |
| 356e0 | 20 75 73 69 6e 67 20 74 68 65 20 69 64 65 61 20 6f 66 0a 66 69 78 65 64 20 70 6f 69 6e 74 73 20 | .using.the.idea.of.fixed.points. |
| 35700 | 73 69 6d 70 6c 69 66 69 65 73 20 74 68 65 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 74 68 | simplifies.the.description.of.th |
| 35720 | 65 20 6d 65 74 68 6f 64 2e 0a 0a 20 20 20 28 34 29 20 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f | e.method......(4).Newton's.metho |
| 35740 | 64 20 64 6f 65 73 20 6e 6f 74 20 61 6c 77 61 79 73 20 63 6f 6e 76 65 72 67 65 20 74 6f 20 61 6e | d.does.not.always.converge.to.an |
| 35760 | 20 61 6e 73 77 65 72 2c 20 62 75 74 20 69 74 20 63 61 6e 0a 62 65 20 73 68 6f 77 6e 20 74 68 61 | .answer,.but.it.can.be.shown.tha |
| 35780 | 74 20 69 6e 20 66 61 76 6f 72 61 62 6c 65 20 63 61 73 65 73 20 65 61 63 68 20 69 74 65 72 61 74 | t.in.favorable.cases.each.iterat |
| 357a0 | 69 6f 6e 20 64 6f 75 62 6c 65 73 20 74 68 65 0a 6e 75 6d 62 65 72 2d 6f 66 2d 64 69 67 69 74 73 | ion.doubles.the.number-of-digits |
| 357c0 | 20 61 63 63 75 72 61 63 79 20 6f 66 20 74 68 65 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 74 | .accuracy.of.the.approximation.t |
| 357e0 | 6f 20 74 68 65 20 73 6f 6c 75 74 69 6f 6e 2e 20 20 49 6e 0a 73 75 63 68 20 63 61 73 65 73 2c 20 | o.the.solution...In.such.cases,. |
| 35800 | 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 20 77 69 6c 6c 20 63 6f 6e 76 65 72 67 65 20 6d 75 | Newton's.method.will.converge.mu |
| 35820 | 63 68 20 6d 6f 72 65 20 72 61 70 69 64 6c 79 20 74 68 61 6e 20 74 68 65 0a 68 61 6c 66 2d 69 6e | ch.more.rapidly.than.the.half-in |
| 35840 | 74 65 72 76 61 6c 20 6d 65 74 68 6f 64 2e 0a 0a 20 20 20 28 35 29 20 46 6f 72 20 66 69 6e 64 69 | terval.method......(5).For.findi |
| 35860 | 6e 67 20 73 71 75 61 72 65 20 72 6f 6f 74 73 2c 20 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 | ng.square.roots,.Newton's.method |
| 35880 | 20 63 6f 6e 76 65 72 67 65 73 20 72 61 70 69 64 6c 79 20 74 6f 0a 74 68 65 20 63 6f 72 72 65 63 | .converges.rapidly.to.the.correc |
| 358a0 | 74 20 73 6f 6c 75 74 69 6f 6e 20 66 72 6f 6d 20 61 6e 79 20 73 74 61 72 74 69 6e 67 20 70 6f 69 | t.solution.from.any.starting.poi |
| 358c0 | 6e 74 2e 0a 0a 20 20 20 28 36 29 20 54 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 20 66 69 72 73 74 2d | nt......(6).The.notion.of.first- |
| 358e0 | 63 6c 61 73 73 20 73 74 61 74 75 73 20 6f 66 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2d 6c 61 6e 67 | class.status.of.programming-lang |
| 35900 | 75 61 67 65 0a 65 6c 65 6d 65 6e 74 73 20 69 73 20 64 75 65 20 74 6f 20 74 68 65 20 42 72 69 74 | uage.elements.is.due.to.the.Brit |
| 35920 | 69 73 68 20 63 6f 6d 70 75 74 65 72 20 73 63 69 65 6e 74 69 73 74 20 43 68 72 69 73 74 6f 70 68 | ish.computer.scientist.Christoph |
| 35940 | 65 72 20 53 74 72 61 63 68 65 79 0a 28 31 39 31 36 2d 31 39 37 35 29 2e 0a 0a 20 20 20 28 37 29 | er.Strachey.(1916-1975)......(7) |
| 35960 | 20 57 65 27 6c 6c 20 73 65 65 20 65 78 61 6d 70 6c 65 73 20 6f 66 20 74 68 69 73 20 61 66 74 65 | .We'll.see.examples.of.this.afte |
| 35980 | 72 20 77 65 20 69 6e 74 72 6f 64 75 63 65 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 69 | r.we.introduce.data.structures.i |
| 359a0 | 6e 0a 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 32 3a 3a 2e 0a 0a 20 20 20 28 38 29 20 54 68 65 | n.*Note.Chapter.2::......(8).The |
| 359c0 | 20 6d 61 6a 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 63 6f 73 74 20 6f 66 20 66 69 | .major.implementation.cost.of.fi |
| 359e0 | 72 73 74 2d 63 6c 61 73 73 20 70 72 6f 63 65 64 75 72 65 73 20 69 73 20 74 68 61 74 0a 61 6c 6c | rst-class.procedures.is.that.all |
| 35a00 | 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 62 65 20 72 65 74 75 72 6e 65 64 20 | owing.procedures.to.be.returned. |
| 35a20 | 61 73 20 76 61 6c 75 65 73 20 72 65 71 75 69 72 65 73 20 72 65 73 65 72 76 69 6e 67 20 73 74 6f | as.values.requires.reserving.sto |
| 35a40 | 72 61 67 65 0a 66 6f 72 20 61 20 70 72 6f 63 65 64 75 72 65 27 73 20 66 72 65 65 20 76 61 72 69 | rage.for.a.procedure's.free.vari |
| 35a60 | 61 62 6c 65 73 20 65 76 65 6e 20 77 68 69 6c 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 | ables.even.while.the.procedure.i |
| 35a80 | 73 20 6e 6f 74 0a 65 78 65 63 75 74 69 6e 67 2e 20 20 49 6e 20 74 68 65 20 53 63 68 65 6d 65 20 | s.not.executing...In.the.Scheme. |
| 35aa0 | 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 77 65 20 77 69 6c 6c 20 73 74 75 64 79 20 69 6e 20 | implementation.we.will.study.in. |
| 35ac0 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 34 2d 31 3a 3a 2c 20 74 68 65 73 65 20 76 61 72 69 61 | section.*Note.4-1::,.these.varia |
| 35ae0 | 62 6c 65 73 20 61 72 65 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 | bles.are.stored.in.the.procedure |
| 35b00 | 27 73 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e | 's.environment.....File:.sicp.in |
| 35b20 | 66 6f 2c 20 20 4e 6f 64 65 3a 20 43 68 61 70 74 65 72 20 32 2c 20 20 4e 65 78 74 3a 20 43 68 61 | fo,..Node:.Chapter.2,..Next:.Cha |
| 35b40 | 70 74 65 72 20 33 2c 20 20 50 72 65 76 3a 20 43 68 61 70 74 65 72 20 31 2c 20 20 55 70 3a 20 54 | pter.3,..Prev:.Chapter.1,..Up:.T |
| 35b60 | 6f 70 0a 0a 32 20 42 75 69 6c 64 69 6e 67 20 41 62 73 74 72 61 63 74 69 6f 6e 73 20 77 69 74 68 | op..2.Building.Abstractions.with |
| 35b80 | 20 44 61 74 61 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a | .Data.************************** |
| 35ba0 | 2a 2a 2a 2a 2a 2a 2a 0a 0a 20 20 20 20 20 57 65 20 6e 6f 77 20 63 6f 6d 65 20 74 6f 20 74 68 65 | *******.......We.now.come.to.the |
| 35bc0 | 20 64 65 63 69 73 69 76 65 20 73 74 65 70 20 6f 66 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 61 | .decisive.step.of.mathematical.a |
| 35be0 | 62 73 74 72 61 63 74 69 6f 6e 3a 20 77 65 0a 20 20 20 20 20 66 6f 72 67 65 74 20 61 62 6f 75 74 | bstraction:.we......forget.about |
| 35c00 | 20 77 68 61 74 20 74 68 65 20 73 79 6d 62 6f 6c 73 20 73 74 61 6e 64 20 66 6f 72 2e 20 2e 2e 2e | .what.the.symbols.stand.for..... |
| 35c20 | 5b 54 68 65 20 6d 61 74 68 65 6d 61 74 69 63 69 61 6e 5d 0a 20 20 20 20 20 6e 65 65 64 20 6e 6f | [The.mathematician]......need.no |
| 35c40 | 74 20 62 65 20 69 64 6c 65 3b 20 74 68 65 72 65 20 61 72 65 20 6d 61 6e 79 20 6f 70 65 72 61 74 | t.be.idle;.there.are.many.operat |
| 35c60 | 69 6f 6e 73 20 77 68 69 63 68 20 68 65 20 6d 61 79 20 63 61 72 72 79 20 6f 75 74 0a 20 20 20 20 | ions.which.he.may.carry.out..... |
| 35c80 | 20 77 69 74 68 20 74 68 65 73 65 20 73 79 6d 62 6f 6c 73 2c 20 77 69 74 68 6f 75 74 20 65 76 65 | .with.these.symbols,.without.eve |
| 35ca0 | 72 20 68 61 76 69 6e 67 20 74 6f 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 68 69 6e 67 73 20 74 | r.having.to.look.at.the.things.t |
| 35cc0 | 68 65 79 0a 20 20 20 20 20 73 74 61 6e 64 20 66 6f 72 2e 0a 0a 20 20 20 20 20 2d 2d 48 65 72 6d | hey......stand.for........--Herm |
| 35ce0 | 61 6e 6e 20 57 65 79 6c 2c 20 60 54 68 65 20 4d 61 74 68 65 6d 61 74 69 63 61 6c 20 57 61 79 20 | ann.Weyl,.`The.Mathematical.Way. |
| 35d00 | 6f 66 20 54 68 69 6e 6b 69 6e 67 27 0a 0a 20 20 20 57 65 20 63 6f 6e 63 65 6e 74 72 61 74 65 64 | of.Thinking'.....We.concentrated |
| 35d20 | 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 31 3a 3a 20 6f 6e 20 63 6f 6d 70 75 74 61 | .in.*Note.Chapter.1::.on.computa |
| 35d40 | 74 69 6f 6e 61 6c 20 70 72 6f 63 65 73 73 65 73 20 61 6e 64 0a 6f 6e 20 74 68 65 20 72 6f 6c 65 | tional.processes.and.on.the.role |
| 35d60 | 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 70 72 6f 67 72 61 6d 20 64 65 73 69 67 6e | .of.procedures.in.program.design |
| 35d80 | 2e 20 20 57 65 20 73 61 77 20 68 6f 77 20 74 6f 20 75 73 65 0a 70 72 69 6d 69 74 69 76 65 20 64 | ...We.saw.how.to.use.primitive.d |
| 35da0 | 61 74 61 20 28 6e 75 6d 62 65 72 73 29 20 61 6e 64 20 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 | ata.(numbers).and.primitive.oper |
| 35dc0 | 61 74 69 6f 6e 73 20 28 61 72 69 74 68 6d 65 74 69 63 0a 6f 70 65 72 61 74 69 6f 6e 73 29 2c 20 | ations.(arithmetic.operations),. |
| 35de0 | 68 6f 77 20 74 6f 20 63 6f 6d 62 69 6e 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 66 6f 72 | how.to.combine.procedures.to.for |
| 35e00 | 6d 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 0a 74 68 72 6f 75 67 68 20 63 6f | m.compound.procedures.through.co |
| 35e20 | 6d 70 6f 73 69 74 69 6f 6e 2c 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 73 2c 20 61 6e 64 20 74 68 65 | mposition,.conditionals,.and.the |
| 35e40 | 20 75 73 65 20 6f 66 20 70 61 72 61 6d 65 74 65 72 73 2c 20 61 6e 64 20 68 6f 77 0a 74 6f 20 61 | .use.of.parameters,.and.how.to.a |
| 35e60 | 62 73 74 72 61 63 74 20 70 72 6f 63 65 64 75 72 65 73 20 62 79 20 75 73 69 6e 67 20 60 64 65 66 | bstract.procedures.by.using.`def |
| 35e80 | 69 6e 65 27 2e 20 20 57 65 20 73 61 77 20 74 68 61 74 20 61 20 70 72 6f 63 65 64 75 72 65 20 63 | ine'...We.saw.that.a.procedure.c |
| 35ea0 | 61 6e 0a 62 65 20 72 65 67 61 72 64 65 64 20 61 73 20 61 20 70 61 74 74 65 72 6e 20 66 6f 72 20 | an.be.regarded.as.a.pattern.for. |
| 35ec0 | 74 68 65 20 6c 6f 63 61 6c 20 65 76 6f 6c 75 74 69 6f 6e 20 6f 66 20 61 20 70 72 6f 63 65 73 73 | the.local.evolution.of.a.process |
| 35ee0 | 2c 20 61 6e 64 20 77 65 0a 63 6c 61 73 73 69 66 69 65 64 2c 20 72 65 61 73 6f 6e 65 64 20 61 62 | ,.and.we.classified,.reasoned.ab |
| 35f00 | 6f 75 74 2c 20 61 6e 64 20 70 65 72 66 6f 72 6d 65 64 20 73 69 6d 70 6c 65 20 61 6c 67 6f 72 69 | out,.and.performed.simple.algori |
| 35f20 | 74 68 6d 69 63 20 61 6e 61 6c 79 73 65 73 20 6f 66 0a 73 6f 6d 65 20 63 6f 6d 6d 6f 6e 20 70 61 | thmic.analyses.of.some.common.pa |
| 35f40 | 74 74 65 72 6e 73 20 66 6f 72 20 70 72 6f 63 65 73 73 65 73 20 61 73 20 65 6d 62 6f 64 69 65 64 | tterns.for.processes.as.embodied |
| 35f60 | 20 69 6e 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 57 65 20 61 6c 73 6f 0a 73 61 77 20 74 68 61 | .in.procedures...We.also.saw.tha |
| 35f80 | 74 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 73 20 65 6e 68 61 6e 63 | t.higher-order.procedures.enhanc |
| 35fa0 | 65 20 74 68 65 20 70 6f 77 65 72 20 6f 66 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 62 79 0a 65 | e.the.power.of.our.language.by.e |
| 35fc0 | 6e 61 62 6c 69 6e 67 20 75 73 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 2c 20 61 6e 64 20 74 68 | nabling.us.to.manipulate,.and.th |
| 35fe0 | 65 72 65 62 79 20 74 6f 20 72 65 61 73 6f 6e 20 69 6e 20 74 65 72 6d 73 20 6f 66 2c 20 67 65 6e | ereby.to.reason.in.terms.of,.gen |
| 36000 | 65 72 61 6c 0a 6d 65 74 68 6f 64 73 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 54 68 | eral.methods.of.computation...Th |
| 36020 | 69 73 20 69 73 20 6d 75 63 68 20 6f 66 20 74 68 65 20 65 73 73 65 6e 63 65 20 6f 66 20 70 72 6f | is.is.much.of.the.essence.of.pro |
| 36040 | 67 72 61 6d 6d 69 6e 67 2e 0a 0a 20 20 20 49 6e 20 74 68 69 73 20 63 68 61 70 74 65 72 20 77 65 | gramming......In.this.chapter.we |
| 36060 | 20 61 72 65 20 67 6f 69 6e 67 20 74 6f 20 6c 6f 6f 6b 20 61 74 20 6d 6f 72 65 20 63 6f 6d 70 6c | .are.going.to.look.at.more.compl |
| 36080 | 65 78 20 64 61 74 61 2e 20 20 41 6c 6c 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 | ex.data...All.the.procedures.in. |
| 360a0 | 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 31 3a 3a 20 6f 70 65 72 61 74 65 20 6f 6e 20 73 69 6d | *Note.Chapter.1::.operate.on.sim |
| 360c0 | 70 6c 65 20 6e 75 6d 65 72 69 63 61 6c 20 64 61 74 61 2c 20 61 6e 64 0a 73 69 6d 70 6c 65 20 64 | ple.numerical.data,.and.simple.d |
| 360e0 | 61 74 61 20 61 72 65 20 6e 6f 74 20 73 75 66 66 69 63 69 65 6e 74 20 66 6f 72 20 6d 61 6e 79 20 | ata.are.not.sufficient.for.many. |
| 36100 | 6f 66 20 74 68 65 20 70 72 6f 62 6c 65 6d 73 20 77 65 20 77 69 73 68 20 74 6f 0a 61 64 64 72 65 | of.the.problems.we.wish.to.addre |
| 36120 | 73 73 20 75 73 69 6e 67 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 50 72 6f 67 72 61 6d 73 20 | ss.using.computation...Programs. |
| 36140 | 61 72 65 20 74 79 70 69 63 61 6c 6c 79 20 64 65 73 69 67 6e 65 64 20 74 6f 20 6d 6f 64 65 6c 0a | are.typically.designed.to.model. |
| 36160 | 63 6f 6d 70 6c 65 78 20 70 68 65 6e 6f 6d 65 6e 61 2c 20 61 6e 64 20 6d 6f 72 65 20 6f 66 74 65 | complex.phenomena,.and.more.ofte |
| 36180 | 6e 20 74 68 61 6e 20 6e 6f 74 20 6f 6e 65 20 6d 75 73 74 20 63 6f 6e 73 74 72 75 63 74 0a 63 6f | n.than.not.one.must.construct.co |
| 361a0 | 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 20 74 68 61 74 20 68 61 76 65 20 73 65 | mputational.objects.that.have.se |
| 361c0 | 76 65 72 61 6c 20 70 61 72 74 73 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 6d 6f 64 65 6c 0a 72 65 | veral.parts.in.order.to.model.re |
| 361e0 | 61 6c 2d 77 6f 72 6c 64 20 70 68 65 6e 6f 6d 65 6e 61 20 74 68 61 74 20 68 61 76 65 20 73 65 76 | al-world.phenomena.that.have.sev |
| 36200 | 65 72 61 6c 20 61 73 70 65 63 74 73 2e 20 20 54 68 75 73 2c 20 77 68 65 72 65 61 73 20 6f 75 72 | eral.aspects...Thus,.whereas.our |
| 36220 | 0a 66 6f 63 75 73 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 31 3a 3a 20 77 61 73 20 | .focus.in.*Note.Chapter.1::.was. |
| 36240 | 6f 6e 20 62 75 69 6c 64 69 6e 67 20 61 62 73 74 72 61 63 74 69 6f 6e 73 20 62 79 20 63 6f 6d 62 | on.building.abstractions.by.comb |
| 36260 | 69 6e 69 6e 67 0a 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 66 6f 72 6d 20 63 6f 6d 70 6f 75 6e | ining.procedures.to.form.compoun |
| 36280 | 64 20 70 72 6f 63 65 64 75 72 65 73 2c 20 77 65 20 74 75 72 6e 20 69 6e 20 74 68 69 73 20 63 68 | d.procedures,.we.turn.in.this.ch |
| 362a0 | 61 70 74 65 72 20 74 6f 0a 61 6e 6f 74 68 65 72 20 6b 65 79 20 61 73 70 65 63 74 20 6f 66 20 61 | apter.to.another.key.aspect.of.a |
| 362c0 | 6e 79 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 3a 20 74 68 65 20 6d 65 61 | ny.programming.language:.the.mea |
| 362e0 | 6e 73 20 69 74 20 70 72 6f 76 69 64 65 73 0a 66 6f 72 20 62 75 69 6c 64 69 6e 67 20 61 62 73 74 | ns.it.provides.for.building.abst |
| 36300 | 72 61 63 74 69 6f 6e 73 20 62 79 20 63 6f 6d 62 69 6e 69 6e 67 20 64 61 74 61 20 6f 62 6a 65 63 | ractions.by.combining.data.objec |
| 36320 | 74 73 20 74 6f 20 66 6f 72 6d 20 22 63 6f 6d 70 6f 75 6e 64 0a 64 61 74 61 22 2e 0a 0a 20 20 20 | ts.to.form."compound.data"...... |
| 36340 | 57 68 79 20 64 6f 20 77 65 20 77 61 6e 74 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 69 6e 20 | Why.do.we.want.compound.data.in. |
| 36360 | 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 3f 20 20 46 6f 72 20 74 68 65 | a.programming.language?..For.the |
| 36380 | 0a 73 61 6d 65 20 72 65 61 73 6f 6e 73 20 74 68 61 74 20 77 65 20 77 61 6e 74 20 63 6f 6d 70 6f | .same.reasons.that.we.want.compo |
| 363a0 | 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 3a 20 74 6f 20 65 6c 65 76 61 74 65 20 74 68 65 0a 63 | und.procedures:.to.elevate.the.c |
| 363c0 | 6f 6e 63 65 70 74 75 61 6c 20 6c 65 76 65 6c 20 61 74 20 77 68 69 63 68 20 77 65 20 63 61 6e 20 | onceptual.level.at.which.we.can. |
| 363e0 | 64 65 73 69 67 6e 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 2c 20 74 6f 20 69 6e 63 72 65 61 73 65 | design.our.programs,.to.increase |
| 36400 | 20 74 68 65 0a 6d 6f 64 75 6c 61 72 69 74 79 20 6f 66 20 6f 75 72 20 64 65 73 69 67 6e 73 2c 20 | .the.modularity.of.our.designs,. |
| 36420 | 61 6e 64 20 74 6f 20 65 6e 68 61 6e 63 65 20 74 68 65 20 65 78 70 72 65 73 73 69 76 65 20 70 6f | and.to.enhance.the.expressive.po |
| 36440 | 77 65 72 20 6f 66 20 6f 75 72 0a 6c 61 6e 67 75 61 67 65 2e 20 20 4a 75 73 74 20 61 73 20 74 68 | wer.of.our.language...Just.as.th |
| 36460 | 65 20 61 62 69 6c 69 74 79 20 74 6f 20 64 65 66 69 6e 65 20 70 72 6f 63 65 64 75 72 65 73 20 65 | e.ability.to.define.procedures.e |
| 36480 | 6e 61 62 6c 65 73 20 75 73 20 74 6f 20 64 65 61 6c 0a 77 69 74 68 20 70 72 6f 63 65 73 73 65 73 | nables.us.to.deal.with.processes |
| 364a0 | 20 61 74 20 61 20 68 69 67 68 65 72 20 63 6f 6e 63 65 70 74 75 61 6c 20 6c 65 76 65 6c 20 74 68 | .at.a.higher.conceptual.level.th |
| 364c0 | 61 6e 20 74 68 61 74 20 6f 66 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 0a 6f 70 65 72 61 74 69 | an.that.of.the.primitive.operati |
| 364e0 | 6f 6e 73 20 6f 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 2c 20 74 68 65 20 61 62 69 6c 69 74 79 | ons.of.the.language,.the.ability |
| 36500 | 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 0a 6f 62 6a 65 | .to.construct.compound.data.obje |
| 36520 | 63 74 73 20 65 6e 61 62 6c 65 73 20 75 73 20 74 6f 20 64 65 61 6c 20 77 69 74 68 20 64 61 74 61 | cts.enables.us.to.deal.with.data |
| 36540 | 20 61 74 20 61 20 68 69 67 68 65 72 20 63 6f 6e 63 65 70 74 75 61 6c 20 6c 65 76 65 6c 20 74 68 | .at.a.higher.conceptual.level.th |
| 36560 | 61 6e 0a 74 68 61 74 20 6f 66 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 64 61 74 61 20 6f 62 | an.that.of.the.primitive.data.ob |
| 36580 | 6a 65 63 74 73 20 6f 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 2e 0a 0a 20 20 20 43 6f 6e 73 69 | jects.of.the.language......Consi |
| 365a0 | 64 65 72 20 74 68 65 20 74 61 73 6b 20 6f 66 20 64 65 73 69 67 6e 69 6e 67 20 61 20 73 79 73 74 | der.the.task.of.designing.a.syst |
| 365c0 | 65 6d 20 74 6f 20 70 65 72 66 6f 72 6d 20 61 72 69 74 68 6d 65 74 69 63 20 77 69 74 68 0a 72 61 | em.to.perform.arithmetic.with.ra |
| 365e0 | 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2e 20 20 57 65 20 63 6f 75 6c 64 20 69 6d 61 67 69 6e | tional.numbers...We.could.imagin |
| 36600 | 65 20 61 6e 20 6f 70 65 72 61 74 69 6f 6e 20 60 61 64 64 2d 72 61 74 27 20 74 68 61 74 20 74 61 | e.an.operation.`add-rat'.that.ta |
| 36620 | 6b 65 73 0a 74 77 6f 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 61 6e 64 20 70 72 6f | kes.two.rational.numbers.and.pro |
| 36640 | 64 75 63 65 73 20 74 68 65 69 72 20 73 75 6d 2e 20 20 49 6e 20 74 65 72 6d 73 20 6f 66 20 73 69 | duces.their.sum...In.terms.of.si |
| 36660 | 6d 70 6c 65 20 64 61 74 61 2c 0a 61 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 63 61 6e | mple.data,.a.rational.number.can |
| 36680 | 20 62 65 20 74 68 6f 75 67 68 74 20 6f 66 20 61 73 20 74 77 6f 20 69 6e 74 65 67 65 72 73 3a 20 | .be.thought.of.as.two.integers:. |
| 366a0 | 61 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 61 0a 64 65 6e 6f 6d 69 6e 61 74 6f 72 2e 20 20 | a.numerator.and.a.denominator... |
| 366c0 | 54 68 75 73 2c 20 77 65 20 63 6f 75 6c 64 20 64 65 73 69 67 6e 20 61 20 70 72 6f 67 72 61 6d 20 | Thus,.we.could.design.a.program. |
| 366e0 | 69 6e 20 77 68 69 63 68 20 65 61 63 68 20 72 61 74 69 6f 6e 61 6c 0a 6e 75 6d 62 65 72 20 77 6f | in.which.each.rational.number.wo |
| 36700 | 75 6c 64 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 74 77 6f 20 69 6e 74 65 67 65 | uld.be.represented.by.two.intege |
| 36720 | 72 73 20 28 61 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 61 0a 64 65 6e 6f 6d 69 6e 61 74 6f | rs.(a.numerator.and.a.denominato |
| 36740 | 72 29 20 61 6e 64 20 77 68 65 72 65 20 60 61 64 64 2d 72 61 74 27 20 77 6f 75 6c 64 20 62 65 20 | r).and.where.`add-rat'.would.be. |
| 36760 | 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 79 20 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 0a 28 6f | implemented.by.two.procedures.(o |
| 36780 | 6e 65 20 70 72 6f 64 75 63 69 6e 67 20 74 68 65 20 6e 75 6d 65 72 61 74 6f 72 20 6f 66 20 74 68 | ne.producing.the.numerator.of.th |
| 367a0 | 65 20 73 75 6d 20 61 6e 64 20 6f 6e 65 20 70 72 6f 64 75 63 69 6e 67 20 74 68 65 0a 64 65 6e 6f | e.sum.and.one.producing.the.deno |
| 367c0 | 6d 69 6e 61 74 6f 72 29 2e 20 20 42 75 74 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 61 77 6b | minator)...But.this.would.be.awk |
| 367e0 | 77 61 72 64 2c 20 62 65 63 61 75 73 65 20 77 65 20 77 6f 75 6c 64 20 74 68 65 6e 20 6e 65 65 64 | ward,.because.we.would.then.need |
| 36800 | 20 74 6f 0a 65 78 70 6c 69 63 69 74 6c 79 20 6b 65 65 70 20 74 72 61 63 6b 20 6f 66 20 77 68 69 | .to.explicitly.keep.track.of.whi |
| 36820 | 63 68 20 6e 75 6d 65 72 61 74 6f 72 73 20 63 6f 72 72 65 73 70 6f 6e 64 65 64 20 74 6f 20 77 68 | ch.numerators.corresponded.to.wh |
| 36840 | 69 63 68 0a 64 65 6e 6f 6d 69 6e 61 74 6f 72 73 2e 20 20 49 6e 20 61 20 73 79 73 74 65 6d 20 69 | ich.denominators...In.a.system.i |
| 36860 | 6e 74 65 6e 64 65 64 20 74 6f 20 70 65 72 66 6f 72 6d 20 6d 61 6e 79 20 6f 70 65 72 61 74 69 6f | ntended.to.perform.many.operatio |
| 36880 | 6e 73 20 6f 6e 20 6d 61 6e 79 0a 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2c 20 73 75 63 | ns.on.many.rational.numbers,.suc |
| 368a0 | 68 20 62 6f 6f 6b 6b 65 65 70 69 6e 67 20 64 65 74 61 69 6c 73 20 77 6f 75 6c 64 20 63 6c 75 74 | h.bookkeeping.details.would.clut |
| 368c0 | 74 65 72 20 74 68 65 20 70 72 6f 67 72 61 6d 73 0a 73 75 62 73 74 61 6e 74 69 61 6c 6c 79 2c 20 | ter.the.programs.substantially,. |
| 368e0 | 74 6f 20 73 61 79 20 6e 6f 74 68 69 6e 67 20 6f 66 20 77 68 61 74 20 74 68 65 79 20 77 6f 75 6c | to.say.nothing.of.what.they.woul |
| 36900 | 64 20 64 6f 20 74 6f 20 6f 75 72 20 6d 69 6e 64 73 2e 20 20 49 74 0a 77 6f 75 6c 64 20 62 65 20 | d.do.to.our.minds...It.would.be. |
| 36920 | 6d 75 63 68 20 62 65 74 74 65 72 20 69 66 20 77 65 20 63 6f 75 6c 64 20 22 67 6c 75 65 20 74 6f | much.better.if.we.could."glue.to |
| 36940 | 67 65 74 68 65 72 22 20 61 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 0a 64 65 6e 6f 6d 69 6e 61 | gether".a.numerator.and.denomina |
| 36960 | 74 6f 72 20 74 6f 20 66 6f 72 6d 20 61 20 70 61 69 72 2d 2d 61 20 22 63 6f 6d 70 6f 75 6e 64 20 | tor.to.form.a.pair--a."compound. |
| 36980 | 64 61 74 61 20 6f 62 6a 65 63 74 22 2d 2d 74 68 61 74 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 0a | data.object"--that.our.programs. |
| 369a0 | 63 6f 75 6c 64 20 6d 61 6e 69 70 75 6c 61 74 65 20 69 6e 20 61 20 77 61 79 20 74 68 61 74 20 77 | could.manipulate.in.a.way.that.w |
| 369c0 | 6f 75 6c 64 20 62 65 20 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 72 65 67 61 72 64 69 6e | ould.be.consistent.with.regardin |
| 369e0 | 67 20 61 0a 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 61 73 20 61 20 73 69 6e 67 6c 65 20 | g.a.rational.number.as.a.single. |
| 36a00 | 63 6f 6e 63 65 70 74 75 61 6c 20 75 6e 69 74 2e 0a 0a 20 20 20 54 68 65 20 75 73 65 20 6f 66 20 | conceptual.unit......The.use.of. |
| 36a20 | 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 61 6c 73 6f 20 65 6e 61 62 6c 65 73 20 75 73 20 74 6f | compound.data.also.enables.us.to |
| 36a40 | 20 69 6e 63 72 65 61 73 65 20 74 68 65 20 6d 6f 64 75 6c 61 72 69 74 79 0a 6f 66 20 6f 75 72 20 | .increase.the.modularity.of.our. |
| 36a60 | 70 72 6f 67 72 61 6d 73 2e 20 20 49 66 20 77 65 20 63 61 6e 20 6d 61 6e 69 70 75 6c 61 74 65 20 | programs...If.we.can.manipulate. |
| 36a80 | 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 64 69 72 65 63 74 6c 79 20 61 73 0a 6f 62 6a | rational.numbers.directly.as.obj |
| 36aa0 | 65 63 74 73 20 69 6e 20 74 68 65 69 72 20 6f 77 6e 20 72 69 67 68 74 2c 20 74 68 65 6e 20 77 65 | ects.in.their.own.right,.then.we |
| 36ac0 | 20 63 61 6e 20 73 65 70 61 72 61 74 65 20 74 68 65 20 70 61 72 74 20 6f 66 20 6f 75 72 0a 70 72 | .can.separate.the.part.of.our.pr |
| 36ae0 | 6f 67 72 61 6d 20 74 68 61 74 20 64 65 61 6c 73 20 77 69 74 68 20 72 61 74 69 6f 6e 61 6c 20 6e | ogram.that.deals.with.rational.n |
| 36b00 | 75 6d 62 65 72 73 20 70 65 72 20 73 65 20 66 72 6f 6d 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f | umbers.per.se.from.the.details.o |
| 36b20 | 66 20 68 6f 77 0a 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 6d 61 79 20 62 65 20 72 65 | f.how.rational.numbers.may.be.re |
| 36b40 | 70 72 65 73 65 6e 74 65 64 20 61 73 20 70 61 69 72 73 20 6f 66 20 69 6e 74 65 67 65 72 73 2e 20 | presented.as.pairs.of.integers.. |
| 36b60 | 20 54 68 65 20 67 65 6e 65 72 61 6c 0a 74 65 63 68 6e 69 71 75 65 20 6f 66 20 69 73 6f 6c 61 74 | .The.general.technique.of.isolat |
| 36b80 | 69 6e 67 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 61 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 | ing.the.parts.of.a.program.that. |
| 36ba0 | 64 65 61 6c 20 77 69 74 68 20 68 6f 77 20 64 61 74 61 0a 6f 62 6a 65 63 74 73 20 61 72 65 20 72 | deal.with.how.data.objects.are.r |
| 36bc0 | 65 70 72 65 73 65 6e 74 65 64 20 66 72 6f 6d 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 61 20 70 | epresented.from.the.parts.of.a.p |
| 36be0 | 72 6f 67 72 61 6d 20 74 68 61 74 20 64 65 61 6c 20 77 69 74 68 20 68 6f 77 0a 64 61 74 61 20 6f | rogram.that.deal.with.how.data.o |
| 36c00 | 62 6a 65 63 74 73 20 61 72 65 20 75 73 65 64 20 69 73 20 61 20 70 6f 77 65 72 66 75 6c 20 64 65 | bjects.are.used.is.a.powerful.de |
| 36c20 | 73 69 67 6e 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 20 63 61 6c 6c 65 64 20 22 64 61 74 61 0a 61 62 | sign.methodology.called."data.ab |
| 36c40 | 73 74 72 61 63 74 69 6f 6e 22 2e 20 20 57 65 20 77 69 6c 6c 20 73 65 65 20 68 6f 77 20 64 61 74 | straction"...We.will.see.how.dat |
| 36c60 | 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 6d 61 6b 65 73 20 70 72 6f 67 72 61 6d 73 20 6d 75 63 | a.abstraction.makes.programs.muc |
| 36c80 | 68 0a 65 61 73 69 65 72 20 74 6f 20 64 65 73 69 67 6e 2c 20 6d 61 69 6e 74 61 69 6e 2c 20 61 6e | h.easier.to.design,.maintain,.an |
| 36ca0 | 64 20 6d 6f 64 69 66 79 2e 0a 0a 20 20 20 54 68 65 20 75 73 65 20 6f 66 20 63 6f 6d 70 6f 75 6e | d.modify......The.use.of.compoun |
| 36cc0 | 64 20 64 61 74 61 20 6c 65 61 64 73 20 74 6f 20 61 20 72 65 61 6c 20 69 6e 63 72 65 61 73 65 20 | d.data.leads.to.a.real.increase. |
| 36ce0 | 69 6e 20 74 68 65 20 65 78 70 72 65 73 73 69 76 65 0a 70 6f 77 65 72 20 6f 66 20 6f 75 72 20 70 | in.the.expressive.power.of.our.p |
| 36d00 | 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 20 20 43 6f 6e 73 69 64 65 72 20 74 | rogramming.language...Consider.t |
| 36d20 | 68 65 20 69 64 65 61 20 6f 66 20 66 6f 72 6d 69 6e 67 20 61 0a 22 6c 69 6e 65 61 72 20 63 6f 6d | he.idea.of.forming.a."linear.com |
| 36d40 | 62 69 6e 61 74 69 6f 6e 22 20 61 78 20 2b 20 62 79 2e 20 20 57 65 20 6d 69 67 68 74 20 6c 69 6b | bination".ax.+.by...We.might.lik |
| 36d60 | 65 20 74 6f 20 77 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 77 6f 75 6c | e.to.write.a.procedure.that.woul |
| 36d80 | 64 20 61 63 63 65 70 74 20 61 2c 20 62 2c 20 78 2c 20 61 6e 64 20 79 20 61 73 20 61 72 67 75 6d | d.accept.a,.b,.x,.and.y.as.argum |
| 36da0 | 65 6e 74 73 20 61 6e 64 20 72 65 74 75 72 6e 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 61 78 20 | ents.and.return.the.value.of.ax. |
| 36dc0 | 2b 0a 62 79 2e 20 20 54 68 69 73 20 70 72 65 73 65 6e 74 73 20 6e 6f 20 64 69 66 66 69 63 75 6c | +.by...This.presents.no.difficul |
| 36de0 | 74 79 20 69 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 74 6f 20 62 65 20 6e 75 | ty.if.the.arguments.are.to.be.nu |
| 36e00 | 6d 62 65 72 73 2c 0a 62 65 63 61 75 73 65 20 77 65 20 63 61 6e 20 72 65 61 64 69 6c 79 20 64 65 | mbers,.because.we.can.readily.de |
| 36e20 | 66 69 6e 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | fine.the.procedure.......(define |
| 36e40 | 20 28 6c 69 6e 65 61 72 2d 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 61 20 62 20 78 20 79 29 0a 20 20 | .(linear-combination.a.b.x.y)... |
| 36e60 | 20 20 20 20 20 28 2b 20 28 2a 20 61 20 78 29 20 28 2a 20 62 20 79 29 29 29 0a 0a 20 20 20 42 75 | .....(+.(*.a.x).(*.b.y))).....Bu |
| 36e80 | 74 20 73 75 70 70 6f 73 65 20 77 65 20 61 72 65 20 6e 6f 74 20 63 6f 6e 63 65 72 6e 65 64 20 6f | t.suppose.we.are.not.concerned.o |
| 36ea0 | 6e 6c 79 20 77 69 74 68 20 6e 75 6d 62 65 72 73 2e 20 20 53 75 70 70 6f 73 65 20 77 65 0a 77 6f | nly.with.numbers...Suppose.we.wo |
| 36ec0 | 75 6c 64 20 6c 69 6b 65 20 74 6f 20 65 78 70 72 65 73 73 2c 20 69 6e 20 70 72 6f 63 65 64 75 72 | uld.like.to.express,.in.procedur |
| 36ee0 | 61 6c 20 74 65 72 6d 73 2c 20 74 68 65 20 69 64 65 61 20 74 68 61 74 20 6f 6e 65 20 63 61 6e 20 | al.terms,.the.idea.that.one.can. |
| 36f00 | 66 6f 72 6d 0a 6c 69 6e 65 61 72 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 77 68 65 6e 65 76 65 | form.linear.combinations.wheneve |
| 36f20 | 72 20 61 64 64 69 74 69 6f 6e 20 61 6e 64 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 20 61 72 | r.addition.and.multiplication.ar |
| 36f40 | 65 0a 64 65 66 69 6e 65 64 2d 2d 66 6f 72 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2c | e.defined--for.rational.numbers, |
| 36f60 | 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2c 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2c 20 6f | .complex.numbers,.polynomials,.o |
| 36f80 | 72 0a 77 68 61 74 65 76 65 72 2e 20 20 57 65 20 63 6f 75 6c 64 20 65 78 70 72 65 73 73 20 74 68 | r.whatever...We.could.express.th |
| 36fa0 | 69 73 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 74 68 65 20 66 6f 72 6d 0a 0a 20 | is.as.a.procedure.of.the.form... |
| 36fc0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 69 6e 65 61 72 2d 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 | ....(define.(linear-combination. |
| 36fe0 | 61 20 62 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 61 64 64 20 28 6d 75 6c 20 61 20 78 29 20 28 | a.b.x.y)........(add.(mul.a.x).( |
| 37000 | 6d 75 6c 20 62 20 79 29 29 29 0a 0a 77 68 65 72 65 20 60 61 64 64 27 20 61 6e 64 20 60 6d 75 6c | mul.b.y)))..where.`add'.and.`mul |
| 37020 | 27 20 61 72 65 20 6e 6f 74 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 | '.are.not.the.primitive.procedur |
| 37040 | 65 73 20 60 2b 27 20 61 6e 64 20 60 2a 27 20 62 75 74 0a 72 61 74 68 65 72 20 6d 6f 72 65 20 63 | es.`+'.and.`*'.but.rather.more.c |
| 37060 | 6f 6d 70 6c 65 78 20 74 68 69 6e 67 73 20 74 68 61 74 20 77 69 6c 6c 20 70 65 72 66 6f 72 6d 20 | omplex.things.that.will.perform. |
| 37080 | 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 6f 70 65 72 61 74 69 6f 6e 73 0a 66 6f 72 20 77 | the.appropriate.operations.for.w |
| 370a0 | 68 61 74 65 76 65 72 20 6b 69 6e 64 73 20 6f 66 20 64 61 74 61 20 77 65 20 70 61 73 73 20 69 6e | hatever.kinds.of.data.we.pass.in |
| 370c0 | 20 61 73 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 60 61 27 2c 20 60 62 27 2c 20 60 78 27 2c | .as.the.arguments.`a',.`b',.`x', |
| 370e0 | 0a 61 6e 64 20 60 79 27 2e 20 54 68 65 20 6b 65 79 20 70 6f 69 6e 74 20 69 73 20 74 68 61 74 20 | .and.`y'..The.key.point.is.that. |
| 37100 | 74 68 65 20 6f 6e 6c 79 20 74 68 69 6e 67 20 60 6c 69 6e 65 61 72 2d 63 6f 6d 62 69 6e 61 74 69 | the.only.thing.`linear-combinati |
| 37120 | 6f 6e 27 0a 73 68 6f 75 6c 64 20 6e 65 65 64 20 74 6f 20 6b 6e 6f 77 20 61 62 6f 75 74 20 60 61 | on'.should.need.to.know.about.`a |
| 37140 | 27 2c 20 60 62 27 2c 20 60 78 27 2c 20 61 6e 64 20 60 79 27 20 69 73 20 74 68 61 74 20 74 68 65 | ',.`b',.`x',.and.`y'.is.that.the |
| 37160 | 20 70 72 6f 63 65 64 75 72 65 73 0a 60 61 64 64 27 20 61 6e 64 20 60 6d 75 6c 27 20 77 69 6c 6c | .procedures.`add'.and.`mul'.will |
| 37180 | 20 70 65 72 66 6f 72 6d 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 6d 61 6e 69 70 75 6c | .perform.the.appropriate.manipul |
| 371a0 | 61 74 69 6f 6e 73 2e 20 20 46 72 6f 6d 20 74 68 65 0a 70 65 72 73 70 65 63 74 69 76 65 20 6f 66 | ations...From.the.perspective.of |
| 371c0 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 6c 69 6e 65 61 72 2d 63 6f 6d 62 69 6e 61 74 69 | .the.procedure.`linear-combinati |
| 371e0 | 6f 6e 27 2c 20 69 74 20 69 73 20 69 72 72 65 6c 65 76 61 6e 74 0a 77 68 61 74 20 60 61 27 2c 20 | on',.it.is.irrelevant.what.`a',. |
| 37200 | 60 62 27 2c 20 60 78 27 2c 20 61 6e 64 20 60 79 27 20 61 72 65 20 61 6e 64 20 65 76 65 6e 20 6d | `b',.`x',.and.`y'.are.and.even.m |
| 37220 | 6f 72 65 20 69 72 72 65 6c 65 76 61 6e 74 20 68 6f 77 20 74 68 65 79 20 6d 69 67 68 74 0a 68 61 | ore.irrelevant.how.they.might.ha |
| 37240 | 70 70 65 6e 20 74 6f 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 74 65 72 6d 73 20 | ppen.to.be.represented.in.terms. |
| 37260 | 6f 66 20 6d 6f 72 65 20 70 72 69 6d 69 74 69 76 65 20 64 61 74 61 2e 20 20 54 68 69 73 20 73 61 | of.more.primitive.data...This.sa |
| 37280 | 6d 65 0a 65 78 61 6d 70 6c 65 20 73 68 6f 77 73 20 77 68 79 20 69 74 20 69 73 20 69 6d 70 6f 72 | me.example.shows.why.it.is.impor |
| 372a0 | 74 61 6e 74 20 74 68 61 74 20 6f 75 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 | tant.that.our.programming.langua |
| 372c0 | 67 65 20 70 72 6f 76 69 64 65 0a 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 6d 61 6e 69 70 75 | ge.provide.the.ability.to.manipu |
| 372e0 | 6c 61 74 65 20 63 6f 6d 70 6f 75 6e 64 20 6f 62 6a 65 63 74 73 20 64 69 72 65 63 74 6c 79 3a 20 | late.compound.objects.directly:. |
| 37300 | 57 69 74 68 6f 75 74 20 74 68 69 73 2c 0a 74 68 65 72 65 20 69 73 20 6e 6f 20 77 61 79 20 66 6f | Without.this,.there.is.no.way.fo |
| 37320 | 72 20 61 20 70 72 6f 63 65 64 75 72 65 20 73 75 63 68 20 61 73 20 60 6c 69 6e 65 61 72 2d 63 6f | r.a.procedure.such.as.`linear-co |
| 37340 | 6d 62 69 6e 61 74 69 6f 6e 27 20 74 6f 20 70 61 73 73 0a 69 74 73 20 61 72 67 75 6d 65 6e 74 73 | mbination'.to.pass.its.arguments |
| 37360 | 20 61 6c 6f 6e 67 20 74 6f 20 60 61 64 64 27 20 61 6e 64 20 60 6d 75 6c 27 20 77 69 74 68 6f 75 | .along.to.`add'.and.`mul'.withou |
| 37380 | 74 20 68 61 76 69 6e 67 20 74 6f 20 6b 6e 6f 77 20 74 68 65 69 72 0a 64 65 74 61 69 6c 65 64 20 | t.having.to.know.their.detailed. |
| 373a0 | 73 74 72 75 63 74 75 72 65 2e 28 31 29 0a 0a 20 20 20 57 65 20 62 65 67 69 6e 20 74 68 69 73 20 | structure.(1).....We.begin.this. |
| 373c0 | 63 68 61 70 74 65 72 20 62 79 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 72 61 74 69 | chapter.by.implementing.the.rati |
| 373e0 | 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 61 72 69 74 68 6d 65 74 69 63 0a 73 79 73 74 65 6d 20 6d 65 | onal-number.arithmetic.system.me |
| 37400 | 6e 74 69 6f 6e 65 64 20 61 62 6f 76 65 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 66 6f 72 6d 20 74 | ntioned.above...This.will.form.t |
| 37420 | 68 65 20 62 61 63 6b 67 72 6f 75 6e 64 20 66 6f 72 20 6f 75 72 0a 64 69 73 63 75 73 73 69 6f 6e | he.background.for.our.discussion |
| 37440 | 20 6f 66 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 61 6e 64 20 64 61 74 61 20 61 62 73 74 72 | .of.compound.data.and.data.abstr |
| 37460 | 61 63 74 69 6f 6e 2e 20 20 41 73 20 77 69 74 68 20 63 6f 6d 70 6f 75 6e 64 0a 70 72 6f 63 65 64 | action...As.with.compound.proced |
| 37480 | 75 72 65 73 2c 20 74 68 65 20 6d 61 69 6e 20 69 73 73 75 65 20 74 6f 20 62 65 20 61 64 64 72 65 | ures,.the.main.issue.to.be.addre |
| 374a0 | 73 73 65 64 20 69 73 20 74 68 61 74 20 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 20 61 73 20 61 | ssed.is.that.of.abstraction.as.a |
| 374c0 | 0a 74 65 63 68 6e 69 71 75 65 20 66 6f 72 20 63 6f 70 69 6e 67 20 77 69 74 68 20 63 6f 6d 70 6c | .technique.for.coping.with.compl |
| 374e0 | 65 78 69 74 79 2c 20 61 6e 64 20 77 65 20 77 69 6c 6c 20 73 65 65 20 68 6f 77 20 64 61 74 61 0a | exity,.and.we.will.see.how.data. |
| 37500 | 61 62 73 74 72 61 63 74 69 6f 6e 20 65 6e 61 62 6c 65 73 20 75 73 20 74 6f 20 65 72 65 63 74 20 | abstraction.enables.us.to.erect. |
| 37520 | 73 75 69 74 61 62 6c 65 20 22 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 72 72 69 65 72 73 22 20 | suitable."abstraction.barriers". |
| 37540 | 62 65 74 77 65 65 6e 0a 64 69 66 66 65 72 65 6e 74 20 70 61 72 74 73 20 6f 66 20 61 20 70 72 6f | between.different.parts.of.a.pro |
| 37560 | 67 72 61 6d 2e 0a 0a 20 20 20 57 65 20 77 69 6c 6c 20 73 65 65 20 74 68 61 74 20 74 68 65 20 6b | gram......We.will.see.that.the.k |
| 37580 | 65 79 20 74 6f 20 66 6f 72 6d 69 6e 67 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 69 73 20 74 | ey.to.forming.compound.data.is.t |
| 375a0 | 68 61 74 20 61 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 73 68 6f 75 6c | hat.a.programming.language.shoul |
| 375c0 | 64 20 70 72 6f 76 69 64 65 20 73 6f 6d 65 20 6b 69 6e 64 20 6f 66 20 22 67 6c 75 65 22 20 73 6f | d.provide.some.kind.of."glue".so |
| 375e0 | 20 74 68 61 74 20 64 61 74 61 0a 6f 62 6a 65 63 74 73 20 63 61 6e 20 62 65 20 63 6f 6d 62 69 6e | .that.data.objects.can.be.combin |
| 37600 | 65 64 20 74 6f 20 66 6f 72 6d 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 20 64 61 74 61 20 6f 62 6a | ed.to.form.more.complex.data.obj |
| 37620 | 65 63 74 73 2e 20 20 54 68 65 72 65 20 61 72 65 0a 6d 61 6e 79 20 70 6f 73 73 69 62 6c 65 20 6b | ects...There.are.many.possible.k |
| 37640 | 69 6e 64 73 20 6f 66 20 67 6c 75 65 2e 20 20 49 6e 64 65 65 64 2c 20 77 65 20 77 69 6c 6c 20 64 | inds.of.glue...Indeed,.we.will.d |
| 37660 | 69 73 63 6f 76 65 72 20 68 6f 77 20 74 6f 20 66 6f 72 6d 0a 63 6f 6d 70 6f 75 6e 64 20 64 61 74 | iscover.how.to.form.compound.dat |
| 37680 | 61 20 75 73 69 6e 67 20 6e 6f 20 73 70 65 63 69 61 6c 20 22 64 61 74 61 22 20 6f 70 65 72 61 74 | a.using.no.special."data".operat |
| 376a0 | 69 6f 6e 73 20 61 74 20 61 6c 6c 2c 20 6f 6e 6c 79 0a 70 72 6f 63 65 64 75 72 65 73 2e 20 20 54 | ions.at.all,.only.procedures...T |
| 376c0 | 68 69 73 20 77 69 6c 6c 20 66 75 72 74 68 65 72 20 62 6c 75 72 20 74 68 65 20 64 69 73 74 69 6e | his.will.further.blur.the.distin |
| 376e0 | 63 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 22 70 72 6f 63 65 64 75 72 65 22 0a 61 6e 64 20 22 64 | ction.between."procedure".and."d |
| 37700 | 61 74 61 2c 22 20 77 68 69 63 68 20 77 61 73 20 61 6c 72 65 61 64 79 20 62 65 63 6f 6d 69 6e 67 | ata,".which.was.already.becoming |
| 37720 | 20 74 65 6e 75 6f 75 73 20 74 6f 77 61 72 64 20 74 68 65 20 65 6e 64 20 6f 66 20 2a 4e 6f 74 65 | .tenuous.toward.the.end.of.*Note |
| 37740 | 0a 43 68 61 70 74 65 72 20 31 3a 3a 2e 20 20 57 65 20 77 69 6c 6c 20 61 6c 73 6f 20 65 78 70 6c | .Chapter.1::...We.will.also.expl |
| 37760 | 6f 72 65 20 73 6f 6d 65 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 74 65 63 68 6e 69 71 75 65 73 | ore.some.conventional.techniques |
| 37780 | 20 66 6f 72 0a 72 65 70 72 65 73 65 6e 74 69 6e 67 20 73 65 71 75 65 6e 63 65 73 20 61 6e 64 20 | .for.representing.sequences.and. |
| 377a0 | 74 72 65 65 73 2e 20 20 4f 6e 65 20 6b 65 79 20 69 64 65 61 20 69 6e 20 64 65 61 6c 69 6e 67 20 | trees...One.key.idea.in.dealing. |
| 377c0 | 77 69 74 68 0a 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 69 73 20 74 68 65 20 6e 6f 74 69 6f 6e | with.compound.data.is.the.notion |
| 377e0 | 20 6f 66 20 22 63 6c 6f 73 75 72 65 22 2d 2d 74 68 61 74 20 74 68 65 20 67 6c 75 65 20 77 65 20 | .of."closure"--that.the.glue.we. |
| 37800 | 75 73 65 20 66 6f 72 0a 63 6f 6d 62 69 6e 69 6e 67 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 73 | use.for.combining.data.objects.s |
| 37820 | 68 6f 75 6c 64 20 61 6c 6c 6f 77 20 75 73 20 74 6f 20 63 6f 6d 62 69 6e 65 20 6e 6f 74 20 6f 6e | hould.allow.us.to.combine.not.on |
| 37840 | 6c 79 20 70 72 69 6d 69 74 69 76 65 0a 64 61 74 61 20 6f 62 6a 65 63 74 73 2c 20 62 75 74 20 63 | ly.primitive.data.objects,.but.c |
| 37860 | 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 61 73 20 77 65 6c 6c 2e 20 20 41 | ompound.data.objects.as.well...A |
| 37880 | 6e 6f 74 68 65 72 20 6b 65 79 20 69 64 65 61 20 69 73 0a 74 68 61 74 20 63 6f 6d 70 6f 75 6e 64 | nother.key.idea.is.that.compound |
| 378a0 | 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 63 61 6e 20 73 65 72 76 65 20 61 73 20 22 63 6f 6e 76 | .data.objects.can.serve.as."conv |
| 378c0 | 65 6e 74 69 6f 6e 61 6c 20 69 6e 74 65 72 66 61 63 65 73 22 20 66 6f 72 0a 63 6f 6d 62 69 6e 69 | entional.interfaces".for.combini |
| 378e0 | 6e 67 20 70 72 6f 67 72 61 6d 20 6d 6f 64 75 6c 65 73 20 69 6e 20 6d 69 78 2d 61 6e 64 2d 6d 61 | ng.program.modules.in.mix-and-ma |
| 37900 | 74 63 68 20 77 61 79 73 2e 20 20 57 65 20 69 6c 6c 75 73 74 72 61 74 65 20 73 6f 6d 65 20 6f 66 | tch.ways...We.illustrate.some.of |
| 37920 | 0a 74 68 65 73 65 20 69 64 65 61 73 20 62 79 20 70 72 65 73 65 6e 74 69 6e 67 20 61 20 73 69 6d | .these.ideas.by.presenting.a.sim |
| 37940 | 70 6c 65 20 67 72 61 70 68 69 63 73 20 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 65 78 70 6c 6f | ple.graphics.language.that.explo |
| 37960 | 69 74 73 0a 63 6c 6f 73 75 72 65 2e 0a 0a 20 20 20 57 65 20 77 69 6c 6c 20 74 68 65 6e 20 61 75 | its.closure......We.will.then.au |
| 37980 | 67 6d 65 6e 74 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 61 6c 20 70 6f 77 65 72 | gment.the.representational.power |
| 379a0 | 20 6f 66 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 62 79 0a 69 6e 74 72 6f 64 75 63 69 6e 67 20 | .of.our.language.by.introducing. |
| 379c0 | 22 73 79 6d 62 6f 6c 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 22 2d 2d 64 61 74 61 20 77 68 6f | "symbolic.expressions"--data.who |
| 379e0 | 73 65 20 65 6c 65 6d 65 6e 74 61 72 79 20 70 61 72 74 73 20 63 61 6e 20 62 65 0a 61 72 62 69 74 | se.elementary.parts.can.be.arbit |
| 37a00 | 72 61 72 79 20 73 79 6d 62 6f 6c 73 20 72 61 74 68 65 72 20 74 68 61 6e 20 6f 6e 6c 79 20 6e 75 | rary.symbols.rather.than.only.nu |
| 37a20 | 6d 62 65 72 73 2e 20 20 57 65 20 65 78 70 6c 6f 72 65 20 76 61 72 69 6f 75 73 0a 61 6c 74 65 72 | mbers...We.explore.various.alter |
| 37a40 | 6e 61 74 69 76 65 73 20 66 6f 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 73 65 74 73 20 6f 66 | natives.for.representing.sets.of |
| 37a60 | 20 6f 62 6a 65 63 74 73 2e 20 20 57 65 20 77 69 6c 6c 20 66 69 6e 64 20 74 68 61 74 2c 20 6a 75 | .objects...We.will.find.that,.ju |
| 37a80 | 73 74 0a 61 73 20 61 20 67 69 76 65 6e 20 6e 75 6d 65 72 69 63 61 6c 20 66 75 6e 63 74 69 6f 6e | st.as.a.given.numerical.function |
| 37aa0 | 20 63 61 6e 20 62 65 20 63 6f 6d 70 75 74 65 64 20 62 79 20 6d 61 6e 79 20 64 69 66 66 65 72 65 | .can.be.computed.by.many.differe |
| 37ac0 | 6e 74 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 70 72 6f 63 65 73 73 65 73 2c 20 74 68 65 72 | nt.computational.processes,.ther |
| 37ae0 | 65 20 61 72 65 20 6d 61 6e 79 20 77 61 79 73 20 69 6e 20 77 68 69 63 68 20 61 20 67 69 76 65 6e | e.are.many.ways.in.which.a.given |
| 37b00 | 20 64 61 74 61 0a 73 74 72 75 63 74 75 72 65 20 63 61 6e 20 62 65 20 72 65 70 72 65 73 65 6e 74 | .data.structure.can.be.represent |
| 37b20 | 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 73 69 6d 70 6c 65 72 20 6f 62 6a 65 63 74 73 2c 20 | ed.in.terms.of.simpler.objects,. |
| 37b40 | 61 6e 64 20 74 68 65 0a 63 68 6f 69 63 65 20 6f 66 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e | and.the.choice.of.representation |
| 37b60 | 20 63 61 6e 20 68 61 76 65 20 73 69 67 6e 69 66 69 63 61 6e 74 20 69 6d 70 61 63 74 20 6f 6e 20 | .can.have.significant.impact.on. |
| 37b80 | 74 68 65 20 74 69 6d 65 20 61 6e 64 0a 73 70 61 63 65 20 72 65 71 75 69 72 65 6d 65 6e 74 73 20 | the.time.and.space.requirements. |
| 37ba0 | 6f 66 20 70 72 6f 63 65 73 73 65 73 20 74 68 61 74 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 68 65 | of.processes.that.manipulate.the |
| 37bc0 | 20 64 61 74 61 2e 20 20 57 65 20 77 69 6c 6c 0a 69 6e 76 65 73 74 69 67 61 74 65 20 74 68 65 73 | .data...We.will.investigate.thes |
| 37be0 | 65 20 69 64 65 61 73 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 73 79 6d 62 6f 6c | e.ideas.in.the.context.of.symbol |
| 37c00 | 69 63 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 2c 20 74 68 65 0a 72 65 70 72 65 73 65 6e | ic.differentiation,.the.represen |
| 37c20 | 74 61 74 69 6f 6e 20 6f 66 20 73 65 74 73 2c 20 61 6e 64 20 74 68 65 20 65 6e 63 6f 64 69 6e 67 | tation.of.sets,.and.the.encoding |
| 37c40 | 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 20 20 20 4e 65 78 74 20 77 65 20 77 69 6c | .of.information......Next.we.wil |
| 37c60 | 6c 20 74 61 6b 65 20 75 70 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 77 6f 72 6b 69 6e 67 | l.take.up.the.problem.of.working |
| 37c80 | 20 77 69 74 68 20 64 61 74 61 20 74 68 61 74 20 6d 61 79 20 62 65 0a 72 65 70 72 65 73 65 6e 74 | .with.data.that.may.be.represent |
| 37ca0 | 65 64 20 64 69 66 66 65 72 65 6e 74 6c 79 20 62 79 20 64 69 66 66 65 72 65 6e 74 20 70 61 72 74 | ed.differently.by.different.part |
| 37cc0 | 73 20 6f 66 20 61 20 70 72 6f 67 72 61 6d 2e 20 20 54 68 69 73 20 6c 65 61 64 73 20 74 6f 0a 74 | s.of.a.program...This.leads.to.t |
| 37ce0 | 68 65 20 6e 65 65 64 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 22 67 65 6e 65 72 69 63 20 6f 70 | he.need.to.implement."generic.op |
| 37d00 | 65 72 61 74 69 6f 6e 73 22 2c 20 77 68 69 63 68 20 6d 75 73 74 20 68 61 6e 64 6c 65 20 6d 61 6e | erations",.which.must.handle.man |
| 37d20 | 79 0a 64 69 66 66 65 72 65 6e 74 20 74 79 70 65 73 20 6f 66 20 64 61 74 61 2e 20 20 4d 61 69 6e | y.different.types.of.data...Main |
| 37d40 | 74 61 69 6e 69 6e 67 20 6d 6f 64 75 6c 61 72 69 74 79 20 69 6e 20 74 68 65 20 70 72 65 73 65 6e | taining.modularity.in.the.presen |
| 37d60 | 63 65 20 6f 66 0a 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 72 65 71 75 69 72 65 | ce.of.generic.operations.require |
| 37d80 | 73 20 6d 6f 72 65 20 70 6f 77 65 72 66 75 6c 20 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 72 72 | s.more.powerful.abstraction.barr |
| 37da0 | 69 65 72 73 20 74 68 61 6e 20 63 61 6e 0a 62 65 20 65 72 65 63 74 65 64 20 77 69 74 68 20 73 69 | iers.than.can.be.erected.with.si |
| 37dc0 | 6d 70 6c 65 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 61 6c 6f 6e 65 2e 20 20 49 6e | mple.data.abstraction.alone...In |
| 37de0 | 20 70 61 72 74 69 63 75 6c 61 72 2c 20 77 65 0a 69 6e 74 72 6f 64 75 63 65 20 70 72 6f 67 72 61 | .particular,.we.introduce.progra |
| 37e00 | 6d 6d 69 6e 67 20 22 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 70 72 6f 67 72 61 6d 6d 69 6e 67 | mming."data-directed.programming |
| 37e20 | 22 20 61 73 20 61 20 74 65 63 68 6e 69 71 75 65 20 74 68 61 74 0a 61 6c 6c 6f 77 73 20 69 6e 64 | ".as.a.technique.that.allows.ind |
| 37e40 | 69 76 69 64 75 61 6c 20 64 61 74 61 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 74 6f 20 | ividual.data.representations.to. |
| 37e60 | 62 65 20 64 65 73 69 67 6e 65 64 20 69 6e 20 69 73 6f 6c 61 74 69 6f 6e 20 61 6e 64 0a 74 68 65 | be.designed.in.isolation.and.the |
| 37e80 | 6e 20 63 6f 6d 62 69 6e 65 64 20 22 61 64 64 69 74 69 76 65 6c 79 22 20 28 69 2e 65 2e 2c 20 77 | n.combined."additively".(i.e.,.w |
| 37ea0 | 69 74 68 6f 75 74 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 29 2e 20 20 54 6f 20 69 6c 6c 75 73 74 | ithout.modification)...To.illust |
| 37ec0 | 72 61 74 65 0a 74 68 65 20 70 6f 77 65 72 20 6f 66 20 74 68 69 73 20 61 70 70 72 6f 61 63 68 20 | rate.the.power.of.this.approach. |
| 37ee0 | 74 6f 20 73 79 73 74 65 6d 20 64 65 73 69 67 6e 2c 20 77 65 20 63 6c 6f 73 65 20 74 68 65 20 63 | to.system.design,.we.close.the.c |
| 37f00 | 68 61 70 74 65 72 20 62 79 0a 61 70 70 6c 79 69 6e 67 20 77 68 61 74 20 77 65 20 68 61 76 65 20 | hapter.by.applying.what.we.have. |
| 37f20 | 6c 65 61 72 6e 65 64 20 74 6f 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 | learned.to.the.implementation.of |
| 37f40 | 20 61 20 70 61 63 6b 61 67 65 20 66 6f 72 0a 70 65 72 66 6f 72 6d 69 6e 67 20 73 79 6d 62 6f 6c | .a.package.for.performing.symbol |
| 37f60 | 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 6f 6e 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2c 20 69 6e | ic.arithmetic.on.polynomials,.in |
| 37f80 | 20 77 68 69 63 68 20 74 68 65 0a 63 6f 65 66 66 69 63 69 65 6e 74 73 20 6f 66 20 74 68 65 20 70 | .which.the.coefficients.of.the.p |
| 37fa0 | 6f 6c 79 6e 6f 6d 69 61 6c 73 20 63 61 6e 20 62 65 20 69 6e 74 65 67 65 72 73 2c 20 72 61 74 69 | olynomials.can.be.integers,.rati |
| 37fc0 | 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2c 0a 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2c 20 61 | onal.numbers,.complex.numbers,.a |
| 37fe0 | 6e 64 20 65 76 65 6e 20 6f 74 68 65 72 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2e 0a 0a 2a 20 4d 65 | nd.even.other.polynomials...*.Me |
| 38000 | 6e 75 3a 0a 0a 2a 20 32 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 49 6e 74 72 6f 64 | nu:..*.2-1::..............Introd |
| 38020 | 75 63 74 69 6f 6e 20 74 6f 20 44 61 74 61 20 41 62 73 74 72 61 63 74 69 6f 6e 0a 2a 20 32 2d 32 | uction.to.Data.Abstraction.*.2-2 |
| 38040 | 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 48 69 65 72 61 72 63 68 69 63 61 6c 20 44 61 74 | ::..............Hierarchical.Dat |
| 38060 | 61 20 61 6e 64 20 74 68 65 20 43 6c 6f 73 75 72 65 20 50 72 6f 70 65 72 74 79 0a 2a 20 32 2d 33 | a.and.the.Closure.Property.*.2-3 |
| 38080 | 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 6d 62 6f 6c 69 63 20 44 61 74 61 0a 2a 20 | ::..............Symbolic.Data.*. |
| 380a0 | 32 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4d 75 6c 74 69 70 6c 65 20 52 65 70 72 | 2-4::..............Multiple.Repr |
| 380c0 | 65 73 65 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 41 62 73 74 72 61 63 74 20 44 61 74 61 0a 2a 20 | esentations.for.Abstract.Data.*. |
| 380e0 | 32 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 79 73 74 65 6d 73 20 77 69 74 68 20 | 2-5::..............Systems.with. |
| 38100 | 47 65 6e 65 72 69 63 20 4f 70 65 72 61 74 69 6f 6e 73 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d | Generic.Operations.....--------- |
| 38120 | 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 | -.Footnotes.----------.....(1).T |
| 38140 | 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 64 69 72 65 63 74 6c 79 20 6d 61 6e 69 70 75 6c 61 74 | he.ability.to.directly.manipulat |
| 38160 | 65 20 70 72 6f 63 65 64 75 72 65 73 20 70 72 6f 76 69 64 65 73 20 61 6e 0a 61 6e 61 6c 6f 67 6f | e.procedures.provides.an.analogo |
| 38180 | 75 73 20 69 6e 63 72 65 61 73 65 20 69 6e 20 74 68 65 20 65 78 70 72 65 73 73 69 76 65 20 70 6f | us.increase.in.the.expressive.po |
| 381a0 | 77 65 72 20 6f 66 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 0a 46 | wer.of.a.programming.language..F |
| 381c0 | 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 33 | or.example,.in.section.*Note.1-3 |
| 381e0 | 2d 31 3a 3a 20 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 74 68 65 20 60 73 75 6d 27 0a 70 72 6f | -1::.we.introduced.the.`sum'.pro |
| 38200 | 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 74 61 6b 65 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 | cedure,.which.takes.a.procedure. |
| 38220 | 60 74 65 72 6d 27 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 63 6f 6d 70 75 74 | `term'.as.an.argument.and.comput |
| 38240 | 65 73 0a 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 60 74 65 72 | es.the.sum.of.the.values.of.`ter |
| 38260 | 6d 27 20 6f 76 65 72 20 73 6f 6d 65 20 73 70 65 63 69 66 69 65 64 20 69 6e 74 65 72 76 61 6c 2e | m'.over.some.specified.interval. |
| 38280 | 20 20 49 6e 20 6f 72 64 65 72 0a 74 6f 20 64 65 66 69 6e 65 20 60 73 75 6d 27 2c 20 69 74 20 69 | ..In.order.to.define.`sum',.it.i |
| 382a0 | 73 20 63 72 75 63 69 61 6c 20 74 68 61 74 20 77 65 20 62 65 20 61 62 6c 65 20 74 6f 20 73 70 65 | s.crucial.that.we.be.able.to.spe |
| 382c0 | 61 6b 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 0a 73 75 63 68 20 61 73 20 60 74 65 72 6d 27 | ak.of.a.procedure.such.as.`term' |
| 382e0 | 20 61 73 20 61 6e 20 65 6e 74 69 74 79 20 69 6e 20 69 74 73 20 6f 77 6e 20 72 69 67 68 74 2c 20 | .as.an.entity.in.its.own.right,. |
| 38300 | 77 69 74 68 6f 75 74 20 72 65 67 61 72 64 20 66 6f 72 20 68 6f 77 0a 60 74 65 72 6d 27 20 6d 69 | without.regard.for.how.`term'.mi |
| 38320 | 67 68 74 20 62 65 20 65 78 70 72 65 73 73 65 64 20 77 69 74 68 20 6d 6f 72 65 20 70 72 69 6d 69 | ght.be.expressed.with.more.primi |
| 38340 | 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 49 6e 64 65 65 64 2c 20 69 66 0a 77 65 20 | tive.operations...Indeed,.if.we. |
| 38360 | 64 69 64 20 6e 6f 74 20 68 61 76 65 20 74 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 20 22 61 20 70 72 | did.not.have.the.notion.of."a.pr |
| 38380 | 6f 63 65 64 75 72 65 2c 22 20 69 74 20 69 73 20 64 6f 75 62 74 66 75 6c 20 74 68 61 74 20 77 65 | ocedure,".it.is.doubtful.that.we |
| 383a0 | 0a 77 6f 75 6c 64 20 65 76 65 72 20 65 76 65 6e 20 74 68 69 6e 6b 20 6f 66 20 74 68 65 20 70 6f | .would.ever.even.think.of.the.po |
| 383c0 | 73 73 69 62 69 6c 69 74 79 20 6f 66 20 64 65 66 69 6e 69 6e 67 20 61 6e 20 6f 70 65 72 61 74 69 | ssibility.of.defining.an.operati |
| 383e0 | 6f 6e 20 73 75 63 68 0a 61 73 20 60 73 75 6d 27 2e 20 20 4d 6f 72 65 6f 76 65 72 2c 20 69 6e 73 | on.such.as.`sum'...Moreover,.ins |
| 38400 | 6f 66 61 72 20 61 73 20 70 65 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 73 75 6d 6d 61 74 69 6f 6e | ofar.as.performing.the.summation |
| 38420 | 20 69 73 20 63 6f 6e 63 65 72 6e 65 64 2c 0a 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 68 6f | .is.concerned,.the.details.of.ho |
| 38440 | 77 20 60 74 65 72 6d 27 20 6d 61 79 20 62 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 66 72 6f 6d | w.`term'.may.be.constructed.from |
| 38460 | 20 6d 6f 72 65 20 70 72 69 6d 69 74 69 76 65 0a 6f 70 65 72 61 74 69 6f 6e 73 20 61 72 65 20 69 | .more.primitive.operations.are.i |
| 38480 | 72 72 65 6c 65 76 61 6e 74 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 | rrelevant.....File:.sicp.info,.. |
| 384a0 | 4e 6f 64 65 3a 20 32 2d 31 2c 20 20 4e 65 78 74 3a 20 32 2d 32 2c 20 20 50 72 65 76 3a 20 43 68 | Node:.2-1,..Next:.2-2,..Prev:.Ch |
| 384c0 | 61 70 74 65 72 20 32 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 32 0a 0a 32 2e 31 20 49 6e 74 | apter.2,..Up:.Chapter.2..2.1.Int |
| 384e0 | 72 6f 64 75 63 74 69 6f 6e 20 74 6f 20 44 61 74 61 20 41 62 73 74 72 61 63 74 69 6f 6e 0a 3d 3d | roduction.to.Data.Abstraction.== |
| 38500 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ================================ |
| 38520 | 3d 3d 0a 0a 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 38 3a 3a 2c 20 77 65 | ==..In.section.*Note.1-1-8::,.we |
| 38540 | 20 6e 6f 74 65 64 20 74 68 61 74 20 61 20 70 72 6f 63 65 64 75 72 65 20 75 73 65 64 20 61 73 20 | .noted.that.a.procedure.used.as. |
| 38560 | 61 6e 20 65 6c 65 6d 65 6e 74 0a 69 6e 20 63 72 65 61 74 69 6e 67 20 61 20 6d 6f 72 65 20 63 6f | an.element.in.creating.a.more.co |
| 38580 | 6d 70 6c 65 78 20 70 72 6f 63 65 64 75 72 65 20 63 6f 75 6c 64 20 62 65 20 72 65 67 61 72 64 65 | mplex.procedure.could.be.regarde |
| 385a0 | 64 20 6e 6f 74 20 6f 6e 6c 79 20 61 73 20 61 0a 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 70 61 | d.not.only.as.a.collection.of.pa |
| 385c0 | 72 74 69 63 75 6c 61 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 62 75 74 20 61 6c 73 6f 20 61 73 20 | rticular.operations.but.also.as. |
| 385e0 | 61 20 70 72 6f 63 65 64 75 72 61 6c 0a 61 62 73 74 72 61 63 74 69 6f 6e 2e 20 20 54 68 61 74 20 | a.procedural.abstraction...That. |
| 38600 | 69 73 2c 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 68 6f 77 20 74 68 65 20 70 72 6f 63 65 | is,.the.details.of.how.the.proce |
| 38620 | 64 75 72 65 20 77 61 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 0a 63 6f 75 6c 64 20 62 65 20 73 75 | dure.was.implemented.could.be.su |
| 38640 | 70 70 72 65 73 73 65 64 2c 20 61 6e 64 20 74 68 65 20 70 61 72 74 69 63 75 6c 61 72 20 70 72 6f | ppressed,.and.the.particular.pro |
| 38660 | 63 65 64 75 72 65 20 69 74 73 65 6c 66 20 63 6f 75 6c 64 20 62 65 0a 72 65 70 6c 61 63 65 64 20 | cedure.itself.could.be.replaced. |
| 38680 | 62 79 20 61 6e 79 20 6f 74 68 65 72 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 74 68 65 20 | by.any.other.procedure.with.the. |
| 386a0 | 73 61 6d 65 20 6f 76 65 72 61 6c 6c 20 62 65 68 61 76 69 6f 72 2e 20 20 49 6e 0a 6f 74 68 65 72 | same.overall.behavior...In.other |
| 386c0 | 20 77 6f 72 64 73 2c 20 77 65 20 63 6f 75 6c 64 20 6d 61 6b 65 20 61 6e 20 61 62 73 74 72 61 63 | .words,.we.could.make.an.abstrac |
| 386e0 | 74 69 6f 6e 20 74 68 61 74 20 77 6f 75 6c 64 20 73 65 70 61 72 61 74 65 20 74 68 65 20 77 61 79 | tion.that.would.separate.the.way |
| 38700 | 0a 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 77 6f 75 6c 64 20 62 65 20 75 73 65 64 20 66 72 6f | .the.procedure.would.be.used.fro |
| 38720 | 6d 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 68 6f 77 20 74 68 65 20 70 72 6f 63 65 64 75 | m.the.details.of.how.the.procedu |
| 38740 | 72 65 20 77 6f 75 6c 64 0a 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 74 65 72 6d 73 | re.would.be.implemented.in.terms |
| 38760 | 20 6f 66 20 6d 6f 72 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 | .of.more.primitive.procedures... |
| 38780 | 54 68 65 20 61 6e 61 6c 6f 67 6f 75 73 0a 6e 6f 74 69 6f 6e 20 66 6f 72 20 63 6f 6d 70 6f 75 6e | The.analogous.notion.for.compoun |
| 387a0 | 64 20 64 61 74 61 20 69 73 20 63 61 6c 6c 65 64 20 22 64 61 74 61 20 61 62 73 74 72 61 63 74 69 | d.data.is.called."data.abstracti |
| 387c0 | 6f 6e 22 2e 20 20 44 61 74 61 0a 61 62 73 74 72 61 63 74 69 6f 6e 20 69 73 20 61 20 6d 65 74 68 | on"...Data.abstraction.is.a.meth |
| 387e0 | 6f 64 6f 6c 6f 67 79 20 74 68 61 74 20 65 6e 61 62 6c 65 73 20 75 73 20 74 6f 20 69 73 6f 6c 61 | odology.that.enables.us.to.isola |
| 38800 | 74 65 20 68 6f 77 20 61 20 63 6f 6d 70 6f 75 6e 64 0a 64 61 74 61 20 6f 62 6a 65 63 74 20 69 73 | te.how.a.compound.data.object.is |
| 38820 | 20 75 73 65 64 20 66 72 6f 6d 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 68 6f 77 20 69 74 | .used.from.the.details.of.how.it |
| 38840 | 20 69 73 20 63 6f 6e 73 74 72 75 63 74 65 64 20 66 72 6f 6d 20 6d 6f 72 65 0a 70 72 69 6d 69 74 | .is.constructed.from.more.primit |
| 38860 | 69 76 65 20 64 61 74 61 20 6f 62 6a 65 63 74 73 2e 0a 0a 20 20 20 54 68 65 20 62 61 73 69 63 20 | ive.data.objects......The.basic. |
| 38880 | 69 64 65 61 20 6f 66 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 69 73 20 74 6f 20 73 | idea.of.data.abstraction.is.to.s |
| 388a0 | 74 72 75 63 74 75 72 65 20 74 68 65 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 0a 61 72 65 20 74 | tructure.the.programs.that.are.t |
| 388c0 | 6f 20 75 73 65 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 73 6f 20 74 | o.use.compound.data.objects.so.t |
| 388e0 | 68 61 74 20 74 68 65 79 20 6f 70 65 72 61 74 65 20 6f 6e 20 22 61 62 73 74 72 61 63 74 0a 64 61 | hat.they.operate.on."abstract.da |
| 38900 | 74 61 2e 22 20 54 68 61 74 20 69 73 2c 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 73 68 6f 75 6c | ta.".That.is,.our.programs.shoul |
| 38920 | 64 20 75 73 65 20 64 61 74 61 20 69 6e 20 73 75 63 68 20 61 20 77 61 79 20 61 73 20 74 6f 20 6d | d.use.data.in.such.a.way.as.to.m |
| 38940 | 61 6b 65 0a 6e 6f 20 61 73 73 75 6d 70 74 69 6f 6e 73 20 61 62 6f 75 74 20 74 68 65 20 64 61 74 | ake.no.assumptions.about.the.dat |
| 38960 | 61 20 74 68 61 74 20 61 72 65 20 6e 6f 74 20 73 74 72 69 63 74 6c 79 20 6e 65 63 65 73 73 61 72 | a.that.are.not.strictly.necessar |
| 38980 | 79 20 66 6f 72 0a 70 65 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 74 61 73 6b 20 61 74 20 68 61 6e | y.for.performing.the.task.at.han |
| 389a0 | 64 2e 20 20 41 74 20 74 68 65 20 73 61 6d 65 20 74 69 6d 65 2c 20 61 20 22 63 6f 6e 63 72 65 74 | d...At.the.same.time,.a."concret |
| 389c0 | 65 22 20 64 61 74 61 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 64 65 66 69 6e 65 | e".data.representation.is.define |
| 389e0 | 64 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d 73 20 74 68 | d.independent.of.the.programs.th |
| 38a00 | 61 74 20 75 73 65 20 74 68 65 0a 64 61 74 61 2e 20 20 54 68 65 20 69 6e 74 65 72 66 61 63 65 20 | at.use.the.data...The.interface. |
| 38a20 | 62 65 74 77 65 65 6e 20 74 68 65 73 65 20 74 77 6f 20 70 61 72 74 73 20 6f 66 20 6f 75 72 20 73 | between.these.two.parts.of.our.s |
| 38a40 | 79 73 74 65 6d 20 77 69 6c 6c 20 62 65 20 61 0a 73 65 74 20 6f 66 20 70 72 6f 63 65 64 75 72 65 | ystem.will.be.a.set.of.procedure |
| 38a60 | 73 2c 20 63 61 6c 6c 65 64 20 22 73 65 6c 65 63 74 6f 72 73 22 20 61 6e 64 20 22 63 6f 6e 73 74 | s,.called."selectors".and."const |
| 38a80 | 72 75 63 74 6f 72 73 22 2c 20 74 68 61 74 0a 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 61 62 73 | ructors",.that.implement.the.abs |
| 38aa0 | 74 72 61 63 74 20 64 61 74 61 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 63 6f 6e 63 72 | tract.data.in.terms.of.the.concr |
| 38ac0 | 65 74 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 54 6f 0a 69 6c 6c 75 73 74 72 61 | ete.representation...To.illustra |
| 38ae0 | 74 65 20 74 68 69 73 20 74 65 63 68 6e 69 71 75 65 2c 20 77 65 20 77 69 6c 6c 20 63 6f 6e 73 69 | te.this.technique,.we.will.consi |
| 38b00 | 64 65 72 20 68 6f 77 20 74 6f 20 64 65 73 69 67 6e 20 61 20 73 65 74 20 6f 66 0a 70 72 6f 63 65 | der.how.to.design.a.set.of.proce |
| 38b20 | 64 75 72 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 72 61 74 69 6f 6e 61 6c 20 | dures.for.manipulating.rational. |
| 38b40 | 6e 75 6d 62 65 72 73 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 32 2d 31 2d 31 3a 3a 20 20 20 20 | numbers...*.Menu:..*.2-1-1::.... |
| 38b60 | 20 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 41 72 69 74 68 6d 65 74 69 63 20 4f 70 65 72 | ........Example:.Arithmetic.Oper |
| 38b80 | 61 74 69 6f 6e 73 20 66 6f 72 20 52 61 74 69 6f 6e 61 6c 20 4e 75 6d 62 65 72 73 0a 2a 20 32 2d | ations.for.Rational.Numbers.*.2- |
| 38ba0 | 31 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 41 62 73 74 72 61 63 74 69 6f 6e 20 42 61 72 | 1-2::............Abstraction.Bar |
| 38bc0 | 72 69 65 72 73 0a 2a 20 32 2d 31 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 57 68 61 74 20 | riers.*.2-1-3::............What. |
| 38be0 | 49 73 20 4d 65 61 6e 74 20 62 79 20 44 61 74 61 3f 0a 2a 20 32 2d 31 2d 34 3a 3a 20 20 20 20 20 | Is.Meant.by.Data?.*.2-1-4::..... |
| 38c00 | 20 20 20 20 20 20 20 45 78 74 65 6e 64 65 64 20 45 78 65 72 63 69 73 65 3a 20 49 6e 74 65 72 76 | .......Extended.Exercise:.Interv |
| 38c20 | 61 6c 20 41 72 69 74 68 6d 65 74 69 63 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f | al.Arithmetic....File:.sicp.info |
| 38c40 | 2c 20 20 4e 6f 64 65 3a 20 32 2d 31 2d 31 2c 20 20 4e 65 78 74 3a 20 32 2d 31 2d 32 2c 20 20 50 | ,..Node:.2-1-1,..Next:.2-1-2,..P |
| 38c60 | 72 65 76 3a 20 32 2d 31 2c 20 20 55 70 3a 20 32 2d 31 0a 0a 32 2e 31 2e 31 20 45 78 61 6d 70 6c | rev:.2-1,..Up:.2-1..2.1.1.Exampl |
| 38c80 | 65 3a 20 41 72 69 74 68 6d 65 74 69 63 20 4f 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 52 61 74 | e:.Arithmetic.Operations.for.Rat |
| 38ca0 | 69 6f 6e 61 6c 20 4e 75 6d 62 65 72 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ional.Numbers.------------------ |
| 38cc0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 38ce0 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 53 75 70 70 6f 73 65 20 77 65 20 77 61 6e 74 20 74 6f 20 64 6f 20 61 | -------..Suppose.we.want.to.do.a |
| 38d00 | 72 69 74 68 6d 65 74 69 63 20 77 69 74 68 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2e | rithmetic.with.rational.numbers. |
| 38d20 | 20 20 57 65 20 77 61 6e 74 20 74 6f 20 62 65 0a 61 62 6c 65 20 74 6f 20 61 64 64 2c 20 73 75 62 | ..We.want.to.be.able.to.add,.sub |
| 38d40 | 74 72 61 63 74 2c 20 6d 75 6c 74 69 70 6c 79 2c 20 61 6e 64 20 64 69 76 69 64 65 20 74 68 65 6d | tract,.multiply,.and.divide.them |
| 38d60 | 20 61 6e 64 20 74 6f 20 74 65 73 74 20 77 68 65 74 68 65 72 0a 74 77 6f 20 72 61 74 69 6f 6e 61 | .and.to.test.whether.two.rationa |
| 38d80 | 6c 20 6e 75 6d 62 65 72 73 20 61 72 65 20 65 71 75 61 6c 2e 0a 0a 20 20 20 4c 65 74 20 75 73 20 | l.numbers.are.equal......Let.us. |
| 38da0 | 62 65 67 69 6e 20 62 79 20 61 73 73 75 6d 69 6e 67 20 74 68 61 74 20 77 65 20 61 6c 72 65 61 64 | begin.by.assuming.that.we.alread |
| 38dc0 | 79 20 68 61 76 65 20 61 20 77 61 79 20 6f 66 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 0a 61 20 72 | y.have.a.way.of.constructing.a.r |
| 38de0 | 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 66 72 6f 6d 20 61 20 6e 75 6d 65 72 61 74 6f 72 20 | ational.number.from.a.numerator. |
| 38e00 | 61 6e 64 20 61 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 2e 20 20 57 65 20 61 6c 73 6f 20 61 73 73 75 | and.a.denominator...We.also.assu |
| 38e20 | 6d 65 0a 74 68 61 74 2c 20 67 69 76 65 6e 20 61 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 | me.that,.given.a.rational.number |
| 38e40 | 2c 20 77 65 20 68 61 76 65 20 61 20 77 61 79 20 6f 66 20 65 78 74 72 61 63 74 69 6e 67 20 28 6f | ,.we.have.a.way.of.extracting.(o |
| 38e60 | 72 0a 73 65 6c 65 63 74 69 6e 67 29 20 69 74 73 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 69 | r.selecting).its.numerator.and.i |
| 38e80 | 74 73 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 2e 20 20 4c 65 74 20 75 73 20 66 75 72 74 68 65 72 20 | ts.denominator...Let.us.further. |
| 38ea0 | 61 73 73 75 6d 65 0a 74 68 61 74 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 61 6e 64 20 | assume.that.the.constructor.and. |
| 38ec0 | 73 65 6c 65 63 74 6f 72 73 20 61 72 65 20 61 76 61 69 6c 61 62 6c 65 20 61 73 20 70 72 6f 63 65 | selectors.are.available.as.proce |
| 38ee0 | 64 75 72 65 73 3a 0a 0a 20 20 20 2a 20 60 28 6d 61 6b 65 2d 72 61 74 20 3c 4e 3e 20 3c 44 3e 29 | dures:.....*.`(make-rat.<N>.<D>) |
| 38f00 | 27 20 72 65 74 75 72 6e 73 20 74 68 65 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 77 68 6f | '.returns.therational.number.who |
| 38f20 | 73 65 20 6e 75 6d 65 72 61 74 6f 72 20 69 73 0a 20 20 20 20 20 74 68 65 20 69 6e 74 65 67 65 72 | se.numerator.is......the.integer |
| 38f40 | 20 60 3c 4e 3e 27 20 61 6e 64 20 77 68 6f 73 65 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 20 69 73 20 | .`<N>'.and.whose.denominator.is. |
| 38f60 | 74 68 65 20 69 6e 74 65 67 65 72 20 60 3c 44 3e 27 2e 0a 0a 20 20 20 2a 20 60 28 6e 75 6d 65 72 | the.integer.`<D>'......*.`(numer |
| 38f80 | 20 3c 58 3e 29 27 20 72 65 74 75 72 6e 73 20 74 68 65 20 6e 75 6d 65 72 61 74 6f 72 20 6f 66 20 | .<X>)'.returns.the.numerator.of. |
| 38fa0 | 74 68 65 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 60 3c 58 3e 27 2e 0a 0a 20 20 20 2a | the.rational.number.`<X>'......* |
| 38fc0 | 20 60 28 64 65 6e 6f 6d 20 3c 58 3e 29 27 20 72 65 74 75 72 6e 73 20 74 68 65 20 64 65 6e 6f 6d | .`(denom.<X>)'.returns.the.denom |
| 38fe0 | 69 6e 61 74 6f 72 20 6f 66 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 60 3c | inator.of.the.rational.number.`< |
| 39000 | 58 3e 27 2e 0a 0a 0a 20 20 20 57 65 20 61 72 65 20 75 73 69 6e 67 20 68 65 72 65 20 61 20 70 6f | X>'.......We.are.using.here.a.po |
| 39020 | 77 65 72 66 75 6c 20 73 74 72 61 74 65 67 79 20 6f 66 20 73 79 6e 74 68 65 73 69 73 3a 20 22 77 | werful.strategy.of.synthesis:."w |
| 39040 | 69 73 68 66 75 6c 0a 74 68 69 6e 6b 69 6e 67 22 2e 20 20 57 65 20 68 61 76 65 6e 27 74 20 79 65 | ishful.thinking"...We.haven't.ye |
| 39060 | 74 20 73 61 69 64 20 68 6f 77 20 61 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 69 73 20 | t.said.how.a.rational.number.is. |
| 39080 | 72 65 70 72 65 73 65 6e 74 65 64 2c 0a 6f 72 20 68 6f 77 20 74 68 65 20 70 72 6f 63 65 64 75 72 | represented,.or.how.the.procedur |
| 390a0 | 65 73 20 60 6e 75 6d 65 72 27 2c 20 60 64 65 6e 6f 6d 27 2c 20 61 6e 64 20 60 6d 61 6b 65 2d 72 | es.`numer',.`denom',.and.`make-r |
| 390c0 | 61 74 27 20 73 68 6f 75 6c 64 20 62 65 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 2e 20 20 45 76 65 6e | at'.should.be.implemented...Even |
| 390e0 | 20 73 6f 2c 20 69 66 20 77 65 20 64 69 64 20 68 61 76 65 20 74 68 65 73 65 20 74 68 72 65 65 20 | .so,.if.we.did.have.these.three. |
| 39100 | 70 72 6f 63 65 64 75 72 65 73 2c 20 77 65 20 63 6f 75 6c 64 0a 74 68 65 6e 20 61 64 64 2c 20 73 | procedures,.we.could.then.add,.s |
| 39120 | 75 62 74 72 61 63 74 2c 20 6d 75 6c 74 69 70 6c 79 2c 20 64 69 76 69 64 65 2c 20 61 6e 64 20 74 | ubtract,.multiply,.divide,.and.t |
| 39140 | 65 73 74 20 65 71 75 61 6c 69 74 79 20 62 79 20 75 73 69 6e 67 20 74 68 65 0a 66 6f 6c 6c 6f 77 | est.equality.by.using.the.follow |
| 39160 | 69 6e 67 20 72 65 6c 61 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 6e 5f 31 20 20 20 6e 5f 32 20 20 | ing.relations:.......n_1...n_2.. |
| 39180 | 20 6e 5f 31 20 64 5f 32 20 2b 20 6e 5f 32 20 64 5f 31 0a 20 20 20 20 20 2d 2d 2d 20 2b 20 2d 2d | .n_1.d_2.+.n_2.d_1......---.+.-- |
| 391a0 | 2d 20 3d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 64 5f 31 20 20 | -.=.-----------------......d_1.. |
| 391c0 | 20 64 5f 32 20 20 20 20 20 20 20 20 64 5f 31 20 64 5f 32 0a 0a 20 20 20 20 20 6e 5f 31 20 20 20 | .d_2........d_1.d_2.......n_1... |
| 391e0 | 6e 5f 32 20 20 20 6e 5f 31 20 64 5f 32 20 2d 20 6e 5f 32 20 64 5f 31 0a 20 20 20 20 20 2d 2d 2d | n_2...n_1.d_2.-.n_2.d_1......--- |
| 39200 | 20 2d 20 2d 2d 2d 20 3d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 | .-.---.=.-----------------...... |
| 39220 | 64 5f 31 20 20 20 64 5f 32 20 20 20 20 20 20 20 20 64 5f 31 20 64 5f 32 0a 0a 20 20 20 20 20 6e | d_1...d_2........d_1.d_2.......n |
| 39240 | 5f 31 20 20 20 6e 5f 32 20 20 20 6e 5f 31 20 6e 5f 32 0a 20 20 20 20 20 2d 2d 2d 20 2a 20 2d 2d | _1...n_2...n_1.n_2......---.*.-- |
| 39260 | 2d 20 3d 20 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 64 5f 31 20 20 20 64 5f 32 20 20 20 64 5f 31 | -.=.-------......d_1...d_2...d_1 |
| 39280 | 20 64 5f 32 0a 0a 20 20 20 20 20 6e 5f 31 20 2f 20 64 5f 31 20 20 20 6e 5f 31 20 64 5f 32 0a 20 | .d_2.......n_1./.d_1...n_1.d_2.. |
| 392a0 | 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 3d 20 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 6e 5f 32 | ....---------.=.-------......n_2 |
| 392c0 | 20 2f 20 64 5f 32 20 20 20 64 5f 31 20 6e 5f 32 0a 0a 20 20 20 20 20 6e 5f 31 20 20 20 6e 5f 32 | ./.d_2...d_1.n_2.......n_1...n_2 |
| 392e0 | 0a 20 20 20 20 20 2d 2d 2d 20 3d 20 2d 2d 2d 20 20 69 66 20 61 6e 64 20 6f 6e 6c 79 20 69 66 20 | ......---.=.---..if.and.only.if. |
| 39300 | 6e 5f 31 20 64 5f 32 20 3d 20 6e 5f 32 20 64 5f 31 0a 20 20 20 20 20 64 5f 31 20 20 20 64 5f 32 | n_1.d_2.=.n_2.d_1......d_1...d_2 |
| 39320 | 0a 0a 57 65 20 63 61 6e 20 65 78 70 72 65 73 73 20 74 68 65 73 65 20 72 75 6c 65 73 20 61 73 20 | ..We.can.express.these.rules.as. |
| 39340 | 70 72 6f 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 72 | procedures:.......(define.(add-r |
| 39360 | 61 74 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 72 61 74 20 28 2b 20 28 2a 20 28 | at.x.y)........(make-rat.(+.(*.( |
| 39380 | 6e 75 6d 65 72 20 78 29 20 28 64 65 6e 6f 6d 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | numer.x).(denom.y))............. |
| 393a0 | 20 20 20 20 20 20 20 20 28 2a 20 28 6e 75 6d 65 72 20 79 29 20 28 64 65 6e 6f 6d 20 78 29 29 29 | ........(*.(numer.y).(denom.x))) |
| 393c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 64 65 6e 6f 6d 20 78 29 20 28 | ..................(*.(denom.x).( |
| 393e0 | 64 65 6e 6f 6d 20 79 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 62 2d 72 | denom.y)))).......(define.(sub-r |
| 39400 | 61 74 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 72 61 74 20 28 2d 20 28 2a 20 28 | at.x.y)........(make-rat.(-.(*.( |
| 39420 | 6e 75 6d 65 72 20 78 29 20 28 64 65 6e 6f 6d 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | numer.x).(denom.y))............. |
| 39440 | 20 20 20 20 20 20 20 20 28 2a 20 28 6e 75 6d 65 72 20 79 29 20 28 64 65 6e 6f 6d 20 78 29 29 29 | ........(*.(numer.y).(denom.x))) |
| 39460 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 64 65 6e 6f 6d 20 78 29 20 28 | ..................(*.(denom.x).( |
| 39480 | 64 65 6e 6f 6d 20 79 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 2d 72 | denom.y)))).......(define.(mul-r |
| 394a0 | 61 74 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 72 61 74 20 28 2a 20 28 6e 75 6d | at.x.y)........(make-rat.(*.(num |
| 394c0 | 65 72 20 78 29 20 28 6e 75 6d 65 72 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | er.x).(numer.y))................ |
| 394e0 | 20 20 28 2a 20 28 64 65 6e 6f 6d 20 78 29 20 28 64 65 6e 6f 6d 20 79 29 29 29 29 0a 0a 20 20 20 | ..(*.(denom.x).(denom.y))))..... |
| 39500 | 20 20 28 64 65 66 69 6e 65 20 28 64 69 76 2d 72 61 74 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 | ..(define.(div-rat.x.y)........( |
| 39520 | 6d 61 6b 65 2d 72 61 74 20 28 2a 20 28 6e 75 6d 65 72 20 78 29 20 28 64 65 6e 6f 6d 20 79 29 29 | make-rat.(*.(numer.x).(denom.y)) |
| 39540 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 64 65 6e 6f 6d 20 78 29 20 28 | ..................(*.(denom.x).( |
| 39560 | 6e 75 6d 65 72 20 79 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 71 75 61 6c | numer.y)))).......(define.(equal |
| 39580 | 2d 72 61 74 3f 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 3d 20 28 2a 20 28 6e 75 6d 65 72 20 78 | -rat?.x.y)........(=.(*.(numer.x |
| 395a0 | 29 20 28 64 65 6e 6f 6d 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 6e 75 6d 65 72 | ).(denom.y))...........(*.(numer |
| 395c0 | 20 79 29 20 28 64 65 6e 6f 6d 20 78 29 29 29 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 68 61 76 65 | .y).(denom.x)))).....Now.we.have |
| 395e0 | 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 | .the.operations.on.rational.numb |
| 39600 | 65 72 73 20 64 65 66 69 6e 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 0a 74 68 65 20 73 65 6c 65 | ers.defined.in.terms.of.the.sele |
| 39620 | 63 74 6f 72 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 70 72 6f 63 65 64 75 72 65 73 20 | ctor.and.constructor.procedures. |
| 39640 | 60 6e 75 6d 65 72 27 2c 20 60 64 65 6e 6f 6d 27 2c 20 61 6e 64 0a 60 6d 61 6b 65 2d 72 61 74 27 | `numer',.`denom',.and.`make-rat' |
| 39660 | 2e 20 20 42 75 74 20 77 65 20 68 61 76 65 6e 27 74 20 79 65 74 20 64 65 66 69 6e 65 64 20 74 68 | ...But.we.haven't.yet.defined.th |
| 39680 | 65 73 65 2e 20 20 57 68 61 74 20 77 65 20 6e 65 65 64 20 69 73 20 73 6f 6d 65 0a 77 61 79 20 74 | ese...What.we.need.is.some.way.t |
| 396a0 | 6f 20 67 6c 75 65 20 74 6f 67 65 74 68 65 72 20 61 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 | o.glue.together.a.numerator.and. |
| 396c0 | 61 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 20 74 6f 20 66 6f 72 6d 20 61 20 72 61 74 69 6f 6e 61 6c | a.denominator.to.form.a.rational |
| 396e0 | 0a 6e 75 6d 62 65 72 2e 0a 0a 50 61 69 72 73 0a 2e 2e 2e 2e 2e 0a 0a 54 6f 20 65 6e 61 62 6c 65 | .number...Pairs........To.enable |
| 39700 | 20 75 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 63 6f 6e 63 72 65 74 65 20 6c 65 | .us.to.implement.the.concrete.le |
| 39720 | 76 65 6c 20 6f 66 20 6f 75 72 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 0a 6f 75 72 | vel.of.our.data.abstraction,.our |
| 39740 | 20 6c 61 6e 67 75 61 67 65 20 70 72 6f 76 69 64 65 73 20 61 20 63 6f 6d 70 6f 75 6e 64 20 73 74 | .language.provides.a.compound.st |
| 39760 | 72 75 63 74 75 72 65 20 63 61 6c 6c 65 64 20 61 20 22 70 61 69 72 22 2c 20 77 68 69 63 68 20 63 | ructure.called.a."pair",.which.c |
| 39780 | 61 6e 20 62 65 0a 63 6f 6e 73 74 72 75 63 74 65 64 20 77 69 74 68 20 74 68 65 20 70 72 69 6d 69 | an.be.constructed.with.the.primi |
| 397a0 | 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 60 63 6f 6e 73 27 2e 20 20 54 68 69 73 20 70 72 6f | tive.procedure.`cons'...This.pro |
| 397c0 | 63 65 64 75 72 65 20 74 61 6b 65 73 0a 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 72 | cedure.takes.two.arguments.and.r |
| 397e0 | 65 74 75 72 6e 73 20 61 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 6f 62 6a 65 63 74 20 74 68 | eturns.a.compound.data.object.th |
| 39800 | 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 74 77 6f 0a 61 72 67 75 6d 65 6e 74 73 20 61 73 | at.contains.the.two.arguments.as |
| 39820 | 20 70 61 72 74 73 2e 20 20 47 69 76 65 6e 20 61 20 70 61 69 72 2c 20 77 65 20 63 61 6e 20 65 78 | .parts...Given.a.pair,.we.can.ex |
| 39840 | 74 72 61 63 74 20 74 68 65 20 70 61 72 74 73 20 75 73 69 6e 67 20 74 68 65 0a 70 72 69 6d 69 74 | tract.the.parts.using.the.primit |
| 39860 | 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 2e 28 | ive.procedures.`car'.and.`cdr'.( |
| 39880 | 31 29 20 54 68 75 73 2c 20 77 65 20 63 61 6e 20 75 73 65 20 60 63 6f 6e 73 27 2c 0a 60 63 61 72 | 1).Thus,.we.can.use.`cons',.`car |
| 398a0 | 27 2c 20 61 6e 64 20 60 63 64 72 27 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 | ',.and.`cdr'.as.follows:.......( |
| 398c0 | 64 65 66 69 6e 65 20 78 20 28 63 6f 6e 73 20 31 20 32 29 29 0a 0a 20 20 20 20 20 28 63 61 72 20 | define.x.(cons.1.2)).......(car. |
| 398e0 | 78 29 0a 20 20 20 20 20 31 0a 0a 20 20 20 20 20 28 63 64 72 20 78 29 0a 20 20 20 20 20 32 0a 0a | x)......1.......(cdr.x)......2.. |
| 39900 | 20 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 61 20 70 61 69 72 20 69 73 20 61 20 64 61 74 61 20 | ...Notice.that.a.pair.is.a.data. |
| 39920 | 6f 62 6a 65 63 74 20 74 68 61 74 20 63 61 6e 20 62 65 20 67 69 76 65 6e 20 61 20 6e 61 6d 65 20 | object.that.can.be.given.a.name. |
| 39940 | 61 6e 64 0a 6d 61 6e 69 70 75 6c 61 74 65 64 2c 20 6a 75 73 74 20 6c 69 6b 65 20 61 20 70 72 69 | and.manipulated,.just.like.a.pri |
| 39960 | 6d 69 74 69 76 65 20 64 61 74 61 20 6f 62 6a 65 63 74 2e 20 20 4d 6f 72 65 6f 76 65 72 2c 20 60 | mitive.data.object...Moreover,.` |
| 39980 | 63 6f 6e 73 27 20 63 61 6e 0a 62 65 20 75 73 65 64 20 74 6f 20 66 6f 72 6d 20 70 61 69 72 73 20 | cons'.can.be.used.to.form.pairs. |
| 399a0 | 77 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 20 70 61 69 72 73 2c 20 61 6e 64 20 73 6f | whose.elements.are.pairs,.and.so |
| 399c0 | 20 6f 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 28 63 6f 6e 73 20 31 20 32 29 29 | .on:.......(define.x.(cons.1.2)) |
| 399e0 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 79 20 28 63 6f 6e 73 20 33 20 34 29 29 0a 0a 20 20 | .......(define.y.(cons.3.4)).... |
| 39a00 | 20 20 20 28 64 65 66 69 6e 65 20 7a 20 28 63 6f 6e 73 20 78 20 79 29 29 0a 0a 20 20 20 20 20 28 | ...(define.z.(cons.x.y)).......( |
| 39a20 | 63 61 72 20 28 63 61 72 20 7a 29 29 0a 20 20 20 20 20 31 0a 0a 20 20 20 20 20 28 63 61 72 20 28 | car.(car.z))......1.......(car.( |
| 39a40 | 63 64 72 20 7a 29 29 0a 20 20 20 20 20 33 0a 0a 20 20 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e | cdr.z))......3.....In.section.*N |
| 39a60 | 6f 74 65 20 32 2d 32 3a 3a 20 77 65 20 77 69 6c 6c 20 73 65 65 20 68 6f 77 20 74 68 69 73 20 61 | ote.2-2::.we.will.see.how.this.a |
| 39a80 | 62 69 6c 69 74 79 20 74 6f 20 63 6f 6d 62 69 6e 65 20 70 61 69 72 73 0a 6d 65 61 6e 73 20 74 68 | bility.to.combine.pairs.means.th |
| 39aa0 | 61 74 20 70 61 69 72 73 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 67 65 6e 65 72 61 6c 2d | at.pairs.can.be.used.as.general- |
| 39ac0 | 70 75 72 70 6f 73 65 20 62 75 69 6c 64 69 6e 67 20 62 6c 6f 63 6b 73 20 74 6f 0a 63 72 65 61 74 | purpose.building.blocks.to.creat |
| 39ae0 | 65 20 61 6c 6c 20 73 6f 72 74 73 20 6f 66 20 63 6f 6d 70 6c 65 78 20 64 61 74 61 20 73 74 72 75 | e.all.sorts.of.complex.data.stru |
| 39b00 | 63 74 75 72 65 73 2e 20 20 54 68 65 20 73 69 6e 67 6c 65 20 63 6f 6d 70 6f 75 6e 64 2d 64 61 74 | ctures...The.single.compound-dat |
| 39b20 | 61 0a 70 72 69 6d 69 74 69 76 65 20 22 70 61 69 72 22 2c 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 | a.primitive."pair",.implemented. |
| 39b40 | 62 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 63 6f 6e 73 27 2c 20 60 63 61 72 27 2c | by.the.procedures.`cons',.`car', |
| 39b60 | 20 61 6e 64 0a 60 63 64 72 27 2c 20 69 73 20 74 68 65 20 6f 6e 6c 79 20 67 6c 75 65 20 77 65 20 | .and.`cdr',.is.the.only.glue.we. |
| 39b80 | 6e 65 65 64 2e 20 20 44 61 74 61 20 6f 62 6a 65 63 74 73 20 63 6f 6e 73 74 72 75 63 74 65 64 20 | need...Data.objects.constructed. |
| 39ba0 | 66 72 6f 6d 20 70 61 69 72 73 0a 61 72 65 20 63 61 6c 6c 65 64 20 22 6c 69 73 74 2d 73 74 72 75 | from.pairs.are.called."list-stru |
| 39bc0 | 63 74 75 72 65 64 22 20 64 61 74 61 2e 0a 0a 52 65 70 72 65 73 65 6e 74 69 6e 67 20 72 61 74 69 | ctured".data...Representing.rati |
| 39be0 | 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | onal.numbers.................... |
| 39c00 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 50 61 69 72 73 20 6f 66 66 65 72 20 61 20 6e 61 74 75 72 61 | ............Pairs.offer.a.natura |
| 39c20 | 6c 20 77 61 79 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e | l.way.to.complete.the.rational-n |
| 39c40 | 75 6d 62 65 72 20 73 79 73 74 65 6d 2e 0a 53 69 6d 70 6c 79 20 72 65 70 72 65 73 65 6e 74 20 61 | umber.system..Simply.represent.a |
| 39c60 | 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 61 73 20 61 20 70 61 69 72 20 6f 66 20 74 77 | .rational.number.as.a.pair.of.tw |
| 39c80 | 6f 20 69 6e 74 65 67 65 72 73 3a 20 61 0a 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 61 20 64 65 | o.integers:.a.numerator.and.a.de |
| 39ca0 | 6e 6f 6d 69 6e 61 74 6f 72 2e 20 20 54 68 65 6e 20 60 6d 61 6b 65 2d 72 61 74 27 2c 20 60 6e 75 | nominator...Then.`make-rat',.`nu |
| 39cc0 | 6d 65 72 27 2c 20 61 6e 64 20 60 64 65 6e 6f 6d 27 20 61 72 65 0a 72 65 61 64 69 6c 79 20 69 6d | mer',.and.`denom'.are.readily.im |
| 39ce0 | 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 28 32 29 0a 0a 20 20 20 20 20 28 | plemented.as.follows:(2).......( |
| 39d00 | 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 72 61 74 20 6e 20 64 29 20 28 63 6f 6e 73 20 6e 20 64 29 | define.(make-rat.n.d).(cons.n.d) |
| 39d20 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6e 75 6d 65 72 20 78 29 20 28 63 61 72 20 78 | ).......(define.(numer.x).(car.x |
| 39d40 | 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 6e 6f 6d 20 78 29 20 28 63 64 72 20 | )).......(define.(denom.x).(cdr. |
| 39d60 | 78 29 29 0a 0a 20 20 20 41 6c 73 6f 2c 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 64 69 73 70 6c 61 | x)).....Also,.in.order.to.displa |
| 39d80 | 79 20 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 20 6f 75 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e | y.the.results.of.our.computation |
| 39da0 | 73 2c 20 77 65 20 63 61 6e 0a 70 72 69 6e 74 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 | s,.we.can.print.rational.numbers |
| 39dc0 | 20 62 79 20 70 72 69 6e 74 69 6e 67 20 74 68 65 20 6e 75 6d 65 72 61 74 6f 72 2c 20 61 20 73 6c | .by.printing.the.numerator,.a.sl |
| 39de0 | 61 73 68 2c 20 61 6e 64 20 74 68 65 0a 64 65 6e 6f 6d 69 6e 61 74 6f 72 3a 28 33 29 0a 0a 20 20 | ash,.and.the.denominator:(3).... |
| 39e00 | 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 69 6e 74 2d 72 61 74 20 78 29 0a 20 20 20 20 20 20 20 | ...(define.(print-rat.x)........ |
| 39e20 | 28 6e 65 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 28 6e 75 6d 65 72 | (newline)........(display.(numer |
| 39e40 | 20 78 29 29 0a 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 22 2f 22 29 0a 20 20 20 20 20 20 | .x))........(display."/")....... |
| 39e60 | 20 28 64 69 73 70 6c 61 79 20 28 64 65 6e 6f 6d 20 78 29 29 29 0a 0a 20 20 20 4e 6f 77 20 77 65 | .(display.(denom.x))).....Now.we |
| 39e80 | 20 63 61 6e 20 74 72 79 20 6f 75 72 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 70 72 6f | .can.try.our.rational-number.pro |
| 39ea0 | 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6f 6e 65 2d 68 61 6c 66 20 | cedures:.......(define.one-half. |
| 39ec0 | 28 6d 61 6b 65 2d 72 61 74 20 31 20 32 29 29 0a 0a 20 20 20 20 20 28 70 72 69 6e 74 2d 72 61 74 | (make-rat.1.2)).......(print-rat |
| 39ee0 | 20 6f 6e 65 2d 68 61 6c 66 29 0a 20 20 20 20 20 31 2f 32 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | .one-half)......1/2.......(defin |
| 39f00 | 65 20 6f 6e 65 2d 74 68 69 72 64 20 28 6d 61 6b 65 2d 72 61 74 20 31 20 33 29 29 0a 0a 20 20 20 | e.one-third.(make-rat.1.3))..... |
| 39f20 | 20 20 28 70 72 69 6e 74 2d 72 61 74 20 28 61 64 64 2d 72 61 74 20 6f 6e 65 2d 68 61 6c 66 20 6f | ..(print-rat.(add-rat.one-half.o |
| 39f40 | 6e 65 2d 74 68 69 72 64 29 29 0a 20 20 20 20 20 35 2f 36 0a 0a 20 20 20 20 20 28 70 72 69 6e 74 | ne-third))......5/6.......(print |
| 39f60 | 2d 72 61 74 20 28 6d 75 6c 2d 72 61 74 20 6f 6e 65 2d 68 61 6c 66 20 6f 6e 65 2d 74 68 69 72 64 | -rat.(mul-rat.one-half.one-third |
| 39f80 | 29 29 0a 20 20 20 20 20 31 2f 36 0a 0a 20 20 20 20 20 28 70 72 69 6e 74 2d 72 61 74 20 28 61 64 | ))......1/6.......(print-rat.(ad |
| 39fa0 | 64 2d 72 61 74 20 6f 6e 65 2d 74 68 69 72 64 20 6f 6e 65 2d 74 68 69 72 64 29 29 0a 20 20 20 20 | d-rat.one-third.one-third))..... |
| 39fc0 | 20 36 2f 39 0a 0a 20 20 20 41 73 20 74 68 65 20 66 69 6e 61 6c 20 65 78 61 6d 70 6c 65 20 73 68 | .6/9.....As.the.final.example.sh |
| 39fe0 | 6f 77 73 2c 20 6f 75 72 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 69 6d 70 6c 65 6d 65 | ows,.our.rational-number.impleme |
| 3a000 | 6e 74 61 74 69 6f 6e 20 64 6f 65 73 0a 6e 6f 74 20 72 65 64 75 63 65 20 72 61 74 69 6f 6e 61 6c | ntation.does.not.reduce.rational |
| 3a020 | 20 6e 75 6d 62 65 72 73 20 74 6f 20 6c 6f 77 65 73 74 20 74 65 72 6d 73 2e 20 20 57 65 20 63 61 | .numbers.to.lowest.terms...We.ca |
| 3a040 | 6e 20 72 65 6d 65 64 79 20 74 68 69 73 20 62 79 0a 63 68 61 6e 67 69 6e 67 20 60 6d 61 6b 65 2d | n.remedy.this.by.changing.`make- |
| 3a060 | 72 61 74 27 2e 20 49 66 20 77 65 20 68 61 76 65 20 61 20 60 67 63 64 27 20 70 72 6f 63 65 64 75 | rat'..If.we.have.a.`gcd'.procedu |
| 3a080 | 72 65 20 6c 69 6b 65 20 74 68 65 20 6f 6e 65 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | re.like.the.one.in.section.*Note |
| 3a0a0 | 20 31 2d 32 2d 35 3a 3a 20 74 68 61 74 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 67 72 65 61 74 | .1-2-5::.that.produces.the.great |
| 3a0c0 | 65 73 74 20 63 6f 6d 6d 6f 6e 20 64 69 76 69 73 6f 72 20 6f 66 20 74 77 6f 0a 69 6e 74 65 67 65 | est.common.divisor.of.two.intege |
| 3a0e0 | 72 73 2c 20 77 65 20 63 61 6e 20 75 73 65 20 60 67 63 64 27 20 74 6f 20 72 65 64 75 63 65 20 74 | rs,.we.can.use.`gcd'.to.reduce.t |
| 3a100 | 68 65 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 74 68 65 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 | he.numerator.and.the.denominator |
| 3a120 | 0a 74 6f 20 6c 6f 77 65 73 74 20 74 65 72 6d 73 20 62 65 66 6f 72 65 20 63 6f 6e 73 74 72 75 63 | .to.lowest.terms.before.construc |
| 3a140 | 74 69 6e 67 20 74 68 65 20 70 61 69 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 | ting.the.pair:.......(define.(ma |
| 3a160 | 6b 65 2d 72 61 74 20 6e 20 64 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 67 20 28 67 63 64 | ke-rat.n.d)........(let.((g.(gcd |
| 3a180 | 20 6e 20 64 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 2f 20 6e 20 67 29 20 28 | .n.d)))..........(cons.(/.n.g).( |
| 3a1a0 | 2f 20 64 20 67 29 29 29 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 68 61 76 65 0a 0a 20 20 20 20 20 | /.d.g)))).....Now.we.have....... |
| 3a1c0 | 28 70 72 69 6e 74 2d 72 61 74 20 28 61 64 64 2d 72 61 74 20 6f 6e 65 2d 74 68 69 72 64 20 6f 6e | (print-rat.(add-rat.one-third.on |
| 3a1e0 | 65 2d 74 68 69 72 64 29 29 0a 20 20 20 20 20 32 2f 33 0a 0a 61 73 20 64 65 73 69 72 65 64 2e 20 | e-third))......2/3..as.desired.. |
| 3a200 | 20 54 68 69 73 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 77 61 73 20 61 63 63 6f 6d 70 6c 69 73 | .This.modification.was.accomplis |
| 3a220 | 68 65 64 20 62 79 20 63 68 61 6e 67 69 6e 67 20 74 68 65 0a 63 6f 6e 73 74 72 75 63 74 6f 72 20 | hed.by.changing.the.constructor. |
| 3a240 | 60 6d 61 6b 65 2d 72 61 74 27 20 77 69 74 68 6f 75 74 20 63 68 61 6e 67 69 6e 67 20 61 6e 79 20 | `make-rat'.without.changing.any. |
| 3a260 | 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 28 73 75 63 68 20 61 73 0a 60 61 64 64 2d | of.the.procedures.(such.as.`add- |
| 3a280 | 72 61 74 27 20 61 6e 64 20 60 6d 75 6c 2d 72 61 74 27 29 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 | rat'.and.`mul-rat').that.impleme |
| 3a2a0 | 6e 74 20 74 68 65 20 61 63 74 75 61 6c 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 | nt.the.actual.operations........ |
| 3a2c0 | 2a 45 78 65 72 63 69 73 65 20 32 2e 31 3a 2a 20 44 65 66 69 6e 65 20 61 20 62 65 74 74 65 72 20 | *Exercise.2.1:*.Define.a.better. |
| 3a2e0 | 76 65 72 73 69 6f 6e 20 6f 66 20 60 6d 61 6b 65 2d 72 61 74 27 20 74 68 61 74 20 68 61 6e 64 6c | version.of.`make-rat'.that.handl |
| 3a300 | 65 73 0a 20 20 20 20 20 62 6f 74 68 20 70 6f 73 69 74 69 76 65 20 61 6e 64 20 6e 65 67 61 74 69 | es......both.positive.and.negati |
| 3a320 | 76 65 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 60 4d 61 6b 65 2d 72 61 74 27 20 73 68 6f 75 6c 64 | ve.arguments...`Make-rat'.should |
| 3a340 | 20 6e 6f 72 6d 61 6c 69 7a 65 0a 20 20 20 20 20 74 68 65 20 73 69 67 6e 20 73 6f 20 74 68 61 74 | .normalize......the.sign.so.that |
| 3a360 | 20 69 66 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 69 73 20 70 6f 73 69 74 | .if.the.rational.number.is.posit |
| 3a380 | 69 76 65 2c 20 62 6f 74 68 20 74 68 65 0a 20 20 20 20 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 | ive,.both.the......numerator.and |
| 3a3a0 | 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 20 61 72 65 20 70 6f 73 69 74 69 76 65 2c 20 61 6e 64 20 69 | .denominator.are.positive,.and.i |
| 3a3c0 | 66 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 0a 20 20 20 20 20 69 73 20 6e 65 | f.the.rational.number......is.ne |
| 3a3e0 | 67 61 74 69 76 65 2c 20 6f 6e 6c 79 20 74 68 65 20 6e 75 6d 65 72 61 74 6f 72 20 69 73 20 6e 65 | gative,.only.the.numerator.is.ne |
| 3a400 | 67 61 74 69 76 65 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 | gative......----------.Footnotes |
| 3a420 | 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 65 20 6e 61 6d 65 20 60 63 6f | .----------.....(1).The.name.`co |
| 3a440 | 6e 73 27 20 73 74 61 6e 64 73 20 66 6f 72 20 22 63 6f 6e 73 74 72 75 63 74 2e 22 20 20 54 68 65 | ns'.stands.for."construct."..The |
| 3a460 | 20 6e 61 6d 65 73 20 60 63 61 72 27 20 61 6e 64 0a 60 63 64 72 27 20 64 65 72 69 76 65 20 66 72 | .names.`car'.and.`cdr'.derive.fr |
| 3a480 | 6f 6d 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f | om.the.original.implementation.o |
| 3a4a0 | 66 20 4c 69 73 70 20 6f 6e 20 74 68 65 20 49 42 4d 20 37 30 34 2e 0a 54 68 61 74 20 6d 61 63 68 | f.Lisp.on.the.IBM.704..That.mach |
| 3a4c0 | 69 6e 65 20 68 61 64 20 61 6e 20 61 64 64 72 65 73 73 69 6e 67 20 73 63 68 65 6d 65 20 74 68 61 | ine.had.an.addressing.scheme.tha |
| 3a4e0 | 74 20 61 6c 6c 6f 77 65 64 20 6f 6e 65 20 74 6f 20 72 65 66 65 72 65 6e 63 65 20 74 68 65 0a 22 | t.allowed.one.to.reference.the." |
| 3a500 | 61 64 64 72 65 73 73 22 20 61 6e 64 20 22 64 65 63 72 65 6d 65 6e 74 22 20 70 61 72 74 73 20 6f | address".and."decrement".parts.o |
| 3a520 | 66 20 61 20 6d 65 6d 6f 72 79 20 6c 6f 63 61 74 69 6f 6e 2e 20 20 60 43 61 72 27 20 73 74 61 6e | f.a.memory.location...`Car'.stan |
| 3a540 | 64 73 20 66 6f 72 0a 22 43 6f 6e 74 65 6e 74 73 20 6f 66 20 41 64 64 72 65 73 73 20 70 61 72 74 | ds.for."Contents.of.Address.part |
| 3a560 | 20 6f 66 20 52 65 67 69 73 74 65 72 22 20 61 6e 64 20 60 63 64 72 27 20 28 70 72 6f 6e 6f 75 6e | .of.Register".and.`cdr'.(pronoun |
| 3a580 | 63 65 64 0a 22 63 6f 75 6c 64 2d 65 72 22 29 20 73 74 61 6e 64 73 20 66 6f 72 20 22 43 6f 6e 74 | ced."could-er").stands.for."Cont |
| 3a5a0 | 65 6e 74 73 20 6f 66 20 44 65 63 72 65 6d 65 6e 74 20 70 61 72 74 20 6f 66 20 52 65 67 69 73 74 | ents.of.Decrement.part.of.Regist |
| 3a5c0 | 65 72 2e 22 0a 0a 20 20 20 28 32 29 20 41 6e 6f 74 68 65 72 20 77 61 79 20 74 6f 20 64 65 66 69 | er.".....(2).Another.way.to.defi |
| 3a5e0 | 6e 65 20 74 68 65 20 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 6f 72 | ne.the.selectors.and.constructor |
| 3a600 | 20 69 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6d 61 6b 65 2d 72 61 74 20 63 6f 6e 73 29 | .is.......(define.make-rat.cons) |
| 3a620 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6e 75 6d 65 72 20 63 61 72 29 0a 20 20 20 20 20 28 64 | ......(define.numer.car)......(d |
| 3a640 | 65 66 69 6e 65 20 64 65 6e 6f 6d 20 63 64 72 29 0a 0a 20 20 20 54 68 65 20 66 69 72 73 74 20 64 | efine.denom.cdr).....The.first.d |
| 3a660 | 65 66 69 6e 69 74 69 6f 6e 20 61 73 73 6f 63 69 61 74 65 73 20 74 68 65 20 6e 61 6d 65 20 60 6d | efinition.associates.the.name.`m |
| 3a680 | 61 6b 65 2d 72 61 74 27 20 77 69 74 68 20 74 68 65 20 76 61 6c 75 65 0a 6f 66 20 74 68 65 20 65 | ake-rat'.with.the.value.of.the.e |
| 3a6a0 | 78 70 72 65 73 73 69 6f 6e 20 60 63 6f 6e 73 27 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 70 | xpression.`cons',.which.is.the.p |
| 3a6c0 | 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 63 6f 6e 73 74 72 75 63 | rimitive.procedure.that.construc |
| 3a6e0 | 74 73 20 70 61 69 72 73 2e 20 20 54 68 75 73 20 60 6d 61 6b 65 2d 72 61 74 27 20 61 6e 64 20 60 | ts.pairs...Thus.`make-rat'.and.` |
| 3a700 | 63 6f 6e 73 27 20 61 72 65 20 6e 61 6d 65 73 20 66 6f 72 20 74 68 65 20 73 61 6d 65 0a 70 72 69 | cons'.are.names.for.the.same.pri |
| 3a720 | 6d 69 74 69 76 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 2e 0a 0a 20 20 20 44 65 66 69 6e 69 6e 67 | mitive.constructor......Defining |
| 3a740 | 20 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 69 6e 20 74 | .selectors.and.constructors.in.t |
| 3a760 | 68 69 73 20 77 61 79 20 69 73 20 65 66 66 69 63 69 65 6e 74 3a 0a 49 6e 73 74 65 61 64 20 6f 66 | his.way.is.efficient:.Instead.of |
| 3a780 | 20 60 6d 61 6b 65 2d 72 61 74 27 20 5f 63 61 6c 6c 69 6e 67 5f 20 60 63 6f 6e 73 27 2c 20 60 6d | .`make-rat'._calling_.`cons',.`m |
| 3a7a0 | 61 6b 65 2d 72 61 74 27 20 5f 69 73 5f 20 60 63 6f 6e 73 27 2c 20 73 6f 0a 74 68 65 72 65 20 69 | ake-rat'._is_.`cons',.so.there.i |
| 3a7c0 | 73 20 6f 6e 6c 79 20 6f 6e 65 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 65 64 2c 20 6e 6f 74 | s.only.one.procedure.called,.not |
| 3a7e0 | 20 74 77 6f 2c 20 77 68 65 6e 20 60 6d 61 6b 65 2d 72 61 74 27 20 69 73 20 63 61 6c 6c 65 64 2e | .two,.when.`make-rat'.is.called. |
| 3a800 | 0a 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 64 6f 69 6e 67 20 74 68 69 73 20 64 | .On.the.other.hand,.doing.this.d |
| 3a820 | 65 66 65 61 74 73 20 64 65 62 75 67 67 69 6e 67 20 61 69 64 73 20 74 68 61 74 20 74 72 61 63 65 | efeats.debugging.aids.that.trace |
| 3a840 | 0a 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 73 20 6f 72 20 70 75 74 20 62 72 65 61 6b 70 6f 69 | .procedure.calls.or.put.breakpoi |
| 3a860 | 6e 74 73 20 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 73 3a 20 59 6f 75 20 6d 61 79 20 | nts.on.procedure.calls:.You.may. |
| 3a880 | 77 61 6e 74 20 74 6f 0a 77 61 74 63 68 20 60 6d 61 6b 65 2d 72 61 74 27 20 62 65 69 6e 67 20 63 | want.to.watch.`make-rat'.being.c |
| 3a8a0 | 61 6c 6c 65 64 2c 20 62 75 74 20 79 6f 75 20 63 65 72 74 61 69 6e 6c 79 20 64 6f 6e 27 74 20 77 | alled,.but.you.certainly.don't.w |
| 3a8c0 | 61 6e 74 20 74 6f 20 77 61 74 63 68 0a 65 76 65 72 79 20 63 61 6c 6c 20 74 6f 20 60 63 6f 6e 73 | ant.to.watch.every.call.to.`cons |
| 3a8e0 | 27 2e 0a 0a 20 20 20 57 65 20 68 61 76 65 20 63 68 6f 73 65 6e 20 6e 6f 74 20 74 6f 20 75 73 65 | '......We.have.chosen.not.to.use |
| 3a900 | 20 74 68 69 73 20 73 74 79 6c 65 20 6f 66 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 6e 20 74 68 69 | .this.style.of.definition.in.thi |
| 3a920 | 73 20 62 6f 6f 6b 2e 0a 0a 20 20 20 28 33 29 20 60 44 69 73 70 6c 61 79 27 20 69 73 20 74 68 65 | s.book......(3).`Display'.is.the |
| 3a940 | 20 53 63 68 65 6d 65 20 70 72 69 6d 69 74 69 76 65 20 66 6f 72 20 70 72 69 6e 74 69 6e 67 20 64 | .Scheme.primitive.for.printing.d |
| 3a960 | 61 74 61 2e 20 20 54 68 65 20 53 63 68 65 6d 65 0a 70 72 69 6d 69 74 69 76 65 20 60 6e 65 77 6c | ata...The.Scheme.primitive.`newl |
| 3a980 | 69 6e 65 27 20 73 74 61 72 74 73 20 61 20 6e 65 77 20 6c 69 6e 65 20 66 6f 72 20 70 72 69 6e 74 | ine'.starts.a.new.line.for.print |
| 3a9a0 | 69 6e 67 2e 20 20 4e 65 69 74 68 65 72 20 6f 66 20 74 68 65 73 65 0a 70 72 6f 63 65 64 75 72 65 | ing...Neither.of.these.procedure |
| 3a9c0 | 73 20 72 65 74 75 72 6e 73 20 61 20 75 73 65 66 75 6c 20 76 61 6c 75 65 2c 20 73 6f 20 69 6e 20 | s.returns.a.useful.value,.so.in. |
| 3a9e0 | 74 68 65 20 75 73 65 73 20 6f 66 20 60 70 72 69 6e 74 2d 72 61 74 27 20 62 65 6c 6f 77 2c 0a 77 | the.uses.of.`print-rat'.below,.w |
| 3aa00 | 65 20 73 68 6f 77 20 6f 6e 6c 79 20 77 68 61 74 20 60 70 72 69 6e 74 2d 72 61 74 27 20 70 72 69 | e.show.only.what.`print-rat'.pri |
| 3aa20 | 6e 74 73 2c 20 6e 6f 74 20 77 68 61 74 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 70 72 | nts,.not.what.the.interpreter.pr |
| 3aa40 | 69 6e 74 73 0a 61 73 20 74 68 65 20 76 61 6c 75 65 20 72 65 74 75 72 6e 65 64 20 62 79 20 60 70 | ints.as.the.value.returned.by.`p |
| 3aa60 | 72 69 6e 74 2d 72 61 74 27 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 | rint-rat'.....File:.sicp.info,.. |
| 3aa80 | 4e 6f 64 65 3a 20 32 2d 31 2d 32 2c 20 20 4e 65 78 74 3a 20 32 2d 31 2d 33 2c 20 20 50 72 65 76 | Node:.2-1-2,..Next:.2-1-3,..Prev |
| 3aaa0 | 3a 20 32 2d 31 2d 31 2c 20 20 55 70 3a 20 32 2d 31 0a 0a 32 2e 31 2e 32 20 41 62 73 74 72 61 63 | :.2-1-1,..Up:.2-1..2.1.2.Abstrac |
| 3aac0 | 74 69 6f 6e 20 42 61 72 72 69 65 72 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | tion.Barriers.------------------ |
| 3aae0 | 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 42 65 66 6f 72 65 20 63 6f 6e 74 69 6e 75 69 6e 67 20 77 69 74 68 | --------..Before.continuing.with |
| 3ab00 | 20 6d 6f 72 65 20 65 78 61 6d 70 6c 65 73 20 6f 66 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 | .more.examples.of.compound.data. |
| 3ab20 | 61 6e 64 20 64 61 74 61 0a 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 6c 65 74 20 75 73 20 63 6f 6e | and.data.abstraction,.let.us.con |
| 3ab40 | 73 69 64 65 72 20 73 6f 6d 65 20 6f 66 20 74 68 65 20 69 73 73 75 65 73 20 72 61 69 73 65 64 20 | sider.some.of.the.issues.raised. |
| 3ab60 | 62 79 20 74 68 65 0a 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 65 78 61 6d 70 6c 65 2e 20 | by.the.rational-number.example.. |
| 3ab80 | 20 57 65 20 64 65 66 69 6e 65 64 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 | .We.defined.the.rational-number. |
| 3aba0 | 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 0a 74 65 72 6d 73 20 6f 66 20 61 20 63 6f 6e 73 74 72 75 | operations.in.terms.of.a.constru |
| 3abc0 | 63 74 6f 72 20 60 6d 61 6b 65 2d 72 61 74 27 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 73 20 60 6e | ctor.`make-rat'.and.selectors.`n |
| 3abe0 | 75 6d 65 72 27 20 61 6e 64 20 60 64 65 6e 6f 6d 27 2e 0a 49 6e 20 67 65 6e 65 72 61 6c 2c 20 74 | umer'.and.`denom'..In.general,.t |
| 3ac00 | 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 69 64 65 61 20 6f 66 20 64 61 74 61 20 61 62 73 74 72 | he.underlying.idea.of.data.abstr |
| 3ac20 | 61 63 74 69 6f 6e 20 69 73 20 74 6f 20 69 64 65 6e 74 69 66 79 20 66 6f 72 0a 65 61 63 68 20 74 | action.is.to.identify.for.each.t |
| 3ac40 | 79 70 65 20 6f 66 20 64 61 74 61 20 6f 62 6a 65 63 74 20 61 20 62 61 73 69 63 20 73 65 74 20 6f | ype.of.data.object.a.basic.set.o |
| 3ac60 | 66 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 77 68 69 63 68 0a 61 | f.operations.in.terms.of.which.a |
| 3ac80 | 6c 6c 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 73 20 6f 66 20 64 61 74 61 20 6f 62 6a 65 63 74 73 | ll.manipulations.of.data.objects |
| 3aca0 | 20 6f 66 20 74 68 61 74 20 74 79 70 65 20 77 69 6c 6c 20 62 65 20 65 78 70 72 65 73 73 65 64 2c | .of.that.type.will.be.expressed, |
| 3acc0 | 20 61 6e 64 0a 74 68 65 6e 20 74 6f 20 75 73 65 20 6f 6e 6c 79 20 74 68 6f 73 65 20 6f 70 65 72 | .and.then.to.use.only.those.oper |
| 3ace0 | 61 74 69 6f 6e 73 20 69 6e 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 74 68 65 20 64 61 74 61 2e | ations.in.manipulating.the.data. |
| 3ad00 | 0a 0a 20 20 20 57 65 20 63 61 6e 20 65 6e 76 69 73 69 6f 6e 20 74 68 65 20 73 74 72 75 63 74 75 | .....We.can.envision.the.structu |
| 3ad20 | 72 65 20 6f 66 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 73 79 73 74 65 6d | re.of.the.rational-number.system |
| 3ad40 | 20 61 73 20 73 68 6f 77 6e 0a 69 6e 20 66 69 67 75 72 65 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 | .as.shown.in.figure.*Note.Figure |
| 3ad60 | 20 32 2d 31 3a 3a 2e 20 20 54 68 65 20 68 6f 72 69 7a 6f 6e 74 61 6c 20 6c 69 6e 65 73 20 72 65 | .2-1::...The.horizontal.lines.re |
| 3ad80 | 70 72 65 73 65 6e 74 20 62 61 72 72 69 65 72 73 0a 22 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 | present.barriers."abstraction.ba |
| 3ada0 | 72 72 69 65 72 73 22 20 74 68 61 74 20 69 73 6f 6c 61 74 65 20 64 69 66 66 65 72 65 6e 74 20 22 | rriers".that.isolate.different." |
| 3adc0 | 6c 65 76 65 6c 73 22 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 2e 0a 41 74 20 65 61 63 68 20 6c | levels".of.the.system..At.each.l |
| 3ade0 | 65 76 65 6c 2c 20 74 68 65 20 62 61 72 72 69 65 72 20 73 65 70 61 72 61 74 65 73 20 74 68 65 20 | evel,.the.barrier.separates.the. |
| 3ae00 | 70 72 6f 67 72 61 6d 73 20 28 61 62 6f 76 65 29 20 74 68 61 74 20 75 73 65 20 74 68 65 0a 64 61 | programs.(above).that.use.the.da |
| 3ae20 | 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 70 72 6f 67 72 61 6d 73 | ta.abstraction.from.the.programs |
| 3ae40 | 20 28 62 65 6c 6f 77 29 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 64 61 74 61 | .(below).that.implement.the.data |
| 3ae60 | 0a 61 62 73 74 72 61 63 74 69 6f 6e 2e 20 20 50 72 6f 67 72 61 6d 73 20 74 68 61 74 20 75 73 65 | .abstraction...Programs.that.use |
| 3ae80 | 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 68 65 | .rational.numbers.manipulate.the |
| 3aea0 | 6d 20 73 6f 6c 65 6c 79 0a 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 | m.solely.in.terms.of.the.procedu |
| 3aec0 | 72 65 73 20 73 75 70 70 6c 69 65 64 20 22 66 6f 72 20 70 75 62 6c 69 63 20 75 73 65 22 20 62 79 | res.supplied."for.public.use".by |
| 3aee0 | 20 74 68 65 0a 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 70 61 63 6b 61 67 65 3a 20 60 61 | .the.rational-number.package:.`a |
| 3af00 | 64 64 2d 72 61 74 27 2c 20 60 73 75 62 2d 72 61 74 27 2c 20 60 6d 75 6c 2d 72 61 74 27 2c 20 60 | dd-rat',.`sub-rat',.`mul-rat',.` |
| 3af20 | 64 69 76 2d 72 61 74 27 2c 0a 61 6e 64 20 60 65 71 75 61 6c 2d 72 61 74 3f 27 2e 20 54 68 65 73 | div-rat',.and.`equal-rat?'..Thes |
| 3af40 | 65 2c 20 69 6e 20 74 75 72 6e 2c 20 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 73 6f 6c 65 | e,.in.turn,.are.implemented.sole |
| 3af60 | 6c 79 20 69 6e 20 74 65 72 6d 73 20 6f 66 0a 74 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 61 | ly.in.terms.of.the.constructor.a |
| 3af80 | 6e 64 20 73 65 6c 65 63 74 6f 72 73 20 60 6d 61 6b 65 2d 72 61 74 27 2c 20 60 6e 75 6d 65 72 27 | nd.selectors.`make-rat',.`numer' |
| 3afa0 | 2c 20 61 6e 64 20 60 64 65 6e 6f 6d 27 2c 20 77 68 69 63 68 0a 74 68 65 6d 73 65 6c 76 65 73 20 | ,.and.`denom',.which.themselves. |
| 3afc0 | 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 70 61 69 72 | are.implemented.in.terms.of.pair |
| 3afe0 | 73 2e 20 20 54 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 68 6f 77 20 70 61 69 72 73 0a 61 72 65 | s...The.details.of.how.pairs.are |
| 3b000 | 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 72 65 20 69 72 72 65 6c 65 76 61 6e 74 20 74 6f 20 74 | .implemented.are.irrelevant.to.t |
| 3b020 | 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 0a 70 | he.rest.of.the.rational-number.p |
| 3b040 | 61 63 6b 61 67 65 20 73 6f 20 6c 6f 6e 67 20 61 73 20 70 61 69 72 73 20 63 61 6e 20 62 65 20 6d | ackage.so.long.as.pairs.can.be.m |
| 3b060 | 61 6e 69 70 75 6c 61 74 65 64 20 62 79 20 74 68 65 20 75 73 65 20 6f 66 20 60 63 6f 6e 73 27 2c | anipulated.by.the.use.of.`cons', |
| 3b080 | 0a 60 63 61 72 27 2c 20 61 6e 64 20 60 63 64 72 27 2e 20 20 49 6e 20 65 66 66 65 63 74 2c 20 70 | .`car',.and.`cdr'...In.effect,.p |
| 3b0a0 | 72 6f 63 65 64 75 72 65 73 20 61 74 20 65 61 63 68 20 6c 65 76 65 6c 20 61 72 65 20 74 68 65 0a | rocedures.at.each.level.are.the. |
| 3b0c0 | 69 6e 74 65 72 66 61 63 65 73 20 74 68 61 74 20 64 65 66 69 6e 65 20 74 68 65 20 61 62 73 74 72 | interfaces.that.define.the.abstr |
| 3b0e0 | 61 63 74 69 6f 6e 20 62 61 72 72 69 65 72 73 20 61 6e 64 20 63 6f 6e 6e 65 63 74 20 74 68 65 0a | action.barriers.and.connect.the. |
| 3b100 | 64 69 66 66 65 72 65 6e 74 20 6c 65 76 65 6c 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 | different.levels........*Figure. |
| 3b120 | 32 2e 31 3a 2a 20 44 61 74 61 2d 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 72 72 69 65 72 73 20 | 2.1:*.Data-abstraction.barriers. |
| 3b140 | 69 6e 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 0a 20 20 20 20 20 70 61 63 6b | in.the.rational-number......pack |
| 3b160 | 61 67 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d | age.....................+------- |
| 3b180 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 | -----------------------------+.. |
| 3b1a0 | 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 7c 20 50 72 6f 67 72 61 6d 73 20 74 68 61 74 | .........--------|.Programs.that |
| 3b1c0 | 20 75 73 65 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 7c 2d 2d 2d 2d 2d 2d 2d 2d 0a | .use.rational.numbers.|--------. |
| 3b1e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..................+------------- |
| 3b200 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 | -----------------------+........ |
| 3b220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 52 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 69 6e | .............Rational.numbers.in |
| 3b240 | 20 70 72 6f 6d 62 6c 65 6d 20 64 6f 6d 61 69 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .promblem.domain................ |
| 3b260 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .......+------------------------ |
| 3b280 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c 20 20 20 61 | ---+...........------------|...a |
| 3b2a0 | 64 64 2d 72 61 74 20 20 73 75 62 2d 72 61 74 20 20 2e 2e 2e 20 20 20 7c 2d 2d 2d 2d 2d 2d 2d 2d | dd-rat..sub-rat........|-------- |
| 3b2c0 | 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | -----.......................+--- |
| 3b2e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 | ------------------------+....... |
| 3b300 | 20 20 20 20 20 20 20 52 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 61 73 20 6e 75 6d 65 72 | .......Rational.numbers.as.numer |
| 3b320 | 61 74 6f 72 73 20 61 6e 64 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 73 0a 20 20 20 20 20 20 20 20 20 | ators.and.denominators.......... |
| 3b340 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ...............+---------------- |
| 3b360 | 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | --------+...........------------ |
| 3b380 | 2d 2d 7c 20 6d 61 6b 65 2d 72 61 74 20 20 6e 75 6d 65 72 20 20 64 65 6e 6f 6d 20 7c 2d 2d 2d 2d | --|.make-rat..numer..denom.|---- |
| 3b3a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ----------...................... |
| 3b3c0 | 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 | ...+------------------------+... |
| 3b3e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 52 61 74 69 6f 6e 61 6c 20 6e | ......................Rational.n |
| 3b400 | 75 6d 62 65 72 73 20 61 73 20 70 61 69 72 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | umbers.as.pairs................. |
| 3b420 | 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 | ............+----------------+.. |
| 3b440 | 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c 20 63 6f 6e | .........------------------|.con |
| 3b460 | 73 20 20 63 61 72 20 20 63 64 72 20 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a | s..car..cdr.|------------------. |
| 3b480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | ............................+--- |
| 3b4a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -------------+.................. |
| 3b4c0 | 20 20 20 20 20 48 6f 77 65 76 65 72 20 70 61 69 72 73 20 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 | .....However.pairs.are.implement |
| 3b4e0 | 65 64 0a 0a 20 20 20 54 68 69 73 20 73 69 6d 70 6c 65 20 69 64 65 61 20 68 61 73 20 6d 61 6e 79 | ed.....This.simple.idea.has.many |
| 3b500 | 20 61 64 76 61 6e 74 61 67 65 73 2e 20 20 4f 6e 65 20 61 64 76 61 6e 74 61 67 65 20 69 73 20 74 | .advantages...One.advantage.is.t |
| 3b520 | 68 61 74 20 69 74 0a 6d 61 6b 65 73 20 70 72 6f 67 72 61 6d 73 20 6d 75 63 68 20 65 61 73 69 65 | hat.it.makes.programs.much.easie |
| 3b540 | 72 20 74 6f 20 6d 61 69 6e 74 61 69 6e 20 61 6e 64 20 74 6f 20 6d 6f 64 69 66 79 2e 20 20 41 6e | r.to.maintain.and.to.modify...An |
| 3b560 | 79 20 63 6f 6d 70 6c 65 78 20 64 61 74 61 0a 73 74 72 75 63 74 75 72 65 20 63 61 6e 20 62 65 20 | y.complex.data.structure.can.be. |
| 3b580 | 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 61 20 76 61 72 69 65 74 79 20 6f 66 20 77 61 79 73 | represented.in.a.variety.of.ways |
| 3b5a0 | 20 77 69 74 68 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 0a 64 61 74 61 20 73 74 72 75 63 74 75 | .with.the.primitive.data.structu |
| 3b5c0 | 72 65 73 20 70 72 6f 76 69 64 65 64 20 62 79 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 | res.provided.by.a.programming.la |
| 3b5e0 | 6e 67 75 61 67 65 2e 20 20 4f 66 20 63 6f 75 72 73 65 2c 20 74 68 65 0a 63 68 6f 69 63 65 20 6f | nguage...Of.course,.the.choice.o |
| 3b600 | 66 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 6e 66 6c 75 65 6e 63 65 73 20 74 68 65 20 | f.representation.influences.the. |
| 3b620 | 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 6f 70 65 72 61 74 65 20 6f 6e 20 69 74 3b 0a 74 68 75 | programs.that.operate.on.it;.thu |
| 3b640 | 73 2c 20 69 66 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 77 65 72 65 20 74 6f | s,.if.the.representation.were.to |
| 3b660 | 20 62 65 20 63 68 61 6e 67 65 64 20 61 74 20 73 6f 6d 65 20 6c 61 74 65 72 20 74 69 6d 65 2c 20 | .be.changed.at.some.later.time,. |
| 3b680 | 61 6c 6c 0a 73 75 63 68 20 70 72 6f 67 72 61 6d 73 20 6d 69 67 68 74 20 68 61 76 65 20 74 6f 20 | all.such.programs.might.have.to. |
| 3b6a0 | 62 65 20 6d 6f 64 69 66 69 65 64 20 61 63 63 6f 72 64 69 6e 67 6c 79 2e 20 20 54 68 69 73 20 74 | be.modified.accordingly...This.t |
| 3b6c0 | 61 73 6b 20 63 6f 75 6c 64 0a 62 65 20 74 69 6d 65 2d 63 6f 6e 73 75 6d 69 6e 67 20 61 6e 64 20 | ask.could.be.time-consuming.and. |
| 3b6e0 | 65 78 70 65 6e 73 69 76 65 20 69 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 6c 61 72 67 65 20 70 | expensive.in.the.case.of.large.p |
| 3b700 | 72 6f 67 72 61 6d 73 20 75 6e 6c 65 73 73 0a 74 68 65 20 64 65 70 65 6e 64 65 6e 63 65 20 6f 6e | rograms.unless.the.dependence.on |
| 3b720 | 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 77 65 72 65 20 74 6f 20 62 65 20 63 | .the.representation.were.to.be.c |
| 3b740 | 6f 6e 66 69 6e 65 64 20 62 79 20 64 65 73 69 67 6e 20 74 6f 20 61 0a 76 65 72 79 20 66 65 77 20 | onfined.by.design.to.a.very.few. |
| 3b760 | 70 72 6f 67 72 61 6d 20 6d 6f 64 75 6c 65 73 2e 0a 0a 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 | program.modules......For.example |
| 3b780 | 2c 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 20 77 61 79 20 74 6f 20 61 64 64 72 65 73 73 20 74 68 | ,.an.alternate.way.to.address.th |
| 3b7a0 | 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 72 65 64 75 63 69 6e 67 0a 72 61 74 69 6f 6e 61 6c 20 6e | e.problem.of.reducing.rational.n |
| 3b7c0 | 75 6d 62 65 72 73 20 74 6f 20 6c 6f 77 65 73 74 20 74 65 72 6d 73 20 69 73 20 74 6f 20 70 65 72 | umbers.to.lowest.terms.is.to.per |
| 3b7e0 | 66 6f 72 6d 20 74 68 65 20 72 65 64 75 63 74 69 6f 6e 20 77 68 65 6e 65 76 65 72 0a 77 65 20 61 | form.the.reduction.whenever.we.a |
| 3b800 | 63 63 65 73 73 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 61 20 72 61 74 69 6f 6e 61 6c 20 6e 75 | ccess.the.parts.of.a.rational.nu |
| 3b820 | 6d 62 65 72 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 77 68 65 6e 20 77 65 20 63 6f 6e 73 74 72 | mber,.rather.than.when.we.constr |
| 3b840 | 75 63 74 0a 69 74 2e 20 20 54 68 69 73 20 6c 65 61 64 73 20 74 6f 20 64 69 66 66 65 72 65 6e 74 | uct.it...This.leads.to.different |
| 3b860 | 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 20 70 72 6f 63 65 64 | .constructor.and.selector.proced |
| 3b880 | 75 72 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 72 61 74 20 6e 20 | ures:.......(define.(make-rat.n. |
| 3b8a0 | 64 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 20 6e 20 64 29 29 0a 0a 20 20 20 20 20 28 64 65 66 | d)........(cons.n.d)).......(def |
| 3b8c0 | 69 6e 65 20 28 6e 75 6d 65 72 20 78 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 67 20 28 67 | ine.(numer.x)........(let.((g.(g |
| 3b8e0 | 63 64 20 28 63 61 72 20 78 29 20 28 63 64 72 20 78 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 | cd.(car.x).(cdr.x))))..........( |
| 3b900 | 2f 20 28 63 61 72 20 78 29 20 67 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 | /.(car.x).g))).......(define.(de |
| 3b920 | 6e 6f 6d 20 78 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 67 20 28 67 63 64 20 28 63 61 72 | nom.x)........(let.((g.(gcd.(car |
| 3b940 | 20 78 29 20 28 63 64 72 20 78 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 2f 20 28 63 64 72 20 | .x).(cdr.x))))..........(/.(cdr. |
| 3b960 | 78 29 20 67 29 29 29 0a 0a 20 20 20 54 68 65 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 | x).g))).....The.difference.betwe |
| 3b980 | 65 6e 20 74 68 69 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 61 6e 64 20 74 68 65 20 70 | en.this.implementation.and.the.p |
| 3b9a0 | 72 65 76 69 6f 75 73 20 6f 6e 65 20 6c 69 65 73 0a 69 6e 20 77 68 65 6e 20 77 65 20 63 6f 6d 70 | revious.one.lies.in.when.we.comp |
| 3b9c0 | 75 74 65 20 74 68 65 20 60 67 63 64 27 2e 20 20 49 66 20 69 6e 20 6f 75 72 20 74 79 70 69 63 61 | ute.the.`gcd'...If.in.our.typica |
| 3b9e0 | 6c 20 75 73 65 20 6f 66 20 72 61 74 69 6f 6e 61 6c 0a 6e 75 6d 62 65 72 73 20 77 65 20 61 63 63 | l.use.of.rational.numbers.we.acc |
| 3ba00 | 65 73 73 20 74 68 65 20 6e 75 6d 65 72 61 74 6f 72 73 20 61 6e 64 20 64 65 6e 6f 6d 69 6e 61 74 | ess.the.numerators.and.denominat |
| 3ba20 | 6f 72 73 20 6f 66 20 74 68 65 20 73 61 6d 65 20 72 61 74 69 6f 6e 61 6c 0a 6e 75 6d 62 65 72 73 | ors.of.the.same.rational.numbers |
| 3ba40 | 20 6d 61 6e 79 20 74 69 6d 65 73 2c 20 69 74 20 77 6f 75 6c 64 20 62 65 20 70 72 65 66 65 72 61 | .many.times,.it.would.be.prefera |
| 3ba60 | 62 6c 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 60 67 63 64 27 20 77 68 65 6e 0a 74 68 | ble.to.compute.the.`gcd'.when.th |
| 3ba80 | 65 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 61 72 65 20 63 6f 6e 73 74 72 75 63 74 | e.rational.numbers.are.construct |
| 3baa0 | 65 64 2e 20 20 49 66 20 6e 6f 74 2c 20 77 65 20 6d 61 79 20 62 65 20 62 65 74 74 65 72 20 6f 66 | ed...If.not,.we.may.be.better.of |
| 3bac0 | 66 0a 77 61 69 74 69 6e 67 20 75 6e 74 69 6c 20 61 63 63 65 73 73 20 74 69 6d 65 20 74 6f 20 63 | f.waiting.until.access.time.to.c |
| 3bae0 | 6f 6d 70 75 74 65 20 74 68 65 20 60 67 63 64 27 2e 20 20 49 6e 20 61 6e 79 20 63 61 73 65 2c 20 | ompute.the.`gcd'...In.any.case,. |
| 3bb00 | 77 68 65 6e 20 77 65 0a 63 68 61 6e 67 65 20 66 72 6f 6d 20 6f 6e 65 20 72 65 70 72 65 73 65 6e | when.we.change.from.one.represen |
| 3bb20 | 74 61 74 69 6f 6e 20 74 6f 20 74 68 65 20 6f 74 68 65 72 2c 20 74 68 65 20 70 72 6f 63 65 64 75 | tation.to.the.other,.the.procedu |
| 3bb40 | 72 65 73 20 60 61 64 64 2d 72 61 74 27 2c 0a 60 73 75 62 2d 72 61 74 27 2c 20 61 6e 64 20 73 6f | res.`add-rat',.`sub-rat',.and.so |
| 3bb60 | 20 6f 6e 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 74 6f 20 62 65 20 6d 6f 64 69 66 69 65 64 20 61 | .on.do.not.have.to.be.modified.a |
| 3bb80 | 74 20 61 6c 6c 2e 0a 0a 20 20 20 43 6f 6e 73 74 72 61 69 6e 69 6e 67 20 74 68 65 20 64 65 70 65 | t.all......Constraining.the.depe |
| 3bba0 | 6e 64 65 6e 63 65 20 6f 6e 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 74 6f 20 | ndence.on.the.representation.to. |
| 3bbc0 | 61 20 66 65 77 20 69 6e 74 65 72 66 61 63 65 0a 70 72 6f 63 65 64 75 72 65 73 20 68 65 6c 70 73 | a.few.interface.procedures.helps |
| 3bbe0 | 20 75 73 20 64 65 73 69 67 6e 20 70 72 6f 67 72 61 6d 73 20 61 73 20 77 65 6c 6c 20 61 73 20 6d | .us.design.programs.as.well.as.m |
| 3bc00 | 6f 64 69 66 79 20 74 68 65 6d 2c 20 62 65 63 61 75 73 65 20 69 74 0a 61 6c 6c 6f 77 73 20 75 73 | odify.them,.because.it.allows.us |
| 3bc20 | 20 74 6f 20 6d 61 69 6e 74 61 69 6e 20 74 68 65 20 66 6c 65 78 69 62 69 6c 69 74 79 20 74 6f 20 | .to.maintain.the.flexibility.to. |
| 3bc40 | 63 6f 6e 73 69 64 65 72 20 61 6c 74 65 72 6e 61 74 65 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | consider.alternate.implementatio |
| 3bc60 | 6e 73 2e 20 20 54 6f 20 63 6f 6e 74 69 6e 75 65 20 77 69 74 68 20 6f 75 72 20 73 69 6d 70 6c 65 | ns...To.continue.with.our.simple |
| 3bc80 | 20 65 78 61 6d 70 6c 65 2c 20 73 75 70 70 6f 73 65 20 77 65 20 61 72 65 0a 64 65 73 69 67 6e 69 | .example,.suppose.we.are.designi |
| 3bca0 | 6e 67 20 61 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 70 61 63 6b 61 67 65 20 61 6e 64 | ng.a.rational-number.package.and |
| 3bcc0 | 20 77 65 20 63 61 6e 27 74 20 64 65 63 69 64 65 20 69 6e 69 74 69 61 6c 6c 79 0a 77 68 65 74 68 | .we.can't.decide.initially.wheth |
| 3bce0 | 65 72 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 20 60 67 63 64 27 20 61 74 20 63 6f 6e 73 74 | er.to.perform.the.`gcd'.at.const |
| 3bd00 | 72 75 63 74 69 6f 6e 20 74 69 6d 65 20 6f 72 20 61 74 20 73 65 6c 65 63 74 69 6f 6e 20 74 69 6d | ruction.time.or.at.selection.tim |
| 3bd20 | 65 2e 0a 54 68 65 20 64 61 74 61 2d 61 62 73 74 72 61 63 74 69 6f 6e 20 6d 65 74 68 6f 64 6f 6c | e..The.data-abstraction.methodol |
| 3bd40 | 6f 67 79 20 67 69 76 65 73 20 75 73 20 61 20 77 61 79 20 74 6f 20 64 65 66 65 72 20 74 68 61 74 | ogy.gives.us.a.way.to.defer.that |
| 3bd60 | 20 64 65 63 69 73 69 6f 6e 0a 77 69 74 68 6f 75 74 20 6c 6f 73 69 6e 67 20 74 68 65 20 61 62 69 | .decision.without.losing.the.abi |
| 3bd80 | 6c 69 74 79 20 74 6f 20 6d 61 6b 65 20 70 72 6f 67 72 65 73 73 20 6f 6e 20 74 68 65 20 72 65 73 | lity.to.make.progress.on.the.res |
| 3bda0 | 74 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | t.of.the.system........*Exercise |
| 3bdc0 | 20 32 2e 32 3a 2a 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 72 | .2.2:*.Consider.the.problem.of.r |
| 3bde0 | 65 70 72 65 73 65 6e 74 69 6e 67 20 6c 69 6e 65 20 73 65 67 6d 65 6e 74 73 0a 20 20 20 20 20 69 | epresenting.line.segments......i |
| 3be00 | 6e 20 61 20 70 6c 61 6e 65 2e 20 20 45 61 63 68 20 73 65 67 6d 65 6e 74 20 69 73 20 72 65 70 72 | n.a.plane...Each.segment.is.repr |
| 3be20 | 65 73 65 6e 74 65 64 20 61 73 20 61 20 70 61 69 72 20 6f 66 20 70 6f 69 6e 74 73 3a 20 61 0a 20 | esented.as.a.pair.of.points:.a.. |
| 3be40 | 20 20 20 20 73 74 61 72 74 69 6e 67 20 70 6f 69 6e 74 20 61 6e 64 20 61 6e 20 65 6e 64 69 6e 67 | ....starting.point.and.an.ending |
| 3be60 | 20 70 6f 69 6e 74 2e 20 20 44 65 66 69 6e 65 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 0a 20 20 | .point...Define.a.constructor... |
| 3be80 | 20 20 20 60 6d 61 6b 65 2d 73 65 67 6d 65 6e 74 27 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 73 20 | ...`make-segment'.and.selectors. |
| 3bea0 | 60 73 74 61 72 74 2d 73 65 67 6d 65 6e 74 27 20 61 6e 64 20 60 65 6e 64 2d 73 65 67 6d 65 6e 74 | `start-segment'.and.`end-segment |
| 3bec0 | 27 0a 20 20 20 20 20 74 68 61 74 20 64 65 66 69 6e 65 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 | '......that.define.the.represent |
| 3bee0 | 61 74 69 6f 6e 20 6f 66 20 73 65 67 6d 65 6e 74 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 70 6f | ation.of.segments.in.terms.of.po |
| 3bf00 | 69 6e 74 73 2e 0a 20 20 20 20 20 46 75 72 74 68 65 72 6d 6f 72 65 2c 20 61 20 70 6f 69 6e 74 20 | ints.......Furthermore,.a.point. |
| 3bf20 | 63 61 6e 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 70 61 69 72 20 6f 66 20 | can.be.represented.as.a.pair.of. |
| 3bf40 | 6e 75 6d 62 65 72 73 3a 20 74 68 65 0a 20 20 20 20 20 78 20 63 6f 6f 72 64 69 6e 61 74 65 20 61 | numbers:.the......x.coordinate.a |
| 3bf60 | 6e 64 20 74 68 65 20 79 20 63 6f 6f 72 64 69 6e 61 74 65 2e 20 20 41 63 63 6f 72 64 69 6e 67 6c | nd.the.y.coordinate...Accordingl |
| 3bf80 | 79 2c 20 73 70 65 63 69 66 79 20 61 0a 20 20 20 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 6d | y,.specify.a......constructor.`m |
| 3bfa0 | 61 6b 65 2d 70 6f 69 6e 74 27 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 73 20 60 78 2d 70 6f 69 6e | ake-point'.and.selectors.`x-poin |
| 3bfc0 | 74 27 20 61 6e 64 20 60 79 2d 70 6f 69 6e 74 27 0a 20 20 20 20 20 74 68 61 74 20 64 65 66 69 6e | t'.and.`y-point'......that.defin |
| 3bfe0 | 65 20 74 68 69 73 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 46 69 6e 61 6c 6c 79 2c | e.this.representation...Finally, |
| 3c000 | 20 75 73 69 6e 67 20 79 6f 75 72 20 73 65 6c 65 63 74 6f 72 73 0a 20 20 20 20 20 61 6e 64 20 63 | .using.your.selectors......and.c |
| 3c020 | 6f 6e 73 74 72 75 63 74 6f 72 73 2c 20 64 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 | onstructors,.define.a.procedure. |
| 3c040 | 60 6d 69 64 70 6f 69 6e 74 2d 73 65 67 6d 65 6e 74 27 20 74 68 61 74 20 74 61 6b 65 73 0a 20 20 | `midpoint-segment'.that.takes... |
| 3c060 | 20 20 20 61 20 6c 69 6e 65 20 73 65 67 6d 65 6e 74 20 61 73 20 61 72 67 75 6d 65 6e 74 20 61 6e | ...a.line.segment.as.argument.an |
| 3c080 | 64 20 72 65 74 75 72 6e 73 20 69 74 73 20 6d 69 64 70 6f 69 6e 74 20 28 74 68 65 20 70 6f 69 6e | d.returns.its.midpoint.(the.poin |
| 3c0a0 | 74 0a 20 20 20 20 20 77 68 6f 73 65 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 61 72 65 20 74 68 65 | t......whose.coordinates.are.the |
| 3c0c0 | 20 61 76 65 72 61 67 65 20 6f 66 20 74 68 65 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 6f 66 20 74 | .average.of.the.coordinates.of.t |
| 3c0e0 | 68 65 0a 20 20 20 20 20 65 6e 64 70 6f 69 6e 74 73 29 2e 20 20 54 6f 20 74 72 79 20 79 6f 75 72 | he......endpoints)...To.try.your |
| 3c100 | 20 70 72 6f 63 65 64 75 72 65 73 2c 20 79 6f 75 27 6c 6c 20 6e 65 65 64 20 61 20 77 61 79 20 74 | .procedures,.you'll.need.a.way.t |
| 3c120 | 6f 20 70 72 69 6e 74 0a 20 20 20 20 20 70 6f 69 6e 74 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 | o.print......points:............ |
| 3c140 | 28 64 65 66 69 6e 65 20 28 70 72 69 6e 74 2d 70 6f 69 6e 74 20 70 29 0a 20 20 20 20 20 20 20 20 | (define.(print-point.p)......... |
| 3c160 | 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c | ....(newline).............(displ |
| 3c180 | 61 79 20 22 28 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 28 78 2d | ay."(").............(display.(x- |
| 3c1a0 | 70 6f 69 6e 74 20 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 22 | point.p)).............(display." |
| 3c1c0 | 2c 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 28 79 2d 70 6f 69 6e | ,").............(display.(y-poin |
| 3c1e0 | 74 20 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 22 29 22 29 29 | t.p)).............(display.")")) |
| 3c200 | 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 33 3a 2a 20 49 6d 70 6c 65 6d 65 6e 74 | .......*Exercise.2.3:*.Implement |
| 3c220 | 20 61 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 72 65 63 74 61 6e 67 6c 65 73 | .a.representation.for.rectangles |
| 3c240 | 20 69 6e 20 61 0a 20 20 20 20 20 70 6c 61 6e 65 2e 20 20 28 48 69 6e 74 3a 20 59 6f 75 20 6d 61 | .in.a......plane...(Hint:.You.ma |
| 3c260 | 79 20 77 61 6e 74 20 74 6f 20 6d 61 6b 65 20 75 73 65 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 | y.want.to.make.use.of.*Note.Exer |
| 3c280 | 63 69 73 65 20 32 2d 32 3a 3a 2e 29 0a 20 20 20 20 20 49 6e 20 74 65 72 6d 73 20 6f 66 20 79 6f | cise.2-2::.)......In.terms.of.yo |
| 3c2a0 | 75 72 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 73 2c 20 63 | ur.constructors.and.selectors,.c |
| 3c2c0 | 72 65 61 74 65 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 74 68 61 74 20 63 6f 6d 70 75 | reate.procedures......that.compu |
| 3c2e0 | 74 65 20 74 68 65 20 70 65 72 69 6d 65 74 65 72 20 61 6e 64 20 74 68 65 20 61 72 65 61 20 6f 66 | te.the.perimeter.and.the.area.of |
| 3c300 | 20 61 20 67 69 76 65 6e 20 72 65 63 74 61 6e 67 6c 65 2e 20 20 4e 6f 77 0a 20 20 20 20 20 69 6d | .a.given.rectangle...Now......im |
| 3c320 | 70 6c 65 6d 65 6e 74 20 61 20 64 69 66 66 65 72 65 6e 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 | plement.a.different.representati |
| 3c340 | 6f 6e 20 66 6f 72 20 72 65 63 74 61 6e 67 6c 65 73 2e 20 20 43 61 6e 20 79 6f 75 0a 20 20 20 20 | on.for.rectangles...Can.you..... |
| 3c360 | 20 64 65 73 69 67 6e 20 79 6f 75 72 20 73 79 73 74 65 6d 20 77 69 74 68 20 73 75 69 74 61 62 6c | .design.your.system.with.suitabl |
| 3c380 | 65 20 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 72 72 69 65 72 73 2c 20 73 6f 20 74 68 61 74 20 | e.abstraction.barriers,.so.that. |
| 3c3a0 | 74 68 65 0a 20 20 20 20 20 73 61 6d 65 20 70 65 72 69 6d 65 74 65 72 20 61 6e 64 20 61 72 65 61 | the......same.perimeter.and.area |
| 3c3c0 | 20 70 72 6f 63 65 64 75 72 65 73 20 77 69 6c 6c 20 77 6f 72 6b 20 75 73 69 6e 67 20 65 69 74 68 | .procedures.will.work.using.eith |
| 3c3e0 | 65 72 0a 20 20 20 20 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 3f 0a 0a 1f 0a 46 69 6c 65 3a | er......representation?....File: |
| 3c400 | 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 31 2d 33 2c 20 20 4e 65 78 74 3a | .sicp.info,..Node:.2-1-3,..Next: |
| 3c420 | 20 32 2d 31 2d 34 2c 20 20 50 72 65 76 3a 20 32 2d 31 2d 32 2c 20 20 55 70 3a 20 32 2d 31 0a 0a | .2-1-4,..Prev:.2-1-2,..Up:.2-1.. |
| 3c440 | 32 2e 31 2e 33 20 57 68 61 74 20 49 73 20 4d 65 61 6e 74 20 62 79 20 44 61 74 61 3f 0a 2d 2d 2d | 2.1.3.What.Is.Meant.by.Data?.--- |
| 3c460 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 65 20 62 65 | -------------------------..We.be |
| 3c480 | 67 61 6e 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 69 6d 70 6c 65 6d 65 6e | gan.the.rational-number.implemen |
| 3c4a0 | 74 61 74 69 6f 6e 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 31 2d 31 3a 3a 20 | tation.in.section.*Note.2-1-1::. |
| 3c4c0 | 62 79 0a 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d | by.implementing.the.rational-num |
| 3c4e0 | 62 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 60 61 64 64 2d 72 61 74 27 2c 20 60 73 75 62 2d 72 | ber.operations.`add-rat',.`sub-r |
| 3c500 | 61 74 27 2c 20 61 6e 64 0a 73 6f 20 6f 6e 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 72 65 65 | at',.and.so.on.in.terms.of.three |
| 3c520 | 20 75 6e 73 70 65 63 69 66 69 65 64 20 70 72 6f 63 65 64 75 72 65 73 3a 20 60 6d 61 6b 65 2d 72 | .unspecified.procedures:.`make-r |
| 3c540 | 61 74 27 2c 20 60 6e 75 6d 65 72 27 2c 0a 61 6e 64 20 60 64 65 6e 6f 6d 27 2e 20 20 41 74 20 74 | at',.`numer',.and.`denom'...At.t |
| 3c560 | 68 61 74 20 70 6f 69 6e 74 2c 20 77 65 20 63 6f 75 6c 64 20 74 68 69 6e 6b 20 6f 66 20 74 68 65 | hat.point,.we.could.think.of.the |
| 3c580 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 73 20 62 65 69 6e 67 0a 64 65 66 69 6e 65 64 20 69 6e 20 | .operations.as.being.defined.in. |
| 3c5a0 | 74 65 72 6d 73 20 6f 66 20 64 61 74 61 20 6f 62 6a 65 63 74 73 2d 2d 6e 75 6d 65 72 61 74 6f 72 | terms.of.data.objects--numerator |
| 3c5c0 | 73 2c 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 73 2c 20 61 6e 64 20 72 61 74 69 6f 6e 61 6c 0a 6e 75 | s,.denominators,.and.rational.nu |
| 3c5e0 | 6d 62 65 72 73 2d 2d 77 68 6f 73 65 20 62 65 68 61 76 69 6f 72 20 77 61 73 20 73 70 65 63 69 66 | mbers--whose.behavior.was.specif |
| 3c600 | 69 65 64 20 62 79 20 74 68 65 20 6c 61 74 74 65 72 20 74 68 72 65 65 20 70 72 6f 63 65 64 75 72 | ied.by.the.latter.three.procedur |
| 3c620 | 65 73 2e 0a 0a 20 20 20 42 75 74 20 65 78 61 63 74 6c 79 20 77 68 61 74 20 69 73 20 6d 65 61 6e | es......But.exactly.what.is.mean |
| 3c640 | 74 20 62 79 20 22 64 61 74 61 22 3f 20 20 49 74 20 69 73 20 6e 6f 74 20 65 6e 6f 75 67 68 20 74 | t.by."data"?..It.is.not.enough.t |
| 3c660 | 6f 20 73 61 79 0a 22 77 68 61 74 65 76 65 72 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 | o.say."whatever.is.implemented.b |
| 3c680 | 79 20 74 68 65 20 67 69 76 65 6e 20 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 20 63 6f 6e 73 74 72 | y.the.given.selectors.and.constr |
| 3c6a0 | 75 63 74 6f 72 73 2e 22 0a 43 6c 65 61 72 6c 79 2c 20 6e 6f 74 20 65 76 65 72 79 20 61 72 62 69 | uctors.".Clearly,.not.every.arbi |
| 3c6c0 | 74 72 61 72 79 20 73 65 74 20 6f 66 20 74 68 72 65 65 20 70 72 6f 63 65 64 75 72 65 73 20 63 61 | trary.set.of.three.procedures.ca |
| 3c6e0 | 6e 20 73 65 72 76 65 20 61 73 20 61 6e 0a 61 70 70 72 6f 70 72 69 61 74 65 20 62 61 73 69 73 20 | n.serve.as.an.appropriate.basis. |
| 3c700 | 66 6f 72 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 69 6d 70 6c 65 6d 65 6e | for.the.rational-number.implemen |
| 3c720 | 74 61 74 69 6f 6e 2e 20 20 57 65 20 6e 65 65 64 20 74 6f 0a 67 75 61 72 61 6e 74 65 65 20 74 68 | tation...We.need.to.guarantee.th |
| 3c740 | 61 74 2c 20 69 66 20 77 65 20 63 6f 6e 73 74 72 75 63 74 20 61 20 72 61 74 69 6f 6e 61 6c 20 6e | at,.if.we.construct.a.rational.n |
| 3c760 | 75 6d 62 65 72 20 60 78 27 20 66 72 6f 6d 20 61 20 70 61 69 72 20 6f 66 0a 69 6e 74 65 67 65 72 | umber.`x'.from.a.pair.of.integer |
| 3c780 | 73 20 60 6e 27 20 61 6e 64 20 60 64 27 2c 20 74 68 65 6e 20 65 78 74 72 61 63 74 69 6e 67 20 74 | s.`n'.and.`d',.then.extracting.t |
| 3c7a0 | 68 65 20 60 6e 75 6d 65 72 27 20 61 6e 64 20 74 68 65 20 60 64 65 6e 6f 6d 27 20 6f 66 0a 60 78 | he.`numer'.and.the.`denom'.of.`x |
| 3c7c0 | 27 20 61 6e 64 20 64 69 76 69 64 69 6e 67 20 74 68 65 6d 20 73 68 6f 75 6c 64 20 79 69 65 6c 64 | '.and.dividing.them.should.yield |
| 3c7e0 | 20 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 20 61 73 20 64 69 76 69 64 69 6e 67 20 60 6e 27 | .the.same.result.as.dividing.`n' |
| 3c800 | 20 62 79 0a 60 64 27 2e 20 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 60 6d 61 6b 65 2d | .by.`d'...In.other.words,.`make- |
| 3c820 | 72 61 74 27 2c 20 60 6e 75 6d 65 72 27 2c 20 61 6e 64 20 60 64 65 6e 6f 6d 27 20 6d 75 73 74 20 | rat',.`numer',.and.`denom'.must. |
| 3c840 | 73 61 74 69 73 66 79 20 74 68 65 0a 63 6f 6e 64 69 74 69 6f 6e 20 74 68 61 74 2c 20 66 6f 72 20 | satisfy.the.condition.that,.for. |
| 3c860 | 61 6e 79 20 69 6e 74 65 67 65 72 20 60 6e 27 20 61 6e 64 20 61 6e 79 20 6e 6f 6e 2d 7a 65 72 6f | any.integer.`n'.and.any.non-zero |
| 3c880 | 20 69 6e 74 65 67 65 72 20 60 64 27 2c 20 69 66 0a 60 78 27 20 69 73 20 28 60 6d 61 6b 65 2d 72 | .integer.`d',.if.`x'.is.(`make-r |
| 3c8a0 | 61 74 20 6e 20 64 27 29 2c 20 74 68 65 6e 0a 0a 20 20 20 20 20 28 6e 75 6d 65 72 20 78 29 20 20 | at.n.d'),.then.......(numer.x).. |
| 3c8c0 | 20 20 6e 0a 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 3d 20 2d 2d 2d 0a 20 20 20 20 20 28 64 | ..n......---------.=.---......(d |
| 3c8e0 | 65 6e 6f 6d 20 78 29 20 20 20 20 64 0a 0a 20 20 20 49 6e 20 66 61 63 74 2c 20 74 68 69 73 20 69 | enom.x)....d.....In.fact,.this.i |
| 3c900 | 73 20 74 68 65 20 6f 6e 6c 79 20 63 6f 6e 64 69 74 69 6f 6e 20 60 6d 61 6b 65 2d 72 61 74 27 2c | s.the.only.condition.`make-rat', |
| 3c920 | 20 60 6e 75 6d 65 72 27 2c 20 61 6e 64 20 60 64 65 6e 6f 6d 27 0a 6d 75 73 74 20 66 75 6c 66 69 | .`numer',.and.`denom'.must.fulfi |
| 3c940 | 6c 6c 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 66 6f 72 6d 20 61 20 73 75 69 74 61 62 6c 65 20 62 | ll.in.order.to.form.a.suitable.b |
| 3c960 | 61 73 69 73 20 66 6f 72 20 61 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 0a 72 65 70 72 65 | asis.for.a.rational-number.repre |
| 3c980 | 73 65 6e 74 61 74 69 6f 6e 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 77 65 20 63 61 6e 20 74 | sentation...In.general,.we.can.t |
| 3c9a0 | 68 69 6e 6b 20 6f 66 20 64 61 74 61 20 61 73 20 64 65 66 69 6e 65 64 20 62 79 20 73 6f 6d 65 0a | hink.of.data.as.defined.by.some. |
| 3c9c0 | 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 20 63 6f 6e 73 | collection.of.selectors.and.cons |
| 3c9e0 | 74 72 75 63 74 6f 72 73 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 73 70 65 63 69 66 69 65 | tructors,.together.with.specifie |
| 3ca00 | 64 0a 63 6f 6e 64 69 74 69 6f 6e 73 20 74 68 61 74 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 | d.conditions.that.these.procedur |
| 3ca20 | 65 73 20 6d 75 73 74 20 66 75 6c 66 69 6c 6c 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 62 65 20 61 | es.must.fulfill.in.order.to.be.a |
| 3ca40 | 20 76 61 6c 69 64 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 28 31 29 0a 0a 20 20 20 54 68 | .valid.representation.(1).....Th |
| 3ca60 | 69 73 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 20 63 61 6e 20 73 65 72 76 65 20 74 6f 20 64 65 | is.point.of.view.can.serve.to.de |
| 3ca80 | 66 69 6e 65 20 6e 6f 74 20 6f 6e 6c 79 20 22 68 69 67 68 2d 6c 65 76 65 6c 22 20 64 61 74 61 0a | fine.not.only."high-level".data. |
| 3caa0 | 6f 62 6a 65 63 74 73 2c 20 73 75 63 68 20 61 73 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 | objects,.such.as.rational.number |
| 3cac0 | 73 2c 20 62 75 74 20 6c 6f 77 65 72 2d 6c 65 76 65 6c 20 6f 62 6a 65 63 74 73 20 61 73 20 77 65 | s,.but.lower-level.objects.as.we |
| 3cae0 | 6c 6c 2e 0a 43 6f 6e 73 69 64 65 72 20 74 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 20 61 20 70 61 69 | ll..Consider.the.notion.of.a.pai |
| 3cb00 | 72 2c 20 77 68 69 63 68 20 77 65 20 75 73 65 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 64 65 66 | r,.which.we.used.in.order.to.def |
| 3cb20 | 69 6e 65 20 6f 75 72 0a 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2e 20 20 57 65 20 6e 65 | ine.our.rational.numbers...We.ne |
| 3cb40 | 76 65 72 20 61 63 74 75 61 6c 6c 79 20 73 61 69 64 20 77 68 61 74 20 61 20 70 61 69 72 20 77 61 | ver.actually.said.what.a.pair.wa |
| 3cb60 | 73 2c 20 6f 6e 6c 79 20 74 68 61 74 0a 74 68 65 20 6c 61 6e 67 75 61 67 65 20 73 75 70 70 6c 69 | s,.only.that.the.language.suppli |
| 3cb80 | 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 60 63 6f 6e 73 27 2c 20 60 63 61 72 27 2c 20 61 6e 64 | ed.procedures.`cons',.`car',.and |
| 3cba0 | 20 60 63 64 72 27 20 66 6f 72 20 6f 70 65 72 61 74 69 6e 67 0a 6f 6e 20 70 61 69 72 73 2e 20 20 | .`cdr'.for.operating.on.pairs... |
| 3cbc0 | 42 75 74 20 74 68 65 20 6f 6e 6c 79 20 74 68 69 6e 67 20 77 65 20 6e 65 65 64 20 74 6f 20 6b 6e | But.the.only.thing.we.need.to.kn |
| 3cbe0 | 6f 77 20 61 62 6f 75 74 20 74 68 65 73 65 20 74 68 72 65 65 0a 6f 70 65 72 61 74 69 6f 6e 73 20 | ow.about.these.three.operations. |
| 3cc00 | 69 73 20 74 68 61 74 20 69 66 20 77 65 20 67 6c 75 65 20 74 77 6f 20 6f 62 6a 65 63 74 73 20 74 | is.that.if.we.glue.two.objects.t |
| 3cc20 | 6f 67 65 74 68 65 72 20 75 73 69 6e 67 20 60 63 6f 6e 73 27 20 77 65 20 63 61 6e 0a 72 65 74 72 | ogether.using.`cons'.we.can.retr |
| 3cc40 | 69 65 76 65 20 74 68 65 20 6f 62 6a 65 63 74 73 20 75 73 69 6e 67 20 60 63 61 72 27 20 61 6e 64 | ieve.the.objects.using.`car'.and |
| 3cc60 | 20 60 63 64 72 27 2e 20 20 54 68 61 74 20 69 73 2c 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 | .`cdr'...That.is,.the.operations |
| 3cc80 | 0a 73 61 74 69 73 66 79 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 20 74 68 61 74 2c 20 66 6f 72 | .satisfy.the.condition.that,.for |
| 3cca0 | 20 61 6e 79 20 6f 62 6a 65 63 74 73 20 60 78 27 20 61 6e 64 20 60 79 27 2c 20 69 66 20 60 7a 27 | .any.objects.`x'.and.`y',.if.`z' |
| 3ccc0 | 20 69 73 0a 60 28 63 6f 6e 73 20 78 20 79 29 27 20 74 68 65 6e 20 60 28 63 61 72 20 7a 29 27 20 | .is.`(cons.x.y)'.then.`(car.z)'. |
| 3cce0 | 69 73 20 60 78 27 20 61 6e 64 20 60 28 63 64 72 20 7a 29 27 20 69 73 20 60 79 27 2e 20 20 49 6e | is.`x'.and.`(cdr.z)'.is.`y'...In |
| 3cd00 | 64 65 65 64 2c 20 77 65 0a 6d 65 6e 74 69 6f 6e 65 64 20 74 68 61 74 20 74 68 65 73 65 20 74 68 | deed,.we.mentioned.that.these.th |
| 3cd20 | 72 65 65 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 69 6e 63 6c 75 64 65 64 20 61 73 20 70 | ree.procedures.are.included.as.p |
| 3cd40 | 72 69 6d 69 74 69 76 65 73 20 69 6e 20 6f 75 72 0a 6c 61 6e 67 75 61 67 65 2e 20 20 48 6f 77 65 | rimitives.in.our.language...Howe |
| 3cd60 | 76 65 72 2c 20 61 6e 79 20 74 72 69 70 6c 65 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 | ver,.any.triple.of.procedures.th |
| 3cd80 | 61 74 20 73 61 74 69 73 66 69 65 73 20 74 68 65 20 61 62 6f 76 65 0a 63 6f 6e 64 69 74 69 6f 6e | at.satisfies.the.above.condition |
| 3cda0 | 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 74 68 65 20 62 61 73 69 73 20 66 6f 72 20 69 6d | .can.be.used.as.the.basis.for.im |
| 3cdc0 | 70 6c 65 6d 65 6e 74 69 6e 67 20 70 61 69 72 73 2e 20 20 54 68 69 73 20 70 6f 69 6e 74 0a 69 73 | plementing.pairs...This.point.is |
| 3cde0 | 20 69 6c 6c 75 73 74 72 61 74 65 64 20 73 74 72 69 6b 69 6e 67 6c 79 20 62 79 20 74 68 65 20 66 | .illustrated.strikingly.by.the.f |
| 3ce00 | 61 63 74 20 74 68 61 74 20 77 65 20 63 6f 75 6c 64 20 69 6d 70 6c 65 6d 65 6e 74 20 60 63 6f 6e | act.that.we.could.implement.`con |
| 3ce20 | 73 27 2c 0a 60 63 61 72 27 2c 20 61 6e 64 20 60 63 64 72 27 20 77 69 74 68 6f 75 74 20 75 73 69 | s',.`car',.and.`cdr'.without.usi |
| 3ce40 | 6e 67 20 61 6e 79 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 61 74 20 61 6c 6c 20 62 75 | ng.any.data.structures.at.all.bu |
| 3ce60 | 74 20 6f 6e 6c 79 0a 75 73 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 48 65 72 65 20 61 | t.only.using.procedures...Here.a |
| 3ce80 | 72 65 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | re.the.definitions:.......(defin |
| 3cea0 | 65 20 28 63 6f 6e 73 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 | e.(cons.x.y)........(define.(dis |
| 3cec0 | 70 61 74 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d 20 6d 20 30 29 | patch.m)..........(cond.((=.m.0) |
| 3cee0 | 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 20 6d 20 31 29 20 79 29 0a 20 | .x)................((=.m.1).y).. |
| 3cf00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 41 72 67 75 | ..............(else.(error."Argu |
| 3cf20 | 6d 65 6e 74 20 6e 6f 74 20 30 20 6f 72 20 31 20 2d 2d 20 43 4f 4e 53 22 20 6d 29 29 29 29 0a 20 | ment.not.0.or.1.--.CONS".m)))).. |
| 3cf40 | 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 | ......dispatch).......(define.(c |
| 3cf60 | 61 72 20 7a 29 20 28 7a 20 30 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 64 72 20 | ar.z).(z.0)).......(define.(cdr. |
| 3cf80 | 7a 29 20 28 7a 20 31 29 29 0a 0a 20 20 20 54 68 69 73 20 75 73 65 20 6f 66 20 70 72 6f 63 65 64 | z).(z.1)).....This.use.of.proced |
| 3cfa0 | 75 72 65 73 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 6e 6f 74 68 69 6e 67 20 6c 69 6b 65 | ures.corresponds.to.nothing.like |
| 3cfc0 | 20 6f 75 72 20 69 6e 74 75 69 74 69 76 65 0a 6e 6f 74 69 6f 6e 20 6f 66 20 77 68 61 74 20 64 61 | .our.intuitive.notion.of.what.da |
| 3cfe0 | 74 61 20 73 68 6f 75 6c 64 20 62 65 2e 20 20 4e 65 76 65 72 74 68 65 6c 65 73 73 2c 20 61 6c 6c | ta.should.be...Nevertheless,.all |
| 3d000 | 20 77 65 20 6e 65 65 64 20 74 6f 20 64 6f 20 74 6f 20 73 68 6f 77 0a 74 68 61 74 20 74 68 69 73 | .we.need.to.do.to.show.that.this |
| 3d020 | 20 69 73 20 61 20 76 61 6c 69 64 20 77 61 79 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 70 61 69 | .is.a.valid.way.to.represent.pai |
| 3d040 | 72 73 20 69 73 20 74 6f 20 76 65 72 69 66 79 20 74 68 61 74 20 74 68 65 73 65 0a 70 72 6f 63 65 | rs.is.to.verify.that.these.proce |
| 3d060 | 64 75 72 65 73 20 73 61 74 69 73 66 79 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 20 67 69 76 65 | dures.satisfy.the.condition.give |
| 3d080 | 6e 20 61 62 6f 76 65 2e 0a 0a 20 20 20 54 68 65 20 73 75 62 74 6c 65 20 70 6f 69 6e 74 20 74 6f | n.above......The.subtle.point.to |
| 3d0a0 | 20 6e 6f 74 69 63 65 20 69 73 20 74 68 61 74 20 74 68 65 20 76 61 6c 75 65 20 72 65 74 75 72 6e | .notice.is.that.the.value.return |
| 3d0c0 | 65 64 20 62 79 20 60 28 63 6f 6e 73 20 78 0a 79 29 27 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 | ed.by.`(cons.x.y)'.is.a.procedur |
| 3d0e0 | 65 2d 2d 6e 61 6d 65 6c 79 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 6c 79 20 64 65 66 69 6e 65 64 | e--namely.the.internally.defined |
| 3d100 | 20 70 72 6f 63 65 64 75 72 65 20 60 64 69 73 70 61 74 63 68 27 2c 0a 77 68 69 63 68 20 74 61 6b | .procedure.`dispatch',.which.tak |
| 3d120 | 65 73 20 6f 6e 65 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 72 65 74 75 72 6e 73 20 65 69 74 68 | es.one.argument.and.returns.eith |
| 3d140 | 65 72 20 60 78 27 20 6f 72 20 60 79 27 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 0a 77 68 65 74 68 | er.`x'.or.`y'.depending.on.wheth |
| 3d160 | 65 72 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 69 73 20 30 20 6f 72 20 31 2e 20 20 43 6f 72 72 | er.the.argument.is.0.or.1...Corr |
| 3d180 | 65 73 70 6f 6e 64 69 6e 67 6c 79 2c 20 60 28 63 61 72 20 7a 29 27 20 69 73 20 64 65 66 69 6e 65 | espondingly,.`(car.z)'.is.define |
| 3d1a0 | 64 0a 74 6f 20 61 70 70 6c 79 20 60 7a 27 20 74 6f 20 30 2e 20 20 48 65 6e 63 65 2c 20 69 66 20 | d.to.apply.`z'.to.0...Hence,.if. |
| 3d1c0 | 60 7a 27 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 6d 65 64 20 62 79 20 60 | `z'.is.the.procedure.formed.by.` |
| 3d1e0 | 28 63 6f 6e 73 20 78 0a 79 29 27 2c 20 74 68 65 6e 20 60 7a 27 20 61 70 70 6c 69 65 64 20 74 6f | (cons.x.y)',.then.`z'.applied.to |
| 3d200 | 20 30 20 77 69 6c 6c 20 79 69 65 6c 64 20 60 78 27 2e 20 54 68 75 73 2c 20 77 65 20 68 61 76 65 | .0.will.yield.`x'..Thus,.we.have |
| 3d220 | 20 73 68 6f 77 6e 20 74 68 61 74 0a 60 28 63 61 72 20 28 63 6f 6e 73 20 78 20 79 29 29 27 20 79 | .shown.that.`(car.(cons.x.y))'.y |
| 3d240 | 69 65 6c 64 73 20 60 78 27 2c 20 61 73 20 64 65 73 69 72 65 64 2e 20 20 53 69 6d 69 6c 61 72 6c | ields.`x',.as.desired...Similarl |
| 3d260 | 79 2c 20 60 28 63 64 72 20 28 63 6f 6e 73 20 78 0a 79 29 29 27 20 61 70 70 6c 69 65 73 20 74 68 | y,.`(cdr.(cons.x.y))'.applies.th |
| 3d280 | 65 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e 65 64 20 62 79 20 60 28 63 6f 6e 73 20 78 | e.procedure.returned.by.`(cons.x |
| 3d2a0 | 20 79 29 27 20 74 6f 20 31 2c 20 77 68 69 63 68 20 72 65 74 75 72 6e 73 0a 60 79 27 2e 20 20 54 | .y)'.to.1,.which.returns.`y'...T |
| 3d2c0 | 68 65 72 65 66 6f 72 65 2c 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 61 6c 20 69 6d 70 6c 65 6d | herefore,.this.procedural.implem |
| 3d2e0 | 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 61 69 72 73 20 69 73 20 61 20 76 61 6c 69 64 0a 69 6d 70 | entation.of.pairs.is.a.valid.imp |
| 3d300 | 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 20 61 6e 64 20 69 66 20 77 65 20 61 63 63 65 73 73 20 70 61 | lementation,.and.if.we.access.pa |
| 3d320 | 69 72 73 20 75 73 69 6e 67 20 6f 6e 6c 79 20 60 63 6f 6e 73 27 2c 20 60 63 61 72 27 2c 20 61 6e | irs.using.only.`cons',.`car',.an |
| 3d340 | 64 0a 60 63 64 72 27 20 77 65 20 63 61 6e 6e 6f 74 20 64 69 73 74 69 6e 67 75 69 73 68 20 74 68 | d.`cdr'.we.cannot.distinguish.th |
| 3d360 | 69 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 66 72 6f 6d 20 6f 6e 65 20 74 68 61 74 20 | is.implementation.from.one.that. |
| 3d380 | 75 73 65 73 0a 22 72 65 61 6c 22 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 2e 0a 0a 20 20 | uses."real".data.structures..... |
| 3d3a0 | 20 54 68 65 20 70 6f 69 6e 74 20 6f 66 20 65 78 68 69 62 69 74 69 6e 67 20 74 68 65 20 70 72 6f | .The.point.of.exhibiting.the.pro |
| 3d3c0 | 63 65 64 75 72 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 61 69 72 73 20 | cedural.representation.of.pairs. |
| 3d3e0 | 69 73 0a 6e 6f 74 20 74 68 61 74 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 77 6f 72 6b 73 20 74 | is.not.that.our.language.works.t |
| 3d400 | 68 69 73 20 77 61 79 20 28 53 63 68 65 6d 65 2c 20 61 6e 64 20 4c 69 73 70 20 73 79 73 74 65 6d | his.way.(Scheme,.and.Lisp.system |
| 3d420 | 73 20 69 6e 0a 67 65 6e 65 72 61 6c 2c 20 69 6d 70 6c 65 6d 65 6e 74 20 70 61 69 72 73 20 64 69 | s.in.general,.implement.pairs.di |
| 3d440 | 72 65 63 74 6c 79 2c 20 66 6f 72 20 65 66 66 69 63 69 65 6e 63 79 20 72 65 61 73 6f 6e 73 29 20 | rectly,.for.efficiency.reasons). |
| 3d460 | 62 75 74 20 74 68 61 74 20 69 74 0a 63 6f 75 6c 64 20 77 6f 72 6b 20 74 68 69 73 20 77 61 79 2e | but.that.it.could.work.this.way. |
| 3d480 | 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c | ..The.procedural.representation, |
| 3d4a0 | 20 61 6c 74 68 6f 75 67 68 20 6f 62 73 63 75 72 65 2c 0a 69 73 20 61 20 70 65 72 66 65 63 74 6c | .although.obscure,.is.a.perfectl |
| 3d4c0 | 79 20 61 64 65 71 75 61 74 65 20 77 61 79 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 70 61 69 72 | y.adequate.way.to.represent.pair |
| 3d4e0 | 73 2c 20 73 69 6e 63 65 20 69 74 20 66 75 6c 66 69 6c 6c 73 20 74 68 65 0a 6f 6e 6c 79 20 63 6f | s,.since.it.fulfills.the.only.co |
| 3d500 | 6e 64 69 74 69 6f 6e 73 20 74 68 61 74 20 70 61 69 72 73 20 6e 65 65 64 20 74 6f 20 66 75 6c 66 | nditions.that.pairs.need.to.fulf |
| 3d520 | 69 6c 6c 2e 20 20 54 68 69 73 20 65 78 61 6d 70 6c 65 20 61 6c 73 6f 0a 64 65 6d 6f 6e 73 74 72 | ill...This.example.also.demonstr |
| 3d540 | 61 74 65 73 20 74 68 61 74 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 6d 61 6e 69 70 75 6c | ates.that.the.ability.to.manipul |
| 3d560 | 61 74 65 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 6f 62 6a 65 63 74 73 0a 61 75 74 6f 6d 61 | ate.procedures.as.objects.automa |
| 3d580 | 74 69 63 61 6c 6c 79 20 70 72 6f 76 69 64 65 73 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 | tically.provides.the.ability.to. |
| 3d5a0 | 72 65 70 72 65 73 65 6e 74 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 2e 20 20 54 68 69 73 0a 6d | represent.compound.data...This.m |
| 3d5c0 | 61 79 20 73 65 65 6d 20 61 20 63 75 72 69 6f 73 69 74 79 20 6e 6f 77 2c 20 62 75 74 20 70 72 6f | ay.seem.a.curiosity.now,.but.pro |
| 3d5e0 | 63 65 64 75 72 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 64 61 74 61 20 | cedural.representations.of.data. |
| 3d600 | 77 69 6c 6c 0a 70 6c 61 79 20 61 20 63 65 6e 74 72 61 6c 20 72 6f 6c 65 20 69 6e 20 6f 75 72 20 | will.play.a.central.role.in.our. |
| 3d620 | 70 72 6f 67 72 61 6d 6d 69 6e 67 20 72 65 70 65 72 74 6f 69 72 65 2e 20 20 54 68 69 73 20 73 74 | programming.repertoire...This.st |
| 3d640 | 79 6c 65 20 6f 66 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 6f 66 74 65 6e 20 63 61 6c 6c | yle.of.programming.is.often.call |
| 3d660 | 65 64 20 22 6d 65 73 73 61 67 65 20 70 61 73 73 69 6e 67 22 2c 20 61 6e 64 20 77 65 20 77 69 6c | ed."message.passing",.and.we.wil |
| 3d680 | 6c 20 62 65 20 75 73 69 6e 67 20 69 74 0a 61 73 20 61 20 62 61 73 69 63 20 74 6f 6f 6c 20 69 6e | l.be.using.it.as.a.basic.tool.in |
| 3d6a0 | 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 20 77 68 65 6e 20 77 65 20 61 64 64 72 65 | .*Note.Chapter.3::.when.we.addre |
| 3d6c0 | 73 73 20 74 68 65 20 69 73 73 75 65 73 20 6f 66 0a 6d 6f 64 65 6c 69 6e 67 20 61 6e 64 20 73 69 | ss.the.issues.of.modeling.and.si |
| 3d6e0 | 6d 75 6c 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 34 3a 2a 20 | mulation........*Exercise.2.4:*. |
| 3d700 | 48 65 72 65 20 69 73 20 61 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 70 72 6f 63 65 64 75 72 61 | Here.is.an.alternative.procedura |
| 3d720 | 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 0a 20 20 20 20 20 6f 66 20 70 61 69 72 73 2e 20 | l.representation......of.pairs.. |
| 3d740 | 20 46 6f 72 20 74 68 69 73 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c 20 76 65 72 69 66 79 | .For.this.representation,.verify |
| 3d760 | 20 74 68 61 74 20 60 28 63 61 72 20 28 63 6f 6e 73 20 78 20 79 29 29 27 0a 20 20 20 20 20 79 69 | .that.`(car.(cons.x.y))'......yi |
| 3d780 | 65 6c 64 73 20 60 78 27 20 66 6f 72 20 61 6e 79 20 6f 62 6a 65 63 74 73 20 60 78 27 20 61 6e 64 | elds.`x'.for.any.objects.`x'.and |
| 3d7a0 | 20 60 79 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 73 20 78 | .`y'.............(define.(cons.x |
| 3d7c0 | 20 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 29 20 28 6d 20 78 | .y).............(lambda.(m).(m.x |
| 3d7e0 | 20 79 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 61 72 20 7a 29 | .y)))............(define.(car.z) |
| 3d800 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 7a 20 28 6c 61 6d 62 64 61 20 28 70 20 71 29 20 70 29 | .............(z.(lambda.(p.q).p) |
| 3d820 | 29 29 0a 0a 20 20 20 20 20 57 68 61 74 20 69 73 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 | )).......What.is.the.correspondi |
| 3d840 | 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 63 64 72 27 3f 20 28 48 69 6e 74 3a 20 54 | ng.definition.of.`cdr'?.(Hint:.T |
| 3d860 | 6f 20 76 65 72 69 66 79 0a 20 20 20 20 20 74 68 61 74 20 74 68 69 73 20 77 6f 72 6b 73 2c 20 6d | o.verify......that.this.works,.m |
| 3d880 | 61 6b 65 20 75 73 65 20 6f 66 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 | ake.use.of.the.substitution.mode |
| 3d8a0 | 6c 20 6f 66 20 73 65 63 74 69 6f 6e 0a 20 20 20 20 20 2a 4e 6f 74 65 20 31 2d 31 2d 35 3a 3a 2e | l.of.section......*Note.1-1-5::. |
| 3d8c0 | 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 35 3a 2a 20 53 68 6f 77 20 74 68 61 | ).......*Exercise.2.5:*.Show.tha |
| 3d8e0 | 74 20 77 65 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 20 70 61 69 72 73 20 6f 66 20 6e 6f 6e 6e | t.we.can.represent.pairs.of.nonn |
| 3d900 | 65 67 61 74 69 76 65 0a 20 20 20 20 20 69 6e 74 65 67 65 72 73 20 75 73 69 6e 67 20 6f 6e 6c 79 | egative......integers.using.only |
| 3d920 | 20 6e 75 6d 62 65 72 73 20 61 6e 64 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f | .numbers.and.arithmetic.operatio |
| 3d940 | 6e 73 20 69 66 20 77 65 0a 20 20 20 20 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 70 61 69 72 | ns.if.we......represent.the.pair |
| 3d960 | 20 61 20 61 6e 64 20 62 20 61 73 20 74 68 65 20 69 6e 74 65 67 65 72 20 74 68 61 74 20 69 73 20 | .a.and.b.as.the.integer.that.is. |
| 3d980 | 74 68 65 20 70 72 6f 64 75 63 74 20 32 5e 61 0a 20 20 20 20 20 33 5e 62 2e 20 20 47 69 76 65 20 | the.product.2^a......3^b...Give. |
| 3d9a0 | 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 | the.corresponding.definitions.of |
| 3d9c0 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 63 6f 6e 73 27 2c 0a 20 20 20 20 20 60 63 61 | .the.procedures.`cons',......`ca |
| 3d9e0 | 72 27 2c 20 61 6e 64 20 60 63 64 72 27 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 | r',.and.`cdr'........*Exercise.2 |
| 3da00 | 2e 36 3a 2a 20 49 6e 20 63 61 73 65 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 70 61 69 72 73 20 | .6:*.In.case.representing.pairs. |
| 3da20 | 61 73 20 70 72 6f 63 65 64 75 72 65 73 20 77 61 73 6e 27 74 0a 20 20 20 20 20 6d 69 6e 64 2d 62 | as.procedures.wasn't......mind-b |
| 3da40 | 6f 67 67 6c 69 6e 67 20 65 6e 6f 75 67 68 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 61 74 2c 20 69 | oggling.enough,.consider.that,.i |
| 3da60 | 6e 20 61 20 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 63 61 6e 0a 20 20 20 20 20 6d 61 6e 69 70 | n.a.language.that.can......manip |
| 3da80 | 75 6c 61 74 65 20 70 72 6f 63 65 64 75 72 65 73 2c 20 77 65 20 63 61 6e 20 67 65 74 20 62 79 20 | ulate.procedures,.we.can.get.by. |
| 3daa0 | 77 69 74 68 6f 75 74 20 6e 75 6d 62 65 72 73 20 28 61 74 20 6c 65 61 73 74 0a 20 20 20 20 20 69 | without.numbers.(at.least......i |
| 3dac0 | 6e 73 6f 66 61 72 20 61 73 20 6e 6f 6e 6e 65 67 61 74 69 76 65 20 69 6e 74 65 67 65 72 73 20 61 | nsofar.as.nonnegative.integers.a |
| 3dae0 | 72 65 20 63 6f 6e 63 65 72 6e 65 64 29 20 62 79 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 30 0a | re.concerned).by.implementing.0. |
| 3db00 | 20 20 20 20 20 61 6e 64 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 6f 66 20 61 64 64 69 6e 67 | .....and.the.operation.of.adding |
| 3db20 | 20 31 20 61 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 7a 65 72 6f 20 28 6c | .1.as............(define.zero.(l |
| 3db40 | 61 6d 62 64 61 20 28 66 29 20 28 6c 61 6d 62 64 61 20 28 78 29 20 78 29 29 29 0a 0a 20 20 20 20 | ambda.(f).(lambda.(x).x)))...... |
| 3db60 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 31 20 6e 29 0a 20 20 20 20 20 20 20 20 | ......(define.(add-1.n)......... |
| 3db80 | 20 20 20 20 28 6c 61 6d 62 64 61 20 28 66 29 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 66 20 28 | ....(lambda.(f).(lambda.(x).(f.( |
| 3dba0 | 28 6e 20 66 29 20 78 29 29 29 29 29 0a 0a 20 20 20 20 20 54 68 69 73 20 72 65 70 72 65 73 65 6e | (n.f).x))))).......This.represen |
| 3dbc0 | 74 61 74 69 6f 6e 20 69 73 20 6b 6e 6f 77 6e 20 61 73 20 22 43 68 75 72 63 68 20 6e 75 6d 65 72 | tation.is.known.as."Church.numer |
| 3dbe0 | 61 6c 73 22 2c 20 61 66 74 65 72 20 69 74 73 0a 20 20 20 20 20 69 6e 76 65 6e 74 6f 72 2c 20 41 | als",.after.its......inventor,.A |
| 3dc00 | 6c 6f 6e 7a 6f 20 43 68 75 72 63 68 2c 20 74 68 65 20 6c 6f 67 69 63 69 61 6e 20 77 68 6f 20 69 | lonzo.Church,.the.logician.who.i |
| 3dc20 | 6e 76 65 6e 74 65 64 20 74 68 65 20 5b 6c 61 6d 62 64 61 5d 0a 20 20 20 20 20 63 61 6c 63 75 6c | nvented.the.[lambda]......calcul |
| 3dc40 | 75 73 2e 0a 0a 20 20 20 20 20 44 65 66 69 6e 65 20 60 6f 6e 65 27 20 61 6e 64 20 60 74 77 6f 27 | us........Define.`one'.and.`two' |
| 3dc60 | 20 64 69 72 65 63 74 6c 79 20 28 6e 6f 74 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 60 7a 65 72 6f | .directly.(not.in.terms.of.`zero |
| 3dc80 | 27 20 61 6e 64 0a 20 20 20 20 20 60 61 64 64 2d 31 27 29 2e 20 20 28 48 69 6e 74 3a 20 55 73 65 | '.and......`add-1')...(Hint:.Use |
| 3dca0 | 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 74 6f 20 65 76 61 6c 75 61 74 65 20 60 28 61 64 64 2d | .substitution.to.evaluate.`(add- |
| 3dcc0 | 31 20 7a 65 72 6f 29 27 29 2e 0a 20 20 20 20 20 47 69 76 65 20 61 20 64 69 72 65 63 74 20 64 65 | 1.zero)').......Give.a.direct.de |
| 3dce0 | 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 61 64 64 69 74 69 6f 6e 20 70 72 6f 63 65 64 75 | finition.of.the.addition.procedu |
| 3dd00 | 72 65 20 60 2b 27 20 28 6e 6f 74 20 69 6e 0a 20 20 20 20 20 74 65 72 6d 73 20 6f 66 20 72 65 70 | re.`+'.(not.in......terms.of.rep |
| 3dd20 | 65 61 74 65 64 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 60 61 64 64 2d 31 27 29 2e 0a 0a | eated.application.of.`add-1')... |
| 3dd40 | 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d | ...----------.Footnotes.-------- |
| 3dd60 | 2d 2d 0a 0a 20 20 20 28 31 29 20 53 75 72 70 72 69 73 69 6e 67 6c 79 2c 20 74 68 69 73 20 69 64 | --.....(1).Surprisingly,.this.id |
| 3dd80 | 65 61 20 69 73 20 76 65 72 79 20 64 69 66 66 69 63 75 6c 74 20 74 6f 20 66 6f 72 6d 75 6c 61 74 | ea.is.very.difficult.to.formulat |
| 3dda0 | 65 0a 72 69 67 6f 72 6f 75 73 6c 79 2e 20 54 68 65 72 65 20 61 72 65 20 74 77 6f 20 61 70 70 72 | e.rigorously..There.are.two.appr |
| 3ddc0 | 6f 61 63 68 65 73 20 74 6f 20 67 69 76 69 6e 67 20 73 75 63 68 20 61 20 66 6f 72 6d 75 6c 61 74 | oaches.to.giving.such.a.formulat |
| 3dde0 | 69 6f 6e 2e 20 20 4f 6e 65 2c 0a 70 69 6f 6e 65 65 72 65 64 20 62 79 20 43 2e 20 41 2e 20 52 2e | ion...One,.pioneered.by.C..A..R. |
| 3de00 | 20 48 6f 61 72 65 20 28 31 39 37 32 29 2c 20 69 73 20 6b 6e 6f 77 6e 20 61 73 20 74 68 65 20 6d | .Hoare.(1972),.is.known.as.the.m |
| 3de20 | 65 74 68 6f 64 20 6f 66 20 6d 6f 64 65 6c 73 0a 22 61 62 73 74 72 61 63 74 20 6d 6f 64 65 6c 73 | ethod.of.models."abstract.models |
| 3de40 | 22 2e 20 20 49 74 20 66 6f 72 6d 61 6c 69 7a 65 73 20 74 68 65 20 22 70 72 6f 63 65 64 75 72 65 | "...It.formalizes.the."procedure |
| 3de60 | 73 20 70 6c 75 73 20 63 6f 6e 64 69 74 69 6f 6e 73 22 0a 73 70 65 63 69 66 69 63 61 74 69 6f 6e | s.plus.conditions".specification |
| 3de80 | 20 61 73 20 6f 75 74 6c 69 6e 65 64 20 69 6e 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d | .as.outlined.in.the.rational-num |
| 3dea0 | 62 65 72 20 65 78 61 6d 70 6c 65 20 61 62 6f 76 65 2e 20 20 4e 6f 74 65 0a 74 68 61 74 20 74 68 | ber.example.above...Note.that.th |
| 3dec0 | 65 20 63 6f 6e 64 69 74 69 6f 6e 20 6f 6e 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 | e.condition.on.the.rational-numb |
| 3dee0 | 65 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 77 61 73 20 73 74 61 74 65 64 20 69 6e 0a | er.representation.was.stated.in. |
| 3df00 | 74 65 72 6d 73 20 6f 66 20 66 61 63 74 73 20 61 62 6f 75 74 20 69 6e 74 65 67 65 72 73 20 28 65 | terms.of.facts.about.integers.(e |
| 3df20 | 71 75 61 6c 69 74 79 20 61 6e 64 20 64 69 76 69 73 69 6f 6e 29 2e 20 20 49 6e 20 67 65 6e 65 72 | quality.and.division)...In.gener |
| 3df40 | 61 6c 2c 0a 61 62 73 74 72 61 63 74 20 6d 6f 64 65 6c 73 20 64 65 66 69 6e 65 20 6e 65 77 20 6b | al,.abstract.models.define.new.k |
| 3df60 | 69 6e 64 73 20 6f 66 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 | inds.of.data.objects.in.terms.of |
| 3df80 | 20 70 72 65 76 69 6f 75 73 6c 79 0a 64 65 66 69 6e 65 64 20 74 79 70 65 73 20 6f 66 20 64 61 74 | .previously.defined.types.of.dat |
| 3dfa0 | 61 20 6f 62 6a 65 63 74 73 2e 20 20 41 73 73 65 72 74 69 6f 6e 73 20 61 62 6f 75 74 20 64 61 74 | a.objects...Assertions.about.dat |
| 3dfc0 | 61 20 6f 62 6a 65 63 74 73 20 63 61 6e 0a 74 68 65 72 65 66 6f 72 65 20 62 65 20 63 68 65 63 6b | a.objects.can.therefore.be.check |
| 3dfe0 | 65 64 20 62 79 20 72 65 64 75 63 69 6e 67 20 74 68 65 6d 20 74 6f 20 61 73 73 65 72 74 69 6f 6e | ed.by.reducing.them.to.assertion |
| 3e000 | 73 20 61 62 6f 75 74 20 70 72 65 76 69 6f 75 73 6c 79 0a 64 65 66 69 6e 65 64 20 64 61 74 61 20 | s.about.previously.defined.data. |
| 3e020 | 6f 62 6a 65 63 74 73 2e 20 20 41 6e 6f 74 68 65 72 20 61 70 70 72 6f 61 63 68 2c 20 69 6e 74 72 | objects...Another.approach,.intr |
| 3e040 | 6f 64 75 63 65 64 20 62 79 20 5a 69 6c 6c 65 73 20 61 74 20 4d 49 54 2c 0a 62 79 20 47 6f 67 75 | oduced.by.Zilles.at.MIT,.by.Gogu |
| 3e060 | 65 6e 2c 20 54 68 61 74 63 68 65 72 2c 20 57 61 67 6e 65 72 2c 20 61 6e 64 20 57 72 69 67 68 74 | en,.Thatcher,.Wagner,.and.Wright |
| 3e080 | 20 61 74 20 49 42 4d 20 28 73 65 65 20 54 68 61 74 63 68 65 72 2c 20 57 61 67 6e 65 72 2c 0a 61 | .at.IBM.(see.Thatcher,.Wagner,.a |
| 3e0a0 | 6e 64 20 57 72 69 67 68 74 20 31 39 37 38 29 2c 20 61 6e 64 20 62 79 20 47 75 74 74 61 67 20 61 | nd.Wright.1978),.and.by.Guttag.a |
| 3e0c0 | 74 20 54 6f 72 6f 6e 74 6f 20 28 73 65 65 20 47 75 74 74 61 67 20 31 39 37 37 29 2c 20 69 73 20 | t.Toronto.(see.Guttag.1977),.is. |
| 3e0e0 | 63 61 6c 6c 65 64 20 22 61 6c 67 65 62 72 61 69 63 0a 73 70 65 63 69 66 69 63 61 74 69 6f 6e 22 | called."algebraic.specification" |
| 3e100 | 2e 20 20 49 74 20 72 65 67 61 72 64 73 20 74 68 65 20 22 70 72 6f 63 65 64 75 72 65 73 22 20 61 | ...It.regards.the."procedures".a |
| 3e120 | 73 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 61 6e 20 61 62 73 74 72 61 63 74 0a 61 6c 67 65 62 72 | s.elements.of.an.abstract.algebr |
| 3e140 | 61 69 63 20 73 79 73 74 65 6d 20 77 68 6f 73 65 20 62 65 68 61 76 69 6f 72 20 69 73 20 73 70 65 | aic.system.whose.behavior.is.spe |
| 3e160 | 63 69 66 69 65 64 20 62 79 20 61 78 69 6f 6d 73 20 74 68 61 74 20 63 6f 72 72 65 73 70 6f 6e 64 | cified.by.axioms.that.correspond |
| 3e180 | 0a 74 6f 20 6f 75 72 20 22 63 6f 6e 64 69 74 69 6f 6e 73 2c 22 20 61 6e 64 20 75 73 65 73 20 74 | .to.our."conditions,".and.uses.t |
| 3e1a0 | 68 65 20 74 65 63 68 6e 69 71 75 65 73 20 6f 66 20 61 62 73 74 72 61 63 74 20 61 6c 67 65 62 72 | he.techniques.of.abstract.algebr |
| 3e1c0 | 61 20 74 6f 0a 63 68 65 63 6b 20 61 73 73 65 72 74 69 6f 6e 73 20 61 62 6f 75 74 20 64 61 74 61 | a.to.check.assertions.about.data |
| 3e1e0 | 20 6f 62 6a 65 63 74 73 2e 20 20 42 6f 74 68 20 6d 65 74 68 6f 64 73 20 61 72 65 20 73 75 72 76 | .objects...Both.methods.are.surv |
| 3e200 | 65 79 65 64 20 69 6e 20 74 68 65 0a 70 61 70 65 72 20 62 79 20 4c 69 73 6b 6f 76 20 61 6e 64 20 | eyed.in.the.paper.by.Liskov.and. |
| 3e220 | 5a 69 6c 6c 65 73 20 28 31 39 37 35 29 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 | Zilles.(1975).....File:.sicp.inf |
| 3e240 | 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 31 2d 34 2c 20 20 50 72 65 76 3a 20 32 2d 31 2d 33 2c 20 20 | o,..Node:.2-1-4,..Prev:.2-1-3,.. |
| 3e260 | 55 70 3a 20 32 2d 31 0a 0a 32 2e 31 2e 34 20 45 78 74 65 6e 64 65 64 20 45 78 65 72 63 69 73 65 | Up:.2-1..2.1.4.Extended.Exercise |
| 3e280 | 3a 20 49 6e 74 65 72 76 61 6c 20 41 72 69 74 68 6d 65 74 69 63 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | :.Interval.Arithmetic.---------- |
| 3e2a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 3e2c0 | 2d 2d 0a 0a 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 20 69 73 20 64 65 73 69 67 6e 69 6e | --..Alyssa.P..Hacker.is.designin |
| 3e2e0 | 67 20 61 20 73 79 73 74 65 6d 20 74 6f 20 68 65 6c 70 20 70 65 6f 70 6c 65 20 73 6f 6c 76 65 20 | g.a.system.to.help.people.solve. |
| 3e300 | 65 6e 67 69 6e 65 65 72 69 6e 67 0a 70 72 6f 62 6c 65 6d 73 2e 20 20 4f 6e 65 20 66 65 61 74 75 | engineering.problems...One.featu |
| 3e320 | 72 65 20 73 68 65 20 77 61 6e 74 73 20 74 6f 20 70 72 6f 76 69 64 65 20 69 6e 20 68 65 72 20 73 | re.she.wants.to.provide.in.her.s |
| 3e340 | 79 73 74 65 6d 20 69 73 20 74 68 65 0a 61 62 69 6c 69 74 79 20 74 6f 20 6d 61 6e 69 70 75 6c 61 | ystem.is.the.ability.to.manipula |
| 3e360 | 74 65 20 69 6e 65 78 61 63 74 20 71 75 61 6e 74 69 74 69 65 73 20 28 73 75 63 68 20 61 73 20 6d | te.inexact.quantities.(such.as.m |
| 3e380 | 65 61 73 75 72 65 64 20 70 61 72 61 6d 65 74 65 72 73 0a 6f 66 20 70 68 79 73 69 63 61 6c 20 64 | easured.parameters.of.physical.d |
| 3e3a0 | 65 76 69 63 65 73 29 20 77 69 74 68 20 6b 6e 6f 77 6e 20 70 72 65 63 69 73 69 6f 6e 2c 20 73 6f | evices).with.known.precision,.so |
| 3e3c0 | 20 74 68 61 74 20 77 68 65 6e 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 0a 61 72 65 20 64 6f 6e 65 | .that.when.computations.are.done |
| 3e3e0 | 20 77 69 74 68 20 73 75 63 68 20 61 70 70 72 6f 78 69 6d 61 74 65 20 71 75 61 6e 74 69 74 69 65 | .with.such.approximate.quantitie |
| 3e400 | 73 20 74 68 65 20 72 65 73 75 6c 74 73 20 77 69 6c 6c 20 62 65 20 6e 75 6d 62 65 72 73 0a 6f 66 | s.the.results.will.be.numbers.of |
| 3e420 | 20 6b 6e 6f 77 6e 20 70 72 65 63 69 73 69 6f 6e 2e 0a 0a 20 20 20 45 6c 65 63 74 72 69 63 61 6c | .known.precision......Electrical |
| 3e440 | 20 65 6e 67 69 6e 65 65 72 73 20 77 69 6c 6c 20 62 65 20 75 73 69 6e 67 20 41 6c 79 73 73 61 27 | .engineers.will.be.using.Alyssa' |
| 3e460 | 73 20 73 79 73 74 65 6d 20 74 6f 20 63 6f 6d 70 75 74 65 0a 65 6c 65 63 74 72 69 63 61 6c 20 71 | s.system.to.compute.electrical.q |
| 3e480 | 75 61 6e 74 69 74 69 65 73 2e 20 20 49 74 20 69 73 20 73 6f 6d 65 74 69 6d 65 73 20 6e 65 63 65 | uantities...It.is.sometimes.nece |
| 3e4a0 | 73 73 61 72 79 20 66 6f 72 20 74 68 65 6d 20 74 6f 20 63 6f 6d 70 75 74 65 0a 74 68 65 20 76 61 | ssary.for.them.to.compute.the.va |
| 3e4c0 | 6c 75 65 20 6f 66 20 61 20 70 61 72 61 6c 6c 65 6c 20 65 71 75 69 76 61 6c 65 6e 74 20 72 65 73 | lue.of.a.parallel.equivalent.res |
| 3e4e0 | 69 73 74 61 6e 63 65 20 52 5f 70 20 6f 66 20 74 77 6f 20 72 65 73 69 73 74 6f 72 73 20 52 5f 31 | istance.R_p.of.two.resistors.R_1 |
| 3e500 | 0a 61 6e 64 20 52 5f 32 20 75 73 69 6e 67 20 74 68 65 20 66 6f 72 6d 75 6c 61 0a 0a 20 20 20 20 | .and.R_2.using.the.formula...... |
| 3e520 | 20 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 52 5f 70 20 3d 20 2d 2d 2d 2d 2d 2d | .............1......R_p.=.------ |
| 3e540 | 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 31 2f 52 5f 31 20 2b 20 31 2f 52 5f 32 | -------............1/R_1.+.1/R_2 |
| 3e560 | 0a 0a 20 20 20 52 65 73 69 73 74 61 6e 63 65 20 76 61 6c 75 65 73 20 61 72 65 20 75 73 75 61 6c | .....Resistance.values.are.usual |
| 3e580 | 6c 79 20 6b 6e 6f 77 6e 20 6f 6e 6c 79 20 75 70 20 74 6f 20 73 6f 6d 65 20 74 6f 6c 65 72 61 6e | ly.known.only.up.to.some.toleran |
| 3e5a0 | 63 65 0a 67 75 61 72 61 6e 74 65 65 64 20 62 79 20 74 68 65 20 6d 61 6e 75 66 61 63 74 75 72 65 | ce.guaranteed.by.the.manufacture |
| 3e5c0 | 72 20 6f 66 20 74 68 65 20 72 65 73 69 73 74 6f 72 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c | r.of.the.resistor...For.example, |
| 3e5e0 | 20 69 66 20 79 6f 75 0a 62 75 79 20 61 20 72 65 73 69 73 74 6f 72 20 6c 61 62 65 6c 65 64 20 22 | .if.you.buy.a.resistor.labeled." |
| 3e600 | 36 2e 38 20 6f 68 6d 73 20 77 69 74 68 20 31 30 25 20 74 6f 6c 65 72 61 6e 63 65 22 20 79 6f 75 | 6.8.ohms.with.10%.tolerance".you |
| 3e620 | 20 63 61 6e 20 6f 6e 6c 79 20 62 65 0a 73 75 72 65 20 74 68 61 74 20 74 68 65 20 72 65 73 69 73 | .can.only.be.sure.that.the.resis |
| 3e640 | 74 6f 72 20 68 61 73 20 61 20 72 65 73 69 73 74 61 6e 63 65 20 62 65 74 77 65 65 6e 20 36 2e 38 | tor.has.a.resistance.between.6.8 |
| 3e660 | 20 2d 20 30 2e 36 38 20 3d 20 36 2e 31 32 20 61 6e 64 0a 36 2e 38 20 2b 20 30 2e 36 38 20 3d 20 | .-.0.68.=.6.12.and.6.8.+.0.68.=. |
| 3e680 | 37 2e 34 38 20 6f 68 6d 73 2e 20 20 54 68 75 73 2c 20 69 66 20 79 6f 75 20 68 61 76 65 20 61 20 | 7.48.ohms...Thus,.if.you.have.a. |
| 3e6a0 | 36 2e 38 2d 6f 68 6d 20 31 30 25 20 72 65 73 69 73 74 6f 72 20 69 6e 0a 70 61 72 61 6c 6c 65 6c | 6.8-ohm.10%.resistor.in.parallel |
| 3e6c0 | 20 77 69 74 68 20 61 20 34 2e 37 2d 6f 68 6d 20 35 25 20 72 65 73 69 73 74 6f 72 2c 20 74 68 65 | .with.a.4.7-ohm.5%.resistor,.the |
| 3e6e0 | 20 72 65 73 69 73 74 61 6e 63 65 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 0a 63 | .resistance.of.the.combination.c |
| 3e700 | 61 6e 20 72 61 6e 67 65 20 66 72 6f 6d 20 61 62 6f 75 74 20 32 2e 35 38 20 6f 68 6d 73 20 28 69 | an.range.from.about.2.58.ohms.(i |
| 3e720 | 66 20 74 68 65 20 74 77 6f 20 72 65 73 69 73 74 6f 72 73 20 61 72 65 20 61 74 20 74 68 65 20 6c | f.the.two.resistors.are.at.the.l |
| 3e740 | 6f 77 65 72 0a 62 6f 75 6e 64 73 29 20 74 6f 20 61 62 6f 75 74 20 32 2e 39 37 20 6f 68 6d 73 20 | ower.bounds).to.about.2.97.ohms. |
| 3e760 | 28 69 66 20 74 68 65 20 74 77 6f 20 72 65 73 69 73 74 6f 72 73 20 61 72 65 20 61 74 20 74 68 65 | (if.the.two.resistors.are.at.the |
| 3e780 | 20 75 70 70 65 72 0a 62 6f 75 6e 64 73 29 2e 0a 0a 20 20 20 41 6c 79 73 73 61 27 73 20 69 64 65 | .upper.bounds)......Alyssa's.ide |
| 3e7a0 | 61 20 69 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 22 69 6e 74 65 72 76 61 6c 20 61 72 69 74 | a.is.to.implement."interval.arit |
| 3e7c0 | 68 6d 65 74 69 63 22 20 61 73 20 61 20 73 65 74 20 6f 66 0a 61 72 69 74 68 6d 65 74 69 63 20 6f | hmetic".as.a.set.of.arithmetic.o |
| 3e7e0 | 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 63 6f 6d 62 69 6e 69 6e 67 20 22 69 6e 74 65 72 76 61 | perations.for.combining."interva |
| 3e800 | 6c 73 22 20 28 6f 62 6a 65 63 74 73 20 74 68 61 74 20 72 65 70 72 65 73 65 6e 74 0a 74 68 65 20 | ls".(objects.that.represent.the. |
| 3e820 | 72 61 6e 67 65 20 6f 66 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 20 6f 66 20 61 6e 20 69 | range.of.possible.values.of.an.i |
| 3e840 | 6e 65 78 61 63 74 20 71 75 61 6e 74 69 74 79 29 2e 20 20 54 68 65 20 72 65 73 75 6c 74 20 6f 66 | nexact.quantity)...The.result.of |
| 3e860 | 0a 61 64 64 69 6e 67 2c 20 73 75 62 74 72 61 63 74 69 6e 67 2c 20 6d 75 6c 74 69 70 6c 79 69 6e | .adding,.subtracting,.multiplyin |
| 3e880 | 67 2c 20 6f 72 20 64 69 76 69 64 69 6e 67 20 74 77 6f 20 69 6e 74 65 72 76 61 6c 73 20 69 73 20 | g,.or.dividing.two.intervals.is. |
| 3e8a0 | 69 74 73 65 6c 66 0a 61 6e 20 69 6e 74 65 72 76 61 6c 2c 20 72 65 70 72 65 73 65 6e 74 69 6e 67 | itself.an.interval,.representing |
| 3e8c0 | 20 74 68 65 20 72 61 6e 67 65 20 6f 66 20 74 68 65 20 72 65 73 75 6c 74 2e 0a 0a 20 20 20 41 6c | .the.range.of.the.result......Al |
| 3e8e0 | 79 73 73 61 20 70 6f 73 74 75 6c 61 74 65 73 20 74 68 65 20 65 78 69 73 74 65 6e 63 65 20 6f 66 | yssa.postulates.the.existence.of |
| 3e900 | 20 61 6e 20 61 62 73 74 72 61 63 74 20 6f 62 6a 65 63 74 20 63 61 6c 6c 65 64 20 61 6e 0a 22 69 | .an.abstract.object.called.an."i |
| 3e920 | 6e 74 65 72 76 61 6c 22 20 74 68 61 74 20 68 61 73 20 74 77 6f 20 65 6e 64 70 6f 69 6e 74 73 3a | nterval".that.has.two.endpoints: |
| 3e940 | 20 61 20 6c 6f 77 65 72 20 62 6f 75 6e 64 20 61 6e 64 20 61 6e 20 75 70 70 65 72 20 62 6f 75 6e | .a.lower.bound.and.an.upper.boun |
| 3e960 | 64 2e 0a 53 68 65 20 61 6c 73 6f 20 70 72 65 73 75 6d 65 73 20 74 68 61 74 2c 20 67 69 76 65 6e | d..She.also.presumes.that,.given |
| 3e980 | 20 74 68 65 20 65 6e 64 70 6f 69 6e 74 73 20 6f 66 20 61 6e 20 69 6e 74 65 72 76 61 6c 2c 20 73 | .the.endpoints.of.an.interval,.s |
| 3e9a0 | 68 65 20 63 61 6e 0a 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 69 6e 74 65 72 76 61 6c 20 75 73 | he.can.construct.the.interval.us |
| 3e9c0 | 69 6e 67 20 74 68 65 20 64 61 74 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 6d 61 6b 65 2d 69 | ing.the.data.constructor.`make-i |
| 3e9e0 | 6e 74 65 72 76 61 6c 27 2e 0a 41 6c 79 73 73 61 20 66 69 72 73 74 20 77 72 69 74 65 73 20 61 20 | nterval'..Alyssa.first.writes.a. |
| 3ea00 | 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 61 64 64 69 6e 67 20 74 77 6f 20 69 6e 74 65 72 76 61 | procedure.for.adding.two.interva |
| 3ea20 | 6c 73 2e 20 20 53 68 65 20 72 65 61 73 6f 6e 73 0a 74 68 61 74 20 74 68 65 20 6d 69 6e 69 6d 75 | ls...She.reasons.that.the.minimu |
| 3ea40 | 6d 20 76 61 6c 75 65 20 74 68 65 20 73 75 6d 20 63 6f 75 6c 64 20 62 65 20 69 73 20 74 68 65 20 | m.value.the.sum.could.be.is.the. |
| 3ea60 | 73 75 6d 20 6f 66 20 74 68 65 20 74 77 6f 20 6c 6f 77 65 72 0a 62 6f 75 6e 64 73 20 61 6e 64 20 | sum.of.the.two.lower.bounds.and. |
| 3ea80 | 74 68 65 20 6d 61 78 69 6d 75 6d 20 76 61 6c 75 65 20 69 74 20 63 6f 75 6c 64 20 62 65 20 69 73 | the.maximum.value.it.could.be.is |
| 3eaa0 | 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 74 77 6f 20 75 70 70 65 72 0a 62 6f 75 6e 64 73 | .the.sum.of.the.two.upper.bounds |
| 3eac0 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 69 6e 74 65 72 76 61 6c 20 78 20 | :.......(define.(add-interval.x. |
| 3eae0 | 79 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 74 65 72 76 61 6c 20 28 2b 20 28 6c 6f 77 | y)........(make-interval.(+.(low |
| 3eb00 | 65 72 2d 62 6f 75 6e 64 20 78 29 20 28 6c 6f 77 65 72 2d 62 6f 75 6e 64 20 79 29 29 0a 20 20 20 | er-bound.x).(lower-bound.y)).... |
| 3eb20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 75 70 70 65 72 2d 62 6f 75 | ...................(+.(upper-bou |
| 3eb40 | 6e 64 20 78 29 20 28 75 70 70 65 72 2d 62 6f 75 6e 64 20 79 29 29 29 29 0a 0a 20 20 20 41 6c 79 | nd.x).(upper-bound.y)))).....Aly |
| 3eb60 | 73 73 61 20 61 6c 73 6f 20 77 6f 72 6b 73 20 6f 75 74 20 74 68 65 20 70 72 6f 64 75 63 74 20 6f | ssa.also.works.out.the.product.o |
| 3eb80 | 66 20 74 77 6f 20 69 6e 74 65 72 76 61 6c 73 20 62 79 20 66 69 6e 64 69 6e 67 20 74 68 65 0a 6d | f.two.intervals.by.finding.the.m |
| 3eba0 | 69 6e 69 6d 75 6d 20 61 6e 64 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 6f 66 20 74 68 65 20 70 72 | inimum.and.the.maximum.of.the.pr |
| 3ebc0 | 6f 64 75 63 74 73 20 6f 66 20 74 68 65 20 62 6f 75 6e 64 73 20 61 6e 64 20 75 73 69 6e 67 20 74 | oducts.of.the.bounds.and.using.t |
| 3ebe0 | 68 65 6d 20 61 73 0a 74 68 65 20 62 6f 75 6e 64 73 20 6f 66 20 74 68 65 20 72 65 73 75 6c 74 69 | hem.as.the.bounds.of.the.resulti |
| 3ec00 | 6e 67 20 69 6e 74 65 72 76 61 6c 2e 20 20 28 60 4d 69 6e 27 20 61 6e 64 20 60 6d 61 78 27 20 61 | ng.interval...(`Min'.and.`max'.a |
| 3ec20 | 72 65 20 70 72 69 6d 69 74 69 76 65 73 0a 74 68 61 74 20 66 69 6e 64 20 74 68 65 20 6d 69 6e 69 | re.primitives.that.find.the.mini |
| 3ec40 | 6d 75 6d 20 6f 72 20 6d 61 78 69 6d 75 6d 20 6f 66 20 61 6e 79 20 6e 75 6d 62 65 72 20 6f 66 20 | mum.or.maximum.of.any.number.of. |
| 3ec60 | 61 72 67 75 6d 65 6e 74 73 2e 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 2d 69 | arguments.).......(define.(mul-i |
| 3ec80 | 6e 74 65 72 76 61 6c 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 31 20 28 2a | nterval.x.y)........(let.((p1.(* |
| 3eca0 | 20 28 6c 6f 77 65 72 2d 62 6f 75 6e 64 20 78 29 20 28 6c 6f 77 65 72 2d 62 6f 75 6e 64 20 79 29 | .(lower-bound.x).(lower-bound.y) |
| 3ecc0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 32 20 28 2a 20 28 6c 6f 77 65 72 2d 62 6f | ))..............(p2.(*.(lower-bo |
| 3ece0 | 75 6e 64 20 78 29 20 28 75 70 70 65 72 2d 62 6f 75 6e 64 20 79 29 29 29 0a 20 20 20 20 20 20 20 | und.x).(upper-bound.y)))........ |
| 3ed00 | 20 20 20 20 20 20 28 70 33 20 28 2a 20 28 75 70 70 65 72 2d 62 6f 75 6e 64 20 78 29 20 28 6c 6f | ......(p3.(*.(upper-bound.x).(lo |
| 3ed20 | 77 65 72 2d 62 6f 75 6e 64 20 79 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 34 20 | wer-bound.y)))..............(p4. |
| 3ed40 | 28 2a 20 28 75 70 70 65 72 2d 62 6f 75 6e 64 20 78 29 20 28 75 70 70 65 72 2d 62 6f 75 6e 64 20 | (*.(upper-bound.x).(upper-bound. |
| 3ed60 | 79 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 74 65 72 76 61 6c 20 28 6d | y))))..........(make-interval.(m |
| 3ed80 | 69 6e 20 70 31 20 70 32 20 70 33 20 70 34 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | in.p1.p2.p3.p4)................. |
| 3eda0 | 20 20 20 20 20 20 20 20 28 6d 61 78 20 70 31 20 70 32 20 70 33 20 70 34 29 29 29 29 0a 0a 20 20 | ........(max.p1.p2.p3.p4)))).... |
| 3edc0 | 20 54 6f 20 64 69 76 69 64 65 20 74 77 6f 20 69 6e 74 65 72 76 61 6c 73 2c 20 41 6c 79 73 73 61 | .To.divide.two.intervals,.Alyssa |
| 3ede0 | 20 6d 75 6c 74 69 70 6c 69 65 73 20 74 68 65 20 66 69 72 73 74 20 62 79 20 74 68 65 0a 72 65 63 | .multiplies.the.first.by.the.rec |
| 3ee00 | 69 70 72 6f 63 61 6c 20 6f 66 20 74 68 65 20 73 65 63 6f 6e 64 2e 20 20 4e 6f 74 65 20 74 68 61 | iprocal.of.the.second...Note.tha |
| 3ee20 | 74 20 74 68 65 20 62 6f 75 6e 64 73 20 6f 66 20 74 68 65 20 72 65 63 69 70 72 6f 63 61 6c 0a 69 | t.the.bounds.of.the.reciprocal.i |
| 3ee40 | 6e 74 65 72 76 61 6c 20 61 72 65 20 74 68 65 20 72 65 63 69 70 72 6f 63 61 6c 20 6f 66 20 74 68 | nterval.are.the.reciprocal.of.th |
| 3ee60 | 65 20 75 70 70 65 72 20 62 6f 75 6e 64 20 61 6e 64 20 74 68 65 20 72 65 63 69 70 72 6f 63 61 6c | e.upper.bound.and.the.reciprocal |
| 3ee80 | 20 6f 66 0a 74 68 65 20 6c 6f 77 65 72 20 62 6f 75 6e 64 2c 20 69 6e 20 74 68 61 74 20 6f 72 64 | .of.the.lower.bound,.in.that.ord |
| 3eea0 | 65 72 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 76 2d 69 6e 74 65 72 76 61 6c 20 | er........(define.(div-interval. |
| 3eec0 | 78 20 79 29 0a 20 20 20 20 20 20 20 28 6d 75 6c 2d 69 6e 74 65 72 76 61 6c 20 78 0a 20 20 20 20 | x.y)........(mul-interval.x..... |
| 3eee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 74 65 72 76 61 6c 20 | .................(make-interval. |
| 3ef00 | 28 2f 20 31 2e 30 20 28 75 70 70 65 72 2d 62 6f 75 6e 64 20 79 29 29 0a 20 20 20 20 20 20 20 20 | (/.1.0.(upper-bound.y))......... |
| 3ef20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2f 20 31 | ............................(/.1 |
| 3ef40 | 2e 30 20 28 6c 6f 77 65 72 2d 62 6f 75 6e 64 20 79 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 | .0.(lower-bound.y))))).......*Ex |
| 3ef60 | 65 72 63 69 73 65 20 32 2e 37 3a 2a 20 41 6c 79 73 73 61 27 73 20 70 72 6f 67 72 61 6d 20 69 73 | ercise.2.7:*.Alyssa's.program.is |
| 3ef80 | 20 69 6e 63 6f 6d 70 6c 65 74 65 20 62 65 63 61 75 73 65 20 73 68 65 20 68 61 73 20 6e 6f 74 0a | .incomplete.because.she.has.not. |
| 3efa0 | 20 20 20 20 20 73 70 65 63 69 66 69 65 64 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | .....specified.the.implementatio |
| 3efc0 | 6e 20 6f 66 20 74 68 65 20 69 6e 74 65 72 76 61 6c 20 61 62 73 74 72 61 63 74 69 6f 6e 2e 20 20 | n.of.the.interval.abstraction... |
| 3efe0 | 48 65 72 65 20 69 73 0a 20 20 20 20 20 61 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 | Here.is......a.definition.of.the |
| 3f000 | 20 69 6e 74 65 72 76 61 6c 20 63 6f 6e 73 74 72 75 63 74 6f 72 3a 0a 0a 20 20 20 20 20 20 20 20 | .interval.constructor:.......... |
| 3f020 | 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 69 6e 74 65 72 76 61 6c 20 61 20 62 29 20 28 63 | ..(define.(make-interval.a.b).(c |
| 3f040 | 6f 6e 73 20 61 20 62 29 29 0a 0a 20 20 20 20 20 44 65 66 69 6e 65 20 73 65 6c 65 63 74 6f 72 73 | ons.a.b)).......Define.selectors |
| 3f060 | 20 60 75 70 70 65 72 2d 62 6f 75 6e 64 27 20 61 6e 64 20 60 6c 6f 77 65 72 2d 62 6f 75 6e 64 27 | .`upper-bound'.and.`lower-bound' |
| 3f080 | 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 65 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 61 | .to.complete.the......implementa |
| 3f0a0 | 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 38 3a 2a 20 55 73 69 6e | tion........*Exercise.2.8:*.Usin |
| 3f0c0 | 67 20 72 65 61 73 6f 6e 69 6e 67 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 41 6c 79 73 73 61 27 | g.reasoning.analogous.to.Alyssa' |
| 3f0e0 | 73 2c 20 64 65 73 63 72 69 62 65 0a 20 20 20 20 20 68 6f 77 20 74 68 65 20 64 69 66 66 65 72 65 | s,.describe......how.the.differe |
| 3f100 | 6e 63 65 20 6f 66 20 74 77 6f 20 69 6e 74 65 72 76 61 6c 73 20 6d 61 79 20 62 65 20 63 6f 6d 70 | nce.of.two.intervals.may.be.comp |
| 3f120 | 75 74 65 64 2e 20 20 44 65 66 69 6e 65 20 61 0a 20 20 20 20 20 63 6f 72 72 65 73 70 6f 6e 64 69 | uted...Define.a......correspondi |
| 3f140 | 6e 67 20 73 75 62 74 72 61 63 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 2c 20 63 61 6c 6c 65 64 | ng.subtraction.procedure,.called |
| 3f160 | 20 60 73 75 62 2d 69 6e 74 65 72 76 61 6c 27 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | .`sub-interval'........*Exercise |
| 3f180 | 20 32 2e 39 3a 2a 20 54 68 65 20 22 77 69 64 74 68 22 20 6f 66 20 61 6e 20 69 6e 74 65 72 76 61 | .2.9:*.The."width".of.an.interva |
| 3f1a0 | 6c 20 69 73 20 68 61 6c 66 20 6f 66 20 74 68 65 0a 20 20 20 20 20 64 69 66 66 65 72 65 6e 63 65 | l.is.half.of.the......difference |
| 3f1c0 | 20 62 65 74 77 65 65 6e 20 69 74 73 20 75 70 70 65 72 20 61 6e 64 20 6c 6f 77 65 72 20 62 6f 75 | .between.its.upper.and.lower.bou |
| 3f1e0 | 6e 64 73 2e 20 20 54 68 65 20 77 69 64 74 68 20 69 73 20 61 0a 20 20 20 20 20 6d 65 61 73 75 72 | nds...The.width.is.a......measur |
| 3f200 | 65 20 6f 66 20 74 68 65 20 75 6e 63 65 72 74 61 69 6e 74 79 20 6f 66 20 74 68 65 20 6e 75 6d 62 | e.of.the.uncertainty.of.the.numb |
| 3f220 | 65 72 20 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 0a 20 20 20 20 20 69 6e 74 65 72 76 61 | er.specified.by.the......interva |
| 3f240 | 6c 2e 20 20 46 6f 72 20 73 6f 6d 65 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f | l...For.some.arithmetic.operatio |
| 3f260 | 6e 73 20 74 68 65 20 77 69 64 74 68 20 6f 66 20 74 68 65 20 72 65 73 75 6c 74 0a 20 20 20 20 20 | ns.the.width.of.the.result...... |
| 3f280 | 6f 66 20 63 6f 6d 62 69 6e 69 6e 67 20 74 77 6f 20 69 6e 74 65 72 76 61 6c 73 20 69 73 20 61 20 | of.combining.two.intervals.is.a. |
| 3f2a0 | 66 75 6e 63 74 69 6f 6e 20 6f 6e 6c 79 20 6f 66 20 74 68 65 20 77 69 64 74 68 73 20 6f 66 20 74 | function.only.of.the.widths.of.t |
| 3f2c0 | 68 65 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 20 69 6e 74 65 72 76 61 6c 73 2c 20 77 68 65 72 | he......argument.intervals,.wher |
| 3f2e0 | 65 61 73 20 66 6f 72 20 6f 74 68 65 72 73 20 74 68 65 20 77 69 64 74 68 20 6f 66 20 74 68 65 0a | eas.for.others.the.width.of.the. |
| 3f300 | 20 20 20 20 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 69 73 20 6e 6f 74 20 61 20 66 75 6e 63 74 69 | .....combination.is.not.a.functi |
| 3f320 | 6f 6e 20 6f 66 20 74 68 65 20 77 69 64 74 68 73 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 | on.of.the.widths.of.the.argument |
| 3f340 | 0a 20 20 20 20 20 69 6e 74 65 72 76 61 6c 73 2e 20 20 53 68 6f 77 20 74 68 61 74 20 74 68 65 20 | ......intervals...Show.that.the. |
| 3f360 | 77 69 64 74 68 20 6f 66 20 74 68 65 20 73 75 6d 20 28 6f 72 20 64 69 66 66 65 72 65 6e 63 65 29 | width.of.the.sum.(or.difference) |
| 3f380 | 20 6f 66 20 74 77 6f 0a 20 20 20 20 20 69 6e 74 65 72 76 61 6c 73 20 69 73 20 61 20 66 75 6e 63 | .of.two......intervals.is.a.func |
| 3f3a0 | 74 69 6f 6e 20 6f 6e 6c 79 20 6f 66 20 74 68 65 20 77 69 64 74 68 73 20 6f 66 20 74 68 65 20 69 | tion.only.of.the.widths.of.the.i |
| 3f3c0 | 6e 74 65 72 76 61 6c 73 20 62 65 69 6e 67 0a 20 20 20 20 20 61 64 64 65 64 20 28 6f 72 20 73 75 | ntervals.being......added.(or.su |
| 3f3e0 | 62 74 72 61 63 74 65 64 29 2e 20 20 47 69 76 65 20 65 78 61 6d 70 6c 65 73 20 74 6f 20 73 68 6f | btracted)...Give.examples.to.sho |
| 3f400 | 77 20 74 68 61 74 20 74 68 69 73 20 69 73 20 6e 6f 74 0a 20 20 20 20 20 74 72 75 65 20 66 6f 72 | w.that.this.is.not......true.for |
| 3f420 | 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 20 6f 72 20 64 69 76 69 73 69 6f 6e 2e 0a 0a 20 20 | .multiplication.or.division..... |
| 3f440 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 31 30 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 64 6c | ...*Exercise.2.10:*.Ben.Bitdiddl |
| 3f460 | 65 2c 20 61 6e 20 65 78 70 65 72 74 20 73 79 73 74 65 6d 73 20 70 72 6f 67 72 61 6d 6d 65 72 2c | e,.an.expert.systems.programmer, |
| 3f480 | 0a 20 20 20 20 20 6c 6f 6f 6b 73 20 6f 76 65 72 20 41 6c 79 73 73 61 27 73 20 73 68 6f 75 6c 64 | ......looks.over.Alyssa's.should |
| 3f4a0 | 65 72 20 61 6e 64 20 63 6f 6d 6d 65 6e 74 73 20 74 68 61 74 20 69 74 20 69 73 20 6e 6f 74 20 63 | er.and.comments.that.it.is.not.c |
| 3f4c0 | 6c 65 61 72 20 77 68 61 74 0a 20 20 20 20 20 69 74 20 6d 65 61 6e 73 20 74 6f 20 64 69 76 69 64 | lear.what......it.means.to.divid |
| 3f4e0 | 65 20 62 79 20 61 6e 20 69 6e 74 65 72 76 61 6c 20 74 68 61 74 20 73 70 61 6e 73 20 7a 65 72 6f | e.by.an.interval.that.spans.zero |
| 3f500 | 2e 20 20 4d 6f 64 69 66 79 0a 20 20 20 20 20 41 6c 79 73 73 61 27 73 20 63 6f 64 65 20 74 6f 20 | ...Modify......Alyssa's.code.to. |
| 3f520 | 63 68 65 63 6b 20 66 6f 72 20 74 68 69 73 20 63 6f 6e 64 69 74 69 6f 6e 20 61 6e 64 20 74 6f 20 | check.for.this.condition.and.to. |
| 3f540 | 73 69 67 6e 61 6c 20 61 6e 20 65 72 72 6f 72 0a 20 20 20 20 20 69 66 20 69 74 20 6f 63 63 75 72 | signal.an.error......if.it.occur |
| 3f560 | 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 31 31 3a 2a 20 49 6e 20 70 61 73 | s........*Exercise.2.11:*.In.pas |
| 3f580 | 73 69 6e 67 2c 20 42 65 6e 20 61 6c 73 6f 20 63 72 79 70 74 69 63 61 6c 6c 79 20 63 6f 6d 6d 65 | sing,.Ben.also.cryptically.comme |
| 3f5a0 | 6e 74 73 3a 20 22 42 79 0a 20 20 20 20 20 74 65 73 74 69 6e 67 20 74 68 65 20 73 69 67 6e 73 20 | nts:."By......testing.the.signs. |
| 3f5c0 | 6f 66 20 74 68 65 20 65 6e 64 70 6f 69 6e 74 73 20 6f 66 20 74 68 65 20 69 6e 74 65 72 76 61 6c | of.the.endpoints.of.the.interval |
| 3f5e0 | 73 2c 20 69 74 20 69 73 0a 20 20 20 20 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 62 72 65 61 6b 20 | s,.it.is......possible.to.break. |
| 3f600 | 60 6d 75 6c 2d 69 6e 74 65 72 76 61 6c 27 20 69 6e 74 6f 20 6e 69 6e 65 20 63 61 73 65 73 2c 20 | `mul-interval'.into.nine.cases,. |
| 3f620 | 6f 6e 6c 79 20 6f 6e 65 20 6f 66 20 77 68 69 63 68 0a 20 20 20 20 20 72 65 71 75 69 72 65 73 20 | only.one.of.which......requires. |
| 3f640 | 6d 6f 72 65 20 74 68 61 6e 20 74 77 6f 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 2e 22 20 | more.than.two.multiplications.". |
| 3f660 | 20 52 65 77 72 69 74 65 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 75 73 69 | .Rewrite.this.procedure......usi |
| 3f680 | 6e 67 20 42 65 6e 27 73 20 73 75 67 67 65 73 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 41 66 74 65 72 | ng.Ben's.suggestion........After |
| 3f6a0 | 20 64 65 62 75 67 67 69 6e 67 20 68 65 72 20 70 72 6f 67 72 61 6d 2c 20 41 6c 79 73 73 61 20 73 | .debugging.her.program,.Alyssa.s |
| 3f6c0 | 68 6f 77 73 20 69 74 20 74 6f 20 61 20 70 6f 74 65 6e 74 69 61 6c 20 75 73 65 72 2c 0a 20 20 20 | hows.it.to.a.potential.user,.... |
| 3f6e0 | 20 20 77 68 6f 20 63 6f 6d 70 6c 61 69 6e 73 20 74 68 61 74 20 68 65 72 20 70 72 6f 67 72 61 6d | ..who.complains.that.her.program |
| 3f700 | 20 73 6f 6c 76 65 73 20 74 68 65 20 77 72 6f 6e 67 20 70 72 6f 62 6c 65 6d 2e 20 20 48 65 20 77 | .solves.the.wrong.problem...He.w |
| 3f720 | 61 6e 74 73 0a 20 20 20 20 20 61 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 63 61 6e 20 64 65 61 | ants......a.program.that.can.dea |
| 3f740 | 6c 20 77 69 74 68 20 6e 75 6d 62 65 72 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 | l.with.numbers.represented.as.a. |
| 3f760 | 63 65 6e 74 65 72 20 76 61 6c 75 65 0a 20 20 20 20 20 61 6e 64 20 61 6e 20 61 64 64 69 74 69 76 | center.value......and.an.additiv |
| 3f780 | 65 20 74 6f 6c 65 72 61 6e 63 65 3b 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 68 65 20 77 61 6e | e.tolerance;.for.example,.he.wan |
| 3f7a0 | 74 73 20 74 6f 20 77 6f 72 6b 20 77 69 74 68 0a 20 20 20 20 20 69 6e 74 65 72 76 61 6c 73 20 73 | ts.to.work.with......intervals.s |
| 3f7c0 | 75 63 68 20 61 73 20 33 2e 35 20 2b 2f 2d 20 30 2e 31 35 20 72 61 74 68 65 72 20 74 68 61 6e 20 | uch.as.3.5.+/-.0.15.rather.than. |
| 3f7e0 | 5b 33 2e 33 35 2c 20 33 2e 36 35 5d 2e 20 20 41 6c 79 73 73 61 0a 20 20 20 20 20 72 65 74 75 72 | [3.35,.3.65]...Alyssa......retur |
| 3f800 | 6e 73 20 74 6f 20 68 65 72 20 64 65 73 6b 20 61 6e 64 20 66 69 78 65 73 20 74 68 69 73 20 70 72 | ns.to.her.desk.and.fixes.this.pr |
| 3f820 | 6f 62 6c 65 6d 20 62 79 20 73 75 70 70 6c 79 69 6e 67 20 61 6e 0a 20 20 20 20 20 61 6c 74 65 72 | oblem.by.supplying.an......alter |
| 3f840 | 6e 61 74 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 61 6e 64 20 61 6c 74 65 72 6e 61 74 65 20 73 | nate.constructor.and.alternate.s |
| 3f860 | 65 6c 65 63 74 6f 72 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 | electors:............(define.(ma |
| 3f880 | 6b 65 2d 63 65 6e 74 65 72 2d 77 69 64 74 68 20 63 20 77 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ke-center-width.c.w)............ |
| 3f8a0 | 20 28 6d 61 6b 65 2d 69 6e 74 65 72 76 61 6c 20 28 2d 20 63 20 77 29 20 28 2b 20 63 20 77 29 29 | .(make-interval.(-.c.w).(+.c.w)) |
| 3f8c0 | 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 65 6e 74 65 72 20 69 29 0a | )............(define.(center.i). |
| 3f8e0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 2f 20 28 2b 20 28 6c 6f 77 65 72 2d 62 6f 75 6e 64 20 69 | ............(/.(+.(lower-bound.i |
| 3f900 | 29 20 28 75 70 70 65 72 2d 62 6f 75 6e 64 20 69 29 29 20 32 29 29 0a 0a 20 20 20 20 20 20 20 20 | ).(upper-bound.i)).2)).......... |
| 3f920 | 20 20 28 64 65 66 69 6e 65 20 28 77 69 64 74 68 20 69 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..(define.(width.i)............. |
| 3f940 | 28 2f 20 28 2d 20 28 75 70 70 65 72 2d 62 6f 75 6e 64 20 69 29 20 28 6c 6f 77 65 72 2d 62 6f 75 | (/.(-.(upper-bound.i).(lower-bou |
| 3f960 | 6e 64 20 69 29 29 20 32 29 29 0a 0a 20 20 20 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 | nd.i)).2)).......Unfortunately,. |
| 3f980 | 6d 6f 73 74 20 6f 66 20 41 6c 79 73 73 61 27 73 20 75 73 65 72 73 20 61 72 65 20 65 6e 67 69 6e | most.of.Alyssa's.users.are.engin |
| 3f9a0 | 65 65 72 73 2e 20 20 52 65 61 6c 0a 20 20 20 20 20 65 6e 67 69 6e 65 65 72 69 6e 67 20 73 69 74 | eers...Real......engineering.sit |
| 3f9c0 | 75 61 74 69 6f 6e 73 20 75 73 75 61 6c 6c 79 20 69 6e 76 6f 6c 76 65 20 6d 65 61 73 75 72 65 6d | uations.usually.involve.measurem |
| 3f9e0 | 65 6e 74 73 20 77 69 74 68 20 6f 6e 6c 79 20 61 0a 20 20 20 20 20 73 6d 61 6c 6c 20 75 6e 63 65 | ents.with.only.a......small.unce |
| 3fa00 | 72 74 61 69 6e 74 79 2c 20 6d 65 61 73 75 72 65 64 20 61 73 20 74 68 65 20 72 61 74 69 6f 20 6f | rtainty,.measured.as.the.ratio.o |
| 3fa20 | 66 20 74 68 65 20 77 69 64 74 68 20 6f 66 20 74 68 65 0a 20 20 20 20 20 69 6e 74 65 72 76 61 6c | f.the.width.of.the......interval |
| 3fa40 | 20 74 6f 20 74 68 65 20 6d 69 64 70 6f 69 6e 74 20 6f 66 20 74 68 65 20 69 6e 74 65 72 76 61 6c | .to.the.midpoint.of.the.interval |
| 3fa60 | 2e 20 20 45 6e 67 69 6e 65 65 72 73 20 75 73 75 61 6c 6c 79 0a 20 20 20 20 20 73 70 65 63 69 66 | ...Engineers.usually......specif |
| 3fa80 | 79 20 70 65 72 63 65 6e 74 61 67 65 20 74 6f 6c 65 72 61 6e 63 65 73 20 6f 6e 20 74 68 65 20 70 | y.percentage.tolerances.on.the.p |
| 3faa0 | 61 72 61 6d 65 74 65 72 73 20 6f 66 20 64 65 76 69 63 65 73 2c 20 61 73 20 69 6e 0a 20 20 20 20 | arameters.of.devices,.as.in..... |
| 3fac0 | 20 74 68 65 20 72 65 73 69 73 74 6f 72 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 73 20 67 69 76 | .the.resistor.specifications.giv |
| 3fae0 | 65 6e 20 65 61 72 6c 69 65 72 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 31 32 | en.earlier........*Exercise.2.12 |
| 3fb00 | 3a 2a 20 44 65 66 69 6e 65 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 6d 61 6b 65 2d 63 65 | :*.Define.a.constructor.`make-ce |
| 3fb20 | 6e 74 65 72 2d 70 65 72 63 65 6e 74 27 20 74 68 61 74 0a 20 20 20 20 20 74 61 6b 65 73 20 61 20 | nter-percent'.that......takes.a. |
| 3fb40 | 63 65 6e 74 65 72 20 61 6e 64 20 61 20 70 65 72 63 65 6e 74 61 67 65 20 74 6f 6c 65 72 61 6e 63 | center.and.a.percentage.toleranc |
| 3fb60 | 65 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 64 65 73 69 72 65 64 0a 20 20 20 20 20 | e.and.produces.the.desired...... |
| 3fb80 | 69 6e 74 65 72 76 61 6c 2e 20 20 59 6f 75 20 6d 75 73 74 20 61 6c 73 6f 20 64 65 66 69 6e 65 20 | interval...You.must.also.define. |
| 3fba0 | 61 20 73 65 6c 65 63 74 6f 72 20 60 70 65 72 63 65 6e 74 27 20 74 68 61 74 20 70 72 6f 64 75 63 | a.selector.`percent'.that.produc |
| 3fbc0 | 65 73 0a 20 20 20 20 20 74 68 65 20 70 65 72 63 65 6e 74 61 67 65 20 74 6f 6c 65 72 61 6e 63 65 | es......the.percentage.tolerance |
| 3fbe0 | 20 66 6f 72 20 61 20 67 69 76 65 6e 20 69 6e 74 65 72 76 61 6c 2e 20 20 54 68 65 20 60 63 65 6e | .for.a.given.interval...The.`cen |
| 3fc00 | 74 65 72 27 0a 20 20 20 20 20 73 65 6c 65 63 74 6f 72 20 69 73 20 74 68 65 20 73 61 6d 65 20 61 | ter'......selector.is.the.same.a |
| 3fc20 | 73 20 74 68 65 20 6f 6e 65 20 73 68 6f 77 6e 20 61 62 6f 76 65 2e 0a 0a 20 20 20 20 20 2a 45 78 | s.the.one.shown.above........*Ex |
| 3fc40 | 65 72 63 69 73 65 20 32 2e 31 33 3a 2a 20 53 68 6f 77 20 74 68 61 74 20 75 6e 64 65 72 20 74 68 | ercise.2.13:*.Show.that.under.th |
| 3fc60 | 65 20 61 73 73 75 6d 70 74 69 6f 6e 20 6f 66 20 73 6d 61 6c 6c 0a 20 20 20 20 20 70 65 72 63 65 | e.assumption.of.small......perce |
| 3fc80 | 6e 74 61 67 65 20 74 6f 6c 65 72 61 6e 63 65 73 20 74 68 65 72 65 20 69 73 20 61 20 73 69 6d 70 | ntage.tolerances.there.is.a.simp |
| 3fca0 | 6c 65 20 66 6f 72 6d 75 6c 61 20 66 6f 72 20 74 68 65 20 61 70 70 72 6f 78 69 6d 61 74 65 0a 20 | le.formula.for.the.approximate.. |
| 3fcc0 | 20 20 20 20 70 65 72 63 65 6e 74 61 67 65 20 74 6f 6c 65 72 61 6e 63 65 20 6f 66 20 74 68 65 20 | ....percentage.tolerance.of.the. |
| 3fce0 | 70 72 6f 64 75 63 74 20 6f 66 20 74 77 6f 20 69 6e 74 65 72 76 61 6c 73 20 69 6e 20 74 65 72 6d | product.of.two.intervals.in.term |
| 3fd00 | 73 20 6f 66 0a 20 20 20 20 20 74 68 65 20 74 6f 6c 65 72 61 6e 63 65 73 20 6f 66 20 74 68 65 20 | s.of......the.tolerances.of.the. |
| 3fd20 | 66 61 63 74 6f 72 73 2e 20 20 59 6f 75 20 6d 61 79 20 73 69 6d 70 6c 69 66 79 20 74 68 65 20 70 | factors...You.may.simplify.the.p |
| 3fd40 | 72 6f 62 6c 65 6d 20 62 79 0a 20 20 20 20 20 61 73 73 75 6d 69 6e 67 20 74 68 61 74 20 61 6c 6c | roblem.by......assuming.that.all |
| 3fd60 | 20 6e 75 6d 62 65 72 73 20 61 72 65 20 70 6f 73 69 74 69 76 65 2e 0a 0a 20 20 20 20 20 41 66 74 | .numbers.are.positive........Aft |
| 3fd80 | 65 72 20 63 6f 6e 73 69 64 65 72 61 62 6c 65 20 77 6f 72 6b 2c 20 41 6c 79 73 73 61 20 50 2e 20 | er.considerable.work,.Alyssa.P.. |
| 3fda0 | 48 61 63 6b 65 72 20 64 65 6c 69 76 65 72 73 20 68 65 72 20 66 69 6e 69 73 68 65 64 0a 20 20 20 | Hacker.delivers.her.finished.... |
| 3fdc0 | 20 20 73 79 73 74 65 6d 2e 20 20 53 65 76 65 72 61 6c 20 79 65 61 72 73 20 6c 61 74 65 72 2c 20 | ..system...Several.years.later,. |
| 3fde0 | 61 66 74 65 72 20 73 68 65 20 68 61 73 20 66 6f 72 67 6f 74 74 65 6e 20 61 6c 6c 20 61 62 6f 75 | after.she.has.forgotten.all.abou |
| 3fe00 | 74 0a 20 20 20 20 20 69 74 2c 20 73 68 65 20 67 65 74 73 20 61 20 66 72 65 6e 7a 69 65 64 20 63 | t......it,.she.gets.a.frenzied.c |
| 3fe20 | 61 6c 6c 20 66 72 6f 6d 20 61 6e 20 69 72 61 74 65 20 75 73 65 72 2c 20 4c 65 6d 20 45 2e 20 54 | all.from.an.irate.user,.Lem.E..T |
| 3fe40 | 77 65 61 6b 69 74 2e 0a 20 20 20 20 20 49 74 20 73 65 65 6d 73 20 74 68 61 74 20 4c 65 6d 20 68 | weakit.......It.seems.that.Lem.h |
| 3fe60 | 61 73 20 6e 6f 74 69 63 65 64 20 74 68 61 74 20 74 68 65 20 66 6f 72 6d 75 6c 61 20 66 6f 72 20 | as.noticed.that.the.formula.for. |
| 3fe80 | 70 61 72 61 6c 6c 65 6c 0a 20 20 20 20 20 72 65 73 69 73 74 6f 72 73 20 63 61 6e 20 62 65 20 77 | parallel......resistors.can.be.w |
| 3fea0 | 72 69 74 74 65 6e 20 69 6e 20 74 77 6f 20 61 6c 67 65 62 72 61 69 63 61 6c 6c 79 20 65 71 75 69 | ritten.in.two.algebraically.equi |
| 3fec0 | 76 61 6c 65 6e 74 20 77 61 79 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 52 5f 31 20 52 5f 32 | valent.ways:.............R_1.R_2 |
| 3fee0 | 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 52 | ...........---------...........R |
| 3ff00 | 5f 31 20 2b 20 52 5f 32 0a 0a 20 20 20 20 20 61 6e 64 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 | _1.+.R_2.......and.............. |
| 3ff20 | 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 | ....1...........-------------... |
| 3ff40 | 20 20 20 20 20 20 20 20 31 2f 52 5f 31 20 2b 20 31 2f 52 5f 32 0a 0a 20 20 20 20 20 48 65 20 68 | ........1/R_1.+.1/R_2.......He.h |
| 3ff60 | 61 73 20 77 72 69 74 74 65 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 77 6f 20 70 72 6f | as.written.the.following.two.pro |
| 3ff80 | 67 72 61 6d 73 2c 20 65 61 63 68 20 6f 66 20 77 68 69 63 68 20 63 6f 6d 70 75 74 65 73 0a 20 20 | grams,.each.of.which.computes... |
| 3ffa0 | 20 20 20 74 68 65 20 70 61 72 61 6c 6c 65 6c 2d 72 65 73 69 73 74 6f 72 73 20 66 6f 72 6d 75 6c | ...the.parallel-resistors.formul |
| 3ffc0 | 61 20 64 69 66 66 65 72 65 6e 74 6c 79 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e | a.differently:............(defin |
| 3ffe0 | 65 20 28 70 61 72 31 20 72 31 20 72 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 76 2d | e.(par1.r1.r2).............(div- |
| 40000 | 69 6e 74 65 72 76 61 6c 20 28 6d 75 6c 2d 69 6e 74 65 72 76 61 6c 20 72 31 20 72 32 29 0a 20 20 | interval.(mul-interval.r1.r2)... |
| 40020 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 69 6e 74 | ........................(add-int |
| 40040 | 65 72 76 61 6c 20 72 31 20 72 32 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e | erval.r1.r2)))............(defin |
| 40060 | 65 20 28 70 61 72 32 20 72 31 20 72 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 | e.(par2.r1.r2).............(let. |
| 40080 | 28 28 6f 6e 65 20 28 6d 61 6b 65 2d 69 6e 74 65 72 76 61 6c 20 31 20 31 29 29 29 0a 20 20 20 20 | ((one.(make-interval.1.1)))..... |
| 400a0 | 20 20 20 20 20 20 20 20 20 20 28 64 69 76 2d 69 6e 74 65 72 76 61 6c 20 6f 6e 65 0a 20 20 20 20 | ..........(div-interval.one..... |
| 400c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 69 6e 74 | ........................(add-int |
| 400e0 | 65 72 76 61 6c 20 28 64 69 76 2d 69 6e 74 65 72 76 61 6c 20 6f 6e 65 20 72 31 29 0a 20 20 20 20 | erval.(div-interval.one.r1)..... |
| 40100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 40120 | 20 20 20 20 20 20 28 64 69 76 2d 69 6e 74 65 72 76 61 6c 20 6f 6e 65 20 72 32 29 29 29 29 29 0a | ......(div-interval.one.r2))))). |
| 40140 | 0a 20 20 20 20 20 4c 65 6d 20 63 6f 6d 70 6c 61 69 6e 73 20 74 68 61 74 20 41 6c 79 73 73 61 27 | ......Lem.complains.that.Alyssa' |
| 40160 | 73 20 70 72 6f 67 72 61 6d 20 67 69 76 65 73 20 64 69 66 66 65 72 65 6e 74 20 61 6e 73 77 65 72 | s.program.gives.different.answer |
| 40180 | 73 20 66 6f 72 0a 20 20 20 20 20 74 68 65 20 74 77 6f 20 77 61 79 73 20 6f 66 20 63 6f 6d 70 75 | s.for......the.two.ways.of.compu |
| 401a0 | 74 69 6e 67 2e 20 54 68 69 73 20 69 73 20 61 20 73 65 72 69 6f 75 73 20 63 6f 6d 70 6c 61 69 6e | ting..This.is.a.serious.complain |
| 401c0 | 74 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 31 34 3a 2a 20 44 65 6d 6f 6e 73 | t........*Exercise.2.14:*.Demons |
| 401e0 | 74 72 61 74 65 20 74 68 61 74 20 4c 65 6d 20 69 73 20 72 69 67 68 74 2e 20 20 49 6e 76 65 73 74 | trate.that.Lem.is.right...Invest |
| 40200 | 69 67 61 74 65 20 74 68 65 0a 20 20 20 20 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 20 73 | igate.the......behavior.of.the.s |
| 40220 | 79 73 74 65 6d 20 6f 6e 20 61 20 76 61 72 69 65 74 79 20 6f 66 20 61 72 69 74 68 6d 65 74 69 63 | ystem.on.a.variety.of.arithmetic |
| 40240 | 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 0a 20 20 20 20 20 4d 61 6b 65 20 73 6f 6d 65 20 69 6e 74 | .expressions.......Make.some.int |
| 40260 | 65 72 76 61 6c 73 20 41 20 61 6e 64 20 42 2c 20 61 6e 64 20 75 73 65 20 74 68 65 6d 20 69 6e 20 | ervals.A.and.B,.and.use.them.in. |
| 40280 | 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 20 41 | computing.the......expressions.A |
| 402a0 | 2f 41 20 61 6e 64 20 41 2f 42 2e 20 20 59 6f 75 20 77 69 6c 6c 20 67 65 74 20 74 68 65 20 6d 6f | /A.and.A/B...You.will.get.the.mo |
| 402c0 | 73 74 20 69 6e 73 69 67 68 74 20 62 79 20 75 73 69 6e 67 0a 20 20 20 20 20 69 6e 74 65 72 76 61 | st.insight.by.using......interva |
| 402e0 | 6c 73 20 77 68 6f 73 65 20 77 69 64 74 68 20 69 73 20 61 20 73 6d 61 6c 6c 20 70 65 72 63 65 6e | ls.whose.width.is.a.small.percen |
| 40300 | 74 61 67 65 20 6f 66 20 74 68 65 20 63 65 6e 74 65 72 20 76 61 6c 75 65 2e 0a 20 20 20 20 20 45 | tage.of.the.center.value.......E |
| 40320 | 78 61 6d 69 6e 65 20 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 20 74 68 65 20 63 6f 6d 70 75 74 | xamine.the.results.of.the.comput |
| 40340 | 61 74 69 6f 6e 20 69 6e 20 63 65 6e 74 65 72 2d 70 65 72 63 65 6e 74 20 66 6f 72 6d 20 28 73 65 | ation.in.center-percent.form.(se |
| 40360 | 65 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 31 32 3a 3a 29 2e 0a 0a | e......*Note.Exercise.2-12::)... |
| 40380 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 31 35 3a 2a 20 45 76 61 20 4c 75 20 41 74 6f | .....*Exercise.2.15:*.Eva.Lu.Ato |
| 403a0 | 72 2c 20 61 6e 6f 74 68 65 72 20 75 73 65 72 2c 20 68 61 73 20 61 6c 73 6f 20 6e 6f 74 69 63 65 | r,.another.user,.has.also.notice |
| 403c0 | 64 20 74 68 65 0a 20 20 20 20 20 64 69 66 66 65 72 65 6e 74 20 69 6e 74 65 72 76 61 6c 73 20 63 | d.the......different.intervals.c |
| 403e0 | 6f 6d 70 75 74 65 64 20 62 79 20 64 69 66 66 65 72 65 6e 74 20 62 75 74 20 61 6c 67 65 62 72 61 | omputed.by.different.but.algebra |
| 40400 | 69 63 61 6c 6c 79 0a 20 20 20 20 20 65 71 75 69 76 61 6c 65 6e 74 20 65 78 70 72 65 73 73 69 6f | ically......equivalent.expressio |
| 40420 | 6e 73 2e 20 53 68 65 20 73 61 79 73 20 74 68 61 74 20 61 20 66 6f 72 6d 75 6c 61 20 74 6f 20 63 | ns..She.says.that.a.formula.to.c |
| 40440 | 6f 6d 70 75 74 65 20 77 69 74 68 0a 20 20 20 20 20 69 6e 74 65 72 76 61 6c 73 20 75 73 69 6e 67 | ompute.with......intervals.using |
| 40460 | 20 41 6c 79 73 73 61 27 73 20 73 79 73 74 65 6d 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 74 69 | .Alyssa's.system.will.produce.ti |
| 40480 | 67 68 74 65 72 20 65 72 72 6f 72 20 62 6f 75 6e 64 73 0a 20 20 20 20 20 69 66 20 69 74 20 63 61 | ghter.error.bounds......if.it.ca |
| 404a0 | 6e 20 62 65 20 77 72 69 74 74 65 6e 20 69 6e 20 73 75 63 68 20 61 20 66 6f 72 6d 20 74 68 61 74 | n.be.written.in.such.a.form.that |
| 404c0 | 20 6e 6f 20 76 61 72 69 61 62 6c 65 20 74 68 61 74 0a 20 20 20 20 20 72 65 70 72 65 73 65 6e 74 | .no.variable.that......represent |
| 404e0 | 73 20 61 6e 20 75 6e 63 65 72 74 61 69 6e 20 6e 75 6d 62 65 72 20 69 73 20 72 65 70 65 61 74 65 | s.an.uncertain.number.is.repeate |
| 40500 | 64 2e 20 20 54 68 75 73 2c 20 73 68 65 20 73 61 79 73 2c 0a 20 20 20 20 20 60 70 61 72 32 27 20 | d...Thus,.she.says,......`par2'. |
| 40520 | 69 73 20 61 20 22 62 65 74 74 65 72 22 20 70 72 6f 67 72 61 6d 20 66 6f 72 20 70 61 72 61 6c 6c | is.a."better".program.for.parall |
| 40540 | 65 6c 20 72 65 73 69 73 74 61 6e 63 65 73 20 74 68 61 6e 20 60 70 61 72 31 27 2e 0a 20 20 20 20 | el.resistances.than.`par1'...... |
| 40560 | 20 49 73 20 73 68 65 20 72 69 67 68 74 3f 20 20 57 68 79 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 | .Is.she.right?..Why?.......*Exer |
| 40580 | 63 69 73 65 20 32 2e 31 36 3a 2a 20 45 78 70 6c 61 69 6e 2c 20 69 6e 20 67 65 6e 65 72 61 6c 2c | cise.2.16:*.Explain,.in.general, |
| 405a0 | 20 77 68 79 20 65 71 75 69 76 61 6c 65 6e 74 20 61 6c 67 65 62 72 61 69 63 0a 20 20 20 20 20 65 | .why.equivalent.algebraic......e |
| 405c0 | 78 70 72 65 73 73 69 6f 6e 73 20 6d 61 79 20 6c 65 61 64 20 74 6f 20 64 69 66 66 65 72 65 6e 74 | xpressions.may.lead.to.different |
| 405e0 | 20 61 6e 73 77 65 72 73 2e 20 20 43 61 6e 20 79 6f 75 20 64 65 76 69 73 65 20 61 6e 0a 20 20 20 | .answers...Can.you.devise.an.... |
| 40600 | 20 20 69 6e 74 65 72 76 61 6c 2d 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 20 74 68 | ..interval-arithmetic.package.th |
| 40620 | 61 74 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 65 20 74 68 69 73 20 73 68 6f 72 74 63 6f 6d 69 6e | at.does.not.have.this.shortcomin |
| 40640 | 67 2c 0a 20 20 20 20 20 6f 72 20 69 73 20 74 68 69 73 20 74 61 73 6b 20 69 6d 70 6f 73 73 69 62 | g,......or.is.this.task.impossib |
| 40660 | 6c 65 3f 20 20 28 57 61 72 6e 69 6e 67 3a 20 54 68 69 73 20 70 72 6f 62 6c 65 6d 20 69 73 20 76 | le?..(Warning:.This.problem.is.v |
| 40680 | 65 72 79 0a 20 20 20 20 20 64 69 66 66 69 63 75 6c 74 2e 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 | ery......difficult.)....File:.si |
| 406a0 | 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 32 2c 20 20 4e 65 78 74 3a 20 32 2d 33 2c | cp.info,..Node:.2-2,..Next:.2-3, |
| 406c0 | 20 20 50 72 65 76 3a 20 32 2d 31 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 32 0a 0a 32 2e 32 | ..Prev:.2-1,..Up:.Chapter.2..2.2 |
| 406e0 | 20 48 69 65 72 61 72 63 68 69 63 61 6c 20 44 61 74 61 20 61 6e 64 20 74 68 65 20 43 6c 6f 73 75 | .Hierarchical.Data.and.the.Closu |
| 40700 | 72 65 20 50 72 6f 70 65 72 74 79 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | re.Property.==================== |
| 40720 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 41 73 20 77 | ==========================..As.w |
| 40740 | 65 20 68 61 76 65 20 73 65 65 6e 2c 20 70 61 69 72 73 20 70 72 6f 76 69 64 65 20 61 20 70 72 69 | e.have.seen,.pairs.provide.a.pri |
| 40760 | 6d 69 74 69 76 65 20 22 67 6c 75 65 22 20 74 68 61 74 20 77 65 20 63 61 6e 20 75 73 65 20 74 6f | mitive."glue".that.we.can.use.to |
| 40780 | 0a 63 6f 6e 73 74 72 75 63 74 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 6f 62 6a 65 63 74 73 | .construct.compound.data.objects |
| 407a0 | 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 32 3a 3a 20 73 68 6f 77 73 20 61 20 73 74 | ...*Note.Figure.2-2::.shows.a.st |
| 407c0 | 61 6e 64 61 72 64 0a 77 61 79 20 74 6f 20 76 69 73 75 61 6c 69 7a 65 20 61 20 70 61 69 72 2d 2d | andard.way.to.visualize.a.pair-- |
| 407e0 | 69 6e 20 74 68 69 73 20 63 61 73 65 2c 20 74 68 65 20 70 61 69 72 20 66 6f 72 6d 65 64 20 62 79 | in.this.case,.the.pair.formed.by |
| 40800 | 20 60 28 63 6f 6e 73 20 31 20 32 29 27 2e 0a 49 6e 20 74 68 69 73 20 72 65 70 72 65 73 65 6e 74 | .`(cons.1.2)'..In.this.represent |
| 40820 | 61 74 69 6f 6e 2c 20 77 68 69 63 68 20 69 73 20 63 61 6c 6c 65 64 20 22 62 6f 78 2d 61 6e 64 2d | ation,.which.is.called."box-and- |
| 40840 | 70 6f 69 6e 74 65 72 20 6e 6f 74 61 74 69 6f 6e 22 2c 0a 65 61 63 68 20 6f 62 6a 65 63 74 20 69 | pointer.notation",.each.object.i |
| 40860 | 73 20 73 68 6f 77 6e 20 61 73 20 61 20 22 70 6f 69 6e 74 65 72 22 20 74 6f 20 61 20 62 6f 78 2e | s.shown.as.a."pointer".to.a.box. |
| 40880 | 20 20 54 68 65 20 62 6f 78 20 66 6f 72 20 61 20 70 72 69 6d 69 74 69 76 65 0a 6f 62 6a 65 63 74 | ..The.box.for.a.primitive.object |
| 408a0 | 20 63 6f 6e 74 61 69 6e 73 20 61 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 | .contains.a.representation.of.th |
| 408c0 | 65 20 6f 62 6a 65 63 74 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 62 6f 78 0a | e.object...For.example,.the.box. |
| 408e0 | 66 6f 72 20 61 20 6e 75 6d 62 65 72 20 63 6f 6e 74 61 69 6e 73 20 61 20 6e 75 6d 65 72 61 6c 2e | for.a.number.contains.a.numeral. |
| 40900 | 20 20 54 68 65 20 62 6f 78 20 66 6f 72 20 61 20 70 61 69 72 20 69 73 20 61 63 74 75 61 6c 6c 79 | ..The.box.for.a.pair.is.actually |
| 40920 | 20 61 0a 64 6f 75 62 6c 65 20 62 6f 78 2c 20 74 68 65 20 6c 65 66 74 20 70 61 72 74 20 63 6f 6e | .a.double.box,.the.left.part.con |
| 40940 | 74 61 69 6e 69 6e 67 20 28 61 20 70 6f 69 6e 74 65 72 20 74 6f 29 20 74 68 65 20 60 63 61 72 27 | taining.(a.pointer.to).the.`car' |
| 40960 | 20 6f 66 20 74 68 65 0a 70 61 69 72 20 61 6e 64 20 74 68 65 20 72 69 67 68 74 20 70 61 72 74 20 | .of.the.pair.and.the.right.part. |
| 40980 | 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 60 63 64 72 27 2e 0a 0a 20 20 20 20 20 2a 46 69 67 | containing.the.`cdr'........*Fig |
| 409a0 | 75 72 65 20 32 2e 32 3a 2a 20 42 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 20 72 65 70 72 65 73 | ure.2.2:*.Box-and-pointer.repres |
| 409c0 | 65 6e 74 61 74 69 6f 6e 20 6f 66 20 60 28 63 6f 6e 73 20 31 20 32 29 27 2e 0a 0a 20 20 20 20 20 | entation.of.`(cons.1.2)'........ |
| 409e0 | 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 | ..........+---+---+.....+---+... |
| 40a00 | 20 20 20 20 20 20 20 20 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 32 20 7c | ........---->|.*.|.*-+---->|.2.| |
| 40a20 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d | ................+-|-+---+.....+- |
| 40a40 | 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 | --+..................|.......... |
| 40a60 | 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 | ........V................+---+.. |
| 40a80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 31 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..............|.1.|............. |
| 40aa0 | 20 20 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 57 65 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 73 65 65 | ...+---+.....We.have.already.see |
| 40ac0 | 6e 20 74 68 61 74 20 60 63 6f 6e 73 27 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 63 6f 6d | n.that.`cons'.can.be.used.to.com |
| 40ae0 | 62 69 6e 65 20 6e 6f 74 20 6f 6e 6c 79 0a 6e 75 6d 62 65 72 73 20 62 75 74 20 70 61 69 72 73 20 | bine.not.only.numbers.but.pairs. |
| 40b00 | 61 73 20 77 65 6c 6c 2e 20 20 28 59 6f 75 20 6d 61 64 65 20 75 73 65 20 6f 66 20 74 68 69 73 20 | as.well...(You.made.use.of.this. |
| 40b20 | 66 61 63 74 2c 20 6f 72 20 73 68 6f 75 6c 64 20 68 61 76 65 2c 0a 69 6e 20 64 6f 69 6e 67 20 2a | fact,.or.should.have,.in.doing.* |
| 40b40 | 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 32 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 45 78 | Note.Exercise.2-2::.and.*Note.Ex |
| 40b60 | 65 72 63 69 73 65 20 32 2d 33 3a 3a 2e 29 20 20 41 73 20 61 0a 63 6f 6e 73 65 71 75 65 6e 63 65 | ercise.2-3::.)..As.a.consequence |
| 40b80 | 2c 20 70 61 69 72 73 20 70 72 6f 76 69 64 65 20 61 20 75 6e 69 76 65 72 73 61 6c 20 62 75 69 6c | ,.pairs.provide.a.universal.buil |
| 40ba0 | 64 69 6e 67 20 62 6c 6f 63 6b 20 66 72 6f 6d 20 77 68 69 63 68 20 77 65 20 63 61 6e 0a 63 6f 6e | ding.block.from.which.we.can.con |
| 40bc0 | 73 74 72 75 63 74 20 61 6c 6c 20 73 6f 72 74 73 20 6f 66 20 64 61 74 61 20 73 74 72 75 63 74 75 | struct.all.sorts.of.data.structu |
| 40be0 | 72 65 73 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 33 3a 3a 20 73 68 6f 77 73 20 74 | res...*Note.Figure.2-3::.shows.t |
| 40c00 | 77 6f 0a 77 61 79 73 20 74 6f 20 75 73 65 20 70 61 69 72 73 20 74 6f 20 63 6f 6d 62 69 6e 65 20 | wo.ways.to.use.pairs.to.combine. |
| 40c20 | 74 68 65 20 6e 75 6d 62 65 72 73 20 31 2c 20 32 2c 20 33 2c 20 61 6e 64 20 34 2e 0a 0a 20 20 20 | the.numbers.1,.2,.3,.and.4...... |
| 40c40 | 20 20 2a 46 69 67 75 72 65 20 32 2e 33 3a 2a 20 54 77 6f 20 77 61 79 73 20 74 6f 20 63 6f 6d 62 | ..*Figure.2.3:*.Two.ways.to.comb |
| 40c60 | 69 6e 65 20 31 2c 20 32 2c 20 33 2c 20 61 6e 64 20 34 20 75 73 69 6e 67 20 70 61 69 72 73 2e 0a | ine.1,.2,.3,.and.4.using.pairs.. |
| 40c80 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d | ................+---+---+.....+- |
| 40ca0 | 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d | --+---+.........+---+---+.....+- |
| 40cc0 | 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d | --+...........---->|.*.|.*-+---- |
| 40ce0 | 3e 7c 20 2a 20 7c 20 2a 20 7c 20 20 20 20 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d | >|.*.|.*.|....---->|.*.|.*-+---- |
| 40d00 | 3e 7c 20 34 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 | >|.4.|................+-|-+---+. |
| 40d20 | 20 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 | ....+-|-+-|-+.........+-|-+---+. |
| 40d40 | 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 | ....+---+..................|.... |
| 40d60 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 | .........|...|.............|.... |
| 40d80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 | ..............V.............V... |
| 40da0 | 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | V.............V..............+-- |
| 40dc0 | 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 2b 2d 2d | -+---+......+---+.+---+......+-- |
| 40de0 | 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 | -+---+.....+---+---+............ |
| 40e00 | 20 20 7c 20 2a 20 7c 20 2a 20 7c 20 20 20 20 20 20 7c 20 33 20 7c 20 7c 20 34 20 7c 20 20 20 20 | ..|.*.|.*.|......|.3.|.|.4.|.... |
| 40e20 | 20 20 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 20 7c 0a 20 20 20 20 20 20 | ..|.*.|.*-+---->|.*.|.*.|....... |
| 40e40 | 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d | .......+-|-+-|-+......+---+.+--- |
| 40e60 | 2b 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 0a 20 | +......+-|-+---+.....+-|-+-|-+.. |
| 40e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............|...|............. |
| 40ea0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | ..............|.............|... |
| 40ec0 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 56 20 20 20 20 20 20 20 20 20 20 | |................V...V.......... |
| 40ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 | .................V.............V |
| 40f00 | 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 20 20 20 | ...V.............+---+.+---+.... |
| 40f20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b | ..................+---+........+ |
| 40f40 | 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 31 20 7c 20 7c 20 32 | ---+.+---+.............|.1.|.|.2 |
| 40f60 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 31 20 7c 20 20 20 | .|......................|.1.|... |
| 40f80 | 20 20 20 20 20 7c 20 32 20 7c 20 7c 20 33 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | .....|.2.|.|.3.|.............+-- |
| 40fa0 | 2d 2b 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d | -+.+---+......................+- |
| 40fc0 | 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 20 20 20 20 20 | --+........+---+.+---+.......... |
| 40fe0 | 20 20 20 20 28 63 6f 6e 73 20 28 63 6f 6e 73 20 31 20 32 29 20 20 20 20 20 20 20 20 20 20 20 20 | ....(cons.(cons.1.2)............ |
| 41000 | 20 20 20 20 20 28 63 6f 6e 73 20 28 63 6f 6e 73 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....(cons.(cons.1.............. |
| 41020 | 20 20 20 20 20 28 63 6f 6e 73 20 33 20 34 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....(cons.3.4))................ |
| 41040 | 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 32 20 33 29 29 0a 20 20 20 20 20 20 20 20 | ............(cons.2.3))......... |
| 41060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 41080 | 20 20 20 20 20 20 20 20 20 20 20 34 29 0a 0a 20 20 20 54 68 65 20 61 62 69 6c 69 74 79 20 74 6f | ...........4).....The.ability.to |
| 410a0 | 20 63 72 65 61 74 65 20 70 61 69 72 73 20 77 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 | .create.pairs.whose.elements.are |
| 410c0 | 20 70 61 69 72 73 20 69 73 20 74 68 65 20 65 73 73 65 6e 63 65 0a 6f 66 20 6c 69 73 74 20 73 74 | .pairs.is.the.essence.of.list.st |
| 410e0 | 72 75 63 74 75 72 65 27 73 20 69 6d 70 6f 72 74 61 6e 63 65 20 61 73 20 61 20 72 65 70 72 65 73 | ructure's.importance.as.a.repres |
| 41100 | 65 6e 74 61 74 69 6f 6e 61 6c 20 74 6f 6f 6c 2e 20 20 57 65 20 72 65 66 65 72 20 74 6f 0a 74 68 | entational.tool...We.refer.to.th |
| 41120 | 69 73 20 61 62 69 6c 69 74 79 20 61 73 20 74 68 65 20 22 63 6c 6f 73 75 72 65 20 70 72 6f 70 65 | is.ability.as.the."closure.prope |
| 41140 | 72 74 79 22 20 6f 66 20 60 63 6f 6e 73 27 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 61 6e 0a | rty".of.`cons'...In.general,.an. |
| 41160 | 6f 70 65 72 61 74 69 6f 6e 20 66 6f 72 20 63 6f 6d 62 69 6e 69 6e 67 20 64 61 74 61 20 6f 62 6a | operation.for.combining.data.obj |
| 41180 | 65 63 74 73 20 73 61 74 69 73 66 69 65 73 20 74 68 65 20 63 6c 6f 73 75 72 65 20 70 72 6f 70 65 | ects.satisfies.the.closure.prope |
| 411a0 | 72 74 79 20 69 66 0a 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 20 63 6f 6d 62 69 6e 69 6e 67 20 | rty.if.the.results.of.combining. |
| 411c0 | 74 68 69 6e 67 73 20 77 69 74 68 20 74 68 61 74 20 6f 70 65 72 61 74 69 6f 6e 20 63 61 6e 20 74 | things.with.that.operation.can.t |
| 411e0 | 68 65 6d 73 65 6c 76 65 73 20 62 65 0a 63 6f 6d 62 69 6e 65 64 20 75 73 69 6e 67 20 74 68 65 20 | hemselves.be.combined.using.the. |
| 41200 | 73 61 6d 65 20 6f 70 65 72 61 74 69 6f 6e 2e 28 31 29 20 43 6c 6f 73 75 72 65 20 69 73 20 74 68 | same.operation.(1).Closure.is.th |
| 41220 | 65 20 6b 65 79 20 74 6f 20 70 6f 77 65 72 20 69 6e 0a 61 6e 79 20 6d 65 61 6e 73 20 6f 66 20 63 | e.key.to.power.in.any.means.of.c |
| 41240 | 6f 6d 62 69 6e 61 74 69 6f 6e 20 62 65 63 61 75 73 65 20 69 74 20 70 65 72 6d 69 74 73 20 75 73 | ombination.because.it.permits.us |
| 41260 | 20 74 6f 20 63 72 65 61 74 65 20 22 68 69 65 72 61 72 63 68 69 63 61 6c 22 0a 73 74 72 75 63 74 | .to.create."hierarchical".struct |
| 41280 | 75 72 65 73 2d 2d 73 74 72 75 63 74 75 72 65 73 20 6d 61 64 65 20 75 70 20 6f 66 20 70 61 72 74 | ures--structures.made.up.of.part |
| 412a0 | 73 2c 20 77 68 69 63 68 20 74 68 65 6d 73 65 6c 76 65 73 20 61 72 65 20 6d 61 64 65 20 75 70 0a | s,.which.themselves.are.made.up. |
| 412c0 | 6f 66 20 70 61 72 74 73 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 0a 0a 20 20 20 46 72 6f 6d 20 74 68 | of.parts,.and.so.on......From.th |
| 412e0 | 65 20 6f 75 74 73 65 74 20 6f 66 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 31 3a 3a 2c 20 77 | e.outset.of.*Note.Chapter.1::,.w |
| 41300 | 65 27 76 65 20 6d 61 64 65 20 65 73 73 65 6e 74 69 61 6c 20 75 73 65 20 6f 66 0a 63 6c 6f 73 75 | e've.made.essential.use.of.closu |
| 41320 | 72 65 20 69 6e 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 70 72 6f 63 65 64 75 72 65 73 2c 20 62 | re.in.dealing.with.procedures,.b |
| 41340 | 65 63 61 75 73 65 20 61 6c 6c 20 62 75 74 20 74 68 65 20 76 65 72 79 20 73 69 6d 70 6c 65 73 74 | ecause.all.but.the.very.simplest |
| 41360 | 0a 70 72 6f 67 72 61 6d 73 20 72 65 6c 79 20 6f 6e 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 | .programs.rely.on.the.fact.that. |
| 41380 | 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 63 61 | the.elements.of.a.combination.ca |
| 413a0 | 6e 0a 74 68 65 6d 73 65 6c 76 65 73 20 62 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 2e 20 20 49 | n.themselves.be.combinations...I |
| 413c0 | 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 20 77 65 20 74 61 6b 65 20 75 70 20 74 68 65 0a 63 | n.this.section,.we.take.up.the.c |
| 413e0 | 6f 6e 73 65 71 75 65 6e 63 65 73 20 6f 66 20 63 6c 6f 73 75 72 65 20 66 6f 72 20 63 6f 6d 70 6f | onsequences.of.closure.for.compo |
| 41400 | 75 6e 64 20 64 61 74 61 2e 20 20 57 65 20 64 65 73 63 72 69 62 65 20 73 6f 6d 65 0a 63 6f 6e 76 | und.data...We.describe.some.conv |
| 41420 | 65 6e 74 69 6f 6e 61 6c 20 74 65 63 68 6e 69 71 75 65 73 20 66 6f 72 20 75 73 69 6e 67 20 70 61 | entional.techniques.for.using.pa |
| 41440 | 69 72 73 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 73 65 71 75 65 6e 63 65 73 20 61 6e 64 0a 74 | irs.to.represent.sequences.and.t |
| 41460 | 72 65 65 73 2c 20 61 6e 64 20 77 65 20 65 78 68 69 62 69 74 20 61 20 67 72 61 70 68 69 63 73 20 | rees,.and.we.exhibit.a.graphics. |
| 41480 | 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 69 6c 6c 75 73 74 72 61 74 65 73 20 63 6c 6f 73 75 72 | language.that.illustrates.closur |
| 414a0 | 65 20 69 6e 20 61 0a 76 69 76 69 64 20 77 61 79 2e 28 32 29 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a | e.in.a.vivid.way.(2)..*.Menu:..* |
| 414c0 | 20 32 2d 32 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 52 65 70 72 65 73 65 6e 74 69 6e 67 | .2-2-1::............Representing |
| 414e0 | 20 53 65 71 75 65 6e 63 65 73 0a 2a 20 32 2d 32 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 | .Sequences.*.2-2-2::............ |
| 41500 | 48 69 65 72 61 72 63 68 69 63 61 6c 20 53 74 72 75 63 74 75 72 65 73 0a 2a 20 32 2d 32 2d 33 3a | Hierarchical.Structures.*.2-2-3: |
| 41520 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 53 65 71 75 65 6e 63 65 73 20 61 73 20 43 6f 6e 76 65 6e | :............Sequences.as.Conven |
| 41540 | 74 69 6f 6e 61 6c 20 49 6e 74 65 72 66 61 63 65 73 0a 2a 20 32 2d 32 2d 34 3a 3a 20 20 20 20 20 | tional.Interfaces.*.2-2-4::..... |
| 41560 | 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 41 20 50 69 63 74 75 72 65 20 4c 61 6e 67 75 61 | .......Example:.A.Picture.Langua |
| 41580 | 67 65 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d | ge.....----------.Footnotes.---- |
| 415a0 | 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 77 6f | ------.....(1).The.use.of.the.wo |
| 415c0 | 72 64 20 22 63 6c 6f 73 75 72 65 22 20 68 65 72 65 20 63 6f 6d 65 73 20 66 72 6f 6d 20 61 62 73 | rd."closure".here.comes.from.abs |
| 415e0 | 74 72 61 63 74 20 61 6c 67 65 62 72 61 2c 0a 77 68 65 72 65 20 61 20 73 65 74 20 6f 66 20 65 6c | tract.algebra,.where.a.set.of.el |
| 41600 | 65 6d 65 6e 74 73 20 69 73 20 73 61 69 64 20 74 6f 20 62 65 20 63 6c 6f 73 65 64 20 75 6e 64 65 | ements.is.said.to.be.closed.unde |
| 41620 | 72 20 61 6e 20 6f 70 65 72 61 74 69 6f 6e 20 69 66 0a 61 70 70 6c 79 69 6e 67 20 74 68 65 20 6f | r.an.operation.if.applying.the.o |
| 41640 | 70 65 72 61 74 69 6f 6e 20 74 6f 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 73 65 74 20 | peration.to.elements.in.the.set. |
| 41660 | 70 72 6f 64 75 63 65 73 20 61 6e 20 65 6c 65 6d 65 6e 74 20 74 68 61 74 0a 69 73 20 61 67 61 69 | produces.an.element.that.is.agai |
| 41680 | 6e 20 61 6e 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 73 65 74 2e 20 20 54 68 65 20 4c 69 | n.an.element.of.the.set...The.Li |
| 416a0 | 73 70 20 63 6f 6d 6d 75 6e 69 74 79 20 61 6c 73 6f 0a 28 75 6e 66 6f 72 74 75 6e 61 74 65 6c 79 | sp.community.also.(unfortunately |
| 416c0 | 29 20 75 73 65 73 20 74 68 65 20 77 6f 72 64 20 22 63 6c 6f 73 75 72 65 22 20 74 6f 20 64 65 73 | ).uses.the.word."closure".to.des |
| 416e0 | 63 72 69 62 65 20 61 20 74 6f 74 61 6c 6c 79 20 75 6e 72 65 6c 61 74 65 64 0a 63 6f 6e 63 65 70 | cribe.a.totally.unrelated.concep |
| 41700 | 74 3a 20 41 20 63 6c 6f 73 75 72 65 20 69 73 20 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | t:.A.closure.is.an.implementatio |
| 41720 | 6e 20 74 65 63 68 6e 69 71 75 65 20 66 6f 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67 0a 70 72 6f | n.technique.for.representing.pro |
| 41740 | 63 65 64 75 72 65 73 20 77 69 74 68 20 66 72 65 65 20 76 61 72 69 61 62 6c 65 73 2e 20 20 57 65 | cedures.with.free.variables...We |
| 41760 | 20 64 6f 20 6e 6f 74 20 75 73 65 20 74 68 65 20 77 6f 72 64 20 22 63 6c 6f 73 75 72 65 22 20 69 | .do.not.use.the.word."closure".i |
| 41780 | 6e 0a 74 68 69 73 20 73 65 63 6f 6e 64 20 73 65 6e 73 65 20 69 6e 20 74 68 69 73 20 62 6f 6f 6b | n.this.second.sense.in.this.book |
| 417a0 | 2e 0a 0a 20 20 20 28 32 29 20 54 68 65 20 6e 6f 74 69 6f 6e 20 74 68 61 74 20 61 20 6d 65 61 6e | ......(2).The.notion.that.a.mean |
| 417c0 | 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 73 68 6f 75 6c 64 20 73 61 74 69 73 66 79 20 | s.of.combination.should.satisfy. |
| 417e0 | 63 6c 6f 73 75 72 65 20 69 73 0a 61 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 69 64 65 | closure.is.a.straightforward.ide |
| 41800 | 61 2e 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 74 68 65 20 64 61 74 61 20 63 6f 6d 62 | a...Unfortunately,.the.data.comb |
| 41820 | 69 6e 65 72 73 20 70 72 6f 76 69 64 65 64 20 69 6e 0a 6d 61 6e 79 20 70 6f 70 75 6c 61 72 20 70 | iners.provided.in.many.popular.p |
| 41840 | 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 64 6f 20 6e 6f 74 20 73 61 74 69 | rogramming.languages.do.not.sati |
| 41860 | 73 66 79 20 63 6c 6f 73 75 72 65 2c 20 6f 72 20 6d 61 6b 65 0a 63 6c 6f 73 75 72 65 20 63 75 6d | sfy.closure,.or.make.closure.cum |
| 41880 | 62 65 72 73 6f 6d 65 20 74 6f 20 65 78 70 6c 6f 69 74 2e 20 20 49 6e 20 46 6f 72 74 72 61 6e 20 | bersome.to.exploit...In.Fortran. |
| 418a0 | 6f 72 20 42 61 73 69 63 2c 20 6f 6e 65 20 74 79 70 69 63 61 6c 6c 79 0a 63 6f 6d 62 69 6e 65 73 | or.Basic,.one.typically.combines |
| 418c0 | 20 64 61 74 61 20 65 6c 65 6d 65 6e 74 73 20 62 79 20 61 73 73 65 6d 62 6c 69 6e 67 20 74 68 65 | .data.elements.by.assembling.the |
| 418e0 | 6d 20 69 6e 74 6f 20 61 72 72 61 79 73 2d 2d 62 75 74 20 6f 6e 65 20 63 61 6e 6e 6f 74 0a 66 6f | m.into.arrays--but.one.cannot.fo |
| 41900 | 72 6d 20 61 72 72 61 79 73 20 77 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 20 74 68 65 | rm.arrays.whose.elements.are.the |
| 41920 | 6d 73 65 6c 76 65 73 20 61 72 72 61 79 73 2e 20 20 50 61 73 63 61 6c 20 61 6e 64 20 43 20 61 64 | mselves.arrays...Pascal.and.C.ad |
| 41940 | 6d 69 74 0a 73 74 72 75 63 74 75 72 65 73 20 77 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 61 72 | mit.structures.whose.elements.ar |
| 41960 | 65 20 73 74 72 75 63 74 75 72 65 73 2e 20 20 48 6f 77 65 76 65 72 2c 20 74 68 69 73 20 72 65 71 | e.structures...However,.this.req |
| 41980 | 75 69 72 65 73 20 74 68 61 74 0a 74 68 65 20 70 72 6f 67 72 61 6d 6d 65 72 20 6d 61 6e 69 70 75 | uires.that.the.programmer.manipu |
| 419a0 | 6c 61 74 65 20 70 6f 69 6e 74 65 72 73 20 65 78 70 6c 69 63 69 74 6c 79 2c 20 61 6e 64 20 61 64 | late.pointers.explicitly,.and.ad |
| 419c0 | 68 65 72 65 20 74 6f 20 74 68 65 0a 72 65 73 74 72 69 63 74 69 6f 6e 20 74 68 61 74 20 65 61 63 | here.to.the.restriction.that.eac |
| 419e0 | 68 20 66 69 65 6c 64 20 6f 66 20 61 20 73 74 72 75 63 74 75 72 65 20 63 61 6e 20 63 6f 6e 74 61 | h.field.of.a.structure.can.conta |
| 41a00 | 69 6e 20 6f 6e 6c 79 20 65 6c 65 6d 65 6e 74 73 20 6f 66 0a 61 20 70 72 65 73 70 65 63 69 66 69 | in.only.elements.of.a.prespecifi |
| 41a20 | 65 64 20 66 6f 72 6d 2e 20 20 55 6e 6c 69 6b 65 20 4c 69 73 70 20 77 69 74 68 20 69 74 73 20 70 | ed.form...Unlike.Lisp.with.its.p |
| 41a40 | 61 69 72 73 2c 20 74 68 65 73 65 20 6c 61 6e 67 75 61 67 65 73 20 68 61 76 65 0a 6e 6f 20 62 75 | airs,.these.languages.have.no.bu |
| 41a60 | 69 6c 74 2d 69 6e 20 67 65 6e 65 72 61 6c 2d 70 75 72 70 6f 73 65 20 67 6c 75 65 20 74 68 61 74 | ilt-in.general-purpose.glue.that |
| 41a80 | 20 6d 61 6b 65 73 20 69 74 20 65 61 73 79 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 0a 63 6f 6d | .makes.it.easy.to.manipulate.com |
| 41aa0 | 70 6f 75 6e 64 20 64 61 74 61 20 69 6e 20 61 20 75 6e 69 66 6f 72 6d 20 77 61 79 2e 20 20 54 68 | pound.data.in.a.uniform.way...Th |
| 41ac0 | 69 73 20 6c 69 6d 69 74 61 74 69 6f 6e 20 6c 69 65 73 20 62 65 68 69 6e 64 20 41 6c 61 6e 0a 50 | is.limitation.lies.behind.Alan.P |
| 41ae0 | 65 72 6c 69 73 27 73 20 63 6f 6d 6d 65 6e 74 20 69 6e 20 68 69 73 20 66 6f 72 65 77 6f 72 64 20 | erlis's.comment.in.his.foreword. |
| 41b00 | 74 6f 20 74 68 69 73 20 62 6f 6f 6b 3a 20 22 49 6e 20 50 61 73 63 61 6c 20 74 68 65 20 70 6c 65 | to.this.book:."In.Pascal.the.ple |
| 41b20 | 74 68 6f 72 61 0a 6f 66 20 64 65 63 6c 61 72 61 62 6c 65 20 64 61 74 61 20 73 74 72 75 63 74 75 | thora.of.declarable.data.structu |
| 41b40 | 72 65 73 20 69 6e 64 75 63 65 73 20 61 20 73 70 65 63 69 61 6c 69 7a 61 74 69 6f 6e 20 77 69 74 | res.induces.a.specialization.wit |
| 41b60 | 68 69 6e 20 66 75 6e 63 74 69 6f 6e 73 0a 74 68 61 74 20 69 6e 68 69 62 69 74 73 20 61 6e 64 20 | hin.functions.that.inhibits.and. |
| 41b80 | 70 65 6e 61 6c 69 7a 65 73 20 63 61 73 75 61 6c 20 63 6f 6f 70 65 72 61 74 69 6f 6e 2e 20 20 49 | penalizes.casual.cooperation...I |
| 41ba0 | 74 20 69 73 20 62 65 74 74 65 72 20 74 6f 20 68 61 76 65 0a 31 30 30 20 66 75 6e 63 74 69 6f 6e | t.is.better.to.have.100.function |
| 41bc0 | 73 20 6f 70 65 72 61 74 65 20 6f 6e 20 6f 6e 65 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 20 | s.operate.on.one.data.structure. |
| 41be0 | 74 68 61 6e 20 74 6f 20 68 61 76 65 20 31 30 20 66 75 6e 63 74 69 6f 6e 73 0a 6f 70 65 72 61 74 | than.to.have.10.functions.operat |
| 41c00 | 65 20 6f 6e 20 31 30 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 2e 22 0a 0a 1f 0a 46 69 6c | e.on.10.data.structures."....Fil |
| 41c20 | 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 32 2d 31 2c 20 20 4e 65 78 | e:.sicp.info,..Node:.2-2-1,..Nex |
| 41c40 | 74 3a 20 32 2d 32 2d 32 2c 20 20 50 72 65 76 3a 20 32 2d 32 2c 20 20 55 70 3a 20 32 2d 32 0a 0a | t:.2-2-2,..Prev:.2-2,..Up:.2-2.. |
| 41c60 | 32 2e 32 2e 31 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 53 65 71 75 65 6e 63 65 73 0a 2d 2d 2d | 2.2.1.Representing.Sequences.--- |
| 41c80 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 20 20 | -------------------------....... |
| 41ca0 | 2a 46 69 67 75 72 65 20 32 2e 34 3a 2a 20 54 68 65 20 73 65 71 75 65 6e 63 65 20 31 2c 20 32 2c | *Figure.2.4:*.The.sequence.1,.2, |
| 41cc0 | 20 33 2c 20 34 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 63 68 61 69 6e 20 6f 66 0a | .3,.4.represented.as.a.chain.of. |
| 41ce0 | 20 20 20 20 20 70 61 69 72 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | .....pairs..................+--- |
| 41d00 | 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d | +---+.....+---+---+.....+---+--- |
| 41d20 | 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 3e 7c | +.....+---+---+...........---->| |
| 41d40 | 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c | .*.|.*-+---->|.*.|.*-+---->|.*.| |
| 41d60 | 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*-+---->|.*.|./.|.............. |
| 41d80 | 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d | ..+-|-+---+.....+-|-+---+.....+- |
| 41da0 | 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 | |-+---+.....+-|-+---+........... |
| 41dc0 | 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | .......|.............|.......... |
| 41de0 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...|.............|.............. |
| 41e00 | 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....V.............V............. |
| 41e20 | 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b | V.............V................+ |
| 41e40 | 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b | ---+.........+---+.........+---+ |
| 41e60 | 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | .........+---+................|. |
| 41e80 | 31 20 7c 20 20 20 20 20 20 20 20 20 7c 20 32 20 7c 20 20 20 20 20 20 20 20 20 7c 20 33 20 7c 20 | 1.|.........|.2.|.........|.3.|. |
| 41ea0 | 20 20 20 20 20 20 20 20 7c 20 34 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | ........|.4.|................+-- |
| 41ec0 | 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 | -+.........+---+.........+---+.. |
| 41ee0 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 0a 4f 6e 65 20 6f 66 20 74 68 65 20 75 73 65 66 75 6c 20 | .......+---+..One.of.the.useful. |
| 41f00 | 73 74 72 75 63 74 75 72 65 73 20 77 65 20 63 61 6e 20 62 75 69 6c 64 20 77 69 74 68 20 70 61 69 | structures.we.can.build.with.pai |
| 41f20 | 72 73 20 69 73 20 61 20 22 73 65 71 75 65 6e 63 65 22 2d 2d 61 6e 0a 6f 72 64 65 72 65 64 20 63 | rs.is.a."sequence"--an.ordered.c |
| 41f40 | 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 64 61 74 61 20 6f 62 6a 65 63 74 73 2e 20 20 54 68 65 72 | ollection.of.data.objects...Ther |
| 41f60 | 65 20 61 72 65 2c 20 6f 66 20 63 6f 75 72 73 65 2c 20 6d 61 6e 79 20 77 61 79 73 20 74 6f 0a 72 | e.are,.of.course,.many.ways.to.r |
| 41f80 | 65 70 72 65 73 65 6e 74 20 73 65 71 75 65 6e 63 65 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 70 | epresent.sequences.in.terms.of.p |
| 41fa0 | 61 69 72 73 2e 20 20 4f 6e 65 20 70 61 72 74 69 63 75 6c 61 72 6c 79 0a 73 74 72 61 69 67 68 74 | airs...One.particularly.straight |
| 41fc0 | 66 6f 72 77 61 72 64 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 69 6c 6c 75 73 74 | forward.representation.is.illust |
| 41fe0 | 72 61 74 65 64 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 34 3a 3a 2c 0a 77 68 65 | rated.in.*Note.Figure.2-4::,.whe |
| 42000 | 72 65 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 31 2c 20 32 2c 20 33 2c 20 34 20 69 73 20 72 65 | re.the.sequence.1,.2,.3,.4.is.re |
| 42020 | 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 63 68 61 69 6e 20 6f 66 20 70 61 69 72 73 2e 20 20 | presented.as.a.chain.of.pairs... |
| 42040 | 54 68 65 0a 60 63 61 72 27 20 6f 66 20 65 61 63 68 20 70 61 69 72 20 69 73 20 74 68 65 20 63 6f | The.`car'.of.each.pair.is.the.co |
| 42060 | 72 72 65 73 70 6f 6e 64 69 6e 67 20 69 74 65 6d 20 69 6e 20 74 68 65 20 63 68 61 69 6e 2c 20 61 | rresponding.item.in.the.chain,.a |
| 42080 | 6e 64 20 74 68 65 0a 60 63 64 72 27 20 6f 66 20 74 68 65 20 70 61 69 72 20 69 73 20 74 68 65 20 | nd.the.`cdr'.of.the.pair.is.the. |
| 420a0 | 6e 65 78 74 20 70 61 69 72 20 69 6e 20 74 68 65 20 63 68 61 69 6e 2e 20 20 54 68 65 20 60 63 64 | next.pair.in.the.chain...The.`cd |
| 420c0 | 72 27 20 6f 66 20 74 68 65 0a 66 69 6e 61 6c 20 70 61 69 72 20 73 69 67 6e 61 6c 73 20 74 68 65 | r'.of.the.final.pair.signals.the |
| 420e0 | 20 65 6e 64 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 62 79 20 70 6f 69 6e 74 69 6e 67 | .end.of.the.sequence.by.pointing |
| 42100 | 20 74 6f 20 61 0a 64 69 73 74 69 6e 67 75 69 73 68 65 64 20 76 61 6c 75 65 20 74 68 61 74 20 69 | .to.a.distinguished.value.that.i |
| 42120 | 73 20 6e 6f 74 20 61 20 70 61 69 72 2c 20 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 62 6f 78 | s.not.a.pair,.represented.in.box |
| 42140 | 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 0a 64 69 61 67 72 61 6d 73 20 61 73 20 61 20 64 69 61 67 6f | -and-pointer.diagrams.as.a.diago |
| 42160 | 6e 61 6c 20 6c 69 6e 65 20 61 6e 64 20 69 6e 20 70 72 6f 67 72 61 6d 73 20 61 73 20 74 68 65 20 | nal.line.and.in.programs.as.the. |
| 42180 | 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 76 61 72 69 61 62 6c 65 20 60 6e 69 6c 27 2e 20 20 54 68 | value.of.the.variable.`nil'...Th |
| 421a0 | 65 20 65 6e 74 69 72 65 20 73 65 71 75 65 6e 63 65 20 69 73 20 63 6f 6e 73 74 72 75 63 74 65 64 | e.entire.sequence.is.constructed |
| 421c0 | 20 62 79 20 6e 65 73 74 65 64 20 60 63 6f 6e 73 27 0a 6f 70 65 72 61 74 69 6f 6e 73 3a 0a 0a 20 | .by.nested.`cons'.operations:... |
| 421e0 | 20 20 20 20 28 63 6f 6e 73 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 32 0a 20 | ....(cons.1............(cons.2.. |
| 42200 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 33 0a 20 20 20 20 20 20 20 20 | ................(cons.3......... |
| 42220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 34 20 6e 69 6c 29 29 29 29 0a 0a | ...............(cons.4.nil)))).. |
| 42240 | 20 20 20 53 75 63 68 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 70 61 69 72 73 2c 20 66 6f 72 | ...Such.a.sequence.of.pairs,.for |
| 42260 | 6d 65 64 20 62 79 20 6e 65 73 74 65 64 20 60 63 6f 6e 73 27 65 73 2c 20 69 73 20 63 61 6c 6c 65 | med.by.nested.`cons'es,.is.calle |
| 42280 | 64 20 61 20 22 6c 69 73 74 22 2c 0a 61 6e 64 20 53 63 68 65 6d 65 20 70 72 6f 76 69 64 65 73 20 | d.a."list",.and.Scheme.provides. |
| 422a0 | 61 20 70 72 69 6d 69 74 69 76 65 20 63 61 6c 6c 65 64 20 60 6c 69 73 74 27 20 74 6f 20 68 65 6c | a.primitive.called.`list'.to.hel |
| 422c0 | 70 20 69 6e 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 0a 6c 69 73 74 73 2e 28 31 29 20 20 54 68 65 | p.in.constructing.lists.(1)..The |
| 422e0 | 20 61 62 6f 76 65 20 73 65 71 75 65 6e 63 65 20 63 6f 75 6c 64 20 62 65 20 70 72 6f 64 75 63 65 | .above.sequence.could.be.produce |
| 42300 | 64 20 62 79 20 60 28 6c 69 73 74 20 31 20 32 20 33 20 34 29 27 2e 0a 49 6e 20 67 65 6e 65 72 61 | d.by.`(list.1.2.3.4)'..In.genera |
| 42320 | 6c 2c 0a 0a 20 20 20 20 20 28 6c 69 73 74 20 3c 41 5f 31 3e 20 3c 41 5f 32 3e 20 2e 2e 2e 20 3c | l,.......(list.<A_1>.<A_2>.....< |
| 42340 | 41 5f 4e 3e 29 0a 0a 69 73 20 65 71 75 69 76 61 6c 65 6e 74 20 74 6f 0a 0a 20 20 20 20 20 28 63 | A_N>)..is.equivalent.to.......(c |
| 42360 | 6f 6e 73 20 3c 41 5f 31 3e 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 3c 41 5f 32 3e | ons.<A_1>............(cons.<A_2> |
| 42380 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 2e 2e 2e 0a 20 20 20 20 | ..................(cons......... |
| 423a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 3c 41 5f 4e 3e 0a 20 | ...................(cons.<A_N>.. |
| 423c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 69 6c 29 | ............................nil) |
| 423e0 | 0a 20 20 20 20 20 2e 2e 2e 29 29 29 0a 0a 20 20 20 4c 69 73 70 20 73 79 73 74 65 6d 73 20 63 6f | .........))).....Lisp.systems.co |
| 42400 | 6e 76 65 6e 74 69 6f 6e 61 6c 6c 79 20 70 72 69 6e 74 20 6c 69 73 74 73 20 62 79 20 70 72 69 6e | nventionally.print.lists.by.prin |
| 42420 | 74 69 6e 67 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 65 6c 65 6d 65 6e 74 73 2c 20 65 | ting.the.sequence.of.elements,.e |
| 42440 | 6e 63 6c 6f 73 65 64 20 69 6e 20 70 61 72 65 6e 74 68 65 73 65 73 2e 20 20 54 68 75 73 2c 20 74 | nclosed.in.parentheses...Thus,.t |
| 42460 | 68 65 20 64 61 74 61 20 6f 62 6a 65 63 74 20 69 6e 20 2a 4e 6f 74 65 0a 46 69 67 75 72 65 20 32 | he.data.object.in.*Note.Figure.2 |
| 42480 | 2d 34 3a 3a 20 69 73 20 70 72 69 6e 74 65 64 20 61 73 20 60 28 31 20 32 20 33 20 34 29 27 3a 0a | -4::.is.printed.as.`(1.2.3.4)':. |
| 424a0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6f 6e 65 2d 74 68 72 6f 75 67 68 2d 66 6f 75 72 20 28 | ......(define.one-through-four.( |
| 424c0 | 6c 69 73 74 20 31 20 32 20 33 20 34 29 29 0a 0a 20 20 20 20 20 6f 6e 65 2d 74 68 72 6f 75 67 68 | list.1.2.3.4)).......one-through |
| 424e0 | 2d 66 6f 75 72 0a 20 20 20 20 20 28 31 20 32 20 33 20 34 29 0a 0a 20 20 20 42 65 20 63 61 72 65 | -four......(1.2.3.4).....Be.care |
| 42500 | 66 75 6c 20 6e 6f 74 20 74 6f 20 63 6f 6e 66 75 73 65 20 74 68 65 20 65 78 70 72 65 73 73 69 6f | ful.not.to.confuse.the.expressio |
| 42520 | 6e 20 60 28 6c 69 73 74 20 31 20 32 20 33 20 34 29 27 20 77 69 74 68 20 74 68 65 0a 6c 69 73 74 | n.`(list.1.2.3.4)'.with.the.list |
| 42540 | 20 60 28 31 20 32 20 33 20 34 29 27 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 72 65 73 75 6c | .`(1.2.3.4)',.which.is.the.resul |
| 42560 | 74 20 6f 62 74 61 69 6e 65 64 20 77 68 65 6e 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 | t.obtained.when.the.expression.i |
| 42580 | 73 0a 65 76 61 6c 75 61 74 65 64 2e 20 20 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 65 76 61 6c | s.evaluated...Attempting.to.eval |
| 425a0 | 75 61 74 65 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 31 20 32 20 33 20 34 29 27 20 | uate.the.expression.`(1.2.3.4)'. |
| 425c0 | 77 69 6c 6c 0a 73 69 67 6e 61 6c 20 61 6e 20 65 72 72 6f 72 20 77 68 65 6e 20 74 68 65 20 69 6e | will.signal.an.error.when.the.in |
| 425e0 | 74 65 72 70 72 65 74 65 72 20 74 72 69 65 73 20 74 6f 20 61 70 70 6c 79 20 74 68 65 20 70 72 6f | terpreter.tries.to.apply.the.pro |
| 42600 | 63 65 64 75 72 65 20 60 31 27 20 74 6f 0a 61 72 67 75 6d 65 6e 74 73 20 60 32 27 2c 20 60 33 27 | cedure.`1'.to.arguments.`2',.`3' |
| 42620 | 2c 20 61 6e 64 20 60 34 27 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 74 68 69 6e 6b 20 6f 66 20 60 | ,.and.`4'......We.can.think.of.` |
| 42640 | 63 61 72 27 20 61 73 20 73 65 6c 65 63 74 69 6e 67 20 74 68 65 20 66 69 72 73 74 20 69 74 65 6d | car'.as.selecting.the.first.item |
| 42660 | 20 69 6e 20 74 68 65 20 6c 69 73 74 2c 20 61 6e 64 20 6f 66 0a 60 63 64 72 27 20 61 73 20 73 65 | .in.the.list,.and.of.`cdr'.as.se |
| 42680 | 6c 65 63 74 69 6e 67 20 74 68 65 20 73 75 62 6c 69 73 74 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f | lecting.the.sublist.consisting.o |
| 426a0 | 66 20 61 6c 6c 20 62 75 74 20 74 68 65 20 66 69 72 73 74 20 69 74 65 6d 2e 0a 4e 65 73 74 65 64 | f.all.but.the.first.item..Nested |
| 426c0 | 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 6f 66 20 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 | .applications.of.`car'.and.`cdr' |
| 426e0 | 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 0a 73 65 63 6f | .can.be.used.to.extract.the.seco |
| 42700 | 6e 64 2c 20 74 68 69 72 64 2c 20 61 6e 64 20 73 75 62 73 65 71 75 65 6e 74 20 69 74 65 6d 73 20 | nd,.third,.and.subsequent.items. |
| 42720 | 69 6e 20 74 68 65 20 6c 69 73 74 2e 28 32 29 20 54 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 0a | in.the.list.(2).The.constructor. |
| 42740 | 60 63 6f 6e 73 27 20 6d 61 6b 65 73 20 61 20 6c 69 73 74 20 6c 69 6b 65 20 74 68 65 20 6f 72 69 | `cons'.makes.a.list.like.the.ori |
| 42760 | 67 69 6e 61 6c 20 6f 6e 65 2c 20 62 75 74 20 77 69 74 68 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 | ginal.one,.but.with.an.additiona |
| 42780 | 6c 20 69 74 65 6d 0a 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 2e 0a 0a 20 20 20 20 20 28 | l.item.at.the.beginning........( |
| 427a0 | 63 61 72 20 6f 6e 65 2d 74 68 72 6f 75 67 68 2d 66 6f 75 72 29 0a 20 20 20 20 20 31 0a 0a 20 20 | car.one-through-four)......1.... |
| 427c0 | 20 20 20 28 63 64 72 20 6f 6e 65 2d 74 68 72 6f 75 67 68 2d 66 6f 75 72 29 0a 20 20 20 20 20 28 | ...(cdr.one-through-four)......( |
| 427e0 | 32 20 33 20 34 29 0a 0a 20 20 20 20 20 28 63 61 72 20 28 63 64 72 20 6f 6e 65 2d 74 68 72 6f 75 | 2.3.4).......(car.(cdr.one-throu |
| 42800 | 67 68 2d 66 6f 75 72 29 29 0a 20 20 20 20 20 32 0a 0a 20 20 20 20 20 28 63 6f 6e 73 20 31 30 20 | gh-four))......2.......(cons.10. |
| 42820 | 6f 6e 65 2d 74 68 72 6f 75 67 68 2d 66 6f 75 72 29 0a 20 20 20 20 20 28 31 30 20 31 20 32 20 33 | one-through-four)......(10.1.2.3 |
| 42840 | 20 34 29 0a 0a 20 20 20 20 20 28 63 6f 6e 73 20 35 20 6f 6e 65 2d 74 68 72 6f 75 67 68 2d 66 6f | .4).......(cons.5.one-through-fo |
| 42860 | 75 72 29 0a 20 20 20 20 20 28 35 20 31 20 32 20 33 20 34 29 0a 0a 20 20 20 54 68 65 20 76 61 6c | ur)......(5.1.2.3.4).....The.val |
| 42880 | 75 65 20 6f 66 20 60 6e 69 6c 27 2c 20 75 73 65 64 20 74 6f 20 74 65 72 6d 69 6e 61 74 65 20 74 | ue.of.`nil',.used.to.terminate.t |
| 428a0 | 68 65 20 63 68 61 69 6e 20 6f 66 20 70 61 69 72 73 2c 20 63 61 6e 20 62 65 0a 74 68 6f 75 67 68 | he.chain.of.pairs,.can.be.though |
| 428c0 | 74 20 6f 66 20 61 73 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 6e 6f 20 65 6c 65 6d 65 6e 74 | t.of.as.a.sequence.of.no.element |
| 428e0 | 73 2c 20 74 68 65 20 22 65 6d 70 74 79 20 6c 69 73 74 22 2e 20 20 54 68 65 20 77 6f 72 64 20 22 | s,.the."empty.list"...The.word." |
| 42900 | 6e 69 6c 22 0a 69 73 20 61 20 63 6f 6e 74 72 61 63 74 69 6f 6e 20 6f 66 20 74 68 65 20 4c 61 74 | nil".is.a.contraction.of.the.Lat |
| 42920 | 69 6e 20 77 6f 72 64 20 5f 6e 69 68 69 6c 5f 2c 20 77 68 69 63 68 20 6d 65 61 6e 73 20 22 6e 6f | in.word._nihil_,.which.means."no |
| 42940 | 74 68 69 6e 67 2e 22 28 33 29 0a 0a 4c 69 73 74 20 6f 70 65 72 61 74 69 6f 6e 73 0a 2e 2e 2e 2e | thing."(3)..List.operations..... |
| 42960 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 75 73 65 20 6f 66 20 70 61 69 72 73 20 74 6f | .............The.use.of.pairs.to |
| 42980 | 20 72 65 70 72 65 73 65 6e 74 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 65 6c 65 6d 65 6e 74 73 | .represent.sequences.of.elements |
| 429a0 | 20 61 73 20 6c 69 73 74 73 20 69 73 0a 61 63 63 6f 6d 70 61 6e 69 65 64 20 62 79 20 63 6f 6e 76 | .as.lists.is.accompanied.by.conv |
| 429c0 | 65 6e 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 74 65 63 68 6e 69 71 75 65 73 20 | entional.programming.techniques. |
| 429e0 | 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 0a 6c 69 73 74 73 20 62 79 20 73 75 63 63 65 73 | for.manipulating.lists.by.succes |
| 42a00 | 73 69 76 65 6c 79 20 22 60 63 64 72 27 69 6e 67 20 64 6f 77 6e 22 20 74 68 65 20 6c 69 73 74 73 | sively."`cdr'ing.down".the.lists |
| 42a20 | 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 60 6c | ...For.example,.the.procedure.`l |
| 42a40 | 69 73 74 2d 72 65 66 27 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 20 6c 69 | ist-ref'.takes.as.arguments.a.li |
| 42a60 | 73 74 20 61 6e 64 20 61 20 6e 75 6d 62 65 72 20 6e 20 61 6e 64 0a 72 65 74 75 72 6e 73 20 74 68 | st.and.a.number.n.and.returns.th |
| 42a80 | 65 20 6e 74 68 20 69 74 65 6d 20 6f 66 20 74 68 65 20 6c 69 73 74 2e 20 20 49 74 20 69 73 20 63 | e.nth.item.of.the.list...It.is.c |
| 42aa0 | 75 73 74 6f 6d 61 72 79 20 74 6f 20 6e 75 6d 62 65 72 20 74 68 65 0a 65 6c 65 6d 65 6e 74 73 20 | ustomary.to.number.the.elements. |
| 42ac0 | 6f 66 20 74 68 65 20 6c 69 73 74 20 62 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 30 2e 20 20 54 | of.the.list.beginning.with.0...T |
| 42ae0 | 68 65 20 6d 65 74 68 6f 64 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 0a 60 6c 69 73 74 2d 72 65 | he.method.for.computing.`list-re |
| 42b00 | 66 27 20 69 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 0a 20 20 20 2a 20 46 6f 72 20 6e | f'.is.the.following:.....*.For.n |
| 42b20 | 20 3d 20 30 2c 20 60 6c 69 73 74 2d 72 65 66 27 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 74 | .=.0,.`list-ref'.should.return.t |
| 42b40 | 68 65 20 60 63 61 72 27 20 6f 66 20 74 68 65 20 6c 69 73 74 2e 0a 0a 20 20 20 2a 20 4f 74 68 65 | he.`car'.of.the.list......*.Othe |
| 42b60 | 72 77 69 73 65 2c 20 60 6c 69 73 74 2d 72 65 66 27 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 | rwise,.`list-ref'.should.return. |
| 42b80 | 20 74 68 65 20 28 6e 20 2d 20 31 29 73 74 20 69 74 65 6d 20 6f 66 20 74 68 65 0a 20 20 20 20 20 | .the.(n.-.1)st.item.of.the...... |
| 42ba0 | 60 63 64 72 27 20 6f 66 20 74 68 65 20 6c 69 73 74 2e 0a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | `cdr'.of.the.list.........(defin |
| 42bc0 | 65 20 28 6c 69 73 74 2d 72 65 66 20 69 74 65 6d 73 20 6e 29 0a 20 20 20 20 20 20 20 28 69 66 20 | e.(list-ref.items.n)........(if. |
| 42be0 | 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 69 74 65 6d 73 29 0a 20 | (=.n.0)............(car.items).. |
| 42c00 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20 28 63 64 72 20 69 74 65 6d 73 29 20 | ..........(list-ref.(cdr.items). |
| 42c20 | 28 2d 20 6e 20 31 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 71 75 61 72 65 73 | (-.n.1)))).......(define.squares |
| 42c40 | 20 28 6c 69 73 74 20 31 20 34 20 39 20 31 36 20 32 35 29 29 0a 0a 20 20 20 20 20 28 6c 69 73 74 | .(list.1.4.9.16.25)).......(list |
| 42c60 | 2d 72 65 66 20 73 71 75 61 72 65 73 20 33 29 0a 20 20 20 20 20 31 36 0a 0a 20 20 20 4f 66 74 65 | -ref.squares.3)......16.....Ofte |
| 42c80 | 6e 20 77 65 20 60 63 64 72 27 20 64 6f 77 6e 20 74 68 65 20 77 68 6f 6c 65 20 6c 69 73 74 2e 20 | n.we.`cdr'.down.the.whole.list.. |
| 42ca0 | 20 54 6f 20 61 69 64 20 69 6e 20 74 68 69 73 2c 20 53 63 68 65 6d 65 20 69 6e 63 6c 75 64 65 73 | .To.aid.in.this,.Scheme.includes |
| 42cc0 | 0a 61 20 70 72 69 6d 69 74 69 76 65 20 70 72 65 64 69 63 61 74 65 20 60 6e 75 6c 6c 3f 27 2c 20 | .a.primitive.predicate.`null?',. |
| 42ce0 | 77 68 69 63 68 20 74 65 73 74 73 20 77 68 65 74 68 65 72 20 69 74 73 20 61 72 67 75 6d 65 6e 74 | which.tests.whether.its.argument |
| 42d00 | 20 69 73 20 74 68 65 0a 65 6d 70 74 79 20 6c 69 73 74 2e 20 20 54 68 65 20 70 72 6f 63 65 64 75 | .is.the.empty.list...The.procedu |
| 42d20 | 72 65 20 60 6c 65 6e 67 74 68 27 2c 20 77 68 69 63 68 20 72 65 74 75 72 6e 73 20 74 68 65 20 6e | re.`length',.which.returns.the.n |
| 42d40 | 75 6d 62 65 72 20 6f 66 20 69 74 65 6d 73 0a 69 6e 20 61 20 6c 69 73 74 2c 20 69 6c 6c 75 73 74 | umber.of.items.in.a.list,.illust |
| 42d60 | 72 61 74 65 73 20 74 68 69 73 20 74 79 70 69 63 61 6c 20 70 61 74 74 65 72 6e 20 6f 66 20 75 73 | rates.this.typical.pattern.of.us |
| 42d80 | 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 0a | e:.......(define.(length.items). |
| 42da0 | 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 20 | .......(if.(null?.items)........ |
| 42dc0 | 20 20 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 31 20 28 6c 65 6e 67 74 68 20 28 63 | ....0............(+.1.(length.(c |
| 42de0 | 64 72 20 69 74 65 6d 73 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6f 64 64 73 | dr.items))))).......(define.odds |
| 42e00 | 20 28 6c 69 73 74 20 31 20 33 20 35 20 37 29 29 0a 0a 20 20 20 20 20 28 6c 65 6e 67 74 68 20 6f | .(list.1.3.5.7)).......(length.o |
| 42e20 | 64 64 73 29 0a 20 20 20 20 20 34 0a 0a 20 20 20 54 68 65 20 60 6c 65 6e 67 74 68 27 20 70 72 6f | dds)......4.....The.`length'.pro |
| 42e40 | 63 65 64 75 72 65 20 69 6d 70 6c 65 6d 65 6e 74 73 20 61 20 73 69 6d 70 6c 65 20 72 65 63 75 72 | cedure.implements.a.simple.recur |
| 42e60 | 73 69 76 65 20 70 6c 61 6e 2e 20 54 68 65 0a 72 65 64 75 63 74 69 6f 6e 20 73 74 65 70 20 69 73 | sive.plan..The.reduction.step.is |
| 42e80 | 3a 0a 0a 20 20 20 2a 20 54 68 65 20 60 6c 65 6e 67 74 68 27 20 6f 66 20 61 6e 79 20 6c 69 73 74 | :.....*.The.`length'.of.any.list |
| 42ea0 | 20 69 73 20 31 20 70 6c 75 73 20 74 68 65 20 60 6c 65 6e 67 74 68 27 20 6f 66 20 74 68 65 20 60 | .is.1.plus.the.`length'.of.the.` |
| 42ec0 | 63 64 72 27 20 6f 66 0a 20 20 20 20 20 74 68 65 20 6c 69 73 74 2e 0a 0a 0a 20 20 20 54 68 69 73 | cdr'.of......the.list.......This |
| 42ee0 | 20 69 73 20 61 70 70 6c 69 65 64 20 73 75 63 63 65 73 73 69 76 65 6c 79 20 75 6e 74 69 6c 20 77 | .is.applied.successively.until.w |
| 42f00 | 65 20 72 65 61 63 68 20 74 68 65 20 62 61 73 65 20 63 61 73 65 3a 0a 0a 20 20 20 2a 20 54 68 65 | e.reach.the.base.case:.....*.The |
| 42f20 | 20 60 6c 65 6e 67 74 68 27 20 6f 66 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 20 69 73 20 30 | .`length'.of.the.empty.list.is.0 |
| 42f40 | 2e 0a 0a 0a 20 20 20 57 65 20 63 6f 75 6c 64 20 61 6c 73 6f 20 63 6f 6d 70 75 74 65 20 60 6c 65 | .......We.could.also.compute.`le |
| 42f60 | 6e 67 74 68 27 20 69 6e 20 61 6e 20 69 74 65 72 61 74 69 76 65 20 73 74 79 6c 65 3a 0a 0a 20 20 | ngth'.in.an.iterative.style:.... |
| 42f80 | 20 20 20 28 64 65 66 69 6e 65 20 28 6c 65 6e 67 74 68 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 | ...(define.(length.items)....... |
| 42fa0 | 20 28 64 65 66 69 6e 65 20 28 6c 65 6e 67 74 68 2d 69 74 65 72 20 61 20 63 6f 75 6e 74 29 0a 20 | .(define.(length-iter.a.count).. |
| 42fc0 | 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 61 29 0a 20 20 20 20 20 20 20 20 20 20 | ........(if.(null?.a)........... |
| 42fe0 | 20 20 20 63 6f 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 6e 67 74 68 2d 69 74 | ...count..............(length-it |
| 43000 | 65 72 20 28 63 64 72 20 61 29 20 28 2b 20 31 20 63 6f 75 6e 74 29 29 29 29 0a 20 20 20 20 20 20 | er.(cdr.a).(+.1.count))))....... |
| 43020 | 20 28 6c 65 6e 67 74 68 2d 69 74 65 72 20 69 74 65 6d 73 20 30 29 29 0a 0a 20 20 20 41 6e 6f 74 | .(length-iter.items.0)).....Anot |
| 43040 | 68 65 72 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 74 65 63 | her.conventional.programming.tec |
| 43060 | 68 6e 69 71 75 65 20 69 73 20 74 6f 20 22 60 63 6f 6e 73 27 20 75 70 22 20 61 6e 0a 61 6e 73 77 | hnique.is.to."`cons'.up".an.answ |
| 43080 | 65 72 20 6c 69 73 74 20 77 68 69 6c 65 20 60 63 64 72 27 69 6e 67 20 64 6f 77 6e 20 61 20 6c 69 | er.list.while.`cdr'ing.down.a.li |
| 430a0 | 73 74 2c 20 61 73 20 69 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 61 70 70 65 6e 64 27 | st,.as.in.the.procedure.`append' |
| 430c0 | 2c 0a 77 68 69 63 68 20 74 61 6b 65 73 20 74 77 6f 20 6c 69 73 74 73 20 61 73 20 61 72 67 75 6d | ,.which.takes.two.lists.as.argum |
| 430e0 | 65 6e 74 73 20 61 6e 64 20 63 6f 6d 62 69 6e 65 73 20 74 68 65 69 72 20 65 6c 65 6d 65 6e 74 73 | ents.and.combines.their.elements |
| 43100 | 20 74 6f 20 6d 61 6b 65 0a 61 20 6e 65 77 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 28 61 70 70 65 | .to.make.a.new.list:.......(appe |
| 43120 | 6e 64 20 73 71 75 61 72 65 73 20 6f 64 64 73 29 0a 20 20 20 20 20 28 31 20 34 20 39 20 31 36 20 | nd.squares.odds)......(1.4.9.16. |
| 43140 | 32 35 20 31 20 33 20 35 20 37 29 0a 0a 20 20 20 20 20 28 61 70 70 65 6e 64 20 6f 64 64 73 20 73 | 25.1.3.5.7).......(append.odds.s |
| 43160 | 71 75 61 72 65 73 29 0a 20 20 20 20 20 28 31 20 33 20 35 20 37 20 31 20 34 20 39 20 31 36 20 32 | quares)......(1.3.5.7.1.4.9.16.2 |
| 43180 | 35 29 0a 0a 20 20 20 60 41 70 70 65 6e 64 27 20 69 73 20 61 6c 73 6f 20 69 6d 70 6c 65 6d 65 6e | 5).....`Append'.is.also.implemen |
| 431a0 | 74 65 64 20 75 73 69 6e 67 20 61 20 72 65 63 75 72 73 69 76 65 20 70 6c 61 6e 2e 20 20 54 6f 20 | ted.using.a.recursive.plan...To. |
| 431c0 | 60 61 70 70 65 6e 64 27 0a 6c 69 73 74 73 20 60 6c 69 73 74 31 27 20 61 6e 64 20 60 6c 69 73 74 | `append'.lists.`list1'.and.`list |
| 431e0 | 32 27 2c 20 64 6f 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 0a 20 20 20 2a 20 49 66 20 60 | 2',.do.the.following:.....*.If.` |
| 43200 | 6c 69 73 74 31 27 20 69 73 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 2c 20 74 68 65 6e 20 74 | list1'.is.the.empty.list,.then.t |
| 43220 | 68 65 20 72 65 73 75 6c 74 20 69 73 20 6a 75 73 74 20 60 6c 69 73 74 32 27 2e 0a 0a 20 20 20 2a | he.result.is.just.`list2'......* |
| 43240 | 20 4f 74 68 65 72 77 69 73 65 2c 20 60 61 70 70 65 6e 64 27 20 74 68 65 20 60 63 64 72 27 20 6f | .Otherwise,.`append'.the.`cdr'.o |
| 43260 | 66 20 60 6c 69 73 74 31 27 20 61 6e 64 20 60 6c 69 73 74 32 27 2c 20 61 6e 64 20 60 63 6f 6e 73 | f.`list1'.and.`list2',.and.`cons |
| 43280 | 27 0a 20 20 20 20 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 60 6c 69 73 74 31 27 20 6f 6e 74 6f | '......the.`car'.of.`list1'.onto |
| 432a0 | 20 74 68 65 20 72 65 73 75 6c 74 3a 0a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 70 | .the.result:........(define.(app |
| 432c0 | 65 6e 64 20 6c 69 73 74 31 20 6c 69 73 74 32 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c | end.list1.list2)........(if.(nul |
| 432e0 | 6c 3f 20 6c 69 73 74 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 6c 69 73 74 32 0a 20 20 20 20 20 | l?.list1)............list2...... |
| 43300 | 20 20 20 20 20 20 28 63 6f 6e 73 20 28 63 61 72 20 6c 69 73 74 31 29 20 28 61 70 70 65 6e 64 20 | ......(cons.(car.list1).(append. |
| 43320 | 28 63 64 72 20 6c 69 73 74 31 29 20 6c 69 73 74 32 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 | (cdr.list1).list2)))).......*Exe |
| 43340 | 72 63 69 73 65 20 32 2e 31 37 3a 2a 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 | rcise.2.17:*.Define.a.procedure. |
| 43360 | 60 6c 61 73 74 2d 70 61 69 72 27 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 74 68 65 0a 20 20 20 | `last-pair'.that.returns.the.... |
| 43380 | 20 20 6c 69 73 74 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 6f 6e 6c 79 20 74 68 65 20 6c 61 | ..list.that.contains.only.the.la |
| 433a0 | 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 61 20 67 69 76 65 6e 20 28 6e 6f 6e 65 6d 70 74 79 29 | st.element.of.a.given.(nonempty) |
| 433c0 | 0a 20 20 20 20 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 61 73 74 2d 70 61 69 | ......list:............(last-pai |
| 433e0 | 72 20 28 6c 69 73 74 20 32 33 20 37 32 20 31 34 39 20 33 34 29 29 0a 20 20 20 20 20 20 20 20 20 | r.(list.23.72.149.34)).......... |
| 43400 | 20 28 33 34 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 31 38 3a 2a 20 44 65 66 | .(34).......*Exercise.2.18:*.Def |
| 43420 | 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 72 65 76 65 72 73 65 27 20 74 68 61 74 20 74 | ine.a.procedure.`reverse'.that.t |
| 43440 | 61 6b 65 73 20 61 20 6c 69 73 74 20 61 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 | akes.a.list.as......argument.and |
| 43460 | 20 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 73 61 6d 65 20 65 6c 65 6d | .returns.a.list.of.the.same.elem |
| 43480 | 65 6e 74 73 20 69 6e 20 72 65 76 65 72 73 65 20 6f 72 64 65 72 3a 0a 0a 20 20 20 20 20 20 20 20 | ents.in.reverse.order:.......... |
| 434a0 | 20 20 28 72 65 76 65 72 73 65 20 28 6c 69 73 74 20 31 20 34 20 39 20 31 36 20 32 35 29 29 0a 20 | ..(reverse.(list.1.4.9.16.25)).. |
| 434c0 | 20 20 20 20 20 20 20 20 20 28 32 35 20 31 36 20 39 20 34 20 31 29 0a 0a 20 20 20 20 20 2a 45 78 | .........(25.16.9.4.1).......*Ex |
| 434e0 | 65 72 63 69 73 65 20 32 2e 31 39 3a 2a 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 63 68 61 6e 67 | ercise.2.19:*.Consider.the.chang |
| 43500 | 65 2d 63 6f 75 6e 74 69 6e 67 20 70 72 6f 67 72 61 6d 20 6f 66 20 73 65 63 74 69 6f 6e 0a 20 20 | e-counting.program.of.section... |
| 43520 | 20 20 20 2a 4e 6f 74 65 20 31 2d 32 2d 32 3a 3a 2e 20 20 49 74 20 77 6f 75 6c 64 20 62 65 20 6e | ...*Note.1-2-2::...It.would.be.n |
| 43540 | 69 63 65 20 74 6f 20 62 65 20 61 62 6c 65 20 74 6f 20 65 61 73 69 6c 79 20 63 68 61 6e 67 65 20 | ice.to.be.able.to.easily.change. |
| 43560 | 74 68 65 0a 20 20 20 20 20 63 75 72 72 65 6e 63 79 20 75 73 65 64 20 62 79 20 74 68 65 20 70 72 | the......currency.used.by.the.pr |
| 43580 | 6f 67 72 61 6d 2c 20 73 6f 20 74 68 61 74 20 77 65 20 63 6f 75 6c 64 20 63 6f 6d 70 75 74 65 20 | ogram,.so.that.we.could.compute. |
| 435a0 | 74 68 65 20 6e 75 6d 62 65 72 0a 20 20 20 20 20 6f 66 20 77 61 79 73 20 74 6f 20 63 68 61 6e 67 | the.number......of.ways.to.chang |
| 435c0 | 65 20 61 20 42 72 69 74 69 73 68 20 70 6f 75 6e 64 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2e 20 | e.a.British.pound,.for.example.. |
| 435e0 | 20 41 73 20 74 68 65 20 70 72 6f 67 72 61 6d 20 69 73 0a 20 20 20 20 20 77 72 69 74 74 65 6e 2c | .As.the.program.is......written, |
| 43600 | 20 74 68 65 20 6b 6e 6f 77 6c 65 64 67 65 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e 63 79 20 69 | .the.knowledge.of.the.currency.i |
| 43620 | 73 20 64 69 73 74 72 69 62 75 74 65 64 20 70 61 72 74 6c 79 20 69 6e 74 6f 0a 20 20 20 20 20 74 | s.distributed.partly.into......t |
| 43640 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 66 69 72 73 74 2d 64 65 6e 6f 6d 69 6e 61 74 69 6f 6e | he.procedure.`first-denomination |
| 43660 | 27 20 61 6e 64 20 70 61 72 74 6c 79 20 69 6e 74 6f 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a | '.and.partly.into.the.procedure. |
| 43680 | 20 20 20 20 20 60 63 6f 75 6e 74 2d 63 68 61 6e 67 65 27 20 28 77 68 69 63 68 20 6b 6e 6f 77 73 | .....`count-change'.(which.knows |
| 436a0 | 20 74 68 61 74 20 74 68 65 72 65 20 61 72 65 20 66 69 76 65 20 6b 69 6e 64 73 20 6f 66 20 55 2e | .that.there.are.five.kinds.of.U. |
| 436c0 | 53 2e 0a 20 20 20 20 20 63 6f 69 6e 73 29 2e 20 20 49 74 20 77 6f 75 6c 64 20 62 65 20 6e 69 63 | S.......coins)...It.would.be.nic |
| 436e0 | 65 72 20 74 6f 20 62 65 20 61 62 6c 65 20 74 6f 20 73 75 70 70 6c 79 20 61 20 6c 69 73 74 20 6f | er.to.be.able.to.supply.a.list.o |
| 43700 | 66 20 63 6f 69 6e 73 20 74 6f 0a 20 20 20 20 20 62 65 20 75 73 65 64 20 66 6f 72 20 6d 61 6b 69 | f.coins.to......be.used.for.maki |
| 43720 | 6e 67 20 63 68 61 6e 67 65 2e 0a 0a 20 20 20 20 20 57 65 20 77 61 6e 74 20 74 6f 20 72 65 77 72 | ng.change........We.want.to.rewr |
| 43740 | 69 74 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 63 63 27 20 73 6f 20 74 68 61 74 20 69 | ite.the.procedure.`cc'.so.that.i |
| 43760 | 74 73 20 73 65 63 6f 6e 64 20 61 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 69 73 20 61 20 6c 69 73 | ts.second.argument......is.a.lis |
| 43780 | 74 20 6f 66 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 63 6f 69 6e 73 20 74 6f 20 | t.of.the.values.of.the.coins.to. |
| 437a0 | 75 73 65 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 6e 20 69 6e 74 65 67 65 72 0a 20 20 20 20 20 | use.rather.than.an.integer...... |
| 437c0 | 73 70 65 63 69 66 79 69 6e 67 20 77 68 69 63 68 20 63 6f 69 6e 73 20 74 6f 20 75 73 65 2e 20 20 | specifying.which.coins.to.use... |
| 437e0 | 57 65 20 63 6f 75 6c 64 20 74 68 65 6e 20 68 61 76 65 20 6c 69 73 74 73 20 74 68 61 74 0a 20 20 | We.could.then.have.lists.that... |
| 43800 | 20 20 20 64 65 66 69 6e 65 64 20 65 61 63 68 20 6b 69 6e 64 20 6f 66 20 63 75 72 72 65 6e 63 79 | ...defined.each.kind.of.currency |
| 43820 | 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 75 73 2d 63 6f 69 6e 73 20 28 6c | :............(define.us-coins.(l |
| 43840 | 69 73 74 20 35 30 20 32 35 20 31 30 20 35 20 31 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | ist.50.25.10.5.1))............(d |
| 43860 | 65 66 69 6e 65 20 75 6b 2d 63 6f 69 6e 73 20 28 6c 69 73 74 20 31 30 30 20 35 30 20 32 30 20 31 | efine.uk-coins.(list.100.50.20.1 |
| 43880 | 30 20 35 20 32 20 31 20 30 2e 35 29 29 0a 0a 20 20 20 20 20 57 65 20 63 6f 75 6c 64 20 74 68 65 | 0.5.2.1.0.5)).......We.could.the |
| 438a0 | 6e 20 63 61 6c 6c 20 60 63 63 27 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 | n.call.`cc'.as.follows:......... |
| 438c0 | 20 20 20 28 63 63 20 31 30 30 20 75 73 2d 63 6f 69 6e 73 29 0a 20 20 20 20 20 20 20 20 20 20 32 | ...(cc.100.us-coins)...........2 |
| 438e0 | 39 32 0a 0a 20 20 20 20 20 54 6f 20 64 6f 20 74 68 69 73 20 77 69 6c 6c 20 72 65 71 75 69 72 65 | 92.......To.do.this.will.require |
| 43900 | 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 70 72 6f 67 72 61 6d 20 60 63 63 27 20 73 6f 6d 65 77 | .changing.the.program.`cc'.somew |
| 43920 | 68 61 74 2e 20 20 49 74 0a 20 20 20 20 20 77 69 6c 6c 20 73 74 69 6c 6c 20 68 61 76 65 20 74 68 | hat...It......will.still.have.th |
| 43940 | 65 20 73 61 6d 65 20 66 6f 72 6d 2c 20 62 75 74 20 69 74 20 77 69 6c 6c 20 61 63 63 65 73 73 20 | e.same.form,.but.it.will.access. |
| 43960 | 69 74 73 20 73 65 63 6f 6e 64 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 20 64 69 66 66 65 72 65 | its.second......argument.differe |
| 43980 | 6e 74 6c 79 2c 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | ntly,.as.follows:............(de |
| 439a0 | 66 69 6e 65 20 28 63 63 20 61 6d 6f 75 6e 74 20 63 6f 69 6e 2d 76 61 6c 75 65 73 29 0a 20 20 20 | fine.(cc.amount.coin-values).... |
| 439c0 | 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d 20 61 6d 6f 75 6e 74 20 30 29 20 31 29 0a | .........(cond.((=.amount.0).1). |
| 439e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6f 72 20 28 3c 20 61 6d 6f 75 6e 74 | ..................((or.(<.amount |
| 43a00 | 20 30 29 20 28 6e 6f 2d 6d 6f 72 65 3f 20 63 6f 69 6e 2d 76 61 6c 75 65 73 29 29 20 30 29 0a 20 | .0).(no-more?.coin-values)).0).. |
| 43a20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 | .................(else.......... |
| 43a40 | 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 63 63 20 61 6d 6f 75 6e 74 0a 20 20 20 20 20 20 20 20 | ..........(+.(cc.amount......... |
| 43a60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 63 65 70 74 2d 66 69 72 73 74 2d | ..................(except-first- |
| 43a80 | 64 65 6e 6f 6d 69 6e 61 74 69 6f 6e 20 63 6f 69 6e 2d 76 61 6c 75 65 73 29 29 0a 20 20 20 20 20 | denomination.coin-values))...... |
| 43aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 63 20 28 2d 20 61 6d 6f 75 6e 74 0a 20 | .................(cc.(-.amount.. |
| 43ac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 72 | ............................(fir |
| 43ae0 | 73 74 2d 64 65 6e 6f 6d 69 6e 61 74 69 6f 6e 20 63 6f 69 6e 2d 76 61 6c 75 65 73 29 29 0a 20 20 | st-denomination.coin-values))... |
| 43b00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 69 6e 2d 76 61 6c | ........................coin-val |
| 43b20 | 75 65 73 29 29 29 29 29 0a 0a 20 20 20 20 20 44 65 66 69 6e 65 20 74 68 65 20 70 72 6f 63 65 64 | ues))))).......Define.the.proced |
| 43b40 | 75 72 65 73 20 60 66 69 72 73 74 2d 64 65 6e 6f 6d 69 6e 61 74 69 6f 6e 27 2c 0a 20 20 20 20 20 | ures.`first-denomination',...... |
| 43b60 | 60 65 78 63 65 70 74 2d 66 69 72 73 74 2d 64 65 6e 6f 6d 69 6e 61 74 69 6f 6e 27 2c 20 61 6e 64 | `except-first-denomination',.and |
| 43b80 | 20 60 6e 6f 2d 6d 6f 72 65 3f 27 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 70 72 69 6d 69 74 69 76 | .`no-more?'.in.terms.of.primitiv |
| 43ba0 | 65 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 6c 69 73 74 20 73 74 72 75 63 74 | e......operations.on.list.struct |
| 43bc0 | 75 72 65 73 2e 20 20 44 6f 65 73 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 6c 69 73 | ures...Does.the.order.of.the.lis |
| 43be0 | 74 0a 20 20 20 20 20 60 63 6f 69 6e 2d 76 61 6c 75 65 73 27 20 61 66 66 65 63 74 20 74 68 65 20 | t......`coin-values'.affect.the. |
| 43c00 | 61 6e 73 77 65 72 20 70 72 6f 64 75 63 65 64 20 62 79 20 60 63 63 27 3f 20 20 57 68 79 20 6f 72 | answer.produced.by.`cc'?..Why.or |
| 43c20 | 20 77 68 79 20 6e 6f 74 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 32 30 3a 2a | .why.not?.......*Exercise.2.20:* |
| 43c40 | 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 2b 27 2c 20 60 2a 27 2c 20 61 6e 64 20 60 6c | .The.procedures.`+',.`*',.and.`l |
| 43c60 | 69 73 74 27 20 74 61 6b 65 0a 20 20 20 20 20 61 72 62 69 74 72 61 72 79 20 6e 75 6d 62 65 72 73 | ist'.take......arbitrary.numbers |
| 43c80 | 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 2e 20 4f 6e 65 20 77 61 79 20 74 6f 20 64 65 66 69 6e 65 | .of.arguments..One.way.to.define |
| 43ca0 | 20 73 75 63 68 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 69 73 20 74 6f 20 75 73 65 20 | .such.procedures......is.to.use. |
| 43cc0 | 60 64 65 66 69 6e 65 27 20 77 69 74 68 20 6e 6f 74 61 74 69 6f 6e 20 22 64 6f 74 74 65 64 2d 74 | `define'.with.notation."dotted-t |
| 43ce0 | 61 69 6c 20 6e 6f 74 61 74 69 6f 6e 22 2e 20 20 49 6e 20 61 0a 20 20 20 20 20 70 72 6f 63 65 64 | ail.notation"...In.a......proced |
| 43d00 | 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 2c 20 61 20 70 61 72 61 6d 65 74 65 72 20 6c 69 73 74 | ure.definition,.a.parameter.list |
| 43d20 | 20 74 68 61 74 20 68 61 73 20 61 20 64 6f 74 20 62 65 66 6f 72 65 20 74 68 65 0a 20 20 20 20 20 | .that.has.a.dot.before.the...... |
| 43d40 | 6c 61 73 74 20 70 61 72 61 6d 65 74 65 72 20 6e 61 6d 65 20 69 6e 64 69 63 61 74 65 73 20 74 68 | last.parameter.name.indicates.th |
| 43d60 | 61 74 2c 20 77 68 65 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 63 61 6c 6c 65 64 | at,.when.the.procedure.is.called |
| 43d80 | 2c 0a 20 20 20 20 20 74 68 65 20 69 6e 69 74 69 61 6c 20 70 61 72 61 6d 65 74 65 72 73 20 28 69 | ,......the.initial.parameters.(i |
| 43da0 | 66 20 61 6e 79 29 20 77 69 6c 6c 20 68 61 76 65 20 61 73 20 76 61 6c 75 65 73 20 74 68 65 20 69 | f.any).will.have.as.values.the.i |
| 43dc0 | 6e 69 74 69 61 6c 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 2c 20 61 73 20 75 73 75 61 6c 2c | nitial......arguments,.as.usual, |
| 43de0 | 20 62 75 74 20 74 68 65 20 66 69 6e 61 6c 20 70 61 72 61 6d 65 74 65 72 27 73 20 76 61 6c 75 65 | .but.the.final.parameter's.value |
| 43e00 | 20 77 69 6c 6c 20 62 65 20 61 20 22 6c 69 73 74 22 0a 20 20 20 20 20 6f 66 20 61 6e 79 20 72 65 | .will.be.a."list"......of.any.re |
| 43e20 | 6d 61 69 6e 69 6e 67 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 | maining.arguments...For.instance |
| 43e40 | 2c 20 67 69 76 65 6e 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 0a 0a 20 20 20 20 20 20 20 20 | ,.given.the.definition.......... |
| 43e60 | 20 20 28 64 65 66 69 6e 65 20 28 66 20 78 20 79 20 2e 20 7a 29 20 3c 42 4f 44 59 3e 29 0a 0a 20 | ..(define.(f.x.y...z).<BODY>)... |
| 43e80 | 20 20 20 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 66 27 20 63 61 6e 20 62 65 20 63 61 6c | ....the.procedure.`f'.can.be.cal |
| 43ea0 | 6c 65 64 20 77 69 74 68 20 74 77 6f 20 6f 72 20 6d 6f 72 65 20 61 72 67 75 6d 65 6e 74 73 2e 20 | led.with.two.or.more.arguments.. |
| 43ec0 | 20 49 66 20 77 65 0a 20 20 20 20 20 65 76 61 6c 75 61 74 65 0a 0a 20 20 20 20 20 20 20 20 20 20 | .If.we......evaluate............ |
| 43ee0 | 28 66 20 31 20 32 20 33 20 34 20 35 20 36 29 0a 0a 20 20 20 20 20 74 68 65 6e 20 69 6e 20 74 68 | (f.1.2.3.4.5.6).......then.in.th |
| 43f00 | 65 20 62 6f 64 79 20 6f 66 20 60 66 27 2c 20 60 78 27 20 77 69 6c 6c 20 62 65 20 31 2c 20 60 79 | e.body.of.`f',.`x'.will.be.1,.`y |
| 43f20 | 27 20 77 69 6c 6c 20 62 65 20 32 2c 20 61 6e 64 20 60 7a 27 0a 20 20 20 20 20 77 69 6c 6c 20 62 | '.will.be.2,.and.`z'......will.b |
| 43f40 | 65 20 74 68 65 20 6c 69 73 74 20 60 28 33 20 34 20 35 20 36 29 27 2e 20 20 47 69 76 65 6e 20 74 | e.the.list.`(3.4.5.6)'...Given.t |
| 43f60 | 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | he.definition............(define |
| 43f80 | 20 28 67 20 2e 20 77 29 20 3c 42 4f 44 59 3e 29 0a 0a 20 20 20 20 20 74 68 65 20 70 72 6f 63 65 | .(g...w).<BODY>).......the.proce |
| 43fa0 | 64 75 72 65 20 60 67 27 20 63 61 6e 20 62 65 20 63 61 6c 6c 65 64 20 77 69 74 68 20 7a 65 72 6f | dure.`g'.can.be.called.with.zero |
| 43fc0 | 20 6f 72 20 6d 6f 72 65 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 49 66 20 77 65 0a 20 20 20 20 20 | .or.more.arguments...If.we...... |
| 43fe0 | 65 76 61 6c 75 61 74 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 67 20 31 20 32 20 33 20 34 20 35 | evaluate............(g.1.2.3.4.5 |
| 44000 | 20 36 29 0a 0a 20 20 20 20 20 74 68 65 6e 20 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 20 60 67 | .6).......then.in.the.body.of.`g |
| 44020 | 27 2c 20 60 77 27 20 77 69 6c 6c 20 62 65 20 74 68 65 20 6c 69 73 74 20 60 28 31 20 32 20 33 20 | ',.`w'.will.be.the.list.`(1.2.3. |
| 44040 | 34 20 35 20 36 29 27 2e 28 34 29 0a 0a 20 20 20 20 20 55 73 65 20 74 68 69 73 20 6e 6f 74 61 74 | 4.5.6)'.(4).......Use.this.notat |
| 44060 | 69 6f 6e 20 74 6f 20 77 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 73 61 6d 65 2d 70 | ion.to.write.a.procedure.`same-p |
| 44080 | 61 72 69 74 79 27 20 74 68 61 74 20 74 61 6b 65 73 0a 20 20 20 20 20 6f 6e 65 20 6f 72 20 6d 6f | arity'.that.takes......one.or.mo |
| 440a0 | 72 65 20 69 6e 74 65 67 65 72 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20 6f | re.integers.and.returns.a.list.o |
| 440c0 | 66 20 61 6c 6c 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 68 61 74 0a 20 20 20 20 20 68 61 | f.all.the.arguments.that......ha |
| 440e0 | 76 65 20 74 68 65 20 73 61 6d 65 20 65 76 65 6e 2d 6f 64 64 20 70 61 72 69 74 79 20 61 73 20 74 | ve.the.same.even-odd.parity.as.t |
| 44100 | 68 65 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c | he.first.argument...For.example, |
| 44120 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 61 6d 65 2d 70 61 72 69 74 79 20 31 20 32 20 33 20 34 | ............(same-parity.1.2.3.4 |
| 44140 | 20 35 20 36 20 37 29 0a 20 20 20 20 20 20 20 20 20 20 28 31 20 33 20 35 20 37 29 0a 0a 20 20 20 | .5.6.7)...........(1.3.5.7)..... |
| 44160 | 20 20 20 20 20 20 20 28 73 61 6d 65 2d 70 61 72 69 74 79 20 32 20 33 20 34 20 35 20 36 20 37 29 | .......(same-parity.2.3.4.5.6.7) |
| 44180 | 0a 20 20 20 20 20 20 20 20 20 20 28 32 20 34 20 36 29 0a 0a 4d 61 70 70 69 6e 67 20 6f 76 65 72 | ...........(2.4.6)..Mapping.over |
| 441a0 | 20 6c 69 73 74 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 4f 6e 65 20 65 | .lists.....................One.e |
| 441c0 | 78 74 72 65 6d 65 6c 79 20 75 73 65 66 75 6c 20 6f 70 65 72 61 74 69 6f 6e 20 69 73 20 74 6f 20 | xtremely.useful.operation.is.to. |
| 441e0 | 61 70 70 6c 79 20 73 6f 6d 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 74 6f 20 65 61 63 | apply.some.transformation.to.eac |
| 44200 | 68 0a 65 6c 65 6d 65 6e 74 20 69 6e 20 61 20 6c 69 73 74 20 61 6e 64 20 67 65 6e 65 72 61 74 65 | h.element.in.a.list.and.generate |
| 44220 | 20 74 68 65 20 6c 69 73 74 20 6f 66 20 72 65 73 75 6c 74 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 | .the.list.of.results...For.insta |
| 44240 | 6e 63 65 2c 20 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 73 63 61 | nce,.the.following.procedure.sca |
| 44260 | 6c 65 73 20 65 61 63 68 20 6e 75 6d 62 65 72 20 69 6e 20 61 20 6c 69 73 74 20 62 79 20 61 20 67 | les.each.number.in.a.list.by.a.g |
| 44280 | 69 76 65 6e 20 66 61 63 74 6f 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 63 61 6c | iven.factor:.......(define.(scal |
| 442a0 | 65 2d 6c 69 73 74 20 69 74 65 6d 73 20 66 61 63 74 6f 72 29 0a 20 20 20 20 20 20 20 28 69 66 20 | e-list.items.factor)........(if. |
| 442c0 | 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 6e 69 6c 0a 20 20 20 | (null?.items)............nil.... |
| 442e0 | 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 2a 20 28 63 61 72 20 69 74 65 6d 73 29 20 66 61 63 | ........(cons.(*.(car.items).fac |
| 44300 | 74 6f 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 63 61 6c 65 2d 6c 69 73 | tor)..................(scale-lis |
| 44320 | 74 20 28 63 64 72 20 69 74 65 6d 73 29 20 66 61 63 74 6f 72 29 29 29 29 0a 0a 20 20 20 20 20 28 | t.(cdr.items).factor)))).......( |
| 44340 | 73 63 61 6c 65 2d 6c 69 73 74 20 28 6c 69 73 74 20 31 20 32 20 33 20 34 20 35 29 20 31 30 29 0a | scale-list.(list.1.2.3.4.5).10). |
| 44360 | 20 20 20 20 20 28 31 30 20 32 30 20 33 30 20 34 30 20 35 30 29 0a 0a 20 20 20 57 65 20 63 61 6e | .....(10.20.30.40.50).....We.can |
| 44380 | 20 61 62 73 74 72 61 63 74 20 74 68 69 73 20 67 65 6e 65 72 61 6c 20 69 64 65 61 20 61 6e 64 20 | .abstract.this.general.idea.and. |
| 443a0 | 63 61 70 74 75 72 65 20 69 74 20 61 73 20 61 20 63 6f 6d 6d 6f 6e 20 70 61 74 74 65 72 6e 0a 65 | capture.it.as.a.common.pattern.e |
| 443c0 | 78 70 72 65 73 73 65 64 20 61 73 20 61 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 | xpressed.as.a.higher-order.proce |
| 443e0 | 64 75 72 65 2c 20 6a 75 73 74 20 61 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 | dure,.just.as.in.section.*Note.1 |
| 44400 | 2d 33 3a 3a 2e 0a 54 68 65 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 | -3::..The.higher-order.procedure |
| 44420 | 20 68 65 72 65 20 69 73 20 63 61 6c 6c 65 64 20 60 6d 61 70 27 2e 20 20 60 4d 61 70 27 20 74 61 | .here.is.called.`map'...`Map'.ta |
| 44440 | 6b 65 73 20 61 73 0a 61 72 67 75 6d 65 6e 74 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 | kes.as.arguments.a.procedure.of. |
| 44460 | 6f 6e 65 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 61 20 6c 69 73 74 2c 20 61 6e 64 20 72 65 74 | one.argument.and.a.list,.and.ret |
| 44480 | 75 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 0a 74 68 65 20 72 65 73 75 6c 74 73 20 70 72 6f 64 75 | urns.a.list.of.the.results.produ |
| 444a0 | 63 65 64 20 62 79 20 61 70 70 6c 79 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f | ced.by.applying.the.procedure.to |
| 444c0 | 20 65 61 63 68 20 65 6c 65 6d 65 6e 74 20 69 6e 20 74 68 65 0a 6c 69 73 74 3a 28 35 29 0a 0a 20 | .each.element.in.the.list:(5)... |
| 444e0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 70 20 70 72 6f 63 20 69 74 65 6d 73 29 0a 20 20 20 | ....(define.(map.proc.items).... |
| 44500 | 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 20 20 20 20 | ....(if.(null?.items)........... |
| 44520 | 20 6e 69 6c 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 70 72 6f 63 20 28 63 61 72 | .nil............(cons.(proc.(car |
| 44540 | 20 69 74 65 6d 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 70 | .items))..................(map.p |
| 44560 | 72 6f 63 20 28 63 64 72 20 69 74 65 6d 73 29 29 29 29 29 0a 0a 20 20 20 20 20 28 6d 61 70 20 61 | roc.(cdr.items))))).......(map.a |
| 44580 | 62 73 20 28 6c 69 73 74 20 2d 31 30 20 32 2e 35 20 2d 31 31 2e 36 20 31 37 29 29 0a 20 20 20 20 | bs.(list.-10.2.5.-11.6.17))..... |
| 445a0 | 20 28 31 30 20 32 2e 35 20 31 31 2e 36 20 31 37 29 0a 0a 20 20 20 20 20 28 6d 61 70 20 28 6c 61 | .(10.2.5.11.6.17).......(map.(la |
| 445c0 | 6d 62 64 61 20 28 78 29 20 28 2a 20 78 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 | mbda.(x).(*.x.x))...........(lis |
| 445e0 | 74 20 31 20 32 20 33 20 34 29 29 0a 20 20 20 20 20 28 31 20 34 20 39 20 31 36 29 0a 0a 20 20 20 | t.1.2.3.4))......(1.4.9.16)..... |
| 44600 | 4e 6f 77 20 77 65 20 63 61 6e 20 67 69 76 65 20 61 20 6e 65 77 20 64 65 66 69 6e 69 74 69 6f 6e | Now.we.can.give.a.new.definition |
| 44620 | 20 6f 66 20 60 73 63 61 6c 65 2d 6c 69 73 74 27 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 60 6d 61 | .of.`scale-list'.in.terms.of.`ma |
| 44640 | 70 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 63 61 6c 65 2d 6c 69 73 74 20 69 74 | p':.......(define.(scale-list.it |
| 44660 | 65 6d 73 20 66 61 63 74 6f 72 29 0a 20 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 | ems.factor)........(map.(lambda. |
| 44680 | 28 78 29 20 28 2a 20 78 20 66 61 63 74 6f 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 74 | (x).(*.x.factor)).............it |
| 446a0 | 65 6d 73 29 29 0a 0a 20 20 20 60 4d 61 70 27 20 69 73 20 61 6e 20 69 6d 70 6f 72 74 61 6e 74 20 | ems)).....`Map'.is.an.important. |
| 446c0 | 63 6f 6e 73 74 72 75 63 74 2c 20 6e 6f 74 20 6f 6e 6c 79 20 62 65 63 61 75 73 65 20 69 74 20 63 | construct,.not.only.because.it.c |
| 446e0 | 61 70 74 75 72 65 73 20 61 0a 63 6f 6d 6d 6f 6e 20 70 61 74 74 65 72 6e 2c 20 62 75 74 20 62 65 | aptures.a.common.pattern,.but.be |
| 44700 | 63 61 75 73 65 20 69 74 20 65 73 74 61 62 6c 69 73 68 65 73 20 61 20 68 69 67 68 65 72 20 6c 65 | cause.it.establishes.a.higher.le |
| 44720 | 76 65 6c 20 6f 66 0a 61 62 73 74 72 61 63 74 69 6f 6e 20 69 6e 20 64 65 61 6c 69 6e 67 20 77 69 | vel.of.abstraction.in.dealing.wi |
| 44740 | 74 68 20 6c 69 73 74 73 2e 20 20 49 6e 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 64 65 66 69 6e | th.lists...In.the.original.defin |
| 44760 | 69 74 69 6f 6e 20 6f 66 0a 60 73 63 61 6c 65 2d 6c 69 73 74 27 2c 20 74 68 65 20 72 65 63 75 72 | ition.of.`scale-list',.the.recur |
| 44780 | 73 69 76 65 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d 20 64 72 | sive.structure.of.the.program.dr |
| 447a0 | 61 77 73 20 61 74 74 65 6e 74 69 6f 6e 20 74 6f 0a 74 68 65 20 65 6c 65 6d 65 6e 74 2d 62 79 2d | aws.attention.to.the.element-by- |
| 447c0 | 65 6c 65 6d 65 6e 74 20 70 72 6f 63 65 73 73 69 6e 67 20 6f 66 20 74 68 65 20 6c 69 73 74 2e 20 | element.processing.of.the.list.. |
| 447e0 | 20 44 65 66 69 6e 69 6e 67 20 60 73 63 61 6c 65 2d 6c 69 73 74 27 0a 69 6e 20 74 65 72 6d 73 20 | .Defining.`scale-list'.in.terms. |
| 44800 | 6f 66 20 60 6d 61 70 27 20 73 75 70 70 72 65 73 73 65 73 20 74 68 61 74 20 6c 65 76 65 6c 20 6f | of.`map'.suppresses.that.level.o |
| 44820 | 66 20 64 65 74 61 69 6c 20 61 6e 64 20 65 6d 70 68 61 73 69 7a 65 73 20 74 68 61 74 0a 73 63 61 | f.detail.and.emphasizes.that.sca |
| 44840 | 6c 69 6e 67 20 74 72 61 6e 73 66 6f 72 6d 73 20 61 20 6c 69 73 74 20 6f 66 20 65 6c 65 6d 65 6e | ling.transforms.a.list.of.elemen |
| 44860 | 74 73 20 74 6f 20 61 20 6c 69 73 74 20 6f 66 20 72 65 73 75 6c 74 73 2e 20 20 54 68 65 0a 64 69 | ts.to.a.list.of.results...The.di |
| 44880 | 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 65 20 74 77 6f 20 64 65 66 69 6e 69 74 | fference.between.the.two.definit |
| 448a0 | 69 6f 6e 73 20 69 73 20 6e 6f 74 20 74 68 61 74 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 69 73 | ions.is.not.that.the.computer.is |
| 448c0 | 0a 70 65 72 66 6f 72 6d 69 6e 67 20 61 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 63 65 73 73 20 | .performing.a.different.process. |
| 448e0 | 28 69 74 20 69 73 6e 27 74 29 20 62 75 74 20 74 68 61 74 20 77 65 20 74 68 69 6e 6b 20 61 62 6f | (it.isn't).but.that.we.think.abo |
| 44900 | 75 74 20 74 68 65 0a 70 72 6f 63 65 73 73 20 64 69 66 66 65 72 65 6e 74 6c 79 2e 20 20 49 6e 20 | ut.the.process.differently...In. |
| 44920 | 65 66 66 65 63 74 2c 20 60 6d 61 70 27 20 68 65 6c 70 73 20 65 73 74 61 62 6c 69 73 68 20 61 6e | effect,.`map'.helps.establish.an |
| 44940 | 20 61 62 73 74 72 61 63 74 69 6f 6e 0a 62 61 72 72 69 65 72 20 74 68 61 74 20 69 73 6f 6c 61 74 | .abstraction.barrier.that.isolat |
| 44960 | 65 73 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 72 6f 63 65 64 75 | es.the.implementation.of.procedu |
| 44980 | 72 65 73 20 74 68 61 74 20 74 72 61 6e 73 66 6f 72 6d 0a 6c 69 73 74 73 20 66 72 6f 6d 20 74 68 | res.that.transform.lists.from.th |
| 449a0 | 65 20 64 65 74 61 69 6c 73 20 6f 66 20 68 6f 77 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 | e.details.of.how.the.elements.of |
| 449c0 | 20 74 68 65 20 6c 69 73 74 20 61 72 65 20 65 78 74 72 61 63 74 65 64 0a 61 6e 64 20 63 6f 6d 62 | .the.list.are.extracted.and.comb |
| 449e0 | 69 6e 65 64 2e 20 20 4c 69 6b 65 20 74 68 65 20 62 61 72 72 69 65 72 73 20 73 68 6f 77 6e 20 69 | ined...Like.the.barriers.shown.i |
| 44a00 | 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 3a 3a 2c 20 74 68 69 73 0a 61 62 73 74 72 | n.*Note.Figure.2-1::,.this.abstr |
| 44a20 | 61 63 74 69 6f 6e 20 67 69 76 65 73 20 75 73 20 74 68 65 20 66 6c 65 78 69 62 69 6c 69 74 79 20 | action.gives.us.the.flexibility. |
| 44a40 | 74 6f 20 63 68 61 6e 67 65 20 74 68 65 20 6c 6f 77 2d 6c 65 76 65 6c 20 64 65 74 61 69 6c 73 20 | to.change.the.low-level.details. |
| 44a60 | 6f 66 0a 68 6f 77 20 73 65 71 75 65 6e 63 65 73 20 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 | of.how.sequences.are.implemented |
| 44a80 | 2c 20 77 68 69 6c 65 20 70 72 65 73 65 72 76 69 6e 67 20 74 68 65 20 63 6f 6e 63 65 70 74 75 61 | ,.while.preserving.the.conceptua |
| 44aa0 | 6c 0a 66 72 61 6d 65 77 6f 72 6b 20 6f 66 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 74 | l.framework.of.operations.that.t |
| 44ac0 | 72 61 6e 73 66 6f 72 6d 20 73 65 71 75 65 6e 63 65 73 20 74 6f 20 73 65 71 75 65 6e 63 65 73 2e | ransform.sequences.to.sequences. |
| 44ae0 | 20 20 53 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 20 65 78 70 61 6e 64 73 20 | ..Section.*Note.2-2-3::.expands. |
| 44b00 | 6f 6e 20 74 68 69 73 20 75 73 65 20 6f 66 20 73 65 71 75 65 6e 63 65 73 20 61 73 20 61 20 66 72 | on.this.use.of.sequences.as.a.fr |
| 44b20 | 61 6d 65 77 6f 72 6b 20 66 6f 72 0a 6f 72 67 61 6e 69 7a 69 6e 67 20 70 72 6f 67 72 61 6d 73 2e | amework.for.organizing.programs. |
| 44b40 | 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 32 31 3a 2a 20 54 68 65 20 70 72 6f 63 | .......*Exercise.2.21:*.The.proc |
| 44b60 | 65 64 75 72 65 20 60 73 71 75 61 72 65 2d 6c 69 73 74 27 20 74 61 6b 65 73 20 61 20 6c 69 73 74 | edure.`square-list'.takes.a.list |
| 44b80 | 20 6f 66 0a 20 20 20 20 20 6e 75 6d 62 65 72 73 20 61 73 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 | .of......numbers.as.argument.and |
| 44ba0 | 20 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 73 71 75 61 72 65 73 20 6f | .returns.a.list.of.the.squares.o |
| 44bc0 | 66 20 74 68 6f 73 65 0a 20 20 20 20 20 6e 75 6d 62 65 72 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 | f.those......numbers............ |
| 44be0 | 20 28 73 71 75 61 72 65 2d 6c 69 73 74 20 28 6c 69 73 74 20 31 20 32 20 33 20 34 29 29 0a 20 20 | .(square-list.(list.1.2.3.4))... |
| 44c00 | 20 20 20 20 20 20 20 20 28 31 20 34 20 39 20 31 36 29 0a 0a 20 20 20 20 20 48 65 72 65 20 61 72 | ........(1.4.9.16).......Here.ar |
| 44c20 | 65 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 60 | e.two.different.definitions.of.` |
| 44c40 | 73 71 75 61 72 65 2d 6c 69 73 74 27 2e 20 20 43 6f 6d 70 6c 65 74 65 0a 20 20 20 20 20 62 6f 74 | square-list'...Complete......bot |
| 44c60 | 68 20 6f 66 20 74 68 65 6d 20 62 79 20 66 69 6c 6c 69 6e 67 20 69 6e 20 74 68 65 20 6d 69 73 73 | h.of.them.by.filling.in.the.miss |
| 44c80 | 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | ing.expressions:............(def |
| 44ca0 | 69 6e 65 20 28 73 71 75 61 72 65 2d 6c 69 73 74 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 20 20 | ine.(square-list.items)......... |
| 44cc0 | 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 20 20 20 20 | ....(if.(null?.items)........... |
| 44ce0 | 20 20 20 20 20 20 6e 69 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 | ......nil.................(cons. |
| 44d00 | 3c 3f 3f 3e 20 3c 3f 3f 3e 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | <??>.<??>)))............(define. |
| 44d20 | 28 73 71 75 61 72 65 2d 6c 69 73 74 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | (square-list.items)............. |
| 44d40 | 28 6d 61 70 20 3c 3f 3f 3e 20 3c 3f 3f 3e 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | (map.<??>.<??>)).......*Exercise |
| 44d60 | 20 32 2e 32 32 3a 2a 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 20 74 72 69 65 73 20 74 6f 20 | .2.22:*.Louis.Reasoner.tries.to. |
| 44d80 | 72 65 77 72 69 74 65 20 74 68 65 20 66 69 72 73 74 0a 20 20 20 20 20 60 73 71 75 61 72 65 2d 6c | rewrite.the.first......`square-l |
| 44da0 | 69 73 74 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | ist'.procedure.of.*Note.Exercise |
| 44dc0 | 20 32 2d 32 31 3a 3a 20 73 6f 20 74 68 61 74 20 69 74 0a 20 20 20 20 20 65 76 6f 6c 76 65 73 20 | .2-21::.so.that.it......evolves. |
| 44de0 | 61 6e 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 | an.iterative.process:........... |
| 44e00 | 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 2d 6c 69 73 74 20 69 74 65 6d 73 29 0a 20 20 20 | .(define.(square-list.items).... |
| 44e20 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 20 74 68 69 6e 67 73 20 61 6e | .........(define.(iter.things.an |
| 44e40 | 73 77 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 | swer)...............(if.(null?.t |
| 44e60 | 68 69 6e 67 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 6e 73 77 65 72 0a | hings)...................answer. |
| 44e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 28 63 64 72 20 74 68 69 | ..................(iter.(cdr.thi |
| 44ea0 | 6e 67 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f | ngs).........................(co |
| 44ec0 | 6e 73 20 28 73 71 75 61 72 65 20 28 63 61 72 20 74 68 69 6e 67 73 29 29 0a 20 20 20 20 20 20 20 | ns.(square.(car.things))........ |
| 44ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 6e 73 77 65 72 29 29 29 | .......................answer))) |
| 44f00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 69 74 65 6d 73 20 6e 69 6c 29 29 0a | ).............(iter.items.nil)). |
| 44f20 | 0a 20 20 20 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 64 65 66 69 6e 69 6e 67 20 60 73 | ......Unfortunately,.defining.`s |
| 44f40 | 71 75 61 72 65 2d 6c 69 73 74 27 20 74 68 69 73 20 77 61 79 20 70 72 6f 64 75 63 65 73 20 74 68 | quare-list'.this.way.produces.th |
| 44f60 | 65 20 61 6e 73 77 65 72 0a 20 20 20 20 20 6c 69 73 74 20 69 6e 20 74 68 65 20 72 65 76 65 72 73 | e.answer......list.in.the.revers |
| 44f80 | 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 6f 6e 65 20 64 65 73 69 72 65 64 2e 20 20 57 68 79 | e.order.of.the.one.desired...Why |
| 44fa0 | 3f 0a 0a 20 20 20 20 20 4c 6f 75 69 73 20 74 68 65 6e 20 74 72 69 65 73 20 74 6f 20 66 69 78 20 | ?.......Louis.then.tries.to.fix. |
| 44fc0 | 68 69 73 20 62 75 67 20 62 79 20 69 6e 74 65 72 63 68 61 6e 67 69 6e 67 20 74 68 65 20 61 72 67 | his.bug.by.interchanging.the.arg |
| 44fe0 | 75 6d 65 6e 74 73 20 74 6f 0a 20 20 20 20 20 60 63 6f 6e 73 27 3a 0a 0a 20 20 20 20 20 20 20 20 | uments.to......`cons':.......... |
| 45000 | 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 2d 6c 69 73 74 20 69 74 65 6d 73 29 0a 20 20 | ..(define.(square-list.items)... |
| 45020 | 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 20 74 68 69 6e 67 73 20 61 | ..........(define.(iter.things.a |
| 45040 | 6e 73 77 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 | nswer)...............(if.(null?. |
| 45060 | 74 68 69 6e 67 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 6e 73 77 65 72 | things)...................answer |
| 45080 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 28 63 64 72 20 74 68 | ...................(iter.(cdr.th |
| 450a0 | 69 6e 67 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 | ings).........................(c |
| 450c0 | 6f 6e 73 20 61 6e 73 77 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ons.answer...................... |
| 450e0 | 20 20 20 20 20 20 20 20 20 28 73 71 75 61 72 65 20 28 63 61 72 20 74 68 69 6e 67 73 29 29 29 29 | .........(square.(car.things)))) |
| 45100 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 69 74 65 6d 73 20 6e 69 6c 29 29 | )).............(iter.items.nil)) |
| 45120 | 0a 0a 20 20 20 20 20 54 68 69 73 20 64 6f 65 73 6e 27 74 20 77 6f 72 6b 20 65 69 74 68 65 72 2e | .......This.doesn't.work.either. |
| 45140 | 20 20 45 78 70 6c 61 69 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 32 33 3a | ..Explain........*Exercise.2.23: |
| 45160 | 2a 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 66 6f 72 2d 65 61 63 68 27 20 69 73 20 73 69 | *.The.procedure.`for-each'.is.si |
| 45180 | 6d 69 6c 61 72 20 74 6f 20 60 6d 61 70 27 2e 20 20 49 74 0a 20 20 20 20 20 74 61 6b 65 73 20 61 | milar.to.`map'...It......takes.a |
| 451a0 | 73 20 61 72 67 75 6d 65 6e 74 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 61 6e 64 20 61 20 6c 69 | s.arguments.a.procedure.and.a.li |
| 451c0 | 73 74 20 6f 66 20 65 6c 65 6d 65 6e 74 73 2e 20 20 48 6f 77 65 76 65 72 2c 0a 20 20 20 20 20 72 | st.of.elements...However,......r |
| 451e0 | 61 74 68 65 72 20 74 68 61 6e 20 66 6f 72 6d 69 6e 67 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 | ather.than.forming.a.list.of.the |
| 45200 | 20 72 65 73 75 6c 74 73 2c 20 60 66 6f 72 2d 65 61 63 68 27 20 6a 75 73 74 20 61 70 70 6c 69 65 | .results,.`for-each'.just.applie |
| 45220 | 73 0a 20 20 20 20 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 65 61 63 68 20 6f 66 20 | s......the.procedure.to.each.of. |
| 45240 | 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 75 72 6e 2c 20 66 72 6f 6d 20 6c 65 66 74 20 | the.elements.in.turn,.from.left. |
| 45260 | 74 6f 20 72 69 67 68 74 2e 0a 20 20 20 20 20 54 68 65 20 76 61 6c 75 65 73 20 72 65 74 75 72 6e | to.right.......The.values.return |
| 45280 | 65 64 20 62 79 20 61 70 70 6c 79 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 | ed.by.applying.the.procedure.to. |
| 452a0 | 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 0a 20 20 20 20 20 6e 6f 74 20 75 73 65 64 20 61 | the.elements.are......not.used.a |
| 452c0 | 74 20 61 6c 6c 2d 2d 60 66 6f 72 2d 65 61 63 68 27 20 69 73 20 75 73 65 64 20 77 69 74 68 20 70 | t.all--`for-each'.is.used.with.p |
| 452e0 | 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 70 65 72 66 6f 72 6d 0a 20 20 20 20 20 61 6e 20 61 | rocedures.that.perform......an.a |
| 45300 | 63 74 69 6f 6e 2c 20 73 75 63 68 20 61 73 20 70 72 69 6e 74 69 6e 67 2e 20 20 46 6f 72 20 65 78 | ction,.such.as.printing...For.ex |
| 45320 | 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d | ample,............(for-each.(lam |
| 45340 | 62 64 61 20 28 78 29 20 28 6e 65 77 6c 69 6e 65 29 20 28 64 69 73 70 6c 61 79 20 78 29 29 0a 20 | bda.(x).(newline).(display.x)).. |
| 45360 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 35 37 20 33 32 31 20 | ...................(list.57.321. |
| 45380 | 38 38 29 29 0a 20 20 20 20 20 20 20 20 20 20 35 37 0a 20 20 20 20 20 20 20 20 20 20 33 32 31 0a | 88))...........57...........321. |
| 453a0 | 20 20 20 20 20 20 20 20 20 20 38 38 0a 0a 20 20 20 20 20 54 68 65 20 76 61 6c 75 65 20 72 65 74 | ..........88.......The.value.ret |
| 453c0 | 75 72 6e 65 64 20 62 79 20 74 68 65 20 63 61 6c 6c 20 74 6f 20 60 66 6f 72 2d 65 61 63 68 27 20 | urned.by.the.call.to.`for-each'. |
| 453e0 | 28 6e 6f 74 20 69 6c 6c 75 73 74 72 61 74 65 64 0a 20 20 20 20 20 61 62 6f 76 65 29 20 63 61 6e | (not.illustrated......above).can |
| 45400 | 20 62 65 20 73 6f 6d 65 74 68 69 6e 67 20 61 72 62 69 74 72 61 72 79 2c 20 73 75 63 68 20 61 73 | .be.something.arbitrary,.such.as |
| 45420 | 20 74 72 75 65 2e 20 20 47 69 76 65 20 61 6e 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 61 74 | .true...Give.an......implementat |
| 45440 | 69 6f 6e 20 6f 66 20 60 66 6f 72 2d 65 61 63 68 27 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d | ion.of.`for-each'......--------- |
| 45460 | 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 | -.Footnotes.----------.....(1).I |
| 45480 | 6e 20 74 68 69 73 20 62 6f 6f 6b 2c 20 77 65 20 75 73 65 20 22 6c 69 73 74 22 20 74 6f 20 6d 65 | n.this.book,.we.use."list".to.me |
| 454a0 | 61 6e 20 61 20 63 68 61 69 6e 20 6f 66 20 70 61 69 72 73 20 74 65 72 6d 69 6e 61 74 65 64 0a 62 | an.a.chain.of.pairs.terminated.b |
| 454c0 | 79 20 74 68 65 20 65 6e 64 2d 6f 66 2d 6c 69 73 74 20 6d 61 72 6b 65 72 2e 20 20 49 6e 20 63 6f | y.the.end-of-list.marker...In.co |
| 454e0 | 6e 74 72 61 73 74 2c 20 74 68 65 20 74 65 72 6d 20 22 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 | ntrast,.the.term."list.structure |
| 45500 | 22 0a 72 65 66 65 72 73 20 74 6f 20 61 6e 79 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 20 6d | ".refers.to.any.data.structure.m |
| 45520 | 61 64 65 20 6f 75 74 20 6f 66 20 70 61 69 72 73 2c 20 6e 6f 74 20 6a 75 73 74 20 74 6f 20 6c 69 | ade.out.of.pairs,.not.just.to.li |
| 45540 | 73 74 73 2e 0a 0a 20 20 20 28 32 29 20 53 69 6e 63 65 20 6e 65 73 74 65 64 20 61 70 70 6c 69 63 | sts......(2).Since.nested.applic |
| 45560 | 61 74 69 6f 6e 73 20 6f 66 20 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 20 61 72 65 20 63 75 | ations.of.`car'.and.`cdr'.are.cu |
| 45580 | 6d 62 65 72 73 6f 6d 65 20 74 6f 0a 77 72 69 74 65 2c 20 4c 69 73 70 20 64 69 61 6c 65 63 74 73 | mbersome.to.write,.Lisp.dialects |
| 455a0 | 20 70 72 6f 76 69 64 65 20 61 62 62 72 65 76 69 61 74 69 6f 6e 73 20 66 6f 72 20 74 68 65 6d 2d | .provide.abbreviations.for.them- |
| 455c0 | 2d 66 6f 72 20 69 6e 73 74 61 6e 63 65 2c 0a 0a 20 20 20 20 20 28 63 61 64 72 20 28 41 52 47 29 | -for.instance,.......(cadr.(ARG) |
| 455e0 | 29 20 3d 20 28 63 61 72 20 28 63 64 72 20 28 41 52 47 29 29 29 0a 0a 20 20 20 54 68 65 20 6e 61 | ).=.(car.(cdr.(ARG))).....The.na |
| 45600 | 6d 65 73 20 6f 66 20 61 6c 6c 20 73 75 63 68 20 70 72 6f 63 65 64 75 72 65 73 20 73 74 61 72 74 | mes.of.all.such.procedures.start |
| 45620 | 20 77 69 74 68 20 60 63 27 20 61 6e 64 20 65 6e 64 20 77 69 74 68 20 60 72 27 2e 0a 45 61 63 68 | .with.`c'.and.end.with.`r'..Each |
| 45640 | 20 60 61 27 20 62 65 74 77 65 65 6e 20 74 68 65 6d 20 73 74 61 6e 64 73 20 66 6f 72 20 61 20 60 | .`a'.between.them.stands.for.a.` |
| 45660 | 63 61 72 27 20 6f 70 65 72 61 74 69 6f 6e 20 61 6e 64 20 65 61 63 68 20 60 64 27 20 66 6f 72 20 | car'.operation.and.each.`d'.for. |
| 45680 | 61 0a 60 63 64 72 27 20 6f 70 65 72 61 74 69 6f 6e 2c 20 74 6f 20 62 65 20 61 70 70 6c 69 65 64 | a.`cdr'.operation,.to.be.applied |
| 456a0 | 20 69 6e 20 74 68 65 20 73 61 6d 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 79 | .in.the.same.order.in.which.they |
| 456c0 | 20 61 70 70 65 61 72 0a 69 6e 20 74 68 65 20 6e 61 6d 65 2e 20 20 54 68 65 20 6e 61 6d 65 73 20 | .appear.in.the.name...The.names. |
| 456e0 | 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 20 70 65 72 73 69 73 74 20 62 65 63 61 75 73 65 20 | `car'.and.`cdr'.persist.because. |
| 45700 | 73 69 6d 70 6c 65 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 6c 69 6b 65 20 60 63 61 64 72 27 20 | simple.combinations.like.`cadr'. |
| 45720 | 61 72 65 20 70 72 6f 6e 6f 75 6e 63 65 61 62 6c 65 2e 0a 0a 20 20 20 28 33 29 20 49 74 27 73 20 | are.pronounceable......(3).It's. |
| 45740 | 72 65 6d 61 72 6b 61 62 6c 65 20 68 6f 77 20 6d 75 63 68 20 65 6e 65 72 67 79 20 69 6e 20 74 68 | remarkable.how.much.energy.in.th |
| 45760 | 65 20 73 74 61 6e 64 61 72 64 69 7a 61 74 69 6f 6e 20 6f 66 20 4c 69 73 70 0a 64 69 61 6c 65 63 | e.standardization.of.Lisp.dialec |
| 45780 | 74 73 20 68 61 73 20 62 65 65 6e 20 64 69 73 73 69 70 61 74 65 64 20 69 6e 20 61 72 67 75 6d 65 | ts.has.been.dissipated.in.argume |
| 457a0 | 6e 74 73 20 74 68 61 74 20 61 72 65 20 6c 69 74 65 72 61 6c 6c 79 20 6f 76 65 72 0a 6e 6f 74 68 | nts.that.are.literally.over.noth |
| 457c0 | 69 6e 67 3a 20 53 68 6f 75 6c 64 20 60 6e 69 6c 27 20 62 65 20 61 6e 20 6f 72 64 69 6e 61 72 79 | ing:.Should.`nil'.be.an.ordinary |
| 457e0 | 20 6e 61 6d 65 3f 20 20 53 68 6f 75 6c 64 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 6e 69 6c | .name?..Should.the.value.of.`nil |
| 45800 | 27 0a 62 65 20 61 20 73 79 6d 62 6f 6c 3f 20 20 53 68 6f 75 6c 64 20 69 74 20 62 65 20 61 20 6c | '.be.a.symbol?..Should.it.be.a.l |
| 45820 | 69 73 74 3f 20 20 53 68 6f 75 6c 64 20 69 74 20 62 65 20 61 20 70 61 69 72 3f 20 20 49 6e 20 53 | ist?..Should.it.be.a.pair?..In.S |
| 45840 | 63 68 65 6d 65 2c 0a 60 6e 69 6c 27 20 69 73 20 61 6e 20 6f 72 64 69 6e 61 72 79 20 6e 61 6d 65 | cheme,.`nil'.is.an.ordinary.name |
| 45860 | 2c 20 77 68 69 63 68 20 77 65 20 75 73 65 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 61 | ,.which.we.use.in.this.section.a |
| 45880 | 73 20 61 20 76 61 72 69 61 62 6c 65 0a 77 68 6f 73 65 20 76 61 6c 75 65 20 69 73 20 74 68 65 20 | s.a.variable.whose.value.is.the. |
| 458a0 | 65 6e 64 2d 6f 66 2d 6c 69 73 74 20 6d 61 72 6b 65 72 20 28 6a 75 73 74 20 61 73 20 60 74 72 75 | end-of-list.marker.(just.as.`tru |
| 458c0 | 65 27 20 69 73 20 61 6e 20 6f 72 64 69 6e 61 72 79 0a 76 61 72 69 61 62 6c 65 20 74 68 61 74 20 | e'.is.an.ordinary.variable.that. |
| 458e0 | 68 61 73 20 61 20 74 72 75 65 20 76 61 6c 75 65 29 2e 20 20 4f 74 68 65 72 20 64 69 61 6c 65 63 | has.a.true.value)...Other.dialec |
| 45900 | 74 73 20 6f 66 20 4c 69 73 70 2c 20 69 6e 63 6c 75 64 69 6e 67 0a 43 6f 6d 6d 6f 6e 20 4c 69 73 | ts.of.Lisp,.including.Common.Lis |
| 45920 | 70 2c 20 74 72 65 61 74 20 60 6e 69 6c 27 20 61 73 20 61 20 73 70 65 63 69 61 6c 20 73 79 6d 62 | p,.treat.`nil'.as.a.special.symb |
| 45940 | 6f 6c 2e 20 20 54 68 65 20 61 75 74 68 6f 72 73 20 6f 66 20 74 68 69 73 0a 62 6f 6f 6b 2c 20 77 | ol...The.authors.of.this.book,.w |
| 45960 | 68 6f 20 68 61 76 65 20 65 6e 64 75 72 65 64 20 74 6f 6f 20 6d 61 6e 79 20 6c 61 6e 67 75 61 67 | ho.have.endured.too.many.languag |
| 45980 | 65 20 73 74 61 6e 64 61 72 64 69 7a 61 74 69 6f 6e 20 62 72 61 77 6c 73 2c 20 77 6f 75 6c 64 0a | e.standardization.brawls,.would. |
| 459a0 | 6c 69 6b 65 20 74 6f 20 61 76 6f 69 64 20 74 68 65 20 65 6e 74 69 72 65 20 69 73 73 75 65 2e 20 | like.to.avoid.the.entire.issue.. |
| 459c0 | 20 4f 6e 63 65 20 77 65 20 68 61 76 65 20 69 6e 74 72 6f 64 75 63 65 64 20 71 75 6f 74 61 74 69 | .Once.we.have.introduced.quotati |
| 459e0 | 6f 6e 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 33 3a 3a 2c 20 77 65 20 77 69 | on.in.section.*Note.2-3::,.we.wi |
| 45a00 | 6c 6c 20 64 65 6e 6f 74 65 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 20 61 73 20 60 27 28 29 | ll.denote.the.empty.list.as.`'() |
| 45a20 | 27 20 61 6e 64 0a 64 69 73 70 65 6e 73 65 20 77 69 74 68 20 74 68 65 20 76 61 72 69 61 62 6c 65 | '.and.dispense.with.the.variable |
| 45a40 | 20 60 6e 69 6c 27 20 65 6e 74 69 72 65 6c 79 2e 0a 0a 20 20 20 28 34 29 20 54 6f 20 64 65 66 69 | .`nil'.entirely......(4).To.defi |
| 45a60 | 6e 65 20 60 66 27 20 61 6e 64 20 60 67 27 20 75 73 69 6e 67 20 60 6c 61 6d 62 64 61 27 20 77 65 | ne.`f'.and.`g'.using.`lambda'.we |
| 45a80 | 20 77 6f 75 6c 64 20 77 72 69 74 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 66 20 28 6c 61 | .would.write.......(define.f.(la |
| 45aa0 | 6d 62 64 61 20 28 78 20 79 20 2e 20 7a 29 20 3c 42 4f 44 59 3e 29 29 0a 20 20 20 20 20 28 64 65 | mbda.(x.y...z).<BODY>))......(de |
| 45ac0 | 66 69 6e 65 20 67 20 28 6c 61 6d 62 64 61 20 77 20 3c 42 4f 44 59 3e 29 29 0a 0a 20 20 20 28 35 | fine.g.(lambda.w.<BODY>)).....(5 |
| 45ae0 | 29 20 5b 46 6f 6f 74 6e 6f 74 65 20 31 32 5d 20 53 63 68 65 6d 65 20 73 74 61 6e 64 61 72 64 6c | ).[Footnote.12].Scheme.standardl |
| 45b00 | 79 20 70 72 6f 76 69 64 65 73 20 61 20 60 6d 61 70 27 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 | y.provides.a.`map'.procedure.tha |
| 45b20 | 74 0a 69 73 20 6d 6f 72 65 20 67 65 6e 65 72 61 6c 20 74 68 61 6e 20 74 68 65 20 6f 6e 65 20 64 | t.is.more.general.than.the.one.d |
| 45b40 | 65 73 63 72 69 62 65 64 20 68 65 72 65 2e 20 20 54 68 69 73 20 6d 6f 72 65 20 67 65 6e 65 72 61 | escribed.here...This.more.genera |
| 45b60 | 6c 20 60 6d 61 70 27 0a 74 61 6b 65 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 6e 20 61 | l.`map'.takes.a.procedure.of.n.a |
| 45b80 | 72 67 75 6d 65 6e 74 73 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 6e 20 6c 69 73 74 73 2c | rguments,.together.with.n.lists, |
| 45ba0 | 20 61 6e 64 20 61 70 70 6c 69 65 73 0a 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 61 6c | .and.applies.the.procedure.to.al |
| 45bc0 | 6c 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 6c 69 73 74 | l.the.first.elements.of.the.list |
| 45be0 | 73 2c 20 61 6c 6c 20 74 68 65 20 73 65 63 6f 6e 64 0a 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 | s,.all.the.second.elements.of.th |
| 45c00 | 65 20 6c 69 73 74 73 2c 20 61 6e 64 20 73 6f 20 6f 6e 2c 20 72 65 74 75 72 6e 69 6e 67 20 61 20 | e.lists,.and.so.on,.returning.a. |
| 45c20 | 6c 69 73 74 20 6f 66 20 74 68 65 20 72 65 73 75 6c 74 73 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c | list.of.the.results...For.exampl |
| 45c40 | 65 3a 0a 0a 20 20 20 20 20 28 6d 61 70 20 2b 20 28 6c 69 73 74 20 31 20 32 20 33 29 20 28 6c 69 | e:.......(map.+.(list.1.2.3).(li |
| 45c60 | 73 74 20 34 30 20 35 30 20 36 30 29 20 28 6c 69 73 74 20 37 30 30 20 38 30 30 20 39 30 30 29 29 | st.40.50.60).(list.700.800.900)) |
| 45c80 | 0a 20 20 20 20 20 28 37 34 31 20 38 35 32 20 39 36 33 29 0a 0a 20 20 20 20 20 28 6d 61 70 20 28 | ......(741.852.963).......(map.( |
| 45ca0 | 6c 61 6d 62 64 61 20 28 78 20 79 29 20 28 2b 20 78 20 28 2a 20 32 20 79 29 29 29 0a 20 20 20 20 | lambda.(x.y).(+.x.(*.2.y)))..... |
| 45cc0 | 20 20 20 20 20 20 28 6c 69 73 74 20 31 20 32 20 33 29 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ......(list.1.2.3)...........(li |
| 45ce0 | 73 74 20 34 20 35 20 36 29 29 0a 20 20 20 20 20 28 39 20 31 32 20 31 35 29 0a 0a 1f 0a 46 69 6c | st.4.5.6))......(9.12.15)....Fil |
| 45d00 | 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 32 2d 32 2c 20 20 4e 65 78 | e:.sicp.info,..Node:.2-2-2,..Nex |
| 45d20 | 74 3a 20 32 2d 32 2d 33 2c 20 20 50 72 65 76 3a 20 32 2d 32 2d 31 2c 20 20 55 70 3a 20 32 2d 32 | t:.2-2-3,..Prev:.2-2-1,..Up:.2-2 |
| 45d40 | 0a 0a 32 2e 32 2e 32 20 48 69 65 72 61 72 63 68 69 63 61 6c 20 53 74 72 75 63 74 75 72 65 73 0a | ..2.2.2.Hierarchical.Structures. |
| 45d60 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 | -----------------------------..T |
| 45d80 | 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 73 65 71 75 65 6e 63 65 73 20 69 | he.representation.of.sequences.i |
| 45da0 | 6e 20 74 65 72 6d 73 20 6f 66 20 6c 69 73 74 73 20 67 65 6e 65 72 61 6c 69 7a 65 73 20 6e 61 74 | n.terms.of.lists.generalizes.nat |
| 45dc0 | 75 72 61 6c 6c 79 0a 74 6f 20 72 65 70 72 65 73 65 6e 74 20 73 65 71 75 65 6e 63 65 73 20 77 68 | urally.to.represent.sequences.wh |
| 45de0 | 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 6d 61 79 20 74 68 65 6d 73 65 6c 76 65 73 20 62 65 20 73 | ose.elements.may.themselves.be.s |
| 45e00 | 65 71 75 65 6e 63 65 73 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 72 | equences...For.example,.we.can.r |
| 45e20 | 65 67 61 72 64 20 74 68 65 20 6f 62 6a 65 63 74 20 60 28 28 31 20 32 29 20 33 20 34 29 27 20 63 | egard.the.object.`((1.2).3.4)'.c |
| 45e40 | 6f 6e 73 74 72 75 63 74 65 64 20 62 79 0a 0a 20 20 20 20 20 28 63 6f 6e 73 20 28 6c 69 73 74 20 | onstructed.by.......(cons.(list. |
| 45e60 | 31 20 32 29 20 28 6c 69 73 74 20 33 20 34 29 29 0a 0a 61 73 20 61 20 6c 69 73 74 20 6f 66 20 74 | 1.2).(list.3.4))..as.a.list.of.t |
| 45e80 | 68 72 65 65 20 69 74 65 6d 73 2c 20 74 68 65 20 66 69 72 73 74 20 6f 66 20 77 68 69 63 68 20 69 | hree.items,.the.first.of.which.i |
| 45ea0 | 73 20 69 74 73 65 6c 66 20 61 20 6c 69 73 74 2c 20 60 28 31 20 32 29 27 2e 0a 49 6e 64 65 65 64 | s.itself.a.list,.`(1.2)'..Indeed |
| 45ec0 | 2c 20 74 68 69 73 20 69 73 20 73 75 67 67 65 73 74 65 64 20 62 79 20 74 68 65 20 66 6f 72 6d 20 | ,.this.is.suggested.by.the.form. |
| 45ee0 | 69 6e 20 77 68 69 63 68 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 20 70 72 69 6e 74 65 64 20 62 | in.which.the.result.is.printed.b |
| 45f00 | 79 0a 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 | y.the.interpreter...*Note.Figure |
| 45f20 | 20 32 2d 35 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 | .2-5::.shows.the.representation. |
| 45f40 | 6f 66 20 74 68 69 73 0a 73 74 72 75 63 74 75 72 65 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 70 61 | of.this.structure.in.terms.of.pa |
| 45f60 | 69 72 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 35 3a 2a 20 53 74 72 75 63 74 75 | irs........*Figure.2.5:*.Structu |
| 45f80 | 72 65 20 66 6f 72 6d 65 64 20 62 79 20 60 28 63 6f 6e 73 20 28 6c 69 73 74 20 31 20 32 29 20 28 | re.formed.by.`(cons.(list.1.2).( |
| 45fa0 | 6c 69 73 74 20 33 20 34 29 29 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | list.3.4))'..................... |
| 45fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 45fe0 | 20 20 28 33 20 34 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..(3.4)......................... |
| 46000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a | ..............................|. |
| 46020 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 46040 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 | ......................V......... |
| 46060 | 20 20 28 28 31 20 32 29 20 33 20 34 29 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 | ..((1.2).3.4)..+---+---+........ |
| 46080 | 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d | ..........+---+---+.....+---+--- |
| 460a0 | 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a | +...................---->|.*.|.* |
| 460c0 | 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d | -+----------------->|.*.|.*-+--- |
| 460e0 | 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ->|.*.|./.|..................... |
| 46100 | 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d | ...+-|-+---+..................+- |
| 46120 | 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 | |-+---+.....+-|-+---+........... |
| 46140 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...............|................ |
| 46160 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 | ..........|.............|....... |
| 46180 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 | ...................V............ |
| 461a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 | ..............V.............V... |
| 461c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 31 20 32 29 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 | ..............(1.2)..+---+---+.. |
| 461e0 | 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d | ...+---+---+....+---+.........+- |
| 46200 | 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 3e 7c 20 2a 20 7c | --+...................---->|.*.| |
| 46220 | 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 20 20 20 20 7c 20 33 20 7c 20 20 20 20 20 | .*-+---->|.*.|./.|....|.3.|..... |
| 46240 | 20 20 20 20 7c 20 34 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....|.4.|....................... |
| 46260 | 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d | .+-|-+---+.....+-|-+---+....+--- |
| 46280 | 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | +.........+---+................. |
| 462a0 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 | .........|.............|........ |
| 462c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..................V............. |
| 462e0 | 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 | V........................+---+.. |
| 46300 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......+---+.................... |
| 46320 | 20 20 20 20 7c 20 31 20 7c 20 20 20 20 20 20 20 20 20 7c 20 32 20 7c 0a 20 20 20 20 20 20 20 20 | ....|.1.|.........|.2.|......... |
| 46340 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d | ...............+---+.........+-- |
| 46360 | 2d 2b 0a 0a 20 20 20 41 6e 6f 74 68 65 72 20 77 61 79 20 74 6f 20 74 68 69 6e 6b 20 6f 66 20 73 | -+.....Another.way.to.think.of.s |
| 46380 | 65 71 75 65 6e 63 65 73 20 77 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 20 73 65 71 75 | equences.whose.elements.are.sequ |
| 463a0 | 65 6e 63 65 73 20 69 73 20 61 73 20 22 74 72 65 65 73 22 2e 0a 54 68 65 20 65 6c 65 6d 65 6e 74 | ences.is.as."trees"..The.element |
| 463c0 | 73 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 61 72 65 20 74 68 65 20 62 72 61 6e 63 68 | s.of.the.sequence.are.the.branch |
| 463e0 | 65 73 20 6f 66 20 74 68 65 20 74 72 65 65 2c 20 61 6e 64 0a 65 6c 65 6d 65 6e 74 73 20 74 68 61 | es.of.the.tree,.and.elements.tha |
| 46400 | 74 20 61 72 65 20 74 68 65 6d 73 65 6c 76 65 73 20 73 65 71 75 65 6e 63 65 73 20 61 72 65 20 73 | t.are.themselves.sequences.are.s |
| 46420 | 75 62 74 72 65 65 73 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 36 3a 3a 0a 73 68 6f | ubtrees...*Note.Figure.2-6::.sho |
| 46440 | 77 73 20 74 68 65 20 73 74 72 75 63 74 75 72 65 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 | ws.the.structure.in.*Note.Figure |
| 46460 | 20 32 2d 35 3a 3a 20 76 69 65 77 65 64 20 61 73 20 61 20 74 72 65 65 2e 0a 0a 20 20 20 20 20 2a | .2-5::.viewed.as.a.tree........* |
| 46480 | 46 69 67 75 72 65 20 32 2e 36 3a 2a 20 54 68 65 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 20 | Figure.2.6:*.The.list.structure. |
| 464a0 | 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 35 3a 3a 20 76 69 65 77 65 64 20 61 73 20 | in.*Note.Figure.2-5::.viewed.as. |
| 464c0 | 61 0a 20 20 20 20 20 74 72 65 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 28 28 31 20 32 29 20 | a......tree..............((1.2). |
| 464e0 | 33 20 34 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 5c 5c 0a 20 20 20 20 20 20 20 20 | 3.4)................/\\......... |
| 46500 | 20 20 20 20 20 20 2f 20 20 7c 20 5c 0a 20 20 20 20 20 20 20 20 20 20 28 31 20 32 29 20 20 33 20 | ....../..|.\...........(1.2)..3. |
| 46520 | 34 0a 20 20 20 20 20 20 20 20 20 20 20 2f 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 31 20 32 0a | 4............/.\............1.2. |
| 46540 | 0a 20 20 20 52 65 63 75 72 73 69 6f 6e 20 69 73 20 61 20 6e 61 74 75 72 61 6c 20 74 6f 6f 6c 20 | ....Recursion.is.a.natural.tool. |
| 46560 | 66 6f 72 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 74 72 65 65 20 73 74 72 75 63 74 75 72 65 73 | for.dealing.with.tree.structures |
| 46580 | 2c 20 73 69 6e 63 65 0a 77 65 20 63 61 6e 20 6f 66 74 65 6e 20 72 65 64 75 63 65 20 6f 70 65 72 | ,.since.we.can.often.reduce.oper |
| 465a0 | 61 74 69 6f 6e 73 20 6f 6e 20 74 72 65 65 73 20 74 6f 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e | ations.on.trees.to.operations.on |
| 465c0 | 20 74 68 65 69 72 0a 62 72 61 6e 63 68 65 73 2c 20 77 68 69 63 68 20 72 65 64 75 63 65 20 69 6e | .their.branches,.which.reduce.in |
| 465e0 | 20 74 75 72 6e 20 74 6f 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 74 68 65 20 62 72 61 6e 63 | .turn.to.operations.on.the.branc |
| 46600 | 68 65 73 20 6f 66 20 74 68 65 0a 62 72 61 6e 63 68 65 73 2c 20 61 6e 64 20 73 6f 20 6f 6e 2c 20 | hes.of.the.branches,.and.so.on,. |
| 46620 | 75 6e 74 69 6c 20 77 65 20 72 65 61 63 68 20 74 68 65 20 6c 65 61 76 65 73 20 6f 66 20 74 68 65 | until.we.reach.the.leaves.of.the |
| 46640 | 20 74 72 65 65 2e 20 20 41 73 20 61 6e 0a 65 78 61 6d 70 6c 65 2c 20 63 6f 6d 70 61 72 65 20 74 | .tree...As.an.example,.compare.t |
| 46660 | 68 65 20 60 6c 65 6e 67 74 68 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e | he.`length'.procedure.of.section |
| 46680 | 20 2a 4e 6f 74 65 20 32 2d 32 2d 31 3a 3a 20 77 69 74 68 0a 74 68 65 20 60 63 6f 75 6e 74 2d 6c | .*Note.2-2-1::.with.the.`count-l |
| 466a0 | 65 61 76 65 73 27 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 72 65 74 75 72 6e 73 20 | eaves'.procedure,.which.returns. |
| 466c0 | 74 68 65 20 74 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 6c 65 61 76 65 73 0a 6f 66 20 61 20 | the.total.number.of.leaves.of.a. |
| 466e0 | 74 72 65 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 28 63 6f 6e 73 20 28 6c 69 73 | tree:.......(define.x.(cons.(lis |
| 46700 | 74 20 31 20 32 29 20 28 6c 69 73 74 20 33 20 34 29 29 29 0a 0a 20 20 20 20 20 28 6c 65 6e 67 74 | t.1.2).(list.3.4))).......(lengt |
| 46720 | 68 20 78 29 0a 20 20 20 20 20 33 0a 0a 20 20 20 20 20 28 63 6f 75 6e 74 2d 6c 65 61 76 65 73 20 | h.x)......3.......(count-leaves. |
| 46740 | 78 29 0a 20 20 20 20 20 34 0a 0a 20 20 20 20 20 28 6c 69 73 74 20 78 20 78 29 0a 20 20 20 20 20 | x)......4.......(list.x.x)...... |
| 46760 | 28 28 28 31 20 32 29 20 33 20 34 29 20 28 28 31 20 32 29 20 33 20 34 29 29 0a 0a 20 20 20 20 20 | (((1.2).3.4).((1.2).3.4))....... |
| 46780 | 28 6c 65 6e 67 74 68 20 28 6c 69 73 74 20 78 20 78 29 29 0a 20 20 20 20 20 32 0a 0a 20 20 20 20 | (length.(list.x.x))......2...... |
| 467a0 | 20 28 63 6f 75 6e 74 2d 6c 65 61 76 65 73 20 28 6c 69 73 74 20 78 20 78 29 29 0a 20 20 20 20 20 | .(count-leaves.(list.x.x))...... |
| 467c0 | 38 0a 0a 20 20 20 54 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 60 63 6f 75 6e 74 2d 6c 65 61 76 65 73 | 8.....To.implement.`count-leaves |
| 467e0 | 27 2c 20 72 65 63 61 6c 6c 20 74 68 65 20 72 65 63 75 72 73 69 76 65 20 70 6c 61 6e 20 66 6f 72 | ',.recall.the.recursive.plan.for |
| 46800 | 20 63 6f 6d 70 75 74 69 6e 67 0a 60 6c 65 6e 67 74 68 27 3a 0a 0a 20 20 20 2a 20 60 4c 65 6e 67 | .computing.`length':.....*.`Leng |
| 46820 | 74 68 27 20 6f 66 20 61 20 6c 69 73 74 20 60 78 27 20 69 73 20 31 20 70 6c 75 73 20 60 6c 65 6e | th'.of.a.list.`x'.is.1.plus.`len |
| 46840 | 67 74 68 27 20 6f 66 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 60 78 27 2e 0a 0a 20 20 20 2a 20 | gth'.of.the.`cdr'.of.`x'......*. |
| 46860 | 60 4c 65 6e 67 74 68 27 20 6f 66 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 20 69 73 20 30 2e | `Length'.of.the.empty.list.is.0. |
| 46880 | 0a 0a 0a 20 20 20 60 43 6f 75 6e 74 2d 6c 65 61 76 65 73 27 20 69 73 20 73 69 6d 69 6c 61 72 2e | ......`Count-leaves'.is.similar. |
| 468a0 | 20 20 54 68 65 20 76 61 6c 75 65 20 66 6f 72 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 20 69 | ..The.value.for.the.empty.list.i |
| 468c0 | 73 20 74 68 65 20 73 61 6d 65 3a 0a 0a 20 20 20 2a 20 60 43 6f 75 6e 74 2d 6c 65 61 76 65 73 27 | s.the.same:.....*.`Count-leaves' |
| 468e0 | 20 6f 66 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 20 69 73 20 30 2e 0a 0a 0a 20 20 20 42 75 | .of.the.empty.list.is.0.......Bu |
| 46900 | 74 20 69 6e 20 74 68 65 20 72 65 64 75 63 74 69 6f 6e 20 73 74 65 70 2c 20 77 68 65 72 65 20 77 | t.in.the.reduction.step,.where.w |
| 46920 | 65 20 73 74 72 69 70 20 6f 66 66 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 74 68 65 20 6c 69 73 | e.strip.off.the.`car'.of.the.lis |
| 46940 | 74 2c 0a 77 65 20 6d 75 73 74 20 74 61 6b 65 20 69 6e 74 6f 20 61 63 63 6f 75 6e 74 20 74 68 61 | t,.we.must.take.into.account.tha |
| 46960 | 74 20 74 68 65 20 60 63 61 72 27 20 6d 61 79 20 69 74 73 65 6c 66 20 62 65 20 61 20 74 72 65 65 | t.the.`car'.may.itself.be.a.tree |
| 46980 | 20 77 68 6f 73 65 0a 6c 65 61 76 65 73 20 77 65 20 6e 65 65 64 20 74 6f 20 63 6f 75 6e 74 2e 20 | .whose.leaves.we.need.to.count.. |
| 469a0 | 20 54 68 75 73 2c 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 72 65 64 75 63 74 69 6f 6e | .Thus,.the.appropriate.reduction |
| 469c0 | 20 73 74 65 70 20 69 73 0a 0a 20 20 20 2a 20 60 43 6f 75 6e 74 2d 6c 65 61 76 65 73 27 20 6f 66 | .step.is.....*.`Count-leaves'.of |
| 469e0 | 20 61 20 74 72 65 65 20 60 78 27 20 69 73 20 60 63 6f 75 6e 74 2d 6c 65 61 76 65 73 27 20 6f 66 | .a.tree.`x'.is.`count-leaves'.of |
| 46a00 | 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 60 78 27 0a 20 20 20 20 20 70 6c 75 73 20 60 63 6f 75 | .the.`car'.of.`x'......plus.`cou |
| 46a20 | 6e 74 2d 6c 65 61 76 65 73 27 20 6f 66 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 60 78 27 2e 0a | nt-leaves'.of.the.`cdr'.of.`x'.. |
| 46a40 | 0a 0a 20 20 20 46 69 6e 61 6c 6c 79 2c 20 62 79 20 74 61 6b 69 6e 67 20 60 63 61 72 27 73 20 77 | .....Finally,.by.taking.`car's.w |
| 46a60 | 65 20 72 65 61 63 68 20 61 63 74 75 61 6c 20 6c 65 61 76 65 73 2c 20 73 6f 20 77 65 20 6e 65 65 | e.reach.actual.leaves,.so.we.nee |
| 46a80 | 64 20 61 6e 6f 74 68 65 72 0a 62 61 73 65 20 63 61 73 65 3a 0a 0a 20 20 20 2a 20 60 43 6f 75 6e | d.another.base.case:.....*.`Coun |
| 46aa0 | 74 2d 6c 65 61 76 65 73 27 20 6f 66 20 61 20 6c 65 61 66 20 69 73 20 31 2e 0a 0a 0a 20 20 20 54 | t-leaves'.of.a.leaf.is.1.......T |
| 46ac0 | 6f 20 61 69 64 20 69 6e 20 77 72 69 74 69 6e 67 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 | o.aid.in.writing.recursive.proce |
| 46ae0 | 64 75 72 65 73 20 6f 6e 20 74 72 65 65 73 2c 20 53 63 68 65 6d 65 20 70 72 6f 76 69 64 65 73 20 | dures.on.trees,.Scheme.provides. |
| 46b00 | 74 68 65 0a 70 72 69 6d 69 74 69 76 65 20 70 72 65 64 69 63 61 74 65 20 60 70 61 69 72 3f 27 2c | the.primitive.predicate.`pair?', |
| 46b20 | 20 77 68 69 63 68 20 74 65 73 74 73 20 77 68 65 74 68 65 72 20 69 74 73 20 61 72 67 75 6d 65 6e | .which.tests.whether.its.argumen |
| 46b40 | 74 20 69 73 20 61 0a 70 61 69 72 2e 20 20 48 65 72 65 20 69 73 20 74 68 65 20 63 6f 6d 70 6c 65 | t.is.a.pair...Here.is.the.comple |
| 46b60 | 74 65 20 70 72 6f 63 65 64 75 72 65 3a 28 31 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | te.procedure:(1).......(define.( |
| 46b80 | 63 6f 75 6e 74 2d 6c 65 61 76 65 73 20 78 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e | count-leaves.x)........(cond.((n |
| 46ba0 | 75 6c 6c 3f 20 78 29 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e 6f 74 20 28 70 | ull?.x).0)..............((not.(p |
| 46bc0 | 61 69 72 3f 20 78 29 29 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 | air?.x)).1)..............(else.( |
| 46be0 | 2b 20 28 63 6f 75 6e 74 2d 6c 65 61 76 65 73 20 28 63 61 72 20 78 29 29 0a 20 20 20 20 20 20 20 | +.(count-leaves.(car.x))........ |
| 46c00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 75 6e 74 2d 6c 65 61 76 65 73 20 28 63 64 | ...............(count-leaves.(cd |
| 46c20 | 72 20 78 29 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 32 34 3a 2a | r.x)))))).......*Exercise.2.24:* |
| 46c40 | 20 53 75 70 70 6f 73 65 20 77 65 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 65 78 70 72 65 73 73 | .Suppose.we.evaluate.the.express |
| 46c60 | 69 6f 6e 20 60 28 6c 69 73 74 20 31 20 28 6c 69 73 74 0a 20 20 20 20 20 32 20 28 6c 69 73 74 20 | ion.`(list.1.(list......2.(list. |
| 46c80 | 33 20 34 29 29 29 27 2e 20 20 47 69 76 65 20 74 68 65 20 72 65 73 75 6c 74 20 70 72 69 6e 74 65 | 3.4)))'...Give.the.result.printe |
| 46ca0 | 64 20 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2c 20 74 68 65 0a 20 20 20 20 20 63 | d.by.the.interpreter,.the......c |
| 46cc0 | 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 20 73 74 72 | orresponding.box-and-pointer.str |
| 46ce0 | 75 63 74 75 72 65 2c 20 61 6e 64 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f | ucture,.and.the.interpretation.o |
| 46d00 | 66 0a 20 20 20 20 20 74 68 69 73 20 61 73 20 61 20 74 72 65 65 20 28 61 73 20 69 6e 20 2a 4e 6f | f......this.as.a.tree.(as.in.*No |
| 46d20 | 74 65 20 46 69 67 75 72 65 20 32 2d 36 3a 3a 29 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | te.Figure.2-6::)........*Exercis |
| 46d40 | 65 20 32 2e 32 35 3a 2a 20 47 69 76 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 6f 66 20 60 63 | e.2.25:*.Give.combinations.of.`c |
| 46d60 | 61 72 27 73 20 61 6e 64 20 60 63 64 72 27 73 20 74 68 61 74 20 77 69 6c 6c 0a 20 20 20 20 20 70 | ar's.and.`cdr's.that.will......p |
| 46d80 | 69 63 6b 20 37 20 66 72 6f 6d 20 65 61 63 68 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 | ick.7.from.each.of.the.following |
| 46da0 | 20 6c 69 73 74 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 31 20 33 20 28 35 20 37 29 20 39 29 | .lists:............(1.3.(5.7).9) |
| 46dc0 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 37 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 31 20 | ............((7))............(1. |
| 46de0 | 28 32 20 28 33 20 28 34 20 28 35 20 28 36 20 37 29 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 | (2.(3.(4.(5.(6.7)))))).......*Ex |
| 46e00 | 65 72 63 69 73 65 20 32 2e 32 36 3a 2a 20 53 75 70 70 6f 73 65 20 77 65 20 64 65 66 69 6e 65 20 | ercise.2.26:*.Suppose.we.define. |
| 46e20 | 60 78 27 20 61 6e 64 20 60 79 27 20 74 6f 20 62 65 20 74 77 6f 20 6c 69 73 74 73 3a 0a 0a 20 20 | `x'.and.`y'.to.be.two.lists:.... |
| 46e40 | 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 28 6c 69 73 74 20 31 20 32 20 33 29 29 0a | ........(define.x.(list.1.2.3)). |
| 46e60 | 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 79 20 28 6c 69 73 74 20 34 20 35 20 36 | ...........(define.y.(list.4.5.6 |
| 46e80 | 29 29 0a 0a 20 20 20 20 20 57 68 61 74 20 72 65 73 75 6c 74 20 69 73 20 70 72 69 6e 74 65 64 20 | )).......What.result.is.printed. |
| 46ea0 | 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 69 6e 20 72 65 73 70 6f 6e 73 65 20 74 | by.the.interpreter.in.response.t |
| 46ec0 | 6f 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6e 67 20 65 61 63 68 20 6f 66 20 74 68 65 20 66 6f | o......evaluating.each.of.the.fo |
| 46ee0 | 6c 6c 6f 77 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 | llowing.expressions:............ |
| 46f00 | 28 61 70 70 65 6e 64 20 78 20 79 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 78 20 | (append.x.y)............(cons.x. |
| 46f20 | 79 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 78 20 79 29 0a 0a 20 20 20 20 20 2a | y)............(list.x.y).......* |
| 46f40 | 45 78 65 72 63 69 73 65 20 32 2e 32 37 3a 2a 20 4d 6f 64 69 66 79 20 79 6f 75 72 20 60 72 65 76 | Exercise.2.27:*.Modify.your.`rev |
| 46f60 | 65 72 73 65 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 | erse'.procedure.of.*Note.Exercis |
| 46f80 | 65 0a 20 20 20 20 20 32 2d 31 38 3a 3a 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 60 64 65 65 70 | e......2-18::.to.produce.a.`deep |
| 46fa0 | 2d 72 65 76 65 72 73 65 27 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 20 61 | -reverse'.procedure.that.takes.a |
| 46fc0 | 20 6c 69 73 74 20 61 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 72 65 74 75 72 | .list.as......argument.and.retur |
| 46fe0 | 6e 73 20 61 73 20 69 74 73 20 76 61 6c 75 65 20 74 68 65 20 6c 69 73 74 20 77 69 74 68 20 69 74 | ns.as.its.value.the.list.with.it |
| 47000 | 73 20 65 6c 65 6d 65 6e 74 73 0a 20 20 20 20 20 72 65 76 65 72 73 65 64 20 61 6e 64 20 77 69 74 | s.elements......reversed.and.wit |
| 47020 | 68 20 61 6c 6c 20 73 75 62 6c 69 73 74 73 20 64 65 65 70 2d 72 65 76 65 72 73 65 64 20 61 73 20 | h.all.sublists.deep-reversed.as. |
| 47040 | 77 65 6c 6c 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 20 20 20 20 20 28 | well...For.example,............( |
| 47060 | 64 65 66 69 6e 65 20 78 20 28 6c 69 73 74 20 28 6c 69 73 74 20 31 20 32 29 20 28 6c 69 73 74 20 | define.x.(list.(list.1.2).(list. |
| 47080 | 33 20 34 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 78 0a 20 20 20 20 20 20 20 20 20 20 28 28 | 3.4)))............x...........(( |
| 470a0 | 31 20 32 29 20 28 33 20 34 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 72 65 76 65 72 73 65 20 | 1.2).(3.4))............(reverse. |
| 470c0 | 78 29 0a 20 20 20 20 20 20 20 20 20 20 28 28 33 20 34 29 20 28 31 20 32 29 29 0a 0a 20 20 20 20 | x)...........((3.4).(1.2))...... |
| 470e0 | 20 20 20 20 20 20 28 64 65 65 70 2d 72 65 76 65 72 73 65 20 78 29 0a 20 20 20 20 20 20 20 20 20 | ......(deep-reverse.x).......... |
| 47100 | 20 28 28 34 20 33 29 20 28 32 20 31 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 | .((4.3).(2.1)).......*Exercise.2 |
| 47120 | 2e 32 38 3a 2a 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 66 72 69 6e 67 65 27 | .28:*.Write.a.procedure.`fringe' |
| 47140 | 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 61 20 74 | .that.takes.as.argument......a.t |
| 47160 | 72 65 65 20 28 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 6c 69 73 74 29 20 61 6e 64 20 | ree.(represented.as.a.list).and. |
| 47180 | 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20 77 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 0a 20 20 | returns.a.list.whose.elements... |
| 471a0 | 20 20 20 61 72 65 20 61 6c 6c 20 74 68 65 20 6c 65 61 76 65 73 20 6f 66 20 74 68 65 20 74 72 65 | ...are.all.the.leaves.of.the.tre |
| 471c0 | 65 20 61 72 72 61 6e 67 65 64 20 69 6e 20 6c 65 66 74 2d 74 6f 2d 72 69 67 68 74 20 6f 72 64 65 | e.arranged.in.left-to-right.orde |
| 471e0 | 72 2e 0a 20 20 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 20 20 20 20 20 | r.......For.example,............ |
| 47200 | 28 64 65 66 69 6e 65 20 78 20 28 6c 69 73 74 20 28 6c 69 73 74 20 31 20 32 29 20 28 6c 69 73 74 | (define.x.(list.(list.1.2).(list |
| 47220 | 20 33 20 34 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 72 69 6e 67 65 20 78 29 0a 20 20 | .3.4)))............(fringe.x)... |
| 47240 | 20 20 20 20 20 20 20 20 28 31 20 32 20 33 20 34 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 72 | ........(1.2.3.4)............(fr |
| 47260 | 69 6e 67 65 20 28 6c 69 73 74 20 78 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 31 20 32 20 | inge.(list.x.x))...........(1.2. |
| 47280 | 33 20 34 20 31 20 32 20 33 20 34 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 32 | 3.4.1.2.3.4).......*Exercise.2.2 |
| 472a0 | 39 3a 2a 20 41 20 62 69 6e 61 72 79 20 6d 6f 62 69 6c 65 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 | 9:*.A.binary.mobile.consists.of. |
| 472c0 | 74 77 6f 20 62 72 61 6e 63 68 65 73 2c 20 61 20 6c 65 66 74 0a 20 20 20 20 20 62 72 61 6e 63 68 | two.branches,.a.left......branch |
| 472e0 | 20 61 6e 64 20 61 20 72 69 67 68 74 20 62 72 61 6e 63 68 2e 20 20 45 61 63 68 20 62 72 61 6e 63 | .and.a.right.branch...Each.branc |
| 47300 | 68 20 69 73 20 61 20 72 6f 64 20 6f 66 20 61 20 63 65 72 74 61 69 6e 0a 20 20 20 20 20 6c 65 6e | h.is.a.rod.of.a.certain......len |
| 47320 | 67 74 68 2c 20 66 72 6f 6d 20 77 68 69 63 68 20 68 61 6e 67 73 20 65 69 74 68 65 72 20 61 20 77 | gth,.from.which.hangs.either.a.w |
| 47340 | 65 69 67 68 74 20 6f 72 20 61 6e 6f 74 68 65 72 20 62 69 6e 61 72 79 20 6d 6f 62 69 6c 65 2e 0a | eight.or.another.binary.mobile.. |
| 47360 | 20 20 20 20 20 57 65 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 20 61 20 62 69 6e 61 72 79 20 6d | .....We.can.represent.a.binary.m |
| 47380 | 6f 62 69 6c 65 20 75 73 69 6e 67 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 62 79 0a 20 20 20 | obile.using.compound.data.by.... |
| 473a0 | 20 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 69 74 20 66 72 6f 6d 20 74 77 6f 20 62 72 61 6e 63 | ..constructing.it.from.two.branc |
| 473c0 | 68 65 73 20 28 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 75 73 69 6e 67 20 60 6c 69 73 74 27 29 3a | hes.(for.example,.using.`list'): |
| 473e0 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 6d 6f 62 69 6c 65 | ............(define.(make-mobile |
| 47400 | 20 6c 65 66 74 20 72 69 67 68 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 6c | .left.right).............(list.l |
| 47420 | 65 66 74 20 72 69 67 68 74 29 29 0a 0a 20 20 20 20 20 41 20 62 72 61 6e 63 68 20 69 73 20 63 6f | eft.right)).......A.branch.is.co |
| 47440 | 6e 73 74 72 75 63 74 65 64 20 66 72 6f 6d 20 61 20 60 6c 65 6e 67 74 68 27 20 28 77 68 69 63 68 | nstructed.from.a.`length'.(which |
| 47460 | 20 6d 75 73 74 20 62 65 20 61 20 6e 75 6d 62 65 72 29 0a 20 20 20 20 20 74 6f 67 65 74 68 65 72 | .must.be.a.number)......together |
| 47480 | 20 77 69 74 68 20 61 20 60 73 74 72 75 63 74 75 72 65 27 2c 20 77 68 69 63 68 20 6d 61 79 20 62 | .with.a.`structure',.which.may.b |
| 474a0 | 65 20 65 69 74 68 65 72 20 61 20 6e 75 6d 62 65 72 0a 20 20 20 20 20 28 72 65 70 72 65 73 65 6e | e.either.a.number......(represen |
| 474c0 | 74 69 6e 67 20 61 20 73 69 6d 70 6c 65 20 77 65 69 67 68 74 29 20 6f 72 20 61 6e 6f 74 68 65 72 | ting.a.simple.weight).or.another |
| 474e0 | 20 6d 6f 62 69 6c 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b | .mobile:............(define.(mak |
| 47500 | 65 2d 62 72 61 6e 63 68 20 6c 65 6e 67 74 68 20 73 74 72 75 63 74 75 72 65 29 0a 20 20 20 20 20 | e-branch.length.structure)...... |
| 47520 | 20 20 20 20 20 20 20 28 6c 69 73 74 20 6c 65 6e 67 74 68 20 73 74 72 75 63 74 75 72 65 29 29 0a | .......(list.length.structure)). |
| 47540 | 0a 20 20 20 20 20 20 20 61 2e 20 57 72 69 74 65 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 | ........a..Write.the.correspondi |
| 47560 | 6e 67 20 73 65 6c 65 63 74 6f 72 73 20 60 6c 65 66 74 2d 62 72 61 6e 63 68 27 20 61 6e 64 0a 20 | ng.selectors.`left-branch'.and.. |
| 47580 | 20 20 20 20 20 20 20 20 20 60 72 69 67 68 74 2d 62 72 61 6e 63 68 27 2c 20 77 68 69 63 68 20 72 | .........`right-branch',.which.r |
| 475a0 | 65 74 75 72 6e 20 74 68 65 20 62 72 61 6e 63 68 65 73 20 6f 66 20 61 20 6d 6f 62 69 6c 65 2c 20 | eturn.the.branches.of.a.mobile,. |
| 475c0 | 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 60 62 72 61 6e 63 68 2d 6c 65 6e 67 74 68 27 20 61 6e | and...........`branch-length'.an |
| 475e0 | 64 20 60 62 72 61 6e 63 68 2d 73 74 72 75 63 74 75 72 65 27 2c 20 77 68 69 63 68 20 72 65 74 75 | d.`branch-structure',.which.retu |
| 47600 | 72 6e 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 6f 66 20 61 | rn.the...........components.of.a |
| 47620 | 20 62 72 61 6e 63 68 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 55 73 69 6e 67 20 79 6f 75 72 20 73 | .branch..........b..Using.your.s |
| 47640 | 65 6c 65 63 74 6f 72 73 2c 20 64 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 74 6f | electors,.define.a.procedure.`to |
| 47660 | 74 61 6c 2d 77 65 69 67 68 74 27 20 74 68 61 74 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 | tal-weight'.that...........retur |
| 47680 | 6e 73 20 74 68 65 20 74 6f 74 61 6c 20 77 65 69 67 68 74 20 6f 66 20 61 20 6d 6f 62 69 6c 65 2e | ns.the.total.weight.of.a.mobile. |
| 476a0 | 0a 0a 20 20 20 20 20 20 20 63 2e 20 41 20 6d 6f 62 69 6c 65 20 69 73 20 73 61 69 64 20 74 6f 20 | .........c..A.mobile.is.said.to. |
| 476c0 | 62 65 20 22 62 61 6c 61 6e 63 65 64 22 20 69 66 20 74 68 65 20 74 6f 72 71 75 65 20 61 70 70 6c | be."balanced".if.the.torque.appl |
| 476e0 | 69 65 64 20 62 79 0a 20 20 20 20 20 20 20 20 20 20 69 74 73 20 74 6f 70 2d 6c 65 66 74 20 62 72 | ied.by...........its.top-left.br |
| 47700 | 61 6e 63 68 20 69 73 20 65 71 75 61 6c 20 74 6f 20 74 68 61 74 20 61 70 70 6c 69 65 64 20 62 79 | anch.is.equal.to.that.applied.by |
| 47720 | 20 69 74 73 20 74 6f 70 2d 72 69 67 68 74 0a 20 20 20 20 20 20 20 20 20 20 62 72 61 6e 63 68 20 | .its.top-right...........branch. |
| 47740 | 28 74 68 61 74 20 69 73 2c 20 69 66 20 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 6c | (that.is,.if.the.length.of.the.l |
| 47760 | 65 66 74 20 72 6f 64 20 6d 75 6c 74 69 70 6c 69 65 64 20 62 79 0a 20 20 20 20 20 20 20 20 20 20 | eft.rod.multiplied.by........... |
| 47780 | 74 68 65 20 77 65 69 67 68 74 20 68 61 6e 67 69 6e 67 20 66 72 6f 6d 20 74 68 61 74 20 72 6f 64 | the.weight.hanging.from.that.rod |
| 477a0 | 20 69 73 20 65 71 75 61 6c 20 74 6f 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 63 6f 72 72 65 | .is.equal.to.the...........corre |
| 477c0 | 73 70 6f 6e 64 69 6e 67 20 70 72 6f 64 75 63 74 20 66 6f 72 20 74 68 65 20 72 69 67 68 74 20 73 | sponding.product.for.the.right.s |
| 477e0 | 69 64 65 29 20 61 6e 64 20 69 66 20 65 61 63 68 20 6f 66 20 74 68 65 0a 20 20 20 20 20 20 20 20 | ide).and.if.each.of.the......... |
| 47800 | 20 20 73 75 62 6d 6f 62 69 6c 65 73 20 68 61 6e 67 69 6e 67 20 6f 66 66 20 69 74 73 20 62 72 61 | ..submobiles.hanging.off.its.bra |
| 47820 | 6e 63 68 65 73 20 69 73 20 62 61 6c 61 6e 63 65 64 2e 20 44 65 73 69 67 6e 20 61 0a 20 20 20 20 | nches.is.balanced..Design.a..... |
| 47840 | 20 20 20 20 20 20 70 72 65 64 69 63 61 74 65 20 74 68 61 74 20 74 65 73 74 73 20 77 68 65 74 68 | ......predicate.that.tests.wheth |
| 47860 | 65 72 20 61 20 62 69 6e 61 72 79 20 6d 6f 62 69 6c 65 20 69 73 20 62 61 6c 61 6e 63 65 64 2e 0a | er.a.binary.mobile.is.balanced.. |
| 47880 | 0a 20 20 20 20 20 20 20 64 2e 20 53 75 70 70 6f 73 65 20 77 65 20 63 68 61 6e 67 65 20 74 68 65 | ........d..Suppose.we.change.the |
| 478a0 | 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 6d 6f 62 69 6c 65 73 20 73 6f 20 74 68 | .representation.of.mobiles.so.th |
| 478c0 | 61 74 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 61 72 | at.the...........constructors.ar |
| 478e0 | 65 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d | e.................(define.(make- |
| 47900 | 6d 6f 62 69 6c 65 20 6c 65 66 74 20 72 69 67 68 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | mobile.left.right).............. |
| 47920 | 20 20 20 20 28 63 6f 6e 73 20 6c 65 66 74 20 72 69 67 68 74 29 29 0a 0a 20 20 20 20 20 20 20 20 | ....(cons.left.right)).......... |
| 47940 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 62 72 61 6e 63 68 20 6c 65 6e 67 | .......(define.(make-branch.leng |
| 47960 | 74 68 20 73 74 72 75 63 74 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | th.structure)..................( |
| 47980 | 63 6f 6e 73 20 6c 65 6e 67 74 68 20 73 74 72 75 63 74 75 72 65 29 29 0a 0a 20 20 20 20 20 20 20 | cons.length.structure))......... |
| 479a0 | 20 20 20 48 6f 77 20 6d 75 63 68 20 64 6f 20 79 6f 75 20 6e 65 65 64 20 74 6f 20 63 68 61 6e 67 | ...How.much.do.you.need.to.chang |
| 479c0 | 65 20 79 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 74 6f 20 63 6f 6e 76 65 72 74 20 74 6f 0a 20 20 | e.your.programs.to.convert.to... |
| 479e0 | 20 20 20 20 20 20 20 20 74 68 65 20 6e 65 77 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 3f 0a | ........the.new.representation?. |
| 47a00 | 0a 0a 4d 61 70 70 69 6e 67 20 6f 76 65 72 20 74 72 65 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ..Mapping.over.trees............ |
| 47a20 | 2e 2e 2e 2e 2e 2e 2e 0a 0a 4a 75 73 74 20 61 73 20 60 6d 61 70 27 20 69 73 20 61 20 70 6f 77 65 | .........Just.as.`map'.is.a.powe |
| 47a40 | 72 66 75 6c 20 61 62 73 74 72 61 63 74 69 6f 6e 20 66 6f 72 20 64 65 61 6c 69 6e 67 20 77 69 74 | rful.abstraction.for.dealing.wit |
| 47a60 | 68 20 73 65 71 75 65 6e 63 65 73 2c 0a 60 6d 61 70 27 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 | h.sequences,.`map'.together.with |
| 47a80 | 20 72 65 63 75 72 73 69 6f 6e 20 69 73 20 61 20 70 6f 77 65 72 66 75 6c 20 61 62 73 74 72 61 63 | .recursion.is.a.powerful.abstrac |
| 47aa0 | 74 69 6f 6e 20 66 6f 72 20 64 65 61 6c 69 6e 67 20 77 69 74 68 0a 74 72 65 65 73 2e 20 20 46 6f | tion.for.dealing.with.trees...Fo |
| 47ac0 | 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 68 65 20 60 73 63 61 6c 65 2d 74 72 65 65 27 20 70 72 6f | r.instance,.the.`scale-tree'.pro |
| 47ae0 | 63 65 64 75 72 65 2c 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 0a 60 73 63 61 6c 65 2d 6c 69 73 74 | cedure,.analogous.to.`scale-list |
| 47b00 | 27 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 31 3a 3a 2c 20 74 61 6b 65 | '.of.section.*Note.2-2-1::,.take |
| 47b20 | 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 20 6e 75 6d 65 72 69 63 0a 66 61 63 74 6f 72 20 | s.as.arguments.a.numeric.factor. |
| 47b40 | 61 6e 64 20 61 20 74 72 65 65 20 77 68 6f 73 65 20 6c 65 61 76 65 73 20 61 72 65 20 6e 75 6d 62 | and.a.tree.whose.leaves.are.numb |
| 47b60 | 65 72 73 2e 20 20 49 74 20 72 65 74 75 72 6e 73 20 61 20 74 72 65 65 20 6f 66 20 74 68 65 0a 73 | ers...It.returns.a.tree.of.the.s |
| 47b80 | 61 6d 65 20 73 68 61 70 65 2c 20 77 68 65 72 65 20 65 61 63 68 20 6e 75 6d 62 65 72 20 69 73 20 | ame.shape,.where.each.number.is. |
| 47ba0 | 6d 75 6c 74 69 70 6c 69 65 64 20 62 79 20 74 68 65 20 66 61 63 74 6f 72 2e 20 20 54 68 65 0a 72 | multiplied.by.the.factor...The.r |
| 47bc0 | 65 63 75 72 73 69 76 65 20 70 6c 61 6e 20 66 6f 72 20 60 73 63 61 6c 65 2d 74 72 65 65 27 20 69 | ecursive.plan.for.`scale-tree'.i |
| 47be0 | 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 6f 6e 65 20 66 6f 72 0a 60 63 6f 75 6e 74 2d | s.similar.to.the.one.for.`count- |
| 47c00 | 6c 65 61 76 65 73 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 63 61 6c 65 2d 74 72 | leaves':.......(define.(scale-tr |
| 47c20 | 65 65 20 74 72 65 65 20 66 61 63 74 6f 72 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e | ee.tree.factor)........(cond.((n |
| 47c40 | 75 6c 6c 3f 20 74 72 65 65 29 20 6e 69 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e | ull?.tree).nil)..............((n |
| 47c60 | 6f 74 20 28 70 61 69 72 3f 20 74 72 65 65 29 29 20 28 2a 20 74 72 65 65 20 66 61 63 74 6f 72 29 | ot.(pair?.tree)).(*.tree.factor) |
| 47c80 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 63 6f 6e 73 20 28 73 63 61 6c | )..............(else.(cons.(scal |
| 47ca0 | 65 2d 74 72 65 65 20 28 63 61 72 20 74 72 65 65 29 20 66 61 63 74 6f 72 29 0a 20 20 20 20 20 20 | e-tree.(car.tree).factor)....... |
| 47cc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 63 61 6c 65 2d 74 72 65 65 20 28 | ...................(scale-tree.( |
| 47ce0 | 63 64 72 20 74 72 65 65 29 20 66 61 63 74 6f 72 29 29 29 29 29 0a 0a 20 20 20 20 20 28 73 63 61 | cdr.tree).factor))))).......(sca |
| 47d00 | 6c 65 2d 74 72 65 65 20 28 6c 69 73 74 20 31 20 28 6c 69 73 74 20 32 20 28 6c 69 73 74 20 33 20 | le-tree.(list.1.(list.2.(list.3. |
| 47d20 | 34 29 20 35 29 20 28 6c 69 73 74 20 36 20 37 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 4).5).(list.6.7))............... |
| 47d40 | 20 20 20 31 30 29 0a 20 20 20 20 20 28 31 30 20 28 32 30 20 28 33 30 20 34 30 29 20 35 30 29 20 | ...10)......(10.(20.(30.40).50). |
| 47d60 | 28 36 30 20 37 30 29 29 0a 0a 20 20 20 41 6e 6f 74 68 65 72 20 77 61 79 20 74 6f 20 69 6d 70 6c | (60.70)).....Another.way.to.impl |
| 47d80 | 65 6d 65 6e 74 20 60 73 63 61 6c 65 2d 74 72 65 65 27 20 69 73 20 74 6f 20 72 65 67 61 72 64 20 | ement.`scale-tree'.is.to.regard. |
| 47da0 | 74 68 65 20 74 72 65 65 20 61 73 20 61 0a 73 65 71 75 65 6e 63 65 20 6f 66 20 73 75 62 2d 74 72 | the.tree.as.a.sequence.of.sub-tr |
| 47dc0 | 65 65 73 20 61 6e 64 20 75 73 65 20 60 6d 61 70 27 2e 20 20 57 65 20 6d 61 70 20 6f 76 65 72 20 | ees.and.use.`map'...We.map.over. |
| 47de0 | 74 68 65 20 73 65 71 75 65 6e 63 65 2c 20 73 63 61 6c 69 6e 67 0a 65 61 63 68 20 73 75 62 2d 74 | the.sequence,.scaling.each.sub-t |
| 47e00 | 72 65 65 20 69 6e 20 74 75 72 6e 2c 20 61 6e 64 20 72 65 74 75 72 6e 20 74 68 65 20 6c 69 73 74 | ree.in.turn,.and.return.the.list |
| 47e20 | 20 6f 66 20 72 65 73 75 6c 74 73 2e 20 20 49 6e 20 74 68 65 20 62 61 73 65 0a 63 61 73 65 2c 20 | .of.results...In.the.base.case,. |
| 47e40 | 77 68 65 72 65 20 74 68 65 20 74 72 65 65 20 69 73 20 61 20 6c 65 61 66 2c 20 77 65 20 73 69 6d | where.the.tree.is.a.leaf,.we.sim |
| 47e60 | 70 6c 79 20 6d 75 6c 74 69 70 6c 79 20 62 79 20 74 68 65 20 66 61 63 74 6f 72 3a 0a 0a 20 20 20 | ply.multiply.by.the.factor:..... |
| 47e80 | 20 20 28 64 65 66 69 6e 65 20 28 73 63 61 6c 65 2d 74 72 65 65 20 74 72 65 65 20 66 61 63 74 6f | ..(define.(scale-tree.tree.facto |
| 47ea0 | 72 29 0a 20 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 73 75 62 2d 74 72 65 65 | r)........(map.(lambda.(sub-tree |
| 47ec0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 70 61 69 72 3f 20 73 75 62 2d 74 | )...............(if.(pair?.sub-t |
| 47ee0 | 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 63 61 6c 65 2d 74 72 | ree)...................(scale-tr |
| 47f00 | 65 65 20 73 75 62 2d 74 72 65 65 20 66 61 63 74 6f 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ee.sub-tree.factor)............. |
| 47f20 | 20 20 20 20 20 20 28 2a 20 73 75 62 2d 74 72 65 65 20 66 61 63 74 6f 72 29 29 29 0a 20 20 20 20 | ......(*.sub-tree.factor)))..... |
| 47f40 | 20 20 20 20 20 20 20 20 74 72 65 65 29 29 0a 0a 20 20 20 4d 61 6e 79 20 74 72 65 65 20 6f 70 65 | ........tree)).....Many.tree.ope |
| 47f60 | 72 61 74 69 6f 6e 73 20 63 61 6e 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 79 20 73 69 | rations.can.be.implemented.by.si |
| 47f80 | 6d 69 6c 61 72 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 6f 66 0a 73 65 71 75 65 6e 63 65 20 6f | milar.combinations.of.sequence.o |
| 47fa0 | 70 65 72 61 74 69 6f 6e 73 20 61 6e 64 20 72 65 63 75 72 73 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a | perations.and.recursion........* |
| 47fc0 | 45 78 65 72 63 69 73 65 20 32 2e 33 30 3a 2a 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 | Exercise.2.30:*.Define.a.procedu |
| 47fe0 | 72 65 20 60 73 71 75 61 72 65 2d 74 72 65 65 27 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 74 68 | re.`square-tree'.analogous.to.th |
| 48000 | 65 0a 20 20 20 20 20 60 73 71 75 61 72 65 2d 6c 69 73 74 27 20 70 72 6f 63 65 64 75 72 65 20 6f | e......`square-list'.procedure.o |
| 48020 | 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 32 31 3a 3a 2e 20 20 54 68 61 74 20 69 | f.*Note.Exercise.2-21::...That.i |
| 48040 | 73 2c 0a 20 20 20 20 20 60 73 71 75 61 72 65 2d 6c 69 73 74 27 20 73 68 6f 75 6c 64 20 62 65 68 | s,......`square-list'.should.beh |
| 48060 | 61 76 65 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 71 75 61 | ave.as.follows:............(squa |
| 48080 | 72 65 2d 74 72 65 65 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 31 0a 20 20 20 20 20 | re-tree............(list.1...... |
| 480a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 32 20 28 6c 69 73 74 20 33 20 34 29 20 35 | ............(list.2.(list.3.4).5 |
| 480c0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 36 20 37 29 29 29 0a | )..................(list.6.7))). |
| 480e0 | 20 20 20 20 20 20 20 20 20 20 28 31 20 28 34 20 28 39 20 31 36 29 20 32 35 29 20 28 33 36 20 34 | ..........(1.(4.(9.16).25).(36.4 |
| 48100 | 39 29 29 0a 0a 20 20 20 20 20 44 65 66 69 6e 65 20 60 73 71 75 61 72 65 2d 74 72 65 65 27 20 62 | 9)).......Define.`square-tree'.b |
| 48120 | 6f 74 68 20 64 69 72 65 63 74 6c 79 20 28 69 2e 65 2e 2c 20 77 69 74 68 6f 75 74 20 75 73 69 6e | oth.directly.(i.e.,.without.usin |
| 48140 | 67 20 61 6e 79 0a 20 20 20 20 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 | g.any......higher-order.procedur |
| 48160 | 65 73 29 20 61 6e 64 20 61 6c 73 6f 20 62 79 20 75 73 69 6e 67 20 60 6d 61 70 27 20 61 6e 64 20 | es).and.also.by.using.`map'.and. |
| 48180 | 72 65 63 75 72 73 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 33 31 3a | recursion........*Exercise.2.31: |
| 481a0 | 2a 20 41 62 73 74 72 61 63 74 20 79 6f 75 72 20 61 6e 73 77 65 72 20 74 6f 20 2a 4e 6f 74 65 20 | *.Abstract.your.answer.to.*Note. |
| 481c0 | 45 78 65 72 63 69 73 65 20 32 2d 33 30 3a 3a 20 74 6f 0a 20 20 20 20 20 70 72 6f 64 75 63 65 20 | Exercise.2-30::.to......produce. |
| 481e0 | 61 20 70 72 6f 63 65 64 75 72 65 20 60 74 72 65 65 2d 6d 61 70 27 20 77 69 74 68 20 74 68 65 20 | a.procedure.`tree-map'.with.the. |
| 48200 | 70 72 6f 70 65 72 74 79 20 74 68 61 74 0a 20 20 20 20 20 60 73 71 75 61 72 65 2d 74 72 65 65 27 | property.that......`square-tree' |
| 48220 | 20 63 6f 75 6c 64 20 62 65 20 64 65 66 69 6e 65 64 20 61 73 0a 0a 20 20 20 20 20 20 20 20 20 20 | .could.be.defined.as............ |
| 48240 | 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 2d 74 72 65 65 20 74 72 65 65 29 20 28 74 72 65 65 | (define.(square-tree.tree).(tree |
| 48260 | 2d 6d 61 70 20 73 71 75 61 72 65 20 74 72 65 65 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | -map.square.tree)).......*Exerci |
| 48280 | 73 65 20 32 2e 33 32 3a 2a 20 57 65 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 20 61 20 73 65 74 | se.2.32:*.We.can.represent.a.set |
| 482a0 | 20 61 73 20 61 20 6c 69 73 74 20 6f 66 20 64 69 73 74 69 6e 63 74 0a 20 20 20 20 20 65 6c 65 6d | .as.a.list.of.distinct......elem |
| 482c0 | 65 6e 74 73 2c 20 61 6e 64 20 77 65 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 73 | ents,.and.we.can.represent.the.s |
| 482e0 | 65 74 20 6f 66 20 61 6c 6c 20 73 75 62 73 65 74 73 20 6f 66 20 74 68 65 20 73 65 74 20 61 73 0a | et.of.all.subsets.of.the.set.as. |
| 48300 | 20 20 20 20 20 61 20 6c 69 73 74 20 6f 66 20 6c 69 73 74 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 | .....a.list.of.lists...For.examp |
| 48320 | 6c 65 2c 20 69 66 20 74 68 65 20 73 65 74 20 69 73 20 60 28 31 20 32 20 33 29 27 2c 20 74 68 65 | le,.if.the.set.is.`(1.2.3)',.the |
| 48340 | 6e 20 74 68 65 0a 20 20 20 20 20 73 65 74 20 6f 66 20 61 6c 6c 20 73 75 62 73 65 74 73 20 69 73 | n.the......set.of.all.subsets.is |
| 48360 | 20 60 28 28 29 20 28 33 29 20 28 32 29 20 28 32 20 33 29 20 28 31 29 20 28 31 20 33 29 20 28 31 | .`(().(3).(2).(2.3).(1).(1.3).(1 |
| 48380 | 20 32 29 20 28 31 20 32 0a 20 20 20 20 20 33 29 29 27 2e 20 20 43 6f 6d 70 6c 65 74 65 20 74 68 | .2).(1.2......3))'...Complete.th |
| 483a0 | 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 61 20 70 72 6f 63 | e.following.definition.of.a.proc |
| 483c0 | 65 64 75 72 65 20 74 68 61 74 0a 20 20 20 20 20 67 65 6e 65 72 61 74 65 73 20 74 68 65 20 73 65 | edure.that......generates.the.se |
| 483e0 | 74 20 6f 66 20 73 75 62 73 65 74 73 20 6f 66 20 61 20 73 65 74 20 61 6e 64 20 67 69 76 65 20 61 | t.of.subsets.of.a.set.and.give.a |
| 48400 | 20 63 6c 65 61 72 20 65 78 70 6c 61 6e 61 74 69 6f 6e 0a 20 20 20 20 20 6f 66 20 77 68 79 20 69 | .clear.explanation......of.why.i |
| 48420 | 74 20 77 6f 72 6b 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 62 | t.works:............(define.(sub |
| 48440 | 73 65 74 73 20 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 73 | sets.s).............(if.(null?.s |
| 48460 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 6e 69 6c 29 0a 20 20 20 | ).................(list.nil).... |
| 48480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 74 20 28 73 75 62 73 65 74 | .............(let.((rest.(subset |
| 484a0 | 73 20 28 63 64 72 20 73 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | s.(cdr.s))))...................( |
| 484c0 | 61 70 70 65 6e 64 20 72 65 73 74 20 28 6d 61 70 20 3c 3f 3f 3e 20 72 65 73 74 29 29 29 29 29 0a | append.rest.(map.<??>.rest))))). |
| 484e0 | 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d | ....----------.Footnotes.------- |
| 48500 | 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 66 69 72 | ---.....(1).The.order.of.the.fir |
| 48520 | 73 74 20 74 77 6f 20 63 6c 61 75 73 65 73 20 69 6e 20 74 68 65 20 60 63 6f 6e 64 27 20 6d 61 74 | st.two.clauses.in.the.`cond'.mat |
| 48540 | 74 65 72 73 2c 20 73 69 6e 63 65 0a 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 20 73 61 74 69 73 | ters,.since.the.empty.list.satis |
| 48560 | 66 69 65 73 20 60 6e 75 6c 6c 3f 27 20 61 6e 64 20 61 6c 73 6f 20 69 73 20 6e 6f 74 20 61 20 70 | fies.`null?'.and.also.is.not.a.p |
| 48580 | 61 69 72 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 | air.....File:.sicp.info,..Node:. |
| 485a0 | 32 2d 32 2d 33 2c 20 20 4e 65 78 74 3a 20 32 2d 32 2d 34 2c 20 20 50 72 65 76 3a 20 32 2d 32 2d | 2-2-3,..Next:.2-2-4,..Prev:.2-2- |
| 485c0 | 32 2c 20 20 55 70 3a 20 32 2d 32 0a 0a 32 2e 32 2e 33 20 53 65 71 75 65 6e 63 65 73 20 61 73 20 | 2,..Up:.2-2..2.2.3.Sequences.as. |
| 485e0 | 43 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 49 6e 74 65 72 66 61 63 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d | Conventional.Interfaces.-------- |
| 48600 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 48620 | 2d 2d 0a 0a 49 6e 20 77 6f 72 6b 69 6e 67 20 77 69 74 68 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 | --..In.working.with.compound.dat |
| 48640 | 61 2c 20 77 65 27 76 65 20 73 74 72 65 73 73 65 64 20 68 6f 77 20 64 61 74 61 20 61 62 73 74 72 | a,.we've.stressed.how.data.abstr |
| 48660 | 61 63 74 69 6f 6e 0a 70 65 72 6d 69 74 73 20 75 73 20 74 6f 20 64 65 73 69 67 6e 20 70 72 6f 67 | action.permits.us.to.design.prog |
| 48680 | 72 61 6d 73 20 77 69 74 68 6f 75 74 20 62 65 63 6f 6d 69 6e 67 20 65 6e 6d 65 73 68 65 64 20 69 | rams.without.becoming.enmeshed.i |
| 486a0 | 6e 20 74 68 65 20 64 65 74 61 69 6c 73 0a 6f 66 20 64 61 74 61 20 72 65 70 72 65 73 65 6e 74 61 | n.the.details.of.data.representa |
| 486c0 | 74 69 6f 6e 73 2c 20 61 6e 64 20 68 6f 77 20 61 62 73 74 72 61 63 74 69 6f 6e 20 70 72 65 73 65 | tions,.and.how.abstraction.prese |
| 486e0 | 72 76 65 73 20 66 6f 72 20 75 73 20 74 68 65 0a 66 6c 65 78 69 62 69 6c 69 74 79 20 74 6f 20 65 | rves.for.us.the.flexibility.to.e |
| 48700 | 78 70 65 72 69 6d 65 6e 74 20 77 69 74 68 20 61 6c 74 65 72 6e 61 74 69 76 65 20 72 65 70 72 65 | xperiment.with.alternative.repre |
| 48720 | 73 65 6e 74 61 74 69 6f 6e 73 2e 20 20 49 6e 20 74 68 69 73 0a 73 65 63 74 69 6f 6e 2c 20 77 65 | sentations...In.this.section,.we |
| 48740 | 20 69 6e 74 72 6f 64 75 63 65 20 61 6e 6f 74 68 65 72 20 70 6f 77 65 72 66 75 6c 20 64 65 73 69 | .introduce.another.powerful.desi |
| 48760 | 67 6e 20 70 72 69 6e 63 69 70 6c 65 20 66 6f 72 20 77 6f 72 6b 69 6e 67 0a 77 69 74 68 20 64 61 | gn.principle.for.working.with.da |
| 48780 | 74 61 20 73 74 72 75 63 74 75 72 65 73 2d 2d 74 68 65 20 75 73 65 20 6f 66 20 22 63 6f 6e 76 65 | ta.structures--the.use.of."conve |
| 487a0 | 6e 74 69 6f 6e 61 6c 20 69 6e 74 65 72 66 61 63 65 73 22 2e 0a 0a 20 20 20 49 6e 20 73 65 63 74 | ntional.interfaces"......In.sect |
| 487c0 | 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 33 3a 3a 20 77 65 20 73 61 77 20 68 6f 77 20 70 72 6f 67 72 | ion.*Note.1-3::.we.saw.how.progr |
| 487e0 | 61 6d 20 61 62 73 74 72 61 63 74 69 6f 6e 73 2c 20 69 6d 70 6c 65 6d 65 6e 74 65 64 0a 61 73 20 | am.abstractions,.implemented.as. |
| 48800 | 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 73 2c 20 63 61 6e 20 63 61 70 | higher-order.procedures,.can.cap |
| 48820 | 74 75 72 65 20 63 6f 6d 6d 6f 6e 20 70 61 74 74 65 72 6e 73 20 69 6e 20 70 72 6f 67 72 61 6d 73 | ture.common.patterns.in.programs |
| 48840 | 0a 74 68 61 74 20 64 65 61 6c 20 77 69 74 68 20 6e 75 6d 65 72 69 63 61 6c 20 64 61 74 61 2e 20 | .that.deal.with.numerical.data.. |
| 48860 | 20 4f 75 72 20 61 62 69 6c 69 74 79 20 74 6f 20 66 6f 72 6d 75 6c 61 74 65 20 61 6e 61 6c 6f 67 | .Our.ability.to.formulate.analog |
| 48880 | 6f 75 73 0a 6f 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 77 6f 72 6b 69 6e 67 20 77 69 74 68 20 | ous.operations.for.working.with. |
| 488a0 | 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 64 65 70 65 6e 64 73 20 63 72 75 63 69 61 6c 6c 79 20 | compound.data.depends.crucially. |
| 488c0 | 6f 6e 20 74 68 65 0a 73 74 79 6c 65 20 69 6e 20 77 68 69 63 68 20 77 65 20 6d 61 6e 69 70 75 6c | on.the.style.in.which.we.manipul |
| 488e0 | 61 74 65 20 6f 75 72 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 2e 20 20 43 6f 6e 73 69 64 | ate.our.data.structures...Consid |
| 48900 | 65 72 2c 20 66 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 | er,.for.example,.the.following.p |
| 48920 | 72 6f 63 65 64 75 72 65 2c 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 74 68 65 20 60 63 6f 75 6e | rocedure,.analogous.to.the.`coun |
| 48940 | 74 2d 6c 65 61 76 65 73 27 0a 70 72 6f 63 65 64 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a | t-leaves'.procedure.of.section.* |
| 48960 | 4e 6f 74 65 20 32 2d 32 2d 32 3a 3a 2c 20 77 68 69 63 68 20 74 61 6b 65 73 20 61 20 74 72 65 65 | Note.2-2-2::,.which.takes.a.tree |
| 48980 | 20 61 73 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 0a 63 6f 6d 70 75 74 65 73 20 74 68 65 20 73 75 | .as.argument.and.computes.the.su |
| 489a0 | 6d 20 6f 66 20 74 68 65 20 73 71 75 61 72 65 73 20 6f 66 20 74 68 65 20 6c 65 61 76 65 73 20 74 | m.of.the.squares.of.the.leaves.t |
| 489c0 | 68 61 74 20 61 72 65 20 6f 64 64 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d 2d | hat.are.odd:.......(define.(sum- |
| 489e0 | 6f 64 64 2d 73 71 75 61 72 65 73 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 | odd-squares.tree)........(cond.( |
| 48a00 | 28 6e 75 6c 6c 3f 20 74 72 65 65 29 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e | (null?.tree).0)..............((n |
| 48a20 | 6f 74 20 28 70 61 69 72 3f 20 74 72 65 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ot.(pair?.tree))...............( |
| 48a40 | 69 66 20 28 6f 64 64 3f 20 74 72 65 65 29 20 28 73 71 75 61 72 65 20 74 72 65 65 29 20 30 29 29 | if.(odd?.tree).(square.tree).0)) |
| 48a60 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 2b 20 28 73 75 6d 2d 6f 64 64 2d | ..............(else.(+.(sum-odd- |
| 48a80 | 73 71 75 61 72 65 73 20 28 63 61 72 20 74 72 65 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | squares.(car.tree))............. |
| 48aa0 | 20 20 20 20 20 20 20 20 20 20 28 73 75 6d 2d 6f 64 64 2d 73 71 75 61 72 65 73 20 28 63 64 72 20 | ..........(sum-odd-squares.(cdr. |
| 48ac0 | 74 72 65 65 29 29 29 29 29 29 0a 0a 20 20 20 4f 6e 20 74 68 65 20 73 75 72 66 61 63 65 2c 20 74 | tree)))))).....On.the.surface,.t |
| 48ae0 | 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 76 65 72 79 20 64 69 66 66 65 72 65 6e 74 20 | his.procedure.is.very.different. |
| 48b00 | 66 72 6f 6d 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 6f 6e 65 2c 20 77 68 69 63 68 20 63 6f | from.the.following.one,.which.co |
| 48b20 | 6e 73 74 72 75 63 74 73 20 61 20 6c 69 73 74 20 6f 66 20 61 6c 6c 20 74 68 65 20 65 76 65 6e 20 | nstructs.a.list.of.all.the.even. |
| 48b40 | 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 0a 5f 46 69 62 5f 28 6b 29 2c 20 77 68 65 72 | Fibonacci.numbers._Fib_(k),.wher |
| 48b60 | 65 20 6b 20 69 73 20 6c 65 73 73 20 74 68 61 6e 20 6f 72 20 65 71 75 61 6c 20 74 6f 20 61 20 67 | e.k.is.less.than.or.equal.to.a.g |
| 48b80 | 69 76 65 6e 20 69 6e 74 65 67 65 72 20 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 | iven.integer.n:.......(define.(e |
| 48ba0 | 76 65 6e 2d 66 69 62 73 20 6e 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6e 65 78 74 | ven-fibs.n)........(define.(next |
| 48bc0 | 20 6b 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 6b 20 6e 29 0a 20 20 20 20 20 20 20 | .k)..........(if.(>.k.n)........ |
| 48be0 | 20 20 20 20 20 20 6e 69 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 66 20 | ......nil..............(let.((f. |
| 48c00 | 28 66 69 62 20 6b 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 76 | (fib.k)))................(if.(ev |
| 48c20 | 65 6e 3f 20 66 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 | en?.f)....................(cons. |
| 48c40 | 66 20 28 6e 65 78 74 20 28 2b 20 6b 20 31 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | f.(next.(+.k.1)))............... |
| 48c60 | 20 20 20 20 20 28 6e 65 78 74 20 28 2b 20 6b 20 31 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 | .....(next.(+.k.1))))))........( |
| 48c80 | 6e 65 78 74 20 30 29 29 0a 0a 20 20 20 44 65 73 70 69 74 65 20 74 68 65 20 66 61 63 74 20 74 68 | next.0)).....Despite.the.fact.th |
| 48ca0 | 61 74 20 74 68 65 73 65 20 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 73 74 72 75 | at.these.two.procedures.are.stru |
| 48cc0 | 63 74 75 72 61 6c 6c 79 20 76 65 72 79 0a 64 69 66 66 65 72 65 6e 74 2c 20 61 20 6d 6f 72 65 20 | cturally.very.different,.a.more. |
| 48ce0 | 61 62 73 74 72 61 63 74 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 74 77 6f 20 | abstract.description.of.the.two. |
| 48d00 | 63 6f 6d 70 75 74 61 74 69 6f 6e 73 20 72 65 76 65 61 6c 73 0a 61 20 67 72 65 61 74 20 64 65 61 | computations.reveals.a.great.dea |
| 48d20 | 6c 20 6f 66 20 73 69 6d 69 6c 61 72 69 74 79 2e 20 20 54 68 65 20 66 69 72 73 74 20 70 72 6f 67 | l.of.similarity...The.first.prog |
| 48d40 | 72 61 6d 0a 0a 20 20 20 2a 20 65 6e 75 6d 65 72 61 74 65 73 20 74 68 65 20 6c 65 61 76 65 73 20 | ram.....*.enumerates.the.leaves. |
| 48d60 | 6f 66 20 61 20 74 72 65 65 3b 0a 0a 20 20 20 2a 20 66 69 6c 74 65 72 73 20 74 68 65 6d 2c 20 73 | of.a.tree;.....*.filters.them,.s |
| 48d80 | 65 6c 65 63 74 69 6e 67 20 74 68 65 20 6f 64 64 20 6f 6e 65 73 3b 0a 0a 20 20 20 2a 20 73 71 75 | electing.the.odd.ones;.....*.squ |
| 48da0 | 61 72 65 73 20 65 61 63 68 20 6f 66 20 74 68 65 20 73 65 6c 65 63 74 65 64 20 6f 6e 65 73 3b 20 | ares.each.of.the.selected.ones;. |
| 48dc0 | 61 6e 64 0a 0a 20 20 20 2a 20 61 63 63 75 6d 75 6c 61 74 65 73 20 74 68 65 20 72 65 73 75 6c 74 | and.....*.accumulates.the.result |
| 48de0 | 73 20 75 73 69 6e 67 20 60 2b 27 2c 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 30 2e 0a 0a 0a | s.using.`+',.starting.with.0.... |
| 48e00 | 20 20 20 54 68 65 20 73 65 63 6f 6e 64 20 70 72 6f 67 72 61 6d 0a 0a 20 20 20 2a 20 65 6e 75 6d | ...The.second.program.....*.enum |
| 48e20 | 65 72 61 74 65 73 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 66 72 6f 6d 20 30 20 74 6f 20 6e 3b | erates.the.integers.from.0.to.n; |
| 48e40 | 0a 0a 20 20 20 2a 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 | .....*.computes.the.Fibonacci.nu |
| 48e60 | 6d 62 65 72 20 66 6f 72 20 65 61 63 68 20 69 6e 74 65 67 65 72 3b 0a 0a 20 20 20 2a 20 66 69 6c | mber.for.each.integer;.....*.fil |
| 48e80 | 74 65 72 73 20 74 68 65 6d 2c 20 73 65 6c 65 63 74 69 6e 67 20 74 68 65 20 65 76 65 6e 20 6f 6e | ters.them,.selecting.the.even.on |
| 48ea0 | 65 73 3b 20 61 6e 64 0a 0a 20 20 20 2a 20 61 63 63 75 6d 75 6c 61 74 65 73 20 74 68 65 20 72 65 | es;.and.....*.accumulates.the.re |
| 48ec0 | 73 75 6c 74 73 20 75 73 69 6e 67 20 60 63 6f 6e 73 27 2c 20 20 73 74 61 72 74 69 6e 67 20 77 69 | sults.using.`cons',..starting.wi |
| 48ee0 | 74 68 20 74 68 65 20 65 6d 70 74 79 0a 20 20 20 20 20 6c 69 73 74 2e 0a 0a 0a 20 20 20 41 20 73 | th.the.empty......list.......A.s |
| 48f00 | 69 67 6e 61 6c 2d 70 72 6f 63 65 73 73 69 6e 67 20 65 6e 67 69 6e 65 65 72 20 77 6f 75 6c 64 20 | ignal-processing.engineer.would. |
| 48f20 | 66 69 6e 64 20 69 74 20 6e 61 74 75 72 61 6c 20 74 6f 20 63 6f 6e 63 65 70 74 75 61 6c 69 7a 65 | find.it.natural.to.conceptualize |
| 48f40 | 0a 74 68 65 73 65 20 70 72 6f 63 65 73 73 65 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 73 69 67 | .these.processes.in.terms.of.sig |
| 48f60 | 6e 61 6c 73 20 66 6c 6f 77 69 6e 67 20 74 68 72 6f 75 67 68 20 61 20 63 61 73 63 61 64 65 20 6f | nals.flowing.through.a.cascade.o |
| 48f80 | 66 0a 73 74 61 67 65 73 2c 20 65 61 63 68 20 6f 66 20 77 68 69 63 68 20 69 6d 70 6c 65 6d 65 6e | f.stages,.each.of.which.implemen |
| 48fa0 | 74 73 20 70 61 72 74 20 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d 20 70 6c 61 6e 2c 20 61 73 20 | ts.part.of.the.program.plan,.as. |
| 48fc0 | 73 68 6f 77 6e 20 69 6e 0a 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 37 3a 3a 2e 20 20 49 6e | shown.in.*Note.Figure.2-7::...In |
| 48fe0 | 20 60 73 75 6d 2d 6f 64 64 2d 73 71 75 61 72 65 73 27 2c 20 77 65 20 62 65 67 69 6e 20 77 69 74 | .`sum-odd-squares',.we.begin.wit |
| 49000 | 68 20 61 6e 20 22 65 6e 75 6d 65 72 61 74 6f 72 22 2c 0a 77 68 69 63 68 20 67 65 6e 65 72 61 74 | h.an."enumerator",.which.generat |
| 49020 | 65 73 20 61 20 22 73 69 67 6e 61 6c 22 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 74 68 65 20 | es.a."signal".consisting.of.the. |
| 49040 | 6c 65 61 76 65 73 20 6f 66 20 61 20 67 69 76 65 6e 20 74 72 65 65 2e 0a 54 68 69 73 20 73 69 67 | leaves.of.a.given.tree..This.sig |
| 49060 | 6e 61 6c 20 69 73 20 70 61 73 73 65 64 20 74 68 72 6f 75 67 68 20 61 20 22 66 69 6c 74 65 72 22 | nal.is.passed.through.a."filter" |
| 49080 | 2c 20 77 68 69 63 68 20 65 6c 69 6d 69 6e 61 74 65 73 20 61 6c 6c 20 62 75 74 20 74 68 65 0a 6f | ,.which.eliminates.all.but.the.o |
| 490a0 | 64 64 20 65 6c 65 6d 65 6e 74 73 2e 20 20 54 68 65 20 72 65 73 75 6c 74 69 6e 67 20 73 69 67 6e | dd.elements...The.resulting.sign |
| 490c0 | 61 6c 20 69 73 20 69 6e 20 74 75 72 6e 20 70 61 73 73 65 64 20 74 68 72 6f 75 67 68 20 61 20 22 | al.is.in.turn.passed.through.a." |
| 490e0 | 6d 61 70 22 2c 0a 77 68 69 63 68 20 69 73 20 61 20 22 74 72 61 6e 73 64 75 63 65 72 22 20 74 68 | map",.which.is.a."transducer".th |
| 49100 | 61 74 20 61 70 70 6c 69 65 73 20 74 68 65 20 60 73 71 75 61 72 65 27 20 70 72 6f 63 65 64 75 72 | at.applies.the.`square'.procedur |
| 49120 | 65 20 74 6f 20 65 61 63 68 0a 65 6c 65 6d 65 6e 74 2e 20 20 54 68 65 20 6f 75 74 70 75 74 20 6f | e.to.each.element...The.output.o |
| 49140 | 66 20 74 68 65 20 6d 61 70 20 69 73 20 74 68 65 6e 20 66 65 64 20 74 6f 20 61 6e 20 22 61 63 63 | f.the.map.is.then.fed.to.an."acc |
| 49160 | 75 6d 75 6c 61 74 6f 72 22 2c 20 77 68 69 63 68 0a 63 6f 6d 62 69 6e 65 73 20 74 68 65 20 65 6c | umulator",.which.combines.the.el |
| 49180 | 65 6d 65 6e 74 73 20 75 73 69 6e 67 20 60 2b 27 2c 20 73 74 61 72 74 69 6e 67 20 66 72 6f 6d 20 | ements.using.`+',.starting.from. |
| 491a0 | 61 6e 20 69 6e 69 74 69 61 6c 20 30 2e 20 20 54 68 65 20 70 6c 61 6e 0a 66 6f 72 20 60 65 76 65 | an.initial.0...The.plan.for.`eve |
| 491c0 | 6e 2d 66 69 62 73 27 20 69 73 20 61 6e 61 6c 6f 67 6f 75 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 | n-fibs'.is.analogous........*Fig |
| 491e0 | 75 72 65 20 32 2e 37 3a 2a 20 54 68 65 20 73 69 67 6e 61 6c 2d 66 6c 6f 77 20 70 6c 61 6e 73 20 | ure.2.7:*.The.signal-flow.plans. |
| 49200 | 66 6f 72 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 60 73 75 6d 2d 6f 64 64 | for.the.procedures......`sum-odd |
| 49220 | 2d 73 71 75 61 72 65 73 27 20 28 74 6f 70 29 20 61 6e 64 20 60 65 76 65 6e 2d 66 69 62 73 27 20 | -squares'.(top).and.`even-fibs'. |
| 49240 | 28 62 6f 74 74 6f 6d 29 20 72 65 76 65 61 6c 20 74 68 65 0a 20 20 20 20 20 63 6f 6d 6d 6f 6e 61 | (bottom).reveal.the......commona |
| 49260 | 6c 69 74 79 20 62 65 74 77 65 65 6e 20 74 68 65 20 74 77 6f 20 70 72 6f 67 72 61 6d 73 2e 0a 0a | lity.between.the.two.programs... |
| 49280 | 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d | ..........+-------------+...+--- |
| 492a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 | ----------+...+-------------+... |
| 492c0 | 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 65 6e 75 6d | +-------------+...........|.enum |
| 492e0 | 65 72 61 74 65 3a 20 20 7c 2d 2d 3e 7c 20 66 69 6c 74 65 72 3a 20 20 20 20 20 7c 2d 2d 3e 7c 20 | erate:..|-->|.filter:.....|-->|. |
| 49300 | 6d 61 70 3a 20 20 20 20 20 20 20 20 7c 2d 2d 3e 7c 20 61 63 63 75 6d 75 6c 61 74 65 3a 20 7c 0a | map:........|-->|.accumulate:.|. |
| 49320 | 20 20 20 20 20 20 20 20 20 20 7c 20 74 72 65 65 20 6c 65 61 76 65 73 20 7c 20 20 20 7c 20 6f 64 | ..........|.tree.leaves.|...|.od |
| 49340 | 64 3f 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 73 71 75 61 72 65 20 20 20 20 20 20 7c 20 20 20 | d?........|...|.square......|... |
| 49360 | 7c 20 2b 2c 20 30 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d | |.+,.0........|...........+----- |
| 49380 | 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d | --------+...+-------------+...+- |
| 493a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a | ------------+...+-------------+. |
| 493c0 | 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d | ...........+-------------+...+-- |
| 493e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 | -----------+...+-------------+.. |
| 49400 | 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 65 6e 75 | .+-------------+...........|.enu |
| 49420 | 6d 65 72 61 74 65 3a 20 20 7c 2d 2d 3e 7c 20 6d 61 70 3a 20 20 20 20 20 20 20 20 7c 2d 2d 3e 7c | merate:..|-->|.map:........|-->| |
| 49440 | 20 66 69 6c 74 65 72 3a 20 20 20 20 20 7c 2d 2d 3e 7c 20 61 63 63 75 6d 75 6c 61 74 65 3a 20 7c | .filter:.....|-->|.accumulate:.| |
| 49460 | 0a 20 20 20 20 20 20 20 20 20 20 7c 20 69 6e 74 65 67 65 72 73 20 20 20 20 7c 20 20 20 7c 20 66 | ...........|.integers....|...|.f |
| 49480 | 69 62 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 65 76 65 6e 3f 20 20 20 20 20 20 20 7c 20 20 | ib.........|...|.even?.......|.. |
| 494a0 | 20 7c 20 63 6f 6e 73 2c 20 28 29 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d | .|.cons,.()....|...........+---- |
| 494c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b | ---------+...+-------------+...+ |
| 494e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b | -------------+...+-------------+ |
| 49500 | 0a 0a 20 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 74 68 65 20 74 77 6f 20 70 72 6f 63 | .....Unfortunately,.the.two.proc |
| 49520 | 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 62 6f 76 65 20 66 61 69 6c 20 74 6f 20 | edure.definitions.above.fail.to. |
| 49540 | 65 78 68 69 62 69 74 0a 74 68 69 73 20 73 69 67 6e 61 6c 2d 66 6c 6f 77 20 73 74 72 75 63 74 75 | exhibit.this.signal-flow.structu |
| 49560 | 72 65 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 66 20 77 65 20 65 78 61 6d 69 6e 65 | re...For.instance,.if.we.examine |
| 49580 | 20 74 68 65 0a 60 73 75 6d 2d 6f 64 64 2d 73 71 75 61 72 65 73 27 20 70 72 6f 63 65 64 75 72 65 | .the.`sum-odd-squares'.procedure |
| 495a0 | 2c 20 77 65 20 66 69 6e 64 20 74 68 61 74 20 74 68 65 20 65 6e 75 6d 65 72 61 74 69 6f 6e 20 69 | ,.we.find.that.the.enumeration.i |
| 495c0 | 73 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 70 61 72 74 6c 79 20 62 79 20 74 68 65 20 60 6e 75 6c | s.implemented.partly.by.the.`nul |
| 495e0 | 6c 3f 27 20 61 6e 64 20 60 70 61 69 72 3f 27 20 74 65 73 74 73 20 61 6e 64 20 70 61 72 74 6c 79 | l?'.and.`pair?'.tests.and.partly |
| 49600 | 20 62 79 20 74 68 65 0a 74 72 65 65 2d 72 65 63 75 72 73 69 76 65 20 73 74 72 75 63 74 75 72 65 | .by.the.tree-recursive.structure |
| 49620 | 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2e 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 74 | .of.the.procedure...Similarly,.t |
| 49640 | 68 65 20 61 63 63 75 6d 75 6c 61 74 69 6f 6e 0a 69 73 20 66 6f 75 6e 64 20 70 61 72 74 6c 79 20 | he.accumulation.is.found.partly. |
| 49660 | 69 6e 20 74 68 65 20 74 65 73 74 73 20 61 6e 64 20 70 61 72 74 6c 79 20 69 6e 20 74 68 65 20 61 | in.the.tests.and.partly.in.the.a |
| 49680 | 64 64 69 74 69 6f 6e 20 75 73 65 64 20 69 6e 20 74 68 65 0a 72 65 63 75 72 73 69 6f 6e 2e 20 20 | ddition.used.in.the.recursion... |
| 496a0 | 49 6e 20 67 65 6e 65 72 61 6c 2c 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 64 69 73 74 69 6e 63 | In.general,.there.are.no.distinc |
| 496c0 | 74 20 70 61 72 74 73 20 6f 66 20 65 69 74 68 65 72 20 70 72 6f 63 65 64 75 72 65 0a 74 68 61 74 | t.parts.of.either.procedure.that |
| 496e0 | 20 63 6f 72 72 65 73 70 6f 6e 64 20 74 6f 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 | .correspond.to.the.elements.in.t |
| 49700 | 68 65 20 73 69 67 6e 61 6c 2d 66 6c 6f 77 20 64 65 73 63 72 69 70 74 69 6f 6e 2e 20 20 4f 75 72 | he.signal-flow.description...Our |
| 49720 | 0a 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 20 64 65 63 6f 6d 70 6f 73 65 20 74 68 65 20 63 6f | .two.procedures.decompose.the.co |
| 49740 | 6d 70 75 74 61 74 69 6f 6e 73 20 69 6e 20 61 20 64 69 66 66 65 72 65 6e 74 20 77 61 79 2c 20 73 | mputations.in.a.different.way,.s |
| 49760 | 70 72 65 61 64 69 6e 67 0a 74 68 65 20 65 6e 75 6d 65 72 61 74 69 6f 6e 20 6f 76 65 72 20 74 68 | preading.the.enumeration.over.th |
| 49780 | 65 20 70 72 6f 67 72 61 6d 20 61 6e 64 20 6d 69 6e 67 6c 69 6e 67 20 69 74 20 77 69 74 68 20 74 | e.program.and.mingling.it.with.t |
| 497a0 | 68 65 20 6d 61 70 2c 20 74 68 65 0a 66 69 6c 74 65 72 2c 20 61 6e 64 20 74 68 65 20 61 63 63 75 | he.map,.the.filter,.and.the.accu |
| 497c0 | 6d 75 6c 61 74 69 6f 6e 2e 20 20 49 66 20 77 65 20 63 6f 75 6c 64 20 6f 72 67 61 6e 69 7a 65 20 | mulation...If.we.could.organize. |
| 497e0 | 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 74 6f 0a 6d 61 6b 65 20 74 68 65 20 73 69 67 6e 61 6c 2d | our.programs.to.make.the.signal- |
| 49800 | 66 6c 6f 77 20 73 74 72 75 63 74 75 72 65 20 6d 61 6e 69 66 65 73 74 20 69 6e 20 74 68 65 20 70 | flow.structure.manifest.in.the.p |
| 49820 | 72 6f 63 65 64 75 72 65 73 20 77 65 20 77 72 69 74 65 2c 20 74 68 69 73 0a 77 6f 75 6c 64 20 69 | rocedures.we.write,.this.would.i |
| 49840 | 6e 63 72 65 61 73 65 20 74 68 65 20 63 6f 6e 63 65 70 74 75 61 6c 20 63 6c 61 72 69 74 79 20 6f | ncrease.the.conceptual.clarity.o |
| 49860 | 66 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 63 6f 64 65 2e 0a 0a 53 65 71 75 65 6e 63 65 20 | f.the.resulting.code...Sequence. |
| 49880 | 4f 70 65 72 61 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | Operations...................... |
| 498a0 | 54 68 65 20 6b 65 79 20 74 6f 20 6f 72 67 61 6e 69 7a 69 6e 67 20 70 72 6f 67 72 61 6d 73 20 73 | The.key.to.organizing.programs.s |
| 498c0 | 6f 20 61 73 20 74 6f 20 6d 6f 72 65 20 63 6c 65 61 72 6c 79 20 72 65 66 6c 65 63 74 20 74 68 65 | o.as.to.more.clearly.reflect.the |
| 498e0 | 0a 73 69 67 6e 61 6c 2d 66 6c 6f 77 20 73 74 72 75 63 74 75 72 65 20 69 73 20 74 6f 20 63 6f 6e | .signal-flow.structure.is.to.con |
| 49900 | 63 65 6e 74 72 61 74 65 20 6f 6e 20 74 68 65 20 22 73 69 67 6e 61 6c 73 22 20 74 68 61 74 20 66 | centrate.on.the."signals".that.f |
| 49920 | 6c 6f 77 20 66 72 6f 6d 0a 6f 6e 65 20 73 74 61 67 65 20 69 6e 20 74 68 65 20 70 72 6f 63 65 73 | low.from.one.stage.in.the.proces |
| 49940 | 73 20 74 6f 20 74 68 65 20 6e 65 78 74 2e 20 20 49 66 20 77 65 20 72 65 70 72 65 73 65 6e 74 20 | s.to.the.next...If.we.represent. |
| 49960 | 74 68 65 73 65 20 73 69 67 6e 61 6c 73 20 61 73 0a 6c 69 73 74 73 2c 20 74 68 65 6e 20 77 65 20 | these.signals.as.lists,.then.we. |
| 49980 | 63 61 6e 20 75 73 65 20 6c 69 73 74 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 6f 20 69 6d 70 6c 65 | can.use.list.operations.to.imple |
| 499a0 | 6d 65 6e 74 20 74 68 65 20 70 72 6f 63 65 73 73 69 6e 67 20 61 74 0a 65 61 63 68 20 6f 66 20 74 | ment.the.processing.at.each.of.t |
| 499c0 | 68 65 20 73 74 61 67 65 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 77 65 20 63 61 6e | he.stages...For.instance,.we.can |
| 499e0 | 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 6d 61 70 70 69 6e 67 20 73 74 61 67 65 73 0a 6f 66 | .implement.the.mapping.stages.of |
| 49a00 | 20 74 68 65 20 73 69 67 6e 61 6c 2d 66 6c 6f 77 20 64 69 61 67 72 61 6d 73 20 75 73 69 6e 67 20 | .the.signal-flow.diagrams.using. |
| 49a20 | 74 68 65 20 60 6d 61 70 27 20 70 72 6f 63 65 64 75 72 65 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e | the.`map'.procedure.from.section |
| 49a40 | 0a 2a 4e 6f 74 65 20 32 2d 32 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 28 6d 61 70 20 73 71 75 61 72 | .*Note.2-2-1:::.......(map.squar |
| 49a60 | 65 20 28 6c 69 73 74 20 31 20 32 20 33 20 34 20 35 29 29 0a 20 20 20 20 20 28 31 20 34 20 39 20 | e.(list.1.2.3.4.5))......(1.4.9. |
| 49a80 | 31 36 20 32 35 29 0a 0a 20 20 20 46 69 6c 74 65 72 69 6e 67 20 61 20 73 65 71 75 65 6e 63 65 20 | 16.25).....Filtering.a.sequence. |
| 49aa0 | 74 6f 20 73 65 6c 65 63 74 20 6f 6e 6c 79 20 74 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 74 68 | to.select.only.those.elements.th |
| 49ac0 | 61 74 20 73 61 74 69 73 66 79 20 61 0a 67 69 76 65 6e 20 70 72 65 64 69 63 61 74 65 20 69 73 20 | at.satisfy.a.given.predicate.is. |
| 49ae0 | 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 | accomplished.by.......(define.(f |
| 49b00 | 69 6c 74 65 72 20 70 72 65 64 69 63 61 74 65 20 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 | ilter.predicate.sequence)....... |
| 49b20 | 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 73 65 71 75 65 6e 63 65 29 20 6e 69 6c 29 0a 20 20 | .(cond.((null?.sequence).nil)... |
| 49b40 | 20 20 20 20 20 20 20 20 20 20 20 28 28 70 72 65 64 69 63 61 74 65 20 28 63 61 72 20 73 65 71 75 | ...........((predicate.(car.sequ |
| 49b60 | 65 6e 63 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 63 61 72 20 | ence))...............(cons.(car. |
| 49b80 | 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 | sequence).....................(f |
| 49ba0 | 69 6c 74 65 72 20 70 72 65 64 69 63 61 74 65 20 28 63 64 72 20 73 65 71 75 65 6e 63 65 29 29 29 | ilter.predicate.(cdr.sequence))) |
| 49bc0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 66 69 6c 74 65 72 20 70 72 65 | )..............(else.(filter.pre |
| 49be0 | 64 69 63 61 74 65 20 28 63 64 72 20 73 65 71 75 65 6e 63 65 29 29 29 29 29 0a 0a 20 20 20 46 6f | dicate.(cdr.sequence))))).....Fo |
| 49c00 | 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 28 66 69 6c 74 65 72 20 6f 64 64 3f 20 28 6c | r.example,.......(filter.odd?.(l |
| 49c20 | 69 73 74 20 31 20 32 20 33 20 34 20 35 29 29 0a 20 20 20 20 20 28 31 20 33 20 35 29 0a 0a 20 20 | ist.1.2.3.4.5))......(1.3.5).... |
| 49c40 | 20 41 63 63 75 6d 75 6c 61 74 69 6f 6e 73 20 63 61 6e 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 | .Accumulations.can.be.implemente |
| 49c60 | 64 20 62 79 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 63 63 75 6d 75 6c 61 74 65 20 6f | d.by.......(define.(accumulate.o |
| 49c80 | 70 20 69 6e 69 74 69 61 6c 20 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 | p.initial.sequence)........(if.( |
| 49ca0 | 6e 75 6c 6c 3f 20 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 69 6e 69 74 69 | null?.sequence)............initi |
| 49cc0 | 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 20 28 63 61 72 20 73 65 71 75 65 6e 63 65 29 | al............(op.(car.sequence) |
| 49ce0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 6f 70 20 69 | ................(accumulate.op.i |
| 49d00 | 6e 69 74 69 61 6c 20 28 63 64 72 20 73 65 71 75 65 6e 63 65 29 29 29 29 29 0a 0a 20 20 20 20 20 | nitial.(cdr.sequence)))))....... |
| 49d20 | 28 61 63 63 75 6d 75 6c 61 74 65 20 2b 20 30 20 28 6c 69 73 74 20 31 20 32 20 33 20 34 20 35 29 | (accumulate.+.0.(list.1.2.3.4.5) |
| 49d40 | 29 0a 20 20 20 20 20 31 35 0a 0a 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 2a 20 31 20 | )......15.......(accumulate.*.1. |
| 49d60 | 28 6c 69 73 74 20 31 20 32 20 33 20 34 20 35 29 29 0a 20 20 20 20 20 31 32 30 0a 0a 20 20 20 20 | (list.1.2.3.4.5))......120...... |
| 49d80 | 20 28 61 63 63 75 6d 75 6c 61 74 65 20 63 6f 6e 73 20 6e 69 6c 20 28 6c 69 73 74 20 31 20 32 20 | .(accumulate.cons.nil.(list.1.2. |
| 49da0 | 33 20 34 20 35 29 29 0a 20 20 20 20 20 28 31 20 32 20 33 20 34 20 35 29 0a 0a 20 20 20 41 6c 6c | 3.4.5))......(1.2.3.4.5).....All |
| 49dc0 | 20 74 68 61 74 20 72 65 6d 61 69 6e 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 73 69 67 6e 61 | .that.remains.to.implement.signa |
| 49de0 | 6c 2d 66 6c 6f 77 20 64 69 61 67 72 61 6d 73 20 69 73 20 74 6f 20 65 6e 75 6d 65 72 61 74 65 0a | l-flow.diagrams.is.to.enumerate. |
| 49e00 | 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 65 6c 65 6d 65 6e 74 73 20 74 6f 20 62 65 20 70 | the.sequence.of.elements.to.be.p |
| 49e20 | 72 6f 63 65 73 73 65 64 2e 20 20 46 6f 72 20 60 65 76 65 6e 2d 66 69 62 73 27 2c 20 77 65 20 6e | rocessed...For.`even-fibs',.we.n |
| 49e40 | 65 65 64 20 74 6f 0a 67 65 6e 65 72 61 74 65 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 | eed.to.generate.the.sequence.of. |
| 49e60 | 69 6e 74 65 67 65 72 73 20 69 6e 20 61 20 67 69 76 65 6e 20 72 61 6e 67 65 2c 20 77 68 69 63 68 | integers.in.a.given.range,.which |
| 49e80 | 20 77 65 20 63 61 6e 20 64 6f 20 61 73 0a 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 | .we.can.do.as.follows:.......(de |
| 49ea0 | 66 69 6e 65 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 6c 6f 77 20 68 69 67 | fine.(enumerate-interval.low.hig |
| 49ec0 | 68 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 6c 6f 77 20 68 69 67 68 29 0a 20 20 20 20 20 | h)........(if.(>.low.high)...... |
| 49ee0 | 20 20 20 20 20 20 6e 69 6c 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 6c 6f 77 20 28 | ......nil............(cons.low.( |
| 49f00 | 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 28 2b 20 6c 6f 77 20 31 29 20 68 69 67 | enumerate-interval.(+.low.1).hig |
| 49f20 | 68 29 29 29 29 0a 0a 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 | h)))).......(enumerate-interval. |
| 49f40 | 32 20 37 29 0a 20 20 20 20 20 28 32 20 33 20 34 20 35 20 36 20 37 29 0a 0a 20 20 20 54 6f 20 65 | 2.7)......(2.3.4.5.6.7).....To.e |
| 49f60 | 6e 75 6d 65 72 61 74 65 20 74 68 65 20 6c 65 61 76 65 73 20 6f 66 20 61 20 74 72 65 65 2c 20 77 | numerate.the.leaves.of.a.tree,.w |
| 49f80 | 65 20 63 61 6e 20 75 73 65 28 31 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6e 75 6d | e.can.use(1).......(define.(enum |
| 49fa0 | 65 72 61 74 65 2d 74 72 65 65 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 | erate-tree.tree)........(cond.(( |
| 49fc0 | 6e 75 6c 6c 3f 20 74 72 65 65 29 20 6e 69 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | null?.tree).nil)..............(( |
| 49fe0 | 6e 6f 74 20 28 70 61 69 72 3f 20 74 72 65 65 29 29 20 28 6c 69 73 74 20 74 72 65 65 29 29 0a 20 | not.(pair?.tree)).(list.tree)).. |
| 4a000 | 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 61 70 70 65 6e 64 20 28 65 6e 75 6d 65 | ............(else.(append.(enume |
| 4a020 | 72 61 74 65 2d 74 72 65 65 20 28 63 61 72 20 74 72 65 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 | rate-tree.(car.tree))........... |
| 4a040 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d 74 72 65 65 | .................(enumerate-tree |
| 4a060 | 20 28 63 64 72 20 74 72 65 65 29 29 29 29 29 29 0a 0a 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 | .(cdr.tree)))))).......(enumerat |
| 4a080 | 65 2d 74 72 65 65 20 28 6c 69 73 74 20 31 20 28 6c 69 73 74 20 32 20 28 6c 69 73 74 20 33 20 34 | e-tree.(list.1.(list.2.(list.3.4 |
| 4a0a0 | 29 29 20 35 29 29 0a 20 20 20 20 20 28 31 20 32 20 33 20 34 20 35 29 0a 0a 20 20 20 4e 6f 77 20 | )).5))......(1.2.3.4.5).....Now. |
| 4a0c0 | 77 65 20 63 61 6e 20 72 65 66 6f 72 6d 75 6c 61 74 65 20 60 73 75 6d 2d 6f 64 64 2d 73 71 75 61 | we.can.reformulate.`sum-odd-squa |
| 4a0e0 | 72 65 73 27 20 61 6e 64 20 60 65 76 65 6e 2d 66 69 62 73 27 20 61 73 20 69 6e 20 74 68 65 0a 73 | res'.and.`even-fibs'.as.in.the.s |
| 4a100 | 69 67 6e 61 6c 2d 66 6c 6f 77 20 64 69 61 67 72 61 6d 73 2e 20 20 46 6f 72 20 60 73 75 6d 2d 6f | ignal-flow.diagrams...For.`sum-o |
| 4a120 | 64 64 2d 73 71 75 61 72 65 73 27 2c 20 77 65 20 65 6e 75 6d 65 72 61 74 65 20 74 68 65 20 73 65 | dd-squares',.we.enumerate.the.se |
| 4a140 | 71 75 65 6e 63 65 0a 6f 66 20 6c 65 61 76 65 73 20 6f 66 20 74 68 65 20 74 72 65 65 2c 20 66 69 | quence.of.leaves.of.the.tree,.fi |
| 4a160 | 6c 74 65 72 20 74 68 69 73 20 74 6f 20 6b 65 65 70 20 6f 6e 6c 79 20 74 68 65 20 6f 64 64 20 6e | lter.this.to.keep.only.the.odd.n |
| 4a180 | 75 6d 62 65 72 73 20 69 6e 20 74 68 65 0a 73 65 71 75 65 6e 63 65 2c 20 73 71 75 61 72 65 20 65 | umbers.in.the.sequence,.square.e |
| 4a1a0 | 61 63 68 20 65 6c 65 6d 65 6e 74 2c 20 61 6e 64 20 73 75 6d 20 74 68 65 20 72 65 73 75 6c 74 73 | ach.element,.and.sum.the.results |
| 4a1c0 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d 2d 6f 64 64 2d 73 71 75 61 72 65 73 | :.......(define.(sum-odd-squares |
| 4a1e0 | 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 2b 0a 20 20 20 20 | .tree)........(accumulate.+..... |
| 4a200 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...............0................ |
| 4a220 | 20 20 20 20 28 6d 61 70 20 73 71 75 61 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....(map.square................. |
| 4a240 | 20 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 20 6f 64 64 3f 0a 20 20 20 20 20 20 20 20 20 20 20 | ........(filter.odd?............ |
| 4a260 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d | .....................(enumerate- |
| 4a280 | 74 72 65 65 20 74 72 65 65 29 29 29 29 29 0a 0a 20 20 20 46 6f 72 20 60 65 76 65 6e 2d 66 69 62 | tree.tree))))).....For.`even-fib |
| 4a2a0 | 73 27 2c 20 77 65 20 65 6e 75 6d 65 72 61 74 65 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 66 72 | s',.we.enumerate.the.integers.fr |
| 4a2c0 | 6f 6d 20 30 20 74 6f 20 6e 2c 20 67 65 6e 65 72 61 74 65 20 74 68 65 0a 46 69 62 6f 6e 61 63 63 | om.0.to.n,.generate.the.Fibonacc |
| 4a2e0 | 69 20 6e 75 6d 62 65 72 20 66 6f 72 20 65 61 63 68 20 6f 66 20 74 68 65 73 65 20 69 6e 74 65 67 | i.number.for.each.of.these.integ |
| 4a300 | 65 72 73 2c 20 66 69 6c 74 65 72 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 0a 73 65 71 75 65 6e | ers,.filter.the.resulting.sequen |
| 4a320 | 63 65 20 74 6f 20 6b 65 65 70 20 6f 6e 6c 79 20 74 68 65 20 65 76 65 6e 20 65 6c 65 6d 65 6e 74 | ce.to.keep.only.the.even.element |
| 4a340 | 73 2c 20 61 6e 64 20 61 63 63 75 6d 75 6c 61 74 65 20 74 68 65 20 72 65 73 75 6c 74 73 0a 69 6e | s,.and.accumulate.the.results.in |
| 4a360 | 74 6f 20 61 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 65 6e 2d 66 | to.a.list:.......(define.(even-f |
| 4a380 | 69 62 73 20 6e 29 0a 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 63 6f 6e 73 0a 20 | ibs.n)........(accumulate.cons.. |
| 4a3a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 69 6c 0a 20 20 20 20 20 20 20 20 20 20 | ..................nil........... |
| 4a3c0 | 20 20 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 20 65 76 65 6e 3f 0a 20 20 20 20 20 20 20 20 20 | .........(filter.even?.......... |
| 4a3e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 66 69 62 0a 20 20 20 20 20 | ..................(map.fib...... |
| 4a400 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 75 6d | ...........................(enum |
| 4a420 | 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 30 20 6e 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 | erate-interval.0.n))))).....The. |
| 4a440 | 76 61 6c 75 65 20 6f 66 20 65 78 70 72 65 73 73 69 6e 67 20 70 72 6f 67 72 61 6d 73 20 61 73 20 | value.of.expressing.programs.as. |
| 4a460 | 73 65 71 75 65 6e 63 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 73 20 74 68 61 74 20 74 68 69 73 | sequence.operations.is.that.this |
| 4a480 | 0a 68 65 6c 70 73 20 75 73 20 6d 61 6b 65 20 70 72 6f 67 72 61 6d 20 64 65 73 69 67 6e 73 20 74 | .helps.us.make.program.designs.t |
| 4a4a0 | 68 61 74 20 61 72 65 20 6d 6f 64 75 6c 61 72 2c 20 74 68 61 74 20 69 73 2c 20 64 65 73 69 67 6e | hat.are.modular,.that.is,.design |
| 4a4c0 | 73 20 74 68 61 74 0a 61 72 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 62 79 20 63 6f 6d 62 69 6e | s.that.are.constructed.by.combin |
| 4a4e0 | 69 6e 67 20 72 65 6c 61 74 69 76 65 6c 79 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 70 69 65 63 65 | ing.relatively.independent.piece |
| 4a500 | 73 2e 20 20 57 65 20 63 61 6e 0a 65 6e 63 6f 75 72 61 67 65 20 6d 6f 64 75 6c 61 72 20 64 65 73 | s...We.can.encourage.modular.des |
| 4a520 | 69 67 6e 20 62 79 20 70 72 6f 76 69 64 69 6e 67 20 61 20 6c 69 62 72 61 72 79 20 6f 66 20 73 74 | ign.by.providing.a.library.of.st |
| 4a540 | 61 6e 64 61 72 64 20 63 6f 6d 70 6f 6e 65 6e 74 73 0a 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 | andard.components.together.with. |
| 4a560 | 61 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 69 6e 74 65 72 66 61 63 65 20 66 6f 72 20 63 6f 6e | a.conventional.interface.for.con |
| 4a580 | 6e 65 63 74 69 6e 67 20 74 68 65 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 69 6e 0a 66 6c 65 78 69 62 | necting.the.components.in.flexib |
| 4a5a0 | 6c 65 20 77 61 79 73 2e 0a 0a 20 20 20 4d 6f 64 75 6c 61 72 20 63 6f 6e 73 74 72 75 63 74 69 6f | le.ways......Modular.constructio |
| 4a5c0 | 6e 20 69 73 20 61 20 70 6f 77 65 72 66 75 6c 20 73 74 72 61 74 65 67 79 20 66 6f 72 20 63 6f 6e | n.is.a.powerful.strategy.for.con |
| 4a5e0 | 74 72 6f 6c 6c 69 6e 67 0a 63 6f 6d 70 6c 65 78 69 74 79 20 69 6e 20 65 6e 67 69 6e 65 65 72 69 | trolling.complexity.in.engineeri |
| 4a600 | 6e 67 20 64 65 73 69 67 6e 2e 20 20 49 6e 20 72 65 61 6c 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 | ng.design...In.real.signal-proce |
| 4a620 | 73 73 69 6e 67 0a 61 70 70 6c 69 63 61 74 69 6f 6e 73 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c | ssing.applications,.for.example, |
| 4a640 | 20 64 65 73 69 67 6e 65 72 73 20 72 65 67 75 6c 61 72 6c 79 20 62 75 69 6c 64 20 73 79 73 74 65 | .designers.regularly.build.syste |
| 4a660 | 6d 73 20 62 79 0a 63 61 73 63 61 64 69 6e 67 20 65 6c 65 6d 65 6e 74 73 20 73 65 6c 65 63 74 65 | ms.by.cascading.elements.selecte |
| 4a680 | 64 20 66 72 6f 6d 20 73 74 61 6e 64 61 72 64 69 7a 65 64 20 66 61 6d 69 6c 69 65 73 20 6f 66 20 | d.from.standardized.families.of. |
| 4a6a0 | 66 69 6c 74 65 72 73 20 61 6e 64 0a 74 72 61 6e 73 64 75 63 65 72 73 2e 20 20 53 69 6d 69 6c 61 | filters.and.transducers...Simila |
| 4a6c0 | 72 6c 79 2c 20 73 65 71 75 65 6e 63 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 70 72 6f 76 69 64 65 | rly,.sequence.operations.provide |
| 4a6e0 | 20 61 20 6c 69 62 72 61 72 79 20 6f 66 0a 73 74 61 6e 64 61 72 64 20 70 72 6f 67 72 61 6d 20 65 | .a.library.of.standard.program.e |
| 4a700 | 6c 65 6d 65 6e 74 73 20 74 68 61 74 20 77 65 20 63 61 6e 20 6d 69 78 20 61 6e 64 20 6d 61 74 63 | lements.that.we.can.mix.and.matc |
| 4a720 | 68 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 77 65 0a 63 61 6e 20 72 65 75 73 65 20 70 | h...For.instance,.we.can.reuse.p |
| 4a740 | 69 65 63 65 73 20 66 72 6f 6d 20 74 68 65 20 60 73 75 6d 2d 6f 64 64 2d 73 71 75 61 72 65 73 27 | ieces.from.the.`sum-odd-squares' |
| 4a760 | 20 61 6e 64 20 60 65 76 65 6e 2d 66 69 62 73 27 20 70 72 6f 63 65 64 75 72 65 73 0a 69 6e 20 61 | .and.`even-fibs'.procedures.in.a |
| 4a780 | 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 63 6f 6e 73 74 72 75 63 74 73 20 61 20 6c 69 73 74 20 | .program.that.constructs.a.list. |
| 4a7a0 | 6f 66 20 74 68 65 20 73 71 75 61 72 65 73 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 6e 20 2b 20 | of.the.squares.of.the.first.n.+. |
| 4a7c0 | 31 0a 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 | 1.Fibonacci.numbers:.......(defi |
| 4a7e0 | 6e 65 20 28 6c 69 73 74 2d 66 69 62 2d 73 71 75 61 72 65 73 20 6e 29 0a 20 20 20 20 20 20 20 28 | ne.(list-fib-squares.n)........( |
| 4a800 | 61 63 63 75 6d 75 6c 61 74 65 20 63 6f 6e 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | accumulate.cons................. |
| 4a820 | 20 20 20 6e 69 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 73 | ...nil....................(map.s |
| 4a840 | 71 75 61 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d | quare.........................(m |
| 4a860 | 61 70 20 66 69 62 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ap.fib.......................... |
| 4a880 | 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 30 20 6e 29 29 29 29 29 | ....(enumerate-interval.0.n))))) |
| 4a8a0 | 0a 0a 20 20 20 20 20 28 6c 69 73 74 2d 66 69 62 2d 73 71 75 61 72 65 73 20 31 30 29 0a 20 20 20 | .......(list-fib-squares.10).... |
| 4a8c0 | 20 20 28 30 20 31 20 31 20 34 20 39 20 32 35 20 36 34 20 31 36 39 20 34 34 31 20 31 31 35 36 20 | ..(0.1.1.4.9.25.64.169.441.1156. |
| 4a8e0 | 33 30 32 35 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 72 65 61 72 72 61 6e 67 65 20 74 68 65 20 70 | 3025).....We.can.rearrange.the.p |
| 4a900 | 69 65 63 65 73 20 61 6e 64 20 75 73 65 20 74 68 65 6d 20 69 6e 20 63 6f 6d 70 75 74 69 6e 67 20 | ieces.and.use.them.in.computing. |
| 4a920 | 74 68 65 20 70 72 6f 64 75 63 74 20 6f 66 0a 74 68 65 20 6f 64 64 20 69 6e 74 65 67 65 72 73 20 | the.product.of.the.odd.integers. |
| 4a940 | 69 6e 20 61 20 73 65 71 75 65 6e 63 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 | in.a.sequence:.......(define.(pr |
| 4a960 | 6f 64 75 63 74 2d 6f 66 2d 73 71 75 61 72 65 73 2d 6f 66 2d 6f 64 64 2d 65 6c 65 6d 65 6e 74 73 | oduct-of-squares-of-odd-elements |
| 4a980 | 20 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 2a 0a | .sequence)........(accumulate.*. |
| 4a9a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 | ...................1............ |
| 4a9c0 | 20 20 20 20 20 20 20 20 28 6d 61 70 20 73 71 75 61 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ........(map.square............. |
| 4a9e0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 20 6f 64 64 3f 20 73 65 71 75 65 6e 63 | ............(filter.odd?.sequenc |
| 4aa00 | 65 29 29 29 29 0a 0a 20 20 20 20 20 28 70 72 6f 64 75 63 74 2d 6f 66 2d 73 71 75 61 72 65 73 2d | e)))).......(product-of-squares- |
| 4aa20 | 6f 66 2d 6f 64 64 2d 65 6c 65 6d 65 6e 74 73 20 28 6c 69 73 74 20 31 20 32 20 33 20 34 20 35 29 | of-odd-elements.(list.1.2.3.4.5) |
| 4aa40 | 29 0a 20 20 20 20 20 32 32 35 0a 0a 20 20 20 57 65 20 63 61 6e 20 61 6c 73 6f 20 66 6f 72 6d 75 | )......225.....We.can.also.formu |
| 4aa60 | 6c 61 74 65 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 64 61 74 61 2d 70 72 6f 63 65 73 73 69 6e | late.conventional.data-processin |
| 4aa80 | 67 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 69 6e 0a 74 65 72 6d 73 20 6f 66 20 73 65 71 75 65 | g.applications.in.terms.of.seque |
| 4aaa0 | 6e 63 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 53 75 70 70 6f 73 65 20 77 65 20 68 61 76 65 | nce.operations...Suppose.we.have |
| 4aac0 | 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 70 65 72 73 6f 6e 6e 65 6c 0a 72 65 63 6f 72 64 73 | .a.sequence.of.personnel.records |
| 4aae0 | 20 61 6e 64 20 77 65 20 77 61 6e 74 20 74 6f 20 66 69 6e 64 20 74 68 65 20 73 61 6c 61 72 79 20 | .and.we.want.to.find.the.salary. |
| 4ab00 | 6f 66 20 74 68 65 20 68 69 67 68 65 73 74 2d 70 61 69 64 20 70 72 6f 67 72 61 6d 6d 65 72 2e 0a | of.the.highest-paid.programmer.. |
| 4ab20 | 41 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 68 61 76 65 20 61 20 73 65 6c 65 63 74 6f 72 20 60 | Assume.that.we.have.a.selector.` |
| 4ab40 | 73 61 6c 61 72 79 27 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 61 6c 61 72 79 20 | salary'.that.returns.the.salary. |
| 4ab60 | 6f 66 20 61 0a 72 65 63 6f 72 64 2c 20 61 6e 64 20 61 20 70 72 65 64 69 63 61 74 65 20 60 70 72 | of.a.record,.and.a.predicate.`pr |
| 4ab80 | 6f 67 72 61 6d 6d 65 72 3f 27 20 74 68 61 74 20 74 65 73 74 73 20 69 66 20 61 20 72 65 63 6f 72 | ogrammer?'.that.tests.if.a.recor |
| 4aba0 | 64 20 69 73 20 66 6f 72 20 61 0a 70 72 6f 67 72 61 6d 6d 65 72 2e 20 20 54 68 65 6e 20 77 65 20 | d.is.for.a.programmer...Then.we. |
| 4abc0 | 63 61 6e 20 77 72 69 74 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 61 6c 61 72 79 2d | can.write.......(define.(salary- |
| 4abe0 | 6f 66 2d 68 69 67 68 65 73 74 2d 70 61 69 64 2d 70 72 6f 67 72 61 6d 6d 65 72 20 72 65 63 6f 72 | of-highest-paid-programmer.recor |
| 4ac00 | 64 73 29 0a 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 6d 61 78 0a 20 20 20 20 20 | ds)........(accumulate.max...... |
| 4ac20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............0................. |
| 4ac40 | 20 20 20 28 6d 61 70 20 73 61 6c 61 72 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...(map.salary.................. |
| 4ac60 | 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 3f 20 72 65 63 6f 72 | .......(filter.programmer?.recor |
| 4ac80 | 64 73 29 29 29 29 0a 0a 20 20 20 54 68 65 73 65 20 65 78 61 6d 70 6c 65 73 20 67 69 76 65 20 6a | ds)))).....These.examples.give.j |
| 4aca0 | 75 73 74 20 61 20 68 69 6e 74 20 6f 66 20 74 68 65 20 76 61 73 74 20 72 61 6e 67 65 20 6f 66 20 | ust.a.hint.of.the.vast.range.of. |
| 4acc0 | 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 0a 63 61 6e 20 62 65 20 65 78 70 72 65 73 73 65 64 | operations.that.can.be.expressed |
| 4ace0 | 20 61 73 20 73 65 71 75 65 6e 63 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 28 32 29 0a 0a 20 20 20 | .as.sequence.operations.(2)..... |
| 4ad00 | 53 65 71 75 65 6e 63 65 73 2c 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 68 65 72 65 20 61 73 20 6c | Sequences,.implemented.here.as.l |
| 4ad20 | 69 73 74 73 2c 20 73 65 72 76 65 20 61 73 20 61 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 0a 69 6e | ists,.serve.as.a.conventional.in |
| 4ad40 | 74 65 72 66 61 63 65 20 74 68 61 74 20 70 65 72 6d 69 74 73 20 75 73 20 74 6f 20 63 6f 6d 62 69 | terface.that.permits.us.to.combi |
| 4ad60 | 6e 65 20 70 72 6f 63 65 73 73 69 6e 67 20 6d 6f 64 75 6c 65 73 2e 20 20 41 64 64 69 74 69 6f 6e | ne.processing.modules...Addition |
| 4ad80 | 61 6c 6c 79 2c 0a 77 68 65 6e 20 77 65 20 75 6e 69 66 6f 72 6d 6c 79 20 72 65 70 72 65 73 65 6e | ally,.when.we.uniformly.represen |
| 4ada0 | 74 20 73 74 72 75 63 74 75 72 65 73 20 61 73 20 73 65 71 75 65 6e 63 65 73 2c 20 77 65 20 68 61 | t.structures.as.sequences,.we.ha |
| 4adc0 | 76 65 20 6c 6f 63 61 6c 69 7a 65 64 0a 74 68 65 20 64 61 74 61 2d 73 74 72 75 63 74 75 72 65 20 | ve.localized.the.data-structure. |
| 4ade0 | 64 65 70 65 6e 64 65 6e 63 69 65 73 20 69 6e 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 74 6f 20 | dependencies.in.our.programs.to. |
| 4ae00 | 61 20 73 6d 61 6c 6c 20 6e 75 6d 62 65 72 20 6f 66 0a 73 65 71 75 65 6e 63 65 20 6f 70 65 72 61 | a.small.number.of.sequence.opera |
| 4ae20 | 74 69 6f 6e 73 2e 20 20 42 79 20 63 68 61 6e 67 69 6e 67 20 74 68 65 73 65 2c 20 77 65 20 63 61 | tions...By.changing.these,.we.ca |
| 4ae40 | 6e 20 65 78 70 65 72 69 6d 65 6e 74 20 77 69 74 68 0a 61 6c 74 65 72 6e 61 74 69 76 65 20 72 65 | n.experiment.with.alternative.re |
| 4ae60 | 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 73 65 71 75 65 6e 63 65 73 2c 20 77 68 69 6c | presentations.of.sequences,.whil |
| 4ae80 | 65 20 6c 65 61 76 69 6e 67 20 74 68 65 20 6f 76 65 72 61 6c 6c 0a 64 65 73 69 67 6e 20 6f 66 20 | e.leaving.the.overall.design.of. |
| 4aea0 | 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 69 6e 74 61 63 74 2e 20 20 57 65 20 77 69 6c 6c 20 65 78 | our.programs.intact...We.will.ex |
| 4aec0 | 70 6c 6f 69 74 20 74 68 69 73 20 63 61 70 61 62 69 6c 69 74 79 20 69 6e 0a 73 65 63 74 69 6f 6e | ploit.this.capability.in.section |
| 4aee0 | 20 2a 4e 6f 74 65 20 33 2d 35 3a 3a 2c 20 77 68 65 6e 20 77 65 20 67 65 6e 65 72 61 6c 69 7a 65 | .*Note.3-5::,.when.we.generalize |
| 4af00 | 20 74 68 65 20 73 65 71 75 65 6e 63 65 2d 70 72 6f 63 65 73 73 69 6e 67 0a 70 61 72 61 64 69 67 | .the.sequence-processing.paradig |
| 4af20 | 6d 20 74 6f 20 61 64 6d 69 74 20 69 6e 66 69 6e 69 74 65 20 73 65 71 75 65 6e 63 65 73 2e 0a 0a | m.to.admit.infinite.sequences... |
| 4af40 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 33 33 3a 2a 20 46 69 6c 6c 20 69 6e 20 74 68 | .....*Exercise.2.33:*.Fill.in.th |
| 4af60 | 65 20 6d 69 73 73 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 6f 20 63 6f 6d 70 6c 65 74 | e.missing.expressions.to.complet |
| 4af80 | 65 20 74 68 65 0a 20 20 20 20 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73 | e.the......following.definitions |
| 4afa0 | 20 6f 66 20 73 6f 6d 65 20 62 61 73 69 63 20 6c 69 73 74 2d 6d 61 6e 69 70 75 6c 61 74 69 6f 6e | .of.some.basic.list-manipulation |
| 4afc0 | 20 6f 70 65 72 61 74 69 6f 6e 73 0a 20 20 20 20 20 61 73 20 61 63 63 75 6d 75 6c 61 74 69 6f 6e | .operations......as.accumulation |
| 4afe0 | 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 70 20 70 20 73 65 71 | s:............(define.(map.p.seq |
| 4b000 | 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 28 | uence).............(accumulate.( |
| 4b020 | 6c 61 6d 62 64 61 20 28 78 20 79 29 20 3c 3f 3f 3e 29 20 6e 69 6c 20 73 65 71 75 65 6e 63 65 29 | lambda.(x.y).<??>).nil.sequence) |
| 4b040 | 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 70 65 6e 64 20 73 65 71 | )............(define.(append.seq |
| 4b060 | 31 20 73 65 71 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 | 1.seq2).............(accumulate. |
| 4b080 | 63 6f 6e 73 20 3c 3f 3f 3e 20 3c 3f 3f 3e 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | cons.<??>.<??>))............(def |
| 4b0a0 | 69 6e 65 20 28 6c 65 6e 67 74 68 20 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 | ine.(length.sequence)........... |
| 4b0c0 | 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 3c 3f 3f 3e 20 30 20 73 65 71 75 65 6e 63 65 29 29 0a | ..(accumulate.<??>.0.sequence)). |
| 4b0e0 | 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 33 34 3a 2a 20 45 76 61 6c 75 61 74 69 6e | ......*Exercise.2.34:*.Evaluatin |
| 4b100 | 67 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 69 6e 20 78 20 61 74 20 61 20 67 69 76 65 6e 20 76 | g.a.polynomial.in.x.at.a.given.v |
| 4b120 | 61 6c 75 65 20 6f 66 0a 20 20 20 20 20 78 20 63 61 6e 20 62 65 20 66 6f 72 6d 75 6c 61 74 65 64 | alue.of......x.can.be.formulated |
| 4b140 | 20 61 73 20 61 6e 20 61 63 63 75 6d 75 6c 61 74 69 6f 6e 2e 20 20 57 65 20 65 76 61 6c 75 61 74 | .as.an.accumulation...We.evaluat |
| 4b160 | 65 20 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 0a 0a 20 20 20 20 20 20 20 20 20 20 61 5f 6e 20 | e.the.polynomial............a_n. |
| 4b180 | 72 5e 6e 20 7c 20 61 5f 28 6e 2d 31 29 20 72 5e 28 6e 2d 31 29 20 2b 20 2e 2e 2e 20 2b 20 61 5f | r^n.|.a_(n-1).r^(n-1).+.....+.a_ |
| 4b1a0 | 31 20 72 20 2b 20 61 5f 30 0a 0a 20 20 20 20 20 75 73 69 6e 67 20 61 20 77 65 6c 6c 2d 6b 6e 6f | 1.r.+.a_0.......using.a.well-kno |
| 4b1c0 | 77 6e 20 61 6c 67 6f 72 69 74 68 6d 20 63 61 6c 6c 65 64 20 22 48 6f 72 6e 65 72 27 73 20 72 75 | wn.algorithm.called."Horner's.ru |
| 4b1e0 | 6c 65 22 2c 20 77 68 69 63 68 0a 20 20 20 20 20 73 74 72 75 63 74 75 72 65 73 20 74 68 65 20 63 | le",.which......structures.the.c |
| 4b200 | 6f 6d 70 75 74 61 74 69 6f 6e 20 61 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 2e 2e 2e 20 28 61 | omputation.as............(....(a |
| 4b220 | 5f 6e 20 72 20 2b 20 61 5f 28 6e 2d 31 29 29 20 72 20 2b 20 2e 2e 2e 20 2b 20 61 5f 31 29 20 72 | _n.r.+.a_(n-1)).r.+.....+.a_1).r |
| 4b240 | 20 2b 20 61 5f 30 0a 0a 20 20 20 20 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 77 65 20 | .+.a_0.......In.other.words,.we. |
| 4b260 | 73 74 61 72 74 20 77 69 74 68 20 61 5f 6e 2c 20 6d 75 6c 74 69 70 6c 79 20 62 79 20 78 2c 20 61 | start.with.a_n,.multiply.by.x,.a |
| 4b280 | 64 64 20 61 5f 28 6e 2d 31 29 2c 0a 20 20 20 20 20 6d 75 6c 74 69 70 6c 79 20 62 79 20 78 2c 20 | dd.a_(n-1),......multiply.by.x,. |
| 4b2a0 | 61 6e 64 20 73 6f 20 6f 6e 2c 20 75 6e 74 69 6c 20 77 65 20 72 65 61 63 68 20 61 5f 30 2e 28 33 | and.so.on,.until.we.reach.a_0.(3 |
| 4b2c0 | 29 0a 0a 20 20 20 20 20 46 69 6c 6c 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 65 | ).......Fill.in.the.following.te |
| 4b2e0 | 6d 70 6c 61 74 65 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 | mplate.to.produce.a.procedure.th |
| 4b300 | 61 74 0a 20 20 20 20 20 65 76 61 6c 75 61 74 65 73 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 75 | at......evaluates.a.polynomial.u |
| 4b320 | 73 69 6e 67 20 48 6f 72 6e 65 72 27 73 20 72 75 6c 65 2e 20 20 41 73 73 75 6d 65 20 74 68 61 74 | sing.Horner's.rule...Assume.that |
| 4b340 | 20 74 68 65 0a 20 20 20 20 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 6f 66 20 74 68 65 20 70 6f | .the......coefficients.of.the.po |
| 4b360 | 6c 79 6e 6f 6d 69 61 6c 20 61 72 65 20 61 72 72 61 6e 67 65 64 20 69 6e 20 61 20 73 65 71 75 65 | lynomial.are.arranged.in.a.seque |
| 4b380 | 6e 63 65 2c 20 66 72 6f 6d 0a 20 20 20 20 20 61 5f 30 20 74 68 72 6f 75 67 68 20 61 5f 6e 2e 0a | nce,.from......a_0.through.a_n.. |
| 4b3a0 | 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 68 6f 72 6e 65 72 2d 65 76 61 6c 20 | ...........(define.(horner-eval. |
| 4b3c0 | 78 20 63 6f 65 66 66 69 63 69 65 6e 74 2d 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 20 | x.coefficient-sequence)......... |
| 4b3e0 | 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 28 6c 61 6d 62 64 61 20 28 74 68 69 73 2d 63 6f | ....(accumulate.(lambda.(this-co |
| 4b400 | 65 66 66 20 68 69 67 68 65 72 2d 74 65 72 6d 73 29 20 3c 3f 3f 3e 29 0a 20 20 20 20 20 20 20 20 | eff.higher-terms).<??>)......... |
| 4b420 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................0............... |
| 4b440 | 20 20 20 20 20 20 20 20 20 20 63 6f 65 66 66 69 63 69 65 6e 74 2d 73 65 71 75 65 6e 63 65 29 29 | ..........coefficient-sequence)) |
| 4b460 | 0a 0a 20 20 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 6f 20 63 6f 6d 70 75 74 65 20 31 | .......For.example,.to.compute.1 |
| 4b480 | 20 2b 20 33 78 20 2b 20 35 78 5e 33 20 2b 20 78 5e 28 35 29 20 61 74 20 78 20 3d 20 32 20 79 6f | .+.3x.+.5x^3.+.x^(5).at.x.=.2.yo |
| 4b4a0 | 75 20 77 6f 75 6c 64 0a 20 20 20 20 20 65 76 61 6c 75 61 74 65 0a 0a 20 20 20 20 20 20 20 20 20 | u.would......evaluate........... |
| 4b4c0 | 20 28 68 6f 72 6e 65 72 2d 65 76 61 6c 20 32 20 28 6c 69 73 74 20 31 20 33 20 30 20 35 20 30 20 | .(horner-eval.2.(list.1.3.0.5.0. |
| 4b4e0 | 31 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 33 35 3a 2a 20 52 65 64 65 66 | 1)).......*Exercise.2.35:*.Redef |
| 4b500 | 69 6e 65 20 60 63 6f 75 6e 74 2d 6c 65 61 76 65 73 27 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 | ine.`count-leaves'.from.section. |
| 4b520 | 2a 4e 6f 74 65 0a 20 20 20 20 20 32 2d 32 2d 32 3a 3a 20 61 73 20 61 6e 20 61 63 63 75 6d 75 6c | *Note......2-2-2::.as.an.accumul |
| 4b540 | 61 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 75 6e 74 | ation:............(define.(count |
| 4b560 | 2d 6c 65 61 76 65 73 20 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 | -leaves.t).............(accumula |
| 4b580 | 74 65 20 3c 3f 3f 3e 20 3c 3f 3f 3e 20 28 6d 61 70 20 3c 3f 3f 3e 20 3c 3f 3f 3e 29 29 29 0a 0a | te.<??>.<??>.(map.<??>.<??>))).. |
| 4b5a0 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 33 36 3a 2a 20 54 68 65 20 70 72 6f 63 65 64 | .....*Exercise.2.36:*.The.proced |
| 4b5c0 | 75 72 65 20 60 61 63 63 75 6d 75 6c 61 74 65 2d 6e 27 20 69 73 20 73 69 6d 69 6c 61 72 20 74 6f | ure.`accumulate-n'.is.similar.to |
| 4b5e0 | 0a 20 20 20 20 20 60 61 63 63 75 6d 75 6c 61 74 65 27 20 65 78 63 65 70 74 20 74 68 61 74 20 69 | ......`accumulate'.except.that.i |
| 4b600 | 74 20 74 61 6b 65 73 20 61 73 20 69 74 73 20 74 68 69 72 64 20 61 72 67 75 6d 65 6e 74 20 61 20 | t.takes.as.its.third.argument.a. |
| 4b620 | 73 65 71 75 65 6e 63 65 0a 20 20 20 20 20 6f 66 20 73 65 71 75 65 6e 63 65 73 2c 20 77 68 69 63 | sequence......of.sequences,.whic |
| 4b640 | 68 20 61 72 65 20 61 6c 6c 20 61 73 73 75 6d 65 64 20 74 6f 20 68 61 76 65 20 74 68 65 20 73 61 | h.are.all.assumed.to.have.the.sa |
| 4b660 | 6d 65 20 6e 75 6d 62 65 72 20 6f 66 0a 20 20 20 20 20 65 6c 65 6d 65 6e 74 73 2e 20 20 49 74 20 | me.number.of......elements...It. |
| 4b680 | 61 70 70 6c 69 65 73 20 74 68 65 20 64 65 73 69 67 6e 61 74 65 64 20 61 63 63 75 6d 75 6c 61 74 | applies.the.designated.accumulat |
| 4b6a0 | 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 74 6f 0a 20 20 20 20 20 63 6f 6d 62 69 6e 65 20 61 6c | ion.procedure.to......combine.al |
| 4b6c0 | 6c 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 73 65 71 75 | l.the.first.elements.of.the.sequ |
| 4b6e0 | 65 6e 63 65 73 2c 20 61 6c 6c 20 74 68 65 20 73 65 63 6f 6e 64 0a 20 20 20 20 20 65 6c 65 6d 65 | ences,.all.the.second......eleme |
| 4b700 | 6e 74 73 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 73 2c 20 61 6e 64 20 73 6f 20 6f 6e 2c | nts.of.the.sequences,.and.so.on, |
| 4b720 | 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 20 20 20 20 20 | .and.returns.a.sequence.of...... |
| 4b740 | 74 68 65 20 72 65 73 75 6c 74 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 66 20 60 | the.results...For.instance,.if.` |
| 4b760 | 73 27 20 69 73 20 61 20 73 65 71 75 65 6e 63 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 66 6f 75 72 | s'.is.a.sequence.containing.four |
| 4b780 | 0a 20 20 20 20 20 73 65 71 75 65 6e 63 65 73 2c 20 60 28 28 31 20 32 20 33 29 20 28 34 20 35 20 | ......sequences,.`((1.2.3).(4.5. |
| 4b7a0 | 36 29 20 28 37 20 38 20 39 29 20 28 31 30 20 31 31 20 31 32 29 29 2c 27 20 74 68 65 6e 20 74 68 | 6).(7.8.9).(10.11.12)),'.then.th |
| 4b7c0 | 65 20 76 61 6c 75 65 0a 20 20 20 20 20 6f 66 20 60 28 61 63 63 75 6d 75 6c 61 74 65 2d 6e 20 2b | e.value......of.`(accumulate-n.+ |
| 4b7e0 | 20 30 20 73 29 27 20 73 68 6f 75 6c 64 20 62 65 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 60 28 | .0.s)'.should.be.the.sequence.`( |
| 4b800 | 32 32 20 32 36 20 33 30 29 27 2e 0a 20 20 20 20 20 46 69 6c 6c 20 69 6e 20 74 68 65 20 6d 69 73 | 22.26.30)'.......Fill.in.the.mis |
| 4b820 | 73 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e | sing.expressions.in.the.followin |
| 4b840 | 67 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 61 63 63 75 6d 75 6c 61 74 65 | g.definition.of......`accumulate |
| 4b860 | 2d 6e 27 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 63 63 75 6d 75 6c | -n':............(define.(accumul |
| 4b880 | 61 74 65 2d 6e 20 6f 70 20 69 6e 69 74 20 73 65 71 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ate-n.op.init.seqs)............. |
| 4b8a0 | 28 69 66 20 28 6e 75 6c 6c 3f 20 28 63 61 72 20 73 65 71 73 29 29 0a 20 20 20 20 20 20 20 20 20 | (if.(null?.(car.seqs)).......... |
| 4b8c0 | 20 20 20 20 20 20 20 6e 69 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 | .......nil.................(cons |
| 4b8e0 | 20 28 61 63 63 75 6d 75 6c 61 74 65 20 6f 70 20 69 6e 69 74 20 3c 3f 3f 3e 29 0a 20 20 20 20 20 | .(accumulate.op.init.<??>)...... |
| 4b900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 2d 6e 20 6f | .................(accumulate-n.o |
| 4b920 | 70 20 69 6e 69 74 20 3c 3f 3f 3e 29 29 29 29 0a 0a 45 78 65 72 63 69 73 65 20 32 2e 33 37 0a 2e | p.init.<??>))))..Exercise.2.37.. |
| 4b940 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 53 75 70 70 6f 73 65 20 77 65 20 72 65 70 72 65 73 65 | ..............Suppose.we.represe |
| 4b960 | 6e 74 20 76 65 63 74 6f 72 73 20 76 20 3d 20 28 76 5f 69 29 20 61 73 20 73 65 71 75 65 6e 63 65 | nt.vectors.v.=.(v_i).as.sequence |
| 4b980 | 73 20 6f 66 20 6e 75 6d 62 65 72 73 2c 20 61 6e 64 0a 6d 61 74 72 69 63 65 73 20 6d 20 3d 20 28 | s.of.numbers,.and.matrices.m.=.( |
| 4b9a0 | 6d 5f 28 69 6a 29 29 20 61 73 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 76 65 63 74 6f 72 73 20 | m_(ij)).as.sequences.of.vectors. |
| 4b9c0 | 28 74 68 65 20 72 6f 77 73 20 6f 66 20 74 68 65 20 6d 61 74 72 69 78 29 2e 0a 46 6f 72 20 65 78 | (the.rows.of.the.matrix)..For.ex |
| 4b9e0 | 61 6d 70 6c 65 2c 20 74 68 65 20 6d 61 74 72 69 78 0a 0a 20 20 20 20 20 2b 2d 20 20 20 20 20 20 | ample,.the.matrix.......+-...... |
| 4ba00 | 20 20 20 2d 2b 0a 20 20 20 20 20 7c 20 20 31 20 32 20 33 20 34 20 20 7c 0a 20 20 20 20 20 7c 20 | ...-+......|..1.2.3.4..|......|. |
| 4ba20 | 20 34 20 35 20 36 20 36 20 20 7c 0a 20 20 20 20 20 7c 20 20 36 20 37 20 38 20 39 20 20 7c 0a 20 | .4.5.6.6..|......|..6.7.8.9..|.. |
| 4ba40 | 20 20 20 20 2b 2d 20 20 20 20 20 20 20 20 20 2d 2b 0a 0a 69 73 20 72 65 70 72 65 73 65 6e 74 65 | ....+-.........-+..is.represente |
| 4ba60 | 64 20 61 73 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 60 28 28 31 20 32 20 33 20 34 29 20 28 34 | d.as.the.sequence.`((1.2.3.4).(4 |
| 4ba80 | 20 35 20 36 20 36 29 20 28 36 20 37 20 38 20 39 29 29 27 2e 20 20 57 69 74 68 0a 74 68 69 73 20 | .5.6.6).(6.7.8.9))'...With.this. |
| 4baa0 | 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c 20 77 65 20 63 61 6e 20 75 73 65 20 73 65 71 75 65 | representation,.we.can.use.seque |
| 4bac0 | 6e 63 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 6f 20 63 6f 6e 63 69 73 65 6c 79 0a 65 78 70 72 | nce.operations.to.concisely.expr |
| 4bae0 | 65 73 73 20 74 68 65 20 62 61 73 69 63 20 6d 61 74 72 69 78 20 61 6e 64 20 76 65 63 74 6f 72 20 | ess.the.basic.matrix.and.vector. |
| 4bb00 | 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 54 68 65 73 65 20 6f 70 65 72 61 74 69 6f 6e 73 0a 28 77 | operations...These.operations.(w |
| 4bb20 | 68 69 63 68 20 61 72 65 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 61 6e 79 20 62 6f 6f 6b 20 6f | hich.are.described.in.any.book.o |
| 4bb40 | 6e 20 6d 61 74 72 69 78 20 61 6c 67 65 62 72 61 29 20 61 72 65 20 74 68 65 20 66 6f 6c 6c 6f 77 | n.matrix.algebra).are.the.follow |
| 4bb60 | 69 6e 67 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ing:............................ |
| 4bb80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 0a 20 20 20 20 20 28 64 6f 74 2d 70 | ..................__......(dot-p |
| 4bba0 | 72 6f 64 75 63 74 20 76 20 77 29 20 20 20 20 20 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 75 6d | roduct.v.w)......returns.the.sum |
| 4bbc0 | 20 3e 5f 69 20 76 5f 69 20 77 5f 69 0a 0a 20 20 20 20 20 28 6d 61 74 72 69 78 2d 2a 2d 76 65 63 | .>_i.v_i.w_i.......(matrix-*-vec |
| 4bbe0 | 74 6f 72 20 6d 20 76 29 20 20 72 65 74 75 72 6e 73 20 74 68 65 20 76 65 63 74 6f 72 20 74 2c 0a | tor.m.v)..returns.the.vector.t,. |
| 4bc00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 4bc20 | 20 20 20 20 20 20 20 20 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........__...................... |
| 4bc40 | 20 20 20 20 20 20 20 77 68 65 72 65 20 74 5f 69 20 3d 20 3e 5f 6a 20 6d 5f 28 69 6a 29 20 76 5f | .......where.t_i.=.>_j.m_(ij).v_ |
| 4bc60 | 6a 0a 0a 20 20 20 20 20 28 6d 61 74 72 69 78 2d 2a 2d 6d 61 74 72 69 78 20 6d 20 6e 29 20 20 72 | j.......(matrix-*-matrix.m.n)..r |
| 4bc80 | 65 74 75 72 6e 73 20 74 68 65 20 6d 61 74 72 69 78 20 70 2c 0a 20 20 20 20 20 20 20 20 20 20 20 | eturns.the.matrix.p,............ |
| 4bca0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 4bcc0 | 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 77 | __.............................w |
| 4bce0 | 68 65 72 65 20 70 5f 28 69 6a 29 20 3d 20 3e 5f 6b 20 6d 5f 28 69 6b 29 20 6e 5f 28 6b 6a 29 0a | here.p_(ij).=.>_k.m_(ik).n_(kj). |
| 4bd00 | 0a 20 20 20 20 20 28 74 72 61 6e 73 70 6f 73 65 20 6d 29 20 20 20 20 20 20 20 20 20 20 72 65 74 | ......(transpose.m)..........ret |
| 4bd20 | 75 72 6e 73 20 74 68 65 20 6d 61 74 72 69 78 20 6e 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | urns.the.matrix.n,.............. |
| 4bd40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 77 68 65 72 65 20 6e 5f 28 69 6a 29 20 3d 20 6d 5f | ...............where.n_(ij).=.m_ |
| 4bd60 | 28 6a 69 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 64 65 66 69 6e 65 20 74 68 65 20 64 6f 74 20 70 | (ji).....We.can.define.the.dot.p |
| 4bd80 | 72 6f 64 75 63 74 20 61 73 28 34 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 6f 74 2d | roduct.as(4).......(define.(dot- |
| 4bda0 | 70 72 6f 64 75 63 74 20 76 20 77 29 0a 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 | product.v.w)........(accumulate. |
| 4bdc0 | 2b 20 30 20 28 6d 61 70 20 2a 20 76 20 77 29 29 29 0a 0a 20 20 20 46 69 6c 6c 20 69 6e 20 74 68 | +.0.(map.*.v.w))).....Fill.in.th |
| 4bde0 | 65 20 6d 69 73 73 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 66 6f 6c | e.missing.expressions.in.the.fol |
| 4be00 | 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 0a 63 6f 6d 70 75 74 69 6e 67 20 | lowing.procedures.for.computing. |
| 4be20 | 74 68 65 20 6f 74 68 65 72 20 6d 61 74 72 69 78 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 28 54 | the.other.matrix.operations...(T |
| 4be40 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 61 63 63 75 6d 75 6c 61 74 65 2d 6e 27 0a 69 73 20 64 | he.procedure.`accumulate-n'.is.d |
| 4be60 | 65 66 69 6e 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 33 36 3a 3a 2e | efined.in.*Note.Exercise.2-36::. |
| 4be80 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 74 72 69 78 2d 2a 2d 76 65 63 74 6f 72 | ).......(define.(matrix-*-vector |
| 4bea0 | 20 6d 20 76 29 0a 20 20 20 20 20 20 20 28 6d 61 70 20 3c 3f 3f 3e 20 6d 29 29 0a 0a 20 20 20 20 | .m.v)........(map.<??>.m))...... |
| 4bec0 | 20 28 64 65 66 69 6e 65 20 28 74 72 61 6e 73 70 6f 73 65 20 6d 61 74 29 0a 20 20 20 20 20 20 20 | .(define.(transpose.mat)........ |
| 4bee0 | 28 61 63 63 75 6d 75 6c 61 74 65 2d 6e 20 3c 3f 3f 3e 20 3c 3f 3f 3e 20 6d 61 74 29 29 0a 0a 20 | (accumulate-n.<??>.<??>.mat))... |
| 4bf00 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 74 72 69 78 2d 2a 2d 6d 61 74 72 69 78 20 6d 20 6e | ....(define.(matrix-*-matrix.m.n |
| 4bf20 | 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 6f 6c 73 20 28 74 72 61 6e 73 70 6f 73 65 20 | )........(let.((cols.(transpose. |
| 4bf40 | 6e 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 3c 3f 3f 3e 20 6d 29 29 29 0a 0a 20 20 | n)))..........(map.<??>.m))).... |
| 4bf60 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 33 38 3a 2a 20 54 68 65 20 60 61 63 63 75 6d 75 6c | ...*Exercise.2.38:*.The.`accumul |
| 4bf80 | 61 74 65 27 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 61 6c 73 6f 20 6b 6e 6f 77 6e 20 61 73 0a | ate'.procedure.is.also.known.as. |
| 4bfa0 | 20 20 20 20 20 60 66 6f 6c 64 2d 72 69 67 68 74 27 2c 20 62 65 63 61 75 73 65 20 69 74 20 63 6f | .....`fold-right',.because.it.co |
| 4bfc0 | 6d 62 69 6e 65 73 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 0a | mbines.the.first.element.of.the. |
| 4bfe0 | 20 20 20 20 20 73 65 71 75 65 6e 63 65 20 77 69 74 68 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 | .....sequence.with.the.result.of |
| 4c000 | 20 63 6f 6d 62 69 6e 69 6e 67 20 61 6c 6c 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 74 6f 20 74 | .combining.all.the.elements.to.t |
| 4c020 | 68 65 0a 20 20 20 20 20 72 69 67 68 74 2e 20 20 54 68 65 72 65 20 69 73 20 61 6c 73 6f 20 61 20 | he......right...There.is.also.a. |
| 4c040 | 60 66 6f 6c 64 2d 6c 65 66 74 27 2c 20 77 68 69 63 68 20 69 73 20 73 69 6d 69 6c 61 72 20 74 6f | `fold-left',.which.is.similar.to |
| 4c060 | 0a 20 20 20 20 20 60 66 6f 6c 64 2d 72 69 67 68 74 27 2c 20 65 78 63 65 70 74 20 74 68 61 74 20 | ......`fold-right',.except.that. |
| 4c080 | 69 74 20 63 6f 6d 62 69 6e 65 73 20 65 6c 65 6d 65 6e 74 73 20 77 6f 72 6b 69 6e 67 20 69 6e 20 | it.combines.elements.working.in. |
| 4c0a0 | 74 68 65 0a 20 20 20 20 20 6f 70 70 6f 73 69 74 65 20 64 69 72 65 63 74 69 6f 6e 3a 0a 0a 20 20 | the......opposite.direction:.... |
| 4c0c0 | 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6f 6c 64 2d 6c 65 66 74 20 6f 70 20 69 6e | ........(define.(fold-left.op.in |
| 4c0e0 | 69 74 69 61 6c 20 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | itial.sequence).............(def |
| 4c100 | 69 6e 65 20 28 69 74 65 72 20 72 65 73 75 6c 74 20 72 65 73 74 29 0a 20 20 20 20 20 20 20 20 20 | ine.(iter.result.rest).......... |
| 4c120 | 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 | .....(if.(null?.rest)........... |
| 4c140 | 20 20 20 20 20 20 20 20 72 65 73 75 6c 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........result.................. |
| 4c160 | 20 28 69 74 65 72 20 28 6f 70 20 72 65 73 75 6c 74 20 28 63 61 72 20 72 65 73 74 29 29 0a 20 20 | .(iter.(op.result.(car.rest))... |
| 4c180 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 72 65 73 74 29 | ......................(cdr.rest) |
| 4c1a0 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 69 6e 69 74 69 61 6c 20 73 65 | ))).............(iter.initial.se |
| 4c1c0 | 71 75 65 6e 63 65 29 29 0a 0a 20 20 20 20 20 57 68 61 74 20 61 72 65 20 74 68 65 20 76 61 6c 75 | quence)).......What.are.the.valu |
| 4c1e0 | 65 73 20 6f 66 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 6f 6c 64 2d 72 69 67 68 74 20 2f 20 31 | es.of............(fold-right./.1 |
| 4c200 | 20 28 6c 69 73 74 20 31 20 32 20 33 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 6f 6c 64 2d | .(list.1.2.3))............(fold- |
| 4c220 | 6c 65 66 74 20 2f 20 31 20 28 6c 69 73 74 20 31 20 32 20 33 29 29 0a 0a 20 20 20 20 20 20 20 20 | left./.1.(list.1.2.3)).......... |
| 4c240 | 20 20 28 66 6f 6c 64 2d 72 69 67 68 74 20 6c 69 73 74 20 6e 69 6c 20 28 6c 69 73 74 20 31 20 32 | ..(fold-right.list.nil.(list.1.2 |
| 4c260 | 20 33 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 6f 6c 64 2d 6c 65 66 74 20 6c 69 73 74 20 | .3))............(fold-left.list. |
| 4c280 | 6e 69 6c 20 28 6c 69 73 74 20 31 20 32 20 33 29 29 0a 0a 20 20 20 20 20 47 69 76 65 20 61 20 70 | nil.(list.1.2.3)).......Give.a.p |
| 4c2a0 | 72 6f 70 65 72 74 79 20 74 68 61 74 20 60 6f 70 27 20 73 68 6f 75 6c 64 20 73 61 74 69 73 66 79 | roperty.that.`op'.should.satisfy |
| 4c2c0 | 20 74 6f 20 67 75 61 72 61 6e 74 65 65 20 74 68 61 74 0a 20 20 20 20 20 60 66 6f 6c 64 2d 72 69 | .to.guarantee.that......`fold-ri |
| 4c2e0 | 67 68 74 27 20 61 6e 64 20 60 66 6f 6c 64 2d 6c 65 66 74 27 20 77 69 6c 6c 20 70 72 6f 64 75 63 | ght'.and.`fold-left'.will.produc |
| 4c300 | 65 20 74 68 65 20 73 61 6d 65 20 76 61 6c 75 65 73 20 66 6f 72 20 61 6e 79 0a 20 20 20 20 20 73 | e.the.same.values.for.any......s |
| 4c320 | 65 71 75 65 6e 63 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 33 39 3a 2a 20 | equence........*Exercise.2.39:*. |
| 4c340 | 43 6f 6d 70 6c 65 74 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f | Complete.the.following.definitio |
| 4c360 | 6e 73 20 6f 66 20 60 72 65 76 65 72 73 65 27 0a 20 20 20 20 20 28 2a 4e 6f 74 65 20 45 78 65 72 | ns.of.`reverse'......(*Note.Exer |
| 4c380 | 63 69 73 65 20 32 2d 31 38 3a 3a 29 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 60 66 6f 6c 64 2d 72 | cise.2-18::).in.terms.of.`fold-r |
| 4c3a0 | 69 67 68 74 27 20 61 6e 64 20 60 66 6f 6c 64 2d 6c 65 66 74 27 0a 20 20 20 20 20 66 72 6f 6d 20 | ight'.and.`fold-left'......from. |
| 4c3c0 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 33 38 3a 3a 3a 0a 0a 20 20 20 20 20 20 20 20 | *Note.Exercise.2-38:::.......... |
| 4c3e0 | 20 20 28 64 65 66 69 6e 65 20 28 72 65 76 65 72 73 65 20 73 65 71 75 65 6e 63 65 29 0a 20 20 20 | ..(define.(reverse.sequence).... |
| 4c400 | 20 20 20 20 20 20 20 20 20 28 66 6f 6c 64 2d 72 69 67 68 74 20 28 6c 61 6d 62 64 61 20 28 78 20 | .........(fold-right.(lambda.(x. |
| 4c420 | 79 29 20 3c 3f 3f 3e 29 20 6e 69 6c 20 73 65 71 75 65 6e 63 65 29 29 0a 0a 20 20 20 20 20 20 20 | y).<??>).nil.sequence))......... |
| 4c440 | 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 76 65 72 73 65 20 73 65 71 75 65 6e 63 65 29 0a 20 20 | ...(define.(reverse.sequence)... |
| 4c460 | 20 20 20 20 20 20 20 20 20 20 28 66 6f 6c 64 2d 6c 65 66 74 20 28 6c 61 6d 62 64 61 20 28 78 20 | ..........(fold-left.(lambda.(x. |
| 4c480 | 79 29 20 3c 3f 3f 3e 29 20 6e 69 6c 20 73 65 71 75 65 6e 63 65 29 29 0a 0a 4e 65 73 74 65 64 20 | y).<??>).nil.sequence))..Nested. |
| 4c4a0 | 4d 61 70 70 69 6e 67 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 20 63 61 6e | Mappings..................We.can |
| 4c4c0 | 20 65 78 74 65 6e 64 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 70 61 72 61 64 69 67 6d 20 74 6f | .extend.the.sequence.paradigm.to |
| 4c4e0 | 20 69 6e 63 6c 75 64 65 20 6d 61 6e 79 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 20 74 68 61 74 0a | .include.many.computations.that. |
| 4c500 | 61 72 65 20 63 6f 6d 6d 6f 6e 6c 79 20 65 78 70 72 65 73 73 65 64 20 75 73 69 6e 67 20 6e 65 73 | are.commonly.expressed.using.nes |
| 4c520 | 74 65 64 20 6c 6f 6f 70 73 2e 28 35 29 20 43 6f 6e 73 69 64 65 72 20 74 68 69 73 20 70 72 6f 62 | ted.loops.(5).Consider.this.prob |
| 4c540 | 6c 65 6d 3a 0a 47 69 76 65 6e 20 61 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 20 6e 2c | lem:.Given.a.positive.integer.n, |
| 4c560 | 20 66 69 6e 64 20 61 6c 6c 20 6f 72 64 65 72 65 64 20 70 61 69 72 73 20 6f 66 20 64 69 73 74 69 | .find.all.ordered.pairs.of.disti |
| 4c580 | 6e 63 74 20 70 6f 73 69 74 69 76 65 0a 69 6e 74 65 67 65 72 73 20 69 20 61 6e 64 20 6a 2c 20 77 | nct.positive.integers.i.and.j,.w |
| 4c5a0 | 68 65 72 65 20 31 20 3c 3d 20 6a 3c 20 69 3c 3d 20 6e 2c 20 73 75 63 68 20 74 68 61 74 20 69 20 | here.1.<=.j<.i<=.n,.such.that.i. |
| 4c5c0 | 2b 20 6a 20 69 73 20 70 72 69 6d 65 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 69 66 20 6e | +.j.is.prime...For.example,.if.n |
| 4c5e0 | 20 69 73 20 36 2c 20 74 68 65 6e 20 74 68 65 20 70 61 69 72 73 20 61 72 65 20 74 68 65 20 66 6f | .is.6,.then.the.pairs.are.the.fo |
| 4c600 | 6c 6c 6f 77 69 6e 67 3a 0a 0a 20 20 20 20 20 20 20 69 20 20 20 7c 20 32 20 33 20 34 20 34 20 35 | llowing:.........i...|.2.3.4.4.5 |
| 4c620 | 20 36 20 36 0a 20 20 20 20 20 20 20 6a 20 20 20 7c 20 31 20 32 20 31 20 33 20 32 20 31 20 35 0a | .6.6........j...|.1.2.1.3.2.1.5. |
| 4c640 | 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 | .....------+---------------..... |
| 4c660 | 20 69 20 2b 20 6a 20 7c 20 33 20 35 20 35 20 37 20 37 20 37 20 31 31 0a 0a 20 20 20 41 20 6e 61 | .i.+.j.|.3.5.5.7.7.7.11.....A.na |
| 4c680 | 74 75 72 61 6c 20 77 61 79 20 74 6f 20 6f 72 67 61 6e 69 7a 65 20 74 68 69 73 20 63 6f 6d 70 75 | tural.way.to.organize.this.compu |
| 4c6a0 | 74 61 74 69 6f 6e 20 69 73 20 74 6f 20 67 65 6e 65 72 61 74 65 20 74 68 65 0a 73 65 71 75 65 6e | tation.is.to.generate.the.sequen |
| 4c6c0 | 63 65 20 6f 66 20 61 6c 6c 20 6f 72 64 65 72 65 64 20 70 61 69 72 73 20 6f 66 20 70 6f 73 69 74 | ce.of.all.ordered.pairs.of.posit |
| 4c6e0 | 69 76 65 20 69 6e 74 65 67 65 72 73 20 6c 65 73 73 20 74 68 61 6e 20 6f 72 20 65 71 75 61 6c 0a | ive.integers.less.than.or.equal. |
| 4c700 | 74 6f 20 6e 2c 20 66 69 6c 74 65 72 20 74 6f 20 73 65 6c 65 63 74 20 74 68 6f 73 65 20 70 61 69 | to.n,.filter.to.select.those.pai |
| 4c720 | 72 73 20 77 68 6f 73 65 20 73 75 6d 20 69 73 20 70 72 69 6d 65 2c 20 61 6e 64 20 74 68 65 6e 2c | rs.whose.sum.is.prime,.and.then, |
| 4c740 | 20 66 6f 72 0a 65 61 63 68 20 70 61 69 72 20 28 69 2c 20 6a 29 20 74 68 61 74 20 70 61 73 73 65 | .for.each.pair.(i,.j).that.passe |
| 4c760 | 73 20 74 68 72 6f 75 67 68 20 74 68 65 20 66 69 6c 74 65 72 2c 20 70 72 6f 64 75 63 65 20 74 68 | s.through.the.filter,.produce.th |
| 4c780 | 65 20 74 72 69 70 6c 65 0a 28 69 2c 6a 2c 69 20 2b 20 6a 29 2e 0a 0a 20 20 20 48 65 72 65 20 69 | e.triple.(i,j,i.+.j)......Here.i |
| 4c7a0 | 73 20 61 20 77 61 79 20 74 6f 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 73 65 71 75 65 6e 63 65 | s.a.way.to.generate.the.sequence |
| 4c7c0 | 20 6f 66 20 70 61 69 72 73 3a 20 46 6f 72 20 65 61 63 68 20 69 6e 74 65 67 65 72 20 69 0a 3c 3d | .of.pairs:.For.each.integer.i.<= |
| 4c7e0 | 20 6e 2c 20 65 6e 75 6d 65 72 61 74 65 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 6a 3c 69 2c 20 | .n,.enumerate.the.integers.j<i,. |
| 4c800 | 61 6e 64 20 66 6f 72 20 65 61 63 68 20 73 75 63 68 20 69 20 61 6e 64 20 6a 20 67 65 6e 65 72 61 | and.for.each.such.i.and.j.genera |
| 4c820 | 74 65 0a 74 68 65 20 70 61 69 72 20 28 69 2c 6a 29 2e 20 20 49 6e 20 74 65 72 6d 73 20 6f 66 20 | te.the.pair.(i,j)...In.terms.of. |
| 4c840 | 73 65 71 75 65 6e 63 65 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 77 65 20 6d 61 70 20 61 6c 6f 6e | sequence.operations,.we.map.alon |
| 4c860 | 67 20 74 68 65 0a 73 65 71 75 65 6e 63 65 20 60 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 | g.the.sequence.`(enumerate-inter |
| 4c880 | 76 61 6c 20 31 20 6e 29 27 2e 20 20 46 6f 72 20 65 61 63 68 20 69 20 69 6e 20 74 68 69 73 20 73 | val.1.n)'...For.each.i.in.this.s |
| 4c8a0 | 65 71 75 65 6e 63 65 2c 20 77 65 0a 6d 61 70 20 61 6c 6f 6e 67 20 74 68 65 20 73 65 71 75 65 6e | equence,.we.map.along.the.sequen |
| 4c8c0 | 63 65 20 60 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 31 20 28 2d 20 69 20 31 | ce.`(enumerate-interval.1.(-.i.1 |
| 4c8e0 | 29 29 27 2e 20 20 46 6f 72 20 65 61 63 68 20 6a 20 69 6e 0a 74 68 69 73 20 6c 61 74 74 65 72 20 | ))'...For.each.j.in.this.latter. |
| 4c900 | 73 65 71 75 65 6e 63 65 2c 20 77 65 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 70 61 69 72 20 60 | sequence,.we.generate.the.pair.` |
| 4c920 | 28 6c 69 73 74 20 69 20 6a 29 27 2e 20 20 54 68 69 73 20 67 69 76 65 73 20 75 73 0a 61 20 73 65 | (list.i.j)'...This.gives.us.a.se |
| 4c940 | 71 75 65 6e 63 65 20 6f 66 20 70 61 69 72 73 20 66 6f 72 20 65 61 63 68 20 69 2e 20 20 43 6f 6d | quence.of.pairs.for.each.i...Com |
| 4c960 | 62 69 6e 69 6e 67 20 61 6c 6c 20 74 68 65 20 73 65 71 75 65 6e 63 65 73 20 66 6f 72 20 61 6c 6c | bining.all.the.sequences.for.all |
| 4c980 | 0a 74 68 65 20 69 20 28 62 79 20 61 63 63 75 6d 75 6c 61 74 69 6e 67 20 77 69 74 68 20 60 61 70 | .the.i.(by.accumulating.with.`ap |
| 4c9a0 | 70 65 6e 64 27 29 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 72 65 71 75 69 72 65 64 20 73 65 71 | pend').produces.the.required.seq |
| 4c9c0 | 75 65 6e 63 65 20 6f 66 0a 70 61 69 72 73 3a 28 36 29 0a 0a 20 20 20 20 20 28 61 63 63 75 6d 75 | uence.of.pairs:(6).......(accumu |
| 4c9e0 | 6c 61 74 65 20 61 70 70 65 6e 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 69 6c | late.append..................nil |
| 4ca00 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 | ..................(map.(lambda.( |
| 4ca20 | 69 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 | i).........................(map. |
| 4ca40 | 28 6c 61 6d 62 64 61 20 28 6a 29 20 28 6c 69 73 74 20 69 20 6a 29 29 0a 20 20 20 20 20 20 20 20 | (lambda.(j).(list.i.j))......... |
| 4ca60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d | .....................(enumerate- |
| 4ca80 | 69 6e 74 65 72 76 61 6c 20 31 20 28 2d 20 69 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | interval.1.(-.i.1))))........... |
| 4caa0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 | ............(enumerate-interval. |
| 4cac0 | 31 20 6e 29 29 29 0a 0a 20 20 20 54 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 6d 61 | 1.n))).....The.combination.of.ma |
| 4cae0 | 70 70 69 6e 67 20 61 6e 64 20 61 63 63 75 6d 75 6c 61 74 69 6e 67 20 77 69 74 68 20 60 61 70 70 | pping.and.accumulating.with.`app |
| 4cb00 | 65 6e 64 27 20 69 73 20 73 6f 0a 63 6f 6d 6d 6f 6e 20 69 6e 20 74 68 69 73 20 73 6f 72 74 20 6f | end'.is.so.common.in.this.sort.o |
| 4cb20 | 66 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 77 65 20 77 69 6c 6c 20 69 73 6f 6c 61 74 65 20 69 | f.program.that.we.will.isolate.i |
| 4cb40 | 74 20 61 73 20 61 20 73 65 70 61 72 61 74 65 0a 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 | t.as.a.separate.procedure:...... |
| 4cb60 | 20 28 64 65 66 69 6e 65 20 28 66 6c 61 74 6d 61 70 20 70 72 6f 63 20 73 65 71 29 0a 20 20 20 20 | .(define.(flatmap.proc.seq)..... |
| 4cb80 | 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 61 70 70 65 6e 64 20 6e 69 6c 20 28 6d 61 70 20 70 | ...(accumulate.append.nil.(map.p |
| 4cba0 | 72 6f 63 20 73 65 71 29 29 29 0a 0a 20 20 20 4e 6f 77 20 66 69 6c 74 65 72 20 74 68 69 73 20 73 | roc.seq))).....Now.filter.this.s |
| 4cbc0 | 65 71 75 65 6e 63 65 20 6f 66 20 70 61 69 72 73 20 74 6f 20 66 69 6e 64 20 74 68 6f 73 65 20 77 | equence.of.pairs.to.find.those.w |
| 4cbe0 | 68 6f 73 65 20 73 75 6d 20 69 73 20 70 72 69 6d 65 2e 0a 54 68 65 20 66 69 6c 74 65 72 20 70 72 | hose.sum.is.prime..The.filter.pr |
| 4cc00 | 65 64 69 63 61 74 65 20 69 73 20 63 61 6c 6c 65 64 20 66 6f 72 20 65 61 63 68 20 65 6c 65 6d 65 | edicate.is.called.for.each.eleme |
| 4cc20 | 6e 74 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 3b 20 69 74 73 0a 61 72 67 75 6d 65 6e 74 | nt.of.the.sequence;.its.argument |
| 4cc40 | 20 69 73 20 61 20 70 61 69 72 20 61 6e 64 20 69 74 20 6d 75 73 74 20 65 78 74 72 61 63 74 20 74 | .is.a.pair.and.it.must.extract.t |
| 4cc60 | 68 65 20 69 6e 74 65 67 65 72 73 20 66 72 6f 6d 20 74 68 65 20 70 61 69 72 2e 0a 54 68 75 73 2c | he.integers.from.the.pair..Thus, |
| 4cc80 | 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 74 6f 20 61 70 70 6c 79 20 74 6f 20 65 61 63 68 20 | .the.predicate.to.apply.to.each. |
| 4cca0 | 65 6c 65 6d 65 6e 74 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 69 73 0a 0a 20 20 20 20 | element.in.the.sequence.is...... |
| 4ccc0 | 20 28 64 65 66 69 6e 65 20 28 70 72 69 6d 65 2d 73 75 6d 3f 20 70 61 69 72 29 0a 20 20 20 20 20 | .(define.(prime-sum?.pair)...... |
| 4cce0 | 20 20 28 70 72 69 6d 65 3f 20 28 2b 20 28 63 61 72 20 70 61 69 72 29 20 28 63 61 64 72 20 70 61 | ..(prime?.(+.(car.pair).(cadr.pa |
| 4cd00 | 69 72 29 29 29 29 0a 0a 20 20 20 46 69 6e 61 6c 6c 79 2c 20 67 65 6e 65 72 61 74 65 20 74 68 65 | ir)))).....Finally,.generate.the |
| 4cd20 | 20 73 65 71 75 65 6e 63 65 20 6f 66 20 72 65 73 75 6c 74 73 20 62 79 20 6d 61 70 70 69 6e 67 20 | .sequence.of.results.by.mapping. |
| 4cd40 | 6f 76 65 72 20 74 68 65 0a 66 69 6c 74 65 72 65 64 20 70 61 69 72 73 20 75 73 69 6e 67 20 74 68 | over.the.filtered.pairs.using.th |
| 4cd60 | 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 63 6f 6e | e.following.procedure,.which.con |
| 4cd80 | 73 74 72 75 63 74 73 20 61 20 74 72 69 70 6c 65 0a 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 74 | structs.a.triple.consisting.of.t |
| 4cda0 | 68 65 20 74 77 6f 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 70 61 69 72 20 61 6c 6f 6e | he.two.elements.of.the.pair.alon |
| 4cdc0 | 67 20 77 69 74 68 20 74 68 65 69 72 20 73 75 6d 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | g.with.their.sum:.......(define. |
| 4cde0 | 28 6d 61 6b 65 2d 70 61 69 72 2d 73 75 6d 20 70 61 69 72 29 0a 20 20 20 20 20 20 20 28 6c 69 73 | (make-pair-sum.pair)........(lis |
| 4ce00 | 74 20 28 63 61 72 20 70 61 69 72 29 20 28 63 61 64 72 20 70 61 69 72 29 20 28 2b 20 28 63 61 72 | t.(car.pair).(cadr.pair).(+.(car |
| 4ce20 | 20 70 61 69 72 29 20 28 63 61 64 72 20 70 61 69 72 29 29 29 29 0a 0a 20 20 20 43 6f 6d 62 69 6e | .pair).(cadr.pair)))).....Combin |
| 4ce40 | 69 6e 67 20 61 6c 6c 20 74 68 65 73 65 20 73 74 65 70 73 20 79 69 65 6c 64 73 20 74 68 65 20 63 | ing.all.these.steps.yields.the.c |
| 4ce60 | 6f 6d 70 6c 65 74 65 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | omplete.procedure:.......(define |
| 4ce80 | 20 28 70 72 69 6d 65 2d 73 75 6d 2d 70 61 69 72 73 20 6e 29 0a 20 20 20 20 20 20 20 28 6d 61 70 | .(prime-sum-pairs.n)........(map |
| 4cea0 | 20 6d 61 6b 65 2d 70 61 69 72 2d 73 75 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 6c 74 | .make-pair-sum.............(filt |
| 4cec0 | 65 72 20 70 72 69 6d 65 2d 73 75 6d 3f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | er.prime-sum?................... |
| 4cee0 | 20 20 28 66 6c 61 74 6d 61 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..(flatmap...................... |
| 4cf00 | 28 6c 61 6d 62 64 61 20 28 69 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (lambda.(i)..................... |
| 4cf20 | 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 6a 29 20 28 6c 69 73 74 20 69 20 6a 29 29 0a | ...(map.(lambda.(j).(list.i.j)). |
| 4cf40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 75 | ............................(enu |
| 4cf60 | 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 31 20 28 2d 20 69 20 31 29 29 29 29 0a 20 20 20 | merate-interval.1.(-.i.1)))).... |
| 4cf80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 | ..................(enumerate-int |
| 4cfa0 | 65 72 76 61 6c 20 31 20 6e 29 29 29 29 29 0a 0a 20 20 20 4e 65 73 74 65 64 20 6d 61 70 70 69 6e | erval.1.n))))).....Nested.mappin |
| 4cfc0 | 67 73 20 61 72 65 20 61 6c 73 6f 20 75 73 65 66 75 6c 20 66 6f 72 20 73 65 71 75 65 6e 63 65 73 | gs.are.also.useful.for.sequences |
| 4cfe0 | 20 6f 74 68 65 72 20 74 68 61 6e 20 74 68 6f 73 65 20 74 68 61 74 0a 65 6e 75 6d 65 72 61 74 65 | .other.than.those.that.enumerate |
| 4d000 | 20 69 6e 74 65 72 76 61 6c 73 2e 20 20 53 75 70 70 6f 73 65 20 77 65 20 77 69 73 68 20 74 6f 20 | .intervals...Suppose.we.wish.to. |
| 4d020 | 67 65 6e 65 72 61 74 65 20 61 6c 6c 20 74 68 65 20 70 65 72 6d 75 74 61 74 69 6f 6e 73 0a 6f 66 | generate.all.the.permutations.of |
| 4d040 | 20 61 20 73 65 74 20 53 3b 20 74 68 61 74 20 69 73 2c 20 61 6c 6c 20 74 68 65 20 77 61 79 73 20 | .a.set.S;.that.is,.all.the.ways. |
| 4d060 | 6f 66 20 6f 72 64 65 72 69 6e 67 20 74 68 65 20 69 74 65 6d 73 20 69 6e 20 74 68 65 20 73 65 74 | of.ordering.the.items.in.the.set |
| 4d080 | 2e 0a 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 68 65 20 70 65 72 6d 75 74 61 74 69 6f 6e 73 | ..For.instance,.the.permutations |
| 4d0a0 | 20 6f 66 20 7b 31 2c 32 2c 33 7d 20 61 72 65 20 7b 31 2c 32 2c 33 7d 2c 20 7b 31 2c 33 2c 32 7d | .of.{1,2,3}.are.{1,2,3},.{1,3,2} |
| 4d0c0 | 2c 0a 7b 32 2c 31 2c 33 7d 2c 20 7b 32 2c 33 2c 31 7d 2c 20 7b 33 2c 31 2c 32 7d 2c 20 61 6e 64 | ,.{2,1,3},.{2,3,1},.{3,1,2},.and |
| 4d0e0 | 20 7b 33 2c 32 2c 31 7d 2e 20 20 48 65 72 65 20 69 73 20 61 20 70 6c 61 6e 20 66 6f 72 20 67 65 | .{3,2,1}...Here.is.a.plan.for.ge |
| 4d100 | 6e 65 72 61 74 69 6e 67 0a 74 68 65 20 70 65 72 6d 75 74 61 74 69 6f 6e 73 20 6f 66 20 53 3a 20 | nerating.the.permutations.of.S:. |
| 4d120 | 46 6f 72 20 65 61 63 68 20 69 74 65 6d 20 78 20 69 6e 20 53 2c 20 72 65 63 75 72 73 69 76 65 6c | For.each.item.x.in.S,.recursivel |
| 4d140 | 79 20 67 65 6e 65 72 61 74 65 20 74 68 65 0a 73 65 71 75 65 6e 63 65 20 6f 66 20 70 65 72 6d 75 | y.generate.the.sequence.of.permu |
| 4d160 | 74 61 74 69 6f 6e 73 20 6f 66 20 53 20 2d 20 78 2c 28 37 29 20 61 6e 64 20 61 64 6a 6f 69 6e 20 | tations.of.S.-.x,(7).and.adjoin. |
| 4d180 | 78 20 74 6f 20 74 68 65 20 66 72 6f 6e 74 20 6f 66 20 65 61 63 68 0a 6f 6e 65 2e 20 20 54 68 69 | x.to.the.front.of.each.one...Thi |
| 4d1a0 | 73 20 79 69 65 6c 64 73 2c 20 66 6f 72 20 65 61 63 68 20 78 20 69 6e 20 53 2c 20 74 68 65 20 73 | s.yields,.for.each.x.in.S,.the.s |
| 4d1c0 | 65 71 75 65 6e 63 65 20 6f 66 20 70 65 72 6d 75 74 61 74 69 6f 6e 73 20 6f 66 20 53 0a 74 68 61 | equence.of.permutations.of.S.tha |
| 4d1e0 | 74 20 62 65 67 69 6e 20 77 69 74 68 20 78 2e 20 20 43 6f 6d 62 69 6e 69 6e 67 20 74 68 65 73 65 | t.begin.with.x...Combining.these |
| 4d200 | 20 73 65 71 75 65 6e 63 65 73 20 66 6f 72 20 61 6c 6c 20 78 20 67 69 76 65 73 20 61 6c 6c 20 74 | .sequences.for.all.x.gives.all.t |
| 4d220 | 68 65 0a 70 65 72 6d 75 74 61 74 69 6f 6e 73 20 6f 66 20 53 3a 28 38 29 0a 0a 20 20 20 20 20 28 | he.permutations.of.S:(8).......( |
| 4d240 | 64 65 66 69 6e 65 20 28 70 65 72 6d 75 74 61 74 69 6f 6e 73 20 73 29 0a 20 20 20 20 20 20 20 28 | define.(permutations.s)........( |
| 4d260 | 69 66 20 28 6e 75 6c 6c 3f 20 73 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | if.(null?.s).................... |
| 4d280 | 3b 20 65 6d 70 74 79 20 73 65 74 3f 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 6e 69 | ;.empty.set?............(list.ni |
| 4d2a0 | 6c 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 73 65 71 75 65 6e 63 65 20 | l)...................;.sequence. |
| 4d2c0 | 63 6f 6e 74 61 69 6e 69 6e 67 20 65 6d 70 74 79 20 73 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 | containing.empty.set............ |
| 4d2e0 | 28 66 6c 61 74 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (flatmap.(lambda.(x)............ |
| 4d300 | 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 70 29 20 28 63 6f 6e | ...........(map.(lambda.(p).(con |
| 4d320 | 73 20 78 20 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | s.x.p))......................... |
| 4d340 | 20 20 20 28 70 65 72 6d 75 74 61 74 69 6f 6e 73 20 28 72 65 6d 6f 76 65 20 78 20 73 29 29 29 29 | ...(permutations.(remove.x.s)))) |
| 4d360 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 29 29 29 0a 0a 20 20 20 4e 6f | .....................s))).....No |
| 4d380 | 74 69 63 65 20 68 6f 77 20 74 68 69 73 20 73 74 72 61 74 65 67 79 20 72 65 64 75 63 65 73 20 74 | tice.how.this.strategy.reduces.t |
| 4d3a0 | 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 67 65 6e 65 72 61 74 69 6e 67 0a 70 65 72 6d 75 74 61 | he.problem.of.generating.permuta |
| 4d3c0 | 74 69 6f 6e 73 20 6f 66 20 53 20 74 6f 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 67 65 6e | tions.of.S.to.the.problem.of.gen |
| 4d3e0 | 65 72 61 74 69 6e 67 20 74 68 65 20 70 65 72 6d 75 74 61 74 69 6f 6e 73 20 6f 66 20 73 65 74 73 | erating.the.permutations.of.sets |
| 4d400 | 0a 77 69 74 68 20 66 65 77 65 72 20 65 6c 65 6d 65 6e 74 73 20 74 68 61 6e 20 53 2e 20 20 49 6e | .with.fewer.elements.than.S...In |
| 4d420 | 20 74 68 65 20 74 65 72 6d 69 6e 61 6c 20 63 61 73 65 2c 20 77 65 20 77 6f 72 6b 20 6f 75 72 20 | .the.terminal.case,.we.work.our. |
| 4d440 | 77 61 79 20 64 6f 77 6e 0a 74 6f 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 2c 20 77 68 69 63 | way.down.to.the.empty.list,.whic |
| 4d460 | 68 20 72 65 70 72 65 73 65 6e 74 73 20 61 20 73 65 74 20 6f 66 20 6e 6f 20 65 6c 65 6d 65 6e 74 | h.represents.a.set.of.no.element |
| 4d480 | 73 2e 20 20 46 6f 72 20 74 68 69 73 2c 20 77 65 0a 67 65 6e 65 72 61 74 65 20 60 28 6c 69 73 74 | s...For.this,.we.generate.`(list |
| 4d4a0 | 20 6e 69 6c 29 27 2c 20 77 68 69 63 68 20 69 73 20 61 20 73 65 71 75 65 6e 63 65 20 77 69 74 68 | .nil)',.which.is.a.sequence.with |
| 4d4c0 | 20 6f 6e 65 20 69 74 65 6d 2c 20 6e 61 6d 65 6c 79 20 74 68 65 0a 73 65 74 20 77 69 74 68 20 6e | .one.item,.namely.the.set.with.n |
| 4d4e0 | 6f 20 65 6c 65 6d 65 6e 74 73 2e 20 20 54 68 65 20 60 72 65 6d 6f 76 65 27 20 70 72 6f 63 65 64 | o.elements...The.`remove'.proced |
| 4d500 | 75 72 65 20 75 73 65 64 20 69 6e 20 60 70 65 72 6d 75 74 61 74 69 6f 6e 73 27 0a 72 65 74 75 72 | ure.used.in.`permutations'.retur |
| 4d520 | 6e 73 20 61 6c 6c 20 74 68 65 20 69 74 65 6d 73 20 69 6e 20 61 20 67 69 76 65 6e 20 73 65 71 75 | ns.all.the.items.in.a.given.sequ |
| 4d540 | 65 6e 63 65 20 65 78 63 65 70 74 20 66 6f 72 20 61 20 67 69 76 65 6e 20 69 74 65 6d 2e 0a 54 68 | ence.except.for.a.given.item..Th |
| 4d560 | 69 73 20 63 61 6e 20 62 65 20 65 78 70 72 65 73 73 65 64 20 61 73 20 61 20 73 69 6d 70 6c 65 20 | is.can.be.expressed.as.a.simple. |
| 4d580 | 66 69 6c 74 65 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 6d 6f 76 65 20 69 74 | filter:.......(define.(remove.it |
| 4d5a0 | 65 6d 20 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 20 28 6c 61 6d | em.sequence)........(filter.(lam |
| 4d5c0 | 62 64 61 20 28 78 29 20 28 6e 6f 74 20 28 3d 20 78 20 69 74 65 6d 29 29 29 0a 20 20 20 20 20 20 | bda.(x).(not.(=.x.item)))....... |
| 4d5e0 | 20 20 20 20 20 20 20 20 20 73 65 71 75 65 6e 63 65 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | .........sequence)).......*Exerc |
| 4d600 | 69 73 65 20 32 2e 34 30 3a 2a 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 75 | ise.2.40:*.Define.a.procedure.`u |
| 4d620 | 6e 69 71 75 65 2d 70 61 69 72 73 27 20 74 68 61 74 2c 20 67 69 76 65 6e 20 61 6e 0a 20 20 20 20 | nique-pairs'.that,.given.an..... |
| 4d640 | 20 69 6e 74 65 67 65 72 20 6e 2c 20 67 65 6e 65 72 61 74 65 73 20 74 68 65 20 73 65 71 75 65 6e | .integer.n,.generates.the.sequen |
| 4d660 | 63 65 20 6f 66 20 70 61 69 72 73 20 28 69 2c 6a 29 20 77 69 74 68 20 31 20 3c 3d 20 6a 3c 20 69 | ce.of.pairs.(i,j).with.1.<=.j<.i |
| 4d680 | 20 3c 3d 0a 20 20 20 20 20 6e 2e 20 20 55 73 65 20 60 75 6e 69 71 75 65 2d 70 61 69 72 73 27 20 | .<=......n...Use.`unique-pairs'. |
| 4d6a0 | 74 6f 20 73 69 6d 70 6c 69 66 79 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 0a 20 20 | to.simplify.the.definition.of... |
| 4d6c0 | 20 20 20 60 70 72 69 6d 65 2d 73 75 6d 2d 70 61 69 72 73 27 20 67 69 76 65 6e 20 61 62 6f 76 65 | ...`prime-sum-pairs'.given.above |
| 4d6e0 | 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 34 31 3a 2a 20 57 72 69 74 65 20 61 | ........*Exercise.2.41:*.Write.a |
| 4d700 | 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 66 69 6e 64 20 61 6c 6c 20 6f 72 64 65 72 65 64 20 74 | .procedure.to.find.all.ordered.t |
| 4d720 | 72 69 70 6c 65 73 20 6f 66 0a 20 20 20 20 20 64 69 73 74 69 6e 63 74 20 70 6f 73 69 74 69 76 65 | riples.of......distinct.positive |
| 4d740 | 20 69 6e 74 65 67 65 72 73 20 69 2c 20 6a 2c 20 61 6e 64 20 6b 20 6c 65 73 73 20 74 68 61 6e 20 | .integers.i,.j,.and.k.less.than. |
| 4d760 | 6f 72 20 65 71 75 61 6c 20 74 6f 20 61 0a 20 20 20 20 20 67 69 76 65 6e 20 69 6e 74 65 67 65 72 | or.equal.to.a......given.integer |
| 4d780 | 20 6e 20 74 68 61 74 20 73 75 6d 20 74 6f 20 61 20 67 69 76 65 6e 20 69 6e 74 65 67 65 72 20 73 | .n.that.sum.to.a.given.integer.s |
| 4d7a0 | 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 38 3a 2a 20 41 20 73 6f 6c 75 74 69 6f 6e | ........*Figure.2.8:*.A.solution |
| 4d7c0 | 20 74 6f 20 74 68 65 20 65 69 67 68 74 2d 71 75 65 65 6e 73 20 70 75 7a 7a 6c 65 2e 0a 0a 20 20 | .to.the.eight-queens.puzzle..... |
| 4d7e0 | 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d | ........+---+---+---+---+---+--- |
| 4d800 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 | +---+---+...........|...|...|... |
| 4d820 | 7c 20 20 20 7c 20 20 20 7c 20 51 20 7c 20 20 20 7c 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | |...|...|.Q.|...|...|........... |
| 4d840 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d | +---+---+---+---+---+---+---+--- |
| 4d860 | 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 51 20 7c 20 20 20 7c 20 20 20 | +...........|...|...|.Q.|...|... |
| 4d880 | 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d | |...|...|...|...........+---+--- |
| 4d8a0 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 | +---+---+---+---+---+---+....... |
| 4d8c0 | 20 20 20 20 7c 20 51 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 | ....|.Q.|...|...|...|...|...|... |
| 4d8e0 | 7c 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d | |...|...........+---+---+---+--- |
| 4d900 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | +---+---+---+---+...........|... |
| 4d920 | 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 51 20 7c 20 20 20 7c 0a 20 20 | |...|...|...|...|...|.Q.|...|... |
| 4d940 | 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d | ........+---+---+---+---+---+--- |
| 4d960 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 | +---+---+...........|...|...|... |
| 4d980 | 7c 20 20 20 7c 20 51 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | |...|.Q.|...|...|...|........... |
| 4d9a0 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d | +---+---+---+---+---+---+---+--- |
| 4d9c0 | 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 | +...........|...|...|...|...|... |
| 4d9e0 | 7c 20 20 20 7c 20 20 20 7c 20 51 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d | |...|...|.Q.|...........+---+--- |
| 4da00 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 | +---+---+---+---+---+---+....... |
| 4da20 | 20 20 20 20 7c 20 20 20 7c 20 51 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 | ....|...|.Q.|...|...|...|...|... |
| 4da40 | 7c 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d | |...|...........+---+---+---+--- |
| 4da60 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | +---+---+---+---+...........|... |
| 4da80 | 7c 20 20 20 7c 20 20 20 7c 20 51 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 0a 20 20 | |...|...|.Q.|...|...|...|...|... |
| 4daa0 | 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d 2b 2d 2d 2d | ........+---+---+---+---+---+--- |
| 4dac0 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 34 32 3a 2a | +---+---+.......*Exercise.2.42:* |
| 4dae0 | 20 54 68 65 20 22 65 69 67 68 74 2d 71 75 65 65 6e 73 20 70 75 7a 7a 6c 65 22 20 61 73 6b 73 20 | .The."eight-queens.puzzle".asks. |
| 4db00 | 68 6f 77 20 74 6f 20 70 6c 61 63 65 20 65 69 67 68 74 0a 20 20 20 20 20 71 75 65 65 6e 73 20 6f | how.to.place.eight......queens.o |
| 4db20 | 6e 20 61 20 63 68 65 73 73 62 6f 61 72 64 20 73 6f 20 74 68 61 74 20 6e 6f 20 71 75 65 65 6e 20 | n.a.chessboard.so.that.no.queen. |
| 4db40 | 69 73 20 69 6e 20 63 68 65 63 6b 20 66 72 6f 6d 20 61 6e 79 20 6f 74 68 65 72 0a 20 20 20 20 20 | is.in.check.from.any.other...... |
| 4db60 | 28 69 2e 65 2e 2c 20 6e 6f 20 74 77 6f 20 71 75 65 65 6e 73 20 61 72 65 20 69 6e 20 74 68 65 20 | (i.e.,.no.two.queens.are.in.the. |
| 4db80 | 73 61 6d 65 20 72 6f 77 2c 20 63 6f 6c 75 6d 6e 2c 20 6f 72 20 64 69 61 67 6f 6e 61 6c 29 2e 0a | same.row,.column,.or.diagonal).. |
| 4dba0 | 20 20 20 20 20 4f 6e 65 20 70 6f 73 73 69 62 6c 65 20 73 6f 6c 75 74 69 6f 6e 20 69 73 20 73 68 | .....One.possible.solution.is.sh |
| 4dbc0 | 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 38 3a 3a 2e 20 20 4f 6e 65 20 | own.in.*Note.Figure.2-8::...One. |
| 4dbe0 | 77 61 79 20 74 6f 0a 20 20 20 20 20 73 6f 6c 76 65 20 74 68 65 20 70 75 7a 7a 6c 65 20 69 73 20 | way.to......solve.the.puzzle.is. |
| 4dc00 | 74 6f 20 77 6f 72 6b 20 61 63 72 6f 73 73 20 74 68 65 20 62 6f 61 72 64 2c 20 70 6c 61 63 69 6e | to.work.across.the.board,.placin |
| 4dc20 | 67 20 61 20 71 75 65 65 6e 20 69 6e 0a 20 20 20 20 20 65 61 63 68 20 63 6f 6c 75 6d 6e 2e 20 20 | g.a.queen.in......each.column... |
| 4dc40 | 4f 6e 63 65 20 77 65 20 68 61 76 65 20 70 6c 61 63 65 64 20 6b 20 2d 20 31 20 71 75 65 65 6e 73 | Once.we.have.placed.k.-.1.queens |
| 4dc60 | 2c 20 77 65 20 6d 75 73 74 20 70 6c 61 63 65 20 74 68 65 0a 20 20 20 20 20 6b 74 68 20 71 75 65 | ,.we.must.place.the......kth.que |
| 4dc80 | 65 6e 20 69 6e 20 61 20 70 6f 73 69 74 69 6f 6e 20 77 68 65 72 65 20 69 74 20 64 6f 65 73 20 6e | en.in.a.position.where.it.does.n |
| 4dca0 | 6f 74 20 63 68 65 63 6b 20 61 6e 79 20 6f 66 20 74 68 65 20 71 75 65 65 6e 73 0a 20 20 20 20 20 | ot.check.any.of.the.queens...... |
| 4dcc0 | 61 6c 72 65 61 64 79 20 6f 6e 20 74 68 65 20 62 6f 61 72 64 2e 20 20 57 65 20 63 61 6e 20 66 6f | already.on.the.board...We.can.fo |
| 4dce0 | 72 6d 75 6c 61 74 65 20 74 68 69 73 20 61 70 70 72 6f 61 63 68 20 72 65 63 75 72 73 69 76 65 6c | rmulate.this.approach.recursivel |
| 4dd00 | 79 3a 0a 20 20 20 20 20 41 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 68 61 76 65 20 61 6c 72 65 | y:......Assume.that.we.have.alre |
| 4dd20 | 61 64 79 20 67 65 6e 65 72 61 74 65 64 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 61 6c | ady.generated.the.sequence.of.al |
| 4dd40 | 6c 20 70 6f 73 73 69 62 6c 65 0a 20 20 20 20 20 77 61 79 73 20 74 6f 20 70 6c 61 63 65 20 6b 20 | l.possible......ways.to.place.k. |
| 4dd60 | 2d 20 31 20 71 75 65 65 6e 73 20 69 6e 20 74 68 65 20 66 69 72 73 74 20 6b 20 2d 20 31 20 63 6f | -.1.queens.in.the.first.k.-.1.co |
| 4dd80 | 6c 75 6d 6e 73 20 6f 66 20 74 68 65 0a 20 20 20 20 20 62 6f 61 72 64 2e 20 20 46 6f 72 20 65 61 | lumns.of.the......board...For.ea |
| 4dda0 | 63 68 20 6f 66 20 74 68 65 73 65 20 77 61 79 73 2c 20 67 65 6e 65 72 61 74 65 20 61 6e 20 65 78 | ch.of.these.ways,.generate.an.ex |
| 4ddc0 | 74 65 6e 64 65 64 20 73 65 74 20 6f 66 0a 20 20 20 20 20 70 6f 73 69 74 69 6f 6e 73 20 62 79 20 | tended.set.of......positions.by. |
| 4dde0 | 70 6c 61 63 69 6e 67 20 61 20 71 75 65 65 6e 20 69 6e 20 65 61 63 68 20 72 6f 77 20 6f 66 20 74 | placing.a.queen.in.each.row.of.t |
| 4de00 | 68 65 20 6b 74 68 20 63 6f 6c 75 6d 6e 2e 20 20 4e 6f 77 0a 20 20 20 20 20 66 69 6c 74 65 72 20 | he.kth.column...Now......filter. |
| 4de20 | 74 68 65 73 65 2c 20 6b 65 65 70 69 6e 67 20 6f 6e 6c 79 20 74 68 65 20 70 6f 73 69 74 69 6f 6e | these,.keeping.only.the.position |
| 4de40 | 73 20 66 6f 72 20 77 68 69 63 68 20 74 68 65 20 71 75 65 65 6e 20 69 6e 0a 20 20 20 20 20 74 68 | s.for.which.the.queen.in......th |
| 4de60 | 65 20 6b 74 68 20 63 6f 6c 75 6d 6e 20 69 73 20 73 61 66 65 20 77 69 74 68 20 72 65 73 70 65 63 | e.kth.column.is.safe.with.respec |
| 4de80 | 74 20 74 6f 20 74 68 65 20 6f 74 68 65 72 20 71 75 65 65 6e 73 2e 20 20 54 68 69 73 0a 20 20 20 | t.to.the.other.queens...This.... |
| 4dea0 | 20 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 61 6c 6c 20 77 | ..produces.the.sequence.of.all.w |
| 4dec0 | 61 79 73 20 74 6f 20 70 6c 61 63 65 20 6b 20 71 75 65 65 6e 73 20 69 6e 20 74 68 65 20 66 69 72 | ays.to.place.k.queens.in.the.fir |
| 4dee0 | 73 74 20 6b 0a 20 20 20 20 20 63 6f 6c 75 6d 6e 73 2e 20 20 42 79 20 63 6f 6e 74 69 6e 75 69 6e | st.k......columns...By.continuin |
| 4df00 | 67 20 74 68 69 73 20 70 72 6f 63 65 73 73 2c 20 77 65 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 | g.this.process,.we.will.produce. |
| 4df20 | 6e 6f 74 20 6f 6e 6c 79 20 6f 6e 65 0a 20 20 20 20 20 73 6f 6c 75 74 69 6f 6e 2c 20 62 75 74 20 | not.only.one......solution,.but. |
| 4df40 | 61 6c 6c 20 73 6f 6c 75 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 70 75 7a 7a 6c 65 2e 0a 0a 20 20 | all.solutions.to.the.puzzle..... |
| 4df60 | 20 20 20 57 65 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 69 73 20 73 6f 6c 75 74 69 6f 6e 20 61 73 | ...We.implement.this.solution.as |
| 4df80 | 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 71 75 65 65 6e 73 27 2c 20 77 68 69 63 68 20 72 65 74 | .a.procedure.`queens',.which.ret |
| 4dfa0 | 75 72 6e 73 20 61 0a 20 20 20 20 20 73 65 71 75 65 6e 63 65 20 6f 66 20 61 6c 6c 20 73 6f 6c 75 | urns.a......sequence.of.all.solu |
| 4dfc0 | 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 70 6c 61 63 69 6e 67 20 | tions.to.the.problem.of.placing. |
| 4dfe0 | 6e 20 71 75 65 65 6e 73 20 6f 6e 20 61 6e 0a 20 20 20 20 20 6e 2a 6e 20 63 68 65 73 73 62 6f 61 | n.queens.on.an......n*n.chessboa |
| 4e000 | 72 64 2e 20 20 60 51 75 65 65 6e 73 27 20 68 61 73 20 61 6e 20 69 6e 74 65 72 6e 61 6c 20 70 72 | rd...`Queens'.has.an.internal.pr |
| 4e020 | 6f 63 65 64 75 72 65 20 60 71 75 65 65 6e 2d 63 6f 6c 73 27 0a 20 20 20 20 20 74 68 61 74 20 72 | ocedure.`queen-cols'......that.r |
| 4e040 | 65 74 75 72 6e 73 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 61 6c 6c 20 77 61 79 73 20 | eturns.the.sequence.of.all.ways. |
| 4e060 | 74 6f 20 70 6c 61 63 65 20 71 75 65 65 6e 73 20 69 6e 20 74 68 65 20 66 69 72 73 74 0a 20 20 20 | to.place.queens.in.the.first.... |
| 4e080 | 20 20 6b 20 63 6f 6c 75 6d 6e 73 20 6f 66 20 74 68 65 20 62 6f 61 72 64 2e 0a 0a 20 20 20 20 20 | ..k.columns.of.the.board........ |
| 4e0a0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 71 75 65 65 6e 73 20 62 6f 61 72 64 2d 73 69 7a 65 29 | .....(define.(queens.board-size) |
| 4e0c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 71 75 65 65 6e 2d 63 6f 6c 73 | .............(define.(queen-cols |
| 4e0e0 | 20 6b 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6b 20 30 29 0a 20 20 | .k)...............(if.(=.k.0)... |
| 4e100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 65 6d 70 74 79 2d 62 6f 61 72 | ................(list.empty-boar |
| 4e120 | 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 0a 20 20 20 | d)...................(filter.... |
| 4e140 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 70 6f 73 69 74 69 6f | ................(lambda.(positio |
| 4e160 | 6e 73 29 20 28 73 61 66 65 3f 20 6b 20 70 6f 73 69 74 69 6f 6e 73 29 29 0a 20 20 20 20 20 20 20 | ns).(safe?.k.positions))........ |
| 4e180 | 20 20 20 20 20 20 20 20 20 20 20 20 28 66 6c 61 74 6d 61 70 0a 20 20 20 20 20 20 20 20 20 20 20 | ............(flatmap............ |
| 4e1a0 | 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 65 73 74 2d 6f 66 2d 71 75 65 65 6e 73 | .........(lambda.(rest-of-queens |
| 4e1c0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 | ).......................(map.(la |
| 4e1e0 | 6d 62 64 61 20 28 6e 65 77 2d 72 6f 77 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | mbda.(new-row).................. |
| 4e200 | 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d 70 6f 73 69 74 69 6f 6e 20 6e 65 77 | ............(adjoin-position.new |
| 4e220 | 2d 72 6f 77 20 6b 20 72 65 73 74 2d 6f 66 2d 71 75 65 65 6e 73 29 29 0a 20 20 20 20 20 20 20 20 | -row.k.rest-of-queens))......... |
| 4e240 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e | ...................(enumerate-in |
| 4e260 | 74 65 72 76 61 6c 20 31 20 62 6f 61 72 64 2d 73 69 7a 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 | terval.1.board-size))).......... |
| 4e280 | 20 20 20 20 20 20 20 20 20 20 20 28 71 75 65 65 6e 2d 63 6f 6c 73 20 28 2d 20 6b 20 31 29 29 29 | ...........(queen-cols.(-.k.1))) |
| 4e2a0 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 71 75 65 65 6e 2d 63 6f 6c 73 20 62 6f 61 72 | ))).............(queen-cols.boar |
| 4e2c0 | 64 2d 73 69 7a 65 29 29 0a 0a 20 20 20 20 20 49 6e 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 | d-size)).......In.this.procedure |
| 4e2e0 | 20 60 72 65 73 74 2d 6f 66 2d 71 75 65 65 6e 73 27 20 69 73 20 61 20 77 61 79 20 74 6f 20 70 6c | .`rest-of-queens'.is.a.way.to.pl |
| 4e300 | 61 63 65 20 6b 20 2d 20 31 20 71 75 65 65 6e 73 0a 20 20 20 20 20 69 6e 20 74 68 65 20 66 69 72 | ace.k.-.1.queens......in.the.fir |
| 4e320 | 73 74 20 6b 20 2d 20 31 20 63 6f 6c 75 6d 6e 73 2c 20 61 6e 64 20 60 6e 65 77 2d 72 6f 77 27 20 | st.k.-.1.columns,.and.`new-row'. |
| 4e340 | 69 73 20 61 20 70 72 6f 70 6f 73 65 64 20 72 6f 77 20 69 6e 0a 20 20 20 20 20 77 68 69 63 68 20 | is.a.proposed.row.in......which. |
| 4e360 | 74 6f 20 70 6c 61 63 65 20 74 68 65 20 71 75 65 65 6e 20 66 6f 72 20 74 68 65 20 6b 74 68 20 63 | to.place.the.queen.for.the.kth.c |
| 4e380 | 6f 6c 75 6d 6e 2e 20 20 43 6f 6d 70 6c 65 74 65 20 74 68 65 20 70 72 6f 67 72 61 6d 0a 20 20 20 | olumn...Complete.the.program.... |
| 4e3a0 | 20 20 62 79 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 | ..by.implementing.the.representa |
| 4e3c0 | 74 69 6f 6e 20 66 6f 72 20 73 65 74 73 20 6f 66 20 62 6f 61 72 64 20 70 6f 73 69 74 69 6f 6e 73 | tion.for.sets.of.board.positions |
| 4e3e0 | 2c 0a 20 20 20 20 20 69 6e 63 6c 75 64 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 | ,......including.the.procedure.` |
| 4e400 | 61 64 6a 6f 69 6e 2d 70 6f 73 69 74 69 6f 6e 27 2c 20 77 68 69 63 68 20 61 64 6a 6f 69 6e 73 20 | adjoin-position',.which.adjoins. |
| 4e420 | 61 20 6e 65 77 0a 20 20 20 20 20 72 6f 77 2d 63 6f 6c 75 6d 6e 20 70 6f 73 69 74 69 6f 6e 20 74 | a.new......row-column.position.t |
| 4e440 | 6f 20 61 20 73 65 74 20 6f 66 20 70 6f 73 69 74 69 6f 6e 73 2c 20 61 6e 64 20 60 65 6d 70 74 79 | o.a.set.of.positions,.and.`empty |
| 4e460 | 2d 62 6f 61 72 64 27 2c 0a 20 20 20 20 20 77 68 69 63 68 20 72 65 70 72 65 73 65 6e 74 73 20 61 | -board',......which.represents.a |
| 4e480 | 6e 20 65 6d 70 74 79 20 73 65 74 20 6f 66 20 70 6f 73 69 74 69 6f 6e 73 2e 20 20 59 6f 75 20 6d | n.empty.set.of.positions...You.m |
| 4e4a0 | 75 73 74 20 61 6c 73 6f 20 77 72 69 74 65 0a 20 20 20 20 20 74 68 65 20 70 72 6f 63 65 64 75 72 | ust.also.write......the.procedur |
| 4e4c0 | 65 20 60 73 61 66 65 3f 27 2c 20 77 68 69 63 68 20 64 65 74 65 72 6d 69 6e 65 73 20 66 6f 72 20 | e.`safe?',.which.determines.for. |
| 4e4e0 | 61 20 73 65 74 20 6f 66 20 70 6f 73 69 74 69 6f 6e 73 2c 0a 20 20 20 20 20 77 68 65 74 68 65 72 | a.set.of.positions,......whether |
| 4e500 | 20 74 68 65 20 71 75 65 65 6e 20 69 6e 20 74 68 65 20 6b 74 68 20 63 6f 6c 75 6d 6e 20 69 73 20 | .the.queen.in.the.kth.column.is. |
| 4e520 | 73 61 66 65 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 74 68 65 0a 20 20 20 20 20 6f 74 | safe.with.respect.to.the......ot |
| 4e540 | 68 65 72 73 2e 20 20 28 4e 6f 74 65 20 74 68 61 74 20 77 65 20 6e 65 65 64 20 6f 6e 6c 79 20 63 | hers...(Note.that.we.need.only.c |
| 4e560 | 68 65 63 6b 20 77 68 65 74 68 65 72 20 74 68 65 20 6e 65 77 20 71 75 65 65 6e 20 69 73 0a 20 20 | heck.whether.the.new.queen.is... |
| 4e580 | 20 20 20 73 61 66 65 2d 2d 74 68 65 20 6f 74 68 65 72 20 71 75 65 65 6e 73 20 61 72 65 20 61 6c | ...safe--the.other.queens.are.al |
| 4e5a0 | 72 65 61 64 79 20 67 75 61 72 61 6e 74 65 65 64 20 73 61 66 65 20 77 69 74 68 20 72 65 73 70 65 | ready.guaranteed.safe.with.respe |
| 4e5c0 | 63 74 20 74 6f 0a 20 20 20 20 20 65 61 63 68 20 6f 74 68 65 72 2e 29 0a 0a 20 20 20 20 20 2a 45 | ct.to......each.other.).......*E |
| 4e5e0 | 78 65 72 63 69 73 65 20 32 2e 34 33 3a 2a 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 20 69 73 | xercise.2.43:*.Louis.Reasoner.is |
| 4e600 | 20 68 61 76 69 6e 67 20 61 20 74 65 72 72 69 62 6c 65 20 74 69 6d 65 20 64 6f 69 6e 67 0a 20 20 | .having.a.terrible.time.doing... |
| 4e620 | 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 34 32 3a 3a 2e 20 20 48 69 73 20 60 | ...*Note.Exercise.2-42::...His.` |
| 4e640 | 71 75 65 65 6e 73 27 20 70 72 6f 63 65 64 75 72 65 20 73 65 65 6d 73 20 74 6f 20 77 6f 72 6b 2c | queens'.procedure.seems.to.work, |
| 4e660 | 20 62 75 74 0a 20 20 20 20 20 69 74 20 72 75 6e 73 20 65 78 74 72 65 6d 65 6c 79 20 73 6c 6f 77 | .but......it.runs.extremely.slow |
| 4e680 | 6c 79 2e 20 20 28 4c 6f 75 69 73 20 6e 65 76 65 72 20 64 6f 65 73 20 6d 61 6e 61 67 65 20 74 6f | ly...(Louis.never.does.manage.to |
| 4e6a0 | 20 77 61 69 74 20 6c 6f 6e 67 0a 20 20 20 20 20 65 6e 6f 75 67 68 20 66 6f 72 20 69 74 20 74 6f | .wait.long......enough.for.it.to |
| 4e6c0 | 20 73 6f 6c 76 65 20 65 76 65 6e 20 74 68 65 20 36 2a 36 20 63 61 73 65 2e 29 20 20 57 68 65 6e | .solve.even.the.6*6.case.)..When |
| 4e6e0 | 20 4c 6f 75 69 73 20 61 73 6b 73 20 45 76 61 20 4c 75 0a 20 20 20 20 20 41 74 6f 72 20 66 6f 72 | .Louis.asks.Eva.Lu......Ator.for |
| 4e700 | 20 68 65 6c 70 2c 20 73 68 65 20 70 6f 69 6e 74 73 20 6f 75 74 20 74 68 61 74 20 68 65 20 68 61 | .help,.she.points.out.that.he.ha |
| 4e720 | 73 20 69 6e 74 65 72 63 68 61 6e 67 65 64 20 74 68 65 20 6f 72 64 65 72 0a 20 20 20 20 20 6f 66 | s.interchanged.the.order......of |
| 4e740 | 20 74 68 65 20 6e 65 73 74 65 64 20 6d 61 70 70 69 6e 67 73 20 69 6e 20 74 68 65 20 60 66 6c 61 | .the.nested.mappings.in.the.`fla |
| 4e760 | 74 6d 61 70 27 2c 20 77 72 69 74 69 6e 67 20 69 74 20 61 73 0a 0a 20 20 20 20 20 20 20 20 20 20 | tmap',.writing.it.as............ |
| 4e780 | 28 66 6c 61 74 6d 61 70 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6e 65 77 | (flatmap............(lambda.(new |
| 4e7a0 | 2d 72 6f 77 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 | -row)..............(map.(lambda. |
| 4e7c0 | 28 72 65 73 74 2d 6f 66 2d 71 75 65 65 6e 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (rest-of-queens)................ |
| 4e7e0 | 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d 70 6f 73 69 74 69 6f 6e 20 6e 65 77 2d 72 6f 77 20 6b 20 | .....(adjoin-position.new-row.k. |
| 4e800 | 72 65 73 74 2d 6f 66 2d 71 75 65 65 6e 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rest-of-queens))................ |
| 4e820 | 20 20 20 28 71 75 65 65 6e 2d 63 6f 6c 73 20 28 2d 20 6b 20 31 29 29 29 29 0a 20 20 20 20 20 20 | ...(queen-cols.(-.k.1))))....... |
| 4e840 | 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 31 20 62 6f 61 72 64 | .....(enumerate-interval.1.board |
| 4e860 | 2d 73 69 7a 65 29 29 0a 0a 20 20 20 20 20 45 78 70 6c 61 69 6e 20 77 68 79 20 74 68 69 73 20 69 | -size)).......Explain.why.this.i |
| 4e880 | 6e 74 65 72 63 68 61 6e 67 65 20 6d 61 6b 65 73 20 74 68 65 20 70 72 6f 67 72 61 6d 20 72 75 6e | nterchange.makes.the.program.run |
| 4e8a0 | 20 73 6c 6f 77 6c 79 2e 0a 20 20 20 20 20 45 73 74 69 6d 61 74 65 20 68 6f 77 20 6c 6f 6e 67 20 | .slowly.......Estimate.how.long. |
| 4e8c0 | 69 74 20 77 69 6c 6c 20 74 61 6b 65 20 4c 6f 75 69 73 27 73 20 70 72 6f 67 72 61 6d 20 74 6f 20 | it.will.take.Louis's.program.to. |
| 4e8e0 | 73 6f 6c 76 65 20 74 68 65 0a 20 20 20 20 20 65 69 67 68 74 2d 71 75 65 65 6e 73 20 70 75 7a 7a | solve.the......eight-queens.puzz |
| 4e900 | 6c 65 2c 20 61 73 73 75 6d 69 6e 67 20 74 68 61 74 20 74 68 65 20 70 72 6f 67 72 61 6d 20 69 6e | le,.assuming.that.the.program.in |
| 4e920 | 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 20 20 20 20 20 32 2d 34 32 3a 3a 20 73 6f 6c 76 | .*Note.Exercise......2-42::.solv |
| 4e940 | 65 73 20 74 68 65 20 70 75 7a 7a 6c 65 20 69 6e 20 74 69 6d 65 20 54 2e 0a 0a 20 20 20 2d 2d 2d | es.the.puzzle.in.time.T......--- |
| 4e960 | 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 | -------.Footnotes.----------.... |
| 4e980 | 20 28 31 29 20 54 68 69 73 20 69 73 2c 20 69 6e 20 66 61 63 74 2c 20 70 72 65 63 69 73 65 6c 79 | .(1).This.is,.in.fact,.precisely |
| 4e9a0 | 20 74 68 65 20 60 66 72 69 6e 67 65 27 20 70 72 6f 63 65 64 75 72 65 20 66 72 6f 6d 20 2a 4e 6f | .the.`fringe'.procedure.from.*No |
| 4e9c0 | 74 65 0a 45 78 65 72 63 69 73 65 20 32 2d 32 38 3a 3a 2e 20 20 48 65 72 65 20 77 65 27 76 65 20 | te.Exercise.2-28::...Here.we've. |
| 4e9e0 | 72 65 6e 61 6d 65 64 20 69 74 20 74 6f 20 65 6d 70 68 61 73 69 7a 65 20 74 68 61 74 20 69 74 20 | renamed.it.to.emphasize.that.it. |
| 4ea00 | 69 73 20 70 61 72 74 20 6f 66 0a 61 20 66 61 6d 69 6c 79 20 6f 66 20 67 65 6e 65 72 61 6c 20 73 | is.part.of.a.family.of.general.s |
| 4ea20 | 65 71 75 65 6e 63 65 2d 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 2e | equence-manipulation.procedures. |
| 4ea40 | 0a 0a 20 20 20 28 32 29 20 52 69 63 68 61 72 64 20 57 61 74 65 72 73 20 28 31 39 37 39 29 20 64 | .....(2).Richard.Waters.(1979).d |
| 4ea60 | 65 76 65 6c 6f 70 65 64 20 61 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 61 75 74 6f 6d 61 74 69 | eveloped.a.program.that.automati |
| 4ea80 | 63 61 6c 6c 79 0a 61 6e 61 6c 79 7a 65 73 20 74 72 61 64 69 74 69 6f 6e 61 6c 20 46 6f 72 74 72 | cally.analyzes.traditional.Fortr |
| 4eaa0 | 61 6e 20 70 72 6f 67 72 61 6d 73 2c 20 76 69 65 77 69 6e 67 20 74 68 65 6d 20 69 6e 20 74 65 72 | an.programs,.viewing.them.in.ter |
| 4eac0 | 6d 73 20 6f 66 20 6d 61 70 73 2c 0a 66 69 6c 74 65 72 73 2c 20 61 6e 64 20 61 63 63 75 6d 75 6c | ms.of.maps,.filters,.and.accumul |
| 4eae0 | 61 74 69 6f 6e 73 2e 20 20 48 65 20 66 6f 75 6e 64 20 74 68 61 74 20 66 75 6c 6c 79 20 39 30 20 | ations...He.found.that.fully.90. |
| 4eb00 | 70 65 72 63 65 6e 74 20 6f 66 20 74 68 65 20 63 6f 64 65 0a 69 6e 20 74 68 65 20 46 6f 72 74 72 | percent.of.the.code.in.the.Fortr |
| 4eb20 | 61 6e 20 53 63 69 65 6e 74 69 66 69 63 20 53 75 62 72 6f 75 74 69 6e 65 20 50 61 63 6b 61 67 65 | an.Scientific.Subroutine.Package |
| 4eb40 | 20 66 69 74 73 20 6e 65 61 74 6c 79 20 69 6e 74 6f 20 74 68 69 73 0a 70 61 72 61 64 69 67 6d 2e | .fits.neatly.into.this.paradigm. |
| 4eb60 | 20 20 4f 6e 65 20 6f 66 20 74 68 65 20 72 65 61 73 6f 6e 73 20 66 6f 72 20 74 68 65 20 73 75 63 | ..One.of.the.reasons.for.the.suc |
| 4eb80 | 63 65 73 73 20 6f 66 20 4c 69 73 70 20 61 73 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 0a 6c 61 | cess.of.Lisp.as.a.programming.la |
| 4eba0 | 6e 67 75 61 67 65 20 69 73 20 74 68 61 74 20 6c 69 73 74 73 20 70 72 6f 76 69 64 65 20 61 20 73 | nguage.is.that.lists.provide.a.s |
| 4ebc0 | 74 61 6e 64 61 72 64 20 6d 65 64 69 75 6d 20 66 6f 72 20 65 78 70 72 65 73 73 69 6e 67 20 6f 72 | tandard.medium.for.expressing.or |
| 4ebe0 | 64 65 72 65 64 0a 63 6f 6c 6c 65 63 74 69 6f 6e 73 20 73 6f 20 74 68 61 74 20 74 68 65 79 20 63 | dered.collections.so.that.they.c |
| 4ec00 | 61 6e 20 62 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 20 75 73 69 6e 67 20 68 69 67 68 65 72 2d 6f | an.be.manipulated.using.higher-o |
| 4ec20 | 72 64 65 72 0a 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 54 68 65 20 70 72 6f 67 72 61 6d 6d 69 6e | rder.operations...The.programmin |
| 4ec40 | 67 20 6c 61 6e 67 75 61 67 65 20 41 50 4c 20 6f 77 65 73 20 6d 75 63 68 20 6f 66 20 69 74 73 20 | g.language.APL.owes.much.of.its. |
| 4ec60 | 70 6f 77 65 72 20 61 6e 64 0a 61 70 70 65 61 6c 20 74 6f 20 61 20 73 69 6d 69 6c 61 72 20 63 68 | power.and.appeal.to.a.similar.ch |
| 4ec80 | 6f 69 63 65 2e 20 49 6e 20 41 50 4c 20 61 6c 6c 20 64 61 74 61 20 61 72 65 20 72 65 70 72 65 73 | oice..In.APL.all.data.are.repres |
| 4eca0 | 65 6e 74 65 64 20 61 73 20 61 72 72 61 79 73 2c 0a 61 6e 64 20 74 68 65 72 65 20 69 73 20 61 20 | ented.as.arrays,.and.there.is.a. |
| 4ecc0 | 75 6e 69 76 65 72 73 61 6c 20 61 6e 64 20 63 6f 6e 76 65 6e 69 65 6e 74 20 73 65 74 20 6f 66 20 | universal.and.convenient.set.of. |
| 4ece0 | 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 6f 72 73 20 66 6f 72 0a 61 6c 6c 20 73 6f 72 74 73 20 | generic.operators.for.all.sorts. |
| 4ed00 | 6f 66 20 61 72 72 61 79 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 28 33 29 20 41 63 63 | of.array.operations......(3).Acc |
| 4ed20 | 6f 72 64 69 6e 67 20 74 6f 20 4b 6e 75 74 68 20 28 31 39 38 31 29 2c 20 74 68 69 73 20 72 75 6c | ording.to.Knuth.(1981),.this.rul |
| 4ed40 | 65 20 77 61 73 20 66 6f 72 6d 75 6c 61 74 65 64 20 62 79 20 57 2e 20 47 2e 0a 48 6f 72 6e 65 72 | e.was.formulated.by.W..G..Horner |
| 4ed60 | 20 65 61 72 6c 79 20 69 6e 20 74 68 65 20 6e 69 6e 65 74 65 65 6e 74 68 20 63 65 6e 74 75 72 79 | .early.in.the.nineteenth.century |
| 4ed80 | 2c 20 62 75 74 20 74 68 65 20 6d 65 74 68 6f 64 20 77 61 73 20 61 63 74 75 61 6c 6c 79 20 75 73 | ,.but.the.method.was.actually.us |
| 4eda0 | 65 64 0a 62 79 20 4e 65 77 74 6f 6e 20 6f 76 65 72 20 61 20 68 75 6e 64 72 65 64 20 79 65 61 72 | ed.by.Newton.over.a.hundred.year |
| 4edc0 | 73 20 65 61 72 6c 69 65 72 2e 20 20 48 6f 72 6e 65 72 27 73 20 72 75 6c 65 20 65 76 61 6c 75 61 | s.earlier...Horner's.rule.evalua |
| 4ede0 | 74 65 73 20 74 68 65 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 20 75 73 69 6e 67 20 66 65 77 65 72 20 61 | tes.the.polynomial.using.fewer.a |
| 4ee00 | 64 64 69 74 69 6f 6e 73 20 61 6e 64 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 20 74 68 61 | dditions.and.multiplications.tha |
| 4ee20 | 6e 20 64 6f 65 73 20 74 68 65 0a 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 6d 65 74 68 6f | n.does.the.straightforward.metho |
| 4ee40 | 64 20 6f 66 20 66 69 72 73 74 20 63 6f 6d 70 75 74 69 6e 67 20 61 5f 6e 20 78 5e 6e 2c 20 74 68 | d.of.first.computing.a_n.x^n,.th |
| 4ee60 | 65 6e 20 61 64 64 69 6e 67 0a 61 5f 28 6e 2d 31 29 78 5e 28 6e 2d 31 29 2c 20 61 6e 64 20 73 6f | en.adding.a_(n-1)x^(n-1),.and.so |
| 4ee80 | 20 6f 6e 2e 20 20 49 6e 20 66 61 63 74 2c 20 69 74 20 69 73 20 70 6f 73 73 69 62 6c 65 20 74 6f | .on...In.fact,.it.is.possible.to |
| 4eea0 | 20 70 72 6f 76 65 20 74 68 61 74 20 61 6e 79 0a 61 6c 67 6f 72 69 74 68 6d 20 66 6f 72 20 65 76 | .prove.that.any.algorithm.for.ev |
| 4eec0 | 61 6c 75 61 74 69 6e 67 20 61 72 62 69 74 72 61 72 79 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 6d | aluating.arbitrary.polynomials.m |
| 4eee0 | 75 73 74 20 75 73 65 20 61 74 20 6c 65 61 73 74 20 61 73 0a 6d 61 6e 79 20 61 64 64 69 74 69 6f | ust.use.at.least.as.many.additio |
| 4ef00 | 6e 73 20 61 6e 64 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 20 61 73 20 64 6f 65 73 20 48 | ns.and.multiplications.as.does.H |
| 4ef20 | 6f 72 6e 65 72 27 73 20 72 75 6c 65 2c 20 61 6e 64 20 74 68 75 73 0a 48 6f 72 6e 65 72 27 73 20 | orner's.rule,.and.thus.Horner's. |
| 4ef40 | 72 75 6c 65 20 69 73 20 61 6e 20 6f 70 74 69 6d 61 6c 20 61 6c 67 6f 72 69 74 68 6d 20 66 6f 72 | rule.is.an.optimal.algorithm.for |
| 4ef60 | 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 65 76 61 6c 75 61 74 69 6f 6e 2e 20 20 54 68 69 73 0a 77 61 | .polynomial.evaluation...This.wa |
| 4ef80 | 73 20 70 72 6f 76 65 64 20 28 66 6f 72 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 61 64 64 69 | s.proved.(for.the.number.of.addi |
| 4efa0 | 74 69 6f 6e 73 29 20 62 79 20 41 2e 20 4d 2e 20 4f 73 74 72 6f 77 73 6b 69 20 69 6e 20 61 20 31 | tions).by.A..M..Ostrowski.in.a.1 |
| 4efc0 | 39 35 34 0a 70 61 70 65 72 20 74 68 61 74 20 65 73 73 65 6e 74 69 61 6c 6c 79 20 66 6f 75 6e 64 | 954.paper.that.essentially.found |
| 4efe0 | 65 64 20 74 68 65 20 6d 6f 64 65 72 6e 20 73 74 75 64 79 20 6f 66 20 6f 70 74 69 6d 61 6c 20 61 | ed.the.modern.study.of.optimal.a |
| 4f000 | 6c 67 6f 72 69 74 68 6d 73 2e 0a 54 68 65 20 61 6e 61 6c 6f 67 6f 75 73 20 73 74 61 74 65 6d 65 | lgorithms..The.analogous.stateme |
| 4f020 | 6e 74 20 66 6f 72 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 73 20 77 61 73 20 70 72 6f 76 65 | nt.for.multiplications.was.prove |
| 4f040 | 64 20 62 79 20 56 2e 20 59 2e 20 50 61 6e 20 69 6e 0a 31 39 36 36 2e 20 20 54 68 65 20 62 6f 6f | d.by.V..Y..Pan.in.1966...The.boo |
| 4f060 | 6b 20 62 79 20 42 6f 72 6f 64 69 6e 20 61 6e 64 20 4d 75 6e 72 6f 20 28 31 39 37 35 29 20 70 72 | k.by.Borodin.and.Munro.(1975).pr |
| 4f080 | 6f 76 69 64 65 73 20 61 6e 20 6f 76 65 72 76 69 65 77 20 6f 66 0a 74 68 65 73 65 20 61 6e 64 20 | ovides.an.overview.of.these.and. |
| 4f0a0 | 6f 74 68 65 72 20 72 65 73 75 6c 74 73 20 61 62 6f 75 74 20 6f 70 74 69 6d 61 6c 20 61 6c 67 6f | other.results.about.optimal.algo |
| 4f0c0 | 72 69 74 68 6d 73 2e 0a 0a 20 20 20 28 34 29 20 54 68 69 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 | rithms......(4).This.definition. |
| 4f0e0 | 75 73 65 73 20 74 68 65 20 65 78 74 65 6e 64 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 60 6d 61 | uses.the.extended.version.of.`ma |
| 4f100 | 70 27 20 64 65 73 63 72 69 62 65 64 20 69 6e 0a 2a 4e 6f 74 65 20 46 6f 6f 74 6e 6f 74 65 20 31 | p'.described.in.*Note.Footnote.1 |
| 4f120 | 32 3a 3a 2e 0a 0a 20 20 20 28 35 29 20 54 68 69 73 20 61 70 70 72 6f 61 63 68 20 74 6f 20 6e 65 | 2::......(5).This.approach.to.ne |
| 4f140 | 73 74 65 64 20 6d 61 70 70 69 6e 67 73 20 77 61 73 20 73 68 6f 77 6e 20 74 6f 20 75 73 20 62 79 | sted.mappings.was.shown.to.us.by |
| 4f160 | 20 44 61 76 69 64 0a 54 75 72 6e 65 72 2c 20 77 68 6f 73 65 20 6c 61 6e 67 75 61 67 65 73 20 4b | .David.Turner,.whose.languages.K |
| 4f180 | 52 43 20 61 6e 64 20 4d 69 72 61 6e 64 61 20 70 72 6f 76 69 64 65 20 65 6c 65 67 61 6e 74 20 66 | RC.and.Miranda.provide.elegant.f |
| 4f1a0 | 6f 72 6d 61 6c 69 73 6d 73 20 66 6f 72 0a 64 65 61 6c 69 6e 67 20 77 69 74 68 20 74 68 65 73 65 | ormalisms.for.dealing.with.these |
| 4f1c0 | 20 63 6f 6e 73 74 72 75 63 74 73 2e 20 20 54 68 65 20 65 78 61 6d 70 6c 65 73 20 69 6e 20 74 68 | .constructs...The.examples.in.th |
| 4f1e0 | 69 73 20 73 65 63 74 69 6f 6e 20 28 73 65 65 20 61 6c 73 6f 0a 2a 4e 6f 74 65 20 45 78 65 72 63 | is.section.(see.also.*Note.Exerc |
| 4f200 | 69 73 65 20 32 2d 34 32 3a 3a 29 20 61 72 65 20 61 64 61 70 74 65 64 20 66 72 6f 6d 20 54 75 72 | ise.2-42::).are.adapted.from.Tur |
| 4f220 | 6e 65 72 20 31 39 38 31 2e 20 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 33 2d 35 2d | ner.1981...In.section.*Note.3-5- |
| 4f240 | 33 3a 3a 2c 20 77 65 27 6c 6c 20 73 65 65 20 68 6f 77 20 74 68 69 73 20 61 70 70 72 6f 61 63 68 | 3::,.we'll.see.how.this.approach |
| 4f260 | 20 67 65 6e 65 72 61 6c 69 7a 65 73 20 74 6f 20 69 6e 66 69 6e 69 74 65 20 73 65 71 75 65 6e 63 | .generalizes.to.infinite.sequenc |
| 4f280 | 65 73 2e 0a 0a 20 20 20 28 36 29 20 57 65 27 72 65 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 | es......(6).We're.representing.a |
| 4f2a0 | 20 70 61 69 72 20 68 65 72 65 20 61 73 20 61 20 6c 69 73 74 20 6f 66 20 74 77 6f 20 65 6c 65 6d | .pair.here.as.a.list.of.two.elem |
| 4f2c0 | 65 6e 74 73 20 72 61 74 68 65 72 0a 74 68 61 6e 20 61 73 20 61 20 4c 69 73 70 20 70 61 69 72 2e | ents.rather.than.as.a.Lisp.pair. |
| 4f2e0 | 20 20 54 68 75 73 2c 20 74 68 65 20 22 70 61 69 72 22 20 28 69 2c 6a 29 20 69 73 20 72 65 70 72 | ..Thus,.the."pair".(i,j).is.repr |
| 4f300 | 65 73 65 6e 74 65 64 20 61 73 20 60 28 6c 69 73 74 20 69 0a 6a 29 27 2c 20 6e 6f 74 20 60 28 63 | esented.as.`(list.i.j)',.not.`(c |
| 4f320 | 6f 6e 73 20 69 20 6a 29 27 2e 0a 0a 20 20 20 28 37 29 20 54 68 65 20 73 65 74 20 53 20 2d 20 78 | ons.i.j)'......(7).The.set.S.-.x |
| 4f340 | 20 69 73 20 74 68 65 20 73 65 74 20 6f 66 20 61 6c 6c 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 53 | .is.the.set.of.all.elements.of.S |
| 4f360 | 2c 20 65 78 63 6c 75 64 69 6e 67 20 78 2e 0a 0a 20 20 20 28 38 29 20 53 65 6d 69 63 6f 6c 6f 6e | ,.excluding.x......(8).Semicolon |
| 4f380 | 73 20 69 6e 20 53 63 68 65 6d 65 20 63 6f 64 65 20 61 72 65 20 75 73 65 64 20 74 6f 20 69 6e 74 | s.in.Scheme.code.are.used.to.int |
| 4f3a0 | 72 6f 64 75 63 65 20 22 63 6f 6d 6d 65 6e 74 73 22 2e 0a 45 76 65 72 79 74 68 69 6e 67 20 66 72 | roduce."comments"..Everything.fr |
| 4f3c0 | 6f 6d 20 74 68 65 20 73 65 6d 69 63 6f 6c 6f 6e 20 74 6f 20 74 68 65 20 65 6e 64 20 6f 66 20 74 | om.the.semicolon.to.the.end.of.t |
| 4f3e0 | 68 65 20 6c 69 6e 65 20 69 73 20 69 67 6e 6f 72 65 64 20 62 79 20 74 68 65 0a 69 6e 74 65 72 70 | he.line.is.ignored.by.the.interp |
| 4f400 | 72 65 74 65 72 2e 20 20 49 6e 20 74 68 69 73 20 62 6f 6f 6b 20 77 65 20 64 6f 6e 27 74 20 75 73 | reter...In.this.book.we.don't.us |
| 4f420 | 65 20 6d 61 6e 79 20 63 6f 6d 6d 65 6e 74 73 3b 20 77 65 20 74 72 79 20 74 6f 20 6d 61 6b 65 0a | e.many.comments;.we.try.to.make. |
| 4f440 | 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 73 65 6c 66 2d 64 6f 63 75 6d 65 6e 74 69 6e 67 20 62 79 | our.programs.self-documenting.by |
| 4f460 | 20 75 73 69 6e 67 20 64 65 73 63 72 69 70 74 69 76 65 20 6e 61 6d 65 73 2e 0a 0a 1f 0a 46 69 6c | .using.descriptive.names.....Fil |
| 4f480 | 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 32 2d 34 2c 20 20 50 72 65 | e:.sicp.info,..Node:.2-2-4,..Pre |
| 4f4a0 | 76 3a 20 32 2d 32 2d 33 2c 20 20 55 70 3a 20 32 2d 32 0a 0a 32 2e 32 2e 34 20 45 78 61 6d 70 6c | v:.2-2-3,..Up:.2-2..2.2.4.Exampl |
| 4f4c0 | 65 3a 20 41 20 50 69 63 74 75 72 65 20 4c 61 6e 67 75 61 67 65 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | e:.A.Picture.Language.---------- |
| 4f4e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 69 73 20 73 65 | -----------------------..This.se |
| 4f500 | 63 74 69 6f 6e 20 70 72 65 73 65 6e 74 73 20 61 20 73 69 6d 70 6c 65 20 6c 61 6e 67 75 61 67 65 | ction.presents.a.simple.language |
| 4f520 | 20 66 6f 72 20 64 72 61 77 69 6e 67 20 70 69 63 74 75 72 65 73 20 74 68 61 74 0a 69 6c 6c 75 73 | .for.drawing.pictures.that.illus |
| 4f540 | 74 72 61 74 65 73 20 74 68 65 20 70 6f 77 65 72 20 6f 66 20 64 61 74 61 20 61 62 73 74 72 61 63 | trates.the.power.of.data.abstrac |
| 4f560 | 74 69 6f 6e 20 61 6e 64 20 63 6c 6f 73 75 72 65 2c 20 61 6e 64 20 61 6c 73 6f 0a 65 78 70 6c 6f | tion.and.closure,.and.also.explo |
| 4f580 | 69 74 73 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 61 | its.higher-order.procedures.in.a |
| 4f5a0 | 6e 20 65 73 73 65 6e 74 69 61 6c 20 77 61 79 2e 20 20 54 68 65 20 6c 61 6e 67 75 61 67 65 20 69 | n.essential.way...The.language.i |
| 4f5c0 | 73 0a 64 65 73 69 67 6e 65 64 20 74 6f 20 6d 61 6b 65 20 69 74 20 65 61 73 79 20 74 6f 20 65 78 | s.designed.to.make.it.easy.to.ex |
| 4f5e0 | 70 65 72 69 6d 65 6e 74 20 77 69 74 68 20 70 61 74 74 65 72 6e 73 20 73 75 63 68 20 61 73 20 74 | periment.with.patterns.such.as.t |
| 4f600 | 68 65 20 6f 6e 65 73 0a 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 39 3a 3a 2c 20 77 | he.ones.in.*Note.Figure.2-9::,.w |
| 4f620 | 68 69 63 68 20 61 72 65 20 63 6f 6d 70 6f 73 65 64 20 6f 66 20 72 65 70 65 61 74 65 64 20 65 6c | hich.are.composed.of.repeated.el |
| 4f640 | 65 6d 65 6e 74 73 20 74 68 61 74 20 61 72 65 0a 73 68 69 66 74 65 64 20 61 6e 64 20 73 63 61 6c | ements.that.are.shifted.and.scal |
| 4f660 | 65 64 2e 28 31 29 20 49 6e 20 74 68 69 73 20 6c 61 6e 67 75 61 67 65 2c 20 74 68 65 20 64 61 74 | ed.(1).In.this.language,.the.dat |
| 4f680 | 61 20 6f 62 6a 65 63 74 73 20 62 65 69 6e 67 0a 63 6f 6d 62 69 6e 65 64 20 61 72 65 20 72 65 70 | a.objects.being.combined.are.rep |
| 4f6a0 | 72 65 73 65 6e 74 65 64 20 61 73 20 70 72 6f 63 65 64 75 72 65 73 20 72 61 74 68 65 72 20 74 68 | resented.as.procedures.rather.th |
| 4f6c0 | 61 6e 20 61 73 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 2e 0a 4a 75 73 74 20 61 73 20 60 63 | an.as.list.structure..Just.as.`c |
| 4f6e0 | 6f 6e 73 27 2c 20 77 68 69 63 68 20 73 61 74 69 73 66 69 65 73 20 74 68 65 20 63 6c 6f 73 75 72 | ons',.which.satisfies.the.closur |
| 4f700 | 65 20 70 72 6f 70 65 72 74 79 2c 20 61 6c 6c 6f 77 65 64 20 75 73 20 74 6f 0a 65 61 73 69 6c 79 | e.property,.allowed.us.to.easily |
| 4f720 | 20 62 75 69 6c 64 20 61 72 62 69 74 72 61 72 69 6c 79 20 63 6f 6d 70 6c 69 63 61 74 65 64 20 6c | .build.arbitrarily.complicated.l |
| 4f740 | 69 73 74 20 73 74 72 75 63 74 75 72 65 2c 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e | ist.structure,.the.operations.in |
| 4f760 | 0a 74 68 69 73 20 6c 61 6e 67 75 61 67 65 2c 20 77 68 69 63 68 20 61 6c 73 6f 20 73 61 74 69 73 | .this.language,.which.also.satis |
| 4f780 | 66 79 20 74 68 65 20 63 6c 6f 73 75 72 65 20 70 72 6f 70 65 72 74 79 2c 20 61 6c 6c 6f 77 20 75 | fy.the.closure.property,.allow.u |
| 4f7a0 | 73 20 74 6f 0a 65 61 73 69 6c 79 20 62 75 69 6c 64 20 61 72 62 69 74 72 61 72 69 6c 79 20 63 6f | s.to.easily.build.arbitrarily.co |
| 4f7c0 | 6d 70 6c 69 63 61 74 65 64 20 70 61 74 74 65 72 6e 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 | mplicated.patterns........*Figur |
| 4f7e0 | 65 20 32 2e 39 3a 2a 20 44 65 73 69 67 6e 73 20 67 65 6e 65 72 61 74 65 64 20 77 69 74 68 20 74 | e.2.9:*.Designs.generated.with.t |
| 4f800 | 68 65 20 70 69 63 74 75 72 65 20 6c 61 6e 67 75 61 67 65 2e 0a 0a 20 20 20 20 20 5b 74 77 6f 20 | he.picture.language........[two. |
| 4f820 | 67 72 61 70 68 69 63 20 69 6d 61 67 65 73 20 6e 6f 74 20 69 6e 63 6c 75 64 65 64 5d 0a 0a 54 68 | graphic.images.not.included]..Th |
| 4f840 | 65 20 70 69 63 74 75 72 65 20 6c 61 6e 67 75 61 67 65 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | e.picture.language.............. |
| 4f860 | 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 68 65 6e 20 77 65 20 62 65 67 61 6e 20 6f 75 72 20 73 74 75 64 79 | .........When.we.began.our.study |
| 4f880 | 20 6f 66 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | .of.programming.in.section.*Note |
| 4f8a0 | 20 31 2d 31 3a 3a 2c 20 77 65 0a 65 6d 70 68 61 73 69 7a 65 64 20 74 68 65 20 69 6d 70 6f 72 74 | .1-1::,.we.emphasized.the.import |
| 4f8c0 | 61 6e 63 65 20 6f 66 20 64 65 73 63 72 69 62 69 6e 67 20 61 20 6c 61 6e 67 75 61 67 65 20 62 79 | ance.of.describing.a.language.by |
| 4f8e0 | 20 66 6f 63 75 73 69 6e 67 20 6f 6e 20 74 68 65 0a 6c 61 6e 67 75 61 67 65 27 73 20 70 72 69 6d | .focusing.on.the.language's.prim |
| 4f900 | 69 74 69 76 65 73 2c 20 69 74 73 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e | itives,.its.means.of.combination |
| 4f920 | 2c 20 61 6e 64 20 69 74 73 20 6d 65 61 6e 73 20 6f 66 0a 61 62 73 74 72 61 63 74 69 6f 6e 2e 20 | ,.and.its.means.of.abstraction.. |
| 4f940 | 20 57 65 27 6c 6c 20 66 6f 6c 6c 6f 77 20 74 68 61 74 20 66 72 61 6d 65 77 6f 72 6b 20 68 65 72 | .We'll.follow.that.framework.her |
| 4f960 | 65 2e 0a 0a 20 20 20 50 61 72 74 20 6f 66 20 74 68 65 20 65 6c 65 67 61 6e 63 65 20 6f 66 20 74 | e......Part.of.the.elegance.of.t |
| 4f980 | 68 69 73 20 70 69 63 74 75 72 65 20 6c 61 6e 67 75 61 67 65 20 69 73 20 74 68 61 74 20 74 68 65 | his.picture.language.is.that.the |
| 4f9a0 | 72 65 20 69 73 20 6f 6e 6c 79 0a 6f 6e 65 20 6b 69 6e 64 20 6f 66 20 65 6c 65 6d 65 6e 74 2c 20 | re.is.only.one.kind.of.element,. |
| 4f9c0 | 63 61 6c 6c 65 64 20 61 20 22 70 61 69 6e 74 65 72 22 2e 20 20 41 20 70 61 69 6e 74 65 72 20 64 | called.a."painter"...A.painter.d |
| 4f9e0 | 72 61 77 73 20 61 6e 20 69 6d 61 67 65 20 74 68 61 74 0a 69 73 20 73 68 69 66 74 65 64 20 61 6e | raws.an.image.that.is.shifted.an |
| 4fa00 | 64 20 73 63 61 6c 65 64 20 74 6f 20 66 69 74 20 77 69 74 68 69 6e 20 61 20 64 65 73 69 67 6e 61 | d.scaled.to.fit.within.a.designa |
| 4fa20 | 74 65 64 20 70 61 72 61 6c 6c 65 6c 6f 67 72 61 6d 2d 73 68 61 70 65 64 0a 66 72 61 6d 65 2e 20 | ted.parallelogram-shaped.frame.. |
| 4fa40 | 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 72 65 27 73 20 61 20 70 72 69 6d 69 74 69 76 | .For.example,.there's.a.primitiv |
| 4fa60 | 65 20 70 61 69 6e 74 65 72 20 77 65 27 6c 6c 20 63 61 6c 6c 20 60 77 61 76 65 27 20 74 68 61 74 | e.painter.we'll.call.`wave'.that |
| 4fa80 | 0a 6d 61 6b 65 73 20 61 20 63 72 75 64 65 20 6c 69 6e 65 20 64 72 61 77 69 6e 67 2c 20 61 73 20 | .makes.a.crude.line.drawing,.as. |
| 4faa0 | 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 30 3a 3a 2e 20 20 54 | shown.in.*Note.Figure.2-10::...T |
| 4fac0 | 68 65 0a 61 63 74 75 61 6c 20 73 68 61 70 65 20 6f 66 20 74 68 65 20 64 72 61 77 69 6e 67 20 64 | he.actual.shape.of.the.drawing.d |
| 4fae0 | 65 70 65 6e 64 73 20 6f 6e 20 74 68 65 20 66 72 61 6d 65 2d 2d 61 6c 6c 20 66 6f 75 72 20 69 6d | epends.on.the.frame--all.four.im |
| 4fb00 | 61 67 65 73 20 69 6e 0a 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 30 3a 3a 20 61 72 65 20 | ages.in.*Note.Figure.2-10::.are. |
| 4fb20 | 70 72 6f 64 75 63 65 64 20 62 79 20 74 68 65 20 73 61 6d 65 20 60 77 61 76 65 27 20 70 61 69 6e | produced.by.the.same.`wave'.pain |
| 4fb40 | 74 65 72 2c 20 62 75 74 20 77 69 74 68 0a 72 65 73 70 65 63 74 20 74 6f 20 66 6f 75 72 20 64 69 | ter,.but.with.respect.to.four.di |
| 4fb60 | 66 66 65 72 65 6e 74 20 66 72 61 6d 65 73 2e 20 20 50 61 69 6e 74 65 72 73 20 63 61 6e 20 62 65 | fferent.frames...Painters.can.be |
| 4fb80 | 20 6d 6f 72 65 20 65 6c 61 62 6f 72 61 74 65 20 74 68 61 6e 0a 74 68 69 73 3a 20 54 68 65 20 70 | .more.elaborate.than.this:.The.p |
| 4fba0 | 72 69 6d 69 74 69 76 65 20 70 61 69 6e 74 65 72 20 63 61 6c 6c 65 64 20 60 72 6f 67 65 72 73 27 | rimitive.painter.called.`rogers' |
| 4fbc0 | 20 70 61 69 6e 74 73 20 61 20 70 69 63 74 75 72 65 20 6f 66 20 4d 49 54 27 73 0a 66 6f 75 6e 64 | .paints.a.picture.of.MIT's.found |
| 4fbe0 | 65 72 2c 20 57 69 6c 6c 69 61 6d 20 42 61 72 74 6f 6e 20 52 6f 67 65 72 73 2c 20 61 73 20 73 68 | er,.William.Barton.Rogers,.as.sh |
| 4fc00 | 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 31 3a 3a 2e 28 32 29 20 54 | own.in.*Note.Figure.2-11::.(2).T |
| 4fc20 | 68 65 0a 66 6f 75 72 20 69 6d 61 67 65 73 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 | he.four.images.in.*Note.Figure.2 |
| 4fc40 | 2d 31 31 3a 3a 20 61 72 65 20 64 72 61 77 6e 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 | -11::.are.drawn.with.respect.to. |
| 4fc60 | 74 68 65 20 73 61 6d 65 0a 66 6f 75 72 20 66 72 61 6d 65 73 20 61 73 20 74 68 65 20 60 77 61 76 | the.same.four.frames.as.the.`wav |
| 4fc80 | 65 27 20 69 6d 61 67 65 73 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 30 3a 3a | e'.images.in.*Note.Figure.2-10:: |
| 4fca0 | 2e 0a 0a 20 20 20 54 6f 20 63 6f 6d 62 69 6e 65 20 69 6d 61 67 65 73 2c 20 77 65 20 75 73 65 20 | ......To.combine.images,.we.use. |
| 4fcc0 | 76 61 72 69 6f 75 73 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 63 6f 6e 73 74 72 75 63 | various.operations.that.construc |
| 4fce0 | 74 20 6e 65 77 0a 70 61 69 6e 74 65 72 73 20 66 72 6f 6d 20 67 69 76 65 6e 20 70 61 69 6e 74 65 | t.new.painters.from.given.painte |
| 4fd00 | 72 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 60 62 65 73 69 64 65 27 20 6f | rs...For.example,.the.`beside'.o |
| 4fd20 | 70 65 72 61 74 69 6f 6e 0a 74 61 6b 65 73 20 74 77 6f 20 70 61 69 6e 74 65 72 73 20 61 6e 64 20 | peration.takes.two.painters.and. |
| 4fd40 | 70 72 6f 64 75 63 65 73 20 61 20 6e 65 77 2c 20 63 6f 6d 70 6f 75 6e 64 20 70 61 69 6e 74 65 72 | produces.a.new,.compound.painter |
| 4fd60 | 20 74 68 61 74 20 64 72 61 77 73 20 74 68 65 0a 66 69 72 73 74 20 70 61 69 6e 74 65 72 27 73 20 | .that.draws.the.first.painter's. |
| 4fd80 | 69 6d 61 67 65 20 69 6e 20 74 68 65 20 6c 65 66 74 20 68 61 6c 66 20 6f 66 20 74 68 65 20 66 72 | image.in.the.left.half.of.the.fr |
| 4fda0 | 61 6d 65 20 61 6e 64 20 74 68 65 20 73 65 63 6f 6e 64 0a 70 61 69 6e 74 65 72 27 73 20 69 6d 61 | ame.and.the.second.painter's.ima |
| 4fdc0 | 67 65 20 69 6e 20 74 68 65 20 72 69 67 68 74 20 68 61 6c 66 20 6f 66 20 74 68 65 20 66 72 61 6d | ge.in.the.right.half.of.the.fram |
| 4fde0 | 65 2e 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 60 62 65 6c 6f 77 27 0a 74 61 6b 65 73 20 74 77 6f | e...Similarly,.`below'.takes.two |
| 4fe00 | 20 70 61 69 6e 74 65 72 73 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 61 20 63 6f 6d 70 6f 75 6e | .painters.and.produces.a.compoun |
| 4fe20 | 64 20 70 61 69 6e 74 65 72 20 74 68 61 74 20 64 72 61 77 73 20 74 68 65 20 66 69 72 73 74 0a 70 | d.painter.that.draws.the.first.p |
| 4fe40 | 61 69 6e 74 65 72 27 73 20 69 6d 61 67 65 20 62 65 6c 6f 77 20 74 68 65 20 73 65 63 6f 6e 64 20 | ainter's.image.below.the.second. |
| 4fe60 | 70 61 69 6e 74 65 72 27 73 20 69 6d 61 67 65 2e 20 20 53 6f 6d 65 20 6f 70 65 72 61 74 69 6f 6e | painter's.image...Some.operation |
| 4fe80 | 73 0a 74 72 61 6e 73 66 6f 72 6d 20 61 20 73 69 6e 67 6c 65 20 70 61 69 6e 74 65 72 20 74 6f 20 | s.transform.a.single.painter.to. |
| 4fea0 | 70 72 6f 64 75 63 65 20 61 20 6e 65 77 20 70 61 69 6e 74 65 72 2e 20 20 46 6f 72 20 65 78 61 6d | produce.a.new.painter...For.exam |
| 4fec0 | 70 6c 65 2c 0a 60 66 6c 69 70 2d 76 65 72 74 27 20 74 61 6b 65 73 20 61 20 70 61 69 6e 74 65 72 | ple,.`flip-vert'.takes.a.painter |
| 4fee0 | 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 61 20 70 61 69 6e 74 65 72 20 74 68 61 74 20 64 72 61 | .and.produces.a.painter.that.dra |
| 4ff00 | 77 73 20 69 74 73 20 69 6d 61 67 65 0a 75 70 73 69 64 65 2d 64 6f 77 6e 2c 20 61 6e 64 20 60 66 | ws.its.image.upside-down,.and.`f |
| 4ff20 | 6c 69 70 2d 68 6f 72 69 7a 27 20 70 72 6f 64 75 63 65 73 20 61 20 70 61 69 6e 74 65 72 20 74 68 | lip-horiz'.produces.a.painter.th |
| 4ff40 | 61 74 20 64 72 61 77 73 20 74 68 65 0a 6f 72 69 67 69 6e 61 6c 20 70 61 69 6e 74 65 72 27 73 20 | at.draws.the.original.painter's. |
| 4ff60 | 69 6d 61 67 65 20 6c 65 66 74 2d 74 6f 2d 72 69 67 68 74 20 72 65 76 65 72 73 65 64 2e 0a 0a 20 | image.left-to-right.reversed.... |
| 4ff80 | 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 31 30 3a 2a 20 49 6d 61 67 65 73 20 70 72 6f 64 75 63 | ....*Figure.2.10:*.Images.produc |
| 4ffa0 | 65 64 20 62 79 20 74 68 65 20 60 77 61 76 65 27 20 70 61 69 6e 74 65 72 2c 20 77 69 74 68 20 72 | ed.by.the.`wave'.painter,.with.r |
| 4ffc0 | 65 73 70 65 63 74 0a 20 20 20 20 20 74 6f 20 66 6f 75 72 20 64 69 66 66 65 72 65 6e 74 20 66 72 | espect......to.four.different.fr |
| 4ffe0 | 61 6d 65 73 2e 20 20 54 68 65 20 66 72 61 6d 65 73 2c 20 73 68 6f 77 6e 20 77 69 74 68 20 64 6f | ames...The.frames,.shown.with.do |
| 50000 | 74 74 65 64 20 6c 69 6e 65 73 2c 0a 20 20 20 20 20 61 72 65 20 6e 6f 74 20 70 61 72 74 20 6f 66 | tted.lines,......are.not.part.of |
| 50020 | 20 74 68 65 20 69 6d 61 67 65 73 2e 0a 0a 20 20 20 20 20 5b 66 6f 75 72 20 67 72 61 70 68 69 63 | .the.images........[four.graphic |
| 50040 | 20 69 6d 61 67 65 73 20 6e 6f 74 20 69 6e 63 6c 75 64 65 64 5d 0a 0a 20 20 20 20 20 2a 46 69 67 | .images.not.included].......*Fig |
| 50060 | 75 72 65 20 32 2e 31 31 3a 2a 20 49 6d 61 67 65 73 20 6f 66 20 57 69 6c 6c 69 61 6d 20 42 61 72 | ure.2.11:*.Images.of.William.Bar |
| 50080 | 74 6f 6e 20 52 6f 67 65 72 73 2c 20 66 6f 75 6e 64 65 72 20 61 6e 64 20 66 69 72 73 74 0a 20 20 | ton.Rogers,.founder.and.first... |
| 500a0 | 20 20 20 70 72 65 73 69 64 65 6e 74 20 6f 66 20 4d 49 54 2c 20 70 61 69 6e 74 65 64 20 77 69 74 | ...president.of.MIT,.painted.wit |
| 500c0 | 68 20 72 65 73 70 65 63 74 20 74 6f 20 74 68 65 20 73 61 6d 65 20 66 6f 75 72 20 66 72 61 6d 65 | h.respect.to.the.same.four.frame |
| 500e0 | 73 20 61 73 0a 20 20 20 20 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 30 3a 3a | s.as......in.*Note.Figure.2-10:: |
| 50100 | 20 28 6f 72 69 67 69 6e 61 6c 20 69 6d 61 67 65 20 72 65 70 72 69 6e 74 65 64 20 77 69 74 68 20 | .(original.image.reprinted.with. |
| 50120 | 74 68 65 0a 20 20 20 20 20 70 65 72 6d 69 73 73 69 6f 6e 20 6f 66 20 74 68 65 20 4d 49 54 20 4d | the......permission.of.the.MIT.M |
| 50140 | 75 73 65 75 6d 29 2e 0a 0a 20 20 20 20 20 5b 66 6f 75 72 20 67 72 61 70 68 69 63 20 69 6d 61 67 | useum)........[four.graphic.imag |
| 50160 | 65 73 20 6e 6f 74 20 69 6e 63 6c 75 64 65 64 5d 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 | es.not.included].....*Note.Figur |
| 50180 | 65 20 32 2d 31 32 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 64 72 61 77 69 6e 67 20 6f 66 20 61 20 | e.2-12::.shows.the.drawing.of.a. |
| 501a0 | 70 61 69 6e 74 65 72 20 63 61 6c 6c 65 64 20 60 77 61 76 65 34 27 0a 74 68 61 74 20 69 73 20 62 | painter.called.`wave4'.that.is.b |
| 501c0 | 75 69 6c 74 20 75 70 20 69 6e 20 74 77 6f 20 73 74 61 67 65 73 20 73 74 61 72 74 69 6e 67 20 66 | uilt.up.in.two.stages.starting.f |
| 501e0 | 72 6f 6d 20 60 77 61 76 65 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 77 61 76 65 32 20 | rom.`wave':.......(define.wave2. |
| 50200 | 28 62 65 73 69 64 65 20 77 61 76 65 20 28 66 6c 69 70 2d 76 65 72 74 20 77 61 76 65 29 29 29 0a | (beside.wave.(flip-vert.wave))). |
| 50220 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 77 61 76 65 34 20 28 62 65 6c 6f 77 20 77 61 76 65 32 20 | .....(define.wave4.(below.wave2. |
| 50240 | 77 61 76 65 32 29 29 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 31 32 3a 2a 20 43 72 65 | wave2)).......*Figure.2.12:*.Cre |
| 50260 | 61 74 69 6e 67 20 61 20 63 6f 6d 70 6c 65 78 20 66 69 67 75 72 65 2c 20 73 74 61 72 74 69 6e 67 | ating.a.complex.figure,.starting |
| 50280 | 20 66 72 6f 6d 20 74 68 65 20 60 77 61 76 65 27 0a 20 20 20 20 20 70 61 69 6e 74 65 72 20 6f 66 | .from.the.`wave'......painter.of |
| 502a0 | 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 30 3a 3a 2e 0a 0a 20 20 20 20 20 5b 74 77 6f | .*Note.Figure.2-10::........[two |
| 502c0 | 20 67 72 61 70 68 69 63 20 69 6d 61 67 65 73 20 6e 6f 74 20 69 6e 63 6c 75 64 65 64 5d 0a 0a 20 | .graphic.images.not.included]... |
| 502e0 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 77 61 76 65 32 20 20 20 20 20 20 20 20 20 20 | .........(define.wave2.......... |
| 50300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 77 61 76 65 34 0a 20 20 20 | ...............(define.wave4.... |
| 50320 | 20 20 20 20 20 20 20 20 20 28 62 65 73 69 64 65 20 77 61 76 65 20 28 66 6c 69 70 2d 76 65 72 74 | .........(beside.wave.(flip-vert |
| 50340 | 20 77 61 76 65 29 29 29 20 20 20 20 20 20 20 28 62 65 6c 6f 77 20 77 61 76 65 32 20 77 61 76 65 | .wave))).......(below.wave2.wave |
| 50360 | 32 29 29 0a 0a 20 20 20 49 6e 20 62 75 69 6c 64 69 6e 67 20 75 70 20 61 20 63 6f 6d 70 6c 65 78 | 2)).....In.building.up.a.complex |
| 50380 | 20 69 6d 61 67 65 20 69 6e 20 74 68 69 73 20 6d 61 6e 6e 65 72 20 77 65 20 61 72 65 20 65 78 70 | .image.in.this.manner.we.are.exp |
| 503a0 | 6c 6f 69 74 69 6e 67 20 74 68 65 0a 66 61 63 74 20 74 68 61 74 20 70 61 69 6e 74 65 72 73 20 61 | loiting.the.fact.that.painters.a |
| 503c0 | 72 65 20 63 6c 6f 73 65 64 20 75 6e 64 65 72 20 74 68 65 20 6c 61 6e 67 75 61 67 65 27 73 20 6d | re.closed.under.the.language's.m |
| 503e0 | 65 61 6e 73 20 6f 66 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 2e 20 20 54 68 65 20 60 62 65 73 69 64 | eans.of.combination...The.`besid |
| 50400 | 65 27 20 6f 72 20 60 62 65 6c 6f 77 27 20 6f 66 20 74 77 6f 20 70 61 69 6e 74 65 72 73 20 69 73 | e'.or.`below'.of.two.painters.is |
| 50420 | 20 69 74 73 65 6c 66 20 61 0a 70 61 69 6e 74 65 72 3b 20 74 68 65 72 65 66 6f 72 65 2c 20 77 65 | .itself.a.painter;.therefore,.we |
| 50440 | 20 63 61 6e 20 75 73 65 20 69 74 20 61 73 20 61 6e 20 65 6c 65 6d 65 6e 74 20 69 6e 20 6d 61 6b | .can.use.it.as.an.element.in.mak |
| 50460 | 69 6e 67 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 0a 70 61 69 6e 74 65 72 73 2e 20 20 41 73 20 77 | ing.more.complex.painters...As.w |
| 50480 | 69 74 68 20 62 75 69 6c 64 69 6e 67 20 75 70 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 20 75 | ith.building.up.list.structure.u |
| 504a0 | 73 69 6e 67 20 60 63 6f 6e 73 27 2c 20 74 68 65 20 63 6c 6f 73 75 72 65 0a 6f 66 20 6f 75 72 20 | sing.`cons',.the.closure.of.our. |
| 504c0 | 64 61 74 61 20 75 6e 64 65 72 20 74 68 65 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 | data.under.the.means.of.combinat |
| 504e0 | 69 6f 6e 20 69 73 20 63 72 75 63 69 61 6c 20 74 6f 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f | ion.is.crucial.to.the.ability.to |
| 50500 | 0a 63 72 65 61 74 65 20 63 6f 6d 70 6c 65 78 20 73 74 72 75 63 74 75 72 65 73 20 77 68 69 6c 65 | .create.complex.structures.while |
| 50520 | 20 75 73 69 6e 67 20 6f 6e 6c 79 20 61 20 66 65 77 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 | .using.only.a.few.operations.... |
| 50540 | 20 20 4f 6e 63 65 20 77 65 20 63 61 6e 20 63 6f 6d 62 69 6e 65 20 70 61 69 6e 74 65 72 73 2c 20 | ..Once.we.can.combine.painters,. |
| 50560 | 77 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 20 62 65 20 61 62 6c 65 20 74 6f 20 61 62 73 74 | we.would.like.to.be.able.to.abst |
| 50580 | 72 61 63 74 0a 74 79 70 69 63 61 6c 20 70 61 74 74 65 72 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 69 | ract.typical.patterns.of.combini |
| 505a0 | 6e 67 20 70 61 69 6e 74 65 72 73 2e 20 20 57 65 20 77 69 6c 6c 20 69 6d 70 6c 65 6d 65 6e 74 20 | ng.painters...We.will.implement. |
| 505c0 | 74 68 65 20 70 61 69 6e 74 65 72 0a 6f 70 65 72 61 74 69 6f 6e 73 20 61 73 20 53 63 68 65 6d 65 | the.painter.operations.as.Scheme |
| 505e0 | 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 54 68 69 73 20 6d 65 61 6e 73 20 74 68 61 74 20 77 65 | .procedures...This.means.that.we |
| 50600 | 20 64 6f 6e 27 74 20 6e 65 65 64 20 61 0a 73 70 65 63 69 61 6c 20 61 62 73 74 72 61 63 74 69 6f | .don't.need.a.special.abstractio |
| 50620 | 6e 20 6d 65 63 68 61 6e 69 73 6d 20 69 6e 20 74 68 65 20 70 69 63 74 75 72 65 20 6c 61 6e 67 75 | n.mechanism.in.the.picture.langu |
| 50640 | 61 67 65 3a 20 53 69 6e 63 65 20 74 68 65 20 6d 65 61 6e 73 0a 6f 66 20 63 6f 6d 62 69 6e 61 74 | age:.Since.the.means.of.combinat |
| 50660 | 69 6f 6e 20 61 72 65 20 6f 72 64 69 6e 61 72 79 20 53 63 68 65 6d 65 20 70 72 6f 63 65 64 75 72 | ion.are.ordinary.Scheme.procedur |
| 50680 | 65 73 2c 20 77 65 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 68 61 76 65 0a 74 68 65 20 63 61 | es,.we.automatically.have.the.ca |
| 506a0 | 70 61 62 69 6c 69 74 79 20 74 6f 20 64 6f 20 61 6e 79 74 68 69 6e 67 20 77 69 74 68 20 70 61 69 | pability.to.do.anything.with.pai |
| 506c0 | 6e 74 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 77 65 20 63 61 6e 20 64 6f 0a 77 | nter.operations.that.we.can.do.w |
| 506e0 | 69 74 68 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 | ith.procedures...For.example,.we |
| 50700 | 20 63 61 6e 20 61 62 73 74 72 61 63 74 20 74 68 65 20 70 61 74 74 65 72 6e 20 69 6e 20 60 77 61 | .can.abstract.the.pattern.in.`wa |
| 50720 | 76 65 34 27 20 61 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6c 69 70 70 65 64 2d 70 | ve4'.as.......(define.(flipped-p |
| 50740 | 61 69 72 73 20 70 61 69 6e 74 65 72 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 61 69 6e | airs.painter)........(let.((pain |
| 50760 | 74 65 72 32 20 28 62 65 73 69 64 65 20 70 61 69 6e 74 65 72 20 28 66 6c 69 70 2d 76 65 72 74 20 | ter2.(beside.painter.(flip-vert. |
| 50780 | 70 61 69 6e 74 65 72 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 62 65 6c 6f 77 20 70 61 69 6e | painter))))..........(below.pain |
| 507a0 | 74 65 72 32 20 70 61 69 6e 74 65 72 32 29 29 29 0a 0a 61 6e 64 20 64 65 66 69 6e 65 20 60 77 61 | ter2.painter2)))..and.define.`wa |
| 507c0 | 76 65 34 27 20 61 73 20 61 6e 20 69 6e 73 74 61 6e 63 65 20 6f 66 20 74 68 69 73 20 70 61 74 74 | ve4'.as.an.instance.of.this.patt |
| 507e0 | 65 72 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 77 61 76 65 34 20 28 66 6c 69 70 70 65 | ern:.......(define.wave4.(flippe |
| 50800 | 64 2d 70 61 69 72 73 20 77 61 76 65 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 61 6c 73 6f 20 64 | d-pairs.wave)).....We.can.also.d |
| 50820 | 65 66 69 6e 65 20 72 65 63 75 72 73 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 48 65 72 | efine.recursive.operations...Her |
| 50840 | 65 27 73 20 6f 6e 65 20 74 68 61 74 20 6d 61 6b 65 73 0a 70 61 69 6e 74 65 72 73 20 73 70 6c 69 | e's.one.that.makes.painters.spli |
| 50860 | 74 20 61 6e 64 20 62 72 61 6e 63 68 20 74 6f 77 61 72 64 73 20 74 68 65 20 72 69 67 68 74 20 61 | t.and.branch.towards.the.right.a |
| 50880 | 73 20 73 68 6f 77 6e 20 69 6e 20 66 69 67 75 72 65 73 20 2a 4e 6f 74 65 0a 46 69 67 75 72 65 20 | s.shown.in.figures.*Note.Figure. |
| 508a0 | 32 2d 31 33 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 34 3a 3a 3a 0a | 2-13::.and.*Note.Figure.2-14:::. |
| 508c0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 69 67 68 74 2d 73 70 6c 69 74 20 70 61 69 6e 74 | ......(define.(right-split.paint |
| 508e0 | 65 72 20 6e 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 | er.n)........(if.(=.n.0)........ |
| 50900 | 20 20 20 20 70 61 69 6e 74 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 6d | ....painter............(let.((sm |
| 50920 | 61 6c 6c 65 72 20 28 72 69 67 68 74 2d 73 70 6c 69 74 20 70 61 69 6e 74 65 72 20 28 2d 20 6e 20 | aller.(right-split.painter.(-.n. |
| 50940 | 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 73 69 64 65 20 70 61 69 6e 74 | 1))))..............(beside.paint |
| 50960 | 65 72 20 28 62 65 6c 6f 77 20 73 6d 61 6c 6c 65 72 20 73 6d 61 6c 6c 65 72 29 29 29 29 29 0a 0a | er.(below.smaller.smaller))))).. |
| 50980 | 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 31 33 3a 2a 20 52 65 63 75 72 73 69 76 65 20 70 6c | .....*Figure.2.13:*.Recursive.pl |
| 509a0 | 61 6e 73 20 66 6f 72 20 60 72 69 67 68 74 2d 73 70 6c 69 74 27 20 61 6e 64 0a 20 20 20 20 20 60 | ans.for.`right-split'.and......` |
| 509c0 | 63 6f 72 6e 65 72 2d 73 70 6c 69 74 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d | corner-split'.............+----- |
| 509e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2d | --------+-------------+....+---- |
| 50a00 | 2d 2d 2b 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 | --+------+-------------+........ |
| 50a20 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | ...|.............|.............| |
| 50a40 | 20 20 20 20 7c 20 75 70 2d 20 20 7c 20 75 70 2d 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....|.up-..|.up-..|............. |
| 50a60 | 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 72 69 67 68 | |...........|.............|.righ |
| 50a80 | 74 2d 73 70 6c 69 74 20 7c 20 20 20 20 7c 20 73 70 6c 69 74 7c 20 73 70 6c 69 74 7c 20 63 6f 72 | t-split.|....|.split|.split|.cor |
| 50aa0 | 6e 65 72 2d 73 70 6c 69 74 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | ner-split|...........|.......... |
| 50ac0 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 7c 20 20 20 20 20 20 7c 20 20 | ...|.............|....|......|.. |
| 50ae0 | 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 | ....|.............|...........|. |
| 50b00 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 6e 2d 31 20 20 20 20 20 7c 20 20 20 20 7c | ............|.....n-1.....|....| |
| 50b20 | 20 20 6e 2d 31 20 7c 20 20 6e 2d 31 20 7c 20 20 20 20 20 6e 2d 31 20 20 20 20 20 7c 0a 20 20 20 | ..n-1.|..n-1.|.....n-1.....|.... |
| 50b40 | 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | .......|.............|.......... |
| 50b60 | 20 20 20 7c 20 20 20 20 7c 20 20 20 20 20 20 7c 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 | ...|....|......|......|......... |
| 50b80 | 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 69 64 65 6e 74 69 74 79 20 20 20 2b 2d | ....|...........|..identity...+- |
| 50ba0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2b | ------------+....+------+------+ |
| 50bc0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | -------------+...........|...... |
| 50be0 | 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 7c 20 20 20 20 20 | .......|.............|....|..... |
| 50c00 | 20 20 20 20 20 20 20 20 7c 20 72 69 67 68 74 2d 73 70 6c 69 74 20 7c 0a 20 20 20 20 20 20 20 20 | ........|.right-split.|......... |
| 50c20 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 72 69 67 68 74 2d 73 70 6c 69 74 20 7c 20 | ..|.............|.right-split.|. |
| 50c40 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 6e 2d 31 20 20 20 20 20 7c | ...|.............|.....n-1.....| |
| 50c60 | 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | ...........|.............|...... |
| 50c80 | 20 20 20 20 20 20 20 7c 20 20 20 20 7c 20 20 69 64 65 6e 74 69 74 79 20 20 20 2b 2d 2d 2d 2d 2d | .......|....|..identity...+----- |
| 50ca0 | 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 | --------+...........|........... |
| 50cc0 | 20 20 7c 20 20 20 20 20 6e 2d 31 20 20 20 20 20 7c 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | ..|.....n-1.....|....|.......... |
| 50ce0 | 20 20 20 7c 20 72 69 67 68 74 2d 73 70 6c 69 74 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ...|.right-split.|...........|.. |
| 50d00 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 7c 20 | ...........|.............|....|. |
| 50d20 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 6e 2d 31 20 20 20 20 20 7c 0a 20 20 20 20 | ............|.....n-1.....|..... |
| 50d40 | 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ......+-------------+----------- |
| 50d60 | 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | --+....+-------------+---------- |
| 50d80 | 2d 2d 2d 2b 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 69 67 68 74 2d 73 70 6c | ---+...................right-spl |
| 50da0 | 69 74 20 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 72 6e 65 72 2d 73 | it.n....................corner-s |
| 50dc0 | 70 6c 69 74 20 6e 0a 0a 20 20 20 57 65 20 63 61 6e 20 70 72 6f 64 75 63 65 20 62 61 6c 61 6e 63 | plit.n.....We.can.produce.balanc |
| 50de0 | 65 64 20 70 61 74 74 65 72 6e 73 20 62 79 20 62 72 61 6e 63 68 69 6e 67 20 75 70 77 61 72 64 73 | ed.patterns.by.branching.upwards |
| 50e00 | 20 61 73 20 77 65 6c 6c 20 61 73 0a 74 6f 77 61 72 64 73 20 74 68 65 20 72 69 67 68 74 20 28 73 | .as.well.as.towards.the.right.(s |
| 50e20 | 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 34 34 3a 3a 20 61 6e 64 20 66 69 67 | ee.*Note.Exercise.2-44::.and.fig |
| 50e40 | 75 72 65 73 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a 32 2d 31 33 3a 3a 20 61 6e 64 20 2a 4e 6f | ures.*Note.Figure.2-13::.and.*No |
| 50e60 | 74 65 20 46 69 67 75 72 65 20 32 2d 31 34 3a 3a 29 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | te.Figure.2-14::):.......(define |
| 50e80 | 20 28 63 6f 72 6e 65 72 2d 73 70 6c 69 74 20 70 61 69 6e 74 65 72 20 6e 29 0a 20 20 20 20 20 20 | .(corner-split.painter.n)....... |
| 50ea0 | 20 28 69 66 20 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 70 61 69 6e 74 65 72 0a | .(if.(=.n.0)............painter. |
| 50ec0 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 75 70 20 28 75 70 2d 73 70 6c 69 74 20 70 | ...........(let.((up.(up-split.p |
| 50ee0 | 61 69 6e 74 65 72 20 28 2d 20 6e 20 31 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ainter.(-.n.1)))................ |
| 50f00 | 20 20 28 72 69 67 68 74 20 28 72 69 67 68 74 2d 73 70 6c 69 74 20 70 61 69 6e 74 65 72 20 28 2d | ..(right.(right-split.painter.(- |
| 50f20 | 20 6e 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 6f 70 | .n.1))))..............(let.((top |
| 50f40 | 2d 6c 65 66 74 20 28 62 65 73 69 64 65 20 75 70 20 75 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 | -left.(beside.up.up))........... |
| 50f60 | 20 20 20 20 20 20 20 20 20 28 62 6f 74 74 6f 6d 2d 72 69 67 68 74 20 28 62 65 6c 6f 77 20 72 69 | .........(bottom-right.(below.ri |
| 50f80 | 67 68 74 20 72 69 67 68 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ght.right))....................( |
| 50fa0 | 63 6f 72 6e 65 72 20 28 63 6f 72 6e 65 72 2d 73 70 6c 69 74 20 70 61 69 6e 74 65 72 20 28 2d 20 | corner.(corner-split.painter.(-. |
| 50fc0 | 6e 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 73 69 64 65 20 28 | n.1))))................(beside.( |
| 50fe0 | 62 65 6c 6f 77 20 70 61 69 6e 74 65 72 20 74 6f 70 2d 6c 65 66 74 29 0a 20 20 20 20 20 20 20 20 | below.painter.top-left)......... |
| 51000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 6c 6f 77 20 62 6f 74 74 6f 6d 2d 72 69 67 | ...............(below.bottom-rig |
| 51020 | 68 74 20 63 6f 72 6e 65 72 29 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e | ht.corner)))))).......*Figure.2. |
| 51040 | 31 34 3a 2a 20 54 68 65 20 72 65 63 75 72 73 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 60 72 | 14:*.The.recursive.operations.`r |
| 51060 | 69 67 68 74 2d 73 70 6c 69 74 27 20 61 6e 64 0a 20 20 20 20 20 60 63 6f 72 6e 65 72 2d 73 70 6c | ight-split'.and......`corner-spl |
| 51080 | 69 74 27 20 61 70 70 6c 69 65 64 20 74 6f 20 74 68 65 20 70 61 69 6e 74 65 72 73 20 60 77 61 76 | it'.applied.to.the.painters.`wav |
| 510a0 | 65 27 20 61 6e 64 20 60 72 6f 67 65 72 73 27 2e 0a 20 20 20 20 20 43 6f 6d 62 69 6e 69 6e 67 20 | e'.and.`rogers'.......Combining. |
| 510c0 | 66 6f 75 72 20 60 63 6f 72 6e 65 72 2d 73 70 6c 69 74 27 20 66 69 67 75 72 65 73 20 70 72 6f 64 | four.`corner-split'.figures.prod |
| 510e0 | 75 63 65 73 20 73 79 6d 6d 65 74 72 69 63 0a 20 20 20 20 20 60 73 71 75 61 72 65 2d 6c 69 6d 69 | uces.symmetric......`square-limi |
| 51100 | 74 27 20 64 65 73 69 67 6e 73 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 | t'.designs.as.shown.in.*Note.Fig |
| 51120 | 75 72 65 20 32 2d 39 3a 3a 2e 0a 0a 20 20 20 20 20 5b 74 77 6f 20 67 72 61 70 68 69 63 20 69 6d | ure.2-9::........[two.graphic.im |
| 51140 | 61 67 65 73 20 6e 6f 74 20 69 6e 63 6c 75 64 65 64 5d 0a 0a 20 20 20 20 20 20 20 20 20 20 28 72 | ages.not.included]............(r |
| 51160 | 69 67 68 74 2d 73 70 6c 69 74 20 77 61 76 65 20 34 29 20 20 20 20 20 20 20 20 20 28 72 69 67 68 | ight-split.wave.4).........(righ |
| 51180 | 74 2d 73 70 6c 69 74 20 72 6f 67 65 72 73 20 34 29 0a 0a 20 20 20 20 20 5b 74 77 6f 20 67 72 61 | t-split.rogers.4).......[two.gra |
| 511a0 | 70 68 69 63 20 69 6d 61 67 65 73 20 6e 6f 74 20 69 6e 63 6c 75 64 65 64 5d 0a 0a 20 20 20 20 20 | phic.images.not.included]....... |
| 511c0 | 20 20 20 20 20 28 63 6f 72 6e 65 72 2d 73 70 6c 69 74 20 77 61 76 65 20 34 29 20 20 20 20 20 20 | .....(corner-split.wave.4)...... |
| 511e0 | 20 20 28 63 6f 72 6e 65 72 2d 73 70 6c 69 74 20 72 6f 67 65 72 73 20 34 29 0a 0a 20 20 20 42 79 | ..(corner-split.rogers.4).....By |
| 51200 | 20 70 6c 61 63 69 6e 67 20 66 6f 75 72 20 63 6f 70 69 65 73 20 6f 66 20 61 20 60 63 6f 72 6e 65 | .placing.four.copies.of.a.`corne |
| 51220 | 72 2d 73 70 6c 69 74 27 20 61 70 70 72 6f 70 72 69 61 74 65 6c 79 2c 20 77 65 20 6f 62 74 61 69 | r-split'.appropriately,.we.obtai |
| 51240 | 6e 20 61 0a 70 61 74 74 65 72 6e 20 63 61 6c 6c 65 64 20 60 73 71 75 61 72 65 2d 6c 69 6d 69 74 | n.a.pattern.called.`square-limit |
| 51260 | 27 2c 20 77 68 6f 73 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 74 6f 20 60 77 61 76 65 27 20 61 | ',.whose.application.to.`wave'.a |
| 51280 | 6e 64 20 60 72 6f 67 65 72 73 27 0a 69 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 | nd.`rogers'.is.shown.in.*Note.Fi |
| 512a0 | 67 75 72 65 20 32 2d 39 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 | gure.2-9:::.......(define.(squar |
| 512c0 | 65 2d 6c 69 6d 69 74 20 70 61 69 6e 74 65 72 20 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 | e-limit.painter.n)........(let.( |
| 512e0 | 28 71 75 61 72 74 65 72 20 28 63 6f 72 6e 65 72 2d 73 70 6c 69 74 20 70 61 69 6e 74 65 72 20 6e | (quarter.(corner-split.painter.n |
| 51300 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 68 61 6c 66 20 28 62 65 73 69 64 65 | )))..........(let.((half.(beside |
| 51320 | 20 28 66 6c 69 70 2d 68 6f 72 69 7a 20 71 75 61 72 74 65 72 29 20 71 75 61 72 74 65 72 29 29 29 | .(flip-horiz.quarter).quarter))) |
| 51340 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 65 6c 6f 77 20 28 66 6c 69 70 2d 76 65 72 74 20 68 61 | ............(below.(flip-vert.ha |
| 51360 | 6c 66 29 20 68 61 6c 66 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 34 | lf).half)))).......*Exercise.2.4 |
| 51380 | 34 3a 2a 20 44 65 66 69 6e 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 75 70 2d 73 70 6c | 4:*.Define.the.procedure.`up-spl |
| 513a0 | 69 74 27 20 75 73 65 64 20 62 79 0a 20 20 20 20 20 60 63 6f 72 6e 65 72 2d 73 70 6c 69 74 27 2e | it'.used.by......`corner-split'. |
| 513c0 | 20 20 49 74 20 69 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 60 72 69 67 68 74 2d 73 70 6c 69 74 27 | ..It.is.similar.to.`right-split' |
| 513e0 | 2c 20 65 78 63 65 70 74 20 74 68 61 74 20 69 74 0a 20 20 20 20 20 73 77 69 74 63 68 65 73 20 74 | ,.except.that.it......switches.t |
| 51400 | 68 65 20 72 6f 6c 65 73 20 6f 66 20 60 62 65 6c 6f 77 27 20 61 6e 64 20 60 62 65 73 69 64 65 27 | he.roles.of.`below'.and.`beside' |
| 51420 | 2e 0a 0a 48 69 67 68 65 72 2d 6f 72 64 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e | ...Higher-order.operations...... |
| 51440 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 61 64 64 69 74 69 6f 6e 20 | ....................In.addition. |
| 51460 | 74 6f 20 61 62 73 74 72 61 63 74 69 6e 67 20 70 61 74 74 65 72 6e 73 20 6f 66 20 63 6f 6d 62 69 | to.abstracting.patterns.of.combi |
| 51480 | 6e 69 6e 67 20 70 61 69 6e 74 65 72 73 2c 20 77 65 20 63 61 6e 20 77 6f 72 6b 0a 61 74 20 61 20 | ning.painters,.we.can.work.at.a. |
| 514a0 | 68 69 67 68 65 72 20 6c 65 76 65 6c 2c 20 61 62 73 74 72 61 63 74 69 6e 67 20 70 61 74 74 65 72 | higher.level,.abstracting.patter |
| 514c0 | 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 69 6e 67 20 70 61 69 6e 74 65 72 0a 6f 70 65 72 61 74 69 6f | ns.of.combining.painter.operatio |
| 514e0 | 6e 73 2e 20 20 54 68 61 74 20 69 73 2c 20 77 65 20 63 61 6e 20 76 69 65 77 20 74 68 65 20 70 61 | ns...That.is,.we.can.view.the.pa |
| 51500 | 69 6e 74 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 73 20 65 6c 65 6d 65 6e 74 73 20 74 6f 0a | inter.operations.as.elements.to. |
| 51520 | 6d 61 6e 69 70 75 6c 61 74 65 20 61 6e 64 20 63 61 6e 20 77 72 69 74 65 20 6d 65 61 6e 73 20 6f | manipulate.and.can.write.means.o |
| 51540 | 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 73 65 0a 65 6c 65 6d 65 6e 74 73 | f.combination.for.these.elements |
| 51560 | 2d 2d 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 74 61 6b 65 20 70 61 69 6e 74 65 72 20 6f | --procedures.that.take.painter.o |
| 51580 | 70 65 72 61 74 69 6f 6e 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 0a 63 72 65 61 74 | perations.as.arguments.and.creat |
| 515a0 | 65 20 6e 65 77 20 70 61 69 6e 74 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 46 6f | e.new.painter.operations......Fo |
| 515c0 | 72 20 65 78 61 6d 70 6c 65 2c 20 60 66 6c 69 70 70 65 64 2d 70 61 69 72 73 27 20 61 6e 64 20 60 | r.example,.`flipped-pairs'.and.` |
| 515e0 | 73 71 75 61 72 65 2d 6c 69 6d 69 74 27 20 65 61 63 68 20 61 72 72 61 6e 67 65 20 66 6f 75 72 0a | square-limit'.each.arrange.four. |
| 51600 | 63 6f 70 69 65 73 20 6f 66 20 61 20 70 61 69 6e 74 65 72 27 73 20 69 6d 61 67 65 20 69 6e 20 61 | copies.of.a.painter's.image.in.a |
| 51620 | 20 73 71 75 61 72 65 20 70 61 74 74 65 72 6e 3b 20 74 68 65 79 20 64 69 66 66 65 72 20 6f 6e 6c | .square.pattern;.they.differ.onl |
| 51640 | 79 20 69 6e 0a 68 6f 77 20 74 68 65 79 20 6f 72 69 65 6e 74 20 74 68 65 20 63 6f 70 69 65 73 2e | y.in.how.they.orient.the.copies. |
| 51660 | 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 61 62 73 74 72 61 63 74 20 74 68 69 73 20 70 61 74 74 65 | ..One.way.to.abstract.this.patte |
| 51680 | 72 6e 20 6f 66 0a 70 61 69 6e 74 65 72 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 69 73 20 77 69 74 | rn.of.painter.combination.is.wit |
| 516a0 | 68 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 | h.the.following.procedure,.which |
| 516c0 | 20 74 61 6b 65 73 20 66 6f 75 72 0a 6f 6e 65 2d 61 72 67 75 6d 65 6e 74 20 70 61 69 6e 74 65 72 | .takes.four.one-argument.painter |
| 516e0 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 61 20 70 61 69 6e 74 | .operations.and.produces.a.paint |
| 51700 | 65 72 20 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 0a 74 72 61 6e 73 66 6f 72 6d 73 20 61 20 67 | er.operation.that.transforms.a.g |
| 51720 | 69 76 65 6e 20 70 61 69 6e 74 65 72 20 77 69 74 68 20 74 68 6f 73 65 20 66 6f 75 72 20 6f 70 65 | iven.painter.with.those.four.ope |
| 51740 | 72 61 74 69 6f 6e 73 20 61 6e 64 20 61 72 72 61 6e 67 65 73 20 74 68 65 0a 72 65 73 75 6c 74 73 | rations.and.arranges.the.results |
| 51760 | 20 69 6e 20 61 20 73 71 75 61 72 65 2e 20 20 60 54 6c 27 2c 20 60 74 72 27 2c 20 60 62 6c 27 2c | .in.a.square...`Tl',.`tr',.`bl', |
| 51780 | 20 61 6e 64 20 60 62 72 27 20 61 72 65 20 74 68 65 0a 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e | .and.`br'.are.the.transformation |
| 517a0 | 73 20 74 6f 20 61 70 70 6c 79 20 74 6f 20 74 68 65 20 74 6f 70 20 6c 65 66 74 20 63 6f 70 79 2c | s.to.apply.to.the.top.left.copy, |
| 517c0 | 20 74 68 65 20 74 6f 70 20 72 69 67 68 74 20 63 6f 70 79 2c 20 74 68 65 0a 62 6f 74 74 6f 6d 20 | .the.top.right.copy,.the.bottom. |
| 517e0 | 6c 65 66 74 20 63 6f 70 79 2c 20 61 6e 64 20 74 68 65 20 62 6f 74 74 6f 6d 20 72 69 67 68 74 20 | left.copy,.and.the.bottom.right. |
| 51800 | 63 6f 70 79 2c 20 72 65 73 70 65 63 74 69 76 65 6c 79 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | copy,.respectively........(defin |
| 51820 | 65 20 28 73 71 75 61 72 65 2d 6f 66 2d 66 6f 75 72 20 74 6c 20 74 72 20 62 6c 20 62 72 29 0a 20 | e.(square-of-four.tl.tr.bl.br).. |
| 51840 | 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 70 61 69 6e 74 65 72 29 0a 20 20 20 20 20 20 20 20 | ......(lambda.(painter)......... |
| 51860 | 20 28 6c 65 74 20 28 28 74 6f 70 20 28 62 65 73 69 64 65 20 28 74 6c 20 70 61 69 6e 74 65 72 29 | .(let.((top.(beside.(tl.painter) |
| 51880 | 20 28 74 72 20 70 61 69 6e 74 65 72 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .(tr.painter)))................( |
| 518a0 | 62 6f 74 74 6f 6d 20 28 62 65 73 69 64 65 20 28 62 6c 20 70 61 69 6e 74 65 72 29 20 28 62 72 20 | bottom.(beside.(bl.painter).(br. |
| 518c0 | 70 61 69 6e 74 65 72 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 65 6c 6f 77 20 62 6f | painter))))............(below.bo |
| 518e0 | 74 74 6f 6d 20 74 6f 70 29 29 29 29 0a 0a 20 20 20 54 68 65 6e 20 60 66 6c 69 70 70 65 64 2d 70 | ttom.top)))).....Then.`flipped-p |
| 51900 | 61 69 72 73 27 20 63 61 6e 20 62 65 20 64 65 66 69 6e 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 | airs'.can.be.defined.in.terms.of |
| 51920 | 20 60 73 71 75 61 72 65 2d 6f 66 2d 66 6f 75 72 27 20 61 73 0a 66 6f 6c 6c 6f 77 73 3a 28 33 29 | .`square-of-four'.as.follows:(3) |
| 51940 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6c 69 70 70 65 64 2d 70 61 69 72 73 20 70 61 | .......(define.(flipped-pairs.pa |
| 51960 | 69 6e 74 65 72 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 6f 6d 62 69 6e 65 34 20 28 73 | inter)........(let.((combine4.(s |
| 51980 | 71 75 61 72 65 2d 6f 66 2d 66 6f 75 72 20 69 64 65 6e 74 69 74 79 20 66 6c 69 70 2d 76 65 72 74 | quare-of-four.identity.flip-vert |
| 519a0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 519c0 | 20 20 20 20 20 20 20 20 69 64 65 6e 74 69 74 79 20 66 6c 69 70 2d 76 65 72 74 29 29 29 0a 20 20 | ........identity.flip-vert)))... |
| 519e0 | 20 20 20 20 20 20 20 28 63 6f 6d 62 69 6e 65 34 20 70 61 69 6e 74 65 72 29 29 29 0a 0a 61 6e 64 | .......(combine4.painter)))..and |
| 51a00 | 20 60 73 71 75 61 72 65 2d 6c 69 6d 69 74 27 20 63 61 6e 20 62 65 20 65 78 70 72 65 73 73 65 64 | .`square-limit'.can.be.expressed |
| 51a20 | 20 61 73 28 34 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 2d 6c 69 6d | .as(4).......(define.(square-lim |
| 51a40 | 69 74 20 70 61 69 6e 74 65 72 20 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 6f 6d 62 | it.painter.n)........(let.((comb |
| 51a60 | 69 6e 65 34 20 28 73 71 75 61 72 65 2d 6f 66 2d 66 6f 75 72 20 66 6c 69 70 2d 68 6f 72 69 7a 20 | ine4.(square-of-four.flip-horiz. |
| 51a80 | 69 64 65 6e 74 69 74 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | identity........................ |
| 51aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 6f 74 61 74 65 31 38 30 20 66 6c 69 70 2d 76 | ................rotate180.flip-v |
| 51ac0 | 65 72 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6d 62 69 6e 65 34 20 28 63 6f 72 6e 65 | ert)))..........(combine4.(corne |
| 51ae0 | 72 2d 73 70 6c 69 74 20 70 61 69 6e 74 65 72 20 6e 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 | r-split.painter.n)))).......*Exe |
| 51b00 | 72 63 69 73 65 20 32 2e 34 35 3a 2a 20 60 52 69 67 68 74 2d 73 70 6c 69 74 27 20 61 6e 64 20 60 | rcise.2.45:*.`Right-split'.and.` |
| 51b20 | 75 70 2d 73 70 6c 69 74 27 20 63 61 6e 20 62 65 20 65 78 70 72 65 73 73 65 64 20 61 73 0a 20 20 | up-split'.can.be.expressed.as... |
| 51b40 | 20 20 20 69 6e 73 74 61 6e 63 65 73 20 6f 66 20 61 20 67 65 6e 65 72 61 6c 20 73 70 6c 69 74 74 | ...instances.of.a.general.splitt |
| 51b60 | 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 2e 20 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 | ing.operation...Define.a.procedu |
| 51b80 | 72 65 0a 20 20 20 20 20 60 73 70 6c 69 74 27 20 77 69 74 68 20 74 68 65 20 70 72 6f 70 65 72 74 | re......`split'.with.the.propert |
| 51ba0 | 79 20 74 68 61 74 20 65 76 61 6c 75 61 74 69 6e 67 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | y.that.evaluating............(de |
| 51bc0 | 66 69 6e 65 20 72 69 67 68 74 2d 73 70 6c 69 74 20 28 73 70 6c 69 74 20 62 65 73 69 64 65 20 62 | fine.right-split.(split.beside.b |
| 51be0 | 65 6c 6f 77 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 75 70 2d 73 70 6c 69 | elow))...........(define.up-spli |
| 51c00 | 74 20 28 73 70 6c 69 74 20 62 65 6c 6f 77 20 62 65 73 69 64 65 29 29 0a 0a 20 20 20 20 20 70 72 | t.(split.below.beside)).......pr |
| 51c20 | 6f 64 75 63 65 73 20 70 72 6f 63 65 64 75 72 65 73 20 60 72 69 67 68 74 2d 73 70 6c 69 74 27 20 | oduces.procedures.`right-split'. |
| 51c40 | 61 6e 64 20 60 75 70 2d 73 70 6c 69 74 27 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 0a 20 20 20 | and.`up-split'.with.the.same.... |
| 51c60 | 20 20 62 65 68 61 76 69 6f 72 73 20 61 73 20 74 68 65 20 6f 6e 65 73 20 61 6c 72 65 61 64 79 20 | ..behaviors.as.the.ones.already. |
| 51c80 | 64 65 66 69 6e 65 64 2e 0a 0a 46 72 61 6d 65 73 0a 2e 2e 2e 2e 2e 2e 0a 0a 42 65 66 6f 72 65 20 | defined...Frames.........Before. |
| 51ca0 | 77 65 20 63 61 6e 20 73 68 6f 77 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 70 61 69 | we.can.show.how.to.implement.pai |
| 51cc0 | 6e 74 65 72 73 20 61 6e 64 20 74 68 65 69 72 20 6d 65 61 6e 73 20 6f 66 0a 63 6f 6d 62 69 6e 61 | nters.and.their.means.of.combina |
| 51ce0 | 74 69 6f 6e 2c 20 77 65 20 6d 75 73 74 20 66 69 72 73 74 20 63 6f 6e 73 69 64 65 72 20 66 72 61 | tion,.we.must.first.consider.fra |
| 51d00 | 6d 65 73 2e 20 20 41 20 66 72 61 6d 65 20 63 61 6e 20 62 65 20 64 65 73 63 72 69 62 65 64 0a 62 | mes...A.frame.can.be.described.b |
| 51d20 | 79 20 74 68 72 65 65 20 76 65 63 74 6f 72 73 2d 2d 61 6e 20 6f 72 69 67 69 6e 20 76 65 63 74 6f | y.three.vectors--an.origin.vecto |
| 51d40 | 72 20 61 6e 64 20 74 77 6f 20 65 64 67 65 20 76 65 63 74 6f 72 73 2e 20 20 54 68 65 20 6f 72 69 | r.and.two.edge.vectors...The.ori |
| 51d60 | 67 69 6e 0a 76 65 63 74 6f 72 20 73 70 65 63 69 66 69 65 73 20 74 68 65 20 6f 66 66 73 65 74 20 | gin.vector.specifies.the.offset. |
| 51d80 | 6f 66 20 74 68 65 20 66 72 61 6d 65 27 73 20 6f 72 69 67 69 6e 20 66 72 6f 6d 20 73 6f 6d 65 20 | of.the.frame's.origin.from.some. |
| 51da0 | 61 62 73 6f 6c 75 74 65 0a 6f 72 69 67 69 6e 20 69 6e 20 74 68 65 20 70 6c 61 6e 65 2c 20 61 6e | absolute.origin.in.the.plane,.an |
| 51dc0 | 64 20 74 68 65 20 65 64 67 65 20 76 65 63 74 6f 72 73 20 73 70 65 63 69 66 79 20 74 68 65 20 6f | d.the.edge.vectors.specify.the.o |
| 51de0 | 66 66 73 65 74 73 20 6f 66 20 74 68 65 0a 66 72 61 6d 65 27 73 20 63 6f 72 6e 65 72 73 20 66 72 | ffsets.of.the.frame's.corners.fr |
| 51e00 | 6f 6d 20 69 74 73 20 6f 72 69 67 69 6e 2e 20 20 49 66 20 74 68 65 20 65 64 67 65 73 20 61 72 65 | om.its.origin...If.the.edges.are |
| 51e20 | 20 70 65 72 70 65 6e 64 69 63 75 6c 61 72 2c 20 74 68 65 0a 66 72 61 6d 65 20 77 69 6c 6c 20 62 | .perpendicular,.the.frame.will.b |
| 51e40 | 65 20 72 65 63 74 61 6e 67 75 6c 61 72 2e 20 20 4f 74 68 65 72 77 69 73 65 20 74 68 65 20 66 72 | e.rectangular...Otherwise.the.fr |
| 51e60 | 61 6d 65 20 77 69 6c 6c 20 62 65 20 61 20 6d 6f 72 65 20 67 65 6e 65 72 61 6c 0a 70 61 72 61 6c | ame.will.be.a.more.general.paral |
| 51e80 | 6c 65 6c 6f 67 72 61 6d 2e 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 35 3a | lelogram......*Note.Figure.2-15: |
| 51ea0 | 3a 20 73 68 6f 77 73 20 61 20 66 72 61 6d 65 20 61 6e 64 20 69 74 73 20 61 73 73 6f 63 69 61 74 | :.shows.a.frame.and.its.associat |
| 51ec0 | 65 64 20 76 65 63 74 6f 72 73 2e 20 20 49 6e 0a 61 63 63 6f 72 64 61 6e 63 65 20 77 69 74 68 20 | ed.vectors...In.accordance.with. |
| 51ee0 | 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 77 65 20 6e 65 65 64 20 6e 6f 74 20 62 65 | data.abstraction,.we.need.not.be |
| 51f00 | 20 73 70 65 63 69 66 69 63 20 79 65 74 20 61 62 6f 75 74 20 68 6f 77 0a 66 72 61 6d 65 73 20 61 | .specific.yet.about.how.frames.a |
| 51f20 | 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 2c 20 6f 74 68 65 72 20 74 68 61 6e 20 74 6f 20 73 61 | re.represented,.other.than.to.sa |
| 51f40 | 79 20 74 68 61 74 20 74 68 65 72 65 20 69 73 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 0a 60 6d | y.that.there.is.a.constructor.`m |
| 51f60 | 61 6b 65 2d 66 72 61 6d 65 27 2c 20 77 68 69 63 68 20 74 61 6b 65 73 20 74 68 72 65 65 20 76 65 | ake-frame',.which.takes.three.ve |
| 51f80 | 63 74 6f 72 73 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 61 20 66 72 61 6d 65 2c 20 61 6e 64 20 | ctors.and.produces.a.frame,.and. |
| 51fa0 | 74 68 72 65 65 0a 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 73 65 6c 65 63 74 6f 72 73 20 60 6f | three.corresponding.selectors.`o |
| 51fc0 | 72 69 67 69 6e 2d 66 72 61 6d 65 27 2c 20 60 65 64 67 65 31 2d 66 72 61 6d 65 27 2c 20 61 6e 64 | rigin-frame',.`edge1-frame',.and |
| 51fe0 | 0a 60 65 64 67 65 32 2d 66 72 61 6d 65 27 20 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 | .`edge2-frame'.(see.*Note.Exerci |
| 52000 | 73 65 20 32 2d 34 37 3a 3a 29 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 31 35 3a 2a | se.2-47::)........*Figure.2.15:* |
| 52020 | 20 41 20 66 72 61 6d 65 20 69 73 20 64 65 73 63 72 69 62 65 64 20 62 79 20 74 68 72 65 65 20 76 | .A.frame.is.described.by.three.v |
| 52040 | 65 63 74 6f 72 73 20 2d 20 61 6e 20 6f 72 69 67 69 6e 0a 20 20 20 20 20 61 6e 64 20 74 77 6f 20 | ectors.-.an.origin......and.two. |
| 52060 | 65 64 67 65 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | edges........................... |
| 52080 | 20 20 20 20 20 20 20 20 20 20 20 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........__................... |
| 520a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 2d 2d 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 | .............__--..\............ |
| 520c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 2d 2d 20 20 20 20 20 20 20 5c 0a 20 20 20 | ................__--.......\.... |
| 520e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 20 20 20 20 20 5f 5f 2d 2d 20 20 20 20 20 20 20 20 | .............__.....__--........ |
| 52100 | 20 20 20 20 5c 20 20 20 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 5c 20 20 5f 5f | ....\...__................|\..__ |
| 52120 | 2d 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 5f 5f 2d 7c 0a 20 20 20 20 20 20 20 | --.................\__-|........ |
| 52140 | 20 20 20 20 20 20 20 20 20 20 5c 2d 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f | ..........\-..................__ |
| 52160 | 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 66 72 61 6d 65 20 20 20 5c 20 20 20 20 20 20 20 20 20 20 | --...........frame...\.......... |
| 52180 | 20 20 20 20 5f 5f 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 65 64 67 65 32 20 20 20 20 5c 20 20 20 | ....__--...........edge2....\... |
| 521a0 | 20 20 20 20 20 20 5f 5f 2d 2d 20 20 20 20 66 72 61 6d 65 0a 20 20 20 20 20 20 20 20 20 20 76 65 | ......__--....frame...........ve |
| 521c0 | 63 74 6f 72 20 20 20 20 5c 20 20 20 20 5f 5f 2d 2d 20 20 20 20 20 20 20 20 65 64 67 65 31 0a 20 | ctor....\....__--........edge1.. |
| 521e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 5f 2d 2d 20 20 20 20 20 20 20 20 | ....................\_--........ |
| 52200 | 20 20 20 20 76 65 63 74 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....vector...................... |
| 52220 | 20 2d 20 20 20 3c 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 72 | .-...<--+.....................fr |
| 52240 | 61 6d 65 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6f 72 69 | ame....|.....................ori |
| 52260 | 67 69 6e 20 20 20 2b 2d 2d 20 28 30 2c 30 29 20 70 6f 69 6e 74 0a 20 20 20 20 20 20 20 20 20 20 | gin...+--.(0,0).point........... |
| 52280 | 20 20 20 20 20 20 20 20 20 20 76 65 63 74 6f 72 20 20 20 20 20 20 20 6f 6e 20 64 69 73 70 6c 61 | ..........vector.......on.displa |
| 522a0 | 79 20 73 63 72 65 65 6e 0a 0a 20 20 20 57 65 20 77 69 6c 6c 20 75 73 65 20 63 6f 6f 72 64 69 6e | y.screen.....We.will.use.coordin |
| 522c0 | 61 74 65 73 20 69 6e 20 74 68 65 20 75 6e 69 74 20 73 71 75 61 72 65 20 28 30 3c 3d 20 78 2c 79 | ates.in.the.unit.square.(0<=.x,y |
| 522e0 | 3c 3d 20 31 29 20 74 6f 20 73 70 65 63 69 66 79 0a 69 6d 61 67 65 73 2e 20 20 57 69 74 68 20 65 | <=.1).to.specify.images...With.e |
| 52300 | 61 63 68 20 66 72 61 6d 65 2c 20 77 65 20 61 73 73 6f 63 69 61 74 65 20 61 20 22 66 72 61 6d 65 | ach.frame,.we.associate.a."frame |
| 52320 | 20 63 6f 6f 72 64 69 6e 61 74 65 20 6d 61 70 22 2c 20 77 68 69 63 68 0a 77 69 6c 6c 20 62 65 20 | .coordinate.map",.which.will.be. |
| 52340 | 75 73 65 64 20 74 6f 20 73 68 69 66 74 20 61 6e 64 20 73 63 61 6c 65 20 69 6d 61 67 65 73 20 74 | used.to.shift.and.scale.images.t |
| 52360 | 6f 20 66 69 74 20 74 68 65 20 66 72 61 6d 65 2e 20 20 54 68 65 20 6d 61 70 0a 74 72 61 6e 73 66 | o.fit.the.frame...The.map.transf |
| 52380 | 6f 72 6d 73 20 74 68 65 20 75 6e 69 74 20 73 71 75 61 72 65 20 69 6e 74 6f 20 74 68 65 20 66 72 | orms.the.unit.square.into.the.fr |
| 523a0 | 61 6d 65 20 62 79 20 6d 61 70 70 69 6e 67 20 74 68 65 20 76 65 63 74 6f 72 20 76 20 3d 0a 28 78 | ame.by.mapping.the.vector.v.=.(x |
| 523c0 | 2c 79 29 20 74 6f 20 74 68 65 20 76 65 63 74 6f 72 20 73 75 6d 0a 0a 20 20 20 20 20 4f 72 69 67 | ,y).to.the.vector.sum.......Orig |
| 523e0 | 69 6e 28 46 72 61 6d 65 29 20 2b 20 72 20 2a 20 45 64 67 65 5f 31 28 46 72 61 6d 65 29 20 2b 20 | in(Frame).+.r.*.Edge_1(Frame).+. |
| 52400 | 79 20 2a 20 45 64 67 65 5f 32 28 46 72 61 6d 65 29 0a 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 | y.*.Edge_2(Frame)..For.example,. |
| 52420 | 28 30 2c 30 29 20 69 73 20 6d 61 70 70 65 64 20 74 6f 20 74 68 65 20 6f 72 69 67 69 6e 20 6f 66 | (0,0).is.mapped.to.the.origin.of |
| 52440 | 20 74 68 65 20 66 72 61 6d 65 2c 20 28 31 2c 31 29 20 74 6f 20 74 68 65 0a 76 65 72 74 65 78 20 | .the.frame,.(1,1).to.the.vertex. |
| 52460 | 64 69 61 67 6f 6e 61 6c 6c 79 20 6f 70 70 6f 73 69 74 65 20 74 68 65 20 6f 72 69 67 69 6e 2c 20 | diagonally.opposite.the.origin,. |
| 52480 | 61 6e 64 20 28 30 2e 35 2c 30 2e 35 29 20 74 6f 20 74 68 65 20 63 65 6e 74 65 72 20 6f 66 0a 74 | and.(0.5,0.5).to.the.center.of.t |
| 524a0 | 68 65 20 66 72 61 6d 65 2e 20 20 57 65 20 63 61 6e 20 63 72 65 61 74 65 20 61 20 66 72 61 6d 65 | he.frame...We.can.create.a.frame |
| 524c0 | 27 73 20 63 6f 6f 72 64 69 6e 61 74 65 20 6d 61 70 20 77 69 74 68 20 74 68 65 20 66 6f 6c 6c 6f | 's.coordinate.map.with.the.follo |
| 524e0 | 77 69 6e 67 0a 70 72 6f 63 65 64 75 72 65 3a 28 35 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | wing.procedure:(5).......(define |
| 52500 | 20 28 66 72 61 6d 65 2d 63 6f 6f 72 64 2d 6d 61 70 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 | .(frame-coord-map.frame)........ |
| 52520 | 28 6c 61 6d 62 64 61 20 28 76 29 0a 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 76 65 63 74 0a 20 | (lambda.(v)..........(add-vect.. |
| 52540 | 20 20 20 20 20 20 20 20 20 28 6f 72 69 67 69 6e 2d 66 72 61 6d 65 20 66 72 61 6d 65 29 0a 20 20 | .........(origin-frame.frame)... |
| 52560 | 20 20 20 20 20 20 20 20 28 61 64 64 2d 76 65 63 74 20 28 73 63 61 6c 65 2d 76 65 63 74 20 28 78 | ........(add-vect.(scale-vect.(x |
| 52580 | 63 6f 72 2d 76 65 63 74 20 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | cor-vect.v)..................... |
| 525a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 65 64 67 65 31 2d 66 72 61 6d 65 20 66 72 61 6d 65 29 29 | ............(edge1-frame.frame)) |
| 525c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 63 61 6c 65 2d 76 65 63 74 | .....................(scale-vect |
| 525e0 | 20 28 79 63 6f 72 2d 76 65 63 74 20 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(ycor-vect.v).................. |
| 52600 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 64 67 65 32 2d 66 72 61 6d 65 20 66 72 61 6d | ...............(edge2-frame.fram |
| 52620 | 65 29 29 29 29 29 29 0a 0a 20 20 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 61 70 70 6c 79 69 6e | e)))))).....Observe.that.applyin |
| 52640 | 67 20 60 66 72 61 6d 65 2d 63 6f 6f 72 64 2d 6d 61 70 27 20 74 6f 20 61 20 66 72 61 6d 65 20 72 | g.`frame-coord-map'.to.a.frame.r |
| 52660 | 65 74 75 72 6e 73 20 61 0a 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 2c 20 67 69 76 65 6e 20 61 | eturns.a.procedure.that,.given.a |
| 52680 | 20 76 65 63 74 6f 72 2c 20 72 65 74 75 72 6e 73 20 61 20 76 65 63 74 6f 72 2e 20 20 49 66 20 74 | .vector,.returns.a.vector...If.t |
| 526a0 | 68 65 20 61 72 67 75 6d 65 6e 74 0a 76 65 63 74 6f 72 20 69 73 20 69 6e 20 74 68 65 20 75 6e 69 | he.argument.vector.is.in.the.uni |
| 526c0 | 74 20 73 71 75 61 72 65 2c 20 74 68 65 20 72 65 73 75 6c 74 20 76 65 63 74 6f 72 20 77 69 6c 6c | t.square,.the.result.vector.will |
| 526e0 | 20 62 65 20 69 6e 20 74 68 65 20 66 72 61 6d 65 2e 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a | .be.in.the.frame..For.example,.. |
| 52700 | 20 20 20 20 20 28 28 66 72 61 6d 65 2d 63 6f 6f 72 64 2d 6d 61 70 20 61 2d 66 72 61 6d 65 29 20 | .....((frame-coord-map.a-frame). |
| 52720 | 28 6d 61 6b 65 2d 76 65 63 74 20 30 20 30 29 29 0a 0a 72 65 74 75 72 6e 73 20 74 68 65 20 73 61 | (make-vect.0.0))..returns.the.sa |
| 52740 | 6d 65 20 76 65 63 74 6f 72 20 61 73 0a 0a 20 20 20 20 20 28 6f 72 69 67 69 6e 2d 66 72 61 6d 65 | me.vector.as.......(origin-frame |
| 52760 | 20 61 2d 66 72 61 6d 65 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 34 36 3a 2a | .a-frame).......*Exercise.2.46:* |
| 52780 | 20 41 20 74 77 6f 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 76 65 63 74 6f 72 20 76 20 72 75 6e 6e | .A.two-dimensional.vector.v.runn |
| 527a0 | 69 6e 67 20 66 72 6f 6d 20 74 68 65 0a 20 20 20 20 20 6f 72 69 67 69 6e 20 74 6f 20 61 20 70 6f | ing.from.the......origin.to.a.po |
| 527c0 | 69 6e 74 20 63 61 6e 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 70 61 69 72 | int.can.be.represented.as.a.pair |
| 527e0 | 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 61 6e 0a 20 20 20 20 20 78 2d 63 6f 6f 72 64 69 6e | .consisting.of.an......x-coordin |
| 52800 | 61 74 65 20 61 6e 64 20 61 20 79 2d 63 6f 6f 72 64 69 6e 61 74 65 2e 20 20 49 6d 70 6c 65 6d 65 | ate.and.a.y-coordinate...Impleme |
| 52820 | 6e 74 20 61 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 66 6f 72 0a 20 20 20 20 20 76 | nt.a.data.abstraction.for......v |
| 52840 | 65 63 74 6f 72 73 20 62 79 20 67 69 76 69 6e 67 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 | ectors.by.giving.a.constructor.` |
| 52860 | 6d 61 6b 65 2d 76 65 63 74 27 20 61 6e 64 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 0a 20 20 20 | make-vect'.and.corresponding.... |
| 52880 | 20 20 73 65 6c 65 63 74 6f 72 73 20 60 78 63 6f 72 2d 76 65 63 74 27 20 61 6e 64 20 60 79 63 6f | ..selectors.`xcor-vect'.and.`yco |
| 528a0 | 72 2d 76 65 63 74 27 2e 20 20 49 6e 20 74 65 72 6d 73 20 6f 66 20 79 6f 75 72 20 73 65 6c 65 63 | r-vect'...In.terms.of.your.selec |
| 528c0 | 74 6f 72 73 0a 20 20 20 20 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 6f 72 2c 20 69 6d 70 6c 65 | tors......and.constructor,.imple |
| 528e0 | 6d 65 6e 74 20 70 72 6f 63 65 64 75 72 65 73 20 60 61 64 64 2d 76 65 63 74 27 2c 20 60 73 75 62 | ment.procedures.`add-vect',.`sub |
| 52900 | 2d 76 65 63 74 27 2c 20 61 6e 64 0a 20 20 20 20 20 60 73 63 61 6c 65 2d 76 65 63 74 27 20 74 68 | -vect',.and......`scale-vect'.th |
| 52920 | 61 74 20 70 65 72 66 6f 72 6d 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 76 65 63 74 6f 72 | at.perform.the.operations.vector |
| 52940 | 20 61 64 64 69 74 69 6f 6e 2c 20 76 65 63 74 6f 72 0a 20 20 20 20 20 73 75 62 74 72 61 63 74 69 | .addition,.vector......subtracti |
| 52960 | 6f 6e 2c 20 61 6e 64 20 6d 75 6c 74 69 70 6c 79 69 6e 67 20 61 20 76 65 63 74 6f 72 20 62 79 20 | on,.and.multiplying.a.vector.by. |
| 52980 | 61 20 73 63 61 6c 61 72 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 78 5f 31 2c 20 79 5f 31 29 20 | a.scalar:............(x_1,.y_1). |
| 529a0 | 2b 20 28 78 5f 32 2c 20 79 5f 32 29 20 3d 20 28 78 5f 31 20 2b 20 78 5f 32 2c 20 79 5f 31 20 2b | +.(x_2,.y_2).=.(x_1.+.x_2,.y_1.+ |
| 529c0 | 20 79 5f 32 29 0a 20 20 20 20 20 20 20 20 20 20 28 78 5f 31 2c 20 79 5f 31 29 20 2d 20 28 78 5f | .y_2)...........(x_1,.y_1).-.(x_ |
| 529e0 | 32 2c 20 79 5f 32 29 20 3d 20 28 78 5f 31 20 2d 20 78 5f 32 2c 20 79 5f 31 20 2d 20 79 5f 32 29 | 2,.y_2).=.(x_1.-.x_2,.y_1.-.y_2) |
| 52a00 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 20 2a 20 28 78 2c 20 | ........................s.*.(x,. |
| 52a20 | 79 29 20 3d 20 28 73 78 2c 20 73 79 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e | y).=.(sx,.sy).......*Exercise.2. |
| 52a40 | 34 37 3a 2a 20 48 65 72 65 20 61 72 65 20 74 77 6f 20 70 6f 73 73 69 62 6c 65 20 63 6f 6e 73 74 | 47:*.Here.are.two.possible.const |
| 52a60 | 72 75 63 74 6f 72 73 20 66 6f 72 20 66 72 61 6d 65 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 | ructors.for.frames:............( |
| 52a80 | 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 61 6d 65 20 6f 72 69 67 69 6e 20 65 64 67 65 31 20 | define.(make-frame.origin.edge1. |
| 52aa0 | 65 64 67 65 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 6f 72 69 67 69 6e 20 | edge2).............(list.origin. |
| 52ac0 | 65 64 67 65 31 20 65 64 67 65 32 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | edge1.edge2))............(define |
| 52ae0 | 20 28 6d 61 6b 65 2d 66 72 61 6d 65 20 6f 72 69 67 69 6e 20 65 64 67 65 31 20 65 64 67 65 32 29 | .(make-frame.origin.edge1.edge2) |
| 52b00 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 6f 72 69 67 69 6e 20 28 63 6f 6e 73 20 | .............(cons.origin.(cons. |
| 52b20 | 65 64 67 65 31 20 65 64 67 65 32 29 29 29 0a 0a 20 20 20 20 20 46 6f 72 20 65 61 63 68 20 63 6f | edge1.edge2))).......For.each.co |
| 52b40 | 6e 73 74 72 75 63 74 6f 72 20 73 75 70 70 6c 79 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 | nstructor.supply.the.appropriate |
| 52b60 | 20 73 65 6c 65 63 74 6f 72 73 20 74 6f 20 70 72 6f 64 75 63 65 20 61 6e 0a 20 20 20 20 20 69 6d | .selectors.to.produce.an......im |
| 52b80 | 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 66 72 61 6d 65 73 2e 0a 0a 50 61 69 6e 74 65 | plementation.for.frames...Painte |
| 52ba0 | 72 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 20 70 61 69 6e 74 65 72 20 69 73 20 72 65 70 72 65 73 | rs...........A.painter.is.repres |
| 52bc0 | 65 6e 74 65 64 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 2c 20 67 69 76 65 6e | ented.as.a.procedure.that,.given |
| 52be0 | 20 61 20 66 72 61 6d 65 20 61 73 0a 61 72 67 75 6d 65 6e 74 2c 20 64 72 61 77 73 20 61 20 70 61 | .a.frame.as.argument,.draws.a.pa |
| 52c00 | 72 74 69 63 75 6c 61 72 20 69 6d 61 67 65 20 73 68 69 66 74 65 64 20 61 6e 64 20 73 63 61 6c 65 | rticular.image.shifted.and.scale |
| 52c20 | 64 20 74 6f 20 66 69 74 20 74 68 65 20 66 72 61 6d 65 2e 0a 54 68 61 74 20 69 73 20 74 6f 20 73 | d.to.fit.the.frame..That.is.to.s |
| 52c40 | 61 79 2c 20 69 66 20 60 70 27 20 69 73 20 61 20 70 61 69 6e 74 65 72 20 61 6e 64 20 60 66 27 20 | ay,.if.`p'.is.a.painter.and.`f'. |
| 52c60 | 69 73 20 61 20 66 72 61 6d 65 2c 20 74 68 65 6e 20 77 65 0a 70 72 6f 64 75 63 65 20 60 70 27 27 | is.a.frame,.then.we.produce.`p'' |
| 52c80 | 73 20 69 6d 61 67 65 20 69 6e 20 60 66 27 20 62 79 20 63 61 6c 6c 69 6e 67 20 60 70 27 20 77 69 | s.image.in.`f'.by.calling.`p'.wi |
| 52ca0 | 74 68 20 60 66 27 20 61 73 20 61 72 67 75 6d 65 6e 74 2e 0a 0a 20 20 20 54 68 65 20 64 65 74 61 | th.`f'.as.argument......The.deta |
| 52cc0 | 69 6c 73 20 6f 66 20 68 6f 77 20 70 72 69 6d 69 74 69 76 65 20 70 61 69 6e 74 65 72 73 20 61 72 | ils.of.how.primitive.painters.ar |
| 52ce0 | 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 64 65 70 65 6e 64 20 6f 6e 20 74 68 65 0a 70 61 72 74 | e.implemented.depend.on.the.part |
| 52d00 | 69 63 75 6c 61 72 20 63 68 61 72 61 63 74 65 72 69 73 74 69 63 73 20 6f 66 20 74 68 65 20 67 72 | icular.characteristics.of.the.gr |
| 52d20 | 61 70 68 69 63 73 20 73 79 73 74 65 6d 20 61 6e 64 20 74 68 65 20 74 79 70 65 20 6f 66 20 69 6d | aphics.system.and.the.type.of.im |
| 52d40 | 61 67 65 0a 74 6f 20 62 65 20 64 72 61 77 6e 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 | age.to.be.drawn...For.instance,. |
| 52d60 | 73 75 70 70 6f 73 65 20 77 65 20 68 61 76 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 64 72 61 | suppose.we.have.a.procedure.`dra |
| 52d80 | 77 2d 6c 69 6e 65 27 0a 74 68 61 74 20 64 72 61 77 73 20 61 20 6c 69 6e 65 20 6f 6e 20 74 68 65 | w-line'.that.draws.a.line.on.the |
| 52da0 | 20 73 63 72 65 65 6e 20 62 65 74 77 65 65 6e 20 74 77 6f 20 73 70 65 63 69 66 69 65 64 20 70 6f | .screen.between.two.specified.po |
| 52dc0 | 69 6e 74 73 2e 20 20 54 68 65 6e 20 77 65 0a 63 61 6e 20 63 72 65 61 74 65 20 70 61 69 6e 74 65 | ints...Then.we.can.create.painte |
| 52de0 | 72 73 20 66 6f 72 20 6c 69 6e 65 20 64 72 61 77 69 6e 67 73 2c 20 73 75 63 68 20 61 73 20 74 68 | rs.for.line.drawings,.such.as.th |
| 52e00 | 65 20 60 77 61 76 65 27 20 70 61 69 6e 74 65 72 20 69 6e 0a 2a 4e 6f 74 65 20 46 69 67 75 72 65 | e.`wave'.painter.in.*Note.Figure |
| 52e20 | 20 32 2d 31 30 3a 3a 2c 20 66 72 6f 6d 20 6c 69 73 74 73 20 6f 66 20 6c 69 6e 65 20 73 65 67 6d | .2-10::,.from.lists.of.line.segm |
| 52e40 | 65 6e 74 73 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 28 36 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | ents.as.follows:(6).......(defin |
| 52e60 | 65 20 28 73 65 67 6d 65 6e 74 73 2d 3e 70 61 69 6e 74 65 72 20 73 65 67 6d 65 6e 74 2d 6c 69 73 | e.(segments->painter.segment-lis |
| 52e80 | 74 29 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 66 72 61 6d 65 29 0a 20 20 20 20 20 20 | t)........(lambda.(frame)....... |
| 52ea0 | 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 | ...(for-each...........(lambda.( |
| 52ec0 | 73 65 67 6d 65 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 72 61 77 2d 6c 69 6e 65 0a | segment).............(draw-line. |
| 52ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 66 72 61 6d 65 2d 63 6f 6f 72 64 2d 6d 61 70 20 66 | .............((frame-coord-map.f |
| 52f00 | 72 61 6d 65 29 20 28 73 74 61 72 74 2d 73 65 67 6d 65 6e 74 20 73 65 67 6d 65 6e 74 29 29 0a 20 | rame).(start-segment.segment)).. |
| 52f20 | 20 20 20 20 20 20 20 20 20 20 20 20 28 28 66 72 61 6d 65 2d 63 6f 6f 72 64 2d 6d 61 70 20 66 72 | ............((frame-coord-map.fr |
| 52f40 | 61 6d 65 29 20 28 65 6e 64 2d 73 65 67 6d 65 6e 74 20 73 65 67 6d 65 6e 74 29 29 29 29 0a 20 20 | ame).(end-segment.segment))))... |
| 52f60 | 20 20 20 20 20 20 20 20 73 65 67 6d 65 6e 74 2d 6c 69 73 74 29 29 29 0a 0a 20 20 20 54 68 65 20 | ........segment-list))).....The. |
| 52f80 | 73 65 67 6d 65 6e 74 73 20 61 72 65 20 67 69 76 65 6e 20 75 73 69 6e 67 20 63 6f 6f 72 64 69 6e | segments.are.given.using.coordin |
| 52fa0 | 61 74 65 73 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 74 68 65 20 75 6e 69 74 0a 73 71 | ates.with.respect.to.the.unit.sq |
| 52fc0 | 75 61 72 65 2e 20 20 46 6f 72 20 65 61 63 68 20 73 65 67 6d 65 6e 74 20 69 6e 20 74 68 65 20 6c | uare...For.each.segment.in.the.l |
| 52fe0 | 69 73 74 2c 20 74 68 65 20 70 61 69 6e 74 65 72 20 74 72 61 6e 73 66 6f 72 6d 73 20 74 68 65 0a | ist,.the.painter.transforms.the. |
| 53000 | 73 65 67 6d 65 6e 74 20 65 6e 64 70 6f 69 6e 74 73 20 77 69 74 68 20 74 68 65 20 66 72 61 6d 65 | segment.endpoints.with.the.frame |
| 53020 | 20 63 6f 6f 72 64 69 6e 61 74 65 20 6d 61 70 20 61 6e 64 20 64 72 61 77 73 20 61 20 6c 69 6e 65 | .coordinate.map.and.draws.a.line |
| 53040 | 0a 62 65 74 77 65 65 6e 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 70 6f 69 6e 74 73 2e | .between.the.transformed.points. |
| 53060 | 0a 0a 20 20 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 70 61 69 6e 74 65 72 73 20 61 73 20 70 72 | .....Representing.painters.as.pr |
| 53080 | 6f 63 65 64 75 72 65 73 20 65 72 65 63 74 73 20 61 20 70 6f 77 65 72 66 75 6c 20 61 62 73 74 72 | ocedures.erects.a.powerful.abstr |
| 530a0 | 61 63 74 69 6f 6e 0a 62 61 72 72 69 65 72 20 69 6e 20 74 68 65 20 70 69 63 74 75 72 65 20 6c 61 | action.barrier.in.the.picture.la |
| 530c0 | 6e 67 75 61 67 65 2e 20 20 57 65 20 63 61 6e 20 63 72 65 61 74 65 20 61 6e 64 20 69 6e 74 65 72 | nguage...We.can.create.and.inter |
| 530e0 | 6d 69 78 20 61 6c 6c 20 73 6f 72 74 73 0a 6f 66 20 70 72 69 6d 69 74 69 76 65 20 70 61 69 6e 74 | mix.all.sorts.of.primitive.paint |
| 53100 | 65 72 73 2c 20 62 61 73 65 64 20 6f 6e 20 61 20 76 61 72 69 65 74 79 20 6f 66 20 67 72 61 70 68 | ers,.based.on.a.variety.of.graph |
| 53120 | 69 63 73 20 63 61 70 61 62 69 6c 69 74 69 65 73 2e 20 54 68 65 0a 64 65 74 61 69 6c 73 20 6f 66 | ics.capabilities..The.details.of |
| 53140 | 20 74 68 65 69 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 64 6f 20 6e 6f 74 20 6d 61 74 | .their.implementation.do.not.mat |
| 53160 | 74 65 72 2e 20 20 41 6e 79 20 70 72 6f 63 65 64 75 72 65 20 63 61 6e 20 73 65 72 76 65 0a 61 73 | ter...Any.procedure.can.serve.as |
| 53180 | 20 61 20 70 61 69 6e 74 65 72 2c 20 70 72 6f 76 69 64 65 64 20 74 68 61 74 20 69 74 20 74 61 6b | .a.painter,.provided.that.it.tak |
| 531a0 | 65 73 20 61 20 66 72 61 6d 65 20 61 73 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 64 72 61 77 73 | es.a.frame.as.argument.and.draws |
| 531c0 | 0a 73 6f 6d 65 74 68 69 6e 67 20 73 63 61 6c 65 64 20 74 6f 20 66 69 74 20 74 68 65 20 66 72 61 | .something.scaled.to.fit.the.fra |
| 531e0 | 6d 65 2e 28 37 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 34 38 3a 2a 20 41 20 | me.(7).......*Exercise.2.48:*.A. |
| 53200 | 64 69 72 65 63 74 65 64 20 6c 69 6e 65 20 73 65 67 6d 65 6e 74 20 69 6e 20 74 68 65 20 70 6c 61 | directed.line.segment.in.the.pla |
| 53220 | 6e 65 20 63 61 6e 20 62 65 0a 20 20 20 20 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 | ne.can.be......represented.as.a. |
| 53240 | 70 61 69 72 20 6f 66 20 76 65 63 74 6f 72 73 2d 2d 74 68 65 20 76 65 63 74 6f 72 20 72 75 6e 6e | pair.of.vectors--the.vector.runn |
| 53260 | 69 6e 67 20 66 72 6f 6d 20 74 68 65 0a 20 20 20 20 20 6f 72 69 67 69 6e 20 74 6f 20 74 68 65 20 | ing.from.the......origin.to.the. |
| 53280 | 73 74 61 72 74 2d 70 6f 69 6e 74 20 6f 66 20 74 68 65 20 73 65 67 6d 65 6e 74 2c 20 61 6e 64 20 | start-point.of.the.segment,.and. |
| 532a0 | 74 68 65 20 76 65 63 74 6f 72 20 72 75 6e 6e 69 6e 67 0a 20 20 20 20 20 66 72 6f 6d 20 74 68 65 | the.vector.running......from.the |
| 532c0 | 20 6f 72 69 67 69 6e 20 74 6f 20 74 68 65 20 65 6e 64 2d 70 6f 69 6e 74 20 6f 66 20 74 68 65 20 | .origin.to.the.end-point.of.the. |
| 532e0 | 73 65 67 6d 65 6e 74 2e 20 20 55 73 65 20 79 6f 75 72 20 76 65 63 74 6f 72 0a 20 20 20 20 20 72 | segment...Use.your.vector......r |
| 53300 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 72 6f 6d 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 | epresentation.from.*Note.Exercis |
| 53320 | 65 20 32 2d 34 36 3a 3a 20 74 6f 20 64 65 66 69 6e 65 20 61 0a 20 20 20 20 20 72 65 70 72 65 73 | e.2-46::.to.define.a......repres |
| 53340 | 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 73 65 67 6d 65 6e 74 73 20 77 69 74 68 20 61 20 63 6f 6e | entation.for.segments.with.a.con |
| 53360 | 73 74 72 75 63 74 6f 72 20 60 6d 61 6b 65 2d 73 65 67 6d 65 6e 74 27 20 61 6e 64 0a 20 20 20 20 | structor.`make-segment'.and..... |
| 53380 | 20 73 65 6c 65 63 74 6f 72 73 20 60 73 74 61 72 74 2d 73 65 67 6d 65 6e 74 27 20 61 6e 64 20 60 | .selectors.`start-segment'.and.` |
| 533a0 | 65 6e 64 2d 73 65 67 6d 65 6e 74 27 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e | end-segment'........*Exercise.2. |
| 533c0 | 34 39 3a 2a 20 55 73 65 20 60 73 65 67 6d 65 6e 74 73 2d 3e 70 61 69 6e 74 65 72 27 20 74 6f 20 | 49:*.Use.`segments->painter'.to. |
| 533e0 | 64 65 66 69 6e 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 20 20 20 20 20 70 72 69 6d 69 74 | define.the.following......primit |
| 53400 | 69 76 65 20 70 61 69 6e 74 65 72 73 3a 0a 0a 20 20 20 20 20 20 20 61 2e 20 54 68 65 20 70 61 69 | ive.painters:.........a..The.pai |
| 53420 | 6e 74 65 72 20 74 68 61 74 20 64 72 61 77 73 20 74 68 65 20 6f 75 74 6c 69 6e 65 20 6f 66 20 74 | nter.that.draws.the.outline.of.t |
| 53440 | 68 65 20 64 65 73 69 67 6e 61 74 65 64 20 66 72 61 6d 65 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 | he.designated.frame..........b.. |
| 53460 | 54 68 65 20 70 61 69 6e 74 65 72 20 74 68 61 74 20 64 72 61 77 73 20 61 6e 20 22 58 22 20 62 79 | The.painter.that.draws.an."X".by |
| 53480 | 20 63 6f 6e 6e 65 63 74 69 6e 67 20 6f 70 70 6f 73 69 74 65 20 63 6f 72 6e 65 72 73 0a 20 20 20 | .connecting.opposite.corners.... |
| 534a0 | 20 20 20 20 20 20 20 6f 66 20 74 68 65 20 66 72 61 6d 65 2e 0a 0a 20 20 20 20 20 20 20 63 2e 20 | .......of.the.frame..........c.. |
| 534c0 | 54 68 65 20 70 61 69 6e 74 65 72 20 74 68 61 74 20 64 72 61 77 73 20 61 20 64 69 61 6d 6f 6e 64 | The.painter.that.draws.a.diamond |
| 534e0 | 20 73 68 61 70 65 20 62 79 20 63 6f 6e 6e 65 63 74 69 6e 67 20 74 68 65 0a 20 20 20 20 20 20 20 | .shape.by.connecting.the........ |
| 53500 | 20 20 20 6d 69 64 70 6f 69 6e 74 73 20 6f 66 20 74 68 65 20 73 69 64 65 73 20 6f 66 20 74 68 65 | ...midpoints.of.the.sides.of.the |
| 53520 | 20 66 72 61 6d 65 2e 0a 0a 20 20 20 20 20 20 20 64 2e 20 54 68 65 20 60 77 61 76 65 27 20 70 61 | .frame..........d..The.`wave'.pa |
| 53540 | 69 6e 74 65 72 2e 0a 0a 0a 54 72 61 6e 73 66 6f 72 6d 69 6e 67 20 61 6e 64 20 63 6f 6d 62 69 6e | inter....Transforming.and.combin |
| 53560 | 69 6e 67 20 70 61 69 6e 74 65 72 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ing.painters.................... |
| 53580 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 6e 20 6f 70 65 72 61 74 69 6f 6e 20 6f | ..................An.operation.o |
| 535a0 | 6e 20 70 61 69 6e 74 65 72 73 20 28 73 75 63 68 20 61 73 20 60 66 6c 69 70 2d 76 65 72 74 27 20 | n.painters.(such.as.`flip-vert'. |
| 535c0 | 6f 72 20 60 62 65 73 69 64 65 27 29 20 77 6f 72 6b 73 20 62 79 0a 63 72 65 61 74 69 6e 67 20 61 | or.`beside').works.by.creating.a |
| 535e0 | 20 70 61 69 6e 74 65 72 20 74 68 61 74 20 69 6e 76 6f 6b 65 73 20 74 68 65 20 6f 72 69 67 69 6e | .painter.that.invokes.the.origin |
| 53600 | 61 6c 20 70 61 69 6e 74 65 72 73 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 0a 66 72 61 6d | al.painters.with.respect.to.fram |
| 53620 | 65 73 20 64 65 72 69 76 65 64 20 66 72 6f 6d 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 66 72 61 | es.derived.from.the.argument.fra |
| 53640 | 6d 65 2e 20 20 54 68 75 73 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 60 66 6c 69 70 2d 76 65 | me...Thus,.for.example,.`flip-ve |
| 53660 | 72 74 27 0a 64 6f 65 73 6e 27 74 20 68 61 76 65 20 74 6f 20 6b 6e 6f 77 20 68 6f 77 20 61 20 70 | rt'.doesn't.have.to.know.how.a.p |
| 53680 | 61 69 6e 74 65 72 20 77 6f 72 6b 73 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 66 6c 69 70 20 69 74 | ainter.works.in.order.to.flip.it |
| 536a0 | 2d 2d 69 74 20 6a 75 73 74 0a 68 61 73 20 74 6f 20 6b 6e 6f 77 20 68 6f 77 20 74 6f 20 74 75 72 | --it.just.has.to.know.how.to.tur |
| 536c0 | 6e 20 61 20 66 72 61 6d 65 20 75 70 73 69 64 65 20 64 6f 77 6e 3a 20 54 68 65 20 66 6c 69 70 70 | n.a.frame.upside.down:.The.flipp |
| 536e0 | 65 64 20 70 61 69 6e 74 65 72 20 6a 75 73 74 0a 75 73 65 73 20 74 68 65 20 6f 72 69 67 69 6e 61 | ed.painter.just.uses.the.origina |
| 53700 | 6c 20 70 61 69 6e 74 65 72 2c 20 62 75 74 20 69 6e 20 74 68 65 20 69 6e 76 65 72 74 65 64 20 66 | l.painter,.but.in.the.inverted.f |
| 53720 | 72 61 6d 65 2e 0a 0a 20 20 20 50 61 69 6e 74 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 72 65 | rame......Painter.operations.are |
| 53740 | 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 74 72 61 6e 73 66 6f | .based.on.the.procedure.`transfo |
| 53760 | 72 6d 2d 70 61 69 6e 74 65 72 27 2c 0a 77 68 69 63 68 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 | rm-painter',.which.takes.as.argu |
| 53780 | 6d 65 6e 74 73 20 61 20 70 61 69 6e 74 65 72 20 61 6e 64 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 | ments.a.painter.and.information. |
| 537a0 | 6f 6e 20 68 6f 77 20 74 6f 20 74 72 61 6e 73 66 6f 72 6d 0a 61 20 66 72 61 6d 65 20 61 6e 64 20 | on.how.to.transform.a.frame.and. |
| 537c0 | 70 72 6f 64 75 63 65 73 20 61 20 6e 65 77 20 70 61 69 6e 74 65 72 2e 20 20 54 68 65 20 74 72 61 | produces.a.new.painter...The.tra |
| 537e0 | 6e 73 66 6f 72 6d 65 64 20 70 61 69 6e 74 65 72 2c 20 77 68 65 6e 0a 63 61 6c 6c 65 64 20 6f 6e | nsformed.painter,.when.called.on |
| 53800 | 20 61 20 66 72 61 6d 65 2c 20 74 72 61 6e 73 66 6f 72 6d 73 20 74 68 65 20 66 72 61 6d 65 20 61 | .a.frame,.transforms.the.frame.a |
| 53820 | 6e 64 20 63 61 6c 6c 73 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 61 69 6e 74 65 72 0a 6f 6e | nd.calls.the.original.painter.on |
| 53840 | 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 66 72 61 6d 65 2e 20 20 54 68 65 20 61 72 67 | .the.transformed.frame...The.arg |
| 53860 | 75 6d 65 6e 74 73 20 74 6f 20 60 74 72 61 6e 73 66 6f 72 6d 2d 70 61 69 6e 74 65 72 27 20 61 72 | uments.to.`transform-painter'.ar |
| 53880 | 65 0a 70 6f 69 6e 74 73 20 28 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 76 65 63 74 6f 72 73 | e.points.(represented.as.vectors |
| 538a0 | 29 20 74 68 61 74 20 73 70 65 63 69 66 79 20 74 68 65 20 63 6f 72 6e 65 72 73 20 6f 66 20 74 68 | ).that.specify.the.corners.of.th |
| 538c0 | 65 20 6e 65 77 0a 66 72 61 6d 65 3a 20 57 68 65 6e 20 6d 61 70 70 65 64 20 69 6e 74 6f 20 74 68 | e.new.frame:.When.mapped.into.th |
| 538e0 | 65 20 66 72 61 6d 65 2c 20 74 68 65 20 66 69 72 73 74 20 70 6f 69 6e 74 20 73 70 65 63 69 66 69 | e.frame,.the.first.point.specifi |
| 53900 | 65 73 20 74 68 65 20 6e 65 77 0a 66 72 61 6d 65 27 73 20 6f 72 69 67 69 6e 20 61 6e 64 20 74 68 | es.the.new.frame's.origin.and.th |
| 53920 | 65 20 6f 74 68 65 72 20 74 77 6f 20 73 70 65 63 69 66 79 20 74 68 65 20 65 6e 64 73 20 6f 66 20 | e.other.two.specify.the.ends.of. |
| 53940 | 69 74 73 20 65 64 67 65 20 76 65 63 74 6f 72 73 2e 0a 54 68 75 73 2c 20 61 72 67 75 6d 65 6e 74 | its.edge.vectors..Thus,.argument |
| 53960 | 73 20 77 69 74 68 69 6e 20 74 68 65 20 75 6e 69 74 20 73 71 75 61 72 65 20 73 70 65 63 69 66 79 | s.within.the.unit.square.specify |
| 53980 | 20 61 20 66 72 61 6d 65 20 63 6f 6e 74 61 69 6e 65 64 20 77 69 74 68 69 6e 0a 74 68 65 20 6f 72 | .a.frame.contained.within.the.or |
| 539a0 | 69 67 69 6e 61 6c 20 66 72 61 6d 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 61 | iginal.frame........(define.(tra |
| 539c0 | 6e 73 66 6f 72 6d 2d 70 61 69 6e 74 65 72 20 70 61 69 6e 74 65 72 20 6f 72 69 67 69 6e 20 63 6f | nsform-painter.painter.origin.co |
| 539e0 | 72 6e 65 72 31 20 63 6f 72 6e 65 72 32 29 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 66 | rner1.corner2)........(lambda.(f |
| 53a00 | 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6d 20 28 66 72 61 6d 65 2d 63 | rame)..........(let.((m.(frame-c |
| 53a20 | 6f 6f 72 64 2d 6d 61 70 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 | oord-map.frame)))............(le |
| 53a40 | 74 20 28 28 6e 65 77 2d 6f 72 69 67 69 6e 20 28 6d 20 6f 72 69 67 69 6e 29 29 29 0a 20 20 20 20 | t.((new-origin.(m.origin)))..... |
| 53a60 | 20 20 20 20 20 20 20 20 20 28 70 61 69 6e 74 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .........(painter............... |
| 53a80 | 28 6d 61 6b 65 2d 66 72 61 6d 65 20 6e 65 77 2d 6f 72 69 67 69 6e 0a 20 20 20 20 20 20 20 20 20 | (make-frame.new-origin.......... |
| 53aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 75 62 2d 76 65 63 74 20 28 6d 20 63 6f | .................(sub-vect.(m.co |
| 53ac0 | 72 6e 65 72 31 29 20 6e 65 77 2d 6f 72 69 67 69 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | rner1).new-origin).............. |
| 53ae0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 75 62 2d 76 65 63 74 20 28 6d 20 63 6f 72 6e 65 72 | .............(sub-vect.(m.corner |
| 53b00 | 32 29 20 6e 65 77 2d 6f 72 69 67 69 6e 29 29 29 29 29 29 29 0a 0a 20 20 20 48 65 72 65 27 73 20 | 2).new-origin))))))).....Here's. |
| 53b20 | 68 6f 77 20 74 6f 20 66 6c 69 70 20 70 61 69 6e 74 65 72 20 69 6d 61 67 65 73 20 76 65 72 74 69 | how.to.flip.painter.images.verti |
| 53b40 | 63 61 6c 6c 79 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6c 69 70 2d 76 65 72 74 20 | cally:.......(define.(flip-vert. |
| 53b60 | 70 61 69 6e 74 65 72 29 0a 20 20 20 20 20 20 20 28 74 72 61 6e 73 66 6f 72 6d 2d 70 61 69 6e 74 | painter)........(transform-paint |
| 53b80 | 65 72 20 70 61 69 6e 74 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | er.painter...................... |
| 53ba0 | 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 30 2e 30 20 31 2e 30 29 20 20 20 3b 20 6e 65 77 | .....(make-vect.0.0.1.0)...;.new |
| 53bc0 | 20 60 6f 72 69 67 69 6e 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .`origin'....................... |
| 53be0 | 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 31 2e 30 20 31 2e 30 29 20 20 20 3b 20 6e 65 77 20 | ....(make-vect.1.0.1.0)...;.new. |
| 53c00 | 65 6e 64 20 6f 66 20 60 65 64 67 65 31 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | end.of.`edge1'.................. |
| 53c20 | 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 30 2e 30 20 30 2e 30 29 29 29 20 3b | .........(make-vect.0.0.0.0))).; |
| 53c40 | 20 6e 65 77 20 65 6e 64 20 6f 66 20 60 65 64 67 65 32 27 0a 0a 20 20 20 55 73 69 6e 67 20 60 74 | .new.end.of.`edge2'.....Using.`t |
| 53c60 | 72 61 6e 73 66 6f 72 6d 2d 70 61 69 6e 74 65 72 27 2c 20 77 65 20 63 61 6e 20 65 61 73 69 6c 79 | ransform-painter',.we.can.easily |
| 53c80 | 20 64 65 66 69 6e 65 20 6e 65 77 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 73 2e 0a 46 6f 72 | .define.new.transformations..For |
| 53ca0 | 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 64 65 66 69 6e 65 20 61 20 70 61 69 6e 74 65 | .example,.we.can.define.a.painte |
| 53cc0 | 72 20 74 68 61 74 20 73 68 72 69 6e 6b 73 20 69 74 73 20 69 6d 61 67 65 20 74 6f 20 74 68 65 0a | r.that.shrinks.its.image.to.the. |
| 53ce0 | 75 70 70 65 72 2d 72 69 67 68 74 20 71 75 61 72 74 65 72 20 6f 66 20 74 68 65 20 66 72 61 6d 65 | upper-right.quarter.of.the.frame |
| 53d00 | 20 69 74 20 69 73 20 67 69 76 65 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 68 72 | .it.is.given:.......(define.(shr |
| 53d20 | 69 6e 6b 2d 74 6f 2d 75 70 70 65 72 2d 72 69 67 68 74 20 70 61 69 6e 74 65 72 29 0a 20 20 20 20 | ink-to-upper-right.painter)..... |
| 53d40 | 20 20 20 28 74 72 61 6e 73 66 6f 72 6d 2d 70 61 69 6e 74 65 72 20 70 61 69 6e 74 65 72 0a 20 20 | ...(transform-painter.painter... |
| 53d60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 | ........................(make-ve |
| 53d80 | 63 74 20 30 2e 35 20 30 2e 35 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ct.0.5.0.5)..................... |
| 53da0 | 20 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 31 2e 30 20 30 2e 35 29 0a 20 20 20 20 20 20 | ......(make-vect.1.0.0.5)....... |
| 53dc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 30 | ....................(make-vect.0 |
| 53de0 | 2e 35 20 31 2e 30 29 29 29 0a 0a 20 20 20 4f 74 68 65 72 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 | .5.1.0))).....Other.transformati |
| 53e00 | 6f 6e 73 20 72 6f 74 61 74 65 20 69 6d 61 67 65 73 20 63 6f 75 6e 74 65 72 63 6c 6f 63 6b 77 69 | ons.rotate.images.counterclockwi |
| 53e20 | 73 65 20 62 79 20 39 30 20 64 65 67 72 65 65 73 28 38 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | se.by.90.degrees(8).......(defin |
| 53e40 | 65 20 28 72 6f 74 61 74 65 39 30 20 70 61 69 6e 74 65 72 29 0a 20 20 20 20 20 20 20 28 74 72 61 | e.(rotate90.painter)........(tra |
| 53e60 | 6e 73 66 6f 72 6d 2d 70 61 69 6e 74 65 72 20 70 61 69 6e 74 65 72 0a 20 20 20 20 20 20 20 20 20 | nsform-painter.painter.......... |
| 53e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 31 2e 30 20 | .................(make-vect.1.0. |
| 53ea0 | 30 2e 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | 0.0)...........................( |
| 53ec0 | 6d 61 6b 65 2d 76 65 63 74 20 31 2e 30 20 31 2e 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | make-vect.1.0.1.0).............. |
| 53ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 30 2e 30 20 30 2e 30 29 | .............(make-vect.0.0.0.0) |
| 53f00 | 29 29 0a 0a 6f 72 20 73 71 75 61 73 68 20 69 6d 61 67 65 73 20 74 6f 77 61 72 64 73 20 74 68 65 | ))..or.squash.images.towards.the |
| 53f20 | 20 63 65 6e 74 65 72 20 6f 66 20 74 68 65 20 66 72 61 6d 65 3a 28 39 29 0a 0a 20 20 20 20 20 28 | .center.of.the.frame:(9).......( |
| 53f40 | 64 65 66 69 6e 65 20 28 73 71 75 61 73 68 2d 69 6e 77 61 72 64 73 20 70 61 69 6e 74 65 72 29 0a | define.(squash-inwards.painter). |
| 53f60 | 20 20 20 20 20 20 20 28 74 72 61 6e 73 66 6f 72 6d 2d 70 61 69 6e 74 65 72 20 70 61 69 6e 74 65 | .......(transform-painter.painte |
| 53f80 | 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b | r...........................(mak |
| 53fa0 | 65 2d 76 65 63 74 20 30 2e 30 20 30 2e 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e-vect.0.0.0.0)................. |
| 53fc0 | 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 30 2e 36 35 20 30 2e 33 35 29 0a | ..........(make-vect.0.65.0.35). |
| 53fe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d | ..........................(make- |
| 54000 | 76 65 63 74 20 30 2e 33 35 20 30 2e 36 35 29 29 29 0a 0a 20 20 20 46 72 61 6d 65 20 74 72 61 6e | vect.0.35.0.65))).....Frame.tran |
| 54020 | 73 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 61 6c 73 6f 20 74 68 65 20 6b 65 79 20 74 6f 20 64 65 | sformation.is.also.the.key.to.de |
| 54040 | 66 69 6e 69 6e 67 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 69 6e 67 0a 74 77 6f 20 6f 72 | fining.means.of.combining.two.or |
| 54060 | 20 6d 6f 72 65 20 70 61 69 6e 74 65 72 73 2e 20 20 54 68 65 20 60 62 65 73 69 64 65 27 20 70 72 | .more.painters...The.`beside'.pr |
| 54080 | 6f 63 65 64 75 72 65 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 61 6b 65 73 20 74 77 6f 0a | ocedure,.for.example,.takes.two. |
| 540a0 | 70 61 69 6e 74 65 72 73 2c 20 74 72 61 6e 73 66 6f 72 6d 73 20 74 68 65 6d 20 74 6f 20 70 61 69 | painters,.transforms.them.to.pai |
| 540c0 | 6e 74 20 69 6e 20 74 68 65 20 6c 65 66 74 20 61 6e 64 20 72 69 67 68 74 20 68 61 6c 76 65 73 20 | nt.in.the.left.and.right.halves. |
| 540e0 | 6f 66 20 61 6e 0a 61 72 67 75 6d 65 6e 74 20 66 72 61 6d 65 20 72 65 73 70 65 63 74 69 76 65 6c | of.an.argument.frame.respectivel |
| 54100 | 79 2c 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 61 20 6e 65 77 2c 20 63 6f 6d 70 6f 75 6e 64 20 | y,.and.produces.a.new,.compound. |
| 54120 | 70 61 69 6e 74 65 72 2e 0a 57 68 65 6e 20 74 68 65 20 63 6f 6d 70 6f 75 6e 64 20 70 61 69 6e 74 | painter..When.the.compound.paint |
| 54140 | 65 72 20 69 73 20 67 69 76 65 6e 20 61 20 66 72 61 6d 65 2c 20 69 74 20 63 61 6c 6c 73 20 74 68 | er.is.given.a.frame,.it.calls.th |
| 54160 | 65 20 66 69 72 73 74 0a 74 72 61 6e 73 66 6f 72 6d 65 64 20 70 61 69 6e 74 65 72 20 74 6f 20 70 | e.first.transformed.painter.to.p |
| 54180 | 61 69 6e 74 20 69 6e 20 74 68 65 20 6c 65 66 74 20 68 61 6c 66 20 6f 66 20 74 68 65 20 66 72 61 | aint.in.the.left.half.of.the.fra |
| 541a0 | 6d 65 20 61 6e 64 20 63 61 6c 6c 73 0a 74 68 65 20 73 65 63 6f 6e 64 20 74 72 61 6e 73 66 6f 72 | me.and.calls.the.second.transfor |
| 541c0 | 6d 65 64 20 70 61 69 6e 74 65 72 20 74 6f 20 70 61 69 6e 74 20 69 6e 20 74 68 65 20 72 69 67 68 | med.painter.to.paint.in.the.righ |
| 541e0 | 74 20 68 61 6c 66 20 6f 66 20 74 68 65 20 66 72 61 6d 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 | t.half.of.the.frame:.......(defi |
| 54200 | 6e 65 20 28 62 65 73 69 64 65 20 70 61 69 6e 74 65 72 31 20 70 61 69 6e 74 65 72 32 29 0a 20 20 | ne.(beside.painter1.painter2)... |
| 54220 | 20 20 20 20 20 28 6c 65 74 20 28 28 73 70 6c 69 74 2d 70 6f 69 6e 74 20 28 6d 61 6b 65 2d 76 65 | .....(let.((split-point.(make-ve |
| 54240 | 63 74 20 30 2e 35 20 30 2e 30 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 61 | ct.0.5.0.0)))..........(let.((pa |
| 54260 | 69 6e 74 2d 6c 65 66 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 72 61 6e 73 66 | int-left.................(transf |
| 54280 | 6f 72 6d 2d 70 61 69 6e 74 65 72 20 70 61 69 6e 74 65 72 31 0a 20 20 20 20 20 20 20 20 20 20 20 | orm-painter.painter1............ |
| 542a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 | ........................(make-ve |
| 542c0 | 63 74 20 30 2e 30 20 30 2e 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ct.0.0.0.0)..................... |
| 542e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 70 6c 69 74 2d 70 6f 69 6e 74 0a 20 20 20 20 20 | ...............split-point...... |
| 54300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d | ..............................(m |
| 54320 | 61 6b 65 2d 76 65 63 74 20 30 2e 30 20 31 2e 30 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ake-vect.0.0.1.0)))............. |
| 54340 | 20 20 20 28 70 61 69 6e 74 2d 72 69 67 68 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...(paint-right................. |
| 54360 | 28 74 72 61 6e 73 66 6f 72 6d 2d 70 61 69 6e 74 65 72 20 70 61 69 6e 74 65 72 32 0a 20 20 20 20 | (transform-painter.painter2..... |
| 54380 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 | ...............................s |
| 543a0 | 70 6c 69 74 2d 70 6f 69 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | plit-point...................... |
| 543c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 31 2e 30 20 30 2e 30 | ..............(make-vect.1.0.0.0 |
| 543e0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | )............................... |
| 54400 | 20 20 20 20 20 28 6d 61 6b 65 2d 76 65 63 74 20 30 2e 35 20 31 2e 30 29 29 29 29 0a 20 20 20 20 | .....(make-vect.0.5.1.0))))..... |
| 54420 | 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 | .......(lambda.(frame).......... |
| 54440 | 20 20 20 20 28 70 61 69 6e 74 2d 6c 65 66 74 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 | ....(paint-left.frame).......... |
| 54460 | 20 20 20 20 28 70 61 69 6e 74 2d 72 69 67 68 74 20 66 72 61 6d 65 29 29 29 29 29 0a 0a 20 20 20 | ....(paint-right.frame)))))..... |
| 54480 | 4f 62 73 65 72 76 65 20 68 6f 77 20 74 68 65 20 70 61 69 6e 74 65 72 20 64 61 74 61 20 61 62 73 | Observe.how.the.painter.data.abs |
| 544a0 | 74 72 61 63 74 69 6f 6e 2c 20 61 6e 64 20 69 6e 20 70 61 72 74 69 63 75 6c 61 72 20 74 68 65 0a | traction,.and.in.particular.the. |
| 544c0 | 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 61 69 6e 74 65 72 73 20 61 73 20 70 72 | representation.of.painters.as.pr |
| 544e0 | 6f 63 65 64 75 72 65 73 2c 20 6d 61 6b 65 73 20 60 62 65 73 69 64 65 27 20 65 61 73 79 20 74 6f | ocedures,.makes.`beside'.easy.to |
| 54500 | 0a 69 6d 70 6c 65 6d 65 6e 74 2e 20 20 54 68 65 20 60 62 65 73 69 64 65 27 20 70 72 6f 63 65 64 | .implement...The.`beside'.proced |
| 54520 | 75 72 65 20 6e 65 65 64 20 6e 6f 74 20 6b 6e 6f 77 20 61 6e 79 74 68 69 6e 67 20 61 62 6f 75 74 | ure.need.not.know.anything.about |
| 54540 | 20 74 68 65 0a 64 65 74 61 69 6c 73 20 6f 66 20 74 68 65 20 63 6f 6d 70 6f 6e 65 6e 74 20 70 61 | .the.details.of.the.component.pa |
| 54560 | 69 6e 74 65 72 73 20 6f 74 68 65 72 20 74 68 61 6e 20 74 68 61 74 20 65 61 63 68 20 70 61 69 6e | inters.other.than.that.each.pain |
| 54580 | 74 65 72 20 77 69 6c 6c 0a 64 72 61 77 20 73 6f 6d 65 74 68 69 6e 67 20 69 6e 20 69 74 73 20 64 | ter.will.draw.something.in.its.d |
| 545a0 | 65 73 69 67 6e 61 74 65 64 20 66 72 61 6d 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | esignated.frame........*Exercise |
| 545c0 | 20 32 2e 35 30 3a 2a 20 44 65 66 69 6e 65 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f | .2.50:*.Define.the.transformatio |
| 545e0 | 6e 20 60 66 6c 69 70 2d 68 6f 72 69 7a 27 2c 20 77 68 69 63 68 0a 20 20 20 20 20 66 6c 69 70 73 | n.`flip-horiz',.which......flips |
| 54600 | 20 70 61 69 6e 74 65 72 73 20 68 6f 72 69 7a 6f 6e 74 61 6c 6c 79 2c 20 61 6e 64 20 74 72 61 6e | .painters.horizontally,.and.tran |
| 54620 | 73 66 6f 72 6d 61 74 69 6f 6e 73 20 74 68 61 74 20 72 6f 74 61 74 65 0a 20 20 20 20 20 70 61 69 | sformations.that.rotate......pai |
| 54640 | 6e 74 65 72 73 20 63 6f 75 6e 74 65 72 63 6c 6f 63 6b 77 69 73 65 20 62 79 20 31 38 30 20 64 65 | nters.counterclockwise.by.180.de |
| 54660 | 67 72 65 65 73 20 61 6e 64 20 32 37 30 20 64 65 67 72 65 65 73 2e 0a 0a 20 20 20 20 20 2a 45 78 | grees.and.270.degrees........*Ex |
| 54680 | 65 72 63 69 73 65 20 32 2e 35 31 3a 2a 20 44 65 66 69 6e 65 20 74 68 65 20 60 62 65 6c 6f 77 27 | ercise.2.51:*.Define.the.`below' |
| 546a0 | 20 6f 70 65 72 61 74 69 6f 6e 20 66 6f 72 20 70 61 69 6e 74 65 72 73 2e 0a 20 20 20 20 20 60 42 | .operation.for.painters.......`B |
| 546c0 | 65 6c 6f 77 27 20 74 61 6b 65 73 20 74 77 6f 20 70 61 69 6e 74 65 72 73 20 61 73 20 61 72 67 75 | elow'.takes.two.painters.as.argu |
| 546e0 | 6d 65 6e 74 73 2e 20 20 54 68 65 20 72 65 73 75 6c 74 69 6e 67 20 70 61 69 6e 74 65 72 2c 0a 20 | ments...The.resulting.painter,.. |
| 54700 | 20 20 20 20 67 69 76 65 6e 20 61 20 66 72 61 6d 65 2c 20 64 72 61 77 73 20 77 69 74 68 20 74 68 | ....given.a.frame,.draws.with.th |
| 54720 | 65 20 66 69 72 73 74 20 70 61 69 6e 74 65 72 20 69 6e 20 74 68 65 20 62 6f 74 74 6f 6d 20 6f 66 | e.first.painter.in.the.bottom.of |
| 54740 | 20 74 68 65 0a 20 20 20 20 20 66 72 61 6d 65 20 61 6e 64 20 77 69 74 68 20 74 68 65 20 73 65 63 | .the......frame.and.with.the.sec |
| 54760 | 6f 6e 64 20 70 61 69 6e 74 65 72 20 69 6e 20 74 68 65 20 74 6f 70 2e 20 20 44 65 66 69 6e 65 20 | ond.painter.in.the.top...Define. |
| 54780 | 60 62 65 6c 6f 77 27 20 69 6e 0a 20 20 20 20 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 77 61 | `below'.in......two.different.wa |
| 547a0 | 79 73 2d 2d 66 69 72 73 74 20 62 79 20 77 72 69 74 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 | ys--first.by.writing.a.procedure |
| 547c0 | 20 74 68 61 74 20 69 73 20 61 6e 61 6c 6f 67 6f 75 73 0a 20 20 20 20 20 74 6f 20 74 68 65 20 60 | .that.is.analogous......to.the.` |
| 547e0 | 62 65 73 69 64 65 27 20 70 72 6f 63 65 64 75 72 65 20 67 69 76 65 6e 20 61 62 6f 76 65 2c 20 61 | beside'.procedure.given.above,.a |
| 54800 | 6e 64 20 61 67 61 69 6e 20 69 6e 20 74 65 72 6d 73 20 6f 66 0a 20 20 20 20 20 60 62 65 73 69 64 | nd.again.in.terms.of......`besid |
| 54820 | 65 27 20 61 6e 64 20 73 75 69 74 61 62 6c 65 20 72 6f 74 61 74 69 6f 6e 20 6f 70 65 72 61 74 69 | e'.and.suitable.rotation.operati |
| 54840 | 6f 6e 73 20 28 66 72 6f 6d 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 20 20 20 20 20 32 2d | ons.(from.*Note.Exercise......2- |
| 54860 | 35 30 3a 3a 29 2e 0a 0a 4c 65 76 65 6c 73 20 6f 66 20 6c 61 6e 67 75 61 67 65 20 66 6f 72 20 72 | 50::)...Levels.of.language.for.r |
| 54880 | 6f 62 75 73 74 20 64 65 73 69 67 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | obust.design.................... |
| 548a0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 70 69 63 74 75 72 65 20 6c | ...................The.picture.l |
| 548c0 | 61 6e 67 75 61 67 65 20 65 78 65 72 63 69 73 65 73 20 73 6f 6d 65 20 6f 66 20 74 68 65 20 63 72 | anguage.exercises.some.of.the.cr |
| 548e0 | 69 74 69 63 61 6c 20 69 64 65 61 73 20 77 65 27 76 65 0a 69 6e 74 72 6f 64 75 63 65 64 20 61 62 | itical.ideas.we've.introduced.ab |
| 54900 | 6f 75 74 20 61 62 73 74 72 61 63 74 69 6f 6e 20 77 69 74 68 20 70 72 6f 63 65 64 75 72 65 73 20 | out.abstraction.with.procedures. |
| 54920 | 61 6e 64 20 64 61 74 61 2e 20 20 54 68 65 20 66 75 6e 64 61 6d 65 6e 74 61 6c 0a 64 61 74 61 20 | and.data...The.fundamental.data. |
| 54940 | 61 62 73 74 72 61 63 74 69 6f 6e 73 2c 20 70 61 69 6e 74 65 72 73 2c 20 61 72 65 20 69 6d 70 6c | abstractions,.painters,.are.impl |
| 54960 | 65 6d 65 6e 74 65 64 20 75 73 69 6e 67 20 70 72 6f 63 65 64 75 72 61 6c 0a 72 65 70 72 65 73 65 | emented.using.procedural.represe |
| 54980 | 6e 74 61 74 69 6f 6e 73 2c 20 77 68 69 63 68 20 65 6e 61 62 6c 65 73 20 74 68 65 20 6c 61 6e 67 | ntations,.which.enables.the.lang |
| 549a0 | 75 61 67 65 20 74 6f 20 68 61 6e 64 6c 65 20 64 69 66 66 65 72 65 6e 74 20 62 61 73 69 63 0a 64 | uage.to.handle.different.basic.d |
| 549c0 | 72 61 77 69 6e 67 20 63 61 70 61 62 69 6c 69 74 69 65 73 20 69 6e 20 61 20 75 6e 69 66 6f 72 6d | rawing.capabilities.in.a.uniform |
| 549e0 | 20 77 61 79 2e 20 20 54 68 65 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 0a | .way...The.means.of.combination. |
| 54a00 | 73 61 74 69 73 66 79 20 74 68 65 20 63 6c 6f 73 75 72 65 20 70 72 6f 70 65 72 74 79 2c 20 77 68 | satisfy.the.closure.property,.wh |
| 54a20 | 69 63 68 20 70 65 72 6d 69 74 73 20 75 73 20 74 6f 20 65 61 73 69 6c 79 20 62 75 69 6c 64 20 75 | ich.permits.us.to.easily.build.u |
| 54a40 | 70 0a 63 6f 6d 70 6c 65 78 20 64 65 73 69 67 6e 73 2e 20 20 46 69 6e 61 6c 6c 79 2c 20 61 6c 6c | p.complex.designs...Finally,.all |
| 54a60 | 20 74 68 65 20 74 6f 6f 6c 73 20 66 6f 72 20 61 62 73 74 72 61 63 74 69 6e 67 20 70 72 6f 63 65 | .the.tools.for.abstracting.proce |
| 54a80 | 64 75 72 65 73 20 61 72 65 0a 61 76 61 69 6c 61 62 6c 65 20 74 6f 20 75 73 20 66 6f 72 20 61 62 | dures.are.available.to.us.for.ab |
| 54aa0 | 73 74 72 61 63 74 69 6e 67 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 66 | stracting.means.of.combination.f |
| 54ac0 | 6f 72 20 70 61 69 6e 74 65 72 73 2e 0a 0a 20 20 20 57 65 20 68 61 76 65 20 61 6c 73 6f 20 6f 62 | or.painters......We.have.also.ob |
| 54ae0 | 74 61 69 6e 65 64 20 61 20 67 6c 69 6d 70 73 65 20 6f 66 20 61 6e 6f 74 68 65 72 20 63 72 75 63 | tained.a.glimpse.of.another.cruc |
| 54b00 | 69 61 6c 20 69 64 65 61 20 61 62 6f 75 74 0a 6c 61 6e 67 75 61 67 65 73 20 61 6e 64 20 70 72 6f | ial.idea.about.languages.and.pro |
| 54b20 | 67 72 61 6d 20 64 65 73 69 67 6e 2e 20 20 54 68 69 73 20 69 73 20 74 68 65 20 61 70 70 72 6f 61 | gram.design...This.is.the.approa |
| 54b40 | 63 68 20 6f 66 20 22 73 74 72 61 74 69 66 69 65 64 0a 64 65 73 69 67 6e 22 2c 20 74 68 65 20 6e | ch.of."stratified.design",.the.n |
| 54b60 | 6f 74 69 6f 6e 20 74 68 61 74 20 61 20 63 6f 6d 70 6c 65 78 20 73 79 73 74 65 6d 20 73 68 6f 75 | otion.that.a.complex.system.shou |
| 54b80 | 6c 64 20 62 65 20 73 74 72 75 63 74 75 72 65 64 20 61 73 20 61 0a 73 65 71 75 65 6e 63 65 20 6f | ld.be.structured.as.a.sequence.o |
| 54ba0 | 66 20 6c 65 76 65 6c 73 20 74 68 61 74 20 61 72 65 20 64 65 73 63 72 69 62 65 64 20 75 73 69 6e | f.levels.that.are.described.usin |
| 54bc0 | 67 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 6c 61 6e 67 75 61 67 65 73 2e 0a 45 61 63 68 20 | g.a.sequence.of.languages..Each. |
| 54be0 | 6c 65 76 65 6c 20 69 73 20 63 6f 6e 73 74 72 75 63 74 65 64 20 62 79 20 63 6f 6d 62 69 6e 69 6e | level.is.constructed.by.combinin |
| 54c00 | 67 20 70 61 72 74 73 20 74 68 61 74 20 61 72 65 20 72 65 67 61 72 64 65 64 20 61 73 0a 70 72 69 | g.parts.that.are.regarded.as.pri |
| 54c20 | 6d 69 74 69 76 65 20 61 74 20 74 68 61 74 20 6c 65 76 65 6c 2c 20 61 6e 64 20 74 68 65 20 70 61 | mitive.at.that.level,.and.the.pa |
| 54c40 | 72 74 73 20 63 6f 6e 73 74 72 75 63 74 65 64 20 61 74 20 65 61 63 68 20 6c 65 76 65 6c 20 61 72 | rts.constructed.at.each.level.ar |
| 54c60 | 65 0a 75 73 65 64 20 61 73 20 70 72 69 6d 69 74 69 76 65 73 20 61 74 20 74 68 65 20 6e 65 78 74 | e.used.as.primitives.at.the.next |
| 54c80 | 20 6c 65 76 65 6c 2e 20 20 54 68 65 20 6c 61 6e 67 75 61 67 65 20 75 73 65 64 20 61 74 20 65 61 | .level...The.language.used.at.ea |
| 54ca0 | 63 68 20 6c 65 76 65 6c 0a 6f 66 20 61 20 73 74 72 61 74 69 66 69 65 64 20 64 65 73 69 67 6e 20 | ch.level.of.a.stratified.design. |
| 54cc0 | 68 61 73 20 70 72 69 6d 69 74 69 76 65 73 2c 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 | has.primitives,.means.of.combina |
| 54ce0 | 74 69 6f 6e 2c 20 61 6e 64 20 6d 65 61 6e 73 0a 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 20 61 | tion,.and.means.of.abstraction.a |
| 54d00 | 70 70 72 6f 70 72 69 61 74 65 20 74 6f 20 74 68 61 74 20 6c 65 76 65 6c 20 6f 66 20 64 65 74 61 | ppropriate.to.that.level.of.deta |
| 54d20 | 69 6c 2e 0a 0a 20 20 20 53 74 72 61 74 69 66 69 65 64 20 64 65 73 69 67 6e 20 70 65 72 76 61 64 | il......Stratified.design.pervad |
| 54d40 | 65 73 20 74 68 65 20 65 6e 67 69 6e 65 65 72 69 6e 67 20 6f 66 20 63 6f 6d 70 6c 65 78 20 73 79 | es.the.engineering.of.complex.sy |
| 54d60 | 73 74 65 6d 73 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 69 6e 20 63 6f 6d 70 75 74 65 72 | stems...For.example,.in.computer |
| 54d80 | 20 65 6e 67 69 6e 65 65 72 69 6e 67 2c 20 72 65 73 69 73 74 6f 72 73 20 61 6e 64 20 74 72 61 6e | .engineering,.resistors.and.tran |
| 54da0 | 73 69 73 74 6f 72 73 20 61 72 65 0a 63 6f 6d 62 69 6e 65 64 20 28 61 6e 64 20 64 65 73 63 72 69 | sistors.are.combined.(and.descri |
| 54dc0 | 62 65 64 20 75 73 69 6e 67 20 61 20 6c 61 6e 67 75 61 67 65 20 6f 66 20 61 6e 61 6c 6f 67 20 63 | bed.using.a.language.of.analog.c |
| 54de0 | 69 72 63 75 69 74 73 29 20 74 6f 20 70 72 6f 64 75 63 65 0a 70 61 72 74 73 20 73 75 63 68 20 61 | ircuits).to.produce.parts.such.a |
| 54e00 | 73 20 61 6e 64 2d 67 61 74 65 73 20 61 6e 64 20 6f 72 2d 67 61 74 65 73 2c 20 77 68 69 63 68 20 | s.and-gates.and.or-gates,.which. |
| 54e20 | 66 6f 72 6d 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 73 20 6f 66 20 61 0a 6c 61 6e 67 75 61 67 | form.the.primitives.of.a.languag |
| 54e40 | 65 20 66 6f 72 20 64 69 67 69 74 61 6c 2d 63 69 72 63 75 69 74 20 64 65 73 69 67 6e 2e 28 31 30 | e.for.digital-circuit.design.(10 |
| 54e60 | 29 20 54 68 65 73 65 20 70 61 72 74 73 20 61 72 65 20 63 6f 6d 62 69 6e 65 64 20 74 6f 0a 62 75 | ).These.parts.are.combined.to.bu |
| 54e80 | 69 6c 64 20 70 72 6f 63 65 73 73 6f 72 73 2c 20 62 75 73 20 73 74 72 75 63 74 75 72 65 73 2c 20 | ild.processors,.bus.structures,. |
| 54ea0 | 61 6e 64 20 6d 65 6d 6f 72 79 20 73 79 73 74 65 6d 73 2c 20 77 68 69 63 68 20 61 72 65 20 69 6e | and.memory.systems,.which.are.in |
| 54ec0 | 20 74 75 72 6e 0a 63 6f 6d 62 69 6e 65 64 20 74 6f 20 66 6f 72 6d 20 63 6f 6d 70 75 74 65 72 73 | .turn.combined.to.form.computers |
| 54ee0 | 2c 20 75 73 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 61 70 70 72 6f 70 72 69 61 74 65 20 74 6f | ,.using.languages.appropriate.to |
| 54f00 | 20 63 6f 6d 70 75 74 65 72 0a 61 72 63 68 69 74 65 63 74 75 72 65 2e 20 20 43 6f 6d 70 75 74 65 | .computer.architecture...Compute |
| 54f20 | 72 73 20 61 72 65 20 63 6f 6d 62 69 6e 65 64 20 74 6f 20 66 6f 72 6d 20 64 69 73 74 72 69 62 75 | rs.are.combined.to.form.distribu |
| 54f40 | 74 65 64 20 73 79 73 74 65 6d 73 2c 20 75 73 69 6e 67 0a 6c 61 6e 67 75 61 67 65 73 20 61 70 70 | ted.systems,.using.languages.app |
| 54f60 | 72 6f 70 72 69 61 74 65 20 66 6f 72 20 64 65 73 63 72 69 62 69 6e 67 20 6e 65 74 77 6f 72 6b 20 | ropriate.for.describing.network. |
| 54f80 | 69 6e 74 65 72 63 6f 6e 6e 65 63 74 69 6f 6e 73 2c 20 61 6e 64 20 73 6f 0a 6f 6e 2e 0a 0a 20 20 | interconnections,.and.so.on..... |
| 54fa0 | 20 41 73 20 61 20 74 69 6e 79 20 65 78 61 6d 70 6c 65 20 6f 66 20 73 74 72 61 74 69 66 69 63 61 | .As.a.tiny.example.of.stratifica |
| 54fc0 | 74 69 6f 6e 2c 20 6f 75 72 20 70 69 63 74 75 72 65 20 6c 61 6e 67 75 61 67 65 20 75 73 65 73 0a | tion,.our.picture.language.uses. |
| 54fe0 | 70 72 69 6d 69 74 69 76 65 20 65 6c 65 6d 65 6e 74 73 20 28 70 72 69 6d 69 74 69 76 65 20 70 61 | primitive.elements.(primitive.pa |
| 55000 | 69 6e 74 65 72 73 29 20 74 68 61 74 20 61 72 65 20 63 72 65 61 74 65 64 20 75 73 69 6e 67 20 61 | inters).that.are.created.using.a |
| 55020 | 0a 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 70 6f 69 6e 74 73 20 | .language.that.specifies.points. |
| 55040 | 61 6e 64 20 6c 69 6e 65 73 20 74 6f 20 70 72 6f 76 69 64 65 20 74 68 65 20 6c 69 73 74 73 20 6f | and.lines.to.provide.the.lists.o |
| 55060 | 66 20 6c 69 6e 65 0a 73 65 67 6d 65 6e 74 73 20 66 6f 72 20 60 73 65 67 6d 65 6e 74 73 2d 3e 70 | f.line.segments.for.`segments->p |
| 55080 | 61 69 6e 74 65 72 27 2c 20 6f 72 20 74 68 65 20 73 68 61 64 69 6e 67 20 64 65 74 61 69 6c 73 20 | ainter',.or.the.shading.details. |
| 550a0 | 66 6f 72 20 61 20 70 61 69 6e 74 65 72 0a 6c 69 6b 65 20 60 72 6f 67 65 72 73 27 2e 20 20 54 68 | for.a.painter.like.`rogers'...Th |
| 550c0 | 65 20 62 75 6c 6b 20 6f 66 20 6f 75 72 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 74 68 65 | e.bulk.of.our.description.of.the |
| 550e0 | 20 70 69 63 74 75 72 65 20 6c 61 6e 67 75 61 67 65 0a 66 6f 63 75 73 65 64 20 6f 6e 20 63 6f 6d | .picture.language.focused.on.com |
| 55100 | 62 69 6e 69 6e 67 20 74 68 65 73 65 20 70 72 69 6d 69 74 69 76 65 73 2c 20 75 73 69 6e 67 20 67 | bining.these.primitives,.using.g |
| 55120 | 65 6f 6d 65 74 72 69 63 20 63 6f 6d 62 69 6e 65 72 73 20 73 75 63 68 0a 61 73 20 60 62 65 73 69 | eometric.combiners.such.as.`besi |
| 55140 | 64 65 27 20 61 6e 64 20 60 62 65 6c 6f 77 27 2e 20 20 57 65 20 61 6c 73 6f 20 77 6f 72 6b 65 64 | de'.and.`below'...We.also.worked |
| 55160 | 20 61 74 20 61 20 68 69 67 68 65 72 20 6c 65 76 65 6c 2c 20 72 65 67 61 72 64 69 6e 67 0a 60 62 | .at.a.higher.level,.regarding.`b |
| 55180 | 65 73 69 64 65 27 20 61 6e 64 20 60 62 65 6c 6f 77 27 20 61 73 20 70 72 69 6d 69 74 69 76 65 73 | eside'.and.`below'.as.primitives |
| 551a0 | 20 74 6f 20 62 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 20 69 6e 20 61 20 6c 61 6e 67 75 61 67 65 | .to.be.manipulated.in.a.language |
| 551c0 | 0a 77 68 6f 73 65 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 73 75 63 68 20 61 73 20 60 73 71 75 61 | .whose.operations,.such.as.`squa |
| 551e0 | 72 65 2d 6f 66 2d 66 6f 75 72 27 2c 20 63 61 70 74 75 72 65 20 63 6f 6d 6d 6f 6e 20 70 61 74 74 | re-of-four',.capture.common.patt |
| 55200 | 65 72 6e 73 20 6f 66 0a 63 6f 6d 62 69 6e 69 6e 67 20 67 65 6f 6d 65 74 72 69 63 20 63 6f 6d 62 | erns.of.combining.geometric.comb |
| 55220 | 69 6e 65 72 73 2e 0a 0a 20 20 20 53 74 72 61 74 69 66 69 65 64 20 64 65 73 69 67 6e 20 68 65 6c | iners......Stratified.design.hel |
| 55240 | 70 73 20 6d 61 6b 65 20 70 72 6f 67 72 61 6d 73 20 22 72 6f 62 75 73 74 22 2c 20 74 68 61 74 20 | ps.make.programs."robust",.that. |
| 55260 | 69 73 2c 20 69 74 20 6d 61 6b 65 73 20 69 74 0a 6c 69 6b 65 6c 79 20 74 68 61 74 20 73 6d 61 6c | is,.it.makes.it.likely.that.smal |
| 55280 | 6c 20 63 68 61 6e 67 65 73 20 69 6e 20 61 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 20 77 69 6c | l.changes.in.a.specification.wil |
| 552a0 | 6c 20 72 65 71 75 69 72 65 0a 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 6c 79 20 73 6d 61 6c 6c 20 | l.require.correspondingly.small. |
| 552c0 | 63 68 61 6e 67 65 73 20 69 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 2e 20 20 46 6f 72 20 69 6e 73 | changes.in.the.program...For.ins |
| 552e0 | 74 61 6e 63 65 2c 20 73 75 70 70 6f 73 65 20 77 65 0a 77 61 6e 74 65 64 20 74 6f 20 63 68 61 6e | tance,.suppose.we.wanted.to.chan |
| 55300 | 67 65 20 74 68 65 20 69 6d 61 67 65 20 62 61 73 65 64 20 6f 6e 20 60 77 61 76 65 27 20 73 68 6f | ge.the.image.based.on.`wave'.sho |
| 55320 | 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 39 3a 3a 2e 0a 57 65 20 63 6f 75 | wn.in.*Note.Figure.2-9::..We.cou |
| 55340 | 6c 64 20 77 6f 72 6b 20 61 74 20 74 68 65 20 6c 6f 77 65 73 74 20 6c 65 76 65 6c 20 74 6f 20 63 | ld.work.at.the.lowest.level.to.c |
| 55360 | 68 61 6e 67 65 20 74 68 65 20 64 65 74 61 69 6c 65 64 20 61 70 70 65 61 72 61 6e 63 65 20 6f 66 | hange.the.detailed.appearance.of |
| 55380 | 0a 74 68 65 20 60 77 61 76 65 27 20 65 6c 65 6d 65 6e 74 3b 20 77 65 20 63 6f 75 6c 64 20 77 6f | .the.`wave'.element;.we.could.wo |
| 553a0 | 72 6b 20 61 74 20 74 68 65 20 6d 69 64 64 6c 65 20 6c 65 76 65 6c 20 74 6f 20 63 68 61 6e 67 65 | rk.at.the.middle.level.to.change |
| 553c0 | 20 74 68 65 20 77 61 79 0a 60 63 6f 72 6e 65 72 2d 73 70 6c 69 74 27 20 72 65 70 6c 69 63 61 74 | .the.way.`corner-split'.replicat |
| 553e0 | 65 73 20 74 68 65 20 60 77 61 76 65 27 3b 20 77 65 20 63 6f 75 6c 64 20 77 6f 72 6b 20 61 74 20 | es.the.`wave';.we.could.work.at. |
| 55400 | 74 68 65 20 68 69 67 68 65 73 74 0a 6c 65 76 65 6c 20 74 6f 20 63 68 61 6e 67 65 20 68 6f 77 20 | the.highest.level.to.change.how. |
| 55420 | 60 73 71 75 61 72 65 2d 6c 69 6d 69 74 27 20 61 72 72 61 6e 67 65 73 20 74 68 65 20 66 6f 75 72 | `square-limit'.arranges.the.four |
| 55440 | 20 63 6f 70 69 65 73 20 6f 66 20 74 68 65 0a 63 6f 72 6e 65 72 2e 20 20 49 6e 20 67 65 6e 65 72 | .copies.of.the.corner...In.gener |
| 55460 | 61 6c 2c 20 65 61 63 68 20 6c 65 76 65 6c 20 6f 66 20 61 20 73 74 72 61 74 69 66 69 65 64 20 64 | al,.each.level.of.a.stratified.d |
| 55480 | 65 73 69 67 6e 20 70 72 6f 76 69 64 65 73 20 61 0a 64 69 66 66 65 72 65 6e 74 20 76 6f 63 61 62 | esign.provides.a.different.vocab |
| 554a0 | 75 6c 61 72 79 20 66 6f 72 20 65 78 70 72 65 73 73 69 6e 67 20 74 68 65 20 63 68 61 72 61 63 74 | ulary.for.expressing.the.charact |
| 554c0 | 65 72 69 73 74 69 63 73 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 2c 0a 61 6e 64 20 61 20 64 69 | eristics.of.the.system,.and.a.di |
| 554e0 | 66 66 65 72 65 6e 74 20 6b 69 6e 64 20 6f 66 20 61 62 69 6c 69 74 79 20 74 6f 20 63 68 61 6e 67 | fferent.kind.of.ability.to.chang |
| 55500 | 65 20 69 74 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 35 32 3a 2a 20 4d 61 6b | e.it........*Exercise.2.52:*.Mak |
| 55520 | 65 20 63 68 61 6e 67 65 73 20 74 6f 20 74 68 65 20 73 71 75 61 72 65 20 6c 69 6d 69 74 20 6f 66 | e.changes.to.the.square.limit.of |
| 55540 | 20 60 77 61 76 65 27 20 73 68 6f 77 6e 0a 20 20 20 20 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 | .`wave'.shown......in.*Note.Figu |
| 55560 | 72 65 20 32 2d 39 3a 3a 20 62 79 20 77 6f 72 6b 69 6e 67 20 61 74 20 65 61 63 68 20 6f 66 20 74 | re.2-9::.by.working.at.each.of.t |
| 55580 | 68 65 20 6c 65 76 65 6c 73 20 64 65 73 63 72 69 62 65 64 0a 20 20 20 20 20 61 62 6f 76 65 2e 20 | he.levels.described......above.. |
| 555a0 | 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 3a 0a 0a 20 20 20 20 20 20 20 61 2e 20 41 64 64 20 73 | .In.particular:.........a..Add.s |
| 555c0 | 6f 6d 65 20 73 65 67 6d 65 6e 74 73 20 74 6f 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 60 77 | ome.segments.to.the.primitive.`w |
| 555e0 | 61 76 65 27 20 70 61 69 6e 74 65 72 20 6f 66 20 2a 4e 6f 74 65 0a 20 20 20 20 20 20 20 20 20 20 | ave'.painter.of.*Note........... |
| 55600 | 45 78 65 72 63 69 73 65 20 32 2d 34 39 3a 3a 20 28 74 6f 20 61 64 64 20 61 20 73 6d 69 6c 65 2c | Exercise.2-49::.(to.add.a.smile, |
| 55620 | 20 66 6f 72 20 65 78 61 6d 70 6c 65 29 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 43 68 61 6e 67 65 | .for.example)..........b..Change |
| 55640 | 20 74 68 65 20 70 61 74 74 65 72 6e 20 63 6f 6e 73 74 72 75 63 74 65 64 20 62 79 20 60 63 6f 72 | .the.pattern.constructed.by.`cor |
| 55660 | 6e 65 72 2d 73 70 6c 69 74 27 20 28 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20 65 78 61 6d 70 6c | ner-split'.(for...........exampl |
| 55680 | 65 2c 20 62 79 20 75 73 69 6e 67 20 6f 6e 6c 79 20 6f 6e 65 20 63 6f 70 79 20 6f 66 20 74 68 65 | e,.by.using.only.one.copy.of.the |
| 556a0 | 20 60 75 70 2d 73 70 6c 69 74 27 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 60 72 69 67 68 74 | .`up-split'.and...........`right |
| 556c0 | 2d 73 70 6c 69 74 27 20 69 6d 61 67 65 73 20 69 6e 73 74 65 61 64 20 6f 66 20 74 77 6f 29 2e 0a | -split'.images.instead.of.two).. |
| 556e0 | 0a 20 20 20 20 20 20 20 63 2e 20 4d 6f 64 69 66 79 20 74 68 65 20 76 65 72 73 69 6f 6e 20 6f 66 | ........c..Modify.the.version.of |
| 55700 | 20 60 73 71 75 61 72 65 2d 6c 69 6d 69 74 27 20 74 68 61 74 20 75 73 65 73 0a 20 20 20 20 20 20 | .`square-limit'.that.uses....... |
| 55720 | 20 20 20 20 60 73 71 75 61 72 65 2d 6f 66 2d 66 6f 75 72 27 20 73 6f 20 61 73 20 74 6f 20 61 73 | ....`square-of-four'.so.as.to.as |
| 55740 | 73 65 6d 62 6c 65 20 74 68 65 20 63 6f 72 6e 65 72 73 20 69 6e 20 61 20 64 69 66 66 65 72 65 6e | semble.the.corners.in.a.differen |
| 55760 | 74 0a 20 20 20 20 20 20 20 20 20 20 70 61 74 74 65 72 6e 2e 20 20 28 46 6f 72 20 65 78 61 6d 70 | t...........pattern...(For.examp |
| 55780 | 6c 65 2c 20 79 6f 75 20 6d 69 67 68 74 20 6d 61 6b 65 20 74 68 65 20 62 69 67 20 4d 72 2e 20 52 | le,.you.might.make.the.big.Mr..R |
| 557a0 | 6f 67 65 72 73 0a 20 20 20 20 20 20 20 20 20 20 6c 6f 6f 6b 20 6f 75 74 77 61 72 64 20 66 72 6f | ogers...........look.outward.fro |
| 557c0 | 6d 20 65 61 63 68 20 63 6f 72 6e 65 72 20 6f 66 20 74 68 65 20 73 71 75 61 72 65 2e 29 0a 0a 0a | m.each.corner.of.the.square.)... |
| 557e0 | 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d | ...----------.Footnotes.-------- |
| 55800 | 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 65 20 70 69 63 74 75 72 65 20 6c 61 6e 67 75 61 67 65 20 | --.....(1).The.picture.language. |
| 55820 | 69 73 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 50 65 74 65 72 20 48 | is.based.on.the.language.Peter.H |
| 55840 | 65 6e 64 65 72 73 6f 6e 0a 63 72 65 61 74 65 64 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 69 6d | enderson.created.to.construct.im |
| 55860 | 61 67 65 73 20 6c 69 6b 65 20 4d 2e 43 2e 20 45 73 63 68 65 72 27 73 20 22 53 71 75 61 72 65 20 | ages.like.M.C..Escher's."Square. |
| 55880 | 4c 69 6d 69 74 22 20 77 6f 6f 64 63 75 74 0a 28 73 65 65 20 48 65 6e 64 65 72 73 6f 6e 20 31 39 | Limit".woodcut.(see.Henderson.19 |
| 558a0 | 38 32 29 2e 20 20 54 68 65 20 77 6f 6f 64 63 75 74 20 69 6e 63 6f 72 70 6f 72 61 74 65 73 20 61 | 82)...The.woodcut.incorporates.a |
| 558c0 | 20 72 65 70 65 61 74 65 64 20 73 63 61 6c 65 64 0a 70 61 74 74 65 72 6e 2c 20 73 69 6d 69 6c 61 | .repeated.scaled.pattern,.simila |
| 558e0 | 72 20 74 6f 20 74 68 65 20 61 72 72 61 6e 67 65 6d 65 6e 74 73 20 64 72 61 77 6e 20 75 73 69 6e | r.to.the.arrangements.drawn.usin |
| 55900 | 67 20 74 68 65 20 60 73 71 75 61 72 65 2d 6c 69 6d 69 74 27 0a 70 72 6f 63 65 64 75 72 65 20 69 | g.the.`square-limit'.procedure.i |
| 55920 | 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2e 0a 0a 20 20 20 28 32 29 20 57 69 6c 6c 69 61 6d 20 | n.this.section......(2).William. |
| 55940 | 42 61 72 74 6f 6e 20 52 6f 67 65 72 73 20 28 31 38 30 34 2d 31 38 38 32 29 20 77 61 73 20 74 68 | Barton.Rogers.(1804-1882).was.th |
| 55960 | 65 20 66 6f 75 6e 64 65 72 20 61 6e 64 20 66 69 72 73 74 0a 70 72 65 73 69 64 65 6e 74 20 6f 66 | e.founder.and.first.president.of |
| 55980 | 20 4d 49 54 2e 20 20 41 20 67 65 6f 6c 6f 67 69 73 74 20 61 6e 64 20 74 61 6c 65 6e 74 65 64 20 | .MIT...A.geologist.and.talented. |
| 559a0 | 74 65 61 63 68 65 72 2c 20 68 65 20 74 61 75 67 68 74 20 61 74 0a 57 69 6c 6c 69 61 6d 20 61 6e | teacher,.he.taught.at.William.an |
| 559c0 | 64 20 4d 61 72 79 20 43 6f 6c 6c 65 67 65 20 61 6e 64 20 61 74 20 74 68 65 20 55 6e 69 76 65 72 | d.Mary.College.and.at.the.Univer |
| 559e0 | 73 69 74 79 20 6f 66 20 56 69 72 67 69 6e 69 61 2e 20 20 49 6e 20 31 38 35 39 20 68 65 0a 6d 6f | sity.of.Virginia...In.1859.he.mo |
| 55a00 | 76 65 64 20 74 6f 20 42 6f 73 74 6f 6e 2c 20 77 68 65 72 65 20 68 65 20 68 61 64 20 6d 6f 72 65 | ved.to.Boston,.where.he.had.more |
| 55a20 | 20 74 69 6d 65 20 66 6f 72 20 72 65 73 65 61 72 63 68 2c 20 77 6f 72 6b 65 64 20 6f 6e 20 61 20 | .time.for.research,.worked.on.a. |
| 55a40 | 70 6c 61 6e 0a 66 6f 72 20 65 73 74 61 62 6c 69 73 68 69 6e 67 20 61 20 22 70 6f 6c 79 74 65 63 | plan.for.establishing.a."polytec |
| 55a60 | 68 6e 69 63 20 69 6e 73 74 69 74 75 74 65 2c 22 20 61 6e 64 20 73 65 72 76 65 64 20 61 73 0a 4d | hnic.institute,".and.served.as.M |
| 55a80 | 61 73 73 61 63 68 75 73 65 74 74 73 27 73 20 66 69 72 73 74 20 53 74 61 74 65 20 49 6e 73 70 65 | assachusetts's.first.State.Inspe |
| 55aa0 | 63 74 6f 72 20 6f 66 20 47 61 73 20 4d 65 74 65 72 73 2e 0a 0a 20 20 20 57 68 65 6e 20 4d 49 54 | ctor.of.Gas.Meters......When.MIT |
| 55ac0 | 20 77 61 73 20 65 73 74 61 62 6c 69 73 68 65 64 20 69 6e 20 31 38 36 31 2c 20 52 6f 67 65 72 73 | .was.established.in.1861,.Rogers |
| 55ae0 | 20 77 61 73 20 65 6c 65 63 74 65 64 20 69 74 73 20 66 69 72 73 74 0a 70 72 65 73 69 64 65 6e 74 | .was.elected.its.first.president |
| 55b00 | 2e 20 20 52 6f 67 65 72 73 20 65 73 70 6f 75 73 65 64 20 61 6e 20 69 64 65 61 6c 20 6f 66 20 22 | ...Rogers.espoused.an.ideal.of." |
| 55b20 | 75 73 65 66 75 6c 20 6c 65 61 72 6e 69 6e 67 22 20 74 68 61 74 20 77 61 73 0a 64 69 66 66 65 72 | useful.learning".that.was.differ |
| 55b40 | 65 6e 74 20 66 72 6f 6d 20 74 68 65 20 75 6e 69 76 65 72 73 69 74 79 20 65 64 75 63 61 74 69 6f | ent.from.the.university.educatio |
| 55b60 | 6e 20 6f 66 20 74 68 65 20 74 69 6d 65 2c 20 77 69 74 68 20 69 74 73 0a 6f 76 65 72 65 6d 70 68 | n.of.the.time,.with.its.overemph |
| 55b80 | 61 73 69 73 20 6f 6e 20 74 68 65 20 63 6c 61 73 73 69 63 73 2c 20 77 68 69 63 68 2c 20 61 73 20 | asis.on.the.classics,.which,.as. |
| 55ba0 | 68 65 20 77 72 6f 74 65 2c 20 22 73 74 61 6e 64 20 69 6e 20 74 68 65 20 77 61 79 20 6f 66 0a 74 | he.wrote,."stand.in.the.way.of.t |
| 55bc0 | 68 65 20 62 72 6f 61 64 65 72 2c 20 68 69 67 68 65 72 20 61 6e 64 20 6d 6f 72 65 20 70 72 61 63 | he.broader,.higher.and.more.prac |
| 55be0 | 74 69 63 61 6c 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 61 6e 64 20 64 69 73 63 69 70 6c 69 6e 65 | tical.instruction.and.discipline |
| 55c00 | 20 6f 66 0a 74 68 65 20 6e 61 74 75 72 61 6c 20 61 6e 64 20 73 6f 63 69 61 6c 20 73 63 69 65 6e | .of.the.natural.and.social.scien |
| 55c20 | 63 65 73 2e 22 20 20 54 68 69 73 20 65 64 75 63 61 74 69 6f 6e 20 77 61 73 20 6c 69 6b 65 77 69 | ces."..This.education.was.likewi |
| 55c40 | 73 65 20 74 6f 20 62 65 0a 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d 20 6e 61 72 72 6f 77 20 74 | se.to.be.different.from.narrow.t |
| 55c60 | 72 61 64 65 2d 73 63 68 6f 6f 6c 20 65 64 75 63 61 74 69 6f 6e 2e 20 20 49 6e 20 52 6f 67 65 72 | rade-school.education...In.Roger |
| 55c80 | 73 27 73 20 77 6f 72 64 73 3a 0a 0a 20 20 20 20 20 54 68 65 20 77 6f 72 6c 64 2d 65 6e 66 6f 72 | s's.words:.......The.world-enfor |
| 55ca0 | 63 65 64 20 64 69 73 74 69 6e 63 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 74 68 65 20 70 72 61 63 | ced.distinction.between.the.prac |
| 55cc0 | 74 69 63 61 6c 20 61 6e 64 20 74 68 65 0a 20 20 20 20 20 73 63 69 65 6e 74 69 66 69 63 20 77 6f | tical.and.the......scientific.wo |
| 55ce0 | 72 6b 65 72 20 69 73 20 75 74 74 65 72 6c 79 20 66 75 74 69 6c 65 2c 20 61 6e 64 20 74 68 65 20 | rker.is.utterly.futile,.and.the. |
| 55d00 | 77 68 6f 6c 65 20 65 78 70 65 72 69 65 6e 63 65 20 6f 66 0a 20 20 20 20 20 6d 6f 64 65 72 6e 20 | whole.experience.of......modern. |
| 55d20 | 74 69 6d 65 73 20 68 61 73 20 64 65 6d 6f 6e 73 74 72 61 74 65 64 20 69 74 73 20 75 74 74 65 72 | times.has.demonstrated.its.utter |
| 55d40 | 20 77 6f 72 74 68 6c 65 73 73 6e 65 73 73 2e 0a 0a 20 20 20 52 6f 67 65 72 73 20 73 65 72 76 65 | .worthlessness......Rogers.serve |
| 55d60 | 64 20 61 73 20 70 72 65 73 69 64 65 6e 74 20 6f 66 20 4d 49 54 20 75 6e 74 69 6c 20 31 38 37 30 | d.as.president.of.MIT.until.1870 |
| 55d80 | 2c 20 77 68 65 6e 20 68 65 20 72 65 73 69 67 6e 65 64 20 64 75 65 20 74 6f 0a 69 6c 6c 20 68 65 | ,.when.he.resigned.due.to.ill.he |
| 55da0 | 61 6c 74 68 2e 20 20 49 6e 20 31 38 37 38 20 74 68 65 20 73 65 63 6f 6e 64 20 70 72 65 73 69 64 | alth...In.1878.the.second.presid |
| 55dc0 | 65 6e 74 20 6f 66 20 4d 49 54 2c 20 4a 6f 68 6e 20 52 75 6e 6b 6c 65 2c 20 72 65 73 69 67 6e 65 | ent.of.MIT,.John.Runkle,.resigne |
| 55de0 | 64 0a 75 6e 64 65 72 20 74 68 65 20 70 72 65 73 73 75 72 65 20 6f 66 20 61 20 66 69 6e 61 6e 63 | d.under.the.pressure.of.a.financ |
| 55e00 | 69 61 6c 20 63 72 69 73 69 73 20 62 72 6f 75 67 68 74 20 6f 6e 20 62 79 20 74 68 65 20 50 61 6e | ial.crisis.brought.on.by.the.Pan |
| 55e20 | 69 63 20 6f 66 0a 31 38 37 33 20 61 6e 64 20 73 74 72 61 69 6e 20 6f 66 20 66 69 67 68 74 69 6e | ic.of.1873.and.strain.of.fightin |
| 55e40 | 67 20 6f 66 66 20 61 74 74 65 6d 70 74 73 20 62 79 20 48 61 72 76 61 72 64 20 74 6f 20 74 61 6b | g.off.attempts.by.Harvard.to.tak |
| 55e60 | 65 20 6f 76 65 72 20 4d 49 54 2e 0a 52 6f 67 65 72 73 20 72 65 74 75 72 6e 65 64 20 74 6f 20 68 | e.over.MIT..Rogers.returned.to.h |
| 55e80 | 6f 6c 64 20 74 68 65 20 6f 66 66 69 63 65 20 6f 66 20 70 72 65 73 69 64 65 6e 74 20 75 6e 74 69 | old.the.office.of.president.unti |
| 55ea0 | 6c 20 31 38 38 31 2e 0a 0a 20 20 20 52 6f 67 65 72 73 20 63 6f 6c 6c 61 70 73 65 64 20 61 6e 64 | l.1881......Rogers.collapsed.and |
| 55ec0 | 20 64 69 65 64 20 77 68 69 6c 65 20 61 64 64 72 65 73 73 69 6e 67 20 4d 49 54 27 73 20 67 72 61 | .died.while.addressing.MIT's.gra |
| 55ee0 | 64 75 61 74 69 6e 67 20 63 6c 61 73 73 20 61 74 0a 74 68 65 20 63 6f 6d 6d 65 6e 63 65 6d 65 6e | duating.class.at.the.commencemen |
| 55f00 | 74 20 65 78 65 72 63 69 73 65 73 20 6f 66 20 31 38 38 32 2e 20 20 52 75 6e 6b 6c 65 20 71 75 6f | t.exercises.of.1882...Runkle.quo |
| 55f20 | 74 65 64 20 52 6f 67 65 72 73 27 73 20 6c 61 73 74 20 77 6f 72 64 73 0a 69 6e 20 61 20 6d 65 6d | ted.Rogers's.last.words.in.a.mem |
| 55f40 | 6f 72 69 61 6c 20 61 64 64 72 65 73 73 20 64 65 6c 69 76 65 72 65 64 20 74 68 61 74 20 73 61 6d | orial.address.delivered.that.sam |
| 55f60 | 65 20 79 65 61 72 3a 0a 0a 20 20 20 20 20 22 41 73 20 49 20 73 74 61 6e 64 20 68 65 72 65 20 74 | e.year:......."As.I.stand.here.t |
| 55f80 | 6f 64 61 79 20 61 6e 64 20 73 65 65 20 77 68 61 74 20 74 68 65 20 49 6e 73 74 69 74 75 74 65 20 | oday.and.see.what.the.Institute. |
| 55fa0 | 69 73 2c 20 2e 2e 2e 20 49 20 63 61 6c 6c 0a 20 20 20 20 20 74 6f 20 6d 69 6e 64 20 74 68 65 20 | is,.....I.call......to.mind.the. |
| 55fc0 | 62 65 67 69 6e 6e 69 6e 67 73 20 6f 66 20 73 63 69 65 6e 63 65 2e 20 20 49 20 72 65 6d 65 6d 62 | beginnings.of.science...I.rememb |
| 55fe0 | 65 72 20 6f 6e 65 20 68 75 6e 64 72 65 64 20 61 6e 64 0a 20 20 20 20 20 66 69 66 74 79 20 79 65 | er.one.hundred.and......fifty.ye |
| 56000 | 61 72 73 20 61 67 6f 20 53 74 65 70 68 65 6e 20 48 61 6c 65 73 20 70 75 62 6c 69 73 68 65 64 20 | ars.ago.Stephen.Hales.published. |
| 56020 | 61 20 70 61 6d 70 68 6c 65 74 20 6f 6e 20 74 68 65 20 73 75 62 6a 65 63 74 0a 20 20 20 20 20 6f | a.pamphlet.on.the.subject......o |
| 56040 | 66 20 69 6c 6c 75 6d 69 6e 61 74 69 6e 67 20 67 61 73 2c 20 69 6e 20 77 68 69 63 68 20 68 65 20 | f.illuminating.gas,.in.which.he. |
| 56060 | 73 74 61 74 65 64 20 74 68 61 74 20 68 69 73 20 72 65 73 65 61 72 63 68 65 73 20 68 61 64 0a 20 | stated.that.his.researches.had.. |
| 56080 | 20 20 20 20 64 65 6d 6f 6e 73 74 72 61 74 65 64 20 74 68 61 74 20 31 32 38 20 67 72 61 69 6e 73 | ....demonstrated.that.128.grains |
| 560a0 | 20 6f 66 20 62 69 74 75 6d 69 6e 6f 75 73 20 63 6f 61 6c 20 2d 20 22 20 22 42 69 74 75 6d 69 6e | .of.bituminous.coal.-."."Bitumin |
| 560c0 | 6f 75 73 0a 20 20 20 20 20 63 6f 61 6c 2c 22 20 74 68 65 73 65 20 77 65 72 65 20 68 69 73 20 6c | ous......coal,".these.were.his.l |
| 560e0 | 61 73 74 20 77 6f 72 64 73 20 6f 6e 20 65 61 72 74 68 2e 20 20 48 65 72 65 20 68 65 20 62 65 6e | ast.words.on.earth...Here.he.ben |
| 56100 | 74 20 66 6f 72 77 61 72 64 2c 0a 20 20 20 20 20 61 73 20 69 66 20 63 6f 6e 73 75 6c 74 69 6e 67 | t.forward,......as.if.consulting |
| 56120 | 20 73 6f 6d 65 20 6e 6f 74 65 73 20 6f 6e 20 74 68 65 20 74 61 62 6c 65 20 62 65 66 6f 72 65 20 | .some.notes.on.the.table.before. |
| 56140 | 68 69 6d 2c 20 74 68 65 6e 20 73 6c 6f 77 6c 79 0a 20 20 20 20 20 72 65 67 61 69 6e 69 6e 67 20 | him,.then.slowly......regaining. |
| 56160 | 61 6e 20 65 72 65 63 74 20 70 6f 73 69 74 69 6f 6e 2c 20 74 68 72 65 77 20 75 70 20 68 69 73 20 | an.erect.position,.threw.up.his. |
| 56180 | 68 61 6e 64 73 2c 20 61 6e 64 20 77 61 73 0a 20 20 20 20 20 74 72 61 6e 73 6c 61 74 65 64 20 66 | hands,.and.was......translated.f |
| 561a0 | 72 6f 6d 20 74 68 65 20 73 63 65 6e 65 20 6f 66 20 68 69 73 20 65 61 72 74 68 6c 79 20 6c 61 62 | rom.the.scene.of.his.earthly.lab |
| 561c0 | 6f 72 73 20 61 6e 64 20 74 72 69 75 6d 70 68 73 20 74 6f 0a 20 20 20 20 20 22 74 68 65 20 74 6f | ors.and.triumphs.to......"the.to |
| 561e0 | 6d 6f 72 72 6f 77 20 6f 66 20 64 65 61 74 68 2c 22 20 77 68 65 72 65 20 74 68 65 20 6d 79 73 74 | morrow.of.death,".where.the.myst |
| 56200 | 65 72 69 65 73 20 6f 66 20 6c 69 66 65 20 61 72 65 20 73 6f 6c 76 65 64 2c 0a 20 20 20 20 20 61 | eries.of.life.are.solved,......a |
| 56220 | 6e 64 20 74 68 65 20 64 69 73 65 6d 62 6f 64 69 65 64 20 73 70 69 72 69 74 20 66 69 6e 64 73 20 | nd.the.disembodied.spirit.finds. |
| 56240 | 75 6e 65 6e 64 69 6e 67 20 73 61 74 69 73 66 61 63 74 69 6f 6e 20 69 6e 0a 20 20 20 20 20 63 6f | unending.satisfaction.in......co |
| 56260 | 6e 74 65 6d 70 6c 61 74 69 6e 67 20 74 68 65 20 6e 65 77 20 61 6e 64 20 73 74 69 6c 6c 20 75 6e | ntemplating.the.new.and.still.un |
| 56280 | 66 61 74 68 6f 6d 61 62 6c 65 20 6d 79 73 74 65 72 69 65 73 20 6f 66 20 74 68 65 0a 20 20 20 20 | fathomable.mysteries.of.the..... |
| 562a0 | 20 69 6e 66 69 6e 69 74 65 20 66 75 74 75 72 65 2e 0a 0a 20 20 20 49 6e 20 74 68 65 20 77 6f 72 | .infinite.future......In.the.wor |
| 562c0 | 64 73 20 6f 66 20 46 72 61 6e 63 69 73 20 41 2e 20 57 61 6c 6b 65 72 20 28 4d 49 54 27 73 20 74 | ds.of.Francis.A..Walker.(MIT's.t |
| 562e0 | 68 69 72 64 20 70 72 65 73 69 64 65 6e 74 29 3a 0a 0a 20 20 20 20 20 41 6c 6c 20 68 69 73 20 6c | hird.president):.......All.his.l |
| 56300 | 69 66 65 20 68 65 20 68 61 64 20 62 6f 72 6e 65 20 68 69 6d 73 65 6c 66 20 6d 6f 73 74 20 66 61 | ife.he.had.borne.himself.most.fa |
| 56320 | 69 74 68 66 75 6c 6c 79 20 61 6e 64 20 68 65 72 6f 69 63 61 6c 6c 79 2c 0a 20 20 20 20 20 61 6e | ithfully.and.heroically,......an |
| 56340 | 64 20 68 65 20 64 69 65 64 20 61 73 20 73 6f 20 67 6f 6f 64 20 61 20 6b 6e 69 67 68 74 20 77 6f | d.he.died.as.so.good.a.knight.wo |
| 56360 | 75 6c 64 20 73 75 72 65 6c 79 20 68 61 76 65 20 77 69 73 68 65 64 2c 20 69 6e 0a 20 20 20 20 20 | uld.surely.have.wished,.in...... |
| 56380 | 68 61 72 6e 65 73 73 2c 20 61 74 20 68 69 73 20 70 6f 73 74 2c 20 61 6e 64 20 69 6e 20 74 68 65 | harness,.at.his.post,.and.in.the |
| 563a0 | 20 76 65 72 79 20 70 61 72 74 20 61 6e 64 20 61 63 74 20 6f 66 20 70 75 62 6c 69 63 20 64 75 74 | .very.part.and.act.of.public.dut |
| 563c0 | 79 2e 0a 0a 20 20 20 28 33 29 20 45 71 75 69 76 61 6c 65 6e 74 6c 79 2c 20 77 65 20 63 6f 75 6c | y......(3).Equivalently,.we.coul |
| 563e0 | 64 20 77 72 69 74 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 66 6c 69 70 70 65 64 2d 70 61 | d.write.......(define.flipped-pa |
| 56400 | 69 72 73 0a 20 20 20 20 20 20 20 28 73 71 75 61 72 65 2d 6f 66 2d 66 6f 75 72 20 69 64 65 6e 74 | irs........(square-of-four.ident |
| 56420 | 69 74 79 20 66 6c 69 70 2d 76 65 72 74 20 69 64 65 6e 74 69 74 79 20 66 6c 69 70 2d 76 65 72 74 | ity.flip-vert.identity.flip-vert |
| 56440 | 29 29 0a 0a 20 20 20 28 34 29 20 60 52 6f 74 61 74 65 31 38 30 27 20 72 6f 74 61 74 65 73 20 61 | )).....(4).`Rotate180'.rotates.a |
| 56460 | 20 70 61 69 6e 74 65 72 20 62 79 20 31 38 30 20 64 65 67 72 65 65 73 20 28 73 65 65 20 2a 4e 6f | .painter.by.180.degrees.(see.*No |
| 56480 | 74 65 20 45 78 65 72 63 69 73 65 0a 32 2d 35 30 3a 3a 29 2e 20 20 49 6e 73 74 65 61 64 20 6f 66 | te.Exercise.2-50::)...Instead.of |
| 564a0 | 20 60 72 6f 74 61 74 65 31 38 30 27 20 77 65 20 63 6f 75 6c 64 20 73 61 79 20 60 28 63 6f 6d 70 | .`rotate180'.we.could.say.`(comp |
| 564c0 | 6f 73 65 20 66 6c 69 70 2d 76 65 72 74 0a 66 6c 69 70 2d 68 6f 72 69 7a 29 27 2c 20 75 73 69 6e | ose.flip-vert.flip-horiz)',.usin |
| 564e0 | 67 20 74 68 65 20 60 63 6f 6d 70 6f 73 65 27 20 70 72 6f 63 65 64 75 72 65 20 66 72 6f 6d 20 2a | g.the.`compose'.procedure.from.* |
| 56500 | 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d 34 32 3a 3a 2e 0a 0a 20 20 20 28 35 29 20 60 46 | Note.Exercise.1-42::......(5).`F |
| 56520 | 72 61 6d 65 2d 63 6f 6f 72 64 2d 6d 61 70 27 20 75 73 65 73 20 74 68 65 20 76 65 63 74 6f 72 20 | rame-coord-map'.uses.the.vector. |
| 56540 | 6f 70 65 72 61 74 69 6f 6e 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f 74 65 0a 45 78 | operations.described.in.*Note.Ex |
| 56560 | 65 72 63 69 73 65 20 32 2d 34 36 3a 3a 20 62 65 6c 6f 77 2c 20 77 68 69 63 68 20 77 65 20 61 73 | ercise.2-46::.below,.which.we.as |
| 56580 | 73 75 6d 65 20 68 61 76 65 20 62 65 65 6e 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 75 73 69 6e 67 | sume.have.been.implemented.using |
| 565a0 | 20 73 6f 6d 65 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 76 65 63 74 6f 72 73 | .some.representation.for.vectors |
| 565c0 | 2e 20 20 42 65 63 61 75 73 65 20 6f 66 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 | ...Because.of.data.abstraction,. |
| 565e0 | 69 74 20 64 6f 65 73 6e 27 74 0a 6d 61 74 74 65 72 20 77 68 61 74 20 74 68 69 73 20 76 65 63 74 | it.doesn't.matter.what.this.vect |
| 56600 | 6f 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 2c 20 73 6f 20 6c 6f 6e 67 20 61 73 | or.representation.is,.so.long.as |
| 56620 | 20 74 68 65 20 76 65 63 74 6f 72 0a 6f 70 65 72 61 74 69 6f 6e 73 20 62 65 68 61 76 65 20 63 6f | .the.vector.operations.behave.co |
| 56640 | 72 72 65 63 74 6c 79 2e 0a 0a 20 20 20 28 36 29 20 60 53 65 67 6d 65 6e 74 73 2d 3e 70 61 69 6e | rrectly......(6).`Segments->pain |
| 56660 | 74 65 72 27 20 75 73 65 73 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 | ter'.uses.the.representation.for |
| 56680 | 20 6c 69 6e 65 20 73 65 67 6d 65 6e 74 73 0a 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f 74 | .line.segments.described.in.*Not |
| 566a0 | 65 20 45 78 65 72 63 69 73 65 20 32 2d 34 38 3a 3a 20 62 65 6c 6f 77 2e 20 20 49 74 20 61 6c 73 | e.Exercise.2-48::.below...It.als |
| 566c0 | 6f 20 75 73 65 73 20 74 68 65 20 60 66 6f 72 2d 65 61 63 68 27 0a 70 72 6f 63 65 64 75 72 65 20 | o.uses.the.`for-each'.procedure. |
| 566e0 | 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 32 33 | described.in.*Note.Exercise.2-23 |
| 56700 | 3a 3a 2e 0a 0a 20 20 20 28 37 29 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 60 72 6f | ::......(7).For.example,.the.`ro |
| 56720 | 67 65 72 73 27 20 70 61 69 6e 74 65 72 20 6f 66 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d | gers'.painter.of.*Note.Figure.2- |
| 56740 | 31 31 3a 3a 20 77 61 73 0a 63 6f 6e 73 74 72 75 63 74 65 64 20 66 72 6f 6d 20 61 20 67 72 61 79 | 11::.was.constructed.from.a.gray |
| 56760 | 2d 6c 65 76 65 6c 20 69 6d 61 67 65 2e 20 20 46 6f 72 20 65 61 63 68 20 70 6f 69 6e 74 20 69 6e | -level.image...For.each.point.in |
| 56780 | 20 61 20 67 69 76 65 6e 20 66 72 61 6d 65 2c 0a 74 68 65 20 60 72 6f 67 65 72 73 27 20 70 61 69 | .a.given.frame,.the.`rogers'.pai |
| 567a0 | 6e 74 65 72 20 64 65 74 65 72 6d 69 6e 65 73 20 74 68 65 20 70 6f 69 6e 74 20 69 6e 20 74 68 65 | nter.determines.the.point.in.the |
| 567c0 | 20 69 6d 61 67 65 20 74 68 61 74 20 69 73 20 6d 61 70 70 65 64 0a 74 6f 20 69 74 20 75 6e 64 65 | .image.that.is.mapped.to.it.unde |
| 567e0 | 72 20 74 68 65 20 66 72 61 6d 65 20 63 6f 6f 72 64 69 6e 61 74 65 20 6d 61 70 2c 20 61 6e 64 20 | r.the.frame.coordinate.map,.and. |
| 56800 | 73 68 61 64 65 73 20 69 74 20 61 63 63 6f 72 64 69 6e 67 6c 79 2e 20 20 42 79 0a 61 6c 6c 6f 77 | shades.it.accordingly...By.allow |
| 56820 | 69 6e 67 20 64 69 66 66 65 72 65 6e 74 20 74 79 70 65 73 20 6f 66 20 70 61 69 6e 74 65 72 73 2c | ing.different.types.of.painters, |
| 56840 | 20 77 65 20 61 72 65 20 63 61 70 69 74 61 6c 69 7a 69 6e 67 20 6f 6e 20 74 68 65 0a 61 62 73 74 | .we.are.capitalizing.on.the.abst |
| 56860 | 72 61 63 74 20 64 61 74 61 20 69 64 65 61 20 64 69 73 63 75 73 73 65 64 20 69 6e 20 73 65 63 74 | ract.data.idea.discussed.in.sect |
| 56880 | 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 31 2d 33 3a 3a 2c 20 77 68 65 72 65 20 77 65 20 61 72 67 75 | ion.*Note.2-1-3::,.where.we.argu |
| 568a0 | 65 64 0a 74 68 61 74 20 61 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 72 65 70 72 65 73 | ed.that.a.rational-number.repres |
| 568c0 | 65 6e 74 61 74 69 6f 6e 20 63 6f 75 6c 64 20 62 65 20 61 6e 79 74 68 69 6e 67 20 61 74 20 61 6c | entation.could.be.anything.at.al |
| 568e0 | 6c 20 74 68 61 74 0a 73 61 74 69 73 66 69 65 73 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20 | l.that.satisfies.an.appropriate. |
| 56900 | 63 6f 6e 64 69 74 69 6f 6e 2e 20 20 48 65 72 65 20 77 65 27 72 65 20 75 73 69 6e 67 20 74 68 65 | condition...Here.we're.using.the |
| 56920 | 20 66 61 63 74 20 74 68 61 74 20 61 0a 70 61 69 6e 74 65 72 20 63 61 6e 20 62 65 20 69 6d 70 6c | .fact.that.a.painter.can.be.impl |
| 56940 | 65 6d 65 6e 74 65 64 20 69 6e 20 61 6e 79 20 77 61 79 20 61 74 20 61 6c 6c 2c 20 73 6f 20 6c 6f | emented.in.any.way.at.all,.so.lo |
| 56960 | 6e 67 20 61 73 20 69 74 20 64 72 61 77 73 0a 73 6f 6d 65 74 68 69 6e 67 20 69 6e 20 74 68 65 20 | ng.as.it.draws.something.in.the. |
| 56980 | 64 65 73 69 67 6e 61 74 65 64 20 66 72 61 6d 65 2e 20 20 53 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | designated.frame...Section.*Note |
| 569a0 | 20 32 2d 31 2d 33 3a 3a 20 61 6c 73 6f 20 73 68 6f 77 65 64 0a 68 6f 77 20 70 61 69 72 73 20 63 | .2-1-3::.also.showed.how.pairs.c |
| 569c0 | 6f 75 6c 64 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 70 72 6f 63 65 64 75 72 65 | ould.be.implemented.as.procedure |
| 569e0 | 73 2e 20 20 50 61 69 6e 74 65 72 73 20 61 72 65 20 6f 75 72 20 73 65 63 6f 6e 64 0a 65 78 61 6d | s...Painters.are.our.second.exam |
| 56a00 | 70 6c 65 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 | ple.of.a.procedural.representati |
| 56a20 | 6f 6e 20 66 6f 72 20 64 61 74 61 2e 0a 0a 20 20 20 28 38 29 20 60 52 6f 74 61 74 65 39 30 27 20 | on.for.data......(8).`Rotate90'. |
| 56a40 | 69 73 20 61 20 70 75 72 65 20 72 6f 74 61 74 69 6f 6e 20 6f 6e 6c 79 20 66 6f 72 20 73 71 75 61 | is.a.pure.rotation.only.for.squa |
| 56a60 | 72 65 20 66 72 61 6d 65 73 2c 20 62 65 63 61 75 73 65 20 69 74 0a 61 6c 73 6f 20 73 74 72 65 74 | re.frames,.because.it.also.stret |
| 56a80 | 63 68 65 73 20 61 6e 64 20 73 68 72 69 6e 6b 73 20 74 68 65 20 69 6d 61 67 65 20 74 6f 20 66 69 | ches.and.shrinks.the.image.to.fi |
| 56aa0 | 74 20 69 6e 74 6f 20 74 68 65 20 72 6f 74 61 74 65 64 20 66 72 61 6d 65 2e 0a 0a 20 20 20 28 39 | t.into.the.rotated.frame......(9 |
| 56ac0 | 29 20 54 68 65 20 64 69 61 6d 6f 6e 64 2d 73 68 61 70 65 64 20 69 6d 61 67 65 73 20 69 6e 20 66 | ).The.diamond-shaped.images.in.f |
| 56ae0 | 69 67 75 72 65 73 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 30 3a 3a 20 61 6e 64 0a 2a | igures.*Note.Figure.2-10::.and.* |
| 56b00 | 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 31 3a 3a 20 77 65 72 65 20 63 72 65 61 74 65 64 20 | Note.Figure.2-11::.were.created. |
| 56b20 | 77 69 74 68 20 60 73 71 75 61 73 68 2d 69 6e 77 61 72 64 73 27 20 61 70 70 6c 69 65 64 20 74 6f | with.`squash-inwards'.applied.to |
| 56b40 | 0a 60 77 61 76 65 27 20 61 6e 64 20 60 72 6f 67 65 72 73 27 2e 0a 0a 20 20 20 28 31 30 29 20 53 | .`wave'.and.`rogers'......(10).S |
| 56b60 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 33 2d 34 3a 3a 20 64 65 73 63 72 69 62 65 73 20 6f | ection.*Note.3-3-4::.describes.o |
| 56b80 | 6e 65 20 73 75 63 68 20 6c 61 6e 67 75 61 67 65 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e | ne.such.language.....File:.sicp. |
| 56ba0 | 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 33 2c 20 20 4e 65 78 74 3a 20 32 2d 34 2c 20 20 50 | info,..Node:.2-3,..Next:.2-4,..P |
| 56bc0 | 72 65 76 3a 20 32 2d 32 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 32 0a 0a 32 2e 33 20 53 79 | rev:.2-2,..Up:.Chapter.2..2.3.Sy |
| 56be0 | 6d 62 6f 6c 69 63 20 44 61 74 61 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 41 | mbolic.Data.=================..A |
| 56c00 | 6c 6c 20 74 68 65 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 77 65 20 | ll.the.compound.data.objects.we. |
| 56c20 | 68 61 76 65 20 75 73 65 64 20 73 6f 20 66 61 72 20 77 65 72 65 20 63 6f 6e 73 74 72 75 63 74 65 | have.used.so.far.were.constructe |
| 56c40 | 64 0a 75 6c 74 69 6d 61 74 65 6c 79 20 66 72 6f 6d 20 6e 75 6d 62 65 72 73 2e 20 20 49 6e 20 74 | d.ultimately.from.numbers...In.t |
| 56c60 | 68 69 73 20 73 65 63 74 69 6f 6e 20 77 65 20 65 78 74 65 6e 64 20 74 68 65 0a 72 65 70 72 65 73 | his.section.we.extend.the.repres |
| 56c80 | 65 6e 74 61 74 69 6f 6e 61 6c 20 63 61 70 61 62 69 6c 69 74 79 20 6f 66 20 6f 75 72 20 6c 61 6e | entational.capability.of.our.lan |
| 56ca0 | 67 75 61 67 65 20 62 79 20 69 6e 74 72 6f 64 75 63 69 6e 67 20 74 68 65 20 61 62 69 6c 69 74 79 | guage.by.introducing.the.ability |
| 56cc0 | 0a 74 6f 20 77 6f 72 6b 20 77 69 74 68 20 61 72 62 69 74 72 61 72 79 20 73 79 6d 62 6f 6c 73 20 | .to.work.with.arbitrary.symbols. |
| 56ce0 | 61 73 20 64 61 74 61 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 32 2d 33 2d 31 3a 3a 20 20 20 20 | as.data...*.Menu:..*.2-3-1::.... |
| 56d00 | 20 20 20 20 20 20 20 20 51 75 6f 74 61 74 69 6f 6e 0a 2a 20 32 2d 33 2d 32 3a 3a 20 20 20 20 20 | ........Quotation.*.2-3-2::..... |
| 56d20 | 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 53 79 6d 62 6f 6c 69 63 20 44 69 66 66 65 72 65 | .......Example:.Symbolic.Differe |
| 56d40 | 6e 74 69 61 74 69 6f 6e 0a 2a 20 32 2d 33 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 | ntiation.*.2-3-3::............Ex |
| 56d60 | 61 6d 70 6c 65 3a 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 53 65 74 73 0a 2a 20 32 2d 33 2d 34 | ample:.Representing.Sets.*.2-3-4 |
| 56d80 | 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 48 75 66 66 6d 61 6e 20 45 | ::............Example:.Huffman.E |
| 56da0 | 6e 63 6f 64 69 6e 67 20 54 72 65 65 73 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f | ncoding.Trees....File:.sicp.info |
| 56dc0 | 2c 20 20 4e 6f 64 65 3a 20 32 2d 33 2d 31 2c 20 20 4e 65 78 74 3a 20 32 2d 33 2d 32 2c 20 20 50 | ,..Node:.2-3-1,..Next:.2-3-2,..P |
| 56de0 | 72 65 76 3a 20 32 2d 33 2c 20 20 55 70 3a 20 32 2d 33 0a 0a 32 2e 33 2e 31 20 51 75 6f 74 61 74 | rev:.2-3,..Up:.2-3..2.3.1.Quotat |
| 56e00 | 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 66 20 77 65 20 63 61 6e 20 66 | ion.---------------..If.we.can.f |
| 56e20 | 6f 72 6d 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 75 73 69 6e 67 20 73 79 6d 62 6f 6c 73 2c | orm.compound.data.using.symbols, |
| 56e40 | 20 77 65 20 63 61 6e 20 68 61 76 65 20 6c 69 73 74 73 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 | .we.can.have.lists.such.as...... |
| 56e60 | 20 28 61 20 62 20 63 20 64 29 0a 20 20 20 20 20 28 32 33 20 34 35 20 31 37 29 0a 20 20 20 20 20 | .(a.b.c.d)......(23.45.17)...... |
| 56e80 | 28 28 4e 6f 72 61 68 20 31 32 29 20 28 4d 6f 6c 6c 79 20 39 29 20 28 41 6e 6e 61 20 37 29 20 28 | ((Norah.12).(Molly.9).(Anna.7).( |
| 56ea0 | 4c 61 75 72 65 6e 20 36 29 20 28 43 68 61 72 6c 6f 74 74 65 20 34 29 29 0a 0a 20 20 20 4c 69 73 | Lauren.6).(Charlotte.4)).....Lis |
| 56ec0 | 74 73 20 63 6f 6e 74 61 69 6e 69 6e 67 20 73 79 6d 62 6f 6c 73 20 63 61 6e 20 6c 6f 6f 6b 20 6a | ts.containing.symbols.can.look.j |
| 56ee0 | 75 73 74 20 6c 69 6b 65 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 6f 66 20 6f 75 72 0a | ust.like.the.expressions.of.our. |
| 56f00 | 6c 61 6e 67 75 61 67 65 3a 0a 0a 20 20 20 20 20 28 2a 20 28 2b 20 32 33 20 34 35 29 20 28 2b 20 | language:.......(*.(+.23.45).(+. |
| 56f20 | 78 20 39 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 20 6e 29 20 28 69 66 | x.9)).......(define.(fact.n).(if |
| 56f40 | 20 28 3d 20 6e 20 31 29 20 31 20 28 2a 20 6e 20 28 66 61 63 74 20 28 2d 20 6e 20 31 29 29 29 29 | .(=.n.1).1.(*.n.(fact.(-.n.1)))) |
| 56f60 | 29 0a 0a 20 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 20 73 79 6d | ).....In.order.to.manipulate.sym |
| 56f80 | 62 6f 6c 73 20 77 65 20 6e 65 65 64 20 61 20 6e 65 77 20 65 6c 65 6d 65 6e 74 20 69 6e 20 6f 75 | bols.we.need.a.new.element.in.ou |
| 56fa0 | 72 0a 6c 61 6e 67 75 61 67 65 3a 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 22 71 75 6f 74 | r.language:.the.ability.to."quot |
| 56fc0 | 65 22 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 2e 20 20 53 75 70 70 6f 73 65 20 77 65 20 77 61 | e".a.data.object...Suppose.we.wa |
| 56fe0 | 6e 74 20 74 6f 0a 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 6c 69 73 74 20 60 28 61 20 62 29 27 | nt.to.construct.the.list.`(a.b)' |
| 57000 | 2e 20 20 57 65 20 63 61 6e 27 74 20 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 20 77 69 74 68 | ...We.can't.accomplish.this.with |
| 57020 | 20 60 28 6c 69 73 74 20 61 0a 62 29 27 2c 20 62 65 63 61 75 73 65 20 74 68 69 73 20 65 78 70 72 | .`(list.a.b)',.because.this.expr |
| 57040 | 65 73 73 69 6f 6e 20 63 6f 6e 73 74 72 75 63 74 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 | ession.constructs.a.list.of.the. |
| 57060 | 22 76 61 6c 75 65 73 22 20 6f 66 20 60 61 27 0a 61 6e 64 20 60 62 27 20 72 61 74 68 65 72 20 74 | "values".of.`a'.and.`b'.rather.t |
| 57080 | 68 61 6e 20 74 68 65 20 73 79 6d 62 6f 6c 73 20 74 68 65 6d 73 65 6c 76 65 73 2e 20 20 54 68 69 | han.the.symbols.themselves...Thi |
| 570a0 | 73 20 69 73 73 75 65 20 69 73 20 77 65 6c 6c 20 6b 6e 6f 77 6e 0a 69 6e 20 74 68 65 20 63 6f 6e | s.issue.is.well.known.in.the.con |
| 570c0 | 74 65 78 74 20 6f 66 20 6e 61 74 75 72 61 6c 20 6c 61 6e 67 75 61 67 65 73 2c 20 77 68 65 72 65 | text.of.natural.languages,.where |
| 570e0 | 20 77 6f 72 64 73 20 61 6e 64 20 73 65 6e 74 65 6e 63 65 73 20 6d 61 79 20 62 65 0a 72 65 67 61 | .words.and.sentences.may.be.rega |
| 57100 | 72 64 65 64 20 65 69 74 68 65 72 20 61 73 20 73 65 6d 61 6e 74 69 63 20 65 6e 74 69 74 69 65 73 | rded.either.as.semantic.entities |
| 57120 | 20 6f 72 20 61 73 20 63 68 61 72 61 63 74 65 72 20 73 74 72 69 6e 67 73 20 28 73 79 6e 74 61 63 | .or.as.character.strings.(syntac |
| 57140 | 74 69 63 0a 65 6e 74 69 74 69 65 73 29 2e 20 20 54 68 65 20 63 6f 6d 6d 6f 6e 20 70 72 61 63 74 | tic.entities)...The.common.pract |
| 57160 | 69 63 65 20 69 6e 20 6e 61 74 75 72 61 6c 20 6c 61 6e 67 75 61 67 65 73 20 69 73 20 74 6f 20 75 | ice.in.natural.languages.is.to.u |
| 57180 | 73 65 0a 71 75 6f 74 61 74 69 6f 6e 20 6d 61 72 6b 73 20 74 6f 20 69 6e 64 69 63 61 74 65 20 74 | se.quotation.marks.to.indicate.t |
| 571a0 | 68 61 74 20 61 20 77 6f 72 64 20 6f 72 20 61 20 73 65 6e 74 65 6e 63 65 20 69 73 20 74 6f 20 62 | hat.a.word.or.a.sentence.is.to.b |
| 571c0 | 65 20 74 72 65 61 74 65 64 0a 6c 69 74 65 72 61 6c 6c 79 20 61 73 20 61 20 73 74 72 69 6e 67 20 | e.treated.literally.as.a.string. |
| 571e0 | 6f 66 20 63 68 61 72 61 63 74 65 72 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 68 | of.characters...For.instance,.th |
| 57200 | 65 20 66 69 72 73 74 20 6c 65 74 74 65 72 20 6f 66 0a 22 4a 6f 68 6e 22 20 69 73 20 63 6c 65 61 | e.first.letter.of."John".is.clea |
| 57220 | 72 6c 79 20 22 4a 2e 22 20 20 49 66 20 77 65 20 74 65 6c 6c 20 73 6f 6d 65 62 6f 64 79 20 22 73 | rly."J."..If.we.tell.somebody."s |
| 57240 | 61 79 20 79 6f 75 72 20 6e 61 6d 65 20 61 6c 6f 75 64 2c 22 20 77 65 0a 65 78 70 65 63 74 20 74 | ay.your.name.aloud,".we.expect.t |
| 57260 | 6f 20 68 65 61 72 20 74 68 61 74 20 70 65 72 73 6f 6e 27 73 20 6e 61 6d 65 2e 20 20 48 6f 77 65 | o.hear.that.person's.name...Howe |
| 57280 | 76 65 72 2c 20 69 66 20 77 65 20 74 65 6c 6c 20 73 6f 6d 65 62 6f 64 79 20 22 73 61 79 0a 60 79 | ver,.if.we.tell.somebody."say.`y |
| 572a0 | 6f 75 72 20 6e 61 6d 65 27 20 61 6c 6f 75 64 2c 22 20 77 65 20 65 78 70 65 63 74 20 74 6f 20 68 | our.name'.aloud,".we.expect.to.h |
| 572c0 | 65 61 72 20 74 68 65 20 77 6f 72 64 73 20 22 79 6f 75 72 20 6e 61 6d 65 2e 22 20 20 4e 6f 74 65 | ear.the.words."your.name."..Note |
| 572e0 | 20 74 68 61 74 0a 77 65 20 61 72 65 20 66 6f 72 63 65 64 20 74 6f 20 6e 65 73 74 20 71 75 6f 74 | .that.we.are.forced.to.nest.quot |
| 57300 | 61 74 69 6f 6e 20 6d 61 72 6b 73 20 74 6f 20 64 65 73 63 72 69 62 65 20 77 68 61 74 20 73 6f 6d | ation.marks.to.describe.what.som |
| 57320 | 65 62 6f 64 79 20 65 6c 73 65 0a 6d 69 67 68 74 20 73 61 79 2e 28 31 29 0a 0a 20 20 20 57 65 20 | ebody.else.might.say.(1).....We. |
| 57340 | 63 61 6e 20 66 6f 6c 6c 6f 77 20 74 68 69 73 20 73 61 6d 65 20 70 72 61 63 74 69 63 65 20 74 6f | can.follow.this.same.practice.to |
| 57360 | 20 69 64 65 6e 74 69 66 79 20 6c 69 73 74 73 20 61 6e 64 20 73 79 6d 62 6f 6c 73 20 74 68 61 74 | .identify.lists.and.symbols.that |
| 57380 | 0a 61 72 65 20 74 6f 20 62 65 20 74 72 65 61 74 65 64 20 61 73 20 64 61 74 61 20 6f 62 6a 65 63 | .are.to.be.treated.as.data.objec |
| 573a0 | 74 73 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 73 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 6f | ts.rather.than.as.expressions.to |
| 573c0 | 20 62 65 0a 65 76 61 6c 75 61 74 65 64 2e 20 20 48 6f 77 65 76 65 72 2c 20 6f 75 72 20 66 6f 72 | .be.evaluated...However,.our.for |
| 573e0 | 6d 61 74 20 66 6f 72 20 71 75 6f 74 69 6e 67 20 64 69 66 66 65 72 73 20 66 72 6f 6d 20 74 68 61 | mat.for.quoting.differs.from.tha |
| 57400 | 74 20 6f 66 0a 6e 61 74 75 72 61 6c 20 6c 61 6e 67 75 61 67 65 73 20 69 6e 20 74 68 61 74 20 77 | t.of.natural.languages.in.that.w |
| 57420 | 65 20 70 6c 61 63 65 20 61 20 71 75 6f 74 61 74 69 6f 6e 20 6d 61 72 6b 20 28 74 72 61 64 69 74 | e.place.a.quotation.mark.(tradit |
| 57440 | 69 6f 6e 61 6c 6c 79 2c 20 74 68 65 0a 73 69 6e 67 6c 65 20 71 75 6f 74 65 20 73 79 6d 62 6f 6c | ionally,.the.single.quote.symbol |
| 57460 | 20 60 27 27 29 20 6f 6e 6c 79 20 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 | .`'').only.at.the.beginning.of.t |
| 57480 | 68 65 20 6f 62 6a 65 63 74 20 74 6f 20 62 65 0a 71 75 6f 74 65 64 2e 20 20 57 65 20 63 61 6e 20 | he.object.to.be.quoted...We.can. |
| 574a0 | 67 65 74 20 61 77 61 79 20 77 69 74 68 20 74 68 69 73 20 69 6e 20 53 63 68 65 6d 65 20 73 79 6e | get.away.with.this.in.Scheme.syn |
| 574c0 | 74 61 78 20 62 65 63 61 75 73 65 20 77 65 20 72 65 6c 79 20 6f 6e 0a 62 6c 61 6e 6b 73 20 61 6e | tax.because.we.rely.on.blanks.an |
| 574e0 | 64 20 70 61 72 65 6e 74 68 65 73 65 73 20 74 6f 20 64 65 6c 69 6d 69 74 20 6f 62 6a 65 63 74 73 | d.parentheses.to.delimit.objects |
| 57500 | 2e 20 20 54 68 75 73 2c 20 74 68 65 20 6d 65 61 6e 69 6e 67 20 6f 66 20 74 68 65 0a 73 69 6e 67 | ...Thus,.the.meaning.of.the.sing |
| 57520 | 6c 65 20 71 75 6f 74 65 20 63 68 61 72 61 63 74 65 72 20 69 73 20 74 6f 20 71 75 6f 74 65 20 74 | le.quote.character.is.to.quote.t |
| 57540 | 68 65 20 6e 65 78 74 20 6f 62 6a 65 63 74 2e 28 32 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 63 61 | he.next.object.(2).....Now.we.ca |
| 57560 | 6e 20 64 69 73 74 69 6e 67 75 69 73 68 20 62 65 74 77 65 65 6e 20 73 79 6d 62 6f 6c 73 20 61 6e | n.distinguish.between.symbols.an |
| 57580 | 64 20 74 68 65 69 72 20 76 61 6c 75 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 61 20 | d.their.values:.......(define.a. |
| 575a0 | 31 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 62 20 32 29 0a 0a 20 20 20 20 20 28 6c 69 73 | 1).......(define.b.2).......(lis |
| 575c0 | 74 20 61 20 62 29 0a 20 20 20 20 20 28 31 20 32 29 0a 0a 20 20 20 20 20 28 6c 69 73 74 20 27 61 | t.a.b)......(1.2).......(list.'a |
| 575e0 | 20 27 62 29 0a 20 20 20 20 20 28 61 20 62 29 0a 0a 20 20 20 20 20 28 6c 69 73 74 20 27 61 20 62 | .'b)......(a.b).......(list.'a.b |
| 57600 | 29 0a 20 20 20 20 20 28 61 20 32 29 0a 0a 20 20 20 51 75 6f 74 61 74 69 6f 6e 20 61 6c 73 6f 20 | )......(a.2).....Quotation.also. |
| 57620 | 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20 74 79 70 65 20 69 6e 20 63 6f 6d 70 6f 75 6e 64 20 6f 62 | allows.us.to.type.in.compound.ob |
| 57640 | 6a 65 63 74 73 2c 20 75 73 69 6e 67 20 74 68 65 0a 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 70 72 | jects,.using.the.conventional.pr |
| 57660 | 69 6e 74 65 64 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 6c 69 73 74 73 3a 28 | inted.representation.for.lists:( |
| 57680 | 33 29 0a 0a 20 20 20 20 20 28 63 61 72 20 27 28 61 20 62 20 63 29 29 0a 20 20 20 20 20 61 0a 0a | 3).......(car.'(a.b.c))......a.. |
| 576a0 | 20 20 20 20 20 28 63 64 72 20 27 28 61 20 62 20 63 29 29 0a 20 20 20 20 20 28 62 20 63 29 0a 0a | .....(cdr.'(a.b.c))......(b.c).. |
| 576c0 | 20 20 20 49 6e 20 6b 65 65 70 69 6e 67 20 77 69 74 68 20 74 68 69 73 2c 20 77 65 20 63 61 6e 20 | ...In.keeping.with.this,.we.can. |
| 576e0 | 6f 62 74 61 69 6e 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 20 62 79 20 65 76 61 6c 75 61 74 | obtain.the.empty.list.by.evaluat |
| 57700 | 69 6e 67 0a 60 27 28 29 27 2c 20 61 6e 64 20 74 68 75 73 20 64 69 73 70 65 6e 73 65 20 77 69 74 | ing.`'()',.and.thus.dispense.wit |
| 57720 | 68 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 60 6e 69 6c 27 2e 0a 0a 20 20 20 4f 6e 65 20 61 64 | h.the.variable.`nil'......One.ad |
| 57740 | 64 69 74 69 6f 6e 61 6c 20 70 72 69 6d 69 74 69 76 65 20 75 73 65 64 20 69 6e 20 6d 61 6e 69 70 | ditional.primitive.used.in.manip |
| 57760 | 75 6c 61 74 69 6e 67 20 73 79 6d 62 6f 6c 73 20 69 73 20 60 65 71 3f 27 2c 20 77 68 69 63 68 0a | ulating.symbols.is.`eq?',.which. |
| 57780 | 74 61 6b 65 73 20 74 77 6f 20 73 79 6d 62 6f 6c 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 | takes.two.symbols.as.arguments.a |
| 577a0 | 6e 64 20 74 65 73 74 73 20 77 68 65 74 68 65 72 20 74 68 65 79 20 61 72 65 20 74 68 65 20 73 61 | nd.tests.whether.they.are.the.sa |
| 577c0 | 6d 65 2e 28 34 29 0a 55 73 69 6e 67 20 60 65 71 3f 27 2c 20 77 65 20 63 61 6e 20 69 6d 70 6c 65 | me.(4).Using.`eq?',.we.can.imple |
| 577e0 | 6d 65 6e 74 20 61 20 75 73 65 66 75 6c 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 65 64 20 60 | ment.a.useful.procedure.called.` |
| 57800 | 6d 65 6d 71 27 2e 20 20 54 68 69 73 0a 74 61 6b 65 73 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 | memq'...This.takes.two.arguments |
| 57820 | 2c 20 61 20 73 79 6d 62 6f 6c 20 61 6e 64 20 61 20 6c 69 73 74 2e 20 20 49 66 20 74 68 65 20 73 | ,.a.symbol.and.a.list...If.the.s |
| 57840 | 79 6d 62 6f 6c 20 69 73 20 6e 6f 74 0a 63 6f 6e 74 61 69 6e 65 64 20 69 6e 20 74 68 65 20 6c 69 | ymbol.is.not.contained.in.the.li |
| 57860 | 73 74 20 28 69 2e 65 2e 2c 20 69 73 20 6e 6f 74 20 60 65 71 3f 27 20 74 6f 20 61 6e 79 20 69 74 | st.(i.e.,.is.not.`eq?'.to.any.it |
| 57880 | 65 6d 20 69 6e 20 74 68 65 20 6c 69 73 74 29 2c 0a 74 68 65 6e 20 60 6d 65 6d 71 27 20 72 65 74 | em.in.the.list),.then.`memq'.ret |
| 578a0 | 75 72 6e 73 20 66 61 6c 73 65 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 69 74 20 72 65 74 75 72 | urns.false...Otherwise,.it.retur |
| 578c0 | 6e 73 20 74 68 65 20 73 75 62 6c 69 73 74 20 6f 66 20 74 68 65 0a 6c 69 73 74 20 62 65 67 69 6e | ns.the.sublist.of.the.list.begin |
| 578e0 | 6e 69 6e 67 20 77 69 74 68 20 74 68 65 20 66 69 72 73 74 20 6f 63 63 75 72 72 65 6e 63 65 20 6f | ning.with.the.first.occurrence.o |
| 57900 | 66 20 74 68 65 20 73 79 6d 62 6f 6c 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 65 6d | f.the.symbol:.......(define.(mem |
| 57920 | 71 20 69 74 65 6d 20 78 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 78 | q.item.x)........(cond.((null?.x |
| 57940 | 29 20 66 61 6c 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 69 74 65 6d | ).false)..............((eq?.item |
| 57960 | 20 28 63 61 72 20 78 29 29 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 | .(car.x)).x)..............(else. |
| 57980 | 28 6d 65 6d 71 20 69 74 65 6d 20 28 63 64 72 20 78 29 29 29 29 29 0a 0a 20 20 20 46 6f 72 20 65 | (memq.item.(cdr.x))))).....For.e |
| 579a0 | 78 61 6d 70 6c 65 2c 20 74 68 65 20 76 61 6c 75 65 20 6f 66 0a 0a 20 20 20 20 20 28 6d 65 6d 71 | xample,.the.value.of.......(memq |
| 579c0 | 20 27 61 70 70 6c 65 20 27 28 70 65 61 72 20 62 61 6e 61 6e 61 20 70 72 75 6e 65 29 29 0a 0a 69 | .'apple.'(pear.banana.prune))..i |
| 579e0 | 73 20 66 61 6c 73 65 2c 20 77 68 65 72 65 61 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 0a 0a 20 | s.false,.whereas.the.value.of... |
| 57a00 | 20 20 20 20 28 6d 65 6d 71 20 27 61 70 70 6c 65 20 27 28 78 20 28 61 70 70 6c 65 20 73 61 75 63 | ....(memq.'apple.'(x.(apple.sauc |
| 57a20 | 65 29 20 79 20 61 70 70 6c 65 20 70 65 61 72 29 29 0a 0a 69 73 20 60 28 61 70 70 6c 65 20 70 65 | e).y.apple.pear))..is.`(apple.pe |
| 57a40 | 61 72 29 27 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 35 33 3a 2a 20 57 68 61 | ar)'........*Exercise.2.53:*.Wha |
| 57a60 | 74 20 77 6f 75 6c 64 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 70 72 69 6e 74 20 69 6e | t.would.the.interpreter.print.in |
| 57a80 | 20 72 65 73 70 6f 6e 73 65 20 74 6f 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6e 67 20 65 61 63 | .response.to......evaluating.eac |
| 57aa0 | 68 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 3f 0a | h.of.the.following.expressions?. |
| 57ac0 | 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 61 20 27 62 20 27 63 29 0a 0a 20 20 20 20 | ...........(list.'a.'b.'c)...... |
| 57ae0 | 20 20 20 20 20 20 28 6c 69 73 74 20 28 6c 69 73 74 20 27 67 65 6f 72 67 65 29 29 0a 0a 20 20 20 | ......(list.(list.'george))..... |
| 57b00 | 20 20 20 20 20 20 20 28 63 64 72 20 27 28 28 78 31 20 78 32 29 20 28 79 31 20 79 32 29 29 29 0a | .......(cdr.'((x1.x2).(y1.y2))). |
| 57b20 | 0a 20 20 20 20 20 20 20 20 20 20 28 63 61 64 72 20 27 28 28 78 31 20 78 32 29 20 28 79 31 20 79 | ...........(cadr.'((x1.x2).(y1.y |
| 57b40 | 32 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 70 61 69 72 3f 20 28 63 61 72 20 27 28 61 20 | 2)))............(pair?.(car.'(a. |
| 57b60 | 73 68 6f 72 74 20 6c 69 73 74 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6d 65 6d 71 20 27 | short.list)))............(memq.' |
| 57b80 | 72 65 64 20 27 28 28 72 65 64 20 73 68 6f 65 73 29 20 28 62 6c 75 65 20 73 6f 63 6b 73 29 29 29 | red.'((red.shoes).(blue.socks))) |
| 57ba0 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6d 65 6d 71 20 27 72 65 64 20 27 28 72 65 64 20 73 68 6f | ............(memq.'red.'(red.sho |
| 57bc0 | 65 73 20 62 6c 75 65 20 73 6f 63 6b 73 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 | es.blue.socks)).......*Exercise. |
| 57be0 | 32 2e 35 34 3a 2a 20 54 77 6f 20 6c 69 73 74 73 20 61 72 65 20 73 61 69 64 20 74 6f 20 62 65 20 | 2.54:*.Two.lists.are.said.to.be. |
| 57c00 | 60 65 71 75 61 6c 3f 27 20 69 66 20 74 68 65 79 20 63 6f 6e 74 61 69 6e 0a 20 20 20 20 20 65 71 | `equal?'.if.they.contain......eq |
| 57c20 | 75 61 6c 20 65 6c 65 6d 65 6e 74 73 20 61 72 72 61 6e 67 65 64 20 69 6e 20 74 68 65 20 73 61 6d | ual.elements.arranged.in.the.sam |
| 57c40 | 65 20 6f 72 64 65 72 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 20 20 20 | e.order...For.example,.......... |
| 57c60 | 20 20 28 65 71 75 61 6c 3f 20 27 28 74 68 69 73 20 69 73 20 61 20 6c 69 73 74 29 20 27 28 74 68 | ..(equal?.'(this.is.a.list).'(th |
| 57c80 | 69 73 20 69 73 20 61 20 6c 69 73 74 29 29 0a 0a 20 20 20 20 20 69 73 20 74 72 75 65 2c 20 62 75 | is.is.a.list)).......is.true,.bu |
| 57ca0 | 74 0a 0a 20 20 20 20 20 20 20 20 20 20 28 65 71 75 61 6c 3f 20 27 28 74 68 69 73 20 69 73 20 61 | t............(equal?.'(this.is.a |
| 57cc0 | 20 6c 69 73 74 29 20 27 28 74 68 69 73 20 28 69 73 20 61 29 20 6c 69 73 74 29 29 0a 0a 20 20 20 | .list).'(this.(is.a).list))..... |
| 57ce0 | 20 20 69 73 20 66 61 6c 73 65 2e 20 20 54 6f 20 62 65 20 6d 6f 72 65 20 70 72 65 63 69 73 65 2c | ..is.false...To.be.more.precise, |
| 57d00 | 20 77 65 20 63 61 6e 20 64 65 66 69 6e 65 20 60 65 71 75 61 6c 3f 27 20 20 72 65 63 75 72 73 69 | .we.can.define.`equal?'..recursi |
| 57d20 | 76 65 6c 79 0a 20 20 20 20 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 62 61 73 69 63 20 | vely......in.terms.of.the.basic. |
| 57d40 | 60 65 71 3f 27 20 65 71 75 61 6c 69 74 79 20 6f 66 20 73 79 6d 62 6f 6c 73 20 62 79 20 73 61 79 | `eq?'.equality.of.symbols.by.say |
| 57d60 | 69 6e 67 20 74 68 61 74 20 60 61 27 0a 20 20 20 20 20 61 6e 64 20 60 62 27 20 61 72 65 20 60 65 | ing.that.`a'......and.`b'.are.`e |
| 57d80 | 71 75 61 6c 3f 27 20 69 66 20 74 68 65 79 20 61 72 65 20 62 6f 74 68 20 73 79 6d 62 6f 6c 73 20 | qual?'.if.they.are.both.symbols. |
| 57da0 | 61 6e 64 20 74 68 65 20 73 79 6d 62 6f 6c 73 20 61 72 65 0a 20 20 20 20 20 60 65 71 3f 27 2c 20 | and.the.symbols.are......`eq?',. |
| 57dc0 | 6f 72 20 69 66 20 74 68 65 79 20 61 72 65 20 62 6f 74 68 20 6c 69 73 74 73 20 73 75 63 68 20 74 | or.if.they.are.both.lists.such.t |
| 57de0 | 68 61 74 20 60 28 63 61 72 20 61 29 27 20 69 73 20 60 65 71 75 61 6c 3f 27 0a 20 20 20 20 20 74 | hat.`(car.a)'.is.`equal?'......t |
| 57e00 | 6f 20 60 28 63 61 72 20 62 29 27 20 61 6e 64 20 60 28 63 64 72 20 61 29 27 20 69 73 20 60 65 71 | o.`(car.b)'.and.`(cdr.a)'.is.`eq |
| 57e20 | 75 61 6c 3f 27 20 74 6f 20 60 28 63 64 72 20 62 29 27 2e 20 20 55 73 69 6e 67 20 74 68 69 73 0a | ual?'.to.`(cdr.b)'...Using.this. |
| 57e40 | 20 20 20 20 20 69 64 65 61 2c 20 69 6d 70 6c 65 6d 65 6e 74 20 60 65 71 75 61 6c 3f 27 20 61 73 | .....idea,.implement.`equal?'.as |
| 57e60 | 20 61 20 70 72 6f 63 65 64 75 72 65 2e 28 35 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | .a.procedure.(5).......*Exercise |
| 57e80 | 20 32 2e 35 35 3a 2a 20 45 76 61 20 4c 75 20 41 74 6f 72 20 74 79 70 65 73 20 74 6f 20 74 68 65 | .2.55:*.Eva.Lu.Ator.types.to.the |
| 57ea0 | 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 68 65 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e | .interpreter.the......expression |
| 57ec0 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 27 27 61 62 72 61 63 61 64 61 62 72 61 29 0a | ............(car.''abracadabra). |
| 57ee0 | 0a 20 20 20 20 20 54 6f 20 68 65 72 20 73 75 72 70 72 69 73 65 2c 20 74 68 65 20 69 6e 74 65 72 | ......To.her.surprise,.the.inter |
| 57f00 | 70 72 65 74 65 72 20 70 72 69 6e 74 73 20 62 61 63 6b 20 60 71 75 6f 74 65 27 2e 20 20 45 78 70 | preter.prints.back.`quote'...Exp |
| 57f20 | 6c 61 69 6e 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d | lain......----------.Footnotes.- |
| 57f40 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 41 6c 6c 6f 77 69 6e 67 20 71 75 6f 74 61 | ---------.....(1).Allowing.quota |
| 57f60 | 74 69 6f 6e 20 69 6e 20 61 20 6c 61 6e 67 75 61 67 65 20 77 72 65 61 6b 73 20 68 61 76 6f 63 20 | tion.in.a.language.wreaks.havoc. |
| 57f80 | 77 69 74 68 20 74 68 65 20 61 62 69 6c 69 74 79 0a 74 6f 20 72 65 61 73 6f 6e 20 61 62 6f 75 74 | with.the.ability.to.reason.about |
| 57fa0 | 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 69 6e 20 73 69 6d 70 6c 65 20 74 65 72 6d 73 2c 20 62 | .the.language.in.simple.terms,.b |
| 57fc0 | 65 63 61 75 73 65 20 69 74 20 64 65 73 74 72 6f 79 73 20 74 68 65 0a 6e 6f 74 69 6f 6e 20 74 68 | ecause.it.destroys.the.notion.th |
| 57fe0 | 61 74 20 65 71 75 61 6c 73 20 63 61 6e 20 62 65 20 73 75 62 73 74 69 74 75 74 65 64 20 66 6f 72 | at.equals.can.be.substituted.for |
| 58000 | 20 65 71 75 61 6c 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 72 65 65 0a 69 73 20 | .equals...For.example,.three.is. |
| 58020 | 6f 6e 65 20 70 6c 75 73 20 74 77 6f 2c 20 62 75 74 20 74 68 65 20 77 6f 72 64 20 22 74 68 72 65 | one.plus.two,.but.the.word."thre |
| 58040 | 65 22 20 69 73 20 6e 6f 74 20 74 68 65 20 70 68 72 61 73 65 20 22 6f 6e 65 20 70 6c 75 73 20 74 | e".is.not.the.phrase."one.plus.t |
| 58060 | 77 6f 2e 22 0a 51 75 6f 74 61 74 69 6f 6e 20 69 73 20 70 6f 77 65 72 66 75 6c 20 62 65 63 61 75 | wo.".Quotation.is.powerful.becau |
| 58080 | 73 65 20 69 74 20 67 69 76 65 73 20 75 73 20 61 20 77 61 79 20 74 6f 20 62 75 69 6c 64 20 65 78 | se.it.gives.us.a.way.to.build.ex |
| 580a0 | 70 72 65 73 73 69 6f 6e 73 0a 74 68 61 74 20 6d 61 6e 69 70 75 6c 61 74 65 20 6f 74 68 65 72 20 | pressions.that.manipulate.other. |
| 580c0 | 65 78 70 72 65 73 73 69 6f 6e 73 20 28 61 73 20 77 65 20 77 69 6c 6c 20 73 65 65 20 77 68 65 6e | expressions.(as.we.will.see.when |
| 580e0 | 20 77 65 20 77 72 69 74 65 20 61 6e 0a 69 6e 74 65 72 70 72 65 74 65 72 20 69 6e 20 2a 4e 6f 74 | .we.write.an.interpreter.in.*Not |
| 58100 | 65 20 43 68 61 70 74 65 72 20 34 3a 3a 29 2e 20 42 75 74 20 61 6c 6c 6f 77 69 6e 67 20 73 74 61 | e.Chapter.4::)..But.allowing.sta |
| 58120 | 74 65 6d 65 6e 74 73 20 69 6e 20 61 0a 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 74 61 6c 6b 20 | tements.in.a.language.that.talk. |
| 58140 | 61 62 6f 75 74 20 6f 74 68 65 72 20 73 74 61 74 65 6d 65 6e 74 73 20 69 6e 20 74 68 61 74 20 6c | about.other.statements.in.that.l |
| 58160 | 61 6e 67 75 61 67 65 20 6d 61 6b 65 73 20 69 74 0a 76 65 72 79 20 64 69 66 66 69 63 75 6c 74 20 | anguage.makes.it.very.difficult. |
| 58180 | 74 6f 20 6d 61 69 6e 74 61 69 6e 20 61 6e 79 20 63 6f 68 65 72 65 6e 74 20 70 72 69 6e 63 69 70 | to.maintain.any.coherent.princip |
| 581a0 | 6c 65 20 6f 66 20 77 68 61 74 20 22 65 71 75 61 6c 73 20 63 61 6e 0a 62 65 20 73 75 62 73 74 69 | le.of.what."equals.can.be.substi |
| 581c0 | 74 75 74 65 64 20 66 6f 72 20 65 71 75 61 6c 73 22 20 73 68 6f 75 6c 64 20 6d 65 61 6e 2e 20 20 | tuted.for.equals".should.mean... |
| 581e0 | 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 77 65 20 6b 6e 6f 77 20 74 68 61 74 0a 74 68 65 | For.example,.if.we.know.that.the |
| 58200 | 20 65 76 65 6e 69 6e 67 20 73 74 61 72 20 69 73 20 74 68 65 20 6d 6f 72 6e 69 6e 67 20 73 74 61 | .evening.star.is.the.morning.sta |
| 58220 | 72 2c 20 74 68 65 6e 20 66 72 6f 6d 20 74 68 65 20 73 74 61 74 65 6d 65 6e 74 20 22 74 68 65 0a | r,.then.from.the.statement."the. |
| 58240 | 65 76 65 6e 69 6e 67 20 73 74 61 72 20 69 73 20 56 65 6e 75 73 22 20 77 65 20 63 61 6e 20 64 65 | evening.star.is.Venus".we.can.de |
| 58260 | 64 75 63 65 20 22 74 68 65 20 6d 6f 72 6e 69 6e 67 20 73 74 61 72 20 69 73 20 56 65 6e 75 73 2e | duce."the.morning.star.is.Venus. |
| 58280 | 22 0a 48 6f 77 65 76 65 72 2c 20 67 69 76 65 6e 20 74 68 61 74 20 22 4a 6f 68 6e 20 6b 6e 6f 77 | ".However,.given.that."John.know |
| 582a0 | 73 20 74 68 61 74 20 74 68 65 20 65 76 65 6e 69 6e 67 20 73 74 61 72 20 69 73 20 56 65 6e 75 73 | s.that.the.evening.star.is.Venus |
| 582c0 | 22 20 77 65 0a 63 61 6e 6e 6f 74 20 69 6e 66 65 72 20 74 68 61 74 20 22 4a 6f 68 6e 20 6b 6e 6f | ".we.cannot.infer.that."John.kno |
| 582e0 | 77 73 20 74 68 61 74 20 74 68 65 20 6d 6f 72 6e 69 6e 67 20 73 74 61 72 20 69 73 20 56 65 6e 75 | ws.that.the.morning.star.is.Venu |
| 58300 | 73 2e 22 0a 0a 20 20 20 28 32 29 20 54 68 65 20 73 69 6e 67 6c 65 20 71 75 6f 74 65 20 69 73 20 | s.".....(2).The.single.quote.is. |
| 58320 | 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d 20 74 68 65 20 64 6f 75 62 6c 65 20 71 75 6f 74 65 20 | different.from.the.double.quote. |
| 58340 | 77 65 20 68 61 76 65 20 62 65 65 6e 0a 75 73 69 6e 67 20 74 6f 20 65 6e 63 6c 6f 73 65 20 63 68 | we.have.been.using.to.enclose.ch |
| 58360 | 61 72 61 63 74 65 72 20 73 74 72 69 6e 67 73 20 74 6f 20 62 65 20 70 72 69 6e 74 65 64 2e 20 20 | aracter.strings.to.be.printed... |
| 58380 | 57 68 65 72 65 61 73 20 74 68 65 20 73 69 6e 67 6c 65 0a 71 75 6f 74 65 20 63 61 6e 20 62 65 20 | Whereas.the.single.quote.can.be. |
| 583a0 | 75 73 65 64 20 74 6f 20 64 65 6e 6f 74 65 20 6c 69 73 74 73 20 6f 72 20 73 79 6d 62 6f 6c 73 2c | used.to.denote.lists.or.symbols, |
| 583c0 | 20 74 68 65 20 64 6f 75 62 6c 65 20 71 75 6f 74 65 20 69 73 20 75 73 65 64 0a 6f 6e 6c 79 20 77 | .the.double.quote.is.used.only.w |
| 583e0 | 69 74 68 20 63 68 61 72 61 63 74 65 72 20 73 74 72 69 6e 67 73 2e 20 20 49 6e 20 74 68 69 73 20 | ith.character.strings...In.this. |
| 58400 | 62 6f 6f 6b 2c 20 74 68 65 20 6f 6e 6c 79 20 75 73 65 20 66 6f 72 20 63 68 61 72 61 63 74 65 72 | book,.the.only.use.for.character |
| 58420 | 0a 73 74 72 69 6e 67 73 20 69 73 20 61 73 20 69 74 65 6d 73 20 74 6f 20 62 65 20 70 72 69 6e 74 | .strings.is.as.items.to.be.print |
| 58440 | 65 64 2e 0a 0a 20 20 20 28 33 29 20 53 74 72 69 63 74 6c 79 2c 20 6f 75 72 20 75 73 65 20 6f 66 | ed......(3).Strictly,.our.use.of |
| 58460 | 20 74 68 65 20 71 75 6f 74 61 74 69 6f 6e 20 6d 61 72 6b 20 76 69 6f 6c 61 74 65 73 20 74 68 65 | .the.quotation.mark.violates.the |
| 58480 | 20 67 65 6e 65 72 61 6c 0a 72 75 6c 65 20 74 68 61 74 20 61 6c 6c 20 63 6f 6d 70 6f 75 6e 64 20 | .general.rule.that.all.compound. |
| 584a0 | 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 73 68 6f 75 | expressions.in.our.language.shou |
| 584c0 | 6c 64 20 62 65 20 64 65 6c 69 6d 69 74 65 64 0a 62 79 20 70 61 72 65 6e 74 68 65 73 65 73 20 61 | ld.be.delimited.by.parentheses.a |
| 584e0 | 6e 64 20 6c 6f 6f 6b 20 6c 69 6b 65 20 6c 69 73 74 73 2e 20 20 57 65 20 63 61 6e 20 72 65 63 6f | nd.look.like.lists...We.can.reco |
| 58500 | 76 65 72 20 74 68 69 73 20 63 6f 6e 73 69 73 74 65 6e 63 79 20 62 79 0a 69 6e 74 72 6f 64 75 63 | ver.this.consistency.by.introduc |
| 58520 | 69 6e 67 20 61 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 60 71 75 6f 74 65 27 2c 20 77 68 69 63 | ing.a.special.form.`quote',.whic |
| 58540 | 68 20 73 65 72 76 65 73 20 74 68 65 20 73 61 6d 65 20 70 75 72 70 6f 73 65 20 61 73 0a 74 68 65 | h.serves.the.same.purpose.as.the |
| 58560 | 20 71 75 6f 74 61 74 69 6f 6e 20 6d 61 72 6b 2e 20 20 54 68 75 73 2c 20 77 65 20 77 6f 75 6c 64 | .quotation.mark...Thus,.we.would |
| 58580 | 20 74 79 70 65 20 60 28 71 75 6f 74 65 20 61 29 27 20 69 6e 73 74 65 61 64 20 6f 66 20 60 27 61 | .type.`(quote.a)'.instead.of.`'a |
| 585a0 | 27 2c 0a 61 6e 64 20 77 65 20 77 6f 75 6c 64 20 74 79 70 65 20 60 28 71 75 6f 74 65 20 28 61 20 | ',.and.we.would.type.`(quote.(a. |
| 585c0 | 62 20 63 29 29 27 20 69 6e 73 74 65 61 64 20 6f 66 20 60 27 28 61 20 62 20 63 29 27 2e 20 20 54 | b.c))'.instead.of.`'(a.b.c)'...T |
| 585e0 | 68 69 73 20 69 73 0a 70 72 65 63 69 73 65 6c 79 20 68 6f 77 20 74 68 65 20 69 6e 74 65 72 70 72 | his.is.precisely.how.the.interpr |
| 58600 | 65 74 65 72 20 77 6f 72 6b 73 2e 20 20 54 68 65 20 71 75 6f 74 61 74 69 6f 6e 20 6d 61 72 6b 20 | eter.works...The.quotation.mark. |
| 58620 | 69 73 20 6a 75 73 74 20 61 0a 73 69 6e 67 6c 65 2d 63 68 61 72 61 63 74 65 72 20 61 62 62 72 65 | is.just.a.single-character.abbre |
| 58640 | 76 69 61 74 69 6f 6e 20 66 6f 72 20 77 72 61 70 70 69 6e 67 20 74 68 65 20 6e 65 78 74 20 63 6f | viation.for.wrapping.the.next.co |
| 58660 | 6d 70 6c 65 74 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 77 69 74 68 20 60 71 75 6f 74 65 27 20 74 | mplete.expression.with.`quote'.t |
| 58680 | 6f 20 66 6f 72 6d 20 60 28 71 75 6f 74 65 20 3c 45 58 50 52 45 53 53 49 4f 4e 3e 29 27 2e 20 20 | o.form.`(quote.<EXPRESSION>)'... |
| 586a0 | 54 68 69 73 20 69 73 20 69 6d 70 6f 72 74 61 6e 74 20 62 65 63 61 75 73 65 0a 69 74 20 6d 61 69 | This.is.important.because.it.mai |
| 586c0 | 6e 74 61 69 6e 73 20 74 68 65 20 70 72 69 6e 63 69 70 6c 65 20 74 68 61 74 20 61 6e 79 20 65 78 | ntains.the.principle.that.any.ex |
| 586e0 | 70 72 65 73 73 69 6f 6e 20 73 65 65 6e 20 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 | pression.seen.by.the.interpreter |
| 58700 | 0a 63 61 6e 20 62 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 20 61 73 20 61 20 64 61 74 61 20 6f 62 | .can.be.manipulated.as.a.data.ob |
| 58720 | 6a 65 63 74 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 77 65 20 63 6f 75 6c 64 20 63 6f | ject...For.instance,.we.could.co |
| 58740 | 6e 73 74 72 75 63 74 0a 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 63 61 72 20 27 28 61 | nstruct.the.expression.`(car.'(a |
| 58760 | 20 62 20 63 29 29 27 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 60 28 | .b.c))',.which.is.the.same.as.`( |
| 58780 | 63 61 72 20 28 71 75 6f 74 65 20 28 61 20 62 0a 63 29 29 29 27 2c 20 62 79 20 65 76 61 6c 75 61 | car.(quote.(a.b.c)))',.by.evalua |
| 587a0 | 74 69 6e 67 20 60 28 6c 69 73 74 20 27 63 61 72 20 28 6c 69 73 74 20 27 71 75 6f 74 65 20 27 28 | ting.`(list.'car.(list.'quote.'( |
| 587c0 | 61 20 62 20 63 29 29 29 27 2e 0a 0a 20 20 20 28 34 29 20 57 65 20 63 61 6e 20 63 6f 6e 73 69 64 | a.b.c)))'......(4).We.can.consid |
| 587e0 | 65 72 20 74 77 6f 20 73 79 6d 62 6f 6c 73 20 74 6f 20 62 65 20 22 74 68 65 20 73 61 6d 65 22 20 | er.two.symbols.to.be."the.same". |
| 58800 | 69 66 20 74 68 65 79 20 63 6f 6e 73 69 73 74 20 6f 66 0a 74 68 65 20 73 61 6d 65 20 63 68 61 72 | if.they.consist.of.the.same.char |
| 58820 | 61 63 74 65 72 73 20 69 6e 20 74 68 65 20 73 61 6d 65 20 6f 72 64 65 72 2e 20 20 53 75 63 68 20 | acters.in.the.same.order...Such. |
| 58840 | 61 20 64 65 66 69 6e 69 74 69 6f 6e 20 73 6b 69 72 74 73 20 61 20 64 65 65 70 0a 69 73 73 75 65 | a.definition.skirts.a.deep.issue |
| 58860 | 20 74 68 61 74 20 77 65 20 61 72 65 20 6e 6f 74 20 79 65 74 20 72 65 61 64 79 20 74 6f 20 61 64 | .that.we.are.not.yet.ready.to.ad |
| 58880 | 64 72 65 73 73 3a 20 74 68 65 20 6d 65 61 6e 69 6e 67 20 6f 66 20 22 73 61 6d 65 6e 65 73 73 22 | dress:.the.meaning.of."sameness" |
| 588a0 | 0a 69 6e 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 20 20 57 65 20 | .in.a.programming.language...We. |
| 588c0 | 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 6f 20 74 68 69 73 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 | will.return.to.this.in.*Note.Cha |
| 588e0 | 70 74 65 72 20 33 3a 3a 0a 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 33 3a 3a 29 | pter.3::.(section.*Note.3-1-3::) |
| 58900 | 2e 0a 0a 20 20 20 28 35 29 20 49 6e 20 70 72 61 63 74 69 63 65 2c 20 70 72 6f 67 72 61 6d 6d 65 | ......(5).In.practice,.programme |
| 58920 | 72 73 20 75 73 65 20 60 65 71 75 61 6c 3f 27 20 74 6f 20 63 6f 6d 70 61 72 65 20 6c 69 73 74 73 | rs.use.`equal?'.to.compare.lists |
| 58940 | 20 74 68 61 74 0a 63 6f 6e 74 61 69 6e 20 6e 75 6d 62 65 72 73 20 61 73 20 77 65 6c 6c 20 61 73 | .that.contain.numbers.as.well.as |
| 58960 | 20 73 79 6d 62 6f 6c 73 2e 20 20 4e 75 6d 62 65 72 73 20 61 72 65 20 6e 6f 74 20 63 6f 6e 73 69 | .symbols...Numbers.are.not.consi |
| 58980 | 64 65 72 65 64 20 74 6f 20 62 65 0a 73 79 6d 62 6f 6c 73 2e 20 20 54 68 65 20 71 75 65 73 74 69 | dered.to.be.symbols...The.questi |
| 589a0 | 6f 6e 20 6f 66 20 77 68 65 74 68 65 72 20 74 77 6f 20 6e 75 6d 65 72 69 63 61 6c 6c 79 20 65 71 | on.of.whether.two.numerically.eq |
| 589c0 | 75 61 6c 20 6e 75 6d 62 65 72 73 20 28 61 73 0a 74 65 73 74 65 64 20 62 79 20 60 3d 27 29 20 61 | ual.numbers.(as.tested.by.`=').a |
| 589e0 | 72 65 20 61 6c 73 6f 20 60 65 71 3f 27 20 69 73 20 68 69 67 68 6c 79 20 69 6d 70 6c 65 6d 65 6e | re.also.`eq?'.is.highly.implemen |
| 58a00 | 74 61 74 69 6f 6e 2d 64 65 70 65 6e 64 65 6e 74 2e 20 20 41 0a 62 65 74 74 65 72 20 64 65 66 69 | tation-dependent...A.better.defi |
| 58a20 | 6e 69 74 69 6f 6e 20 6f 66 20 60 65 71 75 61 6c 3f 27 20 28 73 75 63 68 20 61 73 20 74 68 65 20 | nition.of.`equal?'.(such.as.the. |
| 58a40 | 6f 6e 65 20 74 68 61 74 20 63 6f 6d 65 73 20 61 73 20 61 0a 70 72 69 6d 69 74 69 76 65 20 69 6e | one.that.comes.as.a.primitive.in |
| 58a60 | 20 53 63 68 65 6d 65 29 20 77 6f 75 6c 64 20 61 6c 73 6f 20 73 74 69 70 75 6c 61 74 65 20 74 68 | .Scheme).would.also.stipulate.th |
| 58a80 | 61 74 20 69 66 20 60 61 27 20 61 6e 64 20 60 62 27 20 61 72 65 20 62 6f 74 68 0a 6e 75 6d 62 65 | at.if.`a'.and.`b'.are.both.numbe |
| 58aa0 | 72 73 2c 20 74 68 65 6e 20 60 61 27 20 61 6e 64 20 60 62 27 20 61 72 65 20 60 65 71 75 61 6c 3f | rs,.then.`a'.and.`b'.are.`equal? |
| 58ac0 | 27 20 69 66 20 74 68 65 79 20 61 72 65 20 6e 75 6d 65 72 69 63 61 6c 6c 79 20 65 71 75 61 6c 2e | '.if.they.are.numerically.equal. |
| 58ae0 | 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 33 2d | ....File:.sicp.info,..Node:.2-3- |
| 58b00 | 32 2c 20 20 4e 65 78 74 3a 20 32 2d 33 2d 33 2c 20 20 50 72 65 76 3a 20 32 2d 33 2d 31 2c 20 20 | 2,..Next:.2-3-3,..Prev:.2-3-1,.. |
| 58b20 | 55 70 3a 20 32 2d 33 0a 0a 32 2e 33 2e 32 20 45 78 61 6d 70 6c 65 3a 20 53 79 6d 62 6f 6c 69 63 | Up:.2-3..2.3.2.Example:.Symbolic |
| 58b40 | 20 44 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .Differentiation.--------------- |
| 58b60 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 41 73 20 61 6e 20 | ------------------------..As.an. |
| 58b80 | 69 6c 6c 75 73 74 72 61 74 69 6f 6e 20 6f 66 20 73 79 6d 62 6f 6c 20 6d 61 6e 69 70 75 6c 61 74 | illustration.of.symbol.manipulat |
| 58ba0 | 69 6f 6e 20 61 6e 64 20 61 20 66 75 72 74 68 65 72 20 69 6c 6c 75 73 74 72 61 74 69 6f 6e 20 6f | ion.and.a.further.illustration.o |
| 58bc0 | 66 0a 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 | f.data.abstraction,.consider.the |
| 58be0 | 20 64 65 73 69 67 6e 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 70 65 72 66 | .design.of.a.procedure.that.perf |
| 58c00 | 6f 72 6d 73 0a 73 79 6d 62 6f 6c 69 63 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 6f 66 | orms.symbolic.differentiation.of |
| 58c20 | 20 61 6c 67 65 62 72 61 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 57 65 20 77 6f 75 6c | .algebraic.expressions...We.woul |
| 58c40 | 64 20 6c 69 6b 65 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 74 6f 20 74 61 6b 65 20 61 73 20 | d.like.the.procedure.to.take.as. |
| 58c60 | 61 72 67 75 6d 65 6e 74 73 20 61 6e 20 61 6c 67 65 62 72 61 69 63 20 65 78 70 72 65 73 73 69 6f | arguments.an.algebraic.expressio |
| 58c80 | 6e 20 61 6e 64 20 61 20 76 61 72 69 61 62 6c 65 0a 61 6e 64 20 74 6f 20 72 65 74 75 72 6e 20 74 | n.and.a.variable.and.to.return.t |
| 58ca0 | 68 65 20 64 65 72 69 76 61 74 69 76 65 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 | he.derivative.of.the.expression. |
| 58cc0 | 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 74 68 65 0a 76 61 72 69 61 62 6c 65 2e 20 20 46 | with.respect.to.the.variable...F |
| 58ce0 | 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 | or.example,.if.the.arguments.to. |
| 58d00 | 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 61 72 65 20 61 78 5e 32 20 2b 20 62 78 0a 2b 20 63 20 | the.procedure.are.ax^2.+.bx.+.c. |
| 58d20 | 61 6e 64 20 78 2c 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 72 65 74 75 | and.x,.the.procedure.should.retu |
| 58d40 | 72 6e 20 32 61 78 20 2b 20 62 2e 20 20 53 79 6d 62 6f 6c 69 63 0a 64 69 66 66 65 72 65 6e 74 69 | rn.2ax.+.b...Symbolic.differenti |
| 58d60 | 61 74 69 6f 6e 20 69 73 20 6f 66 20 73 70 65 63 69 61 6c 20 68 69 73 74 6f 72 69 63 61 6c 20 73 | ation.is.of.special.historical.s |
| 58d80 | 69 67 6e 69 66 69 63 61 6e 63 65 20 69 6e 20 4c 69 73 70 2e 20 20 49 74 20 77 61 73 0a 6f 6e 65 | ignificance.in.Lisp...It.was.one |
| 58da0 | 20 6f 66 20 74 68 65 20 6d 6f 74 69 76 61 74 69 6e 67 20 65 78 61 6d 70 6c 65 73 20 62 65 68 69 | .of.the.motivating.examples.behi |
| 58dc0 | 6e 64 20 74 68 65 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 6f 66 20 61 20 63 6f 6d 70 75 74 65 72 | nd.the.development.of.a.computer |
| 58de0 | 0a 6c 61 6e 67 75 61 67 65 20 66 6f 72 20 73 79 6d 62 6f 6c 20 6d 61 6e 69 70 75 6c 61 74 69 6f | .language.for.symbol.manipulatio |
| 58e00 | 6e 2e 20 20 46 75 72 74 68 65 72 6d 6f 72 65 2c 20 69 74 20 6d 61 72 6b 65 64 20 74 68 65 20 62 | n...Furthermore,.it.marked.the.b |
| 58e20 | 65 67 69 6e 6e 69 6e 67 0a 6f 66 20 74 68 65 20 6c 69 6e 65 20 6f 66 20 72 65 73 65 61 72 63 68 | eginning.of.the.line.of.research |
| 58e40 | 20 74 68 61 74 20 6c 65 64 20 74 6f 20 74 68 65 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 6f 66 20 | .that.led.to.the.development.of. |
| 58e60 | 70 6f 77 65 72 66 75 6c 20 73 79 73 74 65 6d 73 0a 66 6f 72 20 73 79 6d 62 6f 6c 69 63 20 6d 61 | powerful.systems.for.symbolic.ma |
| 58e80 | 74 68 65 6d 61 74 69 63 61 6c 20 77 6f 72 6b 2c 20 77 68 69 63 68 20 61 72 65 20 63 75 72 72 65 | thematical.work,.which.are.curre |
| 58ea0 | 6e 74 6c 79 20 62 65 69 6e 67 20 75 73 65 64 20 62 79 20 61 0a 67 72 6f 77 69 6e 67 20 6e 75 6d | ntly.being.used.by.a.growing.num |
| 58ec0 | 62 65 72 20 6f 66 20 61 70 70 6c 69 65 64 20 6d 61 74 68 65 6d 61 74 69 63 69 61 6e 73 20 61 6e | ber.of.applied.mathematicians.an |
| 58ee0 | 64 20 70 68 79 73 69 63 69 73 74 73 2e 0a 0a 20 20 20 49 6e 20 64 65 76 65 6c 6f 70 69 6e 67 20 | d.physicists......In.developing. |
| 58f00 | 74 68 65 20 73 79 6d 62 6f 6c 69 63 2d 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 70 72 6f | the.symbolic-differentiation.pro |
| 58f20 | 67 72 61 6d 2c 20 77 65 20 77 69 6c 6c 20 66 6f 6c 6c 6f 77 0a 74 68 65 20 73 61 6d 65 20 73 74 | gram,.we.will.follow.the.same.st |
| 58f40 | 72 61 74 65 67 79 20 6f 66 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 74 68 61 74 20 | rategy.of.data.abstraction.that. |
| 58f60 | 77 65 20 66 6f 6c 6c 6f 77 65 64 20 69 6e 20 64 65 76 65 6c 6f 70 69 6e 67 0a 74 68 65 20 72 61 | we.followed.in.developing.the.ra |
| 58f80 | 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 73 79 73 74 65 6d 20 6f 66 20 73 65 63 74 69 6f 6e 20 | tional-number.system.of.section. |
| 58fa0 | 2a 4e 6f 74 65 20 32 2d 31 2d 31 3a 3a 2e 20 20 54 68 61 74 20 69 73 2c 20 77 65 20 77 69 6c 6c | *Note.2-1-1::...That.is,.we.will |
| 58fc0 | 0a 66 69 72 73 74 20 64 65 66 69 6e 65 20 61 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 | .first.define.a.differentiation. |
| 58fe0 | 61 6c 67 6f 72 69 74 68 6d 20 74 68 61 74 20 6f 70 65 72 61 74 65 73 20 6f 6e 20 61 62 73 74 72 | algorithm.that.operates.on.abstr |
| 59000 | 61 63 74 0a 6f 62 6a 65 63 74 73 20 73 75 63 68 20 61 73 20 22 73 75 6d 73 2c 22 20 22 70 72 6f | act.objects.such.as."sums,"."pro |
| 59020 | 64 75 63 74 73 2c 22 20 61 6e 64 20 22 76 61 72 69 61 62 6c 65 73 22 20 77 69 74 68 6f 75 74 20 | ducts,".and."variables".without. |
| 59040 | 77 6f 72 72 79 69 6e 67 0a 61 62 6f 75 74 20 68 6f 77 20 74 68 65 73 65 20 61 72 65 20 74 6f 20 | worrying.about.how.these.are.to. |
| 59060 | 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 2e 20 20 4f 6e 6c 79 20 61 66 74 65 72 77 61 72 64 20 | be.represented...Only.afterward. |
| 59080 | 77 69 6c 6c 20 77 65 20 61 64 64 72 65 73 73 0a 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 | will.we.address.the.representati |
| 590a0 | 6f 6e 20 70 72 6f 62 6c 65 6d 2e 0a 0a 54 68 65 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e | on.problem...The.differentiation |
| 590c0 | 20 70 72 6f 67 72 61 6d 20 77 69 74 68 20 61 62 73 74 72 61 63 74 20 64 61 74 61 0a 2e 2e 2e 2e | .program.with.abstract.data..... |
| 590e0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ................................ |
| 59100 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 6f 72 64 65 72 20 74 6f 20 6b 65 65 70 20 74 68 69 | ............In.order.to.keep.thi |
| 59120 | 6e 67 73 20 73 69 6d 70 6c 65 2c 20 77 65 20 77 69 6c 6c 20 63 6f 6e 73 69 64 65 72 20 61 20 76 | ngs.simple,.we.will.consider.a.v |
| 59140 | 65 72 79 20 73 69 6d 70 6c 65 0a 73 79 6d 62 6f 6c 69 63 2d 64 69 66 66 65 72 65 6e 74 69 61 74 | ery.simple.symbolic-differentiat |
| 59160 | 69 6f 6e 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 68 61 6e 64 6c 65 73 20 65 78 70 72 65 73 73 | ion.program.that.handles.express |
| 59180 | 69 6f 6e 73 20 74 68 61 74 20 61 72 65 0a 62 75 69 6c 74 20 75 70 20 75 73 69 6e 67 20 6f 6e 6c | ions.that.are.built.up.using.onl |
| 591a0 | 79 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 66 20 61 64 64 69 74 69 6f 6e 20 61 6e 64 | y.the.operations.of.addition.and |
| 591c0 | 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 20 77 69 74 68 0a 74 77 6f 20 61 72 67 75 6d 65 6e | .multiplication.with.two.argumen |
| 591e0 | 74 73 2e 20 20 44 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 6f 66 20 61 6e 79 20 73 75 63 68 | ts...Differentiation.of.any.such |
| 59200 | 20 65 78 70 72 65 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 63 61 72 72 69 65 64 0a 6f 75 74 20 62 | .expression.can.be.carried.out.b |
| 59220 | 79 20 61 70 70 6c 79 69 6e 67 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 72 65 64 75 63 74 69 | y.applying.the.following.reducti |
| 59240 | 6f 6e 20 72 75 6c 65 73 3a 0a 0a 20 20 20 20 20 64 63 0a 20 20 20 20 20 2d 2d 20 3d 20 30 20 20 | on.rules:.......dc......--.=.0.. |
| 59260 | 66 6f 72 20 63 20 61 20 63 6f 6e 73 74 61 6e 74 2c 20 6f 72 20 61 20 76 61 72 69 61 62 6c 65 20 | for.c.a.constant,.or.a.variable. |
| 59280 | 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d 20 78 0a 20 20 20 20 20 64 78 0a 0a 20 20 20 20 20 64 | different.from.x......dx.......d |
| 592a0 | 78 0a 20 20 20 20 20 2d 2d 20 3d 20 31 0a 20 20 20 20 20 64 78 0a 0a 20 20 20 20 20 64 28 75 20 | x......--.=.1......dx.......d(u. |
| 592c0 | 2b 20 76 29 20 20 20 64 75 20 20 20 64 76 0a 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 20 3d 20 2d | +.v)...du...dv......--------.=.- |
| 592e0 | 2d 20 2b 20 2d 2d 0a 20 20 20 20 20 20 20 20 64 78 20 20 20 20 20 20 64 78 20 20 20 64 78 0a 0a | -.+.--.........dx......dx...dx.. |
| 59300 | 20 20 20 20 20 64 28 75 76 29 20 20 20 20 20 2f 20 64 76 20 5c 20 20 20 20 20 2f 20 64 75 20 5c | .....d(uv)...../.dv.\...../.du.\ |
| 59320 | 0a 20 20 20 20 20 2d 2d 2d 2d 2d 20 3d 20 75 20 7c 20 2d 2d 20 7c 20 2b 20 76 20 7c 20 2d 2d 20 | ......-----.=.u.|.--.|.+.v.|.--. |
| 59340 | 7c 0a 20 20 20 20 20 20 64 78 20 20 20 20 20 20 20 5c 20 64 78 20 2f 20 20 20 20 20 5c 20 64 78 | |.......dx.......\.dx./.....\.dx |
| 59360 | 20 2f 0a 0a 20 20 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 74 68 65 20 6c 61 74 74 65 72 20 74 | ./.....Observe.that.the.latter.t |
| 59380 | 77 6f 20 72 75 6c 65 73 20 61 72 65 20 72 65 63 75 72 73 69 76 65 20 69 6e 20 6e 61 74 75 72 65 | wo.rules.are.recursive.in.nature |
| 593a0 | 2e 20 20 54 68 61 74 20 69 73 2c 0a 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 64 65 72 69 76 61 | ...That.is,.to.obtain.the.deriva |
| 593c0 | 74 69 76 65 20 6f 66 20 61 20 73 75 6d 20 77 65 20 66 69 72 73 74 20 66 69 6e 64 20 74 68 65 20 | tive.of.a.sum.we.first.find.the. |
| 593e0 | 64 65 72 69 76 61 74 69 76 65 73 20 6f 66 20 74 68 65 0a 74 65 72 6d 73 20 61 6e 64 20 61 64 64 | derivatives.of.the.terms.and.add |
| 59400 | 20 74 68 65 6d 2e 20 20 45 61 63 68 20 6f 66 20 74 68 65 20 74 65 72 6d 73 20 6d 61 79 20 69 6e | .them...Each.of.the.terms.may.in |
| 59420 | 20 74 75 72 6e 20 62 65 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 0a 74 68 61 74 20 6e 65 65 64 | .turn.be.an.expression.that.need |
| 59440 | 73 20 74 6f 20 62 65 20 64 65 63 6f 6d 70 6f 73 65 64 2e 20 20 44 65 63 6f 6d 70 6f 73 69 6e 67 | s.to.be.decomposed...Decomposing |
| 59460 | 20 69 6e 74 6f 20 73 6d 61 6c 6c 65 72 20 61 6e 64 20 73 6d 61 6c 6c 65 72 0a 70 69 65 63 65 73 | .into.smaller.and.smaller.pieces |
| 59480 | 20 77 69 6c 6c 20 65 76 65 6e 74 75 61 6c 6c 79 20 70 72 6f 64 75 63 65 20 70 69 65 63 65 73 20 | .will.eventually.produce.pieces. |
| 594a0 | 74 68 61 74 20 61 72 65 20 65 69 74 68 65 72 20 63 6f 6e 73 74 61 6e 74 73 20 6f 72 0a 76 61 72 | that.are.either.constants.or.var |
| 594c0 | 69 61 62 6c 65 73 2c 20 77 68 6f 73 65 20 64 65 72 69 76 61 74 69 76 65 73 20 77 69 6c 6c 20 62 | iables,.whose.derivatives.will.b |
| 594e0 | 65 20 65 69 74 68 65 72 20 30 20 6f 72 20 31 2e 0a 0a 20 20 20 54 6f 20 65 6d 62 6f 64 79 20 74 | e.either.0.or.1......To.embody.t |
| 59500 | 68 65 73 65 20 72 75 6c 65 73 20 69 6e 20 61 20 70 72 6f 63 65 64 75 72 65 20 77 65 20 69 6e 64 | hese.rules.in.a.procedure.we.ind |
| 59520 | 75 6c 67 65 20 69 6e 20 61 20 6c 69 74 74 6c 65 20 77 69 73 68 66 75 6c 0a 74 68 69 6e 6b 69 6e | ulge.in.a.little.wishful.thinkin |
| 59540 | 67 2c 20 61 73 20 77 65 20 64 69 64 20 69 6e 20 64 65 73 69 67 6e 69 6e 67 20 74 68 65 20 72 61 | g,.as.we.did.in.designing.the.ra |
| 59560 | 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a 49 66 | tional-number.implementation..If |
| 59580 | 20 77 65 20 68 61 64 20 61 20 6d 65 61 6e 73 20 66 6f 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67 | .we.had.a.means.for.representing |
| 595a0 | 20 61 6c 67 65 62 72 61 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 77 65 20 73 68 6f 75 6c | .algebraic.expressions,.we.shoul |
| 595c0 | 64 20 62 65 0a 61 62 6c 65 20 74 6f 20 74 65 6c 6c 20 77 68 65 74 68 65 72 20 61 6e 20 65 78 70 | d.be.able.to.tell.whether.an.exp |
| 595e0 | 72 65 73 73 69 6f 6e 20 69 73 20 61 20 73 75 6d 2c 20 61 20 70 72 6f 64 75 63 74 2c 20 61 20 63 | ression.is.a.sum,.a.product,.a.c |
| 59600 | 6f 6e 73 74 61 6e 74 2c 20 6f 72 0a 61 20 76 61 72 69 61 62 6c 65 2e 20 20 57 65 20 73 68 6f 75 | onstant,.or.a.variable...We.shou |
| 59620 | 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 70 61 72 74 73 20 | ld.be.able.to.extract.the.parts. |
| 59640 | 6f 66 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 46 6f 72 20 61 20 73 75 6d 2c 20 66 6f 72 | of.an.expression..For.a.sum,.for |
| 59660 | 20 65 78 61 6d 70 6c 65 20 77 65 20 77 61 6e 74 20 74 6f 20 62 65 20 61 62 6c 65 20 74 6f 20 65 | .example.we.want.to.be.able.to.e |
| 59680 | 78 74 72 61 63 74 20 74 68 65 20 61 64 64 65 6e 64 20 28 66 69 72 73 74 0a 74 65 72 6d 29 20 61 | xtract.the.addend.(first.term).a |
| 596a0 | 6e 64 20 74 68 65 20 61 75 67 65 6e 64 20 28 73 65 63 6f 6e 64 20 74 65 72 6d 29 2e 20 20 57 65 | nd.the.augend.(second.term)...We |
| 596c0 | 20 73 68 6f 75 6c 64 20 61 6c 73 6f 20 62 65 20 61 62 6c 65 20 74 6f 0a 63 6f 6e 73 74 72 75 63 | .should.also.be.able.to.construc |
| 596e0 | 74 20 65 78 70 72 65 73 73 69 6f 6e 73 20 66 72 6f 6d 20 70 61 72 74 73 2e 20 20 4c 65 74 20 75 | t.expressions.from.parts...Let.u |
| 59700 | 73 20 61 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 61 6c 72 65 61 64 79 20 68 61 76 65 0a 70 72 | s.assume.that.we.already.have.pr |
| 59720 | 6f 63 65 64 75 72 65 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 66 6f 6c 6c 6f 77 | ocedures.to.implement.the.follow |
| 59740 | 69 6e 67 20 73 65 6c 65 63 74 6f 72 73 2c 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 2c 20 61 6e 64 | ing.selectors,.constructors,.and |
| 59760 | 0a 70 72 65 64 69 63 61 74 65 73 3a 0a 0a 20 20 20 20 20 28 76 61 72 69 61 62 6c 65 3f 20 65 29 | .predicates:.......(variable?.e) |
| 59780 | 20 20 20 20 20 20 20 20 20 20 49 73 20 60 65 27 20 61 20 76 61 72 69 61 62 6c 65 3f 0a 20 20 20 | ..........Is.`e'.a.variable?.... |
| 597a0 | 20 20 28 73 61 6d 65 2d 76 61 72 69 61 62 6c 65 3f 20 76 31 20 76 32 29 20 41 72 65 20 60 76 31 | ..(same-variable?.v1.v2).Are.`v1 |
| 597c0 | 27 20 61 6e 64 20 60 76 32 27 20 74 68 65 20 73 61 6d 65 20 76 61 72 69 61 62 6c 65 3f 0a 20 20 | '.and.`v2'.the.same.variable?... |
| 597e0 | 20 20 20 28 73 75 6d 3f 20 65 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 49 73 20 60 65 27 | ...(sum?.e)...............Is.`e' |
| 59800 | 20 61 20 73 75 6d 3f 0a 20 20 20 20 20 28 61 64 64 65 6e 64 20 65 29 20 20 20 20 20 20 20 20 20 | .a.sum?......(addend.e)......... |
| 59820 | 20 20 20 20 41 64 64 65 6e 64 20 6f 66 20 74 68 65 20 73 75 6d 20 60 65 27 2e 0a 20 20 20 20 20 | ....Addend.of.the.sum.`e'....... |
| 59840 | 28 61 75 67 65 6e 64 20 65 29 20 20 20 20 20 20 20 20 20 20 20 20 20 41 75 67 65 6e 64 20 6f 66 | (augend.e).............Augend.of |
| 59860 | 20 74 68 65 20 73 75 6d 20 60 65 27 2e 0a 20 20 20 20 20 28 6d 61 6b 65 2d 73 75 6d 20 61 31 20 | .the.sum.`e'.......(make-sum.a1. |
| 59880 | 61 32 29 20 20 20 20 20 20 20 43 6f 6e 73 74 72 75 63 74 20 74 68 65 20 73 75 6d 20 6f 66 20 60 | a2).......Construct.the.sum.of.` |
| 598a0 | 61 31 27 20 61 6e 64 20 60 61 32 27 2e 0a 20 20 20 20 20 28 70 72 6f 64 75 63 74 3f 20 65 29 20 | a1'.and.`a2'.......(product?.e). |
| 598c0 | 20 20 20 20 20 20 20 20 20 20 49 73 20 60 65 27 20 61 20 70 72 6f 64 75 63 74 3f 0a 20 20 20 20 | ..........Is.`e'.a.product?..... |
| 598e0 | 20 28 6d 75 6c 74 69 70 6c 69 65 72 20 65 29 20 20 20 20 20 20 20 20 20 4d 75 6c 74 69 70 6c 69 | .(multiplier.e).........Multipli |
| 59900 | 65 72 20 6f 66 20 74 68 65 20 70 72 6f 64 75 63 74 20 60 65 27 2e 0a 20 20 20 20 20 28 6d 75 6c | er.of.the.product.`e'.......(mul |
| 59920 | 74 69 70 6c 69 63 61 6e 64 20 65 29 20 20 20 20 20 20 20 4d 75 6c 74 69 70 6c 69 63 61 6e 64 20 | tiplicand.e).......Multiplicand. |
| 59940 | 6f 66 20 74 68 65 20 70 72 6f 64 75 63 74 20 60 65 27 2e 0a 20 20 20 20 20 28 6d 61 6b 65 2d 70 | of.the.product.`e'.......(make-p |
| 59960 | 72 6f 64 75 63 74 20 6d 31 20 6d 32 29 20 20 20 43 6f 6e 73 74 72 75 63 74 20 74 68 65 20 70 72 | roduct.m1.m2)...Construct.the.pr |
| 59980 | 6f 64 75 63 74 20 6f 66 20 60 6d 31 27 20 61 6e 64 20 60 6d 32 27 2e 0a 0a 20 20 20 55 73 69 6e | oduct.of.`m1'.and.`m2'......Usin |
| 599a0 | 67 20 74 68 65 73 65 2c 20 61 6e 64 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 65 64 69 | g.these,.and.the.primitive.predi |
| 599c0 | 63 61 74 65 20 60 6e 75 6d 62 65 72 3f 27 2c 20 77 68 69 63 68 20 69 64 65 6e 74 69 66 69 65 73 | cate.`number?',.which.identifies |
| 599e0 | 0a 6e 75 6d 62 65 72 73 2c 20 77 65 20 63 61 6e 20 65 78 70 72 65 73 73 20 74 68 65 20 64 69 66 | .numbers,.we.can.express.the.dif |
| 59a00 | 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 72 75 6c 65 73 20 61 73 20 74 68 65 20 66 6f 6c 6c 6f 77 | ferentiation.rules.as.the.follow |
| 59a20 | 69 6e 67 0a 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 | ing.procedure:.......(define.(de |
| 59a40 | 72 69 76 20 65 78 70 20 76 61 72 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6d 62 | riv.exp.var)........(cond.((numb |
| 59a60 | 65 72 3f 20 65 78 70 29 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 76 61 72 69 61 | er?.exp).0)..............((varia |
| 59a80 | 62 6c 65 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 73 61 6d | ble?.exp)...............(if.(sam |
| 59aa0 | 65 2d 76 61 72 69 61 62 6c 65 3f 20 65 78 70 20 76 61 72 29 20 31 20 30 29 29 0a 20 20 20 20 20 | e-variable?.exp.var).1.0))...... |
| 59ac0 | 20 20 20 20 20 20 20 20 28 28 73 75 6d 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ........((sum?.exp)............. |
| 59ae0 | 20 20 28 6d 61 6b 65 2d 73 75 6d 20 28 64 65 72 69 76 20 28 61 64 64 65 6e 64 20 65 78 70 29 20 | ..(make-sum.(deriv.(addend.exp). |
| 59b00 | 76 61 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 | var).........................(de |
| 59b20 | 72 69 76 20 28 61 75 67 65 6e 64 20 65 78 70 29 20 76 61 72 29 29 29 0a 20 20 20 20 20 20 20 20 | riv.(augend.exp).var)))......... |
| 59b40 | 20 20 20 20 20 28 28 70 72 6f 64 75 63 74 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .....((product?.exp)............ |
| 59b60 | 20 20 20 28 6d 61 6b 65 2d 73 75 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 | ...(make-sum.................(ma |
| 59b80 | 6b 65 2d 70 72 6f 64 75 63 74 20 28 6d 75 6c 74 69 70 6c 69 65 72 20 65 78 70 29 0a 20 20 20 20 | ke-product.(multiplier.exp)..... |
| 59ba0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 72 69 76 | ..........................(deriv |
| 59bc0 | 20 28 6d 75 6c 74 69 70 6c 69 63 61 6e 64 20 65 78 70 29 20 76 61 72 29 29 0a 20 20 20 20 20 20 | .(multiplicand.exp).var))....... |
| 59be0 | 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 70 72 6f 64 75 63 74 20 28 64 65 72 69 76 20 28 | ..........(make-product.(deriv.( |
| 59c00 | 6d 75 6c 74 69 70 6c 69 65 72 20 65 78 70 29 20 76 61 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 | multiplier.exp).var)............ |
| 59c20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 75 6c 74 69 70 6c 69 63 61 6e 64 | ...................(multiplicand |
| 59c40 | 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 | .exp))))..............(else..... |
| 59c60 | 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 75 6e 6b 6e 6f 77 6e 20 65 78 70 72 65 73 | ..........(error."unknown.expres |
| 59c80 | 73 69 6f 6e 20 74 79 70 65 20 2d 2d 20 44 45 52 49 56 22 20 65 78 70 29 29 29 29 0a 0a 20 20 20 | sion.type.--.DERIV".exp))))..... |
| 59ca0 | 54 68 69 73 20 60 64 65 72 69 76 27 20 70 72 6f 63 65 64 75 72 65 20 69 6e 63 6f 72 70 6f 72 61 | This.`deriv'.procedure.incorpora |
| 59cc0 | 74 65 73 20 74 68 65 20 63 6f 6d 70 6c 65 74 65 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e | tes.the.complete.differentiation |
| 59ce0 | 0a 61 6c 67 6f 72 69 74 68 6d 2e 20 20 53 69 6e 63 65 20 69 74 20 69 73 20 65 78 70 72 65 73 73 | .algorithm...Since.it.is.express |
| 59d00 | 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 61 62 73 74 72 61 63 74 20 64 61 74 61 2c 20 69 74 | ed.in.terms.of.abstract.data,.it |
| 59d20 | 20 77 69 6c 6c 0a 77 6f 72 6b 20 6e 6f 20 6d 61 74 74 65 72 20 68 6f 77 20 77 65 20 63 68 6f 6f | .will.work.no.matter.how.we.choo |
| 59d40 | 73 65 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 61 6c 67 65 62 72 61 69 63 20 65 78 70 72 65 73 | se.to.represent.algebraic.expres |
| 59d60 | 73 69 6f 6e 73 2c 20 61 73 0a 6c 6f 6e 67 20 61 73 20 77 65 20 64 65 73 69 67 6e 20 61 20 70 72 | sions,.as.long.as.we.design.a.pr |
| 59d80 | 6f 70 65 72 20 73 65 74 20 6f 66 20 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 20 63 6f 6e 73 74 72 | oper.set.of.selectors.and.constr |
| 59da0 | 75 63 74 6f 72 73 2e 20 20 54 68 69 73 20 69 73 0a 74 68 65 20 69 73 73 75 65 20 77 65 20 6d 75 | uctors...This.is.the.issue.we.mu |
| 59dc0 | 73 74 20 61 64 64 72 65 73 73 20 6e 65 78 74 2e 0a 0a 52 65 70 72 65 73 65 6e 74 69 6e 67 20 61 | st.address.next...Representing.a |
| 59de0 | 6c 67 65 62 72 61 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | lgebraic.expressions............ |
| 59e00 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 20 63 61 6e 20 | .........................We.can. |
| 59e20 | 69 6d 61 67 69 6e 65 20 6d 61 6e 79 20 77 61 79 73 20 74 6f 20 75 73 65 20 6c 69 73 74 20 73 74 | imagine.many.ways.to.use.list.st |
| 59e40 | 72 75 63 74 75 72 65 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 61 6c 67 65 62 72 61 69 63 0a 65 | ructure.to.represent.algebraic.e |
| 59e60 | 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 6f 75 | xpressions...For.example,.we.cou |
| 59e80 | 6c 64 20 75 73 65 20 6c 69 73 74 73 20 6f 66 20 73 79 6d 62 6f 6c 73 20 74 68 61 74 20 6d 69 72 | ld.use.lists.of.symbols.that.mir |
| 59ea0 | 72 6f 72 0a 74 68 65 20 75 73 75 61 6c 20 61 6c 67 65 62 72 61 69 63 20 6e 6f 74 61 74 69 6f 6e | ror.the.usual.algebraic.notation |
| 59ec0 | 2c 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 78 20 2b 20 62 20 61 73 20 74 68 65 20 6c 69 73 | ,.representing.ax.+.b.as.the.lis |
| 59ee0 | 74 20 60 28 61 20 2a 20 78 20 2b 0a 62 29 27 20 2e 20 20 48 6f 77 65 76 65 72 2c 20 6f 6e 65 20 | t.`(a.*.x.+.b)'....However,.one. |
| 59f00 | 65 73 70 65 63 69 61 6c 6c 79 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 63 68 6f 69 63 | especially.straightforward.choic |
| 59f20 | 65 20 69 73 20 74 6f 20 75 73 65 20 74 68 65 20 73 61 6d 65 0a 70 61 72 65 6e 74 68 65 73 69 7a | e.is.to.use.the.same.parenthesiz |
| 59f40 | 65 64 20 70 72 65 66 69 78 20 6e 6f 74 61 74 69 6f 6e 20 74 68 61 74 20 4c 69 73 70 20 75 73 65 | ed.prefix.notation.that.Lisp.use |
| 59f60 | 73 20 66 6f 72 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 3b 20 74 68 61 74 20 69 73 2c 0a 74 6f 20 | s.for.combinations;.that.is,.to. |
| 59f80 | 72 65 70 72 65 73 65 6e 74 20 61 78 20 2b 20 62 20 61 73 20 60 28 2b 20 28 2a 20 61 20 78 29 20 | represent.ax.+.b.as.`(+.(*.a.x). |
| 59fa0 | 62 29 27 2e 20 20 54 68 65 6e 20 6f 75 72 20 64 61 74 61 20 72 65 70 72 65 73 65 6e 74 61 74 69 | b)'...Then.our.data.representati |
| 59fc0 | 6f 6e 0a 66 6f 72 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 70 72 6f 62 6c | on.for.the.differentiation.probl |
| 59fe0 | 65 6d 20 69 73 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 2a 20 54 68 65 20 76 61 72 69 | em.is.as.follows:.....*.The.vari |
| 5a000 | 61 62 6c 65 73 20 61 72 65 20 73 79 6d 62 6f 6c 73 2e 20 20 54 68 65 79 20 61 72 65 20 69 64 65 | ables.are.symbols...They.are.ide |
| 5a020 | 6e 74 69 66 69 65 64 20 62 79 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 0a 20 20 20 20 20 70 72 | ntified.by.the.primitive......pr |
| 5a040 | 65 64 69 63 61 74 65 20 60 73 79 6d 62 6f 6c 3f 27 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | edicate.`symbol?':............(d |
| 5a060 | 65 66 69 6e 65 20 28 76 61 72 69 61 62 6c 65 3f 20 78 29 20 28 73 79 6d 62 6f 6c 3f 20 78 29 29 | efine.(variable?.x).(symbol?.x)) |
| 5a080 | 0a 0a 20 20 20 2a 20 54 77 6f 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 74 68 65 20 73 61 6d | .....*.Two.variables.are.the.sam |
| 5a0a0 | 65 20 69 66 20 74 68 65 20 73 79 6d 62 6f 6c 73 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 | e.if.the.symbols.representing.th |
| 5a0c0 | 65 6d 20 61 72 65 0a 20 20 20 20 20 60 65 71 3f 27 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | em.are......`eq?':............(d |
| 5a0e0 | 65 66 69 6e 65 20 28 73 61 6d 65 2d 76 61 72 69 61 62 6c 65 3f 20 76 31 20 76 32 29 0a 20 20 20 | efine.(same-variable?.v1.v2).... |
| 5a100 | 20 20 20 20 20 20 20 20 20 28 61 6e 64 20 28 76 61 72 69 61 62 6c 65 3f 20 76 31 29 20 28 76 61 | .........(and.(variable?.v1).(va |
| 5a120 | 72 69 61 62 6c 65 3f 20 76 32 29 20 28 65 71 3f 20 76 31 20 76 32 29 29 29 0a 0a 20 20 20 2a 20 | riable?.v2).(eq?.v1.v2))).....*. |
| 5a140 | 53 75 6d 73 20 61 6e 64 20 70 72 6f 64 75 63 74 73 20 61 72 65 20 63 6f 6e 73 74 72 75 63 74 65 | Sums.and.products.are.constructe |
| 5a160 | 64 20 61 73 20 6c 69 73 74 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | d.as.lists:............(define.( |
| 5a180 | 6d 61 6b 65 2d 73 75 6d 20 61 31 20 61 32 29 20 28 6c 69 73 74 20 27 2b 20 61 31 20 61 32 29 29 | make-sum.a1.a2).(list.'+.a1.a2)) |
| 5a1a0 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 70 72 6f 64 75 63 | ............(define.(make-produc |
| 5a1c0 | 74 20 6d 31 20 6d 32 29 20 28 6c 69 73 74 20 27 2a 20 6d 31 20 6d 32 29 29 0a 0a 20 20 20 2a 20 | t.m1.m2).(list.'*.m1.m2)).....*. |
| 5a1e0 | 41 20 73 75 6d 20 69 73 20 61 20 6c 69 73 74 20 77 68 6f 73 65 20 66 69 72 73 74 20 65 6c 65 6d | A.sum.is.a.list.whose.first.elem |
| 5a200 | 65 6e 74 20 69 73 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 2b 27 3a 0a 0a 20 20 20 20 20 20 20 20 | ent.is.the.symbol.`+':.......... |
| 5a220 | 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d 3f 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..(define.(sum?.x).............( |
| 5a240 | 61 6e 64 20 28 70 61 69 72 3f 20 78 29 20 28 65 71 3f 20 28 63 61 72 20 78 29 20 27 2b 29 29 29 | and.(pair?.x).(eq?.(car.x).'+))) |
| 5a260 | 0a 0a 20 20 20 2a 20 54 68 65 20 61 64 64 65 6e 64 20 69 73 20 74 68 65 20 73 65 63 6f 6e 64 20 | .....*.The.addend.is.the.second. |
| 5a280 | 69 74 65 6d 20 6f 66 20 74 68 65 20 73 75 6d 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 | item.of.the.sum.list:........... |
| 5a2a0 | 20 28 64 65 66 69 6e 65 20 28 61 64 64 65 6e 64 20 73 29 20 28 63 61 64 72 20 73 29 29 0a 0a 20 | .(define.(addend.s).(cadr.s))... |
| 5a2c0 | 20 20 2a 20 54 68 65 20 61 75 67 65 6e 64 20 69 73 20 74 68 65 20 74 68 69 72 64 20 69 74 65 6d | ..*.The.augend.is.the.third.item |
| 5a2e0 | 20 6f 66 20 74 68 65 20 73 75 6d 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | .of.the.sum.list:............(de |
| 5a300 | 66 69 6e 65 20 28 61 75 67 65 6e 64 20 73 29 20 28 63 61 64 64 72 20 73 29 29 0a 0a 20 20 20 2a | fine.(augend.s).(caddr.s)).....* |
| 5a320 | 20 41 20 70 72 6f 64 75 63 74 20 69 73 20 61 20 6c 69 73 74 20 77 68 6f 73 65 20 66 69 72 73 74 | .A.product.is.a.list.whose.first |
| 5a340 | 20 65 6c 65 6d 65 6e 74 20 69 73 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 2a 27 3a 0a 0a 20 20 20 | .element.is.the.symbol.`*':..... |
| 5a360 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 64 75 63 74 3f 20 78 29 0a 20 20 20 20 | .......(define.(product?.x)..... |
| 5a380 | 20 20 20 20 20 20 20 20 28 61 6e 64 20 28 70 61 69 72 3f 20 78 29 20 28 65 71 3f 20 28 63 61 72 | ........(and.(pair?.x).(eq?.(car |
| 5a3a0 | 20 78 29 20 27 2a 29 29 29 0a 0a 20 20 20 2a 20 54 68 65 20 6d 75 6c 74 69 70 6c 69 65 72 20 69 | .x).'*))).....*.The.multiplier.i |
| 5a3c0 | 73 20 74 68 65 20 73 65 63 6f 6e 64 20 69 74 65 6d 20 6f 66 20 74 68 65 20 70 72 6f 64 75 63 74 | s.the.second.item.of.the.product |
| 5a3e0 | 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 74 69 | .list:............(define.(multi |
| 5a400 | 70 6c 69 65 72 20 70 29 20 28 63 61 64 72 20 70 29 29 0a 0a 20 20 20 2a 20 54 68 65 20 6d 75 6c | plier.p).(cadr.p)).....*.The.mul |
| 5a420 | 74 69 70 6c 69 63 61 6e 64 20 69 73 20 74 68 65 20 74 68 69 72 64 20 69 74 65 6d 20 6f 66 20 74 | tiplicand.is.the.third.item.of.t |
| 5a440 | 68 65 20 70 72 6f 64 75 63 74 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | he.product.list:............(def |
| 5a460 | 69 6e 65 20 28 6d 75 6c 74 69 70 6c 69 63 61 6e 64 20 70 29 20 28 63 61 64 64 72 20 70 29 29 0a | ine.(multiplicand.p).(caddr.p)). |
| 5a480 | 0a 0a 20 20 20 54 68 75 73 2c 20 77 65 20 6e 65 65 64 20 6f 6e 6c 79 20 63 6f 6d 62 69 6e 65 20 | .....Thus,.we.need.only.combine. |
| 5a4a0 | 74 68 65 73 65 20 77 69 74 68 20 74 68 65 20 61 6c 67 6f 72 69 74 68 6d 20 61 73 20 65 6d 62 6f | these.with.the.algorithm.as.embo |
| 5a4c0 | 64 69 65 64 20 62 79 0a 60 64 65 72 69 76 27 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 68 61 76 65 | died.by.`deriv'.in.order.to.have |
| 5a4e0 | 20 61 20 77 6f 72 6b 69 6e 67 20 73 79 6d 62 6f 6c 69 63 2d 64 69 66 66 65 72 65 6e 74 69 61 74 | .a.working.symbolic-differentiat |
| 5a500 | 69 6f 6e 20 70 72 6f 67 72 61 6d 2e 0a 4c 65 74 20 75 73 20 6c 6f 6f 6b 20 61 74 20 73 6f 6d 65 | ion.program..Let.us.look.at.some |
| 5a520 | 20 65 78 61 6d 70 6c 65 73 20 6f 66 20 69 74 73 20 62 65 68 61 76 69 6f 72 3a 0a 0a 20 20 20 20 | .examples.of.its.behavior:...... |
| 5a540 | 20 28 64 65 72 69 76 20 27 28 2b 20 78 20 33 29 20 27 78 29 0a 20 20 20 20 20 28 2b 20 31 20 30 | .(deriv.'(+.x.3).'x)......(+.1.0 |
| 5a560 | 29 0a 0a 20 20 20 20 20 28 64 65 72 69 76 20 27 28 2a 20 78 20 79 29 20 27 78 29 0a 20 20 20 20 | ).......(deriv.'(*.x.y).'x)..... |
| 5a580 | 20 28 2b 20 28 2a 20 78 20 30 29 20 28 2a 20 31 20 79 29 29 0a 0a 20 20 20 20 20 28 64 65 72 69 | .(+.(*.x.0).(*.1.y)).......(deri |
| 5a5a0 | 76 20 27 28 2a 20 28 2a 20 78 20 79 29 20 28 2b 20 78 20 33 29 29 20 27 78 29 0a 20 20 20 20 20 | v.'(*.(*.x.y).(+.x.3)).'x)...... |
| 5a5c0 | 20 20 20 28 2b 20 28 2a 20 28 2a 20 78 20 79 29 20 28 2b 20 31 20 30 29 29 0a 20 20 20 20 20 20 | ...(+.(*.(*.x.y).(+.1.0))....... |
| 5a5e0 | 20 20 28 2a 20 28 2b 20 28 2a 20 78 20 30 29 20 28 2a 20 31 20 79 29 29 0a 20 20 20 20 20 20 20 | ..(*.(+.(*.x.0).(*.1.y))........ |
| 5a600 | 20 20 20 20 28 2b 20 20 78 20 33 29 29 29 0a 0a 20 20 20 54 68 65 20 70 72 6f 67 72 61 6d 20 70 | ....(+..x.3))).....The.program.p |
| 5a620 | 72 6f 64 75 63 65 73 20 61 6e 73 77 65 72 73 20 74 68 61 74 20 61 72 65 20 63 6f 72 72 65 63 74 | roduces.answers.that.are.correct |
| 5a640 | 3b 20 68 6f 77 65 76 65 72 2c 20 74 68 65 79 20 61 72 65 0a 75 6e 73 69 6d 70 6c 69 66 69 65 64 | ;.however,.they.are.unsimplified |
| 5a660 | 2e 20 20 49 74 20 69 73 20 74 72 75 65 20 74 68 61 74 0a 0a 20 20 20 20 20 64 28 78 79 29 0a 20 | ...It.is.true.that.......d(xy).. |
| 5a680 | 20 20 20 20 2d 2d 2d 2d 2d 20 3d 20 78 20 2a 20 30 20 2b 20 31 20 2a 20 79 0a 20 20 20 20 20 20 | ....-----.=.x.*.0.+.1.*.y....... |
| 5a6a0 | 64 78 0a 0a 62 75 74 20 77 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 68 65 20 70 72 6f 67 72 61 | dx..but.we.would.like.the.progra |
| 5a6c0 | 6d 20 74 6f 20 6b 6e 6f 77 20 74 68 61 74 20 78 20 2a 20 30 20 3d 20 30 2c 20 31 20 2a 20 79 20 | m.to.know.that.x.*.0.=.0,.1.*.y. |
| 5a6e0 | 3d 20 79 2c 20 61 6e 64 20 30 0a 2b 20 79 20 3d 20 79 2e 20 20 54 68 65 20 61 6e 73 77 65 72 20 | =.y,.and.0.+.y.=.y...The.answer. |
| 5a700 | 66 6f 72 20 74 68 65 20 73 65 63 6f 6e 64 20 65 78 61 6d 70 6c 65 20 73 68 6f 75 6c 64 20 68 61 | for.the.second.example.should.ha |
| 5a720 | 76 65 20 62 65 65 6e 20 73 69 6d 70 6c 79 0a 60 79 27 2e 20 20 41 73 20 74 68 65 20 74 68 69 72 | ve.been.simply.`y'...As.the.thir |
| 5a740 | 64 20 65 78 61 6d 70 6c 65 20 73 68 6f 77 73 2c 20 74 68 69 73 20 62 65 63 6f 6d 65 73 20 61 20 | d.example.shows,.this.becomes.a. |
| 5a760 | 73 65 72 69 6f 75 73 20 69 73 73 75 65 20 77 68 65 6e 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f | serious.issue.when.the.expressio |
| 5a780 | 6e 73 20 61 72 65 20 63 6f 6d 70 6c 65 78 2e 0a 0a 20 20 20 4f 75 72 20 64 69 66 66 69 63 75 6c | ns.are.complex......Our.difficul |
| 5a7a0 | 74 79 20 69 73 20 6d 75 63 68 20 6c 69 6b 65 20 74 68 65 20 6f 6e 65 20 77 65 20 65 6e 63 6f 75 | ty.is.much.like.the.one.we.encou |
| 5a7c0 | 6e 74 65 72 65 64 20 77 69 74 68 20 74 68 65 0a 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 | ntered.with.the.rational-number. |
| 5a7e0 | 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 3a 20 77 65 20 68 61 76 65 6e 27 74 20 72 65 64 75 63 | implementation:.we.haven't.reduc |
| 5a800 | 65 64 20 61 6e 73 77 65 72 73 20 74 6f 20 73 69 6d 70 6c 65 73 74 0a 66 6f 72 6d 2e 20 20 54 6f | ed.answers.to.simplest.form...To |
| 5a820 | 20 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 | .accomplish.the.rational-number. |
| 5a840 | 72 65 64 75 63 74 69 6f 6e 2c 20 77 65 20 6e 65 65 64 65 64 20 74 6f 20 63 68 61 6e 67 65 0a 6f | reduction,.we.needed.to.change.o |
| 5a860 | 6e 6c 79 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 61 6e 64 20 74 68 65 20 73 65 6c | nly.the.constructors.and.the.sel |
| 5a880 | 65 63 74 6f 72 73 20 6f 66 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 20 20 57 | ectors.of.the.implementation...W |
| 5a8a0 | 65 20 63 61 6e 0a 61 64 6f 70 74 20 61 20 73 69 6d 69 6c 61 72 20 73 74 72 61 74 65 67 79 20 68 | e.can.adopt.a.similar.strategy.h |
| 5a8c0 | 65 72 65 2e 20 20 57 65 20 77 6f 6e 27 74 20 63 68 61 6e 67 65 20 60 64 65 72 69 76 27 20 61 74 | ere...We.won't.change.`deriv'.at |
| 5a8e0 | 20 61 6c 6c 2e 0a 49 6e 73 74 65 61 64 2c 20 77 65 20 77 69 6c 6c 20 63 68 61 6e 67 65 20 60 6d | .all..Instead,.we.will.change.`m |
| 5a900 | 61 6b 65 2d 73 75 6d 27 20 73 6f 20 74 68 61 74 20 69 66 20 62 6f 74 68 20 73 75 6d 6d 61 6e 64 | ake-sum'.so.that.if.both.summand |
| 5a920 | 73 20 61 72 65 0a 6e 75 6d 62 65 72 73 2c 20 60 6d 61 6b 65 2d 73 75 6d 27 20 77 69 6c 6c 20 61 | s.are.numbers,.`make-sum'.will.a |
| 5a940 | 64 64 20 74 68 65 6d 20 61 6e 64 20 72 65 74 75 72 6e 20 74 68 65 69 72 20 73 75 6d 2e 20 20 41 | dd.them.and.return.their.sum...A |
| 5a960 | 6c 73 6f 2c 20 69 66 20 6f 6e 65 0a 6f 66 20 74 68 65 20 73 75 6d 6d 61 6e 64 73 20 69 73 20 30 | lso,.if.one.of.the.summands.is.0 |
| 5a980 | 2c 20 74 68 65 6e 20 60 6d 61 6b 65 2d 73 75 6d 27 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 68 | ,.then.`make-sum'.will.return.th |
| 5a9a0 | 65 20 6f 74 68 65 72 20 73 75 6d 6d 61 6e 64 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | e.other.summand........(define.( |
| 5a9c0 | 6d 61 6b 65 2d 73 75 6d 20 61 31 20 61 32 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d | make-sum.a1.a2)........(cond.((= |
| 5a9e0 | 6e 75 6d 62 65 72 3f 20 61 31 20 30 29 20 61 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | number?.a1.0).a2)..............( |
| 5aa00 | 28 3d 6e 75 6d 62 65 72 3f 20 61 32 20 30 29 20 61 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | (=number?.a2.0).a1)............. |
| 5aa20 | 20 28 28 61 6e 64 20 28 6e 75 6d 62 65 72 3f 20 61 31 29 20 28 6e 75 6d 62 65 72 3f 20 61 32 29 | .((and.(number?.a1).(number?.a2) |
| 5aa40 | 29 20 28 2b 20 61 31 20 61 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 | ).(+.a1.a2))..............(else. |
| 5aa60 | 28 6c 69 73 74 20 27 2b 20 61 31 20 61 32 29 29 29 29 0a 0a 20 20 20 54 68 69 73 20 75 73 65 73 | (list.'+.a1.a2)))).....This.uses |
| 5aa80 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 3d 6e 75 6d 62 65 72 3f 27 2c 20 77 68 69 63 68 | .the.procedure.`=number?',.which |
| 5aaa0 | 20 63 68 65 63 6b 73 20 77 68 65 74 68 65 72 20 61 6e 0a 65 78 70 72 65 73 73 69 6f 6e 20 69 73 | .checks.whether.an.expression.is |
| 5aac0 | 20 65 71 75 61 6c 20 74 6f 20 61 20 67 69 76 65 6e 20 6e 75 6d 62 65 72 3a 0a 0a 20 20 20 20 20 | .equal.to.a.given.number:....... |
| 5aae0 | 28 64 65 66 69 6e 65 20 28 3d 6e 75 6d 62 65 72 3f 20 65 78 70 20 6e 75 6d 29 0a 20 20 20 20 20 | (define.(=number?.exp.num)...... |
| 5ab00 | 20 20 28 61 6e 64 20 28 6e 75 6d 62 65 72 3f 20 65 78 70 29 20 28 3d 20 65 78 70 20 6e 75 6d 29 | ..(and.(number?.exp).(=.exp.num) |
| 5ab20 | 29 29 0a 0a 20 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 77 65 20 77 69 6c 6c 20 63 68 61 6e 67 65 | )).....Similarly,.we.will.change |
| 5ab40 | 20 60 6d 61 6b 65 2d 70 72 6f 64 75 63 74 27 20 74 6f 20 62 75 69 6c 64 20 69 6e 20 74 68 65 20 | .`make-product'.to.build.in.the. |
| 5ab60 | 72 75 6c 65 73 20 74 68 61 74 20 30 0a 74 69 6d 65 73 20 61 6e 79 74 68 69 6e 67 20 69 73 20 30 | rules.that.0.times.anything.is.0 |
| 5ab80 | 20 61 6e 64 20 31 20 74 69 6d 65 73 20 61 6e 79 74 68 69 6e 67 20 69 73 20 74 68 65 20 74 68 69 | .and.1.times.anything.is.the.thi |
| 5aba0 | 6e 67 20 69 74 73 65 6c 66 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 70 | ng.itself:.......(define.(make-p |
| 5abc0 | 72 6f 64 75 63 74 20 6d 31 20 6d 32 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6f 72 20 | roduct.m1.m2)........(cond.((or. |
| 5abe0 | 28 3d 6e 75 6d 62 65 72 3f 20 6d 31 20 30 29 20 28 3d 6e 75 6d 62 65 72 3f 20 6d 32 20 30 29 29 | (=number?.m1.0).(=number?.m2.0)) |
| 5ac00 | 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 6e 75 6d 62 65 72 3f 20 6d 31 20 31 | .0)..............((=number?.m1.1 |
| 5ac20 | 29 20 6d 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 6e 75 6d 62 65 72 3f 20 6d 32 | ).m2)..............((=number?.m2 |
| 5ac40 | 20 31 29 20 6d 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 61 6e 64 20 28 6e 75 6d 62 | .1).m1)..............((and.(numb |
| 5ac60 | 65 72 3f 20 6d 31 29 20 28 6e 75 6d 62 65 72 3f 20 6d 32 29 29 20 28 2a 20 6d 31 20 6d 32 29 29 | er?.m1).(number?.m2)).(*.m1.m2)) |
| 5ac80 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 6c 69 73 74 20 27 2a 20 6d 31 20 | ..............(else.(list.'*.m1. |
| 5aca0 | 6d 32 29 29 29 29 0a 0a 20 20 20 48 65 72 65 20 69 73 20 68 6f 77 20 74 68 69 73 20 76 65 72 73 | m2)))).....Here.is.how.this.vers |
| 5acc0 | 69 6f 6e 20 77 6f 72 6b 73 20 6f 6e 20 6f 75 72 20 74 68 72 65 65 20 65 78 61 6d 70 6c 65 73 3a | ion.works.on.our.three.examples: |
| 5ace0 | 0a 0a 20 20 20 20 20 28 64 65 72 69 76 20 27 28 2b 20 78 20 33 29 20 27 78 29 0a 20 20 20 20 20 | .......(deriv.'(+.x.3).'x)...... |
| 5ad00 | 31 0a 0a 20 20 20 20 20 28 64 65 72 69 76 20 27 28 2a 20 78 20 79 29 20 27 78 29 0a 20 20 20 20 | 1.......(deriv.'(*.x.y).'x)..... |
| 5ad20 | 20 79 0a 0a 20 20 20 20 20 28 64 65 72 69 76 20 27 28 2a 20 28 2a 20 78 20 79 29 20 28 2b 20 78 | .y.......(deriv.'(*.(*.x.y).(+.x |
| 5ad40 | 20 33 29 29 20 27 78 29 0a 20 20 20 20 20 28 2b 20 28 2a 20 78 20 79 29 20 28 2a 20 79 20 28 2b | .3)).'x)......(+.(*.x.y).(*.y.(+ |
| 5ad60 | 20 78 20 33 29 29 29 0a 0a 20 20 20 41 6c 74 68 6f 75 67 68 20 74 68 69 73 20 69 73 20 71 75 69 | .x.3))).....Although.this.is.qui |
| 5ad80 | 74 65 20 61 6e 20 69 6d 70 72 6f 76 65 6d 65 6e 74 2c 20 74 68 65 20 74 68 69 72 64 20 65 78 61 | te.an.improvement,.the.third.exa |
| 5ada0 | 6d 70 6c 65 20 73 68 6f 77 73 20 74 68 61 74 0a 74 68 65 72 65 20 69 73 20 73 74 69 6c 6c 20 61 | mple.shows.that.there.is.still.a |
| 5adc0 | 20 6c 6f 6e 67 20 77 61 79 20 74 6f 20 67 6f 20 62 65 66 6f 72 65 20 77 65 20 67 65 74 20 61 20 | .long.way.to.go.before.we.get.a. |
| 5ade0 | 70 72 6f 67 72 61 6d 20 74 68 61 74 20 70 75 74 73 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e | program.that.puts.expressions.in |
| 5ae00 | 74 6f 20 61 20 66 6f 72 6d 20 74 68 61 74 20 77 65 20 6d 69 67 68 74 20 61 67 72 65 65 20 69 73 | to.a.form.that.we.might.agree.is |
| 5ae20 | 20 22 73 69 6d 70 6c 65 73 74 2e 22 20 20 54 68 65 20 70 72 6f 62 6c 65 6d 0a 6f 66 20 61 6c 67 | ."simplest."..The.problem.of.alg |
| 5ae40 | 65 62 72 61 69 63 20 73 69 6d 70 6c 69 66 69 63 61 74 69 6f 6e 20 69 73 20 63 6f 6d 70 6c 65 78 | ebraic.simplification.is.complex |
| 5ae60 | 20 62 65 63 61 75 73 65 2c 20 61 6d 6f 6e 67 20 6f 74 68 65 72 20 72 65 61 73 6f 6e 73 2c 20 61 | .because,.among.other.reasons,.a |
| 5ae80 | 0a 66 6f 72 6d 20 74 68 61 74 20 6d 61 79 20 62 65 20 73 69 6d 70 6c 65 73 74 20 66 6f 72 20 6f | .form.that.may.be.simplest.for.o |
| 5aea0 | 6e 65 20 70 75 72 70 6f 73 65 20 6d 61 79 20 6e 6f 74 20 62 65 20 66 6f 72 20 61 6e 6f 74 68 65 | ne.purpose.may.not.be.for.anothe |
| 5aec0 | 72 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 35 36 3a 2a 20 53 68 6f 77 20 68 | r........*Exercise.2.56:*.Show.h |
| 5aee0 | 6f 77 20 74 6f 20 65 78 74 65 6e 64 20 74 68 65 20 62 61 73 69 63 20 64 69 66 66 65 72 65 6e 74 | ow.to.extend.the.basic.different |
| 5af00 | 69 61 74 6f 72 20 74 6f 0a 20 20 20 20 20 68 61 6e 64 6c 65 20 6d 6f 72 65 20 6b 69 6e 64 73 20 | iator.to......handle.more.kinds. |
| 5af20 | 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 | of.expressions...For.instance,.i |
| 5af40 | 6d 70 6c 65 6d 65 6e 74 20 74 68 65 0a 20 20 20 20 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f | mplement.the......differentiatio |
| 5af60 | 6e 20 72 75 6c 65 0a 0a 20 20 20 20 20 20 20 20 20 20 6e 5f 31 20 20 20 6e 5f 32 0a 20 20 20 20 | n.rule............n_1...n_2..... |
| 5af80 | 20 20 20 20 20 20 2d 2d 2d 20 3d 20 2d 2d 2d 20 20 69 66 20 61 6e 64 20 6f 6e 6c 79 20 69 66 20 | ......---.=.---..if.and.only.if. |
| 5afa0 | 6e 5f 31 20 64 5f 32 20 3d 20 6e 5f 32 20 64 5f 31 0a 20 20 20 20 20 20 20 20 20 20 64 5f 31 20 | n_1.d_2.=.n_2.d_1...........d_1. |
| 5afc0 | 20 20 64 5f 32 0a 0a 20 20 20 20 20 62 79 20 61 64 64 69 6e 67 20 61 20 6e 65 77 20 63 6c 61 75 | ..d_2.......by.adding.a.new.clau |
| 5afe0 | 73 65 20 74 6f 20 74 68 65 20 60 64 65 72 69 76 27 20 70 72 6f 67 72 61 6d 20 61 6e 64 20 64 65 | se.to.the.`deriv'.program.and.de |
| 5b000 | 66 69 6e 69 6e 67 0a 20 20 20 20 20 61 70 70 72 6f 70 72 69 61 74 65 20 70 72 6f 63 65 64 75 72 | fining......appropriate.procedur |
| 5b020 | 65 73 20 60 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 3f 27 2c 20 60 62 61 73 65 27 2c 20 60 65 | es.`exponentiation?',.`base',.`e |
| 5b040 | 78 70 6f 6e 65 6e 74 27 2c 20 61 6e 64 0a 20 20 20 20 20 60 6d 61 6b 65 2d 65 78 70 6f 6e 65 6e | xponent',.and......`make-exponen |
| 5b060 | 74 69 61 74 69 6f 6e 27 2e 20 20 28 59 6f 75 20 6d 61 79 20 75 73 65 20 74 68 65 20 73 79 6d 62 | tiation'...(You.may.use.the.symb |
| 5b080 | 6f 6c 20 60 2a 2a 27 20 74 6f 20 64 65 6e 6f 74 65 0a 20 20 20 20 20 65 78 70 6f 6e 65 6e 74 69 | ol.`**'.to.denote......exponenti |
| 5b0a0 | 61 74 69 6f 6e 2e 29 20 20 42 75 69 6c 64 20 69 6e 20 74 68 65 20 72 75 6c 65 73 20 74 68 61 74 | ation.)..Build.in.the.rules.that |
| 5b0c0 | 20 61 6e 79 74 68 69 6e 67 20 72 61 69 73 65 64 20 74 6f 20 74 68 65 0a 20 20 20 20 20 70 6f 77 | .anything.raised.to.the......pow |
| 5b0e0 | 65 72 20 30 20 69 73 20 31 20 61 6e 64 20 61 6e 79 74 68 69 6e 67 20 72 61 69 73 65 64 20 74 6f | er.0.is.1.and.anything.raised.to |
| 5b100 | 20 74 68 65 20 70 6f 77 65 72 20 31 20 69 73 20 74 68 65 20 74 68 69 6e 67 0a 20 20 20 20 20 69 | .the.power.1.is.the.thing......i |
| 5b120 | 74 73 65 6c 66 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 35 37 3a 2a 20 45 78 | tself........*Exercise.2.57:*.Ex |
| 5b140 | 74 65 6e 64 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 70 72 6f 67 72 61 6d | tend.the.differentiation.program |
| 5b160 | 20 74 6f 20 68 61 6e 64 6c 65 20 73 75 6d 73 0a 20 20 20 20 20 61 6e 64 20 70 72 6f 64 75 63 74 | .to.handle.sums......and.product |
| 5b180 | 73 20 6f 66 20 61 72 62 69 74 72 61 72 79 20 6e 75 6d 62 65 72 73 20 6f 66 20 28 74 77 6f 20 6f | s.of.arbitrary.numbers.of.(two.o |
| 5b1a0 | 72 20 6d 6f 72 65 29 20 74 65 72 6d 73 2e 20 20 54 68 65 6e 0a 20 20 20 20 20 74 68 65 20 6c 61 | r.more).terms...Then......the.la |
| 5b1c0 | 73 74 20 65 78 61 6d 70 6c 65 20 61 62 6f 76 65 20 63 6f 75 6c 64 20 62 65 20 65 78 70 72 65 73 | st.example.above.could.be.expres |
| 5b1e0 | 73 65 64 20 61 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 72 69 76 20 27 28 2a 20 78 20 79 | sed.as............(deriv.'(*.x.y |
| 5b200 | 20 28 2b 20 78 20 33 29 29 20 27 78 29 0a 0a 20 20 20 20 20 54 72 79 20 74 6f 20 64 6f 20 74 68 | .(+.x.3)).'x).......Try.to.do.th |
| 5b220 | 69 73 20 62 79 20 63 68 61 6e 67 69 6e 67 20 6f 6e 6c 79 20 74 68 65 20 72 65 70 72 65 73 65 6e | is.by.changing.only.the.represen |
| 5b240 | 74 61 74 69 6f 6e 20 66 6f 72 20 73 75 6d 73 20 61 6e 64 0a 20 20 20 20 20 70 72 6f 64 75 63 74 | tation.for.sums.and......product |
| 5b260 | 73 2c 20 77 69 74 68 6f 75 74 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 60 64 65 72 69 76 27 20 | s,.without.changing.the.`deriv'. |
| 5b280 | 70 72 6f 63 65 64 75 72 65 20 61 74 20 61 6c 6c 2e 20 20 46 6f 72 0a 20 20 20 20 20 65 78 61 6d | procedure.at.all...For......exam |
| 5b2a0 | 70 6c 65 2c 20 74 68 65 20 60 61 64 64 65 6e 64 27 20 6f 66 20 61 20 73 75 6d 20 77 6f 75 6c 64 | ple,.the.`addend'.of.a.sum.would |
| 5b2c0 | 20 62 65 20 74 68 65 20 66 69 72 73 74 20 74 65 72 6d 2c 20 61 6e 64 20 74 68 65 0a 20 20 20 20 | .be.the.first.term,.and.the..... |
| 5b2e0 | 20 60 61 75 67 65 6e 64 27 20 77 6f 75 6c 64 20 62 65 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 | .`augend'.would.be.the.sum.of.th |
| 5b300 | 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 74 65 72 6d 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 | e.rest.of.the.terms........*Exer |
| 5b320 | 63 69 73 65 20 32 2e 35 38 3a 2a 20 53 75 70 70 6f 73 65 20 77 65 20 77 61 6e 74 20 74 6f 20 6d | cise.2.58:*.Suppose.we.want.to.m |
| 5b340 | 6f 64 69 66 79 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 0a 20 20 20 20 20 70 | odify.the.differentiation......p |
| 5b360 | 72 6f 67 72 61 6d 20 73 6f 20 74 68 61 74 20 69 74 20 77 6f 72 6b 73 20 77 69 74 68 20 6f 72 64 | rogram.so.that.it.works.with.ord |
| 5b380 | 69 6e 61 72 79 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6e 6f 74 61 74 69 6f 6e 2c 20 69 6e 0a | inary.mathematical.notation,.in. |
| 5b3a0 | 20 20 20 20 20 77 68 69 63 68 20 60 2b 27 20 61 6e 64 20 60 2a 27 20 61 72 65 20 69 6e 66 69 78 | .....which.`+'.and.`*'.are.infix |
| 5b3c0 | 20 72 61 74 68 65 72 20 74 68 61 6e 20 70 72 65 66 69 78 20 6f 70 65 72 61 74 6f 72 73 2e 20 20 | .rather.than.prefix.operators... |
| 5b3e0 | 53 69 6e 63 65 0a 20 20 20 20 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 70 | Since......the.differentiation.p |
| 5b400 | 72 6f 67 72 61 6d 20 69 73 20 64 65 66 69 6e 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 61 62 | rogram.is.defined.in.terms.of.ab |
| 5b420 | 73 74 72 61 63 74 20 64 61 74 61 2c 0a 20 20 20 20 20 77 65 20 63 61 6e 20 6d 6f 64 69 66 79 20 | stract.data,......we.can.modify. |
| 5b440 | 69 74 20 74 6f 20 77 6f 72 6b 20 77 69 74 68 20 64 69 66 66 65 72 65 6e 74 20 72 65 70 72 65 73 | it.to.work.with.different.repres |
| 5b460 | 65 6e 74 61 74 69 6f 6e 73 20 6f 66 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 20 73 6f | entations.of......expressions.so |
| 5b480 | 6c 65 6c 79 20 62 79 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 70 72 65 64 69 63 61 74 65 73 2c | lely.by.changing.the.predicates, |
| 5b4a0 | 20 73 65 6c 65 63 74 6f 72 73 2c 20 61 6e 64 0a 20 20 20 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 | .selectors,.and......constructor |
| 5b4c0 | 73 20 74 68 61 74 20 64 65 66 69 6e 65 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e | s.that.define.the.representation |
| 5b4e0 | 20 6f 66 20 74 68 65 20 61 6c 67 65 62 72 61 69 63 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f | .of.the.algebraic......expressio |
| 5b500 | 6e 73 20 6f 6e 20 77 68 69 63 68 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 69 61 74 6f 72 20 69 | ns.on.which.the.differentiator.i |
| 5b520 | 73 20 74 6f 20 6f 70 65 72 61 74 65 2e 0a 0a 20 20 20 20 20 20 20 61 2e 20 53 68 6f 77 20 68 6f | s.to.operate..........a..Show.ho |
| 5b540 | 77 20 74 6f 20 64 6f 20 74 68 69 73 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 64 69 66 66 65 72 65 | w.to.do.this.in.order.to.differe |
| 5b560 | 6e 74 69 61 74 65 20 61 6c 67 65 62 72 61 69 63 0a 20 20 20 20 20 20 20 20 20 20 65 78 70 72 65 | ntiate.algebraic...........expre |
| 5b580 | 73 73 69 6f 6e 73 20 70 72 65 73 65 6e 74 65 64 20 69 6e 20 69 6e 66 69 78 20 66 6f 72 6d 2c 20 | ssions.presented.in.infix.form,. |
| 5b5a0 | 73 75 63 68 20 61 73 20 60 28 78 20 2b 20 28 33 20 2a 20 28 78 20 2b 0a 20 20 20 20 20 20 20 20 | such.as.`(x.+.(3.*.(x.+......... |
| 5b5c0 | 20 20 28 79 20 2b 20 32 29 29 29 29 27 2e 20 20 54 6f 20 73 69 6d 70 6c 69 66 79 20 74 68 65 20 | ..(y.+.2))))'...To.simplify.the. |
| 5b5e0 | 74 61 73 6b 2c 20 61 73 73 75 6d 65 20 74 68 61 74 20 60 2b 27 20 61 6e 64 20 60 2a 27 0a 20 20 | task,.assume.that.`+'.and.`*'... |
| 5b600 | 20 20 20 20 20 20 20 20 61 6c 77 61 79 73 20 74 61 6b 65 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 | ........always.take.two.argument |
| 5b620 | 73 20 61 6e 64 20 74 68 61 74 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 66 75 6c 6c 79 | s.and.that.expressions.are.fully |
| 5b640 | 0a 20 20 20 20 20 20 20 20 20 20 70 61 72 65 6e 74 68 65 73 69 7a 65 64 2e 0a 0a 20 20 20 20 20 | ...........parenthesized........ |
| 5b660 | 20 20 62 2e 20 54 68 65 20 70 72 6f 62 6c 65 6d 20 62 65 63 6f 6d 65 73 20 73 75 62 73 74 61 6e | ..b..The.problem.becomes.substan |
| 5b680 | 74 69 61 6c 6c 79 20 68 61 72 64 65 72 20 69 66 20 77 65 20 61 6c 6c 6f 77 20 73 74 61 6e 64 61 | tially.harder.if.we.allow.standa |
| 5b6a0 | 72 64 0a 20 20 20 20 20 20 20 20 20 20 61 6c 67 65 62 72 61 69 63 20 6e 6f 74 61 74 69 6f 6e 2c | rd...........algebraic.notation, |
| 5b6c0 | 20 73 75 63 68 20 61 73 20 60 28 78 20 2b 20 33 20 2a 20 28 78 20 2b 20 79 20 2b 20 32 29 29 27 | .such.as.`(x.+.3.*.(x.+.y.+.2))' |
| 5b6e0 | 2c 20 77 68 69 63 68 0a 20 20 20 20 20 20 20 20 20 20 64 72 6f 70 73 20 75 6e 6e 65 63 65 73 73 | ,.which...........drops.unnecess |
| 5b700 | 61 72 79 20 70 61 72 65 6e 74 68 65 73 65 73 20 61 6e 64 20 61 73 73 75 6d 65 73 20 74 68 61 74 | ary.parentheses.and.assumes.that |
| 5b720 | 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 20 20 69 73 20 64 6f 6e | .multiplication...........is.don |
| 5b740 | 65 20 62 65 66 6f 72 65 20 61 64 64 69 74 69 6f 6e 2e 20 20 43 61 6e 20 79 6f 75 20 64 65 73 69 | e.before.addition...Can.you.desi |
| 5b760 | 67 6e 20 61 70 70 72 6f 70 72 69 61 74 65 0a 20 20 20 20 20 20 20 20 20 20 70 72 65 64 69 63 61 | gn.appropriate...........predica |
| 5b780 | 74 65 73 2c 20 73 65 6c 65 63 74 6f 72 73 2c 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 | tes,.selectors,.and.constructors |
| 5b7a0 | 20 66 6f 72 20 74 68 69 73 20 6e 6f 74 61 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 20 20 73 75 63 | .for.this.notation...........suc |
| 5b7c0 | 68 20 74 68 61 74 20 6f 75 72 20 64 65 72 69 76 61 74 69 76 65 20 70 72 6f 67 72 61 6d 20 73 74 | h.that.our.derivative.program.st |
| 5b7e0 | 69 6c 6c 20 77 6f 72 6b 73 3f 0a 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 | ill.works?.....File:.sicp.info,. |
| 5b800 | 20 4e 6f 64 65 3a 20 32 2d 33 2d 33 2c 20 20 4e 65 78 74 3a 20 32 2d 33 2d 34 2c 20 20 50 72 65 | .Node:.2-3-3,..Next:.2-3-4,..Pre |
| 5b820 | 76 3a 20 32 2d 33 2d 32 2c 20 20 55 70 3a 20 32 2d 33 0a 0a 32 2e 33 2e 33 20 45 78 61 6d 70 6c | v:.2-3-2,..Up:.2-3..2.3.3.Exampl |
| 5b840 | 65 3a 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 53 65 74 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | e:.Representing.Sets.----------- |
| 5b860 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 6e 20 74 68 65 20 70 72 | ---------------------..In.the.pr |
| 5b880 | 65 76 69 6f 75 73 20 65 78 61 6d 70 6c 65 73 20 77 65 20 62 75 69 6c 74 20 72 65 70 72 65 73 65 | evious.examples.we.built.represe |
| 5b8a0 | 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 74 77 6f 20 6b 69 6e 64 73 20 6f 66 0a 63 6f 6d 70 6f 75 | ntations.for.two.kinds.of.compou |
| 5b8c0 | 6e 64 20 64 61 74 61 20 6f 62 6a 65 63 74 73 3a 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 | nd.data.objects:.rational.number |
| 5b8e0 | 73 20 61 6e 64 20 61 6c 67 65 62 72 61 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 49 6e | s.and.algebraic.expressions...In |
| 5b900 | 0a 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 65 78 61 6d 70 6c 65 73 20 77 65 20 68 61 64 20 74 68 | .one.of.these.examples.we.had.th |
| 5b920 | 65 20 63 68 6f 69 63 65 20 6f 66 20 73 69 6d 70 6c 69 66 79 69 6e 67 20 28 72 65 64 75 63 69 6e | e.choice.of.simplifying.(reducin |
| 5b940 | 67 29 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 61 74 20 65 69 74 68 65 72 20 63 6f 6e | g).the.expressions.at.either.con |
| 5b960 | 73 74 72 75 63 74 69 6f 6e 20 74 69 6d 65 20 6f 72 20 73 65 6c 65 63 74 69 6f 6e 20 74 69 6d 65 | struction.time.or.selection.time |
| 5b980 | 2c 20 62 75 74 20 6f 74 68 65 72 0a 74 68 61 6e 20 74 68 61 74 20 74 68 65 20 63 68 6f 69 63 65 | ,.but.other.than.that.the.choice |
| 5b9a0 | 20 6f 66 20 61 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 73 65 20 73 | .of.a.representation.for.these.s |
| 5b9c0 | 74 72 75 63 74 75 72 65 73 20 69 6e 20 74 65 72 6d 73 0a 6f 66 20 6c 69 73 74 73 20 77 61 73 20 | tructures.in.terms.of.lists.was. |
| 5b9e0 | 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 2e 20 57 68 65 6e 20 77 65 20 74 75 72 6e 20 74 6f | straightforward..When.we.turn.to |
| 5ba00 | 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 0a 73 65 74 73 2c 20 74 68 65 | .the.representation.of.sets,.the |
| 5ba20 | 20 63 68 6f 69 63 65 20 6f 66 20 61 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 6e | .choice.of.a.representation.is.n |
| 5ba40 | 6f 74 20 73 6f 20 6f 62 76 69 6f 75 73 2e 20 20 49 6e 64 65 65 64 2c 20 74 68 65 72 65 0a 61 72 | ot.so.obvious...Indeed,.there.ar |
| 5ba60 | 65 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 70 6f 73 73 69 62 6c 65 20 72 65 70 72 65 73 65 6e 74 | e.a.number.of.possible.represent |
| 5ba80 | 61 74 69 6f 6e 73 2c 20 61 6e 64 20 74 68 65 79 20 64 69 66 66 65 72 20 73 69 67 6e 69 66 69 63 | ations,.and.they.differ.signific |
| 5baa0 | 61 6e 74 6c 79 0a 66 72 6f 6d 20 6f 6e 65 20 61 6e 6f 74 68 65 72 20 69 6e 20 73 65 76 65 72 61 | antly.from.one.another.in.severa |
| 5bac0 | 6c 20 77 61 79 73 2e 0a 0a 20 20 20 49 6e 66 6f 72 6d 61 6c 6c 79 2c 20 61 20 73 65 74 20 69 73 | l.ways......Informally,.a.set.is |
| 5bae0 | 20 73 69 6d 70 6c 79 20 61 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 64 69 73 74 69 6e 63 74 | .simply.a.collection.of.distinct |
| 5bb00 | 20 6f 62 6a 65 63 74 73 2e 20 20 54 6f 0a 67 69 76 65 20 61 20 6d 6f 72 65 20 70 72 65 63 69 73 | .objects...To.give.a.more.precis |
| 5bb20 | 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 77 65 20 63 61 6e 20 65 6d 70 6c 6f 79 20 74 68 65 20 6d | e.definition.we.can.employ.the.m |
| 5bb40 | 65 74 68 6f 64 20 6f 66 20 64 61 74 61 0a 61 62 73 74 72 61 63 74 69 6f 6e 2e 20 20 54 68 61 74 | ethod.of.data.abstraction...That |
| 5bb60 | 20 69 73 2c 20 77 65 20 64 65 66 69 6e 65 20 22 73 65 74 22 20 62 79 20 73 70 65 63 69 66 79 69 | .is,.we.define."set".by.specifyi |
| 5bb80 | 6e 67 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 0a 74 68 61 74 20 61 72 65 20 74 6f 20 62 65 | ng.the.operations.that.are.to.be |
| 5bba0 | 20 75 73 65 64 20 6f 6e 20 73 65 74 73 2e 20 20 54 68 65 73 65 20 61 72 65 20 60 75 6e 69 6f 6e | .used.on.sets...These.are.`union |
| 5bbc0 | 2d 73 65 74 27 2c 0a 60 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 27 2c 20 60 65 6c 65 6d | -set',.`intersection-set',.`elem |
| 5bbe0 | 65 6e 74 2d 6f 66 2d 73 65 74 3f 27 2c 20 61 6e 64 20 60 61 64 6a 6f 69 6e 2d 73 65 74 27 2e 0a | ent-of-set?',.and.`adjoin-set'.. |
| 5bc00 | 60 45 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 27 20 69 73 20 61 20 70 72 65 64 69 63 61 74 65 | `Element-of-set?'.is.a.predicate |
| 5bc20 | 20 74 68 61 74 20 64 65 74 65 72 6d 69 6e 65 73 20 77 68 65 74 68 65 72 20 61 20 67 69 76 65 6e | .that.determines.whether.a.given |
| 5bc40 | 0a 65 6c 65 6d 65 6e 74 20 69 73 20 61 20 6d 65 6d 62 65 72 20 6f 66 20 61 20 73 65 74 2e 20 20 | .element.is.a.member.of.a.set... |
| 5bc60 | 60 41 64 6a 6f 69 6e 2d 73 65 74 27 20 74 61 6b 65 73 20 61 6e 20 6f 62 6a 65 63 74 20 61 6e 64 | `Adjoin-set'.takes.an.object.and |
| 5bc80 | 20 61 20 73 65 74 0a 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 | .a.set.as.arguments.and.returns. |
| 5bca0 | 61 20 73 65 74 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 | a.set.that.contains.the.elements |
| 5bcc0 | 20 6f 66 20 74 68 65 0a 6f 72 69 67 69 6e 61 6c 20 73 65 74 20 61 6e 64 20 61 6c 73 6f 20 74 68 | .of.the.original.set.and.also.th |
| 5bce0 | 65 20 61 64 6a 6f 69 6e 65 64 20 65 6c 65 6d 65 6e 74 2e 20 20 60 55 6e 69 6f 6e 2d 73 65 74 27 | e.adjoined.element...`Union-set' |
| 5bd00 | 20 63 6f 6d 70 75 74 65 73 20 74 68 65 0a 75 6e 69 6f 6e 20 6f 66 20 74 77 6f 20 73 65 74 73 2c | .computes.the.union.of.two.sets, |
| 5bd20 | 20 77 68 69 63 68 20 69 73 20 74 68 65 20 73 65 74 20 63 6f 6e 74 61 69 6e 69 6e 67 20 65 61 63 | .which.is.the.set.containing.eac |
| 5bd40 | 68 20 65 6c 65 6d 65 6e 74 20 74 68 61 74 0a 61 70 70 65 61 72 73 20 69 6e 20 65 69 74 68 65 72 | h.element.that.appears.in.either |
| 5bd60 | 20 61 72 67 75 6d 65 6e 74 2e 20 20 60 49 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 27 20 63 | .argument...`Intersection-set'.c |
| 5bd80 | 6f 6d 70 75 74 65 73 20 74 68 65 0a 69 6e 74 65 72 73 65 63 74 69 6f 6e 20 6f 66 20 74 77 6f 20 | omputes.the.intersection.of.two. |
| 5bda0 | 73 65 74 73 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 73 65 74 20 63 6f 6e 74 61 69 6e 69 6e | sets,.which.is.the.set.containin |
| 5bdc0 | 67 20 6f 6e 6c 79 20 65 6c 65 6d 65 6e 74 73 0a 74 68 61 74 20 61 70 70 65 61 72 20 69 6e 20 62 | g.only.elements.that.appear.in.b |
| 5bde0 | 6f 74 68 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 46 72 6f 6d 20 74 68 65 20 76 69 65 77 70 6f 69 | oth.arguments...From.the.viewpoi |
| 5be00 | 6e 74 20 6f 66 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 0a 77 65 20 61 72 65 20 66 | nt.of.data.abstraction,.we.are.f |
| 5be20 | 72 65 65 20 74 6f 20 64 65 73 69 67 6e 20 61 6e 79 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e | ree.to.design.any.representation |
| 5be40 | 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 73 20 74 68 65 73 65 0a 6f 70 65 72 61 74 69 6f 6e | .that.implements.these.operation |
| 5be60 | 73 20 69 6e 20 61 20 77 61 79 20 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 74 68 65 20 69 | s.in.a.way.consistent.with.the.i |
| 5be80 | 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 73 20 67 69 76 65 6e 20 61 62 6f 76 65 2e 28 31 29 0a 0a | nterpretations.given.above.(1).. |
| 5bea0 | 53 65 74 73 20 61 73 20 75 6e 6f 72 64 65 72 65 64 20 6c 69 73 74 73 0a 2e 2e 2e 2e 2e 2e 2e 2e | Sets.as.unordered.lists......... |
| 5bec0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 4f 6e 65 20 77 61 79 20 74 6f 20 72 65 70 72 | .................One.way.to.repr |
| 5bee0 | 65 73 65 6e 74 20 61 20 73 65 74 20 69 73 20 61 73 20 61 20 6c 69 73 74 20 6f 66 20 69 74 73 20 | esent.a.set.is.as.a.list.of.its. |
| 5bf00 | 65 6c 65 6d 65 6e 74 73 20 69 6e 20 77 68 69 63 68 20 6e 6f 0a 65 6c 65 6d 65 6e 74 20 61 70 70 | elements.in.which.no.element.app |
| 5bf20 | 65 61 72 73 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 63 65 2e 20 20 54 68 65 20 65 6d 70 74 79 20 | ears.more.than.once...The.empty. |
| 5bf40 | 73 65 74 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 74 68 65 0a 65 6d 70 74 79 20 | set.is.represented.by.the.empty. |
| 5bf60 | 6c 69 73 74 2e 20 20 49 6e 20 74 68 69 73 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c 20 60 | list...In.this.representation,.` |
| 5bf80 | 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 27 20 69 73 20 73 69 6d 69 6c 61 72 20 74 6f 0a 74 | element-of-set?'.is.similar.to.t |
| 5bfa0 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 6d 65 6d 71 27 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a | he.procedure.`memq'.of.section.* |
| 5bfc0 | 4e 6f 74 65 20 32 2d 33 2d 31 3a 3a 2e 20 20 49 74 20 75 73 65 73 20 60 65 71 75 61 6c 3f 27 0a | Note.2-3-1::...It.uses.`equal?'. |
| 5bfe0 | 69 6e 73 74 65 61 64 20 6f 66 20 60 65 71 3f 27 20 73 6f 20 74 68 61 74 20 74 68 65 20 73 65 74 | instead.of.`eq?'.so.that.the.set |
| 5c000 | 20 65 6c 65 6d 65 6e 74 73 20 6e 65 65 64 20 6e 6f 74 20 62 65 20 73 79 6d 62 6f 6c 73 3a 0a 0a | .elements.need.not.be.symbols:.. |
| 5c020 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 78 20 | .....(define.(element-of-set?.x. |
| 5c040 | 73 65 74 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 73 65 74 29 20 66 | set)........(cond.((null?.set).f |
| 5c060 | 61 6c 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 75 61 6c 3f 20 78 20 28 63 | alse)..............((equal?.x.(c |
| 5c080 | 61 72 20 73 65 74 29 29 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 | ar.set)).true)..............(els |
| 5c0a0 | 65 20 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 78 20 28 63 64 72 20 73 65 74 29 29 29 | e.(element-of-set?.x.(cdr.set))) |
| 5c0c0 | 29 29 0a 0a 20 20 20 55 73 69 6e 67 20 74 68 69 73 2c 20 77 65 20 63 61 6e 20 77 72 69 74 65 20 | )).....Using.this,.we.can.write. |
| 5c0e0 | 60 61 64 6a 6f 69 6e 2d 73 65 74 27 2e 20 20 49 66 20 74 68 65 20 6f 62 6a 65 63 74 20 74 6f 20 | `adjoin-set'...If.the.object.to. |
| 5c100 | 62 65 20 61 64 6a 6f 69 6e 65 64 0a 69 73 20 61 6c 72 65 61 64 79 20 69 6e 20 74 68 65 20 73 65 | be.adjoined.is.already.in.the.se |
| 5c120 | 74 2c 20 77 65 20 6a 75 73 74 20 72 65 74 75 72 6e 20 74 68 65 20 73 65 74 2e 20 20 4f 74 68 65 | t,.we.just.return.the.set...Othe |
| 5c140 | 72 77 69 73 65 2c 20 77 65 20 75 73 65 0a 60 63 6f 6e 73 27 20 74 6f 20 61 64 64 20 74 68 65 20 | rwise,.we.use.`cons'.to.add.the. |
| 5c160 | 6f 62 6a 65 63 74 20 74 6f 20 74 68 65 20 6c 69 73 74 20 74 68 61 74 20 72 65 70 72 65 73 65 6e | object.to.the.list.that.represen |
| 5c180 | 74 73 20 74 68 65 20 73 65 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 6a 6f 69 | ts.the.set:.......(define.(adjoi |
| 5c1a0 | 6e 2d 73 65 74 20 78 20 73 65 74 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 65 6c 65 6d 65 6e 74 | n-set.x.set)........(if.(element |
| 5c1c0 | 2d 6f 66 2d 73 65 74 3f 20 78 20 73 65 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 73 65 74 0a 20 | -of-set?.x.set)............set.. |
| 5c1e0 | 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 78 20 73 65 74 29 29 29 0a 0a 20 20 20 46 6f 72 | ..........(cons.x.set))).....For |
| 5c200 | 20 60 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 27 20 77 65 20 63 61 6e 20 75 73 65 20 61 | .`intersection-set'.we.can.use.a |
| 5c220 | 20 72 65 63 75 72 73 69 76 65 20 73 74 72 61 74 65 67 79 2e 20 20 49 66 20 77 65 20 6b 6e 6f 77 | .recursive.strategy...If.we.know |
| 5c240 | 0a 68 6f 77 20 74 6f 20 66 6f 72 6d 20 74 68 65 20 69 6e 74 65 72 73 65 63 74 69 6f 6e 20 6f 66 | .how.to.form.the.intersection.of |
| 5c260 | 20 60 73 65 74 32 27 20 61 6e 64 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 60 73 65 74 31 27 2c | .`set2'.and.the.`cdr'.of.`set1', |
| 5c280 | 20 77 65 20 6f 6e 6c 79 0a 6e 65 65 64 20 74 6f 20 64 65 63 69 64 65 20 77 68 65 74 68 65 72 20 | .we.only.need.to.decide.whether. |
| 5c2a0 | 74 6f 20 69 6e 63 6c 75 64 65 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 60 73 65 74 31 27 20 69 | to.include.the.`car'.of.`set1'.i |
| 5c2c0 | 6e 20 74 68 69 73 2e 20 20 42 75 74 0a 74 68 69 73 20 64 65 70 65 6e 64 73 20 6f 6e 20 77 68 65 | n.this...But.this.depends.on.whe |
| 5c2e0 | 74 68 65 72 20 60 28 63 61 72 20 73 65 74 31 29 27 20 69 73 20 61 6c 73 6f 20 69 6e 20 60 73 65 | ther.`(car.set1)'.is.also.in.`se |
| 5c300 | 74 32 27 2e 20 20 48 65 72 65 20 69 73 20 74 68 65 0a 72 65 73 75 6c 74 69 6e 67 20 70 72 6f 63 | t2'...Here.is.the.resulting.proc |
| 5c320 | 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 74 65 72 73 65 63 74 69 | edure:.......(define.(intersecti |
| 5c340 | 6f 6e 2d 73 65 74 20 73 65 74 31 20 73 65 74 32 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 | on-set.set1.set2)........(cond.( |
| 5c360 | 28 6f 72 20 28 6e 75 6c 6c 3f 20 73 65 74 31 29 20 28 6e 75 6c 6c 3f 20 73 65 74 32 29 29 20 27 | (or.(null?.set1).(null?.set2)).' |
| 5c380 | 28 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 | ())..............((element-of-se |
| 5c3a0 | 74 3f 20 28 63 61 72 20 73 65 74 31 29 20 73 65 74 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | t?.(car.set1).set2)............. |
| 5c3c0 | 20 20 28 63 6f 6e 73 20 28 63 61 72 20 73 65 74 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..(cons.(car.set1).............. |
| 5c3e0 | 20 20 20 20 20 20 20 28 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 20 28 63 64 72 20 73 65 | .......(intersection-set.(cdr.se |
| 5c400 | 74 31 29 20 73 65 74 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 | t1).set2)))..............(else.( |
| 5c420 | 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 20 28 63 64 72 20 73 65 74 31 29 20 73 65 74 32 | intersection-set.(cdr.set1).set2 |
| 5c440 | 29 29 29 29 0a 0a 20 20 20 49 6e 20 64 65 73 69 67 6e 69 6e 67 20 61 20 72 65 70 72 65 73 65 6e | )))).....In.designing.a.represen |
| 5c460 | 74 61 74 69 6f 6e 2c 20 6f 6e 65 20 6f 66 20 74 68 65 20 69 73 73 75 65 73 20 77 65 20 73 68 6f | tation,.one.of.the.issues.we.sho |
| 5c480 | 75 6c 64 20 62 65 0a 63 6f 6e 63 65 72 6e 65 64 20 77 69 74 68 20 69 73 20 65 66 66 69 63 69 65 | uld.be.concerned.with.is.efficie |
| 5c4a0 | 6e 63 79 2e 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 | ncy...Consider.the.number.of.ste |
| 5c4c0 | 70 73 20 72 65 71 75 69 72 65 64 20 62 79 0a 6f 75 72 20 73 65 74 20 6f 70 65 72 61 74 69 6f 6e | ps.required.by.our.set.operation |
| 5c4e0 | 73 2e 20 20 53 69 6e 63 65 20 74 68 65 79 20 61 6c 6c 20 75 73 65 20 60 65 6c 65 6d 65 6e 74 2d | s...Since.they.all.use.`element- |
| 5c500 | 6f 66 2d 73 65 74 3f 27 2c 20 74 68 65 20 73 70 65 65 64 20 6f 66 0a 74 68 69 73 20 6f 70 65 72 | of-set?',.the.speed.of.this.oper |
| 5c520 | 61 74 69 6f 6e 20 68 61 73 20 61 20 6d 61 6a 6f 72 20 69 6d 70 61 63 74 20 6f 6e 20 74 68 65 20 | ation.has.a.major.impact.on.the. |
| 5c540 | 65 66 66 69 63 69 65 6e 63 79 20 6f 66 20 74 68 65 20 73 65 74 0a 69 6d 70 6c 65 6d 65 6e 74 61 | efficiency.of.the.set.implementa |
| 5c560 | 74 69 6f 6e 20 61 73 20 61 20 77 68 6f 6c 65 2e 20 20 4e 6f 77 2c 20 69 6e 20 6f 72 64 65 72 20 | tion.as.a.whole...Now,.in.order. |
| 5c580 | 74 6f 20 63 68 65 63 6b 20 77 68 65 74 68 65 72 20 61 6e 20 6f 62 6a 65 63 74 20 69 73 0a 61 20 | to.check.whether.an.object.is.a. |
| 5c5a0 | 6d 65 6d 62 65 72 20 6f 66 20 61 20 73 65 74 2c 20 60 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 | member.of.a.set,.`element-of-set |
| 5c5c0 | 3f 27 20 6d 61 79 20 68 61 76 65 20 74 6f 20 73 63 61 6e 20 74 68 65 20 65 6e 74 69 72 65 20 73 | ?'.may.have.to.scan.the.entire.s |
| 5c5e0 | 65 74 2e 0a 28 49 6e 20 74 68 65 20 77 6f 72 73 74 20 63 61 73 65 2c 20 74 68 65 20 6f 62 6a 65 | et..(In.the.worst.case,.the.obje |
| 5c600 | 63 74 20 74 75 72 6e 73 20 6f 75 74 20 6e 6f 74 20 74 6f 20 62 65 20 69 6e 20 74 68 65 20 73 65 | ct.turns.out.not.to.be.in.the.se |
| 5c620 | 74 2e 29 20 20 48 65 6e 63 65 2c 0a 69 66 20 74 68 65 20 73 65 74 20 68 61 73 20 6e 20 65 6c 65 | t.)..Hence,.if.the.set.has.n.ele |
| 5c640 | 6d 65 6e 74 73 2c 20 60 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 27 20 20 6d 69 67 68 74 20 | ments,.`element-of-set?'..might. |
| 5c660 | 74 61 6b 65 20 75 70 20 74 6f 20 6e 20 73 74 65 70 73 2e 0a 54 68 75 73 2c 20 74 68 65 20 6e 75 | take.up.to.n.steps..Thus,.the.nu |
| 5c680 | 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 72 65 71 75 69 72 65 64 20 67 72 6f 77 73 20 61 73 20 | mber.of.steps.required.grows.as. |
| 5c6a0 | 5b 74 68 65 74 61 5d 28 6e 29 2e 20 20 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 0a 73 74 65 70 73 | [theta](n)...The.number.of.steps |
| 5c6c0 | 20 72 65 71 75 69 72 65 64 20 62 79 20 60 61 64 6a 6f 69 6e 2d 73 65 74 27 2c 20 77 68 69 63 68 | .required.by.`adjoin-set',.which |
| 5c6e0 | 20 75 73 65 73 20 74 68 69 73 20 6f 70 65 72 61 74 69 6f 6e 2c 20 61 6c 73 6f 20 67 72 6f 77 73 | .uses.this.operation,.also.grows |
| 5c700 | 0a 61 73 20 5b 74 68 65 74 61 5d 28 6e 29 2e 20 20 46 6f 72 20 60 69 6e 74 65 72 73 65 63 74 69 | .as.[theta](n)...For.`intersecti |
| 5c720 | 6f 6e 2d 73 65 74 27 2c 20 77 68 69 63 68 20 64 6f 65 73 20 61 6e 20 60 65 6c 65 6d 65 6e 74 2d | on-set',.which.does.an.`element- |
| 5c740 | 6f 66 2d 73 65 74 3f 27 0a 63 68 65 63 6b 20 66 6f 72 20 65 61 63 68 20 65 6c 65 6d 65 6e 74 20 | of-set?'.check.for.each.element. |
| 5c760 | 6f 66 20 60 73 65 74 31 27 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 72 | of.`set1',.the.number.of.steps.r |
| 5c780 | 65 71 75 69 72 65 64 20 67 72 6f 77 73 20 61 73 0a 74 68 65 20 70 72 6f 64 75 63 74 20 6f 66 20 | equired.grows.as.the.product.of. |
| 5c7a0 | 74 68 65 20 73 69 7a 65 73 20 6f 66 20 74 68 65 20 73 65 74 73 20 69 6e 76 6f 6c 76 65 64 2c 20 | the.sizes.of.the.sets.involved,. |
| 5c7c0 | 6f 72 20 5b 74 68 65 74 61 5d 28 6e 5e 32 29 20 66 6f 72 20 74 77 6f 0a 73 65 74 73 20 6f 66 20 | or.[theta](n^2).for.two.sets.of. |
| 5c7e0 | 73 69 7a 65 20 6e 2e 20 20 54 68 65 20 73 61 6d 65 20 77 69 6c 6c 20 62 65 20 74 72 75 65 20 6f | size.n...The.same.will.be.true.o |
| 5c800 | 66 20 60 75 6e 69 6f 6e 2d 73 65 74 27 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 | f.`union-set'........*Exercise.2 |
| 5c820 | 2e 35 39 3a 2a 20 49 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 60 75 6e 69 6f 6e 2d 73 65 74 27 20 | .59:*.Implement.the.`union-set'. |
| 5c840 | 6f 70 65 72 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 0a 20 20 20 20 20 75 6e 6f 72 64 65 72 65 64 | operation.for.the......unordered |
| 5c860 | 2d 6c 69 73 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 73 65 74 73 2e 0a 0a 20 | -list.representation.of.sets.... |
| 5c880 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 36 30 3a 2a 20 57 65 20 73 70 65 63 69 66 69 65 | ....*Exercise.2.60:*.We.specifie |
| 5c8a0 | 64 20 74 68 61 74 20 61 20 73 65 74 20 77 6f 75 6c 64 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 | d.that.a.set.would.be.represente |
| 5c8c0 | 64 20 61 73 20 61 0a 20 20 20 20 20 6c 69 73 74 20 77 69 74 68 20 6e 6f 20 64 75 70 6c 69 63 61 | d.as.a......list.with.no.duplica |
| 5c8e0 | 74 65 73 2e 20 20 4e 6f 77 20 73 75 70 70 6f 73 65 20 77 65 20 61 6c 6c 6f 77 20 64 75 70 6c 69 | tes...Now.suppose.we.allow.dupli |
| 5c900 | 63 61 74 65 73 2e 20 20 46 6f 72 0a 20 20 20 20 20 69 6e 73 74 61 6e 63 65 2c 20 74 68 65 20 73 | cates...For......instance,.the.s |
| 5c920 | 65 74 20 7b 31 2c 32 2c 33 7d 20 63 6f 75 6c 64 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 | et.{1,2,3}.could.be.represented. |
| 5c940 | 61 73 20 74 68 65 20 6c 69 73 74 20 60 28 32 20 33 20 32 0a 20 20 20 20 20 31 20 33 20 32 20 32 | as.the.list.`(2.3.2......1.3.2.2 |
| 5c960 | 29 27 2e 20 20 44 65 73 69 67 6e 20 70 72 6f 63 65 64 75 72 65 73 20 60 65 6c 65 6d 65 6e 74 2d | )'...Design.procedures.`element- |
| 5c980 | 6f 66 2d 73 65 74 3f 27 2c 20 60 61 64 6a 6f 69 6e 2d 73 65 74 27 2c 0a 20 20 20 20 20 60 75 6e | of-set?',.`adjoin-set',......`un |
| 5c9a0 | 69 6f 6e 2d 73 65 74 27 2c 20 61 6e 64 20 60 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 27 | ion-set',.and.`intersection-set' |
| 5c9c0 | 20 74 68 61 74 20 6f 70 65 72 61 74 65 20 6f 6e 20 74 68 69 73 0a 20 20 20 20 20 72 65 70 72 65 | .that.operate.on.this......repre |
| 5c9e0 | 73 65 6e 74 61 74 69 6f 6e 2e 20 20 48 6f 77 20 64 6f 65 73 20 74 68 65 20 65 66 66 69 63 69 65 | sentation...How.does.the.efficie |
| 5ca00 | 6e 63 79 20 6f 66 20 65 61 63 68 20 63 6f 6d 70 61 72 65 20 77 69 74 68 20 74 68 65 0a 20 20 20 | ncy.of.each.compare.with.the.... |
| 5ca20 | 20 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 74 68 | ..corresponding.procedure.for.th |
| 5ca40 | 65 20 6e 6f 6e 2d 64 75 70 6c 69 63 61 74 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 3f 20 | e.non-duplicate.representation?. |
| 5ca60 | 20 41 72 65 0a 20 20 20 20 20 74 68 65 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 66 6f 72 | .Are......there.applications.for |
| 5ca80 | 20 77 68 69 63 68 20 79 6f 75 20 77 6f 75 6c 64 20 75 73 65 20 74 68 69 73 20 72 65 70 72 65 73 | .which.you.would.use.this.repres |
| 5caa0 | 65 6e 74 61 74 69 6f 6e 20 69 6e 0a 20 20 20 20 20 70 72 65 66 65 72 65 6e 63 65 20 74 6f 20 74 | entation.in......preference.to.t |
| 5cac0 | 68 65 20 6e 6f 6e 2d 64 75 70 6c 69 63 61 74 65 20 6f 6e 65 3f 0a 0a 53 65 74 73 20 61 73 20 6f | he.non-duplicate.one?..Sets.as.o |
| 5cae0 | 72 64 65 72 65 64 20 6c 69 73 74 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | rdered.lists.................... |
| 5cb00 | 2e 2e 0a 0a 4f 6e 65 20 77 61 79 20 74 6f 20 73 70 65 65 64 20 75 70 20 6f 75 72 20 73 65 74 20 | ....One.way.to.speed.up.our.set. |
| 5cb20 | 6f 70 65 72 61 74 69 6f 6e 73 20 69 73 20 74 6f 20 63 68 61 6e 67 65 20 74 68 65 20 72 65 70 72 | operations.is.to.change.the.repr |
| 5cb40 | 65 73 65 6e 74 61 74 69 6f 6e 0a 73 6f 20 74 68 61 74 20 74 68 65 20 73 65 74 20 65 6c 65 6d 65 | esentation.so.that.the.set.eleme |
| 5cb60 | 6e 74 73 20 61 72 65 20 6c 69 73 74 65 64 20 69 6e 20 69 6e 63 72 65 61 73 69 6e 67 20 6f 72 64 | nts.are.listed.in.increasing.ord |
| 5cb80 | 65 72 2e 20 20 54 6f 20 64 6f 20 74 68 69 73 2c 0a 77 65 20 6e 65 65 64 20 73 6f 6d 65 20 77 61 | er...To.do.this,.we.need.some.wa |
| 5cba0 | 79 20 74 6f 20 63 6f 6d 70 61 72 65 20 74 77 6f 20 6f 62 6a 65 63 74 73 20 73 6f 20 74 68 61 74 | y.to.compare.two.objects.so.that |
| 5cbc0 | 20 77 65 20 63 61 6e 20 73 61 79 20 77 68 69 63 68 20 69 73 0a 62 69 67 67 65 72 2e 20 20 46 6f | .we.can.say.which.is.bigger...Fo |
| 5cbe0 | 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 6f 75 6c 64 20 63 6f 6d 70 61 72 65 20 73 79 6d 62 | r.example,.we.could.compare.symb |
| 5cc00 | 6f 6c 73 20 6c 65 78 69 63 6f 67 72 61 70 68 69 63 61 6c 6c 79 2c 20 6f 72 20 77 65 0a 63 6f 75 | ols.lexicographically,.or.we.cou |
| 5cc20 | 6c 64 20 61 67 72 65 65 20 6f 6e 20 73 6f 6d 65 20 6d 65 74 68 6f 64 20 66 6f 72 20 61 73 73 69 | ld.agree.on.some.method.for.assi |
| 5cc40 | 67 6e 69 6e 67 20 61 20 75 6e 69 71 75 65 20 6e 75 6d 62 65 72 20 74 6f 20 61 6e 20 6f 62 6a 65 | gning.a.unique.number.to.an.obje |
| 5cc60 | 63 74 0a 61 6e 64 20 74 68 65 6e 20 63 6f 6d 70 61 72 65 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 | ct.and.then.compare.the.elements |
| 5cc80 | 20 62 79 20 63 6f 6d 70 61 72 69 6e 67 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 | .by.comparing.the.corresponding. |
| 5cca0 | 6e 75 6d 62 65 72 73 2e 0a 54 6f 20 6b 65 65 70 20 6f 75 72 20 64 69 73 63 75 73 73 69 6f 6e 20 | numbers..To.keep.our.discussion. |
| 5ccc0 | 73 69 6d 70 6c 65 2c 20 77 65 20 77 69 6c 6c 20 63 6f 6e 73 69 64 65 72 20 6f 6e 6c 79 20 74 68 | simple,.we.will.consider.only.th |
| 5cce0 | 65 20 63 61 73 65 20 77 68 65 72 65 20 74 68 65 0a 73 65 74 20 65 6c 65 6d 65 6e 74 73 20 61 72 | e.case.where.the.set.elements.ar |
| 5cd00 | 65 20 6e 75 6d 62 65 72 73 2c 20 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e 20 63 6f 6d 70 61 72 | e.numbers,.so.that.we.can.compar |
| 5cd20 | 65 20 65 6c 65 6d 65 6e 74 73 20 75 73 69 6e 67 20 60 3e 27 20 61 6e 64 0a 60 3c 27 2e 20 20 57 | e.elements.using.`>'.and.`<'...W |
| 5cd40 | 65 20 77 69 6c 6c 20 72 65 70 72 65 73 65 6e 74 20 61 20 73 65 74 20 6f 66 20 6e 75 6d 62 65 72 | e.will.represent.a.set.of.number |
| 5cd60 | 73 20 62 79 20 6c 69 73 74 69 6e 67 20 69 74 73 20 65 6c 65 6d 65 6e 74 73 20 69 6e 0a 69 6e 63 | s.by.listing.its.elements.in.inc |
| 5cd80 | 72 65 61 73 69 6e 67 20 6f 72 64 65 72 2e 20 20 57 68 65 72 65 61 73 20 6f 75 72 20 66 69 72 73 | reasing.order...Whereas.our.firs |
| 5cda0 | 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 61 62 6f 76 65 20 61 6c 6c 6f 77 65 64 20 75 | t.representation.above.allowed.u |
| 5cdc0 | 73 20 74 6f 0a 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 73 65 74 20 7b 31 2c 33 2c 36 2c 31 30 | s.to.represent.the.set.{1,3,6,10 |
| 5cde0 | 7d 20 62 79 20 6c 69 73 74 69 6e 67 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 61 6e 79 | }.by.listing.the.elements.in.any |
| 5ce00 | 20 6f 72 64 65 72 2c 20 6f 75 72 0a 6e 65 77 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 61 | .order,.our.new.representation.a |
| 5ce20 | 6c 6c 6f 77 73 20 6f 6e 6c 79 20 74 68 65 20 6c 69 73 74 20 60 28 31 20 33 20 36 20 31 30 29 27 | llows.only.the.list.`(1.3.6.10)' |
| 5ce40 | 2e 0a 0a 20 20 20 4f 6e 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 6f 72 64 65 72 69 6e 67 20 | ......One.advantage.of.ordering. |
| 5ce60 | 73 68 6f 77 73 20 75 70 20 69 6e 20 60 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 27 3a 20 49 | shows.up.in.`element-of-set?':.I |
| 5ce80 | 6e 20 63 68 65 63 6b 69 6e 67 0a 66 6f 72 20 74 68 65 20 70 72 65 73 65 6e 63 65 20 6f 66 20 61 | n.checking.for.the.presence.of.a |
| 5cea0 | 6e 20 69 74 65 6d 2c 20 77 65 20 6e 6f 20 6c 6f 6e 67 65 72 20 68 61 76 65 20 74 6f 20 73 63 61 | n.item,.we.no.longer.have.to.sca |
| 5cec0 | 6e 20 74 68 65 20 65 6e 74 69 72 65 20 73 65 74 2e 0a 49 66 20 77 65 20 72 65 61 63 68 20 61 20 | n.the.entire.set..If.we.reach.a. |
| 5cee0 | 73 65 74 20 65 6c 65 6d 65 6e 74 20 74 68 61 74 20 69 73 20 6c 61 72 67 65 72 20 74 68 61 6e 20 | set.element.that.is.larger.than. |
| 5cf00 | 74 68 65 20 69 74 65 6d 20 77 65 20 61 72 65 20 6c 6f 6f 6b 69 6e 67 0a 66 6f 72 2c 20 74 68 65 | the.item.we.are.looking.for,.the |
| 5cf20 | 6e 20 77 65 20 6b 6e 6f 77 20 74 68 61 74 20 74 68 65 20 69 74 65 6d 20 69 73 20 6e 6f 74 20 69 | n.we.know.that.the.item.is.not.i |
| 5cf40 | 6e 20 74 68 65 20 73 65 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6c 65 6d 65 6e | n.the.set:.......(define.(elemen |
| 5cf60 | 74 2d 6f 66 2d 73 65 74 3f 20 78 20 73 65 74 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 | t-of-set?.x.set)........(cond.(( |
| 5cf80 | 6e 75 6c 6c 3f 20 73 65 74 29 20 66 61 6c 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | null?.set).false)..............( |
| 5cfa0 | 28 3d 20 78 20 28 63 61 72 20 73 65 74 29 29 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 | (=.x.(car.set)).true)........... |
| 5cfc0 | 20 20 20 28 28 3c 20 78 20 28 63 61 72 20 73 65 74 29 29 20 66 61 6c 73 65 29 0a 20 20 20 20 20 | ...((<.x.(car.set)).false)...... |
| 5cfe0 | 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 78 | ........(else.(element-of-set?.x |
| 5d000 | 20 28 63 64 72 20 73 65 74 29 29 29 29 29 0a 0a 20 20 20 48 6f 77 20 6d 61 6e 79 20 73 74 65 70 | .(cdr.set))))).....How.many.step |
| 5d020 | 73 20 64 6f 65 73 20 74 68 69 73 20 73 61 76 65 3f 20 20 49 6e 20 74 68 65 20 77 6f 72 73 74 20 | s.does.this.save?..In.the.worst. |
| 5d040 | 63 61 73 65 2c 20 74 68 65 20 69 74 65 6d 20 77 65 20 61 72 65 0a 6c 6f 6f 6b 69 6e 67 20 66 6f | case,.the.item.we.are.looking.fo |
| 5d060 | 72 20 6d 61 79 20 62 65 20 74 68 65 20 6c 61 72 67 65 73 74 20 6f 6e 65 20 69 6e 20 74 68 65 20 | r.may.be.the.largest.one.in.the. |
| 5d080 | 73 65 74 2c 20 73 6f 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 0a 69 73 20 74 | set,.so.the.number.of.steps.is.t |
| 5d0a0 | 68 65 20 73 61 6d 65 20 61 73 20 66 6f 72 20 74 68 65 20 75 6e 6f 72 64 65 72 65 64 20 72 65 70 | he.same.as.for.the.unordered.rep |
| 5d0c0 | 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c | resentation...On.the.other.hand, |
| 5d0e0 | 20 69 66 0a 77 65 20 73 65 61 72 63 68 20 66 6f 72 20 69 74 65 6d 73 20 6f 66 20 6d 61 6e 79 20 | .if.we.search.for.items.of.many. |
| 5d100 | 64 69 66 66 65 72 65 6e 74 20 73 69 7a 65 73 20 77 65 20 63 61 6e 20 65 78 70 65 63 74 20 74 68 | different.sizes.we.can.expect.th |
| 5d120 | 61 74 0a 73 6f 6d 65 74 69 6d 65 73 20 77 65 20 77 69 6c 6c 20 62 65 20 61 62 6c 65 20 74 6f 20 | at.sometimes.we.will.be.able.to. |
| 5d140 | 73 74 6f 70 20 73 65 61 72 63 68 69 6e 67 20 61 74 20 61 20 70 6f 69 6e 74 20 6e 65 61 72 20 74 | stop.searching.at.a.point.near.t |
| 5d160 | 68 65 0a 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65 20 6c 69 73 74 20 61 6e 64 20 74 68 61 | he.beginning.of.the.list.and.tha |
| 5d180 | 74 20 6f 74 68 65 72 20 74 69 6d 65 73 20 77 65 20 77 69 6c 6c 20 73 74 69 6c 6c 20 6e 65 65 64 | t.other.times.we.will.still.need |
| 5d1a0 | 20 74 6f 0a 65 78 61 6d 69 6e 65 20 6d 6f 73 74 20 6f 66 20 74 68 65 20 6c 69 73 74 2e 20 20 4f | .to.examine.most.of.the.list...O |
| 5d1c0 | 6e 20 74 68 65 20 61 76 65 72 61 67 65 20 77 65 20 73 68 6f 75 6c 64 20 65 78 70 65 63 74 20 74 | n.the.average.we.should.expect.t |
| 5d1e0 | 6f 20 68 61 76 65 20 74 6f 0a 65 78 61 6d 69 6e 65 20 61 62 6f 75 74 20 68 61 6c 66 20 6f 66 20 | o.have.to.examine.about.half.of. |
| 5d200 | 74 68 65 20 69 74 65 6d 73 20 69 6e 20 74 68 65 20 73 65 74 2e 20 20 54 68 75 73 2c 20 74 68 65 | the.items.in.the.set...Thus,.the |
| 5d220 | 20 61 76 65 72 61 67 65 20 6e 75 6d 62 65 72 0a 6f 66 20 73 74 65 70 73 20 72 65 71 75 69 72 65 | .average.number.of.steps.require |
| 5d240 | 64 20 77 69 6c 6c 20 62 65 20 61 62 6f 75 74 20 6e 2f 32 2e 20 20 54 68 69 73 20 69 73 20 73 74 | d.will.be.about.n/2...This.is.st |
| 5d260 | 69 6c 6c 20 5b 74 68 65 74 61 5d 28 6e 29 20 67 72 6f 77 74 68 2c 0a 62 75 74 20 69 74 20 64 6f | ill.[theta](n).growth,.but.it.do |
| 5d280 | 65 73 20 73 61 76 65 20 75 73 2c 20 6f 6e 20 74 68 65 20 61 76 65 72 61 67 65 2c 20 61 20 66 61 | es.save.us,.on.the.average,.a.fa |
| 5d2a0 | 63 74 6f 72 20 6f 66 20 32 20 69 6e 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 0a 6f 76 65 | ctor.of.2.in.number.of.steps.ove |
| 5d2c0 | 72 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a 0a | r.the.previous.implementation... |
| 5d2e0 | 20 20 20 57 65 20 6f 62 74 61 69 6e 20 61 20 6d 6f 72 65 20 69 6d 70 72 65 73 73 69 76 65 20 73 | ...We.obtain.a.more.impressive.s |
| 5d300 | 70 65 65 64 75 70 20 77 69 74 68 20 60 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 27 2e 20 | peedup.with.`intersection-set'.. |
| 5d320 | 20 49 6e 20 74 68 65 0a 75 6e 6f 72 64 65 72 65 64 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e | .In.the.unordered.representation |
| 5d340 | 20 74 68 69 73 20 6f 70 65 72 61 74 69 6f 6e 20 72 65 71 75 69 72 65 64 20 5b 74 68 65 74 61 5d | .this.operation.required.[theta] |
| 5d360 | 28 6e 5e 32 29 20 73 74 65 70 73 2c 0a 62 65 63 61 75 73 65 20 77 65 20 70 65 72 66 6f 72 6d 65 | (n^2).steps,.because.we.performe |
| 5d380 | 64 20 61 20 63 6f 6d 70 6c 65 74 65 20 73 63 61 6e 20 6f 66 20 60 73 65 74 32 27 20 66 6f 72 20 | d.a.complete.scan.of.`set2'.for. |
| 5d3a0 | 65 61 63 68 20 65 6c 65 6d 65 6e 74 20 6f 66 0a 60 73 65 74 31 27 2e 20 20 42 75 74 20 77 69 74 | each.element.of.`set1'...But.wit |
| 5d3c0 | 68 20 74 68 65 20 6f 72 64 65 72 65 64 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c 20 77 65 | h.the.ordered.representation,.we |
| 5d3e0 | 20 63 61 6e 20 75 73 65 20 61 20 6d 6f 72 65 20 63 6c 65 76 65 72 0a 6d 65 74 68 6f 64 2e 20 20 | .can.use.a.more.clever.method... |
| 5d400 | 42 65 67 69 6e 20 62 79 20 63 6f 6d 70 61 72 69 6e 67 20 74 68 65 20 69 6e 69 74 69 61 6c 20 65 | Begin.by.comparing.the.initial.e |
| 5d420 | 6c 65 6d 65 6e 74 73 2c 20 60 78 31 27 20 61 6e 64 20 60 78 32 27 2c 20 6f 66 20 74 68 65 0a 74 | lements,.`x1'.and.`x2',.of.the.t |
| 5d440 | 77 6f 20 73 65 74 73 2e 20 20 49 66 20 60 78 31 27 20 65 71 75 61 6c 73 20 60 78 32 27 2c 20 74 | wo.sets...If.`x1'.equals.`x2',.t |
| 5d460 | 68 65 6e 20 74 68 61 74 20 67 69 76 65 73 20 61 6e 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 | hen.that.gives.an.element.of.the |
| 5d480 | 0a 69 6e 74 65 72 73 65 63 74 69 6f 6e 2c 20 61 6e 64 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 | .intersection,.and.the.rest.of.t |
| 5d4a0 | 68 65 20 69 6e 74 65 72 73 65 63 74 69 6f 6e 20 69 73 20 74 68 65 20 69 6e 74 65 72 73 65 63 74 | he.intersection.is.the.intersect |
| 5d4c0 | 69 6f 6e 20 6f 66 0a 74 68 65 20 60 63 64 72 27 73 20 6f 66 20 74 68 65 20 74 77 6f 20 73 65 74 | ion.of.the.`cdr's.of.the.two.set |
| 5d4e0 | 73 2e 20 20 53 75 70 70 6f 73 65 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 61 74 20 60 78 31 27 20 | s...Suppose,.however,.that.`x1'. |
| 5d500 | 69 73 20 6c 65 73 73 20 74 68 61 6e 0a 60 78 32 27 2e 20 20 53 69 6e 63 65 20 60 78 32 27 20 69 | is.less.than.`x2'...Since.`x2'.i |
| 5d520 | 73 20 74 68 65 20 73 6d 61 6c 6c 65 73 74 20 65 6c 65 6d 65 6e 74 20 69 6e 20 60 73 65 74 32 27 | s.the.smallest.element.in.`set2' |
| 5d540 | 2c 20 77 65 20 63 61 6e 20 69 6d 6d 65 64 69 61 74 65 6c 79 0a 63 6f 6e 63 6c 75 64 65 20 74 68 | ,.we.can.immediately.conclude.th |
| 5d560 | 61 74 20 60 78 31 27 20 63 61 6e 6e 6f 74 20 61 70 70 65 61 72 20 61 6e 79 77 68 65 72 65 20 69 | at.`x1'.cannot.appear.anywhere.i |
| 5d580 | 6e 20 60 73 65 74 32 27 20 61 6e 64 20 68 65 6e 63 65 20 69 73 20 6e 6f 74 20 69 6e 0a 74 68 65 | n.`set2'.and.hence.is.not.in.the |
| 5d5a0 | 20 69 6e 74 65 72 73 65 63 74 69 6f 6e 2e 20 20 48 65 6e 63 65 2c 20 74 68 65 20 69 6e 74 65 72 | .intersection...Hence,.the.inter |
| 5d5c0 | 73 65 63 74 69 6f 6e 20 69 73 20 65 71 75 61 6c 20 74 6f 20 74 68 65 20 69 6e 74 65 72 73 65 63 | section.is.equal.to.the.intersec |
| 5d5e0 | 74 69 6f 6e 0a 6f 66 20 60 73 65 74 32 27 20 77 69 74 68 20 74 68 65 20 60 63 64 72 27 20 6f 66 | tion.of.`set2'.with.the.`cdr'.of |
| 5d600 | 20 60 73 65 74 31 27 2e 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 69 66 20 60 78 32 27 20 69 73 20 | .`set1'...Similarly,.if.`x2'.is. |
| 5d620 | 6c 65 73 73 20 74 68 61 6e 0a 60 78 31 27 2c 20 74 68 65 6e 20 74 68 65 20 69 6e 74 65 72 73 65 | less.than.`x1',.then.the.interse |
| 5d640 | 63 74 69 6f 6e 20 69 73 20 67 69 76 65 6e 20 62 79 20 74 68 65 20 69 6e 74 65 72 73 65 63 74 69 | ction.is.given.by.the.intersecti |
| 5d660 | 6f 6e 20 6f 66 20 60 73 65 74 31 27 20 77 69 74 68 0a 74 68 65 20 60 63 64 72 27 20 6f 66 20 60 | on.of.`set1'.with.the.`cdr'.of.` |
| 5d680 | 73 65 74 32 27 2e 20 20 48 65 72 65 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a | set2'...Here.is.the.procedure:.. |
| 5d6a0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 20 73 | .....(define.(intersection-set.s |
| 5d6c0 | 65 74 31 20 73 65 74 32 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 | et1.set2)........(if.(or.(null?. |
| 5d6e0 | 73 65 74 31 29 20 28 6e 75 6c 6c 3f 20 73 65 74 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 | set1).(null?.set2))............' |
| 5d700 | 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 78 31 20 28 63 61 72 20 73 65 74 | ()............(let.((x1.(car.set |
| 5d720 | 31 29 29 20 28 78 32 20 28 63 61 72 20 73 65 74 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | 1)).(x2.(car.set2)))............ |
| 5d740 | 20 20 28 63 6f 6e 64 20 28 28 3d 20 78 31 20 78 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..(cond.((=.x1.x2).............. |
| 5d760 | 20 20 20 20 20 20 20 28 63 6f 6e 73 20 78 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......(cons.x1................. |
| 5d780 | 20 20 20 20 20 20 20 20 20 20 28 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 20 28 63 64 72 | ..........(intersection-set.(cdr |
| 5d7a0 | 20 73 65 74 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .set1).......................... |
| 5d7c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 73 65 74 32 29 29 29 29 | ...................(cdr.set2)))) |
| 5d7e0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3c 20 78 31 20 78 32 29 0a 20 | ....................((<.x1.x2).. |
| 5d800 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 6e 74 65 72 73 65 63 74 69 6f 6e | ...................(intersection |
| 5d820 | 2d 73 65 74 20 28 63 64 72 20 73 65 74 31 29 20 73 65 74 32 29 29 0a 20 20 20 20 20 20 20 20 20 | -set.(cdr.set1).set2)).......... |
| 5d840 | 20 20 20 20 20 20 20 20 20 20 28 28 3c 20 78 32 20 78 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ..........((<.x2.x1)............ |
| 5d860 | 20 20 20 20 20 20 20 20 20 28 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 20 73 65 74 31 20 | .........(intersection-set.set1. |
| 5d880 | 28 63 64 72 20 73 65 74 32 29 29 29 29 29 29 29 0a 0a 20 20 20 54 6f 20 65 73 74 69 6d 61 74 65 | (cdr.set2))))))).....To.estimate |
| 5d8a0 | 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 72 65 71 75 69 72 65 64 20 62 79 | .the.number.of.steps.required.by |
| 5d8c0 | 20 74 68 69 73 20 70 72 6f 63 65 73 73 2c 20 6f 62 73 65 72 76 65 0a 74 68 61 74 20 61 74 20 65 | .this.process,.observe.that.at.e |
| 5d8e0 | 61 63 68 20 73 74 65 70 20 77 65 20 72 65 64 75 63 65 20 74 68 65 20 69 6e 74 65 72 73 65 63 74 | ach.step.we.reduce.the.intersect |
| 5d900 | 69 6f 6e 20 70 72 6f 62 6c 65 6d 20 74 6f 20 63 6f 6d 70 75 74 69 6e 67 0a 69 6e 74 65 72 73 65 | ion.problem.to.computing.interse |
| 5d920 | 63 74 69 6f 6e 73 20 6f 66 20 73 6d 61 6c 6c 65 72 20 73 65 74 73 2d 2d 72 65 6d 6f 76 69 6e 67 | ctions.of.smaller.sets--removing |
| 5d940 | 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 66 72 6f 6d 20 60 73 65 74 31 27 0a 6f | .the.first.element.from.`set1'.o |
| 5d960 | 72 20 60 73 65 74 32 27 20 6f 72 20 62 6f 74 68 2e 20 20 54 68 75 73 2c 20 74 68 65 20 6e 75 6d | r.`set2'.or.both...Thus,.the.num |
| 5d980 | 62 65 72 20 6f 66 20 73 74 65 70 73 20 72 65 71 75 69 72 65 64 20 69 73 20 61 74 20 6d 6f 73 74 | ber.of.steps.required.is.at.most |
| 5d9a0 | 20 74 68 65 0a 73 75 6d 20 6f 66 20 74 68 65 20 73 69 7a 65 73 20 6f 66 20 60 73 65 74 31 27 20 | .the.sum.of.the.sizes.of.`set1'. |
| 5d9c0 | 61 6e 64 20 60 73 65 74 32 27 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 68 65 20 70 72 6f 64 | and.`set2',.rather.than.the.prod |
| 5d9e0 | 75 63 74 20 6f 66 20 74 68 65 0a 73 69 7a 65 73 20 61 73 20 77 69 74 68 20 74 68 65 20 75 6e 6f | uct.of.the.sizes.as.with.the.uno |
| 5da00 | 72 64 65 72 65 64 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 54 68 69 73 20 69 73 20 | rdered.representation...This.is. |
| 5da20 | 5b 74 68 65 74 61 5d 28 6e 29 20 67 72 6f 77 74 68 0a 72 61 74 68 65 72 20 74 68 61 6e 20 5b 74 | [theta](n).growth.rather.than.[t |
| 5da40 | 68 65 74 61 5d 28 6e 5e 32 29 2d 2d 61 20 63 6f 6e 73 69 64 65 72 61 62 6c 65 20 73 70 65 65 64 | heta](n^2)--a.considerable.speed |
| 5da60 | 75 70 2c 20 65 76 65 6e 20 66 6f 72 20 73 65 74 73 20 6f 66 0a 6d 6f 64 65 72 61 74 65 20 73 69 | up,.even.for.sets.of.moderate.si |
| 5da80 | 7a 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 36 31 3a 2a 20 47 69 76 65 20 | ze........*Exercise.2.61:*.Give. |
| 5daa0 | 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 60 61 64 6a 6f 69 6e 2d 73 65 74 | an.implementation.of.`adjoin-set |
| 5dac0 | 27 20 75 73 69 6e 67 20 74 68 65 0a 20 20 20 20 20 6f 72 64 65 72 65 64 20 72 65 70 72 65 73 65 | '.using.the......ordered.represe |
| 5dae0 | 6e 74 61 74 69 6f 6e 2e 20 20 42 79 20 61 6e 61 6c 6f 67 79 20 77 69 74 68 20 60 65 6c 65 6d 65 | ntation...By.analogy.with.`eleme |
| 5db00 | 6e 74 2d 6f 66 2d 73 65 74 3f 27 20 73 68 6f 77 0a 20 20 20 20 20 68 6f 77 20 74 6f 20 74 61 6b | nt-of-set?'.show......how.to.tak |
| 5db20 | 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 74 68 65 20 6f 72 64 65 72 69 6e 67 20 74 6f 20 70 | e.advantage.of.the.ordering.to.p |
| 5db40 | 72 6f 64 75 63 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 20 20 20 20 20 72 65 71 | roduce.a.procedure.that......req |
| 5db60 | 75 69 72 65 73 20 6f 6e 20 74 68 65 20 61 76 65 72 61 67 65 20 61 62 6f 75 74 20 68 61 6c 66 20 | uires.on.the.average.about.half. |
| 5db80 | 61 73 20 6d 61 6e 79 20 73 74 65 70 73 20 61 73 20 77 69 74 68 20 74 68 65 0a 20 20 20 20 20 75 | as.many.steps.as.with.the......u |
| 5dba0 | 6e 6f 72 64 65 72 65 64 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a | nordered.representation........* |
| 5dbc0 | 45 78 65 72 63 69 73 65 20 32 2e 36 32 3a 2a 20 47 69 76 65 20 61 20 5b 74 68 65 74 61 5d 28 6e | Exercise.2.62:*.Give.a.[theta](n |
| 5dbe0 | 29 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 60 75 6e 69 6f 6e 2d 73 65 74 27 0a | ).implementation.of.`union-set'. |
| 5dc00 | 20 20 20 20 20 66 6f 72 20 73 65 74 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 6f 72 64 | .....for.sets.represented.as.ord |
| 5dc20 | 65 72 65 64 20 6c 69 73 74 73 2e 0a 0a 53 65 74 73 20 61 73 20 62 69 6e 61 72 79 20 74 72 65 65 | ered.lists...Sets.as.binary.tree |
| 5dc40 | 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 20 63 61 6e 20 64 | s.......................We.can.d |
| 5dc60 | 6f 20 62 65 74 74 65 72 20 74 68 61 6e 20 74 68 65 20 6f 72 64 65 72 65 64 2d 6c 69 73 74 20 72 | o.better.than.the.ordered-list.r |
| 5dc80 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 62 79 20 61 72 72 61 6e 67 69 6e 67 20 74 68 65 0a 73 | epresentation.by.arranging.the.s |
| 5dca0 | 65 74 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 66 6f 72 6d 20 6f 66 20 61 20 74 72 65 | et.elements.in.the.form.of.a.tre |
| 5dcc0 | 65 2e 20 20 45 61 63 68 20 6e 6f 64 65 20 6f 66 20 74 68 65 20 74 72 65 65 20 68 6f 6c 64 73 20 | e...Each.node.of.the.tree.holds. |
| 5dce0 | 6f 6e 65 0a 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 73 65 74 2c 20 63 61 6c 6c 65 64 20 74 | one.element.of.the.set,.called.t |
| 5dd00 | 68 65 20 22 65 6e 74 72 79 22 20 61 74 20 74 68 61 74 20 6e 6f 64 65 2c 20 61 6e 64 20 61 20 6c | he."entry".at.that.node,.and.a.l |
| 5dd20 | 69 6e 6b 20 74 6f 20 65 61 63 68 0a 6f 66 20 74 77 6f 20 6f 74 68 65 72 20 28 70 6f 73 73 69 62 | ink.to.each.of.two.other.(possib |
| 5dd40 | 6c 79 20 65 6d 70 74 79 29 20 6e 6f 64 65 73 2e 20 20 54 68 65 20 22 6c 65 66 74 22 20 6c 69 6e | ly.empty).nodes...The."left".lin |
| 5dd60 | 6b 20 70 6f 69 6e 74 73 20 74 6f 0a 65 6c 65 6d 65 6e 74 73 20 73 6d 61 6c 6c 65 72 20 74 68 61 | k.points.to.elements.smaller.tha |
| 5dd80 | 6e 20 74 68 65 20 6f 6e 65 20 61 74 20 74 68 65 20 6e 6f 64 65 2c 20 61 6e 64 20 74 68 65 20 22 | n.the.one.at.the.node,.and.the." |
| 5dda0 | 72 69 67 68 74 22 20 6c 69 6e 6b 20 74 6f 0a 65 6c 65 6d 65 6e 74 73 20 67 72 65 61 74 65 72 20 | right".link.to.elements.greater. |
| 5ddc0 | 74 68 61 6e 20 74 68 65 20 6f 6e 65 20 61 74 20 74 68 65 20 6e 6f 64 65 2e 20 20 2a 4e 6f 74 65 | than.the.one.at.the.node...*Note |
| 5dde0 | 20 46 69 67 75 72 65 20 32 2d 31 36 3a 3a 20 73 68 6f 77 73 0a 73 6f 6d 65 20 74 72 65 65 73 20 | .Figure.2-16::.shows.some.trees. |
| 5de00 | 74 68 61 74 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 73 65 74 20 7b 31 2c 33 2c 35 2c 37 2c | that.represent.the.set.{1,3,5,7, |
| 5de20 | 39 2c 31 31 7d 2e 20 20 54 68 65 20 73 61 6d 65 20 73 65 74 20 6d 61 79 20 62 65 0a 72 65 70 72 | 9,11}...The.same.set.may.be.repr |
| 5de40 | 65 73 65 6e 74 65 64 20 62 79 20 61 20 74 72 65 65 20 69 6e 20 61 20 6e 75 6d 62 65 72 20 6f 66 | esented.by.a.tree.in.a.number.of |
| 5de60 | 20 64 69 66 66 65 72 65 6e 74 20 77 61 79 73 2e 20 20 54 68 65 20 6f 6e 6c 79 20 74 68 69 6e 67 | .different.ways...The.only.thing |
| 5de80 | 20 77 65 0a 72 65 71 75 69 72 65 20 66 6f 72 20 61 20 76 61 6c 69 64 20 72 65 70 72 65 73 65 6e | .we.require.for.a.valid.represen |
| 5dea0 | 74 61 74 69 6f 6e 20 69 73 20 74 68 61 74 20 61 6c 6c 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 | tation.is.that.all.elements.in.t |
| 5dec0 | 68 65 20 6c 65 66 74 0a 73 75 62 74 72 65 65 20 62 65 20 73 6d 61 6c 6c 65 72 20 74 68 61 6e 20 | he.left.subtree.be.smaller.than. |
| 5dee0 | 74 68 65 20 6e 6f 64 65 20 65 6e 74 72 79 20 61 6e 64 20 74 68 61 74 20 61 6c 6c 20 65 6c 65 6d | the.node.entry.and.that.all.elem |
| 5df00 | 65 6e 74 73 20 69 6e 20 74 68 65 0a 72 69 67 68 74 20 73 75 62 74 72 65 65 20 62 65 20 6c 61 72 | ents.in.the.right.subtree.be.lar |
| 5df20 | 67 65 72 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 31 36 3a 2a 20 56 61 72 69 6f 75 | ger........*Figure.2.16:*.Variou |
| 5df40 | 73 20 62 69 6e 61 72 79 20 74 72 65 65 73 20 74 68 61 74 20 72 65 70 72 65 73 65 6e 74 20 74 68 | s.binary.trees.that.represent.th |
| 5df60 | 65 20 73 65 74 0a 20 20 20 20 20 7b 31 2c 33 2c 35 2c 37 2c 39 2c 31 31 7d 2e 0a 0a 20 20 20 20 | e.set......{1,3,5,7,9,11}....... |
| 5df80 | 20 20 20 20 20 20 20 20 20 37 20 20 20 20 20 20 20 20 20 20 33 20 20 20 20 20 20 20 20 20 20 20 | .........7..........3........... |
| 5dfa0 | 20 20 35 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 5c 20 20 20 20 20 20 20 20 20 2f 5c 20 20 | ..5............../\........./\.. |
| 5dfc0 | 20 20 20 20 20 20 20 20 20 20 2f 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 33 20 20 39 20 20 20 | ........../\.............3..9... |
| 5dfe0 | 20 20 20 20 31 20 20 37 20 20 20 20 20 20 20 20 20 20 33 20 20 39 0a 20 20 20 20 20 20 20 20 20 | ....1..7..........3..9.......... |
| 5e000 | 20 20 2f 5c 20 20 20 5c 20 20 20 20 20 20 20 20 20 2f 5c 20 20 20 20 20 20 20 20 2f 20 20 20 2f | ../\...\........./\......../.../ |
| 5e020 | 5c 0a 20 20 20 20 20 20 20 20 20 20 31 20 20 35 20 20 31 31 20 20 20 20 20 20 20 35 20 20 39 20 | \...........1..5..11.......5..9. |
| 5e040 | 20 20 20 20 20 31 20 20 20 37 20 20 31 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....1...7..11.................. |
| 5e060 | 20 20 20 20 20 20 20 20 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............\................... |
| 5e080 | 20 20 20 20 20 20 20 20 20 20 20 31 31 0a 0a 20 20 20 54 68 65 20 61 64 76 61 6e 74 61 67 65 20 | ...........11.....The.advantage. |
| 5e0a0 | 6f 66 20 74 68 65 20 74 72 65 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 74 68 | of.the.tree.representation.is.th |
| 5e0c0 | 69 73 3a 20 53 75 70 70 6f 73 65 20 77 65 20 77 61 6e 74 20 74 6f 0a 63 68 65 63 6b 20 77 68 65 | is:.Suppose.we.want.to.check.whe |
| 5e0e0 | 74 68 65 72 20 61 20 6e 75 6d 62 65 72 20 78 20 69 73 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 20 | ther.a.number.x.is.contained.in. |
| 5e100 | 61 20 73 65 74 2e 20 20 57 65 20 62 65 67 69 6e 20 62 79 20 63 6f 6d 70 61 72 69 6e 67 0a 78 20 | a.set...We.begin.by.comparing.x. |
| 5e120 | 77 69 74 68 20 74 68 65 20 65 6e 74 72 79 20 69 6e 20 74 68 65 20 74 6f 70 20 6e 6f 64 65 2e 20 | with.the.entry.in.the.top.node.. |
| 5e140 | 20 49 66 20 78 20 69 73 20 6c 65 73 73 20 74 68 61 6e 20 74 68 69 73 2c 20 77 65 20 6b 6e 6f 77 | .If.x.is.less.than.this,.we.know |
| 5e160 | 20 74 68 61 74 0a 77 65 20 6e 65 65 64 20 6f 6e 6c 79 20 73 65 61 72 63 68 20 74 68 65 20 6c 65 | .that.we.need.only.search.the.le |
| 5e180 | 66 74 20 73 75 62 74 72 65 65 3b 20 69 66 20 78 20 69 73 20 67 72 65 61 74 65 72 2c 20 77 65 20 | ft.subtree;.if.x.is.greater,.we. |
| 5e1a0 | 6e 65 65 64 20 6f 6e 6c 79 0a 73 65 61 72 63 68 20 74 68 65 20 72 69 67 68 74 20 73 75 62 74 72 | need.only.search.the.right.subtr |
| 5e1c0 | 65 65 2e 20 20 4e 6f 77 2c 20 69 66 20 74 68 65 20 74 72 65 65 20 69 73 20 22 62 61 6c 61 6e 63 | ee...Now,.if.the.tree.is."balanc |
| 5e1e0 | 65 64 2c 22 20 65 61 63 68 20 6f 66 0a 74 68 65 73 65 20 73 75 62 74 72 65 65 73 20 77 69 6c 6c | ed,".each.of.these.subtrees.will |
| 5e200 | 20 62 65 20 61 62 6f 75 74 20 68 61 6c 66 20 74 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 6f | .be.about.half.the.size.of.the.o |
| 5e220 | 72 69 67 69 6e 61 6c 2e 20 20 54 68 75 73 2c 20 69 6e 0a 6f 6e 65 20 73 74 65 70 20 77 65 20 68 | riginal...Thus,.in.one.step.we.h |
| 5e240 | 61 76 65 20 72 65 64 75 63 65 64 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 73 65 61 72 63 | ave.reduced.the.problem.of.searc |
| 5e260 | 68 69 6e 67 20 61 20 74 72 65 65 20 6f 66 20 73 69 7a 65 20 6e 20 74 6f 0a 73 65 61 72 63 68 69 | hing.a.tree.of.size.n.to.searchi |
| 5e280 | 6e 67 20 61 20 74 72 65 65 20 6f 66 20 73 69 7a 65 20 6e 2f 32 2e 20 20 53 69 6e 63 65 20 74 68 | ng.a.tree.of.size.n/2...Since.th |
| 5e2a0 | 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 74 72 65 65 20 69 73 20 68 61 6c 76 65 64 20 61 74 0a | e.size.of.the.tree.is.halved.at. |
| 5e2c0 | 65 61 63 68 20 73 74 65 70 2c 20 77 65 20 73 68 6f 75 6c 64 20 65 78 70 65 63 74 20 74 68 61 74 | each.step,.we.should.expect.that |
| 5e2e0 | 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 6e 65 65 64 65 64 20 74 6f 20 73 | .the.number.of.steps.needed.to.s |
| 5e300 | 65 61 72 63 68 20 61 0a 74 72 65 65 20 6f 66 20 73 69 7a 65 20 6e 20 67 72 6f 77 73 20 61 73 20 | earch.a.tree.of.size.n.grows.as. |
| 5e320 | 5b 74 68 65 74 61 5d 28 60 6c 6f 67 27 20 6e 29 2e 28 32 29 20 46 6f 72 20 6c 61 72 67 65 20 73 | [theta](`log'.n).(2).For.large.s |
| 5e340 | 65 74 73 2c 20 74 68 69 73 20 77 69 6c 6c 0a 62 65 20 61 20 73 69 67 6e 69 66 69 63 61 6e 74 20 | ets,.this.will.be.a.significant. |
| 5e360 | 73 70 65 65 64 75 70 20 6f 76 65 72 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 72 65 70 72 65 73 | speedup.over.the.previous.repres |
| 5e380 | 65 6e 74 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 20 | entations......We.can.represent. |
| 5e3a0 | 74 72 65 65 73 20 62 79 20 75 73 69 6e 67 20 6c 69 73 74 73 2e 20 20 45 61 63 68 20 6e 6f 64 65 | trees.by.using.lists...Each.node |
| 5e3c0 | 20 77 69 6c 6c 20 62 65 20 61 20 6c 69 73 74 20 6f 66 0a 74 68 72 65 65 20 69 74 65 6d 73 3a 20 | .will.be.a.list.of.three.items:. |
| 5e3e0 | 74 68 65 20 65 6e 74 72 79 20 61 74 20 74 68 65 20 6e 6f 64 65 2c 20 74 68 65 20 6c 65 66 74 20 | the.entry.at.the.node,.the.left. |
| 5e400 | 73 75 62 74 72 65 65 2c 20 61 6e 64 20 74 68 65 20 72 69 67 68 74 0a 73 75 62 74 72 65 65 2e 20 | subtree,.and.the.right.subtree.. |
| 5e420 | 20 41 20 6c 65 66 74 20 6f 72 20 61 20 72 69 67 68 74 20 73 75 62 74 72 65 65 20 6f 66 20 74 68 | .A.left.or.a.right.subtree.of.th |
| 5e440 | 65 20 65 6d 70 74 79 20 6c 69 73 74 20 77 69 6c 6c 20 69 6e 64 69 63 61 74 65 0a 74 68 61 74 20 | e.empty.list.will.indicate.that. |
| 5e460 | 74 68 65 72 65 20 69 73 20 6e 6f 20 73 75 62 74 72 65 65 20 63 6f 6e 6e 65 63 74 65 64 20 74 68 | there.is.no.subtree.connected.th |
| 5e480 | 65 72 65 2e 20 20 57 65 20 63 61 6e 20 64 65 73 63 72 69 62 65 20 74 68 69 73 0a 72 65 70 72 65 | ere...We.can.describe.this.repre |
| 5e4a0 | 73 65 6e 74 61 74 69 6f 6e 20 62 79 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 | sentation.by.the.following.proce |
| 5e4c0 | 64 75 72 65 73 3a 28 33 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6e 74 72 79 20 74 | dures:(3).......(define.(entry.t |
| 5e4e0 | 72 65 65 29 20 28 63 61 72 20 74 72 65 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | ree).(car.tree)).......(define.( |
| 5e500 | 6c 65 66 74 2d 62 72 61 6e 63 68 20 74 72 65 65 29 20 28 63 61 64 72 20 74 72 65 65 29 29 0a 0a | left-branch.tree).(cadr.tree)).. |
| 5e520 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 69 67 68 74 2d 62 72 61 6e 63 68 20 74 72 65 65 29 | .....(define.(right-branch.tree) |
| 5e540 | 20 28 63 61 64 64 72 20 74 72 65 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 | .(caddr.tree)).......(define.(ma |
| 5e560 | 6b 65 2d 74 72 65 65 20 65 6e 74 72 79 20 6c 65 66 74 20 72 69 67 68 74 29 0a 20 20 20 20 20 20 | ke-tree.entry.left.right)....... |
| 5e580 | 20 28 6c 69 73 74 20 65 6e 74 72 79 20 6c 65 66 74 20 72 69 67 68 74 29 29 0a 0a 20 20 20 4e 6f | .(list.entry.left.right)).....No |
| 5e5a0 | 77 20 77 65 20 63 61 6e 20 77 72 69 74 65 20 74 68 65 20 60 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 | w.we.can.write.the.`element-of-s |
| 5e5c0 | 65 74 3f 27 20 70 72 6f 63 65 64 75 72 65 20 75 73 69 6e 67 20 74 68 65 20 73 74 72 61 74 65 67 | et?'.procedure.using.the.strateg |
| 5e5e0 | 79 0a 64 65 73 63 72 69 62 65 64 20 61 62 6f 76 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | y.described.above:.......(define |
| 5e600 | 20 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 78 20 73 65 74 29 0a 20 20 20 20 20 20 20 | .(element-of-set?.x.set)........ |
| 5e620 | 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 73 65 74 29 20 66 61 6c 73 65 29 0a 20 20 20 20 20 20 | (cond.((null?.set).false)....... |
| 5e640 | 20 20 20 20 20 20 20 28 28 3d 20 78 20 28 65 6e 74 72 79 20 73 65 74 29 29 20 74 72 75 65 29 0a | .......((=.x.(entry.set)).true). |
| 5e660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3c 20 78 20 28 65 6e 74 72 79 20 73 65 74 29 29 0a | .............((<.x.(entry.set)). |
| 5e680 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 78 | ..............(element-of-set?.x |
| 5e6a0 | 20 28 6c 65 66 74 2d 62 72 61 6e 63 68 20 73 65 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(left-branch.set)))............ |
| 5e6c0 | 20 20 28 28 3e 20 78 20 28 65 6e 74 72 79 20 73 65 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ..((>.x.(entry.set))............ |
| 5e6e0 | 20 20 20 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 78 20 28 72 69 67 68 74 2d 62 72 61 | ...(element-of-set?.x.(right-bra |
| 5e700 | 6e 63 68 20 73 65 74 29 29 29 29 29 0a 0a 20 20 20 41 64 6a 6f 69 6e 69 6e 67 20 61 6e 20 69 74 | nch.set))))).....Adjoining.an.it |
| 5e720 | 65 6d 20 74 6f 20 61 20 73 65 74 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 73 69 6d 69 6c | em.to.a.set.is.implemented.simil |
| 5e740 | 61 72 6c 79 20 61 6e 64 20 61 6c 73 6f 20 72 65 71 75 69 72 65 73 0a 5b 74 68 65 74 61 5d 28 60 | arly.and.also.requires.[theta](` |
| 5e760 | 6c 6f 67 27 20 6e 29 20 73 74 65 70 73 2e 20 20 54 6f 20 61 64 6a 6f 69 6e 20 61 6e 20 69 74 65 | log'.n).steps...To.adjoin.an.ite |
| 5e780 | 6d 20 60 78 27 2c 20 77 65 20 63 6f 6d 70 61 72 65 20 60 78 27 20 77 69 74 68 20 74 68 65 0a 6e | m.`x',.we.compare.`x'.with.the.n |
| 5e7a0 | 6f 64 65 20 65 6e 74 72 79 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68 65 74 68 65 72 20 60 | ode.entry.to.determine.whether.` |
| 5e7c0 | 78 27 20 73 68 6f 75 6c 64 20 62 65 20 61 64 64 65 64 20 74 6f 20 74 68 65 20 72 69 67 68 74 20 | x'.should.be.added.to.the.right. |
| 5e7e0 | 6f 72 20 74 6f 0a 74 68 65 20 6c 65 66 74 20 62 72 61 6e 63 68 2c 20 61 6e 64 20 68 61 76 69 6e | or.to.the.left.branch,.and.havin |
| 5e800 | 67 20 61 64 6a 6f 69 6e 65 64 20 60 78 27 20 74 6f 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 | g.adjoined.`x'.to.the.appropriat |
| 5e820 | 65 20 62 72 61 6e 63 68 20 77 65 0a 70 69 65 63 65 20 74 68 69 73 20 6e 65 77 6c 79 20 63 6f 6e | e.branch.we.piece.this.newly.con |
| 5e840 | 73 74 72 75 63 74 65 64 20 62 72 61 6e 63 68 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 | structed.branch.together.with.th |
| 5e860 | 65 20 6f 72 69 67 69 6e 61 6c 20 65 6e 74 72 79 0a 61 6e 64 20 74 68 65 20 6f 74 68 65 72 20 62 | e.original.entry.and.the.other.b |
| 5e880 | 72 61 6e 63 68 2e 20 20 49 66 20 60 78 27 20 69 73 20 65 71 75 61 6c 20 74 6f 20 74 68 65 20 65 | ranch...If.`x'.is.equal.to.the.e |
| 5e8a0 | 6e 74 72 79 2c 20 77 65 20 6a 75 73 74 20 72 65 74 75 72 6e 20 74 68 65 0a 6e 6f 64 65 2e 20 20 | ntry,.we.just.return.the.node... |
| 5e8c0 | 49 66 20 77 65 20 61 72 65 20 61 73 6b 65 64 20 74 6f 20 61 64 6a 6f 69 6e 20 60 78 27 20 74 6f | If.we.are.asked.to.adjoin.`x'.to |
| 5e8e0 | 20 61 6e 20 65 6d 70 74 79 20 74 72 65 65 2c 20 77 65 20 67 65 6e 65 72 61 74 65 20 61 0a 74 72 | .an.empty.tree,.we.generate.a.tr |
| 5e900 | 65 65 20 74 68 61 74 20 68 61 73 20 60 78 27 20 61 73 20 74 68 65 20 65 6e 74 72 79 20 61 6e 64 | ee.that.has.`x'.as.the.entry.and |
| 5e920 | 20 65 6d 70 74 79 20 72 69 67 68 74 20 61 6e 64 20 6c 65 66 74 20 62 72 61 6e 63 68 65 73 2e 20 | .empty.right.and.left.branches.. |
| 5e940 | 20 48 65 72 65 0a 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 | .Here.is.the.procedure:.......(d |
| 5e960 | 65 66 69 6e 65 20 28 61 64 6a 6f 69 6e 2d 73 65 74 20 78 20 73 65 74 29 0a 20 20 20 20 20 20 20 | efine.(adjoin-set.x.set)........ |
| 5e980 | 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 73 65 74 29 20 28 6d 61 6b 65 2d 74 72 65 65 20 78 20 | (cond.((null?.set).(make-tree.x. |
| 5e9a0 | 27 28 29 20 27 28 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 20 78 20 28 65 6e | '().'()))..............((=.x.(en |
| 5e9c0 | 74 72 79 20 73 65 74 29 29 20 73 65 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3c 20 | try.set)).set)..............((<. |
| 5e9e0 | 78 20 28 65 6e 74 72 79 20 73 65 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 | x.(entry.set))...............(ma |
| 5ea00 | 6b 65 2d 74 72 65 65 20 28 65 6e 74 72 79 20 73 65 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ke-tree.(entry.set)............. |
| 5ea20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d 73 65 74 20 78 20 28 6c 65 66 74 | .............(adjoin-set.x.(left |
| 5ea40 | 2d 62 72 61 6e 63 68 20 73 65 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -branch.set))................... |
| 5ea60 | 20 20 20 20 20 20 20 28 72 69 67 68 74 2d 62 72 61 6e 63 68 20 73 65 74 29 29 29 0a 20 20 20 20 | .......(right-branch.set)))..... |
| 5ea80 | 20 20 20 20 20 20 20 20 20 28 28 3e 20 78 20 28 65 6e 74 72 79 20 73 65 74 29 29 0a 20 20 20 20 | .........((>.x.(entry.set))..... |
| 5eaa0 | 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 74 72 65 65 20 28 65 6e 74 72 79 20 73 65 74 29 | ..........(make-tree.(entry.set) |
| 5eac0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 66 74 2d | ..........................(left- |
| 5eae0 | 62 72 61 6e 63 68 20 73 65 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | branch.set)..................... |
| 5eb00 | 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d 73 65 74 20 78 20 28 72 69 67 68 74 2d 62 72 61 6e 63 68 | .....(adjoin-set.x.(right-branch |
| 5eb20 | 20 73 65 74 29 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 61 62 6f 76 65 20 63 6c 61 69 6d 20 74 | .set)))))).....The.above.claim.t |
| 5eb40 | 68 61 74 20 73 65 61 72 63 68 69 6e 67 20 74 68 65 20 74 72 65 65 20 63 61 6e 20 62 65 20 70 65 | hat.searching.the.tree.can.be.pe |
| 5eb60 | 72 66 6f 72 6d 65 64 20 69 6e 20 61 0a 6c 6f 67 61 72 69 74 68 6d 69 63 20 6e 75 6d 62 65 72 20 | rformed.in.a.logarithmic.number. |
| 5eb80 | 6f 66 20 73 74 65 70 73 20 72 65 73 74 73 20 6f 6e 20 74 68 65 20 61 73 73 75 6d 70 74 69 6f 6e | of.steps.rests.on.the.assumption |
| 5eba0 | 20 74 68 61 74 20 74 68 65 20 74 72 65 65 20 69 73 0a 22 62 61 6c 61 6e 63 65 64 2c 22 20 69 2e | .that.the.tree.is."balanced,".i. |
| 5ebc0 | 65 2e 2c 20 74 68 61 74 20 74 68 65 20 6c 65 66 74 20 61 6e 64 20 74 68 65 20 72 69 67 68 74 20 | e.,.that.the.left.and.the.right. |
| 5ebe0 | 73 75 62 74 72 65 65 20 6f 66 20 65 76 65 72 79 20 74 72 65 65 0a 68 61 76 65 20 61 70 70 72 6f | subtree.of.every.tree.have.appro |
| 5ec00 | 78 69 6d 61 74 65 6c 79 20 74 68 65 20 73 61 6d 65 20 6e 75 6d 62 65 72 20 6f 66 20 65 6c 65 6d | ximately.the.same.number.of.elem |
| 5ec20 | 65 6e 74 73 2c 20 73 6f 20 74 68 61 74 20 65 61 63 68 20 73 75 62 74 72 65 65 0a 63 6f 6e 74 61 | ents,.so.that.each.subtree.conta |
| 5ec40 | 69 6e 73 20 61 62 6f 75 74 20 68 61 6c 66 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 69 | ins.about.half.the.elements.of.i |
| 5ec60 | 74 73 20 70 61 72 65 6e 74 2e 20 20 42 75 74 20 68 6f 77 20 63 61 6e 20 77 65 20 62 65 0a 63 65 | ts.parent...But.how.can.we.be.ce |
| 5ec80 | 72 74 61 69 6e 20 74 68 61 74 20 74 68 65 20 74 72 65 65 73 20 77 65 20 63 6f 6e 73 74 72 75 63 | rtain.that.the.trees.we.construc |
| 5eca0 | 74 20 77 69 6c 6c 20 62 65 20 62 61 6c 61 6e 63 65 64 3f 20 20 45 76 65 6e 20 69 66 20 77 65 20 | t.will.be.balanced?..Even.if.we. |
| 5ecc0 | 73 74 61 72 74 0a 77 69 74 68 20 61 20 62 61 6c 61 6e 63 65 64 20 74 72 65 65 2c 20 61 64 64 69 | start.with.a.balanced.tree,.addi |
| 5ece0 | 6e 67 20 65 6c 65 6d 65 6e 74 73 20 77 69 74 68 20 60 61 64 6a 6f 69 6e 2d 73 65 74 27 20 6d 61 | ng.elements.with.`adjoin-set'.ma |
| 5ed00 | 79 20 70 72 6f 64 75 63 65 20 61 6e 0a 75 6e 62 61 6c 61 6e 63 65 64 20 72 65 73 75 6c 74 2e 20 | y.produce.an.unbalanced.result.. |
| 5ed20 | 20 53 69 6e 63 65 20 74 68 65 20 70 6f 73 69 74 69 6f 6e 20 6f 66 20 61 20 6e 65 77 6c 79 20 61 | .Since.the.position.of.a.newly.a |
| 5ed40 | 64 6a 6f 69 6e 65 64 20 65 6c 65 6d 65 6e 74 0a 64 65 70 65 6e 64 73 20 6f 6e 20 68 6f 77 20 74 | djoined.element.depends.on.how.t |
| 5ed60 | 68 65 20 65 6c 65 6d 65 6e 74 20 63 6f 6d 70 61 72 65 73 20 77 69 74 68 20 74 68 65 20 69 74 65 | he.element.compares.with.the.ite |
| 5ed80 | 6d 73 20 61 6c 72 65 61 64 79 20 69 6e 20 74 68 65 20 73 65 74 2c 0a 77 65 20 63 61 6e 20 65 78 | ms.already.in.the.set,.we.can.ex |
| 5eda0 | 70 65 63 74 20 74 68 61 74 20 69 66 20 77 65 20 61 64 64 20 65 6c 65 6d 65 6e 74 73 20 22 72 61 | pect.that.if.we.add.elements."ra |
| 5edc0 | 6e 64 6f 6d 6c 79 22 20 74 68 65 20 74 72 65 65 20 77 69 6c 6c 20 74 65 6e 64 20 74 6f 0a 62 65 | ndomly".the.tree.will.tend.to.be |
| 5ede0 | 20 62 61 6c 61 6e 63 65 64 20 6f 6e 20 74 68 65 20 61 76 65 72 61 67 65 2e 20 20 42 75 74 20 74 | .balanced.on.the.average...But.t |
| 5ee00 | 68 69 73 20 69 73 20 6e 6f 74 20 61 20 67 75 61 72 61 6e 74 65 65 2e 20 20 46 6f 72 20 65 78 61 | his.is.not.a.guarantee...For.exa |
| 5ee20 | 6d 70 6c 65 2c 0a 69 66 20 77 65 20 73 74 61 72 74 20 77 69 74 68 20 61 6e 20 65 6d 70 74 79 20 | mple,.if.we.start.with.an.empty. |
| 5ee40 | 73 65 74 20 61 6e 64 20 61 64 6a 6f 69 6e 20 74 68 65 20 6e 75 6d 62 65 72 73 20 31 20 74 68 72 | set.and.adjoin.the.numbers.1.thr |
| 5ee60 | 6f 75 67 68 20 37 20 69 6e 0a 73 65 71 75 65 6e 63 65 20 77 65 20 65 6e 64 20 75 70 20 77 69 74 | ough.7.in.sequence.we.end.up.wit |
| 5ee80 | 68 20 74 68 65 20 68 69 67 68 6c 79 20 75 6e 62 61 6c 61 6e 63 65 64 20 74 72 65 65 20 73 68 6f | h.the.highly.unbalanced.tree.sho |
| 5eea0 | 77 6e 20 69 6e 20 2a 4e 6f 74 65 0a 46 69 67 75 72 65 20 32 2d 31 37 3a 3a 2e 20 20 49 6e 20 74 | wn.in.*Note.Figure.2-17::...In.t |
| 5eec0 | 68 69 73 20 74 72 65 65 20 61 6c 6c 20 74 68 65 20 6c 65 66 74 20 73 75 62 74 72 65 65 73 20 61 | his.tree.all.the.left.subtrees.a |
| 5eee0 | 72 65 20 65 6d 70 74 79 2c 20 73 6f 20 69 74 20 68 61 73 0a 6e 6f 20 61 64 76 61 6e 74 61 67 65 | re.empty,.so.it.has.no.advantage |
| 5ef00 | 20 6f 76 65 72 20 61 20 73 69 6d 70 6c 65 20 6f 72 64 65 72 65 64 20 6c 69 73 74 2e 20 20 4f 6e | .over.a.simple.ordered.list...On |
| 5ef20 | 65 20 77 61 79 20 74 6f 20 73 6f 6c 76 65 20 74 68 69 73 20 70 72 6f 62 6c 65 6d 0a 69 73 20 74 | e.way.to.solve.this.problem.is.t |
| 5ef40 | 6f 20 64 65 66 69 6e 65 20 61 6e 20 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 74 72 61 6e 73 | o.define.an.operation.that.trans |
| 5ef60 | 66 6f 72 6d 73 20 61 6e 20 61 72 62 69 74 72 61 72 79 20 74 72 65 65 20 69 6e 74 6f 20 61 0a 62 | forms.an.arbitrary.tree.into.a.b |
| 5ef80 | 61 6c 61 6e 63 65 64 20 74 72 65 65 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 65 6c 65 6d 65 | alanced.tree.with.the.same.eleme |
| 5efa0 | 6e 74 73 2e 20 20 54 68 65 6e 20 77 65 20 63 61 6e 20 70 65 72 66 6f 72 6d 20 74 68 69 73 0a 74 | nts...Then.we.can.perform.this.t |
| 5efc0 | 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 61 66 74 65 72 20 65 76 65 72 79 20 66 65 77 20 60 61 | ransformation.after.every.few.`a |
| 5efe0 | 64 6a 6f 69 6e 2d 73 65 74 27 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 6f 20 6b 65 65 70 20 6f 75 | djoin-set'.operations.to.keep.ou |
| 5f000 | 72 20 73 65 74 0a 69 6e 20 62 61 6c 61 6e 63 65 2e 20 20 54 68 65 72 65 20 61 72 65 20 61 6c 73 | r.set.in.balance...There.are.als |
| 5f020 | 6f 20 6f 74 68 65 72 20 77 61 79 73 20 74 6f 20 73 6f 6c 76 65 20 74 68 69 73 20 70 72 6f 62 6c | o.other.ways.to.solve.this.probl |
| 5f040 | 65 6d 2c 20 6d 6f 73 74 20 6f 66 0a 77 68 69 63 68 20 69 6e 76 6f 6c 76 65 20 64 65 73 69 67 6e | em,.most.of.which.involve.design |
| 5f060 | 69 6e 67 20 6e 65 77 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 66 6f 72 20 77 68 69 63 | ing.new.data.structures.for.whic |
| 5f080 | 68 20 73 65 61 72 63 68 69 6e 67 20 61 6e 64 0a 69 6e 73 65 72 74 69 6f 6e 20 62 6f 74 68 20 63 | h.searching.and.insertion.both.c |
| 5f0a0 | 61 6e 20 62 65 20 64 6f 6e 65 20 69 6e 20 5b 74 68 65 74 61 5d 28 60 6c 6f 67 27 20 6e 29 20 73 | an.be.done.in.[theta](`log'.n).s |
| 5f0c0 | 74 65 70 73 2e 28 34 29 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 31 37 3a 2a 20 55 6e | teps.(4).......*Figure.2.17:*.Un |
| 5f0e0 | 62 61 6c 61 6e 63 65 64 20 74 72 65 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 61 64 6a 6f 69 6e | balanced.tree.produced.by.adjoin |
| 5f100 | 69 6e 67 20 31 20 74 68 72 6f 75 67 68 20 37 0a 20 20 20 20 20 69 6e 20 73 65 71 75 65 6e 63 65 | ing.1.through.7......in.sequence |
| 5f120 | 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 5c 0a 20 20 20 20 | .............1............\..... |
| 5f140 | 20 20 20 20 20 20 20 20 32 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 0a 20 20 20 20 20 20 20 | ........2..............\........ |
| 5f160 | 20 20 20 20 20 20 20 34 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 0a 20 20 20 20 20 20 | .......4................\....... |
| 5f180 | 20 20 20 20 20 20 20 20 20 20 35 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 0a 20 | ..........5..................\.. |
| 5f1a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 36 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .................6.............. |
| 5f1c0 | 20 20 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 37 0a 0a 20 | ......\.....................7... |
| 5f1e0 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 36 33 3a 2a 20 45 61 63 68 20 6f 66 20 74 68 65 | ....*Exercise.2.63:*.Each.of.the |
| 5f200 | 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 20 63 6f 6e 76 65 72 | .following.two.procedures.conver |
| 5f220 | 74 73 20 61 0a 20 20 20 20 20 62 69 6e 61 72 79 20 74 72 65 65 20 74 6f 20 61 20 6c 69 73 74 2e | ts.a......binary.tree.to.a.list. |
| 5f240 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 65 65 2d 3e 6c 69 73 74 2d | ............(define.(tree->list- |
| 5f260 | 31 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 | 1.tree).............(if.(null?.t |
| 5f280 | 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 28 29 0a 20 20 20 20 20 20 20 | ree).................'()........ |
| 5f2a0 | 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 20 28 74 72 65 65 2d 3e 6c 69 73 74 2d 31 20 28 | .........(append.(tree->list-1.( |
| 5f2c0 | 6c 65 66 74 2d 62 72 61 6e 63 68 20 74 72 65 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | left-branch.tree)).............. |
| 5f2e0 | 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 65 6e 74 72 79 20 74 72 65 65 29 0a 20 20 | ...........(cons.(entry.tree)... |
| 5f300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 72 65 | ............................(tre |
| 5f320 | 65 2d 3e 6c 69 73 74 2d 31 20 28 72 69 67 68 74 2d 62 72 61 6e 63 68 20 74 72 65 65 29 29 29 29 | e->list-1.(right-branch.tree)))) |
| 5f340 | 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 65 65 2d 3e 6c 69 73 | ))............(define.(tree->lis |
| 5f360 | 74 2d 32 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 | t-2.tree).............(define.(c |
| 5f380 | 6f 70 79 2d 74 6f 2d 6c 69 73 74 20 74 72 65 65 20 72 65 73 75 6c 74 2d 6c 69 73 74 29 0a 20 20 | opy-to-list.tree.result-list)... |
| 5f3a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 72 65 65 29 0a 20 20 20 | ............(if.(null?.tree).... |
| 5f3c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 73 75 6c 74 2d 6c 69 73 74 0a 20 20 20 20 20 | ...............result-list...... |
| 5f3e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 70 79 2d 74 6f 2d 6c 69 73 74 20 28 6c 65 66 74 | .............(copy-to-list.(left |
| 5f400 | 2d 62 72 61 6e 63 68 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -branch.tree)................... |
| 5f420 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 65 6e 74 72 79 20 74 72 65 65 29 | ..............(cons.(entry.tree) |
| 5f440 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 5f460 | 20 20 20 20 20 20 20 28 63 6f 70 79 2d 74 6f 2d 6c 69 73 74 20 28 72 69 67 68 74 2d 62 72 61 6e | .......(copy-to-list.(right-bran |
| 5f480 | 63 68 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ch.tree)........................ |
| 5f4a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 73 | .............................res |
| 5f4c0 | 75 6c 74 2d 6c 69 73 74 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 70 79 2d | ult-list))))).............(copy- |
| 5f4e0 | 74 6f 2d 6c 69 73 74 20 74 72 65 65 20 27 28 29 29 29 0a 0a 20 20 20 20 20 20 20 61 2e 20 44 6f | to-list.tree.'())).........a..Do |
| 5f500 | 20 74 68 65 20 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 20 70 72 6f 64 75 63 65 20 74 68 65 20 | .the.two.procedures.produce.the. |
| 5f520 | 73 61 6d 65 20 72 65 73 75 6c 74 20 66 6f 72 20 65 76 65 72 79 20 74 72 65 65 3f 0a 20 20 20 20 | same.result.for.every.tree?..... |
| 5f540 | 20 20 20 20 20 20 49 66 20 6e 6f 74 2c 20 68 6f 77 20 64 6f 20 74 68 65 20 72 65 73 75 6c 74 73 | ......If.not,.how.do.the.results |
| 5f560 | 20 64 69 66 66 65 72 3f 20 20 57 68 61 74 20 6c 69 73 74 73 20 64 6f 20 74 68 65 20 74 77 6f 0a | .differ?..What.lists.do.the.two. |
| 5f580 | 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 73 20 70 72 6f 64 75 63 65 20 66 6f 72 | ..........procedures.produce.for |
| 5f5a0 | 20 74 68 65 20 74 72 65 65 73 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 36 3a | .the.trees.in.*Note.Figure.2-16: |
| 5f5c0 | 3a 3f 0a 0a 20 20 20 20 20 20 20 62 2e 20 44 6f 20 74 68 65 20 74 77 6f 20 70 72 6f 63 65 64 75 | :?.........b..Do.the.two.procedu |
| 5f5e0 | 72 65 73 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 6f 72 64 65 72 20 6f 66 20 67 72 6f 77 74 | res.have.the.same.order.of.growt |
| 5f600 | 68 20 69 6e 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 | h.in.the...........number.of.ste |
| 5f620 | 70 73 20 72 65 71 75 69 72 65 64 20 74 6f 20 63 6f 6e 76 65 72 74 20 61 20 62 61 6c 61 6e 63 65 | ps.required.to.convert.a.balance |
| 5f640 | 64 20 74 72 65 65 20 77 69 74 68 20 6e 0a 20 20 20 20 20 20 20 20 20 20 65 6c 65 6d 65 6e 74 73 | d.tree.with.n...........elements |
| 5f660 | 20 74 6f 20 61 20 6c 69 73 74 3f 20 20 49 66 20 6e 6f 74 2c 20 77 68 69 63 68 20 6f 6e 65 20 67 | .to.a.list?..If.not,.which.one.g |
| 5f680 | 72 6f 77 73 20 6d 6f 72 65 20 73 6c 6f 77 6c 79 3f 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | rows.more.slowly?........*Exerci |
| 5f6a0 | 73 65 20 32 2e 36 34 3a 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 | se.2.64:*.The.following.procedur |
| 5f6c0 | 65 20 60 6c 69 73 74 2d 3e 74 72 65 65 27 20 63 6f 6e 76 65 72 74 73 20 61 6e 0a 20 20 20 20 20 | e.`list->tree'.converts.an...... |
| 5f6e0 | 6f 72 64 65 72 65 64 20 6c 69 73 74 20 74 6f 20 61 20 62 61 6c 61 6e 63 65 64 20 62 69 6e 61 72 | ordered.list.to.a.balanced.binar |
| 5f700 | 79 20 74 72 65 65 2e 20 20 54 68 65 20 68 65 6c 70 65 72 20 70 72 6f 63 65 64 75 72 65 0a 20 20 | y.tree...The.helper.procedure... |
| 5f720 | 20 20 20 60 70 61 72 74 69 61 6c 2d 74 72 65 65 27 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d | ...`partial-tree'.takes.as.argum |
| 5f740 | 65 6e 74 73 20 61 6e 20 69 6e 74 65 67 65 72 20 6e 20 61 6e 64 20 6c 69 73 74 20 6f 66 20 61 74 | ents.an.integer.n.and.list.of.at |
| 5f760 | 0a 20 20 20 20 20 6c 65 61 73 74 20 6e 20 65 6c 65 6d 65 6e 74 73 20 61 6e 64 20 63 6f 6e 73 74 | ......least.n.elements.and.const |
| 5f780 | 72 75 63 74 73 20 61 20 62 61 6c 61 6e 63 65 64 20 74 72 65 65 20 63 6f 6e 74 61 69 6e 69 6e 67 | ructs.a.balanced.tree.containing |
| 5f7a0 | 20 74 68 65 0a 20 20 20 20 20 66 69 72 73 74 20 6e 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 | .the......first.n.elements.of.th |
| 5f7c0 | 65 20 6c 69 73 74 2e 20 20 54 68 65 20 72 65 73 75 6c 74 20 72 65 74 75 72 6e 65 64 20 62 79 0a | e.list...The.result.returned.by. |
| 5f7e0 | 20 20 20 20 20 60 70 61 72 74 69 61 6c 2d 74 72 65 65 27 20 69 73 20 61 20 70 61 69 72 20 28 66 | .....`partial-tree'.is.a.pair.(f |
| 5f800 | 6f 72 6d 65 64 20 77 69 74 68 20 60 63 6f 6e 73 27 29 20 77 68 6f 73 65 20 60 63 61 72 27 20 69 | ormed.with.`cons').whose.`car'.i |
| 5f820 | 73 20 74 68 65 0a 20 20 20 20 20 63 6f 6e 73 74 72 75 63 74 65 64 20 74 72 65 65 20 61 6e 64 20 | s.the......constructed.tree.and. |
| 5f840 | 77 68 6f 73 65 20 60 63 64 72 27 20 69 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20 65 6c 65 6d 65 | whose.`cdr'.is.the.list.of.eleme |
| 5f860 | 6e 74 73 20 6e 6f 74 0a 20 20 20 20 20 69 6e 63 6c 75 64 65 64 20 69 6e 20 74 68 65 20 74 72 65 | nts.not......included.in.the.tre |
| 5f880 | 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 69 73 74 2d 3e 74 72 65 | e.............(define.(list->tre |
| 5f8a0 | 65 20 65 6c 65 6d 65 6e 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 28 70 61 | e.elements).............(car.(pa |
| 5f8c0 | 72 74 69 61 6c 2d 74 72 65 65 20 65 6c 65 6d 65 6e 74 73 20 28 6c 65 6e 67 74 68 20 65 6c 65 6d | rtial-tree.elements.(length.elem |
| 5f8e0 | 65 6e 74 73 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 | ents))))............(define.(par |
| 5f900 | 74 69 61 6c 2d 74 72 65 65 20 65 6c 74 73 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 | tial-tree.elts.n).............(i |
| 5f920 | 66 20 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 | f.(=.n.0).................(cons. |
| 5f940 | 27 28 29 20 65 6c 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 | '().elts).................(let.( |
| 5f960 | 28 6c 65 66 74 2d 73 69 7a 65 20 28 71 75 6f 74 69 65 6e 74 20 28 2d 20 6e 20 31 29 20 32 29 29 | (left-size.(quotient.(-.n.1).2)) |
| 5f980 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6c 65 66 74 2d | )...................(let.((left- |
| 5f9a0 | 72 65 73 75 6c 74 20 28 70 61 72 74 69 61 6c 2d 74 72 65 65 20 65 6c 74 73 20 6c 65 66 74 2d 73 | result.(partial-tree.elts.left-s |
| 5f9c0 | 69 7a 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 | ize))).....................(let. |
| 5f9e0 | 28 28 6c 65 66 74 2d 74 72 65 65 20 28 63 61 72 20 6c 65 66 74 2d 72 65 73 75 6c 74 29 29 0a 20 | ((left-tree.(car.left-result)).. |
| 5fa00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 6f 6e 2d 6c 65 | .........................(non-le |
| 5fa20 | 66 74 2d 65 6c 74 73 20 28 63 64 72 20 6c 65 66 74 2d 72 65 73 75 6c 74 29 29 0a 20 20 20 20 20 | ft-elts.(cdr.left-result))...... |
| 5fa40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 69 67 68 74 2d 73 69 7a 65 | .....................(right-size |
| 5fa60 | 20 28 2d 20 6e 20 28 2b 20 6c 65 66 74 2d 73 69 7a 65 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 | .(-.n.(+.left-size.1))))........ |
| 5fa80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 68 69 73 2d 65 6e 74 72 79 | ...............(let.((this-entry |
| 5faa0 | 20 28 63 61 72 20 6e 6f 6e 2d 6c 65 66 74 2d 65 6c 74 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 | .(car.non-left-elts))........... |
| 5fac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 69 67 68 74 2d 72 65 73 75 6c 74 20 | ..................(right-result. |
| 5fae0 | 28 70 61 72 74 69 61 6c 2d 74 72 65 65 20 28 63 64 72 20 6e 6f 6e 2d 6c 65 66 74 2d 65 6c 74 73 | (partial-tree.(cdr.non-left-elts |
| 5fb00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | )............................... |
| 5fb20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 69 67 68 74 2d | ..........................right- |
| 5fb40 | 73 69 7a 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | size)))......................... |
| 5fb60 | 28 6c 65 74 20 28 28 72 69 67 68 74 2d 74 72 65 65 20 28 63 61 72 20 72 69 67 68 74 2d 72 65 73 | (let.((right-tree.(car.right-res |
| 5fb80 | 75 6c 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ult))........................... |
| 5fba0 | 20 20 20 20 28 72 65 6d 61 69 6e 69 6e 67 2d 65 6c 74 73 20 28 63 64 72 20 72 69 67 68 74 2d 72 | ....(remaining-elts.(cdr.right-r |
| 5fbc0 | 65 73 75 6c 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | esult)))........................ |
| 5fbe0 | 20 20 20 28 63 6f 6e 73 20 28 6d 61 6b 65 2d 74 72 65 65 20 74 68 69 73 2d 65 6e 74 72 79 20 6c | ...(cons.(make-tree.this-entry.l |
| 5fc00 | 65 66 74 2d 74 72 65 65 20 72 69 67 68 74 2d 74 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 | eft-tree.right-tree)............ |
| 5fc20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 2d 65 | .....................remaining-e |
| 5fc40 | 6c 74 73 29 29 29 29 29 29 29 29 0a 0a 20 20 20 20 20 20 20 61 2e 20 57 72 69 74 65 20 61 20 73 | lts)))))))).........a..Write.a.s |
| 5fc60 | 68 6f 72 74 20 70 61 72 61 67 72 61 70 68 20 65 78 70 6c 61 69 6e 69 6e 67 20 61 73 20 63 6c 65 | hort.paragraph.explaining.as.cle |
| 5fc80 | 61 72 6c 79 20 61 73 20 79 6f 75 20 63 61 6e 20 68 6f 77 0a 20 20 20 20 20 20 20 20 20 20 60 70 | arly.as.you.can.how...........`p |
| 5fca0 | 61 72 74 69 61 6c 2d 74 72 65 65 27 20 77 6f 72 6b 73 2e 20 20 44 72 61 77 20 74 68 65 20 74 72 | artial-tree'.works...Draw.the.tr |
| 5fcc0 | 65 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 60 6c 69 73 74 2d 3e 74 72 65 65 27 0a 20 20 20 20 | ee.produced.by.`list->tree'..... |
| 5fce0 | 20 20 20 20 20 20 66 6f 72 20 74 68 65 20 6c 69 73 74 20 60 28 31 20 33 20 35 20 37 20 39 20 31 | ......for.the.list.`(1.3.5.7.9.1 |
| 5fd00 | 31 29 27 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 57 68 61 74 20 69 73 20 74 68 65 20 6f 72 64 65 | 1)'..........b..What.is.the.orde |
| 5fd20 | 72 20 6f 66 20 67 72 6f 77 74 68 20 69 6e 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 | r.of.growth.in.the.number.of.ste |
| 5fd40 | 70 73 20 72 65 71 75 69 72 65 64 20 62 79 0a 20 20 20 20 20 20 20 20 20 20 60 6c 69 73 74 2d 3e | ps.required.by...........`list-> |
| 5fd60 | 74 72 65 65 27 20 74 6f 20 63 6f 6e 76 65 72 74 20 61 20 6c 69 73 74 20 6f 66 20 6e 20 65 6c 65 | tree'.to.convert.a.list.of.n.ele |
| 5fd80 | 6d 65 6e 74 73 3f 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 36 35 3a 2a 20 55 | ments?........*Exercise.2.65:*.U |
| 5fda0 | 73 65 20 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | se.the.results.of.*Note.Exercise |
| 5fdc0 | 20 32 2d 36 33 3a 3a 20 61 6e 64 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 | .2-63::.and......*Note.Exercise. |
| 5fde0 | 32 2d 36 34 3a 3a 20 74 6f 20 67 69 76 65 20 5b 74 68 65 74 61 5d 28 6e 29 20 69 6d 70 6c 65 6d | 2-64::.to.give.[theta](n).implem |
| 5fe00 | 65 6e 74 61 74 69 6f 6e 73 20 6f 66 0a 20 20 20 20 20 60 75 6e 69 6f 6e 2d 73 65 74 27 20 61 6e | entations.of......`union-set'.an |
| 5fe20 | 64 20 60 69 6e 74 65 72 73 65 63 74 69 6f 6e 2d 73 65 74 27 20 66 6f 72 20 73 65 74 73 20 69 6d | d.`intersection-set'.for.sets.im |
| 5fe40 | 70 6c 65 6d 65 6e 74 65 64 20 61 73 0a 20 20 20 20 20 28 62 61 6c 61 6e 63 65 64 29 20 62 69 6e | plemented.as......(balanced).bin |
| 5fe60 | 61 72 79 20 74 72 65 65 73 2e 28 35 29 0a 0a 53 65 74 73 20 61 6e 64 20 69 6e 66 6f 72 6d 61 74 | ary.trees.(5)..Sets.and.informat |
| 5fe80 | 69 6f 6e 20 72 65 74 72 69 65 76 61 6c 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ion.retrieval................... |
| 5fea0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 20 68 61 76 65 20 65 78 61 6d 69 6e 65 64 20 6f | ..............We.have.examined.o |
| 5fec0 | 70 74 69 6f 6e 73 20 66 6f 72 20 75 73 69 6e 67 20 6c 69 73 74 73 20 74 6f 20 72 65 70 72 65 73 | ptions.for.using.lists.to.repres |
| 5fee0 | 65 6e 74 20 73 65 74 73 20 61 6e 64 20 68 61 76 65 0a 73 65 65 6e 20 68 6f 77 20 74 68 65 20 63 | ent.sets.and.have.seen.how.the.c |
| 5ff00 | 68 6f 69 63 65 20 6f 66 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 61 20 64 61 | hoice.of.representation.for.a.da |
| 5ff20 | 74 61 20 6f 62 6a 65 63 74 20 63 61 6e 20 68 61 76 65 20 61 0a 6c 61 72 67 65 20 69 6d 70 61 63 | ta.object.can.have.a.large.impac |
| 5ff40 | 74 20 6f 6e 20 74 68 65 20 70 65 72 66 6f 72 6d 61 6e 63 65 20 6f 66 20 74 68 65 20 70 72 6f 67 | t.on.the.performance.of.the.prog |
| 5ff60 | 72 61 6d 73 20 74 68 61 74 20 75 73 65 20 74 68 65 20 64 61 74 61 2e 0a 41 6e 6f 74 68 65 72 20 | rams.that.use.the.data..Another. |
| 5ff80 | 72 65 61 73 6f 6e 20 66 6f 72 20 63 6f 6e 63 65 6e 74 72 61 74 69 6e 67 20 6f 6e 20 73 65 74 73 | reason.for.concentrating.on.sets |
| 5ffa0 | 20 69 73 20 74 68 61 74 20 74 68 65 20 74 65 63 68 6e 69 71 75 65 73 0a 64 69 73 63 75 73 73 65 | .is.that.the.techniques.discusse |
| 5ffc0 | 64 20 68 65 72 65 20 61 70 70 65 61 72 20 61 67 61 69 6e 20 61 6e 64 20 61 67 61 69 6e 20 69 6e | d.here.appear.again.and.again.in |
| 5ffe0 | 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 69 6e 76 6f 6c 76 69 6e 67 0a 69 6e 66 6f 72 6d 61 74 | .applications.involving.informat |
| 60000 | 69 6f 6e 20 72 65 74 72 69 65 76 61 6c 2e 0a 0a 20 20 20 43 6f 6e 73 69 64 65 72 20 61 20 64 61 | ion.retrieval......Consider.a.da |
| 60020 | 74 61 20 62 61 73 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 20 6c 61 72 67 65 20 6e 75 6d 62 65 | ta.base.containing.a.large.numbe |
| 60040 | 72 20 6f 66 20 69 6e 64 69 76 69 64 75 61 6c 0a 72 65 63 6f 72 64 73 2c 20 73 75 63 68 20 61 73 | r.of.individual.records,.such.as |
| 60060 | 20 74 68 65 20 70 65 72 73 6f 6e 6e 65 6c 20 66 69 6c 65 73 20 66 6f 72 20 61 20 63 6f 6d 70 61 | .the.personnel.files.for.a.compa |
| 60080 | 6e 79 20 6f 72 20 74 68 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 0a 69 6e 20 61 6e 20 61 63 63 | ny.or.the.transactions.in.an.acc |
| 600a0 | 6f 75 6e 74 69 6e 67 20 73 79 73 74 65 6d 2e 20 20 41 20 74 79 70 69 63 61 6c 20 64 61 74 61 2d | ounting.system...A.typical.data- |
| 600c0 | 6d 61 6e 61 67 65 6d 65 6e 74 20 73 79 73 74 65 6d 20 73 70 65 6e 64 73 20 61 0a 6c 61 72 67 65 | management.system.spends.a.large |
| 600e0 | 20 61 6d 6f 75 6e 74 20 6f 66 20 74 69 6d 65 20 61 63 63 65 73 73 69 6e 67 20 6f 72 20 6d 6f 64 | .amount.of.time.accessing.or.mod |
| 60100 | 69 66 79 69 6e 67 20 74 68 65 20 64 61 74 61 20 69 6e 20 74 68 65 20 72 65 63 6f 72 64 73 20 61 | ifying.the.data.in.the.records.a |
| 60120 | 6e 64 0a 74 68 65 72 65 66 6f 72 65 20 72 65 71 75 69 72 65 73 20 61 6e 20 65 66 66 69 63 69 65 | nd.therefore.requires.an.efficie |
| 60140 | 6e 74 20 6d 65 74 68 6f 64 20 66 6f 72 20 61 63 63 65 73 73 69 6e 67 20 72 65 63 6f 72 64 73 2e | nt.method.for.accessing.records. |
| 60160 | 20 20 54 68 69 73 20 69 73 0a 64 6f 6e 65 20 62 79 20 69 64 65 6e 74 69 66 79 69 6e 67 20 61 20 | ..This.is.done.by.identifying.a. |
| 60180 | 70 61 72 74 20 6f 66 20 65 61 63 68 20 72 65 63 6f 72 64 20 74 6f 20 73 65 72 76 65 20 61 73 20 | part.of.each.record.to.serve.as. |
| 601a0 | 61 6e 20 69 64 65 6e 74 69 66 79 69 6e 67 20 22 6b 65 79 22 2e 0a 41 20 6b 65 79 20 63 61 6e 20 | an.identifying."key"..A.key.can. |
| 601c0 | 62 65 20 61 6e 79 74 68 69 6e 67 20 74 68 61 74 20 75 6e 69 71 75 65 6c 79 20 69 64 65 6e 74 69 | be.anything.that.uniquely.identi |
| 601e0 | 66 69 65 73 20 74 68 65 20 72 65 63 6f 72 64 2e 20 20 46 6f 72 20 61 0a 70 65 72 73 6f 6e 6e 65 | fies.the.record...For.a.personne |
| 60200 | 6c 20 66 69 6c 65 2c 20 69 74 20 6d 69 67 68 74 20 62 65 20 61 6e 20 65 6d 70 6c 6f 79 65 65 27 | l.file,.it.might.be.an.employee' |
| 60220 | 73 20 49 44 20 6e 75 6d 62 65 72 2e 20 20 46 6f 72 20 61 6e 20 61 63 63 6f 75 6e 74 69 6e 67 0a | s.ID.number...For.an.accounting. |
| 60240 | 73 79 73 74 65 6d 2c 20 69 74 20 6d 69 67 68 74 20 62 65 20 61 20 74 72 61 6e 73 61 63 74 69 6f | system,.it.might.be.a.transactio |
| 60260 | 6e 20 6e 75 6d 62 65 72 2e 20 20 57 68 61 74 65 76 65 72 20 74 68 65 20 6b 65 79 20 69 73 2c 20 | n.number...Whatever.the.key.is,. |
| 60280 | 77 68 65 6e 20 77 65 0a 64 65 66 69 6e 65 20 74 68 65 20 72 65 63 6f 72 64 20 61 73 20 61 20 64 | when.we.define.the.record.as.a.d |
| 602a0 | 61 74 61 20 73 74 72 75 63 74 75 72 65 20 77 65 20 73 68 6f 75 6c 64 20 69 6e 63 6c 75 64 65 20 | ata.structure.we.should.include. |
| 602c0 | 61 20 60 6b 65 79 27 0a 73 65 6c 65 63 74 6f 72 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 | a.`key'.selector.procedure.that. |
| 602e0 | 72 65 74 72 69 65 76 65 73 20 74 68 65 20 6b 65 79 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 | retrieves.the.key.associated.wit |
| 60300 | 68 20 61 20 67 69 76 65 6e 0a 72 65 63 6f 72 64 2e 0a 0a 20 20 20 4e 6f 77 20 77 65 20 72 65 70 | h.a.given.record......Now.we.rep |
| 60320 | 72 65 73 65 6e 74 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 61 73 20 61 20 73 65 74 20 6f 66 | resent.the.data.base.as.a.set.of |
| 60340 | 20 72 65 63 6f 72 64 73 2e 20 54 6f 20 6c 6f 63 61 74 65 20 74 68 65 0a 72 65 63 6f 72 64 20 77 | .records..To.locate.the.record.w |
| 60360 | 69 74 68 20 61 20 67 69 76 65 6e 20 6b 65 79 20 77 65 20 75 73 65 20 61 20 70 72 6f 63 65 64 75 | ith.a.given.key.we.use.a.procedu |
| 60380 | 72 65 20 60 6c 6f 6f 6b 75 70 27 2c 20 77 68 69 63 68 20 74 61 6b 65 73 20 61 73 0a 61 72 67 75 | re.`lookup',.which.takes.as.argu |
| 603a0 | 6d 65 6e 74 73 20 61 20 6b 65 79 20 61 6e 64 20 61 20 64 61 74 61 20 62 61 73 65 20 61 6e 64 20 | ments.a.key.and.a.data.base.and. |
| 603c0 | 77 68 69 63 68 20 72 65 74 75 72 6e 73 20 74 68 65 20 72 65 63 6f 72 64 20 74 68 61 74 20 68 61 | which.returns.the.record.that.ha |
| 603e0 | 73 0a 74 68 61 74 20 6b 65 79 2c 20 6f 72 20 66 61 6c 73 65 20 69 66 20 74 68 65 72 65 20 69 73 | s.that.key,.or.false.if.there.is |
| 60400 | 20 6e 6f 20 73 75 63 68 20 72 65 63 6f 72 64 2e 20 20 60 4c 6f 6f 6b 75 70 27 20 69 73 20 69 6d | .no.such.record...`Lookup'.is.im |
| 60420 | 70 6c 65 6d 65 6e 74 65 64 0a 69 6e 20 61 6c 6d 6f 73 74 20 74 68 65 20 73 61 6d 65 20 77 61 79 | plemented.in.almost.the.same.way |
| 60440 | 20 61 73 20 60 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 27 2e 20 20 46 6f 72 20 65 78 61 6d | .as.`element-of-set?'...For.exam |
| 60460 | 70 6c 65 2c 20 69 66 20 74 68 65 20 73 65 74 0a 6f 66 20 72 65 63 6f 72 64 73 20 69 73 20 69 6d | ple,.if.the.set.of.records.is.im |
| 60480 | 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 61 6e 20 75 6e 6f 72 64 65 72 65 64 20 6c 69 73 74 2c 20 | plemented.as.an.unordered.list,. |
| 604a0 | 77 65 20 63 6f 75 6c 64 20 75 73 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 6b | we.could.use.......(define.(look |
| 604c0 | 75 70 20 67 69 76 65 6e 2d 6b 65 79 20 73 65 74 2d 6f 66 2d 72 65 63 6f 72 64 73 29 0a 20 20 20 | up.given-key.set-of-records).... |
| 604e0 | 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 73 65 74 2d 6f 66 2d 72 65 63 6f 72 64 73 | ....(cond.((null?.set-of-records |
| 60500 | 29 20 66 61 6c 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 75 61 6c 3f 20 67 | ).false)..............((equal?.g |
| 60520 | 69 76 65 6e 2d 6b 65 79 20 28 6b 65 79 20 28 63 61 72 20 73 65 74 2d 6f 66 2d 72 65 63 6f 72 64 | iven-key.(key.(car.set-of-record |
| 60540 | 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 73 65 74 2d 6f 66 2d 72 | s)))...............(car.set-of-r |
| 60560 | 65 63 6f 72 64 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 6c 6f 6f | ecords))..............(else.(loo |
| 60580 | 6b 75 70 20 67 69 76 65 6e 2d 6b 65 79 20 28 63 64 72 20 73 65 74 2d 6f 66 2d 72 65 63 6f 72 64 | kup.given-key.(cdr.set-of-record |
| 605a0 | 73 29 29 29 29 29 0a 0a 20 20 20 4f 66 20 63 6f 75 72 73 65 2c 20 74 68 65 72 65 20 61 72 65 20 | s))))).....Of.course,.there.are. |
| 605c0 | 62 65 74 74 65 72 20 77 61 79 73 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 6c 61 72 67 65 20 73 | better.ways.to.represent.large.s |
| 605e0 | 65 74 73 20 74 68 61 6e 20 61 73 0a 75 6e 6f 72 64 65 72 65 64 20 6c 69 73 74 73 2e 20 20 49 6e | ets.than.as.unordered.lists...In |
| 60600 | 66 6f 72 6d 61 74 69 6f 6e 2d 72 65 74 72 69 65 76 61 6c 20 73 79 73 74 65 6d 73 20 69 6e 20 77 | formation-retrieval.systems.in.w |
| 60620 | 68 69 63 68 20 72 65 63 6f 72 64 73 20 68 61 76 65 0a 74 6f 20 62 65 20 22 72 61 6e 64 6f 6d 6c | hich.records.have.to.be."randoml |
| 60640 | 79 20 61 63 63 65 73 73 65 64 22 20 61 72 65 20 74 79 70 69 63 61 6c 6c 79 20 69 6d 70 6c 65 6d | y.accessed".are.typically.implem |
| 60660 | 65 6e 74 65 64 20 62 79 20 61 20 74 72 65 65 2d 62 61 73 65 64 0a 6d 65 74 68 6f 64 2c 20 73 75 | ented.by.a.tree-based.method,.su |
| 60680 | 63 68 20 61 73 20 74 68 65 20 62 69 6e 61 72 79 2d 74 72 65 65 20 72 65 70 72 65 73 65 6e 74 61 | ch.as.the.binary-tree.representa |
| 606a0 | 74 69 6f 6e 20 64 69 73 63 75 73 73 65 64 20 70 72 65 76 69 6f 75 73 6c 79 2e 0a 49 6e 20 64 65 | tion.discussed.previously..In.de |
| 606c0 | 73 69 67 6e 69 6e 67 20 73 75 63 68 20 61 20 73 79 73 74 65 6d 20 74 68 65 20 6d 65 74 68 6f 64 | signing.such.a.system.the.method |
| 606e0 | 6f 6c 6f 67 79 20 6f 66 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 63 61 6e 20 62 65 | ology.of.data.abstraction.can.be |
| 60700 | 20 61 0a 67 72 65 61 74 20 68 65 6c 70 2e 20 20 54 68 65 20 64 65 73 69 67 6e 65 72 20 63 61 6e | .a.great.help...The.designer.can |
| 60720 | 20 63 72 65 61 74 65 20 61 6e 20 69 6e 69 74 69 61 6c 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | .create.an.initial.implementatio |
| 60740 | 6e 20 75 73 69 6e 67 20 61 0a 73 69 6d 70 6c 65 2c 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 | n.using.a.simple,.straightforwar |
| 60760 | 64 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 73 75 63 68 20 61 73 20 75 6e 6f 72 64 65 72 | d.representation.such.as.unorder |
| 60780 | 65 64 20 6c 69 73 74 73 2e 20 20 54 68 69 73 0a 77 69 6c 6c 20 62 65 20 75 6e 73 75 69 74 61 62 | ed.lists...This.will.be.unsuitab |
| 607a0 | 6c 65 20 66 6f 72 20 74 68 65 20 65 76 65 6e 74 75 61 6c 20 73 79 73 74 65 6d 2c 20 62 75 74 20 | le.for.the.eventual.system,.but. |
| 607c0 | 69 74 20 63 61 6e 20 62 65 20 75 73 65 66 75 6c 20 69 6e 0a 70 72 6f 76 69 64 69 6e 67 20 61 20 | it.can.be.useful.in.providing.a. |
| 607e0 | 22 71 75 69 63 6b 20 61 6e 64 20 64 69 72 74 79 22 20 64 61 74 61 20 62 61 73 65 20 77 69 74 68 | "quick.and.dirty".data.base.with |
| 60800 | 20 77 68 69 63 68 20 74 6f 20 74 65 73 74 20 74 68 65 20 72 65 73 74 20 6f 66 0a 74 68 65 20 73 | .which.to.test.the.rest.of.the.s |
| 60820 | 79 73 74 65 6d 2e 20 20 4c 61 74 65 72 20 6f 6e 2c 20 74 68 65 20 64 61 74 61 20 72 65 70 72 65 | ystem...Later.on,.the.data.repre |
| 60840 | 73 65 6e 74 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 6d 6f 64 69 66 69 65 64 20 74 6f 20 62 65 0a | sentation.can.be.modified.to.be. |
| 60860 | 6d 6f 72 65 20 73 6f 70 68 69 73 74 69 63 61 74 65 64 2e 20 20 49 66 20 74 68 65 20 64 61 74 61 | more.sophisticated...If.the.data |
| 60880 | 20 62 61 73 65 20 69 73 20 61 63 63 65 73 73 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 61 62 | .base.is.accessed.in.terms.of.ab |
| 608a0 | 73 74 72 61 63 74 0a 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 6f 72 | stract.selectors.and.constructor |
| 608c0 | 73 2c 20 74 68 69 73 20 63 68 61 6e 67 65 20 69 6e 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e | s,.this.change.in.representation |
| 608e0 | 20 77 69 6c 6c 20 6e 6f 74 0a 72 65 71 75 69 72 65 20 61 6e 79 20 63 68 61 6e 67 65 73 20 74 6f | .will.not.require.any.changes.to |
| 60900 | 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 2e 0a 0a 20 20 20 20 20 2a | .the.rest.of.the.system........* |
| 60920 | 45 78 65 72 63 69 73 65 20 32 2e 36 36 3a 2a 20 49 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 60 6c | Exercise.2.66:*.Implement.the.`l |
| 60940 | 6f 6f 6b 75 70 27 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 74 68 65 20 63 61 73 65 0a 20 20 | ookup'.procedure.for.the.case... |
| 60960 | 20 20 20 77 68 65 72 65 20 74 68 65 20 73 65 74 20 6f 66 20 72 65 63 6f 72 64 73 20 69 73 20 73 | ...where.the.set.of.records.is.s |
| 60980 | 74 72 75 63 74 75 72 65 64 20 61 73 20 61 20 62 69 6e 61 72 79 20 74 72 65 65 2c 20 6f 72 64 65 | tructured.as.a.binary.tree,.orde |
| 609a0 | 72 65 64 0a 20 20 20 20 20 62 79 20 74 68 65 20 6e 75 6d 65 72 69 63 61 6c 20 76 61 6c 75 65 73 | red......by.the.numerical.values |
| 609c0 | 20 6f 66 20 74 68 65 20 6b 65 79 73 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f | .of.the.keys......----------.Foo |
| 609e0 | 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 66 20 77 65 20 | tnotes.----------.....(1).If.we. |
| 60a00 | 77 61 6e 74 20 74 6f 20 62 65 20 6d 6f 72 65 20 66 6f 72 6d 61 6c 2c 20 77 65 20 63 61 6e 20 73 | want.to.be.more.formal,.we.can.s |
| 60a20 | 70 65 63 69 66 79 20 22 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 0a 74 68 65 20 69 6e 74 65 | pecify."consistent.with.the.inte |
| 60a40 | 72 70 72 65 74 61 74 69 6f 6e 73 20 67 69 76 65 6e 20 61 62 6f 76 65 22 20 74 6f 20 6d 65 61 6e | rpretations.given.above".to.mean |
| 60a60 | 20 74 68 61 74 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 73 61 74 69 73 66 79 20 61 0a 63 | .that.the.operations.satisfy.a.c |
| 60a80 | 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 72 75 6c 65 73 20 73 75 63 68 20 61 73 20 74 68 65 73 65 | ollection.of.rules.such.as.these |
| 60aa0 | 3a 0a 0a 20 20 20 2a 20 46 6f 72 20 61 6e 79 20 73 65 74 20 60 53 27 20 61 6e 64 20 61 6e 79 20 | :.....*.For.any.set.`S'.and.any. |
| 60ac0 | 6f 62 6a 65 63 74 20 60 78 27 2c 20 60 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 78 0a | object.`x',.`(element-of-set?.x. |
| 60ae0 | 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d 73 65 74 20 78 20 53 29 29 27 20 69 73 20 74 72 75 65 20 | .....(adjoin-set.x.S))'.is.true. |
| 60b00 | 28 69 6e 66 6f 72 6d 61 6c 6c 79 3a 20 22 41 64 6a 6f 69 6e 69 6e 67 20 61 6e 20 6f 62 6a 65 63 | (informally:."Adjoining.an.objec |
| 60b20 | 74 20 74 6f 20 61 0a 20 20 20 20 20 73 65 74 20 70 72 6f 64 75 63 65 73 20 61 20 73 65 74 20 74 | t.to.a......set.produces.a.set.t |
| 60b40 | 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 6f 62 6a 65 63 74 22 29 2e 0a 0a 20 20 20 2a | hat.contains.the.object")......* |
| 60b60 | 20 46 6f 72 20 61 6e 79 20 73 65 74 73 20 60 53 27 20 61 6e 64 20 60 54 27 20 61 6e 64 20 61 6e | .For.any.sets.`S'.and.`T'.and.an |
| 60b80 | 79 20 6f 62 6a 65 63 74 20 60 78 27 2c 20 60 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 | y.object.`x',.`(element-of-set?. |
| 60ba0 | 78 0a 20 20 20 20 20 28 75 6e 69 6f 6e 2d 73 65 74 20 53 20 54 29 29 27 20 69 73 20 65 71 75 61 | x......(union-set.S.T))'.is.equa |
| 60bc0 | 6c 20 74 6f 20 60 28 6f 72 20 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 78 20 53 29 0a | l.to.`(or.(element-of-set?.x.S). |
| 60be0 | 20 20 20 20 20 28 65 6c 65 6d 65 6e 74 2d 6f 66 2d 73 65 74 3f 20 78 20 54 29 29 27 20 28 69 6e | .....(element-of-set?.x.T))'.(in |
| 60c00 | 66 6f 72 6d 61 6c 6c 79 3a 20 22 54 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 60 28 75 6e 69 | formally:."The.elements.of.`(uni |
| 60c20 | 6f 6e 20 53 0a 20 20 20 20 20 54 29 27 20 61 72 65 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 74 | on.S......T)'.are.the.elements.t |
| 60c40 | 68 61 74 20 61 72 65 20 69 6e 20 60 53 27 20 6f 72 20 69 6e 20 60 54 27 22 29 2e 0a 0a 20 20 20 | hat.are.in.`S'.or.in.`T'")...... |
| 60c60 | 2a 20 46 6f 72 20 61 6e 79 20 6f 62 6a 65 63 74 20 60 78 27 2c 20 60 28 65 6c 65 6d 65 6e 74 2d | *.For.any.object.`x',.`(element- |
| 60c80 | 6f 66 2d 73 65 74 3f 20 78 20 27 28 29 29 27 20 69 73 20 66 61 6c 73 65 0a 20 20 20 20 20 28 69 | of-set?.x.'())'.is.false......(i |
| 60ca0 | 6e 66 6f 72 6d 61 6c 6c 79 3a 20 22 4e 6f 20 6f 62 6a 65 63 74 20 69 73 20 61 6e 20 65 6c 65 6d | nformally:."No.object.is.an.elem |
| 60cc0 | 65 6e 74 20 6f 66 20 74 68 65 20 65 6d 70 74 79 20 73 65 74 22 29 2e 0a 0a 0a 20 20 20 28 32 29 | ent.of.the.empty.set").......(2) |
| 60ce0 | 20 48 61 6c 76 69 6e 67 20 74 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 70 72 6f 62 6c 65 6d | .Halving.the.size.of.the.problem |
| 60d00 | 20 61 74 20 65 61 63 68 20 73 74 65 70 20 69 73 20 74 68 65 0a 64 69 73 74 69 6e 67 75 69 73 68 | .at.each.step.is.the.distinguish |
| 60d20 | 69 6e 67 20 63 68 61 72 61 63 74 65 72 69 73 74 69 63 20 6f 66 20 6c 6f 67 61 72 69 74 68 6d 69 | ing.characteristic.of.logarithmi |
| 60d40 | 63 20 67 72 6f 77 74 68 2c 20 61 73 20 77 65 20 73 61 77 20 77 69 74 68 20 74 68 65 0a 66 61 73 | c.growth,.as.we.saw.with.the.fas |
| 60d60 | 74 2d 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 20 6f 66 20 73 65 | t-exponentiation.algorithm.of.se |
| 60d80 | 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 34 3a 3a 20 61 6e 64 20 74 68 65 0a 68 61 6c 66 | ction.*Note.1-2-4::.and.the.half |
| 60da0 | 2d 69 6e 74 65 72 76 61 6c 20 73 65 61 72 63 68 20 6d 65 74 68 6f 64 20 6f 66 20 73 65 63 74 69 | -interval.search.method.of.secti |
| 60dc0 | 6f 6e 20 2a 4e 6f 74 65 20 31 2d 33 2d 33 3a 3a 2e 0a 0a 20 20 20 28 33 29 20 57 65 20 61 72 65 | on.*Note.1-3-3::......(3).We.are |
| 60de0 | 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 73 65 74 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 | .representing.sets.in.terms.of.t |
| 60e00 | 72 65 65 73 2c 20 61 6e 64 20 74 72 65 65 73 20 69 6e 20 74 65 72 6d 73 0a 6f 66 20 6c 69 73 74 | rees,.and.trees.in.terms.of.list |
| 60e20 | 73 2d 2d 69 6e 20 65 66 66 65 63 74 2c 20 61 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e | s--in.effect,.a.data.abstraction |
| 60e40 | 20 62 75 69 6c 74 20 75 70 6f 6e 20 61 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 2e 0a | .built.upon.a.data.abstraction.. |
| 60e60 | 57 65 20 63 61 6e 20 72 65 67 61 72 64 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 65 6e | We.can.regard.the.procedures.`en |
| 60e80 | 74 72 79 27 2c 20 60 6c 65 66 74 2d 62 72 61 6e 63 68 27 2c 20 60 72 69 67 68 74 2d 62 72 61 6e | try',.`left-branch',.`right-bran |
| 60ea0 | 63 68 27 2c 0a 61 6e 64 20 60 6d 61 6b 65 2d 74 72 65 65 27 20 61 73 20 61 20 77 61 79 20 6f 66 | ch',.and.`make-tree'.as.a.way.of |
| 60ec0 | 20 69 73 6f 6c 61 74 69 6e 67 20 74 68 65 20 61 62 73 74 72 61 63 74 69 6f 6e 20 6f 66 20 61 20 | .isolating.the.abstraction.of.a. |
| 60ee0 | 22 62 69 6e 61 72 79 0a 74 72 65 65 22 20 66 72 6f 6d 20 74 68 65 20 70 61 72 74 69 63 75 6c 61 | "binary.tree".from.the.particula |
| 60f00 | 72 20 77 61 79 20 77 65 20 6d 69 67 68 74 20 77 69 73 68 20 74 6f 20 72 65 70 72 65 73 65 6e 74 | r.way.we.might.wish.to.represent |
| 60f20 | 20 73 75 63 68 20 61 20 74 72 65 65 20 69 6e 0a 74 65 72 6d 73 20 6f 66 20 6c 69 73 74 20 73 74 | .such.a.tree.in.terms.of.list.st |
| 60f40 | 72 75 63 74 75 72 65 2e 0a 0a 20 20 20 28 34 29 20 45 78 61 6d 70 6c 65 73 20 6f 66 20 73 75 63 | ructure......(4).Examples.of.suc |
| 60f60 | 68 20 73 74 72 75 63 74 75 72 65 73 20 69 6e 63 6c 75 64 65 20 22 42 2d 74 72 65 65 73 22 20 61 | h.structures.include."B-trees".a |
| 60f80 | 6e 64 20 22 72 65 64 2d 62 6c 61 63 6b 0a 74 72 65 65 73 22 2e 20 20 54 68 65 72 65 20 69 73 20 | nd."red-black.trees"...There.is. |
| 60fa0 | 61 20 6c 61 72 67 65 20 6c 69 74 65 72 61 74 75 72 65 20 6f 6e 20 64 61 74 61 20 73 74 72 75 63 | a.large.literature.on.data.struc |
| 60fc0 | 74 75 72 65 73 20 64 65 76 6f 74 65 64 20 74 6f 20 74 68 69 73 0a 70 72 6f 62 6c 65 6d 2e 20 20 | tures.devoted.to.this.problem... |
| 60fe0 | 53 65 65 20 43 6f 72 6d 65 6e 2c 20 4c 65 69 73 65 72 73 6f 6e 2c 20 61 6e 64 20 52 69 76 65 73 | See.Cormen,.Leiserson,.and.Rives |
| 61000 | 74 20 31 39 39 30 2e 0a 0a 20 20 20 28 35 29 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 | t.1990......(5).*Note.Exercise.2 |
| 61020 | 2d 36 33 3a 3a 20 74 68 72 6f 75 67 68 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 36 | -63::.through.*Note.Exercise.2-6 |
| 61040 | 35 3a 3a 20 61 72 65 20 64 75 65 20 74 6f 0a 50 61 75 6c 20 48 69 6c 66 69 6e 67 65 72 2e 0a 0a | 5::.are.due.to.Paul.Hilfinger... |
| 61060 | 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 33 2d 34 2c | ..File:.sicp.info,..Node:.2-3-4, |
| 61080 | 20 20 50 72 65 76 3a 20 32 2d 33 2d 33 2c 20 20 55 70 3a 20 32 2d 33 0a 0a 32 2e 33 2e 34 20 45 | ..Prev:.2-3-3,..Up:.2-3..2.3.4.E |
| 610a0 | 78 61 6d 70 6c 65 3a 20 48 75 66 66 6d 61 6e 20 45 6e 63 6f 64 69 6e 67 20 54 72 65 65 73 0a 2d | xample:.Huffman.Encoding.Trees.- |
| 610c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 610e0 | 2d 2d 2d 2d 0a 0a 54 68 69 73 20 73 65 63 74 69 6f 6e 20 70 72 6f 76 69 64 65 73 20 70 72 61 63 | ----..This.section.provides.prac |
| 61100 | 74 69 63 65 20 69 6e 20 74 68 65 20 75 73 65 20 6f 66 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 | tice.in.the.use.of.list.structur |
| 61120 | 65 20 61 6e 64 20 64 61 74 61 0a 61 62 73 74 72 61 63 74 69 6f 6e 20 74 6f 20 6d 61 6e 69 70 75 | e.and.data.abstraction.to.manipu |
| 61140 | 6c 61 74 65 20 73 65 74 73 20 61 6e 64 20 74 72 65 65 73 2e 20 20 54 68 65 20 61 70 70 6c 69 63 | late.sets.and.trees...The.applic |
| 61160 | 61 74 69 6f 6e 20 69 73 20 74 6f 0a 6d 65 74 68 6f 64 73 20 66 6f 72 20 72 65 70 72 65 73 65 6e | ation.is.to.methods.for.represen |
| 61180 | 74 69 6e 67 20 64 61 74 61 20 61 73 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 6f 6e 65 73 20 61 | ting.data.as.sequences.of.ones.a |
| 611a0 | 6e 64 20 7a 65 72 6f 73 20 28 62 69 74 73 29 2e 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 | nd.zeros.(bits)..For.example,.th |
| 611c0 | 65 20 41 53 43 49 49 20 73 74 61 6e 64 61 72 64 20 63 6f 64 65 20 75 73 65 64 20 74 6f 20 72 65 | e.ASCII.standard.code.used.to.re |
| 611e0 | 70 72 65 73 65 6e 74 20 74 65 78 74 20 69 6e 0a 63 6f 6d 70 75 74 65 72 73 20 65 6e 63 6f 64 65 | present.text.in.computers.encode |
| 61200 | 73 20 65 61 63 68 20 63 68 61 72 61 63 74 65 72 20 61 73 20 61 20 73 65 71 75 65 6e 63 65 20 6f | s.each.character.as.a.sequence.o |
| 61220 | 66 20 73 65 76 65 6e 20 62 69 74 73 2e 20 20 55 73 69 6e 67 0a 73 65 76 65 6e 20 62 69 74 73 20 | f.seven.bits...Using.seven.bits. |
| 61240 | 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20 64 69 73 74 69 6e 67 75 69 73 68 20 32 5e 28 37 29 2c 20 | allows.us.to.distinguish.2^(7),. |
| 61260 | 6f 72 20 31 32 38 2c 20 70 6f 73 73 69 62 6c 65 20 64 69 66 66 65 72 65 6e 74 0a 63 68 61 72 61 | or.128,.possible.different.chara |
| 61280 | 63 74 65 72 73 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 69 66 20 77 65 20 77 61 6e 74 20 74 | cters...In.general,.if.we.want.t |
| 612a0 | 6f 20 64 69 73 74 69 6e 67 75 69 73 68 20 6e 20 64 69 66 66 65 72 65 6e 74 20 73 79 6d 62 6f 6c | o.distinguish.n.different.symbol |
| 612c0 | 73 2c 0a 77 65 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 75 73 65 20 60 6c 6f 67 27 5f 32 20 6e | s,.we.will.need.to.use.`log'_2.n |
| 612e0 | 20 62 69 74 73 20 70 65 72 20 73 79 6d 62 6f 6c 2e 20 20 49 66 20 61 6c 6c 20 6f 75 72 20 6d 65 | .bits.per.symbol...If.all.our.me |
| 61300 | 73 73 61 67 65 73 20 61 72 65 0a 6d 61 64 65 20 75 70 20 6f 66 20 74 68 65 20 65 69 67 68 74 20 | ssages.are.made.up.of.the.eight. |
| 61320 | 73 79 6d 62 6f 6c 73 20 41 2c 20 42 2c 20 43 2c 20 44 2c 20 45 2c 20 46 2c 20 47 2c 20 61 6e 64 | symbols.A,.B,.C,.D,.E,.F,.G,.and |
| 61340 | 20 48 2c 20 77 65 20 63 61 6e 20 63 68 6f 6f 73 65 0a 61 20 63 6f 64 65 20 77 69 74 68 20 74 68 | .H,.we.can.choose.a.code.with.th |
| 61360 | 72 65 65 20 62 69 74 73 20 70 65 72 20 63 68 61 72 61 63 74 65 72 2c 20 66 6f 72 20 65 78 61 6d | ree.bits.per.character,.for.exam |
| 61380 | 70 6c 65 0a 0a 20 20 20 20 20 41 20 30 30 30 20 43 20 30 31 30 20 45 20 31 30 30 20 47 20 31 31 | ple.......A.000.C.010.E.100.G.11 |
| 613a0 | 30 0a 20 20 20 20 20 42 20 30 30 31 20 44 20 30 31 31 20 46 20 31 30 31 20 48 20 31 31 31 0a 0a | 0......B.001.D.011.F.101.H.111.. |
| 613c0 | 57 69 74 68 20 74 68 69 73 20 63 6f 64 65 2c 20 74 68 65 20 6d 65 73 73 61 67 65 0a 0a 20 20 20 | With.this.code,.the.message..... |
| 613e0 | 42 41 43 41 44 41 45 41 46 41 42 42 41 41 41 47 41 48 0a 0a 69 73 20 65 6e 63 6f 64 65 64 20 61 | BACADAEAFABBAAAGAH..is.encoded.a |
| 61400 | 73 20 74 68 65 20 73 74 72 69 6e 67 20 6f 66 20 35 34 20 62 69 74 73 0a 0a 20 20 20 30 30 31 30 | s.the.string.of.54.bits.....0010 |
| 61420 | 30 30 30 31 30 30 30 30 30 31 31 30 30 30 31 30 30 30 30 30 31 30 31 30 30 30 30 30 31 30 30 31 | 00010000011000100000101000001001 |
| 61440 | 30 30 30 30 30 30 30 30 30 31 31 30 30 30 30 31 31 31 0a 0a 20 20 20 43 6f 64 65 73 20 73 75 63 | 000000000110000111.....Codes.suc |
| 61460 | 68 20 61 73 20 41 53 43 49 49 20 61 6e 64 20 74 68 65 20 41 2d 74 68 72 6f 75 67 68 2d 48 20 63 | h.as.ASCII.and.the.A-through-H.c |
| 61480 | 6f 64 65 20 61 62 6f 76 65 20 61 72 65 20 6b 6e 6f 77 6e 20 61 73 20 22 66 69 78 65 64 2d 6c 65 | ode.above.are.known.as."fixed-le |
| 614a0 | 6e 67 74 68 22 0a 63 6f 64 65 73 2c 20 62 65 63 61 75 73 65 20 74 68 65 79 20 72 65 70 72 65 73 | ngth".codes,.because.they.repres |
| 614c0 | 65 6e 74 20 65 61 63 68 20 73 79 6d 62 6f 6c 20 69 6e 20 74 68 65 20 6d 65 73 73 61 67 65 20 77 | ent.each.symbol.in.the.message.w |
| 614e0 | 69 74 68 20 74 68 65 20 73 61 6d 65 0a 6e 75 6d 62 65 72 20 6f 66 20 62 69 74 73 2e 20 20 49 74 | ith.the.same.number.of.bits...It |
| 61500 | 20 69 73 20 73 6f 6d 65 74 69 6d 65 73 20 61 64 76 61 6e 74 61 67 65 6f 75 73 20 74 6f 20 75 73 | .is.sometimes.advantageous.to.us |
| 61520 | 65 20 22 76 61 72 69 61 62 6c 65 2d 6c 65 6e 67 74 68 22 0a 63 6f 64 65 73 2c 20 69 6e 20 77 68 | e."variable-length".codes,.in.wh |
| 61540 | 69 63 68 20 64 69 66 66 65 72 65 6e 74 20 73 79 6d 62 6f 6c 73 20 6d 61 79 20 62 65 20 72 65 70 | ich.different.symbols.may.be.rep |
| 61560 | 72 65 73 65 6e 74 65 64 20 62 79 20 64 69 66 66 65 72 65 6e 74 0a 6e 75 6d 62 65 72 73 20 6f 66 | resented.by.different.numbers.of |
| 61580 | 20 62 69 74 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 4d 6f 72 73 65 20 63 6f 64 65 20 | .bits...For.example,.Morse.code. |
| 615a0 | 64 6f 65 73 20 6e 6f 74 20 75 73 65 20 74 68 65 20 73 61 6d 65 20 6e 75 6d 62 65 72 0a 6f 66 20 | does.not.use.the.same.number.of. |
| 615c0 | 64 6f 74 73 20 61 6e 64 20 64 61 73 68 65 73 20 66 6f 72 20 65 61 63 68 20 6c 65 74 74 65 72 20 | dots.and.dashes.for.each.letter. |
| 615e0 | 6f 66 20 74 68 65 20 61 6c 70 68 61 62 65 74 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c | of.the.alphabet...In.particular, |
| 61600 | 20 45 2c 0a 74 68 65 20 6d 6f 73 74 20 66 72 65 71 75 65 6e 74 20 6c 65 74 74 65 72 2c 20 69 73 | .E,.the.most.frequent.letter,.is |
| 61620 | 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 61 20 73 69 6e 67 6c 65 20 64 6f 74 2e 20 20 49 | .represented.by.a.single.dot...I |
| 61640 | 6e 20 67 65 6e 65 72 61 6c 2c 0a 69 66 20 6f 75 72 20 6d 65 73 73 61 67 65 73 20 61 72 65 20 73 | n.general,.if.our.messages.are.s |
| 61660 | 75 63 68 20 74 68 61 74 20 73 6f 6d 65 20 73 79 6d 62 6f 6c 73 20 61 70 70 65 61 72 20 76 65 72 | uch.that.some.symbols.appear.ver |
| 61680 | 79 20 66 72 65 71 75 65 6e 74 6c 79 20 61 6e 64 0a 73 6f 6d 65 20 76 65 72 79 20 72 61 72 65 6c | y.frequently.and.some.very.rarel |
| 616a0 | 79 2c 20 77 65 20 63 61 6e 20 65 6e 63 6f 64 65 20 64 61 74 61 20 6d 6f 72 65 20 65 66 66 69 63 | y,.we.can.encode.data.more.effic |
| 616c0 | 69 65 6e 74 6c 79 20 28 69 2e 65 2e 2c 20 75 73 69 6e 67 0a 66 65 77 65 72 20 62 69 74 73 20 70 | iently.(i.e.,.using.fewer.bits.p |
| 616e0 | 65 72 20 6d 65 73 73 61 67 65 29 20 69 66 20 77 65 20 61 73 73 69 67 6e 20 73 68 6f 72 74 65 72 | er.message).if.we.assign.shorter |
| 61700 | 20 63 6f 64 65 73 20 74 6f 20 74 68 65 20 66 72 65 71 75 65 6e 74 0a 73 79 6d 62 6f 6c 73 2e 20 | .codes.to.the.frequent.symbols.. |
| 61720 | 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 6c 74 65 72 6e 61 74 | .Consider.the.following.alternat |
| 61740 | 69 76 65 20 63 6f 64 65 20 66 6f 72 20 74 68 65 20 6c 65 74 74 65 72 73 20 41 0a 74 68 72 6f 75 | ive.code.for.the.letters.A.throu |
| 61760 | 67 68 20 48 3a 0a 0a 20 20 20 20 20 41 20 30 20 20 20 43 20 31 30 31 30 20 20 45 20 31 31 30 30 | gh.H:.......A.0...C.1010..E.1100 |
| 61780 | 20 20 47 20 31 31 31 30 0a 20 20 20 20 20 42 20 31 30 30 20 44 20 31 30 31 31 20 20 46 20 31 31 | ..G.1110......B.100.D.1011..F.11 |
| 617a0 | 30 31 20 20 48 20 31 31 31 31 0a 0a 57 69 74 68 20 74 68 69 73 20 63 6f 64 65 2c 20 74 68 65 20 | 01..H.1111..With.this.code,.the. |
| 617c0 | 73 61 6d 65 20 6d 65 73 73 61 67 65 20 61 73 20 61 62 6f 76 65 20 69 73 20 65 6e 63 6f 64 65 64 | same.message.as.above.is.encoded |
| 617e0 | 20 61 73 20 74 68 65 20 73 74 72 69 6e 67 0a 0a 20 20 20 31 30 30 30 31 30 31 30 30 31 30 31 31 | .as.the.string.....1000101001011 |
| 61800 | 30 31 31 30 30 30 31 31 30 31 30 31 30 30 31 30 30 30 30 30 31 31 31 30 30 31 31 31 31 0a 0a 20 | 01100011010100100000111001111... |
| 61820 | 20 20 54 68 69 73 20 73 74 72 69 6e 67 20 63 6f 6e 74 61 69 6e 73 20 34 32 20 62 69 74 73 2c 20 | ..This.string.contains.42.bits,. |
| 61840 | 73 6f 20 69 74 20 73 61 76 65 73 20 6d 6f 72 65 20 74 68 61 6e 20 32 30 25 20 69 6e 20 73 70 61 | so.it.saves.more.than.20%.in.spa |
| 61860 | 63 65 20 69 6e 0a 63 6f 6d 70 61 72 69 73 6f 6e 20 77 69 74 68 20 74 68 65 20 66 69 78 65 64 2d | ce.in.comparison.with.the.fixed- |
| 61880 | 6c 65 6e 67 74 68 20 63 6f 64 65 20 73 68 6f 77 6e 20 61 62 6f 76 65 2e 0a 0a 20 20 20 4f 6e 65 | length.code.shown.above......One |
| 618a0 | 20 6f 66 20 74 68 65 20 64 69 66 66 69 63 75 6c 74 69 65 73 20 6f 66 20 75 73 69 6e 67 20 61 20 | .of.the.difficulties.of.using.a. |
| 618c0 | 76 61 72 69 61 62 6c 65 2d 6c 65 6e 67 74 68 20 63 6f 64 65 20 69 73 20 6b 6e 6f 77 69 6e 67 0a | variable-length.code.is.knowing. |
| 618e0 | 77 68 65 6e 20 79 6f 75 20 68 61 76 65 20 72 65 61 63 68 65 64 20 74 68 65 20 65 6e 64 20 6f 66 | when.you.have.reached.the.end.of |
| 61900 | 20 61 20 73 79 6d 62 6f 6c 20 69 6e 20 72 65 61 64 69 6e 67 20 61 20 73 65 71 75 65 6e 63 65 20 | .a.symbol.in.reading.a.sequence. |
| 61920 | 6f 66 0a 7a 65 72 6f 73 20 61 6e 64 20 6f 6e 65 73 2e 20 20 4d 6f 72 73 65 20 63 6f 64 65 20 73 | of.zeros.and.ones...Morse.code.s |
| 61940 | 6f 6c 76 65 73 20 74 68 69 73 20 70 72 6f 62 6c 65 6d 20 62 79 20 75 73 69 6e 67 20 61 20 73 70 | olves.this.problem.by.using.a.sp |
| 61960 | 65 63 69 61 6c 20 22 73 65 70 61 72 61 74 6f 72 0a 63 6f 64 65 22 20 28 69 6e 20 74 68 69 73 20 | ecial."separator.code".(in.this. |
| 61980 | 63 61 73 65 2c 20 61 20 70 61 75 73 65 29 20 61 66 74 65 72 20 74 68 65 20 73 65 71 75 65 6e 63 | case,.a.pause).after.the.sequenc |
| 619a0 | 65 20 6f 66 20 64 6f 74 73 20 61 6e 64 20 64 61 73 68 65 73 20 66 6f 72 0a 65 61 63 68 20 6c 65 | e.of.dots.and.dashes.for.each.le |
| 619c0 | 74 74 65 72 2e 20 20 41 6e 6f 74 68 65 72 20 73 6f 6c 75 74 69 6f 6e 20 69 73 20 74 6f 20 64 65 | tter...Another.solution.is.to.de |
| 619e0 | 73 69 67 6e 20 74 68 65 20 63 6f 64 65 20 69 6e 20 73 75 63 68 20 61 20 77 61 79 20 74 68 61 74 | sign.the.code.in.such.a.way.that |
| 61a00 | 0a 6e 6f 20 63 6f 6d 70 6c 65 74 65 20 63 6f 64 65 20 66 6f 72 20 61 6e 79 20 73 79 6d 62 6f 6c | .no.complete.code.for.any.symbol |
| 61a20 | 20 69 73 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 28 6f 72 20 22 70 72 65 66 69 78 22 29 20 | .is.the.beginning.(or."prefix"). |
| 61a40 | 6f 66 20 74 68 65 0a 63 6f 64 65 20 66 6f 72 20 61 6e 6f 74 68 65 72 20 73 79 6d 62 6f 6c 2e 20 | of.the.code.for.another.symbol.. |
| 61a60 | 20 53 75 63 68 20 61 20 63 6f 64 65 20 69 73 20 63 61 6c 6c 65 64 20 61 20 22 70 72 65 66 69 78 | .Such.a.code.is.called.a."prefix |
| 61a80 | 20 63 6f 64 65 22 2e 20 20 49 6e 0a 74 68 65 20 65 78 61 6d 70 6c 65 20 61 62 6f 76 65 2c 20 41 | .code"...In.the.example.above,.A |
| 61aa0 | 20 69 73 20 65 6e 63 6f 64 65 64 20 62 79 20 30 20 61 6e 64 20 42 20 69 73 20 65 6e 63 6f 64 65 | .is.encoded.by.0.and.B.is.encode |
| 61ac0 | 64 20 62 79 20 31 30 30 2c 20 73 6f 20 6e 6f 0a 6f 74 68 65 72 20 73 79 6d 62 6f 6c 20 63 61 6e | d.by.100,.so.no.other.symbol.can |
| 61ae0 | 20 68 61 76 65 20 61 20 63 6f 64 65 20 74 68 61 74 20 62 65 67 69 6e 73 20 77 69 74 68 20 30 20 | .have.a.code.that.begins.with.0. |
| 61b00 | 6f 72 20 77 69 74 68 20 31 30 30 2e 0a 0a 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 77 65 20 | or.with.100......In.general,.we. |
| 61b20 | 63 61 6e 20 61 74 74 61 69 6e 20 73 69 67 6e 69 66 69 63 61 6e 74 20 73 61 76 69 6e 67 73 20 69 | can.attain.significant.savings.i |
| 61b40 | 66 20 77 65 20 75 73 65 0a 76 61 72 69 61 62 6c 65 2d 6c 65 6e 67 74 68 20 70 72 65 66 69 78 20 | f.we.use.variable-length.prefix. |
| 61b60 | 63 6f 64 65 73 20 74 68 61 74 20 74 61 6b 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 74 68 65 | codes.that.take.advantage.of.the |
| 61b80 | 20 72 65 6c 61 74 69 76 65 0a 66 72 65 71 75 65 6e 63 69 65 73 20 6f 66 20 74 68 65 20 73 79 6d | .relative.frequencies.of.the.sym |
| 61ba0 | 62 6f 6c 73 20 69 6e 20 74 68 65 20 6d 65 73 73 61 67 65 73 20 74 6f 20 62 65 20 65 6e 63 6f 64 | bols.in.the.messages.to.be.encod |
| 61bc0 | 65 64 2e 20 20 4f 6e 65 0a 70 61 72 74 69 63 75 6c 61 72 20 73 63 68 65 6d 65 20 66 6f 72 20 64 | ed...One.particular.scheme.for.d |
| 61be0 | 6f 69 6e 67 20 74 68 69 73 20 69 73 20 63 61 6c 6c 65 64 20 74 68 65 20 48 75 66 66 6d 61 6e 20 | oing.this.is.called.the.Huffman. |
| 61c00 | 65 6e 63 6f 64 69 6e 67 20 6d 65 74 68 6f 64 2c 0a 61 66 74 65 72 20 69 74 73 20 64 69 73 63 6f | encoding.method,.after.its.disco |
| 61c20 | 76 65 72 65 72 2c 20 44 61 76 69 64 20 48 75 66 66 6d 61 6e 2e 20 20 41 20 48 75 66 66 6d 61 6e | verer,.David.Huffman...A.Huffman |
| 61c40 | 20 63 6f 64 65 20 63 61 6e 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 0a 61 73 20 61 20 62 69 | .code.can.be.represented.as.a.bi |
| 61c60 | 6e 61 72 79 20 74 72 65 65 20 77 68 6f 73 65 20 6c 65 61 76 65 73 20 61 72 65 20 74 68 65 20 73 | nary.tree.whose.leaves.are.the.s |
| 61c80 | 79 6d 62 6f 6c 73 20 74 68 61 74 20 61 72 65 20 65 6e 63 6f 64 65 64 2e 20 20 41 74 0a 65 61 63 | ymbols.that.are.encoded...At.eac |
| 61ca0 | 68 20 6e 6f 6e 2d 6c 65 61 66 20 6e 6f 64 65 20 6f 66 20 74 68 65 20 74 72 65 65 20 74 68 65 72 | h.non-leaf.node.of.the.tree.ther |
| 61cc0 | 65 20 69 73 20 61 20 73 65 74 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 6c 6c 20 74 68 65 0a 73 79 | e.is.a.set.containing.all.the.sy |
| 61ce0 | 6d 62 6f 6c 73 20 69 6e 20 74 68 65 20 6c 65 61 76 65 73 20 74 68 61 74 20 6c 69 65 20 62 65 6c | mbols.in.the.leaves.that.lie.bel |
| 61d00 | 6f 77 20 74 68 65 20 6e 6f 64 65 2e 20 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 65 61 63 68 0a | ow.the.node...In.addition,.each. |
| 61d20 | 73 79 6d 62 6f 6c 20 61 74 20 61 20 6c 65 61 66 20 69 73 20 61 73 73 69 67 6e 65 64 20 61 20 77 | symbol.at.a.leaf.is.assigned.a.w |
| 61d40 | 65 69 67 68 74 20 28 77 68 69 63 68 20 69 73 20 69 74 73 20 72 65 6c 61 74 69 76 65 0a 66 72 65 | eight.(which.is.its.relative.fre |
| 61d60 | 71 75 65 6e 63 79 29 2c 20 61 6e 64 20 65 61 63 68 20 6e 6f 6e 2d 6c 65 61 66 20 6e 6f 64 65 20 | quency),.and.each.non-leaf.node. |
| 61d80 | 63 6f 6e 74 61 69 6e 73 20 61 20 77 65 69 67 68 74 20 74 68 61 74 20 69 73 20 74 68 65 20 73 75 | contains.a.weight.that.is.the.su |
| 61da0 | 6d 20 6f 66 0a 61 6c 6c 20 74 68 65 20 77 65 69 67 68 74 73 20 6f 66 20 74 68 65 20 6c 65 61 76 | m.of.all.the.weights.of.the.leav |
| 61dc0 | 65 73 20 6c 79 69 6e 67 20 62 65 6c 6f 77 20 69 74 2e 20 20 54 68 65 20 77 65 69 67 68 74 73 20 | es.lying.below.it...The.weights. |
| 61de0 | 61 72 65 20 6e 6f 74 20 75 73 65 64 0a 69 6e 20 74 68 65 20 65 6e 63 6f 64 69 6e 67 20 6f 72 20 | are.not.used.in.the.encoding.or. |
| 61e00 | 74 68 65 20 64 65 63 6f 64 69 6e 67 20 70 72 6f 63 65 73 73 2e 20 20 57 65 20 77 69 6c 6c 20 73 | the.decoding.process...We.will.s |
| 61e20 | 65 65 20 62 65 6c 6f 77 20 68 6f 77 20 74 68 65 79 0a 61 72 65 20 75 73 65 64 20 74 6f 20 68 65 | ee.below.how.they.are.used.to.he |
| 61e40 | 6c 70 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 74 72 65 65 2e 0a 0a 20 20 20 20 20 2a 46 69 | lp.construct.the.tree........*Fi |
| 61e60 | 67 75 72 65 20 32 2e 31 38 3a 2a 20 41 20 48 75 66 66 6d 61 6e 20 65 6e 63 6f 64 69 6e 67 20 74 | gure.2.18:*.A.Huffman.encoding.t |
| 61e80 | 72 65 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 41 20 42 20 | ree........................{A.B. |
| 61ea0 | 43 20 44 20 45 20 46 20 47 20 48 7d 20 31 37 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | C.D.E.F.G.H}.17................. |
| 61ec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............*................. |
| 61ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............./.\................ |
| 61f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............./...\.............. |
| 61f20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 41 20 38 20 20 20 20 2a 20 7b 42 20 43 20 44 20 45 20 46 | .............A.8....*.{B.C.D.E.F |
| 61f40 | 20 47 20 48 7d 20 39 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f | .G.H}.9.......................__ |
| 61f60 | 5f 5f 5f 5f 5f 5f 5f 5f 2f 20 5c 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 0a 20 20 20 20 20 20 20 | ________/.\_____________........ |
| 61f80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............../................. |
| 61fa0 | 20 20 20 20 20 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 7b 42 20 43 20 44 7d 20 35 20 2a | .........\...........{B.C.D}.5.* |
| 61fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 20 7b 45 | ............................*.{E |
| 61fe0 | 20 46 20 47 20 48 7d 20 34 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 5c | .F.G.H}.4..................../.\ |
| 62000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 5f 2f 20 5c 5f 5f 5f | .......................___/.\___ |
| 62020 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 5c 20 20 20 20 20 20 20 20 | .................../...\........ |
| 62040 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 20 20 20 20 20 5c 0a 20 20 20 20 20 20 20 | ............./.........\........ |
| 62060 | 20 20 20 20 20 20 20 20 20 42 20 33 20 20 20 20 2a 20 7b 43 20 44 7d 20 32 20 20 20 7b 45 20 46 | .........B.3....*.{C.D}.2...{E.F |
| 62080 | 7d 20 32 20 2a 20 20 20 20 20 20 20 20 20 20 20 2a 20 7b 47 20 48 7d 20 32 0a 20 20 20 20 20 20 | }.2.*...........*.{G.H}.2....... |
| 620a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 5c 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................/.\............. |
| 620c0 | 20 20 20 20 2f 20 5c 20 20 20 20 20 20 20 20 20 2f 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..../.\........./.\............. |
| 620e0 | 20 20 20 20 20 20 20 20 20 2f 20 20 20 5c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 | ........./...\.............../.. |
| 62100 | 20 5c 20 20 20 20 20 20 20 2f 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .\......./...\.................. |
| 62120 | 20 20 43 20 31 20 20 20 44 20 31 20 20 20 20 20 20 20 20 20 20 20 45 20 31 20 20 20 46 20 31 20 | ..C.1...D.1...........E.1...F.1. |
| 62140 | 20 20 47 20 31 20 20 20 48 20 31 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 | ..G.1...H.1.....*Note.Figure.2-1 |
| 62160 | 38 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 48 75 66 66 6d 61 6e 20 74 72 65 65 20 66 6f 72 20 74 | 8::.shows.the.Huffman.tree.for.t |
| 62180 | 68 65 20 41 2d 74 68 72 6f 75 67 68 2d 48 20 63 6f 64 65 0a 67 69 76 65 6e 20 61 62 6f 76 65 2e | he.A-through-H.code.given.above. |
| 621a0 | 20 20 54 68 65 20 77 65 69 67 68 74 73 20 61 74 20 74 68 65 20 6c 65 61 76 65 73 20 69 6e 64 69 | ..The.weights.at.the.leaves.indi |
| 621c0 | 63 61 74 65 20 74 68 61 74 20 74 68 65 20 74 72 65 65 20 77 61 73 0a 64 65 73 69 67 6e 65 64 20 | cate.that.the.tree.was.designed. |
| 621e0 | 66 6f 72 20 6d 65 73 73 61 67 65 73 20 69 6e 20 77 68 69 63 68 20 41 20 61 70 70 65 61 72 73 20 | for.messages.in.which.A.appears. |
| 62200 | 77 69 74 68 20 72 65 6c 61 74 69 76 65 20 66 72 65 71 75 65 6e 63 79 20 38 2c 20 42 0a 77 69 74 | with.relative.frequency.8,.B.wit |
| 62220 | 68 20 72 65 6c 61 74 69 76 65 20 66 72 65 71 75 65 6e 63 79 20 33 2c 20 61 6e 64 20 74 68 65 20 | h.relative.frequency.3,.and.the. |
| 62240 | 6f 74 68 65 72 20 6c 65 74 74 65 72 73 20 65 61 63 68 20 77 69 74 68 20 72 65 6c 61 74 69 76 65 | other.letters.each.with.relative |
| 62260 | 0a 66 72 65 71 75 65 6e 63 79 20 31 2e 0a 0a 20 20 20 47 69 76 65 6e 20 61 20 48 75 66 66 6d 61 | .frequency.1......Given.a.Huffma |
| 62280 | 6e 20 74 72 65 65 2c 20 77 65 20 63 61 6e 20 66 69 6e 64 20 74 68 65 20 65 6e 63 6f 64 69 6e 67 | n.tree,.we.can.find.the.encoding |
| 622a0 | 20 6f 66 20 61 6e 79 20 73 79 6d 62 6f 6c 20 62 79 0a 73 74 61 72 74 69 6e 67 20 61 74 20 74 68 | .of.any.symbol.by.starting.at.th |
| 622c0 | 65 20 72 6f 6f 74 20 61 6e 64 20 6d 6f 76 69 6e 67 20 64 6f 77 6e 20 75 6e 74 69 6c 20 77 65 20 | e.root.and.moving.down.until.we. |
| 622e0 | 72 65 61 63 68 20 74 68 65 20 6c 65 61 66 20 74 68 61 74 20 68 6f 6c 64 73 0a 74 68 65 20 73 79 | reach.the.leaf.that.holds.the.sy |
| 62300 | 6d 62 6f 6c 2e 20 20 45 61 63 68 20 74 69 6d 65 20 77 65 20 6d 6f 76 65 20 64 6f 77 6e 20 61 20 | mbol...Each.time.we.move.down.a. |
| 62320 | 6c 65 66 74 20 62 72 61 6e 63 68 20 77 65 20 61 64 64 20 61 20 30 20 74 6f 20 74 68 65 0a 63 6f | left.branch.we.add.a.0.to.the.co |
| 62340 | 64 65 2c 20 61 6e 64 20 65 61 63 68 20 74 69 6d 65 20 77 65 20 6d 6f 76 65 20 64 6f 77 6e 20 61 | de,.and.each.time.we.move.down.a |
| 62360 | 20 72 69 67 68 74 20 62 72 61 6e 63 68 20 77 65 20 61 64 64 20 61 20 31 2e 20 20 28 57 65 20 64 | .right.branch.we.add.a.1...(We.d |
| 62380 | 65 63 69 64 65 0a 77 68 69 63 68 20 62 72 61 6e 63 68 20 74 6f 20 66 6f 6c 6c 6f 77 20 62 79 20 | ecide.which.branch.to.follow.by. |
| 623a0 | 74 65 73 74 69 6e 67 20 74 6f 20 73 65 65 20 77 68 69 63 68 20 62 72 61 6e 63 68 20 65 69 74 68 | testing.to.see.which.branch.eith |
| 623c0 | 65 72 20 69 73 20 74 68 65 0a 6c 65 61 66 20 6e 6f 64 65 20 66 6f 72 20 74 68 65 20 73 79 6d 62 | er.is.the.leaf.node.for.the.symb |
| 623e0 | 6f 6c 20 6f 72 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 6e 20 69 74 73 | ol.or.contains.the.symbol.in.its |
| 62400 | 20 73 65 74 2e 29 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 73 74 61 72 74 69 6e 67 20 66 72 | .set.)..For.example,.starting.fr |
| 62420 | 6f 6d 20 74 68 65 20 72 6f 6f 74 20 6f 66 20 74 68 65 20 74 72 65 65 20 69 6e 20 2a 4e 6f 74 65 | om.the.root.of.the.tree.in.*Note |
| 62440 | 20 46 69 67 75 72 65 20 32 2d 31 38 3a 3a 2c 20 77 65 0a 61 72 72 69 76 65 20 61 74 20 74 68 65 | .Figure.2-18::,.we.arrive.at.the |
| 62460 | 20 6c 65 61 66 20 66 6f 72 20 44 20 62 79 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 20 72 69 67 68 74 | .leaf.for.D.by.following.a.right |
| 62480 | 20 62 72 61 6e 63 68 2c 20 74 68 65 6e 20 61 20 6c 65 66 74 0a 62 72 61 6e 63 68 2c 20 74 68 65 | .branch,.then.a.left.branch,.the |
| 624a0 | 6e 20 61 20 72 69 67 68 74 20 62 72 61 6e 63 68 2c 20 74 68 65 6e 20 61 20 72 69 67 68 74 20 62 | n.a.right.branch,.then.a.right.b |
| 624c0 | 72 61 6e 63 68 3b 20 68 65 6e 63 65 2c 20 74 68 65 20 63 6f 64 65 20 66 6f 72 20 44 0a 69 73 20 | ranch;.hence,.the.code.for.D.is. |
| 624e0 | 31 30 31 31 2e 0a 0a 20 20 20 54 6f 20 64 65 63 6f 64 65 20 61 20 62 69 74 20 73 65 71 75 65 6e | 1011......To.decode.a.bit.sequen |
| 62500 | 63 65 20 75 73 69 6e 67 20 61 20 48 75 66 66 6d 61 6e 20 74 72 65 65 2c 20 77 65 20 62 65 67 69 | ce.using.a.Huffman.tree,.we.begi |
| 62520 | 6e 20 61 74 20 74 68 65 20 72 6f 6f 74 0a 61 6e 64 20 75 73 65 20 74 68 65 20 73 75 63 63 65 73 | n.at.the.root.and.use.the.succes |
| 62540 | 73 69 76 65 20 7a 65 72 6f 73 20 61 6e 64 20 6f 6e 65 73 20 6f 66 20 74 68 65 20 62 69 74 20 73 | sive.zeros.and.ones.of.the.bit.s |
| 62560 | 65 71 75 65 6e 63 65 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 0a 77 68 65 74 68 65 72 20 74 6f 20 | equence.to.determine.whether.to. |
| 62580 | 6d 6f 76 65 20 64 6f 77 6e 20 74 68 65 20 6c 65 66 74 20 6f 72 20 74 68 65 20 72 69 67 68 74 20 | move.down.the.left.or.the.right. |
| 625a0 | 62 72 61 6e 63 68 2e 20 20 45 61 63 68 20 74 69 6d 65 20 77 65 20 63 6f 6d 65 0a 74 6f 20 61 20 | branch...Each.time.we.come.to.a. |
| 625c0 | 6c 65 61 66 2c 20 77 65 20 68 61 76 65 20 67 65 6e 65 72 61 74 65 64 20 61 20 6e 65 77 20 73 79 | leaf,.we.have.generated.a.new.sy |
| 625e0 | 6d 62 6f 6c 20 69 6e 20 74 68 65 20 6d 65 73 73 61 67 65 2c 20 61 74 20 77 68 69 63 68 0a 70 6f | mbol.in.the.message,.at.which.po |
| 62600 | 69 6e 74 20 77 65 20 73 74 61 72 74 20 6f 76 65 72 20 66 72 6f 6d 20 74 68 65 20 72 6f 6f 74 20 | int.we.start.over.from.the.root. |
| 62620 | 6f 66 20 74 68 65 20 74 72 65 65 20 74 6f 20 66 69 6e 64 20 74 68 65 20 6e 65 78 74 20 73 79 6d | of.the.tree.to.find.the.next.sym |
| 62640 | 62 6f 6c 2e 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 73 75 70 70 6f 73 65 20 77 65 20 61 72 65 | bol..For.example,.suppose.we.are |
| 62660 | 20 67 69 76 65 6e 20 74 68 65 20 74 72 65 65 20 61 62 6f 76 65 20 61 6e 64 20 74 68 65 20 73 65 | .given.the.tree.above.and.the.se |
| 62680 | 71 75 65 6e 63 65 0a 31 30 30 30 31 30 31 30 2e 20 20 53 74 61 72 74 69 6e 67 20 61 74 20 74 68 | quence.10001010...Starting.at.th |
| 626a0 | 65 20 72 6f 6f 74 2c 20 77 65 20 6d 6f 76 65 20 64 6f 77 6e 20 74 68 65 20 72 69 67 68 74 20 62 | e.root,.we.move.down.the.right.b |
| 626c0 | 72 61 6e 63 68 2c 20 28 73 69 6e 63 65 0a 74 68 65 20 66 69 72 73 74 20 62 69 74 20 6f 66 20 74 | ranch,.(since.the.first.bit.of.t |
| 626e0 | 68 65 20 73 74 72 69 6e 67 20 69 73 20 31 29 2c 20 74 68 65 6e 20 64 6f 77 6e 20 74 68 65 20 6c | he.string.is.1),.then.down.the.l |
| 62700 | 65 66 74 20 62 72 61 6e 63 68 20 28 73 69 6e 63 65 20 74 68 65 0a 73 65 63 6f 6e 64 20 62 69 74 | eft.branch.(since.the.second.bit |
| 62720 | 20 69 73 20 30 29 2c 20 74 68 65 6e 20 64 6f 77 6e 20 74 68 65 20 6c 65 66 74 20 62 72 61 6e 63 | .is.0),.then.down.the.left.branc |
| 62740 | 68 20 28 73 69 6e 63 65 20 74 68 65 20 74 68 69 72 64 20 62 69 74 20 69 73 0a 61 6c 73 6f 20 30 | h.(since.the.third.bit.is.also.0 |
| 62760 | 29 2e 20 20 54 68 69 73 20 62 72 69 6e 67 73 20 75 73 20 74 6f 20 74 68 65 20 6c 65 61 66 20 66 | )...This.brings.us.to.the.leaf.f |
| 62780 | 6f 72 20 42 2c 20 73 6f 20 74 68 65 20 66 69 72 73 74 20 73 79 6d 62 6f 6c 20 6f 66 20 74 68 65 | or.B,.so.the.first.symbol.of.the |
| 627a0 | 0a 64 65 63 6f 64 65 64 20 6d 65 73 73 61 67 65 20 69 73 20 42 2e 20 20 4e 6f 77 20 77 65 20 73 | .decoded.message.is.B...Now.we.s |
| 627c0 | 74 61 72 74 20 61 67 61 69 6e 20 61 74 20 74 68 65 20 72 6f 6f 74 2c 20 61 6e 64 20 77 65 20 6d | tart.again.at.the.root,.and.we.m |
| 627e0 | 61 6b 65 20 61 0a 6c 65 66 74 20 6d 6f 76 65 20 62 65 63 61 75 73 65 20 74 68 65 20 6e 65 78 74 | ake.a.left.move.because.the.next |
| 62800 | 20 62 69 74 20 69 6e 20 74 68 65 20 73 74 72 69 6e 67 20 69 73 20 30 2e 20 20 54 68 69 73 20 62 | .bit.in.the.string.is.0...This.b |
| 62820 | 72 69 6e 67 73 20 75 73 20 74 6f 0a 74 68 65 20 6c 65 61 66 20 66 6f 72 20 41 2e 20 20 54 68 65 | rings.us.to.the.leaf.for.A...The |
| 62840 | 6e 20 77 65 20 73 74 61 72 74 20 61 67 61 69 6e 20 61 74 20 74 68 65 20 72 6f 6f 74 20 77 69 74 | n.we.start.again.at.the.root.wit |
| 62860 | 68 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 0a 73 74 72 69 6e 67 20 31 30 31 30 2c 20 73 | h.the.rest.of.the.string.1010,.s |
| 62880 | 6f 20 77 65 20 6d 6f 76 65 20 72 69 67 68 74 2c 20 6c 65 66 74 2c 20 72 69 67 68 74 2c 20 6c 65 | o.we.move.right,.left,.right,.le |
| 628a0 | 66 74 20 61 6e 64 20 72 65 61 63 68 20 43 2e 20 20 54 68 75 73 2c 0a 74 68 65 20 65 6e 74 69 72 | ft.and.reach.C...Thus,.the.entir |
| 628c0 | 65 20 6d 65 73 73 61 67 65 20 69 73 20 42 41 43 2e 0a 0a 47 65 6e 65 72 61 74 69 6e 67 20 48 75 | e.message.is.BAC...Generating.Hu |
| 628e0 | 66 66 6d 61 6e 20 74 72 65 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ffman.trees..................... |
| 62900 | 2e 2e 2e 2e 0a 0a 47 69 76 65 6e 20 61 6e 20 22 61 6c 70 68 61 62 65 74 22 20 6f 66 20 73 79 6d | ......Given.an."alphabet".of.sym |
| 62920 | 62 6f 6c 73 20 61 6e 64 20 74 68 65 69 72 20 72 65 6c 61 74 69 76 65 20 66 72 65 71 75 65 6e 63 | bols.and.their.relative.frequenc |
| 62940 | 69 65 73 2c 20 68 6f 77 20 64 6f 20 77 65 0a 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 22 62 65 | ies,.how.do.we.construct.the."be |
| 62960 | 73 74 22 20 63 6f 64 65 3f 20 20 28 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 77 68 69 63 | st".code?..(In.other.words,.whic |
| 62980 | 68 20 74 72 65 65 20 77 69 6c 6c 20 65 6e 63 6f 64 65 0a 6d 65 73 73 61 67 65 73 20 77 69 74 68 | h.tree.will.encode.messages.with |
| 629a0 | 20 74 68 65 20 66 65 77 65 73 74 20 62 69 74 73 3f 29 20 20 48 75 66 66 6d 61 6e 20 67 61 76 65 | .the.fewest.bits?)..Huffman.gave |
| 629c0 | 20 61 6e 20 61 6c 67 6f 72 69 74 68 6d 20 66 6f 72 20 64 6f 69 6e 67 0a 74 68 69 73 20 61 6e 64 | .an.algorithm.for.doing.this.and |
| 629e0 | 20 73 68 6f 77 65 64 20 74 68 61 74 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 63 6f 64 65 20 | .showed.that.the.resulting.code. |
| 62a00 | 69 73 20 69 6e 64 65 65 64 20 74 68 65 20 62 65 73 74 0a 76 61 72 69 61 62 6c 65 2d 6c 65 6e 67 | is.indeed.the.best.variable-leng |
| 62a20 | 74 68 20 63 6f 64 65 20 66 6f 72 20 6d 65 73 73 61 67 65 73 20 77 68 65 72 65 20 74 68 65 20 72 | th.code.for.messages.where.the.r |
| 62a40 | 65 6c 61 74 69 76 65 20 66 72 65 71 75 65 6e 63 79 20 6f 66 20 74 68 65 0a 73 79 6d 62 6f 6c 73 | elative.frequency.of.the.symbols |
| 62a60 | 20 6d 61 74 63 68 65 73 20 74 68 65 20 66 72 65 71 75 65 6e 63 69 65 73 20 77 69 74 68 20 77 68 | .matches.the.frequencies.with.wh |
| 62a80 | 69 63 68 20 74 68 65 20 63 6f 64 65 20 77 61 73 20 63 6f 6e 73 74 72 75 63 74 65 64 2e 0a 57 65 | ich.the.code.was.constructed..We |
| 62aa0 | 20 77 69 6c 6c 20 6e 6f 74 20 70 72 6f 76 65 20 74 68 69 73 20 6f 70 74 69 6d 61 6c 69 74 79 20 | .will.not.prove.this.optimality. |
| 62ac0 | 6f 66 20 48 75 66 66 6d 61 6e 20 63 6f 64 65 73 20 68 65 72 65 2c 20 62 75 74 20 77 65 20 77 69 | of.Huffman.codes.here,.but.we.wi |
| 62ae0 | 6c 6c 0a 73 68 6f 77 20 68 6f 77 20 48 75 66 66 6d 61 6e 20 74 72 65 65 73 20 61 72 65 20 63 6f | ll.show.how.Huffman.trees.are.co |
| 62b00 | 6e 73 74 72 75 63 74 65 64 2e 28 31 29 0a 0a 20 20 20 54 68 65 20 61 6c 67 6f 72 69 74 68 6d 20 | nstructed.(1).....The.algorithm. |
| 62b20 | 66 6f 72 20 67 65 6e 65 72 61 74 69 6e 67 20 61 20 48 75 66 66 6d 61 6e 20 74 72 65 65 20 69 73 | for.generating.a.Huffman.tree.is |
| 62b40 | 20 76 65 72 79 20 73 69 6d 70 6c 65 2e 20 54 68 65 20 69 64 65 61 0a 69 73 20 74 6f 20 61 72 72 | .very.simple..The.idea.is.to.arr |
| 62b60 | 61 6e 67 65 20 74 68 65 20 74 72 65 65 20 73 6f 20 74 68 61 74 20 74 68 65 20 73 79 6d 62 6f 6c | ange.the.tree.so.that.the.symbol |
| 62b80 | 73 20 77 69 74 68 20 74 68 65 20 6c 6f 77 65 73 74 20 66 72 65 71 75 65 6e 63 79 0a 61 70 70 65 | s.with.the.lowest.frequency.appe |
| 62ba0 | 61 72 20 66 61 72 74 68 65 73 74 20 61 77 61 79 20 66 72 6f 6d 20 74 68 65 20 72 6f 6f 74 2e 20 | ar.farthest.away.from.the.root.. |
| 62bc0 | 42 65 67 69 6e 20 77 69 74 68 20 74 68 65 20 73 65 74 20 6f 66 20 6c 65 61 66 20 6e 6f 64 65 73 | Begin.with.the.set.of.leaf.nodes |
| 62be0 | 2c 0a 63 6f 6e 74 61 69 6e 69 6e 67 20 73 79 6d 62 6f 6c 73 20 61 6e 64 20 74 68 65 69 72 20 66 | ,.containing.symbols.and.their.f |
| 62c00 | 72 65 71 75 65 6e 63 69 65 73 2c 20 61 73 20 64 65 74 65 72 6d 69 6e 65 64 20 62 79 20 74 68 65 | requencies,.as.determined.by.the |
| 62c20 | 20 69 6e 69 74 69 61 6c 0a 64 61 74 61 20 66 72 6f 6d 20 77 68 69 63 68 20 74 68 65 20 63 6f 64 | .initial.data.from.which.the.cod |
| 62c40 | 65 20 69 73 20 74 6f 20 62 65 20 63 6f 6e 73 74 72 75 63 74 65 64 2e 20 4e 6f 77 20 66 69 6e 64 | e.is.to.be.constructed..Now.find |
| 62c60 | 20 74 77 6f 20 6c 65 61 76 65 73 20 77 69 74 68 0a 74 68 65 20 6c 6f 77 65 73 74 20 77 65 69 67 | .two.leaves.with.the.lowest.weig |
| 62c80 | 68 74 73 20 61 6e 64 20 6d 65 72 67 65 20 74 68 65 6d 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 | hts.and.merge.them.to.produce.a. |
| 62ca0 | 6e 6f 64 65 20 74 68 61 74 20 68 61 73 20 74 68 65 73 65 20 74 77 6f 0a 6e 6f 64 65 73 20 61 73 | node.that.has.these.two.nodes.as |
| 62cc0 | 20 69 74 73 20 6c 65 66 74 20 61 6e 64 20 72 69 67 68 74 20 62 72 61 6e 63 68 65 73 2e 20 54 68 | .its.left.and.right.branches..Th |
| 62ce0 | 65 20 77 65 69 67 68 74 20 6f 66 20 74 68 65 20 6e 65 77 20 6e 6f 64 65 20 69 73 20 74 68 65 0a | e.weight.of.the.new.node.is.the. |
| 62d00 | 73 75 6d 20 6f 66 20 74 68 65 20 74 77 6f 20 77 65 69 67 68 74 73 2e 20 52 65 6d 6f 76 65 20 74 | sum.of.the.two.weights..Remove.t |
| 62d20 | 68 65 20 74 77 6f 20 6c 65 61 76 65 73 20 66 72 6f 6d 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 | he.two.leaves.from.the.original. |
| 62d40 | 73 65 74 20 61 6e 64 0a 72 65 70 6c 61 63 65 20 74 68 65 6d 20 62 79 20 74 68 69 73 20 6e 65 77 | set.and.replace.them.by.this.new |
| 62d60 | 20 6e 6f 64 65 2e 20 4e 6f 77 20 63 6f 6e 74 69 6e 75 65 20 74 68 69 73 20 70 72 6f 63 65 73 73 | .node..Now.continue.this.process |
| 62d80 | 2e 20 41 74 20 65 61 63 68 20 73 74 65 70 2c 0a 6d 65 72 67 65 20 74 77 6f 20 6e 6f 64 65 73 20 | ..At.each.step,.merge.two.nodes. |
| 62da0 | 77 69 74 68 20 74 68 65 20 73 6d 61 6c 6c 65 73 74 20 77 65 69 67 68 74 73 2c 20 72 65 6d 6f 76 | with.the.smallest.weights,.remov |
| 62dc0 | 69 6e 67 20 74 68 65 6d 20 66 72 6f 6d 20 74 68 65 20 73 65 74 0a 61 6e 64 20 72 65 70 6c 61 63 | ing.them.from.the.set.and.replac |
| 62de0 | 69 6e 67 20 74 68 65 6d 20 77 69 74 68 20 61 20 6e 6f 64 65 20 74 68 61 74 20 68 61 73 20 74 68 | ing.them.with.a.node.that.has.th |
| 62e00 | 65 73 65 20 74 77 6f 20 61 73 20 69 74 73 20 6c 65 66 74 20 61 6e 64 20 72 69 67 68 74 0a 62 72 | ese.two.as.its.left.and.right.br |
| 62e20 | 61 6e 63 68 65 73 2e 20 54 68 65 20 70 72 6f 63 65 73 73 20 73 74 6f 70 73 20 77 68 65 6e 20 74 | anches..The.process.stops.when.t |
| 62e40 | 68 65 72 65 20 69 73 20 6f 6e 6c 79 20 6f 6e 65 20 6e 6f 64 65 20 6c 65 66 74 2c 20 77 68 69 63 | here.is.only.one.node.left,.whic |
| 62e60 | 68 20 69 73 0a 74 68 65 20 72 6f 6f 74 20 6f 66 20 74 68 65 20 65 6e 74 69 72 65 20 74 72 65 65 | h.is.the.root.of.the.entire.tree |
| 62e80 | 2e 20 20 48 65 72 65 20 69 73 20 68 6f 77 20 74 68 65 20 48 75 66 66 6d 61 6e 20 74 72 65 65 20 | ...Here.is.how.the.Huffman.tree. |
| 62ea0 | 6f 66 20 2a 4e 6f 74 65 0a 46 69 67 75 72 65 20 32 2d 31 38 3a 3a 20 77 61 73 20 67 65 6e 65 72 | of.*Note.Figure.2-18::.was.gener |
| 62ec0 | 61 74 65 64 3a 0a 0a 20 20 20 20 20 49 6e 69 74 69 61 6c 20 6c 65 61 76 65 73 20 7b 28 41 20 38 | ated:.......Initial.leaves.{(A.8 |
| 62ee0 | 29 20 28 42 20 33 29 20 28 43 20 31 29 20 28 44 20 31 29 20 28 45 20 31 29 20 28 46 20 31 29 20 | ).(B.3).(C.1).(D.1).(E.1).(F.1). |
| 62f00 | 28 47 20 31 29 20 28 48 20 31 29 7d 0a 20 20 20 20 20 4d 65 72 67 65 20 20 20 20 20 20 20 20 20 | (G.1).(H.1)}......Merge......... |
| 62f20 | 20 7b 28 41 20 38 29 20 28 42 20 33 29 20 28 7b 43 20 44 7d 20 32 29 20 28 45 20 31 29 20 28 46 | .{(A.8).(B.3).({C.D}.2).(E.1).(F |
| 62f40 | 20 31 29 20 28 47 20 31 29 20 28 48 20 31 29 7d 0a 20 20 20 20 20 4d 65 72 67 65 20 20 20 20 20 | .1).(G.1).(H.1)}......Merge..... |
| 62f60 | 20 20 20 20 20 7b 28 41 20 38 29 20 28 42 20 33 29 20 28 7b 43 20 44 7d 20 32 29 20 28 7b 45 20 | .....{(A.8).(B.3).({C.D}.2).({E. |
| 62f80 | 46 7d 20 32 29 20 28 47 20 31 29 20 28 48 20 31 29 7d 0a 20 20 20 20 20 4d 65 72 67 65 20 20 20 | F}.2).(G.1).(H.1)}......Merge... |
| 62fa0 | 20 20 20 20 20 20 20 7b 28 41 20 38 29 20 28 42 20 33 29 20 28 7b 43 20 44 7d 20 32 29 20 28 7b | .......{(A.8).(B.3).({C.D}.2).({ |
| 62fc0 | 45 20 46 7d 20 32 29 20 28 7b 47 20 48 7d 20 32 29 7d 0a 20 20 20 20 20 4d 65 72 67 65 20 20 20 | E.F}.2).({G.H}.2)}......Merge... |
| 62fe0 | 20 20 20 20 20 20 20 7b 28 41 20 38 29 20 28 42 20 33 29 20 28 7b 43 20 44 7d 20 32 29 20 28 7b | .......{(A.8).(B.3).({C.D}.2).({ |
| 63000 | 45 20 46 20 47 20 48 7d 20 34 29 7d 0a 20 20 20 20 20 4d 65 72 67 65 20 20 20 20 20 20 20 20 20 | E.F.G.H}.4)}......Merge......... |
| 63020 | 20 7b 28 41 20 38 29 20 28 7b 42 20 43 20 44 7d 20 35 29 20 28 7b 45 20 46 20 47 20 48 7d 20 34 | .{(A.8).({B.C.D}.5).({E.F.G.H}.4 |
| 63040 | 29 7d 0a 20 20 20 20 20 4d 65 72 67 65 20 20 20 20 20 20 20 20 20 20 7b 28 41 20 38 29 20 28 7b | )}......Merge..........{(A.8).({ |
| 63060 | 42 20 43 20 44 20 45 20 46 20 47 20 48 7d 20 39 29 7d 0a 20 20 20 20 20 46 69 6e 61 6c 20 6d 65 | B.C.D.E.F.G.H}.9)}......Final.me |
| 63080 | 72 67 65 20 20 20 20 7b 28 7b 41 20 42 20 43 20 44 20 45 20 46 20 47 20 48 7d 20 31 37 29 7d 0a | rge....{({A.B.C.D.E.F.G.H}.17)}. |
| 630a0 | 0a 20 20 20 54 68 65 20 61 6c 67 6f 72 69 74 68 6d 20 64 6f 65 73 20 6e 6f 74 20 61 6c 77 61 79 | ....The.algorithm.does.not.alway |
| 630c0 | 73 20 73 70 65 63 69 66 79 20 61 20 75 6e 69 71 75 65 20 74 72 65 65 2c 20 62 65 63 61 75 73 65 | s.specify.a.unique.tree,.because |
| 630e0 | 20 74 68 65 72 65 0a 6d 61 79 20 6e 6f 74 20 62 65 20 75 6e 69 71 75 65 20 73 6d 61 6c 6c 65 73 | .there.may.not.be.unique.smalles |
| 63100 | 74 2d 77 65 69 67 68 74 20 6e 6f 64 65 73 20 61 74 20 65 61 63 68 20 73 74 65 70 2e 20 20 41 6c | t-weight.nodes.at.each.step...Al |
| 63120 | 73 6f 2c 20 74 68 65 20 63 68 6f 69 63 65 0a 6f 66 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 | so,.the.choice.of.the.order.in.w |
| 63140 | 68 69 63 68 20 74 68 65 20 74 77 6f 20 6e 6f 64 65 73 20 61 72 65 20 6d 65 72 67 65 64 20 28 69 | hich.the.two.nodes.are.merged.(i |
| 63160 | 2e 65 2e 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 62 65 20 74 68 65 0a 72 69 67 68 74 20 62 72 61 | .e.,.which.will.be.the.right.bra |
| 63180 | 6e 63 68 20 61 6e 64 20 77 68 69 63 68 20 77 69 6c 6c 20 62 65 20 74 68 65 20 6c 65 66 74 20 62 | nch.and.which.will.be.the.left.b |
| 631a0 | 72 61 6e 63 68 29 20 69 73 20 61 72 62 69 74 72 61 72 79 2e 0a 0a 52 65 70 72 65 73 65 6e 74 69 | ranch).is.arbitrary...Representi |
| 631c0 | 6e 67 20 48 75 66 66 6d 61 6e 20 74 72 65 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ng.Huffman.trees................ |
| 631e0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 74 68 65 20 65 78 65 72 63 69 73 65 73 20 62 65 | .............In.the.exercises.be |
| 63200 | 6c 6f 77 20 77 65 20 77 69 6c 6c 20 77 6f 72 6b 20 77 69 74 68 20 61 20 73 79 73 74 65 6d 20 74 | low.we.will.work.with.a.system.t |
| 63220 | 68 61 74 20 75 73 65 73 20 48 75 66 66 6d 61 6e 0a 74 72 65 65 73 20 74 6f 20 65 6e 63 6f 64 65 | hat.uses.Huffman.trees.to.encode |
| 63240 | 20 61 6e 64 20 64 65 63 6f 64 65 20 6d 65 73 73 61 67 65 73 20 61 6e 64 20 67 65 6e 65 72 61 74 | .and.decode.messages.and.generat |
| 63260 | 65 73 20 48 75 66 66 6d 61 6e 20 74 72 65 65 73 0a 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 | es.Huffman.trees.according.to.th |
| 63280 | 65 20 61 6c 67 6f 72 69 74 68 6d 20 6f 75 74 6c 69 6e 65 64 20 61 62 6f 76 65 2e 20 20 57 65 20 | e.algorithm.outlined.above...We. |
| 632a0 | 77 69 6c 6c 20 62 65 67 69 6e 20 62 79 20 64 69 73 63 75 73 73 69 6e 67 0a 68 6f 77 20 74 72 65 | will.begin.by.discussing.how.tre |
| 632c0 | 65 73 20 61 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 2e 0a 0a 20 20 20 4c 65 61 76 65 73 20 6f | es.are.represented......Leaves.o |
| 632e0 | 66 20 74 68 65 20 74 72 65 65 20 61 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 61 20 | f.the.tree.are.represented.by.a. |
| 63300 | 6c 69 73 74 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 74 68 65 20 73 79 6d 62 6f 6c 0a 60 6c | list.consisting.of.the.symbol.`l |
| 63320 | 65 61 66 27 2c 20 74 68 65 20 73 79 6d 62 6f 6c 20 61 74 20 74 68 65 20 6c 65 61 66 2c 20 61 6e | eaf',.the.symbol.at.the.leaf,.an |
| 63340 | 64 20 74 68 65 20 77 65 69 67 68 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b | d.the.weight:.......(define.(mak |
| 63360 | 65 2d 6c 65 61 66 20 73 79 6d 62 6f 6c 20 77 65 69 67 68 74 29 0a 20 20 20 20 20 20 20 28 6c 69 | e-leaf.symbol.weight)........(li |
| 63380 | 73 74 20 27 6c 65 61 66 20 73 79 6d 62 6f 6c 20 77 65 69 67 68 74 29 29 0a 0a 20 20 20 20 20 28 | st.'leaf.symbol.weight)).......( |
| 633a0 | 64 65 66 69 6e 65 20 28 6c 65 61 66 3f 20 6f 62 6a 65 63 74 29 0a 20 20 20 20 20 20 20 28 65 71 | define.(leaf?.object)........(eq |
| 633c0 | 3f 20 28 63 61 72 20 6f 62 6a 65 63 74 29 20 27 6c 65 61 66 29 29 0a 0a 20 20 20 20 20 28 64 65 | ?.(car.object).'leaf)).......(de |
| 633e0 | 66 69 6e 65 20 28 73 79 6d 62 6f 6c 2d 6c 65 61 66 20 78 29 20 28 63 61 64 72 20 78 29 29 0a 0a | fine.(symbol-leaf.x).(cadr.x)).. |
| 63400 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 77 65 69 67 68 74 2d 6c 65 61 66 20 78 29 20 28 63 61 | .....(define.(weight-leaf.x).(ca |
| 63420 | 64 64 72 20 78 29 29 0a 0a 20 20 20 41 20 67 65 6e 65 72 61 6c 20 74 72 65 65 20 77 69 6c 6c 20 | ddr.x)).....A.general.tree.will. |
| 63440 | 62 65 20 61 20 6c 69 73 74 20 6f 66 20 61 20 6c 65 66 74 20 62 72 61 6e 63 68 2c 20 61 20 72 69 | be.a.list.of.a.left.branch,.a.ri |
| 63460 | 67 68 74 20 62 72 61 6e 63 68 2c 20 61 0a 73 65 74 20 6f 66 20 73 79 6d 62 6f 6c 73 2c 20 61 6e | ght.branch,.a.set.of.symbols,.an |
| 63480 | 64 20 61 20 77 65 69 67 68 74 2e 20 20 54 68 65 20 73 65 74 20 6f 66 20 73 79 6d 62 6f 6c 73 20 | d.a.weight...The.set.of.symbols. |
| 634a0 | 77 69 6c 6c 20 62 65 20 73 69 6d 70 6c 79 20 61 20 6c 69 73 74 0a 6f 66 20 74 68 65 20 73 79 6d | will.be.simply.a.list.of.the.sym |
| 634c0 | 62 6f 6c 73 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 73 6f 6d 65 20 6d 6f 72 65 20 73 6f 70 68 | bols,.rather.than.some.more.soph |
| 634e0 | 69 73 74 69 63 61 74 65 64 20 73 65 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 0a 57 68 | isticated.set.representation..Wh |
| 63500 | 65 6e 20 77 65 20 6d 61 6b 65 20 61 20 74 72 65 65 20 62 79 20 6d 65 72 67 69 6e 67 20 74 77 6f | en.we.make.a.tree.by.merging.two |
| 63520 | 20 6e 6f 64 65 73 2c 20 77 65 20 6f 62 74 61 69 6e 20 74 68 65 20 77 65 69 67 68 74 20 6f 66 20 | .nodes,.we.obtain.the.weight.of. |
| 63540 | 74 68 65 0a 74 72 65 65 20 61 73 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 77 65 69 67 68 | the.tree.as.the.sum.of.the.weigh |
| 63560 | 74 73 20 6f 66 20 74 68 65 20 6e 6f 64 65 73 2c 20 61 6e 64 20 74 68 65 20 73 65 74 20 6f 66 20 | ts.of.the.nodes,.and.the.set.of. |
| 63580 | 73 79 6d 62 6f 6c 73 20 61 73 0a 74 68 65 20 75 6e 69 6f 6e 20 6f 66 20 74 68 65 20 73 65 74 73 | symbols.as.the.union.of.the.sets |
| 635a0 | 20 6f 66 20 73 79 6d 62 6f 6c 73 20 66 6f 72 20 74 68 65 20 6e 6f 64 65 73 2e 20 20 53 69 6e 63 | .of.symbols.for.the.nodes...Sinc |
| 635c0 | 65 20 6f 75 72 20 73 79 6d 62 6f 6c 20 73 65 74 73 0a 61 72 65 20 72 65 70 72 65 73 65 6e 74 65 | e.our.symbol.sets.are.represente |
| 635e0 | 64 20 61 73 20 6c 69 73 74 73 2c 20 77 65 20 63 61 6e 20 66 6f 72 6d 20 74 68 65 20 75 6e 69 6f | d.as.lists,.we.can.form.the.unio |
| 63600 | 6e 20 62 79 20 75 73 69 6e 67 20 74 68 65 20 60 61 70 70 65 6e 64 27 0a 70 72 6f 63 65 64 75 72 | n.by.using.the.`append'.procedur |
| 63620 | 65 20 77 65 20 64 65 66 69 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d | e.we.defined.in.section.*Note.2- |
| 63640 | 32 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 63 6f 64 65 2d | 2-1:::.......(define.(make-code- |
| 63660 | 74 72 65 65 20 6c 65 66 74 20 72 69 67 68 74 29 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 6c 65 | tree.left.right)........(list.le |
| 63680 | 66 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 72 69 67 68 74 0a 20 20 20 20 20 20 20 20 20 20 | ft..............right........... |
| 636a0 | 20 20 20 28 61 70 70 65 6e 64 20 28 73 79 6d 62 6f 6c 73 20 6c 65 66 74 29 20 28 73 79 6d 62 6f | ...(append.(symbols.left).(symbo |
| 636c0 | 6c 73 20 72 69 67 68 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 77 65 69 67 | ls.right))..............(+.(weig |
| 636e0 | 68 74 20 6c 65 66 74 29 20 28 77 65 69 67 68 74 20 72 69 67 68 74 29 29 29 29 0a 0a 20 20 20 49 | ht.left).(weight.right)))).....I |
| 63700 | 66 20 77 65 20 6d 61 6b 65 20 61 20 74 72 65 65 20 69 6e 20 74 68 69 73 20 77 61 79 2c 20 77 65 | f.we.make.a.tree.in.this.way,.we |
| 63720 | 20 68 61 76 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 65 6c 65 63 74 6f 72 73 3a 0a 0a | .have.the.following.selectors:.. |
| 63740 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 65 66 74 2d 62 72 61 6e 63 68 20 74 72 65 65 29 20 | .....(define.(left-branch.tree). |
| 63760 | 28 63 61 72 20 74 72 65 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 69 67 68 74 | (car.tree)).......(define.(right |
| 63780 | 2d 62 72 61 6e 63 68 20 74 72 65 65 29 20 28 63 61 64 72 20 74 72 65 65 29 29 0a 0a 20 20 20 20 | -branch.tree).(cadr.tree))...... |
| 637a0 | 20 28 64 65 66 69 6e 65 20 28 73 79 6d 62 6f 6c 73 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 28 | .(define.(symbols.tree)........( |
| 637c0 | 69 66 20 28 6c 65 61 66 3f 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 | if.(leaf?.tree)............(list |
| 637e0 | 20 28 73 79 6d 62 6f 6c 2d 6c 65 61 66 20 74 72 65 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(symbol-leaf.tree))............ |
| 63800 | 28 63 61 64 64 72 20 74 72 65 65 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 77 65 | (caddr.tree))).......(define.(we |
| 63820 | 69 67 68 74 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6c 65 61 66 3f 20 74 72 65 | ight.tree)........(if.(leaf?.tre |
| 63840 | 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 77 65 69 67 68 74 2d 6c 65 61 66 20 74 72 65 65 29 | e)............(weight-leaf.tree) |
| 63860 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 61 64 64 64 72 20 74 72 65 65 29 29 29 0a 0a 20 20 20 | ............(cadddr.tree)))..... |
| 63880 | 54 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 73 79 6d 62 6f 6c 73 27 20 61 6e 64 20 60 77 65 | The.procedures.`symbols'.and.`we |
| 638a0 | 69 67 68 74 27 20 6d 75 73 74 20 64 6f 20 73 6f 6d 65 74 68 69 6e 67 20 73 6c 69 67 68 74 6c 79 | ight'.must.do.something.slightly |
| 638c0 | 0a 64 69 66 66 65 72 65 6e 74 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 77 68 65 74 68 65 72 20 | .different.depending.on.whether. |
| 638e0 | 74 68 65 79 20 61 72 65 20 63 61 6c 6c 65 64 20 77 69 74 68 20 61 20 6c 65 61 66 20 6f 72 20 61 | they.are.called.with.a.leaf.or.a |
| 63900 | 20 67 65 6e 65 72 61 6c 0a 74 72 65 65 2e 20 20 54 68 65 73 65 20 61 72 65 20 73 69 6d 70 6c 65 | .general.tree...These.are.simple |
| 63920 | 20 65 78 61 6d 70 6c 65 73 20 6f 66 20 22 67 65 6e 65 72 69 63 20 70 72 6f 63 65 64 75 72 65 73 | .examples.of."generic.procedures |
| 63940 | 22 20 28 70 72 6f 63 65 64 75 72 65 73 0a 74 68 61 74 20 63 61 6e 20 68 61 6e 64 6c 65 20 6d 6f | ".(procedures.that.can.handle.mo |
| 63960 | 72 65 20 74 68 61 6e 20 6f 6e 65 20 6b 69 6e 64 20 6f 66 20 64 61 74 61 29 2c 20 77 68 69 63 68 | re.than.one.kind.of.data),.which |
| 63980 | 20 77 65 20 77 69 6c 6c 20 68 61 76 65 20 6d 75 63 68 0a 6d 6f 72 65 20 74 6f 20 73 61 79 20 61 | .we.will.have.much.more.to.say.a |
| 639a0 | 62 6f 75 74 20 69 6e 20 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 20 32 2d 34 3a 3a 20 61 6e 64 | bout.in.sections.*Note.2-4::.and |
| 639c0 | 20 2a 4e 6f 74 65 20 32 2d 35 3a 3a 2e 0a 0a 54 68 65 20 64 65 63 6f 64 69 6e 67 20 70 72 6f 63 | .*Note.2-5::...The.decoding.proc |
| 639e0 | 65 64 75 72 65 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 | edure.........................Th |
| 63a00 | 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 69 6d 70 6c 65 6d 65 6e 74 73 | e.following.procedure.implements |
| 63a20 | 20 74 68 65 20 64 65 63 6f 64 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 2e 20 20 49 74 20 74 61 6b | .the.decoding.algorithm...It.tak |
| 63a40 | 65 73 20 61 73 0a 61 72 67 75 6d 65 6e 74 73 20 61 20 6c 69 73 74 20 6f 66 20 7a 65 72 6f 73 20 | es.as.arguments.a.list.of.zeros. |
| 63a60 | 61 6e 64 20 6f 6e 65 73 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 20 48 75 66 66 6d 61 | and.ones,.together.with.a.Huffma |
| 63a80 | 6e 20 74 72 65 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 63 6f 64 65 20 62 69 | n.tree........(define.(decode.bi |
| 63aa0 | 74 73 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 63 6f 64 65 2d | ts.tree)........(define.(decode- |
| 63ac0 | 31 20 62 69 74 73 20 63 75 72 72 65 6e 74 2d 62 72 61 6e 63 68 29 0a 20 20 20 20 20 20 20 20 20 | 1.bits.current-branch).......... |
| 63ae0 | 28 69 66 20 28 6e 75 6c 6c 3f 20 62 69 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 27 28 | (if.(null?.bits)..............'( |
| 63b00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 78 74 2d 62 72 61 6e 63 | )..............(let.((next-branc |
| 63b20 | 68 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 68 6f 6f 73 65 2d 62 72 | h.....................(choose-br |
| 63b40 | 61 6e 63 68 20 28 63 61 72 20 62 69 74 73 29 20 63 75 72 72 65 6e 74 2d 62 72 61 6e 63 68 29 29 | anch.(car.bits).current-branch)) |
| 63b60 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6c 65 61 66 3f 20 6e 65 78 74 | )................(if.(leaf?.next |
| 63b80 | 2d 62 72 61 6e 63 68 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e | -branch)....................(con |
| 63ba0 | 73 20 28 73 79 6d 62 6f 6c 2d 6c 65 61 66 20 6e 65 78 74 2d 62 72 61 6e 63 68 29 0a 20 20 20 20 | s.(symbol-leaf.next-branch)..... |
| 63bc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 63 6f 64 65 2d 31 20 28 | .....................(decode-1.( |
| 63be0 | 63 64 72 20 62 69 74 73 29 20 74 72 65 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | cdr.bits).tree))................ |
| 63c00 | 20 20 20 20 28 64 65 63 6f 64 65 2d 31 20 28 63 64 72 20 62 69 74 73 29 20 6e 65 78 74 2d 62 72 | ....(decode-1.(cdr.bits).next-br |
| 63c20 | 61 6e 63 68 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 63 6f 64 65 2d 31 20 62 69 74 73 20 | anch)))))........(decode-1.bits. |
| 63c40 | 74 72 65 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 68 6f 6f 73 65 2d 62 72 61 | tree)).......(define.(choose-bra |
| 63c60 | 6e 63 68 20 62 69 74 20 62 72 61 6e 63 68 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d | nch.bit.branch)........(cond.((= |
| 63c80 | 20 62 69 74 20 30 29 20 28 6c 65 66 74 2d 62 72 61 6e 63 68 20 62 72 61 6e 63 68 29 29 0a 20 20 | .bit.0).(left-branch.branch))... |
| 63ca0 | 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 20 62 69 74 20 31 29 20 28 72 69 67 68 74 2d 62 72 61 | ...........((=.bit.1).(right-bra |
| 63cc0 | 6e 63 68 20 62 72 61 6e 63 68 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 | nch.branch))..............(else. |
| 63ce0 | 28 65 72 72 6f 72 20 22 62 61 64 20 62 69 74 20 2d 2d 20 43 48 4f 4f 53 45 2d 42 52 41 4e 43 48 | (error."bad.bit.--.CHOOSE-BRANCH |
| 63d00 | 22 20 62 69 74 29 29 29 29 0a 0a 20 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 64 65 63 | ".bit)))).....The.procedure.`dec |
| 63d20 | 6f 64 65 2d 31 27 20 74 61 6b 65 73 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 3a 20 74 68 65 20 | ode-1'.takes.two.arguments:.the. |
| 63d40 | 6c 69 73 74 20 6f 66 20 72 65 6d 61 69 6e 69 6e 67 0a 62 69 74 73 20 61 6e 64 20 74 68 65 20 63 | list.of.remaining.bits.and.the.c |
| 63d60 | 75 72 72 65 6e 74 20 70 6f 73 69 74 69 6f 6e 20 69 6e 20 74 68 65 20 74 72 65 65 2e 20 20 49 74 | urrent.position.in.the.tree...It |
| 63d80 | 20 6b 65 65 70 73 20 6d 6f 76 69 6e 67 20 22 64 6f 77 6e 22 20 74 68 65 0a 74 72 65 65 2c 20 63 | .keeps.moving."down".the.tree,.c |
| 63da0 | 68 6f 6f 73 69 6e 67 20 61 20 6c 65 66 74 20 6f 72 20 61 20 72 69 67 68 74 20 62 72 61 6e 63 68 | hoosing.a.left.or.a.right.branch |
| 63dc0 | 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 77 68 65 74 68 65 72 20 74 68 65 20 6e 65 78 74 0a 62 | .according.to.whether.the.next.b |
| 63de0 | 69 74 20 69 6e 20 74 68 65 20 6c 69 73 74 20 69 73 20 61 20 7a 65 72 6f 20 6f 72 20 61 20 6f 6e | it.in.the.list.is.a.zero.or.a.on |
| 63e00 | 65 2e 20 20 28 54 68 69 73 20 69 73 20 64 6f 6e 65 20 77 69 74 68 20 74 68 65 20 70 72 6f 63 65 | e...(This.is.done.with.the.proce |
| 63e20 | 64 75 72 65 0a 60 63 68 6f 6f 73 65 2d 62 72 61 6e 63 68 27 2e 29 20 20 57 68 65 6e 20 69 74 20 | dure.`choose-branch'.)..When.it. |
| 63e40 | 72 65 61 63 68 65 73 20 61 20 6c 65 61 66 2c 20 69 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 | reaches.a.leaf,.it.returns.the.s |
| 63e60 | 79 6d 62 6f 6c 20 61 74 0a 74 68 61 74 20 6c 65 61 66 20 61 73 20 74 68 65 20 6e 65 78 74 20 73 | ymbol.at.that.leaf.as.the.next.s |
| 63e80 | 79 6d 62 6f 6c 20 69 6e 20 74 68 65 20 6d 65 73 73 61 67 65 20 62 79 20 60 63 6f 6e 73 27 69 6e | ymbol.in.the.message.by.`cons'in |
| 63ea0 | 67 20 69 74 20 6f 6e 74 6f 20 74 68 65 0a 72 65 73 75 6c 74 20 6f 66 20 64 65 63 6f 64 69 6e 67 | g.it.onto.the.result.of.decoding |
| 63ec0 | 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 6d 65 73 73 61 67 65 2c 20 73 74 61 72 74 69 | .the.rest.of.the.message,.starti |
| 63ee0 | 6e 67 20 61 74 20 74 68 65 20 72 6f 6f 74 20 6f 66 20 74 68 65 0a 74 72 65 65 2e 20 20 4e 6f 74 | ng.at.the.root.of.the.tree...Not |
| 63f00 | 65 20 74 68 65 20 65 72 72 6f 72 20 63 68 65 63 6b 20 69 6e 20 74 68 65 20 66 69 6e 61 6c 20 63 | e.the.error.check.in.the.final.c |
| 63f20 | 6c 61 75 73 65 20 6f 66 20 60 63 68 6f 6f 73 65 2d 62 72 61 6e 63 68 27 2c 0a 77 68 69 63 68 20 | lause.of.`choose-branch',.which. |
| 63f40 | 63 6f 6d 70 6c 61 69 6e 73 20 69 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 66 69 6e 64 73 | complains.if.the.procedure.finds |
| 63f60 | 20 73 6f 6d 65 74 68 69 6e 67 20 6f 74 68 65 72 20 74 68 61 6e 20 61 20 7a 65 72 6f 20 6f 72 20 | .something.other.than.a.zero.or. |
| 63f80 | 61 0a 6f 6e 65 20 69 6e 20 74 68 65 20 69 6e 70 75 74 20 64 61 74 61 2e 0a 0a 53 65 74 73 20 6f | a.one.in.the.input.data...Sets.o |
| 63fa0 | 66 20 77 65 69 67 68 74 65 64 20 65 6c 65 6d 65 6e 74 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | f.weighted.elements............. |
| 63fc0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 6f 75 72 20 72 65 70 72 65 73 65 6e 74 61 | ...............In.our.representa |
| 63fe0 | 74 69 6f 6e 20 6f 66 20 74 72 65 65 73 2c 20 65 61 63 68 20 6e 6f 6e 2d 6c 65 61 66 20 6e 6f 64 | tion.of.trees,.each.non-leaf.nod |
| 64000 | 65 20 63 6f 6e 74 61 69 6e 73 20 61 20 73 65 74 20 6f 66 0a 73 79 6d 62 6f 6c 73 2c 20 77 68 69 | e.contains.a.set.of.symbols,.whi |
| 64020 | 63 68 20 77 65 20 68 61 76 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 73 69 6d 70 | ch.we.have.represented.as.a.simp |
| 64040 | 6c 65 20 6c 69 73 74 2e 20 20 48 6f 77 65 76 65 72 2c 20 74 68 65 0a 74 72 65 65 2d 67 65 6e 65 | le.list...However,.the.tree-gene |
| 64060 | 72 61 74 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 20 64 69 73 63 75 73 73 65 64 20 61 62 6f 76 65 | rating.algorithm.discussed.above |
| 64080 | 20 72 65 71 75 69 72 65 73 20 74 68 61 74 20 77 65 20 61 6c 73 6f 20 77 6f 72 6b 0a 77 69 74 68 | .requires.that.we.also.work.with |
| 640a0 | 20 73 65 74 73 20 6f 66 20 6c 65 61 76 65 73 20 61 6e 64 20 74 72 65 65 73 2c 20 73 75 63 63 65 | .sets.of.leaves.and.trees,.succe |
| 640c0 | 73 73 69 76 65 6c 79 20 6d 65 72 67 69 6e 67 20 74 68 65 20 74 77 6f 20 73 6d 61 6c 6c 65 73 74 | ssively.merging.the.two.smallest |
| 640e0 | 0a 69 74 65 6d 73 2e 20 20 53 69 6e 63 65 20 77 65 20 77 69 6c 6c 20 62 65 20 72 65 71 75 69 72 | .items...Since.we.will.be.requir |
| 64100 | 65 64 20 74 6f 20 72 65 70 65 61 74 65 64 6c 79 20 66 69 6e 64 20 74 68 65 20 73 6d 61 6c 6c 65 | ed.to.repeatedly.find.the.smalle |
| 64120 | 73 74 20 69 74 65 6d 0a 69 6e 20 61 20 73 65 74 2c 20 69 74 20 69 73 20 63 6f 6e 76 65 6e 69 65 | st.item.in.a.set,.it.is.convenie |
| 64140 | 6e 74 20 74 6f 20 75 73 65 20 61 6e 20 6f 72 64 65 72 65 64 20 72 65 70 72 65 73 65 6e 74 61 74 | nt.to.use.an.ordered.representat |
| 64160 | 69 6f 6e 20 66 6f 72 20 74 68 69 73 0a 6b 69 6e 64 20 6f 66 20 73 65 74 2e 0a 0a 20 20 20 57 65 | ion.for.this.kind.of.set......We |
| 64180 | 20 77 69 6c 6c 20 72 65 70 72 65 73 65 6e 74 20 61 20 73 65 74 20 6f 66 20 6c 65 61 76 65 73 20 | .will.represent.a.set.of.leaves. |
| 641a0 | 61 6e 64 20 74 72 65 65 73 20 61 73 20 61 20 6c 69 73 74 20 6f 66 20 65 6c 65 6d 65 6e 74 73 2c | and.trees.as.a.list.of.elements, |
| 641c0 | 0a 61 72 72 61 6e 67 65 64 20 69 6e 20 69 6e 63 72 65 61 73 69 6e 67 20 6f 72 64 65 72 20 6f 66 | .arranged.in.increasing.order.of |
| 641e0 | 20 77 65 69 67 68 74 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 60 61 64 6a 6f 69 6e 2d | .weight...The.following.`adjoin- |
| 64200 | 73 65 74 27 0a 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 | set'.procedure.for.constructing. |
| 64220 | 73 65 74 73 20 69 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 6f 6e 65 20 64 65 73 63 72 | sets.is.similar.to.the.one.descr |
| 64240 | 69 62 65 64 20 69 6e 0a 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 36 31 3a 3a 3b 20 68 | ibed.in.*Note.Exercise.2-61::;.h |
| 64260 | 6f 77 65 76 65 72 2c 20 69 74 65 6d 73 20 61 72 65 20 63 6f 6d 70 61 72 65 64 20 62 79 20 74 68 | owever,.items.are.compared.by.th |
| 64280 | 65 69 72 20 77 65 69 67 68 74 73 2c 0a 61 6e 64 20 74 68 65 20 65 6c 65 6d 65 6e 74 20 62 65 69 | eir.weights,.and.the.element.bei |
| 642a0 | 6e 67 20 61 64 64 65 64 20 74 6f 20 74 68 65 20 73 65 74 20 69 73 20 6e 65 76 65 72 20 61 6c 72 | ng.added.to.the.set.is.never.alr |
| 642c0 | 65 61 64 79 20 69 6e 20 69 74 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 6a 6f 69 | eady.in.it........(define.(adjoi |
| 642e0 | 6e 2d 73 65 74 20 78 20 73 65 74 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c | n-set.x.set)........(cond.((null |
| 64300 | 3f 20 73 65 74 29 20 28 6c 69 73 74 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | ?.set).(list.x))..............(( |
| 64320 | 3c 20 28 77 65 69 67 68 74 20 78 29 20 28 77 65 69 67 68 74 20 28 63 61 72 20 73 65 74 29 29 29 | <.(weight.x).(weight.(car.set))) |
| 64340 | 20 28 63 6f 6e 73 20 78 20 73 65 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 | .(cons.x.set))..............(els |
| 64360 | 65 20 28 63 6f 6e 73 20 28 63 61 72 20 73 65 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e.(cons.(car.set)............... |
| 64380 | 20 20 20 20 20 20 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d 73 65 74 20 78 20 28 63 64 72 20 73 65 | ...........(adjoin-set.x.(cdr.se |
| 643a0 | 74 29 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 | t)))))).....The.following.proced |
| 643c0 | 75 72 65 20 74 61 6b 65 73 20 61 20 6c 69 73 74 20 6f 66 20 73 79 6d 62 6f 6c 2d 66 72 65 71 75 | ure.takes.a.list.of.symbol-frequ |
| 643e0 | 65 6e 63 79 20 70 61 69 72 73 20 73 75 63 68 0a 61 73 20 60 28 28 41 20 34 29 20 28 42 20 32 29 | ency.pairs.such.as.`((A.4).(B.2) |
| 64400 | 20 28 43 20 31 29 20 28 44 20 31 29 29 27 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 73 20 61 6e | .(C.1).(D.1))'.and.constructs.an |
| 64420 | 20 69 6e 69 74 69 61 6c 20 6f 72 64 65 72 65 64 20 73 65 74 20 6f 66 0a 6c 65 61 76 65 73 2c 20 | .initial.ordered.set.of.leaves,. |
| 64440 | 72 65 61 64 79 20 74 6f 20 62 65 20 6d 65 72 67 65 64 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 | ready.to.be.merged.according.to. |
| 64460 | 74 68 65 20 48 75 66 66 6d 61 6e 20 61 6c 67 6f 72 69 74 68 6d 3a 0a 0a 20 20 20 20 20 28 64 65 | the.Huffman.algorithm:.......(de |
| 64480 | 66 69 6e 65 20 28 6d 61 6b 65 2d 6c 65 61 66 2d 73 65 74 20 70 61 69 72 73 29 0a 20 20 20 20 20 | fine.(make-leaf-set.pairs)...... |
| 644a0 | 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 61 69 72 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 | ..(if.(null?.pairs)............' |
| 644c0 | 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 61 69 72 20 28 63 61 72 20 70 | ()............(let.((pair.(car.p |
| 644e0 | 61 69 72 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d 73 65 74 | airs)))..............(adjoin-set |
| 64500 | 20 28 6d 61 6b 65 2d 6c 65 61 66 20 28 63 61 72 20 70 61 69 72 29 20 20 20 20 3b 20 73 79 6d 62 | .(make-leaf.(car.pair)....;.symb |
| 64520 | 6f 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ol.............................. |
| 64540 | 20 20 20 20 20 20 20 28 63 61 64 72 20 70 61 69 72 29 29 20 20 3b 20 66 72 65 71 75 65 6e 63 79 | .......(cadr.pair))..;.frequency |
| 64560 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d | ..........................(make- |
| 64580 | 6c 65 61 66 2d 73 65 74 20 28 63 64 72 20 70 61 69 72 73 29 29 29 29 29 29 0a 0a 20 20 20 20 20 | leaf-set.(cdr.pairs))))))....... |
| 645a0 | 2a 45 78 65 72 63 69 73 65 20 32 2e 36 37 3a 2a 20 44 65 66 69 6e 65 20 61 6e 20 65 6e 63 6f 64 | *Exercise.2.67:*.Define.an.encod |
| 645c0 | 69 6e 67 20 74 72 65 65 20 61 6e 64 20 61 20 73 61 6d 70 6c 65 20 6d 65 73 73 61 67 65 3a 0a 0a | ing.tree.and.a.sample.message:.. |
| 645e0 | 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 61 6d 70 6c 65 2d 74 72 65 65 0a 20 20 | ..........(define.sample-tree... |
| 64600 | 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 63 6f 64 65 2d 74 72 65 65 20 28 6d 61 6b 65 2d | ..........(make-code-tree.(make- |
| 64620 | 6c 65 61 66 20 27 41 20 34 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | leaf.'A.4)...................... |
| 64640 | 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 63 6f 64 65 2d 74 72 65 65 0a 20 20 20 20 20 20 20 20 20 | .......(make-code-tree.......... |
| 64660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 6c 65 61 66 20 27 | ....................(make-leaf.' |
| 64680 | 42 20 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | B.2)............................ |
| 646a0 | 20 20 28 6d 61 6b 65 2d 63 6f 64 65 2d 74 72 65 65 20 28 6d 61 6b 65 2d 6c 65 61 66 20 27 44 20 | ..(make-code-tree.(make-leaf.'D. |
| 646c0 | 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 1).............................. |
| 646e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 6c 65 61 66 20 27 43 20 31 29 | ................(make-leaf.'C.1) |
| 64700 | 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 61 6d 70 6c 65 2d 6d | ))))............(define.sample-m |
| 64720 | 65 73 73 61 67 65 20 27 28 30 20 31 20 31 20 30 20 30 20 31 20 30 20 31 20 30 20 31 20 31 20 31 | essage.'(0.1.1.0.0.1.0.1.0.1.1.1 |
| 64740 | 20 30 29 29 0a 0a 20 20 20 20 20 55 73 65 20 74 68 65 20 60 64 65 63 6f 64 65 27 20 70 72 6f 63 | .0)).......Use.the.`decode'.proc |
| 64760 | 65 64 75 72 65 20 74 6f 20 64 65 63 6f 64 65 20 74 68 65 20 6d 65 73 73 61 67 65 2c 20 61 6e 64 | edure.to.decode.the.message,.and |
| 64780 | 20 67 69 76 65 20 74 68 65 0a 20 20 20 20 20 72 65 73 75 6c 74 2e 0a 0a 20 20 20 20 20 2a 45 78 | .give.the......result........*Ex |
| 647a0 | 65 72 63 69 73 65 20 32 2e 36 38 3a 2a 20 54 68 65 20 60 65 6e 63 6f 64 65 27 20 70 72 6f 63 65 | ercise.2.68:*.The.`encode'.proce |
| 647c0 | 64 75 72 65 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 0a 20 20 20 20 20 6d | dure.takes.as.arguments.a......m |
| 647e0 | 65 73 73 61 67 65 20 61 6e 64 20 61 20 74 72 65 65 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 74 | essage.and.a.tree.and.produces.t |
| 64800 | 68 65 20 6c 69 73 74 20 6f 66 20 62 69 74 73 20 74 68 61 74 20 67 69 76 65 73 20 74 68 65 0a 20 | he.list.of.bits.that.gives.the.. |
| 64820 | 20 20 20 20 65 6e 63 6f 64 65 64 20 6d 65 73 73 61 67 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 | ....encoded.message............. |
| 64840 | 28 64 65 66 69 6e 65 20 28 65 6e 63 6f 64 65 20 6d 65 73 73 61 67 65 20 74 72 65 65 29 0a 20 20 | (define.(encode.message.tree)... |
| 64860 | 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 6d 65 73 73 61 67 65 29 0a 20 20 | ..........(if.(null?.message)... |
| 64880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............'()............... |
| 648a0 | 20 20 28 61 70 70 65 6e 64 20 28 65 6e 63 6f 64 65 2d 73 79 6d 62 6f 6c 20 28 63 61 72 20 6d 65 | ..(append.(encode-symbol.(car.me |
| 648c0 | 73 73 61 67 65 29 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ssage).tree).................... |
| 648e0 | 20 20 20 20 20 28 65 6e 63 6f 64 65 20 28 63 64 72 20 6d 65 73 73 61 67 65 29 20 74 72 65 65 29 | .....(encode.(cdr.message).tree) |
| 64900 | 29 29 29 0a 0a 20 20 20 20 20 60 45 6e 63 6f 64 65 2d 73 79 6d 62 6f 6c 27 20 69 73 20 61 20 70 | ))).......`Encode-symbol'.is.a.p |
| 64920 | 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 79 6f 75 20 6d 75 73 74 20 77 72 69 74 65 2c 20 | rocedure,.which.you.must.write,. |
| 64940 | 74 68 61 74 20 72 65 74 75 72 6e 73 0a 20 20 20 20 20 74 68 65 20 6c 69 73 74 20 6f 66 20 62 69 | that.returns......the.list.of.bi |
| 64960 | 74 73 20 74 68 61 74 20 65 6e 63 6f 64 65 73 20 61 20 67 69 76 65 6e 20 73 79 6d 62 6f 6c 20 61 | ts.that.encodes.a.given.symbol.a |
| 64980 | 63 63 6f 72 64 69 6e 67 20 74 6f 20 61 20 67 69 76 65 6e 0a 20 20 20 20 20 74 72 65 65 2e 20 20 | ccording.to.a.given......tree... |
| 649a0 | 59 6f 75 20 73 68 6f 75 6c 64 20 64 65 73 69 67 6e 20 60 65 6e 63 6f 64 65 2d 73 79 6d 62 6f 6c | You.should.design.`encode-symbol |
| 649c0 | 27 20 73 6f 20 74 68 61 74 20 69 74 20 73 69 67 6e 61 6c 73 20 61 6e 0a 20 20 20 20 20 65 72 72 | '.so.that.it.signals.an......err |
| 649e0 | 6f 72 20 69 66 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 6e 6f 74 20 69 6e 20 74 68 65 20 74 | or.if.the.symbol.is.not.in.the.t |
| 64a00 | 72 65 65 20 61 74 20 61 6c 6c 2e 20 20 54 65 73 74 20 79 6f 75 72 0a 20 20 20 20 20 70 72 6f 63 | ree.at.all...Test.your......proc |
| 64a20 | 65 64 75 72 65 20 62 79 20 65 6e 63 6f 64 69 6e 67 20 74 68 65 20 72 65 73 75 6c 74 20 79 6f 75 | edure.by.encoding.the.result.you |
| 64a40 | 20 6f 62 74 61 69 6e 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 20 20 20 20 | .obtained.in.*Note.Exercise..... |
| 64a60 | 20 32 2d 36 37 3a 3a 20 77 69 74 68 20 74 68 65 20 73 61 6d 70 6c 65 20 74 72 65 65 20 61 6e 64 | .2-67::.with.the.sample.tree.and |
| 64a80 | 20 73 65 65 69 6e 67 20 77 68 65 74 68 65 72 20 69 74 20 69 73 20 74 68 65 20 73 61 6d 65 20 61 | .seeing.whether.it.is.the.same.a |
| 64aa0 | 73 0a 20 20 20 20 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 73 61 6d 70 6c 65 20 6d 65 73 73 61 | s......the.original.sample.messa |
| 64ac0 | 67 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 36 39 3a 2a 20 54 68 65 20 66 | ge........*Exercise.2.69:*.The.f |
| 64ae0 | 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 74 61 6b 65 73 20 61 73 20 69 74 73 20 | ollowing.procedure.takes.as.its. |
| 64b00 | 61 72 67 75 6d 65 6e 74 20 61 0a 20 20 20 20 20 6c 69 73 74 20 6f 66 20 73 79 6d 62 6f 6c 2d 66 | argument.a......list.of.symbol-f |
| 64b20 | 72 65 71 75 65 6e 63 79 20 70 61 69 72 73 20 28 77 68 65 72 65 20 6e 6f 20 73 79 6d 62 6f 6c 20 | requency.pairs.(where.no.symbol. |
| 64b40 | 61 70 70 65 61 72 73 20 69 6e 20 6d 6f 72 65 0a 20 20 20 20 20 74 68 61 6e 20 6f 6e 65 20 70 61 | appears.in.more......than.one.pa |
| 64b60 | 69 72 29 20 61 6e 64 20 67 65 6e 65 72 61 74 65 73 20 61 20 48 75 66 66 6d 61 6e 20 65 6e 63 6f | ir).and.generates.a.Huffman.enco |
| 64b80 | 64 69 6e 67 20 74 72 65 65 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 0a 20 20 20 20 20 74 68 65 20 | ding.tree.according.to......the. |
| 64ba0 | 48 75 66 66 6d 61 6e 20 61 6c 67 6f 72 69 74 68 6d 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | Huffman.algorithm.............(d |
| 64bc0 | 65 66 69 6e 65 20 28 67 65 6e 65 72 61 74 65 2d 68 75 66 66 6d 61 6e 2d 74 72 65 65 20 70 61 69 | efine.(generate-huffman-tree.pai |
| 64be0 | 72 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 75 63 63 65 73 73 69 76 65 2d 6d 65 72 67 | rs).............(successive-merg |
| 64c00 | 65 20 28 6d 61 6b 65 2d 6c 65 61 66 2d 73 65 74 20 70 61 69 72 73 29 29 29 0a 0a 20 20 20 20 20 | e.(make-leaf-set.pairs)))....... |
| 64c20 | 60 4d 61 6b 65 2d 6c 65 61 66 2d 73 65 74 27 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 | `Make-leaf-set'.is.the.procedure |
| 64c40 | 20 67 69 76 65 6e 20 61 62 6f 76 65 20 74 68 61 74 20 74 72 61 6e 73 66 6f 72 6d 73 20 74 68 65 | .given.above.that.transforms.the |
| 64c60 | 0a 20 20 20 20 20 6c 69 73 74 20 6f 66 20 70 61 69 72 73 20 69 6e 74 6f 20 61 6e 20 6f 72 64 65 | ......list.of.pairs.into.an.orde |
| 64c80 | 72 65 64 20 73 65 74 20 6f 66 20 6c 65 61 76 65 73 2e 20 20 60 53 75 63 63 65 73 73 69 76 65 2d | red.set.of.leaves...`Successive- |
| 64ca0 | 6d 65 72 67 65 27 0a 20 20 20 20 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 79 6f 75 | merge'......is.the.procedure.you |
| 64cc0 | 20 6d 75 73 74 20 77 72 69 74 65 2c 20 75 73 69 6e 67 20 60 6d 61 6b 65 2d 63 6f 64 65 2d 74 72 | .must.write,.using.`make-code-tr |
| 64ce0 | 65 65 27 20 74 6f 0a 20 20 20 20 20 73 75 63 63 65 73 73 69 76 65 6c 79 20 6d 65 72 67 65 20 74 | ee'.to......successively.merge.t |
| 64d00 | 68 65 20 73 6d 61 6c 6c 65 73 74 2d 77 65 69 67 68 74 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 | he.smallest-weight.elements.of.t |
| 64d20 | 68 65 20 73 65 74 20 75 6e 74 69 6c 0a 20 20 20 20 20 74 68 65 72 65 20 69 73 20 6f 6e 6c 79 20 | he.set.until......there.is.only. |
| 64d40 | 6f 6e 65 20 65 6c 65 6d 65 6e 74 20 6c 65 66 74 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 64 | one.element.left,.which.is.the.d |
| 64d60 | 65 73 69 72 65 64 20 48 75 66 66 6d 61 6e 20 74 72 65 65 2e 0a 20 20 20 20 20 28 54 68 69 73 20 | esired.Huffman.tree.......(This. |
| 64d80 | 70 72 6f 63 65 64 75 72 65 20 69 73 20 73 6c 69 67 68 74 6c 79 20 74 72 69 63 6b 79 2c 20 62 75 | procedure.is.slightly.tricky,.bu |
| 64da0 | 74 20 6e 6f 74 20 72 65 61 6c 6c 79 20 63 6f 6d 70 6c 69 63 61 74 65 64 2e 0a 20 20 20 20 20 49 | t.not.really.complicated.......I |
| 64dc0 | 66 20 79 6f 75 20 66 69 6e 64 20 79 6f 75 72 73 65 6c 66 20 64 65 73 69 67 6e 69 6e 67 20 61 20 | f.you.find.yourself.designing.a. |
| 64de0 | 63 6f 6d 70 6c 65 78 20 70 72 6f 63 65 64 75 72 65 2c 20 74 68 65 6e 20 79 6f 75 20 61 72 65 0a | complex.procedure,.then.you.are. |
| 64e00 | 20 20 20 20 20 61 6c 6d 6f 73 74 20 63 65 72 74 61 69 6e 6c 79 20 64 6f 69 6e 67 20 73 6f 6d 65 | .....almost.certainly.doing.some |
| 64e20 | 74 68 69 6e 67 20 77 72 6f 6e 67 2e 20 20 59 6f 75 20 63 61 6e 20 74 61 6b 65 20 73 69 67 6e 69 | thing.wrong...You.can.take.signi |
| 64e40 | 66 69 63 61 6e 74 0a 20 20 20 20 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 74 68 65 20 66 61 63 | ficant......advantage.of.the.fac |
| 64e60 | 74 20 74 68 61 74 20 77 65 20 61 72 65 20 75 73 69 6e 67 20 61 6e 20 6f 72 64 65 72 65 64 20 73 | t.that.we.are.using.an.ordered.s |
| 64e80 | 65 74 0a 20 20 20 20 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 29 0a 0a 20 20 20 20 20 2a | et......representation.).......* |
| 64ea0 | 45 78 65 72 63 69 73 65 20 32 2e 37 30 3a 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 69 | Exercise.2.70:*.The.following.ei |
| 64ec0 | 67 68 74 2d 73 79 6d 62 6f 6c 20 61 6c 70 68 61 62 65 74 20 77 69 74 68 0a 20 20 20 20 20 61 73 | ght-symbol.alphabet.with......as |
| 64ee0 | 73 6f 63 69 61 74 65 64 20 72 65 6c 61 74 69 76 65 20 66 72 65 71 75 65 6e 63 69 65 73 20 77 61 | sociated.relative.frequencies.wa |
| 64f00 | 73 20 64 65 73 69 67 6e 65 64 20 74 6f 20 65 66 66 69 63 69 65 6e 74 6c 79 20 65 6e 63 6f 64 65 | s.designed.to.efficiently.encode |
| 64f20 | 0a 20 20 20 20 20 74 68 65 20 6c 79 72 69 63 73 20 6f 66 20 31 39 35 30 73 20 72 6f 63 6b 20 73 | ......the.lyrics.of.1950s.rock.s |
| 64f40 | 6f 6e 67 73 2e 20 20 28 4e 6f 74 65 20 74 68 61 74 20 74 68 65 20 22 73 79 6d 62 6f 6c 73 22 20 | ongs...(Note.that.the."symbols". |
| 64f60 | 6f 66 20 61 6e 0a 20 20 20 20 20 22 61 6c 70 68 61 62 65 74 22 20 6e 65 65 64 20 6e 6f 74 20 62 | of.an......"alphabet".need.not.b |
| 64f80 | 65 20 69 6e 64 69 76 69 64 75 61 6c 20 6c 65 74 74 65 72 73 2e 29 0a 0a 20 20 20 20 20 20 20 20 | e.individual.letters.).......... |
| 64fa0 | 20 20 41 20 20 20 20 20 32 20 4e 41 20 20 20 31 36 0a 20 20 20 20 20 20 20 20 20 20 42 4f 4f 4d | ..A.....2.NA...16...........BOOM |
| 64fc0 | 20 20 31 20 53 48 41 20 20 33 0a 20 20 20 20 20 20 20 20 20 20 47 45 54 20 20 20 32 20 59 49 50 | ..1.SHA..3...........GET...2.YIP |
| 64fe0 | 20 20 39 0a 20 20 20 20 20 20 20 20 20 20 4a 4f 42 20 20 20 32 20 57 41 48 20 20 31 0a 0a 20 20 | ..9...........JOB...2.WAH..1.... |
| 65000 | 20 20 20 55 73 65 20 60 67 65 6e 65 72 61 74 65 2d 68 75 66 66 6d 61 6e 2d 74 72 65 65 27 20 28 | ...Use.`generate-huffman-tree'.( |
| 65020 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 36 39 3a 3a 29 20 74 6f 20 67 65 6e 65 72 61 | *Note.Exercise.2-69::).to.genera |
| 65040 | 74 65 20 61 0a 20 20 20 20 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 48 75 66 66 6d 61 6e 20 | te.a......corresponding.Huffman. |
| 65060 | 74 72 65 65 2c 20 61 6e 64 20 75 73 65 20 60 65 6e 63 6f 64 65 27 20 28 2a 4e 6f 74 65 20 45 78 | tree,.and.use.`encode'.(*Note.Ex |
| 65080 | 65 72 63 69 73 65 0a 20 20 20 20 20 32 2d 36 38 3a 3a 29 20 74 6f 20 65 6e 63 6f 64 65 20 74 68 | ercise......2-68::).to.encode.th |
| 650a0 | 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d 65 73 73 61 67 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 | e.following.message:............ |
| 650c0 | 47 65 74 20 61 20 6a 6f 62 0a 0a 20 20 20 20 20 20 20 20 20 20 53 68 61 20 6e 61 20 6e 61 20 6e | Get.a.job............Sha.na.na.n |
| 650e0 | 61 20 6e 61 20 6e 61 20 6e 61 20 6e 61 20 6e 61 0a 0a 20 20 20 20 20 20 20 20 20 20 47 65 74 20 | a.na.na.na.na.na............Get. |
| 65100 | 61 20 6a 6f 62 0a 0a 20 20 20 20 20 20 20 20 20 20 53 68 61 20 6e 61 20 6e 61 20 6e 61 20 6e 61 | a.job............Sha.na.na.na.na |
| 65120 | 20 6e 61 20 6e 61 20 6e 61 20 6e 61 0a 0a 20 20 20 20 20 20 20 20 20 20 57 61 68 20 79 69 70 20 | .na.na.na.na............Wah.yip. |
| 65140 | 79 69 70 20 79 69 70 20 79 69 70 20 79 69 70 20 79 69 70 20 79 69 70 20 79 69 70 20 79 69 70 0a | yip.yip.yip.yip.yip.yip.yip.yip. |
| 65160 | 0a 20 20 20 20 20 20 20 20 20 20 53 68 61 20 62 6f 6f 6d 0a 0a 20 20 20 20 20 48 6f 77 20 6d 61 | ...........Sha.boom.......How.ma |
| 65180 | 6e 79 20 62 69 74 73 20 61 72 65 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 74 68 65 20 65 6e 63 | ny.bits.are.required.for.the.enc |
| 651a0 | 6f 64 69 6e 67 3f 20 20 57 68 61 74 20 69 73 20 74 68 65 20 73 6d 61 6c 6c 65 73 74 0a 20 20 20 | oding?..What.is.the.smallest.... |
| 651c0 | 20 20 6e 75 6d 62 65 72 20 6f 66 20 62 69 74 73 20 74 68 61 74 20 77 6f 75 6c 64 20 62 65 20 6e | ..number.of.bits.that.would.be.n |
| 651e0 | 65 65 64 65 64 20 74 6f 20 65 6e 63 6f 64 65 20 74 68 69 73 20 73 6f 6e 67 20 69 66 20 77 65 20 | eeded.to.encode.this.song.if.we. |
| 65200 | 75 73 65 64 0a 20 20 20 20 20 61 20 66 69 78 65 64 2d 6c 65 6e 67 74 68 20 63 6f 64 65 20 66 6f | used......a.fixed-length.code.fo |
| 65220 | 72 20 74 68 65 20 65 69 67 68 74 2d 73 79 6d 62 6f 6c 20 61 6c 70 68 61 62 65 74 3f 0a 0a 20 20 | r.the.eight-symbol.alphabet?.... |
| 65240 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 37 31 3a 2a 20 53 75 70 70 6f 73 65 20 77 65 20 68 | ...*Exercise.2.71:*.Suppose.we.h |
| 65260 | 61 76 65 20 61 20 48 75 66 66 6d 61 6e 20 74 72 65 65 20 66 6f 72 20 61 6e 20 61 6c 70 68 61 62 | ave.a.Huffman.tree.for.an.alphab |
| 65280 | 65 74 20 6f 66 0a 20 20 20 20 20 6e 20 73 79 6d 62 6f 6c 73 2c 20 61 6e 64 20 74 68 61 74 20 74 | et.of......n.symbols,.and.that.t |
| 652a0 | 68 65 20 72 65 6c 61 74 69 76 65 20 66 72 65 71 75 65 6e 63 69 65 73 20 6f 66 20 74 68 65 20 73 | he.relative.frequencies.of.the.s |
| 652c0 | 79 6d 62 6f 6c 73 20 61 72 65 20 31 2c 0a 20 20 20 20 20 32 2c 20 34 2c 20 2e 2e 2e 2c 20 32 5e | ymbols.are.1,......2,.4,....,.2^ |
| 652e0 | 28 6e 2d 31 29 2e 20 20 53 6b 65 74 63 68 20 74 68 65 20 74 72 65 65 20 66 6f 72 20 6e 3d 35 3b | (n-1)...Sketch.the.tree.for.n=5; |
| 65300 | 20 66 6f 72 20 6e 3d 31 30 2e 20 20 49 6e 20 73 75 63 68 20 61 0a 20 20 20 20 20 74 72 65 65 20 | .for.n=10...In.such.a......tree. |
| 65320 | 28 66 6f 72 20 67 65 6e 65 72 61 6c 20 6e 29 20 68 6f 77 20 6d 61 79 20 62 69 74 73 20 61 72 65 | (for.general.n).how.may.bits.are |
| 65340 | 20 72 65 71 75 69 72 65 64 20 74 6f 20 65 6e 63 6f 64 65 20 74 68 65 20 6d 6f 73 74 0a 20 20 20 | .required.to.encode.the.most.... |
| 65360 | 20 20 66 72 65 71 75 65 6e 74 20 73 79 6d 62 6f 6c 3f 20 20 74 68 65 20 6c 65 61 73 74 20 66 72 | ..frequent.symbol?..the.least.fr |
| 65380 | 65 71 75 65 6e 74 20 73 79 6d 62 6f 6c 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 | equent.symbol?.......*Exercise.2 |
| 653a0 | 2e 37 32 3a 2a 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 65 6e 63 6f 64 69 6e 67 20 70 72 6f 63 | .72:*.Consider.the.encoding.proc |
| 653c0 | 65 64 75 72 65 20 74 68 61 74 20 79 6f 75 20 64 65 73 69 67 6e 65 64 0a 20 20 20 20 20 69 6e 20 | edure.that.you.designed......in. |
| 653e0 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 36 38 3a 3a 2e 20 20 57 68 61 74 20 69 73 20 | *Note.Exercise.2-68::...What.is. |
| 65400 | 74 68 65 20 6f 72 64 65 72 20 6f 66 20 67 72 6f 77 74 68 20 69 6e 20 74 68 65 0a 20 20 20 20 20 | the.order.of.growth.in.the...... |
| 65420 | 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 6e 65 65 64 65 64 20 74 6f 20 65 6e 63 6f 64 65 | number.of.steps.needed.to.encode |
| 65440 | 20 61 20 73 79 6d 62 6f 6c 3f 20 20 42 65 20 73 75 72 65 20 74 6f 20 69 6e 63 6c 75 64 65 20 74 | .a.symbol?..Be.sure.to.include.t |
| 65460 | 68 65 0a 20 20 20 20 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 6e 65 65 64 65 64 20 74 | he......number.of.steps.needed.t |
| 65480 | 6f 20 73 65 61 72 63 68 20 74 68 65 20 73 79 6d 62 6f 6c 20 6c 69 73 74 20 61 74 20 65 61 63 68 | o.search.the.symbol.list.at.each |
| 654a0 | 20 6e 6f 64 65 0a 20 20 20 20 20 65 6e 63 6f 75 6e 74 65 72 65 64 2e 20 20 54 6f 20 61 6e 73 77 | .node......encountered...To.answ |
| 654c0 | 65 72 20 74 68 69 73 20 71 75 65 73 74 69 6f 6e 20 69 6e 20 67 65 6e 65 72 61 6c 20 69 73 20 64 | er.this.question.in.general.is.d |
| 654e0 | 69 66 66 69 63 75 6c 74 2e 0a 20 20 20 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 73 70 65 63 | ifficult.......Consider.the.spec |
| 65500 | 69 61 6c 20 63 61 73 65 20 77 68 65 72 65 20 74 68 65 20 72 65 6c 61 74 69 76 65 20 66 72 65 71 | ial.case.where.the.relative.freq |
| 65520 | 75 65 6e 63 69 65 73 20 6f 66 20 74 68 65 20 6e 0a 20 20 20 20 20 73 79 6d 62 6f 6c 73 20 61 72 | uencies.of.the.n......symbols.ar |
| 65540 | 65 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | e.as.described.in.*Note.Exercise |
| 65560 | 20 32 2d 37 31 3a 3a 2c 20 61 6e 64 20 67 69 76 65 20 74 68 65 0a 20 20 20 20 20 6f 72 64 65 72 | .2-71::,.and.give.the......order |
| 65580 | 20 6f 66 20 67 72 6f 77 74 68 20 28 61 73 20 61 20 66 75 6e 63 74 69 6f 6e 20 6f 66 20 6e 29 20 | .of.growth.(as.a.function.of.n). |
| 655a0 | 6f 66 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 73 20 6e 65 65 64 65 64 0a 20 20 | of.the.number.of.steps.needed... |
| 655c0 | 20 20 20 74 6f 20 65 6e 63 6f 64 65 20 74 68 65 20 6d 6f 73 74 20 66 72 65 71 75 65 6e 74 20 61 | ...to.encode.the.most.frequent.a |
| 655e0 | 6e 64 20 6c 65 61 73 74 20 66 72 65 71 75 65 6e 74 20 73 79 6d 62 6f 6c 73 20 69 6e 20 74 68 65 | nd.least.frequent.symbols.in.the |
| 65600 | 0a 20 20 20 20 20 61 6c 70 68 61 62 65 74 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 | ......alphabet......----------.F |
| 65620 | 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 53 65 65 20 | ootnotes.----------.....(1).See. |
| 65640 | 48 61 6d 6d 69 6e 67 20 31 39 38 30 20 66 6f 72 20 61 20 64 69 73 63 75 73 73 69 6f 6e 20 6f 66 | Hamming.1980.for.a.discussion.of |
| 65660 | 20 74 68 65 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 70 72 6f 70 65 72 74 69 65 73 0a 6f 66 20 | .the.mathematical.properties.of. |
| 65680 | 48 75 66 66 6d 61 6e 20 63 6f 64 65 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 | Huffman.codes.....File:.sicp.inf |
| 656a0 | 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 34 2c 20 20 4e 65 78 74 3a 20 32 2d 35 2c 20 20 50 72 65 76 | o,..Node:.2-4,..Next:.2-5,..Prev |
| 656c0 | 3a 20 32 2d 33 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 32 0a 0a 32 2e 34 20 4d 75 6c 74 69 | :.2-3,..Up:.Chapter.2..2.4.Multi |
| 656e0 | 70 6c 65 20 52 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 41 62 73 74 72 61 63 74 | ple.Representations.for.Abstract |
| 65700 | 20 44 61 74 61 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | .Data.========================== |
| 65720 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 57 65 20 68 61 76 65 20 69 6e | ====================..We.have.in |
| 65740 | 74 72 6f 64 75 63 65 64 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 61 20 6d 65 74 | troduced.data.abstraction,.a.met |
| 65760 | 68 6f 64 6f 6c 6f 67 79 20 66 6f 72 20 73 74 72 75 63 74 75 72 69 6e 67 0a 73 79 73 74 65 6d 73 | hodology.for.structuring.systems |
| 65780 | 20 69 6e 20 73 75 63 68 20 61 20 77 61 79 20 74 68 61 74 20 6d 75 63 68 20 6f 66 20 61 20 70 72 | .in.such.a.way.that.much.of.a.pr |
| 657a0 | 6f 67 72 61 6d 20 63 61 6e 20 62 65 20 73 70 65 63 69 66 69 65 64 0a 69 6e 64 65 70 65 6e 64 65 | ogram.can.be.specified.independe |
| 657c0 | 6e 74 20 6f 66 20 74 68 65 20 63 68 6f 69 63 65 73 20 69 6e 76 6f 6c 76 65 64 20 69 6e 20 69 6d | nt.of.the.choices.involved.in.im |
| 657e0 | 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 64 61 74 61 20 6f 62 6a 65 63 74 73 0a 74 68 61 74 | plementing.the.data.objects.that |
| 65800 | 20 74 68 65 20 70 72 6f 67 72 61 6d 20 6d 61 6e 69 70 75 6c 61 74 65 73 2e 20 20 46 6f 72 20 65 | .the.program.manipulates...For.e |
| 65820 | 78 61 6d 70 6c 65 2c 20 77 65 20 73 61 77 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a | xample,.we.saw.in.section.*Note. |
| 65840 | 32 2d 31 2d 31 3a 3a 20 68 6f 77 20 74 6f 20 73 65 70 61 72 61 74 65 20 74 68 65 20 74 61 73 6b | 2-1-1::.how.to.separate.the.task |
| 65860 | 20 6f 66 20 64 65 73 69 67 6e 69 6e 67 20 61 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 75 73 65 | .of.designing.a.program.that.use |
| 65880 | 73 0a 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 66 72 6f 6d 20 74 68 65 20 74 61 73 6b | s.rational.numbers.from.the.task |
| 658a0 | 20 6f 66 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 | .of.implementing.rational.number |
| 658c0 | 73 20 69 6e 0a 74 65 72 6d 73 20 6f 66 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 6c 61 6e 67 75 | s.in.terms.of.the.computer.langu |
| 658e0 | 61 67 65 27 73 20 70 72 69 6d 69 74 69 76 65 20 6d 65 63 68 61 6e 69 73 6d 73 20 66 6f 72 20 63 | age's.primitive.mechanisms.for.c |
| 65900 | 6f 6e 73 74 72 75 63 74 69 6e 67 0a 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 2e 20 20 54 68 65 20 | onstructing.compound.data...The. |
| 65920 | 6b 65 79 20 69 64 65 61 20 77 61 73 20 74 6f 20 65 72 65 63 74 20 61 6e 20 61 62 73 74 72 61 63 | key.idea.was.to.erect.an.abstrac |
| 65940 | 74 69 6f 6e 20 62 61 72 72 69 65 72 20 2d 20 69 6e 0a 74 68 69 73 20 63 61 73 65 2c 20 74 68 65 | tion.barrier.-.in.this.case,.the |
| 65960 | 20 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 66 6f 72 20 | .selectors.and.constructors.for. |
| 65980 | 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 0a 28 60 6d 61 6b 65 2d 72 61 74 27 2c 20 60 6e | rational.numbers.(`make-rat',.`n |
| 659a0 | 75 6d 65 72 27 2c 20 60 64 65 6e 6f 6d 27 29 2d 2d 74 68 61 74 20 69 73 6f 6c 61 74 65 73 20 74 | umer',.`denom')--that.isolates.t |
| 659c0 | 68 65 20 77 61 79 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 0a 61 72 65 20 75 73 65 64 | he.way.rational.numbers.are.used |
| 659e0 | 20 66 72 6f 6d 20 74 68 65 69 72 20 75 6e 64 65 72 6c 79 69 6e 67 20 72 65 70 72 65 73 65 6e 74 | .from.their.underlying.represent |
| 65a00 | 61 74 69 6f 6e 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6c 69 73 74 0a 73 74 72 75 63 74 75 72 65 | ation.in.terms.of.list.structure |
| 65a20 | 2e 20 20 41 20 73 69 6d 69 6c 61 72 20 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 72 72 69 65 72 | ...A.similar.abstraction.barrier |
| 65a40 | 20 69 73 6f 6c 61 74 65 73 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 74 68 65 0a 70 72 6f | .isolates.the.details.of.the.pro |
| 65a60 | 63 65 64 75 72 65 73 20 74 68 61 74 20 70 65 72 66 6f 72 6d 20 72 61 74 69 6f 6e 61 6c 20 61 72 | cedures.that.perform.rational.ar |
| 65a80 | 69 74 68 6d 65 74 69 63 20 28 60 61 64 64 2d 72 61 74 27 2c 20 60 73 75 62 2d 72 61 74 27 2c 0a | ithmetic.(`add-rat',.`sub-rat',. |
| 65aa0 | 60 6d 75 6c 2d 72 61 74 27 2c 20 61 6e 64 20 60 64 69 76 2d 72 61 74 27 29 20 66 72 6f 6d 20 74 | `mul-rat',.and.`div-rat').from.t |
| 65ac0 | 68 65 20 22 68 69 67 68 65 72 2d 6c 65 76 65 6c 22 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 | he."higher-level".procedures.tha |
| 65ae0 | 74 20 75 73 65 0a 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2e 20 20 54 68 65 20 72 65 73 | t.use.rational.numbers...The.res |
| 65b00 | 75 6c 74 69 6e 67 20 70 72 6f 67 72 61 6d 20 68 61 73 20 74 68 65 20 73 74 72 75 63 74 75 72 65 | ulting.program.has.the.structure |
| 65b20 | 20 73 68 6f 77 6e 20 69 6e 0a 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 31 3a 3a 2e 0a 0a 20 | .shown.in.*Note.Figure.2-1::.... |
| 65b40 | 20 20 54 68 65 73 65 20 64 61 74 61 2d 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 72 72 69 65 72 | ..These.data-abstraction.barrier |
| 65b60 | 73 20 61 72 65 20 70 6f 77 65 72 66 75 6c 20 74 6f 6f 6c 73 20 66 6f 72 20 63 6f 6e 74 72 6f 6c | s.are.powerful.tools.for.control |
| 65b80 | 6c 69 6e 67 0a 63 6f 6d 70 6c 65 78 69 74 79 2e 20 20 42 79 20 69 73 6f 6c 61 74 69 6e 67 20 74 | ling.complexity...By.isolating.t |
| 65ba0 | 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 6f 66 | he.underlying.representations.of |
| 65bc0 | 20 64 61 74 61 0a 6f 62 6a 65 63 74 73 2c 20 77 65 20 63 61 6e 20 64 69 76 69 64 65 20 74 68 65 | .data.objects,.we.can.divide.the |
| 65be0 | 20 74 61 73 6b 20 6f 66 20 64 65 73 69 67 6e 69 6e 67 20 61 20 6c 61 72 67 65 20 70 72 6f 67 72 | .task.of.designing.a.large.progr |
| 65c00 | 61 6d 20 69 6e 74 6f 0a 73 6d 61 6c 6c 65 72 20 74 61 73 6b 73 20 74 68 61 74 20 63 61 6e 20 62 | am.into.smaller.tasks.that.can.b |
| 65c20 | 65 20 70 65 72 66 6f 72 6d 65 64 20 73 65 70 61 72 61 74 65 6c 79 2e 20 20 42 75 74 20 74 68 69 | e.performed.separately...But.thi |
| 65c40 | 73 20 6b 69 6e 64 20 6f 66 20 64 61 74 61 0a 61 62 73 74 72 61 63 74 69 6f 6e 20 69 73 20 6e 6f | s.kind.of.data.abstraction.is.no |
| 65c60 | 74 20 79 65 74 20 70 6f 77 65 72 66 75 6c 20 65 6e 6f 75 67 68 2c 20 62 65 63 61 75 73 65 20 69 | t.yet.powerful.enough,.because.i |
| 65c80 | 74 20 6d 61 79 20 6e 6f 74 20 61 6c 77 61 79 73 20 6d 61 6b 65 0a 73 65 6e 73 65 20 74 6f 20 73 | t.may.not.always.make.sense.to.s |
| 65ca0 | 70 65 61 6b 20 6f 66 20 22 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 72 65 70 72 65 73 65 6e | peak.of."the.underlying.represen |
| 65cc0 | 74 61 74 69 6f 6e 22 20 66 6f 72 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 2e 0a 0a 20 20 20 46 | tation".for.a.data.object......F |
| 65ce0 | 6f 72 20 6f 6e 65 20 74 68 69 6e 67 2c 20 74 68 65 72 65 20 6d 69 67 68 74 20 62 65 20 6d 6f 72 | or.one.thing,.there.might.be.mor |
| 65d00 | 65 20 74 68 61 6e 20 6f 6e 65 20 75 73 65 66 75 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e | e.than.one.useful.representation |
| 65d20 | 0a 66 6f 72 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 2c 20 61 6e 64 20 77 65 20 6d 69 67 68 74 | .for.a.data.object,.and.we.might |
| 65d40 | 20 6c 69 6b 65 20 74 6f 20 64 65 73 69 67 6e 20 73 79 73 74 65 6d 73 20 74 68 61 74 20 63 61 6e | .like.to.design.systems.that.can |
| 65d60 | 20 64 65 61 6c 0a 77 69 74 68 20 6d 75 6c 74 69 70 6c 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 | .deal.with.multiple.representati |
| 65d80 | 6f 6e 73 2e 20 20 54 6f 20 74 61 6b 65 20 61 20 73 69 6d 70 6c 65 20 65 78 61 6d 70 6c 65 2c 20 | ons...To.take.a.simple.example,. |
| 65da0 | 63 6f 6d 70 6c 65 78 0a 6e 75 6d 62 65 72 73 20 6d 61 79 20 62 65 20 72 65 70 72 65 73 65 6e 74 | complex.numbers.may.be.represent |
| 65dc0 | 65 64 20 69 6e 20 74 77 6f 20 61 6c 6d 6f 73 74 20 65 71 75 69 76 61 6c 65 6e 74 20 77 61 79 73 | ed.in.two.almost.equivalent.ways |
| 65de0 | 3a 20 69 6e 0a 72 65 63 74 61 6e 67 75 6c 61 72 20 66 6f 72 6d 20 28 72 65 61 6c 20 61 6e 64 20 | :.in.rectangular.form.(real.and. |
| 65e00 | 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 73 29 20 61 6e 64 20 69 6e 20 70 6f 6c 61 72 20 66 6f | imaginary.parts).and.in.polar.fo |
| 65e20 | 72 6d 0a 28 6d 61 67 6e 69 74 75 64 65 20 61 6e 64 20 61 6e 67 6c 65 29 2e 20 20 53 6f 6d 65 74 | rm.(magnitude.and.angle)...Somet |
| 65e40 | 69 6d 65 73 20 72 65 63 74 61 6e 67 75 6c 61 72 20 66 6f 72 6d 20 69 73 20 6d 6f 72 65 20 61 70 | imes.rectangular.form.is.more.ap |
| 65e60 | 70 72 6f 70 72 69 61 74 65 0a 61 6e 64 20 73 6f 6d 65 74 69 6d 65 73 20 70 6f 6c 61 72 20 66 6f | propriate.and.sometimes.polar.fo |
| 65e80 | 72 6d 20 69 73 20 6d 6f 72 65 20 61 70 70 72 6f 70 72 69 61 74 65 2e 20 20 49 6e 64 65 65 64 2c | rm.is.more.appropriate...Indeed, |
| 65ea0 | 20 69 74 20 69 73 20 70 65 72 66 65 63 74 6c 79 0a 70 6c 61 75 73 69 62 6c 65 20 74 6f 20 69 6d | .it.is.perfectly.plausible.to.im |
| 65ec0 | 61 67 69 6e 65 20 61 20 73 79 73 74 65 6d 20 69 6e 20 77 68 69 63 68 20 63 6f 6d 70 6c 65 78 20 | agine.a.system.in.which.complex. |
| 65ee0 | 6e 75 6d 62 65 72 73 20 61 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 0a 69 6e 20 62 6f 74 68 20 | numbers.are.represented.in.both. |
| 65f00 | 77 61 79 73 2c 20 61 6e 64 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 | ways,.and.in.which.the.procedure |
| 65f20 | 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 63 6f 6d 70 6c 65 78 0a 6e 75 6d 62 65 | s.for.manipulating.complex.numbe |
| 65f40 | 72 73 20 77 6f 72 6b 20 77 69 74 68 20 65 69 74 68 65 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 | rs.work.with.either.representati |
| 65f60 | 6f 6e 2e 0a 0a 20 20 20 4d 6f 72 65 20 69 6d 70 6f 72 74 61 6e 74 6c 79 2c 20 70 72 6f 67 72 61 | on......More.importantly,.progra |
| 65f80 | 6d 6d 69 6e 67 20 73 79 73 74 65 6d 73 20 61 72 65 20 6f 66 74 65 6e 20 64 65 73 69 67 6e 65 64 | mming.systems.are.often.designed |
| 65fa0 | 20 62 79 20 6d 61 6e 79 0a 70 65 6f 70 6c 65 20 77 6f 72 6b 69 6e 67 20 6f 76 65 72 20 65 78 74 | .by.many.people.working.over.ext |
| 65fc0 | 65 6e 64 65 64 20 70 65 72 69 6f 64 73 20 6f 66 20 74 69 6d 65 2c 20 73 75 62 6a 65 63 74 20 74 | ended.periods.of.time,.subject.t |
| 65fe0 | 6f 20 72 65 71 75 69 72 65 6d 65 6e 74 73 0a 74 68 61 74 20 63 68 61 6e 67 65 20 6f 76 65 72 20 | o.requirements.that.change.over. |
| 66000 | 74 69 6d 65 2e 20 20 49 6e 20 73 75 63 68 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 69 | time...In.such.an.environment,.i |
| 66020 | 74 20 69 73 20 73 69 6d 70 6c 79 20 6e 6f 74 0a 70 6f 73 73 69 62 6c 65 20 66 6f 72 20 65 76 65 | t.is.simply.not.possible.for.eve |
| 66040 | 72 79 6f 6e 65 20 74 6f 20 61 67 72 65 65 20 69 6e 20 61 64 76 61 6e 63 65 20 6f 6e 20 63 68 6f | ryone.to.agree.in.advance.on.cho |
| 66060 | 69 63 65 73 20 6f 66 20 64 61 74 61 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 53 6f | ices.of.data.representation...So |
| 66080 | 20 69 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 74 68 65 20 64 61 74 61 2d 61 62 73 74 72 61 63 | .in.addition.to.the.data-abstrac |
| 660a0 | 74 69 6f 6e 20 62 61 72 72 69 65 72 73 20 74 68 61 74 0a 69 73 6f 6c 61 74 65 20 72 65 70 72 65 | tion.barriers.that.isolate.repre |
| 660c0 | 73 65 6e 74 61 74 69 6f 6e 20 66 72 6f 6d 20 75 73 65 2c 20 77 65 20 6e 65 65 64 20 61 62 73 74 | sentation.from.use,.we.need.abst |
| 660e0 | 72 61 63 74 69 6f 6e 20 62 61 72 72 69 65 72 73 20 74 68 61 74 0a 69 73 6f 6c 61 74 65 20 64 69 | raction.barriers.that.isolate.di |
| 66100 | 66 66 65 72 65 6e 74 20 64 65 73 69 67 6e 20 63 68 6f 69 63 65 73 20 66 72 6f 6d 20 65 61 63 68 | fferent.design.choices.from.each |
| 66120 | 20 6f 74 68 65 72 20 61 6e 64 20 70 65 72 6d 69 74 20 64 69 66 66 65 72 65 6e 74 0a 63 68 6f 69 | .other.and.permit.different.choi |
| 66140 | 63 65 73 20 74 6f 20 63 6f 65 78 69 73 74 20 69 6e 20 61 20 73 69 6e 67 6c 65 20 70 72 6f 67 72 | ces.to.coexist.in.a.single.progr |
| 66160 | 61 6d 2e 20 20 46 75 72 74 68 65 72 6d 6f 72 65 2c 20 73 69 6e 63 65 20 6c 61 72 67 65 0a 70 72 | am...Furthermore,.since.large.pr |
| 66180 | 6f 67 72 61 6d 73 20 61 72 65 20 6f 66 74 65 6e 20 63 72 65 61 74 65 64 20 62 79 20 63 6f 6d 62 | ograms.are.often.created.by.comb |
| 661a0 | 69 6e 69 6e 67 20 70 72 65 2d 65 78 69 73 74 69 6e 67 20 6d 6f 64 75 6c 65 73 20 74 68 61 74 20 | ining.pre-existing.modules.that. |
| 661c0 | 77 65 72 65 0a 64 65 73 69 67 6e 65 64 20 69 6e 20 69 73 6f 6c 61 74 69 6f 6e 2c 20 77 65 20 6e | were.designed.in.isolation,.we.n |
| 661e0 | 65 65 64 20 63 6f 6e 76 65 6e 74 69 6f 6e 73 20 74 68 61 74 20 70 65 72 6d 69 74 20 70 72 6f 67 | eed.conventions.that.permit.prog |
| 66200 | 72 61 6d 6d 65 72 73 20 74 6f 0a 69 6e 63 6f 72 70 6f 72 61 74 65 20 6d 6f 64 75 6c 65 73 20 69 | rammers.to.incorporate.modules.i |
| 66220 | 6e 74 6f 20 6c 61 72 67 65 72 20 73 79 73 74 65 6d 73 20 22 61 64 64 69 74 69 76 65 6c 79 22 2c | nto.larger.systems."additively", |
| 66240 | 20 74 68 61 74 20 69 73 2c 20 77 69 74 68 6f 75 74 0a 68 61 76 69 6e 67 20 74 6f 20 72 65 64 65 | .that.is,.without.having.to.rede |
| 66260 | 73 69 67 6e 20 6f 72 20 72 65 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 73 65 20 6d 6f 64 75 6c 65 | sign.or.reimplement.these.module |
| 66280 | 73 2e 0a 0a 20 20 20 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 20 77 65 20 77 69 6c 6c 20 | s......In.this.section,.we.will. |
| 662a0 | 6c 65 61 72 6e 20 68 6f 77 20 74 6f 20 63 6f 70 65 20 77 69 74 68 20 64 61 74 61 20 74 68 61 74 | learn.how.to.cope.with.data.that |
| 662c0 | 20 6d 61 79 20 62 65 0a 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 64 69 66 66 65 72 65 6e 74 | .may.be.represented.in.different |
| 662e0 | 20 77 61 79 73 20 62 79 20 64 69 66 66 65 72 65 6e 74 20 70 61 72 74 73 20 6f 66 20 61 20 70 72 | .ways.by.different.parts.of.a.pr |
| 66300 | 6f 67 72 61 6d 2e 20 20 54 68 69 73 0a 72 65 71 75 69 72 65 73 20 63 6f 6e 73 74 72 75 63 74 69 | ogram...This.requires.constructi |
| 66320 | 6e 67 20 22 67 65 6e 65 72 69 63 20 70 72 6f 63 65 64 75 72 65 73 22 2d 2d 70 72 6f 63 65 64 75 | ng."generic.procedures"--procedu |
| 66340 | 72 65 73 20 74 68 61 74 20 63 61 6e 20 6f 70 65 72 61 74 65 0a 6f 6e 20 64 61 74 61 20 74 68 61 | res.that.can.operate.on.data.tha |
| 66360 | 74 20 6d 61 79 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 6d 6f 72 65 20 74 68 61 | t.may.be.represented.in.more.tha |
| 66380 | 6e 20 6f 6e 65 20 77 61 79 2e 20 20 4f 75 72 20 6d 61 69 6e 0a 74 65 63 68 6e 69 71 75 65 20 66 | n.one.way...Our.main.technique.f |
| 663a0 | 6f 72 20 62 75 69 6c 64 69 6e 67 20 67 65 6e 65 72 69 63 20 70 72 6f 63 65 64 75 72 65 73 20 77 | or.building.generic.procedures.w |
| 663c0 | 69 6c 6c 20 62 65 20 74 6f 20 77 6f 72 6b 20 69 6e 20 74 65 72 6d 73 20 6f 66 0a 64 61 74 61 20 | ill.be.to.work.in.terms.of.data. |
| 663e0 | 6f 62 6a 65 63 74 73 20 74 68 61 74 20 68 61 76 65 20 74 61 67 73 20 22 74 79 70 65 20 74 61 67 | objects.that.have.tags."type.tag |
| 66400 | 73 22 2c 20 74 68 61 74 20 69 73 2c 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 74 68 61 74 0a 69 | s",.that.is,.data.objects.that.i |
| 66420 | 6e 63 6c 75 64 65 20 65 78 70 6c 69 63 69 74 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 | nclude.explicit.information.abou |
| 66440 | 74 20 68 6f 77 20 74 68 65 79 20 61 72 65 20 74 6f 20 62 65 20 70 72 6f 63 65 73 73 65 64 2e 20 | t.how.they.are.to.be.processed.. |
| 66460 | 20 57 65 0a 77 69 6c 6c 20 61 6c 73 6f 20 64 69 73 63 75 73 73 20 22 64 61 74 61 2d 64 69 72 65 | .We.will.also.discuss."data-dire |
| 66480 | 63 74 65 64 22 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 20 61 20 70 6f 77 65 72 66 75 6c 20 61 6e | cted".programming,.a.powerful.an |
| 664a0 | 64 0a 63 6f 6e 76 65 6e 69 65 6e 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 73 74 72 61 | d.convenient.implementation.stra |
| 664c0 | 74 65 67 79 20 66 6f 72 20 61 64 64 69 74 69 76 65 6c 79 20 61 73 73 65 6d 62 6c 69 6e 67 20 73 | tegy.for.additively.assembling.s |
| 664e0 | 79 73 74 65 6d 73 0a 77 69 74 68 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a | ystems.with.generic.operations.. |
| 66500 | 0a 20 20 20 57 65 20 62 65 67 69 6e 20 77 69 74 68 20 74 68 65 20 73 69 6d 70 6c 65 20 63 6f 6d | ....We.begin.with.the.simple.com |
| 66520 | 70 6c 65 78 2d 6e 75 6d 62 65 72 20 65 78 61 6d 70 6c 65 2e 20 57 65 20 77 69 6c 6c 20 73 65 65 | plex-number.example..We.will.see |
| 66540 | 20 68 6f 77 0a 74 79 70 65 20 74 61 67 73 20 61 6e 64 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 | .how.type.tags.and.data-directed |
| 66560 | 20 73 74 79 6c 65 20 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 64 65 73 69 67 6e 20 73 65 70 61 72 | .style.enable.us.to.design.separ |
| 66580 | 61 74 65 0a 72 65 63 74 61 6e 67 75 6c 61 72 20 61 6e 64 20 70 6f 6c 61 72 20 72 65 70 72 65 73 | ate.rectangular.and.polar.repres |
| 665a0 | 65 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 77 68 | entations.for.complex.numbers.wh |
| 665c0 | 69 6c 65 0a 6d 61 69 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 20 61 6e | ile.maintaining.the.notion.of.an |
| 665e0 | 20 61 62 73 74 72 61 63 74 20 22 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 22 20 64 61 74 61 20 | .abstract."complex-number".data. |
| 66600 | 6f 62 6a 65 63 74 2e 20 20 57 65 0a 77 69 6c 6c 20 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 | object...We.will.accomplish.this |
| 66620 | 20 62 79 20 64 65 66 69 6e 69 6e 67 20 61 72 69 74 68 6d 65 74 69 63 20 70 72 6f 63 65 64 75 72 | .by.defining.arithmetic.procedur |
| 66640 | 65 73 20 66 6f 72 20 63 6f 6d 70 6c 65 78 0a 6e 75 6d 62 65 72 73 20 28 60 61 64 64 2d 63 6f 6d | es.for.complex.numbers.(`add-com |
| 66660 | 70 6c 65 78 27 2c 20 60 73 75 62 2d 63 6f 6d 70 6c 65 78 27 2c 20 60 6d 75 6c 2d 63 6f 6d 70 6c | plex',.`sub-complex',.`mul-compl |
| 66680 | 65 78 27 2c 20 61 6e 64 0a 60 64 69 76 2d 63 6f 6d 70 6c 65 78 27 29 20 69 6e 20 74 65 72 6d 73 | ex',.and.`div-complex').in.terms |
| 666a0 | 20 6f 66 20 67 65 6e 65 72 69 63 20 73 65 6c 65 63 74 6f 72 73 20 74 68 61 74 20 61 63 63 65 73 | .of.generic.selectors.that.acces |
| 666c0 | 73 20 70 61 72 74 73 20 6f 66 20 61 0a 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 69 6e 64 65 | s.parts.of.a.complex.number.inde |
| 666e0 | 70 65 6e 64 65 6e 74 20 6f 66 20 68 6f 77 20 74 68 65 20 6e 75 6d 62 65 72 20 69 73 20 72 65 70 | pendent.of.how.the.number.is.rep |
| 66700 | 72 65 73 65 6e 74 65 64 2e 20 20 54 68 65 0a 72 65 73 75 6c 74 69 6e 67 20 63 6f 6d 70 6c 65 78 | resented...The.resulting.complex |
| 66720 | 2d 6e 75 6d 62 65 72 20 73 79 73 74 65 6d 2c 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 | -number.system,.as.shown.in.*Not |
| 66740 | 65 20 46 69 67 75 72 65 20 32 2d 31 39 3a 3a 2c 0a 63 6f 6e 74 61 69 6e 73 20 74 77 6f 20 64 69 | e.Figure.2-19::,.contains.two.di |
| 66760 | 66 66 65 72 65 6e 74 20 6b 69 6e 64 73 20 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 72 | fferent.kinds.of.abstraction.bar |
| 66780 | 72 69 65 72 73 2e 20 20 54 68 65 20 22 68 6f 72 69 7a 6f 6e 74 61 6c 22 0a 61 62 73 74 72 61 63 | riers...The."horizontal".abstrac |
| 667a0 | 74 69 6f 6e 20 62 61 72 72 69 65 72 73 20 70 6c 61 79 20 74 68 65 20 73 61 6d 65 20 72 6f 6c 65 | tion.barriers.play.the.same.role |
| 667c0 | 20 61 73 20 74 68 65 20 6f 6e 65 73 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a 32 2d 31 | .as.the.ones.in.*Note.Figure.2-1 |
| 667e0 | 3a 3a 2e 20 20 54 68 65 79 20 69 73 6f 6c 61 74 65 20 22 68 69 67 68 65 72 2d 6c 65 76 65 6c 22 | ::...They.isolate."higher-level" |
| 66800 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 66 72 6f 6d 20 22 6c 6f 77 65 72 2d 6c 65 76 65 6c 22 0a 72 | .operations.from."lower-level".r |
| 66820 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 2e 20 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 74 68 | epresentations...In.addition,.th |
| 66840 | 65 72 65 20 69 73 20 61 20 22 76 65 72 74 69 63 61 6c 22 20 62 61 72 72 69 65 72 20 74 68 61 74 | ere.is.a."vertical".barrier.that |
| 66860 | 20 67 69 76 65 73 0a 75 73 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 73 65 70 61 72 61 74 | .gives.us.the.ability.to.separat |
| 66880 | 65 6c 79 20 64 65 73 69 67 6e 20 61 6e 64 20 69 6e 73 74 61 6c 6c 20 61 6c 74 65 72 6e 61 74 69 | ely.design.and.install.alternati |
| 668a0 | 76 65 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 | ve.representations........*Figur |
| 668c0 | 65 20 32 2e 31 39 3a 2a 20 44 61 74 61 2d 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 72 72 69 65 | e.2.19:*.Data-abstraction.barrie |
| 668e0 | 72 73 20 69 6e 20 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 0a 20 20 20 20 20 73 79 | rs.in.the.complex-number......sy |
| 66900 | 73 74 65 6d 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 72 6f 67 | stem........................Prog |
| 66920 | 72 61 6d 73 20 74 68 61 74 20 75 73 65 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 0a 20 20 | rams.that.use.complex.numbers... |
| 66940 | 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..........+--------------------- |
| 66960 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 | ----------------------------+... |
| 66980 | 20 20 20 20 20 20 20 20 2d 2d 7c 20 61 64 64 2d 63 6f 6d 70 6c 65 78 20 73 75 62 2d 63 6f 6d 70 | ........--|.add-complex.sub-comp |
| 669a0 | 6c 65 78 20 6d 75 6c 2d 63 6f 6d 70 6c 65 78 20 64 69 76 2d 63 6f 6d 70 6c 65 78 20 7c 2d 2d 0a | lex.mul-complex.div-complex.|--. |
| 669c0 | 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ............+------------------- |
| 669e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a | ------------------------------+. |
| 66a00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6d 70 6c 65 78 20 | ........................Complex. |
| 66a20 | 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d | arithmetic.package...........--- |
| 66a40 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d | ------------------------+------- |
| 66a60 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 | --------------------............ |
| 66a80 | 20 20 20 20 20 20 20 20 20 52 65 63 74 61 6e 67 75 6c 61 72 20 20 20 20 20 20 7c 20 20 20 20 20 | .........Rectangular......|..... |
| 66aa0 | 20 20 20 20 50 6f 6c 61 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 70 72 | ....Polar...................repr |
| 66ac0 | 65 73 65 6e 74 61 74 69 6f 6e 20 20 20 20 20 7c 20 20 20 20 20 72 65 70 72 65 73 65 6e 74 61 74 | esentation.....|.....representat |
| 66ae0 | 69 6f 6e 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ion...........------------------ |
| 66b00 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ---------+---------------------- |
| 66b20 | 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4c 69 73 74 20 73 74 72 75 63 74 75 | -----...............List.structu |
| 66b40 | 72 65 20 61 6e 64 20 70 72 69 6d 69 74 69 76 65 20 6d 61 63 68 69 6e 65 20 61 72 69 74 68 6d 65 | re.and.primitive.machine.arithme |
| 66b60 | 74 69 63 0a 0a 20 20 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 35 3a 3a 20 77 | tic.....In.section.*Note.2-5::.w |
| 66b80 | 65 20 77 69 6c 6c 20 73 68 6f 77 20 68 6f 77 20 74 6f 20 75 73 65 20 74 79 70 65 20 74 61 67 73 | e.will.show.how.to.use.type.tags |
| 66ba0 | 20 61 6e 64 0a 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 73 74 79 6c 65 20 74 6f 20 64 65 76 65 | .and.data-directed.style.to.deve |
| 66bc0 | 6c 6f 70 20 61 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 | lop.a.generic.arithmetic.package |
| 66be0 | 2e 20 20 54 68 69 73 0a 70 72 6f 76 69 64 65 73 20 70 72 6f 63 65 64 75 72 65 73 20 28 60 61 64 | ...This.provides.procedures.(`ad |
| 66c00 | 64 27 2c 20 60 6d 75 6c 27 2c 20 61 6e 64 20 73 6f 20 6f 6e 29 20 74 68 61 74 20 63 61 6e 20 62 | d',.`mul',.and.so.on).that.can.b |
| 66c20 | 65 20 75 73 65 64 20 74 6f 0a 6d 61 6e 69 70 75 6c 61 74 65 20 61 6c 6c 20 73 6f 72 74 73 20 6f | e.used.to.manipulate.all.sorts.o |
| 66c40 | 66 20 22 6e 75 6d 62 65 72 73 22 20 61 6e 64 20 63 61 6e 20 62 65 20 65 61 73 69 6c 79 20 65 78 | f."numbers".and.can.be.easily.ex |
| 66c60 | 74 65 6e 64 65 64 20 77 68 65 6e 20 61 20 6e 65 77 0a 6b 69 6e 64 20 6f 66 20 6e 75 6d 62 65 72 | tended.when.a.new.kind.of.number |
| 66c80 | 20 69 73 20 6e 65 65 64 65 64 2e 20 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d | .is.needed...In.section.*Note.2- |
| 66ca0 | 35 2d 33 3a 3a 2c 20 77 65 27 6c 6c 20 73 68 6f 77 20 68 6f 77 20 74 6f 0a 75 73 65 20 67 65 6e | 5-3::,.we'll.show.how.to.use.gen |
| 66cc0 | 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 69 6e 20 61 20 73 79 73 74 65 6d 20 74 68 61 74 | eric.arithmetic.in.a.system.that |
| 66ce0 | 20 70 65 72 66 6f 72 6d 73 20 73 79 6d 62 6f 6c 69 63 20 61 6c 67 65 62 72 61 2e 0a 0a 2a 20 4d | .performs.symbolic.algebra...*.M |
| 66d00 | 65 6e 75 3a 0a 0a 2a 20 32 2d 34 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 52 65 70 72 65 | enu:..*.2-4-1::............Repre |
| 66d20 | 73 65 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 43 6f 6d 70 6c 65 78 20 4e 75 6d 62 65 72 73 0a 2a | sentations.for.Complex.Numbers.* |
| 66d40 | 20 32 2d 34 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 61 67 67 65 64 20 64 61 74 61 0a | .2-4-2::............Tagged.data. |
| 66d60 | 2a 20 32 2d 34 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 44 61 74 61 2d 44 69 72 65 63 74 | *.2-4-3::............Data-Direct |
| 66d80 | 65 64 20 50 72 6f 67 72 61 6d 6d 69 6e 67 20 61 6e 64 20 41 64 64 69 74 69 76 69 74 79 0a 0a 1f | ed.Programming.and.Additivity... |
| 66da0 | 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 34 2d 31 2c 20 | .File:.sicp.info,..Node:.2-4-1,. |
| 66dc0 | 20 4e 65 78 74 3a 20 32 2d 34 2d 32 2c 20 20 50 72 65 76 3a 20 32 2d 34 2c 20 20 55 70 3a 20 32 | .Next:.2-4-2,..Prev:.2-4,..Up:.2 |
| 66de0 | 2d 34 0a 0a 32 2e 34 2e 31 20 52 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 43 6f | -4..2.4.1.Representations.for.Co |
| 66e00 | 6d 70 6c 65 78 20 4e 75 6d 62 65 72 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | mplex.Numbers.------------------ |
| 66e20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 65 20 77 69 6c 6c | -----------------------..We.will |
| 66e40 | 20 64 65 76 65 6c 6f 70 20 61 20 73 79 73 74 65 6d 20 74 68 61 74 20 70 65 72 66 6f 72 6d 73 20 | .develop.a.system.that.performs. |
| 66e60 | 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 63 6f 6d 70 6c 65 78 | arithmetic.operations.on.complex |
| 66e80 | 0a 6e 75 6d 62 65 72 73 20 61 73 20 61 20 73 69 6d 70 6c 65 20 62 75 74 20 75 6e 72 65 61 6c 69 | .numbers.as.a.simple.but.unreali |
| 66ea0 | 73 74 69 63 20 65 78 61 6d 70 6c 65 20 6f 66 20 61 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 75 | stic.example.of.a.program.that.u |
| 66ec0 | 73 65 73 0a 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 57 65 20 62 65 67 69 | ses.generic.operations...We.begi |
| 66ee0 | 6e 20 62 79 20 64 69 73 63 75 73 73 69 6e 67 20 74 77 6f 20 70 6c 61 75 73 69 62 6c 65 0a 72 65 | n.by.discussing.two.plausible.re |
| 66f00 | 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 | presentations.for.complex.number |
| 66f20 | 73 20 61 73 20 6f 72 64 65 72 65 64 20 70 61 69 72 73 3a 20 72 65 63 74 61 6e 67 75 6c 61 72 20 | s.as.ordered.pairs:.rectangular. |
| 66f40 | 66 6f 72 6d 0a 28 72 65 61 6c 20 70 61 72 74 20 61 6e 64 20 69 6d 61 67 69 6e 61 72 79 20 70 61 | form.(real.part.and.imaginary.pa |
| 66f60 | 72 74 29 20 61 6e 64 20 70 6f 6c 61 72 20 66 6f 72 6d 20 28 6d 61 67 6e 69 74 75 64 65 20 61 6e | rt).and.polar.form.(magnitude.an |
| 66f80 | 64 20 61 6e 67 6c 65 29 2e 28 31 29 0a 53 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 32 | d.angle).(1).Section.*Note.2-4-2 |
| 66fa0 | 3a 3a 20 77 69 6c 6c 20 73 68 6f 77 20 68 6f 77 20 62 6f 74 68 20 72 65 70 72 65 73 65 6e 74 61 | ::.will.show.how.both.representa |
| 66fc0 | 74 69 6f 6e 73 20 63 61 6e 20 62 65 20 6d 61 64 65 0a 74 6f 20 63 6f 65 78 69 73 74 20 69 6e 20 | tions.can.be.made.to.coexist.in. |
| 66fe0 | 61 20 73 69 6e 67 6c 65 20 73 79 73 74 65 6d 20 74 68 72 6f 75 67 68 20 74 68 65 20 75 73 65 20 | a.single.system.through.the.use. |
| 67000 | 6f 66 20 74 79 70 65 20 74 61 67 73 20 61 6e 64 20 67 65 6e 65 72 69 63 0a 6f 70 65 72 61 74 69 | of.type.tags.and.generic.operati |
| 67020 | 6f 6e 73 2e 0a 0a 20 20 20 4c 69 6b 65 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2c 20 | ons......Like.rational.numbers,. |
| 67040 | 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 61 72 65 20 6e 61 74 75 72 61 6c 6c 79 20 72 65 | complex.numbers.are.naturally.re |
| 67060 | 70 72 65 73 65 6e 74 65 64 20 61 73 0a 6f 72 64 65 72 65 64 20 70 61 69 72 73 2e 20 20 54 68 65 | presented.as.ordered.pairs...The |
| 67080 | 20 73 65 74 20 6f 66 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 63 61 6e 20 62 65 20 74 | .set.of.complex.numbers.can.be.t |
| 670a0 | 68 6f 75 67 68 74 20 6f 66 20 61 73 20 61 0a 74 77 6f 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 73 | hought.of.as.a.two-dimensional.s |
| 670c0 | 70 61 63 65 20 77 69 74 68 20 74 77 6f 20 6f 72 74 68 6f 67 6f 6e 61 6c 20 61 78 65 73 2c 20 74 | pace.with.two.orthogonal.axes,.t |
| 670e0 | 68 65 20 22 72 65 61 6c 22 20 61 78 69 73 20 61 6e 64 20 74 68 65 0a 22 69 6d 61 67 69 6e 61 72 | he."real".axis.and.the."imaginar |
| 67100 | 79 22 20 61 78 69 73 2e 20 28 53 65 65 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 32 30 3a | y".axis..(See.*Note.Figure.2-20: |
| 67120 | 3a 2e 29 20 20 46 72 6f 6d 20 74 68 69 73 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 2c 0a 74 68 | :.)..From.this.point.of.view,.th |
| 67140 | 65 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 7a 20 3d 20 78 20 2b 20 69 79 20 28 77 68 65 | e.complex.number.z.=.x.+.iy.(whe |
| 67160 | 72 65 20 69 5e 32 20 3d 20 2d 20 31 29 20 63 61 6e 20 62 65 20 74 68 6f 75 67 68 74 20 6f 66 20 | re.i^2.=.-.1).can.be.thought.of. |
| 67180 | 61 73 0a 74 68 65 20 70 6f 69 6e 74 20 69 6e 20 74 68 65 20 70 6c 61 6e 65 20 77 68 6f 73 65 20 | as.the.point.in.the.plane.whose. |
| 671a0 | 72 65 61 6c 20 63 6f 6f 72 64 69 6e 61 74 65 20 69 73 20 78 20 61 6e 64 20 77 68 6f 73 65 20 69 | real.coordinate.is.x.and.whose.i |
| 671c0 | 6d 61 67 69 6e 61 72 79 0a 63 6f 6f 72 64 69 6e 61 74 65 20 69 73 20 79 2e 20 20 41 64 64 69 74 | maginary.coordinate.is.y...Addit |
| 671e0 | 69 6f 6e 20 6f 66 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 72 65 64 75 63 65 73 20 69 | ion.of.complex.numbers.reduces.i |
| 67200 | 6e 20 74 68 69 73 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 74 6f 20 61 64 64 69 74 69 6f | n.this.representation.to.additio |
| 67220 | 6e 20 6f 66 20 63 6f 6f 72 64 69 6e 61 74 65 73 3a 0a 0a 20 20 20 20 20 52 65 61 6c 2d 70 61 72 | n.of.coordinates:.......Real-par |
| 67240 | 74 28 7a 5f 31 20 2b 20 7a 5f 32 29 20 3d 20 52 65 61 6c 2d 70 61 72 74 28 7a 5f 31 29 20 2b 20 | t(z_1.+.z_2).=.Real-part(z_1).+. |
| 67260 | 52 65 61 6c 2d 70 61 72 74 28 7a 5f 32 29 0a 0a 20 20 20 20 20 49 6d 61 67 69 6e 61 72 79 2d 70 | Real-part(z_2).......Imaginary-p |
| 67280 | 61 72 74 28 7a 5f 31 20 2b 20 7a 5f 32 29 20 3d 20 49 6d 61 67 69 6e 61 72 79 2d 70 61 72 74 28 | art(z_1.+.z_2).=.Imaginary-part( |
| 672a0 | 7a 5f 31 29 20 2b 20 49 6d 61 67 69 6e 61 72 79 2d 70 61 72 74 28 7a 5f 32 29 0a 0a 20 20 20 57 | z_1).+.Imaginary-part(z_2).....W |
| 672c0 | 68 65 6e 20 6d 75 6c 74 69 70 6c 79 69 6e 67 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2c | hen.multiplying.complex.numbers, |
| 672e0 | 20 69 74 20 69 73 20 6d 6f 72 65 20 6e 61 74 75 72 61 6c 20 74 6f 20 74 68 69 6e 6b 20 69 6e 0a | .it.is.more.natural.to.think.in. |
| 67300 | 74 65 72 6d 73 20 6f 66 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 20 63 6f 6d 70 6c 65 78 20 | terms.of.representing.a.complex. |
| 67320 | 6e 75 6d 62 65 72 20 69 6e 20 70 6f 6c 61 72 20 66 6f 72 6d 2c 20 61 73 20 61 20 6d 61 67 6e 69 | number.in.polar.form,.as.a.magni |
| 67340 | 74 75 64 65 0a 61 6e 64 20 61 6e 20 61 6e 67 6c 65 20 28 72 20 61 6e 64 20 41 20 69 6e 20 2a 4e | tude.and.an.angle.(r.and.A.in.*N |
| 67360 | 6f 74 65 20 46 69 67 75 72 65 20 32 2d 32 30 3a 3a 29 2e 20 20 54 68 65 20 70 72 6f 64 75 63 74 | ote.Figure.2-20::)...The.product |
| 67380 | 20 6f 66 20 74 77 6f 0a 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 69 73 20 74 68 65 20 76 | .of.two.complex.numbers.is.the.v |
| 673a0 | 65 63 74 6f 72 20 6f 62 74 61 69 6e 65 64 20 62 79 20 73 74 72 65 74 63 68 69 6e 67 20 6f 6e 65 | ector.obtained.by.stretching.one |
| 673c0 | 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 0a 62 79 20 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 | .complex.number.by.the.length.of |
| 673e0 | 20 74 68 65 20 6f 74 68 65 72 20 61 6e 64 20 74 68 65 6e 20 72 6f 74 61 74 69 6e 67 20 69 74 20 | .the.other.and.then.rotating.it. |
| 67400 | 74 68 72 6f 75 67 68 20 74 68 65 20 61 6e 67 6c 65 20 6f 66 0a 74 68 65 20 6f 74 68 65 72 3a 0a | through.the.angle.of.the.other:. |
| 67420 | 0a 20 20 20 20 20 4d 61 67 6e 69 74 75 64 65 28 7a 5f 31 20 2a 20 7a 5f 32 29 20 3d 20 4d 61 67 | ......Magnitude(z_1.*.z_2).=.Mag |
| 67440 | 6e 69 74 75 64 65 28 7a 5f 31 29 20 2a 20 4d 61 67 6e 69 74 75 64 65 28 7a 5f 32 29 0a 0a 20 20 | nitude(z_1).*.Magnitude(z_2).... |
| 67460 | 20 20 20 41 6e 67 6c 65 28 7a 5f 31 20 2a 20 7a 5f 32 29 20 3d 20 41 6e 67 6c 65 28 7a 5f 31 29 | ...Angle(z_1.*.z_2).=.Angle(z_1) |
| 67480 | 20 2b 20 41 6e 67 6c 65 28 7a 5f 32 29 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 32 30 | .+.Angle(z_2).......*Figure.2.20 |
| 674a0 | 3a 2a 20 43 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 61 73 20 70 6f 69 6e 74 73 20 69 6e 20 | :*.Complex.numbers.as.points.in. |
| 674c0 | 74 68 65 20 70 6c 61 6e 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 49 6d 61 67 69 6e 61 72 79 | the.plane..............Imaginary |
| 674e0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | ...............^...............| |
| 67500 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 79 20 7c 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | .............y.|................ |
| 67520 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2a 20 7a 20 3d 20 78 20 2b 20 3f 79 20 3d 20 72 20 65 5e 28 3f 41 29 | .........*.z.=.x.+.?y.=.r.e^(?A) |
| 67540 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...............|................ |
| 67560 | 20 20 20 20 5f 5f 2d 2d 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | ....__--.................|...... |
| 67580 | 20 20 20 20 20 20 20 20 20 20 5f 5f 2d 2d 20 20 20 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 | ..........__--.................. |
| 675a0 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 72 20 5f 5f 2d 2d 20 20 20 20 20 20 20 20 20 2e 0a 20 | ...|..........r.__--............ |
| 675c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 5f 5f 2d 2d 20 20 20 20 20 20 | .............|........__--...... |
| 675e0 | 20 20 20 20 20 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 5f 5f 2d 2d | .......................|....__-- |
| 67600 | 20 5c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .\.............................. |
| 67620 | 20 7c 5f 5f 2d 2d 20 20 20 20 41 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 0a 20 20 20 | .|__--....A.|................... |
| 67640 | 20 20 20 20 20 20 20 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d | .......----+----------+--------- |
| 67660 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 20 52 65 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---------->.Real................ |
| 67680 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 0a 0a 20 20 20 54 | .........................x.....T |
| 676a0 | 68 75 73 2c 20 74 68 65 72 65 20 61 72 65 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 72 65 70 | hus,.there.are.two.different.rep |
| 676c0 | 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 | resentations.for.complex.numbers |
| 676e0 | 2c 0a 77 68 69 63 68 20 61 72 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 66 6f 72 20 64 69 66 66 | ,.which.are.appropriate.for.diff |
| 67700 | 65 72 65 6e 74 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 59 65 74 2c 20 66 72 6f 6d 20 74 68 65 | erent.operations...Yet,.from.the |
| 67720 | 0a 76 69 65 77 70 6f 69 6e 74 20 6f 66 20 73 6f 6d 65 6f 6e 65 20 77 72 69 74 69 6e 67 20 61 20 | .viewpoint.of.someone.writing.a. |
| 67740 | 70 72 6f 67 72 61 6d 20 74 68 61 74 20 75 73 65 73 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 | program.that.uses.complex.number |
| 67760 | 73 2c 20 74 68 65 0a 70 72 69 6e 63 69 70 6c 65 20 6f 66 20 64 61 74 61 20 61 62 73 74 72 61 63 | s,.the.principle.of.data.abstrac |
| 67780 | 74 69 6f 6e 20 73 75 67 67 65 73 74 73 20 74 68 61 74 20 61 6c 6c 20 74 68 65 20 6f 70 65 72 61 | tion.suggests.that.all.the.opera |
| 677a0 | 74 69 6f 6e 73 20 66 6f 72 0a 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 63 6f 6d 70 6c 65 78 20 6e | tions.for.manipulating.complex.n |
| 677c0 | 75 6d 62 65 72 73 20 73 68 6f 75 6c 64 20 62 65 20 61 76 61 69 6c 61 62 6c 65 20 72 65 67 61 72 | umbers.should.be.available.regar |
| 677e0 | 64 6c 65 73 73 20 6f 66 20 77 68 69 63 68 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 | dless.of.which.representation.is |
| 67800 | 20 75 73 65 64 20 62 79 20 74 68 65 20 63 6f 6d 70 75 74 65 72 2e 20 20 46 6f 72 20 65 78 61 6d | .used.by.the.computer...For.exam |
| 67820 | 70 6c 65 2c 20 69 74 20 69 73 20 6f 66 74 65 6e 0a 75 73 65 66 75 6c 20 74 6f 20 62 65 20 61 62 | ple,.it.is.often.useful.to.be.ab |
| 67840 | 6c 65 20 74 6f 20 66 69 6e 64 20 74 68 65 20 6d 61 67 6e 69 74 75 64 65 20 6f 66 20 61 20 63 6f | le.to.find.the.magnitude.of.a.co |
| 67860 | 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 74 68 61 74 20 69 73 0a 73 70 65 63 69 66 69 65 64 20 62 | mplex.number.that.is.specified.b |
| 67880 | 79 20 72 65 63 74 61 6e 67 75 6c 61 72 20 63 6f 6f 72 64 69 6e 61 74 65 73 2e 20 20 53 69 6d 69 | y.rectangular.coordinates...Simi |
| 678a0 | 6c 61 72 6c 79 2c 20 69 74 20 69 73 20 6f 66 74 65 6e 20 75 73 65 66 75 6c 20 74 6f 0a 62 65 20 | larly,.it.is.often.useful.to.be. |
| 678c0 | 61 62 6c 65 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 72 65 61 6c 20 70 61 72 74 20 | able.to.determine.the.real.part. |
| 678e0 | 6f 66 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 74 68 61 74 20 69 73 0a 73 70 65 63 | of.a.complex.number.that.is.spec |
| 67900 | 69 66 69 65 64 20 62 79 20 70 6f 6c 61 72 20 63 6f 6f 72 64 69 6e 61 74 65 73 2e 0a 0a 20 20 20 | ified.by.polar.coordinates...... |
| 67920 | 54 6f 20 64 65 73 69 67 6e 20 73 75 63 68 20 61 20 73 79 73 74 65 6d 2c 20 77 65 20 63 61 6e 20 | To.design.such.a.system,.we.can. |
| 67940 | 66 6f 6c 6c 6f 77 20 74 68 65 20 73 61 6d 65 20 64 61 74 61 2d 61 62 73 74 72 61 63 74 69 6f 6e | follow.the.same.data-abstraction |
| 67960 | 0a 73 74 72 61 74 65 67 79 20 77 65 20 66 6f 6c 6c 6f 77 65 64 20 69 6e 20 64 65 73 69 67 6e 69 | .strategy.we.followed.in.designi |
| 67980 | 6e 67 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 20 70 61 63 6b 61 67 65 20 69 | ng.the.rational-number.package.i |
| 679a0 | 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 31 2d 31 3a 3a 2e 20 20 41 73 73 75 6d 65 | n.section.*Note.2-1-1::...Assume |
| 679c0 | 20 74 68 61 74 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 63 6f 6d 70 6c 65 78 20 | .that.the.operations.on.complex. |
| 679e0 | 6e 75 6d 62 65 72 73 0a 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 74 65 72 6d 73 | numbers.are.implemented.in.terms |
| 67a00 | 20 6f 66 20 66 6f 75 72 20 73 65 6c 65 63 74 6f 72 73 3a 20 60 72 65 61 6c 2d 70 61 72 74 27 2c | .of.four.selectors:.`real-part', |
| 67a20 | 20 60 69 6d 61 67 2d 70 61 72 74 27 2c 0a 60 6d 61 67 6e 69 74 75 64 65 27 2c 20 61 6e 64 20 60 | .`imag-part',.`magnitude',.and.` |
| 67a40 | 61 6e 67 6c 65 27 2e 20 20 41 6c 73 6f 20 61 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 68 61 76 | angle'...Also.assume.that.we.hav |
| 67a60 | 65 20 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 0a 63 6f 6e 73 74 72 75 63 74 69 6e | e.two.procedures.for.constructin |
| 67a80 | 67 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 3a 20 60 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 | g.complex.numbers:.`make-from-re |
| 67aa0 | 61 6c 2d 69 6d 61 67 27 20 72 65 74 75 72 6e 73 20 61 20 63 6f 6d 70 6c 65 78 0a 6e 75 6d 62 65 | al-imag'.returns.a.complex.numbe |
| 67ac0 | 72 20 77 69 74 68 20 73 70 65 63 69 66 69 65 64 20 72 65 61 6c 20 61 6e 64 20 69 6d 61 67 69 6e | r.with.specified.real.and.imagin |
| 67ae0 | 61 72 79 20 70 61 72 74 73 2c 20 61 6e 64 20 60 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e | ary.parts,.and.`make-from-mag-an |
| 67b00 | 67 27 0a 72 65 74 75 72 6e 73 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 77 69 74 68 | g'.returns.a.complex.number.with |
| 67b20 | 20 73 70 65 63 69 66 69 65 64 20 6d 61 67 6e 69 74 75 64 65 20 61 6e 64 20 61 6e 67 6c 65 2e 20 | .specified.magnitude.and.angle.. |
| 67b40 | 20 54 68 65 73 65 0a 70 72 6f 63 65 64 75 72 65 73 20 68 61 76 65 20 74 68 65 20 70 72 6f 70 65 | .These.procedures.have.the.prope |
| 67b60 | 72 74 79 20 74 68 61 74 2c 20 66 6f 72 20 61 6e 79 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 | rty.that,.for.any.complex.number |
| 67b80 | 20 60 7a 27 2c 20 62 6f 74 68 0a 0a 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c | .`z',.both.......(make-from-real |
| 67ba0 | 2d 69 6d 61 67 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 29 20 28 69 6d 61 67 2d 70 61 72 74 20 7a | -imag.(real-part.z).(imag-part.z |
| 67bc0 | 29 29 0a 0a 61 6e 64 0a 0a 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 | ))..and.......(make-from-mag-ang |
| 67be0 | 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 29 20 28 61 6e 67 6c 65 20 7a 29 29 0a 0a 70 72 6f 64 75 | .(magnitude.z).(angle.z))..produ |
| 67c00 | 63 65 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 74 68 61 74 20 61 72 65 20 65 71 75 61 | ce.complex.numbers.that.are.equa |
| 67c20 | 6c 20 74 6f 20 60 7a 27 2e 0a 0a 20 20 20 55 73 69 6e 67 20 74 68 65 73 65 20 63 6f 6e 73 74 72 | l.to.`z'......Using.these.constr |
| 67c40 | 75 63 74 6f 72 73 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 73 2c 20 77 65 20 63 61 6e 20 69 6d 70 | uctors.and.selectors,.we.can.imp |
| 67c60 | 6c 65 6d 65 6e 74 20 61 72 69 74 68 6d 65 74 69 63 0a 6f 6e 20 63 6f 6d 70 6c 65 78 20 6e 75 6d | lement.arithmetic.on.complex.num |
| 67c80 | 62 65 72 73 20 75 73 69 6e 67 20 74 68 65 20 22 61 62 73 74 72 61 63 74 20 64 61 74 61 22 20 73 | bers.using.the."abstract.data".s |
| 67ca0 | 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 0a 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 61 6e 64 | pecified.by.the.constructors.and |
| 67cc0 | 20 73 65 6c 65 63 74 6f 72 73 2c 20 6a 75 73 74 20 61 73 20 77 65 20 64 69 64 20 66 6f 72 20 72 | .selectors,.just.as.we.did.for.r |
| 67ce0 | 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | ational.numbers.in.section.*Note |
| 67d00 | 20 32 2d 31 2d 31 3a 3a 2e 20 20 41 73 20 73 68 6f 77 6e 20 69 6e 20 74 68 65 20 66 6f 72 6d 75 | .2-1-1::...As.shown.in.the.formu |
| 67d20 | 6c 61 73 20 61 62 6f 76 65 2c 20 77 65 20 63 61 6e 20 61 64 64 20 61 6e 64 0a 73 75 62 74 72 61 | las.above,.we.can.add.and.subtra |
| 67d40 | 63 74 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 72 | ct.complex.numbers.in.terms.of.r |
| 67d60 | 65 61 6c 20 61 6e 64 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 73 20 77 68 69 6c 65 0a 6d 75 | eal.and.imaginary.parts.while.mu |
| 67d80 | 6c 74 69 70 6c 79 69 6e 67 20 61 6e 64 20 64 69 76 69 64 69 6e 67 20 63 6f 6d 70 6c 65 78 20 6e | ltiplying.and.dividing.complex.n |
| 67da0 | 75 6d 62 65 72 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6d 61 67 6e 69 74 75 64 65 73 20 61 6e | umbers.in.terms.of.magnitudes.an |
| 67dc0 | 64 0a 61 6e 67 6c 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 63 6f 6d | d.angles:.......(define.(add-com |
| 67de0 | 70 6c 65 78 20 7a 31 20 7a 32 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 | plex.z1.z2)........(make-from-re |
| 67e00 | 61 6c 2d 69 6d 61 67 20 28 2b 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 31 29 20 28 72 65 61 6c 2d | al-imag.(+.(real-part.z1).(real- |
| 67e20 | 70 61 72 74 20 7a 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | part.z2))....................... |
| 67e40 | 20 20 20 20 20 20 28 2b 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 31 29 20 28 69 6d 61 67 2d 70 61 | ......(+.(imag-part.z1).(imag-pa |
| 67e60 | 72 74 20 7a 32 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 62 2d 63 6f 6d | rt.z2)))).......(define.(sub-com |
| 67e80 | 70 6c 65 78 20 7a 31 20 7a 32 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 | plex.z1.z2)........(make-from-re |
| 67ea0 | 61 6c 2d 69 6d 61 67 20 28 2d 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 31 29 20 28 72 65 61 6c 2d | al-imag.(-.(real-part.z1).(real- |
| 67ec0 | 70 61 72 74 20 7a 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | part.z2))....................... |
| 67ee0 | 20 20 20 20 20 20 28 2d 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 31 29 20 28 69 6d 61 67 2d 70 61 | ......(-.(imag-part.z1).(imag-pa |
| 67f00 | 72 74 20 7a 32 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 2d 63 6f 6d | rt.z2)))).......(define.(mul-com |
| 67f20 | 70 6c 65 78 20 7a 31 20 7a 32 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 | plex.z1.z2)........(make-from-ma |
| 67f40 | 67 2d 61 6e 67 20 28 2a 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 31 29 20 28 6d 61 67 6e 69 74 75 | g-ang.(*.(magnitude.z1).(magnitu |
| 67f60 | 64 65 20 7a 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | de.z2))......................... |
| 67f80 | 20 20 28 2b 20 28 61 6e 67 6c 65 20 7a 31 29 20 28 61 6e 67 6c 65 20 7a 32 29 29 29 29 0a 0a 20 | ..(+.(angle.z1).(angle.z2))))... |
| 67fa0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 76 2d 63 6f 6d 70 6c 65 78 20 7a 31 20 7a 32 29 0a | ....(define.(div-complex.z1.z2). |
| 67fc0 | 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 28 2f 20 28 6d 61 | .......(make-from-mag-ang.(/.(ma |
| 67fe0 | 67 6e 69 74 75 64 65 20 7a 31 29 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 32 29 29 0a 20 20 20 20 | gnitude.z1).(magnitude.z2))..... |
| 68000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2d 20 28 61 6e 67 6c 65 20 | ......................(-.(angle. |
| 68020 | 7a 31 29 20 28 61 6e 67 6c 65 20 7a 32 29 29 29 29 0a 0a 20 20 20 54 6f 20 63 6f 6d 70 6c 65 74 | z1).(angle.z2)))).....To.complet |
| 68040 | 65 20 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 70 61 63 6b 61 67 65 2c 20 77 65 | e.the.complex-number.package,.we |
| 68060 | 20 6d 75 73 74 20 63 68 6f 6f 73 65 20 61 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 61 6e | .must.choose.a.representation.an |
| 68080 | 64 20 77 65 20 6d 75 73 74 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 63 6f 6e 73 74 72 75 63 | d.we.must.implement.the.construc |
| 680a0 | 74 6f 72 73 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 73 20 69 6e 0a 74 65 72 6d 73 20 6f 66 20 70 | tors.and.selectors.in.terms.of.p |
| 680c0 | 72 69 6d 69 74 69 76 65 20 6e 75 6d 62 65 72 73 20 61 6e 64 20 70 72 69 6d 69 74 69 76 65 20 6c | rimitive.numbers.and.primitive.l |
| 680e0 | 69 73 74 20 73 74 72 75 63 74 75 72 65 2e 20 20 54 68 65 72 65 20 61 72 65 20 74 77 6f 0a 6f 62 | ist.structure...There.are.two.ob |
| 68100 | 76 69 6f 75 73 20 77 61 79 73 20 74 6f 20 64 6f 20 74 68 69 73 3a 20 57 65 20 63 61 6e 20 72 65 | vious.ways.to.do.this:.We.can.re |
| 68120 | 70 72 65 73 65 6e 74 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 69 6e 0a 22 72 65 63 | present.a.complex.number.in."rec |
| 68140 | 74 61 6e 67 75 6c 61 72 20 66 6f 72 6d 22 20 61 73 20 61 20 70 61 69 72 20 28 72 65 61 6c 20 70 | tangular.form".as.a.pair.(real.p |
| 68160 | 61 72 74 2c 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 29 20 6f 72 20 69 6e 20 22 70 6f 6c 61 | art,.imaginary.part).or.in."pola |
| 68180 | 72 0a 66 6f 72 6d 22 20 61 73 20 61 20 70 61 69 72 20 28 6d 61 67 6e 69 74 75 64 65 2c 20 61 6e | r.form".as.a.pair.(magnitude,.an |
| 681a0 | 67 6c 65 29 2e 20 20 57 68 69 63 68 20 73 68 61 6c 6c 20 77 65 20 63 68 6f 6f 73 65 3f 0a 0a 20 | gle)...Which.shall.we.choose?... |
| 681c0 | 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 | ..In.order.to.make.the.different |
| 681e0 | 20 63 68 6f 69 63 65 73 20 63 6f 6e 63 72 65 74 65 2c 20 69 6d 61 67 69 6e 65 20 74 68 61 74 20 | .choices.concrete,.imagine.that. |
| 68200 | 74 68 65 72 65 0a 61 72 65 20 74 77 6f 20 70 72 6f 67 72 61 6d 6d 65 72 73 2c 20 42 65 6e 20 42 | there.are.two.programmers,.Ben.B |
| 68220 | 69 74 64 69 64 64 6c 65 20 61 6e 64 20 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 2c 20 77 | itdiddle.and.Alyssa.P..Hacker,.w |
| 68240 | 68 6f 20 61 72 65 0a 69 6e 64 65 70 65 6e 64 65 6e 74 6c 79 20 64 65 73 69 67 6e 69 6e 67 20 72 | ho.are.independently.designing.r |
| 68260 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e | epresentations.for.the.complex-n |
| 68280 | 75 6d 62 65 72 20 73 79 73 74 65 6d 2e 0a 42 65 6e 20 63 68 6f 6f 73 65 73 20 74 6f 20 72 65 70 | umber.system..Ben.chooses.to.rep |
| 682a0 | 72 65 73 65 6e 74 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 69 6e 20 72 65 63 74 61 6e | resent.complex.numbers.in.rectan |
| 682c0 | 67 75 6c 61 72 20 66 6f 72 6d 2e 20 20 57 69 74 68 0a 74 68 69 73 20 63 68 6f 69 63 65 2c 20 73 | gular.form...With.this.choice,.s |
| 682e0 | 65 6c 65 63 74 69 6e 67 20 74 68 65 20 72 65 61 6c 20 61 6e 64 20 69 6d 61 67 69 6e 61 72 79 20 | electing.the.real.and.imaginary. |
| 68300 | 70 61 72 74 73 20 6f 66 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 0a 69 73 20 73 74 72 | parts.of.a.complex.number.is.str |
| 68320 | 61 69 67 68 74 66 6f 72 77 61 72 64 2c 20 61 73 20 69 73 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 | aightforward,.as.is.constructing |
| 68340 | 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 77 69 74 68 20 67 69 76 65 6e 20 72 65 61 | .a.complex.number.with.given.rea |
| 68360 | 6c 0a 61 6e 64 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 73 2e 20 20 54 6f 20 66 69 6e 64 20 | l.and.imaginary.parts...To.find. |
| 68380 | 74 68 65 20 6d 61 67 6e 69 74 75 64 65 20 61 6e 64 20 74 68 65 20 61 6e 67 6c 65 2c 20 6f 72 20 | the.magnitude.and.the.angle,.or. |
| 683a0 | 74 6f 0a 63 6f 6e 73 74 72 75 63 74 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 77 69 | to.construct.a.complex.number.wi |
| 683c0 | 74 68 20 61 20 67 69 76 65 6e 20 6d 61 67 6e 69 74 75 64 65 20 61 6e 64 20 61 6e 67 6c 65 2c 20 | th.a.given.magnitude.and.angle,. |
| 683e0 | 68 65 20 75 73 65 73 0a 74 68 65 20 74 72 69 67 6f 6e 6f 6d 65 74 72 69 63 20 72 65 6c 61 74 69 | he.uses.the.trigonometric.relati |
| 68400 | 6f 6e 73 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ons............................. |
| 68420 | 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 0a 20 20 20 20 20 78 20 3d 20 72 20 63 6f 73 20 41 20 20 20 20 20 | __________......x.=.r.cos.A..... |
| 68440 | 72 20 3d 20 2e 2f 20 78 5e 32 20 2b 20 79 5e 32 0a 0a 20 20 20 20 20 79 20 3d 20 72 20 73 69 6e | r.=../.x^2.+.y^2.......y.=.r.sin |
| 68460 | 20 41 20 20 20 20 20 41 20 3d 20 61 72 63 74 61 6e 28 79 2c 78 29 0a 0a 77 68 69 63 68 20 72 65 | .A.....A.=.arctan(y,x)..which.re |
| 68480 | 6c 61 74 65 20 74 68 65 20 72 65 61 6c 20 61 6e 64 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 | late.the.real.and.imaginary.part |
| 684a0 | 73 20 28 78 2c 20 79 29 20 74 6f 20 74 68 65 20 6d 61 67 6e 69 74 75 64 65 20 61 6e 64 0a 74 68 | s.(x,.y).to.the.magnitude.and.th |
| 684c0 | 65 20 61 6e 67 6c 65 20 28 72 2c 20 41 29 2e 28 32 29 20 20 42 65 6e 27 73 20 72 65 70 72 65 73 | e.angle.(r,.A).(2)..Ben's.repres |
| 684e0 | 65 6e 74 61 74 69 6f 6e 20 69 73 20 74 68 65 72 65 66 6f 72 65 20 67 69 76 65 6e 20 62 79 20 74 | entation.is.therefore.given.by.t |
| 68500 | 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 20 63 6f 6e 73 74 | he.following.selectors.and.const |
| 68520 | 72 75 63 74 6f 72 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 61 6c 2d 70 61 72 | ructors:.......(define.(real-par |
| 68540 | 74 20 7a 29 20 28 63 61 72 20 7a 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 61 | t.z).(car.z)).......(define.(ima |
| 68560 | 67 2d 70 61 72 74 20 7a 29 20 28 63 64 72 20 7a 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | g-part.z).(cdr.z)).......(define |
| 68580 | 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 29 0a 20 20 20 20 20 20 20 28 73 71 72 74 20 28 2b 20 28 | .(magnitude.z)........(sqrt.(+.( |
| 685a0 | 73 71 75 61 72 65 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 29 29 20 28 73 71 75 61 72 65 20 28 69 | square.(real-part.z)).(square.(i |
| 685c0 | 6d 61 67 2d 70 61 72 74 20 7a 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 | mag-part.z))))).......(define.(a |
| 685e0 | 6e 67 6c 65 20 7a 29 0a 20 20 20 20 20 20 20 28 61 74 61 6e 20 28 69 6d 61 67 2d 70 61 72 74 20 | ngle.z)........(atan.(imag-part. |
| 68600 | 7a 29 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | z).(real-part.z))).......(define |
| 68620 | 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 29 20 28 63 6f 6e 73 | .(make-from-real-imag.x.y).(cons |
| 68640 | 20 78 20 79 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d | .x.y)).......(define.(make-from- |
| 68660 | 6d 61 67 2d 61 6e 67 20 72 20 61 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 2a 20 72 20 28 | mag-ang.r.a)........(cons.(*.r.( |
| 68680 | 63 6f 73 20 61 29 29 20 28 2a 20 72 20 28 73 69 6e 20 61 29 29 29 29 0a 0a 20 20 20 41 6c 79 73 | cos.a)).(*.r.(sin.a)))).....Alys |
| 686a0 | 73 61 2c 20 69 6e 20 63 6f 6e 74 72 61 73 74 2c 20 63 68 6f 6f 73 65 73 20 74 6f 20 72 65 70 72 | sa,.in.contrast,.chooses.to.repr |
| 686c0 | 65 73 65 6e 74 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 69 6e 20 70 6f 6c 61 72 0a 66 | esent.complex.numbers.in.polar.f |
| 686e0 | 6f 72 6d 2e 20 20 46 6f 72 20 68 65 72 2c 20 73 65 6c 65 63 74 69 6e 67 20 74 68 65 20 6d 61 67 | orm...For.her,.selecting.the.mag |
| 68700 | 6e 69 74 75 64 65 20 61 6e 64 20 61 6e 67 6c 65 20 69 73 20 73 74 72 61 69 67 68 74 66 6f 72 77 | nitude.and.angle.is.straightforw |
| 68720 | 61 72 64 2c 0a 62 75 74 20 73 68 65 20 68 61 73 20 74 6f 20 75 73 65 20 74 68 65 20 74 72 69 67 | ard,.but.she.has.to.use.the.trig |
| 68740 | 6f 6e 6f 6d 65 74 72 69 63 20 72 65 6c 61 74 69 6f 6e 73 20 74 6f 20 6f 62 74 61 69 6e 20 74 68 | onometric.relations.to.obtain.th |
| 68760 | 65 20 72 65 61 6c 20 61 6e 64 0a 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 73 2e 20 20 41 6c 79 | e.real.and.imaginary.parts...Aly |
| 68780 | 73 73 61 27 73 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 3a 0a 0a 20 20 20 20 20 28 | ssa's.representation.is:.......( |
| 687a0 | 64 65 66 69 6e 65 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 29 0a 20 20 20 20 20 20 20 28 2a 20 28 | define.(real-part.z)........(*.( |
| 687c0 | 6d 61 67 6e 69 74 75 64 65 20 7a 29 20 28 63 6f 73 20 28 61 6e 67 6c 65 20 7a 29 29 29 29 0a 0a | magnitude.z).(cos.(angle.z)))).. |
| 687e0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 29 0a 20 20 20 20 20 | .....(define.(imag-part.z)...... |
| 68800 | 20 20 28 2a 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 29 20 28 73 69 6e 20 28 61 6e 67 6c 65 20 7a | ..(*.(magnitude.z).(sin.(angle.z |
| 68820 | 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 29 | )))).......(define.(magnitude.z) |
| 68840 | 20 28 63 61 72 20 7a 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 67 6c 65 20 7a | .(car.z)).......(define.(angle.z |
| 68860 | 29 20 28 63 64 72 20 7a 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 | ).(cdr.z)).......(define.(make-f |
| 68880 | 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 20 | rom-real-imag.x.y)........(cons. |
| 688a0 | 28 73 71 72 74 20 28 2b 20 28 73 71 75 61 72 65 20 78 29 20 28 73 71 75 61 72 65 20 79 29 29 29 | (sqrt.(+.(square.x).(square.y))) |
| 688c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 74 61 6e 20 79 20 78 29 29 29 0a 0a 20 20 20 20 | ..............(atan.y.x)))...... |
| 688e0 | 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 72 20 61 29 | .(define.(make-from-mag-ang.r.a) |
| 68900 | 20 28 63 6f 6e 73 20 72 20 61 29 29 0a 0a 20 20 20 54 68 65 20 64 69 73 63 69 70 6c 69 6e 65 20 | .(cons.r.a)).....The.discipline. |
| 68920 | 6f 66 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 65 6e 73 75 72 65 73 20 74 68 61 74 | of.data.abstraction.ensures.that |
| 68940 | 20 74 68 65 20 73 61 6d 65 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 60 61 64 64 | .the.same.implementation.of.`add |
| 68960 | 2d 63 6f 6d 70 6c 65 78 27 2c 20 60 73 75 62 2d 63 6f 6d 70 6c 65 78 27 2c 20 60 6d 75 6c 2d 63 | -complex',.`sub-complex',.`mul-c |
| 68980 | 6f 6d 70 6c 65 78 27 2c 20 61 6e 64 0a 60 64 69 76 2d 63 6f 6d 70 6c 65 78 27 20 77 69 6c 6c 20 | omplex',.and.`div-complex'.will. |
| 689a0 | 77 6f 72 6b 20 77 69 74 68 20 65 69 74 68 65 72 20 42 65 6e 27 73 20 72 65 70 72 65 73 65 6e 74 | work.with.either.Ben's.represent |
| 689c0 | 61 74 69 6f 6e 20 6f 72 20 41 6c 79 73 73 61 27 73 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e | ation.or.Alyssa's.representation |
| 689e0 | 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d | ......----------.Footnotes.----- |
| 68a00 | 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 6e 20 61 63 74 75 61 6c 20 63 6f 6d 70 75 74 61 74 | -----.....(1).In.actual.computat |
| 68a20 | 69 6f 6e 61 6c 20 73 79 73 74 65 6d 73 2c 20 72 65 63 74 61 6e 67 75 6c 61 72 20 66 6f 72 6d 20 | ional.systems,.rectangular.form. |
| 68a40 | 69 73 20 70 72 65 66 65 72 61 62 6c 65 0a 74 6f 20 70 6f 6c 61 72 20 66 6f 72 6d 20 6d 6f 73 74 | is.preferable.to.polar.form.most |
| 68a60 | 20 6f 66 20 74 68 65 20 74 69 6d 65 20 62 65 63 61 75 73 65 20 6f 66 20 72 6f 75 6e 64 6f 66 66 | .of.the.time.because.of.roundoff |
| 68a80 | 20 65 72 72 6f 72 73 20 69 6e 20 63 6f 6e 76 65 72 73 69 6f 6e 0a 62 65 74 77 65 65 6e 20 72 65 | .errors.in.conversion.between.re |
| 68aa0 | 63 74 61 6e 67 75 6c 61 72 20 61 6e 64 20 70 6f 6c 61 72 20 66 6f 72 6d 2e 20 20 54 68 69 73 20 | ctangular.and.polar.form...This. |
| 68ac0 | 69 73 20 77 68 79 20 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 0a 65 78 61 6d 70 6c | is.why.the.complex-number.exampl |
| 68ae0 | 65 20 69 73 20 75 6e 72 65 61 6c 69 73 74 69 63 2e 20 20 4e 65 76 65 72 74 68 65 6c 65 73 73 2c | e.is.unrealistic...Nevertheless, |
| 68b00 | 20 69 74 20 70 72 6f 76 69 64 65 73 20 61 20 63 6c 65 61 72 20 69 6c 6c 75 73 74 72 61 74 69 6f | .it.provides.a.clear.illustratio |
| 68b20 | 6e 0a 6f 66 20 74 68 65 20 64 65 73 69 67 6e 20 6f 66 20 61 20 73 79 73 74 65 6d 20 75 73 69 6e | n.of.the.design.of.a.system.usin |
| 68b40 | 67 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 6e 64 20 61 20 67 6f 6f 64 0a | g.generic.operations.and.a.good. |
| 68b60 | 69 6e 74 72 6f 64 75 63 74 69 6f 6e 20 74 6f 20 74 68 65 20 6d 6f 72 65 20 73 75 62 73 74 61 6e | introduction.to.the.more.substan |
| 68b80 | 74 69 61 6c 20 73 79 73 74 65 6d 73 20 74 6f 20 62 65 20 64 65 76 65 6c 6f 70 65 64 20 6c 61 74 | tial.systems.to.be.developed.lat |
| 68ba0 | 65 72 20 69 6e 0a 74 68 69 73 20 63 68 61 70 74 65 72 2e 0a 0a 20 20 20 28 32 29 20 54 68 65 20 | er.in.this.chapter......(2).The. |
| 68bc0 | 61 72 63 74 61 6e 67 65 6e 74 20 66 75 6e 63 74 69 6f 6e 20 72 65 66 65 72 72 65 64 20 74 6f 20 | arctangent.function.referred.to. |
| 68be0 | 68 65 72 65 2c 20 63 6f 6d 70 75 74 65 64 20 62 79 20 53 63 68 65 6d 65 27 73 0a 60 61 74 61 6e | here,.computed.by.Scheme's.`atan |
| 68c00 | 27 20 70 72 6f 63 65 64 75 72 65 2c 20 69 73 20 64 65 66 69 6e 65 64 20 73 6f 20 61 73 20 74 6f | '.procedure,.is.defined.so.as.to |
| 68c20 | 20 74 61 6b 65 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 20 79 20 61 6e 64 20 78 20 61 6e 64 20 | .take.two.arguments.y.and.x.and. |
| 68c40 | 74 6f 0a 72 65 74 75 72 6e 20 74 68 65 20 61 6e 67 6c 65 20 77 68 6f 73 65 20 74 61 6e 67 65 6e | to.return.the.angle.whose.tangen |
| 68c60 | 74 20 69 73 20 79 2f 78 2e 20 20 54 68 65 20 73 69 67 6e 73 20 6f 66 20 74 68 65 20 61 72 67 75 | t.is.y/x...The.signs.of.the.argu |
| 68c80 | 6d 65 6e 74 73 0a 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 71 75 61 64 72 61 6e 74 20 6f 66 20 | ments.determine.the.quadrant.of. |
| 68ca0 | 74 68 65 20 61 6e 67 6c 65 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 | the.angle.....File:.sicp.info,.. |
| 68cc0 | 4e 6f 64 65 3a 20 32 2d 34 2d 32 2c 20 20 4e 65 78 74 3a 20 32 2d 34 2d 33 2c 20 20 50 72 65 76 | Node:.2-4-2,..Next:.2-4-3,..Prev |
| 68ce0 | 3a 20 32 2d 34 2d 31 2c 20 20 55 70 3a 20 32 2d 34 0a 0a 32 2e 34 2e 32 20 54 61 67 67 65 64 20 | :.2-4-1,..Up:.2-4..2.4.2.Tagged. |
| 68d00 | 64 61 74 61 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 4f 6e 65 20 77 61 79 20 | data.-----------------..One.way. |
| 68d20 | 74 6f 20 76 69 65 77 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 69 73 20 61 73 20 61 | to.view.data.abstraction.is.as.a |
| 68d40 | 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 22 70 72 69 6e 63 69 70 6c 65 0a | n.application.of.the."principle. |
| 68d60 | 6f 66 20 6c 65 61 73 74 20 63 6f 6d 6d 69 74 6d 65 6e 74 2e 22 20 20 49 6e 20 69 6d 70 6c 65 6d | of.least.commitment."..In.implem |
| 68d80 | 65 6e 74 69 6e 67 20 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 73 79 73 74 65 6d | enting.the.complex-number.system |
| 68da0 | 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 31 3a 3a 2c 20 77 65 20 63 61 | .in.section.*Note.2-4-1::,.we.ca |
| 68dc0 | 6e 20 75 73 65 20 65 69 74 68 65 72 20 42 65 6e 27 73 20 72 65 63 74 61 6e 67 75 6c 61 72 0a 72 | n.use.either.Ben's.rectangular.r |
| 68de0 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 72 20 41 6c 79 73 73 61 27 73 20 70 6f 6c 61 72 20 | epresentation.or.Alyssa's.polar. |
| 68e00 | 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 54 68 65 20 61 62 73 74 72 61 63 74 69 6f 6e | representation...The.abstraction |
| 68e20 | 0a 62 61 72 72 69 65 72 20 66 6f 72 6d 65 64 20 62 79 20 74 68 65 20 73 65 6c 65 63 74 6f 72 73 | .barrier.formed.by.the.selectors |
| 68e40 | 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 70 65 72 6d 69 74 73 20 75 73 20 74 6f 20 | .and.constructors.permits.us.to. |
| 68e60 | 64 65 66 65 72 20 74 6f 0a 74 68 65 20 6c 61 73 74 20 70 6f 73 73 69 62 6c 65 20 6d 6f 6d 65 6e | defer.to.the.last.possible.momen |
| 68e80 | 74 20 74 68 65 20 63 68 6f 69 63 65 20 6f 66 20 61 20 63 6f 6e 63 72 65 74 65 20 72 65 70 72 65 | t.the.choice.of.a.concrete.repre |
| 68ea0 | 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 0a 6f 75 72 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 61 | sentation.for.our.data.objects.a |
| 68ec0 | 6e 64 20 74 68 75 73 20 72 65 74 61 69 6e 20 6d 61 78 69 6d 75 6d 20 66 6c 65 78 69 62 69 6c 69 | nd.thus.retain.maximum.flexibili |
| 68ee0 | 74 79 20 69 6e 20 6f 75 72 20 73 79 73 74 65 6d 0a 64 65 73 69 67 6e 2e 0a 0a 20 20 20 54 68 65 | ty.in.our.system.design......The |
| 68f00 | 20 70 72 69 6e 63 69 70 6c 65 20 6f 66 20 6c 65 61 73 74 20 63 6f 6d 6d 69 74 6d 65 6e 74 20 63 | .principle.of.least.commitment.c |
| 68f20 | 61 6e 20 62 65 20 63 61 72 72 69 65 64 20 74 6f 20 65 76 65 6e 20 66 75 72 74 68 65 72 0a 65 78 | an.be.carried.to.even.further.ex |
| 68f40 | 74 72 65 6d 65 73 2e 20 20 49 66 20 77 65 20 64 65 73 69 72 65 2c 20 77 65 20 63 61 6e 20 6d 61 | tremes...If.we.desire,.we.can.ma |
| 68f60 | 69 6e 74 61 69 6e 20 74 68 65 20 61 6d 62 69 67 75 69 74 79 20 6f 66 0a 72 65 70 72 65 73 65 6e | intain.the.ambiguity.of.represen |
| 68f80 | 74 61 74 69 6f 6e 20 65 76 65 6e 20 5f 61 66 74 65 72 5f 20 77 65 20 68 61 76 65 20 64 65 73 69 | tation.even._after_.we.have.desi |
| 68fa0 | 67 6e 65 64 20 74 68 65 20 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 0a 63 6f 6e 73 74 72 75 63 74 | gned.the.selectors.and.construct |
| 68fc0 | 6f 72 73 2c 20 61 6e 64 20 65 6c 65 63 74 20 74 6f 20 75 73 65 20 62 6f 74 68 20 42 65 6e 27 73 | ors,.and.elect.to.use.both.Ben's |
| 68fe0 | 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 5f 61 6e 64 5f 20 41 6c 79 73 73 61 27 73 0a 72 | .representation._and_.Alyssa's.r |
| 69000 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 49 66 20 62 6f 74 68 20 72 65 70 72 65 73 65 6e | epresentation...If.both.represen |
| 69020 | 74 61 74 69 6f 6e 73 20 61 72 65 20 69 6e 63 6c 75 64 65 64 20 69 6e 20 61 20 73 69 6e 67 6c 65 | tations.are.included.in.a.single |
| 69040 | 0a 73 79 73 74 65 6d 2c 20 68 6f 77 65 76 65 72 2c 20 77 65 20 77 69 6c 6c 20 6e 65 65 64 20 73 | .system,.however,.we.will.need.s |
| 69060 | 6f 6d 65 20 77 61 79 20 74 6f 20 64 69 73 74 69 6e 67 75 69 73 68 20 64 61 74 61 20 69 6e 20 70 | ome.way.to.distinguish.data.in.p |
| 69080 | 6f 6c 61 72 0a 66 6f 72 6d 20 66 72 6f 6d 20 64 61 74 61 20 69 6e 20 72 65 63 74 61 6e 67 75 6c | olar.form.from.data.in.rectangul |
| 690a0 | 61 72 20 66 6f 72 6d 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 69 66 20 77 65 20 77 65 72 65 20 | ar.form...Otherwise,.if.we.were. |
| 690c0 | 61 73 6b 65 64 2c 20 66 6f 72 0a 69 6e 73 74 61 6e 63 65 2c 20 74 6f 20 66 69 6e 64 20 74 68 65 | asked,.for.instance,.to.find.the |
| 690e0 | 20 60 6d 61 67 6e 69 74 75 64 65 27 20 6f 66 20 74 68 65 20 70 61 69 72 20 28 33 2c 34 29 2c 20 | .`magnitude'.of.the.pair.(3,4),. |
| 69100 | 77 65 20 77 6f 75 6c 64 6e 27 74 20 6b 6e 6f 77 0a 77 68 65 74 68 65 72 20 74 6f 20 61 6e 73 77 | we.wouldn't.know.whether.to.answ |
| 69120 | 65 72 20 35 20 28 69 6e 74 65 72 70 72 65 74 69 6e 67 20 74 68 65 20 6e 75 6d 62 65 72 20 69 6e | er.5.(interpreting.the.number.in |
| 69140 | 20 72 65 63 74 61 6e 67 75 6c 61 72 20 66 6f 72 6d 29 20 6f 72 20 33 0a 28 69 6e 74 65 72 70 72 | .rectangular.form).or.3.(interpr |
| 69160 | 65 74 69 6e 67 20 74 68 65 20 6e 75 6d 62 65 72 20 69 6e 20 70 6f 6c 61 72 20 66 6f 72 6d 29 2e | eting.the.number.in.polar.form). |
| 69180 | 20 20 41 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 77 61 79 20 74 6f 0a 61 63 63 6f 6d | ..A.straightforward.way.to.accom |
| 691a0 | 70 6c 69 73 68 20 74 68 69 73 20 64 69 73 74 69 6e 63 74 69 6f 6e 20 69 73 20 74 6f 20 69 6e 63 | plish.this.distinction.is.to.inc |
| 691c0 | 6c 75 64 65 20 61 20 22 74 79 70 65 20 74 61 67 22 2d 2d 74 68 65 20 73 79 6d 62 6f 6c 0a 60 72 | lude.a."type.tag"--the.symbol.`r |
| 691e0 | 65 63 74 61 6e 67 75 6c 61 72 27 20 6f 72 20 60 70 6f 6c 61 72 27 2d 2d 61 73 20 70 61 72 74 20 | ectangular'.or.`polar'--as.part. |
| 69200 | 6f 66 20 65 61 63 68 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 2e 20 20 54 68 65 6e 20 77 68 | of.each.complex.number...Then.wh |
| 69220 | 65 6e 20 77 65 0a 6e 65 65 64 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 20 61 20 63 6f 6d 70 6c | en.we.need.to.manipulate.a.compl |
| 69240 | 65 78 20 6e 75 6d 62 65 72 20 77 65 20 63 61 6e 20 75 73 65 20 74 68 65 20 74 61 67 20 74 6f 20 | ex.number.we.can.use.the.tag.to. |
| 69260 | 64 65 63 69 64 65 20 77 68 69 63 68 0a 73 65 6c 65 63 74 6f 72 20 74 6f 20 61 70 70 6c 79 2e 0a | decide.which.selector.to.apply.. |
| 69280 | 0a 20 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 61 67 67 65 | ....In.order.to.manipulate.tagge |
| 692a0 | 64 20 64 61 74 61 2c 20 77 65 20 77 69 6c 6c 20 61 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 68 | d.data,.we.will.assume.that.we.h |
| 692c0 | 61 76 65 0a 70 72 6f 63 65 64 75 72 65 73 20 60 74 79 70 65 2d 74 61 67 27 20 61 6e 64 20 60 63 | ave.procedures.`type-tag'.and.`c |
| 692e0 | 6f 6e 74 65 6e 74 73 27 20 74 68 61 74 20 65 78 74 72 61 63 74 20 66 72 6f 6d 20 61 20 64 61 74 | ontents'.that.extract.from.a.dat |
| 69300 | 61 20 6f 62 6a 65 63 74 0a 74 68 65 20 74 61 67 20 61 6e 64 20 74 68 65 20 61 63 74 75 61 6c 20 | a.object.the.tag.and.the.actual. |
| 69320 | 63 6f 6e 74 65 6e 74 73 20 28 74 68 65 20 70 6f 6c 61 72 20 6f 72 20 72 65 63 74 61 6e 67 75 6c | contents.(the.polar.or.rectangul |
| 69340 | 61 72 20 63 6f 6f 72 64 69 6e 61 74 65 73 2c 0a 69 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 61 | ar.coordinates,.in.the.case.of.a |
| 69360 | 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 29 2e 20 20 57 65 20 77 69 6c 6c 20 61 6c 73 6f 20 | .complex.number)...We.will.also. |
| 69380 | 70 6f 73 74 75 6c 61 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 0a 60 61 74 74 61 63 68 2d 74 61 | postulate.a.procedure.`attach-ta |
| 693a0 | 67 27 20 74 68 61 74 20 74 61 6b 65 73 20 61 20 74 61 67 20 61 6e 64 20 63 6f 6e 74 65 6e 74 73 | g'.that.takes.a.tag.and.contents |
| 693c0 | 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 61 20 74 61 67 67 65 64 20 64 61 74 61 0a 6f 62 6a 65 | .and.produces.a.tagged.data.obje |
| 693e0 | 63 74 2e 20 20 41 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 77 61 79 20 74 6f 20 69 6d | ct...A.straightforward.way.to.im |
| 69400 | 70 6c 65 6d 65 6e 74 20 74 68 69 73 20 69 73 20 74 6f 20 75 73 65 20 6f 72 64 69 6e 61 72 79 0a | plement.this.is.to.use.ordinary. |
| 69420 | 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 | list.structure:.......(define.(a |
| 69440 | 74 74 61 63 68 2d 74 61 67 20 74 79 70 65 2d 74 61 67 20 63 6f 6e 74 65 6e 74 73 29 0a 20 20 20 | ttach-tag.type-tag.contents).... |
| 69460 | 20 20 20 20 28 63 6f 6e 73 20 74 79 70 65 2d 74 61 67 20 63 6f 6e 74 65 6e 74 73 29 29 0a 0a 20 | ....(cons.type-tag.contents))... |
| 69480 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 79 70 65 2d 74 61 67 20 64 61 74 75 6d 29 0a 20 20 20 | ....(define.(type-tag.datum).... |
| 694a0 | 20 20 20 20 28 69 66 20 28 70 61 69 72 3f 20 64 61 74 75 6d 29 0a 20 20 20 20 20 20 20 20 20 20 | ....(if.(pair?.datum)........... |
| 694c0 | 20 28 63 61 72 20 64 61 74 75 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 | .(car.datum)............(error." |
| 694e0 | 42 61 64 20 74 61 67 67 65 64 20 64 61 74 75 6d 20 2d 2d 20 54 59 50 45 2d 54 41 47 22 20 64 61 | Bad.tagged.datum.--.TYPE-TAG".da |
| 69500 | 74 75 6d 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 74 65 6e 74 73 20 64 | tum))).......(define.(contents.d |
| 69520 | 61 74 75 6d 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 70 61 69 72 3f 20 64 61 74 75 6d 29 0a 20 | atum)........(if.(pair?.datum).. |
| 69540 | 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 64 61 74 75 6d 29 0a 20 20 20 20 20 20 20 20 20 20 | ..........(cdr.datum)........... |
| 69560 | 20 28 65 72 72 6f 72 20 22 42 61 64 20 74 61 67 67 65 64 20 64 61 74 75 6d 20 2d 2d 20 43 4f 4e | .(error."Bad.tagged.datum.--.CON |
| 69580 | 54 45 4e 54 53 22 20 64 61 74 75 6d 29 29 29 0a 0a 20 20 20 55 73 69 6e 67 20 74 68 65 73 65 20 | TENTS".datum))).....Using.these. |
| 695a0 | 70 72 6f 63 65 64 75 72 65 73 2c 20 77 65 20 63 61 6e 20 64 65 66 69 6e 65 20 70 72 65 64 69 63 | procedures,.we.can.define.predic |
| 695c0 | 61 74 65 73 20 60 72 65 63 74 61 6e 67 75 6c 61 72 3f 27 20 20 61 6e 64 0a 60 70 6f 6c 61 72 3f | ates.`rectangular?'..and.`polar? |
| 695e0 | 27 2c 20 77 68 69 63 68 20 72 65 63 6f 67 6e 69 7a 65 20 70 6f 6c 61 72 20 61 6e 64 20 72 65 63 | ',.which.recognize.polar.and.rec |
| 69600 | 74 61 6e 67 75 6c 61 72 20 6e 75 6d 62 65 72 73 2c 20 72 65 73 70 65 63 74 69 76 65 6c 79 3a 0a | tangular.numbers,.respectively:. |
| 69620 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 63 74 61 6e 67 75 6c 61 72 3f 20 7a 29 0a 20 | ......(define.(rectangular?.z).. |
| 69640 | 20 20 20 20 20 20 28 65 71 3f 20 28 74 79 70 65 2d 74 61 67 20 7a 29 20 27 72 65 63 74 61 6e 67 | ......(eq?.(type-tag.z).'rectang |
| 69660 | 75 6c 61 72 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 6f 6c 61 72 3f 20 7a 29 0a | ular)).......(define.(polar?.z). |
| 69680 | 20 20 20 20 20 20 20 28 65 71 3f 20 28 74 79 70 65 2d 74 61 67 20 7a 29 20 27 70 6f 6c 61 72 29 | .......(eq?.(type-tag.z).'polar) |
| 696a0 | 29 0a 0a 20 20 20 57 69 74 68 20 74 79 70 65 20 74 61 67 73 2c 20 42 65 6e 20 61 6e 64 20 41 6c | ).....With.type.tags,.Ben.and.Al |
| 696c0 | 79 73 73 61 20 63 61 6e 20 6e 6f 77 20 6d 6f 64 69 66 79 20 74 68 65 69 72 20 63 6f 64 65 20 73 | yssa.can.now.modify.their.code.s |
| 696e0 | 6f 20 74 68 61 74 0a 74 68 65 69 72 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 72 65 70 72 65 | o.that.their.two.different.repre |
| 69700 | 73 65 6e 74 61 74 69 6f 6e 73 20 63 61 6e 20 63 6f 65 78 69 73 74 20 69 6e 20 74 68 65 20 73 61 | sentations.can.coexist.in.the.sa |
| 69720 | 6d 65 20 73 79 73 74 65 6d 2e 0a 57 68 65 6e 65 76 65 72 20 42 65 6e 20 63 6f 6e 73 74 72 75 63 | me.system..Whenever.Ben.construc |
| 69740 | 74 73 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 2c 20 68 65 20 74 61 67 73 20 69 74 20 | ts.a.complex.number,.he.tags.it. |
| 69760 | 61 73 20 72 65 63 74 61 6e 67 75 6c 61 72 2e 0a 57 68 65 6e 65 76 65 72 20 41 6c 79 73 73 61 20 | as.rectangular..Whenever.Alyssa. |
| 69780 | 63 6f 6e 73 74 72 75 63 74 73 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 2c 20 73 68 65 | constructs.a.complex.number,.she |
| 697a0 | 20 74 61 67 73 20 69 74 20 61 73 20 70 6f 6c 61 72 2e 20 20 49 6e 0a 61 64 64 69 74 69 6f 6e 2c | .tags.it.as.polar...In.addition, |
| 697c0 | 20 42 65 6e 20 61 6e 64 20 41 6c 79 73 73 61 20 6d 75 73 74 20 6d 61 6b 65 20 73 75 72 65 20 74 | .Ben.and.Alyssa.must.make.sure.t |
| 697e0 | 68 61 74 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 69 72 0a 70 72 6f 63 65 64 75 72 65 | hat.the.names.of.their.procedure |
| 69800 | 73 20 64 6f 20 6e 6f 74 20 63 6f 6e 66 6c 69 63 74 2e 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 64 | s.do.not.conflict...One.way.to.d |
| 69820 | 6f 20 74 68 69 73 20 69 73 20 66 6f 72 20 42 65 6e 20 74 6f 20 61 70 70 65 6e 64 0a 74 68 65 20 | o.this.is.for.Ben.to.append.the. |
| 69840 | 73 75 66 66 69 78 20 60 72 65 63 74 61 6e 67 75 6c 61 72 27 20 74 6f 20 74 68 65 20 6e 61 6d 65 | suffix.`rectangular'.to.the.name |
| 69860 | 20 6f 66 20 65 61 63 68 20 6f 66 20 68 69 73 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 0a 70 | .of.each.of.his.representation.p |
| 69880 | 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 66 6f 72 20 41 6c 79 73 73 61 20 74 6f 20 61 70 70 65 | rocedures.and.for.Alyssa.to.appe |
| 698a0 | 6e 64 20 60 70 6f 6c 61 72 27 20 74 6f 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 68 65 72 73 2e | nd.`polar'.to.the.names.of.hers. |
| 698c0 | 20 20 48 65 72 65 0a 69 73 20 42 65 6e 27 73 20 72 65 76 69 73 65 64 20 72 65 63 74 61 6e 67 75 | ..Here.is.Ben's.revised.rectangu |
| 698e0 | 6c 61 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 | lar.representation.from.section. |
| 69900 | 2a 4e 6f 74 65 20 32 2d 34 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 | *Note.2-4-1:::.......(define.(re |
| 69920 | 61 6c 2d 70 61 72 74 2d 72 65 63 74 61 6e 67 75 6c 61 72 20 7a 29 20 28 63 61 72 20 7a 29 29 0a | al-part-rectangular.z).(car.z)). |
| 69940 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 61 67 2d 70 61 72 74 2d 72 65 63 74 61 6e 67 | ......(define.(imag-part-rectang |
| 69960 | 75 6c 61 72 20 7a 29 20 28 63 64 72 20 7a 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | ular.z).(cdr.z)).......(define.( |
| 69980 | 6d 61 67 6e 69 74 75 64 65 2d 72 65 63 74 61 6e 67 75 6c 61 72 20 7a 29 0a 20 20 20 20 20 20 20 | magnitude-rectangular.z)........ |
| 699a0 | 28 73 71 72 74 20 28 2b 20 28 73 71 75 61 72 65 20 28 72 65 61 6c 2d 70 61 72 74 2d 72 65 63 74 | (sqrt.(+.(square.(real-part-rect |
| 699c0 | 61 6e 67 75 6c 61 72 20 7a 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 75 | angular.z)).................(squ |
| 699e0 | 61 72 65 20 28 69 6d 61 67 2d 70 61 72 74 2d 72 65 63 74 61 6e 67 75 6c 61 72 20 7a 29 29 29 29 | are.(imag-part-rectangular.z)))) |
| 69a00 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 67 6c 65 2d 72 65 63 74 61 6e 67 75 6c | ).......(define.(angle-rectangul |
| 69a20 | 61 72 20 7a 29 0a 20 20 20 20 20 20 20 28 61 74 61 6e 20 28 69 6d 61 67 2d 70 61 72 74 2d 72 65 | ar.z)........(atan.(imag-part-re |
| 69a40 | 63 74 61 6e 67 75 6c 61 72 20 7a 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 61 6c 2d | ctangular.z)..............(real- |
| 69a60 | 70 61 72 74 2d 72 65 63 74 61 6e 67 75 6c 61 72 20 7a 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 | part-rectangular.z))).......(def |
| 69a80 | 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 2d 72 65 63 74 61 6e 67 | ine.(make-from-real-imag-rectang |
| 69aa0 | 75 6c 61 72 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 61 74 74 61 63 68 2d 74 61 67 20 27 72 65 | ular.x.y)........(attach-tag.'re |
| 69ac0 | 63 74 61 6e 67 75 6c 61 72 20 28 63 6f 6e 73 20 78 20 79 29 29 29 0a 0a 20 20 20 20 20 28 64 65 | ctangular.(cons.x.y))).......(de |
| 69ae0 | 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 2d 72 65 63 74 61 6e 67 75 | fine.(make-from-mag-ang-rectangu |
| 69b00 | 6c 61 72 20 72 20 61 29 0a 20 20 20 20 20 20 20 28 61 74 74 61 63 68 2d 74 61 67 20 27 72 65 63 | lar.r.a)........(attach-tag.'rec |
| 69b20 | 74 61 6e 67 75 6c 61 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e | tangular....................(con |
| 69b40 | 73 20 28 2a 20 72 20 28 63 6f 73 20 61 29 29 20 28 2a 20 72 20 28 73 69 6e 20 61 29 29 29 29 29 | s.(*.r.(cos.a)).(*.r.(sin.a))))) |
| 69b60 | 0a 0a 61 6e 64 20 68 65 72 65 20 69 73 20 41 6c 79 73 73 61 27 73 20 72 65 76 69 73 65 64 20 70 | ..and.here.is.Alyssa's.revised.p |
| 69b80 | 6f 6c 61 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 | olar.representation:.......(defi |
| 69ba0 | 6e 65 20 28 72 65 61 6c 2d 70 61 72 74 2d 70 6f 6c 61 72 20 7a 29 0a 20 20 20 20 20 20 20 28 2a | ne.(real-part-polar.z)........(* |
| 69bc0 | 20 28 6d 61 67 6e 69 74 75 64 65 2d 70 6f 6c 61 72 20 7a 29 20 28 63 6f 73 20 28 61 6e 67 6c 65 | .(magnitude-polar.z).(cos.(angle |
| 69be0 | 2d 70 6f 6c 61 72 20 7a 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 61 67 | -polar.z)))).......(define.(imag |
| 69c00 | 2d 70 61 72 74 2d 70 6f 6c 61 72 20 7a 29 0a 20 20 20 20 20 20 20 28 2a 20 28 6d 61 67 6e 69 74 | -part-polar.z)........(*.(magnit |
| 69c20 | 75 64 65 2d 70 6f 6c 61 72 20 7a 29 20 28 73 69 6e 20 28 61 6e 67 6c 65 2d 70 6f 6c 61 72 20 7a | ude-polar.z).(sin.(angle-polar.z |
| 69c40 | 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 67 6e 69 74 75 64 65 2d 70 6f | )))).......(define.(magnitude-po |
| 69c60 | 6c 61 72 20 7a 29 20 28 63 61 72 20 7a 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 | lar.z).(car.z)).......(define.(a |
| 69c80 | 6e 67 6c 65 2d 70 6f 6c 61 72 20 7a 29 20 28 63 64 72 20 7a 29 29 0a 0a 20 20 20 20 20 28 64 65 | ngle-polar.z).(cdr.z)).......(de |
| 69ca0 | 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 2d 70 6f 6c 61 72 20 | fine.(make-from-real-imag-polar. |
| 69cc0 | 78 20 79 29 0a 20 20 20 20 20 20 20 28 61 74 74 61 63 68 2d 74 61 67 20 27 70 6f 6c 61 72 0a 20 | x.y)........(attach-tag.'polar.. |
| 69ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 73 71 72 74 20 28 | ...................(cons.(sqrt.( |
| 69d00 | 2b 20 28 73 71 75 61 72 65 20 78 29 20 28 73 71 75 61 72 65 20 79 29 29 29 0a 20 20 20 20 20 20 | +.(square.x).(square.y)))....... |
| 69d20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 74 61 6e 20 79 20 78 29 29 29 | ....................(atan.y.x))) |
| 69d40 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 | ).......(define.(make-from-mag-a |
| 69d60 | 6e 67 2d 70 6f 6c 61 72 20 72 20 61 29 0a 20 20 20 20 20 20 20 28 61 74 74 61 63 68 2d 74 61 67 | ng-polar.r.a)........(attach-tag |
| 69d80 | 20 27 70 6f 6c 61 72 20 28 63 6f 6e 73 20 72 20 61 29 29 29 0a 0a 20 20 20 45 61 63 68 20 67 65 | .'polar.(cons.r.a))).....Each.ge |
| 69da0 | 6e 65 72 69 63 20 73 65 6c 65 63 74 6f 72 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 | neric.selector.is.implemented.as |
| 69dc0 | 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 68 65 63 6b 73 20 74 68 65 0a 74 61 67 | .a.procedure.that.checks.the.tag |
| 69de0 | 20 6f 66 20 69 74 73 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 63 61 6c 6c 73 20 74 68 65 20 61 | .of.its.argument.and.calls.the.a |
| 69e00 | 70 70 72 6f 70 72 69 61 74 65 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 68 61 6e 64 6c 69 6e | ppropriate.procedure.for.handlin |
| 69e20 | 67 0a 64 61 74 61 20 6f 66 20 74 68 61 74 20 74 79 70 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c | g.data.of.that.type...For.exampl |
| 69e40 | 65 2c 20 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 72 65 61 6c 20 70 61 72 74 20 6f 66 20 61 20 | e,.to.obtain.the.real.part.of.a. |
| 69e60 | 63 6f 6d 70 6c 65 78 0a 6e 75 6d 62 65 72 2c 20 60 72 65 61 6c 2d 70 61 72 74 27 20 65 78 61 6d | complex.number,.`real-part'.exam |
| 69e80 | 69 6e 65 73 20 74 68 65 20 74 61 67 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68 65 74 68 65 | ines.the.tag.to.determine.whethe |
| 69ea0 | 72 20 74 6f 20 75 73 65 20 42 65 6e 27 73 0a 60 72 65 61 6c 2d 70 61 72 74 2d 72 65 63 74 61 6e | r.to.use.Ben's.`real-part-rectan |
| 69ec0 | 67 75 6c 61 72 27 20 6f 72 20 41 6c 79 73 73 61 27 73 20 60 72 65 61 6c 2d 70 61 72 74 2d 70 6f | gular'.or.Alyssa's.`real-part-po |
| 69ee0 | 6c 61 72 27 2e 20 20 49 6e 20 65 69 74 68 65 72 20 63 61 73 65 2c 0a 77 65 20 75 73 65 20 60 63 | lar'...In.either.case,.we.use.`c |
| 69f00 | 6f 6e 74 65 6e 74 73 27 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 62 61 72 65 2c 20 75 6e | ontents'.to.extract.the.bare,.un |
| 69f20 | 74 61 67 67 65 64 20 64 61 74 75 6d 20 61 6e 64 20 73 65 6e 64 20 74 68 69 73 20 74 6f 0a 74 68 | tagged.datum.and.send.this.to.th |
| 69f40 | 65 20 72 65 63 74 61 6e 67 75 6c 61 72 20 6f 72 20 70 6f 6c 61 72 20 70 72 6f 63 65 64 75 72 65 | e.rectangular.or.polar.procedure |
| 69f60 | 20 61 73 20 72 65 71 75 69 72 65 64 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 61 | .as.required:.......(define.(rea |
| 69f80 | 6c 2d 70 61 72 74 20 7a 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 72 65 63 74 61 6e 67 | l-part.z)........(cond.((rectang |
| 69fa0 | 75 6c 61 72 3f 20 7a 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 61 6c 2d 70 61 72 | ular?.z)...............(real-par |
| 69fc0 | 74 2d 72 65 63 74 61 6e 67 75 6c 61 72 20 28 63 6f 6e 74 65 6e 74 73 20 7a 29 29 29 0a 20 20 20 | t-rectangular.(contents.z))).... |
| 69fe0 | 20 20 20 20 20 20 20 20 20 20 28 28 70 6f 6c 61 72 3f 20 7a 29 0a 20 20 20 20 20 20 20 20 20 20 | ..........((polar?.z)........... |
| 6a000 | 20 20 20 20 28 72 65 61 6c 2d 70 61 72 74 2d 70 6f 6c 61 72 20 28 63 6f 6e 74 65 6e 74 73 20 7a | ....(real-part-polar.(contents.z |
| 6a020 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 | )))..............(else.(error."U |
| 6a040 | 6e 6b 6e 6f 77 6e 20 74 79 70 65 20 2d 2d 20 52 45 41 4c 2d 50 41 52 54 22 20 7a 29 29 29 29 0a | nknown.type.--.REAL-PART".z)))). |
| 6a060 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 29 0a 20 20 20 20 | ......(define.(imag-part.z)..... |
| 6a080 | 20 20 20 28 63 6f 6e 64 20 28 28 72 65 63 74 61 6e 67 75 6c 61 72 3f 20 7a 29 0a 20 20 20 20 20 | ...(cond.((rectangular?.z)...... |
| 6a0a0 | 20 20 20 20 20 20 20 20 20 28 69 6d 61 67 2d 70 61 72 74 2d 72 65 63 74 61 6e 67 75 6c 61 72 20 | .........(imag-part-rectangular. |
| 6a0c0 | 28 63 6f 6e 74 65 6e 74 73 20 7a 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 70 6f | (contents.z)))..............((po |
| 6a0e0 | 6c 61 72 3f 20 7a 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 6d 61 67 2d 70 61 72 74 | lar?.z)...............(imag-part |
| 6a100 | 2d 70 6f 6c 61 72 20 28 63 6f 6e 74 65 6e 74 73 20 7a 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | -polar.(contents.z)))........... |
| 6a120 | 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 74 79 70 65 20 2d 2d | ...(else.(error."Unknown.type.-- |
| 6a140 | 20 49 4d 41 47 2d 50 41 52 54 22 20 7a 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | .IMAG-PART".z)))).......(define. |
| 6a160 | 28 6d 61 67 6e 69 74 75 64 65 20 7a 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 72 65 63 | (magnitude.z)........(cond.((rec |
| 6a180 | 74 61 6e 67 75 6c 61 72 3f 20 7a 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 67 6e | tangular?.z)...............(magn |
| 6a1a0 | 69 74 75 64 65 2d 72 65 63 74 61 6e 67 75 6c 61 72 20 28 63 6f 6e 74 65 6e 74 73 20 7a 29 29 29 | itude-rectangular.(contents.z))) |
| 6a1c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 70 6f 6c 61 72 3f 20 7a 29 0a 20 20 20 20 20 20 | ..............((polar?.z)....... |
| 6a1e0 | 20 20 20 20 20 20 20 20 28 6d 61 67 6e 69 74 75 64 65 2d 70 6f 6c 61 72 20 28 63 6f 6e 74 65 6e | ........(magnitude-polar.(conten |
| 6a200 | 74 73 20 7a 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f | ts.z)))..............(else.(erro |
| 6a220 | 72 20 22 55 6e 6b 6e 6f 77 6e 20 74 79 70 65 20 2d 2d 20 4d 41 47 4e 49 54 55 44 45 22 20 7a 29 | r."Unknown.type.--.MAGNITUDE".z) |
| 6a240 | 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 67 6c 65 20 7a 29 0a 20 20 20 20 | ))).......(define.(angle.z)..... |
| 6a260 | 20 20 20 28 63 6f 6e 64 20 28 28 72 65 63 74 61 6e 67 75 6c 61 72 3f 20 7a 29 0a 20 20 20 20 20 | ...(cond.((rectangular?.z)...... |
| 6a280 | 20 20 20 20 20 20 20 20 20 28 61 6e 67 6c 65 2d 72 65 63 74 61 6e 67 75 6c 61 72 20 28 63 6f 6e | .........(angle-rectangular.(con |
| 6a2a0 | 74 65 6e 74 73 20 7a 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 70 6f 6c 61 72 3f | tents.z)))..............((polar? |
| 6a2c0 | 20 7a 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 67 6c 65 2d 70 6f 6c 61 72 20 28 | .z)...............(angle-polar.( |
| 6a2e0 | 63 6f 6e 74 65 6e 74 73 20 7a 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 | contents.z)))..............(else |
| 6a300 | 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 74 79 70 65 20 2d 2d 20 41 4e 47 4c 45 22 20 | .(error."Unknown.type.--.ANGLE". |
| 6a320 | 7a 29 29 29 29 0a 0a 20 20 20 54 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 63 6f 6d 70 6c | z)))).....To.implement.the.compl |
| 6a340 | 65 78 2d 6e 75 6d 62 65 72 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2c | ex-number.arithmetic.operations, |
| 6a360 | 20 77 65 20 63 61 6e 20 75 73 65 0a 74 68 65 20 73 61 6d 65 20 70 72 6f 63 65 64 75 72 65 73 20 | .we.can.use.the.same.procedures. |
| 6a380 | 60 61 64 64 2d 63 6f 6d 70 6c 65 78 27 2c 20 60 73 75 62 2d 63 6f 6d 70 6c 65 78 27 2c 20 60 6d | `add-complex',.`sub-complex',.`m |
| 6a3a0 | 75 6c 2d 63 6f 6d 70 6c 65 78 27 2c 20 61 6e 64 0a 60 64 69 76 2d 63 6f 6d 70 6c 65 78 27 20 66 | ul-complex',.and.`div-complex'.f |
| 6a3c0 | 72 6f 6d 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 31 3a 3a 2c 20 62 65 63 61 75 | rom.section.*Note.2-4-1::,.becau |
| 6a3e0 | 73 65 20 74 68 65 20 73 65 6c 65 63 74 6f 72 73 20 74 68 65 79 0a 63 61 6c 6c 20 61 72 65 20 67 | se.the.selectors.they.call.are.g |
| 6a400 | 65 6e 65 72 69 63 2c 20 61 6e 64 20 73 6f 20 77 69 6c 6c 20 77 6f 72 6b 20 77 69 74 68 20 65 69 | eneric,.and.so.will.work.with.ei |
| 6a420 | 74 68 65 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c | ther.representation...For.exampl |
| 6a440 | 65 2c 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 61 64 64 2d 63 6f 6d 70 6c 65 78 27 20 69 | e,.the.procedure.`add-complex'.i |
| 6a460 | 73 20 73 74 69 6c 6c 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 63 6f 6d 70 6c | s.still.......(define.(add-compl |
| 6a480 | 65 78 20 7a 31 20 7a 32 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c | ex.z1.z2)........(make-from-real |
| 6a4a0 | 2d 69 6d 61 67 20 28 2b 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 31 29 20 28 72 65 61 6c 2d 70 61 | -imag.(+.(real-part.z1).(real-pa |
| 6a4c0 | 72 74 20 7a 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rt.z2))......................... |
| 6a4e0 | 20 20 20 20 28 2b 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 31 29 20 28 69 6d 61 67 2d 70 61 72 74 | ....(+.(imag-part.z1).(imag-part |
| 6a500 | 20 7a 32 29 29 29 29 0a 0a 20 20 20 46 69 6e 61 6c 6c 79 2c 20 77 65 20 6d 75 73 74 20 63 68 6f | .z2)))).....Finally,.we.must.cho |
| 6a520 | 6f 73 65 20 77 68 65 74 68 65 72 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 63 6f 6d 70 6c 65 78 | ose.whether.to.construct.complex |
| 6a540 | 20 6e 75 6d 62 65 72 73 20 75 73 69 6e 67 0a 42 65 6e 27 73 20 72 65 70 72 65 73 65 6e 74 61 74 | .numbers.using.Ben's.representat |
| 6a560 | 69 6f 6e 20 6f 72 20 41 6c 79 73 73 61 27 73 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 | ion.or.Alyssa's.representation.. |
| 6a580 | 20 4f 6e 65 20 72 65 61 73 6f 6e 61 62 6c 65 20 63 68 6f 69 63 65 0a 69 73 20 74 6f 20 63 6f 6e | .One.reasonable.choice.is.to.con |
| 6a5a0 | 73 74 72 75 63 74 20 72 65 63 74 61 6e 67 75 6c 61 72 20 6e 75 6d 62 65 72 73 20 77 68 65 6e 65 | struct.rectangular.numbers.whene |
| 6a5c0 | 76 65 72 20 77 65 20 68 61 76 65 20 72 65 61 6c 20 61 6e 64 20 69 6d 61 67 69 6e 61 72 79 0a 70 | ver.we.have.real.and.imaginary.p |
| 6a5e0 | 61 72 74 73 20 61 6e 64 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 70 6f 6c 61 72 20 6e 75 6d 62 | arts.and.to.construct.polar.numb |
| 6a600 | 65 72 73 20 77 68 65 6e 65 76 65 72 20 77 65 20 68 61 76 65 20 6d 61 67 6e 69 74 75 64 65 73 20 | ers.whenever.we.have.magnitudes. |
| 6a620 | 61 6e 64 0a 61 6e 67 6c 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d | and.angles:.......(define.(make- |
| 6a640 | 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 | from-real-imag.x.y)........(make |
| 6a660 | 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 2d 72 65 63 74 61 6e 67 75 6c 61 72 20 78 20 79 29 | -from-real-imag-rectangular.x.y) |
| 6a680 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 | ).......(define.(make-from-mag-a |
| 6a6a0 | 6e 67 20 72 20 61 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e | ng.r.a)........(make-from-mag-an |
| 6a6c0 | 67 2d 70 6f 6c 61 72 20 72 20 61 29 29 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 32 31 | g-polar.r.a)).......*Figure.2.21 |
| 6a6e0 | 3a 2a 20 53 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 67 65 6e 65 72 69 63 20 63 6f 6d 70 | :*.Structure.of.the.generic.comp |
| 6a700 | 6c 65 78 2d 61 72 69 74 68 6d 65 74 69 63 20 73 79 73 74 65 6d 2e 0a 0a 20 20 20 20 20 20 20 20 | lex-arithmetic.system........... |
| 6a720 | 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ......+------------------------- |
| 6a740 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 | -------------------------+...... |
| 6a760 | 20 20 20 20 20 2d 2d 2d 2d 7c 20 61 64 64 2d 63 6f 6d 70 6c 65 78 20 73 75 62 2d 63 6f 6d 70 6c | .....----|.add-complex.sub-compl |
| 6a780 | 65 78 20 6d 75 6c 2d 63 6f 6d 70 6c 65 78 2d 20 64 69 76 2d 63 6f 6d 70 6c 65 78 20 7c 2d 2d 2d | ex.mul-complex-.div-complex.|--- |
| 6a7a0 | 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -...............+--------------- |
| 6a7c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 6a7e0 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 | ---+...........................C |
| 6a800 | 6f 6d 70 6c 65 78 20 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 0a 20 20 20 20 20 20 | omplex.arithmetic.package....... |
| 6a820 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .....................+---------- |
| 6a840 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -------------+.................. |
| 6a860 | 20 20 20 20 20 20 20 20 20 20 7c 20 72 65 61 6c 2d 70 61 72 74 20 20 20 69 6d 61 67 2d 70 61 72 | ..........|.real-part...imag-par |
| 6a880 | 74 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c | t.|...........-----------------| |
| 6a8a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 2d 2d 2d 2d 2d 2d 2d 2d | .......................|-------- |
| 6a8c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ----------...................... |
| 6a8e0 | 20 20 20 20 20 20 7c 20 6d 61 67 6e 69 74 75 64 65 20 20 20 61 6e 67 6c 65 20 20 20 20 20 7c 0a | ......|.magnitude...angle.....|. |
| 6a900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d | ...........................+---- |
| 6a920 | 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 | -------+-----------+............ |
| 6a940 | 20 20 20 20 20 20 20 20 20 20 52 65 63 74 61 6e 67 75 6c 61 72 20 20 20 20 20 20 20 7c 20 20 20 | ..........Rectangular.......|... |
| 6a960 | 20 20 20 20 20 20 20 50 6f 6c 61 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......Polar.................... |
| 6a980 | 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 20 20 20 20 7c 20 20 20 20 20 72 65 70 72 65 73 | .representation.....|.....repres |
| 6a9a0 | 65 6e 74 61 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | entation...........------------- |
| 6a9c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ----------------+--------------- |
| 6a9e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---------------................. |
| 6aa00 | 20 4c 69 73 74 20 73 74 72 75 63 74 75 72 65 20 61 6e 64 20 70 72 69 6d 69 74 69 76 65 20 6d 61 | .List.structure.and.primitive.ma |
| 6aa20 | 63 68 69 6e 65 20 61 72 69 74 68 6d 65 74 69 63 0a 0a 20 20 20 54 68 65 20 72 65 73 75 6c 74 69 | chine.arithmetic.....The.resulti |
| 6aa40 | 6e 67 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 73 79 73 74 65 6d 20 68 61 73 20 74 68 65 | ng.complex-number.system.has.the |
| 6aa60 | 20 73 74 72 75 63 74 75 72 65 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 0a 46 69 67 75 72 65 | .structure.shown.in.*Note.Figure |
| 6aa80 | 20 32 2d 32 31 3a 3a 2e 20 20 54 68 65 20 73 79 73 74 65 6d 20 68 61 73 20 62 65 65 6e 20 64 65 | .2-21::...The.system.has.been.de |
| 6aaa0 | 63 6f 6d 70 6f 73 65 64 20 69 6e 74 6f 20 74 68 72 65 65 20 72 65 6c 61 74 69 76 65 6c 79 0a 69 | composed.into.three.relatively.i |
| 6aac0 | 6e 64 65 70 65 6e 64 65 6e 74 20 70 61 72 74 73 3a 20 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e 75 | ndependent.parts:.the.complex-nu |
| 6aae0 | 6d 62 65 72 2d 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 41 6c 79 73 | mber-arithmetic.operations,.Alys |
| 6ab00 | 73 61 27 73 0a 70 6f 6c 61 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 20 61 6e 64 20 42 | sa's.polar.implementation,.and.B |
| 6ab20 | 65 6e 27 73 20 72 65 63 74 61 6e 67 75 6c 61 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e | en's.rectangular.implementation. |
| 6ab40 | 20 20 54 68 65 20 70 6f 6c 61 72 0a 61 6e 64 20 72 65 63 74 61 6e 67 75 6c 61 72 20 69 6d 70 6c | ..The.polar.and.rectangular.impl |
| 6ab60 | 65 6d 65 6e 74 61 74 69 6f 6e 73 20 63 6f 75 6c 64 20 68 61 76 65 20 62 65 65 6e 20 77 72 69 74 | ementations.could.have.been.writ |
| 6ab80 | 74 65 6e 20 62 79 20 42 65 6e 20 61 6e 64 0a 41 6c 79 73 73 61 20 77 6f 72 6b 69 6e 67 20 73 65 | ten.by.Ben.and.Alyssa.working.se |
| 6aba0 | 70 61 72 61 74 65 6c 79 2c 20 61 6e 64 20 62 6f 74 68 20 6f 66 20 74 68 65 73 65 20 63 61 6e 20 | parately,.and.both.of.these.can. |
| 6abc0 | 62 65 20 75 73 65 64 20 61 73 20 75 6e 64 65 72 6c 79 69 6e 67 0a 72 65 70 72 65 73 65 6e 74 61 | be.used.as.underlying.representa |
| 6abe0 | 74 69 6f 6e 73 20 62 79 20 61 20 74 68 69 72 64 20 70 72 6f 67 72 61 6d 6d 65 72 20 69 6d 70 6c | tions.by.a.third.programmer.impl |
| 6ac00 | 65 6d 65 6e 74 69 6e 67 20 74 68 65 0a 63 6f 6d 70 6c 65 78 2d 61 72 69 74 68 6d 65 74 69 63 20 | ementing.the.complex-arithmetic. |
| 6ac20 | 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 61 62 73 74 72 | procedures.in.terms.of.the.abstr |
| 6ac40 | 61 63 74 0a 63 6f 6e 73 74 72 75 63 74 6f 72 2f 73 65 6c 65 63 74 6f 72 20 69 6e 74 65 72 66 61 | act.constructor/selector.interfa |
| 6ac60 | 63 65 2e 0a 0a 20 20 20 53 69 6e 63 65 20 65 61 63 68 20 64 61 74 61 20 6f 62 6a 65 63 74 20 69 | ce......Since.each.data.object.i |
| 6ac80 | 73 20 74 61 67 67 65 64 20 77 69 74 68 20 69 74 73 20 74 79 70 65 2c 20 74 68 65 20 73 65 6c 65 | s.tagged.with.its.type,.the.sele |
| 6aca0 | 63 74 6f 72 73 0a 6f 70 65 72 61 74 65 20 6f 6e 20 74 68 65 20 64 61 74 61 20 69 6e 20 61 20 67 | ctors.operate.on.the.data.in.a.g |
| 6acc0 | 65 6e 65 72 69 63 20 6d 61 6e 6e 65 72 2e 20 20 54 68 61 74 20 69 73 2c 20 65 61 63 68 20 73 65 | eneric.manner...That.is,.each.se |
| 6ace0 | 6c 65 63 74 6f 72 20 69 73 0a 64 65 66 69 6e 65 64 20 74 6f 20 68 61 76 65 20 61 20 62 65 68 61 | lector.is.defined.to.have.a.beha |
| 6ad00 | 76 69 6f 72 20 74 68 61 74 20 64 65 70 65 6e 64 73 20 75 70 6f 6e 20 74 68 65 20 70 61 72 74 69 | vior.that.depends.upon.the.parti |
| 6ad20 | 63 75 6c 61 72 20 74 79 70 65 20 6f 66 0a 64 61 74 61 20 69 74 20 69 73 20 61 70 70 6c 69 65 64 | cular.type.of.data.it.is.applied |
| 6ad40 | 20 74 6f 2e 20 20 4e 6f 74 69 63 65 20 74 68 65 20 67 65 6e 65 72 61 6c 20 6d 65 63 68 61 6e 69 | .to...Notice.the.general.mechani |
| 6ad60 | 73 6d 20 66 6f 72 20 69 6e 74 65 72 66 61 63 69 6e 67 0a 74 68 65 20 73 65 70 61 72 61 74 65 20 | sm.for.interfacing.the.separate. |
| 6ad80 | 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 3a 20 57 69 74 68 69 6e 20 61 20 67 69 76 65 6e 20 | representations:.Within.a.given. |
| 6ada0 | 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 28 73 | representation.implementation.(s |
| 6adc0 | 61 79 2c 20 41 6c 79 73 73 61 27 73 20 70 6f 6c 61 72 20 70 61 63 6b 61 67 65 29 20 61 20 63 6f | ay,.Alyssa's.polar.package).a.co |
| 6ade0 | 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 69 73 20 61 6e 0a 75 6e 74 79 70 65 64 20 70 61 69 72 20 | mplex.number.is.an.untyped.pair. |
| 6ae00 | 28 6d 61 67 6e 69 74 75 64 65 2c 20 61 6e 67 6c 65 29 2e 20 20 57 68 65 6e 20 61 20 67 65 6e 65 | (magnitude,.angle)...When.a.gene |
| 6ae20 | 72 69 63 20 73 65 6c 65 63 74 6f 72 20 6f 70 65 72 61 74 65 73 20 6f 6e 20 61 0a 6e 75 6d 62 65 | ric.selector.operates.on.a.numbe |
| 6ae40 | 72 20 6f 66 20 60 70 6f 6c 61 72 27 20 74 79 70 65 2c 20 69 74 20 73 74 72 69 70 73 20 6f 66 66 | r.of.`polar'.type,.it.strips.off |
| 6ae60 | 20 74 68 65 20 74 61 67 20 61 6e 64 20 70 61 73 73 65 73 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 | .the.tag.and.passes.the.contents |
| 6ae80 | 20 6f 6e 0a 74 6f 20 41 6c 79 73 73 61 27 73 20 63 6f 64 65 2e 20 20 43 6f 6e 76 65 72 73 65 6c | .on.to.Alyssa's.code...Conversel |
| 6aea0 | 79 2c 20 77 68 65 6e 20 41 6c 79 73 73 61 20 63 6f 6e 73 74 72 75 63 74 73 20 61 20 6e 75 6d 62 | y,.when.Alyssa.constructs.a.numb |
| 6aec0 | 65 72 20 66 6f 72 0a 67 65 6e 65 72 61 6c 20 75 73 65 2c 20 73 68 65 20 74 61 67 73 20 69 74 20 | er.for.general.use,.she.tags.it. |
| 6aee0 | 77 69 74 68 20 61 20 74 79 70 65 20 73 6f 20 74 68 61 74 20 69 74 20 63 61 6e 20 62 65 20 61 70 | with.a.type.so.that.it.can.be.ap |
| 6af00 | 70 72 6f 70 72 69 61 74 65 6c 79 0a 72 65 63 6f 67 6e 69 7a 65 64 20 62 79 20 74 68 65 20 68 69 | propriately.recognized.by.the.hi |
| 6af20 | 67 68 65 72 2d 6c 65 76 65 6c 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 54 68 69 73 20 64 69 73 | gher-level.procedures...This.dis |
| 6af40 | 63 69 70 6c 69 6e 65 20 6f 66 0a 73 74 72 69 70 70 69 6e 67 20 6f 66 66 20 61 6e 64 20 61 74 74 | cipline.of.stripping.off.and.att |
| 6af60 | 61 63 68 69 6e 67 20 74 61 67 73 20 61 73 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 61 72 65 20 | aching.tags.as.data.objects.are. |
| 6af80 | 70 61 73 73 65 64 20 66 72 6f 6d 20 6c 65 76 65 6c 0a 74 6f 20 6c 65 76 65 6c 20 63 61 6e 20 62 | passed.from.level.to.level.can.b |
| 6afa0 | 65 20 61 6e 20 69 6d 70 6f 72 74 61 6e 74 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 61 6c 20 73 74 | e.an.important.organizational.st |
| 6afc0 | 72 61 74 65 67 79 2c 20 61 73 20 77 65 20 73 68 61 6c 6c 20 73 65 65 0a 69 6e 20 73 65 63 74 69 | rategy,.as.we.shall.see.in.secti |
| 6afe0 | 6f 6e 20 2a 4e 6f 74 65 20 32 2d 35 3a 3a 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e | on.*Note.2-5::.....File:.sicp.in |
| 6b000 | 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 34 2d 33 2c 20 20 50 72 65 76 3a 20 32 2d 34 2d 32 2c 20 | fo,..Node:.2-4-3,..Prev:.2-4-2,. |
| 6b020 | 20 55 70 3a 20 32 2d 34 0a 0a 32 2e 34 2e 33 20 44 61 74 61 2d 44 69 72 65 63 74 65 64 20 50 72 | .Up:.2-4..2.4.3.Data-Directed.Pr |
| 6b040 | 6f 67 72 61 6d 6d 69 6e 67 20 61 6e 64 20 41 64 64 69 74 69 76 69 74 79 0a 2d 2d 2d 2d 2d 2d 2d | ogramming.and.Additivity.------- |
| 6b060 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 6b080 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 67 65 6e 65 72 61 6c 20 73 74 72 61 74 65 67 79 20 6f 66 | -------..The.general.strategy.of |
| 6b0a0 | 20 63 68 65 63 6b 69 6e 67 20 74 68 65 20 74 79 70 65 20 6f 66 20 61 20 64 61 74 75 6d 20 61 6e | .checking.the.type.of.a.datum.an |
| 6b0c0 | 64 20 63 61 6c 6c 69 6e 67 20 61 6e 0a 61 70 70 72 6f 70 72 69 61 74 65 20 70 72 6f 63 65 64 75 | d.calling.an.appropriate.procedu |
| 6b0e0 | 72 65 20 69 73 20 63 61 6c 6c 65 64 20 22 64 69 73 70 61 74 63 68 69 6e 67 20 6f 6e 20 74 79 70 | re.is.called."dispatching.on.typ |
| 6b100 | 65 22 2e 20 20 54 68 69 73 20 69 73 20 61 0a 70 6f 77 65 72 66 75 6c 20 73 74 72 61 74 65 67 79 | e"...This.is.a.powerful.strategy |
| 6b120 | 20 66 6f 72 20 6f 62 74 61 69 6e 69 6e 67 20 6d 6f 64 75 6c 61 72 69 74 79 20 69 6e 20 73 79 73 | .for.obtaining.modularity.in.sys |
| 6b140 | 74 65 6d 20 64 65 73 69 67 6e 2e 20 20 4f 68 20 74 68 65 0a 6f 74 68 65 72 20 68 61 6e 64 2c 20 | tem.design...Oh.the.other.hand,. |
| 6b160 | 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 64 69 73 70 61 74 63 68 20 61 73 20 69 6e 20 | implementing.the.dispatch.as.in. |
| 6b180 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 32 3a 3a 20 68 61 73 0a 74 77 6f 20 73 69 | section.*Note.2-4-2::.has.two.si |
| 6b1a0 | 67 6e 69 66 69 63 61 6e 74 20 77 65 61 6b 6e 65 73 73 65 73 2e 20 20 4f 6e 65 20 77 65 61 6b 6e | gnificant.weaknesses...One.weakn |
| 6b1c0 | 65 73 73 20 69 73 20 74 68 61 74 20 74 68 65 20 67 65 6e 65 72 69 63 20 69 6e 74 65 72 66 61 63 | ess.is.that.the.generic.interfac |
| 6b1e0 | 65 0a 70 72 6f 63 65 64 75 72 65 73 20 28 60 72 65 61 6c 2d 70 61 72 74 27 2c 20 60 69 6d 61 67 | e.procedures.(`real-part',.`imag |
| 6b200 | 2d 70 61 72 74 27 2c 20 60 6d 61 67 6e 69 74 75 64 65 27 2c 20 61 6e 64 20 60 61 6e 67 6c 65 27 | -part',.`magnitude',.and.`angle' |
| 6b220 | 29 20 6d 75 73 74 0a 6b 6e 6f 77 20 61 62 6f 75 74 20 61 6c 6c 20 74 68 65 20 64 69 66 66 65 72 | ).must.know.about.all.the.differ |
| 6b240 | 65 6e 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e | ent.representations...For.instan |
| 6b260 | 63 65 2c 20 73 75 70 70 6f 73 65 20 77 65 0a 77 61 6e 74 65 64 20 74 6f 20 69 6e 63 6f 72 70 6f | ce,.suppose.we.wanted.to.incorpo |
| 6b280 | 72 61 74 65 20 61 20 6e 65 77 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 63 6f | rate.a.new.representation.for.co |
| 6b2a0 | 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 69 6e 74 6f 20 6f 75 72 0a 63 6f 6d 70 6c 65 78 2d 6e | mplex.numbers.into.our.complex-n |
| 6b2c0 | 75 6d 62 65 72 20 73 79 73 74 65 6d 2e 20 20 57 65 20 77 6f 75 6c 64 20 6e 65 65 64 20 74 6f 20 | umber.system...We.would.need.to. |
| 6b2e0 | 69 64 65 6e 74 69 66 79 20 74 68 69 73 20 6e 65 77 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e | identify.this.new.representation |
| 6b300 | 20 77 69 74 68 20 61 20 74 79 70 65 2c 20 61 6e 64 20 74 68 65 6e 20 61 64 64 20 61 20 63 6c 61 | .with.a.type,.and.then.add.a.cla |
| 6b320 | 75 73 65 20 74 6f 20 65 61 63 68 20 6f 66 20 74 68 65 0a 67 65 6e 65 72 69 63 20 69 6e 74 65 72 | use.to.each.of.the.generic.inter |
| 6b340 | 66 61 63 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 63 68 65 63 6b 20 66 6f 72 20 74 68 65 | face.procedures.to.check.for.the |
| 6b360 | 20 6e 65 77 20 74 79 70 65 20 61 6e 64 20 61 70 70 6c 79 20 74 68 65 0a 61 70 70 72 6f 70 72 69 | .new.type.and.apply.the.appropri |
| 6b380 | 61 74 65 20 73 65 6c 65 63 74 6f 72 20 66 6f 72 20 74 68 61 74 20 72 65 70 72 65 73 65 6e 74 61 | ate.selector.for.that.representa |
| 6b3a0 | 74 69 6f 6e 2e 0a 0a 20 20 20 41 6e 6f 74 68 65 72 20 77 65 61 6b 6e 65 73 73 20 6f 66 20 74 68 | tion......Another.weakness.of.th |
| 6b3c0 | 65 20 74 65 63 68 6e 69 71 75 65 20 69 73 20 74 68 61 74 20 65 76 65 6e 20 74 68 6f 75 67 68 20 | e.technique.is.that.even.though. |
| 6b3e0 | 74 68 65 20 69 6e 64 69 76 69 64 75 61 6c 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 63 | the.individual.representations.c |
| 6b400 | 61 6e 20 62 65 20 64 65 73 69 67 6e 65 64 20 73 65 70 61 72 61 74 65 6c 79 2c 20 77 65 20 6d 75 | an.be.designed.separately,.we.mu |
| 6b420 | 73 74 20 67 75 61 72 61 6e 74 65 65 20 74 68 61 74 20 6e 6f 0a 74 77 6f 20 70 72 6f 63 65 64 75 | st.guarantee.that.no.two.procedu |
| 6b440 | 72 65 73 20 69 6e 20 74 68 65 20 65 6e 74 69 72 65 20 73 79 73 74 65 6d 20 68 61 76 65 20 74 68 | res.in.the.entire.system.have.th |
| 6b460 | 65 20 73 61 6d 65 20 6e 61 6d 65 2e 20 20 54 68 69 73 20 69 73 20 77 68 79 0a 42 65 6e 20 61 6e | e.same.name...This.is.why.Ben.an |
| 6b480 | 64 20 41 6c 79 73 73 61 20 68 61 64 20 74 6f 20 63 68 61 6e 67 65 20 74 68 65 20 6e 61 6d 65 73 | d.Alyssa.had.to.change.the.names |
| 6b4a0 | 20 6f 66 20 74 68 65 69 72 20 6f 72 69 67 69 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 73 0a 66 72 | .of.their.original.procedures.fr |
| 6b4c0 | 6f 6d 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 31 3a 3a 2e 0a 0a 20 20 20 54 68 | om.section.*Note.2-4-1::......Th |
| 6b4e0 | 65 20 69 73 73 75 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 62 6f 74 68 20 6f 66 20 74 68 65 73 65 | e.issue.underlying.both.of.these |
| 6b500 | 20 77 65 61 6b 6e 65 73 73 65 73 20 69 73 20 74 68 61 74 20 74 68 65 20 74 65 63 68 6e 69 71 75 | .weaknesses.is.that.the.techniqu |
| 6b520 | 65 0a 66 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 67 65 6e 65 72 69 63 20 69 6e 74 65 72 | e.for.implementing.generic.inter |
| 6b540 | 66 61 63 65 73 20 69 73 20 6e 6f 74 20 22 61 64 64 69 74 69 76 65 22 2e 20 20 54 68 65 20 70 65 | faces.is.not."additive"...The.pe |
| 6b560 | 72 73 6f 6e 0a 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 67 65 6e 65 72 69 63 20 73 65 | rson.implementing.the.generic.se |
| 6b580 | 6c 65 63 74 6f 72 20 70 72 6f 63 65 64 75 72 65 73 20 6d 75 73 74 20 6d 6f 64 69 66 79 20 74 68 | lector.procedures.must.modify.th |
| 6b5a0 | 6f 73 65 0a 70 72 6f 63 65 64 75 72 65 73 20 65 61 63 68 20 74 69 6d 65 20 61 20 6e 65 77 20 72 | ose.procedures.each.time.a.new.r |
| 6b5c0 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 69 6e 73 74 61 6c 6c 65 64 2c 20 61 6e 64 20 | epresentation.is.installed,.and. |
| 6b5e0 | 74 68 65 20 70 65 6f 70 6c 65 0a 69 6e 74 65 72 66 61 63 69 6e 67 20 74 68 65 20 69 6e 64 69 76 | the.people.interfacing.the.indiv |
| 6b600 | 69 64 75 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 6d 75 73 74 20 6d 6f 64 69 66 | idual.representations.must.modif |
| 6b620 | 79 20 74 68 65 69 72 20 63 6f 64 65 20 74 6f 0a 61 76 6f 69 64 20 6e 61 6d 65 20 63 6f 6e 66 6c | y.their.code.to.avoid.name.confl |
| 6b640 | 69 63 74 73 2e 20 20 49 6e 20 65 61 63 68 20 6f 66 20 74 68 65 73 65 20 63 61 73 65 73 2c 20 74 | icts...In.each.of.these.cases,.t |
| 6b660 | 68 65 20 63 68 61 6e 67 65 73 20 74 68 61 74 20 6d 75 73 74 20 62 65 0a 6d 61 64 65 20 74 6f 20 | he.changes.that.must.be.made.to. |
| 6b680 | 74 68 65 20 63 6f 64 65 20 61 72 65 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 2c 20 62 75 | the.code.are.straightforward,.bu |
| 6b6a0 | 74 20 74 68 65 79 20 6d 75 73 74 20 62 65 20 6d 61 64 65 0a 6e 6f 6e 65 74 68 65 6c 65 73 73 2c | t.they.must.be.made.nonetheless, |
| 6b6c0 | 20 61 6e 64 20 74 68 69 73 20 69 73 20 61 20 73 6f 75 72 63 65 20 6f 66 20 69 6e 63 6f 6e 76 65 | .and.this.is.a.source.of.inconve |
| 6b6e0 | 6e 69 65 6e 63 65 20 61 6e 64 20 65 72 72 6f 72 2e 20 20 54 68 69 73 20 69 73 0a 6e 6f 74 20 6d | nience.and.error...This.is.not.m |
| 6b700 | 75 63 68 20 6f 66 20 61 20 70 72 6f 62 6c 65 6d 20 66 6f 72 20 74 68 65 20 63 6f 6d 70 6c 65 78 | uch.of.a.problem.for.the.complex |
| 6b720 | 2d 6e 75 6d 62 65 72 20 73 79 73 74 65 6d 20 61 73 20 69 74 20 73 74 61 6e 64 73 2c 20 62 75 74 | -number.system.as.it.stands,.but |
| 6b740 | 0a 73 75 70 70 6f 73 65 20 74 68 65 72 65 20 77 65 72 65 20 6e 6f 74 20 74 77 6f 20 62 75 74 20 | .suppose.there.were.not.two.but. |
| 6b760 | 68 75 6e 64 72 65 64 73 20 6f 66 20 64 69 66 66 65 72 65 6e 74 20 72 65 70 72 65 73 65 6e 74 61 | hundreds.of.different.representa |
| 6b780 | 74 69 6f 6e 73 0a 66 6f 72 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2e 20 20 41 6e 64 20 | tions.for.complex.numbers...And. |
| 6b7a0 | 73 75 70 70 6f 73 65 20 74 68 61 74 20 74 68 65 72 65 20 77 65 72 65 20 6d 61 6e 79 20 67 65 6e | suppose.that.there.were.many.gen |
| 6b7c0 | 65 72 69 63 0a 73 65 6c 65 63 74 6f 72 73 20 74 6f 20 62 65 20 6d 61 69 6e 74 61 69 6e 65 64 20 | eric.selectors.to.be.maintained. |
| 6b7e0 | 69 6e 20 74 68 65 20 61 62 73 74 72 61 63 74 2d 64 61 74 61 20 69 6e 74 65 72 66 61 63 65 2e 20 | in.the.abstract-data.interface.. |
| 6b800 | 20 53 75 70 70 6f 73 65 2c 20 69 6e 0a 66 61 63 74 2c 20 74 68 61 74 20 6e 6f 20 6f 6e 65 20 70 | .Suppose,.in.fact,.that.no.one.p |
| 6b820 | 72 6f 67 72 61 6d 6d 65 72 20 6b 6e 65 77 20 61 6c 6c 20 74 68 65 20 69 6e 74 65 72 66 61 63 65 | rogrammer.knew.all.the.interface |
| 6b840 | 20 70 72 6f 63 65 64 75 72 65 73 20 6f 72 20 61 6c 6c 0a 74 68 65 20 72 65 70 72 65 73 65 6e 74 | .procedures.or.all.the.represent |
| 6b860 | 61 74 69 6f 6e 73 2e 20 20 54 68 65 20 70 72 6f 62 6c 65 6d 20 69 73 20 72 65 61 6c 20 61 6e 64 | ations...The.problem.is.real.and |
| 6b880 | 20 6d 75 73 74 20 62 65 20 61 64 64 72 65 73 73 65 64 20 69 6e 20 73 75 63 68 0a 70 72 6f 67 72 | .must.be.addressed.in.such.progr |
| 6b8a0 | 61 6d 73 20 61 73 20 6c 61 72 67 65 2d 73 63 61 6c 65 20 64 61 74 61 2d 62 61 73 65 2d 6d 61 6e | ams.as.large-scale.data-base-man |
| 6b8c0 | 61 67 65 6d 65 6e 74 20 73 79 73 74 65 6d 73 2e 0a 0a 20 20 20 57 68 61 74 20 77 65 20 6e 65 65 | agement.systems......What.we.nee |
| 6b8e0 | 64 20 69 73 20 61 20 6d 65 61 6e 73 20 66 6f 72 20 6d 6f 64 75 6c 61 72 69 7a 69 6e 67 20 74 68 | d.is.a.means.for.modularizing.th |
| 6b900 | 65 20 73 79 73 74 65 6d 20 64 65 73 69 67 6e 20 65 76 65 6e 0a 66 75 72 74 68 65 72 2e 20 20 54 | e.system.design.even.further...T |
| 6b920 | 68 69 73 20 69 73 20 70 72 6f 76 69 64 65 64 20 62 79 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 69 | his.is.provided.by.the.programmi |
| 6b940 | 6e 67 20 74 65 63 68 6e 69 71 75 65 20 6b 6e 6f 77 6e 20 61 73 20 70 72 6f 67 72 61 6d 6d 69 6e | ng.technique.known.as.programmin |
| 6b960 | 67 0a 22 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 70 72 6f 67 72 61 6d 6d 69 6e 67 22 2e 20 20 | g."data-directed.programming"... |
| 6b980 | 54 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 68 6f 77 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 0a | To.understand.how.data-directed. |
| 6b9a0 | 70 72 6f 67 72 61 6d 6d 69 6e 67 20 77 6f 72 6b 73 2c 20 62 65 67 69 6e 20 77 69 74 68 20 74 68 | programming.works,.begin.with.th |
| 6b9c0 | 65 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 74 68 61 74 20 77 68 65 6e 65 76 65 72 20 77 65 20 64 | e.observation.that.whenever.we.d |
| 6b9e0 | 65 61 6c 0a 77 69 74 68 20 61 20 73 65 74 20 6f 66 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 | eal.with.a.set.of.generic.operat |
| 6ba00 | 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 63 6f 6d 6d 6f 6e 20 74 6f 20 61 20 73 65 74 20 6f 66 | ions.that.are.common.to.a.set.of |
| 6ba20 | 20 64 69 66 66 65 72 65 6e 74 0a 74 79 70 65 73 20 77 65 20 61 72 65 2c 20 69 6e 20 65 66 66 65 | .different.types.we.are,.in.effe |
| 6ba40 | 63 74 2c 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 61 20 74 77 6f 2d 64 69 6d 65 6e 73 69 6f 6e | ct,.dealing.with.a.two-dimension |
| 6ba60 | 61 6c 20 74 61 62 6c 65 20 74 68 61 74 0a 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 70 6f 73 73 69 | al.table.that.contains.the.possi |
| 6ba80 | 62 6c 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 6f 6e 65 20 61 78 69 73 20 61 6e 64 20 74 | ble.operations.on.one.axis.and.t |
| 6baa0 | 68 65 20 70 6f 73 73 69 62 6c 65 20 74 79 70 65 73 20 6f 6e 0a 74 68 65 20 6f 74 68 65 72 20 61 | he.possible.types.on.the.other.a |
| 6bac0 | 78 69 73 2e 20 20 54 68 65 20 65 6e 74 72 69 65 73 20 69 6e 20 74 68 65 20 74 61 62 6c 65 20 61 | xis...The.entries.in.the.table.a |
| 6bae0 | 72 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 0a 69 6d 70 6c 65 6d 65 6e 74 | re.the.procedures.that.implement |
| 6bb00 | 20 65 61 63 68 20 6f 70 65 72 61 74 69 6f 6e 20 66 6f 72 20 65 61 63 68 20 74 79 70 65 20 6f 66 | .each.operation.for.each.type.of |
| 6bb20 | 20 61 72 67 75 6d 65 6e 74 20 70 72 65 73 65 6e 74 65 64 2e 20 20 49 6e 20 74 68 65 0a 63 6f 6d | .argument.presented...In.the.com |
| 6bb40 | 70 6c 65 78 2d 6e 75 6d 62 65 72 20 73 79 73 74 65 6d 20 64 65 76 65 6c 6f 70 65 64 20 69 6e 20 | plex-number.system.developed.in. |
| 6bb60 | 74 68 65 20 70 72 65 76 69 6f 75 73 20 73 65 63 74 69 6f 6e 2c 20 74 68 65 0a 63 6f 72 72 65 73 | the.previous.section,.the.corres |
| 6bb80 | 70 6f 6e 64 65 6e 63 65 20 62 65 74 77 65 65 6e 20 6f 70 65 72 61 74 69 6f 6e 20 6e 61 6d 65 2c | pondence.between.operation.name, |
| 6bba0 | 20 64 61 74 61 20 74 79 70 65 2c 20 61 6e 64 20 61 63 74 75 61 6c 20 70 72 6f 63 65 64 75 72 65 | .data.type,.and.actual.procedure |
| 6bbc0 | 0a 77 61 73 20 73 70 72 65 61 64 20 6f 75 74 20 61 6d 6f 6e 67 20 74 68 65 20 76 61 72 69 6f 75 | .was.spread.out.among.the.variou |
| 6bbe0 | 73 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 63 6c 61 75 73 65 73 20 69 6e 20 74 68 65 20 67 65 6e | s.conditional.clauses.in.the.gen |
| 6bc00 | 65 72 69 63 0a 69 6e 74 65 72 66 61 63 65 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 42 75 74 20 | eric.interface.procedures...But. |
| 6bc20 | 74 68 65 20 73 61 6d 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 63 6f 75 6c 64 20 68 61 76 65 20 | the.same.information.could.have. |
| 6bc40 | 62 65 65 6e 0a 6f 72 67 61 6e 69 7a 65 64 20 69 6e 20 61 20 74 61 62 6c 65 2c 20 61 73 20 73 68 | been.organized.in.a.table,.as.sh |
| 6bc60 | 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 32 32 3a 3a 2e 0a 0a 20 20 20 | own.in.*Note.Figure.2-22::...... |
| 6bc80 | 44 61 74 61 2d 64 69 72 65 63 74 65 64 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 74 68 65 | Data-directed.programming.is.the |
| 6bca0 | 20 74 65 63 68 6e 69 71 75 65 20 6f 66 20 64 65 73 69 67 6e 69 6e 67 20 70 72 6f 67 72 61 6d 73 | .technique.of.designing.programs |
| 6bcc0 | 20 74 6f 0a 77 6f 72 6b 20 77 69 74 68 20 73 75 63 68 20 61 20 74 61 62 6c 65 20 64 69 72 65 63 | .to.work.with.such.a.table.direc |
| 6bce0 | 74 6c 79 2e 20 20 50 72 65 76 69 6f 75 73 6c 79 2c 20 77 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 | tly...Previously,.we.implemented |
| 6bd00 | 20 74 68 65 0a 6d 65 63 68 61 6e 69 73 6d 20 74 68 61 74 20 69 6e 74 65 72 66 61 63 65 73 20 74 | .the.mechanism.that.interfaces.t |
| 6bd20 | 68 65 20 63 6f 6d 70 6c 65 78 2d 61 72 69 74 68 6d 65 74 69 63 20 63 6f 64 65 20 77 69 74 68 20 | he.complex-arithmetic.code.with. |
| 6bd40 | 74 68 65 20 74 77 6f 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 70 61 63 6b 61 67 65 73 20 | the.two.representation.packages. |
| 6bd60 | 61 73 20 61 20 73 65 74 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 65 61 63 68 | as.a.set.of.procedures.that.each |
| 6bd80 | 20 70 65 72 66 6f 72 6d 20 61 6e 0a 65 78 70 6c 69 63 69 74 20 64 69 73 70 61 74 63 68 20 6f 6e | .perform.an.explicit.dispatch.on |
| 6bda0 | 20 74 79 70 65 2e 20 20 48 65 72 65 20 77 65 20 77 69 6c 6c 20 69 6d 70 6c 65 6d 65 6e 74 20 74 | .type...Here.we.will.implement.t |
| 6bdc0 | 68 65 20 69 6e 74 65 72 66 61 63 65 20 61 73 20 61 0a 73 69 6e 67 6c 65 20 70 72 6f 63 65 64 75 | he.interface.as.a.single.procedu |
| 6bde0 | 72 65 20 74 68 61 74 20 6c 6f 6f 6b 73 20 75 70 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e | re.that.looks.up.the.combination |
| 6be00 | 20 6f 66 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 6e 61 6d 65 0a 61 6e 64 20 61 72 67 75 6d | .of.the.operation.name.and.argum |
| 6be20 | 65 6e 74 20 74 79 70 65 20 69 6e 20 74 68 65 20 74 61 62 6c 65 20 74 6f 20 66 69 6e 64 20 74 68 | ent.type.in.the.table.to.find.th |
| 6be40 | 65 20 63 6f 72 72 65 63 74 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 61 70 70 6c 79 2c 0a 61 6e | e.correct.procedure.to.apply,.an |
| 6be60 | 64 20 74 68 65 6e 20 61 70 70 6c 69 65 73 20 69 74 20 74 6f 20 74 68 65 20 63 6f 6e 74 65 6e 74 | d.then.applies.it.to.the.content |
| 6be80 | 73 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 2e 20 20 49 66 20 77 65 20 64 6f 20 74 68 69 | s.of.the.argument...If.we.do.thi |
| 6bea0 | 73 2c 0a 74 68 65 6e 20 74 6f 20 61 64 64 20 61 20 6e 65 77 20 72 65 70 72 65 73 65 6e 74 61 74 | s,.then.to.add.a.new.representat |
| 6bec0 | 69 6f 6e 20 70 61 63 6b 61 67 65 20 74 6f 20 74 68 65 20 73 79 73 74 65 6d 20 77 65 20 6e 65 65 | ion.package.to.the.system.we.nee |
| 6bee0 | 64 20 6e 6f 74 0a 63 68 61 6e 67 65 20 61 6e 79 20 65 78 69 73 74 69 6e 67 20 70 72 6f 63 65 64 | d.not.change.any.existing.proced |
| 6bf00 | 75 72 65 73 3b 20 77 65 20 6e 65 65 64 20 6f 6e 6c 79 20 61 64 64 20 6e 65 77 20 65 6e 74 72 69 | ures;.we.need.only.add.new.entri |
| 6bf20 | 65 73 20 74 6f 20 74 68 65 0a 74 61 62 6c 65 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 | es.to.the.table........*Figure.2 |
| 6bf40 | 2e 32 32 3a 2a 20 54 61 62 6c 65 20 6f 66 20 6f 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 74 68 | .22:*.Table.of.operations.for.th |
| 6bf60 | 65 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 73 79 73 74 65 6d 2e 0a 0a 20 20 20 20 20 20 | e.complex-number.system......... |
| 6bf80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54 | ...............|...............T |
| 6bfa0 | 79 70 65 73 0a 20 20 20 20 20 20 20 20 20 20 4f 70 65 72 61 74 69 6f 6e 73 20 7c 20 50 6f 6c 61 | ypes...........Operations.|.Pola |
| 6bfc0 | 72 20 20 20 20 20 20 20 20 20 20 20 7c 20 52 65 63 74 61 6e 67 75 6c 61 72 0a 20 20 20 20 20 20 | r...........|.Rectangular....... |
| 6bfe0 | 20 20 20 20 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 2b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ....===========+================ |
| 6c000 | 3d 2b 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 20 20 20 20 20 20 20 | =+======================........ |
| 6c020 | 20 20 20 72 65 61 6c 2d 70 61 72 74 20 20 7c 20 72 65 61 6c 2d 70 61 72 74 2d 70 6f 6c 61 72 20 | ...real-part..|.real-part-polar. |
| 6c040 | 7c 20 72 65 61 6c 2d 70 61 72 74 2d 72 65 63 74 61 6e 67 75 6c 61 72 0a 20 20 20 20 20 20 20 20 | |.real-part-rectangular......... |
| 6c060 | 20 20 69 6d 61 67 2d 70 61 72 74 20 20 7c 20 69 6d 61 67 2d 70 61 72 74 2d 70 6f 6c 61 72 20 7c | ..imag-part..|.imag-part-polar.| |
| 6c080 | 20 69 6d 61 67 2d 70 61 72 74 2d 72 65 63 74 61 6e 67 75 6c 61 72 0a 20 20 20 20 20 20 20 20 20 | .imag-part-rectangular.......... |
| 6c0a0 | 20 6d 61 67 6e 69 74 75 64 65 20 20 7c 20 6d 61 67 6e 69 74 75 64 65 2d 70 6f 6c 61 72 20 7c 20 | .magnitude..|.magnitude-polar.|. |
| 6c0c0 | 6d 61 67 6e 69 74 75 64 65 2d 72 65 63 74 61 6e 67 75 6c 61 72 0a 20 20 20 20 20 20 20 20 20 20 | magnitude-rectangular........... |
| 6c0e0 | 61 6e 67 6c 65 20 20 20 20 20 20 7c 20 61 6e 67 6c 65 2d 70 6f 6c 61 72 20 20 20 20 20 7c 20 61 | angle......|.angle-polar.....|.a |
| 6c100 | 6e 67 6c 65 2d 72 65 63 74 61 6e 67 75 6c 61 72 0a 0a 20 20 20 54 6f 20 69 6d 70 6c 65 6d 65 6e | ngle-rectangular.....To.implemen |
| 6c120 | 74 20 74 68 69 73 20 70 6c 61 6e 2c 20 61 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 68 61 76 65 | t.this.plan,.assume.that.we.have |
| 6c140 | 20 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 2c 20 60 70 75 74 27 20 61 6e 64 0a 60 67 65 74 27 | .two.procedures,.`put'.and.`get' |
| 6c160 | 2c 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e | ,.for.manipulating.the.operation |
| 6c180 | 2d 61 6e 64 2d 74 79 70 65 20 74 61 62 6c 65 3a 0a 0a 20 20 20 2a 20 60 28 70 75 74 20 3c 4f 50 | -and-type.table:.....*.`(put.<OP |
| 6c1a0 | 3e 20 3c 54 59 50 45 3e 20 3c 49 54 45 4d 3e 29 27 20 69 6e 73 74 61 6c 6c 73 20 74 68 65 20 60 | >.<TYPE>.<ITEM>)'.installs.the.` |
| 6c1c0 | 3c 49 54 45 4d 3e 27 20 69 6e 20 74 68 65 20 74 61 62 6c 65 2c 0a 20 20 20 20 20 69 6e 64 65 78 | <ITEM>'.in.the.table,......index |
| 6c1e0 | 65 64 20 62 79 20 74 68 65 20 60 3c 4f 50 3e 27 20 61 6e 64 20 74 68 65 20 60 3c 54 59 50 45 3e | ed.by.the.`<OP>'.and.the.`<TYPE> |
| 6c200 | 27 2e 0a 0a 20 20 20 2a 20 60 28 67 65 74 20 3c 4f 50 3e 20 3c 54 59 50 45 3e 29 27 20 6c 6f 6f | '......*.`(get.<OP>.<TYPE>)'.loo |
| 6c220 | 6b 73 20 75 70 20 74 68 65 20 60 3c 4f 50 3e 27 2c 20 60 3c 54 59 50 45 3e 27 20 65 6e 74 72 79 | ks.up.the.`<OP>',.`<TYPE>'.entry |
| 6c240 | 20 69 6e 20 74 68 65 0a 20 20 20 20 20 74 61 62 6c 65 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 | .in.the......table.and.returns.t |
| 6c260 | 68 65 20 69 74 65 6d 20 66 6f 75 6e 64 20 74 68 65 72 65 2e 20 20 49 66 20 6e 6f 20 69 74 65 6d | he.item.found.there...If.no.item |
| 6c280 | 20 69 73 20 66 6f 75 6e 64 2c 0a 20 20 20 20 20 60 67 65 74 27 20 72 65 74 75 72 6e 73 20 66 61 | .is.found,......`get'.returns.fa |
| 6c2a0 | 6c 73 65 2e 0a 0a 0a 20 20 20 46 6f 72 20 6e 6f 77 2c 20 77 65 20 63 61 6e 20 61 73 73 75 6d 65 | lse.......For.now,.we.can.assume |
| 6c2c0 | 20 74 68 61 74 20 60 70 75 74 27 20 61 6e 64 20 60 67 65 74 27 20 61 72 65 20 69 6e 63 6c 75 64 | .that.`put'.and.`get'.are.includ |
| 6c2e0 | 65 64 20 69 6e 20 6f 75 72 0a 6c 61 6e 67 75 61 67 65 2e 20 20 49 6e 20 2a 4e 6f 74 65 20 43 68 | ed.in.our.language...In.*Note.Ch |
| 6c300 | 61 70 74 65 72 20 33 3a 3a 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 33 2d 33 3a 3a | apter.3::.(section.*Note.3-3-3:: |
| 6c320 | 2c 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 33 2d 32 34 3a 3a 29 20 77 65 20 77 69 6c 6c | ,.*Note.Exercise.3-24::).we.will |
| 6c340 | 20 73 65 65 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 73 65 20 61 6e 64 20 | .see.how.to.implement.these.and. |
| 6c360 | 6f 74 68 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 0a 6d 61 6e 69 70 75 6c 61 74 69 6e | other.operations.for.manipulatin |
| 6c380 | 67 20 74 61 62 6c 65 73 2e 0a 0a 20 20 20 48 65 72 65 20 69 73 20 68 6f 77 20 64 61 74 61 2d 64 | g.tables......Here.is.how.data-d |
| 6c3a0 | 69 72 65 63 74 65 64 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 63 61 6e 20 62 65 20 75 73 65 64 20 | irected.programming.can.be.used. |
| 6c3c0 | 69 6e 20 74 68 65 0a 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 73 79 73 74 65 6d 2e 20 20 42 | in.the.complex-number.system...B |
| 6c3e0 | 65 6e 2c 20 77 68 6f 20 64 65 76 65 6c 6f 70 65 64 20 74 68 65 20 72 65 63 74 61 6e 67 75 6c 61 | en,.who.developed.the.rectangula |
| 6c400 | 72 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c 20 69 6d 70 6c 65 6d 65 6e 74 73 20 68 69 73 | r.representation,.implements.his |
| 6c420 | 20 63 6f 64 65 20 6a 75 73 74 20 61 73 20 68 65 20 64 69 64 20 6f 72 69 67 69 6e 61 6c 6c 79 2e | .code.just.as.he.did.originally. |
| 6c440 | 20 20 48 65 0a 64 65 66 69 6e 65 73 20 61 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 70 72 6f | ..He.defines.a.collection.of.pro |
| 6c460 | 63 65 64 75 72 65 73 2c 20 6f 72 20 61 20 22 70 61 63 6b 61 67 65 22 2c 20 61 6e 64 20 69 6e 74 | cedures,.or.a."package",.and.int |
| 6c480 | 65 72 66 61 63 65 73 0a 74 68 65 73 65 20 74 6f 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 | erfaces.these.to.the.rest.of.the |
| 6c4a0 | 20 73 79 73 74 65 6d 20 62 79 20 61 64 64 69 6e 67 20 65 6e 74 72 69 65 73 20 74 6f 20 74 68 65 | .system.by.adding.entries.to.the |
| 6c4c0 | 20 74 61 62 6c 65 20 74 68 61 74 0a 74 65 6c 6c 20 74 68 65 20 73 79 73 74 65 6d 20 68 6f 77 20 | .table.that.tell.the.system.how. |
| 6c4e0 | 74 6f 20 6f 70 65 72 61 74 65 20 6f 6e 20 72 65 63 74 61 6e 67 75 6c 61 72 20 6e 75 6d 62 65 72 | to.operate.on.rectangular.number |
| 6c500 | 73 2e 20 20 54 68 69 73 20 69 73 0a 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 63 61 6c 6c | s...This.is.accomplished.by.call |
| 6c520 | 69 6e 67 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 | ing.the.following.procedure:.... |
| 6c540 | 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 73 74 61 6c 6c 2d 72 65 63 74 61 6e 67 75 6c 61 72 2d | ...(define.(install-rectangular- |
| 6c560 | 70 61 63 6b 61 67 65 29 0a 20 20 20 20 20 20 20 3b 3b 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f 63 | package)........;;.internal.proc |
| 6c580 | 65 64 75 72 65 73 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 61 6c 2d 70 61 72 74 | edures........(define.(real-part |
| 6c5a0 | 20 7a 29 20 28 63 61 72 20 7a 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 61 | .z).(car.z))........(define.(ima |
| 6c5c0 | 67 2d 70 61 72 74 20 7a 29 20 28 63 64 72 20 7a 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e | g-part.z).(cdr.z))........(defin |
| 6c5e0 | 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 29 20 28 63 6f 6e | e.(make-from-real-imag.x.y).(con |
| 6c600 | 73 20 78 20 79 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 67 6e 69 74 75 64 | s.x.y))........(define.(magnitud |
| 6c620 | 65 20 7a 29 0a 20 20 20 20 20 20 20 20 20 28 73 71 72 74 20 28 2b 20 28 73 71 75 61 72 65 20 28 | e.z)..........(sqrt.(+.(square.( |
| 6c640 | 72 65 61 6c 2d 70 61 72 74 20 7a 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | real-part.z))................... |
| 6c660 | 28 73 71 75 61 72 65 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 29 29 29 29 29 0a 20 20 20 20 20 20 | (square.(imag-part.z)))))....... |
| 6c680 | 20 28 64 65 66 69 6e 65 20 28 61 6e 67 6c 65 20 7a 29 0a 20 20 20 20 20 20 20 20 20 28 61 74 61 | .(define.(angle.z)..........(ata |
| 6c6a0 | 6e 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 29 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 29 29 29 0a | n.(imag-part.z).(real-part.z))). |
| 6c6c0 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e | .......(define.(make-from-mag-an |
| 6c6e0 | 67 20 72 20 61 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 2a 20 72 20 28 63 6f 73 20 | g.r.a)..........(cons.(*.r.(cos. |
| 6c700 | 61 29 29 20 28 2a 20 72 20 28 73 69 6e 20 61 29 29 29 29 0a 0a 20 20 20 20 20 20 20 3b 3b 20 69 | a)).(*.r.(sin.a)))).........;;.i |
| 6c720 | 6e 74 65 72 66 61 63 65 20 74 6f 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 79 73 74 | nterface.to.the.rest.of.the.syst |
| 6c740 | 65 6d 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 61 67 20 78 29 20 28 61 74 74 61 63 | em........(define.(tag.x).(attac |
| 6c760 | 68 2d 74 61 67 20 27 72 65 63 74 61 6e 67 75 6c 61 72 20 78 29 29 0a 20 20 20 20 20 20 20 28 70 | h-tag.'rectangular.x))........(p |
| 6c780 | 75 74 20 27 72 65 61 6c 2d 70 61 72 74 20 27 28 72 65 63 74 61 6e 67 75 6c 61 72 29 20 72 65 61 | ut.'real-part.'(rectangular).rea |
| 6c7a0 | 6c 2d 70 61 72 74 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 69 6d 61 67 2d 70 61 72 74 20 27 | l-part)........(put.'imag-part.' |
| 6c7c0 | 28 72 65 63 74 61 6e 67 75 6c 61 72 29 20 69 6d 61 67 2d 70 61 72 74 29 0a 20 20 20 20 20 20 20 | (rectangular).imag-part)........ |
| 6c7e0 | 28 70 75 74 20 27 6d 61 67 6e 69 74 75 64 65 20 27 28 72 65 63 74 61 6e 67 75 6c 61 72 29 20 6d | (put.'magnitude.'(rectangular).m |
| 6c800 | 61 67 6e 69 74 75 64 65 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 61 6e 67 6c 65 20 27 28 72 | agnitude)........(put.'angle.'(r |
| 6c820 | 65 63 74 61 6e 67 75 6c 61 72 29 20 61 6e 67 6c 65 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 | ectangular).angle)........(put.' |
| 6c840 | 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 27 72 65 63 74 61 6e 67 75 6c 61 72 | make-from-real-imag.'rectangular |
| 6c860 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 20 79 29 20 28 74 61 67 20 | .............(lambda.(x.y).(tag. |
| 6c880 | 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 29 29 29 29 0a 20 20 20 | (make-from-real-imag.x.y)))).... |
| 6c8a0 | 20 20 20 20 28 70 75 74 20 27 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 27 72 65 63 | ....(put.'make-from-mag-ang.'rec |
| 6c8c0 | 74 61 6e 67 75 6c 61 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 20 | tangular.............(lambda.(r. |
| 6c8e0 | 61 29 20 28 74 61 67 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 72 20 61 29 29 | a).(tag.(make-from-mag-ang.r.a)) |
| 6c900 | 29 29 0a 20 20 20 20 20 20 20 27 64 6f 6e 65 29 0a 0a 20 20 20 4e 6f 74 69 63 65 20 74 68 61 74 | ))........'done).....Notice.that |
| 6c920 | 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 73 20 68 65 72 65 20 61 72 | .the.internal.procedures.here.ar |
| 6c940 | 65 20 74 68 65 20 73 61 6d 65 20 70 72 6f 63 65 64 75 72 65 73 0a 66 72 6f 6d 20 73 65 63 74 69 | e.the.same.procedures.from.secti |
| 6c960 | 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 31 3a 3a 20 74 68 61 74 20 42 65 6e 20 77 72 6f 74 65 20 | on.*Note.2-4-1::.that.Ben.wrote. |
| 6c980 | 77 68 65 6e 20 68 65 20 77 61 73 20 77 6f 72 6b 69 6e 67 20 69 6e 0a 69 73 6f 6c 61 74 69 6f 6e | when.he.was.working.in.isolation |
| 6c9a0 | 2e 20 20 4e 6f 20 63 68 61 6e 67 65 73 20 61 72 65 20 6e 65 63 65 73 73 61 72 79 20 69 6e 20 6f | ...No.changes.are.necessary.in.o |
| 6c9c0 | 72 64 65 72 20 74 6f 20 69 6e 74 65 72 66 61 63 65 20 74 68 65 6d 20 74 6f 20 74 68 65 0a 72 65 | rder.to.interface.them.to.the.re |
| 6c9e0 | 73 74 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 2e 20 20 4d 6f 72 65 6f 76 65 72 2c 20 73 69 6e | st.of.the.system...Moreover,.sin |
| 6ca00 | 63 65 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 | ce.these.procedure.definitions.a |
| 6ca20 | 72 65 0a 69 6e 74 65 72 6e 61 6c 20 74 6f 20 74 68 65 20 69 6e 73 74 61 6c 6c 61 74 69 6f 6e 20 | re.internal.to.the.installation. |
| 6ca40 | 70 72 6f 63 65 64 75 72 65 2c 20 42 65 6e 20 6e 65 65 64 6e 27 74 20 77 6f 72 72 79 20 61 62 6f | procedure,.Ben.needn't.worry.abo |
| 6ca60 | 75 74 20 6e 61 6d 65 0a 63 6f 6e 66 6c 69 63 74 73 20 77 69 74 68 20 6f 74 68 65 72 20 70 72 6f | ut.name.conflicts.with.other.pro |
| 6ca80 | 63 65 64 75 72 65 73 20 6f 75 74 73 69 64 65 20 74 68 65 20 72 65 63 74 61 6e 67 75 6c 61 72 20 | cedures.outside.the.rectangular. |
| 6caa0 | 70 61 63 6b 61 67 65 2e 20 20 54 6f 0a 69 6e 74 65 72 66 61 63 65 20 74 68 65 73 65 20 74 6f 20 | package...To.interface.these.to. |
| 6cac0 | 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 2c 20 42 65 6e 20 69 6e 73 74 | the.rest.of.the.system,.Ben.inst |
| 6cae0 | 61 6c 6c 73 20 68 69 73 20 60 72 65 61 6c 2d 70 61 72 74 27 0a 70 72 6f 63 65 64 75 72 65 20 75 | alls.his.`real-part'.procedure.u |
| 6cb00 | 6e 64 65 72 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 6e 61 6d 65 20 60 72 65 61 6c 2d 70 61 | nder.the.operation.name.`real-pa |
| 6cb20 | 72 74 27 20 61 6e 64 20 74 68 65 20 74 79 70 65 0a 60 28 72 65 63 74 61 6e 67 75 6c 61 72 29 27 | rt'.and.the.type.`(rectangular)' |
| 6cb40 | 2c 20 61 6e 64 20 73 69 6d 69 6c 61 72 6c 79 20 66 6f 72 20 74 68 65 20 6f 74 68 65 72 20 73 65 | ,.and.similarly.for.the.other.se |
| 6cb60 | 6c 65 63 74 6f 72 73 2e 28 31 29 20 20 54 68 65 0a 69 6e 74 65 72 66 61 63 65 20 61 6c 73 6f 20 | lectors.(1)..The.interface.also. |
| 6cb80 | 64 65 66 69 6e 65 73 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 74 6f 20 62 65 20 75 | defines.the.constructors.to.be.u |
| 6cba0 | 73 65 64 20 62 79 20 74 68 65 20 65 78 74 65 72 6e 61 6c 0a 73 79 73 74 65 6d 2e 28 32 29 20 20 | sed.by.the.external.system.(2).. |
| 6cbc0 | 54 68 65 73 65 20 61 72 65 20 69 64 65 6e 74 69 63 61 6c 20 74 6f 20 42 65 6e 27 73 20 69 6e 74 | These.are.identical.to.Ben's.int |
| 6cbe0 | 65 72 6e 61 6c 6c 79 20 64 65 66 69 6e 65 64 0a 63 6f 6e 73 74 72 75 63 74 6f 72 73 2c 20 65 78 | ernally.defined.constructors,.ex |
| 6cc00 | 63 65 70 74 20 74 68 61 74 20 74 68 65 79 20 61 74 74 61 63 68 20 74 68 65 20 74 61 67 2e 0a 0a | cept.that.they.attach.the.tag... |
| 6cc20 | 20 20 20 41 6c 79 73 73 61 27 73 20 70 6f 6c 61 72 20 70 61 63 6b 61 67 65 20 69 73 20 61 6e 61 | ...Alyssa's.polar.package.is.ana |
| 6cc40 | 6c 6f 67 6f 75 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 73 74 61 6c 6c 2d 70 | logous:.......(define.(install-p |
| 6cc60 | 6f 6c 61 72 2d 70 61 63 6b 61 67 65 29 0a 20 20 20 20 20 20 20 3b 3b 20 69 6e 74 65 72 6e 61 6c | olar-package)........;;.internal |
| 6cc80 | 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 67 6e | .procedures........(define.(magn |
| 6cca0 | 69 74 75 64 65 20 7a 29 20 28 63 61 72 20 7a 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | itude.z).(car.z))........(define |
| 6ccc0 | 20 28 61 6e 67 6c 65 20 7a 29 20 28 63 64 72 20 7a 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 | .(angle.z).(cdr.z))........(defi |
| 6cce0 | 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 72 20 61 29 20 28 63 6f 6e 73 | ne.(make-from-mag-ang.r.a).(cons |
| 6cd00 | 20 72 20 61 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 61 6c 2d 70 61 72 74 | .r.a))........(define.(real-part |
| 6cd20 | 20 7a 29 0a 20 20 20 20 20 20 20 20 20 28 2a 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 29 20 28 63 | .z)..........(*.(magnitude.z).(c |
| 6cd40 | 6f 73 20 28 61 6e 67 6c 65 20 7a 29 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | os.(angle.z))))........(define.( |
| 6cd60 | 69 6d 61 67 2d 70 61 72 74 20 7a 29 0a 20 20 20 20 20 20 20 20 20 28 2a 20 28 6d 61 67 6e 69 74 | imag-part.z)..........(*.(magnit |
| 6cd80 | 75 64 65 20 7a 29 20 28 73 69 6e 20 28 61 6e 67 6c 65 20 7a 29 29 29 29 0a 20 20 20 20 20 20 20 | ude.z).(sin.(angle.z))))........ |
| 6cda0 | 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 | (define.(make-from-real-imag.x.y |
| 6cdc0 | 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 73 71 72 74 20 28 2b 20 28 73 71 75 61 72 | )..........(cons.(sqrt.(+.(squar |
| 6cde0 | 65 20 78 29 20 28 73 71 75 61 72 65 20 79 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e.x).(square.y)))............... |
| 6ce00 | 20 28 61 74 61 6e 20 79 20 78 29 29 29 0a 0a 20 20 20 20 20 20 20 3b 3b 20 69 6e 74 65 72 66 61 | .(atan.y.x))).........;;.interfa |
| 6ce20 | 63 65 20 74 6f 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 0a 20 20 20 | ce.to.the.rest.of.the.system.... |
| 6ce40 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 61 67 20 78 29 20 28 61 74 74 61 63 68 2d 74 61 67 20 | ....(define.(tag.x).(attach-tag. |
| 6ce60 | 27 70 6f 6c 61 72 20 78 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 72 65 61 6c 2d 70 61 72 | 'polar.x))........(put.'real-par |
| 6ce80 | 74 20 27 28 70 6f 6c 61 72 29 20 72 65 61 6c 2d 70 61 72 74 29 0a 20 20 20 20 20 20 20 28 70 75 | t.'(polar).real-part)........(pu |
| 6cea0 | 74 20 27 69 6d 61 67 2d 70 61 72 74 20 27 28 70 6f 6c 61 72 29 20 69 6d 61 67 2d 70 61 72 74 29 | t.'imag-part.'(polar).imag-part) |
| 6cec0 | 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 6d 61 67 6e 69 74 75 64 65 20 27 28 70 6f 6c 61 72 29 | ........(put.'magnitude.'(polar) |
| 6cee0 | 20 6d 61 67 6e 69 74 75 64 65 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 61 6e 67 6c 65 20 27 | .magnitude)........(put.'angle.' |
| 6cf00 | 28 70 6f 6c 61 72 29 20 61 6e 67 6c 65 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 6d 61 6b 65 | (polar).angle)........(put.'make |
| 6cf20 | 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 27 70 6f 6c 61 72 0a 20 20 20 20 20 20 20 20 20 | -from-real-imag.'polar.......... |
| 6cf40 | 20 20 20 28 6c 61 6d 62 64 61 20 28 78 20 79 29 20 28 74 61 67 20 28 6d 61 6b 65 2d 66 72 6f 6d | ...(lambda.(x.y).(tag.(make-from |
| 6cf60 | 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 29 29 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 | -real-imag.x.y))))........(put.' |
| 6cf80 | 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 27 70 6f 6c 61 72 0a 20 20 20 20 20 20 20 | make-from-mag-ang.'polar........ |
| 6cfa0 | 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 20 61 29 20 28 74 61 67 20 28 6d 61 6b 65 2d 66 72 | .....(lambda.(r.a).(tag.(make-fr |
| 6cfc0 | 6f 6d 2d 6d 61 67 2d 61 6e 67 20 72 20 61 29 29 29 29 0a 20 20 20 20 20 20 20 27 64 6f 6e 65 29 | om-mag-ang.r.a))))........'done) |
| 6cfe0 | 0a 0a 20 20 20 45 76 65 6e 20 74 68 6f 75 67 68 20 42 65 6e 20 61 6e 64 20 41 6c 79 73 73 61 20 | .....Even.though.Ben.and.Alyssa. |
| 6d000 | 62 6f 74 68 20 73 74 69 6c 6c 20 75 73 65 20 74 68 65 69 72 20 6f 72 69 67 69 6e 61 6c 20 70 72 | both.still.use.their.original.pr |
| 6d020 | 6f 63 65 64 75 72 65 73 0a 64 65 66 69 6e 65 64 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 6e | ocedures.defined.with.the.same.n |
| 6d040 | 61 6d 65 73 20 61 73 20 65 61 63 68 20 6f 74 68 65 72 27 73 20 28 65 2e 67 2e 2c 20 60 72 65 61 | ames.as.each.other's.(e.g.,.`rea |
| 6d060 | 6c 2d 70 61 72 74 27 29 2c 20 74 68 65 73 65 0a 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 | l-part'),.these.definitions.are. |
| 6d080 | 6e 6f 77 20 69 6e 74 65 72 6e 61 6c 20 74 6f 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 63 65 64 | now.internal.to.different.proced |
| 6d0a0 | 75 72 65 73 20 28 73 65 65 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 31 2d 31 2d 38 3a 3a 29 | ures.(see.section.*Note.1-1-8::) |
| 6d0c0 | 2c 20 73 6f 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6e 61 6d 65 20 63 6f 6e 66 6c 69 63 74 2e 0a | ,.so.there.is.no.name.conflict.. |
| 6d0e0 | 0a 20 20 20 54 68 65 20 63 6f 6d 70 6c 65 78 2d 61 72 69 74 68 6d 65 74 69 63 20 73 65 6c 65 63 | ....The.complex-arithmetic.selec |
| 6d100 | 74 6f 72 73 20 61 63 63 65 73 73 20 74 68 65 20 74 61 62 6c 65 20 62 79 20 6d 65 61 6e 73 20 6f | tors.access.the.table.by.means.o |
| 6d120 | 66 20 61 0a 67 65 6e 65 72 61 6c 20 22 6f 70 65 72 61 74 69 6f 6e 22 20 70 72 6f 63 65 64 75 72 | f.a.general."operation".procedur |
| 6d140 | 65 20 63 61 6c 6c 65 64 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 2c 20 77 68 69 63 68 20 | e.called.`apply-generic',.which. |
| 6d160 | 61 70 70 6c 69 65 73 20 61 0a 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 20 74 6f 20 73 | applies.a.generic.operation.to.s |
| 6d180 | 6f 6d 65 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 60 41 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 | ome.arguments...`Apply-generic'. |
| 6d1a0 | 6c 6f 6f 6b 73 20 69 6e 20 74 68 65 0a 74 61 62 6c 65 20 75 6e 64 65 72 20 74 68 65 20 6e 61 6d | looks.in.the.table.under.the.nam |
| 6d1c0 | 65 20 6f 66 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 61 6e 64 20 74 68 65 20 74 79 70 65 73 | e.of.the.operation.and.the.types |
| 6d1e0 | 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 0a 61 6e 64 20 61 70 70 6c 69 65 73 20 74 68 | .of.the.arguments.and.applies.th |
| 6d200 | 65 20 72 65 73 75 6c 74 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 69 66 20 6f 6e 65 20 69 73 20 | e.resulting.procedure.if.one.is. |
| 6d220 | 70 72 65 73 65 6e 74 3a 28 33 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 70 6c 79 | present:(3).......(define.(apply |
| 6d240 | 2d 67 65 6e 65 72 69 63 20 6f 70 20 2e 20 61 72 67 73 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 | -generic.op...args)........(let. |
| 6d260 | 28 28 74 79 70 65 2d 74 61 67 73 20 28 6d 61 70 20 74 79 70 65 2d 74 61 67 20 61 72 67 73 29 29 | ((type-tags.(map.type-tag.args)) |
| 6d280 | 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 6f 63 20 28 67 65 74 20 6f 70 20 74 | )..........(let.((proc.(get.op.t |
| 6d2a0 | 79 70 65 2d 74 61 67 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 70 72 6f 63 0a | ype-tags)))............(if.proc. |
| 6d2c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 6c 79 20 70 72 6f 63 20 28 6d 61 70 20 | ...............(apply.proc.(map. |
| 6d2e0 | 63 6f 6e 74 65 6e 74 73 20 61 72 67 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | contents.args))................( |
| 6d300 | 65 72 72 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 4e 6f 20 6d 65 74 68 6f | error.................."No.metho |
| 6d320 | 64 20 66 6f 72 20 74 68 65 73 65 20 74 79 70 65 73 20 2d 2d 20 41 50 50 4c 59 2d 47 45 4e 45 52 | d.for.these.types.--.APPLY-GENER |
| 6d340 | 49 43 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 6f 70 20 74 79 | IC"..................(list.op.ty |
| 6d360 | 70 65 2d 74 61 67 73 29 29 29 29 29 29 0a 0a 20 20 20 55 73 69 6e 67 20 60 61 70 70 6c 79 2d 67 | pe-tags)))))).....Using.`apply-g |
| 6d380 | 65 6e 65 72 69 63 27 2c 20 77 65 20 63 61 6e 20 64 65 66 69 6e 65 20 6f 75 72 20 67 65 6e 65 72 | eneric',.we.can.define.our.gener |
| 6d3a0 | 69 63 20 73 65 6c 65 63 74 6f 72 73 20 61 73 0a 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 | ic.selectors.as.follows:.......( |
| 6d3c0 | 64 65 66 69 6e 65 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 29 20 28 61 70 70 6c 79 2d 67 65 6e 65 | define.(real-part.z).(apply-gene |
| 6d3e0 | 72 69 63 20 27 72 65 61 6c 2d 70 61 72 74 20 7a 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ric.'real-part.z))......(define. |
| 6d400 | 28 69 6d 61 67 2d 70 61 72 74 20 7a 29 20 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 27 69 6d | (imag-part.z).(apply-generic.'im |
| 6d420 | 61 67 2d 70 61 72 74 20 7a 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 67 6e 69 74 | ag-part.z))......(define.(magnit |
| 6d440 | 75 64 65 20 7a 29 20 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 27 6d 61 67 6e 69 74 75 64 65 | ude.z).(apply-generic.'magnitude |
| 6d460 | 20 7a 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 67 6c 65 20 7a 29 20 28 61 70 70 | .z))......(define.(angle.z).(app |
| 6d480 | 6c 79 2d 67 65 6e 65 72 69 63 20 27 61 6e 67 6c 65 20 7a 29 29 0a 0a 20 20 20 4f 62 73 65 72 76 | ly-generic.'angle.z)).....Observ |
| 6d4a0 | 65 20 74 68 61 74 20 74 68 65 73 65 20 64 6f 20 6e 6f 74 20 63 68 61 6e 67 65 20 61 74 20 61 6c | e.that.these.do.not.change.at.al |
| 6d4c0 | 6c 20 69 66 20 61 20 6e 65 77 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 0a 61 64 64 | l.if.a.new.representation.is.add |
| 6d4e0 | 65 64 20 74 6f 20 74 68 65 20 73 79 73 74 65 6d 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 61 6c 73 | ed.to.the.system......We.can.als |
| 6d500 | 6f 20 65 78 74 72 61 63 74 20 66 72 6f 6d 20 74 68 65 20 74 61 62 6c 65 20 74 68 65 20 63 6f 6e | o.extract.from.the.table.the.con |
| 6d520 | 73 74 72 75 63 74 6f 72 73 20 74 6f 20 62 65 20 75 73 65 64 20 62 79 0a 74 68 65 20 70 72 6f 67 | structors.to.be.used.by.the.prog |
| 6d540 | 72 61 6d 73 20 65 78 74 65 72 6e 61 6c 20 74 6f 20 74 68 65 20 70 61 63 6b 61 67 65 73 20 69 6e | rams.external.to.the.packages.in |
| 6d560 | 20 6d 61 6b 69 6e 67 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 66 72 6f 6d 0a 72 65 61 | .making.complex.numbers.from.rea |
| 6d580 | 6c 20 61 6e 64 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 73 20 61 6e 64 20 66 72 6f 6d 20 6d | l.and.imaginary.parts.and.from.m |
| 6d5a0 | 61 67 6e 69 74 75 64 65 73 20 61 6e 64 20 61 6e 67 6c 65 73 2e 20 20 41 73 20 69 6e 20 73 65 63 | agnitudes.and.angles...As.in.sec |
| 6d5c0 | 74 69 6f 6e 0a 2a 4e 6f 74 65 20 32 2d 34 2d 32 3a 3a 2c 20 77 65 20 63 6f 6e 73 74 72 75 63 74 | tion.*Note.2-4-2::,.we.construct |
| 6d5e0 | 20 72 65 63 74 61 6e 67 75 6c 61 72 20 6e 75 6d 62 65 72 73 20 77 68 65 6e 65 76 65 72 20 77 65 | .rectangular.numbers.whenever.we |
| 6d600 | 20 68 61 76 65 20 72 65 61 6c 0a 61 6e 64 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 73 2c 20 | .have.real.and.imaginary.parts,. |
| 6d620 | 61 6e 64 20 70 6f 6c 61 72 20 6e 75 6d 62 65 72 73 20 77 68 65 6e 65 76 65 72 20 77 65 20 68 61 | and.polar.numbers.whenever.we.ha |
| 6d640 | 76 65 20 6d 61 67 6e 69 74 75 64 65 73 20 61 6e 64 0a 61 6e 67 6c 65 73 3a 0a 0a 20 20 20 20 20 | ve.magnitudes.and.angles:....... |
| 6d660 | 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 | (define.(make-from-real-imag.x.y |
| 6d680 | 29 0a 20 20 20 20 20 20 20 28 28 67 65 74 20 27 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 | )........((get.'make-from-real-i |
| 6d6a0 | 6d 61 67 20 27 72 65 63 74 61 6e 67 75 6c 61 72 29 20 78 20 79 29 29 0a 0a 20 20 20 20 20 28 64 | mag.'rectangular).x.y)).......(d |
| 6d6c0 | 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 72 20 61 29 0a 20 20 | efine.(make-from-mag-ang.r.a)... |
| 6d6e0 | 20 20 20 20 20 28 28 67 65 74 20 27 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 27 70 | .....((get.'make-from-mag-ang.'p |
| 6d700 | 6f 6c 61 72 29 20 72 20 61 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 37 33 | olar).r.a)).......*Exercise.2.73 |
| 6d720 | 3a 2a 20 53 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 33 2d 32 3a 3a 20 64 65 73 63 72 69 62 | :*.Section.*Note.2-3-2::.describ |
| 6d740 | 65 64 20 61 20 70 72 6f 67 72 61 6d 20 74 68 61 74 0a 20 20 20 20 20 70 65 72 66 6f 72 6d 73 20 | ed.a.program.that......performs. |
| 6d760 | 73 79 6d 62 6f 6c 69 63 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 | symbolic.differentiation:....... |
| 6d780 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 72 69 76 20 65 78 70 20 76 61 72 29 0a 20 20 20 | .....(define.(deriv.exp.var).... |
| 6d7a0 | 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6d 62 65 72 3f 20 65 78 70 29 20 30 29 | .........(cond.((number?.exp).0) |
| 6d7c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 76 61 72 69 61 62 6c 65 3f 20 65 | ...................((variable?.e |
| 6d7e0 | 78 70 29 20 28 69 66 20 28 73 61 6d 65 2d 76 61 72 69 61 62 6c 65 3f 20 65 78 70 20 76 61 72 29 | xp).(if.(same-variable?.exp.var) |
| 6d800 | 20 31 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 73 75 6d 3f 20 | .1.0))...................((sum?. |
| 6d820 | 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 73 75 | exp)....................(make-su |
| 6d840 | 6d 20 28 64 65 72 69 76 20 28 61 64 64 65 6e 64 20 65 78 70 29 20 76 61 72 29 0a 20 20 20 20 20 | m.(deriv.(addend.exp).var)...... |
| 6d860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 72 69 76 20 28 | ........................(deriv.( |
| 6d880 | 61 75 67 65 6e 64 20 65 78 70 29 20 76 61 72 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | augend.exp).var))).............. |
| 6d8a0 | 20 20 20 20 20 28 28 70 72 6f 64 75 63 74 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .....((product?.exp)............ |
| 6d8c0 | 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 73 75 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........(make-sum............... |
| 6d8e0 | 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 70 72 6f 64 75 63 74 20 28 6d 75 6c 74 69 70 6c 69 65 72 | .......(make-product.(multiplier |
| 6d900 | 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .exp)........................... |
| 6d920 | 20 20 20 20 20 20 20 20 20 28 64 65 72 69 76 20 28 6d 75 6c 74 69 70 6c 69 63 61 6e 64 20 65 78 | .........(deriv.(multiplicand.ex |
| 6d940 | 70 29 20 76 61 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d | p).var))......................(m |
| 6d960 | 61 6b 65 2d 70 72 6f 64 75 63 74 20 28 64 65 72 69 76 20 28 6d 75 6c 74 69 70 6c 69 65 72 20 65 | ake-product.(deriv.(multiplier.e |
| 6d980 | 78 70 29 20 76 61 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | xp).var)........................ |
| 6d9a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 75 6c 74 69 70 6c 69 63 61 6e 64 20 65 78 70 29 29 29 | ............(multiplicand.exp))) |
| 6d9c0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 4d 4f 52 45 20 52 55 4c 45 53 20 | )...................<MORE.RULES. |
| 6d9e0 | 43 41 4e 20 42 45 20 41 44 44 45 44 20 48 45 52 45 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | CAN.BE.ADDED.HERE>.............. |
| 6da00 | 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 75 6e 6b 6e 6f 77 6e 20 65 78 70 72 65 | .....(else.(error."unknown.expre |
| 6da20 | 73 73 69 6f 6e 20 74 79 70 65 20 2d 2d 20 44 45 52 49 56 22 20 65 78 70 29 29 29 29 0a 0a 20 20 | ssion.type.--.DERIV".exp)))).... |
| 6da40 | 20 20 20 57 65 20 63 61 6e 20 72 65 67 61 72 64 20 74 68 69 73 20 70 72 6f 67 72 61 6d 20 61 73 | ...We.can.regard.this.program.as |
| 6da60 | 20 70 65 72 66 6f 72 6d 69 6e 67 20 61 20 64 69 73 70 61 74 63 68 20 6f 6e 20 74 68 65 20 74 79 | .performing.a.dispatch.on.the.ty |
| 6da80 | 70 65 20 6f 66 0a 20 20 20 20 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 62 65 20 | pe.of......the.expression.to.be. |
| 6daa0 | 64 69 66 66 65 72 65 6e 74 69 61 74 65 64 2e 20 20 49 6e 20 74 68 69 73 20 73 69 74 75 61 74 69 | differentiated...In.this.situati |
| 6dac0 | 6f 6e 20 74 68 65 20 22 74 79 70 65 0a 20 20 20 20 20 74 61 67 22 20 6f 66 20 74 68 65 20 64 61 | on.the."type......tag".of.the.da |
| 6dae0 | 74 75 6d 20 69 73 20 74 68 65 20 61 6c 67 65 62 72 61 69 63 20 6f 70 65 72 61 74 6f 72 20 73 79 | tum.is.the.algebraic.operator.sy |
| 6db00 | 6d 62 6f 6c 20 28 73 75 63 68 20 61 73 20 60 2b 27 29 0a 20 20 20 20 20 61 6e 64 20 74 68 65 20 | mbol.(such.as.`+')......and.the. |
| 6db20 | 6f 70 65 72 61 74 69 6f 6e 20 62 65 69 6e 67 20 70 65 72 66 6f 72 6d 65 64 20 69 73 20 60 64 65 | operation.being.performed.is.`de |
| 6db40 | 72 69 76 27 2e 20 20 57 65 20 63 61 6e 20 74 72 61 6e 73 66 6f 72 6d 0a 20 20 20 20 20 74 68 69 | riv'...We.can.transform......thi |
| 6db60 | 73 20 70 72 6f 67 72 61 6d 20 69 6e 74 6f 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 73 74 79 | s.program.into.data-directed.sty |
| 6db80 | 6c 65 20 62 79 20 72 65 77 72 69 74 69 6e 67 20 74 68 65 20 62 61 73 69 63 0a 20 20 20 20 20 64 | le.by.rewriting.the.basic......d |
| 6dba0 | 65 72 69 76 61 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 61 73 0a 0a 20 20 20 20 20 20 20 20 | erivative.procedure.as.......... |
| 6dbc0 | 20 20 28 64 65 66 69 6e 65 20 28 64 65 72 69 76 20 65 78 70 20 76 61 72 29 0a 20 20 20 20 20 20 | ..(define.(deriv.exp.var)....... |
| 6dbe0 | 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6d 62 65 72 3f 20 65 78 70 29 20 30 29 0a 20 | .......(cond.((number?.exp).0).. |
| 6dc00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 76 61 72 69 61 62 6c 65 3f 20 65 78 | ..................((variable?.ex |
| 6dc20 | 70 29 20 28 69 66 20 28 73 61 6d 65 2d 76 61 72 69 61 62 6c 65 3f 20 65 78 70 20 76 61 72 29 20 | p).(if.(same-variable?.exp.var). |
| 6dc40 | 31 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 | 1.0))....................(else.( |
| 6dc60 | 28 67 65 74 20 27 64 65 72 69 76 20 28 6f 70 65 72 61 74 6f 72 20 65 78 70 29 29 20 28 6f 70 65 | (get.'deriv.(operator.exp)).(ope |
| 6dc80 | 72 61 6e 64 73 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rands.exp)...................... |
| 6dca0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 6dcc0 | 20 76 61 72 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6f 70 65 | .var))))............(define.(ope |
| 6dce0 | 72 61 74 6f 72 20 65 78 70 29 20 28 63 61 72 20 65 78 70 29 29 0a 0a 20 20 20 20 20 20 20 20 20 | rator.exp).(car.exp))........... |
| 6dd00 | 20 28 64 65 66 69 6e 65 20 28 6f 70 65 72 61 6e 64 73 20 65 78 70 29 20 28 63 64 72 20 65 78 70 | .(define.(operands.exp).(cdr.exp |
| 6dd20 | 29 29 0a 0a 20 20 20 20 20 20 20 61 2e 20 45 78 70 6c 61 69 6e 20 77 68 61 74 20 77 61 73 20 64 | )).........a..Explain.what.was.d |
| 6dd40 | 6f 6e 65 20 61 62 6f 76 65 2e 20 20 57 68 79 20 63 61 6e 27 74 20 77 65 20 61 73 73 69 6d 69 6c | one.above...Why.can't.we.assimil |
| 6dd60 | 61 74 65 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 70 72 65 64 69 63 61 74 65 73 20 60 6e 75 | ate.the...........predicates.`nu |
| 6dd80 | 6d 62 65 72 3f 27 20 61 6e 64 20 60 73 61 6d 65 2d 76 61 72 69 61 62 6c 65 3f 27 20 69 6e 74 6f | mber?'.and.`same-variable?'.into |
| 6dda0 | 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 64 69 73 | .the...........data-directed.dis |
| 6ddc0 | 70 61 74 63 68 3f 0a 0a 20 20 20 20 20 20 20 62 2e 20 57 72 69 74 65 20 74 68 65 20 70 72 6f 63 | patch?.........b..Write.the.proc |
| 6dde0 | 65 64 75 72 65 73 20 66 6f 72 20 64 65 72 69 76 61 74 69 76 65 73 20 6f 66 20 73 75 6d 73 20 61 | edures.for.derivatives.of.sums.a |
| 6de00 | 6e 64 20 70 72 6f 64 75 63 74 73 2c 0a 20 20 20 20 20 20 20 20 20 20 61 6e 64 20 74 68 65 20 61 | nd.products,...........and.the.a |
| 6de20 | 75 78 69 6c 69 61 72 79 20 63 6f 64 65 20 72 65 71 75 69 72 65 64 20 74 6f 20 69 6e 73 74 61 6c | uxiliary.code.required.to.instal |
| 6de40 | 6c 20 74 68 65 6d 20 69 6e 20 74 68 65 20 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 75 73 | l.them.in.the.table...........us |
| 6de60 | 65 64 20 62 79 20 74 68 65 20 70 72 6f 67 72 61 6d 20 61 62 6f 76 65 2e 0a 0a 20 20 20 20 20 20 | ed.by.the.program.above......... |
| 6de80 | 20 63 2e 20 43 68 6f 6f 73 65 20 61 6e 79 20 61 64 64 69 74 69 6f 6e 61 6c 20 64 69 66 66 65 72 | .c..Choose.any.additional.differ |
| 6dea0 | 65 6e 74 69 61 74 69 6f 6e 20 72 75 6c 65 20 74 68 61 74 20 79 6f 75 20 6c 69 6b 65 2c 0a 20 20 | entiation.rule.that.you.like,... |
| 6dec0 | 20 20 20 20 20 20 20 20 73 75 63 68 20 61 73 20 74 68 65 20 6f 6e 65 20 66 6f 72 20 65 78 70 6f | ........such.as.the.one.for.expo |
| 6dee0 | 6e 65 6e 74 73 20 28 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 35 36 3a 3a 29 2c 20 61 | nents.(*Note.Exercise.2-56::),.a |
| 6df00 | 6e 64 0a 20 20 20 20 20 20 20 20 20 20 69 6e 73 74 61 6c 6c 20 69 74 20 69 6e 20 74 68 69 73 20 | nd...........install.it.in.this. |
| 6df20 | 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 73 79 73 74 65 6d 2e 0a 0a 20 20 20 20 20 20 20 64 2e | data-directed.system..........d. |
| 6df40 | 20 49 6e 20 74 68 69 73 20 73 69 6d 70 6c 65 20 61 6c 67 65 62 72 61 69 63 20 6d 61 6e 69 70 75 | .In.this.simple.algebraic.manipu |
| 6df60 | 6c 61 74 6f 72 20 74 68 65 20 74 79 70 65 20 6f 66 20 61 6e 0a 20 20 20 20 20 20 20 20 20 20 65 | lator.the.type.of.an...........e |
| 6df80 | 78 70 72 65 73 73 69 6f 6e 20 69 73 20 74 68 65 20 61 6c 67 65 62 72 61 69 63 20 6f 70 65 72 61 | xpression.is.the.algebraic.opera |
| 6dfa0 | 74 6f 72 20 74 68 61 74 20 62 69 6e 64 73 20 69 74 20 74 6f 67 65 74 68 65 72 2e 0a 20 20 20 20 | tor.that.binds.it.together...... |
| 6dfc0 | 20 20 20 20 20 20 53 75 70 70 6f 73 65 2c 20 68 6f 77 65 76 65 72 2c 20 77 65 20 69 6e 64 65 78 | ......Suppose,.however,.we.index |
| 6dfe0 | 65 64 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 65 20 6f 70 70 6f 73 69 74 | ed.the.procedures.in.the.opposit |
| 6e000 | 65 0a 20 20 20 20 20 20 20 20 20 20 77 61 79 2c 20 73 6f 20 74 68 61 74 20 74 68 65 20 64 69 73 | e...........way,.so.that.the.dis |
| 6e020 | 70 61 74 63 68 20 6c 69 6e 65 20 69 6e 20 60 64 65 72 69 76 27 20 6c 6f 6f 6b 65 64 20 6c 69 6b | patch.line.in.`deriv'.looked.lik |
| 6e040 | 65 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 67 65 74 20 28 6f 70 65 72 61 74 6f | e.................((get.(operato |
| 6e060 | 72 20 65 78 70 29 20 27 64 65 72 69 76 29 20 28 6f 70 65 72 61 6e 64 73 20 65 78 70 29 20 76 61 | r.exp).'deriv).(operands.exp).va |
| 6e080 | 72 29 0a 0a 20 20 20 20 20 20 20 20 20 20 57 68 61 74 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 | r)............What.corresponding |
| 6e0a0 | 20 63 68 61 6e 67 65 73 20 74 6f 20 74 68 65 20 64 65 72 69 76 61 74 69 76 65 20 73 79 73 74 65 | .changes.to.the.derivative.syste |
| 6e0c0 | 6d 20 61 72 65 0a 20 20 20 20 20 20 20 20 20 20 72 65 71 75 69 72 65 64 3f 0a 0a 0a 20 20 20 20 | m.are...........required?....... |
| 6e0e0 | 20 2a 45 78 65 72 63 69 73 65 20 32 2e 37 34 3a 2a 20 49 6e 73 61 74 69 61 62 6c 65 20 45 6e 74 | .*Exercise.2.74:*.Insatiable.Ent |
| 6e100 | 65 72 70 72 69 73 65 73 2c 20 49 6e 63 2e 2c 20 69 73 20 61 20 68 69 67 68 6c 79 0a 20 20 20 20 | erprises,.Inc.,.is.a.highly..... |
| 6e120 | 20 64 65 63 65 6e 74 72 61 6c 69 7a 65 64 20 63 6f 6e 67 6c 6f 6d 65 72 61 74 65 20 63 6f 6d 70 | .decentralized.conglomerate.comp |
| 6e140 | 61 6e 79 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 61 20 6c 61 72 67 65 20 6e 75 6d 62 65 72 | any.consisting.of.a.large.number |
| 6e160 | 20 6f 66 0a 20 20 20 20 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 64 69 76 69 73 69 6f 6e 73 20 6c | .of......independent.divisions.l |
| 6e180 | 6f 63 61 74 65 64 20 61 6c 6c 20 6f 76 65 72 20 74 68 65 20 77 6f 72 6c 64 2e 20 20 54 68 65 20 | ocated.all.over.the.world...The. |
| 6e1a0 | 63 6f 6d 70 61 6e 79 27 73 0a 20 20 20 20 20 63 6f 6d 70 75 74 65 72 20 66 61 63 69 6c 69 74 69 | company's......computer.faciliti |
| 6e1c0 | 65 73 20 68 61 76 65 20 6a 75 73 74 20 62 65 65 6e 20 69 6e 74 65 72 63 6f 6e 6e 65 63 74 65 64 | es.have.just.been.interconnected |
| 6e1e0 | 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 61 0a 20 20 20 20 20 63 6c 65 76 65 72 20 6e 65 74 77 6f | .by.means.of.a......clever.netwo |
| 6e200 | 72 6b 2d 69 6e 74 65 72 66 61 63 69 6e 67 20 73 63 68 65 6d 65 20 74 68 61 74 20 6d 61 6b 65 73 | rk-interfacing.scheme.that.makes |
| 6e220 | 20 74 68 65 20 65 6e 74 69 72 65 20 6e 65 74 77 6f 72 6b 0a 20 20 20 20 20 61 70 70 65 61 72 20 | .the.entire.network......appear. |
| 6e240 | 74 6f 20 61 6e 79 20 75 73 65 72 20 74 6f 20 62 65 20 61 20 73 69 6e 67 6c 65 20 63 6f 6d 70 75 | to.any.user.to.be.a.single.compu |
| 6e260 | 74 65 72 2e 20 20 49 6e 73 61 74 69 61 62 6c 65 27 73 0a 20 20 20 20 20 70 72 65 73 69 64 65 6e | ter...Insatiable's......presiden |
| 6e280 | 74 2c 20 69 6e 20 68 65 72 20 66 69 72 73 74 20 61 74 74 65 6d 70 74 20 74 6f 20 65 78 70 6c 6f | t,.in.her.first.attempt.to.explo |
| 6e2a0 | 69 74 20 74 68 65 20 61 62 69 6c 69 74 79 20 6f 66 20 74 68 65 0a 20 20 20 20 20 6e 65 74 77 6f | it.the.ability.of.the......netwo |
| 6e2c0 | 72 6b 20 74 6f 20 65 78 74 72 61 63 74 20 61 64 6d 69 6e 69 73 74 72 61 74 69 76 65 20 69 6e 66 | rk.to.extract.administrative.inf |
| 6e2e0 | 6f 72 6d 61 74 69 6f 6e 20 66 72 6f 6d 20 64 69 76 69 73 69 6f 6e 20 66 69 6c 65 73 2c 0a 20 20 | ormation.from.division.files,... |
| 6e300 | 20 20 20 69 73 20 64 69 73 6d 61 79 65 64 20 74 6f 20 64 69 73 63 6f 76 65 72 20 74 68 61 74 2c | ...is.dismayed.to.discover.that, |
| 6e320 | 20 61 6c 74 68 6f 75 67 68 20 61 6c 6c 20 74 68 65 20 64 69 76 69 73 69 6f 6e 20 66 69 6c 65 73 | .although.all.the.division.files |
| 6e340 | 20 68 61 76 65 0a 20 20 20 20 20 62 65 65 6e 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 64 | .have......been.implemented.as.d |
| 6e360 | 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 69 6e 20 53 63 68 65 6d 65 2c 20 74 68 65 20 70 61 | ata.structures.in.Scheme,.the.pa |
| 6e380 | 72 74 69 63 75 6c 61 72 20 64 61 74 61 0a 20 20 20 20 20 73 74 72 75 63 74 75 72 65 20 75 73 65 | rticular.data......structure.use |
| 6e3a0 | 64 20 76 61 72 69 65 73 20 66 72 6f 6d 20 64 69 76 69 73 69 6f 6e 20 74 6f 20 64 69 76 69 73 69 | d.varies.from.division.to.divisi |
| 6e3c0 | 6f 6e 2e 20 20 41 20 6d 65 65 74 69 6e 67 20 6f 66 0a 20 20 20 20 20 64 69 76 69 73 69 6f 6e 20 | on...A.meeting.of......division. |
| 6e3e0 | 6d 61 6e 61 67 65 72 73 20 69 73 20 68 61 73 74 69 6c 79 20 63 61 6c 6c 65 64 20 74 6f 20 73 65 | managers.is.hastily.called.to.se |
| 6e400 | 61 72 63 68 20 66 6f 72 20 61 20 73 74 72 61 74 65 67 79 20 74 6f 0a 20 20 20 20 20 69 6e 74 65 | arch.for.a.strategy.to......inte |
| 6e420 | 67 72 61 74 65 20 74 68 65 20 66 69 6c 65 73 20 74 68 61 74 20 77 69 6c 6c 20 73 61 74 69 73 66 | grate.the.files.that.will.satisf |
| 6e440 | 79 20 68 65 61 64 71 75 61 72 74 65 72 73 27 20 6e 65 65 64 73 20 77 68 69 6c 65 0a 20 20 20 20 | y.headquarters'.needs.while..... |
| 6e460 | 20 70 72 65 73 65 72 76 69 6e 67 20 74 68 65 20 65 78 69 73 74 69 6e 67 20 61 75 74 6f 6e 6f 6d | .preserving.the.existing.autonom |
| 6e480 | 79 20 6f 66 20 74 68 65 20 64 69 76 69 73 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 53 68 6f 77 20 68 | y.of.the.divisions........Show.h |
| 6e4a0 | 6f 77 20 73 75 63 68 20 61 20 73 74 72 61 74 65 67 79 20 63 61 6e 20 62 65 20 69 6d 70 6c 65 6d | ow.such.a.strategy.can.be.implem |
| 6e4c0 | 65 6e 74 65 64 20 77 69 74 68 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 0a 20 20 20 20 20 70 72 | ented.with.data-directed......pr |
| 6e4e0 | 6f 67 72 61 6d 6d 69 6e 67 2e 20 20 41 73 20 61 6e 20 65 78 61 6d 70 6c 65 2c 20 73 75 70 70 6f | ogramming...As.an.example,.suppo |
| 6e500 | 73 65 20 74 68 61 74 20 65 61 63 68 20 64 69 76 69 73 69 6f 6e 27 73 0a 20 20 20 20 20 70 65 72 | se.that.each.division's......per |
| 6e520 | 73 6f 6e 6e 65 6c 20 72 65 63 6f 72 64 73 20 63 6f 6e 73 69 73 74 20 6f 66 20 61 20 73 69 6e 67 | sonnel.records.consist.of.a.sing |
| 6e540 | 6c 65 20 66 69 6c 65 2c 20 77 68 69 63 68 20 63 6f 6e 74 61 69 6e 73 20 61 20 73 65 74 0a 20 20 | le.file,.which.contains.a.set... |
| 6e560 | 20 20 20 6f 66 20 72 65 63 6f 72 64 73 20 6b 65 79 65 64 20 6f 6e 20 65 6d 70 6c 6f 79 65 65 73 | ...of.records.keyed.on.employees |
| 6e580 | 27 20 6e 61 6d 65 73 2e 20 20 54 68 65 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 73 | '.names...The.structure.of.the.s |
| 6e5a0 | 65 74 0a 20 20 20 20 20 76 61 72 69 65 73 20 66 72 6f 6d 20 64 69 76 69 73 69 6f 6e 20 74 6f 20 | et......varies.from.division.to. |
| 6e5c0 | 64 69 76 69 73 69 6f 6e 2e 20 20 46 75 72 74 68 65 72 6d 6f 72 65 2c 20 65 61 63 68 20 65 6d 70 | division...Furthermore,.each.emp |
| 6e5e0 | 6c 6f 79 65 65 27 73 0a 20 20 20 20 20 72 65 63 6f 72 64 20 69 73 20 69 74 73 65 6c 66 20 61 20 | loyee's......record.is.itself.a. |
| 6e600 | 73 65 74 20 28 73 74 72 75 63 74 75 72 65 64 20 64 69 66 66 65 72 65 6e 74 6c 79 20 66 72 6f 6d | set.(structured.differently.from |
| 6e620 | 20 64 69 76 69 73 69 6f 6e 20 74 6f 0a 20 20 20 20 20 64 69 76 69 73 69 6f 6e 29 20 74 68 61 74 | .division.to......division).that |
| 6e640 | 20 63 6f 6e 74 61 69 6e 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6b 65 79 65 64 20 75 6e 64 65 | .contains.information.keyed.unde |
| 6e660 | 72 20 69 64 65 6e 74 69 66 69 65 72 73 20 73 75 63 68 0a 20 20 20 20 20 61 73 20 60 61 64 64 72 | r.identifiers.such......as.`addr |
| 6e680 | 65 73 73 27 20 61 6e 64 20 60 73 61 6c 61 72 79 27 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 | ess'.and.`salary'...In.particula |
| 6e6a0 | 72 3a 0a 0a 20 20 20 20 20 20 20 61 2e 20 49 6d 70 6c 65 6d 65 6e 74 20 66 6f 72 20 68 65 61 64 | r:.........a..Implement.for.head |
| 6e6c0 | 71 75 61 72 74 65 72 73 20 61 20 60 67 65 74 2d 72 65 63 6f 72 64 27 20 70 72 6f 63 65 64 75 72 | quarters.a.`get-record'.procedur |
| 6e6e0 | 65 20 74 68 61 74 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 72 69 65 76 65 73 20 61 20 73 70 65 | e.that...........retrieves.a.spe |
| 6e700 | 63 69 66 69 65 64 20 65 6d 70 6c 6f 79 65 65 27 73 20 72 65 63 6f 72 64 20 66 72 6f 6d 20 61 20 | cified.employee's.record.from.a. |
| 6e720 | 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 20 20 20 20 20 20 70 65 72 73 6f 6e 6e 65 6c 20 66 69 | specified...........personnel.fi |
| 6e740 | 6c 65 2e 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 62 65 20 61 70 70 | le...The.procedure.should.be.app |
| 6e760 | 6c 69 63 61 62 6c 65 20 74 6f 20 61 6e 79 0a 20 20 20 20 20 20 20 20 20 20 64 69 76 69 73 69 6f | licable.to.any...........divisio |
| 6e780 | 6e 27 73 20 66 69 6c 65 2e 20 20 45 78 70 6c 61 69 6e 20 68 6f 77 20 74 68 65 20 69 6e 64 69 76 | n's.file...Explain.how.the.indiv |
| 6e7a0 | 69 64 75 61 6c 20 64 69 76 69 73 69 6f 6e 73 27 20 66 69 6c 65 73 0a 20 20 20 20 20 20 20 20 20 | idual.divisions'.files.......... |
| 6e7c0 | 20 73 68 6f 75 6c 64 20 62 65 20 73 74 72 75 63 74 75 72 65 64 2e 20 20 49 6e 20 70 61 72 74 69 | .should.be.structured...In.parti |
| 6e7e0 | 63 75 6c 61 72 2c 20 77 68 61 74 20 74 79 70 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 20 20 20 | cular,.what.type.information.... |
| 6e800 | 20 20 20 20 20 20 20 6d 75 73 74 20 62 65 20 73 75 70 70 6c 69 65 64 3f 0a 0a 20 20 20 20 20 20 | .......must.be.supplied?........ |
| 6e820 | 20 62 2e 20 49 6d 70 6c 65 6d 65 6e 74 20 66 6f 72 20 68 65 61 64 71 75 61 72 74 65 72 73 20 61 | .b..Implement.for.headquarters.a |
| 6e840 | 20 60 67 65 74 2d 73 61 6c 61 72 79 27 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 20 20 20 | .`get-salary'.procedure.that.... |
| 6e860 | 20 20 20 20 20 20 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 61 6c 61 72 79 20 69 6e 66 6f 72 6d | .......returns.the.salary.inform |
| 6e880 | 61 74 69 6f 6e 20 66 72 6f 6d 20 61 20 67 69 76 65 6e 20 65 6d 70 6c 6f 79 65 65 27 73 20 72 65 | ation.from.a.given.employee's.re |
| 6e8a0 | 63 6f 72 64 0a 20 20 20 20 20 20 20 20 20 20 66 72 6f 6d 20 61 6e 79 20 64 69 76 69 73 69 6f 6e | cord...........from.any.division |
| 6e8c0 | 27 73 20 70 65 72 73 6f 6e 6e 65 6c 20 66 69 6c 65 2e 20 20 48 6f 77 20 73 68 6f 75 6c 64 20 74 | 's.personnel.file...How.should.t |
| 6e8e0 | 68 65 20 72 65 63 6f 72 64 20 62 65 0a 20 20 20 20 20 20 20 20 20 20 73 74 72 75 63 74 75 72 65 | he.record.be...........structure |
| 6e900 | 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 6d 61 6b 65 20 74 68 69 73 20 6f 70 65 72 61 74 69 6f | d.in.order.to.make.this.operatio |
| 6e920 | 6e 20 77 6f 72 6b 3f 0a 0a 20 20 20 20 20 20 20 63 2e 20 49 6d 70 6c 65 6d 65 6e 74 20 66 6f 72 | n.work?.........c..Implement.for |
| 6e940 | 20 68 65 61 64 71 75 61 72 74 65 72 73 20 61 20 60 66 69 6e 64 2d 65 6d 70 6c 6f 79 65 65 2d 72 | .headquarters.a.`find-employee-r |
| 6e960 | 65 63 6f 72 64 27 0a 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 69 | ecord'...........procedure...Thi |
| 6e980 | 73 20 73 68 6f 75 6c 64 20 73 65 61 72 63 68 20 61 6c 6c 20 74 68 65 20 64 69 76 69 73 69 6f 6e | s.should.search.all.the.division |
| 6e9a0 | 73 27 20 66 69 6c 65 73 20 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 20 72 65 63 6f 72 | s'.files.for...........the.recor |
| 6e9c0 | 64 20 6f 66 20 61 20 67 69 76 65 6e 20 65 6d 70 6c 6f 79 65 65 20 61 6e 64 20 72 65 74 75 72 6e | d.of.a.given.employee.and.return |
| 6e9e0 | 20 74 68 65 20 72 65 63 6f 72 64 2e 20 20 41 73 73 75 6d 65 0a 20 20 20 20 20 20 20 20 20 20 74 | .the.record...Assume...........t |
| 6ea00 | 68 61 74 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 | hat.this.procedure.takes.as.argu |
| 6ea20 | 6d 65 6e 74 73 20 61 6e 20 65 6d 70 6c 6f 79 65 65 27 73 20 6e 61 6d 65 20 61 6e 64 0a 20 20 20 | ments.an.employee's.name.and.... |
| 6ea40 | 20 20 20 20 20 20 20 61 20 6c 69 73 74 20 6f 66 20 61 6c 6c 20 74 68 65 20 64 69 76 69 73 69 6f | .......a.list.of.all.the.divisio |
| 6ea60 | 6e 73 27 20 66 69 6c 65 73 2e 0a 0a 20 20 20 20 20 20 20 64 2e 20 57 68 65 6e 20 49 6e 73 61 74 | ns'.files..........d..When.Insat |
| 6ea80 | 69 61 62 6c 65 20 74 61 6b 65 73 20 6f 76 65 72 20 61 20 6e 65 77 20 63 6f 6d 70 61 6e 79 2c 20 | iable.takes.over.a.new.company,. |
| 6eaa0 | 77 68 61 74 20 63 68 61 6e 67 65 73 20 6d 75 73 74 0a 20 20 20 20 20 20 20 20 20 20 62 65 20 6d | what.changes.must...........be.m |
| 6eac0 | 61 64 65 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 69 6e 63 6f 72 70 6f 72 61 74 65 20 74 68 65 20 | ade.in.order.to.incorporate.the. |
| 6eae0 | 6e 65 77 20 70 65 72 73 6f 6e 6e 65 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 20 20 20 20 20 20 | new.personnel.information....... |
| 6eb00 | 20 20 20 20 69 6e 74 6f 20 74 68 65 20 63 65 6e 74 72 61 6c 20 73 79 73 74 65 6d 3f 0a 0a 0a 4d | ....into.the.central.system?...M |
| 6eb20 | 65 73 73 61 67 65 20 70 61 73 73 69 6e 67 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | essage.passing.................. |
| 6eb40 | 54 68 65 20 6b 65 79 20 69 64 65 61 20 6f 66 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 70 72 | The.key.idea.of.data-directed.pr |
| 6eb60 | 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 74 6f 20 68 61 6e 64 6c 65 20 67 65 6e 65 72 69 63 0a 6f | ogramming.is.to.handle.generic.o |
| 6eb80 | 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 70 72 6f 67 72 61 6d 73 20 62 79 20 64 65 61 6c 69 6e 67 | perations.in.programs.by.dealing |
| 6eba0 | 20 65 78 70 6c 69 63 69 74 6c 79 20 77 69 74 68 20 6f 70 65 72 61 74 69 6f 6e 2d 61 6e 64 2d 74 | .explicitly.with.operation-and-t |
| 6ebc0 | 79 70 65 0a 74 61 62 6c 65 73 2c 20 73 75 63 68 20 61 73 20 74 68 65 20 74 61 62 6c 65 20 69 6e | ype.tables,.such.as.the.table.in |
| 6ebe0 | 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 32 32 3a 3a 2e 20 20 54 68 65 20 73 74 79 6c 65 | .*Note.Figure.2-22::...The.style |
| 6ec00 | 20 6f 66 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 77 65 20 75 73 65 64 20 69 6e 20 73 65 63 74 69 | .of.programming.we.used.in.secti |
| 6ec20 | 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 32 3a 3a 20 6f 72 67 61 6e 69 7a 65 64 20 74 68 65 20 72 | on.*Note.2-4-2::.organized.the.r |
| 6ec40 | 65 71 75 69 72 65 64 0a 64 69 73 70 61 74 63 68 69 6e 67 20 6f 6e 20 74 79 70 65 20 62 79 20 68 | equired.dispatching.on.type.by.h |
| 6ec60 | 61 76 69 6e 67 20 65 61 63 68 20 6f 70 65 72 61 74 69 6f 6e 20 74 61 6b 65 20 63 61 72 65 20 6f | aving.each.operation.take.care.o |
| 6ec80 | 66 20 69 74 73 20 6f 77 6e 0a 64 69 73 70 61 74 63 68 69 6e 67 2e 20 20 49 6e 20 65 66 66 65 63 | f.its.own.dispatching...In.effec |
| 6eca0 | 74 2c 20 74 68 69 73 20 64 65 63 6f 6d 70 6f 73 65 73 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e | t,.this.decomposes.the.operation |
| 6ecc0 | 2d 61 6e 64 2d 74 79 70 65 20 74 61 62 6c 65 0a 69 6e 74 6f 20 72 6f 77 73 2c 20 77 69 74 68 20 | -and-type.table.into.rows,.with. |
| 6ece0 | 65 61 63 68 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 | each.generic.operation.procedure |
| 6ed00 | 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 20 72 6f 77 20 6f 66 0a 74 68 65 20 74 61 62 6c 65 | .representing.a.row.of.the.table |
| 6ed20 | 2e 0a 0a 20 20 20 41 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 | ......An.alternative.implementat |
| 6ed40 | 69 6f 6e 20 73 74 72 61 74 65 67 79 20 69 73 20 74 6f 20 64 65 63 6f 6d 70 6f 73 65 20 74 68 65 | ion.strategy.is.to.decompose.the |
| 6ed60 | 20 74 61 62 6c 65 0a 69 6e 74 6f 20 63 6f 6c 75 6d 6e 73 20 61 6e 64 2c 20 69 6e 73 74 65 61 64 | .table.into.columns.and,.instead |
| 6ed80 | 20 6f 66 20 75 73 69 6e 67 20 22 69 6e 74 65 6c 6c 69 67 65 6e 74 20 6f 70 65 72 61 74 69 6f 6e | .of.using."intelligent.operation |
| 6eda0 | 73 22 20 74 68 61 74 0a 64 69 73 70 61 74 63 68 20 6f 6e 20 64 61 74 61 20 74 79 70 65 73 2c 20 | s".that.dispatch.on.data.types,. |
| 6edc0 | 74 6f 20 77 6f 72 6b 20 77 69 74 68 20 22 69 6e 74 65 6c 6c 69 67 65 6e 74 20 64 61 74 61 20 6f | to.work.with."intelligent.data.o |
| 6ede0 | 62 6a 65 63 74 73 22 20 74 68 61 74 0a 64 69 73 70 61 74 63 68 20 6f 6e 20 6f 70 65 72 61 74 69 | bjects".that.dispatch.on.operati |
| 6ee00 | 6f 6e 20 6e 61 6d 65 73 2e 20 20 57 65 20 63 61 6e 20 64 6f 20 74 68 69 73 20 62 79 20 61 72 72 | on.names...We.can.do.this.by.arr |
| 6ee20 | 61 6e 67 69 6e 67 20 74 68 69 6e 67 73 20 73 6f 0a 74 68 61 74 20 61 20 64 61 74 61 20 6f 62 6a | anging.things.so.that.a.data.obj |
| 6ee40 | 65 63 74 2c 20 73 75 63 68 20 61 73 20 61 20 72 65 63 74 61 6e 67 75 6c 61 72 20 6e 75 6d 62 65 | ect,.such.as.a.rectangular.numbe |
| 6ee60 | 72 2c 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 0a 70 72 6f 63 65 64 75 72 65 | r,.is.represented.as.a.procedure |
| 6ee80 | 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 20 74 68 65 20 72 65 71 75 69 72 65 | .that.takes.as.input.the.require |
| 6eea0 | 64 20 6f 70 65 72 61 74 69 6f 6e 20 6e 61 6d 65 20 61 6e 64 20 70 65 72 66 6f 72 6d 73 0a 74 68 | d.operation.name.and.performs.th |
| 6eec0 | 65 20 6f 70 65 72 61 74 69 6f 6e 20 69 6e 64 69 63 61 74 65 64 2e 20 20 49 6e 20 73 75 63 68 20 | e.operation.indicated...In.such. |
| 6eee0 | 61 20 64 69 73 63 69 70 6c 69 6e 65 2c 20 60 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d | a.discipline,.`make-from-real-im |
| 6ef00 | 61 67 27 0a 63 6f 75 6c 64 20 62 65 20 77 72 69 74 74 65 6e 20 61 73 0a 0a 20 20 20 20 20 28 64 | ag'.could.be.written.as.......(d |
| 6ef20 | 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 29 0a | efine.(make-from-real-imag.x.y). |
| 6ef40 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6f 70 29 0a 20 20 20 | .......(define.(dispatch.op).... |
| 6ef60 | 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6f 70 20 27 72 65 61 6c 2d 70 61 72 74 29 | ......(cond.((eq?.op.'real-part) |
| 6ef80 | 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6f 70 20 27 69 6d 61 | .x)................((eq?.op.'ima |
| 6efa0 | 67 2d 70 61 72 74 29 20 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 | g-part).y)................((eq?. |
| 6efc0 | 6f 70 20 27 6d 61 67 6e 69 74 75 64 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | op.'magnitude).................( |
| 6efe0 | 73 71 72 74 20 28 2b 20 28 73 71 75 61 72 65 20 78 29 20 28 73 71 75 61 72 65 20 79 29 29 29 29 | sqrt.(+.(square.x).(square.y)))) |
| 6f000 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6f 70 20 27 61 6e 67 6c 65 29 | ................((eq?.op.'angle) |
| 6f020 | 20 28 61 74 61 6e 20 79 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 | .(atan.y.x))................(els |
| 6f040 | 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 | e.................(error."Unknow |
| 6f060 | 6e 20 6f 70 20 2d 2d 20 4d 41 4b 45 2d 46 52 4f 4d 2d 52 45 41 4c 2d 49 4d 41 47 22 20 6f 70 29 | n.op.--.MAKE-FROM-REAL-IMAG".op) |
| 6f080 | 29 29 29 0a 20 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 0a 0a 20 20 20 54 68 65 20 63 6f 72 | )))........dispatch).....The.cor |
| 6f0a0 | 72 65 73 70 6f 6e 64 69 6e 67 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 70 72 6f 63 65 | responding.`apply-generic'.proce |
| 6f0c0 | 64 75 72 65 2c 20 77 68 69 63 68 20 61 70 70 6c 69 65 73 20 61 20 67 65 6e 65 72 69 63 0a 6f 70 | dure,.which.applies.a.generic.op |
| 6f0e0 | 65 72 61 74 69 6f 6e 20 74 6f 20 61 6e 20 61 72 67 75 6d 65 6e 74 2c 20 6e 6f 77 20 73 69 6d 70 | eration.to.an.argument,.now.simp |
| 6f100 | 6c 79 20 66 65 65 64 73 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 27 73 20 6e 61 6d 65 20 74 6f | ly.feeds.the.operation's.name.to |
| 6f120 | 20 74 68 65 0a 64 61 74 61 20 6f 62 6a 65 63 74 20 61 6e 64 20 6c 65 74 73 20 74 68 65 20 6f 62 | .the.data.object.and.lets.the.ob |
| 6f140 | 6a 65 63 74 20 64 6f 20 74 68 65 20 77 6f 72 6b 3a 28 34 29 0a 0a 20 20 20 20 20 28 64 65 66 69 | ject.do.the.work:(4).......(defi |
| 6f160 | 6e 65 20 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 6f 70 20 61 72 67 29 20 28 61 72 67 20 6f | ne.(apply-generic.op.arg).(arg.o |
| 6f180 | 70 29 29 0a 0a 20 20 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65 20 76 61 6c 75 65 20 72 65 74 75 | p)).....Note.that.the.value.retu |
| 6f1a0 | 72 6e 65 64 20 62 79 20 60 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 27 20 69 73 | rned.by.`make-from-real-imag'.is |
| 6f1c0 | 20 61 0a 70 72 6f 63 65 64 75 72 65 2d 2d 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 60 64 69 73 70 | .a.procedure--the.internal.`disp |
| 6f1e0 | 61 74 63 68 27 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 69 73 20 69 73 20 74 68 65 20 70 72 | atch'.procedure...This.is.the.pr |
| 6f200 | 6f 63 65 64 75 72 65 0a 74 68 61 74 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 60 61 70 | ocedure.that.is.invoked.when.`ap |
| 6f220 | 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 72 65 71 75 65 73 74 73 20 61 6e 20 6f 70 65 72 61 74 69 | ply-generic'.requests.an.operati |
| 6f240 | 6f 6e 20 74 6f 20 62 65 0a 70 65 72 66 6f 72 6d 65 64 2e 0a 0a 20 20 20 54 68 69 73 20 73 74 79 | on.to.be.performed......This.sty |
| 6f260 | 6c 65 20 6f 66 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 63 61 6c 6c 65 64 20 22 6d 65 73 | le.of.programming.is.called."mes |
| 6f280 | 73 61 67 65 20 70 61 73 73 69 6e 67 22 2e 20 20 54 68 65 20 6e 61 6d 65 0a 63 6f 6d 65 73 20 66 | sage.passing"...The.name.comes.f |
| 6f2a0 | 72 6f 6d 20 74 68 65 20 69 6d 61 67 65 20 74 68 61 74 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 | rom.the.image.that.a.data.object |
| 6f2c0 | 20 69 73 20 61 6e 20 65 6e 74 69 74 79 20 74 68 61 74 20 72 65 63 65 69 76 65 73 20 74 68 65 0a | .is.an.entity.that.receives.the. |
| 6f2e0 | 72 65 71 75 65 73 74 65 64 20 6f 70 65 72 61 74 69 6f 6e 20 6e 61 6d 65 20 61 73 20 61 20 22 6d | requested.operation.name.as.a."m |
| 6f300 | 65 73 73 61 67 65 2e 22 20 20 57 65 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 73 65 65 6e 20 61 | essage."..We.have.already.seen.a |
| 6f320 | 6e 0a 65 78 61 6d 70 6c 65 20 6f 66 20 6d 65 73 73 61 67 65 20 70 61 73 73 69 6e 67 20 69 6e 20 | n.example.of.message.passing.in. |
| 6f340 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 31 2d 33 3a 3a 2c 20 77 68 65 72 65 20 77 65 20 | section.*Note.2-1-3::,.where.we. |
| 6f360 | 73 61 77 20 68 6f 77 0a 60 63 6f 6e 73 27 2c 20 60 63 61 72 27 2c 20 61 6e 64 20 60 63 64 72 27 | saw.how.`cons',.`car',.and.`cdr' |
| 6f380 | 20 63 6f 75 6c 64 20 62 65 20 64 65 66 69 6e 65 64 20 77 69 74 68 20 6e 6f 20 64 61 74 61 20 6f | .could.be.defined.with.no.data.o |
| 6f3a0 | 62 6a 65 63 74 73 20 62 75 74 20 6f 6e 6c 79 0a 70 72 6f 63 65 64 75 72 65 73 2e 20 20 48 65 72 | bjects.but.only.procedures...Her |
| 6f3c0 | 65 20 77 65 20 73 65 65 20 74 68 61 74 20 6d 65 73 73 61 67 65 20 70 61 73 73 69 6e 67 20 69 73 | e.we.see.that.message.passing.is |
| 6f3e0 | 20 6e 6f 74 20 61 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 0a 74 72 69 63 6b 20 62 75 74 20 61 20 | .not.a.mathematical.trick.but.a. |
| 6f400 | 75 73 65 66 75 6c 20 74 65 63 68 6e 69 71 75 65 20 66 6f 72 20 6f 72 67 61 6e 69 7a 69 6e 67 20 | useful.technique.for.organizing. |
| 6f420 | 73 79 73 74 65 6d 73 20 77 69 74 68 20 67 65 6e 65 72 69 63 0a 6f 70 65 72 61 74 69 6f 6e 73 2e | systems.with.generic.operations. |
| 6f440 | 20 20 49 6e 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 74 68 69 73 20 63 68 61 70 74 | ..In.the.remainder.of.this.chapt |
| 6f460 | 65 72 20 77 65 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 74 6f 20 75 73 65 0a 64 61 74 61 2d | er.we.will.continue.to.use.data- |
| 6f480 | 64 69 72 65 63 74 65 64 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 20 72 61 74 68 65 72 20 74 68 61 | directed.programming,.rather.tha |
| 6f4a0 | 6e 20 6d 65 73 73 61 67 65 20 70 61 73 73 69 6e 67 2c 20 74 6f 20 64 69 73 63 75 73 73 0a 67 65 | n.message.passing,.to.discuss.ge |
| 6f4c0 | 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 49 6e | neric.arithmetic.operations...In |
| 6f4e0 | 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 20 77 65 20 77 69 6c 6c 20 72 65 74 75 72 | .*Note.Chapter.3::.we.will.retur |
| 6f500 | 6e 20 74 6f 0a 6d 65 73 73 61 67 65 20 70 61 73 73 69 6e 67 2c 20 61 6e 64 20 77 65 20 77 69 6c | n.to.message.passing,.and.we.wil |
| 6f520 | 6c 20 73 65 65 20 74 68 61 74 20 69 74 20 63 61 6e 20 62 65 20 61 20 70 6f 77 65 72 66 75 6c 20 | l.see.that.it.can.be.a.powerful. |
| 6f540 | 74 6f 6f 6c 20 66 6f 72 0a 73 74 72 75 63 74 75 72 69 6e 67 20 73 69 6d 75 6c 61 74 69 6f 6e 20 | tool.for.structuring.simulation. |
| 6f560 | 70 72 6f 67 72 61 6d 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 37 35 3a 2a | programs........*Exercise.2.75:* |
| 6f580 | 20 49 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 6d 61 6b 65 | .Implement.the.constructor.`make |
| 6f5a0 | 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 27 20 69 6e 0a 20 20 20 20 20 6d 65 73 73 61 67 65 2d 70 | -from-mag-ang'.in......message-p |
| 6f5c0 | 61 73 73 69 6e 67 20 73 74 79 6c 65 2e 20 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 73 68 | assing.style...This.procedure.sh |
| 6f5e0 | 6f 75 6c 64 20 62 65 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 74 68 65 0a 20 20 20 20 20 60 6d | ould.be.analogous.to.the......`m |
| 6f600 | 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 27 20 70 72 6f 63 65 64 75 72 65 20 67 69 | ake-from-real-imag'.procedure.gi |
| 6f620 | 76 65 6e 20 61 62 6f 76 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 37 36 3a | ven.above........*Exercise.2.76: |
| 6f640 | 2a 20 41 73 20 61 20 6c 61 72 67 65 20 73 79 73 74 65 6d 20 77 69 74 68 20 67 65 6e 65 72 69 63 | *.As.a.large.system.with.generic |
| 6f660 | 20 6f 70 65 72 61 74 69 6f 6e 73 0a 20 20 20 20 20 65 76 6f 6c 76 65 73 2c 20 6e 65 77 20 74 79 | .operations......evolves,.new.ty |
| 6f680 | 70 65 73 20 6f 66 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 6f 72 20 6e 65 77 20 6f 70 65 72 61 | pes.of.data.objects.or.new.opera |
| 6f6a0 | 74 69 6f 6e 73 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 2e 0a 20 20 20 20 20 46 6f 72 20 65 61 | tions.may.be.needed.......For.ea |
| 6f6c0 | 63 68 20 6f 66 20 74 68 65 20 74 68 72 65 65 20 73 74 72 61 74 65 67 69 65 73 2d 2d 67 65 6e 65 | ch.of.the.three.strategies--gene |
| 6f6e0 | 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 69 74 68 20 65 78 70 6c 69 63 69 74 0a 20 20 20 | ric.operations.with.explicit.... |
| 6f700 | 20 20 64 69 73 70 61 74 63 68 2c 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 73 74 79 6c 65 2c | ..dispatch,.data-directed.style, |
| 6f720 | 20 61 6e 64 20 6d 65 73 73 61 67 65 2d 70 61 73 73 69 6e 67 2d 73 74 79 6c 65 2d 2d 64 65 73 63 | .and.message-passing-style--desc |
| 6f740 | 72 69 62 65 0a 20 20 20 20 20 74 68 65 20 63 68 61 6e 67 65 73 20 74 68 61 74 20 6d 75 73 74 20 | ribe......the.changes.that.must. |
| 6f760 | 62 65 20 6d 61 64 65 20 74 6f 20 61 20 73 79 73 74 65 6d 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 | be.made.to.a.system.in.order.to. |
| 6f780 | 61 64 64 20 6e 65 77 0a 20 20 20 20 20 74 79 70 65 73 20 6f 72 20 6e 65 77 20 6f 70 65 72 61 74 | add.new......types.or.new.operat |
| 6f7a0 | 69 6f 6e 73 2e 20 20 57 68 69 63 68 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 77 6f 75 6c 64 20 | ions...Which.organization.would. |
| 6f7c0 | 62 65 20 6d 6f 73 74 0a 20 20 20 20 20 61 70 70 72 6f 70 72 69 61 74 65 20 66 6f 72 20 61 20 73 | be.most......appropriate.for.a.s |
| 6f7e0 | 79 73 74 65 6d 20 69 6e 20 77 68 69 63 68 20 6e 65 77 20 74 79 70 65 73 20 6d 75 73 74 20 6f 66 | ystem.in.which.new.types.must.of |
| 6f800 | 74 65 6e 20 62 65 20 61 64 64 65 64 3f 0a 20 20 20 20 20 57 68 69 63 68 20 77 6f 75 6c 64 20 62 | ten.be.added?......Which.would.b |
| 6f820 | 65 20 6d 6f 73 74 20 61 70 70 72 6f 70 72 69 61 74 65 20 66 6f 72 20 61 20 73 79 73 74 65 6d 20 | e.most.appropriate.for.a.system. |
| 6f840 | 69 6e 20 77 68 69 63 68 20 6e 65 77 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 20 6d 75 73 | in.which.new......operations.mus |
| 6f860 | 74 20 6f 66 74 65 6e 20 62 65 20 61 64 64 65 64 3f 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | t.often.be.added?.....---------- |
| 6f880 | 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 57 65 | .Footnotes.----------.....(1).We |
| 6f8a0 | 20 75 73 65 20 74 68 65 20 6c 69 73 74 20 60 28 72 65 63 74 61 6e 67 75 6c 61 72 29 27 20 72 61 | .use.the.list.`(rectangular)'.ra |
| 6f8c0 | 74 68 65 72 20 74 68 61 6e 20 74 68 65 20 73 79 6d 62 6f 6c 0a 60 72 65 63 74 61 6e 67 75 6c 61 | ther.than.the.symbol.`rectangula |
| 6f8e0 | 72 27 20 74 6f 20 61 6c 6c 6f 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69 62 69 6c 69 74 79 20 | r'.to.allow.for.the.possibility. |
| 6f900 | 6f 66 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 69 74 68 20 6d 75 6c 74 69 70 6c 65 0a 61 72 67 75 | of.operations.with.multiple.argu |
| 6f920 | 6d 65 6e 74 73 2c 20 6e 6f 74 20 61 6c 6c 20 6f 66 20 74 68 65 20 73 61 6d 65 20 74 79 70 65 2e | ments,.not.all.of.the.same.type. |
| 6f940 | 0a 0a 20 20 20 28 32 29 20 54 68 65 20 74 79 70 65 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 6f | .....(2).The.type.the.constructo |
| 6f960 | 72 73 20 61 72 65 20 69 6e 73 74 61 6c 6c 65 64 20 75 6e 64 65 72 20 6e 65 65 64 6e 27 74 20 62 | rs.are.installed.under.needn't.b |
| 6f980 | 65 20 61 20 6c 69 73 74 0a 62 65 63 61 75 73 65 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 69 | e.a.list.because.a.constructor.i |
| 6f9a0 | 73 20 61 6c 77 61 79 73 20 75 73 65 64 20 74 6f 20 6d 61 6b 65 20 61 6e 20 6f 62 6a 65 63 74 20 | s.always.used.to.make.an.object. |
| 6f9c0 | 6f 66 20 6f 6e 65 0a 70 61 72 74 69 63 75 6c 61 72 20 74 79 70 65 2e 0a 0a 20 20 20 28 33 29 20 | of.one.particular.type......(3). |
| 6f9e0 | 60 41 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 75 73 65 73 20 74 68 65 20 64 6f 74 74 65 64 2d | `Apply-generic'.uses.the.dotted- |
| 6fa00 | 74 61 69 6c 20 6e 6f 74 61 74 69 6f 6e 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f 74 65 | tail.notation.described.in.*Note |
| 6fa20 | 0a 45 78 65 72 63 69 73 65 20 32 2d 32 30 3a 3a 2c 20 62 65 63 61 75 73 65 20 64 69 66 66 65 72 | .Exercise.2-20::,.because.differ |
| 6fa40 | 65 6e 74 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 6d 61 79 20 74 61 6b 65 0a | ent.generic.operations.may.take. |
| 6fa60 | 64 69 66 66 65 72 65 6e 74 20 6e 75 6d 62 65 72 73 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 2e 20 | different.numbers.of.arguments.. |
| 6fa80 | 20 49 6e 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 2c 20 60 6f 70 27 20 68 61 73 20 61 73 | .In.`apply-generic',.`op'.has.as |
| 6faa0 | 20 69 74 73 0a 76 61 6c 75 65 20 74 68 65 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 20 74 6f | .its.value.the.first.argument.to |
| 6fac0 | 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 61 6e 64 20 60 61 72 67 73 27 20 68 61 73 20 | .`apply-generic'.and.`args'.has. |
| 6fae0 | 61 73 20 69 74 73 20 76 61 6c 75 65 0a 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 72 65 6d 61 69 | as.its.value.a.list.of.the.remai |
| 6fb00 | 6e 69 6e 67 20 61 72 67 75 6d 65 6e 74 73 2e 0a 0a 20 20 20 60 41 70 70 6c 79 2d 67 65 6e 65 72 | ning.arguments......`Apply-gener |
| 6fb20 | 69 63 27 20 61 6c 73 6f 20 75 73 65 73 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 | ic'.also.uses.the.primitive.proc |
| 6fb40 | 65 64 75 72 65 20 60 61 70 70 6c 79 27 2c 20 77 68 69 63 68 0a 74 61 6b 65 73 20 74 77 6f 20 61 | edure.`apply',.which.takes.two.a |
| 6fb60 | 72 67 75 6d 65 6e 74 73 2c 20 61 20 70 72 6f 63 65 64 75 72 65 20 61 6e 64 20 61 20 6c 69 73 74 | rguments,.a.procedure.and.a.list |
| 6fb80 | 2e 20 20 60 41 70 70 6c 79 27 20 61 70 70 6c 69 65 73 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 | ...`Apply'.applies.the.procedure |
| 6fba0 | 2c 20 75 73 69 6e 67 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 6c 69 73 74 | ,.using.the.elements.in.the.list |
| 6fbc0 | 20 61 73 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 | .as.arguments...For.example,.... |
| 6fbe0 | 20 20 20 28 61 70 70 6c 79 20 2b 20 28 6c 69 73 74 20 31 20 32 20 33 20 34 29 29 0a 0a 72 65 74 | ...(apply.+.(list.1.2.3.4))..ret |
| 6fc00 | 75 72 6e 73 20 31 30 2e 0a 0a 20 20 20 28 34 29 20 4f 6e 65 20 6c 69 6d 69 74 61 74 69 6f 6e 20 | urns.10......(4).One.limitation. |
| 6fc20 | 6f 66 20 74 68 69 73 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 69 73 20 69 74 20 70 65 72 6d 69 | of.this.organization.is.it.permi |
| 6fc40 | 74 73 20 6f 6e 6c 79 20 67 65 6e 65 72 69 63 0a 70 72 6f 63 65 64 75 72 65 73 20 6f 66 20 6f 6e | ts.only.generic.procedures.of.on |
| 6fc60 | 65 20 61 72 67 75 6d 65 6e 74 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 | e.argument.....File:.sicp.info,. |
| 6fc80 | 20 4e 6f 64 65 3a 20 32 2d 35 2c 20 20 50 72 65 76 3a 20 32 2d 34 2c 20 20 55 70 3a 20 43 68 61 | .Node:.2-5,..Prev:.2-4,..Up:.Cha |
| 6fca0 | 70 74 65 72 20 32 0a 0a 32 2e 35 20 53 79 73 74 65 6d 73 20 77 69 74 68 20 47 65 6e 65 72 69 63 | pter.2..2.5.Systems.with.Generic |
| 6fcc0 | 20 4f 70 65 72 61 74 69 6f 6e 73 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | .Operations.==================== |
| 6fce0 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 49 6e 20 74 68 65 20 70 72 65 76 69 6f 75 73 | ===============..In.the.previous |
| 6fd00 | 20 73 65 63 74 69 6f 6e 2c 20 77 65 20 73 61 77 20 68 6f 77 20 74 6f 20 64 65 73 69 67 6e 20 73 | .section,.we.saw.how.to.design.s |
| 6fd20 | 79 73 74 65 6d 73 20 69 6e 20 77 68 69 63 68 20 64 61 74 61 0a 6f 62 6a 65 63 74 73 20 63 61 6e | ystems.in.which.data.objects.can |
| 6fd40 | 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 | .be.represented.in.more.than.one |
| 6fd60 | 20 77 61 79 2e 20 20 54 68 65 20 6b 65 79 20 69 64 65 61 20 69 73 20 74 6f 0a 6c 69 6e 6b 20 74 | .way...The.key.idea.is.to.link.t |
| 6fd80 | 68 65 20 63 6f 64 65 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 74 68 65 20 64 61 74 61 20 | he.code.that.specifies.the.data. |
| 6fda0 | 6f 70 65 72 61 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 73 65 76 65 72 61 6c 0a 72 65 70 72 65 73 | operations.to.the.several.repres |
| 6fdc0 | 65 6e 74 61 74 69 6f 6e 73 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 67 65 6e 65 72 69 63 20 69 6e | entations.by.means.of.generic.in |
| 6fde0 | 74 65 72 66 61 63 65 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 4e 6f 77 20 77 65 20 77 69 6c 6c | terface.procedures...Now.we.will |
| 6fe00 | 0a 73 65 65 20 68 6f 77 20 74 6f 20 75 73 65 20 74 68 69 73 20 73 61 6d 65 20 69 64 65 61 20 6e | .see.how.to.use.this.same.idea.n |
| 6fe20 | 6f 74 20 6f 6e 6c 79 20 74 6f 20 64 65 66 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 | ot.only.to.define.operations.tha |
| 6fe40 | 74 20 61 72 65 0a 67 65 6e 65 72 69 63 20 6f 76 65 72 20 64 69 66 66 65 72 65 6e 74 20 72 65 70 | t.are.generic.over.different.rep |
| 6fe60 | 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 62 75 74 20 61 6c 73 6f 20 74 6f 20 64 65 66 69 6e 65 20 | resentations.but.also.to.define. |
| 6fe80 | 6f 70 65 72 61 74 69 6f 6e 73 0a 74 68 61 74 20 61 72 65 20 67 65 6e 65 72 69 63 20 6f 76 65 72 | operations.that.are.generic.over |
| 6fea0 | 20 64 69 66 66 65 72 65 6e 74 20 6b 69 6e 64 73 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 | .different.kinds.of.arguments... |
| 6fec0 | 57 65 20 68 61 76 65 20 61 6c 72 65 61 64 79 0a 73 65 65 6e 20 73 65 76 65 72 61 6c 20 64 69 66 | We.have.already.seen.several.dif |
| 6fee0 | 66 65 72 65 6e 74 20 70 61 63 6b 61 67 65 73 20 6f 66 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 | ferent.packages.of.arithmetic.op |
| 6ff00 | 65 72 61 74 69 6f 6e 73 3a 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 0a 61 72 69 74 68 6d 65 74 | erations:.the.primitive.arithmet |
| 6ff20 | 69 63 20 28 60 2b 27 2c 20 60 2d 27 2c 20 60 2a 27 2c 20 60 2f 27 29 20 62 75 69 6c 74 20 69 6e | ic.(`+',.`-',.`*',.`/').built.in |
| 6ff40 | 74 6f 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 2c 20 74 68 65 0a 72 61 74 69 6f 6e 61 6c 2d 6e 75 | to.our.language,.the.rational-nu |
| 6ff60 | 6d 62 65 72 20 61 72 69 74 68 6d 65 74 69 63 20 28 60 61 64 64 2d 72 61 74 27 2c 20 60 73 75 62 | mber.arithmetic.(`add-rat',.`sub |
| 6ff80 | 2d 72 61 74 27 2c 20 60 6d 75 6c 2d 72 61 74 27 2c 20 60 64 69 76 2d 72 61 74 27 29 0a 6f 66 20 | -rat',.`mul-rat',.`div-rat').of. |
| 6ffa0 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 31 2d 31 3a 3a 2c 20 61 6e 64 20 74 68 65 20 63 | section.*Note.2-1-1::,.and.the.c |
| 6ffc0 | 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 61 72 69 74 68 6d 65 74 69 63 20 74 68 61 74 20 77 65 | omplex-number.arithmetic.that.we |
| 6ffe0 | 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d | .implemented.in.section.*Note.2- |
| 70000 | 34 2d 33 3a 3a 2e 20 20 57 65 20 77 69 6c 6c 20 6e 6f 77 20 75 73 65 20 64 61 74 61 2d 64 69 72 | 4-3::...We.will.now.use.data-dir |
| 70020 | 65 63 74 65 64 0a 74 65 63 68 6e 69 71 75 65 73 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 61 20 | ected.techniques.to.construct.a. |
| 70040 | 70 61 63 6b 61 67 65 20 6f 66 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 | package.of.arithmetic.operations |
| 70060 | 20 74 68 61 74 0a 69 6e 63 6f 72 70 6f 72 61 74 65 73 20 61 6c 6c 20 74 68 65 20 61 72 69 74 68 | .that.incorporates.all.the.arith |
| 70080 | 6d 65 74 69 63 20 70 61 63 6b 61 67 65 73 20 77 65 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 63 | metic.packages.we.have.already.c |
| 700a0 | 6f 6e 73 74 72 75 63 74 65 64 2e 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 32 | onstructed......*Note.Figure.2-2 |
| 700c0 | 33 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 73 | 3::.shows.the.structure.of.the.s |
| 700e0 | 79 73 74 65 6d 20 77 65 20 73 68 61 6c 6c 0a 62 75 69 6c 64 2e 20 20 4e 6f 74 69 63 65 20 74 68 | ystem.we.shall.build...Notice.th |
| 70100 | 65 20 61 62 73 74 72 61 63 74 69 6f 6e 20 62 61 72 72 69 65 72 73 2e 20 20 46 72 6f 6d 20 74 68 | e.abstraction.barriers...From.th |
| 70120 | 65 20 70 65 72 73 70 65 63 74 69 76 65 20 6f 66 0a 73 6f 6d 65 6f 6e 65 20 75 73 69 6e 67 20 22 | e.perspective.of.someone.using." |
| 70140 | 6e 75 6d 62 65 72 73 2c 22 20 74 68 65 72 65 20 69 73 20 61 20 73 69 6e 67 6c 65 20 70 72 6f 63 | numbers,".there.is.a.single.proc |
| 70160 | 65 64 75 72 65 20 60 61 64 64 27 20 74 68 61 74 0a 6f 70 65 72 61 74 65 73 20 6f 6e 20 77 68 61 | edure.`add'.that.operates.on.wha |
| 70180 | 74 65 76 65 72 20 6e 75 6d 62 65 72 73 20 61 72 65 20 73 75 70 70 6c 69 65 64 2e 20 20 60 41 64 | tever.numbers.are.supplied...`Ad |
| 701a0 | 64 27 20 69 73 20 70 61 72 74 20 6f 66 20 61 20 67 65 6e 65 72 69 63 0a 69 6e 74 65 72 66 61 63 | d'.is.part.of.a.generic.interfac |
| 701c0 | 65 20 74 68 61 74 20 61 6c 6c 6f 77 73 20 74 68 65 20 73 65 70 61 72 61 74 65 20 6f 72 64 69 6e | e.that.allows.the.separate.ordin |
| 701e0 | 61 72 79 2d 61 72 69 74 68 6d 65 74 69 63 2c 0a 72 61 74 69 6f 6e 61 6c 2d 61 72 69 74 68 6d 65 | ary-arithmetic,.rational-arithme |
| 70200 | 74 69 63 2c 20 61 6e 64 20 63 6f 6d 70 6c 65 78 2d 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b | tic,.and.complex-arithmetic.pack |
| 70220 | 61 67 65 73 20 74 6f 20 62 65 20 61 63 63 65 73 73 65 64 0a 75 6e 69 66 6f 72 6d 6c 79 20 62 79 | ages.to.be.accessed.uniformly.by |
| 70240 | 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 75 73 65 20 6e 75 6d 62 65 72 73 2e 20 20 41 6e 79 | .programs.that.use.numbers...Any |
| 70260 | 20 69 6e 64 69 76 69 64 75 61 6c 20 61 72 69 74 68 6d 65 74 69 63 0a 70 61 63 6b 61 67 65 20 28 | .individual.arithmetic.package.( |
| 70280 | 73 75 63 68 20 61 73 20 74 68 65 20 63 6f 6d 70 6c 65 78 20 70 61 63 6b 61 67 65 29 20 6d 61 79 | such.as.the.complex.package).may |
| 702a0 | 20 69 74 73 65 6c 66 20 62 65 20 61 63 63 65 73 73 65 64 20 74 68 72 6f 75 67 68 0a 67 65 6e 65 | .itself.be.accessed.through.gene |
| 702c0 | 72 69 63 20 70 72 6f 63 65 64 75 72 65 73 20 28 73 75 63 68 20 61 73 20 60 61 64 64 2d 63 6f 6d | ric.procedures.(such.as.`add-com |
| 702e0 | 70 6c 65 78 27 29 20 74 68 61 74 20 63 6f 6d 62 69 6e 65 20 70 61 63 6b 61 67 65 73 0a 64 65 73 | plex').that.combine.packages.des |
| 70300 | 69 67 6e 65 64 20 66 6f 72 20 64 69 66 66 65 72 65 6e 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 | igned.for.different.representati |
| 70320 | 6f 6e 73 20 28 73 75 63 68 20 61 73 20 72 65 63 74 61 6e 67 75 6c 61 72 20 61 6e 64 20 70 6f 6c | ons.(such.as.rectangular.and.pol |
| 70340 | 61 72 29 2e 0a 4d 6f 72 65 6f 76 65 72 2c 20 74 68 65 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 | ar)..Moreover,.the.structure.of. |
| 70360 | 74 68 65 20 73 79 73 74 65 6d 20 69 73 20 61 64 64 69 74 69 76 65 2c 20 73 6f 20 74 68 61 74 20 | the.system.is.additive,.so.that. |
| 70380 | 6f 6e 65 20 63 61 6e 0a 64 65 73 69 67 6e 20 74 68 65 20 69 6e 64 69 76 69 64 75 61 6c 20 61 72 | one.can.design.the.individual.ar |
| 703a0 | 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 73 20 73 65 70 61 72 61 74 65 6c 79 20 61 6e 64 | ithmetic.packages.separately.and |
| 703c0 | 20 63 6f 6d 62 69 6e 65 20 74 68 65 6d 0a 74 6f 20 70 72 6f 64 75 63 65 20 61 20 67 65 6e 65 72 | .combine.them.to.produce.a.gener |
| 703e0 | 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 73 79 73 74 65 6d 2e 0a 0a 20 20 20 20 20 2a 46 69 67 | ic.arithmetic.system........*Fig |
| 70400 | 75 72 65 20 32 2e 32 33 3a 2a 20 47 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 73 79 | ure.2.23:*.Generic.arithmetic.sy |
| 70420 | 73 74 65 6d 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | stem............................ |
| 70440 | 20 20 20 20 20 20 20 20 20 50 72 6f 67 72 61 6d 73 20 74 68 61 74 20 75 73 65 20 6e 75 6d 62 65 | .........Programs.that.use.numbe |
| 70460 | 72 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rs.............................. |
| 70480 | 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 | ........+-----------------+..... |
| 704a0 | 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ......-------------------------- |
| 704c0 | 2d 7c 20 61 64 64 20 73 75 62 20 6d 75 6c 20 64 69 76 20 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -|.add.sub.mul.div.|------------ |
| 704e0 | 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -------......................... |
| 70500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b | .............+-----------------+ |
| 70520 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 70540 | 20 20 20 47 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 0a 20 20 | ...Generic.arithmetic.package... |
| 70560 | 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b | .........+-----------------+...+ |
| 70580 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 | -------------------------+...... |
| 705a0 | 20 20 20 20 20 20 7c 20 61 64 64 2d 72 61 74 20 73 75 62 2d 72 61 74 20 7c 20 20 20 7c 20 61 64 | ......|.add-rat.sub-rat.|...|.ad |
| 705c0 | 64 2d 63 6f 6d 70 6c 65 78 20 73 75 62 2d 63 6f 6d 70 6c 65 78 20 7c 20 20 20 2b 2d 2d 2d 2d 2d | d-complex.sub-complex.|...+----- |
| 705e0 | 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2d 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ----+...........-|.............. |
| 70600 | 20 20 20 7c 2d 2b 2d 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...|-+-|........................ |
| 70620 | 20 7c 2d 2b 2d 7c 20 2b 20 2d 20 2a 20 2f 20 7c 2d 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 6d | .|-+-|.+.-.*./.|-............|.m |
| 70640 | 75 6c 2d 72 61 74 20 64 69 76 2d 72 61 74 20 7c 20 7c 20 7c 20 6d 75 6c 2d 63 6f 6d 70 6c 65 78 | ul-rat.div-rat.|.|.|.mul-complex |
| 70660 | 20 64 69 76 2d 63 6f 6d 70 6c 65 78 20 7c 20 7c 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 | .div-complex.|.|.+---------+.... |
| 70680 | 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 7c 20 2b 2d | ........+-----------------+.|.+- |
| 706a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 7c 0a 20 20 20 20 | ------------------------+.|..... |
| 706c0 | 20 20 20 20 20 20 20 20 20 20 20 20 52 61 74 69 6f 6e 61 6c 20 20 20 20 20 20 20 7c 20 20 20 20 | ............Rational.......|.... |
| 706e0 | 20 43 6f 6d 70 6c 65 78 20 61 72 74 69 74 68 6d 65 74 69 63 20 20 20 20 20 7c 20 20 20 4f 72 64 | .Complex.artithmetic.....|...Ord |
| 70700 | 69 6e 61 72 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 72 69 74 68 6d 65 74 69 63 20 | inary................arithmetic. |
| 70720 | 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .....+--------------+----------- |
| 70740 | 2d 2d 2d 2b 20 20 61 72 69 74 68 6d 65 74 69 63 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---+..arithmetic................ |
| 70760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 52 65 63 74 61 6e 67 75 6c 61 72 20 20 7c | ................|.Rectangular..| |
| 70780 | 20 20 20 20 20 50 6f 6c 61 72 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d | .....Polar....|...........------ |
| 707a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d | ---------------+--------------+- |
| 707c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 2a 20 4d | -------------+-------------..*.M |
| 707e0 | 65 6e 75 3a 0a 0a 2a 20 32 2d 35 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 47 65 6e 65 72 | enu:..*.2-5-1::............Gener |
| 70800 | 69 63 20 41 72 69 74 68 6d 65 74 69 63 20 4f 70 65 72 61 74 69 6f 6e 73 0a 2a 20 32 2d 35 2d 32 | ic.Arithmetic.Operations.*.2-5-2 |
| 70820 | 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6d 62 69 6e 69 6e 67 20 44 61 74 61 20 6f 66 20 | ::............Combining.Data.of. |
| 70840 | 44 69 66 66 65 72 65 6e 74 20 54 79 70 65 73 0a 2a 20 32 2d 35 2d 33 3a 3a 20 20 20 20 20 20 20 | Different.Types.*.2-5-3::....... |
| 70860 | 20 20 20 20 20 45 78 61 6d 70 6c 65 3a 20 53 79 6d 62 6f 6c 69 63 20 41 6c 67 65 62 72 61 0a 0a | .....Example:.Symbolic.Algebra.. |
| 70880 | 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 35 2d 31 2c | ..File:.sicp.info,..Node:.2-5-1, |
| 708a0 | 20 20 4e 65 78 74 3a 20 32 2d 35 2d 32 2c 20 20 50 72 65 76 3a 20 32 2d 35 2c 20 20 55 70 3a 20 | ..Next:.2-5-2,..Prev:.2-5,..Up:. |
| 708c0 | 32 2d 35 0a 0a 32 2e 35 2e 31 20 47 65 6e 65 72 69 63 20 41 72 69 74 68 6d 65 74 69 63 20 4f 70 | 2-5..2.5.1.Generic.Arithmetic.Op |
| 708e0 | 65 72 61 74 69 6f 6e 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | erations.----------------------- |
| 70900 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 74 61 73 6b 20 6f 66 20 64 65 73 69 67 6e | ------------..The.task.of.design |
| 70920 | 69 6e 67 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e | ing.generic.arithmetic.operation |
| 70940 | 73 20 69 73 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 0a 74 68 61 74 20 6f 66 20 64 65 73 69 67 6e | s.is.analogous.to.that.of.design |
| 70960 | 69 6e 67 20 74 68 65 20 67 65 6e 65 72 69 63 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 6f | ing.the.generic.complex-number.o |
| 70980 | 70 65 72 61 74 69 6f 6e 73 2e 20 20 57 65 20 77 6f 75 6c 64 0a 6c 69 6b 65 2c 20 66 6f 72 20 69 | perations...We.would.like,.for.i |
| 709a0 | 6e 73 74 61 6e 63 65 2c 20 74 6f 20 68 61 76 65 20 61 20 67 65 6e 65 72 69 63 20 61 64 64 69 74 | nstance,.to.have.a.generic.addit |
| 709c0 | 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 60 61 64 64 27 20 74 68 61 74 0a 61 63 74 73 20 6c 69 | ion.procedure.`add'.that.acts.li |
| 709e0 | 6b 65 20 6f 72 64 69 6e 61 72 79 20 70 72 69 6d 69 74 69 76 65 20 61 64 64 69 74 69 6f 6e 20 60 | ke.ordinary.primitive.addition.` |
| 70a00 | 2b 27 20 6f 6e 20 6f 72 64 69 6e 61 72 79 20 6e 75 6d 62 65 72 73 2c 20 6c 69 6b 65 0a 60 61 64 | +'.on.ordinary.numbers,.like.`ad |
| 70a20 | 64 2d 72 61 74 27 20 6f 6e 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2c 20 61 6e 64 20 | d-rat'.on.rational.numbers,.and. |
| 70a40 | 6c 69 6b 65 20 60 61 64 64 2d 63 6f 6d 70 6c 65 78 27 20 6f 6e 20 63 6f 6d 70 6c 65 78 0a 6e 75 | like.`add-complex'.on.complex.nu |
| 70a60 | 6d 62 65 72 73 2e 20 20 57 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 60 61 64 64 27 2c 20 | mbers...We.can.implement.`add',. |
| 70a80 | 61 6e 64 20 74 68 65 20 6f 74 68 65 72 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 | and.the.other.generic.arithmetic |
| 70aa0 | 0a 6f 70 65 72 61 74 69 6f 6e 73 2c 20 62 79 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 65 20 73 61 | .operations,.by.following.the.sa |
| 70ac0 | 6d 65 20 73 74 72 61 74 65 67 79 20 77 65 20 75 73 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a | me.strategy.we.used.in.section.* |
| 70ae0 | 4e 6f 74 65 0a 32 2d 34 2d 33 3a 3a 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 67 65 | Note.2-4-3::.to.implement.the.ge |
| 70b00 | 6e 65 72 69 63 20 73 65 6c 65 63 74 6f 72 73 20 66 6f 72 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 | neric.selectors.for.complex.numb |
| 70b20 | 65 72 73 2e 20 20 57 65 0a 77 69 6c 6c 20 61 74 74 61 63 68 20 61 20 74 79 70 65 20 74 61 67 20 | ers...We.will.attach.a.type.tag. |
| 70b40 | 74 6f 20 65 61 63 68 20 6b 69 6e 64 20 6f 66 20 6e 75 6d 62 65 72 20 61 6e 64 20 63 61 75 73 65 | to.each.kind.of.number.and.cause |
| 70b60 | 20 74 68 65 20 67 65 6e 65 72 69 63 0a 70 72 6f 63 65 64 75 72 65 20 74 6f 20 64 69 73 70 61 74 | .the.generic.procedure.to.dispat |
| 70b80 | 63 68 20 74 6f 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20 70 61 63 6b 61 67 65 20 61 63 63 | ch.to.an.appropriate.package.acc |
| 70ba0 | 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 20 64 61 74 61 0a 74 79 70 65 20 6f 66 20 69 74 73 20 61 | ording.to.the.data.type.of.its.a |
| 70bc0 | 72 67 75 6d 65 6e 74 73 2e 0a 0a 20 20 20 54 68 65 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d | rguments......The.generic.arithm |
| 70be0 | 65 74 69 63 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 64 65 66 69 6e 65 64 20 61 73 20 66 | etic.procedures.are.defined.as.f |
| 70c00 | 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 20 78 20 79 29 20 | ollows:.......(define.(add.x.y). |
| 70c20 | 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 27 61 64 64 20 78 20 79 29 29 0a 20 20 20 20 20 28 | (apply-generic.'add.x.y))......( |
| 70c40 | 64 65 66 69 6e 65 20 28 73 75 62 20 78 20 79 29 20 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 | define.(sub.x.y).(apply-generic. |
| 70c60 | 27 73 75 62 20 78 20 79 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 20 78 20 79 | 'sub.x.y))......(define.(mul.x.y |
| 70c80 | 29 20 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 27 6d 75 6c 20 78 20 79 29 29 0a 20 20 20 20 | ).(apply-generic.'mul.x.y))..... |
| 70ca0 | 20 28 64 65 66 69 6e 65 20 28 64 69 76 20 78 20 79 29 20 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 | .(define.(div.x.y).(apply-generi |
| 70cc0 | 63 20 27 64 69 76 20 78 20 79 29 29 0a 0a 20 20 20 57 65 20 62 65 67 69 6e 20 62 79 20 69 6e 73 | c.'div.x.y)).....We.begin.by.ins |
| 70ce0 | 74 61 6c 6c 69 6e 67 20 61 20 70 61 63 6b 61 67 65 20 66 6f 72 20 68 61 6e 64 6c 69 6e 67 20 22 | talling.a.package.for.handling." |
| 70d00 | 6f 72 64 69 6e 61 72 79 22 20 6e 75 6d 62 65 72 73 2c 0a 74 68 61 74 20 69 73 2c 20 74 68 65 20 | ordinary".numbers,.that.is,.the. |
| 70d20 | 70 72 69 6d 69 74 69 76 65 20 6e 75 6d 62 65 72 73 20 6f 66 20 6f 75 72 20 6c 61 6e 67 75 61 67 | primitive.numbers.of.our.languag |
| 70d40 | 65 2e 20 20 57 65 20 77 69 6c 6c 20 74 61 67 20 74 68 65 73 65 20 77 69 74 68 0a 74 68 65 20 73 | e...We.will.tag.these.with.the.s |
| 70d60 | 79 6d 62 6f 6c 20 60 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 27 2e 20 20 54 68 65 20 61 72 69 74 | ymbol.`scheme-number'...The.arit |
| 70d80 | 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 74 68 69 73 20 70 61 63 6b 61 67 | hmetic.operations.in.this.packag |
| 70da0 | 65 0a 61 72 65 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 61 72 69 74 68 6d 65 74 69 63 20 70 | e.are.the.primitive.arithmetic.p |
| 70dc0 | 72 6f 63 65 64 75 72 65 73 20 28 73 6f 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6e 65 65 64 20 74 | rocedures.(so.there.is.no.need.t |
| 70de0 | 6f 20 64 65 66 69 6e 65 0a 65 78 74 72 61 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 68 61 6e | o.define.extra.procedures.to.han |
| 70e00 | 64 6c 65 20 74 68 65 20 75 6e 74 61 67 67 65 64 20 6e 75 6d 62 65 72 73 29 2e 20 20 53 69 6e 63 | dle.the.untagged.numbers)...Sinc |
| 70e20 | 65 20 74 68 65 73 65 0a 6f 70 65 72 61 74 69 6f 6e 73 20 65 61 63 68 20 74 61 6b 65 20 74 77 6f | e.these.operations.each.take.two |
| 70e40 | 20 61 72 67 75 6d 65 6e 74 73 2c 20 74 68 65 79 20 61 72 65 20 69 6e 73 74 61 6c 6c 65 64 20 69 | .arguments,.they.are.installed.i |
| 70e60 | 6e 20 74 68 65 20 74 61 62 6c 65 0a 6b 65 79 65 64 20 62 79 20 74 68 65 20 6c 69 73 74 20 60 28 | n.the.table.keyed.by.the.list.`( |
| 70e80 | 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 20 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 29 27 3a 0a 0a | scheme-number.scheme-number)':.. |
| 70ea0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 73 74 61 6c 6c 2d 73 63 68 65 6d 65 2d 6e 75 6d | .....(define.(install-scheme-num |
| 70ec0 | 62 65 72 2d 70 61 63 6b 61 67 65 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 61 67 | ber-package)........(define.(tag |
| 70ee0 | 20 78 29 0a 20 20 20 20 20 20 20 20 20 28 61 74 74 61 63 68 2d 74 61 67 20 27 73 63 68 65 6d 65 | .x)..........(attach-tag.'scheme |
| 70f00 | 2d 6e 75 6d 62 65 72 20 78 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 61 64 64 20 27 28 73 | -number.x))........(put.'add.'(s |
| 70f20 | 63 68 65 6d 65 2d 6e 75 6d 62 65 72 20 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 29 0a 20 20 20 20 | cheme-number.scheme-number)..... |
| 70f40 | 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 20 79 29 20 28 74 61 67 20 28 2b 20 78 20 | ........(lambda.(x.y).(tag.(+.x. |
| 70f60 | 79 29 29 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 73 75 62 20 27 28 73 63 68 65 6d 65 2d | y))))........(put.'sub.'(scheme- |
| 70f80 | 6e 75 6d 62 65 72 20 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 | number.scheme-number)........... |
| 70fa0 | 20 20 28 6c 61 6d 62 64 61 20 28 78 20 79 29 20 28 74 61 67 20 28 2d 20 78 20 79 29 29 29 29 0a | ..(lambda.(x.y).(tag.(-.x.y)))). |
| 70fc0 | 20 20 20 20 20 20 20 28 70 75 74 20 27 6d 75 6c 20 27 28 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 | .......(put.'mul.'(scheme-number |
| 70fe0 | 20 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d | .scheme-number).............(lam |
| 71000 | 62 64 61 20 28 78 20 79 29 20 28 74 61 67 20 28 2a 20 78 20 79 29 29 29 29 0a 20 20 20 20 20 20 | bda.(x.y).(tag.(*.x.y))))....... |
| 71020 | 20 28 70 75 74 20 27 64 69 76 20 27 28 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 20 73 63 68 65 6d | .(put.'div.'(scheme-number.schem |
| 71040 | 65 2d 6e 75 6d 62 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 | e-number).............(lambda.(x |
| 71060 | 20 79 29 20 28 74 61 67 20 28 2f 20 78 20 79 29 29 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 | .y).(tag.(/.x.y))))........(put. |
| 71080 | 27 6d 61 6b 65 20 27 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 | 'make.'scheme-number............ |
| 710a0 | 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 74 61 67 20 78 29 29 29 0a 20 20 20 20 20 20 20 27 64 | .(lambda.(x).(tag.x)))........'d |
| 710c0 | 6f 6e 65 29 0a 0a 20 20 20 55 73 65 72 73 20 6f 66 20 74 68 65 20 53 63 68 65 6d 65 2d 6e 75 6d | one).....Users.of.the.Scheme-num |
| 710e0 | 62 65 72 20 70 61 63 6b 61 67 65 20 77 69 6c 6c 20 63 72 65 61 74 65 20 28 74 61 67 67 65 64 29 | ber.package.will.create.(tagged) |
| 71100 | 20 6f 72 64 69 6e 61 72 79 0a 6e 75 6d 62 65 72 73 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 74 68 | .ordinary.numbers.by.means.of.th |
| 71120 | 65 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 | e.procedure:.......(define.(make |
| 71140 | 2d 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 20 6e 29 0a 20 20 20 20 20 20 20 28 28 67 65 74 20 27 | -scheme-number.n)........((get.' |
| 71160 | 6d 61 6b 65 20 27 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 29 20 6e 29 29 0a 0a 20 20 20 4e 6f 77 | make.'scheme-number).n)).....Now |
| 71180 | 20 74 68 61 74 20 74 68 65 20 66 72 61 6d 65 77 6f 72 6b 20 6f 66 20 74 68 65 20 67 65 6e 65 72 | .that.the.framework.of.the.gener |
| 711a0 | 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 73 79 73 74 65 6d 20 69 73 20 69 6e 20 70 6c 61 63 65 | ic.arithmetic.system.is.in.place |
| 711c0 | 2c 0a 77 65 20 63 61 6e 20 72 65 61 64 69 6c 79 20 69 6e 63 6c 75 64 65 20 6e 65 77 20 6b 69 6e | ,.we.can.readily.include.new.kin |
| 711e0 | 64 73 20 6f 66 20 6e 75 6d 62 65 72 73 2e 20 20 48 65 72 65 20 69 73 20 61 20 70 61 63 6b 61 67 | ds.of.numbers...Here.is.a.packag |
| 71200 | 65 20 74 68 61 74 0a 70 65 72 66 6f 72 6d 73 20 72 61 74 69 6f 6e 61 6c 20 61 72 69 74 68 6d 65 | e.that.performs.rational.arithme |
| 71220 | 74 69 63 2e 20 20 4e 6f 74 69 63 65 20 74 68 61 74 2c 20 61 73 20 61 20 62 65 6e 65 66 69 74 20 | tic...Notice.that,.as.a.benefit. |
| 71240 | 6f 66 20 61 64 64 69 74 69 76 69 74 79 2c 0a 77 65 20 63 61 6e 20 75 73 65 20 77 69 74 68 6f 75 | of.additivity,.we.can.use.withou |
| 71260 | 74 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 | t.modification.the.rational-numb |
| 71280 | 65 72 20 63 6f 64 65 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 32 2d 31 2d 31 | er.code.from.section.*Note.2-1-1 |
| 712a0 | 3a 3a 20 61 73 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e | ::.as.the.internal.procedures.in |
| 712c0 | 20 74 68 65 20 70 61 63 6b 61 67 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 73 | .the.package:.......(define.(ins |
| 712e0 | 74 61 6c 6c 2d 72 61 74 69 6f 6e 61 6c 2d 70 61 63 6b 61 67 65 29 0a 20 20 20 20 20 20 20 3b 3b | tall-rational-package)........;; |
| 71300 | 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 20 20 28 64 65 66 | .internal.procedures........(def |
| 71320 | 69 6e 65 20 28 6e 75 6d 65 72 20 78 29 20 28 63 61 72 20 78 29 29 0a 20 20 20 20 20 20 20 28 64 | ine.(numer.x).(car.x))........(d |
| 71340 | 65 66 69 6e 65 20 28 64 65 6e 6f 6d 20 78 29 20 28 63 64 72 20 78 29 29 0a 20 20 20 20 20 20 20 | efine.(denom.x).(cdr.x))........ |
| 71360 | 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 72 61 74 20 6e 20 64 29 0a 20 20 20 20 20 20 20 20 20 | (define.(make-rat.n.d).......... |
| 71380 | 28 6c 65 74 20 28 28 67 20 28 67 63 64 20 6e 20 64 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (let.((g.(gcd.n.d)))............ |
| 713a0 | 28 63 6f 6e 73 20 28 2f 20 6e 20 67 29 20 28 2f 20 64 20 67 29 29 29 29 0a 20 20 20 20 20 20 20 | (cons.(/.n.g).(/.d.g))))........ |
| 713c0 | 28 64 65 66 69 6e 65 20 28 61 64 64 2d 72 61 74 20 78 20 79 29 0a 20 20 20 20 20 20 20 20 20 28 | (define.(add-rat.x.y)..........( |
| 713e0 | 6d 61 6b 65 2d 72 61 74 20 28 2b 20 28 2a 20 28 6e 75 6d 65 72 20 78 29 20 28 64 65 6e 6f 6d 20 | make-rat.(+.(*.(numer.x).(denom. |
| 71400 | 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 6e 75 | y)).......................(*.(nu |
| 71420 | 6d 65 72 20 79 29 20 28 64 65 6e 6f 6d 20 78 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | mer.y).(denom.x))).............. |
| 71440 | 20 20 20 20 20 20 28 2a 20 28 64 65 6e 6f 6d 20 78 29 20 28 64 65 6e 6f 6d 20 79 29 29 29 29 0a | ......(*.(denom.x).(denom.y)))). |
| 71460 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 62 2d 72 61 74 20 78 20 79 29 0a 20 20 20 | .......(define.(sub-rat.x.y).... |
| 71480 | 20 20 20 20 20 20 28 6d 61 6b 65 2d 72 61 74 20 28 2d 20 28 2a 20 28 6e 75 6d 65 72 20 78 29 20 | ......(make-rat.(-.(*.(numer.x). |
| 714a0 | 28 64 65 6e 6f 6d 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (denom.y))...................... |
| 714c0 | 20 28 2a 20 28 6e 75 6d 65 72 20 79 29 20 28 64 65 6e 6f 6d 20 78 29 29 29 0a 20 20 20 20 20 20 | .(*.(numer.y).(denom.x)))....... |
| 714e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 64 65 6e 6f 6d 20 78 29 20 28 64 65 6e 6f 6d | .............(*.(denom.x).(denom |
| 71500 | 20 79 29 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 2d 72 61 74 20 78 | .y))))........(define.(mul-rat.x |
| 71520 | 20 79 29 0a 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 72 61 74 20 28 2a 20 28 6e 75 6d 65 72 | .y)..........(make-rat.(*.(numer |
| 71540 | 20 78 29 20 28 6e 75 6d 65 72 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .x).(numer.y)).................. |
| 71560 | 20 20 28 2a 20 28 64 65 6e 6f 6d 20 78 29 20 28 64 65 6e 6f 6d 20 79 29 29 29 29 0a 20 20 20 20 | ..(*.(denom.x).(denom.y))))..... |
| 71580 | 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 76 2d 72 61 74 20 78 20 79 29 0a 20 20 20 20 20 20 20 | ...(define.(div-rat.x.y)........ |
| 715a0 | 20 20 28 6d 61 6b 65 2d 72 61 74 20 28 2a 20 28 6e 75 6d 65 72 20 78 29 20 28 64 65 6e 6f 6d 20 | ..(make-rat.(*.(numer.x).(denom. |
| 715c0 | 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 64 65 6e 6f 6d | y))....................(*.(denom |
| 715e0 | 20 78 29 20 28 6e 75 6d 65 72 20 79 29 29 29 29 0a 0a 20 20 20 20 20 20 20 3b 3b 20 69 6e 74 65 | .x).(numer.y)))).........;;.inte |
| 71600 | 72 66 61 63 65 20 74 6f 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 0a 20 20 20 20 | rface.to.rest.of.the.system..... |
| 71620 | 20 20 20 28 64 65 66 69 6e 65 20 28 74 61 67 20 78 29 20 28 61 74 74 61 63 68 2d 74 61 67 20 27 | ...(define.(tag.x).(attach-tag.' |
| 71640 | 72 61 74 69 6f 6e 61 6c 20 78 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 61 64 64 20 27 28 | rational.x))........(put.'add.'( |
| 71660 | 72 61 74 69 6f 6e 61 6c 20 72 61 74 69 6f 6e 61 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | rational.rational).............( |
| 71680 | 6c 61 6d 62 64 61 20 28 78 20 79 29 20 28 74 61 67 20 28 61 64 64 2d 72 61 74 20 78 20 79 29 29 | lambda.(x.y).(tag.(add-rat.x.y)) |
| 716a0 | 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 73 75 62 20 27 28 72 61 74 69 6f 6e 61 6c 20 72 | ))........(put.'sub.'(rational.r |
| 716c0 | 61 74 69 6f 6e 61 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 20 | ational).............(lambda.(x. |
| 716e0 | 79 29 20 28 74 61 67 20 28 73 75 62 2d 72 61 74 20 78 20 79 29 29 29 29 0a 20 20 20 20 20 20 20 | y).(tag.(sub-rat.x.y))))........ |
| 71700 | 28 70 75 74 20 27 6d 75 6c 20 27 28 72 61 74 69 6f 6e 61 6c 20 72 61 74 69 6f 6e 61 6c 29 0a 20 | (put.'mul.'(rational.rational).. |
| 71720 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 20 79 29 20 28 74 61 67 20 28 6d | ...........(lambda.(x.y).(tag.(m |
| 71740 | 75 6c 2d 72 61 74 20 78 20 79 29 29 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 64 69 76 20 | ul-rat.x.y))))........(put.'div. |
| 71760 | 27 28 72 61 74 69 6f 6e 61 6c 20 72 61 74 69 6f 6e 61 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 | '(rational.rational)............ |
| 71780 | 20 28 6c 61 6d 62 64 61 20 28 78 20 79 29 20 28 74 61 67 20 28 64 69 76 2d 72 61 74 20 78 20 79 | .(lambda.(x.y).(tag.(div-rat.x.y |
| 717a0 | 29 29 29 29 0a 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 6d 61 6b 65 20 27 72 61 74 69 6f 6e 61 | )))).........(put.'make.'rationa |
| 717c0 | 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6e 20 64 29 20 28 74 61 67 | l.............(lambda.(n.d).(tag |
| 717e0 | 20 28 6d 61 6b 65 2d 72 61 74 20 6e 20 64 29 29 29 29 0a 20 20 20 20 20 20 20 27 64 6f 6e 65 29 | .(make-rat.n.d))))........'done) |
| 71800 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 72 61 74 69 6f 6e 61 6c 20 6e 20 | .......(define.(make-rational.n. |
| 71820 | 64 29 0a 20 20 20 20 20 20 20 28 28 67 65 74 20 27 6d 61 6b 65 20 27 72 61 74 69 6f 6e 61 6c 29 | d)........((get.'make.'rational) |
| 71840 | 20 6e 20 64 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 69 6e 73 74 61 6c 6c 20 61 20 73 69 6d 69 | .n.d)).....We.can.install.a.simi |
| 71860 | 6c 61 72 20 70 61 63 6b 61 67 65 20 74 6f 20 68 61 6e 64 6c 65 20 63 6f 6d 70 6c 65 78 20 6e 75 | lar.package.to.handle.complex.nu |
| 71880 | 6d 62 65 72 73 2c 20 75 73 69 6e 67 0a 74 68 65 20 74 61 67 20 60 63 6f 6d 70 6c 65 78 27 2e 20 | mbers,.using.the.tag.`complex'.. |
| 718a0 | 20 49 6e 20 63 72 65 61 74 69 6e 67 20 74 68 65 20 70 61 63 6b 61 67 65 2c 20 77 65 20 65 78 74 | .In.creating.the.package,.we.ext |
| 718c0 | 72 61 63 74 20 66 72 6f 6d 20 74 68 65 20 74 61 62 6c 65 0a 74 68 65 20 6f 70 65 72 61 74 69 6f | ract.from.the.table.the.operatio |
| 718e0 | 6e 73 20 60 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 27 20 61 6e 64 20 60 6d 61 | ns.`make-from-real-imag'.and.`ma |
| 71900 | 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 27 20 74 68 61 74 20 77 65 72 65 0a 64 65 66 69 6e | ke-from-mag-ang'.that.were.defin |
| 71920 | 65 64 20 62 79 20 74 68 65 20 72 65 63 74 61 6e 67 75 6c 61 72 20 61 6e 64 20 70 6f 6c 61 72 20 | ed.by.the.rectangular.and.polar. |
| 71940 | 70 61 63 6b 61 67 65 73 2e 20 20 41 64 64 69 74 69 76 69 74 79 20 70 65 72 6d 69 74 73 20 75 73 | packages...Additivity.permits.us |
| 71960 | 0a 74 6f 20 75 73 65 2c 20 61 73 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 6f 70 65 72 61 74 69 | .to.use,.as.the.internal.operati |
| 71980 | 6f 6e 73 2c 20 74 68 65 20 73 61 6d 65 20 60 61 64 64 2d 63 6f 6d 70 6c 65 78 27 2c 0a 60 73 75 | ons,.the.same.`add-complex',.`su |
| 719a0 | 62 2d 63 6f 6d 70 6c 65 78 27 2c 20 60 6d 75 6c 2d 63 6f 6d 70 6c 65 78 27 2c 20 61 6e 64 20 60 | b-complex',.`mul-complex',.and.` |
| 719c0 | 64 69 76 2d 63 6f 6d 70 6c 65 78 27 20 70 72 6f 63 65 64 75 72 65 73 20 66 72 6f 6d 20 73 65 63 | div-complex'.procedures.from.sec |
| 719e0 | 74 69 6f 6e 0a 2a 4e 6f 74 65 20 32 2d 34 2d 31 3a 3a 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | tion.*Note.2-4-1::........(defin |
| 71a00 | 65 20 28 69 6e 73 74 61 6c 6c 2d 63 6f 6d 70 6c 65 78 2d 70 61 63 6b 61 67 65 29 0a 20 20 20 20 | e.(install-complex-package)..... |
| 71a20 | 20 20 20 3b 3b 20 69 6d 70 6f 72 74 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 66 72 6f 6d 20 72 | ...;;.imported.procedures.from.r |
| 71a40 | 65 63 74 61 6e 67 75 6c 61 72 20 61 6e 64 20 70 6f 6c 61 72 20 70 61 63 6b 61 67 65 73 0a 20 20 | ectangular.and.polar.packages... |
| 71a60 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 | .....(define.(make-from-real-ima |
| 71a80 | 67 20 78 20 79 29 0a 20 20 20 20 20 20 20 20 20 28 28 67 65 74 20 27 6d 61 6b 65 2d 66 72 6f 6d | g.x.y)..........((get.'make-from |
| 71aa0 | 2d 72 65 61 6c 2d 69 6d 61 67 20 27 72 65 63 74 61 6e 67 75 6c 61 72 29 20 78 20 79 29 29 0a 20 | -real-imag.'rectangular).x.y)).. |
| 71ac0 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 | ......(define.(make-from-mag-ang |
| 71ae0 | 20 72 20 61 29 0a 20 20 20 20 20 20 20 20 20 28 28 67 65 74 20 27 6d 61 6b 65 2d 66 72 6f 6d 2d | .r.a)..........((get.'make-from- |
| 71b00 | 6d 61 67 2d 61 6e 67 20 27 70 6f 6c 61 72 29 20 72 20 61 29 29 0a 0a 20 20 20 20 20 20 20 3b 3b | mag-ang.'polar).r.a)).........;; |
| 71b20 | 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 20 20 28 64 65 66 | .internal.procedures........(def |
| 71b40 | 69 6e 65 20 28 61 64 64 2d 63 6f 6d 70 6c 65 78 20 7a 31 20 7a 32 29 0a 20 20 20 20 20 20 20 20 | ine.(add-complex.z1.z2)......... |
| 71b60 | 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 28 2b 20 28 72 65 61 6c 2d 70 | .(make-from-real-imag.(+.(real-p |
| 71b80 | 61 72 74 20 7a 31 29 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 32 29 29 0a 20 20 20 20 20 20 20 20 | art.z1).(real-part.z2))......... |
| 71ba0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 69 6d 61 67 2d 70 | ......................(+.(imag-p |
| 71bc0 | 61 72 74 20 7a 31 29 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 32 29 29 29 29 0a 20 20 20 20 20 20 | art.z1).(imag-part.z2))))....... |
| 71be0 | 20 28 64 65 66 69 6e 65 20 28 73 75 62 2d 63 6f 6d 70 6c 65 78 20 7a 31 20 7a 32 29 0a 20 20 20 | .(define.(sub-complex.z1.z2).... |
| 71c00 | 20 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 28 2d 20 28 72 | ......(make-from-real-imag.(-.(r |
| 71c20 | 65 61 6c 2d 70 61 72 74 20 7a 31 29 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 32 29 29 0a 20 20 20 | eal-part.z1).(real-part.z2)).... |
| 71c40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2d 20 28 69 | ...........................(-.(i |
| 71c60 | 6d 61 67 2d 70 61 72 74 20 7a 31 29 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 32 29 29 29 29 0a 20 | mag-part.z1).(imag-part.z2)))).. |
| 71c80 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 2d 63 6f 6d 70 6c 65 78 20 7a 31 20 7a 32 | ......(define.(mul-complex.z1.z2 |
| 71ca0 | 29 0a 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 28 2a | )..........(make-from-mag-ang.(* |
| 71cc0 | 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 31 29 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 32 29 29 0a | .(magnitude.z1).(magnitude.z2)). |
| 71ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 | ............................(+.( |
| 71d00 | 61 6e 67 6c 65 20 7a 31 29 20 28 61 6e 67 6c 65 20 7a 32 29 29 29 29 0a 20 20 20 20 20 20 20 28 | angle.z1).(angle.z2))))........( |
| 71d20 | 64 65 66 69 6e 65 20 28 64 69 76 2d 63 6f 6d 70 6c 65 78 20 7a 31 20 7a 32 29 0a 20 20 20 20 20 | define.(div-complex.z1.z2)...... |
| 71d40 | 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 28 2f 20 28 6d 61 67 6e 69 | ....(make-from-mag-ang.(/.(magni |
| 71d60 | 74 75 64 65 20 7a 31 29 20 28 6d 61 67 6e 69 74 75 64 65 20 7a 32 29 29 0a 20 20 20 20 20 20 20 | tude.z1).(magnitude.z2))........ |
| 71d80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2d 20 28 61 6e 67 6c 65 20 7a | .....................(-.(angle.z |
| 71da0 | 31 29 20 28 61 6e 67 6c 65 20 7a 32 29 29 29 29 0a 0a 20 20 20 20 20 20 20 3b 3b 20 69 6e 74 65 | 1).(angle.z2)))).........;;.inte |
| 71dc0 | 72 66 61 63 65 20 74 6f 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 0a 20 20 20 20 | rface.to.rest.of.the.system..... |
| 71de0 | 20 20 20 28 64 65 66 69 6e 65 20 28 74 61 67 20 7a 29 20 28 61 74 74 61 63 68 2d 74 61 67 20 27 | ...(define.(tag.z).(attach-tag.' |
| 71e00 | 63 6f 6d 70 6c 65 78 20 7a 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 61 64 64 20 27 28 63 | complex.z))........(put.'add.'(c |
| 71e20 | 6f 6d 70 6c 65 78 20 63 6f 6d 70 6c 65 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d | omplex.complex).............(lam |
| 71e40 | 62 64 61 20 28 7a 31 20 7a 32 29 20 28 74 61 67 20 28 61 64 64 2d 63 6f 6d 70 6c 65 78 20 7a 31 | bda.(z1.z2).(tag.(add-complex.z1 |
| 71e60 | 20 7a 32 29 29 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 73 75 62 20 27 28 63 6f 6d 70 6c | .z2))))........(put.'sub.'(compl |
| 71e80 | 65 78 20 63 6f 6d 70 6c 65 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 | ex.complex).............(lambda. |
| 71ea0 | 28 7a 31 20 7a 32 29 20 28 74 61 67 20 28 73 75 62 2d 63 6f 6d 70 6c 65 78 20 7a 31 20 7a 32 29 | (z1.z2).(tag.(sub-complex.z1.z2) |
| 71ec0 | 29 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 6d 75 6c 20 27 28 63 6f 6d 70 6c 65 78 20 63 | )))........(put.'mul.'(complex.c |
| 71ee0 | 6f 6d 70 6c 65 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 7a 31 20 | omplex).............(lambda.(z1. |
| 71f00 | 7a 32 29 20 28 74 61 67 20 28 6d 75 6c 2d 63 6f 6d 70 6c 65 78 20 7a 31 20 7a 32 29 29 29 29 0a | z2).(tag.(mul-complex.z1.z2)))). |
| 71f20 | 20 20 20 20 20 20 20 28 70 75 74 20 27 64 69 76 20 27 28 63 6f 6d 70 6c 65 78 20 63 6f 6d 70 6c | .......(put.'div.'(complex.compl |
| 71f40 | 65 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 7a 31 20 7a 32 29 20 | ex).............(lambda.(z1.z2). |
| 71f60 | 28 74 61 67 20 28 64 69 76 2d 63 6f 6d 70 6c 65 78 20 7a 31 20 7a 32 29 29 29 29 0a 20 20 20 20 | (tag.(div-complex.z1.z2))))..... |
| 71f80 | 20 20 20 28 70 75 74 20 27 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 27 63 6f | ...(put.'make-from-real-imag.'co |
| 71fa0 | 6d 70 6c 65 78 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 20 79 29 20 | mplex.............(lambda.(x.y). |
| 71fc0 | 28 74 61 67 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 78 20 79 29 29 29 | (tag.(make-from-real-imag.x.y))) |
| 71fe0 | 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 | )........(put.'make-from-mag-ang |
| 72000 | 20 27 63 6f 6d 70 6c 65 78 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 72 | .'complex.............(lambda.(r |
| 72020 | 20 61 29 20 28 74 61 67 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 6d 61 67 2d 61 6e 67 20 72 20 61 29 | .a).(tag.(make-from-mag-ang.r.a) |
| 72040 | 29 29 29 0a 20 20 20 20 20 20 20 27 64 6f 6e 65 29 0a 0a 20 20 20 50 72 6f 67 72 61 6d 73 20 6f | )))........'done).....Programs.o |
| 72060 | 75 74 73 69 64 65 20 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 20 70 61 63 6b 61 67 | utside.the.complex-number.packag |
| 72080 | 65 20 63 61 6e 20 63 6f 6e 73 74 72 75 63 74 20 63 6f 6d 70 6c 65 78 0a 6e 75 6d 62 65 72 73 20 | e.can.construct.complex.numbers. |
| 720a0 | 65 69 74 68 65 72 20 66 72 6f 6d 20 72 65 61 6c 20 61 6e 64 20 69 6d 61 67 69 6e 61 72 79 20 70 | either.from.real.and.imaginary.p |
| 720c0 | 61 72 74 73 20 6f 72 20 66 72 6f 6d 20 6d 61 67 6e 69 74 75 64 65 73 20 61 6e 64 0a 61 6e 67 6c | arts.or.from.magnitudes.and.angl |
| 720e0 | 65 73 2e 20 20 4e 6f 74 69 63 65 20 68 6f 77 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 70 | es...Notice.how.the.underlying.p |
| 72100 | 72 6f 63 65 64 75 72 65 73 2c 20 6f 72 69 67 69 6e 61 6c 6c 79 20 64 65 66 69 6e 65 64 20 69 6e | rocedures,.originally.defined.in |
| 72120 | 0a 74 68 65 20 72 65 63 74 61 6e 67 75 6c 61 72 20 61 6e 64 20 70 6f 6c 61 72 20 70 61 63 6b 61 | .the.rectangular.and.polar.packa |
| 72140 | 67 65 73 2c 20 61 72 65 20 65 78 70 6f 72 74 65 64 20 74 6f 20 74 68 65 20 63 6f 6d 70 6c 65 78 | ges,.are.exported.to.the.complex |
| 72160 | 0a 70 61 63 6b 61 67 65 2c 20 61 6e 64 20 65 78 70 6f 72 74 65 64 20 66 72 6f 6d 20 74 68 65 72 | .package,.and.exported.from.ther |
| 72180 | 65 20 74 6f 20 74 68 65 20 6f 75 74 73 69 64 65 20 77 6f 72 6c 64 2e 0a 0a 20 20 20 20 20 28 64 | e.to.the.outside.world........(d |
| 721a0 | 65 66 69 6e 65 20 28 6d 61 6b 65 2d 63 6f 6d 70 6c 65 78 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d | efine.(make-complex-from-real-im |
| 721c0 | 61 67 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 28 67 65 74 20 27 6d 61 6b 65 2d 66 72 6f 6d 2d | ag.x.y)........((get.'make-from- |
| 721e0 | 72 65 61 6c 2d 69 6d 61 67 20 27 63 6f 6d 70 6c 65 78 29 20 78 20 79 29 29 0a 0a 20 20 20 20 20 | real-imag.'complex).x.y))....... |
| 72200 | 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 63 6f 6d 70 6c 65 78 2d 66 72 6f 6d 2d 6d 61 67 2d 61 | (define.(make-complex-from-mag-a |
| 72220 | 6e 67 20 72 20 61 29 0a 20 20 20 20 20 20 20 28 28 67 65 74 20 27 6d 61 6b 65 2d 66 72 6f 6d 2d | ng.r.a)........((get.'make-from- |
| 72240 | 6d 61 67 2d 61 6e 67 20 27 63 6f 6d 70 6c 65 78 29 20 72 20 61 29 29 0a 0a 20 20 20 57 68 61 74 | mag-ang.'complex).r.a)).....What |
| 72260 | 20 77 65 20 68 61 76 65 20 68 65 72 65 20 69 73 20 61 20 74 77 6f 2d 6c 65 76 65 6c 20 74 61 67 | .we.have.here.is.a.two-level.tag |
| 72280 | 20 73 79 73 74 65 6d 2e 20 20 41 20 74 79 70 69 63 61 6c 20 63 6f 6d 70 6c 65 78 0a 6e 75 6d 62 | .system...A.typical.complex.numb |
| 722a0 | 65 72 2c 20 73 75 63 68 20 61 73 20 33 20 2b 20 34 69 20 69 6e 20 72 65 63 74 61 6e 67 75 6c 61 | er,.such.as.3.+.4i.in.rectangula |
| 722c0 | 72 20 66 6f 72 6d 2c 20 77 6f 75 6c 64 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 0a | r.form,.would.be.represented.as. |
| 722e0 | 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 32 34 3a 3a 2e 20 20 54 | shown.in.*Note.Figure.2-24::...T |
| 72300 | 68 65 20 6f 75 74 65 72 20 74 61 67 20 28 60 63 6f 6d 70 6c 65 78 27 29 20 69 73 20 75 73 65 64 | he.outer.tag.(`complex').is.used |
| 72320 | 20 74 6f 0a 64 69 72 65 63 74 20 74 68 65 20 6e 75 6d 62 65 72 20 74 6f 20 74 68 65 20 63 6f 6d | .to.direct.the.number.to.the.com |
| 72340 | 70 6c 65 78 20 70 61 63 6b 61 67 65 2e 20 20 4f 6e 63 65 20 77 69 74 68 69 6e 20 74 68 65 20 63 | plex.package...Once.within.the.c |
| 72360 | 6f 6d 70 6c 65 78 0a 70 61 63 6b 61 67 65 2c 20 74 68 65 20 6e 65 78 74 20 74 61 67 20 28 60 72 | omplex.package,.the.next.tag.(`r |
| 72380 | 65 63 74 61 6e 67 75 6c 61 72 27 29 20 69 73 20 75 73 65 64 20 74 6f 20 64 69 72 65 63 74 20 74 | ectangular').is.used.to.direct.t |
| 723a0 | 68 65 20 6e 75 6d 62 65 72 20 74 6f 0a 74 68 65 20 72 65 63 74 61 6e 67 75 6c 61 72 20 70 61 63 | he.number.to.the.rectangular.pac |
| 723c0 | 6b 61 67 65 2e 20 20 49 6e 20 61 20 6c 61 72 67 65 20 61 6e 64 20 63 6f 6d 70 6c 69 63 61 74 65 | kage...In.a.large.and.complicate |
| 723e0 | 64 20 73 79 73 74 65 6d 20 74 68 65 72 65 20 6d 69 67 68 74 0a 62 65 20 6d 61 6e 79 20 6c 65 76 | d.system.there.might.be.many.lev |
| 72400 | 65 6c 73 2c 20 65 61 63 68 20 69 6e 74 65 72 66 61 63 65 64 20 77 69 74 68 20 74 68 65 20 6e 65 | els,.each.interfaced.with.the.ne |
| 72420 | 78 74 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 67 65 6e 65 72 69 63 0a 6f 70 65 72 61 74 69 6f 6e | xt.by.means.of.generic.operation |
| 72440 | 73 2e 20 20 41 73 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 20 69 73 20 70 61 73 73 65 64 20 22 | s...As.a.data.object.is.passed." |
| 72460 | 64 6f 77 6e 77 61 72 64 2c 22 20 74 68 65 20 6f 75 74 65 72 20 74 61 67 20 74 68 61 74 0a 69 73 | downward,".the.outer.tag.that.is |
| 72480 | 20 75 73 65 64 20 74 6f 20 64 69 72 65 63 74 20 69 74 20 74 6f 20 74 68 65 20 61 70 70 72 6f 70 | .used.to.direct.it.to.the.approp |
| 724a0 | 72 69 61 74 65 20 70 61 63 6b 61 67 65 20 69 73 20 73 74 72 69 70 70 65 64 20 6f 66 66 20 28 62 | riate.package.is.stripped.off.(b |
| 724c0 | 79 0a 61 70 70 6c 79 69 6e 67 20 60 63 6f 6e 74 65 6e 74 73 27 29 20 61 6e 64 20 74 68 65 20 6e | y.applying.`contents').and.the.n |
| 724e0 | 65 78 74 20 6c 65 76 65 6c 20 6f 66 20 74 61 67 20 28 69 66 20 61 6e 79 29 20 62 65 63 6f 6d 65 | ext.level.of.tag.(if.any).become |
| 72500 | 73 20 76 69 73 69 62 6c 65 0a 74 6f 20 62 65 20 75 73 65 64 20 66 6f 72 20 66 75 72 74 68 65 72 | s.visible.to.be.used.for.further |
| 72520 | 20 64 69 73 70 61 74 63 68 69 6e 67 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e 32 34 | .dispatching........*Figure.2.24 |
| 72540 | 3a 2a 20 52 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 33 20 2b 20 34 69 20 69 6e 20 72 | :*.Representation.of.3.+.4i.in.r |
| 72560 | 65 63 74 61 6e 67 75 6c 61 72 20 66 6f 72 6d 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ectangular.form................. |
| 72580 | 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d | .+---+---+.....+---+---+.....+-- |
| 725a0 | 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d | -+---+...........---->|.*.|.*-+- |
| 725c0 | 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 20 7c 0a 20 20 20 20 | --->|.*.|.*-+---->|.*.|.*.|..... |
| 725e0 | 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d | ...........+-|-+---+.....+-|-+-- |
| 72600 | 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -+.....+-|-+-|-+................ |
| 72620 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ..|.............|.............|. |
| 72640 | 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 | ..|..................V.......... |
| 72660 | 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 | ...V.............V...V.......... |
| 72680 | 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 | ..+---------+...+-------------+. |
| 726a0 | 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 63 6f 6d 70 6c 65 | .+---+.+---+............|.comple |
| 726c0 | 78 20 7c 20 20 20 7c 20 72 65 63 74 61 6e 67 75 6c 61 72 20 7c 20 20 7c 20 33 20 7c 20 7c 20 34 | x.|...|.rectangular.|..|.3.|.|.4 |
| 726e0 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d | .|............+---------+...+--- |
| 72700 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 49 6e 20 | ----------+..+---+.+---+.....In. |
| 72720 | 74 68 65 20 61 62 6f 76 65 20 70 61 63 6b 61 67 65 73 2c 20 77 65 20 75 73 65 64 20 60 61 64 64 | the.above.packages,.we.used.`add |
| 72740 | 2d 72 61 74 27 2c 20 60 61 64 64 2d 63 6f 6d 70 6c 65 78 27 2c 20 61 6e 64 20 74 68 65 0a 6f 74 | -rat',.`add-complex',.and.the.ot |
| 72760 | 68 65 72 20 61 72 69 74 68 6d 65 74 69 63 20 70 72 6f 63 65 64 75 72 65 73 20 65 78 61 63 74 6c | her.arithmetic.procedures.exactl |
| 72780 | 79 20 61 73 20 6f 72 69 67 69 6e 61 6c 6c 79 20 77 72 69 74 74 65 6e 2e 20 20 4f 6e 63 65 20 74 | y.as.originally.written...Once.t |
| 727a0 | 68 65 73 65 0a 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 69 6e 74 65 72 6e 61 6c 20 74 6f | hese.definitions.are.internal.to |
| 727c0 | 20 64 69 66 66 65 72 65 6e 74 20 69 6e 73 74 61 6c 6c 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 | .different.installation.procedur |
| 727e0 | 65 73 2c 20 68 6f 77 65 76 65 72 2c 0a 74 68 65 79 20 6e 6f 20 6c 6f 6e 67 65 72 20 6e 65 65 64 | es,.however,.they.no.longer.need |
| 72800 | 20 6e 61 6d 65 73 20 74 68 61 74 20 61 72 65 20 64 69 73 74 69 6e 63 74 20 66 72 6f 6d 20 65 61 | .names.that.are.distinct.from.ea |
| 72820 | 63 68 20 6f 74 68 65 72 3a 20 77 65 20 63 6f 75 6c 64 0a 73 69 6d 70 6c 79 20 6e 61 6d 65 20 74 | ch.other:.we.could.simply.name.t |
| 72840 | 68 65 6d 20 60 61 64 64 27 2c 20 60 73 75 62 27 2c 20 60 6d 75 6c 27 2c 20 61 6e 64 20 60 64 69 | hem.`add',.`sub',.`mul',.and.`di |
| 72860 | 76 27 20 69 6e 20 62 6f 74 68 20 70 61 63 6b 61 67 65 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 | v'.in.both.packages........*Exer |
| 72880 | 63 69 73 65 20 32 2e 37 37 3a 2a 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 20 74 72 69 65 73 | cise.2.77:*.Louis.Reasoner.tries |
| 728a0 | 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 20 20 20 20 | .to.evaluate.the.expression..... |
| 728c0 | 20 60 28 6d 61 67 6e 69 74 75 64 65 20 7a 29 27 20 77 68 65 72 65 20 60 7a 27 20 69 73 20 74 68 | .`(magnitude.z)'.where.`z'.is.th |
| 728e0 | 65 20 6f 62 6a 65 63 74 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a 20 | e.object.shown.in.*Note.Figure.. |
| 72900 | 20 20 20 20 32 2d 32 34 3a 3a 2e 20 20 54 6f 20 68 69 73 20 73 75 72 70 72 69 73 65 2c 20 69 6e | ....2-24::...To.his.surprise,.in |
| 72920 | 73 74 65 61 64 20 6f 66 20 74 68 65 20 61 6e 73 77 65 72 20 35 20 68 65 20 67 65 74 73 20 61 6e | stead.of.the.answer.5.he.gets.an |
| 72940 | 20 65 72 72 6f 72 0a 20 20 20 20 20 6d 65 73 73 61 67 65 20 66 72 6f 6d 20 60 61 70 70 6c 79 2d | .error......message.from.`apply- |
| 72960 | 67 65 6e 65 72 69 63 27 2c 20 73 61 79 69 6e 67 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6d 65 74 | generic',.saying.there.is.no.met |
| 72980 | 68 6f 64 20 66 6f 72 20 74 68 65 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 20 60 6d 61 67 6e | hod.for.the......operation.`magn |
| 729a0 | 69 74 75 64 65 27 20 6f 6e 20 74 68 65 20 74 79 70 65 73 20 60 28 63 6f 6d 70 6c 65 78 29 27 2e | itude'.on.the.types.`(complex)'. |
| 729c0 | 20 20 48 65 20 73 68 6f 77 73 20 74 68 69 73 0a 20 20 20 20 20 69 6e 74 65 72 61 63 74 69 6f 6e | ..He.shows.this......interaction |
| 729e0 | 20 74 6f 20 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 2c 20 77 68 6f 20 73 61 79 73 20 22 | .to.Alyssa.P..Hacker,.who.says." |
| 72a00 | 54 68 65 20 70 72 6f 62 6c 65 6d 20 69 73 20 74 68 61 74 20 74 68 65 0a 20 20 20 20 20 63 6f 6d | The.problem.is.that.the......com |
| 72a20 | 70 6c 65 78 2d 6e 75 6d 62 65 72 20 73 65 6c 65 63 74 6f 72 73 20 77 65 72 65 20 6e 65 76 65 72 | plex-number.selectors.were.never |
| 72a40 | 20 64 65 66 69 6e 65 64 20 66 6f 72 20 60 63 6f 6d 70 6c 65 78 27 20 6e 75 6d 62 65 72 73 2c 0a | .defined.for.`complex'.numbers,. |
| 72a60 | 20 20 20 20 20 6a 75 73 74 20 66 6f 72 20 60 70 6f 6c 61 72 27 20 61 6e 64 20 60 72 65 63 74 61 | .....just.for.`polar'.and.`recta |
| 72a80 | 6e 67 75 6c 61 72 27 20 6e 75 6d 62 65 72 73 2e 20 20 41 6c 6c 20 79 6f 75 20 68 61 76 65 20 74 | ngular'.numbers...All.you.have.t |
| 72aa0 | 6f 20 64 6f 20 74 6f 0a 20 20 20 20 20 6d 61 6b 65 20 74 68 69 73 20 77 6f 72 6b 20 69 73 20 61 | o.do.to......make.this.work.is.a |
| 72ac0 | 64 64 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 6f 20 74 68 65 20 60 63 6f 6d 70 6c 65 78 | dd.the.following.to.the.`complex |
| 72ae0 | 27 20 70 61 63 6b 61 67 65 3a 22 0a 0a 20 20 20 20 20 20 20 20 20 20 28 70 75 74 20 27 72 65 61 | '.package:"............(put.'rea |
| 72b00 | 6c 2d 70 61 72 74 20 27 28 63 6f 6d 70 6c 65 78 29 20 72 65 61 6c 2d 70 61 72 74 29 0a 20 20 20 | l-part.'(complex).real-part).... |
| 72b20 | 20 20 20 20 20 20 20 28 70 75 74 20 27 69 6d 61 67 2d 70 61 72 74 20 27 28 63 6f 6d 70 6c 65 78 | .......(put.'imag-part.'(complex |
| 72b40 | 29 20 69 6d 61 67 2d 70 61 72 74 29 0a 20 20 20 20 20 20 20 20 20 20 28 70 75 74 20 27 6d 61 67 | ).imag-part)...........(put.'mag |
| 72b60 | 6e 69 74 75 64 65 20 27 28 63 6f 6d 70 6c 65 78 29 20 6d 61 67 6e 69 74 75 64 65 29 0a 20 20 20 | nitude.'(complex).magnitude).... |
| 72b80 | 20 20 20 20 20 20 20 28 70 75 74 20 27 61 6e 67 6c 65 20 27 28 63 6f 6d 70 6c 65 78 29 20 61 6e | .......(put.'angle.'(complex).an |
| 72ba0 | 67 6c 65 29 0a 0a 20 20 20 20 20 44 65 73 63 72 69 62 65 20 69 6e 20 64 65 74 61 69 6c 20 77 68 | gle).......Describe.in.detail.wh |
| 72bc0 | 79 20 74 68 69 73 20 77 6f 72 6b 73 2e 20 20 41 73 20 61 6e 20 65 78 61 6d 70 6c 65 2c 20 74 72 | y.this.works...As.an.example,.tr |
| 72be0 | 61 63 65 20 74 68 72 6f 75 67 68 0a 20 20 20 20 20 61 6c 6c 20 74 68 65 20 70 72 6f 63 65 64 75 | ace.through......all.the.procedu |
| 72c00 | 72 65 73 20 63 61 6c 6c 65 64 20 69 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 | res.called.in.evaluating.the.exp |
| 72c20 | 72 65 73 73 69 6f 6e 20 60 28 6d 61 67 6e 69 74 75 64 65 0a 20 20 20 20 20 7a 29 27 20 77 68 65 | ression.`(magnitude......z)'.whe |
| 72c40 | 72 65 20 60 7a 27 20 69 73 20 74 68 65 20 6f 62 6a 65 63 74 20 73 68 6f 77 6e 20 69 6e 20 2a 4e | re.`z'.is.the.object.shown.in.*N |
| 72c60 | 6f 74 65 20 46 69 67 75 72 65 20 32 2d 32 34 3a 3a 2e 20 20 49 6e 0a 20 20 20 20 20 70 61 72 74 | ote.Figure.2-24::...In......part |
| 72c80 | 69 63 75 6c 61 72 2c 20 68 6f 77 20 6d 61 6e 79 20 74 69 6d 65 73 20 69 73 20 60 61 70 70 6c 79 | icular,.how.many.times.is.`apply |
| 72ca0 | 2d 67 65 6e 65 72 69 63 27 20 69 6e 76 6f 6b 65 64 3f 20 20 57 68 61 74 0a 20 20 20 20 20 70 72 | -generic'.invoked?..What......pr |
| 72cc0 | 6f 63 65 64 75 72 65 20 69 73 20 64 69 73 70 61 74 63 68 65 64 20 74 6f 20 69 6e 20 65 61 63 68 | ocedure.is.dispatched.to.in.each |
| 72ce0 | 20 63 61 73 65 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 37 38 3a 2a 20 54 68 | .case?.......*Exercise.2.78:*.Th |
| 72d00 | 65 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 65 20 60 73 63 | e.internal.procedures.in.the.`sc |
| 72d20 | 68 65 6d 65 2d 6e 75 6d 62 65 72 27 0a 20 20 20 20 20 70 61 63 6b 61 67 65 20 61 72 65 20 65 73 | heme-number'......package.are.es |
| 72d40 | 73 65 6e 74 69 61 6c 6c 79 20 6e 6f 74 68 69 6e 67 20 6d 6f 72 65 20 74 68 61 6e 20 63 61 6c 6c | sentially.nothing.more.than.call |
| 72d60 | 73 20 74 6f 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 | s.to.the.primitive......procedur |
| 72d80 | 65 73 20 60 2b 27 2c 20 60 2d 27 2c 20 65 74 63 2e 20 20 49 74 20 77 61 73 20 6e 6f 74 20 70 6f | es.`+',.`-',.etc...It.was.not.po |
| 72da0 | 73 73 69 62 6c 65 20 74 6f 20 75 73 65 20 74 68 65 0a 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 | ssible.to.use.the......primitive |
| 72dc0 | 73 20 6f 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 64 69 72 65 63 74 6c 79 20 62 65 63 61 75 | s.of.the.language.directly.becau |
| 72de0 | 73 65 20 6f 75 72 20 74 79 70 65 2d 74 61 67 20 73 79 73 74 65 6d 0a 20 20 20 20 20 72 65 71 75 | se.our.type-tag.system......requ |
| 72e00 | 69 72 65 73 20 74 68 61 74 20 65 61 63 68 20 64 61 74 61 20 6f 62 6a 65 63 74 20 68 61 76 65 20 | ires.that.each.data.object.have. |
| 72e20 | 61 20 74 79 70 65 20 61 74 74 61 63 68 65 64 20 74 6f 20 69 74 2e 20 20 49 6e 0a 20 20 20 20 20 | a.type.attached.to.it...In...... |
| 72e40 | 66 61 63 74 2c 20 68 6f 77 65 76 65 72 2c 20 61 6c 6c 20 4c 69 73 70 20 69 6d 70 6c 65 6d 65 6e | fact,.however,.all.Lisp.implemen |
| 72e60 | 74 61 74 69 6f 6e 73 20 64 6f 20 68 61 76 65 20 61 20 74 79 70 65 20 73 79 73 74 65 6d 2c 0a 20 | tations.do.have.a.type.system,.. |
| 72e80 | 20 20 20 20 77 68 69 63 68 20 74 68 65 79 20 75 73 65 20 69 6e 74 65 72 6e 61 6c 6c 79 2e 20 20 | ....which.they.use.internally... |
| 72ea0 | 50 72 69 6d 69 74 69 76 65 20 70 72 65 64 69 63 61 74 65 73 20 73 75 63 68 20 61 73 20 60 73 79 | Primitive.predicates.such.as.`sy |
| 72ec0 | 6d 62 6f 6c 3f 27 0a 20 20 20 20 20 61 6e 64 20 60 6e 75 6d 62 65 72 3f 27 20 20 64 65 74 65 72 | mbol?'......and.`number?'..deter |
| 72ee0 | 6d 69 6e 65 20 77 68 65 74 68 65 72 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 68 61 76 65 20 70 | mine.whether.data.objects.have.p |
| 72f00 | 61 72 74 69 63 75 6c 61 72 0a 20 20 20 20 20 74 79 70 65 73 2e 20 20 4d 6f 64 69 66 79 20 74 68 | articular......types...Modify.th |
| 72f20 | 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 60 74 79 70 65 2d 74 61 67 27 2c 20 60 63 6f | e.definitions.of.`type-tag',.`co |
| 72f40 | 6e 74 65 6e 74 73 27 2c 20 61 6e 64 0a 20 20 20 20 20 60 61 74 74 61 63 68 2d 74 61 67 27 20 66 | ntents',.and......`attach-tag'.f |
| 72f60 | 72 6f 6d 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 32 3a 3a 20 73 6f 20 74 68 61 | rom.section.*Note.2-4-2::.so.tha |
| 72f80 | 74 20 6f 75 72 20 67 65 6e 65 72 69 63 20 73 79 73 74 65 6d 0a 20 20 20 20 20 74 61 6b 65 73 20 | t.our.generic.system......takes. |
| 72fa0 | 61 64 76 61 6e 74 61 67 65 20 6f 66 20 53 63 68 65 6d 65 27 73 20 69 6e 74 65 72 6e 61 6c 20 74 | advantage.of.Scheme's.internal.t |
| 72fc0 | 79 70 65 20 73 79 73 74 65 6d 2e 20 20 54 68 61 74 20 69 73 20 74 6f 20 73 61 79 2c 0a 20 20 20 | ype.system...That.is.to.say,.... |
| 72fe0 | 20 20 74 68 65 20 73 79 73 74 65 6d 20 73 68 6f 75 6c 64 20 77 6f 72 6b 20 61 73 20 62 65 66 6f | ..the.system.should.work.as.befo |
| 73000 | 72 65 20 65 78 63 65 70 74 20 74 68 61 74 20 6f 72 64 69 6e 61 72 79 20 6e 75 6d 62 65 72 73 0a | re.except.that.ordinary.numbers. |
| 73020 | 20 20 20 20 20 73 68 6f 75 6c 64 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 73 69 6d 70 6c | .....should.be.represented.simpl |
| 73040 | 79 20 61 73 20 53 63 68 65 6d 65 20 6e 75 6d 62 65 72 73 20 72 61 74 68 65 72 20 74 68 61 6e 20 | y.as.Scheme.numbers.rather.than. |
| 73060 | 61 73 0a 20 20 20 20 20 70 61 69 72 73 20 77 68 6f 73 65 20 60 63 61 72 27 20 69 73 20 74 68 65 | as......pairs.whose.`car'.is.the |
| 73080 | 20 73 79 6d 62 6f 6c 20 60 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 27 2e 0a 0a 20 20 20 20 20 2a | .symbol.`scheme-number'........* |
| 730a0 | 45 78 65 72 63 69 73 65 20 32 2e 37 39 3a 2a 20 44 65 66 69 6e 65 20 61 20 67 65 6e 65 72 69 63 | Exercise.2.79:*.Define.a.generic |
| 730c0 | 20 65 71 75 61 6c 69 74 79 20 70 72 65 64 69 63 61 74 65 20 60 65 71 75 3f 27 20 74 68 61 74 0a | .equality.predicate.`equ?'.that. |
| 730e0 | 20 20 20 20 20 74 65 73 74 73 20 74 68 65 20 65 71 75 61 6c 69 74 79 20 6f 66 20 74 77 6f 20 6e | .....tests.the.equality.of.two.n |
| 73100 | 75 6d 62 65 72 73 2c 20 61 6e 64 20 69 6e 73 74 61 6c 6c 20 69 74 20 69 6e 20 74 68 65 20 67 65 | umbers,.and.install.it.in.the.ge |
| 73120 | 6e 65 72 69 63 0a 20 20 20 20 20 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 2e 20 20 | neric......arithmetic.package... |
| 73140 | 54 68 69 73 20 6f 70 65 72 61 74 69 6f 6e 20 73 68 6f 75 6c 64 20 77 6f 72 6b 20 66 6f 72 20 6f | This.operation.should.work.for.o |
| 73160 | 72 64 69 6e 61 72 79 0a 20 20 20 20 20 6e 75 6d 62 65 72 73 2c 20 72 61 74 69 6f 6e 61 6c 20 6e | rdinary......numbers,.rational.n |
| 73180 | 75 6d 62 65 72 73 2c 20 61 6e 64 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2e 0a 0a 20 20 | umbers,.and.complex.numbers..... |
| 731a0 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 38 30 3a 2a 20 44 65 66 69 6e 65 20 61 20 67 65 6e | ...*Exercise.2.80:*.Define.a.gen |
| 731c0 | 65 72 69 63 20 70 72 65 64 69 63 61 74 65 20 60 3d 7a 65 72 6f 3f 27 20 74 68 61 74 20 74 65 73 | eric.predicate.`=zero?'.that.tes |
| 731e0 | 74 73 20 69 66 0a 20 20 20 20 20 69 74 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20 7a 65 72 6f 2c | ts.if......its.argument.is.zero, |
| 73200 | 20 61 6e 64 20 69 6e 73 74 61 6c 6c 20 69 74 20 69 6e 20 74 68 65 20 67 65 6e 65 72 69 63 20 61 | .and.install.it.in.the.generic.a |
| 73220 | 72 69 74 68 6d 65 74 69 63 0a 20 20 20 20 20 70 61 63 6b 61 67 65 2e 20 20 54 68 69 73 20 6f 70 | rithmetic......package...This.op |
| 73240 | 65 72 61 74 69 6f 6e 20 73 68 6f 75 6c 64 20 77 6f 72 6b 20 66 6f 72 20 6f 72 64 69 6e 61 72 79 | eration.should.work.for.ordinary |
| 73260 | 20 6e 75 6d 62 65 72 73 2c 20 72 61 74 69 6f 6e 61 6c 0a 20 20 20 20 20 6e 75 6d 62 65 72 73 2c | .numbers,.rational......numbers, |
| 73280 | 20 61 6e 64 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 | .and.complex.numbers.....File:.s |
| 732a0 | 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 35 2d 32 2c 20 20 4e 65 78 74 3a 20 32 | icp.info,..Node:.2-5-2,..Next:.2 |
| 732c0 | 2d 35 2d 33 2c 20 20 50 72 65 76 3a 20 32 2d 35 2d 31 2c 20 20 55 70 3a 20 32 2d 35 0a 0a 32 2e | -5-3,..Prev:.2-5-1,..Up:.2-5..2. |
| 732e0 | 35 2e 32 20 43 6f 6d 62 69 6e 69 6e 67 20 44 61 74 61 20 6f 66 20 44 69 66 66 65 72 65 6e 74 20 | 5.2.Combining.Data.of.Different. |
| 73300 | 54 79 70 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | Types.-------------------------- |
| 73320 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 65 20 68 61 76 65 20 73 65 65 6e 20 68 6f 77 20 | -------------..We.have.seen.how. |
| 73340 | 74 6f 20 64 65 66 69 6e 65 20 61 20 75 6e 69 66 69 65 64 20 61 72 69 74 68 6d 65 74 69 63 20 73 | to.define.a.unified.arithmetic.s |
| 73360 | 79 73 74 65 6d 20 74 68 61 74 20 65 6e 63 6f 6d 70 61 73 73 65 73 0a 6f 72 64 69 6e 61 72 79 20 | ystem.that.encompasses.ordinary. |
| 73380 | 6e 75 6d 62 65 72 73 2c 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2c 20 72 61 74 69 6f 6e | numbers,.complex.numbers,.ration |
| 733a0 | 61 6c 20 6e 75 6d 62 65 72 73 2c 20 61 6e 64 20 61 6e 79 20 6f 74 68 65 72 20 74 79 70 65 0a 6f | al.numbers,.and.any.other.type.o |
| 733c0 | 66 20 6e 75 6d 62 65 72 20 77 65 20 6d 69 67 68 74 20 64 65 63 69 64 65 20 74 6f 20 69 6e 76 65 | f.number.we.might.decide.to.inve |
| 733e0 | 6e 74 2c 20 62 75 74 20 77 65 20 68 61 76 65 20 69 67 6e 6f 72 65 64 20 61 6e 20 69 6d 70 6f 72 | nt,.but.we.have.ignored.an.impor |
| 73400 | 74 61 6e 74 0a 69 73 73 75 65 2e 20 20 54 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 65 20 68 | tant.issue...The.operations.we.h |
| 73420 | 61 76 65 20 64 65 66 69 6e 65 64 20 73 6f 20 66 61 72 20 74 72 65 61 74 20 74 68 65 20 64 69 66 | ave.defined.so.far.treat.the.dif |
| 73440 | 66 65 72 65 6e 74 20 64 61 74 61 0a 74 79 70 65 73 20 61 73 20 62 65 69 6e 67 20 63 6f 6d 70 6c | ferent.data.types.as.being.compl |
| 73460 | 65 74 65 6c 79 20 69 6e 64 65 70 65 6e 64 65 6e 74 2e 20 20 54 68 75 73 2c 20 74 68 65 72 65 20 | etely.independent...Thus,.there. |
| 73480 | 61 72 65 20 73 65 70 61 72 61 74 65 0a 70 61 63 6b 61 67 65 73 20 66 6f 72 20 61 64 64 69 6e 67 | are.separate.packages.for.adding |
| 734a0 | 2c 20 73 61 79 2c 20 74 77 6f 20 6f 72 64 69 6e 61 72 79 20 6e 75 6d 62 65 72 73 2c 20 6f 72 20 | ,.say,.two.ordinary.numbers,.or. |
| 734c0 | 74 77 6f 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2e 0a 57 68 61 74 20 77 65 20 68 61 76 | two.complex.numbers..What.we.hav |
| 734e0 | 65 20 6e 6f 74 20 79 65 74 20 63 6f 6e 73 69 64 65 72 65 64 20 69 73 20 74 68 65 20 66 61 63 74 | e.not.yet.considered.is.the.fact |
| 73500 | 20 74 68 61 74 20 69 74 20 69 73 20 6d 65 61 6e 69 6e 67 66 75 6c 20 74 6f 0a 64 65 66 69 6e 65 | .that.it.is.meaningful.to.define |
| 73520 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 63 72 6f 73 73 20 74 68 65 20 74 79 70 65 20 | .operations.that.cross.the.type. |
| 73540 | 62 6f 75 6e 64 61 72 69 65 73 2c 20 73 75 63 68 20 61 73 20 74 68 65 20 61 64 64 69 74 69 6f 6e | boundaries,.such.as.the.addition |
| 73560 | 0a 6f 66 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 74 6f 20 61 6e 20 6f 72 64 69 6e | .of.a.complex.number.to.an.ordin |
| 73580 | 61 72 79 20 6e 75 6d 62 65 72 2e 20 20 57 65 20 68 61 76 65 20 67 6f 6e 65 20 74 6f 20 67 72 65 | ary.number...We.have.gone.to.gre |
| 735a0 | 61 74 20 70 61 69 6e 73 0a 74 6f 20 69 6e 74 72 6f 64 75 63 65 20 62 61 72 72 69 65 72 73 20 62 | at.pains.to.introduce.barriers.b |
| 735c0 | 65 74 77 65 65 6e 20 70 61 72 74 73 20 6f 66 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 73 6f 20 | etween.parts.of.our.programs.so. |
| 735e0 | 74 68 61 74 20 74 68 65 79 20 63 61 6e 20 62 65 0a 64 65 76 65 6c 6f 70 65 64 20 61 6e 64 20 75 | that.they.can.be.developed.and.u |
| 73600 | 6e 64 65 72 73 74 6f 6f 64 20 73 65 70 61 72 61 74 65 6c 79 2e 20 20 57 65 20 77 6f 75 6c 64 20 | nderstood.separately...We.would. |
| 73620 | 6c 69 6b 65 20 74 6f 20 69 6e 74 72 6f 64 75 63 65 20 74 68 65 0a 63 72 6f 73 73 2d 74 79 70 65 | like.to.introduce.the.cross-type |
| 73640 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 73 6f 6d 65 20 63 61 72 65 66 75 6c 6c 79 20 63 6f | .operations.in.some.carefully.co |
| 73660 | 6e 74 72 6f 6c 6c 65 64 20 77 61 79 2c 20 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e 0a 73 75 70 | ntrolled.way,.so.that.we.can.sup |
| 73680 | 70 6f 72 74 20 74 68 65 6d 20 77 69 74 68 6f 75 74 20 73 65 72 69 6f 75 73 6c 79 20 76 69 6f 6c | port.them.without.seriously.viol |
| 736a0 | 61 74 69 6e 67 20 6f 75 72 20 6d 6f 64 75 6c 65 20 62 6f 75 6e 64 61 72 69 65 73 2e 0a 0a 20 20 | ating.our.module.boundaries..... |
| 736c0 | 20 4f 6e 65 20 77 61 79 20 74 6f 20 68 61 6e 64 6c 65 20 63 72 6f 73 73 2d 74 79 70 65 20 6f 70 | .One.way.to.handle.cross-type.op |
| 736e0 | 65 72 61 74 69 6f 6e 73 20 69 73 20 74 6f 20 64 65 73 69 67 6e 20 61 20 64 69 66 66 65 72 65 6e | erations.is.to.design.a.differen |
| 73700 | 74 0a 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 65 61 63 68 20 70 6f 73 73 69 62 6c 65 20 63 6f | t.procedure.for.each.possible.co |
| 73720 | 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 74 79 70 65 73 20 66 6f 72 20 77 68 69 63 68 20 74 68 65 | mbination.of.types.for.which.the |
| 73740 | 0a 6f 70 65 72 61 74 69 6f 6e 20 69 73 20 76 61 6c 69 64 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c | .operation.is.valid...For.exampl |
| 73760 | 65 2c 20 77 65 20 63 6f 75 6c 64 20 65 78 74 65 6e 64 20 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e | e,.we.could.extend.the.complex-n |
| 73780 | 75 6d 62 65 72 0a 70 61 63 6b 61 67 65 20 73 6f 20 74 68 61 74 20 69 74 20 70 72 6f 76 69 64 65 | umber.package.so.that.it.provide |
| 737a0 | 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 61 64 64 69 6e 67 20 63 6f 6d 70 6c 65 78 | s.a.procedure.for.adding.complex |
| 737c0 | 20 6e 75 6d 62 65 72 73 20 74 6f 0a 6f 72 64 69 6e 61 72 79 20 6e 75 6d 62 65 72 73 20 61 6e 64 | .numbers.to.ordinary.numbers.and |
| 737e0 | 20 69 6e 73 74 61 6c 6c 73 20 74 68 69 73 20 69 6e 20 74 68 65 20 74 61 62 6c 65 20 75 73 69 6e | .installs.this.in.the.table.usin |
| 73800 | 67 20 74 68 65 20 74 61 67 20 60 28 63 6f 6d 70 6c 65 78 0a 73 63 68 65 6d 65 2d 6e 75 6d 62 65 | g.the.tag.`(complex.scheme-numbe |
| 73820 | 72 29 27 3a 28 31 29 0a 0a 20 20 20 20 20 3b 3b 20 74 6f 20 62 65 20 69 6e 63 6c 75 64 65 64 20 | r)':(1).......;;.to.be.included. |
| 73840 | 69 6e 20 74 68 65 20 63 6f 6d 70 6c 65 78 20 70 61 63 6b 61 67 65 0a 20 20 20 20 20 28 64 65 66 | in.the.complex.package......(def |
| 73860 | 69 6e 65 20 28 61 64 64 2d 63 6f 6d 70 6c 65 78 2d 74 6f 2d 73 63 68 65 6d 65 6e 75 6d 20 7a 20 | ine.(add-complex-to-schemenum.z. |
| 73880 | 78 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 28 | x)........(make-from-real-imag.( |
| 738a0 | 2b 20 28 72 65 61 6c 2d 70 61 72 74 20 7a 29 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | +.(real-part.z).x).............. |
| 738c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 6d 61 67 2d 70 61 72 74 20 7a 29 29 29 0a 0a | ...............(imag-part.z))).. |
| 738e0 | 20 20 20 20 20 28 70 75 74 20 27 61 64 64 20 27 28 63 6f 6d 70 6c 65 78 20 73 63 68 65 6d 65 2d | .....(put.'add.'(complex.scheme- |
| 73900 | 6e 75 6d 62 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 7a 20 78 29 20 | number)...........(lambda.(z.x). |
| 73920 | 28 74 61 67 20 28 61 64 64 2d 63 6f 6d 70 6c 65 78 2d 74 6f 2d 73 63 68 65 6d 65 6e 75 6d 20 7a | (tag.(add-complex-to-schemenum.z |
| 73940 | 20 78 29 29 29 29 0a 0a 20 20 20 54 68 69 73 20 74 65 63 68 6e 69 71 75 65 20 77 6f 72 6b 73 2c | .x)))).....This.technique.works, |
| 73960 | 20 62 75 74 20 69 74 20 69 73 20 63 75 6d 62 65 72 73 6f 6d 65 2e 20 20 57 69 74 68 20 73 75 63 | .but.it.is.cumbersome...With.suc |
| 73980 | 68 20 61 20 73 79 73 74 65 6d 2c 20 74 68 65 0a 63 6f 73 74 20 6f 66 20 69 6e 74 72 6f 64 75 63 | h.a.system,.the.cost.of.introduc |
| 739a0 | 69 6e 67 20 61 20 6e 65 77 20 74 79 70 65 20 69 73 20 6e 6f 74 20 6a 75 73 74 20 74 68 65 20 63 | ing.a.new.type.is.not.just.the.c |
| 739c0 | 6f 6e 73 74 72 75 63 74 69 6f 6e 20 6f 66 20 74 68 65 0a 70 61 63 6b 61 67 65 20 6f 66 20 70 72 | onstruction.of.the.package.of.pr |
| 739e0 | 6f 63 65 64 75 72 65 73 20 66 6f 72 20 74 68 61 74 20 74 79 70 65 20 62 75 74 20 61 6c 73 6f 20 | ocedures.for.that.type.but.also. |
| 73a00 | 74 68 65 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 61 6e 64 0a 69 6e 73 74 61 6c 6c 61 74 69 6f | the.construction.and.installatio |
| 73a20 | 6e 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 | n.of.the.procedures.that.impleme |
| 73a40 | 6e 74 20 74 68 65 20 63 72 6f 73 73 2d 74 79 70 65 0a 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 54 | nt.the.cross-type.operations...T |
| 73a60 | 68 69 73 20 63 61 6e 20 65 61 73 69 6c 79 20 62 65 20 6d 75 63 68 20 6d 6f 72 65 20 63 6f 64 65 | his.can.easily.be.much.more.code |
| 73a80 | 20 74 68 61 6e 20 69 73 20 6e 65 65 64 65 64 20 74 6f 20 64 65 66 69 6e 65 0a 74 68 65 20 6f 70 | .than.is.needed.to.define.the.op |
| 73aa0 | 65 72 61 74 69 6f 6e 73 20 6f 6e 20 74 68 65 20 74 79 70 65 20 69 74 73 65 6c 66 2e 20 20 54 68 | erations.on.the.type.itself...Th |
| 73ac0 | 65 20 6d 65 74 68 6f 64 20 61 6c 73 6f 20 75 6e 64 65 72 6d 69 6e 65 73 20 6f 75 72 0a 61 62 69 | e.method.also.undermines.our.abi |
| 73ae0 | 6c 69 74 79 20 74 6f 20 63 6f 6d 62 69 6e 65 20 73 65 70 61 72 61 74 65 20 70 61 63 6b 61 67 65 | lity.to.combine.separate.package |
| 73b00 | 73 20 61 64 64 69 74 69 76 65 6c 79 2c 20 6f 72 20 6c 65 61 73 74 20 74 6f 20 6c 69 6d 69 74 20 | s.additively,.or.least.to.limit. |
| 73b20 | 74 68 65 0a 65 78 74 65 6e 74 20 74 6f 20 77 68 69 63 68 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e | the.extent.to.which.the.implemen |
| 73b40 | 74 6f 72 73 20 6f 66 20 74 68 65 20 69 6e 64 69 76 69 64 75 61 6c 20 70 61 63 6b 61 67 65 73 20 | tors.of.the.individual.packages. |
| 73b60 | 6e 65 65 64 20 74 6f 0a 74 61 6b 65 20 61 63 63 6f 75 6e 74 20 6f 66 20 6f 74 68 65 72 20 70 61 | need.to.take.account.of.other.pa |
| 73b80 | 63 6b 61 67 65 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 6e 20 74 68 65 20 65 78 | ckages...For.instance,.in.the.ex |
| 73ba0 | 61 6d 70 6c 65 20 61 62 6f 76 65 2c 20 69 74 0a 73 65 65 6d 73 20 72 65 61 73 6f 6e 61 62 6c 65 | ample.above,.it.seems.reasonable |
| 73bc0 | 20 74 68 61 74 20 68 61 6e 64 6c 69 6e 67 20 6d 69 78 65 64 20 6f 70 65 72 61 74 69 6f 6e 73 20 | .that.handling.mixed.operations. |
| 73be0 | 6f 6e 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 61 6e 64 0a 6f 72 64 69 6e 61 72 79 20 | on.complex.numbers.and.ordinary. |
| 73c00 | 6e 75 6d 62 65 72 73 20 73 68 6f 75 6c 64 20 62 65 20 74 68 65 20 72 65 73 70 6f 6e 73 69 62 69 | numbers.should.be.the.responsibi |
| 73c20 | 6c 69 74 79 20 6f 66 20 74 68 65 20 63 6f 6d 70 6c 65 78 2d 6e 75 6d 62 65 72 0a 70 61 63 6b 61 | lity.of.the.complex-number.packa |
| 73c40 | 67 65 2e 20 20 43 6f 6d 62 69 6e 69 6e 67 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 | ge...Combining.rational.numbers. |
| 73c60 | 61 6e 64 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2c 20 68 6f 77 65 76 65 72 2c 0a 6d 69 | and.complex.numbers,.however,.mi |
| 73c80 | 67 68 74 20 62 65 20 64 6f 6e 65 20 62 79 20 74 68 65 20 63 6f 6d 70 6c 65 78 20 70 61 63 6b 61 | ght.be.done.by.the.complex.packa |
| 73ca0 | 67 65 2c 20 62 79 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 20 70 61 63 6b 61 67 65 2c 20 6f 72 20 | ge,.by.the.rational.package,.or. |
| 73cc0 | 62 79 0a 73 6f 6d 65 20 74 68 69 72 64 20 70 61 63 6b 61 67 65 20 74 68 61 74 20 75 73 65 73 20 | by.some.third.package.that.uses. |
| 73ce0 | 6f 70 65 72 61 74 69 6f 6e 73 20 65 78 74 72 61 63 74 65 64 20 66 72 6f 6d 20 74 68 65 73 65 20 | operations.extracted.from.these. |
| 73d00 | 74 77 6f 0a 70 61 63 6b 61 67 65 73 2e 20 20 46 6f 72 6d 75 6c 61 74 69 6e 67 20 63 6f 68 65 72 | two.packages...Formulating.coher |
| 73d20 | 65 6e 74 20 70 6f 6c 69 63 69 65 73 20 6f 6e 20 74 68 65 20 64 69 76 69 73 69 6f 6e 20 6f 66 0a | ent.policies.on.the.division.of. |
| 73d40 | 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 20 61 6d 6f 6e 67 20 70 61 63 6b 61 67 65 73 20 63 61 | responsibility.among.packages.ca |
| 73d60 | 6e 20 62 65 20 61 6e 20 6f 76 65 72 77 68 65 6c 6d 69 6e 67 20 74 61 73 6b 20 69 6e 20 64 65 73 | n.be.an.overwhelming.task.in.des |
| 73d80 | 69 67 6e 69 6e 67 0a 73 79 73 74 65 6d 73 20 77 69 74 68 20 6d 61 6e 79 20 70 61 63 6b 61 67 65 | igning.systems.with.many.package |
| 73da0 | 73 20 61 6e 64 20 6d 61 6e 79 20 63 72 6f 73 73 2d 74 79 70 65 20 6f 70 65 72 61 74 69 6f 6e 73 | s.and.many.cross-type.operations |
| 73dc0 | 2e 0a 0a 43 6f 65 72 63 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 74 68 65 20 67 65 6e | ...Coercion...........In.the.gen |
| 73de0 | 65 72 61 6c 20 73 69 74 75 61 74 69 6f 6e 20 6f 66 20 63 6f 6d 70 6c 65 74 65 6c 79 20 75 6e 72 | eral.situation.of.completely.unr |
| 73e00 | 65 6c 61 74 65 64 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 63 74 69 6e 67 20 6f 6e 0a 63 6f 6d 70 | elated.operations.acting.on.comp |
| 73e20 | 6c 65 74 65 6c 79 20 75 6e 72 65 6c 61 74 65 64 20 74 79 70 65 73 2c 20 69 6d 70 6c 65 6d 65 6e | letely.unrelated.types,.implemen |
| 73e40 | 74 69 6e 67 20 65 78 70 6c 69 63 69 74 20 63 72 6f 73 73 2d 74 79 70 65 20 6f 70 65 72 61 74 69 | ting.explicit.cross-type.operati |
| 73e60 | 6f 6e 73 2c 0a 63 75 6d 62 65 72 73 6f 6d 65 20 74 68 6f 75 67 68 20 69 74 20 6d 61 79 20 62 65 | ons,.cumbersome.though.it.may.be |
| 73e80 | 2c 20 69 73 20 74 68 65 20 62 65 73 74 20 74 68 61 74 20 6f 6e 65 20 63 61 6e 20 68 6f 70 65 20 | ,.is.the.best.that.one.can.hope. |
| 73ea0 | 66 6f 72 2e 0a 46 6f 72 74 75 6e 61 74 65 6c 79 2c 20 77 65 20 63 61 6e 20 75 73 75 61 6c 6c 79 | for..Fortunately,.we.can.usually |
| 73ec0 | 20 64 6f 20 62 65 74 74 65 72 20 62 79 20 74 61 6b 69 6e 67 20 61 64 76 61 6e 74 61 67 65 20 6f | .do.better.by.taking.advantage.o |
| 73ee0 | 66 20 61 64 64 69 74 69 6f 6e 61 6c 0a 73 74 72 75 63 74 75 72 65 20 74 68 61 74 20 6d 61 79 20 | f.additional.structure.that.may. |
| 73f00 | 62 65 20 6c 61 74 65 6e 74 20 69 6e 20 6f 75 72 20 74 79 70 65 20 73 79 73 74 65 6d 2e 20 20 4f | be.latent.in.our.type.system...O |
| 73f20 | 66 74 65 6e 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 0a 64 61 74 61 20 74 79 70 65 73 20 61 72 | ften.the.different.data.types.ar |
| 73f40 | 65 20 6e 6f 74 20 63 6f 6d 70 6c 65 74 65 6c 79 20 69 6e 64 65 70 65 6e 64 65 6e 74 2c 20 61 6e | e.not.completely.independent,.an |
| 73f60 | 64 20 74 68 65 72 65 20 6d 61 79 20 62 65 20 77 61 79 73 20 62 79 0a 77 68 69 63 68 20 6f 62 6a | d.there.may.be.ways.by.which.obj |
| 73f80 | 65 63 74 73 20 6f 66 20 6f 6e 65 20 74 79 70 65 20 6d 61 79 20 62 65 20 76 69 65 77 65 64 20 61 | ects.of.one.type.may.be.viewed.a |
| 73fa0 | 73 20 62 65 69 6e 67 20 6f 66 20 61 6e 6f 74 68 65 72 20 74 79 70 65 2e 20 20 54 68 69 73 0a 70 | s.being.of.another.type...This.p |
| 73fc0 | 72 6f 63 65 73 73 20 69 73 20 63 61 6c 6c 65 64 20 22 63 6f 65 72 63 69 6f 6e 22 2e 20 20 46 6f | rocess.is.called."coercion"...Fo |
| 73fe0 | 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 77 65 20 61 72 65 20 61 73 6b 65 64 20 74 6f 0a 61 72 | r.example,.if.we.are.asked.to.ar |
| 74000 | 69 74 68 6d 65 74 69 63 61 6c 6c 79 20 63 6f 6d 62 69 6e 65 20 61 6e 20 6f 72 64 69 6e 61 72 79 | ithmetically.combine.an.ordinary |
| 74020 | 20 6e 75 6d 62 65 72 20 77 69 74 68 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 2c 20 77 | .number.with.a.complex.number,.w |
| 74040 | 65 20 63 61 6e 0a 76 69 65 77 20 74 68 65 20 6f 72 64 69 6e 61 72 79 20 6e 75 6d 62 65 72 20 61 | e.can.view.the.ordinary.number.a |
| 74060 | 73 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 77 68 6f 73 65 20 69 6d 61 67 69 6e 61 | s.a.complex.number.whose.imagina |
| 74080 | 72 79 20 70 61 72 74 20 69 73 0a 7a 65 72 6f 2e 20 20 54 68 69 73 20 74 72 61 6e 73 66 6f 72 6d | ry.part.is.zero...This.transform |
| 740a0 | 73 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 74 6f 20 74 68 61 74 20 6f 66 20 63 6f 6d 62 69 6e 69 | s.the.problem.to.that.of.combini |
| 740c0 | 6e 67 20 74 77 6f 20 63 6f 6d 70 6c 65 78 0a 6e 75 6d 62 65 72 73 2c 20 77 68 69 63 68 20 63 61 | ng.two.complex.numbers,.which.ca |
| 740e0 | 6e 20 62 65 20 68 61 6e 64 6c 65 64 20 69 6e 20 74 68 65 20 6f 72 64 69 6e 61 72 79 20 77 61 79 | n.be.handled.in.the.ordinary.way |
| 74100 | 20 62 79 20 74 68 65 0a 63 6f 6d 70 6c 65 78 2d 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 | .by.the.complex-arithmetic.packa |
| 74120 | 67 65 2e 0a 0a 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 77 65 20 63 61 6e 20 69 6d 70 6c 65 | ge......In.general,.we.can.imple |
| 74140 | 6d 65 6e 74 20 74 68 69 73 20 69 64 65 61 20 62 79 20 64 65 73 69 67 6e 69 6e 67 20 63 6f 65 72 | ment.this.idea.by.designing.coer |
| 74160 | 63 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 74 72 61 6e 73 66 6f 72 6d 20 61 | cion.procedures.that.transform.a |
| 74180 | 6e 20 6f 62 6a 65 63 74 20 6f 66 20 6f 6e 65 20 74 79 70 65 20 69 6e 74 6f 20 61 6e 20 65 71 75 | n.object.of.one.type.into.an.equ |
| 741a0 | 69 76 61 6c 65 6e 74 0a 6f 62 6a 65 63 74 20 6f 66 20 61 6e 6f 74 68 65 72 20 74 79 70 65 2e 20 | ivalent.object.of.another.type.. |
| 741c0 | 20 48 65 72 65 20 69 73 20 61 20 74 79 70 69 63 61 6c 20 63 6f 65 72 63 69 6f 6e 20 70 72 6f 63 | .Here.is.a.typical.coercion.proc |
| 741e0 | 65 64 75 72 65 2c 20 77 68 69 63 68 0a 74 72 61 6e 73 66 6f 72 6d 73 20 61 20 67 69 76 65 6e 20 | edure,.which.transforms.a.given. |
| 74200 | 6f 72 64 69 6e 61 72 79 20 6e 75 6d 62 65 72 20 74 6f 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d | ordinary.number.to.a.complex.num |
| 74220 | 62 65 72 20 77 69 74 68 20 74 68 61 74 20 72 65 61 6c 0a 70 61 72 74 20 61 6e 64 20 7a 65 72 6f | ber.with.that.real.part.and.zero |
| 74240 | 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | .imaginary.part:.......(define.( |
| 74260 | 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 2d 3e 63 6f 6d 70 6c 65 78 20 6e 29 0a 20 20 20 20 20 20 | scheme-number->complex.n)....... |
| 74280 | 20 28 6d 61 6b 65 2d 63 6f 6d 70 6c 65 78 2d 66 72 6f 6d 2d 72 65 61 6c 2d 69 6d 61 67 20 28 63 | .(make-complex-from-real-imag.(c |
| 742a0 | 6f 6e 74 65 6e 74 73 20 6e 29 20 30 29 29 0a 0a 20 20 20 57 65 20 69 6e 73 74 61 6c 6c 20 74 68 | ontents.n).0)).....We.install.th |
| 742c0 | 65 73 65 20 63 6f 65 72 63 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 61 20 73 70 65 | ese.coercion.procedures.in.a.spe |
| 742e0 | 63 69 61 6c 20 63 6f 65 72 63 69 6f 6e 20 74 61 62 6c 65 2c 0a 69 6e 64 65 78 65 64 20 75 6e 64 | cial.coercion.table,.indexed.und |
| 74300 | 65 72 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 20 74 77 6f 20 74 79 70 65 73 3a 0a 0a | er.the.names.of.the.two.types:.. |
| 74320 | 20 20 20 20 20 28 70 75 74 2d 63 6f 65 72 63 69 6f 6e 20 27 73 63 68 65 6d 65 2d 6e 75 6d 62 65 | .....(put-coercion.'scheme-numbe |
| 74340 | 72 20 27 63 6f 6d 70 6c 65 78 20 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 2d 3e 63 6f 6d 70 6c 65 | r.'complex.scheme-number->comple |
| 74360 | 78 29 0a 0a 20 20 20 28 57 65 20 61 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 72 65 20 61 72 65 | x).....(We.assume.that.there.are |
| 74380 | 20 60 70 75 74 2d 63 6f 65 72 63 69 6f 6e 27 20 61 6e 64 20 60 67 65 74 2d 63 6f 65 72 63 69 6f | .`put-coercion'.and.`get-coercio |
| 743a0 | 6e 27 0a 70 72 6f 63 65 64 75 72 65 73 20 61 76 61 69 6c 61 62 6c 65 20 66 6f 72 20 6d 61 6e 69 | n'.procedures.available.for.mani |
| 743c0 | 70 75 6c 61 74 69 6e 67 20 74 68 69 73 20 74 61 62 6c 65 2e 29 20 20 47 65 6e 65 72 61 6c 6c 79 | pulating.this.table.)..Generally |
| 743e0 | 20 73 6f 6d 65 20 6f 66 0a 74 68 65 20 73 6c 6f 74 73 20 69 6e 20 74 68 65 20 74 61 62 6c 65 20 | .some.of.the.slots.in.the.table. |
| 74400 | 77 69 6c 6c 20 62 65 20 65 6d 70 74 79 2c 20 62 65 63 61 75 73 65 20 69 74 20 69 73 20 6e 6f 74 | will.be.empty,.because.it.is.not |
| 74420 | 20 67 65 6e 65 72 61 6c 6c 79 0a 70 6f 73 73 69 62 6c 65 20 74 6f 20 63 6f 65 72 63 65 20 61 6e | .generally.possible.to.coerce.an |
| 74440 | 20 61 72 62 69 74 72 61 72 79 20 64 61 74 61 20 6f 62 6a 65 63 74 20 6f 66 20 65 61 63 68 20 74 | .arbitrary.data.object.of.each.t |
| 74460 | 79 70 65 20 69 6e 74 6f 20 61 6c 6c 20 6f 74 68 65 72 0a 74 79 70 65 73 2e 20 20 46 6f 72 20 65 | ype.into.all.other.types...For.e |
| 74480 | 78 61 6d 70 6c 65 2c 20 74 68 65 72 65 20 69 73 20 6e 6f 20 77 61 79 20 74 6f 20 63 6f 65 72 63 | xample,.there.is.no.way.to.coerc |
| 744a0 | 65 20 61 6e 20 61 72 62 69 74 72 61 72 79 20 63 6f 6d 70 6c 65 78 0a 6e 75 6d 62 65 72 20 74 6f | e.an.arbitrary.complex.number.to |
| 744c0 | 20 61 6e 20 6f 72 64 69 6e 61 72 79 20 6e 75 6d 62 65 72 2c 20 73 6f 20 74 68 65 72 65 20 77 69 | .an.ordinary.number,.so.there.wi |
| 744e0 | 6c 6c 20 62 65 20 6e 6f 20 67 65 6e 65 72 61 6c 0a 60 63 6f 6d 70 6c 65 78 2d 3e 73 63 68 65 6d | ll.be.no.general.`complex->schem |
| 74500 | 65 2d 6e 75 6d 62 65 72 27 20 70 72 6f 63 65 64 75 72 65 20 69 6e 63 6c 75 64 65 64 20 69 6e 20 | e-number'.procedure.included.in. |
| 74520 | 74 68 65 20 74 61 62 6c 65 2e 0a 0a 20 20 20 4f 6e 63 65 20 74 68 65 20 63 6f 65 72 63 69 6f 6e | the.table......Once.the.coercion |
| 74540 | 20 74 61 62 6c 65 20 68 61 73 20 62 65 65 6e 20 73 65 74 20 75 70 2c 20 77 65 20 63 61 6e 20 68 | .table.has.been.set.up,.we.can.h |
| 74560 | 61 6e 64 6c 65 20 63 6f 65 72 63 69 6f 6e 20 69 6e 20 61 0a 75 6e 69 66 6f 72 6d 20 6d 61 6e 6e | andle.coercion.in.a.uniform.mann |
| 74580 | 65 72 20 62 79 20 6d 6f 64 69 66 79 69 6e 67 20 74 68 65 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 | er.by.modifying.the.`apply-gener |
| 745a0 | 69 63 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 32 | ic'.procedure.of.section.*Note.2 |
| 745c0 | 2d 34 2d 33 3a 3a 2e 20 20 57 68 65 6e 20 61 73 6b 65 64 20 74 6f 20 61 70 70 6c 79 20 61 6e 20 | -4-3::...When.asked.to.apply.an. |
| 745e0 | 6f 70 65 72 61 74 69 6f 6e 2c 20 77 65 20 66 69 72 73 74 20 63 68 65 63 6b 0a 77 68 65 74 68 65 | operation,.we.first.check.whethe |
| 74600 | 72 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 69 73 20 64 65 66 69 6e 65 64 20 66 6f 72 20 74 | r.the.operation.is.defined.for.t |
| 74620 | 68 65 20 61 72 67 75 6d 65 6e 74 73 27 20 74 79 70 65 73 2c 20 6a 75 73 74 20 61 73 0a 62 65 66 | he.arguments'.types,.just.as.bef |
| 74640 | 6f 72 65 2e 20 20 49 66 20 73 6f 2c 20 77 65 20 64 69 73 70 61 74 63 68 20 74 6f 20 74 68 65 20 | ore...If.so,.we.dispatch.to.the. |
| 74660 | 70 72 6f 63 65 64 75 72 65 20 66 6f 75 6e 64 20 69 6e 20 74 68 65 0a 6f 70 65 72 61 74 69 6f 6e | procedure.found.in.the.operation |
| 74680 | 2d 61 6e 64 2d 74 79 70 65 20 74 61 62 6c 65 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 77 65 20 | -and-type.table...Otherwise,.we. |
| 746a0 | 74 72 79 20 63 6f 65 72 63 69 6f 6e 2e 20 20 46 6f 72 20 73 69 6d 70 6c 69 63 69 74 79 2c 0a 77 | try.coercion...For.simplicity,.w |
| 746c0 | 65 20 63 6f 6e 73 69 64 65 72 20 6f 6e 6c 79 20 74 68 65 20 63 61 73 65 20 77 68 65 72 65 20 74 | e.consider.only.the.case.where.t |
| 746e0 | 68 65 72 65 20 61 72 65 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 2e 28 32 29 20 20 57 65 20 63 | here.are.two.arguments.(2)..We.c |
| 74700 | 68 65 63 6b 0a 74 68 65 20 63 6f 65 72 63 69 6f 6e 20 74 61 62 6c 65 20 74 6f 20 73 65 65 20 69 | heck.the.coercion.table.to.see.i |
| 74720 | 66 20 6f 62 6a 65 63 74 73 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 74 79 70 65 20 63 61 6e 20 | f.objects.of.the.first.type.can. |
| 74740 | 62 65 20 63 6f 65 72 63 65 64 0a 74 6f 20 74 68 65 20 73 65 63 6f 6e 64 20 74 79 70 65 2e 20 20 | be.coerced.to.the.second.type... |
| 74760 | 49 66 20 73 6f 2c 20 77 65 20 63 6f 65 72 63 65 20 74 68 65 20 66 69 72 73 74 20 61 72 67 75 6d | If.so,.we.coerce.the.first.argum |
| 74780 | 65 6e 74 20 61 6e 64 20 74 72 79 20 74 68 65 0a 6f 70 65 72 61 74 69 6f 6e 20 61 67 61 69 6e 2e | ent.and.try.the.operation.again. |
| 747a0 | 20 20 49 66 20 6f 62 6a 65 63 74 73 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 74 79 70 65 20 63 | ..If.objects.of.the.first.type.c |
| 747c0 | 61 6e 6e 6f 74 20 69 6e 20 67 65 6e 65 72 61 6c 20 62 65 0a 63 6f 65 72 63 65 64 20 74 6f 20 74 | annot.in.general.be.coerced.to.t |
| 747e0 | 68 65 20 73 65 63 6f 6e 64 20 74 79 70 65 2c 20 77 65 20 74 72 79 20 74 68 65 20 63 6f 65 72 63 | he.second.type,.we.try.the.coerc |
| 74800 | 69 6f 6e 20 74 68 65 20 6f 74 68 65 72 20 77 61 79 20 61 72 6f 75 6e 64 20 74 6f 0a 73 65 65 20 | ion.the.other.way.around.to.see. |
| 74820 | 69 66 20 74 68 65 72 65 20 69 73 20 61 20 77 61 79 20 74 6f 20 63 6f 65 72 63 65 20 74 68 65 20 | if.there.is.a.way.to.coerce.the. |
| 74840 | 73 65 63 6f 6e 64 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 74 68 65 20 74 79 70 65 20 6f 66 20 74 | second.argument.to.the.type.of.t |
| 74860 | 68 65 0a 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 2e 20 20 46 69 6e 61 6c 6c 79 2c 20 69 66 20 | he.first.argument...Finally,.if. |
| 74880 | 74 68 65 72 65 20 69 73 20 6e 6f 20 6b 6e 6f 77 6e 20 77 61 79 20 74 6f 20 63 6f 65 72 63 65 20 | there.is.no.known.way.to.coerce. |
| 748a0 | 65 69 74 68 65 72 0a 74 79 70 65 20 74 6f 20 74 68 65 20 6f 74 68 65 72 20 74 79 70 65 2c 20 77 | either.type.to.the.other.type,.w |
| 748c0 | 65 20 67 69 76 65 20 75 70 2e 20 20 48 65 72 65 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 | e.give.up...Here.is.the.procedur |
| 748e0 | 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 | e:.......(define.(apply-generic. |
| 74900 | 6f 70 20 2e 20 61 72 67 73 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 79 70 65 2d 74 61 | op...args)........(let.((type-ta |
| 74920 | 67 73 20 28 6d 61 70 20 74 79 70 65 2d 74 61 67 20 61 72 67 73 29 29 29 0a 20 20 20 20 20 20 20 | gs.(map.type-tag.args)))........ |
| 74940 | 20 20 28 6c 65 74 20 28 28 70 72 6f 63 20 28 67 65 74 20 6f 70 20 74 79 70 65 2d 74 61 67 73 29 | ..(let.((proc.(get.op.type-tags) |
| 74960 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 70 72 6f 63 0a 20 20 20 20 20 20 20 20 20 | ))............(if.proc.......... |
| 74980 | 20 20 20 20 20 20 28 61 70 70 6c 79 20 70 72 6f 63 20 28 6d 61 70 20 63 6f 6e 74 65 6e 74 73 20 | ......(apply.proc.(map.contents. |
| 749a0 | 61 72 67 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 28 6c 65 | args))................(if.(=.(le |
| 749c0 | 6e 67 74 68 20 61 72 67 73 29 20 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ngth.args).2)................... |
| 749e0 | 20 28 6c 65 74 20 28 28 74 79 70 65 31 20 28 63 61 72 20 74 79 70 65 2d 74 61 67 73 29 29 0a 20 | .(let.((type1.(car.type-tags)).. |
| 74a00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 79 70 65 32 20 28 | ........................(type2.( |
| 74a20 | 63 61 64 72 20 74 79 70 65 2d 74 61 67 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | cadr.type-tags))................ |
| 74a40 | 20 20 20 20 20 20 20 20 20 20 28 61 31 20 28 63 61 72 20 61 72 67 73 29 29 0a 20 20 20 20 20 20 | ..........(a1.(car.args))....... |
| 74a60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 32 20 28 63 61 64 72 20 61 72 67 | ...................(a2.(cadr.arg |
| 74a80 | 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 | s)))......................(let.( |
| 74aa0 | 28 74 31 2d 3e 74 32 20 28 67 65 74 2d 63 6f 65 72 63 69 6f 6e 20 74 79 70 65 31 20 74 79 70 65 | (t1->t2.(get-coercion.type1.type |
| 74ac0 | 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | 2))............................( |
| 74ae0 | 74 32 2d 3e 74 31 20 28 67 65 74 2d 63 6f 65 72 63 69 6f 6e 20 74 79 70 65 32 20 74 79 70 65 31 | t2->t1.(get-coercion.type2.type1 |
| 74b00 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 | )))........................(cond |
| 74b20 | 20 28 74 31 2d 3e 74 32 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(t1->t2........................ |
| 74b40 | 20 20 20 20 20 20 20 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 6f 70 20 28 74 31 2d 3e 74 32 | .......(apply-generic.op.(t1->t2 |
| 74b60 | 20 61 31 29 20 61 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .a1).a2))....................... |
| 74b80 | 20 20 20 20 20 20 20 28 74 32 2d 3e 74 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......(t2->t1.................. |
| 74ba0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 6f 70 20 61 | .............(apply-generic.op.a |
| 74bc0 | 31 20 28 74 32 2d 3e 74 31 20 61 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 1.(t2->t1.a2)))................. |
| 74be0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............(else.............. |
| 74c00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 4e 6f 20 6d 65 74 68 | .................(error."No.meth |
| 74c20 | 6f 64 20 66 6f 72 20 74 68 65 73 65 20 74 79 70 65 73 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 | od.for.these.types"............. |
| 74c40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 6f | .........................(list.o |
| 74c60 | 70 20 74 79 70 65 2d 74 61 67 73 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | p.type-tags))))))............... |
| 74c80 | 20 20 20 20 20 28 65 72 72 6f 72 20 22 4e 6f 20 6d 65 74 68 6f 64 20 66 6f 72 20 74 68 65 73 65 | .....(error."No.method.for.these |
| 74ca0 | 20 74 79 70 65 73 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .types"......................... |
| 74cc0 | 20 20 28 6c 69 73 74 20 6f 70 20 74 79 70 65 2d 74 61 67 73 29 29 29 29 29 29 29 0a 0a 20 20 20 | ..(list.op.type-tags)))))))..... |
| 74ce0 | 54 68 69 73 20 63 6f 65 72 63 69 6f 6e 20 73 63 68 65 6d 65 20 68 61 73 20 6d 61 6e 79 20 61 64 | This.coercion.scheme.has.many.ad |
| 74d00 | 76 61 6e 74 61 67 65 73 20 6f 76 65 72 20 74 68 65 20 6d 65 74 68 6f 64 20 6f 66 20 64 65 66 69 | vantages.over.the.method.of.defi |
| 74d20 | 6e 69 6e 67 0a 65 78 70 6c 69 63 69 74 20 63 72 6f 73 73 2d 74 79 70 65 20 6f 70 65 72 61 74 69 | ning.explicit.cross-type.operati |
| 74d40 | 6f 6e 73 2c 20 61 73 20 6f 75 74 6c 69 6e 65 64 20 61 62 6f 76 65 2e 20 20 41 6c 74 68 6f 75 67 | ons,.as.outlined.above...Althoug |
| 74d60 | 68 20 77 65 20 73 74 69 6c 6c 0a 6e 65 65 64 20 74 6f 20 77 72 69 74 65 20 63 6f 65 72 63 69 6f | h.we.still.need.to.write.coercio |
| 74d80 | 6e 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 72 65 6c 61 74 65 20 74 68 65 20 74 79 70 65 73 | n.procedures.to.relate.the.types |
| 74da0 | 20 28 70 6f 73 73 69 62 6c 79 20 6e 5e 32 0a 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 61 20 | .(possibly.n^2.procedures.for.a. |
| 74dc0 | 73 79 73 74 65 6d 20 77 69 74 68 20 6e 20 74 79 70 65 73 29 2c 20 77 65 20 6e 65 65 64 20 74 6f | system.with.n.types),.we.need.to |
| 74de0 | 20 77 72 69 74 65 20 6f 6e 6c 79 20 6f 6e 65 0a 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 65 61 | .write.only.one.procedure.for.ea |
| 74e00 | 63 68 20 70 61 69 72 20 6f 66 20 74 79 70 65 73 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 20 64 | ch.pair.of.types.rather.than.a.d |
| 74e20 | 69 66 66 65 72 65 6e 74 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 0a 65 61 63 68 20 63 6f 6c 6c | ifferent.procedure.for.each.coll |
| 74e40 | 65 63 74 69 6f 6e 20 6f 66 20 74 79 70 65 73 20 61 6e 64 20 65 61 63 68 20 67 65 6e 65 72 69 63 | ection.of.types.and.each.generic |
| 74e60 | 20 6f 70 65 72 61 74 69 6f 6e 2e 28 33 29 20 20 57 68 61 74 20 77 65 20 61 72 65 0a 63 6f 75 6e | .operation.(3)..What.we.are.coun |
| 74e80 | 74 69 6e 67 20 6f 6e 20 68 65 72 65 20 69 73 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 74 68 | ting.on.here.is.the.fact.that.th |
| 74ea0 | 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 0a 62 65 74 | e.appropriate.transformation.bet |
| 74ec0 | 77 65 65 6e 20 74 79 70 65 73 20 64 65 70 65 6e 64 73 20 6f 6e 6c 79 20 6f 6e 20 74 68 65 20 74 | ween.types.depends.only.on.the.t |
| 74ee0 | 79 70 65 73 20 74 68 65 6d 73 65 6c 76 65 73 2c 20 6e 6f 74 20 6f 6e 20 74 68 65 0a 6f 70 65 72 | ypes.themselves,.not.on.the.oper |
| 74f00 | 61 74 69 6f 6e 20 74 6f 20 62 65 20 61 70 70 6c 69 65 64 2e 0a 0a 20 20 20 4f 6e 20 74 68 65 20 | ation.to.be.applied......On.the. |
| 74f20 | 6f 74 68 65 72 20 68 61 6e 64 2c 20 74 68 65 72 65 20 6d 61 79 20 62 65 20 61 70 70 6c 69 63 61 | other.hand,.there.may.be.applica |
| 74f40 | 74 69 6f 6e 73 20 66 6f 72 20 77 68 69 63 68 20 6f 75 72 20 63 6f 65 72 63 69 6f 6e 0a 73 63 68 | tions.for.which.our.coercion.sch |
| 74f60 | 65 6d 65 20 69 73 20 6e 6f 74 20 67 65 6e 65 72 61 6c 20 65 6e 6f 75 67 68 2e 20 20 45 76 65 6e | eme.is.not.general.enough...Even |
| 74f80 | 20 77 68 65 6e 20 6e 65 69 74 68 65 72 20 6f 66 20 74 68 65 20 6f 62 6a 65 63 74 73 20 74 6f 20 | .when.neither.of.the.objects.to. |
| 74fa0 | 62 65 0a 63 6f 6d 62 69 6e 65 64 20 63 61 6e 20 62 65 20 63 6f 6e 76 65 72 74 65 64 20 74 6f 20 | be.combined.can.be.converted.to. |
| 74fc0 | 74 68 65 20 74 79 70 65 20 6f 66 20 74 68 65 20 6f 74 68 65 72 20 69 74 20 6d 61 79 20 73 74 69 | the.type.of.the.other.it.may.sti |
| 74fe0 | 6c 6c 20 62 65 0a 70 6f 73 73 69 62 6c 65 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 20 6f 70 | ll.be.possible.to.perform.the.op |
| 75000 | 65 72 61 74 69 6f 6e 20 62 79 20 63 6f 6e 76 65 72 74 69 6e 67 20 62 6f 74 68 20 6f 62 6a 65 63 | eration.by.converting.both.objec |
| 75020 | 74 73 20 74 6f 20 61 20 74 68 69 72 64 0a 74 79 70 65 2e 20 20 49 6e 20 6f 72 64 65 72 20 74 6f | ts.to.a.third.type...In.order.to |
| 75040 | 20 64 65 61 6c 20 77 69 74 68 20 73 75 63 68 20 63 6f 6d 70 6c 65 78 69 74 79 20 61 6e 64 20 73 | .deal.with.such.complexity.and.s |
| 75060 | 74 69 6c 6c 20 70 72 65 73 65 72 76 65 0a 6d 6f 64 75 6c 61 72 69 74 79 20 69 6e 20 6f 75 72 20 | till.preserve.modularity.in.our. |
| 75080 | 70 72 6f 67 72 61 6d 73 2c 20 69 74 20 69 73 20 75 73 75 61 6c 6c 79 20 6e 65 63 65 73 73 61 72 | programs,.it.is.usually.necessar |
| 750a0 | 79 20 74 6f 20 62 75 69 6c 64 20 73 79 73 74 65 6d 73 0a 74 68 61 74 20 74 61 6b 65 20 61 64 76 | y.to.build.systems.that.take.adv |
| 750c0 | 61 6e 74 61 67 65 20 6f 66 20 73 74 69 6c 6c 20 66 75 72 74 68 65 72 20 73 74 72 75 63 74 75 72 | antage.of.still.further.structur |
| 750e0 | 65 20 69 6e 20 74 68 65 20 72 65 6c 61 74 69 6f 6e 73 20 61 6d 6f 6e 67 0a 74 79 70 65 73 2c 20 | e.in.the.relations.among.types,. |
| 75100 | 61 73 20 77 65 20 64 69 73 63 75 73 73 20 6e 65 78 74 2e 0a 0a 48 69 65 72 61 72 63 68 69 65 73 | as.we.discuss.next...Hierarchies |
| 75120 | 20 6f 66 20 74 79 70 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | .of.types....................... |
| 75140 | 54 68 65 20 63 6f 65 72 63 69 6f 6e 20 73 63 68 65 6d 65 20 70 72 65 73 65 6e 74 65 64 20 61 62 | The.coercion.scheme.presented.ab |
| 75160 | 6f 76 65 20 72 65 6c 69 65 64 20 6f 6e 20 74 68 65 20 65 78 69 73 74 65 6e 63 65 20 6f 66 20 6e | ove.relied.on.the.existence.of.n |
| 75180 | 61 74 75 72 61 6c 0a 72 65 6c 61 74 69 6f 6e 73 20 62 65 74 77 65 65 6e 20 70 61 69 72 73 20 6f | atural.relations.between.pairs.o |
| 751a0 | 66 20 74 79 70 65 73 2e 20 20 4f 66 74 65 6e 20 74 68 65 72 65 20 69 73 20 6d 6f 72 65 20 22 67 | f.types...Often.there.is.more."g |
| 751c0 | 6c 6f 62 61 6c 22 0a 73 74 72 75 63 74 75 72 65 20 69 6e 20 68 6f 77 20 74 68 65 20 64 69 66 66 | lobal".structure.in.how.the.diff |
| 751e0 | 65 72 65 6e 74 20 74 79 70 65 73 20 72 65 6c 61 74 65 20 74 6f 20 65 61 63 68 20 6f 74 68 65 72 | erent.types.relate.to.each.other |
| 75200 | 2e 20 20 46 6f 72 0a 69 6e 73 74 61 6e 63 65 2c 20 73 75 70 70 6f 73 65 20 77 65 20 61 72 65 20 | ...For.instance,.suppose.we.are. |
| 75220 | 62 75 69 6c 64 69 6e 67 20 61 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 73 79 | building.a.generic.arithmetic.sy |
| 75240 | 73 74 65 6d 20 74 6f 20 68 61 6e 64 6c 65 0a 69 6e 74 65 67 65 72 73 2c 20 72 61 74 69 6f 6e 61 | stem.to.handle.integers,.rationa |
| 75260 | 6c 20 6e 75 6d 62 65 72 73 2c 20 72 65 61 6c 20 6e 75 6d 62 65 72 73 2c 20 61 6e 64 20 63 6f 6d | l.numbers,.real.numbers,.and.com |
| 75280 | 70 6c 65 78 20 6e 75 6d 62 65 72 73 2e 20 20 49 6e 20 73 75 63 68 0a 61 20 73 79 73 74 65 6d 2c | plex.numbers...In.such.a.system, |
| 752a0 | 20 69 74 20 69 73 20 71 75 69 74 65 20 6e 61 74 75 72 61 6c 20 74 6f 20 72 65 67 61 72 64 20 61 | .it.is.quite.natural.to.regard.a |
| 752c0 | 6e 20 69 6e 74 65 67 65 72 20 61 73 20 61 20 73 70 65 63 69 61 6c 20 6b 69 6e 64 20 6f 66 0a 72 | n.integer.as.a.special.kind.of.r |
| 752e0 | 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 2c 20 77 68 69 63 68 20 69 73 20 69 6e 20 74 75 72 6e | ational.number,.which.is.in.turn |
| 75300 | 20 61 20 73 70 65 63 69 61 6c 20 6b 69 6e 64 20 6f 66 20 72 65 61 6c 20 6e 75 6d 62 65 72 2c 20 | .a.special.kind.of.real.number,. |
| 75320 | 77 68 69 63 68 0a 69 73 20 69 6e 20 74 75 72 6e 20 61 20 73 70 65 63 69 61 6c 20 6b 69 6e 64 20 | which.is.in.turn.a.special.kind. |
| 75340 | 6f 66 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 2e 20 20 57 68 61 74 20 77 65 20 61 63 74 75 | of.complex.number...What.we.actu |
| 75360 | 61 6c 6c 79 20 68 61 76 65 20 69 73 0a 61 20 73 6f 2d 63 61 6c 6c 65 64 20 22 68 69 65 72 61 72 | ally.have.is.a.so-called."hierar |
| 75380 | 63 68 79 20 6f 66 20 74 79 70 65 73 22 2c 20 69 6e 20 77 68 69 63 68 2c 20 66 6f 72 20 65 78 61 | chy.of.types",.in.which,.for.exa |
| 753a0 | 6d 70 6c 65 2c 20 69 6e 74 65 67 65 72 73 20 61 72 65 20 61 20 22 73 75 62 74 79 70 65 22 0a 6f | mple,.integers.are.a."subtype".o |
| 753c0 | 66 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 28 69 2e 65 2e 2c 20 61 6e 79 20 6f 70 | f.rational.numbers.(i.e.,.any.op |
| 753e0 | 65 72 61 74 69 6f 6e 20 74 68 61 74 20 63 61 6e 20 62 65 20 61 70 70 6c 69 65 64 20 74 6f 20 61 | eration.that.can.be.applied.to.a |
| 75400 | 0a 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 63 61 6e 20 61 75 74 6f 6d 61 74 69 63 61 6c | .rational.number.can.automatical |
| 75420 | 6c 79 20 62 65 20 61 70 70 6c 69 65 64 20 74 6f 20 61 6e 20 69 6e 74 65 67 65 72 29 2e 0a 43 6f | ly.be.applied.to.an.integer)..Co |
| 75440 | 6e 76 65 72 73 65 6c 79 2c 20 77 65 20 73 61 79 20 74 68 61 74 20 72 61 74 69 6f 6e 61 6c 20 6e | nversely,.we.say.that.rational.n |
| 75460 | 75 6d 62 65 72 73 20 66 6f 72 6d 20 61 20 22 73 75 70 65 72 74 79 70 65 22 20 6f 66 0a 69 6e 74 | umbers.form.a."supertype".of.int |
| 75480 | 65 67 65 72 73 2e 20 20 54 68 65 20 70 61 72 74 69 63 75 6c 61 72 20 68 69 65 72 61 72 63 68 79 | egers...The.particular.hierarchy |
| 754a0 | 20 77 65 20 68 61 76 65 20 68 65 72 65 20 69 73 20 6f 66 20 61 20 76 65 72 79 20 73 69 6d 70 6c | .we.have.here.is.of.a.very.simpl |
| 754c0 | 65 0a 6b 69 6e 64 2c 20 69 6e 20 77 68 69 63 68 20 65 61 63 68 20 74 79 70 65 20 68 61 73 20 61 | e.kind,.in.which.each.type.has.a |
| 754e0 | 74 20 6d 6f 73 74 20 6f 6e 65 20 73 75 70 65 72 74 79 70 65 20 61 6e 64 20 61 74 20 6d 6f 73 74 | t.most.one.supertype.and.at.most |
| 75500 | 20 6f 6e 65 0a 73 75 62 74 79 70 65 2e 20 20 53 75 63 68 20 61 20 73 74 72 75 63 74 75 72 65 2c | .one.subtype...Such.a.structure, |
| 75520 | 20 63 61 6c 6c 65 64 20 61 20 22 74 6f 77 65 72 22 2c 20 69 73 20 69 6c 6c 75 73 74 72 61 74 65 | .called.a."tower",.is.illustrate |
| 75540 | 64 20 69 6e 20 2a 4e 6f 74 65 0a 46 69 67 75 72 65 20 32 2d 32 35 3a 3a 2e 0a 0a 20 20 20 20 20 | d.in.*Note.Figure.2-25::........ |
| 75560 | 2a 46 69 67 75 72 65 20 32 2e 32 35 3a 2a 20 41 20 74 6f 77 65 72 20 6f 66 20 74 79 70 65 73 2e | *Figure.2.25:*.A.tower.of.types. |
| 75580 | 0a 0a 20 20 20 20 20 20 20 20 20 20 20 63 6f 6d 70 6c 65 78 0a 20 20 20 20 20 20 20 20 20 20 20 | .............complex............ |
| 755a0 | 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 | ..^..............|.............r |
| 755c0 | 65 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | eal..............^.............. |
| 755e0 | 7c 0a 20 20 20 20 20 20 20 20 20 20 72 61 74 69 6f 6e 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 | |...........rational............ |
| 75600 | 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 69 6e 74 | ..^..............|...........int |
| 75620 | 65 67 65 72 0a 0a 20 20 20 49 66 20 77 65 20 68 61 76 65 20 61 20 74 6f 77 65 72 20 73 74 72 75 | eger.....If.we.have.a.tower.stru |
| 75640 | 63 74 75 72 65 2c 20 74 68 65 6e 20 77 65 20 63 61 6e 20 67 72 65 61 74 6c 79 20 73 69 6d 70 6c | cture,.then.we.can.greatly.simpl |
| 75660 | 69 66 79 20 74 68 65 0a 70 72 6f 62 6c 65 6d 20 6f 66 20 61 64 64 69 6e 67 20 61 20 6e 65 77 20 | ify.the.problem.of.adding.a.new. |
| 75680 | 74 79 70 65 20 74 6f 20 74 68 65 20 68 69 65 72 61 72 63 68 79 2c 20 66 6f 72 20 77 65 20 6e 65 | type.to.the.hierarchy,.for.we.ne |
| 756a0 | 65 64 20 6f 6e 6c 79 20 73 70 65 63 69 66 79 0a 68 6f 77 20 74 68 65 20 6e 65 77 20 74 79 70 65 | ed.only.specify.how.the.new.type |
| 756c0 | 20 69 73 20 65 6d 62 65 64 64 65 64 20 69 6e 20 74 68 65 20 6e 65 78 74 20 73 75 70 65 72 74 79 | .is.embedded.in.the.next.superty |
| 756e0 | 70 65 20 61 62 6f 76 65 20 69 74 20 61 6e 64 20 68 6f 77 20 69 74 0a 69 73 20 74 68 65 20 73 75 | pe.above.it.and.how.it.is.the.su |
| 75700 | 70 65 72 74 79 70 65 20 6f 66 20 74 68 65 20 74 79 70 65 20 62 65 6c 6f 77 20 69 74 2e 20 20 46 | pertype.of.the.type.below.it...F |
| 75720 | 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 77 65 20 77 61 6e 74 20 74 6f 20 61 64 64 0a 61 6e | or.example,.if.we.want.to.add.an |
| 75740 | 20 69 6e 74 65 67 65 72 20 74 6f 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 2c 20 77 65 | .integer.to.a.complex.number,.we |
| 75760 | 20 6e 65 65 64 20 6e 6f 74 20 65 78 70 6c 69 63 69 74 6c 79 20 64 65 66 69 6e 65 20 61 20 73 70 | .need.not.explicitly.define.a.sp |
| 75780 | 65 63 69 61 6c 0a 63 6f 65 72 63 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 60 69 6e 74 65 67 65 | ecial.coercion.procedure.`intege |
| 757a0 | 72 2d 3e 63 6f 6d 70 6c 65 78 27 2e 20 20 49 6e 73 74 65 61 64 2c 20 77 65 20 64 65 66 69 6e 65 | r->complex'...Instead,.we.define |
| 757c0 | 20 68 6f 77 20 61 6e 0a 69 6e 74 65 67 65 72 20 63 61 6e 20 62 65 20 74 72 61 6e 73 66 6f 72 6d | .how.an.integer.can.be.transform |
| 757e0 | 65 64 20 69 6e 74 6f 20 61 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 2c 20 68 6f 77 20 61 | ed.into.a.rational.number,.how.a |
| 75800 | 20 72 61 74 69 6f 6e 61 6c 0a 6e 75 6d 62 65 72 20 69 73 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 | .rational.number.is.transformed. |
| 75820 | 69 6e 74 6f 20 61 20 72 65 61 6c 20 6e 75 6d 62 65 72 2c 20 61 6e 64 20 68 6f 77 20 61 20 72 65 | into.a.real.number,.and.how.a.re |
| 75840 | 61 6c 20 6e 75 6d 62 65 72 20 69 73 0a 74 72 61 6e 73 66 6f 72 6d 65 64 20 69 6e 74 6f 20 61 20 | al.number.is.transformed.into.a. |
| 75860 | 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 2e 20 20 57 65 20 74 68 65 6e 20 61 6c 6c 6f 77 20 74 | complex.number...We.then.allow.t |
| 75880 | 68 65 20 73 79 73 74 65 6d 20 74 6f 0a 74 72 61 6e 73 66 6f 72 6d 20 74 68 65 20 69 6e 74 65 67 | he.system.to.transform.the.integ |
| 758a0 | 65 72 20 69 6e 74 6f 20 61 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 74 68 72 6f 75 67 68 | er.into.a.complex.number.through |
| 758c0 | 20 74 68 65 73 65 20 73 74 65 70 73 20 61 6e 64 0a 74 68 65 6e 20 61 64 64 20 74 68 65 20 74 77 | .these.steps.and.then.add.the.tw |
| 758e0 | 6f 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 72 65 | o.complex.numbers......We.can.re |
| 75900 | 64 65 73 69 67 6e 20 6f 75 72 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 70 72 6f 63 65 | design.our.`apply-generic'.proce |
| 75920 | 64 75 72 65 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 77 61 79 3a 0a 46 6f 72 20 65 | dure.in.the.following.way:.For.e |
| 75940 | 61 63 68 20 74 79 70 65 2c 20 77 65 20 6e 65 65 64 20 74 6f 20 73 75 70 70 6c 79 20 61 20 60 72 | ach.type,.we.need.to.supply.a.`r |
| 75960 | 61 69 73 65 27 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 22 72 61 69 73 65 73 22 0a | aise'.procedure,.which."raises". |
| 75980 | 6f 62 6a 65 63 74 73 20 6f 66 20 74 68 61 74 20 74 79 70 65 20 6f 6e 65 20 6c 65 76 65 6c 20 69 | objects.of.that.type.one.level.i |
| 759a0 | 6e 20 74 68 65 20 74 6f 77 65 72 2e 20 20 54 68 65 6e 20 77 68 65 6e 20 74 68 65 20 73 79 73 74 | n.the.tower...Then.when.the.syst |
| 759c0 | 65 6d 20 69 73 0a 72 65 71 75 69 72 65 64 20 74 6f 20 6f 70 65 72 61 74 65 20 6f 6e 20 6f 62 6a | em.is.required.to.operate.on.obj |
| 759e0 | 65 63 74 73 20 6f 66 20 64 69 66 66 65 72 65 6e 74 20 74 79 70 65 73 20 69 74 20 63 61 6e 20 73 | ects.of.different.types.it.can.s |
| 75a00 | 75 63 63 65 73 73 69 76 65 6c 79 0a 72 61 69 73 65 20 74 68 65 20 6c 6f 77 65 72 20 74 79 70 65 | uccessively.raise.the.lower.type |
| 75a20 | 73 20 75 6e 74 69 6c 20 61 6c 6c 20 74 68 65 20 6f 62 6a 65 63 74 73 20 61 72 65 20 61 74 20 74 | s.until.all.the.objects.are.at.t |
| 75a40 | 68 65 20 73 61 6d 65 20 6c 65 76 65 6c 20 69 6e 0a 74 68 65 20 74 6f 77 65 72 2e 20 20 28 2a 4e | he.same.level.in.the.tower...(*N |
| 75a60 | 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 38 33 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 45 78 | ote.Exercise.2-83::.and.*Note.Ex |
| 75a80 | 65 72 63 69 73 65 20 32 2d 38 34 3a 3a 20 63 6f 6e 63 65 72 6e 0a 74 68 65 20 64 65 74 61 69 6c | ercise.2-84::.concern.the.detail |
| 75aa0 | 73 20 6f 66 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 73 75 63 68 20 61 20 73 74 72 61 74 65 67 | s.of.implementing.such.a.strateg |
| 75ac0 | 79 2e 29 0a 0a 20 20 20 41 6e 6f 74 68 65 72 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 61 20 74 | y.).....Another.advantage.of.a.t |
| 75ae0 | 6f 77 65 72 20 69 73 20 74 68 61 74 20 77 65 20 63 61 6e 20 65 61 73 69 6c 79 20 69 6d 70 6c 65 | ower.is.that.we.can.easily.imple |
| 75b00 | 6d 65 6e 74 20 74 68 65 0a 6e 6f 74 69 6f 6e 20 74 68 61 74 20 65 76 65 72 79 20 74 79 70 65 20 | ment.the.notion.that.every.type. |
| 75b20 | 22 69 6e 68 65 72 69 74 73 22 20 61 6c 6c 20 6f 70 65 72 61 74 69 6f 6e 73 20 64 65 66 69 6e 65 | "inherits".all.operations.define |
| 75b40 | 64 20 6f 6e 20 61 0a 73 75 70 65 72 74 79 70 65 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c | d.on.a.supertype...For.instance, |
| 75b60 | 20 69 66 20 77 65 20 64 6f 20 6e 6f 74 20 73 75 70 70 6c 79 20 61 20 73 70 65 63 69 61 6c 20 70 | .if.we.do.not.supply.a.special.p |
| 75b80 | 72 6f 63 65 64 75 72 65 20 66 6f 72 0a 66 69 6e 64 69 6e 67 20 74 68 65 20 72 65 61 6c 20 70 61 | rocedure.for.finding.the.real.pa |
| 75ba0 | 72 74 20 6f 66 20 61 6e 20 69 6e 74 65 67 65 72 2c 20 77 65 20 73 68 6f 75 6c 64 20 6e 65 76 65 | rt.of.an.integer,.we.should.neve |
| 75bc0 | 72 74 68 65 6c 65 73 73 20 65 78 70 65 63 74 20 74 68 61 74 0a 60 72 65 61 6c 2d 70 61 72 74 27 | rtheless.expect.that.`real-part' |
| 75be0 | 20 77 69 6c 6c 20 62 65 20 64 65 66 69 6e 65 64 20 66 6f 72 20 69 6e 74 65 67 65 72 73 20 62 79 | .will.be.defined.for.integers.by |
| 75c00 | 20 76 69 72 74 75 65 20 6f 66 20 74 68 65 20 66 61 63 74 20 74 68 61 74 0a 69 6e 74 65 67 65 72 | .virtue.of.the.fact.that.integer |
| 75c20 | 73 20 61 72 65 20 61 20 73 75 62 74 79 70 65 20 6f 66 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 | s.are.a.subtype.of.complex.numbe |
| 75c40 | 72 73 2e 20 20 49 6e 20 61 20 74 6f 77 65 72 2c 20 77 65 20 63 61 6e 20 61 72 72 61 6e 67 65 0a | rs...In.a.tower,.we.can.arrange. |
| 75c60 | 66 6f 72 20 74 68 69 73 20 74 6f 20 68 61 70 70 65 6e 20 69 6e 20 61 20 75 6e 69 66 6f 72 6d 20 | for.this.to.happen.in.a.uniform. |
| 75c80 | 77 61 79 20 62 79 20 6d 6f 64 69 66 79 69 6e 67 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 | way.by.modifying.`apply-generic' |
| 75ca0 | 2e 20 20 49 66 0a 74 68 65 20 72 65 71 75 69 72 65 64 20 6f 70 65 72 61 74 69 6f 6e 20 69 73 20 | ...If.the.required.operation.is. |
| 75cc0 | 6e 6f 74 20 64 69 72 65 63 74 6c 79 20 64 65 66 69 6e 65 64 20 66 6f 72 20 74 68 65 20 74 79 70 | not.directly.defined.for.the.typ |
| 75ce0 | 65 20 6f 66 20 74 68 65 0a 6f 62 6a 65 63 74 20 67 69 76 65 6e 2c 20 77 65 20 72 61 69 73 65 20 | e.of.the.object.given,.we.raise. |
| 75d00 | 74 68 65 20 6f 62 6a 65 63 74 20 74 6f 20 69 74 73 20 73 75 70 65 72 74 79 70 65 20 61 6e 64 20 | the.object.to.its.supertype.and. |
| 75d20 | 74 72 79 20 61 67 61 69 6e 2e 20 20 57 65 0a 74 68 75 73 20 63 72 61 77 6c 20 75 70 20 74 68 65 | try.again...We.thus.crawl.up.the |
| 75d40 | 20 74 6f 77 65 72 2c 20 74 72 61 6e 73 66 6f 72 6d 69 6e 67 20 6f 75 72 20 61 72 67 75 6d 65 6e | .tower,.transforming.our.argumen |
| 75d60 | 74 20 61 73 20 77 65 20 67 6f 2c 20 75 6e 74 69 6c 20 77 65 0a 65 69 74 68 65 72 20 66 69 6e 64 | t.as.we.go,.until.we.either.find |
| 75d80 | 20 61 20 6c 65 76 65 6c 20 61 74 20 77 68 69 63 68 20 74 68 65 20 64 65 73 69 72 65 64 20 6f 70 | .a.level.at.which.the.desired.op |
| 75da0 | 65 72 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 6f 72 0a 68 69 74 20 | eration.can.be.performed.or.hit. |
| 75dc0 | 74 68 65 20 74 6f 70 20 28 69 6e 20 77 68 69 63 68 20 63 61 73 65 20 77 65 20 67 69 76 65 20 75 | the.top.(in.which.case.we.give.u |
| 75de0 | 70 29 2e 0a 0a 20 20 20 59 65 74 20 61 6e 6f 74 68 65 72 20 61 64 76 61 6e 74 61 67 65 20 6f 66 | p)......Yet.another.advantage.of |
| 75e00 | 20 61 20 74 6f 77 65 72 20 6f 76 65 72 20 61 20 6d 6f 72 65 20 67 65 6e 65 72 61 6c 20 68 69 65 | .a.tower.over.a.more.general.hie |
| 75e20 | 72 61 72 63 68 79 20 69 73 0a 74 68 61 74 20 69 74 20 67 69 76 65 73 20 75 73 20 61 20 73 69 6d | rarchy.is.that.it.gives.us.a.sim |
| 75e40 | 70 6c 65 20 77 61 79 20 74 6f 20 22 6c 6f 77 65 72 22 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 | ple.way.to."lower".a.data.object |
| 75e60 | 20 74 6f 20 74 68 65 20 73 69 6d 70 6c 65 73 74 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e | .to.the.simplest.representation. |
| 75e80 | 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 77 65 20 61 64 64 20 32 20 2b 20 33 69 20 | ..For.example,.if.we.add.2.+.3i. |
| 75ea0 | 74 6f 20 34 20 2d 20 33 69 2c 20 69 74 20 77 6f 75 6c 64 20 62 65 0a 6e 69 63 65 20 74 6f 20 6f | to.4.-.3i,.it.would.be.nice.to.o |
| 75ec0 | 62 74 61 69 6e 20 74 68 65 20 61 6e 73 77 65 72 20 61 73 20 74 68 65 20 69 6e 74 65 67 65 72 20 | btain.the.answer.as.the.integer. |
| 75ee0 | 36 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 73 20 74 68 65 20 63 6f 6d 70 6c 65 78 0a 6e 75 6d | 6.rather.than.as.the.complex.num |
| 75f00 | 62 65 72 20 36 20 2b 20 30 69 2e 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 38 35 | ber.6.+.0i...*Note.Exercise.2-85 |
| 75f20 | 3a 3a 20 64 69 73 63 75 73 73 65 73 20 61 20 77 61 79 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 | ::.discusses.a.way.to.implement. |
| 75f40 | 73 75 63 68 0a 61 20 6c 6f 77 65 72 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 2e 20 20 28 54 68 65 | such.a.lowering.operation...(The |
| 75f60 | 20 74 72 69 63 6b 20 69 73 20 74 68 61 74 20 77 65 20 6e 65 65 64 20 61 20 67 65 6e 65 72 61 6c | .trick.is.that.we.need.a.general |
| 75f80 | 20 77 61 79 20 74 6f 0a 64 69 73 74 69 6e 67 75 69 73 68 20 74 68 6f 73 65 20 6f 62 6a 65 63 74 | .way.to.distinguish.those.object |
| 75fa0 | 73 20 74 68 61 74 20 63 61 6e 20 62 65 20 6c 6f 77 65 72 65 64 2c 20 73 75 63 68 20 61 73 20 36 | s.that.can.be.lowered,.such.as.6 |
| 75fc0 | 20 2b 20 30 69 2c 20 66 72 6f 6d 0a 74 68 6f 73 65 20 74 68 61 74 20 63 61 6e 6e 6f 74 2c 20 73 | .+.0i,.from.those.that.cannot,.s |
| 75fe0 | 75 63 68 20 61 73 20 36 20 2b 20 32 69 2e 29 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 32 2e | uch.as.6.+.2i.).......*Figure.2. |
| 76000 | 32 36 3a 2a 20 52 65 6c 61 74 69 6f 6e 73 20 61 6d 6f 6e 67 20 74 79 70 65 73 20 6f 66 20 67 65 | 26:*.Relations.among.types.of.ge |
| 76020 | 6f 6d 65 74 72 69 63 20 66 69 67 75 72 65 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ometric.figures................. |
| 76040 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 6f 6c 79 67 6f 6e 0a 20 20 20 20 20 20 20 | .................polygon........ |
| 76060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 20 20 20 5c | ......................./.......\ |
| 76080 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 | ............................../. |
| 760a0 | 20 20 20 20 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........\....................... |
| 760c0 | 74 72 69 61 6e 67 6c 65 20 20 20 20 20 20 20 20 20 71 75 61 64 72 69 6c 61 74 65 72 61 6c 0a 20 | triangle.........quadrilateral.. |
| 760e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 20 5c 20 20 20 20 | ...................../.....\.... |
| 76100 | 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........../.....\............... |
| 76120 | 20 20 20 20 20 20 20 2f 20 20 20 20 20 20 20 5c 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 | ......./.......\............/... |
| 76140 | 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 73 6f 73 63 65 6c 65 73 20 20 | ....\................isosceles.. |
| 76160 | 20 72 69 67 68 74 20 20 20 20 20 20 74 72 61 70 65 7a 6f 69 64 20 20 20 6b 69 74 65 0a 20 20 20 | .right......trapezoid...kite.... |
| 76180 | 20 20 20 20 20 20 20 20 20 20 20 20 74 72 69 61 6e 67 6c 65 20 20 20 20 74 72 69 61 6e 67 6c 65 | ............triangle....triangle |
| 761a0 | 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......|.........|.............. |
| 761c0 | 20 20 20 7c 20 20 20 20 20 5c 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ...|.....\......|............|.. |
| 761e0 | 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | .......|.................|...... |
| 76200 | 5c 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 7c 0a 20 | \.....|............|.........|.. |
| 76220 | 20 20 20 20 20 20 20 20 20 65 71 75 69 6c 61 74 65 72 61 6c 20 20 20 69 73 6f 73 63 65 6c 65 73 | .........equilateral...isosceles |
| 76240 | 20 20 20 70 61 72 61 6c 6c 65 6c 6f 67 72 61 6d 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 74 | ...parallelogram...|...........t |
| 76260 | 72 69 61 6e 67 6c 65 20 20 20 20 20 20 72 69 67 68 74 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | riangle......right..........|... |
| 76280 | 20 20 20 20 5c 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....\....|...................... |
| 762a0 | 20 20 20 74 72 69 61 6e 67 6c 65 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 5c 20 20 20 7c | ...triangle.......|........\...| |
| 762c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 762e0 | 20 20 20 20 20 72 65 63 74 61 6e 67 6c 65 20 20 72 68 6f 6d 62 75 73 0a 20 20 20 20 20 20 20 20 | .....rectangle..rhombus......... |
| 76300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 76320 | 20 20 5c 20 20 20 20 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..\..../........................ |
| 76340 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 20 2f 0a 20 20 20 20 20 20 20 | ....................\../........ |
| 76360 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 76380 | 20 20 20 73 71 75 61 72 65 0a 0a 49 6e 61 64 65 71 75 61 63 69 65 73 20 6f 66 20 68 69 65 72 61 | ...square..Inadequacies.of.hiera |
| 763a0 | 72 63 68 69 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | rchies.......................... |
| 763c0 | 2e 2e 0a 0a 49 66 20 74 68 65 20 64 61 74 61 20 74 79 70 65 73 20 69 6e 20 6f 75 72 20 73 79 73 | ....If.the.data.types.in.our.sys |
| 763e0 | 74 65 6d 20 63 61 6e 20 62 65 20 6e 61 74 75 72 61 6c 6c 79 20 61 72 72 61 6e 67 65 64 20 69 6e | tem.can.be.naturally.arranged.in |
| 76400 | 20 61 20 74 6f 77 65 72 2c 0a 74 68 69 73 20 67 72 65 61 74 6c 79 20 73 69 6d 70 6c 69 66 69 65 | .a.tower,.this.greatly.simplifie |
| 76420 | 73 20 74 68 65 20 70 72 6f 62 6c 65 6d 73 20 6f 66 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 67 | s.the.problems.of.dealing.with.g |
| 76440 | 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 0a 6f 6e 20 64 69 66 66 65 72 65 6e 74 20 74 | eneric.operations.on.different.t |
| 76460 | 79 70 65 73 2c 20 61 73 20 77 65 20 68 61 76 65 20 73 65 65 6e 2e 20 20 55 6e 66 6f 72 74 75 6e | ypes,.as.we.have.seen...Unfortun |
| 76480 | 61 74 65 6c 79 2c 20 74 68 69 73 20 69 73 20 75 73 75 61 6c 6c 79 0a 6e 6f 74 20 74 68 65 20 63 | ately,.this.is.usually.not.the.c |
| 764a0 | 61 73 65 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 32 2d 32 36 3a 3a 20 69 6c 6c 75 73 74 | ase...*Note.Figure.2-26::.illust |
| 764c0 | 72 61 74 65 73 20 61 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 0a 61 72 72 61 6e 67 65 6d 65 6e 74 | rates.a.more.complex.arrangement |
| 764e0 | 20 6f 66 20 6d 69 78 65 64 20 74 79 70 65 73 2c 20 74 68 69 73 20 6f 6e 65 20 73 68 6f 77 69 6e | .of.mixed.types,.this.one.showin |
| 76500 | 67 20 72 65 6c 61 74 69 6f 6e 73 20 61 6d 6f 6e 67 20 64 69 66 66 65 72 65 6e 74 0a 74 79 70 65 | g.relations.among.different.type |
| 76520 | 73 20 6f 66 20 67 65 6f 6d 65 74 72 69 63 20 66 69 67 75 72 65 73 2e 20 20 57 65 20 73 65 65 20 | s.of.geometric.figures...We.see. |
| 76540 | 74 68 61 74 2c 20 69 6e 20 67 65 6e 65 72 61 6c 2c 20 61 20 74 79 70 65 20 6d 61 79 20 68 61 76 | that,.in.general,.a.type.may.hav |
| 76560 | 65 0a 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 73 75 62 74 79 70 65 2e 20 20 54 72 69 61 6e 67 | e.more.than.one.subtype...Triang |
| 76580 | 6c 65 73 20 61 6e 64 20 71 75 61 64 72 69 6c 61 74 65 72 61 6c 73 2c 20 66 6f 72 20 69 6e 73 74 | les.and.quadrilaterals,.for.inst |
| 765a0 | 61 6e 63 65 2c 20 61 72 65 0a 62 6f 74 68 20 73 75 62 74 79 70 65 73 20 6f 66 20 70 6f 6c 79 67 | ance,.are.both.subtypes.of.polyg |
| 765c0 | 6f 6e 73 2e 20 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 61 20 74 79 70 65 20 6d 61 79 20 68 61 | ons...In.addition,.a.type.may.ha |
| 765e0 | 76 65 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 0a 73 75 70 65 72 74 79 70 65 2e 20 20 46 6f 72 | ve.more.than.one.supertype...For |
| 76600 | 20 65 78 61 6d 70 6c 65 2c 20 61 6e 20 69 73 6f 73 63 65 6c 65 73 20 72 69 67 68 74 20 74 72 69 | .example,.an.isosceles.right.tri |
| 76620 | 61 6e 67 6c 65 20 6d 61 79 20 62 65 20 72 65 67 61 72 64 65 64 0a 65 69 74 68 65 72 20 61 73 20 | angle.may.be.regarded.either.as. |
| 76640 | 61 6e 20 69 73 6f 73 63 65 6c 65 73 20 74 72 69 61 6e 67 6c 65 20 6f 72 20 61 73 20 61 20 72 69 | an.isosceles.triangle.or.as.a.ri |
| 76660 | 67 68 74 20 74 72 69 61 6e 67 6c 65 2e 20 20 54 68 69 73 0a 6d 75 6c 74 69 70 6c 65 2d 73 75 70 | ght.triangle...This.multiple-sup |
| 76680 | 65 72 74 79 70 65 73 20 69 73 73 75 65 20 69 73 20 70 61 72 74 69 63 75 6c 61 72 6c 79 20 74 68 | ertypes.issue.is.particularly.th |
| 766a0 | 6f 72 6e 79 2c 20 73 69 6e 63 65 20 69 74 20 6d 65 61 6e 73 20 74 68 61 74 0a 74 68 65 72 65 20 | orny,.since.it.means.that.there. |
| 766c0 | 69 73 20 6e 6f 20 75 6e 69 71 75 65 20 77 61 79 20 74 6f 20 22 72 61 69 73 65 22 20 61 20 74 79 | is.no.unique.way.to."raise".a.ty |
| 766e0 | 70 65 20 69 6e 20 74 68 65 20 68 69 65 72 61 72 63 68 79 2e 20 20 46 69 6e 64 69 6e 67 20 74 68 | pe.in.the.hierarchy...Finding.th |
| 76700 | 65 0a 22 63 6f 72 72 65 63 74 22 20 73 75 70 65 72 74 79 70 65 20 69 6e 20 77 68 69 63 68 20 74 | e."correct".supertype.in.which.t |
| 76720 | 6f 20 61 70 70 6c 79 20 61 6e 20 6f 70 65 72 61 74 69 6f 6e 20 74 6f 20 61 6e 20 6f 62 6a 65 63 | o.apply.an.operation.to.an.objec |
| 76740 | 74 20 6d 61 79 0a 69 6e 76 6f 6c 76 65 20 63 6f 6e 73 69 64 65 72 61 62 6c 65 20 73 65 61 72 63 | t.may.involve.considerable.searc |
| 76760 | 68 69 6e 67 20 74 68 72 6f 75 67 68 20 74 68 65 20 65 6e 74 69 72 65 20 74 79 70 65 20 6e 65 74 | hing.through.the.entire.type.net |
| 76780 | 77 6f 72 6b 20 6f 6e 20 74 68 65 0a 70 61 72 74 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 | work.on.the.part.of.a.procedure. |
| 767a0 | 73 75 63 68 20 61 73 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 2e 20 20 53 69 6e 63 65 20 | such.as.`apply-generic'...Since. |
| 767c0 | 74 68 65 72 65 20 67 65 6e 65 72 61 6c 6c 79 20 61 72 65 0a 6d 75 6c 74 69 70 6c 65 20 73 75 62 | there.generally.are.multiple.sub |
| 767e0 | 74 79 70 65 73 20 66 6f 72 20 61 20 74 79 70 65 2c 20 74 68 65 72 65 20 69 73 20 61 20 73 69 6d | types.for.a.type,.there.is.a.sim |
| 76800 | 69 6c 61 72 20 70 72 6f 62 6c 65 6d 20 69 6e 20 63 6f 65 72 63 69 6e 67 20 61 0a 76 61 6c 75 65 | ilar.problem.in.coercing.a.value |
| 76820 | 20 22 64 6f 77 6e 22 20 74 68 65 20 74 79 70 65 20 68 69 65 72 61 72 63 68 79 2e 20 20 44 65 61 | ."down".the.type.hierarchy...Dea |
| 76840 | 6c 69 6e 67 20 77 69 74 68 20 6c 61 72 67 65 20 6e 75 6d 62 65 72 73 20 6f 66 0a 69 6e 74 65 72 | ling.with.large.numbers.of.inter |
| 76860 | 72 65 6c 61 74 65 64 20 74 79 70 65 73 20 77 68 69 6c 65 20 73 74 69 6c 6c 20 70 72 65 73 65 72 | related.types.while.still.preser |
| 76880 | 76 69 6e 67 20 6d 6f 64 75 6c 61 72 69 74 79 20 69 6e 20 74 68 65 20 64 65 73 69 67 6e 20 6f 66 | ving.modularity.in.the.design.of |
| 768a0 | 0a 6c 61 72 67 65 20 73 79 73 74 65 6d 73 20 69 73 20 76 65 72 79 20 64 69 66 66 69 63 75 6c 74 | .large.systems.is.very.difficult |
| 768c0 | 2c 20 61 6e 64 20 69 73 20 61 6e 20 61 72 65 61 20 6f 66 20 6d 75 63 68 20 63 75 72 72 65 6e 74 | ,.and.is.an.area.of.much.current |
| 768e0 | 0a 72 65 73 65 61 72 63 68 2e 28 34 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e | .research.(4).......*Exercise.2. |
| 76900 | 38 31 3a 2a 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 20 68 61 73 20 6e 6f 74 69 63 65 64 20 | 81:*.Louis.Reasoner.has.noticed. |
| 76920 | 74 68 61 74 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 0a 20 20 20 20 20 6d 61 79 20 74 72 | that.`apply-generic'......may.tr |
| 76940 | 79 20 74 6f 20 63 6f 65 72 63 65 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 65 61 63 | y.to.coerce.the.arguments.to.eac |
| 76960 | 68 20 6f 74 68 65 72 27 73 20 74 79 70 65 20 65 76 65 6e 20 69 66 20 74 68 65 79 0a 20 20 20 20 | h.other's.type.even.if.they..... |
| 76980 | 20 61 6c 72 65 61 64 79 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 74 79 70 65 2e 20 20 54 68 | .already.have.the.same.type...Th |
| 769a0 | 65 72 65 66 6f 72 65 2c 20 68 65 20 72 65 61 73 6f 6e 73 2c 20 77 65 20 6e 65 65 64 20 74 6f 20 | erefore,.he.reasons,.we.need.to. |
| 769c0 | 70 75 74 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 65 20 63 6f 65 72 63 | put......procedures.in.the.coerc |
| 769e0 | 69 6f 6e 20 74 61 62 6c 65 20 74 6f 20 22 63 6f 65 72 63 65 22 20 61 72 67 75 6d 65 6e 74 73 20 | ion.table.to."coerce".arguments. |
| 76a00 | 6f 66 20 65 61 63 68 0a 20 20 20 20 20 74 79 70 65 20 74 6f 20 74 68 65 69 72 20 6f 77 6e 20 74 | of.each......type.to.their.own.t |
| 76a20 | 79 70 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 6e 20 61 64 64 69 74 69 6f 6e 20 74 | ype...For.example,.in.addition.t |
| 76a40 | 6f 20 74 68 65 0a 20 20 20 20 20 60 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 2d 3e 63 6f 6d 70 6c | o.the......`scheme-number->compl |
| 76a60 | 65 78 27 20 63 6f 65 72 63 69 6f 6e 20 73 68 6f 77 6e 20 61 62 6f 76 65 2c 20 68 65 20 77 6f 75 | ex'.coercion.shown.above,.he.wou |
| 76a80 | 6c 64 20 64 6f 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 63 68 65 6d | ld.do:............(define.(schem |
| 76aa0 | 65 2d 6e 75 6d 62 65 72 2d 3e 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 20 6e 29 20 6e 29 0a 20 20 | e-number->scheme-number.n).n)... |
| 76ac0 | 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 6c 65 78 2d 3e 63 6f 6d 70 6c 65 | ........(define.(complex->comple |
| 76ae0 | 78 20 7a 29 20 7a 29 0a 20 20 20 20 20 20 20 20 20 20 28 70 75 74 2d 63 6f 65 72 63 69 6f 6e 20 | x.z).z)...........(put-coercion. |
| 76b00 | 27 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 20 27 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 0a 20 20 | 'scheme-number.'scheme-number... |
| 76b20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 63 68 65 6d 65 2d 6e 75 6d | ......................scheme-num |
| 76b40 | 62 65 72 2d 3e 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 28 70 | ber->scheme-number)...........(p |
| 76b60 | 75 74 2d 63 6f 65 72 63 69 6f 6e 20 27 63 6f 6d 70 6c 65 78 20 27 63 6f 6d 70 6c 65 78 20 63 6f | ut-coercion.'complex.'complex.co |
| 76b80 | 6d 70 6c 65 78 2d 3e 63 6f 6d 70 6c 65 78 29 0a 0a 20 20 20 20 20 20 20 61 2e 20 57 69 74 68 20 | mplex->complex).........a..With. |
| 76ba0 | 4c 6f 75 69 73 27 73 20 63 6f 65 72 63 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 73 74 | Louis's.coercion.procedures.inst |
| 76bc0 | 61 6c 6c 65 64 2c 20 77 68 61 74 20 68 61 70 70 65 6e 73 20 69 66 0a 20 20 20 20 20 20 20 20 20 | alled,.what.happens.if.......... |
| 76be0 | 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 69 73 20 63 61 6c 6c 65 64 20 77 69 74 68 20 | .`apply-generic'.is.called.with. |
| 76c00 | 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 20 6f 66 20 74 79 70 65 0a 20 20 20 20 20 20 20 20 20 20 | two.arguments.of.type........... |
| 76c20 | 60 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 27 20 6f 72 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 | `scheme-number'.or.two.arguments |
| 76c40 | 20 6f 66 20 74 79 70 65 20 60 63 6f 6d 70 6c 65 78 27 20 66 6f 72 20 61 6e 0a 20 20 20 20 20 20 | .of.type.`complex'.for.an....... |
| 76c60 | 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 69 73 20 6e 6f 74 20 66 6f 75 6e 64 20 | ....operation.that.is.not.found. |
| 76c80 | 69 6e 20 74 68 65 20 74 61 62 6c 65 20 66 6f 72 20 74 68 6f 73 65 20 74 79 70 65 73 3f 0a 20 20 | in.the.table.for.those.types?... |
| 76ca0 | 20 20 20 20 20 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 73 73 75 6d 65 20 74 68 61 74 | ........For.example,.assume.that |
| 76cc0 | 20 77 65 27 76 65 20 64 65 66 69 6e 65 64 20 61 20 67 65 6e 65 72 69 63 0a 20 20 20 20 20 20 20 | .we've.defined.a.generic........ |
| 76ce0 | 20 20 20 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 20 6f 70 65 72 61 74 69 6f 6e 3a 0a 0a 20 20 | ...exponentiation.operation:.... |
| 76d00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 20 78 20 79 29 20 28 | .............(define.(exp.x.y).( |
| 76d20 | 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 20 27 65 78 70 20 78 20 79 29 29 0a 0a 20 20 20 20 20 20 | apply-generic.'exp.x.y))........ |
| 76d40 | 20 20 20 20 61 6e 64 20 68 61 76 65 20 70 75 74 20 61 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 | ....and.have.put.a.procedure.for |
| 76d60 | 20 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 20 69 6e 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 | .exponentiation.in.the.......... |
| 76d80 | 20 53 63 68 65 6d 65 2d 6e 75 6d 62 65 72 20 70 61 63 6b 61 67 65 20 62 75 74 20 6e 6f 74 20 69 | .Scheme-number.package.but.not.i |
| 76da0 | 6e 20 61 6e 79 20 6f 74 68 65 72 20 70 61 63 6b 61 67 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 | n.any.other.package:............ |
| 76dc0 | 20 20 20 20 20 3b 3b 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 64 64 65 64 20 74 6f 20 53 63 68 65 6d | .....;;.following.added.to.Schem |
| 76de0 | 65 2d 6e 75 6d 62 65 72 20 70 61 63 6b 61 67 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e-number.package................ |
| 76e00 | 28 70 75 74 20 27 65 78 70 20 27 28 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 20 73 63 68 65 6d 65 | (put.'exp.'(scheme-number.scheme |
| 76e20 | 2d 6e 75 6d 62 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 | -number).....................(la |
| 76e40 | 6d 62 64 61 20 28 78 20 79 29 20 28 74 61 67 20 28 65 78 70 74 20 78 20 79 29 29 29 29 20 3b 20 | mbda.(x.y).(tag.(expt.x.y)))).;. |
| 76e60 | 75 73 69 6e 67 20 70 72 69 6d 69 74 69 76 65 20 60 65 78 70 74 27 0a 0a 20 20 20 20 20 20 20 20 | using.primitive.`expt'.......... |
| 76e80 | 20 20 57 68 61 74 20 68 61 70 70 65 6e 73 20 69 66 20 77 65 20 63 61 6c 6c 20 60 65 78 70 27 20 | ..What.happens.if.we.call.`exp'. |
| 76ea0 | 77 69 74 68 20 74 77 6f 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 61 73 0a 20 20 20 20 | with.two.complex.numbers.as..... |
| 76ec0 | 20 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 3f 0a 0a 20 20 20 20 20 20 20 62 2e 20 49 73 20 4c | ......arguments?.........b..Is.L |
| 76ee0 | 6f 75 69 73 20 63 6f 72 72 65 63 74 20 74 68 61 74 20 73 6f 6d 65 74 68 69 6e 67 20 68 61 64 20 | ouis.correct.that.something.had. |
| 76f00 | 74 6f 20 62 65 20 64 6f 6e 65 20 61 62 6f 75 74 20 63 6f 65 72 63 69 6f 6e 0a 20 20 20 20 20 20 | to.be.done.about.coercion....... |
| 76f20 | 20 20 20 20 77 69 74 68 20 61 72 67 75 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 73 61 6d 65 20 74 | ....with.arguments.of.the.same.t |
| 76f40 | 79 70 65 2c 20 6f 72 20 64 6f 65 73 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 77 6f 72 | ype,.or.does.`apply-generic'.wor |
| 76f60 | 6b 0a 20 20 20 20 20 20 20 20 20 20 63 6f 72 72 65 63 74 6c 79 20 61 73 20 69 73 3f 0a 0a 20 20 | k...........correctly.as.is?.... |
| 76f80 | 20 20 20 20 20 63 2e 20 4d 6f 64 69 66 79 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 73 | .....c..Modify.`apply-generic'.s |
| 76fa0 | 6f 20 74 68 61 74 20 69 74 20 64 6f 65 73 6e 27 74 20 74 72 79 20 63 6f 65 72 63 69 6f 6e 20 69 | o.that.it.doesn't.try.coercion.i |
| 76fc0 | 66 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 20 68 61 | f.the...........two.arguments.ha |
| 76fe0 | 76 65 20 74 68 65 20 73 61 6d 65 20 74 79 70 65 2e 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | ve.the.same.type.........*Exerci |
| 77000 | 73 65 20 32 2e 38 32 3a 2a 20 53 68 6f 77 20 68 6f 77 20 74 6f 20 67 65 6e 65 72 61 6c 69 7a 65 | se.2.82:*.Show.how.to.generalize |
| 77020 | 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 74 6f 20 68 61 6e 64 6c 65 0a 20 20 20 20 20 | .`apply-generic'.to.handle...... |
| 77040 | 63 6f 65 72 63 69 6f 6e 20 69 6e 20 74 68 65 20 67 65 6e 65 72 61 6c 20 63 61 73 65 20 6f 66 20 | coercion.in.the.general.case.of. |
| 77060 | 6d 75 6c 74 69 70 6c 65 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 4f 6e 65 20 73 74 72 61 74 65 67 | multiple.arguments...One.strateg |
| 77080 | 79 0a 20 20 20 20 20 69 73 20 74 6f 20 61 74 74 65 6d 70 74 20 74 6f 20 63 6f 65 72 63 65 20 61 | y......is.to.attempt.to.coerce.a |
| 770a0 | 6c 6c 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 74 68 65 20 74 79 70 65 20 6f 66 20 | ll.the.arguments.to.the.type.of. |
| 770c0 | 74 68 65 20 66 69 72 73 74 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 2c 20 74 68 65 6e 20 74 6f | the.first......argument,.then.to |
| 770e0 | 20 74 68 65 20 74 79 70 65 20 6f 66 20 74 68 65 20 73 65 63 6f 6e 64 20 61 72 67 75 6d 65 6e 74 | .the.type.of.the.second.argument |
| 77100 | 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 0a 20 20 20 20 20 47 69 76 65 20 61 6e 20 65 78 61 6d 70 6c | ,.and.so.on.......Give.an.exampl |
| 77120 | 65 20 6f 66 20 61 20 73 69 74 75 61 74 69 6f 6e 20 77 68 65 72 65 20 74 68 69 73 20 73 74 72 61 | e.of.a.situation.where.this.stra |
| 77140 | 74 65 67 79 20 28 61 6e 64 20 6c 69 6b 65 77 69 73 65 0a 20 20 20 20 20 74 68 65 20 74 77 6f 2d | tegy.(and.likewise......the.two- |
| 77160 | 61 72 67 75 6d 65 6e 74 20 76 65 72 73 69 6f 6e 20 67 69 76 65 6e 20 61 62 6f 76 65 29 20 69 73 | argument.version.given.above).is |
| 77180 | 20 6e 6f 74 20 73 75 66 66 69 63 69 65 6e 74 6c 79 20 67 65 6e 65 72 61 6c 2e 0a 20 20 20 20 20 | .not.sufficiently.general....... |
| 771a0 | 28 48 69 6e 74 3a 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 63 61 73 65 20 77 68 65 72 65 20 74 | (Hint:.Consider.the.case.where.t |
| 771c0 | 68 65 72 65 20 61 72 65 20 73 6f 6d 65 20 73 75 69 74 61 62 6c 65 20 6d 69 78 65 64 2d 74 79 70 | here.are.some.suitable.mixed-typ |
| 771e0 | 65 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 20 70 72 65 73 65 6e 74 20 69 6e 20 74 68 65 | e......operations.present.in.the |
| 77200 | 20 74 61 62 6c 65 20 74 68 61 74 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 74 72 69 65 64 2e 29 0a | .table.that.will.not.be.tried.). |
| 77220 | 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 38 33 3a 2a 20 53 75 70 70 6f 73 65 20 79 | ......*Exercise.2.83:*.Suppose.y |
| 77240 | 6f 75 20 61 72 65 20 64 65 73 69 67 6e 69 6e 67 20 61 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 | ou.are.designing.a.generic.arith |
| 77260 | 6d 65 74 69 63 0a 20 20 20 20 20 73 79 73 74 65 6d 20 66 6f 72 20 64 65 61 6c 69 6e 67 20 77 69 | metic......system.for.dealing.wi |
| 77280 | 74 68 20 74 68 65 20 74 6f 77 65 72 20 6f 66 20 74 79 70 65 73 20 73 68 6f 77 6e 20 69 6e 20 2a | th.the.tower.of.types.shown.in.* |
| 772a0 | 4e 6f 74 65 20 46 69 67 75 72 65 0a 20 20 20 20 20 32 2d 32 35 3a 3a 3a 20 69 6e 74 65 67 65 72 | Note.Figure......2-25:::.integer |
| 772c0 | 2c 20 72 61 74 69 6f 6e 61 6c 2c 20 72 65 61 6c 2c 20 63 6f 6d 70 6c 65 78 2e 20 20 46 6f 72 20 | ,.rational,.real,.complex...For. |
| 772e0 | 65 61 63 68 20 74 79 70 65 20 28 65 78 63 65 70 74 0a 20 20 20 20 20 63 6f 6d 70 6c 65 78 29 2c | each.type.(except......complex), |
| 77300 | 20 64 65 73 69 67 6e 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 72 61 69 73 65 73 20 | .design.a.procedure.that.raises. |
| 77320 | 6f 62 6a 65 63 74 73 20 6f 66 20 74 68 61 74 20 74 79 70 65 20 6f 6e 65 0a 20 20 20 20 20 6c 65 | objects.of.that.type.one......le |
| 77340 | 76 65 6c 20 69 6e 20 74 68 65 20 74 6f 77 65 72 2e 20 20 53 68 6f 77 20 68 6f 77 20 74 6f 20 69 | vel.in.the.tower...Show.how.to.i |
| 77360 | 6e 73 74 61 6c 6c 20 61 20 67 65 6e 65 72 69 63 20 60 72 61 69 73 65 27 0a 20 20 20 20 20 6f 70 | nstall.a.generic.`raise'......op |
| 77380 | 65 72 61 74 69 6f 6e 20 74 68 61 74 20 77 69 6c 6c 20 77 6f 72 6b 20 66 6f 72 20 65 61 63 68 20 | eration.that.will.work.for.each. |
| 773a0 | 74 79 70 65 20 28 65 78 63 65 70 74 20 63 6f 6d 70 6c 65 78 29 2e 0a 0a 20 20 20 20 20 2a 45 78 | type.(except.complex)........*Ex |
| 773c0 | 65 72 63 69 73 65 20 32 2e 38 34 3a 2a 20 55 73 69 6e 67 20 74 68 65 20 60 72 61 69 73 65 27 20 | ercise.2.84:*.Using.the.`raise'. |
| 773e0 | 6f 70 65 72 61 74 69 6f 6e 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 20 20 20 20 | operation.of.*Note.Exercise..... |
| 77400 | 20 32 2d 38 33 3a 3a 2c 20 6d 6f 64 69 66 79 20 74 68 65 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 | .2-83::,.modify.the.`apply-gener |
| 77420 | 69 63 27 20 70 72 6f 63 65 64 75 72 65 20 73 6f 20 74 68 61 74 20 69 74 20 63 6f 65 72 63 65 73 | ic'.procedure.so.that.it.coerces |
| 77440 | 0a 20 20 20 20 20 69 74 73 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 68 61 76 65 20 74 68 65 20 | ......its.arguments.to.have.the. |
| 77460 | 73 61 6d 65 20 74 79 70 65 20 62 79 20 74 68 65 20 6d 65 74 68 6f 64 20 6f 66 20 73 75 63 63 65 | same.type.by.the.method.of.succe |
| 77480 | 73 73 69 76 65 0a 20 20 20 20 20 72 61 69 73 69 6e 67 2c 20 61 73 20 64 69 73 63 75 73 73 65 64 | ssive......raising,.as.discussed |
| 774a0 | 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2e 20 20 59 6f 75 20 77 69 6c 6c 20 6e 65 65 64 | .in.this.section...You.will.need |
| 774c0 | 20 74 6f 20 64 65 76 69 73 65 20 61 0a 20 20 20 20 20 77 61 79 20 74 6f 20 74 65 73 74 20 77 68 | .to.devise.a......way.to.test.wh |
| 774e0 | 69 63 68 20 6f 66 20 74 77 6f 20 74 79 70 65 73 20 69 73 20 68 69 67 68 65 72 20 69 6e 20 74 68 | ich.of.two.types.is.higher.in.th |
| 77500 | 65 20 74 6f 77 65 72 2e 20 20 44 6f 20 74 68 69 73 20 69 6e 0a 20 20 20 20 20 61 20 6d 61 6e 6e | e.tower...Do.this.in......a.mann |
| 77520 | 65 72 20 74 68 61 74 20 69 73 20 22 63 6f 6d 70 61 74 69 62 6c 65 22 20 77 69 74 68 20 74 68 65 | er.that.is."compatible".with.the |
| 77540 | 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 20 61 6e 64 20 77 69 6c 6c 0a 20 20 20 | .rest.of.the.system.and.will.... |
| 77560 | 20 20 6e 6f 74 20 6c 65 61 64 20 74 6f 20 70 72 6f 62 6c 65 6d 73 20 69 6e 20 61 64 64 69 6e 67 | ..not.lead.to.problems.in.adding |
| 77580 | 20 6e 65 77 20 6c 65 76 65 6c 73 20 74 6f 20 74 68 65 20 74 6f 77 65 72 2e 0a 0a 20 20 20 20 20 | .new.levels.to.the.tower........ |
| 775a0 | 2a 45 78 65 72 63 69 73 65 20 32 2e 38 35 3a 2a 20 54 68 69 73 20 73 65 63 74 69 6f 6e 20 6d 65 | *Exercise.2.85:*.This.section.me |
| 775c0 | 6e 74 69 6f 6e 65 64 20 61 20 6d 65 74 68 6f 64 20 66 6f 72 20 22 73 69 6d 70 6c 69 66 79 69 6e | ntioned.a.method.for."simplifyin |
| 775e0 | 67 22 0a 20 20 20 20 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 20 62 79 20 6c 6f 77 65 72 69 6e | g"......a.data.object.by.lowerin |
| 77600 | 67 20 69 74 20 69 6e 20 74 68 65 20 74 6f 77 65 72 20 6f 66 20 74 79 70 65 73 20 61 73 20 66 61 | g.it.in.the.tower.of.types.as.fa |
| 77620 | 72 20 61 73 0a 20 20 20 20 20 70 6f 73 73 69 62 6c 65 2e 20 20 44 65 73 69 67 6e 20 61 20 70 72 | r.as......possible...Design.a.pr |
| 77640 | 6f 63 65 64 75 72 65 20 60 64 72 6f 70 27 20 74 68 61 74 20 61 63 63 6f 6d 70 6c 69 73 68 65 73 | ocedure.`drop'.that.accomplishes |
| 77660 | 20 74 68 69 73 20 66 6f 72 20 74 68 65 0a 20 20 20 20 20 74 6f 77 65 72 20 64 65 73 63 72 69 62 | .this.for.the......tower.describ |
| 77680 | 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 38 33 3a 3a 2e 20 20 54 68 | ed.in.*Note.Exercise.2-83::...Th |
| 776a0 | 65 20 6b 65 79 20 69 73 20 74 6f 20 64 65 63 69 64 65 2c 0a 20 20 20 20 20 69 6e 20 73 6f 6d 65 | e.key.is.to.decide,......in.some |
| 776c0 | 20 67 65 6e 65 72 61 6c 20 77 61 79 2c 20 77 68 65 74 68 65 72 20 61 6e 20 6f 62 6a 65 63 74 20 | .general.way,.whether.an.object. |
| 776e0 | 63 61 6e 20 62 65 20 6c 6f 77 65 72 65 64 2e 20 20 46 6f 72 0a 20 20 20 20 20 65 78 61 6d 70 6c | can.be.lowered...For......exampl |
| 77700 | 65 2c 20 74 68 65 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 31 2e 35 20 2b 20 30 69 20 63 | e,.the.complex.number.1.5.+.0i.c |
| 77720 | 61 6e 20 62 65 20 6c 6f 77 65 72 65 64 20 61 73 20 66 61 72 20 61 73 0a 20 20 20 20 20 60 72 65 | an.be.lowered.as.far.as......`re |
| 77740 | 61 6c 27 2c 20 74 68 65 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 31 20 2b 20 30 69 20 63 | al',.the.complex.number.1.+.0i.c |
| 77760 | 61 6e 20 62 65 20 6c 6f 77 65 72 65 64 20 61 73 20 66 61 72 20 61 73 0a 20 20 20 20 20 60 69 6e | an.be.lowered.as.far.as......`in |
| 77780 | 74 65 67 65 72 27 2c 20 61 6e 64 20 74 68 65 20 63 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 20 32 | teger',.and.the.complex.number.2 |
| 777a0 | 20 2b 20 33 69 20 63 61 6e 6e 6f 74 20 62 65 20 6c 6f 77 65 72 65 64 20 61 74 20 61 6c 6c 2e 0a | .+.3i.cannot.be.lowered.at.all.. |
| 777c0 | 20 20 20 20 20 48 65 72 65 20 69 73 20 61 20 70 6c 61 6e 20 66 6f 72 20 64 65 74 65 72 6d 69 6e | .....Here.is.a.plan.for.determin |
| 777e0 | 69 6e 67 20 77 68 65 74 68 65 72 20 61 6e 20 6f 62 6a 65 63 74 20 63 61 6e 20 62 65 20 6c 6f 77 | ing.whether.an.object.can.be.low |
| 77800 | 65 72 65 64 3a 0a 20 20 20 20 20 42 65 67 69 6e 20 62 79 20 64 65 66 69 6e 69 6e 67 20 61 20 67 | ered:......Begin.by.defining.a.g |
| 77820 | 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 20 60 70 72 6f 6a 65 63 74 27 20 74 68 61 74 20 | eneric.operation.`project'.that. |
| 77840 | 22 70 75 73 68 65 73 22 20 61 6e 0a 20 20 20 20 20 6f 62 6a 65 63 74 20 64 6f 77 6e 20 69 6e 20 | "pushes".an......object.down.in. |
| 77860 | 74 68 65 20 74 6f 77 65 72 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 70 72 6f 6a 65 63 74 | the.tower...For.example,.project |
| 77880 | 69 6e 67 20 61 20 63 6f 6d 70 6c 65 78 0a 20 20 20 20 20 6e 75 6d 62 65 72 20 77 6f 75 6c 64 20 | ing.a.complex......number.would. |
| 778a0 | 69 6e 76 6f 6c 76 65 20 74 68 72 6f 77 69 6e 67 20 61 77 61 79 20 74 68 65 20 69 6d 61 67 69 6e | involve.throwing.away.the.imagin |
| 778c0 | 61 72 79 20 70 61 72 74 2e 20 20 54 68 65 6e 20 61 0a 20 20 20 20 20 6e 75 6d 62 65 72 20 63 61 | ary.part...Then.a......number.ca |
| 778e0 | 6e 20 62 65 20 64 72 6f 70 70 65 64 20 69 66 2c 20 77 68 65 6e 20 77 65 20 60 70 72 6f 6a 65 63 | n.be.dropped.if,.when.we.`projec |
| 77900 | 74 27 20 69 74 20 61 6e 64 20 60 72 61 69 73 65 27 20 74 68 65 0a 20 20 20 20 20 72 65 73 75 6c | t'.it.and.`raise'.the......resul |
| 77920 | 74 20 62 61 63 6b 20 74 6f 20 74 68 65 20 74 79 70 65 20 77 65 20 73 74 61 72 74 65 64 20 77 69 | t.back.to.the.type.we.started.wi |
| 77940 | 74 68 2c 20 77 65 20 65 6e 64 20 75 70 20 77 69 74 68 20 73 6f 6d 65 74 68 69 6e 67 0a 20 20 20 | th,.we.end.up.with.something.... |
| 77960 | 20 20 65 71 75 61 6c 20 74 6f 20 77 68 61 74 20 77 65 20 73 74 61 72 74 65 64 20 77 69 74 68 2e | ..equal.to.what.we.started.with. |
| 77980 | 20 20 53 68 6f 77 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 69 73 20 69 64 65 | ..Show.how.to.implement.this.ide |
| 779a0 | 61 20 69 6e 0a 20 20 20 20 20 64 65 74 61 69 6c 2c 20 62 79 20 77 72 69 74 69 6e 67 20 61 20 60 | a.in......detail,.by.writing.a.` |
| 779c0 | 64 72 6f 70 27 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 64 72 6f 70 73 20 61 6e 20 6f 62 | drop'.procedure.that.drops.an.ob |
| 779e0 | 6a 65 63 74 20 61 73 20 66 61 72 0a 20 20 20 20 20 61 73 20 70 6f 73 73 69 62 6c 65 2e 20 20 59 | ject.as.far......as.possible...Y |
| 77a00 | 6f 75 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 64 65 73 69 67 6e 20 74 68 65 20 76 61 72 69 6f | ou.will.need.to.design.the.vario |
| 77a20 | 75 73 20 70 72 6f 6a 65 63 74 69 6f 6e 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 28 35 29 | us.projection......operations(5) |
| 77a40 | 20 61 6e 64 20 69 6e 73 74 61 6c 6c 20 60 70 72 6f 6a 65 63 74 27 20 61 73 20 61 20 67 65 6e 65 | .and.install.`project'.as.a.gene |
| 77a60 | 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 20 69 6e 20 74 68 65 0a 20 20 20 20 20 73 79 73 74 65 6d | ric.operation.in.the......system |
| 77a80 | 2e 20 20 59 6f 75 20 77 69 6c 6c 20 61 6c 73 6f 20 6e 65 65 64 20 74 6f 20 6d 61 6b 65 20 75 73 | ...You.will.also.need.to.make.us |
| 77aa0 | 65 20 6f 66 20 61 20 67 65 6e 65 72 69 63 20 65 71 75 61 6c 69 74 79 0a 20 20 20 20 20 70 72 65 | e.of.a.generic.equality......pre |
| 77ac0 | 64 69 63 61 74 65 2c 20 73 75 63 68 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f | dicate,.such.as.described.in.*No |
| 77ae0 | 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 37 39 3a 3a 2e 20 20 46 69 6e 61 6c 6c 79 2c 0a 20 20 | te.Exercise.2-79::...Finally,... |
| 77b00 | 20 20 20 75 73 65 20 60 64 72 6f 70 27 20 74 6f 20 72 65 77 72 69 74 65 20 60 61 70 70 6c 79 2d | ...use.`drop'.to.rewrite.`apply- |
| 77b20 | 67 65 6e 65 72 69 63 27 20 66 72 6f 6d 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 38 | generic'.from.*Note.Exercise.2-8 |
| 77b40 | 34 3a 3a 0a 20 20 20 20 20 73 6f 20 74 68 61 74 20 69 74 20 22 73 69 6d 70 6c 69 66 69 65 73 22 | 4::......so.that.it."simplifies" |
| 77b60 | 20 69 74 73 20 61 6e 73 77 65 72 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e | .its.answers........*Exercise.2. |
| 77b80 | 38 36 3a 2a 20 53 75 70 70 6f 73 65 20 77 65 20 77 61 6e 74 20 74 6f 20 68 61 6e 64 6c 65 20 63 | 86:*.Suppose.we.want.to.handle.c |
| 77ba0 | 6f 6d 70 6c 65 78 20 6e 75 6d 62 65 72 73 20 77 68 6f 73 65 0a 20 20 20 20 20 72 65 61 6c 20 70 | omplex.numbers.whose......real.p |
| 77bc0 | 61 72 74 73 2c 20 69 6d 61 67 69 6e 61 72 79 20 70 61 72 74 73 2c 20 6d 61 67 6e 69 74 75 64 65 | arts,.imaginary.parts,.magnitude |
| 77be0 | 73 2c 20 61 6e 64 20 61 6e 67 6c 65 73 20 63 61 6e 20 62 65 20 65 69 74 68 65 72 0a 20 20 20 20 | s,.and.angles.can.be.either..... |
| 77c00 | 20 6f 72 64 69 6e 61 72 79 20 6e 75 6d 62 65 72 73 2c 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 | .ordinary.numbers,.rational.numb |
| 77c20 | 65 72 73 2c 20 6f 72 20 6f 74 68 65 72 20 6e 75 6d 62 65 72 73 20 77 65 20 6d 69 67 68 74 20 77 | ers,.or.other.numbers.we.might.w |
| 77c40 | 69 73 68 0a 20 20 20 20 20 74 6f 20 61 64 64 20 74 6f 20 74 68 65 20 73 79 73 74 65 6d 2e 20 20 | ish......to.add.to.the.system... |
| 77c60 | 44 65 73 63 72 69 62 65 20 61 6e 64 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 63 68 61 6e 67 | Describe.and.implement.the.chang |
| 77c80 | 65 73 20 74 6f 20 74 68 65 0a 20 20 20 20 20 73 79 73 74 65 6d 20 6e 65 65 64 65 64 20 74 6f 20 | es.to.the......system.needed.to. |
| 77ca0 | 61 63 63 6f 6d 6d 6f 64 61 74 65 20 74 68 69 73 2e 20 20 59 6f 75 20 77 69 6c 6c 20 68 61 76 65 | accommodate.this...You.will.have |
| 77cc0 | 20 74 6f 20 64 65 66 69 6e 65 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 20 73 75 63 68 20 | .to.define......operations.such. |
| 77ce0 | 61 73 20 60 73 69 6e 65 27 20 61 6e 64 20 60 63 6f 73 69 6e 65 27 20 74 68 61 74 20 61 72 65 20 | as.`sine'.and.`cosine'.that.are. |
| 77d00 | 67 65 6e 65 72 69 63 20 6f 76 65 72 0a 20 20 20 20 20 6f 72 64 69 6e 61 72 79 20 6e 75 6d 62 65 | generic.over......ordinary.numbe |
| 77d20 | 72 73 20 61 6e 64 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 2e 0a 0a 20 20 20 2d 2d 2d | rs.and.rational.numbers......--- |
| 77d40 | 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 | -------.Footnotes.----------.... |
| 77d60 | 20 28 31 29 20 57 65 20 61 6c 73 6f 20 68 61 76 65 20 74 6f 20 73 75 70 70 6c 79 20 61 6e 20 61 | .(1).We.also.have.to.supply.an.a |
| 77d80 | 6c 6d 6f 73 74 20 69 64 65 6e 74 69 63 61 6c 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 68 61 6e | lmost.identical.procedure.to.han |
| 77da0 | 64 6c 65 0a 74 68 65 20 74 79 70 65 73 20 60 28 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 20 63 6f | dle.the.types.`(scheme-number.co |
| 77dc0 | 6d 70 6c 65 78 29 27 2e 0a 0a 20 20 20 28 32 29 20 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 | mplex)'......(2).See.*Note.Exerc |
| 77de0 | 69 73 65 20 32 2d 38 32 3a 3a 20 66 6f 72 20 67 65 6e 65 72 61 6c 69 7a 61 74 69 6f 6e 73 2e 0a | ise.2-82::.for.generalizations.. |
| 77e00 | 0a 20 20 20 28 33 29 20 49 66 20 77 65 20 61 72 65 20 63 6c 65 76 65 72 2c 20 77 65 20 63 61 6e | ....(3).If.we.are.clever,.we.can |
| 77e20 | 20 75 73 75 61 6c 6c 79 20 67 65 74 20 62 79 20 77 69 74 68 20 66 65 77 65 72 20 74 68 61 6e 20 | .usually.get.by.with.fewer.than. |
| 77e40 | 6e 5e 32 0a 63 6f 65 72 63 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 46 6f 72 20 69 6e | n^2.coercion.procedures...For.in |
| 77e60 | 73 74 61 6e 63 65 2c 20 69 66 20 77 65 20 6b 6e 6f 77 20 68 6f 77 20 74 6f 20 63 6f 6e 76 65 72 | stance,.if.we.know.how.to.conver |
| 77e80 | 74 20 66 72 6f 6d 20 74 79 70 65 0a 31 20 74 6f 20 74 79 70 65 20 32 20 61 6e 64 20 66 72 6f 6d | t.from.type.1.to.type.2.and.from |
| 77ea0 | 20 74 79 70 65 20 32 20 74 6f 20 74 79 70 65 20 33 2c 20 74 68 65 6e 20 77 65 20 63 61 6e 20 75 | .type.2.to.type.3,.then.we.can.u |
| 77ec0 | 73 65 20 74 68 69 73 20 6b 6e 6f 77 6c 65 64 67 65 20 74 6f 0a 63 6f 6e 76 65 72 74 20 66 72 6f | se.this.knowledge.to.convert.fro |
| 77ee0 | 6d 20 74 79 70 65 20 31 20 74 6f 20 74 79 70 65 20 33 2e 20 20 54 68 69 73 20 63 61 6e 20 67 72 | m.type.1.to.type.3...This.can.gr |
| 77f00 | 65 61 74 6c 79 20 64 65 63 72 65 61 73 65 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 0a 63 6f 65 | eatly.decrease.the.number.of.coe |
| 77f20 | 72 63 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 77 65 20 6e 65 65 64 20 74 6f 20 73 75 70 70 | rcion.procedures.we.need.to.supp |
| 77f40 | 6c 79 20 65 78 70 6c 69 63 69 74 6c 79 20 77 68 65 6e 20 77 65 20 61 64 64 20 61 20 6e 65 77 20 | ly.explicitly.when.we.add.a.new. |
| 77f60 | 74 79 70 65 0a 74 6f 20 74 68 65 20 73 79 73 74 65 6d 2e 20 20 49 66 20 77 65 20 61 72 65 20 77 | type.to.the.system...If.we.are.w |
| 77f80 | 69 6c 6c 69 6e 67 20 74 6f 20 62 75 69 6c 64 20 74 68 65 20 72 65 71 75 69 72 65 64 20 61 6d 6f | illing.to.build.the.required.amo |
| 77fa0 | 75 6e 74 20 6f 66 0a 73 6f 70 68 69 73 74 69 63 61 74 69 6f 6e 20 69 6e 74 6f 20 6f 75 72 20 73 | unt.of.sophistication.into.our.s |
| 77fc0 | 79 73 74 65 6d 2c 20 77 65 20 63 61 6e 20 68 61 76 65 20 69 74 20 73 65 61 72 63 68 20 74 68 65 | ystem,.we.can.have.it.search.the |
| 77fe0 | 20 22 67 72 61 70 68 22 20 6f 66 0a 72 65 6c 61 74 69 6f 6e 73 20 61 6d 6f 6e 67 20 74 79 70 65 | ."graph".of.relations.among.type |
| 78000 | 73 20 61 6e 64 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 67 65 6e 65 72 61 74 65 20 74 68 6f | s.and.automatically.generate.tho |
| 78020 | 73 65 20 63 6f 65 72 63 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 63 61 6e 20 | se.coercion.procedures.that.can. |
| 78040 | 62 65 20 69 6e 66 65 72 72 65 64 20 66 72 6f 6d 20 74 68 65 20 6f 6e 65 73 20 74 68 61 74 20 61 | be.inferred.from.the.ones.that.a |
| 78060 | 72 65 20 73 75 70 70 6c 69 65 64 0a 65 78 70 6c 69 63 69 74 6c 79 2e 0a 0a 20 20 20 28 34 29 20 | re.supplied.explicitly......(4). |
| 78080 | 54 68 69 73 20 73 74 61 74 65 6d 65 6e 74 2c 20 77 68 69 63 68 20 61 6c 73 6f 20 61 70 70 65 61 | This.statement,.which.also.appea |
| 780a0 | 72 73 20 69 6e 20 74 68 65 20 66 69 72 73 74 20 65 64 69 74 69 6f 6e 20 6f 66 20 74 68 69 73 0a | rs.in.the.first.edition.of.this. |
| 780c0 | 62 6f 6f 6b 2c 20 69 73 20 6a 75 73 74 20 61 73 20 74 72 75 65 20 6e 6f 77 20 61 73 20 69 74 20 | book,.is.just.as.true.now.as.it. |
| 780e0 | 77 61 73 20 77 68 65 6e 20 77 65 20 77 72 6f 74 65 20 69 74 20 74 77 65 6c 76 65 20 79 65 61 72 | was.when.we.wrote.it.twelve.year |
| 78100 | 73 20 61 67 6f 2e 0a 44 65 76 65 6c 6f 70 69 6e 67 20 61 20 75 73 65 66 75 6c 2c 20 67 65 6e 65 | s.ago..Developing.a.useful,.gene |
| 78120 | 72 61 6c 20 66 72 61 6d 65 77 6f 72 6b 20 66 6f 72 20 65 78 70 72 65 73 73 69 6e 67 20 74 68 65 | ral.framework.for.expressing.the |
| 78140 | 20 72 65 6c 61 74 69 6f 6e 73 0a 61 6d 6f 6e 67 20 64 69 66 66 65 72 65 6e 74 20 74 79 70 65 73 | .relations.among.different.types |
| 78160 | 20 6f 66 20 65 6e 74 69 74 69 65 73 20 28 77 68 61 74 20 70 68 69 6c 6f 73 6f 70 68 65 72 73 20 | .of.entities.(what.philosophers. |
| 78180 | 63 61 6c 6c 20 22 6f 6e 74 6f 6c 6f 67 79 22 29 0a 73 65 65 6d 73 20 69 6e 74 72 61 63 74 61 62 | call."ontology").seems.intractab |
| 781a0 | 6c 79 20 64 69 66 66 69 63 75 6c 74 2e 20 20 54 68 65 20 6d 61 69 6e 20 64 69 66 66 65 72 65 6e | ly.difficult...The.main.differen |
| 781c0 | 63 65 20 62 65 74 77 65 65 6e 20 74 68 65 20 63 6f 6e 66 75 73 69 6f 6e 0a 74 68 61 74 20 65 78 | ce.between.the.confusion.that.ex |
| 781e0 | 69 73 74 65 64 20 74 65 6e 20 79 65 61 72 73 20 61 67 6f 20 61 6e 64 20 74 68 65 20 63 6f 6e 66 | isted.ten.years.ago.and.the.conf |
| 78200 | 75 73 69 6f 6e 20 74 68 61 74 20 65 78 69 73 74 73 20 6e 6f 77 20 69 73 20 74 68 61 74 0a 6e 6f | usion.that.exists.now.is.that.no |
| 78220 | 77 20 61 20 76 61 72 69 65 74 79 20 6f 66 20 69 6e 61 64 65 71 75 61 74 65 20 6f 6e 74 6f 6c 6f | w.a.variety.of.inadequate.ontolo |
| 78240 | 67 69 63 61 6c 20 74 68 65 6f 72 69 65 73 20 68 61 76 65 20 62 65 65 6e 20 65 6d 62 6f 64 69 65 | gical.theories.have.been.embodie |
| 78260 | 64 20 69 6e 0a 61 20 70 6c 65 74 68 6f 72 61 20 6f 66 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 | d.in.a.plethora.of.corresponding |
| 78280 | 6c 79 20 69 6e 61 64 65 71 75 61 74 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 | ly.inadequate.programming.langua |
| 782a0 | 67 65 73 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 6d 75 63 68 20 6f 66 20 74 68 65 20 63 | ges...For.example,.much.of.the.c |
| 782c0 | 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 6f 62 6a 65 63 74 2d 6f 72 69 65 6e 74 65 64 20 70 72 6f | omplexity.of.object-oriented.pro |
| 782e0 | 67 72 61 6d 6d 69 6e 67 0a 6c 61 6e 67 75 61 67 65 73 2d 2d 61 6e 64 20 74 68 65 20 73 75 62 74 | gramming.languages--and.the.subt |
| 78300 | 6c 65 20 61 6e 64 20 63 6f 6e 66 75 73 69 6e 67 20 64 69 66 66 65 72 65 6e 63 65 73 20 61 6d 6f | le.and.confusing.differences.amo |
| 78320 | 6e 67 20 63 6f 6e 74 65 6d 70 6f 72 61 72 79 0a 6f 62 6a 65 63 74 2d 6f 72 69 65 6e 74 65 64 20 | ng.contemporary.object-oriented. |
| 78340 | 6c 61 6e 67 75 61 67 65 73 2d 2d 63 65 6e 74 65 72 73 20 6f 6e 20 74 68 65 20 74 72 65 61 74 6d | languages--centers.on.the.treatm |
| 78360 | 65 6e 74 20 6f 66 20 67 65 6e 65 72 69 63 0a 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 69 6e 74 | ent.of.generic.operations.on.int |
| 78380 | 65 72 72 65 6c 61 74 65 64 20 74 79 70 65 73 2e 20 20 4f 75 72 20 6f 77 6e 20 64 69 73 63 75 73 | errelated.types...Our.own.discus |
| 783a0 | 73 69 6f 6e 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 0a 6f 62 6a 65 63 74 73 20 69 6e | sion.of.computational.objects.in |
| 783c0 | 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 20 61 76 6f 69 64 73 20 74 68 65 73 65 20 | .*Note.Chapter.3::.avoids.these. |
| 783e0 | 69 73 73 75 65 73 20 65 6e 74 69 72 65 6c 79 2e 20 20 52 65 61 64 65 72 73 0a 66 61 6d 69 6c 69 | issues.entirely...Readers.famili |
| 78400 | 61 72 20 77 69 74 68 20 6f 62 6a 65 63 74 2d 6f 72 69 65 6e 74 65 64 20 70 72 6f 67 72 61 6d 6d | ar.with.object-oriented.programm |
| 78420 | 69 6e 67 20 77 69 6c 6c 20 6e 6f 74 69 63 65 20 74 68 61 74 20 77 65 20 68 61 76 65 20 6d 75 63 | ing.will.notice.that.we.have.muc |
| 78440 | 68 0a 74 6f 20 73 61 79 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 20 61 62 | h.to.say.in.*Note.Chapter.3::.ab |
| 78460 | 6f 75 74 20 6c 6f 63 61 6c 20 73 74 61 74 65 2c 20 62 75 74 20 77 65 20 64 6f 20 6e 6f 74 20 65 | out.local.state,.but.we.do.not.e |
| 78480 | 76 65 6e 0a 6d 65 6e 74 69 6f 6e 20 22 63 6c 61 73 73 65 73 22 20 6f 72 20 22 69 6e 68 65 72 69 | ven.mention."classes".or."inheri |
| 784a0 | 74 61 6e 63 65 2e 22 20 20 49 6e 20 66 61 63 74 2c 20 77 65 20 73 75 73 70 65 63 74 20 74 68 61 | tance."..In.fact,.we.suspect.tha |
| 784c0 | 74 20 74 68 65 73 65 0a 70 72 6f 62 6c 65 6d 73 20 63 61 6e 6e 6f 74 20 62 65 20 61 64 65 71 75 | t.these.problems.cannot.be.adequ |
| 784e0 | 61 74 65 6c 79 20 61 64 64 72 65 73 73 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 63 6f 6d 70 | ately.addressed.in.terms.of.comp |
| 78500 | 75 74 65 72 2d 6c 61 6e 67 75 61 67 65 0a 64 65 73 69 67 6e 20 61 6c 6f 6e 65 2c 20 77 69 74 68 | uter-language.design.alone,.with |
| 78520 | 6f 75 74 20 61 6c 73 6f 20 64 72 61 77 69 6e 67 20 6f 6e 20 77 6f 72 6b 20 69 6e 20 6b 6e 6f 77 | out.also.drawing.on.work.in.know |
| 78540 | 6c 65 64 67 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 0a 61 6e 64 20 61 75 74 6f 6d 61 74 | ledge.representation.and.automat |
| 78560 | 65 64 20 72 65 61 73 6f 6e 69 6e 67 2e 0a 0a 20 20 20 28 35 29 20 41 20 72 65 61 6c 20 6e 75 6d | ed.reasoning......(5).A.real.num |
| 78580 | 62 65 72 20 63 61 6e 20 62 65 20 70 72 6f 6a 65 63 74 65 64 20 74 6f 20 61 6e 20 69 6e 74 65 67 | ber.can.be.projected.to.an.integ |
| 785a0 | 65 72 20 75 73 69 6e 67 20 74 68 65 20 60 72 6f 75 6e 64 27 0a 70 72 69 6d 69 74 69 76 65 2c 20 | er.using.the.`round'.primitive,. |
| 785c0 | 77 68 69 63 68 20 72 65 74 75 72 6e 73 20 74 68 65 20 63 6c 6f 73 65 73 74 20 69 6e 74 65 67 65 | which.returns.the.closest.intege |
| 785e0 | 72 20 74 6f 20 69 74 73 20 61 72 67 75 6d 65 6e 74 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 | r.to.its.argument.....File:.sicp |
| 78600 | 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 32 2d 35 2d 33 2c 20 20 50 72 65 76 3a 20 32 2d 35 2d | .info,..Node:.2-5-3,..Prev:.2-5- |
| 78620 | 32 2c 20 20 55 70 3a 20 32 2d 35 0a 0a 32 2e 35 2e 33 20 45 78 61 6d 70 6c 65 3a 20 53 79 6d 62 | 2,..Up:.2-5..2.5.3.Example:.Symb |
| 78640 | 6f 6c 69 63 20 41 6c 67 65 62 72 61 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | olic.Algebra.------------------- |
| 78660 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 6f | ------------..The.manipulation.o |
| 78680 | 66 20 73 79 6d 62 6f 6c 69 63 20 61 6c 67 65 62 72 61 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 | f.symbolic.algebraic.expressions |
| 786a0 | 20 69 73 20 61 20 63 6f 6d 70 6c 65 78 20 70 72 6f 63 65 73 73 0a 74 68 61 74 20 69 6c 6c 75 73 | .is.a.complex.process.that.illus |
| 786c0 | 74 72 61 74 65 73 20 6d 61 6e 79 20 6f 66 20 74 68 65 20 68 61 72 64 65 73 74 20 70 72 6f 62 6c | trates.many.of.the.hardest.probl |
| 786e0 | 65 6d 73 20 74 68 61 74 20 6f 63 63 75 72 20 69 6e 20 74 68 65 20 64 65 73 69 67 6e 0a 6f 66 20 | ems.that.occur.in.the.design.of. |
| 78700 | 6c 61 72 67 65 2d 73 63 61 6c 65 20 73 79 73 74 65 6d 73 2e 20 20 41 6e 20 61 6c 67 65 62 72 61 | large-scale.systems...An.algebra |
| 78720 | 69 63 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 69 6e 20 67 65 6e 65 72 61 6c 2c 20 63 61 6e 20 62 | ic.expression,.in.general,.can.b |
| 78740 | 65 0a 76 69 65 77 65 64 20 61 73 20 61 20 68 69 65 72 61 72 63 68 69 63 61 6c 20 73 74 72 75 63 | e.viewed.as.a.hierarchical.struc |
| 78760 | 74 75 72 65 2c 20 61 20 74 72 65 65 20 6f 66 20 6f 70 65 72 61 74 6f 72 73 20 61 70 70 6c 69 65 | ture,.a.tree.of.operators.applie |
| 78780 | 64 20 74 6f 0a 6f 70 65 72 61 6e 64 73 2e 20 20 57 65 20 63 61 6e 20 63 6f 6e 73 74 72 75 63 74 | d.to.operands...We.can.construct |
| 787a0 | 20 61 6c 67 65 62 72 61 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 20 62 79 20 73 74 61 72 74 69 | .algebraic.expressions.by.starti |
| 787c0 | 6e 67 20 77 69 74 68 20 61 0a 73 65 74 20 6f 66 20 70 72 69 6d 69 74 69 76 65 20 6f 62 6a 65 63 | ng.with.a.set.of.primitive.objec |
| 787e0 | 74 73 2c 20 73 75 63 68 20 61 73 20 63 6f 6e 73 74 61 6e 74 73 20 61 6e 64 20 76 61 72 69 61 62 | ts,.such.as.constants.and.variab |
| 78800 | 6c 65 73 2c 20 61 6e 64 0a 63 6f 6d 62 69 6e 69 6e 67 20 74 68 65 73 65 20 62 79 20 6d 65 61 6e | les,.and.combining.these.by.mean |
| 78820 | 73 20 6f 66 20 61 6c 67 65 62 72 61 69 63 20 6f 70 65 72 61 74 6f 72 73 2c 20 73 75 63 68 20 61 | s.of.algebraic.operators,.such.a |
| 78840 | 73 20 61 64 64 69 74 69 6f 6e 20 61 6e 64 0a 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 2e 20 20 | s.addition.and.multiplication... |
| 78860 | 41 73 20 69 6e 20 6f 74 68 65 72 20 6c 61 6e 67 75 61 67 65 73 2c 20 77 65 20 66 6f 72 6d 20 61 | As.in.other.languages,.we.form.a |
| 78880 | 62 73 74 72 61 63 74 69 6f 6e 73 20 74 68 61 74 0a 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 72 65 | bstractions.that.enable.us.to.re |
| 788a0 | 66 65 72 20 74 6f 20 63 6f 6d 70 6f 75 6e 64 20 6f 62 6a 65 63 74 73 20 69 6e 20 73 69 6d 70 6c | fer.to.compound.objects.in.simpl |
| 788c0 | 65 20 74 65 72 6d 73 2e 20 20 54 79 70 69 63 61 6c 0a 61 62 73 74 72 61 63 74 69 6f 6e 73 20 69 | e.terms...Typical.abstractions.i |
| 788e0 | 6e 20 73 79 6d 62 6f 6c 69 63 20 61 6c 67 65 62 72 61 20 61 72 65 20 69 64 65 61 73 20 73 75 63 | n.symbolic.algebra.are.ideas.suc |
| 78900 | 68 20 61 73 20 6c 69 6e 65 61 72 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 2c 0a 70 6f 6c 79 6e 6f 6d | h.as.linear.combination,.polynom |
| 78920 | 69 61 6c 2c 20 72 61 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 2c 20 6f 72 20 74 72 69 67 6f | ial,.rational.function,.or.trigo |
| 78940 | 6e 6f 6d 65 74 72 69 63 20 66 75 6e 63 74 69 6f 6e 2e 20 20 57 65 20 63 61 6e 0a 72 65 67 61 72 | nometric.function...We.can.regar |
| 78960 | 64 20 74 68 65 73 65 20 61 73 20 63 6f 6d 70 6f 75 6e 64 20 22 74 79 70 65 73 2c 22 20 77 68 69 | d.these.as.compound."types,".whi |
| 78980 | 63 68 20 61 72 65 20 6f 66 74 65 6e 20 75 73 65 66 75 6c 20 66 6f 72 20 64 69 72 65 63 74 69 6e | ch.are.often.useful.for.directin |
| 789a0 | 67 0a 74 68 65 20 70 72 6f 63 65 73 73 69 6e 67 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 2e | g.the.processing.of.expressions. |
| 789c0 | 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 6f 75 6c 64 20 64 65 73 63 72 69 62 65 | ..For.example,.we.could.describe |
| 789e0 | 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 78 5e 32 20 73 69 6e 20 28 79 | .the.expression.......x^2.sin.(y |
| 78a00 | 5e 32 20 2b 20 31 29 20 2b 20 72 20 63 6f 73 20 32 79 20 2b 20 63 6f 73 28 79 5e 33 20 2d 20 32 | ^2.+.1).+.r.cos.2y.+.cos(y^3.-.2 |
| 78a20 | 79 5e 32 29 0a 0a 61 73 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 69 6e 20 78 20 77 69 74 68 20 | y^2)..as.a.polynomial.in.x.with. |
| 78a40 | 63 6f 65 66 66 69 63 69 65 6e 74 73 20 74 68 61 74 20 61 72 65 20 74 72 69 67 6f 6e 6f 6d 65 74 | coefficients.that.are.trigonomet |
| 78a60 | 72 69 63 20 66 75 6e 63 74 69 6f 6e 73 0a 6f 66 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e 20 | ric.functions.of.polynomials.in. |
| 78a80 | 79 20 77 68 6f 73 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 61 72 65 20 69 6e 74 65 67 65 72 | y.whose.coefficients.are.integer |
| 78aa0 | 73 2e 0a 0a 20 20 20 57 65 20 77 69 6c 6c 20 6e 6f 74 20 61 74 74 65 6d 70 74 20 74 6f 20 64 65 | s......We.will.not.attempt.to.de |
| 78ac0 | 76 65 6c 6f 70 20 61 20 63 6f 6d 70 6c 65 74 65 20 61 6c 67 65 62 72 61 69 63 2d 6d 61 6e 69 70 | velop.a.complete.algebraic-manip |
| 78ae0 | 75 6c 61 74 69 6f 6e 0a 73 79 73 74 65 6d 20 68 65 72 65 2e 20 20 53 75 63 68 20 73 79 73 74 65 | ulation.system.here...Such.syste |
| 78b00 | 6d 73 20 61 72 65 20 65 78 63 65 65 64 69 6e 67 6c 79 20 63 6f 6d 70 6c 65 78 20 70 72 6f 67 72 | ms.are.exceedingly.complex.progr |
| 78b20 | 61 6d 73 2c 20 65 6d 62 6f 64 79 69 6e 67 0a 64 65 65 70 20 61 6c 67 65 62 72 61 69 63 20 6b 6e | ams,.embodying.deep.algebraic.kn |
| 78b40 | 6f 77 6c 65 64 67 65 20 61 6e 64 20 65 6c 65 67 61 6e 74 20 61 6c 67 6f 72 69 74 68 6d 73 2e 20 | owledge.and.elegant.algorithms.. |
| 78b60 | 20 57 68 61 74 20 77 65 20 77 69 6c 6c 20 64 6f 20 69 73 0a 6c 6f 6f 6b 20 61 74 20 61 20 73 69 | .What.we.will.do.is.look.at.a.si |
| 78b80 | 6d 70 6c 65 20 62 75 74 20 69 6d 70 6f 72 74 61 6e 74 20 70 61 72 74 20 6f 66 20 61 6c 67 65 62 | mple.but.important.part.of.algeb |
| 78ba0 | 72 61 69 63 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 3a 20 74 68 65 0a 61 72 69 74 68 6d 65 74 69 | raic.manipulation:.the.arithmeti |
| 78bc0 | 63 20 6f 66 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2e 20 20 57 65 20 77 69 6c 6c 20 69 6c 6c 75 73 | c.of.polynomials...We.will.illus |
| 78be0 | 74 72 61 74 65 20 74 68 65 20 6b 69 6e 64 73 20 6f 66 20 64 65 63 69 73 69 6f 6e 73 0a 74 68 65 | trate.the.kinds.of.decisions.the |
| 78c00 | 20 64 65 73 69 67 6e 65 72 20 6f 66 20 73 75 63 68 20 61 20 73 79 73 74 65 6d 20 66 61 63 65 73 | .designer.of.such.a.system.faces |
| 78c20 | 2c 20 61 6e 64 20 68 6f 77 20 74 6f 20 61 70 70 6c 79 20 74 68 65 20 69 64 65 61 73 20 6f 66 0a | ,.and.how.to.apply.the.ideas.of. |
| 78c40 | 61 62 73 74 72 61 63 74 20 64 61 74 61 20 61 6e 64 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 | abstract.data.and.generic.operat |
| 78c60 | 69 6f 6e 73 20 74 6f 20 68 65 6c 70 20 6f 72 67 61 6e 69 7a 65 20 74 68 69 73 20 65 66 66 6f 72 | ions.to.help.organize.this.effor |
| 78c80 | 74 2e 0a 0a 41 72 69 74 68 6d 65 74 69 63 20 6f 6e 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 0a 2e 2e | t...Arithmetic.on.polynomials... |
| 78ca0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 4f 75 72 20 66 69 72 | .........................Our.fir |
| 78cc0 | 73 74 20 74 61 73 6b 20 69 6e 20 64 65 73 69 67 6e 69 6e 67 20 61 20 73 79 73 74 65 6d 20 66 6f | st.task.in.designing.a.system.fo |
| 78ce0 | 72 20 70 65 72 66 6f 72 6d 69 6e 67 20 61 72 69 74 68 6d 65 74 69 63 20 6f 6e 0a 70 6f 6c 79 6e | r.performing.arithmetic.on.polyn |
| 78d00 | 6f 6d 69 61 6c 73 20 69 73 20 74 6f 20 64 65 63 69 64 65 20 6a 75 73 74 20 77 68 61 74 20 61 20 | omials.is.to.decide.just.what.a. |
| 78d20 | 70 6f 6c 79 6e 6f 6d 69 61 6c 20 69 73 2e 20 20 50 6f 6c 79 6e 6f 6d 69 61 6c 73 20 61 72 65 0a | polynomial.is...Polynomials.are. |
| 78d40 | 6e 6f 72 6d 61 6c 6c 79 20 64 65 66 69 6e 65 64 20 72 65 6c 61 74 69 76 65 20 74 6f 20 63 65 72 | normally.defined.relative.to.cer |
| 78d60 | 74 61 69 6e 20 76 61 72 69 61 62 6c 65 73 20 28 74 68 65 20 22 69 6e 64 65 74 65 72 6d 69 6e 61 | tain.variables.(the."indetermina |
| 78d80 | 74 65 73 22 20 6f 66 0a 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 29 2e 20 20 46 6f 72 20 73 69 | tes".of.the.polynomial)...For.si |
| 78da0 | 6d 70 6c 69 63 69 74 79 2c 20 77 65 20 77 69 6c 6c 20 72 65 73 74 72 69 63 74 20 6f 75 72 73 65 | mplicity,.we.will.restrict.ourse |
| 78dc0 | 6c 76 65 73 20 74 6f 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 68 61 76 69 6e 67 20 6a 75 73 74 20 | lves.to.polynomials.having.just. |
| 78de0 | 6f 6e 65 20 69 6e 64 65 74 65 72 6d 69 6e 61 74 65 20 28 22 75 6e 69 76 61 72 69 61 74 65 0a 70 | one.indeterminate.("univariate.p |
| 78e00 | 6f 6c 79 6e 6f 6d 69 61 6c 73 22 29 2e 28 31 29 20 57 65 20 77 69 6c 6c 20 64 65 66 69 6e 65 20 | olynomials").(1).We.will.define. |
| 78e20 | 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 74 6f 20 62 65 20 61 20 73 75 6d 20 6f 66 20 74 65 72 6d | a.polynomial.to.be.a.sum.of.term |
| 78e40 | 73 2c 0a 65 61 63 68 20 6f 66 20 77 68 69 63 68 20 69 73 20 65 69 74 68 65 72 20 61 20 63 6f 65 | s,.each.of.which.is.either.a.coe |
| 78e60 | 66 66 69 63 69 65 6e 74 2c 20 61 20 70 6f 77 65 72 20 6f 66 20 74 68 65 20 69 6e 64 65 74 65 72 | fficient,.a.power.of.the.indeter |
| 78e80 | 6d 69 6e 61 74 65 2c 20 6f 72 0a 61 20 70 72 6f 64 75 63 74 20 6f 66 20 61 20 63 6f 65 66 66 69 | minate,.or.a.product.of.a.coeffi |
| 78ea0 | 63 69 65 6e 74 20 61 6e 64 20 61 20 70 6f 77 65 72 20 6f 66 20 74 68 65 20 69 6e 64 65 74 65 72 | cient.and.a.power.of.the.indeter |
| 78ec0 | 6d 69 6e 61 74 65 2e 20 20 41 0a 63 6f 65 66 66 69 63 69 65 6e 74 20 69 73 20 64 65 66 69 6e 65 | minate...A.coefficient.is.define |
| 78ee0 | 64 20 61 73 20 61 6e 20 61 6c 67 65 62 72 61 69 63 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 | d.as.an.algebraic.expression.tha |
| 78f00 | 74 20 69 73 20 6e 6f 74 20 64 65 70 65 6e 64 65 6e 74 0a 75 70 6f 6e 20 74 68 65 20 69 6e 64 65 | t.is.not.dependent.upon.the.inde |
| 78f20 | 74 65 72 6d 69 6e 61 74 65 20 6f 66 20 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 2e 20 20 46 6f | terminate.of.the.polynomial...Fo |
| 78f40 | 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 35 78 5e 32 20 2b 20 33 72 20 2b 20 37 0a 0a | r.example,.......5x^2.+.3r.+.7.. |
| 78f60 | 69 73 20 61 20 73 69 6d 70 6c 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 69 6e 20 78 2c 20 61 6e 64 | is.a.simple.polynomial.in.x,.and |
| 78f80 | 0a 0a 20 20 20 20 20 28 79 5e 32 20 2b 20 31 29 72 5e 33 20 2b 20 28 32 79 29 78 20 2b 20 31 0a | .......(y^2.+.1)r^3.+.(2y)x.+.1. |
| 78fa0 | 0a 69 73 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 69 6e 20 78 20 77 68 6f 73 65 20 63 6f 65 66 | .is.a.polynomial.in.x.whose.coef |
| 78fc0 | 66 69 63 69 65 6e 74 73 20 61 72 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e 20 79 2e 0a 0a | ficients.are.polynomials.in.y... |
| 78fe0 | 20 20 20 41 6c 72 65 61 64 79 20 77 65 20 61 72 65 20 73 6b 69 72 74 69 6e 67 20 73 6f 6d 65 20 | ...Already.we.are.skirting.some. |
| 79000 | 74 68 6f 72 6e 79 20 69 73 73 75 65 73 2e 20 20 49 73 20 74 68 65 20 66 69 72 73 74 20 6f 66 20 | thorny.issues...Is.the.first.of. |
| 79020 | 74 68 65 73 65 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 | these.polynomials.the.same.as.th |
| 79040 | 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 35 79 5e 32 20 2b 20 33 79 20 2b 20 37 2c 20 6f 72 20 6e | e.polynomial.5y^2.+.3y.+.7,.or.n |
| 79060 | 6f 74 3f 20 20 41 0a 72 65 61 73 6f 6e 61 62 6c 65 20 61 6e 73 77 65 72 20 6d 69 67 68 74 20 62 | ot?..A.reasonable.answer.might.b |
| 79080 | 65 20 22 79 65 73 2c 20 69 66 20 77 65 20 61 72 65 20 63 6f 6e 73 69 64 65 72 69 6e 67 20 61 20 | e."yes,.if.we.are.considering.a. |
| 790a0 | 70 6f 6c 79 6e 6f 6d 69 61 6c 0a 70 75 72 65 6c 79 20 61 73 20 61 20 6d 61 74 68 65 6d 61 74 69 | polynomial.purely.as.a.mathemati |
| 790c0 | 63 61 6c 20 66 75 6e 63 74 69 6f 6e 2c 20 62 75 74 20 6e 6f 2c 20 69 66 20 77 65 20 61 72 65 20 | cal.function,.but.no,.if.we.are. |
| 790e0 | 63 6f 6e 73 69 64 65 72 69 6e 67 20 61 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 20 74 6f 20 62 65 20 61 | considering.a.polynomial.to.be.a |
| 79100 | 20 73 79 6e 74 61 63 74 69 63 20 66 6f 72 6d 2e 22 20 20 54 68 65 20 73 65 63 6f 6e 64 20 70 6f | .syntactic.form."..The.second.po |
| 79120 | 6c 79 6e 6f 6d 69 61 6c 20 69 73 0a 61 6c 67 65 62 72 61 69 63 61 6c 6c 79 20 65 71 75 69 76 61 | lynomial.is.algebraically.equiva |
| 79140 | 6c 65 6e 74 20 74 6f 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 69 6e 20 79 20 77 68 6f 73 65 20 | lent.to.a.polynomial.in.y.whose. |
| 79160 | 63 6f 65 66 66 69 63 69 65 6e 74 73 20 61 72 65 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e 20 | coefficients.are.polynomials.in. |
| 79180 | 78 2e 20 20 53 68 6f 75 6c 64 20 6f 75 72 20 73 79 73 74 65 6d 20 72 65 63 6f 67 6e 69 7a 65 20 | x...Should.our.system.recognize. |
| 791a0 | 74 68 69 73 2c 20 6f 72 20 6e 6f 74 3f 0a 46 75 72 74 68 65 72 6d 6f 72 65 2c 20 74 68 65 72 65 | this,.or.not?.Furthermore,.there |
| 791c0 | 20 61 72 65 20 6f 74 68 65 72 20 77 61 79 73 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 61 20 70 | .are.other.ways.to.represent.a.p |
| 791e0 | 6f 6c 79 6e 6f 6d 69 61 6c 2d 2d 66 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 61 73 20 61 20 70 72 6f | olynomial--for.example,.as.a.pro |
| 79200 | 64 75 63 74 20 6f 66 20 66 61 63 74 6f 72 73 2c 20 6f 72 20 28 66 6f 72 20 61 20 75 6e 69 76 61 | duct.of.factors,.or.(for.a.univa |
| 79220 | 72 69 61 74 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 29 20 61 73 0a 74 68 65 20 73 65 74 20 6f 66 20 | riate.polynomial).as.the.set.of. |
| 79240 | 72 6f 6f 74 73 2c 20 6f 72 20 61 73 20 61 20 6c 69 73 74 69 6e 67 20 6f 66 20 74 68 65 20 76 61 | roots,.or.as.a.listing.of.the.va |
| 79260 | 6c 75 65 73 20 6f 66 20 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 61 74 20 61 0a 73 70 65 63 | lues.of.the.polynomial.at.a.spec |
| 79280 | 69 66 69 65 64 20 73 65 74 20 6f 66 20 70 6f 69 6e 74 73 2e 28 32 29 20 20 57 65 20 63 61 6e 20 | ified.set.of.points.(2)..We.can. |
| 792a0 | 66 69 6e 65 73 73 65 20 74 68 65 73 65 20 71 75 65 73 74 69 6f 6e 73 20 62 79 20 64 65 63 69 64 | finesse.these.questions.by.decid |
| 792c0 | 69 6e 67 0a 74 68 61 74 20 69 6e 20 6f 75 72 20 61 6c 67 65 62 72 61 69 63 2d 6d 61 6e 69 70 75 | ing.that.in.our.algebraic-manipu |
| 792e0 | 6c 61 74 69 6f 6e 20 73 79 73 74 65 6d 20 61 20 22 70 6f 6c 79 6e 6f 6d 69 61 6c 22 20 77 69 6c | lation.system.a."polynomial".wil |
| 79300 | 6c 20 62 65 20 61 0a 70 61 72 74 69 63 75 6c 61 72 20 73 79 6e 74 61 63 74 69 63 20 66 6f 72 6d | l.be.a.particular.syntactic.form |
| 79320 | 2c 20 6e 6f 74 20 69 74 73 20 75 6e 64 65 72 6c 79 69 6e 67 20 6d 61 74 68 65 6d 61 74 69 63 61 | ,.not.its.underlying.mathematica |
| 79340 | 6c 20 6d 65 61 6e 69 6e 67 2e 0a 0a 20 20 20 4e 6f 77 20 77 65 20 6d 75 73 74 20 63 6f 6e 73 69 | l.meaning......Now.we.must.consi |
| 79360 | 64 65 72 20 68 6f 77 20 74 6f 20 67 6f 20 61 62 6f 75 74 20 64 6f 69 6e 67 20 61 72 69 74 68 6d | der.how.to.go.about.doing.arithm |
| 79380 | 65 74 69 63 20 6f 6e 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2e 20 20 49 6e 20 74 68 69 73 20 73 69 | etic.on.polynomials...In.this.si |
| 793a0 | 6d 70 6c 65 20 73 79 73 74 65 6d 2c 20 77 65 20 77 69 6c 6c 20 63 6f 6e 73 69 64 65 72 20 6f 6e | mple.system,.we.will.consider.on |
| 793c0 | 6c 79 20 61 64 64 69 74 69 6f 6e 20 61 6e 64 0a 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 2e 20 | ly.addition.and.multiplication.. |
| 793e0 | 20 4d 6f 72 65 6f 76 65 72 2c 20 77 65 20 77 69 6c 6c 20 69 6e 73 69 73 74 20 74 68 61 74 20 74 | .Moreover,.we.will.insist.that.t |
| 79400 | 77 6f 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 74 6f 20 62 65 0a 63 6f 6d 62 69 6e 65 64 20 6d 75 | wo.polynomials.to.be.combined.mu |
| 79420 | 73 74 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 69 6e 64 65 74 65 72 6d 69 6e 61 74 65 2e 0a | st.have.the.same.indeterminate.. |
| 79440 | 0a 20 20 20 57 65 20 77 69 6c 6c 20 61 70 70 72 6f 61 63 68 20 74 68 65 20 64 65 73 69 67 6e 20 | ....We.will.approach.the.design. |
| 79460 | 6f 66 20 6f 75 72 20 73 79 73 74 65 6d 20 62 79 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 65 20 66 | of.our.system.by.following.the.f |
| 79480 | 61 6d 69 6c 69 61 72 0a 64 69 73 63 69 70 6c 69 6e 65 20 6f 66 20 64 61 74 61 20 61 62 73 74 72 | amiliar.discipline.of.data.abstr |
| 794a0 | 61 63 74 69 6f 6e 2e 20 20 57 65 20 77 69 6c 6c 20 72 65 70 72 65 73 65 6e 74 20 70 6f 6c 79 6e | action...We.will.represent.polyn |
| 794c0 | 6f 6d 69 61 6c 73 20 75 73 69 6e 67 20 61 0a 64 61 74 61 20 73 74 72 75 63 74 75 72 65 20 63 61 | omials.using.a.data.structure.ca |
| 794e0 | 6c 6c 65 64 20 61 20 22 70 6f 6c 79 22 2c 20 77 68 69 63 68 20 63 6f 6e 73 69 73 74 73 20 6f 66 | lled.a."poly",.which.consists.of |
| 79500 | 20 61 20 76 61 72 69 61 62 6c 65 20 61 6e 64 20 61 0a 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 | .a.variable.and.a.collection.of. |
| 79520 | 74 65 72 6d 73 2e 20 20 57 65 20 61 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 68 61 76 65 20 73 | terms...We.assume.that.we.have.s |
| 79540 | 65 6c 65 63 74 6f 72 73 20 60 76 61 72 69 61 62 6c 65 27 20 61 6e 64 0a 60 74 65 72 6d 2d 6c 69 | electors.`variable'.and.`term-li |
| 79560 | 73 74 27 20 74 68 61 74 20 65 78 74 72 61 63 74 20 74 68 6f 73 65 20 70 61 72 74 73 20 66 72 6f | st'.that.extract.those.parts.fro |
| 79580 | 6d 20 61 20 70 6f 6c 79 20 61 6e 64 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 0a 60 6d 61 6b 65 | m.a.poly.and.a.constructor.`make |
| 795a0 | 2d 70 6f 6c 79 27 20 74 68 61 74 20 61 73 73 65 6d 62 6c 65 73 20 61 20 70 6f 6c 79 20 66 72 6f | -poly'.that.assembles.a.poly.fro |
| 795c0 | 6d 20 61 20 67 69 76 65 6e 20 76 61 72 69 61 62 6c 65 20 61 6e 64 20 61 20 74 65 72 6d 0a 6c 69 | m.a.given.variable.and.a.term.li |
| 795e0 | 73 74 2e 20 20 41 20 76 61 72 69 61 62 6c 65 20 77 69 6c 6c 20 62 65 20 6a 75 73 74 20 61 20 73 | st...A.variable.will.be.just.a.s |
| 79600 | 79 6d 62 6f 6c 2c 20 73 6f 20 77 65 20 63 61 6e 20 75 73 65 20 74 68 65 0a 60 73 61 6d 65 2d 76 | ymbol,.so.we.can.use.the.`same-v |
| 79620 | 61 72 69 61 62 6c 65 3f 27 20 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 | ariable?'..procedure.of.section. |
| 79640 | 2a 4e 6f 74 65 20 32 2d 33 2d 32 3a 3a 20 74 6f 20 63 6f 6d 70 61 72 65 0a 76 61 72 69 61 62 6c | *Note.2-3-2::.to.compare.variabl |
| 79660 | 65 73 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 64 65 | es...The.following.procedures.de |
| 79680 | 66 69 6e 65 20 61 64 64 69 74 69 6f 6e 20 61 6e 64 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e | fine.addition.and.multiplication |
| 796a0 | 0a 6f 66 20 70 6f 6c 79 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 70 6f | .of.polys:.......(define.(add-po |
| 796c0 | 6c 79 20 70 31 20 70 32 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 73 61 6d 65 2d 76 61 72 69 61 | ly.p1.p2)........(if.(same-varia |
| 796e0 | 62 6c 65 3f 20 28 76 61 72 69 61 62 6c 65 20 70 31 29 20 28 76 61 72 69 61 62 6c 65 20 70 32 29 | ble?.(variable.p1).(variable.p2) |
| 79700 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 70 6f 6c 79 20 28 76 61 72 69 61 62 6c | )............(make-poly.(variabl |
| 79720 | 65 20 70 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 | e.p1).......................(add |
| 79740 | 2d 74 65 72 6d 73 20 28 74 65 72 6d 2d 6c 69 73 74 20 70 31 29 0a 20 20 20 20 20 20 20 20 20 20 | -terms.(term-list.p1)........... |
| 79760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 72 6d 2d 6c 69 73 | .......................(term-lis |
| 79780 | 74 20 70 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 50 6f 6c 79 73 | t.p2)))............(error."Polys |
| 797a0 | 20 6e 6f 74 20 69 6e 20 73 61 6d 65 20 76 61 72 20 2d 2d 20 41 44 44 2d 50 4f 4c 59 22 0a 20 20 | .not.in.same.var.--.ADD-POLY"... |
| 797c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 70 31 20 70 32 29 29 29 29 0a | ................(list.p1.p2)))). |
| 797e0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 2d 70 6f 6c 79 20 70 31 20 70 32 29 0a 20 | ......(define.(mul-poly.p1.p2).. |
| 79800 | 20 20 20 20 20 20 28 69 66 20 28 73 61 6d 65 2d 76 61 72 69 61 62 6c 65 3f 20 28 76 61 72 69 61 | ......(if.(same-variable?.(varia |
| 79820 | 62 6c 65 20 70 31 29 20 28 76 61 72 69 61 62 6c 65 20 70 32 29 29 0a 20 20 20 20 20 20 20 20 20 | ble.p1).(variable.p2)).......... |
| 79840 | 20 20 28 6d 61 6b 65 2d 70 6f 6c 79 20 28 76 61 72 69 61 62 6c 65 20 70 31 29 0a 20 20 20 20 20 | ..(make-poly.(variable.p1)...... |
| 79860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 75 6c 2d 74 65 72 6d 73 20 28 74 65 72 | .................(mul-terms.(ter |
| 79880 | 6d 2d 6c 69 73 74 20 70 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | m-list.p1)...................... |
| 798a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 72 6d 2d 6c 69 73 74 20 70 32 29 29 29 0a 20 20 20 | ............(term-list.p2))).... |
| 798c0 | 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 50 6f 6c 79 73 20 6e 6f 74 20 69 6e 20 73 61 6d | ........(error."Polys.not.in.sam |
| 798e0 | 65 20 76 61 72 20 2d 2d 20 4d 55 4c 2d 50 4f 4c 59 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | e.var.--.MUL-POLY".............. |
| 79900 | 20 20 20 20 20 28 6c 69 73 74 20 70 31 20 70 32 29 29 29 29 0a 0a 20 20 20 54 6f 20 69 6e 63 6f | .....(list.p1.p2)))).....To.inco |
| 79920 | 72 70 6f 72 61 74 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e 74 6f 20 6f 75 72 20 67 65 6e | rporate.polynomials.into.our.gen |
| 79940 | 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 73 79 73 74 65 6d 2c 20 77 65 0a 6e 65 65 64 20 | eric.arithmetic.system,.we.need. |
| 79960 | 74 6f 20 73 75 70 70 6c 79 20 74 68 65 6d 20 77 69 74 68 20 74 79 70 65 20 74 61 67 73 2e 20 20 | to.supply.them.with.type.tags... |
| 79980 | 57 65 27 6c 6c 20 75 73 65 20 74 68 65 20 74 61 67 20 60 70 6f 6c 79 6e 6f 6d 69 61 6c 27 2c 0a | We'll.use.the.tag.`polynomial',. |
| 799a0 | 61 6e 64 20 69 6e 73 74 61 6c 6c 20 61 70 70 72 6f 70 72 69 61 74 65 20 6f 70 65 72 61 74 69 6f | and.install.appropriate.operatio |
| 799c0 | 6e 73 20 6f 6e 20 74 61 67 67 65 64 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e 20 74 68 65 0a | ns.on.tagged.polynomials.in.the. |
| 799e0 | 6f 70 65 72 61 74 69 6f 6e 20 74 61 62 6c 65 2e 20 20 57 65 27 6c 6c 20 65 6d 62 65 64 20 61 6c | operation.table...We'll.embed.al |
| 79a00 | 6c 20 6f 75 72 20 63 6f 64 65 20 69 6e 20 61 6e 20 69 6e 73 74 61 6c 6c 61 74 69 6f 6e 20 70 72 | l.our.code.in.an.installation.pr |
| 79a20 | 6f 63 65 64 75 72 65 0a 66 6f 72 20 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 70 61 63 6b 61 | ocedure.for.the.polynomial.packa |
| 79a40 | 67 65 2c 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 6f 6e 65 73 20 69 6e 20 73 65 63 74 69 | ge,.similar.to.the.ones.in.secti |
| 79a60 | 6f 6e 20 2a 4e 6f 74 65 0a 32 2d 35 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | on.*Note.2-5-1:::.......(define. |
| 79a80 | 28 69 6e 73 74 61 6c 6c 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 2d 70 61 63 6b 61 67 65 29 0a 20 20 20 | (install-polynomial-package).... |
| 79aa0 | 20 20 20 20 3b 3b 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 | ....;;.internal.procedures...... |
| 79ac0 | 20 20 3b 3b 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 6f 6c 79 0a 20 20 20 20 | ..;;.representation.of.poly..... |
| 79ae0 | 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 70 6f 6c 79 20 76 61 72 69 61 62 6c 65 20 74 | ...(define.(make-poly.variable.t |
| 79b00 | 65 72 6d 2d 6c 69 73 74 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 76 61 72 69 61 62 6c | erm-list)..........(cons.variabl |
| 79b20 | 65 20 74 65 72 6d 2d 6c 69 73 74 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 76 61 | e.term-list))........(define.(va |
| 79b40 | 72 69 61 62 6c 65 20 70 29 20 28 63 61 72 20 70 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e | riable.p).(car.p))........(defin |
| 79b60 | 65 20 28 74 65 72 6d 2d 6c 69 73 74 20 70 29 20 28 63 64 72 20 70 29 29 0a 20 20 20 20 20 20 20 | e.(term-list.p).(cdr.p))........ |
| 79b80 | 3c 5f 70 72 6f 63 65 64 75 72 65 73 20 60 73 61 6d 65 2d 76 61 72 69 61 62 6c 65 3f 27 20 61 6e | <_procedures.`same-variable?'.an |
| 79ba0 | 64 20 60 76 61 72 69 61 62 6c 65 3f 27 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 32 2e 33 2e 32 | d.`variable?'.from.section.2.3.2 |
| 79bc0 | 5f 3e 0a 0a 20 20 20 20 20 20 20 3b 3b 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 | _>.........;;.representation.of. |
| 79be0 | 74 65 72 6d 73 20 61 6e 64 20 74 65 72 6d 20 6c 69 73 74 73 0a 20 20 20 20 20 20 20 3c 5f 70 72 | terms.and.term.lists........<_pr |
| 79c00 | 6f 63 65 64 75 72 65 73 20 60 61 64 6a 6f 69 6e 2d 74 65 72 6d 27 20 2e 2e 2e 20 60 63 6f 65 66 | ocedures.`adjoin-term'.....`coef |
| 79c20 | 66 27 20 66 72 6f 6d 20 74 65 78 74 20 62 65 6c 6f 77 5f 3e 0a 0a 20 20 20 20 20 20 20 3b 3b 20 | f'.from.text.below_>.........;;. |
| 79c40 | 63 6f 6e 74 69 6e 75 65 64 20 6f 6e 20 6e 65 78 74 20 70 61 67 65 0a 0a 20 20 20 20 20 20 20 28 | continued.on.next.page.........( |
| 79c60 | 64 65 66 69 6e 65 20 28 61 64 64 2d 70 6f 6c 79 20 70 31 20 70 32 29 20 2e 2e 2e 29 0a 20 20 20 | define.(add-poly.p1.p2)....).... |
| 79c80 | 20 20 20 20 3c 5f 70 72 6f 63 65 64 75 72 65 73 20 75 73 65 64 20 62 79 20 60 61 64 64 2d 70 6f | ....<_procedures.used.by.`add-po |
| 79ca0 | 6c 79 27 5f 3e 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 2d 70 6f 6c 79 20 70 | ly'_>........(define.(mul-poly.p |
| 79cc0 | 31 20 70 32 29 20 2e 2e 2e 29 0a 20 20 20 20 20 20 20 3c 5f 70 72 6f 63 65 64 75 72 65 73 20 75 | 1.p2)....)........<_procedures.u |
| 79ce0 | 73 65 64 20 62 79 20 60 6d 75 6c 2d 70 6f 6c 79 27 5f 3e 0a 0a 20 20 20 20 20 20 20 3b 3b 20 69 | sed.by.`mul-poly'_>.........;;.i |
| 79d00 | 6e 74 65 72 66 61 63 65 20 74 6f 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 0a 20 | nterface.to.rest.of.the.system.. |
| 79d20 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 61 67 20 70 29 20 28 61 74 74 61 63 68 2d 74 61 | ......(define.(tag.p).(attach-ta |
| 79d40 | 67 20 27 70 6f 6c 79 6e 6f 6d 69 61 6c 20 70 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 61 | g.'polynomial.p))........(put.'a |
| 79d60 | 64 64 20 27 28 70 6f 6c 79 6e 6f 6d 69 61 6c 20 70 6f 6c 79 6e 6f 6d 69 61 6c 29 0a 20 20 20 20 | dd.'(polynomial.polynomial)..... |
| 79d80 | 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 70 31 20 70 32 29 20 28 74 61 67 20 28 61 64 | ........(lambda.(p1.p2).(tag.(ad |
| 79da0 | 64 2d 70 6f 6c 79 20 70 31 20 70 32 29 29 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 6d 75 | d-poly.p1.p2))))........(put.'mu |
| 79dc0 | 6c 20 27 28 70 6f 6c 79 6e 6f 6d 69 61 6c 20 70 6f 6c 79 6e 6f 6d 69 61 6c 29 0a 20 20 20 20 20 | l.'(polynomial.polynomial)...... |
| 79de0 | 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 70 31 20 70 32 29 20 28 74 61 67 20 28 6d 75 6c | .......(lambda.(p1.p2).(tag.(mul |
| 79e00 | 2d 70 6f 6c 79 20 70 31 20 70 32 29 29 29 29 0a 20 20 20 20 20 20 20 28 70 75 74 20 27 6d 61 6b | -poly.p1.p2))))........(put.'mak |
| 79e20 | 65 20 27 70 6f 6c 79 6e 6f 6d 69 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 | e.'polynomial.............(lambd |
| 79e40 | 61 20 28 76 61 72 20 74 65 72 6d 73 29 20 28 74 61 67 20 28 6d 61 6b 65 2d 70 6f 6c 79 20 76 61 | a.(var.terms).(tag.(make-poly.va |
| 79e60 | 72 20 74 65 72 6d 73 29 29 29 29 0a 20 20 20 20 20 20 20 27 64 6f 6e 65 29 0a 0a 20 20 20 50 6f | r.terms))))........'done).....Po |
| 79e80 | 6c 79 6e 6f 6d 69 61 6c 20 61 64 64 69 74 69 6f 6e 20 69 73 20 70 65 72 66 6f 72 6d 65 64 20 74 | lynomial.addition.is.performed.t |
| 79ea0 | 65 72 6d 77 69 73 65 2e 20 20 54 65 72 6d 73 20 6f 66 20 74 68 65 20 73 61 6d 65 20 6f 72 64 65 | ermwise...Terms.of.the.same.orde |
| 79ec0 | 72 0a 28 69 2e 65 2e 2c 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 70 6f 77 65 72 20 6f 66 20 | r.(i.e.,.with.the.same.power.of. |
| 79ee0 | 74 68 65 20 69 6e 64 65 74 65 72 6d 69 6e 61 74 65 29 20 6d 75 73 74 20 62 65 20 63 6f 6d 62 69 | the.indeterminate).must.be.combi |
| 79f00 | 6e 65 64 2e 0a 54 68 69 73 20 69 73 20 64 6f 6e 65 20 62 79 20 66 6f 72 6d 69 6e 67 20 61 20 6e | ned..This.is.done.by.forming.a.n |
| 79f20 | 65 77 20 74 65 72 6d 20 6f 66 20 74 68 65 20 73 61 6d 65 20 6f 72 64 65 72 20 77 68 6f 73 65 20 | ew.term.of.the.same.order.whose. |
| 79f40 | 63 6f 65 66 66 69 63 69 65 6e 74 0a 69 73 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 63 6f | coefficient.is.the.sum.of.the.co |
| 79f60 | 65 66 66 69 63 69 65 6e 74 73 20 6f 66 20 74 68 65 20 61 64 64 65 6e 64 73 2e 20 20 54 65 72 6d | efficients.of.the.addends...Term |
| 79f80 | 73 20 69 6e 20 6f 6e 65 20 61 64 64 65 6e 64 20 66 6f 72 0a 77 68 69 63 68 20 74 68 65 72 65 20 | s.in.one.addend.for.which.there. |
| 79fa0 | 61 72 65 20 6e 6f 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 73 61 6d 65 20 6f 72 64 65 72 20 69 | are.no.terms.of.the.same.order.i |
| 79fc0 | 6e 20 74 68 65 20 6f 74 68 65 72 20 61 64 64 65 6e 64 20 61 72 65 0a 73 69 6d 70 6c 79 20 61 63 | n.the.other.addend.are.simply.ac |
| 79fe0 | 63 75 6d 75 6c 61 74 65 64 20 69 6e 74 6f 20 74 68 65 20 73 75 6d 20 70 6f 6c 79 6e 6f 6d 69 61 | cumulated.into.the.sum.polynomia |
| 7a000 | 6c 20 62 65 69 6e 67 20 63 6f 6e 73 74 72 75 63 74 65 64 2e 0a 0a 20 20 20 49 6e 20 6f 72 64 65 | l.being.constructed......In.orde |
| 7a020 | 72 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 65 72 6d 20 6c 69 73 74 73 2c 20 77 65 20 77 | r.to.manipulate.term.lists,.we.w |
| 7a040 | 69 6c 6c 20 61 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 68 61 76 65 20 61 0a 63 6f 6e 73 74 72 | ill.assume.that.we.have.a.constr |
| 7a060 | 75 63 74 6f 72 20 60 74 68 65 2d 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 27 20 74 68 61 74 20 | uctor.`the-empty-termlist'.that. |
| 7a080 | 72 65 74 75 72 6e 73 20 61 6e 20 65 6d 70 74 79 20 74 65 72 6d 20 6c 69 73 74 20 61 6e 64 20 61 | returns.an.empty.term.list.and.a |
| 7a0a0 | 0a 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 61 64 6a 6f 69 6e 2d 74 65 72 6d 27 20 74 68 61 74 20 | .constructor.`adjoin-term'.that. |
| 7a0c0 | 61 64 6a 6f 69 6e 73 20 61 20 6e 65 77 20 74 65 72 6d 20 74 6f 20 61 20 74 65 72 6d 20 6c 69 73 | adjoins.a.new.term.to.a.term.lis |
| 7a0e0 | 74 2e 20 20 57 65 0a 77 69 6c 6c 20 61 6c 73 6f 20 61 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 | t...We.will.also.assume.that.we. |
| 7a100 | 68 61 76 65 20 61 20 70 72 65 64 69 63 61 74 65 20 60 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 | have.a.predicate.`empty-termlist |
| 7a120 | 3f 27 20 74 68 61 74 20 74 65 6c 6c 73 0a 69 66 20 61 20 67 69 76 65 6e 20 74 65 72 6d 20 6c 69 | ?'.that.tells.if.a.given.term.li |
| 7a140 | 73 74 20 69 73 20 65 6d 70 74 79 2c 20 61 20 73 65 6c 65 63 74 6f 72 20 60 66 69 72 73 74 2d 74 | st.is.empty,.a.selector.`first-t |
| 7a160 | 65 72 6d 27 20 74 68 61 74 20 65 78 74 72 61 63 74 73 0a 74 68 65 20 68 69 67 68 65 73 74 2d 6f | erm'.that.extracts.the.highest-o |
| 7a180 | 72 64 65 72 20 74 65 72 6d 20 66 72 6f 6d 20 61 20 74 65 72 6d 20 6c 69 73 74 2c 20 61 6e 64 20 | rder.term.from.a.term.list,.and. |
| 7a1a0 | 61 20 73 65 6c 65 63 74 6f 72 20 60 72 65 73 74 2d 74 65 72 6d 73 27 0a 74 68 61 74 20 72 65 74 | a.selector.`rest-terms'.that.ret |
| 7a1c0 | 75 72 6e 73 20 61 6c 6c 20 62 75 74 20 74 68 65 20 68 69 67 68 65 73 74 2d 6f 72 64 65 72 20 74 | urns.all.but.the.highest-order.t |
| 7a1e0 | 65 72 6d 2e 20 20 54 6f 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 65 72 6d 73 2c 20 77 65 0a 77 69 | erm...To.manipulate.terms,.we.wi |
| 7a200 | 6c 6c 20 73 75 70 70 6f 73 65 20 74 68 61 74 20 77 65 20 68 61 76 65 20 61 20 63 6f 6e 73 74 72 | ll.suppose.that.we.have.a.constr |
| 7a220 | 75 63 74 6f 72 20 60 6d 61 6b 65 2d 74 65 72 6d 27 20 74 68 61 74 20 63 6f 6e 73 74 72 75 63 74 | uctor.`make-term'.that.construct |
| 7a240 | 73 20 61 0a 74 65 72 6d 20 77 69 74 68 20 67 69 76 65 6e 20 6f 72 64 65 72 20 61 6e 64 20 63 6f | s.a.term.with.given.order.and.co |
| 7a260 | 65 66 66 69 63 69 65 6e 74 2c 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 73 20 60 6f 72 64 65 72 27 | efficient,.and.selectors.`order' |
| 7a280 | 20 61 6e 64 0a 60 63 6f 65 66 66 27 20 74 68 61 74 20 72 65 74 75 72 6e 2c 20 72 65 73 70 65 63 | .and.`coeff'.that.return,.respec |
| 7a2a0 | 74 69 76 65 6c 79 2c 20 74 68 65 20 6f 72 64 65 72 20 61 6e 64 20 74 68 65 20 63 6f 65 66 66 69 | tively,.the.order.and.the.coeffi |
| 7a2c0 | 63 69 65 6e 74 20 6f 66 20 74 68 65 0a 74 65 72 6d 2e 20 20 54 68 65 73 65 20 6f 70 65 72 61 74 | cient.of.the.term...These.operat |
| 7a2e0 | 69 6f 6e 73 20 61 6c 6c 6f 77 20 75 73 20 74 6f 20 63 6f 6e 73 69 64 65 72 20 62 6f 74 68 20 74 | ions.allow.us.to.consider.both.t |
| 7a300 | 65 72 6d 73 20 61 6e 64 20 74 65 72 6d 20 6c 69 73 74 73 0a 61 73 20 64 61 74 61 20 61 62 73 74 | erms.and.term.lists.as.data.abst |
| 7a320 | 72 61 63 74 69 6f 6e 73 2c 20 77 68 6f 73 65 20 63 6f 6e 63 72 65 74 65 20 72 65 70 72 65 73 65 | ractions,.whose.concrete.represe |
| 7a340 | 6e 74 61 74 69 6f 6e 73 20 77 65 20 63 61 6e 20 77 6f 72 72 79 20 61 62 6f 75 74 0a 73 65 70 61 | ntations.we.can.worry.about.sepa |
| 7a360 | 72 61 74 65 6c 79 2e 0a 0a 20 20 20 48 65 72 65 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 | rately......Here.is.the.procedur |
| 7a380 | 65 20 74 68 61 74 20 63 6f 6e 73 74 72 75 63 74 73 20 74 68 65 20 74 65 72 6d 20 6c 69 73 74 20 | e.that.constructs.the.term.list. |
| 7a3a0 | 66 6f 72 20 74 68 65 20 73 75 6d 20 6f 66 0a 74 77 6f 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 3a 28 | for.the.sum.of.two.polynomials:( |
| 7a3c0 | 33 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 74 65 72 6d 73 20 4c 31 20 4c | 3).......(define.(add-terms.L1.L |
| 7a3e0 | 32 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 | 2)........(cond.((empty-termlist |
| 7a400 | 3f 20 4c 31 29 20 4c 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 6d 70 74 79 2d 74 | ?.L1).L2)..............((empty-t |
| 7a420 | 65 72 6d 6c 69 73 74 3f 20 4c 32 29 20 4c 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 | ermlist?.L2).L1)..............(e |
| 7a440 | 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 31 20 28 66 69 72 | lse...............(let.((t1.(fir |
| 7a460 | 73 74 2d 74 65 72 6d 20 4c 31 29 29 20 28 74 32 20 28 66 69 72 73 74 2d 74 65 72 6d 20 4c 32 29 | st-term.L1)).(t2.(first-term.L2) |
| 7a480 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3e 20 28 6f 72 | )).................(cond.((>.(or |
| 7a4a0 | 64 65 72 20 74 31 29 20 28 6f 72 64 65 72 20 74 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | der.t1).(order.t2))............. |
| 7a4c0 | 20 20 20 20 20 20 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d 74 65 72 6d 0a 20 20 20 20 20 20 20 20 | ...........(adjoin-term......... |
| 7a4e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 31 20 28 61 64 64 2d 74 65 72 6d 73 20 28 72 | ................t1.(add-terms.(r |
| 7a500 | 65 73 74 2d 74 65 72 6d 73 20 4c 31 29 20 4c 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | est-terms.L1).L2)))............. |
| 7a520 | 20 20 20 20 20 20 20 20 20 20 28 28 3c 20 28 6f 72 64 65 72 20 74 31 29 20 28 6f 72 64 65 72 20 | ..........((<.(order.t1).(order. |
| 7a540 | 74 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 6a | t2))........................(adj |
| 7a560 | 6f 69 6e 2d 74 65 72 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | oin-term........................ |
| 7a580 | 20 74 32 20 28 61 64 64 2d 74 65 72 6d 73 20 4c 31 20 28 72 65 73 74 2d 74 65 72 6d 73 20 4c 32 | .t2.(add-terms.L1.(rest-terms.L2 |
| 7a5a0 | 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 | )))).......................(else |
| 7a5c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d | ........................(adjoin- |
| 7a5e0 | 74 65 72 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 | term.........................(ma |
| 7a600 | 6b 65 2d 74 65 72 6d 20 28 6f 72 64 65 72 20 74 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ke-term.(order.t1).............. |
| 7a620 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 20 28 63 6f 65 66 | ......................(add.(coef |
| 7a640 | 66 20 74 31 29 20 28 63 6f 65 66 66 20 74 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | f.t1).(coeff.t2))).............. |
| 7a660 | 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 74 65 72 6d 73 20 28 72 65 73 74 2d 74 65 72 6d | ...........(add-terms.(rest-term |
| 7a680 | 73 20 4c 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | s.L1)........................... |
| 7a6a0 | 20 20 20 20 20 20 20 20 20 28 72 65 73 74 2d 74 65 72 6d 73 20 4c 32 29 29 29 29 29 29 29 29 29 | .........(rest-terms.L2))))))))) |
| 7a6c0 | 0a 0a 20 20 20 54 68 65 20 6d 6f 73 74 20 69 6d 70 6f 72 74 61 6e 74 20 70 6f 69 6e 74 20 74 6f | .....The.most.important.point.to |
| 7a6e0 | 20 6e 6f 74 65 20 68 65 72 65 20 69 73 20 74 68 61 74 20 77 65 20 75 73 65 64 20 74 68 65 20 67 | .note.here.is.that.we.used.the.g |
| 7a700 | 65 6e 65 72 69 63 0a 61 64 64 69 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 60 61 64 64 27 20 | eneric.addition.procedure.`add'. |
| 7a720 | 74 6f 20 61 64 64 20 74 6f 67 65 74 68 65 72 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 | to.add.together.the.coefficients |
| 7a740 | 20 6f 66 20 74 68 65 20 74 65 72 6d 73 0a 62 65 69 6e 67 20 63 6f 6d 62 69 6e 65 64 2e 20 20 54 | .of.the.terms.being.combined...T |
| 7a760 | 68 69 73 20 68 61 73 20 70 6f 77 65 72 66 75 6c 20 63 6f 6e 73 65 71 75 65 6e 63 65 73 2c 20 61 | his.has.powerful.consequences,.a |
| 7a780 | 73 20 77 65 20 77 69 6c 6c 20 73 65 65 20 62 65 6c 6f 77 2e 0a 0a 20 20 20 49 6e 20 6f 72 64 65 | s.we.will.see.below......In.orde |
| 7a7a0 | 72 20 74 6f 20 6d 75 6c 74 69 70 6c 79 20 74 77 6f 20 74 65 72 6d 20 6c 69 73 74 73 2c 20 77 65 | r.to.multiply.two.term.lists,.we |
| 7a7c0 | 20 6d 75 6c 74 69 70 6c 79 20 65 61 63 68 20 74 65 72 6d 20 6f 66 20 74 68 65 0a 66 69 72 73 74 | .multiply.each.term.of.the.first |
| 7a7e0 | 20 6c 69 73 74 20 62 79 20 61 6c 6c 20 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 6f 74 | .list.by.all.the.terms.of.the.ot |
| 7a800 | 68 65 72 20 6c 69 73 74 2c 20 72 65 70 65 61 74 65 64 6c 79 20 75 73 69 6e 67 0a 60 6d 75 6c 2d | her.list,.repeatedly.using.`mul- |
| 7a820 | 74 65 72 6d 2d 62 79 2d 61 6c 6c 2d 74 65 72 6d 73 27 2c 20 77 68 69 63 68 20 6d 75 6c 74 69 70 | term-by-all-terms',.which.multip |
| 7a840 | 6c 69 65 73 20 61 20 67 69 76 65 6e 20 74 65 72 6d 20 62 79 20 61 6c 6c 20 74 65 72 6d 73 20 69 | lies.a.given.term.by.all.terms.i |
| 7a860 | 6e 0a 61 20 67 69 76 65 6e 20 74 65 72 6d 20 6c 69 73 74 2e 20 20 54 68 65 20 72 65 73 75 6c 74 | n.a.given.term.list...The.result |
| 7a880 | 69 6e 67 20 74 65 72 6d 20 6c 69 73 74 73 20 28 6f 6e 65 20 66 6f 72 20 65 61 63 68 20 74 65 72 | ing.term.lists.(one.for.each.ter |
| 7a8a0 | 6d 20 6f 66 20 74 68 65 0a 66 69 72 73 74 20 6c 69 73 74 29 20 61 72 65 20 61 63 63 75 6d 75 6c | m.of.the.first.list).are.accumul |
| 7a8c0 | 61 74 65 64 20 69 6e 74 6f 20 61 20 73 75 6d 2e 20 20 4d 75 6c 74 69 70 6c 79 69 6e 67 20 74 77 | ated.into.a.sum...Multiplying.tw |
| 7a8e0 | 6f 20 74 65 72 6d 73 20 66 6f 72 6d 73 20 61 0a 74 65 72 6d 20 77 68 6f 73 65 20 6f 72 64 65 72 | o.terms.forms.a.term.whose.order |
| 7a900 | 20 69 73 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 6f 72 64 65 72 73 20 6f 66 20 74 68 65 | .is.the.sum.of.the.orders.of.the |
| 7a920 | 20 66 61 63 74 6f 72 73 20 61 6e 64 20 77 68 6f 73 65 0a 63 6f 65 66 66 69 63 69 65 6e 74 20 69 | .factors.and.whose.coefficient.i |
| 7a940 | 73 20 74 68 65 20 70 72 6f 64 75 63 74 20 6f 66 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 | s.the.product.of.the.coefficient |
| 7a960 | 73 20 6f 66 20 74 68 65 20 66 61 63 74 6f 72 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | s.of.the.factors:.......(define. |
| 7a980 | 28 6d 75 6c 2d 74 65 72 6d 73 20 4c 31 20 4c 32 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 65 6d | (mul-terms.L1.L2)........(if.(em |
| 7a9a0 | 70 74 79 2d 74 65 72 6d 6c 69 73 74 3f 20 4c 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 74 68 | pty-termlist?.L1)............(th |
| 7a9c0 | 65 2d 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 64 | e-empty-termlist)............(ad |
| 7a9e0 | 64 2d 74 65 72 6d 73 20 28 6d 75 6c 2d 74 65 72 6d 2d 62 79 2d 61 6c 6c 2d 74 65 72 6d 73 20 28 | d-terms.(mul-term-by-all-terms.( |
| 7aa00 | 66 69 72 73 74 2d 74 65 72 6d 20 4c 31 29 20 4c 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | first-term.L1).L2).............. |
| 7aa20 | 20 20 20 20 20 20 20 20 20 28 6d 75 6c 2d 74 65 72 6d 73 20 28 72 65 73 74 2d 74 65 72 6d 73 20 | .........(mul-terms.(rest-terms. |
| 7aa40 | 4c 31 29 20 4c 32 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 2d 74 65 | L1).L2)))).......(define.(mul-te |
| 7aa60 | 72 6d 2d 62 79 2d 61 6c 6c 2d 74 65 72 6d 73 20 74 31 20 4c 29 0a 20 20 20 20 20 20 20 28 69 66 | rm-by-all-terms.t1.L)........(if |
| 7aa80 | 20 28 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 3f 20 4c 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(empty-termlist?.L)............ |
| 7aaa0 | 28 74 68 65 2d 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (the-empty-termlist)............ |
| 7aac0 | 28 6c 65 74 20 28 28 74 32 20 28 66 69 72 73 74 2d 74 65 72 6d 20 4c 29 29 29 0a 20 20 20 20 20 | (let.((t2.(first-term.L)))...... |
| 7aae0 | 20 20 20 20 20 20 20 20 28 61 64 6a 6f 69 6e 2d 74 65 72 6d 0a 20 20 20 20 20 20 20 20 20 20 20 | ........(adjoin-term............ |
| 7ab00 | 20 20 20 28 6d 61 6b 65 2d 74 65 72 6d 20 28 2b 20 28 6f 72 64 65 72 20 74 31 29 20 28 6f 72 64 | ...(make-term.(+.(order.t1).(ord |
| 7ab20 | 65 72 20 74 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | er.t2))......................... |
| 7ab40 | 20 28 6d 75 6c 20 28 63 6f 65 66 66 20 74 31 29 20 28 63 6f 65 66 66 20 74 32 29 29 29 0a 20 20 | .(mul.(coeff.t1).(coeff.t2)))... |
| 7ab60 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 75 6c 2d 74 65 72 6d 2d 62 79 2d 61 6c 6c 2d 74 65 72 | ............(mul-term-by-all-ter |
| 7ab80 | 6d 73 20 74 31 20 28 72 65 73 74 2d 74 65 72 6d 73 20 4c 29 29 29 29 29 29 0a 0a 20 20 20 54 68 | ms.t1.(rest-terms.L)))))).....Th |
| 7aba0 | 69 73 20 69 73 20 72 65 61 6c 6c 79 20 61 6c 6c 20 74 68 65 72 65 20 69 73 20 74 6f 20 70 6f 6c | is.is.really.all.there.is.to.pol |
| 7abc0 | 79 6e 6f 6d 69 61 6c 20 61 64 64 69 74 69 6f 6e 20 61 6e 64 0a 6d 75 6c 74 69 70 6c 69 63 61 74 | ynomial.addition.and.multiplicat |
| 7abe0 | 69 6f 6e 2e 20 20 4e 6f 74 69 63 65 20 74 68 61 74 2c 20 73 69 6e 63 65 20 77 65 20 6f 70 65 72 | ion...Notice.that,.since.we.oper |
| 7ac00 | 61 74 65 20 6f 6e 20 74 65 72 6d 73 20 75 73 69 6e 67 20 74 68 65 0a 67 65 6e 65 72 69 63 20 70 | ate.on.terms.using.the.generic.p |
| 7ac20 | 72 6f 63 65 64 75 72 65 73 20 60 61 64 64 27 20 61 6e 64 20 60 6d 75 6c 27 2c 20 6f 75 72 20 70 | rocedures.`add'.and.`mul',.our.p |
| 7ac40 | 6f 6c 79 6e 6f 6d 69 61 6c 20 70 61 63 6b 61 67 65 20 69 73 0a 61 75 74 6f 6d 61 74 69 63 61 6c | olynomial.package.is.automatical |
| 7ac60 | 6c 79 20 61 62 6c 65 20 74 6f 20 68 61 6e 64 6c 65 20 61 6e 79 20 74 79 70 65 20 6f 66 20 63 6f | ly.able.to.handle.any.type.of.co |
| 7ac80 | 65 66 66 69 63 69 65 6e 74 20 74 68 61 74 20 69 73 20 6b 6e 6f 77 6e 0a 61 62 6f 75 74 20 62 79 | efficient.that.is.known.about.by |
| 7aca0 | 20 74 68 65 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 2e | .the.generic.arithmetic.package. |
| 7acc0 | 20 20 49 66 20 77 65 20 69 6e 63 6c 75 64 65 20 61 20 63 6f 65 72 63 69 6f 6e 0a 6d 65 63 68 61 | ..If.we.include.a.coercion.mecha |
| 7ace0 | 6e 69 73 6d 20 73 75 63 68 20 61 73 20 6f 6e 65 20 6f 66 20 74 68 6f 73 65 20 64 69 73 63 75 73 | nism.such.as.one.of.those.discus |
| 7ad00 | 73 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 35 2d 32 3a 3a 2c 20 74 68 | sed.in.section.*Note.2-5-2::,.th |
| 7ad20 | 65 6e 0a 77 65 20 61 6c 73 6f 20 61 72 65 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 61 62 6c | en.we.also.are.automatically.abl |
| 7ad40 | 65 20 74 6f 20 68 61 6e 64 6c 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 70 6f 6c 79 6e 6f | e.to.handle.operations.on.polyno |
| 7ad60 | 6d 69 61 6c 73 20 6f 66 0a 64 69 66 66 65 72 65 6e 74 20 63 6f 65 66 66 69 63 69 65 6e 74 20 74 | mials.of.different.coefficient.t |
| 7ad80 | 79 70 65 73 2c 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ypes,.such.as................... |
| 7ada0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 20 20 20 20 32 20 20 20 20 20 20 20 20 20 | ............./........2......... |
| 7adc0 | 20 20 20 20 20 20 20 20 5c 0a 20 20 20 20 20 5b 33 78 5e 32 20 2b 20 28 32 20 2b 20 33 69 29 78 | ........\......[3x^2.+.(2.+.3i)x |
| 7ade0 | 20 2b 20 37 5d 20 2a 20 7c 20 78 5e 34 20 2b 20 2d 2d 2d 20 78 5e 32 20 2b 20 28 35 20 2b 20 33 | .+.7].*.|.x^4.+.---.x^2.+.(5.+.3 |
| 7ae00 | 69 29 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | i).|............................ |
| 7ae20 | 20 20 20 5c 20 20 20 20 20 20 20 20 33 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 0a | ...\........3................./. |
| 7ae40 | 0a 20 20 20 42 65 63 61 75 73 65 20 77 65 20 69 6e 73 74 61 6c 6c 65 64 20 74 68 65 20 70 6f 6c | ....Because.we.installed.the.pol |
| 7ae60 | 79 6e 6f 6d 69 61 6c 20 61 64 64 69 74 69 6f 6e 20 61 6e 64 20 6d 75 6c 74 69 70 6c 69 63 61 74 | ynomial.addition.and.multiplicat |
| 7ae80 | 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 73 20 60 61 64 64 2d 70 6f 6c 79 27 20 61 6e 64 20 60 6d | ion.procedures.`add-poly'.and.`m |
| 7aea0 | 75 6c 2d 70 6f 6c 79 27 20 69 6e 20 74 68 65 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 | ul-poly'.in.the.generic.arithmet |
| 7aec0 | 69 63 20 73 79 73 74 65 6d 0a 61 73 20 74 68 65 20 60 61 64 64 27 20 61 6e 64 20 60 6d 75 6c 27 | ic.system.as.the.`add'.and.`mul' |
| 7aee0 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 74 79 70 65 20 60 70 6f 6c 79 6e 6f 6d 69 61 6c | .operations.for.type.`polynomial |
| 7af00 | 27 2c 20 6f 75 72 20 73 79 73 74 65 6d 20 69 73 0a 61 6c 73 6f 20 61 75 74 6f 6d 61 74 69 63 61 | ',.our.system.is.also.automatica |
| 7af20 | 6c 6c 79 20 61 62 6c 65 20 74 6f 20 68 61 6e 64 6c 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 6f 70 | lly.able.to.handle.polynomial.op |
| 7af40 | 65 72 61 74 69 6f 6e 73 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 20 5b 28 79 20 2b 20 31 29 78 | erations.such.as.......[(y.+.1)x |
| 7af60 | 5e 32 20 2b 20 28 79 5e 32 20 2b 20 31 29 78 20 2b 20 28 79 20 2d 20 31 29 5d 20 2a 20 5b 28 79 | ^2.+.(y^2.+.1)x.+.(y.-.1)].*.[(y |
| 7af80 | 20 2d 20 32 29 78 20 2b 20 28 79 5e 33 20 2b 20 37 29 5d 0a 0a 20 20 20 54 68 65 20 72 65 61 73 | .-.2)x.+.(y^3.+.7)].....The.reas |
| 7afa0 | 6f 6e 20 69 73 20 74 68 61 74 20 77 68 65 6e 20 74 68 65 20 73 79 73 74 65 6d 20 74 72 69 65 73 | on.is.that.when.the.system.tries |
| 7afc0 | 20 74 6f 20 63 6f 6d 62 69 6e 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 2c 20 69 74 0a 77 69 6c | .to.combine.coefficients,.it.wil |
| 7afe0 | 6c 20 64 69 73 70 61 74 63 68 20 74 68 72 6f 75 67 68 20 60 61 64 64 27 20 61 6e 64 20 60 6d 75 | l.dispatch.through.`add'.and.`mu |
| 7b000 | 6c 27 2e 20 20 53 69 6e 63 65 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 61 72 65 0a | l'...Since.the.coefficients.are. |
| 7b020 | 74 68 65 6d 73 65 6c 76 65 73 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 28 69 6e 20 79 29 2c 20 74 | themselves.polynomials.(in.y),.t |
| 7b040 | 68 65 73 65 20 77 69 6c 6c 20 62 65 20 63 6f 6d 62 69 6e 65 64 20 75 73 69 6e 67 20 60 61 64 64 | hese.will.be.combined.using.`add |
| 7b060 | 2d 70 6f 6c 79 27 0a 61 6e 64 20 60 6d 75 6c 2d 70 6f 6c 79 27 2e 20 20 54 68 65 20 72 65 73 75 | -poly'.and.`mul-poly'...The.resu |
| 7b080 | 6c 74 20 69 73 20 61 20 6b 69 6e 64 20 6f 66 20 22 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 72 | lt.is.a.kind.of."data-directed.r |
| 7b0a0 | 65 63 75 72 73 69 6f 6e 22 20 69 6e 0a 77 68 69 63 68 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c | ecursion".in.which,.for.example, |
| 7b0c0 | 20 61 20 63 61 6c 6c 20 74 6f 20 60 6d 75 6c 2d 70 6f 6c 79 27 20 77 69 6c 6c 20 72 65 73 75 6c | .a.call.to.`mul-poly'.will.resul |
| 7b0e0 | 74 20 69 6e 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c 73 0a 74 6f 20 60 6d 75 6c 2d 70 6f 6c | t.in.recursive.calls.to.`mul-pol |
| 7b100 | 79 27 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 6d 75 6c 74 69 70 6c 79 20 74 68 65 20 63 6f 65 66 | y'.in.order.to.multiply.the.coef |
| 7b120 | 66 69 63 69 65 6e 74 73 2e 20 20 49 66 20 74 68 65 0a 63 6f 65 66 66 69 63 69 65 6e 74 73 20 6f | ficients...If.the.coefficients.o |
| 7b140 | 66 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 77 65 72 65 20 74 68 65 6d 73 65 6c 76 | f.the.coefficients.were.themselv |
| 7b160 | 65 73 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 28 61 73 20 6d 69 67 68 74 0a 62 65 20 75 73 65 64 | es.polynomials.(as.might.be.used |
| 7b180 | 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e 20 74 68 72 | .to.represent.polynomials.in.thr |
| 7b1a0 | 65 65 20 76 61 72 69 61 62 6c 65 73 29 2c 20 74 68 65 20 64 61 74 61 0a 64 69 72 65 63 74 69 6f | ee.variables),.the.data.directio |
| 7b1c0 | 6e 20 77 6f 75 6c 64 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 65 20 73 79 73 74 65 6d 20 77 | n.would.ensure.that.the.system.w |
| 7b1e0 | 6f 75 6c 64 20 66 6f 6c 6c 6f 77 20 74 68 72 6f 75 67 68 20 61 6e 6f 74 68 65 72 0a 6c 65 76 65 | ould.follow.through.another.leve |
| 7b200 | 6c 20 6f 66 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c 73 2c 20 61 6e 64 20 73 6f 20 6f 6e 20 | l.of.recursive.calls,.and.so.on. |
| 7b220 | 74 68 72 6f 75 67 68 20 61 73 20 6d 61 6e 79 20 6c 65 76 65 6c 73 20 61 73 20 74 68 65 0a 73 74 | through.as.many.levels.as.the.st |
| 7b240 | 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 64 61 74 61 20 64 69 63 74 61 74 65 73 2e 28 34 29 | ructure.of.the.data.dictates.(4) |
| 7b260 | 0a 0a 52 65 70 72 65 73 65 6e 74 69 6e 67 20 74 65 72 6d 20 6c 69 73 74 73 0a 2e 2e 2e 2e 2e 2e | ..Representing.term.lists....... |
| 7b280 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 46 69 6e 61 6c 6c 79 2c 20 77 65 20 6d | ...................Finally,.we.m |
| 7b2a0 | 75 73 74 20 63 6f 6e 66 72 6f 6e 74 20 74 68 65 20 6a 6f 62 20 6f 66 20 69 6d 70 6c 65 6d 65 6e | ust.confront.the.job.of.implemen |
| 7b2c0 | 74 69 6e 67 20 61 20 67 6f 6f 64 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 0a 66 6f 72 20 74 | ting.a.good.representation.for.t |
| 7b2e0 | 65 72 6d 20 6c 69 73 74 73 2e 20 20 41 20 74 65 72 6d 20 6c 69 73 74 20 69 73 2c 20 69 6e 20 65 | erm.lists...A.term.list.is,.in.e |
| 7b300 | 66 66 65 63 74 2c 20 61 20 73 65 74 20 6f 66 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 6b 65 79 | ffect,.a.set.of.coefficients.key |
| 7b320 | 65 64 0a 62 79 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 74 65 72 6d 2e 20 20 48 65 | ed.by.the.order.of.the.term...He |
| 7b340 | 6e 63 65 2c 20 61 6e 79 20 6f 66 20 74 68 65 20 6d 65 74 68 6f 64 73 20 66 6f 72 20 72 65 70 72 | nce,.any.of.the.methods.for.repr |
| 7b360 | 65 73 65 6e 74 69 6e 67 0a 73 65 74 73 2c 20 61 73 20 64 69 73 63 75 73 73 65 64 20 69 6e 20 73 | esenting.sets,.as.discussed.in.s |
| 7b380 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 33 2d 33 3a 3a 2c 20 63 61 6e 20 62 65 20 61 70 70 | ection.*Note.2-3-3::,.can.be.app |
| 7b3a0 | 6c 69 65 64 20 74 6f 20 74 68 69 73 0a 74 61 73 6b 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 | lied.to.this.task...On.the.other |
| 7b3c0 | 20 68 61 6e 64 2c 20 6f 75 72 20 70 72 6f 63 65 64 75 72 65 73 20 60 61 64 64 2d 74 65 72 6d 73 | .hand,.our.procedures.`add-terms |
| 7b3e0 | 27 20 61 6e 64 20 60 6d 75 6c 2d 74 65 72 6d 73 27 0a 61 6c 77 61 79 73 20 61 63 63 65 73 73 20 | '.and.`mul-terms'.always.access. |
| 7b400 | 74 65 72 6d 20 6c 69 73 74 73 20 73 65 71 75 65 6e 74 69 61 6c 6c 79 20 66 72 6f 6d 20 68 69 67 | term.lists.sequentially.from.hig |
| 7b420 | 68 65 73 74 20 74 6f 20 6c 6f 77 65 73 74 20 6f 72 64 65 72 2e 0a 54 68 75 73 2c 20 77 65 20 77 | hest.to.lowest.order..Thus,.we.w |
| 7b440 | 69 6c 6c 20 75 73 65 20 73 6f 6d 65 20 6b 69 6e 64 20 6f 66 20 6f 72 64 65 72 65 64 20 6c 69 73 | ill.use.some.kind.of.ordered.lis |
| 7b460 | 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 0a 0a 20 20 20 48 6f 77 20 73 68 6f 75 6c 64 | t.representation......How.should |
| 7b480 | 20 77 65 20 73 74 72 75 63 74 75 72 65 20 74 68 65 20 6c 69 73 74 20 74 68 61 74 20 72 65 70 72 | .we.structure.the.list.that.repr |
| 7b4a0 | 65 73 65 6e 74 73 20 61 20 74 65 72 6d 20 6c 69 73 74 3f 20 20 4f 6e 65 0a 63 6f 6e 73 69 64 65 | esents.a.term.list?..One.conside |
| 7b4c0 | 72 61 74 69 6f 6e 20 69 73 20 74 68 65 20 22 64 65 6e 73 69 74 79 22 20 6f 66 20 74 68 65 20 70 | ration.is.the."density".of.the.p |
| 7b4e0 | 6f 6c 79 6e 6f 6d 69 61 6c 73 20 77 65 20 69 6e 74 65 6e 64 20 74 6f 0a 6d 61 6e 69 70 75 6c 61 | olynomials.we.intend.to.manipula |
| 7b500 | 74 65 2e 20 20 41 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 69 73 20 73 61 69 64 20 74 6f 20 62 65 20 | te...A.polynomial.is.said.to.be. |
| 7b520 | 22 64 65 6e 73 65 22 20 69 66 20 69 74 20 68 61 73 20 6e 6f 6e 7a 65 72 6f 0a 63 6f 65 66 66 69 | "dense".if.it.has.nonzero.coeffi |
| 7b540 | 63 69 65 6e 74 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6d 6f 73 74 20 6f 72 64 65 72 73 2e 20 | cients.in.terms.of.most.orders.. |
| 7b560 | 20 49 66 20 69 74 20 68 61 73 20 6d 61 6e 79 20 7a 65 72 6f 20 74 65 72 6d 73 20 69 74 20 69 73 | .If.it.has.many.zero.terms.it.is |
| 7b580 | 0a 73 61 69 64 20 74 6f 20 62 65 20 22 73 70 61 72 73 65 22 2e 20 20 46 6f 72 20 65 78 61 6d 70 | .said.to.be."sparse"...For.examp |
| 7b5a0 | 6c 65 2c 0a 0a 20 20 20 20 20 41 20 3a 20 78 5e 35 20 2b 20 32 78 5e 34 20 2b 20 33 78 5e 32 20 | le,.......A.:.x^5.+.2x^4.+.3x^2. |
| 7b5c0 | 2d 20 32 78 20 2d 20 35 0a 0a 69 73 20 61 20 64 65 6e 73 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 2c | -.2x.-.5..is.a.dense.polynomial, |
| 7b5e0 | 20 77 68 65 72 65 61 73 0a 0a 20 20 20 20 20 42 20 3a 20 78 5e 31 30 30 20 2b 20 32 78 5e 32 20 | .whereas.......B.:.x^100.+.2x^2. |
| 7b600 | 2b 20 31 0a 0a 69 73 20 73 70 61 72 73 65 2e 0a 0a 20 20 20 54 68 65 20 74 65 72 6d 20 6c 69 73 | +.1..is.sparse......The.term.lis |
| 7b620 | 74 73 20 6f 66 20 64 65 6e 73 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 61 72 65 20 6d 6f 73 74 | ts.of.dense.polynomials.are.most |
| 7b640 | 20 65 66 66 69 63 69 65 6e 74 6c 79 20 72 65 70 72 65 73 65 6e 74 65 64 0a 61 73 20 6c 69 73 74 | .efficiently.represented.as.list |
| 7b660 | 73 20 6f 66 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 2e 20 20 46 6f 72 20 65 78 61 6d | s.of.the.coefficients...For.exam |
| 7b680 | 70 6c 65 2c 20 41 20 61 62 6f 76 65 20 77 6f 75 6c 64 20 62 65 20 6e 69 63 65 6c 79 0a 72 65 70 | ple,.A.above.would.be.nicely.rep |
| 7b6a0 | 72 65 73 65 6e 74 65 64 20 61 73 20 60 28 31 20 32 20 30 20 33 20 2d 32 20 2d 35 29 27 2e 20 20 | resented.as.`(1.2.0.3.-2.-5)'... |
| 7b6c0 | 54 68 65 20 6f 72 64 65 72 20 6f 66 20 61 20 74 65 72 6d 20 69 6e 20 74 68 69 73 0a 72 65 70 72 | The.order.of.a.term.in.this.repr |
| 7b6e0 | 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 | esentation.is.the.length.of.the. |
| 7b700 | 73 75 62 6c 69 73 74 20 62 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 74 68 61 74 20 74 65 72 6d | sublist.beginning.with.that.term |
| 7b720 | 27 73 0a 63 6f 65 66 66 69 63 69 65 6e 74 2c 20 64 65 63 72 65 6d 65 6e 74 65 64 20 62 79 20 31 | 's.coefficient,.decremented.by.1 |
| 7b740 | 2e 28 35 29 20 20 54 68 69 73 20 77 6f 75 6c 64 20 62 65 20 61 20 74 65 72 72 69 62 6c 65 0a 72 | .(5)..This.would.be.a.terrible.r |
| 7b760 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 61 20 73 70 61 72 73 65 20 70 6f 6c 79 6e | epresentation.for.a.sparse.polyn |
| 7b780 | 6f 6d 69 61 6c 20 73 75 63 68 20 61 73 20 42 3a 20 54 68 65 72 65 20 77 6f 75 6c 64 20 62 65 20 | omial.such.as.B:.There.would.be. |
| 7b7a0 | 61 0a 67 69 61 6e 74 20 6c 69 73 74 20 6f 66 20 7a 65 72 6f 73 20 70 75 6e 63 74 75 61 74 65 64 | a.giant.list.of.zeros.punctuated |
| 7b7c0 | 20 62 79 20 61 20 66 65 77 20 6c 6f 6e 65 6c 79 20 6e 6f 6e 7a 65 72 6f 20 74 65 72 6d 73 2e 20 | .by.a.few.lonely.nonzero.terms.. |
| 7b7e0 | 20 41 20 6d 6f 72 65 0a 72 65 61 73 6f 6e 61 62 6c 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f | .A.more.reasonable.representatio |
| 7b800 | 6e 20 6f 66 20 74 68 65 20 74 65 72 6d 20 6c 69 73 74 20 6f 66 20 61 20 73 70 61 72 73 65 20 70 | n.of.the.term.list.of.a.sparse.p |
| 7b820 | 6f 6c 79 6e 6f 6d 69 61 6c 20 69 73 20 61 73 0a 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 6e 6f | olynomial.is.as.a.list.of.the.no |
| 7b840 | 6e 7a 65 72 6f 20 74 65 72 6d 73 2c 20 77 68 65 72 65 20 65 61 63 68 20 74 65 72 6d 20 69 73 20 | nzero.terms,.where.each.term.is. |
| 7b860 | 61 20 6c 69 73 74 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 0a 6f 72 64 65 72 20 6f 66 20 74 | a.list.containing.the.order.of.t |
| 7b880 | 68 65 20 74 65 72 6d 20 61 6e 64 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 20 66 6f 72 20 | he.term.and.the.coefficient.for. |
| 7b8a0 | 74 68 61 74 20 6f 72 64 65 72 2e 20 20 49 6e 20 73 75 63 68 20 61 0a 73 63 68 65 6d 65 2c 20 70 | that.order...In.such.a.scheme,.p |
| 7b8c0 | 6f 6c 79 6e 6f 6d 69 61 6c 20 42 20 69 73 20 65 66 66 69 63 69 65 6e 74 6c 79 20 72 65 70 72 65 | olynomial.B.is.efficiently.repre |
| 7b8e0 | 73 65 6e 74 65 64 20 61 73 20 60 28 28 31 30 30 20 31 29 20 28 32 20 32 29 20 28 30 0a 31 29 29 | sented.as.`((100.1).(2.2).(0.1)) |
| 7b900 | 27 2e 20 20 41 73 20 6d 6f 73 74 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 6d 61 6e 69 70 75 6c 61 74 | '...As.most.polynomial.manipulat |
| 7b920 | 69 6f 6e 73 20 61 72 65 20 70 65 72 66 6f 72 6d 65 64 20 6f 6e 20 73 70 61 72 73 65 0a 70 6f 6c | ions.are.performed.on.sparse.pol |
| 7b940 | 79 6e 6f 6d 69 61 6c 73 2c 20 77 65 20 77 69 6c 6c 20 75 73 65 20 74 68 69 73 20 6d 65 74 68 6f | ynomials,.we.will.use.this.metho |
| 7b960 | 64 2e 20 20 57 65 20 77 69 6c 6c 20 61 73 73 75 6d 65 20 74 68 61 74 20 74 65 72 6d 20 6c 69 73 | d...We.will.assume.that.term.lis |
| 7b980 | 74 73 0a 61 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 6c 69 73 74 73 20 6f 66 20 74 | ts.are.represented.as.lists.of.t |
| 7b9a0 | 65 72 6d 73 2c 20 61 72 72 61 6e 67 65 64 20 66 72 6f 6d 20 68 69 67 68 65 73 74 2d 6f 72 64 65 | erms,.arranged.from.highest-orde |
| 7b9c0 | 72 20 74 6f 0a 6c 6f 77 65 73 74 2d 6f 72 64 65 72 20 74 65 72 6d 2e 20 20 4f 6e 63 65 20 77 65 | r.to.lowest-order.term...Once.we |
| 7b9e0 | 20 68 61 76 65 20 6d 61 64 65 20 74 68 69 73 20 64 65 63 69 73 69 6f 6e 2c 20 69 6d 70 6c 65 6d | .have.made.this.decision,.implem |
| 7ba00 | 65 6e 74 69 6e 67 20 74 68 65 0a 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 20 63 6f 6e 73 74 72 75 | enting.the.selectors.and.constru |
| 7ba20 | 63 74 6f 72 73 20 66 6f 72 20 74 65 72 6d 73 20 61 6e 64 20 74 65 72 6d 20 6c 69 73 74 73 20 69 | ctors.for.terms.and.term.lists.i |
| 7ba40 | 73 0a 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 3a 28 36 29 0a 0a 20 20 20 20 20 28 64 65 66 | s.straightforward:(6).......(def |
| 7ba60 | 69 6e 65 20 28 61 64 6a 6f 69 6e 2d 74 65 72 6d 20 74 65 72 6d 20 74 65 72 6d 2d 6c 69 73 74 29 | ine.(adjoin-term.term.term-list) |
| 7ba80 | 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 7a 65 72 6f 3f 20 28 63 6f 65 66 66 20 74 65 72 6d 29 | ........(if.(=zero?.(coeff.term) |
| 7baa0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 74 65 72 6d 2d 6c 69 73 74 0a 20 20 20 20 20 20 20 20 20 | )............term-list.......... |
| 7bac0 | 20 20 28 63 6f 6e 73 20 74 65 72 6d 20 74 65 72 6d 2d 6c 69 73 74 29 29 29 0a 0a 20 20 20 20 20 | ..(cons.term.term-list)))....... |
| 7bae0 | 28 64 65 66 69 6e 65 20 28 74 68 65 2d 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 29 20 27 28 29 | (define.(the-empty-termlist).'() |
| 7bb00 | 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 72 73 74 2d 74 65 72 6d 20 74 65 72 6d 2d | )......(define.(first-term.term- |
| 7bb20 | 6c 69 73 74 29 20 28 63 61 72 20 74 65 72 6d 2d 6c 69 73 74 29 29 0a 20 20 20 20 20 28 64 65 66 | list).(car.term-list))......(def |
| 7bb40 | 69 6e 65 20 28 72 65 73 74 2d 74 65 72 6d 73 20 74 65 72 6d 2d 6c 69 73 74 29 20 28 63 64 72 20 | ine.(rest-terms.term-list).(cdr. |
| 7bb60 | 74 65 72 6d 2d 6c 69 73 74 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6d 70 74 79 2d | term-list))......(define.(empty- |
| 7bb80 | 74 65 72 6d 6c 69 73 74 3f 20 74 65 72 6d 2d 6c 69 73 74 29 20 28 6e 75 6c 6c 3f 20 74 65 72 6d | termlist?.term-list).(null?.term |
| 7bba0 | 2d 6c 69 73 74 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 74 65 72 6d | -list)).......(define.(make-term |
| 7bbc0 | 20 6f 72 64 65 72 20 63 6f 65 66 66 29 20 28 6c 69 73 74 20 6f 72 64 65 72 20 63 6f 65 66 66 29 | .order.coeff).(list.order.coeff) |
| 7bbe0 | 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6f 72 64 65 72 20 74 65 72 6d 29 20 28 63 61 72 | )......(define.(order.term).(car |
| 7bc00 | 20 74 65 72 6d 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 65 66 66 20 74 65 72 6d | .term))......(define.(coeff.term |
| 7bc20 | 29 20 28 63 61 64 72 20 74 65 72 6d 29 29 0a 0a 77 68 65 72 65 20 60 3d 7a 65 72 6f 3f 27 20 69 | ).(cadr.term))..where.`=zero?'.i |
| 7bc40 | 73 20 61 73 20 64 65 66 69 6e 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 | s.as.defined.in.*Note.Exercise.2 |
| 7bc60 | 2d 38 30 3a 3a 2e 20 20 28 53 65 65 20 61 6c 73 6f 20 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 | -80::...(See.also.*Note.Exercise |
| 7bc80 | 20 32 2d 38 37 3a 3a 20 62 65 6c 6f 77 2e 29 0a 0a 20 20 20 55 73 65 72 73 20 6f 66 20 74 68 65 | .2-87::.below.).....Users.of.the |
| 7bca0 | 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 70 61 63 6b 61 67 65 20 77 69 6c 6c 20 63 72 65 61 74 65 20 | .polynomial.package.will.create. |
| 7bcc0 | 28 74 61 67 67 65 64 29 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 62 79 0a 6d 65 61 6e 73 20 6f 66 | (tagged).polynomials.by.means.of |
| 7bce0 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d | .the.procedure:.......(define.(m |
| 7bd00 | 61 6b 65 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 20 76 61 72 20 74 65 72 6d 73 29 0a 20 20 20 20 20 20 | ake-polynomial.var.terms)....... |
| 7bd20 | 20 28 28 67 65 74 20 27 6d 61 6b 65 20 27 70 6f 6c 79 6e 6f 6d 69 61 6c 29 20 76 61 72 20 74 65 | .((get.'make.'polynomial).var.te |
| 7bd40 | 72 6d 73 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 38 37 3a 2a 20 49 6e 73 | rms)).......*Exercise.2.87:*.Ins |
| 7bd60 | 74 61 6c 6c 20 60 3d 7a 65 72 6f 3f 27 20 66 6f 72 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e | tall.`=zero?'.for.polynomials.in |
| 7bd80 | 20 74 68 65 20 67 65 6e 65 72 69 63 0a 20 20 20 20 20 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 | .the.generic......arithmetic.pac |
| 7bda0 | 6b 61 67 65 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 61 6c 6c 6f 77 20 60 61 64 6a 6f 69 6e 2d 74 | kage...This.will.allow.`adjoin-t |
| 7bdc0 | 65 72 6d 27 20 74 6f 20 77 6f 72 6b 20 66 6f 72 0a 20 20 20 20 20 70 6f 6c 79 6e 6f 6d 69 61 6c | erm'.to.work.for......polynomial |
| 7bde0 | 73 20 77 69 74 68 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 74 68 61 74 20 61 72 65 20 74 68 65 | s.with.coefficients.that.are.the |
| 7be00 | 6d 73 65 6c 76 65 73 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 | mselves.polynomials........*Exer |
| 7be20 | 63 69 73 65 20 32 2e 38 38 3a 2a 20 45 78 74 65 6e 64 20 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 | cise.2.88:*.Extend.the.polynomia |
| 7be40 | 6c 20 73 79 73 74 65 6d 20 74 6f 20 69 6e 63 6c 75 64 65 0a 20 20 20 20 20 73 75 62 74 72 61 63 | l.system.to.include......subtrac |
| 7be60 | 74 69 6f 6e 20 6f 66 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2e 20 20 28 48 69 6e 74 3a 20 59 6f 75 | tion.of.polynomials...(Hint:.You |
| 7be80 | 20 6d 61 79 20 66 69 6e 64 20 69 74 20 68 65 6c 70 66 75 6c 20 74 6f 0a 20 20 20 20 20 64 65 66 | .may.find.it.helpful.to......def |
| 7bea0 | 69 6e 65 20 61 20 67 65 6e 65 72 69 63 20 6e 65 67 61 74 69 6f 6e 20 6f 70 65 72 61 74 69 6f 6e | ine.a.generic.negation.operation |
| 7bec0 | 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 38 39 3a 2a 20 44 65 66 69 6e 65 | .).......*Exercise.2.89:*.Define |
| 7bee0 | 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 74 | .procedures.that.implement.the.t |
| 7bf00 | 65 72 6d 2d 6c 69 73 74 0a 20 20 20 20 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 64 65 73 | erm-list......representation.des |
| 7bf20 | 63 72 69 62 65 64 20 61 62 6f 76 65 20 61 73 20 61 70 70 72 6f 70 72 69 61 74 65 20 66 6f 72 20 | cribed.above.as.appropriate.for. |
| 7bf40 | 64 65 6e 73 65 0a 20 20 20 20 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2e 0a 0a 20 20 20 20 20 2a 45 | dense......polynomials........*E |
| 7bf60 | 78 65 72 63 69 73 65 20 32 2e 39 30 3a 2a 20 53 75 70 70 6f 73 65 20 77 65 20 77 61 6e 74 20 74 | xercise.2.90:*.Suppose.we.want.t |
| 7bf80 | 6f 20 68 61 76 65 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 73 79 73 74 65 6d 20 74 68 61 74 0a | o.have.a.polynomial.system.that. |
| 7bfa0 | 20 20 20 20 20 69 73 20 65 66 66 69 63 69 65 6e 74 20 66 6f 72 20 62 6f 74 68 20 73 70 61 72 73 | .....is.efficient.for.both.spars |
| 7bfc0 | 65 20 61 6e 64 20 64 65 6e 73 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2e 20 20 4f 6e 65 20 77 61 | e.and.dense.polynomials...One.wa |
| 7bfe0 | 79 20 74 6f 20 64 6f 0a 20 20 20 20 20 74 68 69 73 20 69 73 20 74 6f 20 61 6c 6c 6f 77 20 62 6f | y.to.do......this.is.to.allow.bo |
| 7c000 | 74 68 20 6b 69 6e 64 73 20 6f 66 20 74 65 72 6d 2d 6c 69 73 74 20 72 65 70 72 65 73 65 6e 74 61 | th.kinds.of.term-list.representa |
| 7c020 | 74 69 6f 6e 73 20 69 6e 20 6f 75 72 0a 20 20 20 20 20 73 79 73 74 65 6d 2e 20 20 54 68 65 20 73 | tions.in.our......system...The.s |
| 7c040 | 69 74 75 61 74 69 6f 6e 20 69 73 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 74 68 65 20 63 6f 6d | ituation.is.analogous.to.the.com |
| 7c060 | 70 6c 65 78 2d 6e 75 6d 62 65 72 20 65 78 61 6d 70 6c 65 0a 20 20 20 20 20 6f 66 20 73 65 63 74 | plex-number.example......of.sect |
| 7c080 | 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 3a 3a 2c 20 77 68 65 72 65 20 77 65 20 61 6c 6c 6f 77 65 | ion.*Note.2-4::,.where.we.allowe |
| 7c0a0 | 64 20 62 6f 74 68 20 72 65 63 74 61 6e 67 75 6c 61 72 20 61 6e 64 0a 20 20 20 20 20 70 6f 6c 61 | d.both.rectangular.and......pola |
| 7c0c0 | 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 2e 20 20 54 6f 20 64 6f 20 74 68 69 73 20 77 | r.representations...To.do.this.w |
| 7c0e0 | 65 20 6d 75 73 74 20 64 69 73 74 69 6e 67 75 69 73 68 20 64 69 66 66 65 72 65 6e 74 0a 20 20 20 | e.must.distinguish.different.... |
| 7c100 | 20 20 74 79 70 65 73 20 6f 66 20 74 65 72 6d 20 6c 69 73 74 73 20 61 6e 64 20 6d 61 6b 65 20 74 | ..types.of.term.lists.and.make.t |
| 7c120 | 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 74 65 72 6d 20 6c 69 73 74 73 20 67 65 6e 65 | he.operations.on.term.lists.gene |
| 7c140 | 72 69 63 2e 0a 20 20 20 20 20 52 65 64 65 73 69 67 6e 20 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 | ric.......Redesign.the.polynomia |
| 7c160 | 6c 20 73 79 73 74 65 6d 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 69 73 20 67 65 6e 65 72 | l.system.to.implement.this.gener |
| 7c180 | 61 6c 69 7a 61 74 69 6f 6e 2e 0a 20 20 20 20 20 54 68 69 73 20 69 73 20 61 20 6d 61 6a 6f 72 20 | alization.......This.is.a.major. |
| 7c1a0 | 65 66 66 6f 72 74 2c 20 6e 6f 74 20 61 20 6c 6f 63 61 6c 20 63 68 61 6e 67 65 2e 0a 0a 20 20 20 | effort,.not.a.local.change...... |
| 7c1c0 | 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 39 31 3a 2a 20 41 20 75 6e 69 76 61 72 69 61 74 65 20 | ..*Exercise.2.91:*.A.univariate. |
| 7c1e0 | 70 6f 6c 79 6e 6f 6d 69 61 6c 20 63 61 6e 20 62 65 20 64 69 76 69 64 65 64 20 62 79 20 61 6e 6f | polynomial.can.be.divided.by.ano |
| 7c200 | 74 68 65 72 0a 20 20 20 20 20 6f 6e 65 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 70 6f 6c 79 6e | ther......one.to.produce.a.polyn |
| 7c220 | 6f 6d 69 61 6c 20 71 75 6f 74 69 65 6e 74 20 61 6e 64 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 | omial.quotient.and.a.polynomial. |
| 7c240 | 72 65 6d 61 69 6e 64 65 72 2e 0a 20 20 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 | remainder.......For.example,.... |
| 7c260 | 20 20 20 20 20 20 20 20 78 5e 35 20 2d 20 31 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d | ........x^5.-.1...........------ |
| 7c280 | 2d 20 3d 20 78 5e 33 20 2b 20 78 2c 20 72 65 6d 61 69 6e 64 65 72 20 78 20 2d 20 31 0a 20 20 20 | -.=.x^3.+.x,.remainder.x.-.1.... |
| 7c2a0 | 20 20 20 20 20 20 20 78 5e 32 20 2d 20 31 0a 0a 20 20 20 20 20 44 69 76 69 73 69 6f 6e 20 63 61 | .......x^2.-.1.......Division.ca |
| 7c2c0 | 6e 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 76 69 61 20 6c 6f 6e 67 20 64 69 76 69 73 69 6f 6e | n.be.performed.via.long.division |
| 7c2e0 | 2e 20 20 54 68 61 74 20 69 73 2c 20 64 69 76 69 64 65 20 74 68 65 0a 20 20 20 20 20 68 69 67 68 | ...That.is,.divide.the......high |
| 7c300 | 65 73 74 2d 6f 72 64 65 72 20 74 65 72 6d 20 6f 66 20 74 68 65 20 64 69 76 69 64 65 6e 64 20 62 | est-order.term.of.the.dividend.b |
| 7c320 | 79 20 74 68 65 20 68 69 67 68 65 73 74 2d 6f 72 64 65 72 20 74 65 72 6d 20 6f 66 0a 20 20 20 20 | y.the.highest-order.term.of..... |
| 7c340 | 20 74 68 65 20 64 69 76 69 73 6f 72 2e 20 20 54 68 65 20 72 65 73 75 6c 74 20 69 73 20 74 68 65 | .the.divisor...The.result.is.the |
| 7c360 | 20 66 69 72 73 74 20 74 65 72 6d 20 6f 66 20 74 68 65 20 71 75 6f 74 69 65 6e 74 2e 20 20 4e 65 | .first.term.of.the.quotient...Ne |
| 7c380 | 78 74 2c 0a 20 20 20 20 20 6d 75 6c 74 69 70 6c 79 20 74 68 65 20 72 65 73 75 6c 74 20 62 79 20 | xt,......multiply.the.result.by. |
| 7c3a0 | 74 68 65 20 64 69 76 69 73 6f 72 2c 20 73 75 62 74 72 61 63 74 20 74 68 61 74 20 66 72 6f 6d 20 | the.divisor,.subtract.that.from. |
| 7c3c0 | 74 68 65 0a 20 20 20 20 20 64 69 76 69 64 65 6e 64 2c 20 61 6e 64 20 70 72 6f 64 75 63 65 20 74 | the......dividend,.and.produce.t |
| 7c3e0 | 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 61 6e 73 77 65 72 20 62 79 20 72 65 63 75 72 73 69 | he.rest.of.the.answer.by.recursi |
| 7c400 | 76 65 6c 79 0a 20 20 20 20 20 64 69 76 69 64 69 6e 67 20 74 68 65 20 64 69 66 66 65 72 65 6e 63 | vely......dividing.the.differenc |
| 7c420 | 65 20 62 79 20 74 68 65 20 64 69 76 69 73 6f 72 2e 20 20 53 74 6f 70 20 77 68 65 6e 20 74 68 65 | e.by.the.divisor...Stop.when.the |
| 7c440 | 20 6f 72 64 65 72 20 6f 66 20 74 68 65 0a 20 20 20 20 20 64 69 76 69 73 6f 72 20 65 78 63 65 65 | .order.of.the......divisor.excee |
| 7c460 | 64 73 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 64 69 76 69 64 65 6e 64 20 61 6e 64 | ds.the.order.of.the.dividend.and |
| 7c480 | 20 64 65 63 6c 61 72 65 20 74 68 65 20 64 69 76 69 64 65 6e 64 0a 20 20 20 20 20 74 6f 20 62 65 | .declare.the.dividend......to.be |
| 7c4a0 | 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 2e 20 20 41 6c 73 6f 2c 20 69 66 20 74 68 65 20 64 69 | .the.remainder...Also,.if.the.di |
| 7c4c0 | 76 69 64 65 6e 64 20 65 76 65 72 20 62 65 63 6f 6d 65 73 20 7a 65 72 6f 2c 0a 20 20 20 20 20 72 | vidend.ever.becomes.zero,......r |
| 7c4e0 | 65 74 75 72 6e 20 7a 65 72 6f 20 61 73 20 62 6f 74 68 20 71 75 6f 74 69 65 6e 74 20 61 6e 64 20 | eturn.zero.as.both.quotient.and. |
| 7c500 | 72 65 6d 61 69 6e 64 65 72 2e 0a 0a 20 20 20 20 20 57 65 20 63 61 6e 20 64 65 73 69 67 6e 20 61 | remainder........We.can.design.a |
| 7c520 | 20 60 64 69 76 2d 70 6f 6c 79 27 20 70 72 6f 63 65 64 75 72 65 20 6f 6e 20 74 68 65 20 6d 6f 64 | .`div-poly'.procedure.on.the.mod |
| 7c540 | 65 6c 20 6f 66 20 60 61 64 64 2d 70 6f 6c 79 27 20 61 6e 64 0a 20 20 20 20 20 60 6d 75 6c 2d 70 | el.of.`add-poly'.and......`mul-p |
| 7c560 | 6f 6c 79 27 2e 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 63 68 65 63 6b 73 20 74 6f 20 73 65 | oly'..The.procedure.checks.to.se |
| 7c580 | 65 20 69 66 20 74 68 65 20 74 77 6f 20 70 6f 6c 79 73 20 68 61 76 65 20 74 68 65 0a 20 20 20 20 | e.if.the.two.polys.have.the..... |
| 7c5a0 | 20 73 61 6d 65 20 76 61 72 69 61 62 6c 65 2e 20 20 49 66 20 73 6f 2c 20 60 64 69 76 2d 70 6f 6c | .same.variable...If.so,.`div-pol |
| 7c5c0 | 79 27 20 73 74 72 69 70 73 20 6f 66 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 61 6e 64 0a 20 | y'.strips.off.the.variable.and.. |
| 7c5e0 | 20 20 20 20 70 61 73 73 65 73 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 74 6f 20 60 64 69 76 2d 74 | ....passes.the.problem.to.`div-t |
| 7c600 | 65 72 6d 73 27 2c 20 77 68 69 63 68 20 70 65 72 66 6f 72 6d 73 20 74 68 65 20 64 69 76 69 73 69 | erms',.which.performs.the.divisi |
| 7c620 | 6f 6e 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 20 6f 6e 20 74 65 72 6d 20 6c 69 73 74 73 2e | on......operation.on.term.lists. |
| 7c640 | 20 60 44 69 76 2d 70 6f 6c 79 27 20 66 69 6e 61 6c 6c 79 20 72 65 61 74 74 61 63 68 65 73 20 74 | .`Div-poly'.finally.reattaches.t |
| 7c660 | 68 65 0a 20 20 20 20 20 76 61 72 69 61 62 6c 65 20 74 6f 20 74 68 65 20 72 65 73 75 6c 74 20 73 | he......variable.to.the.result.s |
| 7c680 | 75 70 70 6c 69 65 64 20 62 79 20 60 64 69 76 2d 74 65 72 6d 73 27 2e 20 20 49 74 20 69 73 20 63 | upplied.by.`div-terms'...It.is.c |
| 7c6a0 | 6f 6e 76 65 6e 69 65 6e 74 0a 20 20 20 20 20 74 6f 20 64 65 73 69 67 6e 20 60 64 69 76 2d 74 65 | onvenient......to.design.`div-te |
| 7c6c0 | 72 6d 73 27 20 74 6f 20 63 6f 6d 70 75 74 65 20 62 6f 74 68 20 74 68 65 20 71 75 6f 74 69 65 6e | rms'.to.compute.both.the.quotien |
| 7c6e0 | 74 20 61 6e 64 20 74 68 65 0a 20 20 20 20 20 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 61 20 64 69 | t.and.the......remainder.of.a.di |
| 7c700 | 76 69 73 69 6f 6e 2e 20 20 60 44 69 76 2d 74 65 72 6d 73 27 20 63 61 6e 20 74 61 6b 65 20 74 77 | vision...`Div-terms'.can.take.tw |
| 7c720 | 6f 20 74 65 72 6d 20 6c 69 73 74 73 20 61 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 20 61 | o.term.lists.as......arguments.a |
| 7c740 | 6e 64 20 72 65 74 75 72 6e 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 71 75 6f 74 69 65 6e 74 | nd.return.a.list.of.the.quotient |
| 7c760 | 20 74 65 72 6d 20 6c 69 73 74 20 61 6e 64 20 74 68 65 0a 20 20 20 20 20 72 65 6d 61 69 6e 64 65 | .term.list.and.the......remainde |
| 7c780 | 72 20 74 65 72 6d 20 6c 69 73 74 2e 0a 0a 20 20 20 20 20 43 6f 6d 70 6c 65 74 65 20 74 68 65 20 | r.term.list........Complete.the. |
| 7c7a0 | 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 64 69 76 2d 74 65 72 | following.definition.of.`div-ter |
| 7c7c0 | 6d 73 27 20 62 79 20 66 69 6c 6c 69 6e 67 20 69 6e 20 74 68 65 0a 20 20 20 20 20 6d 69 73 73 69 | ms'.by.filling.in.the......missi |
| 7c7e0 | 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 55 73 65 20 74 68 69 73 20 74 6f 20 69 6d 70 | ng.expressions...Use.this.to.imp |
| 7c800 | 6c 65 6d 65 6e 74 20 60 64 69 76 2d 70 6f 6c 79 27 2c 20 77 68 69 63 68 0a 20 20 20 20 20 74 61 | lement.`div-poly',.which......ta |
| 7c820 | 6b 65 73 20 74 77 6f 20 70 6f 6c 79 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 72 | kes.two.polys.as.arguments.and.r |
| 7c840 | 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 71 75 6f 74 69 65 6e 74 0a 20 20 | eturns.a.list.of.the.quotient... |
| 7c860 | 20 20 20 61 6e 64 20 72 65 6d 61 69 6e 64 65 72 20 70 6f 6c 79 73 2e 0a 0a 20 20 20 20 20 20 20 | ...and.remainder.polys.......... |
| 7c880 | 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 76 2d 74 65 72 6d 73 20 4c 31 20 4c 32 29 0a 20 20 20 | ...(define.(div-terms.L1.L2).... |
| 7c8a0 | 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 3f 20 4c 31 | .........(if.(empty-termlist?.L1 |
| 7c8c0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 28 74 68 65 2d 65 6d 70 | ).................(list.(the-emp |
| 7c8e0 | 74 79 2d 74 65 72 6d 6c 69 73 74 29 20 28 74 68 65 2d 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 | ty-termlist).(the-empty-termlist |
| 7c900 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 31 20 28 66 69 | )).................(let.((t1.(fi |
| 7c920 | 72 73 74 2d 74 65 72 6d 20 4c 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rst-term.L1))................... |
| 7c940 | 20 20 20 20 28 74 32 20 28 66 69 72 73 74 2d 74 65 72 6d 20 4c 32 29 29 29 0a 20 20 20 20 20 20 | ....(t2.(first-term.L2)))....... |
| 7c960 | 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 28 6f 72 64 65 72 20 74 32 29 20 28 6f | ............(if.(>.(order.t2).(o |
| 7c980 | 72 64 65 72 20 74 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rder.t1))....................... |
| 7c9a0 | 28 6c 69 73 74 20 28 74 68 65 2d 65 6d 70 74 79 2d 74 65 72 6d 6c 69 73 74 29 20 4c 31 29 0a 20 | (list.(the-empty-termlist).L1).. |
| 7c9c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 2d | .....................(let.((new- |
| 7c9e0 | 63 20 28 64 69 76 20 28 63 6f 65 66 66 20 74 31 29 20 28 63 6f 65 66 66 20 74 32 29 29 29 0a 20 | c.(div.(coeff.t1).(coeff.t2))).. |
| 7ca00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 77 2d | ...........................(new- |
| 7ca20 | 6f 20 28 2d 20 28 6f 72 64 65 72 20 74 31 29 20 28 6f 72 64 65 72 20 74 32 29 29 29 29 0a 20 20 | o.(-.(order.t1).(order.t2))))... |
| 7ca40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 | ......................(let.((res |
| 7ca60 | 74 2d 6f 66 2d 72 65 73 75 6c 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | t-of-result..................... |
| 7ca80 | 20 20 20 20 20 20 20 20 20 20 20 3c 43 4f 4d 50 55 54 45 20 52 45 53 54 20 4f 46 20 52 45 53 55 | ...........<COMPUTE.REST.OF.RESU |
| 7caa0 | 4c 54 20 52 45 43 55 52 53 49 56 45 4c 59 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | LT.RECURSIVELY>................. |
| 7cac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...............))............... |
| 7cae0 | 20 20 20 20 20 20 20 20 20 20 20 20 3c 46 4f 52 4d 20 43 4f 4d 50 4c 45 54 45 20 52 45 53 55 4c | ............<FORM.COMPLETE.RESUL |
| 7cb00 | 54 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 29 29 29 | T>...........................))) |
| 7cb20 | 29 29 29 0a 0a 48 69 65 72 61 72 63 68 69 65 73 20 6f 66 20 74 79 70 65 73 20 69 6e 20 73 79 6d | )))..Hierarchies.of.types.in.sym |
| 7cb40 | 62 6f 6c 69 63 20 61 6c 67 65 62 72 61 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | bolic.algebra................... |
| 7cb60 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 4f 75 72 20 70 6f 6c 79 | ........................Our.poly |
| 7cb80 | 6e 6f 6d 69 61 6c 20 73 79 73 74 65 6d 20 69 6c 6c 75 73 74 72 61 74 65 73 20 68 6f 77 20 6f 62 | nomial.system.illustrates.how.ob |
| 7cba0 | 6a 65 63 74 73 20 6f 66 20 6f 6e 65 20 74 79 70 65 20 28 70 6f 6c 79 6e 6f 6d 69 61 6c 73 29 0a | jects.of.one.type.(polynomials). |
| 7cbc0 | 6d 61 79 20 69 6e 20 66 61 63 74 20 62 65 20 63 6f 6d 70 6c 65 78 20 6f 62 6a 65 63 74 73 20 74 | may.in.fact.be.complex.objects.t |
| 7cbe0 | 68 61 74 20 68 61 76 65 20 6f 62 6a 65 63 74 73 20 6f 66 20 6d 61 6e 79 20 64 69 66 66 65 72 65 | hat.have.objects.of.many.differe |
| 7cc00 | 6e 74 0a 74 79 70 65 73 20 61 73 20 70 61 72 74 73 2e 20 20 54 68 69 73 20 70 6f 73 65 73 20 6e | nt.types.as.parts...This.poses.n |
| 7cc20 | 6f 20 72 65 61 6c 20 64 69 66 66 69 63 75 6c 74 79 20 69 6e 20 64 65 66 69 6e 69 6e 67 20 67 65 | o.real.difficulty.in.defining.ge |
| 7cc40 | 6e 65 72 69 63 0a 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 57 65 20 6e 65 65 64 20 6f 6e 6c 79 20 | neric.operations...We.need.only. |
| 7cc60 | 69 6e 73 74 61 6c 6c 20 61 70 70 72 6f 70 72 69 61 74 65 20 67 65 6e 65 72 69 63 20 6f 70 65 72 | install.appropriate.generic.oper |
| 7cc80 | 61 74 69 6f 6e 73 20 66 6f 72 0a 70 65 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 6e 65 63 65 73 73 | ations.for.performing.the.necess |
| 7cca0 | 61 72 79 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 70 61 72 74 73 20 6f | ary.manipulations.of.the.parts.o |
| 7ccc0 | 66 20 74 68 65 20 63 6f 6d 70 6f 75 6e 64 0a 74 79 70 65 73 2e 20 20 49 6e 20 66 61 63 74 2c 20 | f.the.compound.types...In.fact,. |
| 7cce0 | 77 65 20 73 61 77 20 74 68 61 74 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 66 6f 72 6d 20 61 20 6b | we.saw.that.polynomials.form.a.k |
| 7cd00 | 69 6e 64 20 6f 66 20 22 72 65 63 75 72 73 69 76 65 20 64 61 74 61 0a 61 62 73 74 72 61 63 74 69 | ind.of."recursive.data.abstracti |
| 7cd20 | 6f 6e 2c 22 20 69 6e 20 74 68 61 74 20 70 61 72 74 73 20 6f 66 20 61 20 70 6f 6c 79 6e 6f 6d 69 | on,".in.that.parts.of.a.polynomi |
| 7cd40 | 61 6c 20 6d 61 79 20 74 68 65 6d 73 65 6c 76 65 73 20 62 65 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 73 | al.may.themselves.be.polynomials |
| 7cd60 | 2e 20 20 4f 75 72 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 6e 64 20 6f 75 | ...Our.generic.operations.and.ou |
| 7cd80 | 72 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 70 72 6f 67 72 61 6d 6d 69 6e 67 0a 73 74 79 6c | r.data-directed.programming.styl |
| 7cda0 | 65 20 63 61 6e 20 68 61 6e 64 6c 65 20 74 68 69 73 20 63 6f 6d 70 6c 69 63 61 74 69 6f 6e 20 77 | e.can.handle.this.complication.w |
| 7cdc0 | 69 74 68 6f 75 74 20 6d 75 63 68 20 74 72 6f 75 62 6c 65 2e 0a 0a 20 20 20 4f 6e 20 74 68 65 20 | ithout.much.trouble......On.the. |
| 7cde0 | 6f 74 68 65 72 20 68 61 6e 64 2c 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 61 6c 67 65 62 72 61 20 69 | other.hand,.polynomial.algebra.i |
| 7ce00 | 73 20 61 20 73 79 73 74 65 6d 20 66 6f 72 20 77 68 69 63 68 20 74 68 65 20 64 61 74 61 0a 74 79 | s.a.system.for.which.the.data.ty |
| 7ce20 | 70 65 73 20 63 61 6e 6e 6f 74 20 62 65 20 6e 61 74 75 72 61 6c 6c 79 20 61 72 72 61 6e 67 65 64 | pes.cannot.be.naturally.arranged |
| 7ce40 | 20 69 6e 20 61 20 74 6f 77 65 72 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 74 20 69 | .in.a.tower...For.instance,.it.i |
| 7ce60 | 73 0a 70 6f 73 73 69 62 6c 65 20 74 6f 20 68 61 76 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 | s.possible.to.have.polynomials.i |
| 7ce80 | 6e 20 78 20 77 68 6f 73 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 61 72 65 20 70 6f 6c 79 6e | n.x.whose.coefficients.are.polyn |
| 7cea0 | 6f 6d 69 61 6c 73 20 69 6e 0a 79 2e 20 20 49 74 20 69 73 20 61 6c 73 6f 20 70 6f 73 73 69 62 6c | omials.in.y...It.is.also.possibl |
| 7cec0 | 65 20 74 6f 20 68 61 76 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e 20 79 20 77 68 6f 73 65 | e.to.have.polynomials.in.y.whose |
| 7cee0 | 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 61 72 65 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e | .coefficients.are.polynomials.in |
| 7cf00 | 20 78 2e 20 20 4e 65 69 74 68 65 72 20 6f 66 20 74 68 65 73 65 20 74 79 70 65 73 20 69 73 20 22 | .x...Neither.of.these.types.is." |
| 7cf20 | 61 62 6f 76 65 22 20 74 68 65 20 6f 74 68 65 72 20 69 6e 20 61 6e 79 0a 6e 61 74 75 72 61 6c 20 | above".the.other.in.any.natural. |
| 7cf40 | 77 61 79 2c 20 79 65 74 20 69 74 20 69 73 20 6f 66 74 65 6e 20 6e 65 63 65 73 73 61 72 79 20 74 | way,.yet.it.is.often.necessary.t |
| 7cf60 | 6f 20 61 64 64 20 74 6f 67 65 74 68 65 72 20 65 6c 65 6d 65 6e 74 73 20 66 72 6f 6d 0a 65 61 63 | o.add.together.elements.from.eac |
| 7cf80 | 68 20 73 65 74 2e 20 20 54 68 65 72 65 20 61 72 65 20 73 65 76 65 72 61 6c 20 77 61 79 73 20 74 | h.set...There.are.several.ways.t |
| 7cfa0 | 6f 20 64 6f 20 74 68 69 73 2e 20 20 4f 6e 65 20 70 6f 73 73 69 62 69 6c 69 74 79 20 69 73 20 74 | o.do.this...One.possibility.is.t |
| 7cfc0 | 6f 0a 63 6f 6e 76 65 72 74 20 6f 6e 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 74 6f 20 74 68 65 20 | o.convert.one.polynomial.to.the. |
| 7cfe0 | 74 79 70 65 20 6f 66 20 74 68 65 20 6f 74 68 65 72 20 62 79 20 65 78 70 61 6e 64 69 6e 67 20 61 | type.of.the.other.by.expanding.a |
| 7d000 | 6e 64 0a 72 65 61 72 72 61 6e 67 69 6e 67 20 74 65 72 6d 73 20 73 6f 20 74 68 61 74 20 62 6f 74 | nd.rearranging.terms.so.that.bot |
| 7d020 | 68 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 70 72 69 6e | h.polynomials.have.the.same.prin |
| 7d040 | 63 69 70 61 6c 0a 76 61 72 69 61 62 6c 65 2e 20 20 4f 6e 65 20 63 61 6e 20 69 6d 70 6f 73 65 20 | cipal.variable...One.can.impose. |
| 7d060 | 61 20 74 6f 77 65 72 6c 69 6b 65 20 73 74 72 75 63 74 75 72 65 20 6f 6e 20 74 68 69 73 20 62 79 | a.towerlike.structure.on.this.by |
| 7d080 | 20 6f 72 64 65 72 69 6e 67 20 74 68 65 0a 76 61 72 69 61 62 6c 65 73 20 61 6e 64 20 74 68 75 73 | .ordering.the.variables.and.thus |
| 7d0a0 | 20 61 6c 77 61 79 73 20 63 6f 6e 76 65 72 74 69 6e 67 20 61 6e 79 20 70 6f 6c 79 6e 6f 6d 69 61 | .always.converting.any.polynomia |
| 7d0c0 | 6c 20 74 6f 20 61 20 22 63 61 6e 6f 6e 69 63 61 6c 0a 66 6f 72 6d 22 20 77 69 74 68 20 74 68 65 | l.to.a."canonical.form".with.the |
| 7d0e0 | 20 68 69 67 68 65 73 74 2d 70 72 69 6f 72 69 74 79 20 76 61 72 69 61 62 6c 65 20 64 6f 6d 69 6e | .highest-priority.variable.domin |
| 7d100 | 61 6e 74 20 61 6e 64 20 74 68 65 0a 6c 6f 77 65 72 2d 70 72 69 6f 72 69 74 79 20 76 61 72 69 61 | ant.and.the.lower-priority.varia |
| 7d120 | 62 6c 65 73 20 62 75 72 69 65 64 20 69 6e 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 2e | bles.buried.in.the.coefficients. |
| 7d140 | 20 20 54 68 69 73 20 73 74 72 61 74 65 67 79 0a 77 6f 72 6b 73 20 66 61 69 72 6c 79 20 77 65 6c | ..This.strategy.works.fairly.wel |
| 7d160 | 6c 2c 20 65 78 63 65 70 74 20 74 68 61 74 20 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e 20 6d 61 | l,.except.that.the.conversion.ma |
| 7d180 | 79 20 65 78 70 61 6e 64 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 0a 75 6e 6e 65 63 65 73 73 61 72 | y.expand.a.polynomial.unnecessar |
| 7d1a0 | 69 6c 79 2c 20 6d 61 6b 69 6e 67 20 69 74 20 68 61 72 64 20 74 6f 20 72 65 61 64 20 61 6e 64 20 | ily,.making.it.hard.to.read.and. |
| 7d1c0 | 70 65 72 68 61 70 73 20 6c 65 73 73 20 65 66 66 69 63 69 65 6e 74 20 74 6f 0a 77 6f 72 6b 20 77 | perhaps.less.efficient.to.work.w |
| 7d1e0 | 69 74 68 2e 20 20 54 68 65 20 74 6f 77 65 72 20 73 74 72 61 74 65 67 79 20 69 73 20 63 65 72 74 | ith...The.tower.strategy.is.cert |
| 7d200 | 61 69 6e 6c 79 20 6e 6f 74 20 6e 61 74 75 72 61 6c 20 66 6f 72 20 74 68 69 73 20 64 6f 6d 61 69 | ainly.not.natural.for.this.domai |
| 7d220 | 6e 0a 6f 72 20 66 6f 72 20 61 6e 79 20 64 6f 6d 61 69 6e 20 77 68 65 72 65 20 74 68 65 20 75 73 | n.or.for.any.domain.where.the.us |
| 7d240 | 65 72 20 63 61 6e 20 69 6e 76 65 6e 74 20 6e 65 77 20 74 79 70 65 73 20 64 79 6e 61 6d 69 63 61 | er.can.invent.new.types.dynamica |
| 7d260 | 6c 6c 79 20 75 73 69 6e 67 0a 6f 6c 64 20 74 79 70 65 73 20 69 6e 20 76 61 72 69 6f 75 73 20 63 | lly.using.old.types.in.various.c |
| 7d280 | 6f 6d 62 69 6e 69 6e 67 20 66 6f 72 6d 73 2c 20 73 75 63 68 20 61 73 20 74 72 69 67 6f 6e 6f 6d | ombining.forms,.such.as.trigonom |
| 7d2a0 | 65 74 72 69 63 20 66 75 6e 63 74 69 6f 6e 73 2c 0a 70 6f 77 65 72 20 73 65 72 69 65 73 2c 20 61 | etric.functions,.power.series,.a |
| 7d2c0 | 6e 64 20 69 6e 74 65 67 72 61 6c 73 2e 0a 0a 20 20 20 49 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 | nd.integrals......It.should.not. |
| 7d2e0 | 62 65 20 73 75 72 70 72 69 73 69 6e 67 20 74 68 61 74 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 20 63 | be.surprising.that.controlling.c |
| 7d300 | 6f 65 72 63 69 6f 6e 20 69 73 20 61 20 73 65 72 69 6f 75 73 0a 70 72 6f 62 6c 65 6d 20 69 6e 20 | oercion.is.a.serious.problem.in. |
| 7d320 | 74 68 65 20 64 65 73 69 67 6e 20 6f 66 20 6c 61 72 67 65 2d 73 63 61 6c 65 20 61 6c 67 65 62 72 | the.design.of.large-scale.algebr |
| 7d340 | 61 69 63 2d 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 73 79 73 74 65 6d 73 2e 0a 4d 75 63 68 20 6f | aic-manipulation.systems..Much.o |
| 7d360 | 66 20 74 68 65 20 63 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 73 75 63 68 20 73 79 73 74 65 6d 73 | f.the.complexity.of.such.systems |
| 7d380 | 20 69 73 20 63 6f 6e 63 65 72 6e 65 64 20 77 69 74 68 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 73 | .is.concerned.with.relationships |
| 7d3a0 | 0a 61 6d 6f 6e 67 20 64 69 76 65 72 73 65 20 74 79 70 65 73 2e 20 20 49 6e 64 65 65 64 2c 20 69 | .among.diverse.types...Indeed,.i |
| 7d3c0 | 74 20 69 73 20 66 61 69 72 20 74 6f 20 73 61 79 20 74 68 61 74 20 77 65 20 64 6f 20 6e 6f 74 20 | t.is.fair.to.say.that.we.do.not. |
| 7d3e0 | 79 65 74 0a 63 6f 6d 70 6c 65 74 65 6c 79 20 75 6e 64 65 72 73 74 61 6e 64 20 63 6f 65 72 63 69 | yet.completely.understand.coerci |
| 7d400 | 6f 6e 2e 20 20 49 6e 20 66 61 63 74 2c 20 77 65 20 64 6f 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 | on...In.fact,.we.do.not.yet.comp |
| 7d420 | 6c 65 74 65 6c 79 0a 75 6e 64 65 72 73 74 61 6e 64 20 74 68 65 20 63 6f 6e 63 65 70 74 20 6f 66 | letely.understand.the.concept.of |
| 7d440 | 20 61 20 64 61 74 61 20 74 79 70 65 2e 20 20 4e 65 76 65 72 74 68 65 6c 65 73 73 2c 20 77 68 61 | .a.data.type...Nevertheless,.wha |
| 7d460 | 74 20 77 65 20 6b 6e 6f 77 0a 70 72 6f 76 69 64 65 73 20 75 73 20 77 69 74 68 20 70 6f 77 65 72 | t.we.know.provides.us.with.power |
| 7d480 | 66 75 6c 20 73 74 72 75 63 74 75 72 69 6e 67 20 61 6e 64 20 6d 6f 64 75 6c 61 72 69 74 79 20 70 | ful.structuring.and.modularity.p |
| 7d4a0 | 72 69 6e 63 69 70 6c 65 73 20 74 6f 0a 73 75 70 70 6f 72 74 20 74 68 65 20 64 65 73 69 67 6e 20 | rinciples.to.support.the.design. |
| 7d4c0 | 6f 66 20 6c 61 72 67 65 20 73 79 73 74 65 6d 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | of.large.systems........*Exercis |
| 7d4e0 | 65 20 32 2e 39 32 3a 2a 20 42 79 20 69 6d 70 6f 73 69 6e 67 20 61 6e 20 6f 72 64 65 72 69 6e 67 | e.2.92:*.By.imposing.an.ordering |
| 7d500 | 20 6f 6e 20 76 61 72 69 61 62 6c 65 73 2c 20 65 78 74 65 6e 64 20 74 68 65 0a 20 20 20 20 20 70 | .on.variables,.extend.the......p |
| 7d520 | 6f 6c 79 6e 6f 6d 69 61 6c 20 70 61 63 6b 61 67 65 20 73 6f 20 74 68 61 74 20 61 64 64 69 74 69 | olynomial.package.so.that.additi |
| 7d540 | 6f 6e 20 61 6e 64 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 70 6f | on.and.multiplication.of......po |
| 7d560 | 6c 79 6e 6f 6d 69 61 6c 73 20 77 6f 72 6b 73 20 66 6f 72 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 | lynomials.works.for.polynomials. |
| 7d580 | 69 6e 20 64 69 66 66 65 72 65 6e 74 20 76 61 72 69 61 62 6c 65 73 2e 20 20 28 54 68 69 73 0a 20 | in.different.variables...(This.. |
| 7d5a0 | 20 20 20 20 69 73 20 6e 6f 74 20 65 61 73 79 21 29 0a 0a 45 78 74 65 6e 64 65 64 20 65 78 65 72 | ....is.not.easy!)..Extended.exer |
| 7d5c0 | 63 69 73 65 3a 20 52 61 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e | cise:.Rational.functions........ |
| 7d5e0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | ................................ |
| 7d600 | 57 65 20 63 61 6e 20 65 78 74 65 6e 64 20 6f 75 72 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d | We.can.extend.our.generic.arithm |
| 7d620 | 65 74 69 63 20 73 79 73 74 65 6d 20 74 6f 20 69 6e 63 6c 75 64 65 20 66 75 6e 63 74 69 6f 6e 73 | etic.system.to.include.functions |
| 7d640 | 0a 22 72 61 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 73 22 2e 20 20 54 68 65 73 65 20 61 72 | ."rational.functions"...These.ar |
| 7d660 | 65 20 22 66 72 61 63 74 69 6f 6e 73 22 20 77 68 6f 73 65 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e | e."fractions".whose.numerator.an |
| 7d680 | 64 0a 64 65 6e 6f 6d 69 6e 61 74 6f 72 20 61 72 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2c 20 73 | d.denominator.are.polynomials,.s |
| 7d6a0 | 75 63 68 20 61 73 0a 0a 20 20 20 20 20 20 78 20 2b 20 31 0a 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d | uch.as........x.+.1......------- |
| 7d6c0 | 0a 20 20 20 20 20 78 5e 33 20 2d 20 31 0a 0a 20 20 20 54 68 65 20 73 79 73 74 65 6d 20 73 68 6f | ......x^3.-.1.....The.system.sho |
| 7d6e0 | 75 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 61 64 64 2c 20 73 75 62 74 72 61 63 74 2c 20 6d 75 | uld.be.able.to.add,.subtract,.mu |
| 7d700 | 6c 74 69 70 6c 79 2c 20 61 6e 64 20 64 69 76 69 64 65 0a 72 61 74 69 6f 6e 61 6c 20 66 75 6e 63 | ltiply,.and.divide.rational.func |
| 7d720 | 74 69 6f 6e 73 2c 20 61 6e 64 20 74 6f 20 70 65 72 66 6f 72 6d 20 73 75 63 68 20 63 6f 6d 70 75 | tions,.and.to.perform.such.compu |
| 7d740 | 74 61 74 69 6f 6e 73 20 61 73 0a 0a 20 20 20 20 20 20 78 20 2b 20 31 20 20 20 20 20 20 20 78 20 | tations.as........x.+.1.......x. |
| 7d760 | 20 20 20 20 20 78 5e 33 20 2b 20 32 78 5e 32 20 2b 20 33 78 20 2b 20 31 0a 20 20 20 20 20 2d 2d | .....x^3.+.2x^2.+.3x.+.1......-- |
| 7d780 | 2d 2d 2d 2d 2d 20 2b 20 2d 2d 2d 2d 2d 2d 2d 20 3d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -----.+.-------.=.-------------- |
| 7d7a0 | 2d 2d 2d 2d 2d 0a 20 20 20 20 20 78 5e 33 20 2d 20 31 20 20 20 78 5e 32 20 2d 20 31 20 20 20 20 | -----......x^3.-.1...x^2.-.1.... |
| 7d7c0 | 78 5e 34 20 2b 20 78 5e 33 20 2d 20 78 20 2d 20 31 0a 0a 28 48 65 72 65 20 74 68 65 20 73 75 6d | x^4.+.x^3.-.x.-.1..(Here.the.sum |
| 7d7e0 | 20 68 61 73 20 62 65 65 6e 20 73 69 6d 70 6c 69 66 69 65 64 20 62 79 20 72 65 6d 6f 76 69 6e 67 | .has.been.simplified.by.removing |
| 7d800 | 20 63 6f 6d 6d 6f 6e 20 66 61 63 74 6f 72 73 2e 20 20 4f 72 64 69 6e 61 72 79 0a 22 63 72 6f 73 | .common.factors...Ordinary."cros |
| 7d820 | 73 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 22 20 77 6f 75 6c 64 20 68 61 76 65 20 70 72 6f | s.multiplication".would.have.pro |
| 7d840 | 64 75 63 65 64 20 61 20 66 6f 75 72 74 68 2d 64 65 67 72 65 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c | duced.a.fourth-degree.polynomial |
| 7d860 | 0a 6f 76 65 72 20 61 20 66 69 66 74 68 2d 64 65 67 72 65 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 2e | .over.a.fifth-degree.polynomial. |
| 7d880 | 29 0a 0a 20 20 20 49 66 20 77 65 20 6d 6f 64 69 66 79 20 6f 75 72 20 72 61 74 69 6f 6e 61 6c 2d | ).....If.we.modify.our.rational- |
| 7d8a0 | 61 72 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 20 73 6f 20 74 68 61 74 20 69 74 20 75 73 | arithmetic.package.so.that.it.us |
| 7d8c0 | 65 73 20 67 65 6e 65 72 69 63 0a 6f 70 65 72 61 74 69 6f 6e 73 2c 20 74 68 65 6e 20 69 74 20 77 | es.generic.operations,.then.it.w |
| 7d8e0 | 69 6c 6c 20 64 6f 20 77 68 61 74 20 77 65 20 77 61 6e 74 2c 20 65 78 63 65 70 74 20 66 6f 72 20 | ill.do.what.we.want,.except.for. |
| 7d900 | 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 0a 72 65 64 75 63 69 6e 67 20 66 72 61 63 74 69 6f 6e | the.problem.of.reducing.fraction |
| 7d920 | 73 20 74 6f 20 6c 6f 77 65 73 74 20 74 65 72 6d 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | s.to.lowest.terms........*Exerci |
| 7d940 | 73 65 20 32 2e 39 33 3a 2a 20 4d 6f 64 69 66 79 20 74 68 65 20 72 61 74 69 6f 6e 61 6c 2d 61 72 | se.2.93:*.Modify.the.rational-ar |
| 7d960 | 69 74 68 6d 65 74 69 63 20 70 61 63 6b 61 67 65 20 74 6f 20 75 73 65 0a 20 20 20 20 20 67 65 6e | ithmetic.package.to.use......gen |
| 7d980 | 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 62 75 74 20 63 68 61 6e 67 65 20 60 6d 61 6b | eric.operations,.but.change.`mak |
| 7d9a0 | 65 2d 72 61 74 27 20 73 6f 20 74 68 61 74 20 69 74 20 64 6f 65 73 20 6e 6f 74 0a 20 20 20 20 20 | e-rat'.so.that.it.does.not...... |
| 7d9c0 | 61 74 74 65 6d 70 74 20 74 6f 20 72 65 64 75 63 65 20 66 72 61 63 74 69 6f 6e 73 20 74 6f 20 6c | attempt.to.reduce.fractions.to.l |
| 7d9e0 | 6f 77 65 73 74 20 74 65 72 6d 73 2e 20 20 54 65 73 74 20 79 6f 75 72 20 73 79 73 74 65 6d 20 62 | owest.terms...Test.your.system.b |
| 7da00 | 79 0a 20 20 20 20 20 63 61 6c 6c 69 6e 67 20 60 6d 61 6b 65 2d 72 61 74 69 6f 6e 61 6c 27 20 6f | y......calling.`make-rational'.o |
| 7da20 | 6e 20 74 77 6f 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 72 | n.two.polynomials.to.produce.a.r |
| 7da40 | 61 74 69 6f 6e 61 6c 0a 20 20 20 20 20 66 75 6e 63 74 69 6f 6e 0a 0a 20 20 20 20 20 20 20 20 20 | ational......function........... |
| 7da60 | 20 28 64 65 66 69 6e 65 20 70 31 20 28 6d 61 6b 65 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 20 27 78 20 | .(define.p1.(make-polynomial.'x. |
| 7da80 | 27 28 28 32 20 31 29 28 30 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e | '((2.1)(0.1))))...........(defin |
| 7daa0 | 65 20 70 32 20 28 6d 61 6b 65 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 20 27 78 20 27 28 28 33 20 31 29 | e.p2.(make-polynomial.'x.'((3.1) |
| 7dac0 | 28 30 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 72 66 20 28 6d | (0.1))))...........(define.rf.(m |
| 7dae0 | 61 6b 65 2d 72 61 74 69 6f 6e 61 6c 20 70 32 20 70 31 29 29 0a 0a 20 20 20 20 20 4e 6f 77 20 61 | ake-rational.p2.p1)).......Now.a |
| 7db00 | 64 64 20 60 72 66 27 20 74 6f 20 69 74 73 65 6c 66 2c 20 75 73 69 6e 67 20 60 61 64 64 27 2e 20 | dd.`rf'.to.itself,.using.`add'.. |
| 7db20 | 59 6f 75 20 77 69 6c 6c 20 6f 62 73 65 72 76 65 20 74 68 61 74 20 74 68 69 73 0a 20 20 20 20 20 | You.will.observe.that.this...... |
| 7db40 | 61 64 64 69 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 64 6f 65 73 20 6e 6f 74 20 72 65 64 75 | addition.procedure.does.not.redu |
| 7db60 | 63 65 20 66 72 61 63 74 69 6f 6e 73 20 74 6f 20 6c 6f 77 65 73 74 20 74 65 72 6d 73 2e 0a 0a 20 | ce.fractions.to.lowest.terms.... |
| 7db80 | 20 20 20 20 57 65 20 63 61 6e 20 72 65 64 75 63 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 66 72 61 | ....We.can.reduce.polynomial.fra |
| 7dba0 | 63 74 69 6f 6e 73 20 74 6f 20 6c 6f 77 65 73 74 20 74 65 72 6d 73 20 75 73 69 6e 67 20 74 68 65 | ctions.to.lowest.terms.using.the |
| 7dbc0 | 20 73 61 6d 65 0a 20 20 20 20 20 69 64 65 61 20 77 65 20 75 73 65 64 20 77 69 74 68 20 69 6e 74 | .same......idea.we.used.with.int |
| 7dbe0 | 65 67 65 72 73 3a 20 6d 6f 64 69 66 79 69 6e 67 20 60 6d 61 6b 65 2d 72 61 74 27 20 74 6f 20 64 | egers:.modifying.`make-rat'.to.d |
| 7dc00 | 69 76 69 64 65 20 62 6f 74 68 0a 20 20 20 20 20 74 68 65 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e | ivide.both......the.numerator.an |
| 7dc20 | 64 20 74 68 65 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 20 62 79 20 74 68 65 69 72 20 67 72 65 61 74 | d.the.denominator.by.their.great |
| 7dc40 | 65 73 74 20 63 6f 6d 6d 6f 6e 0a 20 20 20 20 20 64 69 76 69 73 6f 72 2e 20 20 54 68 65 20 6e 6f | est.common......divisor...The.no |
| 7dc60 | 74 69 6f 6e 20 6f 66 20 22 67 72 65 61 74 65 73 74 20 63 6f 6d 6d 6f 6e 20 64 69 76 69 73 6f 72 | tion.of."greatest.common.divisor |
| 7dc80 | 22 20 6d 61 6b 65 73 20 73 65 6e 73 65 20 66 6f 72 0a 20 20 20 20 20 70 6f 6c 79 6e 6f 6d 69 61 | ".makes.sense.for......polynomia |
| 7dca0 | 6c 73 2e 20 20 49 6e 20 66 61 63 74 2c 20 77 65 20 63 61 6e 20 63 6f 6d 70 75 74 65 20 74 68 65 | ls...In.fact,.we.can.compute.the |
| 7dcc0 | 20 47 43 44 20 6f 66 20 74 77 6f 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 0a 20 20 20 20 20 75 73 69 | .GCD.of.two.polynomials......usi |
| 7dce0 | 6e 67 20 65 73 73 65 6e 74 69 61 6c 6c 79 20 74 68 65 20 73 61 6d 65 20 45 75 63 6c 69 64 27 73 | ng.essentially.the.same.Euclid's |
| 7dd00 | 20 41 6c 67 6f 72 69 74 68 6d 20 74 68 61 74 20 77 6f 72 6b 73 20 66 6f 72 0a 20 20 20 20 20 69 | .Algorithm.that.works.for......i |
| 7dd20 | 6e 74 65 67 65 72 73 2e 28 37 29 20 20 54 68 65 20 69 6e 74 65 67 65 72 20 76 65 72 73 69 6f 6e | ntegers.(7)..The.integer.version |
| 7dd40 | 20 69 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 67 63 64 20 61 20 62 29 | .is............(define.(gcd.a.b) |
| 7dd60 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 62 20 30 29 0a 20 20 20 20 20 20 20 | .............(if.(=.b.0)........ |
| 7dd80 | 20 20 20 20 20 20 20 20 20 61 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 63 64 20 | .........a.................(gcd. |
| 7dda0 | 62 20 28 72 65 6d 61 69 6e 64 65 72 20 61 20 62 29 29 29 29 0a 0a 20 20 20 20 20 55 73 69 6e 67 | b.(remainder.a.b)))).......Using |
| 7ddc0 | 20 74 68 69 73 2c 20 77 65 20 63 6f 75 6c 64 20 6d 61 6b 65 20 74 68 65 20 6f 62 76 69 6f 75 73 | .this,.we.could.make.the.obvious |
| 7dde0 | 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 74 6f 20 64 65 66 69 6e 65 20 61 20 47 43 44 0a 20 20 | .modification.to.define.a.GCD... |
| 7de00 | 20 20 20 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 77 6f 72 6b 73 20 6f 6e 20 74 65 72 6d 20 | ...operation.that.works.on.term. |
| 7de20 | 6c 69 73 74 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 67 63 64 2d 74 | lists:............(define.(gcd-t |
| 7de40 | 65 72 6d 73 20 61 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 6d 70 74 79 | erms.a.b).............(if.(empty |
| 7de60 | 2d 74 65 72 6d 6c 69 73 74 3f 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 0a | -termlist?.b).................a. |
| 7de80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 63 64 2d 74 65 72 6d 73 20 62 20 28 72 65 | ................(gcd-terms.b.(re |
| 7dea0 | 6d 61 69 6e 64 65 72 2d 74 65 72 6d 73 20 61 20 62 29 29 29 29 0a 0a 20 20 20 20 20 77 68 65 72 | mainder-terms.a.b)))).......wher |
| 7dec0 | 65 20 60 72 65 6d 61 69 6e 64 65 72 2d 74 65 72 6d 73 27 20 70 69 63 6b 73 20 6f 75 74 20 74 68 | e.`remainder-terms'.picks.out.th |
| 7dee0 | 65 20 72 65 6d 61 69 6e 64 65 72 20 63 6f 6d 70 6f 6e 65 6e 74 20 6f 66 20 74 68 65 0a 20 20 20 | e.remainder.component.of.the.... |
| 7df00 | 20 20 6c 69 73 74 20 72 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 20 74 65 72 6d 2d 6c 69 73 74 | ..list.returned.by.the.term-list |
| 7df20 | 20 64 69 76 69 73 69 6f 6e 20 6f 70 65 72 61 74 69 6f 6e 20 60 64 69 76 2d 74 65 72 6d 73 27 20 | .division.operation.`div-terms'. |
| 7df40 | 74 68 61 74 0a 20 20 20 20 20 77 61 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 2a 4e 6f | that......was.implemented.in.*No |
| 7df60 | 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 39 31 3a 3a 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | te.Exercise.2-91::........*Exerc |
| 7df80 | 69 73 65 20 32 2e 39 34 3a 2a 20 55 73 69 6e 67 20 60 64 69 76 2d 74 65 72 6d 73 27 2c 20 69 6d | ise.2.94:*.Using.`div-terms',.im |
| 7dfa0 | 70 6c 65 6d 65 6e 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 60 72 65 6d 61 | plement.the.procedure......`rema |
| 7dfc0 | 69 6e 64 65 72 2d 74 65 72 6d 73 27 20 61 6e 64 20 75 73 65 20 74 68 69 73 20 74 6f 20 64 65 66 | inder-terms'.and.use.this.to.def |
| 7dfe0 | 69 6e 65 20 60 67 63 64 2d 74 65 72 6d 73 27 20 61 73 20 61 62 6f 76 65 2e 0a 20 20 20 20 20 4e | ine.`gcd-terms'.as.above.......N |
| 7e000 | 6f 77 20 77 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 67 63 64 2d 70 6f 6c 79 27 20 | ow.write.a.procedure.`gcd-poly'. |
| 7e020 | 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 47 43 44 | that.computes.the.polynomial.GCD |
| 7e040 | 0a 20 20 20 20 20 6f 66 20 74 77 6f 20 70 6f 6c 79 73 2e 20 20 28 54 68 65 20 70 72 6f 63 65 64 | ......of.two.polys...(The.proced |
| 7e060 | 75 72 65 20 73 68 6f 75 6c 64 20 73 69 67 6e 61 6c 20 61 6e 20 65 72 72 6f 72 20 69 66 20 74 68 | ure.should.signal.an.error.if.th |
| 7e080 | 65 20 74 77 6f 0a 20 20 20 20 20 70 6f 6c 79 73 20 61 72 65 20 6e 6f 74 20 69 6e 20 74 68 65 20 | e.two......polys.are.not.in.the. |
| 7e0a0 | 73 61 6d 65 20 76 61 72 69 61 62 6c 65 2e 29 20 20 49 6e 73 74 61 6c 6c 20 69 6e 20 74 68 65 20 | same.variable.)..Install.in.the. |
| 7e0c0 | 73 79 73 74 65 6d 20 61 0a 20 20 20 20 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 20 | system.a......generic.operation. |
| 7e0e0 | 60 67 72 65 61 74 65 73 74 2d 63 6f 6d 6d 6f 6e 2d 64 69 76 69 73 6f 72 27 20 74 68 61 74 20 72 | `greatest-common-divisor'.that.r |
| 7e100 | 65 64 75 63 65 73 20 74 6f 0a 20 20 20 20 20 60 67 63 64 2d 70 6f 6c 79 27 20 66 6f 72 20 70 6f | educes.to......`gcd-poly'.for.po |
| 7e120 | 6c 79 6e 6f 6d 69 61 6c 73 20 61 6e 64 20 74 6f 20 6f 72 64 69 6e 61 72 79 20 60 67 63 64 27 20 | lynomials.and.to.ordinary.`gcd'. |
| 7e140 | 66 6f 72 20 6f 72 64 69 6e 61 72 79 0a 20 20 20 20 20 6e 75 6d 62 65 72 73 2e 20 20 41 73 20 61 | for.ordinary......numbers...As.a |
| 7e160 | 20 74 65 73 74 2c 20 74 72 79 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 70 31 | .test,.try............(define.p1 |
| 7e180 | 20 28 6d 61 6b 65 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 20 27 78 20 27 28 28 34 20 31 29 20 28 33 20 | .(make-polynomial.'x.'((4.1).(3. |
| 7e1a0 | 2d 31 29 20 28 32 20 2d 32 29 20 28 31 20 32 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 | -1).(2.-2).(1.2))))...........(d |
| 7e1c0 | 65 66 69 6e 65 20 70 32 20 28 6d 61 6b 65 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 20 27 78 20 27 28 28 | efine.p2.(make-polynomial.'x.'(( |
| 7e1e0 | 33 20 31 29 20 28 31 20 2d 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 67 72 65 61 74 65 | 3.1).(1.-1))))...........(greate |
| 7e200 | 73 74 2d 63 6f 6d 6d 6f 6e 2d 64 69 76 69 73 6f 72 20 70 31 20 70 32 29 0a 0a 20 20 20 20 20 61 | st-common-divisor.p1.p2).......a |
| 7e220 | 6e 64 20 63 68 65 63 6b 20 79 6f 75 72 20 72 65 73 75 6c 74 20 62 79 20 68 61 6e 64 2e 0a 0a 20 | nd.check.your.result.by.hand.... |
| 7e240 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 39 35 3a 2a 20 44 65 66 69 6e 65 20 50 5f 31 2c | ....*Exercise.2.95:*.Define.P_1, |
| 7e260 | 20 50 5f 32 2c 20 61 6e 64 20 50 5f 33 20 74 6f 20 62 65 20 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 | .P_2,.and.P_3.to.be.the.polynomi |
| 7e280 | 61 6c 73 0a 0a 20 20 20 20 20 20 20 20 20 20 50 5f 31 20 3a 20 78 5e 32 20 2d 20 32 78 20 2b 20 | als............P_1.:.x^2.-.2x.+. |
| 7e2a0 | 31 0a 0a 20 20 20 20 20 20 20 20 20 20 50 5f 32 20 3a 20 31 31 78 5e 32 20 2b 20 37 0a 0a 20 20 | 1............P_2.:.11x^2.+.7.... |
| 7e2c0 | 20 20 20 20 20 20 20 20 50 5f 33 20 3a 20 31 33 78 20 2b 20 35 0a 0a 20 20 20 20 20 4e 6f 77 20 | ........P_3.:.13x.+.5.......Now. |
| 7e2e0 | 64 65 66 69 6e 65 20 51 5f 31 20 74 6f 20 62 65 20 74 68 65 20 70 72 6f 64 75 63 74 20 6f 66 20 | define.Q_1.to.be.the.product.of. |
| 7e300 | 50 5f 31 20 61 6e 64 20 50 5f 32 20 61 6e 64 20 51 5f 32 20 74 6f 20 62 65 20 74 68 65 0a 20 20 | P_1.and.P_2.and.Q_2.to.be.the... |
| 7e320 | 20 20 20 70 72 6f 64 75 63 74 20 6f 66 20 50 5f 31 20 61 6e 64 20 50 5f 33 2c 20 61 6e 64 20 75 | ...product.of.P_1.and.P_3,.and.u |
| 7e340 | 73 65 20 60 67 72 65 61 74 65 73 74 2d 63 6f 6d 6d 6f 6e 2d 64 69 76 69 73 6f 72 27 20 28 2a 4e | se.`greatest-common-divisor'.(*N |
| 7e360 | 6f 74 65 0a 20 20 20 20 20 45 78 65 72 63 69 73 65 20 32 2d 39 34 3a 3a 29 20 74 6f 20 63 6f 6d | ote......Exercise.2-94::).to.com |
| 7e380 | 70 75 74 65 20 74 68 65 20 47 43 44 20 6f 66 20 51 5f 31 20 61 6e 64 20 51 5f 32 2e 20 20 4e 6f | pute.the.GCD.of.Q_1.and.Q_2...No |
| 7e3a0 | 74 65 20 74 68 61 74 20 74 68 65 0a 20 20 20 20 20 61 6e 73 77 65 72 20 69 73 20 6e 6f 74 20 74 | te.that.the......answer.is.not.t |
| 7e3c0 | 68 65 20 73 61 6d 65 20 61 73 20 50 5f 31 2e 20 20 54 68 69 73 20 65 78 61 6d 70 6c 65 20 69 6e | he.same.as.P_1...This.example.in |
| 7e3e0 | 74 72 6f 64 75 63 65 73 20 6e 6f 6e 69 6e 74 65 67 65 72 0a 20 20 20 20 20 6f 70 65 72 61 74 69 | troduces.noninteger......operati |
| 7e400 | 6f 6e 73 20 69 6e 74 6f 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 63 61 75 73 69 6e | ons.into.the.computation,.causin |
| 7e420 | 67 20 64 69 66 66 69 63 75 6c 74 69 65 73 20 77 69 74 68 20 74 68 65 20 47 43 44 0a 20 20 20 20 | g.difficulties.with.the.GCD..... |
| 7e440 | 20 61 6c 67 6f 72 69 74 68 6d 2e 28 38 29 20 20 54 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 77 68 | .algorithm.(8)..To.understand.wh |
| 7e460 | 61 74 20 69 73 20 68 61 70 70 65 6e 69 6e 67 2c 20 74 72 79 20 74 72 61 63 69 6e 67 0a 20 20 20 | at.is.happening,.try.tracing.... |
| 7e480 | 20 20 60 67 63 64 2d 74 65 72 6d 73 27 20 77 68 69 6c 65 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 | ..`gcd-terms'.while.computing.th |
| 7e4a0 | 65 20 47 43 44 20 6f 72 20 74 72 79 20 70 65 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 64 69 76 69 | e.GCD.or.try.performing.the.divi |
| 7e4c0 | 73 69 6f 6e 0a 20 20 20 20 20 62 79 20 68 61 6e 64 2e 0a 0a 20 20 20 20 20 57 65 20 63 61 6e 20 | sion......by.hand........We.can. |
| 7e4e0 | 73 6f 6c 76 65 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 65 78 68 69 62 69 74 65 64 20 69 6e 20 2a | solve.the.problem.exhibited.in.* |
| 7e500 | 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 39 35 3a 3a 20 69 66 20 77 65 0a 20 20 20 20 20 | Note.Exercise.2-95::.if.we...... |
| 7e520 | 75 73 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 6f | use.the.following.modification.o |
| 7e540 | 66 20 74 68 65 20 47 43 44 20 61 6c 67 6f 72 69 74 68 6d 20 28 77 68 69 63 68 20 72 65 61 6c 6c | f.the.GCD.algorithm.(which.reall |
| 7e560 | 79 0a 20 20 20 20 20 77 6f 72 6b 73 20 6f 6e 6c 79 20 69 6e 20 74 68 65 20 63 61 73 65 20 6f 66 | y......works.only.in.the.case.of |
| 7e580 | 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 77 69 74 68 20 69 6e 74 65 67 65 72 20 63 6f 65 66 66 69 | .polynomials.with.integer.coeffi |
| 7e5a0 | 63 69 65 6e 74 73 29 2e 0a 20 20 20 20 20 42 65 66 6f 72 65 20 70 65 72 66 6f 72 6d 69 6e 67 20 | cients).......Before.performing. |
| 7e5c0 | 61 6e 79 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 64 69 76 69 73 69 6f 6e 20 69 6e 20 74 68 65 20 47 | any.polynomial.division.in.the.G |
| 7e5e0 | 43 44 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 0a 20 20 20 20 20 77 65 20 6d 75 6c 74 69 70 6c 79 | CD.computation,......we.multiply |
| 7e600 | 20 74 68 65 20 64 69 76 69 64 65 6e 64 20 62 79 20 61 6e 20 69 6e 74 65 67 65 72 20 63 6f 6e 73 | .the.dividend.by.an.integer.cons |
| 7e620 | 74 61 6e 74 20 66 61 63 74 6f 72 2c 20 63 68 6f 73 65 6e 20 74 6f 0a 20 20 20 20 20 67 75 61 72 | tant.factor,.chosen.to......guar |
| 7e640 | 61 6e 74 65 65 20 74 68 61 74 20 6e 6f 20 66 72 61 63 74 69 6f 6e 73 20 77 69 6c 6c 20 61 72 69 | antee.that.no.fractions.will.ari |
| 7e660 | 73 65 20 64 75 72 69 6e 67 20 74 68 65 20 64 69 76 69 73 69 6f 6e 0a 20 20 20 20 20 70 72 6f 63 | se.during.the.division......proc |
| 7e680 | 65 73 73 2e 20 20 4f 75 72 20 61 6e 73 77 65 72 20 77 69 6c 6c 20 74 68 75 73 20 64 69 66 66 65 | ess...Our.answer.will.thus.diffe |
| 7e6a0 | 72 20 66 72 6f 6d 20 74 68 65 20 61 63 74 75 61 6c 20 47 43 44 20 62 79 20 61 6e 0a 20 20 20 20 | r.from.the.actual.GCD.by.an..... |
| 7e6c0 | 20 69 6e 74 65 67 65 72 20 63 6f 6e 73 74 61 6e 74 20 66 61 63 74 6f 72 2c 20 62 75 74 20 74 68 | .integer.constant.factor,.but.th |
| 7e6e0 | 69 73 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 74 65 72 20 69 6e 20 74 68 65 20 63 61 73 65 20 6f | is.does.not.matter.in.the.case.o |
| 7e700 | 66 0a 20 20 20 20 20 72 65 64 75 63 69 6e 67 20 72 61 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f | f......reducing.rational.functio |
| 7e720 | 6e 73 20 74 6f 20 6c 6f 77 65 73 74 20 74 65 72 6d 73 3b 20 74 68 65 20 47 43 44 20 77 69 6c 6c | ns.to.lowest.terms;.the.GCD.will |
| 7e740 | 20 62 65 20 75 73 65 64 0a 20 20 20 20 20 74 6f 20 64 69 76 69 64 65 20 62 6f 74 68 20 74 68 65 | .be.used......to.divide.both.the |
| 7e760 | 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 2c 20 73 6f 20 74 | .numerator.and.denominator,.so.t |
| 7e780 | 68 65 20 69 6e 74 65 67 65 72 0a 20 20 20 20 20 63 6f 6e 73 74 61 6e 74 20 66 61 63 74 6f 72 20 | he.integer......constant.factor. |
| 7e7a0 | 77 69 6c 6c 20 63 61 6e 63 65 6c 20 6f 75 74 2e 0a 0a 20 20 20 20 20 4d 6f 72 65 20 70 72 65 63 | will.cancel.out........More.prec |
| 7e7c0 | 69 73 65 6c 79 2c 20 69 66 20 50 20 61 6e 64 20 51 20 61 72 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c | isely,.if.P.and.Q.are.polynomial |
| 7e7e0 | 73 2c 20 6c 65 74 20 4f 5f 31 20 62 65 20 74 68 65 20 6f 72 64 65 72 20 6f 66 0a 20 20 20 20 20 | s,.let.O_1.be.the.order.of...... |
| 7e800 | 50 20 28 69 2e 65 2e 2c 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 6c 61 72 67 65 73 | P.(i.e.,.the.order.of.the.larges |
| 7e820 | 74 20 74 65 72 6d 20 6f 66 20 50 29 20 61 6e 64 20 6c 65 74 20 4f 5f 32 20 62 65 20 74 68 65 0a | t.term.of.P).and.let.O_2.be.the. |
| 7e840 | 20 20 20 20 20 6f 72 64 65 72 20 6f 66 20 51 2e 20 20 4c 65 74 20 63 20 62 65 20 74 68 65 20 6c | .....order.of.Q...Let.c.be.the.l |
| 7e860 | 65 61 64 69 6e 67 20 63 6f 65 66 66 69 63 69 65 6e 74 20 6f 66 20 51 2e 20 20 54 68 65 6e 20 69 | eading.coefficient.of.Q...Then.i |
| 7e880 | 74 20 63 61 6e 20 62 65 0a 20 20 20 20 20 73 68 6f 77 6e 20 74 68 61 74 2c 20 69 66 20 77 65 20 | t.can.be......shown.that,.if.we. |
| 7e8a0 | 6d 75 6c 74 69 70 6c 79 20 50 20 62 79 20 74 68 65 20 22 69 6e 74 65 67 65 72 69 7a 69 6e 67 20 | multiply.P.by.the."integerizing. |
| 7e8c0 | 66 61 63 74 6f 72 22 20 63 5e 28 31 2b 4f 5f 31 0a 20 20 20 20 20 2d 4f 5f 32 29 2c 20 74 68 65 | factor".c^(1+O_1......-O_2),.the |
| 7e8e0 | 20 72 65 73 75 6c 74 69 6e 67 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 63 61 6e 20 62 65 20 64 69 76 | .resulting.polynomial.can.be.div |
| 7e900 | 69 64 65 64 20 62 79 20 51 20 62 79 20 75 73 69 6e 67 20 74 68 65 0a 20 20 20 20 20 60 64 69 76 | ided.by.Q.by.using.the......`div |
| 7e920 | 2d 74 65 72 6d 73 27 20 61 6c 67 6f 72 69 74 68 6d 20 77 69 74 68 6f 75 74 20 69 6e 74 72 6f 64 | -terms'.algorithm.without.introd |
| 7e940 | 75 63 69 6e 67 20 61 6e 79 20 66 72 61 63 74 69 6f 6e 73 2e 20 20 54 68 65 0a 20 20 20 20 20 6f | ucing.any.fractions...The......o |
| 7e960 | 70 65 72 61 74 69 6f 6e 20 6f 66 20 6d 75 6c 74 69 70 6c 79 69 6e 67 20 74 68 65 20 64 69 76 69 | peration.of.multiplying.the.divi |
| 7e980 | 64 65 6e 64 20 62 79 20 74 68 69 73 20 63 6f 6e 73 74 61 6e 74 20 61 6e 64 20 74 68 65 6e 0a 20 | dend.by.this.constant.and.then.. |
| 7e9a0 | 20 20 20 20 64 69 76 69 64 69 6e 67 20 69 73 20 73 6f 6d 65 74 69 6d 65 73 20 63 61 6c 6c 65 64 | ....dividing.is.sometimes.called |
| 7e9c0 | 20 74 68 65 20 22 70 73 65 75 64 6f 64 69 76 69 73 69 6f 6e 22 20 6f 66 20 50 20 62 79 20 51 2e | .the."pseudodivision".of.P.by.Q. |
| 7e9e0 | 20 20 54 68 65 0a 20 20 20 20 20 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 74 68 65 20 64 69 76 69 | ..The......remainder.of.the.divi |
| 7ea00 | 73 69 6f 6e 20 69 73 20 63 61 6c 6c 65 64 20 74 68 65 20 22 70 73 65 75 64 6f 72 65 6d 61 69 6e | sion.is.called.the."pseudoremain |
| 7ea20 | 64 65 72 22 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 32 2e 39 36 3a 2a 0a 20 20 20 | der"........*Exercise.2.96:*.... |
| 7ea40 | 20 20 20 20 61 2e 20 49 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 | ....a..Implement.the.procedure.` |
| 7ea60 | 70 73 65 75 64 6f 72 65 6d 61 69 6e 64 65 72 2d 74 65 72 6d 73 27 2c 20 77 68 69 63 68 20 69 73 | pseudoremainder-terms',.which.is |
| 7ea80 | 0a 20 20 20 20 20 20 20 20 20 20 6a 75 73 74 20 6c 69 6b 65 20 60 72 65 6d 61 69 6e 64 65 72 2d | ...........just.like.`remainder- |
| 7eaa0 | 74 65 72 6d 73 27 20 65 78 63 65 70 74 20 74 68 61 74 20 69 74 20 6d 75 6c 74 69 70 6c 69 65 73 | terms'.except.that.it.multiplies |
| 7eac0 | 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 64 69 76 69 64 65 6e 64 20 62 79 20 74 68 65 20 69 | .the...........dividend.by.the.i |
| 7eae0 | 6e 74 65 67 65 72 69 7a 69 6e 67 20 66 61 63 74 6f 72 20 64 65 73 63 72 69 62 65 64 20 61 62 6f | ntegerizing.factor.described.abo |
| 7eb00 | 76 65 20 62 65 66 6f 72 65 0a 20 20 20 20 20 20 20 20 20 20 63 61 6c 6c 69 6e 67 20 60 64 69 76 | ve.before...........calling.`div |
| 7eb20 | 2d 74 65 72 6d 73 27 2e 20 20 4d 6f 64 69 66 79 20 60 67 63 64 2d 74 65 72 6d 73 27 20 74 6f 20 | -terms'...Modify.`gcd-terms'.to. |
| 7eb40 | 75 73 65 0a 20 20 20 20 20 20 20 20 20 20 60 70 73 65 75 64 6f 72 65 6d 61 69 6e 64 65 72 2d 74 | use...........`pseudoremainder-t |
| 7eb60 | 65 72 6d 73 27 2c 20 61 6e 64 20 76 65 72 69 66 79 20 74 68 61 74 0a 20 20 20 20 20 20 20 20 20 | erms',.and.verify.that.......... |
| 7eb80 | 20 60 67 72 65 61 74 65 73 74 2d 63 6f 6d 6d 6f 6e 2d 64 69 76 69 73 6f 72 27 20 6e 6f 77 20 70 | .`greatest-common-divisor'.now.p |
| 7eba0 | 72 6f 64 75 63 65 73 20 61 6e 20 61 6e 73 77 65 72 20 77 69 74 68 20 69 6e 74 65 67 65 72 0a 20 | roduces.an.answer.with.integer.. |
| 7ebc0 | 20 20 20 20 20 20 20 20 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 6f 6e 20 74 68 65 20 65 78 61 | .........coefficients.on.the.exa |
| 7ebe0 | 6d 70 6c 65 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 39 35 3a 3a 2e 0a 0a | mple.in.*Note.Exercise.2-95::... |
| 7ec00 | 20 20 20 20 20 20 20 62 2e 20 54 68 65 20 47 43 44 20 6e 6f 77 20 68 61 73 20 69 6e 74 65 67 65 | .......b..The.GCD.now.has.intege |
| 7ec20 | 72 20 63 6f 65 66 66 69 63 69 65 6e 74 73 2c 20 62 75 74 20 74 68 65 79 20 61 72 65 20 6c 61 72 | r.coefficients,.but.they.are.lar |
| 7ec40 | 67 65 72 0a 20 20 20 20 20 20 20 20 20 20 74 68 61 6e 20 74 68 6f 73 65 20 6f 66 20 50 5f 31 2e | ger...........than.those.of.P_1. |
| 7ec60 | 20 20 4d 6f 64 69 66 79 20 60 67 63 64 2d 74 65 72 6d 73 27 20 73 6f 20 74 68 61 74 20 69 74 20 | ..Modify.`gcd-terms'.so.that.it. |
| 7ec80 | 72 65 6d 6f 76 65 73 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 6d 6f 6e 20 66 61 63 74 6f 72 73 | removes...........common.factors |
| 7eca0 | 20 66 72 6f 6d 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 6f 66 20 74 68 65 20 61 6e | .from.the.coefficients.of.the.an |
| 7ecc0 | 73 77 65 72 20 62 79 0a 20 20 20 20 20 20 20 20 20 20 64 69 76 69 64 69 6e 67 20 61 6c 6c 20 74 | swer.by...........dividing.all.t |
| 7ece0 | 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 62 79 20 74 68 65 69 72 20 28 69 6e 74 65 67 65 | he.coefficients.by.their.(intege |
| 7ed00 | 72 29 20 67 72 65 61 74 65 73 74 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 6d 6f 6e 20 64 69 76 | r).greatest...........common.div |
| 7ed20 | 69 73 6f 72 2e 0a 0a 0a 20 20 20 20 20 54 68 75 73 2c 20 68 65 72 65 20 69 73 20 68 6f 77 20 74 | isor.........Thus,.here.is.how.t |
| 7ed40 | 6f 20 72 65 64 75 63 65 20 61 20 72 61 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 | o.reduce.a.rational.function.to. |
| 7ed60 | 6c 6f 77 65 73 74 20 74 65 72 6d 73 3a 0a 0a 20 20 20 20 20 20 20 20 2a 20 43 6f 6d 70 75 74 65 | lowest.terms:..........*.Compute |
| 7ed80 | 20 74 68 65 20 47 43 44 20 6f 66 20 74 68 65 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 64 65 | .the.GCD.of.the.numerator.and.de |
| 7eda0 | 6e 6f 6d 69 6e 61 74 6f 72 2c 20 75 73 69 6e 67 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 76 | nominator,.using.the...........v |
| 7edc0 | 65 72 73 69 6f 6e 20 6f 66 20 60 67 63 64 2d 74 65 72 6d 73 27 20 66 72 6f 6d 20 2a 4e 6f 74 65 | ersion.of.`gcd-terms'.from.*Note |
| 7ede0 | 20 45 78 65 72 63 69 73 65 20 32 2d 39 36 3a 3a 2e 0a 0a 20 20 20 20 20 20 20 20 2a 20 57 68 65 | .Exercise.2-96::...........*.Whe |
| 7ee00 | 6e 20 79 6f 75 20 6f 62 74 61 69 6e 20 74 68 65 20 47 43 44 2c 20 6d 75 6c 74 69 70 6c 79 20 62 | n.you.obtain.the.GCD,.multiply.b |
| 7ee20 | 6f 74 68 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 64 65 6e 6f | oth.numerator.and...........deno |
| 7ee40 | 6d 69 6e 61 74 6f 72 20 62 79 20 74 68 65 20 73 61 6d 65 20 69 6e 74 65 67 65 72 69 7a 69 6e 67 | minator.by.the.same.integerizing |
| 7ee60 | 20 66 61 63 74 6f 72 20 62 65 66 6f 72 65 20 64 69 76 69 64 69 6e 67 0a 20 20 20 20 20 20 20 20 | .factor.before.dividing......... |
| 7ee80 | 20 20 74 68 72 6f 75 67 68 20 62 79 20 74 68 65 20 47 43 44 2c 20 73 6f 20 74 68 61 74 20 64 69 | ..through.by.the.GCD,.so.that.di |
| 7eea0 | 76 69 73 69 6f 6e 20 62 79 20 74 68 65 20 47 43 44 20 77 69 6c 6c 20 6e 6f 74 0a 20 20 20 20 20 | vision.by.the.GCD.will.not...... |
| 7eec0 | 20 20 20 20 20 69 6e 74 72 6f 64 75 63 65 20 61 6e 79 20 6e 6f 6e 69 6e 74 65 67 65 72 20 63 6f | .....introduce.any.noninteger.co |
| 7eee0 | 65 66 66 69 63 69 65 6e 74 73 2e 20 20 41 73 20 74 68 65 20 66 61 63 74 6f 72 20 79 6f 75 20 63 | efficients...As.the.factor.you.c |
| 7ef00 | 61 6e 0a 20 20 20 20 20 20 20 20 20 20 75 73 65 20 74 68 65 20 6c 65 61 64 69 6e 67 20 63 6f 65 | an...........use.the.leading.coe |
| 7ef20 | 66 66 69 63 69 65 6e 74 20 6f 66 20 74 68 65 20 47 43 44 20 72 61 69 73 65 64 20 74 6f 20 74 68 | fficient.of.the.GCD.raised.to.th |
| 7ef40 | 65 20 70 6f 77 65 72 20 31 0a 20 20 20 20 20 20 20 20 20 20 2b 20 4f 5f 31 20 2d 20 4f 5f 32 2c | e.power.1...........+.O_1.-.O_2, |
| 7ef60 | 20 77 68 65 72 65 20 4f 5f 32 20 69 73 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 47 | .where.O_2.is.the.order.of.the.G |
| 7ef80 | 43 44 20 61 6e 64 20 4f 5f 31 20 69 73 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 6d 61 78 69 | CD.and.O_1.is.the...........maxi |
| 7efa0 | 6d 75 6d 20 6f 66 20 74 68 65 20 6f 72 64 65 72 73 20 6f 66 20 74 68 65 20 6e 75 6d 65 72 61 74 | mum.of.the.orders.of.the.numerat |
| 7efc0 | 6f 72 20 61 6e 64 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 2e 20 20 54 68 69 73 0a 20 20 20 20 20 20 | or.and.denominator...This....... |
| 7efe0 | 20 20 20 20 77 69 6c 6c 20 65 6e 73 75 72 65 20 74 68 61 74 20 64 69 76 69 64 69 6e 67 20 74 68 | ....will.ensure.that.dividing.th |
| 7f000 | 65 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 20 62 79 0a 20 | e.numerator.and.denominator.by.. |
| 7f020 | 20 20 20 20 20 20 20 20 20 74 68 65 20 47 43 44 20 77 69 6c 6c 20 6e 6f 74 20 69 6e 74 72 6f 64 | .........the.GCD.will.not.introd |
| 7f040 | 75 63 65 20 61 6e 79 20 66 72 61 63 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 20 20 20 2a 20 54 68 | uce.any.fractions...........*.Th |
| 7f060 | 65 20 72 65 73 75 6c 74 20 6f 66 20 74 68 69 73 20 6f 70 65 72 61 74 69 6f 6e 20 77 69 6c 6c 20 | e.result.of.this.operation.will. |
| 7f080 | 62 65 20 61 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 64 65 6e | be.a.numerator.and...........den |
| 7f0a0 | 6f 6d 69 6e 61 74 6f 72 20 77 69 74 68 20 69 6e 74 65 67 65 72 20 63 6f 65 66 66 69 63 69 65 6e | ominator.with.integer.coefficien |
| 7f0c0 | 74 73 2e 20 20 54 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 77 69 6c 6c 0a 20 20 20 20 20 | ts...The.coefficients.will...... |
| 7f0e0 | 20 20 20 20 20 6e 6f 72 6d 61 6c 6c 79 20 62 65 20 76 65 72 79 20 6c 61 72 67 65 20 62 65 63 61 | .....normally.be.very.large.beca |
| 7f100 | 75 73 65 20 6f 66 20 61 6c 6c 20 6f 66 20 74 68 65 20 69 6e 74 65 67 65 72 69 7a 69 6e 67 0a 20 | use.of.all.of.the.integerizing.. |
| 7f120 | 20 20 20 20 20 20 20 20 20 66 61 63 74 6f 72 73 2c 20 73 6f 20 74 68 65 20 6c 61 73 74 20 73 74 | .........factors,.so.the.last.st |
| 7f140 | 65 70 20 69 73 20 74 6f 20 72 65 6d 6f 76 65 20 74 68 65 20 72 65 64 75 6e 64 61 6e 74 20 66 61 | ep.is.to.remove.the.redundant.fa |
| 7f160 | 63 74 6f 72 73 0a 20 20 20 20 20 20 20 20 20 20 62 79 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 | ctors...........by.computing.the |
| 7f180 | 20 28 69 6e 74 65 67 65 72 29 20 67 72 65 61 74 65 73 74 20 63 6f 6d 6d 6f 6e 20 64 69 76 69 73 | .(integer).greatest.common.divis |
| 7f1a0 | 6f 72 20 6f 66 20 61 6c 6c 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 63 6f 65 66 66 69 63 69 | or.of.all.the...........coeffici |
| 7f1c0 | 65 6e 74 73 20 6f 66 20 74 68 65 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 74 68 65 20 64 65 | ents.of.the.numerator.and.the.de |
| 7f1e0 | 6e 6f 6d 69 6e 61 74 6f 72 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 64 69 76 69 64 69 6e 67 | nominator.and...........dividing |
| 7f200 | 20 74 68 72 6f 75 67 68 20 62 79 20 74 68 69 73 20 66 61 63 74 6f 72 2e 0a 0a 0a 20 20 20 20 20 | .through.by.this.factor......... |
| 7f220 | 2a 45 78 65 72 63 69 73 65 20 32 2e 39 37 3a 2a 0a 20 20 20 20 20 20 20 61 2e 20 49 6d 70 6c 65 | *Exercise.2.97:*........a..Imple |
| 7f240 | 6d 65 6e 74 20 74 68 69 73 20 61 6c 67 6f 72 69 74 68 6d 20 61 73 20 61 20 70 72 6f 63 65 64 75 | ment.this.algorithm.as.a.procedu |
| 7f260 | 72 65 20 60 72 65 64 75 63 65 2d 74 65 72 6d 73 27 20 74 68 61 74 0a 20 20 20 20 20 20 20 20 20 | re.`reduce-terms'.that.......... |
| 7f280 | 20 74 61 6b 65 73 20 74 77 6f 20 74 65 72 6d 20 6c 69 73 74 73 20 60 6e 27 20 61 6e 64 20 60 64 | .takes.two.term.lists.`n'.and.`d |
| 7f2a0 | 27 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 0a 20 20 20 | '.as.arguments.and.returns.a.... |
| 7f2c0 | 20 20 20 20 20 20 20 6c 69 73 74 20 60 6e 6e 27 2c 20 60 64 64 27 2c 20 77 68 69 63 68 20 61 72 | .......list.`nn',.`dd',.which.ar |
| 7f2e0 | 65 20 60 6e 27 20 61 6e 64 20 60 64 27 20 72 65 64 75 63 65 64 20 74 6f 20 6c 6f 77 65 73 74 0a | e.`n'.and.`d'.reduced.to.lowest. |
| 7f300 | 20 20 20 20 20 20 20 20 20 20 74 65 72 6d 73 20 76 69 61 20 74 68 65 20 61 6c 67 6f 72 69 74 68 | ..........terms.via.the.algorith |
| 7f320 | 6d 20 67 69 76 65 6e 20 61 62 6f 76 65 2e 20 20 41 6c 73 6f 20 77 72 69 74 65 20 61 20 70 72 6f | m.given.above...Also.write.a.pro |
| 7f340 | 63 65 64 75 72 65 0a 20 20 20 20 20 20 20 20 20 20 60 72 65 64 75 63 65 2d 70 6f 6c 79 27 2c 20 | cedure...........`reduce-poly',. |
| 7f360 | 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 60 61 64 64 2d 70 6f 6c 79 27 2c 20 74 68 61 74 20 63 68 | analogous.to.`add-poly',.that.ch |
| 7f380 | 65 63 6b 73 20 74 6f 20 73 65 65 20 69 66 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 20 74 77 6f | ecks.to.see.if...........the.two |
| 7f3a0 | 20 70 6f 6c 79 73 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 76 61 72 69 61 62 6c 65 2e 20 20 | .polys.have.the.same.variable... |
| 7f3c0 | 49 66 20 73 6f 2c 20 60 72 65 64 75 63 65 2d 70 6f 6c 79 27 0a 20 20 20 20 20 20 20 20 20 20 73 | If.so,.`reduce-poly'...........s |
| 7f3e0 | 74 72 69 70 73 20 6f 66 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 61 6e 64 20 70 61 73 73 65 | trips.off.the.variable.and.passe |
| 7f400 | 73 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 60 72 65 64 75 | s.the.problem.to...........`redu |
| 7f420 | 63 65 2d 74 65 72 6d 73 27 2c 20 74 68 65 6e 20 72 65 61 74 74 61 63 68 65 73 20 74 68 65 20 76 | ce-terms',.then.reattaches.the.v |
| 7f440 | 61 72 69 61 62 6c 65 20 74 6f 20 74 68 65 20 74 77 6f 20 74 65 72 6d 0a 20 20 20 20 20 20 20 20 | ariable.to.the.two.term......... |
| 7f460 | 20 20 6c 69 73 74 73 20 73 75 70 70 6c 69 65 64 20 62 79 20 60 72 65 64 75 63 65 2d 74 65 72 6d | ..lists.supplied.by.`reduce-term |
| 7f480 | 73 27 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 | s'..........b..Define.a.procedur |
| 7f4a0 | 65 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 60 72 65 64 75 63 65 2d 74 65 72 6d 73 27 20 74 68 | e.analogous.to.`reduce-terms'.th |
| 7f4c0 | 61 74 20 64 6f 65 73 20 77 68 61 74 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 20 6f 72 69 67 69 | at.does.what...........the.origi |
| 7f4e0 | 6e 61 6c 20 60 6d 61 6b 65 2d 72 61 74 27 20 64 69 64 20 66 6f 72 20 69 6e 74 65 67 65 72 73 3a | nal.`make-rat'.did.for.integers: |
| 7f500 | 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 64 75 63 65 | .................(define.(reduce |
| 7f520 | 2d 69 6e 74 65 67 65 72 73 20 6e 20 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -integers.n.d).................. |
| 7f540 | 28 6c 65 74 20 28 28 67 20 28 67 63 64 20 6e 20 64 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (let.((g.(gcd.n.d)))............ |
| 7f560 | 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 28 2f 20 6e 20 67 29 20 28 2f 20 64 20 67 29 29 29 29 | ........(list.(/.n.g).(/.d.g)))) |
| 7f580 | 0a 0a 20 20 20 20 20 20 20 20 20 20 61 6e 64 20 64 65 66 69 6e 65 20 60 72 65 64 75 63 65 27 20 | ............and.define.`reduce'. |
| 7f5a0 | 61 73 20 61 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 63 61 6c 6c | as.a.generic.operation.that.call |
| 7f5c0 | 73 0a 20 20 20 20 20 20 20 20 20 20 60 61 70 70 6c 79 2d 67 65 6e 65 72 69 63 27 20 74 6f 20 64 | s...........`apply-generic'.to.d |
| 7f5e0 | 69 73 70 61 74 63 68 20 74 6f 20 65 69 74 68 65 72 20 60 72 65 64 75 63 65 2d 70 6f 6c 79 27 20 | ispatch.to.either.`reduce-poly'. |
| 7f600 | 28 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20 60 70 6f 6c 79 6e 6f 6d 69 61 6c 27 20 61 72 67 75 | (for...........`polynomial'.argu |
| 7f620 | 6d 65 6e 74 73 29 20 6f 72 20 60 72 65 64 75 63 65 2d 69 6e 74 65 67 65 72 73 27 20 28 66 6f 72 | ments).or.`reduce-integers'.(for |
| 7f640 | 0a 20 20 20 20 20 20 20 20 20 20 60 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 27 20 61 72 67 75 6d | ...........`scheme-number'.argum |
| 7f660 | 65 6e 74 73 29 2e 20 20 59 6f 75 20 63 61 6e 20 6e 6f 77 20 65 61 73 69 6c 79 20 6d 61 6b 65 20 | ents)...You.can.now.easily.make. |
| 7f680 | 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 72 61 74 69 6f 6e 61 6c 2d 61 72 69 74 68 6d 65 74 69 | the...........rational-arithmeti |
| 7f6a0 | 63 20 70 61 63 6b 61 67 65 20 72 65 64 75 63 65 20 66 72 61 63 74 69 6f 6e 73 20 74 6f 20 6c 6f | c.package.reduce.fractions.to.lo |
| 7f6c0 | 77 65 73 74 20 74 65 72 6d 73 0a 20 20 20 20 20 20 20 20 20 20 62 79 20 68 61 76 69 6e 67 20 60 | west.terms...........by.having.` |
| 7f6e0 | 6d 61 6b 65 2d 72 61 74 27 20 63 61 6c 6c 20 60 72 65 64 75 63 65 27 20 62 65 66 6f 72 65 20 63 | make-rat'.call.`reduce'.before.c |
| 7f700 | 6f 6d 62 69 6e 69 6e 67 20 74 68 65 20 67 69 76 65 6e 0a 20 20 20 20 20 20 20 20 20 20 6e 75 6d | ombining.the.given...........num |
| 7f720 | 65 72 61 74 6f 72 20 61 6e 64 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 20 74 6f 20 66 6f 72 6d 20 61 | erator.and.denominator.to.form.a |
| 7f740 | 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 2e 20 20 54 68 65 0a 20 20 20 20 20 20 20 20 20 | .rational.number...The.......... |
| 7f760 | 20 73 79 73 74 65 6d 20 6e 6f 77 20 68 61 6e 64 6c 65 73 20 72 61 74 69 6f 6e 61 6c 20 65 78 70 | .system.now.handles.rational.exp |
| 7f780 | 72 65 73 73 69 6f 6e 73 20 69 6e 20 65 69 74 68 65 72 20 69 6e 74 65 67 65 72 73 20 6f 72 0a 20 | ressions.in.either.integers.or.. |
| 7f7a0 | 20 20 20 20 20 20 20 20 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2e 20 20 54 6f 20 74 65 73 74 20 79 | .........polynomials...To.test.y |
| 7f7c0 | 6f 75 72 20 70 72 6f 67 72 61 6d 2c 20 74 72 79 20 74 68 65 20 65 78 61 6d 70 6c 65 20 61 74 20 | our.program,.try.the.example.at. |
| 7f7e0 | 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 69 73 20 | the...........beginning.of.this. |
| 7f800 | 65 78 74 65 6e 64 65 64 20 65 78 65 72 63 69 73 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 | extended.exercise:.............. |
| 7f820 | 20 20 20 28 64 65 66 69 6e 65 20 70 31 20 28 6d 61 6b 65 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 20 27 | ...(define.p1.(make-polynomial.' |
| 7f840 | 78 20 27 28 28 31 20 31 29 28 30 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | x.'((1.1)(0.1))))............... |
| 7f860 | 20 28 64 65 66 69 6e 65 20 70 32 20 28 6d 61 6b 65 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 20 27 78 20 | .(define.p2.(make-polynomial.'x. |
| 7f880 | 27 28 28 33 20 31 29 28 30 20 2d 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | '((3.1)(0.-1))))................ |
| 7f8a0 | 28 64 65 66 69 6e 65 20 70 33 20 28 6d 61 6b 65 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 20 27 78 20 27 | (define.p3.(make-polynomial.'x.' |
| 7f8c0 | 28 28 31 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | ((1.1))))................(define |
| 7f8e0 | 20 70 34 20 28 6d 61 6b 65 2d 70 6f 6c 79 6e 6f 6d 69 61 6c 20 27 78 20 27 28 28 32 20 31 29 28 | .p4.(make-polynomial.'x.'((2.1)( |
| 7f900 | 30 20 2d 31 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | 0.-1)))).................(define |
| 7f920 | 20 72 66 31 20 28 6d 61 6b 65 2d 72 61 74 69 6f 6e 61 6c 20 70 31 20 70 32 29 29 0a 20 20 20 20 | .rf1.(make-rational.p1.p2))..... |
| 7f940 | 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 72 66 32 20 28 6d 61 6b 65 2d 72 61 74 | ...........(define.rf2.(make-rat |
| 7f960 | 69 6f 6e 61 6c 20 70 33 20 70 34 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 | ional.p3.p4)).................(a |
| 7f980 | 64 64 20 72 66 31 20 72 66 32 29 0a 0a 20 20 20 20 20 20 20 20 20 20 53 65 65 20 69 66 20 79 6f | dd.rf1.rf2)............See.if.yo |
| 7f9a0 | 75 20 67 65 74 20 74 68 65 20 63 6f 72 72 65 63 74 20 61 6e 73 77 65 72 2c 20 63 6f 72 72 65 63 | u.get.the.correct.answer,.correc |
| 7f9c0 | 74 6c 79 20 72 65 64 75 63 65 64 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 6c 6f 77 65 73 74 20 | tly.reduced.to...........lowest. |
| 7f9e0 | 74 65 72 6d 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 54 68 65 20 47 43 44 20 63 6f 6d 70 75 74 | terms.............The.GCD.comput |
| 7fa00 | 61 74 69 6f 6e 20 69 73 20 61 74 20 74 68 65 20 68 65 61 72 74 20 6f 66 20 61 6e 79 20 73 79 73 | ation.is.at.the.heart.of.any.sys |
| 7fa20 | 74 65 6d 20 74 68 61 74 20 64 6f 65 73 0a 20 20 20 20 20 20 20 20 20 20 6f 70 65 72 61 74 69 6f | tem.that.does...........operatio |
| 7fa40 | 6e 73 20 6f 6e 20 72 61 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 73 2e 20 20 54 68 65 20 61 | ns.on.rational.functions...The.a |
| 7fa60 | 6c 67 6f 72 69 74 68 6d 20 75 73 65 64 20 61 62 6f 76 65 2c 0a 20 20 20 20 20 20 20 20 20 20 61 | lgorithm.used.above,...........a |
| 7fa80 | 6c 74 68 6f 75 67 68 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 6c 79 20 73 74 72 61 69 67 68 74 66 | lthough.mathematically.straightf |
| 7faa0 | 6f 72 77 61 72 64 2c 20 69 73 20 65 78 74 72 65 6d 65 6c 79 20 73 6c 6f 77 2e 0a 20 20 20 20 20 | orward,.is.extremely.slow....... |
| 7fac0 | 20 20 20 20 20 54 68 65 20 73 6c 6f 77 6e 65 73 73 20 69 73 20 64 75 65 20 70 61 72 74 6c 79 20 | .....The.slowness.is.due.partly. |
| 7fae0 | 74 6f 20 74 68 65 20 6c 61 72 67 65 20 6e 75 6d 62 65 72 20 6f 66 20 64 69 76 69 73 69 6f 6e 0a | to.the.large.number.of.division. |
| 7fb00 | 20 20 20 20 20 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 6e 64 20 70 61 72 74 6c 79 20 | ..........operations.and.partly. |
| 7fb20 | 74 6f 20 74 68 65 20 65 6e 6f 72 6d 6f 75 73 20 73 69 7a 65 20 6f 66 20 74 68 65 0a 20 20 20 20 | to.the.enormous.size.of.the..... |
| 7fb40 | 20 20 20 20 20 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 | ......intermediate.coefficients. |
| 7fb60 | 67 65 6e 65 72 61 74 65 64 20 62 79 20 74 68 65 20 70 73 65 75 64 6f 64 69 76 69 73 69 6f 6e 73 | generated.by.the.pseudodivisions |
| 7fb80 | 2e 0a 20 20 20 20 20 20 20 20 20 20 4f 6e 65 20 6f 66 20 74 68 65 20 61 63 74 69 76 65 20 61 72 | ............One.of.the.active.ar |
| 7fba0 | 65 61 73 20 69 6e 20 74 68 65 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 6f 66 0a 20 20 20 20 20 20 | eas.in.the.development.of....... |
| 7fbc0 | 20 20 20 20 61 6c 67 65 62 72 61 69 63 2d 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 73 79 73 74 65 | ....algebraic-manipulation.syste |
| 7fbe0 | 6d 73 20 69 73 20 74 68 65 20 64 65 73 69 67 6e 20 6f 66 20 62 65 74 74 65 72 0a 20 20 20 20 20 | ms.is.the.design.of.better...... |
| 7fc00 | 20 20 20 20 20 61 6c 67 6f 72 69 74 68 6d 73 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 70 6f | .....algorithms.for.computing.po |
| 7fc20 | 6c 79 6e 6f 6d 69 61 6c 20 47 43 44 73 2e 28 39 29 0a 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d | lynomial.GCDs.(9)......--------- |
| 7fc40 | 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 4f | -.Footnotes.----------.....(1).O |
| 7fc60 | 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 77 65 20 77 69 6c 6c 20 61 6c 6c 6f 77 20 | n.the.other.hand,.we.will.allow. |
| 7fc80 | 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 77 68 6f 73 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 0a 61 | polynomials.whose.coefficients.a |
| 7fca0 | 72 65 20 74 68 65 6d 73 65 6c 76 65 73 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 6e 20 6f 74 68 | re.themselves.polynomials.in.oth |
| 7fcc0 | 65 72 20 76 61 72 69 61 62 6c 65 73 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 67 69 76 65 20 75 73 | er.variables...This.will.give.us |
| 7fce0 | 0a 65 73 73 65 6e 74 69 61 6c 6c 79 20 74 68 65 20 73 61 6d 65 20 72 65 70 72 65 73 65 6e 74 61 | .essentially.the.same.representa |
| 7fd00 | 74 69 6f 6e 61 6c 20 70 6f 77 65 72 20 61 73 20 61 20 66 75 6c 6c 20 6d 75 6c 74 69 76 61 72 69 | tional.power.as.a.full.multivari |
| 7fd20 | 61 74 65 0a 73 79 73 74 65 6d 2c 20 61 6c 74 68 6f 75 67 68 20 69 74 20 64 6f 65 73 20 6c 65 61 | ate.system,.although.it.does.lea |
| 7fd40 | 64 20 74 6f 20 63 6f 65 72 63 69 6f 6e 20 70 72 6f 62 6c 65 6d 73 2c 20 61 73 20 64 69 73 63 75 | d.to.coercion.problems,.as.discu |
| 7fd60 | 73 73 65 64 20 62 65 6c 6f 77 2e 0a 0a 20 20 20 28 32 29 20 46 6f 72 20 75 6e 69 76 61 72 69 61 | ssed.below......(2).For.univaria |
| 7fd80 | 74 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2c 20 67 69 76 69 6e 67 20 74 68 65 20 76 61 6c 75 65 | te.polynomials,.giving.the.value |
| 7fda0 | 20 6f 66 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 61 74 0a 61 20 67 69 76 65 6e 20 73 65 74 20 | .of.a.polynomial.at.a.given.set. |
| 7fdc0 | 6f 66 20 70 6f 69 6e 74 73 20 63 61 6e 20 62 65 20 61 20 70 61 72 74 69 63 75 6c 61 72 6c 79 20 | of.points.can.be.a.particularly. |
| 7fde0 | 67 6f 6f 64 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 54 68 69 73 0a 6d 61 6b 65 73 | good.representation...This.makes |
| 7fe00 | 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 61 72 69 74 68 6d 65 74 69 63 20 65 78 74 72 65 6d 65 6c 79 | .polynomial.arithmetic.extremely |
| 7fe20 | 20 73 69 6d 70 6c 65 2e 20 20 54 6f 20 6f 62 74 61 69 6e 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 | .simple...To.obtain,.for.example |
| 7fe40 | 2c 0a 74 68 65 20 73 75 6d 20 6f 66 20 74 77 6f 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 72 65 70 | ,.the.sum.of.two.polynomials.rep |
| 7fe60 | 72 65 73 65 6e 74 65 64 20 69 6e 20 74 68 69 73 20 77 61 79 2c 20 77 65 20 6e 65 65 64 20 6f 6e | resented.in.this.way,.we.need.on |
| 7fe80 | 6c 79 20 61 64 64 0a 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 70 6f 6c 79 6e 6f 6d | ly.add.the.values.of.the.polynom |
| 7fea0 | 69 61 6c 73 20 61 74 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 70 6f 69 6e 74 73 2e 20 20 54 | ials.at.corresponding.points...T |
| 7fec0 | 6f 20 74 72 61 6e 73 66 6f 72 6d 0a 62 61 63 6b 20 74 6f 20 61 20 6d 6f 72 65 20 66 61 6d 69 6c | o.transform.back.to.a.more.famil |
| 7fee0 | 69 61 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c 20 77 65 20 63 61 6e 20 75 73 65 20 74 | iar.representation,.we.can.use.t |
| 7ff00 | 68 65 20 4c 61 67 72 61 6e 67 65 0a 69 6e 74 65 72 70 6f 6c 61 74 69 6f 6e 20 66 6f 72 6d 75 6c | he.Lagrange.interpolation.formul |
| 7ff20 | 61 2c 20 77 68 69 63 68 20 73 68 6f 77 73 20 68 6f 77 20 74 6f 20 72 65 63 6f 76 65 72 20 74 68 | a,.which.shows.how.to.recover.th |
| 7ff40 | 65 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 6f 66 20 61 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 20 6f | e.coefficients.of.a.polynomial.o |
| 7ff60 | 66 20 64 65 67 72 65 65 20 6e 20 67 69 76 65 6e 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 | f.degree.n.given.the.values.of.t |
| 7ff80 | 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 61 74 20 6e 20 2b 20 31 0a 70 6f 69 6e 74 73 2e 0a 0a | he.polynomial.at.n.+.1.points... |
| 7ffa0 | 20 20 20 28 33 29 20 54 68 69 73 20 6f 70 65 72 61 74 69 6f 6e 20 69 73 20 76 65 72 79 20 6d 75 | ...(3).This.operation.is.very.mu |
| 7ffc0 | 63 68 20 6c 69 6b 65 20 74 68 65 20 6f 72 64 65 72 65 64 20 60 75 6e 69 6f 6e 2d 73 65 74 27 0a | ch.like.the.ordered.`union-set'. |
| 7ffe0 | 6f 70 65 72 61 74 69 6f 6e 20 77 65 20 64 65 76 65 6c 6f 70 65 64 20 69 6e 20 65 78 65 72 63 69 | operation.we.developed.in.exerci |
| 80000 | 73 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 36 32 3a 3a 2e 20 20 49 6e 20 66 61 | se.*Note.Exercise.2-62::...In.fa |
| 80020 | 63 74 2c 20 69 66 0a 77 65 20 74 68 69 6e 6b 20 6f 66 20 74 68 65 20 74 65 72 6d 73 20 6f 66 20 | ct,.if.we.think.of.the.terms.of. |
| 80040 | 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 61 73 20 61 20 73 65 74 20 6f 72 64 65 72 65 64 20 | the.polynomial.as.a.set.ordered. |
| 80060 | 61 63 63 6f 72 64 69 6e 67 20 74 6f 0a 74 68 65 20 70 6f 77 65 72 20 6f 66 20 74 68 65 20 69 6e | according.to.the.power.of.the.in |
| 80080 | 64 65 74 65 72 6d 69 6e 61 74 65 2c 20 74 68 65 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 20 74 68 | determinate,.then.the.program.th |
| 800a0 | 61 74 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 74 65 72 6d 0a 6c 69 73 74 20 66 6f 72 20 61 20 | at.produces.the.term.list.for.a. |
| 800c0 | 73 75 6d 20 69 73 20 61 6c 6d 6f 73 74 20 69 64 65 6e 74 69 63 61 6c 20 74 6f 20 60 75 6e 69 6f | sum.is.almost.identical.to.`unio |
| 800e0 | 6e 2d 73 65 74 27 2e 0a 0a 20 20 20 28 34 29 20 54 6f 20 6d 61 6b 65 20 74 68 69 73 20 77 6f 72 | n-set'......(4).To.make.this.wor |
| 80100 | 6b 20 63 6f 6d 70 6c 65 74 65 6c 79 20 73 6d 6f 6f 74 68 6c 79 2c 20 77 65 20 73 68 6f 75 6c 64 | k.completely.smoothly,.we.should |
| 80120 | 20 61 6c 73 6f 20 61 64 64 20 74 6f 20 6f 75 72 0a 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 | .also.add.to.our.generic.arithme |
| 80140 | 74 69 63 20 73 79 73 74 65 6d 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 63 6f 65 72 63 65 | tic.system.the.ability.to.coerce |
| 80160 | 20 61 20 22 6e 75 6d 62 65 72 22 20 74 6f 20 61 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 20 62 79 20 72 | .a."number".to.a.polynomial.by.r |
| 80180 | 65 67 61 72 64 69 6e 67 20 69 74 20 61 73 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 6f 66 20 64 | egarding.it.as.a.polynomial.of.d |
| 801a0 | 65 67 72 65 65 20 7a 65 72 6f 20 77 68 6f 73 65 0a 63 6f 65 66 66 69 63 69 65 6e 74 20 69 73 20 | egree.zero.whose.coefficient.is. |
| 801c0 | 74 68 65 20 6e 75 6d 62 65 72 2e 20 20 54 68 69 73 20 69 73 20 6e 65 63 65 73 73 61 72 79 20 69 | the.number...This.is.necessary.i |
| 801e0 | 66 20 77 65 20 61 72 65 20 67 6f 69 6e 67 20 74 6f 0a 70 65 72 66 6f 72 6d 20 6f 70 65 72 61 74 | f.we.are.going.to.perform.operat |
| 80200 | 69 6f 6e 73 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 20 5b 78 5e 32 20 2b 20 28 79 20 2b 20 31 | ions.such.as.......[x^2.+.(y.+.1 |
| 80220 | 29 78 20 2b 20 35 5d 20 2b 20 5b 78 5e 32 20 2b 20 32 78 20 2b 20 31 5d 0a 0a 77 68 69 63 68 20 | )x.+.5].+.[x^2.+.2x.+.1]..which. |
| 80240 | 72 65 71 75 69 72 65 73 20 61 64 64 69 6e 67 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 20 | requires.adding.the.coefficient. |
| 80260 | 79 20 2b 20 31 20 74 6f 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 20 32 2e 0a 0a 20 20 20 | y.+.1.to.the.coefficient.2...... |
| 80280 | 28 35 29 20 49 6e 20 74 68 65 73 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 65 78 61 6d 70 6c 65 73 | (5).In.these.polynomial.examples |
| 802a0 | 2c 20 77 65 20 61 73 73 75 6d 65 20 74 68 61 74 20 77 65 20 68 61 76 65 20 69 6d 70 6c 65 6d 65 | ,.we.assume.that.we.have.impleme |
| 802c0 | 6e 74 65 64 0a 74 68 65 20 67 65 6e 65 72 69 63 20 61 72 69 74 68 6d 65 74 69 63 20 73 79 73 74 | nted.the.generic.arithmetic.syst |
| 802e0 | 65 6d 20 75 73 69 6e 67 20 74 68 65 20 74 79 70 65 20 6d 65 63 68 61 6e 69 73 6d 20 73 75 67 67 | em.using.the.type.mechanism.sugg |
| 80300 | 65 73 74 65 64 20 69 6e 0a 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 37 38 3a 3a 2e 20 | ested.in.*Note.Exercise.2-78::.. |
| 80320 | 20 54 68 75 73 2c 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 74 68 61 74 20 61 72 65 20 6f 72 64 | .Thus,.coefficients.that.are.ord |
| 80340 | 69 6e 61 72 79 20 6e 75 6d 62 65 72 73 0a 77 69 6c 6c 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 | inary.numbers.will.be.represente |
| 80360 | 64 20 61 73 20 74 68 65 20 6e 75 6d 62 65 72 73 20 74 68 65 6d 73 65 6c 76 65 73 20 72 61 74 68 | d.as.the.numbers.themselves.rath |
| 80380 | 65 72 20 74 68 61 6e 20 61 73 20 70 61 69 72 73 0a 77 68 6f 73 65 20 60 63 61 72 27 20 69 73 20 | er.than.as.pairs.whose.`car'.is. |
| 803a0 | 74 68 65 20 73 79 6d 62 6f 6c 20 60 73 63 68 65 6d 65 2d 6e 75 6d 62 65 72 27 2e 0a 0a 20 20 20 | the.symbol.`scheme-number'...... |
| 803c0 | 28 36 29 20 41 6c 74 68 6f 75 67 68 20 77 65 20 61 72 65 20 61 73 73 75 6d 69 6e 67 20 74 68 61 | (6).Although.we.are.assuming.tha |
| 803e0 | 74 20 74 65 72 6d 20 6c 69 73 74 73 20 61 72 65 20 6f 72 64 65 72 65 64 2c 20 77 65 20 68 61 76 | t.term.lists.are.ordered,.we.hav |
| 80400 | 65 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 60 61 64 6a 6f 69 6e 2d 74 65 72 6d 27 20 74 6f 20 73 | e.implemented.`adjoin-term'.to.s |
| 80420 | 69 6d 70 6c 79 20 60 63 6f 6e 73 27 20 74 68 65 20 6e 65 77 20 74 65 72 6d 20 6f 6e 74 6f 20 74 | imply.`cons'.the.new.term.onto.t |
| 80440 | 68 65 0a 65 78 69 73 74 69 6e 67 20 74 65 72 6d 20 6c 69 73 74 2e 20 20 57 65 20 63 61 6e 20 67 | he.existing.term.list...We.can.g |
| 80460 | 65 74 20 61 77 61 79 20 77 69 74 68 20 74 68 69 73 20 73 6f 20 6c 6f 6e 67 20 61 73 20 77 65 20 | et.away.with.this.so.long.as.we. |
| 80480 | 67 75 61 72 61 6e 74 65 65 0a 74 68 61 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 28 73 | guarantee.that.the.procedures.(s |
| 804a0 | 75 63 68 20 61 73 20 60 61 64 64 2d 74 65 72 6d 73 27 29 20 74 68 61 74 20 75 73 65 20 60 61 64 | uch.as.`add-terms').that.use.`ad |
| 804c0 | 6a 6f 69 6e 2d 74 65 72 6d 27 20 61 6c 77 61 79 73 0a 63 61 6c 6c 20 69 74 20 77 69 74 68 20 61 | join-term'.always.call.it.with.a |
| 804e0 | 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 74 65 72 6d 20 74 68 61 6e 20 61 70 70 65 61 72 73 20 | .higher-order.term.than.appears. |
| 80500 | 69 6e 20 74 68 65 20 6c 69 73 74 2e 20 20 49 66 20 77 65 20 64 69 64 0a 6e 6f 74 20 77 61 6e 74 | in.the.list...If.we.did.not.want |
| 80520 | 20 74 6f 20 6d 61 6b 65 20 73 75 63 68 20 61 20 67 75 61 72 61 6e 74 65 65 2c 20 77 65 20 63 6f | .to.make.such.a.guarantee,.we.co |
| 80540 | 75 6c 64 20 68 61 76 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 0a 60 61 64 6a 6f 69 6e 2d 74 65 72 | uld.have.implemented.`adjoin-ter |
| 80560 | 6d 27 20 74 6f 20 62 65 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 60 61 64 6a 6f 69 6e 2d | m'.to.be.similar.to.the.`adjoin- |
| 80580 | 73 65 74 27 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 66 6f 72 20 74 68 65 0a 6f 72 64 65 72 65 64 | set'.constructor.for.the.ordered |
| 805a0 | 2d 6c 69 73 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 73 65 74 73 20 28 2a 4e | -list.representation.of.sets.(*N |
| 805c0 | 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 36 31 3a 3a 29 2e 0a 0a 20 20 20 28 37 29 20 54 68 | ote.Exercise.2-61::)......(7).Th |
| 805e0 | 65 20 66 61 63 74 20 74 68 61 74 20 45 75 63 6c 69 64 27 73 20 41 6c 67 6f 72 69 74 68 6d 20 77 | e.fact.that.Euclid's.Algorithm.w |
| 80600 | 6f 72 6b 73 20 66 6f 72 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 20 69 73 0a 66 6f 72 6d 61 6c 69 7a | orks.for.polynomials.is.formaliz |
| 80620 | 65 64 20 69 6e 20 61 6c 67 65 62 72 61 20 62 79 20 73 61 79 69 6e 67 20 74 68 61 74 20 70 6f 6c | ed.in.algebra.by.saying.that.pol |
| 80640 | 79 6e 6f 6d 69 61 6c 73 20 66 6f 72 6d 20 61 20 6b 69 6e 64 20 6f 66 0a 61 6c 67 65 62 72 61 69 | ynomials.form.a.kind.of.algebrai |
| 80660 | 63 20 64 6f 6d 61 69 6e 20 63 61 6c 6c 65 64 20 61 20 22 45 75 63 6c 69 64 65 61 6e 20 72 69 6e | c.domain.called.a."Euclidean.rin |
| 80680 | 67 22 2e 20 20 41 20 45 75 63 6c 69 64 65 61 6e 20 72 69 6e 67 20 69 73 20 61 0a 64 6f 6d 61 69 | g"...A.Euclidean.ring.is.a.domai |
| 806a0 | 6e 20 74 68 61 74 20 61 64 6d 69 74 73 20 61 64 64 69 74 69 6f 6e 2c 20 73 75 62 74 72 61 63 74 | n.that.admits.addition,.subtract |
| 806c0 | 69 6f 6e 2c 20 61 6e 64 20 63 6f 6d 6d 75 74 61 74 69 76 65 0a 6d 75 6c 74 69 70 6c 69 63 61 74 | ion,.and.commutative.multiplicat |
| 806e0 | 69 6f 6e 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 20 77 61 79 20 6f 66 20 61 73 73 69 | ion,.together.with.a.way.of.assi |
| 80700 | 67 6e 69 6e 67 20 74 6f 20 65 61 63 68 20 65 6c 65 6d 65 6e 74 20 78 20 6f 66 0a 74 68 65 20 72 | gning.to.each.element.x.of.the.r |
| 80720 | 69 6e 67 20 61 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 20 22 6d 65 61 73 75 72 65 22 | ing.a.positive.integer."measure" |
| 80740 | 20 6d 28 78 29 20 77 69 74 68 20 74 68 65 20 70 72 6f 70 65 72 74 69 65 73 20 74 68 61 74 0a 6d | .m(x).with.the.properties.that.m |
| 80760 | 28 78 79 29 3e 3d 20 6d 28 78 29 20 66 6f 72 20 61 6e 79 20 6e 6f 6e 7a 65 72 6f 20 78 20 61 6e | (xy)>=.m(x).for.any.nonzero.x.an |
| 80780 | 64 20 79 20 61 6e 64 20 74 68 61 74 2c 20 67 69 76 65 6e 20 61 6e 79 20 78 20 61 6e 64 20 79 2c | d.y.and.that,.given.any.x.and.y, |
| 807a0 | 20 74 68 65 72 65 0a 65 78 69 73 74 73 20 61 20 71 20 73 75 63 68 20 74 68 61 74 20 79 20 3d 20 | .there.exists.a.q.such.that.y.=. |
| 807c0 | 71 78 20 2b 20 72 20 61 6e 64 20 65 69 74 68 65 72 20 72 20 3d 20 30 20 6f 72 20 6d 28 72 29 3c | qx.+.r.and.either.r.=.0.or.m(r)< |
| 807e0 | 20 6d 28 78 29 2e 20 20 46 72 6f 6d 0a 61 6e 20 61 62 73 74 72 61 63 74 20 70 6f 69 6e 74 20 6f | .m(x)...From.an.abstract.point.o |
| 80800 | 66 20 76 69 65 77 2c 20 74 68 69 73 20 69 73 20 77 68 61 74 20 69 73 20 6e 65 65 64 65 64 20 74 | f.view,.this.is.what.is.needed.t |
| 80820 | 6f 20 70 72 6f 76 65 20 74 68 61 74 0a 45 75 63 6c 69 64 27 73 20 41 6c 67 6f 72 69 74 68 6d 20 | o.prove.that.Euclid's.Algorithm. |
| 80840 | 77 6f 72 6b 73 2e 20 20 46 6f 72 20 74 68 65 20 64 6f 6d 61 69 6e 20 6f 66 20 69 6e 74 65 67 65 | works...For.the.domain.of.intege |
| 80860 | 72 73 2c 20 74 68 65 20 6d 65 61 73 75 72 65 20 6d 20 6f 66 0a 61 6e 20 69 6e 74 65 67 65 72 20 | rs,.the.measure.m.of.an.integer. |
| 80880 | 69 73 20 74 68 65 20 61 62 73 6f 6c 75 74 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 69 6e 74 | is.the.absolute.value.of.the.int |
| 808a0 | 65 67 65 72 20 69 74 73 65 6c 66 2e 20 20 46 6f 72 20 74 68 65 20 64 6f 6d 61 69 6e 0a 6f 66 20 | eger.itself...For.the.domain.of. |
| 808c0 | 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2c 20 74 68 65 20 6d 65 61 73 75 72 65 20 6f 66 20 61 20 70 6f | polynomials,.the.measure.of.a.po |
| 808e0 | 6c 79 6e 6f 6d 69 61 6c 20 69 73 20 69 74 73 20 64 65 67 72 65 65 2e 0a 0a 20 20 20 28 38 29 20 | lynomial.is.its.degree......(8). |
| 80900 | 49 6e 20 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6c 69 6b 65 20 4d 49 54 20 53 63 | In.an.implementation.like.MIT.Sc |
| 80920 | 68 65 6d 65 2c 20 74 68 69 73 20 70 72 6f 64 75 63 65 73 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c | heme,.this.produces.a.polynomial |
| 80940 | 0a 74 68 61 74 20 69 73 20 69 6e 64 65 65 64 20 61 20 64 69 76 69 73 6f 72 20 6f 66 20 51 5f 31 | .that.is.indeed.a.divisor.of.Q_1 |
| 80960 | 20 61 6e 64 20 51 5f 32 2c 20 62 75 74 20 77 69 74 68 20 72 61 74 69 6f 6e 61 6c 0a 63 6f 65 66 | .and.Q_2,.but.with.rational.coef |
| 80980 | 66 69 63 69 65 6e 74 73 2e 20 20 49 6e 20 6d 61 6e 79 20 6f 74 68 65 72 20 53 63 68 65 6d 65 20 | ficients...In.many.other.Scheme. |
| 809a0 | 73 79 73 74 65 6d 73 2c 20 69 6e 20 77 68 69 63 68 20 64 69 76 69 73 69 6f 6e 20 6f 66 0a 69 6e | systems,.in.which.division.of.in |
| 809c0 | 74 65 67 65 72 73 20 63 61 6e 20 70 72 6f 64 75 63 65 20 6c 69 6d 69 74 65 64 2d 70 72 65 63 69 | tegers.can.produce.limited-preci |
| 809e0 | 73 69 6f 6e 20 64 65 63 69 6d 61 6c 20 6e 75 6d 62 65 72 73 2c 20 77 65 20 6d 61 79 20 66 61 69 | sion.decimal.numbers,.we.may.fai |
| 80a00 | 6c 20 74 6f 0a 67 65 74 20 61 20 76 61 6c 69 64 20 64 69 76 69 73 6f 72 2e 0a 0a 20 20 20 28 39 | l.to.get.a.valid.divisor......(9 |
| 80a20 | 29 20 4f 6e 65 20 65 78 74 72 65 6d 65 6c 79 20 65 66 66 69 63 69 65 6e 74 20 61 6e 64 20 65 6c | ).One.extremely.efficient.and.el |
| 80a40 | 65 67 61 6e 74 20 6d 65 74 68 6f 64 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 0a 70 6f 6c 79 6e | egant.method.for.computing.polyn |
| 80a60 | 6f 6d 69 61 6c 20 47 43 44 73 20 77 61 73 20 64 69 73 63 6f 76 65 72 65 64 20 62 79 20 52 69 63 | omial.GCDs.was.discovered.by.Ric |
| 80a80 | 68 61 72 64 20 5a 69 70 70 65 6c 20 28 31 39 37 39 29 2e 20 20 54 68 65 20 6d 65 74 68 6f 64 20 | hard.Zippel.(1979)...The.method. |
| 80aa0 | 69 73 0a 61 20 70 72 6f 62 61 62 69 6c 69 73 74 69 63 20 61 6c 67 6f 72 69 74 68 6d 2c 20 61 73 | is.a.probabilistic.algorithm,.as |
| 80ac0 | 20 69 73 20 74 68 65 20 66 61 73 74 20 74 65 73 74 20 66 6f 72 20 70 72 69 6d 61 6c 69 74 79 20 | .is.the.fast.test.for.primality. |
| 80ae0 | 74 68 61 74 20 77 65 0a 64 69 73 63 75 73 73 65 64 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 | that.we.discussed.in.*Note.Chapt |
| 80b00 | 65 72 20 31 3a 3a 2e 20 20 5a 69 70 70 65 6c 27 73 20 62 6f 6f 6b 20 28 31 39 39 33 29 20 64 65 | er.1::...Zippel's.book.(1993).de |
| 80b20 | 73 63 72 69 62 65 73 20 74 68 69 73 0a 6d 65 74 68 6f 64 2c 20 74 6f 67 65 74 68 65 72 20 77 69 | scribes.this.method,.together.wi |
| 80b40 | 74 68 20 6f 74 68 65 72 20 77 61 79 73 20 74 6f 20 63 6f 6d 70 75 74 65 20 70 6f 6c 79 6e 6f 6d | th.other.ways.to.compute.polynom |
| 80b60 | 69 61 6c 20 47 43 44 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e | ial.GCDs.....File:.sicp.info,..N |
| 80b80 | 6f 64 65 3a 20 43 68 61 70 74 65 72 20 33 2c 20 20 4e 65 78 74 3a 20 43 68 61 70 74 65 72 20 34 | ode:.Chapter.3,..Next:.Chapter.4 |
| 80ba0 | 2c 20 20 50 72 65 76 3a 20 43 68 61 70 74 65 72 20 32 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 33 20 | ,..Prev:.Chapter.2,..Up:.Top..3. |
| 80bc0 | 4d 6f 64 75 6c 61 72 69 74 79 2c 20 4f 62 6a 65 63 74 73 2c 20 61 6e 64 20 53 74 61 74 65 0a 2a | Modularity,.Objects,.and.State.* |
| 80be0 | 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a | *******************************. |
| 80c00 | 0a 20 20 20 20 20 5b 67 72 65 65 6b 20 6e 6f 74 20 69 6e 63 6c 75 64 65 64 20 68 65 72 65 5d 0a | ......[greek.not.included.here]. |
| 80c20 | 0a 20 20 20 20 20 28 45 76 65 6e 20 77 68 69 6c 65 20 69 74 20 63 68 61 6e 67 65 73 2c 20 69 74 | ......(Even.while.it.changes,.it |
| 80c40 | 20 73 74 61 6e 64 73 20 73 74 69 6c 6c 2e 29 0a 0a 20 20 20 20 20 2d 2d 48 65 72 61 63 6c 69 74 | .stands.still.).......--Heraclit |
| 80c60 | 75 73 0a 0a 20 20 20 20 20 50 6c 75 73 20 63 2c 61 20 63 68 61 6e 67 65 2c 20 70 6c 75 73 20 63 | us.......Plus.c,a.change,.plus.c |
| 80c80 | 27 65 73 74 20 6c 61 20 6d 65 2a 6d 65 20 63 68 6f 73 65 2e 0a 0a 20 20 20 20 20 2d 2d 41 6c 70 | 'est.la.me*me.chose........--Alp |
| 80ca0 | 68 6f 6e 73 65 20 4b 61 72 72 0a 0a 20 20 20 54 68 65 20 70 72 65 63 65 64 69 6e 67 20 63 68 61 | honse.Karr.....The.preceding.cha |
| 80cc0 | 70 74 65 72 73 20 69 6e 74 72 6f 64 75 63 65 64 20 74 68 65 20 62 61 73 69 63 20 65 6c 65 6d 65 | pters.introduced.the.basic.eleme |
| 80ce0 | 6e 74 73 20 66 72 6f 6d 20 77 68 69 63 68 0a 70 72 6f 67 72 61 6d 73 20 61 72 65 20 6d 61 64 65 | nts.from.which.programs.are.made |
| 80d00 | 2e 20 20 57 65 20 73 61 77 20 68 6f 77 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 | ...We.saw.how.primitive.procedur |
| 80d20 | 65 73 20 61 6e 64 20 70 72 69 6d 69 74 69 76 65 20 64 61 74 61 0a 61 72 65 20 63 6f 6d 62 69 6e | es.and.primitive.data.are.combin |
| 80d40 | 65 64 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 63 6f 6d 70 6f 75 6e 64 20 65 6e 74 69 74 69 65 | ed.to.construct.compound.entitie |
| 80d60 | 73 2c 20 61 6e 64 20 77 65 20 6c 65 61 72 6e 65 64 20 74 68 61 74 0a 61 62 73 74 72 61 63 74 69 | s,.and.we.learned.that.abstracti |
| 80d80 | 6f 6e 20 69 73 20 76 69 74 61 6c 20 69 6e 20 68 65 6c 70 69 6e 67 20 75 73 20 74 6f 20 63 6f 70 | on.is.vital.in.helping.us.to.cop |
| 80da0 | 65 20 77 69 74 68 20 74 68 65 20 63 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 6c 61 72 67 65 0a 73 | e.with.the.complexity.of.large.s |
| 80dc0 | 79 73 74 65 6d 73 2e 20 20 42 75 74 20 74 68 65 73 65 20 74 6f 6f 6c 73 20 61 72 65 20 6e 6f 74 | ystems...But.these.tools.are.not |
| 80de0 | 20 73 75 66 66 69 63 69 65 6e 74 20 66 6f 72 20 64 65 73 69 67 6e 69 6e 67 20 70 72 6f 67 72 61 | .sufficient.for.designing.progra |
| 80e00 | 6d 73 2e 0a 45 66 66 65 63 74 69 76 65 20 70 72 6f 67 72 61 6d 20 73 79 6e 74 68 65 73 69 73 20 | ms..Effective.program.synthesis. |
| 80e20 | 61 6c 73 6f 20 72 65 71 75 69 72 65 73 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 61 6c 20 70 72 69 | also.requires.organizational.pri |
| 80e40 | 6e 63 69 70 6c 65 73 0a 74 68 61 74 20 63 61 6e 20 67 75 69 64 65 20 75 73 20 69 6e 20 66 6f 72 | nciples.that.can.guide.us.in.for |
| 80e60 | 6d 75 6c 61 74 69 6e 67 20 74 68 65 20 6f 76 65 72 61 6c 6c 20 64 65 73 69 67 6e 20 6f 66 20 61 | mulating.the.overall.design.of.a |
| 80e80 | 20 70 72 6f 67 72 61 6d 2e 20 20 49 6e 0a 70 61 72 74 69 63 75 6c 61 72 2c 20 77 65 20 6e 65 65 | .program...In.particular,.we.nee |
| 80ea0 | 64 20 73 74 72 61 74 65 67 69 65 73 20 74 6f 20 68 65 6c 70 20 75 73 20 73 74 72 75 63 74 75 72 | d.strategies.to.help.us.structur |
| 80ec0 | 65 20 6c 61 72 67 65 20 73 79 73 74 65 6d 73 20 73 6f 0a 74 68 61 74 20 74 68 65 79 20 77 69 6c | e.large.systems.so.that.they.wil |
| 80ee0 | 6c 20 62 65 20 22 6d 6f 64 75 6c 61 72 22 2c 20 74 68 61 74 20 69 73 2c 20 73 6f 20 74 68 61 74 | l.be."modular",.that.is,.so.that |
| 80f00 | 20 74 68 65 79 20 63 61 6e 20 62 65 20 64 69 76 69 64 65 64 0a 22 6e 61 74 75 72 61 6c 6c 79 22 | .they.can.be.divided."naturally" |
| 80f20 | 20 69 6e 74 6f 20 63 6f 68 65 72 65 6e 74 20 70 61 72 74 73 20 74 68 61 74 20 63 61 6e 20 62 65 | .into.coherent.parts.that.can.be |
| 80f40 | 20 73 65 70 61 72 61 74 65 6c 79 20 64 65 76 65 6c 6f 70 65 64 20 61 6e 64 0a 6d 61 69 6e 74 61 | .separately.developed.and.mainta |
| 80f60 | 69 6e 65 64 2e 0a 0a 20 20 20 4f 6e 65 20 70 6f 77 65 72 66 75 6c 20 64 65 73 69 67 6e 20 73 74 | ined......One.powerful.design.st |
| 80f80 | 72 61 74 65 67 79 2c 20 77 68 69 63 68 20 69 73 20 70 61 72 74 69 63 75 6c 61 72 6c 79 20 61 70 | rategy,.which.is.particularly.ap |
| 80fa0 | 70 72 6f 70 72 69 61 74 65 20 74 6f 0a 74 68 65 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 6f 66 | propriate.to.the.construction.of |
| 80fc0 | 20 70 72 6f 67 72 61 6d 73 20 66 6f 72 20 6d 6f 64 65 6c 69 6e 67 20 70 68 79 73 69 63 61 6c 20 | .programs.for.modeling.physical. |
| 80fe0 | 73 79 73 74 65 6d 73 2c 20 69 73 20 74 6f 20 62 61 73 65 0a 74 68 65 20 73 74 72 75 63 74 75 72 | systems,.is.to.base.the.structur |
| 81000 | 65 20 6f 66 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 6f 6e 20 74 68 65 20 73 74 72 75 63 74 75 | e.of.our.programs.on.the.structu |
| 81020 | 72 65 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 20 62 65 69 6e 67 0a 6d 6f 64 65 6c 65 64 2e 20 | re.of.the.system.being.modeled.. |
| 81040 | 20 46 6f 72 20 65 61 63 68 20 6f 62 6a 65 63 74 20 69 6e 20 74 68 65 20 73 79 73 74 65 6d 2c 20 | .For.each.object.in.the.system,. |
| 81060 | 77 65 20 63 6f 6e 73 74 72 75 63 74 20 61 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 0a 63 6f 6d | we.construct.a.corresponding.com |
| 81080 | 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 2e 20 20 46 6f 72 20 65 61 63 68 20 73 79 73 | putational.object...For.each.sys |
| 810a0 | 74 65 6d 20 61 63 74 69 6f 6e 2c 20 77 65 20 64 65 66 69 6e 65 20 61 20 73 79 6d 62 6f 6c 69 63 | tem.action,.we.define.a.symbolic |
| 810c0 | 0a 6f 70 65 72 61 74 69 6f 6e 20 69 6e 20 6f 75 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 | .operation.in.our.computational. |
| 810e0 | 6d 6f 64 65 6c 2e 20 20 4f 75 72 20 68 6f 70 65 20 69 6e 20 75 73 69 6e 67 20 74 68 69 73 20 73 | model...Our.hope.in.using.this.s |
| 81100 | 74 72 61 74 65 67 79 0a 69 73 20 74 68 61 74 20 65 78 74 65 6e 64 69 6e 67 20 74 68 65 20 6d 6f | trategy.is.that.extending.the.mo |
| 81120 | 64 65 6c 20 74 6f 20 61 63 63 6f 6d 6d 6f 64 61 74 65 20 6e 65 77 20 6f 62 6a 65 63 74 73 20 6f | del.to.accommodate.new.objects.o |
| 81140 | 72 20 6e 65 77 20 61 63 74 69 6f 6e 73 0a 77 69 6c 6c 20 72 65 71 75 69 72 65 20 6e 6f 20 73 74 | r.new.actions.will.require.no.st |
| 81160 | 72 61 74 65 67 69 63 20 63 68 61 6e 67 65 73 20 74 6f 20 74 68 65 20 70 72 6f 67 72 61 6d 2c 20 | rategic.changes.to.the.program,. |
| 81180 | 6f 6e 6c 79 20 74 68 65 20 61 64 64 69 74 69 6f 6e 20 6f 66 0a 74 68 65 20 6e 65 77 20 73 79 6d | only.the.addition.of.the.new.sym |
| 811a0 | 62 6f 6c 69 63 20 61 6e 61 6c 6f 67 73 20 6f 66 20 74 68 6f 73 65 20 6f 62 6a 65 63 74 73 20 6f | bolic.analogs.of.those.objects.o |
| 811c0 | 72 20 61 63 74 69 6f 6e 73 2e 20 20 49 66 20 77 65 20 68 61 76 65 20 62 65 65 6e 0a 73 75 63 63 | r.actions...If.we.have.been.succ |
| 811e0 | 65 73 73 66 75 6c 20 69 6e 20 6f 75 72 20 73 79 73 74 65 6d 20 6f 72 67 61 6e 69 7a 61 74 69 6f | essful.in.our.system.organizatio |
| 81200 | 6e 2c 20 74 68 65 6e 20 74 6f 20 61 64 64 20 61 20 6e 65 77 20 66 65 61 74 75 72 65 20 6f 72 0a | n,.then.to.add.a.new.feature.or. |
| 81220 | 64 65 62 75 67 20 61 6e 20 6f 6c 64 20 6f 6e 65 20 77 65 20 77 69 6c 6c 20 68 61 76 65 20 74 6f | debug.an.old.one.we.will.have.to |
| 81240 | 20 77 6f 72 6b 20 6f 6e 20 6f 6e 6c 79 20 61 20 6c 6f 63 61 6c 69 7a 65 64 20 70 61 72 74 20 6f | .work.on.only.a.localized.part.o |
| 81260 | 66 20 74 68 65 0a 73 79 73 74 65 6d 2e 0a 0a 20 20 20 54 6f 20 61 20 6c 61 72 67 65 20 65 78 74 | f.the.system......To.a.large.ext |
| 81280 | 65 6e 74 2c 20 74 68 65 6e 2c 20 74 68 65 20 77 61 79 20 77 65 20 6f 72 67 61 6e 69 7a 65 20 61 | ent,.then,.the.way.we.organize.a |
| 812a0 | 20 6c 61 72 67 65 20 70 72 6f 67 72 61 6d 20 69 73 0a 64 69 63 74 61 74 65 64 20 62 79 20 6f 75 | .large.program.is.dictated.by.ou |
| 812c0 | 72 20 70 65 72 63 65 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 20 74 6f 20 62 65 | r.perception.of.the.system.to.be |
| 812e0 | 20 6d 6f 64 65 6c 65 64 2e 20 20 49 6e 20 74 68 69 73 0a 63 68 61 70 74 65 72 20 77 65 20 77 69 | .modeled...In.this.chapter.we.wi |
| 81300 | 6c 6c 20 69 6e 76 65 73 74 69 67 61 74 65 20 74 77 6f 20 70 72 6f 6d 69 6e 65 6e 74 20 6f 72 67 | ll.investigate.two.prominent.org |
| 81320 | 61 6e 69 7a 61 74 69 6f 6e 61 6c 20 73 74 72 61 74 65 67 69 65 73 0a 61 72 69 73 69 6e 67 20 66 | anizational.strategies.arising.f |
| 81340 | 72 6f 6d 20 74 77 6f 20 72 61 74 68 65 72 20 64 69 66 66 65 72 65 6e 74 20 22 77 6f 72 6c 64 20 | rom.two.rather.different."world. |
| 81360 | 76 69 65 77 73 22 20 6f 66 20 74 68 65 20 73 74 72 75 63 74 75 72 65 20 6f 66 0a 73 79 73 74 65 | views".of.the.structure.of.syste |
| 81380 | 6d 73 2e 20 20 54 68 65 20 66 69 72 73 74 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 61 6c 20 73 74 | ms...The.first.organizational.st |
| 813a0 | 72 61 74 65 67 79 20 63 6f 6e 63 65 6e 74 72 61 74 65 73 20 6f 6e 20 22 6f 62 6a 65 63 74 73 22 | rategy.concentrates.on."objects" |
| 813c0 | 2c 0a 76 69 65 77 69 6e 67 20 61 20 6c 61 72 67 65 20 73 79 73 74 65 6d 20 61 73 20 61 20 63 6f | ,.viewing.a.large.system.as.a.co |
| 813e0 | 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 64 69 73 74 69 6e 63 74 20 6f 62 6a 65 63 74 73 20 77 68 6f | llection.of.distinct.objects.who |
| 81400 | 73 65 0a 62 65 68 61 76 69 6f 72 73 20 6d 61 79 20 63 68 61 6e 67 65 20 6f 76 65 72 20 74 69 6d | se.behaviors.may.change.over.tim |
| 81420 | 65 2e 20 20 41 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 61 | e...An.alternative.organizationa |
| 81440 | 6c 20 73 74 72 61 74 65 67 79 0a 63 6f 6e 63 65 6e 74 72 61 74 65 73 20 6f 6e 20 74 68 65 20 22 | l.strategy.concentrates.on.the." |
| 81460 | 73 74 72 65 61 6d 73 22 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 74 68 61 74 20 66 6c 6f | streams".of.information.that.flo |
| 81480 | 77 20 69 6e 20 74 68 65 20 73 79 73 74 65 6d 2c 0a 6d 75 63 68 20 61 73 20 61 6e 20 65 6c 65 63 | w.in.the.system,.much.as.an.elec |
| 814a0 | 74 72 69 63 61 6c 20 65 6e 67 69 6e 65 65 72 20 76 69 65 77 73 20 61 20 73 69 67 6e 61 6c 2d 70 | trical.engineer.views.a.signal-p |
| 814c0 | 72 6f 63 65 73 73 69 6e 67 20 73 79 73 74 65 6d 2e 0a 0a 20 20 20 42 6f 74 68 20 74 68 65 20 6f | rocessing.system......Both.the.o |
| 814e0 | 62 6a 65 63 74 2d 62 61 73 65 64 20 61 70 70 72 6f 61 63 68 20 61 6e 64 20 74 68 65 20 73 74 72 | bject-based.approach.and.the.str |
| 81500 | 65 61 6d 2d 70 72 6f 63 65 73 73 69 6e 67 20 61 70 70 72 6f 61 63 68 0a 72 61 69 73 65 20 73 69 | eam-processing.approach.raise.si |
| 81520 | 67 6e 69 66 69 63 61 6e 74 20 6c 69 6e 67 75 69 73 74 69 63 20 69 73 73 75 65 73 20 69 6e 20 70 | gnificant.linguistic.issues.in.p |
| 81540 | 72 6f 67 72 61 6d 6d 69 6e 67 2e 20 20 57 69 74 68 20 6f 62 6a 65 63 74 73 2c 20 77 65 0a 6d 75 | rogramming...With.objects,.we.mu |
| 81560 | 73 74 20 62 65 20 63 6f 6e 63 65 72 6e 65 64 20 77 69 74 68 20 68 6f 77 20 61 20 63 6f 6d 70 75 | st.be.concerned.with.how.a.compu |
| 81580 | 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 20 63 61 6e 20 63 68 61 6e 67 65 20 61 6e 64 20 79 | tational.object.can.change.and.y |
| 815a0 | 65 74 0a 6d 61 69 6e 74 61 69 6e 20 69 74 73 20 69 64 65 6e 74 69 74 79 2e 20 20 54 68 69 73 20 | et.maintain.its.identity...This. |
| 815c0 | 77 69 6c 6c 20 66 6f 72 63 65 20 75 73 20 74 6f 20 61 62 61 6e 64 6f 6e 20 6f 75 72 20 6f 6c 64 | will.force.us.to.abandon.our.old |
| 815e0 | 0a 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 | .substitution.model.of.computati |
| 81600 | 6f 6e 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 35 3a 3a 29 20 69 6e 20 66 61 | on.(section.*Note.1-1-5::).in.fa |
| 81620 | 76 6f 72 20 6f 66 20 61 0a 6d 6f 72 65 20 6d 65 63 68 61 6e 69 73 74 69 63 20 62 75 74 20 6c 65 | vor.of.a.more.mechanistic.but.le |
| 81640 | 73 73 20 74 68 65 6f 72 65 74 69 63 61 6c 6c 79 20 74 72 61 63 74 61 62 6c 65 20 22 65 6e 76 69 | ss.theoretically.tractable."envi |
| 81660 | 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 22 0a 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 | ronment.model".of.computation... |
| 81680 | 54 68 65 20 64 69 66 66 69 63 75 6c 74 69 65 73 20 6f 66 20 64 65 61 6c 69 6e 67 20 77 69 74 68 | The.difficulties.of.dealing.with |
| 816a0 | 20 6f 62 6a 65 63 74 73 2c 20 63 68 61 6e 67 65 2c 20 61 6e 64 0a 69 64 65 6e 74 69 74 79 20 61 | .objects,.change,.and.identity.a |
| 816c0 | 72 65 20 61 20 66 75 6e 64 61 6d 65 6e 74 61 6c 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 6f 66 20 | re.a.fundamental.consequence.of. |
| 816e0 | 74 68 65 20 6e 65 65 64 20 74 6f 20 67 72 61 70 70 6c 65 20 77 69 74 68 20 74 69 6d 65 0a 69 6e | the.need.to.grapple.with.time.in |
| 81700 | 20 6f 75 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 2e 20 20 54 68 65 73 | .our.computational.models...Thes |
| 81720 | 65 20 64 69 66 66 69 63 75 6c 74 69 65 73 20 62 65 63 6f 6d 65 20 65 76 65 6e 20 67 72 65 61 74 | e.difficulties.become.even.great |
| 81740 | 65 72 0a 77 68 65 6e 20 77 65 20 61 6c 6c 6f 77 20 74 68 65 20 70 6f 73 73 69 62 69 6c 69 74 79 | er.when.we.allow.the.possibility |
| 81760 | 20 6f 66 20 63 6f 6e 63 75 72 72 65 6e 74 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 70 72 6f 67 | .of.concurrent.execution.of.prog |
| 81780 | 72 61 6d 73 2e 20 20 54 68 65 0a 73 74 72 65 61 6d 20 61 70 70 72 6f 61 63 68 20 63 61 6e 20 62 | rams...The.stream.approach.can.b |
| 817a0 | 65 20 6d 6f 73 74 20 66 75 6c 6c 79 20 65 78 70 6c 6f 69 74 65 64 20 77 68 65 6e 20 77 65 20 64 | e.most.fully.exploited.when.we.d |
| 817c0 | 65 63 6f 75 70 6c 65 20 73 69 6d 75 6c 61 74 65 64 0a 74 69 6d 65 20 69 6e 20 6f 75 72 20 6d 6f | ecouple.simulated.time.in.our.mo |
| 817e0 | 64 65 6c 20 66 72 6f 6d 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 65 76 65 6e 74 73 | del.from.the.order.of.the.events |
| 81800 | 20 74 68 61 74 20 74 61 6b 65 20 70 6c 61 63 65 20 69 6e 20 74 68 65 0a 63 6f 6d 70 75 74 65 72 | .that.take.place.in.the.computer |
| 81820 | 20 64 75 72 69 6e 67 20 65 76 61 6c 75 61 74 69 6f 6e 2e 20 20 57 65 20 77 69 6c 6c 20 61 63 63 | .during.evaluation...We.will.acc |
| 81840 | 6f 6d 70 6c 69 73 68 20 74 68 69 73 20 75 73 69 6e 67 20 61 20 74 65 63 68 6e 69 71 75 65 0a 6b | omplish.this.using.a.technique.k |
| 81860 | 6e 6f 77 6e 20 61 73 20 22 64 65 6c 61 79 65 64 20 65 76 61 6c 75 61 74 69 6f 6e 22 2e 0a 0a 2a | nown.as."delayed.evaluation"...* |
| 81880 | 20 4d 65 6e 75 3a 0a 0a 2a 20 33 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 41 73 73 | .Menu:..*.3-1::..............Ass |
| 818a0 | 69 67 6e 6d 65 6e 74 20 61 6e 64 20 4c 6f 63 61 6c 20 53 74 61 74 65 0a 2a 20 33 2d 32 3a 3a 20 | ignment.and.Local.State.*.3-2::. |
| 818c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 4d 6f 64 | .............The.Environment.Mod |
| 818e0 | 65 6c 20 6f 66 20 45 76 61 6c 75 61 74 69 6f 6e 0a 2a 20 33 2d 33 3a 3a 20 20 20 20 20 20 20 20 | el.of.Evaluation.*.3-3::........ |
| 81900 | 20 20 20 20 20 20 4d 6f 64 65 6c 69 6e 67 20 77 69 74 68 20 4d 75 74 61 62 6c 65 20 44 61 74 61 | ......Modeling.with.Mutable.Data |
| 81920 | 0a 2a 20 33 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6e 63 75 72 72 65 6e 63 | .*.3-4::..............Concurrenc |
| 81940 | 79 3a 20 54 69 6d 65 20 49 73 20 6f 66 20 74 68 65 20 45 73 73 65 6e 63 65 0a 2a 20 33 2d 35 3a | y:.Time.Is.of.the.Essence.*.3-5: |
| 81960 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 74 72 65 61 6d 73 0a 0a 1f 0a 46 69 6c 65 3a 20 | :..............Streams....File:. |
| 81980 | 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 31 2c 20 20 4e 65 78 74 3a 20 33 2d | sicp.info,..Node:.3-1,..Next:.3- |
| 819a0 | 32 2c 20 20 50 72 65 76 3a 20 43 68 61 70 74 65 72 20 33 2c 20 20 55 70 3a 20 43 68 61 70 74 65 | 2,..Prev:.Chapter.3,..Up:.Chapte |
| 819c0 | 72 20 33 0a 0a 33 2e 31 20 41 73 73 69 67 6e 6d 65 6e 74 20 61 6e 64 20 4c 6f 63 61 6c 20 53 74 | r.3..3.1.Assignment.and.Local.St |
| 819e0 | 61 74 65 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ate.============================ |
| 81a00 | 3d 3d 0a 0a 57 65 20 6f 72 64 69 6e 61 72 69 6c 79 20 76 69 65 77 20 74 68 65 20 77 6f 72 6c 64 | ==..We.ordinarily.view.the.world |
| 81a20 | 20 61 73 20 70 6f 70 75 6c 61 74 65 64 20 62 79 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 62 6a | .as.populated.by.independent.obj |
| 81a40 | 65 63 74 73 2c 20 65 61 63 68 0a 6f 66 20 77 68 69 63 68 20 68 61 73 20 61 20 73 74 61 74 65 20 | ects,.each.of.which.has.a.state. |
| 81a60 | 74 68 61 74 20 63 68 61 6e 67 65 73 20 6f 76 65 72 20 74 69 6d 65 2e 20 20 41 6e 20 6f 62 6a 65 | that.changes.over.time...An.obje |
| 81a80 | 63 74 20 69 73 20 73 61 69 64 20 74 6f 0a 22 68 61 76 65 20 73 74 61 74 65 22 20 69 66 20 69 74 | ct.is.said.to."have.state".if.it |
| 81aa0 | 73 20 62 65 68 61 76 69 6f 72 20 69 73 20 69 6e 66 6c 75 65 6e 63 65 64 20 62 79 20 69 74 73 20 | s.behavior.is.influenced.by.its. |
| 81ac0 | 68 69 73 74 6f 72 79 2e 20 20 41 20 62 61 6e 6b 0a 61 63 63 6f 75 6e 74 2c 20 66 6f 72 20 65 78 | history...A.bank.account,.for.ex |
| 81ae0 | 61 6d 70 6c 65 2c 20 68 61 73 20 73 74 61 74 65 20 69 6e 20 74 68 61 74 20 74 68 65 20 61 6e 73 | ample,.has.state.in.that.the.ans |
| 81b00 | 77 65 72 20 74 6f 20 74 68 65 20 71 75 65 73 74 69 6f 6e 20 22 43 61 6e 0a 49 20 77 69 74 68 64 | wer.to.the.question."Can.I.withd |
| 81b20 | 72 61 77 20 24 31 30 30 3f 22 20 20 64 65 70 65 6e 64 73 20 75 70 6f 6e 20 74 68 65 20 68 69 73 | raw.$100?"..depends.upon.the.his |
| 81b40 | 74 6f 72 79 20 6f 66 20 64 65 70 6f 73 69 74 20 61 6e 64 20 77 69 74 68 64 72 61 77 61 6c 0a 74 | tory.of.deposit.and.withdrawal.t |
| 81b60 | 72 61 6e 73 61 63 74 69 6f 6e 73 2e 20 20 57 65 20 63 61 6e 20 63 68 61 72 61 63 74 65 72 69 7a | ransactions...We.can.characteriz |
| 81b80 | 65 20 61 6e 20 6f 62 6a 65 63 74 27 73 20 73 74 61 74 65 20 62 79 20 6f 6e 65 20 6f 72 20 6d 6f | e.an.object's.state.by.one.or.mo |
| 81ba0 | 72 65 20 22 73 74 61 74 65 0a 76 61 72 69 61 62 6c 65 73 22 2c 20 77 68 69 63 68 20 61 6d 6f 6e | re."state.variables",.which.amon |
| 81bc0 | 67 20 74 68 65 6d 20 6d 61 69 6e 74 61 69 6e 20 65 6e 6f 75 67 68 20 69 6e 66 6f 72 6d 61 74 69 | g.them.maintain.enough.informati |
| 81be0 | 6f 6e 20 61 62 6f 75 74 20 68 69 73 74 6f 72 79 0a 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 | on.about.history.to.determine.th |
| 81c00 | 65 20 6f 62 6a 65 63 74 27 73 20 63 75 72 72 65 6e 74 20 62 65 68 61 76 69 6f 72 2e 20 20 49 6e | e.object's.current.behavior...In |
| 81c20 | 20 61 20 73 69 6d 70 6c 65 20 62 61 6e 6b 69 6e 67 0a 73 79 73 74 65 6d 2c 20 77 65 20 63 6f 75 | .a.simple.banking.system,.we.cou |
| 81c40 | 6c 64 20 63 68 61 72 61 63 74 65 72 69 7a 65 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 61 6e 20 | ld.characterize.the.state.of.an. |
| 81c60 | 61 63 63 6f 75 6e 74 20 62 79 20 61 20 63 75 72 72 65 6e 74 0a 62 61 6c 61 6e 63 65 20 72 61 74 | account.by.a.current.balance.rat |
| 81c80 | 68 65 72 20 74 68 61 6e 20 62 79 20 72 65 6d 65 6d 62 65 72 69 6e 67 20 74 68 65 20 65 6e 74 69 | her.than.by.remembering.the.enti |
| 81ca0 | 72 65 20 68 69 73 74 6f 72 79 20 6f 66 20 61 63 63 6f 75 6e 74 0a 74 72 61 6e 73 61 63 74 69 6f | re.history.of.account.transactio |
| 81cc0 | 6e 73 2e 0a 0a 20 20 20 49 6e 20 61 20 73 79 73 74 65 6d 20 63 6f 6d 70 6f 73 65 64 20 6f 66 20 | ns......In.a.system.composed.of. |
| 81ce0 | 6d 61 6e 79 20 6f 62 6a 65 63 74 73 2c 20 74 68 65 20 6f 62 6a 65 63 74 73 20 61 72 65 20 72 61 | many.objects,.the.objects.are.ra |
| 81d00 | 72 65 6c 79 0a 63 6f 6d 70 6c 65 74 65 6c 79 20 69 6e 64 65 70 65 6e 64 65 6e 74 2e 20 20 45 61 | rely.completely.independent...Ea |
| 81d20 | 63 68 20 6d 61 79 20 69 6e 66 6c 75 65 6e 63 65 20 74 68 65 20 73 74 61 74 65 73 20 6f 66 20 6f | ch.may.influence.the.states.of.o |
| 81d40 | 74 68 65 72 73 0a 74 68 72 6f 75 67 68 20 69 6e 74 65 72 61 63 74 69 6f 6e 73 2c 20 77 68 69 63 | thers.through.interactions,.whic |
| 81d60 | 68 20 73 65 72 76 65 20 74 6f 20 63 6f 75 70 6c 65 20 74 68 65 20 73 74 61 74 65 20 76 61 72 69 | h.serve.to.couple.the.state.vari |
| 81d80 | 61 62 6c 65 73 20 6f 66 20 6f 6e 65 0a 6f 62 6a 65 63 74 20 74 6f 20 74 68 6f 73 65 20 6f 66 20 | ables.of.one.object.to.those.of. |
| 81da0 | 6f 74 68 65 72 20 6f 62 6a 65 63 74 73 2e 20 20 49 6e 64 65 65 64 2c 20 74 68 65 20 76 69 65 77 | other.objects...Indeed,.the.view |
| 81dc0 | 20 74 68 61 74 20 61 20 73 79 73 74 65 6d 20 69 73 0a 63 6f 6d 70 6f 73 65 64 20 6f 66 20 73 65 | .that.a.system.is.composed.of.se |
| 81de0 | 70 61 72 61 74 65 20 6f 62 6a 65 63 74 73 20 69 73 20 6d 6f 73 74 20 75 73 65 66 75 6c 20 77 68 | parate.objects.is.most.useful.wh |
| 81e00 | 65 6e 20 74 68 65 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 20 6f 66 0a 74 68 65 20 73 79 | en.the.state.variables.of.the.sy |
| 81e20 | 73 74 65 6d 20 63 61 6e 20 62 65 20 67 72 6f 75 70 65 64 20 69 6e 74 6f 20 63 6c 6f 73 65 6c 79 | stem.can.be.grouped.into.closely |
| 81e40 | 20 63 6f 75 70 6c 65 64 20 73 75 62 73 79 73 74 65 6d 73 20 74 68 61 74 20 61 72 65 20 6f 6e 6c | .coupled.subsystems.that.are.onl |
| 81e60 | 79 0a 6c 6f 6f 73 65 6c 79 20 63 6f 75 70 6c 65 64 20 74 6f 20 6f 74 68 65 72 20 73 75 62 73 79 | y.loosely.coupled.to.other.subsy |
| 81e80 | 73 74 65 6d 73 2e 0a 0a 20 20 20 54 68 69 73 20 76 69 65 77 20 6f 66 20 61 20 73 79 73 74 65 6d | stems......This.view.of.a.system |
| 81ea0 | 20 63 61 6e 20 62 65 20 61 20 70 6f 77 65 72 66 75 6c 20 66 72 61 6d 65 77 6f 72 6b 20 66 6f 72 | .can.be.a.powerful.framework.for |
| 81ec0 | 20 6f 72 67 61 6e 69 7a 69 6e 67 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 | .organizing.computational.models |
| 81ee0 | 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 2e 20 20 46 6f 72 20 73 75 63 68 20 61 20 6d 6f 64 65 | .of.the.system...For.such.a.mode |
| 81f00 | 6c 20 74 6f 20 62 65 20 6d 6f 64 75 6c 61 72 2c 20 69 74 0a 73 68 6f 75 6c 64 20 62 65 20 64 65 | l.to.be.modular,.it.should.be.de |
| 81f20 | 63 6f 6d 70 6f 73 65 64 20 69 6e 74 6f 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 | composed.into.computational.obje |
| 81f40 | 63 74 73 20 74 68 61 74 20 6d 6f 64 65 6c 20 74 68 65 20 61 63 74 75 61 6c 0a 6f 62 6a 65 63 74 | cts.that.model.the.actual.object |
| 81f60 | 73 20 69 6e 20 74 68 65 20 73 79 73 74 65 6d 2e 20 20 45 61 63 68 20 63 6f 6d 70 75 74 61 74 69 | s.in.the.system...Each.computati |
| 81f80 | 6f 6e 61 6c 20 6f 62 6a 65 63 74 20 6d 75 73 74 20 68 61 76 65 20 69 74 73 20 6f 77 6e 20 22 6c | onal.object.must.have.its.own."l |
| 81fa0 | 6f 63 61 6c 0a 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 22 20 64 65 73 63 72 69 62 69 6e 67 | ocal.state.variables".describing |
| 81fc0 | 20 74 68 65 20 61 63 74 75 61 6c 20 6f 62 6a 65 63 74 27 73 20 73 74 61 74 65 2e 20 20 53 69 6e | .the.actual.object's.state...Sin |
| 81fe0 | 63 65 20 74 68 65 0a 73 74 61 74 65 73 20 6f 66 20 6f 62 6a 65 63 74 73 20 69 6e 20 74 68 65 20 | ce.the.states.of.objects.in.the. |
| 82000 | 73 79 73 74 65 6d 20 62 65 69 6e 67 20 6d 6f 64 65 6c 65 64 20 63 68 61 6e 67 65 20 6f 76 65 72 | system.being.modeled.change.over |
| 82020 | 20 74 69 6d 65 2c 20 74 68 65 0a 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 20 6f 66 20 74 68 | .time,.the.state.variables.of.th |
| 82040 | 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 | e.corresponding.computational.ob |
| 82060 | 6a 65 63 74 73 20 6d 75 73 74 20 61 6c 73 6f 0a 63 68 61 6e 67 65 2e 20 20 49 66 20 77 65 20 63 | jects.must.also.change...If.we.c |
| 82080 | 68 6f 6f 73 65 20 74 6f 20 6d 6f 64 65 6c 20 74 68 65 20 66 6c 6f 77 20 6f 66 20 74 69 6d 65 20 | hoose.to.model.the.flow.of.time. |
| 820a0 | 69 6e 20 74 68 65 20 73 79 73 74 65 6d 20 62 79 20 74 68 65 0a 65 6c 61 70 73 65 64 20 74 69 6d | in.the.system.by.the.elapsed.tim |
| 820c0 | 65 20 69 6e 20 74 68 65 20 63 6f 6d 70 75 74 65 72 2c 20 74 68 65 6e 20 77 65 20 6d 75 73 74 20 | e.in.the.computer,.then.we.must. |
| 820e0 | 68 61 76 65 20 61 20 77 61 79 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 0a 63 6f 6d 70 75 74 61 74 | have.a.way.to.construct.computat |
| 82100 | 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 20 77 68 6f 73 65 20 62 65 68 61 76 69 6f 72 73 20 63 68 | ional.objects.whose.behaviors.ch |
| 82120 | 61 6e 67 65 20 61 73 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 72 75 6e 2e 20 20 49 6e 0a 70 61 | ange.as.our.programs.run...In.pa |
| 82140 | 72 74 69 63 75 6c 61 72 2c 20 69 66 20 77 65 20 77 69 73 68 20 74 6f 20 6d 6f 64 65 6c 20 73 74 | rticular,.if.we.wish.to.model.st |
| 82160 | 61 74 65 20 76 61 72 69 61 62 6c 65 73 20 62 79 20 6f 72 64 69 6e 61 72 79 20 73 79 6d 62 6f 6c | ate.variables.by.ordinary.symbol |
| 82180 | 69 63 0a 6e 61 6d 65 73 20 69 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 | ic.names.in.the.programming.lang |
| 821a0 | 75 61 67 65 2c 20 74 68 65 6e 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 6d 75 73 74 20 70 72 6f | uage,.then.the.language.must.pro |
| 821c0 | 76 69 64 65 20 61 6e 20 6f 70 65 72 61 74 6f 72 0a 22 61 73 73 69 67 6e 6d 65 6e 74 20 6f 70 65 | vide.an.operator."assignment.ope |
| 821e0 | 72 61 74 6f 72 22 20 74 6f 20 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 63 68 61 6e 67 65 20 74 68 | rator".to.enable.us.to.change.th |
| 82200 | 65 20 76 61 6c 75 65 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 0a 61 20 6e 61 6d 65 2e 0a | e.value.associated.with.a.name.. |
| 82220 | 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 33 2d 31 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4c | .*.Menu:..*.3-1-1::............L |
| 82240 | 6f 63 61 6c 20 53 74 61 74 65 20 56 61 72 69 61 62 6c 65 73 0a 2a 20 33 2d 31 2d 32 3a 3a 20 20 | ocal.State.Variables.*.3-1-2::.. |
| 82260 | 20 20 20 20 20 20 20 20 20 20 54 68 65 20 42 65 6e 65 66 69 74 73 20 6f 66 20 49 6e 74 72 6f 64 | ..........The.Benefits.of.Introd |
| 82280 | 75 63 69 6e 67 20 41 73 73 69 67 6e 6d 65 6e 74 0a 2a 20 33 2d 31 2d 33 3a 3a 20 20 20 20 20 20 | ucing.Assignment.*.3-1-3::...... |
| 822a0 | 20 20 20 20 20 20 54 68 65 20 43 6f 73 74 73 20 6f 66 20 49 6e 74 72 6f 64 75 63 69 6e 67 20 41 | ......The.Costs.of.Introducing.A |
| 822c0 | 73 73 69 67 6e 6d 65 6e 74 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e | ssignment....File:.sicp.info,..N |
| 822e0 | 6f 64 65 3a 20 33 2d 31 2d 31 2c 20 20 4e 65 78 74 3a 20 33 2d 31 2d 32 2c 20 20 50 72 65 76 3a | ode:.3-1-1,..Next:.3-1-2,..Prev: |
| 82300 | 20 33 2d 31 2c 20 20 55 70 3a 20 33 2d 31 0a 0a 33 2e 31 2e 31 20 4c 6f 63 61 6c 20 53 74 61 74 | .3-1,..Up:.3-1..3.1.1.Local.Stat |
| 82320 | 65 20 56 61 72 69 61 62 6c 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | e.Variables.-------------------- |
| 82340 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 6f 20 69 6c 6c 75 73 74 72 61 74 65 20 77 68 61 74 20 77 65 20 6d | -------..To.illustrate.what.we.m |
| 82360 | 65 61 6e 20 62 79 20 68 61 76 69 6e 67 20 61 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 | ean.by.having.a.computational.ob |
| 82380 | 6a 65 63 74 20 77 69 74 68 0a 74 69 6d 65 2d 76 61 72 79 69 6e 67 20 73 74 61 74 65 2c 20 6c 65 | ject.with.time-varying.state,.le |
| 823a0 | 74 20 75 73 20 6d 6f 64 65 6c 20 74 68 65 20 73 69 74 75 61 74 69 6f 6e 20 6f 66 20 77 69 74 68 | t.us.model.the.situation.of.with |
| 823c0 | 64 72 61 77 69 6e 67 20 6d 6f 6e 65 79 0a 66 72 6f 6d 20 61 20 62 61 6e 6b 20 61 63 63 6f 75 6e | drawing.money.from.a.bank.accoun |
| 823e0 | 74 2e 20 20 57 65 20 77 69 6c 6c 20 64 6f 20 74 68 69 73 20 75 73 69 6e 67 20 61 20 70 72 6f 63 | t...We.will.do.this.using.a.proc |
| 82400 | 65 64 75 72 65 20 60 77 69 74 68 64 72 61 77 27 2c 0a 77 68 69 63 68 20 74 61 6b 65 73 20 61 73 | edure.`withdraw',.which.takes.as |
| 82420 | 20 61 72 67 75 6d 65 6e 74 20 61 6e 20 60 61 6d 6f 75 6e 74 27 20 74 6f 20 62 65 20 77 69 74 68 | .argument.an.`amount'.to.be.with |
| 82440 | 64 72 61 77 6e 2e 20 20 49 66 20 74 68 65 72 65 20 69 73 0a 65 6e 6f 75 67 68 20 6d 6f 6e 65 79 | drawn...If.there.is.enough.money |
| 82460 | 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 20 74 6f 20 61 63 63 6f 6d 6d 6f 64 61 74 65 20 74 | .in.the.account.to.accommodate.t |
| 82480 | 68 65 20 77 69 74 68 64 72 61 77 61 6c 2c 20 74 68 65 6e 0a 60 77 69 74 68 64 72 61 77 27 20 73 | he.withdrawal,.then.`withdraw'.s |
| 824a0 | 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 74 68 65 20 62 61 6c 61 6e 63 65 20 72 65 6d 61 69 6e 69 | hould.return.the.balance.remaini |
| 824c0 | 6e 67 20 61 66 74 65 72 20 74 68 65 20 77 69 74 68 64 72 61 77 61 6c 2e 0a 4f 74 68 65 72 77 69 | ng.after.the.withdrawal..Otherwi |
| 824e0 | 73 65 2c 20 60 77 69 74 68 64 72 61 77 27 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 74 68 65 | se,.`withdraw'.should.return.the |
| 82500 | 20 6d 65 73 73 61 67 65 20 5f 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 5f 2e 0a 46 | .message._Insufficient.funds_..F |
| 82520 | 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 77 65 20 62 65 67 69 6e 20 77 69 74 68 20 24 31 30 | or.example,.if.we.begin.with.$10 |
| 82540 | 30 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 2c 20 77 65 20 73 68 6f 75 6c 64 20 6f 62 74 61 | 0.in.the.account,.we.should.obta |
| 82560 | 69 6e 20 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 73 65 71 75 65 6e 63 65 20 6f 66 20 72 65 73 | in.the.following.sequence.of.res |
| 82580 | 70 6f 6e 73 65 73 20 75 73 69 6e 67 20 60 77 69 74 68 64 72 61 77 27 3a 0a 0a 20 20 20 20 20 28 | ponses.using.`withdraw':.......( |
| 825a0 | 77 69 74 68 64 72 61 77 20 32 35 29 0a 20 20 20 20 20 37 35 0a 0a 20 20 20 20 20 28 77 69 74 68 | withdraw.25)......75.......(with |
| 825c0 | 64 72 61 77 20 32 35 29 0a 20 20 20 20 20 35 30 0a 0a 20 20 20 20 20 28 77 69 74 68 64 72 61 77 | draw.25)......50.......(withdraw |
| 825e0 | 20 36 30 29 0a 20 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 0a 0a | .60)......"Insufficient.funds".. |
| 82600 | 20 20 20 20 20 28 77 69 74 68 64 72 61 77 20 31 35 29 0a 20 20 20 20 20 33 35 0a 0a 20 20 20 4f | .....(withdraw.15)......35.....O |
| 82620 | 62 73 65 72 76 65 20 74 68 61 74 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 77 69 74 | bserve.that.the.expression.`(wit |
| 82640 | 68 64 72 61 77 20 32 35 29 27 2c 20 65 76 61 6c 75 61 74 65 64 20 74 77 69 63 65 2c 20 79 69 65 | hdraw.25)',.evaluated.twice,.yie |
| 82660 | 6c 64 73 0a 64 69 66 66 65 72 65 6e 74 20 76 61 6c 75 65 73 2e 20 20 54 68 69 73 20 69 73 20 61 | lds.different.values...This.is.a |
| 82680 | 20 6e 65 77 20 6b 69 6e 64 20 6f 66 20 62 65 68 61 76 69 6f 72 20 66 6f 72 20 61 20 70 72 6f 63 | .new.kind.of.behavior.for.a.proc |
| 826a0 | 65 64 75 72 65 2e 0a 55 6e 74 69 6c 20 6e 6f 77 2c 20 61 6c 6c 20 6f 75 72 20 70 72 6f 63 65 64 | edure..Until.now,.all.our.proced |
| 826c0 | 75 72 65 73 20 63 6f 75 6c 64 20 62 65 20 76 69 65 77 65 64 20 61 73 20 73 70 65 63 69 66 69 63 | ures.could.be.viewed.as.specific |
| 826e0 | 61 74 69 6f 6e 73 20 66 6f 72 0a 63 6f 6d 70 75 74 69 6e 67 20 6d 61 74 68 65 6d 61 74 69 63 61 | ations.for.computing.mathematica |
| 82700 | 6c 20 66 75 6e 63 74 69 6f 6e 73 2e 20 20 41 20 63 61 6c 6c 20 74 6f 20 61 20 70 72 6f 63 65 64 | l.functions...A.call.to.a.proced |
| 82720 | 75 72 65 20 63 6f 6d 70 75 74 65 64 20 74 68 65 0a 76 61 6c 75 65 20 6f 66 20 74 68 65 20 66 75 | ure.computed.the.value.of.the.fu |
| 82740 | 6e 63 74 69 6f 6e 20 61 70 70 6c 69 65 64 20 74 6f 20 74 68 65 20 67 69 76 65 6e 20 61 72 67 75 | nction.applied.to.the.given.argu |
| 82760 | 6d 65 6e 74 73 2c 20 61 6e 64 20 74 77 6f 20 63 61 6c 6c 73 20 74 6f 0a 74 68 65 20 73 61 6d 65 | ments,.and.two.calls.to.the.same |
| 82780 | 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 61 72 67 75 6d 65 6e | .procedure.with.the.same.argumen |
| 827a0 | 74 73 20 61 6c 77 61 79 73 20 70 72 6f 64 75 63 65 64 20 74 68 65 20 73 61 6d 65 0a 72 65 73 75 | ts.always.produced.the.same.resu |
| 827c0 | 6c 74 2e 28 31 29 0a 0a 20 20 20 54 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 60 77 69 74 68 64 72 61 | lt.(1).....To.implement.`withdra |
| 827e0 | 77 27 2c 20 77 65 20 63 61 6e 20 75 73 65 20 61 20 76 61 72 69 61 62 6c 65 20 60 62 61 6c 61 6e | w',.we.can.use.a.variable.`balan |
| 82800 | 63 65 27 20 74 6f 20 69 6e 64 69 63 61 74 65 0a 74 68 65 20 62 61 6c 61 6e 63 65 20 6f 66 20 6d | ce'.to.indicate.the.balance.of.m |
| 82820 | 6f 6e 65 79 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 20 61 6e 64 20 64 65 66 69 6e 65 20 60 | oney.in.the.account.and.define.` |
| 82840 | 77 69 74 68 64 72 61 77 27 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 0a 74 68 61 74 20 61 63 | withdraw'.as.a.procedure.that.ac |
| 82860 | 63 65 73 73 65 73 20 60 62 61 6c 61 6e 63 65 27 2e 20 20 54 68 65 20 60 77 69 74 68 64 72 61 77 | cesses.`balance'...The.`withdraw |
| 82880 | 27 20 70 72 6f 63 65 64 75 72 65 20 63 68 65 63 6b 73 20 74 6f 20 73 65 65 20 69 66 0a 60 62 61 | '.procedure.checks.to.see.if.`ba |
| 828a0 | 6c 61 6e 63 65 27 20 69 73 20 61 74 20 6c 65 61 73 74 20 61 73 20 6c 61 72 67 65 20 61 73 20 74 | lance'.is.at.least.as.large.as.t |
| 828c0 | 68 65 20 72 65 71 75 65 73 74 65 64 20 60 61 6d 6f 75 6e 74 27 2e 20 20 49 66 20 73 6f 2c 0a 60 | he.requested.`amount'...If.so,.` |
| 828e0 | 77 69 74 68 64 72 61 77 27 20 64 65 63 72 65 6d 65 6e 74 73 20 60 62 61 6c 61 6e 63 65 27 20 62 | withdraw'.decrements.`balance'.b |
| 82900 | 79 20 60 61 6d 6f 75 6e 74 27 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 6e 65 77 20 76 | y.`amount'.and.returns.the.new.v |
| 82920 | 61 6c 75 65 0a 6f 66 20 60 62 61 6c 61 6e 63 65 27 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 60 | alue.of.`balance'...Otherwise,.` |
| 82940 | 77 69 74 68 64 72 61 77 27 20 72 65 74 75 72 6e 73 20 74 68 65 20 5f 49 6e 73 75 66 66 69 63 69 | withdraw'.returns.the._Insuffici |
| 82960 | 65 6e 74 20 66 75 6e 64 73 5f 0a 6d 65 73 73 61 67 65 2e 20 20 48 65 72 65 20 61 72 65 20 74 68 | ent.funds_.message...Here.are.th |
| 82980 | 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 60 62 61 6c 61 6e 63 65 27 20 61 6e 64 20 60 | e.definitions.of.`balance'.and.` |
| 829a0 | 77 69 74 68 64 72 61 77 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 62 61 6c 61 6e 63 65 | withdraw':.......(define.balance |
| 829c0 | 20 31 30 30 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 77 69 74 68 64 72 61 77 20 61 6d | .100).......(define.(withdraw.am |
| 829e0 | 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f | ount)........(if.(>=.balance.amo |
| 82a00 | 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c | unt)............(begin.(set!.bal |
| 82a20 | 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 | ance.(-.balance.amount))........ |
| 82a40 | 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 22 | ...........balance)............" |
| 82a60 | 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 0a 0a 20 20 20 44 65 63 72 65 6d | Insufficient.funds")).....Decrem |
| 82a80 | 65 6e 74 69 6e 67 20 60 62 61 6c 61 6e 63 65 27 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 | enting.`balance'.is.accomplished |
| 82aa0 | 20 62 79 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 28 73 65 74 21 20 62 | .by.the.expression.......(set!.b |
| 82ac0 | 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 0a 20 20 20 54 | alance.(-.balance.amount)).....T |
| 82ae0 | 68 69 73 20 75 73 65 73 20 74 68 65 20 60 73 65 74 21 27 20 73 70 65 63 69 61 6c 20 66 6f 72 6d | his.uses.the.`set!'.special.form |
| 82b00 | 2c 20 77 68 6f 73 65 20 73 79 6e 74 61 78 20 69 73 0a 0a 20 20 20 20 20 28 73 65 74 21 20 3c 4e | ,.whose.syntax.is.......(set!.<N |
| 82b20 | 41 4d 45 3e 20 3c 4e 45 57 2d 56 41 4c 55 45 3e 29 0a 0a 20 20 20 48 65 72 65 20 3c 4e 41 4d 45 | AME>.<NEW-VALUE>).....Here.<NAME |
| 82b40 | 3e 20 69 73 20 61 20 73 79 6d 62 6f 6c 20 61 6e 64 20 3c 4e 45 57 2d 56 41 4c 55 45 3e 20 69 73 | >.is.a.symbol.and.<NEW-VALUE>.is |
| 82b60 | 20 61 6e 79 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 60 53 65 74 21 27 0a 63 68 61 6e 67 65 73 | .any.expression...`Set!'.changes |
| 82b80 | 20 3c 4e 41 4d 45 3e 20 73 6f 20 74 68 61 74 20 69 74 73 20 76 61 6c 75 65 20 69 73 20 74 68 65 | .<NAME>.so.that.its.value.is.the |
| 82ba0 | 20 72 65 73 75 6c 74 20 6f 62 74 61 69 6e 65 64 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 0a 3c | .result.obtained.by.evaluating.< |
| 82bc0 | 4e 45 57 2d 56 41 4c 55 45 3e 2e 20 20 49 6e 20 74 68 65 20 63 61 73 65 20 61 74 20 68 61 6e 64 | NEW-VALUE>...In.the.case.at.hand |
| 82be0 | 2c 20 77 65 20 61 72 65 20 63 68 61 6e 67 69 6e 67 20 60 62 61 6c 61 6e 63 65 27 20 73 6f 20 74 | ,.we.are.changing.`balance'.so.t |
| 82c00 | 68 61 74 0a 69 74 73 20 6e 65 77 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 65 20 74 68 65 20 72 65 | hat.its.new.value.will.be.the.re |
| 82c20 | 73 75 6c 74 20 6f 66 20 73 75 62 74 72 61 63 74 69 6e 67 20 60 61 6d 6f 75 6e 74 27 20 66 72 6f | sult.of.subtracting.`amount'.fro |
| 82c40 | 6d 20 74 68 65 0a 70 72 65 76 69 6f 75 73 20 76 61 6c 75 65 20 6f 66 20 60 62 61 6c 61 6e 63 65 | m.the.previous.value.of.`balance |
| 82c60 | 27 2e 28 32 29 0a 0a 20 20 20 60 57 69 74 68 64 72 61 77 27 20 61 6c 73 6f 20 75 73 65 73 20 74 | '.(2).....`Withdraw'.also.uses.t |
| 82c80 | 68 65 20 60 62 65 67 69 6e 27 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 74 6f 20 63 61 75 73 65 | he.`begin'.special.form.to.cause |
| 82ca0 | 20 74 77 6f 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 | .two.expressions.to.be.evaluated |
| 82cc0 | 20 69 6e 20 74 68 65 20 63 61 73 65 20 77 68 65 72 65 20 74 68 65 20 60 69 66 27 20 74 65 73 74 | .in.the.case.where.the.`if'.test |
| 82ce0 | 20 69 73 20 74 72 75 65 3a 0a 66 69 72 73 74 20 64 65 63 72 65 6d 65 6e 74 69 6e 67 20 60 62 61 | .is.true:.first.decrementing.`ba |
| 82d00 | 6c 61 6e 63 65 27 20 61 6e 64 20 74 68 65 6e 20 72 65 74 75 72 6e 69 6e 67 20 74 68 65 20 76 61 | lance'.and.then.returning.the.va |
| 82d20 | 6c 75 65 20 6f 66 20 60 62 61 6c 61 6e 63 65 27 2e 0a 49 6e 20 67 65 6e 65 72 61 6c 2c 20 65 76 | lue.of.`balance'..In.general,.ev |
| 82d40 | 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 28 62 | aluating.the.expression.......(b |
| 82d60 | 65 67 69 6e 20 3c 45 58 50 5f 31 3e 20 3c 45 58 50 5f 32 3e 20 2e 2e 2e 20 3c 45 58 50 5f 4b 3e | egin.<EXP_1>.<EXP_2>.....<EXP_K> |
| 82d80 | 29 0a 0a 63 61 75 73 65 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 3c 45 58 50 5f 31 | )..causes.the.expressions.<EXP_1 |
| 82da0 | 3e 20 74 68 72 6f 75 67 68 20 3c 45 58 50 5f 4b 3e 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 | >.through.<EXP_K>.to.be.evaluate |
| 82dc0 | 64 20 69 6e 0a 73 65 71 75 65 6e 63 65 20 61 6e 64 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 | d.in.sequence.and.the.value.of.t |
| 82de0 | 68 65 20 66 69 6e 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 20 3c 45 58 50 5f 4b 3e 20 74 6f 20 62 | he.final.expression.<EXP_K>.to.b |
| 82e00 | 65 20 72 65 74 75 72 6e 65 64 0a 61 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 65 | e.returned.as.the.value.of.the.e |
| 82e20 | 6e 74 69 72 65 20 60 62 65 67 69 6e 27 20 66 6f 72 6d 2e 28 33 29 0a 0a 20 20 20 41 6c 74 68 6f | ntire.`begin'.form.(3).....Altho |
| 82e40 | 75 67 68 20 60 77 69 74 68 64 72 61 77 27 20 77 6f 72 6b 73 20 61 73 20 64 65 73 69 72 65 64 2c | ugh.`withdraw'.works.as.desired, |
| 82e60 | 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 60 62 61 6c 61 6e 63 65 27 20 70 72 65 73 65 6e 74 73 | .the.variable.`balance'.presents |
| 82e80 | 0a 61 20 70 72 6f 62 6c 65 6d 2e 20 20 41 73 20 73 70 65 63 69 66 69 65 64 20 61 62 6f 76 65 2c | .a.problem...As.specified.above, |
| 82ea0 | 20 60 62 61 6c 61 6e 63 65 27 20 69 73 20 61 20 6e 61 6d 65 20 64 65 66 69 6e 65 64 20 69 6e 20 | .`balance'.is.a.name.defined.in. |
| 82ec0 | 74 68 65 0a 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 6e 64 20 69 73 20 66 72 | the.global.environment.and.is.fr |
| 82ee0 | 65 65 6c 79 20 61 63 63 65 73 73 69 62 6c 65 20 74 6f 20 62 65 20 65 78 61 6d 69 6e 65 64 20 6f | eely.accessible.to.be.examined.o |
| 82f00 | 72 20 6d 6f 64 69 66 69 65 64 0a 62 79 20 61 6e 79 20 70 72 6f 63 65 64 75 72 65 2e 20 20 49 74 | r.modified.by.any.procedure...It |
| 82f20 | 20 77 6f 75 6c 64 20 62 65 20 6d 75 63 68 20 62 65 74 74 65 72 20 69 66 20 77 65 20 63 6f 75 6c | .would.be.much.better.if.we.coul |
| 82f40 | 64 20 73 6f 6d 65 68 6f 77 20 6d 61 6b 65 0a 60 62 61 6c 61 6e 63 65 27 20 69 6e 74 65 72 6e 61 | d.somehow.make.`balance'.interna |
| 82f60 | 6c 20 74 6f 20 60 77 69 74 68 64 72 61 77 27 2c 20 73 6f 20 74 68 61 74 20 60 77 69 74 68 64 72 | l.to.`withdraw',.so.that.`withdr |
| 82f80 | 61 77 27 20 77 6f 75 6c 64 20 62 65 20 74 68 65 20 6f 6e 6c 79 0a 70 72 6f 63 65 64 75 72 65 20 | aw'.would.be.the.only.procedure. |
| 82fa0 | 74 68 61 74 20 63 6f 75 6c 64 20 61 63 63 65 73 73 20 60 62 61 6c 61 6e 63 65 27 20 64 69 72 65 | that.could.access.`balance'.dire |
| 82fc0 | 63 74 6c 79 20 61 6e 64 20 61 6e 79 20 6f 74 68 65 72 20 70 72 6f 63 65 64 75 72 65 0a 63 6f 75 | ctly.and.any.other.procedure.cou |
| 82fe0 | 6c 64 20 61 63 63 65 73 73 20 60 62 61 6c 61 6e 63 65 27 20 6f 6e 6c 79 20 69 6e 64 69 72 65 63 | ld.access.`balance'.only.indirec |
| 83000 | 74 6c 79 20 28 74 68 72 6f 75 67 68 20 63 61 6c 6c 73 20 74 6f 20 60 77 69 74 68 64 72 61 77 27 | tly.(through.calls.to.`withdraw' |
| 83020 | 29 2e 0a 54 68 69 73 20 77 6f 75 6c 64 20 6d 6f 72 65 20 61 63 63 75 72 61 74 65 6c 79 20 6d 6f | )..This.would.more.accurately.mo |
| 83040 | 64 65 6c 20 74 68 65 20 6e 6f 74 69 6f 6e 20 74 68 61 74 20 60 62 61 6c 61 6e 63 65 27 20 69 73 | del.the.notion.that.`balance'.is |
| 83060 | 20 61 20 6c 6f 63 61 6c 0a 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 20 75 73 65 64 20 62 79 20 | .a.local.state.variable.used.by. |
| 83080 | 60 77 69 74 68 64 72 61 77 27 20 74 6f 20 6b 65 65 70 20 74 72 61 63 6b 20 6f 66 20 74 68 65 20 | `withdraw'.to.keep.track.of.the. |
| 830a0 | 73 74 61 74 65 20 6f 66 20 74 68 65 0a 61 63 63 6f 75 6e 74 2e 0a 0a 20 20 20 57 65 20 63 61 6e | state.of.the.account......We.can |
| 830c0 | 20 6d 61 6b 65 20 60 62 61 6c 61 6e 63 65 27 20 69 6e 74 65 72 6e 61 6c 20 74 6f 20 60 77 69 74 | .make.`balance'.internal.to.`wit |
| 830e0 | 68 64 72 61 77 27 20 62 79 20 72 65 77 72 69 74 69 6e 67 20 74 68 65 0a 64 65 66 69 6e 69 74 69 | hdraw'.by.rewriting.the.definiti |
| 83100 | 6f 6e 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6e 65 77 | on.as.follows:.......(define.new |
| 83120 | 2d 77 69 74 68 64 72 61 77 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 62 61 6c 61 6e 63 65 20 | -withdraw........(let.((balance. |
| 83140 | 31 30 30 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 6d 6f 75 6e 74 29 0a | 100))..........(lambda.(amount). |
| 83160 | 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e | ...........(if.(>=.balance.amoun |
| 83180 | 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 | t)................(begin.(set!.b |
| 831a0 | 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 | alance.(-.balance.amount))...... |
| 831c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 | .................balance)....... |
| 831e0 | 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 29 | ........."Insufficient.funds"))) |
| 83200 | 29 0a 0a 20 20 20 57 68 61 74 20 77 65 20 68 61 76 65 20 64 6f 6e 65 20 68 65 72 65 20 69 73 20 | ).....What.we.have.done.here.is. |
| 83220 | 75 73 65 20 60 6c 65 74 27 20 74 6f 20 65 73 74 61 62 6c 69 73 68 20 61 6e 20 65 6e 76 69 72 6f | use.`let'.to.establish.an.enviro |
| 83240 | 6e 6d 65 6e 74 20 77 69 74 68 0a 61 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 20 60 62 61 6c | nment.with.a.local.variable.`bal |
| 83260 | 61 6e 63 65 27 2c 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 69 6e 69 74 69 61 6c 20 76 61 6c 75 | ance',.bound.to.the.initial.valu |
| 83280 | 65 20 31 30 30 2e 20 20 57 69 74 68 69 6e 20 74 68 69 73 0a 6c 6f 63 61 6c 20 65 6e 76 69 72 6f | e.100...Within.this.local.enviro |
| 832a0 | 6e 6d 65 6e 74 2c 20 77 65 20 75 73 65 20 60 6c 61 6d 62 64 61 27 20 74 6f 20 63 72 65 61 74 65 | nment,.we.use.`lambda'.to.create |
| 832c0 | 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 0a 60 61 6d 6f 75 6e 74 27 | .a.procedure.that.takes.`amount' |
| 832e0 | 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 62 65 68 61 76 65 73 20 6c 69 6b 65 | .as.an.argument.and.behaves.like |
| 83300 | 20 6f 75 72 20 70 72 65 76 69 6f 75 73 20 60 77 69 74 68 64 72 61 77 27 0a 70 72 6f 63 65 64 75 | .our.previous.`withdraw'.procedu |
| 83320 | 72 65 2e 20 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 2d 2d 72 65 74 75 72 6e 65 64 20 61 73 | re...This.procedure--returned.as |
| 83340 | 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 0a 60 6c | .the.result.of.evaluating.the.`l |
| 83360 | 65 74 27 20 65 78 70 72 65 73 73 69 6f 6e 2d 2d 69 73 20 60 6e 65 77 2d 77 69 74 68 64 72 61 77 | et'.expression--is.`new-withdraw |
| 83380 | 27 2c 20 77 68 69 63 68 20 62 65 68 61 76 65 73 20 69 6e 20 70 72 65 63 69 73 65 6c 79 20 74 68 | ',.which.behaves.in.precisely.th |
| 833a0 | 65 0a 73 61 6d 65 20 77 61 79 20 61 73 20 60 77 69 74 68 64 72 61 77 27 20 62 75 74 20 77 68 6f | e.same.way.as.`withdraw'.but.who |
| 833c0 | 73 65 20 76 61 72 69 61 62 6c 65 20 60 62 61 6c 61 6e 63 65 27 20 69 73 20 6e 6f 74 20 61 63 63 | se.variable.`balance'.is.not.acc |
| 833e0 | 65 73 73 69 62 6c 65 0a 62 79 20 61 6e 79 20 6f 74 68 65 72 20 70 72 6f 63 65 64 75 72 65 2e 28 | essible.by.any.other.procedure.( |
| 83400 | 34 29 0a 0a 20 20 20 43 6f 6d 62 69 6e 69 6e 67 20 60 73 65 74 21 27 20 77 69 74 68 20 6c 6f 63 | 4).....Combining.`set!'.with.loc |
| 83420 | 61 6c 20 76 61 72 69 61 62 6c 65 73 20 69 73 20 74 68 65 20 67 65 6e 65 72 61 6c 20 70 72 6f 67 | al.variables.is.the.general.prog |
| 83440 | 72 61 6d 6d 69 6e 67 0a 74 65 63 68 6e 69 71 75 65 20 77 65 20 77 69 6c 6c 20 75 73 65 20 66 6f | ramming.technique.we.will.use.fo |
| 83460 | 72 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a | r.constructing.computational.obj |
| 83480 | 65 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 0a 73 74 61 74 65 2e 20 20 55 6e 66 6f 72 74 75 6e | ects.with.local.state...Unfortun |
| 834a0 | 61 74 65 6c 79 2c 20 75 73 69 6e 67 20 74 68 69 73 20 74 65 63 68 6e 69 71 75 65 20 72 61 69 73 | ately,.using.this.technique.rais |
| 834c0 | 65 73 20 61 20 73 65 72 69 6f 75 73 20 70 72 6f 62 6c 65 6d 3a 0a 57 68 65 6e 20 77 65 20 66 69 | es.a.serious.problem:.When.we.fi |
| 834e0 | 72 73 74 20 69 6e 74 72 6f 64 75 63 65 64 20 70 72 6f 63 65 64 75 72 65 73 2c 20 77 65 20 61 6c | rst.introduced.procedures,.we.al |
| 83500 | 73 6f 20 69 6e 74 72 6f 64 75 63 65 64 20 74 68 65 0a 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d | so.introduced.the.substitution.m |
| 83520 | 6f 64 65 6c 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 | odel.of.evaluation.(section.*Not |
| 83540 | 65 20 31 2d 31 2d 35 3a 3a 29 20 74 6f 20 70 72 6f 76 69 64 65 20 61 6e 0a 69 6e 74 65 72 70 72 | e.1-1-5::).to.provide.an.interpr |
| 83560 | 65 74 61 74 69 6f 6e 20 6f 66 20 77 68 61 74 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 | etation.of.what.procedure.applic |
| 83580 | 61 74 69 6f 6e 20 6d 65 61 6e 73 2e 20 20 57 65 20 73 61 69 64 20 74 68 61 74 0a 61 70 70 6c 79 | ation.means...We.said.that.apply |
| 835a0 | 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 62 65 20 69 6e 74 65 72 70 | ing.a.procedure.should.be.interp |
| 835c0 | 72 65 74 65 64 20 61 73 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 62 6f 64 79 20 6f 66 0a | reted.as.evaluating.the.body.of. |
| 835e0 | 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 74 68 65 20 66 6f 72 6d 61 6c 20 70 61 | the.procedure.with.the.formal.pa |
| 83600 | 72 61 6d 65 74 65 72 73 20 72 65 70 6c 61 63 65 64 20 62 79 20 74 68 65 69 72 20 76 61 6c 75 65 | rameters.replaced.by.their.value |
| 83620 | 73 2e 20 20 54 68 65 0a 74 72 6f 75 62 6c 65 20 69 73 20 74 68 61 74 2c 20 61 73 20 73 6f 6f 6e | s...The.trouble.is.that,.as.soon |
| 83640 | 20 61 73 20 77 65 20 69 6e 74 72 6f 64 75 63 65 20 61 73 73 69 67 6e 6d 65 6e 74 20 69 6e 74 6f | .as.we.introduce.assignment.into |
| 83660 | 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 2c 0a 73 75 62 73 74 69 74 75 74 69 6f 6e 20 69 73 20 6e | .our.language,.substitution.is.n |
| 83680 | 6f 20 6c 6f 6e 67 65 72 20 61 6e 20 61 64 65 71 75 61 74 65 20 6d 6f 64 65 6c 20 6f 66 20 70 72 | o.longer.an.adequate.model.of.pr |
| 836a0 | 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 0a 28 57 65 20 77 69 6c 6c 20 73 65 | ocedure.application..(We.will.se |
| 836c0 | 65 20 77 68 79 20 74 68 69 73 20 69 73 20 73 6f 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 | e.why.this.is.so.in.section.*Not |
| 836e0 | 65 20 33 2d 31 2d 33 3a 3a 2e 29 20 20 41 73 20 61 0a 63 6f 6e 73 65 71 75 65 6e 63 65 2c 20 77 | e.3-1-3::.)..As.a.consequence,.w |
| 83700 | 65 20 74 65 63 68 6e 69 63 61 6c 6c 79 20 68 61 76 65 20 61 74 20 74 68 69 73 20 70 6f 69 6e 74 | e.technically.have.at.this.point |
| 83720 | 20 6e 6f 20 77 61 79 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 77 68 79 0a 74 68 65 20 60 6e | .no.way.to.understand.why.the.`n |
| 83740 | 65 77 2d 77 69 74 68 64 72 61 77 27 20 70 72 6f 63 65 64 75 72 65 20 62 65 68 61 76 65 73 20 61 | ew-withdraw'.procedure.behaves.a |
| 83760 | 73 20 63 6c 61 69 6d 65 64 20 61 62 6f 76 65 2e 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 0a 72 65 | s.claimed.above...In.order.to.re |
| 83780 | 61 6c 6c 79 20 75 6e 64 65 72 73 74 61 6e 64 20 61 20 70 72 6f 63 65 64 75 72 65 20 73 75 63 68 | ally.understand.a.procedure.such |
| 837a0 | 20 61 73 20 60 6e 65 77 2d 77 69 74 68 64 72 61 77 27 2c 20 77 65 20 77 69 6c 6c 20 6e 65 65 64 | .as.`new-withdraw',.we.will.need |
| 837c0 | 20 74 6f 0a 64 65 76 65 6c 6f 70 20 61 20 6e 65 77 20 6d 6f 64 65 6c 20 6f 66 20 70 72 6f 63 65 | .to.develop.a.new.model.of.proce |
| 837e0 | 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 20 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e | dure.application...In.section.*N |
| 83800 | 6f 74 65 20 33 2d 32 3a 3a 0a 77 65 20 77 69 6c 6c 20 69 6e 74 72 6f 64 75 63 65 20 73 75 63 68 | ote.3-2::.we.will.introduce.such |
| 83820 | 20 61 20 6d 6f 64 65 6c 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 6e 20 65 78 70 6c 61 | .a.model,.together.with.an.expla |
| 83840 | 6e 61 74 69 6f 6e 20 6f 66 20 60 73 65 74 21 27 0a 61 6e 64 20 6c 6f 63 61 6c 20 76 61 72 69 61 | nation.of.`set!'.and.local.varia |
| 83860 | 62 6c 65 73 2e 20 20 46 69 72 73 74 2c 20 68 6f 77 65 76 65 72 2c 20 77 65 20 65 78 61 6d 69 6e | bles...First,.however,.we.examin |
| 83880 | 65 20 73 6f 6d 65 20 76 61 72 69 61 74 69 6f 6e 73 20 6f 6e 20 74 68 65 0a 74 68 65 6d 65 20 65 | e.some.variations.on.the.theme.e |
| 838a0 | 73 74 61 62 6c 69 73 68 65 64 20 62 79 20 60 6e 65 77 2d 77 69 74 68 64 72 61 77 27 2e 0a 0a 20 | stablished.by.`new-withdraw'.... |
| 838c0 | 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 2c 20 60 6d 61 6b 65 | ..The.following.procedure,.`make |
| 838e0 | 2d 77 69 74 68 64 72 61 77 27 2c 20 63 72 65 61 74 65 73 20 22 77 69 74 68 64 72 61 77 61 6c 0a | -withdraw',.creates."withdrawal. |
| 83900 | 70 72 6f 63 65 73 73 6f 72 73 2e 22 20 20 54 68 65 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d 65 74 | processors."..The.formal.paramet |
| 83920 | 65 72 20 60 62 61 6c 61 6e 63 65 27 20 69 6e 20 60 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 27 0a | er.`balance'.in.`make-withdraw'. |
| 83940 | 73 70 65 63 69 66 69 65 73 20 74 68 65 20 69 6e 69 74 69 61 6c 20 61 6d 6f 75 6e 74 20 6f 66 20 | specifies.the.initial.amount.of. |
| 83960 | 6d 6f 6e 65 79 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 2e 28 35 29 0a 0a 20 20 20 20 20 28 | money.in.the.account.(5).......( |
| 83980 | 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 20 62 61 6c 61 6e 63 65 29 0a 20 | define.(make-withdraw.balance).. |
| 839a0 | 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 | ......(lambda.(amount).......... |
| 839c0 | 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 | (if.(>=.balance.amount)......... |
| 839e0 | 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c | .....(begin.(set!.balance.(-.bal |
| 83a00 | 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ance.amount))................... |
| 83a20 | 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 66 69 | ..balance).............."Insuffi |
| 83a40 | 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 29 0a 0a 20 20 20 60 4d 61 6b 65 2d 77 69 74 68 64 72 | cient.funds"))).....`Make-withdr |
| 83a60 | 61 77 27 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 66 6f 6c 6c 6f 77 73 20 74 6f 20 63 72 | aw'.can.be.used.as.follows.to.cr |
| 83a80 | 65 61 74 65 20 74 77 6f 20 6f 62 6a 65 63 74 73 20 60 57 31 27 20 61 6e 64 0a 60 57 32 27 3a 0a | eate.two.objects.`W1'.and.`W2':. |
| 83aa0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 57 31 20 28 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 20 | ......(define.W1.(make-withdraw. |
| 83ac0 | 31 30 30 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 57 32 20 28 6d 61 6b 65 2d 77 69 74 68 | 100))......(define.W2.(make-with |
| 83ae0 | 64 72 61 77 20 31 30 30 29 29 0a 0a 20 20 20 20 20 28 57 31 20 35 30 29 0a 20 20 20 20 20 35 30 | draw.100)).......(W1.50)......50 |
| 83b00 | 0a 0a 20 20 20 20 20 28 57 32 20 37 30 29 0a 20 20 20 20 20 33 30 0a 0a 20 20 20 20 20 28 57 32 | .......(W2.70)......30.......(W2 |
| 83b20 | 20 34 30 29 0a 20 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 0a 0a | .40)......"Insufficient.funds".. |
| 83b40 | 20 20 20 20 20 28 57 31 20 34 30 29 0a 20 20 20 20 20 31 30 0a 0a 20 20 20 4f 62 73 65 72 76 65 | .....(W1.40)......10.....Observe |
| 83b60 | 20 74 68 61 74 20 60 57 31 27 20 61 6e 64 20 60 57 32 27 20 61 72 65 20 63 6f 6d 70 6c 65 74 65 | .that.`W1'.and.`W2'.are.complete |
| 83b80 | 6c 79 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 62 6a 65 63 74 73 2c 20 65 61 63 68 0a 77 69 74 | ly.independent.objects,.each.wit |
| 83ba0 | 68 20 69 74 73 20 6f 77 6e 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 20 60 | h.its.own.local.state.variable.` |
| 83bc0 | 62 61 6c 61 6e 63 65 27 2e 20 20 57 69 74 68 64 72 61 77 61 6c 73 20 66 72 6f 6d 20 6f 6e 65 20 | balance'...Withdrawals.from.one. |
| 83be0 | 64 6f 0a 6e 6f 74 20 61 66 66 65 63 74 20 74 68 65 20 6f 74 68 65 72 2e 0a 0a 20 20 20 57 65 20 | do.not.affect.the.other......We. |
| 83c00 | 63 61 6e 20 61 6c 73 6f 20 63 72 65 61 74 65 20 6f 62 6a 65 63 74 73 20 74 68 61 74 20 68 61 6e | can.also.create.objects.that.han |
| 83c20 | 64 6c 65 20 64 65 70 6f 73 69 74 73 20 61 73 20 77 65 6c 6c 20 61 73 0a 77 69 74 68 64 72 61 77 | dle.deposits.as.well.as.withdraw |
| 83c40 | 61 6c 73 2c 20 61 6e 64 20 74 68 75 73 20 77 65 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 20 73 | als,.and.thus.we.can.represent.s |
| 83c60 | 69 6d 70 6c 65 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 73 2e 20 20 48 65 72 65 20 69 73 20 61 0a | imple.bank.accounts...Here.is.a. |
| 83c80 | 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 61 20 22 62 61 6e 6b 2d 61 | procedure.that.returns.a."bank-a |
| 83ca0 | 63 63 6f 75 6e 74 20 6f 62 6a 65 63 74 22 20 77 69 74 68 20 61 20 73 70 65 63 69 66 69 65 64 20 | ccount.object".with.a.specified. |
| 83cc0 | 69 6e 69 74 69 61 6c 0a 62 61 6c 61 6e 63 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | initial.balance:.......(define.( |
| 83ce0 | 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 28 64 65 | make-account.balance)........(de |
| 83d00 | 66 69 6e 65 20 28 77 69 74 68 64 72 61 77 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 | fine.(withdraw.amount).......... |
| 83d20 | 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 | (if.(>=.balance.amount)......... |
| 83d40 | 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c | .....(begin.(set!.balance.(-.bal |
| 83d60 | 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ance.amount))................... |
| 83d80 | 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 66 69 | ..balance).............."Insuffi |
| 83da0 | 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 | cient.funds"))........(define.(d |
| 83dc0 | 65 70 6f 73 69 74 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 62 61 | eposit.amount)..........(set!.ba |
| 83de0 | 6c 61 6e 63 65 20 28 2b 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 | lance.(+.balance.amount))....... |
| 83e00 | 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 70 | ...balance)........(define.(disp |
| 83e20 | 61 74 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6d 20 27 | atch.m)..........(cond.((eq?.m.' |
| 83e40 | 77 69 74 68 64 72 61 77 29 20 77 69 74 68 64 72 61 77 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | withdraw).withdraw)............. |
| 83e60 | 20 20 20 28 28 65 71 3f 20 6d 20 27 64 65 70 6f 73 69 74 29 20 64 65 70 6f 73 69 74 29 0a 20 20 | ...((eq?.m.'deposit).deposit)... |
| 83e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f | .............(else.(error."Unkno |
| 83ea0 | 77 6e 20 72 65 71 75 65 73 74 20 2d 2d 20 4d 41 4b 45 2d 41 43 43 4f 55 4e 54 22 0a 20 20 20 20 | wn.request.--.MAKE-ACCOUNT"..... |
| 83ec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 29 29 29 29 0a 20 20 | ........................m))))... |
| 83ee0 | 20 20 20 20 20 64 69 73 70 61 74 63 68 29 0a 0a 20 20 20 45 61 63 68 20 63 61 6c 6c 20 74 6f 20 | .....dispatch).....Each.call.to. |
| 83f00 | 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 73 65 74 73 20 75 70 20 61 6e 20 65 6e 76 69 72 6f | `make-account'.sets.up.an.enviro |
| 83f20 | 6e 6d 65 6e 74 20 77 69 74 68 20 61 20 6c 6f 63 61 6c 20 73 74 61 74 65 0a 76 61 72 69 61 62 6c | nment.with.a.local.state.variabl |
| 83f40 | 65 20 60 62 61 6c 61 6e 63 65 27 2e 20 20 57 69 74 68 69 6e 20 74 68 69 73 20 65 6e 76 69 72 6f | e.`balance'...Within.this.enviro |
| 83f60 | 6e 6d 65 6e 74 2c 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 64 65 66 69 6e 65 73 0a 70 72 | nment,.`make-account'.defines.pr |
| 83f80 | 6f 63 65 64 75 72 65 73 20 60 64 65 70 6f 73 69 74 27 20 61 6e 64 20 60 77 69 74 68 64 72 61 77 | ocedures.`deposit'.and.`withdraw |
| 83fa0 | 27 20 74 68 61 74 20 61 63 63 65 73 73 20 60 62 61 6c 61 6e 63 65 27 20 61 6e 64 20 61 6e 0a 61 | '.that.access.`balance'.and.an.a |
| 83fc0 | 64 64 69 74 69 6f 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 20 60 64 69 73 70 61 74 63 68 27 20 74 | dditional.procedure.`dispatch'.t |
| 83fe0 | 68 61 74 20 74 61 6b 65 73 20 61 20 22 6d 65 73 73 61 67 65 22 20 61 73 20 69 6e 70 75 74 20 61 | hat.takes.a."message".as.input.a |
| 84000 | 6e 64 0a 72 65 74 75 72 6e 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 74 77 6f 20 6c 6f 63 61 6c 20 | nd.returns.one.of.the.two.local. |
| 84020 | 70 72 6f 63 65 64 75 72 65 73 2e 20 20 54 68 65 20 60 64 69 73 70 61 74 63 68 27 20 70 72 6f 63 | procedures...The.`dispatch'.proc |
| 84040 | 65 64 75 72 65 0a 69 74 73 65 6c 66 20 69 73 20 72 65 74 75 72 6e 65 64 20 61 73 20 74 68 65 20 | edure.itself.is.returned.as.the. |
| 84060 | 76 61 6c 75 65 20 74 68 61 74 20 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 20 62 61 6e 6b 2d 61 | value.that.represents.the.bank-a |
| 84080 | 63 63 6f 75 6e 74 0a 6f 62 6a 65 63 74 2e 20 20 54 68 69 73 20 69 73 20 70 72 65 63 69 73 65 6c | ccount.object...This.is.precisel |
| 840a0 | 79 20 74 68 65 20 22 6d 65 73 73 61 67 65 2d 70 61 73 73 69 6e 67 22 20 73 74 79 6c 65 20 6f 66 | y.the."message-passing".style.of |
| 840c0 | 20 70 72 6f 67 72 61 6d 6d 69 6e 67 0a 74 68 61 74 20 77 65 20 73 61 77 20 69 6e 20 73 65 63 74 | .programming.that.we.saw.in.sect |
| 840e0 | 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 33 3a 3a 2c 20 61 6c 74 68 6f 75 67 68 20 68 65 72 65 | ion.*Note.2-4-3::,.although.here |
| 84100 | 20 77 65 20 61 72 65 20 75 73 69 6e 67 20 69 74 20 69 6e 0a 63 6f 6e 6a 75 6e 63 74 69 6f 6e 20 | .we.are.using.it.in.conjunction. |
| 84120 | 77 69 74 68 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 6d 6f 64 69 66 79 20 6c 6f 63 61 6c | with.the.ability.to.modify.local |
| 84140 | 20 76 61 72 69 61 62 6c 65 73 2e 0a 0a 20 20 20 60 4d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 63 | .variables......`Make-account'.c |
| 84160 | 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 | an.be.used.as.follows:.......(de |
| 84180 | 66 69 6e 65 20 61 63 63 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 31 30 30 29 29 0a 0a 20 20 | fine.acc.(make-account.100)).... |
| 841a0 | 20 20 20 28 28 61 63 63 20 27 77 69 74 68 64 72 61 77 29 20 35 30 29 0a 20 20 20 20 20 35 30 0a | ...((acc.'withdraw).50)......50. |
| 841c0 | 0a 20 20 20 20 20 28 28 61 63 63 20 27 77 69 74 68 64 72 61 77 29 20 36 30 29 0a 20 20 20 20 20 | ......((acc.'withdraw).60)...... |
| 841e0 | 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 0a 0a 20 20 20 20 20 28 28 61 63 63 | "Insufficient.funds".......((acc |
| 84200 | 20 27 64 65 70 6f 73 69 74 29 20 34 30 29 0a 20 20 20 20 20 39 30 0a 0a 20 20 20 20 20 28 28 61 | .'deposit).40)......90.......((a |
| 84220 | 63 63 20 27 77 69 74 68 64 72 61 77 29 20 36 30 29 0a 20 20 20 20 20 33 30 0a 0a 20 20 20 45 61 | cc.'withdraw).60)......30.....Ea |
| 84240 | 63 68 20 63 61 6c 6c 20 74 6f 20 60 61 63 63 27 20 72 65 74 75 72 6e 73 20 74 68 65 20 6c 6f 63 | ch.call.to.`acc'.returns.the.loc |
| 84260 | 61 6c 6c 79 20 64 65 66 69 6e 65 64 20 60 64 65 70 6f 73 69 74 27 20 6f 72 0a 60 77 69 74 68 64 | ally.defined.`deposit'.or.`withd |
| 84280 | 72 61 77 27 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 6e 20 61 70 | raw'.procedure,.which.is.then.ap |
| 842a0 | 70 6c 69 65 64 20 74 6f 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 60 61 6d 6f 75 6e 74 27 2e | plied.to.the.specified.`amount'. |
| 842c0 | 0a 41 73 20 77 61 73 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20 60 6d 61 6b 65 2d 77 69 74 68 | .As.was.the.case.with.`make-with |
| 842e0 | 64 72 61 77 27 2c 20 61 6e 6f 74 68 65 72 20 63 61 6c 6c 20 74 6f 20 60 6d 61 6b 65 2d 61 63 63 | draw',.another.call.to.`make-acc |
| 84300 | 6f 75 6e 74 27 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 61 63 63 32 20 28 6d 61 6b 65 2d 61 | ount'.......(define.acc2.(make-a |
| 84320 | 63 63 6f 75 6e 74 20 31 30 30 29 29 0a 0a 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 61 20 63 6f 6d | ccount.100))..will.produce.a.com |
| 84340 | 70 6c 65 74 65 6c 79 20 73 65 70 61 72 61 74 65 20 61 63 63 6f 75 6e 74 20 6f 62 6a 65 63 74 2c | pletely.separate.account.object, |
| 84360 | 20 77 68 69 63 68 20 6d 61 69 6e 74 61 69 6e 73 20 69 74 73 0a 6f 77 6e 20 6c 6f 63 61 6c 20 60 | .which.maintains.its.own.local.` |
| 84380 | 62 61 6c 61 6e 63 65 27 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 31 3a 2a 20 | balance'........*Exercise.3.1:*. |
| 843a0 | 41 6e 20 22 61 63 63 75 6d 75 6c 61 74 6f 72 22 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 | An."accumulator".is.a.procedure. |
| 843c0 | 74 68 61 74 20 69 73 20 63 61 6c 6c 65 64 0a 20 20 20 20 20 72 65 70 65 61 74 65 64 6c 79 20 77 | that.is.called......repeatedly.w |
| 843e0 | 69 74 68 20 61 20 73 69 6e 67 6c 65 20 6e 75 6d 65 72 69 63 20 61 72 67 75 6d 65 6e 74 20 61 6e | ith.a.single.numeric.argument.an |
| 84400 | 64 20 61 63 63 75 6d 75 6c 61 74 65 73 20 69 74 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 | d.accumulates.its......arguments |
| 84420 | 20 69 6e 74 6f 20 61 20 73 75 6d 2e 20 20 45 61 63 68 20 74 69 6d 65 20 69 74 20 69 73 20 63 61 | .into.a.sum...Each.time.it.is.ca |
| 84440 | 6c 6c 65 64 2c 20 69 74 20 72 65 74 75 72 6e 73 20 74 68 65 0a 20 20 20 20 20 63 75 72 72 65 6e | lled,.it.returns.the......curren |
| 84460 | 74 6c 79 20 61 63 63 75 6d 75 6c 61 74 65 64 20 73 75 6d 2e 20 20 57 72 69 74 65 20 61 20 70 72 | tly.accumulated.sum...Write.a.pr |
| 84480 | 6f 63 65 64 75 72 65 20 60 6d 61 6b 65 2d 61 63 63 75 6d 75 6c 61 74 6f 72 27 0a 20 20 20 20 20 | ocedure.`make-accumulator'...... |
| 844a0 | 74 68 61 74 20 67 65 6e 65 72 61 74 65 73 20 61 63 63 75 6d 75 6c 61 74 6f 72 73 2c 20 65 61 63 | that.generates.accumulators,.eac |
| 844c0 | 68 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20 61 6e 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 73 75 6d | h.maintaining.an.independent.sum |
| 844e0 | 2e 0a 20 20 20 20 20 54 68 65 20 69 6e 70 75 74 20 74 6f 20 60 6d 61 6b 65 2d 61 63 63 75 6d 75 | .......The.input.to.`make-accumu |
| 84500 | 6c 61 74 6f 72 27 20 73 68 6f 75 6c 64 20 73 70 65 63 69 66 79 20 74 68 65 20 69 6e 69 74 69 61 | lator'.should.specify.the.initia |
| 84520 | 6c 20 76 61 6c 75 65 0a 20 20 20 20 20 6f 66 20 74 68 65 20 73 75 6d 3b 20 66 6f 72 20 65 78 61 | l.value......of.the.sum;.for.exa |
| 84540 | 6d 70 6c 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 41 20 28 6d 61 6b 65 2d | mple............(define.A.(make- |
| 84560 | 61 63 63 75 6d 75 6c 61 74 6f 72 20 35 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 41 20 31 30 | accumulator.5))............(A.10 |
| 84580 | 29 0a 20 20 20 20 20 20 20 20 20 20 31 35 0a 0a 20 20 20 20 20 20 20 20 20 20 28 41 20 31 30 29 | )...........15............(A.10) |
| 845a0 | 0a 20 20 20 20 20 20 20 20 20 20 32 35 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e | ...........25.......*Exercise.3. |
| 845c0 | 32 3a 2a 20 49 6e 20 73 6f 66 74 77 61 72 65 2d 74 65 73 74 69 6e 67 20 61 70 70 6c 69 63 61 74 | 2:*.In.software-testing.applicat |
| 845e0 | 69 6f 6e 73 2c 20 69 74 20 69 73 20 75 73 65 66 75 6c 20 74 6f 0a 20 20 20 20 20 62 65 20 61 62 | ions,.it.is.useful.to......be.ab |
| 84600 | 6c 65 20 74 6f 20 63 6f 75 6e 74 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 74 69 6d 65 73 20 | le.to.count.the.number.of.times. |
| 84620 | 61 20 67 69 76 65 6e 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 63 61 6c 6c 65 64 0a 20 20 20 20 | a.given.procedure.is.called..... |
| 84640 | 20 64 75 72 69 6e 67 20 74 68 65 20 63 6f 75 72 73 65 20 6f 66 20 61 20 63 6f 6d 70 75 74 61 74 | .during.the.course.of.a.computat |
| 84660 | 69 6f 6e 2e 20 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 60 6d 61 | ion...Write.a.procedure......`ma |
| 84680 | 6b 65 2d 6d 6f 6e 69 74 6f 72 65 64 27 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 | ke-monitored'.that.takes.as.inpu |
| 846a0 | 74 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 60 66 27 2c 20 74 68 61 74 20 69 74 73 65 6c 66 0a | t.a.procedure,.`f',.that.itself. |
| 846c0 | 20 20 20 20 20 74 61 6b 65 73 20 6f 6e 65 20 69 6e 70 75 74 2e 20 20 54 68 65 20 72 65 73 75 6c | .....takes.one.input...The.resul |
| 846e0 | 74 20 72 65 74 75 72 6e 65 64 20 62 79 20 60 6d 61 6b 65 2d 6d 6f 6e 69 74 6f 72 65 64 27 20 69 | t.returned.by.`make-monitored'.i |
| 84700 | 73 20 61 0a 20 20 20 20 20 74 68 69 72 64 20 70 72 6f 63 65 64 75 72 65 2c 20 73 61 79 20 60 6d | s.a......third.procedure,.say.`m |
| 84720 | 66 27 2c 20 74 68 61 74 20 6b 65 65 70 73 20 74 72 61 63 6b 20 6f 66 20 74 68 65 20 6e 75 6d 62 | f',.that.keeps.track.of.the.numb |
| 84740 | 65 72 20 6f 66 20 74 69 6d 65 73 0a 20 20 20 20 20 69 74 20 68 61 73 20 62 65 65 6e 20 63 61 6c | er.of.times......it.has.been.cal |
| 84760 | 6c 65 64 20 62 79 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20 61 6e 20 69 6e 74 65 72 6e 61 6c 20 63 | led.by.maintaining.an.internal.c |
| 84780 | 6f 75 6e 74 65 72 2e 20 20 49 66 20 74 68 65 0a 20 20 20 20 20 69 6e 70 75 74 20 74 6f 20 60 6d | ounter...If.the......input.to.`m |
| 847a0 | 66 27 20 69 73 20 74 68 65 20 73 70 65 63 69 61 6c 20 73 79 6d 62 6f 6c 20 60 68 6f 77 2d 6d 61 | f'.is.the.special.symbol.`how-ma |
| 847c0 | 6e 79 2d 63 61 6c 6c 73 3f 27 2c 20 74 68 65 6e 20 60 6d 66 27 0a 20 20 20 20 20 72 65 74 75 72 | ny-calls?',.then.`mf'......retur |
| 847e0 | 6e 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 63 6f 75 6e 74 65 72 2e 20 20 49 66 | ns.the.value.of.the.counter...If |
| 84800 | 20 74 68 65 20 69 6e 70 75 74 20 69 73 20 74 68 65 20 73 70 65 63 69 61 6c 0a 20 20 20 20 20 73 | .the.input.is.the.special......s |
| 84820 | 79 6d 62 6f 6c 20 60 72 65 73 65 74 2d 63 6f 75 6e 74 27 2c 20 74 68 65 6e 20 60 6d 66 27 20 72 | ymbol.`reset-count',.then.`mf'.r |
| 84840 | 65 73 65 74 73 20 74 68 65 20 63 6f 75 6e 74 65 72 20 74 6f 20 7a 65 72 6f 2e 20 20 46 6f 72 0a | esets.the.counter.to.zero...For. |
| 84860 | 20 20 20 20 20 61 6e 79 20 6f 74 68 65 72 20 69 6e 70 75 74 2c 20 60 6d 66 27 20 72 65 74 75 72 | .....any.other.input,.`mf'.retur |
| 84880 | 6e 73 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 63 61 6c 6c 69 6e 67 20 60 66 27 20 6f 6e 20 | ns.the.result.of.calling.`f'.on. |
| 848a0 | 74 68 61 74 0a 20 20 20 20 20 69 6e 70 75 74 20 61 6e 64 20 69 6e 63 72 65 6d 65 6e 74 73 20 74 | that......input.and.increments.t |
| 848c0 | 68 65 20 63 6f 75 6e 74 65 72 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 77 65 20 63 6f | he.counter...For.instance,.we.co |
| 848e0 | 75 6c 64 20 6d 61 6b 65 20 61 0a 20 20 20 20 20 6d 6f 6e 69 74 6f 72 65 64 20 76 65 72 73 69 6f | uld.make.a......monitored.versio |
| 84900 | 6e 20 6f 66 20 74 68 65 20 60 73 71 72 74 27 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 | n.of.the.`sqrt'.procedure:...... |
| 84920 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 20 28 6d 61 6b 65 2d 6d 6f 6e 69 74 6f 72 65 64 20 | ......(define.s.(make-monitored. |
| 84940 | 73 71 72 74 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 20 31 30 30 29 0a 20 20 20 20 20 20 | sqrt))............(s.100)....... |
| 84960 | 20 20 20 20 31 30 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 20 27 68 6f 77 2d 6d 61 6e 79 2d 63 | ....10............(s.'how-many-c |
| 84980 | 61 6c 6c 73 3f 29 0a 20 20 20 20 20 20 20 20 20 20 31 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | alls?)...........1.......*Exerci |
| 849a0 | 73 65 20 33 2e 33 3a 2a 20 4d 6f 64 69 66 79 20 74 68 65 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e | se.3.3:*.Modify.the.`make-accoun |
| 849c0 | 74 27 20 70 72 6f 63 65 64 75 72 65 20 73 6f 20 74 68 61 74 20 69 74 0a 20 20 20 20 20 63 72 65 | t'.procedure.so.that.it......cre |
| 849e0 | 61 74 65 73 20 70 61 73 73 77 6f 72 64 2d 70 72 6f 74 65 63 74 65 64 20 61 63 63 6f 75 6e 74 73 | ates.password-protected.accounts |
| 84a00 | 2e 20 20 54 68 61 74 20 69 73 2c 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 0a 20 20 20 20 20 | ...That.is,.`make-account'...... |
| 84a20 | 73 68 6f 75 6c 64 20 74 61 6b 65 20 61 20 73 79 6d 62 6f 6c 20 61 73 20 61 6e 20 61 64 64 69 74 | should.take.a.symbol.as.an.addit |
| 84a40 | 69 6f 6e 61 6c 20 61 72 67 75 6d 65 6e 74 2c 20 61 73 20 69 6e 0a 0a 20 20 20 20 20 20 20 20 20 | ional.argument,.as.in........... |
| 84a60 | 20 28 64 65 66 69 6e 65 20 61 63 63 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 31 30 30 20 27 | .(define.acc.(make-account.100.' |
| 84a80 | 73 65 63 72 65 74 2d 70 61 73 73 77 6f 72 64 29 29 0a 0a 20 20 20 20 20 54 68 65 20 72 65 73 75 | secret-password)).......The.resu |
| 84aa0 | 6c 74 69 6e 67 20 61 63 63 6f 75 6e 74 20 6f 62 6a 65 63 74 20 73 68 6f 75 6c 64 20 70 72 6f 63 | lting.account.object.should.proc |
| 84ac0 | 65 73 73 20 61 20 72 65 71 75 65 73 74 20 6f 6e 6c 79 20 69 66 20 69 74 0a 20 20 20 20 20 69 73 | ess.a.request.only.if.it......is |
| 84ae0 | 20 61 63 63 6f 6d 70 61 6e 69 65 64 20 62 79 20 74 68 65 20 70 61 73 73 77 6f 72 64 20 77 69 74 | .accompanied.by.the.password.wit |
| 84b00 | 68 20 77 68 69 63 68 20 74 68 65 20 61 63 63 6f 75 6e 74 20 77 61 73 20 63 72 65 61 74 65 64 2c | h.which.the.account.was.created, |
| 84b20 | 0a 20 20 20 20 20 61 6e 64 20 73 68 6f 75 6c 64 20 6f 74 68 65 72 77 69 73 65 20 72 65 74 75 72 | ......and.should.otherwise.retur |
| 84b40 | 6e 20 61 20 63 6f 6d 70 6c 61 69 6e 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 61 63 63 20 | n.a.complaint:............((acc. |
| 84b60 | 27 73 65 63 72 65 74 2d 70 61 73 73 77 6f 72 64 20 27 77 69 74 68 64 72 61 77 29 20 34 30 29 0a | 'secret-password.'withdraw).40). |
| 84b80 | 20 20 20 20 20 20 20 20 20 20 36 30 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 61 63 63 20 27 73 | ..........60............((acc.'s |
| 84ba0 | 6f 6d 65 2d 6f 74 68 65 72 2d 70 61 73 73 77 6f 72 64 20 27 64 65 70 6f 73 69 74 29 20 35 30 29 | ome-other-password.'deposit).50) |
| 84bc0 | 0a 20 20 20 20 20 20 20 20 20 20 22 49 6e 63 6f 72 72 65 63 74 20 70 61 73 73 77 6f 72 64 22 0a | ..........."Incorrect.password". |
| 84be0 | 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 34 3a 2a 20 4d 6f 64 69 66 79 20 74 68 65 | ......*Exercise.3.4:*.Modify.the |
| 84c00 | 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 2a 4e 6f | .`make-account'.procedure.of.*No |
| 84c20 | 74 65 0a 20 20 20 20 20 45 78 65 72 63 69 73 65 20 33 2d 33 3a 3a 20 62 79 20 61 64 64 69 6e 67 | te......Exercise.3-3::.by.adding |
| 84c40 | 20 61 6e 6f 74 68 65 72 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 20 73 6f | .another.local.state.variable.so |
| 84c60 | 20 74 68 61 74 2c 20 69 66 0a 20 20 20 20 20 61 6e 20 61 63 63 6f 75 6e 74 20 69 73 20 61 63 63 | .that,.if......an.account.is.acc |
| 84c80 | 65 73 73 65 64 20 6d 6f 72 65 20 74 68 61 6e 20 73 65 76 65 6e 20 63 6f 6e 73 65 63 75 74 69 76 | essed.more.than.seven.consecutiv |
| 84ca0 | 65 20 74 69 6d 65 73 20 77 69 74 68 20 61 6e 0a 20 20 20 20 20 69 6e 63 6f 72 72 65 63 74 20 70 | e.times.with.an......incorrect.p |
| 84cc0 | 61 73 73 77 6f 72 64 2c 20 69 74 20 69 6e 76 6f 6b 65 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 | assword,.it.invokes.the.procedur |
| 84ce0 | 65 20 60 63 61 6c 6c 2d 74 68 65 2d 63 6f 70 73 27 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d | e.`call-the-cops'......--------- |
| 84d00 | 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 41 | -.Footnotes.----------.....(1).A |
| 84d20 | 63 74 75 61 6c 6c 79 2c 20 74 68 69 73 20 69 73 20 6e 6f 74 20 71 75 69 74 65 20 74 72 75 65 2e | ctually,.this.is.not.quite.true. |
| 84d40 | 20 20 4f 6e 65 20 65 78 63 65 70 74 69 6f 6e 20 77 61 73 20 74 68 65 0a 72 61 6e 64 6f 6d 2d 6e | ..One.exception.was.the.random-n |
| 84d60 | 75 6d 62 65 72 20 67 65 6e 65 72 61 74 6f 72 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | umber.generator.in.section.*Note |
| 84d80 | 20 31 2d 32 2d 36 3a 3a 2e 20 20 41 6e 6f 74 68 65 72 20 65 78 63 65 70 74 69 6f 6e 0a 69 6e 76 | .1-2-6::...Another.exception.inv |
| 84da0 | 6f 6c 76 65 64 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 2f 74 79 70 65 20 74 61 62 6c 65 73 20 | olved.the.operation/type.tables. |
| 84dc0 | 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 32 | we.introduced.in.section.*Note.2 |
| 84de0 | 2d 34 2d 33 3a 3a 2c 20 77 68 65 72 65 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 77 6f 20 | -4-3::,.where.the.values.of.two. |
| 84e00 | 63 61 6c 6c 73 20 74 6f 20 60 67 65 74 27 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 61 72 67 | calls.to.`get'.with.the.same.arg |
| 84e20 | 75 6d 65 6e 74 73 0a 64 65 70 65 6e 64 65 64 20 6f 6e 20 69 6e 74 65 72 76 65 6e 69 6e 67 20 63 | uments.depended.on.intervening.c |
| 84e40 | 61 6c 6c 73 20 74 6f 20 60 70 75 74 27 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e | alls.to.`put'...On.the.other.han |
| 84e60 | 64 2c 20 75 6e 74 69 6c 20 77 65 0a 69 6e 74 72 6f 64 75 63 65 20 61 73 73 69 67 6e 6d 65 6e 74 | d,.until.we.introduce.assignment |
| 84e80 | 2c 20 77 65 20 68 61 76 65 20 6e 6f 20 77 61 79 20 74 6f 20 63 72 65 61 74 65 20 73 75 63 68 20 | ,.we.have.no.way.to.create.such. |
| 84ea0 | 70 72 6f 63 65 64 75 72 65 73 0a 6f 75 72 73 65 6c 76 65 73 2e 0a 0a 20 20 20 28 32 29 20 54 68 | procedures.ourselves......(2).Th |
| 84ec0 | 65 20 76 61 6c 75 65 20 6f 66 20 61 20 60 73 65 74 21 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 | e.value.of.a.`set!'.expression.i |
| 84ee0 | 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2d 64 65 70 65 6e 64 65 6e 74 2e 0a 60 53 65 74 | s.implementation-dependent..`Set |
| 84f00 | 21 27 20 73 68 6f 75 6c 64 20 62 65 20 75 73 65 64 20 6f 6e 6c 79 20 66 6f 72 20 69 74 73 20 65 | !'.should.be.used.only.for.its.e |
| 84f20 | 66 66 65 63 74 2c 20 6e 6f 74 20 66 6f 72 20 69 74 73 20 76 61 6c 75 65 2e 0a 0a 20 20 20 54 68 | ffect,.not.for.its.value......Th |
| 84f40 | 65 20 6e 61 6d 65 20 60 73 65 74 21 27 20 72 65 66 6c 65 63 74 73 20 61 20 6e 61 6d 69 6e 67 20 | e.name.`set!'.reflects.a.naming. |
| 84f60 | 63 6f 6e 76 65 6e 74 69 6f 6e 20 75 73 65 64 20 69 6e 20 53 63 68 65 6d 65 3a 0a 4f 70 65 72 61 | convention.used.in.Scheme:.Opera |
| 84f80 | 74 69 6f 6e 73 20 74 68 61 74 20 63 68 61 6e 67 65 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 | tions.that.change.the.values.of. |
| 84fa0 | 76 61 72 69 61 62 6c 65 73 20 28 6f 72 20 74 68 61 74 20 63 68 61 6e 67 65 20 64 61 74 61 0a 73 | variables.(or.that.change.data.s |
| 84fc0 | 74 72 75 63 74 75 72 65 73 2c 20 61 73 20 77 65 20 77 69 6c 6c 20 73 65 65 20 69 6e 20 73 65 63 | tructures,.as.we.will.see.in.sec |
| 84fe0 | 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 33 3a 3a 29 20 61 72 65 20 67 69 76 65 6e 20 6e 61 6d 65 | tion.*Note.3-3::).are.given.name |
| 85000 | 73 20 74 68 61 74 0a 65 6e 64 20 77 69 74 68 20 61 6e 20 65 78 63 6c 61 6d 61 74 69 6f 6e 20 70 | s.that.end.with.an.exclamation.p |
| 85020 | 6f 69 6e 74 2e 20 20 54 68 69 73 20 69 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 63 6f | oint...This.is.similar.to.the.co |
| 85040 | 6e 76 65 6e 74 69 6f 6e 20 6f 66 0a 64 65 73 69 67 6e 61 74 69 6e 67 20 70 72 65 64 69 63 61 74 | nvention.of.designating.predicat |
| 85060 | 65 73 20 62 79 20 6e 61 6d 65 73 20 74 68 61 74 20 65 6e 64 20 77 69 74 68 20 61 20 71 75 65 73 | es.by.names.that.end.with.a.ques |
| 85080 | 74 69 6f 6e 20 6d 61 72 6b 2e 0a 0a 20 20 20 28 33 29 20 57 65 20 68 61 76 65 20 61 6c 72 65 61 | tion.mark......(3).We.have.alrea |
| 850a0 | 64 79 20 75 73 65 64 20 60 62 65 67 69 6e 27 20 69 6d 70 6c 69 63 69 74 6c 79 20 69 6e 20 6f 75 | dy.used.`begin'.implicitly.in.ou |
| 850c0 | 72 20 70 72 6f 67 72 61 6d 73 2c 20 62 65 63 61 75 73 65 0a 69 6e 20 53 63 68 65 6d 65 20 74 68 | r.programs,.because.in.Scheme.th |
| 850e0 | 65 20 62 6f 64 79 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 63 61 6e 20 62 65 20 61 20 73 | e.body.of.a.procedure.can.be.a.s |
| 85100 | 65 71 75 65 6e 63 65 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 0a 41 6c 73 6f 2c 20 74 68 | equence.of.expressions..Also,.th |
| 85120 | 65 20 3c 43 4f 4e 53 45 51 55 45 4e 54 3e 20 70 61 72 74 20 6f 66 20 65 61 63 68 20 63 6c 61 75 | e.<CONSEQUENT>.part.of.each.clau |
| 85140 | 73 65 20 69 6e 20 61 20 60 63 6f 6e 64 27 20 65 78 70 72 65 73 73 69 6f 6e 20 63 61 6e 0a 62 65 | se.in.a.`cond'.expression.can.be |
| 85160 | 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 20 72 61 74 68 65 | .a.sequence.of.expressions.rathe |
| 85180 | 72 20 74 68 61 6e 20 61 20 73 69 6e 67 6c 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 0a 20 20 20 | r.than.a.single.expression...... |
| 851a0 | 28 34 29 20 49 6e 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2d 6c 61 6e 67 75 61 67 65 20 6a 61 72 67 | (4).In.programming-language.jarg |
| 851c0 | 6f 6e 2c 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 60 62 61 6c 61 6e 63 65 27 20 69 73 20 73 61 | on,.the.variable.`balance'.is.sa |
| 851e0 | 69 64 0a 74 6f 20 62 65 20 22 65 6e 63 61 70 73 75 6c 61 74 65 64 22 20 77 69 74 68 69 6e 20 74 | id.to.be."encapsulated".within.t |
| 85200 | 68 65 20 60 6e 65 77 2d 77 69 74 68 64 72 61 77 27 20 70 72 6f 63 65 64 75 72 65 2e 0a 45 6e 63 | he.`new-withdraw'.procedure..Enc |
| 85220 | 61 70 73 75 6c 61 74 69 6f 6e 20 72 65 66 6c 65 63 74 73 20 74 68 65 20 67 65 6e 65 72 61 6c 20 | apsulation.reflects.the.general. |
| 85240 | 73 79 73 74 65 6d 2d 64 65 73 69 67 6e 20 70 72 69 6e 63 69 70 6c 65 20 6b 6e 6f 77 6e 20 61 73 | system-design.principle.known.as |
| 85260 | 20 74 68 65 20 22 68 69 64 69 6e 67 0a 70 72 69 6e 63 69 70 6c 65 22 3a 20 4f 6e 65 20 63 61 6e | .the."hiding.principle":.One.can |
| 85280 | 20 6d 61 6b 65 20 61 20 73 79 73 74 65 6d 20 6d 6f 72 65 20 6d 6f 64 75 6c 61 72 20 61 6e 64 20 | .make.a.system.more.modular.and. |
| 852a0 | 72 6f 62 75 73 74 20 62 79 20 70 72 6f 74 65 63 74 69 6e 67 0a 70 61 72 74 73 20 6f 66 20 74 68 | robust.by.protecting.parts.of.th |
| 852c0 | 65 20 73 79 73 74 65 6d 20 66 72 6f 6d 20 65 61 63 68 20 6f 74 68 65 72 3b 20 74 68 61 74 20 69 | e.system.from.each.other;.that.i |
| 852e0 | 73 2c 20 62 79 20 70 72 6f 76 69 64 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 61 63 63 65 | s,.by.providing.information.acce |
| 85300 | 73 73 20 6f 6e 6c 79 20 74 6f 20 74 68 6f 73 65 20 70 61 72 74 73 20 6f 66 20 74 68 65 20 73 79 | ss.only.to.those.parts.of.the.sy |
| 85320 | 73 74 65 6d 20 74 68 61 74 20 68 61 76 65 20 61 20 22 6e 65 65 64 20 74 6f 20 6b 6e 6f 77 2e 22 | stem.that.have.a."need.to.know." |
| 85340 | 0a 0a 20 20 20 28 35 29 20 49 6e 20 63 6f 6e 74 72 61 73 74 20 77 69 74 68 20 60 6e 65 77 2d 77 | .....(5).In.contrast.with.`new-w |
| 85360 | 69 74 68 64 72 61 77 27 20 61 62 6f 76 65 2c 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 76 65 20 74 | ithdraw'.above,.we.do.not.have.t |
| 85380 | 6f 20 75 73 65 0a 60 6c 65 74 27 20 74 6f 20 6d 61 6b 65 20 60 62 61 6c 61 6e 63 65 27 20 61 20 | o.use.`let'.to.make.`balance'.a. |
| 853a0 | 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 2c 20 73 69 6e 63 65 20 66 6f 72 6d 61 6c 20 70 61 72 | local.variable,.since.formal.par |
| 853c0 | 61 6d 65 74 65 72 73 20 61 72 65 0a 61 6c 72 65 61 64 79 20 6c 6f 63 61 6c 2e 20 20 54 68 69 73 | ameters.are.already.local...This |
| 853e0 | 20 77 69 6c 6c 20 62 65 20 63 6c 65 61 72 65 72 20 61 66 74 65 72 20 74 68 65 20 64 69 73 63 75 | .will.be.clearer.after.the.discu |
| 85400 | 73 73 69 6f 6e 20 6f 66 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 20 6f | ssion.of.the.environment.model.o |
| 85420 | 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d | f.evaluation.in.section.*Note.3- |
| 85440 | 32 3a 3a 2e 20 20 28 53 65 65 20 61 6c 73 6f 0a 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 | 2::...(See.also.*Note.Exercise.3 |
| 85460 | 2d 31 30 3a 3a 2e 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 | -10::.)....File:.sicp.info,..Nod |
| 85480 | 65 3a 20 33 2d 31 2d 32 2c 20 20 4e 65 78 74 3a 20 33 2d 31 2d 33 2c 20 20 50 72 65 76 3a 20 33 | e:.3-1-2,..Next:.3-1-3,..Prev:.3 |
| 854a0 | 2d 31 2d 31 2c 20 20 55 70 3a 20 33 2d 31 0a 0a 33 2e 31 2e 32 20 54 68 65 20 42 65 6e 65 66 69 | -1-1,..Up:.3-1..3.1.2.The.Benefi |
| 854c0 | 74 73 20 6f 66 20 49 6e 74 72 6f 64 75 63 69 6e 67 20 41 73 73 69 67 6e 6d 65 6e 74 0a 2d 2d 2d | ts.of.Introducing.Assignment.--- |
| 854e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 85500 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 41 73 20 77 65 20 73 68 61 6c 6c 20 73 65 65 2c 20 69 6e 74 72 | ---------..As.we.shall.see,.intr |
| 85520 | 6f 64 75 63 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e 74 20 69 6e 74 6f 20 6f 75 72 20 70 72 6f 67 | oducing.assignment.into.our.prog |
| 85540 | 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 0a 6c 65 61 64 73 20 75 73 20 69 6e 74 6f 20 61 | ramming.language.leads.us.into.a |
| 85560 | 20 74 68 69 63 6b 65 74 20 6f 66 20 64 69 66 66 69 63 75 6c 74 20 63 6f 6e 63 65 70 74 75 61 6c | .thicket.of.difficult.conceptual |
| 85580 | 20 69 73 73 75 65 73 2e 20 20 4e 65 76 65 72 74 68 65 6c 65 73 73 2c 0a 76 69 65 77 69 6e 67 20 | .issues...Nevertheless,.viewing. |
| 855a0 | 73 79 73 74 65 6d 73 20 61 73 20 63 6f 6c 6c 65 63 74 69 6f 6e 73 20 6f 66 20 6f 62 6a 65 63 74 | systems.as.collections.of.object |
| 855c0 | 73 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 69 73 20 61 0a 70 6f 77 65 72 66 75 6c | s.with.local.state.is.a.powerful |
| 855e0 | 20 74 65 63 68 6e 69 71 75 65 20 66 6f 72 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20 61 20 6d 6f 64 | .technique.for.maintaining.a.mod |
| 85600 | 75 6c 61 72 20 64 65 73 69 67 6e 2e 20 20 41 73 20 61 20 73 69 6d 70 6c 65 0a 65 78 61 6d 70 6c | ular.design...As.a.simple.exampl |
| 85620 | 65 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 64 65 73 69 67 6e 20 6f 66 20 61 20 70 72 6f 63 | e,.consider.the.design.of.a.proc |
| 85640 | 65 64 75 72 65 20 60 72 61 6e 64 27 20 74 68 61 74 2c 20 77 68 65 6e 65 76 65 72 20 69 74 20 69 | edure.`rand'.that,.whenever.it.i |
| 85660 | 73 0a 63 61 6c 6c 65 64 2c 20 72 65 74 75 72 6e 73 20 61 6e 20 69 6e 74 65 67 65 72 20 63 68 6f | s.called,.returns.an.integer.cho |
| 85680 | 73 65 6e 20 61 74 20 72 61 6e 64 6f 6d 2e 0a 0a 20 20 20 49 74 20 69 73 20 6e 6f 74 20 61 74 20 | sen.at.random......It.is.not.at. |
| 856a0 | 61 6c 6c 20 63 6c 65 61 72 20 77 68 61 74 20 69 73 20 6d 65 61 6e 74 20 62 79 20 22 63 68 6f 73 | all.clear.what.is.meant.by."chos |
| 856c0 | 65 6e 20 61 74 20 72 61 6e 64 6f 6d 2e 22 20 20 57 68 61 74 20 77 65 0a 70 72 65 73 75 6d 61 62 | en.at.random."..What.we.presumab |
| 856e0 | 6c 79 20 77 61 6e 74 20 69 73 20 66 6f 72 20 73 75 63 63 65 73 73 69 76 65 20 63 61 6c 6c 73 20 | ly.want.is.for.successive.calls. |
| 85700 | 74 6f 20 60 72 61 6e 64 27 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 73 65 71 75 65 6e 63 65 0a | to.`rand'.to.produce.a.sequence. |
| 85720 | 6f 66 20 6e 75 6d 62 65 72 73 20 74 68 61 74 20 68 61 73 20 73 74 61 74 69 73 74 69 63 61 6c 20 | of.numbers.that.has.statistical. |
| 85740 | 70 72 6f 70 65 72 74 69 65 73 20 6f 66 20 75 6e 69 66 6f 72 6d 20 64 69 73 74 72 69 62 75 74 69 | properties.of.uniform.distributi |
| 85760 | 6f 6e 2e 20 20 57 65 0a 77 69 6c 6c 20 6e 6f 74 20 64 69 73 63 75 73 73 20 6d 65 74 68 6f 64 73 | on...We.will.not.discuss.methods |
| 85780 | 20 66 6f 72 20 67 65 6e 65 72 61 74 69 6e 67 20 73 75 69 74 61 62 6c 65 20 73 65 71 75 65 6e 63 | .for.generating.suitable.sequenc |
| 857a0 | 65 73 20 68 65 72 65 2e 0a 52 61 74 68 65 72 2c 20 6c 65 74 20 75 73 20 61 73 73 75 6d 65 20 74 | es.here..Rather,.let.us.assume.t |
| 857c0 | 68 61 74 20 77 65 20 68 61 76 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 72 61 6e 64 2d 75 70 | hat.we.have.a.procedure.`rand-up |
| 857e0 | 64 61 74 65 27 20 74 68 61 74 20 68 61 73 0a 74 68 65 20 70 72 6f 70 65 72 74 79 20 74 68 61 74 | date'.that.has.the.property.that |
| 85800 | 20 69 66 20 77 65 20 73 74 61 72 74 20 77 69 74 68 20 61 20 67 69 76 65 6e 20 6e 75 6d 62 65 72 | .if.we.start.with.a.given.number |
| 85820 | 20 78 5f 31 20 61 6e 64 20 66 6f 72 6d 0a 0a 20 20 20 20 20 78 5f 32 20 3d 20 28 72 61 6e 64 2d | .x_1.and.form.......x_2.=.(rand- |
| 85840 | 75 70 64 61 74 65 20 78 5f 31 29 0a 20 20 20 20 20 78 5f 33 20 3d 20 28 72 61 6e 64 2d 75 70 64 | update.x_1)......x_3.=.(rand-upd |
| 85860 | 61 74 65 20 78 5f 32 29 0a 0a 74 68 65 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 76 | ate.x_2)..then.the.sequence.of.v |
| 85880 | 61 6c 75 65 73 20 78 5f 31 2c 20 78 5f 32 2c 20 78 5f 33 2c 20 2e 2e 2e 2c 20 77 69 6c 6c 20 68 | alues.x_1,.x_2,.x_3,....,.will.h |
| 858a0 | 61 76 65 20 74 68 65 20 64 65 73 69 72 65 64 0a 73 74 61 74 69 73 74 69 63 61 6c 20 70 72 6f 70 | ave.the.desired.statistical.prop |
| 858c0 | 65 72 74 69 65 73 2e 28 31 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 | erties.(1).....We.can.implement. |
| 858e0 | 60 72 61 6e 64 27 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 61 20 6c 6f 63 | `rand'.as.a.procedure.with.a.loc |
| 85900 | 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 0a 60 78 27 20 74 68 61 74 20 69 73 20 69 6e | al.state.variable.`x'.that.is.in |
| 85920 | 69 74 69 61 6c 69 7a 65 64 20 74 6f 20 73 6f 6d 65 20 66 69 78 65 64 20 76 61 6c 75 65 20 60 72 | itialized.to.some.fixed.value.`r |
| 85940 | 61 6e 64 6f 6d 2d 69 6e 69 74 27 2e 20 20 45 61 63 68 20 63 61 6c 6c 0a 74 6f 20 60 72 61 6e 64 | andom-init'...Each.call.to.`rand |
| 85960 | 27 20 63 6f 6d 70 75 74 65 73 20 60 72 61 6e 64 2d 75 70 64 61 74 65 27 20 6f 66 20 74 68 65 20 | '.computes.`rand-update'.of.the. |
| 85980 | 63 75 72 72 65 6e 74 20 76 61 6c 75 65 20 6f 66 20 60 78 27 2c 20 72 65 74 75 72 6e 73 0a 74 68 | current.value.of.`x',.returns.th |
| 859a0 | 69 73 20 61 73 20 74 68 65 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 2c 20 61 6e 64 20 61 6c 73 | is.as.the.random.number,.and.als |
| 859c0 | 6f 20 73 74 6f 72 65 73 20 74 68 69 73 20 61 73 20 74 68 65 20 6e 65 77 20 76 61 6c 75 65 20 6f | o.stores.this.as.the.new.value.o |
| 859e0 | 66 20 60 78 27 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 72 61 6e 64 0a 20 20 20 20 20 20 | f.`x'........(define.rand....... |
| 85a00 | 20 28 6c 65 74 20 28 28 78 20 72 61 6e 64 6f 6d 2d 69 6e 69 74 29 29 0a 20 20 20 20 20 20 20 20 | .(let.((x.random-init))......... |
| 85a20 | 20 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 78 20 28 | .(lambda.()............(set!.x.( |
| 85a40 | 72 61 6e 64 2d 75 70 64 61 74 65 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 78 29 29 29 0a | rand-update.x))............x))). |
| 85a60 | 0a 20 20 20 4f 66 20 63 6f 75 72 73 65 2c 20 77 65 20 63 6f 75 6c 64 20 67 65 6e 65 72 61 74 65 | ....Of.course,.we.could.generate |
| 85a80 | 20 74 68 65 20 73 61 6d 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 72 61 6e 64 6f 6d 20 6e 75 6d | .the.same.sequence.of.random.num |
| 85aa0 | 62 65 72 73 0a 77 69 74 68 6f 75 74 20 75 73 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e 74 20 62 79 | bers.without.using.assignment.by |
| 85ac0 | 20 73 69 6d 70 6c 79 20 63 61 6c 6c 69 6e 67 20 60 72 61 6e 64 2d 75 70 64 61 74 65 27 20 64 69 | .simply.calling.`rand-update'.di |
| 85ae0 | 72 65 63 74 6c 79 2e 0a 48 6f 77 65 76 65 72 2c 20 74 68 69 73 20 77 6f 75 6c 64 20 6d 65 61 6e | rectly..However,.this.would.mean |
| 85b00 | 20 74 68 61 74 20 61 6e 79 20 70 61 72 74 20 6f 66 20 6f 75 72 20 70 72 6f 67 72 61 6d 20 74 68 | .that.any.part.of.our.program.th |
| 85b20 | 61 74 20 75 73 65 64 20 72 61 6e 64 6f 6d 0a 6e 75 6d 62 65 72 73 20 77 6f 75 6c 64 20 68 61 76 | at.used.random.numbers.would.hav |
| 85b40 | 65 20 74 6f 20 65 78 70 6c 69 63 69 74 6c 79 20 72 65 6d 65 6d 62 65 72 20 74 68 65 20 63 75 72 | e.to.explicitly.remember.the.cur |
| 85b60 | 72 65 6e 74 20 76 61 6c 75 65 20 6f 66 20 60 78 27 20 74 6f 0a 62 65 20 70 61 73 73 65 64 20 61 | rent.value.of.`x'.to.be.passed.a |
| 85b80 | 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 60 72 61 6e 64 2d 75 70 64 61 74 65 27 2e 20 | s.an.argument.to.`rand-update'.. |
| 85ba0 | 20 54 6f 20 72 65 61 6c 69 7a 65 20 77 68 61 74 20 61 6e 0a 61 6e 6e 6f 79 61 6e 63 65 20 74 68 | .To.realize.what.an.annoyance.th |
| 85bc0 | 69 73 20 77 6f 75 6c 64 20 62 65 2c 20 63 6f 6e 73 69 64 65 72 20 75 73 69 6e 67 20 72 61 6e 64 | is.would.be,.consider.using.rand |
| 85be0 | 6f 6d 20 6e 75 6d 62 65 72 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 61 0a 74 65 63 68 6e 69 | om.numbers.to.implement.a.techni |
| 85c00 | 71 75 65 20 63 61 6c 6c 65 64 20 73 69 6d 75 6c 61 74 69 6f 6e 20 22 4d 6f 6e 74 65 20 43 61 72 | que.called.simulation."Monte.Car |
| 85c20 | 6c 6f 20 73 69 6d 75 6c 61 74 69 6f 6e 22 2e 0a 0a 20 20 20 54 68 65 20 4d 6f 6e 74 65 20 43 61 | lo.simulation"......The.Monte.Ca |
| 85c40 | 72 6c 6f 20 6d 65 74 68 6f 64 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 63 68 6f 6f 73 69 6e 67 20 | rlo.method.consists.of.choosing. |
| 85c60 | 73 61 6d 70 6c 65 20 65 78 70 65 72 69 6d 65 6e 74 73 20 61 74 0a 72 61 6e 64 6f 6d 20 66 72 6f | sample.experiments.at.random.fro |
| 85c80 | 6d 20 61 20 6c 61 72 67 65 20 73 65 74 20 61 6e 64 20 74 68 65 6e 20 6d 61 6b 69 6e 67 20 64 65 | m.a.large.set.and.then.making.de |
| 85ca0 | 64 75 63 74 69 6f 6e 73 20 6f 6e 20 74 68 65 20 62 61 73 69 73 20 6f 66 20 74 68 65 0a 70 72 6f | ductions.on.the.basis.of.the.pro |
| 85cc0 | 62 61 62 69 6c 69 74 69 65 73 20 65 73 74 69 6d 61 74 65 64 20 66 72 6f 6d 20 74 61 62 75 6c 61 | babilities.estimated.from.tabula |
| 85ce0 | 74 69 6e 67 20 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 20 74 68 6f 73 65 0a 65 78 70 65 72 69 | ting.the.results.of.those.experi |
| 85d00 | 6d 65 6e 74 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 61 70 70 72 | ments...For.example,.we.can.appr |
| 85d20 | 6f 78 69 6d 61 74 65 20 5b 70 69 5d 20 75 73 69 6e 67 20 74 68 65 20 66 61 63 74 20 74 68 61 74 | oximate.[pi].using.the.fact.that |
| 85d40 | 0a 36 2f 5b 70 69 5d 5e 32 20 69 73 20 74 68 65 20 70 72 6f 62 61 62 69 6c 69 74 79 20 74 68 61 | .6/[pi]^2.is.the.probability.tha |
| 85d60 | 74 20 74 77 6f 20 69 6e 74 65 67 65 72 73 20 63 68 6f 73 65 6e 20 61 74 20 72 61 6e 64 6f 6d 20 | t.two.integers.chosen.at.random. |
| 85d80 | 77 69 6c 6c 0a 68 61 76 65 20 6e 6f 20 66 61 63 74 6f 72 73 20 69 6e 20 63 6f 6d 6d 6f 6e 3b 20 | will.have.no.factors.in.common;. |
| 85da0 | 74 68 61 74 20 69 73 2c 20 74 68 61 74 20 74 68 65 69 72 20 67 72 65 61 74 65 73 74 20 63 6f 6d | that.is,.that.their.greatest.com |
| 85dc0 | 6d 6f 6e 20 64 69 76 69 73 6f 72 0a 77 69 6c 6c 20 62 65 20 31 2e 28 32 29 20 54 6f 20 6f 62 74 | mon.divisor.will.be.1.(2).To.obt |
| 85de0 | 61 69 6e 20 74 68 65 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 20 74 6f 20 5b 70 69 5d 2c 20 77 | ain.the.approximation.to.[pi],.w |
| 85e00 | 65 20 70 65 72 66 6f 72 6d 20 61 20 6c 61 72 67 65 0a 6e 75 6d 62 65 72 20 6f 66 20 65 78 70 65 | e.perform.a.large.number.of.expe |
| 85e20 | 72 69 6d 65 6e 74 73 2e 20 20 49 6e 20 65 61 63 68 20 65 78 70 65 72 69 6d 65 6e 74 20 77 65 20 | riments...In.each.experiment.we. |
| 85e40 | 63 68 6f 6f 73 65 20 74 77 6f 20 69 6e 74 65 67 65 72 73 20 61 74 0a 72 61 6e 64 6f 6d 20 61 6e | choose.two.integers.at.random.an |
| 85e60 | 64 20 70 65 72 66 6f 72 6d 20 61 20 74 65 73 74 20 74 6f 20 73 65 65 20 69 66 20 74 68 65 69 72 | d.perform.a.test.to.see.if.their |
| 85e80 | 20 47 43 44 20 69 73 20 31 2e 20 20 54 68 65 20 66 72 61 63 74 69 6f 6e 20 6f 66 0a 74 69 6d 65 | .GCD.is.1...The.fraction.of.time |
| 85ea0 | 73 20 74 68 61 74 20 74 68 65 20 74 65 73 74 20 69 73 20 70 61 73 73 65 64 20 67 69 76 65 73 20 | s.that.the.test.is.passed.gives. |
| 85ec0 | 75 73 20 6f 75 72 20 65 73 74 69 6d 61 74 65 20 6f 66 20 36 2f 5b 70 69 5d 5e 32 2c 20 61 6e 64 | us.our.estimate.of.6/[pi]^2,.and |
| 85ee0 | 0a 66 72 6f 6d 20 74 68 69 73 20 77 65 20 6f 62 74 61 69 6e 20 6f 75 72 20 61 70 70 72 6f 78 69 | .from.this.we.obtain.our.approxi |
| 85f00 | 6d 61 74 69 6f 6e 20 74 6f 20 5b 70 69 5d 2e 0a 0a 20 20 20 54 68 65 20 68 65 61 72 74 20 6f 66 | mation.to.[pi]......The.heart.of |
| 85f20 | 20 6f 75 72 20 70 72 6f 67 72 61 6d 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 6d 6f 6e | .our.program.is.a.procedure.`mon |
| 85f40 | 74 65 2d 63 61 72 6c 6f 27 2c 20 77 68 69 63 68 20 74 61 6b 65 73 20 61 73 0a 61 72 67 75 6d 65 | te-carlo',.which.takes.as.argume |
| 85f60 | 6e 74 73 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 74 69 6d 65 73 20 74 6f 20 74 72 79 20 61 | nts.the.number.of.times.to.try.a |
| 85f80 | 6e 20 65 78 70 65 72 69 6d 65 6e 74 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 0a | n.experiment,.together.with.the. |
| 85fa0 | 65 78 70 65 72 69 6d 65 6e 74 2c 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 6e 6f 2d | experiment,.represented.as.a.no- |
| 85fc0 | 61 72 67 75 6d 65 6e 74 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 77 69 6c 6c 20 72 65 74 | argument.procedure.that.will.ret |
| 85fe0 | 75 72 6e 0a 65 69 74 68 65 72 20 74 72 75 65 20 6f 72 20 66 61 6c 73 65 20 65 61 63 68 20 74 69 | urn.either.true.or.false.each.ti |
| 86000 | 6d 65 20 69 74 20 69 73 20 72 75 6e 2e 20 20 60 4d 6f 6e 74 65 2d 63 61 72 6c 6f 27 20 72 75 6e | me.it.is.run...`Monte-carlo'.run |
| 86020 | 73 20 74 68 65 0a 65 78 70 65 72 69 6d 65 6e 74 20 66 6f 72 20 74 68 65 20 64 65 73 69 67 6e 61 | s.the.experiment.for.the.designa |
| 86040 | 74 65 64 20 6e 75 6d 62 65 72 20 6f 66 20 74 72 69 61 6c 73 20 61 6e 64 20 72 65 74 75 72 6e 73 | ted.number.of.trials.and.returns |
| 86060 | 20 61 20 6e 75 6d 62 65 72 0a 74 65 6c 6c 69 6e 67 20 74 68 65 20 66 72 61 63 74 69 6f 6e 20 6f | .a.number.telling.the.fraction.o |
| 86080 | 66 20 74 68 65 20 74 72 69 61 6c 73 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 65 78 70 65 72 69 | f.the.trials.in.which.the.experi |
| 860a0 | 6d 65 6e 74 20 77 61 73 20 66 6f 75 6e 64 20 74 6f 0a 62 65 20 74 72 75 65 2e 0a 0a 20 20 20 20 | ment.was.found.to.be.true....... |
| 860c0 | 20 28 64 65 66 69 6e 65 20 28 65 73 74 69 6d 61 74 65 2d 70 69 20 74 72 69 61 6c 73 29 0a 20 20 | .(define.(estimate-pi.trials)... |
| 860e0 | 20 20 20 20 20 28 73 71 72 74 20 28 2f 20 36 20 28 6d 6f 6e 74 65 2d 63 61 72 6c 6f 20 74 72 69 | .....(sqrt.(/.6.(monte-carlo.tri |
| 86100 | 61 6c 73 20 63 65 73 61 72 6f 2d 74 65 73 74 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | als.cesaro-test)))).......(defin |
| 86120 | 65 20 28 63 65 73 61 72 6f 2d 74 65 73 74 29 0a 20 20 20 20 20 20 20 20 28 3d 20 28 67 63 64 20 | e.(cesaro-test).........(=.(gcd. |
| 86140 | 28 72 61 6e 64 29 20 28 72 61 6e 64 29 29 20 31 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | (rand).(rand)).1)).......(define |
| 86160 | 20 28 6d 6f 6e 74 65 2d 63 61 72 6c 6f 20 74 72 69 61 6c 73 20 65 78 70 65 72 69 6d 65 6e 74 29 | .(monte-carlo.trials.experiment) |
| 86180 | 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 20 74 72 69 61 6c 73 2d 72 65 6d | ........(define.(iter.trials-rem |
| 861a0 | 61 69 6e 69 6e 67 20 74 72 69 61 6c 73 2d 70 61 73 73 65 64 29 0a 20 20 20 20 20 20 20 20 20 28 | aining.trials-passed)..........( |
| 861c0 | 63 6f 6e 64 20 28 28 3d 20 74 72 69 61 6c 73 2d 72 65 6d 61 69 6e 69 6e 67 20 30 29 0a 20 20 20 | cond.((=.trials-remaining.0).... |
| 861e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2f 20 74 72 69 61 6c 73 2d 70 61 73 73 65 64 20 74 72 | .............(/.trials-passed.tr |
| 86200 | 69 61 6c 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 78 70 65 72 69 6d 65 | ials))................((experime |
| 86220 | 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 28 2d 20 74 72 69 | nt).................(iter.(-.tri |
| 86240 | 61 6c 73 2d 72 65 6d 61 69 6e 69 6e 67 20 31 29 20 28 2b 20 74 72 69 61 6c 73 2d 70 61 73 73 65 | als-remaining.1).(+.trials-passe |
| 86260 | 64 20 31 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 | d.1)))................(else..... |
| 86280 | 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 28 2d 20 74 72 69 61 6c 73 2d 72 65 6d 61 | ............(iter.(-.trials-rema |
| 862a0 | 69 6e 69 6e 67 20 31 29 20 74 72 69 61 6c 73 2d 70 61 73 73 65 64 29 29 29 29 0a 20 20 20 20 20 | ining.1).trials-passed))))...... |
| 862c0 | 20 20 28 69 74 65 72 20 74 72 69 61 6c 73 20 30 29 29 0a 0a 20 20 20 4e 6f 77 20 6c 65 74 20 75 | ..(iter.trials.0)).....Now.let.u |
| 862e0 | 73 20 74 72 79 20 74 68 65 20 73 61 6d 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 75 73 69 6e 67 | s.try.the.same.computation.using |
| 86300 | 20 60 72 61 6e 64 2d 75 70 64 61 74 65 27 20 64 69 72 65 63 74 6c 79 0a 72 61 74 68 65 72 20 74 | .`rand-update'.directly.rather.t |
| 86320 | 68 61 6e 20 60 72 61 6e 64 27 2c 20 74 68 65 20 77 61 79 20 77 65 20 77 6f 75 6c 64 20 62 65 20 | han.`rand',.the.way.we.would.be. |
| 86340 | 66 6f 72 63 65 64 20 74 6f 20 70 72 6f 63 65 65 64 20 69 66 20 77 65 20 64 69 64 20 6e 6f 74 0a | forced.to.proceed.if.we.did.not. |
| 86360 | 75 73 65 20 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 20 6d 6f 64 65 6c 20 6c 6f 63 61 6c 20 73 74 | use.assignment.to.model.local.st |
| 86380 | 61 74 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 73 74 69 6d 61 74 65 2d 70 69 20 | ate:.......(define.(estimate-pi. |
| 863a0 | 74 72 69 61 6c 73 29 0a 20 20 20 20 20 20 20 28 73 71 72 74 20 28 2f 20 36 20 28 72 61 6e 64 6f | trials)........(sqrt.(/.6.(rando |
| 863c0 | 6d 2d 67 63 64 2d 74 65 73 74 20 74 72 69 61 6c 73 20 72 61 6e 64 6f 6d 2d 69 6e 69 74 29 29 29 | m-gcd-test.trials.random-init))) |
| 863e0 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 61 6e 64 6f 6d 2d 67 63 64 2d 74 65 73 74 | ).......(define.(random-gcd-test |
| 86400 | 20 74 72 69 61 6c 73 20 69 6e 69 74 69 61 6c 2d 78 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e | .trials.initial-x)........(defin |
| 86420 | 65 20 28 69 74 65 72 20 74 72 69 61 6c 73 2d 72 65 6d 61 69 6e 69 6e 67 20 74 72 69 61 6c 73 2d | e.(iter.trials-remaining.trials- |
| 86440 | 70 61 73 73 65 64 20 78 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 78 31 20 28 72 61 | passed.x)..........(let.((x1.(ra |
| 86460 | 6e 64 2d 75 70 64 61 74 65 20 78 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 | nd-update.x)))............(let.( |
| 86480 | 28 78 32 20 28 72 61 6e 64 2d 75 70 64 61 74 65 20 78 31 29 29 29 0a 20 20 20 20 20 20 20 20 20 | (x2.(rand-update.x1))).......... |
| 864a0 | 20 20 20 20 28 63 6f 6e 64 20 28 28 3d 20 74 72 69 61 6c 73 2d 72 65 6d 61 69 6e 69 6e 67 20 30 | ....(cond.((=.trials-remaining.0 |
| 864c0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2f 20 74 72 69 61 6c 73 2d | ).....................(/.trials- |
| 864e0 | 70 61 73 73 65 64 20 74 72 69 61 6c 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | passed.trials))................. |
| 86500 | 20 20 20 28 28 3d 20 28 67 63 64 20 78 31 20 78 32 29 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 | ...((=.(gcd.x1.x2).1)........... |
| 86520 | 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 28 2d 20 74 72 69 61 6c 73 2d 72 65 6d 61 69 6e | ..........(iter.(-.trials-remain |
| 86540 | 69 6e 67 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ing.1).......................... |
| 86560 | 20 28 2b 20 74 72 69 61 6c 73 2d 70 61 73 73 65 64 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(+.trials-passed.1)............ |
| 86580 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ...............x2))............. |
| 865a0 | 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......(else.................... |
| 865c0 | 20 28 69 74 65 72 20 28 2d 20 74 72 69 61 6c 73 2d 72 65 6d 61 69 6e 69 6e 67 20 31 29 0a 20 20 | .(iter.(-.trials-remaining.1)... |
| 865e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 69 61 6c 73 2d 70 | ........................trials-p |
| 86600 | 61 73 73 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | assed........................... |
| 86620 | 78 32 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 69 74 65 72 20 74 72 69 61 6c 73 20 30 20 69 | x2))))))........(iter.trials.0.i |
| 86640 | 6e 69 74 69 61 6c 2d 78 29 29 0a 0a 20 20 20 57 68 69 6c 65 20 74 68 65 20 70 72 6f 67 72 61 6d | nitial-x)).....While.the.program |
| 86660 | 20 69 73 20 73 74 69 6c 6c 20 73 69 6d 70 6c 65 2c 20 69 74 20 62 65 74 72 61 79 73 20 73 6f 6d | .is.still.simple,.it.betrays.som |
| 86680 | 65 20 70 61 69 6e 66 75 6c 20 62 72 65 61 63 68 65 73 0a 6f 66 20 6d 6f 64 75 6c 61 72 69 74 79 | e.painful.breaches.of.modularity |
| 866a0 | 2e 20 20 49 6e 20 6f 75 72 20 66 69 72 73 74 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 70 | ...In.our.first.version.of.the.p |
| 866c0 | 72 6f 67 72 61 6d 2c 20 75 73 69 6e 67 20 60 72 61 6e 64 27 2c 20 77 65 0a 63 61 6e 20 65 78 70 | rogram,.using.`rand',.we.can.exp |
| 866e0 | 72 65 73 73 20 74 68 65 20 4d 6f 6e 74 65 20 43 61 72 6c 6f 20 6d 65 74 68 6f 64 20 64 69 72 65 | ress.the.Monte.Carlo.method.dire |
| 86700 | 63 74 6c 79 20 61 73 20 61 20 67 65 6e 65 72 61 6c 20 60 6d 6f 6e 74 65 2d 63 61 72 6c 6f 27 0a | ctly.as.a.general.`monte-carlo'. |
| 86720 | 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 61 6e 20 61 72 67 75 6d | procedure.that.takes.as.an.argum |
| 86740 | 65 6e 74 20 61 6e 20 61 72 62 69 74 72 61 72 79 20 60 65 78 70 65 72 69 6d 65 6e 74 27 20 70 72 | ent.an.arbitrary.`experiment'.pr |
| 86760 | 6f 63 65 64 75 72 65 2e 0a 49 6e 20 6f 75 72 20 73 65 63 6f 6e 64 20 76 65 72 73 69 6f 6e 20 6f | ocedure..In.our.second.version.o |
| 86780 | 66 20 74 68 65 20 70 72 6f 67 72 61 6d 2c 20 77 69 74 68 20 6e 6f 20 6c 6f 63 61 6c 20 73 74 61 | f.the.program,.with.no.local.sta |
| 867a0 | 74 65 20 66 6f 72 20 74 68 65 0a 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 20 67 65 6e 65 72 61 74 | te.for.the.random-number.generat |
| 867c0 | 6f 72 2c 20 60 72 61 6e 64 6f 6d 2d 67 63 64 2d 74 65 73 74 27 20 6d 75 73 74 20 65 78 70 6c 69 | or,.`random-gcd-test'.must.expli |
| 867e0 | 63 69 74 6c 79 20 6d 61 6e 69 70 75 6c 61 74 65 0a 74 68 65 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 | citly.manipulate.the.random.numb |
| 86800 | 65 72 73 20 60 78 31 27 20 61 6e 64 20 60 78 32 27 20 61 6e 64 20 72 65 63 79 63 6c 65 20 60 78 | ers.`x1'.and.`x2'.and.recycle.`x |
| 86820 | 32 27 20 74 68 72 6f 75 67 68 20 74 68 65 20 69 74 65 72 61 74 69 76 65 0a 6c 6f 6f 70 20 61 73 | 2'.through.the.iterative.loop.as |
| 86840 | 20 74 68 65 20 6e 65 77 20 69 6e 70 75 74 20 74 6f 20 60 72 61 6e 64 2d 75 70 64 61 74 65 27 2e | .the.new.input.to.`rand-update'. |
| 86860 | 20 20 54 68 69 73 20 65 78 70 6c 69 63 69 74 20 68 61 6e 64 6c 69 6e 67 20 6f 66 20 74 68 65 0a | ..This.explicit.handling.of.the. |
| 86880 | 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 73 20 69 6e 74 65 72 74 77 69 6e 65 73 20 74 68 65 20 73 | random.numbers.intertwines.the.s |
| 868a0 | 74 72 75 63 74 75 72 65 20 6f 66 20 61 63 63 75 6d 75 6c 61 74 69 6e 67 20 74 65 73 74 20 72 65 | tructure.of.accumulating.test.re |
| 868c0 | 73 75 6c 74 73 0a 77 69 74 68 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 6f 75 72 20 70 61 72 | sults.with.the.fact.that.our.par |
| 868e0 | 74 69 63 75 6c 61 72 20 65 78 70 65 72 69 6d 65 6e 74 20 75 73 65 73 20 74 77 6f 20 72 61 6e 64 | ticular.experiment.uses.two.rand |
| 86900 | 6f 6d 20 6e 75 6d 62 65 72 73 2c 0a 77 68 65 72 65 61 73 20 6f 74 68 65 72 20 4d 6f 6e 74 65 20 | om.numbers,.whereas.other.Monte. |
| 86920 | 43 61 72 6c 6f 20 65 78 70 65 72 69 6d 65 6e 74 73 20 6d 69 67 68 74 20 75 73 65 20 6f 6e 65 20 | Carlo.experiments.might.use.one. |
| 86940 | 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 20 6f 72 0a 74 68 72 65 65 2e 20 20 45 76 65 6e 20 74 68 | random.number.or.three...Even.th |
| 86960 | 65 20 74 6f 70 2d 6c 65 76 65 6c 20 70 72 6f 63 65 64 75 72 65 20 60 65 73 74 69 6d 61 74 65 2d | e.top-level.procedure.`estimate- |
| 86980 | 70 69 27 20 68 61 73 20 74 6f 20 62 65 20 63 6f 6e 63 65 72 6e 65 64 0a 77 69 74 68 20 73 75 70 | pi'.has.to.be.concerned.with.sup |
| 869a0 | 70 6c 79 69 6e 67 20 61 6e 20 69 6e 69 74 69 61 6c 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 2e | plying.an.initial.random.number. |
| 869c0 | 20 20 54 68 65 20 66 61 63 74 20 74 68 61 74 20 74 68 65 0a 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 | ..The.fact.that.the.random-numbe |
| 869e0 | 72 20 67 65 6e 65 72 61 74 6f 72 27 73 20 69 6e 73 69 64 65 73 20 61 72 65 20 6c 65 61 6b 69 6e | r.generator's.insides.are.leakin |
| 86a00 | 67 20 6f 75 74 20 69 6e 74 6f 20 6f 74 68 65 72 20 70 61 72 74 73 20 6f 66 0a 74 68 65 20 70 72 | g.out.into.other.parts.of.the.pr |
| 86a20 | 6f 67 72 61 6d 20 6d 61 6b 65 73 20 69 74 20 64 69 66 66 69 63 75 6c 74 20 66 6f 72 20 75 73 20 | ogram.makes.it.difficult.for.us. |
| 86a40 | 74 6f 20 69 73 6f 6c 61 74 65 20 74 68 65 20 4d 6f 6e 74 65 20 43 61 72 6c 6f 20 69 64 65 61 0a | to.isolate.the.Monte.Carlo.idea. |
| 86a60 | 73 6f 20 74 68 61 74 20 69 74 20 63 61 6e 20 62 65 20 61 70 70 6c 69 65 64 20 74 6f 20 6f 74 68 | so.that.it.can.be.applied.to.oth |
| 86a80 | 65 72 20 74 61 73 6b 73 2e 20 20 49 6e 20 74 68 65 20 66 69 72 73 74 20 76 65 72 73 69 6f 6e 20 | er.tasks...In.the.first.version. |
| 86aa0 | 6f 66 20 74 68 65 0a 70 72 6f 67 72 61 6d 2c 20 61 73 73 69 67 6e 6d 65 6e 74 20 65 6e 63 61 70 | of.the.program,.assignment.encap |
| 86ac0 | 73 75 6c 61 74 65 73 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 72 61 6e 64 6f 6d 2d | sulates.the.state.of.the.random- |
| 86ae0 | 6e 75 6d 62 65 72 0a 67 65 6e 65 72 61 74 6f 72 20 77 69 74 68 69 6e 20 74 68 65 20 60 72 61 6e | number.generator.within.the.`ran |
| 86b00 | 64 27 20 70 72 6f 63 65 64 75 72 65 2c 20 73 6f 20 74 68 61 74 20 74 68 65 20 64 65 74 61 69 6c | d'.procedure,.so.that.the.detail |
| 86b20 | 73 20 6f 66 0a 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 20 67 65 6e 65 72 61 74 69 6f 6e 20 72 65 | s.of.random-number.generation.re |
| 86b40 | 6d 61 69 6e 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 72 65 73 74 20 6f 66 20 | main.independent.of.the.rest.of. |
| 86b60 | 74 68 65 20 70 72 6f 67 72 61 6d 2e 0a 0a 20 20 20 54 68 65 20 67 65 6e 65 72 61 6c 20 70 68 65 | the.program......The.general.phe |
| 86b80 | 6e 6f 6d 65 6e 6f 6e 20 69 6c 6c 75 73 74 72 61 74 65 64 20 62 79 20 74 68 65 20 4d 6f 6e 74 65 | nomenon.illustrated.by.the.Monte |
| 86ba0 | 20 43 61 72 6c 6f 20 65 78 61 6d 70 6c 65 20 69 73 0a 74 68 69 73 3a 20 46 72 6f 6d 20 74 68 65 | .Carlo.example.is.this:.From.the |
| 86bc0 | 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 20 6f 66 20 6f 6e 65 20 70 61 72 74 20 6f 66 20 61 20 | .point.of.view.of.one.part.of.a. |
| 86be0 | 63 6f 6d 70 6c 65 78 20 70 72 6f 63 65 73 73 2c 20 74 68 65 0a 6f 74 68 65 72 20 70 61 72 74 73 | complex.process,.the.other.parts |
| 86c00 | 20 61 70 70 65 61 72 20 74 6f 20 63 68 61 6e 67 65 20 77 69 74 68 20 74 69 6d 65 2e 20 20 54 68 | .appear.to.change.with.time...Th |
| 86c20 | 65 79 20 68 61 76 65 20 68 69 64 64 65 6e 20 74 69 6d 65 2d 76 61 72 79 69 6e 67 0a 6c 6f 63 61 | ey.have.hidden.time-varying.loca |
| 86c40 | 6c 20 73 74 61 74 65 2e 20 20 49 66 20 77 65 20 77 69 73 68 20 74 6f 20 77 72 69 74 65 20 63 6f | l.state...If.we.wish.to.write.co |
| 86c60 | 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 73 20 77 68 6f 73 65 20 73 74 72 75 63 74 75 72 65 0a | mputer.programs.whose.structure. |
| 86c80 | 72 65 66 6c 65 63 74 73 20 74 68 69 73 20 64 65 63 6f 6d 70 6f 73 69 74 69 6f 6e 2c 20 77 65 20 | reflects.this.decomposition,.we. |
| 86ca0 | 6d 61 6b 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 20 28 73 75 63 68 | make.computational.objects.(such |
| 86cc0 | 20 61 73 0a 62 61 6e 6b 20 61 63 63 6f 75 6e 74 73 20 61 6e 64 20 72 61 6e 64 6f 6d 2d 6e 75 6d | .as.bank.accounts.and.random-num |
| 86ce0 | 62 65 72 20 67 65 6e 65 72 61 74 6f 72 73 29 20 77 68 6f 73 65 20 62 65 68 61 76 69 6f 72 20 63 | ber.generators).whose.behavior.c |
| 86d00 | 68 61 6e 67 65 73 20 77 69 74 68 0a 74 69 6d 65 2e 20 20 57 65 20 6d 6f 64 65 6c 20 73 74 61 74 | hanges.with.time...We.model.stat |
| 86d20 | 65 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 2c 20 61 6e | e.with.local.state.variables,.an |
| 86d40 | 64 20 77 65 20 6d 6f 64 65 6c 20 74 68 65 0a 63 68 61 6e 67 65 73 20 6f 66 20 73 74 61 74 65 20 | d.we.model.the.changes.of.state. |
| 86d60 | 77 69 74 68 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 74 6f 20 74 68 6f 73 65 20 76 61 72 69 61 62 | with.assignments.to.those.variab |
| 86d80 | 6c 65 73 2e 0a 0a 20 20 20 49 74 20 69 73 20 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 6f 6e 63 6c | les......It.is.tempting.to.concl |
| 86da0 | 75 64 65 20 74 68 69 73 20 64 69 73 63 75 73 73 69 6f 6e 20 62 79 20 73 61 79 69 6e 67 20 74 68 | ude.this.discussion.by.saying.th |
| 86dc0 | 61 74 2c 20 62 79 0a 69 6e 74 72 6f 64 75 63 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e 74 20 61 6e | at,.by.introducing.assignment.an |
| 86de0 | 64 20 74 68 65 20 74 65 63 68 6e 69 71 75 65 20 6f 66 20 68 69 64 69 6e 67 20 73 74 61 74 65 20 | d.the.technique.of.hiding.state. |
| 86e00 | 69 6e 20 6c 6f 63 61 6c 0a 76 61 72 69 61 62 6c 65 73 2c 20 77 65 20 61 72 65 20 61 62 6c 65 20 | in.local.variables,.we.are.able. |
| 86e20 | 74 6f 20 73 74 72 75 63 74 75 72 65 20 73 79 73 74 65 6d 73 20 69 6e 20 61 20 6d 6f 72 65 20 6d | to.structure.systems.in.a.more.m |
| 86e40 | 6f 64 75 6c 61 72 20 66 61 73 68 69 6f 6e 0a 74 68 61 6e 20 69 66 20 61 6c 6c 20 73 74 61 74 65 | odular.fashion.than.if.all.state |
| 86e60 | 20 68 61 64 20 74 6f 20 62 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 20 65 78 70 6c 69 63 69 74 6c | .had.to.be.manipulated.explicitl |
| 86e80 | 79 2c 20 62 79 20 70 61 73 73 69 6e 67 0a 61 64 64 69 74 69 6f 6e 61 6c 20 70 61 72 61 6d 65 74 | y,.by.passing.additional.paramet |
| 86ea0 | 65 72 73 2e 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 61 73 20 77 65 20 73 68 61 6c 6c | ers...Unfortunately,.as.we.shall |
| 86ec0 | 20 73 65 65 2c 20 74 68 65 20 73 74 6f 72 79 20 69 73 0a 6e 6f 74 20 73 6f 20 73 69 6d 70 6c 65 | .see,.the.story.is.not.so.simple |
| 86ee0 | 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 35 3a 2a 20 22 4d 6f 6e 74 65 20 43 | ........*Exercise.3.5:*."Monte.C |
| 86f00 | 61 72 6c 6f 20 69 6e 74 65 67 72 61 74 69 6f 6e 22 20 69 73 20 61 20 6d 65 74 68 6f 64 20 6f 66 | arlo.integration".is.a.method.of |
| 86f20 | 0a 20 20 20 20 20 65 73 74 69 6d 61 74 69 6e 67 20 64 65 66 69 6e 69 74 65 20 69 6e 74 65 67 72 | ......estimating.definite.integr |
| 86f40 | 61 6c 73 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 4d 6f 6e 74 65 20 43 61 72 6c 6f 20 73 69 6d 75 | als.by.means.of.Monte.Carlo.simu |
| 86f60 | 6c 61 74 69 6f 6e 2e 0a 20 20 20 20 20 43 6f 6e 73 69 64 65 72 20 63 6f 6d 70 75 74 69 6e 67 20 | lation.......Consider.computing. |
| 86f80 | 74 68 65 20 61 72 65 61 20 6f 66 20 61 20 72 65 67 69 6f 6e 20 6f 66 20 73 70 61 63 65 20 64 65 | the.area.of.a.region.of.space.de |
| 86fa0 | 73 63 72 69 62 65 64 20 62 79 20 61 0a 20 20 20 20 20 70 72 65 64 69 63 61 74 65 20 50 28 78 2c | scribed.by.a......predicate.P(x, |
| 86fc0 | 20 79 29 20 74 68 61 74 20 69 73 20 74 72 75 65 20 66 6f 72 20 70 6f 69 6e 74 73 20 28 78 2c 20 | .y).that.is.true.for.points.(x,. |
| 86fe0 | 79 29 20 69 6e 20 74 68 65 20 72 65 67 69 6f 6e 20 61 6e 64 0a 20 20 20 20 20 66 61 6c 73 65 20 | y).in.the.region.and......false. |
| 87000 | 66 6f 72 20 70 6f 69 6e 74 73 20 6e 6f 74 20 69 6e 20 74 68 65 20 72 65 67 69 6f 6e 2e 20 20 46 | for.points.not.in.the.region...F |
| 87020 | 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 72 65 67 69 6f 6e 0a 20 20 20 20 20 63 6f 6e 74 | or.example,.the.region......cont |
| 87040 | 61 69 6e 65 64 20 77 69 74 68 69 6e 20 61 20 63 69 72 63 6c 65 20 6f 66 20 72 61 64 69 75 73 20 | ained.within.a.circle.of.radius. |
| 87060 | 33 20 63 65 6e 74 65 72 65 64 20 61 74 20 28 35 2c 20 37 29 20 69 73 0a 20 20 20 20 20 64 65 73 | 3.centered.at.(5,.7).is......des |
| 87080 | 63 72 69 62 65 64 20 62 79 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 74 68 61 74 20 74 65 73 | cribed.by.the.predicate.that.tes |
| 870a0 | 74 73 20 77 68 65 74 68 65 72 20 28 78 20 2d 20 35 29 5e 32 20 2b 20 28 79 20 2d 0a 20 20 20 20 | ts.whether.(x.-.5)^2.+.(y.-..... |
| 870c0 | 20 37 29 5e 32 20 3c 3d 20 33 5e 32 2e 20 20 54 6f 20 65 73 74 69 6d 61 74 65 20 74 68 65 20 61 | .7)^2.<=.3^2...To.estimate.the.a |
| 870e0 | 72 65 61 20 6f 66 20 74 68 65 20 72 65 67 69 6f 6e 20 64 65 73 63 72 69 62 65 64 20 62 79 20 73 | rea.of.the.region.described.by.s |
| 87100 | 75 63 68 0a 20 20 20 20 20 61 20 70 72 65 64 69 63 61 74 65 2c 20 62 65 67 69 6e 20 62 79 20 63 | uch......a.predicate,.begin.by.c |
| 87120 | 68 6f 6f 73 69 6e 67 20 61 20 72 65 63 74 61 6e 67 6c 65 20 74 68 61 74 20 63 6f 6e 74 61 69 6e | hoosing.a.rectangle.that.contain |
| 87140 | 73 20 74 68 65 0a 20 20 20 20 20 72 65 67 69 6f 6e 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c | s.the......region...For.example, |
| 87160 | 20 61 20 72 65 63 74 61 6e 67 6c 65 20 77 69 74 68 20 64 69 61 67 6f 6e 61 6c 6c 79 20 6f 70 70 | .a.rectangle.with.diagonally.opp |
| 87180 | 6f 73 69 74 65 20 63 6f 72 6e 65 72 73 0a 20 20 20 20 20 61 74 20 28 32 2c 20 34 29 20 61 6e 64 | osite.corners......at.(2,.4).and |
| 871a0 | 20 28 38 2c 20 31 30 29 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 63 69 72 63 6c 65 20 61 62 6f | .(8,.10).contains.the.circle.abo |
| 871c0 | 76 65 2e 20 20 54 68 65 20 64 65 73 69 72 65 64 0a 20 20 20 20 20 69 6e 74 65 67 72 61 6c 20 69 | ve...The.desired......integral.i |
| 871e0 | 73 20 74 68 65 20 61 72 65 61 20 6f 66 20 74 68 61 74 20 70 6f 72 74 69 6f 6e 20 6f 66 20 74 68 | s.the.area.of.that.portion.of.th |
| 87200 | 65 20 72 65 63 74 61 6e 67 6c 65 20 74 68 61 74 20 6c 69 65 73 20 69 6e 0a 20 20 20 20 20 74 68 | e.rectangle.that.lies.in......th |
| 87220 | 65 20 72 65 67 69 6f 6e 2e 20 20 57 65 20 63 61 6e 20 65 73 74 69 6d 61 74 65 20 74 68 65 20 69 | e.region...We.can.estimate.the.i |
| 87240 | 6e 74 65 67 72 61 6c 20 62 79 20 70 69 63 6b 69 6e 67 2c 20 61 74 20 72 61 6e 64 6f 6d 2c 0a 20 | ntegral.by.picking,.at.random,.. |
| 87260 | 20 20 20 20 70 6f 69 6e 74 73 20 28 78 2c 79 29 20 74 68 61 74 20 6c 69 65 20 69 6e 20 74 68 65 | ....points.(x,y).that.lie.in.the |
| 87280 | 20 72 65 63 74 61 6e 67 6c 65 2c 20 61 6e 64 20 74 65 73 74 69 6e 67 20 50 28 78 2c 20 79 29 20 | .rectangle,.and.testing.P(x,.y). |
| 872a0 | 66 6f 72 0a 20 20 20 20 20 65 61 63 68 20 70 6f 69 6e 74 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 | for......each.point.to.determine |
| 872c0 | 20 77 68 65 74 68 65 72 20 74 68 65 20 70 6f 69 6e 74 20 6c 69 65 73 20 69 6e 20 74 68 65 20 72 | .whether.the.point.lies.in.the.r |
| 872e0 | 65 67 69 6f 6e 2e 20 20 49 66 0a 20 20 20 20 20 77 65 20 74 72 79 20 74 68 69 73 20 77 69 74 68 | egion...If......we.try.this.with |
| 87300 | 20 6d 61 6e 79 20 70 6f 69 6e 74 73 2c 20 74 68 65 6e 20 74 68 65 20 66 72 61 63 74 69 6f 6e 20 | .many.points,.then.the.fraction. |
| 87320 | 6f 66 20 70 6f 69 6e 74 73 20 74 68 61 74 0a 20 20 20 20 20 66 61 6c 6c 20 69 6e 20 74 68 65 20 | of.points.that......fall.in.the. |
| 87340 | 72 65 67 69 6f 6e 20 73 68 6f 75 6c 64 20 67 69 76 65 20 61 6e 20 65 73 74 69 6d 61 74 65 20 6f | region.should.give.an.estimate.o |
| 87360 | 66 20 74 68 65 20 70 72 6f 70 6f 72 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 74 68 65 20 72 65 63 | f.the.proportion.of......the.rec |
| 87380 | 74 61 6e 67 6c 65 20 74 68 61 74 20 6c 69 65 73 20 69 6e 20 74 68 65 20 72 65 67 69 6f 6e 2e 20 | tangle.that.lies.in.the.region.. |
| 873a0 | 20 48 65 6e 63 65 2c 20 6d 75 6c 74 69 70 6c 79 69 6e 67 20 74 68 69 73 0a 20 20 20 20 20 66 72 | .Hence,.multiplying.this......fr |
| 873c0 | 61 63 74 69 6f 6e 20 62 79 20 74 68 65 20 61 72 65 61 20 6f 66 20 74 68 65 20 65 6e 74 69 72 65 | action.by.the.area.of.the.entire |
| 873e0 | 20 72 65 63 74 61 6e 67 6c 65 20 73 68 6f 75 6c 64 20 70 72 6f 64 75 63 65 20 61 6e 0a 20 20 20 | .rectangle.should.produce.an.... |
| 87400 | 20 20 65 73 74 69 6d 61 74 65 20 6f 66 20 74 68 65 20 69 6e 74 65 67 72 61 6c 2e 0a 0a 20 20 20 | ..estimate.of.the.integral...... |
| 87420 | 20 20 49 6d 70 6c 65 6d 65 6e 74 20 4d 6f 6e 74 65 20 43 61 72 6c 6f 20 69 6e 74 65 67 72 61 74 | ..Implement.Monte.Carlo.integrat |
| 87440 | 69 6f 6e 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 60 65 73 74 69 6d 61 74 | ion.as.a.procedure......`estimat |
| 87460 | 65 2d 69 6e 74 65 67 72 61 6c 27 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 | e-integral'.that.takes.as.argume |
| 87480 | 6e 74 73 20 61 20 70 72 65 64 69 63 61 74 65 20 60 50 27 2c 20 75 70 70 65 72 0a 20 20 20 20 20 | nts.a.predicate.`P',.upper...... |
| 874a0 | 61 6e 64 20 6c 6f 77 65 72 20 62 6f 75 6e 64 73 20 60 78 31 27 2c 20 60 78 32 27 2c 20 60 79 31 | and.lower.bounds.`x1',.`x2',.`y1 |
| 874c0 | 27 2c 20 61 6e 64 20 60 79 32 27 20 66 6f 72 20 74 68 65 20 72 65 63 74 61 6e 67 6c 65 2c 20 61 | ',.and.`y2'.for.the.rectangle,.a |
| 874e0 | 6e 64 0a 20 20 20 20 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 74 72 69 61 6c 73 20 74 6f 20 | nd......the.number.of.trials.to. |
| 87500 | 70 65 72 66 6f 72 6d 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 | perform.in.order.to.produce.the. |
| 87520 | 65 73 74 69 6d 61 74 65 2e 0a 20 20 20 20 20 59 6f 75 72 20 70 72 6f 63 65 64 75 72 65 20 73 68 | estimate.......Your.procedure.sh |
| 87540 | 6f 75 6c 64 20 75 73 65 20 74 68 65 20 73 61 6d 65 20 60 6d 6f 6e 74 65 2d 63 61 72 6c 6f 27 20 | ould.use.the.same.`monte-carlo'. |
| 87560 | 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 20 20 20 20 20 77 61 73 20 75 73 65 64 20 61 62 6f | procedure.that......was.used.abo |
| 87580 | 76 65 20 74 6f 20 65 73 74 69 6d 61 74 65 20 5b 70 69 5d 2e 20 20 55 73 65 20 79 6f 75 72 20 60 | ve.to.estimate.[pi]...Use.your.` |
| 875a0 | 65 73 74 69 6d 61 74 65 2d 69 6e 74 65 67 72 61 6c 27 20 74 6f 0a 20 20 20 20 20 70 72 6f 64 75 | estimate-integral'.to......produ |
| 875c0 | 63 65 20 61 6e 20 65 73 74 69 6d 61 74 65 20 6f 66 20 5b 70 69 5d 20 62 79 20 6d 65 61 73 75 72 | ce.an.estimate.of.[pi].by.measur |
| 875e0 | 69 6e 67 20 74 68 65 20 61 72 65 61 20 6f 66 20 61 20 75 6e 69 74 20 63 69 72 63 6c 65 2e 0a 0a | ing.the.area.of.a.unit.circle... |
| 87600 | 20 20 20 20 20 59 6f 75 20 77 69 6c 6c 20 66 69 6e 64 20 69 74 20 75 73 65 66 75 6c 20 74 6f 20 | .....You.will.find.it.useful.to. |
| 87620 | 68 61 76 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 61 20 | have.a.procedure.that.returns.a. |
| 87640 | 6e 75 6d 62 65 72 0a 20 20 20 20 20 63 68 6f 73 65 6e 20 61 74 20 72 61 6e 64 6f 6d 20 66 72 6f | number......chosen.at.random.fro |
| 87660 | 6d 20 61 20 67 69 76 65 6e 20 72 61 6e 67 65 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a | m.a.given.range...The.following. |
| 87680 | 20 20 20 20 20 60 72 61 6e 64 6f 6d 2d 69 6e 2d 72 61 6e 67 65 27 20 70 72 6f 63 65 64 75 72 65 | .....`random-in-range'.procedure |
| 876a0 | 20 69 6d 70 6c 65 6d 65 6e 74 73 20 74 68 69 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 | .implements.this.in.terms.of.the |
| 876c0 | 0a 20 20 20 20 20 60 72 61 6e 64 6f 6d 27 20 70 72 6f 63 65 64 75 72 65 20 75 73 65 64 20 69 6e | ......`random'.procedure.used.in |
| 876e0 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 36 3a 3a 2c 20 77 68 69 63 68 20 72 65 | .section.*Note.1-2-6::,.which.re |
| 87700 | 74 75 72 6e 73 20 61 0a 20 20 20 20 20 6e 6f 6e 6e 65 67 61 74 69 76 65 20 6e 75 6d 62 65 72 20 | turns.a......nonnegative.number. |
| 87720 | 6c 65 73 73 20 74 68 61 6e 20 69 74 73 20 69 6e 70 75 74 2e 28 33 29 0a 0a 20 20 20 20 20 20 20 | less.than.its.input.(3)......... |
| 87740 | 20 20 20 28 64 65 66 69 6e 65 20 28 72 61 6e 64 6f 6d 2d 69 6e 2d 72 61 6e 67 65 20 6c 6f 77 20 | ...(define.(random-in-range.low. |
| 87760 | 68 69 67 68 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 61 6e 67 65 20 28 | high).............(let.((range.( |
| 87780 | 2d 20 68 69 67 68 20 6c 6f 77 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 6c | -.high.low)))...............(+.l |
| 877a0 | 6f 77 20 28 72 61 6e 64 6f 6d 20 72 61 6e 67 65 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 | ow.(random.range)))).......*Exer |
| 877c0 | 63 69 73 65 20 33 2e 36 3a 2a 20 49 74 20 69 73 20 75 73 65 66 75 6c 20 74 6f 20 62 65 20 61 62 | cise.3.6:*.It.is.useful.to.be.ab |
| 877e0 | 6c 65 20 74 6f 20 72 65 73 65 74 20 61 20 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 0a 20 20 20 20 | le.to.reset.a.random-number..... |
| 87800 | 20 67 65 6e 65 72 61 74 6f 72 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 73 65 71 75 65 6e 63 65 | .generator.to.produce.a.sequence |
| 87820 | 20 73 74 61 72 74 69 6e 67 20 66 72 6f 6d 20 61 20 67 69 76 65 6e 20 76 61 6c 75 65 2e 0a 20 20 | .starting.from.a.given.value.... |
| 87840 | 20 20 20 44 65 73 69 67 6e 20 61 20 6e 65 77 20 60 72 61 6e 64 27 20 70 72 6f 63 65 64 75 72 65 | ...Design.a.new.`rand'.procedure |
| 87860 | 20 74 68 61 74 20 69 73 20 63 61 6c 6c 65 64 20 77 69 74 68 20 61 6e 20 61 72 67 75 6d 65 6e 74 | .that.is.called.with.an.argument |
| 87880 | 20 74 68 61 74 0a 20 20 20 20 20 69 73 20 65 69 74 68 65 72 20 74 68 65 20 73 79 6d 62 6f 6c 20 | .that......is.either.the.symbol. |
| 878a0 | 60 67 65 6e 65 72 61 74 65 27 20 6f 72 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 72 65 73 65 74 27 | `generate'.or.the.symbol.`reset' |
| 878c0 | 20 61 6e 64 20 62 65 68 61 76 65 73 0a 20 20 20 20 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 20 60 28 | .and.behaves......as.follows:.`( |
| 878e0 | 72 61 6e 64 20 27 67 65 6e 65 72 61 74 65 29 27 20 70 72 6f 64 75 63 65 73 20 61 20 6e 65 77 20 | rand.'generate)'.produces.a.new. |
| 87900 | 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 3b 0a 20 20 20 20 20 60 28 28 72 61 6e 64 20 27 72 65 73 | random.number;......`((rand.'res |
| 87920 | 65 74 29 20 3c 4e 45 57 2d 56 41 4c 55 45 3e 29 27 20 72 65 73 65 74 73 20 74 68 65 20 69 6e 74 | et).<NEW-VALUE>)'.resets.the.int |
| 87940 | 65 72 6e 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 0a 20 20 20 20 20 74 6f 20 74 68 65 | ernal.state.variable......to.the |
| 87960 | 20 64 65 73 69 67 6e 61 74 65 64 20 3c 4e 45 57 2d 56 41 4c 55 45 3e 2e 20 20 54 68 75 73 2c 20 | .designated.<NEW-VALUE>...Thus,. |
| 87980 | 62 79 20 72 65 73 65 74 74 69 6e 67 20 74 68 65 20 73 74 61 74 65 2c 20 6f 6e 65 0a 20 20 20 20 | by.resetting.the.state,.one..... |
| 879a0 | 20 63 61 6e 20 67 65 6e 65 72 61 74 65 20 72 65 70 65 61 74 61 62 6c 65 20 73 65 71 75 65 6e 63 | .can.generate.repeatable.sequenc |
| 879c0 | 65 73 2e 20 20 54 68 65 73 65 20 61 72 65 20 76 65 72 79 20 68 61 6e 64 79 20 74 6f 20 68 61 76 | es...These.are.very.handy.to.hav |
| 879e0 | 65 0a 20 20 20 20 20 77 68 65 6e 20 74 65 73 74 69 6e 67 20 61 6e 64 20 64 65 62 75 67 67 69 6e | e......when.testing.and.debuggin |
| 87a00 | 67 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 75 73 65 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 | g.programs.that.use.random.numbe |
| 87a20 | 72 73 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d | rs......----------.Footnotes.--- |
| 87a40 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 4f 6e 65 20 63 6f 6d 6d 6f 6e 20 77 61 79 20 74 | -------.....(1).One.common.way.t |
| 87a60 | 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 60 72 61 6e 64 2d 75 70 64 61 74 65 27 20 69 73 20 74 6f 20 | o.implement.`rand-update'.is.to. |
| 87a80 | 75 73 65 20 74 68 65 20 72 75 6c 65 0a 74 68 61 74 20 78 20 69 73 20 75 70 64 61 74 65 64 20 74 | use.the.rule.that.x.is.updated.t |
| 87aa0 | 6f 20 61 78 20 2b 20 62 20 6d 6f 64 75 6c 6f 20 6d 2c 20 77 68 65 72 65 20 61 2c 20 62 2c 20 61 | o.ax.+.b.modulo.m,.where.a,.b,.a |
| 87ac0 | 6e 64 20 6d 20 61 72 65 0a 61 70 70 72 6f 70 72 69 61 74 65 6c 79 20 63 68 6f 73 65 6e 20 69 6e | nd.m.are.appropriately.chosen.in |
| 87ae0 | 74 65 67 65 72 73 2e 20 20 43 68 61 70 74 65 72 20 33 20 6f 66 20 4b 6e 75 74 68 20 31 39 38 31 | tegers...Chapter.3.of.Knuth.1981 |
| 87b00 | 20 69 6e 63 6c 75 64 65 73 20 61 6e 0a 65 78 74 65 6e 73 69 76 65 20 64 69 73 63 75 73 73 69 6f | .includes.an.extensive.discussio |
| 87b20 | 6e 20 6f 66 20 74 65 63 68 6e 69 71 75 65 73 20 66 6f 72 20 67 65 6e 65 72 61 74 69 6e 67 20 73 | n.of.techniques.for.generating.s |
| 87b40 | 65 71 75 65 6e 63 65 73 20 6f 66 20 72 61 6e 64 6f 6d 0a 6e 75 6d 62 65 72 73 20 61 6e 64 20 65 | equences.of.random.numbers.and.e |
| 87b60 | 73 74 61 62 6c 69 73 68 69 6e 67 20 74 68 65 69 72 20 73 74 61 74 69 73 74 69 63 61 6c 20 70 72 | stablishing.their.statistical.pr |
| 87b80 | 6f 70 65 72 74 69 65 73 2e 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 74 68 65 0a 60 72 61 6e 64 | operties...Notice.that.the.`rand |
| 87ba0 | 2d 75 70 64 61 74 65 27 20 70 72 6f 63 65 64 75 72 65 20 63 6f 6d 70 75 74 65 73 20 61 20 6d 61 | -update'.procedure.computes.a.ma |
| 87bc0 | 74 68 65 6d 61 74 69 63 61 6c 20 66 75 6e 63 74 69 6f 6e 3a 20 47 69 76 65 6e 20 74 68 65 0a 73 | thematical.function:.Given.the.s |
| 87be0 | 61 6d 65 20 69 6e 70 75 74 20 74 77 69 63 65 2c 20 69 74 20 70 72 6f 64 75 63 65 73 20 74 68 65 | ame.input.twice,.it.produces.the |
| 87c00 | 20 73 61 6d 65 20 6f 75 74 70 75 74 2e 20 20 54 68 65 72 65 66 6f 72 65 2c 20 74 68 65 20 6e 75 | .same.output...Therefore,.the.nu |
| 87c20 | 6d 62 65 72 0a 73 65 71 75 65 6e 63 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 60 72 61 6e 64 2d | mber.sequence.produced.by.`rand- |
| 87c40 | 75 70 64 61 74 65 27 20 63 65 72 74 61 69 6e 6c 79 20 69 73 20 6e 6f 74 20 22 72 61 6e 64 6f 6d | update'.certainly.is.not."random |
| 87c60 | 2c 22 20 69 66 20 62 79 0a 22 72 61 6e 64 6f 6d 22 20 77 65 20 69 6e 73 69 73 74 20 74 68 61 74 | ,".if.by."random".we.insist.that |
| 87c80 | 20 65 61 63 68 20 6e 75 6d 62 65 72 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 69 73 20 | .each.number.in.the.sequence.is. |
| 87ca0 | 75 6e 72 65 6c 61 74 65 64 20 74 6f 20 74 68 65 0a 70 72 65 63 65 64 69 6e 67 20 6e 75 6d 62 65 | unrelated.to.the.preceding.numbe |
| 87cc0 | 72 2e 20 20 54 68 65 20 72 65 6c 61 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 22 72 65 61 6c 20 72 | r...The.relation.between."real.r |
| 87ce0 | 61 6e 64 6f 6d 6e 65 73 73 22 20 61 6e 64 20 73 6f 2d 63 61 6c 6c 65 64 20 22 70 73 65 75 64 6f | andomness".and.so-called."pseudo |
| 87d00 | 2d 72 61 6e 64 6f 6d 22 0a 73 65 71 75 65 6e 63 65 73 2c 20 77 68 69 63 68 20 61 72 65 20 70 72 | -random".sequences,.which.are.pr |
| 87d20 | 6f 64 75 63 65 64 20 62 79 20 77 65 6c 6c 2d 64 65 74 65 72 6d 69 6e 65 64 20 63 6f 6d 70 75 74 | oduced.by.well-determined.comput |
| 87d40 | 61 74 69 6f 6e 73 20 61 6e 64 20 79 65 74 0a 68 61 76 65 20 73 75 69 74 61 62 6c 65 20 73 74 61 | ations.and.yet.have.suitable.sta |
| 87d60 | 74 69 73 74 69 63 61 6c 20 70 72 6f 70 65 72 74 69 65 73 2c 20 69 73 20 61 20 63 6f 6d 70 6c 65 | tistical.properties,.is.a.comple |
| 87d80 | 78 20 71 75 65 73 74 69 6f 6e 20 69 6e 76 6f 6c 76 69 6e 67 0a 64 69 66 66 69 63 75 6c 74 20 69 | x.question.involving.difficult.i |
| 87da0 | 73 73 75 65 73 20 69 6e 20 6d 61 74 68 65 6d 61 74 69 63 73 20 61 6e 64 20 70 68 69 6c 6f 73 6f | ssues.in.mathematics.and.philoso |
| 87dc0 | 70 68 79 2e 20 20 4b 6f 6c 6d 6f 67 6f 72 6f 76 2c 0a 53 6f 6c 6f 6d 6f 6e 6f 66 66 2c 20 61 6e | phy...Kolmogorov,.Solomonoff,.an |
| 87de0 | 64 20 43 68 61 69 74 69 6e 20 68 61 76 65 20 6d 61 64 65 20 67 72 65 61 74 20 70 72 6f 67 72 65 | d.Chaitin.have.made.great.progre |
| 87e00 | 73 73 20 69 6e 20 63 6c 61 72 69 66 79 69 6e 67 20 74 68 65 73 65 0a 69 73 73 75 65 73 3b 20 61 | ss.in.clarifying.these.issues;.a |
| 87e20 | 20 64 69 73 63 75 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 66 6f 75 6e 64 20 69 6e 20 43 68 61 69 | .discussion.can.be.found.in.Chai |
| 87e40 | 74 69 6e 20 31 39 37 35 2e 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 74 68 65 6f 72 65 6d 20 69 | tin.1975......(2).This.theorem.i |
| 87e60 | 73 20 64 75 65 20 74 6f 20 45 2e 20 43 65 73 61 60 72 6f 2e 20 20 53 65 65 20 73 65 63 74 69 6f | s.due.to.E..Cesa`ro...See.sectio |
| 87e80 | 6e 20 34 2e 35 2e 32 20 6f 66 20 4b 6e 75 74 68 0a 31 39 38 31 20 66 6f 72 20 61 20 64 69 73 63 | n.4.5.2.of.Knuth.1981.for.a.disc |
| 87ea0 | 75 73 73 69 6f 6e 20 61 6e 64 20 61 20 70 72 6f 6f 66 2e 0a 0a 20 20 20 28 33 29 20 4d 49 54 20 | ussion.and.a.proof......(3).MIT. |
| 87ec0 | 53 63 68 65 6d 65 20 70 72 6f 76 69 64 65 73 20 73 75 63 68 20 61 20 70 72 6f 63 65 64 75 72 65 | Scheme.provides.such.a.procedure |
| 87ee0 | 2e 20 20 49 66 20 60 72 61 6e 64 6f 6d 27 20 69 73 20 67 69 76 65 6e 20 61 6e 0a 65 78 61 63 74 | ...If.`random'.is.given.an.exact |
| 87f00 | 20 69 6e 74 65 67 65 72 20 28 61 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d | .integer.(as.in.section.*Note.1- |
| 87f20 | 32 2d 36 3a 3a 29 20 69 74 20 72 65 74 75 72 6e 73 20 61 6e 20 65 78 61 63 74 0a 69 6e 74 65 67 | 2-6::).it.returns.an.exact.integ |
| 87f40 | 65 72 2c 20 62 75 74 20 69 66 20 69 74 20 69 73 20 67 69 76 65 6e 20 61 20 64 65 63 69 6d 61 6c | er,.but.if.it.is.given.a.decimal |
| 87f60 | 20 76 61 6c 75 65 20 28 61 73 20 69 6e 20 74 68 69 73 20 65 78 65 72 63 69 73 65 29 20 69 74 0a | .value.(as.in.this.exercise).it. |
| 87f80 | 72 65 74 75 72 6e 73 20 61 20 64 65 63 69 6d 61 6c 20 76 61 6c 75 65 2e 0a 0a 1f 0a 46 69 6c 65 | returns.a.decimal.value.....File |
| 87fa0 | 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 31 2d 33 2c 20 20 50 72 65 76 | :.sicp.info,..Node:.3-1-3,..Prev |
| 87fc0 | 3a 20 33 2d 31 2d 32 2c 20 20 55 70 3a 20 33 2d 31 0a 0a 33 2e 31 2e 33 20 54 68 65 20 43 6f 73 | :.3-1-2,..Up:.3-1..3.1.3.The.Cos |
| 87fe0 | 74 73 20 6f 66 20 49 6e 74 72 6f 64 75 63 69 6e 67 20 41 73 73 69 67 6e 6d 65 6e 74 0a 2d 2d 2d | ts.of.Introducing.Assignment.--- |
| 88000 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 88020 | 2d 2d 2d 2d 2d 2d 0a 0a 41 73 20 77 65 20 68 61 76 65 20 73 65 65 6e 2c 20 74 68 65 20 60 73 65 | ------..As.we.have.seen,.the.`se |
| 88040 | 74 21 27 20 6f 70 65 72 61 74 69 6f 6e 20 65 6e 61 62 6c 65 73 20 75 73 20 74 6f 20 6d 6f 64 65 | t!'.operation.enables.us.to.mode |
| 88060 | 6c 20 6f 62 6a 65 63 74 73 20 74 68 61 74 0a 68 61 76 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 2e | l.objects.that.have.local.state. |
| 88080 | 20 20 48 6f 77 65 76 65 72 2c 20 74 68 69 73 20 61 64 76 61 6e 74 61 67 65 20 63 6f 6d 65 73 20 | ..However,.this.advantage.comes. |
| 880a0 | 61 74 20 61 20 70 72 69 63 65 2e 20 20 4f 75 72 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e | at.a.price...Our.programming.lan |
| 880c0 | 67 75 61 67 65 20 63 61 6e 20 6e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 69 6e 74 65 72 70 72 65 74 | guage.can.no.longer.be.interpret |
| 880e0 | 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 0a 73 75 62 73 74 69 74 75 74 69 6f 6e 20 | ed.in.terms.of.the.substitution. |
| 88100 | 6d 6f 64 65 6c 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 74 | model.of.procedure.application.t |
| 88120 | 68 61 74 20 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f | hat.we.introduced.in.section.*No |
| 88140 | 74 65 20 31 2d 31 2d 35 3a 3a 2e 20 20 4d 6f 72 65 6f 76 65 72 2c 20 6e 6f 20 73 69 6d 70 6c 65 | te.1-1-5::...Moreover,.no.simple |
| 88160 | 20 6d 6f 64 65 6c 20 77 69 74 68 20 22 6e 69 63 65 22 0a 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 | .model.with."nice".mathematical. |
| 88180 | 70 72 6f 70 65 72 74 69 65 73 20 63 61 6e 20 62 65 20 61 6e 20 61 64 65 71 75 61 74 65 20 66 72 | properties.can.be.an.adequate.fr |
| 881a0 | 61 6d 65 77 6f 72 6b 20 66 6f 72 20 64 65 61 6c 69 6e 67 20 77 69 74 68 0a 6f 62 6a 65 63 74 73 | amework.for.dealing.with.objects |
| 881c0 | 20 61 6e 64 20 61 73 73 69 67 6e 6d 65 6e 74 20 69 6e 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c | .and.assignment.in.programming.l |
| 881e0 | 61 6e 67 75 61 67 65 73 2e 0a 0a 20 20 20 53 6f 20 6c 6f 6e 67 20 61 73 20 77 65 20 64 6f 20 6e | anguages......So.long.as.we.do.n |
| 88200 | 6f 74 20 75 73 65 20 61 73 73 69 67 6e 6d 65 6e 74 73 2c 20 74 77 6f 20 65 76 61 6c 75 61 74 69 | ot.use.assignments,.two.evaluati |
| 88220 | 6f 6e 73 20 6f 66 20 74 68 65 20 73 61 6d 65 0a 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 74 | ons.of.the.same.procedure.with.t |
| 88240 | 68 65 20 73 61 6d 65 20 61 72 67 75 6d 65 6e 74 73 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 74 | he.same.arguments.will.produce.t |
| 88260 | 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 2c 20 73 6f 20 74 68 61 74 0a 70 72 6f 63 65 64 75 72 | he.same.result,.so.that.procedur |
| 88280 | 65 73 20 63 61 6e 20 62 65 20 76 69 65 77 65 64 20 61 73 20 63 6f 6d 70 75 74 69 6e 67 20 6d 61 | es.can.be.viewed.as.computing.ma |
| 882a0 | 74 68 65 6d 61 74 69 63 61 6c 20 66 75 6e 63 74 69 6f 6e 73 2e 0a 50 72 6f 67 72 61 6d 6d 69 6e | thematical.functions..Programmin |
| 882c0 | 67 20 77 69 74 68 6f 75 74 20 61 6e 79 20 75 73 65 20 6f 66 20 61 73 73 69 67 6e 6d 65 6e 74 73 | g.without.any.use.of.assignments |
| 882e0 | 2c 20 61 73 20 77 65 20 64 69 64 20 74 68 72 6f 75 67 68 6f 75 74 20 74 68 65 0a 66 69 72 73 74 | ,.as.we.did.throughout.the.first |
| 88300 | 20 74 77 6f 20 63 68 61 70 74 65 72 73 20 6f 66 20 74 68 69 73 20 62 6f 6f 6b 2c 20 69 73 20 61 | .two.chapters.of.this.book,.is.a |
| 88320 | 63 63 6f 72 64 69 6e 67 6c 79 20 6b 6e 6f 77 6e 20 61 73 20 22 66 75 6e 63 74 69 6f 6e 61 6c 0a | ccordingly.known.as."functional. |
| 88340 | 70 72 6f 67 72 61 6d 6d 69 6e 67 22 2e 0a 0a 20 20 20 54 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 | programming"......To.understand. |
| 88360 | 68 6f 77 20 61 73 73 69 67 6e 6d 65 6e 74 20 63 6f 6d 70 6c 69 63 61 74 65 73 20 6d 61 74 74 65 | how.assignment.complicates.matte |
| 88380 | 72 73 2c 20 63 6f 6e 73 69 64 65 72 20 61 0a 73 69 6d 70 6c 69 66 69 65 64 20 76 65 72 73 69 6f | rs,.consider.a.simplified.versio |
| 883a0 | 6e 20 6f 66 20 74 68 65 20 60 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 27 20 70 72 6f 63 65 64 75 | n.of.the.`make-withdraw'.procedu |
| 883c0 | 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 33 2d 31 2d 31 3a 3a 20 74 68 61 74 | re.of.section.*Note.3-1-1::.that |
| 883e0 | 20 64 6f 65 73 20 6e 6f 74 20 62 6f 74 68 65 72 20 74 6f 20 63 68 65 63 6b 20 66 6f 72 20 61 6e | .does.not.bother.to.check.for.an |
| 88400 | 20 69 6e 73 75 66 66 69 63 69 65 6e 74 20 61 6d 6f 75 6e 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 | .insufficient.amount:.......(def |
| 88420 | 69 6e 65 20 28 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 69 65 64 2d 77 69 74 68 64 72 61 77 20 62 61 | ine.(make-simplified-withdraw.ba |
| 88440 | 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 6d 6f 75 6e 74 29 0a 20 | lance)........(lambda.(amount).. |
| 88460 | 20 20 20 20 20 20 20 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 | ........(set!.balance.(-.balance |
| 88480 | 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 29 0a 0a 20 20 | .amount))..........balance)).... |
| 884a0 | 20 20 20 28 64 65 66 69 6e 65 20 57 20 28 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 69 65 64 2d 77 69 | ...(define.W.(make-simplified-wi |
| 884c0 | 74 68 64 72 61 77 20 32 35 29 29 0a 0a 20 20 20 20 20 28 57 20 32 30 29 0a 20 20 20 20 20 35 0a | thdraw.25)).......(W.20)......5. |
| 884e0 | 0a 20 20 20 20 20 28 57 20 31 30 29 0a 20 20 20 20 20 20 2d 20 35 0a 0a 20 20 20 43 6f 6d 70 61 | ......(W.10).......-.5.....Compa |
| 88500 | 72 65 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 74 68 65 20 66 6f 6c 6c 6f | re.this.procedure.with.the.follo |
| 88520 | 77 69 6e 67 20 60 6d 61 6b 65 2d 64 65 63 72 65 6d 65 6e 74 65 72 27 0a 70 72 6f 63 65 64 75 72 | wing.`make-decrementer'.procedur |
| 88540 | 65 2c 20 77 68 69 63 68 20 64 6f 65 73 20 6e 6f 74 20 75 73 65 20 60 73 65 74 21 27 3a 0a 0a 20 | e,.which.does.not.use.`set!':... |
| 88560 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 64 65 63 72 65 6d 65 6e 74 65 72 20 62 61 | ....(define.(make-decrementer.ba |
| 88580 | 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 6d 6f 75 6e 74 29 0a 20 | lance)........(lambda.(amount).. |
| 885a0 | 20 20 20 20 20 20 20 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 29 0a 0a 20 20 | ........(-.balance.amount))).... |
| 885c0 | 20 60 4d 61 6b 65 2d 64 65 63 72 65 6d 65 6e 74 65 72 27 20 72 65 74 75 72 6e 73 20 61 20 70 72 | .`Make-decrementer'.returns.a.pr |
| 885e0 | 6f 63 65 64 75 72 65 20 74 68 61 74 20 73 75 62 74 72 61 63 74 73 20 69 74 73 20 69 6e 70 75 74 | ocedure.that.subtracts.its.input |
| 88600 | 20 66 72 6f 6d 0a 61 20 64 65 73 69 67 6e 61 74 65 64 20 61 6d 6f 75 6e 74 20 60 62 61 6c 61 6e | .from.a.designated.amount.`balan |
| 88620 | 63 65 27 2c 20 62 75 74 20 74 68 65 72 65 20 69 73 20 6e 6f 20 61 63 63 75 6d 75 6c 61 74 65 64 | ce',.but.there.is.no.accumulated |
| 88640 | 20 65 66 66 65 63 74 20 6f 76 65 72 0a 73 75 63 63 65 73 73 69 76 65 20 63 61 6c 6c 73 2c 20 61 | .effect.over.successive.calls,.a |
| 88660 | 73 20 77 69 74 68 20 60 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 69 65 64 2d 77 69 74 68 64 72 61 77 | s.with.`make-simplified-withdraw |
| 88680 | 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 44 20 28 6d 61 6b 65 2d 64 65 63 72 65 6d 65 | ':.......(define.D.(make-decreme |
| 886a0 | 6e 74 65 72 20 32 35 29 29 0a 0a 20 20 20 20 20 28 44 20 32 30 29 0a 20 20 20 20 20 35 0a 0a 20 | nter.25)).......(D.20)......5... |
| 886c0 | 20 20 20 20 28 44 20 31 30 29 0a 20 20 20 20 20 31 35 0a 0a 20 20 20 57 65 20 63 61 6e 20 75 73 | ....(D.10)......15.....We.can.us |
| 886e0 | 65 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 74 6f 20 65 78 70 6c | e.the.substitution.model.to.expl |
| 88700 | 61 69 6e 20 68 6f 77 20 60 6d 61 6b 65 2d 64 65 63 72 65 6d 65 6e 74 65 72 27 0a 77 6f 72 6b 73 | ain.how.`make-decrementer'.works |
| 88720 | 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 6c 65 74 20 75 73 20 61 6e 61 6c 79 7a 65 20 | ...For.instance,.let.us.analyze. |
| 88740 | 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e | the.evaluation.of.the.expression |
| 88760 | 0a 0a 20 20 20 20 20 28 28 6d 61 6b 65 2d 64 65 63 72 65 6d 65 6e 74 65 72 20 32 35 29 20 32 30 | .......((make-decrementer.25).20 |
| 88780 | 29 0a 0a 20 20 20 57 65 20 66 69 72 73 74 20 73 69 6d 70 6c 69 66 79 20 74 68 65 20 6f 70 65 72 | ).....We.first.simplify.the.oper |
| 887a0 | 61 74 6f 72 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 62 79 20 73 75 62 73 74 | ator.of.the.combination.by.subst |
| 887c0 | 69 74 75 74 69 6e 67 20 32 35 0a 66 6f 72 20 60 62 61 6c 61 6e 63 65 27 20 69 6e 20 74 68 65 20 | ituting.25.for.`balance'.in.the. |
| 887e0 | 62 6f 64 79 20 6f 66 20 60 6d 61 6b 65 2d 64 65 63 72 65 6d 65 6e 74 65 72 27 2e 20 20 54 68 69 | body.of.`make-decrementer'...Thi |
| 88800 | 73 20 72 65 64 75 63 65 73 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 0a 0a 20 20 20 | s.reduces.the.expression.to..... |
| 88820 | 20 20 28 28 6c 61 6d 62 64 61 20 28 61 6d 6f 75 6e 74 29 20 28 2d 20 32 35 20 61 6d 6f 75 6e 74 | ..((lambda.(amount).(-.25.amount |
| 88840 | 29 29 20 32 30 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 61 70 70 6c 79 20 74 68 65 20 6f 70 65 72 | )).20).....Now.we.apply.the.oper |
| 88860 | 61 74 6f 72 20 62 79 20 73 75 62 73 74 69 74 75 74 69 6e 67 20 32 30 20 66 6f 72 20 60 61 6d 6f | ator.by.substituting.20.for.`amo |
| 88880 | 75 6e 74 27 20 69 6e 20 74 68 65 0a 62 6f 64 79 20 6f 66 20 74 68 65 20 60 6c 61 6d 62 64 61 27 | unt'.in.the.body.of.the.`lambda' |
| 888a0 | 20 65 78 70 72 65 73 73 69 6f 6e 3a 0a 0a 20 20 20 20 20 28 2d 20 32 35 20 32 30 29 0a 0a 20 20 | .expression:.......(-.25.20).... |
| 888c0 | 20 54 68 65 20 66 69 6e 61 6c 20 61 6e 73 77 65 72 20 69 73 20 35 2e 0a 0a 20 20 20 4f 62 73 65 | .The.final.answer.is.5......Obse |
| 888e0 | 72 76 65 2c 20 68 6f 77 65 76 65 72 2c 20 77 68 61 74 20 68 61 70 70 65 6e 73 20 69 66 20 77 65 | rve,.however,.what.happens.if.we |
| 88900 | 20 61 74 74 65 6d 70 74 20 61 20 73 69 6d 69 6c 61 72 20 73 75 62 73 74 69 74 75 74 69 6f 6e 0a | .attempt.a.similar.substitution. |
| 88920 | 61 6e 61 6c 79 73 69 73 20 77 69 74 68 20 60 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 69 65 64 2d 77 | analysis.with.`make-simplified-w |
| 88940 | 69 74 68 64 72 61 77 27 3a 0a 0a 20 20 20 20 20 28 28 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 69 65 | ithdraw':.......((make-simplifie |
| 88960 | 64 2d 77 69 74 68 64 72 61 77 20 32 35 29 20 32 30 29 0a 0a 20 20 20 57 65 20 66 69 72 73 74 20 | d-withdraw.25).20).....We.first. |
| 88980 | 73 69 6d 70 6c 69 66 79 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 62 79 20 73 75 62 73 74 69 74 | simplify.the.operator.by.substit |
| 889a0 | 75 74 69 6e 67 20 32 35 20 66 6f 72 20 60 62 61 6c 61 6e 63 65 27 20 69 6e 0a 74 68 65 20 62 6f | uting.25.for.`balance'.in.the.bo |
| 889c0 | 64 79 20 6f 66 20 60 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 69 65 64 2d 77 69 74 68 64 72 61 77 27 | dy.of.`make-simplified-withdraw' |
| 889e0 | 2e 20 20 54 68 69 73 20 72 65 64 75 63 65 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 74 | ...This.reduces.the.expression.t |
| 88a00 | 6f 28 31 29 0a 0a 20 20 20 20 20 28 28 6c 61 6d 62 64 61 20 28 61 6d 6f 75 6e 74 29 20 28 73 65 | o(1).......((lambda.(amount).(se |
| 88a20 | 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 32 35 20 61 6d 6f 75 6e 74 29 29 20 32 35 29 20 32 30 | t!.balance.(-.25.amount)).25).20 |
| 88a40 | 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 61 70 70 6c 79 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 | ).....Now.we.apply.the.operator. |
| 88a60 | 62 79 20 73 75 62 73 74 69 74 75 74 69 6e 67 20 32 30 20 66 6f 72 20 60 61 6d 6f 75 6e 74 27 20 | by.substituting.20.for.`amount'. |
| 88a80 | 69 6e 20 74 68 65 0a 62 6f 64 79 20 6f 66 20 74 68 65 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 | in.the.body.of.the.`lambda'.expr |
| 88aa0 | 65 73 73 69 6f 6e 3a 0a 0a 20 20 20 20 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 32 | ession:.......(set!.balance.(-.2 |
| 88ac0 | 35 20 32 30 29 29 20 32 35 0a 0a 20 20 20 49 66 20 77 65 20 61 64 68 65 72 65 64 20 74 6f 20 74 | 5.20)).25.....If.we.adhered.to.t |
| 88ae0 | 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 2c 20 77 65 20 77 6f 75 6c 64 20 | he.substitution.model,.we.would. |
| 88b00 | 68 61 76 65 20 74 6f 20 73 61 79 20 74 68 61 74 0a 74 68 65 20 6d 65 61 6e 69 6e 67 20 6f 66 20 | have.to.say.that.the.meaning.of. |
| 88b20 | 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 69 73 20 74 6f 20 | the.procedure.application.is.to. |
| 88b40 | 66 69 72 73 74 20 73 65 74 20 60 62 61 6c 61 6e 63 65 27 20 74 6f 20 35 0a 61 6e 64 20 74 68 65 | first.set.`balance'.to.5.and.the |
| 88b60 | 6e 20 72 65 74 75 72 6e 20 32 35 20 61 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 | n.return.25.as.the.value.of.the. |
| 88b80 | 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 54 68 69 73 20 67 65 74 73 20 74 68 65 20 77 72 6f 6e 67 | expression...This.gets.the.wrong |
| 88ba0 | 0a 61 6e 73 77 65 72 2e 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 67 65 74 20 74 68 65 20 63 6f | .answer...In.order.to.get.the.co |
| 88bc0 | 72 72 65 63 74 20 61 6e 73 77 65 72 2c 20 77 65 20 77 6f 75 6c 64 20 68 61 76 65 20 74 6f 20 73 | rrect.answer,.we.would.have.to.s |
| 88be0 | 6f 6d 65 68 6f 77 0a 64 69 73 74 69 6e 67 75 69 73 68 20 74 68 65 20 66 69 72 73 74 20 6f 63 63 | omehow.distinguish.the.first.occ |
| 88c00 | 75 72 72 65 6e 63 65 20 6f 66 20 60 62 61 6c 61 6e 63 65 27 20 28 62 65 66 6f 72 65 20 74 68 65 | urrence.of.`balance'.(before.the |
| 88c20 | 20 65 66 66 65 63 74 20 6f 66 20 74 68 65 0a 60 73 65 74 21 27 29 20 20 66 72 6f 6d 20 74 68 65 | .effect.of.the.`set!')..from.the |
| 88c40 | 20 73 65 63 6f 6e 64 20 6f 63 63 75 72 72 65 6e 63 65 20 6f 66 20 60 62 61 6c 61 6e 63 65 27 20 | .second.occurrence.of.`balance'. |
| 88c60 | 28 61 66 74 65 72 20 74 68 65 20 65 66 66 65 63 74 20 6f 66 0a 74 68 65 20 60 73 65 74 21 27 29 | (after.the.effect.of.the.`set!') |
| 88c80 | 2c 20 61 6e 64 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 63 61 6e | ,.and.the.substitution.model.can |
| 88ca0 | 6e 6f 74 20 64 6f 20 74 68 69 73 2e 0a 0a 20 20 20 54 68 65 20 74 72 6f 75 62 6c 65 20 68 65 72 | not.do.this......The.trouble.her |
| 88cc0 | 65 20 69 73 20 74 68 61 74 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 69 73 20 62 61 73 65 64 20 | e.is.that.substitution.is.based. |
| 88ce0 | 75 6c 74 69 6d 61 74 65 6c 79 20 6f 6e 20 74 68 65 0a 6e 6f 74 69 6f 6e 20 74 68 61 74 20 74 68 | ultimately.on.the.notion.that.th |
| 88d00 | 65 20 73 79 6d 62 6f 6c 73 20 69 6e 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 61 72 65 20 65 73 | e.symbols.in.our.language.are.es |
| 88d20 | 73 65 6e 74 69 61 6c 6c 79 20 6e 61 6d 65 73 20 66 6f 72 0a 76 61 6c 75 65 73 2e 20 20 42 75 74 | sentially.names.for.values...But |
| 88d40 | 20 61 73 20 73 6f 6f 6e 20 61 73 20 77 65 20 69 6e 74 72 6f 64 75 63 65 20 60 73 65 74 21 27 20 | .as.soon.as.we.introduce.`set!'. |
| 88d60 | 61 6e 64 20 74 68 65 20 69 64 65 61 20 74 68 61 74 20 74 68 65 20 76 61 6c 75 65 0a 6f 66 20 61 | and.the.idea.that.the.value.of.a |
| 88d80 | 20 76 61 72 69 61 62 6c 65 20 63 61 6e 20 63 68 61 6e 67 65 2c 20 61 20 76 61 72 69 61 62 6c 65 | .variable.can.change,.a.variable |
| 88da0 | 20 63 61 6e 20 6e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 73 69 6d 70 6c 79 20 61 20 6e 61 6d 65 2e | .can.no.longer.be.simply.a.name. |
| 88dc0 | 0a 4e 6f 77 20 61 20 76 61 72 69 61 62 6c 65 20 73 6f 6d 65 68 6f 77 20 72 65 66 65 72 73 20 74 | .Now.a.variable.somehow.refers.t |
| 88de0 | 6f 20 61 20 70 6c 61 63 65 20 77 68 65 72 65 20 61 20 76 61 6c 75 65 20 63 61 6e 20 62 65 20 73 | o.a.place.where.a.value.can.be.s |
| 88e00 | 74 6f 72 65 64 2c 0a 61 6e 64 20 74 68 65 20 76 61 6c 75 65 20 73 74 6f 72 65 64 20 61 74 20 74 | tored,.and.the.value.stored.at.t |
| 88e20 | 68 69 73 20 70 6c 61 63 65 20 63 61 6e 20 63 68 61 6e 67 65 2e 20 20 49 6e 20 73 65 63 74 69 6f | his.place.can.change...In.sectio |
| 88e40 | 6e 20 2a 4e 6f 74 65 20 33 2d 32 3a 3a 0a 77 65 20 77 69 6c 6c 20 73 65 65 20 68 6f 77 20 65 6e | n.*Note.3-2::.we.will.see.how.en |
| 88e60 | 76 69 72 6f 6e 6d 65 6e 74 73 20 70 6c 61 79 20 74 68 69 73 20 72 6f 6c 65 20 6f 66 20 22 70 6c | vironments.play.this.role.of."pl |
| 88e80 | 61 63 65 22 20 69 6e 20 6f 75 72 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 2e | ace".in.our.computational.model. |
| 88ea0 | 0a 0a 53 61 6d 65 6e 65 73 73 20 61 6e 64 20 63 68 61 6e 67 65 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ..Sameness.and.change........... |
| 88ec0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 69 73 73 75 65 20 73 75 72 66 61 63 69 6e 67 20 68 | ...........The.issue.surfacing.h |
| 88ee0 | 65 72 65 20 69 73 20 6d 6f 72 65 20 70 72 6f 66 6f 75 6e 64 20 74 68 61 6e 20 74 68 65 20 6d 65 | ere.is.more.profound.than.the.me |
| 88f00 | 72 65 20 62 72 65 61 6b 64 6f 77 6e 20 6f 66 20 61 0a 70 61 72 74 69 63 75 6c 61 72 20 6d 6f 64 | re.breakdown.of.a.particular.mod |
| 88f20 | 65 6c 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 41 73 20 73 6f 6f 6e 20 61 73 20 77 | el.of.computation...As.soon.as.w |
| 88f40 | 65 20 69 6e 74 72 6f 64 75 63 65 20 63 68 61 6e 67 65 20 69 6e 74 6f 0a 6f 75 72 20 63 6f 6d 70 | e.introduce.change.into.our.comp |
| 88f60 | 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 2c 20 6d 61 6e 79 20 6e 6f 74 69 6f 6e 73 20 74 | utational.models,.many.notions.t |
| 88f80 | 68 61 74 20 77 65 72 65 20 70 72 65 76 69 6f 75 73 6c 79 0a 73 74 72 61 69 67 68 74 66 6f 72 77 | hat.were.previously.straightforw |
| 88fa0 | 61 72 64 20 62 65 63 6f 6d 65 20 70 72 6f 62 6c 65 6d 61 74 69 63 61 6c 2e 20 20 43 6f 6e 73 69 | ard.become.problematical...Consi |
| 88fc0 | 64 65 72 20 74 68 65 20 63 6f 6e 63 65 70 74 20 6f 66 20 74 77 6f 0a 74 68 69 6e 67 73 20 62 65 | der.the.concept.of.two.things.be |
| 88fe0 | 69 6e 67 20 22 74 68 65 20 73 61 6d 65 2e 22 0a 0a 20 20 20 53 75 70 70 6f 73 65 20 77 65 20 63 | ing."the.same.".....Suppose.we.c |
| 89000 | 61 6c 6c 20 60 6d 61 6b 65 2d 64 65 63 72 65 6d 65 6e 74 65 72 27 20 74 77 69 63 65 20 77 69 74 | all.`make-decrementer'.twice.wit |
| 89020 | 68 20 74 68 65 20 73 61 6d 65 20 61 72 67 75 6d 65 6e 74 20 74 6f 0a 63 72 65 61 74 65 20 74 77 | h.the.same.argument.to.create.tw |
| 89040 | 6f 20 70 72 6f 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 44 31 20 28 | o.procedures:.......(define.D1.( |
| 89060 | 6d 61 6b 65 2d 64 65 63 72 65 6d 65 6e 74 65 72 20 32 35 29 29 0a 0a 20 20 20 20 20 28 64 65 66 | make-decrementer.25)).......(def |
| 89080 | 69 6e 65 20 44 32 20 28 6d 61 6b 65 2d 64 65 63 72 65 6d 65 6e 74 65 72 20 32 35 29 29 0a 0a 20 | ine.D2.(make-decrementer.25))... |
| 890a0 | 20 20 41 72 65 20 60 44 31 27 20 61 6e 64 20 60 44 32 27 20 74 68 65 20 73 61 6d 65 3f 20 20 41 | ..Are.`D1'.and.`D2'.the.same?..A |
| 890c0 | 6e 20 61 63 63 65 70 74 61 62 6c 65 20 61 6e 73 77 65 72 20 69 73 20 79 65 73 2c 20 62 65 63 61 | n.acceptable.answer.is.yes,.beca |
| 890e0 | 75 73 65 0a 60 44 31 27 20 61 6e 64 20 60 44 32 27 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 | use.`D1'.and.`D2'.have.the.same. |
| 89100 | 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 62 65 68 61 76 69 6f 72 2d 2d 65 61 63 68 20 69 73 20 | computational.behavior--each.is. |
| 89120 | 61 20 70 72 6f 63 65 64 75 72 65 0a 74 68 61 74 20 73 75 62 74 72 61 63 74 73 20 69 74 73 20 69 | a.procedure.that.subtracts.its.i |
| 89140 | 6e 70 75 74 20 66 72 6f 6d 20 32 35 2e 20 20 49 6e 20 66 61 63 74 2c 20 60 44 31 27 20 63 6f 75 | nput.from.25...In.fact,.`D1'.cou |
| 89160 | 6c 64 20 62 65 20 73 75 62 73 74 69 74 75 74 65 64 0a 66 6f 72 20 60 44 32 27 20 69 6e 20 61 6e | ld.be.substituted.for.`D2'.in.an |
| 89180 | 79 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 77 69 74 68 6f 75 74 20 63 68 61 6e 67 69 6e 67 20 74 | y.computation.without.changing.t |
| 891a0 | 68 65 20 72 65 73 75 6c 74 2e 0a 0a 20 20 20 43 6f 6e 74 72 61 73 74 20 74 68 69 73 20 77 69 74 | he.result......Contrast.this.wit |
| 891c0 | 68 20 6d 61 6b 69 6e 67 20 74 77 6f 20 63 61 6c 6c 73 20 74 6f 20 60 6d 61 6b 65 2d 73 69 6d 70 | h.making.two.calls.to.`make-simp |
| 891e0 | 6c 69 66 69 65 64 2d 77 69 74 68 64 72 61 77 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | lified-withdraw':.......(define. |
| 89200 | 57 31 20 28 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 69 65 64 2d 77 69 74 68 64 72 61 77 20 32 35 29 | W1.(make-simplified-withdraw.25) |
| 89220 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 57 32 20 28 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 | ).......(define.W2.(make-simplif |
| 89240 | 69 65 64 2d 77 69 74 68 64 72 61 77 20 32 35 29 29 0a 0a 20 20 20 41 72 65 20 60 57 31 27 20 61 | ied-withdraw.25)).....Are.`W1'.a |
| 89260 | 6e 64 20 60 57 32 27 20 74 68 65 20 73 61 6d 65 3f 20 20 53 75 72 65 6c 79 20 6e 6f 74 2c 20 62 | nd.`W2'.the.same?..Surely.not,.b |
| 89280 | 65 63 61 75 73 65 20 63 61 6c 6c 73 20 74 6f 20 60 57 31 27 20 61 6e 64 0a 60 57 32 27 20 68 61 | ecause.calls.to.`W1'.and.`W2'.ha |
| 892a0 | 76 65 20 64 69 73 74 69 6e 63 74 20 65 66 66 65 63 74 73 2c 20 61 73 20 73 68 6f 77 6e 20 62 79 | ve.distinct.effects,.as.shown.by |
| 892c0 | 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 69 6e 74 65 72 | .the.following.sequence.of.inter |
| 892e0 | 61 63 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 28 57 31 20 32 30 29 0a 20 20 20 20 20 35 0a 0a 20 | actions:.......(W1.20)......5... |
| 89300 | 20 20 20 20 28 57 31 20 32 30 29 0a 20 20 20 20 20 20 2d 20 31 35 0a 0a 20 20 20 20 20 28 57 32 | ....(W1.20).......-.15.......(W2 |
| 89320 | 20 32 30 29 0a 20 20 20 20 20 35 0a 0a 20 20 20 45 76 65 6e 20 74 68 6f 75 67 68 20 60 57 31 27 | .20)......5.....Even.though.`W1' |
| 89340 | 20 61 6e 64 20 60 57 32 27 20 61 72 65 20 22 65 71 75 61 6c 22 20 69 6e 20 74 68 65 20 73 65 6e | .and.`W2'.are."equal".in.the.sen |
| 89360 | 73 65 20 74 68 61 74 20 74 68 65 79 20 61 72 65 0a 62 6f 74 68 20 63 72 65 61 74 65 64 20 62 79 | se.that.they.are.both.created.by |
| 89380 | 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 73 61 6d 65 20 65 78 70 72 65 73 73 69 6f 6e 2c | .evaluating.the.same.expression, |
| 893a0 | 0a 60 28 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 69 65 64 2d 77 69 74 68 64 72 61 77 20 32 35 29 27 | .`(make-simplified-withdraw.25)' |
| 893c0 | 2c 20 69 74 20 69 73 20 6e 6f 74 20 74 72 75 65 20 74 68 61 74 20 60 57 31 27 20 63 6f 75 6c 64 | ,.it.is.not.true.that.`W1'.could |
| 893e0 | 20 62 65 0a 73 75 62 73 74 69 74 75 74 65 64 20 66 6f 72 20 60 57 32 27 20 69 6e 20 61 6e 79 20 | .be.substituted.for.`W2'.in.any. |
| 89400 | 65 78 70 72 65 73 73 69 6f 6e 20 77 69 74 68 6f 75 74 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 | expression.without.changing.the. |
| 89420 | 72 65 73 75 6c 74 20 6f 66 0a 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 | result.of.evaluating.the.express |
| 89440 | 69 6f 6e 2e 0a 0a 20 20 20 41 20 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 73 75 70 70 6f 72 74 | ion......A.language.that.support |
| 89460 | 73 20 74 68 65 20 63 6f 6e 63 65 70 74 20 74 68 61 74 20 22 65 71 75 61 6c 73 20 63 61 6e 20 62 | s.the.concept.that."equals.can.b |
| 89480 | 65 20 73 75 62 73 74 69 74 75 74 65 64 0a 66 6f 72 20 65 71 75 61 6c 73 22 20 69 6e 20 61 6e 20 | e.substituted.for.equals".in.an. |
| 894a0 | 65 78 70 72 65 73 73 73 69 6f 6e 20 77 69 74 68 6f 75 74 20 63 68 61 6e 67 69 6e 67 20 74 68 65 | expresssion.without.changing.the |
| 894c0 | 20 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 73 61 69 64 | .value.of.the.expression.is.said |
| 894e0 | 20 74 6f 20 62 65 20 22 72 65 66 65 72 65 6e 74 69 61 6c 6c 79 20 74 72 61 6e 73 70 61 72 65 6e | .to.be."referentially.transparen |
| 89500 | 74 22 2e 20 20 52 65 66 65 72 65 6e 74 69 61 6c 0a 74 72 61 6e 73 70 61 72 65 6e 63 79 20 69 73 | t"...Referential.transparency.is |
| 89520 | 20 76 69 6f 6c 61 74 65 64 20 77 68 65 6e 20 77 65 20 69 6e 63 6c 75 64 65 20 60 73 65 74 21 27 | .violated.when.we.include.`set!' |
| 89540 | 20 69 6e 20 6f 75 72 20 63 6f 6d 70 75 74 65 72 0a 6c 61 6e 67 75 61 67 65 2e 20 20 54 68 69 73 | .in.our.computer.language...This |
| 89560 | 20 6d 61 6b 65 73 20 69 74 20 74 72 69 63 6b 79 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68 | .makes.it.tricky.to.determine.wh |
| 89580 | 65 6e 20 77 65 20 63 61 6e 20 73 69 6d 70 6c 69 66 79 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 62 | en.we.can.simplify.expressions.b |
| 895a0 | 79 20 73 75 62 73 74 69 74 75 74 69 6e 67 20 65 71 75 69 76 61 6c 65 6e 74 20 65 78 70 72 65 73 | y.substituting.equivalent.expres |
| 895c0 | 73 69 6f 6e 73 2e 20 20 43 6f 6e 73 65 71 75 65 6e 74 6c 79 2c 0a 72 65 61 73 6f 6e 69 6e 67 20 | sions...Consequently,.reasoning. |
| 895e0 | 61 62 6f 75 74 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 75 73 65 20 61 73 73 69 67 6e 6d 65 | about.programs.that.use.assignme |
| 89600 | 6e 74 20 62 65 63 6f 6d 65 73 20 64 72 61 73 74 69 63 61 6c 6c 79 20 6d 6f 72 65 0a 64 69 66 66 | nt.becomes.drastically.more.diff |
| 89620 | 69 63 75 6c 74 2e 0a 0a 20 20 20 4f 6e 63 65 20 77 65 20 66 6f 72 67 6f 20 72 65 66 65 72 65 6e | icult......Once.we.forgo.referen |
| 89640 | 74 69 61 6c 20 74 72 61 6e 73 70 61 72 65 6e 63 79 2c 20 74 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 | tial.transparency,.the.notion.of |
| 89660 | 20 77 68 61 74 20 69 74 20 6d 65 61 6e 73 0a 66 6f 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c | .what.it.means.for.computational |
| 89680 | 20 6f 62 6a 65 63 74 73 20 74 6f 20 62 65 20 22 74 68 65 20 73 61 6d 65 22 20 62 65 63 6f 6d 65 | .objects.to.be."the.same".become |
| 896a0 | 73 20 64 69 66 66 69 63 75 6c 74 20 74 6f 20 63 61 70 74 75 72 65 0a 69 6e 20 61 20 66 6f 72 6d | s.difficult.to.capture.in.a.form |
| 896c0 | 61 6c 20 77 61 79 2e 20 20 49 6e 64 65 65 64 2c 20 74 68 65 20 6d 65 61 6e 69 6e 67 20 6f 66 20 | al.way...Indeed,.the.meaning.of. |
| 896e0 | 22 73 61 6d 65 22 20 69 6e 20 74 68 65 20 72 65 61 6c 20 77 6f 72 6c 64 20 74 68 61 74 0a 6f 75 | "same".in.the.real.world.that.ou |
| 89700 | 72 20 70 72 6f 67 72 61 6d 73 20 6d 6f 64 65 6c 20 69 73 20 68 61 72 64 6c 79 20 63 6c 65 61 72 | r.programs.model.is.hardly.clear |
| 89720 | 20 69 6e 20 69 74 73 65 6c 66 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 77 65 20 63 61 6e 0a | .in.itself...In.general,.we.can. |
| 89740 | 64 65 74 65 72 6d 69 6e 65 20 74 68 61 74 20 74 77 6f 20 61 70 70 61 72 65 6e 74 6c 79 20 69 64 | determine.that.two.apparently.id |
| 89760 | 65 6e 74 69 63 61 6c 20 6f 62 6a 65 63 74 73 20 61 72 65 20 69 6e 64 65 65 64 20 22 74 68 65 20 | entical.objects.are.indeed."the. |
| 89780 | 73 61 6d 65 0a 6f 6e 65 22 20 6f 6e 6c 79 20 62 79 20 6d 6f 64 69 66 79 69 6e 67 20 6f 6e 65 20 | same.one".only.by.modifying.one. |
| 897a0 | 6f 62 6a 65 63 74 20 61 6e 64 20 74 68 65 6e 20 6f 62 73 65 72 76 69 6e 67 20 77 68 65 74 68 65 | object.and.then.observing.whethe |
| 897c0 | 72 20 74 68 65 20 6f 74 68 65 72 0a 6f 62 6a 65 63 74 20 68 61 73 20 63 68 61 6e 67 65 64 20 69 | r.the.other.object.has.changed.i |
| 897e0 | 6e 20 74 68 65 20 73 61 6d 65 20 77 61 79 2e 20 20 42 75 74 20 68 6f 77 20 63 61 6e 20 77 65 20 | n.the.same.way...But.how.can.we. |
| 89800 | 74 65 6c 6c 20 69 66 20 61 6e 20 6f 62 6a 65 63 74 0a 68 61 73 20 22 63 68 61 6e 67 65 64 22 20 | tell.if.an.object.has."changed". |
| 89820 | 6f 74 68 65 72 20 74 68 61 6e 20 62 79 20 6f 62 73 65 72 76 69 6e 67 20 74 68 65 20 22 73 61 6d | other.than.by.observing.the."sam |
| 89840 | 65 22 20 6f 62 6a 65 63 74 20 74 77 69 63 65 20 61 6e 64 0a 73 65 65 69 6e 67 20 77 68 65 74 68 | e".object.twice.and.seeing.wheth |
| 89860 | 65 72 20 73 6f 6d 65 20 70 72 6f 70 65 72 74 79 20 6f 66 20 74 68 65 20 6f 62 6a 65 63 74 20 64 | er.some.property.of.the.object.d |
| 89880 | 69 66 66 65 72 73 20 66 72 6f 6d 20 6f 6e 65 20 6f 62 73 65 72 76 61 74 69 6f 6e 0a 74 6f 20 74 | iffers.from.one.observation.to.t |
| 898a0 | 68 65 20 6e 65 78 74 3f 20 20 54 68 75 73 2c 20 77 65 20 63 61 6e 6e 6f 74 20 64 65 74 65 72 6d | he.next?..Thus,.we.cannot.determ |
| 898c0 | 69 6e 65 20 22 63 68 61 6e 67 65 22 20 77 69 74 68 6f 75 74 20 73 6f 6d 65 20 5f 61 0a 70 72 69 | ine."change".without.some._a.pri |
| 898e0 | 6f 72 69 5f 20 6e 6f 74 69 6f 6e 20 6f 66 20 22 73 61 6d 65 6e 65 73 73 2c 22 20 61 6e 64 20 77 | ori_.notion.of."sameness,".and.w |
| 89900 | 65 20 63 61 6e 6e 6f 74 20 64 65 74 65 72 6d 69 6e 65 20 73 61 6d 65 6e 65 73 73 20 77 69 74 68 | e.cannot.determine.sameness.with |
| 89920 | 6f 75 74 0a 6f 62 73 65 72 76 69 6e 67 20 74 68 65 20 65 66 66 65 63 74 73 20 6f 66 20 63 68 61 | out.observing.the.effects.of.cha |
| 89940 | 6e 67 65 2e 0a 0a 20 20 20 41 73 20 61 6e 20 65 78 61 6d 70 6c 65 20 6f 66 20 68 6f 77 20 74 68 | nge......As.an.example.of.how.th |
| 89960 | 69 73 20 69 73 73 75 65 20 61 72 69 73 65 73 20 69 6e 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 20 | is.issue.arises.in.programming,. |
| 89980 | 63 6f 6e 73 69 64 65 72 20 74 68 65 0a 73 69 74 75 61 74 69 6f 6e 20 77 68 65 72 65 20 50 65 74 | consider.the.situation.where.Pet |
| 899a0 | 65 72 20 61 6e 64 20 50 61 75 6c 20 68 61 76 65 20 61 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 20 | er.and.Paul.have.a.bank.account. |
| 899c0 | 77 69 74 68 20 24 31 30 30 20 69 6e 20 69 74 2e 0a 54 68 65 72 65 20 69 73 20 61 20 73 75 62 73 | with.$100.in.it..There.is.a.subs |
| 899e0 | 74 61 6e 74 69 61 6c 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 6d 6f 64 65 6c | tantial.difference.between.model |
| 89a00 | 69 6e 67 20 74 68 69 73 20 61 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 70 65 74 65 72 2d | ing.this.as.......(define.peter- |
| 89a20 | 61 63 63 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 31 30 30 29 29 0a 20 20 20 20 20 28 64 65 | acc.(make-account.100))......(de |
| 89a40 | 66 69 6e 65 20 70 61 75 6c 2d 61 63 63 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 31 30 30 29 | fine.paul-acc.(make-account.100) |
| 89a60 | 29 0a 0a 61 6e 64 20 6d 6f 64 65 6c 69 6e 67 20 69 74 20 61 73 0a 0a 20 20 20 20 20 28 64 65 66 | )..and.modeling.it.as.......(def |
| 89a80 | 69 6e 65 20 70 65 74 65 72 2d 61 63 63 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 31 30 30 29 | ine.peter-acc.(make-account.100) |
| 89aa0 | 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 70 61 75 6c 2d 61 63 63 20 70 65 74 65 72 2d 61 63 | )......(define.paul-acc.peter-ac |
| 89ac0 | 63 29 0a 0a 20 20 20 49 6e 20 74 68 65 20 66 69 72 73 74 20 73 69 74 75 61 74 69 6f 6e 2c 20 74 | c).....In.the.first.situation,.t |
| 89ae0 | 68 65 20 74 77 6f 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 73 20 61 72 65 20 64 69 73 74 69 6e 63 | he.two.bank.accounts.are.distinc |
| 89b00 | 74 2e 0a 54 72 61 6e 73 61 63 74 69 6f 6e 73 20 6d 61 64 65 20 62 79 20 50 65 74 65 72 20 77 69 | t..Transactions.made.by.Peter.wi |
| 89b20 | 6c 6c 20 6e 6f 74 20 61 66 66 65 63 74 20 50 61 75 6c 27 73 20 61 63 63 6f 75 6e 74 2c 20 61 6e | ll.not.affect.Paul's.account,.an |
| 89b40 | 64 20 76 69 63 65 0a 76 65 72 73 61 2e 20 20 49 6e 20 74 68 65 20 73 65 63 6f 6e 64 20 73 69 74 | d.vice.versa...In.the.second.sit |
| 89b60 | 75 61 74 69 6f 6e 2c 20 68 6f 77 65 76 65 72 2c 20 77 65 20 68 61 76 65 20 64 65 66 69 6e 65 64 | uation,.however,.we.have.defined |
| 89b80 | 20 60 70 61 75 6c 2d 61 63 63 27 20 74 6f 0a 62 65 20 5f 74 68 65 20 73 61 6d 65 20 74 68 69 6e | .`paul-acc'.to.be._the.same.thin |
| 89ba0 | 67 5f 20 61 73 20 60 70 65 74 65 72 2d 61 63 63 27 2e 20 20 49 6e 20 65 66 66 65 63 74 2c 20 50 | g_.as.`peter-acc'...In.effect,.P |
| 89bc0 | 65 74 65 72 20 61 6e 64 20 50 61 75 6c 20 6e 6f 77 20 68 61 76 65 0a 61 20 6a 6f 69 6e 74 20 62 | eter.and.Paul.now.have.a.joint.b |
| 89be0 | 61 6e 6b 20 61 63 63 6f 75 6e 74 2c 20 61 6e 64 20 69 66 20 50 65 74 65 72 20 6d 61 6b 65 73 20 | ank.account,.and.if.Peter.makes. |
| 89c00 | 61 20 77 69 74 68 64 72 61 77 61 6c 20 66 72 6f 6d 20 60 70 65 74 65 72 2d 61 63 63 27 0a 50 61 | a.withdrawal.from.`peter-acc'.Pa |
| 89c20 | 75 6c 20 77 69 6c 6c 20 6f 62 73 65 72 76 65 20 6c 65 73 73 20 6d 6f 6e 65 79 20 69 6e 20 60 70 | ul.will.observe.less.money.in.`p |
| 89c40 | 61 75 6c 2d 61 63 63 27 2e 20 20 54 68 65 73 65 20 74 77 6f 20 73 69 6d 69 6c 61 72 20 62 75 74 | aul-acc'...These.two.similar.but |
| 89c60 | 0a 64 69 73 74 69 6e 63 74 20 73 69 74 75 61 74 69 6f 6e 73 20 63 61 6e 20 63 61 75 73 65 20 63 | .distinct.situations.can.cause.c |
| 89c80 | 6f 6e 66 75 73 69 6f 6e 20 69 6e 20 62 75 69 6c 64 69 6e 67 20 63 6f 6d 70 75 74 61 74 69 6f 6e | onfusion.in.building.computation |
| 89ca0 | 61 6c 0a 6d 6f 64 65 6c 73 2e 20 20 57 69 74 68 20 74 68 65 20 73 68 61 72 65 64 20 61 63 63 6f | al.models...With.the.shared.acco |
| 89cc0 | 75 6e 74 2c 20 69 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 69 74 20 63 61 6e 20 62 65 20 65 73 | unt,.in.particular,.it.can.be.es |
| 89ce0 | 70 65 63 69 61 6c 6c 79 0a 63 6f 6e 66 75 73 69 6e 67 20 74 68 61 74 20 74 68 65 72 65 20 69 73 | pecially.confusing.that.there.is |
| 89d00 | 20 6f 6e 65 20 6f 62 6a 65 63 74 20 28 74 68 65 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 29 20 74 | .one.object.(the.bank.account).t |
| 89d20 | 68 61 74 20 68 61 73 20 74 77 6f 0a 64 69 66 66 65 72 65 6e 74 20 6e 61 6d 65 73 20 28 60 70 65 | hat.has.two.different.names.(`pe |
| 89d40 | 74 65 72 2d 61 63 63 27 20 61 6e 64 20 60 70 61 75 6c 2d 61 63 63 27 29 3b 20 69 66 20 77 65 20 | ter-acc'.and.`paul-acc');.if.we. |
| 89d60 | 61 72 65 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 0a 61 6c 6c 20 74 68 65 20 70 6c 61 63 65 73 | are.searching.for.all.the.places |
| 89d80 | 20 69 6e 20 6f 75 72 20 70 72 6f 67 72 61 6d 20 77 68 65 72 65 20 60 70 61 75 6c 2d 61 63 63 27 | .in.our.program.where.`paul-acc' |
| 89da0 | 20 63 61 6e 20 62 65 20 63 68 61 6e 67 65 64 2c 20 77 65 20 6d 75 73 74 0a 72 65 6d 65 6d 62 65 | .can.be.changed,.we.must.remembe |
| 89dc0 | 72 20 74 6f 20 6c 6f 6f 6b 20 61 6c 73 6f 20 61 74 20 74 68 69 6e 67 73 20 74 68 61 74 20 63 68 | r.to.look.also.at.things.that.ch |
| 89de0 | 61 6e 67 65 20 60 70 65 74 65 72 2d 61 63 63 27 2e 28 32 29 0a 0a 20 20 20 57 69 74 68 20 72 65 | ange.`peter-acc'.(2).....With.re |
| 89e00 | 66 65 72 65 6e 63 65 20 74 6f 20 74 68 65 20 61 62 6f 76 65 20 72 65 6d 61 72 6b 73 20 6f 6e 20 | ference.to.the.above.remarks.on. |
| 89e20 | 22 73 61 6d 65 6e 65 73 73 22 20 61 6e 64 20 22 63 68 61 6e 67 65 2c 22 0a 6f 62 73 65 72 76 65 | "sameness".and."change,".observe |
| 89e40 | 20 74 68 61 74 20 69 66 20 50 65 74 65 72 20 61 6e 64 20 50 61 75 6c 20 63 6f 75 6c 64 20 6f 6e | .that.if.Peter.and.Paul.could.on |
| 89e60 | 6c 79 20 65 78 61 6d 69 6e 65 20 74 68 65 69 72 20 62 61 6e 6b 20 62 61 6c 61 6e 63 65 73 2c 0a | ly.examine.their.bank.balances,. |
| 89e80 | 61 6e 64 20 63 6f 75 6c 64 20 6e 6f 74 20 70 65 72 66 6f 72 6d 20 6f 70 65 72 61 74 69 6f 6e 73 | and.could.not.perform.operations |
| 89ea0 | 20 74 68 61 74 20 63 68 61 6e 67 65 64 20 74 68 65 20 62 61 6c 61 6e 63 65 2c 20 74 68 65 6e 20 | .that.changed.the.balance,.then. |
| 89ec0 | 74 68 65 0a 69 73 73 75 65 20 6f 66 20 77 68 65 74 68 65 72 20 74 68 65 20 74 77 6f 20 61 63 63 | the.issue.of.whether.the.two.acc |
| 89ee0 | 6f 75 6e 74 73 20 61 72 65 20 64 69 73 74 69 6e 63 74 20 77 6f 75 6c 64 20 62 65 20 6d 6f 6f 74 | ounts.are.distinct.would.be.moot |
| 89f00 | 2e 20 20 49 6e 0a 67 65 6e 65 72 61 6c 2c 20 73 6f 20 6c 6f 6e 67 20 61 73 20 77 65 20 6e 65 76 | ...In.general,.so.long.as.we.nev |
| 89f20 | 65 72 20 6d 6f 64 69 66 79 20 64 61 74 61 20 6f 62 6a 65 63 74 73 2c 20 77 65 20 63 61 6e 20 72 | er.modify.data.objects,.we.can.r |
| 89f40 | 65 67 61 72 64 20 61 0a 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 6f 62 6a 65 63 74 20 74 6f 20 | egard.a.compound.data.object.to. |
| 89f60 | 62 65 20 70 72 65 63 69 73 65 6c 79 20 74 68 65 20 74 6f 74 61 6c 69 74 79 20 6f 66 20 69 74 73 | be.precisely.the.totality.of.its |
| 89f80 | 20 70 69 65 63 65 73 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 61 20 72 61 74 69 6f 6e 61 | .pieces...For.example,.a.rationa |
| 89fa0 | 6c 20 6e 75 6d 62 65 72 20 69 73 20 64 65 74 65 72 6d 69 6e 65 64 20 62 79 20 67 69 76 69 6e 67 | l.number.is.determined.by.giving |
| 89fc0 | 20 69 74 73 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 0a 69 74 73 20 64 65 6e 6f 6d 69 6e 61 74 | .its.numerator.and.its.denominat |
| 89fe0 | 6f 72 2e 20 20 42 75 74 20 74 68 69 73 20 76 69 65 77 20 69 73 20 6e 6f 20 6c 6f 6e 67 65 72 20 | or...But.this.view.is.no.longer. |
| 8a000 | 76 61 6c 69 64 20 69 6e 20 74 68 65 20 70 72 65 73 65 6e 63 65 20 6f 66 0a 63 68 61 6e 67 65 2c | valid.in.the.presence.of.change, |
| 8a020 | 20 77 68 65 72 65 20 61 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 6f 62 6a 65 63 74 20 68 61 | .where.a.compound.data.object.ha |
| 8a040 | 73 20 61 6e 20 22 69 64 65 6e 74 69 74 79 22 20 74 68 61 74 20 69 73 0a 73 6f 6d 65 74 68 69 6e | s.an."identity".that.is.somethin |
| 8a060 | 67 20 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d 20 74 68 65 20 70 69 65 63 65 73 20 6f 66 20 77 | g.different.from.the.pieces.of.w |
| 8a080 | 68 69 63 68 20 69 74 20 69 73 20 63 6f 6d 70 6f 73 65 64 2e 20 20 41 20 62 61 6e 6b 0a 61 63 63 | hich.it.is.composed...A.bank.acc |
| 8a0a0 | 6f 75 6e 74 20 69 73 20 73 74 69 6c 6c 20 22 74 68 65 20 73 61 6d 65 22 20 62 61 6e 6b 20 61 63 | ount.is.still."the.same".bank.ac |
| 8a0c0 | 63 6f 75 6e 74 20 65 76 65 6e 20 69 66 20 77 65 20 63 68 61 6e 67 65 20 74 68 65 20 62 61 6c 61 | count.even.if.we.change.the.bala |
| 8a0e0 | 6e 63 65 0a 62 79 20 6d 61 6b 69 6e 67 20 61 20 77 69 74 68 64 72 61 77 61 6c 3b 20 63 6f 6e 76 | nce.by.making.a.withdrawal;.conv |
| 8a100 | 65 72 73 65 6c 79 2c 20 77 65 20 63 6f 75 6c 64 20 68 61 76 65 20 74 77 6f 20 64 69 66 66 65 72 | ersely,.we.could.have.two.differ |
| 8a120 | 65 6e 74 20 62 61 6e 6b 0a 61 63 63 6f 75 6e 74 73 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 | ent.bank.accounts.with.the.same. |
| 8a140 | 73 74 61 74 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 20 20 54 68 69 73 20 63 6f 6d 70 6c 69 63 | state.information...This.complic |
| 8a160 | 61 74 69 6f 6e 20 69 73 20 61 0a 63 6f 6e 73 65 71 75 65 6e 63 65 2c 20 6e 6f 74 20 6f 66 20 6f | ation.is.a.consequence,.not.of.o |
| 8a180 | 75 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2c 20 62 75 74 20 6f 66 20 | ur.programming.language,.but.of. |
| 8a1a0 | 6f 75 72 20 70 65 72 63 65 70 74 69 6f 6e 20 6f 66 0a 61 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 | our.perception.of.a.bank.account |
| 8a1c0 | 20 61 73 20 61 6e 20 6f 62 6a 65 63 74 2e 20 20 57 65 20 64 6f 20 6e 6f 74 2c 20 66 6f 72 20 65 | .as.an.object...We.do.not,.for.e |
| 8a1e0 | 78 61 6d 70 6c 65 2c 20 6f 72 64 69 6e 61 72 69 6c 79 20 72 65 67 61 72 64 0a 61 20 72 61 74 69 | xample,.ordinarily.regard.a.rati |
| 8a200 | 6f 6e 61 6c 20 6e 75 6d 62 65 72 20 61 73 20 61 20 63 68 61 6e 67 65 61 62 6c 65 20 6f 62 6a 65 | onal.number.as.a.changeable.obje |
| 8a220 | 63 74 20 77 69 74 68 20 69 64 65 6e 74 69 74 79 2c 20 73 75 63 68 20 74 68 61 74 20 77 65 0a 63 | ct.with.identity,.such.that.we.c |
| 8a240 | 6f 75 6c 64 20 63 68 61 6e 67 65 20 74 68 65 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 73 74 | ould.change.the.numerator.and.st |
| 8a260 | 69 6c 6c 20 68 61 76 65 20 22 74 68 65 20 73 61 6d 65 22 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d | ill.have."the.same".rational.num |
| 8a280 | 62 65 72 2e 0a 0a 50 69 74 66 61 6c 6c 73 20 6f 66 20 69 6d 70 65 72 61 74 69 76 65 20 70 72 6f | ber...Pitfalls.of.imperative.pro |
| 8a2a0 | 67 72 61 6d 6d 69 6e 67 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | gramming........................ |
| 8a2c0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 63 6f 6e 74 72 61 73 74 20 74 6f 20 66 75 6e 63 | .............In.contrast.to.func |
| 8a2e0 | 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 | tional.programming,.programming. |
| 8a300 | 74 68 61 74 20 6d 61 6b 65 73 20 65 78 74 65 6e 73 69 76 65 0a 75 73 65 20 6f 66 20 61 73 73 69 | that.makes.extensive.use.of.assi |
| 8a320 | 67 6e 6d 65 6e 74 20 69 73 20 6b 6e 6f 77 6e 20 61 73 20 22 69 6d 70 65 72 61 74 69 76 65 20 70 | gnment.is.known.as."imperative.p |
| 8a340 | 72 6f 67 72 61 6d 6d 69 6e 67 22 2e 20 20 49 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 0a 72 61 69 | rogramming"...In.addition.to.rai |
| 8a360 | 73 69 6e 67 20 63 6f 6d 70 6c 69 63 61 74 69 6f 6e 73 20 61 62 6f 75 74 20 63 6f 6d 70 75 74 61 | sing.complications.about.computa |
| 8a380 | 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 2c 20 70 72 6f 67 72 61 6d 73 20 77 72 69 74 74 65 6e 20 | tional.models,.programs.written. |
| 8a3a0 | 69 6e 0a 69 6d 70 65 72 61 74 69 76 65 20 73 74 79 6c 65 20 61 72 65 20 73 75 73 63 65 70 74 69 | in.imperative.style.are.suscepti |
| 8a3c0 | 62 6c 65 20 74 6f 20 62 75 67 73 20 74 68 61 74 20 63 61 6e 6e 6f 74 20 6f 63 63 75 72 20 69 6e | ble.to.bugs.that.cannot.occur.in |
| 8a3e0 | 20 66 75 6e 63 74 69 6f 6e 61 6c 0a 70 72 6f 67 72 61 6d 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 | .functional.programs...For.examp |
| 8a400 | 6c 65 2c 20 72 65 63 61 6c 6c 20 74 68 65 20 69 74 65 72 61 74 69 76 65 20 66 61 63 74 6f 72 69 | le,.recall.the.iterative.factori |
| 8a420 | 61 6c 20 70 72 6f 67 72 61 6d 20 66 72 6f 6d 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d | al.program.from.section.*Note.1- |
| 8a440 | 32 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 | 2-1:::.......(define.(factorial. |
| 8a460 | 6e 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 20 70 72 6f 64 75 63 74 20 | n)........(define.(iter.product. |
| 8a480 | 63 6f 75 6e 74 65 72 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 63 6f 75 6e 74 65 72 | counter)..........(if.(>.counter |
| 8a4a0 | 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 | .n)..............product........ |
| 8a4c0 | 20 20 20 20 20 20 28 69 74 65 72 20 28 2a 20 63 6f 75 6e 74 65 72 20 70 72 6f 64 75 63 74 29 0a | ......(iter.(*.counter.product). |
| 8a4e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 63 6f 75 6e 74 65 72 20 31 29 | ...................(+.counter.1) |
| 8a500 | 29 29 29 0a 20 20 20 20 20 20 20 28 69 74 65 72 20 31 20 31 29 29 0a 0a 20 20 20 49 6e 73 74 65 | )))........(iter.1.1)).....Inste |
| 8a520 | 61 64 20 6f 66 20 70 61 73 73 69 6e 67 20 61 72 67 75 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 69 | ad.of.passing.arguments.in.the.i |
| 8a540 | 6e 74 65 72 6e 61 6c 20 69 74 65 72 61 74 69 76 65 20 6c 6f 6f 70 2c 20 77 65 0a 63 6f 75 6c 64 | nternal.iterative.loop,.we.could |
| 8a560 | 20 61 64 6f 70 74 20 61 20 6d 6f 72 65 20 69 6d 70 65 72 61 74 69 76 65 20 73 74 79 6c 65 20 62 | .adopt.a.more.imperative.style.b |
| 8a580 | 79 20 75 73 69 6e 67 20 65 78 70 6c 69 63 69 74 20 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 0a 75 | y.using.explicit.assignment.to.u |
| 8a5a0 | 70 64 61 74 65 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 | pdate.the.values.of.the.variable |
| 8a5c0 | 73 20 60 70 72 6f 64 75 63 74 27 20 61 6e 64 20 60 63 6f 75 6e 74 65 72 27 3a 0a 0a 20 20 20 20 | s.`product'.and.`counter':...... |
| 8a5e0 | 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 28 6c | .(define.(factorial.n)........(l |
| 8a600 | 65 74 20 28 28 70 72 6f 64 75 63 74 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f | et.((product.1)..............(co |
| 8a620 | 75 6e 74 65 72 20 31 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 | unter.1))..........(define.(iter |
| 8a640 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 63 6f 75 6e 74 65 72 20 6e 29 0a 20 | )............(if.(>.counter.n).. |
| 8a660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 20 20 20 | ..............product........... |
| 8a680 | 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 70 72 6f 64 75 63 74 20 28 2a 20 63 6f 75 | .....(begin.(set!.product.(*.cou |
| 8a6a0 | 6e 74 65 72 20 70 72 6f 64 75 63 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | nter.product)).................. |
| 8a6c0 | 20 20 20 20 20 28 73 65 74 21 20 63 6f 75 6e 74 65 72 20 28 2b 20 63 6f 75 6e 74 65 72 20 31 29 | .....(set!.counter.(+.counter.1) |
| 8a6e0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 29 29 29 | ).......................(iter))) |
| 8a700 | 29 0a 20 20 20 20 20 20 20 20 20 28 69 74 65 72 29 29 29 0a 0a 20 20 20 54 68 69 73 20 64 6f 65 | )..........(iter))).....This.doe |
| 8a720 | 73 20 6e 6f 74 20 63 68 61 6e 67 65 20 74 68 65 20 72 65 73 75 6c 74 73 20 70 72 6f 64 75 63 65 | s.not.change.the.results.produce |
| 8a740 | 64 20 62 79 20 74 68 65 20 70 72 6f 67 72 61 6d 2c 20 62 75 74 20 69 74 0a 64 6f 65 73 20 69 6e | d.by.the.program,.but.it.does.in |
| 8a760 | 74 72 6f 64 75 63 65 20 61 20 73 75 62 74 6c 65 20 74 72 61 70 2e 20 20 48 6f 77 20 64 6f 20 77 | troduce.a.subtle.trap...How.do.w |
| 8a780 | 65 20 64 65 63 69 64 65 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 0a 61 73 73 69 67 6e | e.decide.the.order.of.the.assign |
| 8a7a0 | 6d 65 6e 74 73 3f 20 20 41 73 20 69 74 20 68 61 70 70 65 6e 73 2c 20 74 68 65 20 70 72 6f 67 72 | ments?..As.it.happens,.the.progr |
| 8a7c0 | 61 6d 20 69 73 20 63 6f 72 72 65 63 74 20 61 73 20 77 72 69 74 74 65 6e 2e 20 20 42 75 74 0a 77 | am.is.correct.as.written...But.w |
| 8a7e0 | 72 69 74 69 6e 67 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 6f 70 | riting.the.assignments.in.the.op |
| 8a800 | 70 6f 73 69 74 65 20 6f 72 64 65 72 0a 0a 20 20 20 20 20 28 73 65 74 21 20 63 6f 75 6e 74 65 72 | posite.order.......(set!.counter |
| 8a820 | 20 28 2b 20 63 6f 75 6e 74 65 72 20 31 29 29 0a 20 20 20 20 20 28 73 65 74 21 20 70 72 6f 64 75 | .(+.counter.1))......(set!.produ |
| 8a840 | 63 74 20 28 2a 20 63 6f 75 6e 74 65 72 20 70 72 6f 64 75 63 74 29 29 0a 0a 77 6f 75 6c 64 20 68 | ct.(*.counter.product))..would.h |
| 8a860 | 61 76 65 20 70 72 6f 64 75 63 65 64 20 61 20 64 69 66 66 65 72 65 6e 74 2c 20 69 6e 63 6f 72 72 | ave.produced.a.different,.incorr |
| 8a880 | 65 63 74 20 72 65 73 75 6c 74 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 0a 70 72 6f 67 72 61 6d | ect.result...In.general,.program |
| 8a8a0 | 6d 69 6e 67 20 77 69 74 68 20 61 73 73 69 67 6e 6d 65 6e 74 20 66 6f 72 63 65 73 20 75 73 20 74 | ming.with.assignment.forces.us.t |
| 8a8c0 | 6f 20 63 61 72 65 66 75 6c 6c 79 20 63 6f 6e 73 69 64 65 72 20 74 68 65 0a 72 65 6c 61 74 69 76 | o.carefully.consider.the.relativ |
| 8a8e0 | 65 20 6f 72 64 65 72 73 20 6f 66 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 74 6f 20 6d | e.orders.of.the.assignments.to.m |
| 8a900 | 61 6b 65 20 73 75 72 65 20 74 68 61 74 20 65 61 63 68 20 73 74 61 74 65 6d 65 6e 74 20 69 73 0a | ake.sure.that.each.statement.is. |
| 8a920 | 75 73 69 6e 67 20 74 68 65 20 63 6f 72 72 65 63 74 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 | using.the.correct.version.of.the |
| 8a940 | 20 76 61 72 69 61 62 6c 65 73 20 74 68 61 74 20 68 61 76 65 20 62 65 65 6e 20 63 68 61 6e 67 65 | .variables.that.have.been.change |
| 8a960 | 64 2e 0a 54 68 69 73 20 69 73 73 75 65 20 73 69 6d 70 6c 79 20 64 6f 65 73 20 6e 6f 74 20 61 72 | d..This.issue.simply.does.not.ar |
| 8a980 | 69 73 65 20 69 6e 20 66 75 6e 63 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 73 2e 28 33 29 0a 0a | ise.in.functional.programs.(3).. |
| 8a9a0 | 20 20 20 54 68 65 20 63 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 69 6d 70 65 72 61 74 69 76 65 20 | ...The.complexity.of.imperative. |
| 8a9c0 | 70 72 6f 67 72 61 6d 73 20 62 65 63 6f 6d 65 73 20 65 76 65 6e 20 77 6f 72 73 65 20 69 66 20 77 | programs.becomes.even.worse.if.w |
| 8a9e0 | 65 0a 63 6f 6e 73 69 64 65 72 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 69 6e 20 77 68 69 63 68 | e.consider.applications.in.which |
| 8aa00 | 20 73 65 76 65 72 61 6c 20 70 72 6f 63 65 73 73 65 73 20 65 78 65 63 75 74 65 20 63 6f 6e 63 75 | .several.processes.execute.concu |
| 8aa20 | 72 72 65 6e 74 6c 79 2e 0a 57 65 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 6f 20 74 68 69 73 20 | rrently..We.will.return.to.this. |
| 8aa40 | 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 34 3a 3a 2e 20 20 46 69 72 73 74 2c 20 | in.section.*Note.3-4::...First,. |
| 8aa60 | 68 6f 77 65 76 65 72 2c 20 77 65 20 77 69 6c 6c 0a 61 64 64 72 65 73 73 20 74 68 65 20 69 73 73 | however,.we.will.address.the.iss |
| 8aa80 | 75 65 20 6f 66 20 70 72 6f 76 69 64 69 6e 67 20 61 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 | ue.of.providing.a.computational. |
| 8aaa0 | 6d 6f 64 65 6c 20 66 6f 72 20 65 78 70 72 65 73 73 69 6f 6e 73 0a 74 68 61 74 20 69 6e 76 6f 6c | model.for.expressions.that.invol |
| 8aac0 | 76 65 20 61 73 73 69 67 6e 6d 65 6e 74 2c 20 61 6e 64 20 65 78 70 6c 6f 72 65 20 74 68 65 20 75 | ve.assignment,.and.explore.the.u |
| 8aae0 | 73 65 73 20 6f 66 20 6f 62 6a 65 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 0a 73 74 61 74 65 20 | ses.of.objects.with.local.state. |
| 8ab00 | 69 6e 20 64 65 73 69 67 6e 69 6e 67 20 73 69 6d 75 6c 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 | in.designing.simulations........ |
| 8ab20 | 2a 45 78 65 72 63 69 73 65 20 33 2e 37 3a 2a 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 62 61 6e | *Exercise.3.7:*.Consider.the.ban |
| 8ab40 | 6b 20 61 63 63 6f 75 6e 74 20 6f 62 6a 65 63 74 73 20 63 72 65 61 74 65 64 20 62 79 0a 20 20 20 | k.account.objects.created.by.... |
| 8ab60 | 20 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 2c 20 77 69 74 68 20 74 68 65 20 70 61 73 73 77 | ..`make-account',.with.the.passw |
| 8ab80 | 6f 72 64 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e | ord.modification.described.in.*N |
| 8aba0 | 6f 74 65 0a 20 20 20 20 20 45 78 65 72 63 69 73 65 20 33 2d 33 3a 3a 2e 20 20 53 75 70 70 6f 73 | ote......Exercise.3-3::...Suppos |
| 8abc0 | 65 20 74 68 61 74 20 6f 75 72 20 62 61 6e 6b 69 6e 67 20 73 79 73 74 65 6d 20 72 65 71 75 69 72 | e.that.our.banking.system.requir |
| 8abe0 | 65 73 20 74 68 65 0a 20 20 20 20 20 61 62 69 6c 69 74 79 20 74 6f 20 6d 61 6b 65 20 6a 6f 69 6e | es.the......ability.to.make.join |
| 8ac00 | 74 20 61 63 63 6f 75 6e 74 73 2e 20 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 | t.accounts...Define.a.procedure. |
| 8ac20 | 60 6d 61 6b 65 2d 6a 6f 69 6e 74 27 0a 20 20 20 20 20 74 68 61 74 20 61 63 63 6f 6d 70 6c 69 73 | `make-joint'......that.accomplis |
| 8ac40 | 68 65 73 20 74 68 69 73 2e 20 20 60 4d 61 6b 65 2d 6a 6f 69 6e 74 27 20 73 68 6f 75 6c 64 20 74 | hes.this...`Make-joint'.should.t |
| 8ac60 | 61 6b 65 20 74 68 72 65 65 20 61 72 67 75 6d 65 6e 74 73 2e 0a 20 20 20 20 20 54 68 65 20 66 69 | ake.three.arguments.......The.fi |
| 8ac80 | 72 73 74 20 69 73 20 61 20 70 61 73 73 77 6f 72 64 2d 70 72 6f 74 65 63 74 65 64 20 61 63 63 6f | rst.is.a.password-protected.acco |
| 8aca0 | 75 6e 74 2e 20 20 54 68 65 20 73 65 63 6f 6e 64 20 61 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 6d | unt...The.second.argument......m |
| 8acc0 | 75 73 74 20 6d 61 74 63 68 20 74 68 65 20 70 61 73 73 77 6f 72 64 20 77 69 74 68 20 77 68 69 63 | ust.match.the.password.with.whic |
| 8ace0 | 68 20 74 68 65 20 61 63 63 6f 75 6e 74 20 77 61 73 20 64 65 66 69 6e 65 64 20 69 6e 0a 20 20 20 | h.the.account.was.defined.in.... |
| 8ad00 | 20 20 6f 72 64 65 72 20 66 6f 72 20 74 68 65 20 60 6d 61 6b 65 2d 6a 6f 69 6e 74 27 20 6f 70 65 | ..order.for.the.`make-joint'.ope |
| 8ad20 | 72 61 74 69 6f 6e 20 74 6f 20 70 72 6f 63 65 65 64 2e 20 20 54 68 65 20 74 68 69 72 64 0a 20 20 | ration.to.proceed...The.third... |
| 8ad40 | 20 20 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 20 6e 65 77 20 70 61 73 73 77 6f 72 64 2e 20 20 | ...argument.is.a.new.password... |
| 8ad60 | 60 4d 61 6b 65 2d 6a 6f 69 6e 74 27 20 69 73 20 74 6f 20 63 72 65 61 74 65 20 61 6e 0a 20 20 20 | `Make-joint'.is.to.create.an.... |
| 8ad80 | 20 20 61 64 64 69 74 69 6f 6e 61 6c 20 61 63 63 65 73 73 20 74 6f 20 74 68 65 20 6f 72 69 67 69 | ..additional.access.to.the.origi |
| 8ada0 | 6e 61 6c 20 61 63 63 6f 75 6e 74 20 75 73 69 6e 67 20 74 68 65 20 6e 65 77 20 70 61 73 73 77 6f | nal.account.using.the.new.passwo |
| 8adc0 | 72 64 2e 0a 20 20 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 60 70 65 74 65 72 2d | rd.......For.example,.if.`peter- |
| 8ade0 | 61 63 63 27 20 69 73 20 61 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 20 77 69 74 68 20 70 61 73 73 | acc'.is.a.bank.account.with.pass |
| 8ae00 | 77 6f 72 64 0a 20 20 20 20 20 60 6f 70 65 6e 2d 73 65 73 61 6d 65 27 2c 20 74 68 65 6e 0a 0a 20 | word......`open-sesame',.then... |
| 8ae20 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 70 61 75 6c 2d 61 63 63 0a 20 20 20 20 20 20 | .........(define.paul-acc....... |
| 8ae40 | 20 20 20 20 20 20 28 6d 61 6b 65 2d 6a 6f 69 6e 74 20 70 65 74 65 72 2d 61 63 63 20 27 6f 70 65 | ......(make-joint.peter-acc.'ope |
| 8ae60 | 6e 2d 73 65 73 61 6d 65 20 27 72 6f 73 65 62 75 64 29 29 0a 0a 20 20 20 20 20 77 69 6c 6c 20 61 | n-sesame.'rosebud)).......will.a |
| 8ae80 | 6c 6c 6f 77 20 6f 6e 65 20 74 6f 20 6d 61 6b 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 20 6f 6e | llow.one.to.make.transactions.on |
| 8aea0 | 20 60 70 65 74 65 72 2d 61 63 63 27 20 75 73 69 6e 67 20 74 68 65 20 6e 61 6d 65 0a 20 20 20 20 | .`peter-acc'.using.the.name..... |
| 8aec0 | 20 60 70 61 75 6c 2d 61 63 63 27 20 61 6e 64 20 74 68 65 20 70 61 73 73 77 6f 72 64 20 60 72 6f | .`paul-acc'.and.the.password.`ro |
| 8aee0 | 73 65 62 75 64 27 2e 20 20 59 6f 75 20 6d 61 79 20 77 69 73 68 20 74 6f 20 6d 6f 64 69 66 79 20 | sebud'...You.may.wish.to.modify. |
| 8af00 | 79 6f 75 72 0a 20 20 20 20 20 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 2a 4e 6f 74 65 20 45 78 65 72 | your......solution.to.*Note.Exer |
| 8af20 | 63 69 73 65 20 33 2d 33 3a 3a 20 74 6f 20 61 63 63 6f 6d 6d 6f 64 61 74 65 20 74 68 69 73 20 6e | cise.3-3::.to.accommodate.this.n |
| 8af40 | 65 77 20 66 65 61 74 75 72 65 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 38 3a 2a | ew.feature.......*Exercise.3.8:* |
| 8af60 | 20 57 68 65 6e 20 77 65 20 64 65 66 69 6e 65 64 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 | .When.we.defined.the.evaluation. |
| 8af80 | 6d 6f 64 65 6c 20 69 6e 20 73 65 63 74 69 6f 6e 0a 20 20 20 20 20 2a 4e 6f 74 65 20 31 2d 31 2d | model.in.section......*Note.1-1- |
| 8afa0 | 33 3a 3a 2c 20 77 65 20 73 61 69 64 20 74 68 61 74 20 74 68 65 20 66 69 72 73 74 20 73 74 65 70 | 3::,.we.said.that.the.first.step |
| 8afc0 | 20 69 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 61 6e 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f | .in.evaluating.an......expressio |
| 8afe0 | 6e 20 69 73 20 74 6f 20 65 76 61 6c 75 61 74 65 20 69 74 73 20 73 75 62 65 78 70 72 65 73 73 69 | n.is.to.evaluate.its.subexpressi |
| 8b000 | 6f 6e 73 2e 20 20 42 75 74 20 77 65 20 6e 65 76 65 72 0a 20 20 20 20 20 73 70 65 63 69 66 69 65 | ons...But.we.never......specifie |
| 8b020 | 64 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 73 75 62 65 78 70 72 | d.the.order.in.which.the.subexpr |
| 8b040 | 65 73 73 69 6f 6e 73 20 73 68 6f 75 6c 64 20 62 65 0a 20 20 20 20 20 65 76 61 6c 75 61 74 65 64 | essions.should.be......evaluated |
| 8b060 | 20 28 65 2e 67 2e 2c 20 6c 65 66 74 20 74 6f 20 72 69 67 68 74 20 6f 72 20 72 69 67 68 74 20 74 | .(e.g.,.left.to.right.or.right.t |
| 8b080 | 6f 20 6c 65 66 74 29 2e 20 20 57 68 65 6e 20 77 65 0a 20 20 20 20 20 69 6e 74 72 6f 64 75 63 65 | o.left)...When.we......introduce |
| 8b0a0 | 20 61 73 73 69 67 6e 6d 65 6e 74 2c 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 | .assignment,.the.order.in.which. |
| 8b0c0 | 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 61 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 | the.arguments.to.a......procedur |
| 8b0e0 | 65 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 20 63 61 6e 20 6d 61 6b 65 20 61 20 64 69 66 66 65 | e.are.evaluated.can.make.a.diffe |
| 8b100 | 72 65 6e 63 65 20 74 6f 20 74 68 65 20 72 65 73 75 6c 74 2e 0a 20 20 20 20 20 44 65 66 69 6e 65 | rence.to.the.result.......Define |
| 8b120 | 20 61 20 73 69 6d 70 6c 65 20 70 72 6f 63 65 64 75 72 65 20 60 66 27 20 73 75 63 68 20 74 68 61 | .a.simple.procedure.`f'.such.tha |
| 8b140 | 74 20 65 76 61 6c 75 61 74 69 6e 67 20 60 28 2b 20 28 66 20 30 29 20 28 66 0a 20 20 20 20 20 31 | t.evaluating.`(+.(f.0).(f......1 |
| 8b160 | 29 29 27 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 30 20 69 66 20 74 68 65 20 61 72 67 75 6d 65 6e | ))'.will.return.0.if.the.argumen |
| 8b180 | 74 73 20 74 6f 20 60 2b 27 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 20 66 72 6f 6d 20 6c 65 66 | ts.to.`+'.are.evaluated.from.lef |
| 8b1a0 | 74 0a 20 20 20 20 20 74 6f 20 72 69 67 68 74 20 62 75 74 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 | t......to.right.but.will.return. |
| 8b1c0 | 31 20 69 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 | 1.if.the.arguments.are.evaluated |
| 8b1e0 | 20 66 72 6f 6d 0a 20 20 20 20 20 72 69 67 68 74 20 74 6f 20 6c 65 66 74 2e 0a 0a 20 20 20 2d 2d | .from......right.to.left......-- |
| 8b200 | 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 | --------.Footnotes.----------... |
| 8b220 | 20 20 28 31 29 20 57 65 20 64 6f 6e 27 74 20 73 75 62 73 74 69 74 75 74 65 20 66 6f 72 20 74 68 | ..(1).We.don't.substitute.for.th |
| 8b240 | 65 20 6f 63 63 75 72 72 65 6e 63 65 20 6f 66 20 60 62 61 6c 61 6e 63 65 27 20 69 6e 20 74 68 65 | e.occurrence.of.`balance'.in.the |
| 8b260 | 0a 60 73 65 74 21 27 20 65 78 70 72 65 73 73 69 6f 6e 20 62 65 63 61 75 73 65 20 74 68 65 20 3c | .`set!'.expression.because.the.< |
| 8b280 | 4e 41 4d 45 3e 20 69 6e 20 61 20 60 73 65 74 21 27 20 69 73 20 6e 6f 74 20 65 76 61 6c 75 61 74 | NAME>.in.a.`set!'.is.not.evaluat |
| 8b2a0 | 65 64 2e 20 20 49 66 0a 77 65 20 64 69 64 20 73 75 62 73 74 69 74 75 74 65 20 66 6f 72 20 69 74 | ed...If.we.did.substitute.for.it |
| 8b2c0 | 2c 20 77 65 20 77 6f 75 6c 64 20 67 65 74 20 60 28 73 65 74 21 20 32 35 20 28 2d 20 32 35 20 61 | ,.we.would.get.`(set!.25.(-.25.a |
| 8b2e0 | 6d 6f 75 6e 74 29 29 27 2c 20 77 68 69 63 68 0a 6d 61 6b 65 73 20 6e 6f 20 73 65 6e 73 65 2e 0a | mount))',.which.makes.no.sense.. |
| 8b300 | 0a 20 20 20 28 32 29 20 54 68 65 20 70 68 65 6e 6f 6d 65 6e 6f 6e 20 6f 66 20 61 20 73 69 6e 67 | ....(2).The.phenomenon.of.a.sing |
| 8b320 | 6c 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 20 62 65 69 6e 67 20 61 63 | le.computational.object.being.ac |
| 8b340 | 63 65 73 73 65 64 0a 62 79 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 6e 61 6d 65 20 69 73 20 | cessed.by.more.than.one.name.is. |
| 8b360 | 6b 6e 6f 77 6e 20 61 73 20 22 61 6c 69 61 73 69 6e 67 22 2e 20 20 54 68 65 20 6a 6f 69 6e 74 20 | known.as."aliasing"...The.joint. |
| 8b380 | 62 61 6e 6b 20 61 63 63 6f 75 6e 74 0a 73 69 74 75 61 74 69 6f 6e 20 69 6c 6c 75 73 74 72 61 74 | bank.account.situation.illustrat |
| 8b3a0 | 65 73 20 61 20 76 65 72 79 20 73 69 6d 70 6c 65 20 65 78 61 6d 70 6c 65 20 6f 66 20 61 6e 20 61 | es.a.very.simple.example.of.an.a |
| 8b3c0 | 6c 69 61 73 2e 20 20 49 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 33 2d 33 3a 3a 20 77 65 | lias...In.section.*Note.3-3::.we |
| 8b3e0 | 20 77 69 6c 6c 20 73 65 65 20 6d 75 63 68 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 20 65 78 61 6d | .will.see.much.more.complex.exam |
| 8b400 | 70 6c 65 73 2c 20 73 75 63 68 20 61 73 20 22 64 69 73 74 69 6e 63 74 22 0a 63 6f 6d 70 6f 75 6e | ples,.such.as."distinct".compoun |
| 8b420 | 64 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 74 68 61 74 20 73 68 61 72 65 20 70 61 72 | d.data.structures.that.share.par |
| 8b440 | 74 73 2e 20 20 42 75 67 73 20 63 61 6e 20 6f 63 63 75 72 20 69 6e 20 6f 75 72 0a 70 72 6f 67 72 | ts...Bugs.can.occur.in.our.progr |
| 8b460 | 61 6d 73 20 69 66 20 77 65 20 66 6f 72 67 65 74 20 74 68 61 74 20 61 20 63 68 61 6e 67 65 20 74 | ams.if.we.forget.that.a.change.t |
| 8b480 | 6f 20 61 6e 20 6f 62 6a 65 63 74 20 6d 61 79 20 61 6c 73 6f 2c 20 61 73 20 61 20 22 73 69 64 65 | o.an.object.may.also,.as.a."side |
| 8b4a0 | 0a 65 66 66 65 63 74 2c 22 20 63 68 61 6e 67 65 20 61 20 22 64 69 66 66 65 72 65 6e 74 22 20 6f | .effect,".change.a."different".o |
| 8b4c0 | 62 6a 65 63 74 20 62 65 63 61 75 73 65 20 74 68 65 20 74 77 6f 20 22 64 69 66 66 65 72 65 6e 74 | bject.because.the.two."different |
| 8b4e0 | 22 0a 6f 62 6a 65 63 74 73 20 61 72 65 20 61 63 74 75 61 6c 6c 79 20 61 20 73 69 6e 67 6c 65 20 | ".objects.are.actually.a.single. |
| 8b500 | 6f 62 6a 65 63 74 20 61 70 70 65 61 72 69 6e 67 20 75 6e 64 65 72 20 64 69 66 66 65 72 65 6e 74 | object.appearing.under.different |
| 8b520 | 20 61 6c 69 61 73 65 73 2e 0a 54 68 65 73 65 20 73 6f 2d 63 61 6c 6c 65 64 20 22 73 69 64 65 2d | .aliases..These.so-called."side- |
| 8b540 | 65 66 66 65 63 74 20 62 75 67 73 22 20 61 72 65 20 73 6f 20 64 69 66 66 69 63 75 6c 74 20 74 6f | effect.bugs".are.so.difficult.to |
| 8b560 | 20 6c 6f 63 61 74 65 20 61 6e 64 20 74 6f 0a 61 6e 61 6c 79 7a 65 20 74 68 61 74 20 73 6f 6d 65 | .locate.and.to.analyze.that.some |
| 8b580 | 20 70 65 6f 70 6c 65 20 68 61 76 65 20 70 72 6f 70 6f 73 65 64 20 74 68 61 74 20 70 72 6f 67 72 | .people.have.proposed.that.progr |
| 8b5a0 | 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 62 65 0a 64 65 73 69 67 6e 65 64 20 69 6e 20 | amming.languages.be.designed.in. |
| 8b5c0 | 73 75 63 68 20 61 20 77 61 79 20 61 73 20 74 6f 20 6e 6f 74 20 61 6c 6c 6f 77 20 73 69 64 65 20 | such.a.way.as.to.not.allow.side. |
| 8b5e0 | 65 66 66 65 63 74 73 20 6f 72 20 61 6c 69 61 73 69 6e 67 0a 28 4c 61 6d 70 73 6f 6e 20 65 74 20 | effects.or.aliasing.(Lampson.et. |
| 8b600 | 61 6c 2e 20 31 39 38 31 3b 20 4d 6f 72 72 69 73 2c 20 53 63 68 6d 69 64 74 2c 20 61 6e 64 20 57 | al..1981;.Morris,.Schmidt,.and.W |
| 8b620 | 61 64 6c 65 72 20 31 39 38 30 29 2e 0a 0a 20 20 20 28 33 29 20 49 6e 20 76 69 65 77 20 6f 66 20 | adler.1980)......(3).In.view.of. |
| 8b640 | 74 68 69 73 2c 20 69 74 20 69 73 20 69 72 6f 6e 69 63 20 74 68 61 74 20 69 6e 74 72 6f 64 75 63 | this,.it.is.ironic.that.introduc |
| 8b660 | 74 6f 72 79 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 0a 6d 6f 73 74 20 6f 66 74 65 6e 20 74 | tory.programming.is.most.often.t |
| 8b680 | 61 75 67 68 74 20 69 6e 20 61 20 68 69 67 68 6c 79 20 69 6d 70 65 72 61 74 69 76 65 20 73 74 79 | aught.in.a.highly.imperative.sty |
| 8b6a0 | 6c 65 2e 20 20 54 68 69 73 20 6d 61 79 20 62 65 20 61 20 76 65 73 74 69 67 65 0a 6f 66 20 61 20 | le...This.may.be.a.vestige.of.a. |
| 8b6c0 | 62 65 6c 69 65 66 2c 20 63 6f 6d 6d 6f 6e 20 74 68 72 6f 75 67 68 6f 75 74 20 74 68 65 20 31 39 | belief,.common.throughout.the.19 |
| 8b6e0 | 36 30 73 20 61 6e 64 20 31 39 37 30 73 2c 20 74 68 61 74 20 70 72 6f 67 72 61 6d 73 20 74 68 61 | 60s.and.1970s,.that.programs.tha |
| 8b700 | 74 0a 63 61 6c 6c 20 70 72 6f 63 65 64 75 72 65 73 20 6d 75 73 74 20 69 6e 68 65 72 65 6e 74 6c | t.call.procedures.must.inherentl |
| 8b720 | 79 20 62 65 20 6c 65 73 73 20 65 66 66 69 63 69 65 6e 74 20 74 68 61 6e 20 70 72 6f 67 72 61 6d | y.be.less.efficient.than.program |
| 8b740 | 73 20 74 68 61 74 0a 70 65 72 66 6f 72 6d 20 61 73 73 69 67 6e 6d 65 6e 74 73 2e 20 20 28 53 74 | s.that.perform.assignments...(St |
| 8b760 | 65 65 6c 65 20 28 31 39 37 37 29 20 64 65 62 75 6e 6b 73 20 74 68 69 73 20 61 72 67 75 6d 65 6e | eele.(1977).debunks.this.argumen |
| 8b780 | 74 2e 29 0a 41 6c 74 65 72 6e 61 74 69 76 65 6c 79 20 69 74 20 6d 61 79 20 72 65 66 6c 65 63 74 | t.).Alternatively.it.may.reflect |
| 8b7a0 | 20 61 20 76 69 65 77 20 74 68 61 74 20 73 74 65 70 2d 62 79 2d 73 74 65 70 20 61 73 73 69 67 6e | .a.view.that.step-by-step.assign |
| 8b7c0 | 6d 65 6e 74 20 69 73 0a 65 61 73 69 65 72 20 66 6f 72 20 62 65 67 69 6e 6e 65 72 73 20 74 6f 20 | ment.is.easier.for.beginners.to. |
| 8b7e0 | 76 69 73 75 61 6c 69 7a 65 20 74 68 61 6e 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 2e 20 20 | visualize.than.procedure.call... |
| 8b800 | 57 68 61 74 65 76 65 72 20 74 68 65 0a 72 65 61 73 6f 6e 2c 20 69 74 20 6f 66 74 65 6e 20 73 61 | Whatever.the.reason,.it.often.sa |
| 8b820 | 64 64 6c 65 73 20 62 65 67 69 6e 6e 69 6e 67 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 77 69 74 68 | ddles.beginning.programmers.with |
| 8b840 | 20 22 73 68 6f 75 6c 64 20 49 20 73 65 74 20 74 68 69 73 0a 76 61 72 69 61 62 6c 65 20 62 65 66 | ."should.I.set.this.variable.bef |
| 8b860 | 6f 72 65 20 6f 72 20 61 66 74 65 72 20 74 68 61 74 20 6f 6e 65 22 20 63 6f 6e 63 65 72 6e 73 20 | ore.or.after.that.one".concerns. |
| 8b880 | 74 68 61 74 20 63 61 6e 20 63 6f 6d 70 6c 69 63 61 74 65 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 | that.can.complicate.programming. |
| 8b8a0 | 61 6e 64 20 6f 62 73 63 75 72 65 20 74 68 65 20 69 6d 70 6f 72 74 61 6e 74 20 69 64 65 61 73 2e | and.obscure.the.important.ideas. |
| 8b8c0 | 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 32 2c | ....File:.sicp.info,..Node:.3-2, |
| 8b8e0 | 20 20 4e 65 78 74 3a 20 33 2d 33 2c 20 20 50 72 65 76 3a 20 33 2d 31 2c 20 20 55 70 3a 20 43 68 | ..Next:.3-3,..Prev:.3-1,..Up:.Ch |
| 8b900 | 61 70 74 65 72 20 33 0a 0a 33 2e 32 20 54 68 65 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 4d 6f 64 | apter.3..3.2.The.Environment.Mod |
| 8b920 | 65 6c 20 6f 66 20 45 76 61 6c 75 61 74 69 6f 6e 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | el.of.Evaluation.=============== |
| 8b940 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 57 68 65 6e 20 77 | ========================..When.w |
| 8b960 | 65 20 69 6e 74 72 6f 64 75 63 65 64 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 | e.introduced.compound.procedures |
| 8b980 | 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 31 3a 3a 2c 20 77 65 20 75 73 65 64 20 74 | .in.*Note.Chapter.1::,.we.used.t |
| 8b9a0 | 68 65 0a 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 6f 66 20 65 76 61 6c 75 61 74 | he.substitution.model.of.evaluat |
| 8b9c0 | 69 6f 6e 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 35 3a 3a 29 20 74 6f 20 64 | ion.(section.*Note.1-1-5::).to.d |
| 8b9e0 | 65 66 69 6e 65 20 77 68 61 74 0a 69 73 20 6d 65 61 6e 74 20 62 79 20 61 70 70 6c 79 69 6e 67 20 | efine.what.is.meant.by.applying. |
| 8ba00 | 61 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 61 72 67 75 6d 65 6e 74 73 3a 0a 0a 20 20 20 2a 20 | a.procedure.to.arguments:.....*. |
| 8ba20 | 54 6f 20 61 70 70 6c 79 20 61 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 20 74 6f | To.apply.a.compound.procedure.to |
| 8ba40 | 20 61 72 67 75 6d 65 6e 74 73 2c 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 62 6f 64 79 20 6f 66 | .arguments,.evaluate.the.body.of |
| 8ba60 | 0a 20 20 20 20 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 65 61 63 68 20 66 6f | ......the.procedure.with.each.fo |
| 8ba80 | 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 20 72 65 70 6c 61 63 65 64 20 62 79 20 74 68 65 0a 20 | rmal.parameter.replaced.by.the.. |
| 8baa0 | 20 20 20 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 61 72 67 75 6d 65 6e 74 2e 0a 0a 0a 20 20 | ....corresponding.argument...... |
| 8bac0 | 20 4f 6e 63 65 20 77 65 20 61 64 6d 69 74 20 61 73 73 69 67 6e 6d 65 6e 74 20 69 6e 74 6f 20 6f | .Once.we.admit.assignment.into.o |
| 8bae0 | 75 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2c 20 73 75 63 68 20 61 0a | ur.programming.language,.such.a. |
| 8bb00 | 64 65 66 69 6e 69 74 69 6f 6e 20 69 73 20 6e 6f 20 6c 6f 6e 67 65 72 20 61 64 65 71 75 61 74 65 | definition.is.no.longer.adequate |
| 8bb20 | 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 | ...In.particular,.section.*Note. |
| 8bb40 | 33 2d 31 2d 33 3a 3a 0a 61 72 67 75 65 64 20 74 68 61 74 2c 20 69 6e 20 74 68 65 20 70 72 65 73 | 3-1-3::.argued.that,.in.the.pres |
| 8bb60 | 65 6e 63 65 20 6f 66 20 61 73 73 69 67 6e 6d 65 6e 74 2c 20 61 20 76 61 72 69 61 62 6c 65 20 63 | ence.of.assignment,.a.variable.c |
| 8bb80 | 61 6e 20 6e 6f 20 6c 6f 6e 67 65 72 20 62 65 0a 63 6f 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65 | an.no.longer.be.considered.to.be |
| 8bba0 | 20 6d 65 72 65 6c 79 20 61 20 6e 61 6d 65 20 66 6f 72 20 61 20 76 61 6c 75 65 2e 20 20 52 61 74 | .merely.a.name.for.a.value...Rat |
| 8bbc0 | 68 65 72 2c 20 61 20 76 61 72 69 61 62 6c 65 20 6d 75 73 74 0a 73 6f 6d 65 68 6f 77 20 64 65 73 | her,.a.variable.must.somehow.des |
| 8bbe0 | 69 67 6e 61 74 65 20 61 20 22 70 6c 61 63 65 22 20 69 6e 20 77 68 69 63 68 20 76 61 6c 75 65 73 | ignate.a."place".in.which.values |
| 8bc00 | 20 63 61 6e 20 62 65 20 73 74 6f 72 65 64 2e 20 20 49 6e 20 6f 75 72 20 6e 65 77 0a 6d 6f 64 65 | .can.be.stored...In.our.new.mode |
| 8bc20 | 6c 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 74 68 65 73 65 20 70 6c 61 63 65 73 20 77 69 | l.of.evaluation,.these.places.wi |
| 8bc40 | 6c 6c 20 62 65 20 6d 61 69 6e 74 61 69 6e 65 64 20 69 6e 20 73 74 72 75 63 74 75 72 65 73 0a 63 | ll.be.maintained.in.structures.c |
| 8bc60 | 61 6c 6c 65 64 20 22 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 22 2e 0a 0a 20 20 20 41 6e 20 65 6e 76 | alled."environments"......An.env |
| 8bc80 | 69 72 6f 6e 6d 65 6e 74 20 69 73 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 22 66 72 61 6d 65 | ironment.is.a.sequence.of."frame |
| 8bca0 | 73 22 2e 20 20 45 61 63 68 20 66 72 61 6d 65 20 69 73 20 61 20 74 61 62 6c 65 0a 28 70 6f 73 73 | s"...Each.frame.is.a.table.(poss |
| 8bcc0 | 69 62 6c 79 20 65 6d 70 74 79 29 20 6f 66 20 22 62 69 6e 64 69 6e 67 73 22 2c 20 77 68 69 63 68 | ibly.empty).of."bindings",.which |
| 8bce0 | 20 61 73 73 6f 63 69 61 74 65 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 73 20 77 69 74 68 0a 74 | .associate.variable.names.with.t |
| 8bd00 | 68 65 69 72 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 76 61 6c 75 65 73 2e 20 20 28 41 20 73 | heir.corresponding.values...(A.s |
| 8bd20 | 69 6e 67 6c 65 20 66 72 61 6d 65 20 6d 61 79 20 63 6f 6e 74 61 69 6e 20 61 74 20 6d 6f 73 74 20 | ingle.frame.may.contain.at.most. |
| 8bd40 | 6f 6e 65 0a 62 69 6e 64 69 6e 67 20 66 6f 72 20 61 6e 79 20 76 61 72 69 61 62 6c 65 2e 29 20 20 | one.binding.for.any.variable.).. |
| 8bd60 | 45 61 63 68 20 66 72 61 6d 65 20 61 6c 73 6f 20 68 61 73 20 61 20 70 6f 69 6e 74 65 72 20 74 6f | Each.frame.also.has.a.pointer.to |
| 8bd80 | 20 69 74 73 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 22 65 6e 63 6c 6f 73 69 6e 67 20 65 6e 76 69 | .its.environment."enclosing.envi |
| 8bda0 | 72 6f 6e 6d 65 6e 74 22 2c 20 75 6e 6c 65 73 73 2c 20 66 6f 72 20 74 68 65 20 70 75 72 70 6f 73 | ronment",.unless,.for.the.purpos |
| 8bdc0 | 65 73 20 6f 66 20 64 69 73 63 75 73 73 69 6f 6e 2c 20 74 68 65 0a 66 72 61 6d 65 20 69 73 20 63 | es.of.discussion,.the.frame.is.c |
| 8bde0 | 6f 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65 20 22 67 6c 6f 62 61 6c 22 2e 20 20 54 68 65 20 22 | onsidered.to.be."global"...The." |
| 8be00 | 76 61 6c 75 65 20 6f 66 20 61 20 76 61 72 69 61 62 6c 65 22 20 77 69 74 68 0a 72 65 73 70 65 63 | value.of.a.variable".with.respec |
| 8be20 | 74 20 74 6f 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 74 68 65 20 76 61 6c 75 65 | t.to.an.environment.is.the.value |
| 8be40 | 20 67 69 76 65 6e 20 62 79 20 74 68 65 20 62 69 6e 64 69 6e 67 20 6f 66 20 74 68 65 0a 76 61 72 | .given.by.the.binding.of.the.var |
| 8be60 | 69 61 62 6c 65 20 69 6e 20 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 | iable.in.the.first.frame.in.the. |
| 8be80 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 61 20 62 69 6e 64 | environment.that.contains.a.bind |
| 8bea0 | 69 6e 67 0a 66 6f 72 20 74 68 61 74 20 76 61 72 69 61 62 6c 65 2e 20 20 49 66 20 6e 6f 20 66 72 | ing.for.that.variable...If.no.fr |
| 8bec0 | 61 6d 65 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 73 70 65 63 69 66 69 65 73 20 61 20 | ame.in.the.sequence.specifies.a. |
| 8bee0 | 62 69 6e 64 69 6e 67 20 66 6f 72 0a 74 68 65 20 76 61 72 69 61 62 6c 65 2c 20 74 68 65 6e 20 74 | binding.for.the.variable,.then.t |
| 8bf00 | 68 65 20 76 61 72 69 61 62 6c 65 20 69 73 20 73 61 69 64 20 74 6f 20 62 65 20 22 75 6e 62 6f 75 | he.variable.is.said.to.be."unbou |
| 8bf20 | 6e 64 22 20 69 6e 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 20 20 20 20 20 2a 46 | nd".in.the.environment........*F |
| 8bf40 | 69 67 75 72 65 20 33 2e 31 3a 2a 20 41 20 73 69 6d 70 6c 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | igure.3.1:*.A.simple.environment |
| 8bf60 | 20 73 74 72 75 63 74 75 72 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .structure...................... |
| 8bf80 | 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..+--------+.................... |
| 8bfa0 | 20 20 7c 20 20 20 20 20 20 49 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..|......I.|.................... |
| 8bfc0 | 20 20 7c 20 78 3a 20 33 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..|.x:.3...|.................... |
| 8bfe0 | 20 20 7c 20 79 3a 20 35 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..|.y:.5...|.................... |
| 8c000 | 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..+--------+.................... |
| 8c020 | 20 20 20 20 20 5e 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....^..^....................... |
| 8c040 | 20 20 7c 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 20 7c | ..|..|.......................C.| |
| 8c060 | 20 20 7c 20 44 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 20 | ..|.D...........+---------+...|. |
| 8c080 | 20 7c 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | .|...+----------+...........|... |
| 8c0a0 | 20 20 20 49 49 20 7c 20 20 20 7c 20 20 7c 20 20 20 7c 20 20 20 20 20 20 49 49 49 20 7c 0a 20 20 | ...II.|...|..|...|......III.|... |
| 8c0c0 | 20 20 20 20 20 20 20 20 7c 20 7a 3a 20 36 20 20 20 20 2b 2d 2d 2d 2b 20 20 2b 2d 2d 2d 2b 20 6d | ........|.z:.6....+---+..+---+.m |
| 8c0e0 | 3a 20 31 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 78 3a 20 37 20 20 20 20 7c 20 | :.1.....|...........|.x:.7....|. |
| 8c100 | 20 20 20 20 20 20 20 20 20 7c 20 79 3a 20 32 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | .........|.y:.2.....|........... |
| 8c120 | 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | +---------+..........+---------- |
| 8c140 | 2b 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 3a 3a 20 73 68 6f 77 73 20 61 | +.....*Note.Figure.3-1::.shows.a |
| 8c160 | 20 73 69 6d 70 6c 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 20 63 6f | .simple.environment.structure.co |
| 8c180 | 6e 73 69 73 74 69 6e 67 0a 6f 66 20 74 68 72 65 65 20 66 72 61 6d 65 73 2c 20 6c 61 62 65 6c 65 | nsisting.of.three.frames,.labele |
| 8c1a0 | 64 20 49 2c 20 49 49 2c 20 61 6e 64 20 49 49 49 2e 20 20 49 6e 20 74 68 65 20 64 69 61 67 72 61 | d.I,.II,.and.III...In.the.diagra |
| 8c1c0 | 6d 2c 20 41 2c 20 42 2c 20 43 2c 20 61 6e 64 0a 44 20 61 72 65 20 70 6f 69 6e 74 65 72 73 20 74 | m,.A,.B,.C,.and.D.are.pointers.t |
| 8c1e0 | 6f 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 2e 20 20 43 20 61 6e 64 20 44 20 70 6f 69 6e 74 20 74 | o.environments...C.and.D.point.t |
| 8c200 | 6f 20 74 68 65 20 73 61 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 54 68 65 20 76 61 72 69 | o.the.same.environment..The.vari |
| 8c220 | 61 62 6c 65 73 20 60 7a 27 20 61 6e 64 20 60 78 27 20 61 72 65 20 62 6f 75 6e 64 20 69 6e 20 66 | ables.`z'.and.`x'.are.bound.in.f |
| 8c240 | 72 61 6d 65 20 49 49 2c 20 77 68 69 6c 65 20 60 79 27 20 61 6e 64 20 60 78 27 20 61 72 65 0a 62 | rame.II,.while.`y'.and.`x'.are.b |
| 8c260 | 6f 75 6e 64 20 69 6e 20 66 72 61 6d 65 20 49 2e 20 20 54 68 65 20 76 61 6c 75 65 20 6f 66 20 60 | ound.in.frame.I...The.value.of.` |
| 8c280 | 78 27 20 69 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 44 20 69 73 20 33 2e 20 20 54 68 65 20 76 | x'.in.environment.D.is.3...The.v |
| 8c2a0 | 61 6c 75 65 0a 6f 66 20 60 78 27 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 65 6e 76 69 | alue.of.`x'.with.respect.to.envi |
| 8c2c0 | 72 6f 6e 6d 65 6e 74 20 42 20 69 73 20 61 6c 73 6f 20 33 2e 20 20 54 68 69 73 20 69 73 20 64 65 | ronment.B.is.also.3...This.is.de |
| 8c2e0 | 74 65 72 6d 69 6e 65 64 20 61 73 0a 66 6f 6c 6c 6f 77 73 3a 20 57 65 20 65 78 61 6d 69 6e 65 20 | termined.as.follows:.We.examine. |
| 8c300 | 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 | the.first.frame.in.the.sequence. |
| 8c320 | 28 66 72 61 6d 65 20 49 49 49 29 20 61 6e 64 20 64 6f 0a 6e 6f 74 20 66 69 6e 64 20 61 20 62 69 | (frame.III).and.do.not.find.a.bi |
| 8c340 | 6e 64 69 6e 67 20 66 6f 72 20 60 78 27 2c 20 73 6f 20 77 65 20 70 72 6f 63 65 65 64 20 74 6f 20 | nding.for.`x',.so.we.proceed.to. |
| 8c360 | 74 68 65 20 65 6e 63 6c 6f 73 69 6e 67 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 44 20 61 6e 64 20 | the.enclosing.environment.D.and. |
| 8c380 | 66 69 6e 64 20 74 68 65 20 62 69 6e 64 69 6e 67 20 69 6e 20 66 72 61 6d 65 20 49 2e 20 20 4f 6e | find.the.binding.in.frame.I...On |
| 8c3a0 | 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 78 | .the.other.hand,.the.value.of.`x |
| 8c3c0 | 27 0a 69 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 41 20 69 73 20 37 2c 20 62 65 63 61 75 73 65 | '.in.environment.A.is.7,.because |
| 8c3e0 | 20 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 | .the.first.frame.in.the.sequence |
| 8c400 | 20 28 66 72 61 6d 65 0a 49 49 29 20 63 6f 6e 74 61 69 6e 73 20 61 20 62 69 6e 64 69 6e 67 20 6f | .(frame.II).contains.a.binding.o |
| 8c420 | 66 20 60 78 27 20 74 6f 20 37 2e 20 20 57 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 65 6e 76 | f.`x'.to.7...With.respect.to.env |
| 8c440 | 69 72 6f 6e 6d 65 6e 74 20 41 2c 20 74 68 65 0a 62 69 6e 64 69 6e 67 20 6f 66 20 60 78 27 20 74 | ironment.A,.the.binding.of.`x'.t |
| 8c460 | 6f 20 37 20 69 6e 20 66 72 61 6d 65 20 49 49 20 69 73 20 73 61 69 64 20 74 6f 20 22 73 68 61 64 | o.7.in.frame.II.is.said.to."shad |
| 8c480 | 6f 77 22 20 74 68 65 20 62 69 6e 64 69 6e 67 20 6f 66 20 60 78 27 0a 74 6f 20 33 20 69 6e 20 66 | ow".the.binding.of.`x'.to.3.in.f |
| 8c4a0 | 72 61 6d 65 20 49 2e 0a 0a 20 20 20 54 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 63 | rame.I......The.environment.is.c |
| 8c4c0 | 72 75 63 69 61 6c 20 74 6f 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 | rucial.to.the.evaluation.process |
| 8c4e0 | 2c 20 62 65 63 61 75 73 65 20 69 74 0a 64 65 74 65 72 6d 69 6e 65 73 20 74 68 65 20 63 6f 6e 74 | ,.because.it.determines.the.cont |
| 8c500 | 65 78 74 20 69 6e 20 77 68 69 63 68 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 73 68 6f 75 6c | ext.in.which.an.expression.shoul |
| 8c520 | 64 20 62 65 20 65 76 61 6c 75 61 74 65 64 2e 0a 49 6e 64 65 65 64 2c 20 6f 6e 65 20 63 6f 75 6c | d.be.evaluated..Indeed,.one.coul |
| 8c540 | 64 20 73 61 79 20 74 68 61 74 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 61 20 70 72 6f 67 | d.say.that.expressions.in.a.prog |
| 8c560 | 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 64 6f 0a 6e 6f 74 2c 20 69 6e 20 74 68 65 6d | ramming.language.do.not,.in.them |
| 8c580 | 73 65 6c 76 65 73 2c 20 68 61 76 65 20 61 6e 79 20 6d 65 61 6e 69 6e 67 2e 20 20 52 61 74 68 65 | selves,.have.any.meaning...Rathe |
| 8c5a0 | 72 2c 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 61 63 71 75 69 72 65 73 20 61 0a 6d 65 61 6e | r,.an.expression.acquires.a.mean |
| 8c5c0 | 69 6e 67 20 6f 6e 6c 79 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 73 6f 6d 65 20 65 6e | ing.only.with.respect.to.some.en |
| 8c5e0 | 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 69 74 20 69 73 20 65 76 61 6c 75 61 74 | vironment.in.which.it.is.evaluat |
| 8c600 | 65 64 2e 0a 45 76 65 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 61 | ed..Even.the.interpretation.of.a |
| 8c620 | 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 61 73 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 | n.expression.as.straightforward. |
| 8c640 | 61 73 20 60 28 2b 20 31 0a 31 29 27 20 64 65 70 65 6e 64 73 20 6f 6e 20 61 6e 20 75 6e 64 65 72 | as.`(+.1.1)'.depends.on.an.under |
| 8c660 | 73 74 61 6e 64 69 6e 67 20 74 68 61 74 20 6f 6e 65 20 69 73 20 6f 70 65 72 61 74 69 6e 67 20 69 | standing.that.one.is.operating.i |
| 8c680 | 6e 20 61 20 63 6f 6e 74 65 78 74 20 69 6e 0a 77 68 69 63 68 20 60 2b 27 20 69 73 20 74 68 65 20 | n.a.context.in.which.`+'.is.the. |
| 8c6a0 | 73 79 6d 62 6f 6c 20 66 6f 72 20 61 64 64 69 74 69 6f 6e 2e 20 20 54 68 75 73 2c 20 69 6e 20 6f | symbol.for.addition...Thus,.in.o |
| 8c6c0 | 75 72 20 6d 6f 64 65 6c 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 0a 77 65 20 77 69 6c 6c 20 61 | ur.model.of.evaluation.we.will.a |
| 8c6e0 | 6c 77 61 79 73 20 73 70 65 61 6b 20 6f 66 20 65 76 61 6c 75 61 74 69 6e 67 20 61 6e 20 65 78 70 | lways.speak.of.evaluating.an.exp |
| 8c700 | 72 65 73 73 69 6f 6e 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 73 6f 6d 65 0a 65 6e 76 | ression.with.respect.to.some.env |
| 8c720 | 69 72 6f 6e 6d 65 6e 74 2e 20 20 54 6f 20 64 65 73 63 72 69 62 65 20 69 6e 74 65 72 61 63 74 69 | ironment...To.describe.interacti |
| 8c740 | 6f 6e 73 20 77 69 74 68 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2c 20 77 65 20 77 69 6c | ons.with.the.interpreter,.we.wil |
| 8c760 | 6c 0a 73 75 70 70 6f 73 65 20 74 68 61 74 20 74 68 65 72 65 20 69 73 20 61 20 67 6c 6f 62 61 6c | l.suppose.that.there.is.a.global |
| 8c780 | 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 61 20 73 69 | .environment,.consisting.of.a.si |
| 8c7a0 | 6e 67 6c 65 20 66 72 61 6d 65 0a 28 77 69 74 68 20 6e 6f 20 65 6e 63 6c 6f 73 69 6e 67 20 65 6e | ngle.frame.(with.no.enclosing.en |
| 8c7c0 | 76 69 72 6f 6e 6d 65 6e 74 29 20 74 68 61 74 20 69 6e 63 6c 75 64 65 73 20 76 61 6c 75 65 73 20 | vironment).that.includes.values. |
| 8c7e0 | 66 6f 72 20 74 68 65 20 73 79 6d 62 6f 6c 73 0a 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 | for.the.symbols.associated.with. |
| 8c800 | 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 46 6f 72 20 65 | the.primitive.procedures...For.e |
| 8c820 | 78 61 6d 70 6c 65 2c 20 74 68 65 20 69 64 65 61 20 74 68 61 74 0a 60 2b 27 20 69 73 20 74 68 65 | xample,.the.idea.that.`+'.is.the |
| 8c840 | 20 73 79 6d 62 6f 6c 20 66 6f 72 20 61 64 64 69 74 69 6f 6e 20 69 73 20 63 61 70 74 75 72 65 64 | .symbol.for.addition.is.captured |
| 8c860 | 20 62 79 20 73 61 79 69 6e 67 20 74 68 61 74 20 74 68 65 20 73 79 6d 62 6f 6c 0a 60 2b 27 20 69 | .by.saying.that.the.symbol.`+'.i |
| 8c880 | 73 20 62 6f 75 6e 64 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e | s.bound.in.the.global.environmen |
| 8c8a0 | 74 20 74 6f 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 61 64 64 69 74 69 6f 6e 0a 70 72 6f 63 | t.to.the.primitive.addition.proc |
| 8c8c0 | 65 64 75 72 65 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 33 2d 32 2d 31 3a 3a 20 20 20 20 20 20 | edure...*.Menu:..*.3-2-1::...... |
| 8c8e0 | 20 20 20 20 20 20 54 68 65 20 52 75 6c 65 73 20 66 6f 72 20 45 76 61 6c 75 61 74 69 6f 6e 0a 2a | ......The.Rules.for.Evaluation.* |
| 8c900 | 20 33 2d 32 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 41 70 70 6c 79 69 6e 67 20 53 69 6d | .3-2-2::............Applying.Sim |
| 8c920 | 70 6c 65 20 50 72 6f 63 65 64 75 72 65 73 0a 2a 20 33 2d 32 2d 33 3a 3a 20 20 20 20 20 20 20 20 | ple.Procedures.*.3-2-3::........ |
| 8c940 | 20 20 20 20 46 72 61 6d 65 73 20 61 73 20 74 68 65 20 52 65 70 6f 73 69 74 6f 72 79 20 6f 66 20 | ....Frames.as.the.Repository.of. |
| 8c960 | 4c 6f 63 61 6c 20 53 74 61 74 65 0a 2a 20 33 2d 32 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 | Local.State.*.3-2-4::........... |
| 8c980 | 20 49 6e 74 65 72 6e 61 6c 20 44 65 66 69 6e 69 74 69 6f 6e 73 0a 0a 1f 0a 46 69 6c 65 3a 20 73 | .Internal.Definitions....File:.s |
| 8c9a0 | 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 32 2d 31 2c 20 20 4e 65 78 74 3a 20 33 | icp.info,..Node:.3-2-1,..Next:.3 |
| 8c9c0 | 2d 32 2d 32 2c 20 20 50 72 65 76 3a 20 33 2d 32 2c 20 20 55 70 3a 20 33 2d 32 0a 0a 33 2e 32 2e | -2-2,..Prev:.3-2,..Up:.3-2..3.2. |
| 8c9e0 | 31 20 54 68 65 20 52 75 6c 65 73 20 66 6f 72 20 45 76 61 6c 75 61 74 69 6f 6e 0a 2d 2d 2d 2d 2d | 1.The.Rules.for.Evaluation.----- |
| 8ca00 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 6f | -------------------------..The.o |
| 8ca20 | 76 65 72 61 6c 6c 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 20 6f 66 20 68 6f 77 20 74 68 65 20 | verall.specification.of.how.the. |
| 8ca40 | 69 6e 74 65 72 70 72 65 74 65 72 20 65 76 61 6c 75 61 74 65 73 20 61 20 63 6f 6d 62 69 6e 61 74 | interpreter.evaluates.a.combinat |
| 8ca60 | 69 6f 6e 0a 72 65 6d 61 69 6e 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 77 68 65 6e 20 77 65 20 | ion.remains.the.same.as.when.we. |
| 8ca80 | 66 69 72 73 74 20 69 6e 74 72 6f 64 75 63 65 64 20 69 74 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a | first.introduced.it.in.section.* |
| 8caa0 | 4e 6f 74 65 0a 31 2d 31 2d 33 3a 3a 3a 0a 0a 20 20 20 2a 20 54 6f 20 65 76 61 6c 75 61 74 65 20 | Note.1-1-3:::.....*.To.evaluate. |
| 8cac0 | 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 3a 0a 0a 0a 20 20 31 2e 20 45 76 61 6c 75 61 74 65 20 74 | a.combination:.....1..Evaluate.t |
| 8cae0 | 68 65 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 6e 61 | he.subexpressions.of.the.combina |
| 8cb00 | 74 69 6f 6e 2e 28 31 29 0a 0a 20 20 32 2e 20 41 70 70 6c 79 20 74 68 65 20 76 61 6c 75 65 20 6f | tion.(1)....2..Apply.the.value.o |
| 8cb20 | 66 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 | f.the.operator.subexpression.to. |
| 8cb40 | 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 0a 20 20 20 20 20 6f 70 65 72 61 6e 64 20 73 | the.values.of.the......operand.s |
| 8cb60 | 75 62 65 78 70 72 65 73 73 69 6f 6e 73 2e 0a 0a 0a 20 20 20 54 68 65 20 65 6e 76 69 72 6f 6e 6d | ubexpressions.......The.environm |
| 8cb80 | 65 6e 74 20 6d 6f 64 65 6c 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 65 70 6c 61 63 65 73 | ent.model.of.evaluation.replaces |
| 8cba0 | 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 0a 69 6e 20 73 70 65 63 69 | .the.substitution.model.in.speci |
| 8cbc0 | 66 79 69 6e 67 20 77 68 61 74 20 69 74 20 6d 65 61 6e 73 20 74 6f 20 61 70 70 6c 79 20 61 20 63 | fying.what.it.means.to.apply.a.c |
| 8cbe0 | 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 61 72 67 75 6d 65 6e 74 73 2e 0a | ompound.procedure.to.arguments.. |
| 8cc00 | 0a 20 20 20 49 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 20 6f 66 20 | ....In.the.environment.model.of. |
| 8cc20 | 65 76 61 6c 75 61 74 69 6f 6e 2c 20 61 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 61 6c 77 61 79 | evaluation,.a.procedure.is.alway |
| 8cc40 | 73 20 61 20 70 61 69 72 0a 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 73 6f 6d 65 20 63 6f 64 65 | s.a.pair.consisting.of.some.code |
| 8cc60 | 20 61 6e 64 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | .and.a.pointer.to.an.environment |
| 8cc80 | 2e 20 20 50 72 6f 63 65 64 75 72 65 73 0a 61 72 65 20 63 72 65 61 74 65 64 20 69 6e 20 6f 6e 65 | ...Procedures.are.created.in.one |
| 8cca0 | 20 77 61 79 20 6f 6e 6c 79 3a 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 20 61 20 60 6c 61 6d 62 | .way.only:.by.evaluating.a.`lamb |
| 8ccc0 | 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 54 68 69 73 0a 70 72 6f 64 75 63 65 73 20 61 | da'.expression...This.produces.a |
| 8cce0 | 20 70 72 6f 63 65 64 75 72 65 20 77 68 6f 73 65 20 63 6f 64 65 20 69 73 20 6f 62 74 61 69 6e 65 | .procedure.whose.code.is.obtaine |
| 8cd00 | 64 20 66 72 6f 6d 20 74 68 65 20 74 65 78 74 20 6f 66 20 74 68 65 0a 60 6c 61 6d 62 64 61 27 20 | d.from.the.text.of.the.`lambda'. |
| 8cd20 | 65 78 70 72 65 73 73 69 6f 6e 20 61 6e 64 20 77 68 6f 73 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | expression.and.whose.environment |
| 8cd40 | 20 69 73 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 0a 74 68 65 | .is.the.environment.in.which.the |
| 8cd60 | 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 77 61 73 20 65 76 61 6c 75 61 74 | .`lambda'.expression.was.evaluat |
| 8cd80 | 65 64 20 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2e 20 20 46 6f | ed.to.produce.the.procedure...Fo |
| 8cda0 | 72 0a 65 78 61 6d 70 6c 65 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 70 72 6f 63 65 64 75 72 | r.example,.consider.the.procedur |
| 8cdc0 | 65 20 64 65 66 69 6e 69 74 69 6f 6e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 | e.definition.......(define.(squa |
| 8cde0 | 72 65 20 78 29 0a 20 20 20 20 20 20 20 28 2a 20 78 20 78 29 29 0a 0a 65 76 61 6c 75 61 74 65 64 | re.x)........(*.x.x))..evaluated |
| 8ce00 | 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 54 68 65 | .in.the.global.environment...The |
| 8ce20 | 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 73 79 6e 74 61 78 0a 69 73 20 | .procedure.definition.syntax.is. |
| 8ce40 | 6a 75 73 74 20 73 79 6e 74 61 63 74 69 63 20 73 75 67 61 72 20 66 6f 72 20 61 6e 20 75 6e 64 65 | just.syntactic.sugar.for.an.unde |
| 8ce60 | 72 6c 79 69 6e 67 20 69 6d 70 6c 69 63 69 74 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 | rlying.implicit.`lambda'.express |
| 8ce80 | 69 6f 6e 2e 0a 49 74 20 77 6f 75 6c 64 20 68 61 76 65 20 62 65 65 6e 20 65 71 75 69 76 61 6c 65 | ion..It.would.have.been.equivale |
| 8cea0 | 6e 74 20 74 6f 20 68 61 76 65 20 75 73 65 64 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 71 | nt.to.have.used.......(define.sq |
| 8cec0 | 75 61 72 65 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 2a 20 78 20 78 29 29 | uare........(lambda.(x).(*.x.x)) |
| 8cee0 | 29 0a 0a 77 68 69 63 68 20 65 76 61 6c 75 61 74 65 73 20 60 28 6c 61 6d 62 64 61 20 28 78 29 20 | )..which.evaluates.`(lambda.(x). |
| 8cf00 | 28 2a 20 78 20 78 29 29 27 20 61 6e 64 20 62 69 6e 64 73 20 60 73 71 75 61 72 65 27 20 74 6f 20 | (*.x.x))'.and.binds.`square'.to. |
| 8cf20 | 74 68 65 0a 72 65 73 75 6c 74 69 6e 67 20 76 61 6c 75 65 2c 20 61 6c 6c 20 69 6e 20 74 68 65 20 | the.resulting.value,.all.in.the. |
| 8cf40 | 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 | global.environment......*Note.Fi |
| 8cf60 | 67 75 72 65 20 33 2d 32 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 65 | gure.3-2::.shows.the.result.of.e |
| 8cf80 | 76 61 6c 75 61 74 69 6e 67 20 74 68 69 73 20 60 64 65 66 69 6e 65 27 0a 65 78 70 72 65 73 73 69 | valuating.this.`define'.expressi |
| 8cfa0 | 6f 6e 2e 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 69 73 20 61 20 70 | on...The.procedure.object.is.a.p |
| 8cfc0 | 61 69 72 20 77 68 6f 73 65 20 63 6f 64 65 20 73 70 65 63 69 66 69 65 73 20 74 68 61 74 0a 74 68 | air.whose.code.specifies.that.th |
| 8cfe0 | 65 20 70 72 6f 63 65 64 75 72 65 20 68 61 73 20 6f 6e 65 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d | e.procedure.has.one.formal.param |
| 8d000 | 65 74 65 72 2c 20 6e 61 6d 65 6c 79 20 60 78 27 2c 20 61 6e 64 20 61 20 70 72 6f 63 65 64 75 72 | eter,.namely.`x',.and.a.procedur |
| 8d020 | 65 0a 62 6f 64 79 20 60 28 2a 20 78 20 78 29 27 2e 20 20 54 68 65 20 65 6e 76 69 72 6f 6e 6d 65 | e.body.`(*.x.x)'...The.environme |
| 8d040 | 6e 74 20 70 61 72 74 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 61 20 70 6f | nt.part.of.the.procedure.is.a.po |
| 8d060 | 69 6e 74 65 72 20 74 6f 0a 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c | inter.to.the.global.environment, |
| 8d080 | 20 73 69 6e 63 65 20 74 68 61 74 20 69 73 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 | .since.that.is.the.environment.i |
| 8d0a0 | 6e 20 77 68 69 63 68 20 74 68 65 0a 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 | n.which.the.`lambda'.expression. |
| 8d0c0 | 77 61 73 20 65 76 61 6c 75 61 74 65 64 20 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 70 72 6f | was.evaluated.to.produce.the.pro |
| 8d0e0 | 63 65 64 75 72 65 2e 20 41 20 6e 65 77 0a 62 69 6e 64 69 6e 67 2c 20 77 68 69 63 68 20 61 73 73 | cedure..A.new.binding,.which.ass |
| 8d100 | 6f 63 69 61 74 65 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 77 69 74 | ociates.the.procedure.object.wit |
| 8d120 | 68 20 74 68 65 20 73 79 6d 62 6f 6c 0a 60 73 71 75 61 72 65 27 2c 20 68 61 73 20 62 65 65 6e 20 | h.the.symbol.`square',.has.been. |
| 8d140 | 61 64 64 65 64 20 74 6f 20 74 68 65 20 67 6c 6f 62 61 6c 20 66 72 61 6d 65 2e 20 20 49 6e 20 67 | added.to.the.global.frame...In.g |
| 8d160 | 65 6e 65 72 61 6c 2c 20 60 64 65 66 69 6e 65 27 0a 63 72 65 61 74 65 73 20 64 65 66 69 6e 69 74 | eneral,.`define'.creates.definit |
| 8d180 | 69 6f 6e 73 20 62 79 20 61 64 64 69 6e 67 20 62 69 6e 64 69 6e 67 73 20 74 6f 20 66 72 61 6d 65 | ions.by.adding.bindings.to.frame |
| 8d1a0 | 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 32 3a 2a 20 45 6e 76 69 72 6f 6e 6d 65 | s........*Figure.3.2:*.Environme |
| 8d1c0 | 6e 74 20 73 74 72 75 63 74 75 72 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 65 76 61 6c 75 61 74 | nt.structure.produced.by.evaluat |
| 8d1e0 | 69 6e 67 0a 20 20 20 20 20 60 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 78 29 20 28 2a 20 | ing......`(define.(square.x).(*. |
| 8d200 | 78 20 78 29 29 27 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | x.x))'.in.the.global.environment |
| 8d220 | 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d | ........................+------- |
| 8d240 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---------------+................ |
| 8d260 | 20 20 20 20 20 20 7c 20 6f 74 68 65 72 20 76 61 72 69 61 62 6c 65 73 20 20 20 20 20 20 7c 0a 20 | ......|.other.variables......|.. |
| 8d280 | 20 20 20 20 20 20 20 20 20 67 6c 6f 62 61 6c 20 2d 2d 2d 3e 7c 20 20 20 20 20 20 20 20 20 20 20 | .........global.--->|........... |
| 8d2a0 | 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 65 6e 76 20 20 20 20 20 20 | ...........|...........env...... |
| 8d2c0 | 20 20 7c 20 73 71 75 61 72 65 3a 20 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 | ..|.square:.--+..........|...... |
| 8d2e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d | ................+-----------|--- |
| 8d300 | 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -------+........................ |
| 8d320 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 28 64 | ..........|.......^...........(d |
| 8d340 | 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 78 29 20 20 20 20 20 7c 20 20 20 20 20 20 20 7c 0a 20 | efine.(square.x).....|.......|.. |
| 8d360 | 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 78 20 78 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........(*.x.x))............. |
| 8d380 | 56 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | V.......|....................... |
| 8d3a0 | 20 20 20 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | ........---.---....|............ |
| 8d3c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2d 2d 2b 0a | ..................|.O.|.O-+---+. |
| 8d3e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 2d 7c | .............................`-| |
| 8d400 | 2d 5e 2d 2d 2d 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -^---'.......................... |
| 8d420 | 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......|......................... |
| 8d440 | 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......V........................ |
| 8d460 | 20 20 20 20 20 20 70 61 72 61 6d 65 74 65 72 73 3a 20 78 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ......parameters:.x............. |
| 8d480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 6f 64 79 3a 20 28 2a 20 78 20 78 29 0a 0a | .................body:.(*.x.x).. |
| 8d4a0 | 20 20 20 4e 6f 77 20 74 68 61 74 20 77 65 20 68 61 76 65 20 73 65 65 6e 20 68 6f 77 20 70 72 6f | ...Now.that.we.have.seen.how.pro |
| 8d4c0 | 63 65 64 75 72 65 73 20 61 72 65 20 63 72 65 61 74 65 64 2c 20 77 65 20 63 61 6e 20 64 65 73 63 | cedures.are.created,.we.can.desc |
| 8d4e0 | 72 69 62 65 20 68 6f 77 0a 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 61 70 70 6c 69 65 64 2e | ribe.how.procedures.are.applied. |
| 8d500 | 20 20 54 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 20 73 70 65 63 69 66 69 65 | ..The.environment.model.specifie |
| 8d520 | 73 3a 20 54 6f 20 61 70 70 6c 79 20 61 0a 70 72 6f 63 65 64 75 72 65 20 74 6f 20 61 72 67 75 6d | s:.To.apply.a.procedure.to.argum |
| 8d540 | 65 6e 74 73 2c 20 63 72 65 61 74 65 20 61 20 6e 65 77 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 63 | ents,.create.a.new.environment.c |
| 8d560 | 6f 6e 74 61 69 6e 69 6e 67 20 61 20 66 72 61 6d 65 0a 74 68 61 74 20 62 69 6e 64 73 20 74 68 65 | ontaining.a.frame.that.binds.the |
| 8d580 | 20 70 61 72 61 6d 65 74 65 72 73 20 74 6f 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 | .parameters.to.the.values.of.the |
| 8d5a0 | 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 54 68 65 0a 65 6e 63 6c 6f 73 69 6e 67 20 65 6e 76 69 72 | .arguments...The.enclosing.envir |
| 8d5c0 | 6f 6e 6d 65 6e 74 20 6f 66 20 74 68 69 73 20 66 72 61 6d 65 20 69 73 20 74 68 65 20 65 6e 76 69 | onment.of.this.frame.is.the.envi |
| 8d5e0 | 72 6f 6e 6d 65 6e 74 20 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 0a 70 72 6f 63 65 64 75 | ronment.specified.by.the.procedu |
| 8d600 | 72 65 2e 20 20 4e 6f 77 2c 20 77 69 74 68 69 6e 20 74 68 69 73 20 6e 65 77 20 65 6e 76 69 72 6f | re...Now,.within.this.new.enviro |
| 8d620 | 6e 6d 65 6e 74 2c 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 62 6f | nment,.evaluate.the.procedure.bo |
| 8d640 | 64 79 2e 0a 0a 20 20 20 54 6f 20 73 68 6f 77 20 68 6f 77 20 74 68 69 73 20 72 75 6c 65 20 69 73 | dy......To.show.how.this.rule.is |
| 8d660 | 20 66 6f 6c 6c 6f 77 65 64 2c 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 33 3a 3a 20 69 6c | .followed,.*Note.Figure.3-3::.il |
| 8d680 | 6c 75 73 74 72 61 74 65 73 0a 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 | lustrates.the.environment.struct |
| 8d6a0 | 75 72 65 20 63 72 65 61 74 65 64 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 | ure.created.by.evaluating.the.ex |
| 8d6c0 | 70 72 65 73 73 69 6f 6e 20 60 28 73 71 75 61 72 65 0a 35 29 27 20 69 6e 20 74 68 65 20 67 6c 6f | pression.`(square.5)'.in.the.glo |
| 8d6e0 | 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 77 68 65 72 65 20 60 73 71 75 61 72 65 27 20 | bal.environment,.where.`square'. |
| 8d700 | 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 67 65 6e 65 72 61 74 65 64 20 69 6e 20 2a 4e | is.the.procedure.generated.in.*N |
| 8d720 | 6f 74 65 20 46 69 67 75 72 65 20 33 2d 32 3a 3a 2e 20 20 41 70 70 6c 79 69 6e 67 20 74 68 65 20 | ote.Figure.3-2::...Applying.the. |
| 8d740 | 70 72 6f 63 65 64 75 72 65 20 72 65 73 75 6c 74 73 20 69 6e 20 74 68 65 0a 63 72 65 61 74 69 6f | procedure.results.in.the.creatio |
| 8d760 | 6e 20 6f 66 20 61 20 6e 65 77 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 6c 61 62 65 6c 65 64 20 | n.of.a.new.environment,.labeled. |
| 8d780 | 45 31 20 69 6e 20 74 68 65 20 66 69 67 75 72 65 2c 20 74 68 61 74 20 62 65 67 69 6e 73 0a 77 69 | E1.in.the.figure,.that.begins.wi |
| 8d7a0 | 74 68 20 61 20 66 72 61 6d 65 20 69 6e 20 77 68 69 63 68 20 60 78 27 2c 20 74 68 65 20 66 6f 72 | th.a.frame.in.which.`x',.the.for |
| 8d7c0 | 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 20 66 6f 72 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2c | mal.parameter.for.the.procedure, |
| 8d7e0 | 20 69 73 0a 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 35 2e 20 20 54 68 | .is.bound.to.the.argument.5...Th |
| 8d800 | 65 20 70 6f 69 6e 74 65 72 20 6c 65 61 64 69 6e 67 20 75 70 77 61 72 64 20 66 72 6f 6d 20 74 68 | e.pointer.leading.upward.from.th |
| 8d820 | 69 73 20 66 72 61 6d 65 0a 73 68 6f 77 73 20 74 68 61 74 20 74 68 65 20 66 72 61 6d 65 27 73 20 | is.frame.shows.that.the.frame's. |
| 8d840 | 65 6e 63 6c 6f 73 69 6e 67 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 74 68 65 20 67 6c 6f | enclosing.environment.is.the.glo |
| 8d860 | 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 54 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 | bal.environment..The.global.envi |
| 8d880 | 72 6f 6e 6d 65 6e 74 20 69 73 20 63 68 6f 73 65 6e 20 68 65 72 65 2c 20 62 65 63 61 75 73 65 20 | ronment.is.chosen.here,.because. |
| 8d8a0 | 74 68 69 73 20 69 73 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 74 68 61 74 20 69 73 20 | this.is.the.environment.that.is. |
| 8d8c0 | 69 6e 64 69 63 61 74 65 64 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20 60 73 71 75 61 72 65 | indicated.as.part.of.the.`square |
| 8d8e0 | 27 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 2e 20 20 57 69 74 68 69 6e 20 45 31 2c 0a | '.procedure.object...Within.E1,. |
| 8d900 | 77 65 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 20 70 72 6f 63 | we.evaluate.the.body.of.the.proc |
| 8d920 | 65 64 75 72 65 2c 20 60 28 2a 20 78 20 78 29 27 2e 20 20 53 69 6e 63 65 20 74 68 65 20 76 61 6c | edure,.`(*.x.x)'...Since.the.val |
| 8d940 | 75 65 20 6f 66 0a 60 78 27 20 69 6e 20 45 31 20 69 73 20 35 2c 20 74 68 65 20 72 65 73 75 6c 74 | ue.of.`x'.in.E1.is.5,.the.result |
| 8d960 | 20 69 73 20 60 28 2a 20 35 20 35 29 27 2c 20 6f 72 20 32 35 2e 0a 0a 20 20 20 20 20 2a 46 69 67 | .is.`(*.5.5)',.or.25........*Fig |
| 8d980 | 75 72 65 20 33 2e 33 3a 2a 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 63 72 65 61 74 65 64 20 62 79 | ure.3.3:*.Environment.created.by |
| 8d9a0 | 20 65 76 61 6c 75 61 74 69 6e 67 20 60 28 73 71 75 61 72 65 20 35 29 27 20 69 6e 0a 20 20 20 20 | .evaluating.`(square.5)'.in..... |
| 8d9c0 | 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 20 20 20 20 20 20 | .the.global.environment......... |
| 8d9e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..............+----------------- |
| 8da00 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 | -------------------+............ |
| 8da20 | 20 20 20 20 20 20 20 20 20 7c 20 6f 74 68 65 72 20 76 61 72 69 61 62 6c 65 73 20 20 20 20 20 20 | .........|.other.variables...... |
| 8da40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 67 6c 6f 62 61 6c | ..............|...........global |
| 8da60 | 20 2d 2d 3e 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .-->|........................... |
| 8da80 | 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 65 6e 76 20 20 20 20 20 20 20 7c | .........|...........env.......| |
| 8daa0 | 20 73 71 75 61 72 65 3a 20 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .square:.--+.................... |
| 8dac0 | 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d | ....|.....................+----- |
| 8dae0 | 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2b | ------|---------------------+--+ |
| 8db00 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 8db20 | 20 7c 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 | .|.......^.............^........ |
| 8db40 | 20 20 20 28 73 71 75 61 72 65 20 35 29 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | ...(square.5)............|...... |
| 8db60 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .|.............|................ |
| 8db80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | .................V.......|...... |
| 8dba0 | 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......|........................ |
| 8dbc0 | 20 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 20 20 7c 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b | ......---.---....|.........+---+ |
| 8dbe0 | 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --+............................. |
| 8dc00 | 7c 20 4f 20 7c 20 4f 2d 2b 2d 2d 2d 2b 20 20 20 45 31 20 2d 2d 3e 7c 20 78 3a 20 35 20 7c 0a 20 | |.O.|.O-+---+...E1.-->|.x:.5.|.. |
| 8dc20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 2d 7c 2d 5e | ...........................`-|-^ |
| 8dc40 | 2d 2d 2d 27 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 | ---'.............+------+....... |
| 8dc60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 | ........................|....... |
| 8dc80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 | ........................V....... |
| 8dca0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 72 61 6d 65 74 65 72 73 | ......................parameters |
| 8dcc0 | 3a 20 78 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | :.x............................. |
| 8dce0 | 62 6f 64 79 3a 20 28 2a 20 78 20 78 29 0a 0a 20 20 20 54 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e | body:.(*.x.x).....The.environmen |
| 8dd00 | 74 20 6d 6f 64 65 6c 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e | t.model.of.procedure.application |
| 8dd20 | 20 63 61 6e 20 62 65 20 73 75 6d 6d 61 72 69 7a 65 64 20 62 79 0a 74 77 6f 20 72 75 6c 65 73 3a | .can.be.summarized.by.two.rules: |
| 8dd40 | 0a 0a 20 20 20 2a 20 41 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 69 73 20 61 70 70 | .....*.A.procedure.object.is.app |
| 8dd60 | 6c 69 65 64 20 74 6f 20 61 20 73 65 74 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 20 62 79 0a 20 20 | lied.to.a.set.of.arguments.by... |
| 8dd80 | 20 20 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 61 20 66 72 61 6d 65 2c 20 62 69 6e 64 69 6e 67 | ...constructing.a.frame,.binding |
| 8dda0 | 20 74 68 65 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 73 20 6f 66 20 74 68 65 0a 20 20 | .the.formal.parameters.of.the... |
| 8ddc0 | 20 20 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 6f 66 | ...procedure.to.the.arguments.of |
| 8dde0 | 20 74 68 65 20 63 61 6c 6c 2c 20 61 6e 64 20 74 68 65 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 74 | .the.call,.and.then.evaluating.t |
| 8de00 | 68 65 0a 20 20 20 20 20 62 6f 64 79 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 6e | he......body.of.the.procedure.in |
| 8de20 | 20 74 68 65 20 63 6f 6e 74 65 78 74 20 6f 66 20 74 68 65 20 6e 65 77 20 65 6e 76 69 72 6f 6e 6d | .the.context.of.the.new.environm |
| 8de40 | 65 6e 74 0a 20 20 20 20 20 63 6f 6e 73 74 72 75 63 74 65 64 2e 20 20 54 68 65 20 6e 65 77 20 66 | ent......constructed...The.new.f |
| 8de60 | 72 61 6d 65 20 68 61 73 20 61 73 20 69 74 73 20 65 6e 63 6c 6f 73 69 6e 67 20 65 6e 76 69 72 6f | rame.has.as.its.enclosing.enviro |
| 8de80 | 6e 6d 65 6e 74 20 74 68 65 0a 20 20 20 20 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 70 61 72 74 20 | nment.the......environment.part. |
| 8dea0 | 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 62 65 69 6e 67 20 61 70 | of.the.procedure.object.being.ap |
| 8dec0 | 70 6c 69 65 64 2e 0a 0a 20 20 20 2a 20 41 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 63 72 65 61 | plied......*.A.procedure.is.crea |
| 8dee0 | 74 65 64 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 20 61 20 60 6c 61 6d 62 64 61 27 20 65 78 70 | ted.by.evaluating.a.`lambda'.exp |
| 8df00 | 72 65 73 73 69 6f 6e 0a 20 20 20 20 20 72 65 6c 61 74 69 76 65 20 74 6f 20 61 20 67 69 76 65 6e | ression......relative.to.a.given |
| 8df20 | 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 54 68 65 20 72 65 73 75 6c 74 69 6e 67 20 70 72 6f | .environment...The.resulting.pro |
| 8df40 | 63 65 64 75 72 65 20 6f 62 6a 65 63 74 0a 20 20 20 20 20 69 73 20 61 20 70 61 69 72 20 63 6f 6e | cedure.object......is.a.pair.con |
| 8df60 | 73 69 73 74 69 6e 67 20 6f 66 20 74 68 65 20 74 65 78 74 20 6f 66 20 74 68 65 20 60 6c 61 6d 62 | sisting.of.the.text.of.the.`lamb |
| 8df80 | 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 61 6e 64 20 61 0a 20 20 20 20 20 70 6f 69 6e 74 65 | da'.expression.and.a......pointe |
| 8dfa0 | 72 20 74 6f 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 74 68 | r.to.the.environment.in.which.th |
| 8dfc0 | 65 20 70 72 6f 63 65 64 75 72 65 20 77 61 73 20 63 72 65 61 74 65 64 2e 0a 0a 0a 20 20 20 57 65 | e.procedure.was.created.......We |
| 8dfe0 | 20 61 6c 73 6f 20 73 70 65 63 69 66 79 20 74 68 61 74 20 64 65 66 69 6e 69 6e 67 20 61 20 73 79 | .also.specify.that.defining.a.sy |
| 8e000 | 6d 62 6f 6c 20 75 73 69 6e 67 20 60 64 65 66 69 6e 65 27 20 63 72 65 61 74 65 73 20 61 0a 62 69 | mbol.using.`define'.creates.a.bi |
| 8e020 | 6e 64 69 6e 67 20 69 6e 20 74 68 65 20 63 75 72 72 65 6e 74 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | nding.in.the.current.environment |
| 8e040 | 20 66 72 61 6d 65 20 61 6e 64 20 61 73 73 69 67 6e 73 20 74 6f 20 74 68 65 20 73 79 6d 62 6f 6c | .frame.and.assigns.to.the.symbol |
| 8e060 | 20 74 68 65 0a 69 6e 64 69 63 61 74 65 64 20 76 61 6c 75 65 2e 28 32 29 20 46 69 6e 61 6c 6c 79 | .the.indicated.value.(2).Finally |
| 8e080 | 2c 20 77 65 20 73 70 65 63 69 66 79 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 60 73 65 | ,.we.specify.the.behavior.of.`se |
| 8e0a0 | 74 21 27 2c 20 74 68 65 0a 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 66 6f 72 63 65 64 20 75 | t!',.the.operation.that.forced.u |
| 8e0c0 | 73 20 74 6f 20 69 6e 74 72 6f 64 75 63 65 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d | s.to.introduce.the.environment.m |
| 8e0e0 | 6f 64 65 6c 20 69 6e 20 74 68 65 0a 66 69 72 73 74 20 70 6c 61 63 65 2e 20 20 45 76 61 6c 75 61 | odel.in.the.first.place...Evalua |
| 8e100 | 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 73 65 74 21 20 3c 56 41 52 49 | ting.the.expression.`(set!.<VARI |
| 8e120 | 41 42 4c 45 3e 20 3c 56 41 4c 55 45 3e 29 27 20 69 6e 0a 73 6f 6d 65 20 65 6e 76 69 72 6f 6e 6d | ABLE>.<VALUE>)'.in.some.environm |
| 8e140 | 65 6e 74 20 6c 6f 63 61 74 65 73 20 74 68 65 20 62 69 6e 64 69 6e 67 20 6f 66 20 74 68 65 20 76 | ent.locates.the.binding.of.the.v |
| 8e160 | 61 72 69 61 62 6c 65 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 61 6e 64 20 63 | ariable.in.the.environment.and.c |
| 8e180 | 68 61 6e 67 65 73 20 74 68 61 74 20 62 69 6e 64 69 6e 67 20 74 6f 20 69 6e 64 69 63 61 74 65 20 | hanges.that.binding.to.indicate. |
| 8e1a0 | 74 68 65 20 6e 65 77 20 76 61 6c 75 65 2e 20 20 54 68 61 74 20 69 73 2c 20 6f 6e 65 20 66 69 6e | the.new.value...That.is,.one.fin |
| 8e1c0 | 64 73 0a 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f | ds.the.first.frame.in.the.enviro |
| 8e1e0 | 6e 6d 65 6e 74 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 61 20 62 69 6e 64 69 6e 67 20 66 6f | nment.that.contains.a.binding.fo |
| 8e200 | 72 20 74 68 65 0a 76 61 72 69 61 62 6c 65 20 61 6e 64 20 6d 6f 64 69 66 69 65 73 20 74 68 61 74 | r.the.variable.and.modifies.that |
| 8e220 | 20 66 72 61 6d 65 2e 20 20 49 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 73 20 75 6e 62 6f | .frame...If.the.variable.is.unbo |
| 8e240 | 75 6e 64 20 69 6e 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 74 68 65 6e 20 60 73 65 | und.in.the.environment,.then.`se |
| 8e260 | 74 21 27 20 73 69 67 6e 61 6c 73 20 61 6e 20 65 72 72 6f 72 2e 0a 0a 20 20 20 54 68 65 73 65 20 | t!'.signals.an.error......These. |
| 8e280 | 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 73 2c 20 74 68 6f 75 67 68 20 63 6f 6e 73 69 64 65 | evaluation.rules,.though.conside |
| 8e2a0 | 72 61 62 6c 79 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 20 74 68 61 6e 20 74 68 65 0a 73 75 62 73 | rably.more.complex.than.the.subs |
| 8e2c0 | 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 2c 20 61 72 65 20 73 74 69 6c 6c 20 72 65 61 73 6f 6e | titution.model,.are.still.reason |
| 8e2e0 | 61 62 6c 79 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 2e 20 20 4d 6f 72 65 6f 76 65 72 2c | ably.straightforward...Moreover, |
| 8e300 | 0a 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6d 6f 64 65 6c 2c 20 74 68 6f 75 67 68 20 61 62 | .the.evaluation.model,.though.ab |
| 8e320 | 73 74 72 61 63 74 2c 20 70 72 6f 76 69 64 65 73 20 61 20 63 6f 72 72 65 63 74 20 64 65 73 63 72 | stract,.provides.a.correct.descr |
| 8e340 | 69 70 74 69 6f 6e 0a 6f 66 20 68 6f 77 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 65 76 | iption.of.how.the.interpreter.ev |
| 8e360 | 61 6c 75 61 74 65 73 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 49 6e 20 2a 4e 6f 74 65 20 43 | aluates.expressions...In.*Note.C |
| 8e380 | 68 61 70 74 65 72 20 34 3a 3a 20 77 65 0a 73 68 61 6c 6c 20 73 65 65 20 68 6f 77 20 74 68 69 73 | hapter.4::.we.shall.see.how.this |
| 8e3a0 | 20 6d 6f 64 65 6c 20 63 61 6e 20 73 65 72 76 65 20 61 73 20 61 20 62 6c 75 65 70 72 69 6e 74 20 | .model.can.serve.as.a.blueprint. |
| 8e3c0 | 66 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 61 0a 77 6f 72 6b 69 6e 67 20 69 6e 74 65 72 | for.implementing.a.working.inter |
| 8e3e0 | 70 72 65 74 65 72 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 65 63 74 69 6f 6e 73 20 | preter...The.following.sections. |
| 8e400 | 65 6c 61 62 6f 72 61 74 65 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 0a 74 68 65 20 6d 6f 64 | elaborate.the.details.of.the.mod |
| 8e420 | 65 6c 20 62 79 20 61 6e 61 6c 79 7a 69 6e 67 20 73 6f 6d 65 20 69 6c 6c 75 73 74 72 61 74 69 76 | el.by.analyzing.some.illustrativ |
| 8e440 | 65 20 70 72 6f 67 72 61 6d 73 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e | e.programs......----------.Footn |
| 8e460 | 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 73 73 69 67 6e 6d 65 6e | otes.----------.....(1).ssignmen |
| 8e480 | 74 20 69 6e 74 72 6f 64 75 63 65 73 20 61 20 73 75 62 74 6c 65 74 79 20 69 6e 74 6f 20 73 74 65 | t.introduces.a.subtlety.into.ste |
| 8e4a0 | 70 20 31 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 0a 72 75 6c 65 2e 20 20 41 73 20 | p.1.of.the.evaluation.rule...As. |
| 8e4c0 | 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 38 3a 3a 2c 20 74 | shown.in.*Note.Exercise.3-8::,.t |
| 8e4e0 | 68 65 20 70 72 65 73 65 6e 63 65 20 6f 66 20 61 73 73 69 67 6e 6d 65 6e 74 0a 61 6c 6c 6f 77 73 | he.presence.of.assignment.allows |
| 8e500 | 20 75 73 20 74 6f 20 77 72 69 74 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 68 61 74 20 77 69 | .us.to.write.expressions.that.wi |
| 8e520 | 6c 6c 20 70 72 6f 64 75 63 65 20 64 69 66 66 65 72 65 6e 74 20 76 61 6c 75 65 73 0a 64 65 70 65 | ll.produce.different.values.depe |
| 8e540 | 6e 64 69 6e 67 20 6f 6e 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 | nding.on.the.order.in.which.the. |
| 8e560 | 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 | subexpressions.in.a.combination. |
| 8e580 | 61 72 65 0a 65 76 61 6c 75 61 74 65 64 2e 20 20 54 68 75 73 2c 20 74 6f 20 62 65 20 70 72 65 63 | are.evaluated...Thus,.to.be.prec |
| 8e5a0 | 69 73 65 2c 20 77 65 20 73 68 6f 75 6c 64 20 73 70 65 63 69 66 79 20 61 6e 20 65 76 61 6c 75 61 | ise,.we.should.specify.an.evalua |
| 8e5c0 | 74 69 6f 6e 20 6f 72 64 65 72 0a 69 6e 20 73 74 65 70 20 31 20 28 65 2e 67 2e 2c 20 6c 65 66 74 | tion.order.in.step.1.(e.g.,.left |
| 8e5e0 | 20 74 6f 20 72 69 67 68 74 20 6f 72 20 72 69 67 68 74 20 74 6f 20 6c 65 66 74 29 2e 20 20 48 6f | .to.right.or.right.to.left)...Ho |
| 8e600 | 77 65 76 65 72 2c 20 74 68 69 73 20 6f 72 64 65 72 0a 73 68 6f 75 6c 64 20 61 6c 77 61 79 73 20 | wever,.this.order.should.always. |
| 8e620 | 62 65 20 63 6f 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65 20 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 | be.considered.to.be.an.implement |
| 8e640 | 61 74 69 6f 6e 20 64 65 74 61 69 6c 2c 20 61 6e 64 20 6f 6e 65 0a 73 68 6f 75 6c 64 20 6e 65 76 | ation.detail,.and.one.should.nev |
| 8e660 | 65 72 20 77 72 69 74 65 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 64 65 70 65 6e 64 20 6f 6e | er.write.programs.that.depend.on |
| 8e680 | 20 73 6f 6d 65 20 70 61 72 74 69 63 75 6c 61 72 20 6f 72 64 65 72 2e 20 20 46 6f 72 0a 69 6e 73 | .some.particular.order...For.ins |
| 8e6a0 | 74 61 6e 63 65 2c 20 61 20 73 6f 70 68 69 73 74 69 63 61 74 65 64 20 63 6f 6d 70 69 6c 65 72 20 | tance,.a.sophisticated.compiler. |
| 8e6c0 | 6d 69 67 68 74 20 6f 70 74 69 6d 69 7a 65 20 61 20 70 72 6f 67 72 61 6d 20 62 79 20 76 61 72 79 | might.optimize.a.program.by.vary |
| 8e6e0 | 69 6e 67 0a 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 73 75 62 65 78 70 72 65 73 | ing.the.order.in.which.subexpres |
| 8e700 | 73 69 6f 6e 73 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 2e 0a 0a 20 20 20 28 32 29 20 49 66 20 | sions.are.evaluated......(2).If. |
| 8e720 | 74 68 65 72 65 20 69 73 20 61 6c 72 65 61 64 79 20 61 20 62 69 6e 64 69 6e 67 20 66 6f 72 20 74 | there.is.already.a.binding.for.t |
| 8e740 | 68 65 20 76 61 72 69 61 62 6c 65 20 69 6e 20 74 68 65 20 63 75 72 72 65 6e 74 0a 66 72 61 6d 65 | he.variable.in.the.current.frame |
| 8e760 | 2c 20 74 68 65 6e 20 74 68 65 20 62 69 6e 64 69 6e 67 20 69 73 20 63 68 61 6e 67 65 64 2e 20 20 | ,.then.the.binding.is.changed... |
| 8e780 | 54 68 69 73 20 69 73 20 63 6f 6e 76 65 6e 69 65 6e 74 20 62 65 63 61 75 73 65 20 69 74 0a 61 6c | This.is.convenient.because.it.al |
| 8e7a0 | 6c 6f 77 73 20 72 65 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 73 79 6d 62 6f 6c 73 3b 20 68 6f | lows.redefinition.of.symbols;.ho |
| 8e7c0 | 77 65 76 65 72 2c 20 69 74 20 61 6c 73 6f 20 6d 65 61 6e 73 20 74 68 61 74 20 60 64 65 66 69 6e | wever,.it.also.means.that.`defin |
| 8e7e0 | 65 27 0a 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 63 68 61 6e 67 65 20 76 61 6c 75 65 73 2c | e'.can.be.used.to.change.values, |
| 8e800 | 20 61 6e 64 20 74 68 69 73 20 62 72 69 6e 67 73 20 75 70 20 74 68 65 20 69 73 73 75 65 73 20 6f | .and.this.brings.up.the.issues.o |
| 8e820 | 66 0a 61 73 73 69 67 6e 6d 65 6e 74 20 77 69 74 68 6f 75 74 20 65 78 70 6c 69 63 69 74 6c 79 20 | f.assignment.without.explicitly. |
| 8e840 | 75 73 69 6e 67 20 60 73 65 74 21 27 2e 20 20 42 65 63 61 75 73 65 20 6f 66 20 74 68 69 73 2c 20 | using.`set!'...Because.of.this,. |
| 8e860 | 73 6f 6d 65 0a 70 65 6f 70 6c 65 20 70 72 65 66 65 72 20 72 65 64 65 66 69 6e 69 74 69 6f 6e 73 | some.people.prefer.redefinitions |
| 8e880 | 20 6f 66 20 65 78 69 73 74 69 6e 67 20 73 79 6d 62 6f 6c 73 20 74 6f 20 73 69 67 6e 61 6c 20 65 | .of.existing.symbols.to.signal.e |
| 8e8a0 | 72 72 6f 72 73 20 6f 72 0a 77 61 72 6e 69 6e 67 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 | rrors.or.warnings.....File:.sicp |
| 8e8c0 | 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 32 2d 32 2c 20 20 4e 65 78 74 3a 20 33 2d 32 2d | .info,..Node:.3-2-2,..Next:.3-2- |
| 8e8e0 | 33 2c 20 20 50 72 65 76 3a 20 33 2d 32 2d 31 2c 20 20 55 70 3a 20 33 2d 32 0a 0a 33 2e 32 2e 32 | 3,..Prev:.3-2-1,..Up:.3-2..3.2.2 |
| 8e900 | 20 41 70 70 6c 79 69 6e 67 20 53 69 6d 70 6c 65 20 50 72 6f 63 65 64 75 72 65 73 0a 2d 2d 2d 2d | .Applying.Simple.Procedures.---- |
| 8e920 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 68 | ----------------------------..Wh |
| 8e940 | 65 6e 20 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 6f | en.we.introduced.the.substitutio |
| 8e960 | 6e 20 6d 6f 64 65 6c 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 35 3a 3a | n.model.in.section.*Note.1-1-5:: |
| 8e980 | 20 77 65 0a 73 68 6f 77 65 64 20 68 6f 77 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 60 | .we.showed.how.the.combination.` |
| 8e9a0 | 28 66 20 35 29 27 20 65 76 61 6c 75 61 74 65 73 20 74 6f 20 31 33 36 2c 20 67 69 76 65 6e 20 74 | (f.5)'.evaluates.to.136,.given.t |
| 8e9c0 | 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f | he.following.procedure.definitio |
| 8e9e0 | 6e 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 78 29 0a 20 20 20 | ns:.......(define.(square.x).... |
| 8ea00 | 20 20 20 20 28 2a 20 78 20 78 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d 2d | ....(*.x.x)).......(define.(sum- |
| 8ea20 | 6f 66 2d 73 71 75 61 72 65 73 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 2b 20 28 73 71 75 61 72 | of-squares.x.y)........(+.(squar |
| 8ea40 | 65 20 78 29 20 28 73 71 75 61 72 65 20 79 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | e.x).(square.y))).......(define. |
| 8ea60 | 28 66 20 61 29 0a 20 20 20 20 20 20 20 28 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 20 28 2b 20 | (f.a)........(sum-of-squares.(+. |
| 8ea80 | 61 20 31 29 20 28 2a 20 61 20 32 29 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 61 6e 61 6c 79 7a | a.1).(*.a.2))).....We.can.analyz |
| 8eaa0 | 65 20 74 68 65 20 73 61 6d 65 20 65 78 61 6d 70 6c 65 20 75 73 69 6e 67 20 74 68 65 20 65 6e 76 | e.the.same.example.using.the.env |
| 8eac0 | 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 2e 20 20 2a 4e 6f 74 65 0a 46 69 67 75 72 65 20 33 2d | ironment.model...*Note.Figure.3- |
| 8eae0 | 34 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 74 68 72 65 65 20 70 72 6f 63 65 64 75 72 65 20 6f 62 | 4::.shows.the.three.procedure.ob |
| 8eb00 | 6a 65 63 74 73 20 63 72 65 61 74 65 64 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 0a 74 68 65 20 | jects.created.by.evaluating.the. |
| 8eb20 | 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 60 66 27 2c 20 60 73 71 75 61 72 65 27 2c 20 61 6e | definitions.of.`f',.`square',.an |
| 8eb40 | 64 20 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c | d.`sum-of-squares'.in.the.global |
| 8eb60 | 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 45 61 63 68 20 70 72 6f 63 65 64 75 72 65 20 6f 62 | .environment...Each.procedure.ob |
| 8eb80 | 6a 65 63 74 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 73 6f 6d 65 20 63 6f 64 65 2c 20 74 6f 67 65 | ject.consists.of.some.code,.toge |
| 8eba0 | 74 68 65 72 0a 77 69 74 68 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 67 6c 6f 62 61 | ther.with.a.pointer.to.the.globa |
| 8ebc0 | 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 34 | l.environment........*Figure.3.4 |
| 8ebe0 | 3a 2a 20 50 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 73 20 69 6e 20 74 68 65 20 67 6c 6f 62 | :*.Procedure.objects.in.the.glob |
| 8ec00 | 61 6c 20 66 72 61 6d 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b | al.frame.......................+ |
| 8ec20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 8ec40 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ------------+................... |
| 8ec60 | 20 20 7c 20 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..|.sum-of-squares:............. |
| 8ec80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 67 6c 6f 62 61 | ...............|...........globa |
| 8eca0 | 6c 20 2d 2d 3e 7c 20 73 71 75 61 72 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | l.-->|.square:.................. |
| 8ecc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 65 6e | ..................|...........en |
| 8ece0 | 76 20 20 20 20 20 20 20 7c 20 66 3a 20 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | v.......|.f:.--+................ |
| 8ed00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 | .....................|.......... |
| 8ed20 | 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ...........+------|------------- |
| 8ed40 | 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 | -+--------------+-------+....... |
| 8ed60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 5e 20 20 20 20 | .....................|.....^.... |
| 8ed80 | 20 20 20 20 7c 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 5e 0a 20 20 20 20 20 | ....|.....^........|.....^...... |
| 8eda0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 | ......................|.....|... |
| 8edc0 | 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 0a 20 20 20 20 | .....|.....|........|.....|..... |
| 8ede0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 7c 20 20 | .......................V.....|.. |
| 8ee00 | 20 20 20 20 20 20 56 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 56 20 20 20 20 20 7c 0a 20 20 20 | ......V.....|........V.....|.... |
| 8ee20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 7c 20 | .....................---.---..|. |
| 8ee40 | 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 7c 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 7c 0a 20 20 | ....---.---..|.....---.---..|... |
| 8ee60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2b | .....................|.O.|.O-+-+ |
| 8ee80 | 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2b 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2b 0a 20 | ....|.O.|.O-+-+....|.O.|.O-+-+.. |
| 8eea0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 2d 7c 2d 5e 2d 2d 2d 27 20 | ......................`-|-^---'. |
| 8eec0 | 20 20 20 20 20 60 2d 7c 2d 5e 2d 2d 2d 27 20 20 20 20 20 20 60 2d 7c 2d 5e 2d 2d 2d 27 0a 20 20 | .....`-|-^---'......`-|-^---'... |
| 8eee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 | .......................|........ |
| 8ef00 | 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 | ......|..............|.......... |
| 8ef20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 | ................V..............V |
| 8ef40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 72 | ..............V..............par |
| 8ef60 | 61 6d 65 74 65 72 73 3a 20 61 20 20 20 20 20 20 20 20 20 20 70 61 72 61 6d 65 74 65 72 73 3a 20 | ameters:.a..........parameters:. |
| 8ef80 | 78 20 20 70 61 72 61 6d 65 74 65 72 73 3a 20 78 2c 20 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 | x..parameters:.x,.y............. |
| 8efa0 | 20 62 6f 64 79 3a 20 28 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 20 20 62 6f 64 79 3a 20 28 2a | .body:.(sum-of-squares..body:.(* |
| 8efc0 | 20 78 20 78 29 20 20 62 6f 64 79 3a 20 28 2b 20 28 73 71 75 61 72 65 20 78 29 0a 20 20 20 20 20 | .x.x)..body:.(+.(square.x)...... |
| 8efe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 61 20 31 29 20 20 20 20 20 20 20 20 20 | ................(+.a.1)......... |
| 8f000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 75 61 72 65 20 79 | .......................(square.y |
| 8f020 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 61 20 32 29 29 | ))......................(*.a.2)) |
| 8f040 | 0a 0a 20 20 20 49 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 35 3a 3a 20 77 65 20 73 65 | .....In.*Note.Figure.3-5::.we.se |
| 8f060 | 65 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 20 63 72 65 61 | e.the.environment.structure.crea |
| 8f080 | 74 65 64 20 62 79 0a 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e | ted.by.evaluating.the.expression |
| 8f0a0 | 20 60 28 66 20 35 29 27 2e 20 20 54 68 65 20 63 61 6c 6c 20 74 6f 20 60 66 27 20 63 72 65 61 74 | .`(f.5)'...The.call.to.`f'.creat |
| 8f0c0 | 65 73 20 61 20 6e 65 77 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 45 31 20 62 65 67 69 6e 6e 69 6e | es.a.new.environment.E1.beginnin |
| 8f0e0 | 67 20 77 69 74 68 20 61 20 66 72 61 6d 65 20 69 6e 20 77 68 69 63 68 20 60 61 27 2c 20 74 68 65 | g.with.a.frame.in.which.`a',.the |
| 8f100 | 20 66 6f 72 6d 61 6c 0a 70 61 72 61 6d 65 74 65 72 20 6f 66 20 60 66 27 2c 20 69 73 20 62 6f 75 | .formal.parameter.of.`f',.is.bou |
| 8f120 | 6e 64 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 35 2e 20 20 49 6e 20 45 31 2c 20 77 65 | nd.to.the.argument.5...In.E1,.we |
| 8f140 | 20 65 76 61 6c 75 61 74 65 20 74 68 65 0a 62 6f 64 79 20 6f 66 20 60 66 27 3a 0a 0a 20 20 20 20 | .evaluate.the.body.of.`f':...... |
| 8f160 | 20 28 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 20 28 2b 20 61 20 31 29 20 28 2a 20 61 20 32 29 | .(sum-of-squares.(+.a.1).(*.a.2) |
| 8f180 | 29 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 35 3a 2a 20 45 6e 76 69 72 6f 6e 6d 65 6e | ).......*Figure.3.5:*.Environmen |
| 8f1a0 | 74 73 20 63 72 65 61 74 65 64 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 20 60 28 66 20 35 29 27 | ts.created.by.evaluating.`(f.5)' |
| 8f1c0 | 20 75 73 69 6e 67 20 74 68 65 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 2a 4e | .using.the......procedures.in.*N |
| 8f1e0 | 6f 74 65 20 46 69 67 75 72 65 20 33 2d 34 3a 3a 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ote.Figure.3-4::................ |
| 8f200 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .......+------------------------ |
| 8f220 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 | -----------------------------+.. |
| 8f240 | 20 20 20 20 20 20 20 20 20 67 6c 6f 62 61 6c 20 2d 2d 3e 7c 20 20 20 20 20 20 20 20 20 20 20 20 | .........global.-->|............ |
| 8f260 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 8f280 | 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 65 6e 76 20 20 20 20 20 20 20 2b | .........|...........env.......+ |
| 8f2a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 8f2c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 | ---------------------+.......... |
| 8f2e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 | .............^..............^... |
| 8f300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a 20 | .............^...............^.. |
| 8f320 | 20 20 20 20 20 20 20 20 20 28 66 20 35 29 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | .........(f.5).......|.......... |
| 8f340 | 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | ....|................|.......... |
| 8f360 | 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d | .....|...................+------ |
| 8f380 | 2b 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d | +.......+-------+........+------ |
| 8f3a0 | 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 45 | +........+-------+.............E |
| 8f3c0 | 31 20 2d 2d 3e 7c 20 61 3a 20 35 20 7c 20 20 45 32 20 2d 3e 7c 20 78 3a 20 36 20 20 7c 20 20 45 | 1.-->|.a:.5.|..E2.->|.x:.6..|..E |
| 8f3e0 | 33 20 2d 2d 3e 7c 20 78 3a 20 36 20 7c 20 20 45 34 20 2d 2d 3e 7c 20 78 3a 20 31 30 20 7c 0a 20 | 3.-->|.x:.6.|..E4.-->|.x:.10.|.. |
| 8f400 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 | .................|......|....... |
| 8f420 | 7c 20 79 3a 20 31 30 20 7c 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 | |.y:.10.|........|......|....... |
| 8f440 | 20 7c 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | .|.......|...................+-- |
| 8f460 | 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d | ----+.......+-------+........+-- |
| 8f480 | 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 | ----+........+-------+.......... |
| 8f4a0 | 20 20 20 20 28 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 20 20 20 28 2b 20 28 73 71 75 61 72 65 | ....(sum-of-squares...(+.(square |
| 8f4c0 | 20 78 29 20 20 20 20 20 20 20 28 2a 20 78 20 78 29 20 20 20 20 20 20 20 20 20 28 2a 20 78 20 78 | .x).......(*.x.x).........(*.x.x |
| 8f4e0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 61 20 31 29 20 20 20 20 20 20 20 20 | )................(+.a.1)........ |
| 8f500 | 20 20 20 20 28 73 71 75 61 72 65 20 75 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ....(square.u))................( |
| 8f520 | 2b 20 61 20 32 29 29 0a 0a 20 20 20 54 6f 20 65 76 61 6c 75 61 74 65 20 74 68 69 73 20 63 6f 6d | +.a.2)).....To.evaluate.this.com |
| 8f540 | 62 69 6e 61 74 69 6f 6e 2c 20 77 65 20 66 69 72 73 74 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 | bination,.we.first.evaluate.the. |
| 8f560 | 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 2e 0a 54 68 65 20 66 69 72 73 74 20 73 75 62 65 78 70 | subexpressions..The.first.subexp |
| 8f580 | 72 65 73 73 69 6f 6e 2c 20 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 2c 20 68 61 73 20 61 | ression,.`sum-of-squares',.has.a |
| 8f5a0 | 20 76 61 6c 75 65 20 74 68 61 74 20 69 73 20 61 0a 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 | .value.that.is.a.procedure.objec |
| 8f5c0 | 74 2e 20 20 28 4e 6f 74 69 63 65 20 68 6f 77 20 74 68 69 73 20 76 61 6c 75 65 20 69 73 20 66 6f | t...(Notice.how.this.value.is.fo |
| 8f5e0 | 75 6e 64 3a 20 57 65 20 66 69 72 73 74 20 6c 6f 6f 6b 20 69 6e 0a 74 68 65 20 66 69 72 73 74 20 | und:.We.first.look.in.the.first. |
| 8f600 | 66 72 61 6d 65 20 6f 66 20 45 31 2c 20 77 68 69 63 68 20 63 6f 6e 74 61 69 6e 73 20 6e 6f 20 62 | frame.of.E1,.which.contains.no.b |
| 8f620 | 69 6e 64 69 6e 67 20 66 6f 72 20 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 2e 0a 54 68 65 | inding.for.`sum-of-squares'..The |
| 8f640 | 6e 20 77 65 20 70 72 6f 63 65 65 64 20 74 6f 20 74 68 65 20 65 6e 63 6c 6f 73 69 6e 67 20 65 6e | n.we.proceed.to.the.enclosing.en |
| 8f660 | 76 69 72 6f 6e 6d 65 6e 74 2c 20 69 2e 65 2e 20 74 68 65 20 67 6c 6f 62 61 6c 0a 65 6e 76 69 72 | vironment,.i.e..the.global.envir |
| 8f680 | 6f 6e 6d 65 6e 74 2c 20 61 6e 64 20 66 69 6e 64 20 74 68 65 20 62 69 6e 64 69 6e 67 20 73 68 6f | onment,.and.find.the.binding.sho |
| 8f6a0 | 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 34 3a 3a 2e 29 20 20 54 68 65 0a | wn.in.*Note.Figure.3-4::.)..The. |
| 8f6c0 | 6f 74 68 65 72 20 74 77 6f 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 65 76 61 | other.two.subexpressions.are.eva |
| 8f6e0 | 6c 75 61 74 65 64 20 62 79 20 61 70 70 6c 79 69 6e 67 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 | luated.by.applying.the.primitive |
| 8f700 | 0a 6f 70 65 72 61 74 69 6f 6e 73 20 60 2b 27 20 61 6e 64 20 60 2a 27 20 74 6f 20 65 76 61 6c 75 | .operations.`+'.and.`*'.to.evalu |
| 8f720 | 61 74 65 20 74 68 65 20 74 77 6f 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 60 28 2b 20 61 20 31 | ate.the.two.combinations.`(+.a.1 |
| 8f740 | 29 27 20 61 6e 64 0a 60 28 2a 20 61 20 32 29 27 20 74 6f 20 6f 62 74 61 69 6e 20 36 20 61 6e 64 | )'.and.`(*.a.2)'.to.obtain.6.and |
| 8f760 | 20 31 30 2c 20 72 65 73 70 65 63 74 69 76 65 6c 79 2e 0a 0a 20 20 20 4e 6f 77 20 77 65 20 61 70 | .10,.respectively......Now.we.ap |
| 8f780 | 70 6c 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 60 73 75 6d 2d 6f 66 | ply.the.procedure.object.`sum-of |
| 8f7a0 | 2d 73 71 75 61 72 65 73 27 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 0a 36 20 61 6e 64 | -squares'.to.the.arguments.6.and |
| 8f7c0 | 20 31 30 2e 20 20 54 68 69 73 20 72 65 73 75 6c 74 73 20 69 6e 20 61 20 6e 65 77 20 65 6e 76 69 | .10...This.results.in.a.new.envi |
| 8f7e0 | 72 6f 6e 6d 65 6e 74 20 45 32 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 66 6f 72 6d 61 6c 0a 70 | ronment.E2.in.which.the.formal.p |
| 8f800 | 61 72 61 6d 65 74 65 72 73 20 60 78 27 20 61 6e 64 20 60 79 27 20 61 72 65 20 62 6f 75 6e 64 20 | arameters.`x'.and.`y'.are.bound. |
| 8f820 | 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 57 69 74 68 69 6e 20 45 32 20 77 65 0a | to.the.arguments...Within.E2.we. |
| 8f840 | 65 76 61 6c 75 61 74 65 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 60 28 2b 20 28 73 71 | evaluate.the.combination.`(+.(sq |
| 8f860 | 75 61 72 65 20 78 29 20 28 73 71 75 61 72 65 20 79 29 29 27 2e 20 20 54 68 69 73 20 6c 65 61 64 | uare.x).(square.y))'...This.lead |
| 8f880 | 73 20 75 73 20 74 6f 0a 65 76 61 6c 75 61 74 65 20 60 28 73 71 75 61 72 65 20 78 29 27 2c 20 77 | s.us.to.evaluate.`(square.x)',.w |
| 8f8a0 | 68 65 72 65 20 60 73 71 75 61 72 65 27 20 69 73 20 66 6f 75 6e 64 20 69 6e 20 74 68 65 20 67 6c | here.`square'.is.found.in.the.gl |
| 8f8c0 | 6f 62 61 6c 20 66 72 61 6d 65 20 61 6e 64 0a 60 78 27 20 69 73 20 36 2e 20 20 4f 6e 63 65 20 61 | obal.frame.and.`x'.is.6...Once.a |
| 8f8e0 | 67 61 69 6e 2c 20 77 65 20 73 65 74 20 75 70 20 61 20 6e 65 77 20 65 6e 76 69 72 6f 6e 6d 65 6e | gain,.we.set.up.a.new.environmen |
| 8f900 | 74 2c 20 45 33 2c 20 69 6e 20 77 68 69 63 68 20 60 78 27 20 69 73 0a 62 6f 75 6e 64 20 74 6f 20 | t,.E3,.in.which.`x'.is.bound.to. |
| 8f920 | 36 2c 20 61 6e 64 20 77 69 74 68 69 6e 20 74 68 69 73 20 77 65 20 65 76 61 6c 75 61 74 65 20 74 | 6,.and.within.this.we.evaluate.t |
| 8f940 | 68 65 20 62 6f 64 79 20 6f 66 20 60 73 71 75 61 72 65 27 2c 20 77 68 69 63 68 20 69 73 0a 60 28 | he.body.of.`square',.which.is.`( |
| 8f960 | 2a 20 78 20 78 29 27 2e 20 20 41 6c 73 6f 20 61 73 20 70 61 72 74 20 6f 66 20 61 70 70 6c 79 69 | *.x.x)'...Also.as.part.of.applyi |
| 8f980 | 6e 67 20 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 2c 20 77 65 20 6d 75 73 74 20 65 76 61 | ng.`sum-of-squares',.we.must.eva |
| 8f9a0 | 6c 75 61 74 65 0a 74 68 65 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 20 60 28 73 71 75 61 72 65 | luate.the.subexpression.`(square |
| 8f9c0 | 20 79 29 27 2c 20 77 68 65 72 65 20 60 79 27 20 69 73 20 31 30 2e 20 20 54 68 69 73 20 73 65 63 | .y)',.where.`y'.is.10...This.sec |
| 8f9e0 | 6f 6e 64 20 63 61 6c 6c 20 74 6f 0a 60 73 71 75 61 72 65 27 20 63 72 65 61 74 65 73 20 61 6e 6f | ond.call.to.`square'.creates.ano |
| 8fa00 | 74 68 65 72 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 45 34 2c 20 69 6e 20 77 68 69 63 68 20 60 | ther.environment,.E4,.in.which.` |
| 8fa20 | 78 27 2c 20 74 68 65 20 66 6f 72 6d 61 6c 0a 70 61 72 61 6d 65 74 65 72 20 6f 66 20 60 73 71 75 | x',.the.formal.parameter.of.`squ |
| 8fa40 | 61 72 65 27 2c 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 31 30 2e 20 20 41 6e 64 20 77 69 74 68 69 | are',.is.bound.to.10...And.withi |
| 8fa60 | 6e 20 45 34 20 77 65 20 6d 75 73 74 20 65 76 61 6c 75 61 74 65 0a 60 28 2a 20 78 20 78 29 27 2e | n.E4.we.must.evaluate.`(*.x.x)'. |
| 8fa80 | 0a 0a 20 20 20 54 68 65 20 69 6d 70 6f 72 74 61 6e 74 20 70 6f 69 6e 74 20 74 6f 20 6f 62 73 65 | .....The.important.point.to.obse |
| 8faa0 | 72 76 65 20 69 73 20 74 68 61 74 20 65 61 63 68 20 63 61 6c 6c 20 74 6f 20 60 73 71 75 61 72 65 | rve.is.that.each.call.to.`square |
| 8fac0 | 27 20 63 72 65 61 74 65 73 0a 61 20 6e 65 77 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 63 6f 6e 74 | '.creates.a.new.environment.cont |
| 8fae0 | 61 69 6e 69 6e 67 20 61 20 62 69 6e 64 69 6e 67 20 66 6f 72 20 60 78 27 2e 20 20 57 65 20 63 61 | aining.a.binding.for.`x'...We.ca |
| 8fb00 | 6e 20 73 65 65 20 68 65 72 65 20 68 6f 77 20 74 68 65 0a 64 69 66 66 65 72 65 6e 74 20 66 72 61 | n.see.here.how.the.different.fra |
| 8fb20 | 6d 65 73 20 73 65 72 76 65 20 74 6f 20 6b 65 65 70 20 73 65 70 61 72 61 74 65 20 74 68 65 20 64 | mes.serve.to.keep.separate.the.d |
| 8fb40 | 69 66 66 65 72 65 6e 74 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 0a 61 6c 6c 20 6e 61 6d | ifferent.local.variables.all.nam |
| 8fb60 | 65 64 20 60 78 27 2e 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 65 61 63 68 20 66 72 61 6d 65 20 | ed.`x'...Notice.that.each.frame. |
| 8fb80 | 63 72 65 61 74 65 64 20 62 79 20 60 73 71 75 61 72 65 27 20 70 6f 69 6e 74 73 20 74 6f 0a 74 68 | created.by.`square'.points.to.th |
| 8fba0 | 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 73 69 6e 63 65 20 74 68 69 73 | e.global.environment,.since.this |
| 8fbc0 | 20 69 73 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 64 69 63 61 74 65 64 20 62 79 | .is.the.environment.indicated.by |
| 8fbe0 | 20 74 68 65 0a 60 73 71 75 61 72 65 27 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 2e 0a | .the.`square'.procedure.object.. |
| 8fc00 | 0a 20 20 20 41 66 74 65 72 20 74 68 65 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 | ....After.the.subexpressions.are |
| 8fc20 | 20 65 76 61 6c 75 61 74 65 64 2c 20 74 68 65 20 72 65 73 75 6c 74 73 20 61 72 65 20 72 65 74 75 | .evaluated,.the.results.are.retu |
| 8fc40 | 72 6e 65 64 2e 0a 54 68 65 20 76 61 6c 75 65 73 20 67 65 6e 65 72 61 74 65 64 20 62 79 20 74 68 | rned..The.values.generated.by.th |
| 8fc60 | 65 20 74 77 6f 20 63 61 6c 6c 73 20 74 6f 20 60 73 71 75 61 72 65 27 20 61 72 65 20 61 64 64 65 | e.two.calls.to.`square'.are.adde |
| 8fc80 | 64 20 62 79 0a 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 2c 20 61 6e 64 20 74 68 69 73 20 | d.by.`sum-of-squares',.and.this. |
| 8fca0 | 72 65 73 75 6c 74 20 69 73 20 72 65 74 75 72 6e 65 64 20 62 79 20 60 66 27 2e 20 20 53 69 6e 63 | result.is.returned.by.`f'...Sinc |
| 8fcc0 | 65 20 6f 75 72 20 66 6f 63 75 73 0a 68 65 72 65 20 69 73 20 6f 6e 20 74 68 65 20 65 6e 76 69 72 | e.our.focus.here.is.on.the.envir |
| 8fce0 | 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 73 2c 20 77 65 20 77 69 6c 6c 20 6e 6f 74 20 64 | onment.structures,.we.will.not.d |
| 8fd00 | 77 65 6c 6c 20 6f 6e 20 68 6f 77 20 74 68 65 73 65 0a 72 65 74 75 72 6e 65 64 20 76 61 6c 75 65 | well.on.how.these.returned.value |
| 8fd20 | 73 20 61 72 65 20 70 61 73 73 65 64 20 66 72 6f 6d 20 63 61 6c 6c 20 74 6f 20 63 61 6c 6c 3b 20 | s.are.passed.from.call.to.call;. |
| 8fd40 | 68 6f 77 65 76 65 72 2c 20 74 68 69 73 20 69 73 20 61 6c 73 6f 20 61 6e 0a 69 6d 70 6f 72 74 61 | however,.this.is.also.an.importa |
| 8fd60 | 6e 74 20 61 73 70 65 63 74 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 | nt.aspect.of.the.evaluation.proc |
| 8fd80 | 65 73 73 2c 20 61 6e 64 20 77 65 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 6f 20 69 74 20 69 6e | ess,.and.we.will.return.to.it.in |
| 8fda0 | 0a 64 65 74 61 69 6c 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 35 3a 3a 2e 0a 0a 20 | .detail.in.*Note.Chapter.5::.... |
| 8fdc0 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 39 3a 2a 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a | ....*Exercise.3.9:*.In.section.* |
| 8fde0 | 4e 6f 74 65 20 31 2d 32 2d 31 3a 3a 20 77 65 20 75 73 65 64 20 74 68 65 20 73 75 62 73 74 69 74 | Note.1-2-1::.we.used.the.substit |
| 8fe00 | 75 74 69 6f 6e 0a 20 20 20 20 20 6d 6f 64 65 6c 20 74 6f 20 61 6e 61 6c 79 7a 65 20 74 77 6f 20 | ution......model.to.analyze.two. |
| 8fe20 | 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 66 61 63 74 6f 72 69 | procedures.for.computing.factori |
| 8fe40 | 61 6c 73 2c 20 61 0a 20 20 20 20 20 72 65 63 75 72 73 69 76 65 20 76 65 72 73 69 6f 6e 0a 0a 20 | als,.a......recursive.version... |
| 8fe60 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 | .........(define.(factorial.n).. |
| 8fe80 | 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 20 20 20 20 | ...........(if.(=.n.1).......... |
| 8fea0 | 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 6e 20 28 66 | .......1.................(*.n.(f |
| 8fec0 | 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 29 29 29 0a 0a 20 20 20 20 20 61 6e 64 20 61 | actorial.(-.n.1))))).......and.a |
| 8fee0 | 6e 20 69 74 65 72 61 74 69 76 65 20 76 65 72 73 69 6f 6e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 | n.iterative.version............( |
| 8ff00 | 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 | define.(factorial.n)............ |
| 8ff20 | 20 28 66 61 63 74 2d 69 74 65 72 20 31 20 31 20 6e 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 | .(fact-iter.1.1.n))............( |
| 8ff40 | 64 65 66 69 6e 65 20 28 66 61 63 74 2d 69 74 65 72 20 70 72 6f 64 75 63 74 20 63 6f 75 6e 74 65 | define.(fact-iter.product.counte |
| 8ff60 | 72 20 6d 61 78 2d 63 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 | r.max-count).............(if.(>. |
| 8ff80 | 63 6f 75 6e 74 65 72 20 6d 61 78 2d 63 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | counter.max-count).............. |
| 8ffa0 | 20 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 | ...product.................(fact |
| 8ffc0 | 2d 69 74 65 72 20 28 2a 20 63 6f 75 6e 74 65 72 20 70 72 6f 64 75 63 74 29 0a 20 20 20 20 20 20 | -iter.(*.counter.product)....... |
| 8ffe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 63 6f 75 6e 74 65 72 20 | .....................(+.counter. |
| 90000 | 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 61 | 1)............................ma |
| 90020 | 78 2d 63 6f 75 6e 74 29 29 29 0a 0a 20 20 20 20 20 53 68 6f 77 20 74 68 65 20 65 6e 76 69 72 6f | x-count))).......Show.the.enviro |
| 90040 | 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 73 20 63 72 65 61 74 65 64 20 62 79 20 65 76 61 6c | nment.structures.created.by.eval |
| 90060 | 75 61 74 69 6e 67 20 60 28 66 61 63 74 6f 72 69 61 6c 0a 20 20 20 20 20 36 29 27 20 75 73 69 6e | uating.`(factorial......6)'.usin |
| 90080 | 67 20 65 61 63 68 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 60 66 61 63 74 6f 72 69 61 6c | g.each.version.of.the.`factorial |
| 900a0 | 27 20 70 72 6f 63 65 64 75 72 65 2e 28 31 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 | '.procedure.(1).....----------.F |
| 900c0 | 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 65 20 | ootnotes.----------.....(1).The. |
| 900e0 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 20 77 69 6c 6c 20 6e 6f 74 20 63 6c 61 72 69 | environment.model.will.not.clari |
| 90100 | 66 79 20 6f 75 72 20 63 6c 61 69 6d 20 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 31 2d | fy.our.claim.in.section.*Note.1- |
| 90120 | 32 2d 31 3a 3a 20 74 68 61 74 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 63 61 6e 20 65 | 2-1::.that.the.interpreter.can.e |
| 90140 | 78 65 63 75 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 73 75 63 68 20 61 73 0a 60 66 61 63 74 | xecute.a.procedure.such.as.`fact |
| 90160 | 2d 69 74 65 72 27 20 69 6e 20 61 20 63 6f 6e 73 74 61 6e 74 20 61 6d 6f 75 6e 74 20 6f 66 20 73 | -iter'.in.a.constant.amount.of.s |
| 90180 | 70 61 63 65 20 75 73 69 6e 67 20 74 61 69 6c 20 72 65 63 75 72 73 69 6f 6e 2e 20 20 57 65 0a 77 | pace.using.tail.recursion...We.w |
| 901a0 | 69 6c 6c 20 64 69 73 63 75 73 73 20 74 61 69 6c 20 72 65 63 75 72 73 69 6f 6e 20 77 68 65 6e 20 | ill.discuss.tail.recursion.when. |
| 901c0 | 77 65 20 64 65 61 6c 20 77 69 74 68 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 73 74 72 75 63 74 75 | we.deal.with.the.control.structu |
| 901e0 | 72 65 20 6f 66 0a 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 69 6e 20 73 65 63 74 69 6f 6e | re.of.the.interpreter.in.section |
| 90200 | 20 2a 4e 6f 74 65 20 35 2d 34 3a 3a 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f | .*Note.5-4::.....File:.sicp.info |
| 90220 | 2c 20 20 4e 6f 64 65 3a 20 33 2d 32 2d 33 2c 20 20 4e 65 78 74 3a 20 33 2d 32 2d 34 2c 20 20 50 | ,..Node:.3-2-3,..Next:.3-2-4,..P |
| 90240 | 72 65 76 3a 20 33 2d 32 2d 32 2c 20 20 55 70 3a 20 33 2d 32 0a 0a 33 2e 32 2e 33 20 46 72 61 6d | rev:.3-2-2,..Up:.3-2..3.2.3.Fram |
| 90260 | 65 73 20 61 73 20 74 68 65 20 52 65 70 6f 73 69 74 6f 72 79 20 6f 66 20 4c 6f 63 61 6c 20 53 74 | es.as.the.Repository.of.Local.St |
| 90280 | 61 74 65 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ate.---------------------------- |
| 902a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 65 20 63 61 6e 20 74 75 72 6e 20 74 | -----------------..We.can.turn.t |
| 902c0 | 6f 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 20 74 6f 20 73 65 65 20 68 | o.the.environment.model.to.see.h |
| 902e0 | 6f 77 20 70 72 6f 63 65 64 75 72 65 73 20 61 6e 64 0a 61 73 73 69 67 6e 6d 65 6e 74 20 63 61 6e | ow.procedures.and.assignment.can |
| 90300 | 20 62 65 20 75 73 65 64 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 6f 62 6a 65 63 74 73 20 77 69 | .be.used.to.represent.objects.wi |
| 90320 | 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 2e 20 20 41 73 20 61 6e 0a 65 78 61 6d 70 6c 65 2c 20 | th.local.state...As.an.example,. |
| 90340 | 63 6f 6e 73 69 64 65 72 20 74 68 65 20 22 77 69 74 68 64 72 61 77 61 6c 20 70 72 6f 63 65 73 73 | consider.the."withdrawal.process |
| 90360 | 6f 72 22 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 31 3a 3a 0a 63 | or".from.section.*Note.3-1-1::.c |
| 90380 | 72 65 61 74 65 64 20 62 79 20 63 61 6c 6c 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a | reated.by.calling.the.procedure. |
| 903a0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 20 62 61 6c | ......(define.(make-withdraw.bal |
| 903c0 | 61 6e 63 65 29 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 6d 6f 75 6e 74 29 0a 20 20 | ance)........(lambda.(amount)... |
| 903e0 | 20 20 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 0a 20 | .......(if.(>=.balance.amount).. |
| 90400 | 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 | ............(begin.(set!.balance |
| 90420 | 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(-.balance.amount))............ |
| 90440 | 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 22 | .........balance).............." |
| 90460 | 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 29 0a 0a 20 20 20 4c 65 74 20 75 | Insufficient.funds"))).....Let.u |
| 90480 | 73 20 64 65 73 63 72 69 62 65 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 0a 0a 20 20 | s.describe.the.evaluation.of.... |
| 904a0 | 20 20 20 28 64 65 66 69 6e 65 20 57 31 20 28 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 20 31 30 30 | ...(define.W1.(make-withdraw.100 |
| 904c0 | 29 29 0a 0a 66 6f 6c 6c 6f 77 65 64 20 62 79 0a 0a 20 20 20 20 20 28 57 31 20 35 30 29 0a 20 20 | ))..followed.by.......(W1.50)... |
| 904e0 | 20 20 20 35 30 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 36 3a 3a 20 73 68 6f | ...50.....*Note.Figure.3-6::.sho |
| 90500 | 77 73 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 64 65 66 69 6e 69 6e 67 20 74 68 65 20 60 6d | ws.the.result.of.defining.the.`m |
| 90520 | 61 6b 65 2d 77 69 74 68 64 72 61 77 27 0a 70 72 6f 63 65 64 75 72 65 20 69 6e 20 74 68 65 20 67 | ake-withdraw'.procedure.in.the.g |
| 90540 | 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 54 68 69 73 20 70 72 6f 64 75 63 65 | lobal.environment...This.produce |
| 90560 | 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 0a 74 68 61 74 20 63 6f 6e 74 61 69 | s.a.procedure.object.that.contai |
| 90580 | 6e 73 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 | ns.a.pointer.to.the.global.envir |
| 905a0 | 6f 6e 6d 65 6e 74 2e 20 20 53 6f 20 66 61 72 2c 20 74 68 69 73 20 69 73 20 6e 6f 0a 64 69 66 66 | onment...So.far,.this.is.no.diff |
| 905c0 | 65 72 65 6e 74 20 66 72 6f 6d 20 74 68 65 20 65 78 61 6d 70 6c 65 73 20 77 65 20 68 61 76 65 20 | erent.from.the.examples.we.have. |
| 905e0 | 61 6c 72 65 61 64 79 20 73 65 65 6e 2c 20 65 78 63 65 70 74 20 74 68 61 74 20 74 68 65 20 62 6f | already.seen,.except.that.the.bo |
| 90600 | 64 79 0a 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 69 74 73 65 6c 66 20 61 20 | dy.of.the.procedure.is.itself.a. |
| 90620 | 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 | `lambda'.expression........*Figu |
| 90640 | 72 65 20 33 2e 36 3a 2a 20 52 65 73 75 6c 74 20 6f 66 20 64 65 66 69 6e 69 6e 67 20 60 6d 61 6b | re.3.6:*.Result.of.defining.`mak |
| 90660 | 65 2d 77 69 74 68 64 72 61 77 27 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c 0a 20 20 20 20 20 65 | e-withdraw'.in.the.global......e |
| 90680 | 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | nvironment...................... |
| 906a0 | 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 | .+---------------------------+.. |
| 906c0 | 20 20 20 20 20 20 20 20 20 67 6c 6f 62 61 6c 20 2d 2d 3e 7c 20 6d 61 6b 65 2d 77 69 74 68 64 72 | .........global.-->|.make-withdr |
| 906e0 | 61 77 3a 20 2d 2d 2b 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 65 6e 76 20 20 | aw:.--+........|...........env.. |
| 90700 | 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2d | .....+------------------|------- |
| 90720 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -+.............................. |
| 90740 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..........|......^.............. |
| 90760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 | ..........................V..... |
| 90780 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .|.............................. |
| 907a0 | 20 20 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......---.---...|.............. |
| 907c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d | ......................|.O.|.O-+- |
| 907e0 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -+.............................. |
| 90800 | 20 20 20 20 20 20 60 2d 7c 2d 5e 2d 2d 2d 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......`-|-^---'................. |
| 90820 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 | .....................|.......... |
| 90840 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 | ............................V... |
| 90860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 72 61 6d 65 74 65 72 73 3a 20 62 61 6c | .................parameters:.bal |
| 90880 | 61 6e 63 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 6f 64 79 3a 20 28 6c | ance....................body:.(l |
| 908a0 | 61 6d 62 64 61 20 28 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ambda.(amount).................. |
| 908c0 | 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 | ..........(if.(>=.balance.amount |
| 908e0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | )............................... |
| 90900 | 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 0a 20 20 20 20 20 20 20 20 20 20 | .(begin.(set!.balance........... |
| 90920 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 90940 | 20 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 | ..(-.balance.amount))........... |
| 90960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 | ............................bala |
| 90980 | 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | nce)............................ |
| 909a0 | 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 0a 0a 20 20 20 54 | ...."Insufficient.funds")).....T |
| 909c0 | 68 65 20 69 6e 74 65 72 65 73 74 69 6e 67 20 70 61 72 74 20 6f 66 20 74 68 65 20 63 6f 6d 70 75 | he.interesting.part.of.the.compu |
| 909e0 | 74 61 74 69 6f 6e 20 68 61 70 70 65 6e 73 20 77 68 65 6e 20 77 65 20 61 70 70 6c 79 20 74 68 65 | tation.happens.when.we.apply.the |
| 90a00 | 0a 70 72 6f 63 65 64 75 72 65 20 60 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 27 20 74 6f 20 61 6e | .procedure.`make-withdraw'.to.an |
| 90a20 | 20 61 72 67 75 6d 65 6e 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 57 31 20 28 6d 61 6b | .argument:.......(define.W1.(mak |
| 90a40 | 65 2d 77 69 74 68 64 72 61 77 20 31 30 30 29 29 0a 0a 20 20 20 57 65 20 62 65 67 69 6e 2c 20 61 | e-withdraw.100)).....We.begin,.a |
| 90a60 | 73 20 75 73 75 61 6c 2c 20 62 79 20 73 65 74 74 69 6e 67 20 75 70 20 61 6e 20 65 6e 76 69 72 6f | s.usual,.by.setting.up.an.enviro |
| 90a80 | 6e 6d 65 6e 74 20 45 31 20 69 6e 20 77 68 69 63 68 20 74 68 65 0a 66 6f 72 6d 61 6c 20 70 61 72 | nment.E1.in.which.the.formal.par |
| 90aa0 | 61 6d 65 74 65 72 20 60 62 61 6c 61 6e 63 65 27 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 | ameter.`balance'.is.bound.to.the |
| 90ac0 | 20 61 72 67 75 6d 65 6e 74 20 31 30 30 2e 20 20 57 69 74 68 69 6e 20 74 68 69 73 0a 65 6e 76 69 | .argument.100...Within.this.envi |
| 90ae0 | 72 6f 6e 6d 65 6e 74 2c 20 77 65 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 62 6f 64 79 20 6f 66 | ronment,.we.evaluate.the.body.of |
| 90b00 | 20 60 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 27 2c 20 6e 61 6d 65 6c 79 20 74 68 65 0a 60 6c 61 | .`make-withdraw',.namely.the.`la |
| 90b20 | 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 54 68 69 73 20 63 6f 6e 73 74 72 75 63 | mbda'.expression...This.construc |
| 90b40 | 74 73 20 61 20 6e 65 77 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 2c 20 77 68 6f 73 65 | ts.a.new.procedure.object,.whose |
| 90b60 | 20 63 6f 64 65 0a 69 73 20 61 73 20 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 20 60 6c 61 | .code.is.as.specified.by.the.`la |
| 90b80 | 6d 62 64 61 27 20 61 6e 64 20 77 68 6f 73 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 45 | mbda'.and.whose.environment.is.E |
| 90ba0 | 31 2c 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 | 1,.the.environment.in.which.the. |
| 90bc0 | 60 6c 61 6d 62 64 61 27 20 77 61 73 20 65 76 61 6c 75 61 74 65 64 20 74 6f 20 70 72 6f 64 75 63 | `lambda'.was.evaluated.to.produc |
| 90be0 | 65 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 65 20 72 65 73 75 6c 74 69 6e 67 20 | e.the.procedure...The.resulting. |
| 90c00 | 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 72 65 | procedure.object.is.the.value.re |
| 90c20 | 74 75 72 6e 65 64 20 62 79 20 74 68 65 0a 63 61 6c 6c 20 74 6f 20 60 6d 61 6b 65 2d 77 69 74 68 | turned.by.the.call.to.`make-with |
| 90c40 | 64 72 61 77 27 2e 20 20 54 68 69 73 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 60 57 31 27 20 69 6e | draw'...This.is.bound.to.`W1'.in |
| 90c60 | 20 74 68 65 20 67 6c 6f 62 61 6c 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 73 69 6e 63 65 20 74 | .the.global.environment,.since.t |
| 90c80 | 68 65 20 60 64 65 66 69 6e 65 27 20 69 74 73 65 6c 66 20 69 73 20 62 65 69 6e 67 20 65 76 61 6c | he.`define'.itself.is.being.eval |
| 90ca0 | 75 61 74 65 64 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e | uated.in.the.global.environment. |
| 90cc0 | 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 37 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 72 | ..*Note.Figure.3-7::.shows.the.r |
| 90ce0 | 65 73 75 6c 74 69 6e 67 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 73 74 72 75 63 74 75 72 65 2e 0a | esulting.environment.structure.. |
| 90d00 | 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 37 3a 2a 20 52 65 73 75 6c 74 20 6f 66 20 65 76 | ......*Figure.3.7:*.Result.of.ev |
| 90d20 | 61 6c 75 61 74 69 6e 67 20 60 28 64 65 66 69 6e 65 20 57 31 20 28 6d 61 6b 65 2d 77 69 74 68 64 | aluating.`(define.W1.(make-withd |
| 90d40 | 72 61 77 0a 20 20 20 20 20 31 30 30 29 29 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | raw......100))'................. |
| 90d60 | 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ......+------------------------- |
| 90d80 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 | ----------------------+......... |
| 90da0 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 3a 20 2d 2d 2d | ............|.make-withdraw:.--- |
| 90dc0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 7c 0a 20 20 | --------------------+.......|... |
| 90de0 | 20 20 20 20 20 20 20 20 67 6c 6f 62 61 6c 20 2d 2d 3e 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........global.-->|............. |
| 90e00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 | ..........................|..... |
| 90e20 | 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 57 31 3a 20 2d 2d | ..|.....................|.W1:.-- |
| 90e40 | 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | +............................... |
| 90e60 | 7c 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d | |.......|.....................+- |
| 90e80 | 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ------|------------------------- |
| 90ea0 | 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ------|-------+................. |
| 90ec0 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 | ............|................^.. |
| 90ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ............|.....^............. |
| 90f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................|............... |
| 90f20 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 | .|..............V.....|......... |
| 90f40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 2b 2d 2d | ....................|........+-- |
| 90f60 | 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2b 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 7c 0a 20 20 20 20 | -----+------+....---.---..|..... |
| 90f80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 45 31 20 2d 2d | ........................|..E1.-- |
| 90fa0 | 3e 7c 20 62 61 6c 61 6e 63 65 3a 20 31 30 30 20 7c 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2b 0a | >|.balance:.100.|...|.O.|.O-+-+. |
| 90fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | ............................|... |
| 90fe0 | 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 60 2d 7c 2d 5e 2d 2d 2d | .....+--------------+...`-|-^--- |
| 91000 | 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 | '.............................V. |
| 91020 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | ...............^............|... |
| 91040 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 | .......................---.---.. |
| 91060 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 | ...........|............V....... |
| 91080 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2b 2d 4f 20 7c 20 4f 2d 2b 2d 2d 2d 2d 2d | ................+-+-O.|.O-+----- |
| 910a0 | 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 70 61 72 61 6d 65 74 65 72 73 3a 20 62 61 6c 61 6e 63 65 0a | -------+....parameters:.balance. |
| 910c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 60 2d 2d 2d 5e 2d 2d 2d | ......................|.`---^--- |
| 910e0 | 27 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 6f 64 79 3a 20 2e 2e 2e 0a 20 20 20 20 | '.................body:......... |
| 91100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..................V............. |
| 91120 | 20 20 70 61 72 61 6d 65 74 65 72 73 3a 20 61 6d 6f 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 | ..parameters:.amount............ |
| 91140 | 20 20 20 62 6f 64 79 3a 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 | ...body:.(if.(>=.balance.amount) |
| 91160 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 | .........................(begin. |
| 91180 | 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 | (set!.balance.(-.balance.amount) |
| 911a0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | )............................... |
| 911c0 | 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .balance)....................... |
| 911e0 | 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 0a 0a 20 20 20 4e 6f 77 20 | .."Insufficient.funds").....Now. |
| 91200 | 77 65 20 63 61 6e 20 61 6e 61 6c 79 7a 65 20 77 68 61 74 20 68 61 70 70 65 6e 73 20 77 68 65 6e | we.can.analyze.what.happens.when |
| 91220 | 20 60 57 31 27 20 69 73 20 61 70 70 6c 69 65 64 20 74 6f 20 61 6e 20 61 72 67 75 6d 65 6e 74 3a | .`W1'.is.applied.to.an.argument: |
| 91240 | 0a 0a 20 20 20 20 20 28 57 31 20 35 30 29 0a 20 20 20 20 20 35 30 0a 0a 20 20 20 57 65 20 62 65 | .......(W1.50)......50.....We.be |
| 91260 | 67 69 6e 20 62 79 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 61 20 66 72 61 6d 65 20 69 6e 20 77 | gin.by.constructing.a.frame.in.w |
| 91280 | 68 69 63 68 20 60 61 6d 6f 75 6e 74 27 2c 20 74 68 65 20 66 6f 72 6d 61 6c 0a 70 61 72 61 6d 65 | hich.`amount',.the.formal.parame |
| 912a0 | 74 65 72 20 6f 66 20 60 57 31 27 2c 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 61 72 67 | ter.of.`W1',.is.bound.to.the.arg |
| 912c0 | 75 6d 65 6e 74 20 35 30 2e 20 20 54 68 65 20 63 72 75 63 69 61 6c 20 70 6f 69 6e 74 20 74 6f 0a | ument.50...The.crucial.point.to. |
| 912e0 | 6f 62 73 65 72 76 65 20 69 73 20 74 68 61 74 20 74 68 69 73 20 66 72 61 6d 65 20 68 61 73 20 61 | observe.is.that.this.frame.has.a |
| 91300 | 73 20 69 74 73 20 65 6e 63 6c 6f 73 69 6e 67 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6e 6f 74 20 | s.its.enclosing.environment.not. |
| 91320 | 74 68 65 0a 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 62 75 74 20 72 61 74 68 | the.global.environment,.but.rath |
| 91340 | 65 72 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 45 31 2c 20 62 65 63 61 75 73 65 20 74 | er.the.environment.E1,.because.t |
| 91360 | 68 69 73 20 69 73 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 74 68 61 74 20 69 73 20 73 | his.is.the.environment.that.is.s |
| 91380 | 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 20 60 57 31 27 20 70 72 6f 63 65 64 75 72 65 20 6f | pecified.by.the.`W1'.procedure.o |
| 913a0 | 62 6a 65 63 74 2e 20 20 57 69 74 68 69 6e 0a 74 68 69 73 20 6e 65 77 20 65 6e 76 69 72 6f 6e 6d | bject...Within.this.new.environm |
| 913c0 | 65 6e 74 2c 20 77 65 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 | ent,.we.evaluate.the.body.of.the |
| 913e0 | 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 | .procedure:.......(if.(>=.balanc |
| 91400 | 65 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 | e.amount)..........(begin.(set!. |
| 91420 | 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 | balance.(-.balance.amount))..... |
| 91440 | 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 22 49 | ............balance).........."I |
| 91460 | 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 0a 0a 20 20 20 54 68 65 20 72 65 73 75 | nsufficient.funds").....The.resu |
| 91480 | 6c 74 69 6e 67 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 20 69 73 20 73 | lting.environment.structure.is.s |
| 914a0 | 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 38 3a 3a 2e 0a 54 68 65 20 | hown.in.*Note.Figure.3-8::..The. |
| 914c0 | 65 78 70 72 65 73 73 69 6f 6e 20 62 65 69 6e 67 20 65 76 61 6c 75 61 74 65 64 20 72 65 66 65 72 | expression.being.evaluated.refer |
| 914e0 | 65 6e 63 65 73 20 62 6f 74 68 20 60 61 6d 6f 75 6e 74 27 20 61 6e 64 20 60 62 61 6c 61 6e 63 65 | ences.both.`amount'.and.`balance |
| 91500 | 27 2e 0a 60 41 6d 6f 75 6e 74 27 20 77 69 6c 6c 20 62 65 20 66 6f 75 6e 64 20 69 6e 20 74 68 65 | '..`Amount'.will.be.found.in.the |
| 91520 | 20 66 69 72 73 74 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c | .first.frame.in.the.environment, |
| 91540 | 20 77 68 69 6c 65 0a 60 62 61 6c 61 6e 63 65 27 20 77 69 6c 6c 20 62 65 20 66 6f 75 6e 64 20 62 | .while.`balance'.will.be.found.b |
| 91560 | 79 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 65 20 65 6e 63 6c 6f 73 69 6e 67 2d 65 6e 76 69 72 6f | y.following.the.enclosing-enviro |
| 91580 | 6e 6d 65 6e 74 20 70 6f 69 6e 74 65 72 0a 74 6f 20 45 31 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 | nment.pointer.to.E1........*Figu |
| 915a0 | 72 65 20 33 2e 38 3a 2a 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 63 72 65 61 74 65 64 20 62 79 | re.3.8:*.Environments.created.by |
| 915c0 | 20 61 70 70 6c 79 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 6f 62 6a | .applying.the.procedure......obj |
| 915e0 | 65 63 74 20 60 57 31 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b | ect.`W1'.......................+ |
| 91600 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 91620 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 | -------------------+............ |
| 91640 | 20 20 20 20 20 20 20 20 20 7c 20 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 3a 20 2e 2e 2e 20 20 20 | .........|.make-withdraw:....... |
| 91660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 | .............................|.. |
| 91680 | 20 20 20 20 20 20 20 20 20 67 6c 6f 62 61 6c 20 2d 2d 3e 7c 20 20 20 20 20 20 20 20 20 20 20 20 | .........global.-->|............ |
| 916a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 916c0 | 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 65 6e 76 20 20 20 20 20 20 20 7c 20 57 | .......|...........env.......|.W |
| 916e0 | 31 3a 20 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 1:.--+.......................... |
| 91700 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .................|.............. |
| 91720 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .......+-------|---------------- |
| 91740 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 | ---------------------------+.... |
| 91760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | .........................|...... |
| 91780 | 20 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .........^...................... |
| 917a0 | 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 | .......|...............|........ |
| 917c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 2d | .....................|.......+-- |
| 917e0 | 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2b 20 48 65 72 65 20 69 73 20 74 68 65 20 62 61 6c 61 6e 63 | -----+------+.Here.is.the.balanc |
| 91800 | 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | e.............................|. |
| 91820 | 45 31 20 2d 2d 3e 7c 20 62 61 6c 61 6e 63 65 3a 20 31 30 30 20 7c 20 74 68 61 74 20 77 69 6c 6c | E1.-->|.balance:.100.|.that.will |
| 91840 | 20 62 65 20 63 68 61 6e 67 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .be.changed..................... |
| 91860 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b | ........|.......+--------------+ |
| 91880 | 20 62 79 20 74 68 65 20 73 65 74 21 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .by.the.set!.................... |
| 918a0 | 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 5e 0a | ..........V...............^...^. |
| 918c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d | .........................---.--- |
| 918e0 | 2e 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 | ............|...+----+.......... |
| 91900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d | ...............|.O.|.O-+-------- |
| 91920 | 2d 2d 2d 2b 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---+........|................... |
| 91940 | 20 20 20 20 20 20 60 2d 7c 2d 5e 2d 2d 2d 27 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | ......`-|-^---'.............+--- |
| 91960 | 2d 2d 2d 2b 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---+-----+...................... |
| 91980 | 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 61 6d 6f 75 6e | .....|...................|.amoun |
| 919a0 | 74 3a 20 35 30 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | t:.50.|......................... |
| 919c0 | 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..V...................+--------- |
| 919e0 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 72 61 6d 65 74 65 72 73 3a | ---+.................parameters: |
| 91a00 | 20 61 6d 6f 75 6e 74 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 | .amount...(if.(>=.balance.amount |
| 91a20 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 6f 64 79 3a 20 2e 2e 2e 20 20 20 20 20 | ).................body:......... |
| 91a40 | 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 0a | ...........(begin.(set!.balance. |
| 91a60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 91a80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2d 20 62 61 6c 61 6e 63 65 | ......................(-.balance |
| 91aa0 | 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .amount))....................... |
| 91ac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 | ..........................balanc |
| 91ae0 | 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e).............................. |
| 91b00 | 20 20 20 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 | ............"Insufficient.funds" |
| 91b20 | 29 0a 0a 20 20 20 57 68 65 6e 20 74 68 65 20 60 73 65 74 21 27 20 69 73 20 65 78 65 63 75 74 65 | ).....When.the.`set!'.is.execute |
| 91b40 | 64 2c 20 74 68 65 20 62 69 6e 64 69 6e 67 20 6f 66 20 60 62 61 6c 61 6e 63 65 27 20 69 6e 20 45 | d,.the.binding.of.`balance'.in.E |
| 91b60 | 31 20 69 73 0a 63 68 61 6e 67 65 64 2e 20 20 41 74 20 74 68 65 20 63 6f 6d 70 6c 65 74 69 6f 6e | 1.is.changed...At.the.completion |
| 91b80 | 20 6f 66 20 74 68 65 20 63 61 6c 6c 20 74 6f 20 60 57 31 27 2c 20 60 62 61 6c 61 6e 63 65 27 20 | .of.the.call.to.`W1',.`balance'. |
| 91ba0 | 69 73 20 35 30 2c 20 61 6e 64 0a 74 68 65 20 66 72 61 6d 65 20 74 68 61 74 20 63 6f 6e 74 61 69 | is.50,.and.the.frame.that.contai |
| 91bc0 | 6e 73 20 60 62 61 6c 61 6e 63 65 27 20 69 73 20 73 74 69 6c 6c 20 70 6f 69 6e 74 65 64 20 74 6f | ns.`balance'.is.still.pointed.to |
| 91be0 | 20 62 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 6f 62 6a 65 63 74 20 60 57 31 27 2e 20 20 | .by.the.procedure.object.`W1'... |
| 91c00 | 54 68 65 20 66 72 61 6d 65 20 74 68 61 74 20 62 69 6e 64 73 20 60 61 6d 6f 75 6e 74 27 20 28 69 | The.frame.that.binds.`amount'.(i |
| 91c20 | 6e 20 77 68 69 63 68 20 77 65 20 65 78 65 63 75 74 65 64 20 74 68 65 0a 63 6f 64 65 20 74 68 61 | n.which.we.executed.the.code.tha |
| 91c40 | 74 20 63 68 61 6e 67 65 64 20 60 62 61 6c 61 6e 63 65 27 29 20 69 73 20 6e 6f 20 6c 6f 6e 67 65 | t.changed.`balance').is.no.longe |
| 91c60 | 72 20 72 65 6c 65 76 61 6e 74 2c 20 73 69 6e 63 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a | r.relevant,.since.the.procedure. |
| 91c80 | 63 61 6c 6c 20 74 68 61 74 20 63 6f 6e 73 74 72 75 63 74 65 64 20 69 74 20 68 61 73 20 74 65 72 | call.that.constructed.it.has.ter |
| 91ca0 | 6d 69 6e 61 74 65 64 2c 20 61 6e 64 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 70 6f 69 6e 74 65 | minated,.and.there.are.no.pointe |
| 91cc0 | 72 73 20 74 6f 0a 74 68 61 74 20 66 72 61 6d 65 20 66 72 6f 6d 20 6f 74 68 65 72 20 70 61 72 74 | rs.to.that.frame.from.other.part |
| 91ce0 | 73 20 6f 66 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 54 68 65 20 6e 65 78 74 20 | s.of.the.environment...The.next. |
| 91d00 | 74 69 6d 65 20 60 57 31 27 20 69 73 0a 63 61 6c 6c 65 64 2c 20 74 68 69 73 20 77 69 6c 6c 20 62 | time.`W1'.is.called,.this.will.b |
| 91d20 | 75 69 6c 64 20 61 20 6e 65 77 20 66 72 61 6d 65 20 74 68 61 74 20 62 69 6e 64 73 20 60 61 6d 6f | uild.a.new.frame.that.binds.`amo |
| 91d40 | 75 6e 74 27 20 61 6e 64 20 77 68 6f 73 65 0a 65 6e 63 6c 6f 73 69 6e 67 20 65 6e 76 69 72 6f 6e | unt'.and.whose.enclosing.environ |
| 91d60 | 6d 65 6e 74 20 69 73 20 45 31 2e 20 20 57 65 20 73 65 65 20 74 68 61 74 20 45 31 20 73 65 72 76 | ment.is.E1...We.see.that.E1.serv |
| 91d80 | 65 73 20 61 73 20 74 68 65 20 22 70 6c 61 63 65 22 20 74 68 61 74 0a 68 6f 6c 64 73 20 74 68 65 | es.as.the."place".that.holds.the |
| 91da0 | 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 20 66 6f 72 20 74 68 65 20 70 72 | .local.state.variable.for.the.pr |
| 91dc0 | 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 60 57 31 27 2e 20 20 2a 4e 6f 74 65 0a 46 69 67 75 | ocedure.object.`W1'...*Note.Figu |
| 91de0 | 72 65 20 33 2d 39 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 73 69 74 75 61 74 69 6f 6e 20 61 66 74 | re.3-9::.shows.the.situation.aft |
| 91e00 | 65 72 20 74 68 65 20 63 61 6c 6c 20 74 6f 20 60 57 31 27 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 | er.the.call.to.`W1'........*Figu |
| 91e20 | 72 65 20 33 2e 39 3a 2a 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 61 66 74 65 72 20 74 68 65 20 | re.3.9:*.Environments.after.the. |
| 91e40 | 63 61 6c 6c 20 74 6f 20 60 57 31 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | call.to.`W1'.................... |
| 91e60 | 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ....+--------------------------- |
| 91e80 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---------+...................... |
| 91ea0 | 7c 20 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 3a 20 2e 2e 2e 20 20 20 20 20 20 20 20 20 20 20 20 | |.make-withdraw:................ |
| 91ec0 | 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 67 6c 6f 62 61 6c 20 2d 2d 2d 3e 7c 20 20 20 | .....|...........global.--->|... |
| 91ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 91f00 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 65 6e 76 20 20 20 20 20 20 20 20 7c 20 57 31 3a 20 2d 2d | .|...........env........|.W1:.-- |
| 91f20 | 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 | +............................|.. |
| 91f40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d | ....................+-------|--- |
| 91f60 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 | -------------------------+...... |
| 91f80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 | ........................|....... |
| 91fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............^................... |
| 91fc0 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | ...........|...................| |
| 91fe0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ..............................|. |
| 92000 | 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 | ...........+------+------+...... |
| 92020 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 45 31 | ........................|.....E1 |
| 92040 | 20 2d 2d 2d 3e 7c 20 62 61 6c 61 6e 63 65 3a 20 35 30 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | .--->|.balance:.50.|............ |
| 92060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 2b | ..................|............+ |
| 92080 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -------------+.................. |
| 920a0 | 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............V................... |
| 920c0 | 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2d 2d 2d 2e | ^...........................---. |
| 920e0 | 2d 2d 2d 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | ---................|............ |
| 92100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..............|.O.|.O-+--------- |
| 92120 | 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ------+......................... |
| 92140 | 20 60 2d 7c 2d 5e 2d 2d 2d 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .`-|-^---'...................... |
| 92160 | 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......|......................... |
| 92180 | 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 72 61 6d 65 74 | ...V.....................paramet |
| 921a0 | 65 72 73 3a 20 61 6d 6f 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ers:.amount..................... |
| 921c0 | 62 6f 64 79 3a 20 2e 2e 2e 0a 0a 20 20 20 4f 62 73 65 72 76 65 20 77 68 61 74 20 68 61 70 70 65 | body:.........Observe.what.happe |
| 921e0 | 6e 73 20 77 68 65 6e 20 77 65 20 63 72 65 61 74 65 20 61 20 73 65 63 6f 6e 64 20 22 77 69 74 68 | ns.when.we.create.a.second."with |
| 92200 | 64 72 61 77 22 20 6f 62 6a 65 63 74 20 62 79 0a 6d 61 6b 69 6e 67 20 61 6e 6f 74 68 65 72 20 63 | draw".object.by.making.another.c |
| 92220 | 61 6c 6c 20 74 6f 20 60 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 27 3a 0a 0a 20 20 20 20 20 28 64 | all.to.`make-withdraw':.......(d |
| 92240 | 65 66 69 6e 65 20 57 32 20 28 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 20 31 30 30 29 29 0a 0a 20 | efine.W2.(make-withdraw.100))... |
| 92260 | 20 20 54 68 69 73 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 | ..This.produces.the.environment. |
| 92280 | 73 74 72 75 63 74 75 72 65 20 6f 66 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 30 3a 3a | structure.of.*Note.Figure.3-10:: |
| 922a0 | 2c 0a 77 68 69 63 68 20 73 68 6f 77 73 20 74 68 61 74 20 60 57 32 27 20 69 73 20 61 20 70 72 6f | ,.which.shows.that.`W2'.is.a.pro |
| 922c0 | 63 65 64 75 72 65 20 6f 62 6a 65 63 74 2c 20 74 68 61 74 20 69 73 2c 20 61 20 70 61 69 72 20 77 | cedure.object,.that.is,.a.pair.w |
| 922e0 | 69 74 68 20 73 6f 6d 65 0a 63 6f 64 65 20 61 6e 64 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | ith.some.code.and.an.environment |
| 92300 | 2e 20 20 54 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 45 32 20 66 6f 72 20 60 57 32 27 20 77 | ...The.environment.E2.for.`W2'.w |
| 92320 | 61 73 20 63 72 65 61 74 65 64 20 62 79 0a 74 68 65 20 63 61 6c 6c 20 74 6f 20 60 6d 61 6b 65 2d | as.created.by.the.call.to.`make- |
| 92340 | 77 69 74 68 64 72 61 77 27 2e 20 20 49 74 20 63 6f 6e 74 61 69 6e 73 20 61 20 66 72 61 6d 65 20 | withdraw'...It.contains.a.frame. |
| 92360 | 77 69 74 68 20 69 74 73 20 6f 77 6e 20 6c 6f 63 61 6c 0a 62 69 6e 64 69 6e 67 20 66 6f 72 20 60 | with.its.own.local.binding.for.` |
| 92380 | 62 61 6c 61 6e 63 65 27 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 60 57 | balance'...On.the.other.hand,.`W |
| 923a0 | 31 27 20 61 6e 64 20 60 57 32 27 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 0a 63 6f 64 65 3a 20 | 1'.and.`W2'.have.the.same.code:. |
| 923c0 | 74 68 65 20 63 6f 64 65 20 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 20 60 6c 61 6d 62 64 | the.code.specified.by.the.`lambd |
| 923e0 | 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 0a 60 6d 61 | a'.expression.in.the.body.of.`ma |
| 92400 | 6b 65 2d 77 69 74 68 64 72 61 77 27 2e 28 31 29 20 57 65 20 73 65 65 20 68 65 72 65 20 77 68 79 | ke-withdraw'.(1).We.see.here.why |
| 92420 | 20 60 57 31 27 20 61 6e 64 20 60 57 32 27 20 62 65 68 61 76 65 20 61 73 20 69 6e 64 65 70 65 6e | .`W1'.and.`W2'.behave.as.indepen |
| 92440 | 64 65 6e 74 0a 6f 62 6a 65 63 74 73 2e 20 20 43 61 6c 6c 73 20 74 6f 20 60 57 31 27 20 72 65 66 | dent.objects...Calls.to.`W1'.ref |
| 92460 | 65 72 65 6e 63 65 20 74 68 65 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 20 60 62 61 6c 61 6e | erence.the.state.variable.`balan |
| 92480 | 63 65 27 20 73 74 6f 72 65 64 0a 69 6e 20 45 31 2c 20 77 68 65 72 65 61 73 20 63 61 6c 6c 73 20 | ce'.stored.in.E1,.whereas.calls. |
| 924a0 | 74 6f 20 60 57 32 27 20 72 65 66 65 72 65 6e 63 65 20 74 68 65 20 60 62 61 6c 61 6e 63 65 27 20 | to.`W2'.reference.the.`balance'. |
| 924c0 | 73 74 6f 72 65 64 20 69 6e 20 45 32 2e 0a 54 68 75 73 2c 20 63 68 61 6e 67 65 73 20 74 6f 20 74 | stored.in.E2..Thus,.changes.to.t |
| 924e0 | 68 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 6f 66 20 6f 6e 65 20 6f 62 6a 65 63 74 20 64 6f 20 | he.local.state.of.one.object.do. |
| 92500 | 6e 6f 74 20 61 66 66 65 63 74 20 74 68 65 20 6f 74 68 65 72 0a 6f 62 6a 65 63 74 2e 0a 0a 20 20 | not.affect.the.other.object..... |
| 92520 | 20 20 20 2a 46 69 67 75 72 65 20 33 2e 31 30 3a 2a 20 55 73 69 6e 67 20 60 28 64 65 66 69 6e 65 | ...*Figure.3.10:*.Using.`(define |
| 92540 | 20 57 32 20 28 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 20 31 30 30 29 29 27 20 74 6f 20 63 72 65 | .W2.(make-withdraw.100))'.to.cre |
| 92560 | 61 74 65 20 61 0a 20 20 20 20 20 73 65 63 6f 6e 64 20 6f 62 6a 65 63 74 2e 0a 0a 20 20 20 20 20 | ate.a......second.object........ |
| 92580 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..............+----------------- |
| 925a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 925c0 | 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 6d 61 6b 65 2d 77 69 74 68 | +....................|.make-with |
| 925e0 | 64 72 61 77 3a 20 2e 2e 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | draw:........................... |
| 92600 | 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 67 6c 6f 62 61 6c 20 2d 3e 7c 20 57 32 | .......|...........global.->|.W2 |
| 92620 | 3a 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 | :.---------------------------+.. |
| 92640 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 65 6e 76 20 20 20 | ..............|...........env... |
| 92660 | 20 20 20 7c 20 57 31 3a 20 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...|.W1:.--+.................... |
| 92680 | 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 | ....|................|.......... |
| 926a0 | 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..........+-------|------------- |
| 926c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 | -----------|----------------+... |
| 926e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | .........................|...... |
| 92700 | 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........^.........|............. |
| 92720 | 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | .^............................|. |
| 92740 | 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 | .............|.........|........ |
| 92760 | 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......|......................... |
| 92780 | 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2b 20 20 7c 20 20 20 | ...|.......+------+------+..|... |
| 927a0 | 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 | ....+------+-------+............ |
| 927c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 45 31 20 2d 3e 7c 20 62 61 6c 61 6e 63 | ................|..E1.->|.balanc |
| 927e0 | 65 3a 20 35 30 20 7c 20 20 7c 20 20 45 32 20 2d 3e 7c 20 62 61 6c 61 6e 63 65 3a 20 31 30 30 20 | e:.50.|..|..E2.->|.balance:.100. |
| 92800 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | |............................|.. |
| 92820 | 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 7c 20 20 20 20 20 20 20 2b 2d | .....+-------------+..|.......+- |
| 92840 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -------------+.................. |
| 92860 | 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 | ..........V..............^...... |
| 92880 | 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ...V..............^............. |
| 928a0 | 20 20 20 20 20 20 20 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 20 20 20 20 20 20 20 20 20 7c 20 | ............---.---...........|. |
| 928c0 | 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 | .....---.---...........|........ |
| 928e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2d 2d 2d 2d 2d 2d | ................|.O.|.O-+------- |
| 92900 | 2d 2d 2d 2b 20 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 | ---+.....|.O.|.O-+----------+... |
| 92920 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 2d 7c 2d 5e 2d 2d 2d 27 20 20 | .....................`-|-^---'.. |
| 92940 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 2d 7c 2d 5e 2d 2d 2d 27 0a 20 20 20 20 20 20 20 20 | ..............`-|-^---'......... |
| 92960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .................|.+------------ |
| 92980 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ----------+..................... |
| 929a0 | 20 20 20 20 20 56 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 72 61 6d | .....V.V...................param |
| 929c0 | 65 74 65 72 73 3a 20 61 6d 6f 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | eters:.amount................... |
| 929e0 | 62 6f 64 79 3a 20 2e 2e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 31 30 3a 2a | body:...........*Exercise.3.10:* |
| 92a00 | 20 49 6e 20 74 68 65 20 60 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 27 20 70 72 6f 63 65 64 75 72 | .In.the.`make-withdraw'.procedur |
| 92a20 | 65 2c 20 74 68 65 20 6c 6f 63 61 6c 0a 20 20 20 20 20 76 61 72 69 61 62 6c 65 20 60 62 61 6c 61 | e,.the.local......variable.`bala |
| 92a40 | 6e 63 65 27 20 69 73 20 63 72 65 61 74 65 64 20 61 73 20 61 20 70 61 72 61 6d 65 74 65 72 20 6f | nce'.is.created.as.a.parameter.o |
| 92a60 | 66 20 60 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 27 2e 0a 20 20 20 20 20 57 65 20 63 6f 75 6c 64 | f.`make-withdraw'.......We.could |
| 92a80 | 20 61 6c 73 6f 20 63 72 65 61 74 65 20 74 68 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 | .also.create.the.local.state.var |
| 92aa0 | 69 61 62 6c 65 20 65 78 70 6c 69 63 69 74 6c 79 2c 20 75 73 69 6e 67 0a 20 20 20 20 20 60 6c 65 | iable.explicitly,.using......`le |
| 92ac0 | 74 27 2c 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 | t',.as.follows:............(defi |
| 92ae0 | 6e 65 20 28 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 20 69 6e 69 74 69 61 6c 2d 61 6d 6f 75 6e 74 | ne.(make-withdraw.initial-amount |
| 92b00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 62 61 6c 61 6e 63 65 20 69 6e 69 | ).............(let.((balance.ini |
| 92b20 | 74 69 61 6c 2d 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d | tial-amount))...............(lam |
| 92b40 | 62 64 61 20 28 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 | bda.(amount).................(if |
| 92b60 | 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(>=.balance.amount)............ |
| 92b80 | 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d | .........(begin.(set!.balance.(- |
| 92ba0 | 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .balance.amount))............... |
| 92bc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 | .............balance)........... |
| 92be0 | 20 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 | .........."Insufficient.funds")) |
| 92c00 | 29 29 0a 0a 20 20 20 20 20 52 65 63 61 6c 6c 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 2a 4e 6f | )).......Recall.from.section.*No |
| 92c20 | 74 65 20 31 2d 33 2d 32 3a 3a 20 74 68 61 74 20 60 6c 65 74 27 20 69 73 20 73 69 6d 70 6c 79 20 | te.1-3-2::.that.`let'.is.simply. |
| 92c40 | 73 79 6e 74 61 63 74 69 63 0a 20 20 20 20 20 73 75 67 61 72 20 66 6f 72 20 61 20 70 72 6f 63 65 | syntactic......sugar.for.a.proce |
| 92c60 | 64 75 72 65 20 63 61 6c 6c 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 3c 56 41 | dure.call:............(let.((<VA |
| 92c80 | 52 3e 20 3c 45 58 50 3e 29 29 20 3c 42 4f 44 59 3e 29 0a 0a 20 20 20 20 20 69 73 20 69 6e 74 65 | R>.<EXP>)).<BODY>).......is.inte |
| 92ca0 | 72 70 72 65 74 65 64 20 61 73 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 20 73 79 6e 74 61 78 20 66 | rpreted.as.an.alternate.syntax.f |
| 92cc0 | 6f 72 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 6c 61 6d 62 64 61 20 28 3c 56 41 52 3e 29 20 3c | or............((lambda.(<VAR>).< |
| 92ce0 | 42 4f 44 59 3e 29 20 3c 45 58 50 3e 29 0a 0a 20 20 20 20 20 55 73 65 20 74 68 65 20 65 6e 76 69 | BODY>).<EXP>).......Use.the.envi |
| 92d00 | 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 20 74 6f 20 61 6e 61 6c 79 7a 65 20 74 68 69 73 20 61 6c | ronment.model.to.analyze.this.al |
| 92d20 | 74 65 72 6e 61 74 65 20 76 65 72 73 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 6d 61 6b 65 2d 77 69 | ternate.version.of......`make-wi |
| 92d40 | 74 68 64 72 61 77 27 2c 20 64 72 61 77 69 6e 67 20 66 69 67 75 72 65 73 20 6c 69 6b 65 20 74 68 | thdraw',.drawing.figures.like.th |
| 92d60 | 65 20 6f 6e 65 73 20 61 62 6f 76 65 20 74 6f 20 69 6c 6c 75 73 74 72 61 74 65 0a 20 20 20 20 20 | e.ones.above.to.illustrate...... |
| 92d80 | 74 68 65 20 69 6e 74 65 72 61 63 74 69 6f 6e 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | the.interactions............(def |
| 92da0 | 69 6e 65 20 57 31 20 28 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 20 31 30 30 29 29 0a 0a 20 20 20 | ine.W1.(make-withdraw.100))..... |
| 92dc0 | 20 20 20 20 20 20 20 28 57 31 20 35 30 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e | .......(W1.50)............(defin |
| 92de0 | 65 20 57 32 20 28 6d 61 6b 65 2d 77 69 74 68 64 72 61 77 20 31 30 30 29 29 0a 0a 20 20 20 20 20 | e.W2.(make-withdraw.100))....... |
| 92e00 | 53 68 6f 77 20 74 68 61 74 20 74 68 65 20 74 77 6f 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 60 6d | Show.that.the.two.versions.of.`m |
| 92e20 | 61 6b 65 2d 77 69 74 68 64 72 61 77 27 20 63 72 65 61 74 65 20 6f 62 6a 65 63 74 73 20 77 69 74 | ake-withdraw'.create.objects.wit |
| 92e40 | 68 0a 20 20 20 20 20 74 68 65 20 73 61 6d 65 20 62 65 68 61 76 69 6f 72 2e 20 20 48 6f 77 20 64 | h......the.same.behavior...How.d |
| 92e60 | 6f 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 73 20 64 69 66 | o.the.environment.structures.dif |
| 92e80 | 66 65 72 20 66 6f 72 0a 20 20 20 20 20 74 68 65 20 74 77 6f 20 76 65 72 73 69 6f 6e 73 3f 0a 0a | fer.for......the.two.versions?.. |
| 92ea0 | 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d | ...----------.Footnotes.-------- |
| 92ec0 | 2d 2d 0a 0a 20 20 20 28 31 29 20 57 68 65 74 68 65 72 20 60 57 31 27 20 61 6e 64 20 60 57 32 27 | --.....(1).Whether.`W1'.and.`W2' |
| 92ee0 | 20 73 68 61 72 65 20 74 68 65 20 73 61 6d 65 20 70 68 79 73 69 63 61 6c 20 63 6f 64 65 20 73 74 | .share.the.same.physical.code.st |
| 92f00 | 6f 72 65 64 20 69 6e 20 74 68 65 0a 63 6f 6d 70 75 74 65 72 2c 20 6f 72 20 77 68 65 74 68 65 72 | ored.in.the.computer,.or.whether |
| 92f20 | 20 74 68 65 79 20 65 61 63 68 20 6b 65 65 70 20 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 63 6f | .they.each.keep.a.copy.of.the.co |
| 92f40 | 64 65 2c 20 69 73 20 61 20 64 65 74 61 69 6c 20 6f 66 0a 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 | de,.is.a.detail.of.the.implement |
| 92f60 | 61 74 69 6f 6e 2e 20 20 46 6f 72 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 77 65 20 69 | ation...For.the.interpreter.we.i |
| 92f80 | 6d 70 6c 65 6d 65 6e 74 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 0a 34 3a 3a 2c 20 74 | mplement.in.*Note.Chapter.4::,.t |
| 92fa0 | 68 65 20 63 6f 64 65 20 69 73 20 69 6e 20 66 61 63 74 20 73 68 61 72 65 64 2e 0a 0a 1f 0a 46 69 | he.code.is.in.fact.shared.....Fi |
| 92fc0 | 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 32 2d 34 2c 20 20 50 72 | le:.sicp.info,..Node:.3-2-4,..Pr |
| 92fe0 | 65 76 3a 20 33 2d 32 2d 33 2c 20 20 55 70 3a 20 33 2d 32 0a 0a 33 2e 32 2e 34 20 49 6e 74 65 72 | ev:.3-2-3,..Up:.3-2..3.2.4.Inter |
| 93000 | 6e 61 6c 20 44 65 66 69 6e 69 74 69 6f 6e 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | nal.Definitions.---------------- |
| 93020 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 53 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 38 3a | ----------..Section.*Note.1-1-8: |
| 93040 | 3a 20 69 6e 74 72 6f 64 75 63 65 64 20 74 68 65 20 69 64 65 61 20 74 68 61 74 20 70 72 6f 63 65 | :.introduced.the.idea.that.proce |
| 93060 | 64 75 72 65 73 20 63 61 6e 20 68 61 76 65 0a 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 | dures.can.have.internal.definiti |
| 93080 | 6f 6e 73 2c 20 74 68 75 73 20 6c 65 61 64 69 6e 67 20 74 6f 20 61 20 62 6c 6f 63 6b 20 73 74 72 | ons,.thus.leading.to.a.block.str |
| 930a0 | 75 63 74 75 72 65 20 61 73 20 69 6e 20 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 | ucture.as.in.the.following.proce |
| 930c0 | 64 75 72 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 73 71 75 61 72 65 20 72 6f 6f 74 73 3a 0a 0a 20 | dure.to.compute.square.roots:... |
| 930e0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 20 20 20 20 20 28 64 65 66 | ....(define.(sqrt.x)........(def |
| 93100 | 69 6e 65 20 28 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 | ine.(good-enough?.guess)........ |
| 93120 | 20 20 28 3c 20 28 61 62 73 20 28 2d 20 28 73 71 75 61 72 65 20 67 75 65 73 73 29 20 78 29 29 20 | ..(<.(abs.(-.(square.guess).x)). |
| 93140 | 30 2e 30 30 31 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6d 70 72 6f 76 65 20 | 0.001))........(define.(improve. |
| 93160 | 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 28 61 76 65 72 61 67 65 20 67 75 65 73 73 20 28 | guess)..........(average.guess.( |
| 93180 | 2f 20 78 20 67 75 65 73 73 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 | /.x.guess)))........(define.(sqr |
| 931a0 | 74 2d 69 74 65 72 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 67 6f 6f 64 | t-iter.guess)..........(if.(good |
| 931c0 | 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 67 75 65 | -enough?.guess)..............gue |
| 931e0 | 73 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 28 69 6d 70 72 | ss..............(sqrt-iter.(impr |
| 93200 | 6f 76 65 20 67 75 65 73 73 29 29 29 29 0a 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 | ove.guess))))........(sqrt-iter. |
| 93220 | 31 2e 30 29 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 63 61 6e 20 75 73 65 20 74 68 65 20 65 6e 76 | 1.0)).....Now.we.can.use.the.env |
| 93240 | 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 20 74 6f 20 73 65 65 20 77 68 79 20 74 68 65 73 65 20 | ironment.model.to.see.why.these. |
| 93260 | 69 6e 74 65 72 6e 61 6c 0a 64 65 66 69 6e 69 74 69 6f 6e 73 20 62 65 68 61 76 65 20 61 73 20 64 | internal.definitions.behave.as.d |
| 93280 | 65 73 69 72 65 64 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 31 3a 3a 20 73 68 6f | esired...*Note.Figure.3-11::.sho |
| 932a0 | 77 73 20 74 68 65 20 70 6f 69 6e 74 20 69 6e 0a 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f | ws.the.point.in.the.evaluation.o |
| 932c0 | 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 73 71 72 74 20 32 29 27 20 77 68 65 72 | f.the.expression.`(sqrt.2)'.wher |
| 932e0 | 65 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 0a 70 72 6f 63 65 64 75 72 65 20 60 67 6f 6f 64 2d 65 | e.the.internal.procedure.`good-e |
| 93300 | 6e 6f 75 67 68 3f 27 20 68 61 73 20 62 65 65 6e 20 63 61 6c 6c 65 64 20 66 6f 72 20 74 68 65 20 | nough?'.has.been.called.for.the. |
| 93320 | 66 69 72 73 74 20 74 69 6d 65 20 77 69 74 68 0a 60 67 75 65 73 73 27 20 65 71 75 61 6c 20 74 6f | first.time.with.`guess'.equal.to |
| 93340 | 20 31 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 31 31 3a 2a 20 60 53 71 72 74 27 20 | .1........*Figure.3.11:*.`Sqrt'. |
| 93360 | 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 | procedure.with.internal.definiti |
| 93380 | 6f 6e 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d | ons.......................+----- |
| 933a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 933c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 67 6c 6f 62 61 6c 20 | -------------+...........global. |
| 933e0 | 2d 2d 3e 7c 20 73 71 72 74 3a 20 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -->|.sqrt:.--+.................. |
| 93400 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 | ......................|......... |
| 93420 | 20 20 65 6e 76 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 | ..env.......|.........|......... |
| 93440 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | ...............................| |
| 93460 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c | .....................+---------| |
| 93480 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 934a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --------+....................... |
| 934c0 | 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........V.......^............... |
| 934e0 | 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....^........................... |
| 93500 | 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .---.---....|................... |
| 93520 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 4f 20 | |................+----------+-O. |
| 93540 | 7c 20 4f 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d | |.O-+---+........+----------+--- |
| 93560 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 | ---------+................|..... |
| 93580 | 20 20 20 20 20 60 2d 2d 2d 5e 2d 2d 2d 27 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 78 3a 20 32 | .....`---^---'............|.x:.2 |
| 935a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..................|............. |
| 935c0 | 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 45 31 20 | ...V.........................E1. |
| 935e0 | 2d 2d 3e 7c 20 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 3a 20 2d 2b 20 20 20 20 20 20 7c 0a 20 20 20 | -->|.good-enough?:.-+......|.... |
| 93600 | 20 20 20 20 20 20 20 70 61 72 61 6d 65 74 65 72 73 3a 20 78 20 20 20 20 20 20 20 20 20 20 20 20 | .......parameters:.x............ |
| 93620 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 69 6d 70 72 6f 76 65 3a 20 2e 2e 2e 20 20 20 7c 20 20 | ............|.improve:.......|.. |
| 93640 | 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 62 6f 64 79 3a 20 28 64 65 66 69 6e 65 20 67 6f | ....|...........body:.(define.go |
| 93660 | 6f 64 2d 65 6e 6f 75 67 68 3f 20 2e 2e 2e 29 20 20 20 20 20 20 7c 20 73 71 72 74 2d 69 74 65 72 | od-enough?....)......|.sqrt-iter |
| 93680 | 3a 20 2e 2e 2e 20 7c 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | :.....|......|.................( |
| 936a0 | 64 65 66 69 6e 65 20 69 6d 70 72 6f 76 65 20 2e 2e 2e 29 20 20 20 20 20 20 20 20 20 20 20 2b 2d | define.improve....)...........+- |
| 936c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 | ---------------|------+......... |
| 936e0 | 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 71 72 74 2d 69 74 65 72 20 2e 2e 2e 29 20 20 | ........(define.sqrt-iter....).. |
| 93700 | 20 20 20 20 20 20 20 20 5e 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 5e 0a | ........^..^............|.....^. |
| 93720 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 31 2e 30 29 20 | ................(sqrt-iter.1.0). |
| 93740 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 | ................|..|............ |
| 93760 | 56 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | V.....|......................... |
| 93780 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2b 20 7c 20 20 20 20 | ..............+---------++.|.... |
| 937a0 | 20 20 20 20 2e 2d 2d 2d 2e 2d 2d 2d 2e 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....---.---..|................. |
| 937c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 45 32 20 2d 2d 3e 7c 20 67 75 65 73 73 3a 20 31 | ................E2.-->|.guess:.1 |
| 937e0 | 20 7c 20 7c 20 20 20 20 20 20 20 20 7c 20 4f 20 7c 20 4f 2d 2b 2d 2b 0a 20 20 20 20 20 20 20 20 | .|.|........|.O.|.O-+-+......... |
| 93800 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d | ..............................+- |
| 93820 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 7c 20 20 20 20 20 20 20 20 60 2d 7c 2d 5e 2d 2d 2d 27 0a 20 20 | ---------+.|........`-|-^---'... |
| 93840 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 | ..............................ca |
| 93860 | 6c 6c 20 74 6f 20 73 71 72 74 2d 69 74 65 72 20 20 7c 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | ll.to.sqrt-iter..|..........|... |
| 93880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 938a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 | .................|..........V... |
| 938c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 938e0 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2b 20 20 20 20 70 61 72 61 6d 65 74 65 72 | .......+---------++....parameter |
| 93900 | 73 3a 20 67 75 65 73 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | s:.guess........................ |
| 93920 | 20 20 20 20 20 20 20 20 20 20 20 20 45 33 20 2d 2d 3e 7c 20 67 75 65 73 73 3a 20 31 20 7c 20 20 | ............E3.-->|.guess:.1.|.. |
| 93940 | 20 20 62 6f 64 79 3a 20 28 3c 20 28 61 62 73 20 2e 2e 2e 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ..body:.(<.(abs....)............ |
| 93960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d | ..............................+- |
| 93980 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 29 0a 20 20 20 20 | ---------+................)..... |
| 939a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 | ...............................c |
| 939c0 | 61 6c 6c 20 74 6f 20 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 0a 0a 20 20 20 4f 62 73 65 72 76 65 20 | all.to.good-enough?.....Observe. |
| 939e0 | 74 68 65 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | the.structure.of.the.environment |
| 93a00 | 2e 20 20 60 53 71 72 74 27 20 69 73 20 61 20 73 79 6d 62 6f 6c 20 69 6e 20 74 68 65 0a 67 6c 6f | ...`Sqrt'.is.a.symbol.in.the.glo |
| 93a20 | 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 74 68 61 74 20 69 73 20 62 6f 75 6e 64 20 74 6f | bal.environment.that.is.bound.to |
| 93a40 | 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 77 68 6f 73 65 20 61 73 73 6f 63 69 | .a.procedure.object.whose.associ |
| 93a60 | 61 74 65 64 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 | ated.environment.is.the.global.e |
| 93a80 | 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 57 68 65 6e 20 60 73 71 72 74 27 20 77 61 73 20 63 61 6c | nvironment...When.`sqrt'.was.cal |
| 93aa0 | 6c 65 64 2c 20 61 20 6e 65 77 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 45 31 20 77 61 73 20 66 6f | led,.a.new.environment.E1.was.fo |
| 93ac0 | 72 6d 65 64 2c 20 73 75 62 6f 72 64 69 6e 61 74 65 20 74 6f 20 74 68 65 20 67 6c 6f 62 61 6c 20 | rmed,.subordinate.to.the.global. |
| 93ae0 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 69 6e 0a 77 68 69 63 68 20 74 68 65 20 70 61 72 61 6d 65 | environment,.in.which.the.parame |
| 93b00 | 74 65 72 20 60 78 27 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 32 2e 20 20 54 68 65 20 62 6f 64 79 | ter.`x'.is.bound.to.2...The.body |
| 93b20 | 20 6f 66 20 60 73 71 72 74 27 20 77 61 73 20 74 68 65 6e 0a 65 76 61 6c 75 61 74 65 64 20 69 6e | .of.`sqrt'.was.then.evaluated.in |
| 93b40 | 20 45 31 2e 20 20 53 69 6e 63 65 20 74 68 65 20 66 69 72 73 74 20 65 78 70 72 65 73 73 69 6f 6e | .E1...Since.the.first.expression |
| 93b60 | 20 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 20 60 73 71 72 74 27 20 69 73 0a 0a 20 20 20 20 20 | .in.the.body.of.`sqrt'.is....... |
| 93b80 | 28 64 65 66 69 6e 65 20 28 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 29 0a 20 20 20 | (define.(good-enough?.guess).... |
| 93ba0 | 20 20 20 20 28 3c 20 28 61 62 73 20 28 2d 20 28 73 71 75 61 72 65 20 67 75 65 73 73 29 20 78 29 | ....(<.(abs.(-.(square.guess).x) |
| 93bc0 | 29 20 30 2e 30 30 31 29 29 0a 0a 65 76 61 6c 75 61 74 69 6e 67 20 74 68 69 73 20 65 78 70 72 65 | ).0.001))..evaluating.this.expre |
| 93be0 | 73 73 69 6f 6e 20 64 65 66 69 6e 65 64 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 67 6f 6f | ssion.defined.the.procedure.`goo |
| 93c00 | 64 2d 65 6e 6f 75 67 68 3f 27 20 20 69 6e 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 45 | d-enough?'..in.the.environment.E |
| 93c20 | 31 2e 20 20 54 6f 20 62 65 20 6d 6f 72 65 20 70 72 65 63 69 73 65 2c 20 74 68 65 20 73 79 6d 62 | 1...To.be.more.precise,.the.symb |
| 93c40 | 6f 6c 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 77 61 73 20 61 64 64 65 64 0a 74 6f 20 74 | ol.`good-enough?'.was.added.to.t |
| 93c60 | 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 20 6f 66 20 45 31 2c 20 62 6f 75 6e 64 20 74 6f 20 61 | he.first.frame.of.E1,.bound.to.a |
| 93c80 | 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 77 68 6f 73 65 20 61 73 73 6f 63 69 61 74 | .procedure.object.whose.associat |
| 93ca0 | 65 64 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 45 31 2e 20 20 53 69 6d 69 6c 61 72 6c 79 | ed.environment.is.E1...Similarly |
| 93cc0 | 2c 20 60 69 6d 70 72 6f 76 65 27 20 61 6e 64 20 60 73 71 72 74 2d 69 74 65 72 27 20 77 65 72 65 | ,.`improve'.and.`sqrt-iter'.were |
| 93ce0 | 20 64 65 66 69 6e 65 64 0a 61 73 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 45 31 2e 20 20 46 | .defined.as.procedures.in.E1...F |
| 93d00 | 6f 72 20 63 6f 6e 63 69 73 65 6e 65 73 73 2c 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 | or.conciseness,.*Note.Figure.3-1 |
| 93d20 | 31 3a 3a 20 73 68 6f 77 73 20 6f 6e 6c 79 0a 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a | 1::.shows.only.the.procedure.obj |
| 93d40 | 65 63 74 20 66 6f 72 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 2e 0a 0a 20 20 20 41 66 74 65 | ect.for.`good-enough?'......Afte |
| 93d60 | 72 20 74 68 65 20 6c 6f 63 61 6c 20 70 72 6f 63 65 64 75 72 65 73 20 77 65 72 65 20 64 65 66 69 | r.the.local.procedures.were.defi |
| 93d80 | 6e 65 64 2c 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 73 71 72 74 2d 69 74 65 72 0a | ned,.the.expression.`(sqrt-iter. |
| 93da0 | 31 2e 30 29 27 20 77 61 73 20 65 76 61 6c 75 61 74 65 64 2c 20 73 74 69 6c 6c 20 69 6e 20 65 6e | 1.0)'.was.evaluated,.still.in.en |
| 93dc0 | 76 69 72 6f 6e 6d 65 6e 74 20 45 31 2e 20 20 53 6f 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 | vironment.E1...So.the.procedure. |
| 93de0 | 6f 62 6a 65 63 74 0a 62 6f 75 6e 64 20 74 6f 20 60 73 71 72 74 2d 69 74 65 72 27 20 69 6e 20 45 | object.bound.to.`sqrt-iter'.in.E |
| 93e00 | 31 20 77 61 73 20 63 61 6c 6c 65 64 20 77 69 74 68 20 31 20 61 73 20 61 6e 20 61 72 67 75 6d 65 | 1.was.called.with.1.as.an.argume |
| 93e20 | 6e 74 2e 20 20 54 68 69 73 0a 63 72 65 61 74 65 64 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | nt...This.created.an.environment |
| 93e40 | 20 45 32 20 69 6e 20 77 68 69 63 68 20 60 67 75 65 73 73 27 2c 20 74 68 65 20 70 61 72 61 6d 65 | .E2.in.which.`guess',.the.parame |
| 93e60 | 74 65 72 20 6f 66 0a 60 73 71 72 74 2d 69 74 65 72 27 2c 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 | ter.of.`sqrt-iter',.is.bound.to. |
| 93e80 | 31 2e 20 20 60 53 71 72 74 2d 69 74 65 72 27 20 69 6e 20 74 75 72 6e 20 63 61 6c 6c 65 64 20 60 | 1...`Sqrt-iter'.in.turn.called.` |
| 93ea0 | 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 0a 77 69 74 68 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 | good-enough?'.with.the.value.of. |
| 93ec0 | 60 67 75 65 73 73 27 20 28 66 72 6f 6d 20 45 32 29 20 61 73 20 74 68 65 20 61 72 67 75 6d 65 6e | `guess'.(from.E2).as.the.argumen |
| 93ee0 | 74 20 66 6f 72 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 2e 0a 54 68 69 73 20 73 65 74 20 75 | t.for.`good-enough?'..This.set.u |
| 93f00 | 70 20 61 6e 6f 74 68 65 72 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 45 33 2c 20 69 6e 20 77 68 | p.another.environment,.E3,.in.wh |
| 93f20 | 69 63 68 20 60 67 75 65 73 73 27 20 28 74 68 65 20 70 61 72 61 6d 65 74 65 72 20 6f 66 0a 60 67 | ich.`guess'.(the.parameter.of.`g |
| 93f40 | 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 29 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 31 2e 20 20 41 6c | ood-enough?').is.bound.to.1...Al |
| 93f60 | 74 68 6f 75 67 68 20 60 73 71 72 74 2d 69 74 65 72 27 20 61 6e 64 20 60 67 6f 6f 64 2d 65 6e 6f | though.`sqrt-iter'.and.`good-eno |
| 93f80 | 75 67 68 3f 27 0a 62 6f 74 68 20 68 61 76 65 20 61 20 70 61 72 61 6d 65 74 65 72 20 6e 61 6d 65 | ugh?'.both.have.a.parameter.name |
| 93fa0 | 64 20 60 67 75 65 73 73 27 2c 20 74 68 65 73 65 20 61 72 65 20 74 77 6f 20 64 69 73 74 69 6e 63 | d.`guess',.these.are.two.distinc |
| 93fc0 | 74 20 6c 6f 63 61 6c 0a 76 61 72 69 61 62 6c 65 73 20 6c 6f 63 61 74 65 64 20 69 6e 20 64 69 66 | t.local.variables.located.in.dif |
| 93fe0 | 66 65 72 65 6e 74 20 66 72 61 6d 65 73 2e 20 20 41 6c 73 6f 2c 20 45 32 20 61 6e 64 20 45 33 20 | ferent.frames...Also,.E2.and.E3. |
| 94000 | 62 6f 74 68 20 68 61 76 65 20 45 31 20 61 73 0a 74 68 65 69 72 20 65 6e 63 6c 6f 73 69 6e 67 20 | both.have.E1.as.their.enclosing. |
| 94020 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 60 73 71 72 74 2d 69 | environment,.because.the.`sqrt-i |
| 94040 | 74 65 72 27 20 61 6e 64 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 0a 70 72 6f 63 65 64 75 72 | ter'.and.`good-enough?'.procedur |
| 94060 | 65 73 20 62 6f 74 68 20 68 61 76 65 20 45 31 20 61 73 20 74 68 65 69 72 20 65 6e 76 69 72 6f 6e | es.both.have.E1.as.their.environ |
| 94080 | 6d 65 6e 74 20 70 61 72 74 2e 20 20 4f 6e 65 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 6f 66 0a 74 | ment.part...One.consequence.of.t |
| 940a0 | 68 69 73 20 69 73 20 74 68 61 74 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 78 27 20 74 68 61 74 20 | his.is.that.the.symbol.`x'.that. |
| 940c0 | 61 70 70 65 61 72 73 20 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 20 60 67 6f 6f 64 2d 65 6e 6f | appears.in.the.body.of.`good-eno |
| 940e0 | 75 67 68 3f 27 0a 77 69 6c 6c 20 72 65 66 65 72 65 6e 63 65 20 74 68 65 20 62 69 6e 64 69 6e 67 | ugh?'.will.reference.the.binding |
| 94100 | 20 6f 66 20 60 78 27 20 74 68 61 74 20 61 70 70 65 61 72 73 20 69 6e 20 45 31 2c 20 6e 61 6d 65 | .of.`x'.that.appears.in.E1,.name |
| 94120 | 6c 79 20 74 68 65 20 76 61 6c 75 65 0a 6f 66 20 60 78 27 20 77 69 74 68 20 77 68 69 63 68 20 74 | ly.the.value.of.`x'.with.which.t |
| 94140 | 68 65 20 6f 72 69 67 69 6e 61 6c 20 60 73 71 72 74 27 20 70 72 6f 63 65 64 75 72 65 20 77 61 73 | he.original.`sqrt'.procedure.was |
| 94160 | 20 63 61 6c 6c 65 64 2e 0a 0a 20 20 20 54 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 | .called......The.environment.mod |
| 94180 | 65 6c 20 74 68 75 73 20 65 78 70 6c 61 69 6e 73 20 74 68 65 20 74 77 6f 20 6b 65 79 20 70 72 6f | el.thus.explains.the.two.key.pro |
| 941a0 | 70 65 72 74 69 65 73 20 74 68 61 74 20 6d 61 6b 65 0a 6c 6f 63 61 6c 20 70 72 6f 63 65 64 75 72 | perties.that.make.local.procedur |
| 941c0 | 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 20 75 73 65 66 75 6c 20 74 65 63 68 6e 69 71 75 65 | e.definitions.a.useful.technique |
| 941e0 | 20 66 6f 72 20 6d 6f 64 75 6c 61 72 69 7a 69 6e 67 0a 70 72 6f 67 72 61 6d 73 3a 0a 0a 20 20 20 | .for.modularizing.programs:..... |
| 94200 | 2a 20 54 68 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 20 6c 6f 63 61 6c 20 70 72 6f 63 65 64 75 | *.The.names.of.the.local.procedu |
| 94220 | 72 65 73 20 64 6f 20 6e 6f 74 20 69 6e 74 65 72 66 65 72 65 20 77 69 74 68 20 6e 61 6d 65 73 0a | res.do.not.interfere.with.names. |
| 94240 | 20 20 20 20 20 65 78 74 65 72 6e 61 6c 20 74 6f 20 74 68 65 20 65 6e 63 6c 6f 73 69 6e 67 20 70 | .....external.to.the.enclosing.p |
| 94260 | 72 6f 63 65 64 75 72 65 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 6c 6f 63 61 6c 20 70 72 6f 63 | rocedure,.because.the.local.proc |
| 94280 | 65 64 75 72 65 0a 20 20 20 20 20 6e 61 6d 65 73 20 77 69 6c 6c 20 62 65 20 62 6f 75 6e 64 20 69 | edure......names.will.be.bound.i |
| 942a0 | 6e 20 74 68 65 20 66 72 61 6d 65 20 74 68 61 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 63 | n.the.frame.that.the.procedure.c |
| 942c0 | 72 65 61 74 65 73 20 77 68 65 6e 0a 20 20 20 20 20 69 74 20 69 73 20 72 75 6e 2c 20 72 61 74 68 | reates.when......it.is.run,.rath |
| 942e0 | 65 72 20 74 68 61 6e 20 62 65 69 6e 67 20 62 6f 75 6e 64 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 | er.than.being.bound.in.the.globa |
| 94300 | 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 20 20 20 2a 20 54 68 65 20 6c 6f 63 61 6c 20 70 | l.environment......*.The.local.p |
| 94320 | 72 6f 63 65 64 75 72 65 73 20 63 61 6e 20 61 63 63 65 73 73 20 74 68 65 20 61 72 67 75 6d 65 6e | rocedures.can.access.the.argumen |
| 94340 | 74 73 20 6f 66 20 74 68 65 20 65 6e 63 6c 6f 73 69 6e 67 0a 20 20 20 20 20 70 72 6f 63 65 64 75 | ts.of.the.enclosing......procedu |
| 94360 | 72 65 2c 20 73 69 6d 70 6c 79 20 62 79 20 75 73 69 6e 67 20 70 61 72 61 6d 65 74 65 72 20 6e 61 | re,.simply.by.using.parameter.na |
| 94380 | 6d 65 73 20 61 73 20 66 72 65 65 20 76 61 72 69 61 62 6c 65 73 2e 0a 20 20 20 20 20 54 68 69 73 | mes.as.free.variables.......This |
| 943a0 | 20 69 73 20 62 65 63 61 75 73 65 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 20 6c 6f 63 61 | .is.because.the.body.of.the.loca |
| 943c0 | 6c 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 61 6e 0a 20 | l.procedure.is.evaluated.in.an.. |
| 943e0 | 20 20 20 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 74 68 61 74 20 69 73 20 73 75 62 6f 72 64 69 6e | ....environment.that.is.subordin |
| 94400 | 61 74 65 20 74 6f 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e | ate.to.the.evaluation.environmen |
| 94420 | 74 20 66 6f 72 0a 20 20 20 20 20 74 68 65 20 65 6e 63 6c 6f 73 69 6e 67 20 70 72 6f 63 65 64 75 | t.for......the.enclosing.procedu |
| 94440 | 72 65 2e 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 31 31 3a 2a 20 49 6e 20 73 | re.........*Exercise.3.11:*.In.s |
| 94460 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 32 2d 33 3a 3a 20 77 65 20 73 61 77 20 68 6f 77 20 | ection.*Note.3-2-3::.we.saw.how. |
| 94480 | 74 68 65 0a 20 20 20 20 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 20 64 65 73 63 72 | the......environment.model.descr |
| 944a0 | 69 62 65 64 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 | ibed.the.behavior.of.procedures. |
| 944c0 | 77 69 74 68 20 6c 6f 63 61 6c 0a 20 20 20 20 20 73 74 61 74 65 2e 20 20 4e 6f 77 20 77 65 20 68 | with.local......state...Now.we.h |
| 944e0 | 61 76 65 20 73 65 65 6e 20 68 6f 77 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e | ave.seen.how.internal.definition |
| 94500 | 73 20 77 6f 72 6b 2e 20 20 41 20 74 79 70 69 63 61 6c 0a 20 20 20 20 20 6d 65 73 73 61 67 65 2d | s.work...A.typical......message- |
| 94520 | 70 61 73 73 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 63 6f 6e 74 61 69 6e 73 20 62 6f 74 68 20 | passing.procedure.contains.both. |
| 94540 | 6f 66 20 74 68 65 73 65 20 61 73 70 65 63 74 73 2e 0a 20 20 20 20 20 43 6f 6e 73 69 64 65 72 20 | of.these.aspects.......Consider. |
| 94560 | 74 68 65 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 73 65 | the.bank.account.procedure.of.se |
| 94580 | 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 | ction.*Note.3-1-1:::............ |
| 945a0 | 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e 63 65 29 0a 20 | (define.(make-account.balance).. |
| 945c0 | 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 77 69 74 68 64 72 61 77 20 61 6d 6f | ...........(define.(withdraw.amo |
| 945e0 | 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e | unt)...............(if.(>=.balan |
| 94600 | 63 65 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 | ce.amount)...................(be |
| 94620 | 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f | gin.(set!.balance.(-.balance.amo |
| 94640 | 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 | unt))..........................b |
| 94660 | 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 | alance)..................."Insuf |
| 94680 | 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 | ficient.funds")).............(de |
| 946a0 | 66 69 6e 65 20 28 64 65 70 6f 73 69 74 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 | fine.(deposit.amount)........... |
| 946c0 | 20 20 20 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2b 20 62 61 6c 61 6e 63 65 20 61 6d 6f | ....(set!.balance.(+.balance.amo |
| 946e0 | 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 | unt))...............balance).... |
| 94700 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 29 0a 20 20 | .........(define.(dispatch.m)... |
| 94720 | 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6d 20 27 77 69 74 68 64 | ............(cond.((eq?.m.'withd |
| 94740 | 72 61 77 29 20 77 69 74 68 64 72 61 77 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | raw).withdraw).................. |
| 94760 | 20 20 20 28 28 65 71 3f 20 6d 20 27 64 65 70 6f 73 69 74 29 20 64 65 70 6f 73 69 74 29 0a 20 20 | ...((eq?.m.'deposit).deposit)... |
| 94780 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 | ..................(else.(error." |
| 947a0 | 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 2d 2d 20 4d 41 4b 45 2d 41 43 43 4f 55 4e 54 22 | Unknown.request.--.MAKE-ACCOUNT" |
| 947c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 947e0 | 20 20 6d 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 0a 0a 20 | ..m)))).............dispatch)... |
| 94800 | 20 20 20 20 53 68 6f 77 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 | ....Show.the.environment.structu |
| 94820 | 72 65 20 67 65 6e 65 72 61 74 65 64 20 62 79 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 0a | re.generated.by.the.sequence.of. |
| 94840 | 20 20 20 20 20 69 6e 74 65 72 61 63 74 69 6f 6e 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | .....interactions............(de |
| 94860 | 66 69 6e 65 20 61 63 63 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 35 30 29 29 0a 0a 20 20 20 | fine.acc.(make-account.50))..... |
| 94880 | 20 20 20 20 20 20 20 28 28 61 63 63 20 27 64 65 70 6f 73 69 74 29 20 34 30 29 0a 20 20 20 20 20 | .......((acc.'deposit).40)...... |
| 948a0 | 20 20 20 20 20 39 30 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 61 63 63 20 27 77 69 74 68 64 72 | .....90............((acc.'withdr |
| 948c0 | 61 77 29 20 36 30 29 0a 20 20 20 20 20 20 20 20 20 20 33 30 0a 0a 20 20 20 20 20 57 68 65 72 65 | aw).60)...........30.......Where |
| 948e0 | 20 69 73 20 74 68 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 66 6f 72 20 60 61 63 63 27 20 6b 65 | .is.the.local.state.for.`acc'.ke |
| 94900 | 70 74 3f 20 20 53 75 70 70 6f 73 65 20 77 65 20 64 65 66 69 6e 65 20 61 6e 6f 74 68 65 72 0a 20 | pt?..Suppose.we.define.another.. |
| 94920 | 20 20 20 20 61 63 63 6f 75 6e 74 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 61 | ....account............(define.a |
| 94940 | 63 63 32 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 31 30 30 29 29 0a 0a 20 20 20 20 20 48 6f | cc2.(make-account.100)).......Ho |
| 94960 | 77 20 61 72 65 20 74 68 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 73 20 66 6f 72 20 74 68 65 20 74 | w.are.the.local.states.for.the.t |
| 94980 | 77 6f 20 61 63 63 6f 75 6e 74 73 20 6b 65 70 74 20 64 69 73 74 69 6e 63 74 3f 0a 20 20 20 20 20 | wo.accounts.kept.distinct?...... |
| 949a0 | 57 68 69 63 68 20 70 61 72 74 73 20 6f 66 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 | Which.parts.of.the.environment.s |
| 949c0 | 74 72 75 63 74 75 72 65 20 61 72 65 20 73 68 61 72 65 64 20 62 65 74 77 65 65 6e 20 60 61 63 63 | tructure.are.shared.between.`acc |
| 949e0 | 27 0a 20 20 20 20 20 61 6e 64 20 60 61 63 63 32 27 3f 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 | '......and.`acc2'?....File:.sicp |
| 94a00 | 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 33 2c 20 20 4e 65 78 74 3a 20 33 2d 34 2c 20 20 | .info,..Node:.3-3,..Next:.3-4,.. |
| 94a20 | 50 72 65 76 3a 20 33 2d 32 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 33 0a 0a 33 2e 33 20 4d | Prev:.3-2,..Up:.Chapter.3..3.3.M |
| 94a40 | 6f 64 65 6c 69 6e 67 20 77 69 74 68 20 4d 75 74 61 62 6c 65 20 44 61 74 61 0a 3d 3d 3d 3d 3d 3d | odeling.with.Mutable.Data.====== |
| 94a60 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 43 68 61 70 74 65 | ========================..Chapte |
| 94a80 | 72 20 32 20 64 65 61 6c 74 20 77 69 74 68 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 61 73 20 | r.2.dealt.with.compound.data.as. |
| 94aa0 | 61 20 6d 65 61 6e 73 20 66 6f 72 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 0a 63 6f 6d 70 75 74 61 | a.means.for.constructing.computa |
| 94ac0 | 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 20 74 68 61 74 20 68 61 76 65 20 73 65 76 65 72 61 6c | tional.objects.that.have.several |
| 94ae0 | 20 70 61 72 74 73 2c 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 6d 6f 64 65 6c 0a 72 65 61 6c 2d 77 | .parts,.in.order.to.model.real-w |
| 94b00 | 6f 72 6c 64 20 6f 62 6a 65 63 74 73 20 74 68 61 74 20 68 61 76 65 20 73 65 76 65 72 61 6c 20 61 | orld.objects.that.have.several.a |
| 94b20 | 73 70 65 63 74 73 2e 20 20 49 6e 20 74 68 61 74 20 63 68 61 70 74 65 72 20 77 65 0a 69 6e 74 72 | spects...In.that.chapter.we.intr |
| 94b40 | 6f 64 75 63 65 64 20 74 68 65 20 64 69 73 63 69 70 6c 69 6e 65 20 6f 66 20 64 61 74 61 20 61 62 | oduced.the.discipline.of.data.ab |
| 94b60 | 73 74 72 61 63 74 69 6f 6e 2c 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 77 68 69 63 68 20 64 61 | straction,.according.to.which.da |
| 94b80 | 74 61 0a 73 74 72 75 63 74 75 72 65 73 20 61 72 65 20 73 70 65 63 69 66 69 65 64 20 69 6e 20 74 | ta.structures.are.specified.in.t |
| 94ba0 | 65 72 6d 73 20 6f 66 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 2c 20 77 68 69 63 68 20 63 72 65 61 | erms.of.constructors,.which.crea |
| 94bc0 | 74 65 20 64 61 74 61 0a 6f 62 6a 65 63 74 73 2c 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 73 2c 20 | te.data.objects,.and.selectors,. |
| 94be0 | 77 68 69 63 68 20 61 63 63 65 73 73 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 63 6f 6d 70 6f 75 | which.access.the.parts.of.compou |
| 94c00 | 6e 64 20 64 61 74 61 0a 6f 62 6a 65 63 74 73 2e 20 20 42 75 74 20 77 65 20 6e 6f 77 20 6b 6e 6f | nd.data.objects...But.we.now.kno |
| 94c20 | 77 20 74 68 61 74 20 74 68 65 72 65 20 69 73 20 61 6e 6f 74 68 65 72 20 61 73 70 65 63 74 20 6f | w.that.there.is.another.aspect.o |
| 94c40 | 66 20 64 61 74 61 20 74 68 61 74 0a 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 32 3a 3a 20 64 69 | f.data.that.*Note.Chapter.2::.di |
| 94c60 | 64 20 6e 6f 74 20 61 64 64 72 65 73 73 2e 20 20 54 68 65 20 64 65 73 69 72 65 20 74 6f 20 6d 6f | d.not.address...The.desire.to.mo |
| 94c80 | 64 65 6c 20 73 79 73 74 65 6d 73 0a 63 6f 6d 70 6f 73 65 64 20 6f 66 20 6f 62 6a 65 63 74 73 20 | del.systems.composed.of.objects. |
| 94ca0 | 74 68 61 74 20 68 61 76 65 20 63 68 61 6e 67 69 6e 67 20 73 74 61 74 65 20 6c 65 61 64 73 20 75 | that.have.changing.state.leads.u |
| 94cc0 | 73 20 74 6f 20 74 68 65 20 6e 65 65 64 20 74 6f 0a 6d 6f 64 69 66 79 20 63 6f 6d 70 6f 75 6e 64 | s.to.the.need.to.modify.compound |
| 94ce0 | 20 64 61 74 61 20 6f 62 6a 65 63 74 73 2c 20 61 73 20 77 65 6c 6c 20 61 73 20 74 6f 20 63 6f 6e | .data.objects,.as.well.as.to.con |
| 94d00 | 73 74 72 75 63 74 20 61 6e 64 20 73 65 6c 65 63 74 20 66 72 6f 6d 0a 74 68 65 6d 2e 20 20 49 6e | struct.and.select.from.them...In |
| 94d20 | 20 6f 72 64 65 72 20 74 6f 20 6d 6f 64 65 6c 20 63 6f 6d 70 6f 75 6e 64 20 6f 62 6a 65 63 74 73 | .order.to.model.compound.objects |
| 94d40 | 20 77 69 74 68 20 63 68 61 6e 67 69 6e 67 20 73 74 61 74 65 2c 20 77 65 20 77 69 6c 6c 0a 64 65 | .with.changing.state,.we.will.de |
| 94d60 | 73 69 67 6e 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 73 20 74 6f 20 69 6e 63 6c 75 64 | sign.data.abstractions.to.includ |
| 94d80 | 65 2c 20 69 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 73 65 6c 65 63 74 6f 72 73 20 61 6e 64 0a | e,.in.addition.to.selectors.and. |
| 94da0 | 63 6f 6e 73 74 72 75 63 74 6f 72 73 2c 20 6f 70 65 72 61 74 69 6f 6e 73 20 63 61 6c 6c 65 64 20 | constructors,.operations.called. |
| 94dc0 | 22 6d 75 74 61 74 6f 72 73 22 2c 20 77 68 69 63 68 20 6d 6f 64 69 66 79 20 64 61 74 61 20 6f 62 | "mutators",.which.modify.data.ob |
| 94de0 | 6a 65 63 74 73 2e 0a 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 6d 6f 64 65 6c 69 6e 67 20 61 20 | jects..For.instance,.modeling.a. |
| 94e00 | 62 61 6e 6b 69 6e 67 20 73 79 73 74 65 6d 20 72 65 71 75 69 72 65 73 20 75 73 20 74 6f 20 63 68 | banking.system.requires.us.to.ch |
| 94e20 | 61 6e 67 65 20 61 63 63 6f 75 6e 74 0a 62 61 6c 61 6e 63 65 73 2e 20 20 54 68 75 73 2c 20 61 20 | ange.account.balances...Thus,.a. |
| 94e40 | 64 61 74 61 20 73 74 72 75 63 74 75 72 65 20 66 6f 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 | data.structure.for.representing. |
| 94e60 | 62 61 6e 6b 20 61 63 63 6f 75 6e 74 73 20 6d 69 67 68 74 0a 61 64 6d 69 74 20 61 6e 20 6f 70 65 | bank.accounts.might.admit.an.ope |
| 94e80 | 72 61 74 69 6f 6e 0a 0a 20 20 20 20 20 28 73 65 74 2d 62 61 6c 61 6e 63 65 21 20 3c 41 43 43 4f | ration.......(set-balance!.<ACCO |
| 94ea0 | 55 4e 54 3e 20 3c 4e 45 57 2d 56 41 4c 55 45 3e 29 0a 0a 74 68 61 74 20 63 68 61 6e 67 65 73 20 | UNT>.<NEW-VALUE>)..that.changes. |
| 94ec0 | 74 68 65 20 62 61 6c 61 6e 63 65 20 6f 66 20 74 68 65 20 64 65 73 69 67 6e 61 74 65 64 20 61 63 | the.balance.of.the.designated.ac |
| 94ee0 | 63 6f 75 6e 74 20 74 6f 20 74 68 65 20 64 65 73 69 67 6e 61 74 65 64 0a 6e 65 77 20 76 61 6c 75 | count.to.the.designated.new.valu |
| 94f00 | 65 2e 20 20 44 61 74 61 20 6f 62 6a 65 63 74 73 20 66 6f 72 20 77 68 69 63 68 20 6d 75 74 61 74 | e...Data.objects.for.which.mutat |
| 94f20 | 6f 72 73 20 61 72 65 20 64 65 66 69 6e 65 64 20 61 72 65 20 6b 6e 6f 77 6e 20 61 73 20 6f 62 6a | ors.are.defined.are.known.as.obj |
| 94f40 | 65 63 74 73 0a 22 6d 75 74 61 62 6c 65 20 64 61 74 61 20 6f 62 6a 65 63 74 73 22 2e 0a 0a 20 20 | ects."mutable.data.objects"..... |
| 94f60 | 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 32 3a 3a 20 69 6e 74 72 6f 64 75 63 65 64 20 70 61 | .*Note.Chapter.2::.introduced.pa |
| 94f80 | 69 72 73 20 61 73 20 61 20 67 65 6e 65 72 61 6c 2d 70 75 72 70 6f 73 65 20 22 67 6c 75 65 22 20 | irs.as.a.general-purpose."glue". |
| 94fa0 | 66 6f 72 0a 73 79 6e 74 68 65 73 69 7a 69 6e 67 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 2e 20 | for.synthesizing.compound.data.. |
| 94fc0 | 20 57 65 20 62 65 67 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 62 79 20 64 65 66 69 6e 69 | .We.begin.this.section.by.defini |
| 94fe0 | 6e 67 20 62 61 73 69 63 0a 6d 75 74 61 74 6f 72 73 20 66 6f 72 20 70 61 69 72 73 2c 20 73 6f 20 | ng.basic.mutators.for.pairs,.so. |
| 95000 | 74 68 61 74 20 70 61 69 72 73 20 63 61 6e 20 73 65 72 76 65 20 61 73 20 62 75 69 6c 64 69 6e 67 | that.pairs.can.serve.as.building |
| 95020 | 20 62 6c 6f 63 6b 73 20 66 6f 72 0a 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 6d 75 74 61 62 6c 65 | .blocks.for.constructing.mutable |
| 95040 | 20 64 61 74 61 20 6f 62 6a 65 63 74 73 2e 20 20 54 68 65 73 65 20 6d 75 74 61 74 6f 72 73 20 67 | .data.objects...These.mutators.g |
| 95060 | 72 65 61 74 6c 79 20 65 6e 68 61 6e 63 65 20 74 68 65 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f | reatly.enhance.the.representatio |
| 95080 | 6e 61 6c 20 70 6f 77 65 72 20 6f 66 20 70 61 69 72 73 2c 20 65 6e 61 62 6c 69 6e 67 20 75 73 20 | nal.power.of.pairs,.enabling.us. |
| 950a0 | 74 6f 20 62 75 69 6c 64 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 0a 6f 74 68 65 72 20 74 | to.build.data.structures.other.t |
| 950c0 | 68 61 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 73 20 61 6e 64 20 74 72 65 65 73 20 74 68 61 74 | han.the.sequences.and.trees.that |
| 950e0 | 20 77 65 20 77 6f 72 6b 65 64 20 77 69 74 68 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | .we.worked.with.in.section.*Note |
| 95100 | 0a 32 2d 32 3a 3a 2e 20 20 57 65 20 61 6c 73 6f 20 70 72 65 73 65 6e 74 20 73 6f 6d 65 20 65 78 | .2-2::...We.also.present.some.ex |
| 95120 | 61 6d 70 6c 65 73 20 6f 66 20 73 69 6d 75 6c 61 74 69 6f 6e 73 20 69 6e 20 77 68 69 63 68 20 63 | amples.of.simulations.in.which.c |
| 95140 | 6f 6d 70 6c 65 78 0a 73 79 73 74 65 6d 73 20 61 72 65 20 6d 6f 64 65 6c 65 64 20 61 73 20 63 6f | omplex.systems.are.modeled.as.co |
| 95160 | 6c 6c 65 63 74 69 6f 6e 73 20 6f 66 20 6f 62 6a 65 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 20 | llections.of.objects.with.local. |
| 95180 | 73 74 61 74 65 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 33 2d 33 2d 31 3a 3a 20 20 20 20 20 20 | state...*.Menu:..*.3-3-1::...... |
| 951a0 | 20 20 20 20 20 20 4d 75 74 61 62 6c 65 20 4c 69 73 74 20 53 74 72 75 63 74 75 72 65 0a 2a 20 33 | ......Mutable.List.Structure.*.3 |
| 951c0 | 2d 33 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 51 | -3-2::............Representing.Q |
| 951e0 | 75 65 75 65 73 0a 2a 20 33 2d 33 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 52 65 70 72 65 | ueues.*.3-3-3::............Repre |
| 95200 | 73 65 6e 74 69 6e 67 20 54 61 62 6c 65 73 0a 2a 20 33 2d 33 2d 34 3a 3a 20 20 20 20 20 20 20 20 | senting.Tables.*.3-3-4::........ |
| 95220 | 20 20 20 20 41 20 53 69 6d 75 6c 61 74 6f 72 20 66 6f 72 20 44 69 67 69 74 61 6c 20 43 69 72 63 | ....A.Simulator.for.Digital.Circ |
| 95240 | 75 69 74 73 0a 2a 20 33 2d 33 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 50 72 6f 70 61 67 | uits.*.3-3-5::............Propag |
| 95260 | 61 74 69 6f 6e 20 6f 66 20 43 6f 6e 73 74 72 61 69 6e 74 73 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 | ation.of.Constraints....File:.si |
| 95280 | 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 33 2d 31 2c 20 20 4e 65 78 74 3a 20 33 2d | cp.info,..Node:.3-3-1,..Next:.3- |
| 952a0 | 33 2d 32 2c 20 20 50 72 65 76 3a 20 33 2d 33 2c 20 20 55 70 3a 20 33 2d 33 0a 0a 33 2e 33 2e 31 | 3-2,..Prev:.3-3,..Up:.3-3..3.3.1 |
| 952c0 | 20 4d 75 74 61 62 6c 65 20 4c 69 73 74 20 53 74 72 75 63 74 75 72 65 0a 2d 2d 2d 2d 2d 2d 2d 2d | .Mutable.List.Structure.-------- |
| 952e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 62 61 73 69 63 20 | --------------------..The.basic. |
| 95300 | 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 70 61 69 72 73 2d 2d 60 63 6f 6e 73 27 2c 20 60 63 61 | operations.on.pairs--`cons',.`ca |
| 95320 | 72 27 2c 20 61 6e 64 20 60 63 64 72 27 2d 2d 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 0a 63 6f | r',.and.`cdr'--can.be.used.to.co |
| 95340 | 6e 73 74 72 75 63 74 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 20 61 6e 64 20 74 6f 20 73 65 | nstruct.list.structure.and.to.se |
| 95360 | 6c 65 63 74 20 70 61 72 74 73 20 66 72 6f 6d 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 2c 20 | lect.parts.from.list.structure,. |
| 95380 | 62 75 74 0a 74 68 65 79 20 61 72 65 20 69 6e 63 61 70 61 62 6c 65 20 6f 66 20 6d 6f 64 69 66 79 | but.they.are.incapable.of.modify |
| 953a0 | 69 6e 67 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 2e 20 20 54 68 65 20 73 61 6d 65 20 69 73 | ing.list.structure...The.same.is |
| 953c0 | 20 74 72 75 65 20 6f 66 20 74 68 65 0a 6c 69 73 74 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 65 20 | .true.of.the.list.operations.we. |
| 953e0 | 68 61 76 65 20 75 73 65 64 20 73 6f 20 66 61 72 2c 20 73 75 63 68 20 61 73 20 60 61 70 70 65 6e | have.used.so.far,.such.as.`appen |
| 95400 | 64 27 20 61 6e 64 20 60 6c 69 73 74 27 2c 20 73 69 6e 63 65 0a 74 68 65 73 65 20 63 61 6e 20 62 | d'.and.`list',.since.these.can.b |
| 95420 | 65 20 64 65 66 69 6e 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 60 63 6f 6e 73 27 2c 20 60 63 | e.defined.in.terms.of.`cons',.`c |
| 95440 | 61 72 27 2c 20 61 6e 64 20 60 63 64 72 27 2e 20 20 54 6f 20 6d 6f 64 69 66 79 0a 6c 69 73 74 20 | ar',.and.`cdr'...To.modify.list. |
| 95460 | 73 74 72 75 63 74 75 72 65 73 20 77 65 20 6e 65 65 64 20 6e 65 77 20 6f 70 65 72 61 74 69 6f 6e | structures.we.need.new.operation |
| 95480 | 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 31 32 3a 2a 20 4c 69 73 74 73 20 60 78 | s........*Figure.3.12:*.Lists.`x |
| 954a0 | 27 3a 20 60 28 28 61 20 62 29 20 63 20 64 29 27 20 61 6e 64 20 60 79 27 3a 20 60 28 65 20 66 29 | ':.`((a.b).c.d)'.and.`y':.`(e.f) |
| 954c0 | 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 | '..................+---+---+.... |
| 954e0 | 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 | .+---+---+.....+---+---+........ |
| 95500 | 20 20 20 78 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d | ...x.-->|.*.|.*-+---->|.*.|.*-+- |
| 95520 | 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c | --->|.*.|./.|................+-| |
| 95540 | 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d | -+---+.....+-|-+---+.....+-|-+-- |
| 95560 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 | -+..................|........... |
| 95580 | 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..V.............V............... |
| 955a0 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d | ...|...........+---+.........+-- |
| 955c0 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 | -+..................|........... |
| 955e0 | 7c 20 63 20 7c 20 20 20 20 20 20 20 20 20 7c 20 64 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 | |.c.|.........|.d.|............. |
| 95600 | 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b | .....|...........+---+.........+ |
| 95620 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 | ---+..................|......... |
| 95640 | 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 | ..+---+---+.....+---+---+....... |
| 95660 | 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b | ...........+---------->|.*.|.*-+ |
| 95680 | 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---->|.*.|./.|.................. |
| 956a0 | 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d | ............+-|-+---+.....+-|-+- |
| 956c0 | 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --+............................. |
| 956e0 | 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...V.............V.............. |
| 95700 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d | ................+---+.........+- |
| 95720 | 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --+............................. |
| 95740 | 20 7c 20 61 20 7c 20 20 20 20 20 20 20 20 20 7c 20 62 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | .|.a.|.........|.b.|............ |
| 95760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 | ..................+---+......... |
| 95780 | 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | +---+........................... |
| 957a0 | 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 | ...+---+---+.....+---+---+...... |
| 957c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d | ...................y.-->|.*.|.*- |
| 957e0 | 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | +---->|.*.|./.|................. |
| 95800 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b | .............+-|-+---+.....+-|-+ |
| 95820 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---+............................ |
| 95840 | 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ....V.............V............. |
| 95860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b | .................+---+.........+ |
| 95880 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---+............................ |
| 958a0 | 20 20 7c 20 65 20 7c 20 20 20 20 20 20 20 20 20 7c 20 66 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | ..|.e.|.........|.f.|........... |
| 958c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 | ...................+---+........ |
| 958e0 | 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 31 33 3a 2a 20 45 66 66 65 | .+---+.......*Figure.3.13:*.Effe |
| 95900 | 63 74 20 6f 66 20 60 28 73 65 74 2d 63 61 72 21 20 78 20 79 29 27 20 6f 6e 20 74 68 65 20 6c 69 | ct.of.`(set-car!.x.y)'.on.the.li |
| 95920 | 73 74 73 20 69 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 46 69 67 75 72 65 20 33 2d 31 32 3a 3a 2e | sts.in.*Note......Figure.3-12::. |
| 95940 | 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b | .................+---+---+.....+ |
| 95960 | 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 | ---+---+.....+---+---+.......... |
| 95980 | 20 78 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d | .x.-->|.*.|.*-+---->|.*.|.*-+--- |
| 959a0 | 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b | ->|.*.|./.|................+-|-+ |
| 959c0 | 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b | ---+.....+-|-+---+.....+-|-+---+ |
| 959e0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..................|............. |
| 95a00 | 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | V.............V................. |
| 95a20 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b | .|...........+---+.........+---+ |
| 95a40 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ..................|...........|. |
| 95a60 | 63 20 7c 20 20 20 20 20 20 20 20 20 7c 20 64 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | c.|.........|.d.|............... |
| 95a80 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d | ...|...........+---+.........+-- |
| 95aa0 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 | -+..................|........... |
| 95ac0 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 | +---+---+.....+---+---+......... |
| 95ae0 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d | .........|...........|.*.|.*-+-- |
| 95b00 | 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | -->|.*.|./.|..................|. |
| 95b20 | 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d | ..........+-|-+---+.....+-|-+--- |
| 95b40 | 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 | +..................|............ |
| 95b60 | 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .V.............V................ |
| 95b80 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | ..|...........+---+.........+--- |
| 95ba0 | 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 7c | +..................|...........| |
| 95bc0 | 20 61 20 7c 20 20 20 20 20 20 20 20 20 7c 20 62 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .a.|.........|.b.|.............. |
| 95be0 | 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d | ....|...........+---+.........+- |
| 95c00 | 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | --+..................+---------- |
| 95c20 | 3e 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 | >+---+---+.....+---+---+........ |
| 95c40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 2a 20 7c 20 2a 2d 2b 2d | ......................|.*.|.*-+- |
| 95c60 | 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --->|.*.|./.|................... |
| 95c80 | 20 20 20 20 20 20 79 20 2d 2d 3e 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d | ......y.-->+-|-+---+.....+-|-+-- |
| 95ca0 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -+.............................. |
| 95cc0 | 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..V.............V............... |
| 95ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d | ...............+---+.........+-- |
| 95d00 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -+.............................. |
| 95d20 | 7c 20 65 20 7c 20 20 20 20 20 20 20 20 20 7c 20 66 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 | |.e.|.........|.f.|............. |
| 95d40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 2b | .................+---+.........+ |
| 95d60 | 2d 2d 2d 2b 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 31 34 3a 2a 20 45 66 66 65 63 74 | ---+.......*Figure.3.14:*.Effect |
| 95d80 | 20 6f 66 20 60 28 64 65 66 69 6e 65 20 7a 20 28 63 6f 6e 73 20 79 20 28 63 64 72 20 78 29 29 29 | .of.`(define.z.(cons.y.(cdr.x))) |
| 95da0 | 27 20 6f 6e 20 74 68 65 0a 20 20 20 20 20 6c 69 73 74 73 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 | '.on.the......lists.in.*Note.Fig |
| 95dc0 | 75 72 65 20 33 2d 31 32 3a 3a 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | ure.3-12::..................+--- |
| 95de0 | 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d | +---+.....+---+---+.....+---+--- |
| 95e00 | 2b 0a 20 20 20 20 20 20 20 20 20 20 78 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c | +...........x.-->|.*.|.*-+---->| |
| 95e20 | 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 | .*.|.*-+---->|.*.|./.|.......... |
| 95e40 | 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 2b 2d 2d 3e 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 | ......+-|-+---+.+-->+-|-+---+... |
| 95e60 | 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ..+-|-+---+..................|.. |
| 95e80 | 20 20 20 20 20 7c 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 | .....|.....V.............V...... |
| 95ea0 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2b 20 20 20 | ............|.......|...+---+... |
| 95ec0 | 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ......+---+..................|.. |
| 95ee0 | 20 20 20 20 20 7c 20 20 20 7c 20 63 20 7c 20 20 20 20 20 20 20 20 20 7c 20 64 20 7c 0a 20 20 20 | .....|...|.c.|.........|.d.|.... |
| 95f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2b 20 | ..............|.......|...+---+. |
| 95f20 | 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | ........+---+..................| |
| 95f40 | 20 20 20 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d | .......|...+---+---+.....+---+-- |
| 95f60 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 3e | -+..................+-------+--> |
| 95f80 | 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 | |.*.|.*-+---->|.*.|./.|......... |
| 95fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 | .................|...+-|-+---+.. |
| 95fc0 | 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | ...+-|-+---+................+--- |
| 95fe0 | 2b 2d 2d 2d 2b 20 7c 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 | +---+.|.....V.............V..... |
| 96000 | 20 20 20 20 20 20 7a 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2b 20 20 20 2b 2d 2d 2d 2b 20 20 | ......z.-->|.*.|.*-+-+...+---+.. |
| 96020 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d | .......+---+................+-|- |
| 96040 | 2b 2d 2d 2d 2b 20 20 20 20 20 7c 20 61 20 7c 20 20 20 20 20 20 20 20 20 7c 20 62 20 7c 0a 20 20 | +---+.....|.a.|.........|.b.|... |
| 96060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b | ...............|...........+---+ |
| 96080 | 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .........+---+.................. |
| 960a0 | 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d | +---------->+---+---+.....+---+- |
| 960c0 | 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --+............................. |
| 960e0 | 20 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 | .|.*.|.*-+---->|.*.|./.|........ |
| 96100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 20 2d 2d 3e 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 | .................y.-->+-|-+---+. |
| 96120 | 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....+-|-+---+................... |
| 96140 | 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 | .............V.............V.... |
| 96160 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 | ..........................+---+. |
| 96180 | 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........+---+................... |
| 961a0 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 65 20 7c 20 20 20 20 20 20 20 20 20 7c 20 66 20 7c 0a 20 | ...........|.e.|.........|.f.|.. |
| 961c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | ............................+--- |
| 961e0 | 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e | +.........+---+.......*Figure.3. |
| 96200 | 31 35 3a 2a 20 45 66 66 65 63 74 20 6f 66 20 60 28 73 65 74 2d 63 64 72 21 20 78 20 79 29 27 20 | 15:*.Effect.of.`(set-cdr!.x.y)'. |
| 96220 | 6f 6e 20 74 68 65 20 6c 69 73 74 73 20 69 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 46 69 67 75 72 | on.the.lists.in.*Note......Figur |
| 96240 | 65 20 33 2d 31 32 3a 3a 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d | e.3-12::..................+---+- |
| 96260 | 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a | --+.....+---+---+.....+---+---+. |
| 96280 | 20 20 20 20 20 20 20 20 20 20 78 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 20 7c 20 20 20 20 20 7c 20 2a | ..........x.-->|.*.|.*.|.....|.* |
| 962a0 | 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | .|.*-+---->|.*.|./.|............ |
| 962c0 | 20 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 | ....+-|-+-|-+.....+-|-+---+..... |
| 962e0 | 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c | +-|-+---+..................|...| |
| 96300 | 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 | .........V.............V........ |
| 96320 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 | ..........|...|.......+---+..... |
| 96340 | 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c | ....+---+..................|...| |
| 96360 | 20 20 20 20 20 20 20 7c 20 63 20 7c 20 20 20 20 20 20 20 20 20 7c 20 64 20 7c 0a 20 20 20 20 20 | .......|.c.|.........|.d.|...... |
| 96380 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 | ............|...|.......+---+... |
| 963a0 | 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ......+---+..................|.. |
| 963c0 | 20 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b | .|.......+---+---+.....+---+---+ |
| 963e0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 3e 7c 20 | ..................+---+------>|. |
| 96400 | 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | *.|.*-+---->|.*.|./.|........... |
| 96420 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 | ...........|.......+-|-+---+.... |
| 96440 | 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .+-|-+---+...................... |
| 96460 | 7c 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 | |.........V.............V....... |
| 96480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 | ...............|.......+---+.... |
| 964a0 | 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....+---+...................... |
| 964c0 | 7c 20 20 20 20 20 20 20 7c 20 61 20 7c 20 20 20 20 20 20 20 20 20 7c 20 62 20 7c 0a 20 20 20 20 | |.......|.a.|.........|.b.|..... |
| 964e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 | .................|.......+---+.. |
| 96500 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......+---+.................... |
| 96520 | 20 20 2b 2d 2d 2d 2d 2d 2d 3e 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d | ..+------>+---+---+.....+---+--- |
| 96540 | 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | +..............................| |
| 96560 | 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 | .*.|.*-+---->|.*.|./.|.......... |
| 96580 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 20 2d 2d 3e 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 | ...............y.-->+-|-+---+... |
| 965a0 | 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..+-|-+---+..................... |
| 965c0 | 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 | ...........V.............V...... |
| 965e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 | ........................+---+... |
| 96600 | 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......+---+..................... |
| 96620 | 20 20 20 20 20 20 20 20 20 7c 20 65 20 7c 20 20 20 20 20 20 20 20 20 7c 20 66 20 7c 0a 20 20 20 | .........|.e.|.........|.f.|.... |
| 96640 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 | ..........................+---+. |
| 96660 | 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 54 68 65 20 70 72 69 6d 69 74 69 76 65 20 | ........+---+.....The.primitive. |
| 96680 | 6d 75 74 61 74 6f 72 73 20 66 6f 72 20 70 61 69 72 73 20 61 72 65 20 60 73 65 74 2d 63 61 72 21 | mutators.for.pairs.are.`set-car! |
| 966a0 | 27 20 61 6e 64 20 60 73 65 74 2d 63 64 72 21 27 2e 0a 60 53 65 74 2d 63 61 72 21 27 20 74 61 6b | '.and.`set-cdr!'..`Set-car!'.tak |
| 966c0 | 65 73 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 2c 20 74 68 65 20 66 69 72 73 74 20 6f 66 20 77 | es.two.arguments,.the.first.of.w |
| 966e0 | 68 69 63 68 20 6d 75 73 74 20 62 65 20 61 20 70 61 69 72 2e 20 20 49 74 0a 6d 6f 64 69 66 69 65 | hich.must.be.a.pair...It.modifie |
| 96700 | 73 20 74 68 69 73 20 70 61 69 72 2c 20 72 65 70 6c 61 63 69 6e 67 20 74 68 65 20 60 63 61 72 27 | s.this.pair,.replacing.the.`car' |
| 96720 | 20 70 6f 69 6e 74 65 72 20 62 79 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 0a 73 65 63 | .pointer.by.a.pointer.to.the.sec |
| 96740 | 6f 6e 64 20 61 72 67 75 6d 65 6e 74 20 6f 66 20 60 73 65 74 2d 63 61 72 21 27 2e 28 31 29 0a 0a | ond.argument.of.`set-car!'.(1).. |
| 96760 | 20 20 20 41 73 20 61 6e 20 65 78 61 6d 70 6c 65 2c 20 73 75 70 70 6f 73 65 20 74 68 61 74 20 60 | ...As.an.example,.suppose.that.` |
| 96780 | 78 27 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 6c 69 73 74 20 60 28 28 61 20 62 29 20 | x'.is.bound.to.the.list.`((a.b). |
| 967a0 | 63 20 64 29 27 0a 61 6e 64 20 60 79 27 20 74 6f 20 74 68 65 20 6c 69 73 74 20 60 28 65 20 66 29 | c.d)'.and.`y'.to.the.list.`(e.f) |
| 967c0 | 27 20 61 73 20 69 6c 6c 75 73 74 72 61 74 65 64 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 | '.as.illustrated.in.*Note.Figure |
| 967e0 | 20 33 2d 31 32 3a 3a 2e 0a 45 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 | .3-12::..Evaluating.the.expressi |
| 96800 | 6f 6e 20 60 20 28 73 65 74 2d 63 61 72 21 20 20 78 20 79 29 27 20 6d 6f 64 69 66 69 65 73 20 74 | on.`.(set-car!..x.y)'.modifies.t |
| 96820 | 68 65 20 70 61 69 72 20 74 6f 20 77 68 69 63 68 0a 60 78 27 20 69 73 20 62 6f 75 6e 64 2c 20 72 | he.pair.to.which.`x'.is.bound,.r |
| 96840 | 65 70 6c 61 63 69 6e 67 20 69 74 73 20 60 63 61 72 27 20 62 79 20 74 68 65 20 76 61 6c 75 65 20 | eplacing.its.`car'.by.the.value. |
| 96860 | 6f 66 20 60 79 27 2e 20 20 54 68 65 20 72 65 73 75 6c 74 20 6f 66 0a 74 68 65 20 6f 70 65 72 61 | of.`y'...The.result.of.the.opera |
| 96880 | 74 69 6f 6e 20 69 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d | tion.is.shown.in.*Note.Figure.3- |
| 968a0 | 31 33 3a 3a 2e 20 20 54 68 65 20 73 74 72 75 63 74 75 72 65 20 60 78 27 20 68 61 73 0a 62 65 65 | 13::...The.structure.`x'.has.bee |
| 968c0 | 6e 20 6d 6f 64 69 66 69 65 64 20 61 6e 64 20 77 6f 75 6c 64 20 6e 6f 77 20 62 65 20 70 72 69 6e | n.modified.and.would.now.be.prin |
| 968e0 | 74 65 64 20 61 73 20 60 28 28 65 20 66 29 20 63 20 64 29 27 2e 20 20 54 68 65 20 70 61 69 72 73 | ted.as.`((e.f).c.d)'...The.pairs |
| 96900 | 0a 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 65 20 6c 69 73 74 20 60 28 61 20 62 29 27 2c 20 | .representing.the.list.`(a.b)',. |
| 96920 | 69 64 65 6e 74 69 66 69 65 64 20 62 79 20 74 68 65 20 70 6f 69 6e 74 65 72 20 74 68 61 74 20 77 | identified.by.the.pointer.that.w |
| 96940 | 61 73 0a 72 65 70 6c 61 63 65 64 2c 20 61 72 65 20 6e 6f 77 20 64 65 74 61 63 68 65 64 20 66 72 | as.replaced,.are.now.detached.fr |
| 96960 | 6f 6d 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 73 74 72 75 63 74 75 72 65 2e 28 32 29 0a 0a 20 | om.the.original.structure.(2)... |
| 96980 | 20 20 43 6f 6d 70 61 72 65 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 33 3a 3a 20 77 69 | ..Compare.*Note.Figure.3-13::.wi |
| 969a0 | 74 68 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 34 3a 3a 2c 20 77 68 69 63 68 0a 69 6c | th.*Note.Figure.3-14::,.which.il |
| 969c0 | 6c 75 73 74 72 61 74 65 73 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 65 78 65 63 75 74 69 6e | lustrates.the.result.of.executin |
| 969e0 | 67 20 60 28 64 65 66 69 6e 65 20 7a 20 28 63 6f 6e 73 20 79 20 28 63 64 72 20 78 29 29 29 27 20 | g.`(define.z.(cons.y.(cdr.x)))'. |
| 96a00 | 77 69 74 68 0a 60 78 27 20 61 6e 64 20 60 79 27 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 6f 72 | with.`x'.and.`y'.bound.to.the.or |
| 96a20 | 69 67 69 6e 61 6c 20 6c 69 73 74 73 20 6f 66 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 | iginal.lists.of.*Note.Figure.3-1 |
| 96a40 | 32 3a 3a 2e 20 20 54 68 65 0a 76 61 72 69 61 62 6c 65 20 60 7a 27 20 69 73 20 6e 6f 77 20 62 6f | 2::...The.variable.`z'.is.now.bo |
| 96a60 | 75 6e 64 20 74 6f 20 61 20 6e 65 77 20 70 61 69 72 20 63 72 65 61 74 65 64 20 62 79 20 74 68 65 | und.to.a.new.pair.created.by.the |
| 96a80 | 20 60 63 6f 6e 73 27 0a 6f 70 65 72 61 74 69 6f 6e 3b 20 74 68 65 20 6c 69 73 74 20 74 6f 20 77 | .`cons'.operation;.the.list.to.w |
| 96aa0 | 68 69 63 68 20 60 78 27 20 69 73 20 62 6f 75 6e 64 20 69 73 20 75 6e 63 68 61 6e 67 65 64 2e 0a | hich.`x'.is.bound.is.unchanged.. |
| 96ac0 | 0a 20 20 20 54 68 65 20 60 73 65 74 2d 63 64 72 21 27 20 6f 70 65 72 61 74 69 6f 6e 20 69 73 20 | ....The.`set-cdr!'.operation.is. |
| 96ae0 | 73 69 6d 69 6c 61 72 20 74 6f 20 60 73 65 74 2d 63 61 72 21 27 2e 20 20 54 68 65 20 6f 6e 6c 79 | similar.to.`set-car!'...The.only |
| 96b00 | 0a 64 69 66 66 65 72 65 6e 63 65 20 69 73 20 74 68 61 74 20 74 68 65 20 60 63 64 72 27 20 70 6f | .difference.is.that.the.`cdr'.po |
| 96b20 | 69 6e 74 65 72 20 6f 66 20 74 68 65 20 70 61 69 72 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 | inter.of.the.pair,.rather.than.t |
| 96b40 | 68 65 20 60 63 61 72 27 0a 70 6f 69 6e 74 65 72 2c 20 69 73 20 72 65 70 6c 61 63 65 64 2e 20 20 | he.`car'.pointer,.is.replaced... |
| 96b60 | 54 68 65 20 65 66 66 65 63 74 20 6f 66 20 65 78 65 63 75 74 69 6e 67 20 60 28 73 65 74 2d 63 64 | The.effect.of.executing.`(set-cd |
| 96b80 | 72 21 20 78 20 79 29 27 20 6f 6e 20 74 68 65 0a 6c 69 73 74 73 20 6f 66 20 2a 4e 6f 74 65 20 46 | r!.x.y)'.on.the.lists.of.*Note.F |
| 96ba0 | 69 67 75 72 65 20 33 2d 31 32 3a 3a 20 69 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 | igure.3-12::.is.shown.in.*Note.F |
| 96bc0 | 69 67 75 72 65 20 33 2d 31 35 3a 3a 2e 20 20 48 65 72 65 20 74 68 65 0a 60 63 64 72 27 20 70 6f | igure.3-15::...Here.the.`cdr'.po |
| 96be0 | 69 6e 74 65 72 20 6f 66 20 60 78 27 20 68 61 73 20 62 65 65 6e 20 72 65 70 6c 61 63 65 64 20 62 | inter.of.`x'.has.been.replaced.b |
| 96c00 | 79 20 74 68 65 20 70 6f 69 6e 74 65 72 20 74 6f 20 60 28 65 20 66 29 27 2e 0a 41 6c 73 6f 2c 20 | y.the.pointer.to.`(e.f)'..Also,. |
| 96c20 | 74 68 65 20 6c 69 73 74 20 60 28 63 20 64 29 27 2c 20 77 68 69 63 68 20 75 73 65 64 20 74 6f 20 | the.list.`(c.d)',.which.used.to. |
| 96c40 | 62 65 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 60 78 27 2c 20 69 73 20 6e 6f 77 0a 64 65 74 61 | be.the.`cdr'.of.`x',.is.now.deta |
| 96c60 | 63 68 65 64 20 66 72 6f 6d 20 74 68 65 20 73 74 72 75 63 74 75 72 65 2e 0a 0a 20 20 20 60 43 6f | ched.from.the.structure......`Co |
| 96c80 | 6e 73 27 20 62 75 69 6c 64 73 20 6e 65 77 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 20 62 79 | ns'.builds.new.list.structure.by |
| 96ca0 | 20 63 72 65 61 74 69 6e 67 20 6e 65 77 20 70 61 69 72 73 2c 20 77 68 69 6c 65 0a 60 73 65 74 2d | .creating.new.pairs,.while.`set- |
| 96cc0 | 63 61 72 21 27 20 61 6e 64 20 60 73 65 74 2d 63 64 72 21 27 20 6d 6f 64 69 66 79 20 65 78 69 73 | car!'.and.`set-cdr!'.modify.exis |
| 96ce0 | 74 69 6e 67 20 70 61 69 72 73 2e 20 20 49 6e 64 65 65 64 2c 20 77 65 20 63 6f 75 6c 64 0a 69 6d | ting.pairs...Indeed,.we.could.im |
| 96d00 | 70 6c 65 6d 65 6e 74 20 60 63 6f 6e 73 27 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 74 | plement.`cons'.in.terms.of.the.t |
| 96d20 | 77 6f 20 6d 75 74 61 74 6f 72 73 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 20 70 72 6f | wo.mutators,.together.with.a.pro |
| 96d40 | 63 65 64 75 72 65 0a 60 67 65 74 2d 6e 65 77 2d 70 61 69 72 27 2c 20 77 68 69 63 68 20 72 65 74 | cedure.`get-new-pair',.which.ret |
| 96d60 | 75 72 6e 73 20 61 20 6e 65 77 20 70 61 69 72 20 74 68 61 74 20 69 73 20 6e 6f 74 20 70 61 72 74 | urns.a.new.pair.that.is.not.part |
| 96d80 | 20 6f 66 20 61 6e 79 0a 65 78 69 73 74 69 6e 67 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 2e | .of.any.existing.list.structure. |
| 96da0 | 20 20 57 65 20 6f 62 74 61 69 6e 20 74 68 65 20 6e 65 77 20 70 61 69 72 2c 20 73 65 74 20 69 74 | ..We.obtain.the.new.pair,.set.it |
| 96dc0 | 73 20 60 63 61 72 27 20 61 6e 64 0a 60 63 64 72 27 20 70 6f 69 6e 74 65 72 73 20 74 6f 20 74 68 | s.`car'.and.`cdr'.pointers.to.th |
| 96de0 | 65 20 64 65 73 69 67 6e 61 74 65 64 20 6f 62 6a 65 63 74 73 2c 20 61 6e 64 20 72 65 74 75 72 6e | e.designated.objects,.and.return |
| 96e00 | 20 74 68 65 20 6e 65 77 20 70 61 69 72 20 61 73 0a 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 74 | .the.new.pair.as.the.result.of.t |
| 96e20 | 68 65 20 60 63 6f 6e 73 27 2e 28 33 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e | he.`cons'.(3).......(define.(con |
| 96e40 | 73 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 20 28 67 65 74 2d 6e 65 | s.x.y)........(let.((new.(get-ne |
| 96e60 | 77 2d 70 61 69 72 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 61 72 21 20 6e 65 77 | w-pair)))..........(set-car!.new |
| 96e80 | 20 78 29 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 20 6e 65 77 20 79 29 0a 20 20 | .x)..........(set-cdr!.new.y)... |
| 96ea0 | 20 20 20 20 20 20 20 6e 65 77 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 31 | .......new)).......*Exercise.3.1 |
| 96ec0 | 32 3a 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 | 2:*.The.following.procedure.for. |
| 96ee0 | 61 70 70 65 6e 64 69 6e 67 20 6c 69 73 74 73 20 77 61 73 0a 20 20 20 20 20 69 6e 74 72 6f 64 75 | appending.lists.was......introdu |
| 96f00 | 63 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 31 3a 3a 3a 0a 0a 20 | ced.in.section.*Note.2-2-1:::... |
| 96f20 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 70 65 6e 64 20 78 20 79 29 0a 20 20 | .........(define.(append.x.y)... |
| 96f40 | 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 78 29 0a 20 20 20 20 20 20 20 20 | ..........(if.(null?.x)......... |
| 96f60 | 20 20 20 20 20 20 20 20 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 | ........y.................(cons. |
| 96f80 | 28 63 61 72 20 78 29 20 28 61 70 70 65 6e 64 20 28 63 64 72 20 78 29 20 79 29 29 29 29 0a 0a 20 | (car.x).(append.(cdr.x).y))))... |
| 96fa0 | 20 20 20 20 60 41 70 70 65 6e 64 27 20 66 6f 72 6d 73 20 61 20 6e 65 77 20 6c 69 73 74 20 62 79 | ....`Append'.forms.a.new.list.by |
| 96fc0 | 20 73 75 63 63 65 73 73 69 76 65 6c 79 20 60 63 6f 6e 73 27 69 6e 67 20 74 68 65 20 65 6c 65 6d | .successively.`cons'ing.the.elem |
| 96fe0 | 65 6e 74 73 20 6f 66 0a 20 20 20 20 20 60 78 27 20 6f 6e 74 6f 20 60 79 27 2e 20 20 54 68 65 20 | ents.of......`x'.onto.`y'...The. |
| 97000 | 70 72 6f 63 65 64 75 72 65 20 60 61 70 70 65 6e 64 21 27 20 69 73 20 73 69 6d 69 6c 61 72 20 74 | procedure.`append!'.is.similar.t |
| 97020 | 6f 20 60 61 70 70 65 6e 64 27 2c 20 62 75 74 0a 20 20 20 20 20 69 74 20 69 73 20 61 20 6d 75 74 | o.`append',.but......it.is.a.mut |
| 97040 | 61 74 6f 72 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 2e 20 | ator.rather.than.a.constructor.. |
| 97060 | 20 49 74 20 61 70 70 65 6e 64 73 20 74 68 65 20 6c 69 73 74 73 0a 20 20 20 20 20 62 79 20 73 70 | .It.appends.the.lists......by.sp |
| 97080 | 6c 69 63 69 6e 67 20 74 68 65 6d 20 74 6f 67 65 74 68 65 72 2c 20 6d 6f 64 69 66 79 69 6e 67 20 | licing.them.together,.modifying. |
| 970a0 | 74 68 65 20 66 69 6e 61 6c 20 70 61 69 72 20 6f 66 20 60 78 27 20 73 6f 20 74 68 61 74 0a 20 20 | the.final.pair.of.`x'.so.that... |
| 970c0 | 20 20 20 69 74 73 20 60 63 64 72 27 20 69 73 20 6e 6f 77 20 60 79 27 2e 20 20 28 49 74 20 69 73 | ...its.`cdr'.is.now.`y'...(It.is |
| 970e0 | 20 61 6e 20 65 72 72 6f 72 20 74 6f 20 63 61 6c 6c 20 60 61 70 70 65 6e 64 21 27 20 77 69 74 68 | .an.error.to.call.`append!'.with |
| 97100 | 20 61 6e 0a 20 20 20 20 20 65 6d 70 74 79 20 60 78 27 2e 29 0a 0a 20 20 20 20 20 20 20 20 20 20 | .an......empty.`x'.)............ |
| 97120 | 28 64 65 66 69 6e 65 20 28 61 70 70 65 6e 64 21 20 78 20 79 29 0a 20 20 20 20 20 20 20 20 20 20 | (define.(append!.x.y)........... |
| 97140 | 20 20 28 73 65 74 2d 63 64 72 21 20 28 6c 61 73 74 2d 70 61 69 72 20 78 29 20 79 29 0a 20 20 20 | ..(set-cdr!.(last-pair.x).y).... |
| 97160 | 20 20 20 20 20 20 20 20 20 78 29 0a 0a 20 20 20 20 20 48 65 72 65 20 60 6c 61 73 74 2d 70 61 69 | .........x).......Here.`last-pai |
| 97180 | 72 27 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 74 | r'.is.a.procedure.that.returns.t |
| 971a0 | 68 65 20 6c 61 73 74 20 70 61 69 72 20 69 6e 20 69 74 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e | he.last.pair.in.its......argumen |
| 971c0 | 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 61 73 74 2d 70 61 69 72 | t:............(define.(last-pair |
| 971e0 | 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 63 64 72 20 | .x).............(if.(null?.(cdr. |
| 97200 | 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 0a 20 20 20 20 20 20 20 20 20 20 | x)).................x........... |
| 97220 | 20 20 20 20 20 20 28 6c 61 73 74 2d 70 61 69 72 20 28 63 64 72 20 78 29 29 29 29 0a 0a 20 20 20 | ......(last-pair.(cdr.x))))..... |
| 97240 | 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 69 6e 74 65 72 61 63 74 69 6f 6e 0a 0a 20 20 20 20 | ..Consider.the.interaction...... |
| 97260 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 28 6c 69 73 74 20 27 61 20 27 62 29 29 0a 0a 20 | ......(define.x.(list.'a.'b))... |
| 97280 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 79 20 28 6c 69 73 74 20 27 63 20 27 64 29 29 | .........(define.y.(list.'c.'d)) |
| 972a0 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 7a 20 28 61 70 70 65 6e 64 20 78 20 | ............(define.z.(append.x. |
| 972c0 | 79 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 7a 0a 20 20 20 20 20 20 20 20 20 20 28 61 20 62 20 | y))............z...........(a.b. |
| 972e0 | 63 20 64 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 78 29 0a 20 20 20 20 20 20 20 20 | c.d)............(cdr.x)......... |
| 97300 | 20 20 3c 52 45 53 50 4f 4e 53 45 3e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ..<RESPONSE>............(define. |
| 97320 | 77 20 28 61 70 70 65 6e 64 21 20 78 20 79 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 77 0a 20 20 | w.(append!.x.y))............w... |
| 97340 | 20 20 20 20 20 20 20 20 28 61 20 62 20 63 20 64 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 64 | ........(a.b.c.d)............(cd |
| 97360 | 72 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 3c 52 45 53 50 4f 4e 53 45 3e 0a 0a 20 20 20 20 20 | r.x)...........<RESPONSE>....... |
| 97380 | 57 68 61 74 20 61 72 65 20 74 68 65 20 6d 69 73 73 69 6e 67 20 3c 52 45 53 50 4f 4e 53 45 3e 73 | What.are.the.missing.<RESPONSE>s |
| 973a0 | 3f 20 20 44 72 61 77 20 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 20 64 69 61 67 72 61 6d 73 | ?..Draw.box-and-pointer.diagrams |
| 973c0 | 20 74 6f 0a 20 20 20 20 20 65 78 70 6c 61 69 6e 20 79 6f 75 72 20 61 6e 73 77 65 72 2e 0a 0a 20 | .to......explain.your.answer.... |
| 973e0 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 31 33 3a 2a 20 43 6f 6e 73 69 64 65 72 20 74 68 | ....*Exercise.3.13:*.Consider.th |
| 97400 | 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 60 6d 61 6b 65 2d 63 79 63 6c 65 27 20 70 72 6f 63 65 64 75 | e.following.`make-cycle'.procedu |
| 97420 | 72 65 2c 0a 20 20 20 20 20 77 68 69 63 68 20 75 73 65 73 20 74 68 65 20 60 6c 61 73 74 2d 70 61 | re,......which.uses.the.`last-pa |
| 97440 | 69 72 27 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 | ir'.procedure.defined.in.*Note.E |
| 97460 | 78 65 72 63 69 73 65 0a 20 20 20 20 20 33 2d 31 32 3a 3a 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 | xercise......3-12:::............ |
| 97480 | 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 63 79 63 6c 65 20 78 29 0a 20 20 20 20 20 20 20 20 20 | (define.(make-cycle.x).......... |
| 974a0 | 20 20 20 28 73 65 74 2d 63 64 72 21 20 28 6c 61 73 74 2d 70 61 69 72 20 78 29 20 78 29 0a 20 20 | ...(set-cdr!.(last-pair.x).x)... |
| 974c0 | 20 20 20 20 20 20 20 20 20 20 78 29 0a 0a 20 20 20 20 20 44 72 61 77 20 61 20 62 6f 78 2d 61 6e | ..........x).......Draw.a.box-an |
| 974e0 | 64 2d 70 6f 69 6e 74 65 72 20 64 69 61 67 72 61 6d 20 74 68 61 74 20 73 68 6f 77 73 20 74 68 65 | d-pointer.diagram.that.shows.the |
| 97500 | 20 73 74 72 75 63 74 75 72 65 20 60 7a 27 0a 20 20 20 20 20 63 72 65 61 74 65 64 20 62 79 0a 0a | .structure.`z'......created.by.. |
| 97520 | 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 7a 20 28 6d 61 6b 65 2d 63 79 63 6c 65 20 | ..........(define.z.(make-cycle. |
| 97540 | 28 6c 69 73 74 20 27 61 20 27 62 20 27 63 29 29 29 0a 0a 20 20 20 20 20 57 68 61 74 20 68 61 70 | (list.'a.'b.'c))).......What.hap |
| 97560 | 70 65 6e 73 20 69 66 20 77 65 20 74 72 79 20 74 6f 20 63 6f 6d 70 75 74 65 20 60 28 6c 61 73 74 | pens.if.we.try.to.compute.`(last |
| 97580 | 2d 70 61 69 72 20 7a 29 27 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 31 34 3a | -pair.z)'?.......*Exercise.3.14: |
| 975a0 | 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 71 75 69 | *.The.following.procedure.is.qui |
| 975c0 | 74 65 20 75 73 65 66 75 6c 2c 20 61 6c 74 68 6f 75 67 68 0a 20 20 20 20 20 6f 62 73 63 75 72 65 | te.useful,.although......obscure |
| 975e0 | 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 79 73 74 65 72 79 20 78 29 | :............(define.(mystery.x) |
| 97600 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 70 20 78 20 79 29 0a | .............(define.(loop.x.y). |
| 97620 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 78 29 0a 20 20 20 20 | ..............(if.(null?.x)..... |
| 97640 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............y................. |
| 97660 | 20 20 28 6c 65 74 20 28 28 74 65 6d 70 20 28 63 64 72 20 78 29 29 29 0a 20 20 20 20 20 20 20 20 | ..(let.((temp.(cdr.x)))......... |
| 97680 | 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 20 78 20 79 29 0a 20 20 20 20 20 | ............(set-cdr!.x.y)...... |
| 976a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 74 65 6d 70 20 78 29 29 29 29 0a | ...............(loop.temp.x)))). |
| 976c0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 78 20 27 28 29 29 29 0a 0a 20 20 20 20 20 | ............(loop.x.'()))....... |
| 976e0 | 60 4c 6f 6f 70 27 20 75 73 65 73 20 74 68 65 20 22 74 65 6d 70 6f 72 61 72 79 22 20 76 61 72 69 | `Loop'.uses.the."temporary".vari |
| 97700 | 61 62 6c 65 20 60 74 65 6d 70 27 20 74 6f 20 68 6f 6c 64 20 74 68 65 20 6f 6c 64 20 76 61 6c 75 | able.`temp'.to.hold.the.old.valu |
| 97720 | 65 0a 20 20 20 20 20 6f 66 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 60 78 27 2c 20 73 69 6e 63 | e......of.the.`cdr'.of.`x',.sinc |
| 97740 | 65 20 74 68 65 20 60 73 65 74 2d 63 64 72 21 27 20 20 6f 6e 20 74 68 65 20 6e 65 78 74 20 6c 69 | e.the.`set-cdr!'..on.the.next.li |
| 97760 | 6e 65 0a 20 20 20 20 20 64 65 73 74 72 6f 79 73 20 74 68 65 20 60 63 64 72 27 2e 20 20 45 78 70 | ne......destroys.the.`cdr'...Exp |
| 97780 | 6c 61 69 6e 20 77 68 61 74 20 60 6d 79 73 74 65 72 79 27 20 64 6f 65 73 20 69 6e 20 67 65 6e 65 | lain.what.`mystery'.does.in.gene |
| 977a0 | 72 61 6c 2e 0a 20 20 20 20 20 53 75 70 70 6f 73 65 20 60 76 27 20 69 73 20 64 65 66 69 6e 65 64 | ral.......Suppose.`v'.is.defined |
| 977c0 | 20 62 79 20 60 28 64 65 66 69 6e 65 20 76 20 28 6c 69 73 74 20 27 61 20 27 62 20 27 63 20 27 64 | .by.`(define.v.(list.'a.'b.'c.'d |
| 977e0 | 29 29 27 2e 20 44 72 61 77 20 74 68 65 0a 20 20 20 20 20 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 | ))'..Draw.the......box-and-point |
| 97800 | 65 72 20 64 69 61 67 72 61 6d 20 74 68 61 74 20 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 20 6c | er.diagram.that.represents.the.l |
| 97820 | 69 73 74 20 74 6f 20 77 68 69 63 68 20 60 76 27 20 69 73 0a 20 20 20 20 20 62 6f 75 6e 64 2e 20 | ist.to.which.`v'.is......bound.. |
| 97840 | 20 53 75 70 70 6f 73 65 20 74 68 61 74 20 77 65 20 6e 6f 77 20 65 76 61 6c 75 61 74 65 20 60 28 | .Suppose.that.we.now.evaluate.`( |
| 97860 | 64 65 66 69 6e 65 20 77 20 28 6d 79 73 74 65 72 79 20 76 29 29 27 2e 20 44 72 61 77 0a 20 20 20 | define.w.(mystery.v))'..Draw.... |
| 97880 | 20 20 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 20 64 69 61 67 72 61 6d 73 20 74 68 61 74 20 | ..box-and-pointer.diagrams.that. |
| 978a0 | 73 68 6f 77 20 74 68 65 20 73 74 72 75 63 74 75 72 65 73 20 60 76 27 20 61 6e 64 20 60 77 27 20 | show.the.structures.`v'.and.`w'. |
| 978c0 | 61 66 74 65 72 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 69 73 20 65 78 70 72 65 | after......evaluating.this.expre |
| 978e0 | 73 73 69 6f 6e 2e 20 20 57 68 61 74 20 77 6f 75 6c 64 20 62 65 20 70 72 69 6e 74 65 64 20 61 73 | ssion...What.would.be.printed.as |
| 97900 | 20 74 68 65 20 76 61 6c 75 65 73 0a 20 20 20 20 20 6f 66 20 60 76 27 20 61 6e 64 20 60 77 27 3f | .the.values......of.`v'.and.`w'? |
| 97920 | 0a 0a 53 68 61 72 69 6e 67 20 61 6e 64 20 69 64 65 6e 74 69 74 79 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e | ..Sharing.and.identity.......... |
| 97940 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 20 6d 65 6e 74 69 6f 6e 65 64 20 69 6e 20 73 65 63 | .............We.mentioned.in.sec |
| 97960 | 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 33 3a 3a 20 74 68 65 20 74 68 65 6f 72 65 74 69 63 | tion.*Note.3-1-3::.the.theoretic |
| 97980 | 61 6c 20 69 73 73 75 65 73 20 6f 66 0a 22 73 61 6d 65 6e 65 73 73 22 20 61 6e 64 20 22 63 68 61 | al.issues.of."sameness".and."cha |
| 979a0 | 6e 67 65 22 20 72 61 69 73 65 64 20 62 79 20 74 68 65 20 69 6e 74 72 6f 64 75 63 74 69 6f 6e 20 | nge".raised.by.the.introduction. |
| 979c0 | 6f 66 20 61 73 73 69 67 6e 6d 65 6e 74 2e 0a 54 68 65 73 65 20 69 73 73 75 65 73 20 61 72 69 73 | of.assignment..These.issues.aris |
| 979e0 | 65 20 69 6e 20 70 72 61 63 74 69 63 65 20 77 68 65 6e 20 69 6e 64 69 76 69 64 75 61 6c 20 70 61 | e.in.practice.when.individual.pa |
| 97a00 | 69 72 73 20 61 72 65 20 22 73 68 61 72 65 64 22 20 61 6d 6f 6e 67 0a 64 69 66 66 65 72 65 6e 74 | irs.are."shared".among.different |
| 97a20 | 20 64 61 74 61 20 6f 62 6a 65 63 74 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 63 6f 6e | .data.objects...For.example,.con |
| 97a40 | 73 69 64 65 72 20 74 68 65 20 73 74 72 75 63 74 75 72 65 20 66 6f 72 6d 65 64 20 62 79 0a 0a 20 | sider.the.structure.formed.by... |
| 97a60 | 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 28 6c 69 73 74 20 27 61 20 27 62 29 29 0a 20 20 20 20 | ....(define.x.(list.'a.'b))..... |
| 97a80 | 20 28 64 65 66 69 6e 65 20 7a 31 20 28 63 6f 6e 73 20 78 20 78 29 29 0a 0a 20 20 20 41 73 20 73 | .(define.z1.(cons.x.x)).....As.s |
| 97aa0 | 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 36 3a 3a 2c 20 60 7a 31 | hown.in.*Note.Figure.3-16::,.`z1 |
| 97ac0 | 27 20 69 73 20 61 20 70 61 69 72 20 77 68 6f 73 65 20 60 63 61 72 27 20 61 6e 64 0a 60 63 64 72 | '.is.a.pair.whose.`car'.and.`cdr |
| 97ae0 | 27 20 62 6f 74 68 20 70 6f 69 6e 74 20 74 6f 20 74 68 65 20 73 61 6d 65 20 70 61 69 72 20 60 78 | '.both.point.to.the.same.pair.`x |
| 97b00 | 27 2e 20 20 54 68 69 73 20 73 68 61 72 69 6e 67 20 6f 66 20 60 78 27 20 62 79 20 74 68 65 0a 60 | '...This.sharing.of.`x'.by.the.` |
| 97b20 | 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 20 6f 66 20 60 7a 31 27 20 69 73 20 61 20 63 6f 6e 73 | car'.and.`cdr'.of.`z1'.is.a.cons |
| 97b40 | 65 71 75 65 6e 63 65 20 6f 66 20 74 68 65 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 77 | equence.of.the.straightforward.w |
| 97b60 | 61 79 20 69 6e 0a 77 68 69 63 68 20 60 63 6f 6e 73 27 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 | ay.in.which.`cons'.is.implemente |
| 97b80 | 64 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 75 73 69 6e 67 20 60 63 6f 6e 73 27 20 74 6f 20 | d...In.general,.using.`cons'.to. |
| 97ba0 | 63 6f 6e 73 74 72 75 63 74 0a 6c 69 73 74 73 20 77 69 6c 6c 20 72 65 73 75 6c 74 20 69 6e 20 61 | construct.lists.will.result.in.a |
| 97bc0 | 6e 20 69 6e 74 65 72 6c 69 6e 6b 65 64 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 70 61 69 72 73 | n.interlinked.structure.of.pairs |
| 97be0 | 20 69 6e 20 77 68 69 63 68 20 6d 61 6e 79 0a 69 6e 64 69 76 69 64 75 61 6c 20 70 61 69 72 73 20 | .in.which.many.individual.pairs. |
| 97c00 | 61 72 65 20 73 68 61 72 65 64 20 62 79 20 6d 61 6e 79 20 64 69 66 66 65 72 65 6e 74 20 73 74 72 | are.shared.by.many.different.str |
| 97c20 | 75 63 74 75 72 65 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 31 36 3a 2a 20 54 68 | uctures........*Figure.3.16:*.Th |
| 97c40 | 65 20 6c 69 73 74 20 60 7a 31 27 20 66 6f 72 6d 65 64 20 62 79 20 60 28 63 6f 6e 73 20 78 20 78 | e.list.`z1'.formed.by.`(cons.x.x |
| 97c60 | 29 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 | )'...................+---+---+.. |
| 97c80 | 20 20 20 20 20 20 20 20 20 7a 31 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 20 7c 0a 20 20 20 20 20 20 20 | .........z1.-->|.*.|.*.|........ |
| 97ca0 | 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .........+-|-+-|-+.............. |
| 97cc0 | 20 20 20 20 20 56 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b | .....V...V.................+---+ |
| 97ce0 | 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 78 20 | ---+.....+---+---+............x. |
| 97d00 | 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 | -->|.*.|.*-+---->|.*.|./.|...... |
| 97d20 | 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d | ...........+-|-+---+.....+-|-+-- |
| 97d40 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 | -+...................V.......... |
| 97d60 | 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 | ...V.................+---+...... |
| 97d80 | 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 61 20 7c 20 20 | ...+---+.................|.a.|.. |
| 97da0 | 20 20 20 20 20 20 20 7c 20 62 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | .......|.b.|.................+-- |
| 97dc0 | 2d 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 | -+.........+---+.......*Figure.3 |
| 97de0 | 2e 31 37 3a 2a 20 54 68 65 20 6c 69 73 74 20 60 7a 32 27 20 66 6f 72 6d 65 64 20 62 79 20 60 28 | .17:*.The.list.`z2'.formed.by.`( |
| 97e00 | 63 6f 6e 73 20 28 6c 69 73 74 20 27 61 20 27 62 29 20 28 6c 69 73 74 0a 20 20 20 20 20 27 61 20 | cons.(list.'a.'b).(list......'a. |
| 97e20 | 27 62 29 29 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d | 'b))'...................+---+--- |
| 97e40 | 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 | +.....+---+---+.....+---+---+... |
| 97e60 | 20 20 20 20 20 20 20 20 7a 32 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 | ........z2.-->|.*.|.*-+---->|.*. |
| 97e80 | 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 | |.*-+---->|.*.|./.|............. |
| 97ea0 | 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 | ....+-|-+---+.....+-|-+---+..... |
| 97ec0 | 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | +-|-+---+...................|... |
| 97ee0 | 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 | ..........V.............V....... |
| 97f00 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 | ............|...........+---+... |
| 97f20 | 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ......+---+...................|. |
| 97f40 | 20 20 20 20 20 20 20 20 20 20 7c 20 61 20 7c 20 20 20 20 20 20 20 20 20 7c 20 62 20 7c 0a 20 20 | ..........|.a.|.........|.b.|... |
| 97f60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | ................|...........+--- |
| 97f80 | 2b 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | +.........+---+................. |
| 97fa0 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a | ..|.............^.............^. |
| 97fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..................|............. |
| 97fe0 | 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |.............|................. |
| 98000 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 2b 2d 7c 2d | ..|...........+-|-+---+.....+-|- |
| 98020 | 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d | +---+...................+------- |
| 98040 | 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 | --->|.*.|.*-+---->|.*.|./.|..... |
| 98060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d | ..........................+---+- |
| 98080 | 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 0a 20 20 20 49 6e 20 63 6f 6e 74 72 61 73 | --+.....+---+---+.....In.contras |
| 980a0 | 74 20 74 6f 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 36 3a 3a 2c 20 2a 4e 6f 74 65 20 | t.to.*Note.Figure.3-16::,.*Note. |
| 980c0 | 46 69 67 75 72 65 20 33 2d 31 37 3a 3a 20 73 68 6f 77 73 20 74 68 65 0a 73 74 72 75 63 74 75 72 | Figure.3-17::.shows.the.structur |
| 980e0 | 65 20 63 72 65 61 74 65 64 20 62 79 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 7a 32 20 28 63 | e.created.by.......(define.z2.(c |
| 98100 | 6f 6e 73 20 28 6c 69 73 74 20 27 61 20 27 62 29 20 28 6c 69 73 74 20 27 61 20 27 62 29 29 29 0a | ons.(list.'a.'b).(list.'a.'b))). |
| 98120 | 0a 20 20 20 49 6e 20 74 68 69 73 20 73 74 72 75 63 74 75 72 65 2c 20 74 68 65 20 70 61 69 72 73 | ....In.this.structure,.the.pairs |
| 98140 | 20 69 6e 20 74 68 65 20 74 77 6f 20 60 28 61 20 62 29 27 20 6c 69 73 74 73 20 61 72 65 20 64 69 | .in.the.two.`(a.b)'.lists.are.di |
| 98160 | 73 74 69 6e 63 74 2c 0a 61 6c 74 68 6f 75 67 68 20 74 68 65 20 61 63 74 75 61 6c 20 73 79 6d 62 | stinct,.although.the.actual.symb |
| 98180 | 6f 6c 73 20 61 72 65 20 73 68 61 72 65 64 2e 28 34 29 0a 0a 20 20 20 57 68 65 6e 20 74 68 6f 75 | ols.are.shared.(4).....When.thou |
| 981a0 | 67 68 74 20 6f 66 20 61 73 20 61 20 6c 69 73 74 2c 20 60 7a 31 27 20 61 6e 64 20 60 7a 32 27 20 | ght.of.as.a.list,.`z1'.and.`z2'. |
| 981c0 | 62 6f 74 68 20 72 65 70 72 65 73 65 6e 74 20 22 74 68 65 20 73 61 6d 65 22 0a 6c 69 73 74 2c 20 | both.represent."the.same".list,. |
| 981e0 | 60 28 28 61 20 62 29 20 61 20 62 29 27 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 73 68 61 72 | `((a.b).a.b)'...In.general,.shar |
| 98200 | 69 6e 67 20 69 73 20 63 6f 6d 70 6c 65 74 65 6c 79 20 75 6e 64 65 74 65 63 74 61 62 6c 65 20 69 | ing.is.completely.undetectable.i |
| 98220 | 66 0a 77 65 20 6f 70 65 72 61 74 65 20 6f 6e 20 6c 69 73 74 73 20 75 73 69 6e 67 20 6f 6e 6c 79 | f.we.operate.on.lists.using.only |
| 98240 | 20 60 63 6f 6e 73 27 2c 20 60 63 61 72 27 2c 20 61 6e 64 20 60 63 64 72 27 2e 20 20 48 6f 77 65 | .`cons',.`car',.and.`cdr'...Howe |
| 98260 | 76 65 72 2c 20 69 66 0a 77 65 20 61 6c 6c 6f 77 20 6d 75 74 61 74 6f 72 73 20 6f 6e 20 6c 69 73 | ver,.if.we.allow.mutators.on.lis |
| 98280 | 74 20 73 74 72 75 63 74 75 72 65 2c 20 73 68 61 72 69 6e 67 20 62 65 63 6f 6d 65 73 20 73 69 67 | t.structure,.sharing.becomes.sig |
| 982a0 | 6e 69 66 69 63 61 6e 74 2e 20 20 41 73 20 61 6e 0a 65 78 61 6d 70 6c 65 20 6f 66 20 74 68 65 20 | nificant...As.an.example.of.the. |
| 982c0 | 64 69 66 66 65 72 65 6e 63 65 20 74 68 61 74 20 73 68 61 72 69 6e 67 20 63 61 6e 20 6d 61 6b 65 | difference.that.sharing.can.make |
| 982e0 | 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 70 72 6f 63 65 64 75 | ,.consider.the.following.procedu |
| 98300 | 72 65 2c 20 77 68 69 63 68 20 6d 6f 64 69 66 69 65 73 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 | re,.which.modifies.the.`car'.of. |
| 98320 | 74 68 65 20 73 74 72 75 63 74 75 72 65 20 74 6f 20 77 68 69 63 68 20 69 74 20 69 73 0a 61 70 70 | the.structure.to.which.it.is.app |
| 98340 | 6c 69 65 64 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 74 2d 74 6f 2d 77 6f 77 21 | lied:.......(define.(set-to-wow! |
| 98360 | 20 78 29 0a 20 20 20 20 20 20 20 28 73 65 74 2d 63 61 72 21 20 28 63 61 72 20 78 29 20 27 77 6f | .x)........(set-car!.(car.x).'wo |
| 98380 | 77 29 0a 20 20 20 20 20 20 20 78 29 0a 0a 20 20 20 45 76 65 6e 20 74 68 6f 75 67 68 20 60 7a 31 | w)........x).....Even.though.`z1 |
| 983a0 | 27 20 61 6e 64 20 60 7a 32 27 20 61 72 65 20 22 74 68 65 20 73 61 6d 65 22 20 73 74 72 75 63 74 | '.and.`z2'.are."the.same".struct |
| 983c0 | 75 72 65 2c 20 61 70 70 6c 79 69 6e 67 0a 60 73 65 74 2d 74 6f 2d 77 6f 77 21 27 20 74 6f 20 74 | ure,.applying.`set-to-wow!'.to.t |
| 983e0 | 68 65 6d 20 79 69 65 6c 64 73 20 64 69 66 66 65 72 65 6e 74 20 72 65 73 75 6c 74 73 2e 20 20 57 | hem.yields.different.results...W |
| 98400 | 69 74 68 20 60 7a 31 27 2c 20 61 6c 74 65 72 69 6e 67 0a 74 68 65 20 60 63 61 72 27 20 61 6c 73 | ith.`z1',.altering.the.`car'.als |
| 98420 | 6f 20 63 68 61 6e 67 65 73 20 74 68 65 20 60 63 64 72 27 2c 20 62 65 63 61 75 73 65 20 69 6e 20 | o.changes.the.`cdr',.because.in. |
| 98440 | 60 7a 31 27 20 74 68 65 20 60 63 61 72 27 20 61 6e 64 20 74 68 65 0a 60 63 64 72 27 20 61 72 65 | `z1'.the.`car'.and.the.`cdr'.are |
| 98460 | 20 74 68 65 20 73 61 6d 65 20 70 61 69 72 2e 20 20 57 69 74 68 20 60 7a 32 27 2c 20 74 68 65 20 | .the.same.pair...With.`z2',.the. |
| 98480 | 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 20 61 72 65 20 64 69 73 74 69 6e 63 74 2c 0a 73 6f | `car'.and.`cdr'.are.distinct,.so |
| 984a0 | 20 60 73 65 74 2d 74 6f 2d 77 6f 77 21 27 20 6d 6f 64 69 66 69 65 73 20 6f 6e 6c 79 20 74 68 65 | .`set-to-wow!'.modifies.only.the |
| 984c0 | 20 60 63 61 72 27 3a 0a 0a 20 20 20 20 20 7a 31 0a 20 20 20 20 20 28 28 61 20 62 29 20 61 20 62 | .`car':.......z1......((a.b).a.b |
| 984e0 | 29 0a 0a 20 20 20 20 20 28 73 65 74 2d 74 6f 2d 77 6f 77 21 20 7a 31 29 0a 20 20 20 20 20 28 28 | ).......(set-to-wow!.z1)......(( |
| 98500 | 77 6f 77 20 62 29 20 77 6f 77 20 62 29 0a 0a 20 20 20 20 20 7a 32 0a 20 20 20 20 20 28 28 61 20 | wow.b).wow.b).......z2......((a. |
| 98520 | 62 29 20 61 20 62 29 0a 0a 20 20 20 20 20 28 73 65 74 2d 74 6f 2d 77 6f 77 21 20 7a 32 29 0a 20 | b).a.b).......(set-to-wow!.z2).. |
| 98540 | 20 20 20 20 28 28 77 6f 77 20 62 29 20 61 20 62 29 0a 0a 20 20 20 4f 6e 65 20 77 61 79 20 74 6f | ....((wow.b).a.b).....One.way.to |
| 98560 | 20 64 65 74 65 63 74 20 73 68 61 72 69 6e 67 20 69 6e 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 | .detect.sharing.in.list.structur |
| 98580 | 65 73 20 69 73 20 74 6f 20 75 73 65 20 74 68 65 20 70 72 65 64 69 63 61 74 65 0a 60 65 71 3f 27 | es.is.to.use.the.predicate.`eq?' |
| 985a0 | 2c 20 77 68 69 63 68 20 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 73 65 63 74 69 6f 6e | ,.which.we.introduced.in.section |
| 985c0 | 20 2a 4e 6f 74 65 20 32 2d 33 2d 31 3a 3a 20 61 73 20 61 20 77 61 79 20 74 6f 20 74 65 73 74 0a | .*Note.2-3-1::.as.a.way.to.test. |
| 985e0 | 77 68 65 74 68 65 72 20 74 77 6f 20 73 79 6d 62 6f 6c 73 20 61 72 65 20 65 71 75 61 6c 2e 20 20 | whether.two.symbols.are.equal... |
| 98600 | 4d 6f 72 65 20 67 65 6e 65 72 61 6c 6c 79 2c 20 60 28 65 71 3f 20 20 78 20 79 29 27 20 74 65 73 | More.generally,.`(eq?..x.y)'.tes |
| 98620 | 74 73 0a 77 68 65 74 68 65 72 20 60 78 27 20 61 6e 64 20 60 79 27 20 61 72 65 20 74 68 65 20 73 | ts.whether.`x'.and.`y'.are.the.s |
| 98640 | 61 6d 65 20 6f 62 6a 65 63 74 20 28 74 68 61 74 20 69 73 2c 20 77 68 65 74 68 65 72 20 60 78 27 | ame.object.(that.is,.whether.`x' |
| 98660 | 20 61 6e 64 20 60 79 27 0a 61 72 65 20 65 71 75 61 6c 20 61 73 20 70 6f 69 6e 74 65 72 73 29 2e | .and.`y'.are.equal.as.pointers). |
| 98680 | 20 20 54 68 75 73 2c 20 77 69 74 68 20 60 7a 31 27 20 61 6e 64 20 60 7a 32 27 20 61 73 20 64 65 | ..Thus,.with.`z1'.and.`z2'.as.de |
| 986a0 | 66 69 6e 65 64 20 69 6e 20 66 69 67 75 72 65 73 0a 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d | fined.in.figures.*Note.Figure.3- |
| 986c0 | 31 36 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 31 37 3a 3a 2c 20 60 28 | 16::.and.*Note.Figure.3-17::,.`( |
| 986e0 | 65 71 3f 20 20 28 63 61 72 20 7a 31 29 20 28 63 64 72 20 7a 31 29 29 27 0a 69 73 20 74 72 75 65 | eq?..(car.z1).(cdr.z1))'.is.true |
| 98700 | 20 61 6e 64 20 60 28 65 71 3f 20 28 63 61 72 20 7a 32 29 20 28 63 64 72 20 7a 32 29 29 27 20 69 | .and.`(eq?.(car.z2).(cdr.z2))'.i |
| 98720 | 73 20 66 61 6c 73 65 2e 0a 0a 20 20 20 41 73 20 77 69 6c 6c 20 62 65 20 73 65 65 6e 20 69 6e 20 | s.false......As.will.be.seen.in. |
| 98740 | 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 65 63 74 69 6f 6e 73 2c 20 77 65 20 63 61 6e 20 65 | the.following.sections,.we.can.e |
| 98760 | 78 70 6c 6f 69 74 20 73 68 61 72 69 6e 67 20 74 6f 0a 67 72 65 61 74 6c 79 20 65 78 74 65 6e 64 | xploit.sharing.to.greatly.extend |
| 98780 | 20 74 68 65 20 72 65 70 65 72 74 6f 69 72 65 20 6f 66 20 64 61 74 61 20 73 74 72 75 63 74 75 72 | .the.repertoire.of.data.structur |
| 987a0 | 65 73 20 74 68 61 74 20 63 61 6e 20 62 65 0a 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 70 61 | es.that.can.be.represented.by.pa |
| 987c0 | 69 72 73 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 73 68 61 72 69 6e 67 | irs...On.the.other.hand,.sharing |
| 987e0 | 20 63 61 6e 20 61 6c 73 6f 20 62 65 0a 64 61 6e 67 65 72 6f 75 73 2c 20 73 69 6e 63 65 20 6d 6f | .can.also.be.dangerous,.since.mo |
| 98800 | 64 69 66 69 63 61 74 69 6f 6e 73 20 6d 61 64 65 20 74 6f 20 73 74 72 75 63 74 75 72 65 73 20 77 | difications.made.to.structures.w |
| 98820 | 69 6c 6c 20 61 6c 73 6f 20 61 66 66 65 63 74 0a 6f 74 68 65 72 20 73 74 72 75 63 74 75 72 65 73 | ill.also.affect.other.structures |
| 98840 | 20 74 68 61 74 20 68 61 70 70 65 6e 20 74 6f 20 73 68 61 72 65 20 74 68 65 20 6d 6f 64 69 66 69 | .that.happen.to.share.the.modifi |
| 98860 | 65 64 20 70 61 72 74 73 2e 20 20 54 68 65 20 6d 75 74 61 74 69 6f 6e 0a 6f 70 65 72 61 74 69 6f | ed.parts...The.mutation.operatio |
| 98880 | 6e 73 20 60 73 65 74 2d 63 61 72 21 27 20 61 6e 64 20 60 73 65 74 2d 63 64 72 21 27 20 73 68 6f | ns.`set-car!'.and.`set-cdr!'.sho |
| 988a0 | 75 6c 64 20 62 65 20 75 73 65 64 20 77 69 74 68 20 63 61 72 65 3b 20 75 6e 6c 65 73 73 0a 77 65 | uld.be.used.with.care;.unless.we |
| 988c0 | 20 68 61 76 65 20 61 20 67 6f 6f 64 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 6f 66 20 68 6f | .have.a.good.understanding.of.ho |
| 988e0 | 77 20 6f 75 72 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 61 72 65 20 73 68 61 72 65 64 2c 0a 6d | w.our.data.objects.are.shared,.m |
| 98900 | 75 74 61 74 69 6f 6e 20 63 61 6e 20 68 61 76 65 20 75 6e 61 6e 74 69 63 69 70 61 74 65 64 20 72 | utation.can.have.unanticipated.r |
| 98920 | 65 73 75 6c 74 73 2e 28 35 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 31 35 3a | esults.(5).......*Exercise.3.15: |
| 98940 | 2a 20 44 72 61 77 20 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 20 64 69 61 67 72 61 6d 73 20 | *.Draw.box-and-pointer.diagrams. |
| 98960 | 74 6f 20 65 78 70 6c 61 69 6e 20 74 68 65 0a 20 20 20 20 20 65 66 66 65 63 74 20 6f 66 20 60 73 | to.explain.the......effect.of.`s |
| 98980 | 65 74 2d 74 6f 2d 77 6f 77 21 27 20 6f 6e 20 74 68 65 20 73 74 72 75 63 74 75 72 65 73 20 60 7a | et-to-wow!'.on.the.structures.`z |
| 989a0 | 31 27 20 61 6e 64 20 60 7a 32 27 20 61 62 6f 76 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | 1'.and.`z2'.above........*Exerci |
| 989c0 | 73 65 20 33 2e 31 36 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 64 65 63 69 64 65 73 20 | se.3.16:*.Ben.Bitdiddle.decides. |
| 989e0 | 74 6f 20 77 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 6f 0a 20 20 20 20 20 63 6f 75 | to.write.a.procedure.to......cou |
| 98a00 | 6e 74 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 69 72 73 20 69 6e 20 61 6e 79 20 6c 69 | nt.the.number.of.pairs.in.any.li |
| 98a20 | 73 74 20 73 74 72 75 63 74 75 72 65 2e 20 20 22 49 74 27 73 20 65 61 73 79 2c 22 20 68 65 0a 20 | st.structure..."It's.easy,".he.. |
| 98a40 | 20 20 20 20 72 65 61 73 6f 6e 73 2e 20 20 22 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 69 | ....reasons..."The.number.of.pai |
| 98a60 | 72 73 20 69 6e 20 61 6e 79 20 73 74 72 75 63 74 75 72 65 20 69 73 20 74 68 65 20 6e 75 6d 62 65 | rs.in.any.structure.is.the.numbe |
| 98a80 | 72 20 69 6e 0a 20 20 20 20 20 74 68 65 20 60 63 61 72 27 20 70 6c 75 73 20 74 68 65 20 6e 75 6d | r.in......the.`car'.plus.the.num |
| 98aa0 | 62 65 72 20 69 6e 20 74 68 65 20 60 63 64 72 27 20 70 6c 75 73 20 6f 6e 65 20 6d 6f 72 65 20 74 | ber.in.the.`cdr'.plus.one.more.t |
| 98ac0 | 6f 20 63 6f 75 6e 74 20 74 68 65 0a 20 20 20 20 20 63 75 72 72 65 6e 74 20 70 61 69 72 2e 22 20 | o.count.the......current.pair.". |
| 98ae0 | 20 53 6f 20 42 65 6e 20 77 72 69 74 65 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f | .So.Ben.writes.the.following.pro |
| 98b00 | 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 75 6e | cedure:............(define.(coun |
| 98b20 | 74 2d 70 61 69 72 73 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 | t-pairs.x).............(if.(not. |
| 98b40 | 28 70 61 69 72 3f 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 30 0a 20 20 20 | (pair?.x)).................0.... |
| 98b60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 63 6f 75 6e 74 2d 70 61 69 72 73 20 28 63 61 | .............(+.(count-pairs.(ca |
| 98b80 | 72 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 75 6e 74 2d | r.x))....................(count- |
| 98ba0 | 70 61 69 72 73 20 28 63 64 72 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | pairs.(cdr.x)).................. |
| 98bc0 | 20 20 31 29 29 29 0a 0a 20 20 20 20 20 53 68 6f 77 20 74 68 61 74 20 74 68 69 73 20 70 72 6f 63 | ..1))).......Show.that.this.proc |
| 98be0 | 65 64 75 72 65 20 69 73 20 6e 6f 74 20 63 6f 72 72 65 63 74 2e 20 20 49 6e 20 70 61 72 74 69 63 | edure.is.not.correct...In.partic |
| 98c00 | 75 6c 61 72 2c 20 64 72 61 77 0a 20 20 20 20 20 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 20 | ular,.draw......box-and-pointer. |
| 98c20 | 64 69 61 67 72 61 6d 73 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 6c 69 73 74 20 73 74 72 75 63 | diagrams.representing.list.struc |
| 98c40 | 74 75 72 65 73 20 6d 61 64 65 20 75 70 20 6f 66 0a 20 20 20 20 20 65 78 61 63 74 6c 79 20 74 68 | tures.made.up.of......exactly.th |
| 98c60 | 72 65 65 20 70 61 69 72 73 20 66 6f 72 20 77 68 69 63 68 20 42 65 6e 27 73 20 70 72 6f 63 65 64 | ree.pairs.for.which.Ben's.proced |
| 98c80 | 75 72 65 20 77 6f 75 6c 64 20 72 65 74 75 72 6e 20 33 3b 0a 20 20 20 20 20 72 65 74 75 72 6e 20 | ure.would.return.3;......return. |
| 98ca0 | 34 3b 20 72 65 74 75 72 6e 20 37 3b 20 6e 65 76 65 72 20 72 65 74 75 72 6e 20 61 74 20 61 6c 6c | 4;.return.7;.never.return.at.all |
| 98cc0 | 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 31 37 3a 2a 20 44 65 76 69 73 65 20 | ........*Exercise.3.17:*.Devise. |
| 98ce0 | 61 20 63 6f 72 72 65 63 74 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 60 63 6f 75 6e 74 2d | a.correct.version.of.the.`count- |
| 98d00 | 70 61 69 72 73 27 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 2a 4e 6f 74 65 20 45 | pairs'......procedure.of.*Note.E |
| 98d20 | 78 65 72 63 69 73 65 20 33 2d 31 36 3a 3a 20 74 68 61 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 | xercise.3-16::.that.returns.the. |
| 98d40 | 6e 75 6d 62 65 72 20 6f 66 0a 20 20 20 20 20 64 69 73 74 69 6e 63 74 20 70 61 69 72 73 20 69 6e | number.of......distinct.pairs.in |
| 98d60 | 20 61 6e 79 20 73 74 72 75 63 74 75 72 65 2e 20 20 28 48 69 6e 74 3a 20 54 72 61 76 65 72 73 65 | .any.structure...(Hint:.Traverse |
| 98d80 | 20 74 68 65 20 73 74 72 75 63 74 75 72 65 2c 0a 20 20 20 20 20 6d 61 69 6e 74 61 69 6e 69 6e 67 | .the.structure,......maintaining |
| 98da0 | 20 61 6e 20 61 75 78 69 6c 69 61 72 79 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 20 74 68 61 | .an.auxiliary.data.structure.tha |
| 98dc0 | 74 20 69 73 20 75 73 65 64 20 74 6f 20 6b 65 65 70 20 74 72 61 63 6b 0a 20 20 20 20 20 6f 66 20 | t.is.used.to.keep.track......of. |
| 98de0 | 77 68 69 63 68 20 70 61 69 72 73 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 63 6f | which.pairs.have.already.been.co |
| 98e00 | 75 6e 74 65 64 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 31 38 3a 2a 20 57 | unted.).......*Exercise.3.18:*.W |
| 98e20 | 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 65 78 61 6d 69 6e 65 73 20 61 | rite.a.procedure.that.examines.a |
| 98e40 | 20 6c 69 73 74 20 61 6e 64 0a 20 20 20 20 20 64 65 74 65 72 6d 69 6e 65 73 20 77 68 65 74 68 65 | .list.and......determines.whethe |
| 98e60 | 72 20 69 74 20 63 6f 6e 74 61 69 6e 73 20 61 20 63 79 63 6c 65 2c 20 74 68 61 74 20 69 73 2c 20 | r.it.contains.a.cycle,.that.is,. |
| 98e80 | 77 68 65 74 68 65 72 20 61 20 70 72 6f 67 72 61 6d 0a 20 20 20 20 20 74 68 61 74 20 74 72 69 65 | whether.a.program......that.trie |
| 98ea0 | 64 20 74 6f 20 66 69 6e 64 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 6c 69 73 74 20 62 79 | d.to.find.the.end.of.the.list.by |
| 98ec0 | 20 74 61 6b 69 6e 67 20 73 75 63 63 65 73 73 69 76 65 20 60 63 64 72 27 73 0a 20 20 20 20 20 77 | .taking.successive.`cdr's......w |
| 98ee0 | 6f 75 6c 64 20 67 6f 20 69 6e 74 6f 20 61 6e 20 69 6e 66 69 6e 69 74 65 20 6c 6f 6f 70 2e 20 20 | ould.go.into.an.infinite.loop... |
| 98f00 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 31 33 3a 3a 20 63 6f 6e 73 74 72 75 63 74 65 | *Note.Exercise.3-13::.constructe |
| 98f20 | 64 0a 20 20 20 20 20 73 75 63 68 20 6c 69 73 74 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | d......such.lists........*Exerci |
| 98f40 | 73 65 20 33 2e 31 39 3a 2a 20 52 65 64 6f 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d | se.3.19:*.Redo.*Note.Exercise.3- |
| 98f60 | 31 38 3a 3a 20 75 73 69 6e 67 20 61 6e 20 61 6c 67 6f 72 69 74 68 6d 0a 20 20 20 20 20 74 68 61 | 18::.using.an.algorithm......tha |
| 98f80 | 74 20 74 61 6b 65 73 20 6f 6e 6c 79 20 61 20 63 6f 6e 73 74 61 6e 74 20 61 6d 6f 75 6e 74 20 6f | t.takes.only.a.constant.amount.o |
| 98fa0 | 66 20 73 70 61 63 65 2e 20 20 28 54 68 69 73 20 72 65 71 75 69 72 65 73 20 61 20 76 65 72 79 0a | f.space...(This.requires.a.very. |
| 98fc0 | 20 20 20 20 20 63 6c 65 76 65 72 20 69 64 65 61 2e 29 0a 0a 4d 75 74 61 74 69 6f 6e 20 69 73 20 | .....clever.idea.)..Mutation.is. |
| 98fe0 | 6a 75 73 74 20 61 73 73 69 67 6e 6d 65 6e 74 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | just.assignment................. |
| 99000 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 68 65 6e 20 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 | .............When.we.introduced. |
| 99020 | 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 2c 20 77 65 20 6f 62 73 65 72 76 65 64 20 69 6e 20 73 65 | compound.data,.we.observed.in.se |
| 99040 | 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 31 2d 33 3a 3a 0a 74 68 61 74 20 70 61 69 72 73 20 63 | ction.*Note.2-1-3::.that.pairs.c |
| 99060 | 61 6e 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 70 75 72 65 6c 79 20 69 6e 20 74 65 72 6d | an.be.represented.purely.in.term |
| 99080 | 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | s.of.procedures:.......(define.( |
| 990a0 | 63 6f 6e 73 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 70 61 74 | cons.x.y)........(define.(dispat |
| 990c0 | 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6d 20 27 63 61 | ch.m)..........(cond.((eq?.m.'ca |
| 990e0 | 72 29 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 63 64 | r).x)................((eq?.m.'cd |
| 99100 | 72 29 20 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f | r).y)................(else.(erro |
| 99120 | 72 20 22 55 6e 64 65 66 69 6e 65 64 20 6f 70 65 72 61 74 69 6f 6e 20 2d 2d 20 43 4f 4e 53 22 20 | r."Undefined.operation.--.CONS". |
| 99140 | 6d 29 29 29 29 0a 20 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 0a 0a 20 20 20 20 20 28 64 65 | m))))........dispatch).......(de |
| 99160 | 66 69 6e 65 20 28 63 61 72 20 7a 29 20 28 7a 20 27 63 61 72 29 29 0a 0a 20 20 20 20 20 28 64 65 | fine.(car.z).(z.'car)).......(de |
| 99180 | 66 69 6e 65 20 28 63 64 72 20 7a 29 20 28 7a 20 27 63 64 72 29 29 0a 0a 20 20 20 54 68 65 20 73 | fine.(cdr.z).(z.'cdr)).....The.s |
| 991a0 | 61 6d 65 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 69 73 20 74 72 75 65 20 66 6f 72 20 6d 75 74 61 | ame.observation.is.true.for.muta |
| 991c0 | 62 6c 65 20 64 61 74 61 2e 20 20 57 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 0a 6d 75 74 61 | ble.data...We.can.implement.muta |
| 991e0 | 62 6c 65 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 61 73 20 70 72 6f 63 65 64 75 72 65 73 20 75 | ble.data.objects.as.procedures.u |
| 99200 | 73 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e 74 20 61 6e 64 20 6c 6f 63 61 6c 20 73 74 61 74 65 2e | sing.assignment.and.local.state. |
| 99220 | 0a 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 77 65 20 63 61 6e 20 65 78 74 65 6e 64 20 74 68 65 | .For.instance,.we.can.extend.the |
| 99240 | 20 61 62 6f 76 65 20 70 61 69 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 74 6f 20 68 61 | .above.pair.implementation.to.ha |
| 99260 | 6e 64 6c 65 0a 60 73 65 74 2d 63 61 72 21 27 20 61 6e 64 20 60 73 65 74 2d 63 64 72 21 27 20 69 | ndle.`set-car!'.and.`set-cdr!'.i |
| 99280 | 6e 20 61 20 6d 61 6e 6e 65 72 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 74 68 65 20 77 61 79 20 | n.a.manner.analogous.to.the.way. |
| 992a0 | 77 65 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 73 20 75 73 69 | we.implemented.bank.accounts.usi |
| 992c0 | 6e 67 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f | ng.`make-account'.in.section.*No |
| 992e0 | 74 65 20 33 2d 31 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 73 20 | te.3-1-1:::.......(define.(cons. |
| 99300 | 78 20 79 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 74 2d 78 21 20 76 29 20 28 | x.y)........(define.(set-x!.v).( |
| 99320 | 73 65 74 21 20 78 20 76 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 74 2d 79 | set!.x.v))........(define.(set-y |
| 99340 | 21 20 76 29 20 28 73 65 74 21 20 79 20 76 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | !.v).(set!.y.v))........(define. |
| 99360 | 28 64 69 73 70 61 74 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 | (dispatch.m)..........(cond.((eq |
| 99380 | 3f 20 6d 20 27 63 61 72 29 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 | ?.m.'car).x)................((eq |
| 993a0 | 3f 20 6d 20 27 63 64 72 29 20 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 | ?.m.'cdr).y)................((eq |
| 993c0 | 3f 20 6d 20 27 73 65 74 2d 63 61 72 21 29 20 73 65 74 2d 78 21 29 0a 20 20 20 20 20 20 20 20 20 | ?.m.'set-car!).set-x!).......... |
| 993e0 | 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 73 65 74 2d 63 64 72 21 29 20 73 65 74 2d 79 21 29 | ......((eq?.m.'set-cdr!).set-y!) |
| 99400 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 6e | ................(else.(error."Un |
| 99420 | 64 65 66 69 6e 65 64 20 6f 70 65 72 61 74 69 6f 6e 20 2d 2d 20 43 4f 4e 53 22 20 6d 29 29 29 29 | defined.operation.--.CONS".m)))) |
| 99440 | 0a 20 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ........dispatch).......(define. |
| 99460 | 28 63 61 72 20 7a 29 20 28 7a 20 27 63 61 72 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | (car.z).(z.'car)).......(define. |
| 99480 | 28 63 64 72 20 7a 29 20 28 7a 20 27 63 64 72 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | (cdr.z).(z.'cdr)).......(define. |
| 994a0 | 28 73 65 74 2d 63 61 72 21 20 7a 20 6e 65 77 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 28 28 | (set-car!.z.new-value)........(( |
| 994c0 | 7a 20 27 73 65 74 2d 63 61 72 21 29 20 6e 65 77 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 7a | z.'set-car!).new-value)........z |
| 994e0 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 74 2d 63 64 72 21 20 7a 20 6e 65 77 2d | ).......(define.(set-cdr!.z.new- |
| 99500 | 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 28 28 7a 20 27 73 65 74 2d 63 64 72 21 29 20 6e 65 77 | value)........((z.'set-cdr!).new |
| 99520 | 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 7a 29 0a 0a 20 20 20 41 73 73 69 67 6e 6d 65 6e 74 | -value)........z).....Assignment |
| 99540 | 20 69 73 20 61 6c 6c 20 74 68 61 74 20 69 73 20 6e 65 65 64 65 64 2c 20 74 68 65 6f 72 65 74 69 | .is.all.that.is.needed,.theoreti |
| 99560 | 63 61 6c 6c 79 2c 20 74 6f 20 61 63 63 6f 75 6e 74 20 66 6f 72 20 74 68 65 0a 62 65 68 61 76 69 | cally,.to.account.for.the.behavi |
| 99580 | 6f 72 20 6f 66 20 6d 75 74 61 62 6c 65 20 64 61 74 61 2e 20 20 41 73 20 73 6f 6f 6e 20 61 73 20 | or.of.mutable.data...As.soon.as. |
| 995a0 | 77 65 20 61 64 6d 69 74 20 60 73 65 74 21 27 20 74 6f 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 2c | we.admit.`set!'.to.our.language, |
| 995c0 | 0a 77 65 20 72 61 69 73 65 20 61 6c 6c 20 74 68 65 20 69 73 73 75 65 73 2c 20 6e 6f 74 20 6f 6e | .we.raise.all.the.issues,.not.on |
| 995e0 | 6c 79 20 6f 66 20 61 73 73 69 67 6e 6d 65 6e 74 2c 20 62 75 74 20 6f 66 20 6d 75 74 61 62 6c 65 | ly.of.assignment,.but.of.mutable |
| 99600 | 20 64 61 74 61 20 69 6e 0a 67 65 6e 65 72 61 6c 2e 28 36 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 | .data.in.general.(6).......*Exer |
| 99620 | 63 69 73 65 20 33 2e 32 30 3a 2a 20 44 72 61 77 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 64 69 61 | cise.3.20:*.Draw.environment.dia |
| 99640 | 67 72 61 6d 73 20 74 6f 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 65 0a 20 20 20 20 20 65 76 61 | grams.to.illustrate.the......eva |
| 99660 | 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 65 78 70 72 65 | luation.of.the.sequence.of.expre |
| 99680 | 73 73 69 6f 6e 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 28 63 6f 6e | ssions............(define.x.(con |
| 996a0 | 73 20 31 20 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 7a 20 28 63 6f 6e | s.1.2))...........(define.z.(con |
| 996c0 | 73 20 78 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 61 72 21 20 28 63 64 72 | s.x.x))...........(set-car!.(cdr |
| 996e0 | 20 7a 29 20 31 37 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 78 29 0a 20 20 20 20 20 | .z).17)............(car.x)...... |
| 99700 | 20 20 20 20 20 31 37 0a 0a 20 20 20 20 20 75 73 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 | .....17.......using.the.procedur |
| 99720 | 61 6c 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 61 69 72 73 20 67 69 76 65 6e | al.implementation.of.pairs.given |
| 99740 | 20 61 62 6f 76 65 2e 20 20 28 43 6f 6d 70 61 72 65 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 | .above...(Compare......*Note.Exe |
| 99760 | 72 63 69 73 65 20 33 2d 31 31 3a 3a 2e 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f | rcise.3-11::.).....----------.Fo |
| 99780 | 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 60 53 65 74 2d | otnotes.----------.....(1).`Set- |
| 997a0 | 63 61 72 21 27 20 61 6e 64 20 60 73 65 74 2d 63 64 72 21 27 20 72 65 74 75 72 6e 20 69 6d 70 6c | car!'.and.`set-cdr!'.return.impl |
| 997c0 | 65 6d 65 6e 74 61 74 69 6f 6e 2d 64 65 70 65 6e 64 65 6e 74 0a 76 61 6c 75 65 73 2e 20 20 4c 69 | ementation-dependent.values...Li |
| 997e0 | 6b 65 20 60 73 65 74 21 27 2c 20 74 68 65 79 20 73 68 6f 75 6c 64 20 62 65 20 75 73 65 64 20 6f | ke.`set!',.they.should.be.used.o |
| 99800 | 6e 6c 79 20 66 6f 72 20 74 68 65 69 72 20 65 66 66 65 63 74 2e 0a 0a 20 20 20 28 32 29 20 57 65 | nly.for.their.effect......(2).We |
| 99820 | 20 73 65 65 20 66 72 6f 6d 20 74 68 69 73 20 74 68 61 74 20 6d 75 74 61 74 69 6f 6e 20 6f 70 65 | .see.from.this.that.mutation.ope |
| 99840 | 72 61 74 69 6f 6e 73 20 6f 6e 20 6c 69 73 74 73 20 63 61 6e 20 63 72 65 61 74 65 0a 22 67 61 72 | rations.on.lists.can.create."gar |
| 99860 | 62 61 67 65 22 20 74 68 61 74 20 69 73 20 6e 6f 74 20 70 61 72 74 20 6f 66 20 61 6e 79 20 61 63 | bage".that.is.not.part.of.any.ac |
| 99880 | 63 65 73 73 69 62 6c 65 20 73 74 72 75 63 74 75 72 65 2e 20 20 57 65 20 77 69 6c 6c 20 73 65 65 | cessible.structure...We.will.see |
| 998a0 | 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 33 2d 32 3a 3a 20 74 68 61 74 20 4c | .in.section.*Note.5-3-2::.that.L |
| 998c0 | 69 73 70 20 6d 65 6d 6f 72 79 2d 6d 61 6e 61 67 65 6d 65 6e 74 20 73 79 73 74 65 6d 73 20 69 6e | isp.memory-management.systems.in |
| 998e0 | 63 6c 75 64 65 20 61 20 22 67 61 72 62 61 67 65 0a 63 6f 6c 6c 65 63 74 6f 72 22 2c 20 77 68 69 | clude.a."garbage.collector",.whi |
| 99900 | 63 68 20 69 64 65 6e 74 69 66 69 65 73 20 61 6e 64 20 72 65 63 79 63 6c 65 73 20 74 68 65 20 6d | ch.identifies.and.recycles.the.m |
| 99920 | 65 6d 6f 72 79 20 73 70 61 63 65 20 75 73 65 64 20 62 79 0a 75 6e 6e 65 65 64 65 64 20 70 61 69 | emory.space.used.by.unneeded.pai |
| 99940 | 72 73 2e 0a 0a 20 20 20 28 33 29 20 60 47 65 74 2d 6e 65 77 2d 70 61 69 72 27 20 69 73 20 6f 6e | rs......(3).`Get-new-pair'.is.on |
| 99960 | 65 20 6f 66 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 6d 75 73 74 20 62 65 | e.of.the.operations.that.must.be |
| 99980 | 20 69 6d 70 6c 65 6d 65 6e 74 65 64 0a 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20 6d 65 6d 6f | .implemented.as.part.of.the.memo |
| 999a0 | 72 79 20 6d 61 6e 61 67 65 6d 65 6e 74 20 72 65 71 75 69 72 65 64 20 62 79 20 61 20 4c 69 73 70 | ry.management.required.by.a.Lisp |
| 999c0 | 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 20 20 57 65 0a 77 69 6c 6c 20 64 69 73 63 75 73 | .implementation...We.will.discus |
| 999e0 | 73 20 74 68 69 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 33 2d 31 3a 3a 2e | s.this.in.section.*Note.5-3-1::. |
| 99a00 | 0a 0a 20 20 20 28 34 29 20 54 68 65 20 74 77 6f 20 70 61 69 72 73 20 61 72 65 20 64 69 73 74 69 | .....(4).The.two.pairs.are.disti |
| 99a20 | 6e 63 74 20 62 65 63 61 75 73 65 20 65 61 63 68 20 63 61 6c 6c 20 74 6f 20 60 63 6f 6e 73 27 20 | nct.because.each.call.to.`cons'. |
| 99a40 | 72 65 74 75 72 6e 73 20 61 0a 6e 65 77 20 70 61 69 72 2e 20 20 54 68 65 20 73 79 6d 62 6f 6c 73 | returns.a.new.pair...The.symbols |
| 99a60 | 20 61 72 65 20 73 68 61 72 65 64 3b 20 69 6e 20 53 63 68 65 6d 65 20 74 68 65 72 65 20 69 73 20 | .are.shared;.in.Scheme.there.is. |
| 99a80 | 61 20 75 6e 69 71 75 65 20 73 79 6d 62 6f 6c 0a 77 69 74 68 20 61 6e 79 20 67 69 76 65 6e 20 6e | a.unique.symbol.with.any.given.n |
| 99aa0 | 61 6d 65 2e 20 20 53 69 6e 63 65 20 53 63 68 65 6d 65 20 70 72 6f 76 69 64 65 73 20 6e 6f 20 77 | ame...Since.Scheme.provides.no.w |
| 99ac0 | 61 79 20 74 6f 20 6d 75 74 61 74 65 20 61 20 73 79 6d 62 6f 6c 2c 0a 74 68 69 73 20 73 68 61 72 | ay.to.mutate.a.symbol,.this.shar |
| 99ae0 | 69 6e 67 20 69 73 20 75 6e 64 65 74 65 63 74 61 62 6c 65 2e 20 20 4e 6f 74 65 20 61 6c 73 6f 20 | ing.is.undetectable...Note.also. |
| 99b00 | 74 68 61 74 20 74 68 65 20 73 68 61 72 69 6e 67 20 69 73 20 77 68 61 74 0a 65 6e 61 62 6c 65 73 | that.the.sharing.is.what.enables |
| 99b20 | 20 75 73 20 74 6f 20 63 6f 6d 70 61 72 65 20 73 79 6d 62 6f 6c 73 20 75 73 69 6e 67 20 60 65 71 | .us.to.compare.symbols.using.`eq |
| 99b40 | 3f 27 2c 20 77 68 69 63 68 20 73 69 6d 70 6c 79 20 63 68 65 63 6b 73 20 65 71 75 61 6c 69 74 79 | ?',.which.simply.checks.equality |
| 99b60 | 0a 6f 66 20 70 6f 69 6e 74 65 72 73 2e 0a 0a 20 20 20 28 35 29 20 54 68 65 20 73 75 62 74 6c 65 | .of.pointers......(5).The.subtle |
| 99b80 | 74 69 65 73 20 6f 66 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 73 68 61 72 69 6e 67 20 6f 66 20 | ties.of.dealing.with.sharing.of. |
| 99ba0 | 6d 75 74 61 62 6c 65 20 64 61 74 61 20 6f 62 6a 65 63 74 73 0a 72 65 66 6c 65 63 74 20 74 68 65 | mutable.data.objects.reflect.the |
| 99bc0 | 20 75 6e 64 65 72 6c 79 69 6e 67 20 69 73 73 75 65 73 20 6f 66 20 22 73 61 6d 65 6e 65 73 73 22 | .underlying.issues.of."sameness" |
| 99be0 | 20 61 6e 64 20 22 63 68 61 6e 67 65 22 20 74 68 61 74 20 77 65 72 65 0a 72 61 69 73 65 64 20 69 | .and."change".that.were.raised.i |
| 99c00 | 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 33 3a 3a 2e 20 20 57 65 20 6d 65 6e | n.section.*Note.3-1-3::...We.men |
| 99c20 | 74 69 6f 6e 65 64 20 74 68 65 72 65 20 74 68 61 74 20 61 64 6d 69 74 74 69 6e 67 0a 63 68 61 6e | tioned.there.that.admitting.chan |
| 99c40 | 67 65 20 74 6f 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 72 65 71 75 69 72 65 73 20 74 68 61 74 | ge.to.our.language.requires.that |
| 99c60 | 20 61 20 63 6f 6d 70 6f 75 6e 64 20 6f 62 6a 65 63 74 20 6d 75 73 74 20 68 61 76 65 20 61 6e 0a | .a.compound.object.must.have.an. |
| 99c80 | 22 69 64 65 6e 74 69 74 79 22 20 74 68 61 74 20 69 73 20 73 6f 6d 65 74 68 69 6e 67 20 64 69 66 | "identity".that.is.something.dif |
| 99ca0 | 66 65 72 65 6e 74 20 66 72 6f 6d 20 74 68 65 20 70 69 65 63 65 73 20 66 72 6f 6d 20 77 68 69 63 | ferent.from.the.pieces.from.whic |
| 99cc0 | 68 20 69 74 20 69 73 0a 63 6f 6d 70 6f 73 65 64 2e 20 20 49 6e 20 4c 69 73 70 2c 20 77 65 20 63 | h.it.is.composed...In.Lisp,.we.c |
| 99ce0 | 6f 6e 73 69 64 65 72 20 74 68 69 73 20 22 69 64 65 6e 74 69 74 79 22 20 74 6f 20 62 65 20 74 68 | onsider.this."identity".to.be.th |
| 99d00 | 65 20 71 75 61 6c 69 74 79 20 74 68 61 74 0a 69 73 20 74 65 73 74 65 64 20 62 79 20 60 65 71 3f | e.quality.that.is.tested.by.`eq? |
| 99d20 | 27 2c 20 69 2e 65 2e 2c 20 62 79 20 65 71 75 61 6c 69 74 79 20 6f 66 20 70 6f 69 6e 74 65 72 73 | ',.i.e.,.by.equality.of.pointers |
| 99d40 | 2e 20 20 53 69 6e 63 65 20 69 6e 20 6d 6f 73 74 20 4c 69 73 70 0a 69 6d 70 6c 65 6d 65 6e 74 61 | ...Since.in.most.Lisp.implementa |
| 99d60 | 74 69 6f 6e 73 20 61 20 70 6f 69 6e 74 65 72 20 69 73 20 65 73 73 65 6e 74 69 61 6c 6c 79 20 61 | tions.a.pointer.is.essentially.a |
| 99d80 | 20 6d 65 6d 6f 72 79 20 61 64 64 72 65 73 73 2c 20 77 65 20 61 72 65 0a 22 73 6f 6c 76 69 6e 67 | .memory.address,.we.are."solving |
| 99da0 | 20 74 68 65 20 70 72 6f 62 6c 65 6d 22 20 6f 66 20 64 65 66 69 6e 69 6e 67 20 74 68 65 20 69 64 | .the.problem".of.defining.the.id |
| 99dc0 | 65 6e 74 69 74 79 20 6f 66 20 6f 62 6a 65 63 74 73 20 62 79 0a 73 74 69 70 75 6c 61 74 69 6e 67 | entity.of.objects.by.stipulating |
| 99de0 | 20 74 68 61 74 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 20 22 69 74 73 65 6c 66 22 20 69 73 20 | .that.a.data.object."itself".is. |
| 99e00 | 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 73 74 6f 72 65 64 20 69 6e 0a 73 6f 6d 65 20 70 | the.information.stored.in.some.p |
| 99e20 | 61 72 74 69 63 75 6c 61 72 20 73 65 74 20 6f 66 20 6d 65 6d 6f 72 79 20 6c 6f 63 61 74 69 6f 6e | articular.set.of.memory.location |
| 99e40 | 73 20 69 6e 20 74 68 65 20 63 6f 6d 70 75 74 65 72 2e 20 20 54 68 69 73 20 73 75 66 66 69 63 65 | s.in.the.computer...This.suffice |
| 99e60 | 73 0a 66 6f 72 20 73 69 6d 70 6c 65 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 73 2c 20 62 75 74 20 | s.for.simple.Lisp.programs,.but. |
| 99e80 | 69 73 20 68 61 72 64 6c 79 20 61 20 67 65 6e 65 72 61 6c 20 77 61 79 20 74 6f 20 72 65 73 6f 6c | is.hardly.a.general.way.to.resol |
| 99ea0 | 76 65 20 74 68 65 0a 69 73 73 75 65 20 6f 66 20 22 73 61 6d 65 6e 65 73 73 22 20 69 6e 20 63 6f | ve.the.issue.of."sameness".in.co |
| 99ec0 | 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 2e 0a 0a 20 20 20 28 36 29 20 4f 6e 20 74 | mputational.models......(6).On.t |
| 99ee0 | 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 66 72 6f 6d 20 74 68 65 20 76 69 65 77 70 6f 69 6e | he.other.hand,.from.the.viewpoin |
| 99f00 | 74 20 6f 66 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 0a 61 73 73 69 67 6e 6d 65 6e 74 20 | t.of.implementation,.assignment. |
| 99f20 | 72 65 71 75 69 72 65 73 20 75 73 20 74 6f 20 6d 6f 64 69 66 79 20 74 68 65 20 65 6e 76 69 72 6f | requires.us.to.modify.the.enviro |
| 99f40 | 6e 6d 65 6e 74 2c 20 77 68 69 63 68 20 69 73 20 69 74 73 65 6c 66 20 61 0a 6d 75 74 61 62 6c 65 | nment,.which.is.itself.a.mutable |
| 99f60 | 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 2e 20 20 54 68 75 73 2c 20 61 73 73 69 67 6e 6d 65 | .data.structure...Thus,.assignme |
| 99f80 | 6e 74 20 61 6e 64 20 6d 75 74 61 74 69 6f 6e 20 61 72 65 20 65 71 75 69 70 6f 74 65 6e 74 3a 0a | nt.and.mutation.are.equipotent:. |
| 99fa0 | 45 61 63 68 20 63 61 6e 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 74 65 72 6d 73 | Each.can.be.implemented.in.terms |
| 99fc0 | 20 6f 66 20 74 68 65 20 6f 74 68 65 72 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 | .of.the.other.....File:.sicp.inf |
| 99fe0 | 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 33 2d 32 2c 20 20 4e 65 78 74 3a 20 33 2d 33 2d 33 2c 20 20 | o,..Node:.3-3-2,..Next:.3-3-3,.. |
| 9a000 | 50 72 65 76 3a 20 33 2d 33 2d 31 2c 20 20 55 70 3a 20 33 2d 33 0a 0a 33 2e 33 2e 32 20 52 65 70 | Prev:.3-3-1,..Up:.3-3..3.3.2.Rep |
| 9a020 | 72 65 73 65 6e 74 69 6e 67 20 51 75 65 75 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | resenting.Queues.--------------- |
| 9a040 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 6d 75 74 61 74 6f 72 73 20 60 73 65 74 2d 63 61 | ----------..The.mutators.`set-ca |
| 9a060 | 72 21 27 20 61 6e 64 20 60 73 65 74 2d 63 64 72 21 27 20 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 | r!'.and.`set-cdr!'.enable.us.to. |
| 9a080 | 75 73 65 20 70 61 69 72 73 20 74 6f 0a 63 6f 6e 73 74 72 75 63 74 20 64 61 74 61 20 73 74 72 75 | use.pairs.to.construct.data.stru |
| 9a0a0 | 63 74 75 72 65 73 20 74 68 61 74 20 63 61 6e 6e 6f 74 20 62 65 20 62 75 69 6c 74 20 77 69 74 68 | ctures.that.cannot.be.built.with |
| 9a0c0 | 20 60 63 6f 6e 73 27 2c 20 60 63 61 72 27 2c 20 61 6e 64 0a 60 63 64 72 27 20 61 6c 6f 6e 65 2e | .`cons',.`car',.and.`cdr'.alone. |
| 9a0e0 | 20 20 54 68 69 73 20 73 65 63 74 69 6f 6e 20 73 68 6f 77 73 20 68 6f 77 20 74 6f 20 75 73 65 20 | ..This.section.shows.how.to.use. |
| 9a100 | 70 61 69 72 73 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 61 20 64 61 74 61 0a 73 74 72 75 63 74 | pairs.to.represent.a.data.struct |
| 9a120 | 75 72 65 20 63 61 6c 6c 65 64 20 61 20 71 75 65 75 65 2e 20 20 53 65 63 74 69 6f 6e 20 2a 4e 6f | ure.called.a.queue...Section.*No |
| 9a140 | 74 65 20 33 2d 33 2d 33 3a 3a 20 77 69 6c 6c 20 73 68 6f 77 20 68 6f 77 20 74 6f 0a 72 65 70 72 | te.3-3-3::.will.show.how.to.repr |
| 9a160 | 65 73 65 6e 74 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 63 61 6c 6c 65 64 20 74 61 62 | esent.data.structures.called.tab |
| 9a180 | 6c 65 73 2e 0a 0a 20 20 20 41 20 22 71 75 65 75 65 22 20 69 73 20 61 20 73 65 71 75 65 6e 63 65 | les......A."queue".is.a.sequence |
| 9a1a0 | 20 69 6e 20 77 68 69 63 68 20 69 74 65 6d 73 20 61 72 65 20 69 6e 73 65 72 74 65 64 20 61 74 20 | .in.which.items.are.inserted.at. |
| 9a1c0 | 6f 6e 65 20 65 6e 64 0a 28 63 61 6c 6c 65 64 20 74 68 65 20 22 72 65 61 72 22 20 6f 66 20 74 68 | one.end.(called.the."rear".of.th |
| 9a1e0 | 65 20 71 75 65 75 65 29 20 61 6e 64 20 64 65 6c 65 74 65 64 20 66 72 6f 6d 20 74 68 65 20 6f 74 | e.queue).and.deleted.from.the.ot |
| 9a200 | 68 65 72 20 65 6e 64 20 28 74 68 65 20 22 66 72 6f 6e 74 22 29 2e 0a 2a 4e 6f 74 65 20 46 69 67 | her.end.(the."front")..*Note.Fig |
| 9a220 | 75 72 65 20 33 2d 31 38 3a 3a 20 73 68 6f 77 73 20 61 6e 20 69 6e 69 74 69 61 6c 6c 79 20 65 6d | ure.3-18::.shows.an.initially.em |
| 9a240 | 70 74 79 20 71 75 65 75 65 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 69 74 65 6d 73 0a 60 61 27 | pty.queue.in.which.the.items.`a' |
| 9a260 | 20 61 6e 64 20 60 62 27 20 61 72 65 20 69 6e 73 65 72 74 65 64 2e 20 20 54 68 65 6e 20 60 61 27 | .and.`b'.are.inserted...Then.`a' |
| 9a280 | 20 69 73 20 72 65 6d 6f 76 65 64 2c 20 60 63 27 20 61 6e 64 20 60 64 27 20 61 72 65 0a 69 6e 73 | .is.removed,.`c'.and.`d'.are.ins |
| 9a2a0 | 65 72 74 65 64 2c 20 61 6e 64 20 60 62 27 20 69 73 20 72 65 6d 6f 76 65 64 2e 20 20 42 65 63 61 | erted,.and.`b'.is.removed...Beca |
| 9a2c0 | 75 73 65 20 69 74 65 6d 73 20 61 72 65 20 61 6c 77 61 79 73 20 72 65 6d 6f 76 65 64 20 69 6e 20 | use.items.are.always.removed.in. |
| 9a2e0 | 74 68 65 0a 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 79 20 61 72 65 20 69 6e 73 65 | the.order.in.which.they.are.inse |
| 9a300 | 72 74 65 64 2c 20 61 20 71 75 65 75 65 20 69 73 20 73 6f 6d 65 74 69 6d 65 73 20 63 61 6c 6c 65 | rted,.a.queue.is.sometimes.calle |
| 9a320 | 64 20 61 20 22 46 49 46 4f 22 0a 28 66 69 72 73 74 20 69 6e 2c 20 66 69 72 73 74 20 6f 75 74 29 | d.a."FIFO".(first.in,.first.out) |
| 9a340 | 20 62 75 66 66 65 72 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 31 38 3a 2a 20 51 75 | .buffer........*Figure.3.18:*.Qu |
| 9a360 | 65 75 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 4f 70 65 72 61 | eue.operations.............Opera |
| 9a380 | 74 69 6f 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 52 65 73 75 6c 74 69 6e 67 20 51 75 | tion................Resulting.Qu |
| 9a3a0 | 65 75 65 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 71 20 28 6d 61 6b 65 2d 71 75 | eue...........(define.q.(make-qu |
| 9a3c0 | 65 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 69 6e 73 65 72 74 2d 71 75 65 75 65 21 20 71 | eue))...........(insert-queue!.q |
| 9a3e0 | 20 27 61 29 20 20 20 20 20 61 0a 20 20 20 20 20 20 20 20 20 20 28 69 6e 73 65 72 74 2d 71 75 65 | .'a).....a...........(insert-que |
| 9a400 | 75 65 21 20 71 20 27 62 29 20 20 20 20 20 61 20 62 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 6c | ue!.q.'b).....a.b...........(del |
| 9a420 | 65 74 65 2d 71 75 65 75 65 21 20 71 29 20 20 20 20 20 20 20 20 62 0a 20 20 20 20 20 20 20 20 20 | ete-queue!.q)........b.......... |
| 9a440 | 20 28 69 6e 73 65 72 74 2d 71 75 65 75 65 21 20 71 20 27 63 29 20 20 20 20 20 62 20 63 0a 20 20 | .(insert-queue!.q.'c).....b.c... |
| 9a460 | 20 20 20 20 20 20 20 20 28 69 6e 73 65 72 74 2d 71 75 65 75 65 21 20 71 20 27 64 29 20 20 20 20 | ........(insert-queue!.q.'d).... |
| 9a480 | 20 62 20 63 20 64 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 71 75 65 75 65 21 20 | .b.c.d...........(delete-queue!. |
| 9a4a0 | 71 29 20 20 20 20 20 20 20 20 63 20 64 0a 0a 20 20 20 49 6e 20 74 65 72 6d 73 20 6f 66 20 64 61 | q)........c.d.....In.terms.of.da |
| 9a4c0 | 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 77 65 20 63 61 6e 20 72 65 67 61 72 64 20 61 20 | ta.abstraction,.we.can.regard.a. |
| 9a4e0 | 71 75 65 75 65 20 61 73 20 64 65 66 69 6e 65 64 20 62 79 0a 74 68 65 20 66 6f 6c 6c 6f 77 69 6e | queue.as.defined.by.the.followin |
| 9a500 | 67 20 73 65 74 20 6f 66 20 6f 70 65 72 61 74 69 6f 6e 73 3a 0a 0a 20 20 20 2a 20 61 20 63 6f 6e | g.set.of.operations:.....*.a.con |
| 9a520 | 73 74 72 75 63 74 6f 72 3a 20 60 28 6d 61 6b 65 2d 71 75 65 75 65 29 27 20 72 65 74 75 72 6e 73 | structor:.`(make-queue)'.returns |
| 9a540 | 20 61 6e 20 65 6d 70 74 79 20 71 75 65 75 65 20 28 61 20 71 75 65 75 65 0a 20 20 20 20 20 63 6f | .an.empty.queue.(a.queue......co |
| 9a560 | 6e 74 61 69 6e 69 6e 67 20 6e 6f 20 69 74 65 6d 73 29 2e 0a 0a 20 20 20 2a 20 74 77 6f 20 73 65 | ntaining.no.items)......*.two.se |
| 9a580 | 6c 65 63 74 6f 72 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 65 6d 70 74 79 2d 71 75 65 75 65 | lectors:............(empty-queue |
| 9a5a0 | 3f 20 3c 51 55 45 55 45 3e 29 0a 0a 20 20 20 20 20 74 65 73 74 73 20 69 66 20 74 68 65 20 71 75 | ?.<QUEUE>).......tests.if.the.qu |
| 9a5c0 | 65 75 65 20 69 73 20 65 6d 70 74 79 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 72 6f 6e 74 2d | eue.is.empty.............(front- |
| 9a5e0 | 71 75 65 75 65 20 3c 51 55 45 55 45 3e 29 0a 0a 20 20 20 20 20 72 65 74 75 72 6e 73 20 74 68 65 | queue.<QUEUE>).......returns.the |
| 9a600 | 20 6f 62 6a 65 63 74 20 61 74 20 74 68 65 20 66 72 6f 6e 74 20 6f 66 20 74 68 65 20 71 75 65 75 | .object.at.the.front.of.the.queu |
| 9a620 | 65 2c 20 73 69 67 6e 61 6c 69 6e 67 20 61 6e 20 65 72 72 6f 72 0a 20 20 20 20 20 69 66 20 74 68 | e,.signaling.an.error......if.th |
| 9a640 | 65 20 71 75 65 75 65 20 69 73 20 65 6d 70 74 79 3b 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 6d 6f | e.queue.is.empty;.it.does.not.mo |
| 9a660 | 64 69 66 79 20 74 68 65 20 71 75 65 75 65 2e 0a 0a 20 20 20 2a 20 74 77 6f 20 6d 75 74 61 74 6f | dify.the.queue......*.two.mutato |
| 9a680 | 72 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 69 6e 73 65 72 74 2d 71 75 65 75 65 21 20 3c 51 | rs:............(insert-queue!.<Q |
| 9a6a0 | 55 45 55 45 3e 20 3c 49 54 45 4d 3e 29 0a 0a 20 20 20 20 20 69 6e 73 65 72 74 73 20 74 68 65 20 | UEUE>.<ITEM>).......inserts.the. |
| 9a6c0 | 69 74 65 6d 20 61 74 20 74 68 65 20 72 65 61 72 20 6f 66 20 74 68 65 20 71 75 65 75 65 20 61 6e | item.at.the.rear.of.the.queue.an |
| 9a6e0 | 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 6d 6f 64 69 66 69 65 64 0a 20 20 20 20 20 71 75 65 75 | d.returns.the.modified......queu |
| 9a700 | 65 20 61 73 20 69 74 73 20 76 61 6c 75 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 6c 65 | e.as.its.value.............(dele |
| 9a720 | 74 65 2d 71 75 65 75 65 21 20 3c 51 55 45 55 45 3e 29 0a 0a 20 20 20 20 20 72 65 6d 6f 76 65 73 | te-queue!.<QUEUE>).......removes |
| 9a740 | 20 74 68 65 20 69 74 65 6d 20 61 74 20 74 68 65 20 66 72 6f 6e 74 20 6f 66 20 74 68 65 20 71 75 | .the.item.at.the.front.of.the.qu |
| 9a760 | 65 75 65 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 0a 20 20 20 20 20 6d 6f 64 69 66 69 65 | eue.and.returns.the......modifie |
| 9a780 | 64 20 71 75 65 75 65 20 61 73 20 69 74 73 20 76 61 6c 75 65 2c 20 73 69 67 6e 61 6c 69 6e 67 20 | d.queue.as.its.value,.signaling. |
| 9a7a0 | 61 6e 20 65 72 72 6f 72 20 69 66 20 74 68 65 20 71 75 65 75 65 20 69 73 0a 20 20 20 20 20 65 6d | an.error.if.the.queue.is......em |
| 9a7c0 | 70 74 79 20 62 65 66 6f 72 65 20 74 68 65 20 64 65 6c 65 74 69 6f 6e 2e 0a 0a 0a 20 20 20 42 65 | pty.before.the.deletion.......Be |
| 9a7e0 | 63 61 75 73 65 20 61 20 71 75 65 75 65 20 69 73 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 69 | cause.a.queue.is.a.sequence.of.i |
| 9a800 | 74 65 6d 73 2c 20 77 65 20 63 6f 75 6c 64 20 63 65 72 74 61 69 6e 6c 79 20 72 65 70 72 65 73 65 | tems,.we.could.certainly.represe |
| 9a820 | 6e 74 0a 69 74 20 61 73 20 61 6e 20 6f 72 64 69 6e 61 72 79 20 6c 69 73 74 3b 20 74 68 65 20 66 | nt.it.as.an.ordinary.list;.the.f |
| 9a840 | 72 6f 6e 74 20 6f 66 20 74 68 65 20 71 75 65 75 65 20 77 6f 75 6c 64 20 62 65 20 74 68 65 20 60 | ront.of.the.queue.would.be.the.` |
| 9a860 | 63 61 72 27 20 6f 66 0a 74 68 65 20 6c 69 73 74 2c 20 69 6e 73 65 72 74 69 6e 67 20 61 6e 20 69 | car'.of.the.list,.inserting.an.i |
| 9a880 | 74 65 6d 20 69 6e 20 74 68 65 20 71 75 65 75 65 20 77 6f 75 6c 64 20 61 6d 6f 75 6e 74 20 74 6f | tem.in.the.queue.would.amount.to |
| 9a8a0 | 20 61 70 70 65 6e 64 69 6e 67 20 61 0a 6e 65 77 20 65 6c 65 6d 65 6e 74 20 61 74 20 74 68 65 20 | .appending.a.new.element.at.the. |
| 9a8c0 | 65 6e 64 20 6f 66 20 74 68 65 20 6c 69 73 74 2c 20 61 6e 64 20 64 65 6c 65 74 69 6e 67 20 61 6e | end.of.the.list,.and.deleting.an |
| 9a8e0 | 20 69 74 65 6d 20 66 72 6f 6d 20 74 68 65 20 71 75 65 75 65 0a 77 6f 75 6c 64 20 6a 75 73 74 20 | .item.from.the.queue.would.just. |
| 9a900 | 62 65 20 74 61 6b 69 6e 67 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 74 68 65 20 6c 69 73 74 2e | be.taking.the.`cdr'.of.the.list. |
| 9a920 | 20 20 48 6f 77 65 76 65 72 2c 20 74 68 69 73 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 | ..However,.this.representation.i |
| 9a940 | 73 20 69 6e 65 66 66 69 63 69 65 6e 74 2c 20 62 65 63 61 75 73 65 20 69 6e 20 6f 72 64 65 72 20 | s.inefficient,.because.in.order. |
| 9a960 | 74 6f 20 69 6e 73 65 72 74 20 61 6e 20 69 74 65 6d 20 77 65 0a 6d 75 73 74 20 73 63 61 6e 20 74 | to.insert.an.item.we.must.scan.t |
| 9a980 | 68 65 20 6c 69 73 74 20 75 6e 74 69 6c 20 77 65 20 72 65 61 63 68 20 74 68 65 20 65 6e 64 2e 20 | he.list.until.we.reach.the.end.. |
| 9a9a0 | 20 53 69 6e 63 65 20 74 68 65 20 6f 6e 6c 79 20 6d 65 74 68 6f 64 20 77 65 0a 68 61 76 65 20 66 | .Since.the.only.method.we.have.f |
| 9a9c0 | 6f 72 20 73 63 61 6e 6e 69 6e 67 20 61 20 6c 69 73 74 20 69 73 20 62 79 20 73 75 63 63 65 73 73 | or.scanning.a.list.is.by.success |
| 9a9e0 | 69 76 65 20 60 63 64 72 27 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 74 68 69 73 0a 73 63 61 6e 6e | ive.`cdr'.operations,.this.scann |
| 9aa00 | 69 6e 67 20 72 65 71 75 69 72 65 73 20 5b 74 68 65 74 61 5d 28 6e 29 20 73 74 65 70 73 20 66 6f | ing.requires.[theta](n).steps.fo |
| 9aa20 | 72 20 61 20 6c 69 73 74 20 6f 66 20 6e 20 69 74 65 6d 73 2e 20 20 41 20 73 69 6d 70 6c 65 0a 6d | r.a.list.of.n.items...A.simple.m |
| 9aa40 | 6f 64 69 66 69 63 61 74 69 6f 6e 20 74 6f 20 74 68 65 20 6c 69 73 74 20 72 65 70 72 65 73 65 6e | odification.to.the.list.represen |
| 9aa60 | 74 61 74 69 6f 6e 20 6f 76 65 72 63 6f 6d 65 73 20 74 68 69 73 20 64 69 73 61 64 76 61 6e 74 61 | tation.overcomes.this.disadvanta |
| 9aa80 | 67 65 20 62 79 0a 61 6c 6c 6f 77 69 6e 67 20 74 68 65 20 71 75 65 75 65 20 6f 70 65 72 61 74 69 | ge.by.allowing.the.queue.operati |
| 9aaa0 | 6f 6e 73 20 74 6f 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 73 6f 20 74 68 61 74 20 74 68 | ons.to.be.implemented.so.that.th |
| 9aac0 | 65 79 20 72 65 71 75 69 72 65 0a 5b 74 68 65 74 61 5d 28 31 29 20 73 74 65 70 73 3b 20 74 68 61 | ey.require.[theta](1).steps;.tha |
| 9aae0 | 74 20 69 73 2c 20 73 6f 20 74 68 61 74 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 70 | t.is,.so.that.the.number.of.step |
| 9ab00 | 73 20 6e 65 65 64 65 64 20 69 73 0a 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 6c | s.needed.is.independent.of.the.l |
| 9ab20 | 65 6e 67 74 68 20 6f 66 20 74 68 65 20 71 75 65 75 65 2e 0a 0a 20 20 20 54 68 65 20 64 69 66 66 | ength.of.the.queue......The.diff |
| 9ab40 | 69 63 75 6c 74 79 20 77 69 74 68 20 74 68 65 20 6c 69 73 74 20 72 65 70 72 65 73 65 6e 74 61 74 | iculty.with.the.list.representat |
| 9ab60 | 69 6f 6e 20 61 72 69 73 65 73 20 66 72 6f 6d 20 74 68 65 20 6e 65 65 64 20 74 6f 0a 73 63 61 6e | ion.arises.from.the.need.to.scan |
| 9ab80 | 20 74 6f 20 66 69 6e 64 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 6c 69 73 74 2e 20 20 54 | .to.find.the.end.of.the.list...T |
| 9aba0 | 68 65 20 72 65 61 73 6f 6e 20 77 65 20 6e 65 65 64 20 74 6f 20 73 63 61 6e 20 69 73 20 74 68 61 | he.reason.we.need.to.scan.is.tha |
| 9abc0 | 74 2c 0a 61 6c 74 68 6f 75 67 68 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 77 61 79 20 6f 66 20 | t,.although.the.standard.way.of. |
| 9abe0 | 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 20 6c 69 73 74 20 61 73 20 61 20 63 68 61 69 6e 20 6f | representing.a.list.as.a.chain.o |
| 9ac00 | 66 20 70 61 69 72 73 0a 72 65 61 64 69 6c 79 20 70 72 6f 76 69 64 65 73 20 75 73 20 77 69 74 68 | f.pairs.readily.provides.us.with |
| 9ac20 | 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 | .a.pointer.to.the.beginning.of.t |
| 9ac40 | 68 65 20 6c 69 73 74 2c 20 69 74 0a 67 69 76 65 73 20 75 73 20 6e 6f 20 65 61 73 69 6c 79 20 61 | he.list,.it.gives.us.no.easily.a |
| 9ac60 | 63 63 65 73 73 69 62 6c 65 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 65 6e 64 2e 20 20 54 | ccessible.pointer.to.the.end...T |
| 9ac80 | 68 65 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 0a 74 68 61 74 20 61 76 6f 69 64 73 20 74 68 65 20 | he.modification.that.avoids.the. |
| 9aca0 | 64 72 61 77 62 61 63 6b 20 69 73 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 71 75 65 | drawback.is.to.represent.the.que |
| 9acc0 | 75 65 20 61 73 20 61 20 6c 69 73 74 2c 20 74 6f 67 65 74 68 65 72 0a 77 69 74 68 20 61 6e 20 61 | ue.as.a.list,.together.with.an.a |
| 9ace0 | 64 64 69 74 69 6f 6e 61 6c 20 70 6f 69 6e 74 65 72 20 74 68 61 74 20 69 6e 64 69 63 61 74 65 73 | dditional.pointer.that.indicates |
| 9ad00 | 20 74 68 65 20 66 69 6e 61 6c 20 70 61 69 72 20 69 6e 20 74 68 65 20 6c 69 73 74 2e 0a 54 68 61 | .the.final.pair.in.the.list..Tha |
| 9ad20 | 74 20 77 61 79 2c 20 77 68 65 6e 20 77 65 20 67 6f 20 74 6f 20 69 6e 73 65 72 74 20 61 6e 20 69 | t.way,.when.we.go.to.insert.an.i |
| 9ad40 | 74 65 6d 2c 20 77 65 20 63 61 6e 20 63 6f 6e 73 75 6c 74 20 74 68 65 20 72 65 61 72 20 70 6f 69 | tem,.we.can.consult.the.rear.poi |
| 9ad60 | 6e 74 65 72 0a 61 6e 64 20 73 6f 20 61 76 6f 69 64 20 73 63 61 6e 6e 69 6e 67 20 74 68 65 20 6c | nter.and.so.avoid.scanning.the.l |
| 9ad80 | 69 73 74 2e 0a 0a 20 20 20 41 20 71 75 65 75 65 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 2c | ist......A.queue.is.represented, |
| 9ada0 | 20 74 68 65 6e 2c 20 61 73 20 61 20 70 61 69 72 20 6f 66 20 70 6f 69 6e 74 65 72 73 2c 20 60 66 | .then,.as.a.pair.of.pointers,.`f |
| 9adc0 | 72 6f 6e 74 2d 70 74 72 27 20 61 6e 64 0a 60 72 65 61 72 2d 70 74 72 27 2c 20 77 68 69 63 68 20 | ront-ptr'.and.`rear-ptr',.which. |
| 9ade0 | 69 6e 64 69 63 61 74 65 2c 20 72 65 73 70 65 63 74 69 76 65 6c 79 2c 20 74 68 65 20 66 69 72 73 | indicate,.respectively,.the.firs |
| 9ae00 | 74 20 61 6e 64 20 6c 61 73 74 20 70 61 69 72 73 20 69 6e 20 61 6e 0a 6f 72 64 69 6e 61 72 79 20 | t.and.last.pairs.in.an.ordinary. |
| 9ae20 | 6c 69 73 74 2e 20 20 53 69 6e 63 65 20 77 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 68 65 20 71 | list...Since.we.would.like.the.q |
| 9ae40 | 75 65 75 65 20 74 6f 20 62 65 20 61 6e 20 69 64 65 6e 74 69 66 69 61 62 6c 65 0a 6f 62 6a 65 63 | ueue.to.be.an.identifiable.objec |
| 9ae60 | 74 2c 20 77 65 20 63 61 6e 20 75 73 65 20 60 63 6f 6e 73 27 20 74 6f 20 63 6f 6d 62 69 6e 65 20 | t,.we.can.use.`cons'.to.combine. |
| 9ae80 | 74 68 65 20 74 77 6f 20 70 6f 69 6e 74 65 72 73 2e 20 20 54 68 75 73 2c 20 74 68 65 20 71 75 65 | the.two.pointers...Thus,.the.que |
| 9aea0 | 75 65 0a 69 74 73 65 6c 66 20 77 69 6c 6c 20 62 65 20 74 68 65 20 60 63 6f 6e 73 27 20 6f 66 20 | ue.itself.will.be.the.`cons'.of. |
| 9aec0 | 74 68 65 20 74 77 6f 20 70 6f 69 6e 74 65 72 73 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 | the.two.pointers...*Note.Figure. |
| 9aee0 | 33 2d 31 39 3a 3a 0a 69 6c 6c 75 73 74 72 61 74 65 73 20 74 68 69 73 20 72 65 70 72 65 73 65 6e | 3-19::.illustrates.this.represen |
| 9af00 | 74 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 31 39 3a 2a 20 49 6d 70 | tation........*Figure.3.19:*.Imp |
| 9af20 | 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 20 71 75 65 75 65 20 61 73 20 61 20 6c 69 73 74 | lementation.of.a.queue.as.a.list |
| 9af40 | 20 77 69 74 68 20 66 72 6f 6e 74 20 61 6e 64 0a 20 20 20 20 20 72 65 61 72 20 70 6f 69 6e 74 65 | .with.front.and......rear.pointe |
| 9af60 | 72 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a | rs....................+---+---+. |
| 9af80 | 20 20 20 20 20 20 20 20 20 20 20 20 71 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 2d 2d | ............q.-->|.*.|.*-+------ |
| 9afa0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -------------+.................. |
| 9afc0 | 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | +-|-+---+...................|... |
| 9afe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .................|.............. |
| 9b000 | 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........|.................... |
| 9b020 | 7c 20 66 72 6f 6e 74 2d 70 74 72 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 72 65 61 72 | |.front-ptr...............|.rear |
| 9b040 | 2d 70 74 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 | -ptr....................V....... |
| 9b060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..................V............. |
| 9b080 | 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 2d | ...+---+---+....+---+---+....+-- |
| 9b0a0 | 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 2a 20 7c 20 2a 2d 2b 2d | -+---+................|.*.|.*-+- |
| 9b0c0 | 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 | -->|.*.|.*-+--->|.*.|./.|....... |
| 9b0e0 | 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 | .........+-|-+---+....+-|-+---+. |
| 9b100 | 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 | ...+-|-+---+..................V. |
| 9b120 | 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 | ...........V............V....... |
| 9b140 | 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 | .........+---+........+---+..... |
| 9b160 | 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 61 20 7c 20 20 20 | ...+---+................|.a.|... |
| 9b180 | 20 20 20 20 20 7c 20 62 20 7c 20 20 20 20 20 20 20 20 7c 20 63 20 7c 0a 20 20 20 20 20 20 20 20 | .....|.b.|........|.c.|......... |
| 9b1a0 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 | .......+---+........+---+....... |
| 9b1c0 | 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 54 6f 20 64 65 66 69 6e 65 20 74 68 65 20 71 75 65 75 65 20 6f | .+---+.....To.define.the.queue.o |
| 9b1e0 | 70 65 72 61 74 69 6f 6e 73 20 77 65 20 75 73 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 | perations.we.use.the.following.p |
| 9b200 | 72 6f 63 65 64 75 72 65 73 2c 0a 77 68 69 63 68 20 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 73 65 | rocedures,.which.enable.us.to.se |
| 9b220 | 6c 65 63 74 20 61 6e 64 20 74 6f 20 6d 6f 64 69 66 79 20 74 68 65 20 66 72 6f 6e 74 20 61 6e 64 | lect.and.to.modify.the.front.and |
| 9b240 | 20 72 65 61 72 20 70 6f 69 6e 74 65 72 73 20 6f 66 0a 61 20 71 75 65 75 65 3a 0a 0a 20 20 20 20 | .rear.pointers.of.a.queue:...... |
| 9b260 | 20 28 64 65 66 69 6e 65 20 28 66 72 6f 6e 74 2d 70 74 72 20 71 75 65 75 65 29 20 28 63 61 72 20 | .(define.(front-ptr.queue).(car. |
| 9b280 | 71 75 65 75 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 61 72 2d 70 74 72 20 | queue)).......(define.(rear-ptr. |
| 9b2a0 | 71 75 65 75 65 29 20 28 63 64 72 20 71 75 65 75 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | queue).(cdr.queue)).......(defin |
| 9b2c0 | 65 20 28 73 65 74 2d 66 72 6f 6e 74 2d 70 74 72 21 20 71 75 65 75 65 20 69 74 65 6d 29 20 28 73 | e.(set-front-ptr!.queue.item).(s |
| 9b2e0 | 65 74 2d 63 61 72 21 20 71 75 65 75 65 20 69 74 65 6d 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 | et-car!.queue.item)).......(defi |
| 9b300 | 6e 65 20 28 73 65 74 2d 72 65 61 72 2d 70 74 72 21 20 71 75 65 75 65 20 69 74 65 6d 29 20 28 73 | ne.(set-rear-ptr!.queue.item).(s |
| 9b320 | 65 74 2d 63 64 72 21 20 71 75 65 75 65 20 69 74 65 6d 29 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 | et-cdr!.queue.item)).....Now.we. |
| 9b340 | 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 61 63 74 75 61 6c 20 71 75 65 75 65 20 6f | can.implement.the.actual.queue.o |
| 9b360 | 70 65 72 61 74 69 6f 6e 73 2e 20 20 57 65 20 77 69 6c 6c 20 63 6f 6e 73 69 64 65 72 0a 61 20 71 | perations...We.will.consider.a.q |
| 9b380 | 75 65 75 65 20 74 6f 20 62 65 20 65 6d 70 74 79 20 69 66 20 69 74 73 20 66 72 6f 6e 74 20 70 6f | ueue.to.be.empty.if.its.front.po |
| 9b3a0 | 69 6e 74 65 72 20 69 73 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 28 | inter.is.the.empty.list:.......( |
| 9b3c0 | 64 65 66 69 6e 65 20 28 65 6d 70 74 79 2d 71 75 65 75 65 3f 20 71 75 65 75 65 29 20 28 6e 75 6c | define.(empty-queue?.queue).(nul |
| 9b3e0 | 6c 3f 20 28 66 72 6f 6e 74 2d 70 74 72 20 71 75 65 75 65 29 29 29 0a 0a 20 20 20 54 68 65 20 60 | l?.(front-ptr.queue))).....The.` |
| 9b400 | 6d 61 6b 65 2d 71 75 65 75 65 27 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 72 65 74 75 72 6e 73 2c | make-queue'.constructor.returns, |
| 9b420 | 20 61 73 20 61 6e 20 69 6e 69 74 69 61 6c 6c 79 20 65 6d 70 74 79 20 71 75 65 75 65 2c 20 61 0a | .as.an.initially.empty.queue,.a. |
| 9b440 | 70 61 69 72 20 77 68 6f 73 65 20 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 20 61 72 65 20 62 | pair.whose.`car'.and.`cdr'.are.b |
| 9b460 | 6f 74 68 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | oth.the.empty.list:.......(defin |
| 9b480 | 65 20 28 6d 61 6b 65 2d 71 75 65 75 65 29 20 28 63 6f 6e 73 20 27 28 29 20 27 28 29 29 29 0a 0a | e.(make-queue).(cons.'().'())).. |
| 9b4a0 | 20 20 20 54 6f 20 73 65 6c 65 63 74 20 74 68 65 20 69 74 65 6d 20 61 74 20 74 68 65 20 66 72 6f | ...To.select.the.item.at.the.fro |
| 9b4c0 | 6e 74 20 6f 66 20 74 68 65 20 71 75 65 75 65 2c 20 77 65 20 72 65 74 75 72 6e 20 74 68 65 20 60 | nt.of.the.queue,.we.return.the.` |
| 9b4e0 | 63 61 72 27 20 6f 66 0a 74 68 65 20 70 61 69 72 20 69 6e 64 69 63 61 74 65 64 20 62 79 20 74 68 | car'.of.the.pair.indicated.by.th |
| 9b500 | 65 20 66 72 6f 6e 74 20 70 6f 69 6e 74 65 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | e.front.pointer:.......(define.( |
| 9b520 | 66 72 6f 6e 74 2d 71 75 65 75 65 20 71 75 65 75 65 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 65 | front-queue.queue)........(if.(e |
| 9b540 | 6d 70 74 79 2d 71 75 65 75 65 3f 20 71 75 65 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 65 | mpty-queue?.queue)............(e |
| 9b560 | 72 72 6f 72 20 22 46 52 4f 4e 54 20 63 61 6c 6c 65 64 20 77 69 74 68 20 61 6e 20 65 6d 70 74 79 | rror."FRONT.called.with.an.empty |
| 9b580 | 20 71 75 65 75 65 22 20 71 75 65 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 28 | .queue".queue)............(car.( |
| 9b5a0 | 66 72 6f 6e 74 2d 70 74 72 20 71 75 65 75 65 29 29 29 29 0a 0a 20 20 20 54 6f 20 69 6e 73 65 72 | front-ptr.queue)))).....To.inser |
| 9b5c0 | 74 20 61 6e 20 69 74 65 6d 20 69 6e 20 61 20 71 75 65 75 65 2c 20 77 65 20 66 6f 6c 6c 6f 77 20 | t.an.item.in.a.queue,.we.follow. |
| 9b5e0 | 74 68 65 20 6d 65 74 68 6f 64 20 77 68 6f 73 65 20 72 65 73 75 6c 74 20 69 73 0a 69 6e 64 69 63 | the.method.whose.result.is.indic |
| 9b600 | 61 74 65 64 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 32 30 3a 3a 2e 20 20 57 65 | ated.in.*Note.Figure.3-20::...We |
| 9b620 | 20 66 69 72 73 74 20 63 72 65 61 74 65 20 61 20 6e 65 77 20 70 61 69 72 20 77 68 6f 73 65 0a 60 | .first.create.a.new.pair.whose.` |
| 9b640 | 63 61 72 27 20 69 73 20 74 68 65 20 69 74 65 6d 20 74 6f 20 62 65 20 69 6e 73 65 72 74 65 64 20 | car'.is.the.item.to.be.inserted. |
| 9b660 | 61 6e 64 20 77 68 6f 73 65 20 60 63 64 72 27 20 69 73 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 | and.whose.`cdr'.is.the.empty.lis |
| 9b680 | 74 2e 20 20 49 66 0a 74 68 65 20 71 75 65 75 65 20 77 61 73 20 69 6e 69 74 69 61 6c 6c 79 20 65 | t...If.the.queue.was.initially.e |
| 9b6a0 | 6d 70 74 79 2c 20 77 65 20 73 65 74 20 74 68 65 20 66 72 6f 6e 74 20 61 6e 64 20 72 65 61 72 20 | mpty,.we.set.the.front.and.rear. |
| 9b6c0 | 70 6f 69 6e 74 65 72 73 20 6f 66 0a 74 68 65 20 71 75 65 75 65 20 74 6f 20 74 68 69 73 20 6e 65 | pointers.of.the.queue.to.this.ne |
| 9b6e0 | 77 20 70 61 69 72 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 77 65 20 6d 6f 64 69 66 79 20 74 68 | w.pair...Otherwise,.we.modify.th |
| 9b700 | 65 20 66 69 6e 61 6c 20 70 61 69 72 20 69 6e 20 74 68 65 0a 71 75 65 75 65 20 74 6f 20 70 6f 69 | e.final.pair.in.the.queue.to.poi |
| 9b720 | 6e 74 20 74 6f 20 74 68 65 20 6e 65 77 20 70 61 69 72 2c 20 61 6e 64 20 61 6c 73 6f 20 73 65 74 | nt.to.the.new.pair,.and.also.set |
| 9b740 | 20 74 68 65 20 72 65 61 72 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 0a 6e 65 77 20 70 61 69 | .the.rear.pointer.to.the.new.pai |
| 9b760 | 72 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 32 30 3a 2a 20 52 65 73 75 6c 74 20 6f | r........*Figure.3.20:*.Result.o |
| 9b780 | 66 20 75 73 69 6e 67 20 60 28 69 6e 73 65 72 74 2d 71 75 65 75 65 21 20 20 71 20 27 64 29 27 20 | f.using.`(insert-queue!..q.'d)'. |
| 9b7a0 | 6f 6e 20 74 68 65 0a 20 20 20 20 20 71 75 65 75 65 20 6f 66 20 2a 4e 6f 74 65 20 46 69 67 75 72 | on.the......queue.of.*Note.Figur |
| 9b7c0 | 65 20 33 2d 31 39 3a 3a 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | e.3-19::....................+--- |
| 9b7e0 | 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 71 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b | +---+.............q.-->|.*.|.*-+ |
| 9b800 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 9b820 | 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 | +..................+-|-+---+.... |
| 9b840 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | ............................|... |
| 9b860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .................|.............. |
| 9b880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 | ........................|....... |
| 9b8a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 66 72 6f 6e 74 2d 70 74 72 20 20 20 20 20 20 20 20 | .............|.front-ptr........ |
| 9b8c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 72 65 61 72 2d 70 74 72 0a 20 | ....................|.rear-ptr.. |
| 9b8e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..................V............. |
| 9b900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 | .........................V...... |
| 9b920 | 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b | ..........+---+---+....+---+---+ |
| 9b940 | 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 | ....+---+---+....+---+---+...... |
| 9b960 | 20 20 20 20 20 20 20 20 20 20 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b | ..........|.*.|.*-+--->|.*.|.*-+ |
| 9b980 | 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 | --->|.*.|.*-+--->|.*.|./.|...... |
| 9b9a0 | 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b | ..........+-|-+---+....+-|-+---+ |
| 9b9c0 | 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 | ....+-|-+---+....+-|-+---+...... |
| 9b9e0 | 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 | ............V............V...... |
| 9ba00 | 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 | ......V............V............ |
| 9ba20 | 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d | ....+---+........+---+........+- |
| 9ba40 | 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --+........+---+................ |
| 9ba60 | 7c 20 61 20 7c 20 20 20 20 20 20 20 20 7c 20 62 20 7c 20 20 20 20 20 20 20 20 7c 20 63 20 7c 20 | |.a.|........|.b.|........|.c.|. |
| 9ba80 | 20 20 20 20 20 20 20 7c 20 64 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | .......|.d.|................+--- |
| 9baa0 | 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 | +........+---+........+---+..... |
| 9bac0 | 20 20 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 73 65 72 74 2d 71 | ...+---+.......(define.(insert-q |
| 9bae0 | 75 65 75 65 21 20 71 75 65 75 65 20 69 74 65 6d 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 | ueue!.queue.item)........(let.(( |
| 9bb00 | 6e 65 77 2d 70 61 69 72 20 28 63 6f 6e 73 20 69 74 65 6d 20 27 28 29 29 29 29 0a 20 20 20 20 20 | new-pair.(cons.item.'())))...... |
| 9bb20 | 20 20 20 20 28 63 6f 6e 64 20 28 28 65 6d 70 74 79 2d 71 75 65 75 65 3f 20 71 75 65 75 65 29 0a | ....(cond.((empty-queue?.queue). |
| 9bb40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 66 72 6f 6e 74 2d 70 74 72 21 20 | ................(set-front-ptr!. |
| 9bb60 | 71 75 65 75 65 20 6e 65 77 2d 70 61 69 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | queue.new-pair)................. |
| 9bb80 | 28 73 65 74 2d 72 65 61 72 2d 70 74 72 21 20 71 75 65 75 65 20 6e 65 77 2d 70 61 69 72 29 0a 20 | (set-rear-ptr!.queue.new-pair).. |
| 9bba0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 71 75 65 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 | ...............queue)........... |
| 9bbc0 | 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d | .....(else.................(set- |
| 9bbe0 | 63 64 72 21 20 28 72 65 61 72 2d 70 74 72 20 71 75 65 75 65 29 20 6e 65 77 2d 70 61 69 72 29 0a | cdr!.(rear-ptr.queue).new-pair). |
| 9bc00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 72 65 61 72 2d 70 74 72 21 20 71 | ................(set-rear-ptr!.q |
| 9bc20 | 75 65 75 65 20 6e 65 77 2d 70 61 69 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 71 | ueue.new-pair).................q |
| 9bc40 | 75 65 75 65 29 29 29 29 0a 0a 20 20 20 54 6f 20 64 65 6c 65 74 65 20 74 68 65 20 69 74 65 6d 20 | ueue)))).....To.delete.the.item. |
| 9bc60 | 61 74 20 74 68 65 20 66 72 6f 6e 74 20 6f 66 20 74 68 65 20 71 75 65 75 65 2c 20 77 65 20 6d 65 | at.the.front.of.the.queue,.we.me |
| 9bc80 | 72 65 6c 79 20 6d 6f 64 69 66 79 20 74 68 65 0a 66 72 6f 6e 74 20 70 6f 69 6e 74 65 72 20 73 6f | rely.modify.the.front.pointer.so |
| 9bca0 | 20 74 68 61 74 20 69 74 20 6e 6f 77 20 70 6f 69 6e 74 73 20 61 74 20 74 68 65 20 73 65 63 6f 6e | .that.it.now.points.at.the.secon |
| 9bcc0 | 64 20 69 74 65 6d 20 69 6e 20 74 68 65 20 71 75 65 75 65 2c 0a 77 68 69 63 68 20 63 61 6e 20 62 | d.item.in.the.queue,.which.can.b |
| 9bce0 | 65 20 66 6f 75 6e 64 20 62 79 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 65 20 60 63 64 72 27 20 70 | e.found.by.following.the.`cdr'.p |
| 9bd00 | 6f 69 6e 74 65 72 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 69 74 65 6d 0a 28 73 65 65 20 2a 4e | ointer.of.the.first.item.(see.*N |
| 9bd20 | 6f 74 65 20 46 69 67 75 72 65 20 33 2d 32 31 3a 3a 29 3a 28 31 29 0a 0a 20 20 20 20 20 2a 46 69 | ote.Figure.3-21::):(1).......*Fi |
| 9bd40 | 67 75 72 65 20 33 2e 32 31 3a 2a 20 52 65 73 75 6c 74 20 6f 66 20 75 73 69 6e 67 20 60 28 64 65 | gure.3.21:*.Result.of.using.`(de |
| 9bd60 | 6c 65 74 65 2d 71 75 65 75 65 21 20 20 71 29 27 20 6f 6e 20 74 68 65 20 71 75 65 75 65 0a 20 20 | lete-queue!..q)'.on.the.queue... |
| 9bd80 | 20 20 20 6f 66 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 32 30 3a 3a 2e 0a 0a 20 20 20 20 | ...of.*Note.Figure.3-20::....... |
| 9bda0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 | .............+---+---+.......... |
| 9bdc0 | 20 20 20 71 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ...q.-->|.*.|.*-+--------------- |
| 9bde0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | -----------------+.............. |
| 9be00 | 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....+-|-+---+................... |
| 9be20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............|.................. |
| 9be40 | 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..+------------+................ |
| 9be60 | 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .........|...................... |
| 9be80 | 20 66 72 6f 6e 74 2d 70 74 72 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .front-ptr.|.................... |
| 9bea0 | 20 20 20 20 20 7c 20 72 65 61 72 2d 70 74 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....|.rear-ptr................. |
| 9bec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................V............... |
| 9bee0 | 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b | ..........V................+---+ |
| 9bf00 | 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 | ---+....+---+---+....+---+---+.. |
| 9bf20 | 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 2a 20 7c | ..+---+---+................|.*.| |
| 9bf40 | 20 2a 2d 2b 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d | .*-+--->|.*.|.*-+--->|.*.|.*-+-- |
| 9bf60 | 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b | ->|.*.|./.|................+-|-+ |
| 9bf80 | 2d 2d 2d 2b 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 | ---+....+-|-+---+....+-|-+---+.. |
| 9bfa0 | 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 | ..+-|-+---+..................V.. |
| 9bfc0 | 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 | ..........V............V........ |
| 9bfe0 | 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 | ....V................+---+...... |
| 9c000 | 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d | ..+---+........+---+........+--- |
| 9c020 | 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 61 20 7c 20 20 20 20 20 20 20 20 7c 20 | +................|.a.|........|. |
| 9c040 | 62 20 7c 20 20 20 20 20 20 20 20 7c 20 63 20 7c 20 20 20 20 20 20 20 20 7c 20 64 20 7c 0a 20 20 | b.|........|.c.|........|.d.|... |
| 9c060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 | .............+---+........+---+. |
| 9c080 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 0a 20 20 20 20 20 | .......+---+........+---+....... |
| 9c0a0 | 28 64 65 66 69 6e 65 20 28 64 65 6c 65 74 65 2d 71 75 65 75 65 21 20 71 75 65 75 65 29 0a 20 20 | (define.(delete-queue!.queue)... |
| 9c0c0 | 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 6d 70 74 79 2d 71 75 65 75 65 3f 20 71 75 65 75 65 29 | .....(cond.((empty-queue?.queue) |
| 9c0e0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 44 45 4c 45 54 45 21 20 63 | ...............(error."DELETE!.c |
| 9c100 | 61 6c 6c 65 64 20 77 69 74 68 20 61 6e 20 65 6d 70 74 79 20 71 75 65 75 65 22 20 71 75 65 75 65 | alled.with.an.empty.queue".queue |
| 9c120 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 | ))..............(else........... |
| 9c140 | 20 20 20 20 28 73 65 74 2d 66 72 6f 6e 74 2d 70 74 72 21 20 71 75 65 75 65 20 28 63 64 72 20 28 | ....(set-front-ptr!.queue.(cdr.( |
| 9c160 | 66 72 6f 6e 74 2d 70 74 72 20 71 75 65 75 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | front-ptr.queue))).............. |
| 9c180 | 20 71 75 65 75 65 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 32 31 3a 2a | .queue))).......*Exercise.3.21:* |
| 9c1a0 | 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 64 65 63 69 64 65 73 20 74 6f 20 74 65 73 74 20 74 | .Ben.Bitdiddle.decides.to.test.t |
| 9c1c0 | 68 65 20 71 75 65 75 65 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 64 65 73 | he.queue......implementation.des |
| 9c1e0 | 63 72 69 62 65 64 20 61 62 6f 76 65 2e 20 20 48 65 20 74 79 70 65 73 20 69 6e 20 74 68 65 20 70 | cribed.above...He.types.in.the.p |
| 9c200 | 72 6f 63 65 64 75 72 65 73 20 74 6f 20 74 68 65 0a 20 20 20 20 20 4c 69 73 70 20 69 6e 74 65 72 | rocedures.to.the......Lisp.inter |
| 9c220 | 70 72 65 74 65 72 20 61 6e 64 20 70 72 6f 63 65 65 64 73 20 74 6f 20 74 72 79 20 74 68 65 6d 20 | preter.and.proceeds.to.try.them. |
| 9c240 | 6f 75 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 71 31 20 28 6d 61 6b 65 | out:............(define.q1.(make |
| 9c260 | 2d 71 75 65 75 65 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 69 6e 73 65 72 74 2d 71 75 65 75 | -queue))............(insert-queu |
| 9c280 | 65 21 20 71 31 20 27 61 29 0a 20 20 20 20 20 20 20 20 20 20 28 28 61 29 20 61 29 0a 0a 20 20 20 | e!.q1.'a)...........((a).a)..... |
| 9c2a0 | 20 20 20 20 20 20 20 28 69 6e 73 65 72 74 2d 71 75 65 75 65 21 20 71 31 20 27 62 29 0a 20 20 20 | .......(insert-queue!.q1.'b).... |
| 9c2c0 | 20 20 20 20 20 20 20 28 28 61 20 62 29 20 62 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 6c | .......((a.b).b)............(del |
| 9c2e0 | 65 74 65 2d 71 75 65 75 65 21 20 71 31 29 0a 20 20 20 20 20 20 20 20 20 20 28 28 62 29 20 62 29 | ete-queue!.q1)...........((b).b) |
| 9c300 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 71 75 65 75 65 21 20 71 31 29 0a 20 | ............(delete-queue!.q1).. |
| 9c320 | 20 20 20 20 20 20 20 20 20 28 28 29 20 62 29 0a 0a 20 20 20 20 20 22 49 74 27 73 20 61 6c 6c 20 | .........(().b)......."It's.all. |
| 9c340 | 77 72 6f 6e 67 21 22 20 68 65 20 63 6f 6d 70 6c 61 69 6e 73 2e 20 20 22 54 68 65 20 69 6e 74 65 | wrong!".he.complains..."The.inte |
| 9c360 | 72 70 72 65 74 65 72 27 73 20 72 65 73 70 6f 6e 73 65 20 73 68 6f 77 73 0a 20 20 20 20 20 74 68 | rpreter's.response.shows......th |
| 9c380 | 61 74 20 74 68 65 20 6c 61 73 74 20 69 74 65 6d 20 69 73 20 69 6e 73 65 72 74 65 64 20 69 6e 74 | at.the.last.item.is.inserted.int |
| 9c3a0 | 6f 20 74 68 65 20 71 75 65 75 65 20 74 77 69 63 65 2e 20 20 41 6e 64 20 77 68 65 6e 20 49 0a 20 | o.the.queue.twice...And.when.I.. |
| 9c3c0 | 20 20 20 20 64 65 6c 65 74 65 20 62 6f 74 68 20 69 74 65 6d 73 2c 20 74 68 65 20 73 65 63 6f 6e | ....delete.both.items,.the.secon |
| 9c3e0 | 64 20 60 62 27 20 69 73 20 73 74 69 6c 6c 20 74 68 65 72 65 2c 20 73 6f 20 74 68 65 20 71 75 65 | d.`b'.is.still.there,.so.the.que |
| 9c400 | 75 65 0a 20 20 20 20 20 69 73 6e 27 74 20 65 6d 70 74 79 2c 20 65 76 65 6e 20 74 68 6f 75 67 68 | ue......isn't.empty,.even.though |
| 9c420 | 20 69 74 27 73 20 73 75 70 70 6f 73 65 64 20 74 6f 20 62 65 2e 22 20 20 45 76 61 20 4c 75 20 41 | .it's.supposed.to.be."..Eva.Lu.A |
| 9c440 | 74 6f 72 0a 20 20 20 20 20 73 75 67 67 65 73 74 73 20 74 68 61 74 20 42 65 6e 20 68 61 73 20 6d | tor......suggests.that.Ben.has.m |
| 9c460 | 69 73 75 6e 64 65 72 73 74 6f 6f 64 20 77 68 61 74 20 69 73 20 68 61 70 70 65 6e 69 6e 67 2e 20 | isunderstood.what.is.happening.. |
| 9c480 | 20 22 49 74 27 73 20 6e 6f 74 0a 20 20 20 20 20 74 68 61 74 20 74 68 65 20 69 74 65 6d 73 20 61 | ."It's.not......that.the.items.a |
| 9c4a0 | 72 65 20 67 6f 69 6e 67 20 69 6e 74 6f 20 74 68 65 20 71 75 65 75 65 20 74 77 69 63 65 2c 22 20 | re.going.into.the.queue.twice,". |
| 9c4c0 | 73 68 65 20 65 78 70 6c 61 69 6e 73 2e 0a 20 20 20 20 20 22 49 74 27 73 20 6a 75 73 74 20 74 68 | she.explains......."It's.just.th |
| 9c4e0 | 61 74 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 4c 69 73 70 20 70 72 69 6e 74 65 72 20 64 6f 65 | at.the.standard.Lisp.printer.doe |
| 9c500 | 73 6e 27 74 20 6b 6e 6f 77 20 68 6f 77 20 74 6f 20 6d 61 6b 65 0a 20 20 20 20 20 73 65 6e 73 65 | sn't.know.how.to.make......sense |
| 9c520 | 20 6f 66 20 74 68 65 20 71 75 65 75 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 49 | .of.the.queue.representation...I |
| 9c540 | 66 20 79 6f 75 20 77 61 6e 74 20 74 6f 20 73 65 65 20 74 68 65 20 71 75 65 75 65 0a 20 20 20 20 | f.you.want.to.see.the.queue..... |
| 9c560 | 20 70 72 69 6e 74 65 64 20 63 6f 72 72 65 63 74 6c 79 2c 20 79 6f 75 27 6c 6c 20 68 61 76 65 20 | .printed.correctly,.you'll.have. |
| 9c580 | 74 6f 20 64 65 66 69 6e 65 20 79 6f 75 72 20 6f 77 6e 20 70 72 69 6e 74 20 70 72 6f 63 65 64 75 | to.define.your.own.print.procedu |
| 9c5a0 | 72 65 0a 20 20 20 20 20 66 6f 72 20 71 75 65 75 65 73 2e 22 20 45 78 70 6c 61 69 6e 20 77 68 61 | re......for.queues.".Explain.wha |
| 9c5c0 | 74 20 45 76 61 20 4c 75 20 69 73 20 74 61 6c 6b 69 6e 67 20 61 62 6f 75 74 2e 20 20 49 6e 20 70 | t.Eva.Lu.is.talking.about...In.p |
| 9c5e0 | 61 72 74 69 63 75 6c 61 72 2c 0a 20 20 20 20 20 73 68 6f 77 20 77 68 79 20 42 65 6e 27 73 20 65 | articular,......show.why.Ben's.e |
| 9c600 | 78 61 6d 70 6c 65 73 20 70 72 6f 64 75 63 65 20 74 68 65 20 70 72 69 6e 74 65 64 20 72 65 73 75 | xamples.produce.the.printed.resu |
| 9c620 | 6c 74 73 20 74 68 61 74 20 74 68 65 79 20 64 6f 2e 0a 20 20 20 20 20 44 65 66 69 6e 65 20 61 20 | lts.that.they.do.......Define.a. |
| 9c640 | 70 72 6f 63 65 64 75 72 65 20 60 70 72 69 6e 74 2d 71 75 65 75 65 27 20 74 68 61 74 20 74 61 6b | procedure.`print-queue'.that.tak |
| 9c660 | 65 73 20 61 20 71 75 65 75 65 20 61 73 20 69 6e 70 75 74 20 61 6e 64 0a 20 20 20 20 20 70 72 69 | es.a.queue.as.input.and......pri |
| 9c680 | 6e 74 73 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 74 68 65 | nts.the.sequence.of.items.in.the |
| 9c6a0 | 20 71 75 65 75 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 32 32 3a 2a 20 49 | .queue........*Exercise.3.22:*.I |
| 9c6c0 | 6e 73 74 65 61 64 20 6f 66 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 20 71 75 65 75 65 20 61 | nstead.of.representing.a.queue.a |
| 9c6e0 | 73 20 61 20 70 61 69 72 20 6f 66 0a 20 20 20 20 20 70 6f 69 6e 74 65 72 73 2c 20 77 65 20 63 61 | s.a.pair.of......pointers,.we.ca |
| 9c700 | 6e 20 62 75 69 6c 64 20 61 20 71 75 65 75 65 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 77 | n.build.a.queue.as.a.procedure.w |
| 9c720 | 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 2e 0a 20 20 20 20 20 54 68 65 20 6c 6f 63 61 6c 20 | ith.local.state.......The.local. |
| 9c740 | 73 74 61 74 65 20 77 69 6c 6c 20 63 6f 6e 73 69 73 74 20 6f 66 20 70 6f 69 6e 74 65 72 73 20 74 | state.will.consist.of.pointers.t |
| 9c760 | 6f 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 61 6e 64 20 74 68 65 0a 20 20 20 20 20 65 6e 64 | o.the.beginning.and.the......end |
| 9c780 | 20 6f 66 20 61 6e 20 6f 72 64 69 6e 61 72 79 20 6c 69 73 74 2e 20 20 54 68 75 73 2c 20 74 68 65 | .of.an.ordinary.list...Thus,.the |
| 9c7a0 | 20 60 6d 61 6b 65 2d 71 75 65 75 65 27 20 70 72 6f 63 65 64 75 72 65 20 77 69 6c 6c 0a 20 20 20 | .`make-queue'.procedure.will.... |
| 9c7c0 | 20 20 68 61 76 65 20 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 | ..have.the.form............(defi |
| 9c7e0 | 6e 65 20 28 6d 61 6b 65 2d 71 75 65 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 | ne.(make-queue).............(let |
| 9c800 | 20 28 28 66 72 6f 6e 74 2d 70 74 72 20 2e 2e 2e 20 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .((front-ptr.....).............. |
| 9c820 | 20 20 20 20 20 28 72 65 61 72 2d 70 74 72 20 2e 2e 2e 20 29 29 0a 20 20 20 20 20 20 20 20 20 20 | .....(rear-ptr.....))........... |
| 9c840 | 20 20 20 20 3c 44 45 46 49 4e 49 54 49 4f 4e 53 20 4f 46 20 49 4e 54 45 52 4e 41 4c 20 50 52 4f | ....<DEFINITIONS.OF.INTERNAL.PRO |
| 9c860 | 43 45 44 55 52 45 53 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | CEDURES>...............(define.( |
| 9c880 | 64 69 73 70 61 74 63 68 20 6d 29 20 2e 2e 2e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 | dispatch.m)....)...............d |
| 9c8a0 | 69 73 70 61 74 63 68 29 29 0a 0a 20 20 20 20 20 43 6f 6d 70 6c 65 74 65 20 74 68 65 20 64 65 66 | ispatch)).......Complete.the.def |
| 9c8c0 | 69 6e 69 74 69 6f 6e 20 6f 66 20 60 6d 61 6b 65 2d 71 75 65 75 65 27 20 61 6e 64 20 70 72 6f 76 | inition.of.`make-queue'.and.prov |
| 9c8e0 | 69 64 65 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 | ide......implementations.of.the. |
| 9c900 | 71 75 65 75 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 75 73 69 6e 67 20 74 68 69 73 20 72 65 70 72 | queue.operations.using.this.repr |
| 9c920 | 65 73 65 6e 74 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 32 33 | esentation........*Exercise.3.23 |
| 9c940 | 3a 2a 20 41 20 22 64 65 71 75 65 22 20 28 22 64 6f 75 62 6c 65 2d 65 6e 64 65 64 20 71 75 65 75 | :*.A."deque".("double-ended.queu |
| 9c960 | 65 22 29 20 69 73 20 61 20 73 65 71 75 65 6e 63 65 20 69 6e 0a 20 20 20 20 20 77 68 69 63 68 20 | e").is.a.sequence.in......which. |
| 9c980 | 69 74 65 6d 73 20 63 61 6e 20 62 65 20 69 6e 73 65 72 74 65 64 20 61 6e 64 20 64 65 6c 65 74 65 | items.can.be.inserted.and.delete |
| 9c9a0 | 64 20 61 74 20 65 69 74 68 65 72 20 74 68 65 20 66 72 6f 6e 74 20 6f 72 20 74 68 65 0a 20 20 20 | d.at.either.the.front.or.the.... |
| 9c9c0 | 20 20 72 65 61 72 2e 20 20 4f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 64 65 71 75 65 73 20 61 72 | ..rear...Operations.on.deques.ar |
| 9c9e0 | 65 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 6d 61 6b 65 2d 64 65 71 75 65 27 2c 20 | e.the.constructor.`make-deque',. |
| 9ca00 | 74 68 65 0a 20 20 20 20 20 70 72 65 64 69 63 61 74 65 20 60 65 6d 70 74 79 2d 64 65 71 75 65 3f | the......predicate.`empty-deque? |
| 9ca20 | 27 2c 20 73 65 6c 65 63 74 6f 72 73 20 60 66 72 6f 6e 74 2d 64 65 71 75 65 27 20 61 6e 64 0a 20 | ',.selectors.`front-deque'.and.. |
| 9ca40 | 20 20 20 20 60 72 65 61 72 2d 64 65 71 75 65 27 2c 20 61 6e 64 20 6d 75 74 61 74 6f 72 73 20 60 | ....`rear-deque',.and.mutators.` |
| 9ca60 | 66 72 6f 6e 74 2d 69 6e 73 65 72 74 2d 64 65 71 75 65 21 27 2c 0a 20 20 20 20 20 60 72 65 61 72 | front-insert-deque!',......`rear |
| 9ca80 | 2d 69 6e 73 65 72 74 2d 64 65 71 75 65 21 27 2c 20 60 66 72 6f 6e 74 2d 64 65 6c 65 74 65 2d 64 | -insert-deque!',.`front-delete-d |
| 9caa0 | 65 71 75 65 21 27 2c 20 61 6e 64 0a 20 20 20 20 20 60 72 65 61 72 2d 64 65 6c 65 74 65 2d 64 65 | eque!',.and......`rear-delete-de |
| 9cac0 | 71 75 65 21 27 2e 20 20 53 68 6f 77 20 68 6f 77 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 64 65 | que!'...Show.how.to.represent.de |
| 9cae0 | 71 75 65 73 20 75 73 69 6e 67 20 70 61 69 72 73 2c 0a 20 20 20 20 20 61 6e 64 20 67 69 76 65 20 | ques.using.pairs,......and.give. |
| 9cb00 | 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e | implementations.of.the.operation |
| 9cb20 | 73 2e 28 32 29 20 20 41 6c 6c 20 6f 70 65 72 61 74 69 6f 6e 73 0a 20 20 20 20 20 73 68 6f 75 6c | s.(2)..All.operations......shoul |
| 9cb40 | 64 20 62 65 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 69 6e 20 5b 74 68 65 74 61 5d 28 31 29 20 | d.be.accomplished.in.[theta](1). |
| 9cb60 | 73 74 65 70 73 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 | steps......----------.Footnotes. |
| 9cb80 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 66 20 74 68 65 20 66 69 72 73 74 20 | ----------.....(1).If.the.first. |
| 9cba0 | 69 74 65 6d 20 69 73 20 74 68 65 20 66 69 6e 61 6c 20 69 74 65 6d 20 69 6e 20 74 68 65 20 71 75 | item.is.the.final.item.in.the.qu |
| 9cbc0 | 65 75 65 2c 20 74 68 65 20 66 72 6f 6e 74 0a 70 6f 69 6e 74 65 72 20 77 69 6c 6c 20 62 65 20 74 | eue,.the.front.pointer.will.be.t |
| 9cbe0 | 68 65 20 65 6d 70 74 79 20 6c 69 73 74 20 61 66 74 65 72 20 74 68 65 20 64 65 6c 65 74 69 6f 6e | he.empty.list.after.the.deletion |
| 9cc00 | 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 6d 61 72 6b 20 74 68 65 0a 71 75 65 75 65 20 61 73 20 65 | ,.which.will.mark.the.queue.as.e |
| 9cc20 | 6d 70 74 79 3b 20 77 65 20 6e 65 65 64 6e 27 74 20 77 6f 72 72 79 20 61 62 6f 75 74 20 75 70 64 | mpty;.we.needn't.worry.about.upd |
| 9cc40 | 61 74 69 6e 67 20 74 68 65 20 72 65 61 72 20 70 6f 69 6e 74 65 72 2c 20 77 68 69 63 68 0a 77 69 | ating.the.rear.pointer,.which.wi |
| 9cc60 | 6c 6c 20 73 74 69 6c 6c 20 70 6f 69 6e 74 20 74 6f 20 74 68 65 20 64 65 6c 65 74 65 64 20 69 74 | ll.still.point.to.the.deleted.it |
| 9cc80 | 65 6d 2c 20 62 65 63 61 75 73 65 20 60 65 6d 70 74 79 2d 71 75 65 75 65 3f 27 20 6c 6f 6f 6b 73 | em,.because.`empty-queue?'.looks |
| 9cca0 | 20 6f 6e 6c 79 0a 61 74 20 74 68 65 20 66 72 6f 6e 74 20 70 6f 69 6e 74 65 72 2e 0a 0a 20 20 20 | .only.at.the.front.pointer...... |
| 9ccc0 | 28 32 29 20 42 65 20 63 61 72 65 66 75 6c 20 6e 6f 74 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 69 | (2).Be.careful.not.to.make.the.i |
| 9cce0 | 6e 74 65 72 70 72 65 74 65 72 20 74 72 79 20 74 6f 20 70 72 69 6e 74 20 61 20 73 74 72 75 63 74 | nterpreter.try.to.print.a.struct |
| 9cd00 | 75 72 65 0a 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 63 79 63 6c 65 73 2e 20 20 28 53 65 65 20 | ure.that.contains.cycles...(See. |
| 9cd20 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 31 33 3a 3a 2e 29 0a 0a 1f 0a 46 69 6c 65 3a | *Note.Exercise.3-13::.)....File: |
| 9cd40 | 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 33 2d 33 2c 20 20 4e 65 78 74 3a | .sicp.info,..Node:.3-3-3,..Next: |
| 9cd60 | 20 33 2d 33 2d 34 2c 20 20 50 72 65 76 3a 20 33 2d 33 2d 32 2c 20 20 55 70 3a 20 33 2d 33 0a 0a | .3-3-4,..Prev:.3-3-2,..Up:.3-3.. |
| 9cd80 | 33 2e 33 2e 33 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 54 61 62 6c 65 73 0a 2d 2d 2d 2d 2d 2d | 3.3.3.Representing.Tables.------ |
| 9cda0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 68 65 6e 20 77 65 20 73 74 75 | -------------------..When.we.stu |
| 9cdc0 | 64 69 65 64 20 76 61 72 69 6f 75 73 20 77 61 79 73 20 6f 66 20 72 65 70 72 65 73 65 6e 74 69 6e | died.various.ways.of.representin |
| 9cde0 | 67 20 73 65 74 73 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 32 3a 3a 2c 0a 77 65 20 | g.sets.in.*Note.Chapter.2::,.we. |
| 9ce00 | 6d 65 6e 74 69 6f 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 33 2d 33 | mentioned.in.section.*Note.2-3-3 |
| 9ce20 | 3a 3a 20 74 68 65 20 74 61 73 6b 20 6f 66 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20 61 20 74 61 62 | ::.the.task.of.maintaining.a.tab |
| 9ce40 | 6c 65 0a 6f 66 20 72 65 63 6f 72 64 73 20 69 6e 64 65 78 65 64 20 62 79 20 69 64 65 6e 74 69 66 | le.of.records.indexed.by.identif |
| 9ce60 | 79 69 6e 67 20 6b 65 79 73 2e 20 20 49 6e 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | ying.keys...In.the.implementatio |
| 9ce80 | 6e 20 6f 66 0a 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 | n.of.data-directed.programming.i |
| 9cea0 | 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 33 3a 3a 2c 20 77 65 20 6d 61 64 65 | n.section.*Note.2-4-3::,.we.made |
| 9cec0 | 20 65 78 74 65 6e 73 69 76 65 0a 75 73 65 20 6f 66 20 74 77 6f 2d 64 69 6d 65 6e 73 69 6f 6e 61 | .extensive.use.of.two-dimensiona |
| 9cee0 | 6c 20 74 61 62 6c 65 73 2c 20 69 6e 20 77 68 69 63 68 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 | l.tables,.in.which.information.i |
| 9cf00 | 73 20 73 74 6f 72 65 64 20 61 6e 64 0a 72 65 74 72 69 65 76 65 64 20 75 73 69 6e 67 20 74 77 6f | s.stored.and.retrieved.using.two |
| 9cf20 | 20 6b 65 79 73 2e 20 20 48 65 72 65 20 77 65 20 73 65 65 20 68 6f 77 20 74 6f 20 62 75 69 6c 64 | .keys...Here.we.see.how.to.build |
| 9cf40 | 20 74 61 62 6c 65 73 20 61 73 20 6d 75 74 61 62 6c 65 0a 6c 69 73 74 20 73 74 72 75 63 74 75 72 | .tables.as.mutable.list.structur |
| 9cf60 | 65 73 2e 0a 0a 20 20 20 57 65 20 66 69 72 73 74 20 63 6f 6e 73 69 64 65 72 20 61 20 6f 6e 65 2d | es......We.first.consider.a.one- |
| 9cf80 | 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 74 61 62 6c 65 2c 20 69 6e 20 77 68 69 63 68 20 65 61 63 68 | dimensional.table,.in.which.each |
| 9cfa0 | 20 76 61 6c 75 65 20 69 73 0a 73 74 6f 72 65 64 20 75 6e 64 65 72 20 61 20 73 69 6e 67 6c 65 20 | .value.is.stored.under.a.single. |
| 9cfc0 | 6b 65 79 2e 20 20 57 65 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 74 61 62 6c 65 20 61 73 20 | key...We.implement.the.table.as. |
| 9cfe0 | 61 20 6c 69 73 74 20 6f 66 0a 72 65 63 6f 72 64 73 2c 20 65 61 63 68 20 6f 66 20 77 68 69 63 68 | a.list.of.records,.each.of.which |
| 9d000 | 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 61 20 70 61 69 72 20 63 6f 6e 73 69 73 | .is.implemented.as.a.pair.consis |
| 9d020 | 74 69 6e 67 20 6f 66 20 61 20 6b 65 79 20 61 6e 64 0a 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 | ting.of.a.key.and.the.associated |
| 9d040 | 20 76 61 6c 75 65 2e 20 54 68 65 20 72 65 63 6f 72 64 73 20 61 72 65 20 67 6c 75 65 64 20 74 6f | .value..The.records.are.glued.to |
| 9d060 | 67 65 74 68 65 72 20 74 6f 20 66 6f 72 6d 20 61 20 6c 69 73 74 20 62 79 0a 70 61 69 72 73 20 77 | gether.to.form.a.list.by.pairs.w |
| 9d080 | 68 6f 73 65 20 60 63 61 72 27 73 20 70 6f 69 6e 74 20 74 6f 20 73 75 63 63 65 73 73 69 76 65 20 | hose.`car's.point.to.successive. |
| 9d0a0 | 72 65 63 6f 72 64 73 2e 20 20 54 68 65 73 65 20 67 6c 75 69 6e 67 20 70 61 69 72 73 20 61 72 65 | records...These.gluing.pairs.are |
| 9d0c0 | 0a 63 61 6c 6c 65 64 20 74 68 65 20 22 62 61 63 6b 62 6f 6e 65 22 20 6f 66 20 74 68 65 20 74 61 | .called.the."backbone".of.the.ta |
| 9d0e0 | 62 6c 65 2e 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 68 61 76 65 20 61 20 70 6c 61 63 65 20 74 | ble...In.order.to.have.a.place.t |
| 9d100 | 68 61 74 20 77 65 0a 63 61 6e 20 63 68 61 6e 67 65 20 77 68 65 6e 20 77 65 20 61 64 64 20 61 20 | hat.we.can.change.when.we.add.a. |
| 9d120 | 6e 65 77 20 72 65 63 6f 72 64 20 74 6f 20 74 68 65 20 74 61 62 6c 65 2c 20 77 65 20 62 75 69 6c | new.record.to.the.table,.we.buil |
| 9d140 | 64 20 74 68 65 20 74 61 62 6c 65 20 61 73 0a 61 20 22 68 65 61 64 65 64 20 6c 69 73 74 22 2e 20 | d.the.table.as.a."headed.list".. |
| 9d160 | 20 41 20 68 65 61 64 65 64 20 6c 69 73 74 20 68 61 73 20 61 20 73 70 65 63 69 61 6c 20 62 61 63 | .A.headed.list.has.a.special.bac |
| 9d180 | 6b 62 6f 6e 65 20 70 61 69 72 20 61 74 20 74 68 65 0a 62 65 67 69 6e 6e 69 6e 67 2c 20 77 68 69 | kbone.pair.at.the.beginning,.whi |
| 9d1a0 | 63 68 20 68 6f 6c 64 73 20 61 20 64 75 6d 6d 79 20 22 72 65 63 6f 72 64 22 2d 2d 69 6e 20 74 68 | ch.holds.a.dummy."record"--in.th |
| 9d1c0 | 69 73 20 63 61 73 65 20 74 68 65 20 61 72 62 69 74 72 61 72 69 6c 79 0a 63 68 6f 73 65 6e 20 73 | is.case.the.arbitrarily.chosen.s |
| 9d1e0 | 79 6d 62 6f 6c 20 60 2a 74 61 62 6c 65 2a 27 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 | ymbol.`*table*'...*Note.Figure.3 |
| 9d200 | 2d 32 32 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 0a | -22::.shows.the.box-and-pointer. |
| 9d220 | 64 69 61 67 72 61 6d 20 66 6f 72 20 74 68 65 20 74 61 62 6c 65 0a 0a 20 20 20 20 20 61 3a 20 20 | diagram.for.the.table.......a:.. |
| 9d240 | 31 0a 20 20 20 20 20 62 3a 20 20 32 0a 20 20 20 20 20 63 3a 20 20 33 0a 0a 20 20 20 20 20 2a 46 | 1......b:..2......c:..3.......*F |
| 9d260 | 69 67 75 72 65 20 33 2e 32 32 3a 2a 20 41 20 74 61 62 6c 65 20 72 65 70 72 65 73 65 6e 74 65 64 | igure.3.22:*.A.table.represented |
| 9d280 | 20 61 73 20 61 20 68 65 61 64 65 64 20 6c 69 73 74 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 2b | .as.a.headed.list..............+ |
| 9d2a0 | 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 2d 2d | ---+---+....+---+---+....+---+-- |
| 9d2c0 | 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 2a 20 7c | -+....+---+---+............|.*.| |
| 9d2e0 | 20 2a 2d 2b 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d | .*-+--->|.*.|.*-+--->|.*.|.*-+-- |
| 9d300 | 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b | ->|.*.|./.|............+-|-+---+ |
| 9d320 | 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d | ....+-|-+---+....+-|-+---+....+- |
| 9d340 | 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | |-+---+..............|.......... |
| 9d360 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | ..|............|............|... |
| 9d380 | 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 | ...........V............V....... |
| 9d3a0 | 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 2b 2d | .....V............V...........+- |
| 9d3c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d | --------+...+---+---+...+---+--- |
| 9d3e0 | 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 2a 74 61 62 6c 65 | +...+---+---+...........|.*table |
| 9d400 | 2a 20 7c 20 20 20 7c 20 2a 20 7c 20 2a 20 7c 20 20 20 7c 20 2a 20 7c 20 2a 20 7c 20 20 20 7c 20 | *.|...|.*.|.*.|...|.*.|.*.|...|. |
| 9d420 | 2a 20 7c 20 2a 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 | *.|.*.|...........+---------+... |
| 9d440 | 2b 2d 7c 2d 2b 2d 7c 2d 2b 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d | +-|-+-|-+...+-|-+-|-+...+-|-+-|- |
| 9d460 | 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | +...........................|... |
| 9d480 | 7c 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 20 20 20 20 7c 20 20 20 7c 0a 20 20 20 20 20 20 | |.......|...|.......|...|....... |
| 9d4a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 56 20 20 20 20 20 20 20 | ....................V...V....... |
| 9d4c0 | 56 20 20 20 56 20 20 20 20 20 20 20 56 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | V...V.......V...V............... |
| 9d4e0 | 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b | .........+---+.+---+.+---+.+---+ |
| 9d500 | 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .+---+.+---+.................... |
| 9d520 | 20 20 20 20 7c 20 61 20 7c 20 7c 20 31 20 7c 20 7c 20 62 20 7c 20 7c 20 32 20 7c 20 7c 20 63 20 | ....|.a.|.|.1.|.|.b.|.|.2.|.|.c. |
| 9d540 | 7c 20 7c 20 33 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b | |.|.3.|........................+ |
| 9d560 | 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d | ---+.+---+.+---+.+---+.+---+.+-- |
| 9d580 | 2d 2b 0a 0a 20 20 20 54 6f 20 65 78 74 72 61 63 74 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 72 | -+.....To.extract.information.fr |
| 9d5a0 | 6f 6d 20 61 20 74 61 62 6c 65 20 77 65 20 75 73 65 20 74 68 65 20 60 6c 6f 6f 6b 75 70 27 20 70 | om.a.table.we.use.the.`lookup'.p |
| 9d5c0 | 72 6f 63 65 64 75 72 65 2c 0a 77 68 69 63 68 20 74 61 6b 65 73 20 61 20 6b 65 79 20 61 73 20 61 | rocedure,.which.takes.a.key.as.a |
| 9d5e0 | 72 67 75 6d 65 6e 74 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 61 73 73 6f 63 69 61 74 | rgument.and.returns.the.associat |
| 9d600 | 65 64 20 76 61 6c 75 65 20 28 6f 72 0a 66 61 6c 73 65 20 69 66 20 74 68 65 72 65 20 69 73 20 6e | ed.value.(or.false.if.there.is.n |
| 9d620 | 6f 20 76 61 6c 75 65 20 73 74 6f 72 65 64 20 75 6e 64 65 72 20 74 68 61 74 20 6b 65 79 29 2e 20 | o.value.stored.under.that.key).. |
| 9d640 | 20 60 4c 6f 6f 6b 75 70 27 20 69 73 20 64 65 66 69 6e 65 64 0a 69 6e 20 74 65 72 6d 73 20 6f 66 | .`Lookup'.is.defined.in.terms.of |
| 9d660 | 20 74 68 65 20 60 61 73 73 6f 63 27 20 6f 70 65 72 61 74 69 6f 6e 2c 20 77 68 69 63 68 20 65 78 | .the.`assoc'.operation,.which.ex |
| 9d680 | 70 65 63 74 73 20 61 20 6b 65 79 20 61 6e 64 20 61 20 6c 69 73 74 20 6f 66 0a 72 65 63 6f 72 64 | pects.a.key.and.a.list.of.record |
| 9d6a0 | 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 4e 6f 74 65 20 74 68 61 74 20 60 61 73 73 6f | s.as.arguments...Note.that.`asso |
| 9d6c0 | 63 27 20 6e 65 76 65 72 20 73 65 65 73 20 74 68 65 20 64 75 6d 6d 79 20 72 65 63 6f 72 64 2e 0a | c'.never.sees.the.dummy.record.. |
| 9d6e0 | 60 41 73 73 6f 63 27 20 72 65 74 75 72 6e 73 20 74 68 65 20 72 65 63 6f 72 64 20 74 68 61 74 20 | `Assoc'.returns.the.record.that. |
| 9d700 | 68 61 73 20 74 68 65 20 67 69 76 65 6e 20 6b 65 79 20 61 73 20 69 74 73 20 60 63 61 72 27 2e 28 | has.the.given.key.as.its.`car'.( |
| 9d720 | 31 29 0a 60 4c 6f 6f 6b 75 70 27 20 74 68 65 6e 20 63 68 65 63 6b 73 20 74 6f 20 73 65 65 20 74 | 1).`Lookup'.then.checks.to.see.t |
| 9d740 | 68 61 74 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 72 65 63 6f 72 64 20 72 65 74 75 72 6e 65 | hat.the.resulting.record.returne |
| 9d760 | 64 20 62 79 0a 60 61 73 73 6f 63 27 20 69 73 20 6e 6f 74 20 66 61 6c 73 65 2c 20 61 6e 64 20 72 | d.by.`assoc'.is.not.false,.and.r |
| 9d780 | 65 74 75 72 6e 73 20 74 68 65 20 76 61 6c 75 65 20 28 74 68 65 20 60 63 64 72 27 29 20 6f 66 20 | eturns.the.value.(the.`cdr').of. |
| 9d7a0 | 74 68 65 20 72 65 63 6f 72 64 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 6b 75 | the.record........(define.(looku |
| 9d7c0 | 70 20 6b 65 79 20 74 61 62 6c 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 63 6f 72 | p.key.table)........(let.((recor |
| 9d7e0 | 64 20 28 61 73 73 6f 63 20 6b 65 79 20 28 63 64 72 20 74 61 62 6c 65 29 29 29 29 0a 20 20 20 20 | d.(assoc.key.(cdr.table))))..... |
| 9d800 | 20 20 20 20 20 28 69 66 20 72 65 63 6f 72 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 | .....(if.record..............(cd |
| 9d820 | 72 20 72 65 63 6f 72 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 6c 73 65 29 29 29 0a | r.record)..............false))). |
| 9d840 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 73 73 6f 63 20 6b 65 79 20 72 65 63 6f 72 64 73 | ......(define.(assoc.key.records |
| 9d860 | 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 72 65 63 6f 72 64 73 29 20 | )........(cond.((null?.records). |
| 9d880 | 66 61 6c 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 75 61 6c 3f 20 6b 65 79 | false)..............((equal?.key |
| 9d8a0 | 20 28 63 61 61 72 20 72 65 63 6f 72 64 73 29 29 20 28 63 61 72 20 72 65 63 6f 72 64 73 29 29 0a | .(caar.records)).(car.records)). |
| 9d8c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 61 73 73 6f 63 20 6b 65 79 20 28 63 | .............(else.(assoc.key.(c |
| 9d8e0 | 64 72 20 72 65 63 6f 72 64 73 29 29 29 29 29 0a 0a 20 20 20 54 6f 20 69 6e 73 65 72 74 20 61 20 | dr.records))))).....To.insert.a. |
| 9d900 | 76 61 6c 75 65 20 69 6e 20 61 20 74 61 62 6c 65 20 75 6e 64 65 72 20 61 20 73 70 65 63 69 66 69 | value.in.a.table.under.a.specifi |
| 9d920 | 65 64 20 6b 65 79 2c 20 77 65 20 66 69 72 73 74 20 75 73 65 0a 60 61 73 73 6f 63 27 20 74 6f 20 | ed.key,.we.first.use.`assoc'.to. |
| 9d940 | 73 65 65 20 69 66 20 74 68 65 72 65 20 69 73 20 61 6c 72 65 61 64 79 20 61 20 72 65 63 6f 72 64 | see.if.there.is.already.a.record |
| 9d960 | 20 69 6e 20 74 68 65 20 74 61 62 6c 65 20 77 69 74 68 20 74 68 69 73 20 6b 65 79 2e 0a 49 66 20 | .in.the.table.with.this.key..If. |
| 9d980 | 6e 6f 74 2c 20 77 65 20 66 6f 72 6d 20 61 20 6e 65 77 20 72 65 63 6f 72 64 20 62 79 20 60 63 6f | not,.we.form.a.new.record.by.`co |
| 9d9a0 | 6e 73 27 69 6e 67 20 74 68 65 20 6b 65 79 20 77 69 74 68 20 74 68 65 20 76 61 6c 75 65 2c 20 61 | ns'ing.the.key.with.the.value,.a |
| 9d9c0 | 6e 64 0a 69 6e 73 65 72 74 20 74 68 69 73 20 61 74 20 74 68 65 20 68 65 61 64 20 6f 66 20 74 68 | nd.insert.this.at.the.head.of.th |
| 9d9e0 | 65 20 74 61 62 6c 65 27 73 20 6c 69 73 74 20 6f 66 20 72 65 63 6f 72 64 73 2c 20 61 66 74 65 72 | e.table's.list.of.records,.after |
| 9da00 | 20 74 68 65 20 64 75 6d 6d 79 0a 72 65 63 6f 72 64 2e 20 20 49 66 20 74 68 65 72 65 20 61 6c 72 | .the.dummy.record...If.there.alr |
| 9da20 | 65 61 64 79 20 69 73 20 61 20 72 65 63 6f 72 64 20 77 69 74 68 20 74 68 69 73 20 6b 65 79 2c 20 | eady.is.a.record.with.this.key,. |
| 9da40 | 77 65 20 73 65 74 20 74 68 65 20 60 63 64 72 27 0a 6f 66 20 74 68 69 73 20 72 65 63 6f 72 64 20 | we.set.the.`cdr'.of.this.record. |
| 9da60 | 74 6f 20 74 68 65 20 64 65 73 69 67 6e 61 74 65 64 20 6e 65 77 20 76 61 6c 75 65 2e 20 20 54 68 | to.the.designated.new.value...Th |
| 9da80 | 65 20 68 65 61 64 65 72 20 6f 66 20 74 68 65 20 74 61 62 6c 65 0a 70 72 6f 76 69 64 65 73 20 75 | e.header.of.the.table.provides.u |
| 9daa0 | 73 20 77 69 74 68 20 61 20 66 69 78 65 64 20 6c 6f 63 61 74 69 6f 6e 20 74 6f 20 6d 6f 64 69 66 | s.with.a.fixed.location.to.modif |
| 9dac0 | 79 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 69 6e 73 65 72 74 20 74 68 65 20 6e 65 77 0a 72 65 63 | y.in.order.to.insert.the.new.rec |
| 9dae0 | 6f 72 64 2e 28 32 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 73 65 72 74 21 20 6b | ord.(2).......(define.(insert!.k |
| 9db00 | 65 79 20 76 61 6c 75 65 20 74 61 62 6c 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 | ey.value.table)........(let.((re |
| 9db20 | 63 6f 72 64 20 28 61 73 73 6f 63 20 6b 65 79 20 28 63 64 72 20 74 61 62 6c 65 29 29 29 29 0a 20 | cord.(assoc.key.(cdr.table)))).. |
| 9db40 | 20 20 20 20 20 20 20 20 28 69 66 20 72 65 63 6f 72 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........(if.record.............. |
| 9db60 | 28 73 65 74 2d 63 64 72 21 20 72 65 63 6f 72 64 20 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 | (set-cdr!.record.value)......... |
| 9db80 | 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 20 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 | .....(set-cdr!.table............ |
| 9dba0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 63 6f 6e 73 20 6b 65 79 20 76 61 6c 75 | ............(cons.(cons.key.valu |
| 9dbc0 | 65 29 20 28 63 64 72 20 74 61 62 6c 65 29 29 29 29 29 0a 20 20 20 20 20 20 20 27 6f 6b 29 0a 0a | e).(cdr.table)))))........'ok).. |
| 9dbe0 | 20 20 20 54 6f 20 63 6f 6e 73 74 72 75 63 74 20 61 20 6e 65 77 20 74 61 62 6c 65 2c 20 77 65 20 | ...To.construct.a.new.table,.we. |
| 9dc00 | 73 69 6d 70 6c 79 20 63 72 65 61 74 65 20 61 20 6c 69 73 74 20 63 6f 6e 74 61 69 6e 69 6e 67 20 | simply.create.a.list.containing. |
| 9dc20 | 74 68 65 0a 73 79 6d 62 6f 6c 20 60 2a 74 61 62 6c 65 2a 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 | the.symbol.`*table*':.......(def |
| 9dc40 | 69 6e 65 20 28 6d 61 6b 65 2d 74 61 62 6c 65 29 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 2a | ine.(make-table)........(list.'* |
| 9dc60 | 74 61 62 6c 65 2a 29 29 0a 0a 54 77 6f 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 74 61 62 6c 65 73 | table*))..Two-dimensional.tables |
| 9dc80 | 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 61 20 74 77 | .........................In.a.tw |
| 9dca0 | 6f 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 74 61 62 6c 65 2c 20 65 61 63 68 20 76 61 6c 75 65 20 | o-dimensional.table,.each.value. |
| 9dcc0 | 69 73 20 69 6e 64 65 78 65 64 20 62 79 20 74 77 6f 20 6b 65 79 73 2e 20 20 57 65 20 63 61 6e 0a | is.indexed.by.two.keys...We.can. |
| 9dce0 | 63 6f 6e 73 74 72 75 63 74 20 73 75 63 68 20 61 20 74 61 62 6c 65 20 61 73 20 61 20 6f 6e 65 2d | construct.such.a.table.as.a.one- |
| 9dd00 | 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 74 61 62 6c 65 20 69 6e 20 77 68 69 63 68 20 65 61 63 68 20 | dimensional.table.in.which.each. |
| 9dd20 | 6b 65 79 0a 69 64 65 6e 74 69 66 69 65 73 20 61 20 73 75 62 74 61 62 6c 65 2e 20 20 2a 4e 6f 74 | key.identifies.a.subtable...*Not |
| 9dd40 | 65 20 46 69 67 75 72 65 20 33 2d 32 33 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 62 6f 78 2d 61 6e | e.Figure.3-23::.shows.the.box-an |
| 9dd60 | 64 2d 70 6f 69 6e 74 65 72 0a 64 69 61 67 72 61 6d 20 66 6f 72 20 74 68 65 20 74 61 62 6c 65 0a | d-pointer.diagram.for.the.table. |
| 9dd80 | 0a 20 20 20 20 20 6d 61 74 68 3a 0a 20 20 20 20 20 20 20 20 20 2b 3a 20 20 34 33 0a 20 20 20 20 | ......math:..........+:..43..... |
| 9dda0 | 20 20 20 20 20 2d 3a 20 20 34 35 0a 20 20 20 20 20 20 20 20 20 2a 3a 20 20 34 32 0a 20 20 20 20 | .....-:..45..........*:..42..... |
| 9ddc0 | 20 6c 65 74 74 65 72 73 3a 0a 20 20 20 20 20 20 20 20 20 61 3a 20 20 39 37 0a 20 20 20 20 20 20 | .letters:..........a:..97....... |
| 9dde0 | 20 20 20 62 3a 20 20 39 38 0a 0a 77 68 69 63 68 20 68 61 73 20 74 77 6f 20 73 75 62 74 61 62 6c | ...b:..98..which.has.two.subtabl |
| 9de00 | 65 73 2e 20 20 28 54 68 65 20 73 75 62 74 61 62 6c 65 73 20 64 6f 6e 27 74 20 6e 65 65 64 20 61 | es...(The.subtables.don't.need.a |
| 9de20 | 20 73 70 65 63 69 61 6c 20 68 65 61 64 65 72 0a 73 79 6d 62 6f 6c 2c 20 73 69 6e 63 65 20 74 68 | .special.header.symbol,.since.th |
| 9de40 | 65 20 6b 65 79 20 74 68 61 74 20 69 64 65 6e 74 69 66 69 65 73 20 74 68 65 20 73 75 62 74 61 62 | e.key.that.identifies.the.subtab |
| 9de60 | 6c 65 20 73 65 72 76 65 73 20 74 68 69 73 20 70 75 72 70 6f 73 65 2e 29 0a 0a 20 20 20 20 20 2a | le.serves.this.purpose.).......* |
| 9de80 | 46 69 67 75 72 65 20 33 2e 32 33 3a 2a 20 41 20 74 77 6f 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 | Figure.3.23:*.A.two-dimensional. |
| 9dea0 | 74 61 62 6c 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 | table.............table......... |
| 9dec0 | 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 2b 2d | ....|.............V...........+- |
| 9dee0 | 2d 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a | --+---+...+---+---+...+---+---+. |
| 9df00 | 20 20 20 20 20 20 20 20 20 20 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d | ..........|.*.|.*-+-->|.*.|.*-+- |
| 9df20 | 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 | ->|.*.|./.|...........+-|-+---+. |
| 9df40 | 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 | ..+-|-+---+...+-|-+---+......... |
| 9df60 | 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 | ....V...........|...........V... |
| 9df80 | 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 | ........+-------+.....|......... |
| 9dfa0 | 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d | +---+---+...+---+---+...+---+--- |
| 9dfc0 | 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 2a 74 61 62 6c 65 2a 7c 20 20 20 20 20 7c 20 20 20 20 20 | +...........|*table*|.....|..... |
| 9dfe0 | 20 20 20 20 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 3e 7c 20 2a 20 | ....|.*.|.*-+-->|.*.|.*-+-->|.*. |
| 9e000 | 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 7c 20 | |./.|...........+-------+.....|. |
| 9e020 | 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 | ........+-|-+---+...+-|-+---+... |
| 9e040 | 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | +-|-+---+....................... |
| 9e060 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 | ..|...........V...........V..... |
| 9e080 | 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......V......................... |
| 9e0a0 | 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 | |.......+-------+.....+---+---+. |
| 9e0c0 | 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..+---+---+..................... |
| 9e0e0 | 20 20 20 20 7c 20 20 20 20 20 20 20 7c 6c 65 74 74 65 72 73 7c 20 20 20 20 20 7c 20 2a 20 7c 20 | ....|.......|letters|.....|.*.|. |
| 9e100 | 2a 20 7c 20 20 20 7c 20 2a 20 7c 20 2a 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | *.|...|.*.|.*.|................. |
| 9e120 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 2b 2d | ........|.......+-------+.....+- |
| 9e140 | 7c 2d 2b 2d 7c 2d 2b 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 | |-+-|-+...+-|-+-|-+............. |
| 9e160 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............|................... |
| 9e180 | 20 20 20 20 56 20 20 20 56 20 20 20 20 20 20 20 56 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 | ....V...V.......V...V........... |
| 9e1a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............|................. |
| 9e1c0 | 20 20 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 | ...+---+.+---+.+---+.+---+...... |
| 9e1e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 | ...................|............ |
| 9e200 | 20 20 20 20 20 20 20 20 7c 20 61 20 7c 20 7c 20 39 37 7c 20 7c 20 62 20 7c 20 7c 20 39 38 7c 0a | ........|.a.|.|.97|.|.b.|.|.98|. |
| 9e220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 | ........................|....... |
| 9e240 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b | .............+---+.+---+.+---+.+ |
| 9e260 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 | ---+.........................V.. |
| 9e280 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 | .....................+---+---+.. |
| 9e2a0 | 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d | .+---+---+...+---+---+...+---+-- |
| 9e2c0 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 2a 20 7c 20 2a | -+.......................|.*.|.* |
| 9e2e0 | 2d 2b 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 3e 7c 20 2a | -+-->|.*.|.*-+-->|.*.|.*-+-->|.* |
| 9e300 | 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c | .|./.|.......................+-| |
| 9e320 | 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 | -+---+...+-|-+---+...+-|-+---+.. |
| 9e340 | 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .+-|-+---+...................... |
| 9e360 | 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 | ...V...........V...........V.... |
| 9e380 | 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | .......V.....................+-- |
| 9e3a0 | 2d 2d 2d 2d 2b 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b | ----+......+---+---+...+---+---+ |
| 9e3c0 | 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...+---+---+.................... |
| 9e3e0 | 20 7c 20 6d 61 74 68 20 7c 20 20 20 20 20 20 7c 20 2a 20 7c 20 2a 20 7c 20 20 20 7c 20 2a 20 7c | .|.math.|......|.*.|.*.|...|.*.| |
| 9e400 | 20 2a 20 7c 20 20 20 7c 20 2a 20 7c 20 2a 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.|...|.*.|.*.|................ |
| 9e420 | 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 20 20 20 2b | .....+------+......+-|-+-|-+...+ |
| 9e440 | 2d 7c 2d 2b 2d 7c 2d 2b 20 20 20 2b 2d 7c 2d 2b 2d 7c 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 | -|-+-|-+...+-|-+-|-+............ |
| 9e460 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 56 20 20 | .........................V...V.. |
| 9e480 | 20 20 20 20 20 56 20 20 20 56 20 20 20 20 20 20 20 56 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 | .....V...V.......V...V.......... |
| 9e4a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 2b 2d | ........................+---+.+- |
| 9e4c0 | 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 0a 20 20 20 20 | --+.+---+.+---+.+---+.+---+..... |
| 9e4e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 2b | .............................|.+ |
| 9e500 | 20 7c 20 7c 20 34 33 7c 20 7c 20 2d 20 7c 20 7c 20 34 35 7c 20 7c 20 2a 20 7c 20 7c 20 34 32 7c | .|.|.43|.|.-.|.|.45|.|.*.|.|.42| |
| 9e520 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 9e540 | 20 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 2b 2d 2d 2d 2b 20 | ..+---+.+---+.+---+.+---+.+---+. |
| 9e560 | 2b 2d 2d 2d 2b 0a 0a 20 20 20 57 68 65 6e 20 77 65 20 6c 6f 6f 6b 20 75 70 20 61 6e 20 69 74 65 | +---+.....When.we.look.up.an.ite |
| 9e580 | 6d 2c 20 77 65 20 75 73 65 20 74 68 65 20 66 69 72 73 74 20 6b 65 79 20 74 6f 20 69 64 65 6e 74 | m,.we.use.the.first.key.to.ident |
| 9e5a0 | 69 66 79 20 74 68 65 0a 63 6f 72 72 65 63 74 20 73 75 62 74 61 62 6c 65 2e 20 20 54 68 65 6e 20 | ify.the.correct.subtable...Then. |
| 9e5c0 | 77 65 20 75 73 65 20 74 68 65 20 73 65 63 6f 6e 64 20 6b 65 79 20 74 6f 20 69 64 65 6e 74 69 66 | we.use.the.second.key.to.identif |
| 9e5e0 | 79 20 74 68 65 20 72 65 63 6f 72 64 0a 77 69 74 68 69 6e 20 74 68 65 20 73 75 62 74 61 62 6c 65 | y.the.record.within.the.subtable |
| 9e600 | 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 6b 75 70 20 6b 65 79 2d 31 20 6b 65 | ........(define.(lookup.key-1.ke |
| 9e620 | 79 2d 32 20 74 61 62 6c 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 75 62 74 61 62 6c | y-2.table)........(let.((subtabl |
| 9e640 | 65 20 28 61 73 73 6f 63 20 6b 65 79 2d 31 20 28 63 64 72 20 74 61 62 6c 65 29 29 29 29 0a 20 20 | e.(assoc.key-1.(cdr.table))))... |
| 9e660 | 20 20 20 20 20 20 20 28 69 66 20 73 75 62 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | .......(if.subtable............. |
| 9e680 | 20 28 6c 65 74 20 28 28 72 65 63 6f 72 64 20 28 61 73 73 6f 63 20 6b 65 79 2d 32 20 28 63 64 72 | .(let.((record.(assoc.key-2.(cdr |
| 9e6a0 | 20 73 75 62 74 61 62 6c 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 | .subtable))))................(if |
| 9e6c0 | 20 72 65 63 6f 72 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 | .record....................(cdr. |
| 9e6e0 | 72 65 63 6f 72 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 6c 73 65 | record)....................false |
| 9e700 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 6c 73 65 29 29 29 0a 0a 20 20 20 54 6f 20 | ))..............false))).....To. |
| 9e720 | 69 6e 73 65 72 74 20 61 20 6e 65 77 20 69 74 65 6d 20 75 6e 64 65 72 20 61 20 70 61 69 72 20 6f | insert.a.new.item.under.a.pair.o |
| 9e740 | 66 20 6b 65 79 73 2c 20 77 65 20 75 73 65 20 60 61 73 73 6f 63 27 20 74 6f 20 73 65 65 20 69 66 | f.keys,.we.use.`assoc'.to.see.if |
| 9e760 | 0a 74 68 65 72 65 20 69 73 20 61 20 73 75 62 74 61 62 6c 65 20 73 74 6f 72 65 64 20 75 6e 64 65 | .there.is.a.subtable.stored.unde |
| 9e780 | 72 20 74 68 65 20 66 69 72 73 74 20 6b 65 79 2e 20 20 49 66 20 6e 6f 74 2c 20 77 65 20 62 75 69 | r.the.first.key...If.not,.we.bui |
| 9e7a0 | 6c 64 20 61 20 6e 65 77 0a 73 75 62 74 61 62 6c 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 | ld.a.new.subtable.containing.the |
| 9e7c0 | 20 73 69 6e 67 6c 65 20 72 65 63 6f 72 64 20 28 60 6b 65 79 2d 32 27 2c 20 60 76 61 6c 75 65 27 | .single.record.(`key-2',.`value' |
| 9e7e0 | 29 20 61 6e 64 20 69 6e 73 65 72 74 20 69 74 0a 69 6e 74 6f 20 74 68 65 20 74 61 62 6c 65 20 75 | ).and.insert.it.into.the.table.u |
| 9e800 | 6e 64 65 72 20 74 68 65 20 66 69 72 73 74 20 6b 65 79 2e 20 20 49 66 20 61 20 73 75 62 74 61 62 | nder.the.first.key...If.a.subtab |
| 9e820 | 6c 65 20 61 6c 72 65 61 64 79 20 65 78 69 73 74 73 20 66 6f 72 0a 74 68 65 20 66 69 72 73 74 20 | le.already.exists.for.the.first. |
| 9e840 | 6b 65 79 2c 20 77 65 20 69 6e 73 65 72 74 20 74 68 65 20 6e 65 77 20 72 65 63 6f 72 64 20 69 6e | key,.we.insert.the.new.record.in |
| 9e860 | 74 6f 20 74 68 69 73 20 73 75 62 74 61 62 6c 65 2c 20 75 73 69 6e 67 20 74 68 65 0a 69 6e 73 65 | to.this.subtable,.using.the.inse |
| 9e880 | 72 74 69 6f 6e 20 6d 65 74 68 6f 64 20 66 6f 72 20 6f 6e 65 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c | rtion.method.for.one-dimensional |
| 9e8a0 | 20 74 61 62 6c 65 73 20 64 65 73 63 72 69 62 65 64 20 61 62 6f 76 65 3a 0a 0a 20 20 20 20 20 28 | .tables.described.above:.......( |
| 9e8c0 | 64 65 66 69 6e 65 20 28 69 6e 73 65 72 74 21 20 6b 65 79 2d 31 20 6b 65 79 2d 32 20 76 61 6c 75 | define.(insert!.key-1.key-2.valu |
| 9e8e0 | 65 20 74 61 62 6c 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 75 62 74 61 62 6c 65 20 | e.table)........(let.((subtable. |
| 9e900 | 28 61 73 73 6f 63 20 6b 65 79 2d 31 20 28 63 64 72 20 74 61 62 6c 65 29 29 29 29 0a 20 20 20 20 | (assoc.key-1.(cdr.table))))..... |
| 9e920 | 20 20 20 20 20 28 69 66 20 73 75 62 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .....(if.subtable..............( |
| 9e940 | 6c 65 74 20 28 28 72 65 63 6f 72 64 20 28 61 73 73 6f 63 20 6b 65 79 2d 32 20 28 63 64 72 20 73 | let.((record.(assoc.key-2.(cdr.s |
| 9e960 | 75 62 74 61 62 6c 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 72 | ubtable))))................(if.r |
| 9e980 | 65 63 6f 72 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 | ecord....................(set-cd |
| 9e9a0 | 72 21 20 72 65 63 6f 72 64 20 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | r!.record.value)................ |
| 9e9c0 | 20 20 20 20 28 73 65 74 2d 63 64 72 21 20 73 75 62 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 | ....(set-cdr!.subtable.......... |
| 9e9e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 63 6f 6e 73 20 | ....................(cons.(cons. |
| 9ea00 | 6b 65 79 2d 32 20 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | key-2.value).................... |
| 9ea20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 73 75 62 74 61 62 6c 65 29 29 29 | ................(cdr.subtable))) |
| 9ea40 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 20 74 61 62 6c 65 0a | ))..............(set-cdr!.table. |
| 9ea60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 6c 69 | .......................(cons.(li |
| 9ea80 | 73 74 20 6b 65 79 2d 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | st.key-1........................ |
| 9eaa0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 6b 65 79 2d 32 20 76 61 6c 75 65 29 29 0a | ............(cons.key-2.value)). |
| 9eac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 | .............................(cd |
| 9eae0 | 72 20 74 61 62 6c 65 29 29 29 29 29 0a 20 20 20 20 20 20 20 27 6f 6b 29 0a 0a 43 72 65 61 74 69 | r.table)))))........'ok)..Creati |
| 9eb00 | 6e 67 20 6c 6f 63 61 6c 20 74 61 62 6c 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ng.local.tables................. |
| 9eb20 | 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 60 6c 6f 6f 6b 75 70 27 20 61 6e 64 20 60 69 6e 73 65 72 74 21 | .......The.`lookup'.and.`insert! |
| 9eb40 | 27 20 6f 70 65 72 61 74 69 6f 6e 73 20 64 65 66 69 6e 65 64 20 61 62 6f 76 65 20 74 61 6b 65 20 | '.operations.defined.above.take. |
| 9eb60 | 74 68 65 20 74 61 62 6c 65 20 61 73 0a 61 6e 20 61 72 67 75 6d 65 6e 74 2e 20 20 54 68 69 73 20 | the.table.as.an.argument...This. |
| 9eb80 | 65 6e 61 62 6c 65 73 20 75 73 20 74 6f 20 75 73 65 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 | enables.us.to.use.programs.that. |
| 9eba0 | 61 63 63 65 73 73 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 0a 74 61 62 6c 65 2e 20 20 41 6e 6f | access.more.than.one.table...Ano |
| 9ebc0 | 74 68 65 72 20 77 61 79 20 74 6f 20 64 65 61 6c 20 77 69 74 68 20 6d 75 6c 74 69 70 6c 65 20 74 | ther.way.to.deal.with.multiple.t |
| 9ebe0 | 61 62 6c 65 73 20 69 73 20 74 6f 20 68 61 76 65 20 73 65 70 61 72 61 74 65 0a 60 6c 6f 6f 6b 75 | ables.is.to.have.separate.`looku |
| 9ec00 | 70 27 20 61 6e 64 20 60 69 6e 73 65 72 74 21 27 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 | p'.and.`insert!'.procedures.for. |
| 9ec20 | 65 61 63 68 20 74 61 62 6c 65 2e 20 20 57 65 20 63 61 6e 20 64 6f 20 74 68 69 73 20 62 79 0a 72 | each.table...We.can.do.this.by.r |
| 9ec40 | 65 70 72 65 73 65 6e 74 69 6e 67 20 61 20 74 61 62 6c 65 20 70 72 6f 63 65 64 75 72 61 6c 6c 79 | epresenting.a.table.procedurally |
| 9ec60 | 2c 20 61 73 20 61 6e 20 6f 62 6a 65 63 74 20 74 68 61 74 20 6d 61 69 6e 74 61 69 6e 73 20 61 6e | ,.as.an.object.that.maintains.an |
| 9ec80 | 0a 69 6e 74 65 72 6e 61 6c 20 74 61 62 6c 65 20 61 73 20 70 61 72 74 20 6f 66 20 69 74 73 20 6c | .internal.table.as.part.of.its.l |
| 9eca0 | 6f 63 61 6c 20 73 74 61 74 65 2e 20 20 57 68 65 6e 20 73 65 6e 74 20 61 6e 20 61 70 70 72 6f 70 | ocal.state...When.sent.an.approp |
| 9ecc0 | 72 69 61 74 65 0a 6d 65 73 73 61 67 65 2c 20 74 68 69 73 20 22 74 61 62 6c 65 20 6f 62 6a 65 63 | riate.message,.this."table.objec |
| 9ece0 | 74 22 20 73 75 70 70 6c 69 65 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 77 | t".supplies.the.procedure.with.w |
| 9ed00 | 68 69 63 68 20 74 6f 0a 6f 70 65 72 61 74 65 20 6f 6e 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 | hich.to.operate.on.the.internal. |
| 9ed20 | 74 61 62 6c 65 2e 20 20 48 65 72 65 20 69 73 20 61 20 67 65 6e 65 72 61 74 6f 72 20 66 6f 72 20 | table...Here.is.a.generator.for. |
| 9ed40 | 74 77 6f 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c 0a 74 61 62 6c 65 73 20 72 65 70 72 65 73 65 6e 74 | two-dimensional.tables.represent |
| 9ed60 | 65 64 20 69 6e 20 74 68 69 73 20 66 61 73 68 69 6f 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | ed.in.this.fashion:.......(defin |
| 9ed80 | 65 20 28 6d 61 6b 65 2d 74 61 62 6c 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6c 6f 63 | e.(make-table)........(let.((loc |
| 9eda0 | 61 6c 2d 74 61 62 6c 65 20 28 6c 69 73 74 20 27 2a 74 61 62 6c 65 2a 29 29 29 0a 20 20 20 20 20 | al-table.(list.'*table*)))...... |
| 9edc0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 6b 75 70 20 6b 65 79 2d 31 20 6b 65 79 2d 32 29 | ....(define.(lookup.key-1.key-2) |
| 9ede0 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 75 62 74 61 62 6c 65 20 28 61 73 73 | ............(let.((subtable.(ass |
| 9ee00 | 6f 63 20 6b 65 79 2d 31 20 28 63 64 72 20 6c 6f 63 61 6c 2d 74 61 62 6c 65 29 29 29 29 0a 20 20 | oc.key-1.(cdr.local-table))))... |
| 9ee20 | 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 73 75 62 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 | ...........(if.subtable......... |
| 9ee40 | 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 63 6f 72 64 20 28 61 73 73 6f 63 20 6b 65 | .........(let.((record.(assoc.ke |
| 9ee60 | 79 2d 32 20 28 63 64 72 20 73 75 62 74 61 62 6c 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | y-2.(cdr.subtable))))........... |
| 9ee80 | 20 20 20 20 20 20 20 20 20 28 69 66 20 72 65 63 6f 72 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 | .........(if.record............. |
| 9eea0 | 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 72 65 63 6f 72 64 29 0a 20 20 20 20 20 20 20 20 | ...........(cdr.record)......... |
| 9eec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 6c 73 65 29 29 0a 20 20 20 20 20 20 20 20 20 | ...............false)).......... |
| 9eee0 | 20 20 20 20 20 20 20 20 66 61 6c 73 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e | ........false)))..........(defin |
| 9ef00 | 65 20 28 69 6e 73 65 72 74 21 20 6b 65 79 2d 31 20 6b 65 79 2d 32 20 76 61 6c 75 65 29 0a 20 20 | e.(insert!.key-1.key-2.value)... |
| 9ef20 | 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 75 62 74 61 62 6c 65 20 28 61 73 73 6f 63 20 | .........(let.((subtable.(assoc. |
| 9ef40 | 6b 65 79 2d 31 20 28 63 64 72 20 6c 6f 63 61 6c 2d 74 61 62 6c 65 29 29 29 29 0a 20 20 20 20 20 | key-1.(cdr.local-table))))...... |
| 9ef60 | 20 20 20 20 20 20 20 20 28 69 66 20 73 75 62 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 | ........(if.subtable............ |
| 9ef80 | 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 63 6f 72 64 20 28 61 73 73 6f 63 20 6b 65 79 2d 32 | ......(let.((record.(assoc.key-2 |
| 9efa0 | 20 28 63 64 72 20 73 75 62 74 61 62 6c 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(cdr.subtable)))).............. |
| 9efc0 | 20 20 20 20 20 20 28 69 66 20 72 65 63 6f 72 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......(if.record................ |
| 9efe0 | 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 20 72 65 63 6f 72 64 20 76 61 6c 75 65 29 0a | ........(set-cdr!.record.value). |
| 9f000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 | .......................(set-cdr! |
| 9f020 | 20 73 75 62 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .subtable....................... |
| 9f040 | 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 63 6f 6e 73 20 6b 65 79 2d 32 20 76 61 6c | ...........(cons.(cons.key-2.val |
| 9f060 | 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ue)............................. |
| 9f080 | 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 73 75 62 74 61 62 6c 65 29 29 29 29 29 0a 20 20 | ...........(cdr.subtable)))))... |
| 9f0a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 20 6c 6f 63 61 6c 2d 74 | ...............(set-cdr!.local-t |
| 9f0c0 | 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | able............................ |
| 9f0e0 | 28 63 6f 6e 73 20 28 6c 69 73 74 20 6b 65 79 2d 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (cons.(list.key-1............... |
| 9f100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 6b | .........................(cons.k |
| 9f120 | 65 79 2d 32 20 76 61 6c 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ey-2.value)).................... |
| 9f140 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 6c 6f 63 61 6c 2d 74 61 62 6c 65 29 29 | ..............(cdr.local-table)) |
| 9f160 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 6f 6b 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 | )))............'ok)..........(de |
| 9f180 | 66 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f | fine.(dispatch.m)............(co |
| 9f1a0 | 6e 64 20 28 28 65 71 3f 20 6d 20 27 6c 6f 6f 6b 75 70 2d 70 72 6f 63 29 20 6c 6f 6f 6b 75 70 29 | nd.((eq?.m.'lookup-proc).lookup) |
| 9f1c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 69 6e 73 65 72 | ..................((eq?.m.'inser |
| 9f1e0 | 74 2d 70 72 6f 63 21 29 20 69 6e 73 65 72 74 21 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | t-proc!).insert!)............... |
| 9f200 | 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 6f 70 65 72 61 74 69 | ...(else.(error."Unknown.operati |
| 9f220 | 6f 6e 20 2d 2d 20 54 41 42 4c 45 22 20 6d 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 64 69 73 70 | on.--.TABLE".m))))..........disp |
| 9f240 | 61 74 63 68 29 29 0a 0a 20 20 20 55 73 69 6e 67 20 60 6d 61 6b 65 2d 74 61 62 6c 65 27 2c 20 77 | atch)).....Using.`make-table',.w |
| 9f260 | 65 20 63 6f 75 6c 64 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 60 67 65 74 27 20 61 6e 64 20 | e.could.implement.the.`get'.and. |
| 9f280 | 60 70 75 74 27 0a 6f 70 65 72 61 74 69 6f 6e 73 20 75 73 65 64 20 69 6e 20 73 65 63 74 69 6f 6e | `put'.operations.used.in.section |
| 9f2a0 | 20 2a 4e 6f 74 65 20 32 2d 34 2d 33 3a 3a 20 66 6f 72 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 | .*Note.2-4-3::.for.data-directed |
| 9f2c0 | 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 0a 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 | .programming,.as.follows:....... |
| 9f2e0 | 28 64 65 66 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 2d 74 61 62 6c 65 20 28 6d 61 6b 65 2d 74 61 | (define.operation-table.(make-ta |
| 9f300 | 62 6c 65 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 67 65 74 20 28 6f 70 65 72 61 74 69 6f | ble))......(define.get.(operatio |
| 9f320 | 6e 2d 74 61 62 6c 65 20 27 6c 6f 6f 6b 75 70 2d 70 72 6f 63 29 29 0a 20 20 20 20 20 28 64 65 66 | n-table.'lookup-proc))......(def |
| 9f340 | 69 6e 65 20 70 75 74 20 28 6f 70 65 72 61 74 69 6f 6e 2d 74 61 62 6c 65 20 27 69 6e 73 65 72 74 | ine.put.(operation-table.'insert |
| 9f360 | 2d 70 72 6f 63 21 29 29 0a 0a 20 20 20 60 47 65 74 27 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 | -proc!)).....`Get'.takes.as.argu |
| 9f380 | 6d 65 6e 74 73 20 74 77 6f 20 6b 65 79 73 2c 20 61 6e 64 20 60 70 75 74 27 20 74 61 6b 65 73 20 | ments.two.keys,.and.`put'.takes. |
| 9f3a0 | 61 73 20 61 72 67 75 6d 65 6e 74 73 20 74 77 6f 0a 6b 65 79 73 20 61 6e 64 20 61 20 76 61 6c 75 | as.arguments.two.keys.and.a.valu |
| 9f3c0 | 65 2e 20 20 42 6f 74 68 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 63 63 65 73 73 20 74 68 65 20 73 | e...Both.operations.access.the.s |
| 9f3e0 | 61 6d 65 20 6c 6f 63 61 6c 20 74 61 62 6c 65 2c 20 77 68 69 63 68 20 69 73 0a 65 6e 63 61 70 73 | ame.local.table,.which.is.encaps |
| 9f400 | 75 6c 61 74 65 64 20 77 69 74 68 69 6e 20 74 68 65 20 6f 62 6a 65 63 74 20 63 72 65 61 74 65 64 | ulated.within.the.object.created |
| 9f420 | 20 62 79 20 74 68 65 20 63 61 6c 6c 20 74 6f 20 60 6d 61 6b 65 2d 74 61 62 6c 65 27 2e 0a 0a 20 | .by.the.call.to.`make-table'.... |
| 9f440 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 32 34 3a 2a 20 49 6e 20 74 68 65 20 74 61 62 6c | ....*Exercise.3.24:*.In.the.tabl |
| 9f460 | 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 61 62 6f 76 65 2c 20 74 68 65 20 6b 65 79 | e.implementations.above,.the.key |
| 9f480 | 73 20 61 72 65 0a 20 20 20 20 20 74 65 73 74 65 64 20 66 6f 72 20 65 71 75 61 6c 69 74 79 20 75 | s.are......tested.for.equality.u |
| 9f4a0 | 73 69 6e 67 20 60 65 71 75 61 6c 3f 27 20 28 63 61 6c 6c 65 64 20 62 79 20 60 61 73 73 6f 63 27 | sing.`equal?'.(called.by.`assoc' |
| 9f4c0 | 29 2e 20 20 54 68 69 73 20 69 73 0a 20 20 20 20 20 6e 6f 74 20 61 6c 77 61 79 73 20 74 68 65 20 | )...This.is......not.always.the. |
| 9f4e0 | 61 70 70 72 6f 70 72 69 61 74 65 20 74 65 73 74 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c | appropriate.test...For.instance, |
| 9f500 | 20 77 65 20 6d 69 67 68 74 20 68 61 76 65 20 61 0a 20 20 20 20 20 74 61 62 6c 65 20 77 69 74 68 | .we.might.have.a......table.with |
| 9f520 | 20 6e 75 6d 65 72 69 63 20 6b 65 79 73 20 69 6e 20 77 68 69 63 68 20 77 65 20 64 6f 6e 27 74 20 | .numeric.keys.in.which.we.don't. |
| 9f540 | 6e 65 65 64 20 61 6e 20 65 78 61 63 74 20 6d 61 74 63 68 20 74 6f 0a 20 20 20 20 20 74 68 65 20 | need.an.exact.match.to......the. |
| 9f560 | 6e 75 6d 62 65 72 20 77 65 27 72 65 20 6c 6f 6f 6b 69 6e 67 20 75 70 2c 20 62 75 74 20 6f 6e 6c | number.we're.looking.up,.but.onl |
| 9f580 | 79 20 61 20 6e 75 6d 62 65 72 20 77 69 74 68 69 6e 20 73 6f 6d 65 0a 20 20 20 20 20 74 6f 6c 65 | y.a.number.within.some......tole |
| 9f5a0 | 72 61 6e 63 65 20 6f 66 20 69 74 2e 20 20 44 65 73 69 67 6e 20 61 20 74 61 62 6c 65 20 63 6f 6e | rance.of.it...Design.a.table.con |
| 9f5c0 | 73 74 72 75 63 74 6f 72 20 60 6d 61 6b 65 2d 74 61 62 6c 65 27 20 74 68 61 74 0a 20 20 20 20 20 | structor.`make-table'.that...... |
| 9f5e0 | 74 61 6b 65 73 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 61 20 60 73 61 6d 65 2d 6b 65 79 | takes.as.an.argument.a.`same-key |
| 9f600 | 3f 27 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 77 69 6c 6c 20 62 65 20 75 73 65 64 20 74 | ?'.procedure.that.will.be.used.t |
| 9f620 | 6f 0a 20 20 20 20 20 74 65 73 74 20 22 65 71 75 61 6c 69 74 79 22 20 6f 66 20 6b 65 79 73 2e 20 | o......test."equality".of.keys.. |
| 9f640 | 20 60 4d 61 6b 65 2d 74 61 62 6c 65 27 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 20 60 64 | .`Make-table'.should.return.a.`d |
| 9f660 | 69 73 70 61 74 63 68 27 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 61 6e | ispatch'......procedure.that.can |
| 9f680 | 20 62 65 20 75 73 65 64 20 74 6f 20 61 63 63 65 73 73 20 61 70 70 72 6f 70 72 69 61 74 65 20 60 | .be.used.to.access.appropriate.` |
| 9f6a0 | 6c 6f 6f 6b 75 70 27 20 61 6e 64 0a 20 20 20 20 20 60 69 6e 73 65 72 74 21 27 20 70 72 6f 63 65 | lookup'.and......`insert!'.proce |
| 9f6c0 | 64 75 72 65 73 20 66 6f 72 20 61 20 6c 6f 63 61 6c 20 74 61 62 6c 65 2e 0a 0a 20 20 20 20 20 2a | dures.for.a.local.table........* |
| 9f6e0 | 45 78 65 72 63 69 73 65 20 33 2e 32 35 3a 2a 20 47 65 6e 65 72 61 6c 69 7a 69 6e 67 20 6f 6e 65 | Exercise.3.25:*.Generalizing.one |
| 9f700 | 2d 20 61 6e 64 20 74 77 6f 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 74 61 62 6c 65 73 2c 0a 20 20 | -.and.two-dimensional.tables,... |
| 9f720 | 20 20 20 73 68 6f 77 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 61 20 74 61 62 6c 65 | ...show.how.to.implement.a.table |
| 9f740 | 20 69 6e 20 77 68 69 63 68 20 76 61 6c 75 65 73 20 61 72 65 20 73 74 6f 72 65 64 20 75 6e 64 65 | .in.which.values.are.stored.unde |
| 9f760 | 72 20 61 6e 0a 20 20 20 20 20 61 72 62 69 74 72 61 72 79 20 6e 75 6d 62 65 72 20 6f 66 20 6b 65 | r.an......arbitrary.number.of.ke |
| 9f780 | 79 73 20 61 6e 64 20 64 69 66 66 65 72 65 6e 74 20 76 61 6c 75 65 73 20 6d 61 79 20 62 65 20 73 | ys.and.different.values.may.be.s |
| 9f7a0 | 74 6f 72 65 64 20 75 6e 64 65 72 0a 20 20 20 20 20 64 69 66 66 65 72 65 6e 74 20 6e 75 6d 62 65 | tored.under......different.numbe |
| 9f7c0 | 72 73 20 6f 66 20 6b 65 79 73 2e 20 20 54 68 65 20 60 6c 6f 6f 6b 75 70 27 20 61 6e 64 20 60 69 | rs.of.keys...The.`lookup'.and.`i |
| 9f7e0 | 6e 73 65 72 74 21 27 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 73 68 6f 75 6c 64 20 74 | nsert!'.procedures......should.t |
| 9f800 | 61 6b 65 20 61 73 20 69 6e 70 75 74 20 61 20 6c 69 73 74 20 6f 66 20 6b 65 79 73 20 75 73 65 64 | ake.as.input.a.list.of.keys.used |
| 9f820 | 20 74 6f 20 61 63 63 65 73 73 20 74 68 65 20 74 61 62 6c 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 | .to.access.the.table........*Exe |
| 9f840 | 72 63 69 73 65 20 33 2e 32 36 3a 2a 20 54 6f 20 73 65 61 72 63 68 20 61 20 74 61 62 6c 65 20 61 | rcise.3.26:*.To.search.a.table.a |
| 9f860 | 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 62 6f 76 65 2c 20 6f 6e 65 20 6e 65 65 64 73 0a 20 | s.implemented.above,.one.needs.. |
| 9f880 | 20 20 20 20 74 6f 20 73 63 61 6e 20 74 68 72 6f 75 67 68 20 74 68 65 20 6c 69 73 74 20 6f 66 20 | ....to.scan.through.the.list.of. |
| 9f8a0 | 72 65 63 6f 72 64 73 2e 20 20 54 68 69 73 20 69 73 20 62 61 73 69 63 61 6c 6c 79 20 74 68 65 0a | records...This.is.basically.the. |
| 9f8c0 | 20 20 20 20 20 75 6e 6f 72 64 65 72 65 64 20 6c 69 73 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 | .....unordered.list.representati |
| 9f8e0 | 6f 6e 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 33 2d 33 3a 3a 2e 20 20 46 6f | on.of.section.*Note.2-3-3::...Fo |
| 9f900 | 72 20 6c 61 72 67 65 0a 20 20 20 20 20 74 61 62 6c 65 73 2c 20 69 74 20 6d 61 79 20 62 65 20 6d | r.large......tables,.it.may.be.m |
| 9f920 | 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20 74 6f 20 73 74 72 75 63 74 75 72 65 20 74 68 65 20 74 | ore.efficient.to.structure.the.t |
| 9f940 | 61 62 6c 65 20 69 6e 20 61 0a 20 20 20 20 20 64 69 66 66 65 72 65 6e 74 20 6d 61 6e 6e 65 72 2e | able.in.a......different.manner. |
| 9f960 | 20 20 44 65 73 63 72 69 62 65 20 61 20 74 61 62 6c 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | ..Describe.a.table.implementatio |
| 9f980 | 6e 20 77 68 65 72 65 20 74 68 65 20 28 6b 65 79 2c 0a 20 20 20 20 20 76 61 6c 75 65 29 20 72 65 | n.where.the.(key,......value).re |
| 9f9a0 | 63 6f 72 64 73 20 61 72 65 20 6f 72 67 61 6e 69 7a 65 64 20 75 73 69 6e 67 20 61 20 62 69 6e 61 | cords.are.organized.using.a.bina |
| 9f9c0 | 72 79 20 74 72 65 65 2c 20 61 73 73 75 6d 69 6e 67 20 74 68 61 74 0a 20 20 20 20 20 6b 65 79 73 | ry.tree,.assuming.that......keys |
| 9f9e0 | 20 63 61 6e 20 62 65 20 6f 72 64 65 72 65 64 20 69 6e 20 73 6f 6d 65 20 77 61 79 20 28 65 2e 67 | .can.be.ordered.in.some.way.(e.g |
| 9fa00 | 2e 2c 20 6e 75 6d 65 72 69 63 61 6c 6c 79 20 6f 72 0a 20 20 20 20 20 61 6c 70 68 61 62 65 74 69 | .,.numerically.or......alphabeti |
| 9fa20 | 63 61 6c 6c 79 29 2e 20 20 28 43 6f 6d 70 61 72 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | cally)...(Compare.*Note.Exercise |
| 9fa40 | 20 32 2d 36 36 3a 3a 20 6f 66 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 0a 20 20 20 20 20 32 3a | .2-66::.of.*Note.Chapter......2: |
| 9fa60 | 3a 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 32 37 3a 2a 20 22 4d 65 6d 6f | :.).......*Exercise.3.27:*."Memo |
| 9fa80 | 69 7a 61 74 69 6f 6e 22 20 28 61 6c 73 6f 20 63 61 6c 6c 65 64 20 22 74 61 62 75 6c 61 74 69 6f | ization".(also.called."tabulatio |
| 9faa0 | 6e 22 29 20 69 73 20 61 0a 20 20 20 20 20 74 65 63 68 6e 69 71 75 65 20 74 68 61 74 20 65 6e 61 | n").is.a......technique.that.ena |
| 9fac0 | 62 6c 65 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 72 65 63 6f 72 64 2c 20 69 6e 20 61 | bles.a.procedure.to.record,.in.a |
| 9fae0 | 20 6c 6f 63 61 6c 20 74 61 62 6c 65 2c 0a 20 20 20 20 20 76 61 6c 75 65 73 20 74 68 61 74 20 68 | .local.table,......values.that.h |
| 9fb00 | 61 76 65 20 70 72 65 76 69 6f 75 73 6c 79 20 62 65 65 6e 20 63 6f 6d 70 75 74 65 64 2e 20 20 54 | ave.previously.been.computed...T |
| 9fb20 | 68 69 73 20 74 65 63 68 6e 69 71 75 65 20 63 61 6e 0a 20 20 20 20 20 6d 61 6b 65 20 61 20 76 61 | his.technique.can......make.a.va |
| 9fb40 | 73 74 20 64 69 66 66 65 72 65 6e 63 65 20 69 6e 20 74 68 65 20 70 65 72 66 6f 72 6d 61 6e 63 65 | st.difference.in.the.performance |
| 9fb60 | 20 6f 66 20 61 20 70 72 6f 67 72 61 6d 2e 20 20 41 20 6d 65 6d 6f 69 7a 65 64 0a 20 20 20 20 20 | .of.a.program...A.memoized...... |
| 9fb80 | 70 72 6f 63 65 64 75 72 65 20 6d 61 69 6e 74 61 69 6e 73 20 61 20 74 61 62 6c 65 20 69 6e 20 77 | procedure.maintains.a.table.in.w |
| 9fba0 | 68 69 63 68 20 76 61 6c 75 65 73 20 6f 66 20 70 72 65 76 69 6f 75 73 20 63 61 6c 6c 73 20 61 72 | hich.values.of.previous.calls.ar |
| 9fbc0 | 65 0a 20 20 20 20 20 73 74 6f 72 65 64 20 75 73 69 6e 67 20 61 73 20 6b 65 79 73 20 74 68 65 20 | e......stored.using.as.keys.the. |
| 9fbe0 | 61 72 67 75 6d 65 6e 74 73 20 74 68 61 74 20 70 72 6f 64 75 63 65 64 20 74 68 65 20 76 61 6c 75 | arguments.that.produced.the.valu |
| 9fc00 | 65 73 2e 20 20 57 68 65 6e 0a 20 20 20 20 20 74 68 65 20 6d 65 6d 6f 69 7a 65 64 20 70 72 6f 63 | es...When......the.memoized.proc |
| 9fc20 | 65 64 75 72 65 20 69 73 20 61 73 6b 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 61 20 76 61 6c 75 | edure.is.asked.to.compute.a.valu |
| 9fc40 | 65 2c 20 69 74 20 66 69 72 73 74 0a 20 20 20 20 20 63 68 65 63 6b 73 20 74 68 65 20 74 61 62 6c | e,.it.first......checks.the.tabl |
| 9fc60 | 65 20 74 6f 20 73 65 65 20 69 66 20 74 68 65 20 76 61 6c 75 65 20 69 73 20 61 6c 72 65 61 64 79 | e.to.see.if.the.value.is.already |
| 9fc80 | 20 74 68 65 72 65 20 61 6e 64 2c 20 69 66 20 73 6f 2c 0a 20 20 20 20 20 6a 75 73 74 20 72 65 74 | .there.and,.if.so,......just.ret |
| 9fca0 | 75 72 6e 73 20 74 68 61 74 20 76 61 6c 75 65 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 69 74 20 | urns.that.value...Otherwise,.it. |
| 9fcc0 | 63 6f 6d 70 75 74 65 73 20 74 68 65 20 6e 65 77 20 76 61 6c 75 65 20 69 6e 0a 20 20 20 20 20 74 | computes.the.new.value.in......t |
| 9fce0 | 68 65 20 6f 72 64 69 6e 61 72 79 20 77 61 79 20 61 6e 64 20 73 74 6f 72 65 73 20 74 68 69 73 20 | he.ordinary.way.and.stores.this. |
| 9fd00 | 69 6e 20 74 68 65 20 74 61 62 6c 65 2e 20 20 41 73 20 61 6e 20 65 78 61 6d 70 6c 65 20 6f 66 0a | in.the.table...As.an.example.of. |
| 9fd20 | 20 20 20 20 20 6d 65 6d 6f 69 7a 61 74 69 6f 6e 2c 20 72 65 63 61 6c 6c 20 66 72 6f 6d 20 73 65 | .....memoization,.recall.from.se |
| 9fd40 | 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 32 3a 3a 20 74 68 65 20 65 78 70 6f 6e 65 6e 74 | ction.*Note.1-2-2::.the.exponent |
| 9fd60 | 69 61 6c 0a 20 20 20 20 20 70 72 6f 63 65 73 73 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 46 | ial......process.for.computing.F |
| 9fd80 | 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | ibonacci.numbers:............(de |
| 9fda0 | 66 69 6e 65 20 28 66 69 62 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 | fine.(fib.n).............(cond.( |
| 9fdc0 | 28 3d 20 6e 20 30 29 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3d | (=.n.0).0)...................((= |
| 9fde0 | 20 6e 20 31 29 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 | .n.1).1)...................(else |
| 9fe00 | 20 28 2b 20 28 66 69 62 20 28 2d 20 6e 20 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(+.(fib.(-.n.1))............... |
| 9fe20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 62 20 28 2d 20 6e 20 32 29 29 29 29 29 29 0a 0a | .............(fib.(-.n.2)))))).. |
| 9fe40 | 20 20 20 20 20 54 68 65 20 6d 65 6d 6f 69 7a 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 | .....The.memoized.version.of.the |
| 9fe60 | 20 73 61 6d 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | .same.procedure.is............(d |
| 9fe80 | 65 66 69 6e 65 20 6d 65 6d 6f 2d 66 69 62 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 65 6d 6f | efine.memo-fib.............(memo |
| 9fea0 | 69 7a 65 20 28 6c 61 6d 62 64 61 20 28 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ize.(lambda.(n)................. |
| 9fec0 | 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d 20 6e 20 30 29 20 30 29 0a 20 20 20 20 20 20 20 | .......(cond.((=.n.0).0)........ |
| 9fee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 3d 20 6e 20 31 29 20 31 | ......................((=.n.1).1 |
| 9ff00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | )..............................( |
| 9ff20 | 65 6c 73 65 20 28 2b 20 28 6d 65 6d 6f 2d 66 69 62 20 28 2d 20 6e 20 31 29 29 0a 20 20 20 20 20 | else.(+.(memo-fib.(-.n.1))...... |
| 9ff40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 9ff60 | 20 28 6d 65 6d 6f 2d 66 69 62 20 28 2d 20 6e 20 32 29 29 29 29 29 29 29 29 0a 0a 20 20 20 20 20 | .(memo-fib.(-.n.2))))))))....... |
| 9ff80 | 77 68 65 72 65 20 74 68 65 20 6d 65 6d 6f 69 7a 65 72 20 69 73 20 64 65 66 69 6e 65 64 20 61 73 | where.the.memoizer.is.defined.as |
| 9ffa0 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 65 6d 6f 69 7a 65 20 66 29 0a | ............(define.(memoize.f). |
| 9ffc0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 61 62 6c 65 20 28 6d 61 6b 65 2d 74 | ............(let.((table.(make-t |
| 9ffe0 | 61 62 6c 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 78 | able)))...............(lambda.(x |
| a0000 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 65 76 69 6f 75 | ).................(let.((previou |
| a0020 | 73 6c 79 2d 63 6f 6d 70 75 74 65 64 2d 72 65 73 75 6c 74 20 28 6c 6f 6f 6b 75 70 20 78 20 74 61 | sly-computed-result.(lookup.x.ta |
| a0040 | 62 6c 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 72 20 70 72 65 | ble)))...................(or.pre |
| a0060 | 76 69 6f 75 73 6c 79 2d 63 6f 6d 70 75 74 65 64 2d 72 65 73 75 6c 74 0a 20 20 20 20 20 20 20 20 | viously-computed-result......... |
| a0080 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 75 6c 74 20 28 66 20 78 | ..............(let.((result.(f.x |
| a00a0 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 6e 73 | ))).........................(ins |
| a00c0 | 65 72 74 21 20 78 20 72 65 73 75 6c 74 20 74 61 62 6c 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ert!.x.result.table)............ |
| a00e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 73 75 6c 74 29 29 29 29 29 29 0a 0a 20 20 20 20 20 | .............result))))))....... |
| a0100 | 44 72 61 77 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 64 69 61 67 72 61 6d 20 74 6f 20 61 | Draw.an.environment.diagram.to.a |
| a0120 | 6e 61 6c 79 7a 65 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 | nalyze.the.computation.of......` |
| a0140 | 28 6d 65 6d 6f 2d 66 69 62 20 33 29 27 2e 20 20 45 78 70 6c 61 69 6e 20 77 68 79 20 60 6d 65 6d | (memo-fib.3)'...Explain.why.`mem |
| a0160 | 6f 2d 66 69 62 27 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 6e 74 68 20 46 69 62 6f 6e 61 63 63 | o-fib'.computes.the.nth.Fibonacc |
| a0180 | 69 0a 20 20 20 20 20 6e 75 6d 62 65 72 20 69 6e 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 65 | i......number.in.a.number.of.ste |
| a01a0 | 70 73 20 70 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 6e 2e 20 20 57 6f 75 6c 64 20 74 68 65 | ps.proportional.to.n...Would.the |
| a01c0 | 20 73 63 68 65 6d 65 0a 20 20 20 20 20 73 74 69 6c 6c 20 77 6f 72 6b 20 69 66 20 77 65 20 68 61 | .scheme......still.work.if.we.ha |
| a01e0 | 64 20 73 69 6d 70 6c 79 20 64 65 66 69 6e 65 64 20 60 6d 65 6d 6f 2d 66 69 62 27 20 74 6f 20 62 | d.simply.defined.`memo-fib'.to.b |
| a0200 | 65 20 60 28 6d 65 6d 6f 69 7a 65 0a 20 20 20 20 20 66 69 62 29 27 3f 0a 0a 20 20 20 2d 2d 2d 2d | e.`(memoize......fib)'?.....---- |
| a0220 | 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 | ------.Footnotes.----------..... |
| a0240 | 28 31 29 20 42 65 63 61 75 73 65 20 60 61 73 73 6f 63 27 20 75 73 65 73 20 60 65 71 75 61 6c 3f | (1).Because.`assoc'.uses.`equal? |
| a0260 | 27 2c 20 69 74 20 63 61 6e 20 72 65 63 6f 67 6e 69 7a 65 20 6b 65 79 73 20 74 68 61 74 20 61 72 | ',.it.can.recognize.keys.that.ar |
| a0280 | 65 0a 73 79 6d 62 6f 6c 73 2c 20 6e 75 6d 62 65 72 73 2c 20 6f 72 20 6c 69 73 74 20 73 74 72 75 | e.symbols,.numbers,.or.list.stru |
| a02a0 | 63 74 75 72 65 2e 0a 0a 20 20 20 28 32 29 20 54 68 75 73 2c 20 74 68 65 20 66 69 72 73 74 20 62 | cture......(2).Thus,.the.first.b |
| a02c0 | 61 63 6b 62 6f 6e 65 20 70 61 69 72 20 69 73 20 74 68 65 20 6f 62 6a 65 63 74 20 74 68 61 74 20 | ackbone.pair.is.the.object.that. |
| a02e0 | 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 0a 74 61 62 6c 65 20 22 69 74 73 65 6c 66 22 3b 20 74 | represents.the.table."itself";.t |
| a0300 | 68 61 74 20 69 73 2c 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 74 61 62 6c 65 20 69 | hat.is,.a.pointer.to.the.table.i |
| a0320 | 73 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 69 73 0a 70 61 69 72 2e 20 20 54 68 69 73 20 | s.a.pointer.to.this.pair...This. |
| a0340 | 73 61 6d 65 20 62 61 63 6b 62 6f 6e 65 20 70 61 69 72 20 61 6c 77 61 79 73 20 73 74 61 72 74 73 | same.backbone.pair.always.starts |
| a0360 | 20 74 68 65 20 74 61 62 6c 65 2e 20 20 49 66 20 77 65 20 64 69 64 20 6e 6f 74 0a 61 72 72 61 6e | .the.table...If.we.did.not.arran |
| a0380 | 67 65 20 74 68 69 6e 67 73 20 69 6e 20 74 68 69 73 20 77 61 79 2c 20 60 69 6e 73 65 72 74 21 27 | ge.things.in.this.way,.`insert!' |
| a03a0 | 20 77 6f 75 6c 64 20 68 61 76 65 20 74 6f 20 72 65 74 75 72 6e 20 61 20 6e 65 77 20 76 61 6c 75 | .would.have.to.return.a.new.valu |
| a03c0 | 65 0a 66 6f 72 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 68 65 20 74 61 62 6c 65 20 77 68 65 | e.for.the.start.of.the.table.whe |
| a03e0 | 6e 20 69 74 20 61 64 64 65 64 20 61 20 6e 65 77 20 72 65 63 6f 72 64 2e 0a 0a 1f 0a 46 69 6c 65 | n.it.added.a.new.record.....File |
| a0400 | 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 33 2d 34 2c 20 20 4e 65 78 74 | :.sicp.info,..Node:.3-3-4,..Next |
| a0420 | 3a 20 33 2d 33 2d 35 2c 20 20 50 72 65 76 3a 20 33 2d 33 2d 33 2c 20 20 55 70 3a 20 33 2d 33 0a | :.3-3-5,..Prev:.3-3-3,..Up:.3-3. |
| a0440 | 0a 33 2e 33 2e 34 20 41 20 53 69 6d 75 6c 61 74 6f 72 20 66 6f 72 20 44 69 67 69 74 61 6c 20 43 | .3.3.4.A.Simulator.for.Digital.C |
| a0460 | 69 72 63 75 69 74 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ircuits.------------------------ |
| a0480 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 44 65 73 69 67 6e 69 6e 67 20 63 6f 6d 70 6c 65 | --------------..Designing.comple |
| a04a0 | 78 20 64 69 67 69 74 61 6c 20 73 79 73 74 65 6d 73 2c 20 73 75 63 68 20 61 73 20 63 6f 6d 70 75 | x.digital.systems,.such.as.compu |
| a04c0 | 74 65 72 73 2c 20 69 73 20 61 6e 20 69 6d 70 6f 72 74 61 6e 74 0a 65 6e 67 69 6e 65 65 72 69 6e | ters,.is.an.important.engineerin |
| a04e0 | 67 20 61 63 74 69 76 69 74 79 2e 20 20 44 69 67 69 74 61 6c 20 73 79 73 74 65 6d 73 20 61 72 65 | g.activity...Digital.systems.are |
| a0500 | 20 63 6f 6e 73 74 72 75 63 74 65 64 20 62 79 0a 69 6e 74 65 72 63 6f 6e 6e 65 63 74 69 6e 67 20 | .constructed.by.interconnecting. |
| a0520 | 73 69 6d 70 6c 65 20 65 6c 65 6d 65 6e 74 73 2e 20 20 41 6c 74 68 6f 75 67 68 20 74 68 65 20 62 | simple.elements...Although.the.b |
| a0540 | 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 73 65 0a 69 6e 64 69 76 69 64 75 61 6c 20 65 6c 65 6d | ehavior.of.these.individual.elem |
| a0560 | 65 6e 74 73 20 69 73 20 73 69 6d 70 6c 65 2c 20 6e 65 74 77 6f 72 6b 73 20 6f 66 20 74 68 65 6d | ents.is.simple,.networks.of.them |
| a0580 | 20 63 61 6e 20 68 61 76 65 20 76 65 72 79 20 63 6f 6d 70 6c 65 78 0a 62 65 68 61 76 69 6f 72 2e | .can.have.very.complex.behavior. |
| a05a0 | 20 20 43 6f 6d 70 75 74 65 72 20 73 69 6d 75 6c 61 74 69 6f 6e 20 6f 66 20 70 72 6f 70 6f 73 65 | ..Computer.simulation.of.propose |
| a05c0 | 64 20 63 69 72 63 75 69 74 20 64 65 73 69 67 6e 73 20 69 73 20 61 6e 0a 69 6d 70 6f 72 74 61 6e | d.circuit.designs.is.an.importan |
| a05e0 | 74 20 74 6f 6f 6c 20 75 73 65 64 20 62 79 20 64 69 67 69 74 61 6c 20 73 79 73 74 65 6d 73 20 65 | t.tool.used.by.digital.systems.e |
| a0600 | 6e 67 69 6e 65 65 72 73 2e 20 20 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 77 65 0a 64 65 | ngineers...In.this.section.we.de |
| a0620 | 73 69 67 6e 20 61 20 73 79 73 74 65 6d 20 66 6f 72 20 70 65 72 66 6f 72 6d 69 6e 67 20 64 69 67 | sign.a.system.for.performing.dig |
| a0640 | 69 74 61 6c 20 6c 6f 67 69 63 20 73 69 6d 75 6c 61 74 69 6f 6e 73 2e 20 20 54 68 69 73 20 73 79 | ital.logic.simulations...This.sy |
| a0660 | 73 74 65 6d 0a 74 79 70 69 66 69 65 73 20 61 20 6b 69 6e 64 20 6f 66 20 70 72 6f 67 72 61 6d 20 | stem.typifies.a.kind.of.program. |
| a0680 | 63 61 6c 6c 65 64 20 61 6e 20 22 65 76 65 6e 74 2d 64 72 69 76 65 6e 20 73 69 6d 75 6c 61 74 69 | called.an."event-driven.simulati |
| a06a0 | 6f 6e 22 2c 20 69 6e 0a 77 68 69 63 68 20 61 63 74 69 6f 6e 73 20 28 22 65 76 65 6e 74 73 22 29 | on",.in.which.actions.("events") |
| a06c0 | 20 74 72 69 67 67 65 72 20 66 75 72 74 68 65 72 20 65 76 65 6e 74 73 20 74 68 61 74 20 68 61 70 | .trigger.further.events.that.hap |
| a06e0 | 70 65 6e 20 61 74 20 61 20 6c 61 74 65 72 0a 74 69 6d 65 2c 20 77 68 69 63 68 20 69 6e 20 74 75 | pen.at.a.later.time,.which.in.tu |
| a0700 | 72 6e 20 74 72 69 67 67 65 72 20 6d 6f 72 65 20 65 76 65 6e 74 73 2c 20 61 6e 64 20 73 6f 20 73 | rn.trigger.more.events,.and.so.s |
| a0720 | 6f 2e 0a 0a 20 20 20 4f 75 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 20 6f | o......Our.computational.model.o |
| a0740 | 66 20 61 20 63 69 72 63 75 69 74 20 77 69 6c 6c 20 62 65 20 63 6f 6d 70 6f 73 65 64 20 6f 66 20 | f.a.circuit.will.be.composed.of. |
| a0760 | 6f 62 6a 65 63 74 73 20 74 68 61 74 0a 63 6f 72 72 65 73 70 6f 6e 64 20 74 6f 20 74 68 65 20 65 | objects.that.correspond.to.the.e |
| a0780 | 6c 65 6d 65 6e 74 61 72 79 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 66 72 6f 6d 20 77 68 69 63 68 20 | lementary.components.from.which. |
| a07a0 | 74 68 65 20 63 69 72 63 75 69 74 20 69 73 0a 63 6f 6e 73 74 72 75 63 74 65 64 2e 20 20 54 68 65 | the.circuit.is.constructed...The |
| a07c0 | 72 65 20 61 72 65 20 22 77 69 72 65 73 22 2c 20 77 68 69 63 68 20 63 61 72 72 79 20 22 64 69 67 | re.are."wires",.which.carry."dig |
| a07e0 | 69 74 61 6c 20 73 69 67 6e 61 6c 73 22 2e 20 20 41 0a 64 69 67 69 74 61 6c 20 73 69 67 6e 61 6c | ital.signals"...A.digital.signal |
| a0800 | 20 6d 61 79 20 61 74 20 61 6e 79 20 6d 6f 6d 65 6e 74 20 68 61 76 65 20 6f 6e 6c 79 20 6f 6e 65 | .may.at.any.moment.have.only.one |
| a0820 | 20 6f 66 20 74 77 6f 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 2c 0a 30 20 61 6e 64 20 31 | .of.two.possible.values,.0.and.1 |
| a0840 | 2e 20 20 54 68 65 72 65 20 61 72 65 20 61 6c 73 6f 20 76 61 72 69 6f 75 73 20 74 79 70 65 73 20 | ...There.are.also.various.types. |
| a0860 | 6f 66 20 64 69 67 69 74 61 6c 20 22 66 75 6e 63 74 69 6f 6e 20 62 6f 78 65 73 22 2c 0a 77 68 69 | of.digital."function.boxes",.whi |
| a0880 | 63 68 20 63 6f 6e 6e 65 63 74 20 77 69 72 65 73 20 63 61 72 72 79 69 6e 67 20 69 6e 70 75 74 20 | ch.connect.wires.carrying.input. |
| a08a0 | 73 69 67 6e 61 6c 73 20 74 6f 20 6f 74 68 65 72 20 6f 75 74 70 75 74 20 77 69 72 65 73 2e 20 20 | signals.to.other.output.wires... |
| a08c0 | 53 75 63 68 0a 62 6f 78 65 73 20 70 72 6f 64 75 63 65 20 6f 75 74 70 75 74 20 73 69 67 6e 61 6c | Such.boxes.produce.output.signal |
| a08e0 | 73 20 63 6f 6d 70 75 74 65 64 20 66 72 6f 6d 20 74 68 65 69 72 20 69 6e 70 75 74 20 73 69 67 6e | s.computed.from.their.input.sign |
| a0900 | 61 6c 73 2e 20 20 54 68 65 0a 6f 75 74 70 75 74 20 73 69 67 6e 61 6c 20 69 73 20 64 65 6c 61 79 | als...The.output.signal.is.delay |
| a0920 | 65 64 20 62 79 20 61 20 74 69 6d 65 20 74 68 61 74 20 64 65 70 65 6e 64 73 20 6f 6e 20 74 68 65 | ed.by.a.time.that.depends.on.the |
| a0940 | 20 74 79 70 65 20 6f 66 20 74 68 65 0a 66 75 6e 63 74 69 6f 6e 20 62 6f 78 2e 20 20 46 6f 72 20 | .type.of.the.function.box...For. |
| a0960 | 65 78 61 6d 70 6c 65 2c 20 61 6e 20 22 69 6e 76 65 72 74 65 72 22 20 69 73 20 61 20 70 72 69 6d | example,.an."inverter".is.a.prim |
| a0980 | 69 74 69 76 65 20 66 75 6e 63 74 69 6f 6e 20 62 6f 78 0a 74 68 61 74 20 69 6e 76 65 72 74 73 20 | itive.function.box.that.inverts. |
| a09a0 | 69 74 73 20 69 6e 70 75 74 2e 20 20 49 66 20 74 68 65 20 69 6e 70 75 74 20 73 69 67 6e 61 6c 20 | its.input...If.the.input.signal. |
| a09c0 | 74 6f 20 61 6e 20 69 6e 76 65 72 74 65 72 20 63 68 61 6e 67 65 73 20 74 6f 0a 30 2c 20 74 68 65 | to.an.inverter.changes.to.0,.the |
| a09e0 | 6e 20 6f 6e 65 20 69 6e 76 65 72 74 65 72 2d 64 65 6c 61 79 20 6c 61 74 65 72 20 74 68 65 20 69 | n.one.inverter-delay.later.the.i |
| a0a00 | 6e 76 65 72 74 65 72 20 77 69 6c 6c 20 63 68 61 6e 67 65 20 69 74 73 20 6f 75 74 70 75 74 0a 73 | nverter.will.change.its.output.s |
| a0a20 | 69 67 6e 61 6c 20 74 6f 20 31 2e 20 20 49 66 20 74 68 65 20 69 6e 70 75 74 20 73 69 67 6e 61 6c | ignal.to.1...If.the.input.signal |
| a0a40 | 20 74 6f 20 61 6e 20 69 6e 76 65 72 74 65 72 20 63 68 61 6e 67 65 73 20 74 6f 20 31 2c 20 74 68 | .to.an.inverter.changes.to.1,.th |
| a0a60 | 65 6e 20 6f 6e 65 0a 69 6e 76 65 72 74 65 72 2d 64 65 6c 61 79 20 6c 61 74 65 72 20 74 68 65 20 | en.one.inverter-delay.later.the. |
| a0a80 | 69 6e 76 65 72 74 65 72 20 77 69 6c 6c 20 63 68 61 6e 67 65 20 69 74 73 20 6f 75 74 70 75 74 20 | inverter.will.change.its.output. |
| a0aa0 | 73 69 67 6e 61 6c 20 74 6f 20 30 2e 0a 57 65 20 64 72 61 77 20 61 6e 20 69 6e 76 65 72 74 65 72 | signal.to.0..We.draw.an.inverter |
| a0ac0 | 20 73 79 6d 62 6f 6c 69 63 61 6c 6c 79 20 61 73 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 | .symbolically.as.in.*Note.Figure |
| a0ae0 | 20 33 2d 32 34 3a 3a 2e 20 20 41 6e 20 22 61 6e 64 2d 67 61 74 65 22 2c 0a 61 6c 73 6f 20 73 68 | .3-24::...An."and-gate",.also.sh |
| a0b00 | 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 32 34 3a 3a 2c 20 69 73 20 61 | own.in.*Note.Figure.3-24::,.is.a |
| a0b20 | 20 70 72 69 6d 69 74 69 76 65 20 66 75 6e 63 74 69 6f 6e 20 62 6f 78 20 77 69 74 68 20 74 77 6f | .primitive.function.box.with.two |
| a0b40 | 0a 69 6e 70 75 74 73 20 61 6e 64 20 6f 6e 65 20 6f 75 74 70 75 74 2e 20 20 49 74 20 64 72 69 76 | .inputs.and.one.output...It.driv |
| a0b60 | 65 73 20 69 74 73 20 6f 75 74 70 75 74 20 73 69 67 6e 61 6c 20 74 6f 20 61 20 76 61 6c 75 65 20 | es.its.output.signal.to.a.value. |
| a0b80 | 74 68 61 74 20 69 73 0a 74 68 65 20 22 6c 6f 67 69 63 61 6c 20 61 6e 64 22 20 6f 66 20 74 68 65 | that.is.the."logical.and".of.the |
| a0ba0 | 20 69 6e 70 75 74 73 2e 20 20 54 68 61 74 20 69 73 2c 20 69 66 20 62 6f 74 68 20 6f 66 20 69 74 | .inputs...That.is,.if.both.of.it |
| a0bc0 | 73 20 69 6e 70 75 74 20 73 69 67 6e 61 6c 73 0a 62 65 63 6f 6d 65 20 31 2c 20 74 68 65 6e 20 6f | s.input.signals.become.1,.then.o |
| a0be0 | 6e 65 20 61 6e 64 2d 67 61 74 65 2d 64 65 6c 61 79 20 74 69 6d 65 20 6c 61 74 65 72 20 74 68 65 | ne.and-gate-delay.time.later.the |
| a0c00 | 20 61 6e 64 2d 67 61 74 65 20 77 69 6c 6c 20 66 6f 72 63 65 0a 69 74 73 20 6f 75 74 70 75 74 20 | .and-gate.will.force.its.output. |
| a0c20 | 73 69 67 6e 61 6c 20 74 6f 20 62 65 20 31 3b 20 6f 74 68 65 72 77 69 73 65 20 74 68 65 20 6f 75 | signal.to.be.1;.otherwise.the.ou |
| a0c40 | 74 70 75 74 20 77 69 6c 6c 20 62 65 20 30 2e 20 20 41 6e 20 22 6f 72 2d 67 61 74 65 22 0a 69 73 | tput.will.be.0...An."or-gate".is |
| a0c60 | 20 61 20 73 69 6d 69 6c 61 72 20 74 77 6f 2d 69 6e 70 75 74 20 70 72 69 6d 69 74 69 76 65 20 66 | .a.similar.two-input.primitive.f |
| a0c80 | 75 6e 63 74 69 6f 6e 20 62 6f 78 20 74 68 61 74 20 64 72 69 76 65 73 20 69 74 73 20 6f 75 74 70 | unction.box.that.drives.its.outp |
| a0ca0 | 75 74 0a 73 69 67 6e 61 6c 20 74 6f 20 61 20 76 61 6c 75 65 20 74 68 61 74 20 69 73 20 74 68 65 | ut.signal.to.a.value.that.is.the |
| a0cc0 | 20 22 6c 6f 67 69 63 61 6c 20 6f 72 22 20 6f 66 20 74 68 65 20 69 6e 70 75 74 73 2e 20 20 54 68 | ."logical.or".of.the.inputs...Th |
| a0ce0 | 61 74 20 69 73 2c 20 74 68 65 0a 6f 75 74 70 75 74 20 77 69 6c 6c 20 62 65 63 6f 6d 65 20 31 20 | at.is,.the.output.will.become.1. |
| a0d00 | 69 66 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 6f 66 20 74 68 65 20 69 6e 70 75 74 20 73 69 67 | if.at.least.one.of.the.input.sig |
| a0d20 | 6e 61 6c 73 20 69 73 20 31 3b 0a 6f 74 68 65 72 77 69 73 65 20 74 68 65 20 6f 75 74 70 75 74 20 | nals.is.1;.otherwise.the.output. |
| a0d40 | 77 69 6c 6c 20 62 65 63 6f 6d 65 20 30 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 32 | will.become.0........*Figure.3.2 |
| a0d60 | 34 3a 2a 20 50 72 69 6d 69 74 69 76 65 20 66 75 6e 63 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 64 | 4:*.Primitive.functions.in.the.d |
| a0d80 | 69 67 69 74 61 6c 20 6c 6f 67 69 63 20 73 69 6d 75 6c 61 74 6f 72 2e 0a 0a 20 20 20 20 20 20 20 | igital.logic.simulator.......... |
| a0da0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 20 20 20 20 20 20 20 20 20 20 5f 5f | ..................__..........__ |
| a0dc0 | 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 5c 20 20 20 20 20 20 20 20 2d 2d 7c 20 20 5c 20 20 | _.............|\........--|..\.. |
| a0de0 | 20 20 20 20 20 2d 2d 5c 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 7c 20 3e 6f 2d 2d 20 20 | .....--\..\...........--|.>o--.. |
| a0e00 | 20 20 20 20 7c 20 20 20 29 2d 2d 20 20 20 20 20 20 20 29 20 20 3e 2d 2d 0a 20 20 20 20 20 20 20 | ....|...)--.......)..>--........ |
| a0e20 | 20 20 20 20 20 7c 2f 20 20 20 20 20 20 20 20 2d 2d 7c 5f 5f 2f 20 20 20 20 20 20 20 2d 2d 2f 5f | .....|/........--|__/.......--/_ |
| a0e40 | 5f 2f 0a 0a 20 20 20 20 20 20 20 20 20 20 49 6e 76 65 72 74 65 72 20 20 20 20 41 6e 64 2d 67 61 | _/............Inverter....And-ga |
| a0e60 | 74 65 20 20 20 20 20 4f 72 2d 67 61 74 65 0a 0a 20 20 20 57 65 20 63 61 6e 20 63 6f 6e 6e 65 63 | te.....Or-gate.....We.can.connec |
| a0e80 | 74 20 70 72 69 6d 69 74 69 76 65 20 66 75 6e 63 74 69 6f 6e 73 20 74 6f 67 65 74 68 65 72 20 74 | t.primitive.functions.together.t |
| a0ea0 | 6f 20 63 6f 6e 73 74 72 75 63 74 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 0a 66 75 6e 63 74 69 6f | o.construct.more.complex.functio |
| a0ec0 | 6e 73 2e 20 20 54 6f 20 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 20 77 65 20 77 69 72 65 20 | ns...To.accomplish.this.we.wire. |
| a0ee0 | 74 68 65 20 6f 75 74 70 75 74 73 20 6f 66 20 73 6f 6d 65 20 66 75 6e 63 74 69 6f 6e 0a 62 6f 78 | the.outputs.of.some.function.box |
| a0f00 | 65 73 20 74 6f 20 74 68 65 20 69 6e 70 75 74 73 20 6f 66 20 6f 74 68 65 72 20 66 75 6e 63 74 69 | es.to.the.inputs.of.other.functi |
| a0f20 | 6f 6e 20 62 6f 78 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 22 68 61 6c | on.boxes...For.example,.the."hal |
| a0f40 | 66 2d 61 64 64 65 72 22 0a 63 69 72 63 75 69 74 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 | f-adder".circuit.shown.in.*Note. |
| a0f60 | 46 69 67 75 72 65 20 33 2d 32 35 3a 3a 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 61 6e 20 6f 72 2d | Figure.3-25::.consists.of.an.or- |
| a0f80 | 67 61 74 65 2c 20 74 77 6f 0a 61 6e 64 2d 67 61 74 65 73 2c 20 61 6e 64 20 61 6e 20 69 6e 76 65 | gate,.two.and-gates,.and.an.inve |
| a0fa0 | 72 74 65 72 2e 20 20 49 74 20 74 61 6b 65 73 20 74 77 6f 20 69 6e 70 75 74 20 73 69 67 6e 61 6c | rter...It.takes.two.input.signal |
| a0fc0 | 73 2c 20 41 20 61 6e 64 20 42 2c 20 61 6e 64 0a 68 61 73 20 74 77 6f 20 6f 75 74 70 75 74 20 73 | s,.A.and.B,.and.has.two.output.s |
| a0fe0 | 69 67 6e 61 6c 73 2c 20 53 20 61 6e 64 20 43 2e 20 20 53 20 77 69 6c 6c 20 62 65 63 6f 6d 65 20 | ignals,.S.and.C...S.will.become. |
| a1000 | 31 20 77 68 65 6e 65 76 65 72 20 70 72 65 63 69 73 65 6c 79 0a 6f 6e 65 20 6f 66 20 41 20 61 6e | 1.whenever.precisely.one.of.A.an |
| a1020 | 64 20 42 20 69 73 20 31 2c 20 61 6e 64 20 43 20 77 69 6c 6c 20 62 65 63 6f 6d 65 20 31 20 77 68 | d.B.is.1,.and.C.will.become.1.wh |
| a1040 | 65 6e 65 76 65 72 20 41 20 61 6e 64 20 42 20 61 72 65 20 62 6f 74 68 20 31 2e 0a 57 65 20 63 61 | enever.A.and.B.are.both.1..We.ca |
| a1060 | 6e 20 73 65 65 20 66 72 6f 6d 20 74 68 65 20 66 69 67 75 72 65 20 74 68 61 74 2c 20 62 65 63 61 | n.see.from.the.figure.that,.beca |
| a1080 | 75 73 65 20 6f 66 20 74 68 65 20 64 65 6c 61 79 73 20 69 6e 76 6f 6c 76 65 64 2c 20 74 68 65 0a | use.of.the.delays.involved,.the. |
| a10a0 | 6f 75 74 70 75 74 73 20 6d 61 79 20 62 65 20 67 65 6e 65 72 61 74 65 64 20 61 74 20 64 69 66 66 | outputs.may.be.generated.at.diff |
| a10c0 | 65 72 65 6e 74 20 74 69 6d 65 73 2e 20 20 4d 61 6e 79 20 6f 66 20 74 68 65 20 64 69 66 66 69 63 | erent.times...Many.of.the.diffic |
| a10e0 | 75 6c 74 69 65 73 0a 69 6e 20 74 68 65 20 64 65 73 69 67 6e 20 6f 66 20 64 69 67 69 74 61 6c 20 | ulties.in.the.design.of.digital. |
| a1100 | 63 69 72 63 75 69 74 73 20 61 72 69 73 65 20 66 72 6f 6d 20 74 68 69 73 20 66 61 63 74 2e 0a 0a | circuits.arise.from.this.fact... |
| a1120 | 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 32 35 3a 2a 20 41 20 68 61 6c 66 2d 61 64 64 65 72 | .....*Figure.3.25:*.A.half-adder |
| a1140 | 20 63 69 72 63 75 69 74 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d | .circuit.................+------ |
| a1160 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| a1180 | 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 5f 5f 5f 5f 20 20 | +...............|.........____.. |
| a11a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 | .......................|........ |
| a11c0 | 20 20 20 41 20 2d 2d 2d 2d 2d 2d 2d 2d 2a 2d 2d 2d 5c 20 20 20 5c 20 44 20 20 20 20 20 20 20 20 | ...A.--------*---\...\.D........ |
| a11e0 | 20 20 20 20 20 20 20 5f 5f 5f 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | .......___....|...............|. |
| a1200 | 20 20 20 20 7c 20 20 20 20 3e 20 20 20 3e 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c 20 20 | ....|....>...>---------------|.. |
| a1220 | 20 5c 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 2b 2d 2d 7c 2d 2d 2d 2f | .\...|...............|..+--|---/ |
| a1240 | 5f 5f 5f 2f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 29 2d 2d 2d 2d 2d 20 | ___/................|....)-----. |
| a1260 | 53 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 20 7c 20 20 20 20 20 20 20 20 20 | S...............|..|..|......... |
| a1280 | 20 20 20 20 20 7c 5c 20 20 45 20 20 2b 2d 2d 7c 5f 5f 5f 2f 20 20 20 7c 0a 20 20 20 20 20 20 20 | .....|\..E..+--|___/...|........ |
| a12a0 | 20 20 20 20 20 20 20 7c 20 20 7c 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 7c 20 3e 6f | .......|..|..|...........+--|.>o |
| a12c0 | 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ---+..........|...............|. |
| a12e0 | 20 7c 20 20 7c 20 20 20 20 5f 5f 5f 20 20 20 20 7c 20 20 7c 2f 20 20 20 20 20 20 20 20 20 20 20 | .|..|....___....|..|/........... |
| a1300 | 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 20 2b 2d 2d 2d 7c | .....|...............|..|..+---| |
| a1320 | 20 20 20 5c 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | ...\...|....................|... |
| a1340 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 20 20 20 20 20 7c 20 20 20 20 29 2d 2d 2a 2d | ............|..|......|....)--*- |
| a1360 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 43 0a 20 20 20 20 20 20 20 | ----------------------.C........ |
| a1380 | 20 20 20 42 20 2d 2d 2d 2d 2d 2a 2d 2d 2d 2d 2d 2d 7c 5f 5f 5f 2f 20 20 20 20 20 20 20 20 20 20 | ...B.-----*------|___/.......... |
| a13a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ..............|...............|. |
| a13c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| a13e0 | 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .....|...............+---------- |
| a1400 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 | ----------------------------+... |
| a1420 | 20 20 57 65 20 77 69 6c 6c 20 6e 6f 77 20 62 75 69 6c 64 20 61 20 70 72 6f 67 72 61 6d 20 66 6f | ..We.will.now.build.a.program.fo |
| a1440 | 72 20 6d 6f 64 65 6c 69 6e 67 20 74 68 65 20 64 69 67 69 74 61 6c 20 6c 6f 67 69 63 20 63 69 72 | r.modeling.the.digital.logic.cir |
| a1460 | 63 75 69 74 73 0a 77 65 20 77 69 73 68 20 74 6f 20 73 74 75 64 79 2e 20 20 54 68 65 20 70 72 6f | cuits.we.wish.to.study...The.pro |
| a1480 | 67 72 61 6d 20 77 69 6c 6c 20 63 6f 6e 73 74 72 75 63 74 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 | gram.will.construct.computationa |
| a14a0 | 6c 20 6f 62 6a 65 63 74 73 0a 6d 6f 64 65 6c 69 6e 67 20 74 68 65 20 77 69 72 65 73 2c 20 77 68 | l.objects.modeling.the.wires,.wh |
| a14c0 | 69 63 68 20 77 69 6c 6c 20 22 68 6f 6c 64 22 20 74 68 65 20 73 69 67 6e 61 6c 73 2e 20 20 46 75 | ich.will."hold".the.signals...Fu |
| a14e0 | 6e 63 74 69 6f 6e 20 62 6f 78 65 73 20 77 69 6c 6c 0a 62 65 20 6d 6f 64 65 6c 65 64 20 62 79 20 | nction.boxes.will.be.modeled.by. |
| a1500 | 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 65 6e 66 6f 72 63 65 20 74 68 65 20 63 6f 72 72 | procedures.that.enforce.the.corr |
| a1520 | 65 63 74 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 73 20 61 6d 6f 6e 67 0a 74 68 65 20 73 69 67 6e | ect.relationships.among.the.sign |
| a1540 | 61 6c 73 2e 0a 0a 20 20 20 4f 6e 65 20 62 61 73 69 63 20 65 6c 65 6d 65 6e 74 20 6f 66 20 6f 75 | als......One.basic.element.of.ou |
| a1560 | 72 20 73 69 6d 75 6c 61 74 69 6f 6e 20 77 69 6c 6c 20 62 65 20 61 20 70 72 6f 63 65 64 75 72 65 | r.simulation.will.be.a.procedure |
| a1580 | 20 60 6d 61 6b 65 2d 77 69 72 65 27 2c 0a 77 68 69 63 68 20 63 6f 6e 73 74 72 75 63 74 73 20 77 | .`make-wire',.which.constructs.w |
| a15a0 | 69 72 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 63 6f 6e 73 74 | ires...For.example,.we.can.const |
| a15c0 | 72 75 63 74 20 73 69 78 20 77 69 72 65 73 20 61 73 0a 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 | ruct.six.wires.as.follows:...... |
| a15e0 | 20 28 64 65 66 69 6e 65 20 61 20 28 6d 61 6b 65 2d 77 69 72 65 29 29 0a 20 20 20 20 20 28 64 65 | .(define.a.(make-wire))......(de |
| a1600 | 66 69 6e 65 20 62 20 28 6d 61 6b 65 2d 77 69 72 65 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | fine.b.(make-wire))......(define |
| a1620 | 20 63 20 28 6d 61 6b 65 2d 77 69 72 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 64 20 | .c.(make-wire)).......(define.d. |
| a1640 | 28 6d 61 6b 65 2d 77 69 72 65 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 65 20 28 6d 61 6b | (make-wire))......(define.e.(mak |
| a1660 | 65 2d 77 69 72 65 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 20 28 6d 61 6b 65 2d 77 69 | e-wire))......(define.s.(make-wi |
| a1680 | 72 65 29 29 0a 0a 20 20 20 57 65 20 61 74 74 61 63 68 20 61 20 66 75 6e 63 74 69 6f 6e 20 62 6f | re)).....We.attach.a.function.bo |
| a16a0 | 78 20 74 6f 20 61 20 73 65 74 20 6f 66 20 77 69 72 65 73 20 62 79 20 63 61 6c 6c 69 6e 67 20 61 | x.to.a.set.of.wires.by.calling.a |
| a16c0 | 20 70 72 6f 63 65 64 75 72 65 0a 74 68 61 74 20 63 6f 6e 73 74 72 75 63 74 73 20 74 68 61 74 20 | .procedure.that.constructs.that. |
| a16e0 | 6b 69 6e 64 20 6f 66 20 62 6f 78 2e 20 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 74 | kind.of.box...The.arguments.to.t |
| a1700 | 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 0a 70 72 6f 63 65 64 75 72 65 20 61 72 65 20 74 68 65 | he.constructor.procedure.are.the |
| a1720 | 20 77 69 72 65 73 20 74 6f 20 62 65 20 61 74 74 61 63 68 65 64 20 74 6f 20 74 68 65 20 62 6f 78 | .wires.to.be.attached.to.the.box |
| a1740 | 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 67 69 76 65 6e 0a 74 68 61 74 20 77 65 20 63 61 | ...For.example,.given.that.we.ca |
| a1760 | 6e 20 63 6f 6e 73 74 72 75 63 74 20 61 6e 64 2d 67 61 74 65 73 2c 20 6f 72 2d 67 61 74 65 73 2c | n.construct.and-gates,.or-gates, |
| a1780 | 20 61 6e 64 20 69 6e 76 65 72 74 65 72 73 2c 20 77 65 20 63 61 6e 20 77 69 72 65 0a 74 6f 67 65 | .and.inverters,.we.can.wire.toge |
| a17a0 | 74 68 65 72 20 74 68 65 20 68 61 6c 66 2d 61 64 64 65 72 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f | ther.the.half-adder.shown.in.*No |
| a17c0 | 74 65 20 46 69 67 75 72 65 20 33 2d 32 35 3a 3a 3a 0a 0a 20 20 20 20 20 28 6f 72 2d 67 61 74 65 | te.Figure.3-25:::.......(or-gate |
| a17e0 | 20 61 20 62 20 64 29 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 28 61 6e 64 2d 67 61 74 65 20 | .a.b.d)......ok.......(and-gate. |
| a1800 | 61 20 62 20 63 29 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 28 69 6e 76 65 72 74 65 72 20 63 | a.b.c)......ok.......(inverter.c |
| a1820 | 20 65 29 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 28 61 6e 64 2d 67 61 74 65 20 64 20 65 20 | .e)......ok.......(and-gate.d.e. |
| a1840 | 73 29 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 42 65 74 74 65 72 20 79 65 74 2c 20 77 65 20 63 61 | s)......ok.....Better.yet,.we.ca |
| a1860 | 6e 20 65 78 70 6c 69 63 69 74 6c 79 20 6e 61 6d 65 20 74 68 69 73 20 6f 70 65 72 61 74 69 6f 6e | n.explicitly.name.this.operation |
| a1880 | 20 62 79 20 64 65 66 69 6e 69 6e 67 20 61 0a 70 72 6f 63 65 64 75 72 65 20 60 68 61 6c 66 2d 61 | .by.defining.a.procedure.`half-a |
| a18a0 | 64 64 65 72 27 20 74 68 61 74 20 63 6f 6e 73 74 72 75 63 74 73 20 74 68 69 73 20 63 69 72 63 75 | dder'.that.constructs.this.circu |
| a18c0 | 69 74 2c 20 67 69 76 65 6e 20 74 68 65 20 66 6f 75 72 0a 65 78 74 65 72 6e 61 6c 20 77 69 72 65 | it,.given.the.four.external.wire |
| a18e0 | 73 20 74 6f 20 62 65 20 61 74 74 61 63 68 65 64 20 74 6f 20 74 68 65 20 68 61 6c 66 2d 61 64 64 | s.to.be.attached.to.the.half-add |
| a1900 | 65 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 68 61 6c 66 2d 61 64 64 65 72 20 61 20 | er:.......(define.(half-adder.a. |
| a1920 | 62 20 73 20 63 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 20 28 6d 61 6b 65 2d 77 69 72 | b.s.c)........(let.((d.(make-wir |
| a1940 | 65 29 29 20 28 65 20 28 6d 61 6b 65 2d 77 69 72 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6f | e)).(e.(make-wire)))..........(o |
| a1960 | 72 2d 67 61 74 65 20 61 20 62 20 64 29 0a 20 20 20 20 20 20 20 20 20 28 61 6e 64 2d 67 61 74 65 | r-gate.a.b.d)..........(and-gate |
| a1980 | 20 61 20 62 20 63 29 0a 20 20 20 20 20 20 20 20 20 28 69 6e 76 65 72 74 65 72 20 63 20 65 29 0a | .a.b.c)..........(inverter.c.e). |
| a19a0 | 20 20 20 20 20 20 20 20 20 28 61 6e 64 2d 67 61 74 65 20 64 20 65 20 73 29 0a 20 20 20 20 20 20 | .........(and-gate.d.e.s)....... |
| a19c0 | 20 20 20 27 6f 6b 29 29 0a 0a 20 20 20 54 68 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 6d 61 | ...'ok)).....The.advantage.of.ma |
| a19e0 | 6b 69 6e 67 20 74 68 69 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 73 20 74 68 61 74 20 77 65 20 | king.this.definition.is.that.we. |
| a1a00 | 63 61 6e 20 75 73 65 0a 60 68 61 6c 66 2d 61 64 64 65 72 27 20 69 74 73 65 6c 66 20 61 73 20 61 | can.use.`half-adder'.itself.as.a |
| a1a20 | 20 62 75 69 6c 64 69 6e 67 20 62 6c 6f 63 6b 20 69 6e 20 63 72 65 61 74 69 6e 67 20 6d 6f 72 65 | .building.block.in.creating.more |
| a1a40 | 20 63 6f 6d 70 6c 65 78 0a 63 69 72 63 75 69 74 73 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 | .complex.circuits...*Note.Figure |
| a1a60 | 20 33 2d 32 36 3a 3a 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 73 68 6f 77 73 20 61 20 22 66 | .3-26::,.for.example,.shows.a."f |
| a1a80 | 75 6c 6c 2d 61 64 64 65 72 22 0a 63 6f 6d 70 6f 73 65 64 20 6f 66 20 74 77 6f 20 68 61 6c 66 2d | ull-adder".composed.of.two.half- |
| a1aa0 | 61 64 64 65 72 73 20 61 6e 64 20 61 6e 20 6f 72 2d 67 61 74 65 2e 28 31 29 20 57 65 20 63 61 6e | adders.and.an.or-gate.(1).We.can |
| a1ac0 | 20 63 6f 6e 73 74 72 75 63 74 20 61 0a 66 75 6c 6c 2d 61 64 64 65 72 20 61 73 20 66 6f 6c 6c 6f | .construct.a.full-adder.as.follo |
| a1ae0 | 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 75 6c 6c 2d 61 64 64 65 72 20 61 20 | ws:.......(define.(full-adder.a. |
| a1b00 | 62 20 63 2d 69 6e 20 73 75 6d 20 63 2d 6f 75 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 | b.c-in.sum.c-out)........(let.(( |
| a1b20 | 73 20 28 6d 61 6b 65 2d 77 69 72 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 31 20 | s.(make-wire))..............(c1. |
| a1b40 | 28 6d 61 6b 65 2d 77 69 72 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 32 20 28 6d | (make-wire))..............(c2.(m |
| a1b60 | 61 6b 65 2d 77 69 72 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 68 61 6c 66 2d 61 64 64 65 72 | ake-wire)))..........(half-adder |
| a1b80 | 20 62 20 63 2d 69 6e 20 73 20 63 31 29 0a 20 20 20 20 20 20 20 20 20 28 68 61 6c 66 2d 61 64 64 | .b.c-in.s.c1)..........(half-add |
| a1ba0 | 65 72 20 61 20 73 20 73 75 6d 20 63 32 29 0a 20 20 20 20 20 20 20 20 20 28 6f 72 2d 67 61 74 65 | er.a.s.sum.c2)..........(or-gate |
| a1bc0 | 20 63 31 20 63 32 20 63 2d 6f 75 74 29 0a 20 20 20 20 20 20 20 20 20 27 6f 6b 29 29 0a 0a 20 20 | .c1.c2.c-out)..........'ok)).... |
| a1be0 | 20 48 61 76 69 6e 67 20 64 65 66 69 6e 65 64 20 60 66 75 6c 6c 2d 61 64 64 65 72 27 20 61 73 20 | .Having.defined.`full-adder'.as. |
| a1c00 | 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 65 20 63 61 6e 20 6e 6f 77 20 75 73 65 20 69 74 20 61 | a.procedure,.we.can.now.use.it.a |
| a1c20 | 73 20 61 0a 62 75 69 6c 64 69 6e 67 20 62 6c 6f 63 6b 20 66 6f 72 20 63 72 65 61 74 69 6e 67 20 | s.a.building.block.for.creating. |
| a1c40 | 73 74 69 6c 6c 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 20 63 69 72 63 75 69 74 73 2e 20 20 28 46 | still.more.complex.circuits...(F |
| a1c60 | 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 | or.example,.see.*Note.Exercise.3 |
| a1c80 | 2d 33 30 3a 3a 2e 29 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 32 36 3a 2a 20 41 20 66 | -30::.).......*Figure.3.26:*.A.f |
| a1ca0 | 75 6c 6c 2d 61 64 64 65 72 20 63 69 72 63 75 69 74 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ull-adder.circuit............... |
| a1cc0 | 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..+----------------------------- |
| a1ce0 | 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | -----+...............|.......... |
| a1d00 | 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 | ....+-------+...........|....... |
| a1d20 | 20 20 20 20 41 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 68 61 6c 66 20 20 2b | ....A.-----------------+.half..+ |
| a1d40 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 53 55 4d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | --------------.SUM.............. |
| a1d60 | 20 7c 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 20 61 64 64 65 72 20 7c 20 20 20 5f 5f 5f 5f | .|..+-------+...|.adder.|...____ |
| a1d80 | 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 42 20 2d 2d 2d 2d 2d 2b 20 68 61 6c 66 20 20 2b | ....|...........B.-----+.half..+ |
| a1da0 | 2d 2d 2d 2b 20 20 20 20 20 20 20 2b 2d 2d 2d 5c 20 20 20 5c 20 20 20 7c 0a 20 20 20 20 20 20 20 | ---+.......+---\...\...|........ |
| a1dc0 | 20 20 20 20 20 20 20 7c 20 20 7c 20 61 64 64 65 72 20 7c 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 | .......|..|.adder.|...+-------+. |
| a1de0 | 20 20 20 3e 6f 72 20 3e 2d 2d 2d 2d 2d 20 43 6f 75 74 0a 20 20 20 20 20 20 20 20 20 20 43 20 2d | ...>or.>-----.Cout...........C.- |
| a1e00 | 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2f 5f 5f 5f | ----+.......+---------------/___ |
| a1e20 | 2f 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b | /...|...............|..+-------+ |
| a1e40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 | .......................|........ |
| a1e60 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .......+------------------------ |
| a1e80 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 49 6e 20 65 73 73 65 6e 63 65 2c 20 6f 75 72 20 | ----------+.....In.essence,.our. |
| a1ea0 | 73 69 6d 75 6c 61 74 6f 72 20 70 72 6f 76 69 64 65 73 20 75 73 20 77 69 74 68 20 74 68 65 20 74 | simulator.provides.us.with.the.t |
| a1ec0 | 6f 6f 6c 73 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 61 0a 6c 61 6e 67 75 61 67 65 20 6f 66 20 | ools.to.construct.a.language.of. |
| a1ee0 | 63 69 72 63 75 69 74 73 2e 20 20 49 66 20 77 65 20 61 64 6f 70 74 20 74 68 65 20 67 65 6e 65 72 | circuits...If.we.adopt.the.gener |
| a1f00 | 61 6c 20 70 65 72 73 70 65 63 74 69 76 65 20 6f 6e 20 6c 61 6e 67 75 61 67 65 73 0a 77 69 74 68 | al.perspective.on.languages.with |
| a1f20 | 20 77 68 69 63 68 20 77 65 20 61 70 70 72 6f 61 63 68 65 64 20 74 68 65 20 73 74 75 64 79 20 6f | .which.we.approached.the.study.o |
| a1f40 | 66 20 4c 69 73 70 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 3a 3a 2c 20 77 | f.Lisp.in.section.*Note.1-1::,.w |
| a1f60 | 65 0a 63 61 6e 20 73 61 79 20 74 68 61 74 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 66 75 6e | e.can.say.that.the.primitive.fun |
| a1f80 | 63 74 69 6f 6e 20 62 6f 78 65 73 20 66 6f 72 6d 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 65 | ction.boxes.form.the.primitive.e |
| a1fa0 | 6c 65 6d 65 6e 74 73 0a 6f 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 2c 20 74 68 61 74 20 77 69 | lements.of.the.language,.that.wi |
| a1fc0 | 72 69 6e 67 20 62 6f 78 65 73 20 74 6f 67 65 74 68 65 72 20 70 72 6f 76 69 64 65 73 20 61 20 6d | ring.boxes.together.provides.a.m |
| a1fe0 | 65 61 6e 73 20 6f 66 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 2c 20 61 6e 64 20 74 68 61 74 20 73 70 | eans.of.combination,.and.that.sp |
| a2000 | 65 63 69 66 79 69 6e 67 20 77 69 72 69 6e 67 20 70 61 74 74 65 72 6e 73 20 61 73 20 70 72 6f 63 | ecifying.wiring.patterns.as.proc |
| a2020 | 65 64 75 72 65 73 20 73 65 72 76 65 73 0a 61 73 20 61 20 6d 65 61 6e 73 20 6f 66 20 61 62 73 74 | edures.serves.as.a.means.of.abst |
| a2040 | 72 61 63 74 69 6f 6e 2e 0a 0a 50 72 69 6d 69 74 69 76 65 20 66 75 6e 63 74 69 6f 6e 20 62 6f 78 | raction...Primitive.function.box |
| a2060 | 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 | es...........................The |
| a2080 | 20 70 72 69 6d 69 74 69 76 65 20 66 75 6e 63 74 69 6f 6e 20 62 6f 78 65 73 20 69 6d 70 6c 65 6d | .primitive.function.boxes.implem |
| a20a0 | 65 6e 74 20 74 68 65 20 22 66 6f 72 63 65 73 22 20 62 79 20 77 68 69 63 68 20 61 20 63 68 61 6e | ent.the."forces".by.which.a.chan |
| a20c0 | 67 65 0a 69 6e 20 74 68 65 20 73 69 67 6e 61 6c 20 6f 6e 20 6f 6e 65 20 77 69 72 65 20 69 6e 66 | ge.in.the.signal.on.one.wire.inf |
| a20e0 | 6c 75 65 6e 63 65 73 20 74 68 65 20 73 69 67 6e 61 6c 73 20 6f 6e 20 6f 74 68 65 72 20 77 69 72 | luences.the.signals.on.other.wir |
| a2100 | 65 73 2e 20 20 54 6f 0a 62 75 69 6c 64 20 66 75 6e 63 74 69 6f 6e 20 62 6f 78 65 73 2c 20 77 65 | es...To.build.function.boxes,.we |
| a2120 | 20 75 73 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e | .use.the.following.operations.on |
| a2140 | 20 77 69 72 65 73 3a 0a 0a 20 20 20 2a 20 20 20 20 20 20 28 67 65 74 2d 73 69 67 6e 61 6c 20 3c | .wires:.....*......(get-signal.< |
| a2160 | 57 49 52 45 3e 29 0a 0a 20 20 20 20 20 72 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65 6e 74 | WIRE>).......returns.the.current |
| a2180 | 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 73 69 67 6e 61 6c 20 6f 6e 20 74 68 65 20 77 69 72 65 | .value.of.the.signal.on.the.wire |
| a21a0 | 2e 0a 0a 20 20 20 2a 20 20 20 20 20 20 28 73 65 74 2d 73 69 67 6e 61 6c 21 20 3c 57 49 52 45 3e | ......*......(set-signal!.<WIRE> |
| a21c0 | 20 3c 4e 45 57 20 56 41 4c 55 45 3e 29 0a 0a 20 20 20 20 20 63 68 61 6e 67 65 73 20 74 68 65 20 | .<NEW.VALUE>).......changes.the. |
| a21e0 | 76 61 6c 75 65 20 6f 66 20 74 68 65 20 73 69 67 6e 61 6c 20 6f 6e 20 74 68 65 20 77 69 72 65 20 | value.of.the.signal.on.the.wire. |
| a2200 | 74 6f 20 74 68 65 20 6e 65 77 20 76 61 6c 75 65 2e 0a 0a 20 20 20 2a 20 20 20 20 20 20 28 61 64 | to.the.new.value......*......(ad |
| a2220 | 64 2d 61 63 74 69 6f 6e 21 20 3c 57 49 52 45 3e 20 3c 50 52 4f 43 45 44 55 52 45 20 4f 46 20 4e | d-action!.<WIRE>.<PROCEDURE.OF.N |
| a2240 | 4f 20 41 52 47 55 4d 45 4e 54 53 3e 29 0a 0a 20 20 20 20 20 61 73 73 65 72 74 73 20 74 68 61 74 | O.ARGUMENTS>).......asserts.that |
| a2260 | 20 74 68 65 20 64 65 73 69 67 6e 61 74 65 64 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 | .the.designated.procedure.should |
| a2280 | 20 62 65 20 72 75 6e 20 77 68 65 6e 65 76 65 72 20 74 68 65 0a 20 20 20 20 20 73 69 67 6e 61 6c | .be.run.whenever.the......signal |
| a22a0 | 20 6f 6e 20 74 68 65 20 77 69 72 65 20 63 68 61 6e 67 65 73 20 76 61 6c 75 65 2e 20 20 53 75 63 | .on.the.wire.changes.value...Suc |
| a22c0 | 68 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 74 68 65 0a 20 20 20 20 20 76 65 68 69 63 6c | h.procedures.are.the......vehicl |
| a22e0 | 65 73 20 62 79 20 77 68 69 63 68 20 63 68 61 6e 67 65 73 20 69 6e 20 74 68 65 20 73 69 67 6e 61 | es.by.which.changes.in.the.signa |
| a2300 | 6c 20 76 61 6c 75 65 20 6f 6e 20 74 68 65 20 77 69 72 65 20 61 72 65 0a 20 20 20 20 20 63 6f 6d | l.value.on.the.wire.are......com |
| a2320 | 6d 75 6e 69 63 61 74 65 64 20 74 6f 20 6f 74 68 65 72 20 77 69 72 65 73 2e 0a 0a 0a 20 20 20 49 | municated.to.other.wires.......I |
| a2340 | 6e 20 61 64 64 69 74 69 6f 6e 2c 20 77 65 20 77 69 6c 6c 20 6d 61 6b 65 20 75 73 65 20 6f 66 20 | n.addition,.we.will.make.use.of. |
| a2360 | 61 20 70 72 6f 63 65 64 75 72 65 20 60 61 66 74 65 72 2d 64 65 6c 61 79 27 20 74 68 61 74 0a 74 | a.procedure.`after-delay'.that.t |
| a2380 | 61 6b 65 73 20 61 20 74 69 6d 65 20 64 65 6c 61 79 20 61 6e 64 20 61 20 70 72 6f 63 65 64 75 72 | akes.a.time.delay.and.a.procedur |
| a23a0 | 65 20 74 6f 20 62 65 20 72 75 6e 20 61 6e 64 20 65 78 65 63 75 74 65 73 20 74 68 65 20 67 69 76 | e.to.be.run.and.executes.the.giv |
| a23c0 | 65 6e 0a 70 72 6f 63 65 64 75 72 65 20 61 66 74 65 72 20 74 68 65 20 67 69 76 65 6e 20 64 65 6c | en.procedure.after.the.given.del |
| a23e0 | 61 79 2e 0a 0a 20 20 20 55 73 69 6e 67 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 2c 20 | ay......Using.these.procedures,. |
| a2400 | 77 65 20 63 61 6e 20 64 65 66 69 6e 65 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 64 69 67 69 | we.can.define.the.primitive.digi |
| a2420 | 74 61 6c 20 6c 6f 67 69 63 0a 66 75 6e 63 74 69 6f 6e 73 2e 20 20 54 6f 20 63 6f 6e 6e 65 63 74 | tal.logic.functions...To.connect |
| a2440 | 20 61 6e 20 69 6e 70 75 74 20 74 6f 20 61 6e 20 6f 75 74 70 75 74 20 74 68 72 6f 75 67 68 20 61 | .an.input.to.an.output.through.a |
| a2460 | 6e 20 69 6e 76 65 72 74 65 72 2c 20 77 65 0a 75 73 65 20 60 61 64 64 2d 61 63 74 69 6f 6e 21 27 | n.inverter,.we.use.`add-action!' |
| a2480 | 20 74 6f 20 61 73 73 6f 63 69 61 74 65 20 77 69 74 68 20 74 68 65 20 69 6e 70 75 74 20 77 69 72 | .to.associate.with.the.input.wir |
| a24a0 | 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 77 69 6c 6c 20 62 65 20 72 75 6e 20 77 | e.a.procedure.that.will.be.run.w |
| a24c0 | 68 65 6e 65 76 65 72 20 74 68 65 20 73 69 67 6e 61 6c 20 6f 6e 20 74 68 65 20 69 6e 70 75 74 20 | henever.the.signal.on.the.input. |
| a24e0 | 77 69 72 65 20 63 68 61 6e 67 65 73 20 76 61 6c 75 65 2e 20 20 54 68 65 0a 70 72 6f 63 65 64 75 | wire.changes.value...The.procedu |
| a2500 | 72 65 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 60 6c 6f 67 69 63 61 6c 2d 6e 6f 74 27 20 6f 66 | re.computes.the.`logical-not'.of |
| a2520 | 20 74 68 65 20 69 6e 70 75 74 20 73 69 67 6e 61 6c 2c 20 61 6e 64 20 74 68 65 6e 2c 0a 61 66 74 | .the.input.signal,.and.then,.aft |
| a2540 | 65 72 20 6f 6e 65 20 60 69 6e 76 65 72 74 65 72 2d 64 65 6c 61 79 27 2c 20 73 65 74 73 20 74 68 | er.one.`inverter-delay',.sets.th |
| a2560 | 65 20 6f 75 74 70 75 74 20 73 69 67 6e 61 6c 20 74 6f 20 62 65 20 74 68 69 73 20 6e 65 77 20 76 | e.output.signal.to.be.this.new.v |
| a2580 | 61 6c 75 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 76 65 72 74 65 72 20 69 6e | alue:.......(define.(inverter.in |
| a25a0 | 70 75 74 20 6f 75 74 70 75 74 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 76 65 | put.output)........(define.(inve |
| a25c0 | 72 74 2d 69 6e 70 75 74 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 2d 76 61 | rt-input)..........(let.((new-va |
| a25e0 | 6c 75 65 20 28 6c 6f 67 69 63 61 6c 2d 6e 6f 74 20 28 67 65 74 2d 73 69 67 6e 61 6c 20 69 6e 70 | lue.(logical-not.(get-signal.inp |
| a2600 | 75 74 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 66 74 65 72 2d 64 65 6c 61 79 20 69 | ut))))............(after-delay.i |
| a2620 | 6e 76 65 72 74 65 72 2d 64 65 6c 61 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | nverter-delay................... |
| a2640 | 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......(lambda.()................ |
| a2660 | 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 73 69 67 6e 61 6c 21 20 6f 75 74 70 75 74 20 6e | ...........(set-signal!.output.n |
| a2680 | 65 77 2d 76 61 6c 75 65 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 61 64 64 2d 61 63 74 69 6f 6e | ew-value)))))........(add-action |
| a26a0 | 21 20 69 6e 70 75 74 20 69 6e 76 65 72 74 2d 69 6e 70 75 74 29 0a 20 20 20 20 20 20 20 27 6f 6b | !.input.invert-input)........'ok |
| a26c0 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 67 69 63 61 6c 2d 6e 6f 74 20 73 29 0a | ).......(define.(logical-not.s). |
| a26e0 | 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3d 20 73 20 30 29 20 31 29 0a 20 20 20 20 20 20 20 | .......(cond.((=.s.0).1)........ |
| a2700 | 20 20 20 20 20 20 28 28 3d 20 73 20 31 29 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ......((=.s.1).0)..............( |
| a2720 | 65 6c 73 65 20 28 65 72 72 6f 72 20 22 49 6e 76 61 6c 69 64 20 73 69 67 6e 61 6c 22 20 73 29 29 | else.(error."Invalid.signal".s)) |
| a2740 | 29 29 0a 0a 20 20 20 41 6e 20 61 6e 64 2d 67 61 74 65 20 69 73 20 61 20 6c 69 74 74 6c 65 20 6d | )).....An.and-gate.is.a.little.m |
| a2760 | 6f 72 65 20 63 6f 6d 70 6c 65 78 2e 20 20 54 68 65 20 61 63 74 69 6f 6e 20 70 72 6f 63 65 64 75 | ore.complex...The.action.procedu |
| a2780 | 72 65 20 6d 75 73 74 20 62 65 0a 72 75 6e 20 69 66 20 65 69 74 68 65 72 20 6f 66 20 74 68 65 20 | re.must.be.run.if.either.of.the. |
| a27a0 | 69 6e 70 75 74 73 20 74 6f 20 74 68 65 20 67 61 74 65 20 63 68 61 6e 67 65 73 2e 20 20 49 74 20 | inputs.to.the.gate.changes...It. |
| a27c0 | 63 6f 6d 70 75 74 65 73 20 74 68 65 0a 60 6c 6f 67 69 63 61 6c 2d 61 6e 64 27 20 28 75 73 69 6e | computes.the.`logical-and'.(usin |
| a27e0 | 67 20 61 20 70 72 6f 63 65 64 75 72 65 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 60 6c 6f 67 69 | g.a.procedure.analogous.to.`logi |
| a2800 | 63 61 6c 2d 6e 6f 74 27 29 20 6f 66 20 74 68 65 0a 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 73 | cal-not').of.the.values.of.the.s |
| a2820 | 69 67 6e 61 6c 73 20 6f 6e 20 74 68 65 20 69 6e 70 75 74 20 77 69 72 65 73 20 61 6e 64 20 73 65 | ignals.on.the.input.wires.and.se |
| a2840 | 74 73 20 75 70 20 61 20 63 68 61 6e 67 65 20 74 6f 20 74 68 65 0a 6e 65 77 20 76 61 6c 75 65 20 | ts.up.a.change.to.the.new.value. |
| a2860 | 74 6f 20 6f 63 63 75 72 20 6f 6e 20 74 68 65 20 6f 75 74 70 75 74 20 77 69 72 65 20 61 66 74 65 | to.occur.on.the.output.wire.afte |
| a2880 | 72 20 6f 6e 65 20 60 61 6e 64 2d 67 61 74 65 2d 64 65 6c 61 79 27 2e 0a 0a 20 20 20 20 20 28 64 | r.one.`and-gate-delay'........(d |
| a28a0 | 65 66 69 6e 65 20 28 61 6e 64 2d 67 61 74 65 20 61 31 20 61 32 20 6f 75 74 70 75 74 29 0a 20 20 | efine.(and-gate.a1.a2.output)... |
| a28c0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 64 2d 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 | .....(define.(and-action-procedu |
| a28e0 | 72 65 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 77 2d 76 61 6c 75 65 0a 20 20 | re)..........(let.((new-value... |
| a2900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 6f 67 69 63 61 6c 2d 61 6e 64 20 28 67 65 74 2d | ..............(logical-and.(get- |
| a2920 | 73 69 67 6e 61 6c 20 61 31 29 20 28 67 65 74 2d 73 69 67 6e 61 6c 20 61 32 29 29 29 29 0a 20 20 | signal.a1).(get-signal.a2))))... |
| a2940 | 20 20 20 20 20 20 20 20 20 28 61 66 74 65 72 2d 64 65 6c 61 79 20 61 6e 64 2d 67 61 74 65 2d 64 | .........(after-delay.and-gate-d |
| a2960 | 65 6c 61 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 | elay.........................(la |
| a2980 | 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | mbda.()......................... |
| a29a0 | 20 20 28 73 65 74 2d 73 69 67 6e 61 6c 21 20 6f 75 74 70 75 74 20 6e 65 77 2d 76 61 6c 75 65 29 | ..(set-signal!.output.new-value) |
| a29c0 | 29 29 29 29 0a 20 20 20 20 20 20 20 28 61 64 64 2d 61 63 74 69 6f 6e 21 20 61 31 20 61 6e 64 2d | ))))........(add-action!.a1.and- |
| a29e0 | 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 28 61 64 64 2d 61 63 | action-procedure)........(add-ac |
| a2a00 | 74 69 6f 6e 21 20 61 32 20 61 6e 64 2d 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 29 0a 20 | tion!.a2.and-action-procedure).. |
| a2a20 | 20 20 20 20 20 20 27 6f 6b 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 32 38 3a | ......'ok).......*Exercise.3.28: |
| a2a40 | 2a 20 44 65 66 69 6e 65 20 61 6e 20 6f 72 2d 67 61 74 65 20 61 73 20 61 20 70 72 69 6d 69 74 69 | *.Define.an.or-gate.as.a.primiti |
| a2a60 | 76 65 20 66 75 6e 63 74 69 6f 6e 20 62 6f 78 2e 0a 20 20 20 20 20 59 6f 75 72 20 60 6f 72 2d 67 | ve.function.box.......Your.`or-g |
| a2a80 | 61 74 65 27 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 73 68 6f 75 6c 64 20 62 65 20 73 69 6d 69 6c | ate'.constructor.should.be.simil |
| a2aa0 | 61 72 20 74 6f 20 60 61 6e 64 2d 67 61 74 65 27 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | ar.to.`and-gate'........*Exercis |
| a2ac0 | 65 20 33 2e 32 39 3a 2a 20 41 6e 6f 74 68 65 72 20 77 61 79 20 74 6f 20 63 6f 6e 73 74 72 75 63 | e.3.29:*.Another.way.to.construc |
| a2ae0 | 74 20 61 6e 20 6f 72 2d 67 61 74 65 20 69 73 20 61 73 20 61 0a 20 20 20 20 20 63 6f 6d 70 6f 75 | t.an.or-gate.is.as.a......compou |
| a2b00 | 6e 64 20 64 69 67 69 74 61 6c 20 6c 6f 67 69 63 20 64 65 76 69 63 65 2c 20 62 75 69 6c 74 20 66 | nd.digital.logic.device,.built.f |
| a2b20 | 72 6f 6d 20 61 6e 64 2d 67 61 74 65 73 20 61 6e 64 20 69 6e 76 65 72 74 65 72 73 2e 0a 20 20 20 | rom.and-gates.and.inverters..... |
| a2b40 | 20 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 6f 72 2d 67 61 74 65 27 20 74 | ..Define.a.procedure.`or-gate'.t |
| a2b60 | 68 61 74 20 61 63 63 6f 6d 70 6c 69 73 68 65 73 20 74 68 69 73 2e 20 20 57 68 61 74 20 69 73 20 | hat.accomplishes.this...What.is. |
| a2b80 | 74 68 65 0a 20 20 20 20 20 64 65 6c 61 79 20 74 69 6d 65 20 6f 66 20 74 68 65 20 6f 72 2d 67 61 | the......delay.time.of.the.or-ga |
| a2ba0 | 74 65 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 60 61 6e 64 2d 67 61 74 65 2d 64 65 6c 61 79 27 20 | te.in.terms.of.`and-gate-delay'. |
| a2bc0 | 61 6e 64 0a 20 20 20 20 20 60 69 6e 76 65 72 74 65 72 2d 64 65 6c 61 79 27 3f 0a 0a 20 20 20 20 | and......`inverter-delay'?...... |
| a2be0 | 20 2a 45 78 65 72 63 69 73 65 20 33 2e 33 30 3a 2a 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 | .*Exercise.3.30:*.*Note.Figure.3 |
| a2c00 | 2d 32 37 3a 3a 20 73 68 6f 77 73 20 61 20 22 72 69 70 70 6c 65 2d 63 61 72 72 79 20 61 64 64 65 | -27::.shows.a."ripple-carry.adde |
| a2c20 | 72 22 0a 20 20 20 20 20 66 6f 72 6d 65 64 20 62 79 20 73 74 72 69 6e 67 69 6e 67 20 74 6f 67 65 | r"......formed.by.stringing.toge |
| a2c40 | 74 68 65 72 20 6e 20 66 75 6c 6c 2d 61 64 64 65 72 73 2e 20 20 54 68 69 73 20 69 73 20 74 68 65 | ther.n.full-adders...This.is.the |
| a2c60 | 20 73 69 6d 70 6c 65 73 74 0a 20 20 20 20 20 66 6f 72 6d 20 6f 66 20 70 61 72 61 6c 6c 65 6c 20 | .simplest......form.of.parallel. |
| a2c80 | 61 64 64 65 72 20 66 6f 72 20 61 64 64 69 6e 67 20 74 77 6f 20 6e 2d 62 69 74 20 62 69 6e 61 72 | adder.for.adding.two.n-bit.binar |
| a2ca0 | 79 20 6e 75 6d 62 65 72 73 2e 20 20 54 68 65 0a 20 20 20 20 20 69 6e 70 75 74 73 20 41 5f 31 2c | y.numbers...The......inputs.A_1, |
| a2cc0 | 20 41 5f 32 2c 20 41 5f 33 2c 20 2e 2e 2e 2c 20 41 5f 6e 20 61 6e 64 20 42 5f 31 2c 20 42 5f 32 | .A_2,.A_3,....,.A_n.and.B_1,.B_2 |
| a2ce0 | 2c 20 42 5f 33 2c 20 2e 2e 2e 2c 20 42 5f 6e 20 61 72 65 20 74 68 65 0a 20 20 20 20 20 74 77 6f | ,.B_3,....,.B_n.are.the......two |
| a2d00 | 20 62 69 6e 61 72 79 20 6e 75 6d 62 65 72 73 20 74 6f 20 62 65 20 61 64 64 65 64 20 28 65 61 63 | .binary.numbers.to.be.added.(eac |
| a2d20 | 68 20 41 5f 6b 20 61 6e 64 20 42 5f 6b 20 69 73 20 61 20 30 20 6f 72 20 61 20 31 29 2e 0a 20 20 | h.A_k.and.B_k.is.a.0.or.a.1).... |
| a2d40 | 20 20 20 54 68 65 20 63 69 72 63 75 69 74 20 67 65 6e 65 72 61 74 65 73 20 53 5f 31 2c 20 53 5f | ...The.circuit.generates.S_1,.S_ |
| a2d60 | 32 2c 20 53 5f 33 2c 20 2e 2e 2e 2c 20 53 5f 6e 2c 20 74 68 65 20 6e 20 62 69 74 73 20 6f 66 20 | 2,.S_3,....,.S_n,.the.n.bits.of. |
| a2d80 | 74 68 65 0a 20 20 20 20 20 73 75 6d 2c 20 61 6e 64 20 43 2c 20 74 68 65 20 63 61 72 72 79 20 66 | the......sum,.and.C,.the.carry.f |
| a2da0 | 72 6f 6d 20 74 68 65 20 61 64 64 69 74 69 6f 6e 2e 20 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 | rom.the.addition...Write.a.proce |
| a2dc0 | 64 75 72 65 0a 20 20 20 20 20 60 72 69 70 70 6c 65 2d 63 61 72 72 79 2d 61 64 64 65 72 27 20 74 | dure......`ripple-carry-adder'.t |
| a2de0 | 68 61 74 20 67 65 6e 65 72 61 74 65 73 20 74 68 69 73 20 63 69 72 63 75 69 74 2e 20 20 54 68 65 | hat.generates.this.circuit...The |
| a2e00 | 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 73 68 6f 75 6c 64 20 74 61 6b 65 20 61 73 20 61 | .procedure......should.take.as.a |
| a2e20 | 72 67 75 6d 65 6e 74 73 20 74 68 72 65 65 20 6c 69 73 74 73 20 6f 66 20 6e 20 77 69 72 65 73 20 | rguments.three.lists.of.n.wires. |
| a2e40 | 65 61 63 68 2d 2d 74 68 65 20 41 5f 6b 2c 20 74 68 65 0a 20 20 20 20 20 42 5f 6b 2c 20 61 6e 64 | each--the.A_k,.the......B_k,.and |
| a2e60 | 20 74 68 65 20 53 5f 6b 2d 2d 61 6e 64 20 61 6c 73 6f 20 61 6e 6f 74 68 65 72 20 77 69 72 65 20 | .the.S_k--and.also.another.wire. |
| a2e80 | 43 2e 20 20 54 68 65 20 6d 61 6a 6f 72 20 64 72 61 77 62 61 63 6b 20 6f 66 0a 20 20 20 20 20 74 | C...The.major.drawback.of......t |
| a2ea0 | 68 65 20 72 69 70 70 6c 65 2d 63 61 72 72 79 20 61 64 64 65 72 20 69 73 20 74 68 65 20 6e 65 65 | he.ripple-carry.adder.is.the.nee |
| a2ec0 | 64 20 74 6f 20 77 61 69 74 20 66 6f 72 20 74 68 65 20 63 61 72 72 79 20 73 69 67 6e 61 6c 73 0a | d.to.wait.for.the.carry.signals. |
| a2ee0 | 20 20 20 20 20 74 6f 20 70 72 6f 70 61 67 61 74 65 2e 20 20 57 68 61 74 20 69 73 20 74 68 65 20 | .....to.propagate...What.is.the. |
| a2f00 | 64 65 6c 61 79 20 6e 65 65 64 65 64 20 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 63 6f 6d 70 6c | delay.needed.to.obtain.the.compl |
| a2f20 | 65 74 65 0a 20 20 20 20 20 6f 75 74 70 75 74 20 66 72 6f 6d 20 61 6e 20 6e 2d 62 69 74 20 72 69 | ete......output.from.an.n-bit.ri |
| a2f40 | 70 70 6c 65 2d 63 61 72 72 79 20 61 64 64 65 72 2c 20 65 78 70 72 65 73 73 65 64 20 69 6e 20 74 | pple-carry.adder,.expressed.in.t |
| a2f60 | 65 72 6d 73 20 6f 66 20 74 68 65 0a 20 20 20 20 20 64 65 6c 61 79 73 20 66 6f 72 20 61 6e 64 2d | erms.of.the......delays.for.and- |
| a2f80 | 67 61 74 65 73 2c 20 6f 72 2d 67 61 74 65 73 2c 20 61 6e 64 20 69 6e 76 65 72 74 65 72 73 3f 0a | gates,.or-gates,.and.inverters?. |
| a2fa0 | 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 32 37 3a 2a 20 41 20 72 69 70 70 6c 65 2d 63 61 | ......*Figure.3.27:*.A.ripple-ca |
| a2fc0 | 72 72 79 20 61 64 64 65 72 20 66 6f 72 20 6e 2d 62 69 74 20 6e 75 6d 62 65 72 73 2e 0a 0a 20 20 | rry.adder.for.n-bit.numbers..... |
| a2fe0 | 20 20 20 20 20 20 20 20 20 20 20 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........:.................... |
| a3000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3a 20 20 20 3a 0a | ..........................:...:. |
| a3020 | 20 20 20 20 20 20 20 20 20 20 20 20 20 3a 20 41 5f 31 20 42 5f 31 20 20 20 43 5f 31 20 20 20 41 | .............:.A_1.B_1...C_1...A |
| a3040 | 5f 32 20 42 5f 32 20 20 20 43 5f 32 20 20 20 41 5f 33 20 42 5f 33 20 20 20 43 5f 33 3a 20 20 20 | _2.B_2...C_2...A_3.B_3...C_3:... |
| a3060 | 3a 20 41 5f 6e 20 42 5f 6e 20 43 5f 6e 3d 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 3a 20 20 | :.A_n.B_n.C_n=0..............:.. |
| a3080 | 7c 20 20 20 7c 20 20 20 2b 2d 2d 2d 2b 20 20 20 7c 20 20 20 7c 20 20 20 2b 2d 2d 2d 2b 20 20 20 | |...|...+---+...|...|...+---+... |
| a30a0 | 7c 20 20 20 7c 20 20 20 2b 2d 2d 2d 2d 2d 20 20 3a 20 20 7c 20 20 20 7c 20 20 20 2b 2d 0a 20 20 | |...|...+-----..:..|...|...+-... |
| a30c0 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 | ...........|..|...|...|...|...|. |
| a30e0 | 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 3a 20 20 20 3a 20 | ..|...|...|...|...|...|...:...:. |
| a3100 | 20 7c 20 20 20 7c 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 3a 20 2b 2b 2d 2d 2d 2b | .|...|...|..............:.++---+ |
| a3120 | 2d 2d 2d 2b 2b 20 20 7c 20 20 2b 2b 2d 2d 2d 2b 2d 2d 2d 2b 2b 20 20 7c 20 20 2b 2b 2d 2d 2d 2b | ---++..|..++---+---++..|..++---+ |
| a3140 | 2d 2d 2d 2b 2b 20 20 3a 20 20 20 3a 20 2b 2b 2d 2d 2d 2b 2d 2d 2d 2b 2b 0a 20 20 20 20 20 20 20 | ---++..:...:.++---+---++........ |
| a3160 | 20 20 20 20 20 20 3a 20 7c 20 20 20 46 41 20 20 20 20 7c 20 20 7c 20 20 7c 20 20 20 46 41 20 20 | ......:.|...FA....|..|..|...FA.. |
| a3180 | 20 20 7c 20 20 7c 20 20 7c 20 20 20 46 41 20 20 20 20 7c 20 20 3a 20 20 20 3a 20 7c 20 20 20 46 | ..|..|..|...FA....|..:...:.|...F |
| a31a0 | 41 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 3a 20 2b 2d 2d 2b 2d 2d 2d 2b 2d 2d | A....|..............:.+--+---+-- |
| a31c0 | 2b 20 20 7c 20 20 2b 2d 2d 2b 2d 2d 2d 2b 2d 2d 2b 20 20 7c 20 20 2b 2d 2d 2b 2d 2d 2d 2b 2d 2d | +..|..+--+---+--+..|..+--+---+-- |
| a31e0 | 2b 20 20 3a 20 20 20 3a 20 2b 2d 2d 2b 2d 2d 2d 2b 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 | +..:...:.+--+---+--+............ |
| a3200 | 20 20 3a 20 20 20 20 7c 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 7c 20 20 20 20 | ..:....|...|.....|.....|...|.... |
| a3220 | 20 7c 20 20 20 20 20 7c 20 20 20 7c 20 20 20 20 20 3a 20 20 20 3a 20 20 20 20 7c 20 20 20 7c 0a | .|.....|...|.....:...:....|...|. |
| a3240 | 20 20 20 20 20 20 20 20 20 20 43 20 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 20 20 20 20 20 2b 2d 2d 2d | ..........C.------+...|.....+--- |
| a3260 | 2d 2d 2b 20 20 20 7c 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 7c 20 20 20 20 20 3a 20 20 2d | --+...|.....+-----+...|.....:..- |
| a3280 | 2d 2d 2d 2d 2d 2b 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 3a 20 20 20 20 20 20 20 | -----+...|..............:....... |
| a32a0 | 20 7c 20 20 20 20 20 20 20 43 5f 31 20 20 20 20 20 7c 20 20 20 20 20 20 20 43 5f 32 20 20 20 20 | .|.......C_1.....|.......C_2.... |
| a32c0 | 20 7c 20 20 20 20 20 3a 20 20 20 3a 43 5f 28 6e 2d 31 29 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | .|.....:...:C_(n-1).|........... |
| a32e0 | 20 20 20 3a 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | ...:........|...............|... |
| a3300 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 3a 20 20 20 3a 20 20 20 20 20 20 20 20 7c | ............|.....:...:........| |
| a3320 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 5f 31 20 20 20 20 20 20 20 | ......................S_1....... |
| a3340 | 20 20 20 20 20 20 53 5f 32 20 20 20 20 20 20 20 20 20 20 20 20 20 53 5f 33 20 20 20 20 20 20 20 | ......S_2.............S_3....... |
| a3360 | 20 20 20 20 20 20 20 20 20 53 5f 6e 0a 0a 52 65 70 72 65 73 65 6e 74 69 6e 67 20 77 69 72 65 73 | .........S_n..Representing.wires |
| a3380 | 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 20 77 69 72 65 20 69 6e 20 6f | .....................A.wire.in.o |
| a33a0 | 75 72 20 73 69 6d 75 6c 61 74 69 6f 6e 20 77 69 6c 6c 20 62 65 20 61 20 63 6f 6d 70 75 74 61 74 | ur.simulation.will.be.a.computat |
| a33c0 | 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 20 77 69 74 68 20 74 77 6f 20 6c 6f 63 61 6c 0a 73 74 61 74 | ional.object.with.two.local.stat |
| a33e0 | 65 20 76 61 72 69 61 62 6c 65 73 3a 20 61 20 60 73 69 67 6e 61 6c 2d 76 61 6c 75 65 27 20 28 69 | e.variables:.a.`signal-value'.(i |
| a3400 | 6e 69 74 69 61 6c 6c 79 20 74 61 6b 65 6e 20 74 6f 20 62 65 20 30 29 20 61 6e 64 20 61 0a 63 6f | nitially.taken.to.be.0).and.a.co |
| a3420 | 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 60 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 73 27 20 | llection.of.`action-procedures'. |
| a3440 | 74 6f 20 62 65 20 72 75 6e 20 77 68 65 6e 20 74 68 65 20 73 69 67 6e 61 6c 20 63 68 61 6e 67 65 | to.be.run.when.the.signal.change |
| a3460 | 73 0a 76 61 6c 75 65 2e 20 20 57 65 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 77 69 72 65 2c | s.value...We.implement.the.wire, |
| a3480 | 20 75 73 69 6e 67 20 6d 65 73 73 61 67 65 2d 70 61 73 73 69 6e 67 20 73 74 79 6c 65 2c 20 61 73 | .using.message-passing.style,.as |
| a34a0 | 20 61 0a 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 6c 6f 63 61 6c 20 70 72 6f 63 65 64 75 72 65 | .a.collection.of.local.procedure |
| a34c0 | 73 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 20 60 64 69 73 70 61 74 63 68 27 20 70 72 6f | s.together.with.a.`dispatch'.pro |
| a34e0 | 63 65 64 75 72 65 0a 74 68 61 74 20 73 65 6c 65 63 74 73 20 74 68 65 20 61 70 70 72 6f 70 72 69 | cedure.that.selects.the.appropri |
| a3500 | 61 74 65 20 6c 6f 63 61 6c 20 6f 70 65 72 61 74 69 6f 6e 2c 20 6a 75 73 74 20 61 73 20 77 65 20 | ate.local.operation,.just.as.we. |
| a3520 | 64 69 64 20 77 69 74 68 20 74 68 65 0a 73 69 6d 70 6c 65 20 62 61 6e 6b 2d 61 63 63 6f 75 6e 74 | did.with.the.simple.bank-account |
| a3540 | 20 6f 62 6a 65 63 74 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 31 3a 3a | .object.in.section.*Note.3-1-1:: |
| a3560 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 77 69 72 65 29 0a 20 20 20 20 | :.......(define.(make-wire)..... |
| a3580 | 20 20 20 28 6c 65 74 20 28 28 73 69 67 6e 61 6c 2d 76 61 6c 75 65 20 30 29 20 28 61 63 74 69 6f | ...(let.((signal-value.0).(actio |
| a35a0 | 6e 2d 70 72 6f 63 65 64 75 72 65 73 20 27 28 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 | n-procedures.'()))..........(def |
| a35c0 | 69 6e 65 20 28 73 65 74 2d 6d 79 2d 73 69 67 6e 61 6c 21 20 6e 65 77 2d 76 61 6c 75 65 29 0a 20 | ine.(set-my-signal!.new-value).. |
| a35e0 | 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 3d 20 73 69 67 6e 61 6c 2d 76 61 6c | ..........(if.(not.(=.signal-val |
| a3600 | 75 65 20 6e 65 77 2d 76 61 6c 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 | ue.new-value))................(b |
| a3620 | 65 67 69 6e 20 28 73 65 74 21 20 73 69 67 6e 61 6c 2d 76 61 6c 75 65 20 6e 65 77 2d 76 61 6c 75 | egin.(set!.signal-value.new-valu |
| a3640 | 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 61 6c 6c 2d 65 | e).......................(call-e |
| a3660 | 61 63 68 20 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 73 29 29 0a 20 20 20 20 20 20 20 20 | ach.action-procedures))......... |
| a3680 | 20 20 20 20 20 20 20 27 64 6f 6e 65 29 29 0a 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | .......'done))...........(define |
| a36a0 | 20 28 61 63 63 65 70 74 2d 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 21 20 70 72 6f 63 29 | .(accept-action-procedure!.proc) |
| a36c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 | ............(set!.action-procedu |
| a36e0 | 72 65 73 20 28 63 6f 6e 73 20 70 72 6f 63 20 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 73 | res.(cons.proc.action-procedures |
| a3700 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 29 29 0a 0a 20 20 20 20 20 20 20 20 20 | ))............(proc))........... |
| a3720 | 28 64 65 66 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (define.(dispatch.m)............ |
| a3740 | 28 63 6f 6e 64 20 28 28 65 71 3f 20 6d 20 27 67 65 74 2d 73 69 67 6e 61 6c 29 20 73 69 67 6e 61 | (cond.((eq?.m.'get-signal).signa |
| a3760 | 6c 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 | l-value)..................((eq?. |
| a3780 | 6d 20 27 73 65 74 2d 73 69 67 6e 61 6c 21 29 20 73 65 74 2d 6d 79 2d 73 69 67 6e 61 6c 21 29 0a | m.'set-signal!).set-my-signal!). |
| a37a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 61 64 64 2d 61 63 | .................((eq?.m.'add-ac |
| a37c0 | 74 69 6f 6e 21 29 20 61 63 63 65 70 74 2d 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 21 29 | tion!).accept-action-procedure!) |
| a37e0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 | ..................(else.(error." |
| a3800 | 55 6e 6b 6e 6f 77 6e 20 6f 70 65 72 61 74 69 6f 6e 20 2d 2d 20 57 49 52 45 22 20 6d 29 29 29 29 | Unknown.operation.--.WIRE".m)))) |
| a3820 | 0a 20 20 20 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 29 0a 0a 20 20 20 54 68 65 20 6c 6f 63 | ..........dispatch)).....The.loc |
| a3840 | 61 6c 20 70 72 6f 63 65 64 75 72 65 20 60 73 65 74 2d 6d 79 2d 73 69 67 6e 61 6c 21 27 20 74 65 | al.procedure.`set-my-signal!'.te |
| a3860 | 73 74 73 20 77 68 65 74 68 65 72 20 74 68 65 20 6e 65 77 20 73 69 67 6e 61 6c 0a 76 61 6c 75 65 | sts.whether.the.new.signal.value |
| a3880 | 20 63 68 61 6e 67 65 73 20 74 68 65 20 73 69 67 6e 61 6c 20 6f 6e 20 74 68 65 20 77 69 72 65 2e | .changes.the.signal.on.the.wire. |
| a38a0 | 20 20 49 66 20 73 6f 2c 20 69 74 20 72 75 6e 73 20 65 61 63 68 20 6f 66 20 74 68 65 0a 61 63 74 | ..If.so,.it.runs.each.of.the.act |
| a38c0 | 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 2c 20 75 73 69 6e 67 20 74 68 65 20 66 6f 6c 6c 6f 77 | ion.procedures,.using.the.follow |
| a38e0 | 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 60 63 61 6c 6c 2d 65 61 63 68 27 2c 20 77 68 69 63 68 | ing.procedure.`call-each',.which |
| a3900 | 0a 63 61 6c 6c 73 20 65 61 63 68 20 6f 66 20 74 68 65 20 69 74 65 6d 73 20 69 6e 20 61 20 6c 69 | .calls.each.of.the.items.in.a.li |
| a3920 | 73 74 20 6f 66 20 6e 6f 2d 61 72 67 75 6d 65 6e 74 20 70 72 6f 63 65 64 75 72 65 73 3a 0a 0a 20 | st.of.no-argument.procedures:... |
| a3940 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 61 6c 6c 2d 65 61 63 68 20 70 72 6f 63 65 64 75 72 65 | ....(define.(call-each.procedure |
| a3960 | 73 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 70 72 6f 63 65 64 75 72 65 73 29 | s)........(if.(null?.procedures) |
| a3980 | 0a 20 20 20 20 20 20 20 20 20 20 20 27 64 6f 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 65 | ............'done............(be |
| a39a0 | 67 69 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 63 61 72 20 70 72 6f 63 65 64 75 72 65 | gin..............((car.procedure |
| a39c0 | 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 61 6c 6c 2d 65 61 63 68 20 28 63 64 72 | s))..............(call-each.(cdr |
| a39e0 | 20 70 72 6f 63 65 64 75 72 65 73 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 6c 6f 63 61 6c 20 70 | .procedures))))).....The.local.p |
| a3a00 | 72 6f 63 65 64 75 72 65 20 60 61 63 63 65 70 74 2d 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 | rocedure.`accept-action-procedur |
| a3a20 | 65 21 27 20 61 64 64 73 20 74 68 65 20 67 69 76 65 6e 0a 70 72 6f 63 65 64 75 72 65 20 74 6f 20 | e!'.adds.the.given.procedure.to. |
| a3a40 | 74 68 65 20 6c 69 73 74 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 62 65 20 72 75 6e | the.list.of.procedures.to.be.run |
| a3a60 | 2c 20 61 6e 64 20 74 68 65 6e 20 72 75 6e 73 20 74 68 65 20 6e 65 77 0a 70 72 6f 63 65 64 75 72 | ,.and.then.runs.the.new.procedur |
| a3a80 | 65 20 6f 6e 63 65 2e 20 20 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 33 | e.once...(See.*Note.Exercise.3-3 |
| a3aa0 | 31 3a 3a 2e 29 0a 0a 20 20 20 57 69 74 68 20 74 68 65 20 6c 6f 63 61 6c 20 60 64 69 73 70 61 74 | 1::.).....With.the.local.`dispat |
| a3ac0 | 63 68 27 20 70 72 6f 63 65 64 75 72 65 20 73 65 74 20 75 70 20 61 73 20 73 70 65 63 69 66 69 65 | ch'.procedure.set.up.as.specifie |
| a3ae0 | 64 2c 20 77 65 20 63 61 6e 0a 70 72 6f 76 69 64 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 | d,.we.can.provide.the.following. |
| a3b00 | 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 61 63 63 65 73 73 20 74 68 65 20 6c 6f 63 61 6c 20 6f | procedures.to.access.the.local.o |
| a3b20 | 70 65 72 61 74 69 6f 6e 73 20 6f 6e 0a 77 69 72 65 73 3a 28 32 29 0a 0a 20 20 20 20 20 28 64 65 | perations.on.wires:(2).......(de |
| a3b40 | 66 69 6e 65 20 28 67 65 74 2d 73 69 67 6e 61 6c 20 77 69 72 65 29 0a 20 20 20 20 20 20 20 28 77 | fine.(get-signal.wire)........(w |
| a3b60 | 69 72 65 20 27 67 65 74 2d 73 69 67 6e 61 6c 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ire.'get-signal)).......(define. |
| a3b80 | 28 73 65 74 2d 73 69 67 6e 61 6c 21 20 77 69 72 65 20 6e 65 77 2d 76 61 6c 75 65 29 0a 20 20 20 | (set-signal!.wire.new-value).... |
| a3ba0 | 20 20 20 20 28 28 77 69 72 65 20 27 73 65 74 2d 73 69 67 6e 61 6c 21 29 20 6e 65 77 2d 76 61 6c | ....((wire.'set-signal!).new-val |
| a3bc0 | 75 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 61 63 74 69 6f 6e 21 20 | ue)).......(define.(add-action!. |
| a3be0 | 77 69 72 65 20 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 28 28 | wire.action-procedure)........(( |
| a3c00 | 77 69 72 65 20 27 61 64 64 2d 61 63 74 69 6f 6e 21 29 20 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 | wire.'add-action!).action-proced |
| a3c20 | 75 72 65 29 29 0a 0a 20 20 20 57 69 72 65 73 2c 20 77 68 69 63 68 20 68 61 76 65 20 74 69 6d 65 | ure)).....Wires,.which.have.time |
| a3c40 | 2d 76 61 72 79 69 6e 67 20 73 69 67 6e 61 6c 73 20 61 6e 64 20 6d 61 79 20 62 65 20 69 6e 63 72 | -varying.signals.and.may.be.incr |
| a3c60 | 65 6d 65 6e 74 61 6c 6c 79 0a 61 74 74 61 63 68 65 64 20 74 6f 20 64 65 76 69 63 65 73 2c 20 61 | ementally.attached.to.devices,.a |
| a3c80 | 72 65 20 74 79 70 69 63 61 6c 20 6f 66 20 6d 75 74 61 62 6c 65 20 6f 62 6a 65 63 74 73 2e 20 20 | re.typical.of.mutable.objects... |
| a3ca0 | 57 65 20 68 61 76 65 20 6d 6f 64 65 6c 65 64 0a 74 68 65 6d 20 61 73 20 70 72 6f 63 65 64 75 72 | We.have.modeled.them.as.procedur |
| a3cc0 | 65 73 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 20 74 68 | es.with.local.state.variables.th |
| a3ce0 | 61 74 20 61 72 65 20 6d 6f 64 69 66 69 65 64 20 62 79 0a 61 73 73 69 67 6e 6d 65 6e 74 2e 20 20 | at.are.modified.by.assignment... |
| a3d00 | 57 68 65 6e 20 61 20 6e 65 77 20 77 69 72 65 20 69 73 20 63 72 65 61 74 65 64 2c 20 61 20 6e 65 | When.a.new.wire.is.created,.a.ne |
| a3d20 | 77 20 73 65 74 20 6f 66 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 0a 69 73 20 61 6c 6c 6f | w.set.of.state.variables.is.allo |
| a3d40 | 63 61 74 65 64 20 28 62 79 20 74 68 65 20 60 6c 65 74 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 | cated.(by.the.`let'.expression.i |
| a3d60 | 6e 20 60 6d 61 6b 65 2d 77 69 72 65 27 29 20 61 6e 64 20 61 20 6e 65 77 0a 60 64 69 73 70 61 74 | n.`make-wire').and.a.new.`dispat |
| a3d80 | 63 68 27 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 63 6f 6e 73 74 72 75 63 74 65 64 20 61 6e 64 | ch'.procedure.is.constructed.and |
| a3da0 | 20 72 65 74 75 72 6e 65 64 2c 20 63 61 70 74 75 72 69 6e 67 20 74 68 65 0a 65 6e 76 69 72 6f 6e | .returned,.capturing.the.environ |
| a3dc0 | 6d 65 6e 74 20 77 69 74 68 20 74 68 65 20 6e 65 77 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 | ment.with.the.new.state.variable |
| a3de0 | 73 2e 0a 0a 20 20 20 54 68 65 20 77 69 72 65 73 20 61 72 65 20 73 68 61 72 65 64 20 61 6d 6f 6e | s......The.wires.are.shared.amon |
| a3e00 | 67 20 74 68 65 20 76 61 72 69 6f 75 73 20 64 65 76 69 63 65 73 20 74 68 61 74 20 68 61 76 65 20 | g.the.various.devices.that.have. |
| a3e20 | 62 65 65 6e 0a 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 74 68 65 6d 2e 20 20 54 68 75 73 2c 20 61 | been.connected.to.them...Thus,.a |
| a3e40 | 20 63 68 61 6e 67 65 20 6d 61 64 65 20 62 79 20 61 6e 20 69 6e 74 65 72 61 63 74 69 6f 6e 20 77 | .change.made.by.an.interaction.w |
| a3e60 | 69 74 68 20 6f 6e 65 0a 64 65 76 69 63 65 20 77 69 6c 6c 20 61 66 66 65 63 74 20 61 6c 6c 20 74 | ith.one.device.will.affect.all.t |
| a3e80 | 68 65 20 6f 74 68 65 72 20 64 65 76 69 63 65 73 20 61 74 74 61 63 68 65 64 20 74 6f 20 74 68 65 | he.other.devices.attached.to.the |
| a3ea0 | 20 77 69 72 65 2e 20 20 54 68 65 0a 77 69 72 65 20 63 6f 6d 6d 75 6e 69 63 61 74 65 73 20 74 68 | .wire...The.wire.communicates.th |
| a3ec0 | 65 20 63 68 61 6e 67 65 20 74 6f 20 69 74 73 20 6e 65 69 67 68 62 6f 72 73 20 62 79 20 63 61 6c | e.change.to.its.neighbors.by.cal |
| a3ee0 | 6c 69 6e 67 20 74 68 65 20 61 63 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 73 20 70 72 6f 76 69 | ling.the.action.procedures.provi |
| a3f00 | 64 65 64 20 74 6f 20 69 74 20 77 68 65 6e 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 77 | ded.to.it.when.the.connections.w |
| a3f20 | 65 72 65 20 65 73 74 61 62 6c 69 73 68 65 64 2e 0a 0a 54 68 65 20 61 67 65 6e 64 61 0a 2e 2e 2e | ere.established...The.agenda.... |
| a3f40 | 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 6f 6e 6c 79 20 74 68 69 6e 67 20 6e 65 65 64 65 64 20 74 | .........The.only.thing.needed.t |
| a3f60 | 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 65 20 73 69 6d 75 6c 61 74 6f 72 20 69 73 20 60 61 66 74 | o.complete.the.simulator.is.`aft |
| a3f80 | 65 72 2d 64 65 6c 61 79 27 2e 20 20 54 68 65 0a 69 64 65 61 20 68 65 72 65 20 69 73 20 74 68 61 | er-delay'...The.idea.here.is.tha |
| a3fa0 | 74 20 77 65 20 6d 61 69 6e 74 61 69 6e 20 61 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 2c 20 | t.we.maintain.a.data.structure,. |
| a3fc0 | 63 61 6c 6c 65 64 20 61 6e 20 22 61 67 65 6e 64 61 22 2c 0a 74 68 61 74 20 63 6f 6e 74 61 69 6e | called.an."agenda",.that.contain |
| a3fe0 | 73 20 61 20 73 63 68 65 64 75 6c 65 20 6f 66 20 74 68 69 6e 67 73 20 74 6f 20 64 6f 2e 20 20 54 | s.a.schedule.of.things.to.do...T |
| a4000 | 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 72 65 0a 64 65 66 69 | he.following.operations.are.defi |
| a4020 | 6e 65 64 20 66 6f 72 20 61 67 65 6e 64 61 73 3a 0a 0a 20 20 20 2a 20 60 28 6d 61 6b 65 2d 61 67 | ned.for.agendas:.....*.`(make-ag |
| a4040 | 65 6e 64 61 29 27 20 72 65 74 75 72 6e 73 20 61 20 6e 65 77 20 65 6d 70 74 79 20 61 67 65 6e 64 | enda)'.returns.a.new.empty.agend |
| a4060 | 61 2e 0a 0a 20 20 20 2a 20 60 28 65 6d 70 74 79 2d 61 67 65 6e 64 61 3f 20 3c 41 47 45 4e 44 41 | a......*.`(empty-agenda?.<AGENDA |
| a4080 | 3e 29 27 20 69 73 20 74 72 75 65 20 69 66 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 61 67 65 | >)'.is.true.if.the.specified.age |
| a40a0 | 6e 64 61 20 69 73 0a 20 20 20 20 20 65 6d 70 74 79 2e 0a 0a 20 20 20 2a 20 60 28 66 69 72 73 74 | nda.is......empty......*.`(first |
| a40c0 | 2d 61 67 65 6e 64 61 2d 69 74 65 6d 20 3c 41 47 45 4e 44 41 3e 29 27 20 72 65 74 75 72 6e 73 20 | -agenda-item.<AGENDA>)'.returns. |
| a40e0 | 74 68 65 20 66 69 72 73 74 20 69 74 65 6d 20 6f 6e 20 74 68 65 0a 20 20 20 20 20 61 67 65 6e 64 | the.first.item.on.the......agend |
| a4100 | 61 2e 0a 0a 20 20 20 2a 20 60 28 72 65 6d 6f 76 65 2d 66 69 72 73 74 2d 61 67 65 6e 64 61 2d 69 | a......*.`(remove-first-agenda-i |
| a4120 | 74 65 6d 21 20 3c 41 47 45 4e 44 41 3e 29 27 20 6d 6f 64 69 66 69 65 73 20 74 68 65 20 61 67 65 | tem!.<AGENDA>)'.modifies.the.age |
| a4140 | 6e 64 61 20 62 79 0a 20 20 20 20 20 72 65 6d 6f 76 69 6e 67 20 74 68 65 20 66 69 72 73 74 20 69 | nda.by......removing.the.first.i |
| a4160 | 74 65 6d 2e 0a 0a 20 20 20 2a 20 60 28 61 64 64 2d 74 6f 2d 61 67 65 6e 64 61 21 20 3c 54 49 4d | tem......*.`(add-to-agenda!.<TIM |
| a4180 | 45 3e 20 3c 41 43 54 49 4f 4e 3e 20 3c 41 47 45 4e 44 41 3e 29 27 20 6d 6f 64 69 66 69 65 73 20 | E>.<ACTION>.<AGENDA>)'.modifies. |
| a41a0 | 74 68 65 20 61 67 65 6e 64 61 20 62 79 0a 20 20 20 20 20 61 64 64 69 6e 67 20 74 68 65 20 67 69 | the.agenda.by......adding.the.gi |
| a41c0 | 76 65 6e 20 61 63 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 62 65 20 72 75 6e 20 61 | ven.action.procedure.to.be.run.a |
| a41e0 | 74 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 74 69 6d 65 2e 0a 0a 20 20 20 2a 20 60 28 63 75 | t.the.specified.time......*.`(cu |
| a4200 | 72 72 65 6e 74 2d 74 69 6d 65 20 3c 41 47 45 4e 44 41 3e 29 27 20 72 65 74 75 72 6e 73 20 74 68 | rrent-time.<AGENDA>)'.returns.th |
| a4220 | 65 20 63 75 72 72 65 6e 74 20 73 69 6d 75 6c 61 74 69 6f 6e 20 74 69 6d 65 2e 0a 0a 0a 20 20 20 | e.current.simulation.time....... |
| a4240 | 54 68 65 20 70 61 72 74 69 63 75 6c 61 72 20 61 67 65 6e 64 61 20 74 68 61 74 20 77 65 20 75 73 | The.particular.agenda.that.we.us |
| a4260 | 65 20 69 73 20 64 65 6e 6f 74 65 64 20 62 79 20 60 74 68 65 2d 61 67 65 6e 64 61 27 2e 20 20 54 | e.is.denoted.by.`the-agenda'...T |
| a4280 | 68 65 0a 70 72 6f 63 65 64 75 72 65 20 60 61 66 74 65 72 2d 64 65 6c 61 79 27 20 61 64 64 73 20 | he.procedure.`after-delay'.adds. |
| a42a0 | 6e 65 77 20 65 6c 65 6d 65 6e 74 73 20 74 6f 20 60 74 68 65 2d 61 67 65 6e 64 61 27 3a 0a 0a 20 | new.elements.to.`the-agenda':... |
| a42c0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 66 74 65 72 2d 64 65 6c 61 79 20 64 65 6c 61 79 20 61 | ....(define.(after-delay.delay.a |
| a42e0 | 63 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 28 61 64 64 2d 74 6f 2d 61 67 65 6e 64 61 21 20 28 2b | ction)........(add-to-agenda!.(+ |
| a4300 | 20 64 65 6c 61 79 20 28 63 75 72 72 65 6e 74 2d 74 69 6d 65 20 74 68 65 2d 61 67 65 6e 64 61 29 | .delay.(current-time.the-agenda) |
| a4320 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 63 74 69 6f 6e 0a | )........................action. |
| a4340 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 61 67 65 6e 64 | .......................the-agend |
| a4360 | 61 29 29 0a 0a 20 20 20 54 68 65 20 73 69 6d 75 6c 61 74 69 6f 6e 20 69 73 20 64 72 69 76 65 6e | a)).....The.simulation.is.driven |
| a4380 | 20 62 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 70 72 6f 70 61 67 61 74 65 27 2c 20 77 | .by.the.procedure.`propagate',.w |
| a43a0 | 68 69 63 68 0a 6f 70 65 72 61 74 65 73 20 6f 6e 20 60 74 68 65 2d 61 67 65 6e 64 61 27 2c 20 65 | hich.operates.on.`the-agenda',.e |
| a43c0 | 78 65 63 75 74 69 6e 67 20 65 61 63 68 20 70 72 6f 63 65 64 75 72 65 20 6f 6e 20 74 68 65 20 61 | xecuting.each.procedure.on.the.a |
| a43e0 | 67 65 6e 64 61 20 69 6e 0a 73 65 71 75 65 6e 63 65 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 | genda.in.sequence...In.general,. |
| a4400 | 61 73 20 74 68 65 20 73 69 6d 75 6c 61 74 69 6f 6e 20 72 75 6e 73 2c 20 6e 65 77 20 69 74 65 6d | as.the.simulation.runs,.new.item |
| a4420 | 73 20 77 69 6c 6c 20 62 65 20 61 64 64 65 64 0a 74 6f 20 74 68 65 20 61 67 65 6e 64 61 2c 20 61 | s.will.be.added.to.the.agenda,.a |
| a4440 | 6e 64 20 60 70 72 6f 70 61 67 61 74 65 27 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 | nd.`propagate'.will.continue.the |
| a4460 | 20 73 69 6d 75 6c 61 74 69 6f 6e 20 61 73 20 6c 6f 6e 67 20 61 73 0a 74 68 65 72 65 20 61 72 65 | .simulation.as.long.as.there.are |
| a4480 | 20 69 74 65 6d 73 20 6f 6e 20 74 68 65 20 61 67 65 6e 64 61 3a 0a 0a 20 20 20 20 20 28 64 65 66 | .items.on.the.agenda:.......(def |
| a44a0 | 69 6e 65 20 28 70 72 6f 70 61 67 61 74 65 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 65 6d 70 74 | ine.(propagate)........(if.(empt |
| a44c0 | 79 2d 61 67 65 6e 64 61 3f 20 74 68 65 2d 61 67 65 6e 64 61 29 0a 20 20 20 20 20 20 20 20 20 20 | y-agenda?.the-agenda)........... |
| a44e0 | 20 27 64 6f 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 66 69 72 73 74 2d 69 | .'done............(let.((first-i |
| a4500 | 74 65 6d 20 28 66 69 72 73 74 2d 61 67 65 6e 64 61 2d 69 74 65 6d 20 74 68 65 2d 61 67 65 6e 64 | tem.(first-agenda-item.the-agend |
| a4520 | 61 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 72 73 74 2d 69 74 65 6d 29 0a 20 | a)))..............(first-item).. |
| a4540 | 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 6d 6f 76 65 2d 66 69 72 73 74 2d 61 67 65 6e 64 61 | ............(remove-first-agenda |
| a4560 | 2d 69 74 65 6d 21 20 74 68 65 2d 61 67 65 6e 64 61 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | -item!.the-agenda).............. |
| a4580 | 28 70 72 6f 70 61 67 61 74 65 29 29 29 29 0a 0a 41 20 73 61 6d 70 6c 65 20 73 69 6d 75 6c 61 74 | (propagate))))..A.sample.simulat |
| a45a0 | 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 66 6f 6c | ion......................The.fol |
| a45c0 | 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 70 6c 61 63 65 73 20 61 | lowing.procedure,.which.places.a |
| a45e0 | 20 22 70 72 6f 62 65 22 20 6f 6e 20 61 20 77 69 72 65 2c 20 73 68 6f 77 73 20 74 68 65 0a 73 69 | ."probe".on.a.wire,.shows.the.si |
| a4600 | 6d 75 6c 61 74 6f 72 20 69 6e 20 61 63 74 69 6f 6e 2e 20 20 54 68 65 20 70 72 6f 62 65 20 74 65 | mulator.in.action...The.probe.te |
| a4620 | 6c 6c 73 20 74 68 65 20 77 69 72 65 20 74 68 61 74 2c 20 77 68 65 6e 65 76 65 72 20 69 74 73 20 | lls.the.wire.that,.whenever.its. |
| a4640 | 73 69 67 6e 61 6c 0a 63 68 61 6e 67 65 73 20 76 61 6c 75 65 2c 20 69 74 20 73 68 6f 75 6c 64 20 | signal.changes.value,.it.should. |
| a4660 | 70 72 69 6e 74 20 74 68 65 20 6e 65 77 20 73 69 67 6e 61 6c 20 76 61 6c 75 65 2c 20 74 6f 67 65 | print.the.new.signal.value,.toge |
| a4680 | 74 68 65 72 20 77 69 74 68 20 74 68 65 0a 63 75 72 72 65 6e 74 20 74 69 6d 65 20 61 6e 64 20 61 | ther.with.the.current.time.and.a |
| a46a0 | 20 6e 61 6d 65 20 74 68 61 74 20 69 64 65 6e 74 69 66 69 65 73 20 74 68 65 20 77 69 72 65 3a 0a | .name.that.identifies.the.wire:. |
| a46c0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 62 65 20 6e 61 6d 65 20 77 69 72 65 29 0a | ......(define.(probe.name.wire). |
| a46e0 | 20 20 20 20 20 20 20 28 61 64 64 2d 61 63 74 69 6f 6e 21 20 77 69 72 65 0a 20 20 20 20 20 20 20 | .......(add-action!.wire........ |
| a4700 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 | .............(lambda.()......... |
| a4720 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 20 20 | ..............(newline)......... |
| a4740 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 6e 61 6d 65 29 0a 20 20 20 | ..............(display.name).... |
| a4760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 22 20 22 29 | ...................(display.".") |
| a4780 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 | .......................(display. |
| a47a0 | 28 63 75 72 72 65 6e 74 2d 74 69 6d 65 20 74 68 65 2d 61 67 65 6e 64 61 29 29 0a 20 20 20 20 20 | (current-time.the-agenda))...... |
| a47c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 22 20 20 4e 65 77 | .................(display."..New |
| a47e0 | 2d 76 61 6c 75 65 20 3d 20 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -value.=.")..................... |
| a4800 | 20 20 28 64 69 73 70 6c 61 79 20 28 67 65 74 2d 73 69 67 6e 61 6c 20 77 69 72 65 29 29 29 29 29 | ..(display.(get-signal.wire))))) |
| a4820 | 0a 0a 20 20 20 57 65 20 62 65 67 69 6e 20 62 79 20 69 6e 69 74 69 61 6c 69 7a 69 6e 67 20 74 68 | .....We.begin.by.initializing.th |
| a4840 | 65 20 61 67 65 6e 64 61 20 61 6e 64 20 73 70 65 63 69 66 79 69 6e 67 20 64 65 6c 61 79 73 20 66 | e.agenda.and.specifying.delays.f |
| a4860 | 6f 72 20 74 68 65 0a 70 72 69 6d 69 74 69 76 65 20 66 75 6e 63 74 69 6f 6e 20 62 6f 78 65 73 3a | or.the.primitive.function.boxes: |
| a4880 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 74 68 65 2d 61 67 65 6e 64 61 20 28 6d 61 6b 65 2d | .......(define.the-agenda.(make- |
| a48a0 | 61 67 65 6e 64 61 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 76 65 72 74 65 72 2d 64 | agenda))......(define.inverter-d |
| a48c0 | 65 6c 61 79 20 32 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 61 6e 64 2d 67 61 74 65 2d 64 65 | elay.2)......(define.and-gate-de |
| a48e0 | 6c 61 79 20 33 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6f 72 2d 67 61 74 65 2d 64 65 6c 61 | lay.3)......(define.or-gate-dela |
| a4900 | 79 20 35 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 64 65 66 69 6e 65 20 66 6f 75 72 20 77 69 72 65 | y.5).....Now.we.define.four.wire |
| a4920 | 73 2c 20 70 6c 61 63 69 6e 67 20 70 72 6f 62 65 73 20 6f 6e 20 74 77 6f 20 6f 66 20 74 68 65 6d | s,.placing.probes.on.two.of.them |
| a4940 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 70 75 74 2d 31 20 28 6d 61 6b 65 2d 77 69 | :.......(define.input-1.(make-wi |
| a4960 | 72 65 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 70 75 74 2d 32 20 28 6d 61 6b 65 2d | re))......(define.input-2.(make- |
| a4980 | 77 69 72 65 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 75 6d 20 28 6d 61 6b 65 2d 77 69 | wire))......(define.sum.(make-wi |
| a49a0 | 72 65 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 63 61 72 72 79 20 28 6d 61 6b 65 2d 77 69 | re))......(define.carry.(make-wi |
| a49c0 | 72 65 29 29 0a 0a 20 20 20 20 20 28 70 72 6f 62 65 20 27 73 75 6d 20 73 75 6d 29 0a 20 20 20 20 | re)).......(probe.'sum.sum)..... |
| a49e0 | 20 73 75 6d 20 30 20 20 4e 65 77 2d 76 61 6c 75 65 20 3d 20 30 0a 0a 20 20 20 20 20 28 70 72 6f | .sum.0..New-value.=.0.......(pro |
| a4a00 | 62 65 20 27 63 61 72 72 79 20 63 61 72 72 79 29 0a 20 20 20 20 20 63 61 72 72 79 20 30 20 20 4e | be.'carry.carry)......carry.0..N |
| a4a20 | 65 77 2d 76 61 6c 75 65 20 3d 20 30 0a 0a 20 20 20 4e 65 78 74 20 77 65 20 63 6f 6e 6e 65 63 74 | ew-value.=.0.....Next.we.connect |
| a4a40 | 20 74 68 65 20 77 69 72 65 73 20 69 6e 20 61 20 68 61 6c 66 2d 61 64 64 65 72 20 63 69 72 63 75 | .the.wires.in.a.half-adder.circu |
| a4a60 | 69 74 20 28 61 73 20 69 6e 20 2a 4e 6f 74 65 0a 46 69 67 75 72 65 20 33 2d 32 35 3a 3a 29 2c 20 | it.(as.in.*Note.Figure.3-25::),. |
| a4a80 | 73 65 74 20 74 68 65 20 73 69 67 6e 61 6c 20 6f 6e 20 60 69 6e 70 75 74 2d 31 27 20 74 6f 20 31 | set.the.signal.on.`input-1'.to.1 |
| a4aa0 | 2c 20 61 6e 64 20 72 75 6e 20 74 68 65 0a 73 69 6d 75 6c 61 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 | ,.and.run.the.simulation:....... |
| a4ac0 | 28 68 61 6c 66 2d 61 64 64 65 72 20 69 6e 70 75 74 2d 31 20 69 6e 70 75 74 2d 32 20 73 75 6d 20 | (half-adder.input-1.input-2.sum. |
| a4ae0 | 63 61 72 72 79 29 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 28 73 65 74 2d 73 69 67 6e 61 6c | carry)......ok.......(set-signal |
| a4b00 | 21 20 69 6e 70 75 74 2d 31 20 31 29 0a 20 20 20 20 20 64 6f 6e 65 0a 0a 20 20 20 20 20 28 70 72 | !.input-1.1)......done.......(pr |
| a4b20 | 6f 70 61 67 61 74 65 29 0a 20 20 20 20 20 73 75 6d 20 38 20 20 4e 65 77 2d 76 61 6c 75 65 20 3d | opagate)......sum.8..New-value.= |
| a4b40 | 20 31 0a 20 20 20 20 20 64 6f 6e 65 0a 0a 20 20 20 54 68 65 20 60 73 75 6d 27 20 73 69 67 6e 61 | .1......done.....The.`sum'.signa |
| a4b60 | 6c 20 63 68 61 6e 67 65 73 20 74 6f 20 31 20 61 74 20 74 69 6d 65 20 38 2e 20 20 57 65 20 61 72 | l.changes.to.1.at.time.8...We.ar |
| a4b80 | 65 20 6e 6f 77 20 65 69 67 68 74 20 74 69 6d 65 0a 75 6e 69 74 73 20 66 72 6f 6d 20 74 68 65 20 | e.now.eight.time.units.from.the. |
| a4ba0 | 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65 20 73 69 6d 75 6c 61 74 69 6f 6e 2e 20 20 41 74 | beginning.of.the.simulation...At |
| a4bc0 | 20 74 68 69 73 20 70 6f 69 6e 74 2c 20 77 65 20 63 61 6e 20 73 65 74 0a 74 68 65 20 73 69 67 6e | .this.point,.we.can.set.the.sign |
| a4be0 | 61 6c 20 6f 6e 20 60 69 6e 70 75 74 2d 32 27 20 74 6f 20 31 20 61 6e 64 20 61 6c 6c 6f 77 20 74 | al.on.`input-2'.to.1.and.allow.t |
| a4c00 | 68 65 20 76 61 6c 75 65 73 20 74 6f 20 70 72 6f 70 61 67 61 74 65 3a 0a 0a 20 20 20 20 20 28 73 | he.values.to.propagate:.......(s |
| a4c20 | 65 74 2d 73 69 67 6e 61 6c 21 20 69 6e 70 75 74 2d 32 20 31 29 0a 20 20 20 20 20 64 6f 6e 65 0a | et-signal!.input-2.1)......done. |
| a4c40 | 0a 20 20 20 20 20 28 70 72 6f 70 61 67 61 74 65 29 0a 20 20 20 20 20 63 61 72 72 79 20 31 31 20 | ......(propagate)......carry.11. |
| a4c60 | 20 4e 65 77 2d 76 61 6c 75 65 20 3d 20 31 0a 20 20 20 20 20 73 75 6d 20 31 36 20 20 4e 65 77 2d | .New-value.=.1......sum.16..New- |
| a4c80 | 76 61 6c 75 65 20 3d 20 30 0a 20 20 20 20 20 64 6f 6e 65 0a 0a 20 20 20 54 68 65 20 60 63 61 72 | value.=.0......done.....The.`car |
| a4ca0 | 72 79 27 20 63 68 61 6e 67 65 73 20 74 6f 20 31 20 61 74 20 74 69 6d 65 20 31 31 20 61 6e 64 20 | ry'.changes.to.1.at.time.11.and. |
| a4cc0 | 74 68 65 20 60 73 75 6d 27 20 63 68 61 6e 67 65 73 20 74 6f 20 30 20 61 74 0a 74 69 6d 65 20 31 | the.`sum'.changes.to.0.at.time.1 |
| a4ce0 | 36 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 33 31 3a 2a 20 54 68 65 20 69 6e | 6........*Exercise.3.31:*.The.in |
| a4d00 | 74 65 72 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 20 60 61 63 63 65 70 74 2d 61 63 74 69 6f 6e 2d | ternal.procedure.`accept-action- |
| a4d20 | 70 72 6f 63 65 64 75 72 65 21 27 0a 20 20 20 20 20 64 65 66 69 6e 65 64 20 69 6e 20 60 6d 61 6b | procedure!'......defined.in.`mak |
| a4d40 | 65 2d 77 69 72 65 27 20 73 70 65 63 69 66 69 65 73 20 74 68 61 74 20 77 68 65 6e 20 61 20 6e 65 | e-wire'.specifies.that.when.a.ne |
| a4d60 | 77 20 61 63 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 69 73 20 61 64 64 65 64 | w.action.procedure......is.added |
| a4d80 | 20 74 6f 20 61 20 77 69 72 65 2c 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 69 6d 6d | .to.a.wire,.the.procedure.is.imm |
| a4da0 | 65 64 69 61 74 65 6c 79 20 72 75 6e 2e 20 20 45 78 70 6c 61 69 6e 20 77 68 79 0a 20 20 20 20 20 | ediately.run...Explain.why...... |
| a4dc0 | 74 68 69 73 20 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 20 69 73 20 6e 65 63 65 73 73 61 72 79 | this.initialization.is.necessary |
| a4de0 | 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 74 72 61 63 65 20 74 68 72 6f 75 67 68 20 | ...In.particular,.trace.through. |
| a4e00 | 74 68 65 0a 20 20 20 20 20 68 61 6c 66 2d 61 64 64 65 72 20 65 78 61 6d 70 6c 65 20 69 6e 20 74 | the......half-adder.example.in.t |
| a4e20 | 68 65 20 70 61 72 61 67 72 61 70 68 73 20 61 62 6f 76 65 20 61 6e 64 20 73 61 79 20 68 6f 77 20 | he.paragraphs.above.and.say.how. |
| a4e40 | 74 68 65 0a 20 20 20 20 20 73 79 73 74 65 6d 27 73 20 72 65 73 70 6f 6e 73 65 20 77 6f 75 6c 64 | the......system's.response.would |
| a4e60 | 20 64 69 66 66 65 72 20 69 66 20 77 65 20 68 61 64 20 64 65 66 69 6e 65 64 0a 20 20 20 20 20 60 | .differ.if.we.had.defined......` |
| a4e80 | 61 63 63 65 70 74 2d 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 21 27 20 61 73 0a 0a 20 20 | accept-action-procedure!'.as.... |
| a4ea0 | 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 63 63 65 70 74 2d 61 63 74 69 6f 6e 2d 70 | ........(define.(accept-action-p |
| a4ec0 | 72 6f 63 65 64 75 72 65 21 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 | rocedure!.proc).............(set |
| a4ee0 | 21 20 61 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 73 20 28 63 6f 6e 73 20 70 72 6f 63 20 61 | !.action-procedures.(cons.proc.a |
| a4f00 | 63 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 73 29 29 29 0a 0a 49 6d 70 6c 65 6d 65 6e 74 69 6e | ction-procedures)))..Implementin |
| a4f20 | 67 20 74 68 65 20 61 67 65 6e 64 61 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | g.the.agenda.................... |
| a4f40 | 2e 2e 2e 2e 0a 0a 46 69 6e 61 6c 6c 79 2c 20 77 65 20 67 69 76 65 20 64 65 74 61 69 6c 73 20 6f | ......Finally,.we.give.details.o |
| a4f60 | 66 20 74 68 65 20 61 67 65 6e 64 61 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 2c 20 77 68 69 | f.the.agenda.data.structure,.whi |
| a4f80 | 63 68 20 68 6f 6c 64 73 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 61 72 65 | ch.holds.the.procedures.that.are |
| a4fa0 | 20 73 63 68 65 64 75 6c 65 64 20 66 6f 72 20 66 75 74 75 72 65 20 65 78 65 63 75 74 69 6f 6e 2e | .scheduled.for.future.execution. |
| a4fc0 | 0a 0a 20 20 20 54 68 65 20 61 67 65 6e 64 61 20 69 73 20 6d 61 64 65 20 75 70 20 6f 66 20 22 74 | .....The.agenda.is.made.up.of."t |
| a4fe0 | 69 6d 65 20 73 65 67 6d 65 6e 74 73 22 2e 20 20 45 61 63 68 20 74 69 6d 65 20 73 65 67 6d 65 6e | ime.segments"...Each.time.segmen |
| a5000 | 74 20 69 73 20 61 0a 70 61 69 72 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 61 20 6e 75 6d 62 | t.is.a.pair.consisting.of.a.numb |
| a5020 | 65 72 20 28 74 68 65 20 74 69 6d 65 29 20 61 6e 64 20 61 20 71 75 65 75 65 20 28 73 65 65 20 2a | er.(the.time).and.a.queue.(see.* |
| a5040 | 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 33 2d 33 32 3a 3a 29 20 74 68 61 74 20 68 6f 6c 64 73 | Note.Exercise.3-32::).that.holds |
| a5060 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 61 72 65 20 73 63 68 65 64 75 6c | .the.procedures.that.are.schedul |
| a5080 | 65 64 20 74 6f 20 62 65 20 72 75 6e 20 64 75 72 69 6e 67 0a 74 68 61 74 20 74 69 6d 65 20 73 65 | ed.to.be.run.during.that.time.se |
| a50a0 | 67 6d 65 6e 74 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 74 69 6d 65 2d | gment........(define.(make-time- |
| a50c0 | 73 65 67 6d 65 6e 74 20 74 69 6d 65 20 71 75 65 75 65 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 | segment.time.queue)........(cons |
| a50e0 | 20 74 69 6d 65 20 71 75 65 75 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 67 | .time.queue)).......(define.(seg |
| a5100 | 6d 65 6e 74 2d 74 69 6d 65 20 73 29 20 28 63 61 72 20 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 | ment-time.s).(car.s)).......(def |
| a5120 | 69 6e 65 20 28 73 65 67 6d 65 6e 74 2d 71 75 65 75 65 20 73 29 20 28 63 64 72 20 73 29 29 0a 0a | ine.(segment-queue.s).(cdr.s)).. |
| a5140 | 20 20 20 57 65 20 77 69 6c 6c 20 6f 70 65 72 61 74 65 20 6f 6e 20 74 68 65 20 74 69 6d 65 2d 73 | ...We.will.operate.on.the.time-s |
| a5160 | 65 67 6d 65 6e 74 20 71 75 65 75 65 73 20 75 73 69 6e 67 20 74 68 65 20 71 75 65 75 65 0a 6f 70 | egment.queues.using.the.queue.op |
| a5180 | 65 72 61 74 69 6f 6e 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e | erations.described.in.section.*N |
| a51a0 | 6f 74 65 20 33 2d 33 2d 32 3a 3a 2e 0a 0a 20 20 20 54 68 65 20 61 67 65 6e 64 61 20 69 74 73 65 | ote.3-3-2::......The.agenda.itse |
| a51c0 | 6c 66 20 69 73 20 61 20 6f 6e 65 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 74 61 62 6c 65 20 6f 66 | lf.is.a.one-dimensional.table.of |
| a51e0 | 20 74 69 6d 65 20 73 65 67 6d 65 6e 74 73 2e 20 20 49 74 0a 64 69 66 66 65 72 73 20 66 72 6f 6d | .time.segments...It.differs.from |
| a5200 | 20 74 68 65 20 74 61 62 6c 65 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e | .the.tables.described.in.section |
| a5220 | 20 2a 4e 6f 74 65 20 33 2d 33 2d 33 3a 3a 20 69 6e 20 74 68 61 74 20 74 68 65 0a 73 65 67 6d 65 | .*Note.3-3-3::.in.that.the.segme |
| a5240 | 6e 74 73 20 77 69 6c 6c 20 62 65 20 73 6f 72 74 65 64 20 69 6e 20 6f 72 64 65 72 20 6f 66 20 69 | nts.will.be.sorted.in.order.of.i |
| a5260 | 6e 63 72 65 61 73 69 6e 67 20 74 69 6d 65 2e 20 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 77 65 | ncreasing.time...In.addition,.we |
| a5280 | 0a 73 74 6f 72 65 20 74 68 65 20 22 63 75 72 72 65 6e 74 20 74 69 6d 65 22 20 28 69 2e 65 2e 2c | .store.the."current.time".(i.e., |
| a52a0 | 20 74 68 65 20 74 69 6d 65 20 6f 66 20 74 68 65 20 6c 61 73 74 20 61 63 74 69 6f 6e 20 74 68 61 | .the.time.of.the.last.action.tha |
| a52c0 | 74 20 77 61 73 0a 70 72 6f 63 65 73 73 65 64 29 20 61 74 20 74 68 65 20 68 65 61 64 20 6f 66 20 | t.was.processed).at.the.head.of. |
| a52e0 | 74 68 65 20 61 67 65 6e 64 61 2e 20 20 41 20 6e 65 77 6c 79 20 63 6f 6e 73 74 72 75 63 74 65 64 | the.agenda...A.newly.constructed |
| a5300 | 20 61 67 65 6e 64 61 20 68 61 73 0a 6e 6f 20 74 69 6d 65 20 73 65 67 6d 65 6e 74 73 20 61 6e 64 | .agenda.has.no.time.segments.and |
| a5320 | 20 68 61 73 20 61 20 63 75 72 72 65 6e 74 20 74 69 6d 65 20 6f 66 20 30 3a 28 33 29 0a 0a 20 20 | .has.a.current.time.of.0:(3).... |
| a5340 | 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 61 67 65 6e 64 61 29 20 28 6c 69 73 74 20 30 | ...(define.(make-agenda).(list.0 |
| a5360 | 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 75 72 72 65 6e 74 2d 74 69 6d 65 20 61 | )).......(define.(current-time.a |
| a5380 | 67 65 6e 64 61 29 20 28 63 61 72 20 61 67 65 6e 64 61 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 | genda).(car.agenda)).......(defi |
| a53a0 | 6e 65 20 28 73 65 74 2d 63 75 72 72 65 6e 74 2d 74 69 6d 65 21 20 61 67 65 6e 64 61 20 74 69 6d | ne.(set-current-time!.agenda.tim |
| a53c0 | 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 2d 63 61 72 21 20 61 67 65 6e 64 61 20 74 69 6d 65 29 | e)........(set-car!.agenda.time) |
| a53e0 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 67 6d 65 6e 74 73 20 61 67 65 6e 64 61 | ).......(define.(segments.agenda |
| a5400 | 29 20 28 63 64 72 20 61 67 65 6e 64 61 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 | ).(cdr.agenda)).......(define.(s |
| a5420 | 65 74 2d 73 65 67 6d 65 6e 74 73 21 20 61 67 65 6e 64 61 20 73 65 67 6d 65 6e 74 73 29 0a 20 20 | et-segments!.agenda.segments)... |
| a5440 | 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 20 61 67 65 6e 64 61 20 73 65 67 6d 65 6e 74 73 29 29 | .....(set-cdr!.agenda.segments)) |
| a5460 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 72 73 74 2d 73 65 67 6d 65 6e 74 20 61 67 | .......(define.(first-segment.ag |
| a5480 | 65 6e 64 61 29 20 28 63 61 72 20 28 73 65 67 6d 65 6e 74 73 20 61 67 65 6e 64 61 29 29 29 0a 0a | enda).(car.(segments.agenda))).. |
| a54a0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 73 74 2d 73 65 67 6d 65 6e 74 73 20 61 67 65 6e | .....(define.(rest-segments.agen |
| a54c0 | 64 61 29 20 28 63 64 72 20 28 73 65 67 6d 65 6e 74 73 20 61 67 65 6e 64 61 29 29 29 0a 0a 20 20 | da).(cdr.(segments.agenda))).... |
| a54e0 | 20 41 6e 20 61 67 65 6e 64 61 20 69 73 20 65 6d 70 74 79 20 69 66 20 69 74 20 68 61 73 20 6e 6f | .An.agenda.is.empty.if.it.has.no |
| a5500 | 20 74 69 6d 65 20 73 65 67 6d 65 6e 74 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 | .time.segments:.......(define.(e |
| a5520 | 6d 70 74 79 2d 61 67 65 6e 64 61 3f 20 61 67 65 6e 64 61 29 0a 20 20 20 20 20 20 20 28 6e 75 6c | mpty-agenda?.agenda)........(nul |
| a5540 | 6c 3f 20 28 73 65 67 6d 65 6e 74 73 20 61 67 65 6e 64 61 29 29 29 0a 0a 20 20 20 54 6f 20 61 64 | l?.(segments.agenda))).....To.ad |
| a5560 | 64 20 61 6e 20 61 63 74 69 6f 6e 20 74 6f 20 61 6e 20 61 67 65 6e 64 61 2c 20 77 65 20 66 69 72 | d.an.action.to.an.agenda,.we.fir |
| a5580 | 73 74 20 63 68 65 63 6b 20 69 66 20 74 68 65 20 61 67 65 6e 64 61 20 69 73 0a 65 6d 70 74 79 2e | st.check.if.the.agenda.is.empty. |
| a55a0 | 20 20 49 66 20 73 6f 2c 20 77 65 20 63 72 65 61 74 65 20 61 20 74 69 6d 65 20 73 65 67 6d 65 6e | ..If.so,.we.create.a.time.segmen |
| a55c0 | 74 20 66 6f 72 20 74 68 65 20 61 63 74 69 6f 6e 20 61 6e 64 20 69 6e 73 74 61 6c 6c 20 74 68 69 | t.for.the.action.and.install.thi |
| a55e0 | 73 0a 69 6e 20 74 68 65 20 61 67 65 6e 64 61 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 77 65 20 | s.in.the.agenda...Otherwise,.we. |
| a5600 | 73 63 61 6e 20 74 68 65 20 61 67 65 6e 64 61 2c 20 65 78 61 6d 69 6e 69 6e 67 20 74 68 65 20 74 | scan.the.agenda,.examining.the.t |
| a5620 | 69 6d 65 20 6f 66 0a 65 61 63 68 20 73 65 67 6d 65 6e 74 2e 20 20 49 66 20 77 65 20 66 69 6e 64 | ime.of.each.segment...If.we.find |
| a5640 | 20 61 20 73 65 67 6d 65 6e 74 20 66 6f 72 20 6f 75 72 20 61 70 70 6f 69 6e 74 65 64 20 74 69 6d | .a.segment.for.our.appointed.tim |
| a5660 | 65 2c 20 77 65 20 61 64 64 20 74 68 65 0a 61 63 74 69 6f 6e 20 74 6f 20 74 68 65 20 61 73 73 6f | e,.we.add.the.action.to.the.asso |
| a5680 | 63 69 61 74 65 64 20 71 75 65 75 65 2e 20 20 49 66 20 77 65 20 72 65 61 63 68 20 61 20 74 69 6d | ciated.queue...If.we.reach.a.tim |
| a56a0 | 65 20 6c 61 74 65 72 20 74 68 61 6e 20 74 68 65 20 6f 6e 65 0a 74 6f 20 77 68 69 63 68 20 77 65 | e.later.than.the.one.to.which.we |
| a56c0 | 20 61 72 65 20 61 70 70 6f 69 6e 74 65 64 2c 20 77 65 20 69 6e 73 65 72 74 20 61 20 6e 65 77 20 | .are.appointed,.we.insert.a.new. |
| a56e0 | 74 69 6d 65 20 73 65 67 6d 65 6e 74 20 69 6e 74 6f 20 74 68 65 20 61 67 65 6e 64 61 0a 6a 75 73 | time.segment.into.the.agenda.jus |
| a5700 | 74 20 62 65 66 6f 72 65 20 69 74 2e 20 20 49 66 20 77 65 20 72 65 61 63 68 20 74 68 65 20 65 6e | t.before.it...If.we.reach.the.en |
| a5720 | 64 20 6f 66 20 74 68 65 20 61 67 65 6e 64 61 2c 20 77 65 20 6d 75 73 74 20 63 72 65 61 74 65 20 | d.of.the.agenda,.we.must.create. |
| a5740 | 61 0a 6e 65 77 20 74 69 6d 65 20 73 65 67 6d 65 6e 74 20 61 74 20 74 68 65 20 65 6e 64 2e 0a 0a | a.new.time.segment.at.the.end... |
| a5760 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 74 6f 2d 61 67 65 6e 64 61 21 20 74 69 6d | .....(define.(add-to-agenda!.tim |
| a5780 | 65 20 61 63 74 69 6f 6e 20 61 67 65 6e 64 61 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | e.action.agenda)........(define. |
| a57a0 | 28 62 65 6c 6f 6e 67 73 2d 62 65 66 6f 72 65 3f 20 73 65 67 6d 65 6e 74 73 29 0a 20 20 20 20 20 | (belongs-before?.segments)...... |
| a57c0 | 20 20 20 20 28 6f 72 20 28 6e 75 6c 6c 3f 20 73 65 67 6d 65 6e 74 73 29 0a 20 20 20 20 20 20 20 | ....(or.(null?.segments)........ |
| a57e0 | 20 20 20 20 20 20 28 3c 20 74 69 6d 65 20 28 73 65 67 6d 65 6e 74 2d 74 69 6d 65 20 28 63 61 72 | ......(<.time.(segment-time.(car |
| a5800 | 20 73 65 67 6d 65 6e 74 73 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d | .segments)))))........(define.(m |
| a5820 | 61 6b 65 2d 6e 65 77 2d 74 69 6d 65 2d 73 65 67 6d 65 6e 74 20 74 69 6d 65 20 61 63 74 69 6f 6e | ake-new-time-segment.time.action |
| a5840 | 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 71 20 28 6d 61 6b 65 2d 71 75 65 75 65 29 | )..........(let.((q.(make-queue) |
| a5860 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 6e 73 65 72 74 2d 71 75 65 75 65 21 20 71 20 61 | ))............(insert-queue!.q.a |
| a5880 | 63 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 74 69 6d 65 2d 73 65 67 | ction)............(make-time-seg |
| a58a0 | 6d 65 6e 74 20 74 69 6d 65 20 71 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 | ment.time.q)))........(define.(a |
| a58c0 | 64 64 2d 74 6f 2d 73 65 67 6d 65 6e 74 73 21 20 73 65 67 6d 65 6e 74 73 29 0a 20 20 20 20 20 20 | dd-to-segments!.segments)....... |
| a58e0 | 20 20 20 28 69 66 20 28 3d 20 28 73 65 67 6d 65 6e 74 2d 74 69 6d 65 20 28 63 61 72 20 73 65 67 | ...(if.(=.(segment-time.(car.seg |
| a5900 | 6d 65 6e 74 73 29 29 20 74 69 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 6e 73 65 | ments)).time)..............(inse |
| a5920 | 72 74 2d 71 75 65 75 65 21 20 28 73 65 67 6d 65 6e 74 2d 71 75 65 75 65 20 28 63 61 72 20 73 65 | rt-queue!.(segment-queue.(car.se |
| a5940 | 67 6d 65 6e 74 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | gments))........................ |
| a5960 | 20 20 20 20 20 61 63 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 | .....action)..............(let.( |
| a5980 | 28 72 65 73 74 20 28 63 64 72 20 73 65 67 6d 65 6e 74 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 | (rest.(cdr.segments))).......... |
| a59a0 | 20 20 20 20 20 20 28 69 66 20 28 62 65 6c 6f 6e 67 73 2d 62 65 66 6f 72 65 3f 20 72 65 73 74 29 | ......(if.(belongs-before?.rest) |
| a59c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 0a 20 20 | ....................(set-cdr!... |
| a59e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 67 6d 65 6e 74 73 0a 20 20 20 20 20 | ..................segments...... |
| a5a00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 6d 61 6b 65 2d 6e 65 77 2d 74 | ...............(cons.(make-new-t |
| a5a20 | 69 6d 65 2d 73 65 67 6d 65 6e 74 20 74 69 6d 65 20 61 63 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 | ime-segment.time.action)........ |
| a5a40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 73 65 67 6d 65 6e 74 73 | ...................(cdr.segments |
| a5a60 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 74 6f 2d 73 | )))....................(add-to-s |
| a5a80 | 65 67 6d 65 6e 74 73 21 20 72 65 73 74 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 | egments!.rest)))))........(let.( |
| a5aa0 | 28 73 65 67 6d 65 6e 74 73 20 28 73 65 67 6d 65 6e 74 73 20 61 67 65 6e 64 61 29 29 29 0a 20 20 | (segments.(segments.agenda)))... |
| a5ac0 | 20 20 20 20 20 20 20 28 69 66 20 28 62 65 6c 6f 6e 67 73 2d 62 65 66 6f 72 65 3f 20 73 65 67 6d | .......(if.(belongs-before?.segm |
| a5ae0 | 65 6e 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 73 65 67 6d 65 6e 74 73 | ents)..............(set-segments |
| a5b00 | 21 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 67 65 6e 64 61 0a 20 20 20 20 20 20 20 20 20 | !...............agenda.......... |
| a5b20 | 20 20 20 20 20 28 63 6f 6e 73 20 28 6d 61 6b 65 2d 6e 65 77 2d 74 69 6d 65 2d 73 65 67 6d 65 6e | .....(cons.(make-new-time-segmen |
| a5b40 | 74 20 74 69 6d 65 20 61 63 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | t.time.action).................. |
| a5b60 | 20 20 20 73 65 67 6d 65 6e 74 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 2d | ...segments))..............(add- |
| a5b80 | 74 6f 2d 73 65 67 6d 65 6e 74 73 21 20 73 65 67 6d 65 6e 74 73 29 29 29 29 0a 0a 20 20 20 54 68 | to-segments!.segments)))).....Th |
| a5ba0 | 65 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 72 65 6d 6f 76 65 73 20 74 68 65 20 66 69 72 | e.procedure.that.removes.the.fir |
| a5bc0 | 73 74 20 69 74 65 6d 20 66 72 6f 6d 20 74 68 65 20 61 67 65 6e 64 61 20 64 65 6c 65 74 65 73 0a | st.item.from.the.agenda.deletes. |
| a5be0 | 74 68 65 20 69 74 65 6d 20 61 74 20 74 68 65 20 66 72 6f 6e 74 20 6f 66 20 74 68 65 20 71 75 65 | the.item.at.the.front.of.the.que |
| a5c00 | 75 65 20 69 6e 20 74 68 65 20 66 69 72 73 74 20 74 69 6d 65 20 73 65 67 6d 65 6e 74 2e 20 20 49 | ue.in.the.first.time.segment...I |
| a5c20 | 66 20 74 68 69 73 0a 64 65 6c 65 74 69 6f 6e 20 6d 61 6b 65 73 20 74 68 65 20 74 69 6d 65 20 73 | f.this.deletion.makes.the.time.s |
| a5c40 | 65 67 6d 65 6e 74 20 65 6d 70 74 79 2c 20 77 65 20 72 65 6d 6f 76 65 20 69 74 20 66 72 6f 6d 20 | egment.empty,.we.remove.it.from. |
| a5c60 | 74 68 65 20 6c 69 73 74 20 6f 66 0a 73 65 67 6d 65 6e 74 73 3a 28 34 29 0a 0a 20 20 20 20 20 28 | the.list.of.segments:(4).......( |
| a5c80 | 64 65 66 69 6e 65 20 28 72 65 6d 6f 76 65 2d 66 69 72 73 74 2d 61 67 65 6e 64 61 2d 69 74 65 6d | define.(remove-first-agenda-item |
| a5ca0 | 21 20 61 67 65 6e 64 61 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 71 20 28 73 65 67 6d 65 | !.agenda)........(let.((q.(segme |
| a5cc0 | 6e 74 2d 71 75 65 75 65 20 28 66 69 72 73 74 2d 73 65 67 6d 65 6e 74 20 61 67 65 6e 64 61 29 29 | nt-queue.(first-segment.agenda)) |
| a5ce0 | 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 6c 65 74 65 2d 71 75 65 75 65 21 20 71 29 0a 20 20 | ))..........(delete-queue!.q)... |
| a5d00 | 20 20 20 20 20 20 20 28 69 66 20 28 65 6d 70 74 79 2d 71 75 65 75 65 3f 20 71 29 0a 20 20 20 20 | .......(if.(empty-queue?.q)..... |
| a5d20 | 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 73 65 67 6d 65 6e 74 73 21 20 61 67 65 6e 64 61 20 28 | .........(set-segments!.agenda.( |
| a5d40 | 72 65 73 74 2d 73 65 67 6d 65 6e 74 73 20 61 67 65 6e 64 61 29 29 29 29 29 0a 0a 20 20 20 54 68 | rest-segments.agenda))))).....Th |
| a5d60 | 65 20 66 69 72 73 74 20 61 67 65 6e 64 61 20 69 74 65 6d 20 69 73 20 66 6f 75 6e 64 20 61 74 20 | e.first.agenda.item.is.found.at. |
| a5d80 | 74 68 65 20 68 65 61 64 20 6f 66 20 74 68 65 20 71 75 65 75 65 20 69 6e 20 74 68 65 20 66 69 72 | the.head.of.the.queue.in.the.fir |
| a5da0 | 73 74 0a 74 69 6d 65 20 73 65 67 6d 65 6e 74 2e 20 20 57 68 65 6e 65 76 65 72 20 77 65 20 65 78 | st.time.segment...Whenever.we.ex |
| a5dc0 | 74 72 61 63 74 20 61 6e 20 69 74 65 6d 2c 20 77 65 20 61 6c 73 6f 20 75 70 64 61 74 65 20 74 68 | tract.an.item,.we.also.update.th |
| a5de0 | 65 20 63 75 72 72 65 6e 74 0a 74 69 6d 65 3a 28 35 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | e.current.time:(5).......(define |
| a5e00 | 20 28 66 69 72 73 74 2d 61 67 65 6e 64 61 2d 69 74 65 6d 20 61 67 65 6e 64 61 29 0a 20 20 20 20 | .(first-agenda-item.agenda)..... |
| a5e20 | 20 20 20 28 69 66 20 28 65 6d 70 74 79 2d 61 67 65 6e 64 61 3f 20 61 67 65 6e 64 61 29 0a 20 20 | ...(if.(empty-agenda?.agenda)... |
| a5e40 | 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 41 67 65 6e 64 61 20 69 73 20 65 6d 70 74 79 | .........(error."Agenda.is.empty |
| a5e60 | 20 2d 2d 20 46 49 52 53 54 2d 41 47 45 4e 44 41 2d 49 54 45 4d 22 29 0a 20 20 20 20 20 20 20 20 | .--.FIRST-AGENDA-ITEM")......... |
| a5e80 | 20 20 20 28 6c 65 74 20 28 28 66 69 72 73 74 2d 73 65 67 20 28 66 69 72 73 74 2d 73 65 67 6d 65 | ...(let.((first-seg.(first-segme |
| a5ea0 | 6e 74 20 61 67 65 6e 64 61 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 | nt.agenda)))..............(set-c |
| a5ec0 | 75 72 72 65 6e 74 2d 74 69 6d 65 21 20 61 67 65 6e 64 61 20 28 73 65 67 6d 65 6e 74 2d 74 69 6d | urrent-time!.agenda.(segment-tim |
| a5ee0 | 65 20 66 69 72 73 74 2d 73 65 67 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 72 6f 6e | e.first-seg))..............(fron |
| a5f00 | 74 2d 71 75 65 75 65 20 28 73 65 67 6d 65 6e 74 2d 71 75 65 75 65 20 66 69 72 73 74 2d 73 65 67 | t-queue.(segment-queue.first-seg |
| a5f20 | 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 33 32 3a 2a 20 54 68 65 | ))))).......*Exercise.3.32:*.The |
| a5f40 | 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 62 65 20 72 75 6e 20 64 75 72 69 6e 67 20 65 61 63 | .procedures.to.be.run.during.eac |
| a5f60 | 68 20 74 69 6d 65 20 73 65 67 6d 65 6e 74 0a 20 20 20 20 20 6f 66 20 74 68 65 20 61 67 65 6e 64 | h.time.segment......of.the.agend |
| a5f80 | 61 20 61 72 65 20 6b 65 70 74 20 69 6e 20 61 20 71 75 65 75 65 2e 20 20 54 68 75 73 2c 20 74 68 | a.are.kept.in.a.queue...Thus,.th |
| a5fa0 | 65 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 65 61 63 68 0a 20 20 20 20 20 73 65 67 6d 65 | e.procedures.for.each......segme |
| a5fc0 | 6e 74 20 61 72 65 20 63 61 6c 6c 65 64 20 69 6e 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 | nt.are.called.in.the.order.in.wh |
| a5fe0 | 69 63 68 20 74 68 65 79 20 77 65 72 65 20 61 64 64 65 64 20 74 6f 20 74 68 65 0a 20 20 20 20 20 | ich.they.were.added.to.the...... |
| a6000 | 61 67 65 6e 64 61 20 28 66 69 72 73 74 20 69 6e 2c 20 66 69 72 73 74 20 6f 75 74 29 2e 20 20 45 | agenda.(first.in,.first.out)...E |
| a6020 | 78 70 6c 61 69 6e 20 77 68 79 20 74 68 69 73 20 6f 72 64 65 72 20 6d 75 73 74 20 62 65 0a 20 20 | xplain.why.this.order.must.be... |
| a6040 | 20 20 20 75 73 65 64 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 74 72 61 63 65 20 74 | ...used...In.particular,.trace.t |
| a6060 | 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 61 6e 20 61 6e 64 2d 67 61 74 65 20 77 68 6f 73 65 | he.behavior.of.an.and-gate.whose |
| a6080 | 0a 20 20 20 20 20 69 6e 70 75 74 73 20 63 68 61 6e 67 65 20 66 72 6f 6d 20 30 2c 31 20 74 6f 20 | ......inputs.change.from.0,1.to. |
| a60a0 | 31 2c 30 20 69 6e 20 74 68 65 20 73 61 6d 65 20 73 65 67 6d 65 6e 74 20 61 6e 64 20 73 61 79 20 | 1,0.in.the.same.segment.and.say. |
| a60c0 | 68 6f 77 20 74 68 65 0a 20 20 20 20 20 62 65 68 61 76 69 6f 72 20 77 6f 75 6c 64 20 64 69 66 66 | how.the......behavior.would.diff |
| a60e0 | 65 72 20 69 66 20 77 65 20 73 74 6f 72 65 64 20 61 20 73 65 67 6d 65 6e 74 27 73 20 70 72 6f 63 | er.if.we.stored.a.segment's.proc |
| a6100 | 65 64 75 72 65 73 20 69 6e 20 61 6e 0a 20 20 20 20 20 6f 72 64 69 6e 61 72 79 20 6c 69 73 74 2c | edures.in.an......ordinary.list, |
| a6120 | 20 61 64 64 69 6e 67 20 61 6e 64 20 72 65 6d 6f 76 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 | .adding.and.removing.procedures. |
| a6140 | 6f 6e 6c 79 20 61 74 20 74 68 65 20 66 72 6f 6e 74 0a 20 20 20 20 20 28 6c 61 73 74 20 69 6e 2c | only.at.the.front......(last.in, |
| a6160 | 20 66 69 72 73 74 20 6f 75 74 29 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 | .first.out)......----------.Foot |
| a6180 | 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 41 20 66 75 6c 6c 2d | notes.----------.....(1).A.full- |
| a61a0 | 61 64 64 65 72 20 69 73 20 61 20 62 61 73 69 63 20 63 69 72 63 75 69 74 20 65 6c 65 6d 65 6e 74 | adder.is.a.basic.circuit.element |
| a61c0 | 20 75 73 65 64 20 69 6e 20 61 64 64 69 6e 67 20 74 77 6f 0a 62 69 6e 61 72 79 20 6e 75 6d 62 65 | .used.in.adding.two.binary.numbe |
| a61e0 | 72 73 2e 20 20 48 65 72 65 20 41 20 61 6e 64 20 42 20 61 72 65 20 74 68 65 20 62 69 74 73 20 61 | rs...Here.A.and.B.are.the.bits.a |
| a6200 | 74 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 70 6f 73 69 74 69 6f 6e 73 20 69 6e 0a 74 68 65 | t.corresponding.positions.in.the |
| a6220 | 20 74 77 6f 20 6e 75 6d 62 65 72 73 20 74 6f 20 62 65 20 61 64 64 65 64 2c 20 61 6e 64 20 43 5f | .two.numbers.to.be.added,.and.C_ |
| a6240 | 28 69 6e 29 20 69 73 20 74 68 65 20 63 61 72 72 79 20 62 69 74 20 66 72 6f 6d 20 74 68 65 0a 61 | (in).is.the.carry.bit.from.the.a |
| a6260 | 64 64 69 74 69 6f 6e 20 6f 6e 65 20 70 6c 61 63 65 20 74 6f 20 74 68 65 20 72 69 67 68 74 2e 20 | ddition.one.place.to.the.right.. |
| a6280 | 20 54 68 65 20 63 69 72 63 75 69 74 20 67 65 6e 65 72 61 74 65 73 20 53 55 4d 2c 20 77 68 69 63 | .The.circuit.generates.SUM,.whic |
| a62a0 | 68 20 69 73 0a 74 68 65 20 73 75 6d 20 62 69 74 20 69 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f | h.is.the.sum.bit.in.the.correspo |
| a62c0 | 6e 64 69 6e 67 20 70 6f 73 69 74 69 6f 6e 2c 20 61 6e 64 20 43 5f 28 6f 75 74 29 2c 20 77 68 69 | nding.position,.and.C_(out),.whi |
| a62e0 | 63 68 20 69 73 20 74 68 65 0a 63 61 72 72 79 20 62 69 74 20 74 6f 20 62 65 20 70 72 6f 70 61 67 | ch.is.the.carry.bit.to.be.propag |
| a6300 | 61 74 65 64 20 74 6f 20 74 68 65 20 6c 65 66 74 2e 0a 0a 20 20 20 28 32 29 20 5b 46 6f 6f 74 6e | ated.to.the.left......(2).[Footn |
| a6320 | 6f 74 65 20 32 37 5d 20 54 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 73 69 6d | ote.27].These.procedures.are.sim |
| a6340 | 70 6c 79 20 73 79 6e 74 61 63 74 69 63 20 73 75 67 61 72 20 74 68 61 74 0a 61 6c 6c 6f 77 20 75 | ply.syntactic.sugar.that.allow.u |
| a6360 | 73 20 74 6f 20 75 73 65 20 6f 72 64 69 6e 61 72 79 20 70 72 6f 63 65 64 75 72 61 6c 20 73 79 6e | s.to.use.ordinary.procedural.syn |
| a6380 | 74 61 78 20 74 6f 20 61 63 63 65 73 73 20 74 68 65 20 6c 6f 63 61 6c 0a 70 72 6f 63 65 64 75 72 | tax.to.access.the.local.procedur |
| a63a0 | 65 73 20 6f 66 20 6f 62 6a 65 63 74 73 2e 20 20 49 74 20 69 73 20 73 74 72 69 6b 69 6e 67 20 74 | es.of.objects...It.is.striking.t |
| a63c0 | 68 61 74 20 77 65 20 63 61 6e 20 69 6e 74 65 72 63 68 61 6e 67 65 20 74 68 65 20 72 6f 6c 65 0a | hat.we.can.interchange.the.role. |
| a63e0 | 6f 66 20 22 70 72 6f 63 65 64 75 72 65 73 22 20 61 6e 64 20 22 64 61 74 61 22 20 69 6e 20 73 75 | of."procedures".and."data".in.su |
| a6400 | 63 68 20 61 20 73 69 6d 70 6c 65 20 77 61 79 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 | ch.a.simple.way...For.example,.i |
| a6420 | 66 20 77 65 0a 77 72 69 74 65 20 60 28 77 69 72 65 20 27 67 65 74 2d 73 69 67 6e 61 6c 29 27 20 | f.we.write.`(wire.'get-signal)'. |
| a6440 | 77 65 20 74 68 69 6e 6b 20 6f 66 20 60 77 69 72 65 27 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 | we.think.of.`wire'.as.a.procedur |
| a6460 | 65 20 74 68 61 74 20 69 73 0a 63 61 6c 6c 65 64 20 77 69 74 68 20 74 68 65 20 6d 65 73 73 61 67 | e.that.is.called.with.the.messag |
| a6480 | 65 20 60 67 65 74 2d 73 69 67 6e 61 6c 27 20 61 73 20 69 6e 70 75 74 2e 20 20 41 6c 74 65 72 6e | e.`get-signal'.as.input...Altern |
| a64a0 | 61 74 69 76 65 6c 79 2c 20 77 72 69 74 69 6e 67 0a 60 28 67 65 74 2d 73 69 67 6e 61 6c 20 77 69 | atively,.writing.`(get-signal.wi |
| a64c0 | 72 65 29 27 20 65 6e 63 6f 75 72 61 67 65 73 20 75 73 20 74 6f 20 74 68 69 6e 6b 20 6f 66 20 60 | re)'.encourages.us.to.think.of.` |
| a64e0 | 77 69 72 65 27 20 61 73 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 0a 74 68 61 74 20 69 73 20 74 | wire'.as.a.data.object.that.is.t |
| a6500 | 68 65 20 69 6e 70 75 74 20 74 6f 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 67 65 74 2d 73 69 67 | he.input.to.a.procedure.`get-sig |
| a6520 | 6e 61 6c 27 2e 20 20 54 68 65 20 74 72 75 74 68 20 6f 66 20 74 68 65 20 6d 61 74 74 65 72 0a 69 | nal'...The.truth.of.the.matter.i |
| a6540 | 73 20 74 68 61 74 2c 20 69 6e 20 61 20 6c 61 6e 67 75 61 67 65 20 69 6e 20 77 68 69 63 68 20 77 | s.that,.in.a.language.in.which.w |
| a6560 | 65 20 63 61 6e 20 64 65 61 6c 20 77 69 74 68 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 6f 62 | e.can.deal.with.procedures.as.ob |
| a6580 | 6a 65 63 74 73 2c 0a 74 68 65 72 65 20 69 73 20 6e 6f 20 66 75 6e 64 61 6d 65 6e 74 61 6c 20 64 | jects,.there.is.no.fundamental.d |
| a65a0 | 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 22 70 72 6f 63 65 64 75 72 65 73 22 20 61 | ifference.between."procedures".a |
| a65c0 | 6e 64 20 22 64 61 74 61 2c 22 20 61 6e 64 0a 77 65 20 63 61 6e 20 63 68 6f 6f 73 65 20 6f 75 72 | nd."data,".and.we.can.choose.our |
| a65e0 | 20 73 79 6e 74 61 63 74 69 63 20 73 75 67 61 72 20 74 6f 20 61 6c 6c 6f 77 20 75 73 20 74 6f 20 | .syntactic.sugar.to.allow.us.to. |
| a6600 | 70 72 6f 67 72 61 6d 20 69 6e 20 77 68 61 74 65 76 65 72 0a 73 74 79 6c 65 20 77 65 20 63 68 6f | program.in.whatever.style.we.cho |
| a6620 | 6f 73 65 2e 0a 0a 20 20 20 28 33 29 20 54 68 65 20 61 67 65 6e 64 61 20 69 73 20 61 20 68 65 61 | ose......(3).The.agenda.is.a.hea |
| a6640 | 64 65 64 20 6c 69 73 74 2c 20 6c 69 6b 65 20 74 68 65 20 74 61 62 6c 65 73 20 69 6e 20 73 65 63 | ded.list,.like.the.tables.in.sec |
| a6660 | 74 69 6f 6e 20 2a 4e 6f 74 65 0a 33 2d 33 2d 33 3a 3a 2c 20 62 75 74 20 73 69 6e 63 65 20 74 68 | tion.*Note.3-3-3::,.but.since.th |
| a6680 | 65 20 6c 69 73 74 20 69 73 20 68 65 61 64 65 64 20 62 79 20 74 68 65 20 74 69 6d 65 2c 20 77 65 | e.list.is.headed.by.the.time,.we |
| a66a0 | 20 64 6f 20 6e 6f 74 20 6e 65 65 64 20 61 6e 0a 61 64 64 69 74 69 6f 6e 61 6c 20 64 75 6d 6d 79 | .do.not.need.an.additional.dummy |
| a66c0 | 20 68 65 61 64 65 72 20 28 73 75 63 68 20 61 73 20 74 68 65 20 60 2a 74 61 62 6c 65 2a 27 20 73 | .header.(such.as.the.`*table*'.s |
| a66e0 | 79 6d 62 6f 6c 20 75 73 65 64 20 77 69 74 68 20 74 61 62 6c 65 73 29 2e 0a 0a 20 20 20 28 34 29 | ymbol.used.with.tables)......(4) |
| a6700 | 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 74 68 65 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f | .Observe.that.the.`if'.expressio |
| a6720 | 6e 20 69 6e 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 68 61 73 20 6e 6f 0a 3c 41 4c 54 45 | n.in.this.procedure.has.no.<ALTE |
| a6740 | 52 4e 41 54 49 56 45 3e 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 53 75 63 68 20 61 20 22 6f 6e | RNATIVE>.expression...Such.a."on |
| a6760 | 65 2d 61 72 6d 65 64 20 60 69 66 27 20 73 74 61 74 65 6d 65 6e 74 22 20 69 73 20 75 73 65 64 20 | e-armed.`if'.statement".is.used. |
| a6780 | 74 6f 0a 64 65 63 69 64 65 20 77 68 65 74 68 65 72 20 74 6f 20 64 6f 20 73 6f 6d 65 74 68 69 6e | to.decide.whether.to.do.somethin |
| a67a0 | 67 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 6f 20 73 65 6c 65 63 74 20 62 65 74 77 65 65 6e | g,.rather.than.to.select.between |
| a67c0 | 20 74 77 6f 0a 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 41 6e 20 60 69 66 27 20 65 78 70 72 65 | .two.expressions...An.`if'.expre |
| a67e0 | 73 73 69 6f 6e 20 72 65 74 75 72 6e 73 20 61 6e 20 75 6e 73 70 65 63 69 66 69 65 64 20 76 61 6c | ssion.returns.an.unspecified.val |
| a6800 | 75 65 20 69 66 20 74 68 65 0a 70 72 65 64 69 63 61 74 65 20 69 73 20 66 61 6c 73 65 20 61 6e 64 | ue.if.the.predicate.is.false.and |
| a6820 | 20 74 68 65 72 65 20 69 73 20 6e 6f 20 3c 41 4c 54 45 52 4e 41 54 49 56 45 3e 2e 0a 0a 20 20 20 | .there.is.no.<ALTERNATIVE>...... |
| a6840 | 28 35 29 20 49 6e 20 74 68 69 73 20 77 61 79 2c 20 74 68 65 20 63 75 72 72 65 6e 74 20 74 69 6d | (5).In.this.way,.the.current.tim |
| a6860 | 65 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 74 68 65 20 74 69 6d 65 20 6f 66 20 74 68 65 | e.will.always.be.the.time.of.the |
| a6880 | 0a 61 63 74 69 6f 6e 20 6d 6f 73 74 20 72 65 63 65 6e 74 6c 79 20 70 72 6f 63 65 73 73 65 64 2e | .action.most.recently.processed. |
| a68a0 | 20 20 53 74 6f 72 69 6e 67 20 74 68 69 73 20 74 69 6d 65 20 61 74 20 74 68 65 20 68 65 61 64 20 | ..Storing.this.time.at.the.head. |
| a68c0 | 6f 66 20 74 68 65 0a 61 67 65 6e 64 61 20 65 6e 73 75 72 65 73 20 74 68 61 74 20 69 74 20 77 69 | of.the.agenda.ensures.that.it.wi |
| a68e0 | 6c 6c 20 73 74 69 6c 6c 20 62 65 20 61 76 61 69 6c 61 62 6c 65 20 65 76 65 6e 20 69 66 20 74 68 | ll.still.be.available.even.if.th |
| a6900 | 65 20 61 73 73 6f 63 69 61 74 65 64 0a 74 69 6d 65 20 73 65 67 6d 65 6e 74 20 68 61 73 20 62 65 | e.associated.time.segment.has.be |
| a6920 | 65 6e 20 64 65 6c 65 74 65 64 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 | en.deleted.....File:.sicp.info,. |
| a6940 | 20 4e 6f 64 65 3a 20 33 2d 33 2d 35 2c 20 20 50 72 65 76 3a 20 33 2d 33 2d 34 2c 20 20 55 70 3a | .Node:.3-3-5,..Prev:.3-3-4,..Up: |
| a6960 | 20 33 2d 33 0a 0a 33 2e 33 2e 35 20 50 72 6f 70 61 67 61 74 69 6f 6e 20 6f 66 20 43 6f 6e 73 74 | .3-3..3.3.5.Propagation.of.Const |
| a6980 | 72 61 69 6e 74 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | raints.------------------------- |
| a69a0 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 43 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 73 20 61 72 65 20 74 | -------..Computer.programs.are.t |
| a69c0 | 72 61 64 69 74 69 6f 6e 61 6c 6c 79 20 6f 72 67 61 6e 69 7a 65 64 20 61 73 20 6f 6e 65 2d 64 69 | raditionally.organized.as.one-di |
| a69e0 | 72 65 63 74 69 6f 6e 61 6c 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 73 2c 20 77 68 69 63 68 20 70 65 | rectional.computations,.which.pe |
| a6a00 | 72 66 6f 72 6d 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 70 72 65 73 70 65 63 69 66 69 65 64 | rform.operations.on.prespecified |
| a6a20 | 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 0a 70 72 6f 64 75 63 65 20 64 65 73 69 72 65 64 20 6f 75 | .arguments.to.produce.desired.ou |
| a6a40 | 74 70 75 74 73 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 77 65 20 6f 66 | tputs...On.the.other.hand,.we.of |
| a6a60 | 74 65 6e 20 6d 6f 64 65 6c 20 73 79 73 74 65 6d 73 20 69 6e 0a 74 65 72 6d 73 20 6f 66 20 72 65 | ten.model.systems.in.terms.of.re |
| a6a80 | 6c 61 74 69 6f 6e 73 20 61 6d 6f 6e 67 20 71 75 61 6e 74 69 74 69 65 73 2e 20 20 46 6f 72 20 65 | lations.among.quantities...For.e |
| a6aa0 | 78 61 6d 70 6c 65 2c 20 61 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6d 6f 64 65 6c 0a 6f 66 20 | xample,.a.mathematical.model.of. |
| a6ac0 | 61 20 6d 65 63 68 61 6e 69 63 61 6c 20 73 74 72 75 63 74 75 72 65 20 6d 69 67 68 74 20 69 6e 63 | a.mechanical.structure.might.inc |
| a6ae0 | 6c 75 64 65 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 74 68 61 74 20 74 68 65 0a 64 65 | lude.the.information.that.the.de |
| a6b00 | 66 6c 65 63 74 69 6f 6e 20 64 20 6f 66 20 61 20 6d 65 74 61 6c 20 72 6f 64 20 69 73 20 72 65 6c | flection.d.of.a.metal.rod.is.rel |
| a6b20 | 61 74 65 64 20 74 6f 20 74 68 65 20 66 6f 72 63 65 20 66 20 6f 6e 20 74 68 65 20 72 6f 64 2c 20 | ated.to.the.force.f.on.the.rod,. |
| a6b40 | 74 68 65 0a 6c 65 6e 67 74 68 20 4c 20 6f 66 20 74 68 65 20 72 6f 64 2c 20 74 68 65 20 63 72 6f | the.length.L.of.the.rod,.the.cro |
| a6b60 | 73 73 2d 73 65 63 74 69 6f 6e 61 6c 20 61 72 65 61 20 41 2c 20 61 6e 64 20 74 68 65 20 65 6c 61 | ss-sectional.area.A,.and.the.ela |
| a6b80 | 73 74 69 63 0a 6d 6f 64 75 6c 75 73 20 45 20 76 69 61 20 74 68 65 20 65 71 75 61 74 69 6f 6e 0a | stic.modulus.E.via.the.equation. |
| a6ba0 | 0a 20 20 20 20 20 64 41 45 20 3d 20 46 4c 0a 0a 20 20 20 53 75 63 68 20 61 6e 20 65 71 75 61 74 | ......dAE.=.FL.....Such.an.equat |
| a6bc0 | 69 6f 6e 20 69 73 20 6e 6f 74 20 6f 6e 65 2d 64 69 72 65 63 74 69 6f 6e 61 6c 2e 20 20 47 69 76 | ion.is.not.one-directional...Giv |
| a6be0 | 65 6e 20 61 6e 79 20 66 6f 75 72 20 6f 66 20 74 68 65 0a 71 75 61 6e 74 69 74 69 65 73 2c 20 77 | en.any.four.of.the.quantities,.w |
| a6c00 | 65 20 63 61 6e 20 75 73 65 20 69 74 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 66 69 66 74 | e.can.use.it.to.compute.the.fift |
| a6c20 | 68 2e 20 20 59 65 74 20 74 72 61 6e 73 6c 61 74 69 6e 67 20 74 68 65 0a 65 71 75 61 74 69 6f 6e | h...Yet.translating.the.equation |
| a6c40 | 20 69 6e 74 6f 20 61 20 74 72 61 64 69 74 69 6f 6e 61 6c 20 63 6f 6d 70 75 74 65 72 20 6c 61 6e | .into.a.traditional.computer.lan |
| a6c60 | 67 75 61 67 65 20 77 6f 75 6c 64 20 66 6f 72 63 65 20 75 73 20 74 6f 20 63 68 6f 6f 73 65 0a 6f | guage.would.force.us.to.choose.o |
| a6c80 | 6e 65 20 6f 66 20 74 68 65 20 71 75 61 6e 74 69 74 69 65 73 20 74 6f 20 62 65 20 63 6f 6d 70 75 | ne.of.the.quantities.to.be.compu |
| a6ca0 | 74 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 6f 74 68 65 72 20 66 6f 75 72 2e 20 | ted.in.terms.of.the.other.four.. |
| a6cc0 | 20 54 68 75 73 2c 0a 61 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 | .Thus,.a.procedure.for.computing |
| a6ce0 | 20 74 68 65 20 61 72 65 61 20 41 20 63 6f 75 6c 64 20 6e 6f 74 20 62 65 20 75 73 65 64 20 74 6f | .the.area.A.could.not.be.used.to |
| a6d00 | 20 63 6f 6d 70 75 74 65 20 74 68 65 0a 64 65 66 6c 65 63 74 69 6f 6e 20 64 2c 20 65 76 65 6e 20 | .compute.the.deflection.d,.even. |
| a6d20 | 74 68 6f 75 67 68 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 20 6f 66 20 41 20 61 6e 64 | though.the.computations.of.A.and |
| a6d40 | 20 64 20 61 72 69 73 65 20 66 72 6f 6d 20 74 68 65 0a 73 61 6d 65 20 65 71 75 61 74 69 6f 6e 2e | .d.arise.from.the.same.equation. |
| a6d60 | 28 31 29 0a 0a 20 20 20 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 20 77 65 20 73 6b 65 74 | (1).....In.this.section,.we.sket |
| a6d80 | 63 68 20 74 68 65 20 64 65 73 69 67 6e 20 6f 66 20 61 20 6c 61 6e 67 75 61 67 65 20 74 68 61 74 | ch.the.design.of.a.language.that |
| a6da0 | 20 65 6e 61 62 6c 65 73 20 75 73 0a 74 6f 20 77 6f 72 6b 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 | .enables.us.to.work.in.terms.of. |
| a6dc0 | 72 65 6c 61 74 69 6f 6e 73 20 74 68 65 6d 73 65 6c 76 65 73 2e 20 20 54 68 65 20 70 72 69 6d 69 | relations.themselves...The.primi |
| a6de0 | 74 69 76 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 0a 74 68 65 20 6c 61 6e 67 75 61 67 65 20 61 72 | tive.elements.of.the.language.ar |
| a6e00 | 65 20 22 70 72 69 6d 69 74 69 76 65 20 63 6f 6e 73 74 72 61 69 6e 74 73 22 2c 20 77 68 69 63 68 | e."primitive.constraints",.which |
| a6e20 | 20 73 74 61 74 65 20 74 68 61 74 20 63 65 72 74 61 69 6e 0a 72 65 6c 61 74 69 6f 6e 73 20 68 6f | .state.that.certain.relations.ho |
| a6e40 | 6c 64 20 62 65 74 77 65 65 6e 20 71 75 61 6e 74 69 74 69 65 73 2e 20 20 46 6f 72 20 65 78 61 6d | ld.between.quantities...For.exam |
| a6e60 | 70 6c 65 2c 20 60 28 61 64 64 65 72 20 61 20 62 20 63 29 27 0a 73 70 65 63 69 66 69 65 73 20 74 | ple,.`(adder.a.b.c)'.specifies.t |
| a6e80 | 68 61 74 20 74 68 65 20 71 75 61 6e 74 69 74 69 65 73 20 61 2c 20 62 2c 20 61 6e 64 20 63 20 6d | hat.the.quantities.a,.b,.and.c.m |
| a6ea0 | 75 73 74 20 62 65 20 72 65 6c 61 74 65 64 20 62 79 20 74 68 65 0a 65 71 75 61 74 69 6f 6e 20 61 | ust.be.related.by.the.equation.a |
| a6ec0 | 20 2b 20 62 20 3d 20 63 2c 20 60 28 6d 75 6c 74 69 70 6c 69 65 72 20 78 20 79 20 7a 29 27 20 65 | .+.b.=.c,.`(multiplier.x.y.z)'.e |
| a6ee0 | 78 70 72 65 73 73 65 73 20 74 68 65 20 63 6f 6e 73 74 72 61 69 6e 74 20 78 79 20 3d 0a 7a 2c 20 | xpresses.the.constraint.xy.=.z,. |
| a6f00 | 61 6e 64 20 60 28 63 6f 6e 73 74 61 6e 74 20 33 2e 31 34 20 78 29 27 20 73 61 79 73 20 74 68 61 | and.`(constant.3.14.x)'.says.tha |
| a6f20 | 74 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 78 20 6d 75 73 74 20 62 65 20 33 2e 31 34 2e 0a 0a | t.the.value.of.x.must.be.3.14... |
| a6f40 | 20 20 20 4f 75 72 20 6c 61 6e 67 75 61 67 65 20 70 72 6f 76 69 64 65 73 20 61 20 6d 65 61 6e 73 | ...Our.language.provides.a.means |
| a6f60 | 20 6f 66 20 63 6f 6d 62 69 6e 69 6e 67 20 70 72 69 6d 69 74 69 76 65 20 63 6f 6e 73 74 72 61 69 | .of.combining.primitive.constrai |
| a6f80 | 6e 74 73 20 69 6e 0a 6f 72 64 65 72 20 74 6f 20 65 78 70 72 65 73 73 20 6d 6f 72 65 20 63 6f 6d | nts.in.order.to.express.more.com |
| a6fa0 | 70 6c 65 78 20 72 65 6c 61 74 69 6f 6e 73 2e 20 20 57 65 20 63 6f 6d 62 69 6e 65 20 63 6f 6e 73 | plex.relations...We.combine.cons |
| a6fc0 | 74 72 61 69 6e 74 73 20 62 79 0a 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 22 63 6f 6e 73 74 72 61 | traints.by.constructing."constra |
| a6fe0 | 69 6e 74 20 6e 65 74 77 6f 72 6b 73 22 2c 20 69 6e 20 77 68 69 63 68 20 63 6f 6e 73 74 72 61 69 | int.networks",.in.which.constrai |
| a7000 | 6e 74 73 20 61 72 65 20 6a 6f 69 6e 65 64 20 62 79 20 22 63 6f 6e 6e 65 63 74 6f 72 73 22 2e 0a | nts.are.joined.by."connectors".. |
| a7020 | 41 20 63 6f 6e 6e 65 63 74 6f 72 20 69 73 20 61 6e 20 6f 62 6a 65 63 74 20 74 68 61 74 20 22 68 | A.connector.is.an.object.that."h |
| a7040 | 6f 6c 64 73 22 20 61 20 76 61 6c 75 65 20 74 68 61 74 20 6d 61 79 20 70 61 72 74 69 63 69 70 61 | olds".a.value.that.may.participa |
| a7060 | 74 65 20 69 6e 0a 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 63 6f 6e 73 74 72 61 69 6e 74 73 2e 20 20 | te.in.one.or.more.constraints... |
| a7080 | 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 6b 6e 6f 77 20 74 68 61 74 20 74 68 65 20 72 65 | For.example,.we.know.that.the.re |
| a70a0 | 6c 61 74 69 6f 6e 73 68 69 70 0a 62 65 74 77 65 65 6e 20 46 61 68 72 65 6e 68 65 69 74 20 61 6e | lationship.between.Fahrenheit.an |
| a70c0 | 64 20 43 65 6c 73 69 75 73 20 74 65 6d 70 65 72 61 74 75 72 65 73 20 69 73 0a 0a 20 20 20 20 20 | d.Celsius.temperatures.is....... |
| a70e0 | 39 43 20 3d 20 35 28 46 20 2d 20 33 32 29 0a 0a 20 20 20 53 75 63 68 20 61 20 63 6f 6e 73 74 72 | 9C.=.5(F.-.32).....Such.a.constr |
| a7100 | 61 69 6e 74 20 63 61 6e 20 62 65 20 74 68 6f 75 67 68 74 20 6f 66 20 61 73 20 61 20 6e 65 74 77 | aint.can.be.thought.of.as.a.netw |
| a7120 | 6f 72 6b 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 0a 70 72 69 6d 69 74 69 76 65 20 61 64 64 65 | ork.consisting.of.primitive.adde |
| a7140 | 72 2c 20 6d 75 6c 74 69 70 6c 69 65 72 2c 20 61 6e 64 20 63 6f 6e 73 74 61 6e 74 20 63 6f 6e 73 | r,.multiplier,.and.constant.cons |
| a7160 | 74 72 61 69 6e 74 73 20 28 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a 33 2d 32 38 3a 3a 29 2e 20 20 | traints.(*Note.Figure.3-28::)... |
| a7180 | 49 6e 20 74 68 65 20 66 69 67 75 72 65 2c 20 77 65 20 73 65 65 20 6f 6e 20 74 68 65 20 6c 65 66 | In.the.figure,.we.see.on.the.lef |
| a71a0 | 74 20 61 20 6d 75 6c 74 69 70 6c 69 65 72 20 62 6f 78 20 77 69 74 68 20 74 68 72 65 65 0a 74 65 | t.a.multiplier.box.with.three.te |
| a71c0 | 72 6d 69 6e 61 6c 73 2c 20 6c 61 62 65 6c 65 64 20 6d 31 2c 20 6d 32 2c 20 61 6e 64 20 70 2e 20 | rminals,.labeled.m1,.m2,.and.p.. |
| a71e0 | 20 54 68 65 73 65 20 63 6f 6e 6e 65 63 74 20 74 68 65 20 6d 75 6c 74 69 70 6c 69 65 72 20 74 6f | .These.connect.the.multiplier.to |
| a7200 | 20 74 68 65 0a 72 65 73 74 20 6f 66 20 74 68 65 20 6e 65 74 77 6f 72 6b 20 61 73 20 66 6f 6c 6c | .the.rest.of.the.network.as.foll |
| a7220 | 6f 77 73 3a 20 54 68 65 20 6d 31 20 74 65 72 6d 69 6e 61 6c 20 69 73 20 6c 69 6e 6b 65 64 20 74 | ows:.The.m1.terminal.is.linked.t |
| a7240 | 6f 20 61 0a 63 6f 6e 6e 65 63 74 6f 72 20 43 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 68 6f 6c 64 | o.a.connector.C,.which.will.hold |
| a7260 | 20 74 68 65 20 43 65 6c 73 69 75 73 20 74 65 6d 70 65 72 61 74 75 72 65 2e 20 20 54 68 65 20 6d | .the.Celsius.temperature...The.m |
| a7280 | 32 20 74 65 72 6d 69 6e 61 6c 0a 69 73 20 6c 69 6e 6b 65 64 20 74 6f 20 61 20 63 6f 6e 6e 65 63 | 2.terminal.is.linked.to.a.connec |
| a72a0 | 74 6f 72 20 77 2c 20 77 68 69 63 68 20 69 73 20 61 6c 73 6f 20 6c 69 6e 6b 65 64 20 74 6f 20 61 | tor.w,.which.is.also.linked.to.a |
| a72c0 | 20 63 6f 6e 73 74 61 6e 74 20 62 6f 78 20 74 68 61 74 0a 68 6f 6c 64 73 20 39 2e 20 20 54 68 65 | .constant.box.that.holds.9...The |
| a72e0 | 20 70 20 74 65 72 6d 69 6e 61 6c 2c 20 77 68 69 63 68 20 74 68 65 20 6d 75 6c 74 69 70 6c 69 65 | .p.terminal,.which.the.multiplie |
| a7300 | 72 20 62 6f 78 20 63 6f 6e 73 74 72 61 69 6e 73 20 74 6f 20 62 65 20 74 68 65 0a 70 72 6f 64 75 | r.box.constrains.to.be.the.produ |
| a7320 | 63 74 20 6f 66 20 6d 31 20 61 6e 64 20 6d 32 2c 20 69 73 20 6c 69 6e 6b 65 64 20 74 6f 20 74 68 | ct.of.m1.and.m2,.is.linked.to.th |
| a7340 | 65 20 70 20 74 65 72 6d 69 6e 61 6c 20 6f 66 20 61 6e 6f 74 68 65 72 20 6d 75 6c 74 69 70 6c 69 | e.p.terminal.of.another.multipli |
| a7360 | 65 72 0a 62 6f 78 2c 20 77 68 6f 73 65 20 6d 32 20 69 73 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f | er.box,.whose.m2.is.connected.to |
| a7380 | 20 61 20 63 6f 6e 73 74 61 6e 74 20 35 20 61 6e 64 20 77 68 6f 73 65 20 6d 31 20 69 73 20 63 6f | .a.constant.5.and.whose.m1.is.co |
| a73a0 | 6e 6e 65 63 74 65 64 20 74 6f 0a 6f 6e 65 20 6f 66 20 74 68 65 20 74 65 72 6d 73 20 69 6e 20 61 | nnected.to.one.of.the.terms.in.a |
| a73c0 | 20 73 75 6d 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 32 38 3a 2a 20 54 68 65 20 72 | .sum........*Figure.3.28:*.The.r |
| a73e0 | 65 6c 61 74 69 6f 6e 20 39 43 20 3d 20 35 28 46 20 2d 20 33 32 29 20 65 78 70 72 65 73 73 65 64 | elation.9C.=.5(F.-.32).expressed |
| a7400 | 20 61 73 20 61 0a 20 20 20 20 20 63 6f 6e 73 74 72 61 69 6e 74 20 6e 65 74 77 6f 72 6b 2e 0a 0a | .as.a......constraint.network... |
| a7420 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 | .................+---------+.... |
| a7440 | 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 76 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 | .+---------+...v...+---------+.. |
| a7460 | 20 20 20 20 20 20 20 20 20 43 20 2d 2d 2d 2d 2d 2b 20 6d 31 20 20 20 20 20 20 7c 20 20 75 20 20 | .........C.-----+.m1......|..u.. |
| a7480 | 7c 20 20 20 20 20 20 6d 31 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 61 31 20 20 20 20 20 20 7c 0a 20 20 | |......m1.+-------+.a1......|... |
| a74a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 2a 20 20 70 20 2b 2d 2d 2d 2d 2d 2b | ...............|....*..p.+-----+ |
| a74c0 | 20 70 20 20 2a 20 20 20 20 7c 20 20 20 20 20 20 20 7c 20 20 20 20 2b 20 20 73 20 2b 2d 2d 2d 2d | .p..*....|.......|....+..s.+---- |
| a74e0 | 20 46 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2b 20 6d 32 20 20 20 20 20 20 7c 20 | .F...............+--+.m2......|. |
| a7500 | 20 20 20 20 7c 20 20 20 20 20 20 6d 32 20 2b 2d 2d 2b 20 2b 2d 2d 2b 20 61 32 20 20 20 20 20 20 | ....|......m2.+--+.+--+.a2...... |
| a7520 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 | |...............|..+---------+.. |
| a7540 | 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 7c 20 7c 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b | ...+---------+..|.|..+---------+ |
| a7560 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 77 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............w.|................ |
| a7580 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 7c 20 7c 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..............x|.|y............. |
| a75a0 | 20 20 7c 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 | ..|....+-----+........+-----+... |
| a75c0 | 20 20 7c 20 7c 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..|.|.....+-----+............... |
| a75e0 | 2b 2d 2d 2d 2d 2b 20 20 39 20 20 7c 20 20 20 20 20 20 20 20 7c 20 20 35 20 20 2b 2d 2d 2d 2d 2d | +----+..9..|........|..5..+----- |
| a7600 | 2b 20 2b 2d 2d 2d 2d 2d 2b 20 20 33 32 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | +.+-----+..32.|................. |
| a7620 | 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 | ...+-----+........+-----+....... |
| a7640 | 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 43 6f 6d 70 75 74 61 74 69 6f 6e 20 62 79 | ......+-----+.....Computation.by |
| a7660 | 20 73 75 63 68 20 61 20 6e 65 74 77 6f 72 6b 20 70 72 6f 63 65 65 64 73 20 61 73 20 66 6f 6c 6c | .such.a.network.proceeds.as.foll |
| a7680 | 6f 77 73 3a 20 57 68 65 6e 20 61 20 63 6f 6e 6e 65 63 74 6f 72 0a 69 73 20 67 69 76 65 6e 20 61 | ows:.When.a.connector.is.given.a |
| a76a0 | 20 76 61 6c 75 65 20 28 62 79 20 74 68 65 20 75 73 65 72 20 6f 72 20 62 79 20 61 20 63 6f 6e 73 | .value.(by.the.user.or.by.a.cons |
| a76c0 | 74 72 61 69 6e 74 20 62 6f 78 20 74 6f 20 77 68 69 63 68 20 69 74 20 69 73 0a 6c 69 6e 6b 65 64 | traint.box.to.which.it.is.linked |
| a76e0 | 29 2c 20 69 74 20 61 77 61 6b 65 6e 73 20 61 6c 6c 20 6f 66 20 69 74 73 20 61 73 73 6f 63 69 61 | ),.it.awakens.all.of.its.associa |
| a7700 | 74 65 64 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 28 65 78 63 65 70 74 20 66 6f 72 20 74 68 65 0a | ted.constraints.(except.for.the. |
| a7720 | 63 6f 6e 73 74 72 61 69 6e 74 20 74 68 61 74 20 6a 75 73 74 20 61 77 61 6b 65 6e 65 64 20 69 74 | constraint.that.just.awakened.it |
| a7740 | 29 20 74 6f 20 69 6e 66 6f 72 6d 20 74 68 65 6d 20 74 68 61 74 20 69 74 20 68 61 73 20 61 20 76 | ).to.inform.them.that.it.has.a.v |
| a7760 | 61 6c 75 65 2e 0a 45 61 63 68 20 61 77 61 6b 65 6e 65 64 20 63 6f 6e 73 74 72 61 69 6e 74 20 62 | alue..Each.awakened.constraint.b |
| a7780 | 6f 78 20 74 68 65 6e 20 70 6f 6c 6c 73 20 69 74 73 20 63 6f 6e 6e 65 63 74 6f 72 73 20 74 6f 20 | ox.then.polls.its.connectors.to. |
| a77a0 | 73 65 65 20 69 66 20 74 68 65 72 65 0a 69 73 20 65 6e 6f 75 67 68 20 69 6e 66 6f 72 6d 61 74 69 | see.if.there.is.enough.informati |
| a77c0 | 6f 6e 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 61 20 76 61 6c 75 65 20 66 6f 72 20 61 20 63 6f | on.to.determine.a.value.for.a.co |
| a77e0 | 6e 6e 65 63 74 6f 72 2e 20 20 49 66 20 73 6f 2c 20 74 68 65 0a 62 6f 78 20 73 65 74 73 20 74 68 | nnector...If.so,.the.box.sets.th |
| a7800 | 61 74 20 63 6f 6e 6e 65 63 74 6f 72 2c 20 77 68 69 63 68 20 74 68 65 6e 20 61 77 61 6b 65 6e 73 | at.connector,.which.then.awakens |
| a7820 | 20 61 6c 6c 20 6f 66 20 69 74 73 20 61 73 73 6f 63 69 61 74 65 64 0a 63 6f 6e 73 74 72 61 69 6e | .all.of.its.associated.constrain |
| a7840 | 74 73 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 6e | ts,.and.so.on...For.instance,.in |
| a7860 | 20 63 6f 6e 76 65 72 73 69 6f 6e 20 62 65 74 77 65 65 6e 20 43 65 6c 73 69 75 73 0a 61 6e 64 20 | .conversion.between.Celsius.and. |
| a7880 | 46 61 68 72 65 6e 68 65 69 74 2c 20 77 2c 20 78 2c 20 61 6e 64 20 79 20 61 72 65 20 69 6d 6d 65 | Fahrenheit,.w,.x,.and.y.are.imme |
| a78a0 | 64 69 61 74 65 6c 79 20 73 65 74 20 62 79 20 74 68 65 20 63 6f 6e 73 74 61 6e 74 20 62 6f 78 65 | diately.set.by.the.constant.boxe |
| a78c0 | 73 0a 74 6f 20 39 2c 20 35 2c 20 61 6e 64 20 33 32 2c 20 72 65 73 70 65 63 74 69 76 65 6c 79 2e | s.to.9,.5,.and.32,.respectively. |
| a78e0 | 20 20 54 68 65 20 63 6f 6e 6e 65 63 74 6f 72 73 20 61 77 61 6b 65 6e 20 74 68 65 20 6d 75 6c 74 | ..The.connectors.awaken.the.mult |
| a7900 | 69 70 6c 69 65 72 73 0a 61 6e 64 20 74 68 65 20 61 64 64 65 72 2c 20 77 68 69 63 68 20 64 65 74 | ipliers.and.the.adder,.which.det |
| a7920 | 65 72 6d 69 6e 65 20 74 68 61 74 20 74 68 65 72 65 20 69 73 20 6e 6f 74 20 65 6e 6f 75 67 68 20 | ermine.that.there.is.not.enough. |
| a7940 | 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 74 6f 0a 70 72 6f 63 65 65 64 2e 20 20 49 66 20 74 68 65 20 | information.to.proceed...If.the. |
| a7960 | 75 73 65 72 20 28 6f 72 20 73 6f 6d 65 20 6f 74 68 65 72 20 70 61 72 74 20 6f 66 20 74 68 65 20 | user.(or.some.other.part.of.the. |
| a7980 | 6e 65 74 77 6f 72 6b 29 20 73 65 74 73 20 43 20 74 6f 20 61 0a 76 61 6c 75 65 20 28 73 61 79 20 | network).sets.C.to.a.value.(say. |
| a79a0 | 32 35 29 2c 20 74 68 65 20 6c 65 66 74 6d 6f 73 74 20 6d 75 6c 74 69 70 6c 69 65 72 20 77 69 6c | 25),.the.leftmost.multiplier.wil |
| a79c0 | 6c 20 62 65 20 61 77 61 6b 65 6e 65 64 2c 20 61 6e 64 20 69 74 20 77 69 6c 6c 0a 73 65 74 20 75 | l.be.awakened,.and.it.will.set.u |
| a79e0 | 20 74 6f 20 32 35 2a 39 20 3d 20 32 32 35 2e 20 20 54 68 65 6e 20 75 20 61 77 61 6b 65 6e 73 20 | .to.25*9.=.225...Then.u.awakens. |
| a7a00 | 74 68 65 20 73 65 63 6f 6e 64 20 6d 75 6c 74 69 70 6c 69 65 72 2c 20 77 68 69 63 68 20 73 65 74 | the.second.multiplier,.which.set |
| a7a20 | 73 0a 76 20 74 6f 20 34 35 2c 20 61 6e 64 20 76 20 61 77 61 6b 65 6e 73 20 74 68 65 20 61 64 64 | s.v.to.45,.and.v.awakens.the.add |
| a7a40 | 65 72 2c 20 77 68 69 63 68 20 73 65 74 73 20 66 20 74 6f 20 37 37 2e 0a 0a 55 73 69 6e 67 20 74 | er,.which.sets.f.to.77...Using.t |
| a7a60 | 68 65 20 63 6f 6e 73 74 72 61 69 6e 74 20 73 79 73 74 65 6d 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | he.constraint.system............ |
| a7a80 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 6f 20 75 73 65 20 74 68 65 20 63 6f 6e | ..................To.use.the.con |
| a7aa0 | 73 74 72 61 69 6e 74 20 73 79 73 74 65 6d 20 74 6f 20 63 61 72 72 79 20 6f 75 74 20 74 68 65 20 | straint.system.to.carry.out.the. |
| a7ac0 | 74 65 6d 70 65 72 61 74 75 72 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 0a 6f 75 74 6c 69 6e 65 64 | temperature.computation.outlined |
| a7ae0 | 20 61 62 6f 76 65 2c 20 77 65 20 66 69 72 73 74 20 63 72 65 61 74 65 20 74 77 6f 20 63 6f 6e 6e | .above,.we.first.create.two.conn |
| a7b00 | 65 63 74 6f 72 73 2c 20 60 43 27 20 61 6e 64 20 60 46 27 2c 20 62 79 20 63 61 6c 6c 69 6e 67 0a | ectors,.`C'.and.`F',.by.calling. |
| a7b20 | 74 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 27 | the.constructor.`make-connector' |
| a7b40 | 2c 20 61 6e 64 20 6c 69 6e 6b 20 60 43 27 20 61 6e 64 20 60 46 27 20 69 6e 20 61 6e 0a 61 70 70 | ,.and.link.`C'.and.`F'.in.an.app |
| a7b60 | 72 6f 70 72 69 61 74 65 20 6e 65 74 77 6f 72 6b 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ropriate.network:.......(define. |
| a7b80 | 43 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | C.(make-connector))......(define |
| a7ba0 | 20 46 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 29 0a 20 20 20 20 20 28 63 65 6c 73 69 | .F.(make-connector))......(celsi |
| a7bc0 | 75 73 2d 66 61 68 72 65 6e 68 65 69 74 2d 63 6f 6e 76 65 72 74 65 72 20 43 20 46 29 0a 20 20 20 | us-fahrenheit-converter.C.F).... |
| a7be0 | 20 20 6f 6b 0a 0a 20 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 72 65 61 | ..ok.....The.procedure.that.crea |
| a7c00 | 74 65 73 20 74 68 65 20 6e 65 74 77 6f 72 6b 20 69 73 20 64 65 66 69 6e 65 64 20 61 73 20 66 6f | tes.the.network.is.defined.as.fo |
| a7c20 | 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 65 6c 73 69 75 73 2d 66 61 | llows:.......(define.(celsius-fa |
| a7c40 | 68 72 65 6e 68 65 69 74 2d 63 6f 6e 76 65 72 74 65 72 20 63 20 66 29 0a 20 20 20 20 20 20 20 28 | hrenheit-converter.c.f)........( |
| a7c60 | 6c 65 74 20 28 28 75 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 29 0a 20 20 20 20 20 20 | let.((u.(make-connector))....... |
| a7c80 | 20 20 20 20 20 20 20 28 76 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 29 0a 20 20 20 20 | .......(v.(make-connector))..... |
| a7ca0 | 20 20 20 20 20 20 20 20 20 28 77 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 29 0a 20 20 | .........(w.(make-connector))... |
| a7cc0 | 20 20 20 20 20 20 20 20 20 20 20 28 78 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 29 0a | ...........(x.(make-connector)). |
| a7ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 79 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 | .............(y.(make-connector) |
| a7d00 | 29 29 0a 20 20 20 20 20 20 20 20 20 28 6d 75 6c 74 69 70 6c 69 65 72 20 63 20 77 20 75 29 0a 20 | ))..........(multiplier.c.w.u).. |
| a7d20 | 20 20 20 20 20 20 20 20 28 6d 75 6c 74 69 70 6c 69 65 72 20 76 20 78 20 75 29 0a 20 20 20 20 20 | ........(multiplier.v.x.u)...... |
| a7d40 | 20 20 20 20 28 61 64 64 65 72 20 76 20 79 20 66 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 | ....(adder.v.y.f)..........(cons |
| a7d60 | 74 61 6e 74 20 39 20 77 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 74 61 6e 74 20 35 20 78 | tant.9.w)..........(constant.5.x |
| a7d80 | 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 74 61 6e 74 20 33 32 20 79 29 0a 20 20 20 20 20 | )..........(constant.32.y)...... |
| a7da0 | 20 20 20 20 27 6f 6b 29 29 0a 0a 20 20 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 63 72 65 | ....'ok)).....This.procedure.cre |
| a7dc0 | 61 74 65 73 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 63 6f 6e 6e 65 63 74 6f 72 73 20 60 75 27 | ates.the.internal.connectors.`u' |
| a7de0 | 2c 20 60 76 27 2c 20 60 77 27 2c 20 60 78 27 2c 0a 61 6e 64 20 60 79 27 2c 20 61 6e 64 20 6c 69 | ,.`v',.`w',.`x',.and.`y',.and.li |
| a7e00 | 6e 6b 73 20 74 68 65 6d 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 | nks.them.as.shown.in.*Note.Figur |
| a7e20 | 65 20 33 2d 32 38 3a 3a 20 75 73 69 6e 67 20 74 68 65 0a 70 72 69 6d 69 74 69 76 65 20 63 6f 6e | e.3-28::.using.the.primitive.con |
| a7e40 | 73 74 72 61 69 6e 74 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 60 61 64 64 65 72 27 2c 20 60 6d | straint.constructors.`adder',.`m |
| a7e60 | 75 6c 74 69 70 6c 69 65 72 27 2c 20 61 6e 64 0a 60 63 6f 6e 73 74 61 6e 74 27 2e 20 20 4a 75 73 | ultiplier',.and.`constant'...Jus |
| a7e80 | 74 20 61 73 20 77 69 74 68 20 74 68 65 20 64 69 67 69 74 61 6c 2d 63 69 72 63 75 69 74 20 73 69 | t.as.with.the.digital-circuit.si |
| a7ea0 | 6d 75 6c 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 33 2d 33 2d 34 3a 3a | mulator.of.section.*Note.3-3-4:: |
| a7ec0 | 2c 20 65 78 70 72 65 73 73 69 6e 67 20 74 68 65 73 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 | ,.expressing.these.combinations. |
| a7ee0 | 6f 66 20 70 72 69 6d 69 74 69 76 65 20 65 6c 65 6d 65 6e 74 73 20 69 6e 0a 74 65 72 6d 73 20 6f | of.primitive.elements.in.terms.o |
| a7f00 | 66 20 70 72 6f 63 65 64 75 72 65 73 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 70 72 6f 76 69 | f.procedures.automatically.provi |
| a7f20 | 64 65 73 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 77 69 74 68 20 61 20 6d 65 61 6e 73 20 6f 66 | des.our.language.with.a.means.of |
| a7f40 | 0a 61 62 73 74 72 61 63 74 69 6f 6e 20 66 6f 72 20 63 6f 6d 70 6f 75 6e 64 20 6f 62 6a 65 63 74 | .abstraction.for.compound.object |
| a7f60 | 73 2e 0a 0a 20 20 20 54 6f 20 77 61 74 63 68 20 74 68 65 20 6e 65 74 77 6f 72 6b 20 69 6e 20 61 | s......To.watch.the.network.in.a |
| a7f80 | 63 74 69 6f 6e 2c 20 77 65 20 63 61 6e 20 70 6c 61 63 65 20 70 72 6f 62 65 73 20 6f 6e 20 74 68 | ction,.we.can.place.probes.on.th |
| a7fa0 | 65 0a 63 6f 6e 6e 65 63 74 6f 72 73 20 60 43 27 20 61 6e 64 20 60 46 27 2c 20 75 73 69 6e 67 20 | e.connectors.`C'.and.`F',.using. |
| a7fc0 | 61 20 60 70 72 6f 62 65 27 20 70 72 6f 63 65 64 75 72 65 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 | a.`probe'.procedure.similar.to.t |
| a7fe0 | 68 65 20 6f 6e 65 20 77 65 0a 75 73 65 64 20 74 6f 20 6d 6f 6e 69 74 6f 72 20 77 69 72 65 73 20 | he.one.we.used.to.monitor.wires. |
| a8000 | 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 33 2d 34 3a 3a 2e 20 20 50 6c 61 63 69 | in.section.*Note.3-3-4::...Placi |
| a8020 | 6e 67 20 61 20 70 72 6f 62 65 20 6f 6e 20 61 0a 63 6f 6e 6e 65 63 74 6f 72 20 77 69 6c 6c 20 63 | ng.a.probe.on.a.connector.will.c |
| a8040 | 61 75 73 65 20 61 20 6d 65 73 73 61 67 65 20 74 6f 20 62 65 20 70 72 69 6e 74 65 64 20 77 68 65 | ause.a.message.to.be.printed.whe |
| a8060 | 6e 65 76 65 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 20 69 73 0a 67 69 76 65 6e 20 61 20 76 | never.the.connector.is.given.a.v |
| a8080 | 61 6c 75 65 3a 0a 0a 20 20 20 20 20 28 70 72 6f 62 65 20 22 43 65 6c 73 69 75 73 20 74 65 6d 70 | alue:.......(probe."Celsius.temp |
| a80a0 | 22 20 43 29 0a 20 20 20 20 20 28 70 72 6f 62 65 20 22 46 61 68 72 65 6e 68 65 69 74 20 74 65 6d | ".C)......(probe."Fahrenheit.tem |
| a80c0 | 70 22 20 46 29 0a 0a 20 20 20 4e 65 78 74 20 77 65 20 73 65 74 20 74 68 65 20 76 61 6c 75 65 20 | p".F).....Next.we.set.the.value. |
| a80e0 | 6f 66 20 60 43 27 20 74 6f 20 32 35 2e 20 20 28 54 68 65 20 74 68 69 72 64 20 61 72 67 75 6d 65 | of.`C'.to.25...(The.third.argume |
| a8100 | 6e 74 20 74 6f 0a 60 73 65 74 2d 76 61 6c 75 65 21 27 20 74 65 6c 6c 73 20 60 43 27 20 74 68 61 | nt.to.`set-value!'.tells.`C'.tha |
| a8120 | 74 20 74 68 69 73 20 64 69 72 65 63 74 69 76 65 20 63 6f 6d 65 73 20 66 72 6f 6d 20 74 68 65 20 | t.this.directive.comes.from.the. |
| a8140 | 60 75 73 65 72 27 2e 29 0a 0a 20 20 20 20 20 28 73 65 74 2d 76 61 6c 75 65 21 20 43 20 32 35 20 | `user'.).......(set-value!.C.25. |
| a8160 | 27 75 73 65 72 29 0a 20 20 20 20 20 50 72 6f 62 65 3a 20 43 65 6c 73 69 75 73 20 74 65 6d 70 20 | 'user)......Probe:.Celsius.temp. |
| a8180 | 3d 20 32 35 0a 20 20 20 20 20 50 72 6f 62 65 3a 20 46 61 68 72 65 6e 68 65 69 74 20 74 65 6d 70 | =.25......Probe:.Fahrenheit.temp |
| a81a0 | 20 3d 20 37 37 0a 20 20 20 20 20 64 6f 6e 65 0a 0a 20 20 20 54 68 65 20 70 72 6f 62 65 20 6f 6e | .=.77......done.....The.probe.on |
| a81c0 | 20 60 43 27 20 61 77 61 6b 65 6e 73 20 61 6e 64 20 72 65 70 6f 72 74 73 20 74 68 65 20 76 61 6c | .`C'.awakens.and.reports.the.val |
| a81e0 | 75 65 2e 20 20 60 43 27 20 61 6c 73 6f 20 70 72 6f 70 61 67 61 74 65 73 0a 69 74 73 20 76 61 6c | ue...`C'.also.propagates.its.val |
| a8200 | 75 65 20 74 68 72 6f 75 67 68 20 74 68 65 20 6e 65 74 77 6f 72 6b 20 61 73 20 64 65 73 63 72 69 | ue.through.the.network.as.descri |
| a8220 | 62 65 64 20 61 62 6f 76 65 2e 20 20 54 68 69 73 20 73 65 74 73 20 60 46 27 20 74 6f 20 37 37 2c | bed.above...This.sets.`F'.to.77, |
| a8240 | 0a 77 68 69 63 68 20 69 73 20 72 65 70 6f 72 74 65 64 20 62 79 20 74 68 65 20 70 72 6f 62 65 20 | .which.is.reported.by.the.probe. |
| a8260 | 6f 6e 20 60 46 27 2e 0a 0a 20 20 20 4e 6f 77 20 77 65 20 63 61 6e 20 74 72 79 20 74 6f 20 73 65 | on.`F'......Now.we.can.try.to.se |
| a8280 | 74 20 60 46 27 20 74 6f 20 61 20 6e 65 77 20 76 61 6c 75 65 2c 20 73 61 79 20 32 31 32 3a 0a 0a | t.`F'.to.a.new.value,.say.212:.. |
| a82a0 | 20 20 20 20 20 28 73 65 74 2d 76 61 6c 75 65 21 20 46 20 32 31 32 20 27 75 73 65 72 29 0a 20 20 | .....(set-value!.F.212.'user)... |
| a82c0 | 20 20 20 45 72 72 6f 72 21 20 43 6f 6e 74 72 61 64 69 63 74 69 6f 6e 20 28 37 37 20 32 31 32 29 | ...Error!.Contradiction.(77.212) |
| a82e0 | 0a 0a 20 20 20 54 68 65 20 63 6f 6e 6e 65 63 74 6f 72 20 63 6f 6d 70 6c 61 69 6e 73 20 74 68 61 | .....The.connector.complains.tha |
| a8300 | 74 20 69 74 20 68 61 73 20 73 65 6e 73 65 64 20 61 20 63 6f 6e 74 72 61 64 69 63 74 69 6f 6e 3a | t.it.has.sensed.a.contradiction: |
| a8320 | 20 49 74 73 0a 76 61 6c 75 65 20 69 73 20 37 37 2c 20 61 6e 64 20 73 6f 6d 65 6f 6e 65 20 69 73 | .Its.value.is.77,.and.someone.is |
| a8340 | 20 74 72 79 69 6e 67 20 74 6f 20 73 65 74 20 69 74 20 74 6f 20 32 31 32 2e 20 20 49 66 20 77 65 | .trying.to.set.it.to.212...If.we |
| a8360 | 20 72 65 61 6c 6c 79 20 77 61 6e 74 0a 74 6f 20 72 65 75 73 65 20 74 68 65 20 6e 65 74 77 6f 72 | .really.want.to.reuse.the.networ |
| a8380 | 6b 20 77 69 74 68 20 6e 65 77 20 76 61 6c 75 65 73 2c 20 77 65 20 63 61 6e 20 74 65 6c 6c 20 60 | k.with.new.values,.we.can.tell.` |
| a83a0 | 43 27 20 74 6f 20 66 6f 72 67 65 74 20 69 74 73 20 6f 6c 64 0a 76 61 6c 75 65 3a 0a 0a 20 20 20 | C'.to.forget.its.old.value:..... |
| a83c0 | 20 20 28 66 6f 72 67 65 74 2d 76 61 6c 75 65 21 20 43 20 27 75 73 65 72 29 0a 20 20 20 20 20 50 | ..(forget-value!.C.'user)......P |
| a83e0 | 72 6f 62 65 3a 20 43 65 6c 73 69 75 73 20 74 65 6d 70 20 3d 20 3f 0a 20 20 20 20 20 50 72 6f 62 | robe:.Celsius.temp.=.?......Prob |
| a8400 | 65 3a 20 46 61 68 72 65 6e 68 65 69 74 20 74 65 6d 70 20 3d 20 3f 0a 20 20 20 20 20 64 6f 6e 65 | e:.Fahrenheit.temp.=.?......done |
| a8420 | 0a 0a 20 20 20 60 43 27 20 66 69 6e 64 73 20 74 68 61 74 20 74 68 65 20 60 75 73 65 72 27 2c 20 | .....`C'.finds.that.the.`user',. |
| a8440 | 77 68 6f 20 73 65 74 20 69 74 73 20 76 61 6c 75 65 20 6f 72 69 67 69 6e 61 6c 6c 79 2c 20 69 73 | who.set.its.value.originally,.is |
| a8460 | 20 6e 6f 77 0a 72 65 74 72 61 63 74 69 6e 67 20 74 68 61 74 20 76 61 6c 75 65 2c 20 73 6f 20 60 | .now.retracting.that.value,.so.` |
| a8480 | 43 27 20 61 67 72 65 65 73 20 74 6f 20 6c 6f 73 65 20 69 74 73 20 76 61 6c 75 65 2c 20 61 73 20 | C'.agrees.to.lose.its.value,.as. |
| a84a0 | 73 68 6f 77 6e 20 62 79 20 74 68 65 0a 70 72 6f 62 65 2c 20 61 6e 64 20 69 6e 66 6f 72 6d 73 20 | shown.by.the.probe,.and.informs. |
| a84c0 | 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 6e 65 74 77 6f 72 6b 20 6f 66 20 74 68 69 73 20 | the.rest.of.the.network.of.this. |
| a84e0 | 66 61 63 74 2e 20 20 54 68 69 73 0a 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 65 76 65 6e 74 75 61 6c | fact...This.information.eventual |
| a8500 | 6c 79 20 70 72 6f 70 61 67 61 74 65 73 20 74 6f 20 60 46 27 2c 20 77 68 69 63 68 20 6e 6f 77 20 | ly.propagates.to.`F',.which.now. |
| a8520 | 66 69 6e 64 73 20 74 68 61 74 20 69 74 20 68 61 73 0a 6e 6f 20 72 65 61 73 6f 6e 20 66 6f 72 20 | finds.that.it.has.no.reason.for. |
| a8540 | 63 6f 6e 74 69 6e 75 69 6e 67 20 74 6f 20 62 65 6c 69 65 76 65 20 74 68 61 74 20 69 74 73 20 6f | continuing.to.believe.that.its.o |
| a8560 | 77 6e 20 76 61 6c 75 65 20 69 73 20 37 37 2e 20 20 54 68 75 73 2c 0a 60 46 27 20 61 6c 73 6f 20 | wn.value.is.77...Thus,.`F'.also. |
| a8580 | 67 69 76 65 73 20 75 70 20 69 74 73 20 76 61 6c 75 65 2c 20 61 73 20 73 68 6f 77 6e 20 62 79 20 | gives.up.its.value,.as.shown.by. |
| a85a0 | 74 68 65 20 70 72 6f 62 65 2e 0a 0a 20 20 20 4e 6f 77 20 74 68 61 74 20 60 46 27 20 68 61 73 20 | the.probe......Now.that.`F'.has. |
| a85c0 | 6e 6f 20 76 61 6c 75 65 2c 20 77 65 20 61 72 65 20 66 72 65 65 20 74 6f 20 73 65 74 20 69 74 20 | no.value,.we.are.free.to.set.it. |
| a85e0 | 74 6f 20 32 31 32 3a 0a 0a 20 20 20 20 20 28 73 65 74 2d 76 61 6c 75 65 21 20 46 20 32 31 32 20 | to.212:.......(set-value!.F.212. |
| a8600 | 27 75 73 65 72 29 0a 20 20 20 20 20 50 72 6f 62 65 3a 20 46 61 68 72 65 6e 68 65 69 74 20 74 65 | 'user)......Probe:.Fahrenheit.te |
| a8620 | 6d 70 20 3d 20 32 31 32 0a 20 20 20 20 20 50 72 6f 62 65 3a 20 43 65 6c 73 69 75 73 20 74 65 6d | mp.=.212......Probe:.Celsius.tem |
| a8640 | 70 20 3d 20 31 30 30 0a 20 20 20 20 20 64 6f 6e 65 0a 0a 20 20 20 54 68 69 73 20 6e 65 77 20 76 | p.=.100......done.....This.new.v |
| a8660 | 61 6c 75 65 2c 20 77 68 65 6e 20 70 72 6f 70 61 67 61 74 65 64 20 74 68 72 6f 75 67 68 20 74 68 | alue,.when.propagated.through.th |
| a8680 | 65 20 6e 65 74 77 6f 72 6b 2c 20 66 6f 72 63 65 73 20 60 43 27 20 74 6f 0a 68 61 76 65 20 61 20 | e.network,.forces.`C'.to.have.a. |
| a86a0 | 76 61 6c 75 65 20 6f 66 20 31 30 30 2c 20 61 6e 64 20 74 68 69 73 20 69 73 20 72 65 67 69 73 74 | value.of.100,.and.this.is.regist |
| a86c0 | 65 72 65 64 20 62 79 20 74 68 65 20 70 72 6f 62 65 20 6f 6e 20 60 43 27 2e 0a 4e 6f 74 69 63 65 | ered.by.the.probe.on.`C'..Notice |
| a86e0 | 20 74 68 61 74 20 74 68 65 20 76 65 72 79 20 73 61 6d 65 20 6e 65 74 77 6f 72 6b 20 69 73 20 62 | .that.the.very.same.network.is.b |
| a8700 | 65 69 6e 67 20 75 73 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 60 43 27 20 67 69 76 65 6e 0a 60 | eing.used.to.compute.`C'.given.` |
| a8720 | 46 27 20 61 6e 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 60 46 27 20 67 69 76 65 6e 20 60 43 27 2e | F'.and.to.compute.`F'.given.`C'. |
| a8740 | 20 20 54 68 69 73 20 6e 6f 6e 64 69 72 65 63 74 69 6f 6e 61 6c 69 74 79 20 6f 66 0a 63 6f 6d 70 | ..This.nondirectionality.of.comp |
| a8760 | 75 74 61 74 69 6f 6e 20 69 73 20 74 68 65 20 64 69 73 74 69 6e 67 75 69 73 68 69 6e 67 20 66 65 | utation.is.the.distinguishing.fe |
| a8780 | 61 74 75 72 65 20 6f 66 20 63 6f 6e 73 74 72 61 69 6e 74 2d 62 61 73 65 64 20 73 79 73 74 65 6d | ature.of.constraint-based.system |
| a87a0 | 73 2e 0a 0a 49 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 63 6f 6e 73 74 72 61 69 6e 74 20 | s...Implementing.the.constraint. |
| a87c0 | 73 79 73 74 65 6d 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | system.......................... |
| a87e0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 63 6f 6e 73 74 72 61 69 6e 74 20 73 79 73 74 65 6d | ...........The.constraint.system |
| a8800 | 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 76 69 61 20 70 72 6f 63 65 64 75 72 61 6c 20 6f | .is.implemented.via.procedural.o |
| a8820 | 62 6a 65 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 0a 73 74 61 74 65 2c 20 69 6e 20 61 20 6d 61 | bjects.with.local.state,.in.a.ma |
| a8840 | 6e 6e 65 72 20 76 65 72 79 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 64 69 67 69 74 61 6c | nner.very.similar.to.the.digital |
| a8860 | 2d 63 69 72 63 75 69 74 20 73 69 6d 75 6c 61 74 6f 72 20 6f 66 0a 73 65 63 74 69 6f 6e 20 2a 4e | -circuit.simulator.of.section.*N |
| a8880 | 6f 74 65 20 33 2d 33 2d 34 3a 3a 2e 20 20 41 6c 74 68 6f 75 67 68 20 74 68 65 20 70 72 69 6d 69 | ote.3-3-4::...Although.the.primi |
| a88a0 | 74 69 76 65 20 6f 62 6a 65 63 74 73 20 6f 66 20 74 68 65 0a 63 6f 6e 73 74 72 61 69 6e 74 20 73 | tive.objects.of.the.constraint.s |
| a88c0 | 79 73 74 65 6d 20 61 72 65 20 73 6f 6d 65 77 68 61 74 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 2c | ystem.are.somewhat.more.complex, |
| a88e0 | 20 74 68 65 20 6f 76 65 72 61 6c 6c 20 73 79 73 74 65 6d 20 69 73 0a 73 69 6d 70 6c 65 72 2c 20 | .the.overall.system.is.simpler,. |
| a8900 | 73 69 6e 63 65 20 74 68 65 72 65 20 69 73 20 6e 6f 20 63 6f 6e 63 65 72 6e 20 61 62 6f 75 74 20 | since.there.is.no.concern.about. |
| a8920 | 61 67 65 6e 64 61 73 20 61 6e 64 20 6c 6f 67 69 63 20 64 65 6c 61 79 73 2e 0a 0a 20 20 20 54 68 | agendas.and.logic.delays......Th |
| a8940 | 65 20 62 61 73 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 63 6f 6e 6e 65 63 74 6f 72 73 | e.basic.operations.on.connectors |
| a8960 | 20 61 72 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 0a 20 20 20 2a 20 60 28 68 61 73 2d | .are.the.following:.....*.`(has- |
| a8980 | 76 61 6c 75 65 3f 20 3c 43 4f 4e 4e 45 43 54 4f 52 3e 29 27 20 74 65 6c 6c 73 20 77 68 65 74 68 | value?.<CONNECTOR>)'.tells.wheth |
| a89a0 | 65 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 20 68 61 73 20 61 20 76 61 6c 75 65 2e 0a 0a 20 | er.the.connector.has.a.value.... |
| a89c0 | 20 20 2a 20 60 28 67 65 74 2d 76 61 6c 75 65 20 3c 43 4f 4e 4e 45 43 54 4f 52 3e 29 27 20 72 65 | ..*.`(get-value.<CONNECTOR>)'.re |
| a89e0 | 74 75 72 6e 73 20 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 27 73 20 63 75 72 72 65 6e 74 20 76 61 | turns.the.connector's.current.va |
| a8a00 | 6c 75 65 2e 0a 0a 20 20 20 2a 20 60 28 73 65 74 2d 76 61 6c 75 65 21 20 3c 43 4f 4e 4e 45 43 54 | lue......*.`(set-value!.<CONNECT |
| a8a20 | 4f 52 3e 20 3c 4e 45 57 2d 56 41 4c 55 45 3e 20 3c 49 4e 46 4f 52 4d 41 4e 54 3e 29 27 20 69 6e | OR>.<NEW-VALUE>.<INFORMANT>)'.in |
| a8a40 | 64 69 63 61 74 65 73 20 74 68 61 74 0a 20 20 20 20 20 74 68 65 20 69 6e 66 6f 72 6d 61 6e 74 20 | dicates.that......the.informant. |
| a8a60 | 69 73 20 72 65 71 75 65 73 74 69 6e 67 20 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 20 74 6f 20 73 | is.requesting.the.connector.to.s |
| a8a80 | 65 74 20 69 74 73 20 76 61 6c 75 65 20 74 6f 20 74 68 65 0a 20 20 20 20 20 6e 65 77 20 76 61 6c | et.its.value.to.the......new.val |
| a8aa0 | 75 65 2e 0a 0a 20 20 20 2a 20 60 28 66 6f 72 67 65 74 2d 76 61 6c 75 65 21 20 3c 43 4f 4e 4e 45 | ue......*.`(forget-value!.<CONNE |
| a8ac0 | 43 54 4f 52 3e 20 3c 52 45 54 52 41 43 54 4f 52 3e 29 27 20 74 65 6c 6c 73 20 74 68 65 20 63 6f | CTOR>.<RETRACTOR>)'.tells.the.co |
| a8ae0 | 6e 6e 65 63 74 6f 72 20 74 68 61 74 0a 20 20 20 20 20 74 68 65 20 72 65 74 72 61 63 74 6f 72 20 | nnector.that......the.retractor. |
| a8b00 | 69 73 20 72 65 71 75 65 73 74 69 6e 67 20 69 74 20 74 6f 20 66 6f 72 67 65 74 20 69 74 73 20 76 | is.requesting.it.to.forget.its.v |
| a8b20 | 61 6c 75 65 2e 0a 0a 20 20 20 2a 20 60 28 63 6f 6e 6e 65 63 74 20 3c 43 4f 4e 4e 45 43 54 4f 52 | alue......*.`(connect.<CONNECTOR |
| a8b40 | 3e 20 3c 4e 45 57 2d 43 4f 4e 53 54 52 41 49 4e 54 3e 29 27 20 74 65 6c 6c 73 20 74 68 65 20 63 | >.<NEW-CONSTRAINT>)'.tells.the.c |
| a8b60 | 6f 6e 6e 65 63 74 6f 72 20 74 6f 0a 20 20 20 20 20 70 61 72 74 69 63 69 70 61 74 65 20 69 6e 20 | onnector.to......participate.in. |
| a8b80 | 74 68 65 20 6e 65 77 20 63 6f 6e 73 74 72 61 69 6e 74 2e 0a 0a 0a 20 20 20 54 68 65 20 63 6f 6e | the.new.constraint.......The.con |
| a8ba0 | 6e 65 63 74 6f 72 73 20 63 6f 6d 6d 75 6e 69 63 61 74 65 20 77 69 74 68 20 74 68 65 20 63 6f 6e | nectors.communicate.with.the.con |
| a8bc0 | 73 74 72 61 69 6e 74 73 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 74 68 65 0a 70 72 6f 63 65 64 75 | straints.by.means.of.the.procedu |
| a8be0 | 72 65 73 20 60 69 6e 66 6f 72 6d 2d 61 62 6f 75 74 2d 76 61 6c 75 65 27 2c 20 77 68 69 63 68 20 | res.`inform-about-value',.which. |
| a8c00 | 74 65 6c 6c 73 20 74 68 65 20 67 69 76 65 6e 20 63 6f 6e 73 74 72 61 69 6e 74 20 74 68 61 74 0a | tells.the.given.constraint.that. |
| a8c20 | 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 20 68 61 73 20 61 20 76 61 6c 75 65 2c 20 61 6e 64 20 60 | the.connector.has.a.value,.and.` |
| a8c40 | 69 6e 66 6f 72 6d 2d 61 62 6f 75 74 2d 6e 6f 2d 76 61 6c 75 65 27 2c 20 77 68 69 63 68 20 74 65 | inform-about-no-value',.which.te |
| a8c60 | 6c 6c 73 20 74 68 65 0a 63 6f 6e 73 74 72 61 69 6e 74 20 74 68 61 74 20 74 68 65 20 63 6f 6e 6e | lls.the.constraint.that.the.conn |
| a8c80 | 65 63 74 6f 72 20 68 61 73 20 6c 6f 73 74 20 69 74 73 20 76 61 6c 75 65 2e 0a 0a 20 20 20 60 41 | ector.has.lost.its.value......`A |
| a8ca0 | 64 64 65 72 27 20 63 6f 6e 73 74 72 75 63 74 73 20 61 6e 20 61 64 64 65 72 20 63 6f 6e 73 74 72 | dder'.constructs.an.adder.constr |
| a8cc0 | 61 69 6e 74 20 61 6d 6f 6e 67 20 73 75 6d 6d 61 6e 64 20 63 6f 6e 6e 65 63 74 6f 72 73 20 60 61 | aint.among.summand.connectors.`a |
| a8ce0 | 31 27 0a 61 6e 64 20 60 61 32 27 20 61 6e 64 20 61 20 60 73 75 6d 27 20 63 6f 6e 6e 65 63 74 6f | 1'.and.`a2'.and.a.`sum'.connecto |
| a8d00 | 72 2e 20 20 41 6e 20 61 64 64 65 72 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 61 | r...An.adder.is.implemented.as.a |
| a8d20 | 20 70 72 6f 63 65 64 75 72 65 0a 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 28 74 68 65 | .procedure.with.local.state.(the |
| a8d40 | 20 70 72 6f 63 65 64 75 72 65 20 60 6d 65 27 20 62 65 6c 6f 77 29 3a 0a 0a 20 20 20 20 20 28 64 | .procedure.`me'.below):.......(d |
| a8d60 | 65 66 69 6e 65 20 28 61 64 64 65 72 20 61 31 20 61 32 20 73 75 6d 29 0a 20 20 20 20 20 20 20 28 | efine.(adder.a1.a2.sum)........( |
| a8d80 | 64 65 66 69 6e 65 20 28 70 72 6f 63 65 73 73 2d 6e 65 77 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 | define.(process-new-value)...... |
| a8da0 | 20 20 20 20 28 63 6f 6e 64 20 28 28 61 6e 64 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 61 31 29 20 | ....(cond.((and.(has-value?.a1). |
| a8dc0 | 28 68 61 73 2d 76 61 6c 75 65 3f 20 61 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (has-value?.a2))................ |
| a8de0 | 20 28 73 65 74 2d 76 61 6c 75 65 21 20 73 75 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(set-value!.sum................ |
| a8e00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 67 65 74 2d 76 61 6c 75 65 20 61 31 29 20 28 | .............(+.(get-value.a1).( |
| a8e20 | 67 65 74 2d 76 61 6c 75 65 20 61 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | get-value.a2)).................. |
| a8e40 | 20 20 20 20 20 20 20 20 20 20 20 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ...........me))................( |
| a8e60 | 28 61 6e 64 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 61 31 29 20 28 68 61 73 2d 76 61 6c 75 65 3f | (and.(has-value?.a1).(has-value? |
| a8e80 | 20 73 75 6d 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 76 61 6c 75 | .sum)).................(set-valu |
| a8ea0 | 65 21 20 61 32 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e!.a2........................... |
| a8ec0 | 20 20 28 2d 20 28 67 65 74 2d 76 61 6c 75 65 20 73 75 6d 29 20 28 67 65 74 2d 76 61 6c 75 65 20 | ..(-.(get-value.sum).(get-value. |
| a8ee0 | 61 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | a1))............................ |
| a8f00 | 20 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 61 6e 64 20 28 68 61 73 2d | .me))................((and.(has- |
| a8f20 | 76 61 6c 75 65 3f 20 61 32 29 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 73 75 6d 29 29 0a 20 20 20 | value?.a2).(has-value?.sum)).... |
| a8f40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 76 61 6c 75 65 21 20 61 31 0a 20 20 20 20 | .............(set-value!.a1..... |
| a8f60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2d 20 28 67 65 74 2d | ........................(-.(get- |
| a8f80 | 76 61 6c 75 65 20 73 75 6d 29 20 28 67 65 74 2d 76 61 6c 75 65 20 61 32 29 29 0a 20 20 20 20 20 | value.sum).(get-value.a2))...... |
| a8fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 65 29 29 29 29 0a 20 20 | .......................me))))... |
| a8fc0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 63 65 73 73 2d 66 6f 72 67 65 74 2d 76 61 6c | .....(define.(process-forget-val |
| a8fe0 | 75 65 29 0a 20 20 20 20 20 20 20 20 20 28 66 6f 72 67 65 74 2d 76 61 6c 75 65 21 20 73 75 6d 20 | ue)..........(forget-value!.sum. |
| a9000 | 6d 65 29 0a 20 20 20 20 20 20 20 20 20 28 66 6f 72 67 65 74 2d 76 61 6c 75 65 21 20 61 31 20 6d | me)..........(forget-value!.a1.m |
| a9020 | 65 29 0a 20 20 20 20 20 20 20 20 20 28 66 6f 72 67 65 74 2d 76 61 6c 75 65 21 20 61 32 20 6d 65 | e)..........(forget-value!.a2.me |
| a9040 | 29 0a 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 6e 65 77 2d 76 61 6c 75 65 29 29 0a | )..........(process-new-value)). |
| a9060 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 65 20 72 65 71 75 65 73 74 29 0a 20 20 20 20 | .......(define.(me.request)..... |
| a9080 | 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 72 65 71 75 65 73 74 20 27 49 2d 68 61 76 65 | .....(cond.((eq?.request.'I-have |
| a90a0 | 2d 61 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 | -a-value).................(proce |
| a90c0 | 73 73 2d 6e 65 77 2d 76 61 6c 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | ss-new-value))................(( |
| a90e0 | 65 71 3f 20 72 65 71 75 65 73 74 20 27 49 2d 6c 6f 73 74 2d 6d 79 2d 76 61 6c 75 65 29 0a 20 20 | eq?.request.'I-lost-my-value)... |
| a9100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 66 6f 72 67 65 74 2d 76 61 | ..............(process-forget-va |
| a9120 | 6c 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 | lue))................(else...... |
| a9140 | 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 | ...........(error."Unknown.reque |
| a9160 | 73 74 20 2d 2d 20 41 44 44 45 52 22 20 72 65 71 75 65 73 74 29 29 29 29 0a 20 20 20 20 20 20 20 | st.--.ADDER".request))))........ |
| a9180 | 28 63 6f 6e 6e 65 63 74 20 61 31 20 6d 65 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 6e 65 63 74 20 | (connect.a1.me)........(connect. |
| a91a0 | 61 32 20 6d 65 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 6e 65 63 74 20 73 75 6d 20 6d 65 29 0a 20 | a2.me)........(connect.sum.me).. |
| a91c0 | 20 20 20 20 20 20 6d 65 29 0a 0a 20 20 20 60 41 64 64 65 72 27 20 63 6f 6e 6e 65 63 74 73 20 74 | ......me).....`Adder'.connects.t |
| a91e0 | 68 65 20 6e 65 77 20 61 64 64 65 72 20 74 6f 20 74 68 65 20 64 65 73 69 67 6e 61 74 65 64 20 63 | he.new.adder.to.the.designated.c |
| a9200 | 6f 6e 6e 65 63 74 6f 72 73 20 61 6e 64 0a 72 65 74 75 72 6e 73 20 69 74 20 61 73 20 69 74 73 20 | onnectors.and.returns.it.as.its. |
| a9220 | 76 61 6c 75 65 2e 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 6d 65 27 2c 20 77 68 69 63 | value...The.procedure.`me',.whic |
| a9240 | 68 20 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 0a 61 64 64 65 72 2c 20 61 63 74 73 20 61 73 20 | h.represents.the.adder,.acts.as. |
| a9260 | 61 20 64 69 73 70 61 74 63 68 20 74 6f 20 74 68 65 20 6c 6f 63 61 6c 20 70 72 6f 63 65 64 75 72 | a.dispatch.to.the.local.procedur |
| a9280 | 65 73 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 22 73 79 6e 74 61 78 20 69 6e 74 65 72 | es...The.following."syntax.inter |
| a92a0 | 66 61 63 65 73 22 20 28 73 65 65 20 66 6f 6f 74 6e 6f 74 65 20 2a 4e 6f 74 65 20 46 6f 6f 74 6e | faces".(see.footnote.*Note.Footn |
| a92c0 | 6f 74 65 20 32 37 3a 3a 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 33 2d 33 2d 34 3a | ote.27::.in.section.*Note.3-3-4: |
| a92e0 | 3a 29 20 61 72 65 20 75 73 65 64 20 69 6e 20 63 6f 6e 6a 75 6e 63 74 69 6f 6e 20 77 69 74 68 20 | :).are.used.in.conjunction.with. |
| a9300 | 74 68 65 20 64 69 73 70 61 74 63 68 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 66 | the.dispatch:.......(define.(inf |
| a9320 | 6f 72 6d 2d 61 62 6f 75 74 2d 76 61 6c 75 65 20 63 6f 6e 73 74 72 61 69 6e 74 29 0a 20 20 20 20 | orm-about-value.constraint)..... |
| a9340 | 20 20 20 28 63 6f 6e 73 74 72 61 69 6e 74 20 27 49 2d 68 61 76 65 2d 61 2d 76 61 6c 75 65 29 29 | ...(constraint.'I-have-a-value)) |
| a9360 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 66 6f 72 6d 2d 61 62 6f 75 74 2d 6e 6f 2d | .......(define.(inform-about-no- |
| a9380 | 76 61 6c 75 65 20 63 6f 6e 73 74 72 61 69 6e 74 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 74 72 | value.constraint)........(constr |
| a93a0 | 61 69 6e 74 20 27 49 2d 6c 6f 73 74 2d 6d 79 2d 76 61 6c 75 65 29 29 0a 0a 20 20 20 54 68 65 20 | aint.'I-lost-my-value)).....The. |
| a93c0 | 61 64 64 65 72 27 73 20 6c 6f 63 61 6c 20 70 72 6f 63 65 64 75 72 65 20 60 70 72 6f 63 65 73 73 | adder's.local.procedure.`process |
| a93e0 | 2d 6e 65 77 2d 76 61 6c 75 65 27 20 69 73 20 63 61 6c 6c 65 64 20 77 68 65 6e 20 74 68 65 0a 61 | -new-value'.is.called.when.the.a |
| a9400 | 64 64 65 72 20 69 73 20 69 6e 66 6f 72 6d 65 64 20 74 68 61 74 20 6f 6e 65 20 6f 66 20 69 74 73 | dder.is.informed.that.one.of.its |
| a9420 | 20 63 6f 6e 6e 65 63 74 6f 72 73 20 68 61 73 20 61 20 76 61 6c 75 65 2e 20 54 68 65 20 61 64 64 | .connectors.has.a.value..The.add |
| a9440 | 65 72 0a 66 69 72 73 74 20 63 68 65 63 6b 73 20 74 6f 20 73 65 65 20 69 66 20 62 6f 74 68 20 60 | er.first.checks.to.see.if.both.` |
| a9460 | 61 31 27 20 61 6e 64 20 60 61 32 27 20 68 61 76 65 20 76 61 6c 75 65 73 2e 20 49 66 20 73 6f 2c | a1'.and.`a2'.have.values..If.so, |
| a9480 | 20 69 74 20 74 65 6c 6c 73 0a 60 73 75 6d 27 20 74 6f 20 73 65 74 20 69 74 73 20 76 61 6c 75 65 | .it.tells.`sum'.to.set.its.value |
| a94a0 | 20 74 6f 20 74 68 65 20 73 75 6d 20 6f 66 20 74 68 65 20 74 77 6f 20 61 64 64 65 6e 64 73 2e 20 | .to.the.sum.of.the.two.addends.. |
| a94c0 | 20 54 68 65 20 60 69 6e 66 6f 72 6d 61 6e 74 27 0a 61 72 67 75 6d 65 6e 74 20 74 6f 20 60 73 65 | .The.`informant'.argument.to.`se |
| a94e0 | 74 2d 76 61 6c 75 65 21 27 20 69 73 20 60 6d 65 27 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 | t-value!'.is.`me',.which.is.the. |
| a9500 | 61 64 64 65 72 20 6f 62 6a 65 63 74 20 69 74 73 65 6c 66 2e 20 20 49 66 0a 60 61 31 27 20 61 6e | adder.object.itself...If.`a1'.an |
| a9520 | 64 20 60 61 32 27 20 64 6f 20 6e 6f 74 20 62 6f 74 68 20 68 61 76 65 20 76 61 6c 75 65 73 2c 20 | d.`a2'.do.not.both.have.values,. |
| a9540 | 74 68 65 6e 20 74 68 65 20 61 64 64 65 72 20 63 68 65 63 6b 73 20 74 6f 20 73 65 65 20 69 66 0a | then.the.adder.checks.to.see.if. |
| a9560 | 70 65 72 68 61 70 73 20 60 61 31 27 20 61 6e 64 20 60 73 75 6d 27 20 68 61 76 65 20 76 61 6c 75 | perhaps.`a1'.and.`sum'.have.valu |
| a9580 | 65 73 2e 20 20 49 66 20 73 6f 2c 20 69 74 20 73 65 74 73 20 60 61 32 27 20 74 6f 20 74 68 65 0a | es...If.so,.it.sets.`a2'.to.the. |
| a95a0 | 64 69 66 66 65 72 65 6e 63 65 20 6f 66 20 74 68 65 73 65 20 74 77 6f 2e 20 20 46 69 6e 61 6c 6c | difference.of.these.two...Finall |
| a95c0 | 79 2c 20 69 66 20 60 61 32 27 20 61 6e 64 20 60 73 75 6d 27 20 68 61 76 65 20 76 61 6c 75 65 73 | y,.if.`a2'.and.`sum'.have.values |
| a95e0 | 2c 20 74 68 69 73 0a 67 69 76 65 73 20 74 68 65 20 61 64 64 65 72 20 65 6e 6f 75 67 68 20 69 6e | ,.this.gives.the.adder.enough.in |
| a9600 | 66 6f 72 6d 61 74 69 6f 6e 20 74 6f 20 73 65 74 20 60 61 31 27 2e 20 20 49 66 20 74 68 65 20 61 | formation.to.set.`a1'...If.the.a |
| a9620 | 64 64 65 72 20 69 73 20 74 6f 6c 64 0a 74 68 61 74 20 6f 6e 65 20 6f 66 20 69 74 73 20 63 6f 6e | dder.is.told.that.one.of.its.con |
| a9640 | 6e 65 63 74 6f 72 73 20 68 61 73 20 6c 6f 73 74 20 61 20 76 61 6c 75 65 2c 20 69 74 20 72 65 71 | nectors.has.lost.a.value,.it.req |
| a9660 | 75 65 73 74 73 20 74 68 61 74 20 61 6c 6c 20 6f 66 20 69 74 73 0a 63 6f 6e 6e 65 63 74 6f 72 73 | uests.that.all.of.its.connectors |
| a9680 | 20 6e 6f 77 20 6c 6f 73 65 20 74 68 65 69 72 20 76 61 6c 75 65 73 2e 20 20 28 4f 6e 6c 79 20 74 | .now.lose.their.values...(Only.t |
| a96a0 | 68 6f 73 65 20 76 61 6c 75 65 73 20 74 68 61 74 20 77 65 72 65 20 73 65 74 20 62 79 0a 74 68 69 | hose.values.that.were.set.by.thi |
| a96c0 | 73 20 61 64 64 65 72 20 61 72 65 20 61 63 74 75 61 6c 6c 79 20 6c 6f 73 74 2e 29 20 20 54 68 65 | s.adder.are.actually.lost.)..The |
| a96e0 | 6e 20 69 74 20 72 75 6e 73 20 60 70 72 6f 63 65 73 73 2d 6e 65 77 2d 76 61 6c 75 65 27 2e 20 20 | n.it.runs.`process-new-value'... |
| a9700 | 54 68 65 0a 72 65 61 73 6f 6e 20 66 6f 72 20 74 68 69 73 20 6c 61 73 74 20 73 74 65 70 20 69 73 | The.reason.for.this.last.step.is |
| a9720 | 20 74 68 61 74 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 63 6f 6e 6e 65 63 74 6f 72 73 20 6d 61 79 | .that.one.or.more.connectors.may |
| a9740 | 20 73 74 69 6c 6c 20 68 61 76 65 0a 61 20 76 61 6c 75 65 20 28 74 68 61 74 20 69 73 2c 20 61 20 | .still.have.a.value.(that.is,.a. |
| a9760 | 63 6f 6e 6e 65 63 74 6f 72 20 6d 61 79 20 68 61 76 65 20 68 61 64 20 61 20 76 61 6c 75 65 20 74 | connector.may.have.had.a.value.t |
| a9780 | 68 61 74 20 77 61 73 20 6e 6f 74 0a 6f 72 69 67 69 6e 61 6c 6c 79 20 73 65 74 20 62 79 20 74 68 | hat.was.not.originally.set.by.th |
| a97a0 | 65 20 61 64 64 65 72 29 2c 20 61 6e 64 20 74 68 65 73 65 20 76 61 6c 75 65 73 20 6d 61 79 20 6e | e.adder),.and.these.values.may.n |
| a97c0 | 65 65 64 20 74 6f 20 62 65 0a 70 72 6f 70 61 67 61 74 65 64 20 62 61 63 6b 20 74 68 72 6f 75 67 | eed.to.be.propagated.back.throug |
| a97e0 | 68 20 74 68 65 20 61 64 64 65 72 2e 0a 0a 20 20 20 41 20 6d 75 6c 74 69 70 6c 69 65 72 20 69 73 | h.the.adder......A.multiplier.is |
| a9800 | 20 76 65 72 79 20 73 69 6d 69 6c 61 72 20 74 6f 20 61 6e 20 61 64 64 65 72 2e 20 49 74 20 77 69 | .very.similar.to.an.adder..It.wi |
| a9820 | 6c 6c 20 73 65 74 20 69 74 73 20 60 70 72 6f 64 75 63 74 27 0a 74 6f 20 30 20 69 66 20 65 69 74 | ll.set.its.`product'.to.0.if.eit |
| a9840 | 68 65 72 20 6f 66 20 74 68 65 20 66 61 63 74 6f 72 73 20 69 73 20 30 2c 20 65 76 65 6e 20 69 66 | her.of.the.factors.is.0,.even.if |
| a9860 | 20 74 68 65 20 6f 74 68 65 72 20 66 61 63 74 6f 72 20 69 73 20 6e 6f 74 0a 6b 6e 6f 77 6e 2e 0a | .the.other.factor.is.not.known.. |
| a9880 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 74 69 70 6c 69 65 72 20 6d 31 20 6d 32 20 | ......(define.(multiplier.m1.m2. |
| a98a0 | 70 72 6f 64 75 63 74 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 63 65 73 73 | product)........(define.(process |
| a98c0 | 2d 6e 65 77 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6f 72 20 | -new-value)..........(cond.((or. |
| a98e0 | 28 61 6e 64 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 6d 31 29 20 28 3d 20 28 67 65 74 2d 76 61 6c | (and.(has-value?.m1).(=.(get-val |
| a9900 | 75 65 20 6d 31 29 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ue.m1).0)).....................( |
| a9920 | 61 6e 64 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 6d 32 29 20 28 3d 20 28 67 65 74 2d 76 61 6c 75 | and.(has-value?.m2).(=.(get-valu |
| a9940 | 65 20 6d 32 29 20 30 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d | e.m2).0))).................(set- |
| a9960 | 76 61 6c 75 65 21 20 70 72 6f 64 75 63 74 20 30 20 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 | value!.product.0.me))........... |
| a9980 | 20 20 20 20 20 28 28 61 6e 64 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 6d 31 29 20 28 68 61 73 2d | .....((and.(has-value?.m1).(has- |
| a99a0 | 76 61 6c 75 65 3f 20 6d 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 | value?.m2)).................(set |
| a99c0 | 2d 76 61 6c 75 65 21 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -value!.product................. |
| a99e0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 67 65 74 2d 76 61 6c 75 65 20 6d 31 29 20 28 67 | ............(*.(get-value.m1).(g |
| a9a00 | 65 74 2d 76 61 6c 75 65 20 6d 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | et-value.m2))................... |
| a9a20 | 20 20 20 20 20 20 20 20 20 20 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | ..........me))................(( |
| a9a40 | 61 6e 64 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 70 72 6f 64 75 63 74 29 20 28 68 61 73 2d 76 61 | and.(has-value?.product).(has-va |
| a9a60 | 6c 75 65 3f 20 6d 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 76 | lue?.m1)).................(set-v |
| a9a80 | 61 6c 75 65 21 20 6d 32 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | alue!.m2........................ |
| a9aa0 | 20 20 20 20 20 28 2f 20 28 67 65 74 2d 76 61 6c 75 65 20 70 72 6f 64 75 63 74 29 20 28 67 65 74 | .....(/.(get-value.product).(get |
| a9ac0 | 2d 76 61 6c 75 65 20 6d 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -value.m1))..................... |
| a9ae0 | 20 20 20 20 20 20 20 20 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 61 6e | ........me))................((an |
| a9b00 | 64 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 70 72 6f 64 75 63 74 29 20 28 68 61 73 2d 76 61 6c 75 | d.(has-value?.product).(has-valu |
| a9b20 | 65 3f 20 6d 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 76 61 6c | e?.m2)).................(set-val |
| a9b40 | 75 65 21 20 6d 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ue!.m1.......................... |
| a9b60 | 20 20 20 28 2f 20 28 67 65 74 2d 76 61 6c 75 65 20 70 72 6f 64 75 63 74 29 20 28 67 65 74 2d 76 | ...(/.(get-value.product).(get-v |
| a9b80 | 61 6c 75 65 20 6d 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | alue.m2))....................... |
| a9ba0 | 20 20 20 20 20 20 6d 65 29 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f | ......me))))........(define.(pro |
| a9bc0 | 63 65 73 73 2d 66 6f 72 67 65 74 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 28 66 6f 72 | cess-forget-value)..........(for |
| a9be0 | 67 65 74 2d 76 61 6c 75 65 21 20 70 72 6f 64 75 63 74 20 6d 65 29 0a 20 20 20 20 20 20 20 20 20 | get-value!.product.me).......... |
| a9c00 | 28 66 6f 72 67 65 74 2d 76 61 6c 75 65 21 20 6d 31 20 6d 65 29 0a 20 20 20 20 20 20 20 20 20 28 | (forget-value!.m1.me)..........( |
| a9c20 | 66 6f 72 67 65 74 2d 76 61 6c 75 65 21 20 6d 32 20 6d 65 29 0a 20 20 20 20 20 20 20 20 20 28 70 | forget-value!.m2.me)..........(p |
| a9c40 | 72 6f 63 65 73 73 2d 6e 65 77 2d 76 61 6c 75 65 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e | rocess-new-value))........(defin |
| a9c60 | 65 20 28 6d 65 20 72 65 71 75 65 73 74 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 | e.(me.request)..........(cond.(( |
| a9c80 | 65 71 3f 20 72 65 71 75 65 73 74 20 27 49 2d 68 61 76 65 2d 61 2d 76 61 6c 75 65 29 0a 20 20 20 | eq?.request.'I-have-a-value).... |
| a9ca0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 6e 65 77 2d 76 61 6c 75 65 29 | .............(process-new-value) |
| a9cc0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 72 65 71 75 65 73 74 20 27 | )................((eq?.request.' |
| a9ce0 | 49 2d 6c 6f 73 74 2d 6d 79 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | I-lost-my-value)................ |
| a9d00 | 20 28 70 72 6f 63 65 73 73 2d 66 6f 72 67 65 74 2d 76 61 6c 75 65 29 29 0a 20 20 20 20 20 20 20 | .(process-forget-value))........ |
| a9d20 | 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 | ........(else.................(e |
| a9d40 | 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 2d 2d 20 4d 55 4c 54 49 50 4c | rror."Unknown.request.--.MULTIPL |
| a9d60 | 49 45 52 22 20 72 65 71 75 65 73 74 29 29 29 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 6e 65 63 74 | IER".request))))........(connect |
| a9d80 | 20 6d 31 20 6d 65 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 6e 65 63 74 20 6d 32 20 6d 65 29 0a 20 | .m1.me)........(connect.m2.me).. |
| a9da0 | 20 20 20 20 20 20 28 63 6f 6e 6e 65 63 74 20 70 72 6f 64 75 63 74 20 6d 65 29 0a 20 20 20 20 20 | ......(connect.product.me)...... |
| a9dc0 | 20 20 6d 65 29 0a 0a 20 20 20 41 20 60 63 6f 6e 73 74 61 6e 74 27 20 63 6f 6e 73 74 72 75 63 74 | ..me).....A.`constant'.construct |
| a9de0 | 6f 72 20 73 69 6d 70 6c 79 20 73 65 74 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 | or.simply.sets.the.value.of.the. |
| a9e00 | 64 65 73 69 67 6e 61 74 65 64 0a 63 6f 6e 6e 65 63 74 6f 72 2e 20 20 41 6e 79 20 60 49 2d 68 61 | designated.connector...Any.`I-ha |
| a9e20 | 76 65 2d 61 2d 76 61 6c 75 65 27 20 6f 72 20 60 49 2d 6c 6f 73 74 2d 6d 79 2d 76 61 6c 75 65 27 | ve-a-value'.or.`I-lost-my-value' |
| a9e40 | 20 6d 65 73 73 61 67 65 20 73 65 6e 74 20 74 6f 0a 74 68 65 20 63 6f 6e 73 74 61 6e 74 20 62 6f | .message.sent.to.the.constant.bo |
| a9e60 | 78 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 61 6e 20 65 72 72 6f 72 2e 0a 0a 20 20 20 20 20 28 | x.will.produce.an.error........( |
| a9e80 | 64 65 66 69 6e 65 20 28 63 6f 6e 73 74 61 6e 74 20 76 61 6c 75 65 20 63 6f 6e 6e 65 63 74 6f 72 | define.(constant.value.connector |
| a9ea0 | 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 65 20 72 65 71 75 65 73 74 29 0a 20 20 | )........(define.(me.request)... |
| a9ec0 | 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 2d | .......(error."Unknown.request.- |
| a9ee0 | 2d 20 43 4f 4e 53 54 41 4e 54 22 20 72 65 71 75 65 73 74 29 29 0a 20 20 20 20 20 20 20 28 63 6f | -.CONSTANT".request))........(co |
| a9f00 | 6e 6e 65 63 74 20 63 6f 6e 6e 65 63 74 6f 72 20 6d 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 2d | nnect.connector.me)........(set- |
| a9f20 | 76 61 6c 75 65 21 20 63 6f 6e 6e 65 63 74 6f 72 20 76 61 6c 75 65 20 6d 65 29 0a 20 20 20 20 20 | value!.connector.value.me)...... |
| a9f40 | 20 20 6d 65 29 0a 0a 20 20 20 46 69 6e 61 6c 6c 79 2c 20 61 20 70 72 6f 62 65 20 70 72 69 6e 74 | ..me).....Finally,.a.probe.print |
| a9f60 | 73 20 61 20 6d 65 73 73 61 67 65 20 61 62 6f 75 74 20 74 68 65 20 73 65 74 74 69 6e 67 20 6f 72 | s.a.message.about.the.setting.or |
| a9f80 | 20 75 6e 73 65 74 74 69 6e 67 20 6f 66 0a 74 68 65 20 64 65 73 69 67 6e 61 74 65 64 20 63 6f 6e | .unsetting.of.the.designated.con |
| a9fa0 | 6e 65 63 74 6f 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 62 65 20 6e 61 6d | nector:.......(define.(probe.nam |
| a9fc0 | 65 20 63 6f 6e 6e 65 63 74 6f 72 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 69 | e.connector)........(define.(pri |
| a9fe0 | 6e 74 2d 70 72 6f 62 65 20 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e | nt-probe.value)..........(newlin |
| aa000 | 65 29 0a 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 22 50 72 6f 62 65 3a 20 22 29 0a | e)..........(display."Probe:."). |
| aa020 | 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 20 | .........(display.name)......... |
| aa040 | 20 28 64 69 73 70 6c 61 79 20 22 20 3d 20 22 29 0a 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c | .(display.".=.")..........(displ |
| aa060 | 61 79 20 76 61 6c 75 65 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 63 65 | ay.value))........(define.(proce |
| aa080 | 73 73 2d 6e 65 77 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 28 70 72 69 6e 74 2d 70 72 | ss-new-value)..........(print-pr |
| aa0a0 | 6f 62 65 20 28 67 65 74 2d 76 61 6c 75 65 20 63 6f 6e 6e 65 63 74 6f 72 29 29 29 0a 20 20 20 20 | obe.(get-value.connector)))..... |
| aa0c0 | 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 63 65 73 73 2d 66 6f 72 67 65 74 2d 76 61 6c 75 65 | ...(define.(process-forget-value |
| aa0e0 | 29 0a 20 20 20 20 20 20 20 20 20 28 70 72 69 6e 74 2d 70 72 6f 62 65 20 22 3f 22 29 29 0a 20 20 | )..........(print-probe."?"))... |
| aa100 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 65 20 72 65 71 75 65 73 74 29 0a 20 20 20 20 20 20 | .....(define.(me.request)....... |
| aa120 | 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 72 65 71 75 65 73 74 20 27 49 2d 68 61 76 65 2d 61 | ...(cond.((eq?.request.'I-have-a |
| aa140 | 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 73 73 | -value).................(process |
| aa160 | 2d 6e 65 77 2d 76 61 6c 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 | -new-value))................((eq |
| aa180 | 3f 20 72 65 71 75 65 73 74 20 27 49 2d 6c 6f 73 74 2d 6d 79 2d 76 61 6c 75 65 29 0a 20 20 20 20 | ?.request.'I-lost-my-value)..... |
| aa1a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 73 73 2d 66 6f 72 67 65 74 2d 76 61 6c 75 | ............(process-forget-valu |
| aa1c0 | 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 | e))................(else........ |
| aa1e0 | 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 | .........(error."Unknown.request |
| aa200 | 20 2d 2d 20 50 52 4f 42 45 22 20 72 65 71 75 65 73 74 29 29 29 29 0a 20 20 20 20 20 20 20 28 63 | .--.PROBE".request))))........(c |
| aa220 | 6f 6e 6e 65 63 74 20 63 6f 6e 6e 65 63 74 6f 72 20 6d 65 29 0a 20 20 20 20 20 20 20 6d 65 29 0a | onnect.connector.me)........me). |
| aa240 | 0a 52 65 70 72 65 73 65 6e 74 69 6e 67 20 63 6f 6e 6e 65 63 74 6f 72 73 0a 2e 2e 2e 2e 2e 2e 2e | .Representing.connectors........ |
| aa260 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 20 63 6f 6e 6e 65 63 74 6f 72 20 69 73 | ..................A.connector.is |
| aa280 | 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 61 6c 20 6f 62 6a | .represented.as.a.procedural.obj |
| aa2a0 | 65 63 74 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 0a 76 61 72 69 61 62 6c 65 73 20 60 | ect.with.local.state.variables.` |
| aa2c0 | 76 61 6c 75 65 27 2c 20 74 68 65 20 63 75 72 72 65 6e 74 20 76 61 6c 75 65 20 6f 66 20 74 68 65 | value',.the.current.value.of.the |
| aa2e0 | 20 63 6f 6e 6e 65 63 74 6f 72 3b 20 60 69 6e 66 6f 72 6d 61 6e 74 27 2c 20 74 68 65 0a 6f 62 6a | .connector;.`informant',.the.obj |
| aa300 | 65 63 74 20 74 68 61 74 20 73 65 74 20 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 27 73 20 76 61 6c | ect.that.set.the.connector's.val |
| aa320 | 75 65 3b 20 61 6e 64 20 60 63 6f 6e 73 74 72 61 69 6e 74 73 27 2c 20 61 20 6c 69 73 74 20 6f 66 | ue;.and.`constraints',.a.list.of |
| aa340 | 20 74 68 65 0a 63 6f 6e 73 74 72 61 69 6e 74 73 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 63 6f | .the.constraints.in.which.the.co |
| aa360 | 6e 6e 65 63 74 6f 72 20 70 61 72 74 69 63 69 70 61 74 65 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 | nnector.participates........(def |
| aa380 | 69 6e 65 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 0a 20 20 20 20 20 20 20 28 6c 65 74 | ine.(make-connector)........(let |
| aa3a0 | 20 28 28 76 61 6c 75 65 20 66 61 6c 73 65 29 20 28 69 6e 66 6f 72 6d 61 6e 74 20 66 61 6c 73 65 | .((value.false).(informant.false |
| aa3c0 | 29 20 28 63 6f 6e 73 74 72 61 69 6e 74 73 20 27 28 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 | ).(constraints.'()))..........(d |
| aa3e0 | 65 66 69 6e 65 20 28 73 65 74 2d 6d 79 2d 76 61 6c 75 65 20 6e 65 77 76 61 6c 20 73 65 74 74 65 | efine.(set-my-value.newval.sette |
| aa400 | 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 6f 74 20 28 68 61 73 2d 76 | r)............(cond.((not.(has-v |
| aa420 | 61 6c 75 65 3f 20 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 | alue?.me))...................(se |
| aa440 | 74 21 20 76 61 6c 75 65 20 6e 65 77 76 61 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | t!.value.newval)................ |
| aa460 | 20 20 20 28 73 65 74 21 20 69 6e 66 6f 72 6d 61 6e 74 20 73 65 74 74 65 72 29 0a 20 20 20 20 20 | ...(set!.informant.setter)...... |
| aa480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 2d 65 78 63 65 70 74 20 73 65 | .............(for-each-except.se |
| aa4a0 | 74 74 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tter............................ |
| aa4c0 | 20 20 20 20 20 20 20 20 69 6e 66 6f 72 6d 2d 61 62 6f 75 74 2d 76 61 6c 75 65 0a 20 20 20 20 20 | ........inform-about-value...... |
| aa4e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f | ..............................co |
| aa500 | 6e 73 74 72 61 69 6e 74 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e | nstraints))..................((n |
| aa520 | 6f 74 20 28 3d 20 76 61 6c 75 65 20 6e 65 77 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ot.(=.value.newval))............ |
| aa540 | 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 43 6f 6e 74 72 61 64 69 63 74 69 6f 6e 22 20 28 6c | .......(error."Contradiction".(l |
| aa560 | 69 73 74 20 76 61 6c 75 65 20 6e 65 77 76 61 6c 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ist.value.newval)))............. |
| aa580 | 20 20 20 20 20 28 65 6c 73 65 20 27 69 67 6e 6f 72 65 64 29 29 29 0a 20 20 20 20 20 20 20 20 20 | .....(else.'ignored))).......... |
| aa5a0 | 28 64 65 66 69 6e 65 20 28 66 6f 72 67 65 74 2d 6d 79 2d 76 61 6c 75 65 20 72 65 74 72 61 63 74 | (define.(forget-my-value.retract |
| aa5c0 | 6f 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 71 3f 20 72 65 74 72 61 63 74 6f | or)............(if.(eq?.retracto |
| aa5e0 | 72 20 69 6e 66 6f 72 6d 61 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 | r.informant)................(beg |
| aa600 | 69 6e 20 28 73 65 74 21 20 69 6e 66 6f 72 6d 61 6e 74 20 66 61 6c 73 65 29 0a 20 20 20 20 20 20 | in.(set!.informant.false)....... |
| aa620 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 2d 65 78 63 65 70 74 | ................(for-each-except |
| aa640 | 20 72 65 74 72 61 63 74 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .retractor...................... |
| aa660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 66 6f 72 6d 2d 61 62 6f 75 74 2d 6e | ..................inform-about-n |
| aa680 | 6f 2d 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | o-value......................... |
| aa6a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 72 61 69 6e 74 73 29 29 0a 20 20 20 | ...............constraints)).... |
| aa6c0 | 20 20 20 20 20 20 20 20 20 20 20 20 27 69 67 6e 6f 72 65 64 29 29 0a 20 20 20 20 20 20 20 20 20 | ............'ignored)).......... |
| aa6e0 | 28 64 65 66 69 6e 65 20 28 63 6f 6e 6e 65 63 74 20 6e 65 77 2d 63 6f 6e 73 74 72 61 69 6e 74 29 | (define.(connect.new-constraint) |
| aa700 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6d 65 6d 71 20 6e 65 77 2d 63 | ............(if.(not.(memq.new-c |
| aa720 | 6f 6e 73 74 72 61 69 6e 74 20 63 6f 6e 73 74 72 61 69 6e 74 73 29 29 0a 20 20 20 20 20 20 20 20 | onstraint.constraints))......... |
| aa740 | 20 20 20 20 20 20 20 28 73 65 74 21 20 63 6f 6e 73 74 72 61 69 6e 74 73 0a 20 20 20 20 20 20 20 | .......(set!.constraints........ |
| aa760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 6e 65 77 2d 63 6f 6e 73 74 72 61 69 | ..............(cons.new-constrai |
| aa780 | 6e 74 20 63 6f 6e 73 74 72 61 69 6e 74 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 | nt.constraints)))............(if |
| aa7a0 | 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(has-value?.me)................ |
| aa7c0 | 28 69 6e 66 6f 72 6d 2d 61 62 6f 75 74 2d 76 61 6c 75 65 20 6e 65 77 2d 63 6f 6e 73 74 72 61 69 | (inform-about-value.new-constrai |
| aa7e0 | 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 64 6f 6e 65 29 0a 20 20 20 20 20 20 20 20 20 | nt))............'done).......... |
| aa800 | 28 64 65 66 69 6e 65 20 28 6d 65 20 72 65 71 75 65 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (define.(me.request)............ |
| aa820 | 28 63 6f 6e 64 20 28 28 65 71 3f 20 72 65 71 75 65 73 74 20 27 68 61 73 2d 76 61 6c 75 65 3f 29 | (cond.((eq?.request.'has-value?) |
| aa840 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 69 6e 66 6f 72 6d 61 6e 74 | ...................(if.informant |
| aa860 | 20 74 72 75 65 20 66 61 6c 73 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .true.false))..................( |
| aa880 | 28 65 71 3f 20 72 65 71 75 65 73 74 20 27 76 61 6c 75 65 29 20 76 61 6c 75 65 29 0a 20 20 20 20 | (eq?.request.'value).value)..... |
| aa8a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 72 65 71 75 65 73 74 20 27 73 65 74 2d | .............((eq?.request.'set- |
| aa8c0 | 76 61 6c 75 65 21 29 20 73 65 74 2d 6d 79 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 | value!).set-my-value)........... |
| aa8e0 | 20 20 20 20 20 20 20 28 28 65 71 3f 20 72 65 71 75 65 73 74 20 27 66 6f 72 67 65 74 29 20 66 6f | .......((eq?.request.'forget).fo |
| aa900 | 72 67 65 74 2d 6d 79 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rget-my-value).................. |
| aa920 | 28 28 65 71 3f 20 72 65 71 75 65 73 74 20 27 63 6f 6e 6e 65 63 74 29 20 63 6f 6e 6e 65 63 74 29 | ((eq?.request.'connect).connect) |
| aa940 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 | ..................(else.(error." |
| aa960 | 55 6e 6b 6e 6f 77 6e 20 6f 70 65 72 61 74 69 6f 6e 20 2d 2d 20 43 4f 4e 4e 45 43 54 4f 52 22 0a | Unknown.operation.--.CONNECTOR". |
| aa980 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 | ..............................re |
| aa9a0 | 71 75 65 73 74 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 6d 65 29 29 0a 0a 20 20 20 54 68 65 20 | quest))))..........me)).....The. |
| aa9c0 | 63 6f 6e 6e 65 63 74 6f 72 27 73 20 6c 6f 63 61 6c 20 70 72 6f 63 65 64 75 72 65 20 60 73 65 74 | connector's.local.procedure.`set |
| aa9e0 | 2d 6d 79 2d 76 61 6c 75 65 27 20 69 73 20 63 61 6c 6c 65 64 20 77 68 65 6e 20 74 68 65 72 65 0a | -my-value'.is.called.when.there. |
| aaa00 | 69 73 20 61 20 72 65 71 75 65 73 74 20 74 6f 20 73 65 74 20 74 68 65 20 63 6f 6e 6e 65 63 74 6f | is.a.request.to.set.the.connecto |
| aaa20 | 72 27 73 20 76 61 6c 75 65 2e 20 20 49 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 20 64 6f 65 | r's.value...If.the.connector.doe |
| aaa40 | 73 20 6e 6f 74 0a 63 75 72 72 65 6e 74 6c 79 20 68 61 76 65 20 61 20 76 61 6c 75 65 2c 20 69 74 | s.not.currently.have.a.value,.it |
| aaa60 | 20 77 69 6c 6c 20 73 65 74 20 69 74 73 20 76 61 6c 75 65 20 61 6e 64 20 72 65 6d 65 6d 62 65 72 | .will.set.its.value.and.remember |
| aaa80 | 20 61 73 0a 60 69 6e 66 6f 72 6d 61 6e 74 27 20 74 68 65 20 63 6f 6e 73 74 72 61 69 6e 74 20 74 | .as.`informant'.the.constraint.t |
| aaaa0 | 68 61 74 20 72 65 71 75 65 73 74 65 64 20 74 68 65 20 76 61 6c 75 65 20 74 6f 20 62 65 20 73 65 | hat.requested.the.value.to.be.se |
| aaac0 | 74 2e 28 32 29 20 20 54 68 65 6e 0a 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 20 77 69 6c 6c 20 6e | t.(2)..Then.the.connector.will.n |
| aaae0 | 6f 74 69 66 79 20 61 6c 6c 20 6f 66 20 69 74 73 20 70 61 72 74 69 63 69 70 61 74 69 6e 67 20 63 | otify.all.of.its.participating.c |
| aab00 | 6f 6e 73 74 72 61 69 6e 74 73 20 65 78 63 65 70 74 0a 74 68 65 20 63 6f 6e 73 74 72 61 69 6e 74 | onstraints.except.the.constraint |
| aab20 | 20 74 68 61 74 20 72 65 71 75 65 73 74 65 64 20 74 68 65 20 76 61 6c 75 65 20 74 6f 20 62 65 20 | .that.requested.the.value.to.be. |
| aab40 | 73 65 74 2e 20 20 54 68 69 73 20 69 73 0a 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 75 73 69 6e 67 | set...This.is.accomplished.using |
| aab60 | 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 69 74 65 72 61 74 6f 72 2c 20 77 68 69 63 68 20 61 | .the.following.iterator,.which.a |
| aab80 | 70 70 6c 69 65 73 20 61 20 64 65 73 69 67 6e 61 74 65 64 0a 70 72 6f 63 65 64 75 72 65 20 74 6f | pplies.a.designated.procedure.to |
| aaba0 | 20 61 6c 6c 20 69 74 65 6d 73 20 69 6e 20 61 20 6c 69 73 74 20 65 78 63 65 70 74 20 61 20 67 69 | .all.items.in.a.list.except.a.gi |
| aabc0 | 76 65 6e 20 6f 6e 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6f 72 2d 65 61 63 68 | ven.one:.......(define.(for-each |
| aabe0 | 2d 65 78 63 65 70 74 20 65 78 63 65 70 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 6c 69 73 74 | -except.exception.procedure.list |
| aac00 | 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 70 20 69 74 65 6d 73 29 0a 20 20 | )........(define.(loop.items)... |
| aac20 | 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 20 27 64 6f 6e | .......(cond.((null?.items).'don |
| aac40 | 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 28 63 61 72 20 69 74 65 | e)................((eq?.(car.ite |
| aac60 | 6d 73 29 20 65 78 63 65 70 74 69 6f 6e 29 20 28 6c 6f 6f 70 20 28 63 64 72 20 69 74 65 6d 73 29 | ms).exception).(loop.(cdr.items) |
| aac80 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 70 72 6f 63 65 64 75 | ))................(else.(procedu |
| aaca0 | 72 65 20 28 63 61 72 20 69 74 65 6d 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | re.(car.items))................. |
| aacc0 | 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 64 72 20 69 74 65 6d 73 29 29 29 29 29 0a 20 20 20 20 20 | .....(loop.(cdr.items)))))...... |
| aace0 | 20 20 28 6c 6f 6f 70 20 6c 69 73 74 29 29 0a 0a 20 20 20 49 66 20 61 20 63 6f 6e 6e 65 63 74 6f | ..(loop.list)).....If.a.connecto |
| aad00 | 72 20 69 73 20 61 73 6b 65 64 20 74 6f 20 66 6f 72 67 65 74 20 69 74 73 20 76 61 6c 75 65 2c 20 | r.is.asked.to.forget.its.value,. |
| aad20 | 69 74 20 72 75 6e 73 20 74 68 65 20 6c 6f 63 61 6c 0a 70 72 6f 63 65 64 75 72 65 20 60 66 6f 72 | it.runs.the.local.procedure.`for |
| aad40 | 67 65 74 2d 6d 79 2d 76 61 6c 75 65 27 2c 20 77 68 69 63 68 20 66 69 72 73 74 20 63 68 65 63 6b | get-my-value',.which.first.check |
| aad60 | 73 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 20 74 68 61 74 20 74 68 65 0a 72 65 71 75 65 73 74 20 | s.to.make.sure.that.the.request. |
| aad80 | 69 73 20 63 6f 6d 69 6e 67 20 66 72 6f 6d 20 74 68 65 20 73 61 6d 65 20 6f 62 6a 65 63 74 20 74 | is.coming.from.the.same.object.t |
| aada0 | 68 61 74 20 73 65 74 20 74 68 65 20 76 61 6c 75 65 20 6f 72 69 67 69 6e 61 6c 6c 79 2e 0a 49 66 | hat.set.the.value.originally..If |
| aadc0 | 20 73 6f 2c 20 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 20 69 6e 66 6f 72 6d 73 20 69 74 73 20 61 | .so,.the.connector.informs.its.a |
| aade0 | 73 73 6f 63 69 61 74 65 64 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 61 62 6f 75 74 20 74 68 65 20 | ssociated.constraints.about.the. |
| aae00 | 6c 6f 73 73 0a 6f 66 20 74 68 65 20 76 61 6c 75 65 2e 0a 0a 20 20 20 54 68 65 20 6c 6f 63 61 6c | loss.of.the.value......The.local |
| aae20 | 20 70 72 6f 63 65 64 75 72 65 20 60 63 6f 6e 6e 65 63 74 27 20 61 64 64 73 20 74 68 65 20 64 65 | .procedure.`connect'.adds.the.de |
| aae40 | 73 69 67 6e 61 74 65 64 20 6e 65 77 20 63 6f 6e 73 74 72 61 69 6e 74 20 74 6f 0a 74 68 65 20 6c | signated.new.constraint.to.the.l |
| aae60 | 69 73 74 20 6f 66 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 69 66 20 69 74 20 69 73 20 6e 6f 74 20 | ist.of.constraints.if.it.is.not. |
| aae80 | 61 6c 72 65 61 64 79 20 69 6e 20 74 68 61 74 20 6c 69 73 74 2e 20 20 54 68 65 6e 2c 20 69 66 0a | already.in.that.list...Then,.if. |
| aaea0 | 74 68 65 20 63 6f 6e 6e 65 63 74 6f 72 20 68 61 73 20 61 20 76 61 6c 75 65 2c 20 69 74 20 69 6e | the.connector.has.a.value,.it.in |
| aaec0 | 66 6f 72 6d 73 20 74 68 65 20 6e 65 77 20 63 6f 6e 73 74 72 61 69 6e 74 20 6f 66 20 74 68 69 73 | forms.the.new.constraint.of.this |
| aaee0 | 20 66 61 63 74 2e 0a 0a 20 20 20 54 68 65 20 63 6f 6e 6e 65 63 74 6f 72 27 73 20 70 72 6f 63 65 | .fact......The.connector's.proce |
| aaf00 | 64 75 72 65 20 60 6d 65 27 20 73 65 72 76 65 73 20 61 73 20 61 20 64 69 73 70 61 74 63 68 20 74 | dure.`me'.serves.as.a.dispatch.t |
| aaf20 | 6f 20 74 68 65 20 6f 74 68 65 72 0a 69 6e 74 65 72 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 73 20 | o.the.other.internal.procedures. |
| aaf40 | 61 6e 64 20 61 6c 73 6f 20 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 20 63 6f 6e 6e 65 63 74 6f | and.also.represents.the.connecto |
| aaf60 | 72 20 61 73 20 61 6e 20 6f 62 6a 65 63 74 2e 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 | r.as.an.object..The.following.pr |
| aaf80 | 6f 63 65 64 75 72 65 73 20 70 72 6f 76 69 64 65 20 61 20 73 79 6e 74 61 78 20 69 6e 74 65 72 66 | ocedures.provide.a.syntax.interf |
| aafa0 | 61 63 65 20 66 6f 72 20 74 68 65 20 64 69 73 70 61 74 63 68 3a 0a 0a 20 20 20 20 20 28 64 65 66 | ace.for.the.dispatch:.......(def |
| aafc0 | 69 6e 65 20 28 68 61 73 2d 76 61 6c 75 65 3f 20 63 6f 6e 6e 65 63 74 6f 72 29 0a 20 20 20 20 20 | ine.(has-value?.connector)...... |
| aafe0 | 20 20 28 63 6f 6e 6e 65 63 74 6f 72 20 27 68 61 73 2d 76 61 6c 75 65 3f 29 29 0a 0a 20 20 20 20 | ..(connector.'has-value?))...... |
| ab000 | 20 28 64 65 66 69 6e 65 20 28 67 65 74 2d 76 61 6c 75 65 20 63 6f 6e 6e 65 63 74 6f 72 29 0a 20 | .(define.(get-value.connector).. |
| ab020 | 20 20 20 20 20 20 28 63 6f 6e 6e 65 63 74 6f 72 20 27 76 61 6c 75 65 29 29 0a 0a 20 20 20 20 20 | ......(connector.'value))....... |
| ab040 | 28 64 65 66 69 6e 65 20 28 73 65 74 2d 76 61 6c 75 65 21 20 63 6f 6e 6e 65 63 74 6f 72 20 6e 65 | (define.(set-value!.connector.ne |
| ab060 | 77 2d 76 61 6c 75 65 20 69 6e 66 6f 72 6d 61 6e 74 29 0a 20 20 20 20 20 20 20 28 28 63 6f 6e 6e | w-value.informant)........((conn |
| ab080 | 65 63 74 6f 72 20 27 73 65 74 2d 76 61 6c 75 65 21 29 20 6e 65 77 2d 76 61 6c 75 65 20 69 6e 66 | ector.'set-value!).new-value.inf |
| ab0a0 | 6f 72 6d 61 6e 74 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6f 72 67 65 74 2d 76 | ormant)).......(define.(forget-v |
| ab0c0 | 61 6c 75 65 21 20 63 6f 6e 6e 65 63 74 6f 72 20 72 65 74 72 61 63 74 6f 72 29 0a 20 20 20 20 20 | alue!.connector.retractor)...... |
| ab0e0 | 20 20 28 28 63 6f 6e 6e 65 63 74 6f 72 20 27 66 6f 72 67 65 74 29 20 72 65 74 72 61 63 74 6f 72 | ..((connector.'forget).retractor |
| ab100 | 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 6e 65 63 74 20 63 6f 6e 6e 65 63 | )).......(define.(connect.connec |
| ab120 | 74 6f 72 20 6e 65 77 2d 63 6f 6e 73 74 72 61 69 6e 74 29 0a 20 20 20 20 20 20 20 28 28 63 6f 6e | tor.new-constraint)........((con |
| ab140 | 6e 65 63 74 6f 72 20 27 63 6f 6e 6e 65 63 74 29 20 6e 65 77 2d 63 6f 6e 73 74 72 61 69 6e 74 29 | nector.'connect).new-constraint) |
| ab160 | 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 33 33 3a 2a 20 55 73 69 6e 67 20 70 | ).......*Exercise.3.33:*.Using.p |
| ab180 | 72 69 6d 69 74 69 76 65 20 6d 75 6c 74 69 70 6c 69 65 72 2c 20 61 64 64 65 72 2c 20 61 6e 64 20 | rimitive.multiplier,.adder,.and. |
| ab1a0 | 63 6f 6e 73 74 61 6e 74 0a 20 20 20 20 20 63 6f 6e 73 74 72 61 69 6e 74 73 2c 20 64 65 66 69 6e | constant......constraints,.defin |
| ab1c0 | 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 61 76 65 72 61 67 65 72 27 20 74 68 61 74 20 74 61 | e.a.procedure.`averager'.that.ta |
| ab1e0 | 6b 65 73 20 74 68 72 65 65 0a 20 20 20 20 20 63 6f 6e 6e 65 63 74 6f 72 73 20 60 61 27 2c 20 60 | kes.three......connectors.`a',.` |
| ab200 | 62 27 2c 20 61 6e 64 20 60 63 27 20 61 73 20 69 6e 70 75 74 73 20 61 6e 64 20 65 73 74 61 62 6c | b',.and.`c'.as.inputs.and.establ |
| ab220 | 69 73 68 65 73 20 74 68 65 0a 20 20 20 20 20 63 6f 6e 73 74 72 61 69 6e 74 20 74 68 61 74 20 74 | ishes.the......constraint.that.t |
| ab240 | 68 65 20 76 61 6c 75 65 20 6f 66 20 60 63 27 20 69 73 20 74 68 65 20 61 76 65 72 61 67 65 20 6f | he.value.of.`c'.is.the.average.o |
| ab260 | 66 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 0a 20 20 20 20 20 60 61 27 20 61 6e 64 20 60 62 27 | f.the.values.of......`a'.and.`b' |
| ab280 | 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 33 34 3a 2a 20 4c 6f 75 69 73 20 52 | ........*Exercise.3.34:*.Louis.R |
| ab2a0 | 65 61 73 6f 6e 65 72 20 77 61 6e 74 73 20 74 6f 20 62 75 69 6c 64 20 61 20 73 71 75 61 72 65 72 | easoner.wants.to.build.a.squarer |
| ab2c0 | 2c 20 61 0a 20 20 20 20 20 63 6f 6e 73 74 72 61 69 6e 74 20 64 65 76 69 63 65 20 77 69 74 68 20 | ,.a......constraint.device.with. |
| ab2e0 | 74 77 6f 20 74 65 72 6d 69 6e 61 6c 73 20 73 75 63 68 20 74 68 61 74 20 74 68 65 20 76 61 6c 75 | two.terminals.such.that.the.valu |
| ab300 | 65 20 6f 66 0a 20 20 20 20 20 63 6f 6e 6e 65 63 74 6f 72 20 60 62 27 20 6f 6e 20 74 68 65 20 73 | e.of......connector.`b'.on.the.s |
| ab320 | 65 63 6f 6e 64 20 74 65 72 6d 69 6e 61 6c 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 74 68 | econd.terminal.will.always.be.th |
| ab340 | 65 20 73 71 75 61 72 65 20 6f 66 0a 20 20 20 20 20 74 68 65 20 76 61 6c 75 65 20 60 61 27 20 6f | e.square.of......the.value.`a'.o |
| ab360 | 6e 20 74 68 65 20 66 69 72 73 74 20 74 65 72 6d 69 6e 61 6c 2e 20 20 48 65 20 70 72 6f 70 6f 73 | n.the.first.terminal...He.propos |
| ab380 | 65 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 20 20 20 20 20 73 69 6d 70 6c 65 20 64 65 76 | es.the.following......simple.dev |
| ab3a0 | 69 63 65 20 6d 61 64 65 20 66 72 6f 6d 20 61 20 6d 75 6c 74 69 70 6c 69 65 72 3a 0a 0a 20 20 20 | ice.made.from.a.multiplier:..... |
| ab3c0 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 72 20 61 20 62 29 0a 20 20 20 | .......(define.(squarer.a.b).... |
| ab3e0 | 20 20 20 20 20 20 20 20 20 28 6d 75 6c 74 69 70 6c 69 65 72 20 61 20 61 20 62 29 29 0a 0a 20 20 | .........(multiplier.a.a.b)).... |
| ab400 | 20 20 20 54 68 65 72 65 20 69 73 20 61 20 73 65 72 69 6f 75 73 20 66 6c 61 77 20 69 6e 20 74 68 | ...There.is.a.serious.flaw.in.th |
| ab420 | 69 73 20 69 64 65 61 2e 20 20 45 78 70 6c 61 69 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | is.idea...Explain........*Exerci |
| ab440 | 73 65 20 33 2e 33 35 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 74 65 6c 6c 73 20 4c 6f | se.3.35:*.Ben.Bitdiddle.tells.Lo |
| ab460 | 75 69 73 20 74 68 61 74 20 6f 6e 65 20 77 61 79 20 74 6f 20 61 76 6f 69 64 0a 20 20 20 20 20 74 | uis.that.one.way.to.avoid......t |
| ab480 | 68 65 20 74 72 6f 75 62 6c 65 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 33 | he.trouble.in.*Note.Exercise.3-3 |
| ab4a0 | 34 3a 3a 20 69 73 20 74 6f 20 64 65 66 69 6e 65 20 61 20 73 71 75 61 72 65 72 20 61 73 20 61 0a | 4::.is.to.define.a.squarer.as.a. |
| ab4c0 | 20 20 20 20 20 6e 65 77 20 70 72 69 6d 69 74 69 76 65 20 63 6f 6e 73 74 72 61 69 6e 74 2e 20 20 | .....new.primitive.constraint... |
| ab4e0 | 46 69 6c 6c 20 69 6e 20 74 68 65 20 6d 69 73 73 69 6e 67 20 70 6f 72 74 69 6f 6e 73 20 69 6e 20 | Fill.in.the.missing.portions.in. |
| ab500 | 42 65 6e 27 73 0a 20 20 20 20 20 6f 75 74 6c 69 6e 65 20 66 6f 72 20 61 20 70 72 6f 63 65 64 75 | Ben's......outline.for.a.procedu |
| ab520 | 72 65 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 73 75 63 68 20 61 20 63 6f 6e 73 74 72 61 69 6e | re.to.implement.such.a.constrain |
| ab540 | 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 72 20 61 | t:............(define.(squarer.a |
| ab560 | 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 63 65 73 73 | .b).............(define.(process |
| ab580 | 2d 6e 65 77 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 68 | -new-value)...............(if.(h |
| ab5a0 | 61 73 2d 76 61 6c 75 65 3f 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | as-value?.b)...................( |
| ab5c0 | 69 66 20 28 3c 20 28 67 65 74 2d 76 61 6c 75 65 20 62 29 20 30 29 0a 20 20 20 20 20 20 20 20 20 | if.(<.(get-value.b).0).......... |
| ab5e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 73 71 75 61 72 65 20 6c 65 73 73 | .............(error."square.less |
| ab600 | 20 74 68 61 6e 20 30 20 2d 2d 20 53 51 55 41 52 45 52 22 20 28 67 65 74 2d 76 61 6c 75 65 20 62 | .than.0.--.SQUARER".(get-value.b |
| ab620 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 41 4c 54 45 52 4e | )).......................<ALTERN |
| ab640 | 41 54 49 56 45 31 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 41 4c 54 45 | ATIVE1>)...................<ALTE |
| ab660 | 52 4e 41 54 49 56 45 32 3e 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | RNATIVE2>)).............(define. |
| ab680 | 28 70 72 6f 63 65 73 73 2d 66 6f 72 67 65 74 2d 76 61 6c 75 65 29 20 3c 42 4f 44 59 31 3e 29 0a | (process-forget-value).<BODY1>). |
| ab6a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 65 20 72 65 71 75 65 73 74 29 | ............(define.(me.request) |
| ab6c0 | 20 3c 42 4f 44 59 32 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 52 45 53 54 20 4f 46 20 44 | .<BODY2>).............<REST.OF.D |
| ab6e0 | 45 46 49 4e 49 54 49 4f 4e 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 6d 65 29 0a 0a 20 20 20 20 | EFINITION>.............me)...... |
| ab700 | 20 2a 45 78 65 72 63 69 73 65 20 33 2e 33 36 3a 2a 20 53 75 70 70 6f 73 65 20 77 65 20 65 76 61 | .*Exercise.3.36:*.Suppose.we.eva |
| ab720 | 6c 75 61 74 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 65 71 75 65 6e 63 65 20 6f 66 0a | luate.the.following.sequence.of. |
| ab740 | 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 | .....expressions.in.the.global.e |
| ab760 | 6e 76 69 72 6f 6e 6d 65 6e 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 61 | nvironment:............(define.a |
| ab780 | 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | .(make-connector))...........(de |
| ab7a0 | 66 69 6e 65 20 62 20 28 6d 61 6b 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 29 0a 20 20 20 20 20 20 20 | fine.b.(make-connector))........ |
| ab7c0 | 20 20 20 28 73 65 74 2d 76 61 6c 75 65 21 20 61 20 31 30 20 27 75 73 65 72 29 0a 0a 20 20 20 20 | ...(set-value!.a.10.'user)...... |
| ab7e0 | 20 41 74 20 73 6f 6d 65 20 74 69 6d 65 20 64 75 72 69 6e 67 20 65 76 61 6c 75 61 74 69 6f 6e 20 | .At.some.time.during.evaluation. |
| ab800 | 6f 66 20 74 68 65 20 60 73 65 74 2d 76 61 6c 75 65 21 27 2c 20 74 68 65 20 66 6f 6c 6c 6f 77 69 | of.the.`set-value!',.the.followi |
| ab820 | 6e 67 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 63 6f 6e 6e | ng......expression.from.the.conn |
| ab840 | 65 63 74 6f 72 27 73 20 6c 6f 63 61 6c 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 65 76 61 6c 75 | ector's.local.procedure.is.evalu |
| ab860 | 61 74 65 64 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 2d 65 78 63 65 70 | ated:............(for-each-excep |
| ab880 | 74 20 73 65 74 74 65 72 20 69 6e 66 6f 72 6d 2d 61 62 6f 75 74 2d 76 61 6c 75 65 20 63 6f 6e 73 | t.setter.inform-about-value.cons |
| ab8a0 | 74 72 61 69 6e 74 73 29 0a 0a 20 20 20 20 20 44 72 61 77 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 | traints).......Draw.an.environme |
| ab8c0 | 6e 74 20 64 69 61 67 72 61 6d 20 73 68 6f 77 69 6e 67 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 | nt.diagram.showing.the.environme |
| ab8e0 | 6e 74 20 69 6e 20 77 68 69 63 68 20 74 68 65 0a 20 20 20 20 20 61 62 6f 76 65 20 65 78 70 72 65 | nt.in.which.the......above.expre |
| ab900 | 73 73 69 6f 6e 20 69 73 20 65 76 61 6c 75 61 74 65 64 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | ssion.is.evaluated........*Exerc |
| ab920 | 69 73 65 20 33 2e 33 37 3a 2a 20 54 68 65 20 60 63 65 6c 73 69 75 73 2d 66 61 68 72 65 6e 68 65 | ise.3.37:*.The.`celsius-fahrenhe |
| ab940 | 69 74 2d 63 6f 6e 76 65 72 74 65 72 27 20 70 72 6f 63 65 64 75 72 65 20 69 73 0a 20 20 20 20 20 | it-converter'.procedure.is...... |
| ab960 | 63 75 6d 62 65 72 73 6f 6d 65 20 77 68 65 6e 20 63 6f 6d 70 61 72 65 64 20 77 69 74 68 20 61 20 | cumbersome.when.compared.with.a. |
| ab980 | 6d 6f 72 65 20 65 78 70 72 65 73 73 69 6f 6e 2d 6f 72 69 65 6e 74 65 64 20 73 74 79 6c 65 20 6f | more.expression-oriented.style.o |
| ab9a0 | 66 0a 20 20 20 20 20 64 65 66 69 6e 69 74 69 6f 6e 2c 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 | f......definition,.such.as...... |
| ab9c0 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 65 6c 73 69 75 73 2d 66 61 68 72 65 6e 68 65 69 | ......(define.(celsius-fahrenhei |
| ab9e0 | 74 2d 63 6f 6e 76 65 72 74 65 72 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 2b 20 28 | t-converter.x).............(c+.( |
| aba00 | 63 2a 20 28 63 2f 20 28 63 76 20 39 29 20 28 63 76 20 35 29 29 0a 20 20 20 20 20 20 20 20 20 20 | c*.(c/.(cv.9).(cv.5))........... |
| aba20 | 20 20 20 20 20 20 20 20 20 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 76 | ..........x).................(cv |
| aba40 | 20 33 32 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 43 20 28 6d 61 6b | .32)))............(define.C.(mak |
| aba60 | 65 2d 63 6f 6e 6e 65 63 74 6f 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | e-connector))...........(define. |
| aba80 | 46 20 28 63 65 6c 73 69 75 73 2d 66 61 68 72 65 6e 68 65 69 74 2d 63 6f 6e 76 65 72 74 65 72 20 | F.(celsius-fahrenheit-converter. |
| abaa0 | 43 29 29 0a 0a 20 20 20 20 20 48 65 72 65 20 60 63 2b 27 2c 20 60 63 2a 27 2c 20 65 74 63 2e 20 | C)).......Here.`c+',.`c*',.etc.. |
| abac0 | 61 72 65 20 74 68 65 20 22 63 6f 6e 73 74 72 61 69 6e 74 22 20 76 65 72 73 69 6f 6e 73 20 6f 66 | are.the."constraint".versions.of |
| abae0 | 20 74 68 65 0a 20 20 20 20 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2e | .the......arithmetic.operations. |
| abb00 | 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 60 63 2b 27 20 74 61 6b 65 73 20 74 77 6f 20 63 6f | ..For.example,.`c+'.takes.two.co |
| abb20 | 6e 6e 65 63 74 6f 72 73 20 61 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 72 | nnectors.as......arguments.and.r |
| abb40 | 65 74 75 72 6e 73 20 61 20 63 6f 6e 6e 65 63 74 6f 72 20 74 68 61 74 20 69 73 20 72 65 6c 61 74 | eturns.a.connector.that.is.relat |
| abb60 | 65 64 20 74 6f 20 74 68 65 73 65 20 62 79 20 61 6e 0a 20 20 20 20 20 61 64 64 65 72 20 63 6f 6e | ed.to.these.by.an......adder.con |
| abb80 | 73 74 72 61 69 6e 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 2b 20 | straint:............(define.(c+. |
| abba0 | 78 20 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 7a 20 28 6d 61 6b 65 2d | x.y).............(let.((z.(make- |
| abbc0 | 63 6f 6e 6e 65 63 74 6f 72 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 65 | connector)))...............(adde |
| abbe0 | 72 20 78 20 79 20 7a 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7a 29 29 0a 0a 20 20 20 20 | r.x.y.z)...............z))...... |
| abc00 | 20 44 65 66 69 6e 65 20 61 6e 61 6c 6f 67 6f 75 73 20 70 72 6f 63 65 64 75 72 65 73 20 60 63 2d | .Define.analogous.procedures.`c- |
| abc20 | 27 2c 20 60 63 2a 27 2c 20 60 63 2f 27 2c 20 61 6e 64 20 60 63 76 27 20 28 63 6f 6e 73 74 61 6e | ',.`c*',.`c/',.and.`cv'.(constan |
| abc40 | 74 0a 20 20 20 20 20 76 61 6c 75 65 29 20 74 68 61 74 20 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 | t......value).that.enable.us.to. |
| abc60 | 64 65 66 69 6e 65 20 63 6f 6d 70 6f 75 6e 64 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 61 73 20 69 | define.compound.constraints.as.i |
| abc80 | 6e 20 74 68 65 0a 20 20 20 20 20 63 6f 6e 76 65 72 74 65 72 20 65 78 61 6d 70 6c 65 20 61 62 6f | n.the......converter.example.abo |
| abca0 | 76 65 2e 28 33 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 | ve.(3).....----------.Footnotes. |
| abcc0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 43 6f 6e 73 74 72 61 69 6e 74 20 70 72 | ----------.....(1).Constraint.pr |
| abce0 | 6f 70 61 67 61 74 69 6f 6e 20 66 69 72 73 74 20 61 70 70 65 61 72 65 64 20 69 6e 20 74 68 65 20 | opagation.first.appeared.in.the. |
| abd00 | 69 6e 63 72 65 64 69 62 6c 79 0a 66 6f 72 77 61 72 64 2d 6c 6f 6f 6b 69 6e 67 20 53 4b 45 54 43 | incredibly.forward-looking.SKETC |
| abd20 | 48 50 41 44 20 73 79 73 74 65 6d 20 6f 66 20 49 76 61 6e 20 53 75 74 68 65 72 6c 61 6e 64 20 28 | HPAD.system.of.Ivan.Sutherland.( |
| abd40 | 31 39 36 33 29 2e 20 20 41 0a 62 65 61 75 74 69 66 75 6c 20 63 6f 6e 73 74 72 61 69 6e 74 2d 70 | 1963)...A.beautiful.constraint-p |
| abd60 | 72 6f 70 61 67 61 74 69 6f 6e 20 73 79 73 74 65 6d 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 53 | ropagation.system.based.on.the.S |
| abd80 | 6d 61 6c 6c 74 61 6c 6b 20 6c 61 6e 67 75 61 67 65 0a 77 61 73 20 64 65 76 65 6c 6f 70 65 64 20 | malltalk.language.was.developed. |
| abda0 | 62 79 20 41 6c 61 6e 20 42 6f 72 6e 69 6e 67 20 28 31 39 37 37 29 20 61 74 20 58 65 72 6f 78 20 | by.Alan.Borning.(1977).at.Xerox. |
| abdc0 | 50 61 6c 6f 20 41 6c 74 6f 20 52 65 73 65 61 72 63 68 0a 43 65 6e 74 65 72 2e 20 20 53 75 73 73 | Palo.Alto.Research.Center...Suss |
| abde0 | 6d 61 6e 2c 20 53 74 61 6c 6c 6d 61 6e 2c 20 61 6e 64 20 53 74 65 65 6c 65 20 61 70 70 6c 69 65 | man,.Stallman,.and.Steele.applie |
| abe00 | 64 20 63 6f 6e 73 74 72 61 69 6e 74 20 70 72 6f 70 61 67 61 74 69 6f 6e 0a 74 6f 20 65 6c 65 63 | d.constraint.propagation.to.elec |
| abe20 | 74 72 69 63 61 6c 20 63 69 72 63 75 69 74 20 61 6e 61 6c 79 73 69 73 20 28 53 75 73 73 6d 61 6e | trical.circuit.analysis.(Sussman |
| abe40 | 20 61 6e 64 20 53 74 61 6c 6c 6d 61 6e 20 31 39 37 35 3b 20 53 75 73 73 6d 61 6e 20 61 6e 64 0a | .and.Stallman.1975;.Sussman.and. |
| abe60 | 53 74 65 65 6c 65 20 31 39 38 30 29 2e 20 54 4b 21 53 6f 6c 76 65 72 20 28 4b 6f 6e 6f 70 61 73 | Steele.1980)..TK!Solver.(Konopas |
| abe80 | 65 6b 20 61 6e 64 20 4a 61 79 61 72 61 6d 61 6e 20 31 39 38 34 29 20 69 73 20 61 6e 20 65 78 74 | ek.and.Jayaraman.1984).is.an.ext |
| abea0 | 65 6e 73 69 76 65 0a 6d 6f 64 65 6c 69 6e 67 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 62 61 73 65 | ensive.modeling.environment.base |
| abec0 | 64 20 6f 6e 20 63 6f 6e 73 74 72 61 69 6e 74 73 2e 0a 0a 20 20 20 28 32 29 20 54 68 65 20 60 73 | d.on.constraints......(2).The.`s |
| abee0 | 65 74 74 65 72 27 20 6d 69 67 68 74 20 6e 6f 74 20 62 65 20 61 20 63 6f 6e 73 74 72 61 69 6e 74 | etter'.might.not.be.a.constraint |
| abf00 | 2e 20 20 49 6e 20 6f 75 72 20 74 65 6d 70 65 72 61 74 75 72 65 0a 65 78 61 6d 70 6c 65 2c 20 77 | ...In.our.temperature.example,.w |
| abf20 | 65 20 75 73 65 64 20 60 75 73 65 72 27 20 61 73 20 74 68 65 20 60 73 65 74 74 65 72 27 2e 0a 0a | e.used.`user'.as.the.`setter'... |
| abf40 | 20 20 20 28 33 29 20 54 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2d 6f 72 69 65 6e 74 65 64 20 66 | ...(3).The.expression-oriented.f |
| abf60 | 6f 72 6d 61 74 20 69 73 20 63 6f 6e 76 65 6e 69 65 6e 74 20 62 65 63 61 75 73 65 20 69 74 20 61 | ormat.is.convenient.because.it.a |
| abf80 | 76 6f 69 64 73 0a 74 68 65 20 6e 65 65 64 20 74 6f 20 6e 61 6d 65 20 74 68 65 20 69 6e 74 65 72 | voids.the.need.to.name.the.inter |
| abfa0 | 6d 65 64 69 61 74 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 61 20 63 6f 6d 70 75 74 61 | mediate.expressions.in.a.computa |
| abfc0 | 74 69 6f 6e 2e 20 20 4f 75 72 0a 6f 72 69 67 69 6e 61 6c 20 66 6f 72 6d 75 6c 61 74 69 6f 6e 20 | tion...Our.original.formulation. |
| abfe0 | 6f 66 20 74 68 65 20 63 6f 6e 73 74 72 61 69 6e 74 20 6c 61 6e 67 75 61 67 65 20 69 73 20 63 75 | of.the.constraint.language.is.cu |
| ac000 | 6d 62 65 72 73 6f 6d 65 20 69 6e 20 74 68 65 0a 73 61 6d 65 20 77 61 79 20 74 68 61 74 20 6d 61 | mbersome.in.the.same.way.that.ma |
| ac020 | 6e 79 20 6c 61 6e 67 75 61 67 65 73 20 61 72 65 20 63 75 6d 62 65 72 73 6f 6d 65 20 77 68 65 6e | ny.languages.are.cumbersome.when |
| ac040 | 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 6f 70 65 72 61 74 69 6f 6e 73 0a 6f 6e 20 63 6f 6d 70 | .dealing.with.operations.on.comp |
| ac060 | 6f 75 6e 64 20 64 61 74 61 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 77 65 20 77 | ound.data...For.example,.if.we.w |
| ac080 | 61 6e 74 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 70 72 6f 64 75 63 74 20 28 61 20 | anted.to.compute.the.product.(a. |
| ac0a0 | 2b 0a 62 29 20 2a 20 28 63 20 2b 20 64 29 2c 20 77 68 65 72 65 20 74 68 65 20 76 61 72 69 61 62 | +.b).*.(c.+.d),.where.the.variab |
| ac0c0 | 6c 65 73 20 72 65 70 72 65 73 65 6e 74 20 76 65 63 74 6f 72 73 2c 20 77 65 20 63 6f 75 6c 64 20 | les.represent.vectors,.we.could. |
| ac0e0 | 77 6f 72 6b 20 69 6e 0a 22 69 6d 70 65 72 61 74 69 76 65 20 73 74 79 6c 65 2c 22 20 75 73 69 6e | work.in."imperative.style,".usin |
| ac100 | 67 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 73 65 74 20 74 68 65 20 76 61 6c 75 65 73 | g.procedures.that.set.the.values |
| ac120 | 20 6f 66 20 64 65 73 69 67 6e 61 74 65 64 0a 76 65 63 74 6f 72 20 61 72 67 75 6d 65 6e 74 73 20 | .of.designated.vector.arguments. |
| ac140 | 62 75 74 20 64 6f 20 6e 6f 74 20 74 68 65 6d 73 65 6c 76 65 73 20 72 65 74 75 72 6e 20 76 65 63 | but.do.not.themselves.return.vec |
| ac160 | 74 6f 72 73 20 61 73 20 76 61 6c 75 65 73 3a 0a 0a 20 20 20 20 20 28 76 2d 73 75 6d 20 61 20 62 | tors.as.values:.......(v-sum.a.b |
| ac180 | 20 74 65 6d 70 31 29 0a 20 20 20 20 20 28 76 2d 73 75 6d 20 63 20 64 20 74 65 6d 70 32 29 0a 20 | .temp1)......(v-sum.c.d.temp2).. |
| ac1a0 | 20 20 20 20 28 76 2d 70 72 6f 64 20 74 65 6d 70 31 20 74 65 6d 70 32 20 61 6e 73 77 65 72 29 0a | ....(v-prod.temp1.temp2.answer). |
| ac1c0 | 0a 20 20 20 41 6c 74 65 72 6e 61 74 69 76 65 6c 79 2c 20 77 65 20 63 6f 75 6c 64 20 64 65 61 6c | ....Alternatively,.we.could.deal |
| ac1e0 | 20 77 69 74 68 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 75 73 69 6e 67 20 70 72 6f 63 65 64 75 | .with.expressions,.using.procedu |
| ac200 | 72 65 73 20 74 68 61 74 0a 72 65 74 75 72 6e 20 76 65 63 74 6f 72 73 20 61 73 20 76 61 6c 75 65 | res.that.return.vectors.as.value |
| ac220 | 73 2c 20 61 6e 64 20 74 68 75 73 20 61 76 6f 69 64 20 65 78 70 6c 69 63 69 74 6c 79 20 6d 65 6e | s,.and.thus.avoid.explicitly.men |
| ac240 | 74 69 6f 6e 69 6e 67 20 60 74 65 6d 70 31 27 0a 61 6e 64 20 60 74 65 6d 70 32 27 3a 0a 0a 20 20 | tioning.`temp1'.and.`temp2':.... |
| ac260 | 20 20 20 28 64 65 66 69 6e 65 20 61 6e 73 77 65 72 20 28 76 2d 70 72 6f 64 20 28 76 2d 73 75 6d | ...(define.answer.(v-prod.(v-sum |
| ac280 | 20 61 20 62 29 20 28 76 2d 73 75 6d 20 63 20 64 29 29 29 0a 0a 20 20 20 53 69 6e 63 65 20 4c 69 | .a.b).(v-sum.c.d))).....Since.Li |
| ac2a0 | 73 70 20 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20 72 65 74 75 72 6e 20 63 6f 6d 70 6f 75 6e 64 20 | sp.allows.us.to.return.compound. |
| ac2c0 | 6f 62 6a 65 63 74 73 20 61 73 20 76 61 6c 75 65 73 20 6f 66 0a 70 72 6f 63 65 64 75 72 65 73 2c | objects.as.values.of.procedures, |
| ac2e0 | 20 77 65 20 63 61 6e 20 74 72 61 6e 73 66 6f 72 6d 20 6f 75 72 20 69 6d 70 65 72 61 74 69 76 65 | .we.can.transform.our.imperative |
| ac300 | 2d 73 74 79 6c 65 20 63 6f 6e 73 74 72 61 69 6e 74 20 6c 61 6e 67 75 61 67 65 0a 69 6e 74 6f 20 | -style.constraint.language.into. |
| ac320 | 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2d 6f 72 69 65 6e 74 65 64 20 73 74 79 6c 65 20 61 73 20 | an.expression-oriented.style.as. |
| ac340 | 73 68 6f 77 6e 20 69 6e 20 74 68 69 73 20 65 78 65 72 63 69 73 65 2e 20 20 49 6e 0a 6c 61 6e 67 | shown.in.this.exercise...In.lang |
| ac360 | 75 61 67 65 73 20 74 68 61 74 20 61 72 65 20 69 6d 70 6f 76 65 72 69 73 68 65 64 20 69 6e 20 68 | uages.that.are.impoverished.in.h |
| ac380 | 61 6e 64 6c 69 6e 67 20 63 6f 6d 70 6f 75 6e 64 20 6f 62 6a 65 63 74 73 2c 20 73 75 63 68 20 61 | andling.compound.objects,.such.a |
| ac3a0 | 73 0a 41 6c 67 6f 6c 2c 20 42 61 73 69 63 2c 20 61 6e 64 20 50 61 73 63 61 6c 20 28 75 6e 6c 65 | s.Algol,.Basic,.and.Pascal.(unle |
| ac3c0 | 73 73 20 6f 6e 65 20 65 78 70 6c 69 63 69 74 6c 79 20 75 73 65 73 20 50 61 73 63 61 6c 20 70 6f | ss.one.explicitly.uses.Pascal.po |
| ac3e0 | 69 6e 74 65 72 0a 76 61 72 69 61 62 6c 65 73 29 2c 20 6f 6e 65 20 69 73 20 75 73 75 61 6c 6c 79 | inter.variables),.one.is.usually |
| ac400 | 20 73 74 75 63 6b 20 77 69 74 68 20 74 68 65 20 69 6d 70 65 72 61 74 69 76 65 20 73 74 79 6c 65 | .stuck.with.the.imperative.style |
| ac420 | 20 77 68 65 6e 0a 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 63 6f 6d 70 6f 75 6e 64 20 6f 62 6a 65 | .when.manipulating.compound.obje |
| ac440 | 63 74 73 2e 20 20 47 69 76 65 6e 20 74 68 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 74 68 65 | cts...Given.the.advantage.of.the |
| ac460 | 0a 65 78 70 72 65 73 73 69 6f 6e 2d 6f 72 69 65 6e 74 65 64 20 66 6f 72 6d 61 74 2c 20 6f 6e 65 | .expression-oriented.format,.one |
| ac480 | 20 6d 69 67 68 74 20 61 73 6b 20 69 66 20 74 68 65 72 65 20 69 73 20 61 6e 79 20 72 65 61 73 6f | .might.ask.if.there.is.any.reaso |
| ac4a0 | 6e 20 74 6f 20 68 61 76 65 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 74 68 65 20 73 79 73 74 65 6d | n.to.have.implemented.the.system |
| ac4c0 | 20 69 6e 20 69 6d 70 65 72 61 74 69 76 65 20 73 74 79 6c 65 2c 20 61 73 20 77 65 20 64 69 64 20 | .in.imperative.style,.as.we.did. |
| ac4e0 | 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2e 0a 4f 6e 65 20 72 65 61 73 6f 6e 20 69 73 20 74 | in.this.section..One.reason.is.t |
| ac500 | 68 61 74 20 74 68 65 20 6e 6f 6e 2d 65 78 70 72 65 73 73 69 6f 6e 2d 6f 72 69 65 6e 74 65 64 20 | hat.the.non-expression-oriented. |
| ac520 | 63 6f 6e 73 74 72 61 69 6e 74 20 6c 61 6e 67 75 61 67 65 0a 70 72 6f 76 69 64 65 73 20 61 20 68 | constraint.language.provides.a.h |
| ac540 | 61 6e 64 6c 65 20 6f 6e 20 63 6f 6e 73 74 72 61 69 6e 74 20 6f 62 6a 65 63 74 73 20 28 65 2e 67 | andle.on.constraint.objects.(e.g |
| ac560 | 2e 2c 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 61 64 64 65 72 27 0a 70 72 6f 63 | .,.the.value.of.the.`adder'.proc |
| ac580 | 65 64 75 72 65 29 20 61 73 20 77 65 6c 6c 20 61 73 20 6f 6e 20 63 6f 6e 6e 65 63 74 6f 72 20 6f | edure).as.well.as.on.connector.o |
| ac5a0 | 62 6a 65 63 74 73 2e 20 20 54 68 69 73 20 69 73 20 75 73 65 66 75 6c 20 69 66 20 77 65 20 77 69 | bjects...This.is.useful.if.we.wi |
| ac5c0 | 73 68 0a 74 6f 20 65 78 74 65 6e 64 20 74 68 65 20 73 79 73 74 65 6d 20 77 69 74 68 20 6e 65 77 | sh.to.extend.the.system.with.new |
| ac5e0 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 63 6f 6d 6d 75 6e 69 63 61 74 65 20 77 69 74 | .operations.that.communicate.wit |
| ac600 | 68 0a 63 6f 6e 73 74 72 61 69 6e 74 73 20 64 69 72 65 63 74 6c 79 20 72 61 74 68 65 72 20 74 68 | h.constraints.directly.rather.th |
| ac620 | 61 6e 20 6f 6e 6c 79 20 69 6e 64 69 72 65 63 74 6c 79 20 76 69 61 20 6f 70 65 72 61 74 69 6f 6e | an.only.indirectly.via.operation |
| ac640 | 73 20 6f 6e 0a 63 6f 6e 6e 65 63 74 6f 72 73 2e 20 20 41 6c 74 68 6f 75 67 68 20 69 74 20 69 73 | s.on.connectors...Although.it.is |
| ac660 | 20 65 61 73 79 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 65 78 70 72 65 73 73 69 6f | .easy.to.implement.the.expressio |
| ac680 | 6e 2d 6f 72 69 65 6e 74 65 64 0a 73 74 79 6c 65 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 | n-oriented.style.in.terms.of.the |
| ac6a0 | 20 69 6d 70 65 72 61 74 69 76 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 20 69 74 20 69 | .imperative.implementation,.it.i |
| ac6c0 | 73 20 76 65 72 79 20 64 69 66 66 69 63 75 6c 74 0a 74 6f 20 64 6f 20 74 68 65 20 63 6f 6e 76 65 | s.very.difficult.to.do.the.conve |
| ac6e0 | 72 73 65 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 | rse.....File:.sicp.info,..Node:. |
| ac700 | 33 2d 34 2c 20 20 4e 65 78 74 3a 20 33 2d 35 2c 20 20 50 72 65 76 3a 20 33 2d 33 2c 20 20 55 70 | 3-4,..Next:.3-5,..Prev:.3-3,..Up |
| ac720 | 3a 20 43 68 61 70 74 65 72 20 33 0a 0a 33 2e 34 20 43 6f 6e 63 75 72 72 65 6e 63 79 3a 20 54 69 | :.Chapter.3..3.4.Concurrency:.Ti |
| ac740 | 6d 65 20 49 73 20 6f 66 20 74 68 65 20 45 73 73 65 6e 63 65 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | me.Is.of.the.Essence.=========== |
| ac760 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 57 65 | ============================..We |
| ac780 | 27 76 65 20 73 65 65 6e 20 74 68 65 20 70 6f 77 65 72 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f | 've.seen.the.power.of.computatio |
| ac7a0 | 6e 61 6c 20 6f 62 6a 65 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 61 73 20 | nal.objects.with.local.state.as. |
| ac7c0 | 74 6f 6f 6c 73 0a 66 6f 72 20 6d 6f 64 65 6c 69 6e 67 2e 20 20 59 65 74 2c 20 61 73 20 73 65 63 | tools.for.modeling...Yet,.as.sec |
| ac7e0 | 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 33 3a 3a 20 77 61 72 6e 65 64 2c 20 74 68 69 73 20 | tion.*Note.3-1-3::.warned,.this. |
| ac800 | 70 6f 77 65 72 0a 65 78 74 72 61 63 74 73 20 61 20 70 72 69 63 65 3a 20 74 68 65 20 6c 6f 73 73 | power.extracts.a.price:.the.loss |
| ac820 | 20 6f 66 20 72 65 66 65 72 65 6e 74 69 61 6c 20 74 72 61 6e 73 70 61 72 65 6e 63 79 2c 20 67 69 | .of.referential.transparency,.gi |
| ac840 | 76 69 6e 67 20 72 69 73 65 20 74 6f 0a 61 20 74 68 69 63 6b 65 74 20 6f 66 20 71 75 65 73 74 69 | ving.rise.to.a.thicket.of.questi |
| ac860 | 6f 6e 73 20 61 62 6f 75 74 20 73 61 6d 65 6e 65 73 73 20 61 6e 64 20 63 68 61 6e 67 65 2c 20 61 | ons.about.sameness.and.change,.a |
| ac880 | 6e 64 20 74 68 65 20 6e 65 65 64 20 74 6f 0a 61 62 61 6e 64 6f 6e 20 74 68 65 20 73 75 62 73 74 | nd.the.need.to.abandon.the.subst |
| ac8a0 | 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 6e 20 66 | itution.model.of.evaluation.in.f |
| ac8c0 | 61 76 6f 72 20 6f 66 20 74 68 65 20 6d 6f 72 65 0a 69 6e 74 72 69 63 61 74 65 20 65 6e 76 69 72 | avor.of.the.more.intricate.envir |
| ac8e0 | 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 2e 0a 0a 20 20 20 54 68 65 20 63 65 6e 74 72 61 6c 20 69 73 | onment.model......The.central.is |
| ac900 | 73 75 65 20 6c 75 72 6b 69 6e 67 20 62 65 6e 65 61 74 68 20 74 68 65 20 63 6f 6d 70 6c 65 78 69 | sue.lurking.beneath.the.complexi |
| ac920 | 74 79 20 6f 66 20 73 74 61 74 65 2c 20 73 61 6d 65 6e 65 73 73 2c 0a 61 6e 64 20 63 68 61 6e 67 | ty.of.state,.sameness,.and.chang |
| ac940 | 65 20 69 73 20 74 68 61 74 20 62 79 20 69 6e 74 72 6f 64 75 63 69 6e 67 20 61 73 73 69 67 6e 6d | e.is.that.by.introducing.assignm |
| ac960 | 65 6e 74 20 77 65 20 61 72 65 20 66 6f 72 63 65 64 20 74 6f 20 61 64 6d 69 74 20 22 74 69 6d 65 | ent.we.are.forced.to.admit."time |
| ac980 | 22 0a 69 6e 74 6f 20 6f 75 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 2e | ".into.our.computational.models. |
| ac9a0 | 20 20 42 65 66 6f 72 65 20 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 61 73 73 69 67 6e 6d 65 6e | ..Before.we.introduced.assignmen |
| ac9c0 | 74 2c 20 61 6c 6c 0a 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 77 65 72 65 20 74 69 6d 65 6c 65 73 | t,.all.our.programs.were.timeles |
| ac9e0 | 73 2c 20 69 6e 20 74 68 65 20 73 65 6e 73 65 20 74 68 61 74 20 61 6e 79 20 65 78 70 72 65 73 73 | s,.in.the.sense.that.any.express |
| aca00 | 69 6f 6e 20 74 68 61 74 20 68 61 73 20 61 0a 76 61 6c 75 65 20 61 6c 77 61 79 73 20 68 61 73 20 | ion.that.has.a.value.always.has. |
| aca20 | 74 68 65 20 73 61 6d 65 20 76 61 6c 75 65 2e 20 20 49 6e 20 63 6f 6e 74 72 61 73 74 2c 20 72 65 | the.same.value...In.contrast,.re |
| aca40 | 63 61 6c 6c 20 74 68 65 20 65 78 61 6d 70 6c 65 20 6f 66 0a 6d 6f 64 65 6c 69 6e 67 20 77 69 74 | call.the.example.of.modeling.wit |
| aca60 | 68 64 72 61 77 61 6c 73 20 66 72 6f 6d 20 61 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 20 61 6e 64 | hdrawals.from.a.bank.account.and |
| aca80 | 20 72 65 74 75 72 6e 69 6e 67 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 0a 62 61 6c 61 6e 63 65 | .returning.the.resulting.balance |
| acaa0 | 2c 20 69 6e 74 72 6f 64 75 63 65 64 20 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 | ,.introduced.at.the.beginning.of |
| acac0 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 28 77 | .section.*Note.3-1-1:::.......(w |
| acae0 | 69 74 68 64 72 61 77 20 32 35 29 0a 20 20 20 20 20 37 35 0a 0a 20 20 20 20 20 28 77 69 74 68 64 | ithdraw.25)......75.......(withd |
| acb00 | 72 61 77 20 32 35 29 0a 20 20 20 20 20 35 30 0a 0a 20 20 20 48 65 72 65 20 73 75 63 63 65 73 73 | raw.25)......50.....Here.success |
| acb20 | 69 76 65 20 65 76 61 6c 75 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 73 61 6d 65 20 65 78 70 72 | ive.evaluations.of.the.same.expr |
| acb40 | 65 73 73 69 6f 6e 20 79 69 65 6c 64 20 64 69 66 66 65 72 65 6e 74 0a 76 61 6c 75 65 73 2e 20 20 | ession.yield.different.values... |
| acb60 | 54 68 69 73 20 62 65 68 61 76 69 6f 72 20 61 72 69 73 65 73 20 66 72 6f 6d 20 74 68 65 20 66 61 | This.behavior.arises.from.the.fa |
| acb80 | 63 74 20 74 68 61 74 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 0a 61 73 73 69 67 6e 6d | ct.that.the.execution.of.assignm |
| acba0 | 65 6e 74 20 73 74 61 74 65 6d 65 6e 74 73 20 28 69 6e 20 74 68 69 73 20 63 61 73 65 2c 20 61 73 | ent.statements.(in.this.case,.as |
| acbc0 | 73 69 67 6e 6d 65 6e 74 73 20 74 6f 20 74 68 65 20 76 61 72 69 61 62 6c 65 0a 60 62 61 6c 61 6e | signments.to.the.variable.`balan |
| acbe0 | 63 65 27 29 20 64 65 6c 69 6e 65 61 74 65 73 20 22 6d 6f 6d 65 6e 74 73 20 69 6e 20 74 69 6d 65 | ce').delineates."moments.in.time |
| acc00 | 22 20 77 68 65 6e 20 76 61 6c 75 65 73 20 63 68 61 6e 67 65 2e 20 20 54 68 65 20 72 65 73 75 6c | ".when.values.change...The.resul |
| acc20 | 74 0a 6f 66 20 65 76 61 6c 75 61 74 69 6e 67 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 64 65 | t.of.evaluating.an.expression.de |
| acc40 | 70 65 6e 64 73 20 6e 6f 74 20 6f 6e 6c 79 20 6f 6e 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e | pends.not.only.on.the.expression |
| acc60 | 20 69 74 73 65 6c 66 2c 0a 62 75 74 20 61 6c 73 6f 20 6f 6e 20 77 68 65 74 68 65 72 20 74 68 65 | .itself,.but.also.on.whether.the |
| acc80 | 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 63 63 75 72 73 20 62 65 66 6f 72 65 20 6f 72 20 61 66 74 | .evaluation.occurs.before.or.aft |
| acca0 | 65 72 20 74 68 65 73 65 0a 6d 6f 6d 65 6e 74 73 2e 20 20 42 75 69 6c 64 69 6e 67 20 6d 6f 64 65 | er.these.moments...Building.mode |
| accc0 | 6c 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a | ls.in.terms.of.computational.obj |
| acce0 | 65 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 0a 73 74 61 74 65 20 66 6f 72 63 65 73 20 75 73 20 | ects.with.local.state.forces.us. |
| acd00 | 74 6f 20 63 6f 6e 66 72 6f 6e 74 20 74 69 6d 65 20 61 73 20 61 6e 20 65 73 73 65 6e 74 69 61 6c | to.confront.time.as.an.essential |
| acd20 | 20 63 6f 6e 63 65 70 74 20 69 6e 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2e 0a 0a 20 20 20 57 65 20 | .concept.in.programming......We. |
| acd40 | 63 61 6e 20 67 6f 20 66 75 72 74 68 65 72 20 69 6e 20 73 74 72 75 63 74 75 72 69 6e 67 20 63 6f | can.go.further.in.structuring.co |
| acd60 | 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 20 74 6f 20 6d 61 74 63 68 20 6f 75 72 0a | mputational.models.to.match.our. |
| acd80 | 70 65 72 63 65 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 70 68 79 73 69 63 61 6c 20 77 6f 72 6c 64 | perception.of.the.physical.world |
| acda0 | 2e 20 20 4f 62 6a 65 63 74 73 20 69 6e 20 74 68 65 20 77 6f 72 6c 64 20 64 6f 20 6e 6f 74 20 63 | ...Objects.in.the.world.do.not.c |
| acdc0 | 68 61 6e 67 65 0a 6f 6e 65 20 61 74 20 61 20 74 69 6d 65 20 69 6e 20 73 65 71 75 65 6e 63 65 2e | hange.one.at.a.time.in.sequence. |
| acde0 | 20 20 52 61 74 68 65 72 20 77 65 20 70 65 72 63 65 69 76 65 20 74 68 65 6d 20 61 73 20 61 63 74 | ..Rather.we.perceive.them.as.act |
| ace00 | 69 6e 67 20 22 63 6f 6e 63 75 72 72 65 6e 74 6c 79 22 2d 2d 61 6c 6c 0a 61 74 20 6f 6e 63 65 2e | ing."concurrently"--all.at.once. |
| ace20 | 20 20 53 6f 20 69 74 20 69 73 20 6f 66 74 65 6e 20 6e 61 74 75 72 61 6c 20 74 6f 20 6d 6f 64 65 | ..So.it.is.often.natural.to.mode |
| ace40 | 6c 20 73 79 73 74 65 6d 73 20 61 73 20 63 6f 6c 6c 65 63 74 69 6f 6e 73 20 6f 66 0a 63 6f 6d 70 | l.systems.as.collections.of.comp |
| ace60 | 75 74 61 74 69 6f 6e 61 6c 20 70 72 6f 63 65 73 73 65 73 20 74 68 61 74 20 65 78 65 63 75 74 65 | utational.processes.that.execute |
| ace80 | 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 2e 20 20 4a 75 73 74 20 61 73 20 77 65 20 63 61 6e 20 6d | .concurrently...Just.as.we.can.m |
| acea0 | 61 6b 65 0a 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 6d 6f 64 75 6c 61 72 20 62 79 20 6f 72 67 61 | ake.our.programs.modular.by.orga |
| acec0 | 6e 69 7a 69 6e 67 20 6d 6f 64 65 6c 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6f 62 6a 65 63 74 | nizing.models.in.terms.of.object |
| acee0 | 73 20 77 69 74 68 0a 73 65 70 61 72 61 74 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 2c 20 69 74 20 | s.with.separate.local.state,.it. |
| acf00 | 69 73 20 6f 66 74 65 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20 74 6f 20 64 69 76 69 64 65 20 63 | is.often.appropriate.to.divide.c |
| acf20 | 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 0a 6d 6f 64 65 6c 73 20 69 6e 74 6f 20 70 61 72 74 73 20 74 | omputational.models.into.parts.t |
| acf40 | 68 61 74 20 65 76 6f 6c 76 65 20 73 65 70 61 72 61 74 65 6c 79 20 61 6e 64 20 63 6f 6e 63 75 72 | hat.evolve.separately.and.concur |
| acf60 | 72 65 6e 74 6c 79 2e 20 20 45 76 65 6e 20 69 66 20 74 68 65 0a 70 72 6f 67 72 61 6d 73 20 61 72 | rently...Even.if.the.programs.ar |
| acf80 | 65 20 74 6f 20 62 65 20 65 78 65 63 75 74 65 64 20 6f 6e 20 61 20 73 65 71 75 65 6e 74 69 61 6c | e.to.be.executed.on.a.sequential |
| acfa0 | 20 63 6f 6d 70 75 74 65 72 2c 20 74 68 65 20 70 72 61 63 74 69 63 65 20 6f 66 0a 77 72 69 74 69 | .computer,.the.practice.of.writi |
| acfc0 | 6e 67 20 70 72 6f 67 72 61 6d 73 20 61 73 20 69 66 20 74 68 65 79 20 77 65 72 65 20 74 6f 20 62 | ng.programs.as.if.they.were.to.b |
| acfe0 | 65 20 65 78 65 63 75 74 65 64 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 20 66 6f 72 63 65 73 20 74 | e.executed.concurrently.forces.t |
| ad000 | 68 65 0a 70 72 6f 67 72 61 6d 6d 65 72 20 74 6f 20 61 76 6f 69 64 20 69 6e 65 73 73 65 6e 74 69 | he.programmer.to.avoid.inessenti |
| ad020 | 61 6c 20 74 69 6d 69 6e 67 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 61 6e 64 20 74 68 75 73 20 6d | al.timing.constraints.and.thus.m |
| ad040 | 61 6b 65 73 0a 70 72 6f 67 72 61 6d 73 20 6d 6f 72 65 20 6d 6f 64 75 6c 61 72 2e 0a 0a 20 20 20 | akes.programs.more.modular...... |
| ad060 | 49 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 6d 61 6b 69 6e 67 20 70 72 6f 67 72 61 6d 73 20 6d | In.addition.to.making.programs.m |
| ad080 | 6f 72 65 20 6d 6f 64 75 6c 61 72 2c 20 63 6f 6e 63 75 72 72 65 6e 74 20 63 6f 6d 70 75 74 61 74 | ore.modular,.concurrent.computat |
| ad0a0 | 69 6f 6e 0a 63 61 6e 20 70 72 6f 76 69 64 65 20 61 20 73 70 65 65 64 20 61 64 76 61 6e 74 61 67 | ion.can.provide.a.speed.advantag |
| ad0c0 | 65 20 6f 76 65 72 20 73 65 71 75 65 6e 74 69 61 6c 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 | e.over.sequential.computation... |
| ad0e0 | 53 65 71 75 65 6e 74 69 61 6c 0a 63 6f 6d 70 75 74 65 72 73 20 65 78 65 63 75 74 65 20 6f 6e 6c | Sequential.computers.execute.onl |
| ad100 | 79 20 6f 6e 65 20 6f 70 65 72 61 74 69 6f 6e 20 61 74 20 61 20 74 69 6d 65 2c 20 73 6f 20 74 68 | y.one.operation.at.a.time,.so.th |
| ad120 | 65 20 61 6d 6f 75 6e 74 20 6f 66 20 74 69 6d 65 0a 69 74 20 74 61 6b 65 73 20 74 6f 20 70 65 72 | e.amount.of.time.it.takes.to.per |
| ad140 | 66 6f 72 6d 20 61 20 74 61 73 6b 20 69 73 20 70 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 74 | form.a.task.is.proportional.to.t |
| ad160 | 68 65 20 74 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 0a 6f 70 65 72 61 74 69 6f 6e 73 20 70 65 | he.total.number.of.operations.pe |
| ad180 | 72 66 6f 72 6d 65 64 2e 28 31 29 20 20 48 6f 77 65 76 65 72 2c 20 69 66 20 69 74 20 69 73 20 70 | rformed.(1)..However,.if.it.is.p |
| ad1a0 | 6f 73 73 69 62 6c 65 20 74 6f 20 64 65 63 6f 6d 70 6f 73 65 20 61 0a 70 72 6f 62 6c 65 6d 20 69 | ossible.to.decompose.a.problem.i |
| ad1c0 | 6e 74 6f 20 70 69 65 63 65 73 20 74 68 61 74 20 61 72 65 20 72 65 6c 61 74 69 76 65 6c 79 20 69 | nto.pieces.that.are.relatively.i |
| ad1e0 | 6e 64 65 70 65 6e 64 65 6e 74 20 61 6e 64 20 6e 65 65 64 20 74 6f 0a 63 6f 6d 6d 75 6e 69 63 61 | ndependent.and.need.to.communica |
| ad200 | 74 65 20 6f 6e 6c 79 20 72 61 72 65 6c 79 2c 20 69 74 20 6d 61 79 20 62 65 20 70 6f 73 73 69 62 | te.only.rarely,.it.may.be.possib |
| ad220 | 6c 65 20 74 6f 20 61 6c 6c 6f 63 61 74 65 20 70 69 65 63 65 73 20 74 6f 0a 73 65 70 61 72 61 74 | le.to.allocate.pieces.to.separat |
| ad240 | 65 20 63 6f 6d 70 75 74 69 6e 67 20 70 72 6f 63 65 73 73 6f 72 73 2c 20 70 72 6f 64 75 63 69 6e | e.computing.processors,.producin |
| ad260 | 67 20 61 20 73 70 65 65 64 20 61 64 76 61 6e 74 61 67 65 20 70 72 6f 70 6f 72 74 69 6f 6e 61 6c | g.a.speed.advantage.proportional |
| ad280 | 0a 74 6f 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 72 6f 63 65 73 73 6f 72 73 20 61 76 61 | .to.the.number.of.processors.ava |
| ad2a0 | 69 6c 61 62 6c 65 2e 0a 0a 20 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 74 68 65 20 63 | ilable......Unfortunately,.the.c |
| ad2c0 | 6f 6d 70 6c 65 78 69 74 69 65 73 20 69 6e 74 72 6f 64 75 63 65 64 20 62 79 20 61 73 73 69 67 6e | omplexities.introduced.by.assign |
| ad2e0 | 6d 65 6e 74 20 62 65 63 6f 6d 65 20 65 76 65 6e 0a 6d 6f 72 65 20 70 72 6f 62 6c 65 6d 61 74 69 | ment.become.even.more.problemati |
| ad300 | 63 20 69 6e 20 74 68 65 20 70 72 65 73 65 6e 63 65 20 6f 66 20 63 6f 6e 63 75 72 72 65 6e 63 79 | c.in.the.presence.of.concurrency |
| ad320 | 2e 20 20 54 68 65 20 66 61 63 74 20 6f 66 0a 63 6f 6e 63 75 72 72 65 6e 74 20 65 78 65 63 75 74 | ...The.fact.of.concurrent.execut |
| ad340 | 69 6f 6e 2c 20 65 69 74 68 65 72 20 62 65 63 61 75 73 65 20 74 68 65 20 77 6f 72 6c 64 20 6f 70 | ion,.either.because.the.world.op |
| ad360 | 65 72 61 74 65 73 20 69 6e 20 70 61 72 61 6c 6c 65 6c 20 6f 72 0a 62 65 63 61 75 73 65 20 6f 75 | erates.in.parallel.or.because.ou |
| ad380 | 72 20 63 6f 6d 70 75 74 65 72 73 20 64 6f 2c 20 65 6e 74 61 69 6c 73 20 61 64 64 69 74 69 6f 6e | r.computers.do,.entails.addition |
| ad3a0 | 61 6c 20 63 6f 6d 70 6c 65 78 69 74 79 20 69 6e 20 6f 75 72 0a 75 6e 64 65 72 73 74 61 6e 64 69 | al.complexity.in.our.understandi |
| ad3c0 | 6e 67 20 6f 66 20 74 69 6d 65 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 33 2d 34 2d 31 3a 3a 20 | ng.of.time...*.Menu:..*.3-4-1::. |
| ad3e0 | 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 4e 61 74 75 72 65 20 6f 66 20 54 69 6d 65 20 69 6e | ...........The.Nature.of.Time.in |
| ad400 | 20 43 6f 6e 63 75 72 72 65 6e 74 20 53 79 73 74 65 6d 73 0a 2a 20 33 2d 34 2d 32 3a 3a 20 20 20 | .Concurrent.Systems.*.3-4-2::... |
| ad420 | 20 20 20 20 20 20 20 20 20 4d 65 63 68 61 6e 69 73 6d 73 20 66 6f 72 20 43 6f 6e 74 72 6f 6c 6c | .........Mechanisms.for.Controll |
| ad440 | 69 6e 67 20 43 6f 6e 63 75 72 72 65 6e 63 79 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 | ing.Concurrency.....----------.F |
| ad460 | 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 4d 6f 73 74 | ootnotes.----------.....(1).Most |
| ad480 | 20 72 65 61 6c 20 70 72 6f 63 65 73 73 6f 72 73 20 61 63 74 75 61 6c 6c 79 20 65 78 65 63 75 74 | .real.processors.actually.execut |
| ad4a0 | 65 20 61 20 66 65 77 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 74 20 61 0a 74 69 6d 65 2c 20 66 6f | e.a.few.operations.at.a.time,.fo |
| ad4c0 | 6c 6c 6f 77 69 6e 67 20 61 20 73 74 72 61 74 65 67 79 20 63 61 6c 6c 65 64 20 22 70 69 70 65 6c | llowing.a.strategy.called."pipel |
| ad4e0 | 69 6e 69 6e 67 22 2e 20 20 41 6c 74 68 6f 75 67 68 20 74 68 69 73 0a 74 65 63 68 6e 69 71 75 65 | ining"...Although.this.technique |
| ad500 | 20 67 72 65 61 74 6c 79 20 69 6d 70 72 6f 76 65 73 20 74 68 65 20 65 66 66 65 63 74 69 76 65 20 | .greatly.improves.the.effective. |
| ad520 | 75 74 69 6c 69 7a 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 68 61 72 64 77 61 72 65 2c 0a 69 74 20 | utilization.of.the.hardware,.it. |
| ad540 | 69 73 20 75 73 65 64 20 6f 6e 6c 79 20 74 6f 20 73 70 65 65 64 20 75 70 20 74 68 65 20 65 78 65 | is.used.only.to.speed.up.the.exe |
| ad560 | 63 75 74 69 6f 6e 20 6f 66 20 61 20 73 65 71 75 65 6e 74 69 61 6c 20 69 6e 73 74 72 75 63 74 69 | cution.of.a.sequential.instructi |
| ad580 | 6f 6e 0a 73 74 72 65 61 6d 2c 20 77 68 69 6c 65 20 72 65 74 61 69 6e 69 6e 67 20 74 68 65 20 62 | on.stream,.while.retaining.the.b |
| ad5a0 | 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 74 69 61 6c 20 70 72 6f 67 72 61 | ehavior.of.the.sequential.progra |
| ad5c0 | 6d 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d | m.....File:.sicp.info,..Node:.3- |
| ad5e0 | 34 2d 31 2c 20 20 4e 65 78 74 3a 20 33 2d 34 2d 32 2c 20 20 50 72 65 76 3a 20 33 2d 34 2c 20 20 | 4-1,..Next:.3-4-2,..Prev:.3-4,.. |
| ad600 | 55 70 3a 20 33 2d 34 0a 0a 33 2e 34 2e 31 20 54 68 65 20 4e 61 74 75 72 65 20 6f 66 20 54 69 6d | Up:.3-4..3.4.1.The.Nature.of.Tim |
| ad620 | 65 20 69 6e 20 43 6f 6e 63 75 72 72 65 6e 74 20 53 79 73 74 65 6d 73 0a 2d 2d 2d 2d 2d 2d 2d 2d | e.in.Concurrent.Systems.-------- |
| ad640 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| ad660 | 2d 2d 2d 2d 2d 2d 0a 0a 4f 6e 20 74 68 65 20 73 75 72 66 61 63 65 2c 20 74 69 6d 65 20 73 65 65 | ------..On.the.surface,.time.see |
| ad680 | 6d 73 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 2e 20 20 49 74 20 69 73 20 61 6e 20 6f 72 | ms.straightforward...It.is.an.or |
| ad6a0 | 64 65 72 69 6e 67 20 69 6d 70 6f 73 65 64 0a 6f 6e 20 65 76 65 6e 74 73 2e 28 31 29 20 20 46 6f | dering.imposed.on.events.(1)..Fo |
| ad6c0 | 72 20 61 6e 79 20 65 76 65 6e 74 73 20 41 20 61 6e 64 20 42 2c 20 65 69 74 68 65 72 20 41 20 6f | r.any.events.A.and.B,.either.A.o |
| ad6e0 | 63 63 75 72 73 20 62 65 66 6f 72 65 20 42 2c 20 41 20 61 6e 64 0a 42 20 61 72 65 20 73 69 6d 75 | ccurs.before.B,.A.and.B.are.simu |
| ad700 | 6c 74 61 6e 65 6f 75 73 2c 20 6f 72 20 41 20 6f 63 63 75 72 73 20 61 66 74 65 72 20 42 2e 20 20 | ltaneous,.or.A.occurs.after.B... |
| ad720 | 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 72 65 74 75 72 6e 69 6e 67 20 74 6f 0a 74 68 65 20 62 | For.instance,.returning.to.the.b |
| ad740 | 61 6e 6b 20 61 63 63 6f 75 6e 74 20 65 78 61 6d 70 6c 65 2c 20 73 75 70 70 6f 73 65 20 74 68 61 | ank.account.example,.suppose.tha |
| ad760 | 74 20 50 65 74 65 72 20 77 69 74 68 64 72 61 77 73 20 24 31 30 20 61 6e 64 20 50 61 75 6c 0a 77 | t.Peter.withdraws.$10.and.Paul.w |
| ad780 | 69 74 68 64 72 61 77 73 20 24 32 35 20 66 72 6f 6d 20 61 20 6a 6f 69 6e 74 20 61 63 63 6f 75 6e | ithdraws.$25.from.a.joint.accoun |
| ad7a0 | 74 20 74 68 61 74 20 69 6e 69 74 69 61 6c 6c 79 20 63 6f 6e 74 61 69 6e 73 20 24 31 30 30 2c 20 | t.that.initially.contains.$100,. |
| ad7c0 | 6c 65 61 76 69 6e 67 0a 24 36 35 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 2e 20 20 44 65 70 | leaving.$65.in.the.account...Dep |
| ad7e0 | 65 6e 64 69 6e 67 20 6f 6e 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 20 74 77 6f 20 77 | ending.on.the.order.of.the.two.w |
| ad800 | 69 74 68 64 72 61 77 61 6c 73 2c 20 74 68 65 0a 73 65 71 75 65 6e 63 65 20 6f 66 20 62 61 6c 61 | ithdrawals,.the.sequence.of.bala |
| ad820 | 6e 63 65 73 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 20 69 73 20 65 69 74 68 65 72 20 24 31 | nces.in.the.account.is.either.$1 |
| ad840 | 30 30 20 2d 3e 20 24 39 30 20 2d 3e 20 24 36 35 20 6f 72 0a 24 31 30 30 20 2d 3e 20 24 37 35 20 | 00.->.$90.->.$65.or.$100.->.$75. |
| ad860 | 2d 3e 20 24 36 35 2e 20 20 49 6e 20 61 20 63 6f 6d 70 75 74 65 72 20 69 6d 70 6c 65 6d 65 6e 74 | ->.$65...In.a.computer.implement |
| ad880 | 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 61 6e 6b 69 6e 67 0a 73 79 73 74 65 6d 2c 20 74 68 69 | ation.of.the.banking.system,.thi |
| ad8a0 | 73 20 63 68 61 6e 67 69 6e 67 20 73 65 71 75 65 6e 63 65 20 6f 66 20 62 61 6c 61 6e 63 65 73 20 | s.changing.sequence.of.balances. |
| ad8c0 | 63 6f 75 6c 64 20 62 65 20 6d 6f 64 65 6c 65 64 20 62 79 0a 73 75 63 63 65 73 73 69 76 65 20 61 | could.be.modeled.by.successive.a |
| ad8e0 | 73 73 69 67 6e 6d 65 6e 74 73 20 74 6f 20 61 20 76 61 72 69 61 62 6c 65 20 60 62 61 6c 61 6e 63 | ssignments.to.a.variable.`balanc |
| ad900 | 65 27 2e 0a 0a 20 20 20 49 6e 20 63 6f 6d 70 6c 65 78 20 73 69 74 75 61 74 69 6f 6e 73 2c 20 68 | e'......In.complex.situations,.h |
| ad920 | 6f 77 65 76 65 72 2c 20 73 75 63 68 20 61 20 76 69 65 77 20 63 61 6e 20 62 65 20 70 72 6f 62 6c | owever,.such.a.view.can.be.probl |
| ad940 | 65 6d 61 74 69 63 2e 0a 53 75 70 70 6f 73 65 20 74 68 61 74 20 50 65 74 65 72 20 61 6e 64 20 50 | ematic..Suppose.that.Peter.and.P |
| ad960 | 61 75 6c 2c 20 61 6e 64 20 6f 74 68 65 72 20 70 65 6f 70 6c 65 20 62 65 73 69 64 65 73 2c 20 61 | aul,.and.other.people.besides,.a |
| ad980 | 72 65 20 61 63 63 65 73 73 69 6e 67 0a 74 68 65 20 73 61 6d 65 20 62 61 6e 6b 20 61 63 63 6f 75 | re.accessing.the.same.bank.accou |
| ad9a0 | 6e 74 20 74 68 72 6f 75 67 68 20 61 20 6e 65 74 77 6f 72 6b 20 6f 66 20 62 61 6e 6b 69 6e 67 20 | nt.through.a.network.of.banking. |
| ad9c0 | 6d 61 63 68 69 6e 65 73 20 64 69 73 74 72 69 62 75 74 65 64 0a 61 6c 6c 20 6f 76 65 72 20 74 68 | machines.distributed.all.over.th |
| ad9e0 | 65 20 77 6f 72 6c 64 2e 20 20 54 68 65 20 61 63 74 75 61 6c 20 73 65 71 75 65 6e 63 65 20 6f 66 | e.world...The.actual.sequence.of |
| ada00 | 20 62 61 6c 61 6e 63 65 73 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 0a 77 69 6c 6c 20 64 65 | .balances.in.the.account.will.de |
| ada20 | 70 65 6e 64 20 63 72 69 74 69 63 61 6c 6c 79 20 6f 6e 20 74 68 65 20 64 65 74 61 69 6c 65 64 20 | pend.critically.on.the.detailed. |
| ada40 | 74 69 6d 69 6e 67 20 6f 66 20 74 68 65 20 61 63 63 65 73 73 65 73 20 61 6e 64 20 74 68 65 0a 64 | timing.of.the.accesses.and.the.d |
| ada60 | 65 74 61 69 6c 73 20 6f 66 20 74 68 65 20 63 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 20 61 6d 6f 6e | etails.of.the.communication.amon |
| ada80 | 67 20 74 68 65 20 6d 61 63 68 69 6e 65 73 2e 0a 0a 20 20 20 54 68 69 73 20 69 6e 64 65 74 65 72 | g.the.machines......This.indeter |
| adaa0 | 6d 69 6e 61 63 79 20 69 6e 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 65 76 65 6e 74 73 20 63 61 | minacy.in.the.order.of.events.ca |
| adac0 | 6e 20 70 6f 73 65 20 73 65 72 69 6f 75 73 20 70 72 6f 62 6c 65 6d 73 0a 69 6e 20 74 68 65 20 64 | n.pose.serious.problems.in.the.d |
| adae0 | 65 73 69 67 6e 20 6f 66 20 63 6f 6e 63 75 72 72 65 6e 74 20 73 79 73 74 65 6d 73 2e 20 20 46 6f | esign.of.concurrent.systems...Fo |
| adb00 | 72 20 69 6e 73 74 61 6e 63 65 2c 20 73 75 70 70 6f 73 65 20 74 68 61 74 20 74 68 65 0a 77 69 74 | r.instance,.suppose.that.the.wit |
| adb20 | 68 64 72 61 77 61 6c 73 20 6d 61 64 65 20 62 79 20 50 65 74 65 72 20 61 6e 64 20 50 61 75 6c 20 | hdrawals.made.by.Peter.and.Paul. |
| adb40 | 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 74 77 6f 20 73 65 70 61 72 61 74 65 0a | are.implemented.as.two.separate. |
| adb60 | 70 72 6f 63 65 73 73 65 73 20 73 68 61 72 69 6e 67 20 61 20 63 6f 6d 6d 6f 6e 20 76 61 72 69 61 | processes.sharing.a.common.varia |
| adb80 | 62 6c 65 20 60 62 61 6c 61 6e 63 65 27 2c 20 65 61 63 68 20 70 72 6f 63 65 73 73 20 73 70 65 63 | ble.`balance',.each.process.spec |
| adba0 | 69 66 69 65 64 0a 62 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 67 69 76 65 6e 20 69 6e 20 | ified.by.the.procedure.given.in. |
| adbc0 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 65 | section.*Note.3-1-1:::.......(de |
| adbe0 | 66 69 6e 65 20 28 77 69 74 68 64 72 61 77 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 28 69 | fine.(withdraw.amount)........(i |
| adc00 | 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 | f.(>=.balance.amount)........... |
| adc20 | 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 | .(begin.(set!.balance.(-.balance |
| adc40 | 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 | .amount))...................bala |
| adc60 | 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 | nce)............"Insufficient.fu |
| adc80 | 6e 64 73 22 29 29 0a 0a 20 20 20 49 66 20 74 68 65 20 74 77 6f 20 70 72 6f 63 65 73 73 65 73 20 | nds")).....If.the.two.processes. |
| adca0 | 6f 70 65 72 61 74 65 20 69 6e 64 65 70 65 6e 64 65 6e 74 6c 79 2c 20 74 68 65 6e 20 50 65 74 65 | operate.independently,.then.Pete |
| adcc0 | 72 20 6d 69 67 68 74 20 74 65 73 74 20 74 68 65 0a 62 61 6c 61 6e 63 65 20 61 6e 64 20 61 74 74 | r.might.test.the.balance.and.att |
| adce0 | 65 6d 70 74 20 74 6f 20 77 69 74 68 64 72 61 77 20 61 20 6c 65 67 69 74 69 6d 61 74 65 20 61 6d | empt.to.withdraw.a.legitimate.am |
| add00 | 6f 75 6e 74 2e 20 20 48 6f 77 65 76 65 72 2c 20 50 61 75 6c 0a 6d 69 67 68 74 20 77 69 74 68 64 | ount...However,.Paul.might.withd |
| add20 | 72 61 77 20 73 6f 6d 65 20 66 75 6e 64 73 20 69 6e 20 62 65 74 77 65 65 6e 20 74 68 65 20 74 69 | raw.some.funds.in.between.the.ti |
| add40 | 6d 65 20 74 68 61 74 20 50 65 74 65 72 20 63 68 65 63 6b 73 20 74 68 65 0a 62 61 6c 61 6e 63 65 | me.that.Peter.checks.the.balance |
| add60 | 20 61 6e 64 20 74 68 65 20 74 69 6d 65 20 50 65 74 65 72 20 63 6f 6d 70 6c 65 74 65 73 20 74 68 | .and.the.time.Peter.completes.th |
| add80 | 65 20 77 69 74 68 64 72 61 77 61 6c 2c 20 74 68 75 73 20 69 6e 76 61 6c 69 64 61 74 69 6e 67 0a | e.withdrawal,.thus.invalidating. |
| adda0 | 50 65 74 65 72 27 73 20 74 65 73 74 2e 0a 0a 20 20 20 54 68 69 6e 67 73 20 63 61 6e 20 62 65 20 | Peter's.test......Things.can.be. |
| addc0 | 77 6f 72 73 65 20 73 74 69 6c 6c 2e 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 65 78 70 72 65 | worse.still...Consider.the.expre |
| adde0 | 73 73 69 6f 6e 0a 0a 20 20 20 20 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c | ssion.......(set!.balance.(-.bal |
| ade00 | 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 0a 65 78 65 63 75 74 65 64 20 61 73 20 70 61 72 74 20 | ance.amount))..executed.as.part. |
| ade20 | 6f 66 20 65 61 63 68 20 77 69 74 68 64 72 61 77 61 6c 20 70 72 6f 63 65 73 73 2e 20 20 54 68 69 | of.each.withdrawal.process...Thi |
| ade40 | 73 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 74 68 72 65 65 0a 73 74 65 70 73 3a 20 28 31 29 20 61 | s.consists.of.three.steps:.(1).a |
| ade60 | 63 63 65 73 73 69 6e 67 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 62 61 6c 61 6e | ccessing.the.value.of.the.`balan |
| ade80 | 63 65 27 20 76 61 72 69 61 62 6c 65 3b 20 28 32 29 20 63 6f 6d 70 75 74 69 6e 67 0a 74 68 65 20 | ce'.variable;.(2).computing.the. |
| adea0 | 6e 65 77 20 62 61 6c 61 6e 63 65 3b 20 28 33 29 20 73 65 74 74 69 6e 67 20 60 62 61 6c 61 6e 63 | new.balance;.(3).setting.`balanc |
| adec0 | 65 27 20 74 6f 20 74 68 69 73 20 6e 65 77 20 76 61 6c 75 65 2e 20 20 49 66 20 50 65 74 65 72 20 | e'.to.this.new.value...If.Peter. |
| adee0 | 61 6e 64 0a 50 61 75 6c 27 73 20 77 69 74 68 64 72 61 77 61 6c 73 20 65 78 65 63 75 74 65 20 74 | and.Paul's.withdrawals.execute.t |
| adf00 | 68 69 73 20 73 74 61 74 65 6d 65 6e 74 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 2c 20 74 68 65 6e | his.statement.concurrently,.then |
| adf20 | 20 74 68 65 20 74 77 6f 0a 77 69 74 68 64 72 61 77 61 6c 73 20 6d 69 67 68 74 20 69 6e 74 65 72 | .the.two.withdrawals.might.inter |
| adf40 | 6c 65 61 76 65 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 79 20 61 63 | leave.the.order.in.which.they.ac |
| adf60 | 63 65 73 73 20 60 62 61 6c 61 6e 63 65 27 0a 61 6e 64 20 73 65 74 20 69 74 20 74 6f 20 74 68 65 | cess.`balance'.and.set.it.to.the |
| adf80 | 20 6e 65 77 20 76 61 6c 75 65 2e 0a 0a 20 20 20 54 68 65 20 74 69 6d 69 6e 67 20 64 69 61 67 72 | .new.value......The.timing.diagr |
| adfa0 | 61 6d 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 32 39 3a 3a 20 64 65 70 69 63 74 | am.in.*Note.Figure.3-29::.depict |
| adfc0 | 73 20 61 6e 20 6f 72 64 65 72 20 6f 66 20 65 76 65 6e 74 73 0a 77 68 65 72 65 20 60 62 61 6c 61 | s.an.order.of.events.where.`bala |
| adfe0 | 6e 63 65 27 20 73 74 61 72 74 73 20 61 74 20 31 30 30 2c 20 50 65 74 65 72 20 77 69 74 68 64 72 | nce'.starts.at.100,.Peter.withdr |
| ae000 | 61 77 73 20 31 30 2c 20 50 61 75 6c 20 77 69 74 68 64 72 61 77 73 20 32 35 2c 0a 61 6e 64 20 79 | aws.10,.Paul.withdraws.25,.and.y |
| ae020 | 65 74 20 74 68 65 20 66 69 6e 61 6c 20 76 61 6c 75 65 20 6f 66 20 60 62 61 6c 61 6e 63 65 27 20 | et.the.final.value.of.`balance'. |
| ae040 | 69 73 20 37 35 2e 20 20 41 73 20 73 68 6f 77 6e 20 69 6e 20 74 68 65 20 64 69 61 67 72 61 6d 2c | is.75...As.shown.in.the.diagram, |
| ae060 | 0a 74 68 65 20 72 65 61 73 6f 6e 20 66 6f 72 20 74 68 69 73 20 61 6e 6f 6d 61 6c 79 20 69 73 20 | .the.reason.for.this.anomaly.is. |
| ae080 | 74 68 61 74 20 50 61 75 6c 27 73 20 61 73 73 69 67 6e 6d 65 6e 74 20 6f 66 20 37 35 20 74 6f 0a | that.Paul's.assignment.of.75.to. |
| ae0a0 | 60 62 61 6c 61 6e 63 65 27 20 69 73 20 6d 61 64 65 20 75 6e 64 65 72 20 74 68 65 20 61 73 73 75 | `balance'.is.made.under.the.assu |
| ae0c0 | 6d 70 74 69 6f 6e 20 74 68 61 74 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 62 61 6c 61 6e 63 | mption.that.the.value.of.`balanc |
| ae0e0 | 65 27 20 74 6f 0a 62 65 20 64 65 63 72 65 6d 65 6e 74 65 64 20 69 73 20 31 30 30 2e 20 20 54 68 | e'.to.be.decremented.is.100...Th |
| ae100 | 61 74 20 61 73 73 75 6d 70 74 69 6f 6e 2c 20 68 6f 77 65 76 65 72 2c 20 62 65 63 61 6d 65 20 69 | at.assumption,.however,.became.i |
| ae120 | 6e 76 61 6c 69 64 20 77 68 65 6e 0a 50 65 74 65 72 20 63 68 61 6e 67 65 64 20 60 62 61 6c 61 6e | nvalid.when.Peter.changed.`balan |
| ae140 | 63 65 27 20 74 6f 20 39 30 2e 20 20 54 68 69 73 20 69 73 20 61 20 63 61 74 61 73 74 72 6f 70 68 | ce'.to.90...This.is.a.catastroph |
| ae160 | 69 63 20 66 61 69 6c 75 72 65 20 66 6f 72 20 74 68 65 0a 62 61 6e 6b 69 6e 67 20 73 79 73 74 65 | ic.failure.for.the.banking.syste |
| ae180 | 6d 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 74 6f 74 61 6c 20 61 6d 6f 75 6e 74 20 6f 66 20 6d | m,.because.the.total.amount.of.m |
| ae1a0 | 6f 6e 65 79 20 69 6e 20 74 68 65 20 73 79 73 74 65 6d 20 69 73 20 6e 6f 74 0a 63 6f 6e 73 65 72 | oney.in.the.system.is.not.conser |
| ae1c0 | 76 65 64 2e 20 20 42 65 66 6f 72 65 20 74 68 65 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 2c 20 74 | ved...Before.the.transactions,.t |
| ae1e0 | 68 65 20 74 6f 74 61 6c 20 61 6d 6f 75 6e 74 20 6f 66 20 6d 6f 6e 65 79 20 77 61 73 0a 24 31 30 | he.total.amount.of.money.was.$10 |
| ae200 | 30 2e 20 20 41 66 74 65 72 77 61 72 64 73 2c 20 50 65 74 65 72 20 68 61 73 20 24 31 30 2c 20 50 | 0...Afterwards,.Peter.has.$10,.P |
| ae220 | 61 75 6c 20 68 61 73 20 24 32 35 2c 20 61 6e 64 20 74 68 65 20 62 61 6e 6b 20 68 61 73 20 24 37 | aul.has.$25,.and.the.bank.has.$7 |
| ae240 | 35 2e 28 32 29 0a 0a 20 20 20 54 68 65 20 67 65 6e 65 72 61 6c 20 70 68 65 6e 6f 6d 65 6e 6f 6e | 5.(2).....The.general.phenomenon |
| ae260 | 20 69 6c 6c 75 73 74 72 61 74 65 64 20 68 65 72 65 20 69 73 20 74 68 61 74 20 73 65 76 65 72 61 | .illustrated.here.is.that.severa |
| ae280 | 6c 20 70 72 6f 63 65 73 73 65 73 0a 6d 61 79 20 73 68 61 72 65 20 61 20 63 6f 6d 6d 6f 6e 20 73 | l.processes.may.share.a.common.s |
| ae2a0 | 74 61 74 65 20 76 61 72 69 61 62 6c 65 2e 20 20 57 68 61 74 20 6d 61 6b 65 73 20 74 68 69 73 20 | tate.variable...What.makes.this. |
| ae2c0 | 63 6f 6d 70 6c 69 63 61 74 65 64 20 69 73 20 74 68 61 74 0a 6d 6f 72 65 20 74 68 61 6e 20 6f 6e | complicated.is.that.more.than.on |
| ae2e0 | 65 20 70 72 6f 63 65 73 73 20 6d 61 79 20 62 65 20 74 72 79 69 6e 67 20 74 6f 20 6d 61 6e 69 70 | e.process.may.be.trying.to.manip |
| ae300 | 75 6c 61 74 65 20 74 68 65 20 73 68 61 72 65 64 20 73 74 61 74 65 20 61 74 0a 74 68 65 20 73 61 | ulate.the.shared.state.at.the.sa |
| ae320 | 6d 65 20 74 69 6d 65 2e 20 20 46 6f 72 20 74 68 65 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 20 65 | me.time...For.the.bank.account.e |
| ae340 | 78 61 6d 70 6c 65 2c 20 64 75 72 69 6e 67 20 65 61 63 68 20 74 72 61 6e 73 61 63 74 69 6f 6e 2c | xample,.during.each.transaction, |
| ae360 | 0a 65 61 63 68 20 63 75 73 74 6f 6d 65 72 20 73 68 6f 75 6c 64 20 62 65 20 61 62 6c 65 20 74 6f | .each.customer.should.be.able.to |
| ae380 | 20 61 63 74 20 61 73 20 69 66 20 74 68 65 20 6f 74 68 65 72 20 63 75 73 74 6f 6d 65 72 73 20 64 | .act.as.if.the.other.customers.d |
| ae3a0 | 69 64 20 6e 6f 74 0a 65 78 69 73 74 2e 20 20 57 68 65 6e 20 61 20 63 75 73 74 6f 6d 65 72 20 63 | id.not.exist...When.a.customer.c |
| ae3c0 | 68 61 6e 67 65 73 20 74 68 65 20 62 61 6c 61 6e 63 65 20 69 6e 20 61 20 77 61 79 20 74 68 61 74 | hanges.the.balance.in.a.way.that |
| ae3e0 | 20 64 65 70 65 6e 64 73 20 6f 6e 0a 74 68 65 20 62 61 6c 61 6e 63 65 2c 20 68 65 20 6d 75 73 74 | .depends.on.the.balance,.he.must |
| ae400 | 20 62 65 20 61 62 6c 65 20 74 6f 20 61 73 73 75 6d 65 20 74 68 61 74 2c 20 6a 75 73 74 20 62 65 | .be.able.to.assume.that,.just.be |
| ae420 | 66 6f 72 65 20 74 68 65 20 6d 6f 6d 65 6e 74 20 6f 66 0a 63 68 61 6e 67 65 2c 20 74 68 65 20 62 | fore.the.moment.of.change,.the.b |
| ae440 | 61 6c 61 6e 63 65 20 69 73 20 73 74 69 6c 6c 20 77 68 61 74 20 68 65 20 74 68 6f 75 67 68 74 20 | alance.is.still.what.he.thought. |
| ae460 | 69 74 20 77 61 73 2e 0a 0a 43 6f 72 72 65 63 74 20 62 65 68 61 76 69 6f 72 20 6f 66 20 63 6f 6e | it.was...Correct.behavior.of.con |
| ae480 | 63 75 72 72 65 6e 74 20 70 72 6f 67 72 61 6d 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | current.programs................ |
| ae4a0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 61 62 | ..........................The.ab |
| ae4c0 | 6f 76 65 20 65 78 61 6d 70 6c 65 20 74 79 70 69 66 69 65 73 20 74 68 65 20 73 75 62 74 6c 65 20 | ove.example.typifies.the.subtle. |
| ae4e0 | 62 75 67 73 20 74 68 61 74 20 63 61 6e 20 63 72 65 65 70 20 69 6e 74 6f 0a 63 6f 6e 63 75 72 72 | bugs.that.can.creep.into.concurr |
| ae500 | 65 6e 74 20 70 72 6f 67 72 61 6d 73 2e 20 20 54 68 65 20 72 6f 6f 74 20 6f 66 20 74 68 69 73 20 | ent.programs...The.root.of.this. |
| ae520 | 63 6f 6d 70 6c 65 78 69 74 79 20 6c 69 65 73 20 69 6e 20 74 68 65 0a 61 73 73 69 67 6e 6d 65 6e | complexity.lies.in.the.assignmen |
| ae540 | 74 73 20 74 6f 20 76 61 72 69 61 62 6c 65 73 20 74 68 61 74 20 61 72 65 20 73 68 61 72 65 64 20 | ts.to.variables.that.are.shared. |
| ae560 | 61 6d 6f 6e 67 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 63 65 73 73 65 73 2e 0a 57 | among.the.different.processes..W |
| ae580 | 65 20 61 6c 72 65 61 64 79 20 6b 6e 6f 77 20 74 68 61 74 20 77 65 20 6d 75 73 74 20 62 65 20 63 | e.already.know.that.we.must.be.c |
| ae5a0 | 61 72 65 66 75 6c 20 69 6e 20 77 72 69 74 69 6e 67 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 | areful.in.writing.programs.that. |
| ae5c0 | 75 73 65 0a 60 73 65 74 21 27 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 72 65 73 75 6c 74 73 20 | use.`set!',.because.the.results. |
| ae5e0 | 6f 66 20 61 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 64 65 70 65 6e 64 20 6f 6e 20 74 68 65 20 6f | of.a.computation.depend.on.the.o |
| ae600 | 72 64 65 72 20 69 6e 0a 77 68 69 63 68 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 6f 63 | rder.in.which.the.assignments.oc |
| ae620 | 63 75 72 2e 28 33 29 20 20 57 69 74 68 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 | cur.(3)..With.concurrent.process |
| ae640 | 65 73 20 77 65 20 6d 75 73 74 20 62 65 0a 65 73 70 65 63 69 61 6c 6c 79 20 63 61 72 65 66 75 6c | es.we.must.be.especially.careful |
| ae660 | 20 61 62 6f 75 74 20 61 73 73 69 67 6e 6d 65 6e 74 73 2c 20 62 65 63 61 75 73 65 20 77 65 20 6d | .about.assignments,.because.we.m |
| ae680 | 61 79 20 6e 6f 74 20 62 65 20 61 62 6c 65 20 74 6f 0a 63 6f 6e 74 72 6f 6c 20 74 68 65 20 6f 72 | ay.not.be.able.to.control.the.or |
| ae6a0 | 64 65 72 20 6f 66 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 6d 61 64 65 20 62 79 20 74 | der.of.the.assignments.made.by.t |
| ae6c0 | 68 65 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 63 65 73 73 65 73 2e 0a 49 66 20 73 65 76 65 72 | he.different.processes..If.sever |
| ae6e0 | 61 6c 20 73 75 63 68 20 63 68 61 6e 67 65 73 20 6d 69 67 68 74 20 62 65 20 6d 61 64 65 20 63 6f | al.such.changes.might.be.made.co |
| ae700 | 6e 63 75 72 72 65 6e 74 6c 79 20 28 61 73 20 77 69 74 68 20 74 77 6f 0a 64 65 70 6f 73 69 74 6f | ncurrently.(as.with.two.deposito |
| ae720 | 72 73 20 61 63 63 65 73 73 69 6e 67 20 61 20 6a 6f 69 6e 74 20 61 63 63 6f 75 6e 74 29 20 77 65 | rs.accessing.a.joint.account).we |
| ae740 | 20 6e 65 65 64 20 73 6f 6d 65 20 77 61 79 20 74 6f 20 65 6e 73 75 72 65 20 74 68 61 74 0a 6f 75 | .need.some.way.to.ensure.that.ou |
| ae760 | 72 20 73 79 73 74 65 6d 20 62 65 68 61 76 65 73 20 63 6f 72 72 65 63 74 6c 79 2e 20 20 46 6f 72 | r.system.behaves.correctly...For |
| ae780 | 20 65 78 61 6d 70 6c 65 2c 20 69 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 77 69 74 68 64 72 61 | .example,.in.the.case.of.withdra |
| ae7a0 | 77 61 6c 73 0a 66 72 6f 6d 20 61 20 6a 6f 69 6e 74 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 2c 20 | wals.from.a.joint.bank.account,. |
| ae7c0 | 77 65 20 6d 75 73 74 20 65 6e 73 75 72 65 20 74 68 61 74 20 6d 6f 6e 65 79 20 69 73 20 63 6f 6e | we.must.ensure.that.money.is.con |
| ae7e0 | 73 65 72 76 65 64 2e 20 20 54 6f 0a 6d 61 6b 65 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 6f 67 | served...To.make.concurrent.prog |
| ae800 | 72 61 6d 73 20 62 65 68 61 76 65 20 63 6f 72 72 65 63 74 6c 79 2c 20 77 65 20 6d 61 79 20 68 61 | rams.behave.correctly,.we.may.ha |
| ae820 | 76 65 20 74 6f 20 70 6c 61 63 65 20 73 6f 6d 65 0a 72 65 73 74 72 69 63 74 69 6f 6e 73 20 6f 6e | ve.to.place.some.restrictions.on |
| ae840 | 20 63 6f 6e 63 75 72 72 65 6e 74 20 65 78 65 63 75 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 46 69 | .concurrent.execution........*Fi |
| ae860 | 67 75 72 65 20 33 2e 32 39 3a 2a 20 54 69 6d 69 6e 67 20 64 69 61 67 72 61 6d 20 73 68 6f 77 69 | gure.3.29:*.Timing.diagram.showi |
| ae880 | 6e 67 20 68 6f 77 20 69 6e 74 65 72 6c 65 61 76 69 6e 67 20 74 68 65 20 6f 72 64 65 72 0a 20 20 | ng.how.interleaving.the.order... |
| ae8a0 | 20 20 20 6f 66 20 65 76 65 6e 74 73 20 69 6e 20 74 77 6f 20 62 61 6e 6b 69 6e 67 20 77 69 74 68 | ...of.events.in.two.banking.with |
| ae8c0 | 64 72 61 77 61 6c 73 20 63 61 6e 20 6c 65 61 64 20 74 6f 20 61 6e 20 69 6e 63 6f 72 72 65 63 74 | drawals.can.lead.to.an.incorrect |
| ae8e0 | 0a 20 20 20 20 20 66 69 6e 61 6c 20 62 61 6c 61 6e 63 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 | ......final.balance............. |
| ae900 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 50 65 74 65 72 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .|...........Peter.............. |
| ae920 | 42 61 6e 6b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 61 75 6c 0a 20 20 20 20 20 20 20 20 20 | Bank..............Paul.......... |
| ae940 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..|............................. |
| ae960 | 20 5f 5f 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .____............|.............. |
| ae980 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 | .............../....\........... |
| ae9a0 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c 20 | .|..............--------------|. |
| ae9c0 | 24 31 30 30 20 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2e 0a 20 20 20 20 20 20 20 20 20 20 20 | $100.|-------------............. |
| ae9e0 | 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 5f | |.............|...............\_ |
| aea00 | 5f 5f 5f 2f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c | ___/..............|............| |
| aea20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............V.................. |
| aea40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 | .................V............|. |
| aea60 | 20 2e 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2e 20 20 20 20 20 20 20 | ..----------------------........ |
| aea80 | 20 20 20 20 20 2e 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2e 0a 20 20 | ......----------------------.... |
| aeaa0 | 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 41 63 63 65 73 73 20 62 61 6c 61 6e 63 65 3a 20 24 31 | .........|..|.Access.balance:.$1 |
| aeac0 | 30 30 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 41 63 63 65 73 73 20 62 61 6c 61 6e 63 65 | 00.|............|.Access.balance |
| aeae0 | 3a 20 24 31 30 30 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 60 2d 2d 2d 2d 2d 2d 2d 2d | :.$100.|............|..`-------- |
| aeb00 | 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 27 20 20 20 20 20 20 20 20 20 20 20 20 60 2d 2d 2d 2d | --+-----------'............`---- |
| aeb20 | 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 27 0a 20 20 20 20 20 20 20 20 20 20 20 7c | ------+-----------'............| |
| aeb40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............V.................. |
| aeb60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 | .................V............|. |
| aeb80 | 20 2e 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2e 20 20 20 20 20 20 20 | ..----------------------........ |
| aeba0 | 20 20 20 20 20 2e 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2e 0a 20 20 | ......----------------------.... |
| aebc0 | 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 6e 65 77 20 76 61 6c 75 65 3a 20 31 30 30 2d 31 30 3d | .........|..|.new.value:.100-10= |
| aebe0 | 39 30 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 6e 65 77 20 76 61 6c 75 65 3a 20 31 30 30 | 90.|............|.new.value:.100 |
| aec00 | 2d 32 35 3d 37 35 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 60 2d 2d 2d 2d 2d 2d 2d 2d | -25=75.|............|..`-------- |
| aec20 | 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 27 20 20 20 20 20 20 20 20 20 20 20 20 60 2d 2d 2d 2d | --+-----------'............`---- |
| aec40 | 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 27 0a 20 20 20 20 20 20 20 20 20 20 20 7c | ------+-----------'............| |
| aec60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............V.................. |
| aec80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 | .................|............|. |
| aeca0 | 20 2e 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2e 20 20 20 20 20 20 20 | ..----------------------........ |
| aecc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ................|............|.. |
| aece0 | 7c 20 73 65 74 21 20 62 61 6c 61 6e 63 65 20 74 6f 20 24 39 30 20 20 7c 20 20 20 20 20 20 20 20 | |.set!.balance.to.$90..|........ |
| aed00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 60 | ...............|............|..` |
| aed20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 27 20 20 20 20 5f 5f 5f 5f 20 | ----------+-----------'....____. |
| aed40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 | ..............|............|.... |
| aed60 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 5c 20 | .........|.............../....\. |
| aed80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 | .............|............|..... |
| aeda0 | 20 20 20 20 20 20 20 20 60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 7c 20 24 20 39 30 20 7c 20 | ........`------------->|.$.90.|. |
| aedc0 | 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | ............V............|...... |
| aede0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 5f 2f 20 20 20 | .......................\____/... |
| aee00 | 2e 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2e 0a 20 20 20 20 20 20 20 | .----------------------......... |
| aee20 | 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....|........................... |
| aee40 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 6e 65 77 20 76 61 6c 75 65 3a 20 31 30 30 2d 32 35 3d 37 | ...........|.new.value:.100-25=7 |
| aee60 | 35 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 5.|............|................ |
| aee80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 5f 5f 20 20 20 20 60 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..............____....`--------- |
| aeea0 | 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 27 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 | -+-----------'............|..... |
| aeec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 5c 20 20 | ......................../....\.. |
| aeee0 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | ............|............|...... |
| aef00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 24 20 39 30 20 7c 3c 2d | ......................|.$.90.|<- |
| aef20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 27 0a 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 | -----------'............V....... |
| aef40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 5f 2f 0a 20 20 20 | ......................\____/.... |
| aef60 | 20 20 20 20 20 20 20 74 69 6d 65 0a 0a 20 20 20 4f 6e 65 20 70 6f 73 73 69 62 6c 65 20 72 65 73 | .......time.....One.possible.res |
| aef80 | 74 72 69 63 74 69 6f 6e 20 6f 6e 20 63 6f 6e 63 75 72 72 65 6e 63 79 20 77 6f 75 6c 64 20 73 74 | triction.on.concurrency.would.st |
| aefa0 | 69 70 75 6c 61 74 65 20 74 68 61 74 20 6e 6f 20 74 77 6f 0a 6f 70 65 72 61 74 69 6f 6e 73 20 74 | ipulate.that.no.two.operations.t |
| aefc0 | 68 61 74 20 63 68 61 6e 67 65 20 61 6e 79 20 73 68 61 72 65 64 20 73 74 61 74 65 20 76 61 72 69 | hat.change.any.shared.state.vari |
| aefe0 | 61 62 6c 65 73 20 63 61 6e 20 6f 63 63 75 72 20 61 74 20 74 68 65 20 73 61 6d 65 0a 74 69 6d 65 | ables.can.occur.at.the.same.time |
| af000 | 2e 20 20 54 68 69 73 20 69 73 20 61 6e 20 65 78 74 72 65 6d 65 6c 79 20 73 74 72 69 6e 67 65 6e | ...This.is.an.extremely.stringen |
| af020 | 74 20 72 65 71 75 69 72 65 6d 65 6e 74 2e 20 20 46 6f 72 20 64 69 73 74 72 69 62 75 74 65 64 0a | t.requirement...For.distributed. |
| af040 | 62 61 6e 6b 69 6e 67 2c 20 69 74 20 77 6f 75 6c 64 20 72 65 71 75 69 72 65 20 74 68 65 20 73 79 | banking,.it.would.require.the.sy |
| af060 | 73 74 65 6d 20 64 65 73 69 67 6e 65 72 20 74 6f 20 65 6e 73 75 72 65 20 74 68 61 74 20 6f 6e 6c | stem.designer.to.ensure.that.onl |
| af080 | 79 20 6f 6e 65 0a 74 72 61 6e 73 61 63 74 69 6f 6e 20 63 6f 75 6c 64 20 70 72 6f 63 65 65 64 20 | y.one.transaction.could.proceed. |
| af0a0 | 61 74 20 61 20 74 69 6d 65 2e 20 20 54 68 69 73 20 77 6f 75 6c 64 20 62 65 20 62 6f 74 68 20 69 | at.a.time...This.would.be.both.i |
| af0c0 | 6e 65 66 66 69 63 69 65 6e 74 0a 61 6e 64 20 6f 76 65 72 6c 79 20 63 6f 6e 73 65 72 76 61 74 69 | nefficient.and.overly.conservati |
| af0e0 | 76 65 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 33 30 3a 3a 20 73 68 6f 77 73 20 50 | ve...*Note.Figure.3-30::.shows.P |
| af100 | 65 74 65 72 20 61 6e 64 20 50 61 75 6c 0a 73 68 61 72 69 6e 67 20 61 20 62 61 6e 6b 20 61 63 63 | eter.and.Paul.sharing.a.bank.acc |
| af120 | 6f 75 6e 74 2c 20 77 68 65 72 65 20 50 61 75 6c 20 68 61 73 20 61 20 70 72 69 76 61 74 65 20 61 | ount,.where.Paul.has.a.private.a |
| af140 | 63 63 6f 75 6e 74 20 61 73 20 77 65 6c 6c 2e 20 20 54 68 65 0a 64 69 61 67 72 61 6d 20 69 6c 6c | ccount.as.well...The.diagram.ill |
| af160 | 75 73 74 72 61 74 65 73 20 74 77 6f 20 77 69 74 68 64 72 61 77 61 6c 73 20 66 72 6f 6d 20 74 68 | ustrates.two.withdrawals.from.th |
| af180 | 65 20 73 68 61 72 65 64 20 61 63 63 6f 75 6e 74 20 28 6f 6e 65 20 62 79 0a 50 65 74 65 72 20 61 | e.shared.account.(one.by.Peter.a |
| af1a0 | 6e 64 20 6f 6e 65 20 62 79 20 50 61 75 6c 29 20 61 6e 64 20 61 20 64 65 70 6f 73 69 74 20 74 6f | nd.one.by.Paul).and.a.deposit.to |
| af1c0 | 20 50 61 75 6c 27 73 20 70 72 69 76 61 74 65 20 61 63 63 6f 75 6e 74 2e 28 34 29 20 20 54 68 65 | .Paul's.private.account.(4)..The |
| af1e0 | 0a 74 77 6f 20 77 69 74 68 64 72 61 77 61 6c 73 20 66 72 6f 6d 20 74 68 65 20 73 68 61 72 65 64 | .two.withdrawals.from.the.shared |
| af200 | 20 61 63 63 6f 75 6e 74 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 63 6f 6e 63 75 72 72 65 6e 74 20 | .account.must.not.be.concurrent. |
| af220 | 28 73 69 6e 63 65 0a 62 6f 74 68 20 61 63 63 65 73 73 20 61 6e 64 20 75 70 64 61 74 65 20 74 68 | (since.both.access.and.update.th |
| af240 | 65 20 73 61 6d 65 20 61 63 63 6f 75 6e 74 29 2c 20 61 6e 64 20 50 61 75 6c 27 73 20 64 65 70 6f | e.same.account),.and.Paul's.depo |
| af260 | 73 69 74 20 61 6e 64 0a 77 69 74 68 64 72 61 77 61 6c 20 6d 75 73 74 20 6e 6f 74 20 62 65 20 63 | sit.and.withdrawal.must.not.be.c |
| af280 | 6f 6e 63 75 72 72 65 6e 74 20 28 73 69 6e 63 65 20 62 6f 74 68 20 61 63 63 65 73 73 20 61 6e 64 | oncurrent.(since.both.access.and |
| af2a0 | 20 75 70 64 61 74 65 20 74 68 65 0a 61 6d 6f 75 6e 74 20 69 6e 20 50 61 75 6c 27 73 20 77 61 6c | .update.the.amount.in.Paul's.wal |
| af2c0 | 6c 65 74 29 2e 20 20 42 75 74 20 74 68 65 72 65 20 73 68 6f 75 6c 64 20 62 65 20 6e 6f 20 70 72 | let)...But.there.should.be.no.pr |
| af2e0 | 6f 62 6c 65 6d 20 70 65 72 6d 69 74 74 69 6e 67 0a 50 61 75 6c 27 73 20 64 65 70 6f 73 69 74 20 | oblem.permitting.Paul's.deposit. |
| af300 | 74 6f 20 68 69 73 20 70 72 69 76 61 74 65 20 61 63 63 6f 75 6e 74 20 74 6f 20 70 72 6f 63 65 65 | to.his.private.account.to.procee |
| af320 | 64 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 20 77 69 74 68 0a 50 65 74 65 72 27 73 20 77 69 74 68 | d.concurrently.with.Peter's.with |
| af340 | 64 72 61 77 61 6c 20 66 72 6f 6d 20 74 68 65 20 73 68 61 72 65 64 20 61 63 63 6f 75 6e 74 2e 0a | drawal.from.the.shared.account.. |
| af360 | 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 33 30 3a 2a 20 43 6f 6e 63 75 72 72 65 6e 74 20 | ......*Figure.3.30:*.Concurrent. |
| af380 | 64 65 70 6f 73 69 74 73 20 61 6e 64 20 77 69 74 68 64 72 61 77 61 6c 73 20 66 72 6f 6d 20 61 20 | deposits.and.withdrawals.from.a. |
| af3a0 | 6a 6f 69 6e 74 0a 20 20 20 20 20 61 63 63 6f 75 6e 74 20 69 6e 20 42 61 6e 6b 31 20 61 6e 64 20 | joint......account.in.Bank1.and. |
| af3c0 | 61 20 70 72 69 76 61 74 65 20 61 63 63 6f 75 6e 74 20 69 6e 20 42 61 6e 6b 32 2e 0a 0a 20 20 20 | a.private.account.in.Bank2...... |
| af3e0 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 50 65 74 65 72 20 20 20 20 20 20 20 20 20 20 42 61 6e 6b | ........|....Peter..........Bank |
| af400 | 31 20 20 20 20 20 20 20 20 20 20 50 61 75 6c 20 20 20 20 20 20 20 20 20 20 20 42 61 6e 6b 32 0a | 1..........Paul...........Bank2. |
| af420 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 5f 5f 5f 5f 20 20 20 20 20 20 20 20 20 20 20 5f | ...........|....____..........._ |
| af440 | 5f 5f 5f 20 20 20 20 20 20 20 20 20 20 20 5f 5f 5f 5f 20 20 20 20 20 20 20 20 20 20 20 5f 5f 5f | ___...........____...........___ |
| af460 | 5f 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 2f 20 20 20 20 5c 20 20 20 20 20 20 20 20 20 | _............|.../....\......... |
| af480 | 2f 20 20 20 20 5c 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 5c 20 20 20 20 20 20 20 20 20 2f 20 | /....\........./....\........./. |
| af4a0 | 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 20 24 37 20 20 7c 2d 2d 2e 20 2e | ...\............|..|..$7..|--... |
| af4c0 | 2d 2d 7c 20 24 31 30 30 20 7c 20 20 20 20 20 20 20 7c 20 20 24 35 20 20 7c 2d 2d 2e 20 2e 2d 2d | --|.$100.|.......|..$5..|--...-- |
| af4e0 | 7c 20 24 33 30 30 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 5c 5f 5f 5f 5f 2f 20 20 | |.$300.|............|...\____/.. |
| af500 | 20 56 20 56 20 20 20 5c 5f 5f 5f 5f 2f 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 5f 2f 20 20 20 56 | .V.V...\____/.........\____/...V |
| af520 | 20 56 20 20 20 5c 5f 5f 5f 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 | .V...\____/............|........ |
| af540 | 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...+---+........................ |
| af560 | 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 7c 20 | .+---+............|...........|. |
| af580 | 57 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 44 20 | W.|.........................|.D. |
| af5a0 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 5f 5f 5f 5f 20 20 20 2b 2b 2d 2b 2b 20 20 | |............|....____...++-++.. |
| af5c0 | 20 5f 5f 5f 5f 20 20 20 20 20 20 20 20 20 20 20 5f 5f 5f 5f 20 20 20 2b 2b 2d 2b 2b 20 20 20 5f | .____...........____...++-++..._ |
| af5e0 | 5f 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 2f 20 20 20 20 5c 20 20 20 7c 20 7c 20 | ___............|.../....\...|.|. |
| af600 | 20 20 2f 20 20 20 20 5c 20 20 20 20 20 20 20 20 20 2f 20 20 20 20 5c 20 20 20 7c 20 7c 20 20 20 | ../....\........./....\...|.|... |
| af620 | 2f 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 24 31 37 20 20 7c 3c 2d 27 | /....\............|..|.$17..|<-' |
| af640 | 20 60 2d 3e 7c 20 24 39 30 20 20 7c 2d 2d 2e 20 2e 2d 2d 7c 20 20 24 30 20 20 7c 3c 2d 27 20 60 | .`->|.$90..|--...--|..$0..|<-'.` |
| af660 | 2d 3e 7c 20 24 33 30 35 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 5c 5f 5f 5f 5f 2f | ->|.$305.|............|...\____/ |
| af680 | 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 5f 2f 20 20 20 56 20 56 20 20 20 5c 5f 5f 5f 5f 2f 20 20 | .........\____/...V.V...\____/.. |
| af6a0 | 20 20 20 20 20 20 20 5c 5f 5f 5f 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | .......\____/............|...... |
| af6c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 | ....................+---+....... |
| af6e0 | 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....|.......................... |
| af700 | 7c 20 57 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 5f 5f 5f 5f 20 20 20 20 20 20 | |.W.|............|....____...... |
| af720 | 20 20 20 20 20 5f 5f 5f 5f 20 20 20 2b 2b 2d 2b 2b 20 20 20 5f 5f 5f 5f 20 20 20 20 20 20 20 20 | .....____...++-++...____........ |
| af740 | 20 20 20 5f 5f 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 2f 20 20 20 20 5c 20 20 20 | ...____............|.../....\... |
| af760 | 20 20 20 20 20 20 2f 20 20 20 20 5c 20 20 20 7c 20 7c 20 20 20 2f 20 20 20 20 5c 20 20 20 20 20 | ....../....\...|.|.../....\..... |
| af780 | 20 20 20 20 2f 20 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 24 31 37 20 20 | ..../....\............|..|.$17.. |
| af7a0 | 7c 20 20 20 20 20 20 20 7c 20 24 36 35 20 20 7c 3c 2d 27 20 60 2d 3e 7c 20 24 32 35 20 20 7c 20 | |.......|.$65..|<-'.`->|.$25..|. |
| af7c0 | 20 20 20 20 20 20 7c 20 24 33 30 35 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 5c 5f | ......|.$305.|............|...\_ |
| af7e0 | 5f 5f 5f 2f 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 5f 2f 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f | ___/.........\____/.........\___ |
| af800 | 5f 2f 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 | _/.........\____/............V.. |
| af820 | 20 20 20 20 20 20 20 20 20 74 69 6d 65 0a 0a 20 20 20 41 20 6c 65 73 73 20 73 74 72 69 6e 67 65 | .........time.....A.less.stringe |
| af840 | 6e 74 20 72 65 73 74 72 69 63 74 69 6f 6e 20 6f 6e 20 63 6f 6e 63 75 72 72 65 6e 63 79 20 77 6f | nt.restriction.on.concurrency.wo |
| af860 | 75 6c 64 20 65 6e 73 75 72 65 20 74 68 61 74 20 61 0a 63 6f 6e 63 75 72 72 65 6e 74 20 73 79 73 | uld.ensure.that.a.concurrent.sys |
| af880 | 74 65 6d 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 20 61 73 20 | tem.produces.the.same.result.as. |
| af8a0 | 69 66 20 74 68 65 20 70 72 6f 63 65 73 73 65 73 20 68 61 64 20 72 75 6e 0a 73 65 71 75 65 6e 74 | if.the.processes.had.run.sequent |
| af8c0 | 69 61 6c 6c 79 20 69 6e 20 73 6f 6d 65 20 6f 72 64 65 72 2e 20 20 54 68 65 72 65 20 61 72 65 20 | ially.in.some.order...There.are. |
| af8e0 | 74 77 6f 20 69 6d 70 6f 72 74 61 6e 74 20 61 73 70 65 63 74 73 20 74 6f 20 74 68 69 73 0a 72 65 | two.important.aspects.to.this.re |
| af900 | 71 75 69 72 65 6d 65 6e 74 2e 20 20 46 69 72 73 74 2c 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 72 | quirement...First,.it.does.not.r |
| af920 | 65 71 75 69 72 65 20 74 68 65 20 70 72 6f 63 65 73 73 65 73 20 74 6f 20 61 63 74 75 61 6c 6c 79 | equire.the.processes.to.actually |
| af940 | 20 72 75 6e 0a 73 65 71 75 65 6e 74 69 61 6c 6c 79 2c 20 62 75 74 20 6f 6e 6c 79 20 74 6f 20 70 | .run.sequentially,.but.only.to.p |
| af960 | 72 6f 64 75 63 65 20 72 65 73 75 6c 74 73 20 74 68 61 74 20 61 72 65 20 74 68 65 20 73 61 6d 65 | roduce.results.that.are.the.same |
| af980 | 20 5f 61 73 20 69 66 5f 0a 74 68 65 79 20 68 61 64 20 72 75 6e 20 73 65 71 75 65 6e 74 69 61 6c | ._as.if_.they.had.run.sequential |
| af9a0 | 6c 79 2e 20 20 46 6f 72 20 74 68 65 20 65 78 61 6d 70 6c 65 20 69 6e 20 2a 4e 6f 74 65 20 46 69 | ly...For.the.example.in.*Note.Fi |
| af9c0 | 67 75 72 65 20 33 2d 33 30 3a 3a 2c 20 74 68 65 0a 64 65 73 69 67 6e 65 72 20 6f 66 20 74 68 65 | gure.3-30::,.the.designer.of.the |
| af9e0 | 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 20 73 79 73 74 65 6d 20 63 61 6e 20 73 61 66 65 6c 79 20 | .bank.account.system.can.safely. |
| afa00 | 61 6c 6c 6f 77 20 50 61 75 6c 27 73 20 64 65 70 6f 73 69 74 20 61 6e 64 0a 50 65 74 65 72 27 73 | allow.Paul's.deposit.and.Peter's |
| afa20 | 20 77 69 74 68 64 72 61 77 61 6c 20 74 6f 20 68 61 70 70 65 6e 20 63 6f 6e 63 75 72 72 65 6e 74 | .withdrawal.to.happen.concurrent |
| afa40 | 6c 79 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 6e 65 74 20 72 65 73 75 6c 74 20 77 69 6c 6c 0a | ly,.because.the.net.result.will. |
| afa60 | 62 65 20 74 68 65 20 73 61 6d 65 20 61 73 20 69 66 20 74 68 65 20 74 77 6f 20 6f 70 65 72 61 74 | be.the.same.as.if.the.two.operat |
| afa80 | 69 6f 6e 73 20 68 61 64 20 68 61 70 70 65 6e 65 64 20 73 65 71 75 65 6e 74 69 61 6c 6c 79 2e 0a | ions.had.happened.sequentially.. |
| afaa0 | 53 65 63 6f 6e 64 2c 20 74 68 65 72 65 20 6d 61 79 20 62 65 20 6d 6f 72 65 20 74 68 61 6e 20 6f | Second,.there.may.be.more.than.o |
| afac0 | 6e 65 20 70 6f 73 73 69 62 6c 65 20 22 63 6f 72 72 65 63 74 22 20 72 65 73 75 6c 74 20 70 72 6f | ne.possible."correct".result.pro |
| afae0 | 64 75 63 65 64 0a 62 79 20 61 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 6f 67 72 61 6d 2c 20 62 | duced.by.a.concurrent.program,.b |
| afb00 | 65 63 61 75 73 65 20 77 65 20 72 65 71 75 69 72 65 20 6f 6e 6c 79 20 74 68 61 74 20 74 68 65 20 | ecause.we.require.only.that.the. |
| afb20 | 72 65 73 75 6c 74 20 62 65 20 74 68 65 0a 73 61 6d 65 20 61 73 20 66 6f 72 20 5f 73 6f 6d 65 5f | result.be.the.same.as.for._some_ |
| afb40 | 20 73 65 71 75 65 6e 74 69 61 6c 20 6f 72 64 65 72 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c | .sequential.order...For.example, |
| afb60 | 20 73 75 70 70 6f 73 65 20 74 68 61 74 20 50 65 74 65 72 0a 61 6e 64 20 50 61 75 6c 27 73 20 6a | .suppose.that.Peter.and.Paul's.j |
| afb80 | 6f 69 6e 74 20 61 63 63 6f 75 6e 74 20 73 74 61 72 74 73 20 6f 75 74 20 77 69 74 68 20 24 31 30 | oint.account.starts.out.with.$10 |
| afba0 | 30 2c 20 61 6e 64 20 50 65 74 65 72 20 64 65 70 6f 73 69 74 73 20 24 34 30 0a 77 68 69 6c 65 20 | 0,.and.Peter.deposits.$40.while. |
| afbc0 | 50 61 75 6c 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 20 77 69 74 68 64 72 61 77 73 20 68 61 6c 66 | Paul.concurrently.withdraws.half |
| afbe0 | 20 74 68 65 20 6d 6f 6e 65 79 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 2e 20 20 54 68 65 6e | .the.money.in.the.account...Then |
| afc00 | 0a 73 65 71 75 65 6e 74 69 61 6c 20 65 78 65 63 75 74 69 6f 6e 20 63 6f 75 6c 64 20 72 65 73 75 | .sequential.execution.could.resu |
| afc20 | 6c 74 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e 63 65 20 62 65 69 6e 67 20 | lt.in.the.account.balance.being. |
| afc40 | 65 69 74 68 65 72 0a 24 37 30 20 6f 72 20 24 39 30 20 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 | either.$70.or.$90.(see.*Note.Exe |
| afc60 | 72 63 69 73 65 20 33 2d 33 38 3a 3a 29 2e 28 35 29 0a 0a 20 20 20 54 68 65 72 65 20 61 72 65 20 | rcise.3-38::).(5).....There.are. |
| afc80 | 73 74 69 6c 6c 20 77 65 61 6b 65 72 20 72 65 71 75 69 72 65 6d 65 6e 74 73 20 66 6f 72 20 63 6f | still.weaker.requirements.for.co |
| afca0 | 72 72 65 63 74 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 0a 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 | rrect.execution.of.concurrent.pr |
| afcc0 | 6f 67 72 61 6d 73 2e 20 20 41 20 70 72 6f 67 72 61 6d 20 66 6f 72 20 73 69 6d 75 6c 61 74 69 6e | ograms...A.program.for.simulatin |
| afce0 | 67 20 64 69 66 66 75 73 69 6f 6e 20 28 73 61 79 2c 20 74 68 65 20 66 6c 6f 77 0a 6f 66 20 68 65 | g.diffusion.(say,.the.flow.of.he |
| afd00 | 61 74 20 69 6e 20 61 6e 20 6f 62 6a 65 63 74 29 20 6d 69 67 68 74 20 63 6f 6e 73 69 73 74 20 6f | at.in.an.object).might.consist.o |
| afd20 | 66 20 61 20 6c 61 72 67 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 72 6f 63 65 73 73 65 73 2c 0a 65 | f.a.large.number.of.processes,.e |
| afd40 | 61 63 68 20 6f 6e 65 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 20 73 6d 61 6c 6c 20 76 6f 6c | ach.one.representing.a.small.vol |
| afd60 | 75 6d 65 20 6f 66 20 73 70 61 63 65 2c 20 74 68 61 74 20 75 70 64 61 74 65 20 74 68 65 69 72 20 | ume.of.space,.that.update.their. |
| afd80 | 76 61 6c 75 65 73 0a 63 6f 6e 63 75 72 72 65 6e 74 6c 79 2e 20 20 45 61 63 68 20 70 72 6f 63 65 | values.concurrently...Each.proce |
| afda0 | 73 73 20 72 65 70 65 61 74 65 64 6c 79 20 63 68 61 6e 67 65 73 20 69 74 73 20 76 61 6c 75 65 20 | ss.repeatedly.changes.its.value. |
| afdc0 | 74 6f 20 74 68 65 20 61 76 65 72 61 67 65 0a 6f 66 20 69 74 73 20 6f 77 6e 20 76 61 6c 75 65 20 | to.the.average.of.its.own.value. |
| afde0 | 61 6e 64 20 69 74 73 20 6e 65 69 67 68 62 6f 72 73 27 20 76 61 6c 75 65 73 2e 20 20 54 68 69 73 | and.its.neighbors'.values...This |
| afe00 | 20 61 6c 67 6f 72 69 74 68 6d 20 63 6f 6e 76 65 72 67 65 73 0a 74 6f 20 74 68 65 20 72 69 67 68 | .algorithm.converges.to.the.righ |
| afe20 | 74 20 61 6e 73 77 65 72 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 6f 72 64 65 | t.answer.independent.of.the.orde |
| afe40 | 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 0a 61 72 65 20 64 6f | r.in.which.the.operations.are.do |
| afe60 | 6e 65 3b 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6e 65 65 64 20 66 6f 72 20 61 6e 79 20 72 65 73 | ne;.there.is.no.need.for.any.res |
| afe80 | 74 72 69 63 74 69 6f 6e 73 20 6f 6e 20 63 6f 6e 63 75 72 72 65 6e 74 20 75 73 65 20 6f 66 0a 74 | trictions.on.concurrent.use.of.t |
| afea0 | 68 65 20 73 68 61 72 65 64 20 76 61 6c 75 65 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | he.shared.values........*Exercis |
| afec0 | 65 20 33 2e 33 38 3a 2a 20 53 75 70 70 6f 73 65 20 74 68 61 74 20 50 65 74 65 72 2c 20 50 61 75 | e.3.38:*.Suppose.that.Peter,.Pau |
| afee0 | 6c 2c 20 61 6e 64 20 4d 61 72 79 20 73 68 61 72 65 20 61 20 6a 6f 69 6e 74 0a 20 20 20 20 20 62 | l,.and.Mary.share.a.joint......b |
| aff00 | 61 6e 6b 20 61 63 63 6f 75 6e 74 20 74 68 61 74 20 69 6e 69 74 69 61 6c 6c 79 20 63 6f 6e 74 61 | ank.account.that.initially.conta |
| aff20 | 69 6e 73 20 24 31 30 30 2e 20 20 43 6f 6e 63 75 72 72 65 6e 74 6c 79 2c 20 50 65 74 65 72 0a 20 | ins.$100...Concurrently,.Peter.. |
| aff40 | 20 20 20 20 64 65 70 6f 73 69 74 73 20 24 31 30 2c 20 50 61 75 6c 20 77 69 74 68 64 72 61 77 73 | ....deposits.$10,.Paul.withdraws |
| aff60 | 20 24 32 30 2c 20 61 6e 64 20 4d 61 72 79 20 77 69 74 68 64 72 61 77 73 20 68 61 6c 66 20 74 68 | .$20,.and.Mary.withdraws.half.th |
| aff80 | 65 0a 20 20 20 20 20 6d 6f 6e 65 79 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 2c 20 62 79 20 | e......money.in.the.account,.by. |
| affa0 | 65 78 65 63 75 74 69 6e 67 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6d 6d 61 6e 64 73 | executing.the.following.commands |
| affc0 | 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 50 65 74 65 72 3a 20 28 73 65 74 21 20 62 61 6c 61 6e 63 | :............Peter:.(set!.balanc |
| affe0 | 65 20 28 2b 20 62 61 6c 61 6e 63 65 20 31 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 50 61 75 6c | e.(+.balance.10))...........Paul |
| b0000 | 3a 20 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 32 30 29 29 | :..(set!.balance.(-.balance.20)) |
| b0020 | 0a 20 20 20 20 20 20 20 20 20 20 4d 61 72 79 3a 20 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 | ...........Mary:..(set!.balance. |
| b0040 | 28 2d 20 62 61 6c 61 6e 63 65 20 28 2f 20 62 61 6c 61 6e 63 65 20 32 29 29 29 0a 0a 20 20 20 20 | (-.balance.(/.balance.2)))...... |
| b0060 | 20 20 20 61 2e 20 4c 69 73 74 20 61 6c 6c 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 20 70 6f 73 | ...a..List.all.the.different.pos |
| b0080 | 73 69 62 6c 65 20 76 61 6c 75 65 73 20 66 6f 72 20 60 62 61 6c 61 6e 63 65 27 20 61 66 74 65 72 | sible.values.for.`balance'.after |
| b00a0 | 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 73 65 20 74 68 72 65 65 20 74 72 61 6e 73 61 63 74 69 | ...........these.three.transacti |
| b00c0 | 6f 6e 73 20 68 61 76 65 20 62 65 65 6e 20 63 6f 6d 70 6c 65 74 65 64 2c 20 61 73 73 75 6d 69 6e | ons.have.been.completed,.assumin |
| b00e0 | 67 20 74 68 61 74 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 20 62 61 6e 6b 69 6e 67 20 73 79 73 | g.that...........the.banking.sys |
| b0100 | 74 65 6d 20 66 6f 72 63 65 73 20 74 68 65 20 74 68 72 65 65 20 70 72 6f 63 65 73 73 65 73 20 74 | tem.forces.the.three.processes.t |
| b0120 | 6f 20 72 75 6e 0a 20 20 20 20 20 20 20 20 20 20 73 65 71 75 65 6e 74 69 61 6c 6c 79 20 69 6e 20 | o.run...........sequentially.in. |
| b0140 | 73 6f 6d 65 20 6f 72 64 65 72 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 57 68 61 74 20 61 72 65 20 | some.order..........b..What.are. |
| b0160 | 73 6f 6d 65 20 6f 74 68 65 72 20 76 61 6c 75 65 73 20 74 68 61 74 20 63 6f 75 6c 64 20 62 65 20 | some.other.values.that.could.be. |
| b0180 | 70 72 6f 64 75 63 65 64 20 69 66 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 73 79 73 74 65 6d | produced.if.the...........system |
| b01a0 | 20 61 6c 6c 6f 77 73 20 74 68 65 20 70 72 6f 63 65 73 73 65 73 20 74 6f 20 62 65 20 69 6e 74 65 | .allows.the.processes.to.be.inte |
| b01c0 | 72 6c 65 61 76 65 64 3f 20 20 44 72 61 77 20 74 69 6d 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 | rleaved?..Draw.timing........... |
| b01e0 | 64 69 61 67 72 61 6d 73 20 6c 69 6b 65 20 74 68 65 20 6f 6e 65 20 69 6e 20 2a 4e 6f 74 65 20 46 | diagrams.like.the.one.in.*Note.F |
| b0200 | 69 67 75 72 65 20 33 2d 32 39 3a 3a 20 74 6f 20 65 78 70 6c 61 69 6e 20 68 6f 77 0a 20 20 20 20 | igure.3-29::.to.explain.how..... |
| b0220 | 20 20 20 20 20 20 74 68 65 73 65 20 76 61 6c 75 65 73 20 63 61 6e 20 6f 63 63 75 72 2e 0a 0a 0a | ......these.values.can.occur.... |
| b0240 | 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d | ...----------.Footnotes.-------- |
| b0260 | 2d 2d 0a 0a 20 20 20 28 31 29 20 54 6f 20 71 75 6f 74 65 20 73 6f 6d 65 20 67 72 61 66 66 69 74 | --.....(1).To.quote.some.graffit |
| b0280 | 69 20 73 65 65 6e 20 6f 6e 20 61 20 43 61 6d 62 72 69 64 67 65 20 62 75 69 6c 64 69 6e 67 20 77 | i.seen.on.a.Cambridge.building.w |
| b02a0 | 61 6c 6c 3a 20 22 54 69 6d 65 0a 69 73 20 61 20 64 65 76 69 63 65 20 74 68 61 74 20 77 61 73 20 | all:."Time.is.a.device.that.was. |
| b02c0 | 69 6e 76 65 6e 74 65 64 20 74 6f 20 6b 65 65 70 20 65 76 65 72 79 74 68 69 6e 67 20 66 72 6f 6d | invented.to.keep.everything.from |
| b02e0 | 20 68 61 70 70 65 6e 69 6e 67 20 61 74 0a 6f 6e 63 65 2e 22 0a 0a 20 20 20 28 32 29 20 41 6e 20 | .happening.at.once.".....(2).An. |
| b0300 | 65 76 65 6e 20 77 6f 72 73 65 20 66 61 69 6c 75 72 65 20 66 6f 72 20 74 68 69 73 20 73 79 73 74 | even.worse.failure.for.this.syst |
| b0320 | 65 6d 20 63 6f 75 6c 64 20 6f 63 63 75 72 20 69 66 20 74 68 65 20 74 77 6f 0a 60 73 65 74 21 27 | em.could.occur.if.the.two.`set!' |
| b0340 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 74 74 65 6d 70 74 20 74 6f 20 63 68 61 6e 67 65 20 74 68 | .operations.attempt.to.change.th |
| b0360 | 65 20 62 61 6c 61 6e 63 65 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 6c 79 2c 20 69 6e 0a 77 68 69 | e.balance.simultaneously,.in.whi |
| b0380 | 63 68 20 63 61 73 65 20 74 68 65 20 61 63 74 75 61 6c 20 64 61 74 61 20 61 70 70 65 61 72 69 6e | ch.case.the.actual.data.appearin |
| b03a0 | 67 20 69 6e 20 6d 65 6d 6f 72 79 20 6d 69 67 68 74 20 65 6e 64 20 75 70 20 62 65 69 6e 67 20 61 | g.in.memory.might.end.up.being.a |
| b03c0 | 0a 72 61 6e 64 6f 6d 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 69 6e 66 6f 72 | .random.combination.of.the.infor |
| b03e0 | 6d 61 74 69 6f 6e 20 62 65 69 6e 67 20 77 72 69 74 74 65 6e 20 62 79 20 74 68 65 20 74 77 6f 0a | mation.being.written.by.the.two. |
| b0400 | 70 72 6f 63 65 73 73 65 73 2e 20 20 4d 6f 73 74 20 63 6f 6d 70 75 74 65 72 73 20 68 61 76 65 20 | processes...Most.computers.have. |
| b0420 | 69 6e 74 65 72 6c 6f 63 6b 73 20 6f 6e 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 0a 6d 65 6d 6f | interlocks.on.the.primitive.memo |
| b0440 | 72 79 2d 77 72 69 74 65 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 77 68 69 63 68 20 70 72 6f 74 65 | ry-write.operations,.which.prote |
| b0460 | 63 74 20 61 67 61 69 6e 73 74 20 73 75 63 68 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 0a 61 63 63 | ct.against.such.simultaneous.acc |
| b0480 | 65 73 73 2e 20 20 45 76 65 6e 20 74 68 69 73 20 73 65 65 6d 69 6e 67 6c 79 20 73 69 6d 70 6c 65 | ess...Even.this.seemingly.simple |
| b04a0 | 20 6b 69 6e 64 20 6f 66 20 70 72 6f 74 65 63 74 69 6f 6e 2c 20 68 6f 77 65 76 65 72 2c 20 72 61 | .kind.of.protection,.however,.ra |
| b04c0 | 69 73 65 73 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 63 68 61 6c 6c 65 6e 67 65 73 20 69 | ises.implementation.challenges.i |
| b04e0 | 6e 20 74 68 65 20 64 65 73 69 67 6e 20 6f 66 20 6d 75 6c 74 69 70 72 6f 63 65 73 73 69 6e 67 20 | n.the.design.of.multiprocessing. |
| b0500 | 63 6f 6d 70 75 74 65 72 73 2c 0a 77 68 65 72 65 20 65 6c 61 62 6f 72 61 74 65 20 22 63 61 63 68 | computers,.where.elaborate."cach |
| b0520 | 65 2d 63 6f 68 65 72 65 6e 63 65 22 20 70 72 6f 74 6f 63 6f 6c 73 20 61 72 65 20 72 65 71 75 69 | e-coherence".protocols.are.requi |
| b0540 | 72 65 64 20 74 6f 20 65 6e 73 75 72 65 20 74 68 61 74 0a 74 68 65 20 76 61 72 69 6f 75 73 20 70 | red.to.ensure.that.the.various.p |
| b0560 | 72 6f 63 65 73 73 6f 72 73 20 77 69 6c 6c 20 6d 61 69 6e 74 61 69 6e 20 61 20 63 6f 6e 73 69 73 | rocessors.will.maintain.a.consis |
| b0580 | 74 65 6e 74 20 76 69 65 77 20 6f 66 20 6d 65 6d 6f 72 79 0a 63 6f 6e 74 65 6e 74 73 2c 20 64 65 | tent.view.of.memory.contents,.de |
| b05a0 | 73 70 69 74 65 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 64 61 74 61 20 6d 61 79 20 62 65 20 | spite.the.fact.that.data.may.be. |
| b05c0 | 72 65 70 6c 69 63 61 74 65 64 20 28 22 63 61 63 68 65 64 22 29 20 61 6d 6f 6e 67 0a 74 68 65 20 | replicated.("cached").among.the. |
| b05e0 | 64 69 66 66 65 72 65 6e 74 20 70 72 6f 63 65 73 73 6f 72 73 20 74 6f 20 69 6e 63 72 65 61 73 65 | different.processors.to.increase |
| b0600 | 20 74 68 65 20 73 70 65 65 64 20 6f 66 20 6d 65 6d 6f 72 79 20 61 63 63 65 73 73 2e 0a 0a 20 20 | .the.speed.of.memory.access..... |
| b0620 | 20 28 33 29 20 54 68 65 20 66 61 63 74 6f 72 69 61 6c 20 70 72 6f 67 72 61 6d 20 69 6e 20 73 65 | .(3).The.factorial.program.in.se |
| b0640 | 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 33 3a 3a 20 69 6c 6c 75 73 74 72 61 74 65 73 20 | ction.*Note.3-1-3::.illustrates. |
| b0660 | 74 68 69 73 0a 66 6f 72 20 61 20 73 69 6e 67 6c 65 20 73 65 71 75 65 6e 74 69 61 6c 20 70 72 6f | this.for.a.single.sequential.pro |
| b0680 | 63 65 73 73 2e 0a 0a 20 20 20 28 34 29 20 54 68 65 20 63 6f 6c 75 6d 6e 73 20 73 68 6f 77 20 74 | cess......(4).The.columns.show.t |
| b06a0 | 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 50 65 74 65 72 27 73 20 77 61 6c 6c 65 74 2c 20 74 | he.contents.of.Peter's.wallet,.t |
| b06c0 | 68 65 20 6a 6f 69 6e 74 0a 61 63 63 6f 75 6e 74 20 28 69 6e 20 42 61 6e 6b 31 29 2c 20 50 61 75 | he.joint.account.(in.Bank1),.Pau |
| b06e0 | 6c 27 73 20 77 61 6c 6c 65 74 2c 20 61 6e 64 20 50 61 75 6c 27 73 20 70 72 69 76 61 74 65 20 61 | l's.wallet,.and.Paul's.private.a |
| b0700 | 63 63 6f 75 6e 74 20 28 69 6e 0a 42 61 6e 6b 32 29 2c 20 62 65 66 6f 72 65 20 61 6e 64 20 61 66 | ccount.(in.Bank2),.before.and.af |
| b0720 | 74 65 72 20 65 61 63 68 20 77 69 74 68 64 72 61 77 61 6c 20 28 57 29 20 61 6e 64 20 64 65 70 6f | ter.each.withdrawal.(W).and.depo |
| b0740 | 73 69 74 20 28 44 29 2e 20 20 50 65 74 65 72 0a 77 69 74 68 64 72 61 77 73 20 24 31 30 20 66 72 | sit.(D)...Peter.withdraws.$10.fr |
| b0760 | 6f 6d 20 42 61 6e 6b 31 3b 20 50 61 75 6c 20 64 65 70 6f 73 69 74 73 20 24 35 20 69 6e 20 42 61 | om.Bank1;.Paul.deposits.$5.in.Ba |
| b0780 | 6e 6b 32 2c 20 74 68 65 6e 20 77 69 74 68 64 72 61 77 73 20 24 32 35 0a 66 72 6f 6d 20 42 61 6e | nk2,.then.withdraws.$25.from.Ban |
| b07a0 | 6b 31 2e 0a 0a 20 20 20 28 35 29 20 5b 46 6f 6f 74 6e 6f 74 65 20 33 39 5d 20 41 20 6d 6f 72 65 | k1......(5).[Footnote.39].A.more |
| b07c0 | 20 66 6f 72 6d 61 6c 20 77 61 79 20 74 6f 20 65 78 70 72 65 73 73 20 74 68 69 73 20 69 64 65 61 | .formal.way.to.express.this.idea |
| b07e0 | 20 69 73 20 74 6f 20 73 61 79 0a 74 68 61 74 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 6f 67 72 | .is.to.say.that.concurrent.progr |
| b0800 | 61 6d 73 20 61 72 65 20 69 6e 68 65 72 65 6e 74 6c 79 20 22 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 | ams.are.inherently."nondetermini |
| b0820 | 73 74 69 63 22 2e 20 54 68 61 74 20 69 73 2c 0a 74 68 65 79 20 61 72 65 20 64 65 73 63 72 69 62 | stic"..That.is,.they.are.describ |
| b0840 | 65 64 20 6e 6f 74 20 62 79 20 73 69 6e 67 6c 65 2d 76 61 6c 75 65 64 20 66 75 6e 63 74 69 6f 6e | ed.not.by.single-valued.function |
| b0860 | 73 2c 20 62 75 74 20 62 79 20 66 75 6e 63 74 69 6f 6e 73 0a 77 68 6f 73 65 20 72 65 73 75 6c 74 | s,.but.by.functions.whose.result |
| b0880 | 73 20 61 72 65 20 73 65 74 73 20 6f 66 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 2e 20 20 | s.are.sets.of.possible.values... |
| b08a0 | 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 33 3a 3a 20 77 65 0a 77 69 6c 6c 20 73 | In.section.*Note.4-3::.we.will.s |
| b08c0 | 74 75 64 79 20 61 20 6c 61 6e 67 75 61 67 65 20 66 6f 72 20 65 78 70 72 65 73 73 69 6e 67 20 6e | tudy.a.language.for.expressing.n |
| b08e0 | 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 2e 0a 0a 1f | ondeterministic.computations.... |
| b0900 | 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 34 2d 32 2c 20 | .File:.sicp.info,..Node:.3-4-2,. |
| b0920 | 20 50 72 65 76 3a 20 33 2d 34 2d 31 2c 20 20 55 70 3a 20 33 2d 34 0a 0a 33 2e 34 2e 32 20 4d 65 | .Prev:.3-4-1,..Up:.3-4..3.4.2.Me |
| b0940 | 63 68 61 6e 69 73 6d 73 20 66 6f 72 20 43 6f 6e 74 72 6f 6c 6c 69 6e 67 20 43 6f 6e 63 75 72 72 | chanisms.for.Controlling.Concurr |
| b0960 | 65 6e 63 79 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ency.--------------------------- |
| b0980 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 65 27 76 65 20 73 65 65 6e 20 74 68 | -----------------..We've.seen.th |
| b09a0 | 61 74 20 74 68 65 20 64 69 66 66 69 63 75 6c 74 79 20 69 6e 20 64 65 61 6c 69 6e 67 20 77 69 74 | at.the.difficulty.in.dealing.wit |
| b09c0 | 68 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 65 73 20 69 73 0a 72 6f 6f 74 65 64 | h.concurrent.processes.is.rooted |
| b09e0 | 20 69 6e 20 74 68 65 20 6e 65 65 64 20 74 6f 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 69 6e 74 | .in.the.need.to.consider.the.int |
| b0a00 | 65 72 6c 65 61 76 69 6e 67 20 6f 66 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 65 76 65 6e 74 73 | erleaving.of.the.order.of.events |
| b0a20 | 0a 69 6e 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 63 65 73 73 65 73 2e 20 20 46 6f | .in.the.different.processes...Fo |
| b0a40 | 72 20 65 78 61 6d 70 6c 65 2c 20 73 75 70 70 6f 73 65 20 77 65 20 68 61 76 65 20 74 77 6f 0a 70 | r.example,.suppose.we.have.two.p |
| b0a60 | 72 6f 63 65 73 73 65 73 2c 20 6f 6e 65 20 77 69 74 68 20 74 68 72 65 65 20 6f 72 64 65 72 65 64 | rocesses,.one.with.three.ordered |
| b0a80 | 20 65 76 65 6e 74 73 20 28 61 2c 62 2c 63 29 20 61 6e 64 20 6f 6e 65 20 77 69 74 68 20 74 68 72 | .events.(a,b,c).and.one.with.thr |
| b0aa0 | 65 65 0a 6f 72 64 65 72 65 64 20 65 76 65 6e 74 73 20 28 78 2c 79 2c 7a 29 2e 20 20 49 66 20 74 | ee.ordered.events.(x,y,z)...If.t |
| b0ac0 | 68 65 20 74 77 6f 20 70 72 6f 63 65 73 73 65 73 20 72 75 6e 20 63 6f 6e 63 75 72 72 65 6e 74 6c | he.two.processes.run.concurrentl |
| b0ae0 | 79 2c 20 77 69 74 68 20 6e 6f 0a 63 6f 6e 73 74 72 61 69 6e 74 73 20 6f 6e 20 68 6f 77 20 74 68 | y,.with.no.constraints.on.how.th |
| b0b00 | 65 69 72 20 65 78 65 63 75 74 69 6f 6e 20 69 73 20 69 6e 74 65 72 6c 65 61 76 65 64 2c 20 74 68 | eir.execution.is.interleaved,.th |
| b0b20 | 65 6e 20 74 68 65 72 65 20 61 72 65 20 32 30 0a 64 69 66 66 65 72 65 6e 74 20 70 6f 73 73 69 62 | en.there.are.20.different.possib |
| b0b40 | 6c 65 20 6f 72 64 65 72 69 6e 67 73 20 66 6f 72 20 74 68 65 20 65 76 65 6e 74 73 20 74 68 61 74 | le.orderings.for.the.events.that |
| b0b60 | 20 61 72 65 20 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 0a 74 68 65 20 69 6e 64 69 76 69 64 | .are.consistent.with.the.individ |
| b0b80 | 75 61 6c 20 6f 72 64 65 72 69 6e 67 73 20 66 6f 72 20 74 68 65 20 74 77 6f 20 70 72 6f 63 65 73 | ual.orderings.for.the.two.proces |
| b0ba0 | 73 65 73 3a 0a 0a 20 20 20 20 20 28 61 2c 62 2c 63 2c 78 2c 79 2c 7a 29 20 20 28 61 2c 78 2c 62 | ses:.......(a,b,c,x,y,z)..(a,x,b |
| b0bc0 | 2c 79 2c 63 2c 7a 29 20 20 28 78 2c 61 2c 62 2c 63 2c 79 2c 7a 29 20 20 28 78 2c 61 2c 79 2c 7a | ,y,c,z)..(x,a,b,c,y,z)..(x,a,y,z |
| b0be0 | 2c 62 2c 63 29 0a 20 20 20 20 20 28 61 2c 62 2c 78 2c 63 2c 79 2c 7a 29 20 20 28 61 2c 78 2c 62 | ,b,c)......(a,b,x,c,y,z)..(a,x,b |
| b0c00 | 2c 79 2c 7a 2c 63 29 20 20 28 78 2c 61 2c 62 2c 79 2c 63 2c 7a 29 20 20 28 78 2c 79 2c 61 2c 62 | ,y,z,c)..(x,a,b,y,c,z)..(x,y,a,b |
| b0c20 | 2c 63 2c 7a 29 0a 20 20 20 20 20 28 61 2c 62 2c 78 2c 79 2c 63 2c 7a 29 20 20 28 61 2c 78 2c 79 | ,c,z)......(a,b,x,y,c,z)..(a,x,y |
| b0c40 | 2c 62 2c 63 2c 7a 29 20 20 28 78 2c 61 2c 62 2c 79 2c 7a 2c 63 29 20 20 28 78 2c 79 2c 61 2c 62 | ,b,c,z)..(x,a,b,y,z,c)..(x,y,a,b |
| b0c60 | 2c 7a 2c 63 29 0a 20 20 20 20 20 28 61 2c 62 2c 78 2c 79 2c 7a 2c 63 29 20 20 28 61 2c 78 2c 79 | ,z,c)......(a,b,x,y,z,c)..(a,x,y |
| b0c80 | 2c 62 2c 7a 2c 63 29 20 20 28 78 2c 61 2c 79 2c 62 2c 63 2c 7a 29 20 20 28 78 2c 79 2c 61 2c 7a | ,b,z,c)..(x,a,y,b,c,z)..(x,y,a,z |
| b0ca0 | 2c 62 2c 63 29 0a 20 20 20 20 20 28 61 2c 78 2c 62 2c 63 2c 79 2c 7a 29 20 20 28 61 2c 78 2c 79 | ,b,c)......(a,x,b,c,y,z)..(a,x,y |
| b0cc0 | 2c 7a 2c 62 2c 63 29 20 20 28 78 2c 61 2c 79 2c 62 2c 7a 2c 63 29 20 20 28 78 2c 79 2c 7a 2c 61 | ,z,b,c)..(x,a,y,b,z,c)..(x,y,z,a |
| b0ce0 | 2c 62 2c 63 29 0a 0a 20 20 20 41 73 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 64 65 73 69 67 6e 69 | ,b,c).....As.programmers.designi |
| b0d00 | 6e 67 20 74 68 69 73 20 73 79 73 74 65 6d 2c 20 77 65 20 77 6f 75 6c 64 20 68 61 76 65 20 74 6f | ng.this.system,.we.would.have.to |
| b0d20 | 20 63 6f 6e 73 69 64 65 72 20 74 68 65 0a 65 66 66 65 63 74 73 20 6f 66 20 65 61 63 68 20 6f 66 | .consider.the.effects.of.each.of |
| b0d40 | 20 74 68 65 73 65 20 32 30 20 6f 72 64 65 72 69 6e 67 73 20 61 6e 64 20 63 68 65 63 6b 20 74 68 | .these.20.orderings.and.check.th |
| b0d60 | 61 74 20 65 61 63 68 20 62 65 68 61 76 69 6f 72 20 69 73 0a 61 63 63 65 70 74 61 62 6c 65 2e 20 | at.each.behavior.is.acceptable.. |
| b0d80 | 20 53 75 63 68 20 61 6e 20 61 70 70 72 6f 61 63 68 20 72 61 70 69 64 6c 79 20 62 65 63 6f 6d 65 | .Such.an.approach.rapidly.become |
| b0da0 | 73 20 75 6e 77 69 65 6c 64 79 20 61 73 20 74 68 65 20 6e 75 6d 62 65 72 73 0a 6f 66 20 70 72 6f | s.unwieldy.as.the.numbers.of.pro |
| b0dc0 | 63 65 73 73 65 73 20 61 6e 64 20 65 76 65 6e 74 73 20 69 6e 63 72 65 61 73 65 2e 0a 0a 20 20 20 | cesses.and.events.increase...... |
| b0de0 | 41 20 6d 6f 72 65 20 70 72 61 63 74 69 63 61 6c 20 61 70 70 72 6f 61 63 68 20 74 6f 20 74 68 65 | A.more.practical.approach.to.the |
| b0e00 | 20 64 65 73 69 67 6e 20 6f 66 20 63 6f 6e 63 75 72 72 65 6e 74 20 73 79 73 74 65 6d 73 20 69 73 | .design.of.concurrent.systems.is |
| b0e20 | 20 74 6f 0a 64 65 76 69 73 65 20 67 65 6e 65 72 61 6c 20 6d 65 63 68 61 6e 69 73 6d 73 20 74 68 | .to.devise.general.mechanisms.th |
| b0e40 | 61 74 20 61 6c 6c 6f 77 20 75 73 20 74 6f 20 63 6f 6e 73 74 72 61 69 6e 20 74 68 65 20 69 6e 74 | at.allow.us.to.constrain.the.int |
| b0e60 | 65 72 6c 65 61 76 69 6e 67 0a 6f 66 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 65 | erleaving.of.concurrent.processe |
| b0e80 | 73 20 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e 20 62 65 20 73 75 72 65 20 74 68 61 74 20 74 68 | s.so.that.we.can.be.sure.that.th |
| b0ea0 | 65 20 70 72 6f 67 72 61 6d 0a 62 65 68 61 76 69 6f 72 20 69 73 20 63 6f 72 72 65 63 74 2e 20 20 | e.program.behavior.is.correct... |
| b0ec0 | 4d 61 6e 79 20 6d 65 63 68 61 6e 69 73 6d 73 20 68 61 76 65 20 62 65 65 6e 20 64 65 76 65 6c 6f | Many.mechanisms.have.been.develo |
| b0ee0 | 70 65 64 20 66 6f 72 20 74 68 69 73 0a 70 75 72 70 6f 73 65 2e 20 20 49 6e 20 74 68 69 73 20 73 | ped.for.this.purpose...In.this.s |
| b0f00 | 65 63 74 69 6f 6e 2c 20 77 65 20 64 65 73 63 72 69 62 65 20 6f 6e 65 20 6f 66 20 74 68 65 6d 2c | ection,.we.describe.one.of.them, |
| b0f20 | 20 74 68 65 20 22 73 65 72 69 61 6c 69 7a 65 72 22 2e 0a 0a 53 65 72 69 61 6c 69 7a 69 6e 67 20 | .the."serializer"...Serializing. |
| b0f40 | 61 63 63 65 73 73 20 74 6f 20 73 68 61 72 65 64 20 73 74 61 74 65 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e | access.to.shared.state.......... |
| b0f60 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 53 65 72 69 61 | ...........................Seria |
| b0f80 | 6c 69 7a 61 74 69 6f 6e 20 69 6d 70 6c 65 6d 65 6e 74 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e | lization.implements.the.followin |
| b0fa0 | 67 20 69 64 65 61 3a 20 50 72 6f 63 65 73 73 65 73 20 77 69 6c 6c 20 65 78 65 63 75 74 65 0a 63 | g.idea:.Processes.will.execute.c |
| b0fc0 | 6f 6e 63 75 72 72 65 6e 74 6c 79 2c 20 62 75 74 20 74 68 65 72 65 20 77 69 6c 6c 20 62 65 20 63 | oncurrently,.but.there.will.be.c |
| b0fe0 | 65 72 74 61 69 6e 20 63 6f 6c 6c 65 63 74 69 6f 6e 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 | ertain.collections.of.procedures |
| b1000 | 20 74 68 61 74 0a 63 61 6e 6e 6f 74 20 62 65 20 65 78 65 63 75 74 65 64 20 63 6f 6e 63 75 72 72 | .that.cannot.be.executed.concurr |
| b1020 | 65 6e 74 6c 79 2e 20 20 4d 6f 72 65 20 70 72 65 63 69 73 65 6c 79 2c 20 73 65 72 69 61 6c 69 7a | ently...More.precisely,.serializ |
| b1040 | 61 74 69 6f 6e 20 63 72 65 61 74 65 73 0a 64 69 73 74 69 6e 67 75 69 73 68 65 64 20 73 65 74 73 | ation.creates.distinguished.sets |
| b1060 | 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 73 75 63 68 20 74 68 61 74 20 6f 6e 6c 79 20 6f 6e | .of.procedures.such.that.only.on |
| b1080 | 65 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 61 0a 70 72 6f 63 65 64 75 72 65 20 69 6e 20 65 61 | e.execution.of.a.procedure.in.ea |
| b10a0 | 63 68 20 73 65 72 69 61 6c 69 7a 65 64 20 73 65 74 20 69 73 20 70 65 72 6d 69 74 74 65 64 20 74 | ch.serialized.set.is.permitted.t |
| b10c0 | 6f 20 68 61 70 70 65 6e 20 61 74 20 61 20 74 69 6d 65 2e 20 20 49 66 0a 73 6f 6d 65 20 70 72 6f | o.happen.at.a.time...If.some.pro |
| b10e0 | 63 65 64 75 72 65 20 69 6e 20 74 68 65 20 73 65 74 20 69 73 20 62 65 69 6e 67 20 65 78 65 63 75 | cedure.in.the.set.is.being.execu |
| b1100 | 74 65 64 2c 20 74 68 65 6e 20 61 20 70 72 6f 63 65 73 73 20 74 68 61 74 0a 61 74 74 65 6d 70 74 | ted,.then.a.process.that.attempt |
| b1120 | 73 20 74 6f 20 65 78 65 63 75 74 65 20 61 6e 79 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 74 68 | s.to.execute.any.procedure.in.th |
| b1140 | 65 20 73 65 74 20 77 69 6c 6c 20 62 65 20 66 6f 72 63 65 64 20 74 6f 20 77 61 69 74 0a 75 6e 74 | e.set.will.be.forced.to.wait.unt |
| b1160 | 69 6c 20 74 68 65 20 66 69 72 73 74 20 65 78 65 63 75 74 69 6f 6e 20 68 61 73 20 66 69 6e 69 73 | il.the.first.execution.has.finis |
| b1180 | 68 65 64 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 75 73 65 20 73 65 72 69 61 6c 69 7a 61 74 69 6f | hed......We.can.use.serializatio |
| b11a0 | 6e 20 74 6f 20 63 6f 6e 74 72 6f 6c 20 61 63 63 65 73 73 20 74 6f 20 73 68 61 72 65 64 20 76 61 | n.to.control.access.to.shared.va |
| b11c0 | 72 69 61 62 6c 65 73 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 69 66 20 77 65 20 77 61 6e | riables...For.example,.if.we.wan |
| b11e0 | 74 20 74 6f 20 75 70 64 61 74 65 20 61 20 73 68 61 72 65 64 20 76 61 72 69 61 62 6c 65 20 62 61 | t.to.update.a.shared.variable.ba |
| b1200 | 73 65 64 20 6f 6e 20 74 68 65 20 70 72 65 76 69 6f 75 73 0a 76 61 6c 75 65 20 6f 66 20 74 68 61 | sed.on.the.previous.value.of.tha |
| b1220 | 74 20 76 61 72 69 61 62 6c 65 2c 20 77 65 20 70 75 74 20 74 68 65 20 61 63 63 65 73 73 20 74 6f | t.variable,.we.put.the.access.to |
| b1240 | 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 76 61 72 69 61 | .the.previous.value.of.the.varia |
| b1260 | 62 6c 65 20 61 6e 64 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 20 6f 66 20 74 68 65 20 6e 65 | ble.and.the.assignment.of.the.ne |
| b1280 | 77 20 76 61 6c 75 65 20 74 6f 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 6e 20 74 68 65 0a 73 | w.value.to.the.variable.in.the.s |
| b12a0 | 61 6d 65 20 70 72 6f 63 65 64 75 72 65 2e 20 20 57 65 20 74 68 65 6e 20 65 6e 73 75 72 65 20 74 | ame.procedure...We.then.ensure.t |
| b12c0 | 68 61 74 20 6e 6f 20 6f 74 68 65 72 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 61 73 73 69 | hat.no.other.procedure.that.assi |
| b12e0 | 67 6e 73 20 74 6f 0a 74 68 65 20 76 61 72 69 61 62 6c 65 20 63 61 6e 20 72 75 6e 20 63 6f 6e 63 | gns.to.the.variable.can.run.conc |
| b1300 | 75 72 72 65 6e 74 6c 79 20 77 69 74 68 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 62 79 20 | urrently.with.this.procedure.by. |
| b1320 | 73 65 72 69 61 6c 69 7a 69 6e 67 0a 61 6c 6c 20 6f 66 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 | serializing.all.of.these.procedu |
| b1340 | 72 65 73 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 73 65 72 69 61 6c 69 7a 65 72 2e 20 20 54 | res.with.the.same.serializer...T |
| b1360 | 68 69 73 20 67 75 61 72 61 6e 74 65 65 73 20 74 68 61 74 0a 74 68 65 20 76 61 6c 75 65 20 6f 66 | his.guarantees.that.the.value.of |
| b1380 | 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 63 61 6e 6e 6f 74 20 62 65 20 63 68 61 6e 67 65 64 20 | .the.variable.cannot.be.changed. |
| b13a0 | 62 65 74 77 65 65 6e 20 61 6e 20 61 63 63 65 73 73 20 61 6e 64 20 74 68 65 0a 63 6f 72 72 65 73 | between.an.access.and.the.corres |
| b13c0 | 70 6f 6e 64 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e 74 2e 0a 0a 53 65 72 69 61 6c 69 7a 65 72 73 | ponding.assignment...Serializers |
| b13e0 | 20 69 6e 20 53 63 68 65 6d 65 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | .in.Scheme...................... |
| b1400 | 0a 0a 54 6f 20 6d 61 6b 65 20 74 68 65 20 61 62 6f 76 65 20 6d 65 63 68 61 6e 69 73 6d 20 6d 6f | ..To.make.the.above.mechanism.mo |
| b1420 | 72 65 20 63 6f 6e 63 72 65 74 65 2c 20 73 75 70 70 6f 73 65 20 74 68 61 74 20 77 65 20 68 61 76 | re.concrete,.suppose.that.we.hav |
| b1440 | 65 0a 65 78 74 65 6e 64 65 64 20 53 63 68 65 6d 65 20 74 6f 20 69 6e 63 6c 75 64 65 20 61 20 70 | e.extended.Scheme.to.include.a.p |
| b1460 | 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 65 64 20 60 70 61 72 61 6c 6c 65 6c 2d 65 78 65 63 75 74 | rocedure.called.`parallel-execut |
| b1480 | 65 27 3a 0a 0a 20 20 20 20 20 28 70 61 72 61 6c 6c 65 6c 2d 65 78 65 63 75 74 65 20 3c 50 5f 31 | e':.......(parallel-execute.<P_1 |
| b14a0 | 3e 20 3c 50 5f 32 3e 20 2e 2e 2e 20 3c 50 5f 4b 3e 29 0a 0a 20 20 20 45 61 63 68 20 3c 50 3e 20 | >.<P_2>.....<P_K>).....Each.<P>. |
| b14c0 | 6d 75 73 74 20 62 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 6e 6f 20 61 72 67 75 6d 65 | must.be.a.procedure.of.no.argume |
| b14e0 | 6e 74 73 2e 20 20 60 50 61 72 61 6c 6c 65 6c 2d 65 78 65 63 75 74 65 27 0a 63 72 65 61 74 65 73 | nts...`Parallel-execute'.creates |
| b1500 | 20 61 20 73 65 70 61 72 61 74 65 20 70 72 6f 63 65 73 73 20 66 6f 72 20 65 61 63 68 20 3c 50 3e | .a.separate.process.for.each.<P> |
| b1520 | 2c 20 77 68 69 63 68 20 61 70 70 6c 69 65 73 20 3c 50 3e 20 28 74 6f 20 6e 6f 0a 61 72 67 75 6d | ,.which.applies.<P>.(to.no.argum |
| b1540 | 65 6e 74 73 29 2e 20 20 54 68 65 73 65 20 70 72 6f 63 65 73 73 65 73 20 61 6c 6c 20 72 75 6e 20 | ents)...These.processes.all.run. |
| b1560 | 63 6f 6e 63 75 72 72 65 6e 74 6c 79 2e 28 31 29 0a 0a 20 20 20 41 73 20 61 6e 20 65 78 61 6d 70 | concurrently.(1).....As.an.examp |
| b1580 | 6c 65 20 6f 66 20 68 6f 77 20 74 68 69 73 20 69 73 20 75 73 65 64 2c 20 63 6f 6e 73 69 64 65 72 | le.of.how.this.is.used,.consider |
| b15a0 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 31 30 29 0a 0a 20 20 20 20 20 28 70 61 72 61 | .......(define.x.10).......(para |
| b15c0 | 6c 6c 65 6c 2d 65 78 65 63 75 74 65 20 28 6c 61 6d 62 64 61 20 28 29 20 28 73 65 74 21 20 78 20 | llel-execute.(lambda.().(set!.x. |
| b15e0 | 28 2a 20 78 20 78 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (*.x.x)))....................... |
| b1600 | 20 28 6c 61 6d 62 64 61 20 28 29 20 28 73 65 74 21 20 78 20 28 2b 20 78 20 31 29 29 29 29 0a 0a | .(lambda.().(set!.x.(+.x.1)))).. |
| b1620 | 20 20 20 54 68 69 73 20 63 72 65 61 74 65 73 20 74 77 6f 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 | ...This.creates.two.concurrent.p |
| b1640 | 72 6f 63 65 73 73 65 73 2d 2d 50 5f 31 2c 20 77 68 69 63 68 20 73 65 74 73 20 60 78 27 20 74 6f | rocesses--P_1,.which.sets.`x'.to |
| b1660 | 20 60 78 27 0a 74 69 6d 65 73 20 60 78 27 2c 20 61 6e 64 20 50 5f 32 2c 20 77 68 69 63 68 20 69 | .`x'.times.`x',.and.P_2,.which.i |
| b1680 | 6e 63 72 65 6d 65 6e 74 73 20 60 78 27 2e 20 20 41 66 74 65 72 20 65 78 65 63 75 74 69 6f 6e 20 | ncrements.`x'...After.execution. |
| b16a0 | 69 73 20 63 6f 6d 70 6c 65 74 65 2c 0a 60 78 27 20 77 69 6c 6c 20 62 65 20 6c 65 66 74 20 77 69 | is.complete,.`x'.will.be.left.wi |
| b16c0 | 74 68 20 6f 6e 65 20 6f 66 20 66 69 76 65 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 2c 20 | th.one.of.five.possible.values,. |
| b16e0 | 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68 65 0a 69 6e 74 65 72 6c 65 61 76 69 6e 67 20 6f 66 | depending.on.the.interleaving.of |
| b1700 | 20 74 68 65 20 65 76 65 6e 74 73 20 6f 66 20 50 5f 31 20 61 6e 64 20 50 5f 32 3a 0a 0a 20 20 20 | .the.events.of.P_1.and.P_2:..... |
| b1720 | 20 20 31 30 31 3a 20 50 5f 31 20 73 65 74 73 20 60 78 27 20 74 6f 20 31 30 30 20 61 6e 64 20 74 | ..101:.P_1.sets.`x'.to.100.and.t |
| b1740 | 68 65 6e 20 50 5f 32 20 69 6e 63 72 65 6d 65 6e 74 73 0a 20 20 20 20 20 20 20 20 20 20 60 78 27 | hen.P_2.increments...........`x' |
| b1760 | 20 74 6f 20 31 30 31 2e 0a 20 20 20 20 20 31 32 31 3a 20 50 5f 32 20 69 6e 63 72 65 6d 65 6e 74 | .to.101.......121:.P_2.increment |
| b1780 | 73 20 60 78 27 20 74 6f 20 31 31 20 61 6e 64 20 74 68 65 6e 20 50 5f 31 20 73 65 74 73 0a 20 20 | s.`x'.to.11.and.then.P_1.sets... |
| b17a0 | 20 20 20 20 20 20 20 20 60 78 27 20 74 6f 20 60 78 27 20 74 69 6d 65 73 20 60 78 27 2e 0a 20 20 | ........`x'.to.`x'.times.`x'.... |
| b17c0 | 20 20 20 31 31 30 3a 20 50 5f 32 20 63 68 61 6e 67 65 73 20 60 78 27 20 66 72 6f 6d 20 31 30 20 | ...110:.P_2.changes.`x'.from.10. |
| b17e0 | 74 6f 20 31 31 20 62 65 74 77 65 65 6e 20 74 68 65 20 74 77 6f 0a 20 20 20 20 20 20 20 20 20 20 | to.11.between.the.two........... |
| b1800 | 74 69 6d 65 73 20 74 68 61 74 20 50 5f 31 20 61 63 63 65 73 73 65 73 20 74 68 65 20 76 61 6c 75 | times.that.P_1.accesses.the.valu |
| b1820 | 65 20 6f 66 20 60 78 27 20 64 75 72 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 20 65 76 | e.of.`x'.during...........the.ev |
| b1840 | 61 6c 75 61 74 69 6f 6e 20 6f 66 20 60 28 2a 20 78 20 78 29 27 2e 0a 20 20 20 20 20 31 31 3a 20 | aluation.of.`(*.x.x)'.......11:. |
| b1860 | 20 50 5f 32 20 61 63 63 65 73 73 65 73 20 60 78 27 2c 20 74 68 65 6e 20 50 5f 31 20 73 65 74 73 | .P_2.accesses.`x',.then.P_1.sets |
| b1880 | 20 60 78 27 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 31 30 30 2c 20 74 68 65 6e 20 50 5f 32 20 | .`x'.to...........100,.then.P_2. |
| b18a0 | 73 65 74 73 20 60 78 27 2e 0a 20 20 20 20 20 31 30 30 3a 20 50 5f 31 20 61 63 63 65 73 73 65 73 | sets.`x'.......100:.P_1.accesses |
| b18c0 | 20 60 78 27 20 28 74 77 69 63 65 29 2c 20 74 68 65 6e 20 50 5f 32 20 73 65 74 73 0a 20 20 20 20 | .`x'.(twice),.then.P_2.sets..... |
| b18e0 | 20 20 20 20 20 20 60 78 27 20 74 6f 20 31 31 2c 20 74 68 65 6e 20 50 5f 31 20 73 65 74 73 20 60 | ......`x'.to.11,.then.P_1.sets.` |
| b1900 | 78 27 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 63 6f 6e 73 74 72 61 69 6e 20 74 68 65 20 63 6f 6e | x'......We.can.constrain.the.con |
| b1920 | 63 75 72 72 65 6e 63 79 20 62 79 20 75 73 69 6e 67 20 73 65 72 69 61 6c 69 7a 65 64 20 70 72 6f | currency.by.using.serialized.pro |
| b1940 | 63 65 64 75 72 65 73 2c 0a 77 68 69 63 68 20 61 72 65 20 63 72 65 61 74 65 64 20 62 79 20 22 73 | cedures,.which.are.created.by."s |
| b1960 | 65 72 69 61 6c 69 7a 65 72 73 22 2e 20 53 65 72 69 61 6c 69 7a 65 72 73 20 61 72 65 20 63 6f 6e | erializers"..Serializers.are.con |
| b1980 | 73 74 72 75 63 74 65 64 20 62 79 0a 60 6d 61 6b 65 2d 73 65 72 69 61 6c 69 7a 65 72 27 2c 20 77 | structed.by.`make-serializer',.w |
| b19a0 | 68 6f 73 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 69 73 20 67 69 76 65 6e 20 62 65 6c | hose.implementation.is.given.bel |
| b19c0 | 6f 77 2e 20 20 41 20 73 65 72 69 61 6c 69 7a 65 72 0a 74 61 6b 65 73 20 61 20 70 72 6f 63 65 64 | ow...A.serializer.takes.a.proced |
| b19e0 | 75 72 65 20 61 73 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 20 73 65 | ure.as.argument.and.returns.a.se |
| b1a00 | 72 69 61 6c 69 7a 65 64 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 62 65 68 61 76 65 73 20 | rialized.procedure.that.behaves. |
| b1a20 | 6c 69 6b 65 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 2e 20 20 41 6c | like.the.original.procedure...Al |
| b1a40 | 6c 20 63 61 6c 6c 73 20 74 6f 20 61 20 67 69 76 65 6e 20 73 65 72 69 61 6c 69 7a 65 72 0a 72 65 | l.calls.to.a.given.serializer.re |
| b1a60 | 74 75 72 6e 20 73 65 72 69 61 6c 69 7a 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 | turn.serialized.procedures.in.th |
| b1a80 | 65 20 73 61 6d 65 20 73 65 74 2e 0a 0a 20 20 20 54 68 75 73 2c 20 69 6e 20 63 6f 6e 74 72 61 73 | e.same.set......Thus,.in.contras |
| b1aa0 | 74 20 74 6f 20 74 68 65 20 65 78 61 6d 70 6c 65 20 61 62 6f 76 65 2c 20 65 78 65 63 75 74 69 6e | t.to.the.example.above,.executin |
| b1ac0 | 67 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 31 30 29 0a 0a 20 20 20 20 20 28 64 65 66 | g.......(define.x.10).......(def |
| b1ae0 | 69 6e 65 20 73 20 28 6d 61 6b 65 2d 73 65 72 69 61 6c 69 7a 65 72 29 29 0a 0a 20 20 20 20 20 28 | ine.s.(make-serializer)).......( |
| b1b00 | 70 61 72 61 6c 6c 65 6c 2d 65 78 65 63 75 74 65 20 28 73 20 28 6c 61 6d 62 64 61 20 28 29 20 28 | parallel-execute.(s.(lambda.().( |
| b1b20 | 73 65 74 21 20 78 20 28 2a 20 78 20 78 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | set!.x.(*.x.x))))............... |
| b1b40 | 20 20 20 20 20 20 20 20 20 28 73 20 28 6c 61 6d 62 64 61 20 28 29 20 28 73 65 74 21 20 78 20 28 | .........(s.(lambda.().(set!.x.( |
| b1b60 | 2b 20 78 20 31 29 29 29 29 29 0a 0a 63 61 6e 20 70 72 6f 64 75 63 65 20 6f 6e 6c 79 20 74 77 6f | +.x.1)))))..can.produce.only.two |
| b1b80 | 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 20 66 6f 72 20 60 78 27 2c 20 31 30 31 20 6f 72 | .possible.values.for.`x',.101.or |
| b1ba0 | 20 31 32 31 2e 20 20 54 68 65 20 6f 74 68 65 72 0a 70 6f 73 73 69 62 69 6c 69 74 69 65 73 20 61 | .121...The.other.possibilities.a |
| b1bc0 | 72 65 20 65 6c 69 6d 69 6e 61 74 65 64 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 65 78 65 63 75 | re.eliminated,.because.the.execu |
| b1be0 | 74 69 6f 6e 20 6f 66 20 50 5f 31 20 61 6e 64 20 50 5f 32 0a 63 61 6e 6e 6f 74 20 62 65 20 69 6e | tion.of.P_1.and.P_2.cannot.be.in |
| b1c00 | 74 65 72 6c 65 61 76 65 64 2e 0a 0a 20 20 20 48 65 72 65 20 69 73 20 61 20 76 65 72 73 69 6f 6e | terleaved......Here.is.a.version |
| b1c20 | 20 6f 66 20 74 68 65 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 70 72 6f 63 65 64 75 72 65 | .of.the.`make-account'.procedure |
| b1c40 | 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 33 2d 31 2d 31 3a 3a 2c 20 77 68 65 | .from.section.*Note.3-1-1::,.whe |
| b1c60 | 72 65 20 74 68 65 20 64 65 70 6f 73 69 74 73 20 61 6e 64 20 77 69 74 68 64 72 61 77 61 6c 73 20 | re.the.deposits.and.withdrawals. |
| b1c80 | 68 61 76 65 20 62 65 65 6e 20 73 65 72 69 61 6c 69 7a 65 64 3a 0a 0a 20 20 20 20 20 28 64 65 66 | have.been.serialized:.......(def |
| b1ca0 | 69 6e 65 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 | ine.(make-account.balance)...... |
| b1cc0 | 20 20 28 64 65 66 69 6e 65 20 28 77 69 74 68 64 72 61 77 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 | ..(define.(withdraw.amount)..... |
| b1ce0 | 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 0a 20 20 20 | .....(if.(>=.balance.amount).... |
| b1d00 | 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 | ..........(begin.(set!.balance.( |
| b1d20 | 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | -.balance.amount)).............. |
| b1d40 | 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 22 49 6e | .......balance).............."In |
| b1d60 | 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 | sufficient.funds"))........(defi |
| b1d80 | 6e 65 20 28 64 65 70 6f 73 69 74 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 28 73 65 | ne.(deposit.amount)..........(se |
| b1da0 | 74 21 20 62 61 6c 61 6e 63 65 20 28 2b 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 | t!.balance.(+.balance.amount)).. |
| b1dc0 | 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 | ........balance)........(let.((p |
| b1de0 | 72 6f 74 65 63 74 65 64 20 28 6d 61 6b 65 2d 73 65 72 69 61 6c 69 7a 65 72 29 29 29 0a 20 20 20 | rotected.(make-serializer))).... |
| b1e00 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 29 0a 20 20 20 20 20 | ......(define.(dispatch.m)...... |
| b1e20 | 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6d 20 27 77 69 74 68 64 72 61 77 29 20 28 | ......(cond.((eq?.m.'withdraw).( |
| b1e40 | 70 72 6f 74 65 63 74 65 64 20 77 69 74 68 64 72 61 77 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | protected.withdraw))............ |
| b1e60 | 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 64 65 70 6f 73 69 74 29 20 28 70 72 6f 74 65 63 74 | ......((eq?.m.'deposit).(protect |
| b1e80 | 65 64 20 64 65 70 6f 73 69 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | ed.deposit))..................(( |
| b1ea0 | 65 71 3f 20 6d 20 27 62 61 6c 61 6e 63 65 29 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 | eq?.m.'balance).balance)........ |
| b1ec0 | 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 | ..........(else.(error."Unknown. |
| b1ee0 | 72 65 71 75 65 73 74 20 2d 2d 20 4d 41 4b 45 2d 41 43 43 4f 55 4e 54 22 0a 20 20 20 20 20 20 20 | request.--.MAKE-ACCOUNT"........ |
| b1f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 29 29 29 29 0a 20 20 20 | .......................m)))).... |
| b1f20 | 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 29 0a 0a 20 20 20 57 69 74 68 20 74 68 69 73 20 69 | ......dispatch)).....With.this.i |
| b1f40 | 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 20 74 77 6f 20 70 72 6f 63 65 73 73 65 73 20 63 61 6e | mplementation,.two.processes.can |
| b1f60 | 6e 6f 74 20 62 65 20 77 69 74 68 64 72 61 77 69 6e 67 20 66 72 6f 6d 20 6f 72 0a 64 65 70 6f 73 | not.be.withdrawing.from.or.depos |
| b1f80 | 69 74 69 6e 67 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c 65 20 61 63 63 6f 75 6e 74 20 63 6f 6e 63 | iting.into.a.single.account.conc |
| b1fa0 | 75 72 72 65 6e 74 6c 79 2e 20 20 54 68 69 73 20 65 6c 69 6d 69 6e 61 74 65 73 20 74 68 65 0a 73 | urrently...This.eliminates.the.s |
| b1fc0 | 6f 75 72 63 65 20 6f 66 20 74 68 65 20 65 72 72 6f 72 20 69 6c 6c 75 73 74 72 61 74 65 64 20 69 | ource.of.the.error.illustrated.i |
| b1fe0 | 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 32 39 3a 3a 2c 20 77 68 65 72 65 20 50 65 74 | n.*Note.Figure.3-29::,.where.Pet |
| b2000 | 65 72 0a 63 68 61 6e 67 65 73 20 74 68 65 20 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e 63 65 20 62 | er.changes.the.account.balance.b |
| b2020 | 65 74 77 65 65 6e 20 74 68 65 20 74 69 6d 65 73 20 77 68 65 6e 20 50 61 75 6c 20 61 63 63 65 73 | etween.the.times.when.Paul.acces |
| b2040 | 73 65 73 20 74 68 65 0a 62 61 6c 61 6e 63 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 6e | ses.the.balance.to.compute.the.n |
| b2060 | 65 77 20 76 61 6c 75 65 20 61 6e 64 20 77 68 65 6e 20 50 61 75 6c 20 61 63 74 75 61 6c 6c 79 20 | ew.value.and.when.Paul.actually. |
| b2080 | 70 65 72 66 6f 72 6d 73 20 74 68 65 0a 61 73 73 69 67 6e 6d 65 6e 74 2e 20 20 4f 6e 20 74 68 65 | performs.the.assignment...On.the |
| b20a0 | 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 65 61 63 68 20 61 63 63 6f 75 6e 74 20 68 61 73 20 69 74 | .other.hand,.each.account.has.it |
| b20c0 | 73 20 6f 77 6e 20 73 65 72 69 61 6c 69 7a 65 72 2c 20 73 6f 0a 74 68 61 74 20 64 65 70 6f 73 69 | s.own.serializer,.so.that.deposi |
| b20e0 | 74 73 20 61 6e 64 20 77 69 74 68 64 72 61 77 61 6c 73 20 66 6f 72 20 64 69 66 66 65 72 65 6e 74 | ts.and.withdrawals.for.different |
| b2100 | 20 61 63 63 6f 75 6e 74 73 20 63 61 6e 20 70 72 6f 63 65 65 64 0a 63 6f 6e 63 75 72 72 65 6e 74 | .accounts.can.proceed.concurrent |
| b2120 | 6c 79 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 33 39 3a 2a 20 57 68 69 63 68 | ly........*Exercise.3.39:*.Which |
| b2140 | 20 6f 66 20 74 68 65 20 66 69 76 65 20 70 6f 73 73 69 62 69 6c 69 74 69 65 73 20 69 6e 20 74 68 | .of.the.five.possibilities.in.th |
| b2160 | 65 20 70 61 72 61 6c 6c 65 6c 0a 20 20 20 20 20 65 78 65 63 75 74 69 6f 6e 20 73 68 6f 77 6e 20 | e.parallel......execution.shown. |
| b2180 | 61 62 6f 76 65 20 72 65 6d 61 69 6e 20 69 66 20 77 65 20 69 6e 73 74 65 61 64 20 73 65 72 69 61 | above.remain.if.we.instead.seria |
| b21a0 | 6c 69 7a 65 20 65 78 65 63 75 74 69 6f 6e 20 61 73 0a 20 20 20 20 20 66 6f 6c 6c 6f 77 73 3a 0a | lize.execution.as......follows:. |
| b21c0 | 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 31 30 29 0a 0a 20 20 20 20 20 20 | ...........(define.x.10)........ |
| b21e0 | 20 20 20 20 28 64 65 66 69 6e 65 20 73 20 28 6d 61 6b 65 2d 73 65 72 69 61 6c 69 7a 65 72 29 29 | ....(define.s.(make-serializer)) |
| b2200 | 0a 0a 20 20 20 20 20 20 20 20 20 20 28 70 61 72 61 6c 6c 65 6c 2d 65 78 65 63 75 74 65 20 28 6c | ............(parallel-execute.(l |
| b2220 | 61 6d 62 64 61 20 28 29 20 28 73 65 74 21 20 78 20 28 28 73 20 28 6c 61 6d 62 64 61 20 28 29 20 | ambda.().(set!.x.((s.(lambda.(). |
| b2240 | 28 2a 20 78 20 78 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (*.x.x)))))).................... |
| b2260 | 20 20 20 20 20 20 20 20 20 28 73 20 28 6c 61 6d 62 64 61 20 28 29 20 28 73 65 74 21 20 78 20 28 | .........(s.(lambda.().(set!.x.( |
| b2280 | 2b 20 78 20 31 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 34 30 3a | +.x.1))))).......*Exercise.3.40: |
| b22a0 | 2a 20 47 69 76 65 20 61 6c 6c 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 20 6f 66 20 60 78 | *.Give.all.possible.values.of.`x |
| b22c0 | 27 20 74 68 61 74 20 63 61 6e 20 72 65 73 75 6c 74 0a 20 20 20 20 20 66 72 6f 6d 20 65 78 65 63 | '.that.can.result......from.exec |
| b22e0 | 75 74 69 6e 67 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 31 30 29 0a 0a | uting............(define.x.10).. |
| b2300 | 20 20 20 20 20 20 20 20 20 20 28 70 61 72 61 6c 6c 65 6c 2d 65 78 65 63 75 74 65 20 28 6c 61 6d | ..........(parallel-execute.(lam |
| b2320 | 62 64 61 20 28 29 20 28 73 65 74 21 20 78 20 28 2a 20 78 20 78 29 29 29 0a 20 20 20 20 20 20 20 | bda.().(set!.x.(*.x.x)))........ |
| b2340 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 | .....................(lambda.(). |
| b2360 | 28 73 65 74 21 20 78 20 28 2a 20 78 20 78 20 78 29 29 29 29 0a 0a 20 20 20 20 20 57 68 69 63 68 | (set!.x.(*.x.x.x)))).......Which |
| b2380 | 20 6f 66 20 74 68 65 73 65 20 70 6f 73 73 69 62 69 6c 69 74 69 65 73 20 72 65 6d 61 69 6e 20 69 | .of.these.possibilities.remain.i |
| b23a0 | 66 20 77 65 20 69 6e 73 74 65 61 64 20 75 73 65 20 73 65 72 69 61 6c 69 7a 65 64 0a 20 20 20 20 | f.we.instead.use.serialized..... |
| b23c0 | 20 70 72 6f 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | .procedures:............(define. |
| b23e0 | 78 20 31 30 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 20 28 6d 61 6b 65 | x.10)............(define.s.(make |
| b2400 | 2d 73 65 72 69 61 6c 69 7a 65 72 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 70 61 72 61 6c 6c | -serializer))............(parall |
| b2420 | 65 6c 2d 65 78 65 63 75 74 65 20 28 73 20 28 6c 61 6d 62 64 61 20 28 29 20 28 73 65 74 21 20 78 | el-execute.(s.(lambda.().(set!.x |
| b2440 | 20 28 2a 20 78 20 78 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(*.x.x))))..................... |
| b2460 | 20 20 20 20 20 20 20 20 28 73 20 28 6c 61 6d 62 64 61 20 28 29 20 28 73 65 74 21 20 78 20 28 2a | ........(s.(lambda.().(set!.x.(* |
| b2480 | 20 78 20 78 20 78 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 34 31 | .x.x.x))))).......*Exercise.3.41 |
| b24a0 | 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 77 6f 72 72 69 65 73 20 74 68 61 74 20 69 74 | :*.Ben.Bitdiddle.worries.that.it |
| b24c0 | 20 77 6f 75 6c 64 20 62 65 20 62 65 74 74 65 72 20 74 6f 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 | .would.be.better.to......impleme |
| b24e0 | 6e 74 20 74 68 65 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 20 61 73 20 66 6f 6c 6c 6f 77 73 20 28 | nt.the.bank.account.as.follows.( |
| b2500 | 77 68 65 72 65 20 74 68 65 20 63 6f 6d 6d 65 6e 74 65 64 20 6c 69 6e 65 0a 20 20 20 20 20 68 61 | where.the.commented.line......ha |
| b2520 | 73 20 62 65 65 6e 20 63 68 61 6e 67 65 64 29 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | s.been.changed):............(def |
| b2540 | 69 6e 65 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 | ine.(make-account.balance)...... |
| b2560 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 77 69 74 68 64 72 61 77 20 61 6d 6f 75 6e 74 29 | .......(define.(withdraw.amount) |
| b2580 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 | ...............(if.(>=.balance.a |
| b25a0 | 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 | mount)...................(begin. |
| b25c0 | 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 | (set!.balance.(-.balance.amount) |
| b25e0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e | )..........................balan |
| b2600 | 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 | ce)..................."Insuffici |
| b2620 | 65 6e 74 20 66 75 6e 64 73 22 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | ent.funds")).............(define |
| b2640 | 20 28 64 65 70 6f 73 69 74 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(deposit.amount)............... |
| b2660 | 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2b 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 | (set!.balance.(+.balance.amount) |
| b2680 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 | )...............balance)........ |
| b26a0 | 20 20 20 20 20 3b 3b 20 63 6f 6e 74 69 6e 75 65 64 20 6f 6e 20 6e 65 78 74 20 70 61 67 65 0a 0a | .....;;.continued.on.next.page.. |
| b26c0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 6f 74 65 63 74 65 64 20 28 6d 61 | ............(let.((protected.(ma |
| b26e0 | 6b 65 2d 73 65 72 69 61 6c 69 7a 65 72 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ke-serializer)))...............( |
| b2700 | 64 65 66 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | define.(dispatch.m)............. |
| b2720 | 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6d 20 27 77 69 74 68 64 72 61 77 29 20 28 70 72 | ....(cond.((eq?.m.'withdraw).(pr |
| b2740 | 6f 74 65 63 74 65 64 20 77 69 74 68 64 72 61 77 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | otected.withdraw)).............. |
| b2760 | 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 64 65 70 6f 73 69 74 29 20 28 70 72 6f 74 | .........((eq?.m.'deposit).(prot |
| b2780 | 65 63 74 65 64 20 64 65 70 6f 73 69 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ected.deposit))................. |
| b27a0 | 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 | ......((eq?.m.'balance)......... |
| b27c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 70 72 6f 74 65 63 74 65 64 20 28 6c 61 6d 62 | ...............((protected.(lamb |
| b27e0 | 64 61 20 28 29 20 62 61 6c 61 6e 63 65 29 29 29 29 20 3b 20 73 65 72 69 61 6c 69 7a 65 64 0a 20 | da.().balance)))).;.serialized.. |
| b2800 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f | .....................(else.(erro |
| b2820 | 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 2d 2d 20 4d 41 4b 45 2d 41 43 43 4f 55 | r."Unknown.request.--.MAKE-ACCOU |
| b2840 | 4e 54 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | NT"............................. |
| b2860 | 20 20 20 20 20 20 20 6d 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 69 73 70 61 | .......m))))...............dispa |
| b2880 | 74 63 68 29 29 0a 0a 20 20 20 20 20 62 65 63 61 75 73 65 20 61 6c 6c 6f 77 69 6e 67 20 75 6e 73 | tch)).......because.allowing.uns |
| b28a0 | 65 72 69 61 6c 69 7a 65 64 20 61 63 63 65 73 73 20 74 6f 20 74 68 65 20 62 61 6e 6b 20 62 61 6c | erialized.access.to.the.bank.bal |
| b28c0 | 61 6e 63 65 20 63 61 6e 0a 20 20 20 20 20 72 65 73 75 6c 74 20 69 6e 20 61 6e 6f 6d 61 6c 6f 75 | ance.can......result.in.anomalou |
| b28e0 | 73 20 62 65 68 61 76 69 6f 72 2e 20 20 44 6f 20 79 6f 75 20 61 67 72 65 65 3f 20 20 49 73 20 74 | s.behavior...Do.you.agree?..Is.t |
| b2900 | 68 65 72 65 20 61 6e 79 0a 20 20 20 20 20 73 63 65 6e 61 72 69 6f 20 74 68 61 74 20 64 65 6d 6f | here.any......scenario.that.demo |
| b2920 | 6e 73 74 72 61 74 65 73 20 42 65 6e 27 73 20 63 6f 6e 63 65 72 6e 3f 0a 0a 20 20 20 20 20 2a 45 | nstrates.Ben's.concern?.......*E |
| b2940 | 78 65 72 63 69 73 65 20 33 2e 34 32 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 73 75 67 | xercise.3.42:*.Ben.Bitdiddle.sug |
| b2960 | 67 65 73 74 73 20 74 68 61 74 20 69 74 27 73 20 61 20 77 61 73 74 65 20 6f 66 20 74 69 6d 65 0a | gests.that.it's.a.waste.of.time. |
| b2980 | 20 20 20 20 20 74 6f 20 63 72 65 61 74 65 20 61 20 6e 65 77 20 73 65 72 69 61 6c 69 7a 65 64 20 | .....to.create.a.new.serialized. |
| b29a0 | 70 72 6f 63 65 64 75 72 65 20 69 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 20 65 76 65 72 79 0a 20 | procedure.in.response.to.every.. |
| b29c0 | 20 20 20 20 60 77 69 74 68 64 72 61 77 27 20 61 6e 64 20 60 64 65 70 6f 73 69 74 27 20 6d 65 73 | ....`withdraw'.and.`deposit'.mes |
| b29e0 | 73 61 67 65 2e 20 20 48 65 20 73 61 79 73 20 74 68 61 74 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e | sage...He.says.that.`make-accoun |
| b2a00 | 74 27 0a 20 20 20 20 20 63 6f 75 6c 64 20 62 65 20 63 68 61 6e 67 65 64 20 73 6f 20 74 68 61 74 | t'......could.be.changed.so.that |
| b2a20 | 20 74 68 65 20 63 61 6c 6c 73 20 74 6f 20 60 70 72 6f 74 65 63 74 65 64 27 20 61 72 65 20 64 6f | .the.calls.to.`protected'.are.do |
| b2a40 | 6e 65 20 6f 75 74 73 69 64 65 0a 20 20 20 20 20 74 68 65 20 60 64 69 73 70 61 74 63 68 27 20 70 | ne.outside......the.`dispatch'.p |
| b2a60 | 72 6f 63 65 64 75 72 65 2e 20 20 54 68 61 74 20 69 73 2c 20 61 6e 20 61 63 63 6f 75 6e 74 20 77 | rocedure...That.is,.an.account.w |
| b2a80 | 6f 75 6c 64 20 72 65 74 75 72 6e 20 74 68 65 0a 20 20 20 20 20 73 61 6d 65 20 73 65 72 69 61 6c | ould.return.the......same.serial |
| b2aa0 | 69 7a 65 64 20 70 72 6f 63 65 64 75 72 65 20 28 77 68 69 63 68 20 77 61 73 20 63 72 65 61 74 65 | ized.procedure.(which.was.create |
| b2ac0 | 64 20 61 74 20 74 68 65 20 73 61 6d 65 20 74 69 6d 65 20 61 73 0a 20 20 20 20 20 74 68 65 20 61 | d.at.the.same.time.as......the.a |
| b2ae0 | 63 63 6f 75 6e 74 29 20 65 61 63 68 20 74 69 6d 65 20 69 74 20 69 73 20 61 73 6b 65 64 20 66 6f | ccount).each.time.it.is.asked.fo |
| b2b00 | 72 20 61 20 77 69 74 68 64 72 61 77 61 6c 20 70 72 6f 63 65 64 75 72 65 2e 0a 0a 20 20 20 20 20 | r.a.withdrawal.procedure........ |
| b2b20 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e | .....(define.(make-account.balan |
| b2b40 | 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 77 69 74 68 64 72 61 | ce).............(define.(withdra |
| b2b60 | 77 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 3d 20 | w.amount)...............(if.(>=. |
| b2b80 | 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | balance.amount)................. |
| b2ba0 | 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 | ..(begin.(set!.balance.(-.balanc |
| b2bc0 | 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e.amount))...................... |
| b2be0 | 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 | ....balance)..................." |
| b2c00 | 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 0a 20 20 20 20 20 20 20 20 20 20 | Insufficient.funds"))........... |
| b2c20 | 20 20 28 64 65 66 69 6e 65 20 28 64 65 70 6f 73 69 74 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 | ..(define.(deposit.amount)...... |
| b2c40 | 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2b 20 62 61 6c 61 6e 63 | .........(set!.balance.(+.balanc |
| b2c60 | 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 | e.amount))...............balance |
| b2c80 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 6f 74 65 63 74 65 64 20 28 | ).............(let.((protected.( |
| b2ca0 | 6d 61 6b 65 2d 73 65 72 69 61 6c 69 7a 65 72 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | make-serializer))).............. |
| b2cc0 | 20 28 6c 65 74 20 28 28 70 72 6f 74 65 63 74 65 64 2d 77 69 74 68 64 72 61 77 20 28 70 72 6f 74 | .(let.((protected-withdraw.(prot |
| b2ce0 | 65 63 74 65 64 20 77 69 74 68 64 72 61 77 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ected.withdraw))................ |
| b2d00 | 20 20 20 20 20 28 70 72 6f 74 65 63 74 65 64 2d 64 65 70 6f 73 69 74 20 28 70 72 6f 74 65 63 74 | .....(protected-deposit.(protect |
| b2d20 | 65 64 20 64 65 70 6f 73 69 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 | ed.deposit))).................(d |
| b2d40 | 65 66 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | efine.(dispatch.m).............. |
| b2d60 | 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6d 20 27 77 69 74 68 64 72 61 77 29 20 70 72 | .....(cond.((eq?.m.'withdraw).pr |
| b2d80 | 6f 74 65 63 74 65 64 2d 77 69 74 68 64 72 61 77 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | otected-withdraw)............... |
| b2da0 | 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 64 65 70 6f 73 69 74 29 20 70 72 6f 74 | ..........((eq?.m.'deposit).prot |
| b2dc0 | 65 63 74 65 64 2d 64 65 70 6f 73 69 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ected-deposit).................. |
| b2de0 | 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 62 61 6c 61 6e 63 65 29 20 62 61 6c 61 6e 63 65 | .......((eq?.m.'balance).balance |
| b2e00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 | ).........................(else. |
| b2e20 | 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 2d 2d 20 4d 41 4b 45 2d | (error."Unknown.request.--.MAKE- |
| b2e40 | 41 43 43 4f 55 4e 54 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ACCOUNT"........................ |
| b2e60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..............m))))............. |
| b2e80 | 20 20 20 20 64 69 73 70 61 74 63 68 29 29 29 0a 0a 20 20 20 20 20 49 73 20 74 68 69 73 20 61 20 | ....dispatch))).......Is.this.a. |
| b2ea0 | 73 61 66 65 20 63 68 61 6e 67 65 20 74 6f 20 6d 61 6b 65 3f 20 20 49 6e 20 70 61 72 74 69 63 75 | safe.change.to.make?..In.particu |
| b2ec0 | 6c 61 72 2c 20 69 73 20 74 68 65 72 65 20 61 6e 79 0a 20 20 20 20 20 64 69 66 66 65 72 65 6e 63 | lar,.is.there.any......differenc |
| b2ee0 | 65 20 69 6e 20 77 68 61 74 20 63 6f 6e 63 75 72 72 65 6e 63 79 20 69 73 20 61 6c 6c 6f 77 65 64 | e.in.what.concurrency.is.allowed |
| b2f00 | 20 62 79 20 74 68 65 73 65 20 74 77 6f 20 76 65 72 73 69 6f 6e 73 20 6f 66 0a 20 20 20 20 20 60 | .by.these.two.versions.of......` |
| b2f20 | 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 3f 0a 0a 43 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 75 | make-account'.?..Complexity.of.u |
| b2f40 | 73 69 6e 67 20 6d 75 6c 74 69 70 6c 65 20 73 68 61 72 65 64 20 72 65 73 6f 75 72 63 65 73 0a 2e | sing.multiple.shared.resources.. |
| b2f60 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ................................ |
| b2f80 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 53 65 72 69 61 6c 69 7a 65 72 73 20 70 72 6f 76 69 64 | ..............Serializers.provid |
| b2fa0 | 65 20 61 20 70 6f 77 65 72 66 75 6c 20 61 62 73 74 72 61 63 74 69 6f 6e 20 74 68 61 74 20 68 65 | e.a.powerful.abstraction.that.he |
| b2fc0 | 6c 70 73 20 69 73 6f 6c 61 74 65 20 74 68 65 0a 63 6f 6d 70 6c 65 78 69 74 69 65 73 20 6f 66 20 | lps.isolate.the.complexities.of. |
| b2fe0 | 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 6f 67 72 61 6d 73 20 73 6f 20 74 68 61 74 20 74 68 65 79 | concurrent.programs.so.that.they |
| b3000 | 20 63 61 6e 20 62 65 20 64 65 61 6c 74 20 77 69 74 68 0a 63 61 72 65 66 75 6c 6c 79 20 61 6e 64 | .can.be.dealt.with.carefully.and |
| b3020 | 20 28 68 6f 70 65 66 75 6c 6c 79 29 20 63 6f 72 72 65 63 74 6c 79 2e 20 20 48 6f 77 65 76 65 72 | .(hopefully).correctly...However |
| b3040 | 2c 20 77 68 69 6c 65 20 75 73 69 6e 67 20 73 65 72 69 61 6c 69 7a 65 72 73 0a 69 73 20 72 65 6c | ,.while.using.serializers.is.rel |
| b3060 | 61 74 69 76 65 6c 79 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 77 68 65 6e 20 74 68 65 | atively.straightforward.when.the |
| b3080 | 72 65 20 69 73 20 6f 6e 6c 79 20 61 20 73 69 6e 67 6c 65 20 73 68 61 72 65 64 0a 72 65 73 6f 75 | re.is.only.a.single.shared.resou |
| b30a0 | 72 63 65 20 28 73 75 63 68 20 61 73 20 61 20 73 69 6e 67 6c 65 20 62 61 6e 6b 20 61 63 63 6f 75 | rce.(such.as.a.single.bank.accou |
| b30c0 | 6e 74 29 2c 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 63 61 6e 20 | nt),.concurrent.programming.can. |
| b30e0 | 62 65 0a 74 72 65 61 63 68 65 72 6f 75 73 6c 79 20 64 69 66 66 69 63 75 6c 74 20 77 68 65 6e 20 | be.treacherously.difficult.when. |
| b3100 | 74 68 65 72 65 20 61 72 65 20 6d 75 6c 74 69 70 6c 65 20 73 68 61 72 65 64 20 72 65 73 6f 75 72 | there.are.multiple.shared.resour |
| b3120 | 63 65 73 2e 0a 0a 20 20 20 54 6f 20 69 6c 6c 75 73 74 72 61 74 65 20 6f 6e 65 20 6f 66 20 74 68 | ces......To.illustrate.one.of.th |
| b3140 | 65 20 64 69 66 66 69 63 75 6c 74 69 65 73 20 74 68 61 74 20 63 61 6e 20 61 72 69 73 65 2c 20 73 | e.difficulties.that.can.arise,.s |
| b3160 | 75 70 70 6f 73 65 20 77 65 0a 77 69 73 68 20 74 6f 20 73 77 61 70 20 74 68 65 20 62 61 6c 61 6e | uppose.we.wish.to.swap.the.balan |
| b3180 | 63 65 73 20 69 6e 20 74 77 6f 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 73 2e 20 20 57 65 20 61 63 | ces.in.two.bank.accounts...We.ac |
| b31a0 | 63 65 73 73 20 65 61 63 68 20 61 63 63 6f 75 6e 74 0a 74 6f 20 66 69 6e 64 20 74 68 65 20 62 61 | cess.each.account.to.find.the.ba |
| b31c0 | 6c 61 6e 63 65 2c 20 63 6f 6d 70 75 74 65 20 74 68 65 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 | lance,.compute.the.difference.be |
| b31e0 | 74 77 65 65 6e 20 74 68 65 20 62 61 6c 61 6e 63 65 73 2c 0a 77 69 74 68 64 72 61 77 20 74 68 69 | tween.the.balances,.withdraw.thi |
| b3200 | 73 20 64 69 66 66 65 72 65 6e 63 65 20 66 72 6f 6d 20 6f 6e 65 20 61 63 63 6f 75 6e 74 2c 20 61 | s.difference.from.one.account,.a |
| b3220 | 6e 64 20 64 65 70 6f 73 69 74 20 69 74 20 69 6e 20 74 68 65 20 6f 74 68 65 72 0a 61 63 63 6f 75 | nd.deposit.it.in.the.other.accou |
| b3240 | 6e 74 2e 20 20 57 65 20 63 6f 75 6c 64 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 69 73 20 61 73 20 | nt...We.could.implement.this.as. |
| b3260 | 66 6f 6c 6c 6f 77 73 3a 28 32 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 63 68 61 | follows:(2).......(define.(excha |
| b3280 | 6e 67 65 20 61 63 63 6f 75 6e 74 31 20 61 63 63 6f 75 6e 74 32 29 0a 20 20 20 20 20 20 20 28 6c | nge.account1.account2)........(l |
| b32a0 | 65 74 20 28 28 64 69 66 66 65 72 65 6e 63 65 20 28 2d 20 28 61 63 63 6f 75 6e 74 31 20 27 62 61 | et.((difference.(-.(account1.'ba |
| b32c0 | 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | lance).......................... |
| b32e0 | 20 20 20 28 61 63 63 6f 75 6e 74 32 20 27 62 61 6c 61 6e 63 65 29 29 29 29 0a 20 20 20 20 20 20 | ...(account2.'balance))))....... |
| b3300 | 20 20 20 28 28 61 63 63 6f 75 6e 74 31 20 27 77 69 74 68 64 72 61 77 29 20 64 69 66 66 65 72 65 | ...((account1.'withdraw).differe |
| b3320 | 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 28 28 61 63 63 6f 75 6e 74 32 20 27 64 65 70 6f 73 69 | nce)..........((account2.'deposi |
| b3340 | 74 29 20 64 69 66 66 65 72 65 6e 63 65 29 29 29 0a 0a 20 20 20 54 68 69 73 20 70 72 6f 63 65 64 | t).difference))).....This.proced |
| b3360 | 75 72 65 20 77 6f 72 6b 73 20 77 65 6c 6c 20 77 68 65 6e 20 6f 6e 6c 79 20 61 20 73 69 6e 67 6c | ure.works.well.when.only.a.singl |
| b3380 | 65 20 70 72 6f 63 65 73 73 20 69 73 20 74 72 79 69 6e 67 20 74 6f 20 64 6f 0a 74 68 65 20 65 78 | e.process.is.trying.to.do.the.ex |
| b33a0 | 63 68 61 6e 67 65 2e 20 20 53 75 70 70 6f 73 65 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 61 74 20 | change...Suppose,.however,.that. |
| b33c0 | 50 65 74 65 72 20 61 6e 64 20 50 61 75 6c 20 62 6f 74 68 20 68 61 76 65 20 61 63 63 65 73 73 0a | Peter.and.Paul.both.have.access. |
| b33e0 | 74 6f 20 61 63 63 6f 75 6e 74 73 20 61 31 2c 20 61 32 2c 20 61 6e 64 20 61 33 2c 20 61 6e 64 20 | to.accounts.a1,.a2,.and.a3,.and. |
| b3400 | 74 68 61 74 20 50 65 74 65 72 20 65 78 63 68 61 6e 67 65 73 20 61 31 20 61 6e 64 20 61 32 20 77 | that.Peter.exchanges.a1.and.a2.w |
| b3420 | 68 69 6c 65 0a 50 61 75 6c 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 20 65 78 63 68 61 6e 67 65 73 | hile.Paul.concurrently.exchanges |
| b3440 | 20 61 31 20 61 6e 64 20 61 33 2e 20 20 45 76 65 6e 20 77 69 74 68 20 61 63 63 6f 75 6e 74 20 64 | .a1.and.a3...Even.with.account.d |
| b3460 | 65 70 6f 73 69 74 73 20 61 6e 64 0a 77 69 74 68 64 72 61 77 61 6c 73 20 73 65 72 69 61 6c 69 7a | eposits.and.withdrawals.serializ |
| b3480 | 65 64 20 66 6f 72 20 69 6e 64 69 76 69 64 75 61 6c 20 61 63 63 6f 75 6e 74 73 20 28 61 73 20 69 | ed.for.individual.accounts.(as.i |
| b34a0 | 6e 20 74 68 65 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 0a 70 72 6f 63 65 64 75 72 65 20 73 | n.the.`make-account'.procedure.s |
| b34c0 | 68 6f 77 6e 20 61 62 6f 76 65 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 29 2c 20 60 65 78 | hown.above.in.this.section),.`ex |
| b34e0 | 63 68 61 6e 67 65 27 20 63 61 6e 20 73 74 69 6c 6c 20 70 72 6f 64 75 63 65 0a 69 6e 63 6f 72 72 | change'.can.still.produce.incorr |
| b3500 | 65 63 74 20 72 65 73 75 6c 74 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 50 65 74 65 72 | ect.results...For.example,.Peter |
| b3520 | 20 6d 69 67 68 74 20 63 6f 6d 70 75 74 65 20 74 68 65 20 64 69 66 66 65 72 65 6e 63 65 20 69 6e | .might.compute.the.difference.in |
| b3540 | 0a 74 68 65 20 62 61 6c 61 6e 63 65 73 20 66 6f 72 20 61 31 20 61 6e 64 20 61 32 2c 20 62 75 74 | .the.balances.for.a1.and.a2,.but |
| b3560 | 20 74 68 65 6e 20 50 61 75 6c 20 6d 69 67 68 74 20 63 68 61 6e 67 65 20 74 68 65 20 62 61 6c 61 | .then.Paul.might.change.the.bala |
| b3580 | 6e 63 65 20 69 6e 0a 61 31 20 62 65 66 6f 72 65 20 50 65 74 65 72 20 69 73 20 61 62 6c 65 20 74 | nce.in.a1.before.Peter.is.able.t |
| b35a0 | 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 65 20 65 78 63 68 61 6e 67 65 2e 28 33 29 20 20 46 6f 72 | o.complete.the.exchange.(3)..For |
| b35c0 | 20 63 6f 72 72 65 63 74 0a 62 65 68 61 76 69 6f 72 2c 20 77 65 20 6d 75 73 74 20 61 72 72 61 6e | .correct.behavior,.we.must.arran |
| b35e0 | 67 65 20 66 6f 72 20 74 68 65 20 60 65 78 63 68 61 6e 67 65 27 20 70 72 6f 63 65 64 75 72 65 20 | ge.for.the.`exchange'.procedure. |
| b3600 | 74 6f 20 6c 6f 63 6b 20 6f 75 74 20 61 6e 79 0a 6f 74 68 65 72 20 63 6f 6e 63 75 72 72 65 6e 74 | to.lock.out.any.other.concurrent |
| b3620 | 20 61 63 63 65 73 73 65 73 20 74 6f 20 74 68 65 20 61 63 63 6f 75 6e 74 73 20 64 75 72 69 6e 67 | .accesses.to.the.accounts.during |
| b3640 | 20 74 68 65 20 65 6e 74 69 72 65 20 74 69 6d 65 20 6f 66 20 74 68 65 0a 65 78 63 68 61 6e 67 65 | .the.entire.time.of.the.exchange |
| b3660 | 2e 0a 0a 20 20 20 4f 6e 65 20 77 61 79 20 77 65 20 63 61 6e 20 61 63 63 6f 6d 70 6c 69 73 68 20 | ......One.way.we.can.accomplish. |
| b3680 | 74 68 69 73 20 69 73 20 62 79 20 75 73 69 6e 67 20 62 6f 74 68 20 61 63 63 6f 75 6e 74 73 27 0a | this.is.by.using.both.accounts'. |
| b36a0 | 73 65 72 69 61 6c 69 7a 65 72 73 20 74 6f 20 73 65 72 69 61 6c 69 7a 65 20 74 68 65 20 65 6e 74 | serializers.to.serialize.the.ent |
| b36c0 | 69 72 65 20 60 65 78 63 68 61 6e 67 65 27 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 6f 20 64 6f | ire.`exchange'.procedure...To.do |
| b36e0 | 20 74 68 69 73 2c 0a 77 65 20 77 69 6c 6c 20 61 72 72 61 6e 67 65 20 66 6f 72 20 61 63 63 65 73 | .this,.we.will.arrange.for.acces |
| b3700 | 73 20 74 6f 20 61 6e 20 61 63 63 6f 75 6e 74 27 73 20 73 65 72 69 61 6c 69 7a 65 72 2e 20 20 4e | s.to.an.account's.serializer...N |
| b3720 | 6f 74 65 20 74 68 61 74 20 77 65 0a 61 72 65 20 64 65 6c 69 62 65 72 61 74 65 6c 79 20 62 72 65 | ote.that.we.are.deliberately.bre |
| b3740 | 61 6b 69 6e 67 20 74 68 65 20 6d 6f 64 75 6c 61 72 69 74 79 20 6f 66 20 74 68 65 20 62 61 6e 6b | aking.the.modularity.of.the.bank |
| b3760 | 2d 61 63 63 6f 75 6e 74 20 6f 62 6a 65 63 74 20 62 79 0a 65 78 70 6f 73 69 6e 67 20 74 68 65 20 | -account.object.by.exposing.the. |
| b3780 | 73 65 72 69 61 6c 69 7a 65 72 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 76 65 72 73 69 | serializer...The.following.versi |
| b37a0 | 6f 6e 20 6f 66 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 69 73 0a 69 64 65 6e 74 69 63 61 | on.of.`make-account'.is.identica |
| b37c0 | 6c 20 74 6f 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 76 65 72 73 69 6f 6e 20 67 69 76 65 6e 20 | l.to.the.original.version.given. |
| b37e0 | 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 31 3a 3a 2c 0a 65 78 63 65 70 74 | in.section.*Note.3-1-1::,.except |
| b3800 | 20 74 68 61 74 20 61 20 73 65 72 69 61 6c 69 7a 65 72 20 69 73 20 70 72 6f 76 69 64 65 64 20 74 | .that.a.serializer.is.provided.t |
| b3820 | 6f 20 70 72 6f 74 65 63 74 20 74 68 65 20 62 61 6c 61 6e 63 65 20 76 61 72 69 61 62 6c 65 2c 0a | o.protect.the.balance.variable,. |
| b3840 | 61 6e 64 20 74 68 65 20 73 65 72 69 61 6c 69 7a 65 72 20 69 73 20 65 78 70 6f 72 74 65 64 20 76 | and.the.serializer.is.exported.v |
| b3860 | 69 61 20 6d 65 73 73 61 67 65 20 70 61 73 73 69 6e 67 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | ia.message.passing:.......(defin |
| b3880 | 65 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 2d 61 6e 64 2d 73 65 72 69 61 6c 69 7a 65 72 20 62 | e.(make-account-and-serializer.b |
| b38a0 | 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 77 69 74 68 64 72 61 77 | alance)........(define.(withdraw |
| b38c0 | 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 | .amount)..........(if.(>=.balanc |
| b38e0 | 65 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 | e.amount)..............(begin.(s |
| b3900 | 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a | et!.balance.(-.balance.amount)). |
| b3920 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 | ....................balance).... |
| b3940 | 20 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 66 75 6e 64 73 22 29 29 | .........."Insufficient.funds")) |
| b3960 | 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 70 6f 73 69 74 20 61 6d 6f 75 6e 74 29 | ........(define.(deposit.amount) |
| b3980 | 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 62 61 6c 61 6e 63 65 20 28 2b 20 62 61 6c 61 6e | ..........(set!.balance.(+.balan |
| b39a0 | 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 | ce.amount))..........balance)... |
| b39c0 | 20 20 20 20 20 28 6c 65 74 20 28 28 62 61 6c 61 6e 63 65 2d 73 65 72 69 61 6c 69 7a 65 72 20 28 | .....(let.((balance-serializer.( |
| b39e0 | 6d 61 6b 65 2d 73 65 72 69 61 6c 69 7a 65 72 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 | make-serializer)))..........(def |
| b3a00 | 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e | ine.(dispatch.m)............(con |
| b3a20 | 64 20 28 28 65 71 3f 20 6d 20 27 77 69 74 68 64 72 61 77 29 20 77 69 74 68 64 72 61 77 29 0a 20 | d.((eq?.m.'withdraw).withdraw).. |
| b3a40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 64 65 70 6f 73 69 74 | ................((eq?.m.'deposit |
| b3a60 | 29 20 64 65 70 6f 73 69 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 | ).deposit)..................((eq |
| b3a80 | 3f 20 6d 20 27 62 61 6c 61 6e 63 65 29 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 | ?.m.'balance).balance).......... |
| b3aa0 | 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 73 65 72 69 61 6c 69 7a 65 72 29 20 62 61 6c | ........((eq?.m.'serializer).bal |
| b3ac0 | 61 6e 63 65 2d 73 65 72 69 61 6c 69 7a 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ance-serializer)................ |
| b3ae0 | 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 | ..(else.(error."Unknown.request. |
| b3b00 | 2d 2d 20 4d 41 4b 45 2d 41 43 43 4f 55 4e 54 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --.MAKE-ACCOUNT"................ |
| b3b20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 64 69 | ...............m))))..........di |
| b3b40 | 73 70 61 74 63 68 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 75 73 65 20 74 68 69 73 20 74 6f 20 | spatch)).....We.can.use.this.to. |
| b3b60 | 64 6f 20 73 65 72 69 61 6c 69 7a 65 64 20 64 65 70 6f 73 69 74 73 20 61 6e 64 20 77 69 74 68 64 | do.serialized.deposits.and.withd |
| b3b80 | 72 61 77 61 6c 73 2e 20 20 48 6f 77 65 76 65 72 2c 0a 75 6e 6c 69 6b 65 20 6f 75 72 20 65 61 72 | rawals...However,.unlike.our.ear |
| b3ba0 | 6c 69 65 72 20 73 65 72 69 61 6c 69 7a 65 64 20 61 63 63 6f 75 6e 74 2c 20 69 74 20 69 73 20 6e | lier.serialized.account,.it.is.n |
| b3bc0 | 6f 77 20 74 68 65 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 20 6f 66 0a 65 61 63 68 20 75 73 | ow.the.responsibility.of.each.us |
| b3be0 | 65 72 20 6f 66 20 62 61 6e 6b 2d 61 63 63 6f 75 6e 74 20 6f 62 6a 65 63 74 73 20 74 6f 20 65 78 | er.of.bank-account.objects.to.ex |
| b3c00 | 70 6c 69 63 69 74 6c 79 20 6d 61 6e 61 67 65 20 74 68 65 0a 73 65 72 69 61 6c 69 7a 61 74 69 6f | plicitly.manage.the.serializatio |
| b3c20 | 6e 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 28 34 29 0a 0a 20 | n,.for.example.as.follows:(4)... |
| b3c40 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 70 6f 73 69 74 20 61 63 63 6f 75 6e 74 20 61 6d 6f | ....(define.(deposit.account.amo |
| b3c60 | 75 6e 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 20 28 61 63 63 6f 75 6e 74 20 27 73 | unt)........(let.((s.(account.'s |
| b3c80 | 65 72 69 61 6c 69 7a 65 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 20 28 61 63 63 | erializer))..............(d.(acc |
| b3ca0 | 6f 75 6e 74 20 27 64 65 70 6f 73 69 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 28 73 20 64 29 | ount.'deposit)))..........((s.d) |
| b3cc0 | 20 61 6d 6f 75 6e 74 29 29 29 0a 0a 20 20 20 45 78 70 6f 72 74 69 6e 67 20 74 68 65 20 73 65 72 | .amount))).....Exporting.the.ser |
| b3ce0 | 69 61 6c 69 7a 65 72 20 69 6e 20 74 68 69 73 20 77 61 79 20 67 69 76 65 73 20 75 73 20 65 6e 6f | ializer.in.this.way.gives.us.eno |
| b3d00 | 75 67 68 20 66 6c 65 78 69 62 69 6c 69 74 79 20 74 6f 0a 69 6d 70 6c 65 6d 65 6e 74 20 61 20 73 | ugh.flexibility.to.implement.a.s |
| b3d20 | 65 72 69 61 6c 69 7a 65 64 20 65 78 63 68 61 6e 67 65 20 70 72 6f 67 72 61 6d 2e 20 20 57 65 20 | erialized.exchange.program...We. |
| b3d40 | 73 69 6d 70 6c 79 20 73 65 72 69 61 6c 69 7a 65 20 74 68 65 0a 6f 72 69 67 69 6e 61 6c 20 60 65 | simply.serialize.the.original.`e |
| b3d60 | 78 63 68 61 6e 67 65 27 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 74 68 65 20 73 65 72 69 | xchange'.procedure.with.the.seri |
| b3d80 | 61 6c 69 7a 65 72 73 20 66 6f 72 20 62 6f 74 68 20 61 63 63 6f 75 6e 74 73 3a 0a 0a 20 20 20 20 | alizers.for.both.accounts:...... |
| b3da0 | 20 28 64 65 66 69 6e 65 20 28 73 65 72 69 61 6c 69 7a 65 64 2d 65 78 63 68 61 6e 67 65 20 61 63 | .(define.(serialized-exchange.ac |
| b3dc0 | 63 6f 75 6e 74 31 20 61 63 63 6f 75 6e 74 32 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 | count1.account2)........(let.((s |
| b3de0 | 65 72 69 61 6c 69 7a 65 72 31 20 28 61 63 63 6f 75 6e 74 31 20 27 73 65 72 69 61 6c 69 7a 65 72 | erializer1.(account1.'serializer |
| b3e00 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 72 69 61 6c 69 7a 65 72 32 20 28 61 63 | ))..............(serializer2.(ac |
| b3e20 | 63 6f 75 6e 74 32 20 27 73 65 72 69 61 6c 69 7a 65 72 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 | count2.'serializer)))..........( |
| b3e40 | 28 73 65 72 69 61 6c 69 7a 65 72 31 20 28 73 65 72 69 61 6c 69 7a 65 72 32 20 65 78 63 68 61 6e | (serializer1.(serializer2.exchan |
| b3e60 | 67 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 61 63 63 6f 75 6e 74 31 0a 20 20 20 20 20 20 20 20 | ge))...........account1......... |
| b3e80 | 20 20 61 63 63 6f 75 6e 74 32 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e | ..account2))).......*Exercise.3. |
| b3ea0 | 34 33 3a 2a 20 53 75 70 70 6f 73 65 20 74 68 61 74 20 74 68 65 20 62 61 6c 61 6e 63 65 73 20 69 | 43:*.Suppose.that.the.balances.i |
| b3ec0 | 6e 20 74 68 72 65 65 20 61 63 63 6f 75 6e 74 73 20 73 74 61 72 74 0a 20 20 20 20 20 6f 75 74 20 | n.three.accounts.start......out. |
| b3ee0 | 61 73 20 24 31 30 2c 20 24 32 30 2c 20 61 6e 64 20 24 33 30 2c 20 61 6e 64 20 74 68 61 74 20 6d | as.$10,.$20,.and.$30,.and.that.m |
| b3f00 | 75 6c 74 69 70 6c 65 20 70 72 6f 63 65 73 73 65 73 20 72 75 6e 2c 0a 20 20 20 20 20 65 78 63 68 | ultiple.processes.run,......exch |
| b3f20 | 61 6e 67 69 6e 67 20 74 68 65 20 62 61 6c 61 6e 63 65 73 20 69 6e 20 74 68 65 20 61 63 63 6f 75 | anging.the.balances.in.the.accou |
| b3f40 | 6e 74 73 2e 20 20 41 72 67 75 65 20 74 68 61 74 20 69 66 20 74 68 65 0a 20 20 20 20 20 70 72 6f | nts...Argue.that.if.the......pro |
| b3f60 | 63 65 73 73 65 73 20 61 72 65 20 72 75 6e 20 73 65 71 75 65 6e 74 69 61 6c 6c 79 2c 20 61 66 74 | cesses.are.run.sequentially,.aft |
| b3f80 | 65 72 20 61 6e 79 20 6e 75 6d 62 65 72 20 6f 66 20 63 6f 6e 63 75 72 72 65 6e 74 0a 20 20 20 20 | er.any.number.of.concurrent..... |
| b3fa0 | 20 65 78 63 68 61 6e 67 65 73 2c 20 74 68 65 20 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e 63 65 73 | .exchanges,.the.account.balances |
| b3fc0 | 20 73 68 6f 75 6c 64 20 62 65 20 24 31 30 2c 20 24 32 30 2c 20 61 6e 64 20 24 33 30 20 69 6e 0a | .should.be.$10,.$20,.and.$30.in. |
| b3fe0 | 20 20 20 20 20 73 6f 6d 65 20 6f 72 64 65 72 2e 20 20 44 72 61 77 20 61 20 74 69 6d 69 6e 67 20 | .....some.order...Draw.a.timing. |
| b4000 | 64 69 61 67 72 61 6d 20 6c 69 6b 65 20 74 68 65 20 6f 6e 65 20 69 6e 20 2a 4e 6f 74 65 20 46 69 | diagram.like.the.one.in.*Note.Fi |
| b4020 | 67 75 72 65 0a 20 20 20 20 20 33 2d 32 39 3a 3a 20 74 6f 20 73 68 6f 77 20 68 6f 77 20 74 68 69 | gure......3-29::.to.show.how.thi |
| b4040 | 73 20 63 6f 6e 64 69 74 69 6f 6e 20 63 61 6e 20 62 65 20 76 69 6f 6c 61 74 65 64 20 69 66 20 74 | s.condition.can.be.violated.if.t |
| b4060 | 68 65 20 65 78 63 68 61 6e 67 65 73 0a 20 20 20 20 20 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 | he.exchanges......are.implemente |
| b4080 | 64 20 75 73 69 6e 67 20 74 68 65 20 66 69 72 73 74 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 | d.using.the.first.version.of.the |
| b40a0 | 20 61 63 63 6f 75 6e 74 2d 65 78 63 68 61 6e 67 65 0a 20 20 20 20 20 70 72 6f 67 72 61 6d 20 69 | .account-exchange......program.i |
| b40c0 | 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 | n.this.section...On.the.other.ha |
| b40e0 | 6e 64 2c 20 61 72 67 75 65 20 74 68 61 74 20 65 76 65 6e 20 77 69 74 68 0a 20 20 20 20 20 74 68 | nd,.argue.that.even.with......th |
| b4100 | 69 73 20 60 65 78 63 68 61 6e 67 65 27 20 70 72 6f 67 72 61 6d 2c 20 74 68 65 20 73 75 6d 20 6f | is.`exchange'.program,.the.sum.o |
| b4120 | 66 20 74 68 65 20 62 61 6c 61 6e 63 65 73 20 69 6e 20 74 68 65 20 61 63 63 6f 75 6e 74 73 0a 20 | f.the.balances.in.the.accounts.. |
| b4140 | 20 20 20 20 77 69 6c 6c 20 62 65 20 70 72 65 73 65 72 76 65 64 2e 20 20 44 72 61 77 20 61 20 74 | ....will.be.preserved...Draw.a.t |
| b4160 | 69 6d 69 6e 67 20 64 69 61 67 72 61 6d 20 74 6f 20 73 68 6f 77 20 68 6f 77 20 65 76 65 6e 20 74 | iming.diagram.to.show.how.even.t |
| b4180 | 68 69 73 0a 20 20 20 20 20 63 6f 6e 64 69 74 69 6f 6e 20 77 6f 75 6c 64 20 62 65 20 76 69 6f 6c | his......condition.would.be.viol |
| b41a0 | 61 74 65 64 20 69 66 20 77 65 20 64 69 64 20 6e 6f 74 20 73 65 72 69 61 6c 69 7a 65 20 74 68 65 | ated.if.we.did.not.serialize.the |
| b41c0 | 0a 20 20 20 20 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 20 6f 6e 20 69 6e 64 69 76 69 64 75 61 6c | ......transactions.on.individual |
| b41e0 | 20 61 63 63 6f 75 6e 74 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 34 34 3a | .accounts........*Exercise.3.44: |
| b4200 | 2a 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 74 72 61 6e 73 66 | *.Consider.the.problem.of.transf |
| b4220 | 65 72 72 69 6e 67 20 61 6e 20 61 6d 6f 75 6e 74 0a 20 20 20 20 20 66 72 6f 6d 20 6f 6e 65 20 61 | erring.an.amount......from.one.a |
| b4240 | 63 63 6f 75 6e 74 20 74 6f 20 61 6e 6f 74 68 65 72 2e 20 20 42 65 6e 20 42 69 74 64 69 64 64 6c | ccount.to.another...Ben.Bitdiddl |
| b4260 | 65 20 63 6c 61 69 6d 73 20 74 68 61 74 20 74 68 69 73 20 63 61 6e 0a 20 20 20 20 20 62 65 20 61 | e.claims.that.this.can......be.a |
| b4280 | 63 63 6f 6d 70 6c 69 73 68 65 64 20 77 69 74 68 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 | ccomplished.with.the.following.p |
| b42a0 | 72 6f 63 65 64 75 72 65 2c 20 65 76 65 6e 20 69 66 20 74 68 65 72 65 20 61 72 65 0a 20 20 20 20 | rocedure,.even.if.there.are..... |
| b42c0 | 20 6d 75 6c 74 69 70 6c 65 20 70 65 6f 70 6c 65 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 20 74 72 | .multiple.people.concurrently.tr |
| b42e0 | 61 6e 73 66 65 72 72 69 6e 67 20 6d 6f 6e 65 79 20 61 6d 6f 6e 67 20 6d 75 6c 74 69 70 6c 65 0a | ansferring.money.among.multiple. |
| b4300 | 20 20 20 20 20 61 63 63 6f 75 6e 74 73 2c 20 75 73 69 6e 67 20 61 6e 79 20 61 63 63 6f 75 6e 74 | .....accounts,.using.any.account |
| b4320 | 20 6d 65 63 68 61 6e 69 73 6d 20 74 68 61 74 20 73 65 72 69 61 6c 69 7a 65 73 20 64 65 70 6f 73 | .mechanism.that.serializes.depos |
| b4340 | 69 74 20 61 6e 64 0a 20 20 20 20 20 77 69 74 68 64 72 61 77 61 6c 20 74 72 61 6e 73 61 63 74 69 | it.and......withdrawal.transacti |
| b4360 | 6f 6e 73 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 76 65 72 73 69 6f 6e 20 6f 66 | ons,.for.example,.the.version.of |
| b4380 | 0a 20 20 20 20 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 69 6e 20 74 68 65 20 74 65 78 74 | ......`make-account'.in.the.text |
| b43a0 | 20 61 62 6f 76 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 61 6e | .above.............(define.(tran |
| b43c0 | 73 66 65 72 20 66 72 6f 6d 2d 61 63 63 6f 75 6e 74 20 74 6f 2d 61 63 63 6f 75 6e 74 20 61 6d 6f | sfer.from-account.to-account.amo |
| b43e0 | 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 28 66 72 6f 6d 2d 61 63 63 6f 75 6e 74 20 | unt).............((from-account. |
| b4400 | 27 77 69 74 68 64 72 61 77 29 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | 'withdraw).amount).............( |
| b4420 | 28 74 6f 2d 61 63 63 6f 75 6e 74 20 27 64 65 70 6f 73 69 74 29 20 61 6d 6f 75 6e 74 29 29 0a 0a | (to-account.'deposit).amount)).. |
| b4440 | 20 20 20 20 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 20 63 6c 61 69 6d 73 20 74 68 61 74 20 | .....Louis.Reasoner.claims.that. |
| b4460 | 74 68 65 72 65 20 69 73 20 61 20 70 72 6f 62 6c 65 6d 20 68 65 72 65 2c 20 61 6e 64 20 74 68 61 | there.is.a.problem.here,.and.tha |
| b4480 | 74 20 77 65 0a 20 20 20 20 20 6e 65 65 64 20 74 6f 20 75 73 65 20 61 20 6d 6f 72 65 20 73 6f 70 | t.we......need.to.use.a.more.sop |
| b44a0 | 68 69 73 74 69 63 61 74 65 64 20 6d 65 74 68 6f 64 2c 20 73 75 63 68 20 61 73 20 74 68 65 20 6f | histicated.method,.such.as.the.o |
| b44c0 | 6e 65 20 72 65 71 75 69 72 65 64 0a 20 20 20 20 20 66 6f 72 20 64 65 61 6c 69 6e 67 20 77 69 74 | ne.required......for.dealing.wit |
| b44e0 | 68 20 74 68 65 20 65 78 63 68 61 6e 67 65 20 70 72 6f 62 6c 65 6d 2e 20 20 49 73 20 4c 6f 75 69 | h.the.exchange.problem...Is.Loui |
| b4500 | 73 20 72 69 67 68 74 3f 20 20 49 66 20 6e 6f 74 2c 0a 20 20 20 20 20 77 68 61 74 20 69 73 20 74 | s.right?..If.not,......what.is.t |
| b4520 | 68 65 20 65 73 73 65 6e 74 69 61 6c 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 | he.essential.difference.between. |
| b4540 | 74 68 65 20 74 72 61 6e 73 66 65 72 20 70 72 6f 62 6c 65 6d 20 61 6e 64 0a 20 20 20 20 20 74 68 | the.transfer.problem.and......th |
| b4560 | 65 20 65 78 63 68 61 6e 67 65 20 70 72 6f 62 6c 65 6d 3f 20 20 28 59 6f 75 20 73 68 6f 75 6c 64 | e.exchange.problem?..(You.should |
| b4580 | 20 61 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 20 62 61 6c 61 6e 63 65 20 69 6e 0a 20 20 20 20 | .assume.that.the.balance.in..... |
| b45a0 | 20 60 66 72 6f 6d 2d 61 63 63 6f 75 6e 74 27 20 69 73 20 61 74 20 6c 65 61 73 74 20 60 61 6d 6f | .`from-account'.is.at.least.`amo |
| b45c0 | 75 6e 74 27 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 34 35 3a 2a 20 4c 6f | unt'.).......*Exercise.3.45:*.Lo |
| b45e0 | 75 69 73 20 52 65 61 73 6f 6e 65 72 20 74 68 69 6e 6b 73 20 6f 75 72 20 62 61 6e 6b 2d 61 63 63 | uis.Reasoner.thinks.our.bank-acc |
| b4600 | 6f 75 6e 74 20 73 79 73 74 65 6d 20 69 73 0a 20 20 20 20 20 75 6e 6e 65 63 65 73 73 61 72 69 6c | ount.system.is......unnecessaril |
| b4620 | 79 20 63 6f 6d 70 6c 65 78 20 61 6e 64 20 65 72 72 6f 72 2d 70 72 6f 6e 65 20 6e 6f 77 20 74 68 | y.complex.and.error-prone.now.th |
| b4640 | 61 74 20 64 65 70 6f 73 69 74 73 20 61 6e 64 0a 20 20 20 20 20 77 69 74 68 64 72 61 77 61 6c 73 | at.deposits.and......withdrawals |
| b4660 | 20 61 72 65 6e 27 74 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73 65 72 69 61 6c 69 7a 65 64 | .aren't.automatically.serialized |
| b4680 | 2e 20 20 48 65 20 73 75 67 67 65 73 74 73 20 74 68 61 74 0a 20 20 20 20 20 60 6d 61 6b 65 2d 61 | ...He.suggests.that......`make-a |
| b46a0 | 63 63 6f 75 6e 74 2d 61 6e 64 2d 73 65 72 69 61 6c 69 7a 65 72 27 20 73 68 6f 75 6c 64 20 68 61 | ccount-and-serializer'.should.ha |
| b46c0 | 76 65 20 65 78 70 6f 72 74 65 64 20 74 68 65 20 73 65 72 69 61 6c 69 7a 65 72 0a 20 20 20 20 20 | ve.exported.the.serializer...... |
| b46e0 | 28 66 6f 72 20 75 73 65 20 62 79 20 73 75 63 68 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 60 | (for.use.by.such.procedures.as.` |
| b4700 | 73 65 72 69 61 6c 69 7a 65 64 2d 65 78 63 68 61 6e 67 65 27 29 20 69 6e 20 61 64 64 69 74 69 6f | serialized-exchange').in.additio |
| b4720 | 6e 0a 20 20 20 20 20 74 6f 20 28 72 61 74 68 65 72 20 74 68 61 6e 20 69 6e 73 74 65 61 64 20 6f | n......to.(rather.than.instead.o |
| b4740 | 66 29 20 75 73 69 6e 67 20 69 74 20 74 6f 20 73 65 72 69 61 6c 69 7a 65 20 61 63 63 6f 75 6e 74 | f).using.it.to.serialize.account |
| b4760 | 73 20 61 6e 64 0a 20 20 20 20 20 64 65 70 6f 73 69 74 73 20 61 73 20 60 6d 61 6b 65 2d 61 63 63 | s.and......deposits.as.`make-acc |
| b4780 | 6f 75 6e 74 27 20 64 69 64 2e 20 20 48 65 20 70 72 6f 70 6f 73 65 73 20 74 6f 20 72 65 64 65 66 | ount'.did...He.proposes.to.redef |
| b47a0 | 69 6e 65 20 61 63 63 6f 75 6e 74 73 0a 20 20 20 20 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 | ine.accounts......as.follows:... |
| b47c0 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 2d 61 | .........(define.(make-account-a |
| b47e0 | 6e 64 2d 73 65 72 69 61 6c 69 7a 65 72 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 | nd-serializer.balance).......... |
| b4800 | 20 20 20 28 64 65 66 69 6e 65 20 28 77 69 74 68 64 72 61 77 20 61 6d 6f 75 6e 74 29 0a 20 20 20 | ...(define.(withdraw.amount).... |
| b4820 | 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 3d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e | ...........(if.(>=.balance.amoun |
| b4840 | 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 | t)...................(begin.(set |
| b4860 | 21 20 62 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 | !.balance.(-.balance.amount))... |
| b4880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a | .......................balance). |
| b48a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 49 6e 73 75 66 66 69 63 69 65 6e 74 20 | .................."Insufficient. |
| b48c0 | 66 75 6e 64 73 22 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 | funds")).............(define.(de |
| b48e0 | 70 6f 73 69 74 20 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 | posit.amount)...............(set |
| b4900 | 21 20 62 61 6c 61 6e 63 65 20 28 2b 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 | !.balance.(+.balance.amount))... |
| b4920 | 20 20 20 20 20 20 20 20 20 20 20 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ............balance)............ |
| b4940 | 20 28 6c 65 74 20 28 28 62 61 6c 61 6e 63 65 2d 73 65 72 69 61 6c 69 7a 65 72 20 28 6d 61 6b 65 | .(let.((balance-serializer.(make |
| b4960 | 2d 73 65 72 69 61 6c 69 7a 65 72 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 | -serializer)))...............(de |
| b4980 | 66 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | fine.(dispatch.m)............... |
| b49a0 | 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6d 20 27 77 69 74 68 64 72 61 77 29 20 28 62 61 6c 61 | ..(cond.((eq?.m.'withdraw).(bala |
| b49c0 | 6e 63 65 2d 73 65 72 69 61 6c 69 7a 65 72 20 77 69 74 68 64 72 61 77 29 29 0a 20 20 20 20 20 20 | nce-serializer.withdraw))....... |
| b49e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 64 65 70 6f 73 69 74 | ................((eq?.m.'deposit |
| b4a00 | 29 20 28 62 61 6c 61 6e 63 65 2d 73 65 72 69 61 6c 69 7a 65 72 20 64 65 70 6f 73 69 74 29 29 0a | ).(balance-serializer.deposit)). |
| b4a20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 62 | ......................((eq?.m.'b |
| b4a40 | 61 6c 61 6e 63 65 29 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | alance).balance)................ |
| b4a60 | 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 20 27 73 65 72 69 61 6c 69 7a 65 72 29 20 62 61 6c 61 | .......((eq?.m.'serializer).bala |
| b4a80 | 6e 63 65 2d 73 65 72 69 61 6c 69 7a 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | nce-serializer)................. |
| b4aa0 | 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 | ......(else.(error."Unknown.requ |
| b4ac0 | 65 73 74 20 2d 2d 20 4d 41 4b 45 2d 41 43 43 4f 55 4e 54 22 0a 20 20 20 20 20 20 20 20 20 20 20 | est.--.MAKE-ACCOUNT"............ |
| b4ae0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 29 29 29 29 0a 20 20 | ........................m))))... |
| b4b00 | 20 20 20 20 20 20 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 29 0a 0a 20 20 20 20 20 54 68 65 | ............dispatch)).......The |
| b4b20 | 6e 20 64 65 70 6f 73 69 74 73 20 61 72 65 20 68 61 6e 64 6c 65 64 20 61 73 20 77 69 74 68 20 74 | n.deposits.are.handled.as.with.t |
| b4b40 | 68 65 20 6f 72 69 67 69 6e 61 6c 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 3a 0a 0a 20 20 20 | he.original.`make-account':..... |
| b4b60 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 70 6f 73 69 74 20 61 63 63 6f 75 6e 74 20 | .......(define.(deposit.account. |
| b4b80 | 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 28 61 63 63 6f 75 6e 74 20 27 64 65 | amount)............((account.'de |
| b4ba0 | 70 6f 73 69 74 29 20 61 6d 6f 75 6e 74 29 29 0a 0a 20 20 20 20 20 45 78 70 6c 61 69 6e 20 77 68 | posit).amount)).......Explain.wh |
| b4bc0 | 61 74 20 69 73 20 77 72 6f 6e 67 20 77 69 74 68 20 4c 6f 75 69 73 27 73 20 72 65 61 73 6f 6e 69 | at.is.wrong.with.Louis's.reasoni |
| b4be0 | 6e 67 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 0a 20 20 20 20 20 63 6f 6e 73 69 64 65 | ng...In.particular,......conside |
| b4c00 | 72 20 77 68 61 74 20 68 61 70 70 65 6e 73 20 77 68 65 6e 20 60 73 65 72 69 61 6c 69 7a 65 64 2d | r.what.happens.when.`serialized- |
| b4c20 | 65 78 63 68 61 6e 67 65 27 20 69 73 20 63 61 6c 6c 65 64 2e 0a 0a 49 6d 70 6c 65 6d 65 6e 74 69 | exchange'.is.called...Implementi |
| b4c40 | 6e 67 20 73 65 72 69 61 6c 69 7a 65 72 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ng.serializers.................. |
| b4c60 | 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 20 69 6d 70 6c 65 6d 65 6e 74 20 73 65 72 69 61 6c 69 7a 65 72 | .........We.implement.serializer |
| b4c80 | 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 61 20 6d 6f 72 65 20 70 72 69 6d 69 74 69 76 65 20 73 | s.in.terms.of.a.more.primitive.s |
| b4ca0 | 79 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 0a 6d 65 63 68 61 6e 69 73 6d 20 63 61 6c 6c 65 64 20 | ynchronization.mechanism.called. |
| b4cc0 | 61 20 22 6d 75 74 65 78 22 2e 20 20 41 20 6d 75 74 65 78 20 69 73 20 61 6e 20 6f 62 6a 65 63 74 | a."mutex"...A.mutex.is.an.object |
| b4ce0 | 20 74 68 61 74 20 73 75 70 70 6f 72 74 73 20 74 77 6f 0a 6f 70 65 72 61 74 69 6f 6e 73 2d 2d 74 | .that.supports.two.operations--t |
| b4d00 | 68 65 20 6d 75 74 65 78 20 63 61 6e 20 62 65 20 22 61 63 71 75 69 72 65 64 22 2c 20 61 6e 64 20 | he.mutex.can.be."acquired",.and. |
| b4d20 | 74 68 65 20 6d 75 74 65 78 20 63 61 6e 20 62 65 20 22 72 65 6c 65 61 73 65 64 22 2e 0a 4f 6e 63 | the.mutex.can.be."released"..Onc |
| b4d40 | 65 20 61 20 6d 75 74 65 78 20 68 61 73 20 62 65 65 6e 20 61 63 71 75 69 72 65 64 2c 20 6e 6f 20 | e.a.mutex.has.been.acquired,.no. |
| b4d60 | 6f 74 68 65 72 20 61 63 71 75 69 72 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 74 68 61 74 | other.acquire.operations.on.that |
| b4d80 | 0a 6d 75 74 65 78 20 6d 61 79 20 70 72 6f 63 65 65 64 20 75 6e 74 69 6c 20 74 68 65 20 6d 75 74 | .mutex.may.proceed.until.the.mut |
| b4da0 | 65 78 20 69 73 20 72 65 6c 65 61 73 65 64 2e 28 35 29 20 49 6e 20 6f 75 72 0a 69 6d 70 6c 65 6d | ex.is.released.(5).In.our.implem |
| b4dc0 | 65 6e 74 61 74 69 6f 6e 2c 20 65 61 63 68 20 73 65 72 69 61 6c 69 7a 65 72 20 68 61 73 20 61 6e | entation,.each.serializer.has.an |
| b4de0 | 20 61 73 73 6f 63 69 61 74 65 64 20 6d 75 74 65 78 2e 20 20 47 69 76 65 6e 20 61 0a 70 72 6f 63 | .associated.mutex...Given.a.proc |
| b4e00 | 65 64 75 72 65 20 60 70 27 2c 20 74 68 65 20 73 65 72 69 61 6c 69 7a 65 72 20 72 65 74 75 72 6e | edure.`p',.the.serializer.return |
| b4e20 | 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 61 63 71 75 69 72 65 73 20 74 68 65 0a | s.a.procedure.that.acquires.the. |
| b4e40 | 6d 75 74 65 78 2c 20 72 75 6e 73 20 60 70 27 2c 20 61 6e 64 20 74 68 65 6e 20 72 65 6c 65 61 73 | mutex,.runs.`p',.and.then.releas |
| b4e60 | 65 73 20 74 68 65 20 6d 75 74 65 78 2e 20 20 54 68 69 73 20 65 6e 73 75 72 65 73 20 74 68 61 74 | es.the.mutex...This.ensures.that |
| b4e80 | 20 6f 6e 6c 79 0a 6f 6e 65 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 70 72 6f 64 | .only.one.of.the.procedures.prod |
| b4ea0 | 75 63 65 64 20 62 79 20 74 68 65 20 73 65 72 69 61 6c 69 7a 65 72 20 63 61 6e 20 62 65 20 72 75 | uced.by.the.serializer.can.be.ru |
| b4ec0 | 6e 6e 69 6e 67 20 61 74 0a 6f 6e 63 65 2c 20 77 68 69 63 68 20 69 73 20 70 72 65 63 69 73 65 6c | nning.at.once,.which.is.precisel |
| b4ee0 | 79 20 74 68 65 20 73 65 72 69 61 6c 69 7a 61 74 69 6f 6e 20 70 72 6f 70 65 72 74 79 20 74 68 61 | y.the.serialization.property.tha |
| b4f00 | 74 20 77 65 20 6e 65 65 64 20 74 6f 0a 67 75 61 72 61 6e 74 65 65 2e 0a 0a 20 20 20 20 20 28 64 | t.we.need.to.guarantee........(d |
| b4f20 | 65 66 69 6e 65 20 28 6d 61 6b 65 2d 73 65 72 69 61 6c 69 7a 65 72 29 0a 20 20 20 20 20 20 20 28 | efine.(make-serializer)........( |
| b4f40 | 6c 65 74 20 28 28 6d 75 74 65 78 20 28 6d 61 6b 65 2d 6d 75 74 65 78 29 29 29 0a 20 20 20 20 20 | let.((mutex.(make-mutex)))...... |
| b4f60 | 20 20 20 20 28 6c 61 6d 62 64 61 20 28 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 | ....(lambda.(p)............(defi |
| b4f80 | 6e 65 20 28 73 65 72 69 61 6c 69 7a 65 64 2d 70 20 2e 20 61 72 67 73 29 0a 20 20 20 20 20 20 20 | ne.(serialized-p...args)........ |
| b4fa0 | 20 20 20 20 20 20 28 6d 75 74 65 78 20 27 61 63 71 75 69 72 65 29 0a 20 20 20 20 20 20 20 20 20 | ......(mutex.'acquire).......... |
| b4fc0 | 20 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28 61 70 70 6c 79 20 70 20 61 72 67 73 29 29 29 0a | ....(let.((val.(apply.p.args))). |
| b4fe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 75 74 65 78 20 27 72 65 6c 65 61 73 65 29 0a | ...............(mutex.'release). |
| b5000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ...............val))............ |
| b5020 | 73 65 72 69 61 6c 69 7a 65 64 2d 70 29 29 29 0a 0a 20 20 20 54 68 65 20 6d 75 74 65 78 20 69 73 | serialized-p))).....The.mutex.is |
| b5040 | 20 61 20 6d 75 74 61 62 6c 65 20 6f 62 6a 65 63 74 20 28 68 65 72 65 20 77 65 27 6c 6c 20 75 73 | .a.mutable.object.(here.we'll.us |
| b5060 | 65 20 61 20 6f 6e 65 2d 65 6c 65 6d 65 6e 74 20 6c 69 73 74 2c 0a 77 68 69 63 68 20 77 65 27 6c | e.a.one-element.list,.which.we'l |
| b5080 | 6c 20 72 65 66 65 72 20 74 6f 20 61 73 20 61 20 22 63 65 6c 6c 22 29 20 74 68 61 74 20 63 61 6e | l.refer.to.as.a."cell").that.can |
| b50a0 | 20 68 6f 6c 64 20 74 68 65 20 76 61 6c 75 65 20 74 72 75 65 20 6f 72 0a 66 61 6c 73 65 2e 20 20 | .hold.the.value.true.or.false... |
| b50c0 | 57 68 65 6e 20 74 68 65 20 76 61 6c 75 65 20 69 73 20 66 61 6c 73 65 2c 20 74 68 65 20 6d 75 74 | When.the.value.is.false,.the.mut |
| b50e0 | 65 78 20 69 73 20 61 76 61 69 6c 61 62 6c 65 20 74 6f 20 62 65 20 61 63 71 75 69 72 65 64 2e 0a | ex.is.available.to.be.acquired.. |
| b5100 | 57 68 65 6e 20 74 68 65 20 76 61 6c 75 65 20 69 73 20 74 72 75 65 2c 20 74 68 65 20 6d 75 74 65 | When.the.value.is.true,.the.mute |
| b5120 | 78 20 69 73 20 75 6e 61 76 61 69 6c 61 62 6c 65 2c 20 61 6e 64 20 61 6e 79 20 70 72 6f 63 65 73 | x.is.unavailable,.and.any.proces |
| b5140 | 73 20 74 68 61 74 0a 61 74 74 65 6d 70 74 73 20 74 6f 20 61 63 71 75 69 72 65 20 74 68 65 20 6d | s.that.attempts.to.acquire.the.m |
| b5160 | 75 74 65 78 20 6d 75 73 74 20 77 61 69 74 2e 0a 0a 20 20 20 4f 75 72 20 6d 75 74 65 78 20 63 6f | utex.must.wait......Our.mutex.co |
| b5180 | 6e 73 74 72 75 63 74 6f 72 20 60 6d 61 6b 65 2d 6d 75 74 65 78 27 20 62 65 67 69 6e 73 20 62 79 | nstructor.`make-mutex'.begins.by |
| b51a0 | 20 69 6e 69 74 69 61 6c 69 7a 69 6e 67 20 74 68 65 20 63 65 6c 6c 0a 63 6f 6e 74 65 6e 74 73 20 | .initializing.the.cell.contents. |
| b51c0 | 74 6f 20 66 61 6c 73 65 2e 20 20 54 6f 20 61 63 71 75 69 72 65 20 74 68 65 20 6d 75 74 65 78 2c | to.false...To.acquire.the.mutex, |
| b51e0 | 20 77 65 20 74 65 73 74 20 74 68 65 20 63 65 6c 6c 2e 20 20 49 66 20 74 68 65 0a 6d 75 74 65 78 | .we.test.the.cell...If.the.mutex |
| b5200 | 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c 20 77 65 20 73 65 74 20 74 68 65 20 63 65 6c 6c 20 63 | .is.available,.we.set.the.cell.c |
| b5220 | 6f 6e 74 65 6e 74 73 20 74 6f 20 74 72 75 65 20 61 6e 64 20 70 72 6f 63 65 65 64 2e 0a 4f 74 68 | ontents.to.true.and.proceed..Oth |
| b5240 | 65 72 77 69 73 65 2c 20 77 65 20 77 61 69 74 20 69 6e 20 61 20 6c 6f 6f 70 2c 20 61 74 74 65 6d | erwise,.we.wait.in.a.loop,.attem |
| b5260 | 70 74 69 6e 67 20 74 6f 20 61 63 71 75 69 72 65 20 6f 76 65 72 20 61 6e 64 20 6f 76 65 72 0a 61 | pting.to.acquire.over.and.over.a |
| b5280 | 67 61 69 6e 2c 20 75 6e 74 69 6c 20 77 65 20 66 69 6e 64 20 74 68 61 74 20 74 68 65 20 6d 75 74 | gain,.until.we.find.that.the.mut |
| b52a0 | 65 78 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2e 28 36 29 20 20 54 6f 20 72 65 6c 65 61 73 65 20 | ex.is.available.(6)..To.release. |
| b52c0 | 74 68 65 0a 6d 75 74 65 78 2c 20 77 65 20 73 65 74 20 74 68 65 20 63 65 6c 6c 20 63 6f 6e 74 65 | the.mutex,.we.set.the.cell.conte |
| b52e0 | 6e 74 73 20 74 6f 20 66 61 6c 73 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b | nts.to.false........(define.(mak |
| b5300 | 65 2d 6d 75 74 65 78 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 65 6c 6c 20 28 6c 69 73 | e-mutex)........(let.((cell.(lis |
| b5320 | 74 20 66 61 6c 73 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 68 65 | t.false)))..........(define.(the |
| b5340 | 2d 6d 75 74 65 78 20 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f | -mutex.m)............(cond.((eq? |
| b5360 | 20 6d 20 27 61 63 71 75 69 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .m.'acquire)...................( |
| b5380 | 69 66 20 28 74 65 73 74 2d 61 6e 64 2d 73 65 74 21 20 63 65 6c 6c 29 0a 20 20 20 20 20 20 20 20 | if.(test-and-set!.cell)......... |
| b53a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 68 65 2d 6d 75 74 65 78 20 27 61 63 71 75 69 72 | ..............(the-mutex.'acquir |
| b53c0 | 65 29 29 29 20 3b 20 72 65 74 72 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | e))).;.retry..................(( |
| b53e0 | 65 71 3f 20 6d 20 27 72 65 6c 65 61 73 65 29 20 28 63 6c 65 61 72 21 20 63 65 6c 6c 29 29 29 29 | eq?.m.'release).(clear!.cell)))) |
| b5400 | 0a 20 20 20 20 20 20 20 20 20 74 68 65 2d 6d 75 74 65 78 29 29 0a 0a 20 20 20 20 20 28 64 65 66 | ..........the-mutex)).......(def |
| b5420 | 69 6e 65 20 28 63 6c 65 61 72 21 20 63 65 6c 6c 29 0a 20 20 20 20 20 20 20 28 73 65 74 2d 63 61 | ine.(clear!.cell)........(set-ca |
| b5440 | 72 21 20 63 65 6c 6c 20 66 61 6c 73 65 29 29 0a 0a 20 20 20 60 54 65 73 74 2d 61 6e 64 2d 73 65 | r!.cell.false)).....`Test-and-se |
| b5460 | 74 21 27 20 74 65 73 74 73 20 74 68 65 20 63 65 6c 6c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 | t!'.tests.the.cell.and.returns.t |
| b5480 | 68 65 20 72 65 73 75 6c 74 20 6f 66 20 74 68 65 20 74 65 73 74 2e 0a 49 6e 20 61 64 64 69 74 69 | he.result.of.the.test..In.additi |
| b54a0 | 6f 6e 2c 20 69 66 20 74 68 65 20 74 65 73 74 20 77 61 73 20 66 61 6c 73 65 2c 20 60 74 65 73 74 | on,.if.the.test.was.false,.`test |
| b54c0 | 2d 61 6e 64 2d 73 65 74 21 27 20 73 65 74 73 20 74 68 65 20 63 65 6c 6c 0a 63 6f 6e 74 65 6e 74 | -and-set!'.sets.the.cell.content |
| b54e0 | 73 20 74 6f 20 74 72 75 65 20 62 65 66 6f 72 65 20 72 65 74 75 72 6e 69 6e 67 20 66 61 6c 73 65 | s.to.true.before.returning.false |
| b5500 | 2e 20 20 57 65 20 63 61 6e 20 65 78 70 72 65 73 73 20 74 68 69 73 20 62 65 68 61 76 69 6f 72 0a | ...We.can.express.this.behavior. |
| b5520 | 61 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 | as.the.following.procedure:..... |
| b5540 | 20 20 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d 61 6e 64 2d 73 65 74 21 20 63 65 6c 6c 29 0a 20 | ..(define.(test-and-set!.cell).. |
| b5560 | 20 20 20 20 20 20 28 69 66 20 28 63 61 72 20 63 65 6c 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ......(if.(car.cell)............ |
| b5580 | 74 72 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 73 65 74 2d 63 61 72 21 | true............(begin.(set-car! |
| b55a0 | 20 63 65 6c 6c 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 | .cell.true)...................fa |
| b55c0 | 6c 73 65 29 29 29 0a 0a 20 20 20 48 6f 77 65 76 65 72 2c 20 74 68 69 73 20 69 6d 70 6c 65 6d 65 | lse))).....However,.this.impleme |
| b55e0 | 6e 74 61 74 69 6f 6e 20 6f 66 20 60 74 65 73 74 2d 61 6e 64 2d 73 65 74 21 27 20 64 6f 65 73 20 | ntation.of.`test-and-set!'.does. |
| b5600 | 6e 6f 74 20 73 75 66 66 69 63 65 20 61 73 0a 69 74 20 73 74 61 6e 64 73 2e 20 20 54 68 65 72 65 | not.suffice.as.it.stands...There |
| b5620 | 20 69 73 20 61 20 63 72 75 63 69 61 6c 20 73 75 62 74 6c 65 74 79 20 68 65 72 65 2c 20 77 68 69 | .is.a.crucial.subtlety.here,.whi |
| b5640 | 63 68 20 69 73 20 74 68 65 20 65 73 73 65 6e 74 69 61 6c 0a 70 6c 61 63 65 20 77 68 65 72 65 20 | ch.is.the.essential.place.where. |
| b5660 | 63 6f 6e 63 75 72 72 65 6e 63 79 20 63 6f 6e 74 72 6f 6c 20 65 6e 74 65 72 73 20 74 68 65 20 73 | concurrency.control.enters.the.s |
| b5680 | 79 73 74 65 6d 3a 20 54 68 65 20 60 74 65 73 74 2d 61 6e 64 2d 73 65 74 21 27 0a 6f 70 65 72 61 | ystem:.The.`test-and-set!'.opera |
| b56a0 | 74 69 6f 6e 20 6d 75 73 74 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 22 61 74 6f 6d 69 63 61 6c | tion.must.be.performed."atomical |
| b56c0 | 6c 79 22 2e 20 20 54 68 61 74 20 69 73 2c 20 77 65 20 6d 75 73 74 20 67 75 61 72 61 6e 74 65 65 | ly"...That.is,.we.must.guarantee |
| b56e0 | 0a 74 68 61 74 2c 20 6f 6e 63 65 20 61 20 70 72 6f 63 65 73 73 20 68 61 73 20 74 65 73 74 65 64 | .that,.once.a.process.has.tested |
| b5700 | 20 74 68 65 20 63 65 6c 6c 20 61 6e 64 20 66 6f 75 6e 64 20 69 74 20 74 6f 20 62 65 20 66 61 6c | .the.cell.and.found.it.to.be.fal |
| b5720 | 73 65 2c 20 74 68 65 0a 63 65 6c 6c 20 63 6f 6e 74 65 6e 74 73 20 77 69 6c 6c 20 61 63 74 75 61 | se,.the.cell.contents.will.actua |
| b5740 | 6c 6c 79 20 62 65 20 73 65 74 20 74 6f 20 74 72 75 65 20 62 65 66 6f 72 65 20 61 6e 79 20 6f 74 | lly.be.set.to.true.before.any.ot |
| b5760 | 68 65 72 20 70 72 6f 63 65 73 73 20 63 61 6e 0a 74 65 73 74 20 74 68 65 20 63 65 6c 6c 2e 20 20 | her.process.can.test.the.cell... |
| b5780 | 49 66 20 77 65 20 64 6f 20 6e 6f 74 20 6d 61 6b 65 20 74 68 69 73 20 67 75 61 72 61 6e 74 65 65 | If.we.do.not.make.this.guarantee |
| b57a0 | 2c 20 74 68 65 6e 20 74 68 65 20 6d 75 74 65 78 20 63 61 6e 0a 66 61 69 6c 20 69 6e 20 61 20 77 | ,.then.the.mutex.can.fail.in.a.w |
| b57c0 | 61 79 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 62 61 6e 6b 2d 61 63 63 6f 75 6e 74 20 66 | ay.similar.to.the.bank-account.f |
| b57e0 | 61 69 6c 75 72 65 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a 33 2d 32 39 3a 3a 2e 20 20 | ailure.in.*Note.Figure.3-29::... |
| b5800 | 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 34 36 3a 3a 2e 29 0a 0a 20 20 | (See.*Note.Exercise.3-46::.).... |
| b5820 | 20 54 68 65 20 61 63 74 75 61 6c 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 60 74 | .The.actual.implementation.of.`t |
| b5840 | 65 73 74 2d 61 6e 64 2d 73 65 74 21 27 20 64 65 70 65 6e 64 73 20 6f 6e 20 74 68 65 20 64 65 74 | est-and-set!'.depends.on.the.det |
| b5860 | 61 69 6c 73 0a 6f 66 20 68 6f 77 20 6f 75 72 20 73 79 73 74 65 6d 20 72 75 6e 73 20 63 6f 6e 63 | ails.of.how.our.system.runs.conc |
| b5880 | 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 | urrent.processes...For.example,. |
| b58a0 | 77 65 20 6d 69 67 68 74 20 62 65 0a 65 78 65 63 75 74 69 6e 67 20 63 6f 6e 63 75 72 72 65 6e 74 | we.might.be.executing.concurrent |
| b58c0 | 20 70 72 6f 63 65 73 73 65 73 20 6f 6e 20 61 20 73 65 71 75 65 6e 74 69 61 6c 20 70 72 6f 63 65 | .processes.on.a.sequential.proce |
| b58e0 | 73 73 6f 72 20 75 73 69 6e 67 20 61 0a 74 69 6d 65 2d 73 6c 69 63 69 6e 67 20 6d 65 63 68 61 6e | ssor.using.a.time-slicing.mechan |
| b5900 | 69 73 6d 20 74 68 61 74 20 63 79 63 6c 65 73 20 74 68 72 6f 75 67 68 20 74 68 65 20 70 72 6f 63 | ism.that.cycles.through.the.proc |
| b5920 | 65 73 73 65 73 2c 20 70 65 72 6d 69 74 74 69 6e 67 0a 65 61 63 68 20 70 72 6f 63 65 73 73 20 74 | esses,.permitting.each.process.t |
| b5940 | 6f 20 72 75 6e 20 66 6f 72 20 61 20 73 68 6f 72 74 20 74 69 6d 65 20 62 65 66 6f 72 65 20 69 6e | o.run.for.a.short.time.before.in |
| b5960 | 74 65 72 72 75 70 74 69 6e 67 20 69 74 20 61 6e 64 20 6d 6f 76 69 6e 67 0a 6f 6e 20 74 6f 20 74 | terrupting.it.and.moving.on.to.t |
| b5980 | 68 65 20 6e 65 78 74 20 70 72 6f 63 65 73 73 2e 20 20 49 6e 20 74 68 61 74 20 63 61 73 65 2c 20 | he.next.process...In.that.case,. |
| b59a0 | 60 74 65 73 74 2d 61 6e 64 2d 73 65 74 21 27 20 20 63 61 6e 20 77 6f 72 6b 20 62 79 0a 64 69 73 | `test-and-set!'..can.work.by.dis |
| b59c0 | 61 62 6c 69 6e 67 20 74 69 6d 65 20 73 6c 69 63 69 6e 67 20 64 75 72 69 6e 67 20 74 68 65 20 74 | abling.time.slicing.during.the.t |
| b59e0 | 65 73 74 69 6e 67 20 61 6e 64 20 73 65 74 74 69 6e 67 2e 28 37 29 0a 41 6c 74 65 72 6e 61 74 69 | esting.and.setting.(7).Alternati |
| b5a00 | 76 65 6c 79 2c 20 6d 75 6c 74 69 70 72 6f 63 65 73 73 69 6e 67 20 63 6f 6d 70 75 74 65 72 73 20 | vely,.multiprocessing.computers. |
| b5a20 | 70 72 6f 76 69 64 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 68 61 74 0a 73 75 70 70 6f 72 | provide.instructions.that.suppor |
| b5a40 | 74 20 61 74 6f 6d 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 64 69 72 65 63 74 6c 79 20 69 6e 20 | t.atomic.operations.directly.in. |
| b5a60 | 68 61 72 64 77 61 72 65 2e 28 38 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 34 | hardware.(8).......*Exercise.3.4 |
| b5a80 | 36 3a 2a 20 53 75 70 70 6f 73 65 20 74 68 61 74 20 77 65 20 69 6d 70 6c 65 6d 65 6e 74 20 60 74 | 6:*.Suppose.that.we.implement.`t |
| b5aa0 | 65 73 74 2d 61 6e 64 2d 73 65 74 21 27 20 20 75 73 69 6e 67 0a 20 20 20 20 20 61 6e 20 6f 72 64 | est-and-set!'..using......an.ord |
| b5ac0 | 69 6e 61 72 79 20 70 72 6f 63 65 64 75 72 65 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 74 68 65 20 | inary.procedure.as.shown.in.the. |
| b5ae0 | 74 65 78 74 2c 20 77 69 74 68 6f 75 74 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 0a 20 20 20 20 | text,.without.attempting.to..... |
| b5b00 | 20 6d 61 6b 65 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 61 74 6f 6d 69 63 2e 20 20 44 72 61 | .make.the.operation.atomic...Dra |
| b5b20 | 77 20 61 20 74 69 6d 69 6e 67 20 64 69 61 67 72 61 6d 20 6c 69 6b 65 20 74 68 65 20 6f 6e 65 20 | w.a.timing.diagram.like.the.one. |
| b5b40 | 69 6e 0a 20 20 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 32 39 3a 3a 20 74 6f 20 64 | in......*Note.Figure.3-29::.to.d |
| b5b60 | 65 6d 6f 6e 73 74 72 61 74 65 20 68 6f 77 20 74 68 65 20 6d 75 74 65 78 20 69 6d 70 6c 65 6d 65 | emonstrate.how.the.mutex.impleme |
| b5b80 | 6e 74 61 74 69 6f 6e 0a 20 20 20 20 20 63 61 6e 20 66 61 69 6c 20 62 79 20 61 6c 6c 6f 77 69 6e | ntation......can.fail.by.allowin |
| b5ba0 | 67 20 74 77 6f 20 70 72 6f 63 65 73 73 65 73 20 74 6f 20 61 63 71 75 69 72 65 20 74 68 65 20 6d | g.two.processes.to.acquire.the.m |
| b5bc0 | 75 74 65 78 20 61 74 20 74 68 65 0a 20 20 20 20 20 73 61 6d 65 20 74 69 6d 65 2e 0a 0a 20 20 20 | utex.at.the......same.time...... |
| b5be0 | 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 34 37 3a 2a 20 41 20 73 65 6d 61 70 68 6f 72 65 20 28 | ..*Exercise.3.47:*.A.semaphore.( |
| b5c00 | 6f 66 20 73 69 7a 65 20 6e 29 20 69 73 20 61 20 67 65 6e 65 72 61 6c 69 7a 61 74 69 6f 6e 20 6f | of.size.n).is.a.generalization.o |
| b5c20 | 66 20 61 0a 20 20 20 20 20 6d 75 74 65 78 2e 20 20 4c 69 6b 65 20 61 20 6d 75 74 65 78 2c 20 61 | f.a......mutex...Like.a.mutex,.a |
| b5c40 | 20 73 65 6d 61 70 68 6f 72 65 20 73 75 70 70 6f 72 74 73 20 61 63 71 75 69 72 65 20 61 6e 64 20 | .semaphore.supports.acquire.and. |
| b5c60 | 72 65 6c 65 61 73 65 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 62 75 74 20 69 74 20 | release......operations,.but.it. |
| b5c80 | 69 73 20 6d 6f 72 65 20 67 65 6e 65 72 61 6c 20 69 6e 20 74 68 61 74 20 75 70 20 74 6f 20 6e 20 | is.more.general.in.that.up.to.n. |
| b5ca0 | 70 72 6f 63 65 73 73 65 73 20 63 61 6e 0a 20 20 20 20 20 61 63 71 75 69 72 65 20 69 74 20 63 6f | processes.can......acquire.it.co |
| b5cc0 | 6e 63 75 72 72 65 6e 74 6c 79 2e 20 20 41 64 64 69 74 69 6f 6e 61 6c 20 70 72 6f 63 65 73 73 65 | ncurrently...Additional.processe |
| b5ce0 | 73 20 74 68 61 74 20 61 74 74 65 6d 70 74 20 74 6f 0a 20 20 20 20 20 61 63 71 75 69 72 65 20 74 | s.that.attempt.to......acquire.t |
| b5d00 | 68 65 20 73 65 6d 61 70 68 6f 72 65 20 6d 75 73 74 20 77 61 69 74 20 66 6f 72 20 72 65 6c 65 61 | he.semaphore.must.wait.for.relea |
| b5d20 | 73 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 47 69 76 65 0a 20 20 20 20 20 69 6d 70 6c 65 6d | se.operations...Give......implem |
| b5d40 | 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 73 65 6d 61 70 68 6f 72 65 73 0a 0a 20 20 20 20 20 20 20 | entations.of.semaphores......... |
| b5d60 | 61 2e 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6d 75 74 65 78 65 73 0a 0a 20 20 20 20 20 20 20 62 | a..in.terms.of.mutexes.........b |
| b5d80 | 2e 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 61 74 6f 6d 69 63 20 60 74 65 73 74 2d 61 6e 64 2d 73 | ..in.terms.of.atomic.`test-and-s |
| b5da0 | 65 74 21 27 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 0a 44 65 61 64 6c 6f 63 6b 0a 2e 2e 2e 2e | et!'.operations....Deadlock..... |
| b5dc0 | 2e 2e 2e 2e 0a 0a 4e 6f 77 20 74 68 61 74 20 77 65 20 68 61 76 65 20 73 65 65 6e 20 68 6f 77 20 | ......Now.that.we.have.seen.how. |
| b5de0 | 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 73 65 72 69 61 6c 69 7a 65 72 73 2c 20 77 65 20 63 61 6e | to.implement.serializers,.we.can |
| b5e00 | 20 73 65 65 20 74 68 61 74 0a 61 63 63 6f 75 6e 74 20 65 78 63 68 61 6e 67 69 6e 67 20 73 74 69 | .see.that.account.exchanging.sti |
| b5e20 | 6c 6c 20 68 61 73 20 61 20 70 72 6f 62 6c 65 6d 2c 20 65 76 65 6e 20 77 69 74 68 20 74 68 65 0a | ll.has.a.problem,.even.with.the. |
| b5e40 | 60 73 65 72 69 61 6c 69 7a 65 64 2d 65 78 63 68 61 6e 67 65 27 20 70 72 6f 63 65 64 75 72 65 20 | `serialized-exchange'.procedure. |
| b5e60 | 61 62 6f 76 65 2e 20 20 49 6d 61 67 69 6e 65 20 74 68 61 74 20 50 65 74 65 72 20 61 74 74 65 6d | above...Imagine.that.Peter.attem |
| b5e80 | 70 74 73 20 74 6f 0a 65 78 63 68 61 6e 67 65 20 61 31 20 77 69 74 68 20 61 32 20 77 68 69 6c 65 | pts.to.exchange.a1.with.a2.while |
| b5ea0 | 20 50 61 75 6c 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 20 61 74 74 65 6d 70 74 73 20 74 6f 20 65 | .Paul.concurrently.attempts.to.e |
| b5ec0 | 78 63 68 61 6e 67 65 20 61 32 0a 77 69 74 68 20 61 31 2e 20 20 53 75 70 70 6f 73 65 20 74 68 61 | xchange.a2.with.a1...Suppose.tha |
| b5ee0 | 74 20 50 65 74 65 72 27 73 20 70 72 6f 63 65 73 73 20 72 65 61 63 68 65 73 20 74 68 65 20 70 6f | t.Peter's.process.reaches.the.po |
| b5f00 | 69 6e 74 20 77 68 65 72 65 20 69 74 20 68 61 73 0a 65 6e 74 65 72 65 64 20 61 20 73 65 72 69 61 | int.where.it.has.entered.a.seria |
| b5f20 | 6c 69 7a 65 64 20 70 72 6f 63 65 64 75 72 65 20 70 72 6f 74 65 63 74 69 6e 67 20 61 31 20 61 6e | lized.procedure.protecting.a1.an |
| b5f40 | 64 2c 20 6a 75 73 74 20 61 66 74 65 72 20 74 68 61 74 2c 0a 50 61 75 6c 27 73 20 70 72 6f 63 65 | d,.just.after.that,.Paul's.proce |
| b5f60 | 73 73 20 65 6e 74 65 72 73 20 61 20 73 65 72 69 61 6c 69 7a 65 64 20 70 72 6f 63 65 64 75 72 65 | ss.enters.a.serialized.procedure |
| b5f80 | 20 70 72 6f 74 65 63 74 69 6e 67 20 61 32 2e 20 20 4e 6f 77 20 50 65 74 65 72 0a 63 61 6e 6e 6f | .protecting.a2...Now.Peter.canno |
| b5fa0 | 74 20 70 72 6f 63 65 65 64 20 28 74 6f 20 65 6e 74 65 72 20 61 20 73 65 72 69 61 6c 69 7a 65 64 | t.proceed.(to.enter.a.serialized |
| b5fc0 | 20 70 72 6f 63 65 64 75 72 65 20 70 72 6f 74 65 63 74 69 6e 67 20 61 32 29 20 75 6e 74 69 6c 0a | .procedure.protecting.a2).until. |
| b5fe0 | 50 61 75 6c 20 65 78 69 74 73 20 74 68 65 20 73 65 72 69 61 6c 69 7a 65 64 20 70 72 6f 63 65 64 | Paul.exits.the.serialized.proced |
| b6000 | 75 72 65 20 70 72 6f 74 65 63 74 69 6e 67 20 61 32 2e 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 50 | ure.protecting.a2...Similarly,.P |
| b6020 | 61 75 6c 0a 63 61 6e 6e 6f 74 20 70 72 6f 63 65 65 64 20 75 6e 74 69 6c 20 50 65 74 65 72 20 65 | aul.cannot.proceed.until.Peter.e |
| b6040 | 78 69 74 73 20 74 68 65 20 73 65 72 69 61 6c 69 7a 65 64 20 70 72 6f 63 65 64 75 72 65 20 70 72 | xits.the.serialized.procedure.pr |
| b6060 | 6f 74 65 63 74 69 6e 67 0a 61 31 2e 20 20 45 61 63 68 20 70 72 6f 63 65 73 73 20 69 73 20 73 74 | otecting.a1...Each.process.is.st |
| b6080 | 61 6c 6c 65 64 20 66 6f 72 65 76 65 72 2c 20 77 61 69 74 69 6e 67 20 66 6f 72 20 74 68 65 20 6f | alled.forever,.waiting.for.the.o |
| b60a0 | 74 68 65 72 2e 20 20 54 68 69 73 0a 73 69 74 75 61 74 69 6f 6e 20 69 73 20 63 61 6c 6c 65 64 20 | ther...This.situation.is.called. |
| b60c0 | 61 20 22 64 65 61 64 6c 6f 63 6b 22 2e 20 20 44 65 61 64 6c 6f 63 6b 20 69 73 20 61 6c 77 61 79 | a."deadlock"...Deadlock.is.alway |
| b60e0 | 73 20 61 20 64 61 6e 67 65 72 20 69 6e 0a 73 79 73 74 65 6d 73 20 74 68 61 74 20 70 72 6f 76 69 | s.a.danger.in.systems.that.provi |
| b6100 | 64 65 20 63 6f 6e 63 75 72 72 65 6e 74 20 61 63 63 65 73 73 20 74 6f 20 6d 75 6c 74 69 70 6c 65 | de.concurrent.access.to.multiple |
| b6120 | 20 73 68 61 72 65 64 20 72 65 73 6f 75 72 63 65 73 2e 0a 0a 20 20 20 4f 6e 65 20 77 61 79 20 74 | .shared.resources......One.way.t |
| b6140 | 6f 20 61 76 6f 69 64 20 74 68 65 20 64 65 61 64 6c 6f 63 6b 20 69 6e 20 74 68 69 73 20 73 69 74 | o.avoid.the.deadlock.in.this.sit |
| b6160 | 75 61 74 69 6f 6e 20 69 73 20 74 6f 20 67 69 76 65 20 65 61 63 68 0a 61 63 63 6f 75 6e 74 20 61 | uation.is.to.give.each.account.a |
| b6180 | 20 75 6e 69 71 75 65 20 69 64 65 6e 74 69 66 69 63 61 74 69 6f 6e 20 6e 75 6d 62 65 72 20 61 6e | .unique.identification.number.an |
| b61a0 | 64 20 72 65 77 72 69 74 65 0a 60 73 65 72 69 61 6c 69 7a 65 64 2d 65 78 63 68 61 6e 67 65 27 20 | d.rewrite.`serialized-exchange'. |
| b61c0 | 73 6f 20 74 68 61 74 20 61 20 70 72 6f 63 65 73 73 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 61 74 | so.that.a.process.will.always.at |
| b61e0 | 74 65 6d 70 74 20 74 6f 20 65 6e 74 65 72 20 61 0a 70 72 6f 63 65 64 75 72 65 20 70 72 6f 74 65 | tempt.to.enter.a.procedure.prote |
| b6200 | 63 74 69 6e 67 20 74 68 65 20 6c 6f 77 65 73 74 2d 6e 75 6d 62 65 72 65 64 20 61 63 63 6f 75 6e | cting.the.lowest-numbered.accoun |
| b6220 | 74 20 66 69 72 73 74 2e 20 20 41 6c 74 68 6f 75 67 68 20 74 68 69 73 0a 6d 65 74 68 6f 64 20 77 | t.first...Although.this.method.w |
| b6240 | 6f 72 6b 73 20 77 65 6c 6c 20 66 6f 72 20 74 68 65 20 65 78 63 68 61 6e 67 65 20 70 72 6f 62 6c | orks.well.for.the.exchange.probl |
| b6260 | 65 6d 2c 20 74 68 65 72 65 20 61 72 65 20 6f 74 68 65 72 20 73 69 74 75 61 74 69 6f 6e 73 0a 74 | em,.there.are.other.situations.t |
| b6280 | 68 61 74 20 72 65 71 75 69 72 65 20 6d 6f 72 65 20 73 6f 70 68 69 73 74 69 63 61 74 65 64 20 64 | hat.require.more.sophisticated.d |
| b62a0 | 65 61 64 6c 6f 63 6b 2d 61 76 6f 69 64 61 6e 63 65 20 74 65 63 68 6e 69 71 75 65 73 2c 20 6f 72 | eadlock-avoidance.techniques,.or |
| b62c0 | 20 77 68 65 72 65 0a 64 65 61 64 6c 6f 63 6b 20 63 61 6e 6e 6f 74 20 62 65 20 61 76 6f 69 64 65 | .where.deadlock.cannot.be.avoide |
| b62e0 | 64 20 61 74 20 61 6c 6c 2e 20 20 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 | d.at.all...(See.*Note.Exercise.3 |
| b6300 | 2d 34 38 3a 3a 20 61 6e 64 0a 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 34 39 3a 3a 2e | -48::.and.*Note.Exercise.3-49::. |
| b6320 | 29 28 39 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 34 38 3a 2a 20 45 78 70 6c | )(9).......*Exercise.3.48:*.Expl |
| b6340 | 61 69 6e 20 69 6e 20 64 65 74 61 69 6c 20 77 68 79 20 74 68 65 20 64 65 61 64 6c 6f 63 6b 2d 61 | ain.in.detail.why.the.deadlock-a |
| b6360 | 76 6f 69 64 61 6e 63 65 0a 20 20 20 20 20 6d 65 74 68 6f 64 20 64 65 73 63 72 69 62 65 64 20 61 | voidance......method.described.a |
| b6380 | 62 6f 76 65 2c 20 28 69 2e 65 2e 2c 20 74 68 65 20 61 63 63 6f 75 6e 74 73 20 61 72 65 20 6e 75 | bove,.(i.e.,.the.accounts.are.nu |
| b63a0 | 6d 62 65 72 65 64 2c 20 61 6e 64 20 65 61 63 68 0a 20 20 20 20 20 70 72 6f 63 65 73 73 20 61 74 | mbered,.and.each......process.at |
| b63c0 | 74 65 6d 70 74 73 20 74 6f 20 61 63 71 75 69 72 65 20 74 68 65 20 73 6d 61 6c 6c 65 72 2d 6e 75 | tempts.to.acquire.the.smaller-nu |
| b63e0 | 6d 62 65 72 65 64 20 61 63 63 6f 75 6e 74 20 66 69 72 73 74 29 0a 20 20 20 20 20 61 76 6f 69 64 | mbered.account.first)......avoid |
| b6400 | 73 20 64 65 61 64 6c 6f 63 6b 20 69 6e 20 74 68 65 20 65 78 63 68 61 6e 67 65 20 70 72 6f 62 6c | s.deadlock.in.the.exchange.probl |
| b6420 | 65 6d 2e 20 20 52 65 77 72 69 74 65 0a 20 20 20 20 20 60 73 65 72 69 61 6c 69 7a 65 64 2d 65 78 | em...Rewrite......`serialized-ex |
| b6440 | 63 68 61 6e 67 65 27 20 74 6f 20 69 6e 63 6f 72 70 6f 72 61 74 65 20 74 68 69 73 20 69 64 65 61 | change'.to.incorporate.this.idea |
| b6460 | 2e 20 20 28 59 6f 75 20 77 69 6c 6c 20 61 6c 73 6f 0a 20 20 20 20 20 6e 65 65 64 20 74 6f 20 6d | ...(You.will.also......need.to.m |
| b6480 | 6f 64 69 66 79 20 60 6d 61 6b 65 2d 61 63 63 6f 75 6e 74 27 20 73 6f 20 74 68 61 74 20 65 61 63 | odify.`make-account'.so.that.eac |
| b64a0 | 68 20 61 63 63 6f 75 6e 74 20 69 73 20 63 72 65 61 74 65 64 20 77 69 74 68 0a 20 20 20 20 20 61 | h.account.is.created.with......a |
| b64c0 | 20 6e 75 6d 62 65 72 2c 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 61 63 63 65 73 73 65 64 20 62 | .number,.which.can.be.accessed.b |
| b64e0 | 79 20 73 65 6e 64 69 6e 67 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20 6d 65 73 73 61 67 65 | y.sending.an.appropriate.message |
| b6500 | 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 34 39 3a 2a 20 47 69 76 65 20 61 | .).......*Exercise.3.49:*.Give.a |
| b6520 | 20 73 63 65 6e 61 72 69 6f 20 77 68 65 72 65 20 74 68 65 20 64 65 61 64 6c 6f 63 6b 2d 61 76 6f | .scenario.where.the.deadlock-avo |
| b6540 | 69 64 61 6e 63 65 0a 20 20 20 20 20 6d 65 63 68 61 6e 69 73 6d 20 64 65 73 63 72 69 62 65 64 20 | idance......mechanism.described. |
| b6560 | 61 62 6f 76 65 20 64 6f 65 73 20 6e 6f 74 20 77 6f 72 6b 2e 20 20 28 48 69 6e 74 3a 20 49 6e 20 | above.does.not.work...(Hint:.In. |
| b6580 | 74 68 65 20 65 78 63 68 61 6e 67 65 0a 20 20 20 20 20 70 72 6f 62 6c 65 6d 2c 20 65 61 63 68 20 | the.exchange......problem,.each. |
| b65a0 | 70 72 6f 63 65 73 73 20 6b 6e 6f 77 73 20 69 6e 20 61 64 76 61 6e 63 65 20 77 68 69 63 68 20 61 | process.knows.in.advance.which.a |
| b65c0 | 63 63 6f 75 6e 74 73 20 69 74 20 77 69 6c 6c 20 6e 65 65 64 0a 20 20 20 20 20 74 6f 20 67 65 74 | ccounts.it.will.need......to.get |
| b65e0 | 20 61 63 63 65 73 73 20 74 6f 2e 20 20 43 6f 6e 73 69 64 65 72 20 61 20 73 69 74 75 61 74 69 6f | .access.to...Consider.a.situatio |
| b6600 | 6e 20 77 68 65 72 65 20 61 20 70 72 6f 63 65 73 73 20 6d 75 73 74 20 67 65 74 0a 20 20 20 20 20 | n.where.a.process.must.get...... |
| b6620 | 61 63 63 65 73 73 20 74 6f 20 73 6f 6d 65 20 73 68 61 72 65 64 20 72 65 73 6f 75 72 63 65 73 20 | access.to.some.shared.resources. |
| b6640 | 62 65 66 6f 72 65 20 69 74 20 63 61 6e 20 6b 6e 6f 77 20 77 68 69 63 68 0a 20 20 20 20 20 61 64 | before.it.can.know.which......ad |
| b6660 | 64 69 74 69 6f 6e 61 6c 20 73 68 61 72 65 64 20 72 65 73 6f 75 72 63 65 73 20 69 74 20 77 69 6c | ditional.shared.resources.it.wil |
| b6680 | 6c 20 72 65 71 75 69 72 65 2e 29 0a 0a 43 6f 6e 63 75 72 72 65 6e 63 79 2c 20 74 69 6d 65 2c 20 | l.require.)..Concurrency,.time,. |
| b66a0 | 61 6e 64 20 63 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | and.communication............... |
| b66c0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 27 76 65 20 73 65 | ........................We've.se |
| b66e0 | 65 6e 20 68 6f 77 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 63 6f 6e 63 75 72 72 65 6e 74 20 73 79 | en.how.programming.concurrent.sy |
| b6700 | 73 74 65 6d 73 20 72 65 71 75 69 72 65 73 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 20 74 68 65 0a 6f | stems.requires.controlling.the.o |
| b6720 | 72 64 65 72 69 6e 67 20 6f 66 20 65 76 65 6e 74 73 20 77 68 65 6e 20 64 69 66 66 65 72 65 6e 74 | rdering.of.events.when.different |
| b6740 | 20 70 72 6f 63 65 73 73 65 73 20 61 63 63 65 73 73 20 73 68 61 72 65 64 20 73 74 61 74 65 2c 20 | .processes.access.shared.state,. |
| b6760 | 61 6e 64 0a 77 65 27 76 65 20 73 65 65 6e 20 68 6f 77 20 74 6f 20 61 63 68 69 65 76 65 20 74 68 | and.we've.seen.how.to.achieve.th |
| b6780 | 69 73 20 63 6f 6e 74 72 6f 6c 20 74 68 72 6f 75 67 68 20 6a 75 64 69 63 69 6f 75 73 20 75 73 65 | is.control.through.judicious.use |
| b67a0 | 20 6f 66 0a 73 65 72 69 61 6c 69 7a 65 72 73 2e 20 20 42 75 74 20 74 68 65 20 70 72 6f 62 6c 65 | .of.serializers...But.the.proble |
| b67c0 | 6d 73 20 6f 66 20 63 6f 6e 63 75 72 72 65 6e 63 79 20 6c 69 65 20 64 65 65 70 65 72 20 74 68 61 | ms.of.concurrency.lie.deeper.tha |
| b67e0 | 6e 20 74 68 69 73 2c 0a 62 65 63 61 75 73 65 2c 20 66 72 6f 6d 20 61 20 66 75 6e 64 61 6d 65 6e | n.this,.because,.from.a.fundamen |
| b6800 | 74 61 6c 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 2c 20 69 74 27 73 20 6e 6f 74 20 61 6c 77 61 | tal.point.of.view,.it's.not.alwa |
| b6820 | 79 73 20 63 6c 65 61 72 20 77 68 61 74 0a 69 73 20 6d 65 61 6e 74 20 62 79 20 22 73 68 61 72 65 | ys.clear.what.is.meant.by."share |
| b6840 | 64 20 73 74 61 74 65 2e 22 0a 0a 20 20 20 4d 65 63 68 61 6e 69 73 6d 73 20 73 75 63 68 20 61 73 | d.state.".....Mechanisms.such.as |
| b6860 | 20 60 74 65 73 74 2d 61 6e 64 2d 73 65 74 21 27 20 72 65 71 75 69 72 65 20 70 72 6f 63 65 73 73 | .`test-and-set!'.require.process |
| b6880 | 65 73 20 74 6f 20 65 78 61 6d 69 6e 65 20 61 0a 67 6c 6f 62 61 6c 20 73 68 61 72 65 64 20 66 6c | es.to.examine.a.global.shared.fl |
| b68a0 | 61 67 20 61 74 20 61 72 62 69 74 72 61 72 79 20 74 69 6d 65 73 2e 20 20 54 68 69 73 20 69 73 20 | ag.at.arbitrary.times...This.is. |
| b68c0 | 70 72 6f 62 6c 65 6d 61 74 69 63 20 61 6e 64 0a 69 6e 65 66 66 69 63 69 65 6e 74 20 74 6f 20 69 | problematic.and.inefficient.to.i |
| b68e0 | 6d 70 6c 65 6d 65 6e 74 20 69 6e 20 6d 6f 64 65 72 6e 20 68 69 67 68 2d 73 70 65 65 64 20 70 72 | mplement.in.modern.high-speed.pr |
| b6900 | 6f 63 65 73 73 6f 72 73 2c 20 77 68 65 72 65 20 64 75 65 20 74 6f 0a 6f 70 74 69 6d 69 7a 61 74 | ocessors,.where.due.to.optimizat |
| b6920 | 69 6f 6e 20 74 65 63 68 6e 69 71 75 65 73 20 73 75 63 68 20 61 73 20 70 69 70 65 6c 69 6e 69 6e | ion.techniques.such.as.pipelinin |
| b6940 | 67 20 61 6e 64 20 63 61 63 68 65 64 20 6d 65 6d 6f 72 79 2c 20 74 68 65 0a 63 6f 6e 74 65 6e 74 | g.and.cached.memory,.the.content |
| b6960 | 73 20 6f 66 20 6d 65 6d 6f 72 79 20 6d 61 79 20 6e 6f 74 20 62 65 20 69 6e 20 61 20 63 6f 6e 73 | s.of.memory.may.not.be.in.a.cons |
| b6980 | 69 73 74 65 6e 74 20 73 74 61 74 65 20 61 74 20 65 76 65 72 79 20 69 6e 73 74 61 6e 74 2e 0a 49 | istent.state.at.every.instant..I |
| b69a0 | 6e 20 63 6f 6e 74 65 6d 70 6f 72 61 72 79 20 6d 75 6c 74 69 70 72 6f 63 65 73 73 69 6e 67 20 73 | n.contemporary.multiprocessing.s |
| b69c0 | 79 73 74 65 6d 73 2c 20 74 68 65 72 65 66 6f 72 65 2c 20 74 68 65 20 73 65 72 69 61 6c 69 7a 65 | ystems,.therefore,.the.serialize |
| b69e0 | 72 0a 70 61 72 61 64 69 67 6d 20 69 73 20 62 65 69 6e 67 20 73 75 70 70 6c 61 6e 74 65 64 20 62 | r.paradigm.is.being.supplanted.b |
| b6a00 | 79 20 6e 65 77 20 61 70 70 72 6f 61 63 68 65 73 20 74 6f 20 63 6f 6e 63 75 72 72 65 6e 63 79 0a | y.new.approaches.to.concurrency. |
| b6a20 | 63 6f 6e 74 72 6f 6c 2e 28 31 30 29 0a 0a 20 20 20 54 68 65 20 70 72 6f 62 6c 65 6d 61 74 69 63 | control.(10).....The.problematic |
| b6a40 | 20 61 73 70 65 63 74 73 20 6f 66 20 73 68 61 72 65 64 20 73 74 61 74 65 20 61 6c 73 6f 20 61 72 | .aspects.of.shared.state.also.ar |
| b6a60 | 69 73 65 20 69 6e 20 6c 61 72 67 65 2c 0a 64 69 73 74 72 69 62 75 74 65 64 20 73 79 73 74 65 6d | ise.in.large,.distributed.system |
| b6a80 | 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 6d 61 67 69 6e 65 20 61 20 64 69 73 74 | s...For.instance,.imagine.a.dist |
| b6aa0 | 72 69 62 75 74 65 64 20 62 61 6e 6b 69 6e 67 0a 73 79 73 74 65 6d 20 77 68 65 72 65 20 69 6e 64 | ributed.banking.system.where.ind |
| b6ac0 | 69 76 69 64 75 61 6c 20 62 72 61 6e 63 68 20 62 61 6e 6b 73 20 6d 61 69 6e 74 61 69 6e 20 6c 6f | ividual.branch.banks.maintain.lo |
| b6ae0 | 63 61 6c 20 76 61 6c 75 65 73 20 66 6f 72 20 62 61 6e 6b 0a 62 61 6c 61 6e 63 65 73 20 61 6e 64 | cal.values.for.bank.balances.and |
| b6b00 | 20 70 65 72 69 6f 64 69 63 61 6c 6c 79 20 63 6f 6d 70 61 72 65 20 74 68 65 73 65 20 77 69 74 68 | .periodically.compare.these.with |
| b6b20 | 20 76 61 6c 75 65 73 20 6d 61 69 6e 74 61 69 6e 65 64 20 62 79 20 6f 74 68 65 72 0a 62 72 61 6e | .values.maintained.by.other.bran |
| b6b40 | 63 68 65 73 2e 20 20 49 6e 20 73 75 63 68 20 61 20 73 79 73 74 65 6d 20 74 68 65 20 76 61 6c 75 | ches...In.such.a.system.the.valu |
| b6b60 | 65 20 6f 66 20 22 74 68 65 20 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e 63 65 22 20 77 6f 75 6c 64 | e.of."the.account.balance".would |
| b6b80 | 20 62 65 0a 75 6e 64 65 74 65 72 6d 69 6e 65 64 2c 20 65 78 63 65 70 74 20 72 69 67 68 74 20 61 | .be.undetermined,.except.right.a |
| b6ba0 | 66 74 65 72 20 73 79 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 2e 20 20 49 66 20 50 65 74 65 72 20 | fter.synchronization...If.Peter. |
| b6bc0 | 64 65 70 6f 73 69 74 73 0a 6d 6f 6e 65 79 20 69 6e 20 61 6e 20 61 63 63 6f 75 6e 74 20 68 65 20 | deposits.money.in.an.account.he. |
| b6be0 | 68 6f 6c 64 73 20 6a 6f 69 6e 74 6c 79 20 77 69 74 68 20 50 61 75 6c 2c 20 77 68 65 6e 20 73 68 | holds.jointly.with.Paul,.when.sh |
| b6c00 | 6f 75 6c 64 20 77 65 20 73 61 79 20 74 68 61 74 0a 74 68 65 20 61 63 63 6f 75 6e 74 20 62 61 6c | ould.we.say.that.the.account.bal |
| b6c20 | 61 6e 63 65 20 68 61 73 20 63 68 61 6e 67 65 64 2d 2d 77 68 65 6e 20 74 68 65 20 62 61 6c 61 6e | ance.has.changed--when.the.balan |
| b6c40 | 63 65 20 69 6e 20 74 68 65 20 6c 6f 63 61 6c 20 62 72 61 6e 63 68 0a 63 68 61 6e 67 65 73 2c 20 | ce.in.the.local.branch.changes,. |
| b6c60 | 6f 72 20 6e 6f 74 20 75 6e 74 69 6c 20 61 66 74 65 72 20 74 68 65 20 73 79 6e 63 68 72 6f 6e 69 | or.not.until.after.the.synchroni |
| b6c80 | 7a 61 74 69 6f 6e 3f 20 20 41 6e 64 20 69 66 20 50 61 75 6c 20 61 63 63 65 73 73 65 73 0a 74 68 | zation?..And.if.Paul.accesses.th |
| b6ca0 | 65 20 61 63 63 6f 75 6e 74 20 66 72 6f 6d 20 61 20 64 69 66 66 65 72 65 6e 74 20 62 72 61 6e 63 | e.account.from.a.different.branc |
| b6cc0 | 68 2c 20 77 68 61 74 20 61 72 65 20 74 68 65 20 72 65 61 73 6f 6e 61 62 6c 65 0a 63 6f 6e 73 74 | h,.what.are.the.reasonable.const |
| b6ce0 | 72 61 69 6e 74 73 20 74 6f 20 70 6c 61 63 65 20 6f 6e 20 74 68 65 20 62 61 6e 6b 69 6e 67 20 73 | raints.to.place.on.the.banking.s |
| b6d00 | 79 73 74 65 6d 20 73 75 63 68 20 74 68 61 74 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 69 73 0a | ystem.such.that.the.behavior.is. |
| b6d20 | 22 63 6f 72 72 65 63 74 22 3f 20 20 54 68 65 20 6f 6e 6c 79 20 74 68 69 6e 67 20 74 68 61 74 20 | "correct"?..The.only.thing.that. |
| b6d40 | 6d 69 67 68 74 20 6d 61 74 74 65 72 20 66 6f 72 20 63 6f 72 72 65 63 74 6e 65 73 73 20 69 73 20 | might.matter.for.correctness.is. |
| b6d60 | 74 68 65 0a 62 65 68 61 76 69 6f 72 20 6f 62 73 65 72 76 65 64 20 62 79 20 50 65 74 65 72 20 61 | the.behavior.observed.by.Peter.a |
| b6d80 | 6e 64 20 50 61 75 6c 20 69 6e 64 69 76 69 64 75 61 6c 6c 79 20 61 6e 64 20 74 68 65 20 22 73 74 | nd.Paul.individually.and.the."st |
| b6da0 | 61 74 65 22 20 6f 66 20 74 68 65 0a 61 63 63 6f 75 6e 74 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 | ate".of.the.account.immediately. |
| b6dc0 | 61 66 74 65 72 20 73 79 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 2e 20 20 51 75 65 73 74 69 6f 6e | after.synchronization...Question |
| b6de0 | 73 20 61 62 6f 75 74 20 74 68 65 20 22 72 65 61 6c 22 0a 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e | s.about.the."real".account.balan |
| b6e00 | 63 65 20 6f 72 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 65 76 65 6e 74 73 20 62 65 74 77 65 65 | ce.or.the.order.of.events.betwee |
| b6e20 | 6e 20 73 79 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 73 20 6d 61 79 20 62 65 0a 69 72 72 65 6c 65 | n.synchronizations.may.be.irrele |
| b6e40 | 76 61 6e 74 20 6f 72 20 6d 65 61 6e 69 6e 67 6c 65 73 73 2e 28 31 31 29 0a 0a 20 20 20 54 68 65 | vant.or.meaningless.(11).....The |
| b6e60 | 20 62 61 73 69 63 20 70 68 65 6e 6f 6d 65 6e 6f 6e 20 68 65 72 65 20 69 73 20 74 68 61 74 20 73 | .basic.phenomenon.here.is.that.s |
| b6e80 | 79 6e 63 68 72 6f 6e 69 7a 69 6e 67 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 63 65 73 73 65 73 | ynchronizing.different.processes |
| b6ea0 | 2c 0a 65 73 74 61 62 6c 69 73 68 69 6e 67 20 73 68 61 72 65 64 20 73 74 61 74 65 2c 20 6f 72 20 | ,.establishing.shared.state,.or. |
| b6ec0 | 69 6d 70 6f 73 69 6e 67 20 61 6e 20 6f 72 64 65 72 20 6f 6e 20 65 76 65 6e 74 73 20 72 65 71 75 | imposing.an.order.on.events.requ |
| b6ee0 | 69 72 65 73 0a 63 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 20 61 6d 6f 6e 67 20 74 68 65 20 70 72 6f | ires.communication.among.the.pro |
| b6f00 | 63 65 73 73 65 73 2e 20 20 49 6e 20 65 73 73 65 6e 63 65 2c 20 61 6e 79 20 6e 6f 74 69 6f 6e 20 | cesses...In.essence,.any.notion. |
| b6f20 | 6f 66 20 74 69 6d 65 20 69 6e 0a 63 6f 6e 63 75 72 72 65 6e 63 79 20 63 6f 6e 74 72 6f 6c 20 6d | of.time.in.concurrency.control.m |
| b6f40 | 75 73 74 20 62 65 20 69 6e 74 69 6d 61 74 65 6c 79 20 74 69 65 64 20 74 6f 20 63 6f 6d 6d 75 6e | ust.be.intimately.tied.to.commun |
| b6f60 | 69 63 61 74 69 6f 6e 2e 28 31 32 29 20 20 49 74 0a 69 73 20 69 6e 74 72 69 67 75 69 6e 67 20 74 | ication.(12)..It.is.intriguing.t |
| b6f80 | 68 61 74 20 61 20 73 69 6d 69 6c 61 72 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 62 65 74 77 65 65 6e | hat.a.similar.connection.between |
| b6fa0 | 20 74 69 6d 65 20 61 6e 64 20 63 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 0a 61 6c 73 6f 20 61 72 69 | .time.and.communication.also.ari |
| b6fc0 | 73 65 73 20 69 6e 20 74 68 65 20 54 68 65 6f 72 79 20 6f 66 20 52 65 6c 61 74 69 76 69 74 79 2c | ses.in.the.Theory.of.Relativity, |
| b6fe0 | 20 77 68 65 72 65 20 74 68 65 20 73 70 65 65 64 20 6f 66 20 6c 69 67 68 74 20 28 74 68 65 0a 66 | .where.the.speed.of.light.(the.f |
| b7000 | 61 73 74 65 73 74 20 73 69 67 6e 61 6c 20 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 | astest.signal.that.can.be.used.t |
| b7020 | 6f 20 73 79 6e 63 68 72 6f 6e 69 7a 65 20 65 76 65 6e 74 73 29 20 69 73 20 61 20 66 75 6e 64 61 | o.synchronize.events).is.a.funda |
| b7040 | 6d 65 6e 74 61 6c 0a 63 6f 6e 73 74 61 6e 74 20 72 65 6c 61 74 69 6e 67 20 74 69 6d 65 20 61 6e | mental.constant.relating.time.an |
| b7060 | 64 20 73 70 61 63 65 2e 20 20 54 68 65 20 63 6f 6d 70 6c 65 78 69 74 69 65 73 20 77 65 20 65 6e | d.space...The.complexities.we.en |
| b7080 | 63 6f 75 6e 74 65 72 20 69 6e 0a 64 65 61 6c 69 6e 67 20 77 69 74 68 20 74 69 6d 65 20 61 6e 64 | counter.in.dealing.with.time.and |
| b70a0 | 20 73 74 61 74 65 20 69 6e 20 6f 75 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 | .state.in.our.computational.mode |
| b70c0 | 6c 73 20 6d 61 79 20 69 6e 20 66 61 63 74 0a 6d 69 72 72 6f 72 20 61 20 66 75 6e 64 61 6d 65 6e | ls.may.in.fact.mirror.a.fundamen |
| b70e0 | 74 61 6c 20 63 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 74 68 65 20 70 68 79 73 69 63 61 6c 20 75 | tal.complexity.of.the.physical.u |
| b7100 | 6e 69 76 65 72 73 65 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 | niverse......----------.Footnote |
| b7120 | 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 60 50 61 72 61 6c 6c 65 6c 2d 65 | s.----------.....(1).`Parallel-e |
| b7140 | 78 65 63 75 74 65 27 20 69 73 20 6e 6f 74 20 70 61 72 74 20 6f 66 20 73 74 61 6e 64 61 72 64 20 | xecute'.is.not.part.of.standard. |
| b7160 | 53 63 68 65 6d 65 2c 20 62 75 74 20 69 74 20 63 61 6e 20 62 65 0a 69 6d 70 6c 65 6d 65 6e 74 65 | Scheme,.but.it.can.be.implemente |
| b7180 | 64 20 69 6e 20 4d 49 54 20 53 63 68 65 6d 65 2e 20 20 49 6e 20 6f 75 72 20 69 6d 70 6c 65 6d 65 | d.in.MIT.Scheme...In.our.impleme |
| b71a0 | 6e 74 61 74 69 6f 6e 2c 20 74 68 65 20 6e 65 77 20 63 6f 6e 63 75 72 72 65 6e 74 0a 70 72 6f 63 | ntation,.the.new.concurrent.proc |
| b71c0 | 65 73 73 65 73 20 61 6c 73 6f 20 72 75 6e 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 20 77 69 74 68 | esses.also.run.concurrently.with |
| b71e0 | 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 53 63 68 65 6d 65 20 70 72 6f 63 65 73 73 2e 0a 41 6c | .the.original.Scheme.process..Al |
| b7200 | 73 6f 2c 20 69 6e 20 6f 75 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 20 74 68 65 20 76 | so,.in.our.implementation,.the.v |
| b7220 | 61 6c 75 65 20 72 65 74 75 72 6e 65 64 20 62 79 20 60 70 61 72 61 6c 6c 65 6c 2d 65 78 65 63 75 | alue.returned.by.`parallel-execu |
| b7240 | 74 65 27 0a 69 73 20 61 20 73 70 65 63 69 61 6c 20 63 6f 6e 74 72 6f 6c 20 6f 62 6a 65 63 74 20 | te'.is.a.special.control.object. |
| b7260 | 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 68 61 6c 74 20 74 68 65 20 6e 65 77 | that.can.be.used.to.halt.the.new |
| b7280 | 6c 79 20 63 72 65 61 74 65 64 0a 70 72 6f 63 65 73 73 65 73 2e 0a 0a 20 20 20 28 32 29 20 57 65 | ly.created.processes......(2).We |
| b72a0 | 20 68 61 76 65 20 73 69 6d 70 6c 69 66 69 65 64 20 60 65 78 63 68 61 6e 67 65 27 20 62 79 20 65 | .have.simplified.`exchange'.by.e |
| b72c0 | 78 70 6c 6f 69 74 69 6e 67 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 6f 75 72 0a 60 64 65 70 | xploiting.the.fact.that.our.`dep |
| b72e0 | 6f 73 69 74 27 20 6d 65 73 73 61 67 65 20 61 63 63 65 70 74 73 20 6e 65 67 61 74 69 76 65 20 61 | osit'.message.accepts.negative.a |
| b7300 | 6d 6f 75 6e 74 73 2e 20 20 28 54 68 69 73 20 69 73 20 61 20 73 65 72 69 6f 75 73 20 62 75 67 20 | mounts...(This.is.a.serious.bug. |
| b7320 | 69 6e 0a 6f 75 72 20 62 61 6e 6b 69 6e 67 20 73 79 73 74 65 6d 21 29 0a 0a 20 20 20 28 33 29 20 | in.our.banking.system!).....(3). |
| b7340 | 49 66 20 74 68 65 20 61 63 63 6f 75 6e 74 20 62 61 6c 61 6e 63 65 73 20 73 74 61 72 74 20 6f 75 | If.the.account.balances.start.ou |
| b7360 | 74 20 61 73 20 24 31 30 2c 20 24 32 30 2c 20 61 6e 64 20 24 33 30 2c 20 74 68 65 6e 0a 61 66 74 | t.as.$10,.$20,.and.$30,.then.aft |
| b7380 | 65 72 20 61 6e 79 20 6e 75 6d 62 65 72 20 6f 66 20 63 6f 6e 63 75 72 72 65 6e 74 20 65 78 63 68 | er.any.number.of.concurrent.exch |
| b73a0 | 61 6e 67 65 73 2c 20 74 68 65 20 62 61 6c 61 6e 63 65 73 20 73 68 6f 75 6c 64 20 73 74 69 6c 6c | anges,.the.balances.should.still |
| b73c0 | 20 62 65 0a 24 31 30 2c 20 24 32 30 2c 20 61 6e 64 20 24 33 30 20 69 6e 20 73 6f 6d 65 20 6f 72 | .be.$10,.$20,.and.$30.in.some.or |
| b73e0 | 64 65 72 2e 20 20 53 65 72 69 61 6c 69 7a 69 6e 67 20 74 68 65 20 64 65 70 6f 73 69 74 73 20 74 | der...Serializing.the.deposits.t |
| b7400 | 6f 0a 69 6e 64 69 76 69 64 75 61 6c 20 61 63 63 6f 75 6e 74 73 20 69 73 20 6e 6f 74 20 73 75 66 | o.individual.accounts.is.not.suf |
| b7420 | 66 69 63 69 65 6e 74 20 74 6f 20 67 75 61 72 61 6e 74 65 65 20 74 68 69 73 2e 20 20 53 65 65 20 | ficient.to.guarantee.this...See. |
| b7440 | 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 20 33 2d 34 33 3a 3a 2e 0a 0a 20 20 20 28 34 29 20 2a | *Note.Exercise.3-43::......(4).* |
| b7460 | 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 34 35 3a 3a 20 69 6e 76 65 73 74 69 67 61 74 65 | Note.Exercise.3-45::.investigate |
| b7480 | 73 20 77 68 79 20 64 65 70 6f 73 69 74 73 20 61 6e 64 20 77 69 74 68 64 72 61 77 61 6c 73 0a 61 | s.why.deposits.and.withdrawals.a |
| b74a0 | 72 65 20 6e 6f 20 6c 6f 6e 67 65 72 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73 65 72 69 61 | re.no.longer.automatically.seria |
| b74c0 | 6c 69 7a 65 64 20 62 79 20 74 68 65 20 61 63 63 6f 75 6e 74 2e 0a 0a 20 20 20 28 35 29 20 54 68 | lized.by.the.account......(5).Th |
| b74e0 | 65 20 74 65 72 6d 20 22 6d 75 74 65 78 22 20 69 73 20 61 6e 20 61 62 62 72 65 76 69 61 74 69 6f | e.term."mutex".is.an.abbreviatio |
| b7500 | 6e 20 66 6f 72 20 22 6d 75 74 75 61 6c 20 65 78 63 6c 75 73 69 6f 6e 22 2e 20 20 54 68 65 0a 67 | n.for."mutual.exclusion"...The.g |
| b7520 | 65 6e 65 72 61 6c 20 70 72 6f 62 6c 65 6d 20 6f 66 20 61 72 72 61 6e 67 69 6e 67 20 61 20 6d 65 | eneral.problem.of.arranging.a.me |
| b7540 | 63 68 61 6e 69 73 6d 20 74 68 61 74 20 70 65 72 6d 69 74 73 20 63 6f 6e 63 75 72 72 65 6e 74 0a | chanism.that.permits.concurrent. |
| b7560 | 70 72 6f 63 65 73 73 65 73 20 74 6f 20 73 61 66 65 6c 79 20 73 68 61 72 65 20 72 65 73 6f 75 72 | processes.to.safely.share.resour |
| b7580 | 63 65 73 20 69 73 20 63 61 6c 6c 65 64 20 74 68 65 20 6d 75 74 75 61 6c 20 65 78 63 6c 75 73 69 | ces.is.called.the.mutual.exclusi |
| b75a0 | 6f 6e 0a 70 72 6f 62 6c 65 6d 2e 20 20 4f 75 72 20 6d 75 74 65 78 20 69 73 20 61 20 73 69 6d 70 | on.problem...Our.mutex.is.a.simp |
| b75c0 | 6c 65 20 76 61 72 69 61 6e 74 20 6f 66 20 74 68 65 20 22 73 65 6d 61 70 68 6f 72 65 22 20 6d 65 | le.variant.of.the."semaphore".me |
| b75e0 | 63 68 61 6e 69 73 6d 0a 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 34 37 | chanism.(see.*Note.Exercise.3-47 |
| b7600 | 3a 3a 29 2c 20 77 68 69 63 68 20 77 61 73 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 74 68 65 | ::),.which.was.introduced.in.the |
| b7620 | 20 22 54 48 45 22 0a 4d 75 6c 74 69 70 72 6f 67 72 61 6d 6d 69 6e 67 20 53 79 73 74 65 6d 20 64 | ."THE".Multiprogramming.System.d |
| b7640 | 65 76 65 6c 6f 70 65 64 20 61 74 20 74 68 65 20 54 65 63 68 6e 6f 6c 6f 67 69 63 61 6c 20 55 6e | eveloped.at.the.Technological.Un |
| b7660 | 69 76 65 72 73 69 74 79 20 6f 66 0a 45 69 6e 64 68 6f 76 65 6e 20 61 6e 64 20 6e 61 6d 65 64 20 | iversity.of.Eindhoven.and.named. |
| b7680 | 66 6f 72 20 74 68 65 20 75 6e 69 76 65 72 73 69 74 79 27 73 20 69 6e 69 74 69 61 6c 73 20 69 6e | for.the.university's.initials.in |
| b76a0 | 20 44 75 74 63 68 20 28 44 69 6a 6b 73 74 72 61 0a 31 39 36 38 61 29 2e 20 20 54 68 65 20 61 63 | .Dutch.(Dijkstra.1968a)...The.ac |
| b76c0 | 71 75 69 72 65 20 61 6e 64 20 72 65 6c 65 61 73 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 65 72 | quire.and.release.operations.wer |
| b76e0 | 65 20 6f 72 69 67 69 6e 61 6c 6c 79 20 63 61 6c 6c 65 64 20 50 0a 61 6e 64 20 56 2c 20 66 72 6f | e.originally.called.P.and.V,.fro |
| b7700 | 6d 20 74 68 65 20 44 75 74 63 68 20 77 6f 72 64 73 20 5f 70 61 73 73 65 72 65 6e 5f 20 28 74 6f | m.the.Dutch.words._passeren_.(to |
| b7720 | 20 70 61 73 73 29 20 61 6e 64 20 5f 76 72 69 6a 67 65 76 65 6e 5f 20 28 74 6f 0a 72 65 6c 65 61 | .pass).and._vrijgeven_.(to.relea |
| b7740 | 73 65 29 2c 20 69 6e 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20 74 68 65 20 73 65 6d 61 70 68 6f | se),.in.reference.to.the.semapho |
| b7760 | 72 65 73 20 75 73 65 64 20 6f 6e 20 72 61 69 6c 72 6f 61 64 20 73 79 73 74 65 6d 73 2e 0a 44 69 | res.used.on.railroad.systems..Di |
| b7780 | 6a 6b 73 74 72 61 27 73 20 63 6c 61 73 73 69 63 20 65 78 70 6f 73 69 74 69 6f 6e 20 28 31 39 36 | jkstra's.classic.exposition.(196 |
| b77a0 | 38 62 29 20 77 61 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 74 6f 20 63 6c 65 61 | 8b).was.one.of.the.first.to.clea |
| b77c0 | 72 6c 79 0a 70 72 65 73 65 6e 74 20 74 68 65 20 69 73 73 75 65 73 20 6f 66 20 63 6f 6e 63 75 72 | rly.present.the.issues.of.concur |
| b77e0 | 72 65 6e 63 79 20 63 6f 6e 74 72 6f 6c 2c 20 61 6e 64 20 73 68 6f 77 65 64 20 68 6f 77 20 74 6f | rency.control,.and.showed.how.to |
| b7800 | 20 75 73 65 0a 73 65 6d 61 70 68 6f 72 65 73 20 74 6f 20 68 61 6e 64 6c 65 20 61 20 76 61 72 69 | .use.semaphores.to.handle.a.vari |
| b7820 | 65 74 79 20 6f 66 20 63 6f 6e 63 75 72 72 65 6e 63 79 20 70 72 6f 62 6c 65 6d 73 2e 0a 0a 20 20 | ety.of.concurrency.problems..... |
| b7840 | 20 28 36 29 20 49 6e 20 6d 6f 73 74 20 74 69 6d 65 2d 73 68 61 72 65 64 20 6f 70 65 72 61 74 69 | .(6).In.most.time-shared.operati |
| b7860 | 6e 67 20 73 79 73 74 65 6d 73 2c 20 70 72 6f 63 65 73 73 65 73 20 74 68 61 74 20 61 72 65 0a 62 | ng.systems,.processes.that.are.b |
| b7880 | 6c 6f 63 6b 65 64 20 62 79 20 61 20 6d 75 74 65 78 20 64 6f 20 6e 6f 74 20 77 61 73 74 65 20 74 | locked.by.a.mutex.do.not.waste.t |
| b78a0 | 69 6d 65 20 22 62 75 73 79 2d 77 61 69 74 69 6e 67 22 20 61 73 20 61 62 6f 76 65 2e 20 20 49 6e | ime."busy-waiting".as.above...In |
| b78c0 | 73 74 65 61 64 2c 0a 74 68 65 20 73 79 73 74 65 6d 20 73 63 68 65 64 75 6c 65 73 20 61 6e 6f 74 | stead,.the.system.schedules.anot |
| b78e0 | 68 65 72 20 70 72 6f 63 65 73 73 20 74 6f 20 72 75 6e 20 77 68 69 6c 65 20 74 68 65 20 66 69 72 | her.process.to.run.while.the.fir |
| b7900 | 73 74 20 69 73 20 77 61 69 74 69 6e 67 2c 0a 61 6e 64 20 74 68 65 20 62 6c 6f 63 6b 65 64 20 70 | st.is.waiting,.and.the.blocked.p |
| b7920 | 72 6f 63 65 73 73 20 69 73 20 61 77 61 6b 65 6e 65 64 20 77 68 65 6e 20 74 68 65 20 6d 75 74 65 | rocess.is.awakened.when.the.mute |
| b7940 | 78 20 62 65 63 6f 6d 65 73 20 61 76 61 69 6c 61 62 6c 65 2e 0a 0a 20 20 20 28 37 29 20 49 6e 20 | x.becomes.available......(7).In. |
| b7960 | 4d 49 54 20 53 63 68 65 6d 65 20 66 6f 72 20 61 20 73 69 6e 67 6c 65 20 70 72 6f 63 65 73 73 6f | MIT.Scheme.for.a.single.processo |
| b7980 | 72 2c 20 77 68 69 63 68 20 75 73 65 73 20 61 20 74 69 6d 65 2d 73 6c 69 63 69 6e 67 0a 6d 6f 64 | r,.which.uses.a.time-slicing.mod |
| b79a0 | 65 6c 2c 20 60 74 65 73 74 2d 61 6e 64 2d 73 65 74 21 27 20 63 61 6e 20 62 65 20 69 6d 70 6c 65 | el,.`test-and-set!'.can.be.imple |
| b79c0 | 6d 65 6e 74 65 64 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | mented.as.follows:.......(define |
| b79e0 | 20 28 74 65 73 74 2d 61 6e 64 2d 73 65 74 21 20 63 65 6c 6c 29 0a 20 20 20 20 20 20 20 28 77 69 | .(test-and-set!.cell)........(wi |
| b7a00 | 74 68 6f 75 74 2d 69 6e 74 65 72 72 75 70 74 73 0a 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 | thout-interrupts.........(lambda |
| b7a20 | 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 63 61 72 20 63 65 6c 6c 29 0a 20 20 20 | .()...........(if.(car.cell).... |
| b7a40 | 20 20 20 20 20 20 20 20 20 20 20 74 72 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 | ...........true...............(b |
| b7a60 | 65 67 69 6e 20 28 73 65 74 2d 63 61 72 21 20 63 65 6c 6c 20 74 72 75 65 29 0a 20 20 20 20 20 20 | egin.(set-car!.cell.true)....... |
| b7a80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 6c 73 65 29 29 29 29 29 0a 0a 20 20 20 60 57 | ...............false))))).....`W |
| b7aa0 | 69 74 68 6f 75 74 2d 69 6e 74 65 72 72 75 70 74 73 27 20 64 69 73 61 62 6c 65 73 20 74 69 6d 65 | ithout-interrupts'.disables.time |
| b7ac0 | 2d 73 6c 69 63 69 6e 67 20 69 6e 74 65 72 72 75 70 74 73 20 77 68 69 6c 65 20 69 74 73 0a 70 72 | -slicing.interrupts.while.its.pr |
| b7ae0 | 6f 63 65 64 75 72 65 20 61 72 67 75 6d 65 6e 74 20 69 73 20 62 65 69 6e 67 20 65 78 65 63 75 74 | ocedure.argument.is.being.execut |
| b7b00 | 65 64 2e 0a 0a 20 20 20 28 38 29 20 54 68 65 72 65 20 61 72 65 20 6d 61 6e 79 20 76 61 72 69 61 | ed......(8).There.are.many.varia |
| b7b20 | 6e 74 73 20 6f 66 20 73 75 63 68 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2d 2d 69 6e 63 6c 75 64 | nts.of.such.instructions--includ |
| b7b40 | 69 6e 67 0a 74 65 73 74 2d 61 6e 64 2d 73 65 74 2c 20 74 65 73 74 2d 61 6e 64 2d 63 6c 65 61 72 | ing.test-and-set,.test-and-clear |
| b7b60 | 2c 20 73 77 61 70 2c 20 63 6f 6d 70 61 72 65 2d 61 6e 64 2d 65 78 63 68 61 6e 67 65 2c 20 6c 6f | ,.swap,.compare-and-exchange,.lo |
| b7b80 | 61 64 2d 72 65 73 65 72 76 65 2c 0a 61 6e 64 20 73 74 6f 72 65 2d 63 6f 6e 64 69 74 69 6f 6e 61 | ad-reserve,.and.store-conditiona |
| b7ba0 | 6c 2d 2d 77 68 6f 73 65 20 64 65 73 69 67 6e 20 6d 75 73 74 20 62 65 20 63 61 72 65 66 75 6c 6c | l--whose.design.must.be.carefull |
| b7bc0 | 79 20 6d 61 74 63 68 65 64 20 74 6f 20 74 68 65 0a 6d 61 63 68 69 6e 65 27 73 20 70 72 6f 63 65 | y.matched.to.the.machine's.proce |
| b7be0 | 73 73 6f 72 2d 6d 65 6d 6f 72 79 20 69 6e 74 65 72 66 61 63 65 2e 20 20 4f 6e 65 20 69 73 73 75 | ssor-memory.interface...One.issu |
| b7c00 | 65 20 74 68 61 74 20 61 72 69 73 65 73 20 68 65 72 65 20 69 73 20 74 6f 0a 64 65 74 65 72 6d 69 | e.that.arises.here.is.to.determi |
| b7c20 | 6e 65 20 77 68 61 74 20 68 61 70 70 65 6e 73 20 69 66 20 74 77 6f 20 70 72 6f 63 65 73 73 65 73 | ne.what.happens.if.two.processes |
| b7c40 | 20 61 74 74 65 6d 70 74 20 74 6f 20 61 63 71 75 69 72 65 20 74 68 65 20 73 61 6d 65 0a 72 65 73 | .attempt.to.acquire.the.same.res |
| b7c60 | 6f 75 72 63 65 20 61 74 20 65 78 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20 74 69 6d 65 20 62 | ource.at.exactly.the.same.time.b |
| b7c80 | 79 20 75 73 69 6e 67 20 73 75 63 68 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 2e 20 20 54 68 | y.using.such.an.instruction...Th |
| b7ca0 | 69 73 0a 72 65 71 75 69 72 65 73 20 73 6f 6d 65 20 6d 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 6d | is.requires.some.mechanism.for.m |
| b7cc0 | 61 6b 69 6e 67 20 61 20 64 65 63 69 73 69 6f 6e 20 61 62 6f 75 74 20 77 68 69 63 68 20 70 72 6f | aking.a.decision.about.which.pro |
| b7ce0 | 63 65 73 73 20 67 65 74 73 0a 63 6f 6e 74 72 6f 6c 2e 20 20 53 75 63 68 20 61 20 6d 65 63 68 61 | cess.gets.control...Such.a.mecha |
| b7d00 | 6e 69 73 6d 20 69 73 20 63 61 6c 6c 65 64 20 61 6e 20 22 61 72 62 69 74 65 72 22 2e 20 20 41 72 | nism.is.called.an."arbiter"...Ar |
| b7d20 | 62 69 74 65 72 73 20 75 73 75 61 6c 6c 79 0a 62 6f 69 6c 20 64 6f 77 6e 20 74 6f 20 73 6f 6d 65 | biters.usually.boil.down.to.some |
| b7d40 | 20 73 6f 72 74 20 6f 66 20 68 61 72 64 77 61 72 65 20 64 65 76 69 63 65 2e 20 20 55 6e 66 6f 72 | .sort.of.hardware.device...Unfor |
| b7d60 | 74 75 6e 61 74 65 6c 79 2c 20 69 74 20 69 73 0a 70 6f 73 73 69 62 6c 65 20 74 6f 20 70 72 6f 76 | tunately,.it.is.possible.to.prov |
| b7d80 | 65 20 74 68 61 74 20 6f 6e 65 20 63 61 6e 6e 6f 74 20 70 68 79 73 69 63 61 6c 6c 79 20 63 6f 6e | e.that.one.cannot.physically.con |
| b7da0 | 73 74 72 75 63 74 20 61 20 66 61 69 72 20 61 72 62 69 74 65 72 0a 74 68 61 74 20 77 6f 72 6b 73 | struct.a.fair.arbiter.that.works |
| b7dc0 | 20 31 30 30 25 20 6f 66 20 74 68 65 20 74 69 6d 65 20 75 6e 6c 65 73 73 20 6f 6e 65 20 61 6c 6c | .100%.of.the.time.unless.one.all |
| b7de0 | 6f 77 73 20 74 68 65 20 61 72 62 69 74 65 72 20 61 6e 0a 61 72 62 69 74 72 61 72 69 6c 79 20 6c | ows.the.arbiter.an.arbitrarily.l |
| b7e00 | 6f 6e 67 20 74 69 6d 65 20 74 6f 20 6d 61 6b 65 20 69 74 73 20 64 65 63 69 73 69 6f 6e 2e 20 20 | ong.time.to.make.its.decision... |
| b7e20 | 54 68 65 20 66 75 6e 64 61 6d 65 6e 74 61 6c 20 70 68 65 6e 6f 6d 65 6e 6f 6e 0a 68 65 72 65 20 | The.fundamental.phenomenon.here. |
| b7e40 | 77 61 73 20 6f 72 69 67 69 6e 61 6c 6c 79 20 6f 62 73 65 72 76 65 64 20 62 79 20 74 68 65 20 66 | was.originally.observed.by.the.f |
| b7e60 | 6f 75 72 74 65 65 6e 74 68 2d 63 65 6e 74 75 72 79 20 46 72 65 6e 63 68 0a 70 68 69 6c 6f 73 6f | ourteenth-century.French.philoso |
| b7e80 | 70 68 65 72 20 4a 65 61 6e 20 42 75 72 69 64 61 6e 20 69 6e 20 68 69 73 20 63 6f 6d 6d 65 6e 74 | pher.Jean.Buridan.in.his.comment |
| b7ea0 | 61 72 79 20 6f 6e 20 41 72 69 73 74 6f 74 6c 65 27 73 20 44 65 20 63 61 65 6c 6f 2e 0a 42 75 72 | ary.on.Aristotle's.De.caelo..Bur |
| b7ec0 | 69 64 61 6e 20 61 72 67 75 65 64 20 74 68 61 74 20 61 20 70 65 72 66 65 63 74 6c 79 20 72 61 74 | idan.argued.that.a.perfectly.rat |
| b7ee0 | 69 6f 6e 61 6c 20 64 6f 67 20 70 6c 61 63 65 64 20 62 65 74 77 65 65 6e 20 74 77 6f 20 65 71 75 | ional.dog.placed.between.two.equ |
| b7f00 | 61 6c 6c 79 0a 61 74 74 72 61 63 74 69 76 65 20 73 6f 75 72 63 65 73 20 6f 66 20 66 6f 6f 64 20 | ally.attractive.sources.of.food. |
| b7f20 | 77 69 6c 6c 20 73 74 61 72 76 65 20 74 6f 20 64 65 61 74 68 2c 20 62 65 63 61 75 73 65 20 69 74 | will.starve.to.death,.because.it |
| b7f40 | 20 69 73 0a 69 6e 63 61 70 61 62 6c 65 20 6f 66 20 64 65 63 69 64 69 6e 67 20 77 68 69 63 68 20 | .is.incapable.of.deciding.which. |
| b7f60 | 74 6f 20 67 6f 20 74 6f 20 66 69 72 73 74 2e 0a 0a 20 20 20 28 39 29 20 54 68 65 20 67 65 6e 65 | to.go.to.first......(9).The.gene |
| b7f80 | 72 61 6c 20 74 65 63 68 6e 69 71 75 65 20 66 6f 72 20 61 76 6f 69 64 69 6e 67 20 64 65 61 64 6c | ral.technique.for.avoiding.deadl |
| b7fa0 | 6f 63 6b 20 62 79 20 6e 75 6d 62 65 72 69 6e 67 20 74 68 65 0a 73 68 61 72 65 64 20 72 65 73 6f | ock.by.numbering.the.shared.reso |
| b7fc0 | 75 72 63 65 73 20 61 6e 64 20 61 63 71 75 69 72 69 6e 67 20 74 68 65 6d 20 69 6e 20 6f 72 64 65 | urces.and.acquiring.them.in.orde |
| b7fe0 | 72 20 69 73 20 64 75 65 20 74 6f 20 48 61 76 65 6e 64 65 72 20 28 31 39 36 38 29 2e 0a 53 69 74 | r.is.due.to.Havender.(1968)..Sit |
| b8000 | 75 61 74 69 6f 6e 73 20 77 68 65 72 65 20 64 65 61 64 6c 6f 63 6b 20 63 61 6e 6e 6f 74 20 62 65 | uations.where.deadlock.cannot.be |
| b8020 | 20 61 76 6f 69 64 65 64 20 72 65 71 75 69 72 65 20 22 64 65 61 64 6c 6f 63 6b 2d 72 65 63 6f 76 | .avoided.require."deadlock-recov |
| b8040 | 65 72 79 22 0a 6d 65 74 68 6f 64 73 2c 20 77 68 69 63 68 20 65 6e 74 61 69 6c 20 68 61 76 69 6e | ery".methods,.which.entail.havin |
| b8060 | 67 20 70 72 6f 63 65 73 73 65 73 20 22 62 61 63 6b 20 6f 75 74 22 20 6f 66 20 74 68 65 20 64 65 | g.processes."back.out".of.the.de |
| b8080 | 61 64 6c 6f 63 6b 65 64 0a 73 74 61 74 65 20 61 6e 64 20 74 72 79 20 61 67 61 69 6e 2e 20 20 44 | adlocked.state.and.try.again...D |
| b80a0 | 65 61 64 6c 6f 63 6b 2d 72 65 63 6f 76 65 72 79 20 6d 65 63 68 61 6e 69 73 6d 73 20 61 72 65 20 | eadlock-recovery.mechanisms.are. |
| b80c0 | 77 69 64 65 6c 79 20 75 73 65 64 20 69 6e 0a 64 61 74 61 62 61 73 65 20 6d 61 6e 61 67 65 6d 65 | widely.used.in.database.manageme |
| b80e0 | 6e 74 20 73 79 73 74 65 6d 73 2c 20 61 20 74 6f 70 69 63 20 74 68 61 74 20 69 73 20 74 72 65 61 | nt.systems,.a.topic.that.is.trea |
| b8100 | 74 65 64 20 69 6e 20 64 65 74 61 69 6c 20 69 6e 20 47 72 61 79 0a 61 6e 64 20 52 65 75 74 65 72 | ted.in.detail.in.Gray.and.Reuter |
| b8120 | 20 31 39 39 33 2e 0a 0a 20 20 20 28 31 30 29 20 4f 6e 65 20 73 75 63 68 20 61 6c 74 65 72 6e 61 | .1993......(10).One.such.alterna |
| b8140 | 74 69 76 65 20 74 6f 20 73 65 72 69 61 6c 69 7a 61 74 69 6f 6e 20 69 73 20 63 61 6c 6c 65 64 20 | tive.to.serialization.is.called. |
| b8160 | 22 62 61 72 72 69 65 72 0a 73 79 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 22 2e 20 20 54 68 65 20 | "barrier.synchronization"...The. |
| b8180 | 70 72 6f 67 72 61 6d 6d 65 72 20 70 65 72 6d 69 74 73 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 | programmer.permits.concurrent.pr |
| b81a0 | 6f 63 65 73 73 65 73 20 74 6f 0a 65 78 65 63 75 74 65 20 61 73 20 74 68 65 79 20 70 6c 65 61 73 | ocesses.to.execute.as.they.pleas |
| b81c0 | 65 2c 20 62 75 74 20 65 73 74 61 62 6c 69 73 68 65 73 20 63 65 72 74 61 69 6e 20 73 79 6e 63 68 | e,.but.establishes.certain.synch |
| b81e0 | 72 6f 6e 69 7a 61 74 69 6f 6e 20 70 6f 69 6e 74 73 0a 28 22 62 61 72 72 69 65 72 73 22 29 20 74 | ronization.points.("barriers").t |
| b8200 | 68 72 6f 75 67 68 20 77 68 69 63 68 20 6e 6f 20 70 72 6f 63 65 73 73 20 63 61 6e 20 70 72 6f 63 | hrough.which.no.process.can.proc |
| b8220 | 65 65 64 20 75 6e 74 69 6c 20 61 6c 6c 20 74 68 65 0a 70 72 6f 63 65 73 73 65 73 20 68 61 76 65 | eed.until.all.the.processes.have |
| b8240 | 20 72 65 61 63 68 65 64 20 74 68 65 20 62 61 72 72 69 65 72 2e 20 20 4d 6f 64 65 72 6e 20 70 72 | .reached.the.barrier...Modern.pr |
| b8260 | 6f 63 65 73 73 6f 72 73 20 70 72 6f 76 69 64 65 20 6d 61 63 68 69 6e 65 0a 69 6e 73 74 72 75 63 | ocessors.provide.machine.instruc |
| b8280 | 74 69 6f 6e 73 20 74 68 61 74 20 70 65 72 6d 69 74 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 74 6f | tions.that.permit.programmers.to |
| b82a0 | 20 65 73 74 61 62 6c 69 73 68 20 73 79 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 0a 70 6f 69 6e 74 | .establish.synchronization.point |
| b82c0 | 73 20 61 74 20 70 6c 61 63 65 73 20 77 68 65 72 65 20 63 6f 6e 73 69 73 74 65 6e 63 79 20 69 73 | s.at.places.where.consistency.is |
| b82e0 | 20 72 65 71 75 69 72 65 64 2e 20 20 54 68 65 20 50 6f 77 65 72 50 43 5e 28 20 54 4d 29 2c 20 66 | .required...The.PowerPC^(.TM),.f |
| b8300 | 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 69 6e 63 6c 75 64 65 73 20 66 6f 72 20 74 68 69 73 20 70 75 | or.example,.includes.for.this.pu |
| b8320 | 72 70 6f 73 65 20 74 77 6f 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 63 61 6c 6c 65 64 20 53 59 | rpose.two.instructions.called.SY |
| b8340 | 4e 43 20 61 6e 64 0a 45 49 45 49 4f 20 28 45 6e 66 6f 72 63 65 64 20 49 6e 2d 6f 72 64 65 72 20 | NC.and.EIEIO.(Enforced.In-order. |
| b8360 | 45 78 65 63 75 74 69 6f 6e 20 6f 66 20 49 6e 70 75 74 2f 4f 75 74 70 75 74 29 2e 0a 0a 20 20 20 | Execution.of.Input/Output)...... |
| b8380 | 28 31 31 29 20 54 68 69 73 20 6d 61 79 20 73 65 65 6d 20 6c 69 6b 65 20 61 20 73 74 72 61 6e 67 | (11).This.may.seem.like.a.strang |
| b83a0 | 65 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 2c 20 62 75 74 20 74 68 65 72 65 20 61 72 65 0a 73 | e.point.of.view,.but.there.are.s |
| b83c0 | 79 73 74 65 6d 73 20 74 68 61 74 20 77 6f 72 6b 20 74 68 69 73 20 77 61 79 2e 20 20 49 6e 74 65 | ystems.that.work.this.way...Inte |
| b83e0 | 72 6e 61 74 69 6f 6e 61 6c 20 63 68 61 72 67 65 73 20 74 6f 20 63 72 65 64 69 74 2d 63 61 72 64 | rnational.charges.to.credit-card |
| b8400 | 0a 61 63 63 6f 75 6e 74 73 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 72 65 20 6e 6f 72 6d | .accounts,.for.example,.are.norm |
| b8420 | 61 6c 6c 79 20 63 6c 65 61 72 65 64 20 6f 6e 20 61 20 70 65 72 2d 63 6f 75 6e 74 72 79 20 62 61 | ally.cleared.on.a.per-country.ba |
| b8440 | 73 69 73 2c 20 61 6e 64 0a 74 68 65 20 63 68 61 72 67 65 73 20 6d 61 64 65 20 69 6e 20 64 69 66 | sis,.and.the.charges.made.in.dif |
| b8460 | 66 65 72 65 6e 74 20 63 6f 75 6e 74 72 69 65 73 20 61 72 65 20 70 65 72 69 6f 64 69 63 61 6c 6c | ferent.countries.are.periodicall |
| b8480 | 79 20 72 65 63 6f 6e 63 69 6c 65 64 2e 0a 54 68 75 73 20 74 68 65 20 61 63 63 6f 75 6e 74 20 62 | y.reconciled..Thus.the.account.b |
| b84a0 | 61 6c 61 6e 63 65 20 6d 61 79 20 62 65 20 64 69 66 66 65 72 65 6e 74 20 69 6e 20 64 69 66 66 65 | alance.may.be.different.in.diffe |
| b84c0 | 72 65 6e 74 20 63 6f 75 6e 74 72 69 65 73 2e 0a 0a 20 20 20 28 31 32 29 20 46 6f 72 20 64 69 73 | rent.countries......(12).For.dis |
| b84e0 | 74 72 69 62 75 74 65 64 20 73 79 73 74 65 6d 73 2c 20 74 68 69 73 20 70 65 72 73 70 65 63 74 69 | tributed.systems,.this.perspecti |
| b8500 | 76 65 20 77 61 73 20 70 75 72 73 75 65 64 20 62 79 0a 4c 61 6d 70 6f 72 74 20 28 31 39 37 38 29 | ve.was.pursued.by.Lamport.(1978) |
| b8520 | 2c 20 77 68 6f 20 73 68 6f 77 65 64 20 68 6f 77 20 74 6f 20 75 73 65 20 63 6f 6d 6d 75 6e 69 63 | ,.who.showed.how.to.use.communic |
| b8540 | 61 74 69 6f 6e 20 74 6f 20 65 73 74 61 62 6c 69 73 68 0a 22 67 6c 6f 62 61 6c 20 63 6c 6f 63 6b | ation.to.establish."global.clock |
| b8560 | 73 22 20 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 65 73 74 61 62 6c 69 73 68 | s".that.can.be.used.to.establish |
| b8580 | 20 6f 72 64 65 72 69 6e 67 73 20 6f 6e 20 65 76 65 6e 74 73 20 69 6e 0a 64 69 73 74 72 69 62 75 | .orderings.on.events.in.distribu |
| b85a0 | 74 65 64 20 73 79 73 74 65 6d 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c | ted.systems.....File:.sicp.info, |
| b85c0 | 20 20 4e 6f 64 65 3a 20 33 2d 35 2c 20 20 50 72 65 76 3a 20 33 2d 34 2c 20 20 55 70 3a 20 43 68 | ..Node:.3-5,..Prev:.3-4,..Up:.Ch |
| b85e0 | 61 70 74 65 72 20 33 0a 0a 33 2e 35 20 53 74 72 65 61 6d 73 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | apter.3..3.5.Streams.=========== |
| b8600 | 0a 0a 57 65 27 76 65 20 67 61 69 6e 65 64 20 61 20 67 6f 6f 64 20 75 6e 64 65 72 73 74 61 6e 64 | ..We've.gained.a.good.understand |
| b8620 | 69 6e 67 20 6f 66 20 61 73 73 69 67 6e 6d 65 6e 74 20 61 73 20 61 20 74 6f 6f 6c 20 69 6e 20 6d | ing.of.assignment.as.a.tool.in.m |
| b8640 | 6f 64 65 6c 69 6e 67 2c 0a 61 73 20 77 65 6c 6c 20 61 73 20 61 6e 20 61 70 70 72 65 63 69 61 74 | odeling,.as.well.as.an.appreciat |
| b8660 | 69 6f 6e 20 6f 66 20 74 68 65 20 63 6f 6d 70 6c 65 78 20 70 72 6f 62 6c 65 6d 73 20 74 68 61 74 | ion.of.the.complex.problems.that |
| b8680 | 20 61 73 73 69 67 6e 6d 65 6e 74 0a 72 61 69 73 65 73 2e 20 49 74 20 69 73 20 74 69 6d 65 20 74 | .assignment.raises..It.is.time.t |
| b86a0 | 6f 20 61 73 6b 20 77 68 65 74 68 65 72 20 77 65 20 63 6f 75 6c 64 20 68 61 76 65 20 67 6f 6e 65 | o.ask.whether.we.could.have.gone |
| b86c0 | 20 61 62 6f 75 74 20 74 68 69 6e 67 73 20 69 6e 20 61 0a 64 69 66 66 65 72 65 6e 74 20 77 61 79 | .about.things.in.a.different.way |
| b86e0 | 2c 20 73 6f 20 61 73 20 74 6f 20 61 76 6f 69 64 20 73 6f 6d 65 20 6f 66 20 74 68 65 73 65 20 70 | ,.so.as.to.avoid.some.of.these.p |
| b8700 | 72 6f 62 6c 65 6d 73 2e 20 20 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 0a 77 65 20 65 78 | roblems...In.this.section,.we.ex |
| b8720 | 70 6c 6f 72 65 20 61 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 61 70 70 72 6f 61 63 68 20 74 6f | plore.an.alternative.approach.to |
| b8740 | 20 6d 6f 64 65 6c 69 6e 67 20 73 74 61 74 65 2c 20 62 61 73 65 64 20 6f 6e 20 64 61 74 61 0a 73 | .modeling.state,.based.on.data.s |
| b8760 | 74 72 75 63 74 75 72 65 73 20 63 61 6c 6c 65 64 20 22 73 74 72 65 61 6d 73 22 2e 20 20 41 73 20 | tructures.called."streams"...As. |
| b8780 | 77 65 20 73 68 61 6c 6c 20 73 65 65 2c 20 73 74 72 65 61 6d 73 20 63 61 6e 20 6d 69 74 69 67 61 | we.shall.see,.streams.can.mitiga |
| b87a0 | 74 65 0a 73 6f 6d 65 20 6f 66 20 74 68 65 20 63 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 6d 6f 64 | te.some.of.the.complexity.of.mod |
| b87c0 | 65 6c 69 6e 67 20 73 74 61 74 65 2e 0a 0a 20 20 20 4c 65 74 27 73 20 73 74 65 70 20 62 61 63 6b | eling.state......Let's.step.back |
| b87e0 | 20 61 6e 64 20 72 65 76 69 65 77 20 77 68 65 72 65 20 74 68 69 73 20 63 6f 6d 70 6c 65 78 69 74 | .and.review.where.this.complexit |
| b8800 | 79 20 63 6f 6d 65 73 20 66 72 6f 6d 2e 20 20 49 6e 20 61 6e 0a 61 74 74 65 6d 70 74 20 74 6f 20 | y.comes.from...In.an.attempt.to. |
| b8820 | 6d 6f 64 65 6c 20 72 65 61 6c 2d 77 6f 72 6c 64 20 70 68 65 6e 6f 6d 65 6e 61 2c 20 77 65 20 6d | model.real-world.phenomena,.we.m |
| b8840 | 61 64 65 20 73 6f 6d 65 20 61 70 70 61 72 65 6e 74 6c 79 0a 72 65 61 73 6f 6e 61 62 6c 65 20 64 | ade.some.apparently.reasonable.d |
| b8860 | 65 63 69 73 69 6f 6e 73 3a 20 57 65 20 6d 6f 64 65 6c 65 64 20 72 65 61 6c 2d 77 6f 72 6c 64 20 | ecisions:.We.modeled.real-world. |
| b8880 | 6f 62 6a 65 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 62 79 0a 63 6f 6d 70 | objects.with.local.state.by.comp |
| b88a0 | 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 20 76 61 72 | utational.objects.with.local.var |
| b88c0 | 69 61 62 6c 65 73 2e 20 20 57 65 20 69 64 65 6e 74 69 66 69 65 64 20 74 69 6d 65 0a 76 61 72 69 | iables...We.identified.time.vari |
| b88e0 | 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 72 65 61 6c 20 77 6f 72 6c 64 20 77 69 74 68 20 74 69 6d | ation.in.the.real.world.with.tim |
| b8900 | 65 20 76 61 72 69 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 63 6f 6d 70 75 74 65 72 2e 20 20 57 65 | e.variation.in.the.computer...We |
| b8920 | 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 74 68 65 20 74 69 6d 65 20 76 61 72 69 61 74 69 6f 6e 20 | .implemented.the.time.variation. |
| b8940 | 6f 66 20 74 68 65 20 73 74 61 74 65 73 20 6f 66 20 74 68 65 20 6d 6f 64 65 6c 20 6f 62 6a 65 63 | of.the.states.of.the.model.objec |
| b8960 | 74 73 20 69 6e 0a 74 68 65 20 63 6f 6d 70 75 74 65 72 20 77 69 74 68 20 61 73 73 69 67 6e 6d 65 | ts.in.the.computer.with.assignme |
| b8980 | 6e 74 73 20 74 6f 20 74 68 65 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 20 6f 66 20 74 68 | nts.to.the.local.variables.of.th |
| b89a0 | 65 20 6d 6f 64 65 6c 0a 6f 62 6a 65 63 74 73 2e 0a 0a 20 20 20 49 73 20 74 68 65 72 65 20 61 6e | e.model.objects......Is.there.an |
| b89c0 | 6f 74 68 65 72 20 61 70 70 72 6f 61 63 68 3f 20 20 43 61 6e 20 77 65 20 61 76 6f 69 64 20 69 64 | other.approach?..Can.we.avoid.id |
| b89e0 | 65 6e 74 69 66 79 69 6e 67 20 74 69 6d 65 20 69 6e 20 74 68 65 0a 63 6f 6d 70 75 74 65 72 20 77 | entifying.time.in.the.computer.w |
| b8a00 | 69 74 68 20 74 69 6d 65 20 69 6e 20 74 68 65 20 6d 6f 64 65 6c 65 64 20 77 6f 72 6c 64 3f 20 20 | ith.time.in.the.modeled.world?.. |
| b8a20 | 4d 75 73 74 20 77 65 20 6d 61 6b 65 20 74 68 65 20 6d 6f 64 65 6c 20 63 68 61 6e 67 65 0a 77 69 | Must.we.make.the.model.change.wi |
| b8a40 | 74 68 20 74 69 6d 65 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 6d 6f 64 65 6c 20 70 68 65 6e 6f 6d | th.time.in.order.to.model.phenom |
| b8a60 | 65 6e 61 20 69 6e 20 61 20 63 68 61 6e 67 69 6e 67 20 77 6f 72 6c 64 3f 20 20 54 68 69 6e 6b 20 | ena.in.a.changing.world?..Think. |
| b8a80 | 61 62 6f 75 74 0a 74 68 65 20 69 73 73 75 65 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6d 61 74 68 | about.the.issue.in.terms.of.math |
| b8aa0 | 65 6d 61 74 69 63 61 6c 20 66 75 6e 63 74 69 6f 6e 73 2e 20 20 57 65 20 63 61 6e 20 64 65 73 63 | ematical.functions...We.can.desc |
| b8ac0 | 72 69 62 65 20 74 68 65 0a 74 69 6d 65 2d 76 61 72 79 69 6e 67 20 62 65 68 61 76 69 6f 72 20 6f | ribe.the.time-varying.behavior.o |
| b8ae0 | 66 20 61 20 71 75 61 6e 74 69 74 79 20 78 20 61 73 20 61 20 66 75 6e 63 74 69 6f 6e 20 6f 66 20 | f.a.quantity.x.as.a.function.of. |
| b8b00 | 74 69 6d 65 20 78 28 74 29 2e 20 20 49 66 0a 77 65 20 63 6f 6e 63 65 6e 74 72 61 74 65 20 6f 6e | time.x(t)...If.we.concentrate.on |
| b8b20 | 20 78 20 69 6e 73 74 61 6e 74 20 62 79 20 69 6e 73 74 61 6e 74 2c 20 77 65 20 74 68 69 6e 6b 20 | .x.instant.by.instant,.we.think. |
| b8b40 | 6f 66 20 69 74 20 61 73 20 61 20 63 68 61 6e 67 69 6e 67 0a 71 75 61 6e 74 69 74 79 2e 20 20 59 | of.it.as.a.changing.quantity...Y |
| b8b60 | 65 74 20 69 66 20 77 65 20 63 6f 6e 63 65 6e 74 72 61 74 65 20 6f 6e 20 74 68 65 20 65 6e 74 69 | et.if.we.concentrate.on.the.enti |
| b8b80 | 72 65 20 74 69 6d 65 20 68 69 73 74 6f 72 79 20 6f 66 20 76 61 6c 75 65 73 2c 0a 77 65 20 64 6f | re.time.history.of.values,.we.do |
| b8ba0 | 20 6e 6f 74 20 65 6d 70 68 61 73 69 7a 65 20 63 68 61 6e 67 65 2d 2d 74 68 65 20 66 75 6e 63 74 | .not.emphasize.change--the.funct |
| b8bc0 | 69 6f 6e 20 69 74 73 65 6c 66 20 64 6f 65 73 20 6e 6f 74 20 63 68 61 6e 67 65 2e 28 31 29 0a 0a | ion.itself.does.not.change.(1).. |
| b8be0 | 20 20 20 49 66 20 74 69 6d 65 20 69 73 20 6d 65 61 73 75 72 65 64 20 69 6e 20 64 69 73 63 72 65 | ...If.time.is.measured.in.discre |
| b8c00 | 74 65 20 73 74 65 70 73 2c 20 74 68 65 6e 20 77 65 20 63 61 6e 20 6d 6f 64 65 6c 20 61 20 74 69 | te.steps,.then.we.can.model.a.ti |
| b8c20 | 6d 65 0a 66 75 6e 63 74 69 6f 6e 20 61 73 20 61 20 28 70 6f 73 73 69 62 6c 79 20 69 6e 66 69 6e | me.function.as.a.(possibly.infin |
| b8c40 | 69 74 65 29 20 73 65 71 75 65 6e 63 65 2e 20 20 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c | ite).sequence...In.this.section, |
| b8c60 | 20 77 65 20 77 69 6c 6c 0a 73 65 65 20 68 6f 77 20 74 6f 20 6d 6f 64 65 6c 20 63 68 61 6e 67 65 | .we.will.see.how.to.model.change |
| b8c80 | 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 73 65 71 75 65 6e 63 65 73 20 74 68 61 74 20 72 65 70 72 | .in.terms.of.sequences.that.repr |
| b8ca0 | 65 73 65 6e 74 20 74 68 65 20 74 69 6d 65 0a 68 69 73 74 6f 72 69 65 73 20 6f 66 20 74 68 65 20 | esent.the.time.histories.of.the. |
| b8cc0 | 73 79 73 74 65 6d 73 20 62 65 69 6e 67 20 6d 6f 64 65 6c 65 64 2e 20 20 54 6f 20 61 63 63 6f 6d | systems.being.modeled...To.accom |
| b8ce0 | 70 6c 69 73 68 20 74 68 69 73 2c 20 77 65 0a 69 6e 74 72 6f 64 75 63 65 20 6e 65 77 20 64 61 74 | plish.this,.we.introduce.new.dat |
| b8d00 | 61 20 73 74 72 75 63 74 75 72 65 73 20 63 61 6c 6c 65 64 20 22 73 74 72 65 61 6d 73 22 2e 20 20 | a.structures.called."streams"... |
| b8d20 | 46 72 6f 6d 20 61 6e 20 61 62 73 74 72 61 63 74 20 70 6f 69 6e 74 0a 6f 66 20 76 69 65 77 2c 20 | From.an.abstract.point.of.view,. |
| b8d40 | 61 20 73 74 72 65 61 6d 20 69 73 20 73 69 6d 70 6c 79 20 61 20 73 65 71 75 65 6e 63 65 2e 20 20 | a.stream.is.simply.a.sequence... |
| b8d60 | 48 6f 77 65 76 65 72 2c 20 77 65 20 77 69 6c 6c 20 66 69 6e 64 20 74 68 61 74 20 74 68 65 0a 73 | However,.we.will.find.that.the.s |
| b8d80 | 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 | traightforward.implementation.of |
| b8da0 | 20 73 74 72 65 61 6d 73 20 61 73 20 6c 69 73 74 73 20 28 61 73 20 69 6e 20 73 65 63 74 69 6f 6e | .streams.as.lists.(as.in.section |
| b8dc0 | 20 2a 4e 6f 74 65 0a 32 2d 32 2d 31 3a 3a 29 20 64 6f 65 73 6e 27 74 20 66 75 6c 6c 79 20 72 65 | .*Note.2-2-1::).doesn't.fully.re |
| b8de0 | 76 65 61 6c 20 74 68 65 20 70 6f 77 65 72 20 6f 66 20 73 74 72 65 61 6d 20 70 72 6f 63 65 73 73 | veal.the.power.of.stream.process |
| b8e00 | 69 6e 67 2e 20 20 41 73 20 61 6e 0a 61 6c 74 65 72 6e 61 74 69 76 65 2c 20 77 65 20 69 6e 74 72 | ing...As.an.alternative,.we.intr |
| b8e20 | 6f 64 75 63 65 20 74 68 65 20 74 65 63 68 6e 69 71 75 65 20 6f 66 20 22 64 65 6c 61 79 65 64 20 | oduce.the.technique.of."delayed. |
| b8e40 | 65 76 61 6c 75 61 74 69 6f 6e 22 2c 20 77 68 69 63 68 0a 65 6e 61 62 6c 65 73 20 75 73 20 74 6f | evaluation",.which.enables.us.to |
| b8e60 | 20 72 65 70 72 65 73 65 6e 74 20 76 65 72 79 20 6c 61 72 67 65 20 28 65 76 65 6e 20 69 6e 66 69 | .represent.very.large.(even.infi |
| b8e80 | 6e 69 74 65 29 20 73 65 71 75 65 6e 63 65 73 20 61 73 20 73 74 72 65 61 6d 73 2e 0a 0a 20 20 20 | nite).sequences.as.streams...... |
| b8ea0 | 53 74 72 65 61 6d 20 70 72 6f 63 65 73 73 69 6e 67 20 6c 65 74 73 20 75 73 20 6d 6f 64 65 6c 20 | Stream.processing.lets.us.model. |
| b8ec0 | 73 79 73 74 65 6d 73 20 74 68 61 74 20 68 61 76 65 20 73 74 61 74 65 20 77 69 74 68 6f 75 74 20 | systems.that.have.state.without. |
| b8ee0 | 65 76 65 72 0a 75 73 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e 74 20 6f 72 20 6d 75 74 61 62 6c 65 | ever.using.assignment.or.mutable |
| b8f00 | 20 64 61 74 61 2e 20 20 54 68 69 73 20 68 61 73 20 69 6d 70 6f 72 74 61 6e 74 20 69 6d 70 6c 69 | .data...This.has.important.impli |
| b8f20 | 63 61 74 69 6f 6e 73 2c 0a 62 6f 74 68 20 74 68 65 6f 72 65 74 69 63 61 6c 20 61 6e 64 20 70 72 | cations,.both.theoretical.and.pr |
| b8f40 | 61 63 74 69 63 61 6c 2c 20 62 65 63 61 75 73 65 20 77 65 20 63 61 6e 20 62 75 69 6c 64 20 6d 6f | actical,.because.we.can.build.mo |
| b8f60 | 64 65 6c 73 20 74 68 61 74 20 61 76 6f 69 64 0a 74 68 65 20 64 72 61 77 62 61 63 6b 73 20 69 6e | dels.that.avoid.the.drawbacks.in |
| b8f80 | 68 65 72 65 6e 74 20 69 6e 20 69 6e 74 72 6f 64 75 63 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e 74 | herent.in.introducing.assignment |
| b8fa0 | 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 0a 74 68 65 20 73 74 72 65 61 6d | ...On.the.other.hand,.the.stream |
| b8fc0 | 20 66 72 61 6d 65 77 6f 72 6b 20 72 61 69 73 65 73 20 64 69 66 66 69 63 75 6c 74 69 65 73 20 6f | .framework.raises.difficulties.o |
| b8fe0 | 66 20 69 74 73 20 6f 77 6e 2c 20 61 6e 64 20 74 68 65 20 71 75 65 73 74 69 6f 6e 0a 6f 66 20 77 | f.its.own,.and.the.question.of.w |
| b9000 | 68 69 63 68 20 6d 6f 64 65 6c 69 6e 67 20 74 65 63 68 6e 69 71 75 65 20 6c 65 61 64 73 20 74 6f | hich.modeling.technique.leads.to |
| b9020 | 20 6d 6f 72 65 20 6d 6f 64 75 6c 61 72 20 61 6e 64 20 6d 6f 72 65 20 65 61 73 69 6c 79 0a 6d 61 | .more.modular.and.more.easily.ma |
| b9040 | 69 6e 74 61 69 6e 65 64 20 73 79 73 74 65 6d 73 20 72 65 6d 61 69 6e 73 20 6f 70 65 6e 2e 0a 0a | intained.systems.remains.open... |
| b9060 | 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 33 2d 35 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 53 74 | *.Menu:..*.3-5-1::............St |
| b9080 | 72 65 61 6d 73 20 41 72 65 20 44 65 6c 61 79 65 64 20 4c 69 73 74 73 0a 2a 20 33 2d 35 2d 32 3a | reams.Are.Delayed.Lists.*.3-5-2: |
| b90a0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 49 6e 66 69 6e 69 74 65 20 53 74 72 65 61 6d 73 0a 2a 20 | :............Infinite.Streams.*. |
| b90c0 | 33 2d 35 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 45 78 70 6c 6f 69 74 69 6e 67 20 74 68 | 3-5-3::............Exploiting.th |
| b90e0 | 65 20 53 74 72 65 61 6d 20 50 61 72 61 64 69 67 6d 0a 2a 20 33 2d 35 2d 34 3a 3a 20 20 20 20 20 | e.Stream.Paradigm.*.3-5-4::..... |
| b9100 | 20 20 20 20 20 20 20 53 74 72 65 61 6d 73 20 61 6e 64 20 44 65 6c 61 79 65 64 20 45 76 61 6c 75 | .......Streams.and.Delayed.Evalu |
| b9120 | 61 74 69 6f 6e 0a 2a 20 33 2d 35 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4d 6f 64 75 6c | ation.*.3-5-5::............Modul |
| b9140 | 61 72 69 74 79 20 6f 66 20 46 75 6e 63 74 69 6f 6e 61 6c 20 50 72 6f 67 72 61 6d 73 20 61 6e 64 | arity.of.Functional.Programs.and |
| b9160 | 20 4d 6f 64 75 6c 61 72 69 74 79 20 6f 66 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .Modularity.of.................. |
| b9180 | 20 20 20 20 4f 62 6a 65 63 74 73 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e | ....Objects.....----------.Footn |
| b91a0 | 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 50 68 79 73 69 63 69 73 | otes.----------.....(1).Physicis |
| b91c0 | 74 73 20 73 6f 6d 65 74 69 6d 65 73 20 61 64 6f 70 74 20 74 68 69 73 20 76 69 65 77 20 62 79 20 | ts.sometimes.adopt.this.view.by. |
| b91e0 | 69 6e 74 72 6f 64 75 63 69 6e 67 20 74 68 65 20 22 77 6f 72 6c 64 0a 6c 69 6e 65 73 22 20 6f 66 | introducing.the."world.lines".of |
| b9200 | 20 70 61 72 74 69 63 6c 65 73 20 61 73 20 61 20 64 65 76 69 63 65 20 66 6f 72 20 72 65 61 73 6f | .particles.as.a.device.for.reaso |
| b9220 | 6e 69 6e 67 20 61 62 6f 75 74 20 6d 6f 74 69 6f 6e 2e 20 20 57 65 27 76 65 20 61 6c 73 6f 0a 61 | ning.about.motion...We've.also.a |
| b9240 | 6c 72 65 61 64 79 20 6d 65 6e 74 69 6f 6e 65 64 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 | lready.mentioned.(section.*Note. |
| b9260 | 32 2d 32 2d 33 3a 3a 29 20 74 68 61 74 20 74 68 69 73 20 69 73 20 74 68 65 20 6e 61 74 75 72 61 | 2-2-3::).that.this.is.the.natura |
| b9280 | 6c 20 77 61 79 0a 74 6f 20 74 68 69 6e 6b 20 61 62 6f 75 74 20 73 69 67 6e 61 6c 2d 70 72 6f 63 | l.way.to.think.about.signal-proc |
| b92a0 | 65 73 73 69 6e 67 20 73 79 73 74 65 6d 73 2e 20 20 57 65 20 77 69 6c 6c 20 65 78 70 6c 6f 72 65 | essing.systems...We.will.explore |
| b92c0 | 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 0a 6f 66 20 73 74 72 65 61 6d 73 20 74 6f 20 73 69 67 6e | .applications.of.streams.to.sign |
| b92e0 | 61 6c 20 70 72 6f 63 65 73 73 69 6e 67 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 | al.processing.in.section.*Note.3 |
| b9300 | 2d 35 2d 33 3a 3a 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 | -5-3::.....File:.sicp.info,..Nod |
| b9320 | 65 3a 20 33 2d 35 2d 31 2c 20 20 4e 65 78 74 3a 20 33 2d 35 2d 32 2c 20 20 50 72 65 76 3a 20 33 | e:.3-5-1,..Next:.3-5-2,..Prev:.3 |
| b9340 | 2d 35 2c 20 20 55 70 3a 20 33 2d 35 0a 0a 33 2e 35 2e 31 20 53 74 72 65 61 6d 73 20 41 72 65 20 | -5,..Up:.3-5..3.5.1.Streams.Are. |
| b9360 | 44 65 6c 61 79 65 64 20 4c 69 73 74 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | Delayed.Lists.------------------ |
| b9380 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 41 73 20 77 65 20 73 61 77 20 69 6e 20 73 65 63 74 | -------------..As.we.saw.in.sect |
| b93a0 | 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 2c 20 73 65 71 75 65 6e 63 65 73 20 63 61 6e | ion.*Note.2-2-3::,.sequences.can |
| b93c0 | 20 73 65 72 76 65 20 61 73 20 73 74 61 6e 64 61 72 64 0a 69 6e 74 65 72 66 61 63 65 73 20 66 6f | .serve.as.standard.interfaces.fo |
| b93e0 | 72 20 63 6f 6d 62 69 6e 69 6e 67 20 70 72 6f 67 72 61 6d 20 6d 6f 64 75 6c 65 73 2e 20 20 57 65 | r.combining.program.modules...We |
| b9400 | 20 66 6f 72 6d 75 6c 61 74 65 64 20 70 6f 77 65 72 66 75 6c 0a 61 62 73 74 72 61 63 74 69 6f 6e | .formulated.powerful.abstraction |
| b9420 | 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 73 65 71 75 65 6e 63 65 73 2c 20 73 75 | s.for.manipulating.sequences,.su |
| b9440 | 63 68 20 61 73 20 60 6d 61 70 27 2c 20 60 66 69 6c 74 65 72 27 2c 20 61 6e 64 0a 60 61 63 63 75 | ch.as.`map',.`filter',.and.`accu |
| b9460 | 6d 75 6c 61 74 65 27 2c 20 74 68 61 74 20 63 61 70 74 75 72 65 20 61 20 77 69 64 65 20 76 61 72 | mulate',.that.capture.a.wide.var |
| b9480 | 69 65 74 79 20 6f 66 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 61 20 6d 61 6e 6e 65 72 20 74 | iety.of.operations.in.a.manner.t |
| b94a0 | 68 61 74 0a 69 73 20 62 6f 74 68 20 73 75 63 63 69 6e 63 74 20 61 6e 64 20 65 6c 65 67 61 6e 74 | hat.is.both.succinct.and.elegant |
| b94c0 | 2e 0a 0a 20 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 69 66 20 77 65 20 72 65 70 72 65 | ......Unfortunately,.if.we.repre |
| b94e0 | 73 65 6e 74 20 73 65 71 75 65 6e 63 65 73 20 61 73 20 6c 69 73 74 73 2c 20 74 68 69 73 20 65 6c | sent.sequences.as.lists,.this.el |
| b9500 | 65 67 61 6e 63 65 20 69 73 0a 62 6f 75 67 68 74 20 61 74 20 74 68 65 20 70 72 69 63 65 20 6f 66 | egance.is.bought.at.the.price.of |
| b9520 | 20 73 65 76 65 72 65 20 69 6e 65 66 66 69 63 69 65 6e 63 79 20 77 69 74 68 20 72 65 73 70 65 63 | .severe.inefficiency.with.respec |
| b9540 | 74 20 74 6f 20 62 6f 74 68 20 74 68 65 0a 74 69 6d 65 20 61 6e 64 20 73 70 61 63 65 20 72 65 71 | t.to.both.the.time.and.space.req |
| b9560 | 75 69 72 65 64 20 62 79 20 6f 75 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 2e 20 20 57 68 65 6e | uired.by.our.computations...When |
| b9580 | 20 77 65 20 72 65 70 72 65 73 65 6e 74 0a 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 73 20 6f 6e 20 73 | .we.represent.manipulations.on.s |
| b95a0 | 65 71 75 65 6e 63 65 73 20 61 73 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 73 20 6f 66 20 6c | equences.as.transformations.of.l |
| b95c0 | 69 73 74 73 2c 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 0a 6d 75 73 74 20 63 6f 6e 73 74 72 75 63 | ists,.our.programs.must.construc |
| b95e0 | 74 20 61 6e 64 20 63 6f 70 79 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 28 77 68 69 63 | t.and.copy.data.structures.(whic |
| b9600 | 68 20 6d 61 79 20 62 65 20 68 75 67 65 29 20 61 74 20 65 76 65 72 79 0a 73 74 65 70 20 6f 66 20 | h.may.be.huge).at.every.step.of. |
| b9620 | 61 20 70 72 6f 63 65 73 73 2e 0a 0a 20 20 20 54 6f 20 73 65 65 20 77 68 79 20 74 68 69 73 20 69 | a.process......To.see.why.this.i |
| b9640 | 73 20 74 72 75 65 2c 20 6c 65 74 20 75 73 20 63 6f 6d 70 61 72 65 20 74 77 6f 20 70 72 6f 67 72 | s.true,.let.us.compare.two.progr |
| b9660 | 61 6d 73 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 0a 74 68 65 20 73 75 6d 20 6f 66 20 61 6c 6c | ams.for.computing.the.sum.of.all |
| b9680 | 20 74 68 65 20 70 72 69 6d 65 20 6e 75 6d 62 65 72 73 20 69 6e 20 61 6e 20 69 6e 74 65 72 76 61 | .the.prime.numbers.in.an.interva |
| b96a0 | 6c 2e 20 20 54 68 65 20 66 69 72 73 74 20 70 72 6f 67 72 61 6d 20 69 73 0a 77 72 69 74 74 65 6e | l...The.first.program.is.written |
| b96c0 | 20 69 6e 20 73 74 61 6e 64 61 72 64 20 69 74 65 72 61 74 69 76 65 20 73 74 79 6c 65 3a 28 31 29 | .in.standard.iterative.style:(1) |
| b96e0 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 75 6d 2d 70 72 69 6d 65 73 20 61 20 62 29 0a | .......(define.(sum-primes.a.b). |
| b9700 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 20 63 6f 75 6e 74 20 61 63 63 75 6d | .......(define.(iter.count.accum |
| b9720 | 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3e 20 63 6f 75 6e 74 20 62 29 20 61 63 | )..........(cond.((>.count.b).ac |
| b9740 | 63 75 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 70 72 69 6d 65 3f 20 63 6f 75 | cum)................((prime?.cou |
| b9760 | 6e 74 29 20 28 69 74 65 72 20 28 2b 20 63 6f 75 6e 74 20 31 29 20 28 2b 20 63 6f 75 6e 74 20 61 | nt).(iter.(+.count.1).(+.count.a |
| b9780 | 63 63 75 6d 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 69 74 | ccum)))................(else.(it |
| b97a0 | 65 72 20 28 2b 20 63 6f 75 6e 74 20 31 29 20 61 63 63 75 6d 29 29 29 29 0a 20 20 20 20 20 20 20 | er.(+.count.1).accum))))........ |
| b97c0 | 28 69 74 65 72 20 61 20 30 29 29 0a 0a 20 20 20 54 68 65 20 73 65 63 6f 6e 64 20 70 72 6f 67 72 | (iter.a.0)).....The.second.progr |
| b97e0 | 61 6d 20 70 65 72 66 6f 72 6d 73 20 74 68 65 20 73 61 6d 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e | am.performs.the.same.computation |
| b9800 | 20 75 73 69 6e 67 20 74 68 65 20 73 65 71 75 65 6e 63 65 0a 6f 70 65 72 61 74 69 6f 6e 73 20 6f | .using.the.sequence.operations.o |
| b9820 | 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 3a 0a 0a 20 20 20 20 20 28 | f.section.*Note.2-2-3:::.......( |
| b9840 | 64 65 66 69 6e 65 20 28 73 75 6d 2d 70 72 69 6d 65 73 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 | define.(sum-primes.a.b)........( |
| b9860 | 61 63 63 75 6d 75 6c 61 74 65 20 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | accumulate.+.................... |
| b9880 | 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 6c 74 65 72 20 70 72 69 | 0....................(filter.pri |
| b98a0 | 6d 65 3f 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 61 20 62 29 29 29 29 0a | me?.(enumerate-interval.a.b)))). |
| b98c0 | 0a 20 20 20 49 6e 20 63 61 72 72 79 69 6e 67 20 6f 75 74 20 74 68 65 20 63 6f 6d 70 75 74 61 74 | ....In.carrying.out.the.computat |
| b98e0 | 69 6f 6e 2c 20 74 68 65 20 66 69 72 73 74 20 70 72 6f 67 72 61 6d 20 6e 65 65 64 73 20 74 6f 20 | ion,.the.first.program.needs.to. |
| b9900 | 73 74 6f 72 65 0a 6f 6e 6c 79 20 74 68 65 20 73 75 6d 20 62 65 69 6e 67 20 61 63 63 75 6d 75 6c | store.only.the.sum.being.accumul |
| b9920 | 61 74 65 64 2e 20 20 49 6e 20 63 6f 6e 74 72 61 73 74 2c 20 74 68 65 20 66 69 6c 74 65 72 20 69 | ated...In.contrast,.the.filter.i |
| b9940 | 6e 20 74 68 65 20 73 65 63 6f 6e 64 0a 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f 74 20 64 6f 20 61 | n.the.second.program.cannot.do.a |
| b9960 | 6e 79 20 74 65 73 74 69 6e 67 20 75 6e 74 69 6c 20 60 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 | ny.testing.until.`enumerate-inte |
| b9980 | 72 76 61 6c 27 20 68 61 73 0a 63 6f 6e 73 74 72 75 63 74 65 64 20 61 20 63 6f 6d 70 6c 65 74 65 | rval'.has.constructed.a.complete |
| b99a0 | 20 6c 69 73 74 20 6f 66 20 74 68 65 20 6e 75 6d 62 65 72 73 20 69 6e 20 74 68 65 20 69 6e 74 65 | .list.of.the.numbers.in.the.inte |
| b99c0 | 72 76 61 6c 2e 20 20 54 68 65 20 66 69 6c 74 65 72 0a 67 65 6e 65 72 61 74 65 73 20 61 6e 6f 74 | rval...The.filter.generates.anot |
| b99e0 | 68 65 72 20 6c 69 73 74 2c 20 77 68 69 63 68 20 69 6e 20 74 75 72 6e 20 69 73 20 70 61 73 73 65 | her.list,.which.in.turn.is.passe |
| b9a00 | 64 20 74 6f 20 60 61 63 63 75 6d 75 6c 61 74 65 27 20 62 65 66 6f 72 65 0a 62 65 69 6e 67 20 63 | d.to.`accumulate'.before.being.c |
| b9a20 | 6f 6c 6c 61 70 73 65 64 20 74 6f 20 66 6f 72 6d 20 61 20 73 75 6d 2e 20 20 53 75 63 68 20 6c 61 | ollapsed.to.form.a.sum...Such.la |
| b9a40 | 72 67 65 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20 73 74 6f 72 61 67 65 20 69 73 20 6e 6f 74 0a | rge.intermediate.storage.is.not. |
| b9a60 | 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 66 69 72 73 74 20 70 72 6f 67 72 61 6d 2c 20 77 68 69 | needed.by.the.first.program,.whi |
| b9a80 | 63 68 20 77 65 20 63 61 6e 20 74 68 69 6e 6b 20 6f 66 20 61 73 20 65 6e 75 6d 65 72 61 74 69 6e | ch.we.can.think.of.as.enumeratin |
| b9aa0 | 67 20 74 68 65 0a 69 6e 74 65 72 76 61 6c 20 69 6e 63 72 65 6d 65 6e 74 61 6c 6c 79 2c 20 61 64 | g.the.interval.incrementally,.ad |
| b9ac0 | 64 69 6e 67 20 65 61 63 68 20 70 72 69 6d 65 20 74 6f 20 74 68 65 20 73 75 6d 20 61 73 20 69 74 | ding.each.prime.to.the.sum.as.it |
| b9ae0 | 20 69 73 20 67 65 6e 65 72 61 74 65 64 2e 0a 0a 20 20 20 54 68 65 20 69 6e 65 66 66 69 63 69 65 | .is.generated......The.inefficie |
| b9b00 | 6e 63 79 20 69 6e 20 75 73 69 6e 67 20 6c 69 73 74 73 20 62 65 63 6f 6d 65 73 20 70 61 69 6e 66 | ncy.in.using.lists.becomes.painf |
| b9b20 | 75 6c 6c 79 20 61 70 70 61 72 65 6e 74 20 69 66 20 77 65 20 75 73 65 0a 74 68 65 20 73 65 71 75 | ully.apparent.if.we.use.the.sequ |
| b9b40 | 65 6e 63 65 20 70 61 72 61 64 69 67 6d 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 73 65 63 | ence.paradigm.to.compute.the.sec |
| b9b60 | 6f 6e 64 20 70 72 69 6d 65 20 69 6e 20 74 68 65 20 69 6e 74 65 72 76 61 6c 20 66 72 6f 6d 0a 31 | ond.prime.in.the.interval.from.1 |
| b9b80 | 30 2c 30 30 30 20 74 6f 20 31 2c 30 30 30 2c 30 30 30 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 | 0,000.to.1,000,000.by.evaluating |
| b9ba0 | 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 28 63 61 72 20 28 63 64 72 20 | .the.expression.......(car.(cdr. |
| b9bc0 | 28 66 69 6c 74 65 72 20 70 72 69 6d 65 3f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (filter.prime?.................. |
| b9be0 | 20 20 20 20 20 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 31 30 30 30 30 20 | ......(enumerate-interval.10000. |
| b9c00 | 31 30 30 30 30 30 30 29 29 29 29 0a 0a 20 20 20 54 68 69 73 20 65 78 70 72 65 73 73 69 6f 6e 20 | 1000000)))).....This.expression. |
| b9c20 | 64 6f 65 73 20 66 69 6e 64 20 74 68 65 20 73 65 63 6f 6e 64 20 70 72 69 6d 65 2c 20 62 75 74 20 | does.find.the.second.prime,.but. |
| b9c40 | 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 0a 6f 76 65 72 68 65 61 64 20 69 73 20 6f 75 | the.computational.overhead.is.ou |
| b9c60 | 74 72 61 67 65 6f 75 73 2e 20 20 57 65 20 63 6f 6e 73 74 72 75 63 74 20 61 20 6c 69 73 74 20 6f | trageous...We.construct.a.list.o |
| b9c80 | 66 20 61 6c 6d 6f 73 74 20 61 20 6d 69 6c 6c 69 6f 6e 0a 69 6e 74 65 67 65 72 73 2c 20 66 69 6c | f.almost.a.million.integers,.fil |
| b9ca0 | 74 65 72 20 74 68 69 73 20 6c 69 73 74 20 62 79 20 74 65 73 74 69 6e 67 20 65 61 63 68 20 65 6c | ter.this.list.by.testing.each.el |
| b9cc0 | 65 6d 65 6e 74 20 66 6f 72 20 70 72 69 6d 61 6c 69 74 79 2c 20 61 6e 64 0a 74 68 65 6e 20 69 67 | ement.for.primality,.and.then.ig |
| b9ce0 | 6e 6f 72 65 20 61 6c 6d 6f 73 74 20 61 6c 6c 20 6f 66 20 74 68 65 20 72 65 73 75 6c 74 2e 20 20 | nore.almost.all.of.the.result... |
| b9d00 | 49 6e 20 61 20 6d 6f 72 65 20 74 72 61 64 69 74 69 6f 6e 61 6c 0a 70 72 6f 67 72 61 6d 6d 69 6e | In.a.more.traditional.programmin |
| b9d20 | 67 20 73 74 79 6c 65 2c 20 77 65 20 77 6f 75 6c 64 20 69 6e 74 65 72 6c 65 61 76 65 20 74 68 65 | g.style,.we.would.interleave.the |
| b9d40 | 20 65 6e 75 6d 65 72 61 74 69 6f 6e 20 61 6e 64 20 74 68 65 0a 66 69 6c 74 65 72 69 6e 67 2c 20 | .enumeration.and.the.filtering,. |
| b9d60 | 61 6e 64 20 73 74 6f 70 20 77 68 65 6e 20 77 65 20 72 65 61 63 68 65 64 20 74 68 65 20 73 65 63 | and.stop.when.we.reached.the.sec |
| b9d80 | 6f 6e 64 20 70 72 69 6d 65 2e 0a 0a 20 20 20 53 74 72 65 61 6d 73 20 61 72 65 20 61 20 63 6c 65 | ond.prime......Streams.are.a.cle |
| b9da0 | 76 65 72 20 69 64 65 61 20 74 68 61 74 20 61 6c 6c 6f 77 73 20 6f 6e 65 20 74 6f 20 75 73 65 20 | ver.idea.that.allows.one.to.use. |
| b9dc0 | 73 65 71 75 65 6e 63 65 0a 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 73 20 77 69 74 68 6f 75 74 20 69 | sequence.manipulations.without.i |
| b9de0 | 6e 63 75 72 72 69 6e 67 20 74 68 65 20 63 6f 73 74 73 20 6f 66 20 6d 61 6e 69 70 75 6c 61 74 69 | ncurring.the.costs.of.manipulati |
| b9e00 | 6e 67 20 73 65 71 75 65 6e 63 65 73 20 61 73 0a 6c 69 73 74 73 2e 20 20 57 69 74 68 20 73 74 72 | ng.sequences.as.lists...With.str |
| b9e20 | 65 61 6d 73 20 77 65 20 63 61 6e 20 61 63 68 69 65 76 65 20 74 68 65 20 62 65 73 74 20 6f 66 20 | eams.we.can.achieve.the.best.of. |
| b9e40 | 62 6f 74 68 20 77 6f 72 6c 64 73 3a 20 57 65 20 63 61 6e 0a 66 6f 72 6d 75 6c 61 74 65 20 70 72 | both.worlds:.We.can.formulate.pr |
| b9e60 | 6f 67 72 61 6d 73 20 65 6c 65 67 61 6e 74 6c 79 20 61 73 20 73 65 71 75 65 6e 63 65 20 6d 61 6e | ograms.elegantly.as.sequence.man |
| b9e80 | 69 70 75 6c 61 74 69 6f 6e 73 2c 20 77 68 69 6c 65 20 61 74 74 61 69 6e 69 6e 67 0a 74 68 65 20 | ipulations,.while.attaining.the. |
| b9ea0 | 65 66 66 69 63 69 65 6e 63 79 20 6f 66 20 69 6e 63 72 65 6d 65 6e 74 61 6c 20 63 6f 6d 70 75 74 | efficiency.of.incremental.comput |
| b9ec0 | 61 74 69 6f 6e 2e 20 20 54 68 65 20 62 61 73 69 63 20 69 64 65 61 20 69 73 20 74 6f 0a 61 72 72 | ation...The.basic.idea.is.to.arr |
| b9ee0 | 61 6e 67 65 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 61 20 73 74 72 65 61 6d 20 6f 6e 6c 79 20 | ange.to.construct.a.stream.only. |
| b9f00 | 70 61 72 74 69 61 6c 6c 79 2c 20 61 6e 64 20 74 6f 20 70 61 73 73 20 74 68 65 20 70 61 72 74 69 | partially,.and.to.pass.the.parti |
| b9f20 | 61 6c 0a 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 74 6f 20 74 68 65 20 70 72 6f 67 72 61 6d 20 74 | al.construction.to.the.program.t |
| b9f40 | 68 61 74 20 63 6f 6e 73 75 6d 65 73 20 74 68 65 20 73 74 72 65 61 6d 2e 20 20 49 66 20 74 68 65 | hat.consumes.the.stream...If.the |
| b9f60 | 20 63 6f 6e 73 75 6d 65 72 0a 61 74 74 65 6d 70 74 73 20 74 6f 20 61 63 63 65 73 73 20 61 20 70 | .consumer.attempts.to.access.a.p |
| b9f80 | 61 72 74 20 6f 66 20 74 68 65 20 73 74 72 65 61 6d 20 74 68 61 74 20 68 61 73 20 6e 6f 74 20 79 | art.of.the.stream.that.has.not.y |
| b9fa0 | 65 74 20 62 65 65 6e 0a 63 6f 6e 73 74 72 75 63 74 65 64 2c 20 74 68 65 20 73 74 72 65 61 6d 20 | et.been.constructed,.the.stream. |
| b9fc0 | 77 69 6c 6c 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 63 6f 6e 73 74 72 75 63 74 20 6a 75 73 | will.automatically.construct.jus |
| b9fe0 | 74 20 65 6e 6f 75 67 68 20 6d 6f 72 65 0a 6f 66 20 69 74 73 65 6c 66 20 74 6f 20 70 72 6f 64 75 | t.enough.more.of.itself.to.produ |
| ba000 | 63 65 20 74 68 65 20 72 65 71 75 69 72 65 64 20 70 61 72 74 2c 20 74 68 75 73 20 70 72 65 73 65 | ce.the.required.part,.thus.prese |
| ba020 | 72 76 69 6e 67 20 74 68 65 20 69 6c 6c 75 73 69 6f 6e 0a 74 68 61 74 20 74 68 65 20 65 6e 74 69 | rving.the.illusion.that.the.enti |
| ba040 | 72 65 20 73 74 72 65 61 6d 20 65 78 69 73 74 73 2e 20 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 | re.stream.exists...In.other.word |
| ba060 | 73 2c 20 61 6c 74 68 6f 75 67 68 20 77 65 20 77 69 6c 6c 20 77 72 69 74 65 0a 70 72 6f 67 72 61 | s,.although.we.will.write.progra |
| ba080 | 6d 73 20 61 73 20 69 66 20 77 65 20 77 65 72 65 20 70 72 6f 63 65 73 73 69 6e 67 20 63 6f 6d 70 | ms.as.if.we.were.processing.comp |
| ba0a0 | 6c 65 74 65 20 73 65 71 75 65 6e 63 65 73 2c 20 77 65 20 64 65 73 69 67 6e 20 6f 75 72 0a 73 74 | lete.sequences,.we.design.our.st |
| ba0c0 | 72 65 61 6d 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 74 6f 20 61 75 74 6f 6d 61 74 69 63 | ream.implementation.to.automatic |
| ba0e0 | 61 6c 6c 79 20 61 6e 64 20 74 72 61 6e 73 70 61 72 65 6e 74 6c 79 20 69 6e 74 65 72 6c 65 61 76 | ally.and.transparently.interleav |
| ba100 | 65 20 74 68 65 0a 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 74 72 65 61 6d | e.the.construction.of.the.stream |
| ba120 | 20 77 69 74 68 20 69 74 73 20 75 73 65 2e 0a 0a 20 20 20 4f 6e 20 74 68 65 20 73 75 72 66 61 63 | .with.its.use......On.the.surfac |
| ba140 | 65 2c 20 73 74 72 65 61 6d 73 20 61 72 65 20 6a 75 73 74 20 6c 69 73 74 73 20 77 69 74 68 20 64 | e,.streams.are.just.lists.with.d |
| ba160 | 69 66 66 65 72 65 6e 74 20 6e 61 6d 65 73 20 66 6f 72 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 | ifferent.names.for.the.procedure |
| ba180 | 73 20 74 68 61 74 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 68 65 6d 2e 20 20 54 68 65 72 65 20 69 | s.that.manipulate.them...There.i |
| ba1a0 | 73 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 2c 0a 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 2c 20 | s.a.constructor,.`cons-stream',. |
| ba1c0 | 61 6e 64 20 74 77 6f 20 73 65 6c 65 63 74 6f 72 73 2c 20 60 73 74 72 65 61 6d 2d 63 61 72 27 20 | and.two.selectors,.`stream-car'. |
| ba1e0 | 61 6e 64 20 60 73 74 72 65 61 6d 2d 63 64 72 27 2c 20 77 68 69 63 68 0a 73 61 74 69 73 66 79 20 | and.`stream-cdr',.which.satisfy. |
| ba200 | 74 68 65 20 63 6f 6e 73 74 72 61 69 6e 74 73 0a 0a 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 61 | the.constraints.......(stream-ca |
| ba220 | 72 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 78 20 79 29 29 20 3d 20 78 0a 20 20 20 20 20 28 73 | r.(cons-stream.x.y)).=.x......(s |
| ba240 | 74 72 65 61 6d 2d 63 64 72 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 78 20 79 29 29 20 3d 20 79 | tream-cdr.(cons-stream.x.y)).=.y |
| ba260 | 0a 0a 20 20 20 54 68 65 72 65 20 69 73 20 61 20 64 69 73 74 69 6e 67 75 69 73 68 61 62 6c 65 20 | .....There.is.a.distinguishable. |
| ba280 | 6f 62 6a 65 63 74 2c 20 60 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 27 2c 20 77 68 69 63 | object,.`the-empty-stream',.whic |
| ba2a0 | 68 20 63 61 6e 6e 6f 74 0a 62 65 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 61 6e 79 20 60 63 | h.cannot.be.the.result.of.any.`c |
| ba2c0 | 6f 6e 73 2d 73 74 72 65 61 6d 27 20 6f 70 65 72 61 74 69 6f 6e 2c 20 61 6e 64 20 77 68 69 63 68 | ons-stream'.operation,.and.which |
| ba2e0 | 20 63 61 6e 20 62 65 0a 69 64 65 6e 74 69 66 69 65 64 20 77 69 74 68 20 74 68 65 20 70 72 65 64 | .can.be.identified.with.the.pred |
| ba300 | 69 63 61 74 65 20 60 73 74 72 65 61 6d 2d 6e 75 6c 6c 3f 27 2e 28 32 29 20 20 54 68 75 73 20 77 | icate.`stream-null?'.(2)..Thus.w |
| ba320 | 65 20 63 61 6e 20 6d 61 6b 65 20 61 6e 64 0a 75 73 65 20 73 74 72 65 61 6d 73 2c 20 69 6e 20 6a | e.can.make.and.use.streams,.in.j |
| ba340 | 75 73 74 20 74 68 65 20 73 61 6d 65 20 77 61 79 20 61 73 20 77 65 20 63 61 6e 20 6d 61 6b 65 20 | ust.the.same.way.as.we.can.make. |
| ba360 | 61 6e 64 20 75 73 65 20 6c 69 73 74 73 2c 20 74 6f 0a 72 65 70 72 65 73 65 6e 74 20 61 67 67 72 | and.use.lists,.to.represent.aggr |
| ba380 | 65 67 61 74 65 20 64 61 74 61 20 61 72 72 61 6e 67 65 64 20 69 6e 20 61 20 73 65 71 75 65 6e 63 | egate.data.arranged.in.a.sequenc |
| ba3a0 | 65 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 77 65 20 63 61 6e 0a 62 75 69 6c 64 20 | e...In.particular,.we.can.build. |
| ba3c0 | 73 74 72 65 61 6d 20 61 6e 61 6c 6f 67 73 20 6f 66 20 74 68 65 20 6c 69 73 74 20 6f 70 65 72 61 | stream.analogs.of.the.list.opera |
| ba3e0 | 74 69 6f 6e 73 20 66 72 6f 6d 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 32 3a 3a 2c 0a 73 75 | tions.from.*Note.Chapter.2::,.su |
| ba400 | 63 68 20 61 73 20 60 6c 69 73 74 2d 72 65 66 27 2c 20 60 6d 61 70 27 2c 20 61 6e 64 20 60 66 6f | ch.as.`list-ref',.`map',.and.`fo |
| ba420 | 72 2d 65 61 63 68 27 3a 28 33 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 72 65 61 | r-each':(3).......(define.(strea |
| ba440 | 6d 2d 72 65 66 20 73 20 6e 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 30 29 0a 20 20 | m-ref.s.n)........(if.(=.n.0)... |
| ba460 | 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 29 0a 20 20 20 20 20 20 20 20 | .........(stream-car.s)......... |
| ba480 | 20 20 20 28 73 74 72 65 61 6d 2d 72 65 66 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 29 20 28 2d | ...(stream-ref.(stream-cdr.s).(- |
| ba4a0 | 20 6e 20 31 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 72 65 61 6d 2d 6d | .n.1)))).......(define.(stream-m |
| ba4c0 | 61 70 20 70 72 6f 63 20 73 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 73 74 72 65 61 6d 2d 6e 75 | ap.proc.s)........(if.(stream-nu |
| ba4e0 | 6c 6c 3f 20 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 | ll?.s)............the-empty-stre |
| ba500 | 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 28 70 72 6f 63 | am............(cons-stream.(proc |
| ba520 | 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(stream-car.s))................ |
| ba540 | 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 70 72 6f 63 20 28 73 74 72 65 61 | .........(stream-map.proc.(strea |
| ba560 | 6d 2d 63 64 72 20 73 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 72 65 | m-cdr.s))))).......(define.(stre |
| ba580 | 61 6d 2d 66 6f 72 2d 65 61 63 68 20 70 72 6f 63 20 73 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 | am-for-each.proc.s)........(if.( |
| ba5a0 | 73 74 72 65 61 6d 2d 6e 75 6c 6c 3f 20 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 64 6f 6e 65 | stream-null?.s)............'done |
| ba5c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 70 72 6f 63 20 28 73 74 72 65 61 6d | ............(begin.(proc.(stream |
| ba5e0 | 2d 63 61 72 20 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 | -car.s))...................(stre |
| ba600 | 61 6d 2d 66 6f 72 2d 65 61 63 68 20 70 72 6f 63 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 29 29 | am-for-each.proc.(stream-cdr.s)) |
| ba620 | 29 29 29 0a 0a 20 20 20 60 53 74 72 65 61 6d 2d 66 6f 72 2d 65 61 63 68 27 20 69 73 20 75 73 65 | ))).....`Stream-for-each'.is.use |
| ba640 | 66 75 6c 20 66 6f 72 20 76 69 65 77 69 6e 67 20 73 74 72 65 61 6d 73 3a 0a 0a 20 20 20 20 20 28 | ful.for.viewing.streams:.......( |
| ba660 | 64 65 66 69 6e 65 20 28 64 69 73 70 6c 61 79 2d 73 74 72 65 61 6d 20 73 29 0a 20 20 20 20 20 20 | define.(display-stream.s)....... |
| ba680 | 20 28 73 74 72 65 61 6d 2d 66 6f 72 2d 65 61 63 68 20 64 69 73 70 6c 61 79 2d 6c 69 6e 65 20 73 | .(stream-for-each.display-line.s |
| ba6a0 | 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 70 6c 61 79 2d 6c 69 6e 65 20 78 | )).......(define.(display-line.x |
| ba6c0 | 29 0a 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 20 28 64 69 73 70 6c | )........(newline)........(displ |
| ba6e0 | 61 79 20 78 29 29 0a 0a 20 20 20 54 6f 20 6d 61 6b 65 20 74 68 65 20 73 74 72 65 61 6d 20 69 6d | ay.x)).....To.make.the.stream.im |
| ba700 | 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 61 6e 64 20 74 | plementation.automatically.and.t |
| ba720 | 72 61 6e 73 70 61 72 65 6e 74 6c 79 0a 69 6e 74 65 72 6c 65 61 76 65 20 74 68 65 20 63 6f 6e 73 | ransparently.interleave.the.cons |
| ba740 | 74 72 75 63 74 69 6f 6e 20 6f 66 20 61 20 73 74 72 65 61 6d 20 77 69 74 68 20 69 74 73 20 75 73 | truction.of.a.stream.with.its.us |
| ba760 | 65 2c 20 77 65 20 77 69 6c 6c 20 61 72 72 61 6e 67 65 0a 66 6f 72 20 74 68 65 20 60 63 64 72 27 | e,.we.will.arrange.for.the.`cdr' |
| ba780 | 20 6f 66 20 61 20 73 74 72 65 61 6d 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 77 68 65 | .of.a.stream.to.be.evaluated.whe |
| ba7a0 | 6e 20 69 74 20 69 73 20 61 63 63 65 73 73 65 64 20 62 79 20 74 68 65 0a 60 73 74 72 65 61 6d 2d | n.it.is.accessed.by.the.`stream- |
| ba7c0 | 63 64 72 27 20 70 72 6f 63 65 64 75 72 65 20 72 61 74 68 65 72 20 74 68 61 6e 20 77 68 65 6e 20 | cdr'.procedure.rather.than.when. |
| ba7e0 | 74 68 65 20 73 74 72 65 61 6d 20 69 73 20 63 6f 6e 73 74 72 75 63 74 65 64 20 62 79 0a 60 63 6f | the.stream.is.constructed.by.`co |
| ba800 | 6e 73 2d 73 74 72 65 61 6d 27 2e 20 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e | ns-stream'...This.implementation |
| ba820 | 20 63 68 6f 69 63 65 20 69 73 20 72 65 6d 69 6e 69 73 63 65 6e 74 20 6f 66 20 6f 75 72 0a 64 69 | .choice.is.reminiscent.of.our.di |
| ba840 | 73 63 75 73 73 69 6f 6e 20 6f 66 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 69 6e 20 | scussion.of.rational.numbers.in. |
| ba860 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 31 2d 32 3a 3a 2c 20 77 68 65 72 65 20 77 65 20 | section.*Note.2-1-2::,.where.we. |
| ba880 | 73 61 77 0a 74 68 61 74 20 77 65 20 63 61 6e 20 63 68 6f 6f 73 65 20 74 6f 20 69 6d 70 6c 65 6d | saw.that.we.can.choose.to.implem |
| ba8a0 | 65 6e 74 20 72 61 74 69 6f 6e 61 6c 20 6e 75 6d 62 65 72 73 20 73 6f 20 74 68 61 74 20 74 68 65 | ent.rational.numbers.so.that.the |
| ba8c0 | 20 72 65 64 75 63 74 69 6f 6e 0a 6f 66 20 6e 75 6d 65 72 61 74 6f 72 20 61 6e 64 20 64 65 6e 6f | .reduction.of.numerator.and.deno |
| ba8e0 | 6d 69 6e 61 74 6f 72 20 74 6f 20 6c 6f 77 65 73 74 20 74 65 72 6d 73 20 69 73 20 70 65 72 66 6f | minator.to.lowest.terms.is.perfo |
| ba900 | 72 6d 65 64 20 65 69 74 68 65 72 20 61 74 0a 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 74 69 6d 65 | rmed.either.at.construction.time |
| ba920 | 20 6f 72 20 61 74 20 73 65 6c 65 63 74 69 6f 6e 20 74 69 6d 65 2e 20 20 54 68 65 20 74 77 6f 20 | .or.at.selection.time...The.two. |
| ba940 | 72 61 74 69 6f 6e 61 6c 2d 6e 75 6d 62 65 72 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 | rational-number.implementations. |
| ba960 | 70 72 6f 64 75 63 65 20 74 68 65 20 73 61 6d 65 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f | produce.the.same.data.abstractio |
| ba980 | 6e 2c 20 62 75 74 20 74 68 65 20 63 68 6f 69 63 65 20 68 61 73 0a 61 6e 20 65 66 66 65 63 74 20 | n,.but.the.choice.has.an.effect. |
| ba9a0 | 6f 6e 20 65 66 66 69 63 69 65 6e 63 79 2e 20 20 54 68 65 72 65 20 69 73 20 61 20 73 69 6d 69 6c | on.efficiency...There.is.a.simil |
| ba9c0 | 61 72 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 20 62 65 74 77 65 65 6e 0a 73 74 72 65 61 6d 73 20 | ar.relationship.between.streams. |
| ba9e0 | 61 6e 64 20 6f 72 64 69 6e 61 72 79 20 6c 69 73 74 73 2e 20 20 41 73 20 61 20 64 61 74 61 20 61 | and.ordinary.lists...As.a.data.a |
| baa00 | 62 73 74 72 61 63 74 69 6f 6e 2c 20 73 74 72 65 61 6d 73 20 61 72 65 20 74 68 65 0a 73 61 6d 65 | bstraction,.streams.are.the.same |
| baa20 | 20 61 73 20 6c 69 73 74 73 2e 20 20 54 68 65 20 64 69 66 66 65 72 65 6e 63 65 20 69 73 20 74 68 | .as.lists...The.difference.is.th |
| baa40 | 65 20 74 69 6d 65 20 61 74 20 77 68 69 63 68 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 | e.time.at.which.the.elements.are |
| baa60 | 0a 65 76 61 6c 75 61 74 65 64 2e 20 20 57 69 74 68 20 6f 72 64 69 6e 61 72 79 20 6c 69 73 74 73 | .evaluated...With.ordinary.lists |
| baa80 | 2c 20 62 6f 74 68 20 74 68 65 20 60 63 61 72 27 20 61 6e 64 20 74 68 65 20 60 63 64 72 27 20 61 | ,.both.the.`car'.and.the.`cdr'.a |
| baaa0 | 72 65 0a 65 76 61 6c 75 61 74 65 64 20 61 74 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 74 69 6d | re.evaluated.at.construction.tim |
| baac0 | 65 2e 20 20 57 69 74 68 20 73 74 72 65 61 6d 73 2c 20 74 68 65 20 60 63 64 72 27 20 69 73 20 65 | e...With.streams,.the.`cdr'.is.e |
| baae0 | 76 61 6c 75 61 74 65 64 0a 61 74 20 73 65 6c 65 63 74 69 6f 6e 20 74 69 6d 65 2e 0a 0a 20 20 20 | valuated.at.selection.time...... |
| bab00 | 4f 75 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 73 74 72 65 61 6d 73 20 77 69 | Our.implementation.of.streams.wi |
| bab20 | 6c 6c 20 62 65 20 62 61 73 65 64 20 6f 6e 20 61 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 63 61 | ll.be.based.on.a.special.form.ca |
| bab40 | 6c 6c 65 64 0a 60 64 65 6c 61 79 27 2e 20 20 45 76 61 6c 75 61 74 69 6e 67 20 60 28 64 65 6c 61 | lled.`delay'...Evaluating.`(dela |
| bab60 | 79 20 3c 45 58 50 3e 29 27 20 64 6f 65 73 20 6e 6f 74 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 | y.<EXP>)'.does.not.evaluate.the. |
| bab80 | 65 78 70 72 65 73 73 69 6f 6e 0a 3c 45 58 50 3e 2c 20 62 75 74 20 72 61 74 68 65 72 20 72 65 74 | expression.<EXP>,.but.rather.ret |
| baba0 | 75 72 6e 73 20 61 20 73 6f 2d 63 61 6c 6c 65 64 20 6f 62 6a 65 63 74 20 22 64 65 6c 61 79 65 64 | urns.a.so-called.object."delayed |
| babc0 | 20 6f 62 6a 65 63 74 22 2c 20 77 68 69 63 68 20 77 65 0a 63 61 6e 20 74 68 69 6e 6b 20 6f 66 20 | .object",.which.we.can.think.of. |
| babe0 | 61 73 20 61 20 22 70 72 6f 6d 69 73 65 22 20 74 6f 20 65 76 61 6c 75 61 74 65 20 3c 45 58 50 3e | as.a."promise".to.evaluate.<EXP> |
| bac00 | 20 61 74 20 73 6f 6d 65 20 66 75 74 75 72 65 20 74 69 6d 65 2e 20 20 41 73 0a 61 20 63 6f 6d 70 | .at.some.future.time...As.a.comp |
| bac20 | 61 6e 69 6f 6e 20 74 6f 20 60 64 65 6c 61 79 27 2c 20 74 68 65 72 65 20 69 73 20 61 20 70 72 6f | anion.to.`delay',.there.is.a.pro |
| bac40 | 63 65 64 75 72 65 20 63 61 6c 6c 65 64 20 60 66 6f 72 63 65 27 20 74 68 61 74 20 74 61 6b 65 73 | cedure.called.`force'.that.takes |
| bac60 | 0a 61 20 64 65 6c 61 79 65 64 20 6f 62 6a 65 63 74 20 61 73 20 61 72 67 75 6d 65 6e 74 20 61 6e | .a.delayed.object.as.argument.an |
| bac80 | 64 20 70 65 72 66 6f 72 6d 73 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 2d 2d 69 6e 20 65 66 | d.performs.the.evaluation--in.ef |
| baca0 | 66 65 63 74 2c 0a 66 6f 72 63 69 6e 67 20 74 68 65 20 60 64 65 6c 61 79 27 20 74 6f 20 66 75 6c | fect,.forcing.the.`delay'.to.ful |
| bacc0 | 66 69 6c 6c 20 69 74 73 20 70 72 6f 6d 69 73 65 2e 20 20 57 65 20 77 69 6c 6c 20 73 65 65 20 62 | fill.its.promise...We.will.see.b |
| bace0 | 65 6c 6f 77 20 68 6f 77 0a 60 64 65 6c 61 79 27 20 61 6e 64 20 60 66 6f 72 63 65 27 20 63 61 6e | elow.how.`delay'.and.`force'.can |
| bad00 | 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 2c 20 62 75 74 20 66 69 72 73 74 20 6c 65 74 20 75 | .be.implemented,.but.first.let.u |
| bad20 | 73 20 75 73 65 20 74 68 65 73 65 20 74 6f 0a 63 6f 6e 73 74 72 75 63 74 20 73 74 72 65 61 6d 73 | s.use.these.to.construct.streams |
| bad40 | 2e 0a 0a 20 20 20 60 43 6f 6e 73 2d 73 74 72 65 61 6d 27 20 69 73 20 61 20 73 70 65 63 69 61 6c | ......`Cons-stream'.is.a.special |
| bad60 | 20 66 6f 72 6d 20 64 65 66 69 6e 65 64 20 73 6f 20 74 68 61 74 0a 0a 20 20 20 20 20 28 63 6f 6e | .form.defined.so.that.......(con |
| bad80 | 73 2d 73 74 72 65 61 6d 20 3c 41 3e 20 3c 42 3e 29 0a 0a 69 73 20 65 71 75 69 76 61 6c 65 6e 74 | s-stream.<A>.<B>)..is.equivalent |
| bada0 | 20 74 6f 0a 0a 20 20 20 20 20 28 63 6f 6e 73 20 3c 41 3e 20 28 64 65 6c 61 79 20 3c 42 3e 29 29 | .to.......(cons.<A>.(delay.<B>)) |
| badc0 | 0a 0a 20 20 20 57 68 61 74 20 74 68 69 73 20 6d 65 61 6e 73 20 69 73 20 74 68 61 74 20 77 65 20 | .....What.this.means.is.that.we. |
| bade0 | 77 69 6c 6c 20 63 6f 6e 73 74 72 75 63 74 20 73 74 72 65 61 6d 73 20 75 73 69 6e 67 20 70 61 69 | will.construct.streams.using.pai |
| bae00 | 72 73 2e 0a 48 6f 77 65 76 65 72 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 70 6c 61 63 69 6e 67 | rs..However,.rather.than.placing |
| bae20 | 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 74 | .the.value.of.the.rest.of.the.st |
| bae40 | 72 65 61 6d 20 69 6e 74 6f 0a 74 68 65 20 60 63 64 72 27 20 6f 66 20 74 68 65 20 70 61 69 72 20 | ream.into.the.`cdr'.of.the.pair. |
| bae60 | 77 65 20 77 69 6c 6c 20 70 75 74 20 74 68 65 72 65 20 61 20 70 72 6f 6d 69 73 65 20 74 6f 20 63 | we.will.put.there.a.promise.to.c |
| bae80 | 6f 6d 70 75 74 65 20 74 68 65 20 72 65 73 74 0a 69 66 20 69 74 20 69 73 20 65 76 65 72 20 72 65 | ompute.the.rest.if.it.is.ever.re |
| baea0 | 71 75 65 73 74 65 64 2e 20 20 60 53 74 72 65 61 6d 2d 63 61 72 27 20 61 6e 64 20 60 73 74 72 65 | quested...`Stream-car'.and.`stre |
| baec0 | 61 6d 2d 63 64 72 27 20 63 61 6e 20 6e 6f 77 20 62 65 0a 64 65 66 69 6e 65 64 20 61 73 20 70 72 | am-cdr'.can.now.be.defined.as.pr |
| baee0 | 6f 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 72 65 61 6d 2d | ocedures:.......(define.(stream- |
| baf00 | 63 61 72 20 73 74 72 65 61 6d 29 20 28 63 61 72 20 73 74 72 65 61 6d 29 29 0a 0a 20 20 20 20 20 | car.stream).(car.stream))....... |
| baf20 | 28 64 65 66 69 6e 65 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 74 72 65 61 6d 29 20 28 66 6f 72 | (define.(stream-cdr.stream).(for |
| baf40 | 63 65 20 28 63 64 72 20 73 74 72 65 61 6d 29 29 29 0a 0a 20 20 20 60 53 74 72 65 61 6d 2d 63 61 | ce.(cdr.stream))).....`Stream-ca |
| baf60 | 72 27 20 73 65 6c 65 63 74 73 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 74 68 65 20 70 61 69 72 | r'.selects.the.`car'.of.the.pair |
| baf80 | 3b 20 60 73 74 72 65 61 6d 2d 63 64 72 27 20 73 65 6c 65 63 74 73 20 74 68 65 0a 60 63 64 72 27 | ;.`stream-cdr'.selects.the.`cdr' |
| bafa0 | 20 6f 66 20 74 68 65 20 70 61 69 72 20 61 6e 64 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 64 | .of.the.pair.and.evaluates.the.d |
| bafc0 | 65 6c 61 79 65 64 20 65 78 70 72 65 73 73 69 6f 6e 20 66 6f 75 6e 64 20 74 68 65 72 65 20 74 6f | elayed.expression.found.there.to |
| bafe0 | 0a 6f 62 74 61 69 6e 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 73 74 72 65 61 6d 2e 28 | .obtain.the.rest.of.the.stream.( |
| bb000 | 34 29 0a 0a 54 68 65 20 73 74 72 65 61 6d 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 69 6e | 4)..The.stream.implementation.in |
| bb020 | 20 61 63 74 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | .action......................... |
| bb040 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 6f 20 73 65 65 20 68 6f 77 20 74 68 69 73 20 69 6d 70 | .............To.see.how.this.imp |
| bb060 | 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 62 65 68 61 76 65 73 2c 20 6c 65 74 20 75 73 20 61 6e 61 6c | lementation.behaves,.let.us.anal |
| bb080 | 79 7a 65 20 74 68 65 20 22 6f 75 74 72 61 67 65 6f 75 73 22 0a 70 72 69 6d 65 20 63 6f 6d 70 75 | yze.the."outrageous".prime.compu |
| bb0a0 | 74 61 74 69 6f 6e 20 77 65 20 73 61 77 20 61 62 6f 76 65 2c 20 72 65 66 6f 72 6d 75 6c 61 74 65 | tation.we.saw.above,.reformulate |
| bb0c0 | 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 73 74 72 65 61 6d 73 3a 0a 0a 20 20 20 20 20 28 73 74 | d.in.terms.of.streams:.......(st |
| bb0e0 | 72 65 61 6d 2d 63 61 72 0a 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 64 72 0a 20 20 20 20 20 | ream-car.......(stream-cdr...... |
| bb100 | 20 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 20 70 72 69 6d 65 3f 0a 20 20 20 20 20 20 20 20 | ..(stream-filter.prime?......... |
| bb120 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d | ..............(stream-enumerate- |
| bb140 | 69 6e 74 65 72 76 61 6c 20 31 30 30 30 30 20 31 30 30 30 30 30 30 29 29 29 29 0a 0a 20 20 20 57 | interval.10000.1000000)))).....W |
| bb160 | 65 20 77 69 6c 6c 20 73 65 65 20 74 68 61 74 20 69 74 20 64 6f 65 73 20 69 6e 64 65 65 64 20 77 | e.will.see.that.it.does.indeed.w |
| bb180 | 6f 72 6b 20 65 66 66 69 63 69 65 6e 74 6c 79 2e 0a 0a 20 20 20 57 65 20 62 65 67 69 6e 20 62 79 | ork.efficiently......We.begin.by |
| bb1a0 | 20 63 61 6c 6c 69 6e 67 20 60 73 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 | .calling.`stream-enumerate-inter |
| bb1c0 | 76 61 6c 27 20 77 69 74 68 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 0a 31 30 2c 30 30 30 20 61 | val'.with.the.arguments.10,000.a |
| bb1e0 | 6e 64 20 31 2c 30 30 30 2c 30 30 30 2e 20 20 60 53 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 | nd.1,000,000...`Stream-enumerate |
| bb200 | 2d 69 6e 74 65 72 76 61 6c 27 20 69 73 20 74 68 65 20 73 74 72 65 61 6d 20 61 6e 61 6c 6f 67 0a | -interval'.is.the.stream.analog. |
| bb220 | 6f 66 20 60 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 27 20 28 73 65 63 74 69 6f 6e | of.`enumerate-interval'.(section |
| bb240 | 20 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 29 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | .*Note.2-2-3::):.......(define.( |
| bb260 | 73 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 6c 6f 77 20 68 69 | stream-enumerate-interval.low.hi |
| bb280 | 67 68 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 6c 6f 77 20 68 69 67 68 29 0a 20 20 20 20 | gh)........(if.(>.low.high)..... |
| bb2a0 | 20 20 20 20 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 | .......the-empty-stream......... |
| bb2c0 | 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6c 6f 77 0a | ...(cons-stream.............low. |
| bb2e0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d 69 6e | ............(stream-enumerate-in |
| bb300 | 74 65 72 76 61 6c 20 28 2b 20 6c 6f 77 20 31 29 20 68 69 67 68 29 29 29 29 0a 0a 61 6e 64 20 74 | terval.(+.low.1).high))))..and.t |
| bb320 | 68 75 73 20 74 68 65 20 72 65 73 75 6c 74 20 72 65 74 75 72 6e 65 64 20 62 79 20 60 73 74 72 65 | hus.the.result.returned.by.`stre |
| bb340 | 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 27 2c 20 66 6f 72 6d 65 64 20 62 | am-enumerate-interval',.formed.b |
| bb360 | 79 0a 74 68 65 20 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 2c 20 69 73 28 35 29 0a 0a 20 20 20 20 | y.the.`cons-stream',.is(5)...... |
| bb380 | 20 28 63 6f 6e 73 20 31 30 30 30 30 0a 20 20 20 20 20 20 20 20 20 20 20 28 64 65 6c 61 79 20 28 | .(cons.10000............(delay.( |
| bb3a0 | 73 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 31 30 30 30 31 20 | stream-enumerate-interval.10001. |
| bb3c0 | 31 30 30 30 30 30 30 29 29 29 0a 0a 20 20 20 54 68 61 74 20 69 73 2c 20 60 73 74 72 65 61 6d 2d | 1000000))).....That.is,.`stream- |
| bb3e0 | 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 27 20 72 65 74 75 72 6e 73 20 61 20 73 74 | enumerate-interval'.returns.a.st |
| bb400 | 72 65 61 6d 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 0a 61 20 70 61 69 72 20 77 68 6f 73 65 | ream.represented.as.a.pair.whose |
| bb420 | 20 60 63 61 72 27 20 69 73 20 31 30 2c 30 30 30 20 61 6e 64 20 77 68 6f 73 65 20 60 63 64 72 27 | .`car'.is.10,000.and.whose.`cdr' |
| bb440 | 20 69 73 20 61 20 70 72 6f 6d 69 73 65 20 74 6f 20 65 6e 75 6d 65 72 61 74 65 0a 6d 6f 72 65 20 | .is.a.promise.to.enumerate.more. |
| bb460 | 6f 66 20 74 68 65 20 69 6e 74 65 72 76 61 6c 20 69 66 20 73 6f 20 72 65 71 75 65 73 74 65 64 2e | of.the.interval.if.so.requested. |
| bb480 | 20 20 54 68 69 73 20 73 74 72 65 61 6d 20 69 73 20 6e 6f 77 20 66 69 6c 74 65 72 65 64 20 66 6f | ..This.stream.is.now.filtered.fo |
| bb4a0 | 72 0a 70 72 69 6d 65 73 2c 20 75 73 69 6e 67 20 74 68 65 20 73 74 72 65 61 6d 20 61 6e 61 6c 6f | r.primes,.using.the.stream.analo |
| bb4c0 | 67 20 6f 66 20 74 68 65 20 60 66 69 6c 74 65 72 27 20 70 72 6f 63 65 64 75 72 65 20 28 73 65 63 | g.of.the.`filter'.procedure.(sec |
| bb4e0 | 74 69 6f 6e 0a 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 29 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 | tion.*Note.2-2-3::):.......(defi |
| bb500 | 6e 65 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 20 70 72 65 64 20 73 74 72 65 61 6d 29 0a 20 | ne.(stream-filter.pred.stream).. |
| bb520 | 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 73 74 72 65 61 6d 2d 6e 75 6c 6c 3f 20 73 74 72 65 61 | ......(cond.((stream-null?.strea |
| bb540 | 6d 29 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 | m).the-empty-stream)............ |
| bb560 | 20 20 28 28 70 72 65 64 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 74 72 65 61 6d 29 29 0a 20 20 | ..((pred.(stream-car.stream))... |
| bb580 | 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 28 73 74 72 65 61 6d | ............(cons-stream.(stream |
| bb5a0 | 2d 63 61 72 20 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -car.stream).................... |
| bb5c0 | 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 20 70 72 65 64 0a 20 20 20 20 | ........(stream-filter.pred..... |
| bb5e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| bb600 | 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 74 72 65 61 6d 29 29 29 29 0a 20 20 20 | ......(stream-cdr.stream)))).... |
| bb620 | 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 20 70 | ..........(else.(stream-filter.p |
| bb640 | 72 65 64 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 74 72 65 61 6d 29 29 29 29 29 0a 0a 20 20 20 | red.(stream-cdr.stream)))))..... |
| bb660 | 60 53 74 72 65 61 6d 2d 66 69 6c 74 65 72 27 20 74 65 73 74 73 20 74 68 65 20 60 73 74 72 65 61 | `Stream-filter'.tests.the.`strea |
| bb680 | 6d 2d 63 61 72 27 20 6f 66 20 74 68 65 20 73 74 72 65 61 6d 20 28 74 68 65 20 60 63 61 72 27 20 | m-car'.of.the.stream.(the.`car'. |
| bb6a0 | 6f 66 0a 74 68 65 20 70 61 69 72 2c 20 77 68 69 63 68 20 69 73 20 31 30 2c 30 30 30 29 2e 20 20 | of.the.pair,.which.is.10,000)... |
| bb6c0 | 53 69 6e 63 65 20 74 68 69 73 20 69 73 20 6e 6f 74 20 70 72 69 6d 65 2c 20 60 73 74 72 65 61 6d | Since.this.is.not.prime,.`stream |
| bb6e0 | 2d 66 69 6c 74 65 72 27 0a 65 78 61 6d 69 6e 65 73 20 74 68 65 20 60 73 74 72 65 61 6d 2d 63 64 | -filter'.examines.the.`stream-cd |
| bb700 | 72 27 20 6f 66 20 69 74 73 20 69 6e 70 75 74 20 73 74 72 65 61 6d 2e 20 20 54 68 65 20 63 61 6c | r'.of.its.input.stream...The.cal |
| bb720 | 6c 20 74 6f 0a 60 73 74 72 65 61 6d 2d 63 64 72 27 20 66 6f 72 63 65 73 20 65 76 61 6c 75 61 74 | l.to.`stream-cdr'.forces.evaluat |
| bb740 | 69 6f 6e 20 6f 66 20 74 68 65 20 64 65 6c 61 79 65 64 0a 60 73 74 72 65 61 6d 2d 65 6e 75 6d 65 | ion.of.the.delayed.`stream-enume |
| bb760 | 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 27 2c 20 77 68 69 63 68 20 6e 6f 77 20 72 65 74 75 72 6e | rate-interval',.which.now.return |
| bb780 | 73 0a 0a 20 20 20 20 20 28 63 6f 6e 73 20 31 30 30 30 31 0a 20 20 20 20 20 20 20 20 20 20 20 28 | s.......(cons.10001............( |
| bb7a0 | 64 65 6c 61 79 20 28 73 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c | delay.(stream-enumerate-interval |
| bb7c0 | 20 31 30 30 30 32 20 31 30 30 30 30 30 30 29 29 29 0a 0a 20 20 20 60 53 74 72 65 61 6d 2d 66 69 | .10002.1000000))).....`Stream-fi |
| bb7e0 | 6c 74 65 72 27 20 6e 6f 77 20 6c 6f 6f 6b 73 20 61 74 20 74 68 65 20 60 73 74 72 65 61 6d 2d 63 | lter'.now.looks.at.the.`stream-c |
| bb800 | 61 72 27 20 6f 66 20 74 68 69 73 20 73 74 72 65 61 6d 2c 20 31 30 2c 30 30 31 2c 0a 73 65 65 73 | ar'.of.this.stream,.10,001,.sees |
| bb820 | 20 74 68 61 74 20 74 68 69 73 20 69 73 20 6e 6f 74 20 70 72 69 6d 65 20 65 69 74 68 65 72 2c 20 | .that.this.is.not.prime.either,. |
| bb840 | 66 6f 72 63 65 73 20 61 6e 6f 74 68 65 72 20 60 73 74 72 65 61 6d 2d 63 64 72 27 2c 20 61 6e 64 | forces.another.`stream-cdr',.and |
| bb860 | 20 73 6f 0a 6f 6e 2c 20 75 6e 74 69 6c 20 60 73 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d | .so.on,.until.`stream-enumerate- |
| bb880 | 69 6e 74 65 72 76 61 6c 27 20 79 69 65 6c 64 73 20 74 68 65 20 70 72 69 6d 65 20 31 30 2c 30 30 | interval'.yields.the.prime.10,00 |
| bb8a0 | 37 2c 20 77 68 65 72 65 75 70 6f 6e 0a 60 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 27 2c 20 61 63 | 7,.whereupon.`stream-filter',.ac |
| bb8c0 | 63 6f 72 64 69 6e 67 20 74 6f 20 69 74 73 20 64 65 66 69 6e 69 74 69 6f 6e 2c 20 72 65 74 75 72 | cording.to.its.definition,.retur |
| bb8e0 | 6e 73 0a 0a 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 28 73 74 72 65 61 6d 2d 63 61 | ns.......(cons-stream.(stream-ca |
| bb900 | 72 20 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 | r.stream)...................(str |
| bb920 | 65 61 6d 2d 66 69 6c 74 65 72 20 70 72 65 64 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 74 72 65 | eam-filter.pred.(stream-cdr.stre |
| bb940 | 61 6d 29 29 29 0a 0a 77 68 69 63 68 20 69 6e 20 74 68 69 73 20 63 61 73 65 20 69 73 0a 0a 20 20 | am)))..which.in.this.case.is.... |
| bb960 | 20 20 20 28 63 6f 6e 73 20 31 30 30 30 37 0a 20 20 20 20 20 20 20 20 20 20 20 28 64 65 6c 61 79 | ...(cons.10007............(delay |
| bb980 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 0a 20 20 20 | ..............(stream-filter.... |
| bb9a0 | 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 65 3f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........prime?............... |
| bb9c0 | 28 63 6f 6e 73 20 31 30 30 30 38 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (cons.10008..................... |
| bb9e0 | 28 64 65 6c 61 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 | (delay.......................(st |
| bba00 | 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 31 30 30 30 39 0a 20 20 | ream-enumerate-interval.10009... |
| bba20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| bba40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 30 30 30 30 30 30 29 29 29 29 29 29 0a 0a 20 20 | ...............1000000)))))).... |
| bba60 | 20 54 68 69 73 20 72 65 73 75 6c 74 20 69 73 20 6e 6f 77 20 70 61 73 73 65 64 20 74 6f 20 60 73 | .This.result.is.now.passed.to.`s |
| bba80 | 74 72 65 61 6d 2d 63 64 72 27 20 69 6e 20 6f 75 72 20 6f 72 69 67 69 6e 61 6c 20 65 78 70 72 65 | tream-cdr'.in.our.original.expre |
| bbaa0 | 73 73 69 6f 6e 2e 0a 54 68 69 73 20 66 6f 72 63 65 73 20 74 68 65 20 64 65 6c 61 79 65 64 20 60 | ssion..This.forces.the.delayed.` |
| bbac0 | 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 27 2c 20 77 68 69 63 68 20 69 6e 20 74 75 72 6e 20 6b 65 | stream-filter',.which.in.turn.ke |
| bbae0 | 65 70 73 20 66 6f 72 63 69 6e 67 20 74 68 65 0a 64 65 6c 61 79 65 64 20 60 73 74 72 65 61 6d 2d | eps.forcing.the.delayed.`stream- |
| bbb00 | 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 27 20 75 6e 74 69 6c 20 69 74 20 66 69 6e | enumerate-interval'.until.it.fin |
| bbb20 | 64 73 20 74 68 65 20 6e 65 78 74 20 70 72 69 6d 65 2c 20 77 68 69 63 68 0a 69 73 20 31 30 2c 30 | ds.the.next.prime,.which.is.10,0 |
| bbb40 | 30 39 2e 20 20 46 69 6e 61 6c 6c 79 2c 20 74 68 65 20 72 65 73 75 6c 74 20 70 61 73 73 65 64 20 | 09...Finally,.the.result.passed. |
| bbb60 | 74 6f 20 60 73 74 72 65 61 6d 2d 63 61 72 27 20 69 6e 20 6f 75 72 20 6f 72 69 67 69 6e 61 6c 0a | to.`stream-car'.in.our.original. |
| bbb80 | 65 78 70 72 65 73 73 69 6f 6e 20 69 73 0a 0a 20 20 20 20 20 28 63 6f 6e 73 20 31 30 30 30 39 0a | expression.is.......(cons.10009. |
| bbba0 | 20 20 20 20 20 20 20 20 20 20 20 28 64 65 6c 61 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ...........(delay..............( |
| bbbc0 | 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6d | stream-filter...............prim |
| bbbe0 | 65 3f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 31 30 30 31 30 0a 20 20 20 | e?...............(cons.10010.... |
| bbc00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 6c 61 79 0a 20 20 20 20 20 20 20 20 | .................(delay......... |
| bbc20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d | ..............(stream-enumerate- |
| bbc40 | 69 6e 74 65 72 76 61 6c 20 31 30 30 31 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | interval.10011.................. |
| bbc60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| bbc80 | 31 30 30 30 30 30 30 29 29 29 29 29 29 0a 0a 20 20 20 60 53 74 72 65 61 6d 2d 63 61 72 27 20 72 | 1000000)))))).....`Stream-car'.r |
| bbca0 | 65 74 75 72 6e 73 20 31 30 2c 30 30 39 2c 20 61 6e 64 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 | eturns.10,009,.and.the.computati |
| bbcc0 | 6f 6e 20 69 73 20 63 6f 6d 70 6c 65 74 65 2e 20 20 4f 6e 6c 79 0a 61 73 20 6d 61 6e 79 20 69 6e | on.is.complete...Only.as.many.in |
| bbce0 | 74 65 67 65 72 73 20 77 65 72 65 20 74 65 73 74 65 64 20 66 6f 72 20 70 72 69 6d 61 6c 69 74 79 | tegers.were.tested.for.primality |
| bbd00 | 20 61 73 20 77 65 72 65 20 6e 65 63 65 73 73 61 72 79 20 74 6f 20 66 69 6e 64 0a 74 68 65 20 73 | .as.were.necessary.to.find.the.s |
| bbd20 | 65 63 6f 6e 64 20 70 72 69 6d 65 2c 20 61 6e 64 20 74 68 65 20 69 6e 74 65 72 76 61 6c 20 77 61 | econd.prime,.and.the.interval.wa |
| bbd40 | 73 20 65 6e 75 6d 65 72 61 74 65 64 20 6f 6e 6c 79 20 61 73 20 66 61 72 20 61 73 20 77 61 73 0a | s.enumerated.only.as.far.as.was. |
| bbd60 | 6e 65 63 65 73 73 61 72 79 20 74 6f 20 66 65 65 64 20 74 68 65 20 70 72 69 6d 65 20 66 69 6c 74 | necessary.to.feed.the.prime.filt |
| bbd80 | 65 72 2e 0a 0a 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 77 65 20 63 61 6e 20 74 68 69 6e 6b | er......In.general,.we.can.think |
| bbda0 | 20 6f 66 20 64 65 6c 61 79 65 64 20 65 76 61 6c 75 61 74 69 6f 6e 20 61 73 20 22 64 65 6d 61 6e | .of.delayed.evaluation.as."deman |
| bbdc0 | 64 2d 64 72 69 76 65 6e 22 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 20 77 68 65 72 65 62 79 20 65 | d-driven".programming,.whereby.e |
| bbde0 | 61 63 68 20 73 74 61 67 65 20 69 6e 20 74 68 65 20 73 74 72 65 61 6d 20 70 72 6f 63 65 73 73 20 | ach.stage.in.the.stream.process. |
| bbe00 | 69 73 20 61 63 74 69 76 61 74 65 64 20 6f 6e 6c 79 0a 65 6e 6f 75 67 68 20 74 6f 20 73 61 74 69 | is.activated.only.enough.to.sati |
| bbe20 | 73 66 79 20 74 68 65 20 6e 65 78 74 20 73 74 61 67 65 2e 20 20 57 68 61 74 20 77 65 20 68 61 76 | sfy.the.next.stage...What.we.hav |
| bbe40 | 65 20 64 6f 6e 65 20 69 73 20 74 6f 20 64 65 63 6f 75 70 6c 65 20 74 68 65 0a 61 63 74 75 61 6c | e.done.is.to.decouple.the.actual |
| bbe60 | 20 6f 72 64 65 72 20 6f 66 20 65 76 65 6e 74 73 20 69 6e 20 74 68 65 20 63 6f 6d 70 75 74 61 74 | .order.of.events.in.the.computat |
| bbe80 | 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 61 70 70 61 72 65 6e 74 20 73 74 72 75 63 74 75 72 65 0a | ion.from.the.apparent.structure. |
| bbea0 | 6f 66 20 6f 75 72 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 57 65 20 77 72 69 74 65 20 70 72 6f | of.our.procedures...We.write.pro |
| bbec0 | 63 65 64 75 72 65 73 20 61 73 20 69 66 20 74 68 65 20 73 74 72 65 61 6d 73 20 65 78 69 73 74 65 | cedures.as.if.the.streams.existe |
| bbee0 | 64 20 22 61 6c 6c 0a 61 74 20 6f 6e 63 65 22 20 77 68 65 6e 2c 20 69 6e 20 72 65 61 6c 69 74 79 | d."all.at.once".when,.in.reality |
| bbf00 | 2c 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 69 73 20 70 65 72 66 6f 72 6d 65 64 20 69 | ,.the.computation.is.performed.i |
| bbf20 | 6e 63 72 65 6d 65 6e 74 61 6c 6c 79 2c 0a 61 73 20 69 6e 20 74 72 61 64 69 74 69 6f 6e 61 6c 20 | ncrementally,.as.in.traditional. |
| bbf40 | 70 72 6f 67 72 61 6d 6d 69 6e 67 20 73 74 79 6c 65 73 2e 0a 0a 49 6d 70 6c 65 6d 65 6e 74 69 6e | programming.styles...Implementin |
| bbf60 | 67 20 60 64 65 6c 61 79 27 20 61 6e 64 20 60 66 6f 72 63 65 27 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | g.`delay'.and.`force'........... |
| bbf80 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 6c 74 68 6f 75 67 68 | ........................Although |
| bbfa0 | 20 60 64 65 6c 61 79 27 20 61 6e 64 20 60 66 6f 72 63 65 27 20 6d 61 79 20 73 65 65 6d 20 6c 69 | .`delay'.and.`force'.may.seem.li |
| bbfc0 | 6b 65 20 6d 79 73 74 65 72 69 6f 75 73 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 74 68 65 69 72 0a | ke.mysterious.operations,.their. |
| bbfe0 | 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 69 73 20 72 65 61 6c 6c 79 20 71 75 69 74 65 20 73 | implementation.is.really.quite.s |
| bc000 | 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 2e 20 20 60 44 65 6c 61 79 27 20 6d 75 73 74 20 70 61 | traightforward...`Delay'.must.pa |
| bc020 | 63 6b 61 67 65 0a 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 73 6f 20 74 68 61 74 20 69 74 20 63 | ckage.an.expression.so.that.it.c |
| bc040 | 61 6e 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 6c 61 74 65 72 20 6f 6e 20 64 65 6d 61 6e 64 2c | an.be.evaluated.later.on.demand, |
| bc060 | 20 61 6e 64 20 77 65 20 63 61 6e 0a 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 20 73 69 6d 70 | .and.we.can.accomplish.this.simp |
| bc080 | 6c 79 20 62 79 20 74 72 65 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 61 73 | ly.by.treating.the.expression.as |
| bc0a0 | 20 74 68 65 20 62 6f 64 79 20 6f 66 20 61 0a 70 72 6f 63 65 64 75 72 65 2e 20 20 60 44 65 6c 61 | .the.body.of.a.procedure...`Dela |
| bc0c0 | 79 27 20 63 61 6e 20 62 65 20 61 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 73 75 63 68 20 74 68 | y'.can.be.a.special.form.such.th |
| bc0e0 | 61 74 0a 0a 20 20 20 20 20 28 64 65 6c 61 79 20 3c 45 58 50 3e 29 0a 0a 69 73 20 73 79 6e 74 61 | at.......(delay.<EXP>)..is.synta |
| bc100 | 63 74 69 63 20 73 75 67 61 72 20 66 6f 72 0a 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 | ctic.sugar.for.......(lambda.(). |
| bc120 | 3c 45 58 50 3e 29 0a 0a 20 20 20 60 46 6f 72 63 65 27 20 73 69 6d 70 6c 79 20 63 61 6c 6c 73 20 | <EXP>).....`Force'.simply.calls. |
| bc140 | 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 28 6f 66 20 6e 6f 20 61 72 67 75 6d 65 6e 74 73 29 20 | the.procedure.(of.no.arguments). |
| bc160 | 70 72 6f 64 75 63 65 64 20 62 79 0a 60 64 65 6c 61 79 27 2c 20 73 6f 20 77 65 20 63 61 6e 20 69 | produced.by.`delay',.so.we.can.i |
| bc180 | 6d 70 6c 65 6d 65 6e 74 20 60 66 6f 72 63 65 27 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 3a | mplement.`force'.as.a.procedure: |
| bc1a0 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6f 72 63 65 20 64 65 6c 61 79 65 64 2d 6f 62 | .......(define.(force.delayed-ob |
| bc1c0 | 6a 65 63 74 29 0a 20 20 20 20 20 20 20 28 64 65 6c 61 79 65 64 2d 6f 62 6a 65 63 74 29 29 0a 0a | ject)........(delayed-object)).. |
| bc1e0 | 20 20 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 73 75 66 66 69 63 65 73 20 | ...This.implementation.suffices. |
| bc200 | 66 6f 72 20 60 64 65 6c 61 79 27 20 61 6e 64 20 60 66 6f 72 63 65 27 20 74 6f 20 77 6f 72 6b 20 | for.`delay'.and.`force'.to.work. |
| bc220 | 61 73 0a 61 64 76 65 72 74 69 73 65 64 2c 20 62 75 74 20 74 68 65 72 65 20 69 73 20 61 6e 20 69 | as.advertised,.but.there.is.an.i |
| bc240 | 6d 70 6f 72 74 61 6e 74 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 74 68 61 74 20 77 65 20 63 61 | mportant.optimization.that.we.ca |
| bc260 | 6e 20 69 6e 63 6c 75 64 65 2e 0a 49 6e 20 6d 61 6e 79 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 2c | n.include..In.many.applications, |
| bc280 | 20 77 65 20 65 6e 64 20 75 70 20 66 6f 72 63 69 6e 67 20 74 68 65 20 73 61 6d 65 20 64 65 6c 61 | .we.end.up.forcing.the.same.dela |
| bc2a0 | 79 65 64 20 6f 62 6a 65 63 74 20 6d 61 6e 79 0a 74 69 6d 65 73 2e 20 20 54 68 69 73 20 63 61 6e | yed.object.many.times...This.can |
| bc2c0 | 20 6c 65 61 64 20 74 6f 20 73 65 72 69 6f 75 73 20 69 6e 65 66 66 69 63 69 65 6e 63 79 20 69 6e | .lead.to.serious.inefficiency.in |
| bc2e0 | 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 67 72 61 6d 73 0a 69 6e 76 6f 6c 76 69 6e 67 20 73 74 | .recursive.programs.involving.st |
| bc300 | 72 65 61 6d 73 2e 20 20 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 35 37 | reams...(See.*Note.Exercise.3-57 |
| bc320 | 3a 3a 2e 29 20 20 54 68 65 20 73 6f 6c 75 74 69 6f 6e 20 69 73 20 74 6f 0a 62 75 69 6c 64 20 64 | ::.)..The.solution.is.to.build.d |
| bc340 | 65 6c 61 79 65 64 20 6f 62 6a 65 63 74 73 20 73 6f 20 74 68 61 74 20 74 68 65 20 66 69 72 73 74 | elayed.objects.so.that.the.first |
| bc360 | 20 74 69 6d 65 20 74 68 65 79 20 61 72 65 20 66 6f 72 63 65 64 2c 20 74 68 65 79 0a 73 74 6f 72 | .time.they.are.forced,.they.stor |
| bc380 | 65 20 74 68 65 20 76 61 6c 75 65 20 74 68 61 74 20 69 73 20 63 6f 6d 70 75 74 65 64 2e 20 20 53 | e.the.value.that.is.computed...S |
| bc3a0 | 75 62 73 65 71 75 65 6e 74 20 66 6f 72 63 69 6e 67 73 20 77 69 6c 6c 20 73 69 6d 70 6c 79 0a 72 | ubsequent.forcings.will.simply.r |
| bc3c0 | 65 74 75 72 6e 20 74 68 65 20 73 74 6f 72 65 64 20 76 61 6c 75 65 20 77 69 74 68 6f 75 74 20 72 | eturn.the.stored.value.without.r |
| bc3e0 | 65 70 65 61 74 69 6e 67 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 49 6e 20 6f 74 | epeating.the.computation...In.ot |
| bc400 | 68 65 72 0a 77 6f 72 64 73 2c 20 77 65 20 69 6d 70 6c 65 6d 65 6e 74 20 60 64 65 6c 61 79 27 20 | her.words,.we.implement.`delay'. |
| bc420 | 61 73 20 61 20 73 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 6d 65 6d 6f 69 7a 65 64 20 70 72 | as.a.special-purpose.memoized.pr |
| bc440 | 6f 63 65 64 75 72 65 0a 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 6f 6e 65 20 64 65 73 63 72 | ocedure.similar.to.the.one.descr |
| bc460 | 69 62 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 32 37 3a 3a 2e 20 20 | ibed.in.*Note.Exercise.3-27::... |
| bc480 | 4f 6e 65 20 77 61 79 20 74 6f 0a 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 20 69 73 20 74 6f | One.way.to.accomplish.this.is.to |
| bc4a0 | 20 75 73 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 | .use.the.following.procedure,.wh |
| bc4c0 | 69 63 68 20 74 61 6b 65 73 20 61 73 0a 61 72 67 75 6d 65 6e 74 20 61 20 70 72 6f 63 65 64 75 72 | ich.takes.as.argument.a.procedur |
| bc4e0 | 65 20 28 6f 66 20 6e 6f 20 61 72 67 75 6d 65 6e 74 73 29 20 61 6e 64 20 72 65 74 75 72 6e 73 20 | e.(of.no.arguments).and.returns. |
| bc500 | 61 20 6d 65 6d 6f 69 7a 65 64 20 76 65 72 73 69 6f 6e 0a 6f 66 20 74 68 65 20 70 72 6f 63 65 64 | a.memoized.version.of.the.proced |
| bc520 | 75 72 65 2e 20 20 54 68 65 20 66 69 72 73 74 20 74 69 6d 65 20 74 68 65 20 6d 65 6d 6f 69 7a 65 | ure...The.first.time.the.memoize |
| bc540 | 64 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 72 75 6e 2c 20 69 74 0a 73 61 76 65 73 20 74 68 65 | d.procedure.is.run,.it.saves.the |
| bc560 | 20 63 6f 6d 70 75 74 65 64 20 72 65 73 75 6c 74 2e 20 20 4f 6e 20 73 75 62 73 65 71 75 65 6e 74 | .computed.result...On.subsequent |
| bc580 | 20 65 76 61 6c 75 61 74 69 6f 6e 73 2c 20 69 74 20 73 69 6d 70 6c 79 0a 72 65 74 75 72 6e 73 20 | .evaluations,.it.simply.returns. |
| bc5a0 | 74 68 65 20 72 65 73 75 6c 74 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 65 6d 6f 2d | the.result........(define.(memo- |
| bc5c0 | 70 72 6f 63 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 61 6c 72 65 61 64 79 | proc.proc)........(let.((already |
| bc5e0 | 2d 72 75 6e 3f 20 66 61 6c 73 65 29 20 28 72 65 73 75 6c 74 20 66 61 6c 73 65 29 29 0a 20 20 20 | -run?.false).(result.false)).... |
| bc600 | 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 | ......(lambda.()............(if. |
| bc620 | 28 6e 6f 74 20 61 6c 72 65 61 64 79 2d 72 75 6e 3f 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | (not.already-run?).............. |
| bc640 | 20 20 28 62 65 67 69 6e 20 28 73 65 74 21 20 72 65 73 75 6c 74 20 28 70 72 6f 63 29 29 0a 20 20 | ..(begin.(set!.result.(proc))... |
| bc660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 61 6c 72 65 61 64 | ....................(set!.alread |
| bc680 | 79 2d 72 75 6e 3f 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | y-run?.true).................... |
| bc6a0 | 20 20 20 72 65 73 75 6c 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 73 75 6c 74 | ...result)................result |
| bc6c0 | 29 29 29 29 0a 0a 20 20 20 60 44 65 6c 61 79 27 20 69 73 20 74 68 65 6e 20 64 65 66 69 6e 65 64 | )))).....`Delay'.is.then.defined |
| bc6e0 | 20 73 6f 20 74 68 61 74 20 60 28 64 65 6c 61 79 20 3c 45 58 50 3e 29 27 20 69 73 20 65 71 75 69 | .so.that.`(delay.<EXP>)'.is.equi |
| bc700 | 76 61 6c 65 6e 74 20 74 6f 0a 0a 20 20 20 20 20 28 6d 65 6d 6f 2d 70 72 6f 63 20 28 6c 61 6d 62 | valent.to.......(memo-proc.(lamb |
| bc720 | 64 61 20 28 29 20 3c 45 58 50 3e 29 29 0a 0a 61 6e 64 20 60 66 6f 72 63 65 27 20 69 73 20 61 73 | da.().<EXP>))..and.`force'.is.as |
| bc740 | 20 64 65 66 69 6e 65 64 20 70 72 65 76 69 6f 75 73 6c 79 2e 28 36 29 0a 0a 20 20 20 20 20 2a 45 | .defined.previously.(6).......*E |
| bc760 | 78 65 72 63 69 73 65 20 33 2e 35 30 3a 2a 20 43 6f 6d 70 6c 65 74 65 20 74 68 65 20 66 6f 6c 6c | xercise.3.50:*.Complete.the.foll |
| bc780 | 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 2c 20 77 68 69 63 68 0a 20 20 20 20 20 67 65 6e | owing.definition,.which......gen |
| bc7a0 | 65 72 61 6c 69 7a 65 73 20 60 73 74 72 65 61 6d 2d 6d 61 70 27 20 74 6f 20 61 6c 6c 6f 77 20 70 | eralizes.`stream-map'.to.allow.p |
| bc7c0 | 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 74 61 6b 65 20 6d 75 6c 74 69 70 6c 65 0a 20 20 20 | rocedures.that.take.multiple.... |
| bc7e0 | 20 20 61 72 67 75 6d 65 6e 74 73 2c 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 60 6d 61 70 27 20 | ..arguments,.analogous.to.`map'. |
| bc800 | 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 2c 20 66 6f 6f 74 6e 6f | in.section.*Note.2-2-3::,.footno |
| bc820 | 74 65 0a 20 20 20 20 20 2a 4e 6f 74 65 20 46 6f 6f 74 6e 6f 74 65 20 31 32 3a 3a 2e 0a 0a 20 20 | te......*Note.Footnote.12::..... |
| bc840 | 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 70 72 6f 63 | ........(define.(stream-map.proc |
| bc860 | 20 2e 20 61 72 67 73 74 72 65 61 6d 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 | ...argstreams).............(if.( |
| bc880 | 3c 3f 3f 3e 20 28 63 61 72 20 61 72 67 73 74 72 65 61 6d 73 29 29 0a 20 20 20 20 20 20 20 20 20 | <??>.(car.argstreams)).......... |
| bc8a0 | 20 20 20 20 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 | .......the-empty-stream......... |
| bc8c0 | 20 20 20 20 20 20 20 20 28 3c 3f 3f 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ........(<??>..................( |
| bc8e0 | 61 70 70 6c 79 20 70 72 6f 63 20 28 6d 61 70 20 3c 3f 3f 3e 20 61 72 67 73 74 72 65 61 6d 73 29 | apply.proc.(map.<??>.argstreams) |
| bc900 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 6c 79 20 73 74 72 65 61 6d | )..................(apply.stream |
| bc920 | 2d 6d 61 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f | -map.........................(co |
| bc940 | 6e 73 20 70 72 6f 63 20 28 6d 61 70 20 3c 3f 3f 3e 20 61 72 67 73 74 72 65 61 6d 73 29 29 29 29 | ns.proc.(map.<??>.argstreams)))) |
| bc960 | 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 35 31 3a 2a 20 49 6e 20 6f 72 64 | )).......*Exercise.3.51:*.In.ord |
| bc980 | 65 72 20 74 6f 20 74 61 6b 65 20 61 20 63 6c 6f 73 65 72 20 6c 6f 6f 6b 20 61 74 20 64 65 6c 61 | er.to.take.a.closer.look.at.dela |
| bc9a0 | 79 65 64 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 77 65 20 77 69 6c 6c 20 75 73 65 | yed......evaluation,.we.will.use |
| bc9c0 | 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 | .the.following.procedure,.which. |
| bc9e0 | 73 69 6d 70 6c 79 0a 20 20 20 20 20 72 65 74 75 72 6e 73 20 69 74 73 20 61 72 67 75 6d 65 6e 74 | simply......returns.its.argument |
| bca00 | 20 61 66 74 65 72 20 70 72 69 6e 74 69 6e 67 20 69 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 | .after.printing.it:............( |
| bca20 | 64 65 66 69 6e 65 20 28 73 68 6f 77 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 | define.(show.x).............(dis |
| bca40 | 70 6c 61 79 2d 6c 69 6e 65 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 78 29 0a 0a 20 20 20 | play-line.x).............x)..... |
| bca60 | 20 20 57 68 61 74 20 64 6f 65 73 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 70 72 69 6e | ..What.does.the.interpreter.prin |
| bca80 | 74 20 69 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 20 65 76 61 6c 75 61 74 69 6e 67 20 65 61 63 68 | t.in.response.to.evaluating.each |
| bcaa0 | 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e | ......expression.in.the.followin |
| bcac0 | 67 20 73 65 71 75 65 6e 63 65 3f 28 37 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e | g.sequence?(7)............(defin |
| bcae0 | 65 20 78 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 73 68 6f 77 20 28 73 74 72 65 61 6d 2d 65 6e 75 | e.x.(stream-map.show.(stream-enu |
| bcb00 | 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 30 20 31 30 29 29 29 0a 0a 20 20 20 20 20 20 20 | merate-interval.0.10)))......... |
| bcb20 | 20 20 20 28 73 74 72 65 61 6d 2d 72 65 66 20 78 20 35 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 | ...(stream-ref.x.5)............( |
| bcb40 | 73 74 72 65 61 6d 2d 72 65 66 20 78 20 37 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 | stream-ref.x.7).......*Exercise. |
| bcb60 | 33 2e 35 32 3a 2a 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 | 3.52:*.Consider.the.sequence.of. |
| bcb80 | 65 78 70 72 65 73 73 69 6f 6e 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 73 | expressions............(define.s |
| bcba0 | 75 6d 20 30 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 63 63 75 6d 20 | um.0)............(define.(accum. |
| bcbc0 | 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 73 75 6d 20 28 2b 20 78 20 73 75 | x).............(set!.sum.(+.x.su |
| bcbe0 | 6d 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 75 6d 29 0a 0a 20 20 20 20 20 20 20 20 20 20 | m)).............sum)............ |
| bcc00 | 28 64 65 66 69 6e 65 20 73 65 71 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 61 63 63 75 6d 20 28 73 | (define.seq.(stream-map.accum.(s |
| bcc20 | 74 72 65 61 6d 2d 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 31 20 32 30 29 29 29 | tream-enumerate-interval.1.20))) |
| bcc40 | 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 79 20 28 73 74 72 65 61 6d 2d 66 69 6c | ...........(define.y.(stream-fil |
| bcc60 | 74 65 72 20 65 76 65 6e 3f 20 73 65 71 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e | ter.even?.seq))...........(defin |
| bcc80 | 65 20 7a 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 | e.z.(stream-filter.(lambda.(x).( |
| bcca0 | 3d 20 28 72 65 6d 61 69 6e 64 65 72 20 78 20 35 29 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 | =.(remainder.x.5).0))........... |
| bccc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 65 71 29 29 0a 0a | .........................seq)).. |
| bcce0 | 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 72 65 66 20 79 20 37 29 0a 0a 20 20 20 20 | ..........(stream-ref.y.7)...... |
| bcd00 | 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 2d 73 74 72 65 61 6d 20 7a 29 0a 0a 20 20 20 20 20 57 | ......(display-stream.z).......W |
| bcd20 | 68 61 74 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 73 75 6d 27 20 61 66 74 65 72 20 | hat.is.the.value.of.`sum'.after. |
| bcd40 | 65 61 63 68 20 6f 66 20 74 68 65 20 61 62 6f 76 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 73 | each.of.the.above.expressions.is |
| bcd60 | 0a 20 20 20 20 20 65 76 61 6c 75 61 74 65 64 3f 20 20 57 68 61 74 20 69 73 20 74 68 65 20 70 72 | ......evaluated?..What.is.the.pr |
| bcd80 | 69 6e 74 65 64 20 72 65 73 70 6f 6e 73 65 20 74 6f 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 | inted.response.to.evaluating.the |
| bcda0 | 0a 20 20 20 20 20 60 73 74 72 65 61 6d 2d 72 65 66 27 20 61 6e 64 20 60 64 69 73 70 6c 61 79 2d | ......`stream-ref'.and.`display- |
| bcdc0 | 73 74 72 65 61 6d 27 20 65 78 70 72 65 73 73 69 6f 6e 73 3f 20 20 57 6f 75 6c 64 20 74 68 65 73 | stream'.expressions?..Would.thes |
| bcde0 | 65 0a 20 20 20 20 20 72 65 73 70 6f 6e 73 65 73 20 64 69 66 66 65 72 20 69 66 20 77 65 20 68 61 | e......responses.differ.if.we.ha |
| bce00 | 64 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 60 28 64 65 6c 61 79 20 3c 45 58 50 3e 29 27 20 73 69 | d.implemented.`(delay.<EXP>)'.si |
| bce20 | 6d 70 6c 79 20 61 73 0a 20 20 20 20 20 60 28 6c 61 6d 62 64 61 20 28 29 20 3c 45 58 50 3e 29 27 | mply.as......`(lambda.().<EXP>)' |
| bce40 | 20 77 69 74 68 6f 75 74 20 75 73 69 6e 67 20 74 68 65 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 | .without.using.the.optimization. |
| bce60 | 70 72 6f 76 69 64 65 64 20 62 79 0a 20 20 20 20 20 60 6d 65 6d 6f 2d 70 72 6f 63 27 3f 20 20 45 | provided.by......`memo-proc'?..E |
| bce80 | 78 70 6c 61 69 6e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 | xplain.....----------.Footnotes. |
| bcea0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 41 73 73 75 6d 65 20 74 68 61 74 20 77 | ----------.....(1).Assume.that.w |
| bcec0 | 65 20 68 61 76 65 20 61 20 70 72 65 64 69 63 61 74 65 20 60 70 72 69 6d 65 3f 27 20 28 65 2e 67 | e.have.a.predicate.`prime?'.(e.g |
| bcee0 | 2e 2c 20 61 73 20 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 31 2d 32 2d 36 3a 3a 29 20 | .,.as.in.section.*Note.1-2-6::). |
| bcf00 | 74 68 61 74 20 74 65 73 74 73 20 66 6f 72 20 70 72 69 6d 61 6c 69 74 79 2e 0a 0a 20 20 20 28 32 | that.tests.for.primality......(2 |
| bcf20 | 29 20 49 6e 20 74 68 65 20 4d 49 54 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 20 60 74 68 | ).In.the.MIT.implementation,.`th |
| bcf40 | 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 27 20 69 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 | e-empty-stream'.is.the.same.as.t |
| bcf60 | 68 65 0a 65 6d 70 74 79 20 6c 69 73 74 20 60 27 28 29 27 2c 20 61 6e 64 20 60 73 74 72 65 61 6d | he.empty.list.`'()',.and.`stream |
| bcf80 | 2d 6e 75 6c 6c 3f 27 20 69 73 20 74 68 65 20 73 61 6d 65 20 61 73 20 60 6e 75 6c 6c 3f 27 2e 0a | -null?'.is.the.same.as.`null?'.. |
| bcfa0 | 0a 20 20 20 28 33 29 20 54 68 69 73 20 73 68 6f 75 6c 64 20 62 6f 74 68 65 72 20 79 6f 75 2e 20 | ....(3).This.should.bother.you.. |
| bcfc0 | 20 54 68 65 20 66 61 63 74 20 74 68 61 74 20 77 65 20 61 72 65 20 64 65 66 69 6e 69 6e 67 20 73 | .The.fact.that.we.are.defining.s |
| bcfe0 | 75 63 68 0a 73 69 6d 69 6c 61 72 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 73 74 72 65 61 | uch.similar.procedures.for.strea |
| bd000 | 6d 73 20 61 6e 64 20 6c 69 73 74 73 20 69 6e 64 69 63 61 74 65 73 20 74 68 61 74 20 77 65 20 61 | ms.and.lists.indicates.that.we.a |
| bd020 | 72 65 20 6d 69 73 73 69 6e 67 0a 73 6f 6d 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 61 62 73 74 72 | re.missing.some.underlying.abstr |
| bd040 | 61 63 74 69 6f 6e 2e 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 69 6e 20 6f 72 64 65 72 | action...Unfortunately,.in.order |
| bd060 | 20 74 6f 20 65 78 70 6c 6f 69 74 20 74 68 69 73 0a 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 77 65 | .to.exploit.this.abstraction,.we |
| bd080 | 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 65 78 65 72 74 20 66 69 6e 65 72 20 63 6f 6e 74 72 6f | .will.need.to.exert.finer.contro |
| bd0a0 | 6c 20 6f 76 65 72 20 74 68 65 20 70 72 6f 63 65 73 73 20 6f 66 0a 65 76 61 6c 75 61 74 69 6f 6e | l.over.the.process.of.evaluation |
| bd0c0 | 20 74 68 61 6e 20 77 65 20 63 61 6e 20 61 74 20 70 72 65 73 65 6e 74 2e 20 20 57 65 20 77 69 6c | .than.we.can.at.present...We.wil |
| bd0e0 | 6c 20 64 69 73 63 75 73 73 20 74 68 69 73 20 70 6f 69 6e 74 20 66 75 72 74 68 65 72 0a 61 74 20 | l.discuss.this.point.further.at. |
| bd100 | 74 68 65 20 65 6e 64 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d 34 3a 3a | the.end.of.section.*Note.3-5-4:: |
| bd120 | 2e 20 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 32 3a 3a 2c 20 77 65 27 6c 6c | ...In.section.*Note.4-2::,.we'll |
| bd140 | 0a 64 65 76 65 6c 6f 70 20 61 20 66 72 61 6d 65 77 6f 72 6b 20 74 68 61 74 20 75 6e 69 66 69 65 | .develop.a.framework.that.unifie |
| bd160 | 73 20 6c 69 73 74 73 20 61 6e 64 20 73 74 72 65 61 6d 73 2e 0a 0a 20 20 20 28 34 29 20 41 6c 74 | s.lists.and.streams......(4).Alt |
| bd180 | 68 6f 75 67 68 20 60 73 74 72 65 61 6d 2d 63 61 72 27 20 61 6e 64 20 60 73 74 72 65 61 6d 2d 63 | hough.`stream-car'.and.`stream-c |
| bd1a0 | 64 72 27 20 63 61 6e 20 62 65 20 64 65 66 69 6e 65 64 20 61 73 0a 70 72 6f 63 65 64 75 72 65 73 | dr'.can.be.defined.as.procedures |
| bd1c0 | 2c 20 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 20 6d 75 73 74 20 62 65 20 61 20 73 70 65 63 69 61 | ,.`cons-stream'.must.be.a.specia |
| bd1e0 | 6c 20 66 6f 72 6d 2e 20 20 49 66 20 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 0a 77 65 72 65 20 61 | l.form...If.`cons-stream'.were.a |
| bd200 | 20 70 72 6f 63 65 64 75 72 65 2c 20 74 68 65 6e 2c 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 6f | .procedure,.then,.according.to.o |
| bd220 | 75 72 20 6d 6f 64 65 6c 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 2c 0a 65 76 61 6c 75 61 74 69 | ur.model.of.evaluation,.evaluati |
| bd240 | 6e 67 20 60 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 3c 41 3e 20 3c 42 3e 29 27 20 77 6f 75 6c 64 | ng.`(cons-stream.<A>.<B>)'.would |
| bd260 | 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 63 61 75 73 65 20 3c 42 3e 20 74 6f 20 62 65 0a 65 | .automatically.cause.<B>.to.be.e |
| bd280 | 76 61 6c 75 61 74 65 64 2c 20 77 68 69 63 68 20 69 73 20 70 72 65 63 69 73 65 6c 79 20 77 68 61 | valuated,.which.is.precisely.wha |
| bd2a0 | 74 20 77 65 20 64 6f 20 6e 6f 74 20 77 61 6e 74 20 74 6f 20 68 61 70 70 65 6e 2e 20 20 46 6f 72 | t.we.do.not.want.to.happen...For |
| bd2c0 | 20 74 68 65 0a 73 61 6d 65 20 72 65 61 73 6f 6e 2c 20 60 64 65 6c 61 79 27 20 6d 75 73 74 20 62 | .the.same.reason,.`delay'.must.b |
| bd2e0 | 65 20 61 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 2c 20 74 68 6f 75 67 68 20 60 66 6f 72 63 65 27 | e.a.special.form,.though.`force' |
| bd300 | 20 63 61 6e 20 62 65 20 61 6e 0a 6f 72 64 69 6e 61 72 79 20 70 72 6f 63 65 64 75 72 65 2e 0a 0a | .can.be.an.ordinary.procedure... |
| bd320 | 20 20 20 28 35 29 20 54 68 65 20 6e 75 6d 62 65 72 73 20 73 68 6f 77 6e 20 68 65 72 65 20 64 6f | ...(5).The.numbers.shown.here.do |
| bd340 | 20 6e 6f 74 20 72 65 61 6c 6c 79 20 61 70 70 65 61 72 20 69 6e 20 74 68 65 20 64 65 6c 61 79 65 | .not.really.appear.in.the.delaye |
| bd360 | 64 0a 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 57 68 61 74 20 61 63 74 75 61 6c 6c 79 20 61 70 70 | d.expression...What.actually.app |
| bd380 | 65 61 72 73 20 69 73 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 2c | ears.is.the.original.expression, |
| bd3a0 | 20 69 6e 20 61 6e 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 | .in.an.environment.in.which.the. |
| bd3c0 | 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 61 70 70 72 6f | variables.are.bound.to.the.appro |
| bd3e0 | 70 72 69 61 74 65 20 6e 75 6d 62 65 72 73 2e 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 60 28 2b | priate.numbers..For.example,.`(+ |
| bd400 | 20 6c 6f 77 20 31 29 27 20 77 69 74 68 20 60 6c 6f 77 27 20 62 6f 75 6e 64 20 74 6f 20 31 30 2c | .low.1)'.with.`low'.bound.to.10, |
| bd420 | 30 30 30 20 61 63 74 75 61 6c 6c 79 20 61 70 70 65 61 72 73 0a 77 68 65 72 65 20 60 31 30 30 30 | 000.actually.appears.where.`1000 |
| bd440 | 31 27 20 69 73 20 73 68 6f 77 6e 2e 0a 0a 20 20 20 28 36 29 20 54 68 65 72 65 20 61 72 65 20 6d | 1'.is.shown......(6).There.are.m |
| bd460 | 61 6e 79 20 70 6f 73 73 69 62 6c 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 | any.possible.implementations.of. |
| bd480 | 73 74 72 65 61 6d 73 20 6f 74 68 65 72 20 74 68 61 6e 0a 74 68 65 20 6f 6e 65 20 64 65 73 63 72 | streams.other.than.the.one.descr |
| bd4a0 | 69 62 65 64 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2e 20 20 44 65 6c 61 79 65 64 20 65 | ibed.in.this.section...Delayed.e |
| bd4c0 | 76 61 6c 75 61 74 69 6f 6e 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 0a 6b 65 79 20 74 6f 20 6d | valuation,.which.is.the.key.to.m |
| bd4e0 | 61 6b 69 6e 67 20 73 74 72 65 61 6d 73 20 70 72 61 63 74 69 63 61 6c 2c 20 77 61 73 20 69 6e 68 | aking.streams.practical,.was.inh |
| bd500 | 65 72 65 6e 74 20 69 6e 20 41 6c 67 6f 6c 20 36 30 27 73 20 22 63 61 6c 6c 2d 62 79 2d 6e 61 6d | erent.in.Algol.60's."call-by-nam |
| bd520 | 65 22 0a 70 61 72 61 6d 65 74 65 72 2d 70 61 73 73 69 6e 67 20 6d 65 74 68 6f 64 2e 20 20 54 68 | e".parameter-passing.method...Th |
| bd540 | 65 20 75 73 65 20 6f 66 20 74 68 69 73 20 6d 65 63 68 61 6e 69 73 6d 20 74 6f 20 69 6d 70 6c 65 | e.use.of.this.mechanism.to.imple |
| bd560 | 6d 65 6e 74 0a 73 74 72 65 61 6d 73 20 77 61 73 20 66 69 72 73 74 20 64 65 73 63 72 69 62 65 64 | ment.streams.was.first.described |
| bd580 | 20 62 79 20 4c 61 6e 64 69 6e 20 28 31 39 36 35 29 2e 20 20 44 65 6c 61 79 65 64 20 65 76 61 6c | .by.Landin.(1965)...Delayed.eval |
| bd5a0 | 75 61 74 69 6f 6e 20 66 6f 72 0a 73 74 72 65 61 6d 73 20 77 61 73 20 69 6e 74 72 6f 64 75 63 65 | uation.for.streams.was.introduce |
| bd5c0 | 64 20 69 6e 74 6f 20 4c 69 73 70 20 62 79 20 46 72 69 65 64 6d 61 6e 20 61 6e 64 20 57 69 73 65 | d.into.Lisp.by.Friedman.and.Wise |
| bd5e0 | 20 28 31 39 37 36 29 2e 20 49 6e 20 74 68 65 69 72 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e | .(1976)..In.their.implementation |
| bd600 | 2c 20 60 63 6f 6e 73 27 20 61 6c 77 61 79 73 20 64 65 6c 61 79 73 20 65 76 61 6c 75 61 74 69 6e | ,.`cons'.always.delays.evaluatin |
| bd620 | 67 20 69 74 73 20 61 72 67 75 6d 65 6e 74 73 2c 20 73 6f 20 74 68 61 74 0a 6c 69 73 74 73 20 61 | g.its.arguments,.so.that.lists.a |
| bd640 | 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 62 65 68 61 76 65 20 61 73 20 73 74 72 65 61 6d 73 2e 20 | utomatically.behave.as.streams.. |
| bd660 | 20 54 68 65 20 6d 65 6d 6f 69 7a 69 6e 67 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 69 73 0a 61 | .The.memoizing.optimization.is.a |
| bd680 | 6c 73 6f 20 6b 6e 6f 77 6e 20 61 73 20 22 63 61 6c 6c 2d 62 79 2d 6e 65 65 64 22 2e 20 20 54 68 | lso.known.as."call-by-need"...Th |
| bd6a0 | 65 20 41 6c 67 6f 6c 20 63 6f 6d 6d 75 6e 69 74 79 20 77 6f 75 6c 64 20 72 65 66 65 72 20 74 6f | e.Algol.community.would.refer.to |
| bd6c0 | 20 6f 75 72 0a 6f 72 69 67 69 6e 61 6c 20 64 65 6c 61 79 65 64 20 6f 62 6a 65 63 74 73 20 61 73 | .our.original.delayed.objects.as |
| bd6e0 | 20 22 63 61 6c 6c 2d 62 79 2d 6e 61 6d 65 20 74 68 75 6e 6b 73 22 20 61 6e 64 20 74 6f 20 74 68 | ."call-by-name.thunks".and.to.th |
| bd700 | 65 20 6f 70 74 69 6d 69 7a 65 64 0a 76 65 72 73 69 6f 6e 73 20 61 73 20 22 63 61 6c 6c 2d 62 79 | e.optimized.versions.as."call-by |
| bd720 | 2d 6e 65 65 64 20 74 68 75 6e 6b 73 22 2e 0a 0a 20 20 20 28 37 29 20 45 78 65 72 63 69 73 65 73 | -need.thunks"......(7).Exercises |
| bd740 | 20 73 75 63 68 20 61 73 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 35 31 3a 3a 20 61 | .such.as.*Note.Exercise.3-51::.a |
| bd760 | 6e 64 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 33 2d 35 32 3a 3a 20 61 72 65 20 76 61 6c | nd.*Note.Exercise.3-52::.are.val |
| bd780 | 75 61 62 6c 65 20 66 6f 72 20 74 65 73 74 69 6e 67 20 6f 75 72 20 75 6e 64 65 72 73 74 61 6e 64 | uable.for.testing.our.understand |
| bd7a0 | 69 6e 67 20 6f 66 20 68 6f 77 20 60 64 65 6c 61 79 27 20 77 6f 72 6b 73 2e 0a 4f 6e 20 74 68 65 | ing.of.how.`delay'.works..On.the |
| bd7c0 | 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 69 6e 74 65 72 6d 69 78 69 6e 67 20 64 65 6c 61 79 65 64 | .other.hand,.intermixing.delayed |
| bd7e0 | 20 65 76 61 6c 75 61 74 69 6f 6e 20 77 69 74 68 20 70 72 69 6e 74 69 6e 67 2d 2d 61 6e 64 2c 0a | .evaluation.with.printing--and,. |
| bd800 | 65 76 65 6e 20 77 6f 72 73 65 2c 20 77 69 74 68 20 61 73 73 69 67 6e 6d 65 6e 74 2d 2d 69 73 20 | even.worse,.with.assignment--is. |
| bd820 | 65 78 74 72 65 6d 65 6c 79 20 63 6f 6e 66 75 73 69 6e 67 2c 20 61 6e 64 20 69 6e 73 74 72 75 63 | extremely.confusing,.and.instruc |
| bd840 | 74 6f 72 73 20 6f 66 0a 63 6f 75 72 73 65 73 20 6f 6e 20 63 6f 6d 70 75 74 65 72 20 6c 61 6e 67 | tors.of.courses.on.computer.lang |
| bd860 | 75 61 67 65 73 20 68 61 76 65 20 74 72 61 64 69 74 69 6f 6e 61 6c 6c 79 20 74 6f 72 6d 65 6e 74 | uages.have.traditionally.torment |
| bd880 | 65 64 20 74 68 65 69 72 0a 73 74 75 64 65 6e 74 73 20 77 69 74 68 20 65 78 61 6d 69 6e 61 74 69 | ed.their.students.with.examinati |
| bd8a0 | 6f 6e 20 71 75 65 73 74 69 6f 6e 73 20 73 75 63 68 20 61 73 20 74 68 65 20 6f 6e 65 73 20 69 6e | on.questions.such.as.the.ones.in |
| bd8c0 | 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2e 0a 4e 65 65 64 6c 65 73 73 20 74 6f 20 73 61 79 2c 20 | .this.section..Needless.to.say,. |
| bd8e0 | 77 72 69 74 69 6e 67 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 64 65 70 65 6e 64 20 6f 6e 20 | writing.programs.that.depend.on. |
| bd900 | 73 75 63 68 20 73 75 62 74 6c 65 74 69 65 73 20 69 73 0a 6f 64 69 6f 75 73 20 70 72 6f 67 72 61 | such.subtleties.is.odious.progra |
| bd920 | 6d 6d 69 6e 67 20 73 74 79 6c 65 2e 20 20 50 61 72 74 20 6f 66 20 74 68 65 20 70 6f 77 65 72 20 | mming.style...Part.of.the.power. |
| bd940 | 6f 66 20 73 74 72 65 61 6d 20 70 72 6f 63 65 73 73 69 6e 67 20 69 73 0a 74 68 61 74 20 69 74 20 | of.stream.processing.is.that.it. |
| bd960 | 6c 65 74 73 20 75 73 20 69 67 6e 6f 72 65 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 | lets.us.ignore.the.order.in.whic |
| bd980 | 68 20 65 76 65 6e 74 73 20 61 63 74 75 61 6c 6c 79 20 68 61 70 70 65 6e 20 69 6e 20 6f 75 72 0a | h.events.actually.happen.in.our. |
| bd9a0 | 70 72 6f 67 72 61 6d 73 2e 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 74 68 69 73 20 69 | programs...Unfortunately,.this.i |
| bd9c0 | 73 20 70 72 65 63 69 73 65 6c 79 20 77 68 61 74 20 77 65 20 63 61 6e 6e 6f 74 20 61 66 66 6f 72 | s.precisely.what.we.cannot.affor |
| bd9e0 | 64 20 74 6f 20 64 6f 0a 69 6e 20 74 68 65 20 70 72 65 73 65 6e 63 65 20 6f 66 20 61 73 73 69 67 | d.to.do.in.the.presence.of.assig |
| bda00 | 6e 6d 65 6e 74 2c 20 77 68 69 63 68 20 66 6f 72 63 65 73 20 75 73 20 74 6f 20 62 65 20 63 6f 6e | nment,.which.forces.us.to.be.con |
| bda20 | 63 65 72 6e 65 64 20 77 69 74 68 0a 74 69 6d 65 20 61 6e 64 20 63 68 61 6e 67 65 2e 0a 0a 1f 0a | cerned.with.time.and.change..... |
| bda40 | 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 35 2d 32 2c 20 20 | File:.sicp.info,..Node:.3-5-2,.. |
| bda60 | 4e 65 78 74 3a 20 33 2d 35 2d 33 2c 20 20 50 72 65 76 3a 20 33 2d 35 2d 31 2c 20 20 55 70 3a 20 | Next:.3-5-3,..Prev:.3-5-1,..Up:. |
| bda80 | 33 2d 35 0a 0a 33 2e 35 2e 32 20 49 6e 66 69 6e 69 74 65 20 53 74 72 65 61 6d 73 0a 2d 2d 2d 2d | 3-5..3.5.2.Infinite.Streams.---- |
| bdaa0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 65 20 68 61 76 65 20 73 65 65 6e | ------------------..We.have.seen |
| bdac0 | 20 68 6f 77 20 74 6f 20 73 75 70 70 6f 72 74 20 74 68 65 20 69 6c 6c 75 73 69 6f 6e 20 6f 66 20 | .how.to.support.the.illusion.of. |
| bdae0 | 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 73 74 72 65 61 6d 73 20 61 73 0a 63 6f 6d 70 6c 65 74 65 | manipulating.streams.as.complete |
| bdb00 | 20 65 6e 74 69 74 69 65 73 20 65 76 65 6e 20 74 68 6f 75 67 68 2c 20 69 6e 20 61 63 74 75 61 6c | .entities.even.though,.in.actual |
| bdb20 | 69 74 79 2c 20 77 65 20 63 6f 6d 70 75 74 65 20 6f 6e 6c 79 20 61 73 20 6d 75 63 68 20 6f 66 0a | ity,.we.compute.only.as.much.of. |
| bdb40 | 74 68 65 20 73 74 72 65 61 6d 20 61 73 20 77 65 20 6e 65 65 64 20 74 6f 20 61 63 63 65 73 73 2e | the.stream.as.we.need.to.access. |
| bdb60 | 20 20 57 65 20 63 61 6e 20 65 78 70 6c 6f 69 74 20 74 68 69 73 20 74 65 63 68 6e 69 71 75 65 20 | ..We.can.exploit.this.technique. |
| bdb80 | 74 6f 0a 72 65 70 72 65 73 65 6e 74 20 73 65 71 75 65 6e 63 65 73 20 65 66 66 69 63 69 65 6e 74 | to.represent.sequences.efficient |
| bdba0 | 6c 79 20 61 73 20 73 74 72 65 61 6d 73 2c 20 65 76 65 6e 20 69 66 20 74 68 65 20 73 65 71 75 65 | ly.as.streams,.even.if.the.seque |
| bdbc0 | 6e 63 65 73 20 61 72 65 0a 76 65 72 79 20 6c 6f 6e 67 2e 20 20 57 68 61 74 20 69 73 20 6d 6f 72 | nces.are.very.long...What.is.mor |
| bdbe0 | 65 20 73 74 72 69 6b 69 6e 67 2c 20 77 65 20 63 61 6e 20 75 73 65 20 73 74 72 65 61 6d 73 20 74 | e.striking,.we.can.use.streams.t |
| bdc00 | 6f 20 72 65 70 72 65 73 65 6e 74 0a 73 65 71 75 65 6e 63 65 73 20 74 68 61 74 20 61 72 65 20 69 | o.represent.sequences.that.are.i |
| bdc20 | 6e 66 69 6e 69 74 65 6c 79 20 6c 6f 6e 67 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 63 | nfinitely.long...For.instance,.c |
| bdc40 | 6f 6e 73 69 64 65 72 20 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e | onsider.the.following.definition |
| bdc60 | 20 6f 66 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 | .of.the.stream.of.positive.integ |
| bdc80 | 65 72 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 74 65 67 65 72 73 2d 73 74 61 | ers:.......(define.(integers-sta |
| bdca0 | 72 74 69 6e 67 2d 66 72 6f 6d 20 6e 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 | rting-from.n)........(cons-strea |
| bdcc0 | 6d 20 6e 20 28 69 6e 74 65 67 65 72 73 2d 73 74 61 72 74 69 6e 67 2d 66 72 6f 6d 20 28 2b 20 6e | m.n.(integers-starting-from.(+.n |
| bdce0 | 20 31 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 74 65 67 65 72 73 20 28 69 | .1)))).......(define.integers.(i |
| bdd00 | 6e 74 65 67 65 72 73 2d 73 74 61 72 74 69 6e 67 2d 66 72 6f 6d 20 31 29 29 0a 0a 20 20 20 54 68 | ntegers-starting-from.1)).....Th |
| bdd20 | 69 73 20 6d 61 6b 65 73 20 73 65 6e 73 65 20 62 65 63 61 75 73 65 20 60 69 6e 74 65 67 65 72 73 | is.makes.sense.because.`integers |
| bdd40 | 27 20 77 69 6c 6c 20 62 65 20 61 20 70 61 69 72 20 77 68 6f 73 65 20 60 63 61 72 27 20 69 73 20 | '.will.be.a.pair.whose.`car'.is. |
| bdd60 | 31 0a 61 6e 64 20 77 68 6f 73 65 20 60 63 64 72 27 20 69 73 20 61 20 70 72 6f 6d 69 73 65 20 74 | 1.and.whose.`cdr'.is.a.promise.t |
| bdd80 | 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 62 65 67 69 6e 6e 69 6e 67 | o.produce.the.integers.beginning |
| bdda0 | 20 77 69 74 68 20 32 2e 0a 54 68 69 73 20 69 73 20 61 6e 20 69 6e 66 69 6e 69 74 65 6c 79 20 6c | .with.2..This.is.an.infinitely.l |
| bddc0 | 6f 6e 67 20 73 74 72 65 61 6d 2c 20 62 75 74 20 69 6e 20 61 6e 79 20 67 69 76 65 6e 20 74 69 6d | ong.stream,.but.in.any.given.tim |
| bdde0 | 65 20 77 65 20 63 61 6e 20 65 78 61 6d 69 6e 65 0a 6f 6e 6c 79 20 61 20 66 69 6e 69 74 65 20 70 | e.we.can.examine.only.a.finite.p |
| bde00 | 6f 72 74 69 6f 6e 20 6f 66 20 69 74 2e 20 20 54 68 75 73 2c 20 6f 75 72 20 70 72 6f 67 72 61 6d | ortion.of.it...Thus,.our.program |
| bde20 | 73 20 77 69 6c 6c 20 6e 65 76 65 72 20 6b 6e 6f 77 20 74 68 61 74 0a 74 68 65 20 65 6e 74 69 72 | s.will.never.know.that.the.entir |
| bde40 | 65 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 20 69 73 20 6e 6f 74 20 74 68 65 72 65 2e 0a | e.infinite.stream.is.not.there.. |
| bde60 | 0a 20 20 20 55 73 69 6e 67 20 60 69 6e 74 65 67 65 72 73 27 20 77 65 20 63 61 6e 20 64 65 66 69 | ....Using.`integers'.we.can.defi |
| bde80 | 6e 65 20 6f 74 68 65 72 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 73 2c 20 73 75 63 68 20 | ne.other.infinite.streams,.such. |
| bdea0 | 61 73 20 74 68 65 0a 73 74 72 65 61 6d 20 6f 66 20 69 6e 74 65 67 65 72 73 20 74 68 61 74 20 61 | as.the.stream.of.integers.that.a |
| bdec0 | 72 65 20 6e 6f 74 20 64 69 76 69 73 69 62 6c 65 20 62 79 20 37 3a 0a 0a 20 20 20 20 20 28 64 65 | re.not.divisible.by.7:.......(de |
| bdee0 | 66 69 6e 65 20 28 64 69 76 69 73 69 62 6c 65 3f 20 78 20 79 29 20 28 3d 20 28 72 65 6d 61 69 6e | fine.(divisible?.x.y).(=.(remain |
| bdf00 | 64 65 72 20 78 20 79 29 20 30 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6e 6f 2d 73 65 | der.x.y).0)).......(define.no-se |
| bdf20 | 76 65 6e 73 0a 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 20 28 6c 61 6d 62 | vens........(stream-filter.(lamb |
| bdf40 | 64 61 20 28 78 29 20 28 6e 6f 74 20 28 64 69 76 69 73 69 62 6c 65 3f 20 78 20 37 29 29 29 0a 20 | da.(x).(not.(divisible?.x.7))).. |
| bdf60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 65 67 65 72 73 29 29 0a | .....................integers)). |
| bdf80 | 0a 20 20 20 54 68 65 6e 20 77 65 20 63 61 6e 20 66 69 6e 64 20 69 6e 74 65 67 65 72 73 20 6e 6f | ....Then.we.can.find.integers.no |
| bdfa0 | 74 20 64 69 76 69 73 69 62 6c 65 20 62 79 20 37 20 73 69 6d 70 6c 79 20 62 79 20 61 63 63 65 73 | t.divisible.by.7.simply.by.acces |
| bdfc0 | 73 69 6e 67 0a 65 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 69 73 20 73 74 72 65 61 6d 3a 0a 0a 20 | sing.elements.of.this.stream:... |
| bdfe0 | 20 20 20 20 28 73 74 72 65 61 6d 2d 72 65 66 20 6e 6f 2d 73 65 76 65 6e 73 20 31 30 30 29 0a 20 | ....(stream-ref.no-sevens.100).. |
| be000 | 20 20 20 20 31 31 37 0a 0a 20 20 20 49 6e 20 61 6e 61 6c 6f 67 79 20 77 69 74 68 20 60 69 6e 74 | ....117.....In.analogy.with.`int |
| be020 | 65 67 65 72 73 27 2c 20 77 65 20 63 61 6e 20 64 65 66 69 6e 65 20 74 68 65 20 69 6e 66 69 6e 69 | egers',.we.can.define.the.infini |
| be040 | 74 65 20 73 74 72 65 61 6d 20 6f 66 0a 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 3a 0a | te.stream.of.Fibonacci.numbers:. |
| be060 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 62 67 65 6e 20 61 20 62 29 0a 20 20 20 20 20 | ......(define.(fibgen.a.b)...... |
| be080 | 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 61 20 28 66 69 62 67 65 6e 20 62 20 28 2b 20 61 20 | ..(cons-stream.a.(fibgen.b.(+.a. |
| be0a0 | 62 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 66 69 62 73 20 28 66 69 62 67 65 6e | b)))).......(define.fibs.(fibgen |
| be0c0 | 20 30 20 31 29 29 0a 0a 20 20 20 60 46 69 62 73 27 20 69 73 20 61 20 70 61 69 72 20 77 68 6f 73 | .0.1)).....`Fibs'.is.a.pair.whos |
| be0e0 | 65 20 60 63 61 72 27 20 69 73 20 30 20 61 6e 64 20 77 68 6f 73 65 20 60 63 64 72 27 20 69 73 20 | e.`car'.is.0.and.whose.`cdr'.is. |
| be100 | 61 20 70 72 6f 6d 69 73 65 20 74 6f 0a 65 76 61 6c 75 61 74 65 20 60 28 66 69 62 67 65 6e 20 31 | a.promise.to.evaluate.`(fibgen.1 |
| be120 | 20 31 29 27 2e 20 20 57 68 65 6e 20 77 65 20 65 76 61 6c 75 61 74 65 20 74 68 69 73 20 64 65 6c | .1)'...When.we.evaluate.this.del |
| be140 | 61 79 65 64 20 60 28 66 69 62 67 65 6e 20 31 20 31 29 27 2c 0a 69 74 20 77 69 6c 6c 20 70 72 6f | ayed.`(fibgen.1.1)',.it.will.pro |
| be160 | 64 75 63 65 20 61 20 70 61 69 72 20 77 68 6f 73 65 20 60 63 61 72 27 20 69 73 20 31 20 61 6e 64 | duce.a.pair.whose.`car'.is.1.and |
| be180 | 20 77 68 6f 73 65 20 60 63 64 72 27 20 69 73 20 61 20 70 72 6f 6d 69 73 65 20 74 6f 0a 65 76 61 | .whose.`cdr'.is.a.promise.to.eva |
| be1a0 | 6c 75 61 74 65 20 60 28 66 69 62 67 65 6e 20 31 20 32 29 27 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e | luate.`(fibgen.1.2)',.and.so.on. |
| be1c0 | 0a 0a 20 20 20 46 6f 72 20 61 20 6c 6f 6f 6b 20 61 74 20 61 20 6d 6f 72 65 20 65 78 63 69 74 69 | .....For.a.look.at.a.more.exciti |
| be1e0 | 6e 67 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 2c 20 77 65 20 63 61 6e 20 67 65 6e 65 72 | ng.infinite.stream,.we.can.gener |
| be200 | 61 6c 69 7a 65 20 74 68 65 0a 60 6e 6f 2d 73 65 76 65 6e 73 27 20 65 78 61 6d 70 6c 65 20 74 6f | alize.the.`no-sevens'.example.to |
| be220 | 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 20 6f | .construct.the.infinite.stream.o |
| be240 | 66 20 70 72 69 6d 65 20 6e 75 6d 62 65 72 73 2c 0a 75 73 69 6e 67 20 61 20 6d 65 74 68 6f 64 20 | f.prime.numbers,.using.a.method. |
| be260 | 6b 6e 6f 77 6e 20 61 73 20 74 68 65 20 45 72 61 74 6f 73 74 68 65 6e 65 73 20 22 73 69 65 76 65 | known.as.the.Eratosthenes."sieve |
| be280 | 20 6f 66 20 45 72 61 74 6f 73 74 68 65 6e 65 73 22 2e 28 31 29 20 57 65 0a 73 74 61 72 74 20 77 | .of.Eratosthenes".(1).We.start.w |
| be2a0 | 69 74 68 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 62 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 | ith.the.integers.beginning.with. |
| be2c0 | 32 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 66 69 72 73 74 20 70 72 69 6d 65 2e 20 20 54 6f | 2,.which.is.the.first.prime...To |
| be2e0 | 0a 67 65 74 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 70 72 69 6d 65 73 2c 20 77 65 20 | .get.the.rest.of.the.primes,.we. |
| be300 | 73 74 61 72 74 20 62 79 20 66 69 6c 74 65 72 69 6e 67 20 74 68 65 20 6d 75 6c 74 69 70 6c 65 73 | start.by.filtering.the.multiples |
| be320 | 20 6f 66 20 32 0a 66 72 6f 6d 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 69 6e 74 65 67 | .of.2.from.the.rest.of.the.integ |
| be340 | 65 72 73 2e 20 20 54 68 69 73 20 6c 65 61 76 65 73 20 61 20 73 74 72 65 61 6d 20 62 65 67 69 6e | ers...This.leaves.a.stream.begin |
| be360 | 6e 69 6e 67 20 77 69 74 68 20 33 2c 0a 77 68 69 63 68 20 69 73 20 74 68 65 20 6e 65 78 74 20 70 | ning.with.3,.which.is.the.next.p |
| be380 | 72 69 6d 65 2e 20 20 4e 6f 77 20 77 65 20 66 69 6c 74 65 72 20 74 68 65 20 6d 75 6c 74 69 70 6c | rime...Now.we.filter.the.multipl |
| be3a0 | 65 73 20 6f 66 20 33 20 66 72 6f 6d 20 74 68 65 0a 72 65 73 74 20 6f 66 20 74 68 69 73 20 73 74 | es.of.3.from.the.rest.of.this.st |
| be3c0 | 72 65 61 6d 2e 20 20 54 68 69 73 20 6c 65 61 76 65 73 20 61 20 73 74 72 65 61 6d 20 62 65 67 69 | ream...This.leaves.a.stream.begi |
| be3e0 | 6e 6e 69 6e 67 20 77 69 74 68 20 35 2c 20 77 68 69 63 68 20 69 73 0a 74 68 65 20 6e 65 78 74 20 | nning.with.5,.which.is.the.next. |
| be400 | 70 72 69 6d 65 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 | prime,.and.so.on...In.other.word |
| be420 | 73 2c 20 77 65 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 70 72 69 6d 65 73 20 62 79 0a 61 20 | s,.we.construct.the.primes.by.a. |
| be440 | 73 69 65 76 69 6e 67 20 70 72 6f 63 65 73 73 2c 20 64 65 73 63 72 69 62 65 64 20 61 73 20 66 6f | sieving.process,.described.as.fo |
| be460 | 6c 6c 6f 77 73 3a 20 54 6f 20 73 69 65 76 65 20 61 20 73 74 72 65 61 6d 20 60 53 27 2c 20 66 6f | llows:.To.sieve.a.stream.`S',.fo |
| be480 | 72 6d 20 61 0a 73 74 72 65 61 6d 20 77 68 6f 73 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 | rm.a.stream.whose.first.element. |
| be4a0 | 69 73 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 60 53 27 20 61 6e 64 20 | is.the.first.element.of.`S'.and. |
| be4c0 | 74 68 65 20 72 65 73 74 20 6f 66 0a 77 68 69 63 68 20 69 73 20 6f 62 74 61 69 6e 65 64 20 62 79 | the.rest.of.which.is.obtained.by |
| be4e0 | 20 66 69 6c 74 65 72 69 6e 67 20 61 6c 6c 20 6d 75 6c 74 69 70 6c 65 73 20 6f 66 20 74 68 65 20 | .filtering.all.multiples.of.the. |
| be500 | 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 0a 60 53 27 20 6f 75 74 20 6f 66 20 74 68 65 20 | first.element.of.`S'.out.of.the. |
| be520 | 72 65 73 74 20 6f 66 20 60 53 27 20 61 6e 64 20 73 69 65 76 69 6e 67 20 74 68 65 20 72 65 73 75 | rest.of.`S'.and.sieving.the.resu |
| be540 | 6c 74 2e 20 54 68 69 73 20 70 72 6f 63 65 73 73 20 69 73 0a 72 65 61 64 69 6c 79 20 64 65 73 63 | lt..This.process.is.readily.desc |
| be560 | 72 69 62 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 73 74 72 65 61 6d 20 6f 70 65 72 61 74 69 | ribed.in.terms.of.stream.operati |
| be580 | 6f 6e 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 69 65 76 65 20 73 74 72 65 61 6d | ons:.......(define.(sieve.stream |
| be5a0 | 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 28 73 | )........(cons-stream.........(s |
| be5c0 | 74 72 65 61 6d 2d 63 61 72 20 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 28 73 69 65 76 65 | tream-car.stream).........(sieve |
| be5e0 | 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(stream-filter................. |
| be600 | 28 6c 61 6d 62 64 61 20 28 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e | (lambda.(x)...................(n |
| be620 | 6f 74 20 28 64 69 76 69 73 69 62 6c 65 3f 20 78 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 74 72 | ot.(divisible?.x.(stream-car.str |
| be640 | 65 61 6d 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d | eam)))).................(stream- |
| be660 | 63 64 72 20 73 74 72 65 61 6d 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 70 72 | cdr.stream))))).......(define.pr |
| be680 | 69 6d 65 73 20 28 73 69 65 76 65 20 28 69 6e 74 65 67 65 72 73 2d 73 74 61 72 74 69 6e 67 2d 66 | imes.(sieve.(integers-starting-f |
| be6a0 | 72 6f 6d 20 32 29 29 29 0a 0a 20 20 20 4e 6f 77 20 74 6f 20 66 69 6e 64 20 61 20 70 61 72 74 69 | rom.2))).....Now.to.find.a.parti |
| be6c0 | 63 75 6c 61 72 20 70 72 69 6d 65 20 77 65 20 6e 65 65 64 20 6f 6e 6c 79 20 61 73 6b 20 66 6f 72 | cular.prime.we.need.only.ask.for |
| be6e0 | 20 69 74 3a 0a 0a 20 20 20 20 20 28 73 74 72 65 61 6d 2d 72 65 66 20 70 72 69 6d 65 73 20 35 30 | .it:.......(stream-ref.primes.50 |
| be700 | 29 0a 20 20 20 20 20 32 33 33 0a 0a 20 20 20 49 74 20 69 73 20 69 6e 74 65 72 65 73 74 69 6e 67 | )......233.....It.is.interesting |
| be720 | 20 74 6f 20 63 6f 6e 74 65 6d 70 6c 61 74 65 20 74 68 65 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 | .to.contemplate.the.signal-proce |
| be740 | 73 73 69 6e 67 20 73 79 73 74 65 6d 20 73 65 74 20 75 70 0a 62 79 20 60 73 69 65 76 65 27 2c 20 | ssing.system.set.up.by.`sieve',. |
| be760 | 73 68 6f 77 6e 20 69 6e 20 74 68 65 20 22 48 65 6e 64 65 72 73 6f 6e 20 64 69 61 67 72 61 6d 22 | shown.in.the."Henderson.diagram" |
| be780 | 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 33 31 3a 3a 2e 28 32 29 0a 54 68 65 20 | .in.*Note.Figure.3-31::.(2).The. |
| be7a0 | 69 6e 70 75 74 20 73 74 72 65 61 6d 20 66 65 65 64 73 20 69 6e 74 6f 20 61 6e 20 22 75 6e 60 63 | input.stream.feeds.into.an."un`c |
| be7c0 | 6f 6e 73 27 65 72 22 20 74 68 61 74 20 73 65 70 61 72 61 74 65 73 20 74 68 65 20 66 69 72 73 74 | ons'er".that.separates.the.first |
| be7e0 | 0a 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 73 74 72 65 61 6d 20 66 72 6f 6d 20 74 68 65 20 | .element.of.the.stream.from.the. |
| be800 | 72 65 73 74 20 6f 66 20 74 68 65 20 73 74 72 65 61 6d 2e 20 20 54 68 65 20 66 69 72 73 74 20 65 | rest.of.the.stream...The.first.e |
| be820 | 6c 65 6d 65 6e 74 0a 69 73 20 75 73 65 64 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 61 20 64 69 | lement.is.used.to.construct.a.di |
| be840 | 76 69 73 69 62 69 6c 69 74 79 20 66 69 6c 74 65 72 2c 20 74 68 72 6f 75 67 68 20 77 68 69 63 68 | visibility.filter,.through.which |
| be860 | 20 74 68 65 20 72 65 73 74 20 69 73 0a 70 61 73 73 65 64 2c 20 61 6e 64 20 74 68 65 20 6f 75 74 | .the.rest.is.passed,.and.the.out |
| be880 | 70 75 74 20 6f 66 20 74 68 65 20 66 69 6c 74 65 72 20 69 73 20 66 65 64 20 74 6f 20 61 6e 6f 74 | put.of.the.filter.is.fed.to.anot |
| be8a0 | 68 65 72 20 73 69 65 76 65 20 62 6f 78 2e 20 20 54 68 65 6e 0a 74 68 65 20 6f 72 69 67 69 6e 61 | her.sieve.box...Then.the.origina |
| be8c0 | 6c 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 69 73 20 60 63 6f 6e 73 27 65 64 20 6f 6e 74 6f | l.first.element.is.`cons'ed.onto |
| be8e0 | 20 74 68 65 20 6f 75 74 70 75 74 20 6f 66 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 0a 73 69 65 76 | .the.output.of.the.internal.siev |
| be900 | 65 20 74 6f 20 66 6f 72 6d 20 74 68 65 20 6f 75 74 70 75 74 20 73 74 72 65 61 6d 2e 20 20 54 68 | e.to.form.the.output.stream...Th |
| be920 | 75 73 2c 20 6e 6f 74 20 6f 6e 6c 79 20 69 73 20 74 68 65 20 73 74 72 65 61 6d 0a 69 6e 66 69 6e | us,.not.only.is.the.stream.infin |
| be940 | 69 74 65 2c 20 62 75 74 20 74 68 65 20 73 69 67 6e 61 6c 20 70 72 6f 63 65 73 73 6f 72 20 69 73 | ite,.but.the.signal.processor.is |
| be960 | 20 61 6c 73 6f 20 69 6e 66 69 6e 69 74 65 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 73 69 65 76 | .also.infinite,.because.the.siev |
| be980 | 65 0a 63 6f 6e 74 61 69 6e 73 20 61 20 73 69 65 76 65 20 77 69 74 68 69 6e 20 69 74 2e 0a 0a 20 | e.contains.a.sieve.within.it.... |
| be9a0 | 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 33 31 3a 2a 20 54 68 65 20 70 72 69 6d 65 20 73 69 65 | ....*Figure.3.31:*.The.prime.sie |
| be9c0 | 76 65 20 76 69 65 77 65 64 20 61 73 20 61 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 73 73 69 6e 67 | ve.viewed.as.a.signal-processing |
| be9e0 | 0a 20 20 20 20 20 73 79 73 74 65 6d 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d | ......system...............+---- |
| bea00 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| bea20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 | ---------------------------+.... |
| bea40 | 20 20 20 20 20 20 20 20 20 7c 20 73 69 65 76 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .........|.sieve................ |
| bea60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| bea80 | 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 | .........|.............|........ |
| beaa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| beac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 | .......................|........ |
| beae0 | 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 5f 5f 2f 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....|........__/|.............. |
| beb00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 5c 5f 5f 20 20 | ..........................|\__.. |
| beb20 | 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 5f 5f 2f 63 61 72 7c | .....|.............|.....__/car| |
| beb40 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ................................ |
| beb60 | 2e 2e 2e 2e 2e 2e 2e 2e 7c 20 20 20 5c 5f 5f 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | ........|...\__....|............ |
| beb80 | 20 7c 20 20 20 5f 2f 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 3a 20 20 20 20 20 20 | .|..._/......|...........:...... |
| beba0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 5c 5f 20 | ......................|......\_. |
| bebc0 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 3e 3c 5f 20 20 20 20 20 20 20 7c 20 20 20 20 | .|...........----><_.......|.... |
| bebe0 | 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......V........................ |
| bec00 | 20 20 20 20 7c 20 20 63 6f 6e 73 20 5f 3e 2d 2d 2d 2d 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ....|..cons._>---->............. |
| bec20 | 7c 20 20 20 20 5c 5f 5f 20 20 20 20 7c 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 | |....\__....|....+------------+. |
| bec40 | 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 7c 20 20 20 20 5f 5f 2f 20 20 20 | ...+------------+....|....__/... |
| bec60 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 5c 63 64 72 7c 2d 2d 2d 3e 7c | |.............|.......\cdr|--->| |
| bec80 | 20 66 69 6c 74 65 72 3a 20 20 20 20 7c 20 20 20 20 7c 20 73 69 65 76 65 20 20 20 20 20 20 7c 2d | .filter:....|....|.sieve......|- |
| beca0 | 2d 2d 3e 7c 20 5f 5f 2f 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | -->|.__/......|.............|... |
| becc0 | 20 20 20 20 20 20 20 5c 7c 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 2d 2d 2d 3e 7c | .......\|....|............|--->| |
| bece0 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 7c 2f 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | ............|....|/.........|... |
| bed00 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 6e 6f 74 | ..........|................|.not |
| bed20 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 | ........|....|............|..... |
| bed40 | 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 | ..........|.............|....... |
| bed60 | 20 20 20 20 20 20 20 20 20 7c 20 64 69 76 69 73 69 62 6c 65 3f 20 7c 20 20 20 20 7c 20 20 20 20 | .........|.divisible?.|....|.... |
| bed80 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 | ........|...............|....... |
| beda0 | 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d | ......|................+-------- |
| bedc0 | 2d 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 | ----+....+------------+......... |
| bede0 | 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ......|.............+----------- |
| bee00 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| bee20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 44 65 66 69 6e 69 6e 67 20 | --------------------+..Defining. |
| bee40 | 73 74 72 65 61 6d 73 20 69 6d 70 6c 69 63 69 74 6c 79 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | streams.implicitly.............. |
| bee60 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 60 69 6e 74 65 67 65 72 73 27 20 61 | ................The.`integers'.a |
| bee80 | 6e 64 20 60 66 69 62 73 27 20 73 74 72 65 61 6d 73 20 61 62 6f 76 65 20 77 65 72 65 20 64 65 66 | nd.`fibs'.streams.above.were.def |
| beea0 | 69 6e 65 64 20 62 79 20 73 70 65 63 69 66 79 69 6e 67 0a 22 67 65 6e 65 72 61 74 69 6e 67 22 20 | ined.by.specifying."generating". |
| beec0 | 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 65 78 70 6c 69 63 69 74 6c 79 20 63 6f 6d 70 75 | procedures.that.explicitly.compu |
| beee0 | 74 65 20 74 68 65 20 73 74 72 65 61 6d 20 65 6c 65 6d 65 6e 74 73 20 6f 6e 65 0a 62 79 20 6f 6e | te.the.stream.elements.one.by.on |
| bef00 | 65 2e 20 41 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 77 61 79 20 74 6f 20 73 70 65 63 69 66 79 | e..An.alternative.way.to.specify |
| bef20 | 20 73 74 72 65 61 6d 73 20 69 73 20 74 6f 20 74 61 6b 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 | .streams.is.to.take.advantage.of |
| bef40 | 0a 64 65 6c 61 79 65 64 20 65 76 61 6c 75 61 74 69 6f 6e 20 74 6f 20 64 65 66 69 6e 65 20 73 74 | .delayed.evaluation.to.define.st |
| bef60 | 72 65 61 6d 73 20 69 6d 70 6c 69 63 69 74 6c 79 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 | reams.implicitly...For.example,. |
| bef80 | 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 20 64 65 66 69 6e 65 73 | the.following.expression.defines |
| befa0 | 20 74 68 65 20 73 74 72 65 61 6d 20 60 6f 6e 65 73 27 20 74 6f 20 62 65 20 61 6e 20 69 6e 66 69 | .the.stream.`ones'.to.be.an.infi |
| befc0 | 6e 69 74 65 20 73 74 72 65 61 6d 0a 6f 66 20 6f 6e 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 | nite.stream.of.ones:.......(defi |
| befe0 | 6e 65 20 6f 6e 65 73 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 20 6f 6e 65 73 29 29 0a 0a 20 | ne.ones.(cons-stream.1.ones))... |
| bf000 | 20 20 54 68 69 73 20 77 6f 72 6b 73 20 6d 75 63 68 20 6c 69 6b 65 20 74 68 65 20 64 65 66 69 6e | ..This.works.much.like.the.defin |
| bf020 | 69 74 69 6f 6e 20 6f 66 20 61 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 64 75 72 65 3a 20 | ition.of.a.recursive.procedure:. |
| bf040 | 60 6f 6e 65 73 27 0a 69 73 20 61 20 70 61 69 72 20 77 68 6f 73 65 20 60 63 61 72 27 20 69 73 20 | `ones'.is.a.pair.whose.`car'.is. |
| bf060 | 31 20 61 6e 64 20 77 68 6f 73 65 20 60 63 64 72 27 20 69 73 20 61 20 70 72 6f 6d 69 73 65 20 74 | 1.and.whose.`cdr'.is.a.promise.t |
| bf080 | 6f 20 65 76 61 6c 75 61 74 65 0a 60 6f 6e 65 73 27 2e 20 20 45 76 61 6c 75 61 74 69 6e 67 20 74 | o.evaluate.`ones'...Evaluating.t |
| bf0a0 | 68 65 20 60 63 64 72 27 20 67 69 76 65 73 20 75 73 20 61 67 61 69 6e 20 61 20 31 20 61 6e 64 20 | he.`cdr'.gives.us.again.a.1.and. |
| bf0c0 | 61 20 70 72 6f 6d 69 73 65 20 74 6f 0a 65 76 61 6c 75 61 74 65 20 60 6f 6e 65 73 27 2c 20 61 6e | a.promise.to.evaluate.`ones',.an |
| bf0e0 | 64 20 73 6f 20 6f 6e 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 64 6f 20 6d 6f 72 65 20 69 6e 74 65 | d.so.on......We.can.do.more.inte |
| bf100 | 72 65 73 74 69 6e 67 20 74 68 69 6e 67 73 20 62 79 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 73 | resting.things.by.manipulating.s |
| bf120 | 74 72 65 61 6d 73 20 77 69 74 68 0a 6f 70 65 72 61 74 69 6f 6e 73 20 73 75 63 68 20 61 73 20 60 | treams.with.operations.such.as.` |
| bf140 | 61 64 64 2d 73 74 72 65 61 6d 73 27 2c 20 77 68 69 63 68 20 70 72 6f 64 75 63 65 73 20 74 68 65 | add-streams',.which.produces.the |
| bf160 | 20 65 6c 65 6d 65 6e 74 77 69 73 65 20 73 75 6d 20 6f 66 0a 74 77 6f 20 67 69 76 65 6e 20 73 74 | .elementwise.sum.of.two.given.st |
| bf180 | 72 65 61 6d 73 3a 28 33 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 73 74 72 | reams:(3).......(define.(add-str |
| bf1a0 | 65 61 6d 73 20 73 31 20 73 32 29 0a 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 2b | eams.s1.s2)........(stream-map.+ |
| bf1c0 | 20 73 31 20 73 32 29 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 63 61 6e 20 64 65 66 69 6e 65 20 74 | .s1.s2)).....Now.we.can.define.t |
| bf1e0 | 68 65 20 69 6e 74 65 67 65 72 73 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 | he.integers.as.follows:.......(d |
| bf200 | 65 66 69 6e 65 20 69 6e 74 65 67 65 72 73 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 20 28 61 | efine.integers.(cons-stream.1.(a |
| bf220 | 64 64 2d 73 74 72 65 61 6d 73 20 6f 6e 65 73 20 69 6e 74 65 67 65 72 73 29 29 29 0a 0a 20 20 20 | dd-streams.ones.integers)))..... |
| bf240 | 54 68 69 73 20 64 65 66 69 6e 65 73 20 60 69 6e 74 65 67 65 72 73 27 20 74 6f 20 62 65 20 61 20 | This.defines.`integers'.to.be.a. |
| bf260 | 73 74 72 65 61 6d 20 77 68 6f 73 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 69 73 20 31 20 | stream.whose.first.element.is.1. |
| bf280 | 61 6e 64 0a 74 68 65 20 72 65 73 74 20 6f 66 20 77 68 69 63 68 20 69 73 20 74 68 65 20 73 75 6d | and.the.rest.of.which.is.the.sum |
| bf2a0 | 20 6f 66 20 60 6f 6e 65 73 27 20 61 6e 64 20 60 69 6e 74 65 67 65 72 73 27 2e 20 20 54 68 75 73 | .of.`ones'.and.`integers'...Thus |
| bf2c0 | 2c 20 74 68 65 20 73 65 63 6f 6e 64 0a 65 6c 65 6d 65 6e 74 20 6f 66 20 60 69 6e 74 65 67 65 72 | ,.the.second.element.of.`integer |
| bf2e0 | 73 27 20 69 73 20 31 20 70 6c 75 73 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f | s'.is.1.plus.the.first.element.o |
| bf300 | 66 20 60 69 6e 74 65 67 65 72 73 27 2c 20 6f 72 20 32 3b 0a 74 68 65 20 74 68 69 72 64 20 65 6c | f.`integers',.or.2;.the.third.el |
| bf320 | 65 6d 65 6e 74 20 6f 66 20 60 69 6e 74 65 67 65 72 73 27 20 69 73 20 31 20 70 6c 75 73 20 74 68 | ement.of.`integers'.is.1.plus.th |
| bf340 | 65 20 73 65 63 6f 6e 64 20 65 6c 65 6d 65 6e 74 20 6f 66 0a 60 69 6e 74 65 67 65 72 73 27 2c 20 | e.second.element.of.`integers',. |
| bf360 | 6f 72 20 33 3b 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 20 54 68 69 73 20 64 65 66 69 6e 69 74 69 6f | or.3;.and.so.on...This.definitio |
| bf380 | 6e 20 77 6f 72 6b 73 20 62 65 63 61 75 73 65 2c 20 61 74 20 61 6e 79 0a 70 6f 69 6e 74 2c 20 65 | n.works.because,.at.any.point,.e |
| bf3a0 | 6e 6f 75 67 68 20 6f 66 20 74 68 65 20 60 69 6e 74 65 67 65 72 73 27 20 73 74 72 65 61 6d 20 68 | nough.of.the.`integers'.stream.h |
| bf3c0 | 61 73 20 62 65 65 6e 20 67 65 6e 65 72 61 74 65 64 20 73 6f 20 74 68 61 74 20 77 65 0a 63 61 6e | as.been.generated.so.that.we.can |
| bf3e0 | 20 66 65 65 64 20 69 74 20 62 61 63 6b 20 69 6e 74 6f 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f | .feed.it.back.into.the.definitio |
| bf400 | 6e 20 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 6e 65 78 74 20 69 6e 74 65 67 65 72 2e 0a 0a | n.to.produce.the.next.integer... |
| bf420 | 20 20 20 57 65 20 63 61 6e 20 64 65 66 69 6e 65 20 74 68 65 20 46 69 62 6f 6e 61 63 63 69 20 6e | ...We.can.define.the.Fibonacci.n |
| bf440 | 75 6d 62 65 72 73 20 69 6e 20 74 68 65 20 73 61 6d 65 20 73 74 79 6c 65 3a 0a 0a 20 20 20 20 20 | umbers.in.the.same.style:....... |
| bf460 | 28 64 65 66 69 6e 65 20 66 69 62 73 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d | (define.fibs........(cons-stream |
| bf480 | 20 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 | .0.....................(cons-str |
| bf4a0 | 65 61 6d 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | eam.1........................... |
| bf4c0 | 20 20 20 20 20 20 20 28 61 64 64 2d 73 74 72 65 61 6d 73 20 28 73 74 72 65 61 6d 2d 63 64 72 20 | .......(add-streams.(stream-cdr. |
| bf4e0 | 66 69 62 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | fibs)........................... |
| bf500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 69 62 73 29 29 29 29 0a 0a 20 20 | ....................fibs)))).... |
| bf520 | 20 54 68 69 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 73 61 79 73 20 74 68 61 74 20 60 66 69 62 73 | .This.definition.says.that.`fibs |
| bf540 | 27 20 69 73 20 61 20 73 74 72 65 61 6d 20 62 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 30 20 61 | '.is.a.stream.beginning.with.0.a |
| bf560 | 6e 64 20 31 2c 0a 73 75 63 68 20 74 68 61 74 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 | nd.1,.such.that.the.rest.of.the. |
| bf580 | 73 74 72 65 61 6d 20 63 61 6e 20 62 65 20 67 65 6e 65 72 61 74 65 64 20 62 79 20 61 64 64 69 6e | stream.can.be.generated.by.addin |
| bf5a0 | 67 20 60 66 69 62 73 27 20 74 6f 0a 69 74 73 65 6c 66 20 73 68 69 66 74 65 64 20 62 79 20 6f 6e | g.`fibs'.to.itself.shifted.by.on |
| bf5c0 | 65 20 70 6c 61 63 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 31 20 20 31 20 20 32 20 20 33 20 | e.place:.............1..1..2..3. |
| bf5e0 | 20 35 20 20 38 20 20 20 31 33 20 20 32 31 20 20 2e 2e 2e 20 3d 20 60 28 73 74 72 65 61 6d 2d 63 | .5..8...13..21......=.`(stream-c |
| bf600 | 64 72 20 66 69 62 73 29 27 0a 20 20 20 20 20 20 20 20 20 20 20 30 20 20 31 20 20 31 20 20 32 20 | dr.fibs)'............0..1..1..2. |
| bf620 | 20 33 20 20 35 20 20 20 38 20 20 20 31 33 20 20 2e 2e 2e 20 3d 20 60 66 69 62 73 27 0a 20 20 20 | .3..5...8...13......=.`fibs'.... |
| bf640 | 20 20 30 20 20 31 20 20 31 20 20 32 20 20 33 20 20 35 20 20 38 20 20 31 33 20 20 32 31 20 20 33 | ..0..1..1..2..3..5..8..13..21..3 |
| bf660 | 34 20 20 2e 2e 2e 20 3d 20 60 66 69 62 73 27 0a 0a 20 20 20 60 53 63 61 6c 65 2d 73 74 72 65 61 | 4......=.`fibs'.....`Scale-strea |
| bf680 | 6d 27 20 69 73 20 61 6e 6f 74 68 65 72 20 75 73 65 66 75 6c 20 70 72 6f 63 65 64 75 72 65 20 69 | m'.is.another.useful.procedure.i |
| bf6a0 | 6e 20 66 6f 72 6d 75 6c 61 74 69 6e 67 20 73 75 63 68 20 73 74 72 65 61 6d 0a 64 65 66 69 6e 69 | n.formulating.such.stream.defini |
| bf6c0 | 74 69 6f 6e 73 2e 20 20 54 68 69 73 20 6d 75 6c 74 69 70 6c 69 65 73 20 65 61 63 68 20 69 74 65 | tions...This.multiplies.each.ite |
| bf6e0 | 6d 20 69 6e 20 61 20 73 74 72 65 61 6d 20 62 79 20 61 20 67 69 76 65 6e 20 63 6f 6e 73 74 61 6e | m.in.a.stream.by.a.given.constan |
| bf700 | 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 63 61 6c 65 2d 73 74 72 65 61 6d 20 73 | t:.......(define.(scale-stream.s |
| bf720 | 74 72 65 61 6d 20 66 61 63 74 6f 72 29 0a 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 | tream.factor)........(stream-map |
| bf740 | 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 2a 20 78 20 66 61 63 74 6f 72 29 29 20 73 74 72 65 61 | .(lambda.(x).(*.x.factor)).strea |
| bf760 | 6d 29 29 0a 0a 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 28 64 65 66 69 | m)).....For.example,.......(defi |
| bf780 | 6e 65 20 64 6f 75 62 6c 65 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 20 28 73 63 61 6c 65 2d | ne.double.(cons-stream.1.(scale- |
| bf7a0 | 73 74 72 65 61 6d 20 64 6f 75 62 6c 65 20 32 29 29 29 0a 0a 70 72 6f 64 75 63 65 73 20 74 68 65 | stream.double.2)))..produces.the |
| bf7c0 | 20 73 74 72 65 61 6d 20 6f 66 20 70 6f 77 65 72 73 20 6f 66 20 32 3a 20 31 2c 20 32 2c 20 34 2c | .stream.of.powers.of.2:.1,.2,.4, |
| bf7e0 | 20 38 2c 20 31 36 2c 20 33 32 2c 20 2e 2e 2e 2e 0a 0a 20 20 20 41 6e 20 61 6c 74 65 72 6e 61 74 | .8,.16,.32,..........An.alternat |
| bf800 | 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 70 72 | e.definition.of.the.stream.of.pr |
| bf820 | 69 6d 65 73 20 63 61 6e 20 62 65 20 67 69 76 65 6e 20 62 79 0a 73 74 61 72 74 69 6e 67 20 77 69 | imes.can.be.given.by.starting.wi |
| bf840 | 74 68 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 61 6e 64 20 66 69 6c 74 65 72 69 6e 67 20 74 68 | th.the.integers.and.filtering.th |
| bf860 | 65 6d 20 62 79 20 74 65 73 74 69 6e 67 20 66 6f 72 20 70 72 69 6d 61 6c 69 74 79 2e 0a 57 65 20 | em.by.testing.for.primality..We. |
| bf880 | 77 69 6c 6c 20 6e 65 65 64 20 74 68 65 20 66 69 72 73 74 20 70 72 69 6d 65 2c 20 32 2c 20 74 6f | will.need.the.first.prime,.2,.to |
| bf8a0 | 20 67 65 74 20 73 74 61 72 74 65 64 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 70 72 69 6d | .get.started:.......(define.prim |
| bf8c0 | 65 73 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 32 | es........(cons-stream.........2 |
| bf8e0 | 0a 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 20 70 72 69 6d 65 3f 20 28 | .........(stream-filter.prime?.( |
| bf900 | 69 6e 74 65 67 65 72 73 2d 73 74 61 72 74 69 6e 67 2d 66 72 6f 6d 20 33 29 29 29 29 0a 0a 20 20 | integers-starting-from.3)))).... |
| bf920 | 20 54 68 69 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 73 20 6e 6f 74 20 73 6f 20 73 74 72 61 69 | .This.definition.is.not.so.strai |
| bf940 | 67 68 74 66 6f 72 77 61 72 64 20 61 73 20 69 74 20 61 70 70 65 61 72 73 2c 20 62 65 63 61 75 73 | ghtforward.as.it.appears,.becaus |
| bf960 | 65 20 77 65 0a 77 69 6c 6c 20 74 65 73 74 20 77 68 65 74 68 65 72 20 61 20 6e 75 6d 62 65 72 20 | e.we.will.test.whether.a.number. |
| bf980 | 6e 20 69 73 20 70 72 69 6d 65 20 62 79 20 63 68 65 63 6b 69 6e 67 20 77 68 65 74 68 65 72 20 6e | n.is.prime.by.checking.whether.n |
| bf9a0 | 20 69 73 0a 64 69 76 69 73 69 62 6c 65 20 62 79 20 61 20 70 72 69 6d 65 20 28 6e 6f 74 20 62 79 | .is.divisible.by.a.prime.(not.by |
| bf9c0 | 20 6a 75 73 74 20 61 6e 79 20 69 6e 74 65 67 65 72 29 20 6c 65 73 73 20 74 68 61 6e 20 6f 72 20 | .just.any.integer).less.than.or. |
| bf9e0 | 65 71 75 61 6c 20 74 6f 0a 5f 5b 73 71 72 74 5d 5f 28 6e 29 3a 0a 0a 20 20 20 20 20 28 64 65 66 | equal.to._[sqrt]_(n):.......(def |
| bfa00 | 69 6e 65 20 28 70 72 69 6d 65 3f 20 6e 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 | ine.(prime?.n)........(define.(i |
| bfa20 | 74 65 72 20 70 73 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3e 20 28 73 71 75 61 | ter.ps)..........(cond.((>.(squa |
| bfa40 | 72 65 20 28 73 74 72 65 61 6d 2d 63 61 72 20 70 73 29 29 20 6e 29 20 74 72 75 65 29 0a 20 20 20 | re.(stream-car.ps)).n).true).... |
| bfa60 | 20 20 20 20 20 20 20 20 20 20 20 20 28 28 64 69 76 69 73 69 62 6c 65 3f 20 6e 20 28 73 74 72 65 | ............((divisible?.n.(stre |
| bfa80 | 61 6d 2d 63 61 72 20 70 73 29 29 20 66 61 6c 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | am-car.ps)).false).............. |
| bfaa0 | 20 20 28 65 6c 73 65 20 28 69 74 65 72 20 28 73 74 72 65 61 6d 2d 63 64 72 20 70 73 29 29 29 29 | ..(else.(iter.(stream-cdr.ps)))) |
| bfac0 | 29 0a 20 20 20 20 20 20 20 28 69 74 65 72 20 70 72 69 6d 65 73 29 29 0a 0a 20 20 20 54 68 69 73 | )........(iter.primes)).....This |
| bfae0 | 20 69 73 20 61 20 72 65 63 75 72 73 69 76 65 20 64 65 66 69 6e 69 74 69 6f 6e 2c 20 73 69 6e 63 | .is.a.recursive.definition,.sinc |
| bfb00 | 65 20 60 70 72 69 6d 65 73 27 20 69 73 20 64 65 66 69 6e 65 64 20 69 6e 20 74 65 72 6d 73 0a 6f | e.`primes'.is.defined.in.terms.o |
| bfb20 | 66 20 74 68 65 20 60 70 72 69 6d 65 3f 27 20 70 72 65 64 69 63 61 74 65 2c 20 77 68 69 63 68 20 | f.the.`prime?'.predicate,.which. |
| bfb40 | 69 74 73 65 6c 66 20 75 73 65 73 20 74 68 65 20 60 70 72 69 6d 65 73 27 20 73 74 72 65 61 6d 2e | itself.uses.the.`primes'.stream. |
| bfb60 | 20 20 54 68 65 0a 72 65 61 73 6f 6e 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 77 6f 72 6b | ..The.reason.this.procedure.work |
| bfb80 | 73 20 69 73 20 74 68 61 74 2c 20 61 74 20 61 6e 79 20 70 6f 69 6e 74 2c 20 65 6e 6f 75 67 68 20 | s.is.that,.at.any.point,.enough. |
| bfba0 | 6f 66 20 74 68 65 0a 60 70 72 69 6d 65 73 27 20 73 74 72 65 61 6d 20 68 61 73 20 62 65 65 6e 20 | of.the.`primes'.stream.has.been. |
| bfbc0 | 67 65 6e 65 72 61 74 65 64 20 74 6f 20 74 65 73 74 20 74 68 65 20 70 72 69 6d 61 6c 69 74 79 20 | generated.to.test.the.primality. |
| bfbe0 | 6f 66 20 74 68 65 20 6e 75 6d 62 65 72 73 0a 77 65 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 20 | of.the.numbers.we.need.to.check. |
| bfc00 | 6e 65 78 74 2e 20 20 54 68 61 74 20 69 73 2c 20 66 6f 72 20 65 76 65 72 79 20 6e 20 77 65 20 74 | next...That.is,.for.every.n.we.t |
| bfc20 | 65 73 74 20 66 6f 72 20 70 72 69 6d 61 6c 69 74 79 2c 0a 65 69 74 68 65 72 20 6e 20 69 73 20 6e | est.for.primality,.either.n.is.n |
| bfc40 | 6f 74 20 70 72 69 6d 65 20 28 69 6e 20 77 68 69 63 68 20 63 61 73 65 20 74 68 65 72 65 20 69 73 | ot.prime.(in.which.case.there.is |
| bfc60 | 20 61 20 70 72 69 6d 65 20 61 6c 72 65 61 64 79 20 67 65 6e 65 72 61 74 65 64 0a 74 68 61 74 20 | .a.prime.already.generated.that. |
| bfc80 | 64 69 76 69 64 65 73 20 69 74 29 20 6f 72 20 6e 20 69 73 20 70 72 69 6d 65 20 28 69 6e 20 77 68 | divides.it).or.n.is.prime.(in.wh |
| bfca0 | 69 63 68 20 63 61 73 65 20 74 68 65 72 65 20 69 73 20 61 20 70 72 69 6d 65 20 61 6c 72 65 61 64 | ich.case.there.is.a.prime.alread |
| bfcc0 | 79 0a 67 65 6e 65 72 61 74 65 64 2d 2d 69 2e 65 2e 2c 20 61 20 70 72 69 6d 65 20 6c 65 73 73 20 | y.generated--i.e.,.a.prime.less. |
| bfce0 | 74 68 61 6e 20 6e 2d 2d 74 68 61 74 20 69 73 20 67 72 65 61 74 65 72 20 74 68 61 6e 0a 5f 5b 73 | than.n--that.is.greater.than._[s |
| bfd00 | 71 72 74 5d 5f 28 6e 29 29 2e 28 34 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e | qrt]_(n)).(4).......*Exercise.3. |
| bfd20 | 35 33 3a 2a 20 57 69 74 68 6f 75 74 20 72 75 6e 6e 69 6e 67 20 74 68 65 20 70 72 6f 67 72 61 6d | 53:*.Without.running.the.program |
| bfd40 | 2c 20 64 65 73 63 72 69 62 65 20 74 68 65 0a 20 20 20 20 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 | ,.describe.the......elements.of. |
| bfd60 | 74 68 65 20 73 74 72 65 61 6d 20 64 65 66 69 6e 65 64 20 62 79 0a 0a 20 20 20 20 20 20 20 20 20 | the.stream.defined.by........... |
| bfd80 | 20 28 64 65 66 69 6e 65 20 73 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 20 28 61 64 64 2d 73 | .(define.s.(cons-stream.1.(add-s |
| bfda0 | 74 72 65 61 6d 73 20 73 20 73 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e | treams.s.s))).......*Exercise.3. |
| bfdc0 | 35 34 3a 2a 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 6d 75 6c 2d 73 74 72 | 54:*.Define.a.procedure.`mul-str |
| bfde0 | 65 61 6d 73 27 2c 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 0a 20 20 20 20 20 60 61 64 64 2d 73 74 | eams',.analogous.to......`add-st |
| bfe00 | 72 65 61 6d 73 27 2c 20 74 68 61 74 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 65 6c 65 6d 65 6e | reams',.that.produces.the.elemen |
| bfe20 | 74 77 69 73 65 20 70 72 6f 64 75 63 74 20 6f 66 20 69 74 73 20 74 77 6f 0a 20 20 20 20 20 69 6e | twise.product.of.its.two......in |
| bfe40 | 70 75 74 20 73 74 72 65 61 6d 73 2e 20 20 55 73 65 20 74 68 69 73 20 74 6f 67 65 74 68 65 72 20 | put.streams...Use.this.together. |
| bfe60 | 77 69 74 68 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 60 69 6e 74 65 67 65 72 73 27 20 74 6f | with.the.stream.of.`integers'.to |
| bfe80 | 0a 20 20 20 20 20 63 6f 6d 70 6c 65 74 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 | ......complete.the.following.def |
| bfea0 | 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 74 72 65 61 6d 20 77 68 6f 73 65 20 6e 74 68 20 | inition.of.the.stream.whose.nth. |
| bfec0 | 65 6c 65 6d 65 6e 74 0a 20 20 20 20 20 28 63 6f 75 6e 74 69 6e 67 20 66 72 6f 6d 20 30 29 20 69 | element......(counting.from.0).i |
| bfee0 | 73 20 6e 20 2b 20 31 20 66 61 63 74 6f 72 69 61 6c 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | s.n.+.1.factorial:............(d |
| bff00 | 65 66 69 6e 65 20 66 61 63 74 6f 72 69 61 6c 73 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 20 | efine.factorials.(cons-stream.1. |
| bff20 | 28 6d 75 6c 2d 73 74 72 65 61 6d 73 20 3c 3f 3f 3e 20 3c 3f 3f 3e 29 29 29 0a 0a 20 20 20 20 20 | (mul-streams.<??>.<??>)))....... |
| bff40 | 2a 45 78 65 72 63 69 73 65 20 33 2e 35 35 3a 2a 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 | *Exercise.3.55:*.Define.a.proced |
| bff60 | 75 72 65 20 60 70 61 72 74 69 61 6c 2d 73 75 6d 73 27 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 | ure.`partial-sums'.that.takes.as |
| bff80 | 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 20 61 20 73 74 72 65 61 6d 20 53 20 61 6e 64 20 72 65 | ......argument.a.stream.S.and.re |
| bffa0 | 74 75 72 6e 73 20 74 68 65 20 73 74 72 65 61 6d 20 77 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 | turns.the.stream.whose.elements. |
| bffc0 | 61 72 65 20 53 5f 30 2c 0a 20 20 20 20 20 53 5f 30 20 2b 20 53 5f 31 2c 20 53 5f 30 20 2b 20 53 | are.S_0,......S_0.+.S_1,.S_0.+.S |
| bffe0 | 5f 31 20 2b 20 53 5f 32 2c 20 2e 2e 2e 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 60 28 70 | _1.+.S_2,.......For.example,.`(p |
| c0000 | 61 72 74 69 61 6c 2d 73 75 6d 73 0a 20 20 20 20 20 69 6e 74 65 67 65 72 73 29 27 20 73 68 6f 75 | artial-sums......integers)'.shou |
| c0020 | 6c 64 20 62 65 20 74 68 65 20 73 74 72 65 61 6d 20 31 2c 20 33 2c 20 36 2c 20 31 30 2c 20 31 35 | ld.be.the.stream.1,.3,.6,.10,.15 |
| c0040 | 2c 20 2e 2e 2e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 35 36 3a 2a 20 41 20 | ,............*Exercise.3.56:*.A. |
| c0060 | 66 61 6d 6f 75 73 20 70 72 6f 62 6c 65 6d 2c 20 66 69 72 73 74 20 72 61 69 73 65 64 20 62 79 20 | famous.problem,.first.raised.by. |
| c0080 | 52 2e 20 48 61 6d 6d 69 6e 67 2c 20 69 73 0a 20 20 20 20 20 74 6f 20 65 6e 75 6d 65 72 61 74 65 | R..Hamming,.is......to.enumerate |
| c00a0 | 2c 20 69 6e 20 61 73 63 65 6e 64 69 6e 67 20 6f 72 64 65 72 20 77 69 74 68 20 6e 6f 20 72 65 70 | ,.in.ascending.order.with.no.rep |
| c00c0 | 65 74 69 74 69 6f 6e 73 2c 20 61 6c 6c 20 70 6f 73 69 74 69 76 65 0a 20 20 20 20 20 69 6e 74 65 | etitions,.all.positive......inte |
| c00e0 | 67 65 72 73 20 77 69 74 68 20 6e 6f 20 70 72 69 6d 65 20 66 61 63 74 6f 72 73 20 6f 74 68 65 72 | gers.with.no.prime.factors.other |
| c0100 | 20 74 68 61 6e 20 32 2c 20 33 2c 20 6f 72 20 35 2e 20 20 4f 6e 65 20 6f 62 76 69 6f 75 73 0a 20 | .than.2,.3,.or.5...One.obvious.. |
| c0120 | 20 20 20 20 77 61 79 20 74 6f 20 64 6f 20 74 68 69 73 20 69 73 20 74 6f 20 73 69 6d 70 6c 79 20 | ....way.to.do.this.is.to.simply. |
| c0140 | 74 65 73 74 20 65 61 63 68 20 69 6e 74 65 67 65 72 20 69 6e 20 74 75 72 6e 20 74 6f 20 73 65 65 | test.each.integer.in.turn.to.see |
| c0160 | 0a 20 20 20 20 20 77 68 65 74 68 65 72 20 69 74 20 68 61 73 20 61 6e 79 20 66 61 63 74 6f 72 73 | ......whether.it.has.any.factors |
| c0180 | 20 6f 74 68 65 72 20 74 68 61 6e 20 32 2c 20 33 2c 20 61 6e 64 20 35 2e 20 20 42 75 74 20 74 68 | .other.than.2,.3,.and.5...But.th |
| c01a0 | 69 73 20 69 73 0a 20 20 20 20 20 76 65 72 79 20 69 6e 65 66 66 69 63 69 65 6e 74 2c 20 73 69 6e | is.is......very.inefficient,.sin |
| c01c0 | 63 65 2c 20 61 73 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 67 65 74 20 6c 61 72 67 65 72 2c 20 | ce,.as.the.integers.get.larger,. |
| c01e0 | 66 65 77 65 72 20 61 6e 64 0a 20 20 20 20 20 66 65 77 65 72 20 6f 66 20 74 68 65 6d 20 66 69 74 | fewer.and......fewer.of.them.fit |
| c0200 | 20 74 68 65 20 72 65 71 75 69 72 65 6d 65 6e 74 2e 20 20 41 73 20 61 6e 20 61 6c 74 65 72 6e 61 | .the.requirement...As.an.alterna |
| c0220 | 74 69 76 65 2c 20 6c 65 74 20 75 73 20 63 61 6c 6c 0a 20 20 20 20 20 74 68 65 20 72 65 71 75 69 | tive,.let.us.call......the.requi |
| c0240 | 72 65 64 20 73 74 72 65 61 6d 20 6f 66 20 6e 75 6d 62 65 72 73 20 60 53 27 20 61 6e 64 20 6e 6f | red.stream.of.numbers.`S'.and.no |
| c0260 | 74 69 63 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 61 63 74 73 0a 20 20 20 20 20 61 62 | tice.the.following.facts......ab |
| c0280 | 6f 75 74 20 69 74 2e 0a 0a 20 20 20 20 20 20 20 20 2a 20 60 53 27 20 62 65 67 69 6e 73 20 77 69 | out.it...........*.`S'.begins.wi |
| c02a0 | 74 68 20 31 2e 0a 0a 20 20 20 20 20 20 20 20 2a 20 54 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 | th.1...........*.The.elements.of |
| c02c0 | 20 60 28 73 63 61 6c 65 2d 73 74 72 65 61 6d 20 53 20 32 29 27 20 61 72 65 20 61 6c 73 6f 20 65 | .`(scale-stream.S.2)'.are.also.e |
| c02e0 | 6c 65 6d 65 6e 74 73 20 6f 66 20 60 53 27 2e 0a 0a 20 20 20 20 20 20 20 20 2a 20 54 68 65 20 73 | lements.of.`S'...........*.The.s |
| c0300 | 61 6d 65 20 69 73 20 74 72 75 65 20 66 6f 72 20 60 28 73 63 61 6c 65 2d 73 74 72 65 61 6d 20 53 | ame.is.true.for.`(scale-stream.S |
| c0320 | 20 33 29 27 20 61 6e 64 20 60 28 73 63 61 6c 65 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 | .3)'.and.`(scale-stream......... |
| c0340 | 20 20 35 20 53 29 27 2e 0a 0a 20 20 20 20 20 20 20 20 2a 20 54 68 65 73 65 20 61 72 65 20 61 6c | ..5.S)'...........*.These.are.al |
| c0360 | 6c 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 60 53 27 2e 0a 0a 0a 20 20 20 20 20 4e 6f | l.the.elements.of.`S'.........No |
| c0380 | 77 20 61 6c 6c 20 77 65 20 68 61 76 65 20 74 6f 20 64 6f 20 69 73 20 63 6f 6d 62 69 6e 65 20 65 | w.all.we.have.to.do.is.combine.e |
| c03a0 | 6c 65 6d 65 6e 74 73 20 66 72 6f 6d 20 74 68 65 73 65 20 73 6f 75 72 63 65 73 2e 20 20 46 6f 72 | lements.from.these.sources...For |
| c03c0 | 0a 20 20 20 20 20 74 68 69 73 20 77 65 20 64 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 | ......this.we.define.a.procedure |
| c03e0 | 20 60 6d 65 72 67 65 27 20 74 68 61 74 20 63 6f 6d 62 69 6e 65 73 20 74 77 6f 20 6f 72 64 65 72 | .`merge'.that.combines.two.order |
| c0400 | 65 64 0a 20 20 20 20 20 73 74 72 65 61 6d 73 20 69 6e 74 6f 20 6f 6e 65 20 6f 72 64 65 72 65 64 | ed......streams.into.one.ordered |
| c0420 | 20 72 65 73 75 6c 74 20 73 74 72 65 61 6d 2c 20 65 6c 69 6d 69 6e 61 74 69 6e 67 20 72 65 70 65 | .result.stream,.eliminating.repe |
| c0440 | 74 69 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 65 72 | titions:............(define.(mer |
| c0460 | 67 65 20 73 31 20 73 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 73 74 | ge.s1.s2).............(cond.((st |
| c0480 | 72 65 61 6d 2d 6e 75 6c 6c 3f 20 73 31 29 20 73 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ream-null?.s1).s2).............. |
| c04a0 | 20 20 20 20 20 28 28 73 74 72 65 61 6d 2d 6e 75 6c 6c 3f 20 73 32 29 20 73 31 29 0a 20 20 20 20 | .....((stream-null?.s2).s1)..... |
| c04c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..............(else............. |
| c04e0 | 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 31 63 61 72 20 28 73 74 72 65 61 6d 2d 63 61 72 20 | .......(let.((s1car.(stream-car. |
| c0500 | 73 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 | s1))..........................(s |
| c0520 | 32 63 61 72 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 | 2car.(stream-car.s2))).......... |
| c0540 | 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 3c 20 73 31 63 61 72 20 73 32 63 61 | ............(cond.((<.s1car.s2ca |
| c0560 | 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | r).............................( |
| c0580 | 63 6f 6e 73 2d 73 74 72 65 61 6d 20 73 31 63 61 72 20 28 6d 65 72 67 65 20 28 73 74 72 65 61 6d | cons-stream.s1car.(merge.(stream |
| c05a0 | 2d 63 64 72 20 73 31 29 20 73 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -cdr.s1).s2))).................. |
| c05c0 | 20 20 20 20 20 20 20 20 20 20 28 28 3e 20 73 31 63 61 72 20 73 32 63 61 72 29 0a 20 20 20 20 20 | ..........((>.s1car.s2car)...... |
| c05e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 | .......................(cons-str |
| c0600 | 65 61 6d 20 73 32 63 61 72 20 28 6d 65 72 67 65 20 73 31 20 28 73 74 72 65 61 6d 2d 63 64 72 20 | eam.s2car.(merge.s1.(stream-cdr. |
| c0620 | 73 32 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | s2)))).......................... |
| c0640 | 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..(else......................... |
| c0660 | 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 73 31 63 61 72 0a 20 20 20 20 20 20 20 20 20 | ....(cons-stream.s1car.......... |
| c0680 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c06a0 | 28 6d 65 72 67 65 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 31 29 0a 20 20 20 20 20 20 20 20 20 | (merge.(stream-cdr.s1).......... |
| c06c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c06e0 | 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 32 29 29 29 29 29 29 29 29 29 0a 0a | .......(stream-cdr.s2))))))))).. |
| c0700 | 20 20 20 20 20 54 68 65 6e 20 74 68 65 20 72 65 71 75 69 72 65 64 20 73 74 72 65 61 6d 20 6d 61 | .....Then.the.required.stream.ma |
| c0720 | 79 20 62 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 77 69 74 68 20 60 6d 65 72 67 65 27 2c 20 61 | y.be.constructed.with.`merge',.a |
| c0740 | 73 0a 20 20 20 20 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 | s......follows:............(defi |
| c0760 | 6e 65 20 53 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 20 28 6d 65 72 67 65 20 3c 3f 3f 3e 20 | ne.S.(cons-stream.1.(merge.<??>. |
| c0780 | 3c 3f 3f 3e 29 29 29 0a 0a 20 20 20 20 20 46 69 6c 6c 20 69 6e 20 74 68 65 20 6d 69 73 73 69 6e | <??>))).......Fill.in.the.missin |
| c07a0 | 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 70 6c 61 63 65 73 20 6d 61 72 6b | g.expressions.in.the.places.mark |
| c07c0 | 65 64 20 3c 3f 3f 3e 20 61 62 6f 76 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 | ed.<??>.above........*Exercise.3 |
| c07e0 | 2e 35 37 3a 2a 20 48 6f 77 20 6d 61 6e 79 20 61 64 64 69 74 69 6f 6e 73 20 61 72 65 20 70 65 72 | .57:*.How.many.additions.are.per |
| c0800 | 66 6f 72 6d 65 64 20 77 68 65 6e 20 77 65 20 63 6f 6d 70 75 74 65 0a 20 20 20 20 20 74 68 65 20 | formed.when.we.compute......the. |
| c0820 | 6e 74 68 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 20 75 73 69 6e 67 20 74 68 65 20 64 | nth.Fibonacci.number.using.the.d |
| c0840 | 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 66 69 62 73 27 20 62 61 73 65 64 20 6f 6e 0a 20 20 20 | efinition.of.`fibs'.based.on.... |
| c0860 | 20 20 74 68 65 20 60 61 64 64 2d 73 74 72 65 61 6d 73 27 20 70 72 6f 63 65 64 75 72 65 3f 20 20 | ..the.`add-streams'.procedure?.. |
| c0880 | 53 68 6f 77 20 74 68 61 74 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 61 64 64 69 74 69 6f 6e | Show.that.the.number.of.addition |
| c08a0 | 73 0a 20 20 20 20 20 77 6f 75 6c 64 20 62 65 20 65 78 70 6f 6e 65 6e 74 69 61 6c 6c 79 20 67 72 | s......would.be.exponentially.gr |
| c08c0 | 65 61 74 65 72 20 69 66 20 77 65 20 68 61 64 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 60 28 64 65 | eater.if.we.had.implemented.`(de |
| c08e0 | 6c 61 79 0a 20 20 20 20 20 3c 45 58 50 3e 29 27 20 73 69 6d 70 6c 79 20 61 73 20 60 28 6c 61 6d | lay......<EXP>)'.simply.as.`(lam |
| c0900 | 62 64 61 20 28 29 20 3c 45 58 50 3e 29 27 2c 20 77 69 74 68 6f 75 74 20 75 73 69 6e 67 20 74 68 | bda.().<EXP>)',.without.using.th |
| c0920 | 65 0a 20 20 20 20 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20 | e......optimization.provided.by. |
| c0940 | 74 68 65 20 60 6d 65 6d 6f 2d 70 72 6f 63 27 20 70 72 6f 63 65 64 75 72 65 20 64 65 73 63 72 69 | the.`memo-proc'.procedure.descri |
| c0960 | 62 65 64 20 69 6e 0a 20 20 20 20 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d 31 3a | bed.in......section.*Note.3-5-1: |
| c0980 | 3a 2e 28 35 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 35 38 3a 2a 20 47 69 76 | :.(5).......*Exercise.3.58:*.Giv |
| c09a0 | 65 20 61 6e 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 74 72 65 61 | e.an.interpretation.of.the.strea |
| c09c0 | 6d 20 63 6f 6d 70 75 74 65 64 20 62 79 0a 20 20 20 20 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 | m.computed.by......the.following |
| c09e0 | 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | .procedure:............(define.( |
| c0a00 | 65 78 70 61 6e 64 20 6e 75 6d 20 64 65 6e 20 72 61 64 69 78 29 0a 20 20 20 20 20 20 20 20 20 20 | expand.num.den.radix)........... |
| c0a20 | 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 71 75 6f | ..(cons-stream..............(quo |
| c0a40 | 74 69 65 6e 74 20 28 2a 20 6e 75 6d 20 72 61 64 69 78 29 20 64 65 6e 29 0a 20 20 20 20 20 20 20 | tient.(*.num.radix).den)........ |
| c0a60 | 20 20 20 20 20 20 28 65 78 70 61 6e 64 20 28 72 65 6d 61 69 6e 64 65 72 20 28 2a 20 6e 75 6d 20 | ......(expand.(remainder.(*.num. |
| c0a80 | 72 61 64 69 78 29 20 64 65 6e 29 20 64 65 6e 20 72 61 64 69 78 29 29 29 0a 0a 20 20 20 20 20 28 | radix).den).den.radix))).......( |
| c0aa0 | 60 51 75 6f 74 69 65 6e 74 27 20 69 73 20 61 20 70 72 69 6d 69 74 69 76 65 20 74 68 61 74 20 72 | `Quotient'.is.a.primitive.that.r |
| c0ac0 | 65 74 75 72 6e 73 20 74 68 65 20 69 6e 74 65 67 65 72 20 71 75 6f 74 69 65 6e 74 20 6f 66 20 74 | eturns.the.integer.quotient.of.t |
| c0ae0 | 77 6f 0a 20 20 20 20 20 69 6e 74 65 67 65 72 73 2e 29 20 20 57 68 61 74 20 61 72 65 20 74 68 65 | wo......integers.)..What.are.the |
| c0b00 | 20 73 75 63 63 65 73 73 69 76 65 20 65 6c 65 6d 65 6e 74 73 20 70 72 6f 64 75 63 65 64 20 62 79 | .successive.elements.produced.by |
| c0b20 | 20 60 28 65 78 70 61 6e 64 0a 20 20 20 20 20 31 20 37 20 31 30 29 27 3f 20 20 57 68 61 74 20 69 | .`(expand......1.7.10)'?..What.i |
| c0b40 | 73 20 70 72 6f 64 75 63 65 64 20 62 79 20 60 28 65 78 70 61 6e 64 20 33 20 38 20 31 30 29 27 3f | s.produced.by.`(expand.3.8.10)'? |
| c0b60 | 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 35 39 3a 2a 20 49 6e 20 73 65 63 74 69 | .......*Exercise.3.59:*.In.secti |
| c0b80 | 6f 6e 20 2a 4e 6f 74 65 20 32 2d 35 2d 33 3a 3a 20 77 65 20 73 61 77 20 68 6f 77 20 74 6f 20 69 | on.*Note.2-5-3::.we.saw.how.to.i |
| c0ba0 | 6d 70 6c 65 6d 65 6e 74 0a 20 20 20 20 20 61 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 61 72 69 74 68 | mplement......a.polynomial.arith |
| c0bc0 | 6d 65 74 69 63 20 73 79 73 74 65 6d 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 70 6f 6c 79 6e 6f | metic.system.representing.polyno |
| c0be0 | 6d 69 61 6c 73 20 61 73 20 6c 69 73 74 73 0a 20 20 20 20 20 6f 66 20 74 65 72 6d 73 2e 20 20 49 | mials.as.lists......of.terms...I |
| c0c00 | 6e 20 61 20 73 69 6d 69 6c 61 72 20 77 61 79 2c 20 77 65 20 63 61 6e 20 77 6f 72 6b 20 77 69 74 | n.a.similar.way,.we.can.work.wit |
| c0c20 | 68 20 22 70 6f 77 65 72 20 73 65 72 69 65 73 22 2c 20 73 75 63 68 0a 20 20 20 20 20 61 73 0a 0a | h."power.series",.such......as.. |
| c0c40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 5e 32 20 20 20 20 | .........................x^2.... |
| c0c60 | 20 78 5e 33 20 20 20 20 20 20 20 78 5e 34 0a 20 20 20 20 20 20 20 20 20 20 65 5e 78 20 3d 20 31 | .x^3.......x^4...........e^x.=.1 |
| c0c80 | 20 2b 20 78 20 2b 20 2d 2d 2d 2d 2d 20 2b 20 2d 2d 2d 2d 2d 20 2b 20 2d 2d 2d 2d 2d 2d 2d 2d 2d | .+.x.+.-----.+.-----.+.--------- |
| c0ca0 | 20 2b 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .+.............................. |
| c0cc0 | 20 32 20 20 20 20 20 33 20 2a 20 32 20 20 20 34 20 2a 20 33 20 2a 20 32 0a 0a 20 20 20 20 20 20 | .2.....3.*.2...4.*.3.*.2........ |
| c0ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 5e 32 20 20 20 20 20 20 20 78 5e 34 0a 20 | .................x^2.......x^4.. |
| c0d00 | 20 20 20 20 20 20 20 20 20 63 6f 73 20 78 20 3d 20 31 20 2d 20 2d 2d 2d 2d 2d 20 2b 20 2d 2d 2d | .........cos.x.=.1.-.-----.+.--- |
| c0d20 | 2d 2d 2d 2d 2d 2d 20 2d 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ------.-........................ |
| c0d40 | 20 20 20 20 20 32 20 20 20 20 20 34 20 2a 20 33 20 2a 20 32 0a 0a 20 20 20 20 20 20 20 20 20 20 | .....2.....4.*.3.*.2............ |
| c0d60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 78 5e 33 20 20 20 20 20 20 20 20 20 78 5e 35 0a 20 20 20 | .............x^3.........x^5.... |
| c0d80 | 20 20 20 20 20 20 20 73 69 6e 20 78 20 3d 20 78 20 2d 20 2d 2d 2d 2d 2d 20 2b 20 2d 2d 2d 2d 2d | .......sin.x.=.x.-.-----.+.----- |
| c0da0 | 2d 2d 2d 2d 2d 2d 2d 2d 20 2d 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --------.-...................... |
| c0dc0 | 20 20 20 20 20 33 20 2a 20 32 20 20 20 35 20 2a 20 34 20 2a 20 33 20 2a 20 32 0a 0a 20 20 20 20 | .....3.*.2...5.*.4.*.3.*.2...... |
| c0de0 | 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 73 | .represented.as.infinite.streams |
| c0e00 | 2e 20 20 57 65 20 77 69 6c 6c 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 73 65 72 69 65 73 20 | ...We.will.represent.the.series. |
| c0e20 | 61 5f 30 0a 20 20 20 20 20 2b 20 61 5f 31 20 78 20 2b 20 61 5f 32 20 78 5e 32 20 2b 20 61 5f 33 | a_0......+.a_1.x.+.a_2.x^2.+.a_3 |
| c0e40 | 20 78 5e 33 20 2b 20 2e 2e 2e 20 61 73 20 74 68 65 20 73 74 72 65 61 6d 20 77 68 6f 73 65 20 65 | .x^3.+.....as.the.stream.whose.e |
| c0e60 | 6c 65 6d 65 6e 74 73 20 61 72 65 0a 20 20 20 20 20 74 68 65 20 63 6f 65 66 66 69 63 69 65 6e 74 | lements.are......the.coefficient |
| c0e80 | 73 20 61 5f 30 2c 20 61 5f 31 2c 20 61 5f 32 2c 20 61 5f 33 2c 20 2e 2e 2e 2e 0a 0a 20 20 20 20 | s.a_0,.a_1,.a_2,.a_3,........... |
| c0ea0 | 20 20 20 61 2e 20 54 68 65 20 69 6e 74 65 67 72 61 6c 20 6f 66 20 74 68 65 20 73 65 72 69 65 73 | ...a..The.integral.of.the.series |
| c0ec0 | 20 61 5f 30 20 2b 20 61 5f 31 20 78 20 2b 20 61 5f 32 20 78 5e 32 20 2b 20 61 5f 33 20 78 5e 33 | .a_0.+.a_1.x.+.a_2.x^2.+.a_3.x^3 |
| c0ee0 | 20 2b 0a 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 20 69 73 20 74 68 65 20 73 65 72 69 65 73 0a 0a | .+...............is.the.series.. |
| c0f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 20 20 20 | ............................1... |
| c0f20 | 20 20 20 20 20 20 20 20 20 20 31 20 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 | ..........1.............1....... |
| c0f40 | 20 20 20 20 20 20 20 20 20 63 20 2b 20 61 5f 30 20 78 20 2b 20 2d 2d 2d 20 78 5f 31 20 72 5e 32 | .........c.+.a_0.x.+.---.x_1.r^2 |
| c0f60 | 20 2b 20 2d 2d 2d 20 61 5f 32 20 72 5e 33 20 2b 20 2d 2d 2d 20 61 5f 33 20 72 5e 34 20 2b 20 2e | .+.---.a_2.r^3.+.---.a_3.r^4.+.. |
| c0f80 | 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 | ...............................2 |
| c0fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 33 20 20 20 20 20 20 20 20 20 20 20 20 20 34 0a 0a 20 20 | .............3.............4.... |
| c0fc0 | 20 20 20 20 20 20 20 20 77 68 65 72 65 20 63 20 69 73 20 61 6e 79 20 63 6f 6e 73 74 61 6e 74 2e | ........where.c.is.any.constant. |
| c0fe0 | 20 20 44 65 66 69 6e 65 20 61 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 20 20 20 20 20 60 | ..Define.a.procedure...........` |
| c1000 | 69 6e 74 65 67 72 61 74 65 2d 73 65 72 69 65 73 27 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 | integrate-series'.that.takes.as. |
| c1020 | 69 6e 70 75 74 20 61 20 73 74 72 65 61 6d 20 61 5f 30 2c 20 61 5f 31 2c 0a 20 20 20 20 20 20 20 | input.a.stream.a_0,.a_1,........ |
| c1040 | 20 20 20 61 5f 32 2c 20 2e 2e 2e 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 20 70 6f 77 65 72 | ...a_2,.....representing.a.power |
| c1060 | 20 73 65 72 69 65 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 74 72 65 61 6d 0a 20 | .series.and.returns.the.stream.. |
| c1080 | 20 20 20 20 20 20 20 20 20 61 5f 30 2c 20 28 31 2f 32 29 61 5f 31 2c 20 28 31 2f 33 29 61 5f 32 | .........a_0,.(1/2)a_1,.(1/3)a_2 |
| c10a0 | 2c 20 2e 2e 2e 20 6f 66 20 63 6f 65 66 66 69 63 69 65 6e 74 73 20 6f 66 20 74 68 65 0a 20 20 20 | ,.....of.coefficients.of.the.... |
| c10c0 | 20 20 20 20 20 20 20 6e 6f 6e 2d 63 6f 6e 73 74 61 6e 74 20 74 65 72 6d 73 20 6f 66 20 74 68 65 | .......non-constant.terms.of.the |
| c10e0 | 20 69 6e 74 65 67 72 61 6c 20 6f 66 20 74 68 65 20 73 65 72 69 65 73 2e 20 20 28 53 69 6e 63 65 | .integral.of.the.series...(Since |
| c1100 | 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 72 65 73 75 6c 74 20 68 61 73 20 6e 6f 20 63 6f 6e | .the...........result.has.no.con |
| c1120 | 73 74 61 6e 74 20 74 65 72 6d 2c 20 69 74 20 64 6f 65 73 6e 27 74 20 72 65 70 72 65 73 65 6e 74 | stant.term,.it.doesn't.represent |
| c1140 | 20 61 20 70 6f 77 65 72 0a 20 20 20 20 20 20 20 20 20 20 73 65 72 69 65 73 3b 20 77 68 65 6e 20 | .a.power...........series;.when. |
| c1160 | 77 65 20 75 73 65 20 60 69 6e 74 65 67 72 61 74 65 2d 73 65 72 69 65 73 27 2c 20 77 65 20 77 69 | we.use.`integrate-series',.we.wi |
| c1180 | 6c 6c 20 60 63 6f 6e 73 27 20 6f 6e 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 61 70 70 72 6f | ll.`cons'.on.the...........appro |
| c11a0 | 70 72 69 61 74 65 20 63 6f 6e 73 74 61 6e 74 2e 29 0a 0a 20 20 20 20 20 20 20 62 2e 20 54 68 65 | priate.constant.).........b..The |
| c11c0 | 20 66 75 6e 63 74 69 6f 6e 20 78 20 7c 2d 3e 20 65 5e 78 20 69 73 20 69 74 73 20 6f 77 6e 20 64 | .function.x.|->.e^x.is.its.own.d |
| c11e0 | 65 72 69 76 61 74 69 76 65 2e 20 20 54 68 69 73 20 69 6d 70 6c 69 65 73 0a 20 20 20 20 20 20 20 | erivative...This.implies........ |
| c1200 | 20 20 20 74 68 61 74 20 65 5e 78 20 61 6e 64 20 74 68 65 20 69 6e 74 65 67 72 61 6c 20 6f 66 20 | ...that.e^x.and.the.integral.of. |
| c1220 | 65 5e 78 20 61 72 65 20 74 68 65 20 73 61 6d 65 20 73 65 72 69 65 73 2c 20 65 78 63 65 70 74 0a | e^x.are.the.same.series,.except. |
| c1240 | 20 20 20 20 20 20 20 20 20 20 66 6f 72 20 74 68 65 20 63 6f 6e 73 74 61 6e 74 20 74 65 72 6d 2c | ..........for.the.constant.term, |
| c1260 | 20 77 68 69 63 68 20 69 73 20 65 5e 30 20 3d 20 31 2e 20 20 41 63 63 6f 72 64 69 6e 67 6c 79 2c | .which.is.e^0.=.1...Accordingly, |
| c1280 | 20 77 65 20 63 61 6e 0a 20 20 20 20 20 20 20 20 20 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 73 | .we.can...........generate.the.s |
| c12a0 | 65 72 69 65 73 20 66 6f 72 20 65 5e 78 20 61 73 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | eries.for.e^x.as................ |
| c12c0 | 20 28 64 65 66 69 6e 65 20 65 78 70 2d 73 65 72 69 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 | .(define.exp-series............. |
| c12e0 | 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 20 28 69 6e 74 65 67 72 61 74 65 2d 73 | .....(cons-stream.1.(integrate-s |
| c1300 | 65 72 69 65 73 20 65 78 70 2d 73 65 72 69 65 73 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 53 | eries.exp-series)))............S |
| c1320 | 68 6f 77 20 68 6f 77 20 74 6f 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 73 65 72 69 65 73 20 66 | how.how.to.generate.the.series.f |
| c1340 | 6f 72 20 73 69 6e 65 20 61 6e 64 20 63 6f 73 69 6e 65 2c 20 73 74 61 72 74 69 6e 67 0a 20 20 20 | or.sine.and.cosine,.starting.... |
| c1360 | 20 20 20 20 20 20 20 66 72 6f 6d 20 74 68 65 20 66 61 63 74 73 20 74 68 61 74 20 74 68 65 20 64 | .......from.the.facts.that.the.d |
| c1380 | 65 72 69 76 61 74 69 76 65 20 6f 66 20 73 69 6e 65 20 69 73 20 63 6f 73 69 6e 65 20 61 6e 64 20 | erivative.of.sine.is.cosine.and. |
| c13a0 | 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 64 65 72 69 76 61 74 69 76 65 20 6f 66 20 63 6f 73 69 | the...........derivative.of.cosi |
| c13c0 | 6e 65 20 69 73 20 74 68 65 20 6e 65 67 61 74 69 76 65 20 6f 66 20 73 69 6e 65 3a 0a 0a 20 20 20 | ne.is.the.negative.of.sine:..... |
| c13e0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 63 6f 73 69 6e 65 2d 73 65 72 69 65 | ............(define.cosine-serie |
| c1400 | 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 | s..................(cons-stream. |
| c1420 | 31 20 3c 3f 3f 3e 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | 1.<??>)).................(define |
| c1440 | 20 73 69 6e 65 2d 73 65 72 69 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 | .sine-series..................(c |
| c1460 | 6f 6e 73 2d 73 74 72 65 61 6d 20 30 20 3c 3f 3f 3e 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | ons-stream.0.<??>)).......*Exerc |
| c1480 | 69 73 65 20 33 2e 36 30 3a 2a 20 57 69 74 68 20 70 6f 77 65 72 20 73 65 72 69 65 73 20 72 65 70 | ise.3.60:*.With.power.series.rep |
| c14a0 | 72 65 73 65 6e 74 65 64 20 61 73 20 73 74 72 65 61 6d 73 20 6f 66 0a 20 20 20 20 20 63 6f 65 66 | resented.as.streams.of......coef |
| c14c0 | 66 69 63 69 65 6e 74 73 20 61 73 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d | ficients.as.in.*Note.Exercise.3- |
| c14e0 | 35 39 3a 3a 2c 20 61 64 64 69 6e 67 20 73 65 72 69 65 73 20 69 73 0a 20 20 20 20 20 69 6d 70 6c | 59::,.adding.series.is......impl |
| c1500 | 65 6d 65 6e 74 65 64 20 62 79 20 60 61 64 64 2d 73 74 72 65 61 6d 73 27 2e 20 20 43 6f 6d 70 6c | emented.by.`add-streams'...Compl |
| c1520 | 65 74 65 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 0a 20 20 20 20 20 66 | ete.the.definition.of.the......f |
| c1540 | 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 6d 75 6c 74 69 70 6c 79 69 | ollowing.procedure.for.multiplyi |
| c1560 | 6e 67 20 73 65 72 69 65 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d | ng.series:............(define.(m |
| c1580 | 75 6c 2d 73 65 72 69 65 73 20 73 31 20 73 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f | ul-series.s1.s2).............(co |
| c15a0 | 6e 73 2d 73 74 72 65 61 6d 20 3c 3f 3f 3e 20 28 61 64 64 2d 73 74 72 65 61 6d 73 20 3c 3f 3f 3e | ns-stream.<??>.(add-streams.<??> |
| c15c0 | 20 3c 3f 3f 3e 29 29 29 0a 0a 20 20 20 20 20 59 6f 75 20 63 61 6e 20 74 65 73 74 20 79 6f 75 72 | .<??>))).......You.can.test.your |
| c15e0 | 20 70 72 6f 63 65 64 75 72 65 20 62 79 20 76 65 72 69 66 79 69 6e 67 20 74 68 61 74 20 73 69 6e | .procedure.by.verifying.that.sin |
| c1600 | 5e 32 20 78 20 2b 20 63 6f 73 5e 32 20 78 20 3d 0a 20 20 20 20 20 31 2c 20 75 73 69 6e 67 20 74 | ^2.x.+.cos^2.x.=......1,.using.t |
| c1620 | 68 65 20 73 65 72 69 65 73 20 66 72 6f 6d 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d | he.series.from.*Note.Exercise.3- |
| c1640 | 35 39 3a 3a 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 36 31 3a 2a 20 4c 65 74 | 59::........*Exercise.3.61:*.Let |
| c1660 | 20 53 20 62 65 20 61 20 70 6f 77 65 72 20 73 65 72 69 65 73 20 28 2a 4e 6f 74 65 20 45 78 65 72 | .S.be.a.power.series.(*Note.Exer |
| c1680 | 63 69 73 65 20 33 2d 35 39 3a 3a 29 0a 20 20 20 20 20 77 68 6f 73 65 20 63 6f 6e 73 74 61 6e 74 | cise.3-59::)......whose.constant |
| c16a0 | 20 74 65 72 6d 20 69 73 20 31 2e 20 20 53 75 70 70 6f 73 65 20 77 65 20 77 61 6e 74 20 74 6f 20 | .term.is.1...Suppose.we.want.to. |
| c16c0 | 66 69 6e 64 20 74 68 65 20 70 6f 77 65 72 0a 20 20 20 20 20 73 65 72 69 65 73 20 31 2f 53 2c 20 | find.the.power......series.1/S,. |
| c16e0 | 74 68 61 74 20 69 73 2c 20 74 68 65 20 73 65 72 69 65 73 20 58 20 73 75 63 68 20 74 68 61 74 20 | that.is,.the.series.X.such.that. |
| c1700 | 53 20 2a 20 58 20 3d 20 31 2e 20 20 57 72 69 74 65 20 53 20 3d 0a 20 20 20 20 20 31 20 2b 20 53 | S.*.X.=.1...Write.S.=......1.+.S |
| c1720 | 5f 52 20 77 68 65 72 65 20 53 5f 52 20 69 73 20 74 68 65 20 70 61 72 74 20 6f 66 20 53 20 61 66 | _R.where.S_R.is.the.part.of.S.af |
| c1740 | 74 65 72 20 74 68 65 20 63 6f 6e 73 74 61 6e 74 20 74 65 72 6d 2e 20 20 54 68 65 6e 0a 20 20 20 | ter.the.constant.term...Then.... |
| c1760 | 20 20 77 65 20 63 61 6e 20 73 6f 6c 76 65 20 66 6f 72 20 58 20 61 73 20 66 6f 6c 6c 6f 77 73 3a | ..we.can.solve.for.X.as.follows: |
| c1780 | 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 20 2a 20 58 20 3d 20 31 0a 20 20 | ....................S.*.X.=.1... |
| c17a0 | 20 20 20 20 20 20 20 20 28 31 20 2b 20 53 5f 52 29 20 2a 20 58 20 3d 20 31 0a 20 20 20 20 20 20 | ........(1.+.S_R).*.X.=.1....... |
| c17c0 | 20 20 20 20 20 20 58 20 2b 20 53 5f 52 20 2a 20 58 20 3d 20 31 0a 20 20 20 20 20 20 20 20 20 20 | ......X.+.S_R.*.X.=.1........... |
| c17e0 | 20 20 20 20 20 20 20 20 20 20 20 20 58 20 3d 20 31 20 2d 20 53 5f 52 20 2a 20 58 0a 0a 20 20 20 | ............X.=.1.-.S_R.*.X..... |
| c1800 | 20 20 49 6e 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 58 20 69 73 20 74 68 65 20 70 6f 77 65 72 | ..In.other.words,.X.is.the.power |
| c1820 | 20 73 65 72 69 65 73 20 77 68 6f 73 65 20 63 6f 6e 73 74 61 6e 74 20 74 65 72 6d 20 69 73 20 31 | .series.whose.constant.term.is.1 |
| c1840 | 20 61 6e 64 0a 20 20 20 20 20 77 68 6f 73 65 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 74 65 72 | .and......whose.higher-order.ter |
| c1860 | 6d 73 20 61 72 65 20 67 69 76 65 6e 20 62 79 20 74 68 65 20 6e 65 67 61 74 69 76 65 20 6f 66 20 | ms.are.given.by.the.negative.of. |
| c1880 | 53 5f 52 20 74 69 6d 65 73 20 58 2e 0a 20 20 20 20 20 55 73 65 20 74 68 69 73 20 69 64 65 61 20 | S_R.times.X.......Use.this.idea. |
| c18a0 | 74 6f 20 77 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 69 6e 76 65 72 74 2d 75 6e 69 | to.write.a.procedure.`invert-uni |
| c18c0 | 74 2d 73 65 72 69 65 73 27 20 74 68 61 74 0a 20 20 20 20 20 63 6f 6d 70 75 74 65 73 20 31 2f 53 | t-series'.that......computes.1/S |
| c18e0 | 20 66 6f 72 20 61 20 70 6f 77 65 72 20 73 65 72 69 65 73 20 53 20 77 69 74 68 20 63 6f 6e 73 74 | .for.a.power.series.S.with.const |
| c1900 | 61 6e 74 20 74 65 72 6d 20 31 2e 20 20 59 6f 75 20 77 69 6c 6c 0a 20 20 20 20 20 6e 65 65 64 20 | ant.term.1...You.will......need. |
| c1920 | 74 6f 20 75 73 65 20 60 6d 75 6c 2d 73 65 72 69 65 73 27 20 66 72 6f 6d 20 2a 4e 6f 74 65 20 45 | to.use.`mul-series'.from.*Note.E |
| c1940 | 78 65 72 63 69 73 65 20 33 2d 36 30 3a 3a 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 | xercise.3-60::........*Exercise. |
| c1960 | 33 2e 36 32 3a 2a 20 55 73 65 20 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 20 2a 4e 6f 74 65 20 | 3.62:*.Use.the.results.of.*Note. |
| c1980 | 45 78 65 72 63 69 73 65 20 33 2d 36 30 3a 3a 20 61 6e 64 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 | Exercise.3-60::.and......*Note.E |
| c19a0 | 78 65 72 63 69 73 65 20 33 2d 36 31 3a 3a 20 74 6f 20 64 65 66 69 6e 65 20 61 20 70 72 6f 63 65 | xercise.3-61::.to.define.a.proce |
| c19c0 | 64 75 72 65 20 60 64 69 76 2d 73 65 72 69 65 73 27 20 74 68 61 74 0a 20 20 20 20 20 64 69 76 69 | dure.`div-series'.that......divi |
| c19e0 | 64 65 73 20 74 77 6f 20 70 6f 77 65 72 20 73 65 72 69 65 73 2e 20 20 60 44 69 76 2d 73 65 72 69 | des.two.power.series...`Div-seri |
| c1a00 | 65 73 27 20 73 68 6f 75 6c 64 20 77 6f 72 6b 20 66 6f 72 20 61 6e 79 20 74 77 6f 0a 20 20 20 20 | es'.should.work.for.any.two..... |
| c1a20 | 20 73 65 72 69 65 73 2c 20 70 72 6f 76 69 64 65 64 20 74 68 61 74 20 74 68 65 20 64 65 6e 6f 6d | .series,.provided.that.the.denom |
| c1a40 | 69 6e 61 74 6f 72 20 73 65 72 69 65 73 20 62 65 67 69 6e 73 20 77 69 74 68 20 61 20 6e 6f 6e 7a | inator.series.begins.with.a.nonz |
| c1a60 | 65 72 6f 0a 20 20 20 20 20 63 6f 6e 73 74 61 6e 74 20 74 65 72 6d 2e 20 20 28 49 66 20 74 68 65 | ero......constant.term...(If.the |
| c1a80 | 20 64 65 6e 6f 6d 69 6e 61 74 6f 72 20 68 61 73 20 61 20 7a 65 72 6f 20 63 6f 6e 73 74 61 6e 74 | .denominator.has.a.zero.constant |
| c1aa0 | 20 74 65 72 6d 2c 20 74 68 65 6e 0a 20 20 20 20 20 60 64 69 76 2d 73 65 72 69 65 73 27 20 73 68 | .term,.then......`div-series'.sh |
| c1ac0 | 6f 75 6c 64 20 73 69 67 6e 61 6c 20 61 6e 20 65 72 72 6f 72 2e 29 20 20 53 68 6f 77 20 68 6f 77 | ould.signal.an.error.)..Show.how |
| c1ae0 | 20 74 6f 20 75 73 65 0a 20 20 20 20 20 60 64 69 76 2d 73 65 72 69 65 73 27 20 74 6f 67 65 74 68 | .to.use......`div-series'.togeth |
| c1b00 | 65 72 20 77 69 74 68 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 | er.with.the.result.of.*Note.Exer |
| c1b20 | 63 69 73 65 20 33 2d 35 39 3a 3a 20 74 6f 0a 20 20 20 20 20 67 65 6e 65 72 61 74 65 20 74 68 65 | cise.3-59::.to......generate.the |
| c1b40 | 20 70 6f 77 65 72 20 73 65 72 69 65 73 20 66 6f 72 20 74 61 6e 67 65 6e 74 2e 0a 0a 20 20 20 2d | .power.series.for.tangent......- |
| c1b60 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a | ---------.Footnotes.----------.. |
| c1b80 | 20 20 20 28 31 29 20 45 72 61 74 6f 73 74 68 65 6e 65 73 2c 20 61 20 74 68 69 72 64 2d 63 65 6e | ...(1).Eratosthenes,.a.third-cen |
| c1ba0 | 74 75 72 79 20 42 2e 43 2e 20 20 41 6c 65 78 61 6e 64 72 69 61 6e 20 47 72 65 65 6b 0a 70 68 69 | tury.B.C...Alexandrian.Greek.phi |
| c1bc0 | 6c 6f 73 6f 70 68 65 72 2c 20 69 73 20 66 61 6d 6f 75 73 20 66 6f 72 20 67 69 76 69 6e 67 20 74 | losopher,.is.famous.for.giving.t |
| c1be0 | 68 65 20 66 69 72 73 74 20 61 63 63 75 72 61 74 65 20 65 73 74 69 6d 61 74 65 20 6f 66 20 74 68 | he.first.accurate.estimate.of.th |
| c1c00 | 65 0a 63 69 72 63 75 6d 66 65 72 65 6e 63 65 20 6f 66 20 74 68 65 20 45 61 72 74 68 2c 20 77 68 | e.circumference.of.the.Earth,.wh |
| c1c20 | 69 63 68 20 68 65 20 63 6f 6d 70 75 74 65 64 20 62 79 20 6f 62 73 65 72 76 69 6e 67 20 73 68 61 | ich.he.computed.by.observing.sha |
| c1c40 | 64 6f 77 73 20 63 61 73 74 0a 61 74 20 6e 6f 6f 6e 20 6f 6e 20 74 68 65 20 64 61 79 20 6f 66 20 | dows.cast.at.noon.on.the.day.of. |
| c1c60 | 74 68 65 20 73 75 6d 6d 65 72 20 73 6f 6c 73 74 69 63 65 2e 20 20 45 72 61 74 6f 73 74 68 65 6e | the.summer.solstice...Eratosthen |
| c1c80 | 65 73 27 73 20 73 69 65 76 65 20 6d 65 74 68 6f 64 2c 0a 61 6c 74 68 6f 75 67 68 20 61 6e 63 69 | es's.sieve.method,.although.anci |
| c1ca0 | 65 6e 74 2c 20 68 61 73 20 66 6f 72 6d 65 64 20 74 68 65 20 62 61 73 69 73 20 66 6f 72 20 73 70 | ent,.has.formed.the.basis.for.sp |
| c1cc0 | 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 68 61 72 64 77 61 72 65 0a 22 73 69 65 76 65 73 22 20 | ecial-purpose.hardware."sieves". |
| c1ce0 | 74 68 61 74 2c 20 75 6e 74 69 6c 20 72 65 63 65 6e 74 6c 79 2c 20 77 65 72 65 20 74 68 65 20 6d | that,.until.recently,.were.the.m |
| c1d00 | 6f 73 74 20 70 6f 77 65 72 66 75 6c 20 74 6f 6f 6c 73 20 69 6e 0a 65 78 69 73 74 65 6e 63 65 20 | ost.powerful.tools.in.existence. |
| c1d20 | 66 6f 72 20 6c 6f 63 61 74 69 6e 67 20 6c 61 72 67 65 20 70 72 69 6d 65 73 2e 20 20 53 69 6e 63 | for.locating.large.primes...Sinc |
| c1d40 | 65 20 74 68 65 20 37 30 73 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 65 73 65 0a 6d 65 74 68 6f 64 | e.the.70s,.however,.these.method |
| c1d60 | 73 20 68 61 76 65 20 62 65 65 6e 20 73 75 70 65 72 73 65 64 65 64 20 62 79 20 6f 75 74 67 72 6f | s.have.been.superseded.by.outgro |
| c1d80 | 77 74 68 73 20 6f 66 20 74 68 65 20 70 72 6f 62 61 62 69 6c 69 73 74 69 63 0a 74 65 63 68 6e 69 | wths.of.the.probabilistic.techni |
| c1da0 | 71 75 65 73 20 64 69 73 63 75 73 73 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 | ques.discussed.in.section.*Note. |
| c1dc0 | 31 2d 32 2d 36 3a 3a 2e 0a 0a 20 20 20 28 32 29 20 57 65 20 68 61 76 65 20 6e 61 6d 65 64 20 74 | 1-2-6::......(2).We.have.named.t |
| c1de0 | 68 65 73 65 20 66 69 67 75 72 65 73 20 61 66 74 65 72 20 50 65 74 65 72 20 48 65 6e 64 65 72 73 | hese.figures.after.Peter.Henders |
| c1e00 | 6f 6e 2c 20 77 68 6f 20 77 61 73 20 74 68 65 0a 66 69 72 73 74 20 70 65 72 73 6f 6e 20 74 6f 20 | on,.who.was.the.first.person.to. |
| c1e20 | 73 68 6f 77 20 75 73 20 64 69 61 67 72 61 6d 73 20 6f 66 20 74 68 69 73 20 73 6f 72 74 20 61 73 | show.us.diagrams.of.this.sort.as |
| c1e40 | 20 61 20 77 61 79 20 6f 66 20 74 68 69 6e 6b 69 6e 67 0a 61 62 6f 75 74 20 73 74 72 65 61 6d 20 | .a.way.of.thinking.about.stream. |
| c1e60 | 70 72 6f 63 65 73 73 69 6e 67 2e 20 20 45 61 63 68 20 73 6f 6c 69 64 20 6c 69 6e 65 20 72 65 70 | processing...Each.solid.line.rep |
| c1e80 | 72 65 73 65 6e 74 73 20 61 20 73 74 72 65 61 6d 20 6f 66 20 76 61 6c 75 65 73 0a 62 65 69 6e 67 | resents.a.stream.of.values.being |
| c1ea0 | 20 74 72 61 6e 73 6d 69 74 74 65 64 2e 20 20 54 68 65 20 64 61 73 68 65 64 20 6c 69 6e 65 20 66 | .transmitted...The.dashed.line.f |
| c1ec0 | 72 6f 6d 20 74 68 65 20 60 63 61 72 27 20 74 6f 20 74 68 65 20 60 63 6f 6e 73 27 20 61 6e 64 0a | rom.the.`car'.to.the.`cons'.and. |
| c1ee0 | 74 68 65 20 60 66 69 6c 74 65 72 27 20 69 6e 64 69 63 61 74 65 73 20 74 68 61 74 20 74 68 69 73 | the.`filter'.indicates.that.this |
| c1f00 | 20 69 73 20 61 20 73 69 6e 67 6c 65 20 76 61 6c 75 65 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 | .is.a.single.value.rather.than.a |
| c1f20 | 20 73 74 72 65 61 6d 2e 0a 0a 20 20 20 28 33 29 20 54 68 69 73 20 75 73 65 73 20 74 68 65 20 67 | .stream......(3).This.uses.the.g |
| c1f40 | 65 6e 65 72 61 6c 69 7a 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 60 73 74 72 65 61 6d 2d 6d 61 | eneralized.version.of.`stream-ma |
| c1f60 | 70 27 20 66 72 6f 6d 20 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 20 33 2d 35 30 3a 3a 2e 0a 0a | p'.from.*Note.Exercise.3-50::... |
| c1f80 | 20 20 20 28 34 29 20 54 68 69 73 20 6c 61 73 74 20 70 6f 69 6e 74 20 69 73 20 76 65 72 79 20 73 | ...(4).This.last.point.is.very.s |
| c1fa0 | 75 62 74 6c 65 20 61 6e 64 20 72 65 6c 69 65 73 20 6f 6e 20 74 68 65 20 66 61 63 74 20 74 68 61 | ubtle.and.relies.on.the.fact.tha |
| c1fc0 | 74 0a 70 5f 28 6e 2b 31 29 20 3c 3d 20 70 5f 6e 5e 32 2e 20 20 28 48 65 72 65 2c 20 70 5f 6b 20 | t.p_(n+1).<=.p_n^2...(Here,.p_k. |
| c1fe0 | 64 65 6e 6f 74 65 73 20 74 68 65 20 6b 74 68 20 70 72 69 6d 65 2e 29 20 20 45 73 74 69 6d 61 74 | denotes.the.kth.prime.)..Estimat |
| c2000 | 65 73 20 73 75 63 68 0a 61 73 20 74 68 65 73 65 20 61 72 65 20 76 65 72 79 20 64 69 66 66 69 63 | es.such.as.these.are.very.diffic |
| c2020 | 75 6c 74 20 74 6f 20 65 73 74 61 62 6c 69 73 68 2e 20 20 54 68 65 20 61 6e 63 69 65 6e 74 20 70 | ult.to.establish...The.ancient.p |
| c2040 | 72 6f 6f 66 20 62 79 20 45 75 63 6c 69 64 0a 74 68 61 74 20 74 68 65 72 65 20 61 72 65 20 61 6e | roof.by.Euclid.that.there.are.an |
| c2060 | 20 69 6e 66 69 6e 69 74 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 72 69 6d 65 73 20 73 68 6f 77 73 | .infinite.number.of.primes.shows |
| c2080 | 20 74 68 61 74 20 70 5f 28 6e 2b 31 29 3c 3d 20 70 5f 31 0a 70 5f 32 2e 2e 2e 70 5f 6e 20 2b 20 | .that.p_(n+1)<=.p_1.p_2...p_n.+. |
| c20a0 | 31 2c 20 61 6e 64 20 6e 6f 20 73 75 62 73 74 61 6e 74 69 61 6c 6c 79 20 62 65 74 74 65 72 20 72 | 1,.and.no.substantially.better.r |
| c20c0 | 65 73 75 6c 74 20 77 61 73 20 70 72 6f 76 65 64 20 75 6e 74 69 6c 0a 31 38 35 31 2c 20 77 68 65 | esult.was.proved.until.1851,.whe |
| c20e0 | 6e 20 74 68 65 20 52 75 73 73 69 61 6e 20 6d 61 74 68 65 6d 61 74 69 63 69 61 6e 20 50 2e 20 4c | n.the.Russian.mathematician.P..L |
| c2100 | 2e 20 43 68 65 62 79 73 68 65 76 20 65 73 74 61 62 6c 69 73 68 65 64 20 74 68 61 74 0a 70 5f 28 | ..Chebyshev.established.that.p_( |
| c2120 | 6e 2b 31 29 3c 3d 20 32 70 5f 6e 20 66 6f 72 20 61 6c 6c 20 6e 2e 20 20 54 68 69 73 20 72 65 73 | n+1)<=.2p_n.for.all.n...This.res |
| c2140 | 75 6c 74 2c 20 6f 72 69 67 69 6e 61 6c 6c 79 20 63 6f 6e 6a 65 63 74 75 72 65 64 20 69 6e 20 31 | ult,.originally.conjectured.in.1 |
| c2160 | 38 34 35 2c 0a 69 73 20 6b 6e 6f 77 6e 20 61 73 20 68 79 70 6f 74 68 65 73 69 73 20 22 42 65 72 | 845,.is.known.as.hypothesis."Ber |
| c2180 | 74 72 61 6e 64 27 73 20 68 79 70 6f 74 68 65 73 69 73 22 2e 20 20 41 20 70 72 6f 6f 66 20 63 61 | trand's.hypothesis"...A.proof.ca |
| c21a0 | 6e 20 62 65 20 66 6f 75 6e 64 0a 69 6e 20 73 65 63 74 69 6f 6e 20 32 32 2e 33 20 6f 66 20 48 61 | n.be.found.in.section.22.3.of.Ha |
| c21c0 | 72 64 79 20 61 6e 64 20 57 72 69 67 68 74 20 31 39 36 30 2e 0a 0a 20 20 20 28 35 29 20 54 68 69 | rdy.and.Wright.1960......(5).Thi |
| c21e0 | 73 20 65 78 65 72 63 69 73 65 20 73 68 6f 77 73 20 68 6f 77 20 63 61 6c 6c 2d 62 79 2d 6e 65 65 | s.exercise.shows.how.call-by-nee |
| c2200 | 64 20 69 73 20 63 6c 6f 73 65 6c 79 20 72 65 6c 61 74 65 64 20 74 6f 0a 6f 72 64 69 6e 61 72 79 | d.is.closely.related.to.ordinary |
| c2220 | 20 6d 65 6d 6f 69 7a 61 74 69 6f 6e 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f | .memoization.as.described.in.*No |
| c2240 | 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 32 37 3a 3a 2e 20 20 49 6e 20 74 68 61 74 0a 65 78 65 | te.Exercise.3-27::...In.that.exe |
| c2260 | 72 63 69 73 65 2c 20 77 65 20 75 73 65 64 20 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 20 65 78 70 | rcise,.we.used.assignment.to.exp |
| c2280 | 6c 69 63 69 74 6c 79 20 63 6f 6e 73 74 72 75 63 74 20 61 20 6c 6f 63 61 6c 20 74 61 62 6c 65 2e | licitly.construct.a.local.table. |
| c22a0 | 0a 4f 75 72 20 63 61 6c 6c 2d 62 79 2d 6e 65 65 64 20 73 74 72 65 61 6d 20 6f 70 74 69 6d 69 7a | .Our.call-by-need.stream.optimiz |
| c22c0 | 61 74 69 6f 6e 20 65 66 66 65 63 74 69 76 65 6c 79 20 63 6f 6e 73 74 72 75 63 74 73 20 73 75 63 | ation.effectively.constructs.suc |
| c22e0 | 68 20 61 0a 74 61 62 6c 65 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 2c 20 73 74 6f 72 69 6e 67 | h.a.table.automatically,.storing |
| c2300 | 20 76 61 6c 75 65 73 20 69 6e 20 74 68 65 20 70 72 65 76 69 6f 75 73 6c 79 20 66 6f 72 63 65 64 | .values.in.the.previously.forced |
| c2320 | 20 70 61 72 74 73 20 6f 66 0a 74 68 65 20 73 74 72 65 61 6d 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 | .parts.of.the.stream.....File:.s |
| c2340 | 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 35 2d 33 2c 20 20 4e 65 78 74 3a 20 33 | icp.info,..Node:.3-5-3,..Next:.3 |
| c2360 | 2d 35 2d 34 2c 20 20 50 72 65 76 3a 20 33 2d 35 2d 32 2c 20 20 55 70 3a 20 33 2d 35 0a 0a 33 2e | -5-4,..Prev:.3-5-2,..Up:.3-5..3. |
| c2380 | 35 2e 33 20 45 78 70 6c 6f 69 74 69 6e 67 20 74 68 65 20 53 74 72 65 61 6d 20 50 61 72 61 64 69 | 5.3.Exploiting.the.Stream.Paradi |
| c23a0 | 67 6d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | gm.----------------------------- |
| c23c0 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 53 74 72 65 61 6d 73 20 77 69 74 68 20 64 65 6c 61 79 65 64 20 65 76 | -------..Streams.with.delayed.ev |
| c23e0 | 61 6c 75 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 61 20 70 6f 77 65 72 66 75 6c 20 6d 6f 64 65 6c | aluation.can.be.a.powerful.model |
| c2400 | 69 6e 67 20 74 6f 6f 6c 2c 0a 70 72 6f 76 69 64 69 6e 67 20 6d 61 6e 79 20 6f 66 20 74 68 65 20 | ing.tool,.providing.many.of.the. |
| c2420 | 62 65 6e 65 66 69 74 73 20 6f 66 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 61 6e 64 20 61 73 73 69 | benefits.of.local.state.and.assi |
| c2440 | 67 6e 6d 65 6e 74 2e 0a 4d 6f 72 65 6f 76 65 72 2c 20 74 68 65 79 20 61 76 6f 69 64 20 73 6f 6d | gnment..Moreover,.they.avoid.som |
| c2460 | 65 20 6f 66 20 74 68 65 20 74 68 65 6f 72 65 74 69 63 61 6c 20 74 61 6e 67 6c 65 73 20 74 68 61 | e.of.the.theoretical.tangles.tha |
| c2480 | 74 20 61 63 63 6f 6d 70 61 6e 79 20 74 68 65 0a 69 6e 74 72 6f 64 75 63 74 69 6f 6e 20 6f 66 20 | t.accompany.the.introduction.of. |
| c24a0 | 61 73 73 69 67 6e 6d 65 6e 74 20 69 6e 74 6f 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 | assignment.into.a.programming.la |
| c24c0 | 6e 67 75 61 67 65 2e 0a 0a 20 20 20 54 68 65 20 73 74 72 65 61 6d 20 61 70 70 72 6f 61 63 68 20 | nguage......The.stream.approach. |
| c24e0 | 63 61 6e 20 62 65 20 69 6c 6c 75 6d 69 6e 61 74 69 6e 67 20 62 65 63 61 75 73 65 20 69 74 20 61 | can.be.illuminating.because.it.a |
| c2500 | 6c 6c 6f 77 73 20 75 73 20 74 6f 0a 62 75 69 6c 64 20 73 79 73 74 65 6d 73 20 77 69 74 68 20 64 | llows.us.to.build.systems.with.d |
| c2520 | 69 66 66 65 72 65 6e 74 20 6d 6f 64 75 6c 65 20 62 6f 75 6e 64 61 72 69 65 73 20 74 68 61 6e 20 | ifferent.module.boundaries.than. |
| c2540 | 73 79 73 74 65 6d 73 20 6f 72 67 61 6e 69 7a 65 64 0a 61 72 6f 75 6e 64 20 61 73 73 69 67 6e 6d | systems.organized.around.assignm |
| c2560 | 65 6e 74 20 74 6f 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 2e 20 20 46 6f 72 20 65 78 61 | ent.to.state.variables...For.exa |
| c2580 | 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 74 68 69 6e 6b 20 6f 66 20 61 6e 0a 65 6e 74 69 72 65 20 | mple,.we.can.think.of.an.entire. |
| c25a0 | 74 69 6d 65 20 73 65 72 69 65 73 20 28 6f 72 20 73 69 67 6e 61 6c 29 20 61 73 20 61 20 66 6f 63 | time.series.(or.signal).as.a.foc |
| c25c0 | 75 73 20 6f 66 20 69 6e 74 65 72 65 73 74 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 68 65 0a | us.of.interest,.rather.than.the. |
| c25e0 | 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 20 61 74 | values.of.the.state.variables.at |
| c2600 | 20 69 6e 64 69 76 69 64 75 61 6c 20 6d 6f 6d 65 6e 74 73 2e 20 20 54 68 69 73 20 6d 61 6b 65 73 | .individual.moments...This.makes |
| c2620 | 20 69 74 0a 63 6f 6e 76 65 6e 69 65 6e 74 20 74 6f 20 63 6f 6d 62 69 6e 65 20 61 6e 64 20 63 6f | .it.convenient.to.combine.and.co |
| c2640 | 6d 70 61 72 65 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 6f 66 20 73 74 61 74 65 20 66 72 6f 6d 20 64 | mpare.components.of.state.from.d |
| c2660 | 69 66 66 65 72 65 6e 74 0a 6d 6f 6d 65 6e 74 73 2e 0a 0a 46 6f 72 6d 75 6c 61 74 69 6e 67 20 69 | ifferent.moments...Formulating.i |
| c2680 | 74 65 72 61 74 69 6f 6e 73 20 61 73 20 73 74 72 65 61 6d 20 70 72 6f 63 65 73 73 65 73 0a 2e 2e | terations.as.stream.processes... |
| c26a0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ................................ |
| c26c0 | 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 31 | ..........In.section.*Note.1-2-1 |
| c26e0 | 3a 3a 2c 20 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 | ::,.we.introduced.iterative.proc |
| c2700 | 65 73 73 65 73 2c 20 77 68 69 63 68 0a 70 72 6f 63 65 65 64 20 62 79 20 75 70 64 61 74 69 6e 67 | esses,.which.proceed.by.updating |
| c2720 | 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 2e 20 20 57 65 20 6b 6e 6f 77 20 6e 6f 77 20 74 | .state.variables...We.know.now.t |
| c2740 | 68 61 74 20 77 65 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 0a 73 74 61 74 65 20 61 73 20 61 20 | hat.we.can.represent.state.as.a. |
| c2760 | 22 74 69 6d 65 6c 65 73 73 22 20 73 74 72 65 61 6d 20 6f 66 20 76 61 6c 75 65 73 20 72 61 74 68 | "timeless".stream.of.values.rath |
| c2780 | 65 72 20 74 68 61 6e 20 61 73 20 61 20 73 65 74 20 6f 66 0a 76 61 72 69 61 62 6c 65 73 20 74 6f | er.than.as.a.set.of.variables.to |
| c27a0 | 20 62 65 20 75 70 64 61 74 65 64 2e 20 20 4c 65 74 27 73 20 61 64 6f 70 74 20 74 68 69 73 20 70 | .be.updated...Let's.adopt.this.p |
| c27c0 | 65 72 73 70 65 63 74 69 76 65 20 69 6e 20 72 65 76 69 73 69 74 69 6e 67 0a 74 68 65 20 73 71 75 | erspective.in.revisiting.the.squ |
| c27e0 | 61 72 65 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 | are-root.procedure.from.section. |
| c2800 | 2a 4e 6f 74 65 20 31 2d 31 2d 37 3a 3a 2e 20 20 52 65 63 61 6c 6c 20 74 68 61 74 20 74 68 65 0a | *Note.1-1-7::...Recall.that.the. |
| c2820 | 69 64 65 61 20 69 73 20 74 6f 20 67 65 6e 65 72 61 74 65 20 61 20 73 65 71 75 65 6e 63 65 20 6f | idea.is.to.generate.a.sequence.o |
| c2840 | 66 20 62 65 74 74 65 72 20 61 6e 64 20 62 65 74 74 65 72 20 67 75 65 73 73 65 73 20 66 6f 72 20 | f.better.and.better.guesses.for. |
| c2860 | 74 68 65 0a 73 71 75 61 72 65 20 72 6f 6f 74 20 6f 66 20 78 20 62 79 20 61 70 70 6c 79 69 6e 67 | the.square.root.of.x.by.applying |
| c2880 | 20 6f 76 65 72 20 61 6e 64 20 6f 76 65 72 20 61 67 61 69 6e 20 74 68 65 20 70 72 6f 63 65 64 75 | .over.and.over.again.the.procedu |
| c28a0 | 72 65 20 74 68 61 74 0a 69 6d 70 72 6f 76 65 73 20 67 75 65 73 73 65 73 3a 0a 0a 20 20 20 20 20 | re.that.improves.guesses:....... |
| c28c0 | 28 64 65 66 69 6e 65 20 28 73 71 72 74 2d 69 6d 70 72 6f 76 65 20 67 75 65 73 73 20 78 29 0a 20 | (define.(sqrt-improve.guess.x).. |
| c28e0 | 20 20 20 20 20 20 28 61 76 65 72 61 67 65 20 67 75 65 73 73 20 28 2f 20 78 20 67 75 65 73 73 29 | ......(average.guess.(/.x.guess) |
| c2900 | 29 29 0a 0a 20 20 20 49 6e 20 6f 75 72 20 6f 72 69 67 69 6e 61 6c 20 60 73 71 72 74 27 20 70 72 | )).....In.our.original.`sqrt'.pr |
| c2920 | 6f 63 65 64 75 72 65 2c 20 77 65 20 6d 61 64 65 20 74 68 65 73 65 20 67 75 65 73 73 65 73 20 62 | ocedure,.we.made.these.guesses.b |
| c2940 | 65 20 74 68 65 0a 73 75 63 63 65 73 73 69 76 65 20 76 61 6c 75 65 73 20 6f 66 20 61 20 73 74 61 | e.the.successive.values.of.a.sta |
| c2960 | 74 65 20 76 61 72 69 61 62 6c 65 2e 20 49 6e 73 74 65 61 64 20 77 65 20 63 61 6e 20 67 65 6e 65 | te.variable..Instead.we.can.gene |
| c2980 | 72 61 74 65 20 74 68 65 0a 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 20 6f 66 20 67 75 65 73 | rate.the.infinite.stream.of.gues |
| c29a0 | 73 65 73 2c 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 61 6e 20 69 6e 69 74 69 61 6c 20 67 75 | ses,.starting.with.an.initial.gu |
| c29c0 | 65 73 73 20 6f 66 20 31 3a 28 31 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 | ess.of.1:(1).......(define.(sqrt |
| c29e0 | 2d 73 74 72 65 61 6d 20 78 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 67 75 65 73 73 65 | -stream.x)........(define.guesse |
| c2a00 | 73 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 2e 30 0a 20 20 20 20 | s..........(cons-stream.1.0..... |
| c2a20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 28 6c | ..................(stream-map.(l |
| c2a40 | 61 6d 62 64 61 20 28 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ambda.(guess)................... |
| c2a60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 6d 70 72 6f 76 65 20 | ..................(sqrt-improve. |
| c2a80 | 67 75 65 73 73 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | guess.x))....................... |
| c2aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 67 75 65 73 73 65 73 29 29 29 0a 20 20 20 20 20 20 20 67 75 | ............guesses)))........gu |
| c2ac0 | 65 73 73 65 73 29 0a 0a 20 20 20 20 20 28 64 69 73 70 6c 61 79 2d 73 74 72 65 61 6d 20 28 73 71 | esses).......(display-stream.(sq |
| c2ae0 | 72 74 2d 73 74 72 65 61 6d 20 32 29 29 0a 20 20 20 20 20 31 2e 0a 20 20 20 20 20 31 2e 35 0a 20 | rt-stream.2))......1.......1.5.. |
| c2b00 | 20 20 20 20 31 2e 34 31 36 36 36 36 36 36 36 36 36 36 36 36 36 35 0a 20 20 20 20 20 31 2e 34 31 | ....1.4166666666666665......1.41 |
| c2b20 | 34 32 31 35 36 38 36 32 37 34 35 30 39 37 0a 20 20 20 20 20 31 2e 34 31 34 32 31 33 35 36 32 33 | 42156862745097......1.4142135623 |
| c2b40 | 37 34 36 38 39 39 0a 20 20 20 20 20 2e 2e 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 67 65 6e 65 72 | 746899..............We.can.gener |
| c2b60 | 61 74 65 20 6d 6f 72 65 20 61 6e 64 20 6d 6f 72 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 73 | ate.more.and.more.terms.of.the.s |
| c2b80 | 74 72 65 61 6d 20 74 6f 20 67 65 74 20 62 65 74 74 65 72 20 61 6e 64 0a 62 65 74 74 65 72 20 67 | tream.to.get.better.and.better.g |
| c2ba0 | 75 65 73 73 65 73 2e 20 20 49 66 20 77 65 20 6c 69 6b 65 2c 20 77 65 20 63 61 6e 20 77 72 69 74 | uesses...If.we.like,.we.can.writ |
| c2bc0 | 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 6b 65 65 70 73 0a 67 65 6e 65 72 61 74 | e.a.procedure.that.keeps.generat |
| c2be0 | 69 6e 67 20 74 65 72 6d 73 20 75 6e 74 69 6c 20 74 68 65 20 61 6e 73 77 65 72 20 69 73 20 67 6f | ing.terms.until.the.answer.is.go |
| c2c00 | 6f 64 20 65 6e 6f 75 67 68 2e 20 20 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a | od.enough...(See.*Note.Exercise. |
| c2c20 | 33 2d 36 34 3a 3a 2e 29 0a 0a 20 20 20 41 6e 6f 74 68 65 72 20 69 74 65 72 61 74 69 6f 6e 20 74 | 3-64::.).....Another.iteration.t |
| c2c40 | 68 61 74 20 77 65 20 63 61 6e 20 74 72 65 61 74 20 69 6e 20 74 68 65 20 73 61 6d 65 20 77 61 79 | hat.we.can.treat.in.the.same.way |
| c2c60 | 20 69 73 20 74 6f 20 67 65 6e 65 72 61 74 65 20 61 6e 0a 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e | .is.to.generate.an.approximation |
| c2c80 | 20 74 6f 20 5b 70 69 5d 2c 20 62 61 73 65 64 20 75 70 6f 6e 20 74 68 65 20 61 6c 74 65 72 6e 61 | .to.[pi],.based.upon.the.alterna |
| c2ca0 | 74 69 6e 67 20 73 65 72 69 65 73 20 74 68 61 74 20 77 65 20 73 61 77 20 69 6e 0a 73 65 63 74 69 | ting.series.that.we.saw.in.secti |
| c2cc0 | 6f 6e 20 2a 4e 6f 74 65 20 31 2d 33 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 5b 70 69 5d 20 20 20 20 | on.*Note.1-3-1:::.......[pi].... |
| c2ce0 | 20 20 20 20 31 20 20 20 20 20 31 20 20 20 20 20 31 0a 20 20 20 20 20 2d 2d 2d 2d 20 3d 20 31 20 | ....1.....1.....1......----.=.1. |
| c2d00 | 2d 20 2d 2d 2d 20 2b 20 2d 2d 2d 20 2d 20 2d 2d 2d 20 2b 20 2e 2e 2e 0a 20 20 20 20 20 20 20 34 | -.---.+.---.-.---.+............4 |
| c2d20 | 20 20 20 20 20 20 20 20 20 33 20 20 20 20 20 35 20 20 20 20 20 37 0a 0a 20 20 20 57 65 20 66 69 | .........3.....5.....7.....We.fi |
| c2d40 | 72 73 74 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 73 75 6d 6d 61 | rst.generate.the.stream.of.summa |
| c2d60 | 6e 64 73 20 6f 66 20 74 68 65 20 73 65 72 69 65 73 20 28 74 68 65 0a 72 65 63 69 70 72 6f 63 61 | nds.of.the.series.(the.reciproca |
| c2d80 | 6c 73 20 6f 66 20 74 68 65 20 6f 64 64 20 69 6e 74 65 67 65 72 73 2c 20 77 69 74 68 20 61 6c 74 | ls.of.the.odd.integers,.with.alt |
| c2da0 | 65 72 6e 61 74 69 6e 67 20 73 69 67 6e 73 29 2e 20 20 54 68 65 6e 20 77 65 20 74 61 6b 65 0a 74 | ernating.signs)...Then.we.take.t |
| c2dc0 | 68 65 20 73 74 72 65 61 6d 20 6f 66 20 73 75 6d 73 20 6f 66 20 6d 6f 72 65 20 61 6e 64 20 6d 6f | he.stream.of.sums.of.more.and.mo |
| c2de0 | 72 65 20 74 65 72 6d 73 20 28 75 73 69 6e 67 20 74 68 65 20 60 70 61 72 74 69 61 6c 2d 73 75 6d | re.terms.(using.the.`partial-sum |
| c2e00 | 73 27 0a 70 72 6f 63 65 64 75 72 65 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 | s'.procedure.of.*Note.Exercise.3 |
| c2e20 | 2d 35 35 3a 3a 29 20 61 6e 64 20 73 63 61 6c 65 20 74 68 65 20 72 65 73 75 6c 74 20 62 79 20 34 | -55::).and.scale.the.result.by.4 |
| c2e40 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 69 2d 73 75 6d 6d 61 6e 64 73 20 6e 29 0a | :.......(define.(pi-summands.n). |
| c2e60 | 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 28 2f 20 31 2e 30 20 6e 29 0a 20 20 | .......(cons-stream.(/.1.0.n)... |
| c2e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 2d 20 | ..................(stream-map.-. |
| c2ea0 | 28 70 69 2d 73 75 6d 6d 61 6e 64 73 20 28 2b 20 6e 20 32 29 29 29 29 29 0a 0a 20 20 20 20 20 28 | (pi-summands.(+.n.2))))).......( |
| c2ec0 | 64 65 66 69 6e 65 20 70 69 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 28 73 63 61 6c 65 2d 73 | define.pi-stream........(scale-s |
| c2ee0 | 74 72 65 61 6d 20 28 70 61 72 74 69 61 6c 2d 73 75 6d 73 20 28 70 69 2d 73 75 6d 6d 61 6e 64 73 | tream.(partial-sums.(pi-summands |
| c2f00 | 20 31 29 29 20 34 29 29 0a 0a 20 20 20 20 20 28 64 69 73 70 6c 61 79 2d 73 74 72 65 61 6d 20 70 | .1)).4)).......(display-stream.p |
| c2f20 | 69 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 34 2e 0a 20 20 20 20 20 32 2e 36 36 36 36 36 36 36 | i-stream)......4.......2.6666666 |
| c2f40 | 36 36 36 36 36 36 36 37 0a 20 20 20 20 20 33 2e 34 36 36 36 36 36 36 36 36 36 36 36 36 36 37 0a | 66666667......3.466666666666667. |
| c2f60 | 20 20 20 20 20 32 2e 38 39 35 32 33 38 30 39 35 32 33 38 30 39 35 36 0a 20 20 20 20 20 33 2e 33 | .....2.8952380952380956......3.3 |
| c2f80 | 33 39 36 38 32 35 33 39 36 38 32 35 34 30 33 0a 20 20 20 20 20 32 2e 39 37 36 30 34 36 31 37 36 | 396825396825403......2.976046176 |
| c2fa0 | 30 34 36 31 37 36 35 0a 20 20 20 20 20 33 2e 32 38 33 37 33 38 34 38 33 37 33 38 34 38 34 34 0a | 0461765......3.2837384837384844. |
| c2fc0 | 20 20 20 20 20 33 2e 30 31 37 30 37 31 38 31 37 30 37 31 38 31 38 0a 20 20 20 20 20 2e 2e 2e 0a | .....3.017071817071818.......... |
| c2fe0 | 0a 20 20 20 54 68 69 73 20 67 69 76 65 73 20 75 73 20 61 20 73 74 72 65 61 6d 20 6f 66 20 62 65 | ....This.gives.us.a.stream.of.be |
| c3000 | 74 74 65 72 20 61 6e 64 20 62 65 74 74 65 72 20 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 74 | tter.and.better.approximations.t |
| c3020 | 6f 20 5b 70 69 5d 2c 0a 61 6c 74 68 6f 75 67 68 20 74 68 65 20 61 70 70 72 6f 78 69 6d 61 74 69 | o.[pi],.although.the.approximati |
| c3040 | 6f 6e 73 20 63 6f 6e 76 65 72 67 65 20 72 61 74 68 65 72 20 73 6c 6f 77 6c 79 2e 20 20 45 69 67 | ons.converge.rather.slowly...Eig |
| c3060 | 68 74 20 74 65 72 6d 73 20 6f 66 20 74 68 65 0a 73 65 71 75 65 6e 63 65 20 62 6f 75 6e 64 20 74 | ht.terms.of.the.sequence.bound.t |
| c3080 | 68 65 20 76 61 6c 75 65 20 6f 66 20 5b 70 69 5d 20 62 65 74 77 65 65 6e 20 33 2e 32 38 34 20 61 | he.value.of.[pi].between.3.284.a |
| c30a0 | 6e 64 20 33 2e 30 31 37 2e 0a 0a 20 20 20 53 6f 20 66 61 72 2c 20 6f 75 72 20 75 73 65 20 6f 66 | nd.3.017......So.far,.our.use.of |
| c30c0 | 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 73 74 61 74 65 73 20 61 70 70 72 6f 61 63 68 20 69 | .the.stream.of.states.approach.i |
| c30e0 | 73 20 6e 6f 74 20 6d 75 63 68 0a 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d 20 75 70 64 61 74 69 | s.not.much.different.from.updati |
| c3100 | 6e 67 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 2e 20 20 42 75 74 20 73 74 72 65 61 6d 73 | ng.state.variables...But.streams |
| c3120 | 20 67 69 76 65 20 75 73 20 61 6e 0a 6f 70 70 6f 72 74 75 6e 69 74 79 20 74 6f 20 64 6f 20 73 6f | .give.us.an.opportunity.to.do.so |
| c3140 | 6d 65 20 69 6e 74 65 72 65 73 74 69 6e 67 20 74 72 69 63 6b 73 2e 20 20 46 6f 72 20 65 78 61 6d | me.interesting.tricks...For.exam |
| c3160 | 70 6c 65 2c 20 77 65 20 63 61 6e 0a 74 72 61 6e 73 66 6f 72 6d 20 61 20 73 74 72 65 61 6d 20 77 | ple,.we.can.transform.a.stream.w |
| c3180 | 69 74 68 20 61 20 22 73 65 71 75 65 6e 63 65 20 61 63 63 65 6c 65 72 61 74 6f 72 22 20 74 68 61 | ith.a."sequence.accelerator".tha |
| c31a0 | 74 20 63 6f 6e 76 65 72 74 73 20 61 0a 73 65 71 75 65 6e 63 65 20 6f 66 20 61 70 70 72 6f 78 69 | t.converts.a.sequence.of.approxi |
| c31c0 | 6d 61 74 69 6f 6e 73 20 74 6f 20 61 20 6e 65 77 20 73 65 71 75 65 6e 63 65 20 74 68 61 74 20 63 | mations.to.a.new.sequence.that.c |
| c31e0 | 6f 6e 76 65 72 67 65 73 20 74 6f 20 74 68 65 20 73 61 6d 65 0a 76 61 6c 75 65 20 61 73 20 74 68 | onverges.to.the.same.value.as.th |
| c3200 | 65 20 6f 72 69 67 69 6e 61 6c 2c 20 6f 6e 6c 79 20 66 61 73 74 65 72 2e 0a 0a 20 20 20 4f 6e 65 | e.original,.only.faster......One |
| c3220 | 20 73 75 63 68 20 61 63 63 65 6c 65 72 61 74 6f 72 2c 20 64 75 65 20 74 6f 20 74 68 65 20 65 69 | .such.accelerator,.due.to.the.ei |
| c3240 | 67 68 74 65 65 6e 74 68 2d 63 65 6e 74 75 72 79 20 53 77 69 73 73 0a 6d 61 74 68 65 6d 61 74 69 | ghteenth-century.Swiss.mathemati |
| c3260 | 63 69 61 6e 20 4c 65 6f 6e 68 61 72 64 20 45 75 6c 65 72 2c 20 77 6f 72 6b 73 20 77 65 6c 6c 20 | cian.Leonhard.Euler,.works.well. |
| c3280 | 77 69 74 68 20 73 65 71 75 65 6e 63 65 73 20 74 68 61 74 20 61 72 65 0a 70 61 72 74 69 61 6c 20 | with.sequences.that.are.partial. |
| c32a0 | 73 75 6d 73 20 6f 66 20 61 6c 74 65 72 6e 61 74 69 6e 67 20 73 65 72 69 65 73 20 28 73 65 72 69 | sums.of.alternating.series.(seri |
| c32c0 | 65 73 20 6f 66 20 74 65 72 6d 73 20 77 69 74 68 20 61 6c 74 65 72 6e 61 74 69 6e 67 0a 73 69 67 | es.of.terms.with.alternating.sig |
| c32e0 | 6e 73 29 2e 20 20 49 6e 20 45 75 6c 65 72 27 73 20 74 65 63 68 6e 69 71 75 65 2c 20 69 66 20 53 | ns)...In.Euler's.technique,.if.S |
| c3300 | 5f 6e 20 69 73 20 74 68 65 20 6e 74 68 20 74 65 72 6d 20 6f 66 20 74 68 65 20 6f 72 69 67 69 6e | _n.is.the.nth.term.of.the.origin |
| c3320 | 61 6c 0a 73 75 6d 20 73 65 71 75 65 6e 63 65 2c 20 74 68 65 6e 20 74 68 65 20 61 63 63 65 6c 65 | al.sum.sequence,.then.the.accele |
| c3340 | 72 61 74 65 64 20 73 65 71 75 65 6e 63 65 20 68 61 73 20 74 65 72 6d 73 0a 0a 20 20 20 20 20 20 | rated.sequence.has.terms........ |
| c3360 | 20 20 20 20 20 20 20 20 20 20 20 20 28 53 5f 28 6e 2b 31 29 20 2d 20 53 5f 6e 29 5e 32 0a 20 20 | ............(S_(n+1).-.S_n)^2... |
| c3380 | 20 20 20 53 5f 28 6e 2b 31 29 20 2d 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ...S_(n+1).-.------------------- |
| c33a0 | 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 53 5f 28 6e 2d 31 29 20 2d 20 32 | -----................S_(n-1).-.2 |
| c33c0 | 53 5f 6e 20 2b 20 53 5f 28 6e 2b 31 29 0a 0a 20 20 20 54 68 75 73 2c 20 69 66 20 74 68 65 20 6f | S_n.+.S_(n+1).....Thus,.if.the.o |
| c33e0 | 72 69 67 69 6e 61 6c 20 73 65 71 75 65 6e 63 65 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 | riginal.sequence.is.represented. |
| c3400 | 61 73 20 61 20 73 74 72 65 61 6d 20 6f 66 20 76 61 6c 75 65 73 2c 0a 74 68 65 20 74 72 61 6e 73 | as.a.stream.of.values,.the.trans |
| c3420 | 66 6f 72 6d 65 64 20 73 65 71 75 65 6e 63 65 20 69 73 20 67 69 76 65 6e 20 62 79 0a 0a 20 20 20 | formed.sequence.is.given.by..... |
| c3440 | 20 20 28 64 65 66 69 6e 65 20 28 65 75 6c 65 72 2d 74 72 61 6e 73 66 6f 72 6d 20 73 29 0a 20 20 | ..(define.(euler-transform.s)... |
| c3460 | 20 20 20 20 20 28 6c 65 74 20 28 28 73 30 20 28 73 74 72 65 61 6d 2d 72 65 66 20 73 20 30 29 29 | .....(let.((s0.(stream-ref.s.0)) |
| c3480 | 20 20 20 20 20 20 20 20 20 20 20 3b 20 53 5f 28 6e 2d 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ...........;.S_(n-1)............ |
| c34a0 | 20 20 28 73 31 20 28 73 74 72 65 61 6d 2d 72 65 66 20 73 20 31 29 29 20 20 20 20 20 20 20 20 20 | ..(s1.(stream-ref.s.1))......... |
| c34c0 | 20 20 3b 20 53 5f 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 32 20 28 73 74 72 65 61 6d | ..;.S_n..............(s2.(stream |
| c34e0 | 2d 72 65 66 20 73 20 32 29 29 29 20 20 20 20 20 20 20 20 20 20 3b 20 53 5f 28 6e 2b 31 29 0a 20 | -ref.s.2)))..........;.S_(n+1).. |
| c3500 | 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 28 2d 20 73 32 20 28 2f 20 28 73 | ........(cons-stream.(-.s2.(/.(s |
| c3520 | 71 75 61 72 65 20 28 2d 20 73 32 20 73 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | quare.(-.s2.s1))................ |
| c3540 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 73 30 20 28 2a 20 2d 32 20 73 31 29 20 | ................(+.s0.(*.-2.s1). |
| c3560 | 73 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 75 6c | s2))).......................(eul |
| c3580 | 65 72 2d 74 72 61 6e 73 66 6f 72 6d 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 29 29 29 29 29 0a | er-transform.(stream-cdr.s))))). |
| c35a0 | 0a 20 20 20 57 65 20 63 61 6e 20 64 65 6d 6f 6e 73 74 72 61 74 65 20 45 75 6c 65 72 20 61 63 63 | ....We.can.demonstrate.Euler.acc |
| c35c0 | 65 6c 65 72 61 74 69 6f 6e 20 77 69 74 68 20 6f 75 72 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 61 | eleration.with.our.sequence.of.a |
| c35e0 | 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 74 6f 20 5b 70 69 5d 3a 0a 0a 20 20 20 20 20 28 64 69 | pproximations.to.[pi]:.......(di |
| c3600 | 73 70 6c 61 79 2d 73 74 72 65 61 6d 20 28 65 75 6c 65 72 2d 74 72 61 6e 73 66 6f 72 6d 20 70 69 | splay-stream.(euler-transform.pi |
| c3620 | 2d 73 74 72 65 61 6d 29 29 0a 20 20 20 20 20 33 2e 31 36 36 36 36 36 36 36 36 36 36 36 36 36 37 | -stream))......3.166666666666667 |
| c3640 | 0a 20 20 20 20 20 33 2e 31 33 33 33 33 33 33 33 33 33 33 33 33 33 33 37 0a 20 20 20 20 20 33 2e | ......3.1333333333333337......3. |
| c3660 | 31 34 35 32 33 38 30 39 35 32 33 38 30 39 35 36 0a 20 20 20 20 20 33 2e 31 33 39 36 38 32 35 33 | 1452380952380956......3.13968253 |
| c3680 | 39 36 38 32 35 34 0a 20 20 20 20 20 33 2e 31 34 32 37 31 32 38 34 32 37 31 32 38 34 33 35 0a 20 | 968254......3.1427128427128435.. |
| c36a0 | 20 20 20 20 33 2e 31 34 30 38 38 31 33 34 30 38 38 31 33 34 31 36 0a 20 20 20 20 20 33 2e 31 34 | ....3.1408813408813416......3.14 |
| c36c0 | 32 30 37 31 38 31 37 30 37 31 38 31 38 0a 20 20 20 20 20 33 2e 31 34 31 32 35 34 38 32 33 36 30 | 2071817071818......3.14125482360 |
| c36e0 | 37 37 36 35 35 0a 20 20 20 20 20 2e 2e 2e 0a 0a 20 20 20 45 76 65 6e 20 62 65 74 74 65 72 2c 20 | 77655..............Even.better,. |
| c3700 | 77 65 20 63 61 6e 20 61 63 63 65 6c 65 72 61 74 65 20 74 68 65 20 61 63 63 65 6c 65 72 61 74 65 | we.can.accelerate.the.accelerate |
| c3720 | 64 20 73 65 71 75 65 6e 63 65 2c 20 61 6e 64 0a 72 65 63 75 72 73 69 76 65 6c 79 20 61 63 63 65 | d.sequence,.and.recursively.acce |
| c3740 | 6c 65 72 61 74 65 20 74 68 61 74 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 20 4e 61 6d 65 6c 79 2c | lerate.that,.and.so.on...Namely, |
| c3760 | 20 77 65 20 63 72 65 61 74 65 20 61 20 73 74 72 65 61 6d 20 6f 66 0a 73 74 72 65 61 6d 73 20 28 | .we.create.a.stream.of.streams.( |
| c3780 | 61 20 73 74 72 75 63 74 75 72 65 20 77 65 27 6c 6c 20 63 61 6c 6c 20 61 20 22 74 61 62 6c 65 61 | a.structure.we'll.call.a."tablea |
| c37a0 | 75 22 29 20 69 6e 20 77 68 69 63 68 20 65 61 63 68 20 73 74 72 65 61 6d 20 69 73 0a 74 68 65 20 | u").in.which.each.stream.is.the. |
| c37c0 | 74 72 61 6e 73 66 6f 72 6d 20 6f 66 20 74 68 65 20 70 72 65 63 65 64 69 6e 67 20 6f 6e 65 3a 0a | transform.of.the.preceding.one:. |
| c37e0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 74 61 62 6c 65 61 75 20 74 72 61 6e | ......(define.(make-tableau.tran |
| c3800 | 73 66 6f 72 6d 20 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 73 0a 20 | sform.s)........(cons-stream.s.. |
| c3820 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 74 61 62 6c 65 61 75 | ...................(make-tableau |
| c3840 | 20 74 72 61 6e 73 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .transform...................... |
| c3860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 72 61 6e 73 66 6f 72 6d 20 73 29 29 29 29 0a 0a 20 | .............(transform.s))))... |
| c3880 | 20 20 54 68 65 20 74 61 62 6c 65 61 75 20 68 61 73 20 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 | ..The.tableau.has.the.form...... |
| c38a0 | 20 73 5f 30 30 20 20 20 73 5f 30 31 20 20 20 73 5f 30 32 20 20 20 73 5f 30 33 20 20 20 73 5f 30 | .s_00...s_01...s_02...s_03...s_0 |
| c38c0 | 34 20 20 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 5f 31 30 20 20 20 73 5f 31 31 20 | 4...................s_10...s_11. |
| c38e0 | 20 20 73 5f 31 32 20 20 20 73 5f 31 33 20 20 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..s_12...s_13................... |
| c3900 | 20 20 20 20 20 20 20 73 5f 32 30 20 20 20 73 5f 32 31 20 20 20 73 5f 32 32 20 20 20 2e 2e 2e 0a | .......s_20...s_21...s_22....... |
| c3920 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c3940 | 20 2e 2e 2e 0a 0a 20 20 20 46 69 6e 61 6c 6c 79 2c 20 77 65 20 66 6f 72 6d 20 61 20 73 65 71 75 | .........Finally,.we.form.a.sequ |
| c3960 | 65 6e 63 65 20 62 79 20 74 61 6b 69 6e 67 20 74 68 65 20 66 69 72 73 74 20 74 65 72 6d 20 69 6e | ence.by.taking.the.first.term.in |
| c3980 | 20 65 61 63 68 20 72 6f 77 20 6f 66 0a 74 68 65 20 74 61 62 6c 65 61 75 3a 0a 0a 20 20 20 20 20 | .each.row.of.the.tableau:....... |
| c39a0 | 28 64 65 66 69 6e 65 20 28 61 63 63 65 6c 65 72 61 74 65 64 2d 73 65 71 75 65 6e 63 65 20 74 72 | (define.(accelerated-sequence.tr |
| c39c0 | 61 6e 73 66 6f 72 6d 20 73 29 0a 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 73 74 | ansform.s)........(stream-map.st |
| c39e0 | 72 65 61 6d 2d 63 61 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b | ream-car....................(mak |
| c3a00 | 65 2d 74 61 62 6c 65 61 75 20 74 72 61 6e 73 66 6f 72 6d 20 73 29 29 29 0a 0a 20 20 20 57 65 20 | e-tableau.transform.s))).....We. |
| c3a20 | 63 61 6e 20 64 65 6d 6f 6e 73 74 72 61 74 65 20 74 68 69 73 20 6b 69 6e 64 20 6f 66 20 22 73 75 | can.demonstrate.this.kind.of."su |
| c3a40 | 70 65 72 2d 61 63 63 65 6c 65 72 61 74 69 6f 6e 22 20 6f 66 20 74 68 65 20 5b 70 69 5d 0a 73 65 | per-acceleration".of.the.[pi].se |
| c3a60 | 71 75 65 6e 63 65 3a 0a 0a 20 20 20 20 20 28 64 69 73 70 6c 61 79 2d 73 74 72 65 61 6d 20 28 61 | quence:.......(display-stream.(a |
| c3a80 | 63 63 65 6c 65 72 61 74 65 64 2d 73 65 71 75 65 6e 63 65 20 65 75 6c 65 72 2d 74 72 61 6e 73 66 | ccelerated-sequence.euler-transf |
| c3aa0 | 6f 72 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | orm............................. |
| c3ac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 69 2d 73 74 72 65 61 6d 29 29 0a 20 20 20 20 20 | ...............pi-stream))...... |
| c3ae0 | 34 2e 0a 20 20 20 20 20 33 2e 31 36 36 36 36 36 36 36 36 36 36 36 36 36 37 0a 20 20 20 20 20 33 | 4.......3.166666666666667......3 |
| c3b00 | 2e 31 34 32 31 30 35 32 36 33 31 35 37 38 39 35 0a 20 20 20 20 20 33 2e 31 34 31 35 39 39 33 35 | .142105263157895......3.14159935 |
| c3b20 | 37 33 31 39 30 30 35 0a 20 20 20 20 20 33 2e 31 34 31 35 39 32 37 31 34 30 33 33 37 37 38 35 0a | 7319005......3.1415927140337785. |
| c3b40 | 20 20 20 20 20 33 2e 31 34 31 35 39 32 36 35 33 39 37 35 32 39 32 37 0a 20 20 20 20 20 33 2e 31 | .....3.1415926539752927......3.1 |
| c3b60 | 34 31 35 39 32 36 35 33 35 39 31 31 37 36 35 0a 20 20 20 20 20 33 2e 31 34 31 35 39 32 36 35 33 | 415926535911765......3.141592653 |
| c3b80 | 35 38 39 37 37 38 0a 20 20 20 20 20 2e 2e 2e 0a 0a 20 20 20 54 68 65 20 72 65 73 75 6c 74 20 69 | 589778..............The.result.i |
| c3ba0 | 73 20 69 6d 70 72 65 73 73 69 76 65 2e 20 20 54 61 6b 69 6e 67 20 65 69 67 68 74 20 74 65 72 6d | s.impressive...Taking.eight.term |
| c3bc0 | 73 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 79 69 65 6c 64 73 0a 74 68 65 20 63 6f 72 | s.of.the.sequence.yields.the.cor |
| c3be0 | 72 65 63 74 20 76 61 6c 75 65 20 6f 66 20 5b 70 69 5d 20 74 6f 20 31 34 20 64 65 63 69 6d 61 6c | rect.value.of.[pi].to.14.decimal |
| c3c00 | 20 70 6c 61 63 65 73 2e 20 20 49 66 20 77 65 20 68 61 64 20 75 73 65 64 20 6f 6e 6c 79 20 74 68 | .places...If.we.had.used.only.th |
| c3c20 | 65 0a 6f 72 69 67 69 6e 61 6c 20 5b 70 69 5d 20 73 65 71 75 65 6e 63 65 2c 20 77 65 20 77 6f 75 | e.original.[pi].sequence,.we.wou |
| c3c40 | 6c 64 20 6e 65 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 6f 6e 20 74 68 65 20 6f 72 64 65 72 20 | ld.need.to.compute.on.the.order. |
| c3c60 | 6f 66 20 31 30 5e 31 33 0a 74 65 72 6d 73 20 28 69 2e 65 2e 2c 20 65 78 70 61 6e 64 69 6e 67 20 | of.10^13.terms.(i.e.,.expanding. |
| c3c80 | 74 68 65 20 73 65 72 69 65 73 20 66 61 72 20 65 6e 6f 75 67 68 20 73 6f 20 74 68 61 74 20 74 68 | the.series.far.enough.so.that.th |
| c3ca0 | 65 20 69 6e 64 69 76 69 64 75 61 6c 0a 74 65 72 6d 73 20 61 72 65 20 6c 65 73 73 20 74 68 65 6e | e.individual.terms.are.less.then |
| c3cc0 | 20 31 30 5e 28 2d 31 33 29 29 20 74 6f 20 67 65 74 20 74 68 61 74 20 6d 75 63 68 20 61 63 63 75 | .10^(-13)).to.get.that.much.accu |
| c3ce0 | 72 61 63 79 21 0a 0a 20 20 20 57 65 20 63 6f 75 6c 64 20 68 61 76 65 20 69 6d 70 6c 65 6d 65 6e | racy!.....We.could.have.implemen |
| c3d00 | 74 65 64 20 74 68 65 73 65 20 61 63 63 65 6c 65 72 61 74 69 6f 6e 20 74 65 63 68 6e 69 71 75 65 | ted.these.acceleration.technique |
| c3d20 | 73 20 77 69 74 68 6f 75 74 0a 75 73 69 6e 67 20 73 74 72 65 61 6d 73 2e 20 20 42 75 74 20 74 68 | s.without.using.streams...But.th |
| c3d40 | 65 20 73 74 72 65 61 6d 20 66 6f 72 6d 75 6c 61 74 69 6f 6e 20 69 73 20 70 61 72 74 69 63 75 6c | e.stream.formulation.is.particul |
| c3d60 | 61 72 6c 79 20 65 6c 65 67 61 6e 74 20 61 6e 64 0a 63 6f 6e 76 65 6e 69 65 6e 74 20 62 65 63 61 | arly.elegant.and.convenient.beca |
| c3d80 | 75 73 65 20 74 68 65 20 65 6e 74 69 72 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 73 74 61 74 65 | use.the.entire.sequence.of.state |
| c3da0 | 73 20 69 73 20 61 76 61 69 6c 61 62 6c 65 20 74 6f 20 75 73 20 61 73 0a 61 20 64 61 74 61 20 73 | s.is.available.to.us.as.a.data.s |
| c3dc0 | 74 72 75 63 74 75 72 65 20 74 68 61 74 20 63 61 6e 20 62 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 | tructure.that.can.be.manipulated |
| c3de0 | 20 77 69 74 68 20 61 20 75 6e 69 66 6f 72 6d 20 73 65 74 20 6f 66 0a 6f 70 65 72 61 74 69 6f 6e | .with.a.uniform.set.of.operation |
| c3e00 | 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 36 33 3a 2a 20 4c 6f 75 69 73 20 | s........*Exercise.3.63:*.Louis. |
| c3e20 | 52 65 61 73 6f 6e 65 72 20 61 73 6b 73 20 77 68 79 20 74 68 65 20 60 73 71 72 74 2d 73 74 72 65 | Reasoner.asks.why.the.`sqrt-stre |
| c3e40 | 61 6d 27 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 77 61 73 20 6e 6f 74 20 77 72 69 74 74 | am'......procedure.was.not.writt |
| c3e60 | 65 6e 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d 6f 72 65 20 73 74 72 61 69 67 68 | en.in.the.following.more.straigh |
| c3e80 | 74 66 6f 72 77 61 72 64 0a 20 20 20 20 20 77 61 79 2c 20 77 69 74 68 6f 75 74 20 74 68 65 20 6c | tforward......way,.without.the.l |
| c3ea0 | 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 20 60 67 75 65 73 73 65 73 27 3a 0a 0a 20 20 20 20 20 20 | ocal.variable.`guesses':........ |
| c3ec0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 2d 73 74 72 65 61 6d 20 78 29 0a 20 20 20 20 | ....(define.(sqrt-stream.x)..... |
| c3ee0 | 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 2e 30 0a 20 20 20 20 20 20 20 | ........(cons-stream.1.0........ |
| c3f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 28 6c | ..................(stream-map.(l |
| c3f20 | 61 6d 62 64 61 20 28 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ambda.(guess)................... |
| c3f40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 6d 70 72 6f | .....................(sqrt-impro |
| c3f60 | 76 65 20 67 75 65 73 73 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ve.guess.x)).................... |
| c3f80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 73 74 72 65 61 6d 20 78 | ..................(sqrt-stream.x |
| c3fa0 | 29 29 29 29 0a 0a 20 20 20 20 20 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 20 72 65 70 6c | )))).......Alyssa.P..Hacker.repl |
| c3fc0 | 69 65 73 20 74 68 61 74 20 74 68 69 73 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 70 72 6f | ies.that.this.version.of.the.pro |
| c3fe0 | 63 65 64 75 72 65 20 69 73 0a 20 20 20 20 20 63 6f 6e 73 69 64 65 72 61 62 6c 79 20 6c 65 73 73 | cedure.is......considerably.less |
| c4000 | 20 65 66 66 69 63 69 65 6e 74 20 62 65 63 61 75 73 65 20 69 74 20 70 65 72 66 6f 72 6d 73 20 72 | .efficient.because.it.performs.r |
| c4020 | 65 64 75 6e 64 61 6e 74 0a 20 20 20 20 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 45 78 70 6c | edundant......computation...Expl |
| c4040 | 61 69 6e 20 41 6c 79 73 73 61 27 73 20 61 6e 73 77 65 72 2e 20 20 57 6f 75 6c 64 20 74 68 65 20 | ain.Alyssa's.answer...Would.the. |
| c4060 | 74 77 6f 20 76 65 72 73 69 6f 6e 73 0a 20 20 20 20 20 73 74 69 6c 6c 20 64 69 66 66 65 72 20 69 | two.versions......still.differ.i |
| c4080 | 6e 20 65 66 66 69 63 69 65 6e 63 79 20 69 66 20 6f 75 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 | n.efficiency.if.our.implementati |
| c40a0 | 6f 6e 20 6f 66 20 60 64 65 6c 61 79 27 20 75 73 65 64 0a 20 20 20 20 20 6f 6e 6c 79 20 60 28 6c | on.of.`delay'.used......only.`(l |
| c40c0 | 61 6d 62 64 61 20 28 29 20 3c 45 58 50 3e 29 27 20 77 69 74 68 6f 75 74 20 75 73 69 6e 67 20 74 | ambda.().<EXP>)'.without.using.t |
| c40e0 | 68 65 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 70 72 6f 76 69 64 65 64 0a 20 20 20 20 20 62 79 | he.optimization.provided......by |
| c4100 | 20 60 6d 65 6d 6f 2d 70 72 6f 63 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d | .`memo-proc'.(section.*Note.3-5- |
| c4120 | 31 3a 3a 29 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 36 34 3a 2a 20 57 72 69 | 1::)?.......*Exercise.3.64:*.Wri |
| c4140 | 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 73 74 72 65 61 6d 2d 6c 69 6d 69 74 27 20 74 68 | te.a.procedure.`stream-limit'.th |
| c4160 | 61 74 20 74 61 6b 65 73 20 61 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 20 61 20 73 74 72 | at.takes.as......arguments.a.str |
| c4180 | 65 61 6d 20 61 6e 64 20 61 20 6e 75 6d 62 65 72 20 28 74 68 65 20 74 6f 6c 65 72 61 6e 63 65 29 | eam.and.a.number.(the.tolerance) |
| c41a0 | 2e 20 20 49 74 20 73 68 6f 75 6c 64 0a 20 20 20 20 20 65 78 61 6d 69 6e 65 20 74 68 65 20 73 74 | ...It.should......examine.the.st |
| c41c0 | 72 65 61 6d 20 75 6e 74 69 6c 20 69 74 20 66 69 6e 64 73 20 74 77 6f 20 73 75 63 63 65 73 73 69 | ream.until.it.finds.two.successi |
| c41e0 | 76 65 20 65 6c 65 6d 65 6e 74 73 20 74 68 61 74 0a 20 20 20 20 20 64 69 66 66 65 72 20 69 6e 20 | ve.elements.that......differ.in. |
| c4200 | 61 62 73 6f 6c 75 74 65 20 76 61 6c 75 65 20 62 79 20 6c 65 73 73 20 74 68 61 6e 20 74 68 65 20 | absolute.value.by.less.than.the. |
| c4220 | 74 6f 6c 65 72 61 6e 63 65 2c 20 61 6e 64 20 72 65 74 75 72 6e 0a 20 20 20 20 20 74 68 65 20 73 | tolerance,.and.return......the.s |
| c4240 | 65 63 6f 6e 64 20 6f 66 20 74 68 65 20 74 77 6f 20 65 6c 65 6d 65 6e 74 73 2e 20 20 55 73 69 6e | econd.of.the.two.elements...Usin |
| c4260 | 67 20 74 68 69 73 2c 20 77 65 20 63 6f 75 6c 64 20 63 6f 6d 70 75 74 65 0a 20 20 20 20 20 73 71 | g.this,.we.could.compute......sq |
| c4280 | 75 61 72 65 20 72 6f 6f 74 73 20 75 70 20 74 6f 20 61 20 67 69 76 65 6e 20 74 6f 6c 65 72 61 6e | uare.roots.up.to.a.given.toleran |
| c42a0 | 63 65 20 62 79 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 20 78 | ce.by............(define.(sqrt.x |
| c42c0 | 20 74 6f 6c 65 72 61 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d | .tolerance).............(stream- |
| c42e0 | 6c 69 6d 69 74 20 28 73 71 72 74 2d 73 74 72 65 61 6d 20 78 29 20 74 6f 6c 65 72 61 6e 63 65 29 | limit.(sqrt-stream.x).tolerance) |
| c4300 | 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 36 35 3a 2a 20 55 73 65 20 74 68 65 | ).......*Exercise.3.65:*.Use.the |
| c4320 | 20 73 65 72 69 65 73 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 | .series........................1 |
| c4340 | 20 20 20 20 20 31 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 6c 6e 20 32 20 3d 20 31 20 | .....1.....1...........ln.2.=.1. |
| c4360 | 2d 20 2d 2d 2d 20 2b 20 2d 2d 2d 20 2d 20 2d 2d 2d 20 2b 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 | -.---.+.---.-.---.+............. |
| c4380 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 20 20 20 20 20 33 20 20 20 20 20 34 0a 0a 20 20 20 | ..............2.....3.....4..... |
| c43a0 | 20 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 72 65 65 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 | ..to.compute.three.sequences.of. |
| c43c0 | 61 70 70 72 6f 78 69 6d 61 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 6e 61 74 75 72 61 6c 0a 20 20 | approximations.to.the.natural... |
| c43e0 | 20 20 20 6c 6f 67 61 72 69 74 68 6d 20 6f 66 20 32 2c 20 69 6e 20 74 68 65 20 73 61 6d 65 20 77 | ...logarithm.of.2,.in.the.same.w |
| c4400 | 61 79 20 77 65 20 64 69 64 20 61 62 6f 76 65 20 66 6f 72 20 5b 70 69 5d 2e 20 20 48 6f 77 0a 20 | ay.we.did.above.for.[pi]...How.. |
| c4420 | 20 20 20 20 72 61 70 69 64 6c 79 20 64 6f 20 74 68 65 73 65 20 73 65 71 75 65 6e 63 65 73 20 63 | ....rapidly.do.these.sequences.c |
| c4440 | 6f 6e 76 65 72 67 65 3f 0a 0a 49 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 73 20 6f 66 20 70 61 | onverge?..Infinite.streams.of.pa |
| c4460 | 69 72 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 | irs............................I |
| c4480 | 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 2c 20 77 65 20 73 61 77 20 | n.section.*Note.2-2-3::,.we.saw. |
| c44a0 | 68 6f 77 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 70 61 72 61 64 69 67 6d 20 68 61 6e 64 6c 65 | how.the.sequence.paradigm.handle |
| c44c0 | 73 0a 74 72 61 64 69 74 69 6f 6e 61 6c 20 6e 65 73 74 65 64 20 6c 6f 6f 70 73 20 61 73 20 70 72 | s.traditional.nested.loops.as.pr |
| c44e0 | 6f 63 65 73 73 65 73 20 64 65 66 69 6e 65 64 20 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 | ocesses.defined.on.sequences.of. |
| c4500 | 70 61 69 72 73 2e 0a 49 66 20 77 65 20 67 65 6e 65 72 61 6c 69 7a 65 20 74 68 69 73 20 74 65 63 | pairs..If.we.generalize.this.tec |
| c4520 | 68 6e 69 71 75 65 20 74 6f 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 73 2c 20 74 68 65 6e | hnique.to.infinite.streams,.then |
| c4540 | 20 77 65 20 63 61 6e 20 77 72 69 74 65 0a 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 61 72 65 20 | .we.can.write.programs.that.are. |
| c4560 | 6e 6f 74 20 65 61 73 69 6c 79 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 6c 6f 6f 70 73 2c | not.easily.represented.as.loops, |
| c4580 | 20 62 65 63 61 75 73 65 20 74 68 65 0a 22 6c 6f 6f 70 69 6e 67 22 20 6d 75 73 74 20 72 61 6e 67 | .because.the."looping".must.rang |
| c45a0 | 65 20 6f 76 65 72 20 61 6e 20 69 6e 66 69 6e 69 74 65 20 73 65 74 2e 0a 0a 20 20 20 46 6f 72 20 | e.over.an.infinite.set......For. |
| c45c0 | 65 78 61 6d 70 6c 65 2c 20 73 75 70 70 6f 73 65 20 77 65 20 77 61 6e 74 20 74 6f 20 67 65 6e 65 | example,.suppose.we.want.to.gene |
| c45e0 | 72 61 6c 69 7a 65 20 74 68 65 20 60 70 72 69 6d 65 2d 73 75 6d 2d 70 61 69 72 73 27 0a 70 72 6f | ralize.the.`prime-sum-pairs'.pro |
| c4600 | 63 65 64 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 20 | cedure.of.section.*Note.2-2-3::. |
| c4620 | 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 70 61 69 72 73 20 6f | to.produce.the.stream.of.pairs.o |
| c4640 | 66 0a 5f 61 6c 6c 5f 20 69 6e 74 65 67 65 72 73 20 28 69 2c 6a 29 20 77 69 74 68 20 69 20 3c 3d | f._all_.integers.(i,j).with.i.<= |
| c4660 | 20 6a 20 73 75 63 68 20 74 68 61 74 20 69 20 2b 20 6a 20 69 73 20 70 72 69 6d 65 2e 20 20 49 66 | .j.such.that.i.+.j.is.prime...If |
| c4680 | 0a 60 69 6e 74 2d 70 61 69 72 73 27 20 69 73 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 | .`int-pairs'.is.the.sequence.of. |
| c46a0 | 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 69 6e 74 65 67 65 72 73 20 28 69 2c 6a 29 20 77 69 74 68 | all.pairs.of.integers.(i,j).with |
| c46c0 | 20 69 20 3c 3d 20 6a 2c 0a 74 68 65 6e 20 6f 75 72 20 72 65 71 75 69 72 65 64 20 73 74 72 65 61 | .i.<=.j,.then.our.required.strea |
| c46e0 | 6d 20 69 73 20 73 69 6d 70 6c 79 28 32 29 0a 0a 20 20 20 20 20 28 73 74 72 65 61 6d 2d 66 69 6c | m.is.simply(2).......(stream-fil |
| c4700 | 74 65 72 20 28 6c 61 6d 62 64 61 20 28 70 61 69 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ter.(lambda.(pair).............. |
| c4720 | 20 20 20 20 20 20 20 20 20 28 70 72 69 6d 65 3f 20 28 2b 20 28 63 61 72 20 70 61 69 72 29 20 28 | .........(prime?.(+.(car.pair).( |
| c4740 | 63 61 64 72 20 70 61 69 72 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | cadr.pair))))................... |
| c4760 | 20 20 69 6e 74 2d 70 61 69 72 73 29 0a 0a 20 20 20 4f 75 72 20 70 72 6f 62 6c 65 6d 2c 20 74 68 | ..int-pairs).....Our.problem,.th |
| c4780 | 65 6e 2c 20 69 73 20 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 73 74 72 65 61 6d 20 60 69 6e | en,.is.to.produce.the.stream.`in |
| c47a0 | 74 2d 70 61 69 72 73 27 2e 20 20 4d 6f 72 65 0a 67 65 6e 65 72 61 6c 6c 79 2c 20 73 75 70 70 6f | t-pairs'...More.generally,.suppo |
| c47c0 | 73 65 20 77 65 20 68 61 76 65 20 74 77 6f 20 73 74 72 65 61 6d 73 20 53 20 3d 20 28 53 5f 69 29 | se.we.have.two.streams.S.=.(S_i) |
| c47e0 | 20 61 6e 64 20 54 20 3d 20 28 54 5f 6a 29 2c 20 61 6e 64 0a 69 6d 61 67 69 6e 65 20 74 68 65 20 | .and.T.=.(T_j),.and.imagine.the. |
| c4800 | 69 6e 66 69 6e 69 74 65 20 72 65 63 74 61 6e 67 75 6c 61 72 20 61 72 72 61 79 0a 0a 20 20 20 20 | infinite.rectangular.array...... |
| c4820 | 20 28 53 5f 30 2c 20 54 5f 30 29 20 20 28 53 5f 30 2c 20 54 5f 31 29 20 20 28 53 5f 30 2c 20 54 | .(S_0,.T_0)..(S_0,.T_1)..(S_0,.T |
| c4840 | 5f 32 29 20 20 2e 2e 2e 0a 20 20 20 20 20 28 53 5f 31 2c 20 54 5f 30 29 20 20 28 53 5f 31 2c 20 | _2)...........(S_1,.T_0)..(S_1,. |
| c4860 | 54 5f 31 29 20 20 28 53 5f 31 2c 20 54 5f 32 29 20 20 2e 2e 2e 0a 20 20 20 20 20 28 53 5f 32 2c | T_1)..(S_1,.T_2)...........(S_2, |
| c4880 | 20 54 5f 30 29 20 20 28 53 5f 32 2c 20 54 5f 31 29 20 20 28 53 5f 32 2c 20 54 5f 32 29 20 20 2e | .T_0)..(S_2,.T_1)..(S_2,.T_2)... |
| c48a0 | 2e 2e 0a 20 20 20 20 20 20 20 20 2e 2e 2e 0a 0a 20 20 20 57 65 20 77 69 73 68 20 74 6f 20 67 65 | ...................We.wish.to.ge |
| c48c0 | 6e 65 72 61 74 65 20 61 20 73 74 72 65 61 6d 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 61 6c | nerate.a.stream.that.contains.al |
| c48e0 | 6c 20 74 68 65 20 70 61 69 72 73 20 69 6e 20 74 68 65 0a 61 72 72 61 79 20 74 68 61 74 20 6c 69 | l.the.pairs.in.the.array.that.li |
| c4900 | 65 20 6f 6e 20 6f 72 20 61 62 6f 76 65 20 74 68 65 20 64 69 61 67 6f 6e 61 6c 2c 20 69 2e 65 2e | e.on.or.above.the.diagonal,.i.e. |
| c4920 | 2c 20 74 68 65 20 70 61 69 72 73 0a 0a 20 20 20 20 20 28 53 5f 30 2c 20 54 5f 30 29 20 20 28 53 | ,.the.pairs.......(S_0,.T_0)..(S |
| c4940 | 5f 30 2c 20 54 5f 31 29 20 20 28 53 5f 30 2c 20 54 5f 32 29 20 20 2e 2e 2e 0a 20 20 20 20 20 20 | _0,.T_1)..(S_0,.T_2)............ |
| c4960 | 20 20 20 20 20 20 20 20 20 20 20 28 53 5f 31 2c 20 54 5f 31 29 20 20 28 53 5f 31 2c 20 54 5f 32 | ...........(S_1,.T_1)..(S_1,.T_2 |
| c4980 | 29 20 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | )............................... |
| c49a0 | 20 20 20 20 28 53 5f 32 2c 20 54 5f 32 29 20 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ....(S_2,.T_2).................. |
| c49c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e | ................................ |
| c49e0 | 0a 0a 28 49 66 20 77 65 20 74 61 6b 65 20 62 6f 74 68 20 53 20 61 6e 64 20 54 20 74 6f 20 62 65 | ..(If.we.take.both.S.and.T.to.be |
| c4a00 | 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 69 6e 74 65 67 65 72 73 2c 20 74 68 65 6e 20 74 68 | .the.stream.of.integers,.then.th |
| c4a20 | 69 73 20 77 69 6c 6c 0a 62 65 20 6f 75 72 20 64 65 73 69 72 65 64 20 73 74 72 65 61 6d 20 60 69 | is.will.be.our.desired.stream.`i |
| c4a40 | 6e 74 2d 70 61 69 72 73 27 2e 29 0a 0a 20 20 20 43 61 6c 6c 20 74 68 65 20 67 65 6e 65 72 61 6c | nt-pairs'.).....Call.the.general |
| c4a60 | 20 73 74 72 65 61 6d 20 6f 66 20 70 61 69 72 73 20 60 28 70 61 69 72 73 20 53 20 54 29 27 2c 20 | .stream.of.pairs.`(pairs.S.T)',. |
| c4a80 | 61 6e 64 20 63 6f 6e 73 69 64 65 72 20 69 74 20 74 6f 20 62 65 0a 63 6f 6d 70 6f 73 65 64 20 6f | and.consider.it.to.be.composed.o |
| c4aa0 | 66 20 74 68 72 65 65 20 70 61 72 74 73 3a 20 74 68 65 20 70 61 69 72 20 28 53 5f 30 2c 54 5f 30 | f.three.parts:.the.pair.(S_0,T_0 |
| c4ac0 | 29 2c 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 70 61 69 72 73 20 69 6e 0a 74 68 65 20 | ),.the.rest.of.the.pairs.in.the. |
| c4ae0 | 66 69 72 73 74 20 72 6f 77 2c 20 61 6e 64 20 74 68 65 20 72 65 6d 61 69 6e 69 6e 67 20 70 61 69 | first.row,.and.the.remaining.pai |
| c4b00 | 72 73 3a 28 33 29 0a 0a 20 20 20 20 20 28 53 5f 30 2c 20 54 5f 30 29 20 7c 20 28 53 5f 30 2c 20 | rs:(3).......(S_0,.T_0).|.(S_0,. |
| c4b20 | 54 5f 31 29 20 20 28 53 5f 30 2c 20 54 5f 32 29 20 20 2e 2e 2e 0a 20 20 20 20 20 2d 2d 2d 2d 2d | T_1)..(S_0,.T_2)...........----- |
| c4b40 | 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ------+------------------------- |
| c4b60 | 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 28 53 5f 31 2c 20 54 5f 31 | ----.................|.(S_1,.T_1 |
| c4b80 | 29 20 20 28 53 5f 31 2c 20 54 5f 32 29 20 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | )..(S_1,.T_2)................... |
| c4ba0 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 28 53 5f 32 2c 20 54 5f 32 29 20 20 2e 2e 2e | ...|.............(S_2,.T_2)..... |
| c4bc0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .................|.............. |
| c4be0 | 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 0a 0a 20 20 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 | ...................Observe.that. |
| c4c00 | 74 68 65 20 74 68 69 72 64 20 70 69 65 63 65 20 69 6e 20 74 68 69 73 20 64 65 63 6f 6d 70 6f 73 | the.third.piece.in.this.decompos |
| c4c20 | 69 74 69 6f 6e 20 28 70 61 69 72 73 20 74 68 61 74 20 61 72 65 0a 6e 6f 74 20 69 6e 20 74 68 65 | ition.(pairs.that.are.not.in.the |
| c4c40 | 20 66 69 72 73 74 20 72 6f 77 29 20 69 73 20 28 72 65 63 75 72 73 69 76 65 6c 79 29 20 74 68 65 | .first.row).is.(recursively).the |
| c4c60 | 20 70 61 69 72 73 20 66 6f 72 6d 65 64 20 66 72 6f 6d 0a 60 28 73 74 72 65 61 6d 2d 63 64 72 20 | .pairs.formed.from.`(stream-cdr. |
| c4c80 | 53 29 27 20 61 6e 64 20 60 28 73 74 72 65 61 6d 2d 63 64 72 20 54 29 27 2e 20 20 41 6c 73 6f 20 | S)'.and.`(stream-cdr.T)'...Also. |
| c4ca0 | 6e 6f 74 65 20 74 68 61 74 20 74 68 65 20 73 65 63 6f 6e 64 20 70 69 65 63 65 0a 28 74 68 65 20 | note.that.the.second.piece.(the. |
| c4cc0 | 72 65 73 74 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 72 6f 77 29 20 69 73 0a 0a 20 20 20 20 20 | rest.of.the.first.row).is....... |
| c4ce0 | 28 73 74 72 65 61 6d 2d 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 6c 69 73 74 20 28 73 | (stream-map.(lambda.(x).(list.(s |
| c4d00 | 74 72 65 61 6d 2d 63 61 72 20 73 29 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tream-car.s).x))................ |
| c4d20 | 20 20 28 73 74 72 65 61 6d 2d 63 64 72 20 74 29 29 0a 0a 20 20 20 54 68 75 73 20 77 65 20 63 61 | ..(stream-cdr.t)).....Thus.we.ca |
| c4d40 | 6e 20 66 6f 72 6d 20 6f 75 72 20 73 74 72 65 61 6d 20 6f 66 20 70 61 69 72 73 20 61 73 20 66 6f | n.form.our.stream.of.pairs.as.fo |
| c4d60 | 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 69 72 73 20 73 20 74 29 | llows:.......(define.(pairs.s.t) |
| c4d80 | 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 28 6c 69 | ........(cons-stream.........(li |
| c4da0 | 73 74 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 29 20 28 73 74 72 65 61 6d 2d 63 61 72 20 74 29 | st.(stream-car.s).(stream-car.t) |
| c4dc0 | 29 0a 20 20 20 20 20 20 20 20 28 3c 43 4f 4d 42 49 4e 45 2d 49 4e 2d 53 4f 4d 45 2d 57 41 59 3e | ).........(<COMBINE-IN-SOME-WAY> |
| c4de0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 28 6c 61 6d 62 64 61 | .............(stream-map.(lambda |
| c4e00 | 20 28 78 29 20 28 6c 69 73 74 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 29 20 78 29 29 0a 20 20 | .(x).(list.(stream-car.s).x))... |
| c4e20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 64 | ......................(stream-cd |
| c4e40 | 72 20 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 69 72 73 20 28 73 74 72 65 61 6d | r.t)).............(pairs.(stream |
| c4e60 | 2d 63 64 72 20 73 29 20 28 73 74 72 65 61 6d 2d 63 64 72 20 74 29 29 29 29 29 0a 0a 20 20 20 49 | -cdr.s).(stream-cdr.t))))).....I |
| c4e80 | 6e 20 6f 72 64 65 72 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 | n.order.to.complete.the.procedur |
| c4ea0 | 65 2c 20 77 65 20 6d 75 73 74 20 63 68 6f 6f 73 65 20 73 6f 6d 65 20 77 61 79 20 74 6f 0a 63 6f | e,.we.must.choose.some.way.to.co |
| c4ec0 | 6d 62 69 6e 65 20 74 68 65 20 74 77 6f 20 69 6e 6e 65 72 20 73 74 72 65 61 6d 73 2e 20 20 4f 6e | mbine.the.two.inner.streams...On |
| c4ee0 | 65 20 69 64 65 61 20 69 73 20 74 6f 20 75 73 65 20 74 68 65 20 73 74 72 65 61 6d 20 61 6e 61 6c | e.idea.is.to.use.the.stream.anal |
| c4f00 | 6f 67 20 6f 66 0a 74 68 65 20 60 61 70 70 65 6e 64 27 20 70 72 6f 63 65 64 75 72 65 20 66 72 6f | og.of.the.`append'.procedure.fro |
| c4f20 | 6d 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 28 | m.section.*Note.2-2-1:::.......( |
| c4f40 | 64 65 66 69 6e 65 20 28 73 74 72 65 61 6d 2d 61 70 70 65 6e 64 20 73 31 20 73 32 29 0a 20 20 20 | define.(stream-append.s1.s2).... |
| c4f60 | 20 20 20 20 28 69 66 20 28 73 74 72 65 61 6d 2d 6e 75 6c 6c 3f 20 73 31 29 0a 20 20 20 20 20 20 | ....(if.(stream-null?.s1)....... |
| c4f80 | 20 20 20 20 20 73 32 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 | .....s2............(cons-stream. |
| c4fa0 | 28 73 74 72 65 61 6d 2d 63 61 72 20 73 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (stream-car.s1)................. |
| c4fc0 | 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 61 70 70 65 6e 64 20 28 73 74 72 65 61 6d 2d 63 | ........(stream-append.(stream-c |
| c4fe0 | 64 72 20 73 31 29 20 73 32 29 29 29 29 0a 0a 20 20 20 54 68 69 73 20 69 73 20 75 6e 73 75 69 74 | dr.s1).s2)))).....This.is.unsuit |
| c5000 | 61 62 6c 65 20 66 6f 72 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 73 2c 20 68 6f 77 65 76 | able.for.infinite.streams,.howev |
| c5020 | 65 72 2c 20 62 65 63 61 75 73 65 20 69 74 20 74 61 6b 65 73 0a 61 6c 6c 20 74 68 65 20 65 6c 65 | er,.because.it.takes.all.the.ele |
| c5040 | 6d 65 6e 74 73 20 66 72 6f 6d 20 74 68 65 20 66 69 72 73 74 20 73 74 72 65 61 6d 20 62 65 66 6f | ments.from.the.first.stream.befo |
| c5060 | 72 65 20 69 6e 63 6f 72 70 6f 72 61 74 69 6e 67 20 74 68 65 20 73 65 63 6f 6e 64 0a 73 74 72 65 | re.incorporating.the.second.stre |
| c5080 | 61 6d 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 69 66 20 77 65 20 74 72 79 20 74 6f | am...In.particular,.if.we.try.to |
| c50a0 | 20 67 65 6e 65 72 61 74 65 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 70 6f 73 69 74 69 76 65 0a | .generate.all.pairs.of.positive. |
| c50c0 | 69 6e 74 65 67 65 72 73 20 75 73 69 6e 67 0a 0a 20 20 20 20 20 28 70 61 69 72 73 20 69 6e 74 65 | integers.using.......(pairs.inte |
| c50e0 | 67 65 72 73 20 69 6e 74 65 67 65 72 73 29 0a 0a 6f 75 72 20 73 74 72 65 61 6d 20 6f 66 20 72 65 | gers.integers)..our.stream.of.re |
| c5100 | 73 75 6c 74 73 20 77 69 6c 6c 20 66 69 72 73 74 20 74 72 79 20 74 6f 20 72 75 6e 20 74 68 72 6f | sults.will.first.try.to.run.thro |
| c5120 | 75 67 68 20 61 6c 6c 20 70 61 69 72 73 20 77 69 74 68 20 74 68 65 0a 66 69 72 73 74 20 69 6e 74 | ugh.all.pairs.with.the.first.int |
| c5140 | 65 67 65 72 20 65 71 75 61 6c 20 74 6f 20 31 2c 20 61 6e 64 20 68 65 6e 63 65 20 77 69 6c 6c 20 | eger.equal.to.1,.and.hence.will. |
| c5160 | 6e 65 76 65 72 20 70 72 6f 64 75 63 65 20 70 61 69 72 73 20 77 69 74 68 20 61 6e 79 0a 6f 74 68 | never.produce.pairs.with.any.oth |
| c5180 | 65 72 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 69 6e 74 65 67 65 72 2e 0a 0a | er.value.of.the.first.integer... |
| c51a0 | 20 20 20 54 6f 20 68 61 6e 64 6c 65 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 73 2c 20 77 | ...To.handle.infinite.streams,.w |
| c51c0 | 65 20 6e 65 65 64 20 74 6f 20 64 65 76 69 73 65 20 61 6e 20 6f 72 64 65 72 20 6f 66 0a 63 6f 6d | e.need.to.devise.an.order.of.com |
| c51e0 | 62 69 6e 61 74 69 6f 6e 20 74 68 61 74 20 65 6e 73 75 72 65 73 20 74 68 61 74 20 65 76 65 72 79 | bination.that.ensures.that.every |
| c5200 | 20 65 6c 65 6d 65 6e 74 20 77 69 6c 6c 20 65 76 65 6e 74 75 61 6c 6c 79 20 62 65 20 72 65 61 63 | .element.will.eventually.be.reac |
| c5220 | 68 65 64 0a 69 66 20 77 65 20 6c 65 74 20 6f 75 72 20 70 72 6f 67 72 61 6d 20 72 75 6e 20 6c 6f | hed.if.we.let.our.program.run.lo |
| c5240 | 6e 67 20 65 6e 6f 75 67 68 2e 20 20 41 6e 20 65 6c 65 67 61 6e 74 20 77 61 79 20 74 6f 20 61 63 | ng.enough...An.elegant.way.to.ac |
| c5260 | 63 6f 6d 70 6c 69 73 68 0a 74 68 69 73 20 69 73 20 77 69 74 68 20 74 68 65 20 66 6f 6c 6c 6f 77 | complish.this.is.with.the.follow |
| c5280 | 69 6e 67 20 60 69 6e 74 65 72 6c 65 61 76 65 27 20 70 72 6f 63 65 64 75 72 65 3a 28 34 29 0a 0a | ing.`interleave'.procedure:(4).. |
| c52a0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 74 65 72 6c 65 61 76 65 20 73 31 20 73 32 29 0a | .....(define.(interleave.s1.s2). |
| c52c0 | 20 20 20 20 20 20 20 28 69 66 20 28 73 74 72 65 61 6d 2d 6e 75 6c 6c 3f 20 73 31 29 0a 20 20 20 | .......(if.(stream-null?.s1).... |
| c52e0 | 20 20 20 20 20 20 20 20 73 32 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 | ........s2............(cons-stre |
| c5300 | 61 6d 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | am.(stream-car.s1).............. |
| c5320 | 20 20 20 20 20 20 20 20 20 20 20 28 69 6e 74 65 72 6c 65 61 76 65 20 73 32 20 28 73 74 72 65 61 | ...........(interleave.s2.(strea |
| c5340 | 6d 2d 63 64 72 20 73 31 29 29 29 29 29 0a 0a 20 20 20 53 69 6e 63 65 20 60 69 6e 74 65 72 6c 65 | m-cdr.s1))))).....Since.`interle |
| c5360 | 61 76 65 27 20 74 61 6b 65 73 20 65 6c 65 6d 65 6e 74 73 20 61 6c 74 65 72 6e 61 74 65 6c 79 20 | ave'.takes.elements.alternately. |
| c5380 | 66 72 6f 6d 20 74 68 65 20 74 77 6f 20 73 74 72 65 61 6d 73 2c 0a 65 76 65 72 79 20 65 6c 65 6d | from.the.two.streams,.every.elem |
| c53a0 | 65 6e 74 20 6f 66 20 74 68 65 20 73 65 63 6f 6e 64 20 73 74 72 65 61 6d 20 77 69 6c 6c 20 65 76 | ent.of.the.second.stream.will.ev |
| c53c0 | 65 6e 74 75 61 6c 6c 79 20 66 69 6e 64 20 69 74 73 20 77 61 79 20 69 6e 74 6f 0a 74 68 65 20 69 | entually.find.its.way.into.the.i |
| c53e0 | 6e 74 65 72 6c 65 61 76 65 64 20 73 74 72 65 61 6d 2c 20 65 76 65 6e 20 69 66 20 74 68 65 20 66 | nterleaved.stream,.even.if.the.f |
| c5400 | 69 72 73 74 20 73 74 72 65 61 6d 20 69 73 20 69 6e 66 69 6e 69 74 65 2e 0a 0a 20 20 20 57 65 20 | irst.stream.is.infinite......We. |
| c5420 | 63 61 6e 20 74 68 75 73 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 72 65 71 75 69 72 65 64 20 73 | can.thus.generate.the.required.s |
| c5440 | 74 72 65 61 6d 20 6f 66 20 70 61 69 72 73 20 61 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | tream.of.pairs.as.......(define. |
| c5460 | 28 70 61 69 72 73 20 73 20 74 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a | (pairs.s.t)........(cons-stream. |
| c5480 | 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 29 20 28 73 74 | ........(list.(stream-car.s).(st |
| c54a0 | 72 65 61 6d 2d 63 61 72 20 74 29 29 0a 20 20 20 20 20 20 20 20 28 69 6e 74 65 72 6c 65 61 76 65 | ream-car.t)).........(interleave |
| c54c0 | 0a 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 78 | ..........(stream-map.(lambda.(x |
| c54e0 | 29 20 28 6c 69 73 74 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 29 20 78 29 29 0a 20 20 20 20 20 | ).(list.(stream-car.s).x))...... |
| c5500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 64 72 20 74 29 29 0a | ................(stream-cdr.t)). |
| c5520 | 20 20 20 20 20 20 20 20 20 28 70 61 69 72 73 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 29 20 28 | .........(pairs.(stream-cdr.s).( |
| c5540 | 73 74 72 65 61 6d 2d 63 64 72 20 74 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | stream-cdr.t))))).......*Exercis |
| c5560 | 65 20 33 2e 36 36 3a 2a 20 45 78 61 6d 69 6e 65 20 74 68 65 20 73 74 72 65 61 6d 20 60 28 70 61 | e.3.66:*.Examine.the.stream.`(pa |
| c5580 | 69 72 73 20 69 6e 74 65 67 65 72 73 20 69 6e 74 65 67 65 72 73 29 27 2e 0a 20 20 20 20 20 43 61 | irs.integers.integers)'.......Ca |
| c55a0 | 6e 20 79 6f 75 20 6d 61 6b 65 20 61 6e 79 20 67 65 6e 65 72 61 6c 20 63 6f 6d 6d 65 6e 74 73 20 | n.you.make.any.general.comments. |
| c55c0 | 61 62 6f 75 74 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 0a 20 20 20 | about.the.order.in.which.the.... |
| c55e0 | 20 20 70 61 69 72 73 20 61 72 65 20 70 6c 61 63 65 64 20 69 6e 74 6f 20 74 68 65 20 73 74 72 65 | ..pairs.are.placed.into.the.stre |
| c5600 | 61 6d 3f 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 62 6f 75 74 20 68 6f 77 20 6d 61 6e 79 0a | am?.For.example,.about.how.many. |
| c5620 | 20 20 20 20 20 70 61 69 72 73 20 70 72 65 63 65 64 65 20 74 68 65 20 70 61 69 72 20 28 31 2c 31 | .....pairs.precede.the.pair.(1,1 |
| c5640 | 30 30 29 3f 20 20 74 68 65 20 70 61 69 72 20 28 39 39 2c 31 30 30 29 3f 20 74 68 65 20 70 61 69 | 00)?..the.pair.(99,100)?.the.pai |
| c5660 | 72 0a 20 20 20 20 20 28 31 30 30 2c 31 30 30 29 3f 20 28 49 66 20 79 6f 75 20 63 61 6e 20 6d 61 | r......(100,100)?.(If.you.can.ma |
| c5680 | 6b 65 20 70 72 65 63 69 73 65 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 73 74 61 74 65 6d 65 6e | ke.precise.mathematical.statemen |
| c56a0 | 74 73 20 68 65 72 65 2c 0a 20 20 20 20 20 61 6c 6c 20 74 68 65 20 62 65 74 74 65 72 2e 20 42 75 | ts.here,......all.the.better..Bu |
| c56c0 | 74 20 66 65 65 6c 20 66 72 65 65 20 74 6f 20 67 69 76 65 20 6d 6f 72 65 20 71 75 61 6c 69 74 61 | t.feel.free.to.give.more.qualita |
| c56e0 | 74 69 76 65 20 61 6e 73 77 65 72 73 20 69 66 0a 20 20 20 20 20 79 6f 75 20 66 69 6e 64 20 79 6f | tive.answers.if......you.find.yo |
| c5700 | 75 72 73 65 6c 66 20 67 65 74 74 69 6e 67 20 62 6f 67 67 65 64 20 64 6f 77 6e 2e 29 0a 0a 20 20 | urself.getting.bogged.down.).... |
| c5720 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 36 37 3a 2a 20 4d 6f 64 69 66 79 20 74 68 65 20 60 | ...*Exercise.3.67:*.Modify.the.` |
| c5740 | 70 61 69 72 73 27 20 70 72 6f 63 65 64 75 72 65 20 73 6f 20 74 68 61 74 20 60 28 70 61 69 72 73 | pairs'.procedure.so.that.`(pairs |
| c5760 | 0a 20 20 20 20 20 69 6e 74 65 67 65 72 73 20 69 6e 74 65 67 65 72 73 29 27 20 77 69 6c 6c 20 70 | ......integers.integers)'.will.p |
| c5780 | 72 6f 64 75 63 65 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 5f 61 6c 6c 5f 20 70 61 69 72 73 | roduce.the.stream.of._all_.pairs |
| c57a0 | 20 6f 66 0a 20 20 20 20 20 69 6e 74 65 67 65 72 73 20 28 69 2c 6a 29 20 28 77 69 74 68 6f 75 74 | .of......integers.(i,j).(without |
| c57c0 | 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 20 3c 3d 20 6a 29 2e 20 20 48 69 6e 74 3a 20 59 | .the.condition.i.<=.j)...Hint:.Y |
| c57e0 | 6f 75 20 77 69 6c 6c 0a 20 20 20 20 20 6e 65 65 64 20 74 6f 20 6d 69 78 20 69 6e 20 61 6e 20 61 | ou.will......need.to.mix.in.an.a |
| c5800 | 64 64 69 74 69 6f 6e 61 6c 20 73 74 72 65 61 6d 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | dditional.stream........*Exercis |
| c5820 | 65 20 33 2e 36 38 3a 2a 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 20 74 68 69 6e 6b 73 20 74 | e.3.68:*.Louis.Reasoner.thinks.t |
| c5840 | 68 61 74 20 62 75 69 6c 64 69 6e 67 20 61 20 73 74 72 65 61 6d 20 6f 66 0a 20 20 20 20 20 70 61 | hat.building.a.stream.of......pa |
| c5860 | 69 72 73 20 66 72 6f 6d 20 74 68 72 65 65 20 70 61 72 74 73 20 69 73 20 75 6e 6e 65 63 65 73 73 | irs.from.three.parts.is.unnecess |
| c5880 | 61 72 69 6c 79 20 63 6f 6d 70 6c 69 63 61 74 65 64 2e 20 20 49 6e 73 74 65 61 64 20 6f 66 0a 20 | arily.complicated...Instead.of.. |
| c58a0 | 20 20 20 20 73 65 70 61 72 61 74 69 6e 67 20 74 68 65 20 70 61 69 72 20 28 53 5f 30 2c 54 5f 30 | ....separating.the.pair.(S_0,T_0 |
| c58c0 | 29 20 66 72 6f 6d 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 70 61 69 72 73 20 69 6e 20 | ).from.the.rest.of.the.pairs.in. |
| c58e0 | 74 68 65 0a 20 20 20 20 20 66 69 72 73 74 20 72 6f 77 2c 20 68 65 20 70 72 6f 70 6f 73 65 73 20 | the......first.row,.he.proposes. |
| c5900 | 74 6f 20 77 6f 72 6b 20 77 69 74 68 20 74 68 65 20 77 68 6f 6c 65 20 66 69 72 73 74 20 72 6f 77 | to.work.with.the.whole.first.row |
| c5920 | 2c 20 61 73 0a 20 20 20 20 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | ,.as......follows:............(d |
| c5940 | 65 66 69 6e 65 20 28 70 61 69 72 73 20 73 20 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 | efine.(pairs.s.t).............(i |
| c5960 | 6e 74 65 72 6c 65 61 76 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d | nterleave..............(stream-m |
| c5980 | 61 70 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 6c 69 73 74 20 28 73 74 72 65 61 6d 2d 63 61 72 | ap.(lambda.(x).(list.(stream-car |
| c59a0 | 20 73 29 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .s).x))......................... |
| c59c0 | 20 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 69 72 73 20 28 73 74 72 65 61 6d 2d | .t)..............(pairs.(stream- |
| c59e0 | 63 64 72 20 73 29 20 28 73 74 72 65 61 6d 2d 63 64 72 20 74 29 29 29 29 0a 0a 20 20 20 20 20 44 | cdr.s).(stream-cdr.t)))).......D |
| c5a00 | 6f 65 73 20 74 68 69 73 20 77 6f 72 6b 3f 20 20 43 6f 6e 73 69 64 65 72 20 77 68 61 74 20 68 61 | oes.this.work?..Consider.what.ha |
| c5a20 | 70 70 65 6e 73 20 69 66 20 77 65 20 65 76 61 6c 75 61 74 65 20 60 28 70 61 69 72 73 0a 20 20 20 | ppens.if.we.evaluate.`(pairs.... |
| c5a40 | 20 20 69 6e 74 65 67 65 72 73 20 69 6e 74 65 67 65 72 73 29 27 20 75 73 69 6e 67 20 4c 6f 75 69 | ..integers.integers)'.using.Loui |
| c5a60 | 73 27 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 70 61 69 72 73 27 2e 0a 0a 20 20 20 20 | s's.definition.of.`pairs'....... |
| c5a80 | 20 2a 45 78 65 72 63 69 73 65 20 33 2e 36 39 3a 2a 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 | .*Exercise.3.69:*.Write.a.proced |
| c5aa0 | 75 72 65 20 60 74 72 69 70 6c 65 73 27 20 74 68 61 74 20 74 61 6b 65 73 20 74 68 72 65 65 0a 20 | ure.`triples'.that.takes.three.. |
| c5ac0 | 20 20 20 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 73 2c 20 53 2c 20 54 2c 20 61 6e 64 20 | ....infinite.streams,.S,.T,.and. |
| c5ae0 | 55 2c 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 74 72 | U,.and.produces.the.stream.of.tr |
| c5b00 | 69 70 6c 65 73 0a 20 20 20 20 20 28 53 5f 69 2c 54 5f 6a 2c 55 5f 6b 29 20 73 75 63 68 20 74 68 | iples......(S_i,T_j,U_k).such.th |
| c5b20 | 61 74 20 69 20 3c 3d 20 6a 20 3c 3d 20 6b 2e 20 20 55 73 65 20 60 74 72 69 70 6c 65 73 27 20 74 | at.i.<=.j.<=.k...Use.`triples'.t |
| c5b40 | 6f 20 67 65 6e 65 72 61 74 65 0a 20 20 20 20 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 61 6c | o.generate......the.stream.of.al |
| c5b60 | 6c 20 50 79 74 68 61 67 6f 72 65 61 6e 20 74 72 69 70 6c 65 73 20 6f 66 20 70 6f 73 69 74 69 76 | l.Pythagorean.triples.of.positiv |
| c5b80 | 65 20 69 6e 74 65 67 65 72 73 2c 20 69 2e 65 2e 2c 0a 20 20 20 20 20 74 68 65 20 74 72 69 70 6c | e.integers,.i.e.,......the.tripl |
| c5ba0 | 65 73 20 28 69 2c 6a 2c 6b 29 20 73 75 63 68 20 74 68 61 74 20 69 20 3c 3d 20 6a 20 61 6e 64 20 | es.(i,j,k).such.that.i.<=.j.and. |
| c5bc0 | 69 5e 32 20 2b 20 6a 5e 32 20 3d 20 6b 5e 32 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | i^2.+.j^2.=.k^2........*Exercise |
| c5be0 | 20 33 2e 37 30 3a 2a 20 49 74 20 77 6f 75 6c 64 20 62 65 20 6e 69 63 65 20 74 6f 20 62 65 20 61 | .3.70:*.It.would.be.nice.to.be.a |
| c5c00 | 62 6c 65 20 74 6f 20 67 65 6e 65 72 61 74 65 20 73 74 72 65 61 6d 73 0a 20 20 20 20 20 69 6e 20 | ble.to.generate.streams......in. |
| c5c20 | 77 68 69 63 68 20 74 68 65 20 70 61 69 72 73 20 61 70 70 65 61 72 20 69 6e 20 73 6f 6d 65 20 75 | which.the.pairs.appear.in.some.u |
| c5c40 | 73 65 66 75 6c 20 6f 72 64 65 72 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 69 6e 20 74 68 65 0a | seful.order,.rather.than.in.the. |
| c5c60 | 20 20 20 20 20 6f 72 64 65 72 20 74 68 61 74 20 72 65 73 75 6c 74 73 20 66 72 6f 6d 20 61 6e 20 | .....order.that.results.from.an. |
| c5c80 | 5f 61 64 20 68 6f 63 5f 20 69 6e 74 65 72 6c 65 61 76 69 6e 67 20 70 72 6f 63 65 73 73 2e 20 20 | _ad.hoc_.interleaving.process... |
| c5ca0 | 57 65 20 63 61 6e 0a 20 20 20 20 20 75 73 65 20 61 20 74 65 63 68 6e 69 71 75 65 20 73 69 6d 69 | We.can......use.a.technique.simi |
| c5cc0 | 6c 61 72 20 74 6f 20 74 68 65 20 60 6d 65 72 67 65 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 | lar.to.the.`merge'.procedure.of. |
| c5ce0 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 20 20 20 20 20 33 2d 35 36 3a 3a 2c 20 69 66 20 77 | *Note.Exercise......3-56::,.if.w |
| c5d00 | 65 20 64 65 66 69 6e 65 20 61 20 77 61 79 20 74 6f 20 73 61 79 20 74 68 61 74 20 6f 6e 65 20 70 | e.define.a.way.to.say.that.one.p |
| c5d20 | 61 69 72 20 6f 66 20 69 6e 74 65 67 65 72 73 20 69 73 0a 20 20 20 20 20 22 6c 65 73 73 20 74 68 | air.of.integers.is......"less.th |
| c5d40 | 61 6e 22 20 61 6e 6f 74 68 65 72 2e 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 64 6f 20 74 68 69 73 | an".another...One.way.to.do.this |
| c5d60 | 20 69 73 20 74 6f 20 64 65 66 69 6e 65 20 61 20 22 77 65 69 67 68 74 69 6e 67 0a 20 20 20 20 20 | .is.to.define.a."weighting...... |
| c5d80 | 66 75 6e 63 74 69 6f 6e 22 20 57 28 69 2c 6a 29 20 61 6e 64 20 73 74 69 70 75 6c 61 74 65 20 74 | function".W(i,j).and.stipulate.t |
| c5da0 | 68 61 74 20 28 69 5f 31 2c 6a 5f 31 29 20 69 73 20 6c 65 73 73 20 74 68 61 6e 0a 20 20 20 20 20 | hat.(i_1,j_1).is.less.than...... |
| c5dc0 | 28 69 5f 32 2c 6a 5f 32 29 20 69 66 20 57 28 69 5f 31 2c 6a 5f 31 29 20 3c 20 57 28 69 5f 32 2c | (i_2,j_2).if.W(i_1,j_1).<.W(i_2, |
| c5de0 | 6a 5f 32 29 2e 20 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 60 6d | j_2)...Write.a.procedure......`m |
| c5e00 | 65 72 67 65 2d 77 65 69 67 68 74 65 64 27 20 74 68 61 74 20 69 73 20 6c 69 6b 65 20 60 6d 65 72 | erge-weighted'.that.is.like.`mer |
| c5e20 | 67 65 27 2c 20 65 78 63 65 70 74 20 74 68 61 74 0a 20 20 20 20 20 60 6d 65 72 67 65 2d 77 65 69 | ge',.except.that......`merge-wei |
| c5e40 | 67 68 74 65 64 27 20 74 61 6b 65 73 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 6c 20 61 72 67 75 6d | ghted'.takes.an.additional.argum |
| c5e60 | 65 6e 74 20 60 77 65 69 67 68 74 27 2c 20 77 68 69 63 68 20 69 73 20 61 0a 20 20 20 20 20 70 72 | ent.`weight',.which.is.a......pr |
| c5e80 | 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 74 68 65 20 77 65 69 67 68 74 | ocedure.that.computes.the.weight |
| c5ea0 | 20 6f 66 20 61 20 70 61 69 72 2c 20 61 6e 64 20 69 73 20 75 73 65 64 20 74 6f 0a 20 20 20 20 20 | .of.a.pair,.and.is.used.to...... |
| c5ec0 | 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 65 6c 65 | determine.the.order.in.which.ele |
| c5ee0 | 6d 65 6e 74 73 20 73 68 6f 75 6c 64 20 61 70 70 65 61 72 20 69 6e 20 74 68 65 0a 20 20 20 20 20 | ments.should.appear.in.the...... |
| c5f00 | 72 65 73 75 6c 74 69 6e 67 20 6d 65 72 67 65 64 20 73 74 72 65 61 6d 2e 28 35 29 20 20 55 73 69 | resulting.merged.stream.(5)..Usi |
| c5f20 | 6e 67 20 74 68 69 73 2c 20 67 65 6e 65 72 61 6c 69 7a 65 20 60 70 61 69 72 73 27 20 74 6f 20 61 | ng.this,.generalize.`pairs'.to.a |
| c5f40 | 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 60 77 65 69 67 68 74 65 64 2d 70 61 69 72 73 27 | ......procedure.`weighted-pairs' |
| c5f60 | 20 74 68 61 74 20 74 61 6b 65 73 20 74 77 6f 20 73 74 72 65 61 6d 73 2c 20 74 6f 67 65 74 68 65 | .that.takes.two.streams,.togethe |
| c5f80 | 72 20 77 69 74 68 20 61 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 6f 6d | r.with.a......procedure.that.com |
| c5fa0 | 70 75 74 65 73 20 61 20 77 65 69 67 68 74 69 6e 67 20 66 75 6e 63 74 69 6f 6e 2c 20 61 6e 64 20 | putes.a.weighting.function,.and. |
| c5fc0 | 67 65 6e 65 72 61 74 65 73 20 74 68 65 0a 20 20 20 20 20 73 74 72 65 61 6d 20 6f 66 20 70 61 69 | generates.the......stream.of.pai |
| c5fe0 | 72 73 2c 20 6f 72 64 65 72 65 64 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 77 65 69 67 68 74 2e | rs,.ordered.according.to.weight. |
| c6000 | 20 20 55 73 65 20 79 6f 75 72 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 74 6f 20 67 65 6e | ..Use.your.procedure......to.gen |
| c6020 | 65 72 61 74 65 0a 0a 20 20 20 20 20 20 20 61 2e 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 61 | erate.........a..the.stream.of.a |
| c6040 | 6c 6c 20 70 61 69 72 73 20 6f 66 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 73 20 28 69 | ll.pairs.of.positive.integers.(i |
| c6060 | 2c 6a 29 20 77 69 74 68 20 69 20 3c 3d 20 6a 0a 20 20 20 20 20 20 20 20 20 20 6f 72 64 65 72 65 | ,j).with.i.<=.j...........ordere |
| c6080 | 64 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 20 73 75 6d 20 69 20 2b 20 6a 0a 0a 20 20 | d.according.to.the.sum.i.+.j.... |
| c60a0 | 20 20 20 20 20 62 2e 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 61 6c 6c 20 70 61 69 72 73 20 | .....b..the.stream.of.all.pairs. |
| c60c0 | 6f 66 20 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 65 72 73 20 28 69 2c 6a 29 20 77 69 74 68 20 | of.positive.integers.(i,j).with. |
| c60e0 | 69 20 3c 3d 0a 20 20 20 20 20 20 20 20 20 20 6a 2c 20 77 68 65 72 65 20 6e 65 69 74 68 65 72 20 | i.<=...........j,.where.neither. |
| c6100 | 69 20 6e 6f 72 20 6a 20 69 73 20 64 69 76 69 73 69 62 6c 65 20 62 79 20 32 2c 20 33 2c 20 6f 72 | i.nor.j.is.divisible.by.2,.3,.or |
| c6120 | 20 35 2c 20 61 6e 64 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 70 61 69 72 73 20 61 72 65 20 | .5,.and.the...........pairs.are. |
| c6140 | 6f 72 64 65 72 65 64 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 20 73 75 6d 20 32 20 69 | ordered.according.to.the.sum.2.i |
| c6160 | 20 2b 20 33 20 6a 20 2b 20 35 20 69 20 6a 2e 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | .+.3.j.+.5.i.j.........*Exercise |
| c6180 | 20 33 2e 37 31 3a 2a 20 4e 75 6d 62 65 72 73 20 74 68 61 74 20 63 61 6e 20 62 65 20 65 78 70 72 | .3.71:*.Numbers.that.can.be.expr |
| c61a0 | 65 73 73 65 64 20 61 73 20 74 68 65 20 73 75 6d 20 6f 66 20 74 77 6f 0a 20 20 20 20 20 63 75 62 | essed.as.the.sum.of.two......cub |
| c61c0 | 65 73 20 69 6e 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 77 61 79 20 61 72 65 20 73 6f 6d 65 | es.in.more.than.one.way.are.some |
| c61e0 | 74 69 6d 65 73 20 63 61 6c 6c 65 64 20 22 52 61 6d 61 6e 75 6a 61 6e 0a 20 20 20 20 20 6e 75 6d | times.called."Ramanujan......num |
| c6200 | 62 65 72 73 22 2c 20 69 6e 20 68 6f 6e 6f 72 20 6f 66 20 74 68 65 20 6d 61 74 68 65 6d 61 74 69 | bers",.in.honor.of.the.mathemati |
| c6220 | 63 69 61 6e 20 53 72 69 6e 69 76 61 73 61 20 52 61 6d 61 6e 75 6a 61 6e 2e 28 36 29 0a 20 20 20 | cian.Srinivasa.Ramanujan.(6).... |
| c6240 | 20 20 4f 72 64 65 72 65 64 20 73 74 72 65 61 6d 73 20 6f 66 20 70 61 69 72 73 20 70 72 6f 76 69 | ..Ordered.streams.of.pairs.provi |
| c6260 | 64 65 20 61 6e 20 65 6c 65 67 61 6e 74 20 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 74 68 65 0a 20 20 | de.an.elegant.solution.to.the... |
| c6280 | 20 20 20 70 72 6f 62 6c 65 6d 20 6f 66 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 73 65 20 6e 75 | ...problem.of.computing.these.nu |
| c62a0 | 6d 62 65 72 73 2e 20 20 54 6f 20 66 69 6e 64 20 61 20 6e 75 6d 62 65 72 20 74 68 61 74 20 63 61 | mbers...To.find.a.number.that.ca |
| c62c0 | 6e 20 62 65 0a 20 20 20 20 20 77 72 69 74 74 65 6e 20 61 73 20 74 68 65 20 73 75 6d 20 6f 66 20 | n.be......written.as.the.sum.of. |
| c62e0 | 74 77 6f 20 63 75 62 65 73 20 69 6e 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 77 61 79 73 2c | two.cubes.in.two.different.ways, |
| c6300 | 20 77 65 20 6e 65 65 64 0a 20 20 20 20 20 6f 6e 6c 79 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 | .we.need......only.generate.the. |
| c6320 | 73 74 72 65 61 6d 20 6f 66 20 70 61 69 72 73 20 6f 66 20 69 6e 74 65 67 65 72 73 20 28 69 2c 6a | stream.of.pairs.of.integers.(i,j |
| c6340 | 29 20 77 65 69 67 68 74 65 64 0a 20 20 20 20 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 74 68 65 | ).weighted......according.to.the |
| c6360 | 20 73 75 6d 20 69 5e 33 20 2b 20 6a 5e 33 20 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 | .sum.i^3.+.j^3.(see.*Note.Exerci |
| c6380 | 73 65 20 33 2d 37 30 3a 3a 29 2c 20 74 68 65 6e 0a 20 20 20 20 20 73 65 61 72 63 68 20 74 68 65 | se.3-70::),.then......search.the |
| c63a0 | 20 73 74 72 65 61 6d 20 66 6f 72 20 74 77 6f 20 63 6f 6e 73 65 63 75 74 69 76 65 20 70 61 69 72 | .stream.for.two.consecutive.pair |
| c63c0 | 73 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 77 65 69 67 68 74 2e 0a 20 20 20 20 20 57 72 69 | s.with.the.same.weight.......Wri |
| c63e0 | 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 52 | te.a.procedure.to.generate.the.R |
| c6400 | 61 6d 61 6e 75 6a 61 6e 20 6e 75 6d 62 65 72 73 2e 20 20 54 68 65 20 66 69 72 73 74 0a 20 20 20 | amanujan.numbers...The.first.... |
| c6420 | 20 20 73 75 63 68 20 6e 75 6d 62 65 72 20 69 73 20 31 2c 37 32 39 2e 20 20 57 68 61 74 20 61 72 | ..such.number.is.1,729...What.ar |
| c6440 | 65 20 74 68 65 20 6e 65 78 74 20 66 69 76 65 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | e.the.next.five?.......*Exercise |
| c6460 | 20 33 2e 37 32 3a 2a 20 49 6e 20 61 20 73 69 6d 69 6c 61 72 20 77 61 79 20 74 6f 20 2a 4e 6f 74 | .3.72:*.In.a.similar.way.to.*Not |
| c6480 | 65 20 45 78 65 72 63 69 73 65 20 33 2d 37 31 3a 3a 0a 20 20 20 20 20 67 65 6e 65 72 61 74 65 20 | e.Exercise.3-71::......generate. |
| c64a0 | 61 20 73 74 72 65 61 6d 20 6f 66 20 61 6c 6c 20 6e 75 6d 62 65 72 73 20 74 68 61 74 20 63 61 6e | a.stream.of.all.numbers.that.can |
| c64c0 | 20 62 65 20 77 72 69 74 74 65 6e 20 61 73 20 74 68 65 20 73 75 6d 20 6f 66 0a 20 20 20 20 20 74 | .be.written.as.the.sum.of......t |
| c64e0 | 77 6f 20 73 71 75 61 72 65 73 20 69 6e 20 74 68 72 65 65 20 64 69 66 66 65 72 65 6e 74 20 77 61 | wo.squares.in.three.different.wa |
| c6500 | 79 73 20 28 73 68 6f 77 69 6e 67 20 68 6f 77 20 74 68 65 79 20 63 61 6e 20 62 65 20 73 6f 0a 20 | ys.(showing.how.they.can.be.so.. |
| c6520 | 20 20 20 20 77 72 69 74 74 65 6e 29 2e 0a 0a 53 74 72 65 61 6d 73 20 61 73 20 73 69 67 6e 61 6c | ....written)...Streams.as.signal |
| c6540 | 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 20 62 65 67 61 6e 20 6f | s.....................We.began.o |
| c6560 | 75 72 20 64 69 73 63 75 73 73 69 6f 6e 20 6f 66 20 73 74 72 65 61 6d 73 20 62 79 20 64 65 73 63 | ur.discussion.of.streams.by.desc |
| c6580 | 72 69 62 69 6e 67 20 74 68 65 6d 20 61 73 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 0a 61 6e 61 | ribing.them.as.computational.ana |
| c65a0 | 6c 6f 67 73 20 6f 66 20 74 68 65 20 22 73 69 67 6e 61 6c 73 22 20 69 6e 20 73 69 67 6e 61 6c 2d | logs.of.the."signals".in.signal- |
| c65c0 | 70 72 6f 63 65 73 73 69 6e 67 20 73 79 73 74 65 6d 73 2e 20 20 49 6e 20 66 61 63 74 2c 20 77 65 | processing.systems...In.fact,.we |
| c65e0 | 20 63 61 6e 0a 75 73 65 20 73 74 72 65 61 6d 73 20 74 6f 20 6d 6f 64 65 6c 20 73 69 67 6e 61 6c | .can.use.streams.to.model.signal |
| c6600 | 2d 70 72 6f 63 65 73 73 69 6e 67 20 73 79 73 74 65 6d 73 20 69 6e 20 61 20 76 65 72 79 20 64 69 | -processing.systems.in.a.very.di |
| c6620 | 72 65 63 74 20 77 61 79 2c 0a 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 65 20 76 61 6c 75 65 | rect.way,.representing.the.value |
| c6640 | 73 20 6f 66 20 61 20 73 69 67 6e 61 6c 20 61 74 20 73 75 63 63 65 73 73 69 76 65 20 74 69 6d 65 | s.of.a.signal.at.successive.time |
| c6660 | 20 69 6e 74 65 72 76 61 6c 73 20 61 73 0a 63 6f 6e 73 65 63 75 74 69 76 65 20 65 6c 65 6d 65 6e | .intervals.as.consecutive.elemen |
| c6680 | 74 73 20 6f 66 20 61 20 73 74 72 65 61 6d 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 77 | ts.of.a.stream...For.instance,.w |
| c66a0 | 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 61 6e 20 22 69 6e 74 65 67 72 61 74 6f 72 22 0a | e.can.implement.an."integrator". |
| c66c0 | 6f 72 20 22 73 75 6d 6d 65 72 22 20 74 68 61 74 2c 20 66 6f 72 20 61 6e 20 69 6e 70 75 74 20 73 | or."summer".that,.for.an.input.s |
| c66e0 | 74 72 65 61 6d 20 78 20 3d 20 28 78 5f 69 29 2c 20 61 6e 20 69 6e 69 74 69 61 6c 20 76 61 6c 75 | tream.x.=.(x_i),.an.initial.valu |
| c6700 | 65 20 43 2c 0a 61 6e 64 20 61 20 73 6d 61 6c 6c 20 69 6e 63 72 65 6d 65 6e 74 20 64 74 2c 20 61 | e.C,.and.a.small.increment.dt,.a |
| c6720 | 63 63 75 6d 75 6c 61 74 65 73 20 74 68 65 20 73 75 6d 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ccumulates.the.sum.............. |
| c6740 | 20 20 20 20 69 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 0a 20 20 20 20 20 53 5f | ....i................---......S_ |
| c6760 | 69 20 3d 20 43 20 2b 20 3e 20 20 20 78 5f 6a 20 64 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | i.=.C.+.>...x_j.dt.............. |
| c6780 | 20 20 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6a 3d 31 0a 0a 61 6e 64 20 72 65 | ..---................j=1..and.re |
| c67a0 | 74 75 72 6e 73 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 76 61 6c 75 65 73 20 53 20 3d 20 28 | turns.the.stream.of.values.S.=.( |
| c67c0 | 53 5f 69 29 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 60 69 6e 74 65 67 72 61 6c 27 0a | S_i)...The.following.`integral'. |
| c67e0 | 70 72 6f 63 65 64 75 72 65 20 69 73 20 72 65 6d 69 6e 69 73 63 65 6e 74 20 6f 66 20 74 68 65 20 | procedure.is.reminiscent.of.the. |
| c6800 | 22 69 6d 70 6c 69 63 69 74 20 73 74 79 6c 65 22 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 | "implicit.style".definition.of.t |
| c6820 | 68 65 0a 73 74 72 65 61 6d 20 6f 66 20 69 6e 74 65 67 65 72 73 20 28 73 65 63 74 69 6f 6e 20 2a | he.stream.of.integers.(section.* |
| c6840 | 4e 6f 74 65 20 33 2d 35 2d 32 3a 3a 29 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e | Note.3-5-2::):.......(define.(in |
| c6860 | 74 65 67 72 61 6c 20 69 6e 74 65 67 72 61 6e 64 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 20 64 | tegral.integrand.initial-value.d |
| c6880 | 74 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 74 0a 20 20 20 20 20 20 20 20 20 28 | t)........(define.int..........( |
| c68a0 | 63 6f 6e 73 2d 73 74 72 65 61 6d 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 0a 20 20 20 20 20 20 | cons-stream.initial-value....... |
| c68c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 73 74 72 65 61 6d 73 20 28 73 63 | ................(add-streams.(sc |
| c68e0 | 61 6c 65 2d 73 74 72 65 61 6d 20 69 6e 74 65 67 72 61 6e 64 20 64 74 29 0a 20 20 20 20 20 20 20 | ale-stream.integrand.dt)........ |
| c6900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 29 | ............................int) |
| c6920 | 29 29 0a 20 20 20 20 20 20 20 69 6e 74 29 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 | ))........int).....*Note.Figure. |
| c6940 | 33 2d 33 32 3a 3a 20 69 73 20 61 20 70 69 63 74 75 72 65 20 6f 66 20 61 20 73 69 67 6e 61 6c 2d | 3-32::.is.a.picture.of.a.signal- |
| c6960 | 70 72 6f 63 65 73 73 69 6e 67 20 73 79 73 74 65 6d 20 74 68 61 74 0a 63 6f 72 72 65 73 70 6f 6e | processing.system.that.correspon |
| c6980 | 64 73 20 74 6f 20 74 68 65 20 60 69 6e 74 65 67 72 61 6c 27 20 70 72 6f 63 65 64 75 72 65 2e 20 | ds.to.the.`integral'.procedure.. |
| c69a0 | 20 54 68 65 20 69 6e 70 75 74 20 73 74 72 65 61 6d 20 69 73 20 73 63 61 6c 65 64 20 62 79 0a 64 | .The.input.stream.is.scaled.by.d |
| c69c0 | 74 20 61 6e 64 20 70 61 73 73 65 64 20 74 68 72 6f 75 67 68 20 61 6e 20 61 64 64 65 72 2c 20 77 | t.and.passed.through.an.adder,.w |
| c69e0 | 68 6f 73 65 20 6f 75 74 70 75 74 20 69 73 20 70 61 73 73 65 64 20 62 61 63 6b 20 74 68 72 6f 75 | hose.output.is.passed.back.throu |
| c6a00 | 67 68 20 74 68 65 0a 73 61 6d 65 20 61 64 64 65 72 2e 20 20 54 68 65 20 73 65 6c 66 2d 72 65 66 | gh.the.same.adder...The.self-ref |
| c6a20 | 65 72 65 6e 63 65 20 69 6e 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 69 6e 74 | erence.in.the.definition.of.`int |
| c6a40 | 27 20 69 73 20 72 65 66 6c 65 63 74 65 64 0a 69 6e 20 74 68 65 20 66 69 67 75 72 65 20 62 79 20 | '.is.reflected.in.the.figure.by. |
| c6a60 | 74 68 65 20 66 65 65 64 62 61 63 6b 20 6c 6f 6f 70 20 74 68 61 74 20 63 6f 6e 6e 65 63 74 73 20 | the.feedback.loop.that.connects. |
| c6a80 | 74 68 65 20 6f 75 74 70 75 74 20 6f 66 20 74 68 65 0a 61 64 64 65 72 20 74 6f 20 6f 6e 65 20 6f | the.output.of.the.adder.to.one.o |
| c6aa0 | 66 20 74 68 65 20 69 6e 70 75 74 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 33 32 | f.the.inputs........*Figure.3.32 |
| c6ac0 | 3a 2a 20 54 68 65 20 60 69 6e 74 65 67 72 61 6c 27 20 70 72 6f 63 65 64 75 72 65 20 76 69 65 77 | :*.The.`integral'.procedure.view |
| c6ae0 | 65 64 20 61 73 20 61 0a 20 20 20 20 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 73 73 69 6e 67 20 73 | ed.as.a......signal-processing.s |
| c6b00 | 79 73 74 65 6d 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ystem........................... |
| c6b20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 0a 20 20 20 | ...............initial-value.... |
| c6b40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c6b60 | 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | .........|..................+--- |
| c6b80 | 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 5c 5f 5f 0a | --------+..............|...|\__. |
| c6ba0 | 20 20 20 20 20 20 20 20 20 20 69 6e 70 75 74 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ..........input..|...........|.. |
| c6bc0 | 20 20 20 20 7c 5c 5f 5f 20 20 20 20 2b 2d 2d 3e 7c 20 20 20 5c 5f 20 20 69 6e 74 65 67 72 61 6c | ....|\__....+-->|...\_..integral |
| c6be0 | 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 3e 7c 20 73 63 61 6c 65 3a 20 64 74 20 2b 2d | ...........------>|.scale:.dt.+- |
| c6c00 | 2d 2d 2d 2d 3e 7c 20 20 20 5c 5f 20 20 20 20 20 20 7c 63 6f 6e 73 5f 3e 2d 2d 2a 2d 2d 2d 2d 2d | ---->|...\_......|cons_>--*----- |
| c6c20 | 2d 2d 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | -->..................|.......... |
| c6c40 | 20 7c 20 20 20 20 20 20 7c 20 61 64 64 5f 3e 2d 2d 2d 2d 3e 7c 20 5f 5f 2f 20 20 20 20 7c 0a 20 | .|......|.add_>---->|.__/....|.. |
| c6c60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 2b | ................+-----------+..+ |
| c6c80 | 2d 2d 3e 7c 20 5f 5f 2f 20 20 20 20 20 20 20 7c 2f 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 | -->|.__/.......|/.......|....... |
| c6ca0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 2f | ..........................|...|/ |
| c6cc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | ...................|............ |
| c6ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | .....................|.......... |
| c6d00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............|................. |
| c6d20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ................+--------------- |
| c6d40 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 37 33 3a | ---------+.......*Exercise.3.73: |
| c6d60 | 2a 20 57 65 20 63 61 6e 20 6d 6f 64 65 6c 20 65 6c 65 63 74 72 69 63 61 6c 20 63 69 72 63 75 69 | *.We.can.model.electrical.circui |
| c6d80 | 74 73 20 75 73 69 6e 67 20 73 74 72 65 61 6d 73 20 74 6f 0a 20 20 20 20 20 72 65 70 72 65 73 65 | ts.using.streams.to......represe |
| c6da0 | 6e 74 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 63 75 72 72 65 6e 74 73 20 6f 72 20 76 6f 6c | nt.the.values.of.currents.or.vol |
| c6dc0 | 74 61 67 65 73 20 61 74 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 20 20 20 20 20 74 69 6d 65 | tages.at.a.sequence.of......time |
| c6de0 | 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 73 75 70 70 6f 73 65 20 77 65 20 68 61 76 | s...For.instance,.suppose.we.hav |
| c6e00 | 65 20 61 6e 20 22 52 43 20 63 69 72 63 75 69 74 22 20 63 6f 6e 73 69 73 74 69 6e 67 0a 20 20 20 | e.an."RC.circuit".consisting.... |
| c6e20 | 20 20 6f 66 20 61 20 72 65 73 69 73 74 6f 72 20 6f 66 20 72 65 73 69 73 74 61 6e 63 65 20 52 20 | ..of.a.resistor.of.resistance.R. |
| c6e40 | 61 6e 64 20 61 20 63 61 70 61 63 69 74 6f 72 20 6f 66 20 63 61 70 61 63 69 74 61 6e 63 65 20 43 | and.a.capacitor.of.capacitance.C |
| c6e60 | 20 69 6e 0a 20 20 20 20 20 73 65 72 69 65 73 2e 20 20 54 68 65 20 76 6f 6c 74 61 67 65 20 72 65 | .in......series...The.voltage.re |
| c6e80 | 73 70 6f 6e 73 65 20 76 20 6f 66 20 74 68 65 20 63 69 72 63 75 69 74 20 74 6f 20 61 6e 20 69 6e | sponse.v.of.the.circuit.to.an.in |
| c6ea0 | 6a 65 63 74 65 64 0a 20 20 20 20 20 63 75 72 72 65 6e 74 20 69 20 69 73 20 64 65 74 65 72 6d 69 | jected......current.i.is.determi |
| c6ec0 | 6e 65 64 20 62 79 20 74 68 65 20 66 6f 72 6d 75 6c 61 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 | ned.by.the.formula.in.*Note.Figu |
| c6ee0 | 72 65 20 33 2d 33 33 3a 3a 2c 0a 20 20 20 20 20 77 68 6f 73 65 20 73 74 72 75 63 74 75 72 65 20 | re.3-33::,......whose.structure. |
| c6f00 | 69 73 20 73 68 6f 77 6e 20 62 79 20 74 68 65 20 61 63 63 6f 6d 70 61 6e 79 69 6e 67 20 73 69 67 | is.shown.by.the.accompanying.sig |
| c6f20 | 6e 61 6c 2d 66 6c 6f 77 20 64 69 61 67 72 61 6d 2e 0a 0a 20 20 20 20 20 57 72 69 74 65 20 61 20 | nal-flow.diagram........Write.a. |
| c6f40 | 70 72 6f 63 65 64 75 72 65 20 60 52 43 27 20 74 68 61 74 20 6d 6f 64 65 6c 73 20 74 68 69 73 20 | procedure.`RC'.that.models.this. |
| c6f60 | 63 69 72 63 75 69 74 2e 20 20 60 52 43 27 20 73 68 6f 75 6c 64 20 74 61 6b 65 0a 20 20 20 20 20 | circuit...`RC'.should.take...... |
| c6f80 | 61 73 20 69 6e 70 75 74 73 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 52 2c 20 43 2c 20 61 6e | as.inputs.the.values.of.R,.C,.an |
| c6fa0 | 64 20 64 74 20 61 6e 64 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 20 70 72 6f 63 65 64 75 | d.dt.and.should.return.a.procedu |
| c6fc0 | 72 65 0a 20 20 20 20 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 73 20 61 20 73 | re......that.takes.as.inputs.a.s |
| c6fe0 | 74 72 65 61 6d 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 65 20 63 75 72 72 65 6e 74 20 69 | tream.representing.the.current.i |
| c7000 | 20 61 6e 64 20 61 6e 0a 20 20 20 20 20 69 6e 69 74 69 61 6c 20 76 61 6c 75 65 20 66 6f 72 20 74 | .and.an......initial.value.for.t |
| c7020 | 68 65 20 63 61 70 61 63 69 74 6f 72 20 76 6f 6c 74 61 67 65 20 76 5f 30 20 61 6e 64 20 70 72 6f | he.capacitor.voltage.v_0.and.pro |
| c7040 | 64 75 63 65 73 20 61 73 20 6f 75 74 70 75 74 0a 20 20 20 20 20 74 68 65 20 73 74 72 65 61 6d 20 | duces.as.output......the.stream. |
| c7060 | 6f 66 20 76 6f 6c 74 61 67 65 73 20 76 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 79 6f 75 | of.voltages.v...For.example,.you |
| c7080 | 20 73 68 6f 75 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 75 73 65 0a 20 20 20 20 20 60 52 43 27 | .should.be.able.to.use......`RC' |
| c70a0 | 20 74 6f 20 6d 6f 64 65 6c 20 61 6e 20 52 43 20 63 69 72 63 75 69 74 20 77 69 74 68 20 52 20 3d | .to.model.an.RC.circuit.with.R.= |
| c70c0 | 20 35 20 6f 68 6d 73 2c 20 43 20 3d 20 31 20 66 61 72 61 64 2c 20 61 6e 64 20 61 0a 20 20 20 20 | .5.ohms,.C.=.1.farad,.and.a..... |
| c70e0 | 20 30 2e 35 2d 73 65 63 6f 6e 64 20 74 69 6d 65 20 73 74 65 70 20 62 79 20 65 76 61 6c 75 61 74 | .0.5-second.time.step.by.evaluat |
| c7100 | 69 6e 67 20 60 28 64 65 66 69 6e 65 20 52 43 31 20 28 52 43 20 35 20 31 20 30 2e 35 29 29 27 2e | ing.`(define.RC1.(RC.5.1.0.5))'. |
| c7120 | 0a 20 20 20 20 20 54 68 69 73 20 64 65 66 69 6e 65 73 20 60 52 43 31 27 20 61 73 20 61 20 70 72 | ......This.defines.`RC1'.as.a.pr |
| c7140 | 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 20 61 20 73 74 72 65 61 6d 20 72 65 70 72 | ocedure.that.takes.a.stream.repr |
| c7160 | 65 73 65 6e 74 69 6e 67 0a 20 20 20 20 20 74 68 65 20 74 69 6d 65 20 73 65 71 75 65 6e 63 65 20 | esenting......the.time.sequence. |
| c7180 | 6f 66 20 63 75 72 72 65 6e 74 73 20 61 6e 64 20 61 6e 20 69 6e 69 74 69 61 6c 20 63 61 70 61 63 | of.currents.and.an.initial.capac |
| c71a0 | 69 74 6f 72 20 76 6f 6c 74 61 67 65 20 61 6e 64 0a 20 20 20 20 20 70 72 6f 64 75 63 65 73 20 74 | itor.voltage.and......produces.t |
| c71c0 | 68 65 20 6f 75 74 70 75 74 20 73 74 72 65 61 6d 20 6f 66 20 76 6f 6c 74 61 67 65 73 2e 0a 0a 20 | he.output.stream.of.voltages.... |
| c71e0 | 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 33 33 3a 2a 20 41 6e 20 52 43 20 63 69 72 63 75 69 74 | ....*Figure.3.33:*.An.RC.circuit |
| c7200 | 20 61 6e 64 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 73 69 67 6e 61 6c 2d 66 6c 6f 77 0a | .and.the.associated.signal-flow. |
| c7220 | 20 20 20 20 20 64 69 61 67 72 61 6d 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 2b 20 20 20 20 | .....diagram...............+.... |
| c7240 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2d 0a 20 20 20 20 20 20 20 20 20 20 20 2d 3e 2d 2d 2d 2d | .............-............->---- |
| c7260 | 27 5c 2f 5c 2f 5c 2c 2d 2d 2d 7c 20 7c 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 20 20 | '\/\/\,---|.|---.............i.. |
| c7280 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...............C................ |
| c72a0 | 20 20 20 20 20 20 20 20 20 20 2f 20 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........../.t................... |
| c72c0 | 20 20 20 20 20 20 7c 20 20 69 0a 20 20 20 20 20 20 20 20 20 20 20 76 20 20 3d 20 20 76 20 20 20 | ......|..i............v..=..v... |
| c72e0 | 2b 20 20 7c 20 20 20 20 20 20 64 74 20 2b 20 52 20 69 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | +..|......dt.+.R.i.............. |
| c7300 | 20 20 20 20 20 30 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....0.....|.................... |
| c7320 | 20 20 20 20 20 2f 20 30 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | ...../.0.....................+-- |
| c7340 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | ------------+................+-- |
| c7360 | 3e 7c 20 20 20 73 63 61 6c 65 3a 20 52 20 20 20 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | >|...scale:.R...|--------------- |
| c7380 | 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 5c 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ------+...|\_................|.. |
| c73a0 | 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .+--------------+............... |
| c73c0 | 20 20 20 20 20 20 7c 20 20 20 7c 20 20 5c 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | ......|...|..\_................| |
| c73e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c7400 | 20 20 20 20 20 20 20 20 2b 2d 2d 3e 7c 20 20 20 20 5c 20 20 20 76 0a 20 20 20 20 20 20 20 20 20 | ........+-->|....\...v.......... |
| c7420 | 20 20 20 69 20 20 7c 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 2b | ...i..|...+--------------+.....+ |
| c7440 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 7c 20 61 64 64 20 3e 2d 2d 2d 3e 0a 20 | ------------+......|.add.>--->.. |
| c7460 | 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2b 2d 2d 3e 7c 20 20 73 63 61 6c 65 3a 20 31 2f 43 20 | ..........----+-->|..scale:.1/C. |
| c7480 | 20 7c 2d 2d 2d 2d 3e 7c 20 20 69 6e 74 65 67 72 61 6c 20 20 7c 2d 2d 2d 2d 2d 3e 7c 20 20 20 5f | .|---->|..integral..|----->|..._ |
| c74a0 | 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | /....................+---------- |
| c74c0 | 2d 2d 2d 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 7c 20 | ----+.....+------------+......|. |
| c74e0 | 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | _/.............................. |
| c7500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | ...............................| |
| c7520 | 2f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 37 34 3a 2a 20 41 6c 79 73 73 61 20 | /.......*Exercise.3.74:*.Alyssa. |
| c7540 | 50 2e 20 48 61 63 6b 65 72 20 69 73 20 64 65 73 69 67 6e 69 6e 67 20 61 20 73 79 73 74 65 6d 20 | P..Hacker.is.designing.a.system. |
| c7560 | 74 6f 20 70 72 6f 63 65 73 73 0a 20 20 20 20 20 73 69 67 6e 61 6c 73 20 63 6f 6d 69 6e 67 20 66 | to.process......signals.coming.f |
| c7580 | 72 6f 6d 20 70 68 79 73 69 63 61 6c 20 73 65 6e 73 6f 72 73 2e 20 20 4f 6e 65 20 69 6d 70 6f 72 | rom.physical.sensors...One.impor |
| c75a0 | 74 61 6e 74 20 66 65 61 74 75 72 65 20 73 68 65 0a 20 20 20 20 20 77 69 73 68 65 73 20 74 6f 20 | tant.feature.she......wishes.to. |
| c75c0 | 70 72 6f 64 75 63 65 20 69 73 20 61 20 73 69 67 6e 61 6c 20 74 68 61 74 20 64 65 73 63 72 69 62 | produce.is.a.signal.that.describ |
| c75e0 | 65 73 20 74 68 65 20 22 7a 65 72 6f 20 63 72 6f 73 73 69 6e 67 73 22 0a 20 20 20 20 20 6f 66 20 | es.the."zero.crossings"......of. |
| c7600 | 74 68 65 20 69 6e 70 75 74 20 73 69 67 6e 61 6c 2e 20 20 54 68 61 74 20 69 73 2c 20 74 68 65 20 | the.input.signal...That.is,.the. |
| c7620 | 72 65 73 75 6c 74 69 6e 67 20 73 69 67 6e 61 6c 20 73 68 6f 75 6c 64 20 62 65 20 2b 20 31 0a 20 | resulting.signal.should.be.+.1.. |
| c7640 | 20 20 20 20 77 68 65 6e 65 76 65 72 20 74 68 65 20 69 6e 70 75 74 20 73 69 67 6e 61 6c 20 63 68 | ....whenever.the.input.signal.ch |
| c7660 | 61 6e 67 65 73 20 66 72 6f 6d 20 6e 65 67 61 74 69 76 65 20 74 6f 20 70 6f 73 69 74 69 76 65 2c | anges.from.negative.to.positive, |
| c7680 | 20 2d 20 31 0a 20 20 20 20 20 77 68 65 6e 65 76 65 72 20 74 68 65 20 69 6e 70 75 74 20 73 69 67 | .-.1......whenever.the.input.sig |
| c76a0 | 6e 61 6c 20 63 68 61 6e 67 65 73 20 66 72 6f 6d 20 70 6f 73 69 74 69 76 65 20 74 6f 20 6e 65 67 | nal.changes.from.positive.to.neg |
| c76c0 | 61 74 69 76 65 2c 20 61 6e 64 20 30 0a 20 20 20 20 20 6f 74 68 65 72 77 69 73 65 2e 20 20 28 41 | ative,.and.0......otherwise...(A |
| c76e0 | 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 20 73 69 67 6e 20 6f 66 20 61 20 30 20 69 6e 70 75 74 | ssume.that.the.sign.of.a.0.input |
| c7700 | 20 69 73 20 70 6f 73 69 74 69 76 65 2e 29 20 20 46 6f 72 0a 20 20 20 20 20 65 78 61 6d 70 6c 65 | .is.positive.)..For......example |
| c7720 | 2c 20 61 20 74 79 70 69 63 61 6c 20 69 6e 70 75 74 20 73 69 67 6e 61 6c 20 77 69 74 68 20 69 74 | ,.a.typical.input.signal.with.it |
| c7740 | 73 20 61 73 73 6f 63 69 61 74 65 64 20 7a 65 72 6f 2d 63 72 6f 73 73 69 6e 67 0a 20 20 20 20 20 | s.associated.zero-crossing...... |
| c7760 | 73 69 67 6e 61 6c 20 77 6f 75 6c 64 20 62 65 0a 0a 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 20 31 | signal.would.be................1 |
| c7780 | 20 20 32 20 20 31 2e 35 20 20 31 20 20 30 2e 35 20 20 2d 30 2e 31 20 20 2d 32 20 20 2d 33 20 20 | ..2..1.5..1..0.5..-0.1..-2..-3.. |
| c77a0 | 2d 32 20 20 2d 30 2e 35 20 20 30 2e 32 20 20 33 20 20 34 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 | -2..-0.5..0.2..3..4............. |
| c77c0 | 20 20 2e 2e 2e 20 20 30 20 20 30 20 20 20 20 30 20 20 30 20 20 20 20 30 20 20 20 20 20 2d 31 20 | .......0..0....0..0....0.....-1. |
| c77e0 | 20 30 20 20 20 30 20 20 20 30 20 20 20 20 20 30 20 20 20 20 31 20 20 30 20 20 30 20 2e 2e 2e 0a | .0...0...0.....0....1..0..0..... |
| c7800 | 0a 20 20 20 20 20 49 6e 20 41 6c 79 73 73 61 27 73 20 73 79 73 74 65 6d 2c 20 74 68 65 20 73 69 | ......In.Alyssa's.system,.the.si |
| c7820 | 67 6e 61 6c 20 66 72 6f 6d 20 74 68 65 20 73 65 6e 73 6f 72 20 69 73 20 72 65 70 72 65 73 65 6e | gnal.from.the.sensor.is.represen |
| c7840 | 74 65 64 20 61 73 20 61 0a 20 20 20 20 20 73 74 72 65 61 6d 20 60 73 65 6e 73 65 2d 64 61 74 61 | ted.as.a......stream.`sense-data |
| c7860 | 27 20 61 6e 64 20 74 68 65 20 73 74 72 65 61 6d 20 60 7a 65 72 6f 2d 63 72 6f 73 73 69 6e 67 73 | '.and.the.stream.`zero-crossings |
| c7880 | 27 20 69 73 20 74 68 65 0a 20 20 20 20 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 73 74 72 65 | '.is.the......corresponding.stre |
| c78a0 | 61 6d 20 6f 66 20 7a 65 72 6f 20 63 72 6f 73 73 69 6e 67 73 2e 20 20 41 6c 79 73 73 61 20 66 69 | am.of.zero.crossings...Alyssa.fi |
| c78c0 | 72 73 74 20 77 72 69 74 65 73 20 61 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 60 73 69 67 | rst.writes.a......procedure.`sig |
| c78e0 | 6e 2d 63 68 61 6e 67 65 2d 64 65 74 65 63 74 6f 72 27 20 74 68 61 74 20 74 61 6b 65 73 20 74 77 | n-change-detector'.that.takes.tw |
| c7900 | 6f 20 76 61 6c 75 65 73 20 61 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 63 | o.values.as......arguments.and.c |
| c7920 | 6f 6d 70 61 72 65 73 20 74 68 65 20 73 69 67 6e 73 20 6f 66 20 74 68 65 20 76 61 6c 75 65 73 20 | ompares.the.signs.of.the.values. |
| c7940 | 74 6f 20 70 72 6f 64 75 63 65 20 61 6e 0a 20 20 20 20 20 61 70 70 72 6f 70 72 69 61 74 65 20 30 | to.produce.an......appropriate.0 |
| c7960 | 2c 20 31 2c 20 6f 72 20 2d 20 31 2e 20 20 53 68 65 20 74 68 65 6e 20 63 6f 6e 73 74 72 75 63 74 | ,.1,.or.-.1...She.then.construct |
| c7980 | 73 20 68 65 72 20 7a 65 72 6f 2d 63 72 6f 73 73 69 6e 67 0a 20 20 20 20 20 73 74 72 65 61 6d 20 | s.her.zero-crossing......stream. |
| c79a0 | 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | as.follows:............(define.( |
| c79c0 | 6d 61 6b 65 2d 7a 65 72 6f 2d 63 72 6f 73 73 69 6e 67 73 20 69 6e 70 75 74 2d 73 74 72 65 61 6d | make-zero-crossings.input-stream |
| c79e0 | 20 6c 61 73 74 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 | .last-value).............(cons-s |
| c7a00 | 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 67 6e 2d 63 68 61 6e 67 65 2d | tream..............(sign-change- |
| c7a20 | 64 65 74 65 63 74 6f 72 20 28 73 74 72 65 61 6d 2d 63 61 72 20 69 6e 70 75 74 2d 73 74 72 65 61 | detector.(stream-car.input-strea |
| c7a40 | 6d 29 20 6c 61 73 74 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b | m).last-value)..............(mak |
| c7a60 | 65 2d 7a 65 72 6f 2d 63 72 6f 73 73 69 6e 67 73 20 28 73 74 72 65 61 6d 2d 63 64 72 20 69 6e 70 | e-zero-crossings.(stream-cdr.inp |
| c7a80 | 75 74 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ut-stream)...................... |
| c7aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 61 72 20 69 6e 70 75 74 2d 73 | .............(stream-car.input-s |
| c7ac0 | 74 72 65 61 6d 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 7a 65 72 | tream))))............(define.zer |
| c7ae0 | 6f 2d 63 72 6f 73 73 69 6e 67 73 20 28 6d 61 6b 65 2d 7a 65 72 6f 2d 63 72 6f 73 73 69 6e 67 73 | o-crossings.(make-zero-crossings |
| c7b00 | 20 73 65 6e 73 65 2d 64 61 74 61 20 30 29 29 0a 0a 20 20 20 20 20 41 6c 79 73 73 61 27 73 20 62 | .sense-data.0)).......Alyssa's.b |
| c7b20 | 6f 73 73 2c 20 45 76 61 20 4c 75 20 41 74 6f 72 2c 20 77 61 6c 6b 73 20 62 79 20 61 6e 64 20 73 | oss,.Eva.Lu.Ator,.walks.by.and.s |
| c7b40 | 75 67 67 65 73 74 73 20 74 68 61 74 20 74 68 69 73 0a 20 20 20 20 20 70 72 6f 67 72 61 6d 20 69 | uggests.that.this......program.i |
| c7b60 | 73 20 61 70 70 72 6f 78 69 6d 61 74 65 6c 79 20 65 71 75 69 76 61 6c 65 6e 74 20 74 6f 20 74 68 | s.approximately.equivalent.to.th |
| c7b80 | 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6f 6e 65 2c 20 77 68 69 63 68 0a 20 20 20 20 20 75 73 65 73 | e.following.one,.which......uses |
| c7ba0 | 20 74 68 65 20 67 65 6e 65 72 61 6c 69 7a 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 60 73 74 72 | .the.generalized.version.of.`str |
| c7bc0 | 65 61 6d 2d 6d 61 70 27 20 66 72 6f 6d 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 20 20 20 | eam-map'.from.*Note.Exercise.... |
| c7be0 | 20 20 33 2d 35 30 3a 3a 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 7a 65 72 | ..3-50:::............(define.zer |
| c7c00 | 6f 2d 63 72 6f 73 73 69 6e 67 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d | o-crossings.............(stream- |
| c7c20 | 6d 61 70 20 73 69 67 6e 2d 63 68 61 6e 67 65 2d 64 65 74 65 63 74 6f 72 20 73 65 6e 73 65 2d 64 | map.sign-change-detector.sense-d |
| c7c40 | 61 74 61 20 3c 45 58 50 52 45 53 53 49 4f 4e 3e 29 29 0a 0a 20 20 20 20 20 43 6f 6d 70 6c 65 74 | ata.<EXPRESSION>)).......Complet |
| c7c60 | 65 20 74 68 65 20 70 72 6f 67 72 61 6d 20 62 79 20 73 75 70 70 6c 79 69 6e 67 20 74 68 65 20 69 | e.the.program.by.supplying.the.i |
| c7c80 | 6e 64 69 63 61 74 65 64 20 3c 45 58 50 52 45 53 53 49 4f 4e 3e 2e 0a 0a 20 20 20 20 20 2a 45 78 | ndicated.<EXPRESSION>........*Ex |
| c7ca0 | 65 72 63 69 73 65 20 33 2e 37 35 3a 2a 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 41 6c 79 | ercise.3.75:*.Unfortunately,.Aly |
| c7cc0 | 73 73 61 27 73 20 7a 65 72 6f 2d 63 72 6f 73 73 69 6e 67 20 64 65 74 65 63 74 6f 72 20 69 6e 0a | ssa's.zero-crossing.detector.in. |
| c7ce0 | 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 37 34 3a 3a 20 70 72 6f 76 65 | .....*Note.Exercise.3-74::.prove |
| c7d00 | 73 20 74 6f 20 62 65 20 69 6e 73 75 66 66 69 63 69 65 6e 74 2c 20 62 65 63 61 75 73 65 20 74 68 | s.to.be.insufficient,.because.th |
| c7d20 | 65 20 6e 6f 69 73 79 0a 20 20 20 20 20 73 69 67 6e 61 6c 20 66 72 6f 6d 20 74 68 65 20 73 65 6e | e.noisy......signal.from.the.sen |
| c7d40 | 73 6f 72 20 6c 65 61 64 73 20 74 6f 20 73 70 75 72 69 6f 75 73 20 7a 65 72 6f 20 63 72 6f 73 73 | sor.leads.to.spurious.zero.cross |
| c7d60 | 69 6e 67 73 2e 20 20 4c 65 6d 20 45 2e 0a 20 20 20 20 20 54 77 65 61 6b 69 74 2c 20 61 20 68 61 | ings...Lem.E.......Tweakit,.a.ha |
| c7d80 | 72 64 77 61 72 65 20 73 70 65 63 69 61 6c 69 73 74 2c 20 73 75 67 67 65 73 74 73 20 74 68 61 74 | rdware.specialist,.suggests.that |
| c7da0 | 20 41 6c 79 73 73 61 20 73 6d 6f 6f 74 68 20 74 68 65 0a 20 20 20 20 20 73 69 67 6e 61 6c 20 74 | .Alyssa.smooth.the......signal.t |
| c7dc0 | 6f 20 66 69 6c 74 65 72 20 6f 75 74 20 74 68 65 20 6e 6f 69 73 65 20 62 65 66 6f 72 65 20 65 78 | o.filter.out.the.noise.before.ex |
| c7de0 | 74 72 61 63 74 69 6e 67 20 74 68 65 20 7a 65 72 6f 0a 20 20 20 20 20 63 72 6f 73 73 69 6e 67 73 | tracting.the.zero......crossings |
| c7e00 | 2e 20 20 41 6c 79 73 73 61 20 74 61 6b 65 73 20 68 69 73 20 61 64 76 69 63 65 20 61 6e 64 20 64 | ...Alyssa.takes.his.advice.and.d |
| c7e20 | 65 63 69 64 65 73 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 0a 20 20 20 20 20 7a 65 72 6f 20 | ecides.to.extract.the......zero. |
| c7e40 | 63 72 6f 73 73 69 6e 67 73 20 66 72 6f 6d 20 74 68 65 20 73 69 67 6e 61 6c 20 63 6f 6e 73 74 72 | crossings.from.the.signal.constr |
| c7e60 | 75 63 74 65 64 20 62 79 20 61 76 65 72 61 67 69 6e 67 20 65 61 63 68 20 76 61 6c 75 65 0a 20 20 | ucted.by.averaging.each.value... |
| c7e80 | 20 20 20 6f 66 20 74 68 65 20 73 65 6e 73 65 20 64 61 74 61 20 77 69 74 68 20 74 68 65 20 70 72 | ...of.the.sense.data.with.the.pr |
| c7ea0 | 65 76 69 6f 75 73 20 76 61 6c 75 65 2e 20 20 53 68 65 20 65 78 70 6c 61 69 6e 73 20 74 68 65 0a | evious.value...She.explains.the. |
| c7ec0 | 20 20 20 20 20 70 72 6f 62 6c 65 6d 20 74 6f 20 68 65 72 20 61 73 73 69 73 74 61 6e 74 2c 20 4c | .....problem.to.her.assistant,.L |
| c7ee0 | 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 2c 20 77 68 6f 20 61 74 74 65 6d 70 74 73 20 74 6f 0a 20 | ouis.Reasoner,.who.attempts.to.. |
| c7f00 | 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 69 64 65 61 2c 20 61 6c 74 65 72 69 6e 67 | ....implement.the.idea,.altering |
| c7f20 | 20 41 6c 79 73 73 61 27 73 20 70 72 6f 67 72 61 6d 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 | .Alyssa's.program.as.follows:... |
| c7f40 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 7a 65 72 6f 2d 63 72 6f 73 | .........(define.(make-zero-cros |
| c7f60 | 73 69 6e 67 73 20 69 6e 70 75 74 2d 73 74 72 65 61 6d 20 6c 61 73 74 2d 76 61 6c 75 65 29 0a 20 | sings.input-stream.last-value).. |
| c7f80 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 61 76 70 74 20 28 2f 20 28 2b 20 28 73 74 | ...........(let.((avpt.(/.(+.(st |
| c7fa0 | 72 65 61 6d 2d 63 61 72 20 69 6e 70 75 74 2d 73 74 72 65 61 6d 29 20 6c 61 73 74 2d 76 61 6c 75 | ream-car.input-stream).last-valu |
| c7fc0 | 65 29 20 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 | e).2)))...............(cons-stre |
| c7fe0 | 61 6d 20 28 73 69 67 6e 2d 63 68 61 6e 67 65 2d 64 65 74 65 63 74 6f 72 20 61 76 70 74 20 6c 61 | am.(sign-change-detector.avpt.la |
| c8000 | 73 74 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | st-value)....................... |
| c8020 | 20 20 20 20 20 28 6d 61 6b 65 2d 7a 65 72 6f 2d 63 72 6f 73 73 69 6e 67 73 20 28 73 74 72 65 61 | .....(make-zero-crossings.(strea |
| c8040 | 6d 2d 63 64 72 20 69 6e 70 75 74 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | m-cdr.input-stream)............. |
| c8060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c8080 | 20 20 20 20 61 76 70 74 29 29 29 29 0a 0a 20 20 20 20 20 54 68 69 73 20 64 6f 65 73 20 6e 6f 74 | ....avpt)))).......This.does.not |
| c80a0 | 20 63 6f 72 72 65 63 74 6c 79 20 69 6d 70 6c 65 6d 65 6e 74 20 41 6c 79 73 73 61 27 73 20 70 6c | .correctly.implement.Alyssa's.pl |
| c80c0 | 61 6e 2e 20 20 46 69 6e 64 20 74 68 65 20 62 75 67 0a 20 20 20 20 20 74 68 61 74 20 4c 6f 75 69 | an...Find.the.bug......that.Loui |
| c80e0 | 73 20 68 61 73 20 69 6e 73 74 61 6c 6c 65 64 20 61 6e 64 20 66 69 78 20 69 74 20 77 69 74 68 6f | s.has.installed.and.fix.it.witho |
| c8100 | 75 74 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 73 74 72 75 63 74 75 72 65 0a 20 20 20 20 20 6f | ut.changing.the.structure......o |
| c8120 | 66 20 74 68 65 20 70 72 6f 67 72 61 6d 2e 20 20 28 48 69 6e 74 3a 20 59 6f 75 20 77 69 6c 6c 20 | f.the.program...(Hint:.You.will. |
| c8140 | 6e 65 65 64 20 74 6f 20 69 6e 63 72 65 61 73 65 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 0a 20 | need.to.increase.the.number.of.. |
| c8160 | 20 20 20 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 60 6d 61 6b 65 2d 7a 65 72 6f 2d 63 72 6f 73 | ....arguments.to.`make-zero-cros |
| c8180 | 73 69 6e 67 73 27 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 37 36 3a 2a 20 | sings'.).......*Exercise.3.76:*. |
| c81a0 | 45 76 61 20 4c 75 20 41 74 6f 72 20 68 61 73 20 61 20 63 72 69 74 69 63 69 73 6d 20 6f 66 20 4c | Eva.Lu.Ator.has.a.criticism.of.L |
| c81c0 | 6f 75 69 73 27 73 20 61 70 70 72 6f 61 63 68 0a 20 20 20 20 20 69 6e 20 2a 4e 6f 74 65 20 45 78 | ouis's.approach......in.*Note.Ex |
| c81e0 | 65 72 63 69 73 65 20 33 2d 37 35 3a 3a 2e 20 20 54 68 65 20 70 72 6f 67 72 61 6d 20 68 65 20 77 | ercise.3-75::...The.program.he.w |
| c8200 | 72 6f 74 65 20 69 73 20 6e 6f 74 20 6d 6f 64 75 6c 61 72 2c 0a 20 20 20 20 20 62 65 63 61 75 73 | rote.is.not.modular,......becaus |
| c8220 | 65 20 69 74 20 69 6e 74 65 72 6d 69 78 65 73 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 6f 66 | e.it.intermixes.the.operation.of |
| c8240 | 20 73 6d 6f 6f 74 68 69 6e 67 20 77 69 74 68 20 74 68 65 0a 20 20 20 20 20 7a 65 72 6f 2d 63 72 | .smoothing.with.the......zero-cr |
| c8260 | 6f 73 73 69 6e 67 20 65 78 74 72 61 63 74 69 6f 6e 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c | ossing.extraction...For.example, |
| c8280 | 20 74 68 65 20 65 78 74 72 61 63 74 6f 72 20 73 68 6f 75 6c 64 20 6e 6f 74 0a 20 20 20 20 20 68 | .the.extractor.should.not......h |
| c82a0 | 61 76 65 20 74 6f 20 62 65 20 63 68 61 6e 67 65 64 20 69 66 20 41 6c 79 73 73 61 20 66 69 6e 64 | ave.to.be.changed.if.Alyssa.find |
| c82c0 | 73 20 61 20 62 65 74 74 65 72 20 77 61 79 20 74 6f 20 63 6f 6e 64 69 74 69 6f 6e 20 68 65 72 0a | s.a.better.way.to.condition.her. |
| c82e0 | 20 20 20 20 20 69 6e 70 75 74 20 73 69 67 6e 61 6c 2e 20 20 48 65 6c 70 20 4c 6f 75 69 73 20 62 | .....input.signal...Help.Louis.b |
| c8300 | 79 20 77 72 69 74 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 73 6d 6f 6f 74 68 27 20 74 | y.writing.a.procedure.`smooth'.t |
| c8320 | 68 61 74 0a 20 20 20 20 20 74 61 6b 65 73 20 61 20 73 74 72 65 61 6d 20 61 73 20 69 6e 70 75 74 | hat......takes.a.stream.as.input |
| c8340 | 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 61 20 73 74 72 65 61 6d 20 69 6e 20 77 68 69 63 68 20 | .and.produces.a.stream.in.which. |
| c8360 | 65 61 63 68 0a 20 20 20 20 20 65 6c 65 6d 65 6e 74 20 69 73 20 74 68 65 20 61 76 65 72 61 67 65 | each......element.is.the.average |
| c8380 | 20 6f 66 20 74 77 6f 20 73 75 63 63 65 73 73 69 76 65 20 69 6e 70 75 74 20 73 74 72 65 61 6d 20 | .of.two.successive.input.stream. |
| c83a0 | 65 6c 65 6d 65 6e 74 73 2e 0a 20 20 20 20 20 54 68 65 6e 20 75 73 65 20 60 73 6d 6f 6f 74 68 27 | elements.......Then.use.`smooth' |
| c83c0 | 20 61 73 20 61 20 63 6f 6d 70 6f 6e 65 6e 74 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 | .as.a.component.to.implement.the |
| c83e0 | 20 7a 65 72 6f 2d 63 72 6f 73 73 69 6e 67 0a 20 20 20 20 20 64 65 74 65 63 74 6f 72 20 69 6e 20 | .zero-crossing......detector.in. |
| c8400 | 61 20 6d 6f 72 65 20 6d 6f 64 75 6c 61 72 20 73 74 79 6c 65 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d | a.more.modular.style......------ |
| c8420 | 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 | ----.Footnotes.----------.....(1 |
| c8440 | 29 20 57 65 20 63 61 6e 27 74 20 75 73 65 20 60 6c 65 74 27 20 74 6f 20 62 69 6e 64 20 74 68 65 | ).We.can't.use.`let'.to.bind.the |
| c8460 | 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 20 60 67 75 65 73 73 65 73 27 2c 20 62 65 63 61 75 | .local.variable.`guesses',.becau |
| c8480 | 73 65 0a 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 67 75 65 73 73 65 73 27 20 64 65 70 65 6e 64 | se.the.value.of.`guesses'.depend |
| c84a0 | 73 20 6f 6e 20 60 67 75 65 73 73 65 73 27 20 69 74 73 65 6c 66 2e 20 20 2a 4e 6f 74 65 20 45 78 | s.on.`guesses'.itself...*Note.Ex |
| c84c0 | 65 72 63 69 73 65 0a 33 2d 36 33 3a 3a 20 61 64 64 72 65 73 73 65 73 20 77 68 79 20 77 65 20 77 | ercise.3-63::.addresses.why.we.w |
| c84e0 | 61 6e 74 20 61 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 20 68 65 72 65 2e 0a 0a 20 20 20 28 | ant.a.local.variable.here......( |
| c8500 | 32 29 20 41 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 33 3a 3a 2c 20 | 2).As.in.section.*Note.2-2-3::,. |
| c8520 | 77 65 20 72 65 70 72 65 73 65 6e 74 20 61 20 70 61 69 72 20 6f 66 20 69 6e 74 65 67 65 72 73 20 | we.represent.a.pair.of.integers. |
| c8540 | 61 73 0a 61 20 6c 69 73 74 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 20 4c 69 73 70 20 70 61 69 | as.a.list.rather.than.a.Lisp.pai |
| c8560 | 72 2e 0a 0a 20 20 20 28 33 29 20 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d | r......(3).See.*Note.Exercise.3- |
| c8580 | 36 38 3a 3a 20 66 6f 72 20 73 6f 6d 65 20 69 6e 73 69 67 68 74 20 69 6e 74 6f 20 77 68 79 20 77 | 68::.for.some.insight.into.why.w |
| c85a0 | 65 20 63 68 6f 73 65 0a 74 68 69 73 20 64 65 63 6f 6d 70 6f 73 69 74 69 6f 6e 2e 0a 0a 20 20 20 | e.chose.this.decomposition...... |
| c85c0 | 28 34 29 20 54 68 65 20 70 72 65 63 69 73 65 20 73 74 61 74 65 6d 65 6e 74 20 6f 66 20 74 68 65 | (4).The.precise.statement.of.the |
| c85e0 | 20 72 65 71 75 69 72 65 64 20 70 72 6f 70 65 72 74 79 20 6f 6e 20 74 68 65 20 6f 72 64 65 72 20 | .required.property.on.the.order. |
| c8600 | 6f 66 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 69 73 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 20 54 68 | of.combination.is.as.follows:.Th |
| c8620 | 65 72 65 20 73 68 6f 75 6c 64 20 62 65 20 61 20 66 75 6e 63 74 69 6f 6e 20 66 20 6f 66 20 74 77 | ere.should.be.a.function.f.of.tw |
| c8640 | 6f 0a 61 72 67 75 6d 65 6e 74 73 20 73 75 63 68 20 74 68 61 74 20 74 68 65 20 70 61 69 72 20 63 | o.arguments.such.that.the.pair.c |
| c8660 | 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 65 6c 65 6d 65 6e 74 20 69 20 6f 66 20 74 68 65 | orresponding.to.element.i.of.the |
| c8680 | 20 66 69 72 73 74 0a 73 74 72 65 61 6d 20 61 6e 64 20 65 6c 65 6d 65 6e 74 20 6a 20 6f 66 20 74 | .first.stream.and.element.j.of.t |
| c86a0 | 68 65 20 73 65 63 6f 6e 64 20 73 74 72 65 61 6d 20 77 69 6c 6c 20 61 70 70 65 61 72 20 61 73 20 | he.second.stream.will.appear.as. |
| c86c0 | 65 6c 65 6d 65 6e 74 20 6e 75 6d 62 65 72 0a 66 28 69 2c 6a 29 20 6f 66 20 74 68 65 20 6f 75 74 | element.number.f(i,j).of.the.out |
| c86e0 | 70 75 74 20 73 74 72 65 61 6d 2e 20 20 54 68 65 20 74 72 69 63 6b 20 6f 66 20 75 73 69 6e 67 20 | put.stream...The.trick.of.using. |
| c8700 | 60 69 6e 74 65 72 6c 65 61 76 65 27 20 74 6f 0a 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 20 | `interleave'.to.accomplish.this. |
| c8720 | 77 61 73 20 73 68 6f 77 6e 20 74 6f 20 75 73 20 62 79 20 44 61 76 69 64 20 54 75 72 6e 65 72 2c | was.shown.to.us.by.David.Turner, |
| c8740 | 20 77 68 6f 20 65 6d 70 6c 6f 79 65 64 20 69 74 20 69 6e 20 74 68 65 0a 6c 61 6e 67 75 61 67 65 | .who.employed.it.in.the.language |
| c8760 | 20 4b 52 43 20 28 54 75 72 6e 65 72 20 31 39 38 31 29 2e 0a 0a 20 20 20 28 35 29 20 57 65 20 77 | .KRC.(Turner.1981)......(5).We.w |
| c8780 | 69 6c 6c 20 72 65 71 75 69 72 65 20 74 68 61 74 20 74 68 65 20 77 65 69 67 68 74 69 6e 67 20 66 | ill.require.that.the.weighting.f |
| c87a0 | 75 6e 63 74 69 6f 6e 20 62 65 20 73 75 63 68 20 74 68 61 74 20 74 68 65 0a 77 65 69 67 68 74 20 | unction.be.such.that.the.weight. |
| c87c0 | 6f 66 20 61 20 70 61 69 72 20 69 6e 63 72 65 61 73 65 73 20 61 73 20 77 65 20 6d 6f 76 65 20 6f | of.a.pair.increases.as.we.move.o |
| c87e0 | 75 74 20 61 6c 6f 6e 67 20 61 20 72 6f 77 20 6f 72 20 64 6f 77 6e 20 61 6c 6f 6e 67 20 61 0a 63 | ut.along.a.row.or.down.along.a.c |
| c8800 | 6f 6c 75 6d 6e 20 6f 66 20 74 68 65 20 61 72 72 61 79 20 6f 66 20 70 61 69 72 73 2e 0a 0a 20 20 | olumn.of.the.array.of.pairs..... |
| c8820 | 20 28 36 29 20 54 6f 20 71 75 6f 74 65 20 66 72 6f 6d 20 47 2e 20 48 2e 20 48 61 72 64 79 27 73 | .(6).To.quote.from.G..H..Hardy's |
| c8840 | 20 6f 62 69 74 75 61 72 79 20 6f 66 20 52 61 6d 61 6e 75 6a 61 6e 20 28 48 61 72 64 79 20 31 39 | .obituary.of.Ramanujan.(Hardy.19 |
| c8860 | 32 31 29 3a 0a 22 49 74 20 77 61 73 20 4d 72 2e 20 4c 69 74 74 6c 65 77 6f 6f 64 20 28 49 20 62 | 21):."It.was.Mr..Littlewood.(I.b |
| c8880 | 65 6c 69 65 76 65 29 20 77 68 6f 20 72 65 6d 61 72 6b 65 64 20 74 68 61 74 20 60 65 76 65 72 79 | elieve).who.remarked.that.`every |
| c88a0 | 20 70 6f 73 69 74 69 76 65 0a 69 6e 74 65 67 65 72 20 77 61 73 20 6f 6e 65 20 6f 66 20 68 69 73 | .positive.integer.was.one.of.his |
| c88c0 | 20 66 72 69 65 6e 64 73 2e 27 20 20 49 20 72 65 6d 65 6d 62 65 72 20 6f 6e 63 65 20 67 6f 69 6e | .friends.'..I.remember.once.goin |
| c88e0 | 67 20 74 6f 20 73 65 65 20 68 69 6d 20 77 68 65 6e 0a 68 65 20 77 61 73 20 6c 79 69 6e 67 20 69 | g.to.see.him.when.he.was.lying.i |
| c8900 | 6c 6c 20 61 74 20 50 75 74 6e 65 79 2e 20 20 49 20 68 61 64 20 72 69 64 64 65 6e 20 69 6e 20 74 | ll.at.Putney...I.had.ridden.in.t |
| c8920 | 61 78 69 2d 63 61 62 20 4e 6f 2e 20 31 37 32 39 2c 20 61 6e 64 0a 72 65 6d 61 72 6b 65 64 20 74 | axi-cab.No..1729,.and.remarked.t |
| c8940 | 68 61 74 20 74 68 65 20 6e 75 6d 62 65 72 20 73 65 65 6d 65 64 20 74 6f 20 6d 65 20 61 20 72 61 | hat.the.number.seemed.to.me.a.ra |
| c8960 | 74 68 65 72 20 64 75 6c 6c 20 6f 6e 65 2c 20 61 6e 64 20 74 68 61 74 20 49 0a 68 6f 70 65 64 20 | ther.dull.one,.and.that.I.hoped. |
| c8980 | 69 74 20 77 61 73 20 6e 6f 74 20 61 6e 20 75 6e 66 61 76 6f 72 61 62 6c 65 20 6f 6d 65 6e 2e 20 | it.was.not.an.unfavorable.omen.. |
| c89a0 | 20 60 4e 6f 2c 27 20 68 65 20 72 65 70 6c 69 65 64 2c 20 60 69 74 20 69 73 20 61 20 76 65 72 79 | .`No,'.he.replied,.`it.is.a.very |
| c89c0 | 0a 69 6e 74 65 72 65 73 74 69 6e 67 20 6e 75 6d 62 65 72 3b 20 69 74 20 69 73 20 74 68 65 20 73 | .interesting.number;.it.is.the.s |
| c89e0 | 6d 61 6c 6c 65 73 74 20 6e 75 6d 62 65 72 20 65 78 70 72 65 73 73 69 62 6c 65 20 61 73 20 74 68 | mallest.number.expressible.as.th |
| c8a00 | 65 20 73 75 6d 20 6f 66 0a 74 77 6f 20 63 75 62 65 73 20 69 6e 20 74 77 6f 20 64 69 66 66 65 72 | e.sum.of.two.cubes.in.two.differ |
| c8a20 | 65 6e 74 20 77 61 79 73 2e 27 20 20 22 20 54 68 65 20 74 72 69 63 6b 20 6f 66 20 75 73 69 6e 67 | ent.ways.'..".The.trick.of.using |
| c8a40 | 20 77 65 69 67 68 74 65 64 20 70 61 69 72 73 0a 74 6f 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 | .weighted.pairs.to.generate.the. |
| c8a60 | 52 61 6d 61 6e 75 6a 61 6e 20 6e 75 6d 62 65 72 73 20 77 61 73 20 73 68 6f 77 6e 20 74 6f 20 75 | Ramanujan.numbers.was.shown.to.u |
| c8a80 | 73 20 62 79 20 43 68 61 72 6c 65 73 20 4c 65 69 73 65 72 73 6f 6e 2e 0a 0a 1f 0a 46 69 6c 65 3a | s.by.Charles.Leiserson.....File: |
| c8aa0 | 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 35 2d 34 2c 20 20 4e 65 78 74 3a | .sicp.info,..Node:.3-5-4,..Next: |
| c8ac0 | 20 33 2d 35 2d 35 2c 20 20 50 72 65 76 3a 20 33 2d 35 2d 33 2c 20 20 55 70 3a 20 33 2d 35 0a 0a | .3-5-5,..Prev:.3-5-3,..Up:.3-5.. |
| c8ae0 | 33 2e 35 2e 34 20 53 74 72 65 61 6d 73 20 61 6e 64 20 44 65 6c 61 79 65 64 20 45 76 61 6c 75 61 | 3.5.4.Streams.and.Delayed.Evalua |
| c8b00 | 74 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | tion.--------------------------- |
| c8b20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 60 69 6e 74 65 67 72 61 6c 27 20 70 72 6f 63 65 64 | ---------..The.`integral'.proced |
| c8b40 | 75 72 65 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 70 72 65 63 65 64 69 6e 67 20 | ure.at.the.end.of.the.preceding. |
| c8b60 | 73 65 63 74 69 6f 6e 20 73 68 6f 77 73 20 68 6f 77 0a 77 65 20 63 61 6e 20 75 73 65 20 73 74 72 | section.shows.how.we.can.use.str |
| c8b80 | 65 61 6d 73 20 74 6f 20 6d 6f 64 65 6c 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 73 73 69 6e 67 20 | eams.to.model.signal-processing. |
| c8ba0 | 73 79 73 74 65 6d 73 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 0a 66 65 65 64 62 61 63 6b 20 6c 6f | systems.that.contain.feedback.lo |
| c8bc0 | 6f 70 73 2e 20 20 54 68 65 20 66 65 65 64 62 61 63 6b 20 6c 6f 6f 70 20 66 6f 72 20 74 68 65 20 | ops...The.feedback.loop.for.the. |
| c8be0 | 61 64 64 65 72 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a 33 2d 33 32 | adder.shown.in.*Note.Figure.3-32 |
| c8c00 | 3a 3a 20 69 73 20 6d 6f 64 65 6c 65 64 20 62 79 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 60 | ::.is.modeled.by.the.fact.that.` |
| c8c20 | 69 6e 74 65 67 72 61 6c 27 27 73 20 69 6e 74 65 72 6e 61 6c 20 73 74 72 65 61 6d 20 60 69 6e 74 | integral''s.internal.stream.`int |
| c8c40 | 27 0a 69 73 20 64 65 66 69 6e 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 69 74 73 65 6c 66 3a | '.is.defined.in.terms.of.itself: |
| c8c60 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 74 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 2d | .......(define.int........(cons- |
| c8c80 | 73 74 72 65 61 6d 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 | stream.initial-value............ |
| c8ca0 | 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 73 74 72 65 61 6d 73 20 28 73 63 61 6c 65 2d 73 74 72 | .........(add-streams.(scale-str |
| c8cc0 | 65 61 6d 20 69 6e 74 65 67 72 61 6e 64 20 64 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | eam.integrand.dt)............... |
| c8ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 29 29 29 0a 0a 20 20 20 54 68 | ...................int))).....Th |
| c8d00 | 65 20 69 6e 74 65 72 70 72 65 74 65 72 27 73 20 61 62 69 6c 69 74 79 20 74 6f 20 64 65 61 6c 20 | e.interpreter's.ability.to.deal. |
| c8d20 | 77 69 74 68 20 73 75 63 68 20 61 6e 20 69 6d 70 6c 69 63 69 74 20 64 65 66 69 6e 69 74 69 6f 6e | with.such.an.implicit.definition |
| c8d40 | 0a 64 65 70 65 6e 64 73 20 6f 6e 20 74 68 65 20 60 64 65 6c 61 79 27 20 74 68 61 74 20 69 73 20 | .depends.on.the.`delay'.that.is. |
| c8d60 | 69 6e 63 6f 72 70 6f 72 61 74 65 64 20 69 6e 74 6f 20 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 2e | incorporated.into.`cons-stream'. |
| c8d80 | 0a 57 69 74 68 6f 75 74 20 74 68 69 73 20 60 64 65 6c 61 79 27 2c 20 74 68 65 20 69 6e 74 65 72 | .Without.this.`delay',.the.inter |
| c8da0 | 70 72 65 74 65 72 20 63 6f 75 6c 64 20 6e 6f 74 20 63 6f 6e 73 74 72 75 63 74 20 60 69 6e 74 27 | preter.could.not.construct.`int' |
| c8dc0 | 20 62 65 66 6f 72 65 0a 65 76 61 6c 75 61 74 69 6e 67 20 62 6f 74 68 20 61 72 67 75 6d 65 6e 74 | .before.evaluating.both.argument |
| c8de0 | 73 20 74 6f 20 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 2c 20 77 68 69 63 68 20 77 6f 75 6c 64 20 | s.to.`cons-stream',.which.would. |
| c8e00 | 72 65 71 75 69 72 65 20 74 68 61 74 0a 60 69 6e 74 27 20 61 6c 72 65 61 64 79 20 62 65 20 64 65 | require.that.`int'.already.be.de |
| c8e20 | 66 69 6e 65 64 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 60 64 65 6c 61 79 27 20 69 73 20 63 | fined...In.general,.`delay'.is.c |
| c8e40 | 72 75 63 69 61 6c 20 66 6f 72 20 75 73 69 6e 67 0a 73 74 72 65 61 6d 73 20 74 6f 20 6d 6f 64 65 | rucial.for.using.streams.to.mode |
| c8e60 | 6c 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 73 73 69 6e 67 20 73 79 73 74 65 6d 73 20 74 68 61 74 | l.signal-processing.systems.that |
| c8e80 | 20 63 6f 6e 74 61 69 6e 20 6c 6f 6f 70 73 2e 20 20 57 69 74 68 6f 75 74 0a 60 64 65 6c 61 79 27 | .contain.loops...Without.`delay' |
| c8ea0 | 2c 20 6f 75 72 20 6d 6f 64 65 6c 73 20 77 6f 75 6c 64 20 68 61 76 65 20 74 6f 20 62 65 20 66 6f | ,.our.models.would.have.to.be.fo |
| c8ec0 | 72 6d 75 6c 61 74 65 64 20 73 6f 20 74 68 61 74 20 74 68 65 20 69 6e 70 75 74 73 20 74 6f 0a 61 | rmulated.so.that.the.inputs.to.a |
| c8ee0 | 6e 79 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 73 73 69 6e 67 20 63 6f 6d 70 6f 6e 65 6e 74 20 77 | ny.signal-processing.component.w |
| c8f00 | 6f 75 6c 64 20 62 65 20 66 75 6c 6c 79 20 65 76 61 6c 75 61 74 65 64 20 62 65 66 6f 72 65 20 74 | ould.be.fully.evaluated.before.t |
| c8f20 | 68 65 0a 6f 75 74 70 75 74 20 63 6f 75 6c 64 20 62 65 20 70 72 6f 64 75 63 65 64 2e 20 20 54 68 | he.output.could.be.produced...Th |
| c8f40 | 69 73 20 77 6f 75 6c 64 20 6f 75 74 6c 61 77 20 6c 6f 6f 70 73 2e 0a 0a 20 20 20 55 6e 66 6f 72 | is.would.outlaw.loops......Unfor |
| c8f60 | 74 75 6e 61 74 65 6c 79 2c 20 73 74 72 65 61 6d 20 6d 6f 64 65 6c 73 20 6f 66 20 73 79 73 74 65 | tunately,.stream.models.of.syste |
| c8f80 | 6d 73 20 77 69 74 68 20 6c 6f 6f 70 73 20 6d 61 79 20 72 65 71 75 69 72 65 20 75 73 65 73 0a 6f | ms.with.loops.may.require.uses.o |
| c8fa0 | 66 20 60 64 65 6c 61 79 27 20 62 65 79 6f 6e 64 20 74 68 65 20 22 68 69 64 64 65 6e 22 20 60 64 | f.`delay'.beyond.the."hidden".`d |
| c8fc0 | 65 6c 61 79 27 20 73 75 70 70 6c 69 65 64 20 62 79 20 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 2e | elay'.supplied.by.`cons-stream'. |
| c8fe0 | 20 20 46 6f 72 0a 69 6e 73 74 61 6e 63 65 2c 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 33 | ..For.instance,.*Note.Figure.3-3 |
| c9000 | 34 3a 3a 20 73 68 6f 77 73 20 61 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 73 73 69 6e 67 20 73 79 | 4::.shows.a.signal-processing.sy |
| c9020 | 73 74 65 6d 20 66 6f 72 0a 73 6f 6c 76 69 6e 67 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 69 61 | stem.for.solving.the.differentia |
| c9040 | 6c 20 65 71 75 61 74 69 6f 6e 20 64 79 2f 64 74 20 3d 20 66 28 79 29 20 77 68 65 72 65 20 66 20 | l.equation.dy/dt.=.f(y).where.f. |
| c9060 | 69 73 20 61 20 67 69 76 65 6e 0a 66 75 6e 63 74 69 6f 6e 2e 20 20 54 68 65 20 66 69 67 75 72 65 | is.a.given.function...The.figure |
| c9080 | 20 73 68 6f 77 73 20 61 20 6d 61 70 70 69 6e 67 20 63 6f 6d 70 6f 6e 65 6e 74 2c 20 77 68 69 63 | .shows.a.mapping.component,.whic |
| c90a0 | 68 20 61 70 70 6c 69 65 73 20 66 20 74 6f 20 69 74 73 0a 69 6e 70 75 74 20 73 69 67 6e 61 6c 2c | h.applies.f.to.its.input.signal, |
| c90c0 | 20 6c 69 6e 6b 65 64 20 69 6e 20 61 20 66 65 65 64 62 61 63 6b 20 6c 6f 6f 70 20 74 6f 20 61 6e | .linked.in.a.feedback.loop.to.an |
| c90e0 | 20 69 6e 74 65 67 72 61 74 6f 72 20 69 6e 20 61 20 6d 61 6e 6e 65 72 0a 76 65 72 79 20 73 69 6d | .integrator.in.a.manner.very.sim |
| c9100 | 69 6c 61 72 20 74 6f 20 74 68 61 74 20 6f 66 20 74 68 65 20 61 6e 61 6c 6f 67 20 63 6f 6d 70 75 | ilar.to.that.of.the.analog.compu |
| c9120 | 74 65 72 20 63 69 72 63 75 69 74 73 20 74 68 61 74 20 61 72 65 20 61 63 74 75 61 6c 6c 79 0a 75 | ter.circuits.that.are.actually.u |
| c9140 | 73 65 64 20 74 6f 20 73 6f 6c 76 65 20 73 75 63 68 20 65 71 75 61 74 69 6f 6e 73 2e 0a 0a 20 20 | sed.to.solve.such.equations..... |
| c9160 | 20 20 20 2a 46 69 67 75 72 65 20 33 2e 33 34 3a 2a 20 41 6e 20 22 61 6e 61 6c 6f 67 20 63 6f 6d | ...*Figure.3.34:*.An."analog.com |
| c9180 | 70 75 74 65 72 20 63 69 72 63 75 69 74 22 20 74 68 61 74 20 73 6f 6c 76 65 73 20 74 68 65 0a 20 | puter.circuit".that.solves.the.. |
| c91a0 | 20 20 20 20 65 71 75 61 74 69 6f 6e 20 64 79 2f 64 74 20 3d 20 66 28 79 29 2e 0a 0a 20 20 20 20 | ....equation.dy/dt.=.f(y)....... |
| c91c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c91e0 | 20 20 79 5f 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..y_0........................... |
| c9200 | 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............|.................. |
| c9220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 | ......................V......... |
| c9240 | 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 64 79 20 20 20 2b 2d 2d 2d 2d 2d 2d | ......+----------+..dy...+------ |
| c9260 | 2d 2d 2d 2d 2b 20 20 20 20 20 79 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 3e 7c 20 20 6d 61 70 | ----+.....y...........+-->|..map |
| c9280 | 3a 20 66 20 20 2b 2d 2d 2d 2d 2d 2d 3e 7c 20 69 6e 74 65 67 72 61 6c 20 2b 2d 2d 2a 2d 2d 2d 2d | :.f..+------>|.integral.+--*---- |
| c92a0 | 2d 3e 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 | ->...........|...+----------+... |
| c92c0 | 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 | ....+----------+..|...........|. |
| c92e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c9300 | 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ...|...........+---------------- |
| c9320 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 41 73 73 75 6d 69 | --------------------+.....Assumi |
| c9340 | 6e 67 20 77 65 20 61 72 65 20 67 69 76 65 6e 20 61 6e 20 69 6e 69 74 69 61 6c 20 76 61 6c 75 65 | ng.we.are.given.an.initial.value |
| c9360 | 20 79 5f 30 20 66 6f 72 20 79 2c 20 77 65 20 63 6f 75 6c 64 20 74 72 79 20 74 6f 0a 6d 6f 64 65 | .y_0.for.y,.we.could.try.to.mode |
| c9380 | 6c 20 74 68 69 73 20 73 79 73 74 65 6d 20 75 73 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 | l.this.system.using.the.procedur |
| c93a0 | 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 6f 6c 76 65 20 66 20 79 30 20 64 74 29 0a | e.......(define.(solve.f.y0.dt). |
| c93c0 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 79 20 28 69 6e 74 65 67 72 61 6c 20 64 79 20 79 30 | .......(define.y.(integral.dy.y0 |
| c93e0 | 20 64 74 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 64 79 20 28 73 74 72 65 61 6d 2d | .dt))........(define.dy.(stream- |
| c9400 | 6d 61 70 20 66 20 79 29 29 0a 20 20 20 20 20 20 20 79 29 0a 0a 20 20 20 54 68 69 73 20 70 72 6f | map.f.y))........y).....This.pro |
| c9420 | 63 65 64 75 72 65 20 64 6f 65 73 20 6e 6f 74 20 77 6f 72 6b 2c 20 62 65 63 61 75 73 65 20 69 6e | cedure.does.not.work,.because.in |
| c9440 | 20 74 68 65 20 66 69 72 73 74 20 6c 69 6e 65 20 6f 66 20 60 73 6f 6c 76 65 27 0a 74 68 65 20 63 | .the.first.line.of.`solve'.the.c |
| c9460 | 61 6c 6c 20 74 6f 20 60 69 6e 74 65 67 72 61 6c 27 20 72 65 71 75 69 72 65 73 20 74 68 61 74 20 | all.to.`integral'.requires.that. |
| c9480 | 74 68 65 20 69 6e 70 75 74 20 60 64 79 27 20 62 65 20 64 65 66 69 6e 65 64 2c 20 77 68 69 63 68 | the.input.`dy'.be.defined,.which |
| c94a0 | 0a 64 6f 65 73 20 6e 6f 74 20 68 61 70 70 65 6e 20 75 6e 74 69 6c 20 74 68 65 20 73 65 63 6f 6e | .does.not.happen.until.the.secon |
| c94c0 | 64 20 6c 69 6e 65 20 6f 66 20 60 73 6f 6c 76 65 27 2e 0a 0a 20 20 20 4f 6e 20 74 68 65 20 6f 74 | d.line.of.`solve'......On.the.ot |
| c94e0 | 68 65 72 20 68 61 6e 64 2c 20 74 68 65 20 69 6e 74 65 6e 74 20 6f 66 20 6f 75 72 20 64 65 66 69 | her.hand,.the.intent.of.our.defi |
| c9500 | 6e 69 74 69 6f 6e 20 64 6f 65 73 20 6d 61 6b 65 20 73 65 6e 73 65 2c 0a 62 65 63 61 75 73 65 20 | nition.does.make.sense,.because. |
| c9520 | 77 65 20 63 61 6e 2c 20 69 6e 20 70 72 69 6e 63 69 70 6c 65 2c 20 62 65 67 69 6e 20 74 6f 20 67 | we.can,.in.principle,.begin.to.g |
| c9540 | 65 6e 65 72 61 74 65 20 74 68 65 20 60 79 27 20 73 74 72 65 61 6d 20 77 69 74 68 6f 75 74 0a 6b | enerate.the.`y'.stream.without.k |
| c9560 | 6e 6f 77 69 6e 67 20 60 64 79 27 2e 20 20 49 6e 64 65 65 64 2c 20 60 69 6e 74 65 67 72 61 6c 27 | nowing.`dy'...Indeed,.`integral' |
| c9580 | 20 61 6e 64 20 6d 61 6e 79 20 6f 74 68 65 72 20 73 74 72 65 61 6d 20 6f 70 65 72 61 74 69 6f 6e | .and.many.other.stream.operation |
| c95a0 | 73 20 68 61 76 65 0a 70 72 6f 70 65 72 74 69 65 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 6f | s.have.properties.similar.to.tho |
| c95c0 | 73 65 20 6f 66 20 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 2c 20 69 6e 20 74 68 61 74 20 77 65 20 | se.of.`cons-stream',.in.that.we. |
| c95e0 | 63 61 6e 20 67 65 6e 65 72 61 74 65 0a 70 61 72 74 20 6f 66 20 74 68 65 20 61 6e 73 77 65 72 20 | can.generate.part.of.the.answer. |
| c9600 | 67 69 76 65 6e 20 6f 6e 6c 79 20 70 61 72 74 69 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 | given.only.partial.information.a |
| c9620 | 62 6f 75 74 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 2e 0a 46 6f 72 20 60 69 6e 74 65 67 72 61 | bout.the.arguments..For.`integra |
| c9640 | 6c 27 2c 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 6f 75 74 | l',.the.first.element.of.the.out |
| c9660 | 70 75 74 20 73 74 72 65 61 6d 20 69 73 20 74 68 65 20 73 70 65 63 69 66 69 65 64 0a 60 69 6e 69 | put.stream.is.the.specified.`ini |
| c9680 | 74 69 61 6c 2d 76 61 6c 75 65 27 2e 20 20 54 68 75 73 2c 20 77 65 20 63 61 6e 20 67 65 6e 65 72 | tial-value'...Thus,.we.can.gener |
| c96a0 | 61 74 65 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 6f 75 74 | ate.the.first.element.of.the.out |
| c96c0 | 70 75 74 0a 73 74 72 65 61 6d 20 77 69 74 68 6f 75 74 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 | put.stream.without.evaluating.th |
| c96e0 | 65 20 69 6e 74 65 67 72 61 6e 64 20 60 64 79 27 2e 20 20 4f 6e 63 65 20 77 65 20 6b 6e 6f 77 20 | e.integrand.`dy'...Once.we.know. |
| c9700 | 74 68 65 20 66 69 72 73 74 0a 65 6c 65 6d 65 6e 74 20 6f 66 20 60 79 27 2c 20 74 68 65 20 60 73 | the.first.element.of.`y',.the.`s |
| c9720 | 74 72 65 61 6d 2d 6d 61 70 27 20 69 6e 20 74 68 65 20 73 65 63 6f 6e 64 20 6c 69 6e 65 20 6f 66 | tream-map'.in.the.second.line.of |
| c9740 | 20 60 73 6f 6c 76 65 27 20 63 61 6e 0a 62 65 67 69 6e 20 77 6f 72 6b 69 6e 67 20 74 6f 20 67 65 | .`solve'.can.begin.working.to.ge |
| c9760 | 6e 65 72 61 74 65 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 60 64 79 27 | nerate.the.first.element.of.`dy' |
| c9780 | 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 0a 74 68 65 20 6e 65 78 74 20 65 6c | ,.which.will.produce.the.next.el |
| c97a0 | 65 6d 65 6e 74 20 6f 66 20 60 79 27 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 0a 0a 20 20 20 54 6f 20 | ement.of.`y',.and.so.on......To. |
| c97c0 | 74 61 6b 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 74 68 69 73 20 69 64 65 61 2c 20 77 65 20 | take.advantage.of.this.idea,.we. |
| c97e0 | 77 69 6c 6c 20 72 65 64 65 66 69 6e 65 20 60 69 6e 74 65 67 72 61 6c 27 20 74 6f 0a 65 78 70 65 | will.redefine.`integral'.to.expe |
| c9800 | 63 74 20 74 68 65 20 69 6e 74 65 67 72 61 6e 64 20 73 74 72 65 61 6d 20 74 6f 20 62 65 20 61 20 | ct.the.integrand.stream.to.be.a. |
| c9820 | 22 64 65 6c 61 79 65 64 20 61 72 67 75 6d 65 6e 74 22 2e 20 20 60 49 6e 74 65 67 72 61 6c 27 20 | "delayed.argument"...`Integral'. |
| c9840 | 77 69 6c 6c 0a 60 66 6f 72 63 65 27 20 74 68 65 20 69 6e 74 65 67 72 61 6e 64 20 74 6f 20 62 65 | will.`force'.the.integrand.to.be |
| c9860 | 20 65 76 61 6c 75 61 74 65 64 20 6f 6e 6c 79 20 77 68 65 6e 20 69 74 20 69 73 20 72 65 71 75 69 | .evaluated.only.when.it.is.requi |
| c9880 | 72 65 64 20 74 6f 0a 67 65 6e 65 72 61 74 65 20 6d 6f 72 65 20 74 68 61 6e 20 74 68 65 20 66 69 | red.to.generate.more.than.the.fi |
| c98a0 | 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 6f 75 74 70 75 74 20 73 74 72 65 61 6d | rst.element.of.the.output.stream |
| c98c0 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 74 65 67 72 61 6c 20 64 65 6c 61 79 65 | :.......(define.(integral.delaye |
| c98e0 | 64 2d 69 6e 74 65 67 72 61 6e 64 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 20 64 74 29 0a 20 20 | d-integrand.initial-value.dt)... |
| c9900 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 74 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d | .....(define.int..........(cons- |
| c9920 | 73 74 72 65 61 6d 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 | stream.initial-value............ |
| c9940 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e 74 65 67 72 61 6e 64 20 28 66 6f 72 | ...........(let.((integrand.(for |
| c9960 | 63 65 20 64 65 6c 61 79 65 64 2d 69 6e 74 65 67 72 61 6e 64 29 29 29 0a 20 20 20 20 20 20 20 20 | ce.delayed-integrand)))......... |
| c9980 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 73 74 72 65 61 6d 73 20 28 73 63 | ................(add-streams.(sc |
| c99a0 | 61 6c 65 2d 73 74 72 65 61 6d 20 69 6e 74 65 67 72 61 6e 64 20 64 74 29 0a 20 20 20 20 20 20 20 | ale-stream.integrand.dt)........ |
| c99c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e | ..............................in |
| c99e0 | 74 29 29 29 29 0a 20 20 20 20 20 20 20 69 6e 74 29 0a 0a 20 20 20 4e 6f 77 20 77 65 20 63 61 6e | t))))........int).....Now.we.can |
| c9a00 | 20 69 6d 70 6c 65 6d 65 6e 74 20 6f 75 72 20 60 73 6f 6c 76 65 27 20 70 72 6f 63 65 64 75 72 65 | .implement.our.`solve'.procedure |
| c9a20 | 20 62 79 20 64 65 6c 61 79 69 6e 67 20 74 68 65 0a 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 60 | .by.delaying.the.evaluation.of.` |
| c9a40 | 64 79 27 20 69 6e 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 79 27 3a 28 31 29 | dy'.in.the.definition.of.`y':(1) |
| c9a60 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 6f 6c 76 65 20 66 20 79 30 20 64 74 29 0a 20 | .......(define.(solve.f.y0.dt).. |
| c9a80 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 79 20 28 69 6e 74 65 67 72 61 6c 20 28 64 65 6c 61 79 | ......(define.y.(integral.(delay |
| c9aa0 | 20 64 79 29 20 79 30 20 64 74 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 64 79 20 28 | .dy).y0.dt))........(define.dy.( |
| c9ac0 | 73 74 72 65 61 6d 2d 6d 61 70 20 66 20 79 29 29 0a 20 20 20 20 20 20 20 79 29 0a 0a 20 20 20 49 | stream-map.f.y))........y).....I |
| c9ae0 | 6e 20 67 65 6e 65 72 61 6c 2c 20 65 76 65 72 79 20 63 61 6c 6c 65 72 20 6f 66 20 60 69 6e 74 65 | n.general,.every.caller.of.`inte |
| c9b00 | 67 72 61 6c 27 20 6d 75 73 74 20 6e 6f 77 20 60 64 65 6c 61 79 27 20 74 68 65 20 69 6e 74 65 67 | gral'.must.now.`delay'.the.integ |
| c9b20 | 72 61 6e 64 0a 61 72 67 75 6d 65 6e 74 2e 20 20 57 65 20 63 61 6e 20 64 65 6d 6f 6e 73 74 72 61 | rand.argument...We.can.demonstra |
| c9b40 | 74 65 20 74 68 61 74 20 74 68 65 20 60 73 6f 6c 76 65 27 20 70 72 6f 63 65 64 75 72 65 20 77 6f | te.that.the.`solve'.procedure.wo |
| c9b60 | 72 6b 73 20 62 79 0a 61 70 70 72 6f 78 69 6d 61 74 69 6e 67 20 65 61 70 70 72 6f 78 20 32 2e 37 | rks.by.approximating.eapprox.2.7 |
| c9b80 | 31 38 20 62 79 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 76 61 6c 75 65 20 61 74 20 79 20 3d | 18.by.computing.the.value.at.y.= |
| c9ba0 | 20 31 20 6f 66 20 74 68 65 0a 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 74 68 65 20 64 69 66 66 65 72 | .1.of.the.solution.to.the.differ |
| c9bc0 | 65 6e 74 69 61 6c 20 65 71 75 61 74 69 6f 6e 20 64 79 2f 64 74 20 3d 20 79 20 77 69 74 68 20 69 | ential.equation.dy/dt.=.y.with.i |
| c9be0 | 6e 69 74 69 61 6c 20 63 6f 6e 64 69 74 69 6f 6e 0a 79 28 30 29 20 3d 20 31 3a 0a 0a 20 20 20 20 | nitial.condition.y(0).=.1:...... |
| c9c00 | 20 28 73 74 72 65 61 6d 2d 72 65 66 20 28 73 6f 6c 76 65 20 28 6c 61 6d 62 64 61 20 28 79 29 20 | .(stream-ref.(solve.(lambda.(y). |
| c9c20 | 79 29 20 31 20 30 2e 30 30 31 29 20 31 30 30 30 29 0a 20 20 20 20 20 32 2e 37 31 36 39 32 34 0a | y).1.0.001).1000)......2.716924. |
| c9c40 | 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 37 37 3a 2a 20 54 68 65 20 60 69 6e 74 65 | ......*Exercise.3.77:*.The.`inte |
| c9c60 | 67 72 61 6c 27 20 70 72 6f 63 65 64 75 72 65 20 75 73 65 64 20 61 62 6f 76 65 20 77 61 73 20 61 | gral'.procedure.used.above.was.a |
| c9c80 | 6e 61 6c 6f 67 6f 75 73 0a 20 20 20 20 20 74 6f 20 74 68 65 20 22 69 6d 70 6c 69 63 69 74 22 20 | nalogous......to.the."implicit". |
| c9ca0 | 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 | definition.of.the.infinite.strea |
| c9cc0 | 6d 20 6f 66 20 69 6e 74 65 67 65 72 73 20 69 6e 0a 20 20 20 20 20 73 65 63 74 69 6f 6e 20 2a 4e | m.of.integers.in......section.*N |
| c9ce0 | 6f 74 65 20 33 2d 35 2d 32 3a 3a 2e 20 20 41 6c 74 65 72 6e 61 74 69 76 65 6c 79 2c 20 77 65 20 | ote.3-5-2::...Alternatively,.we. |
| c9d00 | 63 61 6e 20 67 69 76 65 20 61 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 69 | can.give.a.definition.of......`i |
| c9d20 | 6e 74 65 67 72 61 6c 27 20 74 68 61 74 20 69 73 20 6d 6f 72 65 20 6c 69 6b 65 20 60 69 6e 74 65 | ntegral'.that.is.more.like.`inte |
| c9d40 | 67 65 72 73 2d 73 74 61 72 74 69 6e 67 2d 66 72 6f 6d 27 20 28 61 6c 73 6f 20 69 6e 0a 20 20 20 | gers-starting-from'.(also.in.... |
| c9d60 | 20 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d 32 3a 3a 29 3a 0a 0a 20 20 20 20 20 | ..section.*Note.3-5-2::):....... |
| c9d80 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 74 65 67 72 61 6c 20 69 6e 74 65 67 72 61 6e 64 | .....(define.(integral.integrand |
| c9da0 | 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 20 64 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | .initial-value.dt).............( |
| c9dc0 | 63 6f 6e 73 2d 73 74 72 65 61 6d 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 0a 20 20 20 20 20 20 | cons-stream.initial-value....... |
| c9de0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 73 74 72 65 61 6d 2d 6e | ...................(if.(stream-n |
| c9e00 | 75 6c 6c 3f 20 69 6e 74 65 67 72 61 6e 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ull?.integrand)................. |
| c9e20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 0a 20 20 | .............the-empty-stream... |
| c9e40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 6e 74 65 | ...........................(inte |
| c9e60 | 67 72 61 6c 20 28 73 74 72 65 61 6d 2d 63 64 72 20 69 6e 74 65 67 72 61 6e 64 29 0a 20 20 20 20 | gral.(stream-cdr.integrand)..... |
| c9e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c9ea0 | 20 20 20 28 2b 20 28 2a 20 64 74 20 28 73 74 72 65 61 6d 2d 63 61 72 20 69 6e 74 65 67 72 61 6e | ...(+.(*.dt.(stream-car.integran |
| c9ec0 | 64 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | d))............................. |
| c9ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 29 0a 20 20 20 | ..............initial-value).... |
| c9f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| c9f20 | 20 20 20 20 64 74 29 29 29 29 0a 0a 20 20 20 20 20 57 68 65 6e 20 75 73 65 64 20 69 6e 20 73 79 | ....dt)))).......When.used.in.sy |
| c9f40 | 73 74 65 6d 73 20 77 69 74 68 20 6c 6f 6f 70 73 2c 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 | stems.with.loops,.this.procedure |
| c9f60 | 20 68 61 73 20 74 68 65 20 73 61 6d 65 0a 20 20 20 20 20 70 72 6f 62 6c 65 6d 20 61 73 20 64 6f | .has.the.same......problem.as.do |
| c9f80 | 65 73 20 6f 75 72 20 6f 72 69 67 69 6e 61 6c 20 76 65 72 73 69 6f 6e 20 6f 66 20 60 69 6e 74 65 | es.our.original.version.of.`inte |
| c9fa0 | 67 72 61 6c 27 2e 20 20 4d 6f 64 69 66 79 20 74 68 65 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 | gral'...Modify.the......procedur |
| c9fc0 | 65 20 73 6f 20 74 68 61 74 20 69 74 20 65 78 70 65 63 74 73 20 74 68 65 20 60 69 6e 74 65 67 72 | e.so.that.it.expects.the.`integr |
| c9fe0 | 61 6e 64 27 20 61 73 20 61 20 64 65 6c 61 79 65 64 20 61 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 | and'.as.a.delayed.argument...... |
| ca000 | 61 6e 64 20 68 65 6e 63 65 20 63 61 6e 20 62 65 20 75 73 65 64 20 69 6e 20 74 68 65 20 60 73 6f | and.hence.can.be.used.in.the.`so |
| ca020 | 6c 76 65 27 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 77 6e 20 61 62 6f 76 65 2e 0a 0a 20 20 20 | lve'.procedure.shown.above...... |
| ca040 | 20 20 2a 46 69 67 75 72 65 20 33 2e 33 35 3a 2a 20 53 69 67 6e 61 6c 2d 66 6c 6f 77 20 64 69 61 | ..*Figure.3.35:*.Signal-flow.dia |
| ca060 | 67 72 61 6d 20 66 6f 72 20 74 68 65 20 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 61 0a 20 20 20 20 20 | gram.for.the.solution.to.a...... |
| ca080 | 73 65 63 6f 6e 64 2d 6f 72 64 65 72 20 6c 69 6e 65 61 72 20 64 69 66 66 65 72 65 6e 74 69 61 6c | second-order.linear.differential |
| ca0a0 | 20 65 71 75 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .equation....................... |
| ca0c0 | 20 20 20 20 20 64 79 5f 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 79 5f 30 0a 20 20 20 | .....dy_0................y_0.... |
| ca0e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 | .......................|........ |
| ca100 | 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........|.................... |
| ca120 | 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 | .......V...................V.... |
| ca140 | 20 20 20 20 20 20 20 20 20 20 64 64 79 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 | ..........ddy.....+----------+.. |
| ca160 | 20 20 64 79 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 79 0a 20 20 20 20 20 20 20 20 | ..dy..+----------+....y......... |
| ca180 | 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 7c 20 69 6e 74 65 67 72 61 6c 20 2b 2d 2d 2d 2d 2d 2a 2d | ..+--------->|.integral.+-----*- |
| ca1a0 | 2d 2b 20 69 6e 74 65 67 72 61 6c 20 2b 2d 2d 2a 2d 2d 2d 3e 0a 20 20 20 20 20 20 20 20 20 20 7c | -+.integral.+--*--->...........| |
| ca1c0 | 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 7c 20 20 2b 2d | ..........+----------+.....|..+- |
| ca1e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 | ---------+..|...........|....... |
| ca200 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 | ....................|........... |
| ca220 | 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d | .....|...........|............+- |
| ca240 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a | ---------+...|................|. |
| ca260 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 5f 5f 2f 7c 3c 2d 2d 2b 20 73 63 61 6c 65 3a 20 | ..........|.....__/|<--+.scale:. |
| ca280 | 61 20 7c 3c 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 | a.|<--+................|........ |
| ca2a0 | 20 20 20 7c 20 20 20 5f 2f 20 20 20 7c 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 | ...|..._/...|...+----------+.... |
| ca2c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 3c | ................|...........+--< |
| ca2e0 | 5f 61 64 64 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | _add.|.......................... |
| ca300 | 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 5f 5f 20 7c 20 | .........|................\__.|. |
| ca320 | 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..+----------+.................. |
| ca340 | 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 7c 3c 2d 2d 2b 20 73 63 61 | ..|...................\|<--+.sca |
| ca360 | 6c 65 3a 20 62 20 7c 3c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 | le:.b.|<-------------------+.... |
| ca380 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b | ....................+----------+ |
| ca3a0 | 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 37 38 3a 2a 20 43 6f 6e 73 69 64 65 72 | .......*Exercise.3.78:*.Consider |
| ca3c0 | 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 64 65 73 69 67 6e 69 6e 67 20 61 0a 20 20 20 20 | .the.problem.of.designing.a..... |
| ca3e0 | 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 73 73 69 6e 67 20 73 79 73 74 65 6d 20 74 6f 20 73 74 75 | .signal-processing.system.to.stu |
| ca400 | 64 79 20 74 68 65 20 68 6f 6d 6f 67 65 6e 65 6f 75 73 20 73 65 63 6f 6e 64 2d 6f 72 64 65 72 0a | dy.the.homogeneous.second-order. |
| ca420 | 20 20 20 20 20 6c 69 6e 65 61 72 20 64 69 66 66 65 72 65 6e 74 69 61 6c 20 65 71 75 61 74 69 6f | .....linear.differential.equatio |
| ca440 | 6e 0a 0a 20 20 20 20 20 20 20 20 20 20 64 5e 32 20 79 20 20 20 20 20 20 20 20 64 20 79 0a 20 20 | n............d^2.y........d.y... |
| ca460 | 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 20 20 2d 20 20 61 20 2d 2d 2d 2d 2d 20 20 2d 20 20 62 79 | ........-----..-..a.-----..-..by |
| ca480 | 20 20 3d 20 20 30 0a 20 20 20 20 20 20 20 20 20 20 64 20 74 5e 32 20 20 20 20 20 20 20 20 64 20 | ..=..0...........d.t^2........d. |
| ca4a0 | 74 0a 0a 20 20 20 20 20 54 68 65 20 6f 75 74 70 75 74 20 73 74 72 65 61 6d 2c 20 6d 6f 64 65 6c | t.......The.output.stream,.model |
| ca4c0 | 69 6e 67 20 79 2c 20 69 73 20 67 65 6e 65 72 61 74 65 64 20 62 79 20 61 20 6e 65 74 77 6f 72 6b | ing.y,.is.generated.by.a.network |
| ca4e0 | 20 74 68 61 74 0a 20 20 20 20 20 63 6f 6e 74 61 69 6e 73 20 61 20 6c 6f 6f 70 2e 20 54 68 69 73 | .that......contains.a.loop..This |
| ca500 | 20 69 73 20 62 65 63 61 75 73 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 64 5e 32 79 2f 64 74 | .is.because.the.value.of.d^2y/dt |
| ca520 | 5e 32 20 64 65 70 65 6e 64 73 0a 20 20 20 20 20 75 70 6f 6e 20 74 68 65 20 76 61 6c 75 65 73 20 | ^2.depends......upon.the.values. |
| ca540 | 6f 66 20 79 20 61 6e 64 20 64 79 2f 64 74 20 61 6e 64 20 62 6f 74 68 20 6f 66 20 74 68 65 73 65 | of.y.and.dy/dt.and.both.of.these |
| ca560 | 20 61 72 65 20 64 65 74 65 72 6d 69 6e 65 64 20 62 79 0a 20 20 20 20 20 69 6e 74 65 67 72 61 74 | .are.determined.by......integrat |
| ca580 | 69 6e 67 20 64 5e 32 79 2f 64 74 5e 32 2e 20 20 54 68 65 20 64 69 61 67 72 61 6d 20 77 65 20 77 | ing.d^2y/dt^2...The.diagram.we.w |
| ca5a0 | 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 20 65 6e 63 6f 64 65 20 69 73 0a 20 20 20 20 20 73 68 6f 77 | ould.like.to.encode.is......show |
| ca5c0 | 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 33 35 3a 3a 2e 20 20 57 72 69 74 65 | n.in.*Note.Figure.3-35::...Write |
| ca5e0 | 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 73 6f 6c 76 65 2d 32 6e 64 27 20 74 68 61 74 0a 20 20 | .a.procedure.`solve-2nd'.that... |
| ca600 | 20 20 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 74 68 65 20 63 6f 6e 73 74 61 | ...takes.as.arguments.the.consta |
| ca620 | 6e 74 73 20 61 2c 20 62 2c 20 61 6e 64 20 64 74 20 61 6e 64 20 74 68 65 20 69 6e 69 74 69 61 6c | nts.a,.b,.and.dt.and.the.initial |
| ca640 | 0a 20 20 20 20 20 76 61 6c 75 65 73 20 79 5f 30 20 61 6e 64 20 64 79 5f 30 20 66 6f 72 20 79 20 | ......values.y_0.and.dy_0.for.y. |
| ca660 | 61 6e 64 20 64 79 2f 64 74 20 61 6e 64 20 67 65 6e 65 72 61 74 65 73 20 74 68 65 20 73 74 72 65 | and.dy/dt.and.generates.the.stre |
| ca680 | 61 6d 20 6f 66 0a 20 20 20 20 20 73 75 63 63 65 73 73 69 76 65 20 76 61 6c 75 65 73 20 6f 66 20 | am.of......successive.values.of. |
| ca6a0 | 79 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 37 39 3a 2a 20 47 65 6e 65 72 61 | y........*Exercise.3.79:*.Genera |
| ca6c0 | 6c 69 7a 65 20 74 68 65 20 60 73 6f 6c 76 65 2d 32 6e 64 27 20 70 72 6f 63 65 64 75 72 65 20 6f | lize.the.`solve-2nd'.procedure.o |
| ca6e0 | 66 20 2a 4e 6f 74 65 0a 20 20 20 20 20 45 78 65 72 63 69 73 65 20 33 2d 37 38 3a 3a 20 73 6f 20 | f.*Note......Exercise.3-78::.so. |
| ca700 | 74 68 61 74 20 69 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 73 6f 6c 76 65 20 67 65 6e | that.it.can.be.used.to.solve.gen |
| ca720 | 65 72 61 6c 0a 20 20 20 20 20 73 65 63 6f 6e 64 2d 6f 72 64 65 72 20 64 69 66 66 65 72 65 6e 74 | eral......second-order.different |
| ca740 | 69 61 6c 20 65 71 75 61 74 69 6f 6e 73 20 64 5e 32 20 79 2f 64 74 5e 32 20 3d 20 66 28 64 79 2f | ial.equations.d^2.y/dt^2.=.f(dy/ |
| ca760 | 64 74 2c 20 79 29 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 33 2e 38 30 3a 2a 20 41 | dt,.y)........*Exercise.3.80:*.A |
| ca780 | 20 22 73 65 72 69 65 73 20 52 4c 43 20 63 69 72 63 75 69 74 22 20 63 6f 6e 73 69 73 74 73 20 6f | ."series.RLC.circuit".consists.o |
| ca7a0 | 66 20 61 20 72 65 73 69 73 74 6f 72 2c 20 61 0a 20 20 20 20 20 63 61 70 61 63 69 74 6f 72 2c 20 | f.a.resistor,.a......capacitor,. |
| ca7c0 | 61 6e 64 20 61 6e 20 69 6e 64 75 63 74 6f 72 20 63 6f 6e 6e 65 63 74 65 64 20 69 6e 20 73 65 72 | and.an.inductor.connected.in.ser |
| ca7e0 | 69 65 73 2c 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 46 69 67 75 | ies,.as.shown.in.*Note......Figu |
| ca800 | 72 65 20 33 2d 33 36 3a 3a 2e 20 20 49 66 20 52 2c 20 4c 2c 20 61 6e 64 20 43 20 61 72 65 20 74 | re.3-36::...If.R,.L,.and.C.are.t |
| ca820 | 68 65 20 72 65 73 69 73 74 61 6e 63 65 2c 20 69 6e 64 75 63 74 61 6e 63 65 2c 20 61 6e 64 0a 20 | he.resistance,.inductance,.and.. |
| ca840 | 20 20 20 20 63 61 70 61 63 69 74 61 6e 63 65 2c 20 74 68 65 6e 20 74 68 65 20 72 65 6c 61 74 69 | ....capacitance,.then.the.relati |
| ca860 | 6f 6e 73 20 62 65 74 77 65 65 6e 20 76 6f 6c 74 61 67 65 20 28 76 29 20 61 6e 64 20 63 75 72 72 | ons.between.voltage.(v).and.curr |
| ca880 | 65 6e 74 0a 20 20 20 20 20 28 69 29 20 66 6f 72 20 74 68 65 20 74 68 72 65 65 20 63 6f 6d 70 6f | ent......(i).for.the.three.compo |
| ca8a0 | 6e 65 6e 74 73 20 61 72 65 20 64 65 73 63 72 69 62 65 64 20 62 79 20 74 68 65 20 65 71 75 61 74 | nents.are.described.by.the.equat |
| ca8c0 | 69 6f 6e 73 0a 0a 20 20 20 20 20 20 20 20 20 20 76 5f 52 20 3d 20 69 5f 52 20 52 0a 0a 20 20 20 | ions............v_R.=.i_R.R..... |
| ca8e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 5f 28 69 20 4c 29 0a 20 20 20 20 20 20 20 20 | ................d_(i.L)......... |
| ca900 | 20 20 76 5f 4c 20 3d 20 4c 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..v_L.=.L.---------............. |
| ca920 | 20 20 20 20 20 20 20 20 20 64 20 74 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .........d.t.................... |
| ca940 | 20 64 20 76 5f 43 0a 20 20 20 20 20 20 20 20 20 20 69 5f 43 20 3d 20 43 20 2d 2d 2d 2d 2d 2d 2d | .d.v_C...........i_C.=.C.------- |
| ca960 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 20 74 0a 0a 20 20 20 20 20 61 | .....................d.t.......a |
| ca980 | 6e 64 20 74 68 65 20 63 69 72 63 75 69 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 64 69 63 74 61 | nd.the.circuit.connections.dicta |
| ca9a0 | 74 65 20 74 68 65 20 72 65 6c 61 74 69 6f 6e 73 0a 0a 20 20 20 20 20 20 20 20 20 20 69 5f 52 20 | te.the.relations............i_R. |
| ca9c0 | 3d 20 69 5f 4c 20 3d 20 2d 69 5f 43 0a 0a 20 20 20 20 20 20 20 20 20 20 76 5f 43 20 3d 20 76 5f | =.i_L.=.-i_C............v_C.=.v_ |
| ca9e0 | 4c 20 2b 20 76 5f 52 0a 0a 20 20 20 20 20 43 6f 6d 62 69 6e 69 6e 67 20 74 68 65 73 65 20 65 71 | L.+.v_R.......Combining.these.eq |
| caa00 | 75 61 74 69 6f 6e 73 20 73 68 6f 77 73 20 74 68 61 74 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 | uations.shows.that.the.state.of. |
| caa20 | 74 68 65 20 63 69 72 63 75 69 74 0a 20 20 20 20 20 28 73 75 6d 6d 61 72 69 7a 65 64 20 62 79 20 | the.circuit......(summarized.by. |
| caa40 | 76 5f 43 2c 20 74 68 65 20 76 6f 6c 74 61 67 65 20 61 63 72 6f 73 73 20 74 68 65 20 63 61 70 61 | v_C,.the.voltage.across.the.capa |
| caa60 | 63 69 74 6f 72 2c 20 61 6e 64 20 69 5f 4c 2c 20 74 68 65 0a 20 20 20 20 20 63 75 72 72 65 6e 74 | citor,.and.i_L,.the......current |
| caa80 | 20 69 6e 20 74 68 65 20 69 6e 64 75 63 74 6f 72 29 20 69 73 20 64 65 73 63 72 69 62 65 64 20 62 | .in.the.inductor).is.described.b |
| caaa0 | 79 20 74 68 65 20 70 61 69 72 20 6f 66 20 64 69 66 66 65 72 65 6e 74 69 61 6c 0a 20 20 20 20 20 | y.the.pair.of.differential...... |
| caac0 | 65 71 75 61 74 69 6f 6e 73 0a 0a 20 20 20 20 20 20 20 20 20 20 64 20 76 5f 43 20 20 20 20 20 20 | equations............d.v_C...... |
| caae0 | 20 20 69 5f 4c 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 20 20 3d 20 20 2d 20 20 2d 2d 2d | ..i_L...........-----..=..-..--- |
| cab00 | 0a 20 20 20 20 20 20 20 20 20 20 20 64 20 74 20 20 20 20 20 20 20 20 20 20 43 0a 0a 20 20 20 20 | ............d.t..........C...... |
| cab20 | 20 20 20 20 20 20 64 20 69 5f 4c 20 20 20 20 20 20 31 20 20 20 20 20 20 20 20 20 20 20 52 0a 20 | ......d.i_L......1...........R.. |
| cab40 | 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 20 20 3d 20 20 2d 2d 2d 20 76 5f 43 20 20 2d 20 20 2d | .........-----..=..---.v_C..-..- |
| cab60 | 2d 2d 20 69 5f 4c 0a 20 20 20 20 20 20 20 20 20 20 20 64 20 74 20 20 20 20 20 20 20 4c 20 20 20 | --.i_L............d.t.......L... |
| cab80 | 20 20 20 20 20 20 20 20 4c 0a 0a 20 20 20 20 20 54 68 65 20 73 69 67 6e 61 6c 2d 66 6c 6f 77 20 | ........L.......The.signal-flow. |
| caba0 | 64 69 61 67 72 61 6d 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 69 73 20 73 79 73 74 65 6d | diagram.representing.this.system |
| cabc0 | 20 6f 66 20 64 69 66 66 65 72 65 6e 74 69 61 6c 0a 20 20 20 20 20 65 71 75 61 74 69 6f 6e 73 20 | .of.differential......equations. |
| cabe0 | 69 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 33 2d 33 37 3a 3a 2e | is.shown.in.*Note.Figure.3-37::. |
| cac00 | 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 33 36 3a 2a 20 41 20 73 65 72 69 65 73 20 52 | .......*Figure.3.36:*.A.series.R |
| cac20 | 4c 43 20 63 69 72 63 75 69 74 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b | LC.circuit.....................+ |
| cac40 | 20 76 5f 52 20 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 69 5f 52 0a 20 20 20 20 20 20 20 20 | .v_R.-..............i_R......... |
| cac60 | 20 20 2b 2d 2d 2d 3e 2d 2d 2d 2d 27 5c 2f 5c 2f 5c 2c 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 | ..+--->----'\/\/\,--------+..... |
| cac80 | 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ......|.......................|. |
| caca0 | 20 69 5f 4c 0a 20 20 20 20 20 20 20 20 20 5c 7c 2f 20 20 20 20 20 20 20 20 20 20 52 20 20 20 20 | .i_L..........\|/..........R.... |
| cacc0 | 20 20 20 20 20 20 5c 7c 2f 0a 20 20 20 20 20 20 20 2b 20 20 7c 20 20 69 5f 43 20 20 20 20 20 20 | ......\|/........+..|..i_C...... |
| cace0 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 5f 20 20 20 2b 0a 20 20 20 20 20 20 20 20 20 2d 2b 2d 20 | ............|_...+..........-+-. |
| cad00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 29 0a 20 20 20 20 20 76 5f | .....................__)......v_ |
| cad20 | 43 20 2d 2b 2d 20 43 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 5f 29 20 20 20 | C.-+-.C...................(_)... |
| cad40 | 76 5f 4c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | v_L...........|................. |
| cad60 | 20 20 20 20 20 20 5f 5f 29 0a 20 20 20 20 20 20 20 2d 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 | ......__)........-..|........... |
| cad80 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 2d 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | ............|....-...........+-- |
| cada0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 20 20 2a 46 69 | ---------------------+.......*Fi |
| cadc0 | 67 75 72 65 20 33 2e 33 37 3a 2a 20 41 20 73 69 67 6e 61 6c 2d 66 6c 6f 77 20 64 69 61 67 72 61 | gure.3.37:*.A.signal-flow.diagra |
| cade0 | 6d 20 66 6f 72 20 74 68 65 20 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 61 20 73 65 72 69 65 73 0a 20 | m.for.the.solution.to.a.series.. |
| cae00 | 20 20 20 20 52 4c 43 20 63 69 72 63 75 69 74 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....RLC.circuit................. |
| cae20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 | .............+-------------+.... |
| cae40 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 73 63 61 6c 65 | .......+----------------+..scale |
| cae60 | 3a 20 6c 2f 4c 20 7c 3c 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 | :.l/L.|<--+...........|......... |
| cae80 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 0a 20 20 20 20 20 | .......+-------------+...|...... |
| caea0 | 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....|.......................... |
| caec0 | 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 | ........|...........|........... |
| caee0 | 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 20 20 76 5f 43 0a 20 20 | .....+-------------+...|..v_C... |
| caf00 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 64 76 5f 43 20 2b 2d 2d 3e 7c 20 20 20 69 6e 74 | ........|.......dv_C.+-->|...int |
| caf20 | 65 67 72 61 6c 20 20 2b 2d 2d 2d 2a 2d 2d 2d 2d 2d 2d 3e 0a 20 20 20 20 20 20 20 20 20 20 7c 20 | egral..+---*------>...........|. |
| caf40 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 | ...........|...+-------------+.. |
| caf60 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 5e | .........|............|........^ |
| caf80 | 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 | ...........|............|....... |
| cafa0 | 20 7c 20 76 5f 28 43 5f 30 29 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | .|.v_(C_0)...........|.......... |
| cafc0 | 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 2b | ..|...........|............|...+ |
| cafe0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | -------------+...........|...... |
| cb000 | 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 73 63 61 6c 65 3a 20 2d 6c 2f 43 20 7c 3c 2d 2d 2b 0a 20 20 | ......+---+.scale:.-l/C.|<--+... |
| cb020 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d | ........|................+------ |
| cb040 | 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 5c 5f 5f 20 20 | -------+...|...........|..|\__.. |
| cb060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 | ..........................|..... |
| cb080 | 20 20 20 20 20 20 2b 2d 3e 7c 20 20 20 5c 5f 20 20 64 69 5f 4c 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d | ......+->|...\_..di_L..+-------- |
| cb0a0 | 2d 2d 2d 2d 2d 2b 20 20 20 7c 20 20 69 5f 4c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 61 | -----+...|..i_L..............|.a |
| cb0c0 | 64 64 5f 3e 2d 2d 2d 2d 2d 2d 3e 7c 20 20 20 69 6e 74 65 67 72 61 6c 20 20 2b 2d 2d 2d 2a 2d 2d | dd_>------>|...integral..+---*-- |
| cb0e0 | 2d 2d 2d 2d 3e 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 3e 7c 20 5f 5f 2f 20 20 20 20 20 20 20 20 | ---->...........+->|.__/........ |
| cb100 | 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c | .+-------------+...|...........| |
| cb120 | 20 20 7c 2f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 | ..|/.................^.......... |
| cb140 | 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..|...........|................. |
| cb160 | 20 20 20 20 7c 20 69 5f 28 4c 5f 30 29 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ....|.i_(L_0)....|...........|.. |
| cb180 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| cb1a0 | 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | |...........|................+-- |
| cb1c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d | -----------+...|...........+---- |
| cb1e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 73 63 61 6c 65 3a 20 2d 52 2f 4c 20 7c 3c 2d 2d 2b 0a | ------------+.scale:.-R/L.|<--+. |
| cb200 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d | ...........................+---- |
| cb220 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 | ---------+.....Write.a.procedure |
| cb240 | 20 60 52 4c 43 27 20 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 74 | .`RLC'.that.takes.as.arguments.t |
| cb260 | 68 65 20 70 61 72 61 6d 65 74 65 72 73 20 52 2c 20 4c 2c 0a 61 6e 64 20 43 20 6f 66 20 74 68 65 | he.parameters.R,.L,.and.C.of.the |
| cb280 | 20 63 69 72 63 75 69 74 20 61 6e 64 20 74 68 65 20 74 69 6d 65 20 69 6e 63 72 65 6d 65 6e 74 20 | .circuit.and.the.time.increment. |
| cb2a0 | 64 74 2e 20 20 49 6e 20 61 20 6d 61 6e 6e 65 72 20 73 69 6d 69 6c 61 72 20 74 6f 0a 74 68 61 74 | dt...In.a.manner.similar.to.that |
| cb2c0 | 20 6f 66 20 74 68 65 20 60 52 43 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 2a 4e 6f 74 65 20 | .of.the.`RC'.procedure.of.*Note. |
| cb2e0 | 45 78 65 72 63 69 73 65 20 33 2d 37 33 3a 3a 2c 20 60 52 4c 43 27 20 73 68 6f 75 6c 64 0a 70 72 | Exercise.3-73::,.`RLC'.should.pr |
| cb300 | 6f 64 75 63 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 20 74 68 65 | oduce.a.procedure.that.takes.the |
| cb320 | 20 69 6e 69 74 69 61 6c 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 73 74 61 74 65 0a 76 61 72 | .initial.values.of.the.state.var |
| cb340 | 69 61 62 6c 65 73 2c 20 76 5f 28 43 5f 30 29 20 61 6e 64 20 69 5f 28 4c 5f 30 29 2c 20 61 6e 64 | iables,.v_(C_0).and.i_(L_0),.and |
| cb360 | 20 70 72 6f 64 75 63 65 73 20 61 20 70 61 69 72 20 28 75 73 69 6e 67 20 60 63 6f 6e 73 27 29 20 | .produces.a.pair.(using.`cons'). |
| cb380 | 6f 66 0a 74 68 65 20 73 74 72 65 61 6d 73 20 6f 66 20 73 74 61 74 65 73 20 76 5f 43 20 61 6e 64 | of.the.streams.of.states.v_C.and |
| cb3a0 | 20 69 5f 4c 2e 20 20 55 73 69 6e 67 20 60 52 4c 43 27 2c 20 67 65 6e 65 72 61 74 65 20 74 68 65 | .i_L...Using.`RLC',.generate.the |
| cb3c0 | 20 70 61 69 72 20 6f 66 0a 73 74 72 65 61 6d 73 20 74 68 61 74 20 6d 6f 64 65 6c 73 20 74 68 65 | .pair.of.streams.that.models.the |
| cb3e0 | 20 62 65 68 61 76 69 6f 72 20 6f 66 20 61 20 73 65 72 69 65 73 20 52 4c 43 20 63 69 72 63 75 69 | .behavior.of.a.series.RLC.circui |
| cb400 | 74 20 77 69 74 68 20 52 20 3d 20 31 0a 6f 68 6d 2c 20 43 20 3d 20 30 2e 32 20 66 61 72 61 64 2c | t.with.R.=.1.ohm,.C.=.0.2.farad, |
| cb420 | 20 4c 20 3d 20 31 20 68 65 6e 72 79 2c 20 64 74 20 3d 20 30 2e 31 20 73 65 63 6f 6e 64 2c 20 61 | .L.=.1.henry,.dt.=.0.1.second,.a |
| cb440 | 6e 64 20 69 6e 69 74 69 61 6c 20 76 61 6c 75 65 73 0a 69 5f 28 4c 5f 30 29 20 3d 20 30 20 61 6d | nd.initial.values.i_(L_0).=.0.am |
| cb460 | 70 73 20 61 6e 64 20 76 5f 28 43 5f 30 29 20 3d 20 31 30 20 76 6f 6c 74 73 2e 0a 0a 4e 6f 72 6d | ps.and.v_(C_0).=.10.volts...Norm |
| cb480 | 61 6c 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | al-order.evaluation............. |
| cb4a0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 65 78 61 6d 70 6c 65 73 20 69 6e 20 74 68 69 | .............The.examples.in.thi |
| cb4c0 | 73 20 73 65 63 74 69 6f 6e 20 69 6c 6c 75 73 74 72 61 74 65 20 68 6f 77 20 74 68 65 20 65 78 70 | s.section.illustrate.how.the.exp |
| cb4e0 | 6c 69 63 69 74 20 75 73 65 20 6f 66 20 60 64 65 6c 61 79 27 0a 61 6e 64 20 60 66 6f 72 63 65 27 | licit.use.of.`delay'.and.`force' |
| cb500 | 20 70 72 6f 76 69 64 65 73 20 67 72 65 61 74 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 66 6c 65 78 | .provides.great.programming.flex |
| cb520 | 69 62 69 6c 69 74 79 2c 20 62 75 74 20 74 68 65 20 73 61 6d 65 0a 65 78 61 6d 70 6c 65 73 20 61 | ibility,.but.the.same.examples.a |
| cb540 | 6c 73 6f 20 73 68 6f 77 20 68 6f 77 20 74 68 69 73 20 63 61 6e 20 6d 61 6b 65 20 6f 75 72 20 70 | lso.show.how.this.can.make.our.p |
| cb560 | 72 6f 67 72 61 6d 73 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 2e 20 20 4f 75 72 0a 6e 65 77 20 60 | rograms.more.complex...Our.new.` |
| cb580 | 69 6e 74 65 67 72 61 6c 27 20 70 72 6f 63 65 64 75 72 65 2c 20 66 6f 72 20 69 6e 73 74 61 6e 63 | integral'.procedure,.for.instanc |
| cb5a0 | 65 2c 20 67 69 76 65 73 20 75 73 20 74 68 65 20 70 6f 77 65 72 20 74 6f 20 6d 6f 64 65 6c 0a 73 | e,.gives.us.the.power.to.model.s |
| cb5c0 | 79 73 74 65 6d 73 20 77 69 74 68 20 6c 6f 6f 70 73 2c 20 62 75 74 20 77 65 20 6d 75 73 74 20 6e | ystems.with.loops,.but.we.must.n |
| cb5e0 | 6f 77 20 72 65 6d 65 6d 62 65 72 20 74 68 61 74 20 60 69 6e 74 65 67 72 61 6c 27 20 73 68 6f 75 | ow.remember.that.`integral'.shou |
| cb600 | 6c 64 20 62 65 0a 63 61 6c 6c 65 64 20 77 69 74 68 20 61 20 64 65 6c 61 79 65 64 20 69 6e 74 65 | ld.be.called.with.a.delayed.inte |
| cb620 | 67 72 61 6e 64 2c 20 61 6e 64 20 65 76 65 72 79 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 | grand,.and.every.procedure.that. |
| cb640 | 75 73 65 73 0a 60 69 6e 74 65 67 72 61 6c 27 20 6d 75 73 74 20 62 65 20 61 77 61 72 65 20 6f 66 | uses.`integral'.must.be.aware.of |
| cb660 | 20 74 68 69 73 2e 20 20 49 6e 20 65 66 66 65 63 74 2c 20 77 65 20 68 61 76 65 20 63 72 65 61 74 | .this...In.effect,.we.have.creat |
| cb680 | 65 64 20 74 77 6f 0a 63 6c 61 73 73 65 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 3a 20 6f 72 | ed.two.classes.of.procedures:.or |
| cb6a0 | 64 69 6e 61 72 79 20 70 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 70 72 6f 63 65 64 75 72 65 73 | dinary.procedures.and.procedures |
| cb6c0 | 20 74 68 61 74 20 74 61 6b 65 0a 64 65 6c 61 79 65 64 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 49 | .that.take.delayed.arguments...I |
| cb6e0 | 6e 20 67 65 6e 65 72 61 6c 2c 20 63 72 65 61 74 69 6e 67 20 73 65 70 61 72 61 74 65 20 63 6c 61 | n.general,.creating.separate.cla |
| cb700 | 73 73 65 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 0a 66 6f 72 63 65 73 20 75 73 20 74 6f 20 | sses.of.procedures.forces.us.to. |
| cb720 | 63 72 65 61 74 65 20 73 65 70 61 72 61 74 65 20 63 6c 61 73 73 65 73 20 6f 66 20 68 69 67 68 65 | create.separate.classes.of.highe |
| cb740 | 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 0a 77 65 6c 6c 2e 28 32 29 0a 0a | r-order.procedures.as.well.(2).. |
| cb760 | 20 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 61 76 6f 69 64 20 74 68 65 20 6e 65 65 64 20 66 6f 72 | ...One.way.to.avoid.the.need.for |
| cb780 | 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 63 6c 61 73 73 65 73 20 6f 66 20 70 72 6f 63 65 64 | .two.different.classes.of.proced |
| cb7a0 | 75 72 65 73 20 69 73 0a 74 6f 20 6d 61 6b 65 20 61 6c 6c 20 70 72 6f 63 65 64 75 72 65 73 20 74 | ures.is.to.make.all.procedures.t |
| cb7c0 | 61 6b 65 20 64 65 6c 61 79 65 64 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 57 65 20 63 6f 75 6c 64 | ake.delayed.arguments...We.could |
| cb7e0 | 20 61 64 6f 70 74 20 61 20 6d 6f 64 65 6c 0a 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 6e 20 | .adopt.a.model.of.evaluation.in. |
| cb800 | 77 68 69 63 68 20 61 6c 6c 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 70 72 6f 63 65 64 75 72 65 | which.all.arguments.to.procedure |
| cb820 | 73 20 61 72 65 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 0a 64 65 6c 61 79 65 64 20 61 6e 64 20 | s.are.automatically.delayed.and. |
| cb840 | 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 66 6f 72 63 65 64 20 6f 6e 6c 79 20 77 68 65 6e 20 74 | arguments.are.forced.only.when.t |
| cb860 | 68 65 79 20 61 72 65 20 61 63 74 75 61 6c 6c 79 20 6e 65 65 64 65 64 0a 28 66 6f 72 20 65 78 61 | hey.are.actually.needed.(for.exa |
| cb880 | 6d 70 6c 65 2c 20 77 68 65 6e 20 74 68 65 79 20 61 72 65 20 72 65 71 75 69 72 65 64 20 62 79 20 | mple,.when.they.are.required.by. |
| cb8a0 | 61 20 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 29 2e 20 20 54 68 69 73 0a 77 6f | a.primitive.operation)...This.wo |
| cb8c0 | 75 6c 64 20 74 72 61 6e 73 66 6f 72 6d 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 74 6f 20 75 73 | uld.transform.our.language.to.us |
| cb8e0 | 65 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 77 68 69 63 68 | e.normal-order.evaluation,.which |
| cb900 | 20 77 65 0a 66 69 72 73 74 20 64 65 73 63 72 69 62 65 64 20 77 68 65 6e 20 77 65 20 69 6e 74 72 | .we.first.described.when.we.intr |
| cb920 | 6f 64 75 63 65 64 20 74 68 65 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 66 6f | oduced.the.substitution.model.fo |
| cb940 | 72 0a 65 76 61 6c 75 61 74 69 6f 6e 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d | r.evaluation.in.section.*Note.1- |
| cb960 | 31 2d 35 3a 3a 2e 20 20 43 6f 6e 76 65 72 74 69 6e 67 20 74 6f 20 6e 6f 72 6d 61 6c 2d 6f 72 64 | 1-5::...Converting.to.normal-ord |
| cb980 | 65 72 0a 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 76 69 64 65 73 20 61 20 75 6e 69 66 6f 72 6d | er.evaluation.provides.a.uniform |
| cb9a0 | 20 61 6e 64 20 65 6c 65 67 61 6e 74 20 77 61 79 20 74 6f 20 73 69 6d 70 6c 69 66 79 20 74 68 65 | .and.elegant.way.to.simplify.the |
| cb9c0 | 20 75 73 65 20 6f 66 0a 64 65 6c 61 79 65 64 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 61 6e 64 20 | .use.of.delayed.evaluation,.and. |
| cb9e0 | 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 61 20 6e 61 74 75 72 61 6c 20 73 74 72 61 74 65 67 79 | this.would.be.a.natural.strategy |
| cba00 | 20 74 6f 20 61 64 6f 70 74 20 69 66 20 77 65 0a 77 65 72 65 20 63 6f 6e 63 65 72 6e 65 64 20 6f | .to.adopt.if.we.were.concerned.o |
| cba20 | 6e 6c 79 20 77 69 74 68 20 73 74 72 65 61 6d 20 70 72 6f 63 65 73 73 69 6e 67 2e 20 20 49 6e 20 | nly.with.stream.processing...In. |
| cba40 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 32 3a 3a 2c 0a 61 66 74 65 72 20 77 65 20 68 61 | section.*Note.4-2::,.after.we.ha |
| cba60 | 76 65 20 73 74 75 64 69 65 64 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 2c 20 77 65 20 77 69 6c | ve.studied.the.evaluator,.we.wil |
| cba80 | 6c 20 73 65 65 20 68 6f 77 20 74 6f 20 74 72 61 6e 73 66 6f 72 6d 20 6f 75 72 0a 6c 61 6e 67 75 | l.see.how.to.transform.our.langu |
| cbaa0 | 61 67 65 20 69 6e 20 6a 75 73 74 20 74 68 69 73 20 77 61 79 2e 20 20 55 6e 66 6f 72 74 75 6e 61 | age.in.just.this.way...Unfortuna |
| cbac0 | 74 65 6c 79 2c 20 69 6e 63 6c 75 64 69 6e 67 20 64 65 6c 61 79 73 20 69 6e 0a 70 72 6f 63 65 64 | tely,.including.delays.in.proced |
| cbae0 | 75 72 65 20 63 61 6c 6c 73 20 77 72 65 61 6b 73 20 68 61 76 6f 63 20 77 69 74 68 20 6f 75 72 20 | ure.calls.wreaks.havoc.with.our. |
| cbb00 | 61 62 69 6c 69 74 79 20 74 6f 20 64 65 73 69 67 6e 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 0a | ability.to.design.programs.that. |
| cbb20 | 64 65 70 65 6e 64 20 6f 6e 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 65 76 65 6e 74 73 2c 20 73 | depend.on.the.order.of.events,.s |
| cbb40 | 75 63 68 20 61 73 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 75 73 65 20 61 73 73 69 67 6e 6d | uch.as.programs.that.use.assignm |
| cbb60 | 65 6e 74 2c 0a 6d 75 74 61 74 65 20 64 61 74 61 2c 20 6f 72 20 70 65 72 66 6f 72 6d 20 69 6e 70 | ent,.mutate.data,.or.perform.inp |
| cbb80 | 75 74 20 6f 72 20 6f 75 74 70 75 74 2e 20 20 45 76 65 6e 20 74 68 65 20 73 69 6e 67 6c 65 20 60 | ut.or.output...Even.the.single.` |
| cbba0 | 64 65 6c 61 79 27 20 69 6e 0a 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 20 63 61 6e 20 63 61 75 73 | delay'.in.`cons-stream'.can.caus |
| cbbc0 | 65 20 67 72 65 61 74 20 63 6f 6e 66 75 73 69 6f 6e 2c 20 61 73 20 69 6c 6c 75 73 74 72 61 74 65 | e.great.confusion,.as.illustrate |
| cbbe0 | 64 20 62 79 20 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 20 33 2d 35 31 3a 3a 20 61 6e 64 20 2a | d.by.*Note.Exercise.3-51::.and.* |
| cbc00 | 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 35 32 3a 3a 2e 20 20 41 73 20 66 61 72 20 61 73 | Note.Exercise.3-52::...As.far.as |
| cbc20 | 20 61 6e 79 6f 6e 65 20 6b 6e 6f 77 73 2c 0a 6d 75 74 61 62 69 6c 69 74 79 20 61 6e 64 20 64 65 | .anyone.knows,.mutability.and.de |
| cbc40 | 6c 61 79 65 64 20 65 76 61 6c 75 61 74 69 6f 6e 20 64 6f 20 6e 6f 74 20 6d 69 78 20 77 65 6c 6c | layed.evaluation.do.not.mix.well |
| cbc60 | 20 69 6e 20 70 72 6f 67 72 61 6d 6d 69 6e 67 0a 6c 61 6e 67 75 61 67 65 73 2c 20 61 6e 64 20 64 | .in.programming.languages,.and.d |
| cbc80 | 65 76 69 73 69 6e 67 20 77 61 79 73 20 74 6f 20 64 65 61 6c 20 77 69 74 68 20 62 6f 74 68 20 6f | evising.ways.to.deal.with.both.o |
| cbca0 | 66 20 74 68 65 73 65 20 61 74 20 6f 6e 63 65 20 69 73 20 61 6e 0a 61 63 74 69 76 65 20 61 72 65 | f.these.at.once.is.an.active.are |
| cbcc0 | 61 20 6f 66 20 72 65 73 65 61 72 63 68 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f | a.of.research......----------.Fo |
| cbce0 | 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 69 73 20 | otnotes.----------.....(1).This. |
| cbd00 | 70 72 6f 63 65 64 75 72 65 20 69 73 20 6e 6f 74 20 67 75 61 72 61 6e 74 65 65 64 20 74 6f 20 77 | procedure.is.not.guaranteed.to.w |
| cbd20 | 6f 72 6b 20 69 6e 20 61 6c 6c 20 53 63 68 65 6d 65 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e | ork.in.all.Scheme.implementation |
| cbd40 | 73 2c 20 61 6c 74 68 6f 75 67 68 20 66 6f 72 20 61 6e 79 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 | s,.although.for.any.implementati |
| cbd60 | 6f 6e 20 74 68 65 72 65 20 69 73 20 61 20 73 69 6d 70 6c 65 0a 76 61 72 69 61 74 69 6f 6e 20 74 | on.there.is.a.simple.variation.t |
| cbd80 | 68 61 74 20 77 69 6c 6c 20 77 6f 72 6b 2e 20 20 54 68 65 20 70 72 6f 62 6c 65 6d 20 68 61 73 20 | hat.will.work...The.problem.has. |
| cbda0 | 74 6f 20 64 6f 20 77 69 74 68 20 73 75 62 74 6c 65 0a 64 69 66 66 65 72 65 6e 63 65 73 20 69 6e | to.do.with.subtle.differences.in |
| cbdc0 | 20 74 68 65 20 77 61 79 73 20 74 68 61 74 20 53 63 68 65 6d 65 20 69 6d 70 6c 65 6d 65 6e 74 61 | .the.ways.that.Scheme.implementa |
| cbde0 | 74 69 6f 6e 73 20 68 61 6e 64 6c 65 20 69 6e 74 65 72 6e 61 6c 0a 64 65 66 69 6e 69 74 69 6f 6e | tions.handle.internal.definition |
| cbe00 | 73 2e 20 20 28 53 65 65 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 36 3a 3a 2e 29 | s...(See.section.*Note.4-1-6::.) |
| cbe20 | 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 69 73 20 61 20 73 6d 61 6c 6c 20 72 65 66 6c 65 63 74 | .....(2).This.is.a.small.reflect |
| cbe40 | 69 6f 6e 2c 20 69 6e 20 4c 69 73 70 2c 20 6f 66 20 74 68 65 20 64 69 66 66 69 63 75 6c 74 69 65 | ion,.in.Lisp,.of.the.difficultie |
| cbe60 | 73 20 74 68 61 74 0a 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 73 74 72 6f 6e 67 6c 79 20 74 79 70 | s.that.conventional.strongly.typ |
| cbe80 | 65 64 20 6c 61 6e 67 75 61 67 65 73 20 73 75 63 68 20 61 73 20 50 61 73 63 61 6c 20 68 61 76 65 | ed.languages.such.as.Pascal.have |
| cbea0 | 20 69 6e 20 63 6f 70 69 6e 67 20 77 69 74 68 0a 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f | .in.coping.with.higher-order.pro |
| cbec0 | 63 65 64 75 72 65 73 2e 20 20 49 6e 20 73 75 63 68 20 6c 61 6e 67 75 61 67 65 73 2c 20 74 68 65 | cedures...In.such.languages,.the |
| cbee0 | 20 70 72 6f 67 72 61 6d 6d 65 72 20 6d 75 73 74 0a 73 70 65 63 69 66 79 20 74 68 65 20 64 61 74 | .programmer.must.specify.the.dat |
| cbf00 | 61 20 74 79 70 65 73 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 74 68 65 | a.types.of.the.arguments.and.the |
| cbf20 | 20 72 65 73 75 6c 74 20 6f 66 20 65 61 63 68 0a 70 72 6f 63 65 64 75 72 65 3a 20 6e 75 6d 62 65 | .result.of.each.procedure:.numbe |
| cbf40 | 72 2c 20 6c 6f 67 69 63 61 6c 20 76 61 6c 75 65 2c 20 73 65 71 75 65 6e 63 65 2c 20 61 6e 64 20 | r,.logical.value,.sequence,.and. |
| cbf60 | 73 6f 20 6f 6e 2e 20 20 43 6f 6e 73 65 71 75 65 6e 74 6c 79 2c 0a 77 65 20 63 6f 75 6c 64 20 6e | so.on...Consequently,.we.could.n |
| cbf80 | 6f 74 20 65 78 70 72 65 73 73 20 61 6e 20 61 62 73 74 72 61 63 74 69 6f 6e 20 73 75 63 68 20 61 | ot.express.an.abstraction.such.a |
| cbfa0 | 73 20 22 6d 61 70 20 61 20 67 69 76 65 6e 20 70 72 6f 63 65 64 75 72 65 0a 60 70 72 6f 63 27 20 | s."map.a.given.procedure.`proc'. |
| cbfc0 | 6f 76 65 72 20 61 6c 6c 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 61 20 73 65 71 75 65 | over.all.the.elements.in.a.seque |
| cbfe0 | 6e 63 65 22 20 62 79 20 61 20 73 69 6e 67 6c 65 20 68 69 67 68 65 72 2d 6f 72 64 65 72 0a 70 72 | nce".by.a.single.higher-order.pr |
| cc000 | 6f 63 65 64 75 72 65 20 73 75 63 68 20 61 73 20 60 73 74 72 65 61 6d 2d 6d 61 70 27 2e 20 20 52 | ocedure.such.as.`stream-map'...R |
| cc020 | 61 74 68 65 72 2c 20 77 65 20 77 6f 75 6c 64 20 6e 65 65 64 20 61 20 64 69 66 66 65 72 65 6e 74 | ather,.we.would.need.a.different |
| cc040 | 0a 6d 61 70 70 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 65 61 63 68 20 64 69 66 66 | .mapping.procedure.for.each.diff |
| cc060 | 65 72 65 6e 74 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 61 72 67 75 6d 65 6e 74 20 61 6e | erent.combination.of.argument.an |
| cc080 | 64 20 72 65 73 75 6c 74 0a 64 61 74 61 20 74 79 70 65 73 20 74 68 61 74 20 6d 69 67 68 74 20 62 | d.result.data.types.that.might.b |
| cc0a0 | 65 20 73 70 65 63 69 66 69 65 64 20 66 6f 72 20 61 20 60 70 72 6f 63 27 2e 20 20 4d 61 69 6e 74 | e.specified.for.a.`proc'...Maint |
| cc0c0 | 61 69 6e 69 6e 67 20 61 0a 70 72 61 63 74 69 63 61 6c 20 6e 6f 74 69 6f 6e 20 6f 66 20 22 64 61 | aining.a.practical.notion.of."da |
| cc0e0 | 74 61 20 74 79 70 65 22 20 69 6e 20 74 68 65 20 70 72 65 73 65 6e 63 65 20 6f 66 20 68 69 67 68 | ta.type".in.the.presence.of.high |
| cc100 | 65 72 2d 6f 72 64 65 72 0a 70 72 6f 63 65 64 75 72 65 73 20 72 61 69 73 65 73 20 6d 61 6e 79 20 | er-order.procedures.raises.many. |
| cc120 | 64 69 66 66 69 63 75 6c 74 20 69 73 73 75 65 73 2e 20 20 4f 6e 65 20 77 61 79 20 6f 66 20 64 65 | difficult.issues...One.way.of.de |
| cc140 | 61 6c 69 6e 67 20 77 69 74 68 20 74 68 69 73 0a 70 72 6f 62 6c 65 6d 20 69 73 20 69 6c 6c 75 73 | aling.with.this.problem.is.illus |
| cc160 | 74 72 61 74 65 64 20 62 79 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 4d 4c 20 28 47 6f 72 64 6f | trated.by.the.language.ML.(Gordo |
| cc180 | 6e 2c 20 4d 69 6c 6e 65 72 2c 20 61 6e 64 0a 57 61 64 73 77 6f 72 74 68 20 31 39 37 39 29 2c 20 | n,.Milner,.and.Wadsworth.1979),. |
| cc1a0 | 77 68 6f 73 65 20 22 70 6f 6c 79 6d 6f 72 70 68 69 63 20 64 61 74 61 20 74 79 70 65 73 22 20 69 | whose."polymorphic.data.types".i |
| cc1c0 | 6e 63 6c 75 64 65 20 74 65 6d 70 6c 61 74 65 73 20 66 6f 72 0a 68 69 67 68 65 72 2d 6f 72 64 65 | nclude.templates.for.higher-orde |
| cc1e0 | 72 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 73 20 62 65 74 77 65 65 6e 20 64 61 74 61 20 74 | r.transformations.between.data.t |
| cc200 | 79 70 65 73 2e 20 20 4d 6f 72 65 6f 76 65 72 2c 20 64 61 74 61 20 74 79 70 65 73 0a 66 6f 72 20 | ypes...Moreover,.data.types.for. |
| cc220 | 6d 6f 73 74 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 4d 4c 20 61 72 65 20 6e 65 76 65 72 20 | most.procedures.in.ML.are.never. |
| cc240 | 65 78 70 6c 69 63 69 74 6c 79 20 64 65 63 6c 61 72 65 64 20 62 79 20 74 68 65 0a 70 72 6f 67 72 | explicitly.declared.by.the.progr |
| cc260 | 61 6d 6d 65 72 2e 20 20 49 6e 73 74 65 61 64 2c 20 4d 4c 20 69 6e 63 6c 75 64 65 73 20 61 20 22 | ammer...Instead,.ML.includes.a." |
| cc280 | 74 79 70 65 2d 69 6e 66 65 72 65 6e 63 69 6e 67 22 20 6d 65 63 68 61 6e 69 73 6d 20 74 68 61 74 | type-inferencing".mechanism.that |
| cc2a0 | 0a 75 73 65 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e | .uses.information.in.the.environ |
| cc2c0 | 6d 65 6e 74 20 74 6f 20 64 65 64 75 63 65 20 74 68 65 20 64 61 74 61 20 74 79 70 65 73 20 66 6f | ment.to.deduce.the.data.types.fo |
| cc2e0 | 72 20 6e 65 77 6c 79 0a 64 65 66 69 6e 65 64 20 70 72 6f 63 65 64 75 72 65 73 2e 0a 0a 1f 0a 46 | r.newly.defined.procedures.....F |
| cc300 | 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 33 2d 35 2d 35 2c 20 20 50 | ile:.sicp.info,..Node:.3-5-5,..P |
| cc320 | 72 65 76 3a 20 33 2d 35 2d 34 2c 20 20 55 70 3a 20 33 2d 35 0a 0a 33 2e 35 2e 35 20 4d 6f 64 75 | rev:.3-5-4,..Up:.3-5..3.5.5.Modu |
| cc340 | 6c 61 72 69 74 79 20 6f 66 20 46 75 6e 63 74 69 6f 6e 61 6c 20 50 72 6f 67 72 61 6d 73 20 61 6e | larity.of.Functional.Programs.an |
| cc360 | 64 20 4d 6f 64 75 6c 61 72 69 74 79 20 6f 66 20 4f 62 6a 65 63 74 73 0a 2d 2d 2d 2d 2d 2d 2d 2d | d.Modularity.of.Objects.-------- |
| cc380 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| cc3a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 41 73 20 77 65 | -------------------------..As.we |
| cc3c0 | 20 73 61 77 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 32 3a 3a 2c 20 6f | .saw.in.section.*Note.3-1-2::,.o |
| cc3e0 | 6e 65 20 6f 66 20 74 68 65 20 6d 61 6a 6f 72 20 62 65 6e 65 66 69 74 73 20 6f 66 0a 69 6e 74 72 | ne.of.the.major.benefits.of.intr |
| cc400 | 6f 64 75 63 69 6e 67 20 61 73 73 69 67 6e 6d 65 6e 74 20 69 73 20 74 68 61 74 20 77 65 20 63 61 | oducing.assignment.is.that.we.ca |
| cc420 | 6e 20 69 6e 63 72 65 61 73 65 20 74 68 65 20 6d 6f 64 75 6c 61 72 69 74 79 20 6f 66 20 6f 75 72 | n.increase.the.modularity.of.our |
| cc440 | 0a 73 79 73 74 65 6d 73 20 62 79 20 65 6e 63 61 70 73 75 6c 61 74 69 6e 67 2c 20 6f 72 20 22 68 | .systems.by.encapsulating,.or."h |
| cc460 | 69 64 69 6e 67 2c 22 20 70 61 72 74 73 20 6f 66 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 61 20 | iding,".parts.of.the.state.of.a. |
| cc480 | 6c 61 72 67 65 0a 73 79 73 74 65 6d 20 77 69 74 68 69 6e 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 | large.system.within.local.variab |
| cc4a0 | 6c 65 73 2e 20 20 53 74 72 65 61 6d 20 6d 6f 64 65 6c 73 20 63 61 6e 20 70 72 6f 76 69 64 65 20 | les...Stream.models.can.provide. |
| cc4c0 | 61 6e 20 65 71 75 69 76 61 6c 65 6e 74 0a 6d 6f 64 75 6c 61 72 69 74 79 20 77 69 74 68 6f 75 74 | an.equivalent.modularity.without |
| cc4e0 | 20 74 68 65 20 75 73 65 20 6f 66 20 61 73 73 69 67 6e 6d 65 6e 74 2e 20 20 41 73 20 61 6e 20 69 | .the.use.of.assignment...As.an.i |
| cc500 | 6c 6c 75 73 74 72 61 74 69 6f 6e 2c 20 77 65 20 63 61 6e 0a 72 65 69 6d 70 6c 65 6d 65 6e 74 20 | llustration,.we.can.reimplement. |
| cc520 | 74 68 65 20 4d 6f 6e 74 65 20 43 61 72 6c 6f 20 65 73 74 69 6d 61 74 69 6f 6e 20 6f 66 20 5b 70 | the.Monte.Carlo.estimation.of.[p |
| cc540 | 69 5d 2c 20 77 68 69 63 68 20 77 65 20 65 78 61 6d 69 6e 65 64 20 69 6e 0a 73 65 63 74 69 6f 6e | i],.which.we.examined.in.section |
| cc560 | 20 2a 4e 6f 74 65 20 33 2d 31 2d 32 3a 3a 2c 20 66 72 6f 6d 20 61 20 73 74 72 65 61 6d 2d 70 72 | .*Note.3-1-2::,.from.a.stream-pr |
| cc580 | 6f 63 65 73 73 69 6e 67 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 2e 0a 0a 20 20 20 54 68 65 20 | ocessing.point.of.view......The. |
| cc5a0 | 6b 65 79 20 6d 6f 64 75 6c 61 72 69 74 79 20 69 73 73 75 65 20 77 61 73 20 74 68 61 74 20 77 65 | key.modularity.issue.was.that.we |
| cc5c0 | 20 77 69 73 68 65 64 20 74 6f 20 68 69 64 65 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 0a 73 74 61 | .wished.to.hide.the.internal.sta |
| cc5e0 | 74 65 20 6f 66 20 61 20 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 20 67 65 6e 65 72 61 74 6f 72 20 | te.of.a.random-number.generator. |
| cc600 | 66 72 6f 6d 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 75 73 65 64 20 72 61 6e 64 6f 6d 0a 6e | from.programs.that.used.random.n |
| cc620 | 75 6d 62 65 72 73 2e 20 20 57 65 20 62 65 67 61 6e 20 77 69 74 68 20 61 20 70 72 6f 63 65 64 75 | umbers...We.began.with.a.procedu |
| cc640 | 72 65 20 60 72 61 6e 64 2d 75 70 64 61 74 65 27 2c 20 77 68 6f 73 65 20 73 75 63 63 65 73 73 69 | re.`rand-update',.whose.successi |
| cc660 | 76 65 0a 76 61 6c 75 65 73 20 66 75 72 6e 69 73 68 65 64 20 6f 75 72 20 73 75 70 70 6c 79 20 6f | ve.values.furnished.our.supply.o |
| cc680 | 66 20 72 61 6e 64 6f 6d 20 6e 75 6d 62 65 72 73 2c 20 61 6e 64 20 75 73 65 64 20 74 68 69 73 20 | f.random.numbers,.and.used.this. |
| cc6a0 | 74 6f 20 70 72 6f 64 75 63 65 0a 61 20 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 20 67 65 6e 65 72 | to.produce.a.random-number.gener |
| cc6c0 | 61 74 6f 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 72 61 6e 64 0a 20 20 20 20 20 20 20 | ator:.......(define.rand........ |
| cc6e0 | 28 6c 65 74 20 28 28 78 20 72 61 6e 64 6f 6d 2d 69 6e 69 74 29 29 0a 20 20 20 20 20 20 20 20 20 | (let.((x.random-init)).......... |
| cc700 | 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 78 20 28 72 | (lambda.()............(set!.x.(r |
| cc720 | 61 6e 64 2d 75 70 64 61 74 65 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 78 29 29 29 0a 0a | and-update.x))............x))).. |
| cc740 | 20 20 20 49 6e 20 74 68 65 20 73 74 72 65 61 6d 20 66 6f 72 6d 75 6c 61 74 69 6f 6e 20 74 68 65 | ...In.the.stream.formulation.the |
| cc760 | 72 65 20 69 73 20 6e 6f 20 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 20 67 65 6e 65 72 61 74 6f 72 | re.is.no.random-number.generator |
| cc780 | 20 5f 70 65 72 0a 73 65 5f 2c 20 6a 75 73 74 20 61 20 73 74 72 65 61 6d 20 6f 66 20 72 61 6e 64 | ._per.se_,.just.a.stream.of.rand |
| cc7a0 | 6f 6d 20 6e 75 6d 62 65 72 73 20 70 72 6f 64 75 63 65 64 20 62 79 20 73 75 63 63 65 73 73 69 76 | om.numbers.produced.by.successiv |
| cc7c0 | 65 20 63 61 6c 6c 73 20 74 6f 0a 60 72 61 6e 64 2d 75 70 64 61 74 65 27 3a 0a 0a 20 20 20 20 20 | e.calls.to.`rand-update':....... |
| cc7e0 | 28 64 65 66 69 6e 65 20 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 73 0a 20 20 20 20 20 20 20 28 63 | (define.random-numbers........(c |
| cc800 | 6f 6e 73 2d 73 74 72 65 61 6d 20 72 61 6e 64 6f 6d 2d 69 6e 69 74 0a 20 20 20 20 20 20 20 20 20 | ons-stream.random-init.......... |
| cc820 | 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 72 61 6e 64 2d 75 70 64 61 | ...........(stream-map.rand-upda |
| cc840 | 74 65 20 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 73 29 29 29 0a 0a 20 20 20 57 65 20 75 73 65 20 | te.random-numbers))).....We.use. |
| cc860 | 74 68 69 73 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 | this.to.construct.the.stream.of. |
| cc880 | 6f 75 74 63 6f 6d 65 73 20 6f 66 20 74 68 65 20 43 65 73 61 60 72 6f 0a 65 78 70 65 72 69 6d 65 | outcomes.of.the.Cesa`ro.experime |
| cc8a0 | 6e 74 20 70 65 72 66 6f 72 6d 65 64 20 6f 6e 20 63 6f 6e 73 65 63 75 74 69 76 65 20 70 61 69 72 | nt.performed.on.consecutive.pair |
| cc8c0 | 73 20 69 6e 20 74 68 65 20 60 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 73 27 0a 73 74 72 65 61 6d | s.in.the.`random-numbers'.stream |
| cc8e0 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 63 65 73 61 72 6f 2d 73 74 72 65 61 6d 0a 20 20 | :.......(define.cesaro-stream... |
| cc900 | 20 20 20 20 20 28 6d 61 70 2d 73 75 63 63 65 73 73 69 76 65 2d 70 61 69 72 73 20 28 6c 61 6d 62 | .....(map-successive-pairs.(lamb |
| cc920 | 64 61 20 28 72 31 20 72 32 29 20 28 3d 20 28 67 63 64 20 72 31 20 72 32 29 20 31 29 29 0a 20 20 | da.(r1.r2).(=.(gcd.r1.r2).1))... |
| cc940 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 61 6e 64 6f | ...........................rando |
| cc960 | 6d 2d 6e 75 6d 62 65 72 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 70 2d 73 | m-numbers)).......(define.(map-s |
| cc980 | 75 63 63 65 73 73 69 76 65 2d 70 61 69 72 73 20 66 20 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e | uccessive-pairs.f.s)........(con |
| cc9a0 | 73 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 28 66 20 28 73 74 72 65 61 6d 2d 63 61 72 20 | s-stream.........(f.(stream-car. |
| cc9c0 | 73 29 20 28 73 74 72 65 61 6d 2d 63 61 72 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 29 29 29 0a | s).(stream-car.(stream-cdr.s))). |
| cc9e0 | 20 20 20 20 20 20 20 20 28 6d 61 70 2d 73 75 63 63 65 73 73 69 76 65 2d 70 61 69 72 73 20 66 20 | ........(map-successive-pairs.f. |
| cca00 | 28 73 74 72 65 61 6d 2d 63 64 72 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 29 29 29 29 29 0a 0a | (stream-cdr.(stream-cdr.s))))).. |
| cca20 | 20 20 20 54 68 65 20 60 63 65 73 61 72 6f 2d 73 74 72 65 61 6d 27 20 69 73 20 6e 6f 77 20 66 65 | ...The.`cesaro-stream'.is.now.fe |
| cca40 | 64 20 74 6f 20 61 20 60 6d 6f 6e 74 65 2d 63 61 72 6c 6f 27 20 70 72 6f 63 65 64 75 72 65 2c 20 | d.to.a.`monte-carlo'.procedure,. |
| cca60 | 77 68 69 63 68 0a 70 72 6f 64 75 63 65 73 20 61 20 73 74 72 65 61 6d 20 6f 66 20 65 73 74 69 6d | which.produces.a.stream.of.estim |
| cca80 | 61 74 65 73 20 6f 66 20 70 72 6f 62 61 62 69 6c 69 74 69 65 73 2e 20 20 54 68 65 20 72 65 73 75 | ates.of.probabilities...The.resu |
| ccaa0 | 6c 74 73 20 61 72 65 20 74 68 65 6e 0a 63 6f 6e 76 65 72 74 65 64 20 69 6e 74 6f 20 61 20 73 74 | lts.are.then.converted.into.a.st |
| ccac0 | 72 65 61 6d 20 6f 66 20 65 73 74 69 6d 61 74 65 73 20 6f 66 20 5b 70 69 5d 2e 20 20 54 68 69 73 | ream.of.estimates.of.[pi]...This |
| ccae0 | 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 0a 70 72 6f 67 72 61 6d 20 64 6f 65 73 6e 27 74 20 | .version.of.the.program.doesn't. |
| ccb00 | 6e 65 65 64 20 61 20 70 61 72 61 6d 65 74 65 72 20 74 65 6c 6c 69 6e 67 20 68 6f 77 20 6d 61 6e | need.a.parameter.telling.how.man |
| ccb20 | 79 20 74 72 69 61 6c 73 20 74 6f 20 70 65 72 66 6f 72 6d 2e 0a 42 65 74 74 65 72 20 65 73 74 69 | y.trials.to.perform..Better.esti |
| ccb40 | 6d 61 74 65 73 20 6f 66 20 5b 70 69 5d 20 28 66 72 6f 6d 20 70 65 72 66 6f 72 6d 69 6e 67 20 6d | mates.of.[pi].(from.performing.m |
| ccb60 | 6f 72 65 20 65 78 70 65 72 69 6d 65 6e 74 73 29 20 61 72 65 0a 6f 62 74 61 69 6e 65 64 20 62 79 | ore.experiments).are.obtained.by |
| ccb80 | 20 6c 6f 6f 6b 69 6e 67 20 66 61 72 74 68 65 72 20 69 6e 74 6f 20 74 68 65 20 60 70 69 27 20 73 | .looking.farther.into.the.`pi'.s |
| ccba0 | 74 72 65 61 6d 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 6f 6e 74 65 2d 63 61 72 6c | tream:.......(define.(monte-carl |
| ccbc0 | 6f 20 65 78 70 65 72 69 6d 65 6e 74 2d 73 74 72 65 61 6d 20 70 61 73 73 65 64 20 66 61 69 6c 65 | o.experiment-stream.passed.faile |
| ccbe0 | 64 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6e 65 78 74 20 70 61 73 73 65 64 20 66 | d)........(define.(next.passed.f |
| ccc00 | 61 69 6c 65 64 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a 20 20 20 | ailed)..........(cons-stream.... |
| ccc20 | 20 20 20 20 20 20 20 28 2f 20 70 61 73 73 65 64 20 28 2b 20 70 61 73 73 65 64 20 66 61 69 6c 65 | .......(/.passed.(+.passed.faile |
| ccc40 | 64 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 6d 6f 6e 74 65 2d 63 61 72 6c 6f 0a 20 20 20 20 20 | d))...........(monte-carlo...... |
| ccc60 | 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 64 72 20 65 78 70 65 72 69 6d 65 6e 74 2d 73 74 72 | ......(stream-cdr.experiment-str |
| ccc80 | 65 61 6d 29 20 70 61 73 73 65 64 20 66 61 69 6c 65 64 29 29 29 0a 20 20 20 20 20 20 20 28 69 66 | eam).passed.failed)))........(if |
| ccca0 | 20 28 73 74 72 65 61 6d 2d 63 61 72 20 65 78 70 65 72 69 6d 65 6e 74 2d 73 74 72 65 61 6d 29 0a | .(stream-car.experiment-stream). |
| cccc0 | 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 78 74 20 28 2b 20 70 61 73 73 65 64 20 31 29 20 66 61 | ...........(next.(+.passed.1).fa |
| ccce0 | 69 6c 65 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 78 74 20 70 61 73 73 65 64 20 28 2b | iled)............(next.passed.(+ |
| ccd00 | 20 66 61 69 6c 65 64 20 31 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 70 69 0a 20 | .failed.1)))).......(define.pi.. |
| ccd20 | 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 70 29 20 28 73 | ......(stream-map.(lambda.(p).(s |
| ccd40 | 71 72 74 20 28 2f 20 36 20 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | qrt.(/.6.p)))................... |
| ccd60 | 20 28 6d 6f 6e 74 65 2d 63 61 72 6c 6f 20 63 65 73 61 72 6f 2d 73 74 72 65 61 6d 20 30 20 30 29 | .(monte-carlo.cesaro-stream.0.0) |
| ccd80 | 29 29 0a 0a 20 20 20 54 68 65 72 65 20 69 73 20 63 6f 6e 73 69 64 65 72 61 62 6c 65 20 6d 6f 64 | )).....There.is.considerable.mod |
| ccda0 | 75 6c 61 72 69 74 79 20 69 6e 20 74 68 69 73 20 61 70 70 72 6f 61 63 68 2c 20 62 65 63 61 75 73 | ularity.in.this.approach,.becaus |
| ccdc0 | 65 20 77 65 20 73 74 69 6c 6c 0a 63 61 6e 20 66 6f 72 6d 75 6c 61 74 65 20 61 20 67 65 6e 65 72 | e.we.still.can.formulate.a.gener |
| ccde0 | 61 6c 20 60 6d 6f 6e 74 65 2d 63 61 72 6c 6f 27 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 | al.`monte-carlo'.procedure.that. |
| cce00 | 63 61 6e 20 64 65 61 6c 20 77 69 74 68 0a 61 72 62 69 74 72 61 72 79 20 65 78 70 65 72 69 6d 65 | can.deal.with.arbitrary.experime |
| cce20 | 6e 74 73 2e 20 20 59 65 74 20 74 68 65 72 65 20 69 73 20 6e 6f 20 61 73 73 69 67 6e 6d 65 6e 74 | nts...Yet.there.is.no.assignment |
| cce40 | 20 6f 72 20 6c 6f 63 61 6c 20 73 74 61 74 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | .or.local.state........*Exercise |
| cce60 | 20 33 2e 38 31 3a 2a 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 36 3a 3a 20 64 69 73 | .3.81:*.*Note.Exercise.3-6::.dis |
| cce80 | 63 75 73 73 65 64 20 67 65 6e 65 72 61 6c 69 7a 69 6e 67 20 74 68 65 0a 20 20 20 20 20 72 61 6e | cussed.generalizing.the......ran |
| ccea0 | 64 6f 6d 2d 6e 75 6d 62 65 72 20 67 65 6e 65 72 61 74 6f 72 20 74 6f 20 61 6c 6c 6f 77 20 6f 6e | dom-number.generator.to.allow.on |
| ccec0 | 65 20 74 6f 20 72 65 73 65 74 20 74 68 65 20 72 61 6e 64 6f 6d 2d 6e 75 6d 62 65 72 0a 20 20 20 | e.to.reset.the.random-number.... |
| ccee0 | 20 20 73 65 71 75 65 6e 63 65 20 73 6f 20 61 73 20 74 6f 20 70 72 6f 64 75 63 65 20 72 65 70 65 | ..sequence.so.as.to.produce.repe |
| ccf00 | 61 74 61 62 6c 65 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 22 72 61 6e 64 6f 6d 22 0a 20 20 20 | atable.sequences.of."random".... |
| ccf20 | 20 20 6e 75 6d 62 65 72 73 2e 20 20 50 72 6f 64 75 63 65 20 61 20 73 74 72 65 61 6d 20 66 6f 72 | ..numbers...Produce.a.stream.for |
| ccf40 | 6d 75 6c 61 74 69 6f 6e 20 6f 66 20 74 68 69 73 20 73 61 6d 65 20 67 65 6e 65 72 61 74 6f 72 20 | mulation.of.this.same.generator. |
| ccf60 | 74 68 61 74 0a 20 20 20 20 20 6f 70 65 72 61 74 65 73 20 6f 6e 20 61 6e 20 69 6e 70 75 74 20 73 | that......operates.on.an.input.s |
| ccf80 | 74 72 65 61 6d 20 6f 66 20 72 65 71 75 65 73 74 73 20 74 6f 20 60 67 65 6e 65 72 61 74 65 27 20 | tream.of.requests.to.`generate'. |
| ccfa0 | 61 20 6e 65 77 20 72 61 6e 64 6f 6d 0a 20 20 20 20 20 6e 75 6d 62 65 72 20 6f 72 20 74 6f 20 60 | a.new.random......number.or.to.` |
| ccfc0 | 72 65 73 65 74 27 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 74 6f 20 61 20 73 70 65 63 69 66 69 | reset'.the.sequence.to.a.specifi |
| ccfe0 | 65 64 20 76 61 6c 75 65 20 61 6e 64 20 74 68 61 74 0a 20 20 20 20 20 70 72 6f 64 75 63 65 73 20 | ed.value.and.that......produces. |
| cd000 | 74 68 65 20 64 65 73 69 72 65 64 20 73 74 72 65 61 6d 20 6f 66 20 72 61 6e 64 6f 6d 20 6e 75 6d | the.desired.stream.of.random.num |
| cd020 | 62 65 72 73 2e 20 20 44 6f 6e 27 74 20 75 73 65 0a 20 20 20 20 20 61 73 73 69 67 6e 6d 65 6e 74 | bers...Don't.use......assignment |
| cd040 | 20 69 6e 20 79 6f 75 72 20 73 6f 6c 75 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | .in.your.solution........*Exerci |
| cd060 | 73 65 20 33 2e 38 32 3a 2a 20 52 65 64 6f 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d | se.3.82:*.Redo.*Note.Exercise.3- |
| cd080 | 35 3a 3a 20 6f 6e 20 4d 6f 6e 74 65 20 43 61 72 6c 6f 0a 20 20 20 20 20 69 6e 74 65 67 72 61 74 | 5::.on.Monte.Carlo......integrat |
| cd0a0 | 69 6f 6e 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 73 74 72 65 61 6d 73 2e 20 20 54 68 65 20 73 74 | ion.in.terms.of.streams...The.st |
| cd0c0 | 72 65 61 6d 20 76 65 72 73 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 65 73 74 69 6d 61 74 65 2d 69 | ream.version.of......`estimate-i |
| cd0e0 | 6e 74 65 67 72 61 6c 27 20 77 69 6c 6c 20 6e 6f 74 20 68 61 76 65 20 61 6e 20 61 72 67 75 6d 65 | ntegral'.will.not.have.an.argume |
| cd100 | 6e 74 20 74 65 6c 6c 69 6e 67 20 68 6f 77 20 6d 61 6e 79 0a 20 20 20 20 20 74 72 69 61 6c 73 20 | nt.telling.how.many......trials. |
| cd120 | 74 6f 20 70 65 72 66 6f 72 6d 2e 20 20 49 6e 73 74 65 61 64 2c 20 69 74 20 77 69 6c 6c 20 70 72 | to.perform...Instead,.it.will.pr |
| cd140 | 6f 64 75 63 65 20 61 20 73 74 72 65 61 6d 20 6f 66 20 65 73 74 69 6d 61 74 65 73 0a 20 20 20 20 | oduce.a.stream.of.estimates..... |
| cd160 | 20 62 61 73 65 64 20 6f 6e 20 73 75 63 63 65 73 73 69 76 65 6c 79 20 6d 6f 72 65 20 74 72 69 61 | .based.on.successively.more.tria |
| cd180 | 6c 73 2e 0a 0a 41 20 66 75 6e 63 74 69 6f 6e 61 6c 2d 70 72 6f 67 72 61 6d 6d 69 6e 67 20 76 69 | ls...A.functional-programming.vi |
| cd1a0 | 65 77 20 6f 66 20 74 69 6d 65 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ew.of.time...................... |
| cd1c0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 4c 65 74 20 75 73 20 6e 6f 77 20 72 65 74 | ..................Let.us.now.ret |
| cd1e0 | 75 72 6e 20 74 6f 20 74 68 65 20 69 73 73 75 65 73 20 6f 66 20 6f 62 6a 65 63 74 73 20 61 6e 64 | urn.to.the.issues.of.objects.and |
| cd200 | 20 73 74 61 74 65 20 74 68 61 74 20 77 65 72 65 20 72 61 69 73 65 64 0a 61 74 20 74 68 65 20 62 | .state.that.were.raised.at.the.b |
| cd220 | 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 69 73 20 63 68 61 70 74 65 72 20 61 6e 64 20 65 78 61 | eginning.of.this.chapter.and.exa |
| cd240 | 6d 69 6e 65 20 74 68 65 6d 20 69 6e 20 61 20 6e 65 77 20 6c 69 67 68 74 2e 20 20 57 65 0a 69 6e | mine.them.in.a.new.light...We.in |
| cd260 | 74 72 6f 64 75 63 65 64 20 61 73 73 69 67 6e 6d 65 6e 74 20 61 6e 64 20 6d 75 74 61 62 6c 65 20 | troduced.assignment.and.mutable. |
| cd280 | 6f 62 6a 65 63 74 73 20 74 6f 20 70 72 6f 76 69 64 65 20 61 20 6d 65 63 68 61 6e 69 73 6d 20 66 | objects.to.provide.a.mechanism.f |
| cd2a0 | 6f 72 0a 6d 6f 64 75 6c 61 72 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 20 6f 66 20 70 72 6f 67 72 | or.modular.construction.of.progr |
| cd2c0 | 61 6d 73 20 74 68 61 74 20 6d 6f 64 65 6c 20 73 79 73 74 65 6d 73 20 77 69 74 68 20 73 74 61 74 | ams.that.model.systems.with.stat |
| cd2e0 | 65 2e 20 20 57 65 0a 63 6f 6e 73 74 72 75 63 74 65 64 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c | e...We.constructed.computational |
| cd300 | 20 6f 62 6a 65 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 | .objects.with.local.state.variab |
| cd320 | 6c 65 73 20 61 6e 64 20 75 73 65 64 0a 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 20 6d 6f 64 69 66 | les.and.used.assignment.to.modif |
| cd340 | 79 20 74 68 65 73 65 20 76 61 72 69 61 62 6c 65 73 2e 20 20 57 65 20 6d 6f 64 65 6c 65 64 20 74 | y.these.variables...We.modeled.t |
| cd360 | 68 65 20 74 65 6d 70 6f 72 61 6c 20 62 65 68 61 76 69 6f 72 0a 6f 66 20 74 68 65 20 6f 62 6a 65 | he.temporal.behavior.of.the.obje |
| cd380 | 63 74 73 20 69 6e 20 74 68 65 20 77 6f 72 6c 64 20 62 79 20 74 68 65 20 74 65 6d 70 6f 72 61 6c | cts.in.the.world.by.the.temporal |
| cd3a0 | 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 0a 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 63 | .behavior.of.the.corresponding.c |
| cd3c0 | 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 2e 0a 0a 20 20 20 4e 6f 77 20 77 65 | omputational.objects......Now.we |
| cd3e0 | 20 68 61 76 65 20 73 65 65 6e 20 74 68 61 74 20 73 74 72 65 61 6d 73 20 70 72 6f 76 69 64 65 20 | .have.seen.that.streams.provide. |
| cd400 | 61 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 77 61 79 20 74 6f 20 6d 6f 64 65 6c 0a 6f 62 6a 65 | an.alternative.way.to.model.obje |
| cd420 | 63 74 73 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 2e 20 20 57 65 20 63 61 6e 20 6d 6f | cts.with.local.state...We.can.mo |
| cd440 | 64 65 6c 20 61 20 63 68 61 6e 67 69 6e 67 20 71 75 61 6e 74 69 74 79 2c 20 73 75 63 68 20 61 73 | del.a.changing.quantity,.such.as |
| cd460 | 0a 74 68 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 6f 66 20 73 6f 6d 65 20 6f 62 6a 65 63 74 2c | .the.local.state.of.some.object, |
| cd480 | 20 75 73 69 6e 67 20 61 20 73 74 72 65 61 6d 20 74 68 61 74 20 72 65 70 72 65 73 65 6e 74 73 20 | .using.a.stream.that.represents. |
| cd4a0 | 74 68 65 20 74 69 6d 65 0a 68 69 73 74 6f 72 79 20 6f 66 20 73 75 63 63 65 73 73 69 76 65 20 73 | the.time.history.of.successive.s |
| cd4c0 | 74 61 74 65 73 2e 20 20 49 6e 20 65 73 73 65 6e 63 65 2c 20 77 65 20 72 65 70 72 65 73 65 6e 74 | tates...In.essence,.we.represent |
| cd4e0 | 20 74 69 6d 65 0a 65 78 70 6c 69 63 69 74 6c 79 2c 20 75 73 69 6e 67 20 73 74 72 65 61 6d 73 2c | .time.explicitly,.using.streams, |
| cd500 | 20 73 6f 20 74 68 61 74 20 77 65 20 64 65 63 6f 75 70 6c 65 20 74 69 6d 65 20 69 6e 20 6f 75 72 | .so.that.we.decouple.time.in.our |
| cd520 | 20 73 69 6d 75 6c 61 74 65 64 0a 77 6f 72 6c 64 20 66 72 6f 6d 20 74 68 65 20 73 65 71 75 65 6e | .simulated.world.from.the.sequen |
| cd540 | 63 65 20 6f 66 20 65 76 65 6e 74 73 20 74 68 61 74 20 74 61 6b 65 20 70 6c 61 63 65 20 64 75 72 | ce.of.events.that.take.place.dur |
| cd560 | 69 6e 67 20 65 76 61 6c 75 61 74 69 6f 6e 2e 0a 49 6e 64 65 65 64 2c 20 62 65 63 61 75 73 65 20 | ing.evaluation..Indeed,.because. |
| cd580 | 6f 66 20 74 68 65 20 70 72 65 73 65 6e 63 65 20 6f 66 20 60 64 65 6c 61 79 27 20 74 68 65 72 65 | of.the.presence.of.`delay'.there |
| cd5a0 | 20 6d 61 79 20 62 65 20 6c 69 74 74 6c 65 20 72 65 6c 61 74 69 6f 6e 0a 62 65 74 77 65 65 6e 20 | .may.be.little.relation.between. |
| cd5c0 | 73 69 6d 75 6c 61 74 65 64 20 74 69 6d 65 20 69 6e 20 74 68 65 20 6d 6f 64 65 6c 20 61 6e 64 20 | simulated.time.in.the.model.and. |
| cd5e0 | 74 68 65 20 6f 72 64 65 72 20 6f 66 20 65 76 65 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65 0a 65 | the.order.of.events.during.the.e |
| cd600 | 76 61 6c 75 61 74 69 6f 6e 2e 0a 0a 20 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 63 6f 6e 74 72 | valuation......In.order.to.contr |
| cd620 | 61 73 74 20 74 68 65 73 65 20 74 77 6f 20 61 70 70 72 6f 61 63 68 65 73 20 74 6f 20 6d 6f 64 65 | ast.these.two.approaches.to.mode |
| cd640 | 6c 69 6e 67 2c 20 6c 65 74 20 75 73 0a 72 65 63 6f 6e 73 69 64 65 72 20 74 68 65 20 69 6d 70 6c | ling,.let.us.reconsider.the.impl |
| cd660 | 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 20 22 77 69 74 68 64 72 61 77 61 6c 20 70 72 6f 63 | ementation.of.a."withdrawal.proc |
| cd680 | 65 73 73 6f 72 22 20 74 68 61 74 20 6d 6f 6e 69 74 6f 72 73 0a 74 68 65 20 62 61 6c 61 6e 63 65 | essor".that.monitors.the.balance |
| cd6a0 | 20 69 6e 20 61 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 2e 20 20 49 6e 20 73 65 63 74 69 6f 6e 20 | .in.a.bank.account...In.section. |
| cd6c0 | 2a 4e 6f 74 65 20 33 2d 31 2d 33 3a 3a 20 77 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 0a 61 20 73 | *Note.3-1-3::.we.implemented.a.s |
| cd6e0 | 69 6d 70 6c 69 66 69 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 73 75 63 68 20 61 20 70 72 6f 63 | implified.version.of.such.a.proc |
| cd700 | 65 73 73 6f 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 73 69 6d 70 6c | essor:.......(define.(make-simpl |
| cd720 | 69 66 69 65 64 2d 77 69 74 68 64 72 61 77 20 62 61 6c 61 6e 63 65 29 0a 20 20 20 20 20 20 20 28 | ified-withdraw.balance)........( |
| cd740 | 6c 61 6d 62 64 61 20 28 61 6d 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 62 | lambda.(amount)..........(set!.b |
| cd760 | 61 6c 61 6e 63 65 20 28 2d 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 29 29 0a 20 20 20 20 20 | alance.(-.balance.amount))...... |
| cd780 | 20 20 20 20 62 61 6c 61 6e 63 65 29 29 0a 0a 20 20 20 43 61 6c 6c 73 20 74 6f 20 60 6d 61 6b 65 | ....balance)).....Calls.to.`make |
| cd7a0 | 2d 73 69 6d 70 6c 69 66 69 65 64 2d 77 69 74 68 64 72 61 77 27 20 70 72 6f 64 75 63 65 20 63 6f | -simplified-withdraw'.produce.co |
| cd7c0 | 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6f 62 6a 65 63 74 73 2c 0a 65 61 63 68 20 77 69 74 68 20 61 | mputational.objects,.each.with.a |
| cd7e0 | 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 20 60 62 61 6c 61 6e 63 65 27 20 | .local.state.variable.`balance'. |
| cd800 | 74 68 61 74 20 69 73 20 64 65 63 72 65 6d 65 6e 74 65 64 20 62 79 0a 73 75 63 63 65 73 73 69 76 | that.is.decremented.by.successiv |
| cd820 | 65 20 63 61 6c 6c 73 20 74 6f 20 74 68 65 20 6f 62 6a 65 63 74 2e 20 20 54 68 65 20 6f 62 6a 65 | e.calls.to.the.object...The.obje |
| cd840 | 63 74 20 74 61 6b 65 73 20 61 6e 20 60 61 6d 6f 75 6e 74 27 20 61 73 20 61 6e 0a 61 72 67 75 6d | ct.takes.an.`amount'.as.an.argum |
| cd860 | 65 6e 74 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 6e 65 77 20 62 61 6c 61 6e 63 65 2e | ent.and.returns.the.new.balance. |
| cd880 | 20 20 57 65 20 63 61 6e 20 69 6d 61 67 69 6e 65 20 74 68 65 20 75 73 65 72 20 6f 66 20 61 0a 62 | ..We.can.imagine.the.user.of.a.b |
| cd8a0 | 61 6e 6b 20 61 63 63 6f 75 6e 74 20 74 79 70 69 6e 67 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 | ank.account.typing.a.sequence.of |
| cd8c0 | 20 69 6e 70 75 74 73 20 74 6f 20 73 75 63 68 20 61 6e 20 6f 62 6a 65 63 74 20 61 6e 64 0a 6f 62 | .inputs.to.such.an.object.and.ob |
| cd8e0 | 73 65 72 76 69 6e 67 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 72 65 74 75 72 6e 65 64 | serving.the.sequence.of.returned |
| cd900 | 20 76 61 6c 75 65 73 20 73 68 6f 77 6e 20 6f 6e 20 61 20 64 69 73 70 6c 61 79 20 73 63 72 65 65 | .values.shown.on.a.display.scree |
| cd920 | 6e 2e 0a 0a 20 20 20 41 6c 74 65 72 6e 61 74 69 76 65 6c 79 2c 20 77 65 20 63 61 6e 20 6d 6f 64 | n......Alternatively,.we.can.mod |
| cd940 | 65 6c 20 61 20 77 69 74 68 64 72 61 77 61 6c 20 70 72 6f 63 65 73 73 6f 72 20 61 73 20 61 20 70 | el.a.withdrawal.processor.as.a.p |
| cd960 | 72 6f 63 65 64 75 72 65 0a 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 20 61 20 62 | rocedure.that.takes.as.input.a.b |
| cd980 | 61 6c 61 6e 63 65 20 61 6e 64 20 61 20 73 74 72 65 61 6d 20 6f 66 20 61 6d 6f 75 6e 74 73 20 74 | alance.and.a.stream.of.amounts.t |
| cd9a0 | 6f 20 77 69 74 68 64 72 61 77 20 61 6e 64 0a 70 72 6f 64 75 63 65 73 20 74 68 65 20 73 74 72 65 | o.withdraw.and.produces.the.stre |
| cd9c0 | 61 6d 20 6f 66 20 73 75 63 63 65 73 73 69 76 65 20 62 61 6c 61 6e 63 65 73 20 69 6e 20 74 68 65 | am.of.successive.balances.in.the |
| cd9e0 | 20 61 63 63 6f 75 6e 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 72 65 61 6d 2d | .account:.......(define.(stream- |
| cda00 | 77 69 74 68 64 72 61 77 20 62 61 6c 61 6e 63 65 20 61 6d 6f 75 6e 74 2d 73 74 72 65 61 6d 29 0a | withdraw.balance.amount-stream). |
| cda20 | 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 62 61 6c 61 | .......(cons-stream.........bala |
| cda40 | 6e 63 65 0a 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 77 69 74 68 64 72 61 77 20 28 2d 20 | nce.........(stream-withdraw.(-. |
| cda60 | 62 61 6c 61 6e 63 65 20 28 73 74 72 65 61 6d 2d 63 61 72 20 61 6d 6f 75 6e 74 2d 73 74 72 65 61 | balance.(stream-car.amount-strea |
| cda80 | 6d 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 | m))..........................(st |
| cdaa0 | 72 65 61 6d 2d 63 64 72 20 61 6d 6f 75 6e 74 2d 73 74 72 65 61 6d 29 29 29 29 0a 0a 20 20 20 60 | ream-cdr.amount-stream)))).....` |
| cdac0 | 53 74 72 65 61 6d 2d 77 69 74 68 64 72 61 77 27 20 69 6d 70 6c 65 6d 65 6e 74 73 20 61 20 77 65 | Stream-withdraw'.implements.a.we |
| cdae0 | 6c 6c 2d 64 65 66 69 6e 65 64 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 66 75 6e 63 74 69 6f 6e | ll-defined.mathematical.function |
| cdb00 | 0a 77 68 6f 73 65 20 6f 75 74 70 75 74 20 69 73 20 66 75 6c 6c 79 20 64 65 74 65 72 6d 69 6e 65 | .whose.output.is.fully.determine |
| cdb20 | 64 20 62 79 20 69 74 73 20 69 6e 70 75 74 2e 20 20 53 75 70 70 6f 73 65 2c 20 68 6f 77 65 76 65 | d.by.its.input...Suppose,.howeve |
| cdb40 | 72 2c 20 74 68 61 74 0a 74 68 65 20 69 6e 70 75 74 20 60 61 6d 6f 75 6e 74 2d 73 74 72 65 61 6d | r,.that.the.input.`amount-stream |
| cdb60 | 27 20 69 73 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 73 75 63 63 65 73 73 69 76 65 20 76 61 | '.is.the.stream.of.successive.va |
| cdb80 | 6c 75 65 73 20 74 79 70 65 64 20 62 79 0a 74 68 65 20 75 73 65 72 20 61 6e 64 20 74 68 61 74 20 | lues.typed.by.the.user.and.that. |
| cdba0 | 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 73 74 72 65 61 6d 20 6f 66 20 62 61 6c 61 6e 63 65 73 | the.resulting.stream.of.balances |
| cdbc0 | 20 69 73 20 64 69 73 70 6c 61 79 65 64 2e 20 20 54 68 65 6e 2c 0a 66 72 6f 6d 20 74 68 65 20 70 | .is.displayed...Then,.from.the.p |
| cdbe0 | 65 72 73 70 65 63 74 69 76 65 20 6f 66 20 74 68 65 20 75 73 65 72 20 77 68 6f 20 69 73 20 74 79 | erspective.of.the.user.who.is.ty |
| cdc00 | 70 69 6e 67 20 76 61 6c 75 65 73 20 61 6e 64 20 77 61 74 63 68 69 6e 67 0a 72 65 73 75 6c 74 73 | ping.values.and.watching.results |
| cdc20 | 2c 20 74 68 65 20 73 74 72 65 61 6d 20 70 72 6f 63 65 73 73 20 68 61 73 20 74 68 65 20 73 61 6d | ,.the.stream.process.has.the.sam |
| cdc40 | 65 20 62 65 68 61 76 69 6f 72 20 61 73 20 74 68 65 20 6f 62 6a 65 63 74 20 63 72 65 61 74 65 64 | e.behavior.as.the.object.created |
| cdc60 | 0a 62 79 20 60 6d 61 6b 65 2d 73 69 6d 70 6c 69 66 69 65 64 2d 77 69 74 68 64 72 61 77 27 2e 20 | .by.`make-simplified-withdraw'.. |
| cdc80 | 20 48 6f 77 65 76 65 72 2c 20 77 69 74 68 20 74 68 65 20 73 74 72 65 61 6d 20 76 65 72 73 69 6f | .However,.with.the.stream.versio |
| cdca0 | 6e 2c 20 74 68 65 72 65 0a 69 73 20 6e 6f 20 61 73 73 69 67 6e 6d 65 6e 74 2c 20 6e 6f 20 6c 6f | n,.there.is.no.assignment,.no.lo |
| cdcc0 | 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 2c 20 61 6e 64 20 63 6f 6e 73 65 71 75 65 | cal.state.variable,.and.conseque |
| cdce0 | 6e 74 6c 79 20 6e 6f 6e 65 20 6f 66 20 74 68 65 0a 74 68 65 6f 72 65 74 69 63 61 6c 20 64 69 66 | ntly.none.of.the.theoretical.dif |
| cdd00 | 66 69 63 75 6c 74 69 65 73 20 74 68 61 74 20 77 65 20 65 6e 63 6f 75 6e 74 65 72 65 64 20 69 6e | ficulties.that.we.encountered.in |
| cdd20 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 31 2d 33 3a 3a 2e 0a 59 65 74 20 74 68 65 20 | .section.*Note.3-1-3::..Yet.the. |
| cdd40 | 73 79 73 74 65 6d 20 68 61 73 20 73 74 61 74 65 21 0a 0a 20 20 20 54 68 69 73 20 69 73 20 72 65 | system.has.state!.....This.is.re |
| cdd60 | 61 6c 6c 79 20 72 65 6d 61 72 6b 61 62 6c 65 2e 20 20 45 76 65 6e 20 74 68 6f 75 67 68 20 60 73 | ally.remarkable...Even.though.`s |
| cdd80 | 74 72 65 61 6d 2d 77 69 74 68 64 72 61 77 27 20 69 6d 70 6c 65 6d 65 6e 74 73 0a 61 20 77 65 6c | tream-withdraw'.implements.a.wel |
| cdda0 | 6c 2d 64 65 66 69 6e 65 64 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 66 75 6e 63 74 69 6f 6e 20 | l-defined.mathematical.function. |
| cddc0 | 77 68 6f 73 65 20 62 65 68 61 76 69 6f 72 20 64 6f 65 73 20 6e 6f 74 20 63 68 61 6e 67 65 2c 0a | whose.behavior.does.not.change,. |
| cdde0 | 74 68 65 20 75 73 65 72 27 73 20 70 65 72 63 65 70 74 69 6f 6e 20 68 65 72 65 20 69 73 20 6f 6e | the.user's.perception.here.is.on |
| cde00 | 65 20 6f 66 20 69 6e 74 65 72 61 63 74 69 6e 67 20 77 69 74 68 20 61 20 73 79 73 74 65 6d 20 74 | e.of.interacting.with.a.system.t |
| cde20 | 68 61 74 20 68 61 73 0a 61 20 63 68 61 6e 67 69 6e 67 20 73 74 61 74 65 2e 20 20 4f 6e 65 20 77 | hat.has.a.changing.state...One.w |
| cde40 | 61 79 20 74 6f 20 72 65 73 6f 6c 76 65 20 74 68 69 73 20 70 61 72 61 64 6f 78 20 69 73 20 74 6f | ay.to.resolve.this.paradox.is.to |
| cde60 | 20 72 65 61 6c 69 7a 65 20 74 68 61 74 0a 69 74 20 69 73 20 74 68 65 20 75 73 65 72 27 73 20 74 | .realize.that.it.is.the.user's.t |
| cde80 | 65 6d 70 6f 72 61 6c 20 65 78 69 73 74 65 6e 63 65 20 74 68 61 74 20 69 6d 70 6f 73 65 73 20 73 | emporal.existence.that.imposes.s |
| cdea0 | 74 61 74 65 20 6f 6e 20 74 68 65 20 73 79 73 74 65 6d 2e 0a 49 66 20 74 68 65 20 75 73 65 72 20 | tate.on.the.system..If.the.user. |
| cdec0 | 63 6f 75 6c 64 20 73 74 65 70 20 62 61 63 6b 20 66 72 6f 6d 20 74 68 65 20 69 6e 74 65 72 61 63 | could.step.back.from.the.interac |
| cdee0 | 74 69 6f 6e 20 61 6e 64 20 74 68 69 6e 6b 20 69 6e 20 74 65 72 6d 73 20 6f 66 0a 73 74 72 65 61 | tion.and.think.in.terms.of.strea |
| cdf00 | 6d 73 20 6f 66 20 62 61 6c 61 6e 63 65 73 20 72 61 74 68 65 72 20 74 68 61 6e 20 69 6e 64 69 76 | ms.of.balances.rather.than.indiv |
| cdf20 | 69 64 75 61 6c 20 74 72 61 6e 73 61 63 74 69 6f 6e 73 2c 20 74 68 65 20 73 79 73 74 65 6d 0a 77 | idual.transactions,.the.system.w |
| cdf40 | 6f 75 6c 64 20 61 70 70 65 61 72 20 73 74 61 74 65 6c 65 73 73 2e 28 31 29 0a 0a 20 20 20 46 72 | ould.appear.stateless.(1).....Fr |
| cdf60 | 6f 6d 20 74 68 65 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 20 6f 66 20 6f 6e 65 20 70 61 72 74 | om.the.point.of.view.of.one.part |
| cdf80 | 20 6f 66 20 61 20 63 6f 6d 70 6c 65 78 20 70 72 6f 63 65 73 73 2c 20 74 68 65 20 6f 74 68 65 72 | .of.a.complex.process,.the.other |
| cdfa0 | 0a 70 61 72 74 73 20 61 70 70 65 61 72 20 74 6f 20 63 68 61 6e 67 65 20 77 69 74 68 20 74 69 6d | .parts.appear.to.change.with.tim |
| cdfc0 | 65 2e 20 20 54 68 65 79 20 68 61 76 65 20 68 69 64 64 65 6e 20 74 69 6d 65 2d 76 61 72 79 69 6e | e...They.have.hidden.time-varyin |
| cdfe0 | 67 20 6c 6f 63 61 6c 0a 73 74 61 74 65 2e 20 20 49 66 20 77 65 20 77 69 73 68 20 74 6f 20 77 72 | g.local.state...If.we.wish.to.wr |
| ce000 | 69 74 65 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 6d 6f 64 65 6c 20 74 68 69 73 20 6b 69 6e | ite.programs.that.model.this.kin |
| ce020 | 64 20 6f 66 20 6e 61 74 75 72 61 6c 0a 64 65 63 6f 6d 70 6f 73 69 74 69 6f 6e 20 69 6e 20 6f 75 | d.of.natural.decomposition.in.ou |
| ce040 | 72 20 77 6f 72 6c 64 20 28 61 73 20 77 65 20 73 65 65 20 69 74 20 66 72 6f 6d 20 6f 75 72 20 76 | r.world.(as.we.see.it.from.our.v |
| ce060 | 69 65 77 70 6f 69 6e 74 20 61 73 20 61 20 70 61 72 74 0a 6f 66 20 74 68 61 74 20 77 6f 72 6c 64 | iewpoint.as.a.part.of.that.world |
| ce080 | 29 20 77 69 74 68 20 73 74 72 75 63 74 75 72 65 73 20 69 6e 20 6f 75 72 20 63 6f 6d 70 75 74 65 | ).with.structures.in.our.compute |
| ce0a0 | 72 2c 20 77 65 20 6d 61 6b 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 0a 6f 62 6a 65 63 74 73 | r,.we.make.computational.objects |
| ce0c0 | 20 74 68 61 74 20 61 72 65 20 6e 6f 74 20 66 75 6e 63 74 69 6f 6e 61 6c 2d 2d 74 68 65 79 20 6d | .that.are.not.functional--they.m |
| ce0e0 | 75 73 74 20 63 68 61 6e 67 65 20 77 69 74 68 20 74 69 6d 65 2e 20 20 57 65 20 6d 6f 64 65 6c 0a | ust.change.with.time...We.model. |
| ce100 | 73 74 61 74 65 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 | state.with.local.state.variables |
| ce120 | 2c 20 61 6e 64 20 77 65 20 6d 6f 64 65 6c 20 74 68 65 20 63 68 61 6e 67 65 73 20 6f 66 20 73 74 | ,.and.we.model.the.changes.of.st |
| ce140 | 61 74 65 0a 77 69 74 68 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 74 6f 20 74 68 6f 73 65 20 76 61 | ate.with.assignments.to.those.va |
| ce160 | 72 69 61 62 6c 65 73 2e 20 20 42 79 20 64 6f 69 6e 67 20 74 68 69 73 20 77 65 20 6d 61 6b 65 20 | riables...By.doing.this.we.make. |
| ce180 | 74 68 65 20 74 69 6d 65 20 6f 66 0a 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 61 20 63 6f 6d 70 75 | the.time.of.execution.of.a.compu |
| ce1a0 | 74 61 74 69 6f 6e 20 6d 6f 64 65 6c 20 74 69 6d 65 20 69 6e 20 74 68 65 20 77 6f 72 6c 64 20 74 | tation.model.time.in.the.world.t |
| ce1c0 | 68 61 74 20 77 65 20 61 72 65 20 70 61 72 74 20 6f 66 2c 0a 61 6e 64 20 74 68 75 73 20 77 65 20 | hat.we.are.part.of,.and.thus.we. |
| ce1e0 | 67 65 74 20 22 6f 62 6a 65 63 74 73 22 20 69 6e 20 6f 75 72 20 63 6f 6d 70 75 74 65 72 2e 0a 0a | get."objects".in.our.computer... |
| ce200 | 20 20 20 4d 6f 64 65 6c 69 6e 67 20 77 69 74 68 20 6f 62 6a 65 63 74 73 20 69 73 20 70 6f 77 65 | ...Modeling.with.objects.is.powe |
| ce220 | 72 66 75 6c 20 61 6e 64 20 69 6e 74 75 69 74 69 76 65 2c 20 6c 61 72 67 65 6c 79 20 62 65 63 61 | rful.and.intuitive,.largely.beca |
| ce240 | 75 73 65 0a 74 68 69 73 20 6d 61 74 63 68 65 73 20 74 68 65 20 70 65 72 63 65 70 74 69 6f 6e 20 | use.this.matches.the.perception. |
| ce260 | 6f 66 20 69 6e 74 65 72 61 63 74 69 6e 67 20 77 69 74 68 20 61 20 77 6f 72 6c 64 20 6f 66 20 77 | of.interacting.with.a.world.of.w |
| ce280 | 68 69 63 68 20 77 65 20 61 72 65 0a 70 61 72 74 2e 20 20 48 6f 77 65 76 65 72 2c 20 61 73 20 77 | hich.we.are.part...However,.as.w |
| ce2a0 | 65 27 76 65 20 73 65 65 6e 20 72 65 70 65 61 74 65 64 6c 79 20 74 68 72 6f 75 67 68 6f 75 74 20 | e've.seen.repeatedly.throughout. |
| ce2c0 | 74 68 69 73 20 63 68 61 70 74 65 72 2c 20 74 68 65 73 65 0a 6d 6f 64 65 6c 73 20 72 61 69 73 65 | this.chapter,.these.models.raise |
| ce2e0 | 20 74 68 6f 72 6e 79 20 70 72 6f 62 6c 65 6d 73 20 6f 66 20 63 6f 6e 73 74 72 61 69 6e 69 6e 67 | .thorny.problems.of.constraining |
| ce300 | 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 65 76 65 6e 74 73 20 61 6e 64 20 6f 66 0a 73 79 6e 63 | .the.order.of.events.and.of.sync |
| ce320 | 68 72 6f 6e 69 7a 69 6e 67 20 6d 75 6c 74 69 70 6c 65 20 70 72 6f 63 65 73 73 65 73 2e 20 20 54 | hronizing.multiple.processes...T |
| ce340 | 68 65 20 70 6f 73 73 69 62 69 6c 69 74 79 20 6f 66 20 61 76 6f 69 64 69 6e 67 20 74 68 65 73 65 | he.possibility.of.avoiding.these |
| ce360 | 0a 70 72 6f 62 6c 65 6d 73 20 68 61 73 20 73 74 69 6d 75 6c 61 74 65 64 20 74 68 65 20 64 65 76 | .problems.has.stimulated.the.dev |
| ce380 | 65 6c 6f 70 6d 65 6e 74 20 6f 66 20 22 66 75 6e 63 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d | elopment.of."functional.programm |
| ce3a0 | 69 6e 67 0a 6c 61 6e 67 75 61 67 65 73 22 2c 20 77 68 69 63 68 20 64 6f 20 6e 6f 74 20 69 6e 63 | ing.languages",.which.do.not.inc |
| ce3c0 | 6c 75 64 65 20 61 6e 79 20 70 72 6f 76 69 73 69 6f 6e 20 66 6f 72 20 61 73 73 69 67 6e 6d 65 6e | lude.any.provision.for.assignmen |
| ce3e0 | 74 20 6f 72 0a 6d 75 74 61 62 6c 65 20 64 61 74 61 2e 20 20 49 6e 20 73 75 63 68 20 61 20 6c 61 | t.or.mutable.data...In.such.a.la |
| ce400 | 6e 67 75 61 67 65 2c 20 61 6c 6c 20 70 72 6f 63 65 64 75 72 65 73 20 69 6d 70 6c 65 6d 65 6e 74 | nguage,.all.procedures.implement |
| ce420 | 0a 77 65 6c 6c 2d 64 65 66 69 6e 65 64 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 66 75 6e 63 74 | .well-defined.mathematical.funct |
| ce440 | 69 6f 6e 73 20 6f 66 20 74 68 65 69 72 20 61 72 67 75 6d 65 6e 74 73 2c 20 77 68 6f 73 65 20 62 | ions.of.their.arguments,.whose.b |
| ce460 | 65 68 61 76 69 6f 72 0a 64 6f 65 73 20 6e 6f 74 20 63 68 61 6e 67 65 2e 20 20 54 68 65 20 66 75 | ehavior.does.not.change...The.fu |
| ce480 | 6e 63 74 69 6f 6e 61 6c 20 61 70 70 72 6f 61 63 68 20 69 73 20 65 78 74 72 65 6d 65 6c 79 20 61 | nctional.approach.is.extremely.a |
| ce4a0 | 74 74 72 61 63 74 69 76 65 20 66 6f 72 0a 64 65 61 6c 69 6e 67 20 77 69 74 68 20 63 6f 6e 63 75 | ttractive.for.dealing.with.concu |
| ce4c0 | 72 72 65 6e 74 20 73 79 73 74 65 6d 73 2e 28 32 29 0a 0a 20 20 20 4f 6e 20 74 68 65 20 6f 74 68 | rrent.systems.(2).....On.the.oth |
| ce4e0 | 65 72 20 68 61 6e 64 2c 20 69 66 20 77 65 20 6c 6f 6f 6b 20 63 6c 6f 73 65 6c 79 2c 20 77 65 20 | er.hand,.if.we.look.closely,.we. |
| ce500 | 63 61 6e 20 73 65 65 20 74 69 6d 65 2d 72 65 6c 61 74 65 64 0a 70 72 6f 62 6c 65 6d 73 20 63 72 | can.see.time-related.problems.cr |
| ce520 | 65 65 70 69 6e 67 20 69 6e 74 6f 20 66 75 6e 63 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 20 61 73 | eeping.into.functional.models.as |
| ce540 | 20 77 65 6c 6c 2e 20 20 4f 6e 65 20 70 61 72 74 69 63 75 6c 61 72 6c 79 0a 74 72 6f 75 62 6c 65 | .well...One.particularly.trouble |
| ce560 | 73 6f 6d 65 20 61 72 65 61 20 61 72 69 73 65 73 20 77 68 65 6e 20 77 65 20 77 69 73 68 20 74 6f | some.area.arises.when.we.wish.to |
| ce580 | 20 64 65 73 69 67 6e 20 69 6e 74 65 72 61 63 74 69 76 65 20 73 79 73 74 65 6d 73 2c 0a 65 73 70 | .design.interactive.systems,.esp |
| ce5a0 | 65 63 69 61 6c 6c 79 20 6f 6e 65 73 20 74 68 61 74 20 6d 6f 64 65 6c 20 69 6e 74 65 72 61 63 74 | ecially.ones.that.model.interact |
| ce5c0 | 69 6f 6e 73 20 62 65 74 77 65 65 6e 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 65 6e 74 69 74 69 65 | ions.between.independent.entitie |
| ce5e0 | 73 2e 0a 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 63 6f 6e 73 69 64 65 72 20 6f 6e 63 65 20 6d | s..For.instance,.consider.once.m |
| ce600 | 6f 72 65 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 61 20 62 61 6e 6b 69 6e 67 | ore.the.implementation.a.banking |
| ce620 | 20 73 79 73 74 65 6d 0a 74 68 61 74 20 70 65 72 6d 69 74 73 20 6a 6f 69 6e 74 20 62 61 6e 6b 20 | .system.that.permits.joint.bank. |
| ce640 | 61 63 63 6f 75 6e 74 73 2e 20 20 49 6e 20 61 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 73 79 73 | accounts...In.a.conventional.sys |
| ce660 | 74 65 6d 20 75 73 69 6e 67 0a 61 73 73 69 67 6e 6d 65 6e 74 20 61 6e 64 20 6f 62 6a 65 63 74 73 | tem.using.assignment.and.objects |
| ce680 | 2c 20 77 65 20 77 6f 75 6c 64 20 6d 6f 64 65 6c 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 50 | ,.we.would.model.the.fact.that.P |
| ce6a0 | 65 74 65 72 20 61 6e 64 20 50 61 75 6c 0a 73 68 61 72 65 20 61 6e 20 61 63 63 6f 75 6e 74 20 62 | eter.and.Paul.share.an.account.b |
| ce6c0 | 79 20 68 61 76 69 6e 67 20 62 6f 74 68 20 50 65 74 65 72 20 61 6e 64 20 50 61 75 6c 20 73 65 6e | y.having.both.Peter.and.Paul.sen |
| ce6e0 | 64 20 74 68 65 69 72 20 74 72 61 6e 73 61 63 74 69 6f 6e 0a 72 65 71 75 65 73 74 73 20 74 6f 20 | d.their.transaction.requests.to. |
| ce700 | 74 68 65 20 73 61 6d 65 20 62 61 6e 6b 2d 61 63 63 6f 75 6e 74 20 6f 62 6a 65 63 74 2c 20 61 73 | the.same.bank-account.object,.as |
| ce720 | 20 77 65 20 73 61 77 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 33 2d 31 2d 33 3a 3a | .we.saw.in.section.*Note.3-1-3:: |
| ce740 | 2e 20 20 46 72 6f 6d 20 74 68 65 20 73 74 72 65 61 6d 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 | ...From.the.stream.point.of.view |
| ce760 | 2c 20 77 68 65 72 65 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 22 6f 62 6a 65 63 74 73 22 0a 5f | ,.where.there.are.no."objects"._ |
| ce780 | 70 65 72 20 73 65 5f 2c 20 77 65 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 69 6e 64 69 63 61 74 | per.se_,.we.have.already.indicat |
| ce7a0 | 65 64 20 74 68 61 74 20 61 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 20 63 61 6e 20 62 65 20 6d 6f | ed.that.a.bank.account.can.be.mo |
| ce7c0 | 64 65 6c 65 64 0a 61 73 20 61 20 70 72 6f 63 65 73 73 20 74 68 61 74 20 6f 70 65 72 61 74 65 73 | deled.as.a.process.that.operates |
| ce7e0 | 20 6f 6e 20 61 20 73 74 72 65 61 6d 20 6f 66 20 74 72 61 6e 73 61 63 74 69 6f 6e 20 72 65 71 75 | .on.a.stream.of.transaction.requ |
| ce800 | 65 73 74 73 20 74 6f 0a 70 72 6f 64 75 63 65 20 61 20 73 74 72 65 61 6d 20 6f 66 20 72 65 73 70 | ests.to.produce.a.stream.of.resp |
| ce820 | 6f 6e 73 65 73 2e 20 20 41 63 63 6f 72 64 69 6e 67 6c 79 2c 20 77 65 20 63 6f 75 6c 64 20 6d 6f | onses...Accordingly,.we.could.mo |
| ce840 | 64 65 6c 20 74 68 65 20 66 61 63 74 0a 74 68 61 74 20 50 65 74 65 72 20 61 6e 64 20 50 61 75 6c | del.the.fact.that.Peter.and.Paul |
| ce860 | 20 68 61 76 65 20 61 20 6a 6f 69 6e 74 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 20 62 79 20 6d 65 | .have.a.joint.bank.account.by.me |
| ce880 | 72 67 69 6e 67 20 50 65 74 65 72 27 73 20 73 74 72 65 61 6d 0a 6f 66 20 74 72 61 6e 73 61 63 74 | rging.Peter's.stream.of.transact |
| ce8a0 | 69 6f 6e 20 72 65 71 75 65 73 74 73 20 77 69 74 68 20 50 61 75 6c 27 73 20 73 74 72 65 61 6d 20 | ion.requests.with.Paul's.stream. |
| ce8c0 | 6f 66 20 72 65 71 75 65 73 74 73 20 61 6e 64 20 66 65 65 64 69 6e 67 20 74 68 65 0a 72 65 73 75 | of.requests.and.feeding.the.resu |
| ce8e0 | 6c 74 20 74 6f 20 74 68 65 20 62 61 6e 6b 2d 61 63 63 6f 75 6e 74 20 73 74 72 65 61 6d 20 70 72 | lt.to.the.bank-account.stream.pr |
| ce900 | 6f 63 65 73 73 2c 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a | ocess,.as.shown.in.*Note.Figure. |
| ce920 | 33 2d 33 38 3a 3a 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 33 2e 33 38 3a 2a 20 41 20 6a | 3-38::........*Figure.3.38:*.A.j |
| ce940 | 6f 69 6e 74 20 62 61 6e 6b 20 61 63 63 6f 75 6e 74 2c 20 6d 6f 64 65 6c 65 64 20 62 79 20 6d 65 | oint.bank.account,.modeled.by.me |
| ce960 | 72 67 69 6e 67 20 74 77 6f 0a 20 20 20 20 20 73 74 72 65 61 6d 73 20 6f 66 20 74 72 61 6e 73 61 | rging.two......streams.of.transa |
| ce980 | 63 74 69 6f 6e 20 72 65 71 75 65 73 74 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 50 65 74 65 72 | ction.requests.............Peter |
| ce9a0 | 27 73 20 72 65 71 75 65 73 74 73 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 2b 2d | 's.requests...+---------+.....+- |
| ce9c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | --------+...........------------ |
| ce9e0 | 2d 2d 2d 2d 2d 2d 3e 7c 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 | ------>|.........|.....|........ |
| cea00 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 50 61 75 6c 27 73 20 72 65 71 75 65 73 74 73 20 20 20 20 | .|...........Paul's.requests.... |
| cea20 | 7c 20 20 6d 65 72 67 65 20 20 7c 2d 2d 2d 2d 3e 7c 20 62 61 6e 6b 20 20 20 20 7c 2d 2d 2d 2d 3e | |..merge..|---->|.bank....|----> |
| cea40 | 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 7c 20 | ...........------------------>|. |
| cea60 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 61 63 63 6f 75 6e 74 20 7c 0a 20 20 20 20 20 20 | ........|.....|.account.|....... |
| cea80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d | .......................+-------- |
| ceaa0 | 2d 2b 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 54 68 65 20 74 72 6f 75 62 | -+.....+---------+.....The.troub |
| ceac0 | 6c 65 20 77 69 74 68 20 74 68 69 73 20 66 6f 72 6d 75 6c 61 74 69 6f 6e 20 69 73 20 69 6e 20 74 | le.with.this.formulation.is.in.t |
| ceae0 | 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 20 22 6d 65 72 67 65 22 2e 20 20 49 74 0a 77 69 6c 6c 20 6e | he.notion.of."merge"...It.will.n |
| ceb00 | 6f 74 20 64 6f 20 74 6f 20 6d 65 72 67 65 20 74 68 65 20 74 77 6f 20 73 74 72 65 61 6d 73 20 62 | ot.do.to.merge.the.two.streams.b |
| ceb20 | 79 20 73 69 6d 70 6c 79 20 74 61 6b 69 6e 67 20 61 6c 74 65 72 6e 61 74 65 6c 79 20 6f 6e 65 0a | y.simply.taking.alternately.one. |
| ceb40 | 72 65 71 75 65 73 74 20 66 72 6f 6d 20 50 65 74 65 72 20 61 6e 64 20 6f 6e 65 20 72 65 71 75 65 | request.from.Peter.and.one.reque |
| ceb60 | 73 74 20 66 72 6f 6d 20 50 61 75 6c 2e 20 53 75 70 70 6f 73 65 20 50 61 75 6c 20 61 63 63 65 73 | st.from.Paul..Suppose.Paul.acces |
| ceb80 | 73 65 73 20 74 68 65 0a 61 63 63 6f 75 6e 74 20 6f 6e 6c 79 20 76 65 72 79 20 72 61 72 65 6c 79 | ses.the.account.only.very.rarely |
| ceba0 | 2e 20 20 57 65 20 63 6f 75 6c 64 20 68 61 72 64 6c 79 20 66 6f 72 63 65 20 50 65 74 65 72 20 74 | ...We.could.hardly.force.Peter.t |
| cebc0 | 6f 20 77 61 69 74 20 66 6f 72 20 50 61 75 6c 0a 74 6f 20 61 63 63 65 73 73 20 74 68 65 20 61 63 | o.wait.for.Paul.to.access.the.ac |
| cebe0 | 63 6f 75 6e 74 20 62 65 66 6f 72 65 20 68 65 20 63 6f 75 6c 64 20 69 73 73 75 65 20 61 20 73 65 | count.before.he.could.issue.a.se |
| cec00 | 63 6f 6e 64 20 74 72 61 6e 73 61 63 74 69 6f 6e 2e 0a 48 6f 77 65 76 65 72 20 73 75 63 68 20 61 | cond.transaction..However.such.a |
| cec20 | 20 6d 65 72 67 65 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 2c 20 69 74 20 6d 75 73 74 20 69 | .merge.is.implemented,.it.must.i |
| cec40 | 6e 74 65 72 6c 65 61 76 65 20 74 68 65 20 74 77 6f 0a 74 72 61 6e 73 61 63 74 69 6f 6e 20 73 74 | nterleave.the.two.transaction.st |
| cec60 | 72 65 61 6d 73 20 69 6e 20 73 6f 6d 65 20 77 61 79 20 74 68 61 74 20 69 73 20 63 6f 6e 73 74 72 | reams.in.some.way.that.is.constr |
| cec80 | 61 69 6e 65 64 20 62 79 20 22 72 65 61 6c 20 74 69 6d 65 22 20 61 73 0a 70 65 72 63 65 69 76 65 | ained.by."real.time".as.perceive |
| ceca0 | 64 20 62 79 20 50 65 74 65 72 20 61 6e 64 20 50 61 75 6c 2c 20 69 6e 20 74 68 65 20 73 65 6e 73 | d.by.Peter.and.Paul,.in.the.sens |
| cecc0 | 65 20 74 68 61 74 2c 20 69 66 20 50 65 74 65 72 20 61 6e 64 20 50 61 75 6c 20 6d 65 65 74 2c 0a | e.that,.if.Peter.and.Paul.meet,. |
| cece0 | 74 68 65 79 20 63 61 6e 20 61 67 72 65 65 20 74 68 61 74 20 63 65 72 74 61 69 6e 20 74 72 61 6e | they.can.agree.that.certain.tran |
| ced00 | 73 61 63 74 69 6f 6e 73 20 77 65 72 65 20 70 72 6f 63 65 73 73 65 64 20 62 65 66 6f 72 65 20 74 | sactions.were.processed.before.t |
| ced20 | 68 65 0a 6d 65 65 74 69 6e 67 2c 20 61 6e 64 20 6f 74 68 65 72 20 74 72 61 6e 73 61 63 74 69 6f | he.meeting,.and.other.transactio |
| ced40 | 6e 73 20 77 65 72 65 20 70 72 6f 63 65 73 73 65 64 20 61 66 74 65 72 20 74 68 65 20 6d 65 65 74 | ns.were.processed.after.the.meet |
| ced60 | 69 6e 67 2e 28 33 29 0a 54 68 69 73 20 69 73 20 70 72 65 63 69 73 65 6c 79 20 74 68 65 20 73 61 | ing.(3).This.is.precisely.the.sa |
| ced80 | 6d 65 20 63 6f 6e 73 74 72 61 69 6e 74 20 74 68 61 74 20 77 65 20 68 61 64 20 74 6f 20 64 65 61 | me.constraint.that.we.had.to.dea |
| ceda0 | 6c 20 77 69 74 68 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 34 2d 31 3a 3a 2c | l.with.in.section.*Note.3-4-1::, |
| cedc0 | 20 77 68 65 72 65 20 77 65 20 66 6f 75 6e 64 20 74 68 65 20 6e 65 65 64 20 74 6f 20 69 6e 74 72 | .where.we.found.the.need.to.intr |
| cede0 | 6f 64 75 63 65 20 65 78 70 6c 69 63 69 74 0a 73 79 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 20 74 | oduce.explicit.synchronization.t |
| cee00 | 6f 20 65 6e 73 75 72 65 20 61 20 22 63 6f 72 72 65 63 74 22 20 6f 72 64 65 72 20 6f 66 20 65 76 | o.ensure.a."correct".order.of.ev |
| cee20 | 65 6e 74 73 20 69 6e 20 63 6f 6e 63 75 72 72 65 6e 74 0a 70 72 6f 63 65 73 73 69 6e 67 20 6f 66 | ents.in.concurrent.processing.of |
| cee40 | 20 6f 62 6a 65 63 74 73 20 77 69 74 68 20 73 74 61 74 65 2e 20 20 54 68 75 73 2c 20 69 6e 20 61 | .objects.with.state...Thus,.in.a |
| cee60 | 6e 20 61 74 74 65 6d 70 74 20 74 6f 20 73 75 70 70 6f 72 74 20 74 68 65 0a 66 75 6e 63 74 69 6f | n.attempt.to.support.the.functio |
| cee80 | 6e 61 6c 20 73 74 79 6c 65 2c 20 74 68 65 20 6e 65 65 64 20 74 6f 20 6d 65 72 67 65 20 69 6e 70 | nal.style,.the.need.to.merge.inp |
| ceea0 | 75 74 73 20 66 72 6f 6d 20 64 69 66 66 65 72 65 6e 74 20 61 67 65 6e 74 73 0a 72 65 69 6e 74 72 | uts.from.different.agents.reintr |
| ceec0 | 6f 64 75 63 65 73 20 74 68 65 20 73 61 6d 65 20 70 72 6f 62 6c 65 6d 73 20 74 68 61 74 20 74 68 | oduces.the.same.problems.that.th |
| ceee0 | 65 20 66 75 6e 63 74 69 6f 6e 61 6c 20 73 74 79 6c 65 20 77 61 73 20 6d 65 61 6e 74 20 74 6f 0a | e.functional.style.was.meant.to. |
| cef00 | 65 6c 69 6d 69 6e 61 74 65 2e 0a 0a 20 20 20 57 65 20 62 65 67 61 6e 20 74 68 69 73 20 63 68 61 | eliminate......We.began.this.cha |
| cef20 | 70 74 65 72 20 77 69 74 68 20 74 68 65 20 67 6f 61 6c 20 6f 66 20 62 75 69 6c 64 69 6e 67 20 63 | pter.with.the.goal.of.building.c |
| cef40 | 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 0a 77 68 6f 73 65 20 73 74 72 75 63 74 | omputational.models.whose.struct |
| cef60 | 75 72 65 20 6d 61 74 63 68 65 73 20 6f 75 72 20 70 65 72 63 65 70 74 69 6f 6e 20 6f 66 20 74 68 | ure.matches.our.perception.of.th |
| cef80 | 65 20 72 65 61 6c 20 77 6f 72 6c 64 20 77 65 20 61 72 65 20 74 72 79 69 6e 67 0a 74 6f 20 6d 6f | e.real.world.we.are.trying.to.mo |
| cefa0 | 64 65 6c 2e 20 20 57 65 20 63 61 6e 20 6d 6f 64 65 6c 20 74 68 65 20 77 6f 72 6c 64 20 61 73 20 | del...We.can.model.the.world.as. |
| cefc0 | 61 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 73 65 70 61 72 61 74 65 2c 0a 74 69 6d 65 2d 62 | a.collection.of.separate,.time-b |
| cefe0 | 6f 75 6e 64 2c 20 69 6e 74 65 72 61 63 74 69 6e 67 20 6f 62 6a 65 63 74 73 20 77 69 74 68 20 73 | ound,.interacting.objects.with.s |
| cf000 | 74 61 74 65 2c 20 6f 72 20 77 65 20 63 61 6e 20 6d 6f 64 65 6c 20 74 68 65 20 77 6f 72 6c 64 0a | tate,.or.we.can.model.the.world. |
| cf020 | 61 73 20 61 20 73 69 6e 67 6c 65 2c 20 74 69 6d 65 6c 65 73 73 2c 20 73 74 61 74 65 6c 65 73 73 | as.a.single,.timeless,.stateless |
| cf040 | 20 75 6e 69 74 79 2e 20 20 45 61 63 68 20 76 69 65 77 20 68 61 73 20 70 6f 77 65 72 66 75 6c 0a | .unity...Each.view.has.powerful. |
| cf060 | 61 64 76 61 6e 74 61 67 65 73 2c 20 62 75 74 20 6e 65 69 74 68 65 72 20 76 69 65 77 20 61 6c 6f | advantages,.but.neither.view.alo |
| cf080 | 6e 65 20 69 73 20 63 6f 6d 70 6c 65 74 65 6c 79 20 73 61 74 69 73 66 61 63 74 6f 72 79 2e 20 20 | ne.is.completely.satisfactory... |
| cf0a0 | 41 20 67 72 61 6e 64 0a 75 6e 69 66 69 63 61 74 69 6f 6e 20 68 61 73 20 79 65 74 20 74 6f 20 65 | A.grand.unification.has.yet.to.e |
| cf0c0 | 6d 65 72 67 65 2e 28 34 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 | merge.(4).....----------.Footnot |
| cf0e0 | 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 53 69 6d 69 6c 61 72 6c 79 20 | es.----------.....(1).Similarly. |
| cf100 | 69 6e 20 70 68 79 73 69 63 73 2c 20 77 68 65 6e 20 77 65 20 6f 62 73 65 72 76 65 20 61 20 6d 6f | in.physics,.when.we.observe.a.mo |
| cf120 | 76 69 6e 67 20 70 61 72 74 69 63 6c 65 2c 20 77 65 20 73 61 79 0a 74 68 61 74 20 74 68 65 20 70 | ving.particle,.we.say.that.the.p |
| cf140 | 6f 73 69 74 69 6f 6e 20 28 73 74 61 74 65 29 20 6f 66 20 74 68 65 20 70 61 72 74 69 63 6c 65 20 | osition.(state).of.the.particle. |
| cf160 | 69 73 20 63 68 61 6e 67 69 6e 67 2e 20 20 48 6f 77 65 76 65 72 2c 20 66 72 6f 6d 0a 74 68 65 20 | is.changing...However,.from.the. |
| cf180 | 70 65 72 73 70 65 63 74 69 76 65 20 6f 66 20 74 68 65 20 70 61 72 74 69 63 6c 65 27 73 20 77 6f | perspective.of.the.particle's.wo |
| cf1a0 | 72 6c 64 20 6c 69 6e 65 20 69 6e 20 73 70 61 63 65 2d 74 69 6d 65 20 74 68 65 72 65 20 69 73 20 | rld.line.in.space-time.there.is. |
| cf1c0 | 6e 6f 0a 63 68 61 6e 67 65 20 69 6e 76 6f 6c 76 65 64 2e 0a 0a 20 20 20 28 32 29 20 4a 6f 68 6e | no.change.involved......(2).John |
| cf1e0 | 20 42 61 63 6b 75 73 2c 20 74 68 65 20 69 6e 76 65 6e 74 6f 72 20 6f 66 20 46 6f 72 74 72 61 6e | .Backus,.the.inventor.of.Fortran |
| cf200 | 2c 20 67 61 76 65 20 68 69 67 68 20 76 69 73 69 62 69 6c 69 74 79 20 74 6f 0a 66 75 6e 63 74 69 | ,.gave.high.visibility.to.functi |
| cf220 | 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 77 68 65 6e 20 68 65 20 77 61 73 20 61 77 61 | onal.programming.when.he.was.awa |
| cf240 | 72 64 65 64 20 74 68 65 20 41 43 4d 20 54 75 72 69 6e 67 20 61 77 61 72 64 20 69 6e 0a 31 39 37 | rded.the.ACM.Turing.award.in.197 |
| cf260 | 38 2e 20 20 48 69 73 20 61 63 63 65 70 74 61 6e 63 65 20 73 70 65 65 63 68 20 28 42 61 63 6b 75 | 8...His.acceptance.speech.(Backu |
| cf280 | 73 20 31 39 37 38 29 20 73 74 72 6f 6e 67 6c 79 20 61 64 76 6f 63 61 74 65 64 20 74 68 65 0a 66 | s.1978).strongly.advocated.the.f |
| cf2a0 | 75 6e 63 74 69 6f 6e 61 6c 20 61 70 70 72 6f 61 63 68 2e 20 20 41 20 67 6f 6f 64 20 6f 76 65 72 | unctional.approach...A.good.over |
| cf2c0 | 76 69 65 77 20 6f 66 20 66 75 6e 63 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 | view.of.functional.programming.i |
| cf2e0 | 73 0a 67 69 76 65 6e 20 69 6e 20 48 65 6e 64 65 72 73 6f 6e 20 31 39 38 30 20 61 6e 64 20 69 6e | s.given.in.Henderson.1980.and.in |
| cf300 | 20 44 61 72 6c 69 6e 67 74 6f 6e 2c 20 48 65 6e 64 65 72 73 6f 6e 2c 20 61 6e 64 20 54 75 72 6e | .Darlington,.Henderson,.and.Turn |
| cf320 | 65 72 20 31 39 38 32 2e 0a 0a 20 20 20 28 33 29 20 4f 62 73 65 72 76 65 20 74 68 61 74 2c 20 66 | er.1982......(3).Observe.that,.f |
| cf340 | 6f 72 20 61 6e 79 20 74 77 6f 20 73 74 72 65 61 6d 73 2c 20 74 68 65 72 65 20 69 73 20 69 6e 20 | or.any.two.streams,.there.is.in. |
| cf360 | 67 65 6e 65 72 61 6c 20 6d 6f 72 65 20 74 68 61 6e 0a 6f 6e 65 20 61 63 63 65 70 74 61 62 6c 65 | general.more.than.one.acceptable |
| cf380 | 20 6f 72 64 65 72 20 6f 66 20 69 6e 74 65 72 6c 65 61 76 69 6e 67 2e 20 20 54 68 75 73 2c 20 74 | .order.of.interleaving...Thus,.t |
| cf3a0 | 65 63 68 6e 69 63 61 6c 6c 79 2c 20 22 6d 65 72 67 65 22 20 69 73 20 61 0a 72 65 6c 61 74 69 6f | echnically,."merge".is.a.relatio |
| cf3c0 | 6e 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 20 66 75 6e 63 74 69 6f 6e 2d 2d 74 68 65 20 61 6e | n.rather.than.a.function--the.an |
| cf3e0 | 73 77 65 72 20 69 73 20 6e 6f 74 20 61 20 64 65 74 65 72 6d 69 6e 69 73 74 69 63 0a 66 75 6e 63 | swer.is.not.a.deterministic.func |
| cf400 | 74 69 6f 6e 20 6f 66 20 74 68 65 20 69 6e 70 75 74 73 2e 20 20 57 65 20 61 6c 72 65 61 64 79 20 | tion.of.the.inputs...We.already. |
| cf420 | 6d 65 6e 74 69 6f 6e 65 64 20 28 2a 4e 6f 74 65 20 46 6f 6f 74 6e 6f 74 65 20 33 39 3a 3a 29 0a | mentioned.(*Note.Footnote.39::). |
| cf440 | 74 68 61 74 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 6d 20 69 73 20 65 73 73 65 6e 74 69 61 6c | that.nondeterminism.is.essential |
| cf460 | 20 77 68 65 6e 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 63 6f 6e 63 75 72 72 65 6e 63 79 2e 20 | .when.dealing.with.concurrency.. |
| cf480 | 20 54 68 65 0a 6d 65 72 67 65 20 72 65 6c 61 74 69 6f 6e 20 69 6c 6c 75 73 74 72 61 74 65 73 20 | .The.merge.relation.illustrates. |
| cf4a0 | 74 68 65 20 73 61 6d 65 20 65 73 73 65 6e 74 69 61 6c 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 | the.same.essential.nondeterminis |
| cf4c0 | 6d 2c 20 66 72 6f 6d 20 74 68 65 0a 66 75 6e 63 74 69 6f 6e 61 6c 20 70 65 72 73 70 65 63 74 69 | m,.from.the.functional.perspecti |
| cf4e0 | 76 65 2e 20 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 33 3a 3a 2c 20 77 65 20 | ve...In.section.*Note.4-3::,.we. |
| cf500 | 77 69 6c 6c 20 6c 6f 6f 6b 20 61 74 0a 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 6d 20 66 72 6f 6d | will.look.at.nondeterminism.from |
| cf520 | 20 79 65 74 20 61 6e 6f 74 68 65 72 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 2e 0a 0a 20 20 20 | .yet.another.point.of.view...... |
| cf540 | 28 34 29 20 54 68 65 20 6f 62 6a 65 63 74 20 6d 6f 64 65 6c 20 61 70 70 72 6f 78 69 6d 61 74 65 | (4).The.object.model.approximate |
| cf560 | 73 20 74 68 65 20 77 6f 72 6c 64 20 62 79 20 64 69 76 69 64 69 6e 67 20 69 74 20 69 6e 74 6f 0a | s.the.world.by.dividing.it.into. |
| cf580 | 73 65 70 61 72 61 74 65 20 70 69 65 63 65 73 2e 20 20 54 68 65 20 66 75 6e 63 74 69 6f 6e 61 6c | separate.pieces...The.functional |
| cf5a0 | 20 6d 6f 64 65 6c 20 64 6f 65 73 20 6e 6f 74 20 6d 6f 64 75 6c 61 72 69 7a 65 20 61 6c 6f 6e 67 | .model.does.not.modularize.along |
| cf5c0 | 20 6f 62 6a 65 63 74 0a 62 6f 75 6e 64 61 72 69 65 73 2e 20 20 54 68 65 20 6f 62 6a 65 63 74 20 | .object.boundaries...The.object. |
| cf5e0 | 6d 6f 64 65 6c 20 69 73 20 75 73 65 66 75 6c 20 77 68 65 6e 20 74 68 65 20 75 6e 73 68 61 72 65 | model.is.useful.when.the.unshare |
| cf600 | 64 20 73 74 61 74 65 20 6f 66 20 74 68 65 0a 22 6f 62 6a 65 63 74 73 22 20 69 73 20 6d 75 63 68 | d.state.of.the."objects".is.much |
| cf620 | 20 6c 61 72 67 65 72 20 74 68 61 6e 20 74 68 65 20 73 74 61 74 65 20 74 68 61 74 20 74 68 65 79 | .larger.than.the.state.that.they |
| cf640 | 20 73 68 61 72 65 2e 20 20 41 6e 20 65 78 61 6d 70 6c 65 20 6f 66 0a 61 20 70 6c 61 63 65 20 77 | .share...An.example.of.a.place.w |
| cf660 | 68 65 72 65 20 74 68 65 20 6f 62 6a 65 63 74 20 76 69 65 77 70 6f 69 6e 74 20 66 61 69 6c 73 20 | here.the.object.viewpoint.fails. |
| cf680 | 69 73 20 71 75 61 6e 74 75 6d 20 6d 65 63 68 61 6e 69 63 73 2c 20 77 68 65 72 65 0a 74 68 69 6e | is.quantum.mechanics,.where.thin |
| cf6a0 | 6b 69 6e 67 20 6f 66 20 74 68 69 6e 67 73 20 61 73 20 69 6e 64 69 76 69 64 75 61 6c 20 70 61 72 | king.of.things.as.individual.par |
| cf6c0 | 74 69 63 6c 65 73 20 6c 65 61 64 73 20 74 6f 20 70 61 72 61 64 6f 78 65 73 20 61 6e 64 0a 63 6f | ticles.leads.to.paradoxes.and.co |
| cf6e0 | 6e 66 75 73 69 6f 6e 73 2e 20 20 55 6e 69 66 79 69 6e 67 20 74 68 65 20 6f 62 6a 65 63 74 20 76 | nfusions...Unifying.the.object.v |
| cf700 | 69 65 77 20 77 69 74 68 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 61 6c 20 76 69 65 77 20 6d 61 79 | iew.with.the.functional.view.may |
| cf720 | 20 68 61 76 65 0a 6c 69 74 74 6c 65 20 74 6f 20 64 6f 20 77 69 74 68 20 70 72 6f 67 72 61 6d 6d | .have.little.to.do.with.programm |
| cf740 | 69 6e 67 2c 20 62 75 74 20 72 61 74 68 65 72 20 77 69 74 68 20 66 75 6e 64 61 6d 65 6e 74 61 6c | ing,.but.rather.with.fundamental |
| cf760 | 0a 65 70 69 73 74 65 6d 6f 6c 6f 67 69 63 61 6c 20 69 73 73 75 65 73 2e 0a 0a 1f 0a 46 69 6c 65 | .epistemological.issues.....File |
| cf780 | 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 43 68 61 70 74 65 72 20 34 2c 20 20 | :.sicp.info,..Node:.Chapter.4,.. |
| cf7a0 | 4e 65 78 74 3a 20 43 68 61 70 74 65 72 20 35 2c 20 20 50 72 65 76 3a 20 43 68 61 70 74 65 72 20 | Next:.Chapter.5,..Prev:.Chapter. |
| cf7c0 | 33 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 34 20 4d 65 74 61 6c 69 6e 67 75 69 73 74 69 63 20 41 62 | 3,..Up:.Top..4.Metalinguistic.Ab |
| cf7e0 | 73 74 72 61 63 74 69 6f 6e 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a | straction.********************** |
| cf800 | 2a 2a 2a 2a 2a 2a 0a 0a 20 20 20 20 20 2e 2e 2e 20 49 74 27 73 20 69 6e 20 77 6f 72 64 73 20 74 | ******...........It's.in.words.t |
| cf820 | 68 61 74 20 74 68 65 20 6d 61 67 69 63 20 69 73 2d 2d 41 62 72 61 63 61 64 61 62 72 61 2c 20 4f | hat.the.magic.is--Abracadabra,.O |
| cf840 | 70 65 6e 20 53 65 73 61 6d 65 2c 20 61 6e 64 0a 20 20 20 20 20 74 68 65 20 72 65 73 74 2d 2d 62 | pen.Sesame,.and......the.rest--b |
| cf860 | 75 74 20 74 68 65 20 6d 61 67 69 63 20 77 6f 72 64 73 20 69 6e 20 6f 6e 65 20 73 74 6f 72 79 20 | ut.the.magic.words.in.one.story. |
| cf880 | 61 72 65 6e 27 74 20 6d 61 67 69 63 61 6c 20 69 6e 20 74 68 65 0a 20 20 20 20 20 6e 65 78 74 2e | aren't.magical.in.the......next. |
| cf8a0 | 20 20 54 68 65 20 72 65 61 6c 20 6d 61 67 69 63 20 69 73 20 74 6f 20 75 6e 64 65 72 73 74 61 6e | ..The.real.magic.is.to.understan |
| cf8c0 | 64 20 77 68 69 63 68 20 77 6f 72 64 73 20 77 6f 72 6b 2c 20 61 6e 64 20 77 68 65 6e 2c 0a 20 20 | d.which.words.work,.and.when,... |
| cf8e0 | 20 20 20 61 6e 64 20 66 6f 72 20 77 68 61 74 3b 20 74 68 65 20 74 72 69 63 6b 20 69 73 20 74 6f | ...and.for.what;.the.trick.is.to |
| cf900 | 20 6c 65 61 72 6e 20 74 68 65 20 74 72 69 63 6b 2e 0a 0a 20 20 20 20 20 2e 2e 2e 20 41 6e 64 20 | .learn.the.trick............And. |
| cf920 | 74 68 6f 73 65 20 77 6f 72 64 73 20 61 72 65 20 6d 61 64 65 20 66 72 6f 6d 20 74 68 65 20 6c 65 | those.words.are.made.from.the.le |
| cf940 | 74 74 65 72 73 20 6f 66 20 6f 75 72 20 61 6c 70 68 61 62 65 74 3a 20 61 0a 20 20 20 20 20 63 6f | tters.of.our.alphabet:.a......co |
| cf960 | 75 70 6c 65 2d 64 6f 7a 65 6e 20 73 71 75 69 67 67 6c 65 73 20 77 65 20 63 61 6e 20 64 72 61 77 | uple-dozen.squiggles.we.can.draw |
| cf980 | 20 77 69 74 68 20 74 68 65 20 70 65 6e 2e 20 20 54 68 69 73 20 69 73 20 74 68 65 20 6b 65 79 21 | .with.the.pen...This.is.the.key! |
| cf9a0 | 0a 20 20 20 20 20 41 6e 64 20 74 68 65 20 74 72 65 61 73 75 72 65 2c 20 74 6f 6f 2c 20 69 66 20 | ......And.the.treasure,.too,.if. |
| cf9c0 | 77 65 20 63 61 6e 20 6f 6e 6c 79 20 67 65 74 20 6f 75 72 20 68 61 6e 64 73 20 6f 6e 20 69 74 21 | we.can.only.get.our.hands.on.it! |
| cf9e0 | 20 20 49 74 27 73 0a 20 20 20 20 20 61 73 20 69 66 2d 2d 61 73 20 69 66 20 74 68 65 20 6b 65 79 | ..It's......as.if--as.if.the.key |
| cfa00 | 20 74 6f 20 74 68 65 20 74 72 65 61 73 75 72 65 20 5f 69 73 5f 20 74 68 65 20 74 72 65 61 73 75 | .to.the.treasure._is_.the.treasu |
| cfa20 | 72 65 21 0a 0a 20 20 20 20 20 2d 2d 4a 6f 68 6e 20 42 61 72 74 68 2c 20 60 43 68 69 6d 65 72 61 | re!.......--John.Barth,.`Chimera |
| cfa40 | 27 0a 0a 20 20 20 49 6e 20 6f 75 72 20 73 74 75 64 79 20 6f 66 20 70 72 6f 67 72 61 6d 20 64 65 | '.....In.our.study.of.program.de |
| cfa60 | 73 69 67 6e 2c 20 77 65 20 68 61 76 65 20 73 65 65 6e 20 74 68 61 74 20 65 78 70 65 72 74 20 70 | sign,.we.have.seen.that.expert.p |
| cfa80 | 72 6f 67 72 61 6d 6d 65 72 73 0a 63 6f 6e 74 72 6f 6c 20 74 68 65 20 63 6f 6d 70 6c 65 78 69 74 | rogrammers.control.the.complexit |
| cfaa0 | 79 20 6f 66 20 74 68 65 69 72 20 64 65 73 69 67 6e 73 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 | y.of.their.designs.with.the.same |
| cfac0 | 20 67 65 6e 65 72 61 6c 0a 74 65 63 68 6e 69 71 75 65 73 20 75 73 65 64 20 62 79 20 64 65 73 69 | .general.techniques.used.by.desi |
| cfae0 | 67 6e 65 72 73 20 6f 66 20 61 6c 6c 20 63 6f 6d 70 6c 65 78 20 73 79 73 74 65 6d 73 2e 20 20 54 | gners.of.all.complex.systems...T |
| cfb00 | 68 65 79 20 63 6f 6d 62 69 6e 65 0a 70 72 69 6d 69 74 69 76 65 20 65 6c 65 6d 65 6e 74 73 20 74 | hey.combine.primitive.elements.t |
| cfb20 | 6f 20 66 6f 72 6d 20 63 6f 6d 70 6f 75 6e 64 20 6f 62 6a 65 63 74 73 2c 20 74 68 65 79 20 61 62 | o.form.compound.objects,.they.ab |
| cfb40 | 73 74 72 61 63 74 20 63 6f 6d 70 6f 75 6e 64 0a 6f 62 6a 65 63 74 73 20 74 6f 20 66 6f 72 6d 20 | stract.compound.objects.to.form. |
| cfb60 | 68 69 67 68 65 72 2d 6c 65 76 65 6c 20 62 75 69 6c 64 69 6e 67 20 62 6c 6f 63 6b 73 2c 20 61 6e | higher-level.building.blocks,.an |
| cfb80 | 64 20 74 68 65 79 20 70 72 65 73 65 72 76 65 0a 6d 6f 64 75 6c 61 72 69 74 79 20 62 79 20 61 64 | d.they.preserve.modularity.by.ad |
| cfba0 | 6f 70 74 69 6e 67 20 61 70 70 72 6f 70 72 69 61 74 65 20 6c 61 72 67 65 2d 73 63 61 6c 65 20 76 | opting.appropriate.large-scale.v |
| cfbc0 | 69 65 77 73 20 6f 66 20 73 79 73 74 65 6d 0a 73 74 72 75 63 74 75 72 65 2e 20 20 49 6e 20 69 6c | iews.of.system.structure...In.il |
| cfbe0 | 6c 75 73 74 72 61 74 69 6e 67 20 74 68 65 73 65 20 74 65 63 68 6e 69 71 75 65 73 2c 20 77 65 20 | lustrating.these.techniques,.we. |
| cfc00 | 68 61 76 65 20 75 73 65 64 20 4c 69 73 70 20 61 73 20 61 0a 6c 61 6e 67 75 61 67 65 20 66 6f 72 | have.used.Lisp.as.a.language.for |
| cfc20 | 20 64 65 73 63 72 69 62 69 6e 67 20 70 72 6f 63 65 73 73 65 73 20 61 6e 64 20 66 6f 72 20 63 6f | .describing.processes.and.for.co |
| cfc40 | 6e 73 74 72 75 63 74 69 6e 67 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 0a 64 61 74 61 20 6f 62 | nstructing.computational.data.ob |
| cfc60 | 6a 65 63 74 73 20 61 6e 64 20 70 72 6f 63 65 73 73 65 73 20 74 6f 20 6d 6f 64 65 6c 20 63 6f 6d | jects.and.processes.to.model.com |
| cfc80 | 70 6c 65 78 20 70 68 65 6e 6f 6d 65 6e 61 20 69 6e 20 74 68 65 20 72 65 61 6c 0a 77 6f 72 6c 64 | plex.phenomena.in.the.real.world |
| cfca0 | 2e 20 20 48 6f 77 65 76 65 72 2c 20 61 73 20 77 65 20 63 6f 6e 66 72 6f 6e 74 20 69 6e 63 72 65 | ...However,.as.we.confront.incre |
| cfcc0 | 61 73 69 6e 67 6c 79 20 63 6f 6d 70 6c 65 78 20 70 72 6f 62 6c 65 6d 73 2c 20 77 65 20 77 69 6c | asingly.complex.problems,.we.wil |
| cfce0 | 6c 0a 66 69 6e 64 20 74 68 61 74 20 4c 69 73 70 2c 20 6f 72 20 69 6e 64 65 65 64 20 61 6e 79 20 | l.find.that.Lisp,.or.indeed.any. |
| cfd00 | 66 69 78 65 64 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2c 20 69 73 20 6e | fixed.programming.language,.is.n |
| cfd20 | 6f 74 0a 73 75 66 66 69 63 69 65 6e 74 20 66 6f 72 20 6f 75 72 20 6e 65 65 64 73 2e 20 20 57 65 | ot.sufficient.for.our.needs...We |
| cfd40 | 20 6d 75 73 74 20 63 6f 6e 73 74 61 6e 74 6c 79 20 74 75 72 6e 20 74 6f 20 6e 65 77 20 6c 61 6e | .must.constantly.turn.to.new.lan |
| cfd60 | 67 75 61 67 65 73 20 69 6e 0a 6f 72 64 65 72 20 74 6f 20 65 78 70 72 65 73 73 20 6f 75 72 20 69 | guages.in.order.to.express.our.i |
| cfd80 | 64 65 61 73 20 6d 6f 72 65 20 65 66 66 65 63 74 69 76 65 6c 79 2e 20 20 45 73 74 61 62 6c 69 73 | deas.more.effectively...Establis |
| cfda0 | 68 69 6e 67 20 6e 65 77 0a 6c 61 6e 67 75 61 67 65 73 20 69 73 20 61 20 70 6f 77 65 72 66 75 6c | hing.new.languages.is.a.powerful |
| cfdc0 | 20 73 74 72 61 74 65 67 79 20 66 6f 72 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 20 63 6f 6d 70 6c 65 | .strategy.for.controlling.comple |
| cfde0 | 78 69 74 79 20 69 6e 0a 65 6e 67 69 6e 65 65 72 69 6e 67 20 64 65 73 69 67 6e 3b 20 77 65 20 63 | xity.in.engineering.design;.we.c |
| cfe00 | 61 6e 20 6f 66 74 65 6e 20 65 6e 68 61 6e 63 65 20 6f 75 72 20 61 62 69 6c 69 74 79 20 74 6f 20 | an.often.enhance.our.ability.to. |
| cfe20 | 64 65 61 6c 20 77 69 74 68 20 61 0a 63 6f 6d 70 6c 65 78 20 70 72 6f 62 6c 65 6d 20 62 79 20 61 | deal.with.a.complex.problem.by.a |
| cfe40 | 64 6f 70 74 69 6e 67 20 61 20 6e 65 77 20 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 65 6e 61 62 | dopting.a.new.language.that.enab |
| cfe60 | 6c 65 73 20 75 73 20 74 6f 20 64 65 73 63 72 69 62 65 0a 28 61 6e 64 20 68 65 6e 63 65 20 74 6f | les.us.to.describe.(and.hence.to |
| cfe80 | 20 74 68 69 6e 6b 20 61 62 6f 75 74 29 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 69 6e 20 61 20 64 | .think.about).the.problem.in.a.d |
| cfea0 | 69 66 66 65 72 65 6e 74 20 77 61 79 2c 20 75 73 69 6e 67 0a 70 72 69 6d 69 74 69 76 65 73 2c 20 | ifferent.way,.using.primitives,. |
| cfec0 | 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 2c 20 61 6e 64 20 6d 65 61 6e 73 20 | means.of.combination,.and.means. |
| cfee0 | 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 20 74 68 61 74 20 61 72 65 0a 70 61 72 74 69 63 75 6c | of.abstraction.that.are.particul |
| cff00 | 61 72 6c 79 20 77 65 6c 6c 20 73 75 69 74 65 64 20 74 6f 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 | arly.well.suited.to.the.problem. |
| cff20 | 61 74 20 68 61 6e 64 2e 28 31 29 0a 0a 20 20 20 50 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 65 | at.hand.(1).....Programming.is.e |
| cff40 | 6e 64 6f 77 65 64 20 77 69 74 68 20 61 20 6d 75 6c 74 69 74 75 64 65 20 6f 66 20 6c 61 6e 67 75 | ndowed.with.a.multitude.of.langu |
| cff60 | 61 67 65 73 2e 20 20 54 68 65 72 65 20 61 72 65 0a 70 68 79 73 69 63 61 6c 20 6c 61 6e 67 75 61 | ages...There.are.physical.langua |
| cff80 | 67 65 73 2c 20 73 75 63 68 20 61 73 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 | ges,.such.as.the.machine.languag |
| cffa0 | 65 73 20 66 6f 72 20 70 61 72 74 69 63 75 6c 61 72 0a 63 6f 6d 70 75 74 65 72 73 2e 20 20 54 68 | es.for.particular.computers...Th |
| cffc0 | 65 73 65 20 6c 61 6e 67 75 61 67 65 73 20 61 72 65 20 63 6f 6e 63 65 72 6e 65 64 20 77 69 74 68 | ese.languages.are.concerned.with |
| cffe0 | 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 0a 64 61 74 61 20 61 6e 64 20 | .the.representation.of.data.and. |
| d0000 | 63 6f 6e 74 72 6f 6c 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 69 6e 64 69 76 69 64 75 61 6c 20 62 | control.in.terms.of.individual.b |
| d0020 | 69 74 73 20 6f 66 20 73 74 6f 72 61 67 65 20 61 6e 64 20 70 72 69 6d 69 74 69 76 65 0a 6d 61 63 | its.of.storage.and.primitive.mac |
| d0040 | 68 69 6e 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 20 20 54 68 65 20 6d 61 63 68 69 6e 65 2d | hine.instructions...The.machine- |
| d0060 | 6c 61 6e 67 75 61 67 65 20 70 72 6f 67 72 61 6d 6d 65 72 20 69 73 20 63 6f 6e 63 65 72 6e 65 64 | language.programmer.is.concerned |
| d0080 | 0a 77 69 74 68 20 75 73 69 6e 67 20 74 68 65 20 67 69 76 65 6e 20 68 61 72 64 77 61 72 65 20 74 | .with.using.the.given.hardware.t |
| d00a0 | 6f 20 65 72 65 63 74 20 73 79 73 74 65 6d 73 20 61 6e 64 20 75 74 69 6c 69 74 69 65 73 20 66 6f | o.erect.systems.and.utilities.fo |
| d00c0 | 72 20 74 68 65 0a 65 66 66 69 63 69 65 6e 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f | r.the.efficient.implementation.o |
| d00e0 | 66 20 72 65 73 6f 75 72 63 65 2d 6c 69 6d 69 74 65 64 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 2e | f.resource-limited.computations. |
| d0100 | 20 20 48 69 67 68 2d 6c 65 76 65 6c 0a 6c 61 6e 67 75 61 67 65 73 2c 20 65 72 65 63 74 65 64 20 | ..High-level.languages,.erected. |
| d0120 | 6f 6e 20 61 20 6d 61 63 68 69 6e 65 2d 6c 61 6e 67 75 61 67 65 20 73 75 62 73 74 72 61 74 65 2c | on.a.machine-language.substrate, |
| d0140 | 20 68 69 64 65 20 63 6f 6e 63 65 72 6e 73 20 61 62 6f 75 74 0a 74 68 65 20 72 65 70 72 65 73 65 | .hide.concerns.about.the.represe |
| d0160 | 6e 74 61 74 69 6f 6e 20 6f 66 20 64 61 74 61 20 61 73 20 63 6f 6c 6c 65 63 74 69 6f 6e 73 20 6f | ntation.of.data.as.collections.o |
| d0180 | 66 20 62 69 74 73 20 61 6e 64 20 74 68 65 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 | f.bits.and.the.representation.of |
| d01a0 | 20 70 72 6f 67 72 61 6d 73 20 61 73 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 70 72 69 6d 69 74 | .programs.as.sequences.of.primit |
| d01c0 | 69 76 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 0a 54 68 65 73 65 20 6c 61 6e 67 75 61 67 65 | ive.instructions..These.language |
| d01e0 | 73 20 68 61 76 65 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 61 6e 64 20 | s.have.means.of.combination.and. |
| d0200 | 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 73 75 63 68 20 61 73 0a 70 72 6f 63 65 64 75 72 65 20 64 | abstraction,.such.as.procedure.d |
| d0220 | 65 66 69 6e 69 74 69 6f 6e 2c 20 74 68 61 74 20 61 72 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 | efinition,.that.are.appropriate. |
| d0240 | 74 6f 20 74 68 65 20 6c 61 72 67 65 72 2d 73 63 61 6c 65 0a 6f 72 67 61 6e 69 7a 61 74 69 6f 6e | to.the.larger-scale.organization |
| d0260 | 20 6f 66 20 73 79 73 74 65 6d 73 2e 0a 0a 20 20 20 22 4d 65 74 61 6c 69 6e 67 75 69 73 74 69 63 | .of.systems......"Metalinguistic |
| d0280 | 20 61 62 73 74 72 61 63 74 69 6f 6e 22 2d 2d 65 73 74 61 62 6c 69 73 68 69 6e 67 20 6e 65 77 20 | .abstraction"--establishing.new. |
| d02a0 | 6c 61 6e 67 75 61 67 65 73 2d 2d 70 6c 61 79 73 20 61 6e 0a 69 6d 70 6f 72 74 61 6e 74 20 72 6f | languages--plays.an.important.ro |
| d02c0 | 6c 65 20 69 6e 20 61 6c 6c 20 62 72 61 6e 63 68 65 73 20 6f 66 20 65 6e 67 69 6e 65 65 72 69 6e | le.in.all.branches.of.engineerin |
| d02e0 | 67 20 64 65 73 69 67 6e 2e 20 20 49 74 20 69 73 0a 70 61 72 74 69 63 75 6c 61 72 6c 79 20 69 6d | g.design...It.is.particularly.im |
| d0300 | 70 6f 72 74 61 6e 74 20 74 6f 20 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c | portant.to.computer.programming, |
| d0320 | 20 62 65 63 61 75 73 65 20 69 6e 20 70 72 6f 67 72 61 6d 6d 69 6e 67 0a 6e 6f 74 20 6f 6e 6c 79 | .because.in.programming.not.only |
| d0340 | 20 63 61 6e 20 77 65 20 66 6f 72 6d 75 6c 61 74 65 20 6e 65 77 20 6c 61 6e 67 75 61 67 65 73 20 | .can.we.formulate.new.languages. |
| d0360 | 62 75 74 20 77 65 20 63 61 6e 20 61 6c 73 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 73 65 0a | but.we.can.also.implement.these. |
| d0380 | 6c 61 6e 67 75 61 67 65 73 20 62 79 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 65 76 61 6c 75 61 | languages.by.constructing.evalua |
| d03a0 | 74 6f 72 73 2e 20 20 41 6e 20 22 65 76 61 6c 75 61 74 6f 72 22 20 28 6f 72 20 22 69 6e 74 65 72 | tors...An."evaluator".(or."inter |
| d03c0 | 70 72 65 74 65 72 22 29 0a 66 6f 72 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 | preter").for.a.programming.langu |
| d03e0 | 61 67 65 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 2c 20 77 68 65 6e 20 61 70 | age.is.a.procedure.that,.when.ap |
| d0400 | 70 6c 69 65 64 20 74 6f 20 61 6e 0a 65 78 70 72 65 73 73 69 6f 6e 20 6f 66 20 74 68 65 20 6c 61 | plied.to.an.expression.of.the.la |
| d0420 | 6e 67 75 61 67 65 2c 20 70 65 72 66 6f 72 6d 73 20 74 68 65 20 61 63 74 69 6f 6e 73 20 72 65 71 | nguage,.performs.the.actions.req |
| d0440 | 75 69 72 65 64 20 74 6f 20 65 76 61 6c 75 61 74 65 0a 74 68 61 74 20 65 78 70 72 65 73 73 69 6f | uired.to.evaluate.that.expressio |
| d0460 | 6e 2e 0a 0a 20 20 20 49 74 20 69 73 20 6e 6f 20 65 78 61 67 67 65 72 61 74 69 6f 6e 20 74 6f 20 | n......It.is.no.exaggeration.to. |
| d0480 | 72 65 67 61 72 64 20 74 68 69 73 20 61 73 20 74 68 65 20 6d 6f 73 74 20 66 75 6e 64 61 6d 65 6e | regard.this.as.the.most.fundamen |
| d04a0 | 74 61 6c 20 69 64 65 61 20 69 6e 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 3a 0a 0a 20 20 20 20 20 54 | tal.idea.in.programming:.......T |
| d04c0 | 68 65 20 65 76 61 6c 75 61 74 6f 72 2c 20 77 68 69 63 68 20 64 65 74 65 72 6d 69 6e 65 73 20 74 | he.evaluator,.which.determines.t |
| d04e0 | 68 65 20 6d 65 61 6e 69 6e 67 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 61 0a 20 | he.meaning.of.expressions.in.a.. |
| d0500 | 20 20 20 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2c 20 69 73 20 6a 75 73 | ....programming.language,.is.jus |
| d0520 | 74 20 61 6e 6f 74 68 65 72 20 70 72 6f 67 72 61 6d 2e 0a 0a 20 20 20 54 6f 20 61 70 70 72 65 63 | t.another.program......To.apprec |
| d0540 | 69 61 74 65 20 74 68 69 73 20 70 6f 69 6e 74 20 69 73 20 74 6f 20 63 68 61 6e 67 65 20 6f 75 72 | iate.this.point.is.to.change.our |
| d0560 | 20 69 6d 61 67 65 73 20 6f 66 20 6f 75 72 73 65 6c 76 65 73 20 61 73 0a 70 72 6f 67 72 61 6d 6d | .images.of.ourselves.as.programm |
| d0580 | 65 72 73 2e 20 20 57 65 20 63 6f 6d 65 20 74 6f 20 73 65 65 20 6f 75 72 73 65 6c 76 65 73 20 61 | ers...We.come.to.see.ourselves.a |
| d05a0 | 73 20 64 65 73 69 67 6e 65 72 73 20 6f 66 20 6c 61 6e 67 75 61 67 65 73 2c 0a 72 61 74 68 65 72 | s.designers.of.languages,.rather |
| d05c0 | 20 74 68 61 6e 20 6f 6e 6c 79 20 75 73 65 72 73 20 6f 66 20 6c 61 6e 67 75 61 67 65 73 20 64 65 | .than.only.users.of.languages.de |
| d05e0 | 73 69 67 6e 65 64 20 62 79 20 6f 74 68 65 72 73 2e 0a 0a 20 20 20 49 6e 20 66 61 63 74 2c 20 77 | signed.by.others......In.fact,.w |
| d0600 | 65 20 63 61 6e 20 72 65 67 61 72 64 20 61 6c 6d 6f 73 74 20 61 6e 79 20 70 72 6f 67 72 61 6d 20 | e.can.regard.almost.any.program. |
| d0620 | 61 73 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 66 6f 72 20 73 6f 6d 65 0a 6c 61 6e 67 75 61 | as.the.evaluator.for.some.langua |
| d0640 | 67 65 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 68 65 20 70 6f 6c 79 6e 6f 6d 69 61 | ge...For.instance,.the.polynomia |
| d0660 | 6c 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 73 79 73 74 65 6d 20 6f 66 20 73 65 63 74 69 6f 6e | l.manipulation.system.of.section |
| d0680 | 0a 2a 4e 6f 74 65 20 32 2d 35 2d 33 3a 3a 20 65 6d 62 6f 64 69 65 73 20 74 68 65 20 72 75 6c 65 | .*Note.2-5-3::.embodies.the.rule |
| d06a0 | 73 20 6f 66 20 70 6f 6c 79 6e 6f 6d 69 61 6c 20 61 72 69 74 68 6d 65 74 69 63 20 61 6e 64 0a 69 | s.of.polynomial.arithmetic.and.i |
| d06c0 | 6d 70 6c 65 6d 65 6e 74 73 20 74 68 65 6d 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6f 70 65 72 61 | mplements.them.in.terms.of.opera |
| d06e0 | 74 69 6f 6e 73 20 6f 6e 20 6c 69 73 74 2d 73 74 72 75 63 74 75 72 65 64 20 64 61 74 61 2e 20 20 | tions.on.list-structured.data... |
| d0700 | 49 66 20 77 65 0a 61 75 67 6d 65 6e 74 20 74 68 69 73 20 73 79 73 74 65 6d 20 77 69 74 68 20 70 | If.we.augment.this.system.with.p |
| d0720 | 72 6f 63 65 64 75 72 65 73 20 74 6f 20 72 65 61 64 20 61 6e 64 20 70 72 69 6e 74 20 70 6f 6c 79 | rocedures.to.read.and.print.poly |
| d0740 | 6e 6f 6d 69 61 6c 0a 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 77 65 20 68 61 76 65 20 74 68 65 20 | nomial.expressions,.we.have.the. |
| d0760 | 63 6f 72 65 20 6f 66 20 61 20 73 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 6c 61 6e 67 75 61 | core.of.a.special-purpose.langua |
| d0780 | 67 65 20 66 6f 72 20 64 65 61 6c 69 6e 67 0a 77 69 74 68 20 70 72 6f 62 6c 65 6d 73 20 69 6e 20 | ge.for.dealing.with.problems.in. |
| d07a0 | 73 79 6d 62 6f 6c 69 63 20 6d 61 74 68 65 6d 61 74 69 63 73 2e 20 20 54 68 65 20 64 69 67 69 74 | symbolic.mathematics...The.digit |
| d07c0 | 61 6c 2d 6c 6f 67 69 63 20 73 69 6d 75 6c 61 74 6f 72 20 6f 66 0a 73 65 63 74 69 6f 6e 20 2a 4e | al-logic.simulator.of.section.*N |
| d07e0 | 6f 74 65 20 33 2d 33 2d 34 3a 3a 20 61 6e 64 20 74 68 65 20 63 6f 6e 73 74 72 61 69 6e 74 20 70 | ote.3-3-4::.and.the.constraint.p |
| d0800 | 72 6f 70 61 67 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 33 2d 33 2d 35 | ropagator.of.section.*Note.3-3-5 |
| d0820 | 3a 3a 20 61 72 65 20 6c 65 67 69 74 69 6d 61 74 65 20 6c 61 6e 67 75 61 67 65 73 20 69 6e 20 74 | ::.are.legitimate.languages.in.t |
| d0840 | 68 65 69 72 20 6f 77 6e 20 72 69 67 68 74 2c 20 65 61 63 68 20 77 69 74 68 20 69 74 73 20 6f 77 | heir.own.right,.each.with.its.ow |
| d0860 | 6e 0a 70 72 69 6d 69 74 69 76 65 73 2c 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 | n.primitives,.means.of.combinati |
| d0880 | 6f 6e 2c 20 61 6e 64 20 6d 65 61 6e 73 20 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 2e 20 20 53 | on,.and.means.of.abstraction...S |
| d08a0 | 65 65 6e 20 66 72 6f 6d 0a 74 68 69 73 20 70 65 72 73 70 65 63 74 69 76 65 2c 20 74 68 65 20 74 | een.from.this.perspective,.the.t |
| d08c0 | 65 63 68 6e 6f 6c 6f 67 79 20 66 6f 72 20 63 6f 70 69 6e 67 20 77 69 74 68 20 6c 61 72 67 65 2d | echnology.for.coping.with.large- |
| d08e0 | 73 63 61 6c 65 20 63 6f 6d 70 75 74 65 72 0a 73 79 73 74 65 6d 73 20 6d 65 72 67 65 73 20 77 69 | scale.computer.systems.merges.wi |
| d0900 | 74 68 20 74 68 65 20 74 65 63 68 6e 6f 6c 6f 67 79 20 66 6f 72 20 62 75 69 6c 64 69 6e 67 20 6e | th.the.technology.for.building.n |
| d0920 | 65 77 20 63 6f 6d 70 75 74 65 72 20 6c 61 6e 67 75 61 67 65 73 2c 0a 61 6e 64 20 63 6f 6d 70 75 | ew.computer.languages,.and.compu |
| d0940 | 74 65 72 20 73 63 69 65 6e 63 65 20 69 74 73 65 6c 66 20 62 65 63 6f 6d 65 73 20 6e 6f 20 6d 6f | ter.science.itself.becomes.no.mo |
| d0960 | 72 65 20 28 61 6e 64 20 6e 6f 20 6c 65 73 73 29 20 74 68 61 6e 20 74 68 65 0a 64 69 73 63 69 70 | re.(and.no.less).than.the.discip |
| d0980 | 6c 69 6e 65 20 6f 66 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 61 70 70 72 6f 70 72 69 61 74 65 | line.of.constructing.appropriate |
| d09a0 | 20 64 65 73 63 72 69 70 74 69 76 65 20 6c 61 6e 67 75 61 67 65 73 2e 0a 0a 20 20 20 57 65 20 6e | .descriptive.languages......We.n |
| d09c0 | 6f 77 20 65 6d 62 61 72 6b 20 6f 6e 20 61 20 74 6f 75 72 20 6f 66 20 74 68 65 20 74 65 63 68 6e | ow.embark.on.a.tour.of.the.techn |
| d09e0 | 6f 6c 6f 67 79 20 62 79 20 77 68 69 63 68 20 6c 61 6e 67 75 61 67 65 73 20 61 72 65 0a 65 73 74 | ology.by.which.languages.are.est |
| d0a00 | 61 62 6c 69 73 68 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6f 74 68 65 72 20 6c 61 6e 67 75 | ablished.in.terms.of.other.langu |
| d0a20 | 61 67 65 73 2e 20 20 49 6e 20 74 68 69 73 20 63 68 61 70 74 65 72 20 77 65 20 73 68 61 6c 6c 20 | ages...In.this.chapter.we.shall. |
| d0a40 | 75 73 65 0a 4c 69 73 70 20 61 73 20 61 20 62 61 73 65 2c 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 | use.Lisp.as.a.base,.implementing |
| d0a60 | 20 65 76 61 6c 75 61 74 6f 72 73 20 61 73 20 4c 69 73 70 20 70 72 6f 63 65 64 75 72 65 73 2e 20 | .evaluators.as.Lisp.procedures.. |
| d0a80 | 20 4c 69 73 70 20 69 73 0a 70 61 72 74 69 63 75 6c 61 72 6c 79 20 77 65 6c 6c 20 73 75 69 74 65 | .Lisp.is.particularly.well.suite |
| d0aa0 | 64 20 74 6f 20 74 68 69 73 20 74 61 73 6b 2c 20 62 65 63 61 75 73 65 20 6f 66 20 69 74 73 20 61 | d.to.this.task,.because.of.its.a |
| d0ac0 | 62 69 6c 69 74 79 20 74 6f 0a 72 65 70 72 65 73 65 6e 74 20 61 6e 64 20 6d 61 6e 69 70 75 6c 61 | bility.to.represent.and.manipula |
| d0ae0 | 74 65 20 73 79 6d 62 6f 6c 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 57 65 20 77 69 6c | te.symbolic.expressions...We.wil |
| d0b00 | 6c 20 74 61 6b 65 20 74 68 65 20 66 69 72 73 74 0a 73 74 65 70 20 69 6e 20 75 6e 64 65 72 73 74 | l.take.the.first.step.in.underst |
| d0b20 | 61 6e 64 69 6e 67 20 68 6f 77 20 6c 61 6e 67 75 61 67 65 73 20 61 72 65 20 69 6d 70 6c 65 6d 65 | anding.how.languages.are.impleme |
| d0b40 | 6e 74 65 64 20 62 79 20 62 75 69 6c 64 69 6e 67 20 61 6e 0a 65 76 61 6c 75 61 74 6f 72 20 66 6f | nted.by.building.an.evaluator.fo |
| d0b60 | 72 20 4c 69 73 70 20 69 74 73 65 6c 66 2e 20 20 54 68 65 20 6c 61 6e 67 75 61 67 65 20 69 6d 70 | r.Lisp.itself...The.language.imp |
| d0b80 | 6c 65 6d 65 6e 74 65 64 20 62 79 20 6f 75 72 20 65 76 61 6c 75 61 74 6f 72 0a 77 69 6c 6c 20 62 | lemented.by.our.evaluator.will.b |
| d0ba0 | 65 20 61 20 73 75 62 73 65 74 20 6f 66 20 74 68 65 20 53 63 68 65 6d 65 20 64 69 61 6c 65 63 74 | e.a.subset.of.the.Scheme.dialect |
| d0bc0 | 20 6f 66 20 4c 69 73 70 20 74 68 61 74 20 77 65 20 75 73 65 20 69 6e 20 74 68 69 73 0a 62 6f 6f | .of.Lisp.that.we.use.in.this.boo |
| d0be0 | 6b 2e 20 20 41 6c 74 68 6f 75 67 68 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 64 65 73 63 72 | k...Although.the.evaluator.descr |
| d0c00 | 69 62 65 64 20 69 6e 20 74 68 69 73 20 63 68 61 70 74 65 72 20 69 73 20 77 72 69 74 74 65 6e 20 | ibed.in.this.chapter.is.written. |
| d0c20 | 66 6f 72 20 61 0a 70 61 72 74 69 63 75 6c 61 72 20 64 69 61 6c 65 63 74 20 6f 66 20 4c 69 73 70 | for.a.particular.dialect.of.Lisp |
| d0c40 | 2c 20 69 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 65 73 73 65 6e 74 69 61 6c 20 73 74 72 75 | ,.it.contains.the.essential.stru |
| d0c60 | 63 74 75 72 65 20 6f 66 20 61 6e 0a 65 76 61 6c 75 61 74 6f 72 20 66 6f 72 20 61 6e 79 20 65 78 | cture.of.an.evaluator.for.any.ex |
| d0c80 | 70 72 65 73 73 69 6f 6e 2d 6f 72 69 65 6e 74 65 64 20 6c 61 6e 67 75 61 67 65 20 64 65 73 69 67 | pression-oriented.language.desig |
| d0ca0 | 6e 65 64 20 66 6f 72 20 77 72 69 74 69 6e 67 0a 70 72 6f 67 72 61 6d 73 20 66 6f 72 20 61 20 73 | ned.for.writing.programs.for.a.s |
| d0cc0 | 65 71 75 65 6e 74 69 61 6c 20 6d 61 63 68 69 6e 65 2e 20 20 28 49 6e 20 66 61 63 74 2c 20 6d 6f | equential.machine...(In.fact,.mo |
| d0ce0 | 73 74 20 6c 61 6e 67 75 61 67 65 20 70 72 6f 63 65 73 73 6f 72 73 0a 63 6f 6e 74 61 69 6e 2c 20 | st.language.processors.contain,. |
| d0d00 | 64 65 65 70 20 77 69 74 68 69 6e 20 74 68 65 6d 2c 20 61 20 6c 69 74 74 6c 65 20 22 4c 69 73 70 | deep.within.them,.a.little."Lisp |
| d0d20 | 22 20 65 76 61 6c 75 61 74 6f 72 2e 29 20 20 54 68 65 20 65 76 61 6c 75 61 74 6f 72 0a 68 61 73 | ".evaluator.)..The.evaluator.has |
| d0d40 | 20 62 65 65 6e 20 73 69 6d 70 6c 69 66 69 65 64 20 66 6f 72 20 74 68 65 20 70 75 72 70 6f 73 65 | .been.simplified.for.the.purpose |
| d0d60 | 73 20 6f 66 20 69 6c 6c 75 73 74 72 61 74 69 6f 6e 20 61 6e 64 20 64 69 73 63 75 73 73 69 6f 6e | s.of.illustration.and.discussion |
| d0d80 | 2c 0a 61 6e 64 20 73 6f 6d 65 20 66 65 61 74 75 72 65 73 20 68 61 76 65 20 62 65 65 6e 20 6c 65 | ,.and.some.features.have.been.le |
| d0da0 | 66 74 20 6f 75 74 20 74 68 61 74 20 77 6f 75 6c 64 20 62 65 20 69 6d 70 6f 72 74 61 6e 74 20 74 | ft.out.that.would.be.important.t |
| d0dc0 | 6f 20 69 6e 63 6c 75 64 65 0a 69 6e 20 61 20 70 72 6f 64 75 63 74 69 6f 6e 2d 71 75 61 6c 69 74 | o.include.in.a.production-qualit |
| d0de0 | 79 20 4c 69 73 70 20 73 79 73 74 65 6d 2e 20 20 4e 65 76 65 72 74 68 65 6c 65 73 73 2c 20 74 68 | y.Lisp.system...Nevertheless,.th |
| d0e00 | 69 73 20 73 69 6d 70 6c 65 0a 65 76 61 6c 75 61 74 6f 72 20 69 73 20 61 64 65 71 75 61 74 65 20 | is.simple.evaluator.is.adequate. |
| d0e20 | 74 6f 20 65 78 65 63 75 74 65 20 6d 6f 73 74 20 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d 73 20 | to.execute.most.of.the.programs. |
| d0e40 | 69 6e 20 74 68 69 73 20 62 6f 6f 6b 2e 28 32 29 0a 0a 20 20 20 41 6e 20 69 6d 70 6f 72 74 61 6e | in.this.book.(2).....An.importan |
| d0e60 | 74 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 6d 61 6b 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 | t.advantage.of.making.the.evalua |
| d0e80 | 74 6f 72 20 61 63 63 65 73 73 69 62 6c 65 20 61 73 20 61 20 4c 69 73 70 0a 70 72 6f 67 72 61 6d | tor.accessible.as.a.Lisp.program |
| d0ea0 | 20 69 73 20 74 68 61 74 20 77 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 61 6c 74 65 72 6e | .is.that.we.can.implement.altern |
| d0ec0 | 61 74 69 76 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 73 20 62 79 0a 64 65 73 63 72 69 | ative.evaluation.rules.by.descri |
| d0ee0 | 62 69 6e 67 20 74 68 65 73 65 20 61 73 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 73 20 74 6f 20 74 | bing.these.as.modifications.to.t |
| d0f00 | 68 65 20 65 76 61 6c 75 61 74 6f 72 20 70 72 6f 67 72 61 6d 2e 20 20 4f 6e 65 20 70 6c 61 63 65 | he.evaluator.program...One.place |
| d0f20 | 0a 77 68 65 72 65 20 77 65 20 63 61 6e 20 75 73 65 20 74 68 69 73 20 70 6f 77 65 72 20 74 6f 20 | .where.we.can.use.this.power.to. |
| d0f40 | 67 6f 6f 64 20 65 66 66 65 63 74 20 69 73 20 74 6f 20 67 61 69 6e 20 65 78 74 72 61 20 63 6f 6e | good.effect.is.to.gain.extra.con |
| d0f60 | 74 72 6f 6c 0a 6f 76 65 72 20 74 68 65 20 77 61 79 73 20 69 6e 20 77 68 69 63 68 20 63 6f 6d 70 | trol.over.the.ways.in.which.comp |
| d0f80 | 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 73 20 65 6d 62 6f 64 79 20 74 68 65 20 6e 6f 74 69 | utational.models.embody.the.noti |
| d0fa0 | 6f 6e 20 6f 66 20 74 69 6d 65 2c 0a 77 68 69 63 68 20 77 61 73 20 73 6f 20 63 65 6e 74 72 61 6c | on.of.time,.which.was.so.central |
| d0fc0 | 20 74 6f 20 74 68 65 20 64 69 73 63 75 73 73 69 6f 6e 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 | .to.the.discussion.in.*Note.Chap |
| d0fe0 | 74 65 72 20 33 3a 3a 2e 20 20 54 68 65 72 65 2c 20 77 65 0a 6d 69 74 69 67 61 74 65 64 20 73 6f | ter.3::...There,.we.mitigated.so |
| d1000 | 6d 65 20 6f 66 20 74 68 65 20 63 6f 6d 70 6c 65 78 69 74 69 65 73 20 6f 66 20 73 74 61 74 65 20 | me.of.the.complexities.of.state. |
| d1020 | 61 6e 64 20 61 73 73 69 67 6e 6d 65 6e 74 20 62 79 20 75 73 69 6e 67 0a 73 74 72 65 61 6d 73 20 | and.assignment.by.using.streams. |
| d1040 | 74 6f 20 64 65 63 6f 75 70 6c 65 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f | to.decouple.the.representation.o |
| d1060 | 66 20 74 69 6d 65 20 69 6e 20 74 68 65 20 77 6f 72 6c 64 20 66 72 6f 6d 20 74 69 6d 65 0a 69 6e | f.time.in.the.world.from.time.in |
| d1080 | 20 74 68 65 20 63 6f 6d 70 75 74 65 72 2e 20 20 4f 75 72 20 73 74 72 65 61 6d 20 70 72 6f 67 72 | .the.computer...Our.stream.progr |
| d10a0 | 61 6d 73 2c 20 68 6f 77 65 76 65 72 2c 20 77 65 72 65 20 73 6f 6d 65 74 69 6d 65 73 0a 63 75 6d | ams,.however,.were.sometimes.cum |
| d10c0 | 62 65 72 73 6f 6d 65 2c 20 62 65 63 61 75 73 65 20 74 68 65 79 20 77 65 72 65 20 63 6f 6e 73 74 | bersome,.because.they.were.const |
| d10e0 | 72 61 69 6e 65 64 20 62 79 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 0a | rained.by.the.applicative-order. |
| d1100 | 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 53 63 68 65 6d 65 2e 20 20 49 6e 20 73 65 63 74 69 6f | evaluation.of.Scheme...In.sectio |
| d1120 | 6e 20 2a 4e 6f 74 65 20 34 2d 32 3a 3a 2c 20 77 65 27 6c 6c 20 63 68 61 6e 67 65 20 74 68 65 0a | n.*Note.4-2::,.we'll.change.the. |
| d1140 | 75 6e 64 65 72 6c 79 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 74 6f 20 70 72 6f 76 69 64 65 20 66 | underlying.language.to.provide.f |
| d1160 | 6f 72 20 61 20 6d 6f 72 65 20 65 6c 65 67 61 6e 74 20 61 70 70 72 6f 61 63 68 2c 20 62 79 0a 6d | or.a.more.elegant.approach,.by.m |
| d1180 | 6f 64 69 66 79 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 70 72 6f 76 69 64 | odifying.the.evaluator.to.provid |
| d11a0 | 65 20 66 6f 72 20 22 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 22 2e | e.for."normal-order.evaluation". |
| d11c0 | 0a 0a 20 20 20 53 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 33 3a 3a 20 69 6d 70 6c 65 6d 65 | .....Section.*Note.4-3::.impleme |
| d11e0 | 6e 74 73 20 61 20 6d 6f 72 65 20 61 6d 62 69 74 69 6f 75 73 20 6c 69 6e 67 75 69 73 74 69 63 20 | nts.a.more.ambitious.linguistic. |
| d1200 | 63 68 61 6e 67 65 2c 0a 77 68 65 72 65 62 79 20 65 78 70 72 65 73 73 69 6f 6e 73 20 68 61 76 65 | change,.whereby.expressions.have |
| d1220 | 20 6d 61 6e 79 20 76 61 6c 75 65 73 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 6a 75 73 74 20 61 | .many.values,.rather.than.just.a |
| d1240 | 20 73 69 6e 67 6c 65 20 76 61 6c 75 65 2e 0a 49 6e 20 74 68 69 73 20 6c 61 6e 67 75 61 67 65 20 | .single.value..In.this.language. |
| d1260 | 6f 66 20 22 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 63 6f 6d 70 75 74 69 6e 67 22 2c | of."nondeterministic.computing", |
| d1280 | 20 69 74 20 69 73 20 6e 61 74 75 72 61 6c 20 74 6f 0a 65 78 70 72 65 73 73 20 70 72 6f 63 65 73 | .it.is.natural.to.express.proces |
| d12a0 | 73 65 73 20 74 68 61 74 20 67 65 6e 65 72 61 74 65 20 61 6c 6c 20 70 6f 73 73 69 62 6c 65 20 76 | ses.that.generate.all.possible.v |
| d12c0 | 61 6c 75 65 73 20 66 6f 72 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 6e 64 0a 74 68 65 6e 20 73 | alues.for.expressions.and.then.s |
| d12e0 | 65 61 72 63 68 20 66 6f 72 20 74 68 6f 73 65 20 76 61 6c 75 65 73 20 74 68 61 74 20 73 61 74 69 | earch.for.those.values.that.sati |
| d1300 | 73 66 79 20 63 65 72 74 61 69 6e 20 63 6f 6e 73 74 72 61 69 6e 74 73 2e 20 20 49 6e 0a 74 65 72 | sfy.certain.constraints...In.ter |
| d1320 | 6d 73 20 6f 66 20 6d 6f 64 65 6c 73 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 61 6e 64 20 | ms.of.models.of.computation.and. |
| d1340 | 74 69 6d 65 2c 20 74 68 69 73 20 69 73 20 6c 69 6b 65 20 68 61 76 69 6e 67 20 74 69 6d 65 0a 62 | time,.this.is.like.having.time.b |
| d1360 | 72 61 6e 63 68 20 69 6e 74 6f 20 61 20 73 65 74 20 6f 66 20 22 70 6f 73 73 69 62 6c 65 20 66 75 | ranch.into.a.set.of."possible.fu |
| d1380 | 74 75 72 65 73 22 20 61 6e 64 20 74 68 65 6e 20 73 65 61 72 63 68 69 6e 67 20 66 6f 72 0a 61 70 | tures".and.then.searching.for.ap |
| d13a0 | 70 72 6f 70 72 69 61 74 65 20 74 69 6d 65 20 6c 69 6e 65 73 2e 20 20 57 69 74 68 20 6f 75 72 20 | propriate.time.lines...With.our. |
| d13c0 | 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 65 76 61 6c 75 61 74 6f 72 2c 20 6b 65 65 70 | nondeterministic.evaluator,.keep |
| d13e0 | 69 6e 67 0a 74 72 61 63 6b 20 6f 66 20 6d 75 6c 74 69 70 6c 65 20 76 61 6c 75 65 73 20 61 6e 64 | ing.track.of.multiple.values.and |
| d1400 | 20 70 65 72 66 6f 72 6d 69 6e 67 20 73 65 61 72 63 68 65 73 20 61 72 65 20 68 61 6e 64 6c 65 64 | .performing.searches.are.handled |
| d1420 | 0a 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 62 79 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 | .automatically.by.the.underlying |
| d1440 | 20 6d 65 63 68 61 6e 69 73 6d 20 6f 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 2e 0a 0a 20 20 20 | .mechanism.of.the.language...... |
| d1460 | 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 3a 3a 20 77 65 20 69 6d 70 6c 65 6d | In.section.*Note.4-4::.we.implem |
| d1480 | 65 6e 74 20 61 20 22 6c 6f 67 69 63 2d 70 72 6f 67 72 61 6d 6d 69 6e 67 22 20 6c 61 6e 67 75 61 | ent.a."logic-programming".langua |
| d14a0 | 67 65 20 69 6e 0a 77 68 69 63 68 20 6b 6e 6f 77 6c 65 64 67 65 20 69 73 20 65 78 70 72 65 73 73 | ge.in.which.knowledge.is.express |
| d14c0 | 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 72 65 6c 61 74 69 6f 6e 73 2c 20 72 61 74 68 65 72 | ed.in.terms.of.relations,.rather |
| d14e0 | 20 74 68 61 6e 20 69 6e 0a 74 65 72 6d 73 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 20 77 | .than.in.terms.of.computations.w |
| d1500 | 69 74 68 20 69 6e 70 75 74 73 20 61 6e 64 20 6f 75 74 70 75 74 73 2e 20 20 45 76 65 6e 20 74 68 | ith.inputs.and.outputs...Even.th |
| d1520 | 6f 75 67 68 20 74 68 69 73 20 6d 61 6b 65 73 0a 74 68 65 20 6c 61 6e 67 75 61 67 65 20 64 72 61 | ough.this.makes.the.language.dra |
| d1540 | 73 74 69 63 61 6c 6c 79 20 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d 20 4c 69 73 70 2c 20 6f 72 | stically.different.from.Lisp,.or |
| d1560 | 20 69 6e 64 65 65 64 20 66 72 6f 6d 20 61 6e 79 0a 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 6c 61 | .indeed.from.any.conventional.la |
| d1580 | 6e 67 75 61 67 65 2c 20 77 65 20 77 69 6c 6c 20 73 65 65 20 74 68 61 74 20 74 68 65 20 6c 6f 67 | nguage,.we.will.see.that.the.log |
| d15a0 | 69 63 2d 70 72 6f 67 72 61 6d 6d 69 6e 67 20 65 76 61 6c 75 61 74 6f 72 0a 73 68 61 72 65 73 20 | ic-programming.evaluator.shares. |
| d15c0 | 74 68 65 20 65 73 73 65 6e 74 69 61 6c 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 4c | the.essential.structure.of.the.L |
| d15e0 | 69 73 70 20 65 76 61 6c 75 61 74 6f 72 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 34 2d 31 3a 3a | isp.evaluator...*.Menu:..*.4-1:: |
| d1600 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 4d 65 74 61 63 69 72 63 75 6c 61 72 20 45 | ..............The.Metacircular.E |
| d1620 | 76 61 6c 75 61 74 6f 72 0a 2a 20 34 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 61 | valuator.*.4-2::..............Va |
| d1640 | 72 69 61 74 69 6f 6e 73 20 6f 6e 20 61 20 53 63 68 65 6d 65 20 2d 2d 20 4c 61 7a 79 20 45 76 61 | riations.on.a.Scheme.--.Lazy.Eva |
| d1660 | 6c 75 61 74 69 6f 6e 0a 2a 20 34 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 61 72 | luation.*.4-3::..............Var |
| d1680 | 69 61 74 69 6f 6e 73 20 6f 6e 20 61 20 53 63 68 65 6d 65 20 2d 2d 20 4e 6f 6e 64 65 74 65 72 6d | iations.on.a.Scheme.--.Nondeterm |
| d16a0 | 69 6e 69 73 74 69 63 20 43 6f 6d 70 75 74 69 6e 67 0a 2a 20 34 2d 34 3a 3a 20 20 20 20 20 20 20 | inistic.Computing.*.4-4::....... |
| d16c0 | 20 20 20 20 20 20 20 4c 6f 67 69 63 20 50 72 6f 67 72 61 6d 6d 69 6e 67 0a 0a 20 20 20 2d 2d 2d | .......Logic.Programming.....--- |
| d16e0 | 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 | -------.Footnotes.----------.... |
| d1700 | 20 28 31 29 20 54 68 65 20 73 61 6d 65 20 69 64 65 61 20 69 73 20 70 65 72 76 61 73 69 76 65 20 | .(1).The.same.idea.is.pervasive. |
| d1720 | 74 68 72 6f 75 67 68 6f 75 74 20 61 6c 6c 20 6f 66 20 65 6e 67 69 6e 65 65 72 69 6e 67 2e 20 20 | throughout.all.of.engineering... |
| d1740 | 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 65 6c 65 63 74 72 69 63 61 6c 20 65 6e 67 69 6e 65 65 72 | For.example,.electrical.engineer |
| d1760 | 73 20 75 73 65 20 6d 61 6e 79 20 64 69 66 66 65 72 65 6e 74 20 6c 61 6e 67 75 61 67 65 73 20 66 | s.use.many.different.languages.f |
| d1780 | 6f 72 0a 64 65 73 63 72 69 62 69 6e 67 20 63 69 72 63 75 69 74 73 2e 20 20 54 77 6f 20 6f 66 20 | or.describing.circuits...Two.of. |
| d17a0 | 74 68 65 73 65 20 61 72 65 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 6f 66 20 65 6c 65 63 74 72 | these.are.the.language.of.electr |
| d17c0 | 69 63 61 6c 20 22 6e 65 74 77 6f 72 6b 73 22 0a 61 6e 64 20 74 68 65 20 6c 61 6e 67 75 61 67 65 | ical."networks".and.the.language |
| d17e0 | 20 6f 66 20 65 6c 65 63 74 72 69 63 61 6c 20 22 73 79 73 74 65 6d 73 22 2e 20 20 54 68 65 20 6e | .of.electrical."systems"...The.n |
| d1800 | 65 74 77 6f 72 6b 20 6c 61 6e 67 75 61 67 65 0a 65 6d 70 68 61 73 69 7a 65 73 20 74 68 65 20 70 | etwork.language.emphasizes.the.p |
| d1820 | 68 79 73 69 63 61 6c 20 6d 6f 64 65 6c 69 6e 67 20 6f 66 20 64 65 76 69 63 65 73 20 69 6e 20 74 | hysical.modeling.of.devices.in.t |
| d1840 | 65 72 6d 73 20 6f 66 20 64 69 73 63 72 65 74 65 0a 65 6c 65 63 74 72 69 63 61 6c 20 65 6c 65 6d | erms.of.discrete.electrical.elem |
| d1860 | 65 6e 74 73 2e 20 20 54 68 65 20 70 72 69 6d 69 74 69 76 65 20 6f 62 6a 65 63 74 73 20 6f 66 20 | ents...The.primitive.objects.of. |
| d1880 | 74 68 65 20 6e 65 74 77 6f 72 6b 20 6c 61 6e 67 75 61 67 65 20 61 72 65 0a 70 72 69 6d 69 74 69 | the.network.language.are.primiti |
| d18a0 | 76 65 20 65 6c 65 63 74 72 69 63 61 6c 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 73 75 63 68 20 61 73 | ve.electrical.components.such.as |
| d18c0 | 20 72 65 73 69 73 74 6f 72 73 2c 20 63 61 70 61 63 69 74 6f 72 73 2c 0a 69 6e 64 75 63 74 6f 72 | .resistors,.capacitors,.inductor |
| d18e0 | 73 2c 20 61 6e 64 20 74 72 61 6e 73 69 73 74 6f 72 73 2c 20 77 68 69 63 68 20 61 72 65 20 63 68 | s,.and.transistors,.which.are.ch |
| d1900 | 61 72 61 63 74 65 72 69 7a 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 0a 70 68 79 73 69 63 61 6c | aracterized.in.terms.of.physical |
| d1920 | 20 76 61 72 69 61 62 6c 65 73 20 63 61 6c 6c 65 64 20 76 6f 6c 74 61 67 65 20 61 6e 64 20 63 75 | .variables.called.voltage.and.cu |
| d1940 | 72 72 65 6e 74 2e 20 20 57 68 65 6e 20 64 65 73 63 72 69 62 69 6e 67 0a 63 69 72 63 75 69 74 73 | rrent...When.describing.circuits |
| d1960 | 20 69 6e 20 74 68 65 20 6e 65 74 77 6f 72 6b 20 6c 61 6e 67 75 61 67 65 2c 20 74 68 65 20 65 6e | .in.the.network.language,.the.en |
| d1980 | 67 69 6e 65 65 72 20 69 73 20 63 6f 6e 63 65 72 6e 65 64 20 77 69 74 68 20 74 68 65 0a 70 68 79 | gineer.is.concerned.with.the.phy |
| d19a0 | 73 69 63 61 6c 20 63 68 61 72 61 63 74 65 72 69 73 74 69 63 73 20 6f 66 20 61 20 64 65 73 69 67 | sical.characteristics.of.a.desig |
| d19c0 | 6e 2e 20 20 49 6e 20 63 6f 6e 74 72 61 73 74 2c 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 0a 6f | n...In.contrast,.the.primitive.o |
| d19e0 | 62 6a 65 63 74 73 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 20 6c 61 6e 67 75 61 67 65 20 61 72 | bjects.of.the.system.language.ar |
| d1a00 | 65 20 73 69 67 6e 61 6c 2d 70 72 6f 63 65 73 73 69 6e 67 20 6d 6f 64 75 6c 65 73 20 73 75 63 68 | e.signal-processing.modules.such |
| d1a20 | 20 61 73 0a 66 69 6c 74 65 72 73 20 61 6e 64 20 61 6d 70 6c 69 66 69 65 72 73 2e 20 20 4f 6e 6c | .as.filters.and.amplifiers...Onl |
| d1a40 | 79 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 61 6c 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 | y.the.functional.behavior.of.the |
| d1a60 | 20 6d 6f 64 75 6c 65 73 20 69 73 0a 72 65 6c 65 76 61 6e 74 2c 20 61 6e 64 20 73 69 67 6e 61 6c | .modules.is.relevant,.and.signal |
| d1a80 | 73 20 61 72 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 20 77 69 74 68 6f 75 74 20 63 6f 6e 63 65 72 | s.are.manipulated.without.concer |
| d1aa0 | 6e 20 66 6f 72 20 74 68 65 69 72 0a 70 68 79 73 69 63 61 6c 20 72 65 61 6c 69 7a 61 74 69 6f 6e | n.for.their.physical.realization |
| d1ac0 | 20 61 73 20 76 6f 6c 74 61 67 65 73 20 61 6e 64 20 63 75 72 72 65 6e 74 73 2e 20 20 54 68 65 20 | .as.voltages.and.currents...The. |
| d1ae0 | 73 79 73 74 65 6d 20 6c 61 6e 67 75 61 67 65 20 69 73 0a 65 72 65 63 74 65 64 20 6f 6e 20 74 68 | system.language.is.erected.on.th |
| d1b00 | 65 20 6e 65 74 77 6f 72 6b 20 6c 61 6e 67 75 61 67 65 2c 20 69 6e 20 74 68 65 20 73 65 6e 73 65 | e.network.language,.in.the.sense |
| d1b20 | 20 74 68 61 74 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 0a 73 69 67 6e 61 6c 2d 70 72 6f | .that.the.elements.of.signal-pro |
| d1b40 | 63 65 73 73 69 6e 67 20 73 79 73 74 65 6d 73 20 61 72 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 | cessing.systems.are.constructed. |
| d1b60 | 66 72 6f 6d 20 65 6c 65 63 74 72 69 63 61 6c 20 6e 65 74 77 6f 72 6b 73 2e 0a 48 65 72 65 2c 20 | from.electrical.networks..Here,. |
| d1b80 | 68 6f 77 65 76 65 72 2c 20 74 68 65 20 63 6f 6e 63 65 72 6e 73 20 61 72 65 20 77 69 74 68 20 74 | however,.the.concerns.are.with.t |
| d1ba0 | 68 65 20 6c 61 72 67 65 2d 73 63 61 6c 65 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 6f 66 0a 65 | he.large-scale.organization.of.e |
| d1bc0 | 6c 65 63 74 72 69 63 61 6c 20 64 65 76 69 63 65 73 20 74 6f 20 73 6f 6c 76 65 20 61 20 67 69 76 | lectrical.devices.to.solve.a.giv |
| d1be0 | 65 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 70 72 6f 62 6c 65 6d 3b 20 74 68 65 20 70 68 79 73 | en.application.problem;.the.phys |
| d1c00 | 69 63 61 6c 0a 66 65 61 73 69 62 69 6c 69 74 79 20 6f 66 20 74 68 65 20 70 61 72 74 73 20 69 73 | ical.feasibility.of.the.parts.is |
| d1c20 | 20 61 73 73 75 6d 65 64 2e 20 20 54 68 69 73 20 6c 61 79 65 72 65 64 20 63 6f 6c 6c 65 63 74 69 | .assumed...This.layered.collecti |
| d1c40 | 6f 6e 20 6f 66 0a 6c 61 6e 67 75 61 67 65 73 20 69 73 20 61 6e 6f 74 68 65 72 20 65 78 61 6d 70 | on.of.languages.is.another.examp |
| d1c60 | 6c 65 20 6f 66 20 74 68 65 20 73 74 72 61 74 69 66 69 65 64 20 64 65 73 69 67 6e 20 74 65 63 68 | le.of.the.stratified.design.tech |
| d1c80 | 6e 69 71 75 65 0a 69 6c 6c 75 73 74 72 61 74 65 64 20 62 79 20 74 68 65 20 70 69 63 74 75 72 65 | nique.illustrated.by.the.picture |
| d1ca0 | 20 6c 61 6e 67 75 61 67 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 34 | .language.of.section.*Note.2-2-4 |
| d1cc0 | 3a 3a 2e 0a 0a 20 20 20 28 32 29 20 54 68 65 20 6d 6f 73 74 20 69 6d 70 6f 72 74 61 6e 74 20 66 | ::......(2).The.most.important.f |
| d1ce0 | 65 61 74 75 72 65 73 20 74 68 61 74 20 6f 75 72 20 65 76 61 6c 75 61 74 6f 72 20 6c 65 61 76 65 | eatures.that.our.evaluator.leave |
| d1d00 | 73 20 6f 75 74 20 61 72 65 0a 6d 65 63 68 61 6e 69 73 6d 73 20 66 6f 72 20 68 61 6e 64 6c 69 6e | s.out.are.mechanisms.for.handlin |
| d1d20 | 67 20 65 72 72 6f 72 73 20 61 6e 64 20 73 75 70 70 6f 72 74 69 6e 67 20 64 65 62 75 67 67 69 6e | g.errors.and.supporting.debuggin |
| d1d40 | 67 2e 20 20 46 6f 72 20 61 20 6d 6f 72 65 0a 65 78 74 65 6e 73 69 76 65 20 64 69 73 63 75 73 73 | g...For.a.more.extensive.discuss |
| d1d60 | 69 6f 6e 20 6f 66 20 65 76 61 6c 75 61 74 6f 72 73 2c 20 73 65 65 20 46 72 69 65 64 6d 61 6e 2c | ion.of.evaluators,.see.Friedman, |
| d1d80 | 20 57 61 6e 64 2c 20 61 6e 64 20 48 61 79 6e 65 73 0a 31 39 39 32 2c 20 77 68 69 63 68 20 67 69 | .Wand,.and.Haynes.1992,.which.gi |
| d1da0 | 76 65 73 20 61 6e 20 65 78 70 6f 73 69 74 69 6f 6e 20 6f 66 20 70 72 6f 67 72 61 6d 6d 69 6e 67 | ves.an.exposition.of.programming |
| d1dc0 | 20 6c 61 6e 67 75 61 67 65 73 20 74 68 61 74 20 70 72 6f 63 65 65 64 73 0a 76 69 61 20 61 20 73 | .languages.that.proceeds.via.a.s |
| d1de0 | 65 71 75 65 6e 63 65 20 6f 66 20 65 76 61 6c 75 61 74 6f 72 73 20 77 72 69 74 74 65 6e 20 69 6e | equence.of.evaluators.written.in |
| d1e00 | 20 53 63 68 65 6d 65 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f | .Scheme.....File:.sicp.info,..No |
| d1e20 | 64 65 3a 20 34 2d 31 2c 20 20 4e 65 78 74 3a 20 34 2d 32 2c 20 20 50 72 65 76 3a 20 43 68 61 70 | de:.4-1,..Next:.4-2,..Prev:.Chap |
| d1e40 | 74 65 72 20 34 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 34 0a 0a 34 2e 31 20 54 68 65 20 4d | ter.4,..Up:.Chapter.4..4.1.The.M |
| d1e60 | 65 74 61 63 69 72 63 75 6c 61 72 20 45 76 61 6c 75 61 74 6f 72 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | etacircular.Evaluator.========== |
| d1e80 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 4f 75 72 20 65 76 61 6c 75 61 | ====================..Our.evalua |
| d1ea0 | 74 6f 72 20 66 6f 72 20 4c 69 73 70 20 77 69 6c 6c 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 | tor.for.Lisp.will.be.implemented |
| d1ec0 | 20 61 73 20 61 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 2e 20 20 49 74 20 6d 61 79 0a 73 65 65 6d | .as.a.Lisp.program...It.may.seem |
| d1ee0 | 20 63 69 72 63 75 6c 61 72 20 74 6f 20 74 68 69 6e 6b 20 61 62 6f 75 74 20 65 76 61 6c 75 61 74 | .circular.to.think.about.evaluat |
| d1f00 | 69 6e 67 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 73 20 75 73 69 6e 67 20 61 6e 0a 65 76 61 6c 75 | ing.Lisp.programs.using.an.evalu |
| d1f20 | 61 74 6f 72 20 74 68 61 74 20 69 73 20 69 74 73 65 6c 66 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 | ator.that.is.itself.implemented. |
| d1f40 | 69 6e 20 4c 69 73 70 2e 20 20 48 6f 77 65 76 65 72 2c 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 73 | in.Lisp...However,.evaluation.is |
| d1f60 | 20 61 0a 70 72 6f 63 65 73 73 2c 20 73 6f 20 69 74 20 69 73 20 61 70 70 72 6f 70 72 69 61 74 65 | .a.process,.so.it.is.appropriate |
| d1f80 | 20 74 6f 20 64 65 73 63 72 69 62 65 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 | .to.describe.the.evaluation.proc |
| d1fa0 | 65 73 73 20 75 73 69 6e 67 0a 4c 69 73 70 2c 20 77 68 69 63 68 2c 20 61 66 74 65 72 20 61 6c 6c | ess.using.Lisp,.which,.after.all |
| d1fc0 | 2c 20 69 73 20 6f 75 72 20 74 6f 6f 6c 20 66 6f 72 20 64 65 73 63 72 69 62 69 6e 67 20 70 72 6f | ,.is.our.tool.for.describing.pro |
| d1fe0 | 63 65 73 73 65 73 2e 28 31 29 20 41 6e 0a 65 76 61 6c 75 61 74 6f 72 20 74 68 61 74 20 69 73 20 | cesses.(1).An.evaluator.that.is. |
| d2000 | 77 72 69 74 74 65 6e 20 69 6e 20 74 68 65 20 73 61 6d 65 20 6c 61 6e 67 75 61 67 65 20 74 68 61 | written.in.the.same.language.tha |
| d2020 | 74 20 69 74 20 65 76 61 6c 75 61 74 65 73 20 69 73 0a 73 61 69 64 20 74 6f 20 62 65 20 22 6d 65 | t.it.evaluates.is.said.to.be."me |
| d2040 | 74 61 63 69 72 63 75 6c 61 72 22 2e 0a 0a 20 20 20 54 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 | tacircular"......The.metacircula |
| d2060 | 72 20 65 76 61 6c 75 61 74 6f 72 20 69 73 20 65 73 73 65 6e 74 69 61 6c 6c 79 20 61 20 53 63 68 | r.evaluator.is.essentially.a.Sch |
| d2080 | 65 6d 65 20 66 6f 72 6d 75 6c 61 74 69 6f 6e 20 6f 66 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 | eme.formulation.of.the.environme |
| d20a0 | 6e 74 20 6d 6f 64 65 6c 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 64 65 73 63 72 69 62 65 64 | nt.model.of.evaluation.described |
| d20c0 | 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 32 3a 3a 2e 0a 52 65 63 61 6c 6c 20 | .in.section.*Note.3-2::..Recall. |
| d20e0 | 74 68 61 74 20 74 68 65 20 6d 6f 64 65 6c 20 68 61 73 20 74 77 6f 20 62 61 73 69 63 20 70 61 72 | that.the.model.has.two.basic.par |
| d2100 | 74 73 3a 0a 0a 20 20 31 2e 20 54 6f 20 65 76 61 6c 75 61 74 65 20 61 20 63 6f 6d 62 69 6e 61 74 | ts:....1..To.evaluate.a.combinat |
| d2120 | 69 6f 6e 20 28 61 20 63 6f 6d 70 6f 75 6e 64 20 65 78 70 72 65 73 73 69 6f 6e 20 6f 74 68 65 72 | ion.(a.compound.expression.other |
| d2140 | 20 74 68 61 6e 20 61 0a 20 20 20 20 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 29 2c 20 65 76 61 6c | .than.a......special.form),.eval |
| d2160 | 75 61 74 65 20 74 68 65 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 6e | uate.the.subexpressions.and.then |
| d2180 | 20 61 70 70 6c 79 20 74 68 65 0a 20 20 20 20 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 6f 70 65 | .apply.the......value.of.the.ope |
| d21a0 | 72 61 74 6f 72 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 74 68 65 20 76 61 6c 75 65 | rator.subexpression.to.the.value |
| d21c0 | 73 20 6f 66 20 74 68 65 20 6f 70 65 72 61 6e 64 0a 20 20 20 20 20 73 75 62 65 78 70 72 65 73 73 | s.of.the.operand......subexpress |
| d21e0 | 69 6f 6e 73 2e 0a 0a 20 20 32 2e 20 54 6f 20 61 70 70 6c 79 20 61 20 63 6f 6d 70 6f 75 6e 64 20 | ions.....2..To.apply.a.compound. |
| d2200 | 70 72 6f 63 65 64 75 72 65 20 74 6f 20 61 20 73 65 74 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 2c | procedure.to.a.set.of.arguments, |
| d2220 | 20 65 76 61 6c 75 61 74 65 20 74 68 65 0a 20 20 20 20 20 62 6f 64 79 20 6f 66 20 74 68 65 20 70 | .evaluate.the......body.of.the.p |
| d2240 | 72 6f 63 65 64 75 72 65 20 69 6e 20 61 20 6e 65 77 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 | rocedure.in.a.new.environment... |
| d2260 | 54 6f 20 63 6f 6e 73 74 72 75 63 74 20 74 68 69 73 0a 20 20 20 20 20 65 6e 76 69 72 6f 6e 6d 65 | To.construct.this......environme |
| d2280 | 6e 74 2c 20 65 78 74 65 6e 64 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 70 61 72 74 20 | nt,.extend.the.environment.part. |
| d22a0 | 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 0a 20 20 20 20 20 62 79 20 | of.the.procedure.object......by. |
| d22c0 | 61 20 66 72 61 6d 65 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 66 6f 72 6d 61 6c 20 70 61 72 61 | a.frame.in.which.the.formal.para |
| d22e0 | 6d 65 74 65 72 73 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 61 72 65 0a 20 20 20 20 | meters.of.the.procedure.are..... |
| d2300 | 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 77 68 69 63 68 | .bound.to.the.arguments.to.which |
| d2320 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 61 70 70 6c 69 65 64 2e 0a 0a 0a 20 20 20 | .the.procedure.is.applied....... |
| d2340 | 54 68 65 73 65 20 74 77 6f 20 72 75 6c 65 73 20 64 65 73 63 72 69 62 65 20 74 68 65 20 65 73 73 | These.two.rules.describe.the.ess |
| d2360 | 65 6e 63 65 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 2c 20 | ence.of.the.evaluation.process,. |
| d2380 | 61 0a 62 61 73 69 63 20 63 79 63 6c 65 20 69 6e 20 77 68 69 63 68 20 65 78 70 72 65 73 73 69 6f | a.basic.cycle.in.which.expressio |
| d23a0 | 6e 73 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e | ns.to.be.evaluated.in.environmen |
| d23c0 | 74 73 20 61 72 65 0a 72 65 64 75 63 65 64 20 74 6f 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 | ts.are.reduced.to.procedures.to. |
| d23e0 | 62 65 20 61 70 70 6c 69 65 64 20 74 6f 20 61 72 67 75 6d 65 6e 74 73 2c 20 77 68 69 63 68 20 69 | be.applied.to.arguments,.which.i |
| d2400 | 6e 20 74 75 72 6e 20 61 72 65 0a 72 65 64 75 63 65 64 20 74 6f 20 6e 65 77 20 65 78 70 72 65 73 | n.turn.are.reduced.to.new.expres |
| d2420 | 73 69 6f 6e 73 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 6e 65 77 20 65 6e 76 | sions.to.be.evaluated.in.new.env |
| d2440 | 69 72 6f 6e 6d 65 6e 74 73 2c 20 61 6e 64 20 73 6f 0a 6f 6e 2c 20 75 6e 74 69 6c 20 77 65 20 67 | ironments,.and.so.on,.until.we.g |
| d2460 | 65 74 20 64 6f 77 6e 20 74 6f 20 73 79 6d 62 6f 6c 73 2c 20 77 68 6f 73 65 20 76 61 6c 75 65 73 | et.down.to.symbols,.whose.values |
| d2480 | 20 61 72 65 20 6c 6f 6f 6b 65 64 20 75 70 20 69 6e 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e | .are.looked.up.in.the.environmen |
| d24a0 | 74 2c 20 61 6e 64 20 74 6f 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 2c 20 | t,.and.to.primitive.procedures,. |
| d24c0 | 77 68 69 63 68 20 61 72 65 20 61 70 70 6c 69 65 64 20 64 69 72 65 63 74 6c 79 0a 28 73 65 65 20 | which.are.applied.directly.(see. |
| d24e0 | 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 34 2d 31 3a 3a 29 2e 28 32 29 20 54 68 69 73 20 65 76 61 | *Note.Figure.4-1::).(2).This.eva |
| d2500 | 6c 75 61 74 69 6f 6e 20 63 79 63 6c 65 20 77 69 6c 6c 20 62 65 20 65 6d 62 6f 64 69 65 64 20 62 | luation.cycle.will.be.embodied.b |
| d2520 | 79 0a 74 68 65 20 69 6e 74 65 72 70 6c 61 79 20 62 65 74 77 65 65 6e 20 74 68 65 20 74 77 6f 20 | y.the.interplay.between.the.two. |
| d2540 | 63 72 69 74 69 63 61 6c 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 65 20 65 76 61 6c 75 | critical.procedures.in.the.evalu |
| d2560 | 61 74 6f 72 2c 0a 60 65 76 61 6c 27 20 61 6e 64 20 60 61 70 70 6c 79 27 2c 20 77 68 69 63 68 20 | ator,.`eval'.and.`apply',.which. |
| d2580 | 61 72 65 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 | are.described.in.section.*Note.4 |
| d25a0 | 2d 31 2d 31 3a 3a 20 28 73 65 65 0a 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 34 2d 31 3a 3a 29 2e | -1-1::.(see.*Note.Figure.4-1::). |
| d25c0 | 0a 0a 20 20 20 54 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 65 | .....The.implementation.of.the.e |
| d25e0 | 76 61 6c 75 61 74 6f 72 20 77 69 6c 6c 20 64 65 70 65 6e 64 20 75 70 6f 6e 20 70 72 6f 63 65 64 | valuator.will.depend.upon.proced |
| d2600 | 75 72 65 73 20 74 68 61 74 0a 64 65 66 69 6e 65 20 74 68 65 20 22 73 79 6e 74 61 78 22 20 6f 66 | ures.that.define.the."syntax".of |
| d2620 | 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 | .the.expressions.to.be.evaluated |
| d2640 | 2e 20 20 57 65 20 77 69 6c 6c 20 75 73 65 0a 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 | ...We.will.use.data.abstraction. |
| d2660 | 74 6f 20 6d 61 6b 65 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 64 65 70 65 6e 64 65 6e | to.make.the.evaluator.independen |
| d2680 | 74 20 6f 66 20 74 68 65 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6c | t.of.the.representation.of.the.l |
| d26a0 | 61 6e 67 75 61 67 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 72 61 74 68 65 72 20 74 68 | anguage...For.example,.rather.th |
| d26c0 | 61 6e 20 63 6f 6d 6d 69 74 74 69 6e 67 20 74 6f 0a 61 20 63 68 6f 69 63 65 20 74 68 61 74 20 61 | an.committing.to.a.choice.that.a |
| d26e0 | 6e 20 61 73 73 69 67 6e 6d 65 6e 74 20 69 73 20 74 6f 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 | n.assignment.is.to.be.represente |
| d2700 | 64 20 62 79 20 61 20 6c 69 73 74 20 62 65 67 69 6e 6e 69 6e 67 0a 77 69 74 68 20 74 68 65 20 73 | d.by.a.list.beginning.with.the.s |
| d2720 | 79 6d 62 6f 6c 20 60 73 65 74 21 27 20 77 65 20 75 73 65 20 61 6e 20 61 62 73 74 72 61 63 74 20 | ymbol.`set!'.we.use.an.abstract. |
| d2740 | 70 72 65 64 69 63 61 74 65 20 60 61 73 73 69 67 6e 6d 65 6e 74 3f 27 20 74 6f 0a 74 65 73 74 20 | predicate.`assignment?'.to.test. |
| d2760 | 66 6f 72 20 61 6e 20 61 73 73 69 67 6e 6d 65 6e 74 2c 20 61 6e 64 20 77 65 20 75 73 65 20 61 62 | for.an.assignment,.and.we.use.ab |
| d2780 | 73 74 72 61 63 74 20 73 65 6c 65 63 74 6f 72 73 0a 60 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 72 | stract.selectors.`assignment-var |
| d27a0 | 69 61 62 6c 65 27 20 61 6e 64 20 60 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 6c 75 65 27 20 74 6f | iable'.and.`assignment-value'.to |
| d27c0 | 20 61 63 63 65 73 73 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 61 6e 0a 61 73 73 69 67 6e 6d 65 | .access.the.parts.of.an.assignme |
| d27e0 | 6e 74 2e 20 20 49 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 65 78 70 72 65 73 73 69 6f | nt...Implementation.of.expressio |
| d2800 | 6e 73 20 77 69 6c 6c 20 62 65 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 64 65 74 61 69 6c 0a 69 | ns.will.be.described.in.detail.i |
| d2820 | 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 32 3a 3a 2e 20 20 54 68 65 72 65 20 | n.section.*Note.4-1-2::...There. |
| d2840 | 61 72 65 20 61 6c 73 6f 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 64 65 73 63 72 69 62 65 64 20 69 | are.also.operations,.described.i |
| d2860 | 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 33 3a 3a 2c 20 74 68 61 74 20 73 70 | n.section.*Note.4-1-3::,.that.sp |
| d2880 | 65 63 69 66 79 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 72 6f 63 | ecify.the.representation.of.proc |
| d28a0 | 65 64 75 72 65 73 0a 61 6e 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 2e 20 20 46 6f 72 20 65 78 | edures.and.environments...For.ex |
| d28c0 | 61 6d 70 6c 65 2c 20 60 6d 61 6b 65 2d 70 72 6f 63 65 64 75 72 65 27 20 63 6f 6e 73 74 72 75 63 | ample,.`make-procedure'.construc |
| d28e0 | 74 73 20 63 6f 6d 70 6f 75 6e 64 0a 70 72 6f 63 65 64 75 72 65 73 2c 20 60 6c 6f 6f 6b 75 70 2d | ts.compound.procedures,.`lookup- |
| d2900 | 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 27 20 61 63 63 65 73 73 65 73 20 74 68 65 20 76 61 6c | variable-value'.accesses.the.val |
| d2920 | 75 65 73 20 6f 66 20 76 61 72 69 61 62 6c 65 73 2c 0a 61 6e 64 20 60 61 70 70 6c 79 2d 70 72 69 | ues.of.variables,.and.`apply-pri |
| d2940 | 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 27 20 61 70 70 6c 69 65 73 20 61 20 70 72 69 6d | mitive-procedure'.applies.a.prim |
| d2960 | 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 61 0a 67 69 76 65 6e 20 6c 69 73 74 20 | itive.procedure.to.a.given.list. |
| d2980 | 6f 66 20 61 72 67 75 6d 65 6e 74 73 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 34 2d 31 2d 31 3a | of.arguments...*.Menu:..*.4-1-1: |
| d29a0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 43 6f 72 65 20 6f 66 20 74 68 65 20 45 76 61 | :............The.Core.of.the.Eva |
| d29c0 | 6c 75 61 74 6f 72 0a 2a 20 34 2d 31 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 52 65 70 72 | luator.*.4-1-2::............Repr |
| d29e0 | 65 73 65 6e 74 69 6e 67 20 45 78 70 72 65 73 73 69 6f 6e 73 0a 2a 20 34 2d 31 2d 33 3a 3a 20 20 | esenting.Expressions.*.4-1-3::.. |
| d2a00 | 20 20 20 20 20 20 20 20 20 20 45 76 61 6c 75 61 74 6f 72 20 44 61 74 61 20 53 74 72 75 63 74 75 | ..........Evaluator.Data.Structu |
| d2a20 | 72 65 73 0a 2a 20 34 2d 31 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 52 75 6e 6e 69 6e 67 | res.*.4-1-4::............Running |
| d2a40 | 20 74 68 65 20 45 76 61 6c 75 61 74 6f 72 20 61 73 20 61 20 50 72 6f 67 72 61 6d 0a 2a 20 34 2d | .the.Evaluator.as.a.Program.*.4- |
| d2a60 | 31 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 44 61 74 61 20 61 73 20 50 72 6f 67 72 61 6d | 1-5::............Data.as.Program |
| d2a80 | 73 0a 2a 20 34 2d 31 2d 36 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 49 6e 74 65 72 6e 61 6c 20 | s.*.4-1-6::............Internal. |
| d2aa0 | 44 65 66 69 6e 69 74 69 6f 6e 73 0a 2a 20 34 2d 31 2d 37 3a 3a 20 20 20 20 20 20 20 20 20 20 20 | Definitions.*.4-1-7::........... |
| d2ac0 | 20 53 65 70 61 72 61 74 69 6e 67 20 53 79 6e 74 61 63 74 69 63 20 41 6e 61 6c 79 73 69 73 20 66 | .Separating.Syntactic.Analysis.f |
| d2ae0 | 72 6f 6d 20 45 78 65 63 75 74 69 6f 6e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f | rom.Execution.....----------.Foo |
| d2b00 | 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 45 76 65 6e 20 73 | tnotes.----------.....(1).Even.s |
| d2b20 | 6f 2c 20 74 68 65 72 65 20 77 69 6c 6c 20 72 65 6d 61 69 6e 20 69 6d 70 6f 72 74 61 6e 74 20 61 | o,.there.will.remain.important.a |
| d2b40 | 73 70 65 63 74 73 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 0a 70 72 6f 63 65 73 73 | spects.of.the.evaluation.process |
| d2b60 | 20 74 68 61 74 20 61 72 65 20 6e 6f 74 20 65 6c 75 63 69 64 61 74 65 64 20 62 79 20 6f 75 72 20 | .that.are.not.elucidated.by.our. |
| d2b80 | 65 76 61 6c 75 61 74 6f 72 2e 20 20 54 68 65 20 6d 6f 73 74 20 69 6d 70 6f 72 74 61 6e 74 0a 6f | evaluator...The.most.important.o |
| d2ba0 | 66 20 74 68 65 73 65 20 61 72 65 20 74 68 65 20 64 65 74 61 69 6c 65 64 20 6d 65 63 68 61 6e 69 | f.these.are.the.detailed.mechani |
| d2bc0 | 73 6d 73 20 62 79 20 77 68 69 63 68 20 70 72 6f 63 65 64 75 72 65 73 20 63 61 6c 6c 20 6f 74 68 | sms.by.which.procedures.call.oth |
| d2be0 | 65 72 0a 70 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 72 65 74 75 72 6e 20 76 61 6c 75 65 73 20 | er.procedures.and.return.values. |
| d2c00 | 74 6f 20 74 68 65 69 72 20 63 61 6c 6c 65 72 73 2e 20 20 57 65 20 77 69 6c 6c 20 61 64 64 72 65 | to.their.callers...We.will.addre |
| d2c20 | 73 73 20 74 68 65 73 65 0a 69 73 73 75 65 73 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 | ss.these.issues.in.*Note.Chapter |
| d2c40 | 20 35 3a 3a 2c 20 77 68 65 72 65 20 77 65 20 74 61 6b 65 20 61 20 63 6c 6f 73 65 72 20 6c 6f 6f | .5::,.where.we.take.a.closer.loo |
| d2c60 | 6b 20 61 74 20 74 68 65 0a 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 62 79 20 69 | k.at.the.evaluation.process.by.i |
| d2c80 | 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 61 73 20 61 20 73 | mplementing.the.evaluator.as.a.s |
| d2ca0 | 69 6d 70 6c 65 20 72 65 67 69 73 74 65 72 0a 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 28 32 29 20 | imple.register.machine......(2). |
| d2cc0 | 49 66 20 77 65 20 67 72 61 6e 74 20 6f 75 72 73 65 6c 76 65 73 20 74 68 65 20 61 62 69 6c 69 74 | If.we.grant.ourselves.the.abilit |
| d2ce0 | 79 20 74 6f 20 61 70 70 6c 79 20 70 72 69 6d 69 74 69 76 65 73 2c 20 74 68 65 6e 20 77 68 61 74 | y.to.apply.primitives,.then.what |
| d2d00 | 0a 72 65 6d 61 69 6e 73 20 66 6f 72 20 75 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 69 6e 20 | .remains.for.us.to.implement.in. |
| d2d20 | 74 68 65 20 65 76 61 6c 75 61 74 6f 72 3f 20 20 54 68 65 20 6a 6f 62 20 6f 66 20 74 68 65 20 65 | the.evaluator?..The.job.of.the.e |
| d2d40 | 76 61 6c 75 61 74 6f 72 0a 69 73 20 6e 6f 74 20 74 6f 20 73 70 65 63 69 66 79 20 74 68 65 20 70 | valuator.is.not.to.specify.the.p |
| d2d60 | 72 69 6d 69 74 69 76 65 73 20 6f 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 2c 20 62 75 74 20 72 | rimitives.of.the.language,.but.r |
| d2d80 | 61 74 68 65 72 20 74 6f 20 70 72 6f 76 69 64 65 0a 74 68 65 20 63 6f 6e 6e 65 63 74 69 76 65 20 | ather.to.provide.the.connective. |
| d2da0 | 74 69 73 73 75 65 2d 2d 74 68 65 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e | tissue--the.means.of.combination |
| d2dc0 | 20 61 6e 64 20 74 68 65 20 6d 65 61 6e 73 20 6f 66 0a 61 62 73 74 72 61 63 74 69 6f 6e 2d 2d 74 | .and.the.means.of.abstraction--t |
| d2de0 | 68 61 74 20 62 69 6e 64 73 20 61 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 70 72 69 6d 69 74 | hat.binds.a.collection.of.primit |
| d2e00 | 69 76 65 73 20 74 6f 20 66 6f 72 6d 20 61 20 6c 61 6e 67 75 61 67 65 2e 0a 53 70 65 63 69 66 69 | ives.to.form.a.language..Specifi |
| d2e20 | 63 61 6c 6c 79 3a 0a 0a 20 20 20 2a 20 54 68 65 20 65 76 61 6c 75 61 74 6f 72 20 65 6e 61 62 6c | cally:.....*.The.evaluator.enabl |
| d2e40 | 65 73 20 75 73 20 74 6f 20 64 65 61 6c 20 77 69 74 68 20 6e 65 73 74 65 64 20 65 78 70 72 65 73 | es.us.to.deal.with.nested.expres |
| d2e60 | 73 69 6f 6e 73 2e 20 20 46 6f 72 0a 20 20 20 20 20 65 78 61 6d 70 6c 65 2c 20 61 6c 74 68 6f 75 | sions...For......example,.althou |
| d2e80 | 67 68 20 73 69 6d 70 6c 79 20 61 70 70 6c 79 69 6e 67 20 70 72 69 6d 69 74 69 76 65 73 20 77 6f | gh.simply.applying.primitives.wo |
| d2ea0 | 75 6c 64 20 73 75 66 66 69 63 65 20 66 6f 72 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6e 67 20 | uld.suffice.for......evaluating. |
| d2ec0 | 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 2b 20 31 20 36 29 27 2c 20 69 74 20 69 73 20 | the.expression.`(+.1.6)',.it.is. |
| d2ee0 | 6e 6f 74 20 61 64 65 71 75 61 74 65 20 66 6f 72 0a 20 20 20 20 20 68 61 6e 64 6c 69 6e 67 20 60 | not.adequate.for......handling.` |
| d2f00 | 28 2b 20 31 20 28 2a 20 32 20 33 29 29 27 2e 20 20 41 73 20 66 61 72 20 61 73 20 74 68 65 20 70 | (+.1.(*.2.3))'...As.far.as.the.p |
| d2f20 | 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 60 2b 27 0a 20 20 20 20 20 69 73 20 63 | rimitive.procedure.`+'......is.c |
| d2f40 | 6f 6e 63 65 72 6e 65 64 2c 20 69 74 73 20 61 72 67 75 6d 65 6e 74 73 20 6d 75 73 74 20 62 65 20 | oncerned,.its.arguments.must.be. |
| d2f60 | 6e 75 6d 62 65 72 73 2c 20 61 6e 64 20 69 74 20 77 6f 75 6c 64 20 63 68 6f 6b 65 20 69 66 0a 20 | numbers,.and.it.would.choke.if.. |
| d2f80 | 20 20 20 20 77 65 20 70 61 73 73 65 64 20 69 74 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 | ....we.passed.it.the.expression. |
| d2fa0 | 60 28 2a 20 32 20 33 29 27 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 2e 20 20 4f 6e 65 0a 20 | `(*.2.3)'.as.an.argument...One.. |
| d2fc0 | 20 20 20 20 69 6d 70 6f 72 74 61 6e 74 20 72 6f 6c 65 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 | ....important.role.of.the.evalua |
| d2fe0 | 74 6f 72 20 69 73 20 74 6f 20 63 68 6f 72 65 6f 67 72 61 70 68 20 70 72 6f 63 65 64 75 72 65 0a | tor.is.to.choreograph.procedure. |
| d3000 | 20 20 20 20 20 63 6f 6d 70 6f 73 69 74 69 6f 6e 20 73 6f 20 74 68 61 74 20 60 28 2a 20 32 20 33 | .....composition.so.that.`(*.2.3 |
| d3020 | 29 27 20 69 73 20 72 65 64 75 63 65 64 20 74 6f 20 36 20 62 65 66 6f 72 65 20 62 65 69 6e 67 20 | )'.is.reduced.to.6.before.being. |
| d3040 | 70 61 73 73 65 64 0a 20 20 20 20 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 60 2b | passed......as.an.argument.to.`+ |
| d3060 | 27 2e 0a 0a 20 20 20 2a 20 54 68 65 20 65 76 61 6c 75 61 74 6f 72 20 61 6c 6c 6f 77 73 20 75 73 | '......*.The.evaluator.allows.us |
| d3080 | 20 74 6f 20 75 73 65 20 76 61 72 69 61 62 6c 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c | .to.use.variables...For.example, |
| d30a0 | 20 74 68 65 0a 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 66 6f | .the......primitive.procedure.fo |
| d30c0 | 72 20 61 64 64 69 74 69 6f 6e 20 68 61 73 20 6e 6f 20 77 61 79 20 74 6f 20 64 65 61 6c 20 77 69 | r.addition.has.no.way.to.deal.wi |
| d30e0 | 74 68 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 20 73 75 63 68 20 61 73 20 60 28 2b 20 | th......expressions.such.as.`(+. |
| d3100 | 78 20 31 29 27 2e 20 20 57 65 20 6e 65 65 64 20 61 6e 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 | x.1)'...We.need.an.evaluator.to. |
| d3120 | 6b 65 65 70 20 74 72 61 63 6b 0a 20 20 20 20 20 6f 66 20 76 61 72 69 61 62 6c 65 73 20 61 6e 64 | keep.track......of.variables.and |
| d3140 | 20 6f 62 74 61 69 6e 20 74 68 65 69 72 20 76 61 6c 75 65 73 20 62 65 66 6f 72 65 20 69 6e 76 6f | .obtain.their.values.before.invo |
| d3160 | 6b 69 6e 67 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 | king.the.primitive......procedur |
| d3180 | 65 73 2e 0a 0a 20 20 20 2a 20 54 68 65 20 65 76 61 6c 75 61 74 6f 72 20 61 6c 6c 6f 77 73 20 75 | es......*.The.evaluator.allows.u |
| d31a0 | 73 20 74 6f 20 64 65 66 69 6e 65 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 2e | s.to.define.compound.procedures. |
| d31c0 | 20 20 54 68 69 73 0a 20 20 20 20 20 69 6e 76 6f 6c 76 65 73 20 6b 65 65 70 69 6e 67 20 74 72 61 | ..This......involves.keeping.tra |
| d31e0 | 63 6b 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 6b 6e 6f | ck.of.procedure.definitions,.kno |
| d3200 | 77 69 6e 67 20 68 6f 77 20 74 6f 0a 20 20 20 20 20 75 73 65 20 74 68 65 73 65 20 64 65 66 69 6e | wing.how.to......use.these.defin |
| d3220 | 69 74 69 6f 6e 73 20 69 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 | itions.in.evaluating.expressions |
| d3240 | 2c 20 61 6e 64 20 70 72 6f 76 69 64 69 6e 67 20 61 0a 20 20 20 20 20 6d 65 63 68 61 6e 69 73 6d | ,.and.providing.a......mechanism |
| d3260 | 20 74 68 61 74 20 65 6e 61 62 6c 65 73 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 61 63 63 65 | .that.enables.procedures.to.acce |
| d3280 | 70 74 20 61 72 67 75 6d 65 6e 74 73 2e 0a 0a 20 20 20 2a 20 54 68 65 20 65 76 61 6c 75 61 74 6f | pt.arguments......*.The.evaluato |
| d32a0 | 72 20 70 72 6f 76 69 64 65 73 20 74 68 65 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 2c 20 77 68 | r.provides.the.special.forms,.wh |
| d32c0 | 69 63 68 20 6d 75 73 74 20 62 65 20 65 76 61 6c 75 61 74 65 64 0a 20 20 20 20 20 64 69 66 66 65 | ich.must.be.evaluated......diffe |
| d32e0 | 72 65 6e 74 6c 79 20 66 72 6f 6d 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 73 2e 0a 0a 0a 1f | rently.from.procedure.calls..... |
| d3300 | 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 31 2d 31 2c 20 | .File:.sicp.info,..Node:.4-1-1,. |
| d3320 | 20 4e 65 78 74 3a 20 34 2d 31 2d 32 2c 20 20 50 72 65 76 3a 20 34 2d 31 2c 20 20 55 70 3a 20 34 | .Next:.4-1-2,..Prev:.4-1,..Up:.4 |
| d3340 | 2d 31 0a 0a 34 2e 31 2e 31 20 54 68 65 20 43 6f 72 65 20 6f 66 20 74 68 65 20 45 76 61 6c 75 61 | -1..4.1.1.The.Core.of.the.Evalua |
| d3360 | 74 6f 72 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | tor.---------------------------- |
| d3380 | 2d 2d 2d 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 34 2e 31 3a 2a 20 54 68 65 20 60 65 76 61 | ---.......*Figure.4.1:*.The.`eva |
| d33a0 | 6c 27 2d 60 61 70 70 6c 79 27 20 63 79 63 6c 65 20 65 78 70 6f 73 65 73 20 74 68 65 20 65 73 73 | l'-`apply'.cycle.exposes.the.ess |
| d33c0 | 65 6e 63 65 20 6f 66 20 61 0a 20 20 20 20 20 63 6f 6d 70 75 74 65 72 20 6c 61 6e 67 75 61 67 65 | ence.of.a......computer.language |
| d33e0 | 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| d3400 | 20 20 20 20 20 20 20 20 2e 2c 61 64 38 38 38 38 38 38 38 38 62 61 61 2c 0a 20 20 20 20 20 20 20 | .........,ad88888888baa,........ |
| d3420 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 20 20 20 20 2c 64 38 50 22 22 | ....................._....,d8P"" |
| d3440 | 22 20 20 20 20 20 20 20 20 22 22 39 38 38 38 62 61 2e 20 20 20 20 20 20 5f 0a 20 20 20 20 20 20 | "........""9888ba......._....... |
| d3460 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 2e 61 38 22 20 20 20 20 | ...................../...a8".... |
| d3480 | 20 20 20 20 20 20 2c 61 64 38 38 38 38 38 38 38 38 38 38 38 61 20 20 20 7c 5c 0a 20 20 20 20 20 | ......,ad88888888888a...|\...... |
| d34a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 61 50 27 20 20 20 20 20 | ..................../...aP'..... |
| d34c0 | 20 20 20 20 20 2c 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 61 20 20 20 5c 0a 20 20 20 | .....,88888888888888888a...\.... |
| d34e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 2c 38 22 20 20 20 20 20 | ...................../..,8"..... |
| d3500 | 20 20 20 20 20 20 2c 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 2c 20 20 5c 0a | ......,88888888888888888888,..\. |
| d3520 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 2c 38 27 20 20 20 | .......................|..,8'... |
| d3540 | 20 20 20 20 20 20 20 20 20 28 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 2c | .........(888888888888888888888, |
| d3560 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 2c 38 27 20 | .|......................./..,8'. |
| d3580 | 20 20 20 20 20 20 20 20 20 20 20 20 60 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 | ............`8888888888888888888 |
| d35a0 | 38 38 38 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | 888..\.......................|.. |
| d35c0 | 38 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 38 38 38 38 38 38 38 38 38 38 38 38 38 38 | 8)...............`88888888888888 |
| d35e0 | 38 38 38 38 38 38 38 2c 20 7c 0a 20 20 20 20 20 20 20 20 20 20 50 72 6f 63 65 64 75 72 65 2c 20 | 8888888,.|...........Procedure,. |
| d3600 | 20 7c 20 20 38 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 38 38 38 38 38 20 41 70 | .|..8.................."88888.Ap |
| d3620 | 70 6c 79 20 38 38 38 38 38 38 38 29 20 7c 20 45 78 70 72 65 73 73 69 6f 6e 0a 20 20 20 20 20 20 | ply.8888888).|.Expression....... |
| d3640 | 20 20 20 20 41 72 67 75 6d 65 6e 74 73 20 20 20 7c 20 20 38 20 20 20 20 20 45 76 61 6c 20 20 20 | ....Arguments...|..8.....Eval... |
| d3660 | 20 20 20 20 20 20 20 60 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 29 20 7c 20 45 6e | .......`888888888888888888).|.En |
| d3680 | 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | vironment....................... |
| d36a0 | 7c 20 20 38 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 38 38 38 38 38 38 | |..8)...................."888888 |
| d36c0 | 38 38 38 38 38 38 38 38 38 38 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 8888888888..|................... |
| d36e0 | 20 20 20 20 5c 20 20 28 62 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 38 | ....\..(b....................."8 |
| d3700 | 38 38 38 38 38 38 38 38 38 38 38 38 38 27 20 20 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 8888888888888'../............... |
| d3720 | 20 20 20 20 20 20 20 20 20 7c 20 60 38 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .........|.`8,.................. |
| d3740 | 20 20 20 38 38 38 38 38 38 38 38 38 38 38 38 38 29 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | ...8888888888888)..|............ |
| d3760 | 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 20 22 38 61 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............\.."8a.............. |
| d3780 | 20 20 20 20 20 2c 38 38 38 38 38 38 38 38 38 38 38 38 29 20 20 2f 0a 20 20 20 20 20 20 20 20 20 | .....,888888888888)../.......... |
| d37a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 20 20 56 38 2c 20 20 20 20 20 20 20 20 20 20 | ...............\...V8,.......... |
| d37c0 | 20 20 20 20 20 20 20 64 38 38 38 38 38 38 38 38 38 38 38 22 20 20 2f 0a 20 20 20 20 20 20 20 20 | .......d88888888888"../......... |
| d37e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5c 7c 20 60 38 62 2c 20 20 20 20 20 20 20 20 | ................_\|.`8b,........ |
| d3800 | 20 20 20 20 20 2c 64 38 38 38 38 38 38 38 38 38 38 50 27 20 5f 2f 0a 20 20 20 20 20 20 20 20 20 | .....,d8888888888P'._/.......... |
| d3820 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 56 38 61 2c 20 20 20 20 20 | ......................`V8a,..... |
| d3840 | 20 20 2c 61 64 38 38 38 38 38 38 38 38 38 38 50 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..,ad8888888888P'............... |
| d3860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 22 38 38 38 38 38 38 38 38 38 38 | ....................""8888888888 |
| d3880 | 38 38 38 38 38 38 38 50 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 8888888P"....................... |
| d38a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 22 22 22 22 22 22 22 22 22 22 22 0a 0a 20 | .................""""""""""""... |
| d38c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| d38e0 | 20 20 20 20 20 20 20 20 5b 67 72 61 70 68 69 63 20 62 79 20 4e 6f 72 6d 61 6e 64 20 56 65 69 6c | ........[graphic.by.Normand.Veil |
| d3900 | 6c 75 78 2c 20 6d 6f 64 69 66 69 65 64 5d 0a 0a 54 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 | lux,.modified]..The.evaluation.p |
| d3920 | 72 6f 63 65 73 73 20 63 61 6e 20 62 65 20 64 65 73 63 72 69 62 65 64 20 61 73 20 74 68 65 20 69 | rocess.can.be.described.as.the.i |
| d3940 | 6e 74 65 72 70 6c 61 79 20 62 65 74 77 65 65 6e 20 74 77 6f 0a 70 72 6f 63 65 64 75 72 65 73 3a | nterplay.between.two.procedures: |
| d3960 | 20 60 65 76 61 6c 27 20 61 6e 64 20 60 61 70 70 6c 79 27 2e 0a 0a 45 76 61 6c 0a 2e 2e 2e 2e 0a | .`eval'.and.`apply'...Eval...... |
| d3980 | 0a 60 45 76 61 6c 27 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 20 65 78 | .`Eval'.takes.as.arguments.an.ex |
| d39a0 | 70 72 65 73 73 69 6f 6e 20 61 6e 64 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 49 74 | pression.and.an.environment...It |
| d39c0 | 0a 63 6c 61 73 73 69 66 69 65 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 61 6e 64 20 64 | .classifies.the.expression.and.d |
| d39e0 | 69 72 65 63 74 73 20 69 74 73 20 65 76 61 6c 75 61 74 69 6f 6e 2e 20 20 60 45 76 61 6c 27 20 69 | irects.its.evaluation...`Eval'.i |
| d3a00 | 73 0a 73 74 72 75 63 74 75 72 65 64 20 61 73 20 61 20 63 61 73 65 20 61 6e 61 6c 79 73 69 73 20 | s.structured.as.a.case.analysis. |
| d3a20 | 6f 66 20 74 68 65 20 73 79 6e 74 61 63 74 69 63 20 74 79 70 65 20 6f 66 20 74 68 65 20 65 78 70 | of.the.syntactic.type.of.the.exp |
| d3a40 | 72 65 73 73 69 6f 6e 0a 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 2e 20 20 49 6e 20 6f 72 64 | ression.to.be.evaluated...In.ord |
| d3a60 | 65 72 20 74 6f 20 6b 65 65 70 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 67 65 6e 65 72 61 6c | er.to.keep.the.procedure.general |
| d3a80 | 2c 20 77 65 20 65 78 70 72 65 73 73 0a 74 68 65 20 64 65 74 65 72 6d 69 6e 61 74 69 6f 6e 20 6f | ,.we.express.the.determination.o |
| d3aa0 | 66 20 74 68 65 20 74 79 70 65 20 6f 66 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 61 62 73 74 | f.the.type.of.an.expression.abst |
| d3ac0 | 72 61 63 74 6c 79 2c 20 6d 61 6b 69 6e 67 20 6e 6f 0a 63 6f 6d 6d 69 74 6d 65 6e 74 20 74 6f 20 | ractly,.making.no.commitment.to. |
| d3ae0 | 61 6e 79 20 70 61 72 74 69 63 75 6c 61 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f | any.particular.representation.fo |
| d3b00 | 72 20 74 68 65 20 76 61 72 69 6f 75 73 20 74 79 70 65 73 20 6f 66 0a 65 78 70 72 65 73 73 69 6f | r.the.various.types.of.expressio |
| d3b20 | 6e 73 2e 20 20 45 61 63 68 20 74 79 70 65 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 20 68 61 73 | ns...Each.type.of.expression.has |
| d3b40 | 20 61 20 70 72 65 64 69 63 61 74 65 20 74 68 61 74 20 74 65 73 74 73 20 66 6f 72 20 69 74 0a 61 | .a.predicate.that.tests.for.it.a |
| d3b60 | 6e 64 20 61 6e 20 61 62 73 74 72 61 63 74 20 6d 65 61 6e 73 20 66 6f 72 20 73 65 6c 65 63 74 69 | nd.an.abstract.means.for.selecti |
| d3b80 | 6e 67 20 69 74 73 20 70 61 72 74 73 2e 20 20 54 68 69 73 20 22 61 62 73 74 72 61 63 74 20 73 79 | ng.its.parts...This."abstract.sy |
| d3ba0 | 6e 74 61 78 22 0a 6d 61 6b 65 73 20 69 74 20 65 61 73 79 20 74 6f 20 73 65 65 20 68 6f 77 20 77 | ntax".makes.it.easy.to.see.how.w |
| d3bc0 | 65 20 63 61 6e 20 63 68 61 6e 67 65 20 74 68 65 20 73 79 6e 74 61 78 20 6f 66 20 74 68 65 20 6c | e.can.change.the.syntax.of.the.l |
| d3be0 | 61 6e 67 75 61 67 65 20 62 79 0a 75 73 69 6e 67 20 74 68 65 20 73 61 6d 65 20 65 76 61 6c 75 61 | anguage.by.using.the.same.evalua |
| d3c00 | 74 6f 72 2c 20 62 75 74 20 77 69 74 68 20 61 20 64 69 66 66 65 72 65 6e 74 20 63 6f 6c 6c 65 63 | tor,.but.with.a.different.collec |
| d3c20 | 74 69 6f 6e 20 6f 66 20 73 79 6e 74 61 78 0a 70 72 6f 63 65 64 75 72 65 73 2e 0a 0a 50 72 69 6d | tion.of.syntax.procedures...Prim |
| d3c40 | 69 74 69 76 65 20 65 78 70 72 65 73 73 69 6f 6e 73 0a 0a 20 20 20 2a 20 46 6f 72 20 73 65 6c 66 | itive.expressions.....*.For.self |
| d3c60 | 2d 65 76 61 6c 75 61 74 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 73 75 63 68 20 61 73 | -evaluating.expressions,.such.as |
| d3c80 | 20 6e 75 6d 62 65 72 73 2c 20 60 65 76 61 6c 27 20 72 65 74 75 72 6e 73 0a 20 20 20 20 20 74 68 | .numbers,.`eval'.returns......th |
| d3ca0 | 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 74 73 65 6c 66 2e 0a 0a 20 20 20 2a 20 60 45 76 61 6c | e.expression.itself......*.`Eval |
| d3cc0 | 27 20 6d 75 73 74 20 6c 6f 6f 6b 20 75 70 20 76 61 72 69 61 62 6c 65 73 20 69 6e 20 74 68 65 20 | '.must.look.up.variables.in.the. |
| d3ce0 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 74 6f 20 66 69 6e 64 20 74 68 65 69 72 0a 20 20 20 20 20 76 | environment.to.find.their......v |
| d3d00 | 61 6c 75 65 73 2e 0a 0a 0a 53 70 65 63 69 61 6c 20 66 6f 72 6d 73 0a 0a 20 20 20 2a 20 46 6f 72 | alues....Special.forms.....*.For |
| d3d20 | 20 71 75 6f 74 65 64 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 60 65 76 61 6c 27 20 72 65 74 75 | .quoted.expressions,.`eval'.retu |
| d3d40 | 72 6e 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 77 61 73 0a 20 20 20 20 | rns.the.expression.that.was..... |
| d3d60 | 20 71 75 6f 74 65 64 2e 0a 0a 20 20 20 2a 20 41 6e 20 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 20 | .quoted......*.An.assignment.to. |
| d3d80 | 28 6f 72 20 61 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 29 20 61 20 76 61 72 69 61 62 6c 65 20 | (or.a.definition.of).a.variable. |
| d3da0 | 6d 75 73 74 20 72 65 63 75 72 73 69 76 65 6c 79 0a 20 20 20 20 20 63 61 6c 6c 20 60 65 76 61 6c | must.recursively......call.`eval |
| d3dc0 | 27 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 6e 65 77 20 76 61 6c 75 65 20 74 6f 20 62 65 | '.to.compute.the.new.value.to.be |
| d3de0 | 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 65 0a 20 20 20 20 20 76 61 72 69 61 62 | .associated.with.the......variab |
| d3e00 | 6c 65 2e 20 20 54 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 75 73 74 20 62 65 20 6d 6f 64 | le...The.environment.must.be.mod |
| d3e20 | 69 66 69 65 64 20 74 6f 20 63 68 61 6e 67 65 20 28 6f 72 20 63 72 65 61 74 65 29 0a 20 20 20 20 | ified.to.change.(or.create)..... |
| d3e40 | 20 74 68 65 20 62 69 6e 64 69 6e 67 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 2e 0a 0a 20 | .the.binding.of.the.variable.... |
| d3e60 | 20 20 2a 20 41 6e 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 20 72 65 71 75 69 72 65 73 20 | ..*.An.`if'.expression.requires. |
| d3e80 | 73 70 65 63 69 61 6c 20 70 72 6f 63 65 73 73 69 6e 67 20 6f 66 20 69 74 73 20 70 61 72 74 73 2c | special.processing.of.its.parts, |
| d3ea0 | 20 73 6f 20 61 73 0a 20 20 20 20 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 63 6f 6e 73 | .so.as......to.evaluate.the.cons |
| d3ec0 | 65 71 75 65 6e 74 20 69 66 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 69 73 20 74 72 75 65 2c | equent.if.the.predicate.is.true, |
| d3ee0 | 20 61 6e 64 20 6f 74 68 65 72 77 69 73 65 0a 20 20 20 20 20 74 6f 20 65 76 61 6c 75 61 74 65 20 | .and.otherwise......to.evaluate. |
| d3f00 | 74 68 65 20 61 6c 74 65 72 6e 61 74 69 76 65 2e 0a 0a 20 20 20 2a 20 41 20 60 6c 61 6d 62 64 61 | the.alternative......*.A.`lambda |
| d3f20 | 27 20 65 78 70 72 65 73 73 69 6f 6e 20 6d 75 73 74 20 62 65 20 74 72 61 6e 73 66 6f 72 6d 65 64 | '.expression.must.be.transformed |
| d3f40 | 20 69 6e 74 6f 20 61 6e 20 61 70 70 6c 69 63 61 62 6c 65 0a 20 20 20 20 20 70 72 6f 63 65 64 75 | .into.an.applicable......procedu |
| d3f60 | 72 65 20 62 79 20 70 61 63 6b 61 67 69 6e 67 20 74 6f 67 65 74 68 65 72 20 74 68 65 20 70 61 72 | re.by.packaging.together.the.par |
| d3f80 | 61 6d 65 74 65 72 73 20 61 6e 64 20 62 6f 64 79 20 73 70 65 63 69 66 69 65 64 0a 20 20 20 20 20 | ameters.and.body.specified...... |
| d3fa0 | 62 79 20 74 68 65 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 77 69 74 68 20 | by.the.`lambda'.expression.with. |
| d3fc0 | 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f | the.environment.of.the.evaluatio |
| d3fe0 | 6e 2e 0a 0a 20 20 20 2a 20 41 20 60 62 65 67 69 6e 27 20 65 78 70 72 65 73 73 69 6f 6e 20 72 65 | n......*.A.`begin'.expression.re |
| d4000 | 71 75 69 72 65 73 20 65 76 61 6c 75 61 74 69 6e 67 20 69 74 73 20 73 65 71 75 65 6e 63 65 20 6f | quires.evaluating.its.sequence.o |
| d4020 | 66 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 6f 72 64 65 72 20 | f......expressions.in.the.order. |
| d4040 | 69 6e 20 77 68 69 63 68 20 74 68 65 79 20 61 70 70 65 61 72 2e 0a 0a 20 20 20 2a 20 41 20 63 61 | in.which.they.appear......*.A.ca |
| d4060 | 73 65 20 61 6e 61 6c 79 73 69 73 20 28 60 63 6f 6e 64 27 29 20 69 73 20 74 72 61 6e 73 66 6f 72 | se.analysis.(`cond').is.transfor |
| d4080 | 6d 65 64 20 69 6e 74 6f 20 61 20 6e 65 73 74 20 6f 66 20 60 69 66 27 0a 20 20 20 20 20 65 78 70 | med.into.a.nest.of.`if'......exp |
| d40a0 | 72 65 73 73 69 6f 6e 73 20 61 6e 64 20 74 68 65 6e 20 65 76 61 6c 75 61 74 65 64 2e 0a 0a 0a 43 | ressions.and.then.evaluated....C |
| d40c0 | 6f 6d 62 69 6e 61 74 69 6f 6e 73 0a 0a 20 20 20 2a 20 46 6f 72 20 61 20 70 72 6f 63 65 64 75 72 | ombinations.....*.For.a.procedur |
| d40e0 | 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 60 65 76 61 6c 27 20 6d 75 73 74 20 72 65 63 75 72 | e.application,.`eval'.must.recur |
| d4100 | 73 69 76 65 6c 79 20 65 76 61 6c 75 61 74 65 20 74 68 65 0a 20 20 20 20 20 6f 70 65 72 61 74 6f | sively.evaluate.the......operato |
| d4120 | 72 20 70 61 72 74 20 61 6e 64 20 74 68 65 20 6f 70 65 72 61 6e 64 73 20 6f 66 20 74 68 65 20 63 | r.part.and.the.operands.of.the.c |
| d4140 | 6f 6d 62 69 6e 61 74 69 6f 6e 2e 20 20 54 68 65 20 72 65 73 75 6c 74 69 6e 67 0a 20 20 20 20 20 | ombination...The.resulting...... |
| d4160 | 70 72 6f 63 65 64 75 72 65 20 61 6e 64 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 70 61 73 73 | procedure.and.arguments.are.pass |
| d4180 | 65 64 20 74 6f 20 60 61 70 70 6c 79 27 2c 20 77 68 69 63 68 20 68 61 6e 64 6c 65 73 20 74 68 65 | ed.to.`apply',.which.handles.the |
| d41a0 | 0a 20 20 20 20 20 61 63 74 75 61 6c 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 | ......actual.procedure.applicati |
| d41c0 | 6f 6e 2e 0a 0a 0a 20 20 20 48 65 72 65 20 69 73 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 | on.......Here.is.the.definition. |
| d41e0 | 6f 66 20 60 65 76 61 6c 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 61 6c 20 65 | of.`eval':.......(define.(eval.e |
| d4200 | 78 70 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 73 65 6c 66 2d 65 76 61 6c | xp.env)........(cond.((self-eval |
| d4220 | 75 61 74 69 6e 67 3f 20 65 78 70 29 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | uating?.exp).exp)..............( |
| d4240 | 28 76 61 72 69 61 62 6c 65 3f 20 65 78 70 29 20 28 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 | (variable?.exp).(lookup-variable |
| d4260 | 2d 76 61 6c 75 65 20 65 78 70 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | -value.exp.env))..............(( |
| d4280 | 71 75 6f 74 65 64 3f 20 65 78 70 29 20 28 74 65 78 74 2d 6f 66 2d 71 75 6f 74 61 74 69 6f 6e 20 | quoted?.exp).(text-of-quotation. |
| d42a0 | 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 61 73 73 69 67 6e 6d 65 6e 74 3f | exp))..............((assignment? |
| d42c0 | 20 65 78 70 29 20 28 65 76 61 6c 2d 61 73 73 69 67 6e 6d 65 6e 74 20 65 78 70 20 65 6e 76 29 29 | .exp).(eval-assignment.exp.env)) |
| d42e0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 64 65 66 69 6e 69 74 69 6f 6e 3f 20 65 78 70 29 | ..............((definition?.exp) |
| d4300 | 20 28 65 76 61 6c 2d 64 65 66 69 6e 69 74 69 6f 6e 20 65 78 70 20 65 6e 76 29 29 0a 20 20 20 20 | .(eval-definition.exp.env))..... |
| d4320 | 20 20 20 20 20 20 20 20 20 28 28 69 66 3f 20 65 78 70 29 20 28 65 76 61 6c 2d 69 66 20 65 78 70 | .........((if?.exp).(eval-if.exp |
| d4340 | 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6c 61 6d 62 64 61 3f 20 65 78 | .env))..............((lambda?.ex |
| d4360 | 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 70 72 6f 63 65 64 75 72 65 | p)...............(make-procedure |
| d4380 | 20 28 6c 61 6d 62 64 61 2d 70 61 72 61 6d 65 74 65 72 73 20 65 78 70 29 0a 20 20 20 20 20 20 20 | .(lambda-parameters.exp)........ |
| d43a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 2d 62 | .......................(lambda-b |
| d43c0 | 6f 64 79 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ody.exp)........................ |
| d43e0 | 20 20 20 20 20 20 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 62 65 67 69 | .......env))..............((begi |
| d4400 | 6e 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 76 61 6c 2d 73 65 71 75 | n?.exp)...............(eval-sequ |
| d4420 | 65 6e 63 65 20 28 62 65 67 69 6e 2d 61 63 74 69 6f 6e 73 20 65 78 70 29 20 65 6e 76 29 29 0a 20 | ence.(begin-actions.exp).env)).. |
| d4440 | 20 20 20 20 20 20 20 20 20 20 20 20 28 28 63 6f 6e 64 3f 20 65 78 70 29 20 28 65 76 61 6c 20 28 | ............((cond?.exp).(eval.( |
| d4460 | 63 6f 6e 64 2d 3e 69 66 20 65 78 70 29 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | cond->if.exp).env))............. |
| d4480 | 20 28 28 61 70 70 6c 69 63 61 74 69 6f 6e 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .((application?.exp)............ |
| d44a0 | 20 20 20 28 61 70 70 6c 79 20 28 65 76 61 6c 20 28 6f 70 65 72 61 74 6f 72 20 65 78 70 29 20 65 | ...(apply.(eval.(operator.exp).e |
| d44c0 | 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 6f | nv)......................(list-o |
| d44e0 | 66 2d 76 61 6c 75 65 73 20 28 6f 70 65 72 61 6e 64 73 20 65 78 70 29 20 65 6e 76 29 29 29 0a 20 | f-values.(operands.exp).env))).. |
| d4500 | 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............(else............... |
| d4520 | 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 74 79 70 65 20 | (error."Unknown.expression.type. |
| d4540 | 2d 2d 20 45 56 41 4c 22 20 65 78 70 29 29 29 29 0a 0a 20 20 20 46 6f 72 20 63 6c 61 72 69 74 79 | --.EVAL".exp)))).....For.clarity |
| d4560 | 2c 20 60 65 76 61 6c 27 20 68 61 73 20 62 65 65 6e 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 | ,.`eval'.has.been.implemented.as |
| d4580 | 20 61 20 63 61 73 65 20 61 6e 61 6c 79 73 69 73 20 75 73 69 6e 67 0a 60 63 6f 6e 64 27 2e 20 20 | .a.case.analysis.using.`cond'... |
| d45a0 | 54 68 65 20 64 69 73 61 64 76 61 6e 74 61 67 65 20 6f 66 20 74 68 69 73 20 69 73 20 74 68 61 74 | The.disadvantage.of.this.is.that |
| d45c0 | 20 6f 75 72 20 70 72 6f 63 65 64 75 72 65 20 68 61 6e 64 6c 65 73 20 6f 6e 6c 79 20 61 0a 66 65 | .our.procedure.handles.only.a.fe |
| d45e0 | 77 20 64 69 73 74 69 6e 67 75 69 73 68 61 62 6c 65 20 74 79 70 65 73 20 6f 66 20 65 78 70 72 65 | w.distinguishable.types.of.expre |
| d4600 | 73 73 69 6f 6e 73 2c 20 61 6e 64 20 6e 6f 20 6e 65 77 20 6f 6e 65 73 20 63 61 6e 20 62 65 0a 64 | ssions,.and.no.new.ones.can.be.d |
| d4620 | 65 66 69 6e 65 64 20 77 69 74 68 6f 75 74 20 65 64 69 74 69 6e 67 20 74 68 65 20 64 65 66 69 6e | efined.without.editing.the.defin |
| d4640 | 69 74 69 6f 6e 20 6f 66 20 60 65 76 61 6c 27 2e 20 20 49 6e 20 6d 6f 73 74 20 4c 69 73 70 0a 69 | ition.of.`eval'...In.most.Lisp.i |
| d4660 | 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2c 20 64 69 73 70 61 74 63 68 69 6e 67 20 6f 6e 20 74 | mplementations,.dispatching.on.t |
| d4680 | 68 65 20 74 79 70 65 20 6f 66 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 64 6f 6e 65 | he.type.of.an.expression.is.done |
| d46a0 | 20 69 6e 20 61 0a 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 73 74 79 6c 65 2e 20 20 54 68 69 73 | .in.a.data-directed.style...This |
| d46c0 | 20 61 6c 6c 6f 77 73 20 61 20 75 73 65 72 20 74 6f 20 61 64 64 20 6e 65 77 20 74 79 70 65 73 20 | .allows.a.user.to.add.new.types. |
| d46e0 | 6f 66 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 74 68 61 74 20 60 65 76 61 6c 27 20 63 61 6e 20 64 | of.expressions.that.`eval'.can.d |
| d4700 | 69 73 74 69 6e 67 75 69 73 68 2c 20 77 69 74 68 6f 75 74 20 6d 6f 64 69 66 79 69 6e 67 20 74 68 | istinguish,.without.modifying.th |
| d4720 | 65 0a 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 65 76 61 6c 27 20 69 74 73 65 6c 66 2e 20 20 | e.definition.of.`eval'.itself... |
| d4740 | 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 33 3a 3a 2e 29 0a 0a 41 70 70 | (See.*Note.Exercise.4-3::.)..App |
| d4760 | 6c 79 0a 2e 2e 2e 2e 2e 0a 0a 60 41 70 70 6c 79 27 20 74 61 6b 65 73 20 74 77 6f 20 61 72 67 75 | ly........`Apply'.takes.two.argu |
| d4780 | 6d 65 6e 74 73 2c 20 61 20 70 72 6f 63 65 64 75 72 65 20 61 6e 64 20 61 20 6c 69 73 74 20 6f 66 | ments,.a.procedure.and.a.list.of |
| d47a0 | 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 0a 77 68 69 63 68 20 74 68 65 20 70 72 6f 63 65 64 75 72 | .arguments.to.which.the.procedur |
| d47c0 | 65 20 73 68 6f 75 6c 64 20 62 65 20 61 70 70 6c 69 65 64 2e 20 20 60 41 70 70 6c 79 27 20 63 6c | e.should.be.applied...`Apply'.cl |
| d47e0 | 61 73 73 69 66 69 65 73 20 70 72 6f 63 65 64 75 72 65 73 0a 69 6e 74 6f 20 74 77 6f 20 6b 69 6e | assifies.procedures.into.two.kin |
| d4800 | 64 73 3a 20 49 74 20 63 61 6c 6c 73 20 60 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 | ds:.It.calls.`apply-primitive-pr |
| d4820 | 6f 63 65 64 75 72 65 27 20 74 6f 20 61 70 70 6c 79 0a 70 72 69 6d 69 74 69 76 65 73 3b 20 69 74 | ocedure'.to.apply.primitives;.it |
| d4840 | 20 61 70 70 6c 69 65 73 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 20 62 79 20 | .applies.compound.procedures.by. |
| d4860 | 73 65 71 75 65 6e 74 69 61 6c 6c 79 20 65 76 61 6c 75 61 74 69 6e 67 0a 74 68 65 20 65 78 70 72 | sequentially.evaluating.the.expr |
| d4880 | 65 73 73 69 6f 6e 73 20 74 68 61 74 20 6d 61 6b 65 20 75 70 20 74 68 65 20 62 6f 64 79 20 6f 66 | essions.that.make.up.the.body.of |
| d48a0 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 | .the.procedure...The.environment |
| d48c0 | 20 66 6f 72 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 6f 64 79 20 | .for.the.evaluation.of.the.body. |
| d48e0 | 6f 66 20 61 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 20 69 73 0a 63 6f 6e 73 74 | of.a.compound.procedure.is.const |
| d4900 | 72 75 63 74 65 64 20 62 79 20 65 78 74 65 6e 64 69 6e 67 20 74 68 65 20 62 61 73 65 20 65 6e 76 | ructed.by.extending.the.base.env |
| d4920 | 69 72 6f 6e 6d 65 6e 74 20 63 61 72 72 69 65 64 20 62 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 | ironment.carried.by.the.procedur |
| d4940 | 65 0a 74 6f 20 69 6e 63 6c 75 64 65 20 61 20 66 72 61 6d 65 20 74 68 61 74 20 62 69 6e 64 73 20 | e.to.include.a.frame.that.binds. |
| d4960 | 74 68 65 20 70 61 72 61 6d 65 74 65 72 73 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 | the.parameters.of.the.procedure. |
| d4980 | 74 6f 20 74 68 65 0a 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 77 68 69 63 68 20 74 68 65 20 70 72 | to.the.arguments.to.which.the.pr |
| d49a0 | 6f 63 65 64 75 72 65 20 69 73 20 74 6f 20 62 65 20 61 70 70 6c 69 65 64 2e 20 20 48 65 72 65 20 | ocedure.is.to.be.applied...Here. |
| d49c0 | 69 73 20 74 68 65 0a 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 61 70 70 6c 79 27 3a 0a 0a 20 | is.the.definition.of.`apply':... |
| d49e0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 70 6c 79 20 70 72 6f 63 65 64 75 72 65 20 61 72 67 | ....(define.(apply.procedure.arg |
| d4a00 | 75 6d 65 6e 74 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 70 72 69 6d 69 74 69 76 65 | uments)........(cond.((primitive |
| d4a20 | 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 | -procedure?.procedure).......... |
| d4a40 | 20 20 20 20 20 28 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 20 | .....(apply-primitive-procedure. |
| d4a60 | 70 72 6f 63 65 64 75 72 65 20 61 72 67 75 6d 65 6e 74 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 | procedure.arguments))........... |
| d4a80 | 20 20 20 28 28 63 6f 6d 70 6f 75 6e 64 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 65 64 75 | ...((compound-procedure?.procedu |
| d4aa0 | 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 | re)...............(eval-sequence |
| d4ac0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 64 75 72 65 2d 62 6f 64 79 | .................(procedure-body |
| d4ae0 | 20 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 74 | .procedure).................(ext |
| d4b00 | 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | end-environment................. |
| d4b20 | 20 20 28 70 72 6f 63 65 64 75 72 65 2d 70 61 72 61 6d 65 74 65 72 73 20 70 72 6f 63 65 64 75 72 | ..(procedure-parameters.procedur |
| d4b40 | 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 0a 20 | e)...................arguments.. |
| d4b60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 64 75 72 65 2d 65 6e 76 69 | .................(procedure-envi |
| d4b80 | 72 6f 6e 6d 65 6e 74 20 70 72 6f 63 65 64 75 72 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | ronment.procedure))))........... |
| d4ba0 | 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 0a 20 20 | ...(else...............(error... |
| d4bc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 22 55 6e 6b 6e 6f 77 6e 20 70 72 6f 63 65 64 75 72 65 20 | ............."Unknown.procedure. |
| d4be0 | 74 79 70 65 20 2d 2d 20 41 50 50 4c 59 22 20 70 72 6f 63 65 64 75 72 65 29 29 29 29 0a 0a 50 72 | type.--.APPLY".procedure))))..Pr |
| d4c00 | 6f 63 65 64 75 72 65 20 61 72 67 75 6d 65 6e 74 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ocedure.arguments............... |
| d4c20 | 2e 2e 2e 2e 2e 0a 0a 57 68 65 6e 20 60 65 76 61 6c 27 20 70 72 6f 63 65 73 73 65 73 20 61 20 70 | .......When.`eval'.processes.a.p |
| d4c40 | 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 69 74 20 75 73 65 73 20 60 6c | rocedure.application,.it.uses.`l |
| d4c60 | 69 73 74 2d 6f 66 2d 76 61 6c 75 65 73 27 0a 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 6c 69 | ist-of-values'.to.produce.the.li |
| d4c80 | 73 74 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 77 68 69 63 68 20 74 68 65 20 70 72 6f | st.of.arguments.to.which.the.pro |
| d4ca0 | 63 65 64 75 72 65 20 69 73 20 74 6f 20 62 65 0a 61 70 70 6c 69 65 64 2e 20 60 4c 69 73 74 2d 6f | cedure.is.to.be.applied..`List-o |
| d4cc0 | 66 2d 76 61 6c 75 65 73 27 20 74 61 6b 65 73 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 74 | f-values'.takes.as.an.argument.t |
| d4ce0 | 68 65 20 6f 70 65 72 61 6e 64 73 20 6f 66 20 74 68 65 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 2e 20 | he.operands.of.the.combination.. |
| d4d00 | 20 49 74 20 65 76 61 6c 75 61 74 65 73 20 65 61 63 68 20 6f 70 65 72 61 6e 64 20 61 6e 64 20 72 | .It.evaluates.each.operand.and.r |
| d4d20 | 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 0a 63 6f 72 72 65 73 70 6f 6e 64 69 | eturns.a.list.of.the.correspondi |
| d4d40 | 6e 67 20 76 61 6c 75 65 73 3a 28 31 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 69 73 | ng.values:(1).......(define.(lis |
| d4d60 | 74 2d 6f 66 2d 76 61 6c 75 65 73 20 65 78 70 73 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 69 66 | t-of-values.exps.env)........(if |
| d4d80 | 20 28 6e 6f 2d 6f 70 65 72 61 6e 64 73 3f 20 65 78 70 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(no-operands?.exps)............ |
| d4da0 | 27 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 65 76 61 6c 20 28 66 69 72 73 | '()............(cons.(eval.(firs |
| d4dc0 | 74 2d 6f 70 65 72 61 6e 64 20 65 78 70 73 29 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 | t-operand.exps).env)............ |
| d4de0 | 20 20 20 20 20 20 28 6c 69 73 74 2d 6f 66 2d 76 61 6c 75 65 73 20 28 72 65 73 74 2d 6f 70 65 72 | ......(list-of-values.(rest-oper |
| d4e00 | 61 6e 64 73 20 65 78 70 73 29 20 65 6e 76 29 29 29 29 0a 0a 43 6f 6e 64 69 74 69 6f 6e 61 6c 73 | ands.exps).env))))..Conditionals |
| d4e20 | 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 60 45 76 61 6c 2d 69 66 27 20 65 76 61 6c 75 61 74 | ...............`Eval-if'.evaluat |
| d4e40 | 65 73 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 70 61 72 74 20 6f 66 20 61 6e 20 60 69 66 27 | es.the.predicate.part.of.an.`if' |
| d4e60 | 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 0a 67 69 76 65 6e 20 65 6e 76 69 72 6f 6e | .expression.in.the.given.environ |
| d4e80 | 6d 65 6e 74 2e 20 20 49 66 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 20 74 72 75 65 2c 20 60 65 | ment...If.the.result.is.true,.`e |
| d4ea0 | 76 61 6c 2d 69 66 27 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 0a 63 6f 6e 73 65 71 75 65 6e 74 | val-if'.evaluates.the.consequent |
| d4ec0 | 2c 20 6f 74 68 65 72 77 69 73 65 20 69 74 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 61 6c 74 | ,.otherwise.it.evaluates.the.alt |
| d4ee0 | 65 72 6e 61 74 69 76 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 61 6c 2d 69 66 | ernative:.......(define.(eval-if |
| d4f00 | 20 65 78 70 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 74 72 75 65 3f 20 28 65 76 61 | .exp.env)........(if.(true?.(eva |
| d4f20 | 6c 20 28 69 66 2d 70 72 65 64 69 63 61 74 65 20 65 78 70 29 20 65 6e 76 29 29 0a 20 20 20 20 20 | l.(if-predicate.exp).env))...... |
| d4f40 | 20 20 20 20 20 20 28 65 76 61 6c 20 28 69 66 2d 63 6f 6e 73 65 71 75 65 6e 74 20 65 78 70 29 20 | ......(eval.(if-consequent.exp). |
| d4f60 | 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 65 76 61 6c 20 28 69 66 2d 61 6c 74 65 72 6e | env)............(eval.(if-altern |
| d4f80 | 61 74 69 76 65 20 65 78 70 29 20 65 6e 76 29 29 29 0a 0a 20 20 20 54 68 65 20 75 73 65 20 6f 66 | ative.exp).env))).....The.use.of |
| d4fa0 | 20 60 74 72 75 65 3f 27 20 69 6e 20 60 65 76 61 6c 2d 69 66 27 20 68 69 67 68 6c 69 67 68 74 73 | .`true?'.in.`eval-if'.highlights |
| d4fc0 | 20 74 68 65 20 69 73 73 75 65 20 6f 66 20 74 68 65 0a 63 6f 6e 6e 65 63 74 69 6f 6e 20 62 65 74 | .the.issue.of.the.connection.bet |
| d4fe0 | 77 65 65 6e 20 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 6c 61 6e 67 75 61 67 65 20 61 6e 64 | ween.an.implemented.language.and |
| d5000 | 20 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 0a 6c 61 6e 67 75 61 67 65 2e 20 20 54 68 | .an.implementation.language...Th |
| d5020 | 65 20 60 69 66 2d 70 72 65 64 69 63 61 74 65 27 20 69 73 20 65 76 61 6c 75 61 74 65 64 20 69 6e | e.`if-predicate'.is.evaluated.in |
| d5040 | 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 62 65 69 6e 67 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 | .the.language.being.implemented. |
| d5060 | 61 6e 64 20 74 68 75 73 20 79 69 65 6c 64 73 20 61 20 76 61 6c 75 65 20 69 6e 20 74 68 61 74 20 | and.thus.yields.a.value.in.that. |
| d5080 | 6c 61 6e 67 75 61 67 65 2e 20 20 54 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 0a 70 72 65 64 69 | language...The.interpreter.predi |
| d50a0 | 63 61 74 65 20 60 74 72 75 65 3f 27 20 74 72 61 6e 73 6c 61 74 65 73 20 74 68 61 74 20 76 61 6c | cate.`true?'.translates.that.val |
| d50c0 | 75 65 20 69 6e 74 6f 20 61 20 76 61 6c 75 65 20 74 68 61 74 20 63 61 6e 20 62 65 20 74 65 73 74 | ue.into.a.value.that.can.be.test |
| d50e0 | 65 64 0a 62 79 20 74 68 65 20 60 69 66 27 20 69 6e 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 | ed.by.the.`if'.in.the.implementa |
| d5100 | 74 69 6f 6e 20 6c 61 6e 67 75 61 67 65 3a 20 54 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 0a | tion.language:.The.metacircular. |
| d5120 | 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 72 75 74 68 20 6d 69 67 68 74 20 6e 6f | representation.of.truth.might.no |
| d5140 | 74 20 62 65 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 61 74 20 6f 66 20 74 68 65 20 75 6e 64 | t.be.the.same.as.that.of.the.und |
| d5160 | 65 72 6c 79 69 6e 67 0a 53 63 68 65 6d 65 2e 28 32 29 0a 0a 53 65 71 75 65 6e 63 65 73 0a 2e 2e | erlying.Scheme.(2)..Sequences... |
| d5180 | 2e 2e 2e 2e 2e 2e 2e 0a 0a 60 45 76 61 6c 2d 73 65 71 75 65 6e 63 65 27 20 69 73 20 75 73 65 64 | .........`Eval-sequence'.is.used |
| d51a0 | 20 62 79 20 60 61 70 70 6c 79 27 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 73 65 71 75 | .by.`apply'.to.evaluate.the.sequ |
| d51c0 | 65 6e 63 65 20 6f 66 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 61 20 70 72 6f 63 65 64 75 | ence.of.expressions.in.a.procedu |
| d51e0 | 72 65 20 62 6f 64 79 20 61 6e 64 20 62 79 20 60 65 76 61 6c 27 20 74 6f 20 65 76 61 6c 75 61 74 | re.body.and.by.`eval'.to.evaluat |
| d5200 | 65 20 74 68 65 20 73 65 71 75 65 6e 63 65 0a 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e | e.the.sequence.of.expressions.in |
| d5220 | 20 61 20 60 62 65 67 69 6e 27 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 49 74 20 74 61 6b 65 73 | .a.`begin'.expression...It.takes |
| d5240 | 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 0a 73 65 71 75 65 6e 63 65 20 6f 66 20 65 78 70 72 | .as.arguments.a.sequence.of.expr |
| d5260 | 65 73 73 69 6f 6e 73 20 61 6e 64 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 61 6e 64 20 | essions.and.an.environment,.and. |
| d5280 | 65 76 61 6c 75 61 74 65 73 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 68 65 | evaluates.the.expressions.in.the |
| d52a0 | 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 79 20 6f 63 63 75 72 2e 20 20 54 68 65 | .order.in.which.they.occur...The |
| d52c0 | 20 76 61 6c 75 65 20 72 65 74 75 72 6e 65 64 20 69 73 0a 74 68 65 20 76 61 6c 75 65 20 6f 66 20 | .value.returned.is.the.value.of. |
| d52e0 | 74 68 65 20 66 69 6e 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 0a 20 20 20 20 20 28 64 65 66 | the.final.expression........(def |
| d5300 | 69 6e 65 20 28 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 20 65 78 70 73 20 65 6e 76 29 0a 20 20 20 | ine.(eval-sequence.exps.env).... |
| d5320 | 20 20 20 20 28 63 6f 6e 64 20 28 28 6c 61 73 74 2d 65 78 70 3f 20 65 78 70 73 29 20 28 65 76 61 | ....(cond.((last-exp?.exps).(eva |
| d5340 | 6c 20 28 66 69 72 73 74 2d 65 78 70 20 65 78 70 73 29 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 | l.(first-exp.exps).env))........ |
| d5360 | 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 76 61 6c 20 28 66 69 72 73 74 2d 65 78 70 20 65 78 70 | ......(else.(eval.(first-exp.exp |
| d5380 | 73 29 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 76 61 6c | s).env)....................(eval |
| d53a0 | 2d 73 65 71 75 65 6e 63 65 20 28 72 65 73 74 2d 65 78 70 73 20 65 78 70 73 29 20 65 6e 76 29 29 | -sequence.(rest-exps.exps).env)) |
| d53c0 | 29 29 0a 0a 41 73 73 69 67 6e 6d 65 6e 74 73 20 61 6e 64 20 64 65 66 69 6e 69 74 69 6f 6e 73 0a | ))..Assignments.and.definitions. |
| d53e0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 | .............................The |
| d5400 | 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 68 61 6e 64 6c 65 73 20 61 73 73 | .following.procedure.handles.ass |
| d5420 | 69 67 6e 6d 65 6e 74 73 20 74 6f 20 76 61 72 69 61 62 6c 65 73 2e 20 20 49 74 20 63 61 6c 6c 73 | ignments.to.variables...It.calls |
| d5440 | 0a 60 65 76 61 6c 27 20 74 6f 20 66 69 6e 64 20 74 68 65 20 76 61 6c 75 65 20 74 6f 20 62 65 20 | .`eval'.to.find.the.value.to.be. |
| d5460 | 61 73 73 69 67 6e 65 64 20 61 6e 64 20 74 72 61 6e 73 6d 69 74 73 20 74 68 65 20 76 61 72 69 61 | assigned.and.transmits.the.varia |
| d5480 | 62 6c 65 20 61 6e 64 0a 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 76 61 6c 75 65 20 74 6f 20 60 | ble.and.the.resulting.value.to.` |
| d54a0 | 73 65 74 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 21 27 20 74 6f 20 62 65 20 69 6e 73 74 61 | set-variable-value!'.to.be.insta |
| d54c0 | 6c 6c 65 64 20 69 6e 20 74 68 65 0a 64 65 73 69 67 6e 61 74 65 64 20 65 6e 76 69 72 6f 6e 6d 65 | lled.in.the.designated.environme |
| d54e0 | 6e 74 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 61 6c 2d 61 73 73 69 67 6e 6d 65 | nt........(define.(eval-assignme |
| d5500 | 6e 74 20 65 78 70 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 73 65 74 2d 76 61 72 69 61 62 6c 65 | nt.exp.env)........(set-variable |
| d5520 | 2d 76 61 6c 75 65 21 20 28 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 72 69 61 62 6c 65 20 65 78 70 | -value!.(assignment-variable.exp |
| d5540 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 | ).............................(e |
| d5560 | 76 61 6c 20 28 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 6c 75 65 20 65 78 70 29 20 65 6e 76 29 0a | val.(assignment-value.exp).env). |
| d5580 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 6e 76 29 | ............................env) |
| d55a0 | 0a 20 20 20 20 20 20 20 27 6f 6b 29 0a 0a 44 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 76 61 72 | ........'ok)..Definitions.of.var |
| d55c0 | 69 61 62 6c 65 73 20 61 72 65 20 68 61 6e 64 6c 65 64 20 69 6e 20 61 20 73 69 6d 69 6c 61 72 20 | iables.are.handled.in.a.similar. |
| d55e0 | 6d 61 6e 6e 65 72 2e 28 33 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 61 6c 2d 64 | manner.(3).......(define.(eval-d |
| d5600 | 65 66 69 6e 69 74 69 6f 6e 20 65 78 70 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e | efinition.exp.env)........(defin |
| d5620 | 65 2d 76 61 72 69 61 62 6c 65 21 20 28 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 72 69 61 62 6c 65 | e-variable!.(definition-variable |
| d5640 | 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .exp)..........................( |
| d5660 | 65 76 61 6c 20 28 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 6c 75 65 20 65 78 70 29 20 65 6e 76 29 | eval.(definition-value.exp).env) |
| d5680 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 6e 76 29 0a 20 | ..........................env).. |
| d56a0 | 20 20 20 20 20 20 27 6f 6b 29 0a 0a 20 20 20 57 65 20 68 61 76 65 20 63 68 6f 73 65 6e 20 68 65 | ......'ok).....We.have.chosen.he |
| d56c0 | 72 65 20 74 6f 20 72 65 74 75 72 6e 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 6f 6b 27 20 61 73 20 | re.to.return.the.symbol.`ok'.as. |
| d56e0 | 74 68 65 20 76 61 6c 75 65 20 6f 66 20 61 6e 0a 61 73 73 69 67 6e 6d 65 6e 74 20 6f 72 20 61 20 | the.value.of.an.assignment.or.a. |
| d5700 | 64 65 66 69 6e 69 74 69 6f 6e 2e 28 34 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 | definition.(4).......*Exercise.4 |
| d5720 | 2e 31 3a 2a 20 4e 6f 74 69 63 65 20 74 68 61 74 20 77 65 20 63 61 6e 6e 6f 74 20 74 65 6c 6c 20 | .1:*.Notice.that.we.cannot.tell. |
| d5740 | 77 68 65 74 68 65 72 20 74 68 65 0a 20 20 20 20 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 | whether.the......metacircular.ev |
| d5760 | 61 6c 75 61 74 6f 72 20 65 76 61 6c 75 61 74 65 73 20 6f 70 65 72 61 6e 64 73 20 66 72 6f 6d 20 | aluator.evaluates.operands.from. |
| d5780 | 6c 65 66 74 20 74 6f 20 72 69 67 68 74 20 6f 72 0a 20 20 20 20 20 66 72 6f 6d 20 72 69 67 68 74 | left.to.right.or......from.right |
| d57a0 | 20 74 6f 20 6c 65 66 74 2e 20 20 49 74 73 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 72 64 65 72 20 | .to.left...Its.evaluation.order. |
| d57c0 | 69 73 20 69 6e 68 65 72 69 74 65 64 20 66 72 6f 6d 20 74 68 65 0a 20 20 20 20 20 75 6e 64 65 72 | is.inherited.from.the......under |
| d57e0 | 6c 79 69 6e 67 20 4c 69 73 70 3a 20 49 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 | lying.Lisp:.If.the.arguments.to. |
| d5800 | 60 63 6f 6e 73 27 20 69 6e 20 60 6c 69 73 74 2d 6f 66 2d 76 61 6c 75 65 73 27 0a 20 20 20 20 20 | `cons'.in.`list-of-values'...... |
| d5820 | 61 72 65 20 65 76 61 6c 75 61 74 65 64 20 66 72 6f 6d 20 6c 65 66 74 20 74 6f 20 72 69 67 68 74 | are.evaluated.from.left.to.right |
| d5840 | 2c 20 74 68 65 6e 20 60 6c 69 73 74 2d 6f 66 2d 76 61 6c 75 65 73 27 20 77 69 6c 6c 0a 20 20 20 | ,.then.`list-of-values'.will.... |
| d5860 | 20 20 65 76 61 6c 75 61 74 65 20 6f 70 65 72 61 6e 64 73 20 66 72 6f 6d 20 6c 65 66 74 20 74 6f | ..evaluate.operands.from.left.to |
| d5880 | 20 72 69 67 68 74 3b 20 61 6e 64 20 69 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 0a | .right;.and.if.the.arguments.to. |
| d58a0 | 20 20 20 20 20 60 63 6f 6e 73 27 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 20 66 72 6f 6d 20 72 | .....`cons'.are.evaluated.from.r |
| d58c0 | 69 67 68 74 20 74 6f 20 6c 65 66 74 2c 20 74 68 65 6e 20 60 6c 69 73 74 2d 6f 66 2d 76 61 6c 75 | ight.to.left,.then.`list-of-valu |
| d58e0 | 65 73 27 0a 20 20 20 20 20 77 69 6c 6c 20 65 76 61 6c 75 61 74 65 20 6f 70 65 72 61 6e 64 73 20 | es'......will.evaluate.operands. |
| d5900 | 66 72 6f 6d 20 72 69 67 68 74 20 74 6f 20 6c 65 66 74 2e 0a 0a 20 20 20 20 20 57 72 69 74 65 20 | from.right.to.left........Write. |
| d5920 | 61 20 76 65 72 73 69 6f 6e 20 6f 66 20 60 6c 69 73 74 2d 6f 66 2d 76 61 6c 75 65 73 27 20 74 68 | a.version.of.`list-of-values'.th |
| d5940 | 61 74 20 65 76 61 6c 75 61 74 65 73 20 6f 70 65 72 61 6e 64 73 20 66 72 6f 6d 0a 20 20 20 20 20 | at.evaluates.operands.from...... |
| d5960 | 6c 65 66 74 20 74 6f 20 72 69 67 68 74 20 72 65 67 61 72 64 6c 65 73 73 20 6f 66 20 74 68 65 20 | left.to.right.regardless.of.the. |
| d5980 | 6f 72 64 65 72 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 6e 20 74 68 65 0a 20 20 20 20 20 | order.of.evaluation.in.the...... |
| d59a0 | 75 6e 64 65 72 6c 79 69 6e 67 20 4c 69 73 70 2e 20 20 41 6c 73 6f 20 77 72 69 74 65 20 61 20 76 | underlying.Lisp...Also.write.a.v |
| d59c0 | 65 72 73 69 6f 6e 20 6f 66 20 60 6c 69 73 74 2d 6f 66 2d 76 61 6c 75 65 73 27 20 74 68 61 74 0a | ersion.of.`list-of-values'.that. |
| d59e0 | 20 20 20 20 20 65 76 61 6c 75 61 74 65 73 20 6f 70 65 72 61 6e 64 73 20 66 72 6f 6d 20 72 69 67 | .....evaluates.operands.from.rig |
| d5a00 | 68 74 20 74 6f 20 6c 65 66 74 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e | ht.to.left......----------.Footn |
| d5a20 | 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 57 65 20 63 6f 75 6c 64 | otes.----------.....(1).We.could |
| d5a40 | 20 68 61 76 65 20 73 69 6d 70 6c 69 66 69 65 64 20 74 68 65 20 60 61 70 70 6c 69 63 61 74 69 6f | .have.simplified.the.`applicatio |
| d5a60 | 6e 3f 27 20 63 6c 61 75 73 65 20 69 6e 20 60 65 76 61 6c 27 20 62 79 0a 75 73 69 6e 67 20 60 6d | n?'.clause.in.`eval'.by.using.`m |
| d5a80 | 61 70 27 20 28 61 6e 64 20 73 74 69 70 75 6c 61 74 69 6e 67 20 74 68 61 74 20 60 6f 70 65 72 61 | ap'.(and.stipulating.that.`opera |
| d5aa0 | 6e 64 73 27 20 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74 29 20 72 61 74 68 65 72 0a 74 68 61 6e | nds'.returns.a.list).rather.than |
| d5ac0 | 20 77 72 69 74 69 6e 67 20 61 6e 20 65 78 70 6c 69 63 69 74 20 60 6c 69 73 74 2d 6f 66 2d 76 61 | .writing.an.explicit.`list-of-va |
| d5ae0 | 6c 75 65 73 27 20 70 72 6f 63 65 64 75 72 65 2e 20 20 57 65 20 63 68 6f 73 65 20 6e 6f 74 20 74 | lues'.procedure...We.chose.not.t |
| d5b00 | 6f 0a 75 73 65 20 60 6d 61 70 27 20 68 65 72 65 20 74 6f 20 65 6d 70 68 61 73 69 7a 65 20 74 68 | o.use.`map'.here.to.emphasize.th |
| d5b20 | 65 20 66 61 63 74 20 74 68 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 63 61 6e 20 62 65 | e.fact.that.the.evaluator.can.be |
| d5b40 | 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 77 69 74 68 6f 75 74 20 61 6e 79 20 75 73 65 20 6f 66 20 | .implemented.without.any.use.of. |
| d5b60 | 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 73 20 28 61 6e 64 20 74 68 75 | higher-order.procedures.(and.thu |
| d5b80 | 73 20 63 6f 75 6c 64 0a 62 65 20 77 72 69 74 74 65 6e 20 69 6e 20 61 20 6c 61 6e 67 75 61 67 65 | s.could.be.written.in.a.language |
| d5ba0 | 20 74 68 61 74 20 64 6f 65 73 6e 27 74 20 68 61 76 65 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 | .that.doesn't.have.higher-order. |
| d5bc0 | 70 72 6f 63 65 64 75 72 65 73 29 2c 0a 65 76 65 6e 20 74 68 6f 75 67 68 20 74 68 65 20 6c 61 6e | procedures),.even.though.the.lan |
| d5be0 | 67 75 61 67 65 20 74 68 61 74 20 69 74 20 73 75 70 70 6f 72 74 73 20 77 69 6c 6c 20 69 6e 63 6c | guage.that.it.supports.will.incl |
| d5c00 | 75 64 65 20 68 69 67 68 65 72 2d 6f 72 64 65 72 0a 70 72 6f 63 65 64 75 72 65 73 2e 0a 0a 20 20 | ude.higher-order.procedures..... |
| d5c20 | 20 28 32 29 20 49 6e 20 74 68 69 73 20 63 61 73 65 2c 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 | .(2).In.this.case,.the.language. |
| d5c40 | 62 65 69 6e 67 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 6e 64 20 74 68 65 0a 69 6d 70 6c 65 6d | being.implemented.and.the.implem |
| d5c60 | 65 6e 74 61 74 69 6f 6e 20 6c 61 6e 67 75 61 67 65 20 61 72 65 20 74 68 65 20 73 61 6d 65 2e 20 | entation.language.are.the.same.. |
| d5c80 | 20 43 6f 6e 74 65 6d 70 6c 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6d 65 61 6e 69 6e 67 20 6f 66 | .Contemplation.of.the.meaning.of |
| d5ca0 | 0a 60 74 72 75 65 3f 27 20 68 65 72 65 20 79 69 65 6c 64 73 20 65 78 70 61 6e 73 69 6f 6e 20 6f | .`true?'.here.yields.expansion.o |
| d5cc0 | 66 20 63 6f 6e 73 63 69 6f 75 73 6e 65 73 73 20 77 69 74 68 6f 75 74 20 74 68 65 20 61 62 75 73 | f.consciousness.without.the.abus |
| d5ce0 | 65 20 6f 66 0a 73 75 62 73 74 61 6e 63 65 2e 0a 0a 20 20 20 28 33 29 20 54 68 69 73 20 69 6d 70 | e.of.substance......(3).This.imp |
| d5d00 | 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 60 64 65 66 69 6e 65 27 20 69 67 6e 6f 72 65 73 20 | lementation.of.`define'.ignores. |
| d5d20 | 61 20 73 75 62 74 6c 65 20 69 73 73 75 65 20 69 6e 20 74 68 65 0a 68 61 6e 64 6c 69 6e 67 20 6f | a.subtle.issue.in.the.handling.o |
| d5d40 | 66 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 61 6c 74 68 6f 75 67 68 | f.internal.definitions,.although |
| d5d60 | 20 69 74 20 77 6f 72 6b 73 20 63 6f 72 72 65 63 74 6c 79 20 69 6e 20 6d 6f 73 74 0a 63 61 73 65 | .it.works.correctly.in.most.case |
| d5d80 | 73 2e 20 20 57 65 20 77 69 6c 6c 20 73 65 65 20 77 68 61 74 20 74 68 65 20 70 72 6f 62 6c 65 6d | s...We.will.see.what.the.problem |
| d5da0 | 20 69 73 20 61 6e 64 20 68 6f 77 20 74 6f 20 73 6f 6c 76 65 20 69 74 20 69 6e 20 73 65 63 74 69 | .is.and.how.to.solve.it.in.secti |
| d5dc0 | 6f 6e 0a 2a 4e 6f 74 65 20 34 2d 31 2d 36 3a 3a 2e 0a 0a 20 20 20 28 34 29 20 41 73 20 77 65 20 | on.*Note.4-1-6::......(4).As.we. |
| d5de0 | 73 61 69 64 20 77 68 65 6e 20 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 60 64 65 66 69 6e 65 27 | said.when.we.introduced.`define' |
| d5e00 | 20 61 6e 64 20 60 73 65 74 21 27 2c 20 74 68 65 73 65 20 76 61 6c 75 65 73 0a 61 72 65 20 69 6d | .and.`set!',.these.values.are.im |
| d5e20 | 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2d 64 65 70 65 6e 64 65 6e 74 20 69 6e 20 53 63 68 65 6d 65 | plementation-dependent.in.Scheme |
| d5e40 | 2d 2d 74 68 61 74 20 69 73 2c 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 6f 72 20 63 61 6e 0a 63 | --that.is,.the.implementor.can.c |
| d5e60 | 68 6f 6f 73 65 20 77 68 61 74 20 76 61 6c 75 65 20 74 6f 20 72 65 74 75 72 6e 2e 0a 0a 1f 0a 46 | hoose.what.value.to.return.....F |
| d5e80 | 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 31 2d 32 2c 20 20 4e | ile:.sicp.info,..Node:.4-1-2,..N |
| d5ea0 | 65 78 74 3a 20 34 2d 31 2d 33 2c 20 20 50 72 65 76 3a 20 34 2d 31 2d 31 2c 20 20 55 70 3a 20 34 | ext:.4-1-3,..Prev:.4-1-1,..Up:.4 |
| d5ec0 | 2d 31 0a 0a 34 2e 31 2e 32 20 52 65 70 72 65 73 65 6e 74 69 6e 67 20 45 78 70 72 65 73 73 69 6f | -1..4.1.2.Representing.Expressio |
| d5ee0 | 6e 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ns.----------------------------- |
| d5f00 | 2d 0a 0a 54 68 65 20 65 76 61 6c 75 61 74 6f 72 20 69 73 20 72 65 6d 69 6e 69 73 63 65 6e 74 20 | -..The.evaluator.is.reminiscent. |
| d5f20 | 6f 66 20 74 68 65 20 73 79 6d 62 6f 6c 69 63 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 | of.the.symbolic.differentiation. |
| d5f40 | 70 72 6f 67 72 61 6d 0a 64 69 73 63 75 73 73 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f | program.discussed.in.section.*No |
| d5f60 | 74 65 20 32 2d 33 2d 32 3a 3a 2e 20 20 42 6f 74 68 20 70 72 6f 67 72 61 6d 73 20 6f 70 65 72 61 | te.2-3-2::...Both.programs.opera |
| d5f80 | 74 65 20 6f 6e 20 73 79 6d 62 6f 6c 69 63 0a 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 49 6e 20 | te.on.symbolic.expressions...In. |
| d5fa0 | 62 6f 74 68 20 70 72 6f 67 72 61 6d 73 2c 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 6f 70 65 | both.programs,.the.result.of.ope |
| d5fc0 | 72 61 74 69 6e 67 20 6f 6e 20 61 20 63 6f 6d 70 6f 75 6e 64 0a 65 78 70 72 65 73 73 69 6f 6e 20 | rating.on.a.compound.expression. |
| d5fe0 | 69 73 20 64 65 74 65 72 6d 69 6e 65 64 20 62 79 20 6f 70 65 72 61 74 69 6e 67 20 72 65 63 75 72 | is.determined.by.operating.recur |
| d6000 | 73 69 76 65 6c 79 20 6f 6e 20 74 68 65 20 70 69 65 63 65 73 20 6f 66 20 74 68 65 0a 65 78 70 72 | sively.on.the.pieces.of.the.expr |
| d6020 | 65 73 73 69 6f 6e 20 61 6e 64 20 63 6f 6d 62 69 6e 69 6e 67 20 74 68 65 20 72 65 73 75 6c 74 73 | ession.and.combining.the.results |
| d6040 | 20 69 6e 20 61 20 77 61 79 20 74 68 61 74 20 64 65 70 65 6e 64 73 20 6f 6e 20 74 68 65 20 74 79 | .in.a.way.that.depends.on.the.ty |
| d6060 | 70 65 0a 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 49 6e 20 62 6f 74 68 20 70 | pe.of.the.expression...In.both.p |
| d6080 | 72 6f 67 72 61 6d 73 20 77 65 20 75 73 65 64 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e | rograms.we.used.data.abstraction |
| d60a0 | 20 74 6f 0a 64 65 63 6f 75 70 6c 65 20 74 68 65 20 67 65 6e 65 72 61 6c 20 72 75 6c 65 73 20 6f | .to.decouple.the.general.rules.o |
| d60c0 | 66 20 6f 70 65 72 61 74 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 | f.operation.from.the.details.of. |
| d60e0 | 68 6f 77 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 2e | how.expressions.are.represented. |
| d6100 | 20 20 49 6e 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 70 72 6f 67 72 61 6d | ..In.the.differentiation.program |
| d6120 | 20 74 68 69 73 20 6d 65 61 6e 74 0a 74 68 61 74 20 74 68 65 20 73 61 6d 65 20 64 69 66 66 65 72 | .this.meant.that.the.same.differ |
| d6140 | 65 6e 74 69 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 63 6f 75 6c 64 20 64 65 61 6c 20 77 | entiation.procedure.could.deal.w |
| d6160 | 69 74 68 20 61 6c 67 65 62 72 61 69 63 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 70 72 65 | ith.algebraic.expressions.in.pre |
| d6180 | 66 69 78 20 66 6f 72 6d 2c 20 69 6e 20 69 6e 66 69 78 20 66 6f 72 6d 2c 20 6f 72 20 69 6e 20 73 | fix.form,.in.infix.form,.or.in.s |
| d61a0 | 6f 6d 65 20 6f 74 68 65 72 20 66 6f 72 6d 2e 20 20 46 6f 72 0a 74 68 65 20 65 76 61 6c 75 61 74 | ome.other.form...For.the.evaluat |
| d61c0 | 6f 72 2c 20 74 68 69 73 20 6d 65 61 6e 73 20 74 68 61 74 20 74 68 65 20 73 79 6e 74 61 78 20 6f | or,.this.means.that.the.syntax.o |
| d61e0 | 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 62 65 69 6e 67 0a 65 76 61 6c 75 61 74 65 64 20 69 | f.the.language.being.evaluated.i |
| d6200 | 73 20 64 65 74 65 72 6d 69 6e 65 64 20 73 6f 6c 65 6c 79 20 62 79 20 74 68 65 20 70 72 6f 63 65 | s.determined.solely.by.the.proce |
| d6220 | 64 75 72 65 73 20 74 68 61 74 20 63 6c 61 73 73 69 66 79 20 61 6e 64 0a 65 78 74 72 61 63 74 20 | dures.that.classify.and.extract. |
| d6240 | 70 69 65 63 65 73 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 0a 0a 20 20 20 48 65 72 65 20 | pieces.of.expressions......Here. |
| d6260 | 69 73 20 74 68 65 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 79 6e 74 | is.the.specification.of.the.synt |
| d6280 | 61 78 20 6f 66 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 3a 0a 0a 20 20 20 2a 20 54 68 65 20 6f 6e | ax.of.our.language:.....*.The.on |
| d62a0 | 6c 79 20 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 20 69 74 65 6d 73 20 61 72 65 20 6e 75 6d | ly.self-evaluating.items.are.num |
| d62c0 | 62 65 72 73 20 61 6e 64 20 73 74 72 69 6e 67 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | bers.and.strings:............(de |
| d62e0 | 66 69 6e 65 20 28 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 3f 20 65 78 70 29 0a 20 20 20 20 | fine.(self-evaluating?.exp)..... |
| d6300 | 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6d 62 65 72 3f 20 65 78 70 29 20 74 72 75 | ........(cond.((number?.exp).tru |
| d6320 | 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 73 74 72 69 6e 67 3f 20 65 | e)...................((string?.e |
| d6340 | 78 70 29 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 | xp).true)...................(els |
| d6360 | 65 20 66 61 6c 73 65 29 29 29 0a 0a 20 20 20 2a 20 56 61 72 69 61 62 6c 65 73 20 61 72 65 20 72 | e.false))).....*.Variables.are.r |
| d6380 | 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 73 79 6d 62 6f 6c 73 3a 0a 0a 20 20 20 20 20 20 20 20 | epresented.by.symbols:.......... |
| d63a0 | 20 20 28 64 65 66 69 6e 65 20 28 76 61 72 69 61 62 6c 65 3f 20 65 78 70 29 20 28 73 79 6d 62 6f | ..(define.(variable?.exp).(symbo |
| d63c0 | 6c 3f 20 65 78 70 29 29 0a 0a 20 20 20 2a 20 51 75 6f 74 61 74 69 6f 6e 73 20 68 61 76 65 20 74 | l?.exp)).....*.Quotations.have.t |
| d63e0 | 68 65 20 66 6f 72 6d 20 60 28 71 75 6f 74 65 20 3c 54 45 58 54 2d 4f 46 2d 51 55 4f 54 41 54 49 | he.form.`(quote.<TEXT-OF-QUOTATI |
| d6400 | 4f 4e 3e 29 27 3a 28 31 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 71 75 | ON>)':(1)............(define.(qu |
| d6420 | 6f 74 65 64 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 74 61 67 67 65 64 2d 6c | oted?.exp).............(tagged-l |
| d6440 | 69 73 74 3f 20 65 78 70 20 27 71 75 6f 74 65 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | ist?.exp.'quote))............(de |
| d6460 | 66 69 6e 65 20 28 74 65 78 74 2d 6f 66 2d 71 75 6f 74 61 74 69 6f 6e 20 65 78 70 29 20 28 63 61 | fine.(text-of-quotation.exp).(ca |
| d6480 | 64 72 20 65 78 70 29 29 0a 0a 20 20 20 20 20 60 51 75 6f 74 65 64 3f 27 20 69 73 20 64 65 66 69 | dr.exp)).......`Quoted?'.is.defi |
| d64a0 | 6e 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 74 | ned.in.terms.of.the.procedure.`t |
| d64c0 | 61 67 67 65 64 2d 6c 69 73 74 3f 27 2c 0a 20 20 20 20 20 77 68 69 63 68 20 69 64 65 6e 74 69 66 | agged-list?',......which.identif |
| d64e0 | 69 65 73 20 6c 69 73 74 73 20 62 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 61 20 64 65 73 69 67 | ies.lists.beginning.with.a.desig |
| d6500 | 6e 61 74 65 64 20 73 79 6d 62 6f 6c 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | nated.symbol:............(define |
| d6520 | 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 65 78 70 20 74 61 67 29 0a 20 20 20 20 20 20 20 20 | .(tagged-list?.exp.tag)......... |
| d6540 | 20 20 20 20 28 69 66 20 28 70 61 69 72 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ....(if.(pair?.exp)............. |
| d6560 | 20 20 20 20 28 65 71 3f 20 28 63 61 72 20 65 78 70 29 20 74 61 67 29 0a 20 20 20 20 20 20 20 20 | ....(eq?.(car.exp).tag)......... |
| d6580 | 20 20 20 20 20 20 20 20 66 61 6c 73 65 29 29 0a 0a 20 20 20 2a 20 41 73 73 69 67 6e 6d 65 6e 74 | ........false)).....*.Assignment |
| d65a0 | 73 20 68 61 76 65 20 74 68 65 20 66 6f 72 6d 20 60 28 73 65 74 21 20 3c 56 41 52 3e 20 3c 56 41 | s.have.the.form.`(set!.<VAR>.<VA |
| d65c0 | 4c 55 45 3e 29 27 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 73 73 69 | LUE>)':............(define.(assi |
| d65e0 | 67 6e 6d 65 6e 74 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 74 61 67 67 65 64 | gnment?.exp).............(tagged |
| d6600 | 2d 6c 69 73 74 3f 20 65 78 70 20 27 73 65 74 21 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | -list?.exp.'set!))............(d |
| d6620 | 65 66 69 6e 65 20 28 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 72 69 61 62 6c 65 20 65 78 70 29 20 | efine.(assignment-variable.exp). |
| d6640 | 28 63 61 64 72 20 65 78 70 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | (cadr.exp))............(define.( |
| d6660 | 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 6c 75 65 20 65 78 70 29 20 28 63 61 64 64 72 20 65 78 70 | assignment-value.exp).(caddr.exp |
| d6680 | 29 29 0a 0a 20 20 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 68 61 76 65 20 74 68 65 20 66 6f | )).....*.Definitions.have.the.fo |
| d66a0 | 72 6d 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 3c 56 41 52 3e 20 3c 56 41 4c | rm............(define.<VAR>.<VAL |
| d66c0 | 55 45 3e 29 0a 0a 20 20 20 20 20 6f 72 20 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 20 20 20 | UE>).......or.the.form.......... |
| d66e0 | 20 20 28 64 65 66 69 6e 65 20 28 3c 56 41 52 3e 20 3c 50 41 52 41 4d 45 54 45 52 5f 31 3e 20 2e | ..(define.(<VAR>.<PARAMETER_1>.. |
| d6700 | 2e 2e 20 3c 50 41 52 41 4d 45 54 45 52 5f 4e 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 42 | ...<PARAMETER_N>).............<B |
| d6720 | 4f 44 59 3e 29 0a 0a 20 20 20 20 20 54 68 65 20 6c 61 74 74 65 72 20 66 6f 72 6d 20 28 73 74 61 | ODY>).......The.latter.form.(sta |
| d6740 | 6e 64 61 72 64 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 29 20 69 73 20 73 | ndard.procedure.definition).is.s |
| d6760 | 79 6e 74 61 63 74 69 63 20 73 75 67 61 72 0a 20 20 20 20 20 66 6f 72 0a 0a 20 20 20 20 20 20 20 | yntactic.sugar......for......... |
| d6780 | 20 20 20 28 64 65 66 69 6e 65 20 3c 56 41 52 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 | ...(define.<VAR>.............(la |
| d67a0 | 6d 62 64 61 20 28 3c 50 41 52 41 4d 45 54 45 52 5f 31 3e 20 2e 2e 2e 20 3c 50 41 52 41 4d 45 54 | mbda.(<PARAMETER_1>.....<PARAMET |
| d67c0 | 45 52 5f 4e 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 42 4f 44 59 3e 29 29 0a 0a 20 | ER_N>)...............<BODY>))... |
| d67e0 | 20 20 20 20 54 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 73 79 6e 74 61 78 20 70 72 6f | ....The.corresponding.syntax.pro |
| d6800 | 63 65 64 75 72 65 73 20 61 72 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 0a 20 20 20 20 | cedures.are.the.following:...... |
| d6820 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 66 69 6e 69 74 69 6f 6e 3f 20 65 78 70 29 0a | ......(define.(definition?.exp). |
| d6840 | 20 20 20 20 20 20 20 20 20 20 20 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 65 78 70 20 27 64 | ............(tagged-list?.exp.'d |
| d6860 | 65 66 69 6e 65 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 66 69 | efine))............(define.(defi |
| d6880 | 6e 69 74 69 6f 6e 2d 76 61 72 69 61 62 6c 65 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 | nition-variable.exp)............ |
| d68a0 | 20 28 69 66 20 28 73 79 6d 62 6f 6c 3f 20 28 63 61 64 72 20 65 78 70 29 29 0a 20 20 20 20 20 20 | .(if.(symbol?.(cadr.exp))....... |
| d68c0 | 20 20 20 20 20 20 20 20 20 20 28 63 61 64 72 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ..........(cadr.exp)............ |
| d68e0 | 20 20 20 20 20 28 63 61 61 64 72 20 65 78 70 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | .....(caadr.exp)))............(d |
| d6900 | 65 66 69 6e 65 20 28 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 6c 75 65 20 65 78 70 29 0a 20 20 20 | efine.(definition-value.exp).... |
| d6920 | 20 20 20 20 20 20 20 20 20 28 69 66 20 28 73 79 6d 62 6f 6c 3f 20 28 63 61 64 72 20 65 78 70 29 | .........(if.(symbol?.(cadr.exp) |
| d6940 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 61 64 64 72 20 65 78 70 29 0a 20 20 | ).................(caddr.exp)... |
| d6960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 6c 61 6d 62 64 61 20 28 63 64 61 64 | ..............(make-lambda.(cdad |
| d6980 | 72 20 65 78 70 29 20 20 20 3b 20 66 6f 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 73 0a 20 20 20 | r.exp)...;.formal.parameters.... |
| d69a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 64 72 20 | ..........................(cddr. |
| d69c0 | 65 78 70 29 29 29 29 20 3b 20 62 6f 64 79 0a 0a 20 20 20 2a 20 60 4c 61 6d 62 64 61 27 20 65 78 | exp)))).;.body.....*.`Lambda'.ex |
| d69e0 | 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 6c 69 73 74 73 20 74 68 61 74 20 62 65 67 69 6e 20 77 | pressions.are.lists.that.begin.w |
| d6a00 | 69 74 68 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 6c 61 6d 62 64 61 27 3a 0a 0a 20 20 20 20 20 20 | ith.the.symbol.`lambda':........ |
| d6a20 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 61 6d 62 64 61 3f 20 65 78 70 29 20 28 74 61 67 67 65 | ....(define.(lambda?.exp).(tagge |
| d6a40 | 64 2d 6c 69 73 74 3f 20 65 78 70 20 27 6c 61 6d 62 64 61 29 29 0a 0a 20 20 20 20 20 20 20 20 20 | d-list?.exp.'lambda))........... |
| d6a60 | 20 28 64 65 66 69 6e 65 20 28 6c 61 6d 62 64 61 2d 70 61 72 61 6d 65 74 65 72 73 20 65 78 70 29 | .(define.(lambda-parameters.exp) |
| d6a80 | 20 28 63 61 64 72 20 65 78 70 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | .(cadr.exp))............(define. |
| d6aa0 | 28 6c 61 6d 62 64 61 2d 62 6f 64 79 20 65 78 70 29 20 28 63 64 64 72 20 65 78 70 29 29 0a 0a 20 | (lambda-body.exp).(cddr.exp))... |
| d6ac0 | 20 20 20 20 57 65 20 61 6c 73 6f 20 70 72 6f 76 69 64 65 20 61 20 63 6f 6e 73 74 72 75 63 74 6f | ....We.also.provide.a.constructo |
| d6ae0 | 72 20 66 6f 72 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 77 68 69 63 | r.for.`lambda'.expressions,.whic |
| d6b00 | 68 20 69 73 0a 20 20 20 20 20 75 73 65 64 20 62 79 20 60 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 | h.is......used.by.`definition-va |
| d6b20 | 6c 75 65 27 2c 20 61 62 6f 76 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | lue',.above:............(define. |
| d6b40 | 28 6d 61 6b 65 2d 6c 61 6d 62 64 61 20 70 61 72 61 6d 65 74 65 72 73 20 62 6f 64 79 29 0a 20 20 | (make-lambda.parameters.body)... |
| d6b60 | 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 27 6c 61 6d 62 64 61 20 28 63 6f 6e 73 20 70 61 | ..........(cons.'lambda.(cons.pa |
| d6b80 | 72 61 6d 65 74 65 72 73 20 62 6f 64 79 29 29 29 0a 0a 20 20 20 2a 20 43 6f 6e 64 69 74 69 6f 6e | rameters.body))).....*.Condition |
| d6ba0 | 61 6c 73 20 62 65 67 69 6e 20 77 69 74 68 20 60 69 66 27 20 61 6e 64 20 68 61 76 65 20 61 20 70 | als.begin.with.`if'.and.have.a.p |
| d6bc0 | 72 65 64 69 63 61 74 65 2c 20 61 20 63 6f 6e 73 65 71 75 65 6e 74 2c 0a 20 20 20 20 20 61 6e 64 | redicate,.a.consequent,......and |
| d6be0 | 20 61 6e 20 28 6f 70 74 69 6f 6e 61 6c 29 20 61 6c 74 65 72 6e 61 74 69 76 65 2e 20 20 49 66 20 | .an.(optional).alternative...If. |
| d6c00 | 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 68 61 73 20 6e 6f 0a 20 20 20 20 20 61 6c 74 65 72 | the.expression.has.no......alter |
| d6c20 | 6e 61 74 69 76 65 20 70 61 72 74 2c 20 77 65 20 70 72 6f 76 69 64 65 20 60 66 61 6c 73 65 27 20 | native.part,.we.provide.`false'. |
| d6c40 | 61 73 20 74 68 65 20 61 6c 74 65 72 6e 61 74 69 76 65 2e 28 32 29 0a 0a 20 20 20 20 20 20 20 20 | as.the.alternative.(2).......... |
| d6c60 | 20 20 28 64 65 66 69 6e 65 20 28 69 66 3f 20 65 78 70 29 20 28 74 61 67 67 65 64 2d 6c 69 73 74 | ..(define.(if?.exp).(tagged-list |
| d6c80 | 3f 20 65 78 70 20 27 69 66 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | ?.exp.'if))............(define.( |
| d6ca0 | 69 66 2d 70 72 65 64 69 63 61 74 65 20 65 78 70 29 20 28 63 61 64 72 20 65 78 70 29 29 0a 0a 20 | if-predicate.exp).(cadr.exp))... |
| d6cc0 | 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 66 2d 63 6f 6e 73 65 71 75 65 6e 74 20 | .........(define.(if-consequent. |
| d6ce0 | 65 78 70 29 20 28 63 61 64 64 72 20 65 78 70 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | exp).(caddr.exp))............(de |
| d6d00 | 66 69 6e 65 20 28 69 66 2d 61 6c 74 65 72 6e 61 74 69 76 65 20 65 78 70 29 0a 20 20 20 20 20 20 | fine.(if-alternative.exp)....... |
| d6d20 | 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 28 63 64 64 64 72 20 65 78 70 | ......(if.(not.(null?.(cdddr.exp |
| d6d40 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 61 64 64 64 72 20 65 78 70 29 | ))).................(cadddr.exp) |
| d6d60 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 66 61 6c 73 65 29 29 0a 0a 20 20 20 20 20 | .................'false))....... |
| d6d80 | 57 65 20 61 6c 73 6f 20 70 72 6f 76 69 64 65 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 66 6f | We.also.provide.a.constructor.fo |
| d6da0 | 72 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 74 6f 20 62 65 20 75 73 65 64 20 62 | r.`if'.expressions,.to.be.used.b |
| d6dc0 | 79 0a 20 20 20 20 20 60 63 6f 6e 64 2d 3e 69 66 27 20 74 6f 20 74 72 61 6e 73 66 6f 72 6d 20 60 | y......`cond->if'.to.transform.` |
| d6de0 | 63 6f 6e 64 27 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 74 6f 20 60 69 66 27 20 65 78 70 72 | cond'.expressions.into.`if'.expr |
| d6e00 | 65 73 73 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b | essions:............(define.(mak |
| d6e20 | 65 2d 69 66 20 70 72 65 64 69 63 61 74 65 20 63 6f 6e 73 65 71 75 65 6e 74 20 61 6c 74 65 72 6e | e-if.predicate.consequent.altern |
| d6e40 | 61 74 69 76 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 69 66 20 70 72 65 | ative).............(list.'if.pre |
| d6e60 | 64 69 63 61 74 65 20 63 6f 6e 73 65 71 75 65 6e 74 20 61 6c 74 65 72 6e 61 74 69 76 65 29 29 0a | dicate.consequent.alternative)). |
| d6e80 | 0a 20 20 20 2a 20 60 42 65 67 69 6e 27 20 70 61 63 6b 61 67 65 73 20 61 20 73 65 71 75 65 6e 63 | ....*.`Begin'.packages.a.sequenc |
| d6ea0 | 65 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c 65 0a 20 | e.of.expressions.into.a.single.. |
| d6ec0 | 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 57 65 20 69 6e 63 6c 75 64 65 20 73 79 6e 74 | ....expression...We.include.synt |
| d6ee0 | 61 78 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 60 62 65 67 69 6e 27 20 65 78 70 72 65 73 73 | ax.operations.on.`begin'.express |
| d6f00 | 69 6f 6e 73 0a 20 20 20 20 20 74 6f 20 65 78 74 72 61 63 74 20 74 68 65 20 61 63 74 75 61 6c 20 | ions......to.extract.the.actual. |
| d6f20 | 73 65 71 75 65 6e 63 65 20 66 72 6f 6d 20 74 68 65 20 60 62 65 67 69 6e 27 20 65 78 70 72 65 73 | sequence.from.the.`begin'.expres |
| d6f40 | 73 69 6f 6e 2c 20 61 73 0a 20 20 20 20 20 77 65 6c 6c 20 61 73 20 73 65 6c 65 63 74 6f 72 73 20 | sion,.as......well.as.selectors. |
| d6f60 | 74 68 61 74 20 72 65 74 75 72 6e 20 74 68 65 20 66 69 72 73 74 20 65 78 70 72 65 73 73 69 6f 6e | that.return.the.first.expression |
| d6f80 | 20 61 6e 64 20 74 68 65 20 72 65 73 74 20 6f 66 0a 20 20 20 20 20 74 68 65 20 65 78 70 72 65 73 | .and.the.rest.of......the.expres |
| d6fa0 | 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 2e 28 33 29 0a 0a 20 20 20 20 20 | sions.in.the.sequence.(3)....... |
| d6fc0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 62 65 67 69 6e 3f 20 65 78 70 29 20 28 74 61 67 67 65 | .....(define.(begin?.exp).(tagge |
| d6fe0 | 64 2d 6c 69 73 74 3f 20 65 78 70 20 27 62 65 67 69 6e 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 | d-list?.exp.'begin))............ |
| d7000 | 28 64 65 66 69 6e 65 20 28 62 65 67 69 6e 2d 61 63 74 69 6f 6e 73 20 65 78 70 29 20 28 63 64 72 | (define.(begin-actions.exp).(cdr |
| d7020 | 20 65 78 70 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 61 73 74 2d | .exp))............(define.(last- |
| d7040 | 65 78 70 3f 20 73 65 71 29 20 28 6e 75 6c 6c 3f 20 28 63 64 72 20 73 65 71 29 29 29 0a 0a 20 20 | exp?.seq).(null?.(cdr.seq))).... |
| d7060 | 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 72 73 74 2d 65 78 70 20 73 65 71 29 20 | ........(define.(first-exp.seq). |
| d7080 | 28 63 61 72 20 73 65 71 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 | (car.seq))............(define.(r |
| d70a0 | 65 73 74 2d 65 78 70 73 20 73 65 71 29 20 28 63 64 72 20 73 65 71 29 29 0a 0a 20 20 20 20 20 57 | est-exps.seq).(cdr.seq)).......W |
| d70c0 | 65 20 61 6c 73 6f 20 69 6e 63 6c 75 64 65 20 61 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 73 65 | e.also.include.a.constructor.`se |
| d70e0 | 71 75 65 6e 63 65 2d 3e 65 78 70 27 20 28 66 6f 72 20 75 73 65 20 62 79 0a 20 20 20 20 20 60 63 | quence->exp'.(for.use.by......`c |
| d7100 | 6f 6e 64 2d 3e 69 66 27 29 20 74 68 61 74 20 74 72 61 6e 73 66 6f 72 6d 73 20 61 20 73 65 71 75 | ond->if').that.transforms.a.sequ |
| d7120 | 65 6e 63 65 20 69 6e 74 6f 20 61 20 73 69 6e 67 6c 65 20 65 78 70 72 65 73 73 69 6f 6e 2c 0a 20 | ence.into.a.single.expression,.. |
| d7140 | 20 20 20 20 75 73 69 6e 67 20 60 62 65 67 69 6e 27 20 69 66 20 6e 65 63 65 73 73 61 72 79 3a 0a | ....using.`begin'.if.necessary:. |
| d7160 | 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 71 75 65 6e 63 65 2d 3e 65 78 | ...........(define.(sequence->ex |
| d7180 | 70 20 73 65 71 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f | p.seq).............(cond.((null? |
| d71a0 | 20 73 65 71 29 20 73 65 71 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6c | .seq).seq)...................((l |
| d71c0 | 61 73 74 2d 65 78 70 3f 20 73 65 71 29 20 28 66 69 72 73 74 2d 65 78 70 20 73 65 71 29 29 0a 20 | ast-exp?.seq).(first-exp.seq)).. |
| d71e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 6d 61 6b 65 2d 62 65 67 | .................(else.(make-beg |
| d7200 | 69 6e 20 73 65 71 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d | in.seq))))............(define.(m |
| d7220 | 61 6b 65 2d 62 65 67 69 6e 20 73 65 71 29 20 28 63 6f 6e 73 20 27 62 65 67 69 6e 20 73 65 71 29 | ake-begin.seq).(cons.'begin.seq) |
| d7240 | 29 0a 0a 20 20 20 2a 20 41 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 | ).....*.A.procedure.application. |
| d7260 | 69 73 20 61 6e 79 20 63 6f 6d 70 6f 75 6e 64 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 | is.any.compound.expression.that. |
| d7280 | 69 73 20 6e 6f 74 20 6f 6e 65 0a 20 20 20 20 20 6f 66 20 74 68 65 20 61 62 6f 76 65 20 65 78 70 | is.not.one......of.the.above.exp |
| d72a0 | 72 65 73 73 69 6f 6e 20 74 79 70 65 73 2e 20 20 54 68 65 20 60 63 61 72 27 20 6f 66 20 74 68 65 | ression.types...The.`car'.of.the |
| d72c0 | 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 74 68 65 0a 20 20 20 20 20 6f 70 65 72 61 74 6f 72 | .expression.is.the......operator |
| d72e0 | 2c 20 61 6e 64 20 74 68 65 20 60 63 64 72 27 20 69 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20 6f | ,.and.the.`cdr'.is.the.list.of.o |
| d7300 | 70 65 72 61 6e 64 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 70 | perands:............(define.(app |
| d7320 | 6c 69 63 61 74 69 6f 6e 3f 20 65 78 70 29 20 28 70 61 69 72 3f 20 65 78 70 29 29 0a 0a 20 20 20 | lication?.exp).(pair?.exp))..... |
| d7340 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6f 70 65 72 61 74 6f 72 20 65 78 70 29 20 28 63 | .......(define.(operator.exp).(c |
| d7360 | 61 72 20 65 78 70 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6f 70 65 | ar.exp))............(define.(ope |
| d7380 | 72 61 6e 64 73 20 65 78 70 29 20 28 63 64 72 20 65 78 70 29 29 0a 0a 20 20 20 20 20 20 20 20 20 | rands.exp).(cdr.exp))........... |
| d73a0 | 20 28 64 65 66 69 6e 65 20 28 6e 6f 2d 6f 70 65 72 61 6e 64 73 3f 20 6f 70 73 29 20 28 6e 75 6c | .(define.(no-operands?.ops).(nul |
| d73c0 | 6c 3f 20 6f 70 73 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 72 | l?.ops))............(define.(fir |
| d73e0 | 73 74 2d 6f 70 65 72 61 6e 64 20 6f 70 73 29 20 28 63 61 72 20 6f 70 73 29 29 0a 0a 20 20 20 20 | st-operand.ops).(car.ops))...... |
| d7400 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 73 74 2d 6f 70 65 72 61 6e 64 73 20 6f 70 73 | ......(define.(rest-operands.ops |
| d7420 | 29 20 28 63 64 72 20 6f 70 73 29 29 0a 0a 0a 44 65 72 69 76 65 64 20 65 78 70 72 65 73 73 69 6f | ).(cdr.ops))...Derived.expressio |
| d7440 | 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 53 6f 6d 65 20 73 70 65 | ns......................Some.spe |
| d7460 | 63 69 61 6c 20 66 6f 72 6d 73 20 69 6e 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 63 61 6e 20 62 | cial.forms.in.our.language.can.b |
| d7480 | 65 20 64 65 66 69 6e 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 0a 65 78 70 72 65 73 73 69 6f 6e | e.defined.in.terms.of.expression |
| d74a0 | 73 20 69 6e 76 6f 6c 76 69 6e 67 20 6f 74 68 65 72 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 2c | s.involving.other.special.forms, |
| d74c0 | 20 72 61 74 68 65 72 20 74 68 61 6e 20 62 65 69 6e 67 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 64 | .rather.than.being.implemented.d |
| d74e0 | 69 72 65 63 74 6c 79 2e 20 20 4f 6e 65 20 65 78 61 6d 70 6c 65 20 69 73 20 60 63 6f 6e 64 27 2c | irectly...One.example.is.`cond', |
| d7500 | 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 0a 61 73 20 61 20 6e | .which.can.be.implemented.as.a.n |
| d7520 | 65 73 74 20 6f 66 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 46 6f 72 20 65 78 | est.of.`if'.expressions...For.ex |
| d7540 | 61 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 72 65 64 75 63 65 20 74 68 65 20 70 72 6f 62 6c 65 6d | ample,.we.can.reduce.the.problem |
| d7560 | 0a 6f 66 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 | .of.evaluating.the.expression... |
| d7580 | 20 20 20 20 28 63 6f 6e 64 20 28 28 3e 20 78 20 30 29 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 | ....(cond.((>.x.0).x)........... |
| d75a0 | 20 28 28 3d 20 78 20 30 29 20 28 64 69 73 70 6c 61 79 20 27 7a 65 72 6f 29 20 30 29 0a 20 20 20 | .((=.x.0).(display.'zero).0).... |
| d75c0 | 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 2d 20 78 29 29 29 0a 0a 74 6f 20 74 68 65 20 70 72 | ........(else.(-.x)))..to.the.pr |
| d75e0 | 6f 62 6c 65 6d 20 6f 66 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e | oblem.of.evaluating.the.followin |
| d7600 | 67 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 76 6f 6c 76 69 6e 67 20 60 69 66 27 20 61 6e 64 0a | g.expression.involving.`if'.and. |
| d7620 | 60 62 65 67 69 6e 27 20 65 78 70 72 65 73 73 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 28 69 66 20 28 | `begin'.expressions:.......(if.( |
| d7640 | 3e 20 78 20 30 29 0a 20 20 20 20 20 20 20 20 20 78 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 | >.x.0)..........x..........(if.( |
| d7660 | 3d 20 78 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 64 69 73 70 | =.x.0)..............(begin.(disp |
| d7680 | 6c 61 79 20 27 7a 65 72 6f 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 30 | lay.'zero).....................0 |
| d76a0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2d 20 78 29 29 29 0a 0a 20 20 20 49 6d 70 6c 65 | )..............(-.x))).....Imple |
| d76c0 | 6d 65 6e 74 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 60 63 6f 6e 64 27 | menting.the.evaluation.of.`cond' |
| d76e0 | 20 69 6e 20 74 68 69 73 20 77 61 79 20 73 69 6d 70 6c 69 66 69 65 73 20 74 68 65 0a 65 76 61 6c | .in.this.way.simplifies.the.eval |
| d7700 | 75 61 74 6f 72 20 62 65 63 61 75 73 65 20 69 74 20 72 65 64 75 63 65 73 20 74 68 65 20 6e 75 6d | uator.because.it.reduces.the.num |
| d7720 | 62 65 72 20 6f 66 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 20 66 6f 72 20 77 68 69 63 68 20 74 | ber.of.special.forms.for.which.t |
| d7740 | 68 65 0a 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 6d 75 73 74 20 62 65 20 65 78 | he.evaluation.process.must.be.ex |
| d7760 | 70 6c 69 63 69 74 6c 79 20 73 70 65 63 69 66 69 65 64 2e 0a 0a 20 20 20 57 65 20 69 6e 63 6c 75 | plicitly.specified......We.inclu |
| d7780 | 64 65 20 73 79 6e 74 61 78 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 65 78 74 72 61 63 | de.syntax.procedures.that.extrac |
| d77a0 | 74 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 61 20 60 63 6f 6e 64 27 0a 65 78 70 72 65 73 73 69 | t.the.parts.of.a.`cond'.expressi |
| d77c0 | 6f 6e 2c 20 61 6e 64 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 63 6f 6e 64 2d 3e 69 66 27 20 74 | on,.and.a.procedure.`cond->if'.t |
| d77e0 | 68 61 74 20 74 72 61 6e 73 66 6f 72 6d 73 20 60 63 6f 6e 64 27 0a 65 78 70 72 65 73 73 69 6f 6e | hat.transforms.`cond'.expression |
| d7800 | 73 20 69 6e 74 6f 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 41 20 63 61 73 65 | s.into.`if'.expressions...A.case |
| d7820 | 20 61 6e 61 6c 79 73 69 73 20 62 65 67 69 6e 73 20 77 69 74 68 20 60 63 6f 6e 64 27 0a 61 6e 64 | .analysis.begins.with.`cond'.and |
| d7840 | 20 68 61 73 20 61 20 6c 69 73 74 20 6f 66 20 70 72 65 64 69 63 61 74 65 2d 61 63 74 69 6f 6e 20 | .has.a.list.of.predicate-action. |
| d7860 | 63 6c 61 75 73 65 73 2e 20 20 41 20 63 6c 61 75 73 65 20 69 73 20 61 6e 20 60 65 6c 73 65 27 0a | clauses...A.clause.is.an.`else'. |
| d7880 | 63 6c 61 75 73 65 20 69 66 20 69 74 73 20 70 72 65 64 69 63 61 74 65 20 69 73 20 74 68 65 20 73 | clause.if.its.predicate.is.the.s |
| d78a0 | 79 6d 62 6f 6c 20 60 65 6c 73 65 27 2e 28 34 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | ymbol.`else'.(4).......(define.( |
| d78c0 | 63 6f 6e 64 3f 20 65 78 70 29 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 65 78 70 20 27 63 6f | cond?.exp).(tagged-list?.exp.'co |
| d78e0 | 6e 64 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 64 2d 63 6c 61 75 73 65 73 | nd)).......(define.(cond-clauses |
| d7900 | 20 65 78 70 29 20 28 63 64 72 20 65 78 70 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | .exp).(cdr.exp)).......(define.( |
| d7920 | 63 6f 6e 64 2d 65 6c 73 65 2d 63 6c 61 75 73 65 3f 20 63 6c 61 75 73 65 29 0a 20 20 20 20 20 20 | cond-else-clause?.clause)....... |
| d7940 | 20 28 65 71 3f 20 28 63 6f 6e 64 2d 70 72 65 64 69 63 61 74 65 20 63 6c 61 75 73 65 29 20 27 65 | .(eq?.(cond-predicate.clause).'e |
| d7960 | 6c 73 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 64 2d 70 72 65 64 69 63 | lse)).......(define.(cond-predic |
| d7980 | 61 74 65 20 63 6c 61 75 73 65 29 20 28 63 61 72 20 63 6c 61 75 73 65 29 29 0a 0a 20 20 20 20 20 | ate.clause).(car.clause))....... |
| d79a0 | 28 64 65 66 69 6e 65 20 28 63 6f 6e 64 2d 61 63 74 69 6f 6e 73 20 63 6c 61 75 73 65 29 20 28 63 | (define.(cond-actions.clause).(c |
| d79c0 | 64 72 20 63 6c 61 75 73 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 64 2d | dr.clause)).......(define.(cond- |
| d79e0 | 3e 69 66 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 65 78 70 61 6e 64 2d 63 6c 61 75 73 65 73 20 | >if.exp)........(expand-clauses. |
| d7a00 | 28 63 6f 6e 64 2d 63 6c 61 75 73 65 73 20 65 78 70 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 | (cond-clauses.exp))).......(defi |
| d7a20 | 6e 65 20 28 65 78 70 61 6e 64 2d 63 6c 61 75 73 65 73 20 63 6c 61 75 73 65 73 29 0a 20 20 20 20 | ne.(expand-clauses.clauses)..... |
| d7a40 | 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 63 6c 61 75 73 65 73 29 0a 20 20 20 20 20 20 20 20 20 | ...(if.(null?.clauses).......... |
| d7a60 | 20 20 27 66 61 6c 73 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..'false........................ |
| d7a80 | 20 20 3b 20 6e 6f 20 60 65 6c 73 65 27 20 63 6c 61 75 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 | ..;.no.`else'.clause............ |
| d7aa0 | 28 6c 65 74 20 28 28 66 69 72 73 74 20 28 63 61 72 20 63 6c 61 75 73 65 73 29 29 0a 20 20 20 20 | (let.((first.(car.clauses))..... |
| d7ac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 20 28 63 64 72 20 63 6c 61 75 73 65 73 29 | .............(rest.(cdr.clauses) |
| d7ae0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 63 6f 6e 64 2d 65 6c 73 65 2d 63 | ))..............(if.(cond-else-c |
| d7b00 | 6c 61 75 73 65 3f 20 66 69 72 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | lause?.first)..................( |
| d7b20 | 69 66 20 28 6e 75 6c 6c 3f 20 72 65 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | if.(null?.rest)................. |
| d7b40 | 20 20 20 20 20 28 73 65 71 75 65 6e 63 65 2d 3e 65 78 70 20 28 63 6f 6e 64 2d 61 63 74 69 6f 6e | .....(sequence->exp.(cond-action |
| d7b60 | 73 20 66 69 72 73 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | s.first))......................( |
| d7b80 | 65 72 72 6f 72 20 22 45 4c 53 45 20 63 6c 61 75 73 65 20 69 73 6e 27 74 20 6c 61 73 74 20 2d 2d | error."ELSE.clause.isn't.last.-- |
| d7ba0 | 20 43 4f 4e 44 2d 3e 49 46 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .COND->IF"...................... |
| d7bc0 | 20 20 20 20 20 20 20 63 6c 61 75 73 65 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......clauses))................ |
| d7be0 | 20 20 28 6d 61 6b 65 2d 69 66 20 28 63 6f 6e 64 2d 70 72 65 64 69 63 61 74 65 20 66 69 72 73 74 | ..(make-if.(cond-predicate.first |
| d7c00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 71 | )...........................(seq |
| d7c20 | 75 65 6e 63 65 2d 3e 65 78 70 20 28 63 6f 6e 64 2d 61 63 74 69 6f 6e 73 20 66 69 72 73 74 29 29 | uence->exp.(cond-actions.first)) |
| d7c40 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 70 61 | ...........................(expa |
| d7c60 | 6e 64 2d 63 6c 61 75 73 65 73 20 72 65 73 74 29 29 29 29 29 29 0a 0a 20 20 20 45 78 70 72 65 73 | nd-clauses.rest)))))).....Expres |
| d7c80 | 73 69 6f 6e 73 20 28 73 75 63 68 20 61 73 20 60 63 6f 6e 64 27 29 20 74 68 61 74 20 77 65 20 63 | sions.(such.as.`cond').that.we.c |
| d7ca0 | 68 6f 6f 73 65 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 61 73 20 73 79 6e 74 61 63 74 69 63 0a | hoose.to.implement.as.syntactic. |
| d7cc0 | 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 73 20 61 72 65 20 63 61 6c 6c 65 64 20 22 64 65 72 69 | transformations.are.called."deri |
| d7ce0 | 76 65 64 20 65 78 70 72 65 73 73 69 6f 6e 73 22 2e 20 20 60 4c 65 74 27 20 65 78 70 72 65 73 73 | ved.expressions"...`Let'.express |
| d7d00 | 69 6f 6e 73 0a 61 72 65 20 61 6c 73 6f 20 64 65 72 69 76 65 64 20 65 78 70 72 65 73 73 69 6f 6e | ions.are.also.derived.expression |
| d7d20 | 73 20 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 36 3a 3a 29 2e 28 35 29 | s.(see.*Note.Exercise.4-6::).(5) |
| d7d40 | 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 32 3a 2a 20 4c 6f 75 69 73 20 52 65 61 | .......*Exercise.4.2:*.Louis.Rea |
| d7d60 | 73 6f 6e 65 72 20 70 6c 61 6e 73 20 74 6f 20 72 65 6f 72 64 65 72 20 74 68 65 20 60 63 6f 6e 64 | soner.plans.to.reorder.the.`cond |
| d7d80 | 27 20 63 6c 61 75 73 65 73 0a 20 20 20 20 20 69 6e 20 60 65 76 61 6c 27 20 73 6f 20 74 68 61 74 | '.clauses......in.`eval'.so.that |
| d7da0 | 20 74 68 65 20 63 6c 61 75 73 65 20 66 6f 72 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 | .the.clause.for.procedure.applic |
| d7dc0 | 61 74 69 6f 6e 73 20 61 70 70 65 61 72 73 0a 20 20 20 20 20 62 65 66 6f 72 65 20 74 68 65 20 63 | ations.appears......before.the.c |
| d7de0 | 6c 61 75 73 65 20 66 6f 72 20 61 73 73 69 67 6e 6d 65 6e 74 73 2e 20 20 48 65 20 61 72 67 75 65 | lause.for.assignments...He.argue |
| d7e00 | 73 20 74 68 61 74 20 74 68 69 73 20 77 69 6c 6c 20 6d 61 6b 65 0a 20 20 20 20 20 74 68 65 20 69 | s.that.this.will.make......the.i |
| d7e20 | 6e 74 65 72 70 72 65 74 65 72 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 3a 20 53 69 6e 63 65 | nterpreter.more.efficient:.Since |
| d7e40 | 20 70 72 6f 67 72 61 6d 73 20 75 73 75 61 6c 6c 79 20 63 6f 6e 74 61 69 6e 20 6d 6f 72 65 0a 20 | .programs.usually.contain.more.. |
| d7e60 | 20 20 20 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 74 68 61 6e 20 61 73 73 69 67 6e 6d 65 6e 74 | ....applications.than.assignment |
| d7e80 | 73 2c 20 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 61 6e 64 20 73 6f 20 6f 6e 2c 20 68 69 73 0a 20 | s,.definitions,.and.so.on,.his.. |
| d7ea0 | 20 20 20 20 6d 6f 64 69 66 69 65 64 20 60 65 76 61 6c 27 20 77 69 6c 6c 20 75 73 75 61 6c 6c 79 | ....modified.`eval'.will.usually |
| d7ec0 | 20 63 68 65 63 6b 20 66 65 77 65 72 20 63 6c 61 75 73 65 73 20 74 68 61 6e 20 74 68 65 20 6f 72 | .check.fewer.clauses.than.the.or |
| d7ee0 | 69 67 69 6e 61 6c 0a 20 20 20 20 20 60 65 76 61 6c 27 20 62 65 66 6f 72 65 20 69 64 65 6e 74 69 | iginal......`eval'.before.identi |
| d7f00 | 66 79 69 6e 67 20 74 68 65 20 74 79 70 65 20 6f 66 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2e | fying.the.type.of.an.expression. |
| d7f20 | 0a 0a 20 20 20 20 20 20 20 61 2e 20 57 68 61 74 20 69 73 20 77 72 6f 6e 67 20 77 69 74 68 20 4c | .........a..What.is.wrong.with.L |
| d7f40 | 6f 75 69 73 27 73 20 70 6c 61 6e 3f 20 20 28 48 69 6e 74 3a 20 57 68 61 74 20 77 69 6c 6c 20 4c | ouis's.plan?..(Hint:.What.will.L |
| d7f60 | 6f 75 69 73 27 73 0a 20 20 20 20 20 20 20 20 20 20 65 76 61 6c 75 61 74 6f 72 20 64 6f 20 77 69 | ouis's...........evaluator.do.wi |
| d7f80 | 74 68 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 64 65 66 69 6e 65 20 78 20 33 29 27 | th.the.expression.`(define.x.3)' |
| d7fa0 | 3f 29 0a 0a 20 20 20 20 20 20 20 62 2e 20 4c 6f 75 69 73 20 69 73 20 75 70 73 65 74 20 74 68 61 | ?).........b..Louis.is.upset.tha |
| d7fc0 | 74 20 68 69 73 20 70 6c 61 6e 20 64 69 64 6e 27 74 20 77 6f 72 6b 2e 20 20 48 65 20 69 73 20 77 | t.his.plan.didn't.work...He.is.w |
| d7fe0 | 69 6c 6c 69 6e 67 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 67 6f 20 74 6f 20 61 6e 79 20 6c 65 | illing.to...........go.to.any.le |
| d8000 | 6e 67 74 68 73 20 74 6f 20 6d 61 6b 65 20 68 69 73 20 65 76 61 6c 75 61 74 6f 72 20 72 65 63 6f | ngths.to.make.his.evaluator.reco |
| d8020 | 67 6e 69 7a 65 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 20 20 20 20 20 61 70 70 6c 69 63 | gnize.procedure...........applic |
| d8040 | 61 74 69 6f 6e 73 20 62 65 66 6f 72 65 20 69 74 20 63 68 65 63 6b 73 20 66 6f 72 20 6d 6f 73 74 | ations.before.it.checks.for.most |
| d8060 | 20 6f 74 68 65 72 20 6b 69 6e 64 73 20 6f 66 0a 20 20 20 20 20 20 20 20 20 20 65 78 70 72 65 73 | .other.kinds.of...........expres |
| d8080 | 73 69 6f 6e 73 2e 20 20 48 65 6c 70 20 68 69 6d 20 62 79 20 63 68 61 6e 67 69 6e 67 20 74 68 65 | sions...Help.him.by.changing.the |
| d80a0 | 20 73 79 6e 74 61 78 20 6f 66 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 65 76 61 6c 75 61 74 | .syntax.of.the...........evaluat |
| d80c0 | 65 64 20 6c 61 6e 67 75 61 67 65 20 73 6f 20 74 68 61 74 20 70 72 6f 63 65 64 75 72 65 20 61 70 | ed.language.so.that.procedure.ap |
| d80e0 | 70 6c 69 63 61 74 69 6f 6e 73 20 73 74 61 72 74 20 77 69 74 68 0a 20 20 20 20 20 20 20 20 20 20 | plications.start.with........... |
| d8100 | 60 63 61 6c 6c 27 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 6e 73 74 65 61 64 20 6f 66 | `call'...For.example,.instead.of |
| d8120 | 20 60 28 66 61 63 74 6f 72 69 61 6c 20 33 29 27 20 77 65 20 77 69 6c 6c 20 6e 6f 77 0a 20 20 20 | .`(factorial.3)'.we.will.now.... |
| d8140 | 20 20 20 20 20 20 20 68 61 76 65 20 74 6f 20 77 72 69 74 65 20 60 28 63 61 6c 6c 20 66 61 63 74 | .......have.to.write.`(call.fact |
| d8160 | 6f 72 69 61 6c 20 33 29 27 20 61 6e 64 20 69 6e 73 74 65 61 64 20 6f 66 20 60 28 2b 20 31 20 32 | orial.3)'.and.instead.of.`(+.1.2 |
| d8180 | 29 27 0a 20 20 20 20 20 20 20 20 20 20 77 65 20 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 77 72 69 | )'...........we.will.have.to.wri |
| d81a0 | 74 65 20 60 28 63 61 6c 6c 20 2b 20 31 20 32 29 27 2e 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | te.`(call.+.1.2)'.........*Exerc |
| d81c0 | 69 73 65 20 34 2e 33 3a 2a 20 52 65 77 72 69 74 65 20 60 65 76 61 6c 27 20 73 6f 20 74 68 61 74 | ise.4.3:*.Rewrite.`eval'.so.that |
| d81e0 | 20 74 68 65 20 64 69 73 70 61 74 63 68 20 69 73 20 64 6f 6e 65 20 69 6e 0a 20 20 20 20 20 64 61 | .the.dispatch.is.done.in......da |
| d8200 | 74 61 2d 64 69 72 65 63 74 65 64 20 73 74 79 6c 65 2e 20 20 43 6f 6d 70 61 72 65 20 74 68 69 73 | ta-directed.style...Compare.this |
| d8220 | 20 77 69 74 68 20 74 68 65 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 0a 20 20 20 20 20 64 69 66 | .with.the.data-directed......dif |
| d8240 | 66 65 72 65 6e 74 69 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 2a 4e 6f 74 65 20 | ferentiation.procedure.of.*Note. |
| d8260 | 45 78 65 72 63 69 73 65 20 32 2d 37 33 3a 3a 2e 20 20 28 59 6f 75 20 6d 61 79 20 75 73 65 0a 20 | Exercise.2-73::...(You.may.use.. |
| d8280 | 20 20 20 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 61 20 63 6f 6d 70 6f 75 6e 64 20 65 78 70 72 | ....the.`car'.of.a.compound.expr |
| d82a0 | 65 73 73 69 6f 6e 20 61 73 20 74 68 65 20 74 79 70 65 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 | ession.as.the.type.of.the.expres |
| d82c0 | 73 69 6f 6e 2c 0a 20 20 20 20 20 61 73 20 69 73 20 61 70 70 72 6f 70 72 69 61 74 65 20 66 6f 72 | sion,......as.is.appropriate.for |
| d82e0 | 20 74 68 65 20 73 79 6e 74 61 78 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 74 68 69 73 20 | .the.syntax.implemented.in.this. |
| d8300 | 73 65 63 74 69 6f 6e 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 34 3a 2a 20 | section.).......*Exercise.4.4:*. |
| d8320 | 52 65 63 61 6c 6c 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 73 70 | Recall.the.definitions.of.the.sp |
| d8340 | 65 63 69 61 6c 20 66 6f 72 6d 73 20 60 61 6e 64 27 0a 20 20 20 20 20 61 6e 64 20 60 6f 72 27 20 | ecial.forms.`and'......and.`or'. |
| d8360 | 66 72 6f 6d 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 31 3a 3a 3a 0a 0a 20 20 20 20 20 20 20 | from.*Note.Chapter.1:::......... |
| d8380 | 20 2a 20 60 61 6e 64 27 3a 20 54 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 65 76 | .*.`and':.The.expressions.are.ev |
| d83a0 | 61 6c 75 61 74 65 64 20 66 72 6f 6d 20 6c 65 66 74 20 74 6f 20 72 69 67 68 74 2e 20 20 49 66 0a | aluated.from.left.to.right...If. |
| d83c0 | 20 20 20 20 20 20 20 20 20 20 61 6e 79 20 65 78 70 72 65 73 73 69 6f 6e 20 65 76 61 6c 75 61 74 | ..........any.expression.evaluat |
| d83e0 | 65 73 20 74 6f 20 66 61 6c 73 65 2c 20 66 61 6c 73 65 20 69 73 20 72 65 74 75 72 6e 65 64 3b 20 | es.to.false,.false.is.returned;. |
| d8400 | 61 6e 79 0a 20 20 20 20 20 20 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 65 78 70 72 65 73 73 69 | any...........remaining.expressi |
| d8420 | 6f 6e 73 20 61 72 65 20 6e 6f 74 20 65 76 61 6c 75 61 74 65 64 2e 20 20 49 66 20 61 6c 6c 20 74 | ons.are.not.evaluated...If.all.t |
| d8440 | 68 65 0a 20 20 20 20 20 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 20 65 76 61 6c 75 61 74 | he...........expressions.evaluat |
| d8460 | 65 20 74 6f 20 74 72 75 65 20 76 61 6c 75 65 73 2c 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 | e.to.true.values,.the.value.of.t |
| d8480 | 68 65 20 6c 61 73 74 0a 20 20 20 20 20 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 | he.last...........expression.is. |
| d84a0 | 72 65 74 75 72 6e 65 64 2e 20 20 49 66 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 65 78 70 72 65 | returned...If.there.are.no.expre |
| d84c0 | 73 73 69 6f 6e 73 20 74 68 65 6e 0a 20 20 20 20 20 20 20 20 20 20 74 72 75 65 20 69 73 20 72 65 | ssions.then...........true.is.re |
| d84e0 | 74 75 72 6e 65 64 2e 0a 0a 20 20 20 20 20 20 20 20 2a 20 60 6f 72 27 3a 20 54 68 65 20 65 78 70 | turned...........*.`or':.The.exp |
| d8500 | 72 65 73 73 69 6f 6e 73 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 20 66 72 6f 6d 20 6c 65 66 74 | ressions.are.evaluated.from.left |
| d8520 | 20 74 6f 20 72 69 67 68 74 2e 20 20 49 66 0a 20 20 20 20 20 20 20 20 20 20 61 6e 79 20 65 78 70 | .to.right...If...........any.exp |
| d8540 | 72 65 73 73 69 6f 6e 20 65 76 61 6c 75 61 74 65 73 20 74 6f 20 61 20 74 72 75 65 20 76 61 6c 75 | ression.evaluates.to.a.true.valu |
| d8560 | 65 2c 20 74 68 61 74 20 76 61 6c 75 65 20 69 73 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 | e,.that.value.is...........retur |
| d8580 | 6e 65 64 3b 20 61 6e 79 20 72 65 6d 61 69 6e 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 | ned;.any.remaining.expressions.a |
| d85a0 | 72 65 20 6e 6f 74 20 65 76 61 6c 75 61 74 65 64 2e 20 20 49 66 0a 20 20 20 20 20 20 20 20 20 20 | re.not.evaluated...If........... |
| d85c0 | 61 6c 6c 20 65 78 70 72 65 73 73 69 6f 6e 73 20 65 76 61 6c 75 61 74 65 20 74 6f 20 66 61 6c 73 | all.expressions.evaluate.to.fals |
| d85e0 | 65 2c 20 6f 72 20 69 66 20 74 68 65 72 65 20 61 72 65 20 6e 6f 0a 20 20 20 20 20 20 20 20 20 20 | e,.or.if.there.are.no........... |
| d8600 | 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 74 68 65 6e 20 66 61 6c 73 65 20 69 73 20 72 65 74 75 72 | expressions,.then.false.is.retur |
| d8620 | 6e 65 64 2e 0a 0a 0a 20 20 20 20 20 49 6e 73 74 61 6c 6c 20 60 61 6e 64 27 20 61 6e 64 20 60 6f | ned.........Install.`and'.and.`o |
| d8640 | 72 27 20 61 73 20 6e 65 77 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 20 66 6f 72 20 74 68 65 20 | r'.as.new.special.forms.for.the. |
| d8660 | 65 76 61 6c 75 61 74 6f 72 20 62 79 0a 20 20 20 20 20 64 65 66 69 6e 69 6e 67 20 61 70 70 72 6f | evaluator.by......defining.appro |
| d8680 | 70 72 69 61 74 65 20 73 79 6e 74 61 78 20 70 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 65 76 61 | priate.syntax.procedures.and.eva |
| d86a0 | 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 60 65 76 61 6c 2d 61 6e | luation.procedures......`eval-an |
| d86c0 | 64 27 20 61 6e 64 20 60 65 76 61 6c 2d 6f 72 27 2e 20 20 41 6c 74 65 72 6e 61 74 69 76 65 6c 79 | d'.and.`eval-or'...Alternatively |
| d86e0 | 2c 20 73 68 6f 77 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 0a 20 20 20 20 20 60 61 6e | ,.show.how.to.implement......`an |
| d8700 | 64 27 20 61 6e 64 20 60 6f 72 27 20 61 73 20 64 65 72 69 76 65 64 20 65 78 70 72 65 73 73 69 6f | d'.and.`or'.as.derived.expressio |
| d8720 | 6e 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 35 3a 2a 20 53 63 68 65 6d 65 | ns........*Exercise.4.5:*.Scheme |
| d8740 | 20 61 6c 6c 6f 77 73 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 6c 20 73 79 6e 74 61 78 20 66 6f 72 | .allows.an.additional.syntax.for |
| d8760 | 20 60 63 6f 6e 64 27 0a 20 20 20 20 20 63 6c 61 75 73 65 73 2c 20 60 28 3c 54 45 53 54 3e 20 3d | .`cond'......clauses,.`(<TEST>.= |
| d8780 | 3e 20 3c 52 45 43 49 50 49 45 4e 54 3e 29 27 2e 20 20 49 66 20 3c 54 45 53 54 3e 20 65 76 61 6c | >.<RECIPIENT>)'...If.<TEST>.eval |
| d87a0 | 75 61 74 65 73 20 74 6f 20 61 20 74 72 75 65 0a 20 20 20 20 20 76 61 6c 75 65 2c 20 74 68 65 6e | uates.to.a.true......value,.then |
| d87c0 | 20 3c 52 45 43 49 50 49 45 4e 54 3e 20 69 73 20 65 76 61 6c 75 61 74 65 64 2e 20 20 49 74 73 20 | .<RECIPIENT>.is.evaluated...Its. |
| d87e0 | 76 61 6c 75 65 20 6d 75 73 74 20 62 65 20 61 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 6f | value.must.be.a......procedure.o |
| d8800 | 66 20 6f 6e 65 20 61 72 67 75 6d 65 6e 74 3b 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 69 | f.one.argument;.this.procedure.i |
| d8820 | 73 20 74 68 65 6e 20 69 6e 76 6f 6b 65 64 20 6f 6e 20 74 68 65 0a 20 20 20 20 20 76 61 6c 75 65 | s.then.invoked.on.the......value |
| d8840 | 20 6f 66 20 74 68 65 20 3c 54 45 53 54 3e 2c 20 61 6e 64 20 74 68 65 20 72 65 73 75 6c 74 20 69 | .of.the.<TEST>,.and.the.result.i |
| d8860 | 73 20 72 65 74 75 72 6e 65 64 20 61 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 0a 20 20 20 20 20 | s.returned.as.the.value.of...... |
| d8880 | 74 68 65 20 60 63 6f 6e 64 27 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 46 6f 72 20 65 78 61 6d | the.`cond'.expression...For.exam |
| d88a0 | 70 6c 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 61 73 73 6f 63 20 27 62 20 | ple............(cond.((assoc.'b. |
| d88c0 | 27 28 28 61 20 31 29 20 28 62 20 32 29 29 29 20 3d 3e 20 63 61 64 72 29 0a 20 20 20 20 20 20 20 | '((a.1).(b.2))).=>.cadr)........ |
| d88e0 | 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 66 61 6c 73 65 29 29 0a 0a 20 20 20 20 20 72 65 74 | .........(else.false)).......ret |
| d8900 | 75 72 6e 73 20 32 2e 20 20 4d 6f 64 69 66 79 20 74 68 65 20 68 61 6e 64 6c 69 6e 67 20 6f 66 20 | urns.2...Modify.the.handling.of. |
| d8920 | 60 63 6f 6e 64 27 20 73 6f 20 74 68 61 74 20 69 74 20 73 75 70 70 6f 72 74 73 20 74 68 69 73 0a | `cond'.so.that.it.supports.this. |
| d8940 | 20 20 20 20 20 65 78 74 65 6e 64 65 64 20 73 79 6e 74 61 78 2e 0a 0a 20 20 20 20 20 2a 45 78 65 | .....extended.syntax........*Exe |
| d8960 | 72 63 69 73 65 20 34 2e 36 3a 2a 20 60 4c 65 74 27 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 | rcise.4.6:*.`Let'.expressions.ar |
| d8980 | 65 20 64 65 72 69 76 65 64 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 62 65 63 61 75 73 65 0a 0a | e.derived.expressions,.because.. |
| d89a0 | 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 3c 56 41 52 5f 31 3e 20 3c 45 58 50 5f 31 3e | ..........(let.((<VAR_1>.<EXP_1> |
| d89c0 | 29 20 2e 2e 2e 20 28 3c 56 41 52 5f 4e 3e 20 3c 45 58 50 5f 4e 3e 29 29 0a 20 20 20 20 20 20 20 | ).....(<VAR_N>.<EXP_N>))........ |
| d89e0 | 20 20 20 20 20 3c 42 4f 44 59 3e 29 0a 0a 20 20 20 20 20 69 73 20 65 71 75 69 76 61 6c 65 6e 74 | .....<BODY>).......is.equivalent |
| d8a00 | 20 74 6f 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 6c 61 6d 62 64 61 20 28 3c 56 41 52 5f 31 3e | .to............((lambda.(<VAR_1> |
| d8a20 | 20 2e 2e 2e 20 3c 56 41 52 5f 4e 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 42 4f 44 59 | .....<VAR_N>)..............<BODY |
| d8a40 | 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 3c 45 58 50 5f 31 3e 0a 20 20 20 20 20 20 20 20 20 20 | >)............<EXP_1>........... |
| d8a60 | 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 3c 45 58 50 5f 4e 3e 29 0a 0a 20 20 20 20 20 49 | ................<EXP_N>).......I |
| d8a80 | 6d 70 6c 65 6d 65 6e 74 20 61 20 73 79 6e 74 61 63 74 69 63 20 74 72 61 6e 73 66 6f 72 6d 61 74 | mplement.a.syntactic.transformat |
| d8aa0 | 69 6f 6e 20 60 6c 65 74 2d 3e 63 6f 6d 62 69 6e 61 74 69 6f 6e 27 20 74 68 61 74 0a 20 20 20 20 | ion.`let->combination'.that..... |
| d8ac0 | 20 72 65 64 75 63 65 73 20 65 76 61 6c 75 61 74 69 6e 67 20 60 6c 65 74 27 20 65 78 70 72 65 73 | .reduces.evaluating.`let'.expres |
| d8ae0 | 73 69 6f 6e 73 20 74 6f 20 65 76 61 6c 75 61 74 69 6e 67 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 | sions.to.evaluating.combinations |
| d8b00 | 20 6f 66 0a 20 20 20 20 20 74 68 65 20 74 79 70 65 20 73 68 6f 77 6e 20 61 62 6f 76 65 2c 20 61 | .of......the.type.shown.above,.a |
| d8b20 | 6e 64 20 61 64 64 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 63 6c 61 75 73 65 20 74 6f | nd.add.the.appropriate.clause.to |
| d8b40 | 20 60 65 76 61 6c 27 20 74 6f 0a 20 20 20 20 20 68 61 6e 64 6c 65 20 60 6c 65 74 27 20 65 78 70 | .`eval'.to......handle.`let'.exp |
| d8b60 | 72 65 73 73 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 37 3a 2a 20 | ressions........*Exercise.4.7:*. |
| d8b80 | 60 4c 65 74 2a 27 20 69 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 60 6c 65 74 27 2c 20 65 78 63 65 | `Let*'.is.similar.to.`let',.exce |
| d8ba0 | 70 74 20 74 68 61 74 20 74 68 65 0a 20 20 20 20 20 62 69 6e 64 69 6e 67 73 20 6f 66 20 74 68 65 | pt.that.the......bindings.of.the |
| d8bc0 | 20 60 6c 65 74 27 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 70 65 72 66 6f 72 6d 65 64 20 73 | .`let'.variables.are.performed.s |
| d8be0 | 65 71 75 65 6e 74 69 61 6c 6c 79 20 66 72 6f 6d 0a 20 20 20 20 20 6c 65 66 74 20 74 6f 20 72 69 | equentially.from......left.to.ri |
| d8c00 | 67 68 74 2c 20 61 6e 64 20 65 61 63 68 20 62 69 6e 64 69 6e 67 20 69 73 20 6d 61 64 65 20 69 6e | ght,.and.each.binding.is.made.in |
| d8c20 | 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 0a 20 20 20 20 20 61 6c | .an.environment.in.which......al |
| d8c40 | 6c 20 6f 66 20 74 68 65 20 70 72 65 63 65 64 69 6e 67 20 62 69 6e 64 69 6e 67 73 20 61 72 65 20 | l.of.the.preceding.bindings.are. |
| d8c60 | 76 69 73 69 62 6c 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 0a 0a 20 20 20 20 20 20 20 20 20 | visible...For.example........... |
| d8c80 | 20 28 6c 65 74 2a 20 28 28 78 20 33 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .(let*.((x.3)..................( |
| d8ca0 | 79 20 28 2b 20 78 20 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 7a 20 28 | y.(+.x.2))..................(z.( |
| d8cc0 | 2b 20 78 20 79 20 35 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 78 20 7a 29 29 0a | +.x.y.5))).............(*.x.z)). |
| d8ce0 | 0a 20 20 20 20 20 72 65 74 75 72 6e 73 20 33 39 2e 20 20 45 78 70 6c 61 69 6e 20 68 6f 77 20 61 | ......returns.39...Explain.how.a |
| d8d00 | 20 60 6c 65 74 2a 27 20 65 78 70 72 65 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 72 65 77 72 69 74 | .`let*'.expression.can.be.rewrit |
| d8d20 | 74 65 6e 20 61 73 20 61 0a 20 20 20 20 20 73 65 74 20 6f 66 20 6e 65 73 74 65 64 20 60 6c 65 74 | ten.as.a......set.of.nested.`let |
| d8d40 | 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 61 6e 64 20 77 72 69 74 65 20 61 20 70 72 6f 63 65 | '.expressions,.and.write.a.proce |
| d8d60 | 64 75 72 65 0a 20 20 20 20 20 60 6c 65 74 2a 2d 3e 6e 65 73 74 65 64 2d 6c 65 74 73 27 20 74 68 | dure......`let*->nested-lets'.th |
| d8d80 | 61 74 20 70 65 72 66 6f 72 6d 73 20 74 68 69 73 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2e | at.performs.this.transformation. |
| d8da0 | 20 20 49 66 20 77 65 20 68 61 76 65 0a 20 20 20 20 20 61 6c 72 65 61 64 79 20 69 6d 70 6c 65 6d | ..If.we.have......already.implem |
| d8dc0 | 65 6e 74 65 64 20 60 6c 65 74 27 20 28 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 36 3a | ented.`let'.(*Note.Exercise.4-6: |
| d8de0 | 3a 29 20 61 6e 64 20 77 65 20 77 61 6e 74 20 74 6f 0a 20 20 20 20 20 65 78 74 65 6e 64 20 74 68 | :).and.we.want.to......extend.th |
| d8e00 | 65 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 68 61 6e 64 6c 65 20 60 6c 65 74 2a 27 2c 20 69 73 | e.evaluator.to.handle.`let*',.is |
| d8e20 | 20 69 74 20 73 75 66 66 69 63 69 65 6e 74 20 74 6f 20 61 64 64 20 61 0a 20 20 20 20 20 63 6c 61 | .it.sufficient.to.add.a......cla |
| d8e40 | 75 73 65 20 74 6f 20 60 65 76 61 6c 27 20 77 68 6f 73 65 20 61 63 74 69 6f 6e 20 69 73 0a 0a 20 | use.to.`eval'.whose.action.is... |
| d8e60 | 20 20 20 20 20 20 20 20 20 28 65 76 61 6c 20 28 6c 65 74 2a 2d 3e 6e 65 73 74 65 64 2d 6c 65 74 | .........(eval.(let*->nested-let |
| d8e80 | 73 20 65 78 70 29 20 65 6e 76 29 0a 0a 20 20 20 20 20 6f 72 20 6d 75 73 74 20 77 65 20 65 78 70 | s.exp).env).......or.must.we.exp |
| d8ea0 | 6c 69 63 69 74 6c 79 20 65 78 70 61 6e 64 20 60 6c 65 74 2a 27 20 69 6e 20 74 65 72 6d 73 20 6f | licitly.expand.`let*'.in.terms.o |
| d8ec0 | 66 20 6e 6f 6e 2d 64 65 72 69 76 65 64 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 3f 0a | f.non-derived......expressions?. |
| d8ee0 | 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 38 3a 2a 20 22 4e 61 6d 65 64 20 60 6c 65 | ......*Exercise.4.8:*."Named.`le |
| d8f00 | 74 27 22 20 69 73 20 61 20 76 61 72 69 61 6e 74 20 6f 66 20 60 6c 65 74 27 20 74 68 61 74 20 68 | t'".is.a.variant.of.`let'.that.h |
| d8f20 | 61 73 20 74 68 65 0a 20 20 20 20 20 66 6f 72 6d 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 | as.the......form............(let |
| d8f40 | 20 3c 56 41 52 3e 20 3c 42 49 4e 44 49 4e 47 53 3e 20 3c 42 4f 44 59 3e 29 0a 0a 20 20 20 20 20 | .<VAR>.<BINDINGS>.<BODY>)....... |
| d8f60 | 54 68 65 20 3c 42 49 4e 44 49 4e 47 53 3e 20 61 6e 64 20 3c 42 4f 44 59 3e 20 61 72 65 20 6a 75 | The.<BINDINGS>.and.<BODY>.are.ju |
| d8f80 | 73 74 20 61 73 20 69 6e 20 6f 72 64 69 6e 61 72 79 20 60 6c 65 74 27 2c 20 65 78 63 65 70 74 0a | st.as.in.ordinary.`let',.except. |
| d8fa0 | 20 20 20 20 20 74 68 61 74 20 3c 56 41 52 3e 20 69 73 20 62 6f 75 6e 64 20 77 69 74 68 69 6e 20 | .....that.<VAR>.is.bound.within. |
| d8fc0 | 3c 42 4f 44 59 3e 20 74 6f 20 61 20 70 72 6f 63 65 64 75 72 65 20 77 68 6f 73 65 20 62 6f 64 79 | <BODY>.to.a.procedure.whose.body |
| d8fe0 | 20 69 73 0a 20 20 20 20 20 3c 42 4f 44 59 3e 20 61 6e 64 20 77 68 6f 73 65 20 70 61 72 61 6d 65 | .is......<BODY>.and.whose.parame |
| d9000 | 74 65 72 73 20 61 72 65 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 69 6e 20 74 68 65 20 3c 42 | ters.are.the.variables.in.the.<B |
| d9020 | 49 4e 44 49 4e 47 53 3e 2e 0a 20 20 20 20 20 54 68 75 73 2c 20 6f 6e 65 20 63 61 6e 20 72 65 70 | INDINGS>.......Thus,.one.can.rep |
| d9040 | 65 61 74 65 64 6c 79 20 65 78 65 63 75 74 65 20 74 68 65 20 3c 42 4f 44 59 3e 20 62 79 20 69 6e | eatedly.execute.the.<BODY>.by.in |
| d9060 | 76 6f 6b 69 6e 67 20 74 68 65 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 6e 61 6d 65 64 20 | voking.the......procedure.named. |
| d9080 | 3c 56 41 52 3e 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 69 74 65 72 61 74 69 | <VAR>...For.example,.the.iterati |
| d90a0 | 76 65 20 46 69 62 6f 6e 61 63 63 69 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 28 73 65 63 | ve.Fibonacci......procedure.(sec |
| d90c0 | 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 32 3a 3a 29 20 63 61 6e 20 62 65 20 72 65 77 72 69 | tion.*Note.1-2-2::).can.be.rewri |
| d90e0 | 74 74 65 6e 20 75 73 69 6e 67 20 6e 61 6d 65 64 0a 20 20 20 20 20 60 6c 65 74 27 20 61 73 20 66 | tten.using.named......`let'.as.f |
| d9100 | 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 62 20 | ollows:............(define.(fib. |
| d9120 | 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 66 69 62 2d 69 74 65 72 20 28 28 61 | n).............(let.fib-iter.((a |
| d9140 | 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .1)............................( |
| d9160 | 62 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | b.0)............................ |
| d9180 | 28 63 6f 75 6e 74 20 6e 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 | (count.n))...............(if.(=. |
| d91a0 | 63 6f 75 6e 74 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 0a 20 20 20 | count.0)...................b.... |
| d91c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 69 62 2d 69 74 65 72 20 28 2b 20 61 20 62 29 | ...............(fib-iter.(+.a.b) |
| d91e0 | 20 61 20 28 2d 20 63 6f 75 6e 74 20 31 29 29 29 29 29 0a 0a 20 20 20 20 20 4d 6f 64 69 66 79 20 | .a.(-.count.1))))).......Modify. |
| d9200 | 60 6c 65 74 2d 3e 63 6f 6d 62 69 6e 61 74 69 6f 6e 27 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 | `let->combination'.of.*Note.Exer |
| d9220 | 63 69 73 65 20 34 2d 36 3a 3a 20 74 6f 20 61 6c 73 6f 20 73 75 70 70 6f 72 74 0a 20 20 20 20 20 | cise.4-6::.to.also.support...... |
| d9240 | 6e 61 6d 65 64 20 60 6c 65 74 27 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 39 | named.`let'........*Exercise.4.9 |
| d9260 | 3a 2a 20 4d 61 6e 79 20 6c 61 6e 67 75 61 67 65 73 20 73 75 70 70 6f 72 74 20 61 20 76 61 72 69 | :*.Many.languages.support.a.vari |
| d9280 | 65 74 79 20 6f 66 20 69 74 65 72 61 74 69 6f 6e 0a 20 20 20 20 20 63 6f 6e 73 74 72 75 63 74 73 | ety.of.iteration......constructs |
| d92a0 | 2c 20 73 75 63 68 20 61 73 20 60 64 6f 27 2c 20 60 66 6f 72 27 2c 20 60 77 68 69 6c 65 27 2c 20 | ,.such.as.`do',.`for',.`while',. |
| d92c0 | 61 6e 64 20 60 75 6e 74 69 6c 27 2e 20 20 49 6e 20 53 63 68 65 6d 65 2c 0a 20 20 20 20 20 69 74 | and.`until'...In.Scheme,......it |
| d92e0 | 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 65 73 20 63 61 6e 20 62 65 20 65 78 70 72 65 73 73 | erative.processes.can.be.express |
| d9300 | 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6f 72 64 69 6e 61 72 79 0a 20 20 20 20 20 70 72 6f | ed.in.terms.of.ordinary......pro |
| d9320 | 63 65 64 75 72 65 20 63 61 6c 6c 73 2c 20 73 6f 20 73 70 65 63 69 61 6c 20 69 74 65 72 61 74 69 | cedure.calls,.so.special.iterati |
| d9340 | 6f 6e 20 63 6f 6e 73 74 72 75 63 74 73 20 70 72 6f 76 69 64 65 20 6e 6f 0a 20 20 20 20 20 65 73 | on.constructs.provide.no......es |
| d9360 | 73 65 6e 74 69 61 6c 20 67 61 69 6e 20 69 6e 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 70 6f | sential.gain.in.computational.po |
| d9380 | 77 65 72 2e 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 73 75 63 68 0a 20 20 | wer...On.the.other.hand,.such... |
| d93a0 | 20 20 20 63 6f 6e 73 74 72 75 63 74 73 20 61 72 65 20 6f 66 74 65 6e 20 63 6f 6e 76 65 6e 69 65 | ...constructs.are.often.convenie |
| d93c0 | 6e 74 2e 20 20 44 65 73 69 67 6e 20 73 6f 6d 65 20 69 74 65 72 61 74 69 6f 6e 0a 20 20 20 20 20 | nt...Design.some.iteration...... |
| d93e0 | 63 6f 6e 73 74 72 75 63 74 73 2c 20 67 69 76 65 20 65 78 61 6d 70 6c 65 73 20 6f 66 20 74 68 65 | constructs,.give.examples.of.the |
| d9400 | 69 72 20 75 73 65 2c 20 61 6e 64 20 73 68 6f 77 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e | ir.use,.and.show.how.to.implemen |
| d9420 | 74 0a 20 20 20 20 20 74 68 65 6d 20 61 73 20 64 65 72 69 76 65 64 20 65 78 70 72 65 73 73 69 6f | t......them.as.derived.expressio |
| d9440 | 6e 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 31 30 3a 2a 20 42 79 20 75 73 | ns........*Exercise.4.10:*.By.us |
| d9460 | 69 6e 67 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 2c 20 77 65 20 77 65 72 65 20 61 62 | ing.data.abstraction,.we.were.ab |
| d9480 | 6c 65 20 74 6f 20 77 72 69 74 65 0a 20 20 20 20 20 61 6e 20 60 65 76 61 6c 27 20 70 72 6f 63 65 | le.to.write......an.`eval'.proce |
| d94a0 | 64 75 72 65 20 74 68 61 74 20 69 73 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 | dure.that.is.independent.of.the. |
| d94c0 | 70 61 72 74 69 63 75 6c 61 72 20 73 79 6e 74 61 78 0a 20 20 20 20 20 6f 66 20 74 68 65 20 6c 61 | particular.syntax......of.the.la |
| d94e0 | 6e 67 75 61 67 65 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 2e 20 20 54 6f 20 69 6c 6c 75 | nguage.to.be.evaluated...To.illu |
| d9500 | 73 74 72 61 74 65 20 74 68 69 73 2c 20 64 65 73 69 67 6e 20 61 6e 64 0a 20 20 20 20 20 69 6d 70 | strate.this,.design.and......imp |
| d9520 | 6c 65 6d 65 6e 74 20 61 20 6e 65 77 20 73 79 6e 74 61 78 20 66 6f 72 20 53 63 68 65 6d 65 20 62 | lement.a.new.syntax.for.Scheme.b |
| d9540 | 79 20 6d 6f 64 69 66 79 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 0a 20 20 | y.modifying.the.procedures.in... |
| d9560 | 20 20 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 20 77 69 74 68 6f 75 74 20 63 68 61 6e 67 69 6e | ...this.section,.without.changin |
| d9580 | 67 20 60 65 76 61 6c 27 20 6f 72 20 60 61 70 70 6c 79 27 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d | g.`eval'.or.`apply'......------- |
| d95a0 | 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 | ---.Footnotes.----------.....(1) |
| d95c0 | 20 41 73 20 6d 65 6e 74 69 6f 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 | .As.mentioned.in.section.*Note.2 |
| d95e0 | 2d 33 2d 31 3a 3a 2c 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 73 65 65 73 20 61 0a 71 75 6f | -3-1::,.the.evaluator.sees.a.quo |
| d9600 | 74 65 64 20 65 78 70 72 65 73 73 69 6f 6e 20 61 73 20 61 20 6c 69 73 74 20 62 65 67 69 6e 6e 69 | ted.expression.as.a.list.beginni |
| d9620 | 6e 67 20 77 69 74 68 20 60 71 75 6f 74 65 27 2c 20 65 76 65 6e 20 69 66 20 74 68 65 0a 65 78 70 | ng.with.`quote',.even.if.the.exp |
| d9640 | 72 65 73 73 69 6f 6e 20 69 73 20 74 79 70 65 64 20 77 69 74 68 20 74 68 65 20 71 75 6f 74 61 74 | ression.is.typed.with.the.quotat |
| d9660 | 69 6f 6e 20 6d 61 72 6b 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 0a 65 78 70 72 | ion.mark...For.example,.the.expr |
| d9680 | 65 73 73 69 6f 6e 20 60 27 61 27 20 77 6f 75 6c 64 20 62 65 20 73 65 65 6e 20 62 79 20 74 68 65 | ession.`'a'.would.be.seen.by.the |
| d96a0 | 20 65 76 61 6c 75 61 74 6f 72 20 61 73 20 60 28 71 75 6f 74 65 20 61 29 27 2e 20 20 53 65 65 0a | .evaluator.as.`(quote.a)'...See. |
| d96c0 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 35 35 3a 3a 2e 0a 0a 20 20 20 28 32 29 20 54 | *Note.Exercise.2-55::......(2).T |
| d96e0 | 68 65 20 76 61 6c 75 65 20 6f 66 20 61 6e 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 20 77 | he.value.of.an.`if'.expression.w |
| d9700 | 68 65 6e 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 69 73 20 66 61 6c 73 65 20 61 6e 64 0a 74 | hen.the.predicate.is.false.and.t |
| d9720 | 68 65 72 65 20 69 73 20 6e 6f 20 61 6c 74 65 72 6e 61 74 69 76 65 20 69 73 20 75 6e 73 70 65 63 | here.is.no.alternative.is.unspec |
| d9740 | 69 66 69 65 64 20 69 6e 20 53 63 68 65 6d 65 3b 20 77 65 20 68 61 76 65 20 63 68 6f 73 65 6e 20 | ified.in.Scheme;.we.have.chosen. |
| d9760 | 68 65 72 65 0a 74 6f 20 6d 61 6b 65 20 69 74 20 66 61 6c 73 65 2e 20 20 57 65 20 77 69 6c 6c 20 | here.to.make.it.false...We.will. |
| d9780 | 73 75 70 70 6f 72 74 20 74 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 | support.the.use.of.the.variables |
| d97a0 | 20 60 74 72 75 65 27 20 61 6e 64 0a 60 66 61 6c 73 65 27 20 69 6e 20 65 78 70 72 65 73 73 69 6f | .`true'.and.`false'.in.expressio |
| d97c0 | 6e 73 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 62 79 20 62 69 6e 64 69 6e 67 20 74 68 | ns.to.be.evaluated.by.binding.th |
| d97e0 | 65 6d 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 53 | em.in.the.global.environment...S |
| d9800 | 65 65 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 34 3a 3a 2e 0a 0a 20 20 20 28 33 | ee.section.*Note.4-1-4::......(3 |
| d9820 | 29 20 54 68 65 73 65 20 73 65 6c 65 63 74 6f 72 73 20 66 6f 72 20 61 20 6c 69 73 74 20 6f 66 20 | ).These.selectors.for.a.list.of. |
| d9840 | 65 78 70 72 65 73 73 69 6f 6e 73 2d 2d 61 6e 64 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 | expressions--and.the.correspondi |
| d9860 | 6e 67 0a 6f 6e 65 73 20 66 6f 72 20 61 20 6c 69 73 74 20 6f 66 20 6f 70 65 72 61 6e 64 73 2d 2d | ng.ones.for.a.list.of.operands-- |
| d9880 | 61 72 65 20 6e 6f 74 20 69 6e 74 65 6e 64 65 64 20 61 73 20 61 20 64 61 74 61 20 61 62 73 74 72 | are.not.intended.as.a.data.abstr |
| d98a0 | 61 63 74 69 6f 6e 2e 0a 54 68 65 79 20 61 72 65 20 69 6e 74 72 6f 64 75 63 65 64 20 61 73 20 6d | action..They.are.introduced.as.m |
| d98c0 | 6e 65 6d 6f 6e 69 63 20 6e 61 6d 65 73 20 66 6f 72 20 74 68 65 20 62 61 73 69 63 20 6c 69 73 74 | nemonic.names.for.the.basic.list |
| d98e0 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 0a 6f 72 64 65 72 20 74 6f 20 6d 61 6b 65 20 69 74 20 | .operations.in.order.to.make.it. |
| d9900 | 65 61 73 69 65 72 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 74 68 65 20 65 78 70 6c 69 63 69 | easier.to.understand.the.explici |
| d9920 | 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a | t-control.evaluator.in.section.* |
| d9940 | 4e 6f 74 65 20 35 2d 34 3a 3a 2e 0a 0a 20 20 20 28 34 29 20 54 68 65 20 76 61 6c 75 65 20 6f 66 | Note.5-4::......(4).The.value.of |
| d9960 | 20 61 20 60 63 6f 6e 64 27 20 65 78 70 72 65 73 73 69 6f 6e 20 77 68 65 6e 20 61 6c 6c 20 74 68 | .a.`cond'.expression.when.all.th |
| d9980 | 65 20 70 72 65 64 69 63 61 74 65 73 20 61 72 65 0a 66 61 6c 73 65 20 61 6e 64 20 74 68 65 72 65 | e.predicates.are.false.and.there |
| d99a0 | 20 69 73 20 6e 6f 20 60 65 6c 73 65 27 20 63 6c 61 75 73 65 20 69 73 20 75 6e 73 70 65 63 69 66 | .is.no.`else'.clause.is.unspecif |
| d99c0 | 69 65 64 20 69 6e 20 53 63 68 65 6d 65 3b 20 77 65 20 68 61 76 65 0a 63 68 6f 73 65 6e 20 68 65 | ied.in.Scheme;.we.have.chosen.he |
| d99e0 | 72 65 20 74 6f 20 6d 61 6b 65 20 69 74 20 66 61 6c 73 65 2e 0a 0a 20 20 20 28 35 29 20 50 72 61 | re.to.make.it.false......(5).Pra |
| d9a00 | 63 74 69 63 61 6c 20 4c 69 73 70 20 73 79 73 74 65 6d 73 20 70 72 6f 76 69 64 65 20 61 20 6d 65 | ctical.Lisp.systems.provide.a.me |
| d9a20 | 63 68 61 6e 69 73 6d 20 74 68 61 74 20 61 6c 6c 6f 77 73 20 61 20 75 73 65 72 20 74 6f 0a 61 64 | chanism.that.allows.a.user.to.ad |
| d9a40 | 64 20 6e 65 77 20 64 65 72 69 76 65 64 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 6e 64 20 73 70 | d.new.derived.expressions.and.sp |
| d9a60 | 65 63 69 66 79 20 74 68 65 69 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 61 73 0a 73 79 | ecify.their.implementation.as.sy |
| d9a80 | 6e 74 61 63 74 69 63 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 73 20 77 69 74 68 6f 75 74 20 | ntactic.transformations.without. |
| d9aa0 | 6d 6f 64 69 66 79 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 2e 20 20 53 75 63 68 20 61 | modifying.the.evaluator...Such.a |
| d9ac0 | 0a 75 73 65 72 2d 64 65 66 69 6e 65 64 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 | .user-defined.transformation.is. |
| d9ae0 | 63 61 6c 6c 65 64 20 61 20 22 6d 61 63 72 6f 22 2e 20 20 41 6c 74 68 6f 75 67 68 20 69 74 20 69 | called.a."macro"...Although.it.i |
| d9b00 | 73 20 65 61 73 79 0a 74 6f 20 61 64 64 20 61 6e 20 65 6c 65 6d 65 6e 74 61 72 79 20 6d 65 63 68 | s.easy.to.add.an.elementary.mech |
| d9b20 | 61 6e 69 73 6d 20 66 6f 72 20 64 65 66 69 6e 69 6e 67 20 6d 61 63 72 6f 73 2c 20 74 68 65 20 72 | anism.for.defining.macros,.the.r |
| d9b40 | 65 73 75 6c 74 69 6e 67 0a 6c 61 6e 67 75 61 67 65 20 68 61 73 20 73 75 62 74 6c 65 20 6e 61 6d | esulting.language.has.subtle.nam |
| d9b60 | 65 2d 63 6f 6e 66 6c 69 63 74 20 70 72 6f 62 6c 65 6d 73 2e 20 20 54 68 65 72 65 20 68 61 73 20 | e-conflict.problems...There.has. |
| d9b80 | 62 65 65 6e 20 6d 75 63 68 0a 72 65 73 65 61 72 63 68 20 6f 6e 20 6d 65 63 68 61 6e 69 73 6d 73 | been.much.research.on.mechanisms |
| d9ba0 | 20 66 6f 72 20 6d 61 63 72 6f 20 64 65 66 69 6e 69 74 69 6f 6e 20 74 68 61 74 20 64 6f 20 6e 6f | .for.macro.definition.that.do.no |
| d9bc0 | 74 20 63 61 75 73 65 20 74 68 65 73 65 0a 64 69 66 66 69 63 75 6c 74 69 65 73 2e 20 20 53 65 65 | t.cause.these.difficulties...See |
| d9be0 | 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 4b 6f 68 6c 62 65 63 6b 65 72 20 31 39 38 36 2c 20 | ,.for.example,.Kohlbecker.1986,. |
| d9c00 | 43 6c 69 6e 67 65 72 20 61 6e 64 20 52 65 65 73 0a 31 39 39 31 2c 20 61 6e 64 20 48 61 6e 73 6f | Clinger.and.Rees.1991,.and.Hanso |
| d9c20 | 6e 20 31 39 39 31 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 | n.1991.....File:.sicp.info,..Nod |
| d9c40 | 65 3a 20 34 2d 31 2d 33 2c 20 20 4e 65 78 74 3a 20 34 2d 31 2d 34 2c 20 20 50 72 65 76 3a 20 34 | e:.4-1-3,..Next:.4-1-4,..Prev:.4 |
| d9c60 | 2d 31 2d 32 2c 20 20 55 70 3a 20 34 2d 31 0a 0a 34 2e 31 2e 33 20 45 76 61 6c 75 61 74 6f 72 20 | -1-2,..Up:.4-1..4.1.3.Evaluator. |
| d9c80 | 44 61 74 61 20 53 74 72 75 63 74 75 72 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | Data.Structures.---------------- |
| d9ca0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 | ---------------..In.addition.to. |
| d9cc0 | 64 65 66 69 6e 69 6e 67 20 74 68 65 20 65 78 74 65 72 6e 61 6c 20 73 79 6e 74 61 78 20 6f 66 20 | defining.the.external.syntax.of. |
| d9ce0 | 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 20 69 6d 70 6c 65 | expressions,.the.evaluator.imple |
| d9d00 | 6d 65 6e 74 61 74 69 6f 6e 20 6d 75 73 74 20 61 6c 73 6f 20 64 65 66 69 6e 65 20 74 68 65 20 64 | mentation.must.also.define.the.d |
| d9d20 | 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 74 68 61 74 20 74 68 65 0a 65 76 61 6c 75 61 74 6f | ata.structures.that.the.evaluato |
| d9d40 | 72 20 6d 61 6e 69 70 75 6c 61 74 65 73 20 69 6e 74 65 72 6e 61 6c 6c 79 2c 20 61 73 20 70 61 72 | r.manipulates.internally,.as.par |
| d9d60 | 74 20 6f 66 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 61 0a 70 72 6f 67 72 61 6d 2c | t.of.the.execution.of.a.program, |
| d9d80 | 20 73 75 63 68 20 61 73 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 | .such.as.the.representation.of.p |
| d9da0 | 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 61 6e 64 0a 74 | rocedures.and.environments.and.t |
| d9dc0 | 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 72 75 65 20 61 6e 64 20 66 61 | he.representation.of.true.and.fa |
| d9de0 | 6c 73 65 2e 0a 0a 54 65 73 74 69 6e 67 20 6f 66 20 70 72 65 64 69 63 61 74 65 73 0a 2e 2e 2e 2e | lse...Testing.of.predicates..... |
| d9e00 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 46 6f 72 20 63 6f 6e 64 69 74 69 6f 6e | ...................For.condition |
| d9e20 | 61 6c 73 2c 20 77 65 20 61 63 63 65 70 74 20 61 6e 79 74 68 69 6e 67 20 74 6f 20 62 65 20 74 72 | als,.we.accept.anything.to.be.tr |
| d9e40 | 75 65 20 74 68 61 74 20 69 73 20 6e 6f 74 20 74 68 65 20 65 78 70 6c 69 63 69 74 0a 60 66 61 6c | ue.that.is.not.the.explicit.`fal |
| d9e60 | 73 65 27 20 6f 62 6a 65 63 74 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 75 65 3f | se'.object........(define.(true? |
| d9e80 | 20 78 29 0a 20 20 20 20 20 20 20 28 6e 6f 74 20 28 65 71 3f 20 78 20 66 61 6c 73 65 29 29 29 0a | .x)........(not.(eq?.x.false))). |
| d9ea0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 6c 73 65 3f 20 78 29 0a 20 20 20 20 20 20 20 | ......(define.(false?.x)........ |
| d9ec0 | 28 65 71 3f 20 78 20 66 61 6c 73 65 29 29 0a 0a 52 65 70 72 65 73 65 6e 74 69 6e 67 20 70 72 6f | (eq?.x.false))..Representing.pro |
| d9ee0 | 63 65 64 75 72 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a | cedures......................... |
| d9f00 | 0a 54 6f 20 68 61 6e 64 6c 65 20 70 72 69 6d 69 74 69 76 65 73 2c 20 77 65 20 61 73 73 75 6d 65 | .To.handle.primitives,.we.assume |
| d9f20 | 20 74 68 61 74 20 77 65 20 68 61 76 65 20 61 76 61 69 6c 61 62 6c 65 20 74 68 65 20 66 6f 6c 6c | .that.we.have.available.the.foll |
| d9f40 | 6f 77 69 6e 67 0a 70 72 6f 63 65 64 75 72 65 73 3a 0a 0a 20 20 20 2a 20 60 28 61 70 70 6c 79 2d | owing.procedures:.....*.`(apply- |
| d9f60 | 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 20 3c 50 52 4f 43 3e 20 3c 41 52 47 53 | primitive-procedure.<PROC>.<ARGS |
| d9f80 | 3e 29 27 0a 0a 20 20 20 20 20 61 70 70 6c 69 65 73 20 74 68 65 20 67 69 76 65 6e 20 70 72 69 6d | >)'.......applies.the.given.prim |
| d9fa0 | 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 | itive.procedure.to.the.argument. |
| d9fc0 | 76 61 6c 75 65 73 20 69 6e 0a 20 20 20 20 20 74 68 65 20 6c 69 73 74 20 3c 41 52 47 53 3e 20 61 | values.in......the.list.<ARGS>.a |
| d9fe0 | 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 74 68 65 20 61 70 70 | nd.returns.the.result.of.the.app |
| da000 | 6c 69 63 61 74 69 6f 6e 2e 0a 0a 20 20 20 2a 20 60 28 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 | lication......*.`(primitive-proc |
| da020 | 65 64 75 72 65 3f 20 3c 50 52 4f 43 3e 29 27 0a 0a 20 20 20 20 20 74 65 73 74 73 20 77 68 65 74 | edure?.<PROC>)'.......tests.whet |
| da040 | 68 65 72 20 3c 50 52 4f 43 3e 20 69 73 20 61 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 | her.<PROC>.is.a.primitive.proced |
| da060 | 75 72 65 2e 0a 0a 0a 20 20 20 54 68 65 73 65 20 6d 65 63 68 61 6e 69 73 6d 73 20 66 6f 72 20 68 | ure.......These.mechanisms.for.h |
| da080 | 61 6e 64 6c 69 6e 67 20 70 72 69 6d 69 74 69 76 65 73 20 61 72 65 20 66 75 72 74 68 65 72 20 64 | andling.primitives.are.further.d |
| da0a0 | 65 73 63 72 69 62 65 64 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 34 3a | escribed.in.section.*Note.4-1-4: |
| da0c0 | 3a 2e 0a 0a 20 20 20 43 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 63 | :......Compound.procedures.are.c |
| da0e0 | 6f 6e 73 74 72 75 63 74 65 64 20 66 72 6f 6d 20 70 61 72 61 6d 65 74 65 72 73 2c 20 70 72 6f 63 | onstructed.from.parameters,.proc |
| da100 | 65 64 75 72 65 0a 62 6f 64 69 65 73 2c 20 61 6e 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 75 | edure.bodies,.and.environments.u |
| da120 | 73 69 6e 67 20 74 68 65 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 60 6d 61 6b 65 2d 70 72 6f 63 65 | sing.the.constructor.`make-proce |
| da140 | 64 75 72 65 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 70 72 6f 63 65 | dure':.......(define.(make-proce |
| da160 | 64 75 72 65 20 70 61 72 61 6d 65 74 65 72 73 20 62 6f 64 79 20 65 6e 76 29 0a 20 20 20 20 20 20 | dure.parameters.body.env)....... |
| da180 | 20 28 6c 69 73 74 20 27 70 72 6f 63 65 64 75 72 65 20 70 61 72 61 6d 65 74 65 72 73 20 62 6f 64 | .(list.'procedure.parameters.bod |
| da1a0 | 79 20 65 6e 76 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 6f 75 6e 64 2d | y.env)).......(define.(compound- |
| da1c0 | 70 72 6f 63 65 64 75 72 65 3f 20 70 29 0a 20 20 20 20 20 20 20 28 74 61 67 67 65 64 2d 6c 69 73 | procedure?.p)........(tagged-lis |
| da1e0 | 74 3f 20 70 20 27 70 72 6f 63 65 64 75 72 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | t?.p.'procedure)).......(define. |
| da200 | 28 70 72 6f 63 65 64 75 72 65 2d 70 61 72 61 6d 65 74 65 72 73 20 70 29 20 28 63 61 64 72 20 70 | (procedure-parameters.p).(cadr.p |
| da220 | 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 63 65 64 75 72 65 2d 62 6f 64 79 | )).......(define.(procedure-body |
| da240 | 20 70 29 20 28 63 61 64 64 72 20 70 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 | .p).(caddr.p)).......(define.(pr |
| da260 | 6f 63 65 64 75 72 65 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 70 29 20 28 63 61 64 64 64 72 20 70 | ocedure-environment.p).(cadddr.p |
| da280 | 29 29 0a 0a 4f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 73 0a 2e | ))..Operations.on.Environments.. |
| da2a0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 65 | ...........................The.e |
| da2c0 | 76 61 6c 75 61 74 6f 72 20 6e 65 65 64 73 20 6f 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 6d 61 | valuator.needs.operations.for.ma |
| da2e0 | 6e 69 70 75 6c 61 74 69 6e 67 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 2e 20 20 41 73 0a 65 78 70 | nipulating.environments...As.exp |
| da300 | 6c 61 69 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 32 3a 3a 2c 20 61 | lained.in.section.*Note.3-2::,.a |
| da320 | 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 66 | n.environment.is.a.sequence.of.f |
| da340 | 72 61 6d 65 73 2c 20 77 68 65 72 65 20 65 61 63 68 20 66 72 61 6d 65 20 69 73 20 61 20 74 61 62 | rames,.where.each.frame.is.a.tab |
| da360 | 6c 65 20 6f 66 20 62 69 6e 64 69 6e 67 73 20 74 68 61 74 20 61 73 73 6f 63 69 61 74 65 0a 76 61 | le.of.bindings.that.associate.va |
| da380 | 72 69 61 62 6c 65 73 20 77 69 74 68 20 74 68 65 69 72 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 | riables.with.their.corresponding |
| da3a0 | 20 76 61 6c 75 65 73 2e 20 20 57 65 20 75 73 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 6f | .values...We.use.the.following.o |
| da3c0 | 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 65 6e 76 69 72 | perations.for.manipulating.envir |
| da3e0 | 6f 6e 6d 65 6e 74 73 3a 0a 0a 20 20 20 2a 20 60 28 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 | onments:.....*.`(lookup-variable |
| da400 | 2d 76 61 6c 75 65 20 3c 56 41 52 3e 20 3c 45 4e 56 3e 29 27 0a 0a 20 20 20 20 20 72 65 74 75 72 | -value.<VAR>.<ENV>)'.......retur |
| da420 | 6e 73 20 74 68 65 20 76 61 6c 75 65 20 74 68 61 74 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 74 68 | ns.the.value.that.is.bound.to.th |
| da440 | 65 20 73 79 6d 62 6f 6c 20 3c 56 41 52 3e 20 69 6e 20 74 68 65 0a 20 20 20 20 20 65 6e 76 69 72 | e.symbol.<VAR>.in.the......envir |
| da460 | 6f 6e 6d 65 6e 74 20 3c 45 4e 56 3e 2c 20 6f 72 20 73 69 67 6e 61 6c 73 20 61 6e 20 65 72 72 6f | onment.<ENV>,.or.signals.an.erro |
| da480 | 72 20 69 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 73 20 75 6e 62 6f 75 6e 64 2e 0a 0a 20 | r.if.the.variable.is.unbound.... |
| da4a0 | 20 20 2a 20 60 28 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 3c 56 41 52 49 41 42 | ..*.`(extend-environment.<VARIAB |
| da4c0 | 4c 45 53 3e 20 3c 56 41 4c 55 45 53 3e 20 3c 42 41 53 45 2d 45 4e 56 3e 29 27 0a 0a 20 20 20 20 | LES>.<VALUES>.<BASE-ENV>)'...... |
| da4e0 | 20 72 65 74 75 72 6e 73 20 61 20 6e 65 77 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 63 6f 6e 73 | .returns.a.new.environment,.cons |
| da500 | 69 73 74 69 6e 67 20 6f 66 20 61 20 6e 65 77 20 66 72 61 6d 65 20 69 6e 20 77 68 69 63 68 20 74 | isting.of.a.new.frame.in.which.t |
| da520 | 68 65 0a 20 20 20 20 20 73 79 6d 62 6f 6c 73 20 69 6e 20 74 68 65 20 6c 69 73 74 20 3c 56 41 52 | he......symbols.in.the.list.<VAR |
| da540 | 49 41 42 4c 45 53 3e 20 61 72 65 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 63 6f 72 72 65 73 70 | IABLES>.are.bound.to.the.corresp |
| da560 | 6f 6e 64 69 6e 67 0a 20 20 20 20 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 6c 69 73 74 | onding......elements.in.the.list |
| da580 | 20 3c 56 41 4c 55 45 53 3e 2c 20 77 68 65 72 65 20 74 68 65 20 65 6e 63 6c 6f 73 69 6e 67 20 65 | .<VALUES>,.where.the.enclosing.e |
| da5a0 | 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 0a 20 20 20 20 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 | nvironment.is......the.environme |
| da5c0 | 6e 74 20 3c 42 41 53 45 2d 45 4e 56 3e 2e 0a 0a 20 20 20 2a 20 60 28 64 65 66 69 6e 65 2d 76 61 | nt.<BASE-ENV>......*.`(define-va |
| da5e0 | 72 69 61 62 6c 65 21 20 3c 56 41 52 3e 20 3c 56 41 4c 55 45 3e 20 3c 45 4e 56 3e 29 27 0a 0a 20 | riable!.<VAR>.<VALUE>.<ENV>)'... |
| da600 | 20 20 20 20 61 64 64 73 20 74 6f 20 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 20 69 6e 20 74 | ....adds.to.the.first.frame.in.t |
| da620 | 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 3c 45 4e 56 3e 20 61 20 6e 65 77 20 62 69 6e 64 69 | he.environment.<ENV>.a.new.bindi |
| da640 | 6e 67 20 74 68 61 74 0a 20 20 20 20 20 61 73 73 6f 63 69 61 74 65 73 20 74 68 65 20 76 61 72 69 | ng.that......associates.the.vari |
| da660 | 61 62 6c 65 20 3c 56 41 52 3e 20 77 69 74 68 20 74 68 65 20 76 61 6c 75 65 20 3c 56 41 4c 55 45 | able.<VAR>.with.the.value.<VALUE |
| da680 | 3e 2e 0a 0a 20 20 20 2a 20 60 28 73 65 74 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 21 20 3c | >......*.`(set-variable-value!.< |
| da6a0 | 56 41 52 3e 20 3c 56 41 4c 55 45 3e 20 3c 45 4e 56 3e 29 27 0a 0a 20 20 20 20 20 63 68 61 6e 67 | VAR>.<VALUE>.<ENV>)'.......chang |
| da6c0 | 65 73 20 74 68 65 20 62 69 6e 64 69 6e 67 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 3c | es.the.binding.of.the.variable.< |
| da6e0 | 56 41 52 3e 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 3c 45 4e 56 3e 0a 20 20 | VAR>.in.the.environment.<ENV>... |
| da700 | 20 20 20 73 6f 20 74 68 61 74 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 73 20 6e 6f 77 20 62 | ...so.that.the.variable.is.now.b |
| da720 | 6f 75 6e 64 20 74 6f 20 74 68 65 20 76 61 6c 75 65 20 3c 56 41 4c 55 45 3e 2c 20 6f 72 20 73 69 | ound.to.the.value.<VALUE>,.or.si |
| da740 | 67 6e 61 6c 73 0a 20 20 20 20 20 61 6e 20 65 72 72 6f 72 20 69 66 20 74 68 65 20 76 61 72 69 61 | gnals......an.error.if.the.varia |
| da760 | 62 6c 65 20 69 73 20 75 6e 62 6f 75 6e 64 2e 0a 0a 0a 20 20 20 54 6f 20 69 6d 70 6c 65 6d 65 6e | ble.is.unbound.......To.implemen |
| da780 | 74 20 74 68 65 73 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 65 20 72 65 70 72 65 73 65 6e 74 20 | t.these.operations.we.represent. |
| da7a0 | 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 73 20 61 20 6c 69 73 74 0a 6f 66 20 66 72 61 6d | an.environment.as.a.list.of.fram |
| da7c0 | 65 73 2e 20 20 54 68 65 20 65 6e 63 6c 6f 73 69 6e 67 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6f | es...The.enclosing.environment.o |
| da7e0 | 66 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 74 68 65 20 60 63 64 72 27 20 6f 66 | f.an.environment.is.the.`cdr'.of |
| da800 | 0a 74 68 65 20 6c 69 73 74 2e 20 20 54 68 65 20 65 6d 70 74 79 20 65 6e 76 69 72 6f 6e 6d 65 6e | .the.list...The.empty.environmen |
| da820 | 74 20 69 73 20 73 69 6d 70 6c 79 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 2e 0a 0a 20 20 20 | t.is.simply.the.empty.list...... |
| da840 | 20 20 28 64 65 66 69 6e 65 20 28 65 6e 63 6c 6f 73 69 6e 67 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 | ..(define.(enclosing-environment |
| da860 | 20 65 6e 76 29 20 28 63 64 72 20 65 6e 76 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | .env).(cdr.env)).......(define.( |
| da880 | 66 69 72 73 74 2d 66 72 61 6d 65 20 65 6e 76 29 20 28 63 61 72 20 65 6e 76 29 29 0a 0a 20 20 20 | first-frame.env).(car.env))..... |
| da8a0 | 20 20 28 64 65 66 69 6e 65 20 74 68 65 2d 65 6d 70 74 79 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 | ..(define.the-empty-environment. |
| da8c0 | 27 28 29 29 0a 0a 20 20 20 45 61 63 68 20 66 72 61 6d 65 20 6f 66 20 61 6e 20 65 6e 76 69 72 6f | '()).....Each.frame.of.an.enviro |
| da8e0 | 6e 6d 65 6e 74 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 70 61 69 72 20 6f | nment.is.represented.as.a.pair.o |
| da900 | 66 20 6c 69 73 74 73 3a 20 61 0a 6c 69 73 74 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 | f.lists:.a.list.of.the.variables |
| da920 | 20 62 6f 75 6e 64 20 69 6e 20 74 68 61 74 20 66 72 61 6d 65 20 61 6e 64 20 61 20 6c 69 73 74 20 | .bound.in.that.frame.and.a.list. |
| da940 | 6f 66 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 0a 76 61 6c 75 65 73 2e 28 31 29 0a 0a 20 20 | of.the.associated.values.(1).... |
| da960 | 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 66 72 61 6d 65 20 76 61 72 69 61 62 6c 65 73 | ...(define.(make-frame.variables |
| da980 | 20 76 61 6c 75 65 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 20 76 61 72 69 61 62 6c 65 73 20 | .values)........(cons.variables. |
| da9a0 | 76 61 6c 75 65 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 72 61 6d 65 2d 76 61 | values)).......(define.(frame-va |
| da9c0 | 72 69 61 62 6c 65 73 20 66 72 61 6d 65 29 20 28 63 61 72 20 66 72 61 6d 65 29 29 0a 0a 20 20 20 | riables.frame).(car.frame))..... |
| da9e0 | 20 20 28 64 65 66 69 6e 65 20 28 66 72 61 6d 65 2d 76 61 6c 75 65 73 20 66 72 61 6d 65 29 20 28 | ..(define.(frame-values.frame).( |
| daa00 | 63 64 72 20 66 72 61 6d 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 62 | cdr.frame)).......(define.(add-b |
| daa20 | 69 6e 64 69 6e 67 2d 74 6f 2d 66 72 61 6d 65 21 20 76 61 72 20 76 61 6c 20 66 72 61 6d 65 29 0a | inding-to-frame!.var.val.frame). |
| daa40 | 20 20 20 20 20 20 20 28 73 65 74 2d 63 61 72 21 20 66 72 61 6d 65 20 28 63 6f 6e 73 20 76 61 72 | .......(set-car!.frame.(cons.var |
| daa60 | 20 28 63 61 72 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 20 | .(car.frame)))........(set-cdr!. |
| daa80 | 66 72 61 6d 65 20 28 63 6f 6e 73 20 76 61 6c 20 28 63 64 72 20 66 72 61 6d 65 29 29 29 29 0a 0a | frame.(cons.val.(cdr.frame)))).. |
| daaa0 | 20 20 20 54 6f 20 65 78 74 65 6e 64 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 62 79 20 61 | ...To.extend.an.environment.by.a |
| daac0 | 20 6e 65 77 20 66 72 61 6d 65 20 74 68 61 74 20 61 73 73 6f 63 69 61 74 65 73 20 76 61 72 69 61 | .new.frame.that.associates.varia |
| daae0 | 62 6c 65 73 0a 77 69 74 68 20 76 61 6c 75 65 73 2c 20 77 65 20 6d 61 6b 65 20 61 20 66 72 61 6d | bles.with.values,.we.make.a.fram |
| dab00 | 65 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 74 68 65 20 6c 69 73 74 20 6f 66 20 76 61 72 69 | e.consisting.of.the.list.of.vari |
| dab20 | 61 62 6c 65 73 20 61 6e 64 0a 74 68 65 20 6c 69 73 74 20 6f 66 20 76 61 6c 75 65 73 2c 20 61 6e | ables.and.the.list.of.values,.an |
| dab40 | 64 20 77 65 20 61 64 6a 6f 69 6e 20 74 68 69 73 20 74 6f 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d | d.we.adjoin.this.to.the.environm |
| dab60 | 65 6e 74 2e 20 20 57 65 20 73 69 67 6e 61 6c 0a 61 6e 20 65 72 72 6f 72 20 69 66 20 74 68 65 20 | ent...We.signal.an.error.if.the. |
| dab80 | 6e 75 6d 62 65 72 20 6f 66 20 76 61 72 69 61 62 6c 65 73 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 | number.of.variables.does.not.mat |
| daba0 | 63 68 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 76 61 6c 75 65 73 2e 0a 0a 20 20 20 20 20 28 | ch.the.number.of.values........( |
| dabc0 | 64 65 66 69 6e 65 20 28 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 73 20 | define.(extend-environment.vars. |
| dabe0 | 76 61 6c 73 20 62 61 73 65 2d 65 6e 76 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 28 6c 65 | vals.base-env)........(if.(=.(le |
| dac00 | 6e 67 74 68 20 76 61 72 73 29 20 28 6c 65 6e 67 74 68 20 76 61 6c 73 29 29 0a 20 20 20 20 20 20 | ngth.vars).(length.vals))....... |
| dac20 | 20 20 20 20 20 28 63 6f 6e 73 20 28 6d 61 6b 65 2d 66 72 61 6d 65 20 76 61 72 73 20 76 61 6c 73 | .....(cons.(make-frame.vars.vals |
| dac40 | 29 20 62 61 73 65 2d 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3c 20 28 6c | ).base-env)............(if.(<.(l |
| dac60 | 65 6e 67 74 68 20 76 61 72 73 29 20 28 6c 65 6e 67 74 68 20 76 61 6c 73 29 29 0a 20 20 20 20 20 | ength.vars).(length.vals))...... |
| dac80 | 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 54 6f 6f 20 6d 61 6e 79 20 61 72 67 75 6d | ..........(error."Too.many.argum |
| daca0 | 65 6e 74 73 20 73 75 70 70 6c 69 65 64 22 20 76 61 72 73 20 76 61 6c 73 29 0a 20 20 20 20 20 20 | ents.supplied".vars.vals)....... |
| dacc0 | 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 54 6f 6f 20 66 65 77 20 61 72 67 75 6d 65 6e | .........(error."Too.few.argumen |
| dace0 | 74 73 20 73 75 70 70 6c 69 65 64 22 20 76 61 72 73 20 76 61 6c 73 29 29 29 29 0a 0a 20 20 20 54 | ts.supplied".vars.vals)))).....T |
| dad00 | 6f 20 6c 6f 6f 6b 20 75 70 20 61 20 76 61 72 69 61 62 6c 65 20 69 6e 20 61 6e 20 65 6e 76 69 72 | o.look.up.a.variable.in.an.envir |
| dad20 | 6f 6e 6d 65 6e 74 2c 20 77 65 20 73 63 61 6e 20 74 68 65 20 6c 69 73 74 20 6f 66 0a 76 61 72 69 | onment,.we.scan.the.list.of.vari |
| dad40 | 61 62 6c 65 73 20 69 6e 20 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 2e 20 20 49 66 20 77 65 | ables.in.the.first.frame...If.we |
| dad60 | 20 66 69 6e 64 20 74 68 65 20 64 65 73 69 72 65 64 20 76 61 72 69 61 62 6c 65 2c 20 77 65 0a 72 | .find.the.desired.variable,.we.r |
| dad80 | 65 74 75 72 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 65 6c 65 6d 65 6e 74 20 | eturn.the.corresponding.element. |
| dada0 | 69 6e 20 74 68 65 20 6c 69 73 74 20 6f 66 20 76 61 6c 75 65 73 2e 20 20 49 66 20 77 65 20 64 6f | in.the.list.of.values...If.we.do |
| dadc0 | 20 6e 6f 74 0a 66 69 6e 64 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 6e 20 74 68 65 20 63 75 | .not.find.the.variable.in.the.cu |
| dade0 | 72 72 65 6e 74 20 66 72 61 6d 65 2c 20 77 65 20 73 65 61 72 63 68 20 74 68 65 20 65 6e 63 6c 6f | rrent.frame,.we.search.the.enclo |
| dae00 | 73 69 6e 67 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 20 49 66 | sing.environment,.and.so.on...If |
| dae20 | 20 77 65 20 72 65 61 63 68 20 74 68 65 20 65 6d 70 74 79 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c | .we.reach.the.empty.environment, |
| dae40 | 20 77 65 20 73 69 67 6e 61 6c 0a 61 6e 20 22 75 6e 62 6f 75 6e 64 20 76 61 72 69 61 62 6c 65 22 | .we.signal.an."unbound.variable" |
| dae60 | 20 65 72 72 6f 72 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 6b 75 70 2d 76 61 | .error........(define.(lookup-va |
| dae80 | 72 69 61 62 6c 65 2d 76 61 6c 75 65 20 76 61 72 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 64 65 | riable-value.var.env)........(de |
| daea0 | 66 69 6e 65 20 28 65 6e 76 2d 6c 6f 6f 70 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 | fine.(env-loop.env)..........(de |
| daec0 | 66 69 6e 65 20 28 73 63 61 6e 20 76 61 72 73 20 76 61 6c 73 29 0a 20 20 20 20 20 20 20 20 20 20 | fine.(scan.vars.vals)........... |
| daee0 | 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 76 61 72 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(cond.((null?.vars)............ |
| daf00 | 20 20 20 20 20 20 20 28 65 6e 76 2d 6c 6f 6f 70 20 28 65 6e 63 6c 6f 73 69 6e 67 2d 65 6e 76 69 | .......(env-loop.(enclosing-envi |
| daf20 | 72 6f 6e 6d 65 6e 74 20 65 6e 76 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ronment.env))).................. |
| daf40 | 28 28 65 71 3f 20 76 61 72 20 28 63 61 72 20 76 61 72 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 | ((eq?.var.(car.vars))........... |
| daf60 | 20 20 20 20 20 20 20 20 28 63 61 72 20 76 61 6c 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ........(car.vals))............. |
| daf80 | 20 20 20 20 20 28 65 6c 73 65 20 28 73 63 61 6e 20 28 63 64 72 20 76 61 72 73 29 20 28 63 64 72 | .....(else.(scan.(cdr.vars).(cdr |
| dafa0 | 20 76 61 6c 73 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 71 3f 20 65 6e 76 | .vals)))))..........(if.(eq?.env |
| dafc0 | 20 74 68 65 2d 65 6d 70 74 79 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 0a 20 20 20 20 20 20 20 20 | .the-empty-environment)......... |
| dafe0 | 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 62 6f 75 6e 64 20 76 61 72 69 61 62 6c 65 22 20 76 | .....(error."Unbound.variable".v |
| db000 | 61 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 66 72 61 6d 65 20 28 66 | ar)..............(let.((frame.(f |
| db020 | 69 72 73 74 2d 66 72 61 6d 65 20 65 6e 76 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | irst-frame.env)))............... |
| db040 | 20 28 73 63 61 6e 20 28 66 72 61 6d 65 2d 76 61 72 69 61 62 6c 65 73 20 66 72 61 6d 65 29 0a 20 | .(scan.(frame-variables.frame).. |
| db060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 72 61 6d 65 2d 76 61 6c 75 65 | ....................(frame-value |
| db080 | 73 20 66 72 61 6d 65 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 65 6e 76 2d 6c 6f 6f 70 20 65 6e | s.frame)))))........(env-loop.en |
| db0a0 | 76 29 29 0a 0a 20 20 20 54 6f 20 73 65 74 20 61 20 76 61 72 69 61 62 6c 65 20 74 6f 20 61 20 6e | v)).....To.set.a.variable.to.a.n |
| db0c0 | 65 77 20 76 61 6c 75 65 20 69 6e 20 61 20 73 70 65 63 69 66 69 65 64 20 65 6e 76 69 72 6f 6e 6d | ew.value.in.a.specified.environm |
| db0e0 | 65 6e 74 2c 20 77 65 20 73 63 61 6e 0a 66 6f 72 20 74 68 65 20 76 61 72 69 61 62 6c 65 2c 20 6a | ent,.we.scan.for.the.variable,.j |
| db100 | 75 73 74 20 61 73 20 69 6e 20 60 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 | ust.as.in.`lookup-variable-value |
| db120 | 27 2c 20 61 6e 64 20 63 68 61 6e 67 65 20 74 68 65 0a 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 | ',.and.change.the.corresponding. |
| db140 | 76 61 6c 75 65 20 77 68 65 6e 20 77 65 20 66 69 6e 64 20 69 74 2e 0a 0a 20 20 20 20 20 28 64 65 | value.when.we.find.it........(de |
| db160 | 66 69 6e 65 20 28 73 65 74 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 21 20 76 61 72 20 76 61 | fine.(set-variable-value!.var.va |
| db180 | 6c 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6e 76 2d 6c 6f 6f 70 20 | l.env)........(define.(env-loop. |
| db1a0 | 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 63 61 6e 20 76 61 72 73 | env)..........(define.(scan.vars |
| db1c0 | 20 76 61 6c 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 | .vals)............(cond.((null?. |
| db1e0 | 76 61 72 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 76 2d 6c 6f 6f | vars)...................(env-loo |
| db200 | 70 20 28 65 6e 63 6c 6f 73 69 6e 67 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 65 6e 76 29 29 29 0a | p.(enclosing-environment.env))). |
| db220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 76 61 72 20 28 63 61 72 20 | .................((eq?.var.(car. |
| db240 | 76 61 72 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 61 | vars))...................(set-ca |
| db260 | 72 21 20 76 61 6c 73 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | r!.vals.val))..................( |
| db280 | 65 6c 73 65 20 28 73 63 61 6e 20 28 63 64 72 20 76 61 72 73 29 20 28 63 64 72 20 76 61 6c 73 29 | else.(scan.(cdr.vars).(cdr.vals) |
| db2a0 | 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 71 3f 20 65 6e 76 20 74 68 65 2d 65 | ))))..........(if.(eq?.env.the-e |
| db2c0 | 6d 70 74 79 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | mpty-environment)..............( |
| db2e0 | 65 72 72 6f 72 20 22 55 6e 62 6f 75 6e 64 20 76 61 72 69 61 62 6c 65 20 2d 2d 20 53 45 54 21 22 | error."Unbound.variable.--.SET!" |
| db300 | 20 76 61 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 66 72 61 6d 65 20 | .var)..............(let.((frame. |
| db320 | 28 66 69 72 73 74 2d 66 72 61 6d 65 20 65 6e 76 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | (first-frame.env)))............. |
| db340 | 20 20 20 28 73 63 61 6e 20 28 66 72 61 6d 65 2d 76 61 72 69 61 62 6c 65 73 20 66 72 61 6d 65 29 | ...(scan.(frame-variables.frame) |
| db360 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 72 61 6d 65 2d 76 61 6c | ......................(frame-val |
| db380 | 75 65 73 20 66 72 61 6d 65 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 65 6e 76 2d 6c 6f 6f 70 20 | ues.frame)))))........(env-loop. |
| db3a0 | 65 6e 76 29 29 0a 0a 20 20 20 54 6f 20 64 65 66 69 6e 65 20 61 20 76 61 72 69 61 62 6c 65 2c 20 | env)).....To.define.a.variable,. |
| db3c0 | 77 65 20 73 65 61 72 63 68 20 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 20 66 6f 72 20 61 20 | we.search.the.first.frame.for.a. |
| db3e0 | 62 69 6e 64 69 6e 67 20 66 6f 72 0a 74 68 65 20 76 61 72 69 61 62 6c 65 2c 20 61 6e 64 20 63 68 | binding.for.the.variable,.and.ch |
| db400 | 61 6e 67 65 20 74 68 65 20 62 69 6e 64 69 6e 67 20 69 66 20 69 74 20 65 78 69 73 74 73 20 28 6a | ange.the.binding.if.it.exists.(j |
| db420 | 75 73 74 20 61 73 20 69 6e 0a 60 73 65 74 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 21 27 29 | ust.as.in.`set-variable-value!') |
| db440 | 2e 20 20 49 66 20 6e 6f 20 73 75 63 68 20 62 69 6e 64 69 6e 67 20 65 78 69 73 74 73 2c 20 77 65 | ...If.no.such.binding.exists,.we |
| db460 | 20 61 64 6a 6f 69 6e 20 6f 6e 65 20 74 6f 0a 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 2e 0a | .adjoin.one.to.the.first.frame.. |
| db480 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 66 69 6e 65 2d 76 61 72 69 61 62 6c 65 21 20 | ......(define.(define-variable!. |
| db4a0 | 76 61 72 20 76 61 6c 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 66 72 61 6d 65 | var.val.env)........(let.((frame |
| db4c0 | 20 28 66 69 72 73 74 2d 66 72 61 6d 65 20 65 6e 76 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 | .(first-frame.env)))..........(d |
| db4e0 | 65 66 69 6e 65 20 28 73 63 61 6e 20 76 61 72 73 20 76 61 6c 73 29 0a 20 20 20 20 20 20 20 20 20 | efine.(scan.vars.vals).......... |
| db500 | 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 76 61 72 73 29 0a 20 20 20 20 20 20 20 20 20 20 | ..(cond.((null?.vars)........... |
| db520 | 20 20 20 20 20 20 20 20 28 61 64 64 2d 62 69 6e 64 69 6e 67 2d 74 6f 2d 66 72 61 6d 65 21 20 76 | ........(add-binding-to-frame!.v |
| db540 | 61 72 20 76 61 6c 20 66 72 61 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ar.val.frame)).................. |
| db560 | 28 28 65 71 3f 20 76 61 72 20 28 63 61 72 20 76 61 72 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 | ((eq?.var.(car.vars))........... |
| db580 | 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 61 72 21 20 76 61 6c 73 20 76 61 6c 29 29 0a 20 20 20 | ........(set-car!.vals.val)).... |
| db5a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 73 63 61 6e 20 28 63 64 72 20 76 | ..............(else.(scan.(cdr.v |
| db5c0 | 61 72 73 29 20 28 63 64 72 20 76 61 6c 73 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 73 63 | ars).(cdr.vals)))))..........(sc |
| db5e0 | 61 6e 20 28 66 72 61 6d 65 2d 76 61 72 69 61 62 6c 65 73 20 66 72 61 6d 65 29 0a 20 20 20 20 20 | an.(frame-variables.frame)...... |
| db600 | 20 20 20 20 20 20 20 20 20 20 28 66 72 61 6d 65 2d 76 61 6c 75 65 73 20 66 72 61 6d 65 29 29 29 | ..........(frame-values.frame))) |
| db620 | 29 0a 0a 20 20 20 54 68 65 20 6d 65 74 68 6f 64 20 64 65 73 63 72 69 62 65 64 20 68 65 72 65 20 | ).....The.method.described.here. |
| db640 | 69 73 20 6f 6e 6c 79 20 6f 6e 65 20 6f 66 20 6d 61 6e 79 20 70 6c 61 75 73 69 62 6c 65 20 77 61 | is.only.one.of.many.plausible.wa |
| db660 | 79 73 20 74 6f 0a 72 65 70 72 65 73 65 6e 74 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 2e 20 20 53 | ys.to.represent.environments...S |
| db680 | 69 6e 63 65 20 77 65 20 75 73 65 64 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 74 6f | ince.we.used.data.abstraction.to |
| db6a0 | 20 69 73 6f 6c 61 74 65 20 74 68 65 0a 72 65 73 74 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 | .isolate.the.rest.of.the.evaluat |
| db6c0 | 6f 72 20 66 72 6f 6d 20 74 68 65 20 64 65 74 61 69 6c 65 64 20 63 68 6f 69 63 65 20 6f 66 20 72 | or.from.the.detailed.choice.of.r |
| db6e0 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c 20 77 65 0a 63 6f 75 6c 64 20 63 68 61 6e 67 65 20 74 | epresentation,.we.could.change.t |
| db700 | 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 66 | he.environment.representation.if |
| db720 | 20 77 65 20 77 61 6e 74 65 64 20 74 6f 2e 20 20 28 53 65 65 0a 2a 4e 6f 74 65 20 45 78 65 72 63 | .we.wanted.to...(See.*Note.Exerc |
| db740 | 69 73 65 20 34 2d 31 31 3a 3a 2e 29 20 20 49 6e 20 61 20 70 72 6f 64 75 63 74 69 6f 6e 2d 71 75 | ise.4-11::.)..In.a.production-qu |
| db760 | 61 6c 69 74 79 20 4c 69 73 70 20 73 79 73 74 65 6d 2c 20 74 68 65 20 73 70 65 65 64 0a 6f 66 20 | ality.Lisp.system,.the.speed.of. |
| db780 | 74 68 65 20 65 76 61 6c 75 61 74 6f 72 27 73 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6f 70 65 72 | the.evaluator's.environment.oper |
| db7a0 | 61 74 69 6f 6e 73 2d 2d 65 73 70 65 63 69 61 6c 6c 79 20 74 68 61 74 20 6f 66 20 76 61 72 69 61 | ations--especially.that.of.varia |
| db7c0 | 62 6c 65 0a 6c 6f 6f 6b 75 70 2d 2d 68 61 73 20 61 20 6d 61 6a 6f 72 20 69 6d 70 61 63 74 20 6f | ble.lookup--has.a.major.impact.o |
| db7e0 | 6e 20 74 68 65 20 70 65 72 66 6f 72 6d 61 6e 63 65 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 2e | n.the.performance.of.the.system. |
| db800 | 20 20 54 68 65 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 64 65 73 63 72 69 62 65 64 20 68 | ..The.representation.described.h |
| db820 | 65 72 65 2c 20 61 6c 74 68 6f 75 67 68 20 63 6f 6e 63 65 70 74 75 61 6c 6c 79 20 73 69 6d 70 6c | ere,.although.conceptually.simpl |
| db840 | 65 2c 20 69 73 20 6e 6f 74 0a 65 66 66 69 63 69 65 6e 74 20 61 6e 64 20 77 6f 75 6c 64 20 6e 6f | e,.is.not.efficient.and.would.no |
| db860 | 74 20 6f 72 64 69 6e 61 72 69 6c 79 20 62 65 20 75 73 65 64 20 69 6e 20 61 20 70 72 6f 64 75 63 | t.ordinarily.be.used.in.a.produc |
| db880 | 74 69 6f 6e 20 73 79 73 74 65 6d 2e 28 32 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 | tion.system.(2).......*Exercise. |
| db8a0 | 34 2e 31 31 3a 2a 20 49 6e 73 74 65 61 64 20 6f 66 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 | 4.11:*.Instead.of.representing.a |
| db8c0 | 20 66 72 61 6d 65 20 61 73 20 61 20 70 61 69 72 20 6f 66 0a 20 20 20 20 20 6c 69 73 74 73 2c 20 | .frame.as.a.pair.of......lists,. |
| db8e0 | 77 65 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 20 61 20 66 72 61 6d 65 20 61 73 20 61 20 6c 69 | we.can.represent.a.frame.as.a.li |
| db900 | 73 74 20 6f 66 20 62 69 6e 64 69 6e 67 73 2c 20 77 68 65 72 65 20 65 61 63 68 0a 20 20 20 20 20 | st.of.bindings,.where.each...... |
| db920 | 62 69 6e 64 69 6e 67 20 69 73 20 61 20 6e 61 6d 65 2d 76 61 6c 75 65 20 70 61 69 72 2e 20 20 52 | binding.is.a.name-value.pair...R |
| db940 | 65 77 72 69 74 65 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6f 70 65 72 61 74 69 6f 6e | ewrite.the.environment.operation |
| db960 | 73 0a 20 20 20 20 20 74 6f 20 75 73 65 20 74 68 69 73 20 61 6c 74 65 72 6e 61 74 69 76 65 20 72 | s......to.use.this.alternative.r |
| db980 | 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 | epresentation........*Exercise.4 |
| db9a0 | 2e 31 32 3a 2a 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 73 65 74 2d 76 61 72 69 61 62 | .12:*.The.procedures.`set-variab |
| db9c0 | 6c 65 2d 76 61 6c 75 65 21 27 2c 0a 20 20 20 20 20 60 64 65 66 69 6e 65 2d 76 61 72 69 61 62 6c | le-value!',......`define-variabl |
| db9e0 | 65 21 27 2c 20 61 6e 64 20 60 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 27 | e!',.and.`lookup-variable-value' |
| dba00 | 20 63 61 6e 20 62 65 20 65 78 70 72 65 73 73 65 64 0a 20 20 20 20 20 69 6e 20 74 65 72 6d 73 20 | .can.be.expressed......in.terms. |
| dba20 | 6f 66 20 6d 6f 72 65 20 61 62 73 74 72 61 63 74 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 | of.more.abstract.procedures.for. |
| dba40 | 74 72 61 76 65 72 73 69 6e 67 20 74 68 65 0a 20 20 20 20 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 | traversing.the......environment. |
| dba60 | 73 74 72 75 63 74 75 72 65 2e 20 20 44 65 66 69 6e 65 20 61 62 73 74 72 61 63 74 69 6f 6e 73 20 | structure...Define.abstractions. |
| dba80 | 74 68 61 74 20 63 61 70 74 75 72 65 20 74 68 65 0a 20 20 20 20 20 63 6f 6d 6d 6f 6e 20 70 61 74 | that.capture.the......common.pat |
| dbaa0 | 74 65 72 6e 73 20 61 6e 64 20 72 65 64 65 66 69 6e 65 20 74 68 65 20 74 68 72 65 65 20 70 72 6f | terns.and.redefine.the.three.pro |
| dbac0 | 63 65 64 75 72 65 73 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 73 65 0a 20 20 20 20 20 61 | cedures.in.terms.of.these......a |
| dbae0 | 62 73 74 72 61 63 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 31 | bstractions........*Exercise.4.1 |
| dbb00 | 33 3a 2a 20 53 63 68 65 6d 65 20 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20 63 72 65 61 74 65 20 6e | 3:*.Scheme.allows.us.to.create.n |
| dbb20 | 65 77 20 62 69 6e 64 69 6e 67 73 20 66 6f 72 0a 20 20 20 20 20 76 61 72 69 61 62 6c 65 73 20 62 | ew.bindings.for......variables.b |
| dbb40 | 79 20 6d 65 61 6e 73 20 6f 66 20 60 64 65 66 69 6e 65 27 2c 20 62 75 74 20 70 72 6f 76 69 64 65 | y.means.of.`define',.but.provide |
| dbb60 | 73 20 6e 6f 20 77 61 79 20 74 6f 20 67 65 74 20 72 69 64 20 6f 66 0a 20 20 20 20 20 62 69 6e 64 | s.no.way.to.get.rid.of......bind |
| dbb80 | 69 6e 67 73 2e 20 20 49 6d 70 6c 65 6d 65 6e 74 20 66 6f 72 20 74 68 65 20 65 76 61 6c 75 61 74 | ings...Implement.for.the.evaluat |
| dbba0 | 6f 72 20 61 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 0a 20 20 20 20 20 60 6d 61 6b 65 2d 75 6e 62 | or.a.special.form......`make-unb |
| dbbc0 | 6f 75 6e 64 21 27 20 74 68 61 74 20 72 65 6d 6f 76 65 73 20 74 68 65 20 62 69 6e 64 69 6e 67 20 | ound!'.that.removes.the.binding. |
| dbbe0 | 6f 66 20 61 20 67 69 76 65 6e 20 73 79 6d 62 6f 6c 20 66 72 6f 6d 20 74 68 65 0a 20 20 20 20 20 | of.a.given.symbol.from.the...... |
| dbc00 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 60 6d 61 6b 65 2d 75 | environment.in.which.the.`make-u |
| dbc20 | 6e 62 6f 75 6e 64 21 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 65 76 61 6c 75 61 74 65 64 | nbound!'.expression.is.evaluated |
| dbc40 | 2e 0a 20 20 20 20 20 54 68 69 73 20 70 72 6f 62 6c 65 6d 20 69 73 20 6e 6f 74 20 63 6f 6d 70 6c | .......This.problem.is.not.compl |
| dbc60 | 65 74 65 6c 79 20 73 70 65 63 69 66 69 65 64 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 73 | etely.specified...For.example,.s |
| dbc80 | 68 6f 75 6c 64 20 77 65 0a 20 20 20 20 20 72 65 6d 6f 76 65 20 6f 6e 6c 79 20 74 68 65 20 62 69 | hould.we......remove.only.the.bi |
| dbca0 | 6e 64 69 6e 67 20 69 6e 20 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 20 6f 66 20 74 68 65 20 | nding.in.the.first.frame.of.the. |
| dbcc0 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 3f 0a 20 20 20 20 20 43 6f 6d 70 6c 65 74 65 20 74 68 65 20 73 | environment?......Complete.the.s |
| dbce0 | 70 65 63 69 66 69 63 61 74 69 6f 6e 20 61 6e 64 20 6a 75 73 74 69 66 79 20 61 6e 79 20 63 68 6f | pecification.and.justify.any.cho |
| dbd00 | 69 63 65 73 20 79 6f 75 20 6d 61 6b 65 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f | ices.you.make......----------.Fo |
| dbd20 | 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 46 72 61 6d 65 | otnotes.----------.....(1).Frame |
| dbd40 | 73 20 61 72 65 20 6e 6f 74 20 72 65 61 6c 6c 79 20 61 20 64 61 74 61 20 61 62 73 74 72 61 63 74 | s.are.not.really.a.data.abstract |
| dbd60 | 69 6f 6e 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 64 65 3a 0a 60 53 65 74 2d | ion.in.the.following.code:.`Set- |
| dbd80 | 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 21 27 20 61 6e 64 20 60 64 65 66 69 6e 65 2d 76 61 72 | variable-value!'.and.`define-var |
| dbda0 | 69 61 62 6c 65 21 27 20 75 73 65 20 60 73 65 74 2d 63 61 72 21 27 20 20 74 6f 0a 64 69 72 65 63 | iable!'.use.`set-car!'..to.direc |
| dbdc0 | 74 6c 79 20 6d 6f 64 69 66 79 20 74 68 65 20 76 61 6c 75 65 73 20 69 6e 20 61 20 66 72 61 6d 65 | tly.modify.the.values.in.a.frame |
| dbde0 | 2e 20 20 54 68 65 20 70 75 72 70 6f 73 65 20 6f 66 20 74 68 65 20 66 72 61 6d 65 0a 70 72 6f 63 | ...The.purpose.of.the.frame.proc |
| dbe00 | 65 64 75 72 65 73 20 69 73 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e | edures.is.to.make.the.environmen |
| dbe20 | 74 2d 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 65 61 73 79 20 74 | t-manipulation.procedures.easy.t |
| dbe40 | 6f 0a 72 65 61 64 2e 0a 0a 20 20 20 28 32 29 20 54 68 65 20 64 72 61 77 62 61 63 6b 20 6f 66 20 | o.read......(2).The.drawback.of. |
| dbe60 | 74 68 69 73 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 28 61 73 20 77 65 6c 6c 20 61 73 20 | this.representation.(as.well.as. |
| dbe80 | 74 68 65 20 76 61 72 69 61 6e 74 20 69 6e 0a 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d | the.variant.in.*Note.Exercise.4- |
| dbea0 | 31 31 3a 3a 29 20 69 73 20 74 68 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6d 61 79 20 | 11::).is.that.the.evaluator.may. |
| dbec0 | 68 61 76 65 20 74 6f 20 73 65 61 72 63 68 20 74 68 72 6f 75 67 68 0a 6d 61 6e 79 20 66 72 61 6d | have.to.search.through.many.fram |
| dbee0 | 65 73 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 66 69 6e 64 20 74 68 65 20 62 69 6e 64 69 6e 67 20 | es.in.order.to.find.the.binding. |
| dbf00 | 66 6f 72 20 61 20 67 69 76 65 6e 20 76 61 72 69 61 62 6c 65 2e 20 20 28 53 75 63 68 0a 61 6e 20 | for.a.given.variable...(Such.an. |
| dbf20 | 61 70 70 72 6f 61 63 68 20 69 73 20 72 65 66 65 72 72 65 64 20 74 6f 20 61 73 20 22 64 65 65 70 | approach.is.referred.to.as."deep |
| dbf40 | 20 62 69 6e 64 69 6e 67 22 2e 29 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 61 76 6f 69 64 20 74 68 | .binding".)..One.way.to.avoid.th |
| dbf60 | 69 73 0a 69 6e 65 66 66 69 63 69 65 6e 63 79 20 69 73 20 74 6f 20 6d 61 6b 65 20 75 73 65 20 6f | is.inefficiency.is.to.make.use.o |
| dbf80 | 66 20 61 20 73 74 72 61 74 65 67 79 20 63 61 6c 6c 65 64 20 22 6c 65 78 69 63 61 6c 20 61 64 64 | f.a.strategy.called."lexical.add |
| dbfa0 | 72 65 73 73 69 6e 67 22 2c 0a 77 68 69 63 68 20 77 69 6c 6c 20 62 65 20 64 69 73 63 75 73 73 65 | ressing",.which.will.be.discusse |
| dbfc0 | 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 2d 36 3a 3a 2e 0a 0a 1f 0a 46 | d.in.section.*Note.5-5-6::.....F |
| dbfe0 | 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 31 2d 34 2c 20 20 4e | ile:.sicp.info,..Node:.4-1-4,..N |
| dc000 | 65 78 74 3a 20 34 2d 31 2d 35 2c 20 20 50 72 65 76 3a 20 34 2d 31 2d 33 2c 20 20 55 70 3a 20 34 | ext:.4-1-5,..Prev:.4-1-3,..Up:.4 |
| dc020 | 2d 31 0a 0a 34 2e 31 2e 34 20 52 75 6e 6e 69 6e 67 20 74 68 65 20 45 76 61 6c 75 61 74 6f 72 20 | -1..4.1.4.Running.the.Evaluator. |
| dc040 | 61 73 20 61 20 50 72 6f 67 72 61 6d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | as.a.Program.------------------- |
| dc060 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 47 69 76 65 6e 20 74 68 65 | ---------------------..Given.the |
| dc080 | 20 65 76 61 6c 75 61 74 6f 72 2c 20 77 65 20 68 61 76 65 20 69 6e 20 6f 75 72 20 68 61 6e 64 73 | .evaluator,.we.have.in.our.hands |
| dc0a0 | 20 61 20 64 65 73 63 72 69 70 74 69 6f 6e 20 28 65 78 70 72 65 73 73 65 64 20 69 6e 0a 4c 69 73 | .a.description.(expressed.in.Lis |
| dc0c0 | 70 29 20 6f 66 20 74 68 65 20 70 72 6f 63 65 73 73 20 62 79 20 77 68 69 63 68 20 4c 69 73 70 20 | p).of.the.process.by.which.Lisp. |
| dc0e0 | 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 2e 20 20 4f 6e 65 0a | expressions.are.evaluated...One. |
| dc100 | 61 64 76 61 6e 74 61 67 65 20 6f 66 20 65 78 70 72 65 73 73 69 6e 67 20 74 68 65 20 65 76 61 6c | advantage.of.expressing.the.eval |
| dc120 | 75 61 74 6f 72 20 61 73 20 61 20 70 72 6f 67 72 61 6d 20 69 73 20 74 68 61 74 20 77 65 20 63 61 | uator.as.a.program.is.that.we.ca |
| dc140 | 6e 20 72 75 6e 0a 74 68 65 20 70 72 6f 67 72 61 6d 2e 20 20 54 68 69 73 20 67 69 76 65 73 20 75 | n.run.the.program...This.gives.u |
| dc160 | 73 2c 20 72 75 6e 6e 69 6e 67 20 77 69 74 68 69 6e 20 4c 69 73 70 2c 20 61 20 77 6f 72 6b 69 6e | s,.running.within.Lisp,.a.workin |
| dc180 | 67 20 6d 6f 64 65 6c 20 6f 66 0a 68 6f 77 20 4c 69 73 70 20 69 74 73 65 6c 66 20 65 76 61 6c 75 | g.model.of.how.Lisp.itself.evalu |
| dc1a0 | 61 74 65 73 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 54 68 69 73 20 63 61 6e 20 73 65 72 76 | ates.expressions...This.can.serv |
| dc1c0 | 65 20 61 73 20 61 20 66 72 61 6d 65 77 6f 72 6b 0a 66 6f 72 20 65 78 70 65 72 69 6d 65 6e 74 69 | e.as.a.framework.for.experimenti |
| dc1e0 | 6e 67 20 77 69 74 68 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 6c 65 73 2c 20 61 73 20 77 65 20 | ng.with.evaluation.rules,.as.we. |
| dc200 | 73 68 61 6c 6c 20 64 6f 20 6c 61 74 65 72 20 69 6e 20 74 68 69 73 0a 63 68 61 70 74 65 72 2e 0a | shall.do.later.in.this.chapter.. |
| dc220 | 0a 20 20 20 4f 75 72 20 65 76 61 6c 75 61 74 6f 72 20 70 72 6f 67 72 61 6d 20 72 65 64 75 63 65 | ....Our.evaluator.program.reduce |
| dc240 | 73 20 65 78 70 72 65 73 73 69 6f 6e 73 20 75 6c 74 69 6d 61 74 65 6c 79 20 74 6f 20 74 68 65 0a | s.expressions.ultimately.to.the. |
| dc260 | 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 | application.of.primitive.procedu |
| dc280 | 72 65 73 2e 20 20 54 68 65 72 65 66 6f 72 65 2c 20 61 6c 6c 20 74 68 61 74 20 77 65 20 6e 65 65 | res...Therefore,.all.that.we.nee |
| dc2a0 | 64 20 74 6f 0a 72 75 6e 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 69 73 20 74 6f 20 63 72 65 | d.to.run.the.evaluator.is.to.cre |
| dc2c0 | 61 74 65 20 61 20 6d 65 63 68 61 6e 69 73 6d 20 74 68 61 74 20 63 61 6c 6c 73 20 6f 6e 20 74 68 | ate.a.mechanism.that.calls.on.th |
| dc2e0 | 65 20 75 6e 64 65 72 6c 79 69 6e 67 0a 4c 69 73 70 20 73 79 73 74 65 6d 20 74 6f 20 6d 6f 64 65 | e.underlying.Lisp.system.to.mode |
| dc300 | 6c 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 70 72 69 6d 69 74 69 76 65 20 70 | l.the.application.of.primitive.p |
| dc320 | 72 6f 63 65 64 75 72 65 73 2e 0a 0a 20 20 20 54 68 65 72 65 20 6d 75 73 74 20 62 65 20 61 20 62 | rocedures......There.must.be.a.b |
| dc340 | 69 6e 64 69 6e 67 20 66 6f 72 20 65 61 63 68 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 | inding.for.each.primitive.proced |
| dc360 | 75 72 65 20 6e 61 6d 65 2c 20 73 6f 20 74 68 61 74 0a 77 68 65 6e 20 60 65 76 61 6c 27 20 65 76 | ure.name,.so.that.when.`eval'.ev |
| dc380 | 61 6c 75 61 74 65 73 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 6f 66 20 61 6e 20 61 70 70 6c 69 | aluates.the.operator.of.an.appli |
| dc3a0 | 63 61 74 69 6f 6e 20 6f 66 20 61 20 70 72 69 6d 69 74 69 76 65 2c 20 69 74 0a 77 69 6c 6c 20 66 | cation.of.a.primitive,.it.will.f |
| dc3c0 | 69 6e 64 20 61 6e 20 6f 62 6a 65 63 74 20 74 6f 20 70 61 73 73 20 74 6f 20 60 61 70 70 6c 79 27 | ind.an.object.to.pass.to.`apply' |
| dc3e0 | 2e 20 20 57 65 20 74 68 75 73 20 73 65 74 20 75 70 20 61 20 67 6c 6f 62 61 6c 0a 65 6e 76 69 72 | ...We.thus.set.up.a.global.envir |
| dc400 | 6f 6e 6d 65 6e 74 20 74 68 61 74 20 61 73 73 6f 63 69 61 74 65 73 20 75 6e 69 71 75 65 20 6f 62 | onment.that.associates.unique.ob |
| dc420 | 6a 65 63 74 73 20 77 69 74 68 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 74 68 65 0a 70 72 69 6d | jects.with.the.names.of.the.prim |
| dc440 | 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 63 61 6e 20 61 70 70 65 61 72 | itive.procedures.that.can.appear |
| dc460 | 20 69 6e 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 77 65 20 77 69 6c 6c 20 62 65 0a 65 | .in.the.expressions.we.will.be.e |
| dc480 | 76 61 6c 75 61 74 69 6e 67 2e 20 20 54 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 | valuating...The.global.environme |
| dc4a0 | 6e 74 20 61 6c 73 6f 20 69 6e 63 6c 75 64 65 73 20 62 69 6e 64 69 6e 67 73 20 66 6f 72 20 74 68 | nt.also.includes.bindings.for.th |
| dc4c0 | 65 0a 73 79 6d 62 6f 6c 73 20 60 74 72 75 65 27 20 61 6e 64 20 60 66 61 6c 73 65 27 2c 20 73 6f | e.symbols.`true'.and.`false',.so |
| dc4e0 | 20 74 68 61 74 20 74 68 65 79 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 76 61 72 69 61 62 | .that.they.can.be.used.as.variab |
| dc500 | 6c 65 73 20 69 6e 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 | les.in.expressions.to.be.evaluat |
| dc520 | 65 64 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 74 75 70 2d 65 6e 76 69 72 6f 6e | ed........(define.(setup-environ |
| dc540 | 6d 65 6e 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e 69 74 69 61 6c 2d 65 6e 76 0a | ment)........(let.((initial-env. |
| dc560 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e | ..............(extend-environmen |
| dc580 | 74 20 28 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 2d 6e 61 6d 65 73 29 0a 20 20 | t.(primitive-procedure-names)... |
| dc5a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| dc5c0 | 28 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 2d 6f 62 6a 65 63 74 73 29 0a 20 20 | (primitive-procedure-objects)... |
| dc5e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| dc600 | 74 68 65 2d 65 6d 70 74 79 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 29 29 0a 20 20 20 20 20 20 20 | the-empty-environment)))........ |
| dc620 | 20 20 28 64 65 66 69 6e 65 2d 76 61 72 69 61 62 6c 65 21 20 27 74 72 75 65 20 74 72 75 65 20 69 | ..(define-variable!.'true.true.i |
| dc640 | 6e 69 74 69 61 6c 2d 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 2d 76 61 72 | nitial-env)..........(define-var |
| dc660 | 69 61 62 6c 65 21 20 27 66 61 6c 73 65 20 66 61 6c 73 65 20 69 6e 69 74 69 61 6c 2d 65 6e 76 29 | iable!.'false.false.initial-env) |
| dc680 | 0a 20 20 20 20 20 20 20 20 20 69 6e 69 74 69 61 6c 2d 65 6e 76 29 29 0a 0a 20 20 20 20 20 28 64 | ..........initial-env)).......(d |
| dc6a0 | 65 66 69 6e 65 20 74 68 65 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 28 73 65 | efine.the-global-environment.(se |
| dc6c0 | 74 75 70 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 29 0a 0a 20 20 20 49 74 20 64 6f 65 73 20 6e 6f | tup-environment)).....It.does.no |
| dc6e0 | 74 20 6d 61 74 74 65 72 20 68 6f 77 20 77 65 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 70 72 | t.matter.how.we.represent.the.pr |
| dc700 | 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 73 2c 0a 73 6f 20 6c 6f | imitive.procedure.objects,.so.lo |
| dc720 | 6e 67 20 61 73 20 60 61 70 70 6c 79 27 20 63 61 6e 20 69 64 65 6e 74 69 66 79 20 61 6e 64 20 61 | ng.as.`apply'.can.identify.and.a |
| dc740 | 70 70 6c 79 20 74 68 65 6d 20 62 79 20 75 73 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 | pply.them.by.using.the.procedure |
| dc760 | 73 0a 60 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 27 20 61 6e 64 20 60 61 70 | s.`primitive-procedure?'.and.`ap |
| dc780 | 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 27 2e 20 20 57 65 20 68 61 | ply-primitive-procedure'...We.ha |
| dc7a0 | 76 65 20 63 68 6f 73 65 6e 0a 74 6f 20 72 65 70 72 65 73 65 6e 74 20 61 20 70 72 69 6d 69 74 69 | ve.chosen.to.represent.a.primiti |
| dc7c0 | 76 65 20 70 72 6f 63 65 64 75 72 65 20 61 73 20 61 20 6c 69 73 74 20 62 65 67 69 6e 6e 69 6e 67 | ve.procedure.as.a.list.beginning |
| dc7e0 | 20 77 69 74 68 20 74 68 65 20 73 79 6d 62 6f 6c 0a 60 70 72 69 6d 69 74 69 76 65 27 20 61 6e 64 | .with.the.symbol.`primitive'.and |
| dc800 | 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 74 68 65 20 75 | .containing.a.procedure.in.the.u |
| dc820 | 6e 64 65 72 6c 79 69 6e 67 20 4c 69 73 70 20 74 68 61 74 0a 69 6d 70 6c 65 6d 65 6e 74 73 20 74 | nderlying.Lisp.that.implements.t |
| dc840 | 68 61 74 20 70 72 69 6d 69 74 69 76 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 | hat.primitive........(define.(pr |
| dc860 | 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 | imitive-procedure?.proc)........ |
| dc880 | 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 70 72 6f 63 20 27 70 72 69 6d 69 74 69 76 65 29 29 0a | (tagged-list?.proc.'primitive)). |
| dc8a0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 69 6d 69 74 69 76 65 2d 69 6d 70 6c 65 6d 65 | ......(define.(primitive-impleme |
| dc8c0 | 6e 74 61 74 69 6f 6e 20 70 72 6f 63 29 20 28 63 61 64 72 20 70 72 6f 63 29 29 0a 0a 20 20 20 60 | ntation.proc).(cadr.proc)).....` |
| dc8e0 | 53 65 74 75 70 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 27 20 77 69 6c 6c 20 67 65 74 20 74 68 65 20 | Setup-environment'.will.get.the. |
| dc900 | 70 72 69 6d 69 74 69 76 65 20 6e 61 6d 65 73 20 61 6e 64 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 | primitive.names.and.implementati |
| dc920 | 6f 6e 0a 70 72 6f 63 65 64 75 72 65 73 20 66 72 6f 6d 20 61 20 6c 69 73 74 3a 28 31 29 0a 0a 20 | on.procedures.from.a.list:(1)... |
| dc940 | 20 20 20 20 28 64 65 66 69 6e 65 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 73 | ....(define.primitive-procedures |
| dc960 | 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 28 6c 69 73 74 20 27 63 61 72 20 63 61 72 29 0a 20 20 | ........(list.(list.'car.car)... |
| dc980 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 63 64 72 20 63 64 72 29 0a 20 20 20 20 20 | ...........(list.'cdr.cdr)...... |
| dc9a0 | 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 63 6f 6e 73 20 63 6f 6e 73 29 0a 20 20 20 20 20 20 | ........(list.'cons.cons)....... |
| dc9c0 | 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 6e 75 6c 6c 3f 20 6e 75 6c 6c 3f 29 0a 20 20 20 20 20 | .......(list.'null?.null?)...... |
| dc9e0 | 20 20 20 20 20 20 20 20 3c 4d 4f 52 45 20 50 52 49 4d 49 54 49 56 45 53 3e 0a 20 20 20 20 20 20 | ........<MORE.PRIMITIVES>....... |
| dca00 | 20 20 20 20 20 20 20 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 69 6d 69 74 69 | .......)).......(define.(primiti |
| dca20 | 76 65 2d 70 72 6f 63 65 64 75 72 65 2d 6e 61 6d 65 73 29 0a 20 20 20 20 20 20 20 28 6d 61 70 20 | ve-procedure-names)........(map. |
| dca40 | 63 61 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 | car.............primitive-proced |
| dca60 | 75 72 65 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 69 6d 69 74 69 76 65 2d | ures)).......(define.(primitive- |
| dca80 | 70 72 6f 63 65 64 75 72 65 2d 6f 62 6a 65 63 74 73 29 0a 20 20 20 20 20 20 20 28 6d 61 70 20 28 | procedure-objects)........(map.( |
| dcaa0 | 6c 61 6d 62 64 61 20 28 70 72 6f 63 29 20 28 6c 69 73 74 20 27 70 72 69 6d 69 74 69 76 65 20 28 | lambda.(proc).(list.'primitive.( |
| dcac0 | 63 61 64 72 20 70 72 6f 63 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 69 74 69 | cadr.proc))).............primiti |
| dcae0 | 76 65 2d 70 72 6f 63 65 64 75 72 65 73 29 29 0a 0a 20 20 20 54 6f 20 61 70 70 6c 79 20 61 20 70 | ve-procedures)).....To.apply.a.p |
| dcb00 | 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 2c 20 77 65 20 73 69 6d 70 6c 79 20 61 70 | rimitive.procedure,.we.simply.ap |
| dcb20 | 70 6c 79 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 | ply.the.implementation.procedure |
| dcb40 | 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 2c 20 75 73 69 6e 67 20 74 68 65 20 75 6e 64 | .to.the.arguments,.using.the.und |
| dcb60 | 65 72 6c 79 69 6e 67 20 4c 69 73 70 20 73 79 73 74 65 6d 3a 28 32 29 0a 0a 20 20 20 20 20 28 64 | erlying.Lisp.system:(2).......(d |
| dcb80 | 65 66 69 6e 65 20 28 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 | efine.(apply-primitive-procedure |
| dcba0 | 20 70 72 6f 63 20 61 72 67 73 29 0a 20 20 20 20 20 20 20 28 61 70 70 6c 79 2d 69 6e 2d 75 6e 64 | .proc.args)........(apply-in-und |
| dcbc0 | 65 72 6c 79 69 6e 67 2d 73 63 68 65 6d 65 0a 20 20 20 20 20 20 20 20 28 70 72 69 6d 69 74 69 76 | erlying-scheme.........(primitiv |
| dcbe0 | 65 2d 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 70 72 6f 63 29 20 61 72 67 73 29 29 0a 0a 20 | e-implementation.proc).args))... |
| dcc00 | 20 20 46 6f 72 20 63 6f 6e 76 65 6e 69 65 6e 63 65 20 69 6e 20 72 75 6e 6e 69 6e 67 20 74 68 65 | ..For.convenience.in.running.the |
| dcc20 | 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 2c 20 77 65 20 70 72 6f 76 | .metacircular.evaluator,.we.prov |
| dcc40 | 69 64 65 20 61 20 22 64 72 69 76 65 72 0a 6c 6f 6f 70 22 20 74 68 61 74 20 6d 6f 64 65 6c 73 20 | ide.a."driver.loop".that.models. |
| dcc60 | 74 68 65 20 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 6e 74 20 6c 6f 6f 70 20 6f 66 20 74 68 65 20 | the.read-eval-print.loop.of.the. |
| dcc80 | 75 6e 64 65 72 6c 79 69 6e 67 20 4c 69 73 70 0a 73 79 73 74 65 6d 2e 20 20 49 74 20 70 72 69 6e | underlying.Lisp.system...It.prin |
| dcca0 | 74 73 20 61 20 22 70 72 6f 6d 70 74 22 2c 20 72 65 61 64 73 20 61 6e 20 69 6e 70 75 74 20 65 78 | ts.a."prompt",.reads.an.input.ex |
| dccc0 | 70 72 65 73 73 69 6f 6e 2c 20 65 76 61 6c 75 61 74 65 73 0a 74 68 69 73 20 65 78 70 72 65 73 73 | pression,.evaluates.this.express |
| dcce0 | 69 6f 6e 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 61 | ion.in.the.global.environment,.a |
| dcd00 | 6e 64 20 70 72 69 6e 74 73 20 74 68 65 20 72 65 73 75 6c 74 2e 20 20 57 65 0a 70 72 65 63 65 64 | nd.prints.the.result...We.preced |
| dcd20 | 65 20 65 61 63 68 20 70 72 69 6e 74 65 64 20 72 65 73 75 6c 74 20 62 79 20 61 6e 20 22 6f 75 74 | e.each.printed.result.by.an."out |
| dcd40 | 70 75 74 20 70 72 6f 6d 70 74 22 20 73 6f 20 61 73 20 74 6f 20 64 69 73 74 69 6e 67 75 69 73 68 | put.prompt".so.as.to.distinguish |
| dcd60 | 0a 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 66 72 6f | .the.value.of.the.expression.fro |
| dcd80 | 6d 20 6f 74 68 65 72 20 6f 75 74 70 75 74 20 74 68 61 74 20 6d 61 79 20 62 65 20 70 72 69 6e 74 | m.other.output.that.may.be.print |
| dcda0 | 65 64 2e 28 33 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 70 75 74 2d 70 72 6f 6d 70 | ed.(3).......(define.input-promp |
| dcdc0 | 74 20 22 3b 3b 3b 20 4d 2d 45 76 61 6c 20 69 6e 70 75 74 3a 22 29 0a 20 20 20 20 20 28 64 65 66 | t.";;;.M-Eval.input:")......(def |
| dcde0 | 69 6e 65 20 6f 75 74 70 75 74 2d 70 72 6f 6d 70 74 20 22 3b 3b 3b 20 4d 2d 45 76 61 6c 20 76 61 | ine.output-prompt.";;;.M-Eval.va |
| dce00 | 6c 75 65 3a 22 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 72 69 76 65 72 2d 6c 6f 6f | lue:").......(define.(driver-loo |
| dce20 | 70 29 0a 20 20 20 20 20 20 20 28 70 72 6f 6d 70 74 2d 66 6f 72 2d 69 6e 70 75 74 20 69 6e 70 75 | p)........(prompt-for-input.inpu |
| dce40 | 74 2d 70 72 6f 6d 70 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e 70 75 74 20 28 72 | t-prompt)........(let.((input.(r |
| dce60 | 65 61 64 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6f 75 74 70 75 74 20 28 65 | ead)))..........(let.((output.(e |
| dce80 | 76 61 6c 20 69 6e 70 75 74 20 74 68 65 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 | val.input.the-global-environment |
| dcea0 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 6e 6f 75 6e 63 65 2d 6f 75 74 70 75 74 20 | )))............(announce-output. |
| dcec0 | 6f 75 74 70 75 74 2d 70 72 6f 6d 70 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 75 73 65 72 2d | output-prompt)............(user- |
| dcee0 | 70 72 69 6e 74 20 6f 75 74 70 75 74 29 29 29 0a 20 20 20 20 20 20 20 28 64 72 69 76 65 72 2d 6c | print.output)))........(driver-l |
| dcf00 | 6f 6f 70 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 6f 6d 70 74 2d 66 6f 72 2d | oop)).......(define.(prompt-for- |
| dcf20 | 69 6e 70 75 74 20 73 74 72 69 6e 67 29 0a 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 20 28 | input.string)........(newline).( |
| dcf40 | 6e 65 77 6c 69 6e 65 29 20 28 64 69 73 70 6c 61 79 20 73 74 72 69 6e 67 29 20 28 6e 65 77 6c 69 | newline).(display.string).(newli |
| dcf60 | 6e 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 6e 6f 75 6e 63 65 2d 6f 75 74 | ne)).......(define.(announce-out |
| dcf80 | 70 75 74 20 73 74 72 69 6e 67 29 0a 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 20 28 64 69 | put.string)........(newline).(di |
| dcfa0 | 73 70 6c 61 79 20 73 74 72 69 6e 67 29 20 28 6e 65 77 6c 69 6e 65 29 29 0a 0a 20 20 20 57 65 20 | splay.string).(newline)).....We. |
| dcfc0 | 75 73 65 20 61 20 73 70 65 63 69 61 6c 20 70 72 69 6e 74 69 6e 67 20 70 72 6f 63 65 64 75 72 65 | use.a.special.printing.procedure |
| dcfe0 | 2c 20 60 75 73 65 72 2d 70 72 69 6e 74 27 2c 20 74 6f 20 61 76 6f 69 64 20 70 72 69 6e 74 69 6e | ,.`user-print',.to.avoid.printin |
| dd000 | 67 0a 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 70 61 72 74 20 6f 66 20 61 20 63 6f 6d 70 | g.the.environment.part.of.a.comp |
| dd020 | 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 6d 61 79 20 62 65 20 61 20 76 | ound.procedure,.which.may.be.a.v |
| dd040 | 65 72 79 20 6c 6f 6e 67 0a 6c 69 73 74 20 28 6f 72 20 6d 61 79 20 65 76 65 6e 20 63 6f 6e 74 61 | ery.long.list.(or.may.even.conta |
| dd060 | 69 6e 20 63 79 63 6c 65 73 29 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 75 73 65 72 2d | in.cycles)........(define.(user- |
| dd080 | 70 72 69 6e 74 20 6f 62 6a 65 63 74 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 63 6f 6d 70 6f 75 | print.object)........(if.(compou |
| dd0a0 | 6e 64 2d 70 72 6f 63 65 64 75 72 65 3f 20 6f 62 6a 65 63 74 29 0a 20 20 20 20 20 20 20 20 20 20 | nd-procedure?.object)........... |
| dd0c0 | 20 28 64 69 73 70 6c 61 79 20 28 6c 69 73 74 20 27 63 6f 6d 70 6f 75 6e 64 2d 70 72 6f 63 65 64 | .(display.(list.'compound-proced |
| dd0e0 | 75 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 | ure...........................(p |
| dd100 | 72 6f 63 65 64 75 72 65 2d 70 61 72 61 6d 65 74 65 72 73 20 6f 62 6a 65 63 74 29 0a 20 20 20 20 | rocedure-parameters.object)..... |
| dd120 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 64 75 72 65 | ......................(procedure |
| dd140 | 2d 62 6f 64 79 20 6f 62 6a 65 63 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -body.object)................... |
| dd160 | 20 20 20 20 20 20 20 20 27 3c 70 72 6f 63 65 64 75 72 65 2d 65 6e 76 3e 29 29 0a 20 20 20 20 20 | ........'<procedure-env>))...... |
| dd180 | 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 6f 62 6a 65 63 74 29 29 29 0a 0a 20 20 20 4e 6f 77 | ......(display.object))).....Now |
| dd1a0 | 20 61 6c 6c 20 77 65 20 6e 65 65 64 20 74 6f 20 64 6f 20 74 6f 20 72 75 6e 20 74 68 65 20 65 76 | .all.we.need.to.do.to.run.the.ev |
| dd1c0 | 61 6c 75 61 74 6f 72 20 69 73 20 74 6f 20 69 6e 69 74 69 61 6c 69 7a 65 20 74 68 65 0a 67 6c 6f | aluator.is.to.initialize.the.glo |
| dd1e0 | 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 6e 64 20 73 74 61 72 74 20 74 68 65 20 64 72 | bal.environment.and.start.the.dr |
| dd200 | 69 76 65 72 20 6c 6f 6f 70 2e 20 20 48 65 72 65 20 69 73 20 61 20 73 61 6d 70 6c 65 0a 69 6e 74 | iver.loop...Here.is.a.sample.int |
| dd220 | 65 72 61 63 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 74 68 65 2d 67 6c 6f 62 | eraction:.......(define.the-glob |
| dd240 | 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 28 73 65 74 75 70 2d 65 6e 76 69 72 6f 6e 6d 65 6e | al-environment.(setup-environmen |
| dd260 | 74 29 29 0a 0a 20 20 20 20 20 28 64 72 69 76 65 72 2d 6c 6f 6f 70 29 0a 0a 20 20 20 20 20 3b 3b | t)).......(driver-loop).......;; |
| dd280 | 3b 20 4d 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 | ;.M-Eval.input:......(define.(ap |
| dd2a0 | 70 65 6e 64 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 78 29 0a 20 | pend.x.y)........(if.(null?.x).. |
| dd2c0 | 20 20 20 20 20 20 20 20 20 20 79 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 63 61 | ..........y............(cons.(ca |
| dd2e0 | 72 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 20 28 63 | r.x)..................(append.(c |
| dd300 | 64 72 20 78 29 20 79 29 29 29 29 0a 20 20 20 20 20 3b 3b 3b 20 4d 2d 45 76 61 6c 20 76 61 6c 75 | dr.x).y))))......;;;.M-Eval.valu |
| dd320 | 65 3a 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 3b 3b 3b 20 4d 2d 45 76 61 6c 20 69 6e 70 75 | e:......ok.......;;;.M-Eval.inpu |
| dd340 | 74 3a 0a 20 20 20 20 20 28 61 70 70 65 6e 64 20 27 28 61 20 62 20 63 29 20 27 28 64 20 65 20 66 | t:......(append.'(a.b.c).'(d.e.f |
| dd360 | 29 29 0a 20 20 20 20 20 3b 3b 3b 20 4d 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 28 | ))......;;;.M-Eval.value:......( |
| dd380 | 61 20 62 20 63 20 64 20 65 20 66 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 31 | a.b.c.d.e.f).......*Exercise.4.1 |
| dd3a0 | 34 3a 2a 20 45 76 61 20 4c 75 20 41 74 6f 72 20 61 6e 64 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e | 4:*.Eva.Lu.Ator.and.Louis.Reason |
| dd3c0 | 65 72 20 61 72 65 20 65 61 63 68 0a 20 20 20 20 20 65 78 70 65 72 69 6d 65 6e 74 69 6e 67 20 77 | er.are.each......experimenting.w |
| dd3e0 | 69 74 68 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 2e 20 | ith.the.metacircular.evaluator.. |
| dd400 | 20 45 76 61 20 74 79 70 65 73 20 69 6e 20 74 68 65 0a 20 20 20 20 20 64 65 66 69 6e 69 74 69 6f | .Eva.types.in.the......definitio |
| dd420 | 6e 20 6f 66 20 60 6d 61 70 27 2c 20 61 6e 64 20 72 75 6e 73 20 73 6f 6d 65 20 74 65 73 74 20 70 | n.of.`map',.and.runs.some.test.p |
| dd440 | 72 6f 67 72 61 6d 73 20 74 68 61 74 20 75 73 65 20 69 74 2e 0a 20 20 20 20 20 54 68 65 79 20 77 | rograms.that.use.it.......They.w |
| dd460 | 6f 72 6b 20 66 69 6e 65 2e 20 20 4c 6f 75 69 73 2c 20 69 6e 20 63 6f 6e 74 72 61 73 74 2c 20 68 | ork.fine...Louis,.in.contrast,.h |
| dd480 | 61 73 20 69 6e 73 74 61 6c 6c 65 64 20 74 68 65 20 73 79 73 74 65 6d 0a 20 20 20 20 20 76 65 72 | as.installed.the.system......ver |
| dd4a0 | 73 69 6f 6e 20 6f 66 20 60 6d 61 70 27 20 61 73 20 61 20 70 72 69 6d 69 74 69 76 65 20 66 6f 72 | sion.of.`map'.as.a.primitive.for |
| dd4c0 | 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 2e 0a 20 20 20 | .the.metacircular.evaluator..... |
| dd4e0 | 20 20 57 68 65 6e 20 68 65 20 74 72 69 65 73 20 69 74 2c 20 74 68 69 6e 67 73 20 67 6f 20 74 65 | ..When.he.tries.it,.things.go.te |
| dd500 | 72 72 69 62 6c 79 20 77 72 6f 6e 67 2e 20 20 45 78 70 6c 61 69 6e 20 77 68 79 20 4c 6f 75 69 73 | rribly.wrong...Explain.why.Louis |
| dd520 | 27 73 0a 20 20 20 20 20 60 6d 61 70 27 20 66 61 69 6c 73 20 65 76 65 6e 20 74 68 6f 75 67 68 20 | 's......`map'.fails.even.though. |
| dd540 | 45 76 61 27 73 20 77 6f 72 6b 73 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 | Eva's.works......----------.Foot |
| dd560 | 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 41 6e 79 20 70 72 6f | notes.----------.....(1).Any.pro |
| dd580 | 63 65 64 75 72 65 20 64 65 66 69 6e 65 64 20 69 6e 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 | cedure.defined.in.the.underlying |
| dd5a0 | 20 4c 69 73 70 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 61 0a 70 72 69 6d 69 74 69 76 65 | .Lisp.can.be.used.as.a.primitive |
| dd5c0 | 20 66 6f 72 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 2e | .for.the.metacircular.evaluator. |
| dd5e0 | 20 20 54 68 65 20 6e 61 6d 65 20 6f 66 20 61 20 70 72 69 6d 69 74 69 76 65 0a 69 6e 73 74 61 6c | ..The.name.of.a.primitive.instal |
| dd600 | 6c 65 64 20 69 6e 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6e 65 65 64 20 6e 6f 74 20 62 65 | led.in.the.evaluator.need.not.be |
| dd620 | 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 69 74 73 0a 69 6d 70 | .the.same.as.the.name.of.its.imp |
| dd640 | 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 4c 69 | lementation.in.the.underlying.Li |
| dd660 | 73 70 3b 20 74 68 65 20 6e 61 6d 65 73 20 61 72 65 20 74 68 65 20 73 61 6d 65 20 68 65 72 65 0a | sp;.the.names.are.the.same.here. |
| dd680 | 62 65 63 61 75 73 65 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 | because.the.metacircular.evaluat |
| dd6a0 | 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 73 20 53 63 68 65 6d 65 20 69 74 73 65 6c 66 2e 20 20 54 68 | or.implements.Scheme.itself...Th |
| dd6c0 | 75 73 2c 20 66 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 6f 75 6c 64 20 70 75 74 20 60 28 | us,.for.example,.we.could.put.`( |
| dd6e0 | 6c 69 73 74 20 27 66 69 72 73 74 20 63 61 72 29 27 20 6f 72 20 60 28 6c 69 73 74 20 27 73 71 75 | list.'first.car)'.or.`(list.'squ |
| dd700 | 61 72 65 20 28 6c 61 6d 62 64 61 20 28 78 29 0a 28 2a 20 78 20 78 29 29 29 27 20 69 6e 20 74 68 | are.(lambda.(x).(*.x.x)))'.in.th |
| dd720 | 65 20 6c 69 73 74 20 6f 66 20 60 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 73 27 | e.list.of.`primitive-procedures' |
| dd740 | 2e 0a 0a 20 20 20 28 32 29 20 60 41 70 70 6c 79 2d 69 6e 2d 75 6e 64 65 72 6c 79 69 6e 67 2d 73 | ......(2).`Apply-in-underlying-s |
| dd760 | 63 68 65 6d 65 27 20 69 73 20 74 68 65 20 60 61 70 70 6c 79 27 20 70 72 6f 63 65 64 75 72 65 20 | cheme'.is.the.`apply'.procedure. |
| dd780 | 77 65 20 68 61 76 65 0a 75 73 65 64 20 69 6e 20 65 61 72 6c 69 65 72 20 63 68 61 70 74 65 72 73 | we.have.used.in.earlier.chapters |
| dd7a0 | 2e 20 20 54 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 27 73 20 | ...The.metacircular.evaluator's. |
| dd7c0 | 60 61 70 70 6c 79 27 0a 70 72 6f 63 65 64 75 72 65 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | `apply'.procedure.(section.*Note |
| dd7e0 | 20 34 2d 31 2d 31 3a 3a 29 20 6d 6f 64 65 6c 73 20 74 68 65 20 77 6f 72 6b 69 6e 67 20 6f 66 20 | .4-1-1::).models.the.working.of. |
| dd800 | 74 68 69 73 20 70 72 69 6d 69 74 69 76 65 2e 0a 48 61 76 69 6e 67 20 74 77 6f 20 64 69 66 66 65 | this.primitive..Having.two.diffe |
| dd820 | 72 65 6e 74 20 74 68 69 6e 67 73 20 63 61 6c 6c 65 64 20 60 61 70 70 6c 79 27 20 6c 65 61 64 73 | rent.things.called.`apply'.leads |
| dd840 | 20 74 6f 20 61 20 74 65 63 68 6e 69 63 61 6c 0a 70 72 6f 62 6c 65 6d 20 69 6e 20 72 75 6e 6e 69 | .to.a.technical.problem.in.runni |
| dd860 | 6e 67 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 2c 20 62 | ng.the.metacircular.evaluator,.b |
| dd880 | 65 63 61 75 73 65 20 64 65 66 69 6e 69 6e 67 20 74 68 65 0a 6d 65 74 61 63 69 72 63 75 6c 61 72 | ecause.defining.the.metacircular |
| dd8a0 | 20 65 76 61 6c 75 61 74 6f 72 27 73 20 60 61 70 70 6c 79 27 20 77 69 6c 6c 20 6d 61 73 6b 20 74 | .evaluator's.`apply'.will.mask.t |
| dd8c0 | 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 0a 70 72 69 6d 69 74 69 76 65 2e 20 | he.definition.of.the.primitive.. |
| dd8e0 | 20 4f 6e 65 20 77 61 79 20 61 72 6f 75 6e 64 20 74 68 69 73 20 69 73 20 74 6f 20 72 65 6e 61 6d | .One.way.around.this.is.to.renam |
| dd900 | 65 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 60 61 70 70 6c 79 27 20 74 6f 0a 61 76 | e.the.metacircular.`apply'.to.av |
| dd920 | 6f 69 64 20 63 6f 6e 66 6c 69 63 74 20 77 69 74 68 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 | oid.conflict.with.the.name.of.th |
| dd940 | 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 2e 20 20 57 65 20 68 61 76 65 0a | e.primitive.procedure...We.have. |
| dd960 | 61 73 73 75 6d 65 64 20 69 6e 73 74 65 61 64 20 74 68 61 74 20 77 65 20 68 61 76 65 20 73 61 76 | assumed.instead.that.we.have.sav |
| dd980 | 65 64 20 61 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 | ed.a.reference.to.the.underlying |
| dd9a0 | 0a 60 61 70 70 6c 79 27 20 62 79 20 64 6f 69 6e 67 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | .`apply'.by.doing.......(define. |
| dd9c0 | 61 70 70 6c 79 2d 69 6e 2d 75 6e 64 65 72 6c 79 69 6e 67 2d 73 63 68 65 6d 65 20 61 70 70 6c 79 | apply-in-underlying-scheme.apply |
| dd9e0 | 29 0a 0a 62 65 66 6f 72 65 20 64 65 66 69 6e 69 6e 67 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 | )..before.defining.the.metacircu |
| dda00 | 6c 61 72 20 60 61 70 70 6c 79 27 2e 20 20 54 68 69 73 20 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20 | lar.`apply'...This.allows.us.to. |
| dda20 | 61 63 63 65 73 73 20 74 68 65 0a 6f 72 69 67 69 6e 61 6c 20 76 65 72 73 69 6f 6e 20 6f 66 20 60 | access.the.original.version.of.` |
| dda40 | 61 70 70 6c 79 27 20 75 6e 64 65 72 20 61 20 64 69 66 66 65 72 65 6e 74 20 6e 61 6d 65 2e 0a 0a | apply'.under.a.different.name... |
| dda60 | 20 20 20 28 33 29 20 54 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 60 | ...(3).The.primitive.procedure.` |
| dda80 | 72 65 61 64 27 20 77 61 69 74 73 20 66 6f 72 20 69 6e 70 75 74 20 66 72 6f 6d 20 74 68 65 20 75 | read'.waits.for.input.from.the.u |
| ddaa0 | 73 65 72 2c 0a 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 6e 65 78 74 20 63 6f 6d 70 6c 65 | ser,.and.returns.the.next.comple |
| ddac0 | 74 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 69 73 20 74 79 70 65 64 2e 20 20 46 6f | te.expression.that.is.typed...Fo |
| ddae0 | 72 20 65 78 61 6d 70 6c 65 2c 0a 69 66 20 74 68 65 20 75 73 65 72 20 74 79 70 65 73 20 60 28 2b | r.example,.if.the.user.types.`(+ |
| ddb00 | 20 32 33 20 78 29 27 2c 20 60 72 65 61 64 27 20 72 65 74 75 72 6e 73 20 61 20 74 68 72 65 65 2d | .23.x)',.`read'.returns.a.three- |
| ddb20 | 65 6c 65 6d 65 6e 74 20 6c 69 73 74 0a 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 73 79 6d 62 | element.list.containing.the.symb |
| ddb40 | 6f 6c 20 60 2b 27 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 32 33 2c 20 61 6e 64 20 74 68 65 20 73 | ol.`+',.the.number.23,.and.the.s |
| ddb60 | 79 6d 62 6f 6c 20 60 78 27 2e 20 20 49 66 20 74 68 65 0a 75 73 65 72 20 74 79 70 65 73 20 60 27 | ymbol.`x'...If.the.user.types.`' |
| ddb80 | 78 27 2c 20 60 72 65 61 64 27 20 72 65 74 75 72 6e 73 20 61 20 74 77 6f 2d 65 6c 65 6d 65 6e 74 | x',.`read'.returns.a.two-element |
| ddba0 | 20 6c 69 73 74 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 0a 73 79 6d 62 6f 6c 20 60 71 75 6f | .list.containing.the.symbol.`quo |
| ddbc0 | 74 65 27 20 61 6e 64 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 78 27 2e 0a 0a 1f 0a 46 69 6c 65 3a | te'.and.the.symbol.`x'.....File: |
| ddbe0 | 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 31 2d 35 2c 20 20 4e 65 78 74 3a | .sicp.info,..Node:.4-1-5,..Next: |
| ddc00 | 20 34 2d 31 2d 36 2c 20 20 50 72 65 76 3a 20 34 2d 31 2d 34 2c 20 20 55 70 3a 20 34 2d 31 0a 0a | .4-1-6,..Prev:.4-1-4,..Up:.4-1.. |
| ddc20 | 34 2e 31 2e 35 20 44 61 74 61 20 61 73 20 50 72 6f 67 72 61 6d 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d | 4.1.5.Data.as.Programs.--------- |
| ddc40 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 6e 20 74 68 69 6e 6b 69 6e 67 20 61 62 6f 75 74 | -------------..In.thinking.about |
| ddc60 | 20 61 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 65 76 61 6c 75 61 74 65 73 20 4c | .a.Lisp.program.that.evaluates.L |
| ddc80 | 69 73 70 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 61 6e 0a 61 6e 61 6c 6f 67 79 20 6d 69 67 68 | isp.expressions,.an.analogy.migh |
| ddca0 | 74 20 62 65 20 68 65 6c 70 66 75 6c 2e 20 20 4f 6e 65 20 6f 70 65 72 61 74 69 6f 6e 61 6c 20 76 | t.be.helpful...One.operational.v |
| ddcc0 | 69 65 77 20 6f 66 20 74 68 65 20 6d 65 61 6e 69 6e 67 20 6f 66 20 61 0a 70 72 6f 67 72 61 6d 20 | iew.of.the.meaning.of.a.program. |
| ddce0 | 69 73 20 74 68 61 74 20 61 20 70 72 6f 67 72 61 6d 20 69 73 20 61 20 64 65 73 63 72 69 70 74 69 | is.that.a.program.is.a.descripti |
| ddd00 | 6f 6e 20 6f 66 20 61 6e 20 61 62 73 74 72 61 63 74 20 28 70 65 72 68 61 70 73 0a 69 6e 66 69 6e | on.of.an.abstract.(perhaps.infin |
| ddd20 | 69 74 65 6c 79 20 6c 61 72 67 65 29 20 6d 61 63 68 69 6e 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 | itely.large).machine...For.examp |
| ddd40 | 6c 65 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 66 61 6d 69 6c 69 61 72 20 70 72 6f 67 72 61 | le,.consider.the.familiar.progra |
| ddd60 | 6d 0a 74 6f 20 63 6f 6d 70 75 74 65 20 66 61 63 74 6f 72 69 61 6c 73 3a 0a 0a 20 20 20 20 20 28 | m.to.compute.factorials:.......( |
| ddd80 | 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 28 69 66 20 | define.(factorial.n)........(if. |
| ddda0 | 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 | (=.n.1)............1............ |
| dddc0 | 28 2a 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 29 29 0a 0a 20 20 20 | (*.(factorial.(-.n.1)).n)))..... |
| ddde0 | 57 65 20 6d 61 79 20 72 65 67 61 72 64 20 74 68 69 73 20 70 72 6f 67 72 61 6d 20 61 73 20 74 68 | We.may.regard.this.program.as.th |
| dde00 | 65 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 61 20 6d 61 63 68 69 6e 65 0a 63 6f 6e 74 61 | e.description.of.a.machine.conta |
| dde20 | 69 6e 69 6e 67 20 70 61 72 74 73 20 74 68 61 74 20 64 65 63 72 65 6d 65 6e 74 2c 20 6d 75 6c 74 | ining.parts.that.decrement,.mult |
| dde40 | 69 70 6c 79 2c 20 61 6e 64 20 74 65 73 74 20 66 6f 72 20 65 71 75 61 6c 69 74 79 2c 0a 74 6f 67 | iply,.and.test.for.equality,.tog |
| dde60 | 65 74 68 65 72 20 77 69 74 68 20 61 20 74 77 6f 2d 70 6f 73 69 74 69 6f 6e 20 73 77 69 74 63 68 | ether.with.a.two-position.switch |
| dde80 | 20 61 6e 64 20 61 6e 6f 74 68 65 72 20 66 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 2e 20 | .and.another.factorial.machine.. |
| ddea0 | 28 54 68 65 0a 66 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 20 69 73 20 69 6e 66 69 6e 69 | (The.factorial.machine.is.infini |
| ddec0 | 74 65 20 62 65 63 61 75 73 65 20 69 74 20 63 6f 6e 74 61 69 6e 73 20 61 6e 6f 74 68 65 72 20 66 | te.because.it.contains.another.f |
| ddee0 | 61 63 74 6f 72 69 61 6c 0a 6d 61 63 68 69 6e 65 20 77 69 74 68 69 6e 20 69 74 2e 29 20 20 2a 4e | actorial.machine.within.it.)..*N |
| ddf00 | 6f 74 65 20 46 69 67 75 72 65 20 34 2d 32 3a 3a 20 69 73 20 61 20 66 6c 6f 77 20 64 69 61 67 72 | ote.Figure.4-2::.is.a.flow.diagr |
| ddf20 | 61 6d 20 66 6f 72 20 74 68 65 0a 66 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 2c 20 73 68 | am.for.the.factorial.machine,.sh |
| ddf40 | 6f 77 69 6e 67 20 68 6f 77 20 74 68 65 20 70 61 72 74 73 20 61 72 65 20 77 69 72 65 64 20 74 6f | owing.how.the.parts.are.wired.to |
| ddf60 | 67 65 74 68 65 72 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 34 2e 32 3a 2a 20 54 68 65 20 | gether........*Figure.4.2:*.The. |
| ddf80 | 66 61 63 74 6f 72 69 61 6c 20 70 72 6f 67 72 61 6d 2c 20 76 69 65 77 65 64 20 61 73 20 61 6e 20 | factorial.program,.viewed.as.an. |
| ddfa0 | 61 62 73 74 72 61 63 74 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | abstract.machine................ |
| ddfc0 | 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .+------------------------------ |
| ddfe0 | 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 66 61 63 74 6f 72 69 61 6c | -----+...............|.factorial |
| de000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 31 20 20 20 20 7c 0a 20 20 20 20 20 | ...................|1....|...... |
| de020 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 31 20 20 20 20 20 20 | .........|..............|1...... |
| de040 | 20 20 20 20 20 20 20 56 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | .......V.....|...............|.. |
| de060 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 | ............|...........+-----+. |
| de080 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .|...............|.............. |
| de0a0 | 56 20 20 20 20 20 20 20 20 20 20 20 7c 20 23 20 20 20 7c 20 20 7c 0a 20 20 20 20 20 20 20 20 20 | V...........|.#...|..|.......... |
| de0c0 | 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 | .....|...........+-----+........ |
| de0e0 | 7c 20 20 20 20 20 7c 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 36 20 2d 2d 2d 2d 2d 2d 2d 2d 2a | |.....|..|...........6.--------* |
| de100 | 2d 2d 2d 2d 2d 7c 20 20 3d 20 20 7c 2d 2d 2d 2d 2d 2d 2d 3e 7c 20 20 20 23 2d 2b 2d 2d 2d 2d 2d | -----|..=..|------->|...#-+----- |
| de120 | 3e 20 37 32 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 20 | >.720...............|.....|..... |
| de140 | 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 7c 20 20 2f 20 20 7c 20 20 7c 0a 20 20 20 20 20 20 | +-----+........|../..|..|....... |
| de160 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........|.....|................. |
| de180 | 20 20 20 7c 20 23 20 20 20 7c 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | ...|.#...|..|...............|... |
| de1a0 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 | ..|....................+-----+.. |
| de1c0 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 | |...............|.....|......... |
| de1e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | ..............^.....|........... |
| de200 | 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....|.....|..................... |
| de220 | 20 20 7c 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 | ..|.....|...............|.....|. |
| de240 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2b 2d 2d 2b 20 20 7c 0a 20 20 | ...................+--+--+..|... |
| de260 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ............|.....*------------- |
| de280 | 2d 2d 2d 2d 2d 2d 3e 7c 20 20 2a 20 20 7c 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ------>|..*..|..|............... |
| de2a0 | 7c 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d | |.....|....................+---- |
| de2c0 | 2d 2b 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 56 20 20 20 20 20 | -+..|...............|.....V..... |
| de2e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 7c 0a 20 20 20 20 20 20 | ..................^.....|....... |
| de300 | 20 20 20 20 20 20 20 20 7c 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d | ........|..+-----+....+--------- |
| de320 | 2d 2d 2b 20 20 20 7c 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c | --+...|.....|...............|..| |
| de340 | 20 20 2d 20 20 2b 2d 2d 2d 3e 7c 20 66 61 63 74 6f 72 69 61 6c 20 2b 2d 2d 2d 2b 20 20 20 20 20 | ..-..+--->|.factorial.+---+..... |
| de360 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 2b 2d | |...............|..+-----+....+- |
| de380 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | ----------+.........|........... |
| de3a0 | 20 20 20 20 7c 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....|.....^..................... |
| de3c0 | 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 31 | ........|...............|.....|1 |
| de3e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 | ............................|... |
| de400 | 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ............+------------------- |
| de420 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 49 6e 20 61 20 73 69 6d 69 6c | ----------------+.....In.a.simil |
| de440 | 61 72 20 77 61 79 2c 20 77 65 20 63 61 6e 20 72 65 67 61 72 64 20 74 68 65 20 65 76 61 6c 75 61 | ar.way,.we.can.regard.the.evalua |
| de460 | 74 6f 72 20 61 73 20 61 20 76 65 72 79 20 73 70 65 63 69 61 6c 0a 6d 61 63 68 69 6e 65 20 74 68 | tor.as.a.very.special.machine.th |
| de480 | 61 74 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 20 61 20 64 65 73 63 72 69 70 74 69 6f 6e 20 | at.takes.as.input.a.description. |
| de4a0 | 6f 66 20 61 20 6d 61 63 68 69 6e 65 2e 20 20 47 69 76 65 6e 20 74 68 69 73 0a 69 6e 70 75 74 2c | of.a.machine...Given.this.input, |
| de4c0 | 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 63 6f 6e 66 69 67 75 72 65 73 20 69 74 73 65 6c 66 | .the.evaluator.configures.itself |
| de4e0 | 20 74 6f 20 65 6d 75 6c 61 74 65 20 74 68 65 20 6d 61 63 68 69 6e 65 0a 64 65 73 63 72 69 62 65 | .to.emulate.the.machine.describe |
| de500 | 64 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 77 65 20 66 65 65 64 20 6f 75 72 20 | d...For.example,.if.we.feed.our. |
| de520 | 65 76 61 6c 75 61 74 6f 72 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 0a 60 66 61 63 | evaluator.the.definition.of.`fac |
| de540 | 74 6f 72 69 61 6c 27 2c 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 | torial',.as.shown.in.*Note.Figur |
| de560 | 65 20 34 2d 33 3a 3a 2c 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 77 69 6c 6c 20 62 65 20 61 | e.4-3::,.the.evaluator.will.be.a |
| de580 | 62 6c 65 0a 74 6f 20 63 6f 6d 70 75 74 65 20 66 61 63 74 6f 72 69 61 6c 73 2e 0a 0a 20 20 20 20 | ble.to.compute.factorials....... |
| de5a0 | 20 2a 46 69 67 75 72 65 20 34 2e 33 3a 2a 20 54 68 65 20 65 76 61 6c 75 61 74 6f 72 20 65 6d 75 | .*Figure.4.3:*.The.evaluator.emu |
| de5c0 | 6c 61 74 69 6e 67 20 61 20 66 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 | lating.a.factorial.machine...... |
| de5e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d | ..........................+----- |
| de600 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 36 20 2d 2d 2d | ---+.......................6.--- |
| de620 | 2d 3e 7c 20 20 65 76 61 6c 20 20 7c 2d 2d 2d 2d 3e 20 37 32 30 0a 20 20 20 20 20 20 20 20 20 20 | ->|..eval..|---->.720........... |
| de640 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 | ...................+--------+... |
| de660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f | .............................../ |
| de680 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 20 2e 20 2e 20 20 20 | ................................ |
| de6a0 | 20 2f 20 20 2e 20 2e 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 20 2e 20 2e | ./.............................. |
| de6c0 | 20 20 20 20 20 20 20 2e 2e 2f 2e 20 2e 20 20 20 20 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 | ........./...................... |
| de6e0 | 20 20 20 20 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| de700 | 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 | .....................(define.(fa |
| de720 | 63 74 6f 72 69 61 6c 20 6e 29 20 20 20 20 20 20 2e 20 2e 20 2e 0a 20 20 20 20 20 20 20 20 20 20 | ctorial.n)...................... |
| de740 | 20 20 20 2e 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 20 20 20 20 20 20 20 20 20 20 20 | ..........(if.(=.n.1)........... |
| de760 | 20 20 20 20 20 20 20 20 2e 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 20 20 20 20 20 | ................................ |
| de780 | 20 20 20 20 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....1........................... |
| de7a0 | 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 20 20 20 20 20 20 20 20 20 28 2a 20 28 66 | ...........................(*.(f |
| de7c0 | 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 29 29 20 20 20 2e 0a 20 20 20 20 20 | actorial.(-.n.1)).n))).......... |
| de7e0 | 20 20 20 20 20 20 20 20 20 20 20 2e 20 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| de800 | 20 20 20 20 20 2e 20 2e 20 20 20 20 20 20 20 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| de820 | 20 20 20 20 20 20 2e 20 2e 20 20 2e 20 2e 20 20 20 20 20 20 2e 20 2e 20 2e 20 2e 20 20 20 20 20 | ................................ |
| de840 | 2e 20 2e 20 2e 20 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| de860 | 20 20 20 20 20 2e 20 2e 2e 0a 0a 20 20 20 46 72 6f 6d 20 74 68 69 73 20 70 65 72 73 70 65 63 74 | ..............From.this.perspect |
| de880 | 69 76 65 2c 20 6f 75 72 20 65 76 61 6c 75 61 74 6f 72 20 69 73 20 73 65 65 6e 20 74 6f 20 62 65 | ive,.our.evaluator.is.seen.to.be |
| de8a0 | 20 61 20 6d 61 63 68 69 6e 65 0a 22 75 6e 69 76 65 72 73 61 6c 20 6d 61 63 68 69 6e 65 22 2e 20 | .a.machine."universal.machine".. |
| de8c0 | 20 49 74 20 6d 69 6d 69 63 73 20 6f 74 68 65 72 20 6d 61 63 68 69 6e 65 73 20 77 68 65 6e 20 74 | .It.mimics.other.machines.when.t |
| de8e0 | 68 65 73 65 20 61 72 65 20 64 65 73 63 72 69 62 65 64 0a 61 73 20 4c 69 73 70 20 70 72 6f 67 72 | hese.are.described.as.Lisp.progr |
| de900 | 61 6d 73 2e 28 31 29 20 54 68 69 73 20 69 73 20 73 74 72 69 6b 69 6e 67 2e 20 54 72 79 20 74 6f | ams.(1).This.is.striking..Try.to |
| de920 | 20 69 6d 61 67 69 6e 65 20 61 6e 20 61 6e 61 6c 6f 67 6f 75 73 0a 65 76 61 6c 75 61 74 6f 72 20 | .imagine.an.analogous.evaluator. |
| de940 | 66 6f 72 20 65 6c 65 63 74 72 69 63 61 6c 20 63 69 72 63 75 69 74 73 2e 20 20 54 68 69 73 20 77 | for.electrical.circuits...This.w |
| de960 | 6f 75 6c 64 20 62 65 20 61 20 63 69 72 63 75 69 74 20 74 68 61 74 20 74 61 6b 65 73 0a 61 73 20 | ould.be.a.circuit.that.takes.as. |
| de980 | 69 6e 70 75 74 20 61 20 73 69 67 6e 61 6c 20 65 6e 63 6f 64 69 6e 67 20 74 68 65 20 70 6c 61 6e | input.a.signal.encoding.the.plan |
| de9a0 | 73 20 66 6f 72 20 73 6f 6d 65 20 6f 74 68 65 72 20 63 69 72 63 75 69 74 2c 20 73 75 63 68 20 61 | s.for.some.other.circuit,.such.a |
| de9c0 | 73 20 61 0a 66 69 6c 74 65 72 2e 20 20 47 69 76 65 6e 20 74 68 69 73 20 69 6e 70 75 74 2c 20 74 | s.a.filter...Given.this.input,.t |
| de9e0 | 68 65 20 63 69 72 63 75 69 74 20 65 76 61 6c 75 61 74 6f 72 20 77 6f 75 6c 64 20 74 68 65 6e 20 | he.circuit.evaluator.would.then. |
| dea00 | 62 65 68 61 76 65 20 6c 69 6b 65 0a 61 20 66 69 6c 74 65 72 20 77 69 74 68 20 74 68 65 20 73 61 | behave.like.a.filter.with.the.sa |
| dea20 | 6d 65 20 64 65 73 63 72 69 70 74 69 6f 6e 2e 20 20 53 75 63 68 20 61 20 75 6e 69 76 65 72 73 61 | me.description...Such.a.universa |
| dea40 | 6c 20 65 6c 65 63 74 72 69 63 61 6c 0a 63 69 72 63 75 69 74 20 69 73 20 61 6c 6d 6f 73 74 20 75 | l.electrical.circuit.is.almost.u |
| dea60 | 6e 69 6d 61 67 69 6e 61 62 6c 79 20 63 6f 6d 70 6c 65 78 2e 20 20 49 74 20 69 73 20 72 65 6d 61 | nimaginably.complex...It.is.rema |
| dea80 | 72 6b 61 62 6c 65 20 74 68 61 74 20 74 68 65 0a 70 72 6f 67 72 61 6d 20 65 76 61 6c 75 61 74 6f | rkable.that.the.program.evaluato |
| deaa0 | 72 20 69 73 20 61 20 72 61 74 68 65 72 20 73 69 6d 70 6c 65 20 70 72 6f 67 72 61 6d 2e 28 32 29 | r.is.a.rather.simple.program.(2) |
| deac0 | 0a 0a 20 20 20 41 6e 6f 74 68 65 72 20 73 74 72 69 6b 69 6e 67 20 61 73 70 65 63 74 20 6f 66 20 | .....Another.striking.aspect.of. |
| deae0 | 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 69 73 20 74 68 61 74 20 69 74 20 61 63 74 73 20 61 73 | the.evaluator.is.that.it.acts.as |
| deb00 | 20 61 20 62 72 69 64 67 65 0a 62 65 74 77 65 65 6e 20 74 68 65 20 64 61 74 61 20 6f 62 6a 65 63 | .a.bridge.between.the.data.objec |
| deb20 | 74 73 20 74 68 61 74 20 61 72 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 20 62 79 20 6f 75 72 20 70 | ts.that.are.manipulated.by.our.p |
| deb40 | 72 6f 67 72 61 6d 6d 69 6e 67 0a 6c 61 6e 67 75 61 67 65 20 61 6e 64 20 74 68 65 20 70 72 6f 67 | rogramming.language.and.the.prog |
| deb60 | 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 69 74 73 65 6c 66 2e 20 20 49 6d 61 67 69 6e | ramming.language.itself...Imagin |
| deb80 | 65 20 74 68 61 74 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 20 70 72 6f 67 72 61 6d 20 28 69 6d | e.that.the.evaluator.program.(im |
| deba0 | 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 4c 69 73 70 29 20 69 73 20 72 75 6e 6e 69 6e 67 2c 20 61 | plemented.in.Lisp).is.running,.a |
| debc0 | 6e 64 20 74 68 61 74 20 61 20 75 73 65 72 20 69 73 0a 74 79 70 69 6e 67 20 65 78 70 72 65 73 73 | nd.that.a.user.is.typing.express |
| debe0 | 69 6f 6e 73 20 74 6f 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 61 6e 64 20 6f 62 73 65 72 76 | ions.to.the.evaluator.and.observ |
| dec00 | 69 6e 67 20 74 68 65 20 72 65 73 75 6c 74 73 2e 20 20 46 72 6f 6d 0a 74 68 65 20 70 65 72 73 70 | ing.the.results...From.the.persp |
| dec20 | 65 63 74 69 76 65 20 6f 66 20 74 68 65 20 75 73 65 72 2c 20 61 6e 20 69 6e 70 75 74 20 65 78 70 | ective.of.the.user,.an.input.exp |
| dec40 | 72 65 73 73 69 6f 6e 20 73 75 63 68 20 61 73 20 60 28 2a 20 78 20 78 29 27 20 69 73 0a 61 6e 20 | ression.such.as.`(*.x.x)'.is.an. |
| dec60 | 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 | expression.in.the.programming.la |
| dec80 | 6e 67 75 61 67 65 2c 20 77 68 69 63 68 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 73 68 6f 75 | nguage,.which.the.evaluator.shou |
| deca0 | 6c 64 0a 65 78 65 63 75 74 65 2e 20 20 46 72 6f 6d 20 74 68 65 20 70 65 72 73 70 65 63 74 69 76 | ld.execute...From.the.perspectiv |
| decc0 | 65 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 65 | e.of.the.evaluator,.however,.the |
| dece0 | 0a 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 73 69 6d 70 6c 79 20 61 20 6c 69 73 74 20 28 69 6e | .expression.is.simply.a.list.(in |
| ded00 | 20 74 68 69 73 20 63 61 73 65 2c 20 61 20 6c 69 73 74 20 6f 66 20 74 68 72 65 65 20 73 79 6d 62 | .this.case,.a.list.of.three.symb |
| ded20 | 6f 6c 73 3a 20 60 2a 27 2c 0a 60 78 27 2c 20 61 6e 64 20 60 78 27 29 20 74 68 61 74 20 69 73 20 | ols:.`*',.`x',.and.`x').that.is. |
| ded40 | 74 6f 20 62 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 61 | to.be.manipulated.according.to.a |
| ded60 | 20 77 65 6c 6c 2d 64 65 66 69 6e 65 64 20 73 65 74 0a 6f 66 20 72 75 6c 65 73 2e 0a 0a 20 20 20 | .well-defined.set.of.rules...... |
| ded80 | 54 68 61 74 20 74 68 65 20 75 73 65 72 27 73 20 70 72 6f 67 72 61 6d 73 20 61 72 65 20 74 68 65 | That.the.user's.programs.are.the |
| deda0 | 20 65 76 61 6c 75 61 74 6f 72 27 73 20 64 61 74 61 20 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 0a | .evaluator's.data.need.not.be.a. |
| dedc0 | 73 6f 75 72 63 65 20 6f 66 20 63 6f 6e 66 75 73 69 6f 6e 2e 20 20 49 6e 20 66 61 63 74 2c 20 69 | source.of.confusion...In.fact,.i |
| dede0 | 74 20 69 73 20 73 6f 6d 65 74 69 6d 65 73 20 63 6f 6e 76 65 6e 69 65 6e 74 20 74 6f 20 69 67 6e | t.is.sometimes.convenient.to.ign |
| dee00 | 6f 72 65 0a 74 68 69 73 20 64 69 73 74 69 6e 63 74 69 6f 6e 2c 20 61 6e 64 20 74 6f 20 67 69 76 | ore.this.distinction,.and.to.giv |
| dee20 | 65 20 74 68 65 20 75 73 65 72 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 65 78 70 6c 69 63 | e.the.user.the.ability.to.explic |
| dee40 | 69 74 6c 79 0a 65 76 61 6c 75 61 74 65 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 20 61 73 20 61 | itly.evaluate.a.data.object.as.a |
| dee60 | 20 4c 69 73 70 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 62 79 20 6d 61 6b 69 6e 67 20 60 65 76 61 | .Lisp.expression,.by.making.`eva |
| dee80 | 6c 27 20 61 76 61 69 6c 61 62 6c 65 0a 66 6f 72 20 75 73 65 20 69 6e 20 70 72 6f 67 72 61 6d 73 | l'.available.for.use.in.programs |
| deea0 | 2e 20 20 4d 61 6e 79 20 4c 69 73 70 20 64 69 61 6c 65 63 74 73 20 70 72 6f 76 69 64 65 20 61 20 | ...Many.Lisp.dialects.provide.a. |
| deec0 | 70 72 69 6d 69 74 69 76 65 20 60 65 76 61 6c 27 0a 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 | primitive.`eval'.procedure.that. |
| deee0 | 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e | takes.as.arguments.an.expression |
| def00 | 20 61 6e 64 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 6e 64 0a 65 76 61 6c 75 61 74 65 | .and.an.environment.and.evaluate |
| def20 | 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 72 65 6c 61 74 69 76 65 20 74 6f 20 74 68 65 | s.the.expression.relative.to.the |
| def40 | 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 28 33 29 20 54 68 75 73 2c 0a 0a 20 20 20 20 20 28 65 76 | .environment.(3).Thus,.......(ev |
| def60 | 61 6c 20 27 28 2a 20 35 20 35 29 20 75 73 65 72 2d 69 6e 69 74 69 61 6c 2d 65 6e 76 69 72 6f 6e | al.'(*.5.5).user-initial-environ |
| def80 | 6d 65 6e 74 29 0a 0a 61 6e 64 0a 0a 20 20 20 20 20 28 65 76 61 6c 20 28 63 6f 6e 73 20 27 2a 20 | ment)..and.......(eval.(cons.'*. |
| defa0 | 28 6c 69 73 74 20 35 20 35 29 29 20 75 73 65 72 2d 69 6e 69 74 69 61 6c 2d 65 6e 76 69 72 6f 6e | (list.5.5)).user-initial-environ |
| defc0 | 6d 65 6e 74 29 0a 0a 77 69 6c 6c 20 62 6f 74 68 20 72 65 74 75 72 6e 20 32 35 2e 28 34 29 0a 0a | ment)..will.both.return.25.(4).. |
| defe0 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 31 35 3a 2a 20 47 69 76 65 6e 20 61 20 6f 6e | .....*Exercise.4.15:*.Given.a.on |
| df000 | 65 2d 61 72 67 75 6d 65 6e 74 20 70 72 6f 63 65 64 75 72 65 20 60 70 27 20 61 6e 64 20 61 6e 20 | e-argument.procedure.`p'.and.an. |
| df020 | 6f 62 6a 65 63 74 0a 20 20 20 20 20 60 61 27 2c 20 60 70 27 20 69 73 20 73 61 69 64 20 74 6f 20 | object......`a',.`p'.is.said.to. |
| df040 | 22 68 61 6c 74 22 20 6f 6e 20 60 61 27 20 69 66 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 | "halt".on.`a'.if.evaluating.the. |
| df060 | 65 78 70 72 65 73 73 69 6f 6e 20 60 28 70 0a 20 20 20 20 20 61 29 27 20 72 65 74 75 72 6e 73 20 | expression.`(p......a)'.returns. |
| df080 | 61 20 76 61 6c 75 65 20 28 61 73 20 6f 70 70 6f 73 65 64 20 74 6f 20 74 65 72 6d 69 6e 61 74 69 | a.value.(as.opposed.to.terminati |
| df0a0 | 6e 67 20 77 69 74 68 20 61 6e 20 65 72 72 6f 72 0a 20 20 20 20 20 6d 65 73 73 61 67 65 20 6f 72 | ng.with.an.error......message.or |
| df0c0 | 20 72 75 6e 6e 69 6e 67 20 66 6f 72 65 76 65 72 29 2e 20 20 53 68 6f 77 20 74 68 61 74 20 69 74 | .running.forever)...Show.that.it |
| df0e0 | 20 69 73 20 69 6d 70 6f 73 73 69 62 6c 65 20 74 6f 20 77 72 69 74 65 0a 20 20 20 20 20 61 20 70 | .is.impossible.to.write......a.p |
| df100 | 72 6f 63 65 64 75 72 65 20 60 68 61 6c 74 73 3f 27 20 74 68 61 74 20 63 6f 72 72 65 63 74 6c 79 | rocedure.`halts?'.that.correctly |
| df120 | 20 64 65 74 65 72 6d 69 6e 65 73 20 77 68 65 74 68 65 72 20 60 70 27 20 68 61 6c 74 73 0a 20 20 | .determines.whether.`p'.halts... |
| df140 | 20 20 20 6f 6e 20 60 61 27 20 66 6f 72 20 61 6e 79 20 70 72 6f 63 65 64 75 72 65 20 60 70 27 20 | ...on.`a'.for.any.procedure.`p'. |
| df160 | 61 6e 64 20 6f 62 6a 65 63 74 20 60 61 27 2e 20 20 55 73 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 | and.object.`a'...Use.the.followi |
| df180 | 6e 67 0a 20 20 20 20 20 72 65 61 73 6f 6e 69 6e 67 3a 20 49 66 20 79 6f 75 20 68 61 64 20 73 75 | ng......reasoning:.If.you.had.su |
| df1a0 | 63 68 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 68 61 6c 74 73 3f 27 2c 20 79 6f 75 20 63 6f 75 | ch.a.procedure.`halts?',.you.cou |
| df1c0 | 6c 64 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 | ld......implement.the.following. |
| df1e0 | 70 72 6f 67 72 61 6d 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 75 6e | program:............(define.(run |
| df200 | 2d 66 6f 72 65 76 65 72 29 20 28 72 75 6e 2d 66 6f 72 65 76 65 72 29 29 0a 0a 20 20 20 20 20 20 | -forever).(run-forever))........ |
| df220 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 79 20 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ....(define.(try.p)............. |
| df240 | 28 69 66 20 28 68 61 6c 74 73 3f 20 70 20 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (if.(halts?.p.p)................ |
| df260 | 20 28 72 75 6e 2d 66 6f 72 65 76 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 | .(run-forever).................' |
| df280 | 68 61 6c 74 65 64 29 29 0a 0a 20 20 20 20 20 4e 6f 77 20 63 6f 6e 73 69 64 65 72 20 65 76 61 6c | halted)).......Now.consider.eval |
| df2a0 | 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 74 72 79 20 74 72 79 29 | uating.the.expression.`(try.try) |
| df2c0 | 27 20 61 6e 64 20 73 68 6f 77 20 74 68 61 74 0a 20 20 20 20 20 61 6e 79 20 70 6f 73 73 69 62 6c | '.and.show.that......any.possibl |
| df2e0 | 65 20 6f 75 74 63 6f 6d 65 20 28 65 69 74 68 65 72 20 68 61 6c 74 69 6e 67 20 6f 72 20 72 75 6e | e.outcome.(either.halting.or.run |
| df300 | 6e 69 6e 67 20 66 6f 72 65 76 65 72 29 20 76 69 6f 6c 61 74 65 73 0a 20 20 20 20 20 74 68 65 20 | ning.forever).violates......the. |
| df320 | 69 6e 74 65 6e 64 65 64 20 62 65 68 61 76 69 6f 72 20 6f 66 20 60 68 61 6c 74 73 3f 27 2e 28 35 | intended.behavior.of.`halts?'.(5 |
| df340 | 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d | ).....----------.Footnotes.----- |
| df360 | 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 65 20 66 61 63 74 20 74 68 61 74 20 74 68 65 20 | -----.....(1).The.fact.that.the. |
| df380 | 6d 61 63 68 69 6e 65 73 20 61 72 65 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 4c 69 73 70 20 69 | machines.are.described.in.Lisp.i |
| df3a0 | 73 20 69 6e 65 73 73 65 6e 74 69 61 6c 2e 0a 49 66 20 77 65 20 67 69 76 65 20 6f 75 72 20 65 76 | s.inessential..If.we.give.our.ev |
| df3c0 | 61 6c 75 61 74 6f 72 20 61 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 62 65 68 61 | aluator.a.Lisp.program.that.beha |
| df3e0 | 76 65 73 20 61 73 20 61 6e 20 65 76 61 6c 75 61 74 6f 72 0a 66 6f 72 20 73 6f 6d 65 20 6f 74 68 | ves.as.an.evaluator.for.some.oth |
| df400 | 65 72 20 6c 61 6e 67 75 61 67 65 2c 20 73 61 79 20 43 2c 20 74 68 65 20 4c 69 73 70 20 65 76 61 | er.language,.say.C,.the.Lisp.eva |
| df420 | 6c 75 61 74 6f 72 20 77 69 6c 6c 20 65 6d 75 6c 61 74 65 20 74 68 65 20 43 0a 65 76 61 6c 75 61 | luator.will.emulate.the.C.evalua |
| df440 | 74 6f 72 2c 20 77 68 69 63 68 20 69 6e 20 74 75 72 6e 20 63 61 6e 20 65 6d 75 6c 61 74 65 20 61 | tor,.which.in.turn.can.emulate.a |
| df460 | 6e 79 20 6d 61 63 68 69 6e 65 20 64 65 73 63 72 69 62 65 64 20 61 73 20 61 20 43 0a 70 72 6f 67 | ny.machine.described.as.a.C.prog |
| df480 | 72 61 6d 2e 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 77 72 69 74 69 6e 67 20 61 20 4c 69 73 70 20 | ram...Similarly,.writing.a.Lisp. |
| df4a0 | 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 43 20 70 72 6f 64 75 63 65 73 20 61 20 43 20 70 72 6f 67 | evaluator.in.C.produces.a.C.prog |
| df4c0 | 72 61 6d 0a 74 68 61 74 20 63 61 6e 20 65 78 65 63 75 74 65 20 61 6e 79 20 4c 69 73 70 20 70 72 | ram.that.can.execute.any.Lisp.pr |
| df4e0 | 6f 67 72 61 6d 2e 20 20 54 68 65 20 64 65 65 70 20 69 64 65 61 20 68 65 72 65 20 69 73 20 74 68 | ogram...The.deep.idea.here.is.th |
| df500 | 61 74 20 61 6e 79 0a 65 76 61 6c 75 61 74 6f 72 20 63 61 6e 20 65 6d 75 6c 61 74 65 20 61 6e 79 | at.any.evaluator.can.emulate.any |
| df520 | 20 6f 74 68 65 72 2e 20 20 54 68 75 73 2c 20 74 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 20 22 77 68 | .other...Thus,.the.notion.of."wh |
| df540 | 61 74 20 63 61 6e 20 69 6e 0a 70 72 69 6e 63 69 70 6c 65 20 62 65 20 63 6f 6d 70 75 74 65 64 22 | at.can.in.principle.be.computed" |
| df560 | 20 28 69 67 6e 6f 72 69 6e 67 20 70 72 61 63 74 69 63 61 6c 69 74 69 65 73 20 6f 66 20 74 69 6d | .(ignoring.practicalities.of.tim |
| df580 | 65 20 61 6e 64 20 6d 65 6d 6f 72 79 0a 72 65 71 75 69 72 65 64 29 20 69 73 20 69 6e 64 65 70 65 | e.and.memory.required).is.indepe |
| df5a0 | 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 6f 72 20 74 68 65 20 63 6f 6d | ndent.of.the.language.or.the.com |
| df5c0 | 70 75 74 65 72 2c 20 61 6e 64 20 69 6e 73 74 65 61 64 0a 72 65 66 6c 65 63 74 73 20 61 6e 20 75 | puter,.and.instead.reflects.an.u |
| df5e0 | 6e 64 65 72 6c 79 69 6e 67 20 6e 6f 74 69 6f 6e 20 6f 66 20 22 63 6f 6d 70 75 74 61 62 69 6c 69 | nderlying.notion.of."computabili |
| df600 | 74 79 22 2e 20 20 54 68 69 73 20 77 61 73 20 66 69 72 73 74 0a 64 65 6d 6f 6e 73 74 72 61 74 65 | ty"...This.was.first.demonstrate |
| df620 | 64 20 69 6e 20 61 20 63 6c 65 61 72 20 77 61 79 20 62 79 20 41 6c 61 6e 20 4d 2e 20 54 75 72 69 | d.in.a.clear.way.by.Alan.M..Turi |
| df640 | 6e 67 20 28 31 39 31 32 2d 31 39 35 34 29 2c 20 77 68 6f 73 65 20 31 39 33 36 0a 70 61 70 65 72 | ng.(1912-1954),.whose.1936.paper |
| df660 | 20 6c 61 69 64 20 74 68 65 20 66 6f 75 6e 64 61 74 69 6f 6e 73 20 66 6f 72 20 74 68 65 6f 72 65 | .laid.the.foundations.for.theore |
| df680 | 74 69 63 61 6c 20 63 6f 6d 70 75 74 65 72 20 73 63 69 65 6e 63 65 2e 20 20 49 6e 20 74 68 65 0a | tical.computer.science...In.the. |
| df6a0 | 70 61 70 65 72 2c 20 54 75 72 69 6e 67 20 70 72 65 73 65 6e 74 65 64 20 61 20 73 69 6d 70 6c 65 | paper,.Turing.presented.a.simple |
| df6c0 | 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6d 6f 64 65 6c 2d 2d 6e 6f 77 20 6b 6e 6f 77 6e 20 | .computational.model--now.known. |
| df6e0 | 61 73 20 61 20 22 54 75 72 69 6e 67 0a 6d 61 63 68 69 6e 65 22 2d 2d 61 6e 64 20 61 72 67 75 65 | as.a."Turing.machine"--and.argue |
| df700 | 64 20 74 68 61 74 20 61 6e 79 20 22 65 66 66 65 63 74 69 76 65 20 70 72 6f 63 65 73 73 22 20 63 | d.that.any."effective.process".c |
| df720 | 61 6e 20 62 65 20 66 6f 72 6d 75 6c 61 74 65 64 20 61 73 0a 61 20 70 72 6f 67 72 61 6d 20 66 6f | an.be.formulated.as.a.program.fo |
| df740 | 72 20 73 75 63 68 20 61 20 6d 61 63 68 69 6e 65 2e 20 20 28 54 68 69 73 20 61 72 67 75 6d 65 6e | r.such.a.machine...(This.argumen |
| df760 | 74 20 69 73 20 6b 6e 6f 77 6e 20 61 73 20 74 68 65 20 22 43 68 75 72 63 68 2d 54 75 72 69 6e 67 | t.is.known.as.the."Church-Turing |
| df780 | 0a 74 68 65 73 69 73 22 2e 29 20 20 54 75 72 69 6e 67 20 74 68 65 6e 20 69 6d 70 6c 65 6d 65 6e | .thesis".)..Turing.then.implemen |
| df7a0 | 74 65 64 20 61 20 75 6e 69 76 65 72 73 61 6c 20 6d 61 63 68 69 6e 65 2c 20 69 2e 65 2e 2c 20 61 | ted.a.universal.machine,.i.e.,.a |
| df7c0 | 20 54 75 72 69 6e 67 0a 6d 61 63 68 69 6e 65 20 74 68 61 74 20 62 65 68 61 76 65 73 20 61 73 20 | .Turing.machine.that.behaves.as. |
| df7e0 | 61 6e 20 65 76 61 6c 75 61 74 6f 72 20 66 6f 72 20 54 75 72 69 6e 67 2d 6d 61 63 68 69 6e 65 20 | an.evaluator.for.Turing-machine. |
| df800 | 70 72 6f 67 72 61 6d 73 2e 20 20 48 65 0a 75 73 65 64 20 74 68 69 73 20 66 72 61 6d 65 77 6f 72 | programs...He.used.this.framewor |
| df820 | 6b 20 74 6f 20 64 65 6d 6f 6e 73 74 72 61 74 65 20 74 68 61 74 20 74 68 65 72 65 20 61 72 65 20 | k.to.demonstrate.that.there.are. |
| df840 | 77 65 6c 6c 2d 70 6f 73 65 64 20 70 72 6f 62 6c 65 6d 73 0a 74 68 61 74 20 63 61 6e 6e 6f 74 20 | well-posed.problems.that.cannot. |
| df860 | 62 65 20 63 6f 6d 70 75 74 65 64 20 62 79 20 54 75 72 69 6e 67 20 6d 61 63 68 69 6e 65 73 20 28 | be.computed.by.Turing.machines.( |
| df880 | 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 31 35 3a 3a 29 2c 0a 61 6e 64 20 | see.*Note.Exercise.4-15::),.and. |
| df8a0 | 73 6f 20 62 79 20 69 6d 70 6c 69 63 61 74 69 6f 6e 20 63 61 6e 6e 6f 74 20 62 65 20 66 6f 72 6d | so.by.implication.cannot.be.form |
| df8c0 | 75 6c 61 74 65 64 20 61 73 20 22 65 66 66 65 63 74 69 76 65 20 70 72 6f 63 65 73 73 65 73 2e 22 | ulated.as."effective.processes." |
| df8e0 | 0a 54 75 72 69 6e 67 20 77 65 6e 74 20 6f 6e 20 74 6f 20 6d 61 6b 65 20 66 75 6e 64 61 6d 65 6e | .Turing.went.on.to.make.fundamen |
| df900 | 74 61 6c 20 63 6f 6e 74 72 69 62 75 74 69 6f 6e 73 20 74 6f 20 70 72 61 63 74 69 63 61 6c 20 63 | tal.contributions.to.practical.c |
| df920 | 6f 6d 70 75 74 65 72 0a 73 63 69 65 6e 63 65 20 61 73 20 77 65 6c 6c 2e 20 20 46 6f 72 20 65 78 | omputer.science.as.well...For.ex |
| df940 | 61 6d 70 6c 65 2c 20 68 65 20 69 6e 76 65 6e 74 65 64 20 74 68 65 20 69 64 65 61 20 6f 66 20 73 | ample,.he.invented.the.idea.of.s |
| df960 | 74 72 75 63 74 75 72 69 6e 67 0a 70 72 6f 67 72 61 6d 73 20 75 73 69 6e 67 20 67 65 6e 65 72 61 | tructuring.programs.using.genera |
| df980 | 6c 2d 70 75 72 70 6f 73 65 20 73 75 62 72 6f 75 74 69 6e 65 73 2e 20 20 53 65 65 20 48 6f 64 67 | l-purpose.subroutines...See.Hodg |
| df9a0 | 65 73 20 31 39 38 33 20 66 6f 72 20 61 0a 62 69 6f 67 72 61 70 68 79 20 6f 66 20 54 75 72 69 6e | es.1983.for.a.biography.of.Turin |
| df9c0 | 67 2e 0a 0a 20 20 20 28 32 29 20 53 6f 6d 65 20 70 65 6f 70 6c 65 20 66 69 6e 64 20 69 74 20 63 | g......(2).Some.people.find.it.c |
| df9e0 | 6f 75 6e 74 65 72 69 6e 74 75 69 74 69 76 65 20 74 68 61 74 20 61 6e 20 65 76 61 6c 75 61 74 6f | ounterintuitive.that.an.evaluato |
| dfa00 | 72 2c 20 77 68 69 63 68 20 69 73 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 79 20 61 20 72 65 6c | r,.which.is.implemented.by.a.rel |
| dfa20 | 61 74 69 76 65 6c 79 20 73 69 6d 70 6c 65 20 70 72 6f 63 65 64 75 72 65 2c 20 63 61 6e 20 65 6d | atively.simple.procedure,.can.em |
| dfa40 | 75 6c 61 74 65 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 0a 61 72 65 20 6d 6f 72 65 20 63 6f 6d | ulate.programs.that.are.more.com |
| dfa60 | 70 6c 65 78 20 74 68 61 6e 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 69 74 73 65 6c 66 2e 20 | plex.than.the.evaluator.itself.. |
| dfa80 | 20 54 68 65 20 65 78 69 73 74 65 6e 63 65 20 6f 66 20 61 0a 75 6e 69 76 65 72 73 61 6c 20 65 76 | .The.existence.of.a.universal.ev |
| dfaa0 | 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 20 69 73 20 61 20 64 65 65 70 20 61 6e 64 20 77 6f | aluator.machine.is.a.deep.and.wo |
| dfac0 | 6e 64 65 72 66 75 6c 20 70 72 6f 70 65 72 74 79 20 6f 66 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 2e | nderful.property.of.computation. |
| dfae0 | 20 20 74 68 65 6f 72 79 20 22 52 65 63 75 72 73 69 6f 6e 20 74 68 65 6f 72 79 22 2c 20 61 20 62 | ..theory."Recursion.theory",.a.b |
| dfb00 | 72 61 6e 63 68 20 6f 66 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 0a 6c 6f 67 69 63 2c 20 69 73 20 | ranch.of.mathematical.logic,.is. |
| dfb20 | 63 6f 6e 63 65 72 6e 65 64 20 77 69 74 68 20 6c 6f 67 69 63 61 6c 20 6c 69 6d 69 74 73 20 6f 66 | concerned.with.logical.limits.of |
| dfb40 | 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 44 6f 75 67 6c 61 73 0a 48 6f 66 73 74 61 64 74 65 | .computation...Douglas.Hofstadte |
| dfb60 | 72 27 73 20 62 65 61 75 74 69 66 75 6c 20 62 6f 6f 6b 20 60 47 6f 22 64 65 6c 2c 20 45 73 63 68 | r's.beautiful.book.`Go"del,.Esch |
| dfb80 | 65 72 2c 20 42 61 63 68 27 20 28 31 39 37 39 29 20 65 78 70 6c 6f 72 65 73 20 73 6f 6d 65 0a 6f | er,.Bach'.(1979).explores.some.o |
| dfba0 | 66 20 74 68 65 73 65 20 69 64 65 61 73 2e 0a 0a 20 20 20 28 33 29 20 57 61 72 6e 69 6e 67 3a 20 | f.these.ideas......(3).Warning:. |
| dfbc0 | 54 68 69 73 20 60 65 76 61 6c 27 20 70 72 69 6d 69 74 69 76 65 20 69 73 20 6e 6f 74 20 69 64 65 | This.`eval'.primitive.is.not.ide |
| dfbe0 | 6e 74 69 63 61 6c 20 74 6f 20 74 68 65 20 60 65 76 61 6c 27 0a 70 72 6f 63 65 64 75 72 65 20 77 | ntical.to.the.`eval'.procedure.w |
| dfc00 | 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 | e.implemented.in.section.*Note.4 |
| dfc20 | 2d 31 2d 31 3a 3a 2c 20 62 65 63 61 75 73 65 20 69 74 20 75 73 65 73 0a 5f 61 63 74 75 61 6c 5f | -1-1::,.because.it.uses._actual_ |
| dfc40 | 20 53 63 68 65 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 72 61 74 68 65 72 20 74 68 61 6e | .Scheme.environments.rather.than |
| dfc60 | 20 74 68 65 20 73 61 6d 70 6c 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 73 74 72 75 63 74 75 72 | .the.sample.environment.structur |
| dfc80 | 65 73 20 77 65 20 62 75 69 6c 74 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 | es.we.built.in.section.*Note.4-1 |
| dfca0 | 2d 33 3a 3a 2e 20 20 54 68 65 73 65 20 61 63 74 75 61 6c 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 | -3::...These.actual.environments |
| dfcc0 | 20 63 61 6e 6e 6f 74 20 62 65 20 6d 61 6e 69 70 75 6c 61 74 65 64 20 62 79 20 74 68 65 20 75 73 | .cannot.be.manipulated.by.the.us |
| dfce0 | 65 72 20 61 73 20 6f 72 64 69 6e 61 72 79 20 6c 69 73 74 73 3b 20 74 68 65 79 0a 6d 75 73 74 20 | er.as.ordinary.lists;.they.must. |
| dfd00 | 62 65 20 61 63 63 65 73 73 65 64 20 76 69 61 20 60 65 76 61 6c 27 20 6f 72 20 6f 74 68 65 72 20 | be.accessed.via.`eval'.or.other. |
| dfd20 | 73 70 65 63 69 61 6c 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 53 69 6d 69 6c 61 72 6c 79 2c 0a | special.operations...Similarly,. |
| dfd40 | 74 68 65 20 60 61 70 70 6c 79 27 20 70 72 69 6d 69 74 69 76 65 20 77 65 20 73 61 77 20 65 61 72 | the.`apply'.primitive.we.saw.ear |
| dfd60 | 6c 69 65 72 20 69 73 20 6e 6f 74 20 69 64 65 6e 74 69 63 61 6c 20 74 6f 20 74 68 65 0a 6d 65 74 | lier.is.not.identical.to.the.met |
| dfd80 | 61 63 69 72 63 75 6c 61 72 20 60 61 70 70 6c 79 27 2c 20 62 65 63 61 75 73 65 20 69 74 20 75 73 | acircular.`apply',.because.it.us |
| dfda0 | 65 73 20 61 63 74 75 61 6c 20 53 63 68 65 6d 65 20 70 72 6f 63 65 64 75 72 65 73 20 72 61 74 68 | es.actual.Scheme.procedures.rath |
| dfdc0 | 65 72 0a 74 68 61 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 73 20 77 65 | er.than.the.procedure.objects.we |
| dfde0 | 20 63 6f 6e 73 74 72 75 63 74 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 20 34 | .constructed.in.sections.*Note.4 |
| dfe00 | 2d 31 2d 33 3a 3a 20 61 6e 64 0a 2a 4e 6f 74 65 20 34 2d 31 2d 34 3a 3a 2e 0a 0a 20 20 20 28 34 | -1-3::.and.*Note.4-1-4::......(4 |
| dfe20 | 29 20 54 68 65 20 4d 49 54 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 53 63 68 65 | ).The.MIT.implementation.of.Sche |
| dfe40 | 6d 65 20 69 6e 63 6c 75 64 65 73 20 60 65 76 61 6c 27 2c 20 61 73 20 77 65 6c 6c 20 61 73 20 61 | me.includes.`eval',.as.well.as.a |
| dfe60 | 0a 73 79 6d 62 6f 6c 20 60 75 73 65 72 2d 69 6e 69 74 69 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e | .symbol.`user-initial-environmen |
| dfe80 | 74 27 20 74 68 61 74 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 69 6e 69 74 69 61 6c 0a | t'.that.is.bound.to.the.initial. |
| dfea0 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 75 73 65 72 27 73 20 | environment.in.which.the.user's. |
| dfec0 | 69 6e 70 75 74 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 2e | input.expressions.are.evaluated. |
| dfee0 | 0a 0a 20 20 20 28 35 29 20 41 6c 74 68 6f 75 67 68 20 77 65 20 73 74 69 70 75 6c 61 74 65 64 20 | .....(5).Although.we.stipulated. |
| dff00 | 74 68 61 74 20 60 68 61 6c 74 73 3f 27 20 69 73 20 67 69 76 65 6e 20 61 20 70 72 6f 63 65 64 75 | that.`halts?'.is.given.a.procedu |
| dff20 | 72 65 0a 6f 62 6a 65 63 74 2c 20 6e 6f 74 69 63 65 20 74 68 61 74 20 74 68 69 73 20 72 65 61 73 | re.object,.notice.that.this.reas |
| dff40 | 6f 6e 69 6e 67 20 73 74 69 6c 6c 20 61 70 70 6c 69 65 73 20 65 76 65 6e 20 69 66 20 60 68 61 6c | oning.still.applies.even.if.`hal |
| dff60 | 74 73 3f 27 20 63 61 6e 0a 67 61 69 6e 20 61 63 63 65 73 73 20 74 6f 20 74 68 65 20 70 72 6f 63 | ts?'.can.gain.access.to.the.proc |
| dff80 | 65 64 75 72 65 27 73 20 74 65 78 74 20 61 6e 64 20 69 74 73 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | edure's.text.and.its.environment |
| dffa0 | 2e 20 20 54 68 69 73 20 69 73 0a 54 75 72 69 6e 67 27 73 20 63 65 6c 65 62 72 61 74 65 64 20 22 | ...This.is.Turing's.celebrated." |
| dffc0 | 48 61 6c 74 69 6e 67 20 54 68 65 6f 72 65 6d 22 2c 20 77 68 69 63 68 20 67 61 76 65 20 74 68 65 | Halting.Theorem",.which.gave.the |
| dffe0 | 20 66 69 72 73 74 20 63 6c 65 61 72 0a 65 78 61 6d 70 6c 65 20 6f 66 20 61 20 22 6e 6f 6e 2d 63 | .first.clear.example.of.a."non-c |
| e0000 | 6f 6d 70 75 74 61 62 6c 65 22 20 70 72 6f 62 6c 65 6d 2c 20 69 2e 65 2e 2c 20 61 20 77 65 6c 6c | omputable".problem,.i.e.,.a.well |
| e0020 | 2d 70 6f 73 65 64 20 74 61 73 6b 20 74 68 61 74 0a 63 61 6e 6e 6f 74 20 62 65 20 63 61 72 72 69 | -posed.task.that.cannot.be.carri |
| e0040 | 65 64 20 6f 75 74 20 61 73 20 61 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 70 72 6f 63 65 64 | ed.out.as.a.computational.proced |
| e0060 | 75 72 65 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 | ure.....File:.sicp.info,..Node:. |
| e0080 | 34 2d 31 2d 36 2c 20 20 4e 65 78 74 3a 20 34 2d 31 2d 37 2c 20 20 50 72 65 76 3a 20 34 2d 31 2d | 4-1-6,..Next:.4-1-7,..Prev:.4-1- |
| e00a0 | 35 2c 20 20 55 70 3a 20 34 2d 31 0a 0a 34 2e 31 2e 36 20 49 6e 74 65 72 6e 61 6c 20 44 65 66 69 | 5,..Up:.4-1..4.1.6.Internal.Defi |
| e00c0 | 6e 69 74 69 6f 6e 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | nitions.------------------------ |
| e00e0 | 2d 2d 0a 0a 4f 75 72 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 6f 64 65 6c 20 6f 66 20 65 76 61 | --..Our.environment.model.of.eva |
| e0100 | 6c 75 61 74 69 6f 6e 20 61 6e 64 20 6f 75 72 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 | luation.and.our.metacircular.eva |
| e0120 | 6c 75 61 74 6f 72 0a 65 78 65 63 75 74 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 69 6e 20 73 65 | luator.execute.definitions.in.se |
| e0140 | 71 75 65 6e 63 65 2c 20 65 78 74 65 6e 64 69 6e 67 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e | quence,.extending.the.environmen |
| e0160 | 74 20 66 72 61 6d 65 20 6f 6e 65 0a 64 65 66 69 6e 69 74 69 6f 6e 20 61 74 20 61 20 74 69 6d 65 | t.frame.one.definition.at.a.time |
| e0180 | 2e 20 20 54 68 69 73 20 69 73 20 70 61 72 74 69 63 75 6c 61 72 6c 79 20 63 6f 6e 76 65 6e 69 65 | ...This.is.particularly.convenie |
| e01a0 | 6e 74 20 66 6f 72 20 69 6e 74 65 72 61 63 74 69 76 65 0a 70 72 6f 67 72 61 6d 20 64 65 76 65 6c | nt.for.interactive.program.devel |
| e01c0 | 6f 70 6d 65 6e 74 2c 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 65 72 20 | opment,.in.which.the.programmer. |
| e01e0 | 6e 65 65 64 73 20 74 6f 20 66 72 65 65 6c 79 20 6d 69 78 20 74 68 65 0a 61 70 70 6c 69 63 61 74 | needs.to.freely.mix.the.applicat |
| e0200 | 69 6f 6e 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 77 69 74 68 20 74 68 65 20 64 65 66 69 6e | ion.of.procedures.with.the.defin |
| e0220 | 69 74 69 6f 6e 20 6f 66 20 6e 65 77 20 70 72 6f 63 65 64 75 72 65 73 2e 0a 48 6f 77 65 76 65 72 | ition.of.new.procedures..However |
| e0240 | 2c 20 69 66 20 77 65 20 74 68 69 6e 6b 20 63 61 72 65 66 75 6c 6c 79 20 61 62 6f 75 74 20 74 68 | ,.if.we.think.carefully.about.th |
| e0260 | 65 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 75 73 65 64 20 74 6f 0a 69 | e.internal.definitions.used.to.i |
| e0280 | 6d 70 6c 65 6d 65 6e 74 20 62 6c 6f 63 6b 20 73 74 72 75 63 74 75 72 65 20 28 69 6e 74 72 6f 64 | mplement.block.structure.(introd |
| e02a0 | 75 63 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 38 3a 3a 29 2c 20 | uced.in.section.*Note.1-1-8::),. |
| e02c0 | 77 65 0a 77 69 6c 6c 20 66 69 6e 64 20 74 68 61 74 20 6e 61 6d 65 2d 62 79 2d 6e 61 6d 65 20 65 | we.will.find.that.name-by-name.e |
| e02e0 | 78 74 65 6e 73 69 6f 6e 20 6f 66 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 61 79 20 | xtension.of.the.environment.may. |
| e0300 | 6e 6f 74 20 62 65 20 74 68 65 0a 62 65 73 74 20 77 61 79 20 74 6f 20 64 65 66 69 6e 65 20 6c 6f | not.be.the.best.way.to.define.lo |
| e0320 | 63 61 6c 20 76 61 72 69 61 62 6c 65 73 2e 0a 0a 20 20 20 43 6f 6e 73 69 64 65 72 20 61 20 70 72 | cal.variables......Consider.a.pr |
| e0340 | 6f 63 65 64 75 72 65 20 77 69 74 68 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e | ocedure.with.internal.definition |
| e0360 | 73 2c 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 20 78 29 0a 20 | s,.such.as.......(define.(f.x).. |
| e0380 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 65 6e 3f 20 6e 29 0a 20 20 20 20 20 20 20 20 | ......(define.(even?.n)......... |
| e03a0 | 20 28 69 66 20 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 75 65 0a 20 | .(if.(=.n.0)..............true.. |
| e03c0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 64 64 3f 20 28 2d 20 6e 20 31 29 29 29 29 0a 20 20 20 | ............(odd?.(-.n.1)))).... |
| e03e0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 6f 64 64 3f 20 6e 29 0a 20 20 20 20 20 20 20 20 20 28 69 | ....(define.(odd?.n)..........(i |
| e0400 | 66 20 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 6c 73 65 0a 20 20 20 | f.(=.n.0)..............false.... |
| e0420 | 20 20 20 20 20 20 20 20 20 20 28 65 76 65 6e 3f 20 28 2d 20 6e 20 31 29 29 29 29 0a 20 20 20 20 | ..........(even?.(-.n.1))))..... |
| e0440 | 20 20 20 3c 52 45 53 54 20 4f 46 20 42 4f 44 59 20 4f 46 20 60 46 27 3e 29 0a 0a 20 20 20 4f 75 | ...<REST.OF.BODY.OF.`F'>).....Ou |
| e0460 | 72 20 69 6e 74 65 6e 74 69 6f 6e 20 68 65 72 65 20 69 73 20 74 68 61 74 20 74 68 65 20 6e 61 6d | r.intention.here.is.that.the.nam |
| e0480 | 65 20 60 6f 64 64 3f 27 20 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 0a 70 72 6f 63 | e.`odd?'.in.the.body.of.the.proc |
| e04a0 | 65 64 75 72 65 20 60 65 76 65 6e 3f 27 20 73 68 6f 75 6c 64 20 72 65 66 65 72 20 74 6f 20 74 68 | edure.`even?'.should.refer.to.th |
| e04c0 | 65 20 70 72 6f 63 65 64 75 72 65 20 60 6f 64 64 3f 27 20 74 68 61 74 20 69 73 20 64 65 66 69 6e | e.procedure.`odd?'.that.is.defin |
| e04e0 | 65 64 0a 61 66 74 65 72 20 60 65 76 65 6e 3f 27 2e 20 20 54 68 65 20 73 63 6f 70 65 20 6f 66 20 | ed.after.`even?'...The.scope.of. |
| e0500 | 74 68 65 20 6e 61 6d 65 20 60 6f 64 64 3f 27 20 69 73 20 74 68 65 20 65 6e 74 69 72 65 20 62 6f | the.name.`odd?'.is.the.entire.bo |
| e0520 | 64 79 20 6f 66 20 60 66 27 2c 0a 6e 6f 74 20 6a 75 73 74 20 74 68 65 20 70 6f 72 74 69 6f 6e 20 | dy.of.`f',.not.just.the.portion. |
| e0540 | 6f 66 20 74 68 65 20 62 6f 64 79 20 6f 66 20 60 66 27 20 73 74 61 72 74 69 6e 67 20 61 74 20 74 | of.the.body.of.`f'.starting.at.t |
| e0560 | 68 65 20 70 6f 69 6e 74 20 77 68 65 72 65 20 74 68 65 0a 60 64 65 66 69 6e 65 27 20 66 6f 72 20 | he.point.where.the.`define'.for. |
| e0580 | 60 6f 64 64 3f 27 20 6f 63 63 75 72 73 2e 20 20 49 6e 64 65 65 64 2c 20 77 68 65 6e 20 77 65 20 | `odd?'.occurs...Indeed,.when.we. |
| e05a0 | 63 6f 6e 73 69 64 65 72 20 74 68 61 74 20 60 6f 64 64 3f 27 20 69 73 0a 69 74 73 65 6c 66 20 64 | consider.that.`odd?'.is.itself.d |
| e05c0 | 65 66 69 6e 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 60 65 76 65 6e 3f 27 2d 2d 73 6f 20 74 | efined.in.terms.of.`even?'--so.t |
| e05e0 | 68 61 74 20 60 65 76 65 6e 3f 27 20 61 6e 64 20 60 6f 64 64 3f 27 20 61 72 65 0a 6d 75 74 75 61 | hat.`even?'.and.`odd?'.are.mutua |
| e0600 | 6c 6c 79 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 2d 2d 77 65 20 73 65 65 | lly.recursive.procedures--we.see |
| e0620 | 20 74 68 61 74 20 74 68 65 20 6f 6e 6c 79 20 73 61 74 69 73 66 61 63 74 6f 72 79 0a 69 6e 74 65 | .that.the.only.satisfactory.inte |
| e0640 | 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 74 77 6f 20 60 64 65 66 69 6e 65 27 73 20 | rpretation.of.the.two.`define's. |
| e0660 | 69 73 20 74 6f 20 72 65 67 61 72 64 20 74 68 65 6d 20 61 73 20 69 66 20 74 68 65 20 6e 61 6d 65 | is.to.regard.them.as.if.the.name |
| e0680 | 73 0a 60 65 76 65 6e 3f 27 20 61 6e 64 20 60 6f 64 64 3f 27 20 77 65 72 65 20 62 65 69 6e 67 20 | s.`even?'.and.`odd?'.were.being. |
| e06a0 | 61 64 64 65 64 20 74 6f 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 69 6d 75 6c 74 61 | added.to.the.environment.simulta |
| e06c0 | 6e 65 6f 75 73 6c 79 2e 0a 4d 6f 72 65 20 67 65 6e 65 72 61 6c 6c 79 2c 20 69 6e 20 62 6c 6f 63 | neously..More.generally,.in.bloc |
| e06e0 | 6b 20 73 74 72 75 63 74 75 72 65 2c 20 74 68 65 20 73 63 6f 70 65 20 6f 66 20 61 20 6c 6f 63 61 | k.structure,.the.scope.of.a.loca |
| e0700 | 6c 20 6e 61 6d 65 20 69 73 20 74 68 65 0a 65 6e 74 69 72 65 20 70 72 6f 63 65 64 75 72 65 20 62 | l.name.is.the.entire.procedure.b |
| e0720 | 6f 64 79 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 60 64 65 66 69 6e 65 27 20 69 73 20 65 76 61 | ody.in.which.the.`define'.is.eva |
| e0740 | 6c 75 61 74 65 64 2e 0a 0a 20 20 20 41 73 20 69 74 20 68 61 70 70 65 6e 73 2c 20 6f 75 72 20 69 | luated......As.it.happens,.our.i |
| e0760 | 6e 74 65 72 70 72 65 74 65 72 20 77 69 6c 6c 20 65 76 61 6c 75 61 74 65 20 63 61 6c 6c 73 20 74 | nterpreter.will.evaluate.calls.t |
| e0780 | 6f 20 60 66 27 20 63 6f 72 72 65 63 74 6c 79 2c 0a 62 75 74 20 66 6f 72 20 61 6e 20 22 61 63 63 | o.`f'.correctly,.but.for.an."acc |
| e07a0 | 69 64 65 6e 74 61 6c 22 20 72 65 61 73 6f 6e 3a 20 53 69 6e 63 65 20 74 68 65 20 64 65 66 69 6e | idental".reason:.Since.the.defin |
| e07c0 | 69 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 0a 70 72 6f 63 65 64 75 72 65 | itions.of.the.internal.procedure |
| e07e0 | 73 20 63 6f 6d 65 20 66 69 72 73 74 2c 20 6e 6f 20 63 61 6c 6c 73 20 74 6f 20 74 68 65 73 65 20 | s.come.first,.no.calls.to.these. |
| e0800 | 70 72 6f 63 65 64 75 72 65 73 20 77 69 6c 6c 20 62 65 20 65 76 61 6c 75 61 74 65 64 0a 75 6e 74 | procedures.will.be.evaluated.unt |
| e0820 | 69 6c 20 61 6c 6c 20 6f 66 20 74 68 65 6d 20 68 61 76 65 20 62 65 65 6e 20 64 65 66 69 6e 65 64 | il.all.of.them.have.been.defined |
| e0840 | 2e 20 20 48 65 6e 63 65 2c 20 60 6f 64 64 3f 27 20 20 77 69 6c 6c 20 68 61 76 65 20 62 65 65 6e | ...Hence,.`odd?'..will.have.been |
| e0860 | 0a 64 65 66 69 6e 65 64 20 62 79 20 74 68 65 20 74 69 6d 65 20 60 65 76 65 6e 3f 27 20 69 73 20 | .defined.by.the.time.`even?'.is. |
| e0880 | 65 78 65 63 75 74 65 64 2e 20 20 49 6e 20 66 61 63 74 2c 20 6f 75 72 20 73 65 71 75 65 6e 74 69 | executed...In.fact,.our.sequenti |
| e08a0 | 61 6c 0a 65 76 61 6c 75 61 74 69 6f 6e 20 6d 65 63 68 61 6e 69 73 6d 20 77 69 6c 6c 20 67 69 76 | al.evaluation.mechanism.will.giv |
| e08c0 | 65 20 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 20 61 73 20 61 20 6d 65 63 68 61 6e 69 73 6d | e.the.same.result.as.a.mechanism |
| e08e0 | 20 74 68 61 74 0a 64 69 72 65 63 74 6c 79 20 69 6d 70 6c 65 6d 65 6e 74 73 20 73 69 6d 75 6c 74 | .that.directly.implements.simult |
| e0900 | 61 6e 65 6f 75 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 66 6f 72 20 61 6e 79 20 70 72 6f 63 65 64 | aneous.definition.for.any.proced |
| e0920 | 75 72 65 20 69 6e 20 77 68 69 63 68 0a 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 | ure.in.which.the.internal.defini |
| e0940 | 74 69 6f 6e 73 20 63 6f 6d 65 20 66 69 72 73 74 20 69 6e 20 61 20 62 6f 64 79 20 61 6e 64 20 65 | tions.come.first.in.a.body.and.e |
| e0960 | 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 0a 76 61 6c 75 65 20 65 78 70 72 65 73 73 69 6f | valuation.of.the.value.expressio |
| e0980 | 6e 73 20 66 6f 72 20 74 68 65 20 64 65 66 69 6e 65 64 20 76 61 72 69 61 62 6c 65 73 20 64 6f 65 | ns.for.the.defined.variables.doe |
| e09a0 | 73 6e 27 74 20 61 63 74 75 61 6c 6c 79 20 75 73 65 20 61 6e 79 20 6f 66 0a 74 68 65 20 64 65 66 | sn't.actually.use.any.of.the.def |
| e09c0 | 69 6e 65 64 20 76 61 72 69 61 62 6c 65 73 2e 20 20 28 46 6f 72 20 61 6e 20 65 78 61 6d 70 6c 65 | ined.variables...(For.an.example |
| e09e0 | 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 64 6f 65 73 6e 27 74 0a 6f 62 65 | .of.a.procedure.that.doesn't.obe |
| e0a00 | 79 20 74 68 65 73 65 20 72 65 73 74 72 69 63 74 69 6f 6e 73 2c 20 73 6f 20 74 68 61 74 20 73 65 | y.these.restrictions,.so.that.se |
| e0a20 | 71 75 65 6e 74 69 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 73 6e 27 74 20 65 71 75 69 76 61 | quential.definition.isn't.equiva |
| e0a40 | 6c 65 6e 74 0a 74 6f 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 20 64 65 66 69 6e 69 74 69 6f 6e 2c | lent.to.simultaneous.definition, |
| e0a60 | 20 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 31 39 3a 3a 2e 29 28 31 29 0a | .see.*Note.Exercise.4-19::.)(1). |
| e0a80 | 0a 20 20 20 54 68 65 72 65 20 69 73 2c 20 68 6f 77 65 76 65 72 2c 20 61 20 73 69 6d 70 6c 65 20 | ....There.is,.however,.a.simple. |
| e0aa0 | 77 61 79 20 74 6f 20 74 72 65 61 74 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 73 6f 20 74 68 61 74 | way.to.treat.definitions.so.that |
| e0ac0 | 0a 69 6e 74 65 72 6e 61 6c 6c 79 20 64 65 66 69 6e 65 64 20 6e 61 6d 65 73 20 68 61 76 65 20 74 | .internally.defined.names.have.t |
| e0ae0 | 72 75 6c 79 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 20 73 63 6f 70 65 2d 2d 6a 75 73 74 20 63 72 | ruly.simultaneous.scope--just.cr |
| e0b00 | 65 61 74 65 20 61 6c 6c 0a 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 20 74 68 61 74 20 77 69 | eate.all.local.variables.that.wi |
| e0b20 | 6c 6c 20 62 65 20 69 6e 20 74 68 65 20 63 75 72 72 65 6e 74 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | ll.be.in.the.current.environment |
| e0b40 | 20 62 65 66 6f 72 65 0a 65 76 61 6c 75 61 74 69 6e 67 20 61 6e 79 20 6f 66 20 74 68 65 20 76 61 | .before.evaluating.any.of.the.va |
| e0b60 | 6c 75 65 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 64 6f 20 | lue.expressions...One.way.to.do. |
| e0b80 | 74 68 69 73 20 69 73 20 62 79 20 61 0a 73 79 6e 74 61 78 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 | this.is.by.a.syntax.transformati |
| e0ba0 | 6f 6e 20 6f 6e 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 42 65 66 | on.on.`lambda'.expressions...Bef |
| e0bc0 | 6f 72 65 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 0a 62 6f 64 79 20 6f 66 20 61 20 60 6c 61 | ore.evaluating.the.body.of.a.`la |
| e0be0 | 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 77 65 20 22 73 63 61 6e 20 6f 75 74 22 20 | mbda'.expression,.we."scan.out". |
| e0c00 | 61 6e 64 20 65 6c 69 6d 69 6e 61 74 65 20 61 6c 6c 20 74 68 65 0a 69 6e 74 65 72 6e 61 6c 20 64 | and.eliminate.all.the.internal.d |
| e0c20 | 65 66 69 6e 69 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 62 6f 64 79 2e 20 20 54 68 65 20 69 6e 74 | efinitions.in.the.body...The.int |
| e0c40 | 65 72 6e 61 6c 6c 79 20 64 65 66 69 6e 65 64 20 76 61 72 69 61 62 6c 65 73 0a 77 69 6c 6c 20 62 | ernally.defined.variables.will.b |
| e0c60 | 65 20 63 72 65 61 74 65 64 20 77 69 74 68 20 61 20 60 6c 65 74 27 20 61 6e 64 20 74 68 65 6e 20 | e.created.with.a.`let'.and.then. |
| e0c80 | 73 65 74 20 74 6f 20 74 68 65 69 72 20 76 61 6c 75 65 73 20 62 79 0a 61 73 73 69 67 6e 6d 65 6e | set.to.their.values.by.assignmen |
| e0ca0 | 74 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 0a | t...For.example,.the.procedure.. |
| e0cc0 | 20 20 20 20 20 28 6c 61 6d 62 64 61 20 3c 56 41 52 53 3e 0a 20 20 20 20 20 20 20 28 64 65 66 69 | .....(lambda.<VARS>........(defi |
| e0ce0 | 6e 65 20 75 20 3c 45 31 3e 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 76 20 3c 45 32 3e | ne.u.<E1>)........(define.v.<E2> |
| e0d00 | 29 0a 20 20 20 20 20 20 20 3c 45 33 3e 29 0a 0a 77 6f 75 6c 64 20 62 65 20 74 72 61 6e 73 66 6f | )........<E3>)..would.be.transfo |
| e0d20 | 72 6d 65 64 20 69 6e 74 6f 0a 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 3c 56 41 52 53 3e 0a 20 | rmed.into.......(lambda.<VARS>.. |
| e0d40 | 20 20 20 20 20 20 28 6c 65 74 20 28 28 75 20 27 2a 75 6e 61 73 73 69 67 6e 65 64 2a 29 0a 20 20 | ......(let.((u.'*unassigned*)... |
| e0d60 | 20 20 20 20 20 20 20 20 20 20 20 28 76 20 27 2a 75 6e 61 73 73 69 67 6e 65 64 2a 29 29 0a 20 20 | ...........(v.'*unassigned*))... |
| e0d80 | 20 20 20 20 20 20 20 28 73 65 74 21 20 75 20 3c 45 31 3e 29 0a 20 20 20 20 20 20 20 20 20 28 73 | .......(set!.u.<E1>)..........(s |
| e0da0 | 65 74 21 20 76 20 3c 45 32 3e 29 0a 20 20 20 20 20 20 20 20 20 3c 45 33 3e 29 29 0a 0a 77 68 65 | et!.v.<E2>)..........<E3>))..whe |
| e0dc0 | 72 65 20 60 2a 75 6e 61 73 73 69 67 6e 65 64 2a 27 20 69 73 20 61 20 73 70 65 63 69 61 6c 20 73 | re.`*unassigned*'.is.a.special.s |
| e0de0 | 79 6d 62 6f 6c 20 74 68 61 74 20 63 61 75 73 65 73 20 6c 6f 6f 6b 69 6e 67 20 75 70 20 61 0a 76 | ymbol.that.causes.looking.up.a.v |
| e0e00 | 61 72 69 61 62 6c 65 20 74 6f 20 73 69 67 6e 61 6c 20 61 6e 20 65 72 72 6f 72 20 69 66 20 61 6e | ariable.to.signal.an.error.if.an |
| e0e20 | 20 61 74 74 65 6d 70 74 20 69 73 20 6d 61 64 65 20 74 6f 20 75 73 65 20 74 68 65 20 76 61 6c 75 | .attempt.is.made.to.use.the.valu |
| e0e40 | 65 20 6f 66 0a 74 68 65 20 6e 6f 74 2d 79 65 74 2d 61 73 73 69 67 6e 65 64 20 76 61 72 69 61 62 | e.of.the.not-yet-assigned.variab |
| e0e60 | 6c 65 2e 0a 0a 20 20 20 41 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 73 74 72 61 74 65 67 79 20 | le......An.alternative.strategy. |
| e0e80 | 66 6f 72 20 73 63 61 6e 6e 69 6e 67 20 6f 75 74 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 | for.scanning.out.internal.defini |
| e0ea0 | 74 69 6f 6e 73 20 69 73 0a 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | tions.is.shown.in.*Note.Exercise |
| e0ec0 | 20 34 2d 31 38 3a 3a 2e 20 20 55 6e 6c 69 6b 65 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 | .4-18::...Unlike.the.transformat |
| e0ee0 | 69 6f 6e 20 73 68 6f 77 6e 20 61 62 6f 76 65 2c 0a 74 68 69 73 20 65 6e 66 6f 72 63 65 73 20 74 | ion.shown.above,.this.enforces.t |
| e0f00 | 68 65 20 72 65 73 74 72 69 63 74 69 6f 6e 20 74 68 61 74 20 74 68 65 20 64 65 66 69 6e 65 64 20 | he.restriction.that.the.defined. |
| e0f20 | 76 61 72 69 61 62 6c 65 73 27 20 76 61 6c 75 65 73 20 63 61 6e 20 62 65 0a 65 76 61 6c 75 61 74 | variables'.values.can.be.evaluat |
| e0f40 | 65 64 20 77 69 74 68 6f 75 74 20 75 73 69 6e 67 20 61 6e 79 20 6f 66 20 74 68 65 20 76 61 72 69 | ed.without.using.any.of.the.vari |
| e0f60 | 61 62 6c 65 73 27 20 76 61 6c 75 65 73 2e 28 32 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | ables'.values.(2).......*Exercis |
| e0f80 | 65 20 34 2e 31 36 3a 2a 20 49 6e 20 74 68 69 73 20 65 78 65 72 63 69 73 65 20 77 65 20 69 6d 70 | e.4.16:*.In.this.exercise.we.imp |
| e0fa0 | 6c 65 6d 65 6e 74 20 74 68 65 20 6d 65 74 68 6f 64 20 6a 75 73 74 0a 20 20 20 20 20 64 65 73 63 | lement.the.method.just......desc |
| e0fc0 | 72 69 62 65 64 20 66 6f 72 20 69 6e 74 65 72 70 72 65 74 69 6e 67 20 69 6e 74 65 72 6e 61 6c 20 | ribed.for.interpreting.internal. |
| e0fe0 | 64 65 66 69 6e 69 74 69 6f 6e 73 2e 20 20 57 65 20 61 73 73 75 6d 65 20 74 68 61 74 0a 20 20 20 | definitions...We.assume.that.... |
| e1000 | 20 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 73 75 70 70 6f 72 74 73 20 60 6c 65 74 27 20 28 | ..the.evaluator.supports.`let'.( |
| e1020 | 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 36 3a 3a 29 2e 0a 0a 20 20 20 20 | see.*Note.Exercise.4-6::)....... |
| e1040 | 20 20 20 61 2e 20 43 68 61 6e 67 65 20 60 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 | ...a..Change.`lookup-variable-va |
| e1060 | 6c 75 65 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 33 3a 3a 29 20 74 6f 0a | lue'.(section.*Note.4-1-3::).to. |
| e1080 | 20 20 20 20 20 20 20 20 20 20 73 69 67 6e 61 6c 20 61 6e 20 65 72 72 6f 72 20 69 66 20 74 68 65 | ..........signal.an.error.if.the |
| e10a0 | 20 76 61 6c 75 65 20 69 74 20 66 69 6e 64 73 20 69 73 20 74 68 65 20 73 79 6d 62 6f 6c 0a 20 20 | .value.it.finds.is.the.symbol... |
| e10c0 | 20 20 20 20 20 20 20 20 60 2a 75 6e 61 73 73 69 67 6e 65 64 2a 27 2e 0a 0a 20 20 20 20 20 20 20 | ........`*unassigned*'.......... |
| e10e0 | 62 2e 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 73 63 61 6e 2d 6f 75 74 2d 64 | b..Write.a.procedure.`scan-out-d |
| e1100 | 65 66 69 6e 65 73 27 20 74 68 61 74 20 74 61 6b 65 73 20 61 20 70 72 6f 63 65 64 75 72 65 0a 20 | efines'.that.takes.a.procedure.. |
| e1120 | 20 20 20 20 20 20 20 20 20 62 6f 64 79 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 6e 20 65 71 75 | .........body.and.returns.an.equ |
| e1140 | 69 76 61 6c 65 6e 74 20 6f 6e 65 20 74 68 61 74 20 68 61 73 20 6e 6f 20 69 6e 74 65 72 6e 61 6c | ivalent.one.that.has.no.internal |
| e1160 | 0a 20 20 20 20 20 20 20 20 20 20 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 62 79 20 6d 61 6b 69 6e | ...........definitions,.by.makin |
| e1180 | 67 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 64 65 73 63 72 69 62 65 64 20 61 | g.the.transformation.described.a |
| e11a0 | 62 6f 76 65 2e 0a 0a 20 20 20 20 20 20 20 63 2e 20 49 6e 73 74 61 6c 6c 20 60 73 63 61 6e 2d 6f | bove..........c..Install.`scan-o |
| e11c0 | 75 74 2d 64 65 66 69 6e 65 73 27 20 69 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2c 20 | ut-defines'.in.the.interpreter,. |
| e11e0 | 65 69 74 68 65 72 20 69 6e 0a 20 20 20 20 20 20 20 20 20 20 60 6d 61 6b 65 2d 70 72 6f 63 65 64 | either.in...........`make-proced |
| e1200 | 75 72 65 27 20 6f 72 20 69 6e 20 60 70 72 6f 63 65 64 75 72 65 2d 62 6f 64 79 27 20 28 73 65 65 | ure'.or.in.`procedure-body'.(see |
| e1220 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 33 3a 3a | .section.*Note...........4-1-3:: |
| e1240 | 29 2e 20 20 57 68 69 63 68 20 70 6c 61 63 65 20 69 73 20 62 65 74 74 65 72 3f 20 20 57 68 79 3f | )...Which.place.is.better?..Why? |
| e1260 | 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 31 37 3a 2a 20 44 72 61 77 20 64 69 | ........*Exercise.4.17:*.Draw.di |
| e1280 | 61 67 72 61 6d 73 20 6f 66 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 65 66 66 | agrams.of.the.environment.in.eff |
| e12a0 | 65 63 74 20 77 68 65 6e 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 | ect.when......evaluating.the.exp |
| e12c0 | 72 65 73 73 69 6f 6e 20 3c 45 33 3e 20 69 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 6e | ression.<E3>.in.the.procedure.in |
| e12e0 | 20 74 68 65 20 74 65 78 74 2c 0a 20 20 20 20 20 63 6f 6d 70 61 72 69 6e 67 20 68 6f 77 20 74 68 | .the.text,......comparing.how.th |
| e1300 | 69 73 20 77 69 6c 6c 20 62 65 20 73 74 72 75 63 74 75 72 65 64 20 77 68 65 6e 20 64 65 66 69 6e | is.will.be.structured.when.defin |
| e1320 | 69 74 69 6f 6e 73 20 61 72 65 0a 20 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 64 20 73 65 71 75 | itions.are......interpreted.sequ |
| e1340 | 65 6e 74 69 61 6c 6c 79 20 77 69 74 68 20 68 6f 77 20 69 74 20 77 69 6c 6c 20 62 65 20 73 74 72 | entially.with.how.it.will.be.str |
| e1360 | 75 63 74 75 72 65 64 20 69 66 0a 20 20 20 20 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 | uctured.if......definitions.are. |
| e1380 | 73 63 61 6e 6e 65 64 20 6f 75 74 20 61 73 20 64 65 73 63 72 69 62 65 64 2e 20 20 57 68 79 20 69 | scanned.out.as.described...Why.i |
| e13a0 | 73 20 74 68 65 72 65 20 61 6e 20 65 78 74 72 61 0a 20 20 20 20 20 66 72 61 6d 65 20 69 6e 20 74 | s.there.an.extra......frame.in.t |
| e13c0 | 68 65 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 70 72 6f 67 72 61 6d 3f 20 20 45 78 70 6c 61 69 6e | he.transformed.program?..Explain |
| e13e0 | 20 77 68 79 20 74 68 69 73 20 64 69 66 66 65 72 65 6e 63 65 20 69 6e 0a 20 20 20 20 20 65 6e 76 | .why.this.difference.in......env |
| e1400 | 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 20 63 61 6e 20 6e 65 76 65 72 20 6d 61 6b | ironment.structure.can.never.mak |
| e1420 | 65 20 61 20 64 69 66 66 65 72 65 6e 63 65 20 69 6e 20 74 68 65 20 62 65 68 61 76 69 6f 72 0a 20 | e.a.difference.in.the.behavior.. |
| e1440 | 20 20 20 20 6f 66 20 61 20 63 6f 72 72 65 63 74 20 70 72 6f 67 72 61 6d 2e 20 20 44 65 73 69 67 | ....of.a.correct.program...Desig |
| e1460 | 6e 20 61 20 77 61 79 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 0a | n.a.way.to.make.the.interpreter. |
| e1480 | 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 22 73 69 6d 75 6c 74 61 6e 65 6f 75 73 | .....implement.the."simultaneous |
| e14a0 | 22 20 73 63 6f 70 65 20 72 75 6c 65 20 66 6f 72 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 | ".scope.rule.for.internal.defini |
| e14c0 | 74 69 6f 6e 73 0a 20 20 20 20 20 77 69 74 68 6f 75 74 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 20 | tions......without.constructing. |
| e14e0 | 74 68 65 20 65 78 74 72 61 20 66 72 61 6d 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | the.extra.frame........*Exercise |
| e1500 | 20 34 2e 31 38 3a 2a 20 43 6f 6e 73 69 64 65 72 20 61 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 | .4.18:*.Consider.an.alternative. |
| e1520 | 73 74 72 61 74 65 67 79 20 66 6f 72 20 73 63 61 6e 6e 69 6e 67 20 6f 75 74 0a 20 20 20 20 20 64 | strategy.for.scanning.out......d |
| e1540 | 65 66 69 6e 69 74 69 6f 6e 73 20 74 68 61 74 20 74 72 61 6e 73 6c 61 74 65 73 20 74 68 65 20 65 | efinitions.that.translates.the.e |
| e1560 | 78 61 6d 70 6c 65 20 69 6e 20 74 68 65 20 74 65 78 74 20 74 6f 0a 0a 20 20 20 20 20 20 20 20 20 | xample.in.the.text.to........... |
| e1580 | 20 28 6c 61 6d 62 64 61 20 3c 56 41 52 53 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 | .(lambda.<VARS>.............(let |
| e15a0 | 20 28 28 75 20 27 2a 75 6e 61 73 73 69 67 6e 65 64 2a 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | .((u.'*unassigned*)............. |
| e15c0 | 20 20 20 20 20 20 28 76 20 27 2a 75 6e 61 73 73 69 67 6e 65 64 2a 29 29 0a 20 20 20 20 20 20 20 | ......(v.'*unassigned*))........ |
| e15e0 | 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 61 20 3c 45 31 3e 29 0a 20 20 20 20 20 20 20 20 20 20 | .......(let.((a.<E1>)........... |
| e1600 | 20 20 20 20 20 20 20 20 20 20 28 62 20 3c 45 32 3e 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..........(b.<E2>))............. |
| e1620 | 20 20 20 20 28 73 65 74 21 20 75 20 61 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ....(set!.u.a).................( |
| e1640 | 73 65 74 21 20 76 20 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 45 33 3e 29 29 0a | set!.v.b))...............<E3>)). |
| e1660 | 0a 20 20 20 20 20 48 65 72 65 20 60 61 27 20 61 6e 64 20 60 62 27 20 61 72 65 20 6d 65 61 6e 74 | ......Here.`a'.and.`b'.are.meant |
| e1680 | 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 6e 65 77 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 73 | .to.represent.new.variable.names |
| e16a0 | 2c 20 63 72 65 61 74 65 64 0a 20 20 20 20 20 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 | ,.created......by.the.interprete |
| e16c0 | 72 2c 20 74 68 61 74 20 64 6f 20 6e 6f 74 20 61 70 70 65 61 72 20 69 6e 20 74 68 65 20 75 73 65 | r,.that.do.not.appear.in.the.use |
| e16e0 | 72 27 73 20 70 72 6f 67 72 61 6d 2e 0a 20 20 20 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 60 | r's.program.......Consider.the.` |
| e1700 | 73 6f 6c 76 65 27 20 70 72 6f 63 65 64 75 72 65 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 2a 4e | solve'.procedure.from.section.*N |
| e1720 | 6f 74 65 20 33 2d 35 2d 34 3a 3a 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ote.3-5-4:::............(define. |
| e1740 | 28 73 6f 6c 76 65 20 66 20 79 30 20 64 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | (solve.f.y0.dt).............(def |
| e1760 | 69 6e 65 20 79 20 28 69 6e 74 65 67 72 61 6c 20 28 64 65 6c 61 79 20 64 79 29 20 79 30 20 64 74 | ine.y.(integral.(delay.dy).y0.dt |
| e1780 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 64 79 20 28 73 74 72 65 61 | )).............(define.dy.(strea |
| e17a0 | 6d 2d 6d 61 70 20 66 20 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 79 29 0a 0a 20 20 20 20 | m-map.f.y)).............y)...... |
| e17c0 | 20 57 69 6c 6c 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 77 6f 72 6b 20 69 66 20 69 6e 74 | .Will.this.procedure.work.if.int |
| e17e0 | 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 73 63 61 6e 6e 65 64 20 6f 75 | ernal.definitions.are.scanned.ou |
| e1800 | 74 0a 20 20 20 20 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 74 68 69 73 20 65 78 65 72 63 69 73 65 | t......as.shown.in.this.exercise |
| e1820 | 3f 20 20 57 68 61 74 20 69 66 20 74 68 65 79 20 61 72 65 20 73 63 61 6e 6e 65 64 20 6f 75 74 20 | ?..What.if.they.are.scanned.out. |
| e1840 | 61 73 20 73 68 6f 77 6e 0a 20 20 20 20 20 69 6e 20 74 68 65 20 74 65 78 74 3f 20 20 45 78 70 6c | as.shown......in.the.text?..Expl |
| e1860 | 61 69 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 31 39 3a 2a 20 42 65 6e 20 | ain........*Exercise.4.19:*.Ben. |
| e1880 | 42 69 74 64 69 64 64 6c 65 2c 20 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 2c 20 61 6e 64 | Bitdiddle,.Alyssa.P..Hacker,.and |
| e18a0 | 20 45 76 61 20 4c 75 20 41 74 6f 72 0a 20 20 20 20 20 61 72 65 20 61 72 67 75 69 6e 67 20 61 62 | .Eva.Lu.Ator......are.arguing.ab |
| e18c0 | 6f 75 74 20 74 68 65 20 64 65 73 69 72 65 64 20 72 65 73 75 6c 74 20 6f 66 20 65 76 61 6c 75 61 | out.the.desired.result.of.evalua |
| e18e0 | 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 | ting.the.expression............( |
| e1900 | 6c 65 74 20 28 28 61 20 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | let.((a.1)).............(define. |
| e1920 | 28 66 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 62 20 28 2b | (f.x)...............(define.b.(+ |
| e1940 | 20 61 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 61 20 35 | .a.x))...............(define.a.5 |
| e1960 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 61 20 62 29 29 0a 20 20 20 20 20 20 20 | )...............(+.a.b))........ |
| e1980 | 20 20 20 20 20 28 66 20 31 30 29 29 0a 0a 20 20 20 20 20 42 65 6e 20 61 73 73 65 72 74 73 20 74 | .....(f.10)).......Ben.asserts.t |
| e19a0 | 68 61 74 20 74 68 65 20 72 65 73 75 6c 74 20 73 68 6f 75 6c 64 20 62 65 20 6f 62 74 61 69 6e 65 | hat.the.result.should.be.obtaine |
| e19c0 | 64 20 75 73 69 6e 67 20 74 68 65 0a 20 20 20 20 20 73 65 71 75 65 6e 74 69 61 6c 20 72 75 6c 65 | d.using.the......sequential.rule |
| e19e0 | 20 66 6f 72 20 60 64 65 66 69 6e 65 27 3a 20 60 62 27 20 69 73 20 64 65 66 69 6e 65 64 20 74 6f | .for.`define':.`b'.is.defined.to |
| e1a00 | 20 62 65 20 31 31 2c 20 74 68 65 6e 20 60 61 27 20 69 73 0a 20 20 20 20 20 64 65 66 69 6e 65 64 | .be.11,.then.`a'.is......defined |
| e1a20 | 20 74 6f 20 62 65 20 35 2c 20 73 6f 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 20 31 36 2e 20 20 | .to.be.5,.so.the.result.is.16... |
| e1a40 | 41 6c 79 73 73 61 20 6f 62 6a 65 63 74 73 20 74 68 61 74 20 6d 75 74 75 61 6c 0a 20 20 20 20 20 | Alyssa.objects.that.mutual...... |
| e1a60 | 72 65 63 75 72 73 69 6f 6e 20 72 65 71 75 69 72 65 73 20 74 68 65 20 73 69 6d 75 6c 74 61 6e 65 | recursion.requires.the.simultane |
| e1a80 | 6f 75 73 20 73 63 6f 70 65 20 72 75 6c 65 20 66 6f 72 20 69 6e 74 65 72 6e 61 6c 0a 20 20 20 20 | ous.scope.rule.for.internal..... |
| e1aa0 | 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 61 6e 64 20 74 68 61 74 | .procedure.definitions,.and.that |
| e1ac0 | 20 69 74 20 69 73 20 75 6e 72 65 61 73 6f 6e 61 62 6c 65 20 74 6f 20 74 72 65 61 74 0a 20 20 20 | .it.is.unreasonable.to.treat.... |
| e1ae0 | 20 20 70 72 6f 63 65 64 75 72 65 20 6e 61 6d 65 73 20 64 69 66 66 65 72 65 6e 74 6c 79 20 66 72 | ..procedure.names.differently.fr |
| e1b00 | 6f 6d 20 6f 74 68 65 72 20 6e 61 6d 65 73 2e 20 20 54 68 75 73 2c 20 73 68 65 20 61 72 67 75 65 | om.other.names...Thus,.she.argue |
| e1b20 | 73 0a 20 20 20 20 20 66 6f 72 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d 20 69 6d 70 6c 65 6d 65 | s......for.the.mechanism.impleme |
| e1b40 | 6e 74 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 31 36 3a 3a 2e 20 20 | nted.in.*Note.Exercise.4-16::... |
| e1b60 | 54 68 69 73 0a 20 20 20 20 20 77 6f 75 6c 64 20 6c 65 61 64 20 74 6f 20 60 61 27 20 62 65 69 6e | This......would.lead.to.`a'.bein |
| e1b80 | 67 20 75 6e 61 73 73 69 67 6e 65 64 20 61 74 20 74 68 65 20 74 69 6d 65 20 74 68 61 74 20 74 68 | g.unassigned.at.the.time.that.th |
| e1ba0 | 65 20 76 61 6c 75 65 20 66 6f 72 0a 20 20 20 20 20 60 62 27 20 69 73 20 74 6f 20 62 65 20 63 6f | e.value.for......`b'.is.to.be.co |
| e1bc0 | 6d 70 75 74 65 64 2e 20 20 48 65 6e 63 65 2c 20 69 6e 20 41 6c 79 73 73 61 27 73 20 76 69 65 77 | mputed...Hence,.in.Alyssa's.view |
| e1be0 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 73 68 6f 75 6c 64 20 70 72 6f 64 75 | .the.procedure......should.produ |
| e1c00 | 63 65 20 61 6e 20 65 72 72 6f 72 2e 20 20 45 76 61 20 68 61 73 20 61 20 74 68 69 72 64 20 6f 70 | ce.an.error...Eva.has.a.third.op |
| e1c20 | 69 6e 69 6f 6e 2e 20 20 53 68 65 20 73 61 79 73 20 74 68 61 74 0a 20 20 20 20 20 69 66 20 74 68 | inion...She.says.that......if.th |
| e1c40 | 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 60 61 27 20 61 6e 64 20 60 62 27 20 61 72 65 | e.definitions.of.`a'.and.`b'.are |
| e1c60 | 20 74 72 75 6c 79 20 6d 65 61 6e 74 20 74 6f 20 62 65 0a 20 20 20 20 20 73 69 6d 75 6c 74 61 6e | .truly.meant.to.be......simultan |
| e1c80 | 65 6f 75 73 2c 20 74 68 65 6e 20 74 68 65 20 76 61 6c 75 65 20 35 20 66 6f 72 20 60 61 27 20 73 | eous,.then.the.value.5.for.`a'.s |
| e1ca0 | 68 6f 75 6c 64 20 62 65 20 75 73 65 64 20 69 6e 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6e 67 | hould.be.used.in......evaluating |
| e1cc0 | 20 60 62 27 2e 20 20 48 65 6e 63 65 2c 20 69 6e 20 45 76 61 27 73 20 76 69 65 77 20 60 61 27 20 | .`b'...Hence,.in.Eva's.view.`a'. |
| e1ce0 | 73 68 6f 75 6c 64 20 62 65 20 35 2c 20 60 62 27 20 73 68 6f 75 6c 64 0a 20 20 20 20 20 62 65 20 | should.be.5,.`b'.should......be. |
| e1d00 | 31 35 2c 20 61 6e 64 20 74 68 65 20 72 65 73 75 6c 74 20 73 68 6f 75 6c 64 20 62 65 20 32 30 2e | 15,.and.the.result.should.be.20. |
| e1d20 | 20 20 57 68 69 63 68 20 28 69 66 20 61 6e 79 29 20 6f 66 20 74 68 65 73 65 0a 20 20 20 20 20 76 | ..Which.(if.any).of.these......v |
| e1d40 | 69 65 77 70 6f 69 6e 74 73 20 64 6f 20 79 6f 75 20 73 75 70 70 6f 72 74 3f 20 20 43 61 6e 20 79 | iewpoints.do.you.support?..Can.y |
| e1d60 | 6f 75 20 64 65 76 69 73 65 20 61 20 77 61 79 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 0a 20 20 20 | ou.devise.a.way.to.implement.... |
| e1d80 | 20 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 73 6f 20 74 68 61 74 20 74 | ..internal.definitions.so.that.t |
| e1da0 | 68 65 79 20 62 65 68 61 76 65 20 61 73 20 45 76 61 20 70 72 65 66 65 72 73 3f 28 33 29 0a 0a 20 | hey.behave.as.Eva.prefers?(3)... |
| e1dc0 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 32 30 3a 2a 20 42 65 63 61 75 73 65 20 69 6e 74 | ....*Exercise.4.20:*.Because.int |
| e1de0 | 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6c 6f 6f 6b 20 73 65 71 75 65 6e 74 69 61 | ernal.definitions.look.sequentia |
| e1e00 | 6c 20 62 75 74 0a 20 20 20 20 20 61 72 65 20 61 63 74 75 61 6c 6c 79 20 73 69 6d 75 6c 74 61 6e | l.but......are.actually.simultan |
| e1e20 | 65 6f 75 73 2c 20 73 6f 6d 65 20 70 65 6f 70 6c 65 20 70 72 65 66 65 72 20 74 6f 20 61 76 6f 69 | eous,.some.people.prefer.to.avoi |
| e1e40 | 64 20 74 68 65 6d 0a 20 20 20 20 20 65 6e 74 69 72 65 6c 79 2c 20 61 6e 64 20 75 73 65 20 74 68 | d.them......entirely,.and.use.th |
| e1e60 | 65 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 60 6c 65 74 72 65 63 27 20 69 6e 73 74 65 61 64 2e | e.special.form.`letrec'.instead. |
| e1e80 | 20 20 60 4c 65 74 72 65 63 27 0a 20 20 20 20 20 6c 6f 6f 6b 73 20 6c 69 6b 65 20 60 6c 65 74 27 | ..`Letrec'......looks.like.`let' |
| e1ea0 | 2c 20 73 6f 20 69 74 20 69 73 20 6e 6f 74 20 73 75 72 70 72 69 73 69 6e 67 20 74 68 61 74 20 74 | ,.so.it.is.not.surprising.that.t |
| e1ec0 | 68 65 20 76 61 72 69 61 62 6c 65 73 20 69 74 0a 20 20 20 20 20 62 69 6e 64 73 20 61 72 65 20 62 | he.variables.it......binds.are.b |
| e1ee0 | 6f 75 6e 64 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 6c 79 20 61 6e 64 20 68 61 76 65 20 74 68 65 | ound.simultaneously.and.have.the |
| e1f00 | 20 73 61 6d 65 20 73 63 6f 70 65 20 61 73 20 65 61 63 68 0a 20 20 20 20 20 6f 74 68 65 72 2e 20 | .same.scope.as.each......other.. |
| e1f20 | 20 54 68 65 20 73 61 6d 70 6c 65 20 70 72 6f 63 65 64 75 72 65 20 60 66 27 20 61 62 6f 76 65 20 | .The.sample.procedure.`f'.above. |
| e1f40 | 63 61 6e 20 62 65 20 77 72 69 74 74 65 6e 20 77 69 74 68 6f 75 74 0a 20 20 20 20 20 69 6e 74 65 | can.be.written.without......inte |
| e1f60 | 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 62 75 74 20 77 69 74 68 20 65 78 61 63 74 | rnal.definitions,.but.with.exact |
| e1f80 | 6c 79 20 74 68 65 20 73 61 6d 65 20 6d 65 61 6e 69 6e 67 2c 20 61 73 0a 0a 20 20 20 20 20 20 20 | ly.the.same.meaning,.as......... |
| e1fa0 | 20 20 20 28 64 65 66 69 6e 65 20 28 66 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 | ...(define.(f.x).............(le |
| e1fc0 | 74 72 65 63 20 28 28 65 76 65 6e 3f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | trec.((even?.................... |
| e1fe0 | 20 20 20 28 6c 61 6d 62 64 61 20 28 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...(lambda.(n).................. |
| e2000 | 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......(if.(=.n.0).............. |
| e2020 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ...............true............. |
| e2040 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 64 64 3f 20 28 2d 20 6e 20 31 29 29 29 29 | ................(odd?.(-.n.1)))) |
| e2060 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 64 64 3f 0a 20 20 20 | )......................(odd?.... |
| e2080 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6e 29 0a 20 | ...................(lambda.(n).. |
| e20a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 | .......................(if.(=.n. |
| e20c0 | 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 | 0).............................f |
| e20e0 | 61 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | alse............................ |
| e2100 | 20 28 65 76 65 6e 3f 20 28 2d 20 6e 20 31 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(even?.(-.n.1))))))............ |
| e2120 | 20 20 20 3c 52 45 53 54 20 4f 46 20 42 4f 44 59 20 4f 46 20 60 46 27 3e 29 29 0a 0a 20 20 20 20 | ...<REST.OF.BODY.OF.`F'>))...... |
| e2140 | 20 60 4c 65 74 72 65 63 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 77 68 69 63 68 20 68 61 76 | .`Letrec'.expressions,.which.hav |
| e2160 | 65 20 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 72 65 63 20 28 28 | e.the.form............(letrec.(( |
| e2180 | 3c 56 41 52 5f 31 3e 20 3c 45 58 50 5f 31 3e 29 20 2e 2e 2e 20 28 3c 56 41 52 5f 4e 3e 20 3c 45 | <VAR_1>.<EXP_1>).....(<VAR_N>.<E |
| e21a0 | 58 50 5f 4e 3e 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 42 4f 44 59 3e 29 0a 0a 20 20 20 | XP_N>)).............<BODY>)..... |
| e21c0 | 20 20 61 72 65 20 61 20 76 61 72 69 61 74 69 6f 6e 20 6f 6e 20 60 6c 65 74 27 20 69 6e 20 77 68 | ..are.a.variation.on.`let'.in.wh |
| e21e0 | 69 63 68 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 3c 45 58 50 5f 4b 3e 20 74 68 61 74 | ich.the.expressions.<EXP_K>.that |
| e2200 | 0a 20 20 20 20 20 70 72 6f 76 69 64 65 20 74 68 65 20 69 6e 69 74 69 61 6c 20 76 61 6c 75 65 73 | ......provide.the.initial.values |
| e2220 | 20 66 6f 72 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 3c 56 41 52 5f 4b 3e 20 61 72 65 20 65 | .for.the.variables.<VAR_K>.are.e |
| e2240 | 76 61 6c 75 61 74 65 64 0a 20 20 20 20 20 69 6e 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 | valuated......in.an.environment. |
| e2260 | 74 68 61 74 20 69 6e 63 6c 75 64 65 73 20 61 6c 6c 20 74 68 65 20 60 6c 65 74 72 65 63 27 20 62 | that.includes.all.the.`letrec'.b |
| e2280 | 69 6e 64 69 6e 67 73 2e 20 20 54 68 69 73 0a 20 20 20 20 20 70 65 72 6d 69 74 73 20 72 65 63 75 | indings...This......permits.recu |
| e22a0 | 72 73 69 6f 6e 20 69 6e 20 74 68 65 20 62 69 6e 64 69 6e 67 73 2c 20 73 75 63 68 20 61 73 20 74 | rsion.in.the.bindings,.such.as.t |
| e22c0 | 68 65 20 6d 75 74 75 61 6c 20 72 65 63 75 72 73 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 65 76 65 | he.mutual.recursion.of......`eve |
| e22e0 | 6e 3f 27 20 61 6e 64 20 60 6f 64 64 3f 27 20 69 6e 20 74 68 65 20 65 78 61 6d 70 6c 65 20 61 62 | n?'.and.`odd?'.in.the.example.ab |
| e2300 | 6f 76 65 2c 20 6f 72 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 31 30 0a 20 20 20 | ove,.or.the.evaluation.of.10.... |
| e2320 | 20 20 66 61 63 74 6f 72 69 61 6c 20 77 69 74 68 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 | ..factorial.with............(let |
| e2340 | 72 65 63 20 28 28 66 61 63 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | rec.((fact.....................( |
| e2360 | 6c 61 6d 62 64 61 20 28 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | lambda.(n)...................... |
| e2380 | 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(if.(=.n.1).................... |
| e23a0 | 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......1........................ |
| e23c0 | 20 20 20 28 2a 20 6e 20 28 66 61 63 74 20 28 2d 20 6e 20 31 29 29 29 29 29 29 29 0a 20 20 20 20 | ...(*.n.(fact.(-.n.1)))))))..... |
| e23e0 | 20 20 20 20 20 20 20 20 28 66 61 63 74 20 31 30 29 29 0a 0a 20 20 20 20 20 20 20 61 2e 20 49 6d | ........(fact.10)).........a..Im |
| e2400 | 70 6c 65 6d 65 6e 74 20 60 6c 65 74 72 65 63 27 20 61 73 20 61 20 64 65 72 69 76 65 64 20 65 78 | plement.`letrec'.as.a.derived.ex |
| e2420 | 70 72 65 73 73 69 6f 6e 2c 20 62 79 20 74 72 61 6e 73 66 6f 72 6d 69 6e 67 20 61 0a 20 20 20 20 | pression,.by.transforming.a..... |
| e2440 | 20 20 20 20 20 20 60 6c 65 74 72 65 63 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 74 6f 20 61 | ......`letrec'.expression.into.a |
| e2460 | 20 60 6c 65 74 27 20 65 78 70 72 65 73 73 69 6f 6e 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 74 68 | .`let'.expression.as.shown.in.th |
| e2480 | 65 0a 20 20 20 20 20 20 20 20 20 20 74 65 78 74 20 61 62 6f 76 65 20 6f 72 20 69 6e 20 2a 4e 6f | e...........text.above.or.in.*No |
| e24a0 | 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 31 38 3a 3a 2e 20 20 54 68 61 74 20 69 73 2c 20 74 68 | te.Exercise.4-18::...That.is,.th |
| e24c0 | 65 0a 20 20 20 20 20 20 20 20 20 20 60 6c 65 74 72 65 63 27 20 76 61 72 69 61 62 6c 65 73 20 73 | e...........`letrec'.variables.s |
| e24e0 | 68 6f 75 6c 64 20 62 65 20 63 72 65 61 74 65 64 20 77 69 74 68 20 61 20 60 6c 65 74 27 20 61 6e | hould.be.created.with.a.`let'.an |
| e2500 | 64 20 74 68 65 6e 20 62 65 0a 20 20 20 20 20 20 20 20 20 20 61 73 73 69 67 6e 65 64 20 74 68 65 | d.then.be...........assigned.the |
| e2520 | 69 72 20 76 61 6c 75 65 73 20 77 69 74 68 20 60 73 65 74 21 27 2e 0a 0a 20 20 20 20 20 20 20 62 | ir.values.with.`set!'..........b |
| e2540 | 2e 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 20 69 73 20 63 6f 6e 66 75 73 65 64 20 62 79 20 | ..Louis.Reasoner.is.confused.by. |
| e2560 | 61 6c 6c 20 74 68 69 73 20 66 75 73 73 20 61 62 6f 75 74 20 69 6e 74 65 72 6e 61 6c 0a 20 20 20 | all.this.fuss.about.internal.... |
| e2580 | 20 20 20 20 20 20 20 64 65 66 69 6e 69 74 69 6f 6e 73 2e 20 20 54 68 65 20 77 61 79 20 68 65 20 | .......definitions...The.way.he. |
| e25a0 | 73 65 65 73 20 69 74 2c 20 69 66 20 79 6f 75 20 64 6f 6e 27 74 20 6c 69 6b 65 20 74 6f 20 75 73 | sees.it,.if.you.don't.like.to.us |
| e25c0 | 65 0a 20 20 20 20 20 20 20 20 20 20 60 64 65 66 69 6e 65 27 20 69 6e 73 69 64 65 20 61 20 70 72 | e...........`define'.inside.a.pr |
| e25e0 | 6f 63 65 64 75 72 65 2c 20 79 6f 75 20 63 61 6e 20 6a 75 73 74 20 75 73 65 20 60 6c 65 74 27 2e | ocedure,.you.can.just.use.`let'. |
| e2600 | 0a 20 20 20 20 20 20 20 20 20 20 49 6c 6c 75 73 74 72 61 74 65 20 77 68 61 74 20 69 73 20 6c 6f | ...........Illustrate.what.is.lo |
| e2620 | 6f 73 65 20 61 62 6f 75 74 20 68 69 73 20 72 65 61 73 6f 6e 69 6e 67 20 62 79 20 64 72 61 77 69 | ose.about.his.reasoning.by.drawi |
| e2640 | 6e 67 20 61 6e 0a 20 20 20 20 20 20 20 20 20 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 64 69 61 67 | ng.an...........environment.diag |
| e2660 | 72 61 6d 20 74 68 61 74 20 73 68 6f 77 73 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 | ram.that.shows.the.environment.i |
| e2680 | 6e 20 77 68 69 63 68 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 3c 52 45 53 54 20 4f 46 20 42 | n.which.the...........<REST.OF.B |
| e26a0 | 4f 44 59 20 4f 46 20 60 46 27 3e 20 69 73 20 65 76 61 6c 75 61 74 65 64 20 64 75 72 69 6e 67 20 | ODY.OF.`F'>.is.evaluated.during. |
| e26c0 | 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 65 78 70 72 | evaluation.of.the...........expr |
| e26e0 | 65 73 73 69 6f 6e 20 60 28 66 20 35 29 27 2c 20 77 69 74 68 20 60 66 27 20 64 65 66 69 6e 65 64 | ession.`(f.5)',.with.`f'.defined |
| e2700 | 20 61 73 20 69 6e 20 74 68 69 73 20 65 78 65 72 63 69 73 65 2e 0a 20 20 20 20 20 20 20 20 20 20 | .as.in.this.exercise............ |
| e2720 | 44 72 61 77 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 64 69 61 67 72 61 6d 20 66 6f 72 20 | Draw.an.environment.diagram.for. |
| e2740 | 74 68 65 20 73 61 6d 65 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 62 75 74 20 77 69 74 68 0a 20 20 | the.same.evaluation,.but.with... |
| e2760 | 20 20 20 20 20 20 20 20 60 6c 65 74 27 20 69 6e 20 70 6c 61 63 65 20 6f 66 20 60 6c 65 74 72 65 | ........`let'.in.place.of.`letre |
| e2780 | 63 27 20 69 6e 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 66 27 2e 0a 0a 0a 20 | c'.in.the.definition.of.`f'..... |
| e27a0 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 32 31 3a 2a 20 41 6d 61 7a 69 6e 67 6c 79 2c 20 | ....*Exercise.4.21:*.Amazingly,. |
| e27c0 | 4c 6f 75 69 73 27 73 20 69 6e 74 75 69 74 69 6f 6e 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 | Louis's.intuition.in.*Note.Exerc |
| e27e0 | 69 73 65 0a 20 20 20 20 20 34 2d 32 30 3a 3a 20 69 73 20 63 6f 72 72 65 63 74 2e 20 20 49 74 20 | ise......4-20::.is.correct...It. |
| e2800 | 69 73 20 69 6e 64 65 65 64 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 73 70 65 63 69 66 79 20 72 65 | is.indeed.possible.to.specify.re |
| e2820 | 63 75 72 73 69 76 65 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 73 20 77 69 74 68 6f 75 74 20 | cursive......procedures.without. |
| e2840 | 75 73 69 6e 67 20 60 6c 65 74 72 65 63 27 20 28 6f 72 20 65 76 65 6e 20 60 64 65 66 69 6e 65 27 | using.`letrec'.(or.even.`define' |
| e2860 | 29 2c 20 61 6c 74 68 6f 75 67 68 20 74 68 65 0a 20 20 20 20 20 6d 65 74 68 6f 64 20 66 6f 72 20 | ),.although.the......method.for. |
| e2880 | 61 63 63 6f 6d 70 6c 69 73 68 69 6e 67 20 74 68 69 73 20 69 73 20 6d 75 63 68 20 6d 6f 72 65 20 | accomplishing.this.is.much.more. |
| e28a0 | 73 75 62 74 6c 65 20 74 68 61 6e 20 4c 6f 75 69 73 0a 20 20 20 20 20 69 6d 61 67 69 6e 65 64 2e | subtle.than.Louis......imagined. |
| e28c0 | 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 20 63 6f 6d 70 75 | ..The.following.expression.compu |
| e28e0 | 74 65 73 20 31 30 20 66 61 63 74 6f 72 69 61 6c 20 62 79 0a 20 20 20 20 20 61 70 70 6c 79 69 6e | tes.10.factorial.by......applyin |
| e2900 | 67 20 61 20 72 65 63 75 72 73 69 76 65 20 66 61 63 74 6f 72 69 61 6c 20 70 72 6f 63 65 64 75 72 | g.a.recursive.factorial.procedur |
| e2920 | 65 3a 28 34 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 6c 61 6d 62 64 61 20 28 6e 29 0a 20 20 | e:(4)............((lambda.(n)... |
| e2940 | 20 20 20 20 20 20 20 20 20 20 20 28 28 6c 61 6d 62 64 61 20 28 66 61 63 74 29 0a 20 20 20 20 20 | ...........((lambda.(fact)...... |
| e2960 | 20 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 20 66 61 63 74 20 6e 29 29 0a 20 20 20 20 20 20 | ...........(fact.fact.n))....... |
| e2980 | 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 66 74 20 6b 29 0a 20 20 20 20 20 20 20 20 20 | ........(lambda.(ft.k).......... |
| e29a0 | 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6b 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......(if.(=.k.1).............. |
| e29c0 | 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 | .......1.....................(*. |
| e29e0 | 6b 20 28 66 74 20 66 74 20 28 2d 20 6b 20 31 29 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 | k.(ft.ft.(-.k.1))))))).......... |
| e2a00 | 20 20 31 30 29 0a 0a 20 20 20 20 20 20 20 61 2e 20 43 68 65 63 6b 20 28 62 79 20 65 76 61 6c 75 | ..10).........a..Check.(by.evalu |
| e2a20 | 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 29 20 74 68 61 74 20 74 68 69 73 20 | ating.the.expression).that.this. |
| e2a40 | 72 65 61 6c 6c 79 20 64 6f 65 73 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 70 75 74 65 20 66 61 | really.does...........compute.fa |
| e2a60 | 63 74 6f 72 69 61 6c 73 2e 20 20 44 65 76 69 73 65 20 61 6e 20 61 6e 61 6c 6f 67 6f 75 73 20 65 | ctorials...Devise.an.analogous.e |
| e2a80 | 78 70 72 65 73 73 69 6f 6e 20 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 70 75 74 69 6e | xpression.for...........computin |
| e2aa0 | 67 20 46 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 | g.Fibonacci.numbers..........b.. |
| e2ac0 | 43 6f 6e 73 69 64 65 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 | Consider.the.following.procedure |
| e2ae0 | 2c 20 77 68 69 63 68 20 69 6e 63 6c 75 64 65 73 20 6d 75 74 75 61 6c 6c 79 0a 20 20 20 20 20 20 | ,.which.includes.mutually....... |
| e2b00 | 20 20 20 20 72 65 63 75 72 73 69 76 65 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f | ....recursive.internal.definitio |
| e2b20 | 6e 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 20 78 | ns:.................(define.(f.x |
| e2b40 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 65 6e | )..................(define.(even |
| e2b60 | 3f 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e | ?.n)....................(if.(=.n |
| e2b80 | 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 75 65 0a | .0)........................true. |
| e2ba0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 64 64 3f 20 28 2d 20 | .......................(odd?.(-. |
| e2bc0 | 6e 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | n.1))))..................(define |
| e2be0 | 20 28 6f 64 64 3f 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 | .(odd?.n)....................(if |
| e2c00 | 20 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(=.n.0)........................ |
| e2c20 | 66 61 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 76 | false........................(ev |
| e2c40 | 65 6e 3f 20 28 2d 20 6e 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | en?.(-.n.1)))).................. |
| e2c60 | 28 65 76 65 6e 3f 20 78 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 46 69 6c 6c 20 69 6e 20 74 68 | (even?.x))............Fill.in.th |
| e2c80 | 65 20 6d 69 73 73 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 6f 20 63 6f 6d 70 6c 65 74 | e.missing.expressions.to.complet |
| e2ca0 | 65 20 61 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 0a 20 20 20 20 20 20 20 20 20 20 64 65 66 69 6e | e.an.alternative...........defin |
| e2cc0 | 69 74 69 6f 6e 20 6f 66 20 60 66 27 2c 20 77 68 69 63 68 20 75 73 65 73 20 6e 65 69 74 68 65 72 | ition.of.`f',.which.uses.neither |
| e2ce0 | 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 0a 20 20 20 20 20 20 20 20 20 20 | .internal.definitions........... |
| e2d00 | 6e 6f 72 20 60 6c 65 74 72 65 63 27 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 | nor.`letrec':.................(d |
| e2d20 | 65 66 69 6e 65 20 28 66 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6c | efine.(f.x)..................((l |
| e2d40 | 61 6d 62 64 61 20 28 65 76 65 6e 3f 20 6f 64 64 3f 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ambda.(even?.odd?).............. |
| e2d60 | 20 20 20 20 20 20 20 28 65 76 65 6e 3f 20 65 76 65 6e 3f 20 6f 64 64 3f 20 78 29 29 0a 20 20 20 | .......(even?.even?.odd?.x)).... |
| e2d80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 76 3f 20 6f 64 3f 20 | ...............(lambda.(ev?.od?. |
| e2da0 | 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 | n).....................(if.(=.n. |
| e2dc0 | 30 29 20 74 72 75 65 20 28 6f 64 3f 20 3c 3f 3f 3e 20 3c 3f 3f 3e 20 3c 3f 3f 3e 29 29 29 0a 20 | 0).true.(od?.<??>.<??>.<??>))).. |
| e2de0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 76 3f 20 6f 64 | .................(lambda.(ev?.od |
| e2e00 | 3f 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 | ?.n).....................(if.(=. |
| e2e20 | 6e 20 30 29 20 66 61 6c 73 65 20 28 65 76 3f 20 3c 3f 3f 3e 20 3c 3f 3f 3e 20 3c 3f 3f 3e 29 29 | n.0).false.(ev?.<??>.<??>.<??>)) |
| e2e40 | 29 29 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d | ))).....----------.Footnotes.--- |
| e2e60 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 57 61 6e 74 69 6e 67 20 70 72 6f 67 72 61 6d 73 | -------.....(1).Wanting.programs |
| e2e80 | 20 74 6f 20 6e 6f 74 20 64 65 70 65 6e 64 20 6f 6e 20 74 68 69 73 20 65 76 61 6c 75 61 74 69 6f | .to.not.depend.on.this.evaluatio |
| e2ea0 | 6e 20 6d 65 63 68 61 6e 69 73 6d 20 69 73 0a 74 68 65 20 72 65 61 73 6f 6e 20 66 6f 72 20 74 68 | n.mechanism.is.the.reason.for.th |
| e2ec0 | 65 20 22 6d 61 6e 61 67 65 6d 65 6e 74 20 69 73 20 6e 6f 74 20 72 65 73 70 6f 6e 73 69 62 6c 65 | e."management.is.not.responsible |
| e2ee0 | 22 20 72 65 6d 61 72 6b 20 69 6e 20 2a 4e 6f 74 65 0a 46 6f 6f 74 6e 6f 74 65 20 32 38 3a 3a 20 | ".remark.in.*Note.Footnote.28::. |
| e2f00 | 6f 66 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 31 3a 3a 2e 20 20 42 79 20 69 6e 73 69 73 74 | of.*Note.Chapter.1::...By.insist |
| e2f20 | 69 6e 67 20 74 68 61 74 20 69 6e 74 65 72 6e 61 6c 0a 64 65 66 69 6e 69 74 69 6f 6e 73 20 63 6f | ing.that.internal.definitions.co |
| e2f40 | 6d 65 20 66 69 72 73 74 20 61 6e 64 20 64 6f 20 6e 6f 74 20 75 73 65 20 65 61 63 68 20 6f 74 68 | me.first.and.do.not.use.each.oth |
| e2f60 | 65 72 20 77 68 69 6c 65 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 0a 61 72 65 20 62 65 69 | er.while.the.definitions.are.bei |
| e2f80 | 6e 67 20 65 76 61 6c 75 61 74 65 64 2c 20 74 68 65 20 49 45 45 45 20 73 74 61 6e 64 61 72 64 20 | ng.evaluated,.the.IEEE.standard. |
| e2fa0 | 66 6f 72 20 53 63 68 65 6d 65 20 6c 65 61 76 65 73 20 69 6d 70 6c 65 6d 65 6e 74 6f 72 73 0a 73 | for.Scheme.leaves.implementors.s |
| e2fc0 | 6f 6d 65 20 63 68 6f 69 63 65 20 69 6e 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d 20 75 73 65 64 | ome.choice.in.the.mechanism.used |
| e2fe0 | 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 73 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 2e 20 | .to.evaluate.these.definitions.. |
| e3000 | 20 54 68 65 0a 63 68 6f 69 63 65 20 6f 66 20 6f 6e 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 75 | .The.choice.of.one.evaluation.ru |
| e3020 | 6c 65 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 6e 6f 74 68 65 72 20 68 65 72 65 20 6d 61 79 20 | le.rather.than.another.here.may. |
| e3040 | 73 65 65 6d 20 6c 69 6b 65 20 61 0a 73 6d 61 6c 6c 20 69 73 73 75 65 2c 20 61 66 66 65 63 74 69 | seem.like.a.small.issue,.affecti |
| e3060 | 6e 67 20 6f 6e 6c 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 22 62 | ng.only.the.interpretation.of."b |
| e3080 | 61 64 6c 79 20 66 6f 72 6d 65 64 22 0a 70 72 6f 67 72 61 6d 73 2e 20 20 48 6f 77 65 76 65 72 2c | adly.formed".programs...However, |
| e30a0 | 20 77 65 20 77 69 6c 6c 20 73 65 65 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d | .we.will.see.in.section.*Note.5- |
| e30c0 | 35 2d 36 3a 3a 20 74 68 61 74 20 6d 6f 76 69 6e 67 20 74 6f 0a 61 20 6d 6f 64 65 6c 20 6f 66 20 | 5-6::.that.moving.to.a.model.of. |
| e30e0 | 73 69 6d 75 6c 74 61 6e 65 6f 75 73 20 73 63 6f 70 69 6e 67 20 66 6f 72 20 69 6e 74 65 72 6e 61 | simultaneous.scoping.for.interna |
| e3100 | 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 76 6f 69 64 73 20 73 6f 6d 65 0a 6e 61 73 74 79 20 | l.definitions.avoids.some.nasty. |
| e3120 | 64 69 66 66 69 63 75 6c 74 69 65 73 20 74 68 61 74 20 77 6f 75 6c 64 20 6f 74 68 65 72 77 69 73 | difficulties.that.would.otherwis |
| e3140 | 65 20 61 72 69 73 65 20 69 6e 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 61 0a 63 6f 6d 70 69 6c | e.arise.in.implementing.a.compil |
| e3160 | 65 72 2e 0a 0a 20 20 20 28 32 29 20 54 68 65 20 49 45 45 45 20 73 74 61 6e 64 61 72 64 20 66 6f | er......(2).The.IEEE.standard.fo |
| e3180 | 72 20 53 63 68 65 6d 65 20 61 6c 6c 6f 77 73 20 66 6f 72 20 64 69 66 66 65 72 65 6e 74 20 69 6d | r.Scheme.allows.for.different.im |
| e31a0 | 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 0a 73 74 72 61 74 65 67 69 65 73 20 62 79 20 73 70 65 63 69 | plementation.strategies.by.speci |
| e31c0 | 66 79 69 6e 67 20 74 68 61 74 20 69 74 20 69 73 20 75 70 20 74 6f 20 74 68 65 20 70 72 6f 67 72 | fying.that.it.is.up.to.the.progr |
| e31e0 | 61 6d 6d 65 72 20 74 6f 20 6f 62 65 79 20 74 68 69 73 0a 72 65 73 74 72 69 63 74 69 6f 6e 2c 20 | ammer.to.obey.this.restriction,. |
| e3200 | 6e 6f 74 20 75 70 20 74 6f 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 74 6f 20 | not.up.to.the.implementation.to. |
| e3220 | 65 6e 66 6f 72 63 65 20 69 74 2e 20 20 53 6f 6d 65 20 53 63 68 65 6d 65 0a 69 6d 70 6c 65 6d 65 | enforce.it...Some.Scheme.impleme |
| e3240 | 6e 74 61 74 69 6f 6e 73 2c 20 69 6e 63 6c 75 64 69 6e 67 20 4d 49 54 20 53 63 68 65 6d 65 2c 20 | ntations,.including.MIT.Scheme,. |
| e3260 | 75 73 65 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 73 68 6f 77 6e 0a 61 62 6f | use.the.transformation.shown.abo |
| e3280 | 76 65 2e 20 20 54 68 75 73 2c 20 73 6f 6d 65 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 64 6f | ve...Thus,.some.programs.that.do |
| e32a0 | 6e 27 74 20 6f 62 65 79 20 74 68 69 73 20 72 65 73 74 72 69 63 74 69 6f 6e 20 77 69 6c 6c 20 69 | n't.obey.this.restriction.will.i |
| e32c0 | 6e 0a 66 61 63 74 20 72 75 6e 20 69 6e 20 73 75 63 68 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | n.fact.run.in.such.implementatio |
| e32e0 | 6e 73 2e 0a 0a 20 20 20 28 33 29 20 54 68 65 20 4d 49 54 20 69 6d 70 6c 65 6d 65 6e 74 6f 72 73 | ns......(3).The.MIT.implementors |
| e3300 | 20 6f 66 20 53 63 68 65 6d 65 20 73 75 70 70 6f 72 74 20 41 6c 79 73 73 61 20 6f 6e 20 74 68 65 | .of.Scheme.support.Alyssa.on.the |
| e3320 | 20 66 6f 6c 6c 6f 77 69 6e 67 0a 67 72 6f 75 6e 64 73 3a 20 45 76 61 20 69 73 20 69 6e 20 70 72 | .following.grounds:.Eva.is.in.pr |
| e3340 | 69 6e 63 69 70 6c 65 20 63 6f 72 72 65 63 74 20 2d 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e | inciple.correct.-.the.definition |
| e3360 | 73 20 73 68 6f 75 6c 64 20 62 65 0a 72 65 67 61 72 64 65 64 20 61 73 20 73 69 6d 75 6c 74 61 6e | s.should.be.regarded.as.simultan |
| e3380 | 65 6f 75 73 2e 20 20 42 75 74 20 69 74 20 73 65 65 6d 73 20 64 69 66 66 69 63 75 6c 74 20 74 6f | eous...But.it.seems.difficult.to |
| e33a0 | 20 69 6d 70 6c 65 6d 65 6e 74 20 61 0a 67 65 6e 65 72 61 6c 2c 20 65 66 66 69 63 69 65 6e 74 20 | .implement.a.general,.efficient. |
| e33c0 | 6d 65 63 68 61 6e 69 73 6d 20 74 68 61 74 20 64 6f 65 73 20 77 68 61 74 20 45 76 61 20 72 65 71 | mechanism.that.does.what.Eva.req |
| e33e0 | 75 69 72 65 73 2e 20 20 49 6e 20 74 68 65 0a 61 62 73 65 6e 63 65 20 6f 66 20 73 75 63 68 20 61 | uires...In.the.absence.of.such.a |
| e3400 | 20 6d 65 63 68 61 6e 69 73 6d 2c 20 69 74 20 69 73 20 62 65 74 74 65 72 20 74 6f 20 67 65 6e 65 | .mechanism,.it.is.better.to.gene |
| e3420 | 72 61 74 65 20 61 6e 20 65 72 72 6f 72 20 69 6e 20 74 68 65 0a 64 69 66 66 69 63 75 6c 74 20 63 | rate.an.error.in.the.difficult.c |
| e3440 | 61 73 65 73 20 6f 66 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 20 64 65 66 69 6e 69 74 69 6f 6e 73 | ases.of.simultaneous.definitions |
| e3460 | 20 28 41 6c 79 73 73 61 27 73 20 6e 6f 74 69 6f 6e 29 20 74 68 61 6e 20 74 6f 0a 70 72 6f 64 75 | .(Alyssa's.notion).than.to.produ |
| e3480 | 63 65 20 61 6e 20 69 6e 63 6f 72 72 65 63 74 20 61 6e 73 77 65 72 20 28 61 73 20 42 65 6e 20 77 | ce.an.incorrect.answer.(as.Ben.w |
| e34a0 | 6f 75 6c 64 20 68 61 76 65 20 69 74 29 2e 0a 0a 20 20 20 28 34 29 20 54 68 69 73 20 65 78 61 6d | ould.have.it)......(4).This.exam |
| e34c0 | 70 6c 65 20 69 6c 6c 75 73 74 72 61 74 65 73 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 74 72 | ple.illustrates.a.programming.tr |
| e34e0 | 69 63 6b 20 66 6f 72 20 66 6f 72 6d 75 6c 61 74 69 6e 67 0a 72 65 63 75 72 73 69 76 65 20 70 72 | ick.for.formulating.recursive.pr |
| e3500 | 6f 63 65 64 75 72 65 73 20 77 69 74 68 6f 75 74 20 75 73 69 6e 67 20 60 64 65 66 69 6e 65 27 2e | ocedures.without.using.`define'. |
| e3520 | 20 20 54 68 65 20 6d 6f 73 74 20 67 65 6e 65 72 61 6c 20 74 72 69 63 6b 20 6f 66 0a 74 68 69 73 | ..The.most.general.trick.of.this |
| e3540 | 20 73 6f 72 74 20 69 73 20 74 68 65 20 59 20 22 6f 70 65 72 61 74 6f 72 22 2c 20 77 68 69 63 68 | .sort.is.the.Y."operator",.which |
| e3560 | 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 67 69 76 65 20 61 20 22 70 75 72 65 0a 5b 6c 61 | .can.be.used.to.give.a."pure.[la |
| e3580 | 6d 62 64 61 5d 2d 63 61 6c 63 75 6c 75 73 22 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f | mbda]-calculus".implementation.o |
| e35a0 | 66 20 72 65 63 75 72 73 69 6f 6e 2e 20 20 28 53 65 65 20 53 74 6f 79 20 31 39 37 37 20 66 6f 72 | f.recursion...(See.Stoy.1977.for |
| e35c0 | 0a 64 65 74 61 69 6c 73 20 6f 6e 20 74 68 65 20 5b 6c 61 6d 62 64 61 5d 20 63 61 6c 63 75 6c 75 | .details.on.the.[lambda].calculu |
| e35e0 | 73 2c 20 61 6e 64 20 47 61 62 72 69 65 6c 20 31 39 38 38 20 66 6f 72 20 61 6e 20 65 78 70 6f 73 | s,.and.Gabriel.1988.for.an.expos |
| e3600 | 69 74 69 6f 6e 20 6f 66 0a 74 68 65 20 59 20 6f 70 65 72 61 74 6f 72 20 69 6e 20 53 63 68 65 6d | ition.of.the.Y.operator.in.Schem |
| e3620 | 65 2e 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 | e.)....File:.sicp.info,..Node:.4 |
| e3640 | 2d 31 2d 37 2c 20 20 50 72 65 76 3a 20 34 2d 31 2d 36 2c 20 20 55 70 3a 20 34 2d 31 0a 0a 34 2e | -1-7,..Prev:.4-1-6,..Up:.4-1..4. |
| e3660 | 31 2e 37 20 53 65 70 61 72 61 74 69 6e 67 20 53 79 6e 74 61 63 74 69 63 20 41 6e 61 6c 79 73 69 | 1.7.Separating.Syntactic.Analysi |
| e3680 | 73 20 66 72 6f 6d 20 45 78 65 63 75 74 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | s.from.Execution.--------------- |
| e36a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| e36c0 | 2d 2d 2d 0a 0a 54 68 65 20 65 76 61 6c 75 61 74 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 | ---..The.evaluator.implemented.a |
| e36e0 | 62 6f 76 65 20 69 73 20 73 69 6d 70 6c 65 2c 20 62 75 74 20 69 74 20 69 73 20 76 65 72 79 20 69 | bove.is.simple,.but.it.is.very.i |
| e3700 | 6e 65 66 66 69 63 69 65 6e 74 2c 0a 62 65 63 61 75 73 65 20 74 68 65 20 73 79 6e 74 61 63 74 69 | nefficient,.because.the.syntacti |
| e3720 | 63 20 61 6e 61 6c 79 73 69 73 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 73 20 69 6e 74 | c.analysis.of.expressions.is.int |
| e3740 | 65 72 6c 65 61 76 65 64 20 77 69 74 68 20 74 68 65 69 72 0a 65 78 65 63 75 74 69 6f 6e 2e 20 20 | erleaved.with.their.execution... |
| e3760 | 54 68 75 73 20 69 66 20 61 20 70 72 6f 67 72 61 6d 20 69 73 20 65 78 65 63 75 74 65 64 20 6d 61 | Thus.if.a.program.is.executed.ma |
| e3780 | 6e 79 20 74 69 6d 65 73 2c 20 69 74 73 20 73 79 6e 74 61 78 20 69 73 0a 61 6e 61 6c 79 7a 65 64 | ny.times,.its.syntax.is.analyzed |
| e37a0 | 20 6d 61 6e 79 20 74 69 6d 65 73 2e 20 20 43 6f 6e 73 69 64 65 72 2c 20 66 6f 72 20 65 78 61 6d | .many.times...Consider,.for.exam |
| e37c0 | 70 6c 65 2c 20 65 76 61 6c 75 61 74 69 6e 67 20 60 28 66 61 63 74 6f 72 69 61 6c 20 34 29 27 0a | ple,.evaluating.`(factorial.4)'. |
| e37e0 | 75 73 69 6e 67 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f | using.the.following.definition.o |
| e3800 | 66 20 60 66 61 63 74 6f 72 69 61 6c 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 | f.`factorial':.......(define.(fa |
| e3820 | 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 | ctorial.n)........(if.(=.n.1)... |
| e3840 | 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 66 61 63 74 6f 72 | .........1............(*.(factor |
| e3860 | 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 29 29 0a 0a 20 20 20 45 61 63 68 20 74 69 6d 65 20 | ial.(-.n.1)).n))).....Each.time. |
| e3880 | 60 66 61 63 74 6f 72 69 61 6c 27 20 69 73 20 63 61 6c 6c 65 64 2c 20 74 68 65 20 65 76 61 6c 75 | `factorial'.is.called,.the.evalu |
| e38a0 | 61 74 6f 72 20 6d 75 73 74 20 64 65 74 65 72 6d 69 6e 65 20 74 68 61 74 0a 74 68 65 20 62 6f 64 | ator.must.determine.that.the.bod |
| e38c0 | 79 20 69 73 20 61 6e 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 20 61 6e 64 20 65 78 74 72 | y.is.an.`if'.expression.and.extr |
| e38e0 | 61 63 74 20 74 68 65 20 70 72 65 64 69 63 61 74 65 2e 20 20 4f 6e 6c 79 20 74 68 65 6e 0a 63 61 | act.the.predicate...Only.then.ca |
| e3900 | 6e 20 69 74 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 61 6e 64 20 | n.it.evaluate.the.predicate.and. |
| e3920 | 64 69 73 70 61 74 63 68 20 6f 6e 20 69 74 73 20 76 61 6c 75 65 2e 20 20 45 61 63 68 20 74 69 6d | dispatch.on.its.value...Each.tim |
| e3940 | 65 20 69 74 0a 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 | e.it.evaluates.the.expression.`( |
| e3960 | 2a 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 27 2c 20 6f 72 20 74 68 | *.(factorial.(-.n.1)).n)',.or.th |
| e3980 | 65 0a 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 20 60 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 | e.subexpressions.`(factorial.(-. |
| e39a0 | 6e 20 31 29 29 27 20 61 6e 64 20 60 28 2d 20 6e 20 31 29 27 2c 20 74 68 65 20 65 76 61 6c 75 61 | n.1))'.and.`(-.n.1)',.the.evalua |
| e39c0 | 74 6f 72 20 6d 75 73 74 0a 70 65 72 66 6f 72 6d 20 74 68 65 20 63 61 73 65 20 61 6e 61 6c 79 73 | tor.must.perform.the.case.analys |
| e39e0 | 69 73 20 69 6e 20 60 65 76 61 6c 27 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 61 74 20 74 | is.in.`eval'.to.determine.that.t |
| e3a00 | 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 0a 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c | he.expression.is.an.application, |
| e3a20 | 20 61 6e 64 20 6d 75 73 74 20 65 78 74 72 61 63 74 20 69 74 73 20 6f 70 65 72 61 74 6f 72 20 61 | .and.must.extract.its.operator.a |
| e3a40 | 6e 64 20 6f 70 65 72 61 6e 64 73 2e 20 20 54 68 69 73 0a 61 6e 61 6c 79 73 69 73 20 69 73 20 65 | nd.operands...This.analysis.is.e |
| e3a60 | 78 70 65 6e 73 69 76 65 2e 20 20 50 65 72 66 6f 72 6d 69 6e 67 20 69 74 20 72 65 70 65 61 74 65 | xpensive...Performing.it.repeate |
| e3a80 | 64 6c 79 20 69 73 20 77 61 73 74 65 66 75 6c 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 74 72 61 6e | dly.is.wasteful......We.can.tran |
| e3aa0 | 73 66 6f 72 6d 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 62 65 20 73 69 67 6e 69 66 | sform.the.evaluator.to.be.signif |
| e3ac0 | 69 63 61 6e 74 6c 79 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20 62 79 0a 61 72 72 61 6e 67 | icantly.more.efficient.by.arrang |
| e3ae0 | 69 6e 67 20 74 68 69 6e 67 73 20 73 6f 20 74 68 61 74 20 73 79 6e 74 61 63 74 69 63 20 61 6e 61 | ing.things.so.that.syntactic.ana |
| e3b00 | 6c 79 73 69 73 20 69 73 20 70 65 72 66 6f 72 6d 65 64 20 6f 6e 6c 79 20 6f 6e 63 65 2e 28 31 29 | lysis.is.performed.only.once.(1) |
| e3b20 | 0a 57 65 20 73 70 6c 69 74 20 60 65 76 61 6c 27 2c 20 77 68 69 63 68 20 74 61 6b 65 73 20 61 6e | .We.split.`eval',.which.takes.an |
| e3b40 | 20 65 78 70 72 65 73 73 69 6f 6e 20 61 6e 64 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 | .expression.and.an.environment,. |
| e3b60 | 69 6e 74 6f 20 74 77 6f 0a 70 61 72 74 73 2e 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 | into.two.parts...The.procedure.` |
| e3b80 | 61 6e 61 6c 79 7a 65 27 20 74 61 6b 65 73 20 6f 6e 6c 79 20 74 68 65 20 65 78 70 72 65 73 73 69 | analyze'.takes.only.the.expressi |
| e3ba0 | 6f 6e 2e 20 20 49 74 20 70 65 72 66 6f 72 6d 73 0a 74 68 65 20 73 79 6e 74 61 63 74 69 63 20 61 | on...It.performs.the.syntactic.a |
| e3bc0 | 6e 61 6c 79 73 69 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 20 6e 65 77 20 70 72 6f 63 65 64 | nalysis.and.returns.a.new.proced |
| e3be0 | 75 72 65 2c 20 74 68 65 20 22 65 78 65 63 75 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 22 2c 20 | ure,.the."execution.procedure",. |
| e3c00 | 74 68 61 74 20 65 6e 63 61 70 73 75 6c 61 74 65 73 20 74 68 65 20 77 6f 72 6b 20 74 6f 20 62 65 | that.encapsulates.the.work.to.be |
| e3c20 | 20 64 6f 6e 65 20 69 6e 20 65 78 65 63 75 74 69 6e 67 20 74 68 65 0a 61 6e 61 6c 79 7a 65 64 20 | .done.in.executing.the.analyzed. |
| e3c40 | 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 54 68 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 | expression...The.execution.proce |
| e3c60 | 64 75 72 65 20 74 61 6b 65 73 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 73 0a 69 74 73 | dure.takes.an.environment.as.its |
| e3c80 | 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 63 6f 6d 70 6c 65 74 65 73 20 74 68 65 20 65 76 61 6c | .argument.and.completes.the.eval |
| e3ca0 | 75 61 74 69 6f 6e 2e 20 20 54 68 69 73 20 73 61 76 65 73 20 77 6f 72 6b 20 62 65 63 61 75 73 65 | uation...This.saves.work.because |
| e3cc0 | 0a 60 61 6e 61 6c 79 7a 65 27 20 77 69 6c 6c 20 62 65 20 63 61 6c 6c 65 64 20 6f 6e 6c 79 20 6f | .`analyze'.will.be.called.only.o |
| e3ce0 | 6e 63 65 20 6f 6e 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 77 68 69 6c 65 20 74 68 65 0a | nce.on.an.expression,.while.the. |
| e3d00 | 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 6d 61 79 20 62 65 20 63 61 6c 6c 65 | execution.procedure.may.be.calle |
| e3d20 | 64 20 6d 61 6e 79 20 74 69 6d 65 73 2e 0a 0a 20 20 20 57 69 74 68 20 74 68 65 20 73 65 70 61 72 | d.many.times......With.the.separ |
| e3d40 | 61 74 69 6f 6e 20 69 6e 74 6f 20 61 6e 61 6c 79 73 69 73 20 61 6e 64 20 65 78 65 63 75 74 69 6f | ation.into.analysis.and.executio |
| e3d60 | 6e 2c 20 60 65 76 61 6c 27 20 6e 6f 77 20 62 65 63 6f 6d 65 73 0a 0a 20 20 20 20 20 28 64 65 66 | n,.`eval'.now.becomes.......(def |
| e3d80 | 69 6e 65 20 28 65 76 61 6c 20 65 78 70 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 28 61 6e 61 6c | ine.(eval.exp.env)........((anal |
| e3da0 | 79 7a 65 20 65 78 70 29 20 65 6e 76 29 29 0a 0a 20 20 20 54 68 65 20 72 65 73 75 6c 74 20 6f 66 | yze.exp).env)).....The.result.of |
| e3dc0 | 20 63 61 6c 6c 69 6e 67 20 60 61 6e 61 6c 79 7a 65 27 20 69 73 20 74 68 65 20 65 78 65 63 75 74 | .calling.`analyze'.is.the.execut |
| e3de0 | 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 62 65 0a 61 70 70 6c 69 65 64 20 74 6f 20 74 | ion.procedure.to.be.applied.to.t |
| e3e00 | 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 54 68 65 20 60 61 6e 61 6c 79 7a 65 27 20 70 | he.environment...The.`analyze'.p |
| e3e20 | 72 6f 63 65 64 75 72 65 20 69 73 20 74 68 65 20 73 61 6d 65 20 63 61 73 65 0a 61 6e 61 6c 79 73 | rocedure.is.the.same.case.analys |
| e3e40 | 69 73 20 61 73 20 70 65 72 66 6f 72 6d 65 64 20 62 79 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 | is.as.performed.by.the.original. |
| e3e60 | 60 65 76 61 6c 27 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 2c | `eval'.of.section.*Note.4-1-1::, |
| e3e80 | 0a 65 78 63 65 70 74 20 74 68 61 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 77 | .except.that.the.procedures.to.w |
| e3ea0 | 68 69 63 68 20 77 65 20 64 69 73 70 61 74 63 68 20 70 65 72 66 6f 72 6d 20 6f 6e 6c 79 20 61 6e | hich.we.dispatch.perform.only.an |
| e3ec0 | 61 6c 79 73 69 73 2c 0a 6e 6f 74 20 66 75 6c 6c 20 65 76 61 6c 75 61 74 69 6f 6e 3a 0a 0a 20 20 | alysis,.not.full.evaluation:.... |
| e3ee0 | 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 20 65 78 70 29 0a 20 20 20 20 20 20 20 | ...(define.(analyze.exp)........ |
| e3f00 | 28 63 6f 6e 64 20 28 28 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 3f 20 65 78 70 29 0a 20 20 | (cond.((self-evaluating?.exp)... |
| e3f20 | 20 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 61 6c 79 7a 65 2d 73 65 6c 66 2d 65 76 61 6c 75 61 | ............(analyze-self-evalua |
| e3f40 | 74 69 6e 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 71 75 6f 74 65 64 | ting.exp))..............((quoted |
| e3f60 | 3f 20 65 78 70 29 20 28 61 6e 61 6c 79 7a 65 2d 71 75 6f 74 65 64 20 65 78 70 29 29 0a 20 20 20 | ?.exp).(analyze-quoted.exp)).... |
| e3f80 | 20 20 20 20 20 20 20 20 20 20 28 28 76 61 72 69 61 62 6c 65 3f 20 65 78 70 29 20 28 61 6e 61 6c | ..........((variable?.exp).(anal |
| e3fa0 | 79 7a 65 2d 76 61 72 69 61 62 6c 65 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | yze-variable.exp)).............. |
| e3fc0 | 28 28 61 73 73 69 67 6e 6d 65 6e 74 3f 20 65 78 70 29 20 28 61 6e 61 6c 79 7a 65 2d 61 73 73 69 | ((assignment?.exp).(analyze-assi |
| e3fe0 | 67 6e 6d 65 6e 74 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 64 65 66 69 | gnment.exp))..............((defi |
| e4000 | 6e 69 74 69 6f 6e 3f 20 65 78 70 29 20 28 61 6e 61 6c 79 7a 65 2d 64 65 66 69 6e 69 74 69 6f 6e | nition?.exp).(analyze-definition |
| e4020 | 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 69 66 3f 20 65 78 70 29 20 28 | .exp))..............((if?.exp).( |
| e4040 | 61 6e 61 6c 79 7a 65 2d 69 66 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | analyze-if.exp))..............(( |
| e4060 | 6c 61 6d 62 64 61 3f 20 65 78 70 29 20 28 61 6e 61 6c 79 7a 65 2d 6c 61 6d 62 64 61 20 65 78 70 | lambda?.exp).(analyze-lambda.exp |
| e4080 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 62 65 67 69 6e 3f 20 65 78 70 29 20 28 61 | ))..............((begin?.exp).(a |
| e40a0 | 6e 61 6c 79 7a 65 2d 73 65 71 75 65 6e 63 65 20 28 62 65 67 69 6e 2d 61 63 74 69 6f 6e 73 20 65 | nalyze-sequence.(begin-actions.e |
| e40c0 | 78 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 63 6f 6e 64 3f 20 65 78 70 29 20 | xp)))..............((cond?.exp). |
| e40e0 | 28 61 6e 61 6c 79 7a 65 20 28 63 6f 6e 64 2d 3e 69 66 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 | (analyze.(cond->if.exp)))....... |
| e4100 | 20 20 20 20 20 20 20 28 28 61 70 70 6c 69 63 61 74 69 6f 6e 3f 20 65 78 70 29 20 28 61 6e 61 6c | .......((application?.exp).(anal |
| e4120 | 79 7a 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 | yze-application.exp))........... |
| e4140 | 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 | ...(else...............(error."U |
| e4160 | 6e 6b 6e 6f 77 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 74 79 70 65 20 2d 2d 20 41 4e 41 4c 59 5a | nknown.expression.type.--.ANALYZ |
| e4180 | 45 22 20 65 78 70 29 29 29 29 0a 0a 20 20 20 48 65 72 65 20 69 73 20 74 68 65 20 73 69 6d 70 6c | E".exp)))).....Here.is.the.simpl |
| e41a0 | 65 73 74 20 73 79 6e 74 61 63 74 69 63 20 61 6e 61 6c 79 73 69 73 20 70 72 6f 63 65 64 75 72 65 | est.syntactic.analysis.procedure |
| e41c0 | 2c 20 77 68 69 63 68 20 68 61 6e 64 6c 65 73 0a 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 20 | ,.which.handles.self-evaluating. |
| e41e0 | 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 49 74 20 72 65 74 75 72 6e 73 20 61 6e 20 65 78 65 63 | expressions...It.returns.an.exec |
| e4200 | 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 69 67 6e 6f 72 65 73 20 69 74 73 | ution.procedure.that.ignores.its |
| e4220 | 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 6a 75 73 74 20 72 | .environment.argument.and.just.r |
| e4240 | 65 74 75 72 6e 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 3a 0a 0a 20 20 20 20 20 28 64 65 | eturns.the.expression:.......(de |
| e4260 | 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 20 65 78 | fine.(analyze-self-evaluating.ex |
| e4280 | 70 29 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 29 20 65 78 70 29 29 0a 0a 20 | p)........(lambda.(env).exp))... |
| e42a0 | 20 20 46 6f 72 20 61 20 71 75 6f 74 65 64 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 77 65 20 63 61 | ..For.a.quoted.expression,.we.ca |
| e42c0 | 6e 20 67 61 69 6e 20 61 20 6c 69 74 74 6c 65 20 65 66 66 69 63 69 65 6e 63 79 20 62 79 0a 65 78 | n.gain.a.little.efficiency.by.ex |
| e42e0 | 74 72 61 63 74 69 6e 67 20 74 68 65 20 74 65 78 74 20 6f 66 20 74 68 65 20 71 75 6f 74 61 74 69 | tracting.the.text.of.the.quotati |
| e4300 | 6f 6e 20 6f 6e 6c 79 20 6f 6e 63 65 2c 20 69 6e 20 74 68 65 20 61 6e 61 6c 79 73 69 73 20 70 68 | on.only.once,.in.the.analysis.ph |
| e4320 | 61 73 65 2c 0a 72 61 74 68 65 72 20 74 68 61 6e 20 69 6e 20 74 68 65 20 65 78 65 63 75 74 69 6f | ase,.rather.than.in.the.executio |
| e4340 | 6e 20 70 68 61 73 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d | n.phase........(define.(analyze- |
| e4360 | 71 75 6f 74 65 64 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 71 76 61 6c 20 28 | quoted.exp)........(let.((qval.( |
| e4380 | 74 65 78 74 2d 6f 66 2d 71 75 6f 74 61 74 69 6f 6e 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 20 | text-of-quotation.exp)))........ |
| e43a0 | 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 29 20 71 76 61 6c 29 29 29 0a 0a 20 20 20 4c 6f 6f 6b | ..(lambda.(env).qval))).....Look |
| e43c0 | 69 6e 67 20 75 70 20 61 20 76 61 72 69 61 62 6c 65 20 76 61 6c 75 65 20 6d 75 73 74 20 73 74 69 | ing.up.a.variable.value.must.sti |
| e43e0 | 6c 6c 20 62 65 20 64 6f 6e 65 20 69 6e 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 0a 70 68 61 73 | ll.be.done.in.the.execution.phas |
| e4400 | 65 2c 20 73 69 6e 63 65 20 74 68 69 73 20 64 65 70 65 6e 64 73 20 75 70 6f 6e 20 6b 6e 6f 77 69 | e,.since.this.depends.upon.knowi |
| e4420 | 6e 67 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 28 32 29 0a 0a 20 20 20 20 20 28 64 65 | ng.the.environment.(2).......(de |
| e4440 | 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 76 61 72 69 61 62 6c 65 20 65 78 70 29 0a 20 20 20 20 | fine.(analyze-variable.exp)..... |
| e4460 | 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 29 20 28 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c | ...(lambda.(env).(lookup-variabl |
| e4480 | 65 2d 76 61 6c 75 65 20 65 78 70 20 65 6e 76 29 29 29 0a 0a 20 20 20 60 41 6e 61 6c 79 7a 65 2d | e-value.exp.env))).....`Analyze- |
| e44a0 | 61 73 73 69 67 6e 6d 65 6e 74 27 20 61 6c 73 6f 20 6d 75 73 74 20 64 65 66 65 72 20 61 63 74 75 | assignment'.also.must.defer.actu |
| e44c0 | 61 6c 6c 79 20 73 65 74 74 69 6e 67 20 74 68 65 20 76 61 72 69 61 62 6c 65 0a 75 6e 74 69 6c 20 | ally.setting.the.variable.until. |
| e44e0 | 74 68 65 20 65 78 65 63 75 74 69 6f 6e 2c 20 77 68 65 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d | the.execution,.when.the.environm |
| e4500 | 65 6e 74 20 68 61 73 20 62 65 65 6e 20 73 75 70 70 6c 69 65 64 2e 20 20 48 6f 77 65 76 65 72 2c | ent.has.been.supplied...However, |
| e4520 | 0a 74 68 65 20 66 61 63 74 20 74 68 61 74 20 74 68 65 20 60 61 73 73 69 67 6e 6d 65 6e 74 2d 76 | .the.fact.that.the.`assignment-v |
| e4540 | 61 6c 75 65 27 20 65 78 70 72 65 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 61 6e 61 6c 79 7a 65 64 | alue'.expression.can.be.analyzed |
| e4560 | 0a 28 72 65 63 75 72 73 69 76 65 6c 79 29 20 64 75 72 69 6e 67 20 61 6e 61 6c 79 73 69 73 20 69 | .(recursively).during.analysis.i |
| e4580 | 73 20 61 20 6d 61 6a 6f 72 20 67 61 69 6e 20 69 6e 20 65 66 66 69 63 69 65 6e 63 79 2c 20 62 65 | s.a.major.gain.in.efficiency,.be |
| e45a0 | 63 61 75 73 65 0a 74 68 65 20 60 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 6c 75 65 27 20 65 78 70 | cause.the.`assignment-value'.exp |
| e45c0 | 72 65 73 73 69 6f 6e 20 77 69 6c 6c 20 6e 6f 77 20 62 65 20 61 6e 61 6c 79 7a 65 64 20 6f 6e 6c | ression.will.now.be.analyzed.onl |
| e45e0 | 79 20 6f 6e 63 65 2e 20 20 54 68 65 0a 73 61 6d 65 20 68 6f 6c 64 73 20 74 72 75 65 20 66 6f 72 | y.once...The.same.holds.true.for |
| e4600 | 20 64 65 66 69 6e 69 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 | .definitions........(define.(ana |
| e4620 | 6c 79 7a 65 2d 61 73 73 69 67 6e 6d 65 6e 74 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 6c 65 74 | lyze-assignment.exp)........(let |
| e4640 | 20 28 28 76 61 72 20 28 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 72 69 61 62 6c 65 20 65 78 70 29 | .((var.(assignment-variable.exp) |
| e4660 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 76 70 72 6f 63 20 28 61 6e 61 6c 79 7a 65 20 28 | )..............(vproc.(analyze.( |
| e4680 | 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 6c 75 65 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 | assignment-value.exp))))........ |
| e46a0 | 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d | ..(lambda.(env)............(set- |
| e46c0 | 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 21 20 76 61 72 20 28 76 70 72 6f 63 20 65 6e 76 29 20 | variable-value!.var.(vproc.env). |
| e46e0 | 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 6f 6b 29 29 29 0a 0a 20 20 20 20 20 28 64 65 | env)............'ok))).......(de |
| e4700 | 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 64 65 66 69 6e 69 74 69 6f 6e 20 65 78 70 29 0a 20 20 | fine.(analyze-definition.exp)... |
| e4720 | 20 20 20 20 20 28 6c 65 74 20 28 28 76 61 72 20 28 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 72 69 | .....(let.((var.(definition-vari |
| e4740 | 61 62 6c 65 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 76 70 72 6f 63 20 28 | able.exp))..............(vproc.( |
| e4760 | 61 6e 61 6c 79 7a 65 20 28 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 6c 75 65 20 65 78 70 29 29 29 | analyze.(definition-value.exp))) |
| e4780 | 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 29 0a 20 20 20 20 20 20 20 | )..........(lambda.(env)........ |
| e47a0 | 20 20 20 20 28 64 65 66 69 6e 65 2d 76 61 72 69 61 62 6c 65 21 20 76 61 72 20 28 76 70 72 6f 63 | ....(define-variable!.var.(vproc |
| e47c0 | 20 65 6e 76 29 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 6f 6b 29 29 29 0a 0a 20 20 | .env).env)............'ok))).... |
| e47e0 | 20 46 6f 72 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 77 65 20 65 78 74 72 61 63 | .For.`if'.expressions,.we.extrac |
| e4800 | 74 20 61 6e 64 20 61 6e 61 6c 79 7a 65 20 74 68 65 20 70 72 65 64 69 63 61 74 65 2c 0a 63 6f 6e | t.and.analyze.the.predicate,.con |
| e4820 | 73 65 71 75 65 6e 74 2c 20 61 6e 64 20 61 6c 74 65 72 6e 61 74 69 76 65 20 61 74 20 61 6e 61 6c | sequent,.and.alternative.at.anal |
| e4840 | 79 73 69 73 20 74 69 6d 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a | ysis.time........(define.(analyz |
| e4860 | 65 2d 69 66 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 70 72 6f 63 20 28 61 | e-if.exp)........(let.((pproc.(a |
| e4880 | 6e 61 6c 79 7a 65 20 28 69 66 2d 70 72 65 64 69 63 61 74 65 20 65 78 70 29 29 29 0a 20 20 20 20 | nalyze.(if-predicate.exp)))..... |
| e48a0 | 20 20 20 20 20 20 20 20 20 28 63 70 72 6f 63 20 28 61 6e 61 6c 79 7a 65 20 28 69 66 2d 63 6f 6e | .........(cproc.(analyze.(if-con |
| e48c0 | 73 65 71 75 65 6e 74 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 72 | sequent.exp)))..............(apr |
| e48e0 | 6f 63 20 28 61 6e 61 6c 79 7a 65 20 28 69 66 2d 61 6c 74 65 72 6e 61 74 69 76 65 20 65 78 70 29 | oc.(analyze.(if-alternative.exp) |
| e4900 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 29 0a 20 20 20 20 20 | )))..........(lambda.(env)...... |
| e4920 | 20 20 20 20 20 20 28 69 66 20 28 74 72 75 65 3f 20 28 70 70 72 6f 63 20 65 6e 76 29 29 0a 20 20 | ......(if.(true?.(pproc.env))... |
| e4940 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 70 72 6f 63 20 65 6e 76 29 0a 20 20 20 20 20 20 20 | .............(cproc.env)........ |
| e4960 | 20 20 20 20 20 20 20 20 28 61 70 72 6f 63 20 65 6e 76 29 29 29 29 29 0a 0a 20 20 20 41 6e 61 6c | ........(aproc.env))))).....Anal |
| e4980 | 79 7a 69 6e 67 20 61 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 61 6c 73 6f | yzing.a.`lambda'.expression.also |
| e49a0 | 20 61 63 68 69 65 76 65 73 20 61 20 6d 61 6a 6f 72 20 67 61 69 6e 20 69 6e 0a 65 66 66 69 63 69 | .achieves.a.major.gain.in.effici |
| e49c0 | 65 6e 63 79 3a 20 57 65 20 61 6e 61 6c 79 7a 65 20 74 68 65 20 60 6c 61 6d 62 64 61 27 20 62 6f | ency:.We.analyze.the.`lambda'.bo |
| e49e0 | 64 79 20 6f 6e 6c 79 20 6f 6e 63 65 2c 20 65 76 65 6e 20 74 68 6f 75 67 68 0a 70 72 6f 63 65 64 | dy.only.once,.even.though.proced |
| e4a00 | 75 72 65 73 20 72 65 73 75 6c 74 69 6e 67 20 66 72 6f 6d 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f | ures.resulting.from.evaluation.o |
| e4a20 | 66 20 74 68 65 20 60 6c 61 6d 62 64 61 27 20 6d 61 79 20 62 65 20 61 70 70 6c 69 65 64 0a 6d 61 | f.the.`lambda'.may.be.applied.ma |
| e4a40 | 6e 79 20 74 69 6d 65 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 | ny.times........(define.(analyze |
| e4a60 | 2d 6c 61 6d 62 64 61 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 76 61 72 73 20 | -lambda.exp)........(let.((vars. |
| e4a80 | 28 6c 61 6d 62 64 61 2d 70 61 72 61 6d 65 74 65 72 73 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 | (lambda-parameters.exp))........ |
| e4aa0 | 20 20 20 20 20 20 28 62 70 72 6f 63 20 28 61 6e 61 6c 79 7a 65 2d 73 65 71 75 65 6e 63 65 20 28 | ......(bproc.(analyze-sequence.( |
| e4ac0 | 6c 61 6d 62 64 61 2d 62 6f 64 79 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 | lambda-body.exp))))..........(la |
| e4ae0 | 6d 62 64 61 20 28 65 6e 76 29 20 28 6d 61 6b 65 2d 70 72 6f 63 65 64 75 72 65 20 76 61 72 73 20 | mbda.(env).(make-procedure.vars. |
| e4b00 | 62 70 72 6f 63 20 65 6e 76 29 29 29 29 0a 0a 20 20 20 41 6e 61 6c 79 73 69 73 20 6f 66 20 61 20 | bproc.env)))).....Analysis.of.a. |
| e4b20 | 73 65 71 75 65 6e 63 65 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 20 28 61 73 20 69 6e 20 61 | sequence.of.expressions.(as.in.a |
| e4b40 | 20 60 62 65 67 69 6e 27 20 6f 72 20 74 68 65 20 62 6f 64 79 0a 6f 66 20 61 20 60 6c 61 6d 62 64 | .`begin'.or.the.body.of.a.`lambd |
| e4b60 | 61 27 20 65 78 70 72 65 73 73 69 6f 6e 29 20 69 73 20 6d 6f 72 65 20 69 6e 76 6f 6c 76 65 64 2e | a'.expression).is.more.involved. |
| e4b80 | 28 33 29 20 45 61 63 68 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 0a 73 65 71 75 65 | (3).Each.expression.in.the.seque |
| e4ba0 | 6e 63 65 20 69 73 20 61 6e 61 6c 79 7a 65 64 2c 20 79 69 65 6c 64 69 6e 67 20 61 6e 20 65 78 65 | nce.is.analyzed,.yielding.an.exe |
| e4bc0 | 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 65 73 65 20 65 78 65 63 75 74 69 | cution.procedure...These.executi |
| e4be0 | 6f 6e 0a 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 63 6f 6d 62 69 6e 65 64 20 74 6f 20 70 72 | on.procedures.are.combined.to.pr |
| e4c00 | 6f 64 75 63 65 20 61 6e 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 | oduce.an.execution.procedure.tha |
| e4c20 | 74 20 74 61 6b 65 73 20 61 6e 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 73 20 61 72 67 75 6d 65 | t.takes.an.environment.as.argume |
| e4c40 | 6e 74 20 61 6e 64 20 73 65 71 75 65 6e 74 69 61 6c 6c 79 20 63 61 6c 6c 73 20 65 61 63 68 20 69 | nt.and.sequentially.calls.each.i |
| e4c60 | 6e 64 69 76 69 64 75 61 6c 20 65 78 65 63 75 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 20 77 69 | ndividual.execution.procedure.wi |
| e4c80 | 74 68 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 73 20 61 72 67 75 6d 65 6e 74 2e 0a | th.the.environment.as.argument.. |
| e4ca0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 73 65 71 75 65 6e 63 65 20 | ......(define.(analyze-sequence. |
| e4cc0 | 65 78 70 73 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 71 75 65 6e 74 69 61 6c | exps)........(define.(sequential |
| e4ce0 | 6c 79 20 70 72 6f 63 31 20 70 72 6f 63 32 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 | ly.proc1.proc2)..........(lambda |
| e4d00 | 20 28 65 6e 76 29 20 28 70 72 6f 63 31 20 65 6e 76 29 20 28 70 72 6f 63 32 20 65 6e 76 29 29 29 | .(env).(proc1.env).(proc2.env))) |
| e4d20 | 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 70 20 66 69 72 73 74 2d 70 72 6f 63 | ........(define.(loop.first-proc |
| e4d40 | 20 72 65 73 74 2d 70 72 6f 63 73 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f | .rest-procs)..........(if.(null? |
| e4d60 | 20 72 65 73 74 2d 70 72 6f 63 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 66 69 72 73 74 2d | .rest-procs)..............first- |
| e4d80 | 70 72 6f 63 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 73 65 71 75 65 6e 74 | proc..............(loop.(sequent |
| e4da0 | 69 61 6c 6c 79 20 66 69 72 73 74 2d 70 72 6f 63 20 28 63 61 72 20 72 65 73 74 2d 70 72 6f 63 73 | ially.first-proc.(car.rest-procs |
| e4dc0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 72 65 73 74 2d | ))....................(cdr.rest- |
| e4de0 | 70 72 6f 63 73 29 29 29 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 6f 63 73 20 28 6d | procs))))........(let.((procs.(m |
| e4e00 | 61 70 20 61 6e 61 6c 79 7a 65 20 65 78 70 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 | ap.analyze.exps)))..........(if. |
| e4e20 | 28 6e 75 6c 6c 3f 20 70 72 6f 63 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f | (null?.procs)..............(erro |
| e4e40 | 72 20 22 45 6d 70 74 79 20 73 65 71 75 65 6e 63 65 20 2d 2d 20 41 4e 41 4c 59 5a 45 22 29 29 0a | r."Empty.sequence.--.ANALYZE")). |
| e4e60 | 20 20 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 70 72 6f 63 73 29 20 28 63 64 72 20 | .........(loop.(car.procs).(cdr. |
| e4e80 | 70 72 6f 63 73 29 29 29 29 0a 0a 20 20 20 54 6f 20 61 6e 61 6c 79 7a 65 20 61 6e 20 61 70 70 6c | procs)))).....To.analyze.an.appl |
| e4ea0 | 69 63 61 74 69 6f 6e 2c 20 77 65 20 61 6e 61 6c 79 7a 65 20 74 68 65 20 6f 70 65 72 61 74 6f 72 | ication,.we.analyze.the.operator |
| e4ec0 | 20 61 6e 64 20 6f 70 65 72 61 6e 64 73 20 61 6e 64 0a 63 6f 6e 73 74 72 75 63 74 20 61 6e 20 65 | .and.operands.and.construct.an.e |
| e4ee0 | 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 61 6c 6c 73 20 74 68 | xecution.procedure.that.calls.th |
| e4f00 | 65 20 6f 70 65 72 61 74 6f 72 20 65 78 65 63 75 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 20 28 | e.operator.execution.procedure.( |
| e4f20 | 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 61 63 74 75 61 6c 20 70 72 6f 63 65 64 75 72 65 20 74 | to.obtain.the.actual.procedure.t |
| e4f40 | 6f 20 62 65 20 61 70 70 6c 69 65 64 29 20 61 6e 64 20 74 68 65 0a 6f 70 65 72 61 6e 64 20 65 78 | o.be.applied).and.the.operand.ex |
| e4f60 | 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 28 74 6f 20 6f 62 74 61 69 6e 20 74 68 | ecution.procedures.(to.obtain.th |
| e4f80 | 65 20 61 63 74 75 61 6c 20 61 72 67 75 6d 65 6e 74 73 29 2e 20 20 57 65 20 74 68 65 6e 0a 70 61 | e.actual.arguments)...We.then.pa |
| e4fa0 | 73 73 20 74 68 65 73 65 20 74 6f 20 60 65 78 65 63 75 74 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e | ss.these.to.`execute-application |
| e4fc0 | 27 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 61 6e 61 6c 6f 67 20 6f 66 20 60 61 70 70 6c 79 | ',.which.is.the.analog.of.`apply |
| e4fe0 | 27 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 2e 20 20 60 45 78 | '.in.section.*Note.4-1-1::...`Ex |
| e5000 | 65 63 75 74 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 27 20 64 69 66 66 65 72 73 20 66 72 6f 6d 20 | ecute-application'.differs.from. |
| e5020 | 60 61 70 70 6c 79 27 20 69 6e 0a 74 68 61 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 62 6f | `apply'.in.that.the.procedure.bo |
| e5040 | 64 79 20 66 6f 72 20 61 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 20 68 61 73 20 | dy.for.a.compound.procedure.has. |
| e5060 | 61 6c 72 65 61 64 79 20 62 65 65 6e 0a 61 6e 61 6c 79 7a 65 64 2c 20 73 6f 20 74 68 65 72 65 20 | already.been.analyzed,.so.there. |
| e5080 | 69 73 20 6e 6f 20 6e 65 65 64 20 74 6f 20 64 6f 20 66 75 72 74 68 65 72 20 61 6e 61 6c 79 73 69 | is.no.need.to.do.further.analysi |
| e50a0 | 73 2e 20 20 49 6e 73 74 65 61 64 2c 20 77 65 20 6a 75 73 74 0a 63 61 6c 6c 20 74 68 65 20 65 78 | s...Instead,.we.just.call.the.ex |
| e50c0 | 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 74 68 65 20 62 6f 64 79 20 6f | ecution.procedure.for.the.body.o |
| e50e0 | 6e 20 74 68 65 20 65 78 74 65 6e 64 65 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 20 20 20 | n.the.extended.environment...... |
| e5100 | 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 20 65 | ..(define.(analyze-application.e |
| e5120 | 78 70 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 66 70 72 6f 63 20 28 61 6e 61 6c 79 7a 65 | xp)........(let.((fproc.(analyze |
| e5140 | 20 28 6f 70 65 72 61 74 6f 72 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .(operator.exp)))..............( |
| e5160 | 61 70 72 6f 63 73 20 28 6d 61 70 20 61 6e 61 6c 79 7a 65 20 28 6f 70 65 72 61 6e 64 73 20 65 78 | aprocs.(map.analyze.(operands.ex |
| e5180 | 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 29 0a 20 20 20 | p))))..........(lambda.(env).... |
| e51a0 | 20 20 20 20 20 20 20 20 28 65 78 65 63 75 74 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 20 28 66 70 | ........(execute-application.(fp |
| e51c0 | 72 6f 63 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | roc.env)........................ |
| e51e0 | 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 61 70 72 6f 63 29 20 28 61 | .........(map.(lambda.(aproc).(a |
| e5200 | 70 72 6f 63 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | proc.env))...................... |
| e5220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 70 72 6f 63 73 29 29 29 29 29 0a 0a 20 20 20 | ................aprocs)))))..... |
| e5240 | 20 20 28 64 65 66 69 6e 65 20 28 65 78 65 63 75 74 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 20 70 | ..(define.(execute-application.p |
| e5260 | 72 6f 63 20 61 72 67 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 70 72 69 6d 69 74 69 | roc.args)........(cond.((primiti |
| e5280 | 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ve-procedure?.proc)............. |
| e52a0 | 20 20 28 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 20 70 72 6f | ..(apply-primitive-procedure.pro |
| e52c0 | 63 20 61 72 67 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 63 6f 6d 70 6f 75 6e 64 | c.args))..............((compound |
| e52e0 | 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -procedure?.proc)............... |
| e5300 | 28 28 70 72 6f 63 65 64 75 72 65 2d 62 6f 64 79 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 | ((procedure-body.proc).......... |
| e5320 | 20 20 20 20 20 20 28 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 28 70 72 6f 63 65 | ......(extend-environment.(proce |
| e5340 | 64 75 72 65 2d 70 61 72 61 6d 65 74 65 72 73 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 | dure-parameters.proc)........... |
| e5360 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 72 67 73 0a 20 20 | .........................args... |
| e5380 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| e53a0 | 20 28 70 72 6f 63 65 64 75 72 65 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 70 72 6f 63 29 29 29 29 | .(procedure-environment.proc)))) |
| e53c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..............(else............. |
| e53e0 | 20 20 28 65 72 72 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 55 6e 6b 6e 6f 77 6e | ..(error................"Unknown |
| e5400 | 20 70 72 6f 63 65 64 75 72 65 20 74 79 70 65 20 2d 2d 20 45 58 45 43 55 54 45 2d 41 50 50 4c 49 | .procedure.type.--.EXECUTE-APPLI |
| e5420 | 43 41 54 49 4f 4e 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 29 29 29 29 0a | CATION"................proc)))). |
| e5440 | 0a 20 20 20 4f 75 72 20 6e 65 77 20 65 76 61 6c 75 61 74 6f 72 20 75 73 65 73 20 74 68 65 20 73 | ....Our.new.evaluator.uses.the.s |
| e5460 | 61 6d 65 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 2c 20 73 79 6e 74 61 78 20 70 72 6f 63 | ame.data.structures,.syntax.proc |
| e5480 | 65 64 75 72 65 73 2c 0a 61 6e 64 20 72 75 6e 2d 74 69 6d 65 20 73 75 70 70 6f 72 74 20 70 72 6f | edures,.and.run-time.support.pro |
| e54a0 | 63 65 64 75 72 65 73 20 61 73 20 69 6e 20 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 20 34 2d 31 | cedures.as.in.sections.*Note.4-1 |
| e54c0 | 2d 32 3a 3a 2c 20 2a 4e 6f 74 65 0a 34 2d 31 2d 33 3a 3a 2c 20 61 6e 64 20 2a 4e 6f 74 65 20 34 | -2::,.*Note.4-1-3::,.and.*Note.4 |
| e54e0 | 2d 31 2d 34 3a 3a 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 32 32 3a 2a 20 45 | -1-4::........*Exercise.4.22:*.E |
| e5500 | 78 74 65 6e 64 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 74 68 69 73 20 73 65 63 74 | xtend.the.evaluator.in.this.sect |
| e5520 | 69 6f 6e 20 74 6f 20 73 75 70 70 6f 72 74 0a 20 20 20 20 20 74 68 65 20 73 70 65 63 69 61 6c 20 | ion.to.support......the.special. |
| e5540 | 66 6f 72 6d 20 60 6c 65 74 27 2e 20 20 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | form.`let'...(See.*Note.Exercise |
| e5560 | 20 34 2d 36 3a 3a 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 32 33 3a 2a 20 | .4-6::.).......*Exercise.4.23:*. |
| e5580 | 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 20 64 6f 65 73 6e 27 74 20 75 6e 64 65 72 73 74 | Alyssa.P..Hacker.doesn't.underst |
| e55a0 | 61 6e 64 20 77 68 79 0a 20 20 20 20 20 60 61 6e 61 6c 79 7a 65 2d 73 65 71 75 65 6e 63 65 27 20 | and.why......`analyze-sequence'. |
| e55c0 | 6e 65 65 64 73 20 74 6f 20 62 65 20 73 6f 20 63 6f 6d 70 6c 69 63 61 74 65 64 2e 20 20 41 6c 6c | needs.to.be.so.complicated...All |
| e55e0 | 20 74 68 65 20 6f 74 68 65 72 0a 20 20 20 20 20 61 6e 61 6c 79 73 69 73 20 70 72 6f 63 65 64 75 | .the.other......analysis.procedu |
| e5600 | 72 65 73 20 61 72 65 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 74 72 61 6e 73 66 6f 72 | res.are.straightforward.transfor |
| e5620 | 6d 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 0a 20 20 20 20 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e | mations.of.the......correspondin |
| e5640 | 67 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 28 6f 72 20 60 65 76 61 | g.evaluation.procedures.(or.`eva |
| e5660 | 6c 27 20 63 6c 61 75 73 65 73 29 20 69 6e 20 73 65 63 74 69 6f 6e 0a 20 20 20 20 20 2a 4e 6f 74 | l'.clauses).in.section......*Not |
| e5680 | 65 20 34 2d 31 2d 31 3a 3a 2e 20 20 53 68 65 20 65 78 70 65 63 74 65 64 20 60 61 6e 61 6c 79 7a | e.4-1-1::...She.expected.`analyz |
| e56a0 | 65 2d 73 65 71 75 65 6e 63 65 27 20 74 6f 20 6c 6f 6f 6b 20 6c 69 6b 65 20 74 68 69 73 3a 0a 0a | e-sequence'.to.look.like.this:.. |
| e56c0 | 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 73 65 71 75 65 | ..........(define.(analyze-seque |
| e56e0 | 6e 63 65 20 65 78 70 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 | nce.exps).............(define.(e |
| e5700 | 78 65 63 75 74 65 2d 73 65 71 75 65 6e 63 65 20 70 72 6f 63 73 20 65 6e 76 29 0a 20 20 20 20 20 | xecute-sequence.procs.env)...... |
| e5720 | 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 28 63 64 72 20 70 72 6f 63 | .........(cond.((null?.(cdr.proc |
| e5740 | 73 29 29 20 28 28 63 61 72 20 70 72 6f 63 73 29 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 | s)).((car.procs).env)).......... |
| e5760 | 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 28 63 61 72 20 70 72 6f 63 73 29 20 65 6e | ...........(else.((car.procs).en |
| e5780 | 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 | v)...........................(ex |
| e57a0 | 65 63 75 74 65 2d 73 65 71 75 65 6e 63 65 20 28 63 64 72 20 70 72 6f 63 73 29 20 65 6e 76 29 29 | ecute-sequence.(cdr.procs).env)) |
| e57c0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 6f 63 73 20 28 6d 61 70 | )).............(let.((procs.(map |
| e57e0 | 20 61 6e 61 6c 79 7a 65 20 65 78 70 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .analyze.exps)))...............( |
| e5800 | 69 66 20 28 6e 75 6c 6c 3f 20 70 72 6f 63 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | if.(null?.procs)................ |
| e5820 | 20 20 20 28 65 72 72 6f 72 20 22 45 6d 70 74 79 20 73 65 71 75 65 6e 63 65 20 2d 2d 20 41 4e 41 | ...(error."Empty.sequence.--.ANA |
| e5840 | 4c 59 5a 45 22 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 | LYZE"))...............(lambda.(e |
| e5860 | 6e 76 29 20 28 65 78 65 63 75 74 65 2d 73 65 71 75 65 6e 63 65 20 70 72 6f 63 73 20 65 6e 76 29 | nv).(execute-sequence.procs.env) |
| e5880 | 29 29 29 0a 0a 20 20 20 20 20 45 76 61 20 4c 75 20 41 74 6f 72 20 65 78 70 6c 61 69 6e 73 20 74 | ))).......Eva.Lu.Ator.explains.t |
| e58a0 | 6f 20 41 6c 79 73 73 61 20 74 68 61 74 20 74 68 65 20 76 65 72 73 69 6f 6e 20 69 6e 20 74 68 65 | o.Alyssa.that.the.version.in.the |
| e58c0 | 20 74 65 78 74 20 64 6f 65 73 0a 20 20 20 20 20 6d 6f 72 65 20 6f 66 20 74 68 65 20 77 6f 72 6b | .text.does......more.of.the.work |
| e58e0 | 20 6f 66 20 65 76 61 6c 75 61 74 69 6e 67 20 61 20 73 65 71 75 65 6e 63 65 20 61 74 20 61 6e 61 | .of.evaluating.a.sequence.at.ana |
| e5900 | 6c 79 73 69 73 20 74 69 6d 65 2e 0a 20 20 20 20 20 41 6c 79 73 73 61 27 73 20 73 65 71 75 65 6e | lysis.time.......Alyssa's.sequen |
| e5920 | 63 65 2d 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 2c 20 72 61 74 68 65 72 20 74 | ce-execution.procedure,.rather.t |
| e5940 | 68 61 6e 20 68 61 76 69 6e 67 20 74 68 65 0a 20 20 20 20 20 63 61 6c 6c 73 20 74 6f 20 74 68 65 | han.having.the......calls.to.the |
| e5960 | 20 69 6e 64 69 76 69 64 75 61 6c 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 | .individual.execution.procedures |
| e5980 | 20 62 75 69 6c 74 20 69 6e 2c 20 6c 6f 6f 70 73 0a 20 20 20 20 20 74 68 72 6f 75 67 68 20 74 68 | .built.in,.loops......through.th |
| e59a0 | 65 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 63 61 6c 6c 20 74 68 | e.procedures.in.order.to.call.th |
| e59c0 | 65 6d 3a 20 49 6e 20 65 66 66 65 63 74 2c 20 61 6c 74 68 6f 75 67 68 0a 20 20 20 20 20 74 68 65 | em:.In.effect,.although......the |
| e59e0 | 20 69 6e 64 69 76 69 64 75 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 68 65 20 73 | .individual.expressions.in.the.s |
| e5a00 | 65 71 75 65 6e 63 65 20 68 61 76 65 20 62 65 65 6e 20 61 6e 61 6c 79 7a 65 64 2c 20 74 68 65 0a | equence.have.been.analyzed,.the. |
| e5a20 | 20 20 20 20 20 73 65 71 75 65 6e 63 65 20 69 74 73 65 6c 66 20 68 61 73 20 6e 6f 74 20 62 65 65 | .....sequence.itself.has.not.bee |
| e5a40 | 6e 2e 0a 0a 20 20 20 20 20 43 6f 6d 70 61 72 65 20 74 68 65 20 74 77 6f 20 76 65 72 73 69 6f 6e | n........Compare.the.two.version |
| e5a60 | 73 20 6f 66 20 60 61 6e 61 6c 79 7a 65 2d 73 65 71 75 65 6e 63 65 27 2e 20 20 46 6f 72 20 65 78 | s.of.`analyze-sequence'...For.ex |
| e5a80 | 61 6d 70 6c 65 2c 0a 20 20 20 20 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 | ample,......consider.the.common. |
| e5aa0 | 63 61 73 65 20 28 74 79 70 69 63 61 6c 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 69 65 | case.(typical.of.procedure.bodie |
| e5ac0 | 73 29 20 77 68 65 72 65 20 74 68 65 0a 20 20 20 20 20 73 65 71 75 65 6e 63 65 20 68 61 73 20 6a | s).where.the......sequence.has.j |
| e5ae0 | 75 73 74 20 6f 6e 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 57 68 61 74 20 77 6f 72 6b 20 77 | ust.one.expression...What.work.w |
| e5b00 | 69 6c 6c 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 | ill.the.execution......procedure |
| e5b20 | 20 70 72 6f 64 75 63 65 64 20 62 79 20 41 6c 79 73 73 61 27 73 20 70 72 6f 67 72 61 6d 20 64 6f | .produced.by.Alyssa's.program.do |
| e5b40 | 3f 20 20 57 68 61 74 20 61 62 6f 75 74 20 74 68 65 0a 20 20 20 20 20 65 78 65 63 75 74 69 6f 6e | ?..What.about.the......execution |
| e5b60 | 20 70 72 6f 63 65 64 75 72 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 74 68 65 20 70 72 6f 67 72 | .procedure.produced.by.the.progr |
| e5b80 | 61 6d 20 69 6e 20 74 68 65 20 74 65 78 74 20 61 62 6f 76 65 3f 0a 20 20 20 20 20 48 6f 77 20 64 | am.in.the.text.above?......How.d |
| e5ba0 | 6f 20 74 68 65 20 74 77 6f 20 76 65 72 73 69 6f 6e 73 20 63 6f 6d 70 61 72 65 20 66 6f 72 20 61 | o.the.two.versions.compare.for.a |
| e5bc0 | 20 73 65 71 75 65 6e 63 65 20 77 69 74 68 20 74 77 6f 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 | .sequence.with.two......expressi |
| e5be0 | 6f 6e 73 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 32 34 3a 2a 20 44 65 73 69 | ons?.......*Exercise.4.24:*.Desi |
| e5c00 | 67 6e 20 61 6e 64 20 63 61 72 72 79 20 6f 75 74 20 73 6f 6d 65 20 65 78 70 65 72 69 6d 65 6e 74 | gn.and.carry.out.some.experiment |
| e5c20 | 73 20 74 6f 20 63 6f 6d 70 61 72 65 0a 20 20 20 20 20 74 68 65 20 73 70 65 65 64 20 6f 66 20 74 | s.to.compare......the.speed.of.t |
| e5c40 | 68 65 20 6f 72 69 67 69 6e 61 6c 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 | he.original.metacircular.evaluat |
| e5c60 | 6f 72 20 77 69 74 68 20 74 68 65 20 76 65 72 73 69 6f 6e 0a 20 20 20 20 20 69 6e 20 74 68 69 73 | or.with.the.version......in.this |
| e5c80 | 20 73 65 63 74 69 6f 6e 2e 20 20 55 73 65 20 79 6f 75 72 20 72 65 73 75 6c 74 73 20 74 6f 20 65 | .section...Use.your.results.to.e |
| e5ca0 | 73 74 69 6d 61 74 65 20 74 68 65 20 66 72 61 63 74 69 6f 6e 20 6f 66 20 74 69 6d 65 0a 20 20 20 | stimate.the.fraction.of.time.... |
| e5cc0 | 20 20 74 68 61 74 20 69 73 20 73 70 65 6e 74 20 69 6e 20 61 6e 61 6c 79 73 69 73 20 76 65 72 73 | ..that.is.spent.in.analysis.vers |
| e5ce0 | 75 73 20 65 78 65 63 75 74 69 6f 6e 20 66 6f 72 20 76 61 72 69 6f 75 73 20 70 72 6f 63 65 64 75 | us.execution.for.various.procedu |
| e5d00 | 72 65 73 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d | res......----------.Footnotes.-- |
| e5d20 | 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 69 73 20 74 65 63 68 6e 69 71 75 65 20 | --------.....(1).This.technique. |
| e5d40 | 69 73 20 61 6e 20 69 6e 74 65 67 72 61 6c 20 70 61 72 74 20 6f 66 20 74 68 65 20 63 6f 6d 70 69 | is.an.integral.part.of.the.compi |
| e5d60 | 6c 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 2c 0a 77 68 69 63 68 20 77 65 20 73 68 61 6c 6c 20 64 | lation.process,.which.we.shall.d |
| e5d80 | 69 73 63 75 73 73 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 35 3a 3a 2e 20 20 4a 6f | iscuss.in.*Note.Chapter.5::...Jo |
| e5da0 | 6e 61 74 68 61 6e 20 52 65 65 73 20 77 72 6f 74 65 20 61 0a 53 63 68 65 6d 65 20 69 6e 74 65 72 | nathan.Rees.wrote.a.Scheme.inter |
| e5dc0 | 70 72 65 74 65 72 20 6c 69 6b 65 20 74 68 69 73 20 69 6e 20 61 62 6f 75 74 20 31 39 38 32 20 66 | preter.like.this.in.about.1982.f |
| e5de0 | 6f 72 20 74 68 65 20 54 20 70 72 6f 6a 65 63 74 20 28 52 65 65 73 20 61 6e 64 0a 41 64 61 6d 73 | or.the.T.project.(Rees.and.Adams |
| e5e00 | 20 31 39 38 32 29 2e 20 20 4d 61 72 63 20 46 65 65 6c 65 79 20 28 31 39 38 36 29 20 28 73 65 65 | .1982)...Marc.Feeley.(1986).(see |
| e5e20 | 20 61 6c 73 6f 20 46 65 65 6c 65 79 20 61 6e 64 20 4c 61 70 61 6c 6d 65 20 31 39 38 37 29 0a 69 | .also.Feeley.and.Lapalme.1987).i |
| e5e40 | 6e 64 65 70 65 6e 64 65 6e 74 6c 79 20 69 6e 76 65 6e 74 65 64 20 74 68 69 73 20 74 65 63 68 6e | ndependently.invented.this.techn |
| e5e60 | 69 71 75 65 20 69 6e 20 68 69 73 20 6d 61 73 74 65 72 27 73 20 74 68 65 73 69 73 2e 0a 0a 20 20 | ique.in.his.master's.thesis..... |
| e5e80 | 20 28 32 29 20 54 68 65 72 65 20 69 73 2c 20 68 6f 77 65 76 65 72 2c 20 61 6e 20 69 6d 70 6f 72 | .(2).There.is,.however,.an.impor |
| e5ea0 | 74 61 6e 74 20 70 61 72 74 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 73 65 61 72 63 68 | tant.part.of.the.variable.search |
| e5ec0 | 20 74 68 61 74 0a 5f 63 61 6e 5f 20 62 65 20 64 6f 6e 65 20 61 73 20 70 61 72 74 20 6f 66 20 74 | .that._can_.be.done.as.part.of.t |
| e5ee0 | 68 65 20 73 79 6e 74 61 63 74 69 63 20 61 6e 61 6c 79 73 69 73 2e 20 20 41 73 20 77 65 20 77 69 | he.syntactic.analysis...As.we.wi |
| e5f00 | 6c 6c 20 73 68 6f 77 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 2d 36 3a 3a | ll.show.in.section.*Note.5-5-6:: |
| e5f20 | 2c 20 6f 6e 65 20 63 61 6e 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 70 6f 73 69 74 69 6f 6e | ,.one.can.determine.the.position |
| e5f40 | 20 69 6e 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 20 77 68 | .in.the.environment.structure.wh |
| e5f60 | 65 72 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 77 69 | ere.the.value.of.the.variable.wi |
| e5f80 | 6c 6c 20 62 65 20 66 6f 75 6e 64 2c 0a 74 68 75 73 20 6f 62 76 69 61 74 69 6e 67 20 74 68 65 20 | ll.be.found,.thus.obviating.the. |
| e5fa0 | 6e 65 65 64 20 74 6f 20 73 63 61 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 66 6f 72 | need.to.scan.the.environment.for |
| e5fc0 | 20 74 68 65 20 65 6e 74 72 79 20 74 68 61 74 0a 6d 61 74 63 68 65 73 20 74 68 65 20 76 61 72 69 | .the.entry.that.matches.the.vari |
| e5fe0 | 61 62 6c 65 2e 0a 0a 20 20 20 28 33 29 20 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | able......(3).See.*Note.Exercise |
| e6000 | 20 34 2d 32 33 3a 3a 20 66 6f 72 20 73 6f 6d 65 20 69 6e 73 69 67 68 74 20 69 6e 74 6f 20 74 68 | .4-23::.for.some.insight.into.th |
| e6020 | 65 20 70 72 6f 63 65 73 73 69 6e 67 0a 6f 66 20 73 65 71 75 65 6e 63 65 73 2e 0a 0a 1f 0a 46 69 | e.processing.of.sequences.....Fi |
| e6040 | 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 32 2c 20 20 4e 65 78 74 | le:.sicp.info,..Node:.4-2,..Next |
| e6060 | 3a 20 34 2d 33 2c 20 20 50 72 65 76 3a 20 34 2d 31 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 | :.4-3,..Prev:.4-1,..Up:.Chapter. |
| e6080 | 34 0a 0a 34 2e 32 20 56 61 72 69 61 74 69 6f 6e 73 20 6f 6e 20 61 20 53 63 68 65 6d 65 20 2d 20 | 4..4.2.Variations.on.a.Scheme.-. |
| e60a0 | 4c 61 7a 79 20 45 76 61 6c 75 61 74 69 6f 6e 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | Lazy.Evaluation.================ |
| e60c0 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 4e 6f | ============================..No |
| e60e0 | 77 20 74 68 61 74 20 77 65 20 68 61 76 65 20 61 6e 20 65 76 61 6c 75 61 74 6f 72 20 65 78 70 72 | w.that.we.have.an.evaluator.expr |
| e6100 | 65 73 73 65 64 20 61 73 20 61 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 2c 20 77 65 20 63 61 6e 0a | essed.as.a.Lisp.program,.we.can. |
| e6120 | 65 78 70 65 72 69 6d 65 6e 74 20 77 69 74 68 20 61 6c 74 65 72 6e 61 74 69 76 65 20 63 68 6f 69 | experiment.with.alternative.choi |
| e6140 | 63 65 73 20 69 6e 20 6c 61 6e 67 75 61 67 65 20 64 65 73 69 67 6e 20 73 69 6d 70 6c 79 20 62 79 | ces.in.language.design.simply.by |
| e6160 | 0a 6d 6f 64 69 66 79 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 2e 20 20 49 6e 64 65 65 | .modifying.the.evaluator...Indee |
| e6180 | 64 2c 20 6e 65 77 20 6c 61 6e 67 75 61 67 65 73 20 61 72 65 20 6f 66 74 65 6e 20 69 6e 76 65 6e | d,.new.languages.are.often.inven |
| e61a0 | 74 65 64 20 62 79 0a 66 69 72 73 74 20 77 72 69 74 69 6e 67 20 61 6e 20 65 76 61 6c 75 61 74 6f | ted.by.first.writing.an.evaluato |
| e61c0 | 72 20 74 68 61 74 20 65 6d 62 65 64 73 20 74 68 65 20 6e 65 77 20 6c 61 6e 67 75 61 67 65 20 77 | r.that.embeds.the.new.language.w |
| e61e0 | 69 74 68 69 6e 20 61 6e 0a 65 78 69 73 74 69 6e 67 20 68 69 67 68 2d 6c 65 76 65 6c 20 6c 61 6e | ithin.an.existing.high-level.lan |
| e6200 | 67 75 61 67 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 66 20 77 65 20 77 69 73 68 20 | guage...For.example,.if.we.wish. |
| e6220 | 74 6f 20 64 69 73 63 75 73 73 20 73 6f 6d 65 0a 61 73 70 65 63 74 20 6f 66 20 61 20 70 72 6f 70 | to.discuss.some.aspect.of.a.prop |
| e6240 | 6f 73 65 64 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 74 6f 20 4c 69 73 70 20 77 69 74 68 20 61 | osed.modification.to.Lisp.with.a |
| e6260 | 6e 6f 74 68 65 72 20 6d 65 6d 62 65 72 20 6f 66 20 74 68 65 0a 4c 69 73 70 20 63 6f 6d 6d 75 6e | nother.member.of.the.Lisp.commun |
| e6280 | 69 74 79 2c 20 77 65 20 63 61 6e 20 73 75 70 70 6c 79 20 61 6e 20 65 76 61 6c 75 61 74 6f 72 20 | ity,.we.can.supply.an.evaluator. |
| e62a0 | 74 68 61 74 20 65 6d 62 6f 64 69 65 73 20 74 68 65 20 63 68 61 6e 67 65 2e 0a 54 68 65 20 72 65 | that.embodies.the.change..The.re |
| e62c0 | 63 69 70 69 65 6e 74 20 63 61 6e 20 74 68 65 6e 20 65 78 70 65 72 69 6d 65 6e 74 20 77 69 74 68 | cipient.can.then.experiment.with |
| e62e0 | 20 74 68 65 20 6e 65 77 20 65 76 61 6c 75 61 74 6f 72 20 61 6e 64 20 73 65 6e 64 20 62 61 63 6b | .the.new.evaluator.and.send.back |
| e6300 | 0a 63 6f 6d 6d 65 6e 74 73 20 61 73 20 66 75 72 74 68 65 72 20 6d 6f 64 69 66 69 63 61 74 69 6f | .comments.as.further.modificatio |
| e6320 | 6e 73 2e 20 20 4e 6f 74 20 6f 6e 6c 79 20 64 6f 65 73 20 74 68 65 20 68 69 67 68 2d 6c 65 76 65 | ns...Not.only.does.the.high-leve |
| e6340 | 6c 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 62 61 73 65 20 6d 61 6b 65 20 69 74 20 65 61 | l.implementation.base.make.it.ea |
| e6360 | 73 69 65 72 20 74 6f 20 74 65 73 74 20 61 6e 64 20 64 65 62 75 67 20 74 68 65 20 65 76 61 6c 75 | sier.to.test.and.debug.the.evalu |
| e6380 | 61 74 6f 72 3b 20 69 6e 0a 61 64 64 69 74 69 6f 6e 2c 20 74 68 65 20 65 6d 62 65 64 64 69 6e 67 | ator;.in.addition,.the.embedding |
| e63a0 | 20 65 6e 61 62 6c 65 73 20 74 68 65 20 64 65 73 69 67 6e 65 72 20 74 6f 20 73 6e 61 72 66 28 31 | .enables.the.designer.to.snarf(1 |
| e63c0 | 29 20 66 65 61 74 75 72 65 73 20 66 72 6f 6d 0a 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 6c | ).features.from.the.underlying.l |
| e63e0 | 61 6e 67 75 61 67 65 2c 20 6a 75 73 74 20 61 73 20 6f 75 72 20 65 6d 62 65 64 64 65 64 20 4c 69 | anguage,.just.as.our.embedded.Li |
| e6400 | 73 70 20 65 76 61 6c 75 61 74 6f 72 20 75 73 65 73 0a 70 72 69 6d 69 74 69 76 65 73 20 61 6e 64 | sp.evaluator.uses.primitives.and |
| e6420 | 20 63 6f 6e 74 72 6f 6c 20 73 74 72 75 63 74 75 72 65 20 66 72 6f 6d 20 74 68 65 20 75 6e 64 65 | .control.structure.from.the.unde |
| e6440 | 72 6c 79 69 6e 67 20 4c 69 73 70 2e 20 20 4f 6e 6c 79 20 6c 61 74 65 72 0a 28 69 66 20 65 76 65 | rlying.Lisp...Only.later.(if.eve |
| e6460 | 72 29 20 6e 65 65 64 20 74 68 65 20 64 65 73 69 67 6e 65 72 20 67 6f 20 74 6f 20 74 68 65 20 74 | r).need.the.designer.go.to.the.t |
| e6480 | 72 6f 75 62 6c 65 20 6f 66 20 62 75 69 6c 64 69 6e 67 20 61 20 63 6f 6d 70 6c 65 74 65 0a 69 6d | rouble.of.building.a.complete.im |
| e64a0 | 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 69 6e 20 61 20 6c 6f 77 2d 6c 65 76 65 6c 20 6c 61 6e 67 | plementation.in.a.low-level.lang |
| e64c0 | 75 61 67 65 20 6f 72 20 69 6e 20 68 61 72 64 77 61 72 65 2e 20 20 49 6e 20 74 68 69 73 20 73 65 | uage.or.in.hardware...In.this.se |
| e64e0 | 63 74 69 6f 6e 0a 61 6e 64 20 74 68 65 20 6e 65 78 74 20 77 65 20 65 78 70 6c 6f 72 65 20 73 6f | ction.and.the.next.we.explore.so |
| e6500 | 6d 65 20 76 61 72 69 61 74 69 6f 6e 73 20 6f 6e 20 53 63 68 65 6d 65 20 74 68 61 74 20 70 72 6f | me.variations.on.Scheme.that.pro |
| e6520 | 76 69 64 65 0a 73 69 67 6e 69 66 69 63 61 6e 74 20 61 64 64 69 74 69 6f 6e 61 6c 20 65 78 70 72 | vide.significant.additional.expr |
| e6540 | 65 73 73 69 76 65 20 70 6f 77 65 72 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 34 2d 32 2d 31 3a | essive.power...*.Menu:..*.4-2-1: |
| e6560 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 4e 6f 72 6d 61 6c 20 4f 72 64 65 72 20 61 6e 64 20 41 70 | :............Normal.Order.and.Ap |
| e6580 | 70 6c 69 63 61 74 69 76 65 20 4f 72 64 65 72 0a 2a 20 34 2d 32 2d 32 3a 3a 20 20 20 20 20 20 20 | plicative.Order.*.4-2-2::....... |
| e65a0 | 20 20 20 20 20 41 6e 20 49 6e 74 65 72 70 72 65 74 65 72 20 77 69 74 68 20 4c 61 7a 79 20 45 76 | .....An.Interpreter.with.Lazy.Ev |
| e65c0 | 61 6c 75 61 74 69 6f 6e 0a 2a 20 34 2d 32 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 53 74 | aluation.*.4-2-3::............St |
| e65e0 | 72 65 61 6d 73 20 61 73 20 4c 61 7a 79 20 4c 69 73 74 73 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d | reams.as.Lazy.Lists.....-------- |
| e6600 | 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 | --.Footnotes.----------.....(1). |
| e6620 | 53 6e 61 72 66 3a 20 22 54 6f 20 67 72 61 62 2c 20 65 73 70 65 63 69 61 6c 6c 79 20 61 20 6c 61 | Snarf:."To.grab,.especially.a.la |
| e6640 | 72 67 65 20 64 6f 63 75 6d 65 6e 74 20 6f 72 20 66 69 6c 65 20 66 6f 72 20 74 68 65 0a 70 75 72 | rge.document.or.file.for.the.pur |
| e6660 | 70 6f 73 65 20 6f 66 20 75 73 69 6e 67 20 69 74 20 65 69 74 68 65 72 20 77 69 74 68 20 6f 72 20 | pose.of.using.it.either.with.or. |
| e6680 | 77 69 74 68 6f 75 74 20 74 68 65 20 6f 77 6e 65 72 27 73 20 70 65 72 6d 69 73 73 69 6f 6e 2e 22 | without.the.owner's.permission." |
| e66a0 | 0a 53 6e 61 72 66 20 64 6f 77 6e 3a 20 22 54 6f 20 73 6e 61 72 66 2c 20 73 6f 6d 65 74 69 6d 65 | .Snarf.down:."To.snarf,.sometime |
| e66c0 | 73 20 77 69 74 68 20 74 68 65 20 63 6f 6e 6e 6f 74 61 74 69 6f 6e 20 6f 66 20 61 62 73 6f 72 62 | s.with.the.connotation.of.absorb |
| e66e0 | 69 6e 67 2c 0a 70 72 6f 63 65 73 73 69 6e 67 2c 20 6f 72 20 75 6e 64 65 72 73 74 61 6e 64 69 6e | ing,.processing,.or.understandin |
| e6700 | 67 2e 22 20 20 28 54 68 65 73 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 77 65 72 65 20 73 6e 61 | g."..(These.definitions.were.sna |
| e6720 | 72 66 65 64 20 66 72 6f 6d 0a 53 74 65 65 6c 65 20 65 74 20 61 6c 2e 20 31 39 38 33 2e 20 20 53 | rfed.from.Steele.et.al..1983...S |
| e6740 | 65 65 20 61 6c 73 6f 20 52 61 79 6d 6f 6e 64 20 31 39 39 33 2e 29 0a 0a 1f 0a 46 69 6c 65 3a 20 | ee.also.Raymond.1993.)....File:. |
| e6760 | 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 32 2d 31 2c 20 20 4e 65 78 74 3a 20 | sicp.info,..Node:.4-2-1,..Next:. |
| e6780 | 34 2d 32 2d 32 2c 20 20 50 72 65 76 3a 20 34 2d 32 2c 20 20 55 70 3a 20 34 2d 32 0a 0a 34 2e 32 | 4-2-2,..Prev:.4-2,..Up:.4-2..4.2 |
| e67a0 | 2e 31 20 4e 6f 72 6d 61 6c 20 4f 72 64 65 72 20 61 6e 64 20 41 70 70 6c 69 63 61 74 69 76 65 20 | .1.Normal.Order.and.Applicative. |
| e67c0 | 4f 72 64 65 72 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | Order.-------------------------- |
| e67e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | --------------..In.section.*Note |
| e6800 | 20 31 2d 31 3a 3a 2c 20 77 68 65 72 65 20 77 65 20 62 65 67 61 6e 20 6f 75 72 20 64 69 73 63 75 | .1-1::,.where.we.began.our.discu |
| e6820 | 73 73 69 6f 6e 20 6f 66 20 6d 6f 64 65 6c 73 20 6f 66 0a 65 76 61 6c 75 61 74 69 6f 6e 2c 20 77 | ssion.of.models.of.evaluation,.w |
| e6840 | 65 20 6e 6f 74 65 64 20 74 68 61 74 20 53 63 68 65 6d 65 20 69 73 20 61 6e 20 22 61 70 70 6c 69 | e.noted.that.Scheme.is.an."appli |
| e6860 | 63 61 74 69 76 65 2d 6f 72 64 65 72 22 20 6c 61 6e 67 75 61 67 65 2c 0a 6e 61 6d 65 6c 79 2c 20 | cative-order".language,.namely,. |
| e6880 | 74 68 61 74 20 61 6c 6c 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 53 63 68 65 6d 65 | that.all.the.arguments.to.Scheme |
| e68a0 | 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 20 77 68 65 6e 0a 74 | .procedures.are.evaluated.when.t |
| e68c0 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 61 70 70 6c 69 65 64 2e 20 20 49 6e 20 63 6f 6e | he.procedure.is.applied...In.con |
| e68e0 | 74 72 61 73 74 2c 20 22 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 22 20 6c 61 6e 67 75 61 67 65 73 20 | trast,."normal-order".languages. |
| e6900 | 64 65 6c 61 79 0a 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 61 72 | delay.evaluation.of.procedure.ar |
| e6920 | 67 75 6d 65 6e 74 73 20 75 6e 74 69 6c 20 74 68 65 20 61 63 74 75 61 6c 20 61 72 67 75 6d 65 6e | guments.until.the.actual.argumen |
| e6940 | 74 20 76 61 6c 75 65 73 20 61 72 65 0a 6e 65 65 64 65 64 2e 20 20 44 65 6c 61 79 69 6e 67 20 65 | t.values.are.needed...Delaying.e |
| e6960 | 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 61 72 67 75 6d 65 6e 74 73 | valuation.of.procedure.arguments |
| e6980 | 20 75 6e 74 69 6c 20 74 68 65 20 6c 61 73 74 0a 70 6f 73 73 69 62 6c 65 20 6d 6f 6d 65 6e 74 20 | .until.the.last.possible.moment. |
| e69a0 | 28 65 2e 67 2e 2c 20 75 6e 74 69 6c 20 74 68 65 79 20 61 72 65 20 72 65 71 75 69 72 65 64 20 62 | (e.g.,.until.they.are.required.b |
| e69c0 | 79 20 61 20 70 72 69 6d 69 74 69 76 65 0a 6f 70 65 72 61 74 69 6f 6e 29 20 69 73 20 63 61 6c 6c | y.a.primitive.operation).is.call |
| e69e0 | 65 64 20 65 76 61 6c 75 61 74 69 6f 6e 20 22 6c 61 7a 79 20 65 76 61 6c 75 61 74 69 6f 6e 22 2e | ed.evaluation."lazy.evaluation". |
| e6a00 | 28 31 29 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 | (1)..Consider.the.procedure..... |
| e6a20 | 20 20 28 64 65 66 69 6e 65 20 28 74 72 79 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 | ..(define.(try.a.b)........(if.( |
| e6a40 | 3d 20 61 20 30 29 20 31 20 62 29 29 0a 0a 20 20 20 45 76 61 6c 75 61 74 69 6e 67 20 60 28 74 72 | =.a.0).1.b)).....Evaluating.`(tr |
| e6a60 | 79 20 30 20 28 2f 20 31 20 30 29 29 27 20 67 65 6e 65 72 61 74 65 73 20 61 6e 20 65 72 72 6f 72 | y.0.(/.1.0))'.generates.an.error |
| e6a80 | 20 69 6e 20 53 63 68 65 6d 65 2e 20 20 57 69 74 68 20 6c 61 7a 79 0a 65 76 61 6c 75 61 74 69 6f | .in.Scheme...With.lazy.evaluatio |
| e6aa0 | 6e 2c 20 74 68 65 72 65 20 77 6f 75 6c 64 20 62 65 20 6e 6f 20 65 72 72 6f 72 2e 20 20 45 76 61 | n,.there.would.be.no.error...Eva |
| e6ac0 | 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 77 6f 75 6c 64 0a 72 65 74 | luating.the.expression.would.ret |
| e6ae0 | 75 72 6e 20 31 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 60 28 2f 20 | urn.1,.because.the.argument.`(/. |
| e6b00 | 31 20 30 29 27 20 77 6f 75 6c 64 20 6e 65 76 65 72 20 62 65 20 65 76 61 6c 75 61 74 65 64 2e 0a | 1.0)'.would.never.be.evaluated.. |
| e6b20 | 0a 20 20 20 41 6e 20 65 78 61 6d 70 6c 65 20 74 68 61 74 20 65 78 70 6c 6f 69 74 73 20 6c 61 7a | ....An.example.that.exploits.laz |
| e6b40 | 79 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 73 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f | y.evaluation.is.the.definition.o |
| e6b60 | 66 20 61 0a 70 72 6f 63 65 64 75 72 65 20 60 75 6e 6c 65 73 73 27 0a 0a 20 20 20 20 20 28 64 65 | f.a.procedure.`unless'.......(de |
| e6b80 | 66 69 6e 65 20 28 75 6e 6c 65 73 73 20 63 6f 6e 64 69 74 69 6f 6e 20 75 73 75 61 6c 2d 76 61 6c | fine.(unless.condition.usual-val |
| e6ba0 | 75 65 20 65 78 63 65 70 74 69 6f 6e 61 6c 2d 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 28 69 66 | ue.exceptional-value)........(if |
| e6bc0 | 20 63 6f 6e 64 69 74 69 6f 6e 20 65 78 63 65 70 74 69 6f 6e 61 6c 2d 76 61 6c 75 65 20 75 73 75 | .condition.exceptional-value.usu |
| e6be0 | 61 6c 2d 76 61 6c 75 65 29 29 0a 0a 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 69 6e 20 | al-value))..that.can.be.used.in. |
| e6c00 | 65 78 70 72 65 73 73 69 6f 6e 73 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 20 28 75 6e 6c 65 73 | expressions.such.as.......(unles |
| e6c20 | 73 20 28 3d 20 62 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2f 20 61 20 62 29 0a 20 | s.(=.b.0)..............(/.a.b).. |
| e6c40 | 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 69 6e 20 28 64 69 73 70 6c 61 79 20 22 65 78 63 | ............(begin.(display."exc |
| e6c60 | 65 70 74 69 6f 6e 3a 20 72 65 74 75 72 6e 69 6e 67 20 30 22 29 0a 20 20 20 20 20 20 20 20 20 20 | eption:.returning.0")........... |
| e6c80 | 20 20 20 20 20 20 20 20 20 20 30 29 29 0a 0a 20 20 20 54 68 69 73 20 77 6f 6e 27 74 20 77 6f 72 | ..........0)).....This.won't.wor |
| e6ca0 | 6b 20 69 6e 20 61 6e 20 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 20 6c 61 6e 67 75 61 | k.in.an.applicative-order.langua |
| e6cc0 | 67 65 20 62 65 63 61 75 73 65 20 62 6f 74 68 20 74 68 65 0a 75 73 75 61 6c 20 76 61 6c 75 65 20 | ge.because.both.the.usual.value. |
| e6ce0 | 61 6e 64 20 74 68 65 20 65 78 63 65 70 74 69 6f 6e 61 6c 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 | and.the.exceptional.value.will.b |
| e6d00 | 65 20 65 76 61 6c 75 61 74 65 64 20 62 65 66 6f 72 65 20 60 75 6e 6c 65 73 73 27 0a 69 73 20 63 | e.evaluated.before.`unless'.is.c |
| e6d20 | 61 6c 6c 65 64 20 28 63 6f 6d 70 61 72 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 31 2d | alled.(compare.*Note.Exercise.1- |
| e6d40 | 36 3a 3a 29 2e 20 20 41 6e 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 6c 61 7a 79 0a 65 76 61 6c | 6::)...An.advantage.of.lazy.eval |
| e6d60 | 75 61 74 69 6f 6e 20 69 73 20 74 68 61 74 20 73 6f 6d 65 20 70 72 6f 63 65 64 75 72 65 73 2c 20 | uation.is.that.some.procedures,. |
| e6d80 | 73 75 63 68 20 61 73 20 60 75 6e 6c 65 73 73 27 2c 20 63 61 6e 20 64 6f 20 75 73 65 66 75 6c 0a | such.as.`unless',.can.do.useful. |
| e6da0 | 63 6f 6d 70 75 74 61 74 69 6f 6e 20 65 76 65 6e 20 69 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f | computation.even.if.evaluation.o |
| e6dc0 | 66 20 73 6f 6d 65 20 6f 66 20 74 68 65 69 72 20 61 72 67 75 6d 65 6e 74 73 20 77 6f 75 6c 64 20 | f.some.of.their.arguments.would. |
| e6de0 | 70 72 6f 64 75 63 65 0a 65 72 72 6f 72 73 20 6f 72 20 77 6f 75 6c 64 20 6e 6f 74 20 74 65 72 6d | produce.errors.or.would.not.term |
| e6e00 | 69 6e 61 74 65 2e 0a 0a 20 20 20 49 66 20 74 68 65 20 62 6f 64 79 20 6f 66 20 61 20 70 72 6f 63 | inate......If.the.body.of.a.proc |
| e6e20 | 65 64 75 72 65 20 69 73 20 65 6e 74 65 72 65 64 20 62 65 66 6f 72 65 20 61 6e 20 61 72 67 75 6d | edure.is.entered.before.an.argum |
| e6e40 | 65 6e 74 20 68 61 73 20 62 65 65 6e 0a 65 76 61 6c 75 61 74 65 64 20 77 65 20 73 61 79 20 74 68 | ent.has.been.evaluated.we.say.th |
| e6e60 | 61 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 22 6e 6f 6e 2d 73 74 72 69 63 74 22 | at.the.procedure.is."non-strict" |
| e6e80 | 20 69 6e 20 74 68 61 74 20 61 72 67 75 6d 65 6e 74 2e 0a 49 66 20 74 68 65 20 61 72 67 75 6d 65 | .in.that.argument..If.the.argume |
| e6ea0 | 6e 74 20 69 73 20 65 76 61 6c 75 61 74 65 64 20 62 65 66 6f 72 65 20 74 68 65 20 62 6f 64 79 20 | nt.is.evaluated.before.the.body. |
| e6ec0 | 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 0a 65 6e 74 65 72 65 64 20 77 65 20 73 | of.the.procedure.is.entered.we.s |
| e6ee0 | 61 79 20 74 68 61 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 22 73 74 72 69 63 74 | ay.that.the.procedure.is."strict |
| e6f00 | 22 20 69 6e 20 74 68 61 74 20 61 72 67 75 6d 65 6e 74 2e 28 32 29 20 20 49 6e 0a 61 20 70 75 72 | ".in.that.argument.(2)..In.a.pur |
| e6f20 | 65 6c 79 20 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 20 6c 61 6e 67 75 61 67 65 2c 20 | ely.applicative-order.language,. |
| e6f40 | 61 6c 6c 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 73 74 72 69 63 74 20 69 6e 20 65 61 63 | all.procedures.are.strict.in.eac |
| e6f60 | 68 0a 61 72 67 75 6d 65 6e 74 2e 20 20 49 6e 20 61 20 70 75 72 65 6c 79 20 6e 6f 72 6d 61 6c 2d | h.argument...In.a.purely.normal- |
| e6f80 | 6f 72 64 65 72 20 6c 61 6e 67 75 61 67 65 2c 20 61 6c 6c 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f | order.language,.all.compound.pro |
| e6fa0 | 63 65 64 75 72 65 73 0a 61 72 65 20 6e 6f 6e 2d 73 74 72 69 63 74 20 69 6e 20 65 61 63 68 20 61 | cedures.are.non-strict.in.each.a |
| e6fc0 | 72 67 75 6d 65 6e 74 2c 20 61 6e 64 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 | rgument,.and.primitive.procedure |
| e6fe0 | 73 20 6d 61 79 20 62 65 20 65 69 74 68 65 72 0a 73 74 72 69 63 74 20 6f 72 20 6e 6f 6e 2d 73 74 | s.may.be.either.strict.or.non-st |
| e7000 | 72 69 63 74 2e 20 20 54 68 65 72 65 20 61 72 65 20 61 6c 73 6f 20 6c 61 6e 67 75 61 67 65 73 20 | rict...There.are.also.languages. |
| e7020 | 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 34 2d 33 31 3a 3a 29 20 74 68 61 74 | (see.*Note.Exercise.4-31::).that |
| e7040 | 20 67 69 76 65 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 64 65 74 61 69 6c 65 64 20 63 6f 6e 74 72 | .give.programmers.detailed.contr |
| e7060 | 6f 6c 20 6f 76 65 72 20 74 68 65 20 73 74 72 69 63 74 6e 65 73 73 20 6f 66 0a 74 68 65 20 70 72 | ol.over.the.strictness.of.the.pr |
| e7080 | 6f 63 65 64 75 72 65 73 20 74 68 65 79 20 64 65 66 69 6e 65 2e 0a 0a 20 20 20 41 20 73 74 72 69 | ocedures.they.define......A.stri |
| e70a0 | 6b 69 6e 67 20 65 78 61 6d 70 6c 65 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 | king.example.of.a.procedure.that |
| e70c0 | 20 63 61 6e 20 75 73 65 66 75 6c 6c 79 20 62 65 20 6d 61 64 65 0a 6e 6f 6e 2d 73 74 72 69 63 74 | .can.usefully.be.made.non-strict |
| e70e0 | 20 69 73 20 60 63 6f 6e 73 27 20 28 6f 72 2c 20 69 6e 20 67 65 6e 65 72 61 6c 2c 20 61 6c 6d 6f | .is.`cons'.(or,.in.general,.almo |
| e7100 | 73 74 20 61 6e 79 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 66 6f 72 20 64 61 74 61 0a 73 74 72 75 | st.any.constructor.for.data.stru |
| e7120 | 63 74 75 72 65 73 29 2e 20 20 4f 6e 65 20 63 61 6e 20 64 6f 20 75 73 65 66 75 6c 20 63 6f 6d 70 | ctures)...One.can.do.useful.comp |
| e7140 | 75 74 61 74 69 6f 6e 2c 20 63 6f 6d 62 69 6e 69 6e 67 20 65 6c 65 6d 65 6e 74 73 20 74 6f 20 66 | utation,.combining.elements.to.f |
| e7160 | 6f 72 6d 0a 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 61 6e 64 20 6f 70 65 72 61 74 69 6e | orm.data.structures.and.operatin |
| e7180 | 67 20 6f 6e 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 64 61 74 61 20 73 74 72 75 63 74 75 72 | g.on.the.resulting.data.structur |
| e71a0 | 65 73 2c 20 65 76 65 6e 20 69 66 0a 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 65 6c | es,.even.if.the.values.of.the.el |
| e71c0 | 65 6d 65 6e 74 73 20 61 72 65 20 6e 6f 74 20 6b 6e 6f 77 6e 2e 20 20 49 74 20 6d 61 6b 65 73 20 | ements.are.not.known...It.makes. |
| e71e0 | 70 65 72 66 65 63 74 20 73 65 6e 73 65 2c 20 66 6f 72 0a 69 6e 73 74 61 6e 63 65 2c 20 74 6f 20 | perfect.sense,.for.instance,.to. |
| e7200 | 63 6f 6d 70 75 74 65 20 74 68 65 20 6c 65 6e 67 74 68 20 6f 66 20 61 20 6c 69 73 74 20 77 69 74 | compute.the.length.of.a.list.wit |
| e7220 | 68 6f 75 74 20 6b 6e 6f 77 69 6e 67 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 0a 74 68 65 20 69 | hout.knowing.the.values.of.the.i |
| e7240 | 6e 64 69 76 69 64 75 61 6c 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 6c 69 73 74 2e 20 | ndividual.elements.in.the.list.. |
| e7260 | 20 57 65 20 77 69 6c 6c 20 65 78 70 6c 6f 69 74 20 74 68 69 73 20 69 64 65 61 20 69 6e 0a 73 65 | .We.will.exploit.this.idea.in.se |
| e7280 | 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 32 2d 33 3a 3a 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 | ction.*Note.4-2-3::.to.implement |
| e72a0 | 20 74 68 65 20 73 74 72 65 61 6d 73 20 6f 66 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a | .the.streams.of.*Note.Chapter.3: |
| e72c0 | 3a 20 61 73 0a 6c 69 73 74 73 20 66 6f 72 6d 65 64 20 6f 66 20 6e 6f 6e 2d 73 74 72 69 63 74 20 | :.as.lists.formed.of.non-strict. |
| e72e0 | 60 63 6f 6e 73 27 20 70 61 69 72 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e | `cons'.pairs........*Exercise.4. |
| e7300 | 32 35 3a 2a 20 53 75 70 70 6f 73 65 20 74 68 61 74 20 28 69 6e 20 6f 72 64 69 6e 61 72 79 20 61 | 25:*.Suppose.that.(in.ordinary.a |
| e7320 | 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 0a 20 20 20 20 20 53 63 68 65 6d 65 29 20 77 65 | pplicative-order......Scheme).we |
| e7340 | 20 64 65 66 69 6e 65 20 60 75 6e 6c 65 73 73 27 20 61 73 20 73 68 6f 77 6e 20 61 62 6f 76 65 20 | .define.`unless'.as.shown.above. |
| e7360 | 61 6e 64 20 74 68 65 6e 20 64 65 66 69 6e 65 0a 20 20 20 20 20 60 66 61 63 74 6f 72 69 61 6c 27 | and.then.define......`factorial' |
| e7380 | 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 60 75 6e 6c 65 73 73 27 20 61 73 0a 0a 20 20 20 20 20 20 | .in.terms.of.`unless'.as........ |
| e73a0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 | ....(define.(factorial.n)....... |
| e73c0 | 20 20 20 20 20 20 28 75 6e 6c 65 73 73 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 | ......(unless.(=.n.1)........... |
| e73e0 | 20 20 20 20 20 20 20 20 20 20 28 2a 20 6e 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 | ..........(*.n.(factorial.(-.n.1 |
| e7400 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 29 29 0a 0a 20 20 20 | ))).....................1))..... |
| e7420 | 20 20 57 68 61 74 20 68 61 70 70 65 6e 73 20 69 66 20 77 65 20 61 74 74 65 6d 70 74 20 74 6f 20 | ..What.happens.if.we.attempt.to. |
| e7440 | 65 76 61 6c 75 61 74 65 20 60 28 66 61 63 74 6f 72 69 61 6c 20 35 29 27 3f 20 20 57 69 6c 6c 20 | evaluate.`(factorial.5)'?..Will. |
| e7460 | 6f 75 72 0a 20 20 20 20 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 77 6f 72 6b 20 69 6e 20 61 20 6e | our......definitions.work.in.a.n |
| e7480 | 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 6c 61 6e 67 75 61 67 65 3f 0a 0a 20 20 20 20 20 2a 45 78 65 | ormal-order.language?.......*Exe |
| e74a0 | 72 63 69 73 65 20 34 2e 32 36 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 61 6e 64 20 41 | rcise.4.26:*.Ben.Bitdiddle.and.A |
| e74c0 | 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 20 64 69 73 61 67 72 65 65 20 6f 76 65 72 0a 20 20 | lyssa.P..Hacker.disagree.over... |
| e74e0 | 20 20 20 74 68 65 20 69 6d 70 6f 72 74 61 6e 63 65 20 6f 66 20 6c 61 7a 79 20 65 76 61 6c 75 61 | ...the.importance.of.lazy.evalua |
| e7500 | 74 69 6f 6e 20 66 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 69 6e 67 73 20 73 75 63 | tion.for.implementing.things.suc |
| e7520 | 68 20 61 73 0a 20 20 20 20 20 60 75 6e 6c 65 73 73 27 2e 20 20 42 65 6e 20 70 6f 69 6e 74 73 20 | h.as......`unless'...Ben.points. |
| e7540 | 6f 75 74 20 74 68 61 74 20 69 74 27 73 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 69 6d 70 6c 65 6d | out.that.it's.possible.to.implem |
| e7560 | 65 6e 74 20 60 75 6e 6c 65 73 73 27 0a 20 20 20 20 20 69 6e 20 61 70 70 6c 69 63 61 74 69 76 65 | ent.`unless'......in.applicative |
| e7580 | 20 6f 72 64 65 72 20 61 73 20 61 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 2e 20 20 41 6c 79 73 73 | .order.as.a.special.form...Alyss |
| e75a0 | 61 20 63 6f 75 6e 74 65 72 73 20 74 68 61 74 2c 20 69 66 0a 20 20 20 20 20 6f 6e 65 20 64 69 64 | a.counters.that,.if......one.did |
| e75c0 | 20 74 68 61 74 2c 20 60 75 6e 6c 65 73 73 27 20 77 6f 75 6c 64 20 62 65 20 6d 65 72 65 6c 79 20 | .that,.`unless'.would.be.merely. |
| e75e0 | 73 79 6e 74 61 78 2c 20 6e 6f 74 20 61 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 74 68 61 | syntax,.not.a.procedure......tha |
| e7600 | 74 20 63 6f 75 6c 64 20 62 65 20 75 73 65 64 20 69 6e 20 63 6f 6e 6a 75 6e 63 74 69 6f 6e 20 77 | t.could.be.used.in.conjunction.w |
| e7620 | 69 74 68 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 6f 63 65 64 75 72 65 73 2e 0a 20 20 20 | ith.higher-order.procedures..... |
| e7640 | 20 20 46 69 6c 6c 20 69 6e 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 6e 20 62 6f 74 68 20 73 69 | ..Fill.in.the.details.on.both.si |
| e7660 | 64 65 73 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 2e 20 20 53 68 6f 77 20 68 6f 77 20 74 | des.of.the.argument...Show.how.t |
| e7680 | 6f 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 20 60 75 6e 6c 65 73 73 27 20 61 73 20 61 20 64 | o......implement.`unless'.as.a.d |
| e76a0 | 65 72 69 76 65 64 20 65 78 70 72 65 73 73 69 6f 6e 20 28 6c 69 6b 65 20 60 63 6f 6e 64 27 20 6f | erived.expression.(like.`cond'.o |
| e76c0 | 72 20 60 6c 65 74 27 29 2c 0a 20 20 20 20 20 61 6e 64 20 67 69 76 65 20 61 6e 20 65 78 61 6d 70 | r.`let'),......and.give.an.examp |
| e76e0 | 6c 65 20 6f 66 20 61 20 73 69 74 75 61 74 69 6f 6e 20 77 68 65 72 65 20 69 74 20 6d 69 67 68 74 | le.of.a.situation.where.it.might |
| e7700 | 20 62 65 20 75 73 65 66 75 6c 20 74 6f 0a 20 20 20 20 20 68 61 76 65 20 60 75 6e 6c 65 73 73 27 | .be.useful.to......have.`unless' |
| e7720 | 20 61 76 61 69 6c 61 62 6c 65 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 72 61 74 68 65 | .available.as.a.procedure,.rathe |
| e7740 | 72 20 74 68 61 6e 20 61 73 20 61 20 73 70 65 63 69 61 6c 0a 20 20 20 20 20 66 6f 72 6d 2e 0a 0a | r.than.as.a.special......form... |
| e7760 | 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d | ...----------.Footnotes.-------- |
| e7780 | 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 65 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 | --.....(1).The.difference.betwee |
| e77a0 | 6e 20 74 68 65 20 22 6c 61 7a 79 22 20 74 65 72 6d 69 6e 6f 6c 6f 67 79 20 61 6e 64 20 74 68 65 | n.the."lazy".terminology.and.the |
| e77c0 | 0a 22 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 22 20 74 65 72 6d 69 6e 6f 6c 6f 67 79 20 69 73 20 73 | ."normal-order".terminology.is.s |
| e77e0 | 6f 6d 65 77 68 61 74 20 66 75 7a 7a 79 2e 20 20 47 65 6e 65 72 61 6c 6c 79 2c 20 22 6c 61 7a 79 | omewhat.fuzzy...Generally,."lazy |
| e7800 | 22 20 72 65 66 65 72 73 0a 74 6f 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d 73 20 6f 66 20 70 61 | ".refers.to.the.mechanisms.of.pa |
| e7820 | 72 74 69 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 73 2c 20 77 68 69 6c 65 20 22 6e 6f 72 6d | rticular.evaluators,.while."norm |
| e7840 | 61 6c 2d 6f 72 64 65 72 22 20 72 65 66 65 72 73 0a 74 6f 20 74 68 65 20 73 65 6d 61 6e 74 69 63 | al-order".refers.to.the.semantic |
| e7860 | 73 20 6f 66 20 6c 61 6e 67 75 61 67 65 73 2c 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 61 | s.of.languages,.independent.of.a |
| e7880 | 6e 79 20 70 61 72 74 69 63 75 6c 61 72 20 65 76 61 6c 75 61 74 69 6f 6e 0a 73 74 72 61 74 65 67 | ny.particular.evaluation.strateg |
| e78a0 | 79 2e 20 20 42 75 74 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61 20 68 61 72 64 2d 61 6e 64 2d 66 | y...But.this.is.not.a.hard-and-f |
| e78c0 | 61 73 74 20 64 69 73 74 69 6e 63 74 69 6f 6e 2c 20 61 6e 64 20 74 68 65 20 74 77 6f 0a 74 65 72 | ast.distinction,.and.the.two.ter |
| e78e0 | 6d 69 6e 6f 6c 6f 67 69 65 73 20 61 72 65 20 6f 66 74 65 6e 20 75 73 65 64 20 69 6e 74 65 72 63 | minologies.are.often.used.interc |
| e7900 | 68 61 6e 67 65 61 62 6c 79 2e 0a 0a 20 20 20 28 32 29 20 54 68 65 20 22 73 74 72 69 63 74 22 20 | hangeably......(2).The."strict". |
| e7920 | 76 65 72 73 75 73 20 22 6e 6f 6e 2d 73 74 72 69 63 74 22 20 74 65 72 6d 69 6e 6f 6c 6f 67 79 20 | versus."non-strict".terminology. |
| e7940 | 6d 65 61 6e 73 20 65 73 73 65 6e 74 69 61 6c 6c 79 0a 74 68 65 20 73 61 6d 65 20 74 68 69 6e 67 | means.essentially.the.same.thing |
| e7960 | 20 61 73 20 22 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 22 20 76 65 72 73 75 73 20 22 | .as."applicative-order".versus." |
| e7980 | 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 2c 22 20 65 78 63 65 70 74 0a 74 68 61 74 20 69 74 20 72 65 | normal-order,".except.that.it.re |
| e79a0 | 66 65 72 73 20 74 6f 20 69 6e 64 69 76 69 64 75 61 6c 20 70 72 6f 63 65 64 75 72 65 73 20 61 6e | fers.to.individual.procedures.an |
| e79c0 | 64 20 61 72 67 75 6d 65 6e 74 73 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 6f 0a 74 68 65 20 6c | d.arguments.rather.than.to.the.l |
| e79e0 | 61 6e 67 75 61 67 65 20 61 73 20 61 20 77 68 6f 6c 65 2e 20 20 41 74 20 61 20 63 6f 6e 66 65 72 | anguage.as.a.whole...At.a.confer |
| e7a00 | 65 6e 63 65 20 6f 6e 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 79 6f | ence.on.programming.languages.yo |
| e7a20 | 75 0a 6d 69 67 68 74 20 68 65 61 72 20 73 6f 6d 65 6f 6e 65 20 73 61 79 2c 20 22 54 68 65 20 6e | u.might.hear.someone.say,."The.n |
| e7a40 | 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 6c 61 6e 67 75 61 67 65 20 48 61 73 73 6c 65 20 68 61 73 20 | ormal-order.language.Hassle.has. |
| e7a60 | 63 65 72 74 61 69 6e 0a 73 74 72 69 63 74 20 70 72 69 6d 69 74 69 76 65 73 2e 20 20 4f 74 68 65 | certain.strict.primitives...Othe |
| e7a80 | 72 20 70 72 6f 63 65 64 75 72 65 73 20 74 61 6b 65 20 74 68 65 69 72 20 61 72 67 75 6d 65 6e 74 | r.procedures.take.their.argument |
| e7aa0 | 73 20 62 79 20 6c 61 7a 79 0a 65 76 61 6c 75 61 74 69 6f 6e 2e 22 0a 0a 1f 0a 46 69 6c 65 3a 20 | s.by.lazy.evaluation."....File:. |
| e7ac0 | 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 32 2d 32 2c 20 20 4e 65 78 74 3a 20 | sicp.info,..Node:.4-2-2,..Next:. |
| e7ae0 | 34 2d 32 2d 33 2c 20 20 50 72 65 76 3a 20 34 2d 32 2d 31 2c 20 20 55 70 3a 20 34 2d 32 0a 0a 34 | 4-2-3,..Prev:.4-2-1,..Up:.4-2..4 |
| e7b00 | 2e 32 2e 32 20 41 6e 20 49 6e 74 65 72 70 72 65 74 65 72 20 77 69 74 68 20 4c 61 7a 79 20 45 76 | .2.2.An.Interpreter.with.Lazy.Ev |
| e7b20 | 61 6c 75 61 74 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | aluation.----------------------- |
| e7b40 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 6e 20 74 68 69 73 20 73 65 63 74 | ------------------..In.this.sect |
| e7b60 | 69 6f 6e 20 77 65 20 77 69 6c 6c 20 69 6d 70 6c 65 6d 65 6e 74 20 61 20 6e 6f 72 6d 61 6c 2d 6f | ion.we.will.implement.a.normal-o |
| e7b80 | 72 64 65 72 20 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 69 73 20 74 68 65 0a 73 61 6d 65 20 61 | rder.language.that.is.the.same.a |
| e7ba0 | 73 20 53 63 68 65 6d 65 20 65 78 63 65 70 74 20 74 68 61 74 20 63 6f 6d 70 6f 75 6e 64 20 70 72 | s.Scheme.except.that.compound.pr |
| e7bc0 | 6f 63 65 64 75 72 65 73 20 61 72 65 20 6e 6f 6e 2d 73 74 72 69 63 74 20 69 6e 20 65 61 63 68 0a | ocedures.are.non-strict.in.each. |
| e7be0 | 61 72 67 75 6d 65 6e 74 2e 20 20 50 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 20 | argument...Primitive.procedures. |
| e7c00 | 77 69 6c 6c 20 73 74 69 6c 6c 20 62 65 20 73 74 72 69 63 74 2e 20 20 49 74 20 69 73 20 6e 6f 74 | will.still.be.strict...It.is.not |
| e7c20 | 0a 64 69 66 66 69 63 75 6c 74 20 74 6f 20 6d 6f 64 69 66 79 20 74 68 65 20 65 76 61 6c 75 61 74 | .difficult.to.modify.the.evaluat |
| e7c40 | 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 20 73 6f 20 74 | or.of.section.*Note.4-1-1::.so.t |
| e7c60 | 68 61 74 20 74 68 65 0a 6c 61 6e 67 75 61 67 65 20 69 74 20 69 6e 74 65 72 70 72 65 74 73 20 62 | hat.the.language.it.interprets.b |
| e7c80 | 65 68 61 76 65 73 20 74 68 69 73 20 77 61 79 2e 20 20 41 6c 6d 6f 73 74 20 61 6c 6c 20 74 68 65 | ehaves.this.way...Almost.all.the |
| e7ca0 | 20 72 65 71 75 69 72 65 64 0a 63 68 61 6e 67 65 73 20 63 65 6e 74 65 72 20 61 72 6f 75 6e 64 20 | .required.changes.center.around. |
| e7cc0 | 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 0a 0a 20 20 20 54 68 65 20 62 | procedure.application......The.b |
| e7ce0 | 61 73 69 63 20 69 64 65 61 20 69 73 20 74 68 61 74 2c 20 77 68 65 6e 20 61 70 70 6c 79 69 6e 67 | asic.idea.is.that,.when.applying |
| e7d00 | 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 0a 6d 75 | .a.procedure,.the.interpreter.mu |
| e7d20 | 73 74 20 64 65 74 65 72 6d 69 6e 65 20 77 68 69 63 68 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 | st.determine.which.arguments.are |
| e7d40 | 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 61 6e 64 20 77 68 69 63 68 20 61 72 65 20 74 | .to.be.evaluated.and.which.are.t |
| e7d60 | 6f 20 62 65 0a 64 65 6c 61 79 65 64 2e 20 20 54 68 65 20 64 65 6c 61 79 65 64 20 61 72 67 75 6d | o.be.delayed...The.delayed.argum |
| e7d80 | 65 6e 74 73 20 61 72 65 20 6e 6f 74 20 65 76 61 6c 75 61 74 65 64 3b 20 69 6e 73 74 65 61 64 2c | ents.are.not.evaluated;.instead, |
| e7da0 | 20 74 68 65 79 20 61 72 65 0a 74 72 61 6e 73 66 6f 72 6d 65 64 20 69 6e 74 6f 20 6f 62 6a 65 63 | .they.are.transformed.into.objec |
| e7dc0 | 74 73 20 63 61 6c 6c 65 64 20 22 74 68 75 6e 6b 73 22 2e 28 31 29 20 54 68 65 20 74 68 75 6e 6b | ts.called."thunks".(1).The.thunk |
| e7de0 | 20 6d 75 73 74 20 63 6f 6e 74 61 69 6e 20 74 68 65 0a 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 72 65 | .must.contain.the.information.re |
| e7e00 | 71 75 69 72 65 64 20 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 | quired.to.produce.the.value.of.t |
| e7e20 | 68 65 20 61 72 67 75 6d 65 6e 74 20 77 68 65 6e 20 69 74 20 69 73 0a 6e 65 65 64 65 64 2c 20 61 | he.argument.when.it.is.needed,.a |
| e7e40 | 73 20 69 66 20 69 74 20 68 61 64 20 62 65 65 6e 20 65 76 61 6c 75 61 74 65 64 20 61 74 20 74 68 | s.if.it.had.been.evaluated.at.th |
| e7e60 | 65 20 74 69 6d 65 20 6f 66 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 0a 54 68 75 73 2c | e.time.of.the.application..Thus, |
| e7e80 | 20 74 68 65 20 74 68 75 6e 6b 20 6d 75 73 74 20 63 6f 6e 74 61 69 6e 20 74 68 65 20 61 72 67 75 | .the.thunk.must.contain.the.argu |
| e7ea0 | 6d 65 6e 74 20 65 78 70 72 65 73 73 69 6f 6e 20 61 6e 64 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d | ment.expression.and.the.environm |
| e7ec0 | 65 6e 74 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 | ent.in.which.the.procedure.appli |
| e7ee0 | 63 61 74 69 6f 6e 20 69 73 20 62 65 69 6e 67 20 65 76 61 6c 75 61 74 65 64 2e 0a 0a 20 20 20 54 | cation.is.being.evaluated......T |
| e7f00 | 68 65 20 70 72 6f 63 65 73 73 20 6f 66 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 | he.process.of.evaluating.the.exp |
| e7f20 | 72 65 73 73 69 6f 6e 20 69 6e 20 61 20 74 68 75 6e 6b 20 69 73 20 63 61 6c 6c 65 64 20 22 66 6f | ression.in.a.thunk.is.called."fo |
| e7f40 | 72 63 69 6e 67 22 2e 28 32 29 0a 49 6e 20 67 65 6e 65 72 61 6c 2c 20 61 20 74 68 75 6e 6b 20 77 | rcing".(2).In.general,.a.thunk.w |
| e7f60 | 69 6c 6c 20 62 65 20 66 6f 72 63 65 64 20 6f 6e 6c 79 20 77 68 65 6e 20 69 74 73 20 76 61 6c 75 | ill.be.forced.only.when.its.valu |
| e7f80 | 65 20 69 73 20 6e 65 65 64 65 64 3a 20 77 68 65 6e 0a 69 74 20 69 73 20 70 61 73 73 65 64 20 74 | e.is.needed:.when.it.is.passed.t |
| e7fa0 | 6f 20 61 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 77 69 6c | o.a.primitive.procedure.that.wil |
| e7fc0 | 6c 20 75 73 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 74 68 75 6e 6b 3b 20 77 68 | l.use.the.value.of.the.thunk;.wh |
| e7fe0 | 65 6e 20 69 74 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 61 20 70 72 65 64 69 63 61 74 | en.it.is.the.value.of.a.predicat |
| e8000 | 65 20 6f 66 20 61 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 3b 20 61 6e 64 20 77 68 65 6e 0a 69 74 20 | e.of.a.conditional;.and.when.it. |
| e8020 | 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 61 6e 20 6f 70 65 72 61 74 6f 72 20 74 68 61 74 | is.the.value.of.an.operator.that |
| e8040 | 20 69 73 20 61 62 6f 75 74 20 74 6f 20 62 65 20 61 70 70 6c 69 65 64 20 61 73 20 61 0a 70 72 6f | .is.about.to.be.applied.as.a.pro |
| e8060 | 63 65 64 75 72 65 2e 20 20 4f 6e 65 20 64 65 73 69 67 6e 20 63 68 6f 69 63 65 20 77 65 20 68 61 | cedure...One.design.choice.we.ha |
| e8080 | 76 65 20 61 76 61 69 6c 61 62 6c 65 20 69 73 20 77 68 65 74 68 65 72 20 6f 72 20 6e 6f 74 20 74 | ve.available.is.whether.or.not.t |
| e80a0 | 6f 20 22 6d 65 6d 6f 69 7a 65 22 0a 74 68 75 6e 6b 73 2c 20 61 73 20 77 65 20 64 69 64 20 77 69 | o."memoize".thunks,.as.we.did.wi |
| e80c0 | 74 68 20 64 65 6c 61 79 65 64 20 6f 62 6a 65 63 74 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e | th.delayed.objects.in.section.*N |
| e80e0 | 6f 74 65 20 33 2d 35 2d 31 3a 3a 2e 20 20 57 69 74 68 0a 6d 65 6d 6f 69 7a 61 74 69 6f 6e 2c 20 | ote.3-5-1::...With.memoization,. |
| e8100 | 74 68 65 20 66 69 72 73 74 20 74 69 6d 65 20 61 20 74 68 75 6e 6b 20 69 73 20 66 6f 72 63 65 64 | the.first.time.a.thunk.is.forced |
| e8120 | 2c 20 69 74 20 73 74 6f 72 65 73 20 74 68 65 20 76 61 6c 75 65 20 74 68 61 74 0a 69 73 20 63 6f | ,.it.stores.the.value.that.is.co |
| e8140 | 6d 70 75 74 65 64 2e 20 20 53 75 62 73 65 71 75 65 6e 74 20 66 6f 72 63 69 6e 67 73 20 73 69 6d | mputed...Subsequent.forcings.sim |
| e8160 | 70 6c 79 20 72 65 74 75 72 6e 20 74 68 65 20 73 74 6f 72 65 64 20 76 61 6c 75 65 0a 77 69 74 68 | ply.return.the.stored.value.with |
| e8180 | 6f 75 74 20 72 65 70 65 61 74 69 6e 67 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 | out.repeating.the.computation... |
| e81a0 | 57 65 27 6c 6c 20 6d 61 6b 65 20 6f 75 72 20 69 6e 74 65 72 70 72 65 74 65 72 20 6d 65 6d 6f 69 | We'll.make.our.interpreter.memoi |
| e81c0 | 7a 65 2c 0a 62 65 63 61 75 73 65 20 74 68 69 73 20 69 73 20 6d 6f 72 65 20 65 66 66 69 63 69 65 | ze,.because.this.is.more.efficie |
| e81e0 | 6e 74 20 66 6f 72 20 6d 61 6e 79 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 2e 20 20 54 68 65 72 65 | nt.for.many.applications...There |
| e8200 | 20 61 72 65 20 74 72 69 63 6b 79 0a 63 6f 6e 73 69 64 65 72 61 74 69 6f 6e 73 20 68 65 72 65 2c | .are.tricky.considerations.here, |
| e8220 | 20 68 6f 77 65 76 65 72 2e 28 33 29 0a 0a 4d 6f 64 69 66 79 69 6e 67 20 74 68 65 20 65 76 61 6c | .however.(3)..Modifying.the.eval |
| e8240 | 75 61 74 6f 72 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 | uator..........................T |
| e8260 | 68 65 20 6d 61 69 6e 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 65 20 6c | he.main.difference.between.the.l |
| e8280 | 61 7a 79 20 65 76 61 6c 75 61 74 6f 72 20 61 6e 64 20 74 68 65 20 6f 6e 65 20 69 6e 20 73 65 63 | azy.evaluator.and.the.one.in.sec |
| e82a0 | 74 69 6f 6e 0a 2a 4e 6f 74 65 20 34 2d 31 3a 3a 20 69 73 20 69 6e 20 74 68 65 20 68 61 6e 64 6c | tion.*Note.4-1::.is.in.the.handl |
| e82c0 | 69 6e 67 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 69 6e | ing.of.procedure.applications.in |
| e82e0 | 20 60 65 76 61 6c 27 20 61 6e 64 0a 60 61 70 70 6c 79 27 2e 0a 0a 20 20 20 54 68 65 20 60 61 70 | .`eval'.and.`apply'......The.`ap |
| e8300 | 70 6c 69 63 61 74 69 6f 6e 3f 27 20 63 6c 61 75 73 65 20 6f 66 20 60 65 76 61 6c 27 20 62 65 63 | plication?'.clause.of.`eval'.bec |
| e8320 | 6f 6d 65 73 0a 0a 20 20 20 20 20 28 28 61 70 70 6c 69 63 61 74 69 6f 6e 3f 20 65 78 70 29 0a 20 | omes.......((application?.exp).. |
| e8340 | 20 20 20 20 20 28 61 70 70 6c 79 20 28 61 63 74 75 61 6c 2d 76 61 6c 75 65 20 28 6f 70 65 72 61 | .....(apply.(actual-value.(opera |
| e8360 | 74 6f 72 20 65 78 70 29 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 65 72 | tor.exp).env)..............(oper |
| e8380 | 61 6e 64 73 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 65 6e 76 29 29 0a 0a 20 20 | ands.exp)..............env)).... |
| e83a0 | 20 54 68 69 73 20 69 73 20 61 6c 6d 6f 73 74 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 | .This.is.almost.the.same.as.the. |
| e83c0 | 60 61 70 70 6c 69 63 61 74 69 6f 6e 3f 27 20 63 6c 61 75 73 65 20 6f 66 20 60 65 76 61 6c 27 20 | `application?'.clause.of.`eval'. |
| e83e0 | 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 2e 20 20 46 6f 72 20 6c | in.section.*Note.4-1-1::...For.l |
| e8400 | 61 7a 79 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 68 6f 77 65 76 65 72 2c 20 77 65 20 63 61 6c 6c | azy.evaluation,.however,.we.call |
| e8420 | 20 60 61 70 70 6c 79 27 0a 77 69 74 68 20 74 68 65 20 6f 70 65 72 61 6e 64 20 65 78 70 72 65 73 | .`apply'.with.the.operand.expres |
| e8440 | 73 69 6f 6e 73 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 | sions,.rather.than.the.arguments |
| e8460 | 20 70 72 6f 64 75 63 65 64 20 62 79 0a 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 6d 2e 20 20 53 | .produced.by.evaluating.them...S |
| e8480 | 69 6e 63 65 20 77 65 20 77 69 6c 6c 20 6e 65 65 64 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e | ince.we.will.need.the.environmen |
| e84a0 | 74 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 0a 74 68 75 6e 6b 73 20 69 66 20 74 68 65 20 61 72 67 | t.to.construct.thunks.if.the.arg |
| e84c0 | 75 6d 65 6e 74 73 20 61 72 65 20 74 6f 20 62 65 20 64 65 6c 61 79 65 64 2c 20 77 65 20 6d 75 73 | uments.are.to.be.delayed,.we.mus |
| e84e0 | 74 20 70 61 73 73 20 74 68 69 73 20 61 73 20 77 65 6c 6c 2e 0a 57 65 20 73 74 69 6c 6c 20 65 76 | t.pass.this.as.well..We.still.ev |
| e8500 | 61 6c 75 61 74 65 20 74 68 65 20 6f 70 65 72 61 74 6f 72 2c 20 62 65 63 61 75 73 65 20 60 61 70 | aluate.the.operator,.because.`ap |
| e8520 | 70 6c 79 27 20 6e 65 65 64 73 20 74 68 65 20 61 63 74 75 61 6c 0a 70 72 6f 63 65 64 75 72 65 20 | ply'.needs.the.actual.procedure. |
| e8540 | 74 6f 20 62 65 20 61 70 70 6c 69 65 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 64 69 73 70 61 74 | to.be.applied.in.order.to.dispat |
| e8560 | 63 68 20 6f 6e 20 69 74 73 20 74 79 70 65 20 28 70 72 69 6d 69 74 69 76 65 0a 76 65 72 73 75 73 | ch.on.its.type.(primitive.versus |
| e8580 | 20 63 6f 6d 70 6f 75 6e 64 29 20 61 6e 64 20 61 70 70 6c 79 20 69 74 2e 0a 0a 20 20 20 57 68 65 | .compound).and.apply.it......Whe |
| e85a0 | 6e 65 76 65 72 20 77 65 20 6e 65 65 64 20 74 68 65 20 61 63 74 75 61 6c 20 76 61 6c 75 65 20 6f | never.we.need.the.actual.value.o |
| e85c0 | 66 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 77 65 20 75 73 65 0a 0a 20 20 20 20 20 28 64 | f.an.expression,.we.use.......(d |
| e85e0 | 65 66 69 6e 65 20 28 61 63 74 75 61 6c 2d 76 61 6c 75 65 20 65 78 70 20 65 6e 76 29 0a 20 20 20 | efine.(actual-value.exp.env).... |
| e8600 | 20 20 20 20 28 66 6f 72 63 65 2d 69 74 20 28 65 76 61 6c 20 65 78 70 20 65 6e 76 29 29 29 0a 0a | ....(force-it.(eval.exp.env))).. |
| e8620 | 69 6e 73 74 65 61 64 20 6f 66 20 6a 75 73 74 20 60 65 76 61 6c 27 2c 20 73 6f 20 74 68 61 74 20 | instead.of.just.`eval',.so.that. |
| e8640 | 69 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 27 73 20 76 61 6c 75 65 20 69 73 20 61 20 74 | if.the.expression's.value.is.a.t |
| e8660 | 68 75 6e 6b 2c 20 69 74 0a 77 69 6c 6c 20 62 65 20 66 6f 72 63 65 64 2e 0a 0a 20 20 20 4f 75 72 | hunk,.it.will.be.forced......Our |
| e8680 | 20 6e 65 77 20 76 65 72 73 69 6f 6e 20 6f 66 20 60 61 70 70 6c 79 27 20 69 73 20 61 6c 73 6f 20 | .new.version.of.`apply'.is.also. |
| e86a0 | 61 6c 6d 6f 73 74 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 76 65 72 73 69 6f 6e 20 69 | almost.the.same.as.the.version.i |
| e86c0 | 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 2e 20 20 54 68 65 20 64 69 | n.section.*Note.4-1-1::...The.di |
| e86e0 | 66 66 65 72 65 6e 63 65 20 69 73 20 74 68 61 74 20 60 65 76 61 6c 27 20 68 61 73 20 70 61 73 73 | fference.is.that.`eval'.has.pass |
| e8700 | 65 64 20 69 6e 0a 75 6e 65 76 61 6c 75 61 74 65 64 20 6f 70 65 72 61 6e 64 20 65 78 70 72 65 73 | ed.in.unevaluated.operand.expres |
| e8720 | 73 69 6f 6e 73 3a 20 46 6f 72 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 20 | sions:.For.primitive.procedures. |
| e8740 | 28 77 68 69 63 68 20 61 72 65 0a 73 74 72 69 63 74 29 2c 20 77 65 20 65 76 61 6c 75 61 74 65 20 | (which.are.strict),.we.evaluate. |
| e8760 | 61 6c 6c 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 62 65 66 6f 72 65 20 61 70 70 6c 79 69 6e | all.the.arguments.before.applyin |
| e8780 | 67 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 3b 0a 66 6f 72 20 63 6f 6d 70 6f 75 6e 64 20 70 72 | g.the.primitive;.for.compound.pr |
| e87a0 | 6f 63 65 64 75 72 65 73 20 28 77 68 69 63 68 20 61 72 65 20 6e 6f 6e 2d 73 74 72 69 63 74 29 20 | ocedures.(which.are.non-strict). |
| e87c0 | 77 65 20 64 65 6c 61 79 20 61 6c 6c 20 74 68 65 0a 61 72 67 75 6d 65 6e 74 73 20 62 65 66 6f 72 | we.delay.all.the.arguments.befor |
| e87e0 | 65 20 61 70 70 6c 79 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2e 0a 0a 20 20 20 20 20 | e.applying.the.procedure........ |
| e8800 | 28 64 65 66 69 6e 65 20 28 61 70 70 6c 79 20 70 72 6f 63 65 64 75 72 65 20 61 72 67 75 6d 65 6e | (define.(apply.procedure.argumen |
| e8820 | 74 73 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 70 72 69 6d 69 74 69 76 65 | ts.env)........(cond.((primitive |
| e8840 | 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 | -procedure?.procedure).......... |
| e8860 | 20 20 20 20 20 28 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 0a | .....(apply-primitive-procedure. |
| e8880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 20 20 | ...............procedure........ |
| e88a0 | 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 6f 66 2d 61 72 67 2d 76 61 6c 75 65 73 20 61 72 67 75 | ........(list-of-arg-values.argu |
| e88c0 | 6d 65 6e 74 73 20 65 6e 76 29 29 29 20 20 3b 20 63 68 61 6e 67 65 64 0a 20 20 20 20 20 20 20 20 | ments.env)))..;.changed......... |
| e88e0 | 20 20 20 20 20 28 28 63 6f 6d 70 6f 75 6e 64 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 65 | .....((compound-procedure?.proce |
| e8900 | 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 76 61 6c 2d 73 65 71 75 65 6e | dure)...............(eval-sequen |
| e8920 | 63 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 64 75 72 65 2d 62 6f 64 | ce................(procedure-bod |
| e8940 | 79 20 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 74 | y.procedure)................(ext |
| e8960 | 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | end-environment................. |
| e8980 | 28 70 72 6f 63 65 64 75 72 65 2d 70 61 72 61 6d 65 74 65 72 73 20 70 72 6f 63 65 64 75 72 65 29 | (procedure-parameters.procedure) |
| e89a0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 6f 66 2d 64 65 6c 61 79 65 | .................(list-of-delaye |
| e89c0 | 64 2d 61 72 67 73 20 61 72 67 75 6d 65 6e 74 73 20 65 6e 76 29 20 3b 20 63 68 61 6e 67 65 64 0a | d-args.arguments.env).;.changed. |
| e89e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 64 75 72 65 2d 65 6e 76 69 72 | ................(procedure-envir |
| e8a00 | 6f 6e 6d 65 6e 74 20 70 72 6f 63 65 64 75 72 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | onment.procedure))))............ |
| e8a20 | 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 0a 20 20 20 | ..(else...............(error.... |
| e8a40 | 20 20 20 20 20 20 20 20 20 20 20 20 22 55 6e 6b 6e 6f 77 6e 20 70 72 6f 63 65 64 75 72 65 20 74 | ............"Unknown.procedure.t |
| e8a60 | 79 70 65 20 2d 2d 20 41 50 50 4c 59 22 20 70 72 6f 63 65 64 75 72 65 29 29 29 29 0a 0a 20 20 20 | ype.--.APPLY".procedure))))..... |
| e8a80 | 54 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 70 72 6f 63 65 73 73 20 74 68 65 20 | The.procedures.that.process.the. |
| e8aa0 | 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 6a 75 73 74 20 6c 69 6b 65 0a 60 6c 69 73 74 2d 6f 66 | arguments.are.just.like.`list-of |
| e8ac0 | 2d 76 61 6c 75 65 73 27 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d | -values'.from.section.*Note.4-1- |
| e8ae0 | 31 3a 3a 2c 20 65 78 63 65 70 74 20 74 68 61 74 0a 60 6c 69 73 74 2d 6f 66 2d 64 65 6c 61 79 65 | 1::,.except.that.`list-of-delaye |
| e8b00 | 64 2d 61 72 67 73 27 20 64 65 6c 61 79 73 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 69 6e 73 | d-args'.delays.the.arguments.ins |
| e8b20 | 74 65 61 64 20 6f 66 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 6d 2c 0a 61 6e 64 20 60 6c 69 | tead.of.evaluating.them,.and.`li |
| e8b40 | 73 74 2d 6f 66 2d 61 72 67 2d 76 61 6c 75 65 73 27 20 75 73 65 73 20 60 61 63 74 75 61 6c 2d 76 | st-of-arg-values'.uses.`actual-v |
| e8b60 | 61 6c 75 65 27 20 69 6e 73 74 65 61 64 20 6f 66 20 60 65 76 61 6c 27 3a 0a 0a 20 20 20 20 20 28 | alue'.instead.of.`eval':.......( |
| e8b80 | 64 65 66 69 6e 65 20 28 6c 69 73 74 2d 6f 66 2d 61 72 67 2d 76 61 6c 75 65 73 20 65 78 70 73 20 | define.(list-of-arg-values.exps. |
| e8ba0 | 65 6e 76 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 2d 6f 70 65 72 61 6e 64 73 3f 20 65 78 | env)........(if.(no-operands?.ex |
| e8bc0 | 70 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 | ps)............'()............(c |
| e8be0 | 6f 6e 73 20 28 61 63 74 75 61 6c 2d 76 61 6c 75 65 20 28 66 69 72 73 74 2d 6f 70 65 72 61 6e 64 | ons.(actual-value.(first-operand |
| e8c00 | 20 65 78 70 73 29 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | .exps).env)..................(li |
| e8c20 | 73 74 2d 6f 66 2d 61 72 67 2d 76 61 6c 75 65 73 20 28 72 65 73 74 2d 6f 70 65 72 61 6e 64 73 20 | st-of-arg-values.(rest-operands. |
| e8c40 | 65 78 70 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | exps)........................... |
| e8c60 | 20 20 20 20 20 20 20 20 20 20 20 65 6e 76 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | ...........env)))).......(define |
| e8c80 | 20 28 6c 69 73 74 2d 6f 66 2d 64 65 6c 61 79 65 64 2d 61 72 67 73 20 65 78 70 73 20 65 6e 76 29 | .(list-of-delayed-args.exps.env) |
| e8ca0 | 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 2d 6f 70 65 72 61 6e 64 73 3f 20 65 78 70 73 29 0a | ........(if.(no-operands?.exps). |
| e8cc0 | 20 20 20 20 20 20 20 20 20 20 20 27 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 | ...........'()............(cons. |
| e8ce0 | 28 64 65 6c 61 79 2d 69 74 20 28 66 69 72 73 74 2d 6f 70 65 72 61 6e 64 20 65 78 70 73 29 20 65 | (delay-it.(first-operand.exps).e |
| e8d00 | 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 6f 66 2d 64 65 | nv)..................(list-of-de |
| e8d20 | 6c 61 79 65 64 2d 61 72 67 73 20 28 72 65 73 74 2d 6f 70 65 72 61 6e 64 73 20 65 78 70 73 29 0a | layed-args.(rest-operands.exps). |
| e8d40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| e8d60 | 20 20 20 20 20 20 20 65 6e 76 29 29 29 29 0a 0a 20 20 20 54 68 65 20 6f 74 68 65 72 20 70 6c 61 | .......env)))).....The.other.pla |
| e8d80 | 63 65 20 77 65 20 6d 75 73 74 20 63 68 61 6e 67 65 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 | ce.we.must.change.the.evaluator. |
| e8da0 | 69 73 20 69 6e 20 74 68 65 20 68 61 6e 64 6c 69 6e 67 20 6f 66 0a 60 69 66 27 2c 20 77 68 65 72 | is.in.the.handling.of.`if',.wher |
| e8dc0 | 65 20 77 65 20 6d 75 73 74 20 75 73 65 20 60 61 63 74 75 61 6c 2d 76 61 6c 75 65 27 20 69 6e 73 | e.we.must.use.`actual-value'.ins |
| e8de0 | 74 65 61 64 20 6f 66 20 60 65 76 61 6c 27 20 74 6f 20 67 65 74 20 74 68 65 0a 76 61 6c 75 65 20 | tead.of.`eval'.to.get.the.value. |
| e8e00 | 6f 66 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 65 78 70 72 65 73 73 69 6f 6e 20 62 65 66 6f | of.the.predicate.expression.befo |
| e8e20 | 72 65 20 74 65 73 74 69 6e 67 20 77 68 65 74 68 65 72 20 69 74 20 69 73 20 74 72 75 65 20 6f 72 | re.testing.whether.it.is.true.or |
| e8e40 | 0a 66 61 6c 73 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 61 6c 2d 69 66 20 65 | .false:.......(define.(eval-if.e |
| e8e60 | 78 70 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 74 72 75 65 3f 20 28 61 63 74 75 61 | xp.env)........(if.(true?.(actua |
| e8e80 | 6c 2d 76 61 6c 75 65 20 28 69 66 2d 70 72 65 64 69 63 61 74 65 20 65 78 70 29 20 65 6e 76 29 29 | l-value.(if-predicate.exp).env)) |
| e8ea0 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 65 76 61 6c 20 28 69 66 2d 63 6f 6e 73 65 71 75 65 6e 74 | ............(eval.(if-consequent |
| e8ec0 | 20 65 78 70 29 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 65 76 61 6c 20 28 69 66 2d | .exp).env)............(eval.(if- |
| e8ee0 | 61 6c 74 65 72 6e 61 74 69 76 65 20 65 78 70 29 20 65 6e 76 29 29 29 0a 0a 20 20 20 46 69 6e 61 | alternative.exp).env))).....Fina |
| e8f00 | 6c 6c 79 2c 20 77 65 20 6d 75 73 74 20 63 68 61 6e 67 65 20 74 68 65 20 60 64 72 69 76 65 72 2d | lly,.we.must.change.the.`driver- |
| e8f20 | 6c 6f 6f 70 27 20 70 72 6f 63 65 64 75 72 65 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 34 | loop'.procedure.(section.*Note.4 |
| e8f40 | 2d 31 2d 34 3a 3a 29 20 74 6f 20 75 73 65 20 60 61 63 74 75 61 6c 2d 76 61 6c 75 65 27 20 69 6e | -1-4::).to.use.`actual-value'.in |
| e8f60 | 73 74 65 61 64 20 6f 66 20 60 65 76 61 6c 27 2c 20 73 6f 20 74 68 61 74 20 69 66 20 61 20 64 65 | stead.of.`eval',.so.that.if.a.de |
| e8f80 | 6c 61 79 65 64 0a 76 61 6c 75 65 20 69 73 20 70 72 6f 70 61 67 61 74 65 64 20 62 61 63 6b 20 74 | layed.value.is.propagated.back.t |
| e8fa0 | 6f 20 74 68 65 20 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 6e 74 20 6c 6f 6f 70 2c 20 69 74 20 77 | o.the.read-eval-print.loop,.it.w |
| e8fc0 | 69 6c 6c 20 62 65 20 66 6f 72 63 65 64 0a 62 65 66 6f 72 65 20 62 65 69 6e 67 20 70 72 69 6e 74 | ill.be.forced.before.being.print |
| e8fe0 | 65 64 2e 20 20 57 65 20 61 6c 73 6f 20 63 68 61 6e 67 65 20 74 68 65 20 70 72 6f 6d 70 74 73 20 | ed...We.also.change.the.prompts. |
| e9000 | 74 6f 20 69 6e 64 69 63 61 74 65 20 74 68 61 74 20 74 68 69 73 0a 69 73 20 74 68 65 20 6c 61 7a | to.indicate.that.this.is.the.laz |
| e9020 | 79 20 65 76 61 6c 75 61 74 6f 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 70 75 74 | y.evaluator:.......(define.input |
| e9040 | 2d 70 72 6f 6d 70 74 20 22 3b 3b 3b 20 4c 2d 45 76 61 6c 20 69 6e 70 75 74 3a 22 29 0a 20 20 20 | -prompt.";;;.L-Eval.input:").... |
| e9060 | 20 20 28 64 65 66 69 6e 65 20 6f 75 74 70 75 74 2d 70 72 6f 6d 70 74 20 22 3b 3b 3b 20 4c 2d 45 | ..(define.output-prompt.";;;.L-E |
| e9080 | 76 61 6c 20 76 61 6c 75 65 3a 22 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 72 69 76 | val.value:").......(define.(driv |
| e90a0 | 65 72 2d 6c 6f 6f 70 29 0a 20 20 20 20 20 20 20 28 70 72 6f 6d 70 74 2d 66 6f 72 2d 69 6e 70 75 | er-loop)........(prompt-for-inpu |
| e90c0 | 74 20 69 6e 70 75 74 2d 70 72 6f 6d 70 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e | t.input-prompt)........(let.((in |
| e90e0 | 70 75 74 20 28 72 65 61 64 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6f 75 74 | put.(read)))..........(let.((out |
| e9100 | 70 75 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 63 74 75 61 6c 2d 76 61 6c 75 | put.................(actual-valu |
| e9120 | 65 20 69 6e 70 75 74 20 74 68 65 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 29 | e.input.the-global-environment)) |
| e9140 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 6e 6f 75 6e 63 65 2d 6f 75 74 70 75 74 20 6f 75 | )............(announce-output.ou |
| e9160 | 74 70 75 74 2d 70 72 6f 6d 70 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 75 73 65 72 2d 70 72 | tput-prompt)............(user-pr |
| e9180 | 69 6e 74 20 6f 75 74 70 75 74 29 29 29 0a 20 20 20 20 20 20 20 28 64 72 69 76 65 72 2d 6c 6f 6f | int.output)))........(driver-loo |
| e91a0 | 70 29 29 0a 0a 20 20 20 57 69 74 68 20 74 68 65 73 65 20 63 68 61 6e 67 65 73 20 6d 61 64 65 2c | p)).....With.these.changes.made, |
| e91c0 | 20 77 65 20 63 61 6e 20 73 74 61 72 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 61 6e 64 20 | .we.can.start.the.evaluator.and. |
| e91e0 | 74 65 73 74 20 69 74 2e 20 20 54 68 65 0a 73 75 63 63 65 73 73 66 75 6c 20 65 76 61 6c 75 61 74 | test.it...The.successful.evaluat |
| e9200 | 69 6f 6e 20 6f 66 20 74 68 65 20 60 74 72 79 27 20 65 78 70 72 65 73 73 69 6f 6e 20 64 69 73 63 | ion.of.the.`try'.expression.disc |
| e9220 | 75 73 73 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 34 2d 32 2d 31 3a 3a 20 69 | ussed.in.section.*Note.4-2-1::.i |
| e9240 | 6e 64 69 63 61 74 65 73 20 74 68 61 74 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 69 73 | ndicates.that.the.interpreter.is |
| e9260 | 20 70 65 72 66 6f 72 6d 69 6e 67 20 6c 61 7a 79 0a 65 76 61 6c 75 61 74 69 6f 6e 3a 0a 0a 20 20 | .performing.lazy.evaluation:.... |
| e9280 | 20 20 20 28 64 65 66 69 6e 65 20 74 68 65 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e | ...(define.the-global-environmen |
| e92a0 | 74 20 28 73 65 74 75 70 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 29 0a 0a 20 20 20 20 20 28 64 72 | t.(setup-environment)).......(dr |
| e92c0 | 69 76 65 72 2d 6c 6f 6f 70 29 0a 0a 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 69 6e 70 75 | iver-loop).......;;;.L-Eval.inpu |
| e92e0 | 74 3a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 79 20 61 20 62 29 0a 20 20 20 20 20 20 | t:......(define.(try.a.b)....... |
| e9300 | 20 28 69 66 20 28 3d 20 61 20 30 29 20 31 20 62 29 29 0a 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 | .(if.(=.a.0).1.b))......;;;.L-Ev |
| e9320 | 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 | al.value:......ok.......;;;.L-Ev |
| e9340 | 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 74 72 79 20 30 20 28 2f 20 31 20 30 29 29 0a 20 | al.input:......(try.0.(/.1.0)).. |
| e9360 | 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 31 0a 0a 52 65 | ....;;;.L-Eval.value:......1..Re |
| e9380 | 70 72 65 73 65 6e 74 69 6e 67 20 74 68 75 6e 6b 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | presenting.thunks............... |
| e93a0 | 2e 2e 2e 2e 2e 0a 0a 4f 75 72 20 65 76 61 6c 75 61 74 6f 72 20 6d 75 73 74 20 61 72 72 61 6e 67 | .......Our.evaluator.must.arrang |
| e93c0 | 65 20 74 6f 20 63 72 65 61 74 65 20 74 68 75 6e 6b 73 20 77 68 65 6e 20 70 72 6f 63 65 64 75 72 | e.to.create.thunks.when.procedur |
| e93e0 | 65 73 20 61 72 65 20 61 70 70 6c 69 65 64 0a 74 6f 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 | es.are.applied.to.arguments.and. |
| e9400 | 74 6f 20 66 6f 72 63 65 20 74 68 65 73 65 20 74 68 75 6e 6b 73 20 6c 61 74 65 72 2e 20 20 41 20 | to.force.these.thunks.later...A. |
| e9420 | 74 68 75 6e 6b 20 6d 75 73 74 20 70 61 63 6b 61 67 65 20 61 6e 0a 65 78 70 72 65 73 73 69 6f 6e | thunk.must.package.an.expression |
| e9440 | 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 | .together.with.the.environment,. |
| e9460 | 73 6f 20 74 68 61 74 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 63 61 6e 20 62 65 0a 70 72 6f 64 | so.that.the.argument.can.be.prod |
| e9480 | 75 63 65 64 20 6c 61 74 65 72 2e 20 20 54 6f 20 66 6f 72 63 65 20 74 68 65 20 74 68 75 6e 6b 2c | uced.later...To.force.the.thunk, |
| e94a0 | 20 77 65 20 73 69 6d 70 6c 79 20 65 78 74 72 61 63 74 20 74 68 65 20 65 78 70 72 65 73 73 69 6f | .we.simply.extract.the.expressio |
| e94c0 | 6e 0a 61 6e 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 66 72 6f 6d 20 74 68 65 20 74 68 75 6e 6b | n.and.environment.from.the.thunk |
| e94e0 | 20 61 6e 64 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 | .and.evaluate.the.expression.in. |
| e9500 | 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 57 65 20 75 73 65 20 60 61 63 74 75 61 6c | the.environment...We.use.`actual |
| e9520 | 2d 76 61 6c 75 65 27 20 72 61 74 68 65 72 20 74 68 61 6e 20 60 65 76 61 6c 27 20 73 6f 20 74 68 | -value'.rather.than.`eval'.so.th |
| e9540 | 61 74 20 69 6e 20 63 61 73 65 0a 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 65 78 70 72 | at.in.case.the.value.of.the.expr |
| e9560 | 65 73 73 69 6f 6e 20 69 73 20 69 74 73 65 6c 66 20 61 20 74 68 75 6e 6b 2c 20 77 65 20 77 69 6c | ession.is.itself.a.thunk,.we.wil |
| e9580 | 6c 20 66 6f 72 63 65 20 74 68 61 74 2c 20 61 6e 64 0a 73 6f 20 6f 6e 2c 20 75 6e 74 69 6c 20 77 | l.force.that,.and.so.on,.until.w |
| e95a0 | 65 20 72 65 61 63 68 20 73 6f 6d 65 74 68 69 6e 67 20 74 68 61 74 20 69 73 20 6e 6f 74 20 61 20 | e.reach.something.that.is.not.a. |
| e95c0 | 74 68 75 6e 6b 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6f 72 63 65 2d 69 74 20 6f | thunk:.......(define.(force-it.o |
| e95e0 | 62 6a 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 74 68 75 6e 6b 3f 20 6f 62 6a 29 0a 20 20 20 20 | bj)........(if.(thunk?.obj)..... |
| e9600 | 20 20 20 20 20 20 20 28 61 63 74 75 61 6c 2d 76 61 6c 75 65 20 28 74 68 75 6e 6b 2d 65 78 70 20 | .......(actual-value.(thunk-exp. |
| e9620 | 6f 62 6a 29 20 28 74 68 75 6e 6b 2d 65 6e 76 20 6f 62 6a 29 29 0a 20 20 20 20 20 20 20 20 20 20 | obj).(thunk-env.obj))........... |
| e9640 | 20 6f 62 6a 29 29 0a 0a 20 20 20 4f 6e 65 20 65 61 73 79 20 77 61 79 20 74 6f 20 70 61 63 6b 61 | .obj)).....One.easy.way.to.packa |
| e9660 | 67 65 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 77 69 74 68 20 61 6e 20 65 6e 76 69 72 6f 6e | ge.an.expression.with.an.environ |
| e9680 | 6d 65 6e 74 20 69 73 20 74 6f 20 6d 61 6b 65 0a 61 20 6c 69 73 74 20 63 6f 6e 74 61 69 6e 69 6e | ment.is.to.make.a.list.containin |
| e96a0 | 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 61 6e 64 20 74 68 65 20 65 6e 76 69 72 6f 6e | g.the.expression.and.the.environ |
| e96c0 | 6d 65 6e 74 2e 20 20 54 68 75 73 2c 20 77 65 20 63 72 65 61 74 65 0a 61 20 74 68 75 6e 6b 20 61 | ment...Thus,.we.create.a.thunk.a |
| e96e0 | 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 65 6c 61 79 2d | s.follows:.......(define.(delay- |
| e9700 | 69 74 20 65 78 70 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 74 68 75 6e 6b 20 | it.exp.env)........(list.'thunk. |
| e9720 | 65 78 70 20 65 6e 76 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 68 75 6e 6b 3f 20 | exp.env)).......(define.(thunk?. |
| e9740 | 6f 62 6a 29 0a 20 20 20 20 20 20 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 6f 62 6a 20 27 74 | obj)........(tagged-list?.obj.'t |
| e9760 | 68 75 6e 6b 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 68 75 6e 6b 2d 65 78 70 20 | hunk)).......(define.(thunk-exp. |
| e9780 | 74 68 75 6e 6b 29 20 28 63 61 64 72 20 74 68 75 6e 6b 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 | thunk).(cadr.thunk)).......(defi |
| e97a0 | 6e 65 20 28 74 68 75 6e 6b 2d 65 6e 76 20 74 68 75 6e 6b 29 20 28 63 61 64 64 72 20 74 68 75 6e | ne.(thunk-env.thunk).(caddr.thun |
| e97c0 | 6b 29 29 0a 0a 20 20 20 41 63 74 75 61 6c 6c 79 2c 20 77 68 61 74 20 77 65 20 77 61 6e 74 20 66 | k)).....Actually,.what.we.want.f |
| e97e0 | 6f 72 20 6f 75 72 20 69 6e 74 65 72 70 72 65 74 65 72 20 69 73 20 6e 6f 74 20 71 75 69 74 65 20 | or.our.interpreter.is.not.quite. |
| e9800 | 74 68 69 73 2c 20 62 75 74 0a 72 61 74 68 65 72 20 74 68 75 6e 6b 73 20 74 68 61 74 20 68 61 76 | this,.but.rather.thunks.that.hav |
| e9820 | 65 20 62 65 65 6e 20 6d 65 6d 6f 69 7a 65 64 2e 20 20 57 68 65 6e 20 61 20 74 68 75 6e 6b 20 69 | e.been.memoized...When.a.thunk.i |
| e9840 | 73 20 66 6f 72 63 65 64 2c 20 77 65 20 77 69 6c 6c 0a 74 75 72 6e 20 69 74 20 69 6e 74 6f 20 61 | s.forced,.we.will.turn.it.into.a |
| e9860 | 6e 20 65 76 61 6c 75 61 74 65 64 20 74 68 75 6e 6b 20 62 79 20 72 65 70 6c 61 63 69 6e 67 20 74 | n.evaluated.thunk.by.replacing.t |
| e9880 | 68 65 20 73 74 6f 72 65 64 20 65 78 70 72 65 73 73 69 6f 6e 20 77 69 74 68 0a 69 74 73 20 76 61 | he.stored.expression.with.its.va |
| e98a0 | 6c 75 65 20 61 6e 64 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 60 74 68 75 6e 6b 27 20 74 61 67 | lue.and.changing.the.`thunk'.tag |
| e98c0 | 20 73 6f 20 74 68 61 74 20 69 74 20 63 61 6e 20 62 65 20 72 65 63 6f 67 6e 69 7a 65 64 20 61 73 | .so.that.it.can.be.recognized.as |
| e98e0 | 0a 61 6c 72 65 61 64 79 20 65 76 61 6c 75 61 74 65 64 2e 28 34 29 0a 0a 20 20 20 20 20 28 64 65 | .already.evaluated.(4).......(de |
| e9900 | 66 69 6e 65 20 28 65 76 61 6c 75 61 74 65 64 2d 74 68 75 6e 6b 3f 20 6f 62 6a 29 0a 20 20 20 20 | fine.(evaluated-thunk?.obj)..... |
| e9920 | 20 20 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 6f 62 6a 20 27 65 76 61 6c 75 61 74 65 64 2d | ...(tagged-list?.obj.'evaluated- |
| e9940 | 74 68 75 6e 6b 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 68 75 6e 6b 2d 76 61 6c | thunk)).......(define.(thunk-val |
| e9960 | 75 65 20 65 76 61 6c 75 61 74 65 64 2d 74 68 75 6e 6b 29 20 28 63 61 64 72 20 65 76 61 6c 75 61 | ue.evaluated-thunk).(cadr.evalua |
| e9980 | 74 65 64 2d 74 68 75 6e 6b 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6f 72 63 65 | ted-thunk)).......(define.(force |
| e99a0 | 2d 69 74 20 6f 62 6a 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 74 68 75 6e 6b 3f 20 6f | -it.obj)........(cond.((thunk?.o |
| e99c0 | 62 6a 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 73 75 6c 74 20 | bj)...............(let.((result. |
| e99e0 | 28 61 63 74 75 61 6c 2d 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (actual-value................... |
| e9a00 | 20 20 20 20 20 20 20 20 20 20 20 28 74 68 75 6e 6b 2d 65 78 70 20 6f 62 6a 29 0a 20 20 20 20 20 | ...........(thunk-exp.obj)...... |
| e9a20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 68 75 6e 6b 2d 65 | ........................(thunk-e |
| e9a40 | 6e 76 20 6f 62 6a 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d | nv.obj)))).................(set- |
| e9a60 | 63 61 72 21 20 6f 62 6a 20 27 65 76 61 6c 75 61 74 65 64 2d 74 68 75 6e 6b 29 0a 20 20 20 20 20 | car!.obj.'evaluated-thunk)...... |
| e9a80 | 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 61 72 21 20 28 63 64 72 20 6f 62 6a 29 20 72 | ...........(set-car!.(cdr.obj).r |
| e9aa0 | 65 73 75 6c 74 29 20 20 3b 20 72 65 70 6c 61 63 65 20 60 65 78 70 27 20 77 69 74 68 20 69 74 73 | esult)..;.replace.`exp'.with.its |
| e9ac0 | 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 64 72 21 | .value.................(set-cdr! |
| e9ae0 | 20 28 63 64 72 20 6f 62 6a 29 20 27 28 29 29 20 20 20 20 20 3b 20 66 6f 72 67 65 74 20 75 6e 6e | .(cdr.obj).'()).....;.forget.unn |
| e9b00 | 65 65 64 65 64 20 60 65 6e 76 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 73 75 | eeded.`env'.................resu |
| e9b20 | 6c 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 76 61 6c 75 61 74 65 64 2d 74 68 | lt))..............((evaluated-th |
| e9b40 | 75 6e 6b 3f 20 6f 62 6a 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 68 75 6e 6b 2d 76 | unk?.obj)...............(thunk-v |
| e9b60 | 61 6c 75 65 20 6f 62 6a 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 6f 62 | alue.obj))..............(else.ob |
| e9b80 | 6a 29 29 29 0a 0a 20 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 74 68 65 20 73 61 6d 65 20 60 64 | j))).....Notice.that.the.same.`d |
| e9ba0 | 65 6c 61 79 2d 69 74 27 20 70 72 6f 63 65 64 75 72 65 20 77 6f 72 6b 73 20 62 6f 74 68 20 77 69 | elay-it'.procedure.works.both.wi |
| e9bc0 | 74 68 20 61 6e 64 20 77 69 74 68 6f 75 74 0a 6d 65 6d 6f 69 7a 61 74 69 6f 6e 2e 0a 0a 20 20 20 | th.and.without.memoization...... |
| e9be0 | 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 32 37 3a 2a 20 53 75 70 70 6f 73 65 20 77 65 20 74 79 | ..*Exercise.4.27:*.Suppose.we.ty |
| e9c00 | 70 65 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 | pe.in.the.following.definitions. |
| e9c20 | 74 6f 0a 20 20 20 20 20 74 68 65 20 6c 61 7a 79 20 65 76 61 6c 75 61 74 6f 72 3a 0a 0a 20 20 20 | to......the.lazy.evaluator:..... |
| e9c40 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 63 6f 75 6e 74 20 30 29 0a 0a 20 20 20 20 20 20 20 | .......(define.count.0)......... |
| e9c60 | 20 20 20 28 64 65 66 69 6e 65 20 28 69 64 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 | ...(define.(id.x).............(s |
| e9c80 | 65 74 21 20 63 6f 75 6e 74 20 28 2b 20 63 6f 75 6e 74 20 31 29 29 0a 20 20 20 20 20 20 20 20 20 | et!.count.(+.count.1)).......... |
| e9ca0 | 20 20 20 78 29 0a 0a 20 20 20 20 20 47 69 76 65 20 74 68 65 20 6d 69 73 73 69 6e 67 20 76 61 6c | ...x).......Give.the.missing.val |
| e9cc0 | 75 65 73 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 65 71 75 65 6e 63 65 20 6f 66 | ues.in.the.following.sequence.of |
| e9ce0 | 20 69 6e 74 65 72 61 63 74 69 6f 6e 73 2c 0a 20 20 20 20 20 61 6e 64 20 65 78 70 6c 61 69 6e 20 | .interactions,......and.explain. |
| e9d00 | 79 6f 75 72 20 61 6e 73 77 65 72 73 2e 28 35 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | your.answers.(5)............(def |
| e9d20 | 69 6e 65 20 77 20 28 69 64 20 28 69 64 20 31 30 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 3b | ine.w.(id.(id.10)))............; |
| e9d40 | 3b 3b 20 4c 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 63 6f 75 6e 74 | ;;.L-Eval.input:...........count |
| e9d60 | 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 | ...........;;;.L-Eval.value:.... |
| e9d80 | 20 20 20 20 20 20 20 3c 52 45 53 50 4f 4e 53 45 3e 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b | .......<RESPONSE>............;;; |
| e9da0 | 20 4c 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 77 0a 20 20 20 20 20 | .L-Eval.input:...........w...... |
| e9dc0 | 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 20 20 20 20 | .....;;;.L-Eval.value:.......... |
| e9de0 | 20 3c 52 45 53 50 4f 4e 53 45 3e 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 | .<RESPONSE>............;;;.L-Eva |
| e9e00 | 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 63 6f 75 6e 74 0a 20 20 20 20 20 20 20 | l.input:...........count........ |
| e9e20 | 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 20 20 20 20 20 3c | ...;;;.L-Eval.value:...........< |
| e9e40 | 52 45 53 50 4f 4e 53 45 3e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 32 38 3a 2a | RESPONSE>.......*Exercise.4.28:* |
| e9e60 | 20 60 45 76 61 6c 27 20 75 73 65 73 20 60 61 63 74 75 61 6c 2d 76 61 6c 75 65 27 20 72 61 74 68 | .`Eval'.uses.`actual-value'.rath |
| e9e80 | 65 72 20 74 68 61 6e 20 60 65 76 61 6c 27 20 74 6f 0a 20 20 20 20 20 65 76 61 6c 75 61 74 65 20 | er.than.`eval'.to......evaluate. |
| e9ea0 | 74 68 65 20 6f 70 65 72 61 74 6f 72 20 62 65 66 6f 72 65 20 70 61 73 73 69 6e 67 20 69 74 20 74 | the.operator.before.passing.it.t |
| e9ec0 | 6f 20 60 61 70 70 6c 79 27 2c 20 69 6e 20 6f 72 64 65 72 20 74 6f 0a 20 20 20 20 20 66 6f 72 63 | o.`apply',.in.order.to......forc |
| e9ee0 | 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 6f 70 65 72 61 74 6f 72 2e 20 20 47 69 | e.the.value.of.the.operator...Gi |
| e9f00 | 76 65 20 61 6e 20 65 78 61 6d 70 6c 65 20 74 68 61 74 0a 20 20 20 20 20 64 65 6d 6f 6e 73 74 72 | ve.an.example.that......demonstr |
| e9f20 | 61 74 65 73 20 74 68 65 20 6e 65 65 64 20 66 6f 72 20 74 68 69 73 20 66 6f 72 63 69 6e 67 2e 0a | ates.the.need.for.this.forcing.. |
| e9f40 | 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 32 39 3a 2a 20 45 78 68 69 62 69 74 20 61 | ......*Exercise.4.29:*.Exhibit.a |
| e9f60 | 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 79 6f 75 20 77 6f 75 6c 64 20 65 78 70 65 63 74 20 74 | .program.that.you.would.expect.t |
| e9f80 | 6f 20 72 75 6e 0a 20 20 20 20 20 6d 75 63 68 20 6d 6f 72 65 20 73 6c 6f 77 6c 79 20 77 69 74 68 | o.run......much.more.slowly.with |
| e9fa0 | 6f 75 74 20 6d 65 6d 6f 69 7a 61 74 69 6f 6e 20 74 68 61 6e 20 77 69 74 68 20 6d 65 6d 6f 69 7a | out.memoization.than.with.memoiz |
| e9fc0 | 61 74 69 6f 6e 2e 20 20 41 6c 73 6f 2c 0a 20 20 20 20 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 | ation...Also,......consider.the. |
| e9fe0 | 66 6f 6c 6c 6f 77 69 6e 67 20 69 6e 74 65 72 61 63 74 69 6f 6e 2c 20 77 68 65 72 65 20 74 68 65 | following.interaction,.where.the |
| ea000 | 20 60 69 64 27 20 70 72 6f 63 65 64 75 72 65 20 69 73 0a 20 20 20 20 20 64 65 66 69 6e 65 64 20 | .`id'.procedure.is......defined. |
| ea020 | 61 73 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 32 37 3a 3a 20 61 6e 64 20 | as.in.*Note.Exercise.4-27::.and. |
| ea040 | 60 63 6f 75 6e 74 27 20 73 74 61 72 74 73 20 61 74 20 30 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 | `count'.starts.at.0:............ |
| ea060 | 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | (define.(square.x).............( |
| ea080 | 2a 20 78 20 78 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 69 6e | *.x.x))............;;;.L-Eval.in |
| ea0a0 | 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 28 73 71 75 61 72 65 20 28 69 64 20 31 30 29 29 0a | put:...........(square.(id.10)). |
| ea0c0 | 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 | ..........;;;.L-Eval.value:..... |
| ea0e0 | 20 20 20 20 20 20 3c 52 45 53 50 4f 4e 53 45 3e 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 | ......<RESPONSE>............;;;. |
| ea100 | 4c 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 63 6f 75 6e 74 0a 20 20 | L-Eval.input:...........count... |
| ea120 | 20 20 20 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 20 | ........;;;.L-Eval.value:....... |
| ea140 | 20 20 20 20 3c 52 45 53 50 4f 4e 53 45 3e 0a 0a 20 20 20 20 20 47 69 76 65 20 74 68 65 20 72 65 | ....<RESPONSE>.......Give.the.re |
| ea160 | 73 70 6f 6e 73 65 73 20 62 6f 74 68 20 77 68 65 6e 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 | sponses.both.when.the.evaluator. |
| ea180 | 6d 65 6d 6f 69 7a 65 73 20 61 6e 64 20 77 68 65 6e 20 69 74 0a 20 20 20 20 20 64 6f 65 73 20 6e | memoizes.and.when.it......does.n |
| ea1a0 | 6f 74 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 33 30 3a 2a 20 43 79 20 44 2e | ot........*Exercise.4.30:*.Cy.D. |
| ea1c0 | 20 46 65 63 74 2c 20 61 20 72 65 66 6f 72 6d 65 64 20 43 20 70 72 6f 67 72 61 6d 6d 65 72 2c 20 | .Fect,.a.reformed.C.programmer,. |
| ea1e0 | 69 73 20 77 6f 72 72 69 65 64 0a 20 20 20 20 20 74 68 61 74 20 73 6f 6d 65 20 73 69 64 65 20 65 | is.worried......that.some.side.e |
| ea200 | 66 66 65 63 74 73 20 6d 61 79 20 6e 65 76 65 72 20 74 61 6b 65 20 70 6c 61 63 65 2c 20 62 65 63 | ffects.may.never.take.place,.bec |
| ea220 | 61 75 73 65 20 74 68 65 20 6c 61 7a 79 0a 20 20 20 20 20 65 76 61 6c 75 61 74 6f 72 20 64 6f 65 | ause.the.lazy......evaluator.doe |
| ea240 | 73 6e 27 74 20 66 6f 72 63 65 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 61 20 | sn't.force.the.expressions.in.a. |
| ea260 | 73 65 71 75 65 6e 63 65 2e 20 20 53 69 6e 63 65 20 74 68 65 0a 20 20 20 20 20 76 61 6c 75 65 20 | sequence...Since.the......value. |
| ea280 | 6f 66 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 61 20 73 65 71 75 65 6e 63 65 20 6f | of.an.expression.in.a.sequence.o |
| ea2a0 | 74 68 65 72 20 74 68 61 6e 20 74 68 65 20 6c 61 73 74 20 6f 6e 65 20 69 73 0a 20 20 20 20 20 6e | ther.than.the.last.one.is......n |
| ea2c0 | 6f 74 20 75 73 65 64 20 28 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 74 68 65 72 65 | ot.used.(the.expression.is.there |
| ea2e0 | 20 6f 6e 6c 79 20 66 6f 72 20 69 74 73 20 65 66 66 65 63 74 2c 20 73 75 63 68 20 61 73 0a 20 20 | .only.for.its.effect,.such.as... |
| ea300 | 20 20 20 61 73 73 69 67 6e 69 6e 67 20 74 6f 20 61 20 76 61 72 69 61 62 6c 65 20 6f 72 20 70 72 | ...assigning.to.a.variable.or.pr |
| ea320 | 69 6e 74 69 6e 67 29 2c 20 74 68 65 72 65 20 63 61 6e 20 62 65 20 6e 6f 20 73 75 62 73 65 71 75 | inting),.there.can.be.no.subsequ |
| ea340 | 65 6e 74 0a 20 20 20 20 20 75 73 65 20 6f 66 20 74 68 69 73 20 76 61 6c 75 65 20 28 65 2e 67 2e | ent......use.of.this.value.(e.g. |
| ea360 | 2c 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 61 20 70 72 69 6d 69 74 69 76 65 20 | ,.as.an.argument.to.a.primitive. |
| ea380 | 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 74 68 61 74 20 77 69 6c 6c 20 63 61 75 73 65 20 | procedure)......that.will.cause. |
| ea3a0 | 69 74 20 74 6f 20 62 65 20 66 6f 72 63 65 64 2e 20 20 43 79 20 74 68 75 73 20 74 68 69 6e 6b 73 | it.to.be.forced...Cy.thus.thinks |
| ea3c0 | 20 74 68 61 74 20 77 68 65 6e 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6e 67 20 73 65 71 75 65 | .that.when......evaluating.seque |
| ea3e0 | 6e 63 65 73 2c 20 77 65 20 6d 75 73 74 20 66 6f 72 63 65 20 61 6c 6c 20 65 78 70 72 65 73 73 69 | nces,.we.must.force.all.expressi |
| ea400 | 6f 6e 73 20 69 6e 20 74 68 65 0a 20 20 20 20 20 73 65 71 75 65 6e 63 65 20 65 78 63 65 70 74 20 | ons.in.the......sequence.except. |
| ea420 | 74 68 65 20 66 69 6e 61 6c 20 6f 6e 65 2e 20 20 48 65 20 70 72 6f 70 6f 73 65 73 20 74 6f 20 6d | the.final.one...He.proposes.to.m |
| ea440 | 6f 64 69 66 79 0a 20 20 20 20 20 60 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 27 20 66 72 6f 6d 20 | odify......`eval-sequence'.from. |
| ea460 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 20 74 6f 20 75 73 65 20 60 61 63 | section.*Note.4-1-1::.to.use.`ac |
| ea480 | 74 75 61 6c 2d 76 61 6c 75 65 27 0a 20 20 20 20 20 72 61 74 68 65 72 20 74 68 61 6e 20 60 65 76 | tual-value'......rather.than.`ev |
| ea4a0 | 61 6c 27 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 76 61 6c 2d 73 65 | al':............(define.(eval-se |
| ea4c0 | 71 75 65 6e 63 65 20 65 78 70 73 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f | quence.exps.env).............(co |
| ea4e0 | 6e 64 20 28 28 6c 61 73 74 2d 65 78 70 3f 20 65 78 70 73 29 20 28 65 76 61 6c 20 28 66 69 72 73 | nd.((last-exp?.exps).(eval.(firs |
| ea500 | 74 2d 65 78 70 20 65 78 70 73 29 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | t-exp.exps).env))............... |
| ea520 | 20 20 20 20 28 65 6c 73 65 20 28 61 63 74 75 61 6c 2d 76 61 6c 75 65 20 28 66 69 72 73 74 2d 65 | ....(else.(actual-value.(first-e |
| ea540 | 78 70 20 65 78 70 73 29 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | xp.exps).env)................... |
| ea560 | 20 20 20 20 20 20 28 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 20 28 72 65 73 74 2d 65 78 70 73 20 | ......(eval-sequence.(rest-exps. |
| ea580 | 65 78 70 73 29 20 65 6e 76 29 29 29 29 0a 0a 20 20 20 20 20 20 20 61 2e 20 42 65 6e 20 42 69 74 | exps).env)))).........a..Ben.Bit |
| ea5a0 | 64 69 64 64 6c 65 20 74 68 69 6e 6b 73 20 43 79 20 69 73 20 77 72 6f 6e 67 2e 20 20 48 65 20 73 | diddle.thinks.Cy.is.wrong...He.s |
| ea5c0 | 68 6f 77 73 20 43 79 20 74 68 65 20 60 66 6f 72 2d 65 61 63 68 27 0a 20 20 20 20 20 20 20 20 20 | hows.Cy.the.`for-each'.......... |
| ea5e0 | 20 70 72 6f 63 65 64 75 72 65 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 | .procedure.described.in.*Note.Ex |
| ea600 | 65 72 63 69 73 65 20 32 2d 32 33 3a 3a 2c 20 77 68 69 63 68 20 67 69 76 65 73 20 61 6e 0a 20 20 | ercise.2-23::,.which.gives.an... |
| ea620 | 20 20 20 20 20 20 20 20 69 6d 70 6f 72 74 61 6e 74 20 65 78 61 6d 70 6c 65 20 6f 66 20 61 20 73 | ........important.example.of.a.s |
| ea640 | 65 71 75 65 6e 63 65 20 77 69 74 68 20 73 69 64 65 20 65 66 66 65 63 74 73 3a 0a 0a 20 20 20 20 | equence.with.side.effects:...... |
| ea660 | 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6f 72 2d 65 61 63 68 20 70 72 6f | ...........(define.(for-each.pro |
| ea680 | 63 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e | c.items)..................(if.(n |
| ea6a0 | 75 6c 6c 3f 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ull?.items)..................... |
| ea6c0 | 20 27 64 6f 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 | .'done......................(beg |
| ea6e0 | 69 6e 20 28 70 72 6f 63 20 28 63 61 72 20 69 74 65 6d 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 | in.(proc.(car.items))........... |
| ea700 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 20 70 72 6f 63 | ..................(for-each.proc |
| ea720 | 20 28 63 64 72 20 69 74 65 6d 73 29 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 48 65 20 63 | .(cdr.items)))))............He.c |
| ea740 | 6c 61 69 6d 73 20 74 68 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 74 68 65 20 | laims.that.the.evaluator.in.the. |
| ea760 | 74 65 78 74 20 28 77 69 74 68 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 0a 20 20 20 20 20 20 20 20 | text.(with.the.original......... |
| ea780 | 20 20 60 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 27 29 20 68 61 6e 64 6c 65 73 20 74 68 69 73 20 | ..`eval-sequence').handles.this. |
| ea7a0 | 63 6f 72 72 65 63 74 6c 79 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 4c | correctly:.................;;;.L |
| ea7c0 | 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 6f 72 | -Eval.input:................(for |
| ea7e0 | 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 78 29 20 28 6e 65 77 6c 69 6e 65 29 20 28 64 69 73 | -each.(lambda.(x).(newline).(dis |
| ea800 | 70 6c 61 79 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | play.x))........................ |
| ea820 | 20 20 28 6c 69 73 74 20 35 37 20 33 32 31 20 38 38 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..(list.57.321.88))............. |
| ea840 | 20 20 20 35 37 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 32 31 0a 20 20 20 20 20 20 20 | ...57................321........ |
| ea860 | 20 20 20 20 20 20 20 20 38 38 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 4c 2d | ........88................;;;.L- |
| ea880 | 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 6f 6e 65 0a | Eval.value:................done. |
| ea8a0 | 0a 20 20 20 20 20 20 20 20 20 20 45 78 70 6c 61 69 6e 20 77 68 79 20 42 65 6e 20 69 73 20 72 69 | ...........Explain.why.Ben.is.ri |
| ea8c0 | 67 68 74 20 61 62 6f 75 74 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 60 66 6f 72 2d 65 | ght.about.the.behavior.of.`for-e |
| ea8e0 | 61 63 68 27 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 43 79 20 61 67 72 65 65 73 20 74 68 61 74 20 | ach'..........b..Cy.agrees.that. |
| ea900 | 42 65 6e 20 69 73 20 72 69 67 68 74 20 61 62 6f 75 74 20 74 68 65 20 60 66 6f 72 2d 65 61 63 68 | Ben.is.right.about.the.`for-each |
| ea920 | 27 20 65 78 61 6d 70 6c 65 2c 20 62 75 74 0a 20 20 20 20 20 20 20 20 20 20 73 61 79 73 20 74 68 | '.example,.but...........says.th |
| ea940 | 61 74 20 74 68 61 74 27 73 20 6e 6f 74 20 74 68 65 20 6b 69 6e 64 20 6f 66 20 70 72 6f 67 72 61 | at.that's.not.the.kind.of.progra |
| ea960 | 6d 20 68 65 20 77 61 73 20 74 68 69 6e 6b 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 61 62 6f 75 | m.he.was.thinking...........abou |
| ea980 | 74 20 77 68 65 6e 20 68 65 20 70 72 6f 70 6f 73 65 64 20 68 69 73 20 63 68 61 6e 67 65 20 74 6f | t.when.he.proposed.his.change.to |
| ea9a0 | 20 60 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 27 2e 20 20 48 65 0a 20 20 20 20 20 20 20 20 20 20 | .`eval-sequence'...He........... |
| ea9c0 | 64 65 66 69 6e 65 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 77 6f 20 70 72 6f 63 65 64 | defines.the.following.two.proced |
| ea9e0 | 75 72 65 73 20 69 6e 20 74 68 65 20 6c 61 7a 79 20 65 76 61 6c 75 61 74 6f 72 3a 0a 0a 20 20 20 | ures.in.the.lazy.evaluator:..... |
| eaa00 | 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 31 20 78 29 0a 20 20 20 20 20 | ............(define.(p1.x)...... |
| eaa20 | 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 78 20 28 63 6f 6e 73 20 78 20 27 28 32 29 | ............(set!.x.(cons.x.'(2) |
| eaa40 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 29 0a 0a 20 20 20 20 20 20 20 20 | ))..................x).......... |
| eaa60 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 32 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 | .......(define.(p2.x)........... |
| eaa80 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 20 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .......(define.(p.e)............ |
| eaaa0 | 20 20 20 20 20 20 20 20 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 29 0a | ........e....................x). |
| eaac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 20 28 73 65 74 21 20 78 20 28 63 6f 6e | .................(p.(set!.x.(con |
| eaae0 | 73 20 78 20 27 28 32 29 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 57 68 61 74 20 61 72 65 | s.x.'(2)))))............What.are |
| eab00 | 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 60 28 70 31 20 31 29 27 20 61 6e 64 20 60 28 70 32 | .the.values.of.`(p1.1)'.and.`(p2 |
| eab20 | 20 31 29 27 20 77 69 74 68 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 0a 20 20 20 20 20 20 20 20 20 | .1)'.with.the.original.......... |
| eab40 | 20 60 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 27 3f 20 20 57 68 61 74 20 77 6f 75 6c 64 20 74 68 | .`eval-sequence'?..What.would.th |
| eab60 | 65 20 76 61 6c 75 65 73 20 62 65 20 77 69 74 68 20 43 79 27 73 20 70 72 6f 70 6f 73 65 64 0a 20 | e.values.be.with.Cy's.proposed.. |
| eab80 | 20 20 20 20 20 20 20 20 20 63 68 61 6e 67 65 20 74 6f 20 60 65 76 61 6c 2d 73 65 71 75 65 6e 63 | .........change.to.`eval-sequenc |
| eaba0 | 65 27 3f 0a 0a 20 20 20 20 20 20 20 63 2e 20 43 79 20 61 6c 73 6f 20 70 6f 69 6e 74 73 20 6f 75 | e'?.........c..Cy.also.points.ou |
| eabc0 | 74 20 74 68 61 74 20 63 68 61 6e 67 69 6e 67 20 60 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 27 20 | t.that.changing.`eval-sequence'. |
| eabe0 | 61 73 20 68 65 0a 20 20 20 20 20 20 20 20 20 20 70 72 6f 70 6f 73 65 73 20 64 6f 65 73 20 6e 6f | as.he...........proposes.does.no |
| eac00 | 74 20 61 66 66 65 63 74 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 20 65 78 61 | t.affect.the.behavior.of.the.exa |
| eac20 | 6d 70 6c 65 20 69 6e 20 70 61 72 74 0a 20 20 20 20 20 20 20 20 20 20 61 2e 20 20 45 78 70 6c 61 | mple.in.part...........a...Expla |
| eac40 | 69 6e 20 77 68 79 20 74 68 69 73 20 69 73 20 74 72 75 65 2e 0a 0a 20 20 20 20 20 20 20 64 2e 20 | in.why.this.is.true..........d.. |
| eac60 | 48 6f 77 20 64 6f 20 79 6f 75 20 74 68 69 6e 6b 20 73 65 71 75 65 6e 63 65 73 20 6f 75 67 68 74 | How.do.you.think.sequences.ought |
| eac80 | 20 74 6f 20 62 65 20 74 72 65 61 74 65 64 20 69 6e 20 74 68 65 20 6c 61 7a 79 0a 20 20 20 20 20 | .to.be.treated.in.the.lazy...... |
| eaca0 | 20 20 20 20 20 65 76 61 6c 75 61 74 6f 72 3f 20 20 44 6f 20 79 6f 75 20 6c 69 6b 65 20 43 79 27 | .....evaluator?..Do.you.like.Cy' |
| eacc0 | 73 20 61 70 70 72 6f 61 63 68 2c 20 74 68 65 20 61 70 70 72 6f 61 63 68 20 69 6e 20 74 68 65 0a | s.approach,.the.approach.in.the. |
| eace0 | 20 20 20 20 20 20 20 20 20 20 74 65 78 74 2c 20 6f 72 20 73 6f 6d 65 20 6f 74 68 65 72 20 61 70 | ..........text,.or.some.other.ap |
| ead00 | 70 72 6f 61 63 68 3f 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 33 31 3a 2a 20 | proach?........*Exercise.4.31:*. |
| ead20 | 54 68 65 20 61 70 70 72 6f 61 63 68 20 74 61 6b 65 6e 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 | The.approach.taken.in.this.secti |
| ead40 | 6f 6e 20 69 73 20 73 6f 6d 65 77 68 61 74 0a 20 20 20 20 20 75 6e 70 6c 65 61 73 61 6e 74 2c 20 | on.is.somewhat......unpleasant,. |
| ead60 | 62 65 63 61 75 73 65 20 69 74 20 6d 61 6b 65 73 20 61 6e 20 69 6e 63 6f 6d 70 61 74 69 62 6c 65 | because.it.makes.an.incompatible |
| ead80 | 20 63 68 61 6e 67 65 20 74 6f 20 53 63 68 65 6d 65 2e 20 20 49 74 0a 20 20 20 20 20 6d 69 67 68 | .change.to.Scheme...It......migh |
| eada0 | 74 20 62 65 20 6e 69 63 65 72 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 6c 61 7a 79 20 65 76 61 | t.be.nicer.to.implement.lazy.eva |
| eadc0 | 6c 75 61 74 69 6f 6e 20 61 73 20 61 6e 20 22 75 70 77 61 72 64 2d 63 6f 6d 70 61 74 69 62 6c 65 | luation.as.an."upward-compatible |
| eade0 | 0a 20 20 20 20 20 65 78 74 65 6e 73 69 6f 6e 22 2c 20 74 68 61 74 20 69 73 2c 20 73 6f 20 74 68 | ......extension",.that.is,.so.th |
| eae00 | 61 74 20 6f 72 64 69 6e 61 72 79 20 53 63 68 65 6d 65 20 70 72 6f 67 72 61 6d 73 20 77 69 6c 6c | at.ordinary.Scheme.programs.will |
| eae20 | 20 77 6f 72 6b 20 61 73 0a 20 20 20 20 20 62 65 66 6f 72 65 2e 20 20 57 65 20 63 61 6e 20 64 6f | .work.as......before...We.can.do |
| eae40 | 20 74 68 69 73 20 62 79 20 65 78 74 65 6e 64 69 6e 67 20 74 68 65 20 73 79 6e 74 61 78 20 6f 66 | .this.by.extending.the.syntax.of |
| eae60 | 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 20 74 6f 20 | .procedure......declarations.to. |
| eae80 | 6c 65 74 20 74 68 65 20 75 73 65 72 20 63 6f 6e 74 72 6f 6c 20 77 68 65 74 68 65 72 20 6f 72 20 | let.the.user.control.whether.or. |
| eaea0 | 6e 6f 74 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 0a 20 20 20 20 20 74 6f 20 62 65 20 64 65 6c | not.arguments.are......to.be.del |
| eaec0 | 61 79 65 64 2e 20 20 57 68 69 6c 65 20 77 65 27 72 65 20 61 74 20 69 74 2c 20 77 65 20 6d 61 79 | ayed...While.we're.at.it,.we.may |
| eaee0 | 20 61 73 20 77 65 6c 6c 20 61 6c 73 6f 20 67 69 76 65 20 74 68 65 0a 20 20 20 20 20 75 73 65 72 | .as.well.also.give.the......user |
| eaf00 | 20 74 68 65 20 63 68 6f 69 63 65 20 62 65 74 77 65 65 6e 20 64 65 6c 61 79 69 6e 67 20 77 69 74 | .the.choice.between.delaying.wit |
| eaf20 | 68 20 61 6e 64 20 77 69 74 68 6f 75 74 20 6d 65 6d 6f 69 7a 61 74 69 6f 6e 2e 0a 20 20 20 20 20 | h.and.without.memoization....... |
| eaf40 | 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 0a 0a 20 20 20 | For.example,.the.definition..... |
| eaf60 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 20 61 20 28 62 20 6c 61 7a 79 29 20 63 20 28 | .......(define.(f.a.(b.lazy).c.( |
| eaf80 | 64 20 6c 61 7a 79 2d 6d 65 6d 6f 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 29 0a 0a | d.lazy-memo))................).. |
| eafa0 | 20 20 20 20 20 77 6f 75 6c 64 20 64 65 66 69 6e 65 20 60 66 27 20 74 6f 20 62 65 20 61 20 70 72 | .....would.define.`f'.to.be.a.pr |
| eafc0 | 6f 63 65 64 75 72 65 20 6f 66 20 66 6f 75 72 20 61 72 67 75 6d 65 6e 74 73 2c 20 77 68 65 72 65 | ocedure.of.four.arguments,.where |
| eafe0 | 20 74 68 65 0a 20 20 20 20 20 66 69 72 73 74 20 61 6e 64 20 74 68 69 72 64 20 61 72 67 75 6d 65 | .the......first.and.third.argume |
| eb000 | 6e 74 73 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 20 77 68 65 6e 20 74 68 65 20 70 72 6f 63 65 | nts.are.evaluated.when.the.proce |
| eb020 | 64 75 72 65 20 69 73 0a 20 20 20 20 20 63 61 6c 6c 65 64 2c 20 74 68 65 20 73 65 63 6f 6e 64 20 | dure.is......called,.the.second. |
| eb040 | 61 72 67 75 6d 65 6e 74 20 69 73 20 64 65 6c 61 79 65 64 2c 20 61 6e 64 20 74 68 65 20 66 6f 75 | argument.is.delayed,.and.the.fou |
| eb060 | 72 74 68 20 61 72 67 75 6d 65 6e 74 20 69 73 0a 20 20 20 20 20 62 6f 74 68 20 64 65 6c 61 79 65 | rth.argument.is......both.delaye |
| eb080 | 64 20 61 6e 64 20 6d 65 6d 6f 69 7a 65 64 2e 20 20 54 68 75 73 2c 20 6f 72 64 69 6e 61 72 79 20 | d.and.memoized...Thus,.ordinary. |
| eb0a0 | 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 0a 20 20 20 20 20 77 69 6c 6c 20 | procedure.definitions......will. |
| eb0c0 | 70 72 6f 64 75 63 65 20 74 68 65 20 73 61 6d 65 20 62 65 68 61 76 69 6f 72 20 61 73 20 6f 72 64 | produce.the.same.behavior.as.ord |
| eb0e0 | 69 6e 61 72 79 20 53 63 68 65 6d 65 2c 20 77 68 69 6c 65 20 61 64 64 69 6e 67 0a 20 20 20 20 20 | inary.Scheme,.while.adding...... |
| eb100 | 74 68 65 20 60 6c 61 7a 79 2d 6d 65 6d 6f 27 20 64 65 63 6c 61 72 61 74 69 6f 6e 20 74 6f 20 65 | the.`lazy-memo'.declaration.to.e |
| eb120 | 61 63 68 20 70 61 72 61 6d 65 74 65 72 20 6f 66 20 65 76 65 72 79 20 63 6f 6d 70 6f 75 6e 64 0a | ach.parameter.of.every.compound. |
| eb140 | 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 74 68 65 20 | .....procedure.will.produce.the. |
| eb160 | 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 20 6c 61 7a 79 20 65 76 61 6c 75 61 74 6f 72 20 64 | behavior.of.the.lazy.evaluator.d |
| eb180 | 65 66 69 6e 65 64 0a 20 20 20 20 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2e 20 44 65 73 | efined......in.this.section..Des |
| eb1a0 | 69 67 6e 20 61 6e 64 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 63 68 61 6e 67 65 73 20 72 65 | ign.and.implement.the.changes.re |
| eb1c0 | 71 75 69 72 65 64 20 74 6f 0a 20 20 20 20 20 70 72 6f 64 75 63 65 20 73 75 63 68 20 61 6e 20 65 | quired.to......produce.such.an.e |
| eb1e0 | 78 74 65 6e 73 69 6f 6e 20 74 6f 20 53 63 68 65 6d 65 2e 20 20 59 6f 75 20 77 69 6c 6c 20 68 61 | xtension.to.Scheme...You.will.ha |
| eb200 | 76 65 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 0a 20 20 20 20 20 6e 65 77 20 73 79 6e 74 61 78 20 | ve.to.implement......new.syntax. |
| eb220 | 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 68 61 6e 64 6c 65 20 74 68 65 20 6e 65 77 20 73 79 6e | procedures.to.handle.the.new.syn |
| eb240 | 74 61 78 20 66 6f 72 20 60 64 65 66 69 6e 65 27 2e 20 20 59 6f 75 0a 20 20 20 20 20 6d 75 73 74 | tax.for.`define'...You......must |
| eb260 | 20 61 6c 73 6f 20 61 72 72 61 6e 67 65 20 66 6f 72 20 60 65 76 61 6c 27 20 6f 72 20 60 61 70 70 | .also.arrange.for.`eval'.or.`app |
| eb280 | 6c 79 27 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68 65 6e 0a 20 20 20 20 20 61 72 67 75 6d | ly'.to.determine.when......argum |
| eb2a0 | 65 6e 74 73 20 61 72 65 20 74 6f 20 62 65 20 64 65 6c 61 79 65 64 2c 20 61 6e 64 20 74 6f 20 66 | ents.are.to.be.delayed,.and.to.f |
| eb2c0 | 6f 72 63 65 20 6f 72 20 64 65 6c 61 79 20 61 72 67 75 6d 65 6e 74 73 0a 20 20 20 20 20 61 63 63 | orce.or.delay.arguments......acc |
| eb2e0 | 6f 72 64 69 6e 67 6c 79 2c 20 61 6e 64 20 79 6f 75 20 6d 75 73 74 20 61 72 72 61 6e 67 65 20 66 | ordingly,.and.you.must.arrange.f |
| eb300 | 6f 72 20 66 6f 72 63 69 6e 67 20 74 6f 20 6d 65 6d 6f 69 7a 65 20 6f 72 20 6e 6f 74 2c 0a 20 20 | or.forcing.to.memoize.or.not,... |
| eb320 | 20 20 20 61 73 20 61 70 70 72 6f 70 72 69 61 74 65 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d | ...as.appropriate......--------- |
| eb340 | 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 | -.Footnotes.----------.....(1).T |
| eb360 | 68 65 20 77 6f 72 64 20 22 74 68 75 6e 6b 22 20 77 61 73 20 69 6e 76 65 6e 74 65 64 20 62 79 20 | he.word."thunk".was.invented.by. |
| eb380 | 61 6e 20 69 6e 66 6f 72 6d 61 6c 20 77 6f 72 6b 69 6e 67 20 67 72 6f 75 70 20 74 68 61 74 0a 77 | an.informal.working.group.that.w |
| eb3a0 | 61 73 20 64 69 73 63 75 73 73 69 6e 67 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e | as.discussing.the.implementation |
| eb3c0 | 20 6f 66 20 63 61 6c 6c 2d 62 79 2d 6e 61 6d 65 20 69 6e 20 41 6c 67 6f 6c 20 36 30 2e 20 20 54 | .of.call-by-name.in.Algol.60...T |
| eb3e0 | 68 65 79 0a 6f 62 73 65 72 76 65 64 20 74 68 61 74 20 6d 6f 73 74 20 6f 66 20 74 68 65 20 61 6e | hey.observed.that.most.of.the.an |
| eb400 | 61 6c 79 73 69 73 20 6f 66 20 28 22 74 68 69 6e 6b 69 6e 67 20 61 62 6f 75 74 22 29 20 74 68 65 | alysis.of.("thinking.about").the |
| eb420 | 20 65 78 70 72 65 73 73 69 6f 6e 0a 63 6f 75 6c 64 20 62 65 20 64 6f 6e 65 20 61 74 20 63 6f 6d | .expression.could.be.done.at.com |
| eb440 | 70 69 6c 65 20 74 69 6d 65 3b 20 74 68 75 73 2c 20 61 74 20 72 75 6e 20 74 69 6d 65 2c 20 74 68 | pile.time;.thus,.at.run.time,.th |
| eb460 | 65 20 65 78 70 72 65 73 73 69 6f 6e 20 77 6f 75 6c 64 0a 61 6c 72 65 61 64 79 20 68 61 76 65 20 | e.expression.would.already.have. |
| eb480 | 62 65 65 6e 20 22 74 68 75 6e 6b 22 20 61 62 6f 75 74 20 28 49 6e 67 65 72 6d 61 6e 20 65 74 20 | been."thunk".about.(Ingerman.et. |
| eb4a0 | 61 6c 2e 20 31 39 36 30 29 2e 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 69 73 20 61 6e 61 6c 6f | al..1960)......(2).This.is.analo |
| eb4c0 | 67 6f 75 73 20 74 6f 20 74 68 65 20 75 73 65 20 6f 66 20 60 66 6f 72 63 65 27 20 6f 6e 20 74 68 | gous.to.the.use.of.`force'.on.th |
| eb4e0 | 65 20 64 65 6c 61 79 65 64 20 6f 62 6a 65 63 74 73 0a 74 68 61 74 20 77 65 72 65 20 69 6e 74 72 | e.delayed.objects.that.were.intr |
| eb500 | 6f 64 75 63 65 64 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 20 74 6f 20 72 | oduced.in.*Note.Chapter.3::.to.r |
| eb520 | 65 70 72 65 73 65 6e 74 20 73 74 72 65 61 6d 73 2e 20 20 54 68 65 0a 63 72 69 74 69 63 61 6c 20 | epresent.streams...The.critical. |
| eb540 | 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 77 68 61 74 20 77 65 20 61 72 65 20 64 | difference.between.what.we.are.d |
| eb560 | 6f 69 6e 67 20 68 65 72 65 20 61 6e 64 20 77 68 61 74 20 77 65 20 64 69 64 20 69 6e 0a 2a 4e 6f | oing.here.and.what.we.did.in.*No |
| eb580 | 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 20 69 73 20 74 68 61 74 20 77 65 20 61 72 65 20 62 75 | te.Chapter.3::.is.that.we.are.bu |
| eb5a0 | 69 6c 64 69 6e 67 20 64 65 6c 61 79 69 6e 67 20 61 6e 64 20 66 6f 72 63 69 6e 67 20 69 6e 74 6f | ilding.delaying.and.forcing.into |
| eb5c0 | 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 2c 20 61 6e 64 20 74 68 75 73 20 6d 61 6b 69 6e 67 20 | .the.evaluator,.and.thus.making. |
| eb5e0 | 74 68 69 73 20 75 6e 69 66 6f 72 6d 20 61 6e 64 20 61 75 74 6f 6d 61 74 69 63 20 74 68 72 6f 75 | this.uniform.and.automatic.throu |
| eb600 | 67 68 6f 75 74 20 74 68 65 0a 6c 61 6e 67 75 61 67 65 2e 0a 0a 20 20 20 28 33 29 20 4c 61 7a 79 | ghout.the.language......(3).Lazy |
| eb620 | 20 65 76 61 6c 75 61 74 69 6f 6e 20 63 6f 6d 62 69 6e 65 64 20 77 69 74 68 20 6d 65 6d 6f 69 7a | .evaluation.combined.with.memoiz |
| eb640 | 61 74 69 6f 6e 20 69 73 20 73 6f 6d 65 74 69 6d 65 73 20 72 65 66 65 72 72 65 64 0a 74 6f 20 61 | ation.is.sometimes.referred.to.a |
| eb660 | 73 20 22 63 61 6c 6c 2d 62 79 2d 6e 65 65 64 22 20 61 72 67 75 6d 65 6e 74 20 70 61 73 73 69 6e | s."call-by-need".argument.passin |
| eb680 | 67 2c 20 69 6e 20 63 6f 6e 74 72 61 73 74 20 74 6f 20 22 63 61 6c 6c 2d 62 79 2d 6e 61 6d 65 22 | g,.in.contrast.to."call-by-name" |
| eb6a0 | 0a 61 72 67 75 6d 65 6e 74 20 70 61 73 73 69 6e 67 2e 20 20 28 43 61 6c 6c 2d 62 79 2d 6e 61 6d | .argument.passing...(Call-by-nam |
| eb6c0 | 65 2c 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 41 6c 67 6f 6c 20 36 30 2c 20 69 73 20 73 69 | e,.introduced.in.Algol.60,.is.si |
| eb6e0 | 6d 69 6c 61 72 20 74 6f 0a 6e 6f 6e 2d 6d 65 6d 6f 69 7a 65 64 20 6c 61 7a 79 20 65 76 61 6c 75 | milar.to.non-memoized.lazy.evalu |
| eb700 | 61 74 69 6f 6e 2e 29 20 20 41 73 20 6c 61 6e 67 75 61 67 65 20 64 65 73 69 67 6e 65 72 73 2c 20 | ation.)..As.language.designers,. |
| eb720 | 77 65 20 63 61 6e 20 62 75 69 6c 64 20 6f 75 72 0a 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 6d 65 | we.can.build.our.evaluator.to.me |
| eb740 | 6d 6f 69 7a 65 2c 20 6e 6f 74 20 74 6f 20 6d 65 6d 6f 69 7a 65 2c 20 6f 72 20 6c 65 61 76 65 20 | moize,.not.to.memoize,.or.leave. |
| eb760 | 74 68 69 73 20 61 6e 20 6f 70 74 69 6f 6e 20 66 6f 72 0a 70 72 6f 67 72 61 6d 6d 65 72 73 20 28 | this.an.option.for.programmers.( |
| eb780 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 33 31 3a 3a 29 2e 20 20 41 73 20 79 6f 75 20 | *Note.Exercise.4-31::)...As.you. |
| eb7a0 | 6d 69 67 68 74 20 65 78 70 65 63 74 20 66 72 6f 6d 20 2a 4e 6f 74 65 0a 43 68 61 70 74 65 72 20 | might.expect.from.*Note.Chapter. |
| eb7c0 | 33 3a 3a 2c 20 74 68 65 73 65 20 63 68 6f 69 63 65 73 20 72 61 69 73 65 20 69 73 73 75 65 73 20 | 3::,.these.choices.raise.issues. |
| eb7e0 | 74 68 61 74 20 62 65 63 6f 6d 65 20 62 6f 74 68 20 73 75 62 74 6c 65 20 61 6e 64 0a 63 6f 6e 66 | that.become.both.subtle.and.conf |
| eb800 | 75 73 69 6e 67 20 69 6e 20 74 68 65 20 70 72 65 73 65 6e 63 65 20 6f 66 20 61 73 73 69 67 6e 6d | using.in.the.presence.of.assignm |
| eb820 | 65 6e 74 73 2e 20 20 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 32 37 3a | ents...(See.*Note.Exercise.4-27: |
| eb840 | 3a 0a 61 6e 64 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 32 39 3a 3a 2e 29 20 20 41 | :.and.*Note.Exercise.4-29::.)..A |
| eb860 | 6e 20 65 78 63 65 6c 6c 65 6e 74 20 61 72 74 69 63 6c 65 20 62 79 20 43 6c 69 6e 67 65 72 20 28 | n.excellent.article.by.Clinger.( |
| eb880 | 31 39 38 32 29 0a 61 74 74 65 6d 70 74 73 20 74 6f 20 63 6c 61 72 69 66 79 20 74 68 65 20 6d 75 | 1982).attempts.to.clarify.the.mu |
| eb8a0 | 6c 74 69 70 6c 65 20 64 69 6d 65 6e 73 69 6f 6e 73 20 6f 66 20 63 6f 6e 66 75 73 69 6f 6e 20 74 | ltiple.dimensions.of.confusion.t |
| eb8c0 | 68 61 74 20 61 72 69 73 65 0a 68 65 72 65 2e 0a 0a 20 20 20 28 34 29 20 4e 6f 74 69 63 65 20 74 | hat.arise.here......(4).Notice.t |
| eb8e0 | 68 61 74 20 77 65 20 61 6c 73 6f 20 65 72 61 73 65 20 74 68 65 20 60 65 6e 76 27 20 66 72 6f 6d | hat.we.also.erase.the.`env'.from |
| eb900 | 20 74 68 65 20 74 68 75 6e 6b 20 6f 6e 63 65 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 27 73 | .the.thunk.once.the.expression's |
| eb920 | 20 76 61 6c 75 65 20 68 61 73 20 62 65 65 6e 20 63 6f 6d 70 75 74 65 64 2e 20 20 54 68 69 73 20 | .value.has.been.computed...This. |
| eb940 | 6d 61 6b 65 73 20 6e 6f 20 64 69 66 66 65 72 65 6e 63 65 20 69 6e 20 74 68 65 0a 76 61 6c 75 65 | makes.no.difference.in.the.value |
| eb960 | 73 20 72 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20 20 | s.returned.by.the.interpreter... |
| eb980 | 49 74 20 64 6f 65 73 20 68 65 6c 70 20 73 61 76 65 20 73 70 61 63 65 2c 20 68 6f 77 65 76 65 72 | It.does.help.save.space,.however |
| eb9a0 | 2c 0a 62 65 63 61 75 73 65 20 72 65 6d 6f 76 69 6e 67 20 74 68 65 20 72 65 66 65 72 65 6e 63 65 | ,.because.removing.the.reference |
| eb9c0 | 20 66 72 6f 6d 20 74 68 65 20 74 68 75 6e 6b 20 74 6f 20 74 68 65 20 60 65 6e 76 27 20 6f 6e 63 | .from.the.thunk.to.the.`env'.onc |
| eb9e0 | 65 20 69 74 20 69 73 0a 6e 6f 20 6c 6f 6e 67 65 72 20 6e 65 65 64 65 64 20 61 6c 6c 6f 77 73 20 | e.it.is.no.longer.needed.allows. |
| eba00 | 74 68 69 73 20 73 74 72 75 63 74 75 72 65 20 74 6f 20 62 65 20 22 67 61 72 62 61 67 65 2d 63 6f | this.structure.to.be."garbage-co |
| eba20 | 6c 6c 65 63 74 65 64 22 20 61 6e 64 0a 69 74 73 20 73 70 61 63 65 20 72 65 63 79 63 6c 65 64 2c | llected".and.its.space.recycled, |
| eba40 | 20 61 73 20 77 65 20 77 69 6c 6c 20 64 69 73 63 75 73 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a | .as.we.will.discuss.in.section.* |
| eba60 | 4e 6f 74 65 20 35 2d 33 3a 3a 2e 0a 0a 20 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 77 65 20 63 6f | Note.5-3::......Similarly,.we.co |
| eba80 | 75 6c 64 20 68 61 76 65 20 61 6c 6c 6f 77 65 64 20 75 6e 6e 65 65 64 65 64 20 65 6e 76 69 72 6f | uld.have.allowed.unneeded.enviro |
| ebaa0 | 6e 6d 65 6e 74 73 20 69 6e 20 74 68 65 0a 6d 65 6d 6f 69 7a 65 64 20 64 65 6c 61 79 65 64 20 6f | nments.in.the.memoized.delayed.o |
| ebac0 | 62 6a 65 63 74 73 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d 31 3a 3a 20 | bjects.of.section.*Note.3-5-1::. |
| ebae0 | 74 6f 20 62 65 0a 67 61 72 62 61 67 65 2d 63 6f 6c 6c 65 63 74 65 64 2c 20 62 79 20 68 61 76 69 | to.be.garbage-collected,.by.havi |
| ebb00 | 6e 67 20 60 6d 65 6d 6f 2d 70 72 6f 63 27 20 64 6f 20 73 6f 6d 65 74 68 69 6e 67 20 6c 69 6b 65 | ng.`memo-proc'.do.something.like |
| ebb20 | 20 60 28 73 65 74 21 20 70 72 6f 63 0a 27 28 29 29 27 20 74 6f 20 64 69 73 63 61 72 64 20 74 68 | .`(set!.proc.'())'.to.discard.th |
| ebb40 | 65 20 70 72 6f 63 65 64 75 72 65 20 60 70 72 6f 63 27 20 28 77 68 69 63 68 20 69 6e 63 6c 75 64 | e.procedure.`proc'.(which.includ |
| ebb60 | 65 73 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 69 6e 20 77 68 69 63 68 20 74 68 65 20 | es.the.environment.in.which.the. |
| ebb80 | 60 64 65 6c 61 79 27 20 77 61 73 20 65 76 61 6c 75 61 74 65 64 29 20 61 66 74 65 72 20 73 74 6f | `delay'.was.evaluated).after.sto |
| ebba0 | 72 69 6e 67 20 69 74 73 20 76 61 6c 75 65 2e 0a 0a 20 20 20 28 35 29 20 54 68 69 73 20 65 78 65 | ring.its.value......(5).This.exe |
| ebbc0 | 72 63 69 73 65 20 64 65 6d 6f 6e 73 74 72 61 74 65 73 20 74 68 61 74 20 74 68 65 20 69 6e 74 65 | rcise.demonstrates.that.the.inte |
| ebbe0 | 72 61 63 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 6c 61 7a 79 0a 65 76 61 6c 75 61 74 69 6f 6e 20 | raction.between.lazy.evaluation. |
| ebc00 | 61 6e 64 20 73 69 64 65 20 65 66 66 65 63 74 73 20 63 61 6e 20 62 65 20 76 65 72 79 20 63 6f 6e | and.side.effects.can.be.very.con |
| ebc20 | 66 75 73 69 6e 67 2e 20 20 54 68 69 73 20 69 73 20 6a 75 73 74 20 77 68 61 74 0a 79 6f 75 20 6d | fusing...This.is.just.what.you.m |
| ebc40 | 69 67 68 74 20 65 78 70 65 63 74 20 66 72 6f 6d 20 74 68 65 20 64 69 73 63 75 73 73 69 6f 6e 20 | ight.expect.from.the.discussion. |
| ebc60 | 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 | in.*Note.Chapter.3::.....File:.s |
| ebc80 | 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 32 2d 33 2c 20 20 50 72 65 76 3a 20 34 | icp.info,..Node:.4-2-3,..Prev:.4 |
| ebca0 | 2d 32 2d 32 2c 20 20 55 70 3a 20 34 2d 32 0a 0a 34 2e 32 2e 33 20 53 74 72 65 61 6d 73 20 61 73 | -2-2,..Up:.4-2..4.2.3.Streams.as |
| ebcc0 | 20 4c 61 7a 79 20 4c 69 73 74 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .Lazy.Lists.-------------------- |
| ebce0 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d 31 3a | -------..In.section.*Note.3-5-1: |
| ebd00 | 3a 2c 20 77 65 20 73 68 6f 77 65 64 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 73 74 | :,.we.showed.how.to.implement.st |
| ebd20 | 72 65 61 6d 73 20 61 73 20 64 65 6c 61 79 65 64 0a 6c 69 73 74 73 2e 20 20 57 65 20 69 6e 74 72 | reams.as.delayed.lists...We.intr |
| ebd40 | 6f 64 75 63 65 64 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 20 60 64 65 6c 61 79 27 20 61 6e 64 | oduced.special.forms.`delay'.and |
| ebd60 | 20 60 63 6f 6e 73 2d 73 74 72 65 61 6d 27 2c 20 77 68 69 63 68 0a 61 6c 6c 6f 77 65 64 20 75 73 | .`cons-stream',.which.allowed.us |
| ebd80 | 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 61 20 22 70 72 6f 6d 69 73 65 22 20 74 6f 20 63 6f 6d | .to.construct.a."promise".to.com |
| ebda0 | 70 75 74 65 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 61 20 73 74 72 65 61 6d 2c 0a 77 69 74 68 | pute.the.`cdr'.of.a.stream,.with |
| ebdc0 | 6f 75 74 20 61 63 74 75 61 6c 6c 79 20 66 75 6c 66 69 6c 6c 69 6e 67 20 74 68 61 74 20 70 72 6f | out.actually.fulfilling.that.pro |
| ebde0 | 6d 69 73 65 20 75 6e 74 69 6c 20 6c 61 74 65 72 2e 20 20 57 65 20 63 6f 75 6c 64 20 75 73 65 0a | mise.until.later...We.could.use. |
| ebe00 | 74 68 69 73 20 67 65 6e 65 72 61 6c 20 74 65 63 68 6e 69 71 75 65 20 6f 66 20 69 6e 74 72 6f 64 | this.general.technique.of.introd |
| ebe20 | 75 63 69 6e 67 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 20 77 68 65 6e 65 76 65 72 20 77 65 20 | ucing.special.forms.whenever.we. |
| ebe40 | 6e 65 65 64 0a 6d 6f 72 65 20 63 6f 6e 74 72 6f 6c 20 6f 76 65 72 20 74 68 65 20 65 76 61 6c 75 | need.more.control.over.the.evalu |
| ebe60 | 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 2c 20 62 75 74 20 74 68 69 73 20 69 73 20 61 77 6b 77 61 | ation.process,.but.this.is.awkwa |
| ebe80 | 72 64 2e 20 20 46 6f 72 20 6f 6e 65 0a 74 68 69 6e 67 2c 20 61 20 73 70 65 63 69 61 6c 20 66 6f | rd...For.one.thing,.a.special.fo |
| ebea0 | 72 6d 20 69 73 20 6e 6f 74 20 61 20 66 69 72 73 74 2d 63 6c 61 73 73 20 6f 62 6a 65 63 74 20 6c | rm.is.not.a.first-class.object.l |
| ebec0 | 69 6b 65 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 73 6f 0a 77 65 20 63 61 6e 6e 6f 74 20 75 73 | ike.a.procedure,.so.we.cannot.us |
| ebee0 | 65 20 69 74 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 | e.it.together.with.higher-order. |
| ebf00 | 70 72 6f 63 65 64 75 72 65 73 2e 28 31 29 0a 41 64 64 69 74 69 6f 6e 61 6c 6c 79 2c 20 77 65 20 | procedures.(1).Additionally,.we. |
| ebf20 | 77 65 72 65 20 66 6f 72 63 65 64 20 74 6f 20 63 72 65 61 74 65 20 73 74 72 65 61 6d 73 20 61 73 | were.forced.to.create.streams.as |
| ebf40 | 20 61 20 6e 65 77 20 6b 69 6e 64 20 6f 66 20 64 61 74 61 0a 6f 62 6a 65 63 74 20 73 69 6d 69 6c | .a.new.kind.of.data.object.simil |
| ebf60 | 61 72 20 62 75 74 20 6e 6f 74 20 69 64 65 6e 74 69 63 61 6c 20 74 6f 20 6c 69 73 74 73 2c 20 61 | ar.but.not.identical.to.lists,.a |
| ebf80 | 6e 64 20 74 68 69 73 20 72 65 71 75 69 72 65 64 20 75 73 20 74 6f 0a 72 65 69 6d 70 6c 65 6d 65 | nd.this.required.us.to.reimpleme |
| ebfa0 | 6e 74 20 6d 61 6e 79 20 6f 72 64 69 6e 61 72 79 20 6c 69 73 74 20 6f 70 65 72 61 74 69 6f 6e 73 | nt.many.ordinary.list.operations |
| ebfc0 | 20 28 60 6d 61 70 27 2c 20 60 61 70 70 65 6e 64 27 2c 20 61 6e 64 20 73 6f 20 6f 6e 29 0a 66 6f | .(`map',.`append',.and.so.on).fo |
| ebfe0 | 72 20 75 73 65 20 77 69 74 68 20 73 74 72 65 61 6d 73 2e 0a 0a 20 20 20 57 69 74 68 20 6c 61 7a | r.use.with.streams......With.laz |
| ec000 | 79 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 73 74 72 65 61 6d 73 20 61 6e 64 20 6c 69 73 74 73 20 | y.evaluation,.streams.and.lists. |
| ec020 | 63 61 6e 20 62 65 20 69 64 65 6e 74 69 63 61 6c 2c 20 73 6f 20 74 68 65 72 65 0a 69 73 20 6e 6f | can.be.identical,.so.there.is.no |
| ec040 | 20 6e 65 65 64 20 66 6f 72 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 20 6f 72 20 66 6f 72 20 73 | .need.for.special.forms.or.for.s |
| ec060 | 65 70 61 72 61 74 65 20 6c 69 73 74 20 61 6e 64 20 73 74 72 65 61 6d 0a 6f 70 65 72 61 74 69 6f | eparate.list.and.stream.operatio |
| ec080 | 6e 73 2e 20 20 41 6c 6c 20 77 65 20 6e 65 65 64 20 74 6f 20 64 6f 20 69 73 20 74 6f 20 61 72 72 | ns...All.we.need.to.do.is.to.arr |
| ec0a0 | 61 6e 67 65 20 6d 61 74 74 65 72 73 20 73 6f 20 74 68 61 74 20 60 63 6f 6e 73 27 20 69 73 0a 6e | ange.matters.so.that.`cons'.is.n |
| ec0c0 | 6f 6e 2d 73 74 72 69 63 74 2e 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 61 63 63 6f 6d 70 6c 69 73 | on-strict...One.way.to.accomplis |
| ec0e0 | 68 20 74 68 69 73 20 69 73 20 74 6f 20 65 78 74 65 6e 64 20 74 68 65 20 6c 61 7a 79 20 65 76 61 | h.this.is.to.extend.the.lazy.eva |
| ec100 | 6c 75 61 74 6f 72 0a 74 6f 20 61 6c 6c 6f 77 20 66 6f 72 20 6e 6f 6e 2d 73 74 72 69 63 74 20 70 | luator.to.allow.for.non-strict.p |
| ec120 | 72 69 6d 69 74 69 76 65 73 2c 20 61 6e 64 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 60 63 6f 6e | rimitives,.and.to.implement.`con |
| ec140 | 73 27 20 61 73 20 6f 6e 65 20 6f 66 0a 74 68 65 73 65 2e 20 20 41 6e 20 65 61 73 69 65 72 20 77 | s'.as.one.of.these...An.easier.w |
| ec160 | 61 79 20 69 73 20 74 6f 20 72 65 63 61 6c 6c 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 | ay.is.to.recall.(section.*Note.2 |
| ec180 | 2d 31 2d 33 3a 3a 29 20 74 68 61 74 20 74 68 65 72 65 0a 69 73 20 6e 6f 20 66 75 6e 64 61 6d 65 | -1-3::).that.there.is.no.fundame |
| ec1a0 | 6e 74 61 6c 20 6e 65 65 64 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 60 63 6f 6e 73 27 20 61 73 | ntal.need.to.implement.`cons'.as |
| ec1c0 | 20 61 20 70 72 69 6d 69 74 69 76 65 20 61 74 20 61 6c 6c 2e 0a 49 6e 73 74 65 61 64 2c 20 77 65 | .a.primitive.at.all..Instead,.we |
| ec1e0 | 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 20 70 61 69 72 73 20 61 73 20 70 72 6f 63 65 64 75 72 | .can.represent.pairs.as.procedur |
| ec200 | 65 73 3a 28 32 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 73 20 78 20 79 29 0a | es:(2).......(define.(cons.x.y). |
| ec220 | 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6d 29 20 28 6d 20 78 20 79 29 29 29 0a 0a 20 20 | .......(lambda.(m).(m.x.y))).... |
| ec240 | 20 20 20 28 64 65 66 69 6e 65 20 28 63 61 72 20 7a 29 0a 20 20 20 20 20 20 20 28 7a 20 28 6c 61 | ...(define.(car.z)........(z.(la |
| ec260 | 6d 62 64 61 20 28 70 20 71 29 20 70 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 | mbda.(p.q).p))).......(define.(c |
| ec280 | 64 72 20 7a 29 0a 20 20 20 20 20 20 20 28 7a 20 28 6c 61 6d 62 64 61 20 28 70 20 71 29 20 71 29 | dr.z)........(z.(lambda.(p.q).q) |
| ec2a0 | 29 29 0a 0a 20 20 20 49 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 73 65 20 62 61 73 69 63 20 6f | )).....In.terms.of.these.basic.o |
| ec2c0 | 70 65 72 61 74 69 6f 6e 73 2c 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 64 65 66 69 6e 69 74 69 | perations,.the.standard.definiti |
| ec2e0 | 6f 6e 73 20 6f 66 20 74 68 65 0a 6c 69 73 74 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 69 6c 6c 20 | ons.of.the.list.operations.will. |
| ec300 | 77 6f 72 6b 20 77 69 74 68 20 69 6e 66 69 6e 69 74 65 20 6c 69 73 74 73 20 28 73 74 72 65 61 6d | work.with.infinite.lists.(stream |
| ec320 | 73 29 20 61 73 20 77 65 6c 6c 20 61 73 0a 66 69 6e 69 74 65 20 6f 6e 65 73 2c 20 61 6e 64 20 74 | s).as.well.as.finite.ones,.and.t |
| ec340 | 68 65 20 73 74 72 65 61 6d 20 6f 70 65 72 61 74 69 6f 6e 73 20 63 61 6e 20 62 65 20 69 6d 70 6c | he.stream.operations.can.be.impl |
| ec360 | 65 6d 65 6e 74 65 64 20 61 73 20 6c 69 73 74 0a 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 48 65 72 | emented.as.list.operations...Her |
| ec380 | 65 20 61 72 65 20 73 6f 6d 65 20 65 78 61 6d 70 6c 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 | e.are.some.examples:.......(defi |
| ec3a0 | 6e 65 20 28 6c 69 73 74 2d 72 65 66 20 69 74 65 6d 73 20 6e 29 0a 20 20 20 20 20 20 20 28 69 66 | ne.(list-ref.items.n)........(if |
| ec3c0 | 20 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 69 74 65 6d 73 29 0a | .(=.n.0)............(car.items). |
| ec3e0 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20 28 63 64 72 20 69 74 65 6d 73 29 | ...........(list-ref.(cdr.items) |
| ec400 | 20 28 2d 20 6e 20 31 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 70 20 70 | .(-.n.1)))).......(define.(map.p |
| ec420 | 72 6f 63 20 69 74 65 6d 73 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 69 74 65 | roc.items)........(if.(null?.ite |
| ec440 | 6d 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 | ms)............'()............(c |
| ec460 | 6f 6e 73 20 28 70 72 6f 63 20 28 63 61 72 20 69 74 65 6d 73 29 29 0a 20 20 20 20 20 20 20 20 20 | ons.(proc.(car.items)).......... |
| ec480 | 20 20 20 20 20 20 20 20 28 6d 61 70 20 70 72 6f 63 20 28 63 64 72 20 69 74 65 6d 73 29 29 29 29 | ........(map.proc.(cdr.items)))) |
| ec4a0 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 63 61 6c 65 2d 6c 69 73 74 20 69 74 65 6d | ).......(define.(scale-list.item |
| ec4c0 | 73 20 66 61 63 74 6f 72 29 0a 20 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 78 | s.factor)........(map.(lambda.(x |
| ec4e0 | 29 20 28 2a 20 78 20 66 61 63 74 6f 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 74 65 6d | ).(*.x.factor)).............item |
| ec500 | 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 6c 69 73 74 73 20 6c 69 73 | s)).......(define.(add-lists.lis |
| ec520 | 74 31 20 6c 69 73 74 32 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 6c | t1.list2)........(cond.((null?.l |
| ec540 | 69 73 74 31 29 20 6c 69 73 74 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e 75 6c 6c | ist1).list2)..............((null |
| ec560 | 3f 20 6c 69 73 74 32 29 20 6c 69 73 74 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c | ?.list2).list1)..............(el |
| ec580 | 73 65 20 28 63 6f 6e 73 20 28 2b 20 28 63 61 72 20 6c 69 73 74 31 29 20 28 63 61 72 20 6c 69 73 | se.(cons.(+.(car.list1).(car.lis |
| ec5a0 | 74 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 | t2))..........................(a |
| ec5c0 | 64 64 2d 6c 69 73 74 73 20 28 63 64 72 20 6c 69 73 74 31 29 20 28 63 64 72 20 6c 69 73 74 32 29 | dd-lists.(cdr.list1).(cdr.list2) |
| ec5e0 | 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6f 6e 65 73 20 28 63 6f 6e 73 20 31 | ))))).......(define.ones.(cons.1 |
| ec600 | 20 6f 6e 65 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 74 65 67 65 72 73 20 28 | .ones)).......(define.integers.( |
| ec620 | 63 6f 6e 73 20 31 20 28 61 64 64 2d 6c 69 73 74 73 20 6f 6e 65 73 20 69 6e 74 65 67 65 72 73 29 | cons.1.(add-lists.ones.integers) |
| ec640 | 29 29 0a 0a 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 | )).......;;;.L-Eval.input:...... |
| ec660 | 28 6c 69 73 74 2d 72 65 66 20 69 6e 74 65 67 65 72 73 20 31 37 29 0a 20 20 20 20 20 3b 3b 3b 20 | (list-ref.integers.17)......;;;. |
| ec680 | 4c 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 31 38 0a 0a 20 20 20 4e 6f 74 65 20 74 | L-Eval.value:......18.....Note.t |
| ec6a0 | 68 61 74 20 74 68 65 73 65 20 6c 61 7a 79 20 6c 69 73 74 73 20 61 72 65 20 65 76 65 6e 20 6c 61 | hat.these.lazy.lists.are.even.la |
| ec6c0 | 7a 69 65 72 20 74 68 61 6e 20 74 68 65 20 73 74 72 65 61 6d 73 20 6f 66 20 2a 4e 6f 74 65 0a 43 | zier.than.the.streams.of.*Note.C |
| ec6e0 | 68 61 70 74 65 72 20 33 3a 3a 3a 20 54 68 65 20 60 63 61 72 27 20 6f 66 20 74 68 65 20 6c 69 73 | hapter.3:::.The.`car'.of.the.lis |
| ec700 | 74 2c 20 61 73 20 77 65 6c 6c 20 61 73 20 74 68 65 20 60 63 64 72 27 2c 20 69 73 0a 64 65 6c 61 | t,.as.well.as.the.`cdr',.is.dela |
| ec720 | 79 65 64 2e 28 33 29 20 20 49 6e 20 66 61 63 74 2c 20 65 76 65 6e 20 61 63 63 65 73 73 69 6e 67 | yed.(3)..In.fact,.even.accessing |
| ec740 | 20 74 68 65 20 60 63 61 72 27 20 6f 72 20 60 63 64 72 27 20 6f 66 20 61 20 6c 61 7a 79 20 70 61 | .the.`car'.or.`cdr'.of.a.lazy.pa |
| ec760 | 69 72 0a 6e 65 65 64 20 6e 6f 74 20 66 6f 72 63 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 61 | ir.need.not.force.the.value.of.a |
| ec780 | 20 6c 69 73 74 20 65 6c 65 6d 65 6e 74 2e 20 20 54 68 65 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 | .list.element...The.value.will.b |
| ec7a0 | 65 20 66 6f 72 63 65 64 0a 6f 6e 6c 79 20 77 68 65 6e 20 69 74 20 69 73 20 72 65 61 6c 6c 79 20 | e.forced.only.when.it.is.really. |
| ec7c0 | 6e 65 65 64 65 64 20 2d 20 65 2e 67 2e 2c 20 66 6f 72 20 75 73 65 20 61 73 20 74 68 65 20 61 72 | needed.-.e.g.,.for.use.as.the.ar |
| ec7e0 | 67 75 6d 65 6e 74 20 6f 66 20 61 0a 70 72 69 6d 69 74 69 76 65 2c 20 6f 72 20 74 6f 20 62 65 20 | gument.of.a.primitive,.or.to.be. |
| ec800 | 70 72 69 6e 74 65 64 20 61 73 20 61 6e 20 61 6e 73 77 65 72 2e 0a 0a 20 20 20 4c 61 7a 79 20 70 | printed.as.an.answer......Lazy.p |
| ec820 | 61 69 72 73 20 61 6c 73 6f 20 68 65 6c 70 20 77 69 74 68 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 | airs.also.help.with.the.problem. |
| ec840 | 74 68 61 74 20 61 72 6f 73 65 20 77 69 74 68 20 73 74 72 65 61 6d 73 20 69 6e 0a 73 65 63 74 69 | that.arose.with.streams.in.secti |
| ec860 | 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d 34 3a 3a 2c 20 77 68 65 72 65 20 77 65 20 66 6f 75 6e 64 | on.*Note.3-5-4::,.where.we.found |
| ec880 | 20 74 68 61 74 20 66 6f 72 6d 75 6c 61 74 69 6e 67 20 73 74 72 65 61 6d 20 6d 6f 64 65 6c 73 20 | .that.formulating.stream.models. |
| ec8a0 | 6f 66 0a 73 79 73 74 65 6d 73 20 77 69 74 68 20 6c 6f 6f 70 73 20 6d 61 79 20 72 65 71 75 69 72 | of.systems.with.loops.may.requir |
| ec8c0 | 65 20 75 73 20 74 6f 20 73 70 72 69 6e 6b 6c 65 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 77 69 | e.us.to.sprinkle.our.programs.wi |
| ec8e0 | 74 68 0a 65 78 70 6c 69 63 69 74 20 60 64 65 6c 61 79 27 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 | th.explicit.`delay'.operations,. |
| ec900 | 62 65 79 6f 6e 64 20 74 68 65 20 6f 6e 65 73 20 73 75 70 70 6c 69 65 64 20 62 79 20 60 63 6f 6e | beyond.the.ones.supplied.by.`con |
| ec920 | 73 2d 73 74 72 65 61 6d 27 2e 0a 57 69 74 68 20 6c 61 7a 79 20 65 76 61 6c 75 61 74 69 6f 6e 2c | s-stream'..With.lazy.evaluation, |
| ec940 | 20 61 6c 6c 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 | .all.arguments.to.procedures.are |
| ec960 | 20 64 65 6c 61 79 65 64 0a 75 6e 69 66 6f 72 6d 6c 79 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 | .delayed.uniformly...For.instanc |
| ec980 | 65 2c 20 77 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 70 72 6f 63 65 64 75 72 65 73 20 74 | e,.we.can.implement.procedures.t |
| ec9a0 | 6f 20 69 6e 74 65 67 72 61 74 65 0a 6c 69 73 74 73 20 61 6e 64 20 73 6f 6c 76 65 20 64 69 66 66 | o.integrate.lists.and.solve.diff |
| ec9c0 | 65 72 65 6e 74 69 61 6c 20 65 71 75 61 74 69 6f 6e 73 20 61 73 20 77 65 20 6f 72 69 67 69 6e 61 | erential.equations.as.we.origina |
| ec9e0 | 6c 6c 79 20 69 6e 74 65 6e 64 65 64 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d | lly.intended.in.section.*Note.3- |
| eca00 | 35 2d 34 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 74 65 67 72 61 6c 20 69 | 5-4:::.......(define.(integral.i |
| eca20 | 6e 74 65 67 72 61 6e 64 20 69 6e 69 74 69 61 6c 2d 76 61 6c 75 65 20 64 74 29 0a 20 20 20 20 20 | ntegrand.initial-value.dt)...... |
| eca40 | 20 20 28 64 65 66 69 6e 65 20 69 6e 74 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 69 6e 69 | ..(define.int..........(cons.ini |
| eca60 | 74 69 61 6c 2d 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 6c | tial-value................(add-l |
| eca80 | 69 73 74 73 20 28 73 63 61 6c 65 2d 6c 69 73 74 20 69 6e 74 65 67 72 61 6e 64 20 64 74 29 0a 20 | ists.(scale-list.integrand.dt).. |
| ecaa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 74 29 29 29 0a 20 | ........................int))).. |
| ecac0 | 20 20 20 20 20 20 69 6e 74 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 6f 6c 76 65 20 | ......int).......(define.(solve. |
| ecae0 | 66 20 79 30 20 64 74 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 79 20 28 69 6e 74 65 67 | f.y0.dt)........(define.y.(integ |
| ecb00 | 72 61 6c 20 64 79 20 79 30 20 64 74 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 64 79 | ral.dy.y0.dt))........(define.dy |
| ecb20 | 20 28 6d 61 70 20 66 20 79 29 29 0a 20 20 20 20 20 20 20 79 29 0a 0a 20 20 20 20 20 3b 3b 3b 20 | .(map.f.y))........y).......;;;. |
| ecb40 | 4c 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 6c 69 73 74 2d 72 65 66 20 28 73 6f | L-Eval.input:......(list-ref.(so |
| ecb60 | 6c 76 65 20 28 6c 61 6d 62 64 61 20 28 78 29 20 78 29 20 31 20 30 2e 30 30 31 29 20 31 30 30 30 | lve.(lambda.(x).x).1.0.001).1000 |
| ecb80 | 29 0a 20 20 20 20 20 3b 3b 3b 20 4c 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 32 2e | )......;;;.L-Eval.value:......2. |
| ecba0 | 37 31 36 39 32 34 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 33 32 3a 2a 20 47 69 | 716924.......*Exercise.4.32:*.Gi |
| ecbc0 | 76 65 20 73 6f 6d 65 20 65 78 61 6d 70 6c 65 73 20 74 68 61 74 20 69 6c 6c 75 73 74 72 61 74 65 | ve.some.examples.that.illustrate |
| ecbe0 | 20 74 68 65 20 64 69 66 66 65 72 65 6e 63 65 0a 20 20 20 20 20 62 65 74 77 65 65 6e 20 74 68 65 | .the.difference......between.the |
| ecc00 | 20 73 74 72 65 61 6d 73 20 6f 66 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 20 61 6e | .streams.of.*Note.Chapter.3::.an |
| ecc20 | 64 20 74 68 65 20 22 6c 61 7a 69 65 72 22 20 6c 61 7a 79 0a 20 20 20 20 20 6c 69 73 74 73 20 64 | d.the."lazier".lazy......lists.d |
| ecc40 | 65 73 63 72 69 62 65 64 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2e 20 20 48 6f 77 20 63 | escribed.in.this.section...How.c |
| ecc60 | 61 6e 20 79 6f 75 20 74 61 6b 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 0a 20 20 20 20 20 74 68 | an.you.take.advantage.of......th |
| ecc80 | 69 73 20 65 78 74 72 61 20 6c 61 7a 69 6e 65 73 73 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | is.extra.laziness?.......*Exerci |
| ecca0 | 73 65 20 34 2e 33 33 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 74 65 73 74 73 20 74 68 | se.4.33:*.Ben.Bitdiddle.tests.th |
| eccc0 | 65 20 6c 61 7a 79 20 6c 69 73 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 0a 20 20 20 20 20 | e.lazy.list.implementation...... |
| ecce0 | 67 69 76 65 6e 20 61 62 6f 76 65 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 | given.above.by.evaluating.the.ex |
| ecd00 | 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 27 28 61 20 62 20 63 | pression............(car.'(a.b.c |
| ecd20 | 29 29 0a 0a 20 20 20 20 20 54 6f 20 68 69 73 20 73 75 72 70 72 69 73 65 2c 20 74 68 69 73 20 70 | )).......To.his.surprise,.this.p |
| ecd40 | 72 6f 64 75 63 65 73 20 61 6e 20 65 72 72 6f 72 2e 20 20 41 66 74 65 72 20 73 6f 6d 65 20 74 68 | roduces.an.error...After.some.th |
| ecd60 | 6f 75 67 68 74 2c 20 68 65 0a 20 20 20 20 20 72 65 61 6c 69 7a 65 73 20 74 68 61 74 20 74 68 65 | ought,.he......realizes.that.the |
| ecd80 | 20 22 6c 69 73 74 73 22 20 6f 62 74 61 69 6e 65 64 20 62 79 20 72 65 61 64 69 6e 67 20 69 6e 20 | ."lists".obtained.by.reading.in. |
| ecda0 | 71 75 6f 74 65 64 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 64 69 66 66 | quoted......expressions.are.diff |
| ecdc0 | 65 72 65 6e 74 20 66 72 6f 6d 20 74 68 65 20 6c 69 73 74 73 20 6d 61 6e 69 70 75 6c 61 74 65 64 | erent.from.the.lists.manipulated |
| ecde0 | 20 62 79 20 74 68 65 20 6e 65 77 0a 20 20 20 20 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 | .by.the.new......definitions.of. |
| ece00 | 60 63 6f 6e 73 27 2c 20 60 63 61 72 27 2c 20 61 6e 64 20 60 63 64 72 27 2e 20 20 4d 6f 64 69 66 | `cons',.`car',.and.`cdr'...Modif |
| ece20 | 79 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 27 73 0a 20 20 20 20 20 74 72 65 61 74 6d 65 6e 74 | y.the.evaluator's......treatment |
| ece40 | 20 6f 66 20 71 75 6f 74 65 64 20 65 78 70 72 65 73 73 69 6f 6e 73 20 73 6f 20 74 68 61 74 20 71 | .of.quoted.expressions.so.that.q |
| ece60 | 75 6f 74 65 64 20 6c 69 73 74 73 20 74 79 70 65 64 20 61 74 20 74 68 65 0a 20 20 20 20 20 64 72 | uoted.lists.typed.at.the......dr |
| ece80 | 69 76 65 72 20 6c 6f 6f 70 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 74 72 75 65 20 6c 61 7a 79 | iver.loop.will.produce.true.lazy |
| ecea0 | 20 6c 69 73 74 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 33 34 3a 2a 20 4d | .lists........*Exercise.4.34:*.M |
| ecec0 | 6f 64 69 66 79 20 74 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 20 66 6f 72 20 74 68 65 20 65 76 | odify.the.driver.loop.for.the.ev |
| ecee0 | 61 6c 75 61 74 6f 72 20 73 6f 20 74 68 61 74 0a 20 20 20 20 20 6c 61 7a 79 20 70 61 69 72 73 20 | aluator.so.that......lazy.pairs. |
| ecf00 | 61 6e 64 20 6c 69 73 74 73 20 77 69 6c 6c 20 70 72 69 6e 74 20 69 6e 20 73 6f 6d 65 20 72 65 61 | and.lists.will.print.in.some.rea |
| ecf20 | 73 6f 6e 61 62 6c 65 20 77 61 79 2e 20 20 28 57 68 61 74 20 61 72 65 0a 20 20 20 20 20 79 6f 75 | sonable.way...(What.are......you |
| ecf40 | 20 67 6f 69 6e 67 20 74 6f 20 64 6f 20 61 62 6f 75 74 20 69 6e 66 69 6e 69 74 65 20 6c 69 73 74 | .going.to.do.about.infinite.list |
| ecf60 | 73 3f 29 20 20 59 6f 75 20 6d 61 79 20 61 6c 73 6f 20 6e 65 65 64 20 74 6f 20 6d 6f 64 69 66 79 | s?)..You.may.also.need.to.modify |
| ecf80 | 0a 20 20 20 20 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 6c 61 7a 79 | ......the.representation.of.lazy |
| ecfa0 | 20 70 61 69 72 73 20 73 6f 20 74 68 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 63 61 6e | .pairs.so.that.the.evaluator.can |
| ecfc0 | 0a 20 20 20 20 20 69 64 65 6e 74 69 66 79 20 74 68 65 6d 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 | ......identify.them.in.order.to. |
| ecfe0 | 70 72 69 6e 74 20 74 68 65 6d 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e | print.them......----------.Footn |
| ed000 | 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 69 73 20 69 73 20 | otes.----------.....(1).This.is. |
| ed020 | 70 72 65 63 69 73 65 6c 79 20 74 68 65 20 69 73 73 75 65 20 77 69 74 68 20 74 68 65 20 60 75 6e | precisely.the.issue.with.the.`un |
| ed040 | 6c 65 73 73 27 20 70 72 6f 63 65 64 75 72 65 2c 20 61 73 20 69 6e 0a 2a 4e 6f 74 65 20 45 78 65 | less'.procedure,.as.in.*Note.Exe |
| ed060 | 72 63 69 73 65 20 34 2d 32 36 3a 3a 2e 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 69 73 20 74 68 | rcise.4-26::......(2).This.is.th |
| ed080 | 65 20 70 72 6f 63 65 64 75 72 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 64 65 73 63 | e.procedural.representation.desc |
| ed0a0 | 72 69 62 65 64 20 69 6e 20 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 20 32 2d 34 3a 3a 2e 20 20 | ribed.in.*Note.Exercise.2-4::... |
| ed0c0 | 45 73 73 65 6e 74 69 61 6c 6c 79 20 61 6e 79 20 70 72 6f 63 65 64 75 72 61 6c 20 72 65 70 72 65 | Essentially.any.procedural.repre |
| ed0e0 | 73 65 6e 74 61 74 69 6f 6e 20 28 65 2e 67 2e 2c 20 61 0a 6d 65 73 73 61 67 65 2d 70 61 73 73 69 | sentation.(e.g.,.a.message-passi |
| ed100 | 6e 67 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 29 20 77 6f 75 6c 64 20 64 6f 20 61 73 20 77 | ng.implementation).would.do.as.w |
| ed120 | 65 6c 6c 2e 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 77 65 20 63 61 6e 0a 69 6e 73 74 61 6c 6c | ell...Notice.that.we.can.install |
| ed140 | 20 74 68 65 73 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 6c 61 7a 79 20 65 | .these.definitions.in.the.lazy.e |
| ed160 | 76 61 6c 75 61 74 6f 72 20 73 69 6d 70 6c 79 20 62 79 20 74 79 70 69 6e 67 20 74 68 65 6d 0a 61 | valuator.simply.by.typing.them.a |
| ed180 | 74 20 74 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 2e 20 20 49 66 20 77 65 20 68 61 64 20 6f 72 | t.the.driver.loop...If.we.had.or |
| ed1a0 | 69 67 69 6e 61 6c 6c 79 20 69 6e 63 6c 75 64 65 64 20 60 63 6f 6e 73 27 2c 20 60 63 61 72 27 2c | iginally.included.`cons',.`car', |
| ed1c0 | 20 61 6e 64 0a 60 63 64 72 27 20 61 73 20 70 72 69 6d 69 74 69 76 65 73 20 69 6e 20 74 68 65 20 | .and.`cdr'.as.primitives.in.the. |
| ed1e0 | 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 74 68 65 79 20 77 69 6c 6c 20 62 65 | global.environment,.they.will.be |
| ed200 | 20 72 65 64 65 66 69 6e 65 64 2e 0a 28 41 6c 73 6f 20 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 | .redefined..(Also.see.*Note.Exer |
| ed220 | 63 69 73 65 20 34 2d 33 33 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 | cise.4-33::.and.*Note.Exercise.4 |
| ed240 | 2d 33 34 3a 3a 2e 29 0a 0a 20 20 20 28 33 29 20 54 68 69 73 20 70 65 72 6d 69 74 73 20 75 73 20 | -34::.).....(3).This.permits.us. |
| ed260 | 74 6f 20 63 72 65 61 74 65 20 64 65 6c 61 79 65 64 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 6d 6f | to.create.delayed.versions.of.mo |
| ed280 | 72 65 20 67 65 6e 65 72 61 6c 20 6b 69 6e 64 73 0a 6f 66 20 6c 69 73 74 20 73 74 72 75 63 74 75 | re.general.kinds.of.list.structu |
| ed2a0 | 72 65 73 2c 20 6e 6f 74 20 6a 75 73 74 20 73 65 71 75 65 6e 63 65 73 2e 20 20 48 75 67 68 65 73 | res,.not.just.sequences...Hughes |
| ed2c0 | 20 31 39 39 30 20 64 69 73 63 75 73 73 65 73 20 73 6f 6d 65 0a 61 70 70 6c 69 63 61 74 69 6f 6e | .1990.discusses.some.application |
| ed2e0 | 73 20 6f 66 20 22 6c 61 7a 79 20 74 72 65 65 73 2e 22 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 | s.of."lazy.trees."....File:.sicp |
| ed300 | 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 33 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2c 20 20 | .info,..Node:.4-3,..Next:.4-4,.. |
| ed320 | 50 72 65 76 3a 20 34 2d 32 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 34 0a 0a 34 2e 33 20 56 | Prev:.4-2,..Up:.Chapter.4..4.3.V |
| ed340 | 61 72 69 61 74 69 6f 6e 73 20 6f 6e 20 61 20 53 63 68 65 6d 65 20 2d 20 4e 6f 6e 64 65 74 65 72 | ariations.on.a.Scheme.-.Nondeter |
| ed360 | 6d 69 6e 69 73 74 69 63 20 43 6f 6d 70 75 74 69 6e 67 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ministic.Computing.============= |
| ed380 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ================================ |
| ed3a0 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 20 77 65 20 | ==========..In.this.section,.we. |
| ed3c0 | 65 78 74 65 6e 64 20 74 68 65 20 53 63 68 65 6d 65 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 73 | extend.the.Scheme.evaluator.to.s |
| ed3e0 | 75 70 70 6f 72 74 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 0a 70 61 72 61 64 69 67 6d 20 63 61 | upport.a.programming.paradigm.ca |
| ed400 | 6c 6c 65 64 20 22 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 63 6f 6d 70 75 74 69 6e 67 | lled."nondeterministic.computing |
| ed420 | 22 20 62 79 20 62 75 69 6c 64 69 6e 67 20 69 6e 74 6f 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 | ".by.building.into.the.evaluator |
| ed440 | 20 61 20 66 61 63 69 6c 69 74 79 20 74 6f 20 73 75 70 70 6f 72 74 20 61 75 74 6f 6d 61 74 69 63 | .a.facility.to.support.automatic |
| ed460 | 20 73 65 61 72 63 68 2e 20 20 54 68 69 73 20 69 73 20 61 20 6d 75 63 68 20 6d 6f 72 65 0a 70 72 | .search...This.is.a.much.more.pr |
| ed480 | 6f 66 6f 75 6e 64 20 63 68 61 6e 67 65 20 74 6f 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 74 68 | ofound.change.to.the.language.th |
| ed4a0 | 61 6e 20 74 68 65 20 69 6e 74 72 6f 64 75 63 74 69 6f 6e 20 6f 66 20 6c 61 7a 79 0a 65 76 61 6c | an.the.introduction.of.lazy.eval |
| ed4c0 | 75 61 74 69 6f 6e 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 32 3a 3a 2e 0a 0a | uation.in.section.*Note.4-2::... |
| ed4e0 | 20 20 20 4e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 63 6f 6d 70 75 74 69 6e 67 2c 20 6c | ...Nondeterministic.computing,.l |
| ed500 | 69 6b 65 20 73 74 72 65 61 6d 20 70 72 6f 63 65 73 73 69 6e 67 2c 20 69 73 20 75 73 65 66 75 6c | ike.stream.processing,.is.useful |
| ed520 | 20 66 6f 72 0a 22 67 65 6e 65 72 61 74 65 20 61 6e 64 20 74 65 73 74 22 20 61 70 70 6c 69 63 61 | .for."generate.and.test".applica |
| ed540 | 74 69 6f 6e 73 2e 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 74 61 73 6b 20 6f 66 20 73 74 61 | tions...Consider.the.task.of.sta |
| ed560 | 72 74 69 6e 67 20 77 69 74 68 0a 74 77 6f 20 6c 69 73 74 73 20 6f 66 20 70 6f 73 69 74 69 76 65 | rting.with.two.lists.of.positive |
| ed580 | 20 69 6e 74 65 67 65 72 73 20 61 6e 64 20 66 69 6e 64 69 6e 67 20 61 20 70 61 69 72 20 6f 66 20 | .integers.and.finding.a.pair.of. |
| ed5a0 | 69 6e 74 65 67 65 72 73 2d 2d 6f 6e 65 20 66 72 6f 6d 0a 74 68 65 20 66 69 72 73 74 20 6c 69 73 | integers--one.from.the.first.lis |
| ed5c0 | 74 20 61 6e 64 20 6f 6e 65 20 66 72 6f 6d 20 74 68 65 20 73 65 63 6f 6e 64 20 6c 69 73 74 2d 2d | t.and.one.from.the.second.list-- |
| ed5e0 | 77 68 6f 73 65 20 73 75 6d 20 69 73 20 70 72 69 6d 65 2e 20 20 57 65 0a 73 61 77 20 68 6f 77 20 | whose.sum.is.prime...We.saw.how. |
| ed600 | 74 6f 20 68 61 6e 64 6c 65 20 74 68 69 73 20 77 69 74 68 20 66 69 6e 69 74 65 20 73 65 71 75 65 | to.handle.this.with.finite.seque |
| ed620 | 6e 63 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a | nce.operations.in.section.*Note. |
| ed640 | 32 2d 32 2d 33 3a 3a 20 61 6e 64 20 77 69 74 68 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d | 2-2-3::.and.with.infinite.stream |
| ed660 | 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d 33 3a 3a 2e 20 20 4f 75 72 | s.in.section.*Note.3-5-3::...Our |
| ed680 | 0a 61 70 70 72 6f 61 63 68 20 77 61 73 20 74 6f 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 73 65 | .approach.was.to.generate.the.se |
| ed6a0 | 71 75 65 6e 63 65 20 6f 66 20 61 6c 6c 20 70 6f 73 73 69 62 6c 65 20 70 61 69 72 73 20 61 6e 64 | quence.of.all.possible.pairs.and |
| ed6c0 | 20 66 69 6c 74 65 72 0a 74 68 65 73 65 20 74 6f 20 73 65 6c 65 63 74 20 74 68 65 20 70 61 69 72 | .filter.these.to.select.the.pair |
| ed6e0 | 73 20 77 68 6f 73 65 20 73 75 6d 20 69 73 20 70 72 69 6d 65 2e 20 20 57 68 65 74 68 65 72 20 77 | s.whose.sum.is.prime...Whether.w |
| ed700 | 65 20 61 63 74 75 61 6c 6c 79 0a 67 65 6e 65 72 61 74 65 20 74 68 65 20 65 6e 74 69 72 65 20 73 | e.actually.generate.the.entire.s |
| ed720 | 65 71 75 65 6e 63 65 20 6f 66 20 70 61 69 72 73 20 66 69 72 73 74 20 61 73 20 69 6e 20 2a 4e 6f | equence.of.pairs.first.as.in.*No |
| ed740 | 74 65 20 43 68 61 70 74 65 72 20 32 3a 3a 2c 20 6f 72 0a 69 6e 74 65 72 6c 65 61 76 65 20 74 68 | te.Chapter.2::,.or.interleave.th |
| ed760 | 65 20 67 65 6e 65 72 61 74 69 6e 67 20 61 6e 64 20 66 69 6c 74 65 72 69 6e 67 20 61 73 20 69 6e | e.generating.and.filtering.as.in |
| ed780 | 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 2c 20 69 73 0a 69 6d 6d 61 74 65 72 69 61 | .*Note.Chapter.3::,.is.immateria |
| ed7a0 | 6c 20 74 6f 20 74 68 65 20 65 73 73 65 6e 74 69 61 6c 20 69 6d 61 67 65 20 6f 66 20 68 6f 77 20 | l.to.the.essential.image.of.how. |
| ed7c0 | 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 69 73 20 6f 72 67 61 6e 69 7a 65 64 2e 0a 0a 20 | the.computation.is.organized.... |
| ed7e0 | 20 20 54 68 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 61 70 70 72 6f 61 63 68 20 | ..The.nondeterministic.approach. |
| ed800 | 65 76 6f 6b 65 73 20 61 20 64 69 66 66 65 72 65 6e 74 20 69 6d 61 67 65 2e 20 20 49 6d 61 67 69 | evokes.a.different.image...Imagi |
| ed820 | 6e 65 0a 73 69 6d 70 6c 79 20 74 68 61 74 20 77 65 20 63 68 6f 6f 73 65 20 28 69 6e 20 73 6f 6d | ne.simply.that.we.choose.(in.som |
| ed840 | 65 20 77 61 79 29 20 61 20 6e 75 6d 62 65 72 20 66 72 6f 6d 20 74 68 65 20 66 69 72 73 74 20 6c | e.way).a.number.from.the.first.l |
| ed860 | 69 73 74 20 61 6e 64 20 61 0a 6e 75 6d 62 65 72 20 66 72 6f 6d 20 74 68 65 20 73 65 63 6f 6e 64 | ist.and.a.number.from.the.second |
| ed880 | 20 6c 69 73 74 20 61 6e 64 20 72 65 71 75 69 72 65 20 28 75 73 69 6e 67 20 73 6f 6d 65 20 6d 65 | .list.and.require.(using.some.me |
| ed8a0 | 63 68 61 6e 69 73 6d 29 20 74 68 61 74 0a 74 68 65 69 72 20 73 75 6d 20 62 65 20 70 72 69 6d 65 | chanism).that.their.sum.be.prime |
| ed8c0 | 2e 20 20 54 68 69 73 20 69 73 20 65 78 70 72 65 73 73 65 64 20 62 79 20 66 6f 6c 6c 6f 77 69 6e | ...This.is.expressed.by.followin |
| ed8e0 | 67 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 69 6d | g.procedure:.......(define.(prim |
| ed900 | 65 2d 73 75 6d 2d 70 61 69 72 20 6c 69 73 74 31 20 6c 69 73 74 32 29 0a 20 20 20 20 20 20 20 28 | e-sum-pair.list1.list2)........( |
| ed920 | 6c 65 74 20 28 28 61 20 28 61 6e 2d 65 6c 65 6d 65 6e 74 2d 6f 66 20 6c 69 73 74 31 29 29 0a 20 | let.((a.(an-element-of.list1)).. |
| ed940 | 20 20 20 20 20 20 20 20 20 20 20 20 28 62 20 28 61 6e 2d 65 6c 65 6d 65 6e 74 2d 6f 66 20 6c 69 | ............(b.(an-element-of.li |
| ed960 | 73 74 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 70 72 69 6d 65 3f | st2)))..........(require.(prime? |
| ed980 | 20 28 2b 20 61 20 62 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 61 20 62 29 29 29 | .(+.a.b)))..........(list.a.b))) |
| ed9a0 | 0a 0a 20 20 20 49 74 20 6d 69 67 68 74 20 73 65 65 6d 20 61 73 20 69 66 20 74 68 69 73 20 70 72 | .....It.might.seem.as.if.this.pr |
| ed9c0 | 6f 63 65 64 75 72 65 20 6d 65 72 65 6c 79 20 72 65 73 74 61 74 65 73 20 74 68 65 20 70 72 6f 62 | ocedure.merely.restates.the.prob |
| ed9e0 | 6c 65 6d 2c 0a 72 61 74 68 65 72 20 74 68 61 6e 20 73 70 65 63 69 66 79 69 6e 67 20 61 20 77 61 | lem,.rather.than.specifying.a.wa |
| eda00 | 79 20 74 6f 20 73 6f 6c 76 65 20 69 74 2e 20 20 4e 65 76 65 72 74 68 65 6c 65 73 73 2c 20 74 68 | y.to.solve.it...Nevertheless,.th |
| eda20 | 69 73 20 69 73 20 61 0a 6c 65 67 69 74 69 6d 61 74 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 | is.is.a.legitimate.nondeterminis |
| eda40 | 74 69 63 20 70 72 6f 67 72 61 6d 2e 28 31 29 0a 0a 20 20 20 54 68 65 20 6b 65 79 20 69 64 65 61 | tic.program.(1).....The.key.idea |
| eda60 | 20 68 65 72 65 20 69 73 20 74 68 61 74 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 61 20 6e | .here.is.that.expressions.in.a.n |
| eda80 | 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 6c 61 6e 67 75 61 67 65 0a 63 61 6e 20 68 61 76 | ondeterministic.language.can.hav |
| edaa0 | 65 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 2e 20 | e.more.than.one.possible.value.. |
| edac0 | 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 60 61 6e 2d 65 6c 65 6d 65 6e 74 2d 6f 66 27 0a 6d | .For.instance,.`an-element-of'.m |
| edae0 | 69 67 68 74 20 72 65 74 75 72 6e 20 61 6e 79 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 67 | ight.return.any.element.of.the.g |
| edb00 | 69 76 65 6e 20 6c 69 73 74 2e 20 20 4f 75 72 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 | iven.list...Our.nondeterministic |
| edb20 | 0a 70 72 6f 67 72 61 6d 20 65 76 61 6c 75 61 74 6f 72 20 77 69 6c 6c 20 77 6f 72 6b 20 62 79 20 | .program.evaluator.will.work.by. |
| edb40 | 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 63 68 6f 6f 73 69 6e 67 20 61 20 70 6f 73 73 69 62 6c | automatically.choosing.a.possibl |
| edb60 | 65 20 76 61 6c 75 65 0a 61 6e 64 20 6b 65 65 70 69 6e 67 20 74 72 61 63 6b 20 6f 66 20 74 68 65 | e.value.and.keeping.track.of.the |
| edb80 | 20 63 68 6f 69 63 65 2e 20 20 49 66 20 61 20 73 75 62 73 65 71 75 65 6e 74 20 72 65 71 75 69 72 | .choice...If.a.subsequent.requir |
| edba0 | 65 6d 65 6e 74 20 69 73 20 6e 6f 74 0a 6d 65 74 2c 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 | ement.is.not.met,.the.evaluator. |
| edbc0 | 77 69 6c 6c 20 74 72 79 20 61 20 64 69 66 66 65 72 65 6e 74 20 63 68 6f 69 63 65 2c 20 61 6e 64 | will.try.a.different.choice,.and |
| edbe0 | 20 69 74 20 77 69 6c 6c 20 6b 65 65 70 20 74 72 79 69 6e 67 0a 6e 65 77 20 63 68 6f 69 63 65 73 | .it.will.keep.trying.new.choices |
| edc00 | 20 75 6e 74 69 6c 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 73 75 63 63 65 65 64 73 2c 20 | .until.the.evaluation.succeeds,. |
| edc20 | 6f 72 20 75 6e 74 69 6c 20 77 65 20 72 75 6e 20 6f 75 74 20 6f 66 0a 63 68 6f 69 63 65 73 2e 20 | or.until.we.run.out.of.choices.. |
| edc40 | 20 4a 75 73 74 20 61 73 20 74 68 65 20 6c 61 7a 79 20 65 76 61 6c 75 61 74 6f 72 20 66 72 65 65 | .Just.as.the.lazy.evaluator.free |
| edc60 | 64 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 65 72 20 66 72 6f 6d 20 74 68 65 0a 64 65 74 61 69 6c | d.the.programmer.from.the.detail |
| edc80 | 73 20 6f 66 20 68 6f 77 20 76 61 6c 75 65 73 20 61 72 65 20 64 65 6c 61 79 65 64 20 61 6e 64 20 | s.of.how.values.are.delayed.and. |
| edca0 | 66 6f 72 63 65 64 2c 20 74 68 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 0a 70 72 6f | forced,.the.nondeterministic.pro |
| edcc0 | 67 72 61 6d 20 65 76 61 6c 75 61 74 6f 72 20 77 69 6c 6c 20 66 72 65 65 20 74 68 65 20 70 72 6f | gram.evaluator.will.free.the.pro |
| edce0 | 67 72 61 6d 6d 65 72 20 66 72 6f 6d 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 68 6f 77 0a | grammer.from.the.details.of.how. |
| edd00 | 63 68 6f 69 63 65 73 20 61 72 65 20 6d 61 64 65 2e 0a 0a 20 20 20 49 74 20 69 73 20 69 6e 73 74 | choices.are.made......It.is.inst |
| edd20 | 72 75 63 74 69 76 65 20 74 6f 20 63 6f 6e 74 72 61 73 74 20 74 68 65 20 64 69 66 66 65 72 65 6e | ructive.to.contrast.the.differen |
| edd40 | 74 20 69 6d 61 67 65 73 20 6f 66 20 74 69 6d 65 20 65 76 6f 6b 65 64 20 62 79 0a 6e 6f 6e 64 65 | t.images.of.time.evoked.by.nonde |
| edd60 | 74 65 72 6d 69 6e 69 73 74 69 63 20 65 76 61 6c 75 61 74 69 6f 6e 20 61 6e 64 20 73 74 72 65 61 | terministic.evaluation.and.strea |
| edd80 | 6d 20 70 72 6f 63 65 73 73 69 6e 67 2e 20 20 53 74 72 65 61 6d 20 70 72 6f 63 65 73 73 69 6e 67 | m.processing...Stream.processing |
| edda0 | 0a 75 73 65 73 20 6c 61 7a 79 20 65 76 61 6c 75 61 74 69 6f 6e 20 74 6f 20 64 65 63 6f 75 70 6c | .uses.lazy.evaluation.to.decoupl |
| eddc0 | 65 20 74 68 65 20 74 69 6d 65 20 77 68 65 6e 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 70 6f | e.the.time.when.the.stream.of.po |
| edde0 | 73 73 69 62 6c 65 0a 61 6e 73 77 65 72 73 20 69 73 20 61 73 73 65 6d 62 6c 65 64 20 66 72 6f 6d | ssible.answers.is.assembled.from |
| ede00 | 20 74 68 65 20 74 69 6d 65 20 77 68 65 6e 20 74 68 65 20 61 63 74 75 61 6c 20 73 74 72 65 61 6d | .the.time.when.the.actual.stream |
| ede20 | 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 0a 70 72 6f 64 75 63 65 64 2e 20 20 54 68 65 20 65 76 61 | .elements.are.produced...The.eva |
| ede40 | 6c 75 61 74 6f 72 20 73 75 70 70 6f 72 74 73 20 74 68 65 20 69 6c 6c 75 73 69 6f 6e 20 74 68 61 | luator.supports.the.illusion.tha |
| ede60 | 74 20 61 6c 6c 20 74 68 65 20 70 6f 73 73 69 62 6c 65 0a 61 6e 73 77 65 72 73 20 61 72 65 20 6c | t.all.the.possible.answers.are.l |
| ede80 | 61 69 64 20 6f 75 74 20 62 65 66 6f 72 65 20 75 73 20 69 6e 20 61 20 74 69 6d 65 6c 65 73 73 20 | aid.out.before.us.in.a.timeless. |
| edea0 | 73 65 71 75 65 6e 63 65 2e 20 20 57 69 74 68 0a 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 | sequence...With.nondeterministic |
| edec0 | 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 72 65 70 72 65 | .evaluation,.an.expression.repre |
| edee0 | 73 65 6e 74 73 20 74 68 65 20 65 78 70 6c 6f 72 61 74 69 6f 6e 0a 6f 66 20 61 20 73 65 74 20 6f | sents.the.exploration.of.a.set.o |
| edf00 | 66 20 70 6f 73 73 69 62 6c 65 20 77 6f 72 6c 64 73 2c 20 65 61 63 68 20 64 65 74 65 72 6d 69 6e | f.possible.worlds,.each.determin |
| edf20 | 65 64 20 62 79 20 61 20 73 65 74 20 6f 66 20 63 68 6f 69 63 65 73 2e 20 20 53 6f 6d 65 0a 6f 66 | ed.by.a.set.of.choices...Some.of |
| edf40 | 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20 77 6f 72 6c 64 73 20 6c 65 61 64 20 74 6f 20 64 65 61 | .the.possible.worlds.lead.to.dea |
| edf60 | 64 20 65 6e 64 73 2c 20 77 68 69 6c 65 20 6f 74 68 65 72 73 20 68 61 76 65 20 75 73 65 66 75 6c | d.ends,.while.others.have.useful |
| edf80 | 0a 76 61 6c 75 65 73 2e 20 20 54 68 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 | .values...The.nondeterministic.p |
| edfa0 | 72 6f 67 72 61 6d 20 65 76 61 6c 75 61 74 6f 72 20 73 75 70 70 6f 72 74 73 20 74 68 65 20 69 6c | rogram.evaluator.supports.the.il |
| edfc0 | 6c 75 73 69 6f 6e 0a 74 68 61 74 20 74 69 6d 65 20 62 72 61 6e 63 68 65 73 2c 20 61 6e 64 20 74 | lusion.that.time.branches,.and.t |
| edfe0 | 68 61 74 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 68 61 76 65 20 64 69 66 66 65 72 65 6e 74 20 | hat.our.programs.have.different. |
| ee000 | 70 6f 73 73 69 62 6c 65 0a 65 78 65 63 75 74 69 6f 6e 20 68 69 73 74 6f 72 69 65 73 2e 20 20 57 | possible.execution.histories...W |
| ee020 | 68 65 6e 20 77 65 20 72 65 61 63 68 20 61 20 64 65 61 64 20 65 6e 64 2c 20 77 65 20 63 61 6e 20 | hen.we.reach.a.dead.end,.we.can. |
| ee040 | 72 65 76 69 73 69 74 20 61 0a 70 72 65 76 69 6f 75 73 20 63 68 6f 69 63 65 20 70 6f 69 6e 74 20 | revisit.a.previous.choice.point. |
| ee060 | 61 6e 64 20 70 72 6f 63 65 65 64 20 61 6c 6f 6e 67 20 61 20 64 69 66 66 65 72 65 6e 74 20 62 72 | and.proceed.along.a.different.br |
| ee080 | 61 6e 63 68 2e 0a 0a 20 20 20 54 68 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 | anch......The.nondeterministic.p |
| ee0a0 | 72 6f 67 72 61 6d 20 65 76 61 6c 75 61 74 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 65 6c | rogram.evaluator.implemented.bel |
| ee0c0 | 6f 77 20 69 73 20 63 61 6c 6c 65 64 0a 74 68 65 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 | ow.is.called.the.`amb'.evaluator |
| ee0e0 | 20 62 65 63 61 75 73 65 20 69 74 20 69 73 20 62 61 73 65 64 20 6f 6e 20 61 20 6e 65 77 20 73 70 | .because.it.is.based.on.a.new.sp |
| ee100 | 65 63 69 61 6c 20 66 6f 72 6d 20 63 61 6c 6c 65 64 0a 60 61 6d 62 27 2e 20 20 57 65 20 63 61 6e | ecial.form.called.`amb'...We.can |
| ee120 | 20 74 79 70 65 20 74 68 65 20 61 62 6f 76 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 70 | .type.the.above.definition.of.`p |
| ee140 | 72 69 6d 65 2d 73 75 6d 2d 70 61 69 72 27 20 61 74 20 74 68 65 0a 60 61 6d 62 27 20 65 76 61 6c | rime-sum-pair'.at.the.`amb'.eval |
| ee160 | 75 61 74 6f 72 20 64 72 69 76 65 72 20 6c 6f 6f 70 20 28 61 6c 6f 6e 67 20 77 69 74 68 20 64 65 | uator.driver.loop.(along.with.de |
| ee180 | 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 60 70 72 69 6d 65 3f 27 2c 0a 60 61 6e 2d 65 6c 65 6d 65 | finitions.of.`prime?',.`an-eleme |
| ee1a0 | 6e 74 2d 6f 66 27 2c 20 61 6e 64 20 60 72 65 71 75 69 72 65 27 29 20 61 6e 64 20 72 75 6e 20 74 | nt-of',.and.`require').and.run.t |
| ee1c0 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 3b | he.procedure.as.follows:.......; |
| ee1e0 | 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 70 72 69 6d 65 2d 73 | ;;.Amb-Eval.input:......(prime-s |
| ee200 | 75 6d 2d 70 61 69 72 20 27 28 31 20 33 20 35 20 38 29 20 27 28 32 30 20 33 35 20 31 31 30 29 29 | um-pair.'(1.3.5.8).'(20.35.110)) |
| ee220 | 0a 20 20 20 20 20 3b 3b 3b 20 53 74 61 72 74 69 6e 67 20 61 20 6e 65 77 20 70 72 6f 62 6c 65 6d | ......;;;.Starting.a.new.problem |
| ee240 | 0a 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 28 | ......;;;.Amb-Eval.value:......( |
| ee260 | 33 20 32 30 29 0a 0a 20 20 20 54 68 65 20 76 61 6c 75 65 20 72 65 74 75 72 6e 65 64 20 77 61 73 | 3.20).....The.value.returned.was |
| ee280 | 20 6f 62 74 61 69 6e 65 64 20 61 66 74 65 72 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 72 65 | .obtained.after.the.evaluator.re |
| ee2a0 | 70 65 61 74 65 64 6c 79 20 63 68 6f 73 65 0a 65 6c 65 6d 65 6e 74 73 20 66 72 6f 6d 20 65 61 63 | peatedly.chose.elements.from.eac |
| ee2c0 | 68 20 6f 66 20 74 68 65 20 6c 69 73 74 73 2c 20 75 6e 74 69 6c 20 61 20 73 75 63 63 65 73 73 66 | h.of.the.lists,.until.a.successf |
| ee2e0 | 75 6c 20 63 68 6f 69 63 65 20 77 61 73 20 6d 61 64 65 2e 0a 0a 20 20 20 53 65 63 74 69 6f 6e 20 | ul.choice.was.made......Section. |
| ee300 | 2a 4e 6f 74 65 20 34 2d 33 2d 31 3a 3a 20 69 6e 74 72 6f 64 75 63 65 73 20 60 61 6d 62 27 20 61 | *Note.4-3-1::.introduces.`amb'.a |
| ee320 | 6e 64 20 65 78 70 6c 61 69 6e 73 20 68 6f 77 20 69 74 20 73 75 70 70 6f 72 74 73 0a 6e 6f 6e 64 | nd.explains.how.it.supports.nond |
| ee340 | 65 74 65 72 6d 69 6e 69 73 6d 20 74 68 72 6f 75 67 68 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 | eterminism.through.the.evaluator |
| ee360 | 27 73 20 61 75 74 6f 6d 61 74 69 63 20 73 65 61 72 63 68 20 6d 65 63 68 61 6e 69 73 6d 2e 0a 53 | 's.automatic.search.mechanism..S |
| ee380 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 33 2d 32 3a 3a 20 70 72 65 73 65 6e 74 73 20 65 78 | ection.*Note.4-3-2::.presents.ex |
| ee3a0 | 61 6d 70 6c 65 73 20 6f 66 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 72 6f 67 72 | amples.of.nondeterministic.progr |
| ee3c0 | 61 6d 73 2c 0a 61 6e 64 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 33 2d 33 3a 3a 20 67 | ams,.and.section.*Note.4-3-3::.g |
| ee3e0 | 69 76 65 73 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 | ives.the.details.of.how.to.imple |
| ee400 | 6d 65 6e 74 20 74 68 65 0a 60 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 20 62 79 20 6d 6f 64 69 | ment.the.`amb'.evaluator.by.modi |
| ee420 | 66 79 69 6e 67 20 74 68 65 20 6f 72 64 69 6e 61 72 79 20 53 63 68 65 6d 65 20 65 76 61 6c 75 61 | fying.the.ordinary.Scheme.evalua |
| ee440 | 74 6f 72 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 34 2d 33 2d 31 3a 3a 20 20 20 20 20 20 20 20 | tor...*.Menu:..*.4-3-1::........ |
| ee460 | 20 20 20 20 41 6d 62 20 61 6e 64 20 53 65 61 72 63 68 0a 2a 20 34 2d 33 2d 32 3a 3a 20 20 20 20 | ....Amb.and.Search.*.4-3-2::.... |
| ee480 | 20 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 73 20 6f 66 20 4e 6f 6e 64 65 74 65 72 6d 69 6e 69 | ........Examples.of.Nondetermini |
| ee4a0 | 73 74 69 63 20 50 72 6f 67 72 61 6d 73 0a 2a 20 34 2d 33 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 | stic.Programs.*.4-3-3::......... |
| ee4c0 | 20 20 20 49 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 60 41 6d 62 27 20 45 76 61 6c 75 61 | ...Implementing.the.`Amb'.Evalua |
| ee4e0 | 74 6f 72 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d | tor.....----------.Footnotes.--- |
| ee500 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 57 65 20 61 73 73 75 6d 65 20 74 68 61 74 20 77 | -------.....(1).We.assume.that.w |
| ee520 | 65 20 68 61 76 65 20 70 72 65 76 69 6f 75 73 6c 79 20 64 65 66 69 6e 65 64 20 61 20 70 72 6f 63 | e.have.previously.defined.a.proc |
| ee540 | 65 64 75 72 65 20 60 70 72 69 6d 65 3f 27 0a 74 68 61 74 20 74 65 73 74 73 20 77 68 65 74 68 65 | edure.`prime?'.that.tests.whethe |
| ee560 | 72 20 6e 75 6d 62 65 72 73 20 61 72 65 20 70 72 69 6d 65 2e 20 20 45 76 65 6e 20 77 69 74 68 20 | r.numbers.are.prime...Even.with. |
| ee580 | 60 70 72 69 6d 65 3f 27 20 64 65 66 69 6e 65 64 2c 20 74 68 65 0a 60 70 72 69 6d 65 2d 73 75 6d | `prime?'.defined,.the.`prime-sum |
| ee5a0 | 2d 70 61 69 72 27 20 70 72 6f 63 65 64 75 72 65 20 6d 61 79 20 6c 6f 6f 6b 20 73 75 73 70 69 63 | -pair'.procedure.may.look.suspic |
| ee5c0 | 69 6f 75 73 6c 79 20 6c 69 6b 65 20 74 68 65 20 75 6e 68 65 6c 70 66 75 6c 0a 22 70 73 65 75 64 | iously.like.the.unhelpful."pseud |
| ee5e0 | 6f 2d 4c 69 73 70 22 20 61 74 74 65 6d 70 74 20 74 6f 20 64 65 66 69 6e 65 20 74 68 65 20 73 71 | o-Lisp".attempt.to.define.the.sq |
| ee600 | 75 61 72 65 2d 72 6f 6f 74 20 66 75 6e 63 74 69 6f 6e 2c 20 77 68 69 63 68 20 77 65 0a 64 65 73 | uare-root.function,.which.we.des |
| ee620 | 63 72 69 62 65 64 20 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 73 65 63 74 69 | cribed.at.the.beginning.of.secti |
| ee640 | 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 37 3a 3a 2e 20 20 49 6e 20 66 61 63 74 2c 20 61 0a 73 71 | on.*Note.1-1-7::...In.fact,.a.sq |
| ee660 | 75 61 72 65 2d 72 6f 6f 74 20 70 72 6f 63 65 64 75 72 65 20 61 6c 6f 6e 67 20 74 68 6f 73 65 20 | uare-root.procedure.along.those. |
| ee680 | 6c 69 6e 65 73 20 63 61 6e 20 61 63 74 75 61 6c 6c 79 20 62 65 20 66 6f 72 6d 75 6c 61 74 65 64 | lines.can.actually.be.formulated |
| ee6a0 | 20 61 73 20 61 0a 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 72 6f 67 72 61 6d 2e 20 | .as.a.nondeterministic.program.. |
| ee6c0 | 20 42 79 20 69 6e 63 6f 72 70 6f 72 61 74 69 6e 67 20 61 20 73 65 61 72 63 68 20 6d 65 63 68 61 | .By.incorporating.a.search.mecha |
| ee6e0 | 6e 69 73 6d 20 69 6e 74 6f 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 2c 20 77 65 20 61 72 65 20 | nism.into.the.evaluator,.we.are. |
| ee700 | 65 72 6f 64 69 6e 67 20 74 68 65 20 64 69 73 74 69 6e 63 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 | eroding.the.distinction.between. |
| ee720 | 70 75 72 65 6c 79 20 64 65 63 6c 61 72 61 74 69 76 65 0a 64 65 73 63 72 69 70 74 69 6f 6e 73 20 | purely.declarative.descriptions. |
| ee740 | 61 6e 64 20 69 6d 70 65 72 61 74 69 76 65 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 73 20 6f 66 | and.imperative.specifications.of |
| ee760 | 20 68 6f 77 20 74 6f 20 63 6f 6d 70 75 74 65 20 61 6e 73 77 65 72 73 2e 0a 57 65 27 6c 6c 20 67 | .how.to.compute.answers..We'll.g |
| ee780 | 6f 20 65 76 65 6e 20 66 61 72 74 68 65 72 20 69 6e 20 74 68 69 73 20 64 69 72 65 63 74 69 6f 6e | o.even.farther.in.this.direction |
| ee7a0 | 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 3a 3a 2e 0a 0a 1f 0a 46 69 6c 65 | .in.section.*Note.4-4::.....File |
| ee7c0 | 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 33 2d 31 2c 20 20 4e 65 78 74 | :.sicp.info,..Node:.4-3-1,..Next |
| ee7e0 | 3a 20 34 2d 33 2d 32 2c 20 20 50 72 65 76 3a 20 34 2d 33 2c 20 20 55 70 3a 20 34 2d 33 0a 0a 34 | :.4-3-2,..Prev:.4-3,..Up:.4-3..4 |
| ee800 | 2e 33 2e 31 20 41 6d 62 20 61 6e 64 20 53 65 61 72 63 68 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .3.1.Amb.and.Search.------------ |
| ee820 | 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 6f 20 65 78 74 65 6e 64 20 53 63 68 65 6d 65 20 74 6f 20 73 75 | --------..To.extend.Scheme.to.su |
| ee840 | 70 70 6f 72 74 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 6d 2c 20 77 65 20 69 6e 74 72 6f 64 75 | pport.nondeterminism,.we.introdu |
| ee860 | 63 65 20 61 20 6e 65 77 20 73 70 65 63 69 61 6c 0a 66 6f 72 6d 20 63 61 6c 6c 65 64 20 60 61 6d | ce.a.new.special.form.called.`am |
| ee880 | 62 27 2e 28 31 29 20 54 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 28 61 6d 62 | b'.(1).The.expression.......(amb |
| ee8a0 | 20 3c 45 5f 31 3e 20 3c 45 5f 32 3e 20 2e 2e 2e 20 3c 45 5f 4e 3e 29 0a 0a 72 65 74 75 72 6e 73 | .<E_1>.<E_2>.....<E_N>)..returns |
| ee8c0 | 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 6f 6e 65 20 6f 66 20 74 68 65 20 6e 20 65 78 70 72 65 | .the.value.of.one.of.the.n.expre |
| ee8e0 | 73 73 69 6f 6e 73 20 3c 45 5f 49 3e 20 22 61 6d 62 69 67 75 6f 75 73 6c 79 2e 22 20 20 46 6f 72 | ssions.<E_I>."ambiguously."..For |
| ee900 | 0a 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 0a 20 20 20 20 20 28 | .example,.the.expression.......( |
| ee920 | 6c 69 73 74 20 28 61 6d 62 20 31 20 32 20 33 29 20 28 61 6d 62 20 27 61 20 27 62 29 29 0a 0a 63 | list.(amb.1.2.3).(amb.'a.'b))..c |
| ee940 | 61 6e 20 68 61 76 65 20 73 69 78 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 3a 0a 0a 20 20 | an.have.six.possible.values:.... |
| ee960 | 20 20 20 60 28 31 20 61 29 27 20 60 28 31 20 62 29 27 20 60 28 32 20 61 29 27 20 60 28 32 20 62 | ...`(1.a)'.`(1.b)'.`(2.a)'.`(2.b |
| ee980 | 29 27 20 60 28 33 20 61 29 27 20 60 28 33 20 62 29 27 0a 0a 20 20 20 60 41 6d 62 27 20 77 69 74 | )'.`(3.a)'.`(3.b)'.....`Amb'.wit |
| ee9a0 | 68 20 61 20 73 69 6e 67 6c 65 20 63 68 6f 69 63 65 20 70 72 6f 64 75 63 65 73 20 61 6e 20 6f 72 | h.a.single.choice.produces.an.or |
| ee9c0 | 64 69 6e 61 72 79 20 28 73 69 6e 67 6c 65 29 20 76 61 6c 75 65 2e 0a 0a 20 20 20 60 41 6d 62 27 | dinary.(single).value......`Amb' |
| ee9e0 | 20 77 69 74 68 20 6e 6f 20 63 68 6f 69 63 65 73 2d 2d 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e | .with.no.choices--the.expression |
| eea00 | 20 60 28 61 6d 62 29 27 2d 2d 69 73 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 77 69 74 68 0a | .`(amb)'--is.an.expression.with. |
| eea20 | 6e 6f 20 61 63 63 65 70 74 61 62 6c 65 20 76 61 6c 75 65 73 2e 20 20 4f 70 65 72 61 74 69 6f 6e | no.acceptable.values...Operation |
| eea40 | 61 6c 6c 79 2c 20 77 65 20 63 61 6e 20 74 68 69 6e 6b 20 6f 66 20 60 28 61 6d 62 29 27 20 61 73 | ally,.we.can.think.of.`(amb)'.as |
| eea60 | 20 61 6e 0a 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 77 68 65 6e 20 65 76 61 6c 75 61 74 | .an.expression.that.when.evaluat |
| eea80 | 65 64 20 63 61 75 73 65 73 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 74 6f 20 22 66 61 | ed.causes.the.computation.to."fa |
| eeaa0 | 69 6c 22 3a 20 54 68 65 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 20 61 62 6f 72 74 73 20 61 6e 64 20 | il":.The.computation.aborts.and. |
| eeac0 | 6e 6f 20 76 61 6c 75 65 20 69 73 20 70 72 6f 64 75 63 65 64 2e 20 20 55 73 69 6e 67 20 74 68 69 | no.value.is.produced...Using.thi |
| eeae0 | 73 20 69 64 65 61 2c 20 77 65 20 63 61 6e 0a 65 78 70 72 65 73 73 20 74 68 65 20 72 65 71 75 69 | s.idea,.we.can.express.the.requi |
| eeb00 | 72 65 6d 65 6e 74 20 74 68 61 74 20 61 20 70 61 72 74 69 63 75 6c 61 72 20 70 72 65 64 69 63 61 | rement.that.a.particular.predica |
| eeb20 | 74 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 70 27 20 6d 75 73 74 0a 62 65 20 74 72 75 65 20 61 | te.expression.`p'.must.be.true.a |
| eeb40 | 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 71 75 69 72 | s.follows:.......(define.(requir |
| eeb60 | 65 20 70 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 6f 74 20 70 29 20 28 61 6d 62 29 29 29 0a | e.p)........(if.(not.p).(amb))). |
| eeb80 | 0a 20 20 20 57 69 74 68 20 60 61 6d 62 27 20 61 6e 64 20 60 72 65 71 75 69 72 65 27 2c 20 77 65 | ....With.`amb'.and.`require',.we |
| eeba0 | 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 60 61 6e 2d 65 6c 65 6d 65 6e 74 2d 6f | .can.implement.the.`an-element-o |
| eebc0 | 66 27 0a 70 72 6f 63 65 64 75 72 65 20 75 73 65 64 20 61 62 6f 76 65 3a 0a 0a 20 20 20 20 20 28 | f'.procedure.used.above:.......( |
| eebe0 | 64 65 66 69 6e 65 20 28 61 6e 2d 65 6c 65 6d 65 6e 74 2d 6f 66 20 69 74 65 6d 73 29 0a 20 20 20 | define.(an-element-of.items).... |
| eec00 | 20 20 20 20 28 72 65 71 75 69 72 65 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 29 | ....(require.(not.(null?.items)) |
| eec20 | 29 0a 20 20 20 20 20 20 20 28 61 6d 62 20 28 63 61 72 20 69 74 65 6d 73 29 20 28 61 6e 2d 65 6c | )........(amb.(car.items).(an-el |
| eec40 | 65 6d 65 6e 74 2d 6f 66 20 28 63 64 72 20 69 74 65 6d 73 29 29 29 29 0a 0a 20 20 20 60 41 6e 2d | ement-of.(cdr.items)))).....`An- |
| eec60 | 65 6c 65 6d 65 6e 74 2d 6f 66 27 20 66 61 69 6c 73 20 69 66 20 74 68 65 20 6c 69 73 74 20 69 73 | element-of'.fails.if.the.list.is |
| eec80 | 20 65 6d 70 74 79 2e 20 20 4f 74 68 65 72 77 69 73 65 20 69 74 20 61 6d 62 69 67 75 6f 75 73 6c | .empty...Otherwise.it.ambiguousl |
| eeca0 | 79 0a 72 65 74 75 72 6e 73 20 65 69 74 68 65 72 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 | y.returns.either.the.first.eleme |
| eecc0 | 6e 74 20 6f 66 20 74 68 65 20 6c 69 73 74 20 6f 72 20 61 6e 20 65 6c 65 6d 65 6e 74 20 63 68 6f | nt.of.the.list.or.an.element.cho |
| eece0 | 73 65 6e 20 66 72 6f 6d 0a 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 6c 69 73 74 2e 0a 0a | sen.from.the.rest.of.the.list... |
| eed00 | 20 20 20 57 65 20 63 61 6e 20 61 6c 73 6f 20 65 78 70 72 65 73 73 20 69 6e 66 69 6e 69 74 65 20 | ...We.can.also.express.infinite. |
| eed20 | 72 61 6e 67 65 73 20 6f 66 20 63 68 6f 69 63 65 73 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e | ranges.of.choices...The.followin |
| eed40 | 67 0a 70 72 6f 63 65 64 75 72 65 20 70 6f 74 65 6e 74 69 61 6c 6c 79 20 72 65 74 75 72 6e 73 20 | g.procedure.potentially.returns. |
| eed60 | 61 6e 79 20 69 6e 74 65 67 65 72 20 67 72 65 61 74 65 72 20 74 68 61 6e 20 6f 72 20 65 71 75 61 | any.integer.greater.than.or.equa |
| eed80 | 6c 20 74 6f 20 73 6f 6d 65 0a 67 69 76 65 6e 20 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | l.to.some.given.n:.......(define |
| eeda0 | 20 28 61 6e 2d 69 6e 74 65 67 65 72 2d 73 74 61 72 74 69 6e 67 2d 66 72 6f 6d 20 6e 29 0a 20 20 | .(an-integer-starting-from.n)... |
| eedc0 | 20 20 20 20 20 28 61 6d 62 20 6e 20 28 61 6e 2d 69 6e 74 65 67 65 72 2d 73 74 61 72 74 69 6e 67 | .....(amb.n.(an-integer-starting |
| eede0 | 2d 66 72 6f 6d 20 28 2b 20 6e 20 31 29 29 29 29 0a 0a 20 20 20 54 68 69 73 20 69 73 20 6c 69 6b | -from.(+.n.1)))).....This.is.lik |
| eee00 | 65 20 74 68 65 20 73 74 72 65 61 6d 20 70 72 6f 63 65 64 75 72 65 20 60 69 6e 74 65 67 65 72 73 | e.the.stream.procedure.`integers |
| eee20 | 2d 73 74 61 72 74 69 6e 67 2d 66 72 6f 6d 27 20 64 65 73 63 72 69 62 65 64 0a 69 6e 20 73 65 63 | -starting-from'.described.in.sec |
| eee40 | 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d 32 3a 3a 2c 20 62 75 74 20 77 69 74 68 20 61 6e 20 | tion.*Note.3-5-2::,.but.with.an. |
| eee60 | 69 6d 70 6f 72 74 61 6e 74 20 64 69 66 66 65 72 65 6e 63 65 3a 20 54 68 65 20 73 74 72 65 61 6d | important.difference:.The.stream |
| eee80 | 0a 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e 73 20 61 6e 20 6f 62 6a 65 63 74 20 74 68 61 | .procedure.returns.an.object.tha |
| eeea0 | 74 20 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 61 6c 6c | t.represents.the.sequence.of.all |
| eeec0 | 0a 69 6e 74 65 67 65 72 73 20 62 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 6e 2c 20 77 68 65 72 | .integers.beginning.with.n,.wher |
| eeee0 | 65 61 73 20 74 68 65 20 60 61 6d 62 27 20 70 72 6f 63 65 64 75 72 65 20 72 65 74 75 72 6e 73 20 | eas.the.`amb'.procedure.returns. |
| eef00 | 61 20 73 69 6e 67 6c 65 0a 69 6e 74 65 67 65 72 2e 28 32 29 0a 0a 20 20 20 41 62 73 74 72 61 63 | a.single.integer.(2).....Abstrac |
| eef20 | 74 6c 79 2c 20 77 65 20 63 61 6e 20 69 6d 61 67 69 6e 65 20 74 68 61 74 20 65 76 61 6c 75 61 74 | tly,.we.can.imagine.that.evaluat |
| eef40 | 69 6e 67 20 61 6e 20 60 61 6d 62 27 20 65 78 70 72 65 73 73 69 6f 6e 0a 63 61 75 73 65 73 20 74 | ing.an.`amb'.expression.causes.t |
| eef60 | 69 6d 65 20 74 6f 20 73 70 6c 69 74 20 69 6e 74 6f 20 62 72 61 6e 63 68 65 73 2c 20 77 68 65 72 | ime.to.split.into.branches,.wher |
| eef80 | 65 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 63 6f 6e 74 69 6e 75 65 73 20 6f 6e 0a 65 | e.the.computation.continues.on.e |
| eefa0 | 61 63 68 20 62 72 61 6e 63 68 20 77 69 74 68 20 6f 6e 65 20 6f 66 20 74 68 65 20 70 6f 73 73 69 | ach.branch.with.one.of.the.possi |
| eefc0 | 62 6c 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 57 | ble.values.of.the.expression...W |
| eefe0 | 65 20 73 61 79 0a 74 68 61 74 20 60 61 6d 62 27 20 72 65 70 72 65 73 65 6e 74 73 20 61 20 22 6e | e.say.that.`amb'.represents.a."n |
| ef000 | 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 63 68 6f 69 63 65 20 70 6f 69 6e 74 22 2e 20 20 | ondeterministic.choice.point"... |
| ef020 | 49 66 20 77 65 20 68 61 64 20 61 0a 6d 61 63 68 69 6e 65 20 77 69 74 68 20 61 20 73 75 66 66 69 | If.we.had.a.machine.with.a.suffi |
| ef040 | 63 69 65 6e 74 20 6e 75 6d 62 65 72 20 6f 66 20 70 72 6f 63 65 73 73 6f 72 73 20 74 68 61 74 20 | cient.number.of.processors.that. |
| ef060 | 63 6f 75 6c 64 20 62 65 0a 64 79 6e 61 6d 69 63 61 6c 6c 79 20 61 6c 6c 6f 63 61 74 65 64 2c 20 | could.be.dynamically.allocated,. |
| ef080 | 77 65 20 63 6f 75 6c 64 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 73 65 61 72 63 68 20 69 6e | we.could.implement.the.search.in |
| ef0a0 | 20 61 0a 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 77 61 79 2e 20 20 45 78 65 63 75 74 69 | .a.straightforward.way...Executi |
| ef0c0 | 6f 6e 20 77 6f 75 6c 64 20 70 72 6f 63 65 65 64 20 61 73 20 69 6e 20 61 20 73 65 71 75 65 6e 74 | on.would.proceed.as.in.a.sequent |
| ef0e0 | 69 61 6c 0a 6d 61 63 68 69 6e 65 2c 20 75 6e 74 69 6c 20 61 6e 20 60 61 6d 62 27 20 65 78 70 72 | ial.machine,.until.an.`amb'.expr |
| ef100 | 65 73 73 69 6f 6e 20 69 73 20 65 6e 63 6f 75 6e 74 65 72 65 64 2e 20 20 41 74 20 74 68 69 73 20 | ession.is.encountered...At.this. |
| ef120 | 70 6f 69 6e 74 2c 20 6d 6f 72 65 0a 70 72 6f 63 65 73 73 6f 72 73 20 77 6f 75 6c 64 20 62 65 20 | point,.more.processors.would.be. |
| ef140 | 61 6c 6c 6f 63 61 74 65 64 20 61 6e 64 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 74 6f 20 63 6f 6e | allocated.and.initialized.to.con |
| ef160 | 74 69 6e 75 65 20 61 6c 6c 20 6f 66 20 74 68 65 0a 70 61 72 61 6c 6c 65 6c 20 65 78 65 63 75 74 | tinue.all.of.the.parallel.execut |
| ef180 | 69 6f 6e 73 20 69 6d 70 6c 69 65 64 20 62 79 20 74 68 65 20 63 68 6f 69 63 65 2e 20 20 45 61 63 | ions.implied.by.the.choice...Eac |
| ef1a0 | 68 20 70 72 6f 63 65 73 73 6f 72 20 77 6f 75 6c 64 20 70 72 6f 63 65 65 64 0a 73 65 71 75 65 6e | h.processor.would.proceed.sequen |
| ef1c0 | 74 69 61 6c 6c 79 20 61 73 20 69 66 20 69 74 20 77 65 72 65 20 74 68 65 20 6f 6e 6c 79 20 63 68 | tially.as.if.it.were.the.only.ch |
| ef1e0 | 6f 69 63 65 2c 20 75 6e 74 69 6c 20 69 74 20 65 69 74 68 65 72 20 74 65 72 6d 69 6e 61 74 65 73 | oice,.until.it.either.terminates |
| ef200 | 0a 62 79 20 65 6e 63 6f 75 6e 74 65 72 69 6e 67 20 61 20 66 61 69 6c 75 72 65 2c 20 6f 72 20 69 | .by.encountering.a.failure,.or.i |
| ef220 | 74 20 66 75 72 74 68 65 72 20 73 75 62 64 69 76 69 64 65 73 2c 20 6f 72 20 69 74 20 66 69 6e 69 | t.further.subdivides,.or.it.fini |
| ef240 | 73 68 65 73 2e 28 33 29 0a 0a 20 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 | shes.(3).....On.the.other.hand,. |
| ef260 | 69 66 20 77 65 20 68 61 76 65 20 61 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 63 61 6e 20 65 78 | if.we.have.a.machine.that.can.ex |
| ef280 | 65 63 75 74 65 20 6f 6e 6c 79 20 6f 6e 65 0a 70 72 6f 63 65 73 73 20 28 6f 72 20 61 20 66 65 77 | ecute.only.one.process.(or.a.few |
| ef2a0 | 20 63 6f 6e 63 75 72 72 65 6e 74 20 70 72 6f 63 65 73 73 65 73 29 2c 20 77 65 20 6d 75 73 74 20 | .concurrent.processes),.we.must. |
| ef2c0 | 63 6f 6e 73 69 64 65 72 20 74 68 65 0a 61 6c 74 65 72 6e 61 74 69 76 65 73 20 73 65 71 75 65 6e | consider.the.alternatives.sequen |
| ef2e0 | 74 69 61 6c 6c 79 2e 20 20 4f 6e 65 20 63 6f 75 6c 64 20 69 6d 61 67 69 6e 65 20 6d 6f 64 69 66 | tially...One.could.imagine.modif |
| ef300 | 79 69 6e 67 20 61 6e 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 0a 70 69 63 6b 20 61 74 20 72 61 6e | ying.an.evaluator.to.pick.at.ran |
| ef320 | 64 6f 6d 20 61 20 62 72 61 6e 63 68 20 74 6f 20 66 6f 6c 6c 6f 77 20 77 68 65 6e 65 76 65 72 20 | dom.a.branch.to.follow.whenever. |
| ef340 | 69 74 20 65 6e 63 6f 75 6e 74 65 72 73 20 61 20 63 68 6f 69 63 65 0a 70 6f 69 6e 74 2e 20 20 52 | it.encounters.a.choice.point...R |
| ef360 | 61 6e 64 6f 6d 20 63 68 6f 69 63 65 2c 20 68 6f 77 65 76 65 72 2c 20 63 61 6e 20 65 61 73 69 6c | andom.choice,.however,.can.easil |
| ef380 | 79 20 6c 65 61 64 20 74 6f 20 66 61 69 6c 69 6e 67 20 76 61 6c 75 65 73 2e 20 20 57 65 0a 6d 69 | y.lead.to.failing.values...We.mi |
| ef3a0 | 67 68 74 20 74 72 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6f 76 | ght.try.running.the.evaluator.ov |
| ef3c0 | 65 72 20 61 6e 64 20 6f 76 65 72 2c 20 6d 61 6b 69 6e 67 20 72 61 6e 64 6f 6d 20 63 68 6f 69 63 | er.and.over,.making.random.choic |
| ef3e0 | 65 73 0a 61 6e 64 20 68 6f 70 69 6e 67 20 74 6f 20 66 69 6e 64 20 61 20 6e 6f 6e 2d 66 61 69 6c | es.and.hoping.to.find.a.non-fail |
| ef400 | 69 6e 67 20 76 61 6c 75 65 2c 20 62 75 74 20 69 74 20 69 73 20 62 65 74 74 65 72 20 74 6f 20 22 | ing.value,.but.it.is.better.to." |
| ef420 | 73 79 73 74 65 6d 61 74 69 63 61 6c 6c 79 0a 73 65 61 72 63 68 22 20 61 6c 6c 20 70 6f 73 73 69 | systematically.search".all.possi |
| ef440 | 62 6c 65 20 65 78 65 63 75 74 69 6f 6e 20 70 61 74 68 73 2e 20 20 54 68 65 20 60 61 6d 62 27 20 | ble.execution.paths...The.`amb'. |
| ef460 | 65 76 61 6c 75 61 74 6f 72 20 74 68 61 74 20 77 65 20 77 69 6c 6c 0a 64 65 76 65 6c 6f 70 20 61 | evaluator.that.we.will.develop.a |
| ef480 | 6e 64 20 77 6f 72 6b 20 77 69 74 68 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 69 6d 70 | nd.work.with.in.this.section.imp |
| ef4a0 | 6c 65 6d 65 6e 74 73 20 61 20 73 79 73 74 65 6d 61 74 69 63 20 73 65 61 72 63 68 20 61 73 0a 66 | lements.a.systematic.search.as.f |
| ef4c0 | 6f 6c 6c 6f 77 73 3a 20 57 68 65 6e 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 65 6e 63 6f 75 | ollows:.When.the.evaluator.encou |
| ef4e0 | 6e 74 65 72 73 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 60 61 6d 62 27 2c 20 69 | nters.an.application.of.`amb',.i |
| ef500 | 74 0a 69 6e 69 74 69 61 6c 6c 79 20 73 65 6c 65 63 74 73 20 74 68 65 20 66 69 72 73 74 20 61 6c | t.initially.selects.the.first.al |
| ef520 | 74 65 72 6e 61 74 69 76 65 2e 20 20 54 68 69 73 20 73 65 6c 65 63 74 69 6f 6e 20 6d 61 79 20 69 | ternative...This.selection.may.i |
| ef540 | 74 73 65 6c 66 0a 6c 65 61 64 20 74 6f 20 61 20 66 75 72 74 68 65 72 20 63 68 6f 69 63 65 2e 20 | tself.lead.to.a.further.choice.. |
| ef560 | 20 54 68 65 20 65 76 61 6c 75 61 74 6f 72 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 69 6e 69 74 69 | .The.evaluator.will.always.initi |
| ef580 | 61 6c 6c 79 20 63 68 6f 6f 73 65 0a 74 68 65 20 66 69 72 73 74 20 61 6c 74 65 72 6e 61 74 69 76 | ally.choose.the.first.alternativ |
| ef5a0 | 65 20 61 74 20 65 61 63 68 20 63 68 6f 69 63 65 20 70 6f 69 6e 74 2e 20 20 49 66 20 61 20 63 68 | e.at.each.choice.point...If.a.ch |
| ef5c0 | 6f 69 63 65 20 72 65 73 75 6c 74 73 20 69 6e 20 61 0a 66 61 69 6c 75 72 65 2c 20 74 68 65 6e 20 | oice.results.in.a.failure,.then. |
| ef5e0 | 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 61 75 74 6f 6d 61 67 69 63 61 6c 6c 79 28 34 29 20 22 | the.evaluator.automagically(4)." |
| ef600 | 62 61 63 6b 74 72 61 63 6b 73 22 20 74 6f 20 74 68 65 20 6d 6f 73 74 0a 72 65 63 65 6e 74 20 63 | backtracks".to.the.most.recent.c |
| ef620 | 68 6f 69 63 65 20 70 6f 69 6e 74 20 61 6e 64 20 74 72 69 65 73 20 74 68 65 20 6e 65 78 74 20 61 | hoice.point.and.tries.the.next.a |
| ef640 | 6c 74 65 72 6e 61 74 69 76 65 2e 20 20 49 66 20 69 74 20 72 75 6e 73 20 6f 75 74 20 6f 66 0a 61 | lternative...If.it.runs.out.of.a |
| ef660 | 6c 74 65 72 6e 61 74 69 76 65 73 20 61 74 20 61 6e 79 20 63 68 6f 69 63 65 20 70 6f 69 6e 74 2c | lternatives.at.any.choice.point, |
| ef680 | 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 77 69 6c 6c 20 62 61 63 6b 20 75 70 20 74 6f 20 74 | .the.evaluator.will.back.up.to.t |
| ef6a0 | 68 65 0a 70 72 65 76 69 6f 75 73 20 63 68 6f 69 63 65 20 70 6f 69 6e 74 20 61 6e 64 20 72 65 73 | he.previous.choice.point.and.res |
| ef6c0 | 75 6d 65 20 66 72 6f 6d 20 74 68 65 72 65 2e 20 20 54 68 69 73 20 70 72 6f 63 65 73 73 20 6c 65 | ume.from.there...This.process.le |
| ef6e0 | 61 64 73 20 74 6f 20 61 0a 73 65 61 72 63 68 20 73 74 72 61 74 65 67 79 20 6b 6e 6f 77 6e 20 61 | ads.to.a.search.strategy.known.a |
| ef700 | 73 20 22 64 65 70 74 68 2d 66 69 72 73 74 20 73 65 61 72 63 68 22 20 6f 72 20 62 61 63 6b 74 72 | s."depth-first.search".or.backtr |
| ef720 | 61 63 6b 69 6e 67 0a 22 63 68 72 6f 6e 6f 6c 6f 67 69 63 61 6c 20 62 61 63 6b 74 72 61 63 6b 69 | acking."chronological.backtracki |
| ef740 | 6e 67 22 2e 28 35 29 0a 0a 44 72 69 76 65 72 20 6c 6f 6f 70 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ng".(5)..Driver.loop............ |
| ef760 | 0a 0a 54 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 20 66 6f 72 20 74 68 65 20 60 61 6d 62 27 20 | ..The.driver.loop.for.the.`amb'. |
| ef780 | 65 76 61 6c 75 61 74 6f 72 20 68 61 73 20 73 6f 6d 65 20 75 6e 75 73 75 61 6c 20 70 72 6f 70 65 | evaluator.has.some.unusual.prope |
| ef7a0 | 72 74 69 65 73 2e 20 20 49 74 0a 72 65 61 64 73 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 61 | rties...It.reads.an.expression.a |
| ef7c0 | 6e 64 20 70 72 69 6e 74 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 66 69 72 73 74 | nd.prints.the.value.of.the.first |
| ef7e0 | 20 6e 6f 6e 2d 66 61 69 6c 69 6e 67 0a 65 78 65 63 75 74 69 6f 6e 2c 20 61 73 20 69 6e 20 74 68 | .non-failing.execution,.as.in.th |
| ef800 | 65 20 60 70 72 69 6d 65 2d 73 75 6d 2d 70 61 69 72 27 20 65 78 61 6d 70 6c 65 20 73 68 6f 77 6e | e.`prime-sum-pair'.example.shown |
| ef820 | 20 61 62 6f 76 65 2e 20 20 49 66 20 77 65 20 77 61 6e 74 0a 74 6f 20 73 65 65 20 74 68 65 20 76 | .above...If.we.want.to.see.the.v |
| ef840 | 61 6c 75 65 20 6f 66 20 74 68 65 20 6e 65 78 74 20 73 75 63 63 65 73 73 66 75 6c 20 65 78 65 63 | alue.of.the.next.successful.exec |
| ef860 | 75 74 69 6f 6e 2c 20 77 65 20 63 61 6e 20 61 73 6b 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 | ution,.we.can.ask.the.interprete |
| ef880 | 72 20 74 6f 20 62 61 63 6b 74 72 61 63 6b 20 61 6e 64 20 61 74 74 65 6d 70 74 20 74 6f 20 67 65 | r.to.backtrack.and.attempt.to.ge |
| ef8a0 | 6e 65 72 61 74 65 20 61 20 73 65 63 6f 6e 64 20 6e 6f 6e 2d 66 61 69 6c 69 6e 67 0a 65 78 65 63 | nerate.a.second.non-failing.exec |
| ef8c0 | 75 74 69 6f 6e 2e 20 20 54 68 69 73 20 69 73 20 73 69 67 6e 61 6c 65 64 20 62 79 20 74 79 70 69 | ution...This.is.signaled.by.typi |
| ef8e0 | 6e 67 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 74 72 79 2d 61 67 61 69 6e 27 2e 20 20 49 66 20 61 | ng.the.symbol.`try-again'...If.a |
| ef900 | 6e 79 0a 65 78 70 72 65 73 73 69 6f 6e 20 65 78 63 65 70 74 20 60 74 72 79 2d 61 67 61 69 6e 27 | ny.expression.except.`try-again' |
| ef920 | 20 69 73 20 67 69 76 65 6e 2c 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 77 69 6c 6c 20 | .is.given,.the.interpreter.will. |
| ef940 | 73 74 61 72 74 20 61 0a 6e 65 77 20 70 72 6f 62 6c 65 6d 2c 20 64 69 73 63 61 72 64 69 6e 67 20 | start.a.new.problem,.discarding. |
| ef960 | 74 68 65 20 75 6e 65 78 70 6c 6f 72 65 64 20 61 6c 74 65 72 6e 61 74 69 76 65 73 20 69 6e 20 74 | the.unexplored.alternatives.in.t |
| ef980 | 68 65 20 70 72 65 76 69 6f 75 73 0a 70 72 6f 62 6c 65 6d 2e 20 20 48 65 72 65 20 69 73 20 61 20 | he.previous.problem...Here.is.a. |
| ef9a0 | 73 61 6d 70 6c 65 20 69 6e 74 65 72 61 63 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 3b 3b 3b 20 41 6d | sample.interaction:.......;;;.Am |
| ef9c0 | 62 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 70 72 69 6d 65 2d 73 75 6d 2d 70 61 | b-Eval.input:......(prime-sum-pa |
| ef9e0 | 69 72 20 27 28 31 20 33 20 35 20 38 29 20 27 28 32 30 20 33 35 20 31 31 30 29 29 0a 20 20 20 20 | ir.'(1.3.5.8).'(20.35.110))..... |
| efa00 | 20 3b 3b 3b 20 53 74 61 72 74 69 6e 67 20 61 20 6e 65 77 20 70 72 6f 62 6c 65 6d 0a 20 20 20 20 | .;;;.Starting.a.new.problem..... |
| efa20 | 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 28 33 20 32 30 29 | .;;;.Amb-Eval.value:......(3.20) |
| efa40 | 0a 0a 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 | .......;;;.Amb-Eval.input:...... |
| efa60 | 74 72 79 2d 61 67 61 69 6e 0a 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 76 61 6c 75 | try-again......;;;.Amb-Eval.valu |
| efa80 | 65 3a 0a 20 20 20 20 20 28 33 20 31 31 30 29 0a 0a 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 | e:......(3.110).......;;;.Amb-Ev |
| efaa0 | 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 74 72 79 2d 61 67 61 69 6e 0a 20 20 20 20 20 3b 3b | al.input:......try-again......;; |
| efac0 | 3b 20 41 6d 62 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 28 38 20 33 35 29 0a 0a 20 | ;.Amb-Eval.value:......(8.35)... |
| efae0 | 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 74 72 79 | ....;;;.Amb-Eval.input:......try |
| efb00 | 2d 61 67 61 69 6e 0a 20 20 20 20 20 3b 3b 3b 20 54 68 65 72 65 20 61 72 65 20 6e 6f 20 6d 6f 72 | -again......;;;.There.are.no.mor |
| efb20 | 65 20 76 61 6c 75 65 73 20 6f 66 0a 20 20 20 20 20 28 70 72 69 6d 65 2d 73 75 6d 2d 70 61 69 72 | e.values.of......(prime-sum-pair |
| efb40 | 20 28 71 75 6f 74 65 20 28 31 20 33 20 35 20 38 29 29 20 28 71 75 6f 74 65 20 28 32 30 20 33 35 | .(quote.(1.3.5.8)).(quote.(20.35 |
| efb60 | 20 31 31 30 29 29 29 0a 0a 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 69 6e 70 75 74 | .110))).......;;;.Amb-Eval.input |
| efb80 | 3a 0a 20 20 20 20 20 28 70 72 69 6d 65 2d 73 75 6d 2d 70 61 69 72 20 27 28 31 39 20 32 37 20 33 | :......(prime-sum-pair.'(19.27.3 |
| efba0 | 30 29 20 27 28 31 31 20 33 36 20 35 38 29 29 0a 20 20 20 20 20 3b 3b 3b 20 53 74 61 72 74 69 6e | 0).'(11.36.58))......;;;.Startin |
| efbc0 | 67 20 61 20 6e 65 77 20 70 72 6f 62 6c 65 6d 0a 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 | g.a.new.problem......;;;.Amb-Eva |
| efbe0 | 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 28 33 30 20 31 31 29 0a 0a 20 20 20 20 20 2a 45 78 65 | l.value:......(30.11).......*Exe |
| efc00 | 72 63 69 73 65 20 34 2e 33 35 3a 2a 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 | rcise.4.35:*.Write.a.procedure.` |
| efc20 | 61 6e 2d 69 6e 74 65 67 65 72 2d 62 65 74 77 65 65 6e 27 20 74 68 61 74 0a 20 20 20 20 20 72 65 | an-integer-between'.that......re |
| efc40 | 74 75 72 6e 73 20 61 6e 20 69 6e 74 65 67 65 72 20 62 65 74 77 65 65 6e 20 74 77 6f 20 67 69 76 | turns.an.integer.between.two.giv |
| efc60 | 65 6e 20 62 6f 75 6e 64 73 2e 20 20 54 68 69 73 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 0a | en.bounds...This.can.be.used.to. |
| efc80 | 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 | .....implement.a.procedure.that. |
| efca0 | 66 69 6e 64 73 20 50 79 74 68 61 67 6f 72 65 61 6e 20 74 72 69 70 6c 65 73 2c 20 69 2e 65 2e 2c | finds.Pythagorean.triples,.i.e., |
| efcc0 | 0a 20 20 20 20 20 74 72 69 70 6c 65 73 20 6f 66 20 69 6e 74 65 67 65 72 73 20 28 69 2c 6a 2c 6b | ......triples.of.integers.(i,j,k |
| efce0 | 29 20 62 65 74 77 65 65 6e 20 74 68 65 20 67 69 76 65 6e 20 62 6f 75 6e 64 73 20 73 75 63 68 20 | ).between.the.given.bounds.such. |
| efd00 | 74 68 61 74 20 69 0a 20 20 20 20 20 3c 3d 20 6a 20 61 6e 64 20 69 5e 32 20 2b 20 6a 5e 32 20 3d | that.i......<=.j.and.i^2.+.j^2.= |
| efd20 | 20 6b 5e 32 2c 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | .k^2,.as.follows:............(de |
| efd40 | 66 69 6e 65 20 28 61 2d 70 79 74 68 61 67 6f 72 65 61 6e 2d 74 72 69 70 6c 65 2d 62 65 74 77 65 | fine.(a-pythagorean-triple-betwe |
| efd60 | 65 6e 20 6c 6f 77 20 68 69 67 68 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 | en.low.high).............(let.(( |
| efd80 | 69 20 28 61 6e 2d 69 6e 74 65 67 65 72 2d 62 65 74 77 65 65 6e 20 6c 6f 77 20 68 69 67 68 29 29 | i.(an-integer-between.low.high)) |
| efda0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6a 20 28 61 6e 2d 69 6e 74 | )...............(let.((j.(an-int |
| efdc0 | 65 67 65 72 2d 62 65 74 77 65 65 6e 20 69 20 68 69 67 68 29 29 29 0a 20 20 20 20 20 20 20 20 20 | eger-between.i.high))).......... |
| efde0 | 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6b 20 28 61 6e 2d 69 6e 74 65 67 65 72 2d 62 65 74 77 | .......(let.((k.(an-integer-betw |
| efe00 | 65 65 6e 20 6a 20 68 69 67 68 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | een.j.high)))................... |
| efe20 | 28 72 65 71 75 69 72 65 20 28 3d 20 28 2b 20 28 2a 20 69 20 69 29 20 28 2a 20 6a 20 6a 29 29 20 | (require.(=.(+.(*.i.i).(*.j.j)). |
| efe40 | 28 2a 20 6b 20 6b 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 | (*.k.k)))...................(lis |
| efe60 | 74 20 69 20 6a 20 6b 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 33 | t.i.j.k))))).......*Exercise.4.3 |
| efe80 | 36 3a 2a 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 33 2d 36 39 3a 3a 20 64 69 73 63 75 73 | 6:*.*Note.Exercise.3-69::.discus |
| efea0 | 73 65 64 20 68 6f 77 20 74 6f 20 67 65 6e 65 72 61 74 65 0a 20 20 20 20 20 74 68 65 20 73 74 72 | sed.how.to.generate......the.str |
| efec0 | 65 61 6d 20 6f 66 20 5f 61 6c 6c 5f 20 50 79 74 68 61 67 6f 72 65 61 6e 20 74 72 69 70 6c 65 73 | eam.of._all_.Pythagorean.triples |
| efee0 | 2c 20 77 69 74 68 20 6e 6f 20 75 70 70 65 72 20 62 6f 75 6e 64 20 6f 6e 0a 20 20 20 20 20 74 68 | ,.with.no.upper.bound.on......th |
| eff00 | 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 69 6e 74 65 67 65 72 73 20 74 6f 20 62 65 20 73 65 61 | e.size.of.the.integers.to.be.sea |
| eff20 | 72 63 68 65 64 2e 20 20 45 78 70 6c 61 69 6e 20 77 68 79 20 73 69 6d 70 6c 79 0a 20 20 20 20 20 | rched...Explain.why.simply...... |
| eff40 | 72 65 70 6c 61 63 69 6e 67 20 60 61 6e 2d 69 6e 74 65 67 65 72 2d 62 65 74 77 65 65 6e 27 20 62 | replacing.`an-integer-between'.b |
| eff60 | 79 20 60 61 6e 2d 69 6e 74 65 67 65 72 2d 73 74 61 72 74 69 6e 67 2d 66 72 6f 6d 27 20 69 6e 0a | y.`an-integer-starting-from'.in. |
| eff80 | 20 20 20 20 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 | .....the.procedure.in.*Note.Exer |
| effa0 | 63 69 73 65 20 34 2d 33 35 3a 3a 20 69 73 20 6e 6f 74 20 61 6e 20 61 64 65 71 75 61 74 65 20 77 | cise.4-35::.is.not.an.adequate.w |
| effc0 | 61 79 20 74 6f 0a 20 20 20 20 20 67 65 6e 65 72 61 74 65 20 61 72 62 69 74 72 61 72 79 20 50 79 | ay.to......generate.arbitrary.Py |
| effe0 | 74 68 61 67 6f 72 65 61 6e 20 74 72 69 70 6c 65 73 2e 20 20 57 72 69 74 65 20 61 20 70 72 6f 63 | thagorean.triples...Write.a.proc |
| f0000 | 65 64 75 72 65 20 74 68 61 74 0a 20 20 20 20 20 61 63 74 75 61 6c 6c 79 20 77 69 6c 6c 20 61 63 | edure.that......actually.will.ac |
| f0020 | 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 2e 20 20 28 54 68 61 74 20 69 73 2c 20 77 72 69 74 65 20 | complish.this...(That.is,.write. |
| f0040 | 61 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 0a 20 20 20 20 20 77 68 69 63 68 20 72 65 70 65 61 | a.procedure.for......which.repea |
| f0060 | 74 65 64 6c 79 20 74 79 70 69 6e 67 20 60 74 72 79 2d 61 67 61 69 6e 27 20 77 6f 75 6c 64 20 69 | tedly.typing.`try-again'.would.i |
| f0080 | 6e 20 70 72 69 6e 63 69 70 6c 65 20 65 76 65 6e 74 75 61 6c 6c 79 0a 20 20 20 20 20 67 65 6e 65 | n.principle.eventually......gene |
| f00a0 | 72 61 74 65 20 61 6c 6c 20 50 79 74 68 61 67 6f 72 65 61 6e 20 74 72 69 70 6c 65 73 2e 29 0a 0a | rate.all.Pythagorean.triples.).. |
| f00c0 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 33 37 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 | .....*Exercise.4.37:*.Ben.Bitdid |
| f00e0 | 64 6c 65 20 63 6c 61 69 6d 73 20 74 68 61 74 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d 65 | dle.claims.that.the.following.me |
| f0100 | 74 68 6f 64 0a 20 20 20 20 20 66 6f 72 20 67 65 6e 65 72 61 74 69 6e 67 20 50 79 74 68 61 67 6f | thod......for.generating.Pythago |
| f0120 | 72 65 61 6e 20 74 72 69 70 6c 65 73 20 69 73 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20 74 | rean.triples.is.more.efficient.t |
| f0140 | 68 61 6e 20 74 68 65 20 6f 6e 65 0a 20 20 20 20 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 | han.the.one......in.*Note.Exerci |
| f0160 | 73 65 20 34 2d 33 35 3a 3a 2e 20 20 49 73 20 68 65 20 63 6f 72 72 65 63 74 3f 20 20 28 48 69 6e | se.4-35::...Is.he.correct?..(Hin |
| f0180 | 74 3a 20 43 6f 6e 73 69 64 65 72 20 74 68 65 0a 20 20 20 20 20 6e 75 6d 62 65 72 20 6f 66 20 70 | t:.Consider.the......number.of.p |
| f01a0 | 6f 73 73 69 62 69 6c 69 74 69 65 73 20 74 68 61 74 20 6d 75 73 74 20 62 65 20 65 78 70 6c 6f 72 | ossibilities.that.must.be.explor |
| f01c0 | 65 64 2e 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 2d 70 79 74 68 61 | ed.)............(define.(a-pytha |
| f01e0 | 67 6f 72 65 61 6e 2d 74 72 69 70 6c 65 2d 62 65 74 77 65 65 6e 20 6c 6f 77 20 68 69 67 68 29 0a | gorean-triple-between.low.high). |
| f0200 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 20 28 61 6e 2d 69 6e 74 65 67 65 72 | ............(let.((i.(an-integer |
| f0220 | 2d 62 65 74 77 65 65 6e 20 6c 6f 77 20 68 69 67 68 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | -between.low.high))............. |
| f0240 | 20 20 20 20 20 20 28 68 73 71 20 28 2a 20 68 69 67 68 20 68 69 67 68 29 29 29 0a 20 20 20 20 20 | ......(hsq.(*.high.high)))...... |
| f0260 | 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6a 20 28 61 6e 2d 69 6e 74 65 67 65 72 2d 62 65 | .........(let.((j.(an-integer-be |
| f0280 | 74 77 65 65 6e 20 69 20 68 69 67 68 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tween.i.high)))................. |
| f02a0 | 28 6c 65 74 20 28 28 6b 73 71 20 28 2b 20 28 2a 20 69 20 69 29 20 28 2a 20 6a 20 6a 29 29 29 29 | (let.((ksq.(+.(*.i.i).(*.j.j)))) |
| f02c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 3e 3d 20 | ...................(require.(>=. |
| f02e0 | 68 73 71 20 6b 73 71 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 | hsq.ksq))...................(let |
| f0300 | 20 28 28 6b 20 28 73 71 72 74 20 6b 73 71 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .((k.(sqrt.ksq)))............... |
| f0320 | 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 69 6e 74 65 67 65 72 3f 20 6b 29 29 0a 20 20 20 | ......(require.(integer?.k)).... |
| f0340 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 69 20 6a 20 6b 29 29 29 29 | .................(list.i.j.k)))) |
| f0360 | 29 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d | )).....----------.Footnotes.---- |
| f0380 | 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 65 20 69 64 65 61 20 6f 66 20 60 61 6d 62 27 | ------.....(1).The.idea.of.`amb' |
| f03a0 | 20 66 6f 72 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e | .for.nondeterministic.programmin |
| f03c0 | 67 20 77 61 73 20 66 69 72 73 74 0a 64 65 73 63 72 69 62 65 64 20 69 6e 20 31 39 36 31 20 62 79 | g.was.first.described.in.1961.by |
| f03e0 | 20 4a 6f 68 6e 20 4d 63 43 61 72 74 68 79 20 28 73 65 65 20 4d 63 43 61 72 74 68 79 20 31 39 36 | .John.McCarthy.(see.McCarthy.196 |
| f0400 | 37 29 2e 0a 0a 20 20 20 28 32 29 20 49 6e 20 61 63 74 75 61 6c 69 74 79 2c 20 74 68 65 20 64 69 | 7)......(2).In.actuality,.the.di |
| f0420 | 73 74 69 6e 63 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 | stinction.between.nondeterminist |
| f0440 | 69 63 61 6c 6c 79 0a 72 65 74 75 72 6e 69 6e 67 20 61 20 73 69 6e 67 6c 65 20 63 68 6f 69 63 65 | ically.returning.a.single.choice |
| f0460 | 20 61 6e 64 20 72 65 74 75 72 6e 69 6e 67 20 61 6c 6c 20 63 68 6f 69 63 65 73 20 64 65 70 65 6e | .and.returning.all.choices.depen |
| f0480 | 64 73 20 73 6f 6d 65 77 68 61 74 20 6f 6e 0a 6f 75 72 20 70 6f 69 6e 74 20 6f 66 20 76 69 65 77 | ds.somewhat.on.our.point.of.view |
| f04a0 | 2e 20 20 46 72 6f 6d 20 74 68 65 20 70 65 72 73 70 65 63 74 69 76 65 20 6f 66 20 74 68 65 20 63 | ...From.the.perspective.of.the.c |
| f04c0 | 6f 64 65 20 74 68 61 74 20 75 73 65 73 20 74 68 65 0a 76 61 6c 75 65 2c 20 74 68 65 20 6e 6f 6e | ode.that.uses.the.value,.the.non |
| f04e0 | 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 63 68 6f 69 63 65 20 72 65 74 75 72 6e 73 20 61 20 73 | deterministic.choice.returns.a.s |
| f0500 | 69 6e 67 6c 65 20 76 61 6c 75 65 2e 20 20 46 72 6f 6d 20 74 68 65 0a 70 65 72 73 70 65 63 74 69 | ingle.value...From.the.perspecti |
| f0520 | 76 65 20 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 65 72 20 64 65 73 69 67 6e 69 6e 67 20 74 | ve.of.the.programmer.designing.t |
| f0540 | 68 65 20 63 6f 64 65 2c 20 74 68 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 0a 63 68 | he.code,.the.nondeterministic.ch |
| f0560 | 6f 69 63 65 20 70 6f 74 65 6e 74 69 61 6c 6c 79 20 72 65 74 75 72 6e 73 20 61 6c 6c 20 70 6f 73 | oice.potentially.returns.all.pos |
| f0580 | 73 69 62 6c 65 20 76 61 6c 75 65 73 2c 20 61 6e 64 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f | sible.values,.and.the.computatio |
| f05a0 | 6e 0a 62 72 61 6e 63 68 65 73 20 73 6f 20 74 68 61 74 20 65 61 63 68 20 76 61 6c 75 65 20 69 73 | n.branches.so.that.each.value.is |
| f05c0 | 20 69 6e 76 65 73 74 69 67 61 74 65 64 20 73 65 70 61 72 61 74 65 6c 79 2e 0a 0a 20 20 20 28 33 | .investigated.separately......(3 |
| f05e0 | 29 20 4f 6e 65 20 6d 69 67 68 74 20 6f 62 6a 65 63 74 20 74 68 61 74 20 74 68 69 73 20 69 73 20 | ).One.might.object.that.this.is. |
| f0600 | 61 20 68 6f 70 65 6c 65 73 73 6c 79 20 69 6e 65 66 66 69 63 69 65 6e 74 0a 6d 65 63 68 61 6e 69 | a.hopelessly.inefficient.mechani |
| f0620 | 73 6d 2e 20 20 49 74 20 6d 69 67 68 74 20 72 65 71 75 69 72 65 20 6d 69 6c 6c 69 6f 6e 73 20 6f | sm...It.might.require.millions.o |
| f0640 | 66 20 70 72 6f 63 65 73 73 6f 72 73 20 74 6f 20 73 6f 6c 76 65 20 73 6f 6d 65 0a 65 61 73 69 6c | f.processors.to.solve.some.easil |
| f0660 | 79 20 73 74 61 74 65 64 20 70 72 6f 62 6c 65 6d 20 74 68 69 73 20 77 61 79 2c 20 61 6e 64 20 6d | y.stated.problem.this.way,.and.m |
| f0680 | 6f 73 74 20 6f 66 20 74 68 65 20 74 69 6d 65 20 6d 6f 73 74 20 6f 66 20 74 68 6f 73 65 0a 70 72 | ost.of.the.time.most.of.those.pr |
| f06a0 | 6f 63 65 73 73 6f 72 73 20 77 6f 75 6c 64 20 62 65 20 69 64 6c 65 2e 20 20 54 68 69 73 20 6f 62 | ocessors.would.be.idle...This.ob |
| f06c0 | 6a 65 63 74 69 6f 6e 20 73 68 6f 75 6c 64 20 62 65 20 74 61 6b 65 6e 20 69 6e 20 74 68 65 0a 63 | jection.should.be.taken.in.the.c |
| f06e0 | 6f 6e 74 65 78 74 20 6f 66 20 68 69 73 74 6f 72 79 2e 20 20 4d 65 6d 6f 72 79 20 75 73 65 64 20 | ontext.of.history...Memory.used. |
| f0700 | 74 6f 20 62 65 20 63 6f 6e 73 69 64 65 72 65 64 20 6a 75 73 74 20 73 75 63 68 20 61 6e 0a 65 78 | to.be.considered.just.such.an.ex |
| f0720 | 70 65 6e 73 69 76 65 20 63 6f 6d 6d 6f 64 69 74 79 2e 20 20 49 6e 20 31 39 36 34 20 61 20 6d 65 | pensive.commodity...In.1964.a.me |
| f0740 | 67 61 62 79 74 65 20 6f 66 20 52 41 4d 20 63 6f 73 74 20 61 62 6f 75 74 20 24 34 30 30 2c 30 30 | gabyte.of.RAM.cost.about.$400,00 |
| f0760 | 30 2e 0a 4e 6f 77 20 65 76 65 72 79 20 70 65 72 73 6f 6e 61 6c 20 63 6f 6d 70 75 74 65 72 20 68 | 0..Now.every.personal.computer.h |
| f0780 | 61 73 20 6d 61 6e 79 20 6d 65 67 61 62 79 74 65 73 20 6f 66 20 52 41 4d 2c 20 61 6e 64 20 6d 6f | as.many.megabytes.of.RAM,.and.mo |
| f07a0 | 73 74 20 6f 66 20 74 68 65 0a 74 69 6d 65 20 6d 6f 73 74 20 6f 66 20 74 68 61 74 20 52 41 4d 20 | st.of.the.time.most.of.that.RAM. |
| f07c0 | 69 73 20 75 6e 75 73 65 64 2e 20 20 49 74 20 69 73 20 68 61 72 64 20 74 6f 20 75 6e 64 65 72 65 | is.unused...It.is.hard.to.undere |
| f07e0 | 73 74 69 6d 61 74 65 20 74 68 65 20 63 6f 73 74 0a 6f 66 20 6d 61 73 73 2d 70 72 6f 64 75 63 65 | stimate.the.cost.of.mass-produce |
| f0800 | 64 20 65 6c 65 63 74 72 6f 6e 69 63 73 2e 0a 0a 20 20 20 28 34 29 20 41 75 74 6f 6d 61 67 69 63 | d.electronics......(4).Automagic |
| f0820 | 61 6c 6c 79 3a 20 22 41 75 74 6f 6d 61 74 69 63 61 6c 6c 79 2c 20 62 75 74 20 69 6e 20 61 20 77 | ally:."Automatically,.but.in.a.w |
| f0840 | 61 79 20 77 68 69 63 68 2c 20 66 6f 72 20 73 6f 6d 65 0a 72 65 61 73 6f 6e 20 28 74 79 70 69 63 | ay.which,.for.some.reason.(typic |
| f0860 | 61 6c 6c 79 20 62 65 63 61 75 73 65 20 69 74 20 69 73 20 74 6f 6f 20 63 6f 6d 70 6c 69 63 61 74 | ally.because.it.is.too.complicat |
| f0880 | 65 64 2c 20 6f 72 20 74 6f 6f 20 75 67 6c 79 2c 20 6f 72 0a 70 65 72 68 61 70 73 20 65 76 65 6e | ed,.or.too.ugly,.or.perhaps.even |
| f08a0 | 20 74 6f 6f 20 74 72 69 76 69 61 6c 29 2c 20 74 68 65 20 73 70 65 61 6b 65 72 20 64 6f 65 73 6e | .too.trivial),.the.speaker.doesn |
| f08c0 | 27 74 20 66 65 65 6c 20 6c 69 6b 65 20 65 78 70 6c 61 69 6e 69 6e 67 2e 22 0a 28 53 74 65 65 6c | 't.feel.like.explaining.".(Steel |
| f08e0 | 65 20 31 39 38 33 2c 20 52 61 79 6d 6f 6e 64 20 31 39 39 33 29 0a 0a 20 20 20 28 35 29 20 5b 46 | e.1983,.Raymond.1993).....(5).[F |
| f0900 | 6f 6f 74 6e 6f 74 65 20 34 2e 34 37 5d 20 54 68 65 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 6f 66 | ootnote.4.47].The.integration.of |
| f0920 | 20 61 75 74 6f 6d 61 74 69 63 20 73 65 61 72 63 68 20 73 74 72 61 74 65 67 69 65 73 0a 69 6e 74 | .automatic.search.strategies.int |
| f0940 | 6f 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 68 61 73 20 68 61 64 20 | o.programming.languages.has.had. |
| f0960 | 61 20 6c 6f 6e 67 20 61 6e 64 20 63 68 65 63 6b 65 72 65 64 20 68 69 73 74 6f 72 79 2e 20 20 54 | a.long.and.checkered.history...T |
| f0980 | 68 65 0a 66 69 72 73 74 20 73 75 67 67 65 73 74 69 6f 6e 73 20 74 68 61 74 20 6e 6f 6e 64 65 74 | he.first.suggestions.that.nondet |
| f09a0 | 65 72 6d 69 6e 69 73 74 69 63 20 61 6c 67 6f 72 69 74 68 6d 73 20 6d 69 67 68 74 20 62 65 20 65 | erministic.algorithms.might.be.e |
| f09c0 | 6c 65 67 61 6e 74 6c 79 0a 65 6e 63 6f 64 65 64 20 69 6e 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e | legantly.encoded.in.a.programmin |
| f09e0 | 67 20 6c 61 6e 67 75 61 67 65 20 77 69 74 68 20 73 65 61 72 63 68 20 61 6e 64 20 61 75 74 6f 6d | g.language.with.search.and.autom |
| f0a00 | 61 74 69 63 0a 62 61 63 6b 74 72 61 63 6b 69 6e 67 20 63 61 6d 65 20 66 72 6f 6d 20 52 6f 62 65 | atic.backtracking.came.from.Robe |
| f0a20 | 72 74 20 46 6c 6f 79 64 20 28 31 39 36 37 29 2e 20 20 43 61 72 6c 20 48 65 77 69 74 74 20 28 31 | rt.Floyd.(1967)...Carl.Hewitt.(1 |
| f0a40 | 39 36 39 29 0a 69 6e 76 65 6e 74 65 64 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 | 969).invented.a.programming.lang |
| f0a60 | 75 61 67 65 20 63 61 6c 6c 65 64 20 50 6c 61 6e 6e 65 72 20 74 68 61 74 20 65 78 70 6c 69 63 69 | uage.called.Planner.that.explici |
| f0a80 | 74 6c 79 0a 73 75 70 70 6f 72 74 65 64 20 61 75 74 6f 6d 61 74 69 63 20 63 68 72 6f 6e 6f 6c 6f | tly.supported.automatic.chronolo |
| f0aa0 | 67 69 63 61 6c 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 2c 20 70 72 6f 76 69 64 69 6e 67 20 66 6f | gical.backtracking,.providing.fo |
| f0ac0 | 72 20 61 0a 62 75 69 6c 74 2d 69 6e 20 64 65 70 74 68 2d 66 69 72 73 74 20 73 65 61 72 63 68 20 | r.a.built-in.depth-first.search. |
| f0ae0 | 73 74 72 61 74 65 67 79 2e 20 20 53 75 73 73 6d 61 6e 2c 20 57 69 6e 6f 67 72 61 64 2c 20 61 6e | strategy...Sussman,.Winograd,.an |
| f0b00 | 64 20 43 68 61 72 6e 69 61 6b 0a 28 31 39 37 31 29 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 20 | d.Charniak.(1971).implemented.a. |
| f0b20 | 73 75 62 73 65 74 20 6f 66 20 74 68 69 73 20 6c 61 6e 67 75 61 67 65 2c 20 63 61 6c 6c 65 64 20 | subset.of.this.language,.called. |
| f0b40 | 4d 69 63 72 6f 50 6c 61 6e 6e 65 72 2c 0a 77 68 69 63 68 20 77 61 73 20 75 73 65 64 20 74 6f 20 | MicroPlanner,.which.was.used.to. |
| f0b60 | 73 75 70 70 6f 72 74 20 77 6f 72 6b 20 69 6e 20 70 72 6f 62 6c 65 6d 20 73 6f 6c 76 69 6e 67 20 | support.work.in.problem.solving. |
| f0b80 | 61 6e 64 20 72 6f 62 6f 74 20 70 6c 61 6e 6e 69 6e 67 2e 0a 53 69 6d 69 6c 61 72 20 69 64 65 61 | and.robot.planning..Similar.idea |
| f0ba0 | 73 2c 20 61 72 69 73 69 6e 67 20 66 72 6f 6d 20 6c 6f 67 69 63 20 61 6e 64 20 74 68 65 6f 72 65 | s,.arising.from.logic.and.theore |
| f0bc0 | 6d 20 70 72 6f 76 69 6e 67 2c 20 6c 65 64 20 74 6f 20 74 68 65 0a 67 65 6e 65 73 69 73 20 69 6e | m.proving,.led.to.the.genesis.in |
| f0be0 | 20 45 64 69 6e 62 75 72 67 68 20 61 6e 64 20 4d 61 72 73 65 69 6c 6c 65 20 6f 66 20 74 68 65 20 | .Edinburgh.and.Marseille.of.the. |
| f0c00 | 65 6c 65 67 61 6e 74 20 6c 61 6e 67 75 61 67 65 20 50 72 6f 6c 6f 67 0a 28 77 68 69 63 68 20 77 | elegant.language.Prolog.(which.w |
| f0c20 | 65 20 77 69 6c 6c 20 64 69 73 63 75 73 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 | e.will.discuss.in.section.*Note. |
| f0c40 | 34 2d 34 3a 3a 29 2e 20 20 41 66 74 65 72 20 73 75 66 66 69 63 69 65 6e 74 0a 66 72 75 73 74 72 | 4-4::)...After.sufficient.frustr |
| f0c60 | 61 74 69 6f 6e 20 77 69 74 68 20 61 75 74 6f 6d 61 74 69 63 20 73 65 61 72 63 68 2c 20 4d 63 44 | ation.with.automatic.search,.McD |
| f0c80 | 65 72 6d 6f 74 74 20 61 6e 64 20 53 75 73 73 6d 61 6e 20 28 31 39 37 32 29 0a 64 65 76 65 6c 6f | ermott.and.Sussman.(1972).develo |
| f0ca0 | 70 65 64 20 61 20 6c 61 6e 67 75 61 67 65 20 63 61 6c 6c 65 64 20 43 6f 6e 6e 69 76 65 72 2c 20 | ped.a.language.called.Conniver,. |
| f0cc0 | 77 68 69 63 68 20 69 6e 63 6c 75 64 65 64 20 6d 65 63 68 61 6e 69 73 6d 73 20 66 6f 72 0a 70 6c | which.included.mechanisms.for.pl |
| f0ce0 | 61 63 69 6e 67 20 74 68 65 20 73 65 61 72 63 68 20 73 74 72 61 74 65 67 79 20 75 6e 64 65 72 20 | acing.the.search.strategy.under. |
| f0d00 | 70 72 6f 67 72 61 6d 6d 65 72 20 63 6f 6e 74 72 6f 6c 2e 20 20 54 68 69 73 20 70 72 6f 76 65 64 | programmer.control...This.proved |
| f0d20 | 0a 75 6e 77 69 65 6c 64 79 2c 20 68 6f 77 65 76 65 72 2c 20 61 6e 64 20 53 75 73 73 6d 61 6e 20 | .unwieldy,.however,.and.Sussman. |
| f0d40 | 61 6e 64 20 53 74 61 6c 6c 6d 61 6e 20 28 31 39 37 35 29 20 66 6f 75 6e 64 20 61 20 6d 6f 72 65 | and.Stallman.(1975).found.a.more |
| f0d60 | 0a 74 72 61 63 74 61 62 6c 65 20 61 70 70 72 6f 61 63 68 20 77 68 69 6c 65 20 69 6e 76 65 73 74 | .tractable.approach.while.invest |
| f0d80 | 69 67 61 74 69 6e 67 20 6d 65 74 68 6f 64 73 20 6f 66 20 73 79 6d 62 6f 6c 69 63 20 61 6e 61 6c | igating.methods.of.symbolic.anal |
| f0da0 | 79 73 69 73 20 66 6f 72 0a 65 6c 65 63 74 72 69 63 61 6c 20 63 69 72 63 75 69 74 73 2e 20 20 54 | ysis.for.electrical.circuits...T |
| f0dc0 | 68 65 79 20 64 65 76 65 6c 6f 70 65 64 20 61 20 6e 6f 6e 2d 63 68 72 6f 6e 6f 6c 6f 67 69 63 61 | hey.developed.a.non-chronologica |
| f0de0 | 6c 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 0a 73 63 68 65 6d 65 20 74 68 61 74 20 77 61 73 20 62 | l.backtracking.scheme.that.was.b |
| f0e00 | 61 73 65 64 20 6f 6e 20 74 72 61 63 69 6e 67 20 6f 75 74 20 74 68 65 20 6c 6f 67 69 63 61 6c 20 | ased.on.tracing.out.the.logical. |
| f0e20 | 64 65 70 65 6e 64 65 6e 63 69 65 73 0a 63 6f 6e 6e 65 63 74 69 6e 67 20 66 61 63 74 73 2c 20 61 | dependencies.connecting.facts,.a |
| f0e40 | 20 74 65 63 68 6e 69 71 75 65 20 74 68 61 74 20 68 61 73 20 63 6f 6d 65 20 74 6f 20 62 65 20 6b | .technique.that.has.come.to.be.k |
| f0e60 | 6e 6f 77 6e 20 61 73 20 22 64 65 70 65 6e 64 65 6e 63 79 2d 64 69 72 65 63 74 65 64 0a 62 61 63 | nown.as."dependency-directed.bac |
| f0e80 | 6b 74 72 61 63 6b 69 6e 67 22 2e 20 20 41 6c 74 68 6f 75 67 68 20 74 68 65 69 72 20 6d 65 74 68 | ktracking"...Although.their.meth |
| f0ea0 | 6f 64 20 77 61 73 20 63 6f 6d 70 6c 65 78 2c 20 69 74 20 70 72 6f 64 75 63 65 64 0a 72 65 61 73 | od.was.complex,.it.produced.reas |
| f0ec0 | 6f 6e 61 62 6c 79 20 65 66 66 69 63 69 65 6e 74 20 70 72 6f 67 72 61 6d 73 20 62 65 63 61 75 73 | onably.efficient.programs.becaus |
| f0ee0 | 65 20 69 74 20 64 69 64 20 6c 69 74 74 6c 65 20 72 65 64 75 6e 64 61 6e 74 20 73 65 61 72 63 68 | e.it.did.little.redundant.search |
| f0f00 | 2e 0a 44 6f 79 6c 65 20 28 31 39 37 39 29 20 61 6e 64 20 4d 63 41 6c 6c 65 73 74 65 72 20 28 31 | ..Doyle.(1979).and.McAllester.(1 |
| f0f20 | 39 37 38 2c 20 31 39 38 30 29 20 67 65 6e 65 72 61 6c 69 7a 65 64 20 61 6e 64 20 63 6c 61 72 69 | 978,.1980).generalized.and.clari |
| f0f40 | 66 69 65 64 20 74 68 65 0a 6d 65 74 68 6f 64 73 20 6f 66 20 53 74 61 6c 6c 6d 61 6e 20 61 6e 64 | fied.the.methods.of.Stallman.and |
| f0f60 | 20 53 75 73 73 6d 61 6e 2c 20 64 65 76 65 6c 6f 70 69 6e 67 20 61 20 6e 65 77 20 70 61 72 61 64 | .Sussman,.developing.a.new.parad |
| f0f80 | 69 67 6d 20 66 6f 72 0a 66 6f 72 6d 75 6c 61 74 69 6e 67 20 73 65 61 72 63 68 20 74 68 61 74 20 | igm.for.formulating.search.that. |
| f0fa0 | 69 73 20 6e 6f 77 20 63 61 6c 6c 65 64 20 22 74 72 75 74 68 20 6d 61 69 6e 74 65 6e 61 6e 63 65 | is.now.called."truth.maintenance |
| f0fc0 | 22 2e 20 20 4d 6f 64 65 72 6e 0a 70 72 6f 62 6c 65 6d 2d 73 6f 6c 76 69 6e 67 20 73 79 73 74 65 | "...Modern.problem-solving.syste |
| f0fe0 | 6d 73 20 61 6c 6c 20 75 73 65 20 73 6f 6d 65 20 66 6f 72 6d 20 6f 66 20 74 72 75 74 68 2d 6d 61 | ms.all.use.some.form.of.truth-ma |
| f1000 | 69 6e 74 65 6e 61 6e 63 65 20 73 79 73 74 65 6d 0a 61 73 20 61 20 73 75 62 73 74 72 61 74 65 2e | intenance.system.as.a.substrate. |
| f1020 | 20 20 53 65 65 20 46 6f 72 62 75 73 20 61 6e 64 20 64 65 4b 6c 65 65 72 20 31 39 39 33 20 66 6f | ..See.Forbus.and.deKleer.1993.fo |
| f1040 | 72 20 61 20 64 69 73 63 75 73 73 69 6f 6e 20 6f 66 0a 65 6c 65 67 61 6e 74 20 77 61 79 73 20 74 | r.a.discussion.of.elegant.ways.t |
| f1060 | 6f 20 62 75 69 6c 64 20 74 72 75 74 68 2d 6d 61 69 6e 74 65 6e 61 6e 63 65 20 73 79 73 74 65 6d | o.build.truth-maintenance.system |
| f1080 | 73 20 61 6e 64 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 75 73 69 6e 67 0a 74 72 75 74 68 20 6d | s.and.applications.using.truth.m |
| f10a0 | 61 69 6e 74 65 6e 61 6e 63 65 2e 20 20 5a 61 62 69 68 2c 20 4d 63 41 6c 6c 65 73 74 65 72 2c 20 | aintenance...Zabih,.McAllester,. |
| f10c0 | 61 6e 64 20 43 68 61 70 6d 61 6e 20 31 39 38 37 20 64 65 73 63 72 69 62 65 73 20 61 0a 6e 6f 6e | and.Chapman.1987.describes.a.non |
| f10e0 | 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 65 78 74 65 6e 73 69 6f 6e 20 74 6f 20 53 63 68 65 6d | deterministic.extension.to.Schem |
| f1100 | 65 20 74 68 61 74 20 69 73 20 62 61 73 65 64 20 6f 6e 20 60 61 6d 62 27 3b 20 69 74 20 69 73 0a | e.that.is.based.on.`amb';.it.is. |
| f1120 | 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 64 65 73 63 72 | similar.to.the.interpreter.descr |
| f1140 | 69 62 65 64 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 20 62 75 74 20 6d 6f 72 65 0a 73 | ibed.in.this.section,.but.more.s |
| f1160 | 6f 70 68 69 73 74 69 63 61 74 65 64 2c 20 62 65 63 61 75 73 65 20 69 74 20 75 73 65 73 20 64 65 | ophisticated,.because.it.uses.de |
| f1180 | 70 65 6e 64 65 6e 63 79 2d 64 69 72 65 63 74 65 64 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 20 72 | pendency-directed.backtracking.r |
| f11a0 | 61 74 68 65 72 0a 74 68 61 6e 20 63 68 72 6f 6e 6f 6c 6f 67 69 63 61 6c 20 62 61 63 6b 74 72 61 | ather.than.chronological.backtra |
| f11c0 | 63 6b 69 6e 67 2e 20 20 57 69 6e 73 74 6f 6e 20 31 39 39 32 20 67 69 76 65 73 20 61 6e 20 69 6e | cking...Winston.1992.gives.an.in |
| f11e0 | 74 72 6f 64 75 63 74 69 6f 6e 20 74 6f 0a 62 6f 74 68 20 6b 69 6e 64 73 20 6f 66 20 62 61 63 6b | troduction.to.both.kinds.of.back |
| f1200 | 74 72 61 63 6b 69 6e 67 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e | tracking.....File:.sicp.info,..N |
| f1220 | 6f 64 65 3a 20 34 2d 33 2d 32 2c 20 20 4e 65 78 74 3a 20 34 2d 33 2d 33 2c 20 20 50 72 65 76 3a | ode:.4-3-2,..Next:.4-3-3,..Prev: |
| f1240 | 20 34 2d 33 2d 31 2c 20 20 55 70 3a 20 34 2d 33 0a 0a 34 2e 33 2e 32 20 45 78 61 6d 70 6c 65 73 | .4-3-1,..Up:.4-3..4.3.2.Examples |
| f1260 | 20 6f 66 20 4e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 50 72 6f 67 72 61 6d 73 0a 2d 2d | .of.Nondeterministic.Programs.-- |
| f1280 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| f12a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 53 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 33 2d 33 3a 3a | ---------..Section.*Note.4-3-3:: |
| f12c0 | 20 64 65 73 63 72 69 62 65 73 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 | .describes.the.implementation.of |
| f12e0 | 20 74 68 65 20 60 61 6d 62 27 0a 65 76 61 6c 75 61 74 6f 72 2e 20 20 46 69 72 73 74 2c 20 68 6f | .the.`amb'.evaluator...First,.ho |
| f1300 | 77 65 76 65 72 2c 20 77 65 20 67 69 76 65 20 73 6f 6d 65 20 65 78 61 6d 70 6c 65 73 20 6f 66 20 | wever,.we.give.some.examples.of. |
| f1320 | 68 6f 77 20 69 74 20 63 61 6e 20 62 65 0a 75 73 65 64 2e 20 20 54 68 65 20 61 64 76 61 6e 74 61 | how.it.can.be.used...The.advanta |
| f1340 | 67 65 20 6f 66 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 72 6f 67 72 61 6d 6d 69 | ge.of.nondeterministic.programmi |
| f1360 | 6e 67 20 69 73 20 74 68 61 74 20 77 65 20 63 61 6e 0a 73 75 70 70 72 65 73 73 20 74 68 65 20 64 | ng.is.that.we.can.suppress.the.d |
| f1380 | 65 74 61 69 6c 73 20 6f 66 20 68 6f 77 20 73 65 61 72 63 68 20 69 73 20 63 61 72 72 69 65 64 20 | etails.of.how.search.is.carried. |
| f13a0 | 6f 75 74 2c 20 74 68 65 72 65 62 79 20 65 78 70 72 65 73 73 69 6e 67 0a 6f 75 72 20 70 72 6f 67 | out,.thereby.expressing.our.prog |
| f13c0 | 72 61 6d 73 20 61 74 20 61 20 68 69 67 68 65 72 20 6c 65 76 65 6c 20 6f 66 20 61 62 73 74 72 61 | rams.at.a.higher.level.of.abstra |
| f13e0 | 63 74 69 6f 6e 2e 0a 0a 4c 6f 67 69 63 20 50 75 7a 7a 6c 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ction...Logic.Puzzles........... |
| f1400 | 2e 2e 2e 0a 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 75 7a 7a 6c 65 20 28 74 61 6b 65 6e | .....The.following.puzzle.(taken |
| f1420 | 20 66 72 6f 6d 20 44 69 6e 65 73 6d 61 6e 20 31 39 36 38 29 20 69 73 20 74 79 70 69 63 61 6c 20 | .from.Dinesman.1968).is.typical. |
| f1440 | 6f 66 20 61 20 6c 61 72 67 65 0a 63 6c 61 73 73 20 6f 66 20 73 69 6d 70 6c 65 20 6c 6f 67 69 63 | of.a.large.class.of.simple.logic |
| f1460 | 20 70 75 7a 7a 6c 65 73 3a 0a 0a 20 20 20 20 20 42 61 6b 65 72 2c 20 43 6f 6f 70 65 72 2c 20 46 | .puzzles:.......Baker,.Cooper,.F |
| f1480 | 6c 65 74 63 68 65 72 2c 20 4d 69 6c 6c 65 72 2c 20 61 6e 64 20 53 6d 69 74 68 20 6c 69 76 65 20 | letcher,.Miller,.and.Smith.live. |
| f14a0 | 6f 6e 20 64 69 66 66 65 72 65 6e 74 0a 20 20 20 20 20 66 6c 6f 6f 72 73 20 6f 66 20 61 6e 20 61 | on.different......floors.of.an.a |
| f14c0 | 70 61 72 74 6d 65 6e 74 20 68 6f 75 73 65 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 6f 6e 6c | partment.house.that.contains.onl |
| f14e0 | 79 20 66 69 76 65 20 66 6c 6f 6f 72 73 2e 0a 20 20 20 20 20 42 61 6b 65 72 20 64 6f 65 73 20 6e | y.five.floors.......Baker.does.n |
| f1500 | 6f 74 20 6c 69 76 65 20 6f 6e 20 74 68 65 20 74 6f 70 20 66 6c 6f 6f 72 2e 20 20 43 6f 6f 70 65 | ot.live.on.the.top.floor...Coope |
| f1520 | 72 20 64 6f 65 73 20 6e 6f 74 20 6c 69 76 65 20 6f 6e 20 74 68 65 0a 20 20 20 20 20 62 6f 74 74 | r.does.not.live.on.the......bott |
| f1540 | 6f 6d 20 66 6c 6f 6f 72 2e 20 20 46 6c 65 74 63 68 65 72 20 64 6f 65 73 20 6e 6f 74 20 6c 69 76 | om.floor...Fletcher.does.not.liv |
| f1560 | 65 20 6f 6e 20 65 69 74 68 65 72 20 74 68 65 20 74 6f 70 20 6f 72 20 74 68 65 0a 20 20 20 20 20 | e.on.either.the.top.or.the...... |
| f1580 | 62 6f 74 74 6f 6d 20 66 6c 6f 6f 72 2e 20 20 4d 69 6c 6c 65 72 20 6c 69 76 65 73 20 6f 6e 20 61 | bottom.floor...Miller.lives.on.a |
| f15a0 | 20 68 69 67 68 65 72 20 66 6c 6f 6f 72 20 74 68 61 6e 20 64 6f 65 73 20 43 6f 6f 70 65 72 2e 0a | .higher.floor.than.does.Cooper.. |
| f15c0 | 20 20 20 20 20 53 6d 69 74 68 20 64 6f 65 73 20 6e 6f 74 20 6c 69 76 65 20 6f 6e 20 61 20 66 6c | .....Smith.does.not.live.on.a.fl |
| f15e0 | 6f 6f 72 20 61 64 6a 61 63 65 6e 74 20 74 6f 20 46 6c 65 74 63 68 65 72 27 73 2e 20 20 46 6c 65 | oor.adjacent.to.Fletcher's...Fle |
| f1600 | 74 63 68 65 72 0a 20 20 20 20 20 64 6f 65 73 20 6e 6f 74 20 6c 69 76 65 20 6f 6e 20 61 20 66 6c | tcher......does.not.live.on.a.fl |
| f1620 | 6f 6f 72 20 61 64 6a 61 63 65 6e 74 20 74 6f 20 43 6f 6f 70 65 72 27 73 2e 20 20 57 68 65 72 65 | oor.adjacent.to.Cooper's...Where |
| f1640 | 20 64 6f 65 73 0a 20 20 20 20 20 65 76 65 72 79 6f 6e 65 20 6c 69 76 65 3f 0a 0a 20 20 20 57 65 | .does......everyone.live?.....We |
| f1660 | 20 63 61 6e 20 64 65 74 65 72 6d 69 6e 65 20 77 68 6f 20 6c 69 76 65 73 20 6f 6e 20 65 61 63 68 | .can.determine.who.lives.on.each |
| f1680 | 20 66 6c 6f 6f 72 20 69 6e 20 61 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 77 61 79 20 | .floor.in.a.straightforward.way. |
| f16a0 | 62 79 0a 65 6e 75 6d 65 72 61 74 69 6e 67 20 61 6c 6c 20 74 68 65 20 70 6f 73 73 69 62 69 6c 69 | by.enumerating.all.the.possibili |
| f16c0 | 74 69 65 73 20 61 6e 64 20 69 6d 70 6f 73 69 6e 67 20 74 68 65 20 67 69 76 65 6e 0a 72 65 73 74 | ties.and.imposing.the.given.rest |
| f16e0 | 72 69 63 74 69 6f 6e 73 3a 28 31 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 75 6c 74 | rictions:(1).......(define.(mult |
| f1700 | 69 70 6c 65 2d 64 77 65 6c 6c 69 6e 67 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 62 61 6b | iple-dwelling)........(let.((bak |
| f1720 | 65 72 20 28 61 6d 62 20 31 20 32 20 33 20 34 20 35 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | er.(amb.1.2.3.4.5))............. |
| f1740 | 20 28 63 6f 6f 70 65 72 20 28 61 6d 62 20 31 20 32 20 33 20 34 20 35 29 29 0a 20 20 20 20 20 20 | .(cooper.(amb.1.2.3.4.5))....... |
| f1760 | 20 20 20 20 20 20 20 28 66 6c 65 74 63 68 65 72 20 28 61 6d 62 20 31 20 32 20 33 20 34 20 35 29 | .......(fletcher.(amb.1.2.3.4.5) |
| f1780 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 69 6c 6c 65 72 20 28 61 6d 62 20 31 20 32 20 | )..............(miller.(amb.1.2. |
| f17a0 | 33 20 34 20 35 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 6d 69 74 68 20 28 61 6d 62 | 3.4.5))..............(smith.(amb |
| f17c0 | 20 31 20 32 20 33 20 34 20 35 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 0a | .1.2.3.4.5)))..........(require. |
| f17e0 | 20 20 20 20 20 20 20 20 20 20 28 64 69 73 74 69 6e 63 74 3f 20 28 6c 69 73 74 20 62 61 6b 65 72 | ..........(distinct?.(list.baker |
| f1800 | 20 63 6f 6f 70 65 72 20 66 6c 65 74 63 68 65 72 20 6d 69 6c 6c 65 72 20 73 6d 69 74 68 29 29 29 | .cooper.fletcher.miller.smith))) |
| f1820 | 0a 20 20 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 6e 6f 74 20 28 3d 20 62 61 6b 65 72 | ..........(require.(not.(=.baker |
| f1840 | 20 35 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 6e 6f 74 20 28 3d 20 | .5)))..........(require.(not.(=. |
| f1860 | 63 6f 6f 70 65 72 20 31 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 6e | cooper.1)))..........(require.(n |
| f1880 | 6f 74 20 28 3d 20 66 6c 65 74 63 68 65 72 20 35 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 72 65 | ot.(=.fletcher.5)))..........(re |
| f18a0 | 71 75 69 72 65 20 28 6e 6f 74 20 28 3d 20 66 6c 65 74 63 68 65 72 20 31 29 29 29 0a 20 20 20 20 | quire.(not.(=.fletcher.1)))..... |
| f18c0 | 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 3e 20 6d 69 6c 6c 65 72 20 63 6f 6f 70 65 72 29 29 | .....(require.(>.miller.cooper)) |
| f18e0 | 0a 20 20 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 6e 6f 74 20 28 3d 20 28 61 62 73 20 | ..........(require.(not.(=.(abs. |
| f1900 | 28 2d 20 73 6d 69 74 68 20 66 6c 65 74 63 68 65 72 29 29 20 31 29 29 29 0a 20 20 20 20 20 20 20 | (-.smith.fletcher)).1)))........ |
| f1920 | 20 20 28 72 65 71 75 69 72 65 20 28 6e 6f 74 20 28 3d 20 28 61 62 73 20 28 2d 20 66 6c 65 74 63 | ..(require.(not.(=.(abs.(-.fletc |
| f1940 | 68 65 72 20 63 6f 6f 70 65 72 29 29 20 31 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 | her.cooper)).1)))..........(list |
| f1960 | 20 28 6c 69 73 74 20 27 62 61 6b 65 72 20 62 61 6b 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(list.'baker.baker)............ |
| f1980 | 20 20 20 20 28 6c 69 73 74 20 27 63 6f 6f 70 65 72 20 63 6f 6f 70 65 72 29 0a 20 20 20 20 20 20 | ....(list.'cooper.cooper)....... |
| f19a0 | 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 66 6c 65 74 63 68 65 72 20 66 6c 65 74 63 68 65 | .........(list.'fletcher.fletche |
| f19c0 | 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 6d 69 6c 6c 65 72 20 | r)................(list.'miller. |
| f19e0 | 6d 69 6c 6c 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 73 6d | miller)................(list.'sm |
| f1a00 | 69 74 68 20 73 6d 69 74 68 29 29 29 29 0a 0a 20 20 20 45 76 61 6c 75 61 74 69 6e 67 20 74 68 65 | ith.smith)))).....Evaluating.the |
| f1a20 | 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 6d 75 6c 74 69 70 6c 65 2d 64 77 65 6c 6c 69 6e 67 29 | .expression.`(multiple-dwelling) |
| f1a40 | 27 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 72 65 73 75 6c 74 0a 0a 20 20 20 20 20 28 28 62 61 | '.produces.the.result.......((ba |
| f1a60 | 6b 65 72 20 33 29 20 28 63 6f 6f 70 65 72 20 32 29 20 28 66 6c 65 74 63 68 65 72 20 34 29 20 28 | ker.3).(cooper.2).(fletcher.4).( |
| f1a80 | 6d 69 6c 6c 65 72 20 35 29 20 28 73 6d 69 74 68 20 31 29 29 0a 0a 20 20 20 41 6c 74 68 6f 75 67 | miller.5).(smith.1)).....Althoug |
| f1aa0 | 68 20 74 68 69 73 20 73 69 6d 70 6c 65 20 70 72 6f 63 65 64 75 72 65 20 77 6f 72 6b 73 2c 20 69 | h.this.simple.procedure.works,.i |
| f1ac0 | 74 20 69 73 20 76 65 72 79 20 73 6c 6f 77 2e 20 20 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 20 | t.is.very.slow...*Note.Exercise. |
| f1ae0 | 34 2d 33 39 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 34 30 3a 3a | 4-39::.and.*Note.Exercise.4-40:: |
| f1b00 | 20 64 69 73 63 75 73 73 20 73 6f 6d 65 20 70 6f 73 73 69 62 6c 65 0a 69 6d 70 72 6f 76 65 6d 65 | .discuss.some.possible.improveme |
| f1b20 | 6e 74 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 33 38 3a 2a 20 4d 6f 64 69 | nts........*Exercise.4.38:*.Modi |
| f1b40 | 66 79 20 74 68 65 20 6d 75 6c 74 69 70 6c 65 2d 64 77 65 6c 6c 69 6e 67 20 70 72 6f 63 65 64 75 | fy.the.multiple-dwelling.procedu |
| f1b60 | 72 65 20 74 6f 20 6f 6d 69 74 0a 20 20 20 20 20 74 68 65 20 72 65 71 75 69 72 65 6d 65 6e 74 20 | re.to.omit......the.requirement. |
| f1b80 | 74 68 61 74 20 53 6d 69 74 68 20 61 6e 64 20 46 6c 65 74 63 68 65 72 20 64 6f 20 6e 6f 74 20 6c | that.Smith.and.Fletcher.do.not.l |
| f1ba0 | 69 76 65 20 6f 6e 20 61 64 6a 61 63 65 6e 74 0a 20 20 20 20 20 66 6c 6f 6f 72 73 2e 20 20 48 6f | ive.on.adjacent......floors...Ho |
| f1bc0 | 77 20 6d 61 6e 79 20 73 6f 6c 75 74 69 6f 6e 73 20 61 72 65 20 74 68 65 72 65 20 74 6f 20 74 68 | w.many.solutions.are.there.to.th |
| f1be0 | 69 73 20 6d 6f 64 69 66 69 65 64 20 70 75 7a 7a 6c 65 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | is.modified.puzzle?.......*Exerc |
| f1c00 | 69 73 65 20 34 2e 33 39 3a 2a 20 44 6f 65 73 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 65 | ise.4.39:*.Does.the.order.of.the |
| f1c20 | 20 72 65 73 74 72 69 63 74 69 6f 6e 73 20 69 6e 20 74 68 65 0a 20 20 20 20 20 6d 75 6c 74 69 70 | .restrictions.in.the......multip |
| f1c40 | 6c 65 2d 64 77 65 6c 6c 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 61 66 66 65 63 74 20 74 68 65 | le-dwelling.procedure.affect.the |
| f1c60 | 20 61 6e 73 77 65 72 3f 20 44 6f 65 73 20 69 74 20 61 66 66 65 63 74 20 74 68 65 0a 20 20 20 20 | .answer?.Does.it.affect.the..... |
| f1c80 | 20 74 69 6d 65 20 74 6f 20 66 69 6e 64 20 61 6e 20 61 6e 73 77 65 72 3f 20 20 49 66 20 79 6f 75 | .time.to.find.an.answer?..If.you |
| f1ca0 | 20 74 68 69 6e 6b 20 69 74 20 6d 61 74 74 65 72 73 2c 20 64 65 6d 6f 6e 73 74 72 61 74 65 20 61 | .think.it.matters,.demonstrate.a |
| f1cc0 | 0a 20 20 20 20 20 66 61 73 74 65 72 20 70 72 6f 67 72 61 6d 20 6f 62 74 61 69 6e 65 64 20 66 72 | ......faster.program.obtained.fr |
| f1ce0 | 6f 6d 20 74 68 65 20 67 69 76 65 6e 20 6f 6e 65 20 62 79 20 72 65 6f 72 64 65 72 69 6e 67 20 74 | om.the.given.one.by.reordering.t |
| f1d00 | 68 65 0a 20 20 20 20 20 72 65 73 74 72 69 63 74 69 6f 6e 73 2e 20 20 49 66 20 79 6f 75 20 74 68 | he......restrictions...If.you.th |
| f1d20 | 69 6e 6b 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 74 65 72 2c 20 61 72 67 75 65 20 79 6f | ink.it.does.not.matter,.argue.yo |
| f1d40 | 75 72 20 63 61 73 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 34 30 3a 2a 20 | ur.case........*Exercise.4.40:*. |
| f1d60 | 49 6e 20 74 68 65 20 6d 75 6c 74 69 70 6c 65 20 64 77 65 6c 6c 69 6e 67 20 70 72 6f 62 6c 65 6d | In.the.multiple.dwelling.problem |
| f1d80 | 2c 20 68 6f 77 20 6d 61 6e 79 20 73 65 74 73 0a 20 20 20 20 20 6f 66 20 61 73 73 69 67 6e 6d 65 | ,.how.many.sets......of.assignme |
| f1da0 | 6e 74 73 20 61 72 65 20 74 68 65 72 65 20 6f 66 20 70 65 6f 70 6c 65 20 74 6f 20 66 6c 6f 6f 72 | nts.are.there.of.people.to.floor |
| f1dc0 | 73 2c 20 62 6f 74 68 20 62 65 66 6f 72 65 20 61 6e 64 0a 20 20 20 20 20 61 66 74 65 72 20 74 68 | s,.both.before.and......after.th |
| f1de0 | 65 20 72 65 71 75 69 72 65 6d 65 6e 74 20 74 68 61 74 20 66 6c 6f 6f 72 20 61 73 73 69 67 6e 6d | e.requirement.that.floor.assignm |
| f1e00 | 65 6e 74 73 20 62 65 20 64 69 73 74 69 6e 63 74 3f 20 20 49 74 20 69 73 0a 20 20 20 20 20 76 65 | ents.be.distinct?..It.is......ve |
| f1e20 | 72 79 20 69 6e 65 66 66 69 63 69 65 6e 74 20 74 6f 20 67 65 6e 65 72 61 74 65 20 61 6c 6c 20 70 | ry.inefficient.to.generate.all.p |
| f1e40 | 6f 73 73 69 62 6c 65 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 6f 66 20 70 65 6f 70 6c 65 20 74 6f | ossible.assignments.of.people.to |
| f1e60 | 0a 20 20 20 20 20 66 6c 6f 6f 72 73 20 61 6e 64 20 74 68 65 6e 20 6c 65 61 76 65 20 69 74 20 74 | ......floors.and.then.leave.it.t |
| f1e80 | 6f 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 20 74 6f 20 65 6c 69 6d 69 6e 61 74 65 20 74 68 65 6d | o.backtracking.to.eliminate.them |
| f1ea0 | 2e 20 20 46 6f 72 0a 20 20 20 20 20 65 78 61 6d 70 6c 65 2c 20 6d 6f 73 74 20 6f 66 20 74 68 65 | ...For......example,.most.of.the |
| f1ec0 | 20 72 65 73 74 72 69 63 74 69 6f 6e 73 20 64 65 70 65 6e 64 20 6f 6e 20 6f 6e 6c 79 20 6f 6e 65 | .restrictions.depend.on.only.one |
| f1ee0 | 20 6f 72 20 74 77 6f 20 6f 66 20 74 68 65 0a 20 20 20 20 20 70 65 72 73 6f 6e 2d 66 6c 6f 6f 72 | .or.two.of.the......person-floor |
| f1f00 | 20 76 61 72 69 61 62 6c 65 73 2c 20 61 6e 64 20 63 61 6e 20 74 68 75 73 20 62 65 20 69 6d 70 6f | .variables,.and.can.thus.be.impo |
| f1f20 | 73 65 64 20 62 65 66 6f 72 65 20 66 6c 6f 6f 72 73 20 68 61 76 65 0a 20 20 20 20 20 62 65 65 6e | sed.before.floors.have......been |
| f1f40 | 20 73 65 6c 65 63 74 65 64 20 66 6f 72 20 61 6c 6c 20 74 68 65 20 70 65 6f 70 6c 65 2e 20 20 57 | .selected.for.all.the.people...W |
| f1f60 | 72 69 74 65 20 61 6e 64 20 64 65 6d 6f 6e 73 74 72 61 74 65 20 61 20 6d 75 63 68 0a 20 20 20 20 | rite.and.demonstrate.a.much..... |
| f1f80 | 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 | .more.efficient.nondeterministic |
| f1fa0 | 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 73 6f 6c 76 65 73 20 74 68 69 73 20 70 72 6f 62 | .procedure.that.solves.this.prob |
| f1fc0 | 6c 65 6d 0a 20 20 20 20 20 62 61 73 65 64 20 75 70 6f 6e 20 67 65 6e 65 72 61 74 69 6e 67 20 6f | lem......based.upon.generating.o |
| f1fe0 | 6e 6c 79 20 74 68 6f 73 65 20 70 6f 73 73 69 62 69 6c 69 74 69 65 73 20 74 68 61 74 20 61 72 65 | nly.those.possibilities.that.are |
| f2000 | 20 6e 6f 74 20 61 6c 72 65 61 64 79 0a 20 20 20 20 20 72 75 6c 65 64 20 6f 75 74 20 62 79 20 70 | .not.already......ruled.out.by.p |
| f2020 | 72 65 76 69 6f 75 73 20 72 65 73 74 72 69 63 74 69 6f 6e 73 2e 20 20 28 48 69 6e 74 3a 20 54 68 | revious.restrictions...(Hint:.Th |
| f2040 | 69 73 20 77 69 6c 6c 20 72 65 71 75 69 72 65 20 61 0a 20 20 20 20 20 6e 65 73 74 20 6f 66 20 60 | is.will.require.a......nest.of.` |
| f2060 | 6c 65 74 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 | let'.expressions.).......*Exerci |
| f2080 | 73 65 20 34 2e 34 31 3a 2a 20 57 72 69 74 65 20 61 6e 20 6f 72 64 69 6e 61 72 79 20 53 63 68 65 | se.4.41:*.Write.an.ordinary.Sche |
| f20a0 | 6d 65 20 70 72 6f 67 72 61 6d 20 74 6f 20 73 6f 6c 76 65 20 74 68 65 0a 20 20 20 20 20 6d 75 6c | me.program.to.solve.the......mul |
| f20c0 | 74 69 70 6c 65 20 64 77 65 6c 6c 69 6e 67 20 70 75 7a 7a 6c 65 2e 0a 0a 20 20 20 20 20 2a 45 78 | tiple.dwelling.puzzle........*Ex |
| f20e0 | 65 72 63 69 73 65 20 34 2e 34 32 3a 2a 20 53 6f 6c 76 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e | ercise.4.42:*.Solve.the.followin |
| f2100 | 67 20 22 4c 69 61 72 73 22 20 70 75 7a 7a 6c 65 20 28 66 72 6f 6d 20 50 68 69 6c 6c 69 70 73 0a | g."Liars".puzzle.(from.Phillips. |
| f2120 | 20 20 20 20 20 31 39 33 34 29 3a 0a 0a 20 20 20 20 20 46 69 76 65 20 73 63 68 6f 6f 6c 67 69 72 | .....1934):.......Five.schoolgir |
| f2140 | 6c 73 20 73 61 74 20 66 6f 72 20 61 6e 20 65 78 61 6d 69 6e 61 74 69 6f 6e 2e 20 20 54 68 65 69 | ls.sat.for.an.examination...Thei |
| f2160 | 72 20 70 61 72 65 6e 74 73 2d 2d 73 6f 20 74 68 65 79 0a 20 20 20 20 20 74 68 6f 75 67 68 74 2d | r.parents--so.they......thought- |
| f2180 | 2d 73 68 6f 77 65 64 20 61 6e 20 75 6e 64 75 65 20 64 65 67 72 65 65 20 6f 66 20 69 6e 74 65 72 | -showed.an.undue.degree.of.inter |
| f21a0 | 65 73 74 20 69 6e 20 74 68 65 20 72 65 73 75 6c 74 2e 20 20 54 68 65 79 0a 20 20 20 20 20 74 68 | est.in.the.result...They......th |
| f21c0 | 65 72 65 66 6f 72 65 20 61 67 72 65 65 64 20 74 68 61 74 2c 20 69 6e 20 77 72 69 74 69 6e 67 20 | erefore.agreed.that,.in.writing. |
| f21e0 | 68 6f 6d 65 20 61 62 6f 75 74 20 74 68 65 20 65 78 61 6d 69 6e 61 74 69 6f 6e 2c 20 65 61 63 68 | home.about.the.examination,.each |
| f2200 | 0a 20 20 20 20 20 67 69 72 6c 20 73 68 6f 75 6c 64 20 6d 61 6b 65 20 6f 6e 65 20 74 72 75 65 20 | ......girl.should.make.one.true. |
| f2220 | 73 74 61 74 65 6d 65 6e 74 20 61 6e 64 20 6f 6e 65 20 75 6e 74 72 75 65 20 6f 6e 65 2e 20 20 54 | statement.and.one.untrue.one...T |
| f2240 | 68 65 0a 20 20 20 20 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 72 65 20 74 68 65 20 72 65 6c 65 76 61 | he......following.are.the.releva |
| f2260 | 6e 74 20 70 61 73 73 61 67 65 73 20 66 72 6f 6d 20 74 68 65 69 72 20 6c 65 74 74 65 72 73 3a 0a | nt.passages.from.their.letters:. |
| f2280 | 0a 20 20 20 20 20 20 20 20 2a 20 42 65 74 74 79 3a 20 22 4b 69 74 74 79 20 77 61 73 20 73 65 63 | .........*.Betty:."Kitty.was.sec |
| f22a0 | 6f 6e 64 20 69 6e 20 74 68 65 20 65 78 61 6d 69 6e 61 74 69 6f 6e 2e 20 20 49 20 77 61 73 20 6f | ond.in.the.examination...I.was.o |
| f22c0 | 6e 6c 79 0a 20 20 20 20 20 20 20 20 20 20 74 68 69 72 64 2e 22 0a 0a 20 20 20 20 20 20 20 20 2a | nly...........third."..........* |
| f22e0 | 20 45 74 68 65 6c 3a 20 22 59 6f 75 27 6c 6c 20 62 65 20 67 6c 61 64 20 74 6f 20 68 65 61 72 20 | .Ethel:."You'll.be.glad.to.hear. |
| f2300 | 74 68 61 74 20 49 20 77 61 73 20 6f 6e 20 74 6f 70 2e 20 20 4a 6f 61 6e 20 77 61 73 0a 20 20 20 | that.I.was.on.top...Joan.was.... |
| f2320 | 20 20 20 20 20 20 20 73 65 63 6f 6e 64 2e 22 0a 0a 20 20 20 20 20 20 20 20 2a 20 4a 6f 61 6e 3a | .......second."..........*.Joan: |
| f2340 | 20 22 49 20 77 61 73 20 74 68 69 72 64 2c 20 61 6e 64 20 70 6f 6f 72 20 6f 6c 64 20 45 74 68 65 | ."I.was.third,.and.poor.old.Ethe |
| f2360 | 6c 20 77 61 73 20 62 6f 74 74 6f 6d 2e 22 0a 0a 20 20 20 20 20 20 20 20 2a 20 4b 69 74 74 79 3a | l.was.bottom."..........*.Kitty: |
| f2380 | 20 22 49 20 63 61 6d 65 20 6f 75 74 20 73 65 63 6f 6e 64 2e 20 20 4d 61 72 79 20 77 61 73 20 6f | ."I.came.out.second...Mary.was.o |
| f23a0 | 6e 6c 79 20 66 6f 75 72 74 68 2e 22 0a 0a 20 20 20 20 20 20 20 20 2a 20 4d 61 72 79 3a 20 22 49 | nly.fourth."..........*.Mary:."I |
| f23c0 | 20 77 61 73 20 66 6f 75 72 74 68 2e 20 20 54 6f 70 20 70 6c 61 63 65 20 77 61 73 20 74 61 6b 65 | .was.fourth...Top.place.was.take |
| f23e0 | 6e 20 62 79 20 42 65 74 74 79 2e 22 0a 0a 0a 20 20 20 20 20 57 68 61 74 20 69 6e 20 66 61 63 74 | n.by.Betty."........What.in.fact |
| f2400 | 20 77 61 73 20 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 66 69 76 65 | .was.the.order.in.which.the.five |
| f2420 | 20 67 69 72 6c 73 20 77 65 72 65 20 70 6c 61 63 65 64 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | .girls.were.placed?.......*Exerc |
| f2440 | 69 73 65 20 34 2e 34 33 3a 2a 20 55 73 65 20 74 68 65 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 | ise.4.43:*.Use.the.`amb'.evaluat |
| f2460 | 6f 72 20 74 6f 20 73 6f 6c 76 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 20 20 20 20 20 70 | or.to.solve.the.following......p |
| f2480 | 75 7a 7a 6c 65 3a 28 32 29 0a 0a 20 20 20 20 20 20 20 20 20 20 4d 61 72 79 20 41 6e 6e 20 4d 6f | uzzle:(2)............Mary.Ann.Mo |
| f24a0 | 6f 72 65 27 73 20 66 61 74 68 65 72 20 68 61 73 20 61 20 79 61 63 68 74 20 61 6e 64 20 73 6f 20 | ore's.father.has.a.yacht.and.so. |
| f24c0 | 68 61 73 20 65 61 63 68 20 6f 66 20 68 69 73 0a 20 20 20 20 20 20 20 20 20 20 66 6f 75 72 20 66 | has.each.of.his...........four.f |
| f24e0 | 72 69 65 6e 64 73 3a 20 43 6f 6c 6f 6e 65 6c 20 44 6f 77 6e 69 6e 67 2c 20 4d 72 2e 20 48 61 6c | riends:.Colonel.Downing,.Mr..Hal |
| f2500 | 6c 2c 20 53 69 72 20 42 61 72 6e 61 63 6c 65 20 48 6f 6f 64 2c 0a 20 20 20 20 20 20 20 20 20 20 | l,.Sir.Barnacle.Hood,........... |
| f2520 | 61 6e 64 20 44 72 2e 20 20 50 61 72 6b 65 72 2e 20 20 45 61 63 68 20 6f 66 20 74 68 65 20 66 69 | and.Dr...Parker...Each.of.the.fi |
| f2540 | 76 65 20 61 6c 73 6f 20 68 61 73 20 6f 6e 65 20 64 61 75 67 68 74 65 72 20 61 6e 64 0a 20 20 20 | ve.also.has.one.daughter.and.... |
| f2560 | 20 20 20 20 20 20 20 65 61 63 68 20 68 61 73 20 6e 61 6d 65 64 20 68 69 73 20 79 61 63 68 74 20 | .......each.has.named.his.yacht. |
| f2580 | 61 66 74 65 72 20 61 20 64 61 75 67 68 74 65 72 20 6f 66 20 6f 6e 65 20 6f 66 20 74 68 65 0a 20 | after.a.daughter.of.one.of.the.. |
| f25a0 | 20 20 20 20 20 20 20 20 20 6f 74 68 65 72 73 2e 20 20 53 69 72 20 42 61 72 6e 61 63 6c 65 27 73 | .........others...Sir.Barnacle's |
| f25c0 | 20 79 61 63 68 74 20 69 73 20 74 68 65 20 47 61 62 72 69 65 6c 6c 65 2c 20 4d 72 2e 20 4d 6f 6f | .yacht.is.the.Gabrielle,.Mr..Moo |
| f25e0 | 72 65 0a 20 20 20 20 20 20 20 20 20 20 6f 77 6e 73 20 74 68 65 20 4c 6f 72 6e 61 3b 20 4d 72 2e | re...........owns.the.Lorna;.Mr. |
| f2600 | 20 48 61 6c 6c 20 74 68 65 20 52 6f 73 61 6c 69 6e 64 2e 20 20 54 68 65 20 4d 65 6c 69 73 73 61 | .Hall.the.Rosalind...The.Melissa |
| f2620 | 2c 20 6f 77 6e 65 64 20 62 79 0a 20 20 20 20 20 20 20 20 20 20 43 6f 6c 6f 6e 65 6c 20 44 6f 77 | ,.owned.by...........Colonel.Dow |
| f2640 | 6e 69 6e 67 2c 20 69 73 20 6e 61 6d 65 64 20 61 66 74 65 72 20 53 69 72 20 42 61 72 6e 61 63 6c | ning,.is.named.after.Sir.Barnacl |
| f2660 | 65 27 73 20 64 61 75 67 68 74 65 72 2e 0a 20 20 20 20 20 20 20 20 20 20 47 61 62 72 69 65 6c 6c | e's.daughter............Gabriell |
| f2680 | 65 27 73 20 66 61 74 68 65 72 20 6f 77 6e 73 20 74 68 65 20 79 61 63 68 74 20 74 68 61 74 20 69 | e's.father.owns.the.yacht.that.i |
| f26a0 | 73 20 6e 61 6d 65 64 20 61 66 74 65 72 20 44 72 2e 0a 20 20 20 20 20 20 20 20 20 20 50 61 72 6b | s.named.after.Dr............Park |
| f26c0 | 65 72 27 73 20 64 61 75 67 68 74 65 72 2e 20 20 57 68 6f 20 69 73 20 4c 6f 72 6e 61 27 73 20 66 | er's.daughter...Who.is.Lorna's.f |
| f26e0 | 61 74 68 65 72 3f 0a 0a 20 20 20 20 20 54 72 79 20 74 6f 20 77 72 69 74 65 20 74 68 65 20 70 72 | ather?.......Try.to.write.the.pr |
| f2700 | 6f 67 72 61 6d 20 73 6f 20 74 68 61 74 20 69 74 20 72 75 6e 73 20 65 66 66 69 63 69 65 6e 74 6c | ogram.so.that.it.runs.efficientl |
| f2720 | 79 20 28 73 65 65 20 2a 4e 6f 74 65 0a 20 20 20 20 20 45 78 65 72 63 69 73 65 20 34 2d 34 30 3a | y.(see.*Note......Exercise.4-40: |
| f2740 | 3a 29 2e 20 20 41 6c 73 6f 20 64 65 74 65 72 6d 69 6e 65 20 68 6f 77 20 6d 61 6e 79 20 73 6f 6c | :)...Also.determine.how.many.sol |
| f2760 | 75 74 69 6f 6e 73 20 74 68 65 72 65 20 61 72 65 20 69 66 0a 20 20 20 20 20 77 65 20 61 72 65 20 | utions.there.are.if......we.are. |
| f2780 | 6e 6f 74 20 74 6f 6c 64 20 74 68 61 74 20 4d 61 72 79 20 41 6e 6e 27 73 20 6c 61 73 74 20 6e 61 | not.told.that.Mary.Ann's.last.na |
| f27a0 | 6d 65 20 69 73 20 4d 6f 6f 72 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 34 | me.is.Moore........*Exercise.4.4 |
| f27c0 | 34 3a 2a 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 34 32 3a 3a 20 64 65 73 63 72 69 | 4:*.*Note.Exercise.2-42::.descri |
| f27e0 | 62 65 64 20 74 68 65 20 22 65 69 67 68 74 2d 71 75 65 65 6e 73 0a 20 20 20 20 20 70 75 7a 7a 6c | bed.the."eight-queens......puzzl |
| f2800 | 65 22 20 6f 66 20 70 6c 61 63 69 6e 67 20 71 75 65 65 6e 73 20 6f 6e 20 61 20 63 68 65 73 73 62 | e".of.placing.queens.on.a.chessb |
| f2820 | 6f 61 72 64 20 73 6f 20 74 68 61 74 20 6e 6f 20 74 77 6f 20 61 74 74 61 63 6b 0a 20 20 20 20 20 | oard.so.that.no.two.attack...... |
| f2840 | 65 61 63 68 20 6f 74 68 65 72 2e 20 20 57 72 69 74 65 20 61 20 6e 6f 6e 64 65 74 65 72 6d 69 6e | each.other...Write.a.nondetermin |
| f2860 | 69 73 74 69 63 20 70 72 6f 67 72 61 6d 20 74 6f 20 73 6f 6c 76 65 20 74 68 69 73 20 70 75 7a 7a | istic.program.to.solve.this.puzz |
| f2880 | 6c 65 2e 0a 0a 50 61 72 73 69 6e 67 20 6e 61 74 75 72 61 6c 20 6c 61 6e 67 75 61 67 65 0a 2e 2e | le...Parsing.natural.language... |
| f28a0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 50 72 6f 67 72 61 6d 73 | ........................Programs |
| f28c0 | 20 64 65 73 69 67 6e 65 64 20 74 6f 20 61 63 63 65 70 74 20 6e 61 74 75 72 61 6c 20 6c 61 6e 67 | .designed.to.accept.natural.lang |
| f28e0 | 75 61 67 65 20 61 73 20 69 6e 70 75 74 20 75 73 75 61 6c 6c 79 20 73 74 61 72 74 20 62 79 0a 61 | uage.as.input.usually.start.by.a |
| f2900 | 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 22 70 61 72 73 65 22 20 74 68 65 20 69 6e 70 75 74 2c 20 | ttempting.to."parse".the.input,. |
| f2920 | 74 68 61 74 20 69 73 2c 20 74 6f 20 6d 61 74 63 68 20 74 68 65 20 69 6e 70 75 74 20 61 67 61 69 | that.is,.to.match.the.input.agai |
| f2940 | 6e 73 74 0a 73 6f 6d 65 20 67 72 61 6d 6d 61 74 69 63 61 6c 20 73 74 72 75 63 74 75 72 65 2e 20 | nst.some.grammatical.structure.. |
| f2960 | 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 6d 69 67 68 74 20 74 72 79 20 74 6f 20 72 65 | .For.example,.we.might.try.to.re |
| f2980 | 63 6f 67 6e 69 7a 65 0a 73 69 6d 70 6c 65 20 73 65 6e 74 65 6e 63 65 73 20 63 6f 6e 73 69 73 74 | cognize.simple.sentences.consist |
| f29a0 | 69 6e 67 20 6f 66 20 61 6e 20 61 72 74 69 63 6c 65 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 | ing.of.an.article.followed.by.a. |
| f29c0 | 6e 6f 75 6e 20 66 6f 6c 6c 6f 77 65 64 0a 62 79 20 61 20 76 65 72 62 2c 20 73 75 63 68 20 61 73 | noun.followed.by.a.verb,.such.as |
| f29e0 | 20 22 54 68 65 20 63 61 74 20 65 61 74 73 2e 22 20 20 54 6f 20 61 63 63 6f 6d 70 6c 69 73 68 20 | ."The.cat.eats."..To.accomplish. |
| f2a00 | 73 75 63 68 20 61 6e 20 61 6e 61 6c 79 73 69 73 2c 20 77 65 0a 6d 75 73 74 20 62 65 20 61 62 6c | such.an.analysis,.we.must.be.abl |
| f2a20 | 65 20 74 6f 20 69 64 65 6e 74 69 66 79 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 73 70 65 65 63 | e.to.identify.the.parts.of.speec |
| f2a40 | 68 20 6f 66 20 69 6e 64 69 76 69 64 75 61 6c 20 77 6f 72 64 73 2e 20 20 57 65 0a 63 6f 75 6c 64 | h.of.individual.words...We.could |
| f2a60 | 20 73 74 61 72 74 20 77 69 74 68 20 73 6f 6d 65 20 6c 69 73 74 73 20 74 68 61 74 20 63 6c 61 73 | .start.with.some.lists.that.clas |
| f2a80 | 73 69 66 79 20 76 61 72 69 6f 75 73 20 77 6f 72 64 73 3a 28 33 29 0a 0a 20 20 20 20 20 28 64 65 | sify.various.words:(3).......(de |
| f2aa0 | 66 69 6e 65 20 6e 6f 75 6e 73 20 27 28 6e 6f 75 6e 20 73 74 75 64 65 6e 74 20 70 72 6f 66 65 73 | fine.nouns.'(noun.student.profes |
| f2ac0 | 73 6f 72 20 63 61 74 20 63 6c 61 73 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 76 65 | sor.cat.class)).......(define.ve |
| f2ae0 | 72 62 73 20 27 28 76 65 72 62 20 73 74 75 64 69 65 73 20 6c 65 63 74 75 72 65 73 20 65 61 74 73 | rbs.'(verb.studies.lectures.eats |
| f2b00 | 20 73 6c 65 65 70 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 61 72 74 69 63 6c 65 73 | .sleeps)).......(define.articles |
| f2b20 | 20 27 28 61 72 74 69 63 6c 65 20 74 68 65 20 61 29 29 0a 0a 20 20 20 57 65 20 61 6c 73 6f 20 6e | .'(article.the.a)).....We.also.n |
| f2b40 | 65 65 64 20 61 20 22 67 72 61 6d 6d 61 72 22 2c 20 74 68 61 74 20 69 73 2c 20 61 20 73 65 74 20 | eed.a."grammar",.that.is,.a.set. |
| f2b60 | 6f 66 20 72 75 6c 65 73 20 64 65 73 63 72 69 62 69 6e 67 20 68 6f 77 0a 67 72 61 6d 6d 61 74 69 | of.rules.describing.how.grammati |
| f2b80 | 63 61 6c 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 20 63 6f 6d 70 6f 73 65 64 20 66 72 6f 6d 20 73 | cal.elements.are.composed.from.s |
| f2ba0 | 69 6d 70 6c 65 72 20 65 6c 65 6d 65 6e 74 73 2e 20 20 41 20 76 65 72 79 20 73 69 6d 70 6c 65 0a | impler.elements...A.very.simple. |
| f2bc0 | 67 72 61 6d 6d 61 72 20 6d 69 67 68 74 20 73 74 69 70 75 6c 61 74 65 20 74 68 61 74 20 61 20 73 | grammar.might.stipulate.that.a.s |
| f2be0 | 65 6e 74 65 6e 63 65 20 61 6c 77 61 79 73 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 74 77 6f 0a 70 | entence.always.consists.of.two.p |
| f2c00 | 69 65 63 65 73 2d 2d 61 20 6e 6f 75 6e 20 70 68 72 61 73 65 20 66 6f 6c 6c 6f 77 65 64 20 62 79 | ieces--a.noun.phrase.followed.by |
| f2c20 | 20 61 20 76 65 72 62 2d 2d 61 6e 64 20 74 68 61 74 20 61 20 6e 6f 75 6e 20 70 68 72 61 73 65 0a | .a.verb--and.that.a.noun.phrase. |
| f2c40 | 63 6f 6e 73 69 73 74 73 20 6f 66 20 61 6e 20 61 72 74 69 63 6c 65 20 66 6f 6c 6c 6f 77 65 64 20 | consists.of.an.article.followed. |
| f2c60 | 62 79 20 61 20 6e 6f 75 6e 2e 20 20 57 69 74 68 20 74 68 69 73 20 67 72 61 6d 6d 61 72 2c 20 74 | by.a.noun...With.this.grammar,.t |
| f2c80 | 68 65 0a 73 65 6e 74 65 6e 63 65 20 22 54 68 65 20 63 61 74 20 65 61 74 73 22 20 69 73 20 70 61 | he.sentence."The.cat.eats".is.pa |
| f2ca0 | 72 73 65 64 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 73 65 6e 74 65 6e 63 65 | rsed.as.follows:.......(sentence |
| f2cc0 | 20 28 6e 6f 75 6e 2d 70 68 72 61 73 65 20 28 61 72 74 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 | .(noun-phrase.(article.the).(nou |
| f2ce0 | 6e 20 63 61 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 76 65 72 62 20 65 61 74 | n.cat))................(verb.eat |
| f2d00 | 73 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 67 65 6e 65 72 61 74 65 20 73 75 63 68 20 61 20 70 | s)).....We.can.generate.such.a.p |
| f2d20 | 61 72 73 65 20 77 69 74 68 20 61 20 73 69 6d 70 6c 65 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 | arse.with.a.simple.program.that. |
| f2d40 | 68 61 73 20 73 65 70 61 72 61 74 65 0a 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 65 61 63 68 | has.separate.procedures.for.each |
| f2d60 | 20 6f 66 20 74 68 65 20 67 72 61 6d 6d 61 74 69 63 61 6c 20 72 75 6c 65 73 2e 20 20 54 6f 20 70 | .of.the.grammatical.rules...To.p |
| f2d80 | 61 72 73 65 20 61 20 73 65 6e 74 65 6e 63 65 2c 20 77 65 0a 69 64 65 6e 74 69 66 79 20 69 74 73 | arse.a.sentence,.we.identify.its |
| f2da0 | 20 74 77 6f 20 63 6f 6e 73 74 69 74 75 65 6e 74 20 70 69 65 63 65 73 20 61 6e 64 20 72 65 74 75 | .two.constituent.pieces.and.retu |
| f2dc0 | 72 6e 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 73 65 20 74 77 6f 0a 65 6c 65 6d 65 6e 74 73 2c | rn.a.list.of.these.two.elements, |
| f2de0 | 20 74 61 67 67 65 64 20 77 69 74 68 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 73 65 6e 74 65 6e 63 | .tagged.with.the.symbol.`sentenc |
| f2e00 | 65 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 73 65 2d 73 65 6e 74 65 6e 63 | e':.......(define.(parse-sentenc |
| f2e20 | 65 29 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 73 65 6e 74 65 6e 63 65 0a 20 20 20 20 20 20 | e)........(list.'sentence....... |
| f2e40 | 20 20 20 20 20 20 20 20 28 70 61 72 73 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 29 0a 20 20 20 20 | ........(parse-noun-phrase)..... |
| f2e60 | 20 20 20 20 20 20 20 20 20 20 28 70 61 72 73 65 2d 77 6f 72 64 20 76 65 72 62 73 29 29 29 0a 0a | ..........(parse-word.verbs))).. |
| f2e80 | 20 20 20 41 20 6e 6f 75 6e 20 70 68 72 61 73 65 2c 20 73 69 6d 69 6c 61 72 6c 79 2c 20 69 73 20 | ...A.noun.phrase,.similarly,.is. |
| f2ea0 | 70 61 72 73 65 64 20 62 79 20 66 69 6e 64 69 6e 67 20 61 6e 20 61 72 74 69 63 6c 65 20 66 6f 6c | parsed.by.finding.an.article.fol |
| f2ec0 | 6c 6f 77 65 64 0a 62 79 20 61 20 6e 6f 75 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | lowed.by.a.noun:.......(define.( |
| f2ee0 | 70 61 72 73 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 29 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 | parse-noun-phrase)........(list. |
| f2f00 | 27 6e 6f 75 6e 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 72 73 65 | 'noun-phrase..............(parse |
| f2f20 | 2d 77 6f 72 64 20 61 72 74 69 63 6c 65 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 | -word.articles)..............(pa |
| f2f40 | 72 73 65 2d 77 6f 72 64 20 6e 6f 75 6e 73 29 29 29 0a 0a 20 20 20 41 74 20 74 68 65 20 6c 6f 77 | rse-word.nouns))).....At.the.low |
| f2f60 | 65 73 74 20 6c 65 76 65 6c 2c 20 70 61 72 73 69 6e 67 20 62 6f 69 6c 73 20 64 6f 77 6e 20 74 6f | est.level,.parsing.boils.down.to |
| f2f80 | 20 72 65 70 65 61 74 65 64 6c 79 20 63 68 65 63 6b 69 6e 67 20 74 68 61 74 0a 74 68 65 20 6e 65 | .repeatedly.checking.that.the.ne |
| f2fa0 | 78 74 20 75 6e 70 61 72 73 65 64 20 77 6f 72 64 20 69 73 20 61 20 6d 65 6d 62 65 72 20 6f 66 20 | xt.unparsed.word.is.a.member.of. |
| f2fc0 | 74 68 65 20 6c 69 73 74 20 6f 66 20 77 6f 72 64 73 20 66 6f 72 20 74 68 65 0a 72 65 71 75 69 72 | the.list.of.words.for.the.requir |
| f2fe0 | 65 64 20 70 61 72 74 20 6f 66 20 73 70 65 65 63 68 2e 20 20 54 6f 20 69 6d 70 6c 65 6d 65 6e 74 | ed.part.of.speech...To.implement |
| f3000 | 20 74 68 69 73 2c 20 77 65 20 6d 61 69 6e 74 61 69 6e 20 61 20 67 6c 6f 62 61 6c 0a 76 61 72 69 | .this,.we.maintain.a.global.vari |
| f3020 | 61 62 6c 65 20 60 2a 75 6e 70 61 72 73 65 64 2a 27 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 | able.`*unparsed*',.which.is.the. |
| f3040 | 69 6e 70 75 74 20 74 68 61 74 20 68 61 73 20 6e 6f 74 20 79 65 74 20 62 65 65 6e 20 70 61 72 73 | input.that.has.not.yet.been.pars |
| f3060 | 65 64 2e 0a 45 61 63 68 20 74 69 6d 65 20 77 65 20 63 68 65 63 6b 20 61 20 77 6f 72 64 2c 20 77 | ed..Each.time.we.check.a.word,.w |
| f3080 | 65 20 72 65 71 75 69 72 65 20 74 68 61 74 20 60 2a 75 6e 70 61 72 73 65 64 2a 27 20 6d 75 73 74 | e.require.that.`*unparsed*'.must |
| f30a0 | 20 62 65 0a 6e 6f 6e 2d 65 6d 70 74 79 20 61 6e 64 20 74 68 61 74 20 69 74 20 73 68 6f 75 6c 64 | .be.non-empty.and.that.it.should |
| f30c0 | 20 62 65 67 69 6e 20 77 69 74 68 20 61 20 77 6f 72 64 20 66 72 6f 6d 20 74 68 65 20 64 65 73 69 | .begin.with.a.word.from.the.desi |
| f30e0 | 67 6e 61 74 65 64 0a 6c 69 73 74 2e 20 20 49 66 20 73 6f 2c 20 77 65 20 72 65 6d 6f 76 65 20 74 | gnated.list...If.so,.we.remove.t |
| f3100 | 68 61 74 20 77 6f 72 64 20 66 72 6f 6d 20 60 2a 75 6e 70 61 72 73 65 64 2a 27 20 61 6e 64 20 72 | hat.word.from.`*unparsed*'.and.r |
| f3120 | 65 74 75 72 6e 20 74 68 65 20 77 6f 72 64 0a 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 69 74 73 | eturn.the.word.together.with.its |
| f3140 | 20 70 61 72 74 20 6f 66 20 73 70 65 65 63 68 20 28 77 68 69 63 68 20 69 73 20 66 6f 75 6e 64 20 | .part.of.speech.(which.is.found. |
| f3160 | 61 74 20 74 68 65 20 68 65 61 64 20 6f 66 20 74 68 65 0a 6c 69 73 74 29 3a 28 34 29 0a 0a 20 20 | at.the.head.of.the.list):(4).... |
| f3180 | 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 73 65 2d 77 6f 72 64 20 77 6f 72 64 2d 6c 69 73 74 | ...(define.(parse-word.word-list |
| f31a0 | 29 0a 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 6e 6f 74 20 28 6e 75 6c 6c 3f 20 2a 75 | )........(require.(not.(null?.*u |
| f31c0 | 6e 70 61 72 73 65 64 2a 29 29 29 0a 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 6d 65 6d | nparsed*)))........(require.(mem |
| f31e0 | 71 20 28 63 61 72 20 2a 75 6e 70 61 72 73 65 64 2a 29 20 28 63 64 72 20 77 6f 72 64 2d 6c 69 73 | q.(car.*unparsed*).(cdr.word-lis |
| f3200 | 74 29 29 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 66 6f 75 6e 64 2d 77 6f 72 64 20 28 63 | t)))........(let.((found-word.(c |
| f3220 | 61 72 20 2a 75 6e 70 61 72 73 65 64 2a 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 | ar.*unparsed*)))..........(set!. |
| f3240 | 2a 75 6e 70 61 72 73 65 64 2a 20 28 63 64 72 20 2a 75 6e 70 61 72 73 65 64 2a 29 29 0a 20 20 20 | *unparsed*.(cdr.*unparsed*)).... |
| f3260 | 20 20 20 20 20 20 28 6c 69 73 74 20 28 63 61 72 20 77 6f 72 64 2d 6c 69 73 74 29 20 66 6f 75 6e | ......(list.(car.word-list).foun |
| f3280 | 64 2d 77 6f 72 64 29 29 29 0a 0a 20 20 20 54 6f 20 73 74 61 72 74 20 74 68 65 20 70 61 72 73 69 | d-word))).....To.start.the.parsi |
| f32a0 | 6e 67 2c 20 61 6c 6c 20 77 65 20 6e 65 65 64 20 74 6f 20 64 6f 20 69 73 20 73 65 74 20 60 2a 75 | ng,.all.we.need.to.do.is.set.`*u |
| f32c0 | 6e 70 61 72 73 65 64 2a 27 20 74 6f 20 62 65 20 74 68 65 0a 65 6e 74 69 72 65 20 69 6e 70 75 74 | nparsed*'.to.be.the.entire.input |
| f32e0 | 2c 20 74 72 79 20 74 6f 20 70 61 72 73 65 20 61 20 73 65 6e 74 65 6e 63 65 2c 20 61 6e 64 20 63 | ,.try.to.parse.a.sentence,.and.c |
| f3300 | 68 65 63 6b 20 74 68 61 74 20 6e 6f 74 68 69 6e 67 20 69 73 20 6c 65 66 74 0a 6f 76 65 72 3a 0a | heck.that.nothing.is.left.over:. |
| f3320 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 2a 75 6e 70 61 72 73 65 64 2a 20 27 28 29 29 0a 0a 20 | ......(define.*unparsed*.'())... |
| f3340 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 73 65 20 69 6e 70 75 74 29 0a 20 20 20 20 20 20 | ....(define.(parse.input)....... |
| f3360 | 20 28 73 65 74 21 20 2a 75 6e 70 61 72 73 65 64 2a 20 69 6e 70 75 74 29 0a 20 20 20 20 20 20 20 | .(set!.*unparsed*.input)........ |
| f3380 | 28 6c 65 74 20 28 28 73 65 6e 74 20 28 70 61 72 73 65 2d 73 65 6e 74 65 6e 63 65 29 29 29 0a 20 | (let.((sent.(parse-sentence))).. |
| f33a0 | 20 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 6e 75 6c 6c 3f 20 2a 75 6e 70 61 72 73 65 | ........(require.(null?.*unparse |
| f33c0 | 64 2a 29 29 0a 20 20 20 20 20 20 20 20 20 73 65 6e 74 29 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 | d*))..........sent)).....We.can. |
| f33e0 | 6e 6f 77 20 74 72 79 20 74 68 65 20 70 61 72 73 65 72 20 61 6e 64 20 76 65 72 69 66 79 20 74 68 | now.try.the.parser.and.verify.th |
| f3400 | 61 74 20 69 74 20 77 6f 72 6b 73 20 66 6f 72 20 6f 75 72 20 73 69 6d 70 6c 65 0a 74 65 73 74 20 | at.it.works.for.our.simple.test. |
| f3420 | 73 65 6e 74 65 6e 63 65 3a 0a 0a 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 69 6e 70 | sentence:.......;;;.Amb-Eval.inp |
| f3440 | 75 74 3a 0a 20 20 20 20 20 28 70 61 72 73 65 20 27 28 74 68 65 20 63 61 74 20 65 61 74 73 29 29 | ut:......(parse.'(the.cat.eats)) |
| f3460 | 0a 20 20 20 20 20 3b 3b 3b 20 53 74 61 72 74 69 6e 67 20 61 20 6e 65 77 20 70 72 6f 62 6c 65 6d | ......;;;.Starting.a.new.problem |
| f3480 | 0a 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 28 | ......;;;.Amb-Eval.value:......( |
| f34a0 | 73 65 6e 74 65 6e 63 65 20 28 6e 6f 75 6e 2d 70 68 72 61 73 65 20 28 61 72 74 69 63 6c 65 20 74 | sentence.(noun-phrase.(article.t |
| f34c0 | 68 65 29 20 28 6e 6f 75 6e 20 63 61 74 29 29 20 28 76 65 72 62 20 65 61 74 73 29 29 0a 0a 20 20 | he).(noun.cat)).(verb.eats)).... |
| f34e0 | 20 54 68 65 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 20 69 73 20 75 73 65 66 75 6c 20 68 | .The.`amb'.evaluator.is.useful.h |
| f3500 | 65 72 65 20 62 65 63 61 75 73 65 20 69 74 20 69 73 20 63 6f 6e 76 65 6e 69 65 6e 74 20 74 6f 0a | ere.because.it.is.convenient.to. |
| f3520 | 65 78 70 72 65 73 73 20 74 68 65 20 70 61 72 73 69 6e 67 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 | express.the.parsing.constraints. |
| f3540 | 77 69 74 68 20 74 68 65 20 61 69 64 20 6f 66 20 60 72 65 71 75 69 72 65 27 2e 20 20 41 75 74 6f | with.the.aid.of.`require'...Auto |
| f3560 | 6d 61 74 69 63 0a 73 65 61 72 63 68 20 61 6e 64 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 20 72 65 | matic.search.and.backtracking.re |
| f3580 | 61 6c 6c 79 20 70 61 79 20 6f 66 66 2c 20 68 6f 77 65 76 65 72 2c 20 77 68 65 6e 20 77 65 20 63 | ally.pay.off,.however,.when.we.c |
| f35a0 | 6f 6e 73 69 64 65 72 20 6d 6f 72 65 0a 63 6f 6d 70 6c 65 78 20 67 72 61 6d 6d 61 72 73 20 77 68 | onsider.more.complex.grammars.wh |
| f35c0 | 65 72 65 20 74 68 65 72 65 20 61 72 65 20 63 68 6f 69 63 65 73 20 66 6f 72 20 68 6f 77 20 74 68 | ere.there.are.choices.for.how.th |
| f35e0 | 65 20 75 6e 69 74 73 20 63 61 6e 20 62 65 0a 64 65 63 6f 6d 70 6f 73 65 64 2e 0a 0a 20 20 20 4c | e.units.can.be.decomposed......L |
| f3600 | 65 74 27 73 20 61 64 64 20 74 6f 20 6f 75 72 20 67 72 61 6d 6d 61 72 20 61 20 6c 69 73 74 20 6f | et's.add.to.our.grammar.a.list.o |
| f3620 | 66 20 70 72 65 70 6f 73 69 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 70 72 | f.prepositions:.......(define.pr |
| f3640 | 65 70 6f 73 69 74 69 6f 6e 73 20 27 28 70 72 65 70 20 66 6f 72 20 74 6f 20 69 6e 20 62 79 20 77 | epositions.'(prep.for.to.in.by.w |
| f3660 | 69 74 68 29 29 0a 0a 61 6e 64 20 64 65 66 69 6e 65 20 61 20 70 72 65 70 6f 73 69 74 69 6f 6e 61 | ith))..and.define.a.prepositiona |
| f3680 | 6c 20 70 68 72 61 73 65 20 28 65 2e 67 2e 2c 20 22 66 6f 72 20 74 68 65 20 63 61 74 22 29 20 74 | l.phrase.(e.g.,."for.the.cat").t |
| f36a0 | 6f 20 62 65 20 61 0a 70 72 65 70 6f 73 69 74 69 6f 6e 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 | o.be.a.preposition.followed.by.a |
| f36c0 | 20 6e 6f 75 6e 20 70 68 72 61 73 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 | .noun.phrase:.......(define.(par |
| f36e0 | 73 65 2d 70 72 65 70 6f 73 69 74 69 6f 6e 61 6c 2d 70 68 72 61 73 65 29 0a 20 20 20 20 20 20 20 | se-prepositional-phrase)........ |
| f3700 | 28 6c 69 73 74 20 27 70 72 65 70 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | (list.'prep-phrase.............. |
| f3720 | 28 70 61 72 73 65 2d 77 6f 72 64 20 70 72 65 70 6f 73 69 74 69 6f 6e 73 29 0a 20 20 20 20 20 20 | (parse-word.prepositions)....... |
| f3740 | 20 20 20 20 20 20 20 28 70 61 72 73 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 29 29 29 0a 0a 20 20 | .......(parse-noun-phrase))).... |
| f3760 | 20 4e 6f 77 20 77 65 20 63 61 6e 20 64 65 66 69 6e 65 20 61 20 73 65 6e 74 65 6e 63 65 20 74 6f | .Now.we.can.define.a.sentence.to |
| f3780 | 20 62 65 20 61 20 6e 6f 75 6e 20 70 68 72 61 73 65 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 | .be.a.noun.phrase.followed.by.a. |
| f37a0 | 76 65 72 62 0a 70 68 72 61 73 65 2c 20 77 68 65 72 65 20 61 20 76 65 72 62 20 70 68 72 61 73 65 | verb.phrase,.where.a.verb.phrase |
| f37c0 | 20 63 61 6e 20 62 65 20 65 69 74 68 65 72 20 61 20 76 65 72 62 20 6f 72 20 61 20 76 65 72 62 20 | .can.be.either.a.verb.or.a.verb. |
| f37e0 | 70 68 72 61 73 65 0a 65 78 74 65 6e 64 65 64 20 62 79 20 61 20 70 72 65 70 6f 73 69 74 69 6f 6e | phrase.extended.by.a.preposition |
| f3800 | 61 6c 20 70 68 72 61 73 65 3a 28 35 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 | al.phrase:(5).......(define.(par |
| f3820 | 73 65 2d 73 65 6e 74 65 6e 63 65 29 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 73 65 6e 74 65 | se-sentence)........(list.'sente |
| f3840 | 6e 63 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 72 73 65 2d 6e 6f 75 6e 2d 70 68 | nce...............(parse-noun-ph |
| f3860 | 72 61 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 72 73 65 2d 76 65 72 62 2d | rase)...............(parse-verb- |
| f3880 | 70 68 72 61 73 65 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 73 65 2d 76 | phrase))).......(define.(parse-v |
| f38a0 | 65 72 62 2d 70 68 72 61 73 65 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 79 62 | erb-phrase)........(define.(mayb |
| f38c0 | 65 2d 65 78 74 65 6e 64 20 76 65 72 62 2d 70 68 72 61 73 65 29 0a 20 20 20 20 20 20 20 20 20 28 | e-extend.verb-phrase)..........( |
| f38e0 | 61 6d 62 20 76 65 72 62 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d | amb.verb-phrase...............(m |
| f3900 | 61 79 62 65 2d 65 78 74 65 6e 64 20 28 6c 69 73 74 20 27 76 65 72 62 2d 70 68 72 61 73 65 0a 20 | aybe-extend.(list.'verb-phrase.. |
| f3920 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| f3940 | 20 76 65 72 62 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .verb-phrase.................... |
| f3960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 72 73 65 2d 70 72 65 70 6f 73 69 74 69 6f | ...............(parse-prepositio |
| f3980 | 6e 61 6c 2d 70 68 72 61 73 65 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 6d 61 79 62 65 2d 65 78 | nal-phrase)))))........(maybe-ex |
| f39a0 | 74 65 6e 64 20 28 70 61 72 73 65 2d 77 6f 72 64 20 76 65 72 62 73 29 29 29 0a 0a 20 20 20 57 68 | tend.(parse-word.verbs))).....Wh |
| f39c0 | 69 6c 65 20 77 65 27 72 65 20 61 74 20 69 74 2c 20 77 65 20 63 61 6e 20 61 6c 73 6f 20 65 6c 61 | ile.we're.at.it,.we.can.also.ela |
| f39e0 | 62 6f 72 61 74 65 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 6e 6f 75 6e 0a 70 68 | borate.the.definition.of.noun.ph |
| f3a00 | 72 61 73 65 73 20 74 6f 20 70 65 72 6d 69 74 20 73 75 63 68 20 74 68 69 6e 67 73 20 61 73 20 22 | rases.to.permit.such.things.as." |
| f3a20 | 61 20 63 61 74 20 69 6e 20 74 68 65 20 63 6c 61 73 73 2e 22 20 20 57 68 61 74 20 77 65 20 75 73 | a.cat.in.the.class."..What.we.us |
| f3a40 | 65 64 20 74 6f 0a 63 61 6c 6c 20 61 20 6e 6f 75 6e 20 70 68 72 61 73 65 2c 20 77 65 27 6c 6c 20 | ed.to.call.a.noun.phrase,.we'll. |
| f3a60 | 6e 6f 77 20 63 61 6c 6c 20 61 20 73 69 6d 70 6c 65 20 6e 6f 75 6e 20 70 68 72 61 73 65 2c 20 61 | now.call.a.simple.noun.phrase,.a |
| f3a80 | 6e 64 20 61 20 6e 6f 75 6e 0a 70 68 72 61 73 65 20 77 69 6c 6c 20 6e 6f 77 20 62 65 20 65 69 74 | nd.a.noun.phrase.will.now.be.eit |
| f3aa0 | 68 65 72 20 61 20 73 69 6d 70 6c 65 20 6e 6f 75 6e 20 70 68 72 61 73 65 20 6f 72 20 61 20 6e 6f | her.a.simple.noun.phrase.or.a.no |
| f3ac0 | 75 6e 20 70 68 72 61 73 65 0a 65 78 74 65 6e 64 65 64 20 62 79 20 61 20 70 72 65 70 6f 73 69 74 | un.phrase.extended.by.a.preposit |
| f3ae0 | 69 6f 6e 61 6c 20 70 68 72 61 73 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 | ional.phrase:.......(define.(par |
| f3b00 | 73 65 2d 73 69 6d 70 6c 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 29 0a 20 20 20 20 20 20 20 28 6c | se-simple-noun-phrase)........(l |
| f3b20 | 69 73 74 20 27 73 69 6d 70 6c 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 | ist.'simple-noun-phrase......... |
| f3b40 | 20 20 20 20 20 28 70 61 72 73 65 2d 77 6f 72 64 20 61 72 74 69 63 6c 65 73 29 0a 20 20 20 20 20 | .....(parse-word.articles)...... |
| f3b60 | 20 20 20 20 20 20 20 20 28 70 61 72 73 65 2d 77 6f 72 64 20 6e 6f 75 6e 73 29 29 29 0a 0a 20 20 | ........(parse-word.nouns))).... |
| f3b80 | 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 73 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 29 0a 20 | ...(define.(parse-noun-phrase).. |
| f3ba0 | 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 79 62 65 2d 65 78 74 65 6e 64 20 6e 6f 75 6e | ......(define.(maybe-extend.noun |
| f3bc0 | 2d 70 68 72 61 73 65 29 0a 20 20 20 20 20 20 20 20 20 28 61 6d 62 20 6e 6f 75 6e 2d 70 68 72 61 | -phrase)..........(amb.noun-phra |
| f3be0 | 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 79 62 65 2d 65 78 74 65 6e 64 20 28 | se...............(maybe-extend.( |
| f3c00 | 6c 69 73 74 20 27 6e 6f 75 6e 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | list.'noun-phrase............... |
| f3c20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 6f 75 6e 2d 70 68 72 61 73 65 0a | ....................noun-phrase. |
| f3c40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| f3c60 | 20 20 28 70 61 72 73 65 2d 70 72 65 70 6f 73 69 74 69 6f 6e 61 6c 2d 70 68 72 61 73 65 29 29 29 | ..(parse-prepositional-phrase))) |
| f3c80 | 29 29 0a 20 20 20 20 20 20 20 28 6d 61 79 62 65 2d 65 78 74 65 6e 64 20 28 70 61 72 73 65 2d 73 | ))........(maybe-extend.(parse-s |
| f3ca0 | 69 6d 70 6c 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 29 29 29 0a 0a 20 20 20 4f 75 72 20 6e 65 77 | imple-noun-phrase))).....Our.new |
| f3cc0 | 20 67 72 61 6d 6d 61 72 20 6c 65 74 73 20 75 73 20 70 61 72 73 65 20 6d 6f 72 65 20 63 6f 6d 70 | .grammar.lets.us.parse.more.comp |
| f3ce0 | 6c 65 78 20 73 65 6e 74 65 6e 63 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 0a 0a 20 20 20 | lex.sentences...For.example..... |
| f3d00 | 20 20 28 70 61 72 73 65 20 27 28 74 68 65 20 73 74 75 64 65 6e 74 20 77 69 74 68 20 74 68 65 20 | ..(parse.'(the.student.with.the. |
| f3d20 | 63 61 74 20 73 6c 65 65 70 73 20 69 6e 20 74 68 65 20 63 6c 61 73 73 29 29 0a 0a 70 72 6f 64 75 | cat.sleeps.in.the.class))..produ |
| f3d40 | 63 65 73 0a 0a 20 20 20 20 20 28 73 65 6e 74 65 6e 63 65 0a 20 20 20 20 20 20 28 6e 6f 75 6e 2d | ces.......(sentence.......(noun- |
| f3d60 | 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 28 73 69 6d 70 6c 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 | phrase........(simple-noun-phras |
| f3d80 | 65 20 28 61 72 74 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 6e 20 73 74 75 64 65 6e 74 29 29 0a | e.(article.the).(noun.student)). |
| f3da0 | 20 20 20 20 20 20 20 28 70 72 65 70 2d 70 68 72 61 73 65 20 28 70 72 65 70 20 77 69 74 68 29 0a | .......(prep-phrase.(prep.with). |
| f3dc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 6d 70 6c 65 2d 6e 6f 75 6e | ....................(simple-noun |
| f3de0 | 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 72 | -phrase......................(ar |
| f3e00 | 74 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 6e 20 63 61 74 29 29 29 29 0a 20 20 20 20 20 20 28 | ticle.the).(noun.cat)))).......( |
| f3e20 | 76 65 72 62 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 28 76 65 72 62 20 73 6c 65 65 70 73 29 | verb-phrase........(verb.sleeps) |
| f3e40 | 0a 20 20 20 20 20 20 20 28 70 72 65 70 2d 70 68 72 61 73 65 20 28 70 72 65 70 20 69 6e 29 0a 20 | ........(prep-phrase.(prep.in).. |
| f3e60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 6d 70 6c 65 2d 6e 6f 75 6e 2d | ...................(simple-noun- |
| f3e80 | 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 72 74 | phrase......................(art |
| f3ea0 | 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 6e 20 63 6c 61 73 73 29 29 29 29 29 0a 0a 20 20 20 4f | icle.the).(noun.class))))).....O |
| f3ec0 | 62 73 65 72 76 65 20 74 68 61 74 20 61 20 67 69 76 65 6e 20 69 6e 70 75 74 20 6d 61 79 20 68 61 | bserve.that.a.given.input.may.ha |
| f3ee0 | 76 65 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 6c 65 67 61 6c 20 70 61 72 73 65 2e 20 20 49 | ve.more.than.one.legal.parse...I |
| f3f00 | 6e 0a 74 68 65 20 73 65 6e 74 65 6e 63 65 20 22 54 68 65 20 70 72 6f 66 65 73 73 6f 72 20 6c 65 | n.the.sentence."The.professor.le |
| f3f20 | 63 74 75 72 65 73 20 74 6f 20 74 68 65 20 73 74 75 64 65 6e 74 20 77 69 74 68 20 74 68 65 20 63 | ctures.to.the.student.with.the.c |
| f3f40 | 61 74 2c 22 20 69 74 0a 6d 61 79 20 62 65 20 74 68 61 74 20 74 68 65 20 70 72 6f 66 65 73 73 6f | at,".it.may.be.that.the.professo |
| f3f60 | 72 20 69 73 20 6c 65 63 74 75 72 69 6e 67 20 77 69 74 68 20 74 68 65 20 63 61 74 2c 20 6f 72 20 | r.is.lecturing.with.the.cat,.or. |
| f3f80 | 74 68 61 74 20 74 68 65 0a 73 74 75 64 65 6e 74 20 68 61 73 20 74 68 65 20 63 61 74 2e 20 20 4f | that.the.student.has.the.cat...O |
| f3fa0 | 75 72 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 72 6f 67 72 61 6d 20 66 69 6e 64 | ur.nondeterministic.program.find |
| f3fc0 | 73 20 62 6f 74 68 0a 70 6f 73 73 69 62 69 6c 69 74 69 65 73 3a 0a 0a 20 20 20 20 20 28 70 61 72 | s.both.possibilities:.......(par |
| f3fe0 | 73 65 20 27 28 74 68 65 20 70 72 6f 66 65 73 73 6f 72 20 6c 65 63 74 75 72 65 73 20 74 6f 20 74 | se.'(the.professor.lectures.to.t |
| f4000 | 68 65 20 73 74 75 64 65 6e 74 20 77 69 74 68 20 74 68 65 20 63 61 74 29 29 0a 0a 70 72 6f 64 75 | he.student.with.the.cat))..produ |
| f4020 | 63 65 73 0a 0a 20 20 20 20 20 28 73 65 6e 74 65 6e 63 65 0a 20 20 20 20 20 20 28 73 69 6d 70 6c | ces.......(sentence.......(simpl |
| f4040 | 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 20 28 61 72 74 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 | e-noun-phrase.(article.the).(nou |
| f4060 | 6e 20 70 72 6f 66 65 73 73 6f 72 29 29 0a 20 20 20 20 20 20 28 76 65 72 62 2d 70 68 72 61 73 65 | n.professor)).......(verb-phrase |
| f4080 | 0a 20 20 20 20 20 20 20 28 76 65 72 62 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 28 76 65 | ........(verb-phrase.........(ve |
| f40a0 | 72 62 20 6c 65 63 74 75 72 65 73 29 0a 20 20 20 20 20 20 20 20 28 70 72 65 70 2d 70 68 72 61 73 | rb.lectures).........(prep-phras |
| f40c0 | 65 20 28 70 72 65 70 20 74 6f 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e.(prep.to)..................... |
| f40e0 | 20 28 73 69 6d 70 6c 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 | .(simple-noun-phrase............ |
| f4100 | 20 20 20 20 20 20 20 20 20 20 20 28 61 72 74 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 6e 20 73 | ...........(article.the).(noun.s |
| f4120 | 74 75 64 65 6e 74 29 29 29 29 0a 20 20 20 20 20 20 20 28 70 72 65 70 2d 70 68 72 61 73 65 20 28 | tudent))))........(prep-phrase.( |
| f4140 | 70 72 65 70 20 77 69 74 68 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | prep.with).....................( |
| f4160 | 73 69 6d 70 6c 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | simple-noun-phrase.............. |
| f4180 | 20 20 20 20 20 20 20 20 28 61 72 74 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 6e 20 63 61 74 29 | ........(article.the).(noun.cat) |
| f41a0 | 29 29 29 29 0a 0a 20 20 20 41 73 6b 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 74 6f | )))).....Asking.the.evaluator.to |
| f41c0 | 20 74 72 79 20 61 67 61 69 6e 20 79 69 65 6c 64 73 0a 0a 20 20 20 20 20 28 73 65 6e 74 65 6e 63 | .try.again.yields.......(sentenc |
| f41e0 | 65 0a 20 20 20 20 20 20 28 73 69 6d 70 6c 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 20 28 61 72 74 | e.......(simple-noun-phrase.(art |
| f4200 | 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 6e 20 70 72 6f 66 65 73 73 6f 72 29 29 0a 20 20 20 20 | icle.the).(noun.professor))..... |
| f4220 | 20 20 28 76 65 72 62 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 28 76 65 72 62 20 6c 65 63 74 | ..(verb-phrase........(verb.lect |
| f4240 | 75 72 65 73 29 0a 20 20 20 20 20 20 20 28 70 72 65 70 2d 70 68 72 61 73 65 20 28 70 72 65 70 20 | ures)........(prep-phrase.(prep. |
| f4260 | 74 6f 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 6f 75 6e 2d 70 68 | to).....................(noun-ph |
| f4280 | 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 6d 70 6c | rase......................(simpl |
| f42a0 | 65 2d 6e 6f 75 6e 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e-noun-phrase................... |
| f42c0 | 20 20 20 20 28 61 72 74 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 6e 20 73 74 75 64 65 6e 74 29 | ....(article.the).(noun.student) |
| f42e0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 65 70 2d 70 68 72 | )......................(prep-phr |
| f4300 | 61 73 65 20 28 70 72 65 70 20 77 69 74 68 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ase.(prep.with)................. |
| f4320 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 6d 70 6c 65 2d 6e 6f 75 6e 2d 70 | ..................(simple-noun-p |
| f4340 | 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | hrase........................... |
| f4360 | 20 20 20 20 20 20 20 20 20 28 61 72 74 69 63 6c 65 20 74 68 65 29 20 28 6e 6f 75 6e 20 63 61 74 | .........(article.the).(noun.cat |
| f4380 | 29 29 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 34 35 3a 2a 20 57 | ))))))).......*Exercise.4.45:*.W |
| f43a0 | 69 74 68 20 74 68 65 20 67 72 61 6d 6d 61 72 20 67 69 76 65 6e 20 61 62 6f 76 65 2c 20 74 68 65 | ith.the.grammar.given.above,.the |
| f43c0 | 20 66 6f 6c 6c 6f 77 69 6e 67 0a 20 20 20 20 20 73 65 6e 74 65 6e 63 65 20 63 61 6e 20 62 65 20 | .following......sentence.can.be. |
| f43e0 | 70 61 72 73 65 64 20 69 6e 20 66 69 76 65 20 64 69 66 66 65 72 65 6e 74 20 77 61 79 73 3a 20 22 | parsed.in.five.different.ways:." |
| f4400 | 54 68 65 20 70 72 6f 66 65 73 73 6f 72 0a 20 20 20 20 20 6c 65 63 74 75 72 65 73 20 74 6f 20 74 | The.professor......lectures.to.t |
| f4420 | 68 65 20 73 74 75 64 65 6e 74 20 69 6e 20 74 68 65 20 63 6c 61 73 73 20 77 69 74 68 20 74 68 65 | he.student.in.the.class.with.the |
| f4440 | 20 63 61 74 2e 22 20 20 47 69 76 65 20 74 68 65 20 66 69 76 65 0a 20 20 20 20 20 70 61 72 73 65 | .cat."..Give.the.five......parse |
| f4460 | 73 20 61 6e 64 20 65 78 70 6c 61 69 6e 20 74 68 65 20 64 69 66 66 65 72 65 6e 63 65 73 20 69 6e | s.and.explain.the.differences.in |
| f4480 | 20 73 68 61 64 65 73 20 6f 66 20 6d 65 61 6e 69 6e 67 20 61 6d 6f 6e 67 20 74 68 65 6d 2e 0a 0a | .shades.of.meaning.among.them... |
| f44a0 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 34 36 3a 2a 20 54 68 65 20 65 76 61 6c 75 61 | .....*Exercise.4.46:*.The.evalua |
| f44c0 | 74 6f 72 73 20 69 6e 20 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 20 34 2d 31 3a 3a 20 61 6e 64 | tors.in.sections.*Note.4-1::.and |
| f44e0 | 20 2a 4e 6f 74 65 0a 20 20 20 20 20 34 2d 32 3a 3a 20 64 6f 20 6e 6f 74 20 64 65 74 65 72 6d 69 | .*Note......4-2::.do.not.determi |
| f4500 | 6e 65 20 77 68 61 74 20 6f 72 64 65 72 20 6f 70 65 72 61 6e 64 73 20 61 72 65 20 65 76 61 6c 75 | ne.what.order.operands.are.evalu |
| f4520 | 61 74 65 64 20 69 6e 2e 20 20 57 65 0a 20 20 20 20 20 77 69 6c 6c 20 73 65 65 20 74 68 61 74 20 | ated.in...We......will.see.that. |
| f4540 | 74 68 65 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 20 65 76 61 6c 75 61 74 65 73 20 74 68 | the.`amb'.evaluator.evaluates.th |
| f4560 | 65 6d 20 66 72 6f 6d 20 6c 65 66 74 20 74 6f 0a 20 20 20 20 20 72 69 67 68 74 2e 20 20 45 78 70 | em.from.left.to......right...Exp |
| f4580 | 6c 61 69 6e 20 77 68 79 20 6f 75 72 20 70 61 72 73 69 6e 67 20 70 72 6f 67 72 61 6d 20 77 6f 75 | lain.why.our.parsing.program.wou |
| f45a0 | 6c 64 6e 27 74 20 77 6f 72 6b 20 69 66 20 74 68 65 0a 20 20 20 20 20 6f 70 65 72 61 6e 64 73 20 | ldn't.work.if.the......operands. |
| f45c0 | 77 65 72 65 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 73 6f 6d 65 20 6f 74 68 65 72 20 6f 72 64 | were.evaluated.in.some.other.ord |
| f45e0 | 65 72 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 34 37 3a 2a 20 4c 6f 75 69 73 | er........*Exercise.4.47:*.Louis |
| f4600 | 20 52 65 61 73 6f 6e 65 72 20 73 75 67 67 65 73 74 73 20 74 68 61 74 2c 20 73 69 6e 63 65 20 61 | .Reasoner.suggests.that,.since.a |
| f4620 | 20 76 65 72 62 20 70 68 72 61 73 65 0a 20 20 20 20 20 69 73 20 65 69 74 68 65 72 20 61 20 76 65 | .verb.phrase......is.either.a.ve |
| f4640 | 72 62 20 6f 72 20 61 20 76 65 72 62 20 70 68 72 61 73 65 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 | rb.or.a.verb.phrase.followed.by. |
| f4660 | 61 20 70 72 65 70 6f 73 69 74 69 6f 6e 61 6c 0a 20 20 20 20 20 70 68 72 61 73 65 2c 20 69 74 20 | a.prepositional......phrase,.it. |
| f4680 | 77 6f 75 6c 64 20 62 65 20 6d 75 63 68 20 6d 6f 72 65 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 | would.be.much.more.straightforwa |
| f46a0 | 72 64 20 74 6f 20 64 65 66 69 6e 65 20 74 68 65 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 | rd.to.define.the......procedure. |
| f46c0 | 60 70 61 72 73 65 2d 76 65 72 62 2d 70 68 72 61 73 65 27 20 61 73 20 66 6f 6c 6c 6f 77 73 20 28 | `parse-verb-phrase'.as.follows.( |
| f46e0 | 61 6e 64 20 73 69 6d 69 6c 61 72 6c 79 20 66 6f 72 20 6e 6f 75 6e 0a 20 20 20 20 20 70 68 72 61 | and.similarly.for.noun......phra |
| f4700 | 73 65 73 29 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 61 72 73 65 2d | ses):............(define.(parse- |
| f4720 | 76 65 72 62 2d 70 68 72 61 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 6d 62 20 28 70 | verb-phrase).............(amb.(p |
| f4740 | 61 72 73 65 2d 77 6f 72 64 20 76 65 72 62 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | arse-word.verbs)................ |
| f4760 | 20 20 28 6c 69 73 74 20 27 76 65 72 62 2d 70 68 72 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 | ..(list.'verb-phrase............ |
| f4780 | 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 72 73 65 2d 76 65 72 62 2d 70 68 72 61 73 65 29 0a | ............(parse-verb-phrase). |
| f47a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 72 73 65 2d 70 72 | .......................(parse-pr |
| f47c0 | 65 70 6f 73 69 74 69 6f 6e 61 6c 2d 70 68 72 61 73 65 29 29 29 29 0a 0a 20 20 20 20 20 44 6f 65 | epositional-phrase)))).......Doe |
| f47e0 | 73 20 74 68 69 73 20 77 6f 72 6b 3f 20 20 44 6f 65 73 20 74 68 65 20 70 72 6f 67 72 61 6d 27 73 | s.this.work?..Does.the.program's |
| f4800 | 20 62 65 68 61 76 69 6f 72 20 63 68 61 6e 67 65 20 69 66 20 77 65 0a 20 20 20 20 20 69 6e 74 65 | .behavior.change.if.we......inte |
| f4820 | 72 63 68 61 6e 67 65 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 | rchange.the.order.of.expressions |
| f4840 | 20 69 6e 20 74 68 65 20 60 61 6d 62 27 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e | .in.the.`amb'.......*Exercise.4. |
| f4860 | 34 38 3a 2a 20 45 78 74 65 6e 64 20 74 68 65 20 67 72 61 6d 6d 61 72 20 67 69 76 65 6e 20 61 62 | 48:*.Extend.the.grammar.given.ab |
| f4880 | 6f 76 65 20 74 6f 20 68 61 6e 64 6c 65 20 6d 6f 72 65 0a 20 20 20 20 20 63 6f 6d 70 6c 65 78 20 | ove.to.handle.more......complex. |
| f48a0 | 73 65 6e 74 65 6e 63 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 79 6f 75 20 63 6f 75 | sentences...For.example,.you.cou |
| f48c0 | 6c 64 20 65 78 74 65 6e 64 20 6e 6f 75 6e 20 70 68 72 61 73 65 73 20 61 6e 64 0a 20 20 20 20 20 | ld.extend.noun.phrases.and...... |
| f48e0 | 76 65 72 62 20 70 68 72 61 73 65 73 20 74 6f 20 69 6e 63 6c 75 64 65 20 61 64 6a 65 63 74 69 76 | verb.phrases.to.include.adjectiv |
| f4900 | 65 73 20 61 6e 64 20 61 64 76 65 72 62 73 2c 20 6f 72 20 79 6f 75 20 63 6f 75 6c 64 0a 20 20 20 | es.and.adverbs,.or.you.could.... |
| f4920 | 20 20 68 61 6e 64 6c 65 20 63 6f 6d 70 6f 75 6e 64 20 73 65 6e 74 65 6e 63 65 73 2e 28 36 29 0a | ..handle.compound.sentences.(6). |
| f4940 | 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 34 39 3a 2a 20 41 6c 79 73 73 61 20 50 2e | ......*Exercise.4.49:*.Alyssa.P. |
| f4960 | 20 48 61 63 6b 65 72 20 69 73 20 6d 6f 72 65 20 69 6e 74 65 72 65 73 74 65 64 20 69 6e 20 67 65 | .Hacker.is.more.interested.in.ge |
| f4980 | 6e 65 72 61 74 69 6e 67 0a 20 20 20 20 20 69 6e 74 65 72 65 73 74 69 6e 67 20 73 65 6e 74 65 6e | nerating......interesting.senten |
| f49a0 | 63 65 73 20 74 68 61 6e 20 69 6e 20 70 61 72 73 69 6e 67 20 74 68 65 6d 2e 20 20 53 68 65 20 72 | ces.than.in.parsing.them...She.r |
| f49c0 | 65 61 73 6f 6e 73 20 74 68 61 74 20 62 79 0a 20 20 20 20 20 73 69 6d 70 6c 79 20 63 68 61 6e 67 | easons.that.by......simply.chang |
| f49e0 | 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 70 61 72 73 65 2d 77 6f 72 64 27 20 73 | ing.the.procedure.`parse-word'.s |
| f4a00 | 6f 20 74 68 61 74 20 69 74 20 69 67 6e 6f 72 65 73 20 74 68 65 0a 20 20 20 20 20 22 69 6e 70 75 | o.that.it.ignores.the......"inpu |
| f4a20 | 74 20 73 65 6e 74 65 6e 63 65 22 20 61 6e 64 20 69 6e 73 74 65 61 64 20 61 6c 77 61 79 73 20 73 | t.sentence".and.instead.always.s |
| f4a40 | 75 63 63 65 65 64 73 20 61 6e 64 20 67 65 6e 65 72 61 74 65 73 20 61 6e 0a 20 20 20 20 20 61 70 | ucceeds.and.generates.an......ap |
| f4a60 | 70 72 6f 70 72 69 61 74 65 20 77 6f 72 64 2c 20 77 65 20 63 61 6e 20 75 73 65 20 74 68 65 20 70 | propriate.word,.we.can.use.the.p |
| f4a80 | 72 6f 67 72 61 6d 73 20 77 65 20 68 61 64 20 62 75 69 6c 74 20 66 6f 72 20 70 61 72 73 69 6e 67 | rograms.we.had.built.for.parsing |
| f4aa0 | 0a 20 20 20 20 20 74 6f 20 64 6f 20 67 65 6e 65 72 61 74 69 6f 6e 20 69 6e 73 74 65 61 64 2e 20 | ......to.do.generation.instead.. |
| f4ac0 | 20 49 6d 70 6c 65 6d 65 6e 74 20 41 6c 79 73 73 61 27 73 20 69 64 65 61 2c 20 61 6e 64 20 73 68 | .Implement.Alyssa's.idea,.and.sh |
| f4ae0 | 6f 77 20 74 68 65 0a 20 20 20 20 20 66 69 72 73 74 20 68 61 6c 66 2d 64 6f 7a 65 6e 20 6f 72 20 | ow.the......first.half-dozen.or. |
| f4b00 | 73 6f 20 73 65 6e 74 65 6e 63 65 73 20 67 65 6e 65 72 61 74 65 64 2e 28 37 29 0a 0a 20 20 20 2d | so.sentences.generated.(7).....- |
| f4b20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a | ---------.Footnotes.----------.. |
| f4b40 | 20 20 20 28 31 29 20 4f 75 72 20 70 72 6f 67 72 61 6d 20 75 73 65 73 20 74 68 65 20 66 6f 6c 6c | ...(1).Our.program.uses.the.foll |
| f4b60 | 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 69 66 20 | owing.procedure.to.determine.if. |
| f4b80 | 74 68 65 0a 65 6c 65 6d 65 6e 74 73 20 6f 66 20 61 20 6c 69 73 74 20 61 72 65 20 64 69 73 74 69 | the.elements.of.a.list.are.disti |
| f4ba0 | 6e 63 74 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 74 69 6e 63 74 3f 20 69 74 | nct:.......(define.(distinct?.it |
| f4bc0 | 65 6d 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 69 74 65 6d 73 29 | ems)........(cond.((null?.items) |
| f4be0 | 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e 75 6c 6c 3f 20 28 63 64 72 | .true)..............((null?.(cdr |
| f4c00 | 20 69 74 65 6d 73 29 29 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6d 65 | .items)).true)..............((me |
| f4c20 | 6d 62 65 72 20 28 63 61 72 20 69 74 65 6d 73 29 20 28 63 64 72 20 69 74 65 6d 73 29 29 20 66 61 | mber.(car.items).(cdr.items)).fa |
| f4c40 | 6c 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 64 69 73 74 69 6e 63 | lse)..............(else.(distinc |
| f4c60 | 74 3f 20 28 63 64 72 20 69 74 65 6d 73 29 29 29 29 29 0a 0a 20 20 20 60 4d 65 6d 62 65 72 27 20 | t?.(cdr.items))))).....`Member'. |
| f4c80 | 69 73 20 6c 69 6b 65 20 60 6d 65 6d 71 27 20 65 78 63 65 70 74 20 74 68 61 74 20 69 74 20 75 73 | is.like.`memq'.except.that.it.us |
| f4ca0 | 65 73 20 60 65 71 75 61 6c 3f 27 20 69 6e 73 74 65 61 64 20 6f 66 0a 60 65 71 3f 27 20 74 6f 20 | es.`equal?'.instead.of.`eq?'.to. |
| f4cc0 | 74 65 73 74 20 66 6f 72 20 65 71 75 61 6c 69 74 79 2e 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 | test.for.equality......(2).This. |
| f4ce0 | 69 73 20 74 61 6b 65 6e 20 66 72 6f 6d 20 61 20 62 6f 6f 6b 6c 65 74 20 63 61 6c 6c 65 64 20 22 | is.taken.from.a.booklet.called." |
| f4d00 | 50 72 6f 62 6c 65 6d 61 74 69 63 61 6c 20 52 65 63 72 65 61 74 69 6f 6e 73 2c 22 0a 70 75 62 6c | Problematical.Recreations,".publ |
| f4d20 | 69 73 68 65 64 20 69 6e 20 74 68 65 20 31 39 36 30 73 20 62 79 20 4c 69 74 74 6f 6e 20 49 6e 64 | ished.in.the.1960s.by.Litton.Ind |
| f4d40 | 75 73 74 72 69 65 73 2c 20 77 68 65 72 65 20 69 74 20 69 73 20 61 74 74 72 69 62 75 74 65 64 20 | ustries,.where.it.is.attributed. |
| f4d60 | 74 6f 0a 74 68 65 20 60 4b 61 6e 73 61 73 20 53 74 61 74 65 20 45 6e 67 69 6e 65 65 72 27 2e 0a | to.the.`Kansas.State.Engineer'.. |
| f4d80 | 0a 20 20 20 28 33 29 20 48 65 72 65 20 77 65 20 75 73 65 20 74 68 65 20 63 6f 6e 76 65 6e 74 69 | ....(3).Here.we.use.the.conventi |
| f4da0 | 6f 6e 20 74 68 61 74 20 74 68 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 65 61 63 | on.that.the.first.element.of.eac |
| f4dc0 | 68 20 6c 69 73 74 0a 64 65 73 69 67 6e 61 74 65 73 20 74 68 65 20 70 61 72 74 20 6f 66 20 73 70 | h.list.designates.the.part.of.sp |
| f4de0 | 65 65 63 68 20 66 6f 72 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 77 6f 72 64 73 20 69 | eech.for.the.rest.of.the.words.i |
| f4e00 | 6e 20 74 68 65 20 6c 69 73 74 2e 0a 0a 20 20 20 28 34 29 20 4e 6f 74 69 63 65 20 74 68 61 74 20 | n.the.list......(4).Notice.that. |
| f4e20 | 60 70 61 72 73 65 2d 77 6f 72 64 27 20 75 73 65 73 20 60 73 65 74 21 27 20 74 6f 20 6d 6f 64 69 | `parse-word'.uses.`set!'.to.modi |
| f4e40 | 66 79 20 74 68 65 20 75 6e 70 61 72 73 65 64 0a 69 6e 70 75 74 20 6c 69 73 74 2e 20 20 46 6f 72 | fy.the.unparsed.input.list...For |
| f4e60 | 20 74 68 69 73 20 74 6f 20 77 6f 72 6b 2c 20 6f 75 72 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 | .this.to.work,.our.`amb'.evaluat |
| f4e80 | 6f 72 20 6d 75 73 74 20 75 6e 64 6f 20 74 68 65 0a 65 66 66 65 63 74 73 20 6f 66 20 60 73 65 74 | or.must.undo.the.effects.of.`set |
| f4ea0 | 21 27 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 68 65 6e 20 69 74 20 62 61 63 6b 74 72 61 63 6b 73 | !'.operations.when.it.backtracks |
| f4ec0 | 2e 0a 0a 20 20 20 28 35 29 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 74 68 69 73 20 64 65 66 69 | ......(5).Observe.that.this.defi |
| f4ee0 | 6e 69 74 69 6f 6e 20 69 73 20 72 65 63 75 72 73 69 76 65 2d 2d 61 20 76 65 72 62 20 6d 61 79 20 | nition.is.recursive--a.verb.may. |
| f4f00 | 62 65 0a 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 6e 79 20 6e 75 6d 62 65 72 20 6f 66 20 70 72 65 | be.followed.by.any.number.of.pre |
| f4f20 | 70 6f 73 69 74 69 6f 6e 61 6c 20 70 68 72 61 73 65 73 2e 0a 0a 20 20 20 28 36 29 20 54 68 69 73 | positional.phrases......(6).This |
| f4f40 | 20 6b 69 6e 64 20 6f 66 20 67 72 61 6d 6d 61 72 20 63 61 6e 20 62 65 63 6f 6d 65 20 61 72 62 69 | .kind.of.grammar.can.become.arbi |
| f4f60 | 74 72 61 72 69 6c 79 20 63 6f 6d 70 6c 65 78 2c 20 62 75 74 20 69 74 20 69 73 0a 6f 6e 6c 79 20 | trarily.complex,.but.it.is.only. |
| f4f80 | 61 20 74 6f 79 20 61 73 20 66 61 72 20 61 73 20 72 65 61 6c 20 6c 61 6e 67 75 61 67 65 20 75 6e | a.toy.as.far.as.real.language.un |
| f4fa0 | 64 65 72 73 74 61 6e 64 69 6e 67 20 69 73 20 63 6f 6e 63 65 72 6e 65 64 2e 20 20 52 65 61 6c 0a | derstanding.is.concerned...Real. |
| f4fc0 | 6e 61 74 75 72 61 6c 2d 6c 61 6e 67 75 61 67 65 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 62 | natural-language.understanding.b |
| f4fe0 | 79 20 63 6f 6d 70 75 74 65 72 20 72 65 71 75 69 72 65 73 20 61 6e 20 65 6c 61 62 6f 72 61 74 65 | y.computer.requires.an.elaborate |
| f5000 | 0a 6d 69 78 74 75 72 65 20 6f 66 20 73 79 6e 74 61 63 74 69 63 20 61 6e 61 6c 79 73 69 73 20 61 | .mixture.of.syntactic.analysis.a |
| f5020 | 6e 64 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 6d 65 61 6e 69 6e 67 2e 20 20 4f | nd.interpretation.of.meaning...O |
| f5040 | 6e 20 74 68 65 0a 6f 74 68 65 72 20 68 61 6e 64 2c 20 65 76 65 6e 20 74 6f 79 20 70 61 72 73 65 | n.the.other.hand,.even.toy.parse |
| f5060 | 72 73 20 63 61 6e 20 62 65 20 75 73 65 66 75 6c 20 69 6e 20 73 75 70 70 6f 72 74 69 6e 67 20 66 | rs.can.be.useful.in.supporting.f |
| f5080 | 6c 65 78 69 62 6c 65 0a 63 6f 6d 6d 61 6e 64 20 6c 61 6e 67 75 61 67 65 73 20 66 6f 72 20 70 72 | lexible.command.languages.for.pr |
| f50a0 | 6f 67 72 61 6d 73 20 73 75 63 68 20 61 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2d 72 65 74 72 69 | ograms.such.as.information-retri |
| f50c0 | 65 76 61 6c 20 73 79 73 74 65 6d 73 2e 0a 57 69 6e 73 74 6f 6e 20 31 39 39 32 20 64 69 73 63 75 | eval.systems..Winston.1992.discu |
| f50e0 | 73 73 65 73 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 61 70 70 72 6f 61 63 68 65 73 20 74 6f | sses.computational.approaches.to |
| f5100 | 20 72 65 61 6c 20 6c 61 6e 67 75 61 67 65 0a 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 61 6e 64 | .real.language.understanding.and |
| f5120 | 20 61 6c 73 6f 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 6f 66 20 73 69 6d 70 6c 65 | .also.the.applications.of.simple |
| f5140 | 20 67 72 61 6d 6d 61 72 73 20 74 6f 20 63 6f 6d 6d 61 6e 64 0a 6c 61 6e 67 75 61 67 65 73 2e 0a | .grammars.to.command.languages.. |
| f5160 | 0a 20 20 20 28 37 29 20 41 6c 74 68 6f 75 67 68 20 41 6c 79 73 73 61 27 73 20 69 64 65 61 20 77 | ....(7).Although.Alyssa's.idea.w |
| f5180 | 6f 72 6b 73 20 6a 75 73 74 20 66 69 6e 65 20 28 61 6e 64 20 69 73 20 73 75 72 70 72 69 73 69 6e | orks.just.fine.(and.is.surprisin |
| f51a0 | 67 6c 79 0a 73 69 6d 70 6c 65 29 2c 20 74 68 65 20 73 65 6e 74 65 6e 63 65 73 20 74 68 61 74 20 | gly.simple),.the.sentences.that. |
| f51c0 | 69 74 20 67 65 6e 65 72 61 74 65 73 20 61 72 65 20 61 20 62 69 74 20 62 6f 72 69 6e 67 2d 2d 74 | it.generates.are.a.bit.boring--t |
| f51e0 | 68 65 79 20 64 6f 6e 27 74 0a 73 61 6d 70 6c 65 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20 73 65 | hey.don't.sample.the.possible.se |
| f5200 | 6e 74 65 6e 63 65 73 20 6f 66 20 74 68 69 73 20 6c 61 6e 67 75 61 67 65 20 69 6e 20 61 20 76 65 | ntences.of.this.language.in.a.ve |
| f5220 | 72 79 20 69 6e 74 65 72 65 73 74 69 6e 67 0a 77 61 79 2e 20 20 49 6e 20 66 61 63 74 2c 20 74 68 | ry.interesting.way...In.fact,.th |
| f5240 | 65 20 67 72 61 6d 6d 61 72 20 69 73 20 68 69 67 68 6c 79 20 72 65 63 75 72 73 69 76 65 20 69 6e | e.grammar.is.highly.recursive.in |
| f5260 | 20 6d 61 6e 79 20 70 6c 61 63 65 73 2c 20 61 6e 64 0a 41 6c 79 73 73 61 27 73 20 74 65 63 68 6e | .many.places,.and.Alyssa's.techn |
| f5280 | 69 71 75 65 20 22 66 61 6c 6c 73 20 69 6e 74 6f 22 20 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 72 | ique."falls.into".one.of.these.r |
| f52a0 | 65 63 75 72 73 69 6f 6e 73 20 61 6e 64 20 67 65 74 73 20 73 74 75 63 6b 2e 0a 53 65 65 20 2a 4e | ecursions.and.gets.stuck..See.*N |
| f52c0 | 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 35 30 3a 3a 20 66 6f 72 20 61 20 77 61 79 20 74 6f | ote.Exercise.4-50::.for.a.way.to |
| f52e0 | 20 64 65 61 6c 20 77 69 74 68 20 74 68 69 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 | .deal.with.this.....File:.sicp.i |
| f5300 | 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 33 2d 33 2c 20 20 50 72 65 76 3a 20 34 2d 33 2d 32 2c | nfo,..Node:.4-3-3,..Prev:.4-3-2, |
| f5320 | 20 20 55 70 3a 20 34 2d 33 0a 0a 34 2e 33 2e 33 20 49 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 | ..Up:.4-3..4.3.3.Implementing.th |
| f5340 | 65 20 60 41 6d 62 27 20 45 76 61 6c 75 61 74 6f 72 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | e.`Amb'.Evaluator.-------------- |
| f5360 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 65 76 | ------------------------..The.ev |
| f5380 | 61 6c 75 61 74 69 6f 6e 20 6f 66 20 61 6e 20 6f 72 64 69 6e 61 72 79 20 53 63 68 65 6d 65 20 65 | aluation.of.an.ordinary.Scheme.e |
| f53a0 | 78 70 72 65 73 73 69 6f 6e 20 6d 61 79 20 72 65 74 75 72 6e 20 61 20 76 61 6c 75 65 2c 20 6d 61 | xpression.may.return.a.value,.ma |
| f53c0 | 79 0a 6e 65 76 65 72 20 74 65 72 6d 69 6e 61 74 65 2c 20 6f 72 20 6d 61 79 20 73 69 67 6e 61 6c | y.never.terminate,.or.may.signal |
| f53e0 | 20 61 6e 20 65 72 72 6f 72 2e 20 20 49 6e 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 | .an.error...In.nondeterministic. |
| f5400 | 53 63 68 65 6d 65 0a 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 61 6e 20 65 78 70 72 | Scheme.the.evaluation.of.an.expr |
| f5420 | 65 73 73 69 6f 6e 20 6d 61 79 20 69 6e 20 61 64 64 69 74 69 6f 6e 20 72 65 73 75 6c 74 20 69 6e | ession.may.in.addition.result.in |
| f5440 | 20 74 68 65 20 64 69 73 63 6f 76 65 72 79 0a 6f 66 20 61 20 64 65 61 64 20 65 6e 64 2c 20 69 6e | .the.discovery.of.a.dead.end,.in |
| f5460 | 20 77 68 69 63 68 20 63 61 73 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6d 75 73 74 20 62 61 63 6b | .which.case.evaluation.must.back |
| f5480 | 74 72 61 63 6b 20 74 6f 20 61 20 70 72 65 76 69 6f 75 73 0a 63 68 6f 69 63 65 20 70 6f 69 6e 74 | track.to.a.previous.choice.point |
| f54a0 | 2e 20 20 54 68 65 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 6e 6f 6e 64 65 74 65 | ...The.interpretation.of.nondete |
| f54c0 | 72 6d 69 6e 69 73 74 69 63 20 53 63 68 65 6d 65 20 69 73 0a 63 6f 6d 70 6c 69 63 61 74 65 64 20 | rministic.Scheme.is.complicated. |
| f54e0 | 62 79 20 74 68 69 73 20 65 78 74 72 61 20 63 61 73 65 2e 0a 0a 20 20 20 57 65 20 77 69 6c 6c 20 | by.this.extra.case......We.will. |
| f5500 | 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 20 66 6f | construct.the.`amb'.evaluator.fo |
| f5520 | 72 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 53 63 68 65 6d 65 20 62 79 0a 6d 6f 64 | r.nondeterministic.Scheme.by.mod |
| f5540 | 69 66 79 69 6e 67 20 74 68 65 20 61 6e 61 6c 79 7a 69 6e 67 20 65 76 61 6c 75 61 74 6f 72 20 6f | ifying.the.analyzing.evaluator.o |
| f5560 | 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 37 3a 3a 2e 28 31 29 20 20 41 73 20 | f.section.*Note.4-1-7::.(1)..As. |
| f5580 | 69 6e 0a 74 68 65 20 61 6e 61 6c 79 7a 69 6e 67 20 65 76 61 6c 75 61 74 6f 72 2c 20 65 76 61 6c | in.the.analyzing.evaluator,.eval |
| f55a0 | 75 61 74 69 6f 6e 20 6f 66 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 61 63 63 6f 6d | uation.of.an.expression.is.accom |
| f55c0 | 70 6c 69 73 68 65 64 20 62 79 0a 63 61 6c 6c 69 6e 67 20 61 6e 20 65 78 65 63 75 74 69 6f 6e 20 | plished.by.calling.an.execution. |
| f55e0 | 70 72 6f 63 65 64 75 72 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 61 6e 61 6c 79 73 69 73 20 6f | procedure.produced.by.analysis.o |
| f5600 | 66 20 74 68 61 74 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 54 68 65 20 64 69 66 66 65 72 65 6e 63 | f.that.expression..The.differenc |
| f5620 | 65 20 62 65 74 77 65 65 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 | e.between.the.interpretation.of. |
| f5640 | 6f 72 64 69 6e 61 72 79 20 53 63 68 65 6d 65 20 61 6e 64 20 74 68 65 0a 69 6e 74 65 72 70 72 65 | ordinary.Scheme.and.the.interpre |
| f5660 | 74 61 74 69 6f 6e 20 6f 66 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 53 63 68 65 6d | tation.of.nondeterministic.Schem |
| f5680 | 65 20 77 69 6c 6c 20 62 65 20 65 6e 74 69 72 65 6c 79 20 69 6e 20 74 68 65 0a 65 78 65 63 75 74 | e.will.be.entirely.in.the.execut |
| f56a0 | 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 2e 0a 0a 45 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 | ion.procedures...Execution.proce |
| f56c0 | 64 75 72 65 73 20 61 6e 64 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e | dures.and.continuations......... |
| f56e0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | ................................ |
| f5700 | 52 65 63 61 6c 6c 20 74 68 61 74 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 | Recall.that.the.execution.proced |
| f5720 | 75 72 65 73 20 66 6f 72 20 74 68 65 20 6f 72 64 69 6e 61 72 79 20 65 76 61 6c 75 61 74 6f 72 20 | ures.for.the.ordinary.evaluator. |
| f5740 | 74 61 6b 65 20 6f 6e 65 0a 61 72 67 75 6d 65 6e 74 3a 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 | take.one.argument:.the.environme |
| f5760 | 6e 74 20 6f 66 20 65 78 65 63 75 74 69 6f 6e 2e 20 20 49 6e 20 63 6f 6e 74 72 61 73 74 2c 20 74 | nt.of.execution...In.contrast,.t |
| f5780 | 68 65 20 65 78 65 63 75 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 65 20 60 | he.execution.procedures.in.the.` |
| f57a0 | 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 20 74 61 6b 65 20 74 68 72 65 65 20 61 72 67 75 6d 65 | amb'.evaluator.take.three.argume |
| f57c0 | 6e 74 73 3a 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 61 6e 64 20 74 77 6f 20 70 72 | nts:.the.environment,.and.two.pr |
| f57e0 | 6f 63 65 64 75 72 65 73 20 63 61 6c 6c 65 64 20 22 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 70 72 | ocedures.called."continuation.pr |
| f5800 | 6f 63 65 64 75 72 65 73 22 2e 20 20 54 68 65 0a 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 61 6e | ocedures"...The.evaluation.of.an |
| f5820 | 20 65 78 70 72 65 73 73 69 6f 6e 20 77 69 6c 6c 20 66 69 6e 69 73 68 20 62 79 20 63 61 6c 6c 69 | .expression.will.finish.by.calli |
| f5840 | 6e 67 20 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 74 77 6f 0a 63 6f 6e 74 69 6e 75 61 74 69 6f 6e | ng.one.of.these.two.continuation |
| f5860 | 73 3a 20 49 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 65 73 75 6c 74 73 20 69 6e 20 | s:.If.the.evaluation.results.in. |
| f5880 | 61 20 76 61 6c 75 65 2c 20 74 68 65 20 22 73 75 63 63 65 73 73 0a 63 6f 6e 74 69 6e 75 61 74 69 | a.value,.the."success.continuati |
| f58a0 | 6f 6e 22 20 69 73 20 63 61 6c 6c 65 64 20 77 69 74 68 20 74 68 61 74 20 76 61 6c 75 65 3b 20 69 | on".is.called.with.that.value;.i |
| f58c0 | 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 72 65 73 75 6c 74 73 20 69 6e 0a 74 68 65 20 | f.the.evaluation.results.in.the. |
| f58e0 | 64 69 73 63 6f 76 65 72 79 20 6f 66 20 61 20 64 65 61 64 20 65 6e 64 2c 20 74 68 65 20 22 66 61 | discovery.of.a.dead.end,.the."fa |
| f5900 | 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 22 20 69 73 20 63 61 6c 6c 65 64 2e 0a 43 | ilure.continuation".is.called..C |
| f5920 | 6f 6e 73 74 72 75 63 74 69 6e 67 20 61 6e 64 20 63 61 6c 6c 69 6e 67 20 61 70 70 72 6f 70 72 69 | onstructing.and.calling.appropri |
| f5940 | 61 74 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 73 20 69 73 20 74 68 65 20 6d 65 63 68 61 6e 69 | ate.continuations.is.the.mechani |
| f5960 | 73 6d 20 62 79 0a 77 68 69 63 68 20 74 68 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 | sm.by.which.the.nondeterministic |
| f5980 | 20 65 76 61 6c 75 61 74 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 73 20 62 61 63 6b 74 72 61 63 6b 69 | .evaluator.implements.backtracki |
| f59a0 | 6e 67 2e 0a 0a 20 20 20 49 74 20 69 73 20 74 68 65 20 6a 6f 62 20 6f 66 20 74 68 65 20 73 75 63 | ng......It.is.the.job.of.the.suc |
| f59c0 | 63 65 73 73 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 74 6f 20 72 65 63 65 69 76 65 20 61 20 76 | cess.continuation.to.receive.a.v |
| f59e0 | 61 6c 75 65 20 61 6e 64 0a 70 72 6f 63 65 65 64 20 77 69 74 68 20 74 68 65 20 63 6f 6d 70 75 74 | alue.and.proceed.with.the.comput |
| f5a00 | 61 74 69 6f 6e 2e 20 20 41 6c 6f 6e 67 20 77 69 74 68 20 74 68 61 74 20 76 61 6c 75 65 2c 20 74 | ation...Along.with.that.value,.t |
| f5a20 | 68 65 20 73 75 63 63 65 73 73 0a 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 69 73 20 70 61 73 73 65 | he.success.continuation.is.passe |
| f5a40 | 64 20 61 6e 6f 74 68 65 72 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 2c 20 | d.another.failure.continuation,. |
| f5a60 | 77 68 69 63 68 20 69 73 20 74 6f 20 62 65 0a 63 61 6c 6c 65 64 20 73 75 62 73 65 71 75 65 6e 74 | which.is.to.be.called.subsequent |
| f5a80 | 6c 79 20 69 66 20 74 68 65 20 75 73 65 20 6f 66 20 74 68 61 74 20 76 61 6c 75 65 20 6c 65 61 64 | ly.if.the.use.of.that.value.lead |
| f5aa0 | 73 20 74 6f 20 61 20 64 65 61 64 20 65 6e 64 2e 0a 0a 20 20 20 49 74 20 69 73 20 74 68 65 20 6a | s.to.a.dead.end......It.is.the.j |
| f5ac0 | 6f 62 20 6f 66 20 74 68 65 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 74 | ob.of.the.failure.continuation.t |
| f5ae0 | 6f 20 74 72 79 20 61 6e 6f 74 68 65 72 20 62 72 61 6e 63 68 20 6f 66 0a 74 68 65 20 6e 6f 6e 64 | o.try.another.branch.of.the.nond |
| f5b00 | 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 72 6f 63 65 73 73 2e 20 20 54 68 65 20 65 73 73 65 6e | eterministic.process...The.essen |
| f5b20 | 63 65 20 6f 66 20 74 68 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 0a 6c 61 6e 67 75 | ce.of.the.nondeterministic.langu |
| f5b40 | 61 67 65 20 69 73 20 69 6e 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 65 78 70 72 65 73 73 69 | age.is.in.the.fact.that.expressi |
| f5b60 | 6f 6e 73 20 6d 61 79 20 72 65 70 72 65 73 65 6e 74 20 63 68 6f 69 63 65 73 20 61 6d 6f 6e 67 0a | ons.may.represent.choices.among. |
| f5b80 | 61 6c 74 65 72 6e 61 74 69 76 65 73 2e 20 20 54 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 | alternatives...The.evaluation.of |
| f5ba0 | 20 73 75 63 68 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 6d 75 73 74 20 70 72 6f 63 65 65 64 | .such.an.expression.must.proceed |
| f5bc0 | 20 77 69 74 68 0a 6f 6e 65 20 6f 66 20 74 68 65 20 69 6e 64 69 63 61 74 65 64 20 61 6c 74 65 72 | .with.one.of.the.indicated.alter |
| f5be0 | 6e 61 74 69 76 65 20 63 68 6f 69 63 65 73 2c 20 65 76 65 6e 20 74 68 6f 75 67 68 20 69 74 20 69 | native.choices,.even.though.it.i |
| f5c00 | 73 20 6e 6f 74 20 6b 6e 6f 77 6e 0a 69 6e 20 61 64 76 61 6e 63 65 20 77 68 69 63 68 20 63 68 6f | s.not.known.in.advance.which.cho |
| f5c20 | 69 63 65 73 20 77 69 6c 6c 20 6c 65 61 64 20 74 6f 20 61 63 63 65 70 74 61 62 6c 65 20 72 65 73 | ices.will.lead.to.acceptable.res |
| f5c40 | 75 6c 74 73 2e 20 20 54 6f 20 64 65 61 6c 20 77 69 74 68 0a 74 68 69 73 2c 20 74 68 65 20 65 76 | ults...To.deal.with.this,.the.ev |
| f5c60 | 61 6c 75 61 74 6f 72 20 70 69 63 6b 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 61 6c 74 65 72 6e 61 | aluator.picks.one.of.the.alterna |
| f5c80 | 74 69 76 65 73 20 61 6e 64 20 70 61 73 73 65 73 20 74 68 69 73 20 76 61 6c 75 65 0a 74 6f 20 74 | tives.and.passes.this.value.to.t |
| f5ca0 | 68 65 20 73 75 63 63 65 73 73 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 2e 20 20 54 6f 67 65 74 68 | he.success.continuation...Togeth |
| f5cc0 | 65 72 20 77 69 74 68 20 74 68 69 73 20 76 61 6c 75 65 2c 20 74 68 65 20 65 76 61 6c 75 61 74 6f | er.with.this.value,.the.evaluato |
| f5ce0 | 72 0a 63 6f 6e 73 74 72 75 63 74 73 20 61 6e 64 20 70 61 73 73 65 73 20 61 6c 6f 6e 67 20 61 20 | r.constructs.and.passes.along.a. |
| f5d00 | 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 74 68 61 74 20 63 61 6e 20 62 65 | failure.continuation.that.can.be |
| f5d20 | 20 63 61 6c 6c 65 64 0a 6c 61 74 65 72 20 74 6f 20 63 68 6f 6f 73 65 20 61 20 64 69 66 66 65 72 | .called.later.to.choose.a.differ |
| f5d40 | 65 6e 74 20 61 6c 74 65 72 6e 61 74 69 76 65 2e 0a 0a 20 20 20 41 20 66 61 69 6c 75 72 65 20 69 | ent.alternative......A.failure.i |
| f5d60 | 73 20 74 72 69 67 67 65 72 65 64 20 64 75 72 69 6e 67 20 65 76 61 6c 75 61 74 69 6f 6e 20 28 74 | s.triggered.during.evaluation.(t |
| f5d80 | 68 61 74 20 69 73 2c 20 61 20 66 61 69 6c 75 72 65 0a 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 69 | hat.is,.a.failure.continuation.i |
| f5da0 | 73 20 63 61 6c 6c 65 64 29 20 77 68 65 6e 20 61 20 75 73 65 72 20 70 72 6f 67 72 61 6d 20 65 78 | s.called).when.a.user.program.ex |
| f5dc0 | 70 6c 69 63 69 74 6c 79 20 72 65 6a 65 63 74 73 20 74 68 65 0a 63 75 72 72 65 6e 74 20 6c 69 6e | plicitly.rejects.the.current.lin |
| f5de0 | 65 20 6f 66 20 61 74 74 61 63 6b 20 28 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 20 63 61 6c 6c | e.of.attack.(for.example,.a.call |
| f5e00 | 20 74 6f 20 60 72 65 71 75 69 72 65 27 20 6d 61 79 20 72 65 73 75 6c 74 20 69 6e 0a 65 78 65 63 | .to.`require'.may.result.in.exec |
| f5e20 | 75 74 69 6f 6e 20 6f 66 20 60 28 61 6d 62 29 27 2c 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 | ution.of.`(amb)',.an.expression. |
| f5e40 | 74 68 61 74 20 61 6c 77 61 79 73 20 66 61 69 6c 73 2d 2d 73 65 65 20 73 65 63 74 69 6f 6e 0a 2a | that.always.fails--see.section.* |
| f5e60 | 4e 6f 74 65 20 34 2d 33 2d 31 3a 3a 29 2e 20 20 54 68 65 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 | Note.4-3-1::)...The.failure.cont |
| f5e80 | 69 6e 75 61 74 69 6f 6e 20 69 6e 20 68 61 6e 64 20 61 74 20 74 68 61 74 20 70 6f 69 6e 74 20 77 | inuation.in.hand.at.that.point.w |
| f5ea0 | 69 6c 6c 0a 63 61 75 73 65 20 74 68 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 63 68 6f 69 63 65 | ill.cause.the.most.recent.choice |
| f5ec0 | 20 70 6f 69 6e 74 20 74 6f 20 63 68 6f 6f 73 65 20 61 6e 6f 74 68 65 72 20 61 6c 74 65 72 6e 61 | .point.to.choose.another.alterna |
| f5ee0 | 74 69 76 65 2e 20 20 49 66 0a 74 68 65 72 65 20 61 72 65 20 6e 6f 20 6d 6f 72 65 20 61 6c 74 65 | tive...If.there.are.no.more.alte |
| f5f00 | 72 6e 61 74 69 76 65 73 20 74 6f 20 62 65 20 63 6f 6e 73 69 64 65 72 65 64 20 61 74 20 74 68 61 | rnatives.to.be.considered.at.tha |
| f5f20 | 74 20 63 68 6f 69 63 65 20 70 6f 69 6e 74 2c 20 61 0a 66 61 69 6c 75 72 65 20 61 74 20 61 6e 20 | t.choice.point,.a.failure.at.an. |
| f5f40 | 65 61 72 6c 69 65 72 20 63 68 6f 69 63 65 20 70 6f 69 6e 74 20 69 73 20 74 72 69 67 67 65 72 65 | earlier.choice.point.is.triggere |
| f5f60 | 64 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 20 46 61 69 6c 75 72 65 0a 63 6f 6e 74 69 6e 75 61 74 | d,.and.so.on...Failure.continuat |
| f5f80 | 69 6f 6e 73 20 61 72 65 20 61 6c 73 6f 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20 64 72 69 | ions.are.also.invoked.by.the.dri |
| f5fa0 | 76 65 72 20 6c 6f 6f 70 20 69 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 20 61 0a 60 74 72 79 2d 61 | ver.loop.in.response.to.a.`try-a |
| f5fc0 | 67 61 69 6e 27 20 72 65 71 75 65 73 74 2c 20 74 6f 20 66 69 6e 64 20 61 6e 6f 74 68 65 72 20 76 | gain'.request,.to.find.another.v |
| f5fe0 | 61 6c 75 65 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 0a 20 20 20 49 6e 20 61 | alue.of.the.expression......In.a |
| f6000 | 64 64 69 74 69 6f 6e 2c 20 69 66 20 61 20 73 69 64 65 2d 65 66 66 65 63 74 20 6f 70 65 72 61 74 | ddition,.if.a.side-effect.operat |
| f6020 | 69 6f 6e 20 28 73 75 63 68 20 61 73 20 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 20 61 0a 76 61 72 | ion.(such.as.assignment.to.a.var |
| f6040 | 69 61 62 6c 65 29 20 6f 63 63 75 72 73 20 6f 6e 20 61 20 62 72 61 6e 63 68 20 6f 66 20 74 68 65 | iable).occurs.on.a.branch.of.the |
| f6060 | 20 70 72 6f 63 65 73 73 20 72 65 73 75 6c 74 69 6e 67 20 66 72 6f 6d 20 61 20 63 68 6f 69 63 65 | .process.resulting.from.a.choice |
| f6080 | 2c 20 69 74 0a 6d 61 79 20 62 65 20 6e 65 63 65 73 73 61 72 79 2c 20 77 68 65 6e 20 74 68 65 20 | ,.it.may.be.necessary,.when.the. |
| f60a0 | 70 72 6f 63 65 73 73 20 66 69 6e 64 73 20 61 20 64 65 61 64 20 65 6e 64 2c 20 74 6f 20 75 6e 64 | process.finds.a.dead.end,.to.und |
| f60c0 | 6f 20 74 68 65 20 73 69 64 65 0a 65 66 66 65 63 74 20 62 65 66 6f 72 65 20 6d 61 6b 69 6e 67 20 | o.the.side.effect.before.making. |
| f60e0 | 61 20 6e 65 77 20 63 68 6f 69 63 65 2e 20 20 54 68 69 73 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 | a.new.choice...This.is.accomplis |
| f6100 | 68 65 64 20 62 79 20 68 61 76 69 6e 67 20 74 68 65 0a 73 69 64 65 2d 65 66 66 65 63 74 20 6f 70 | hed.by.having.the.side-effect.op |
| f6120 | 65 72 61 74 69 6f 6e 20 70 72 6f 64 75 63 65 20 61 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e | eration.produce.a.failure.contin |
| f6140 | 75 61 74 69 6f 6e 20 74 68 61 74 20 75 6e 64 6f 65 73 20 74 68 65 0a 73 69 64 65 20 65 66 66 65 | uation.that.undoes.the.side.effe |
| f6160 | 63 74 20 61 6e 64 20 70 72 6f 70 61 67 61 74 65 73 20 74 68 65 20 66 61 69 6c 75 72 65 2e 0a 0a | ct.and.propagates.the.failure... |
| f6180 | 20 20 20 49 6e 20 73 75 6d 6d 61 72 79 2c 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 | ...In.summary,.failure.continuat |
| f61a0 | 69 6f 6e 73 20 61 72 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 62 79 0a 0a 20 20 20 2a 20 60 61 | ions.are.constructed.by.....*.`a |
| f61c0 | 6d 62 27 20 65 78 70 72 65 73 73 69 6f 6e 73 2d 2d 74 6f 20 70 72 6f 76 69 64 65 20 61 20 6d 65 | mb'.expressions--to.provide.a.me |
| f61e0 | 63 68 61 6e 69 73 6d 20 74 6f 20 6d 61 6b 65 20 61 6c 74 65 72 6e 61 74 69 76 65 0a 20 20 20 20 | chanism.to.make.alternative..... |
| f6200 | 20 63 68 6f 69 63 65 73 20 69 66 20 74 68 65 20 63 75 72 72 65 6e 74 20 63 68 6f 69 63 65 20 6d | .choices.if.the.current.choice.m |
| f6220 | 61 64 65 20 62 79 20 74 68 65 20 60 61 6d 62 27 20 65 78 70 72 65 73 73 69 6f 6e 20 6c 65 61 64 | ade.by.the.`amb'.expression.lead |
| f6240 | 73 0a 20 20 20 20 20 74 6f 20 61 20 64 65 61 64 20 65 6e 64 3b 0a 0a 20 20 20 2a 20 74 68 65 20 | s......to.a.dead.end;.....*.the. |
| f6260 | 74 6f 70 2d 6c 65 76 65 6c 20 64 72 69 76 65 72 2d 2d 74 6f 20 70 72 6f 76 69 64 65 20 61 20 6d | top-level.driver--to.provide.a.m |
| f6280 | 65 63 68 61 6e 69 73 6d 20 74 6f 20 72 65 70 6f 72 74 20 66 61 69 6c 75 72 65 0a 20 20 20 20 20 | echanism.to.report.failure...... |
| f62a0 | 77 68 65 6e 20 74 68 65 20 63 68 6f 69 63 65 73 20 61 72 65 20 65 78 68 61 75 73 74 65 64 3b 0a | when.the.choices.are.exhausted;. |
| f62c0 | 0a 20 20 20 2a 20 61 73 73 69 67 6e 6d 65 6e 74 73 2d 2d 74 6f 20 69 6e 74 65 72 63 65 70 74 20 | ....*.assignments--to.intercept. |
| f62e0 | 66 61 69 6c 75 72 65 73 20 61 6e 64 20 75 6e 64 6f 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 64 75 | failures.and.undo.assignments.du |
| f6300 | 72 69 6e 67 0a 20 20 20 20 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 2e 0a 0a 0a 20 20 20 46 61 69 | ring......backtracking.......Fai |
| f6320 | 6c 75 72 65 73 20 61 72 65 20 69 6e 69 74 69 61 74 65 64 20 6f 6e 6c 79 20 77 68 65 6e 20 61 20 | lures.are.initiated.only.when.a. |
| f6340 | 64 65 61 64 20 65 6e 64 20 69 73 20 65 6e 63 6f 75 6e 74 65 72 65 64 2e 20 20 54 68 69 73 0a 6f | dead.end.is.encountered...This.o |
| f6360 | 63 63 75 72 73 0a 0a 20 20 20 2a 20 69 66 20 74 68 65 20 75 73 65 72 20 70 72 6f 67 72 61 6d 20 | ccurs.....*.if.the.user.program. |
| f6380 | 65 78 65 63 75 74 65 73 20 60 28 61 6d 62 29 27 3b 0a 0a 20 20 20 2a 20 69 66 20 74 68 65 20 75 | executes.`(amb)';.....*.if.the.u |
| f63a0 | 73 65 72 20 74 79 70 65 73 20 60 74 72 79 2d 61 67 61 69 6e 27 20 61 74 20 74 68 65 20 74 6f 70 | ser.types.`try-again'.at.the.top |
| f63c0 | 2d 6c 65 76 65 6c 20 64 72 69 76 65 72 2e 0a 0a 0a 20 20 20 46 61 69 6c 75 72 65 20 63 6f 6e 74 | -level.driver.......Failure.cont |
| f63e0 | 69 6e 75 61 74 69 6f 6e 73 20 61 72 65 20 61 6c 73 6f 20 63 61 6c 6c 65 64 20 64 75 72 69 6e 67 | inuations.are.also.called.during |
| f6400 | 20 70 72 6f 63 65 73 73 69 6e 67 20 6f 66 20 61 20 66 61 69 6c 75 72 65 3a 0a 0a 20 20 20 2a 20 | .processing.of.a.failure:.....*. |
| f6420 | 57 68 65 6e 20 74 68 65 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 63 72 | When.the.failure.continuation.cr |
| f6440 | 65 61 74 65 64 20 62 79 20 61 6e 20 61 73 73 69 67 6e 6d 65 6e 74 20 66 69 6e 69 73 68 65 73 0a | eated.by.an.assignment.finishes. |
| f6460 | 20 20 20 20 20 75 6e 64 6f 69 6e 67 20 61 20 73 69 64 65 20 65 66 66 65 63 74 2c 20 69 74 20 63 | .....undoing.a.side.effect,.it.c |
| f6480 | 61 6c 6c 73 20 74 68 65 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 69 74 | alls.the.failure.continuation.it |
| f64a0 | 0a 20 20 20 20 20 69 6e 74 65 72 63 65 70 74 65 64 2c 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 70 | ......intercepted,.in.order.to.p |
| f64c0 | 72 6f 70 61 67 61 74 65 20 74 68 65 20 66 61 69 6c 75 72 65 20 62 61 63 6b 20 74 6f 20 74 68 65 | ropagate.the.failure.back.to.the |
| f64e0 | 20 63 68 6f 69 63 65 0a 20 20 20 20 20 70 6f 69 6e 74 20 74 68 61 74 20 6c 65 64 20 74 6f 20 74 | .choice......point.that.led.to.t |
| f6500 | 68 69 73 20 61 73 73 69 67 6e 6d 65 6e 74 20 6f 72 20 74 6f 20 74 68 65 20 74 6f 70 20 6c 65 76 | his.assignment.or.to.the.top.lev |
| f6520 | 65 6c 2e 0a 0a 20 20 20 2a 20 57 68 65 6e 20 74 68 65 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 | el......*.When.the.failure.conti |
| f6540 | 6e 75 61 74 69 6f 6e 20 66 6f 72 20 61 6e 20 60 61 6d 62 27 20 72 75 6e 73 20 6f 75 74 20 6f 66 | nuation.for.an.`amb'.runs.out.of |
| f6560 | 20 63 68 6f 69 63 65 73 2c 20 69 74 0a 20 20 20 20 20 63 61 6c 6c 73 20 74 68 65 20 66 61 69 6c | .choices,.it......calls.the.fail |
| f6580 | 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 74 68 61 74 20 77 61 73 20 6f 72 69 67 69 6e | ure.continuation.that.was.origin |
| f65a0 | 61 6c 6c 79 20 67 69 76 65 6e 20 74 6f 20 74 68 65 0a 20 20 20 20 20 60 61 6d 62 27 2c 20 69 6e | ally.given.to.the......`amb',.in |
| f65c0 | 20 6f 72 64 65 72 20 74 6f 20 70 72 6f 70 61 67 61 74 65 20 74 68 65 20 66 61 69 6c 75 72 65 20 | .order.to.propagate.the.failure. |
| f65e0 | 62 61 63 6b 20 74 6f 20 74 68 65 20 70 72 65 76 69 6f 75 73 0a 20 20 20 20 20 63 68 6f 69 63 65 | back.to.the.previous......choice |
| f6600 | 20 70 6f 69 6e 74 20 6f 72 20 74 6f 20 74 68 65 20 74 6f 70 20 6c 65 76 65 6c 2e 0a 0a 0a 53 74 | .point.or.to.the.top.level....St |
| f6620 | 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 0a 2e 2e 2e 2e 2e 2e 2e | ructure.of.the.evaluator........ |
| f6640 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 73 79 6e 74 61 78 2d | .....................The.syntax- |
| f6660 | 20 61 6e 64 20 64 61 74 61 2d 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 | .and.data-representation.procedu |
| f6680 | 72 65 73 20 66 6f 72 20 74 68 65 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 2c 0a 61 6e 64 | res.for.the.`amb'.evaluator,.and |
| f66a0 | 20 61 6c 73 6f 20 74 68 65 20 62 61 73 69 63 20 60 61 6e 61 6c 79 7a 65 27 20 70 72 6f 63 65 64 | .also.the.basic.`analyze'.proced |
| f66c0 | 75 72 65 2c 20 61 72 65 20 69 64 65 6e 74 69 63 61 6c 20 74 6f 20 74 68 6f 73 65 20 69 6e 20 74 | ure,.are.identical.to.those.in.t |
| f66e0 | 68 65 0a 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d | he.evaluator.of.section.*Note.4- |
| f6700 | 31 2d 37 3a 3a 2c 20 65 78 63 65 70 74 20 66 6f 72 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 | 1-7::,.except.for.the.fact.that. |
| f6720 | 77 65 20 6e 65 65 64 0a 61 64 64 69 74 69 6f 6e 61 6c 20 73 79 6e 74 61 78 20 70 72 6f 63 65 64 | we.need.additional.syntax.proced |
| f6740 | 75 72 65 73 20 74 6f 20 72 65 63 6f 67 6e 69 7a 65 20 74 68 65 20 60 61 6d 62 27 20 73 70 65 63 | ures.to.recognize.the.`amb'.spec |
| f6760 | 69 61 6c 20 66 6f 72 6d 3a 28 32 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6d 62 3f | ial.form:(2).......(define.(amb? |
| f6780 | 20 65 78 70 29 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 65 78 70 20 27 61 6d 62 29 29 0a 0a | .exp).(tagged-list?.exp.'amb)).. |
| f67a0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6d 62 2d 63 68 6f 69 63 65 73 20 65 78 70 29 20 28 | .....(define.(amb-choices.exp).( |
| f67c0 | 63 64 72 20 65 78 70 29 29 0a 0a 20 20 20 57 65 20 6d 75 73 74 20 61 6c 73 6f 20 61 64 64 20 74 | cdr.exp)).....We.must.also.add.t |
| f67e0 | 6f 20 74 68 65 20 64 69 73 70 61 74 63 68 20 69 6e 20 60 61 6e 61 6c 79 7a 65 27 20 61 20 63 6c | o.the.dispatch.in.`analyze'.a.cl |
| f6800 | 61 75 73 65 20 74 68 61 74 20 77 69 6c 6c 0a 72 65 63 6f 67 6e 69 7a 65 20 74 68 69 73 20 73 70 | ause.that.will.recognize.this.sp |
| f6820 | 65 63 69 61 6c 20 66 6f 72 6d 20 61 6e 64 20 67 65 6e 65 72 61 74 65 20 61 6e 20 61 70 70 72 6f | ecial.form.and.generate.an.appro |
| f6840 | 70 72 69 61 74 65 20 65 78 65 63 75 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 | priate.execution.procedure:..... |
| f6860 | 20 20 28 28 61 6d 62 3f 20 65 78 70 29 20 28 61 6e 61 6c 79 7a 65 2d 61 6d 62 20 65 78 70 29 29 | ..((amb?.exp).(analyze-amb.exp)) |
| f6880 | 0a 0a 20 20 20 54 68 65 20 74 6f 70 2d 6c 65 76 65 6c 20 70 72 6f 63 65 64 75 72 65 20 60 61 6d | .....The.top-level.procedure.`am |
| f68a0 | 62 65 76 61 6c 27 20 28 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 76 65 72 73 69 6f 6e 20 6f | beval'.(similar.to.the.version.o |
| f68c0 | 66 20 60 65 76 61 6c 27 0a 67 69 76 65 6e 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 | f.`eval'.given.in.section.*Note. |
| f68e0 | 34 2d 31 2d 37 3a 3a 29 20 61 6e 61 6c 79 7a 65 73 20 74 68 65 20 67 69 76 65 6e 20 65 78 70 72 | 4-1-7::).analyzes.the.given.expr |
| f6900 | 65 73 73 69 6f 6e 20 61 6e 64 0a 61 70 70 6c 69 65 73 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 | ession.and.applies.the.resulting |
| f6920 | 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 74 68 65 20 67 69 76 65 | .execution.procedure.to.the.give |
| f6940 | 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 0a 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 77 6f | n.environment,.together.with.two |
| f6960 | 20 67 69 76 65 6e 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 | .given.continuations:.......(def |
| f6980 | 69 6e 65 20 28 61 6d 62 65 76 61 6c 20 65 78 70 20 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 | ine.(ambeval.exp.env.succeed.fai |
| f69a0 | 6c 29 0a 20 20 20 20 20 20 20 28 28 61 6e 61 6c 79 7a 65 20 65 78 70 29 20 65 6e 76 20 73 75 63 | l)........((analyze.exp).env.suc |
| f69c0 | 63 65 65 64 20 66 61 69 6c 29 29 0a 0a 20 20 20 41 20 73 75 63 63 65 73 73 20 63 6f 6e 74 69 6e | ceed.fail)).....A.success.contin |
| f69e0 | 75 61 74 69 6f 6e 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 74 77 6f 20 61 72 67 | uation.is.a.procedure.of.two.arg |
| f6a00 | 75 6d 65 6e 74 73 3a 20 74 68 65 20 76 61 6c 75 65 0a 6a 75 73 74 20 6f 62 74 61 69 6e 65 64 20 | uments:.the.value.just.obtained. |
| f6a20 | 61 6e 64 20 61 6e 6f 74 68 65 72 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e | and.another.failure.continuation |
| f6a40 | 20 74 6f 20 62 65 20 75 73 65 64 20 69 66 20 74 68 61 74 20 76 61 6c 75 65 0a 6c 65 61 64 73 20 | .to.be.used.if.that.value.leads. |
| f6a60 | 74 6f 20 61 20 73 75 62 73 65 71 75 65 6e 74 20 66 61 69 6c 75 72 65 2e 20 41 20 66 61 69 6c 75 | to.a.subsequent.failure..A.failu |
| f6a80 | 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f | re.continuation.is.a.procedure.o |
| f6aa0 | 66 0a 6e 6f 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 53 6f 20 74 68 65 20 67 65 6e 65 72 61 6c 20 | f.no.arguments...So.the.general. |
| f6ac0 | 66 6f 72 6d 20 6f 66 20 61 6e 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 69 | form.of.an.execution.procedure.i |
| f6ae0 | 73 0a 0a 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 | s.......(lambda.(env.succeed.fai |
| f6b00 | 6c 29 0a 20 20 20 20 20 20 20 3b 3b 20 60 73 75 63 63 65 65 64 27 20 69 73 20 60 28 6c 61 6d 62 | l)........;;.`succeed'.is.`(lamb |
| f6b20 | 64 61 20 28 76 61 6c 75 65 20 66 61 69 6c 29 20 2e 2e 2e 29 27 0a 20 20 20 20 20 20 20 3b 3b 20 | da.(value.fail)....)'........;;. |
| f6b40 | 60 66 61 69 6c 27 20 69 73 20 60 28 6c 61 6d 62 64 61 20 28 29 20 2e 2e 2e 29 27 0a 20 20 20 20 | `fail'.is.`(lambda.()....)'..... |
| f6b60 | 20 20 20 2e 2e 2e 29 0a 0a 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 65 78 65 63 75 74 69 | ......).....For.example,.executi |
| f6b80 | 6e 67 0a 0a 20 20 20 20 20 28 61 6d 62 65 76 61 6c 20 3c 45 58 50 3e 0a 20 20 20 20 20 20 20 20 | ng.......(ambeval.<EXP>......... |
| f6ba0 | 20 20 20 20 20 20 74 68 65 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 20 20 20 | ......the-global-environment.... |
| f6bc0 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 75 65 20 66 61 69 6c 29 20 | ...........(lambda.(value.fail). |
| f6be0 | 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 | value)...............(lambda.(). |
| f6c00 | 27 66 61 69 6c 65 64 29 29 0a 0a 77 69 6c 6c 20 61 74 74 65 6d 70 74 20 74 6f 20 65 76 61 6c 75 | 'failed))..will.attempt.to.evalu |
| f6c20 | 61 74 65 20 74 68 65 20 67 69 76 65 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 61 6e 64 20 77 69 6c | ate.the.given.expression.and.wil |
| f6c40 | 6c 20 72 65 74 75 72 6e 20 65 69 74 68 65 72 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 27 73 | l.return.either.the.expression's |
| f6c60 | 20 76 61 6c 75 65 20 28 69 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 73 75 63 63 65 65 | .value.(if.the.evaluation.succee |
| f6c80 | 64 73 29 20 6f 72 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 66 61 69 6c 65 64 27 0a 28 69 66 20 74 | ds).or.the.symbol.`failed'.(if.t |
| f6ca0 | 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 66 61 69 6c 73 29 2e 20 20 54 68 65 20 63 61 6c 6c 20 | he.evaluation.fails)...The.call. |
| f6cc0 | 74 6f 20 60 61 6d 62 65 76 61 6c 27 20 69 6e 20 74 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 0a | to.`ambeval'.in.the.driver.loop. |
| f6ce0 | 73 68 6f 77 6e 20 62 65 6c 6f 77 20 75 73 65 73 20 6d 75 63 68 20 6d 6f 72 65 20 63 6f 6d 70 6c | shown.below.uses.much.more.compl |
| f6d00 | 69 63 61 74 65 64 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 2c 20 | icated.continuation.procedures,. |
| f6d20 | 77 68 69 63 68 0a 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 6c 6f 6f 70 20 61 6e 64 20 73 75 70 70 | which.continue.the.loop.and.supp |
| f6d40 | 6f 72 74 20 74 68 65 20 60 74 72 79 2d 61 67 61 69 6e 27 20 72 65 71 75 65 73 74 2e 0a 0a 20 20 | ort.the.`try-again'.request..... |
| f6d60 | 20 4d 6f 73 74 20 6f 66 20 74 68 65 20 63 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 74 68 65 20 60 | .Most.of.the.complexity.of.the.` |
| f6d80 | 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 20 72 65 73 75 6c 74 73 20 66 72 6f 6d 20 74 68 65 0a | amb'.evaluator.results.from.the. |
| f6da0 | 6d 65 63 68 61 6e 69 63 73 20 6f 66 20 70 61 73 73 69 6e 67 20 74 68 65 20 63 6f 6e 74 69 6e 75 | mechanics.of.passing.the.continu |
| f6dc0 | 61 74 69 6f 6e 73 20 61 72 6f 75 6e 64 20 61 73 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 0a 70 | ations.around.as.the.execution.p |
| f6de0 | 72 6f 63 65 64 75 72 65 73 20 63 61 6c 6c 20 65 61 63 68 20 6f 74 68 65 72 2e 20 20 49 6e 20 67 | rocedures.call.each.other...In.g |
| f6e00 | 6f 69 6e 67 20 74 68 72 6f 75 67 68 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 64 65 2c | oing.through.the.following.code, |
| f6e20 | 20 79 6f 75 0a 73 68 6f 75 6c 64 20 63 6f 6d 70 61 72 65 20 65 61 63 68 20 6f 66 20 74 68 65 20 | .you.should.compare.each.of.the. |
| f6e40 | 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 77 69 74 68 20 74 68 65 20 63 6f | execution.procedures.with.the.co |
| f6e60 | 72 72 65 73 70 6f 6e 64 69 6e 67 0a 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 74 68 65 20 6f 72 | rresponding.procedure.for.the.or |
| f6e80 | 64 69 6e 61 72 79 20 65 76 61 6c 75 61 74 6f 72 20 67 69 76 65 6e 20 69 6e 20 73 65 63 74 69 6f | dinary.evaluator.given.in.sectio |
| f6ea0 | 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 37 3a 3a 2e 0a 0a 53 69 6d 70 6c 65 20 65 78 70 72 65 73 73 | n.*Note.4-1-7::...Simple.express |
| f6ec0 | 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 65 78 65 | ions.....................The.exe |
| f6ee0 | 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 74 68 65 20 73 69 6d 70 6c 65 | cution.procedures.for.the.simple |
| f6f00 | 73 74 20 6b 69 6e 64 73 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 0a 65 73 73 65 | st.kinds.of.expressions.are.esse |
| f6f20 | 6e 74 69 61 6c 6c 79 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 6f 73 65 20 66 6f 72 20 74 68 | ntially.the.same.as.those.for.th |
| f6f40 | 65 20 6f 72 64 69 6e 61 72 79 20 65 76 61 6c 75 61 74 6f 72 2c 20 65 78 63 65 70 74 20 66 6f 72 | e.ordinary.evaluator,.except.for |
| f6f60 | 0a 74 68 65 20 6e 65 65 64 20 74 6f 20 6d 61 6e 61 67 65 20 74 68 65 20 63 6f 6e 74 69 6e 75 61 | .the.need.to.manage.the.continua |
| f6f80 | 74 69 6f 6e 73 2e 20 20 54 68 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 | tions...The.execution.procedures |
| f6fa0 | 20 73 69 6d 70 6c 79 0a 73 75 63 63 65 65 64 20 77 69 74 68 20 74 68 65 20 76 61 6c 75 65 20 6f | .simply.succeed.with.the.value.o |
| f6fc0 | 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 70 61 73 73 69 6e 67 20 61 6c 6f 6e 67 20 | f.the.expression,.passing.along. |
| f6fe0 | 74 68 65 20 66 61 69 6c 75 72 65 0a 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 74 68 61 74 20 77 61 | the.failure.continuation.that.wa |
| f7000 | 73 20 70 61 73 73 65 64 20 74 6f 20 74 68 65 6d 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | s.passed.to.them........(define. |
| f7020 | 28 61 6e 61 6c 79 7a 65 2d 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 20 65 78 70 29 0a 20 20 | (analyze-self-evaluating.exp)... |
| f7040 | 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 6c 29 0a | .....(lambda.(env.succeed.fail). |
| f7060 | 20 20 20 20 20 20 20 20 20 28 73 75 63 63 65 65 64 20 65 78 70 20 66 61 69 6c 29 29 29 0a 0a 20 | .........(succeed.exp.fail)))... |
| f7080 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 71 75 6f 74 65 64 20 65 78 70 29 | ....(define.(analyze-quoted.exp) |
| f70a0 | 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 71 76 61 6c 20 28 74 65 78 74 2d 6f 66 2d 71 75 6f | ........(let.((qval.(text-of-quo |
| f70c0 | 74 61 74 69 6f 6e 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 | tation.exp)))..........(lambda.( |
| f70e0 | 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 75 | env.succeed.fail)............(su |
| f7100 | 63 63 65 65 64 20 71 76 61 6c 20 66 61 69 6c 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | cceed.qval.fail)))).......(defin |
| f7120 | 65 20 28 61 6e 61 6c 79 7a 65 2d 76 61 72 69 61 62 6c 65 20 65 78 70 29 0a 20 20 20 20 20 20 20 | e.(analyze-variable.exp)........ |
| f7140 | 28 6c 61 6d 62 64 61 20 28 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 | (lambda.(env.succeed.fail)...... |
| f7160 | 20 20 20 20 28 73 75 63 63 65 65 64 20 28 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 | ....(succeed.(lookup-variable-va |
| f7180 | 6c 75 65 20 65 78 70 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 | lue.exp.env)...................f |
| f71a0 | 61 69 6c 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 6c 61 | ail))).......(define.(analyze-la |
| f71c0 | 6d 62 64 61 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 76 61 72 73 20 28 6c 61 | mbda.exp)........(let.((vars.(la |
| f71e0 | 6d 62 64 61 2d 70 61 72 61 6d 65 74 65 72 73 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 | mbda-parameters.exp))........... |
| f7200 | 20 20 20 28 62 70 72 6f 63 20 28 61 6e 61 6c 79 7a 65 2d 73 65 71 75 65 6e 63 65 20 28 6c 61 6d | ...(bproc.(analyze-sequence.(lam |
| f7220 | 62 64 61 2d 62 6f 64 79 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 | bda-body.exp))))..........(lambd |
| f7240 | 61 20 28 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 | a.(env.succeed.fail)............ |
| f7260 | 28 73 75 63 63 65 65 64 20 28 6d 61 6b 65 2d 70 72 6f 63 65 64 75 72 65 20 76 61 72 73 20 62 70 | (succeed.(make-procedure.vars.bp |
| f7280 | 72 6f 63 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 69 | roc.env).....................fai |
| f72a0 | 6c 29 29 29 29 0a 0a 20 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 6c 6f 6f 6b 69 6e 67 20 75 70 | l)))).....Notice.that.looking.up |
| f72c0 | 20 61 20 76 61 72 69 61 62 6c 65 20 61 6c 77 61 79 73 20 22 73 75 63 63 65 65 64 73 2e 22 20 20 | .a.variable.always."succeeds.".. |
| f72e0 | 49 66 0a 60 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 27 20 66 61 69 6c 73 | If.`lookup-variable-value'.fails |
| f7300 | 20 74 6f 20 66 69 6e 64 20 74 68 65 20 76 61 72 69 61 62 6c 65 2c 20 69 74 20 73 69 67 6e 61 6c | .to.find.the.variable,.it.signal |
| f7320 | 73 20 61 6e 20 65 72 72 6f 72 2c 0a 61 73 20 75 73 75 61 6c 2e 20 20 53 75 63 68 20 61 20 22 66 | s.an.error,.as.usual...Such.a."f |
| f7340 | 61 69 6c 75 72 65 22 20 69 6e 64 69 63 61 74 65 73 20 61 20 70 72 6f 67 72 61 6d 20 62 75 67 2d | ailure".indicates.a.program.bug- |
| f7360 | 2d 61 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20 61 6e 0a 75 6e 62 6f 75 6e 64 20 76 61 72 69 61 | -a.reference.to.an.unbound.varia |
| f7380 | 62 6c 65 3b 20 69 74 20 69 73 20 6e 6f 74 20 61 6e 20 69 6e 64 69 63 61 74 69 6f 6e 20 74 68 61 | ble;.it.is.not.an.indication.tha |
| f73a0 | 74 20 77 65 20 73 68 6f 75 6c 64 20 74 72 79 20 61 6e 6f 74 68 65 72 0a 6e 6f 6e 64 65 74 65 72 | t.we.should.try.another.nondeter |
| f73c0 | 6d 69 6e 69 73 74 69 63 20 63 68 6f 69 63 65 20 69 6e 73 74 65 61 64 20 6f 66 20 74 68 65 20 6f | ministic.choice.instead.of.the.o |
| f73e0 | 6e 65 20 74 68 61 74 20 69 73 20 63 75 72 72 65 6e 74 6c 79 20 62 65 69 6e 67 0a 74 72 69 65 64 | ne.that.is.currently.being.tried |
| f7400 | 2e 0a 0a 43 6f 6e 64 69 74 69 6f 6e 61 6c 73 20 61 6e 64 20 73 65 71 75 65 6e 63 65 73 0a 2e 2e | ...Conditionals.and.sequences... |
| f7420 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 43 6f 6e 64 69 74 | ..........................Condit |
| f7440 | 69 6f 6e 61 6c 73 20 61 72 65 20 61 6c 73 6f 20 68 61 6e 64 6c 65 64 20 69 6e 20 61 20 73 69 6d | ionals.are.also.handled.in.a.sim |
| f7460 | 69 6c 61 72 20 77 61 79 20 61 73 20 69 6e 20 74 68 65 20 6f 72 64 69 6e 61 72 79 0a 65 76 61 6c | ilar.way.as.in.the.ordinary.eval |
| f7480 | 75 61 74 6f 72 2e 20 20 54 68 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 | uator...The.execution.procedure. |
| f74a0 | 67 65 6e 65 72 61 74 65 64 20 62 79 20 60 61 6e 61 6c 79 7a 65 2d 69 66 27 20 69 6e 76 6f 6b 65 | generated.by.`analyze-if'.invoke |
| f74c0 | 73 0a 74 68 65 20 70 72 65 64 69 63 61 74 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 | s.the.predicate.execution.proced |
| f74e0 | 75 72 65 20 60 70 70 72 6f 63 27 20 77 69 74 68 20 61 20 73 75 63 63 65 73 73 20 63 6f 6e 74 69 | ure.`pproc'.with.a.success.conti |
| f7500 | 6e 75 61 74 69 6f 6e 0a 74 68 61 74 20 63 68 65 63 6b 73 20 77 68 65 74 68 65 72 20 74 68 65 20 | nuation.that.checks.whether.the. |
| f7520 | 70 72 65 64 69 63 61 74 65 20 76 61 6c 75 65 20 69 73 20 74 72 75 65 20 61 6e 64 20 67 6f 65 73 | predicate.value.is.true.and.goes |
| f7540 | 20 6f 6e 20 74 6f 20 65 78 65 63 75 74 65 0a 65 69 74 68 65 72 20 74 68 65 20 63 6f 6e 73 65 71 | .on.to.execute.either.the.conseq |
| f7560 | 75 65 6e 74 20 6f 72 20 74 68 65 20 61 6c 74 65 72 6e 61 74 69 76 65 2e 20 20 49 66 20 74 68 65 | uent.or.the.alternative...If.the |
| f7580 | 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 60 70 70 72 6f 63 27 0a 66 61 69 6c 73 2c 20 74 68 65 | .execution.of.`pproc'.fails,.the |
| f75a0 | 20 6f 72 69 67 69 6e 61 6c 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 66 | .original.failure.continuation.f |
| f75c0 | 6f 72 20 74 68 65 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 0a 63 61 6c 6c 65 64 | or.the.`if'.expression.is.called |
| f75e0 | 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 69 66 20 65 78 70 29 | ........(define.(analyze-if.exp) |
| f7600 | 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 70 72 6f 63 20 28 61 6e 61 6c 79 7a 65 20 28 69 | ........(let.((pproc.(analyze.(i |
| f7620 | 66 2d 70 72 65 64 69 63 61 74 65 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | f-predicate.exp))).............. |
| f7640 | 28 63 70 72 6f 63 20 28 61 6e 61 6c 79 7a 65 20 28 69 66 2d 63 6f 6e 73 65 71 75 65 6e 74 20 65 | (cproc.(analyze.(if-consequent.e |
| f7660 | 78 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 72 6f 63 20 28 61 6e 61 6c 79 | xp)))..............(aproc.(analy |
| f7680 | 7a 65 20 28 69 66 2d 61 6c 74 65 72 6e 61 74 69 76 65 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 | ze.(if-alternative.exp))))...... |
| f76a0 | 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 6c 29 0a 20 | ....(lambda.(env.succeed.fail).. |
| f76c0 | 20 20 20 20 20 20 20 20 20 20 28 70 70 72 6f 63 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 20 20 | ..........(pproc.env............ |
| f76e0 | 20 20 20 20 20 20 20 3b 3b 20 73 75 63 63 65 73 73 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 66 | .......;;.success.continuation.f |
| f7700 | 6f 72 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 70 72 65 64 69 63 61 74 65 0a 20 20 20 20 | or.evaluating.the.predicate..... |
| f7720 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 74 6f 20 6f 62 74 61 69 6e 20 60 70 72 65 64 | ..............;;.to.obtain.`pred |
| f7740 | 2d 76 61 6c 75 65 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 | -value'...................(lambd |
| f7760 | 61 20 28 70 72 65 64 2d 76 61 6c 75 65 20 66 61 69 6c 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 | a.(pred-value.fail2)............ |
| f7780 | 20 20 20 20 20 20 20 20 20 28 69 66 20 28 74 72 75 65 3f 20 70 72 65 64 2d 76 61 6c 75 65 29 0a | .........(if.(true?.pred-value). |
| f77a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 70 72 6f 63 20 65 | ........................(cproc.e |
| f77c0 | 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 6c 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | nv.succeed.fail2)............... |
| f77e0 | 20 20 20 20 20 20 20 20 20 20 28 61 70 72 6f 63 20 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 | ..........(aproc.env.succeed.fai |
| f7800 | 6c 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 66 61 69 6c 75 | l2)))...................;;.failu |
| f7820 | 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 66 6f 72 20 65 76 61 6c 75 61 74 69 6e 67 20 74 | re.continuation.for.evaluating.t |
| f7840 | 68 65 20 70 72 65 64 69 63 61 74 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 | he.predicate...................f |
| f7860 | 61 69 6c 29 29 29 29 0a 0a 20 20 20 53 65 71 75 65 6e 63 65 73 20 61 72 65 20 61 6c 73 6f 20 68 | ail)))).....Sequences.are.also.h |
| f7880 | 61 6e 64 6c 65 64 20 69 6e 20 74 68 65 20 73 61 6d 65 20 77 61 79 20 61 73 20 69 6e 20 74 68 65 | andled.in.the.same.way.as.in.the |
| f78a0 | 20 70 72 65 76 69 6f 75 73 0a 65 76 61 6c 75 61 74 6f 72 2c 20 65 78 63 65 70 74 20 66 6f 72 20 | .previous.evaluator,.except.for. |
| f78c0 | 74 68 65 20 6d 61 63 68 69 6e 61 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 73 75 62 70 72 6f 63 65 | the.machinations.in.the.subproce |
| f78e0 | 64 75 72 65 0a 60 73 65 71 75 65 6e 74 69 61 6c 6c 79 27 20 74 68 61 74 20 61 72 65 20 72 65 71 | dure.`sequentially'.that.are.req |
| f7900 | 75 69 72 65 64 20 66 6f 72 20 70 61 73 73 69 6e 67 20 74 68 65 20 63 6f 6e 74 69 6e 75 61 74 69 | uired.for.passing.the.continuati |
| f7920 | 6f 6e 73 2e 0a 4e 61 6d 65 6c 79 2c 20 74 6f 20 73 65 71 75 65 6e 74 69 61 6c 6c 79 20 65 78 65 | ons..Namely,.to.sequentially.exe |
| f7940 | 63 75 74 65 20 60 61 27 20 61 6e 64 20 74 68 65 6e 20 60 62 27 2c 20 77 65 20 63 61 6c 6c 20 60 | cute.`a'.and.then.`b',.we.call.` |
| f7960 | 61 27 20 77 69 74 68 20 61 0a 73 75 63 63 65 73 73 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 74 | a'.with.a.success.continuation.t |
| f7980 | 68 61 74 20 63 61 6c 6c 73 20 60 62 27 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e | hat.calls.`b'........(define.(an |
| f79a0 | 61 6c 79 7a 65 2d 73 65 71 75 65 6e 63 65 20 65 78 70 73 29 0a 20 20 20 20 20 20 20 28 64 65 66 | alyze-sequence.exps)........(def |
| f79c0 | 69 6e 65 20 28 73 65 71 75 65 6e 74 69 61 6c 6c 79 20 61 20 62 29 0a 20 20 20 20 20 20 20 20 20 | ine.(sequentially.a.b).......... |
| f79e0 | 28 6c 61 6d 62 64 61 20 28 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 | (lambda.(env.succeed.fail)...... |
| f7a00 | 20 20 20 20 20 20 28 61 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 73 75 | ......(a.env...............;;.su |
| f7a20 | 63 63 65 73 73 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 66 6f 72 20 63 61 6c 6c 69 6e 67 20 60 | ccess.continuation.for.calling.` |
| f7a40 | 61 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 2d 76 61 6c 75 | a'...............(lambda.(a-valu |
| f7a60 | 65 20 66 61 69 6c 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 20 65 6e 76 20 | e.fail2).................(b.env. |
| f7a80 | 73 75 63 63 65 65 64 20 66 61 69 6c 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b | succeed.fail2))...............;; |
| f7aa0 | 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 66 6f 72 20 63 61 6c 6c 69 6e | .failure.continuation.for.callin |
| f7ac0 | 67 20 60 61 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 29 29 29 0a 20 20 20 20 | g.`a'...............fail)))..... |
| f7ae0 | 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 70 20 66 69 72 73 74 2d 70 72 6f 63 20 72 65 73 74 | ...(define.(loop.first-proc.rest |
| f7b00 | 2d 70 72 6f 63 73 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 73 74 | -procs)..........(if.(null?.rest |
| f7b20 | 2d 70 72 6f 63 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 66 69 72 73 74 2d 70 72 6f 63 0a | -procs)..............first-proc. |
| f7b40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 6f 6f 70 20 28 73 65 71 75 65 6e 74 69 61 6c 6c 79 | .............(loop.(sequentially |
| f7b60 | 20 66 69 72 73 74 2d 70 72 6f 63 20 28 63 61 72 20 72 65 73 74 2d 70 72 6f 63 73 29 29 0a 20 20 | .first-proc.(car.rest-procs))... |
| f7b80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 72 65 73 74 2d 70 72 6f 63 73 | .................(cdr.rest-procs |
| f7ba0 | 29 29 29 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 6f 63 73 20 28 6d 61 70 20 61 6e | ))))........(let.((procs.(map.an |
| f7bc0 | 61 6c 79 7a 65 20 65 78 70 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c | alyze.exps)))..........(if.(null |
| f7be0 | 3f 20 70 72 6f 63 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 45 6d | ?.procs)..............(error."Em |
| f7c00 | 70 74 79 20 73 65 71 75 65 6e 63 65 20 2d 2d 20 41 4e 41 4c 59 5a 45 22 29 29 0a 20 20 20 20 20 | pty.sequence.--.ANALYZE"))...... |
| f7c20 | 20 20 20 20 28 6c 6f 6f 70 20 28 63 61 72 20 70 72 6f 63 73 29 20 28 63 64 72 20 70 72 6f 63 73 | ....(loop.(car.procs).(cdr.procs |
| f7c40 | 29 29 29 29 0a 0a 44 65 66 69 6e 69 74 69 6f 6e 73 20 61 6e 64 20 61 73 73 69 67 6e 6d 65 6e 74 | ))))..Definitions.and.assignment |
| f7c60 | 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 44 | s..............................D |
| f7c80 | 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 61 6e 6f 74 68 65 72 20 63 61 73 65 20 77 68 65 72 | efinitions.are.another.case.wher |
| f7ca0 | 65 20 77 65 20 6d 75 73 74 20 67 6f 20 74 6f 20 73 6f 6d 65 20 74 72 6f 75 62 6c 65 20 74 6f 20 | e.we.must.go.to.some.trouble.to. |
| f7cc0 | 6d 61 6e 61 67 65 0a 74 68 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 73 2c 20 62 65 63 61 75 73 | manage.the.continuations,.becaus |
| f7ce0 | 65 20 69 74 20 69 73 20 6e 65 63 65 73 73 61 72 79 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 | e.it.is.necessary.to.evaluate.th |
| f7d00 | 65 0a 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 6c 75 65 20 65 78 70 72 65 73 73 69 6f 6e 20 62 65 | e.definition-value.expression.be |
| f7d20 | 66 6f 72 65 20 61 63 74 75 61 6c 6c 79 20 64 65 66 69 6e 69 6e 67 20 74 68 65 20 6e 65 77 20 76 | fore.actually.defining.the.new.v |
| f7d40 | 61 72 69 61 62 6c 65 2e 0a 54 6f 20 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 2c 20 74 68 65 | ariable..To.accomplish.this,.the |
| f7d60 | 20 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 6c 75 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 | .definition-value.execution.proc |
| f7d80 | 65 64 75 72 65 20 60 76 70 72 6f 63 27 20 69 73 0a 63 61 6c 6c 65 64 20 77 69 74 68 20 74 68 65 | edure.`vproc'.is.called.with.the |
| f7da0 | 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 61 20 73 75 63 63 65 73 73 20 63 6f 6e 74 69 6e 75 61 | .environment,.a.success.continua |
| f7dc0 | 74 69 6f 6e 2c 20 61 6e 64 20 74 68 65 20 66 61 69 6c 75 72 65 0a 63 6f 6e 74 69 6e 75 61 74 69 | tion,.and.the.failure.continuati |
| f7de0 | 6f 6e 2e 20 20 49 66 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 60 76 70 72 6f 63 27 | on...If.the.execution.of.`vproc' |
| f7e00 | 20 73 75 63 63 65 65 64 73 2c 20 6f 62 74 61 69 6e 69 6e 67 20 61 20 76 61 6c 75 65 0a 60 76 61 | .succeeds,.obtaining.a.value.`va |
| f7e20 | 6c 27 20 66 6f 72 20 74 68 65 20 64 65 66 69 6e 65 64 20 76 61 72 69 61 62 6c 65 2c 20 74 68 65 | l'.for.the.defined.variable,.the |
| f7e40 | 20 76 61 72 69 61 62 6c 65 20 69 73 20 64 65 66 69 6e 65 64 20 61 6e 64 20 74 68 65 20 73 75 63 | .variable.is.defined.and.the.suc |
| f7e60 | 63 65 73 73 0a 69 73 20 70 72 6f 70 61 67 61 74 65 64 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | cess.is.propagated:.......(defin |
| f7e80 | 65 20 28 61 6e 61 6c 79 7a 65 2d 64 65 66 69 6e 69 74 69 6f 6e 20 65 78 70 29 0a 20 20 20 20 20 | e.(analyze-definition.exp)...... |
| f7ea0 | 20 20 28 6c 65 74 20 28 28 76 61 72 20 28 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 72 69 61 62 6c | ..(let.((var.(definition-variabl |
| f7ec0 | 65 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 76 70 72 6f 63 20 28 61 6e 61 | e.exp))..............(vproc.(ana |
| f7ee0 | 6c 79 7a 65 20 28 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 6c 75 65 20 65 78 70 29 29 29 29 0a 20 | lyze.(definition-value.exp)))).. |
| f7f00 | 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 | ........(lambda.(env.succeed.fai |
| f7f20 | 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 76 70 72 6f 63 20 65 6e 76 0a 20 20 20 20 20 20 20 | l)............(vproc.env........ |
| f7f40 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 20 66 61 69 6c 32 29 0a 20 | ...........(lambda.(val.fail2).. |
| f7f60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 2d 76 61 72 69 61 | ...................(define-varia |
| f7f80 | 62 6c 65 21 20 76 61 72 20 76 61 6c 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ble!.var.val.env)............... |
| f7fa0 | 20 20 20 20 20 20 28 73 75 63 63 65 65 64 20 27 6f 6b 20 66 61 69 6c 32 29 29 0a 20 20 20 20 20 | ......(succeed.'ok.fail2))...... |
| f7fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 29 29 29 29 0a 0a 20 20 20 41 73 73 69 67 6e | .............fail)))).....Assign |
| f7fe0 | 6d 65 6e 74 73 20 61 72 65 20 6d 6f 72 65 20 69 6e 74 65 72 65 73 74 69 6e 67 2e 20 20 54 68 69 | ments.are.more.interesting...Thi |
| f8000 | 73 20 69 73 20 74 68 65 20 66 69 72 73 74 20 70 6c 61 63 65 20 77 68 65 72 65 20 77 65 0a 72 65 | s.is.the.first.place.where.we.re |
| f8020 | 61 6c 6c 79 20 75 73 65 20 74 68 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 73 2c 20 72 61 74 68 | ally.use.the.continuations,.rath |
| f8040 | 65 72 20 74 68 61 6e 20 6a 75 73 74 20 70 61 73 73 69 6e 67 20 74 68 65 6d 20 61 72 6f 75 6e 64 | er.than.just.passing.them.around |
| f8060 | 2e 0a 54 68 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 61 73 | ..The.execution.procedure.for.as |
| f8080 | 73 69 67 6e 6d 65 6e 74 73 20 73 74 61 72 74 73 20 6f 75 74 20 6c 69 6b 65 20 74 68 65 20 6f 6e | signments.starts.out.like.the.on |
| f80a0 | 65 20 66 6f 72 0a 64 65 66 69 6e 69 74 69 6f 6e 73 2e 20 20 49 74 20 66 69 72 73 74 20 61 74 74 | e.for.definitions...It.first.att |
| f80c0 | 65 6d 70 74 73 20 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 6e 65 77 20 76 61 6c 75 65 20 74 6f | empts.to.obtain.the.new.value.to |
| f80e0 | 20 62 65 20 61 73 73 69 67 6e 65 64 0a 74 6f 20 74 68 65 20 76 61 72 69 61 62 6c 65 2e 20 49 66 | .be.assigned.to.the.variable..If |
| f8100 | 20 74 68 69 73 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 60 76 70 72 6f 63 27 20 66 61 69 6c | .this.evaluation.of.`vproc'.fail |
| f8120 | 73 2c 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 0a 66 61 69 6c 73 2e 0a 0a 20 20 20 49 66 20 | s,.the.assignment.fails......If. |
| f8140 | 60 76 70 72 6f 63 27 20 73 75 63 63 65 65 64 73 2c 20 68 6f 77 65 76 65 72 2c 20 61 6e 64 20 77 | `vproc'.succeeds,.however,.and.w |
| f8160 | 65 20 67 6f 20 6f 6e 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 2c 0a | e.go.on.to.make.the.assignment,. |
| f8180 | 77 65 20 6d 75 73 74 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 70 6f 73 73 69 62 69 6c 69 74 79 | we.must.consider.the.possibility |
| f81a0 | 20 74 68 61 74 20 74 68 69 73 20 62 72 61 6e 63 68 20 6f 66 20 74 68 65 20 63 6f 6d 70 75 74 61 | .that.this.branch.of.the.computa |
| f81c0 | 74 69 6f 6e 0a 6d 69 67 68 74 20 6c 61 74 65 72 20 66 61 69 6c 2c 20 77 68 69 63 68 20 77 69 6c | tion.might.later.fail,.which.wil |
| f81e0 | 6c 20 72 65 71 75 69 72 65 20 75 73 20 74 6f 20 62 61 63 6b 74 72 61 63 6b 20 6f 75 74 20 6f 66 | l.require.us.to.backtrack.out.of |
| f8200 | 20 74 68 65 0a 61 73 73 69 67 6e 6d 65 6e 74 2e 20 20 54 68 75 73 2c 20 77 65 20 6d 75 73 74 20 | .the.assignment...Thus,.we.must. |
| f8220 | 61 72 72 61 6e 67 65 20 74 6f 20 75 6e 64 6f 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 20 61 | arrange.to.undo.the.assignment.a |
| f8240 | 73 20 70 61 72 74 20 6f 66 0a 74 68 65 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 20 70 72 6f 63 65 | s.part.of.the.backtracking.proce |
| f8260 | 73 73 2e 28 33 29 0a 0a 20 20 20 54 68 69 73 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 | ss.(3).....This.is.accomplished. |
| f8280 | 62 79 20 67 69 76 69 6e 67 20 60 76 70 72 6f 63 27 20 61 20 73 75 63 63 65 73 73 20 63 6f 6e 74 | by.giving.`vproc'.a.success.cont |
| f82a0 | 69 6e 75 61 74 69 6f 6e 0a 28 6d 61 72 6b 65 64 20 77 69 74 68 20 74 68 65 20 63 6f 6d 6d 65 6e | inuation.(marked.with.the.commen |
| f82c0 | 74 20 22 2a 31 2a 22 20 62 65 6c 6f 77 29 20 74 68 61 74 20 73 61 76 65 73 20 74 68 65 20 6f 6c | t."*1*".below).that.saves.the.ol |
| f82e0 | 64 20 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 76 61 72 69 61 62 6c 65 20 62 65 66 6f 72 65 20 61 | d.value.of.the.variable.before.a |
| f8300 | 73 73 69 67 6e 69 6e 67 20 74 68 65 20 6e 65 77 20 76 61 6c 75 65 20 74 6f 20 74 68 65 20 76 61 | ssigning.the.new.value.to.the.va |
| f8320 | 72 69 61 62 6c 65 20 61 6e 64 20 70 72 6f 63 65 65 64 69 6e 67 0a 66 72 6f 6d 20 74 68 65 20 61 | riable.and.proceeding.from.the.a |
| f8340 | 73 73 69 67 6e 6d 65 6e 74 2e 20 20 54 68 65 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 | ssignment...The.failure.continua |
| f8360 | 74 69 6f 6e 20 74 68 61 74 20 69 73 20 70 61 73 73 65 64 20 61 6c 6f 6e 67 0a 77 69 74 68 20 74 | tion.that.is.passed.along.with.t |
| f8380 | 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 20 28 6d 61 72 6b | he.value.of.the.assignment.(mark |
| f83a0 | 65 64 20 77 69 74 68 20 74 68 65 20 63 6f 6d 6d 65 6e 74 20 22 2a 32 2a 22 20 62 65 6c 6f 77 29 | ed.with.the.comment."*2*".below) |
| f83c0 | 0a 72 65 73 74 6f 72 65 73 20 74 68 65 20 6f 6c 64 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 76 | .restores.the.old.value.of.the.v |
| f83e0 | 61 72 69 61 62 6c 65 20 62 65 66 6f 72 65 20 63 6f 6e 74 69 6e 75 69 6e 67 20 74 68 65 20 66 61 | ariable.before.continuing.the.fa |
| f8400 | 69 6c 75 72 65 2e 0a 54 68 61 74 20 69 73 2c 20 61 20 73 75 63 63 65 73 73 66 75 6c 20 61 73 73 | ilure..That.is,.a.successful.ass |
| f8420 | 69 67 6e 6d 65 6e 74 20 70 72 6f 76 69 64 65 73 20 61 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 | ignment.provides.a.failure.conti |
| f8440 | 6e 75 61 74 69 6f 6e 20 74 68 61 74 0a 77 69 6c 6c 20 69 6e 74 65 72 63 65 70 74 20 61 20 73 75 | nuation.that.will.intercept.a.su |
| f8460 | 62 73 65 71 75 65 6e 74 20 66 61 69 6c 75 72 65 3b 20 77 68 61 74 65 76 65 72 20 66 61 69 6c 75 | bsequent.failure;.whatever.failu |
| f8480 | 72 65 20 77 6f 75 6c 64 20 6f 74 68 65 72 77 69 73 65 0a 68 61 76 65 20 63 61 6c 6c 65 64 20 60 | re.would.otherwise.have.called.` |
| f84a0 | 66 61 69 6c 32 27 20 63 61 6c 6c 73 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 69 6e 73 74 | fail2'.calls.this.procedure.inst |
| f84c0 | 65 61 64 2c 20 74 6f 20 75 6e 64 6f 20 74 68 65 0a 61 73 73 69 67 6e 6d 65 6e 74 20 62 65 66 6f | ead,.to.undo.the.assignment.befo |
| f84e0 | 72 65 20 61 63 74 75 61 6c 6c 79 20 63 61 6c 6c 69 6e 67 20 60 66 61 69 6c 32 27 2e 0a 0a 20 20 | re.actually.calling.`fail2'..... |
| f8500 | 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 61 73 73 69 67 6e 6d 65 6e 74 20 65 | ...(define.(analyze-assignment.e |
| f8520 | 78 70 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 76 61 72 20 28 61 73 73 69 67 6e 6d 65 6e | xp)........(let.((var.(assignmen |
| f8540 | 74 2d 76 61 72 69 61 62 6c 65 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 76 | t-variable.exp))..............(v |
| f8560 | 70 72 6f 63 20 28 61 6e 61 6c 79 7a 65 20 28 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 6c 75 65 20 | proc.(analyze.(assignment-value. |
| f8580 | 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 20 73 75 | exp))))..........(lambda.(env.su |
| f85a0 | 63 63 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 76 70 72 6f 63 20 65 6e | cceed.fail)............(vproc.en |
| f85c0 | 76 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 76 61 6c | v...................(lambda.(val |
| f85e0 | 20 66 61 69 6c 32 29 20 20 20 20 20 20 20 20 3b 20 2a 31 2a 0a 20 20 20 20 20 20 20 20 20 20 20 | .fail2)........;.*1*............ |
| f8600 | 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6f 6c 64 2d 76 61 6c 75 65 0a 20 20 20 20 20 20 | .........(let.((old-value....... |
| f8620 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 6f 6f 6b 75 70 2d 76 61 72 | .....................(lookup-var |
| f8640 | 69 61 62 6c 65 2d 76 61 6c 75 65 20 76 61 72 20 65 6e 76 29 29 29 0a 20 20 20 20 20 20 20 20 20 | iable-value.var.env))).......... |
| f8660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 | .............(set-variable-value |
| f8680 | 21 20 76 61 72 20 76 61 6c 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | !.var.val.env).................. |
| f86a0 | 20 20 20 20 20 28 73 75 63 63 65 65 64 20 27 6f 6b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....(succeed.'ok............... |
| f86c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 20 20 20 3b | .................(lambda.()....; |
| f86e0 | 20 2a 32 2a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*2*............................ |
| f8700 | 20 20 20 20 20 20 28 73 65 74 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 21 20 76 61 72 0a 20 | ......(set-variable-value!.var.. |
| f8720 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| f8740 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6f 6c 64 2d 76 61 6c 75 65 0a 20 | .....................old-value.. |
| f8760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| f8780 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 6e 76 29 0a 20 20 20 20 20 20 | .....................env)....... |
| f87a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 61 69 6c | ...........................(fail |
| f87c0 | 32 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 29 29 29 | 2)))))...................fail))) |
| f87e0 | 29 0a 0a 50 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e | )..Procedure.applications....... |
| f8800 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 65 78 65 63 75 74 69 6f 6e 20 | ..................The.execution. |
| f8820 | 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 63 6f 6e 74 61 | procedure.for.applications.conta |
| f8840 | 69 6e 73 20 6e 6f 20 6e 65 77 20 69 64 65 61 73 20 65 78 63 65 70 74 0a 66 6f 72 20 74 68 65 20 | ins.no.new.ideas.except.for.the. |
| f8860 | 74 65 63 68 6e 69 63 61 6c 20 63 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 6d 61 6e 61 67 69 6e 67 | technical.complexity.of.managing |
| f8880 | 20 74 68 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 73 2e 20 20 54 68 69 73 0a 63 6f 6d 70 6c 65 | .the.continuations...This.comple |
| f88a0 | 78 69 74 79 20 61 72 69 73 65 73 20 69 6e 20 60 61 6e 61 6c 79 7a 65 2d 61 70 70 6c 69 63 61 74 | xity.arises.in.`analyze-applicat |
| f88c0 | 69 6f 6e 27 2c 20 64 75 65 20 74 6f 20 74 68 65 20 6e 65 65 64 20 74 6f 20 6b 65 65 70 0a 74 72 | ion',.due.to.the.need.to.keep.tr |
| f88e0 | 61 63 6b 20 6f 66 20 74 68 65 20 73 75 63 63 65 73 73 20 61 6e 64 20 66 61 69 6c 75 72 65 20 63 | ack.of.the.success.and.failure.c |
| f8900 | 6f 6e 74 69 6e 75 61 74 69 6f 6e 73 20 61 73 20 77 65 20 65 76 61 6c 75 61 74 65 20 74 68 65 0a | ontinuations.as.we.evaluate.the. |
| f8920 | 6f 70 65 72 61 6e 64 73 2e 20 20 57 65 20 75 73 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 67 | operands...We.use.a.procedure.`g |
| f8940 | 65 74 2d 61 72 67 73 27 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 6c 69 73 74 20 6f 66 | et-args'.to.evaluate.the.list.of |
| f8960 | 0a 6f 70 65 72 61 6e 64 73 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 20 73 69 6d 70 6c 65 20 | .operands,.rather.than.a.simple. |
| f8980 | 60 6d 61 70 27 20 61 73 20 69 6e 20 74 68 65 20 6f 72 64 69 6e 61 72 79 20 65 76 61 6c 75 61 74 | `map'.as.in.the.ordinary.evaluat |
| f89a0 | 6f 72 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 61 70 70 6c 69 | or........(define.(analyze-appli |
| f89c0 | 63 61 74 69 6f 6e 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 66 70 72 6f 63 20 | cation.exp)........(let.((fproc. |
| f89e0 | 28 61 6e 61 6c 79 7a 65 20 28 6f 70 65 72 61 74 6f 72 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 | (analyze.(operator.exp)))....... |
| f8a00 | 20 20 20 20 20 20 20 28 61 70 72 6f 63 73 20 28 6d 61 70 20 61 6e 61 6c 79 7a 65 20 28 6f 70 65 | .......(aprocs.(map.analyze.(ope |
| f8a20 | 72 61 6e 64 73 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 | rands.exp))))..........(lambda.( |
| f8a40 | 65 6e 76 20 73 75 63 63 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 66 70 | env.succeed.fail)............(fp |
| f8a60 | 72 6f 63 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 | roc.env...................(lambd |
| f8a80 | 61 20 28 70 72 6f 63 20 66 61 69 6c 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | a.(proc.fail2).................. |
| f8aa0 | 20 20 20 28 67 65 74 2d 61 72 67 73 20 61 70 72 6f 63 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ...(get-args.aprocs............. |
| f8ac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 20 | ..................env........... |
| f8ae0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 72 67 | ....................(lambda.(arg |
| f8b00 | 73 20 66 61 69 6c 33 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | s.fail3)........................ |
| f8b20 | 20 20 20 20 20 20 20 20 20 28 65 78 65 63 75 74 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 0a 20 20 | .........(execute-application... |
| f8b40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 | ...............................p |
| f8b60 | 72 6f 63 20 61 72 67 73 20 73 75 63 63 65 65 64 20 66 61 69 6c 33 29 29 0a 20 20 20 20 20 20 20 | roc.args.succeed.fail3))........ |
| f8b80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 32 29 29 0a 20 | .......................fail2)).. |
| f8ba0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 29 29 29 29 0a 0a 20 20 20 49 6e | .................fail)))).....In |
| f8bc0 | 20 60 67 65 74 2d 61 72 67 73 27 2c 20 6e 6f 74 69 63 65 20 68 6f 77 20 60 63 64 72 27 69 6e 67 | .`get-args',.notice.how.`cdr'ing |
| f8be0 | 20 64 6f 77 6e 20 74 68 65 20 6c 69 73 74 20 6f 66 20 60 61 70 72 6f 63 27 0a 65 78 65 63 75 74 | .down.the.list.of.`aproc'.execut |
| f8c00 | 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 60 63 6f 6e 73 27 69 6e 67 20 75 70 20 | ion.procedures.and.`cons'ing.up. |
| f8c20 | 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 6c 69 73 74 20 6f 66 20 60 61 72 67 73 27 20 69 73 0a | the.resulting.list.of.`args'.is. |
| f8c40 | 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 63 61 6c 6c 69 6e 67 20 65 61 63 68 20 60 61 70 | accomplished.by.calling.each.`ap |
| f8c60 | 72 6f 63 27 20 69 6e 20 74 68 65 20 6c 69 73 74 20 77 69 74 68 20 61 20 73 75 63 63 65 73 73 0a | roc'.in.the.list.with.a.success. |
| f8c80 | 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 74 68 61 74 20 72 65 63 75 72 73 69 76 65 6c 79 20 63 61 | continuation.that.recursively.ca |
| f8ca0 | 6c 6c 73 20 60 67 65 74 2d 61 72 67 73 27 2e 20 20 45 61 63 68 20 6f 66 20 74 68 65 73 65 20 72 | lls.`get-args'...Each.of.these.r |
| f8cc0 | 65 63 75 72 73 69 76 65 0a 63 61 6c 6c 73 20 74 6f 20 60 67 65 74 2d 61 72 67 73 27 20 68 61 73 | ecursive.calls.to.`get-args'.has |
| f8ce0 | 20 61 20 73 75 63 63 65 73 73 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 77 68 6f 73 65 20 76 61 | .a.success.continuation.whose.va |
| f8d00 | 6c 75 65 20 69 73 20 74 68 65 0a 60 63 6f 6e 73 27 20 6f 66 20 74 68 65 20 6e 65 77 6c 79 20 6f | lue.is.the.`cons'.of.the.newly.o |
| f8d20 | 62 74 61 69 6e 65 64 20 61 72 67 75 6d 65 6e 74 20 6f 6e 74 6f 20 74 68 65 20 6c 69 73 74 20 6f | btained.argument.onto.the.list.o |
| f8d40 | 66 20 61 63 63 75 6d 75 6c 61 74 65 64 0a 61 72 67 75 6d 65 6e 74 73 3a 0a 0a 20 20 20 20 20 28 | f.accumulated.arguments:.......( |
| f8d60 | 64 65 66 69 6e 65 20 28 67 65 74 2d 61 72 67 73 20 61 70 72 6f 63 73 20 65 6e 76 20 73 75 63 63 | define.(get-args.aprocs.env.succ |
| f8d80 | 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 61 70 72 6f | eed.fail)........(if.(null?.apro |
| f8da0 | 63 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 75 63 63 65 65 64 20 27 28 29 20 66 61 69 6c | cs)............(succeed.'().fail |
| f8dc0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 28 63 61 72 20 61 70 72 6f 63 73 29 20 65 6e 76 0a 20 | )............((car.aprocs).env.. |
| f8de0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 73 75 63 63 65 | ........................;;.succe |
| f8e00 | 73 73 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 66 6f 72 20 74 68 69 73 20 60 61 70 72 6f 63 27 | ss.continuation.for.this.`aproc' |
| f8e20 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 | ..........................(lambd |
| f8e40 | 61 20 28 61 72 67 20 66 61 69 6c 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | a.(arg.fail2)................... |
| f8e60 | 20 20 20 20 20 20 20 20 20 28 67 65 74 2d 61 72 67 73 20 28 63 64 72 20 61 70 72 6f 63 73 29 0a | .........(get-args.(cdr.aprocs). |
| f8e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| f8ea0 | 20 20 20 20 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....env........................ |
| f8ec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 73 75 63 63 65 73 73 20 63 6f 6e 74 69 6e 75 | ..............;;.success.continu |
| f8ee0 | 61 74 69 6f 6e 20 66 6f 72 20 72 65 63 75 72 73 69 76 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ation.for.recursive............. |
| f8f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 61 6c 6c | .........................;;.call |
| f8f20 | 20 74 6f 20 60 67 65 74 2d 61 72 67 73 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .to.`get-args'.................. |
| f8f40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 72 67 | ....................(lambda.(arg |
| f8f60 | 73 20 66 61 69 6c 33 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | s.fail3)........................ |
| f8f80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 75 63 63 65 65 64 20 28 63 6f 6e 73 20 61 | ................(succeed.(cons.a |
| f8fa0 | 72 67 20 61 72 67 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rg.args)........................ |
| f8fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 33 29 29 | .........................fail3)) |
| f8fe0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| f9000 | 20 20 20 20 20 20 66 61 69 6c 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......fail2))................... |
| f9020 | 20 20 20 20 20 20 20 66 61 69 6c 29 29 29 0a 0a 20 20 20 54 68 65 20 61 63 74 75 61 6c 20 70 72 | .......fail))).....The.actual.pr |
| f9040 | 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 77 68 69 63 68 20 69 73 20 70 65 | ocedure.application,.which.is.pe |
| f9060 | 72 66 6f 72 6d 65 64 20 62 79 0a 60 65 78 65 63 75 74 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 27 | rformed.by.`execute-application' |
| f9080 | 2c 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 69 6e 20 74 68 65 20 73 61 6d 65 20 77 61 | ,.is.accomplished.in.the.same.wa |
| f90a0 | 79 20 61 73 20 66 6f 72 20 74 68 65 0a 6f 72 64 69 6e 61 72 79 20 65 76 61 6c 75 61 74 6f 72 2c | y.as.for.the.ordinary.evaluator, |
| f90c0 | 20 65 78 63 65 70 74 20 66 6f 72 20 74 68 65 20 6e 65 65 64 20 74 6f 20 6d 61 6e 61 67 65 20 74 | .except.for.the.need.to.manage.t |
| f90e0 | 68 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | he.continuations........(define. |
| f9100 | 28 65 78 65 63 75 74 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 20 70 72 6f 63 20 61 72 67 73 20 73 | (execute-application.proc.args.s |
| f9120 | 75 63 63 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 70 72 69 6d | ucceed.fail)........(cond.((prim |
| f9140 | 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 | itive-procedure?.proc).......... |
| f9160 | 20 20 20 20 20 28 73 75 63 63 65 65 64 20 28 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 | .....(succeed.(apply-primitive-p |
| f9180 | 72 6f 63 65 64 75 72 65 20 70 72 6f 63 20 61 72 67 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | rocedure.proc.args)............. |
| f91a0 | 20 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ...........fail))..............( |
| f91c0 | 28 63 6f 6d 70 6f 75 6e 64 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 29 0a 20 20 20 20 20 | (compound-procedure?.proc)...... |
| f91e0 | 20 20 20 20 20 20 20 20 20 28 28 70 72 6f 63 65 64 75 72 65 2d 62 6f 64 79 20 70 72 6f 63 29 0a | .........((procedure-body.proc). |
| f9200 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 | ...............(extend-environme |
| f9220 | 6e 74 20 28 70 72 6f 63 65 64 75 72 65 2d 70 61 72 61 6d 65 74 65 72 73 20 70 72 6f 63 29 0a 20 | nt.(procedure-parameters.proc).. |
| f9240 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| f9260 | 20 20 61 72 67 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..args.......................... |
| f9280 | 20 20 20 20 20 20 20 20 20 20 28 70 72 6f 63 65 64 75 72 65 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 | ..........(procedure-environment |
| f92a0 | 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 75 63 63 65 65 64 0a 20 | .proc))................succeed.. |
| f92c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ..............fail))............ |
| f92e0 | 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 0a 20 20 20 | ..(else...............(error.... |
| f9300 | 20 20 20 20 20 20 20 20 20 20 20 20 22 55 6e 6b 6e 6f 77 6e 20 70 72 6f 63 65 64 75 72 65 20 74 | ............"Unknown.procedure.t |
| f9320 | 79 70 65 20 2d 2d 20 45 58 45 43 55 54 45 2d 41 50 50 4c 49 43 41 54 49 4f 4e 22 0a 20 20 20 20 | ype.--.EXECUTE-APPLICATION"..... |
| f9340 | 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 29 29 29 29 0a 0a 45 76 61 6c 75 61 74 69 6e 67 20 | ...........proc))))..Evaluating. |
| f9360 | 60 61 6d 62 27 20 65 78 70 72 65 73 73 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | `amb'.expressions............... |
| f9380 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 60 61 6d 62 27 20 73 70 65 63 69 61 | ................The.`amb'.specia |
| f93a0 | 6c 20 66 6f 72 6d 20 69 73 20 74 68 65 20 6b 65 79 20 65 6c 65 6d 65 6e 74 20 69 6e 20 74 68 65 | l.form.is.the.key.element.in.the |
| f93c0 | 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 0a 6c 61 6e 67 75 61 67 65 2e 20 20 48 65 72 | .nondeterministic.language...Her |
| f93e0 | 65 20 77 65 20 73 65 65 20 74 68 65 20 65 73 73 65 6e 63 65 20 6f 66 20 74 68 65 20 69 6e 74 65 | e.we.see.the.essence.of.the.inte |
| f9400 | 72 70 72 65 74 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 61 6e 64 0a 74 68 65 20 72 65 61 73 6f | rpretation.process.and.the.reaso |
| f9420 | 6e 20 66 6f 72 20 6b 65 65 70 69 6e 67 20 74 72 61 63 6b 20 6f 66 20 74 68 65 20 63 6f 6e 74 69 | n.for.keeping.track.of.the.conti |
| f9440 | 6e 75 61 74 69 6f 6e 73 2e 20 20 54 68 65 20 65 78 65 63 75 74 69 6f 6e 0a 70 72 6f 63 65 64 75 | nuations...The.execution.procedu |
| f9460 | 72 65 20 66 6f 72 20 60 61 6d 62 27 20 64 65 66 69 6e 65 73 20 61 20 6c 6f 6f 70 20 60 74 72 79 | re.for.`amb'.defines.a.loop.`try |
| f9480 | 2d 6e 65 78 74 27 20 74 68 61 74 20 63 79 63 6c 65 73 20 74 68 72 6f 75 67 68 20 74 68 65 0a 65 | -next'.that.cycles.through.the.e |
| f94a0 | 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 61 6c 6c 20 74 68 65 20 | xecution.procedures.for.all.the. |
| f94c0 | 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 60 61 6d 62 27 0a 65 78 70 | possible.values.of.the.`amb'.exp |
| f94e0 | 72 65 73 73 69 6f 6e 2e 20 20 45 61 63 68 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 | ression...Each.execution.procedu |
| f9500 | 72 65 20 69 73 20 63 61 6c 6c 65 64 20 77 69 74 68 20 61 20 66 61 69 6c 75 72 65 0a 63 6f 6e 74 | re.is.called.with.a.failure.cont |
| f9520 | 69 6e 75 61 74 69 6f 6e 20 74 68 61 74 20 77 69 6c 6c 20 74 72 79 20 74 68 65 20 6e 65 78 74 20 | inuation.that.will.try.the.next. |
| f9540 | 6f 6e 65 2e 20 20 57 68 65 6e 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 6d 6f 72 65 0a 61 6c 74 | one...When.there.are.no.more.alt |
| f9560 | 65 72 6e 61 74 69 76 65 73 20 74 6f 20 74 72 79 2c 20 74 68 65 20 65 6e 74 69 72 65 20 60 61 6d | ernatives.to.try,.the.entire.`am |
| f9580 | 62 27 20 65 78 70 72 65 73 73 69 6f 6e 20 66 61 69 6c 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 | b'.expression.fails........(defi |
| f95a0 | 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 61 6d 62 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 6c 65 74 | ne.(analyze-amb.exp)........(let |
| f95c0 | 20 28 28 63 70 72 6f 63 73 20 28 6d 61 70 20 61 6e 61 6c 79 7a 65 20 28 61 6d 62 2d 63 68 6f 69 | .((cprocs.(map.analyze.(amb-choi |
| f95e0 | 63 65 73 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e | ces.exp))))..........(lambda.(en |
| f9600 | 76 20 73 75 63 63 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 | v.succeed.fail)............(defi |
| f9620 | 6e 65 20 28 74 72 79 2d 6e 65 78 74 20 63 68 6f 69 63 65 73 29 0a 20 20 20 20 20 20 20 20 20 20 | ne.(try-next.choices)........... |
| f9640 | 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 63 68 6f 69 63 65 73 29 0a 20 20 20 20 20 20 20 20 20 | ...(if.(null?.choices).......... |
| f9660 | 20 20 20 20 20 20 20 20 28 66 61 69 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ........(fail).................. |
| f9680 | 28 28 63 61 72 20 63 68 6f 69 63 65 73 29 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ((car.choices).env.............. |
| f96a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 75 63 63 65 65 64 0a 20 20 20 20 20 | ...................succeed...... |
| f96c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 | ...........................(lamb |
| f96e0 | 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | da.()........................... |
| f9700 | 20 20 20 20 20 20 20 20 28 74 72 79 2d 6e 65 78 74 20 28 63 64 72 20 63 68 6f 69 63 65 73 29 29 | ........(try-next.(cdr.choices)) |
| f9720 | 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 74 72 79 2d 6e 65 78 74 20 63 70 72 6f 63 73 | ))))............(try-next.cprocs |
| f9740 | 29 29 29 29 0a 0a 44 72 69 76 65 72 20 6c 6f 6f 70 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 | ))))..Driver.loop..............T |
| f9760 | 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 20 66 6f 72 20 74 68 65 20 60 61 6d 62 27 20 65 76 61 | he.driver.loop.for.the.`amb'.eva |
| f9780 | 6c 75 61 74 6f 72 20 69 73 20 63 6f 6d 70 6c 65 78 2c 20 64 75 65 20 74 6f 20 74 68 65 20 6d 65 | luator.is.complex,.due.to.the.me |
| f97a0 | 63 68 61 6e 69 73 6d 0a 74 68 61 74 20 70 65 72 6d 69 74 73 20 74 68 65 20 75 73 65 72 20 74 6f | chanism.that.permits.the.user.to |
| f97c0 | 20 74 72 79 20 61 67 61 69 6e 20 69 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 61 6e 20 65 78 70 72 | .try.again.in.evaluating.an.expr |
| f97e0 | 65 73 73 69 6f 6e 2e 20 20 54 68 65 0a 64 72 69 76 65 72 20 75 73 65 73 20 61 20 70 72 6f 63 65 | ession...The.driver.uses.a.proce |
| f9800 | 64 75 72 65 20 63 61 6c 6c 65 64 20 60 69 6e 74 65 72 6e 61 6c 2d 6c 6f 6f 70 27 2c 20 77 68 69 | dure.called.`internal-loop',.whi |
| f9820 | 63 68 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 0a 61 20 70 72 6f 63 65 64 75 72 65 | ch.takes.as.argument.a.procedure |
| f9840 | 20 60 74 72 79 2d 61 67 61 69 6e 27 2e 20 20 54 68 65 20 69 6e 74 65 6e 74 20 69 73 20 74 68 61 | .`try-again'...The.intent.is.tha |
| f9860 | 74 20 63 61 6c 6c 69 6e 67 20 60 74 72 79 2d 61 67 61 69 6e 27 20 73 68 6f 75 6c 64 0a 67 6f 20 | t.calling.`try-again'.should.go. |
| f9880 | 6f 6e 20 74 6f 20 74 68 65 20 6e 65 78 74 20 75 6e 74 72 69 65 64 20 61 6c 74 65 72 6e 61 74 69 | on.to.the.next.untried.alternati |
| f98a0 | 76 65 20 69 6e 20 74 68 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 0a 65 76 61 6c 75 | ve.in.the.nondeterministic.evalu |
| f98c0 | 61 74 69 6f 6e 2e 20 20 60 49 6e 74 65 72 6e 61 6c 2d 6c 6f 6f 70 27 20 65 69 74 68 65 72 20 63 | ation...`Internal-loop'.either.c |
| f98e0 | 61 6c 6c 73 20 60 74 72 79 2d 61 67 61 69 6e 27 20 69 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 0a | alls.`try-again'.in.response.to. |
| f9900 | 74 68 65 20 75 73 65 72 20 74 79 70 69 6e 67 20 60 74 72 79 2d 61 67 61 69 6e 27 20 61 74 20 74 | the.user.typing.`try-again'.at.t |
| f9920 | 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 2c 20 6f 72 20 65 6c 73 65 20 73 74 61 72 74 73 20 61 | he.driver.loop,.or.else.starts.a |
| f9940 | 20 6e 65 77 0a 65 76 61 6c 75 61 74 69 6f 6e 20 62 79 20 63 61 6c 6c 69 6e 67 20 60 61 6d 62 65 | .new.evaluation.by.calling.`ambe |
| f9960 | 76 61 6c 27 2e 0a 0a 20 20 20 54 68 65 20 66 61 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 | val'......The.failure.continuati |
| f9980 | 6f 6e 20 66 6f 72 20 74 68 69 73 20 63 61 6c 6c 20 74 6f 20 60 61 6d 62 65 76 61 6c 27 20 69 6e | on.for.this.call.to.`ambeval'.in |
| f99a0 | 66 6f 72 6d 73 20 74 68 65 20 75 73 65 72 0a 74 68 61 74 20 74 68 65 72 65 20 61 72 65 20 6e 6f | forms.the.user.that.there.are.no |
| f99c0 | 20 6d 6f 72 65 20 76 61 6c 75 65 73 20 61 6e 64 20 72 65 2d 69 6e 76 6f 6b 65 73 20 74 68 65 20 | .more.values.and.re-invokes.the. |
| f99e0 | 64 72 69 76 65 72 20 6c 6f 6f 70 2e 0a 0a 20 20 20 54 68 65 20 73 75 63 63 65 73 73 20 63 6f 6e | driver.loop......The.success.con |
| f9a00 | 74 69 6e 75 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 63 61 6c 6c 20 74 6f 20 60 61 6d 62 65 76 | tinuation.for.the.call.to.`ambev |
| f9a20 | 61 6c 27 20 69 73 20 6d 6f 72 65 20 73 75 62 74 6c 65 2e 0a 57 65 20 70 72 69 6e 74 20 74 68 65 | al'.is.more.subtle..We.print.the |
| f9a40 | 20 6f 62 74 61 69 6e 65 64 20 76 61 6c 75 65 20 61 6e 64 20 74 68 65 6e 20 69 6e 76 6f 6b 65 20 | .obtained.value.and.then.invoke. |
| f9a60 | 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 6c 6f 6f 70 20 61 67 61 69 6e 0a 77 69 74 68 20 61 20 60 | the.internal.loop.again.with.a.` |
| f9a80 | 74 72 79 2d 61 67 61 69 6e 27 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 77 69 6c 6c 20 62 | try-again'.procedure.that.will.b |
| f9aa0 | 65 20 61 62 6c 65 20 74 6f 20 74 72 79 20 74 68 65 20 6e 65 78 74 0a 61 6c 74 65 72 6e 61 74 69 | e.able.to.try.the.next.alternati |
| f9ac0 | 76 65 2e 20 20 54 68 69 73 20 60 6e 65 78 74 2d 61 6c 74 65 72 6e 61 74 69 76 65 27 20 70 72 6f | ve...This.`next-alternative'.pro |
| f9ae0 | 63 65 64 75 72 65 20 69 73 20 74 68 65 20 73 65 63 6f 6e 64 20 61 72 67 75 6d 65 6e 74 0a 74 68 | cedure.is.the.second.argument.th |
| f9b00 | 61 74 20 77 61 73 20 70 61 73 73 65 64 20 74 6f 20 74 68 65 20 73 75 63 63 65 73 73 20 63 6f 6e | at.was.passed.to.the.success.con |
| f9b20 | 74 69 6e 75 61 74 69 6f 6e 2e 20 20 4f 72 64 69 6e 61 72 69 6c 79 2c 20 77 65 20 74 68 69 6e 6b | tinuation...Ordinarily,.we.think |
| f9b40 | 20 6f 66 0a 74 68 69 73 20 73 65 63 6f 6e 64 20 61 72 67 75 6d 65 6e 74 20 61 73 20 61 20 66 61 | .of.this.second.argument.as.a.fa |
| f9b60 | 69 6c 75 72 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 74 6f 20 62 65 20 75 73 65 64 20 69 66 | ilure.continuation.to.be.used.if |
| f9b80 | 20 74 68 65 0a 63 75 72 72 65 6e 74 20 65 76 61 6c 75 61 74 69 6f 6e 20 62 72 61 6e 63 68 20 6c | .the.current.evaluation.branch.l |
| f9ba0 | 61 74 65 72 20 66 61 69 6c 73 2e 20 20 49 6e 20 74 68 69 73 20 63 61 73 65 2c 20 68 6f 77 65 76 | ater.fails...In.this.case,.howev |
| f9bc0 | 65 72 2c 20 77 65 20 68 61 76 65 0a 63 6f 6d 70 6c 65 74 65 64 20 61 20 73 75 63 63 65 73 73 66 | er,.we.have.completed.a.successf |
| f9be0 | 75 6c 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 73 6f 20 77 65 20 63 61 6e 20 69 6e 76 6f 6b 65 20 | ul.evaluation,.so.we.can.invoke. |
| f9c00 | 74 68 65 20 22 66 61 69 6c 75 72 65 22 0a 61 6c 74 65 72 6e 61 74 69 76 65 20 62 72 61 6e 63 68 | the."failure".alternative.branch |
| f9c20 | 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 73 65 61 72 63 68 20 66 6f 72 20 61 64 64 69 74 69 6f 6e | .in.order.to.search.for.addition |
| f9c40 | 61 6c 20 73 75 63 63 65 73 73 66 75 6c 0a 65 76 61 6c 75 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 | al.successful.evaluations....... |
| f9c60 | 20 28 64 65 66 69 6e 65 20 69 6e 70 75 74 2d 70 72 6f 6d 70 74 20 22 3b 3b 3b 20 41 6d 62 2d 45 | .(define.input-prompt.";;;.Amb-E |
| f9c80 | 76 61 6c 20 69 6e 70 75 74 3a 22 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6f 75 74 70 75 74 | val.input:")......(define.output |
| f9ca0 | 2d 70 72 6f 6d 70 74 20 22 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 76 61 6c 75 65 3a 22 29 0a 0a | -prompt.";;;.Amb-Eval.value:").. |
| f9cc0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 72 69 76 65 72 2d 6c 6f 6f 70 29 0a 20 20 20 20 20 | .....(define.(driver-loop)...... |
| f9ce0 | 20 20 28 64 65 66 69 6e 65 20 28 69 6e 74 65 72 6e 61 6c 2d 6c 6f 6f 70 20 74 72 79 2d 61 67 61 | ..(define.(internal-loop.try-aga |
| f9d00 | 69 6e 29 0a 20 20 20 20 20 20 20 20 20 28 70 72 6f 6d 70 74 2d 66 6f 72 2d 69 6e 70 75 74 20 69 | in)..........(prompt-for-input.i |
| f9d20 | 6e 70 75 74 2d 70 72 6f 6d 70 74 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e 70 | nput-prompt)..........(let.((inp |
| f9d40 | 75 74 20 28 72 65 61 64 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 71 3f 20 | ut.(read)))............(if.(eq?. |
| f9d60 | 69 6e 70 75 74 20 27 74 72 79 2d 61 67 61 69 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | input.'try-again)............... |
| f9d80 | 20 28 74 72 79 2d 61 67 61 69 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 65 67 | .(try-again)................(beg |
| f9da0 | 69 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 0a 20 20 | in..................(newline)... |
| f9dc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 22 3b 3b 3b 20 53 74 61 | ...............(display.";;;.Sta |
| f9de0 | 72 74 69 6e 67 20 61 20 6e 65 77 20 70 72 6f 62 6c 65 6d 20 22 29 0a 20 20 20 20 20 20 20 20 20 | rting.a.new.problem.").......... |
| f9e00 | 20 20 20 20 20 20 20 20 28 61 6d 62 65 76 61 6c 20 69 6e 70 75 74 0a 20 20 20 20 20 20 20 20 20 | ........(ambeval.input.......... |
| f9e20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 | .................the-global-envi |
| f9e40 | 72 6f 6e 6d 65 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ronment......................... |
| f9e60 | 20 20 3b 3b 20 60 61 6d 62 65 76 61 6c 27 20 73 75 63 63 65 73 73 0a 20 20 20 20 20 20 20 20 20 | ..;;.`ambeval'.success.......... |
| f9e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 20 6e 65 | .................(lambda.(val.ne |
| f9ea0 | 78 74 2d 61 6c 74 65 72 6e 61 74 69 76 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | xt-alternative)................. |
| f9ec0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 6e 6f 75 6e 63 65 2d 6f 75 74 70 75 74 20 6f 75 74 | ............(announce-output.out |
| f9ee0 | 70 75 74 2d 70 72 6f 6d 70 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | put-prompt)..................... |
| f9f00 | 20 20 20 20 20 20 20 20 28 75 73 65 72 2d 70 72 69 6e 74 20 76 61 6c 29 0a 20 20 20 20 20 20 20 | ........(user-print.val)........ |
| f9f20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 6e 74 65 72 6e 61 6c 2d 6c | .....................(internal-l |
| f9f40 | 6f 6f 70 20 6e 65 78 74 2d 61 6c 74 65 72 6e 61 74 69 76 65 29 29 0a 20 20 20 20 20 20 20 20 20 | oop.next-alternative)).......... |
| f9f60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 60 61 6d 62 65 76 61 6c 27 20 66 61 | .................;;.`ambeval'.fa |
| f9f80 | 69 6c 75 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ilure........................... |
| f9fa0 | 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (lambda.()...................... |
| f9fc0 | 20 20 20 20 20 20 20 28 61 6e 6e 6f 75 6e 63 65 2d 6f 75 74 70 75 74 0a 20 20 20 20 20 20 20 20 | .......(announce-output......... |
| f9fe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 3b 3b 3b 20 54 68 65 72 65 20 | .....................";;;.There. |
| fa000 | 61 72 65 20 6e 6f 20 6d 6f 72 65 20 76 61 6c 75 65 73 20 6f 66 22 29 0a 20 20 20 20 20 20 20 20 | are.no.more.values.of")......... |
| fa020 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 75 73 65 72 2d 70 72 69 6e 74 20 | ....................(user-print. |
| fa040 | 69 6e 70 75 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | input).......................... |
| fa060 | 20 20 20 28 64 72 69 76 65 72 2d 6c 6f 6f 70 29 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 28 69 | ...(driver-loop)))))))........(i |
| fa080 | 6e 74 65 72 6e 61 6c 2d 6c 6f 6f 70 0a 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a | nternal-loop.........(lambda.(). |
| fa0a0 | 20 20 20 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 | ..........(newline)...........(d |
| fa0c0 | 69 73 70 6c 61 79 20 22 3b 3b 3b 20 54 68 65 72 65 20 69 73 20 6e 6f 20 63 75 72 72 65 6e 74 20 | isplay.";;;.There.is.no.current. |
| fa0e0 | 70 72 6f 62 6c 65 6d 22 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 72 69 76 65 72 2d 6c 6f 6f 70 | problem")...........(driver-loop |
| fa100 | 29 29 29 29 0a 0a 20 20 20 54 68 65 20 69 6e 69 74 69 61 6c 20 63 61 6c 6c 20 74 6f 20 60 69 6e | )))).....The.initial.call.to.`in |
| fa120 | 74 65 72 6e 61 6c 2d 6c 6f 6f 70 27 20 75 73 65 73 20 61 20 60 74 72 79 2d 61 67 61 69 6e 27 20 | ternal-loop'.uses.a.`try-again'. |
| fa140 | 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 0a 63 6f 6d 70 6c 61 69 6e 73 20 74 68 61 74 20 74 68 | procedure.that.complains.that.th |
| fa160 | 65 72 65 20 69 73 20 6e 6f 20 63 75 72 72 65 6e 74 20 70 72 6f 62 6c 65 6d 20 61 6e 64 20 72 65 | ere.is.no.current.problem.and.re |
| fa180 | 73 74 61 72 74 73 20 74 68 65 20 64 72 69 76 65 72 0a 6c 6f 6f 70 2e 20 20 54 68 69 73 20 69 73 | starts.the.driver.loop...This.is |
| fa1a0 | 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 74 68 61 74 20 77 69 6c 6c 20 68 61 70 70 65 6e 20 69 | .the.behavior.that.will.happen.i |
| fa1c0 | 66 20 74 68 65 20 75 73 65 72 20 74 79 70 65 73 0a 60 74 72 79 2d 61 67 61 69 6e 27 20 77 68 65 | f.the.user.types.`try-again'.whe |
| fa1e0 | 6e 20 74 68 65 72 65 20 69 73 20 6e 6f 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 6e 20 70 72 6f 67 | n.there.is.no.evaluation.in.prog |
| fa200 | 72 65 73 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 35 30 3a 2a 20 49 6d 70 | ress........*Exercise.4.50:*.Imp |
| fa220 | 6c 65 6d 65 6e 74 20 61 20 6e 65 77 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 60 72 61 6d 62 27 | lement.a.new.special.form.`ramb' |
| fa240 | 20 74 68 61 74 20 69 73 20 6c 69 6b 65 0a 20 20 20 20 20 60 61 6d 62 27 20 65 78 63 65 70 74 20 | .that.is.like......`amb'.except. |
| fa260 | 74 68 61 74 20 69 74 20 73 65 61 72 63 68 65 73 20 61 6c 74 65 72 6e 61 74 69 76 65 73 20 69 6e | that.it.searches.alternatives.in |
| fa280 | 20 61 20 72 61 6e 64 6f 6d 20 6f 72 64 65 72 2c 0a 20 20 20 20 20 72 61 74 68 65 72 20 74 68 61 | .a.random.order,......rather.tha |
| fa2a0 | 6e 20 66 72 6f 6d 20 6c 65 66 74 20 74 6f 20 72 69 67 68 74 2e 20 20 53 68 6f 77 20 68 6f 77 20 | n.from.left.to.right...Show.how. |
| fa2c0 | 74 68 69 73 20 63 61 6e 20 68 65 6c 70 20 77 69 74 68 0a 20 20 20 20 20 41 6c 79 73 73 61 27 73 | this.can.help.with......Alyssa's |
| fa2e0 | 20 70 72 6f 62 6c 65 6d 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 34 39 3a | .problem.in.*Note.Exercise.4-49: |
| fa300 | 3a 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 35 31 3a 2a 20 49 6d 70 6c 65 6d | :........*Exercise.4.51:*.Implem |
| fa320 | 65 6e 74 20 61 20 6e 65 77 20 6b 69 6e 64 20 6f 66 20 61 73 73 69 67 6e 6d 65 6e 74 20 63 61 6c | ent.a.new.kind.of.assignment.cal |
| fa340 | 6c 65 64 0a 20 20 20 20 20 60 70 65 72 6d 61 6e 65 6e 74 2d 73 65 74 21 27 20 74 68 61 74 20 69 | led......`permanent-set!'.that.i |
| fa360 | 73 20 6e 6f 74 20 75 6e 64 6f 6e 65 20 75 70 6f 6e 20 66 61 69 6c 75 72 65 2e 20 20 46 6f 72 20 | s.not.undone.upon.failure...For. |
| fa380 | 65 78 61 6d 70 6c 65 2c 20 77 65 0a 20 20 20 20 20 63 61 6e 20 63 68 6f 6f 73 65 20 74 77 6f 20 | example,.we......can.choose.two. |
| fa3a0 | 64 69 73 74 69 6e 63 74 20 65 6c 65 6d 65 6e 74 73 20 66 72 6f 6d 20 61 20 6c 69 73 74 20 61 6e | distinct.elements.from.a.list.an |
| fa3c0 | 64 20 63 6f 75 6e 74 20 74 68 65 20 6e 75 6d 62 65 72 0a 20 20 20 20 20 6f 66 20 74 72 69 61 6c | d.count.the.number......of.trial |
| fa3e0 | 73 20 72 65 71 75 69 72 65 64 20 74 6f 20 6d 61 6b 65 20 61 20 73 75 63 63 65 73 73 66 75 6c 20 | s.required.to.make.a.successful. |
| fa400 | 63 68 6f 69 63 65 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | choice.as.follows:............(d |
| fa420 | 65 66 69 6e 65 20 63 6f 75 6e 74 20 30 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 | efine.count.0)............(let.( |
| fa440 | 28 78 20 28 61 6e 2d 65 6c 65 6d 65 6e 74 2d 6f 66 20 27 28 61 20 62 20 63 29 29 29 0a 20 20 20 | (x.(an-element-of.'(a.b.c))).... |
| fa460 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 79 20 28 61 6e 2d 65 6c 65 6d 65 6e 74 2d 6f 66 20 27 | .............(y.(an-element-of.' |
| fa480 | 28 61 20 62 20 63 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 70 65 72 6d 61 6e 65 6e | (a.b.c)))).............(permanen |
| fa4a0 | 74 2d 73 65 74 21 20 63 6f 75 6e 74 20 28 2b 20 63 6f 75 6e 74 20 31 29 29 0a 20 20 20 20 20 20 | t-set!.count.(+.count.1))....... |
| fa4c0 | 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 6e 6f 74 20 28 65 71 3f 20 78 20 79 29 29 29 0a | ......(require.(not.(eq?.x.y))). |
| fa4e0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 78 20 79 20 63 6f 75 6e 74 29 29 0a 20 20 | ............(list.x.y.count))... |
| fa500 | 20 20 20 20 20 20 20 20 3b 3b 3b 20 53 74 61 72 74 69 6e 67 20 61 20 6e 65 77 20 70 72 6f 62 6c | ........;;;.Starting.a.new.probl |
| fa520 | 65 6d 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 76 61 6c 75 65 3a | em...........;;;.Amb-Eval.value: |
| fa540 | 0a 20 20 20 20 20 20 20 20 20 20 28 61 20 62 20 32 29 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b | ...........(a.b.2)............;; |
| fa560 | 3b 20 41 6d 62 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 74 72 79 2d | ;.Amb-Eval.input:...........try- |
| fa580 | 61 67 61 69 6e 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 76 61 6c | again...........;;;.Amb-Eval.val |
| fa5a0 | 75 65 3a 0a 20 20 20 20 20 20 20 20 20 20 28 61 20 63 20 33 29 0a 0a 20 20 20 20 20 57 68 61 74 | ue:...........(a.c.3).......What |
| fa5c0 | 20 76 61 6c 75 65 73 20 77 6f 75 6c 64 20 68 61 76 65 20 62 65 65 6e 20 64 69 73 70 6c 61 79 65 | .values.would.have.been.displaye |
| fa5e0 | 64 20 69 66 20 77 65 20 68 61 64 20 75 73 65 64 20 60 73 65 74 21 27 20 68 65 72 65 0a 20 20 20 | d.if.we.had.used.`set!'.here.... |
| fa600 | 20 20 72 61 74 68 65 72 20 74 68 61 6e 20 60 70 65 72 6d 61 6e 65 6e 74 2d 73 65 74 21 27 20 3f | ..rather.than.`permanent-set!'.? |
| fa620 | 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 35 32 3a 2a 20 49 6d 70 6c 65 6d 65 6e | .......*Exercise.4.52:*.Implemen |
| fa640 | 74 20 61 20 6e 65 77 20 63 6f 6e 73 74 72 75 63 74 20 63 61 6c 6c 65 64 20 60 69 66 2d 66 61 69 | t.a.new.construct.called.`if-fai |
| fa660 | 6c 27 20 74 68 61 74 0a 20 20 20 20 20 70 65 72 6d 69 74 73 20 74 68 65 20 75 73 65 72 20 74 6f | l'.that......permits.the.user.to |
| fa680 | 20 63 61 74 63 68 20 74 68 65 20 66 61 69 6c 75 72 65 20 6f 66 20 61 6e 20 65 78 70 72 65 73 73 | .catch.the.failure.of.an.express |
| fa6a0 | 69 6f 6e 2e 20 20 60 49 66 2d 66 61 69 6c 27 0a 20 20 20 20 20 74 61 6b 65 73 20 74 77 6f 20 65 | ion...`If-fail'......takes.two.e |
| fa6c0 | 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 49 74 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 66 69 | xpressions...It.evaluates.the.fi |
| fa6e0 | 72 73 74 20 65 78 70 72 65 73 73 69 6f 6e 20 61 73 20 75 73 75 61 6c 0a 20 20 20 20 20 61 6e 64 | rst.expression.as.usual......and |
| fa700 | 20 72 65 74 75 72 6e 73 20 61 73 20 75 73 75 61 6c 20 69 66 20 74 68 65 20 65 76 61 6c 75 61 74 | .returns.as.usual.if.the.evaluat |
| fa720 | 69 6f 6e 20 73 75 63 63 65 65 64 73 2e 20 20 49 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e | ion.succeeds...If.the.evaluation |
| fa740 | 0a 20 20 20 20 20 66 61 69 6c 73 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 65 20 76 61 6c 75 65 20 | ......fails,.however,.the.value. |
| fa760 | 6f 66 20 74 68 65 20 73 65 63 6f 6e 64 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 72 65 74 75 | of.the.second.expression.is.retu |
| fa780 | 72 6e 65 64 2c 20 61 73 0a 20 20 20 20 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 65 | rned,.as......in.the.following.e |
| fa7a0 | 78 61 6d 70 6c 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 | xample:............;;;.Amb-Eval. |
| fa7c0 | 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 28 69 66 2d 66 61 69 6c 20 28 6c 65 74 20 28 | input:...........(if-fail.(let.( |
| fa7e0 | 28 78 20 28 61 6e 2d 65 6c 65 6d 65 6e 74 2d 6f 66 20 27 28 31 20 33 20 35 29 29 29 29 0a 20 20 | (x.(an-element-of.'(1.3.5))))... |
| fa800 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 71 75 69 72 65 20 28 65 76 65 | ...................(require.(eve |
| fa820 | 6e 3f 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 29 0a 20 | n?.x))......................x).. |
| fa840 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 61 6c 6c 2d 6f 64 64 29 0a 20 20 20 20 | ..................'all-odd)..... |
| fa860 | 20 20 20 20 20 20 3b 3b 3b 20 53 74 61 72 74 69 6e 67 20 61 20 6e 65 77 20 70 72 6f 62 6c 65 6d | ......;;;.Starting.a.new.problem |
| fa880 | 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 | ...........;;;.Amb-Eval.value:.. |
| fa8a0 | 20 20 20 20 20 20 20 20 20 61 6c 6c 2d 6f 64 64 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 | .........all-odd............;;;. |
| fa8c0 | 41 6d 62 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 28 69 66 2d 66 61 | Amb-Eval.input:...........(if-fa |
| fa8e0 | 69 6c 20 28 6c 65 74 20 28 28 78 20 28 61 6e 2d 65 6c 65 6d 65 6e 74 2d 6f 66 20 27 28 31 20 33 | il.(let.((x.(an-element-of.'(1.3 |
| fa900 | 20 35 20 38 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 | .5.8))))......................(r |
| fa920 | 65 71 75 69 72 65 20 28 65 76 65 6e 3f 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | equire.(even?.x))............... |
| fa940 | 20 20 20 20 20 20 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 61 6c | .......x)....................'al |
| fa960 | 6c 2d 6f 64 64 29 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 53 74 61 72 74 69 6e 67 20 61 20 | l-odd)...........;;;.Starting.a. |
| fa980 | 6e 65 77 20 70 72 6f 62 6c 65 6d 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 41 6d 62 2d 45 76 | new.problem...........;;;.Amb-Ev |
| fa9a0 | 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 20 20 20 20 20 38 0a 0a 20 20 20 20 20 2a 45 78 65 | al.value:...........8.......*Exe |
| fa9c0 | 72 63 69 73 65 20 34 2e 35 33 3a 2a 20 57 69 74 68 20 60 70 65 72 6d 61 6e 65 6e 74 2d 73 65 74 | rcise.4.53:*.With.`permanent-set |
| fa9e0 | 21 27 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 45 78 | !'.as.described.in.*Note......Ex |
| faa00 | 65 72 63 69 73 65 20 34 2d 35 31 3a 3a 20 61 6e 64 20 60 69 66 2d 66 61 69 6c 27 20 61 73 20 69 | ercise.4-51::.and.`if-fail'.as.i |
| faa20 | 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 35 32 3a 3a 2c 20 77 68 61 74 0a 20 20 | n.*Note.Exercise.4-52::,.what... |
| faa40 | 20 20 20 77 69 6c 6c 20 62 65 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 65 76 61 6c 75 61 74 | ...will.be.the.result.of.evaluat |
| faa60 | 69 6e 67 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 61 69 72 73 20 27 28 29 29 | ing............(let.((pairs.'()) |
| faa80 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 2d 66 61 69 6c 20 28 6c 65 74 20 28 28 70 20 | ).............(if-fail.(let.((p. |
| faaa0 | 28 70 72 69 6d 65 2d 73 75 6d 2d 70 61 69 72 20 27 28 31 20 33 20 35 20 38 29 20 27 28 32 30 20 | (prime-sum-pair.'(1.3.5.8).'(20. |
| faac0 | 33 35 20 31 31 30 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 35.110))))...................... |
| faae0 | 20 20 28 70 65 72 6d 61 6e 65 6e 74 2d 73 65 74 21 20 70 61 69 72 73 20 28 63 6f 6e 73 20 70 20 | ..(permanent-set!.pairs.(cons.p. |
| fab00 | 70 61 69 72 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | pairs))........................( |
| fab20 | 61 6d 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 61 69 72 73 | amb))......................pairs |
| fab40 | 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 35 34 3a 2a 20 49 66 20 77 65 20 | )).......*Exercise.4.54:*.If.we. |
| fab60 | 68 61 64 20 6e 6f 74 20 72 65 61 6c 69 7a 65 64 20 74 68 61 74 20 60 72 65 71 75 69 72 65 27 20 | had.not.realized.that.`require'. |
| fab80 | 63 6f 75 6c 64 20 62 65 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 61 6e 20 | could.be......implemented.as.an. |
| faba0 | 6f 72 64 69 6e 61 72 79 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 75 73 65 73 20 60 61 6d | ordinary.procedure.that.uses.`am |
| fabc0 | 62 27 2c 20 74 6f 20 62 65 0a 20 20 20 20 20 64 65 66 69 6e 65 64 20 62 79 20 74 68 65 20 75 73 | b',.to.be......defined.by.the.us |
| fabe0 | 65 72 20 61 73 20 70 61 72 74 20 6f 66 20 61 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 | er.as.part.of.a.nondeterministic |
| fac00 | 20 70 72 6f 67 72 61 6d 2c 20 77 65 0a 20 20 20 20 20 77 6f 75 6c 64 20 68 61 76 65 20 68 61 64 | .program,.we......would.have.had |
| fac20 | 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 69 74 20 61 73 20 61 20 73 70 65 63 69 61 6c 20 66 6f | .to.implement.it.as.a.special.fo |
| fac40 | 72 6d 2e 20 20 54 68 69 73 20 77 6f 75 6c 64 0a 20 20 20 20 20 72 65 71 75 69 72 65 20 73 79 6e | rm...This.would......require.syn |
| fac60 | 74 61 78 20 70 72 6f 63 65 64 75 72 65 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e | tax.procedures............(defin |
| fac80 | 65 20 28 72 65 71 75 69 72 65 3f 20 65 78 70 29 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 65 | e.(require?.exp).(tagged-list?.e |
| faca0 | 78 70 20 27 72 65 71 75 69 72 65 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | xp.'require))............(define |
| facc0 | 20 28 72 65 71 75 69 72 65 2d 70 72 65 64 69 63 61 74 65 20 65 78 70 29 20 28 63 61 64 72 20 65 | .(require-predicate.exp).(cadr.e |
| face0 | 78 70 29 29 0a 0a 20 20 20 20 20 61 6e 64 20 61 20 6e 65 77 20 63 6c 61 75 73 65 20 69 6e 20 74 | xp)).......and.a.new.clause.in.t |
| fad00 | 68 65 20 64 69 73 70 61 74 63 68 20 69 6e 20 60 61 6e 61 6c 79 7a 65 27 0a 0a 20 20 20 20 20 20 | he.dispatch.in.`analyze'........ |
| fad20 | 20 20 20 20 28 28 72 65 71 75 69 72 65 3f 20 65 78 70 29 20 28 61 6e 61 6c 79 7a 65 2d 72 65 71 | ....((require?.exp).(analyze-req |
| fad40 | 75 69 72 65 20 65 78 70 29 29 0a 0a 20 20 20 20 20 61 73 20 77 65 6c 6c 20 74 68 65 20 70 72 6f | uire.exp)).......as.well.the.pro |
| fad60 | 63 65 64 75 72 65 20 60 61 6e 61 6c 79 7a 65 2d 72 65 71 75 69 72 65 27 20 74 68 61 74 20 68 61 | cedure.`analyze-require'.that.ha |
| fad80 | 6e 64 6c 65 73 20 60 72 65 71 75 69 72 65 27 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 | ndles.`require'......expressions |
| fada0 | 2e 20 20 43 6f 6d 70 6c 65 74 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 | ...Complete.the.following.defini |
| fadc0 | 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 61 6e 61 6c 79 7a 65 2d 72 65 71 75 69 72 65 27 2e 0a | tion.of......`analyze-require'.. |
| fade0 | 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6e 61 6c 79 7a 65 2d 72 65 71 75 | ...........(define.(analyze-requ |
| fae00 | 69 72 65 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 70 72 6f | ire.exp).............(let.((ppro |
| fae20 | 63 20 28 61 6e 61 6c 79 7a 65 20 28 72 65 71 75 69 72 65 2d 70 72 65 64 69 63 61 74 65 20 65 78 | c.(analyze.(require-predicate.ex |
| fae40 | 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 65 6e 76 | p))))...............(lambda.(env |
| fae60 | 20 73 75 63 63 65 65 64 20 66 61 69 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .succeed.fail).................( |
| fae80 | 70 70 72 6f 63 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | pproc.env....................... |
| faea0 | 20 28 6c 61 6d 62 64 61 20 28 70 72 65 64 2d 76 61 6c 75 65 20 66 61 69 6c 32 29 0a 20 20 20 20 | .(lambda.(pred-value.fail2)..... |
| faec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 3c 3f 3f 3e 0a 20 20 | .....................(if.<??>... |
| faee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 3f 3f 3e 0a | ...........................<??>. |
| faf00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 75 | .............................(su |
| faf20 | 63 63 65 65 64 20 27 6f 6b 20 66 61 69 6c 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | cceed.'ok.fail2))).............. |
| faf40 | 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 29 29 29 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..........fail)))).....--------- |
| faf60 | 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 57 | -.Footnotes.----------.....(1).W |
| faf80 | 65 20 63 68 6f 73 65 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 6c 61 7a 79 20 65 76 | e.chose.to.implement.the.lazy.ev |
| fafa0 | 61 6c 75 61 74 6f 72 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 32 3a 3a 0a 61 | aluator.in.section.*Note.4-2::.a |
| fafc0 | 73 20 61 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6f 72 64 69 6e 61 72 79 | s.a.modification.of.the.ordinary |
| fafe0 | 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 | .metacircular.evaluator.of.secti |
| fb000 | 6f 6e 0a 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 2e 20 20 49 6e 20 63 6f 6e 74 72 61 73 74 2c 20 | on.*Note.4-1-1::...In.contrast,. |
| fb020 | 77 65 20 77 69 6c 6c 20 62 61 73 65 20 74 68 65 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 | we.will.base.the.`amb'.evaluator |
| fb040 | 20 6f 6e 20 74 68 65 0a 61 6e 61 6c 79 7a 69 6e 67 20 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 | .on.the.analyzing.evaluator.of.s |
| fb060 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 37 3a 3a 2c 20 62 65 63 61 75 73 65 20 74 68 | ection.*Note.4-1-7::,.because.th |
| fb080 | 65 20 65 78 65 63 75 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 61 74 20 65 | e.execution.procedures.in.that.e |
| fb0a0 | 76 61 6c 75 61 74 6f 72 20 70 72 6f 76 69 64 65 20 61 20 63 6f 6e 76 65 6e 69 65 6e 74 20 66 72 | valuator.provide.a.convenient.fr |
| fb0c0 | 61 6d 65 77 6f 72 6b 20 66 6f 72 0a 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 62 61 63 6b 74 72 61 | amework.for.implementing.backtra |
| fb0e0 | 63 6b 69 6e 67 2e 0a 0a 20 20 20 28 32 29 20 57 65 20 61 73 73 75 6d 65 20 74 68 61 74 20 74 68 | cking......(2).We.assume.that.th |
| fb100 | 65 20 65 76 61 6c 75 61 74 6f 72 20 73 75 70 70 6f 72 74 73 20 60 6c 65 74 27 20 28 73 65 65 20 | e.evaluator.supports.`let'.(see. |
| fb120 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 34 2d 32 32 3a 3a 29 2c 20 77 68 69 63 68 20 77 65 | *Note.Exercise.4-22::),.which.we |
| fb140 | 20 68 61 76 65 20 75 73 65 64 20 69 6e 20 6f 75 72 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 | .have.used.in.our.nondeterminist |
| fb160 | 69 63 20 70 72 6f 67 72 61 6d 73 2e 0a 0a 20 20 20 28 33 29 20 57 65 20 64 69 64 6e 27 74 20 77 | ic.programs......(3).We.didn't.w |
| fb180 | 6f 72 72 79 20 61 62 6f 75 74 20 75 6e 64 6f 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 | orry.about.undoing.definitions,. |
| fb1a0 | 73 69 6e 63 65 20 77 65 20 63 61 6e 20 61 73 73 75 6d 65 0a 74 68 61 74 20 69 6e 74 65 72 6e 61 | since.we.can.assume.that.interna |
| fb1c0 | 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 73 63 61 6e 6e 65 64 20 6f 75 74 20 28 73 | l.definitions.are.scanned.out.(s |
| fb1e0 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 36 3a 3a 29 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 | ection.*Note.4-1-6::).....File:. |
| fb200 | 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 34 2c 20 20 50 72 65 76 3a 20 34 2d | sicp.info,..Node:.4-4,..Prev:.4- |
| fb220 | 33 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 34 0a 0a 34 2e 34 20 4c 6f 67 69 63 20 50 72 6f | 3,..Up:.Chapter.4..4.4.Logic.Pro |
| fb240 | 67 72 61 6d 6d 69 6e 67 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a | gramming.=====================.. |
| fb260 | 49 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 31 3a 3a 20 77 65 20 73 74 72 65 73 73 65 64 | In.*Note.Chapter.1::.we.stressed |
| fb280 | 20 74 68 61 74 20 63 6f 6d 70 75 74 65 72 20 73 63 69 65 6e 63 65 20 64 65 61 6c 73 20 77 69 74 | .that.computer.science.deals.wit |
| fb2a0 | 68 0a 69 6d 70 65 72 61 74 69 76 65 20 28 68 6f 77 20 74 6f 29 20 6b 6e 6f 77 6c 65 64 67 65 2c | h.imperative.(how.to).knowledge, |
| fb2c0 | 20 77 68 65 72 65 61 73 20 6d 61 74 68 65 6d 61 74 69 63 73 20 64 65 61 6c 73 20 77 69 74 68 0a | .whereas.mathematics.deals.with. |
| fb2e0 | 64 65 63 6c 61 72 61 74 69 76 65 20 28 77 68 61 74 20 69 73 29 20 6b 6e 6f 77 6c 65 64 67 65 2e | declarative.(what.is).knowledge. |
| fb300 | 20 20 49 6e 64 65 65 64 2c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 | ..Indeed,.programming.languages. |
| fb320 | 72 65 71 75 69 72 65 0a 74 68 61 74 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 65 72 20 65 78 70 72 | require.that.the.programmer.expr |
| fb340 | 65 73 73 20 6b 6e 6f 77 6c 65 64 67 65 20 69 6e 20 61 20 66 6f 72 6d 20 74 68 61 74 20 69 6e 64 | ess.knowledge.in.a.form.that.ind |
| fb360 | 69 63 61 74 65 73 20 74 68 65 0a 73 74 65 70 2d 62 79 2d 73 74 65 70 20 6d 65 74 68 6f 64 73 20 | icates.the.step-by-step.methods. |
| fb380 | 66 6f 72 20 73 6f 6c 76 69 6e 67 20 70 61 72 74 69 63 75 6c 61 72 20 70 72 6f 62 6c 65 6d 73 2e | for.solving.particular.problems. |
| fb3a0 | 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 0a 68 61 6e 64 2c 20 68 69 67 68 2d 6c 65 76 65 6c 20 | ..On.the.other.hand,.high-level. |
| fb3c0 | 6c 61 6e 67 75 61 67 65 73 20 70 72 6f 76 69 64 65 2c 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 | languages.provide,.as.part.of.th |
| fb3e0 | 65 20 6c 61 6e 67 75 61 67 65 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 20 61 20 73 75 62 | e.language.implementation,.a.sub |
| fb400 | 73 74 61 6e 74 69 61 6c 20 61 6d 6f 75 6e 74 20 6f 66 20 6d 65 74 68 6f 64 6f 6c 6f 67 69 63 61 | stantial.amount.of.methodologica |
| fb420 | 6c 20 6b 6e 6f 77 6c 65 64 67 65 20 74 68 61 74 0a 66 72 65 65 73 20 74 68 65 20 75 73 65 72 20 | l.knowledge.that.frees.the.user. |
| fb440 | 66 72 6f 6d 20 63 6f 6e 63 65 72 6e 20 77 69 74 68 20 6e 75 6d 65 72 6f 75 73 20 64 65 74 61 69 | from.concern.with.numerous.detai |
| fb460 | 6c 73 20 6f 66 20 68 6f 77 20 61 20 73 70 65 63 69 66 69 65 64 0a 63 6f 6d 70 75 74 61 74 69 6f | ls.of.how.a.specified.computatio |
| fb480 | 6e 20 77 69 6c 6c 20 70 72 6f 67 72 65 73 73 2e 0a 0a 20 20 20 4d 6f 73 74 20 70 72 6f 67 72 61 | n.will.progress......Most.progra |
| fb4a0 | 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 2c 20 69 6e 63 6c 75 64 69 6e 67 20 4c 69 73 70 2c | mming.languages,.including.Lisp, |
| fb4c0 | 20 61 72 65 20 6f 72 67 61 6e 69 7a 65 64 20 61 72 6f 75 6e 64 0a 63 6f 6d 70 75 74 69 6e 67 20 | .are.organized.around.computing. |
| fb4e0 | 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 66 75 6e 63 74 | the.values.of.mathematical.funct |
| fb500 | 69 6f 6e 73 2e 20 20 45 78 70 72 65 73 73 69 6f 6e 2d 6f 72 69 65 6e 74 65 64 0a 6c 61 6e 67 75 | ions...Expression-oriented.langu |
| fb520 | 61 67 65 73 20 28 73 75 63 68 20 61 73 20 4c 69 73 70 2c 20 46 6f 72 74 72 61 6e 2c 20 61 6e 64 | ages.(such.as.Lisp,.Fortran,.and |
| fb540 | 20 41 6c 67 6f 6c 29 20 63 61 70 69 74 61 6c 69 7a 65 20 6f 6e 20 74 68 65 20 22 70 75 6e 22 0a | .Algol).capitalize.on.the."pun". |
| fb560 | 74 68 61 74 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 64 65 73 63 72 69 62 65 | that.an.expression.that.describe |
| fb580 | 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 61 20 66 75 6e 63 74 69 6f 6e 20 6d 61 79 20 61 6c | s.the.value.of.a.function.may.al |
| fb5a0 | 73 6f 20 62 65 0a 69 6e 74 65 72 70 72 65 74 65 64 20 61 73 20 61 20 6d 65 61 6e 73 20 6f 66 20 | so.be.interpreted.as.a.means.of. |
| fb5c0 | 63 6f 6d 70 75 74 69 6e 67 20 74 68 61 74 20 76 61 6c 75 65 2e 20 20 42 65 63 61 75 73 65 20 6f | computing.that.value...Because.o |
| fb5e0 | 66 20 74 68 69 73 2c 20 6d 6f 73 74 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 | f.this,.most.programming.languag |
| fb600 | 65 73 20 61 72 65 20 73 74 72 6f 6e 67 6c 79 20 62 69 61 73 65 64 20 74 6f 77 61 72 64 20 75 6e | es.are.strongly.biased.toward.un |
| fb620 | 69 64 69 72 65 63 74 69 6f 6e 61 6c 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 73 20 28 63 6f 6d 70 75 | idirectional.computations.(compu |
| fb640 | 74 61 74 69 6f 6e 73 20 77 69 74 68 20 77 65 6c 6c 2d 64 65 66 69 6e 65 64 20 69 6e 70 75 74 73 | tations.with.well-defined.inputs |
| fb660 | 20 61 6e 64 20 6f 75 74 70 75 74 73 29 2e 0a 54 68 65 72 65 20 61 72 65 2c 20 68 6f 77 65 76 65 | .and.outputs)..There.are,.howeve |
| fb680 | 72 2c 20 72 61 64 69 63 61 6c 6c 79 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 67 72 61 6d 6d 69 | r,.radically.different.programmi |
| fb6a0 | 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 74 68 61 74 0a 72 65 6c 61 78 20 74 68 69 73 20 62 69 61 | ng.languages.that.relax.this.bia |
| fb6c0 | 73 2e 20 20 57 65 20 73 61 77 20 6f 6e 65 20 73 75 63 68 20 65 78 61 6d 70 6c 65 20 69 6e 20 73 | s...We.saw.one.such.example.in.s |
| fb6e0 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 33 2d 35 3a 3a 2c 0a 77 68 65 72 65 20 74 68 65 20 | ection.*Note.3-3-5::,.where.the. |
| fb700 | 6f 62 6a 65 63 74 73 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 77 65 72 65 20 61 72 69 74 | objects.of.computation.were.arit |
| fb720 | 68 6d 65 74 69 63 20 63 6f 6e 73 74 72 61 69 6e 74 73 2e 20 20 49 6e 20 61 0a 63 6f 6e 73 74 72 | hmetic.constraints...In.a.constr |
| fb740 | 61 69 6e 74 20 73 79 73 74 65 6d 20 74 68 65 20 64 69 72 65 63 74 69 6f 6e 20 61 6e 64 20 74 68 | aint.system.the.direction.and.th |
| fb760 | 65 20 6f 72 64 65 72 20 6f 66 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 61 72 65 20 6e 6f 74 20 73 | e.order.of.computation.are.not.s |
| fb780 | 6f 0a 77 65 6c 6c 20 73 70 65 63 69 66 69 65 64 3b 20 69 6e 20 63 61 72 72 79 69 6e 67 20 6f 75 | o.well.specified;.in.carrying.ou |
| fb7a0 | 74 20 61 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 74 68 65 20 73 79 73 74 65 6d 20 6d 75 73 74 20 | t.a.computation.the.system.must. |
| fb7c0 | 74 68 65 72 65 66 6f 72 65 0a 70 72 6f 76 69 64 65 20 6d 6f 72 65 20 64 65 74 61 69 6c 65 64 20 | therefore.provide.more.detailed. |
| fb7e0 | 22 68 6f 77 20 74 6f 22 20 6b 6e 6f 77 6c 65 64 67 65 20 74 68 61 6e 20 77 6f 75 6c 64 20 62 65 | "how.to".knowledge.than.would.be |
| fb800 | 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20 61 6e 0a 6f 72 64 69 6e 61 72 79 20 61 72 69 74 68 | .the.case.with.an.ordinary.arith |
| fb820 | 6d 65 74 69 63 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 54 68 69 73 20 64 6f 65 73 20 6e 6f | metic.computation...This.does.no |
| fb840 | 74 20 6d 65 61 6e 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 61 74 20 74 68 65 0a 75 73 65 72 20 69 | t.mean,.however,.that.the.user.i |
| fb860 | 73 20 72 65 6c 65 61 73 65 64 20 61 6c 74 6f 67 65 74 68 65 72 20 66 72 6f 6d 20 74 68 65 20 72 | s.released.altogether.from.the.r |
| fb880 | 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 20 6f 66 20 70 72 6f 76 69 64 69 6e 67 0a 69 6d 70 65 72 | esponsibility.of.providing.imper |
| fb8a0 | 61 74 69 76 65 20 6b 6e 6f 77 6c 65 64 67 65 2e 20 20 54 68 65 72 65 20 61 72 65 20 6d 61 6e 79 | ative.knowledge...There.are.many |
| fb8c0 | 20 63 6f 6e 73 74 72 61 69 6e 74 20 6e 65 74 77 6f 72 6b 73 20 74 68 61 74 0a 69 6d 70 6c 65 6d | .constraint.networks.that.implem |
| fb8e0 | 65 6e 74 20 74 68 65 20 73 61 6d 65 20 73 65 74 20 6f 66 20 63 6f 6e 73 74 72 61 69 6e 74 73 2c | ent.the.same.set.of.constraints, |
| fb900 | 20 61 6e 64 20 74 68 65 20 75 73 65 72 20 6d 75 73 74 20 63 68 6f 6f 73 65 20 66 72 6f 6d 0a 74 | .and.the.user.must.choose.from.t |
| fb920 | 68 65 20 73 65 74 20 6f 66 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 6c 79 20 65 71 75 69 76 61 6c | he.set.of.mathematically.equival |
| fb940 | 65 6e 74 20 6e 65 74 77 6f 72 6b 73 20 61 20 73 75 69 74 61 62 6c 65 20 6e 65 74 77 6f 72 6b 20 | ent.networks.a.suitable.network. |
| fb960 | 74 6f 0a 73 70 65 63 69 66 79 20 61 20 70 61 72 74 69 63 75 6c 61 72 20 63 6f 6d 70 75 74 61 74 | to.specify.a.particular.computat |
| fb980 | 69 6f 6e 2e 0a 0a 20 20 20 54 68 65 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 72 | ion......The.nondeterministic.pr |
| fb9a0 | 6f 67 72 61 6d 20 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | ogram.evaluator.of.section.*Note |
| fb9c0 | 20 34 2d 33 3a 3a 20 61 6c 73 6f 0a 6d 6f 76 65 73 20 61 77 61 79 20 66 72 6f 6d 20 74 68 65 20 | .4-3::.also.moves.away.from.the. |
| fb9e0 | 76 69 65 77 20 74 68 61 74 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 61 62 6f 75 74 20 63 | view.that.programming.is.about.c |
| fba00 | 6f 6e 73 74 72 75 63 74 69 6e 67 0a 61 6c 67 6f 72 69 74 68 6d 73 20 66 6f 72 20 63 6f 6d 70 75 | onstructing.algorithms.for.compu |
| fba20 | 74 69 6e 67 20 75 6e 69 64 69 72 65 63 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 73 2e 20 20 | ting.unidirectional.functions... |
| fba40 | 49 6e 20 61 0a 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 6c 61 6e 67 75 61 67 65 2c 20 | In.a.nondeterministic.language,. |
| fba60 | 65 78 70 72 65 73 73 69 6f 6e 73 20 63 61 6e 20 68 61 76 65 20 6d 6f 72 65 20 74 68 61 6e 20 6f | expressions.can.have.more.than.o |
| fba80 | 6e 65 20 76 61 6c 75 65 2c 0a 61 6e 64 2c 20 61 73 20 61 20 72 65 73 75 6c 74 2c 20 74 68 65 20 | ne.value,.and,.as.a.result,.the. |
| fbaa0 | 63 6f 6d 70 75 74 61 74 69 6f 6e 20 69 73 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 72 65 6c 61 | computation.is.dealing.with.rela |
| fbac0 | 74 69 6f 6e 73 20 72 61 74 68 65 72 20 74 68 61 6e 0a 77 69 74 68 20 73 69 6e 67 6c 65 2d 76 61 | tions.rather.than.with.single-va |
| fbae0 | 6c 75 65 64 20 66 75 6e 63 74 69 6f 6e 73 2e 20 20 4c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 | lued.functions...Logic.programmi |
| fbb00 | 6e 67 20 65 78 74 65 6e 64 73 20 74 68 69 73 20 69 64 65 61 20 62 79 0a 63 6f 6d 62 69 6e 69 6e | ng.extends.this.idea.by.combinin |
| fbb20 | 67 20 61 20 72 65 6c 61 74 69 6f 6e 61 6c 20 76 69 73 69 6f 6e 20 6f 66 20 70 72 6f 67 72 61 6d | g.a.relational.vision.of.program |
| fbb40 | 6d 69 6e 67 20 77 69 74 68 20 61 20 70 6f 77 65 72 66 75 6c 20 6b 69 6e 64 20 6f 66 0a 73 79 6d | ming.with.a.powerful.kind.of.sym |
| fbb60 | 62 6f 6c 69 63 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 69 6e 67 20 63 61 6c 6c 65 64 20 22 75 | bolic.pattern.matching.called."u |
| fbb80 | 6e 69 66 69 63 61 74 69 6f 6e 22 2e 28 31 29 0a 0a 20 20 20 54 68 69 73 20 61 70 70 72 6f 61 63 | nification".(1).....This.approac |
| fbba0 | 68 2c 20 77 68 65 6e 20 69 74 20 77 6f 72 6b 73 2c 20 63 61 6e 20 62 65 20 61 20 76 65 72 79 20 | h,.when.it.works,.can.be.a.very. |
| fbbc0 | 70 6f 77 65 72 66 75 6c 20 77 61 79 20 74 6f 20 77 72 69 74 65 0a 70 72 6f 67 72 61 6d 73 2e 20 | powerful.way.to.write.programs.. |
| fbbe0 | 20 50 61 72 74 20 6f 66 20 74 68 65 20 70 6f 77 65 72 20 63 6f 6d 65 73 20 66 72 6f 6d 20 74 68 | .Part.of.the.power.comes.from.th |
| fbc00 | 65 20 66 61 63 74 20 74 68 61 74 20 61 20 73 69 6e 67 6c 65 20 22 77 68 61 74 0a 69 73 22 20 66 | e.fact.that.a.single."what.is".f |
| fbc20 | 61 63 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 73 6f 6c 76 65 20 61 20 6e 75 6d 62 65 | act.can.be.used.to.solve.a.numbe |
| fbc40 | 72 20 6f 66 20 64 69 66 66 65 72 65 6e 74 20 70 72 6f 62 6c 65 6d 73 20 74 68 61 74 20 77 6f 75 | r.of.different.problems.that.wou |
| fbc60 | 6c 64 0a 68 61 76 65 20 64 69 66 66 65 72 65 6e 74 20 22 68 6f 77 20 74 6f 22 20 63 6f 6d 70 6f | ld.have.different."how.to".compo |
| fbc80 | 6e 65 6e 74 73 2e 20 20 41 73 20 61 6e 20 65 78 61 6d 70 6c 65 2c 20 63 6f 6e 73 69 64 65 72 20 | nents...As.an.example,.consider. |
| fbca0 | 74 68 65 0a 60 61 70 70 65 6e 64 27 20 6f 70 65 72 61 74 69 6f 6e 2c 20 77 68 69 63 68 20 74 61 | the.`append'.operation,.which.ta |
| fbcc0 | 6b 65 73 20 74 77 6f 20 6c 69 73 74 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 63 | kes.two.lists.as.arguments.and.c |
| fbce0 | 6f 6d 62 69 6e 65 73 0a 74 68 65 69 72 20 65 6c 65 6d 65 6e 74 73 20 74 6f 20 66 6f 72 6d 20 61 | ombines.their.elements.to.form.a |
| fbd00 | 20 73 69 6e 67 6c 65 20 6c 69 73 74 2e 20 20 49 6e 20 61 20 70 72 6f 63 65 64 75 72 61 6c 20 6c | .single.list...In.a.procedural.l |
| fbd20 | 61 6e 67 75 61 67 65 20 73 75 63 68 20 61 73 0a 4c 69 73 70 2c 20 77 65 20 63 6f 75 6c 64 20 64 | anguage.such.as.Lisp,.we.could.d |
| fbd40 | 65 66 69 6e 65 20 60 61 70 70 65 6e 64 27 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 62 | efine.`append'.in.terms.of.the.b |
| fbd60 | 61 73 69 63 20 6c 69 73 74 20 63 6f 6e 73 74 72 75 63 74 6f 72 0a 60 63 6f 6e 73 27 2c 20 61 73 | asic.list.constructor.`cons',.as |
| fbd80 | 20 77 65 20 64 69 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 32 2d 31 3a 3a | .we.did.in.section.*Note.2-2-1:: |
| fbda0 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 70 65 6e 64 20 78 20 79 29 0a 20 20 20 | :.......(define.(append.x.y).... |
| fbdc0 | 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 79 0a 20 | ....(if.(null?.x)............y.. |
| fbde0 | 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 63 61 72 20 78 29 20 28 61 70 70 65 6e 64 20 | ..........(cons.(car.x).(append. |
| fbe00 | 28 63 64 72 20 78 29 20 79 29 29 29 29 0a 0a 20 20 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 | (cdr.x).y)))).....This.procedure |
| fbe20 | 20 63 61 6e 20 62 65 20 72 65 67 61 72 64 65 64 20 61 73 20 61 20 74 72 61 6e 73 6c 61 74 69 6f | .can.be.regarded.as.a.translatio |
| fbe40 | 6e 20 69 6e 74 6f 20 4c 69 73 70 20 6f 66 20 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 74 77 6f | n.into.Lisp.of.the.following.two |
| fbe60 | 20 72 75 6c 65 73 2c 20 74 68 65 20 66 69 72 73 74 20 6f 66 20 77 68 69 63 68 20 63 6f 76 65 72 | .rules,.the.first.of.which.cover |
| fbe80 | 73 20 74 68 65 20 63 61 73 65 20 77 68 65 72 65 20 74 68 65 20 66 69 72 73 74 0a 6c 69 73 74 20 | s.the.case.where.the.first.list. |
| fbea0 | 69 73 20 65 6d 70 74 79 20 61 6e 64 20 74 68 65 20 73 65 63 6f 6e 64 20 6f 66 20 77 68 69 63 68 | is.empty.and.the.second.of.which |
| fbec0 | 20 68 61 6e 64 6c 65 73 20 74 68 65 20 63 61 73 65 20 6f 66 20 61 20 6e 6f 6e 65 6d 70 74 79 0a | .handles.the.case.of.a.nonempty. |
| fbee0 | 6c 69 73 74 2c 20 77 68 69 63 68 20 69 73 20 61 20 60 63 6f 6e 73 27 20 6f 66 20 74 77 6f 20 70 | list,.which.is.a.`cons'.of.two.p |
| fbf00 | 61 72 74 73 3a 0a 0a 20 20 20 2a 20 46 6f 72 20 61 6e 79 20 6c 69 73 74 20 60 79 27 2c 20 74 68 | arts:.....*.For.any.list.`y',.th |
| fbf20 | 65 20 65 6d 70 74 79 20 6c 69 73 74 20 61 6e 64 20 60 79 27 20 60 61 70 70 65 6e 64 27 20 74 6f | e.empty.list.and.`y'.`append'.to |
| fbf40 | 20 66 6f 72 6d 20 60 79 27 2e 0a 0a 20 20 20 2a 20 46 6f 72 20 61 6e 79 20 60 75 27 2c 20 60 76 | .form.`y'......*.For.any.`u',.`v |
| fbf60 | 27 2c 20 60 79 27 2c 20 61 6e 64 20 60 7a 27 2c 20 60 28 63 6f 6e 73 20 75 20 76 29 27 20 61 6e | ',.`y',.and.`z',.`(cons.u.v)'.an |
| fbf80 | 64 20 60 79 27 20 60 61 70 70 65 6e 64 27 20 74 6f 0a 20 20 20 20 20 66 6f 72 6d 20 60 28 63 6f | d.`y'.`append'.to......form.`(co |
| fbfa0 | 6e 73 20 75 20 7a 29 27 20 69 66 20 60 76 27 20 61 6e 64 20 60 79 27 20 60 61 70 70 65 6e 64 27 | ns.u.z)'.if.`v'.and.`y'.`append' |
| fbfc0 | 20 74 6f 20 66 6f 72 6d 20 60 7a 27 2e 28 32 29 0a 0a 0a 20 20 20 55 73 69 6e 67 20 74 68 65 20 | .to.form.`z'.(2)......Using.the. |
| fbfe0 | 60 61 70 70 65 6e 64 27 20 70 72 6f 63 65 64 75 72 65 2c 20 77 65 20 63 61 6e 20 61 6e 73 77 65 | `append'.procedure,.we.can.answe |
| fc000 | 72 20 71 75 65 73 74 69 6f 6e 73 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 20 46 69 6e 64 20 74 | r.questions.such.as.......Find.t |
| fc020 | 68 65 20 60 61 70 70 65 6e 64 27 20 6f 66 20 60 28 61 20 62 29 27 20 61 6e 64 20 60 28 63 20 64 | he.`append'.of.`(a.b)'.and.`(c.d |
| fc040 | 29 27 2e 0a 0a 20 20 20 42 75 74 20 74 68 65 20 73 61 6d 65 20 74 77 6f 20 72 75 6c 65 73 20 61 | )'......But.the.same.two.rules.a |
| fc060 | 72 65 20 61 6c 73 6f 20 73 75 66 66 69 63 69 65 6e 74 20 66 6f 72 20 61 6e 73 77 65 72 69 6e 67 | re.also.sufficient.for.answering |
| fc080 | 20 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 73 6f 72 74 73 20 6f 66 20 71 75 65 73 74 69 6f 6e | .the.following.sorts.of.question |
| fc0a0 | 73 2c 20 77 68 69 63 68 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 63 61 6e 27 74 20 61 6e 73 | s,.which.the.procedure.can't.ans |
| fc0c0 | 77 65 72 3a 0a 0a 20 20 20 20 20 46 69 6e 64 20 61 20 6c 69 73 74 20 60 79 27 20 74 68 61 74 20 | wer:.......Find.a.list.`y'.that. |
| fc0e0 | 60 61 70 70 65 6e 64 27 73 20 77 69 74 68 20 60 28 61 20 62 29 27 20 74 6f 20 70 72 6f 64 75 63 | `append's.with.`(a.b)'.to.produc |
| fc100 | 65 20 60 28 61 20 62 20 63 20 64 29 27 2e 0a 0a 20 20 20 20 20 46 69 6e 64 20 61 6c 6c 20 60 78 | e.`(a.b.c.d)'........Find.all.`x |
| fc120 | 27 20 61 6e 64 20 60 79 27 20 74 68 61 74 20 60 61 70 70 65 6e 64 27 20 74 6f 20 66 6f 72 6d 20 | '.and.`y'.that.`append'.to.form. |
| fc140 | 60 28 61 20 62 20 63 20 64 29 27 2e 0a 0a 20 20 20 49 6e 20 61 20 6c 6f 67 69 63 20 70 72 6f 67 | `(a.b.c.d)'......In.a.logic.prog |
| fc160 | 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2c 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 65 72 | ramming.language,.the.programmer |
| fc180 | 20 77 72 69 74 65 73 20 61 6e 20 60 61 70 70 65 6e 64 27 0a 22 70 72 6f 63 65 64 75 72 65 22 20 | .writes.an.`append'."procedure". |
| fc1a0 | 62 79 20 73 74 61 74 69 6e 67 20 74 68 65 20 74 77 6f 20 72 75 6c 65 73 20 61 62 6f 75 74 20 60 | by.stating.the.two.rules.about.` |
| fc1c0 | 61 70 70 65 6e 64 27 20 67 69 76 65 6e 20 61 62 6f 76 65 2e 20 20 22 48 6f 77 0a 74 6f 22 20 6b | append'.given.above..."How.to".k |
| fc1e0 | 6e 6f 77 6c 65 64 67 65 20 69 73 20 70 72 6f 76 69 64 65 64 20 61 75 74 6f 6d 61 74 69 63 61 6c | nowledge.is.provided.automatical |
| fc200 | 6c 79 20 62 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 6f 20 61 6c 6c 6f 77 20 74 | ly.by.the.interpreter.to.allow.t |
| fc220 | 68 69 73 0a 73 69 6e 67 6c 65 20 70 61 69 72 20 6f 66 20 72 75 6c 65 73 20 74 6f 20 62 65 20 75 | his.single.pair.of.rules.to.be.u |
| fc240 | 73 65 64 20 74 6f 20 61 6e 73 77 65 72 20 61 6c 6c 20 74 68 72 65 65 20 74 79 70 65 73 20 6f 66 | sed.to.answer.all.three.types.of |
| fc260 | 20 71 75 65 73 74 69 6f 6e 73 0a 61 62 6f 75 74 20 60 61 70 70 65 6e 64 27 2e 28 33 29 0a 0a 20 | .questions.about.`append'.(3)... |
| fc280 | 20 20 43 6f 6e 74 65 6d 70 6f 72 61 72 79 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 | ..Contemporary.logic.programming |
| fc2a0 | 20 6c 61 6e 67 75 61 67 65 73 20 28 69 6e 63 6c 75 64 69 6e 67 20 74 68 65 20 6f 6e 65 20 77 65 | .languages.(including.the.one.we |
| fc2c0 | 0a 69 6d 70 6c 65 6d 65 6e 74 20 68 65 72 65 29 20 68 61 76 65 20 73 75 62 73 74 61 6e 74 69 61 | .implement.here).have.substantia |
| fc2e0 | 6c 20 64 65 66 69 63 69 65 6e 63 69 65 73 2c 20 69 6e 20 74 68 61 74 20 74 68 65 69 72 20 67 65 | l.deficiencies,.in.that.their.ge |
| fc300 | 6e 65 72 61 6c 0a 22 68 6f 77 20 74 6f 22 20 6d 65 74 68 6f 64 73 20 63 61 6e 20 6c 65 61 64 20 | neral."how.to".methods.can.lead. |
| fc320 | 74 68 65 6d 20 69 6e 74 6f 20 73 70 75 72 69 6f 75 73 20 69 6e 66 69 6e 69 74 65 20 6c 6f 6f 70 | them.into.spurious.infinite.loop |
| fc340 | 73 20 6f 72 20 6f 74 68 65 72 0a 75 6e 64 65 73 69 72 61 62 6c 65 20 62 65 68 61 76 69 6f 72 2e | s.or.other.undesirable.behavior. |
| fc360 | 20 20 4c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 61 6e 20 61 63 74 69 76 65 | ..Logic.programming.is.an.active |
| fc380 | 20 66 69 65 6c 64 20 6f 66 20 72 65 73 65 61 72 63 68 0a 69 6e 20 63 6f 6d 70 75 74 65 72 20 73 | .field.of.research.in.computer.s |
| fc3a0 | 63 69 65 6e 63 65 2e 28 34 29 0a 0a 20 20 20 45 61 72 6c 69 65 72 20 69 6e 20 74 68 69 73 20 63 | cience.(4).....Earlier.in.this.c |
| fc3c0 | 68 61 70 74 65 72 20 77 65 20 65 78 70 6c 6f 72 65 64 20 74 68 65 20 74 65 63 68 6e 6f 6c 6f 67 | hapter.we.explored.the.technolog |
| fc3e0 | 79 20 6f 66 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 0a 69 6e 74 65 72 70 72 65 74 65 72 73 20 61 | y.of.implementing.interpreters.a |
| fc400 | 6e 64 20 64 65 73 63 72 69 62 65 64 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 74 68 61 74 20 61 | nd.described.the.elements.that.a |
| fc420 | 72 65 20 65 73 73 65 6e 74 69 61 6c 20 74 6f 20 61 6e 0a 69 6e 74 65 72 70 72 65 74 65 72 20 66 | re.essential.to.an.interpreter.f |
| fc440 | 6f 72 20 61 20 4c 69 73 70 2d 6c 69 6b 65 20 6c 61 6e 67 75 61 67 65 20 28 69 6e 64 65 65 64 2c | or.a.Lisp-like.language.(indeed, |
| fc460 | 20 74 6f 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 66 6f 72 20 61 6e 79 0a 63 6f 6e 76 65 | .to.an.interpreter.for.any.conve |
| fc480 | 6e 74 69 6f 6e 61 6c 20 6c 61 6e 67 75 61 67 65 29 2e 20 20 4e 6f 77 20 77 65 20 77 69 6c 6c 20 | ntional.language)...Now.we.will. |
| fc4a0 | 61 70 70 6c 79 20 74 68 65 73 65 20 69 64 65 61 73 20 74 6f 20 64 69 73 63 75 73 73 20 61 6e 0a | apply.these.ideas.to.discuss.an. |
| fc4c0 | 69 6e 74 65 72 70 72 65 74 65 72 20 66 6f 72 20 61 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d | interpreter.for.a.logic.programm |
| fc4e0 | 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 20 20 57 65 20 63 61 6c 6c 20 74 68 69 73 20 6c 61 6e 67 | ing.language...We.call.this.lang |
| fc500 | 75 61 67 65 0a 74 68 65 20 22 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 22 2c 20 62 65 63 61 75 | uage.the."query.language",.becau |
| fc520 | 73 65 20 69 74 20 69 73 20 76 65 72 79 20 75 73 65 66 75 6c 20 66 6f 72 20 72 65 74 72 69 65 76 | se.it.is.very.useful.for.retriev |
| fc540 | 69 6e 67 0a 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 72 6f 6d 20 64 61 74 61 20 62 61 73 65 73 20 | ing.information.from.data.bases. |
| fc560 | 62 79 20 66 6f 72 6d 75 6c 61 74 69 6e 67 20 22 71 75 65 72 69 65 73 22 2c 20 6f 72 20 71 75 65 | by.formulating."queries",.or.que |
| fc580 | 73 74 69 6f 6e 73 2c 0a 65 78 70 72 65 73 73 65 64 20 69 6e 20 74 68 65 20 6c 61 6e 67 75 61 67 | stions,.expressed.in.the.languag |
| fc5a0 | 65 2e 20 20 45 76 65 6e 20 74 68 6f 75 67 68 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 | e...Even.though.the.query.langua |
| fc5c0 | 67 65 20 69 73 20 76 65 72 79 0a 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d 20 4c 69 73 70 2c 20 | ge.is.very.different.from.Lisp,. |
| fc5e0 | 77 65 20 77 69 6c 6c 20 66 69 6e 64 20 69 74 20 63 6f 6e 76 65 6e 69 65 6e 74 20 74 6f 20 64 65 | we.will.find.it.convenient.to.de |
| fc600 | 73 63 72 69 62 65 20 74 68 65 0a 6c 61 6e 67 75 61 67 65 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 | scribe.the.language.in.terms.of. |
| fc620 | 74 68 65 20 73 61 6d 65 20 67 65 6e 65 72 61 6c 20 66 72 61 6d 65 77 6f 72 6b 20 77 65 20 68 61 | the.same.general.framework.we.ha |
| fc640 | 76 65 20 62 65 65 6e 20 75 73 69 6e 67 20 61 6c 6c 0a 61 6c 6f 6e 67 3a 20 61 73 20 61 20 63 6f | ve.been.using.all.along:.as.a.co |
| fc660 | 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 70 72 69 6d 69 74 69 76 65 20 65 6c 65 6d 65 6e 74 73 2c 20 | llection.of.primitive.elements,. |
| fc680 | 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 6d 65 61 6e 73 20 6f 66 0a 63 6f 6d 62 69 6e 61 74 69 | together.with.means.of.combinati |
| fc6a0 | 6f 6e 20 74 68 61 74 20 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 63 6f 6d 62 69 6e 65 20 73 69 6d | on.that.enable.us.to.combine.sim |
| fc6c0 | 70 6c 65 20 65 6c 65 6d 65 6e 74 73 20 74 6f 20 63 72 65 61 74 65 20 6d 6f 72 65 0a 63 6f 6d 70 | ple.elements.to.create.more.comp |
| fc6e0 | 6c 65 78 20 65 6c 65 6d 65 6e 74 73 20 61 6e 64 20 6d 65 61 6e 73 20 6f 66 20 61 62 73 74 72 61 | lex.elements.and.means.of.abstra |
| fc700 | 63 74 69 6f 6e 20 74 68 61 74 20 65 6e 61 62 6c 65 20 75 73 20 74 6f 20 72 65 67 61 72 64 0a 63 | ction.that.enable.us.to.regard.c |
| fc720 | 6f 6d 70 6c 65 78 20 65 6c 65 6d 65 6e 74 73 20 61 73 20 73 69 6e 67 6c 65 20 63 6f 6e 63 65 70 | omplex.elements.as.single.concep |
| fc740 | 74 75 61 6c 20 75 6e 69 74 73 2e 20 20 41 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 66 6f 72 20 | tual.units...An.interpreter.for. |
| fc760 | 61 0a 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 69 73 20 | a.logic.programming.language.is. |
| fc780 | 63 6f 6e 73 69 64 65 72 61 62 6c 79 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 20 74 68 61 6e 20 61 | considerably.more.complex.than.a |
| fc7a0 | 6e 0a 69 6e 74 65 72 70 72 65 74 65 72 20 66 6f 72 20 61 20 6c 61 6e 67 75 61 67 65 20 6c 69 6b | n.interpreter.for.a.language.lik |
| fc7c0 | 65 20 4c 69 73 70 2e 20 20 4e 65 76 65 72 74 68 65 6c 65 73 73 2c 20 77 65 20 77 69 6c 6c 20 73 | e.Lisp...Nevertheless,.we.will.s |
| fc7e0 | 65 65 20 74 68 61 74 0a 6f 75 72 20 71 75 65 72 79 2d 6c 61 6e 67 75 61 67 65 20 69 6e 74 65 72 | ee.that.our.query-language.inter |
| fc800 | 70 72 65 74 65 72 20 63 6f 6e 74 61 69 6e 73 20 6d 61 6e 79 20 6f 66 20 74 68 65 20 73 61 6d 65 | preter.contains.many.of.the.same |
| fc820 | 20 65 6c 65 6d 65 6e 74 73 20 66 6f 75 6e 64 0a 69 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 | .elements.found.in.the.interpret |
| fc840 | 65 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 3a 3a 2e 20 20 49 6e 20 70 | er.of.section.*Note.4-1::...In.p |
| fc860 | 61 72 74 69 63 75 6c 61 72 2c 20 74 68 65 72 65 20 77 69 6c 6c 0a 62 65 20 61 6e 20 22 65 76 61 | articular,.there.will.be.an."eva |
| fc880 | 6c 22 20 70 61 72 74 20 74 68 61 74 20 63 6c 61 73 73 69 66 69 65 73 20 65 78 70 72 65 73 73 69 | l".part.that.classifies.expressi |
| fc8a0 | 6f 6e 73 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 74 79 70 65 20 61 6e 64 20 61 6e 0a 22 61 70 | ons.according.to.type.and.an."ap |
| fc8c0 | 70 6c 79 22 20 70 61 72 74 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 73 20 74 68 65 20 6c 61 | ply".part.that.implements.the.la |
| fc8e0 | 6e 67 75 61 67 65 27 73 20 61 62 73 74 72 61 63 74 69 6f 6e 20 6d 65 63 68 61 6e 69 73 6d 0a 28 | nguage's.abstraction.mechanism.( |
| fc900 | 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 4c 69 73 70 2c 20 | procedures.in.the.case.of.Lisp,. |
| fc920 | 61 6e 64 20 22 72 75 6c 65 73 22 20 69 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 6c 6f 67 69 63 | and."rules".in.the.case.of.logic |
| fc940 | 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 29 2e 20 20 41 6c 73 6f 2c 20 61 20 63 65 6e 74 72 61 6c 20 | .programming)...Also,.a.central. |
| fc960 | 72 6f 6c 65 20 69 73 20 70 6c 61 79 65 64 20 69 6e 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 | role.is.played.in.the.implementa |
| fc980 | 74 69 6f 6e 20 62 79 0a 61 20 66 72 61 6d 65 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 2c 20 | tion.by.a.frame.data.structure,. |
| fc9a0 | 77 68 69 63 68 20 64 65 74 65 72 6d 69 6e 65 73 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 65 | which.determines.the.corresponde |
| fc9c0 | 6e 63 65 20 62 65 74 77 65 65 6e 0a 73 79 6d 62 6f 6c 73 20 61 6e 64 20 74 68 65 69 72 20 61 73 | nce.between.symbols.and.their.as |
| fc9e0 | 73 6f 63 69 61 74 65 64 20 76 61 6c 75 65 73 2e 20 20 4f 6e 65 20 61 64 64 69 74 69 6f 6e 61 6c | sociated.values...One.additional |
| fca00 | 20 69 6e 74 65 72 65 73 74 69 6e 67 20 61 73 70 65 63 74 0a 6f 66 20 6f 75 72 20 71 75 65 72 79 | .interesting.aspect.of.our.query |
| fca20 | 2d 6c 61 6e 67 75 61 67 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 69 73 20 74 68 61 74 | -language.implementation.is.that |
| fca40 | 20 77 65 20 6d 61 6b 65 20 73 75 62 73 74 61 6e 74 69 61 6c 20 75 73 65 20 6f 66 0a 73 74 72 65 | .we.make.substantial.use.of.stre |
| fca60 | 61 6d 73 2c 20 77 68 69 63 68 20 77 65 72 65 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 2a 4e | ams,.which.were.introduced.in.*N |
| fca80 | 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 34 2d 34 | ote.Chapter.3::...*.Menu:..*.4-4 |
| fcaa0 | 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 44 65 64 75 63 74 69 76 65 20 49 6e 66 6f 72 6d | -1::............Deductive.Inform |
| fcac0 | 61 74 69 6f 6e 20 52 65 74 72 69 65 76 61 6c 0a 2a 20 34 2d 34 2d 32 3a 3a 20 20 20 20 20 20 20 | ation.Retrieval.*.4-4-2::....... |
| fcae0 | 20 20 20 20 20 48 6f 77 20 74 68 65 20 51 75 65 72 79 20 53 79 73 74 65 6d 20 57 6f 72 6b 73 0a | .....How.the.Query.System.Works. |
| fcb00 | 2a 20 34 2d 34 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 49 73 20 4c 6f 67 69 63 20 50 72 | *.4-4-3::............Is.Logic.Pr |
| fcb20 | 6f 67 72 61 6d 6d 69 6e 67 20 4d 61 74 68 65 6d 61 74 69 63 61 6c 20 4c 6f 67 69 63 3f 0a 2a 20 | ogramming.Mathematical.Logic?.*. |
| fcb40 | 34 2d 34 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 49 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 | 4-4-4::............Implementing. |
| fcb60 | 74 68 65 20 51 75 65 72 79 20 53 79 73 74 65 6d 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 | the.Query.System.....----------. |
| fcb80 | 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 4c 6f 67 | Footnotes.----------.....(1).Log |
| fcba0 | 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 68 61 73 20 67 72 6f 77 6e 20 6f 75 74 20 6f 66 20 | ic.programming.has.grown.out.of. |
| fcbc0 | 61 20 6c 6f 6e 67 20 68 69 73 74 6f 72 79 20 6f 66 20 72 65 73 65 61 72 63 68 20 69 6e 0a 61 75 | a.long.history.of.research.in.au |
| fcbe0 | 74 6f 6d 61 74 69 63 20 74 68 65 6f 72 65 6d 20 70 72 6f 76 69 6e 67 2e 20 20 45 61 72 6c 79 20 | tomatic.theorem.proving...Early. |
| fcc00 | 74 68 65 6f 72 65 6d 2d 70 72 6f 76 69 6e 67 20 70 72 6f 67 72 61 6d 73 20 63 6f 75 6c 64 0a 61 | theorem-proving.programs.could.a |
| fcc20 | 63 63 6f 6d 70 6c 69 73 68 20 76 65 72 79 20 6c 69 74 74 6c 65 2c 20 62 65 63 61 75 73 65 20 74 | ccomplish.very.little,.because.t |
| fcc40 | 68 65 79 20 65 78 68 61 75 73 74 69 76 65 6c 79 20 73 65 61 72 63 68 65 64 20 74 68 65 20 73 70 | hey.exhaustively.searched.the.sp |
| fcc60 | 61 63 65 20 6f 66 0a 70 6f 73 73 69 62 6c 65 20 70 72 6f 6f 66 73 2e 20 20 54 68 65 20 6d 61 6a | ace.of.possible.proofs...The.maj |
| fcc80 | 6f 72 20 62 72 65 61 6b 74 68 72 6f 75 67 68 20 74 68 61 74 20 6d 61 64 65 20 73 75 63 68 20 61 | or.breakthrough.that.made.such.a |
| fcca0 | 20 73 65 61 72 63 68 0a 70 6c 61 75 73 69 62 6c 65 20 77 61 73 20 74 68 65 20 64 69 73 63 6f 76 | .search.plausible.was.the.discov |
| fccc0 | 65 72 79 20 69 6e 20 74 68 65 20 65 61 72 6c 79 20 31 39 36 30 73 20 6f 66 20 74 68 65 20 22 75 | ery.in.the.early.1960s.of.the."u |
| fcce0 | 6e 69 66 69 63 61 74 69 6f 6e 0a 61 6c 67 6f 72 69 74 68 6d 22 20 61 6e 64 20 74 68 65 20 70 72 | nification.algorithm".and.the.pr |
| fcd00 | 69 6e 63 69 70 6c 65 20 22 72 65 73 6f 6c 75 74 69 6f 6e 20 70 72 69 6e 63 69 70 6c 65 22 20 28 | inciple."resolution.principle".( |
| fcd20 | 52 6f 62 69 6e 73 6f 6e 20 31 39 36 35 29 2e 0a 52 65 73 6f 6c 75 74 69 6f 6e 20 77 61 73 20 75 | Robinson.1965)..Resolution.was.u |
| fcd40 | 73 65 64 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 62 79 20 47 72 65 65 6e 20 61 6e 64 20 52 | sed,.for.example,.by.Green.and.R |
| fcd60 | 61 70 68 61 65 6c 20 28 31 39 36 38 29 20 28 73 65 65 20 61 6c 73 6f 0a 47 72 65 65 6e 20 31 39 | aphael.(1968).(see.also.Green.19 |
| fcd80 | 36 39 29 20 61 73 20 74 68 65 20 62 61 73 69 73 20 66 6f 72 20 61 20 64 65 64 75 63 74 69 76 65 | 69).as.the.basis.for.a.deductive |
| fcda0 | 20 71 75 65 73 74 69 6f 6e 2d 61 6e 73 77 65 72 69 6e 67 20 73 79 73 74 65 6d 2e 0a 44 75 72 69 | .question-answering.system..Duri |
| fcdc0 | 6e 67 20 6d 6f 73 74 20 6f 66 20 74 68 69 73 20 70 65 72 69 6f 64 2c 20 72 65 73 65 61 72 63 68 | ng.most.of.this.period,.research |
| fcde0 | 65 72 73 20 63 6f 6e 63 65 6e 74 72 61 74 65 64 20 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 73 20 74 | ers.concentrated.on.algorithms.t |
| fce00 | 68 61 74 0a 61 72 65 20 67 75 61 72 61 6e 74 65 65 64 20 74 6f 20 66 69 6e 64 20 61 20 70 72 6f | hat.are.guaranteed.to.find.a.pro |
| fce20 | 6f 66 20 69 66 20 6f 6e 65 20 65 78 69 73 74 73 2e 20 20 53 75 63 68 20 61 6c 67 6f 72 69 74 68 | of.if.one.exists...Such.algorith |
| fce40 | 6d 73 20 77 65 72 65 0a 64 69 66 66 69 63 75 6c 74 20 74 6f 20 63 6f 6e 74 72 6f 6c 20 61 6e 64 | ms.were.difficult.to.control.and |
| fce60 | 20 74 6f 20 64 69 72 65 63 74 20 74 6f 77 61 72 64 20 61 20 70 72 6f 6f 66 2e 20 20 48 65 77 69 | .to.direct.toward.a.proof...Hewi |
| fce80 | 74 74 20 28 31 39 36 39 29 0a 72 65 63 6f 67 6e 69 7a 65 64 20 74 68 65 20 70 6f 73 73 69 62 69 | tt.(1969).recognized.the.possibi |
| fcea0 | 6c 69 74 79 20 6f 66 20 6d 65 72 67 69 6e 67 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 73 74 72 75 | lity.of.merging.the.control.stru |
| fcec0 | 63 74 75 72 65 20 6f 66 20 61 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 20 | cture.of.a.programming.language. |
| fcee0 | 77 69 74 68 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 66 20 61 20 6c 6f 67 69 63 2d 6d | with.the.operations.of.a.logic-m |
| fcf00 | 61 6e 69 70 75 6c 61 74 69 6f 6e 20 73 79 73 74 65 6d 2c 0a 6c 65 61 64 69 6e 67 20 74 6f 20 74 | anipulation.system,.leading.to.t |
| fcf20 | 68 65 20 77 6f 72 6b 20 69 6e 20 61 75 74 6f 6d 61 74 69 63 20 73 65 61 72 63 68 20 6d 65 6e 74 | he.work.in.automatic.search.ment |
| fcf40 | 69 6f 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 34 2d 33 2d 31 3a 3a 20 28 | ioned.in.section.*Note.4-3-1::.( |
| fcf60 | 66 6f 6f 74 6e 6f 74 65 20 2a 4e 6f 74 65 20 46 6f 6f 74 6e 6f 74 65 20 34 2d 34 37 3a 3a 29 2e | footnote.*Note.Footnote.4-47::). |
| fcf80 | 20 20 41 74 20 74 68 65 20 73 61 6d 65 20 74 69 6d 65 20 74 68 61 74 20 74 68 69 73 0a 77 61 73 | ..At.the.same.time.that.this.was |
| fcfa0 | 20 62 65 69 6e 67 20 64 6f 6e 65 2c 20 43 6f 6c 6d 65 72 61 75 65 72 2c 20 69 6e 20 4d 61 72 73 | .being.done,.Colmerauer,.in.Mars |
| fcfc0 | 65 69 6c 6c 65 2c 20 77 61 73 20 64 65 76 65 6c 6f 70 69 6e 67 20 72 75 6c 65 2d 62 61 73 65 64 | eille,.was.developing.rule-based |
| fcfe0 | 0a 73 79 73 74 65 6d 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 6e 61 74 75 72 61 | .systems.for.manipulating.natura |
| fd000 | 6c 20 6c 61 6e 67 75 61 67 65 20 28 73 65 65 20 43 6f 6c 6d 65 72 61 75 65 72 20 65 74 20 61 6c | l.language.(see.Colmerauer.et.al |
| fd020 | 2e 20 31 39 37 33 29 2e 0a 48 65 20 69 6e 76 65 6e 74 65 64 20 61 20 70 72 6f 67 72 61 6d 6d 69 | ..1973)..He.invented.a.programmi |
| fd040 | 6e 67 20 6c 61 6e 67 75 61 67 65 20 63 61 6c 6c 65 64 20 50 72 6f 6c 6f 67 20 66 6f 72 20 72 65 | ng.language.called.Prolog.for.re |
| fd060 | 70 72 65 73 65 6e 74 69 6e 67 0a 74 68 6f 73 65 20 72 75 6c 65 73 2e 20 20 4b 6f 77 61 6c 73 6b | presenting.those.rules...Kowalsk |
| fd080 | 69 20 28 31 39 37 33 3b 20 31 39 37 39 29 2c 20 69 6e 20 45 64 69 6e 62 75 72 67 68 2c 20 72 65 | i.(1973;.1979),.in.Edinburgh,.re |
| fd0a0 | 63 6f 67 6e 69 7a 65 64 20 74 68 61 74 0a 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 61 20 50 72 6f | cognized.that.execution.of.a.Pro |
| fd0c0 | 6c 6f 67 20 70 72 6f 67 72 61 6d 20 63 6f 75 6c 64 20 62 65 20 69 6e 74 65 72 70 72 65 74 65 64 | log.program.could.be.interpreted |
| fd0e0 | 20 61 73 20 70 72 6f 76 69 6e 67 20 74 68 65 6f 72 65 6d 73 0a 28 75 73 69 6e 67 20 61 20 70 72 | .as.proving.theorems.(using.a.pr |
| fd100 | 6f 6f 66 20 74 65 63 68 6e 69 71 75 65 20 63 61 6c 6c 65 64 20 6c 69 6e 65 61 72 20 48 6f 72 6e | oof.technique.called.linear.Horn |
| fd120 | 2d 63 6c 61 75 73 65 20 72 65 73 6f 6c 75 74 69 6f 6e 29 2e 20 20 54 68 65 0a 6d 65 72 67 69 6e | -clause.resolution)...The.mergin |
| fd140 | 67 20 6f 66 20 74 68 65 20 6c 61 73 74 20 74 77 6f 20 73 74 72 61 6e 64 73 20 6c 65 64 20 74 6f | g.of.the.last.two.strands.led.to |
| fd160 | 20 74 68 65 20 6c 6f 67 69 63 2d 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6d 6f 76 65 6d 65 6e 74 2e | .the.logic-programming.movement. |
| fd180 | 0a 54 68 75 73 2c 20 69 6e 20 61 73 73 69 67 6e 69 6e 67 20 63 72 65 64 69 74 20 66 6f 72 20 74 | .Thus,.in.assigning.credit.for.t |
| fd1a0 | 68 65 20 64 65 76 65 6c 6f 70 6d 65 6e 74 20 6f 66 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d | he.development.of.logic.programm |
| fd1c0 | 69 6e 67 2c 20 74 68 65 0a 46 72 65 6e 63 68 20 63 61 6e 20 70 6f 69 6e 74 20 74 6f 20 50 72 6f | ing,.the.French.can.point.to.Pro |
| fd1e0 | 6c 6f 67 27 73 20 67 65 6e 65 73 69 73 20 61 74 20 74 68 65 20 55 6e 69 76 65 72 73 69 74 79 20 | log's.genesis.at.the.University. |
| fd200 | 6f 66 20 4d 61 72 73 65 69 6c 6c 65 2c 0a 77 68 69 6c 65 20 74 68 65 20 42 72 69 74 69 73 68 20 | of.Marseille,.while.the.British. |
| fd220 | 63 61 6e 20 68 69 67 68 6c 69 67 68 74 20 74 68 65 20 77 6f 72 6b 20 61 74 20 74 68 65 20 55 6e | can.highlight.the.work.at.the.Un |
| fd240 | 69 76 65 72 73 69 74 79 20 6f 66 0a 45 64 69 6e 62 75 72 67 68 2e 20 20 41 63 63 6f 72 64 69 6e | iversity.of.Edinburgh...Accordin |
| fd260 | 67 20 74 6f 20 70 65 6f 70 6c 65 20 61 74 20 4d 49 54 2c 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 | g.to.people.at.MIT,.logic.progra |
| fd280 | 6d 6d 69 6e 67 20 77 61 73 20 64 65 76 65 6c 6f 70 65 64 0a 62 79 20 74 68 65 73 65 20 67 72 6f | mming.was.developed.by.these.gro |
| fd2a0 | 75 70 73 20 69 6e 20 61 6e 20 61 74 74 65 6d 70 74 20 74 6f 20 66 69 67 75 72 65 20 6f 75 74 20 | ups.in.an.attempt.to.figure.out. |
| fd2c0 | 77 68 61 74 20 48 65 77 69 74 74 20 77 61 73 20 74 61 6c 6b 69 6e 67 0a 61 62 6f 75 74 20 69 6e | what.Hewitt.was.talking.about.in |
| fd2e0 | 20 68 69 73 20 62 72 69 6c 6c 69 61 6e 74 20 62 75 74 20 69 6d 70 65 6e 65 74 72 61 62 6c 65 20 | .his.brilliant.but.impenetrable. |
| fd300 | 50 68 2e 44 2e 20 74 68 65 73 69 73 2e 20 20 46 6f 72 20 61 20 68 69 73 74 6f 72 79 20 6f 66 0a | Ph.D..thesis...For.a.history.of. |
| fd320 | 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2c 20 73 65 65 20 52 6f 62 69 6e 73 6f 6e 20 | logic.programming,.see.Robinson. |
| fd340 | 31 39 38 33 2e 0a 0a 20 20 20 28 32 29 20 54 6f 20 73 65 65 20 74 68 65 20 63 6f 72 72 65 73 70 | 1983......(2).To.see.the.corresp |
| fd360 | 6f 6e 64 65 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 65 20 72 75 6c 65 73 20 61 6e 64 20 74 68 | ondence.between.the.rules.and.th |
| fd380 | 65 20 70 72 6f 63 65 64 75 72 65 2c 0a 6c 65 74 20 60 78 27 20 69 6e 20 74 68 65 20 70 72 6f 63 | e.procedure,.let.`x'.in.the.proc |
| fd3a0 | 65 64 75 72 65 20 28 77 68 65 72 65 20 60 78 27 20 69 73 20 6e 6f 6e 65 6d 70 74 79 29 20 63 6f | edure.(where.`x'.is.nonempty).co |
| fd3c0 | 72 72 65 73 70 6f 6e 64 20 74 6f 20 60 28 63 6f 6e 73 20 75 0a 76 29 27 20 69 6e 20 74 68 65 20 | rrespond.to.`(cons.u.v)'.in.the. |
| fd3e0 | 72 75 6c 65 2e 20 20 54 68 65 6e 20 60 7a 27 20 69 6e 20 74 68 65 20 72 75 6c 65 20 63 6f 72 72 | rule...Then.`z'.in.the.rule.corr |
| fd400 | 65 73 70 6f 6e 64 73 20 74 6f 20 74 68 65 20 60 61 70 70 65 6e 64 27 20 6f 66 0a 60 28 63 64 72 | esponds.to.the.`append'.of.`(cdr |
| fd420 | 20 78 29 27 20 61 6e 64 20 60 79 27 2e 0a 0a 20 20 20 28 33 29 20 54 68 69 73 20 63 65 72 74 61 | .x)'.and.`y'......(3).This.certa |
| fd440 | 69 6e 6c 79 20 64 6f 65 73 20 6e 6f 74 20 72 65 6c 69 65 76 65 20 74 68 65 20 75 73 65 72 20 6f | inly.does.not.relieve.the.user.o |
| fd460 | 66 20 74 68 65 20 65 6e 74 69 72 65 20 70 72 6f 62 6c 65 6d 0a 6f 66 20 68 6f 77 20 74 6f 20 63 | f.the.entire.problem.of.how.to.c |
| fd480 | 6f 6d 70 75 74 65 20 74 68 65 20 61 6e 73 77 65 72 2e 20 20 54 68 65 72 65 20 61 72 65 20 6d 61 | ompute.the.answer...There.are.ma |
| fd4a0 | 6e 79 20 64 69 66 66 65 72 65 6e 74 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 6c 79 0a 65 71 75 69 | ny.different.mathematically.equi |
| fd4c0 | 76 61 6c 65 6e 74 20 73 65 74 73 20 6f 66 20 72 75 6c 65 73 20 66 6f 72 20 66 6f 72 6d 75 6c 61 | valent.sets.of.rules.for.formula |
| fd4e0 | 74 69 6e 67 20 74 68 65 20 60 61 70 70 65 6e 64 27 20 72 65 6c 61 74 69 6f 6e 2c 20 6f 6e 6c 79 | ting.the.`append'.relation,.only |
| fd500 | 0a 73 6f 6d 65 20 6f 66 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 74 75 72 6e 65 64 20 69 6e 74 | .some.of.which.can.be.turned.int |
| fd520 | 6f 20 65 66 66 65 63 74 69 76 65 20 64 65 76 69 63 65 73 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e | o.effective.devices.for.computin |
| fd540 | 67 20 69 6e 20 61 6e 79 0a 64 69 72 65 63 74 69 6f 6e 2e 20 20 49 6e 20 61 64 64 69 74 69 6f 6e | g.in.any.direction...In.addition |
| fd560 | 2c 20 73 6f 6d 65 74 69 6d 65 73 20 22 77 68 61 74 20 69 73 22 20 69 6e 66 6f 72 6d 61 74 69 6f | ,.sometimes."what.is".informatio |
| fd580 | 6e 20 67 69 76 65 73 20 6e 6f 20 63 6c 75 65 0a 22 68 6f 77 20 74 6f 22 20 63 6f 6d 70 75 74 65 | n.gives.no.clue."how.to".compute |
| fd5a0 | 20 61 6e 20 61 6e 73 77 65 72 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 63 6f 6e 73 69 64 | .an.answer...For.example,.consid |
| fd5c0 | 65 72 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 0a 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 | er.the.problem.of.computing.the. |
| fd5e0 | 79 20 73 75 63 68 20 74 68 61 74 20 79 5e 32 20 3d 20 78 2e 0a 0a 20 20 20 28 34 29 20 49 6e 74 | y.such.that.y^2.=.x......(4).Int |
| fd600 | 65 72 65 73 74 20 69 6e 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 70 65 61 6b 65 | erest.in.logic.programming.peake |
| fd620 | 64 20 64 75 72 69 6e 67 20 74 68 65 20 65 61 72 6c 79 20 38 30 73 20 77 68 65 6e 0a 74 68 65 20 | d.during.the.early.80s.when.the. |
| fd640 | 4a 61 70 61 6e 65 73 65 20 67 6f 76 65 72 6e 6d 65 6e 74 20 62 65 67 61 6e 20 61 6e 20 61 6d 62 | Japanese.government.began.an.amb |
| fd660 | 69 74 69 6f 75 73 20 70 72 6f 6a 65 63 74 20 61 69 6d 65 64 20 61 74 20 62 75 69 6c 64 69 6e 67 | itious.project.aimed.at.building |
| fd680 | 0a 73 75 70 65 72 66 61 73 74 20 63 6f 6d 70 75 74 65 72 73 20 6f 70 74 69 6d 69 7a 65 64 20 74 | .superfast.computers.optimized.t |
| fd6a0 | 6f 20 72 75 6e 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 | o.run.logic.programming.language |
| fd6c0 | 73 2e 20 20 54 68 65 0a 73 70 65 65 64 20 6f 66 20 73 75 63 68 20 63 6f 6d 70 75 74 65 72 73 20 | s...The.speed.of.such.computers. |
| fd6e0 | 77 61 73 20 74 6f 20 62 65 20 6d 65 61 73 75 72 65 64 20 69 6e 20 4c 49 50 53 20 28 4c 6f 67 69 | was.to.be.measured.in.LIPS.(Logi |
| fd700 | 63 61 6c 20 49 6e 66 65 72 65 6e 63 65 73 0a 50 65 72 20 53 65 63 6f 6e 64 29 20 72 61 74 68 65 | cal.Inferences.Per.Second).rathe |
| fd720 | 72 20 74 68 61 6e 20 74 68 65 20 75 73 75 61 6c 20 46 4c 4f 50 53 20 28 46 4c 6f 61 74 69 6e 67 | r.than.the.usual.FLOPS.(FLoating |
| fd740 | 2d 70 6f 69 6e 74 20 4f 70 65 72 61 74 69 6f 6e 73 20 50 65 72 0a 53 65 63 6f 6e 64 29 2e 20 20 | -point.Operations.Per.Second)... |
| fd760 | 41 6c 74 68 6f 75 67 68 20 74 68 65 20 70 72 6f 6a 65 63 74 20 73 75 63 63 65 65 64 65 64 20 69 | Although.the.project.succeeded.i |
| fd780 | 6e 20 64 65 76 65 6c 6f 70 69 6e 67 20 68 61 72 64 77 61 72 65 20 61 6e 64 0a 73 6f 66 74 77 61 | n.developing.hardware.and.softwa |
| fd7a0 | 72 65 20 61 73 20 6f 72 69 67 69 6e 61 6c 6c 79 20 70 6c 61 6e 6e 65 64 2c 20 74 68 65 20 69 6e | re.as.originally.planned,.the.in |
| fd7c0 | 74 65 72 6e 61 74 69 6f 6e 61 6c 20 63 6f 6d 70 75 74 65 72 20 69 6e 64 75 73 74 72 79 0a 6d 6f | ternational.computer.industry.mo |
| fd7e0 | 76 65 64 20 69 6e 20 61 20 64 69 66 66 65 72 65 6e 74 20 64 69 72 65 63 74 69 6f 6e 2e 20 20 53 | ved.in.a.different.direction...S |
| fd800 | 65 65 20 46 65 69 67 65 6e 62 61 75 6d 20 61 6e 64 20 53 68 72 6f 62 65 20 31 39 39 33 20 66 6f | ee.Feigenbaum.and.Shrobe.1993.fo |
| fd820 | 72 20 61 6e 0a 6f 76 65 72 76 69 65 77 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 | r.an.overview.evaluation.of.the. |
| fd840 | 4a 61 70 61 6e 65 73 65 20 70 72 6f 6a 65 63 74 2e 20 20 54 68 65 20 6c 6f 67 69 63 20 70 72 6f | Japanese.project...The.logic.pro |
| fd860 | 67 72 61 6d 6d 69 6e 67 0a 63 6f 6d 6d 75 6e 69 74 79 20 68 61 73 20 61 6c 73 6f 20 6d 6f 76 65 | gramming.community.has.also.move |
| fd880 | 64 20 6f 6e 20 74 6f 20 63 6f 6e 73 69 64 65 72 20 72 65 6c 61 74 69 6f 6e 61 6c 20 70 72 6f 67 | d.on.to.consider.relational.prog |
| fd8a0 | 72 61 6d 6d 69 6e 67 20 62 61 73 65 64 20 6f 6e 0a 74 65 63 68 6e 69 71 75 65 73 20 6f 74 68 65 | ramming.based.on.techniques.othe |
| fd8c0 | 72 20 74 68 61 6e 20 73 69 6d 70 6c 65 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 69 6e 67 2c 20 | r.than.simple.pattern.matching,. |
| fd8e0 | 73 75 63 68 20 61 73 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 0a 64 65 61 6c 20 77 69 74 68 | such.as.the.ability.to.deal.with |
| fd900 | 20 6e 75 6d 65 72 69 63 61 6c 20 63 6f 6e 73 74 72 61 69 6e 74 73 20 73 75 63 68 20 61 73 20 74 | .numerical.constraints.such.as.t |
| fd920 | 68 65 20 6f 6e 65 73 20 69 6c 6c 75 73 74 72 61 74 65 64 20 69 6e 20 74 68 65 0a 63 6f 6e 73 74 | he.ones.illustrated.in.the.const |
| fd940 | 72 61 69 6e 74 2d 70 72 6f 70 61 67 61 74 69 6f 6e 20 73 79 73 74 65 6d 20 6f 66 20 73 65 63 74 | raint-propagation.system.of.sect |
| fd960 | 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 33 2d 35 3a 3a 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 | ion.*Note.3-3-5::.....File:.sicp |
| fd980 | 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 34 2d 31 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2d | .info,..Node:.4-4-1,..Next:.4-4- |
| fd9a0 | 32 2c 20 20 50 72 65 76 3a 20 34 2d 34 2c 20 20 55 70 3a 20 34 2d 34 0a 0a 34 2e 34 2e 31 20 44 | 2,..Prev:.4-4,..Up:.4-4..4.4.1.D |
| fd9c0 | 65 64 75 63 74 69 76 65 20 49 6e 66 6f 72 6d 61 74 69 6f 6e 20 52 65 74 72 69 65 76 61 6c 0a 2d | eductive.Information.Retrieval.- |
| fd9e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| fda00 | 2d 2d 2d 2d 0a 0a 4c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 65 78 63 65 6c 73 20 69 | ----..Logic.programming.excels.i |
| fda20 | 6e 20 70 72 6f 76 69 64 69 6e 67 20 69 6e 74 65 72 66 61 63 65 73 20 74 6f 20 64 61 74 61 20 62 | n.providing.interfaces.to.data.b |
| fda40 | 61 73 65 73 20 66 6f 72 0a 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 72 65 74 72 69 65 76 61 6c 2e 20 | ases.for.information.retrieval.. |
| fda60 | 20 54 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 20 77 65 20 73 68 61 6c 6c 20 69 6d 70 | .The.query.language.we.shall.imp |
| fda80 | 6c 65 6d 65 6e 74 20 69 6e 20 74 68 69 73 0a 63 68 61 70 74 65 72 20 69 73 20 64 65 73 69 67 6e | lement.in.this.chapter.is.design |
| fdaa0 | 65 64 20 74 6f 20 62 65 20 75 73 65 64 20 69 6e 20 74 68 69 73 20 77 61 79 2e 0a 0a 20 20 20 49 | ed.to.be.used.in.this.way......I |
| fdac0 | 6e 20 6f 72 64 65 72 20 74 6f 20 69 6c 6c 75 73 74 72 61 74 65 20 77 68 61 74 20 74 68 65 20 71 | n.order.to.illustrate.what.the.q |
| fdae0 | 75 65 72 79 20 73 79 73 74 65 6d 20 64 6f 65 73 2c 20 77 65 20 77 69 6c 6c 20 73 68 6f 77 20 68 | uery.system.does,.we.will.show.h |
| fdb00 | 6f 77 0a 69 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 6d 61 6e 61 67 65 20 74 68 65 20 | ow.it.can.be.used.to.manage.the. |
| fdb20 | 64 61 74 61 20 62 61 73 65 20 6f 66 20 70 65 72 73 6f 6e 6e 65 6c 20 72 65 63 6f 72 64 73 20 66 | data.base.of.personnel.records.f |
| fdb40 | 6f 72 0a 4d 69 63 72 6f 73 68 61 66 74 2c 20 61 20 74 68 72 69 76 69 6e 67 20 68 69 67 68 2d 74 | or.Microshaft,.a.thriving.high-t |
| fdb60 | 65 63 68 6e 6f 6c 6f 67 79 20 63 6f 6d 70 61 6e 79 20 69 6e 20 74 68 65 20 42 6f 73 74 6f 6e 20 | echnology.company.in.the.Boston. |
| fdb80 | 61 72 65 61 2e 20 20 54 68 65 0a 6c 61 6e 67 75 61 67 65 20 70 72 6f 76 69 64 65 73 20 70 61 74 | area...The.language.provides.pat |
| fdba0 | 74 65 72 6e 2d 64 69 72 65 63 74 65 64 20 61 63 63 65 73 73 20 74 6f 20 70 65 72 73 6f 6e 6e 65 | tern-directed.access.to.personne |
| fdbc0 | 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 6e 64 0a 63 61 6e 20 61 6c 73 6f 20 74 61 6b 65 20 | l.information.and.can.also.take. |
| fdbe0 | 61 64 76 61 6e 74 61 67 65 20 6f 66 20 67 65 6e 65 72 61 6c 20 72 75 6c 65 73 20 69 6e 20 6f 72 | advantage.of.general.rules.in.or |
| fdc00 | 64 65 72 20 74 6f 20 6d 61 6b 65 20 6c 6f 67 69 63 61 6c 0a 64 65 64 75 63 74 69 6f 6e 73 2e 0a | der.to.make.logical.deductions.. |
| fdc20 | 0a 41 20 73 61 6d 70 6c 65 20 64 61 74 61 20 62 61 73 65 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | .A.sample.data.base............. |
| fdc40 | 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 70 65 72 73 6f 6e 6e 65 6c 20 64 61 74 61 20 62 61 73 65 20 | ........The.personnel.data.base. |
| fdc60 | 66 6f 72 20 4d 69 63 72 6f 73 68 61 66 74 20 63 6f 6e 74 61 69 6e 73 20 22 61 73 73 65 72 74 69 | for.Microshaft.contains."asserti |
| fdc80 | 6f 6e 73 22 20 61 62 6f 75 74 0a 63 6f 6d 70 61 6e 79 20 70 65 72 73 6f 6e 6e 65 6c 2e 20 20 48 | ons".about.company.personnel...H |
| fdca0 | 65 72 65 20 69 73 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20 42 65 6e | ere.is.the.information.about.Ben |
| fdcc0 | 20 42 69 74 64 69 64 64 6c 65 2c 20 74 68 65 0a 72 65 73 69 64 65 6e 74 20 63 6f 6d 70 75 74 65 | .Bitdiddle,.the.resident.compute |
| fdce0 | 72 20 77 69 7a 61 72 64 3a 0a 0a 20 20 20 20 20 28 61 64 64 72 65 73 73 20 28 42 69 74 64 69 64 | r.wizard:.......(address.(Bitdid |
| fdd00 | 64 6c 65 20 42 65 6e 29 20 28 53 6c 75 6d 65 72 76 69 6c 6c 65 20 28 52 69 64 67 65 20 52 6f 61 | dle.Ben).(Slumerville.(Ridge.Roa |
| fdd20 | 64 29 20 31 30 29 29 0a 20 20 20 20 20 28 6a 6f 62 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e | d).10))......(job.(Bitdiddle.Ben |
| fdd40 | 29 20 28 63 6f 6d 70 75 74 65 72 20 77 69 7a 61 72 64 29 29 0a 20 20 20 20 20 28 73 61 6c 61 72 | ).(computer.wizard))......(salar |
| fdd60 | 79 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 20 36 30 30 30 30 29 0a 0a 20 20 20 45 61 63 | y.(Bitdiddle.Ben).60000).....Eac |
| fdd80 | 68 20 61 73 73 65 72 74 69 6f 6e 20 69 73 20 61 20 6c 69 73 74 20 28 69 6e 20 74 68 69 73 20 63 | h.assertion.is.a.list.(in.this.c |
| fdda0 | 61 73 65 20 61 20 74 72 69 70 6c 65 29 20 77 68 6f 73 65 20 65 6c 65 6d 65 6e 74 73 20 63 61 6e | ase.a.triple).whose.elements.can |
| fddc0 | 0a 74 68 65 6d 73 65 6c 76 65 73 20 62 65 20 6c 69 73 74 73 2e 0a 0a 20 20 20 41 73 20 72 65 73 | .themselves.be.lists......As.res |
| fdde0 | 69 64 65 6e 74 20 77 69 7a 61 72 64 2c 20 42 65 6e 20 69 73 20 69 6e 20 63 68 61 72 67 65 20 6f | ident.wizard,.Ben.is.in.charge.o |
| fde00 | 66 20 74 68 65 20 63 6f 6d 70 61 6e 79 27 73 20 63 6f 6d 70 75 74 65 72 0a 64 69 76 69 73 69 6f | f.the.company's.computer.divisio |
| fde20 | 6e 2c 20 61 6e 64 20 68 65 20 73 75 70 65 72 76 69 73 65 73 20 74 77 6f 20 70 72 6f 67 72 61 6d | n,.and.he.supervises.two.program |
| fde40 | 6d 65 72 73 20 61 6e 64 20 6f 6e 65 20 74 65 63 68 6e 69 63 69 61 6e 2e 20 20 48 65 72 65 0a 69 | mers.and.one.technician...Here.i |
| fde60 | 73 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20 74 68 65 6d 3a 0a 0a 20 | s.the.information.about.them:... |
| fde80 | 20 20 20 20 28 61 64 64 72 65 73 73 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 20 28 | ....(address.(Hacker.Alyssa.P).( |
| fdea0 | 43 61 6d 62 72 69 64 67 65 20 28 4d 61 73 73 20 41 76 65 29 20 37 38 29 29 0a 20 20 20 20 20 28 | Cambridge.(Mass.Ave).78))......( |
| fdec0 | 6a 6f 62 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 20 28 63 6f 6d 70 75 74 65 72 20 | job.(Hacker.Alyssa.P).(computer. |
| fdee0 | 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a 20 20 20 20 20 28 73 61 6c 61 72 79 20 28 48 61 63 6b 65 | programmer))......(salary.(Hacke |
| fdf00 | 72 20 41 6c 79 73 73 61 20 50 29 20 34 30 30 30 30 29 0a 20 20 20 20 20 28 73 75 70 65 72 76 69 | r.Alyssa.P).40000)......(supervi |
| fdf20 | 73 6f 72 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 20 28 42 69 74 64 69 64 64 6c 65 | sor.(Hacker.Alyssa.P).(Bitdiddle |
| fdf40 | 20 42 65 6e 29 29 0a 0a 20 20 20 20 20 28 61 64 64 72 65 73 73 20 28 46 65 63 74 20 43 79 20 44 | .Ben)).......(address.(Fect.Cy.D |
| fdf60 | 29 20 28 43 61 6d 62 72 69 64 67 65 20 28 41 6d 65 73 20 53 74 72 65 65 74 29 20 33 29 29 0a 20 | ).(Cambridge.(Ames.Street).3)).. |
| fdf80 | 20 20 20 20 28 6a 6f 62 20 28 46 65 63 74 20 43 79 20 44 29 20 28 63 6f 6d 70 75 74 65 72 20 70 | ....(job.(Fect.Cy.D).(computer.p |
| fdfa0 | 72 6f 67 72 61 6d 6d 65 72 29 29 0a 20 20 20 20 20 28 73 61 6c 61 72 79 20 28 46 65 63 74 20 43 | rogrammer))......(salary.(Fect.C |
| fdfc0 | 79 20 44 29 20 33 35 30 30 30 29 0a 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 28 46 65 | y.D).35000)......(supervisor.(Fe |
| fdfe0 | 63 74 20 43 79 20 44 29 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 0a 0a 20 20 20 20 20 | ct.Cy.D).(Bitdiddle.Ben))....... |
| fe000 | 28 61 64 64 72 65 73 73 20 28 54 77 65 61 6b 69 74 20 4c 65 6d 20 45 29 20 28 42 6f 73 74 6f 6e | (address.(Tweakit.Lem.E).(Boston |
| fe020 | 20 28 42 61 79 20 53 74 61 74 65 20 52 6f 61 64 29 20 32 32 29 29 0a 20 20 20 20 20 28 6a 6f 62 | .(Bay.State.Road).22))......(job |
| fe040 | 20 28 54 77 65 61 6b 69 74 20 4c 65 6d 20 45 29 20 28 63 6f 6d 70 75 74 65 72 20 74 65 63 68 6e | .(Tweakit.Lem.E).(computer.techn |
| fe060 | 69 63 69 61 6e 29 29 0a 20 20 20 20 20 28 73 61 6c 61 72 79 20 28 54 77 65 61 6b 69 74 20 4c 65 | ician))......(salary.(Tweakit.Le |
| fe080 | 6d 20 45 29 20 32 35 30 30 30 29 0a 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 28 54 77 | m.E).25000)......(supervisor.(Tw |
| fe0a0 | 65 61 6b 69 74 20 4c 65 6d 20 45 29 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 0a 0a 20 | eakit.Lem.E).(Bitdiddle.Ben))... |
| fe0c0 | 20 20 54 68 65 72 65 20 69 73 20 61 6c 73 6f 20 61 20 70 72 6f 67 72 61 6d 6d 65 72 20 74 72 61 | ..There.is.also.a.programmer.tra |
| fe0e0 | 69 6e 65 65 2c 20 77 68 6f 20 69 73 20 73 75 70 65 72 76 69 73 65 64 20 62 79 20 41 6c 79 73 73 | inee,.who.is.supervised.by.Alyss |
| fe100 | 61 3a 0a 0a 20 20 20 20 20 28 61 64 64 72 65 73 73 20 28 52 65 61 73 6f 6e 65 72 20 4c 6f 75 69 | a:.......(address.(Reasoner.Loui |
| fe120 | 73 29 20 28 53 6c 75 6d 65 72 76 69 6c 6c 65 20 28 50 69 6e 65 20 54 72 65 65 20 52 6f 61 64 29 | s).(Slumerville.(Pine.Tree.Road) |
| fe140 | 20 38 30 29 29 0a 20 20 20 20 20 28 6a 6f 62 20 28 52 65 61 73 6f 6e 65 72 20 4c 6f 75 69 73 29 | .80))......(job.(Reasoner.Louis) |
| fe160 | 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 20 74 72 61 69 6e 65 65 29 29 0a | .(computer.programmer.trainee)). |
| fe180 | 20 20 20 20 20 28 73 61 6c 61 72 79 20 28 52 65 61 73 6f 6e 65 72 20 4c 6f 75 69 73 29 20 33 30 | .....(salary.(Reasoner.Louis).30 |
| fe1a0 | 30 30 30 29 0a 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 28 52 65 61 73 6f 6e 65 72 20 | 000)......(supervisor.(Reasoner. |
| fe1c0 | 4c 6f 75 69 73 29 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 29 0a 0a 20 20 20 41 6c | Louis).(Hacker.Alyssa.P)).....Al |
| fe1e0 | 6c 20 6f 66 20 74 68 65 73 65 20 70 65 6f 70 6c 65 20 61 72 65 20 69 6e 20 74 68 65 20 63 6f 6d | l.of.these.people.are.in.the.com |
| fe200 | 70 75 74 65 72 20 64 69 76 69 73 69 6f 6e 2c 20 61 73 20 69 6e 64 69 63 61 74 65 64 20 62 79 0a | puter.division,.as.indicated.by. |
| fe220 | 74 68 65 20 77 6f 72 64 20 60 63 6f 6d 70 75 74 65 72 27 20 61 73 20 74 68 65 20 66 69 72 73 74 | the.word.`computer'.as.the.first |
| fe240 | 20 69 74 65 6d 20 69 6e 20 74 68 65 69 72 20 6a 6f 62 20 64 65 73 63 72 69 70 74 69 6f 6e 73 2e | .item.in.their.job.descriptions. |
| fe260 | 0a 0a 20 20 20 42 65 6e 20 69 73 20 61 20 68 69 67 68 2d 6c 65 76 65 6c 20 65 6d 70 6c 6f 79 65 | .....Ben.is.a.high-level.employe |
| fe280 | 65 2e 20 20 48 69 73 20 73 75 70 65 72 76 69 73 6f 72 20 69 73 20 74 68 65 20 63 6f 6d 70 61 6e | e...His.supervisor.is.the.compan |
| fe2a0 | 79 27 73 20 62 69 67 0a 77 68 65 65 6c 20 68 69 6d 73 65 6c 66 3a 0a 0a 20 20 20 20 20 28 73 75 | y's.big.wheel.himself:.......(su |
| fe2c0 | 70 65 72 76 69 73 6f 72 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 20 28 57 61 72 62 75 63 | pervisor.(Bitdiddle.Ben).(Warbuc |
| fe2e0 | 6b 73 20 4f 6c 69 76 65 72 29 29 0a 0a 20 20 20 20 20 28 61 64 64 72 65 73 73 20 28 57 61 72 62 | ks.Oliver)).......(address.(Warb |
| fe300 | 75 63 6b 73 20 4f 6c 69 76 65 72 29 20 28 53 77 65 6c 6c 65 73 6c 65 79 20 28 54 6f 70 20 48 65 | ucks.Oliver).(Swellesley.(Top.He |
| fe320 | 61 70 20 52 6f 61 64 29 29 29 0a 20 20 20 20 20 28 6a 6f 62 20 28 57 61 72 62 75 63 6b 73 20 4f | ap.Road)))......(job.(Warbucks.O |
| fe340 | 6c 69 76 65 72 29 20 28 61 64 6d 69 6e 69 73 74 72 61 74 69 6f 6e 20 62 69 67 20 77 68 65 65 6c | liver).(administration.big.wheel |
| fe360 | 29 29 0a 20 20 20 20 20 28 73 61 6c 61 72 79 20 28 57 61 72 62 75 63 6b 73 20 4f 6c 69 76 65 72 | ))......(salary.(Warbucks.Oliver |
| fe380 | 29 20 31 35 30 30 30 30 29 0a 0a 20 20 20 42 65 73 69 64 65 73 20 74 68 65 20 63 6f 6d 70 75 74 | ).150000).....Besides.the.comput |
| fe3a0 | 65 72 20 64 69 76 69 73 69 6f 6e 20 73 75 70 65 72 76 69 73 65 64 20 62 79 20 42 65 6e 2c 20 74 | er.division.supervised.by.Ben,.t |
| fe3c0 | 68 65 20 63 6f 6d 70 61 6e 79 20 68 61 73 20 61 6e 0a 61 63 63 6f 75 6e 74 69 6e 67 20 64 69 76 | he.company.has.an.accounting.div |
| fe3e0 | 69 73 69 6f 6e 2c 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 61 20 63 68 69 65 66 20 61 63 63 | ision,.consisting.of.a.chief.acc |
| fe400 | 6f 75 6e 74 61 6e 74 20 61 6e 64 20 68 69 73 20 61 73 73 69 73 74 61 6e 74 3a 0a 0a 20 20 20 20 | ountant.and.his.assistant:...... |
| fe420 | 20 28 61 64 64 72 65 73 73 20 28 53 63 72 6f 6f 67 65 20 45 62 65 6e 29 20 28 57 65 73 74 6f 6e | .(address.(Scrooge.Eben).(Weston |
| fe440 | 20 28 53 68 61 64 79 20 4c 61 6e 65 29 20 31 30 29 29 0a 20 20 20 20 20 28 6a 6f 62 20 28 53 63 | .(Shady.Lane).10))......(job.(Sc |
| fe460 | 72 6f 6f 67 65 20 45 62 65 6e 29 20 28 61 63 63 6f 75 6e 74 69 6e 67 20 63 68 69 65 66 20 61 63 | rooge.Eben).(accounting.chief.ac |
| fe480 | 63 6f 75 6e 74 61 6e 74 29 29 0a 20 20 20 20 20 28 73 61 6c 61 72 79 20 28 53 63 72 6f 6f 67 65 | countant))......(salary.(Scrooge |
| fe4a0 | 20 45 62 65 6e 29 20 37 35 30 30 30 29 0a 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 28 | .Eben).75000)......(supervisor.( |
| fe4c0 | 53 63 72 6f 6f 67 65 20 45 62 65 6e 29 20 28 57 61 72 62 75 63 6b 73 20 4f 6c 69 76 65 72 29 29 | Scrooge.Eben).(Warbucks.Oliver)) |
| fe4e0 | 0a 0a 20 20 20 20 20 28 61 64 64 72 65 73 73 20 28 43 72 61 74 63 68 65 74 20 52 6f 62 65 72 74 | .......(address.(Cratchet.Robert |
| fe500 | 29 20 28 41 6c 6c 73 74 6f 6e 20 28 4e 20 48 61 72 76 61 72 64 20 53 74 72 65 65 74 29 20 31 36 | ).(Allston.(N.Harvard.Street).16 |
| fe520 | 29 29 0a 20 20 20 20 20 28 6a 6f 62 20 28 43 72 61 74 63 68 65 74 20 52 6f 62 65 72 74 29 20 28 | ))......(job.(Cratchet.Robert).( |
| fe540 | 61 63 63 6f 75 6e 74 69 6e 67 20 73 63 72 69 76 65 6e 65 72 29 29 0a 20 20 20 20 20 28 73 61 6c | accounting.scrivener))......(sal |
| fe560 | 61 72 79 20 28 43 72 61 74 63 68 65 74 20 52 6f 62 65 72 74 29 20 31 38 30 30 30 29 0a 20 20 20 | ary.(Cratchet.Robert).18000).... |
| fe580 | 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 28 43 72 61 74 63 68 65 74 20 52 6f 62 65 72 74 29 20 | ..(supervisor.(Cratchet.Robert). |
| fe5a0 | 28 53 63 72 6f 6f 67 65 20 45 62 65 6e 29 29 0a 0a 20 20 20 54 68 65 72 65 20 69 73 20 61 6c 73 | (Scrooge.Eben)).....There.is.als |
| fe5c0 | 6f 20 61 20 73 65 63 72 65 74 61 72 79 20 66 6f 72 20 74 68 65 20 62 69 67 20 77 68 65 65 6c 3a | o.a.secretary.for.the.big.wheel: |
| fe5e0 | 0a 0a 20 20 20 20 20 28 61 64 64 72 65 73 73 20 28 41 75 6c 6c 20 44 65 57 69 74 74 29 20 28 53 | .......(address.(Aull.DeWitt).(S |
| fe600 | 6c 75 6d 65 72 76 69 6c 6c 65 20 28 4f 6e 69 6f 6e 20 53 71 75 61 72 65 29 20 35 29 29 0a 20 20 | lumerville.(Onion.Square).5))... |
| fe620 | 20 20 20 28 6a 6f 62 20 28 41 75 6c 6c 20 44 65 57 69 74 74 29 20 28 61 64 6d 69 6e 69 73 74 72 | ...(job.(Aull.DeWitt).(administr |
| fe640 | 61 74 69 6f 6e 20 73 65 63 72 65 74 61 72 79 29 29 0a 20 20 20 20 20 28 73 61 6c 61 72 79 20 28 | ation.secretary))......(salary.( |
| fe660 | 41 75 6c 6c 20 44 65 57 69 74 74 29 20 32 35 30 30 30 29 0a 20 20 20 20 20 28 73 75 70 65 72 76 | Aull.DeWitt).25000)......(superv |
| fe680 | 69 73 6f 72 20 28 41 75 6c 6c 20 44 65 57 69 74 74 29 20 28 57 61 72 62 75 63 6b 73 20 4f 6c 69 | isor.(Aull.DeWitt).(Warbucks.Oli |
| fe6a0 | 76 65 72 29 29 0a 0a 20 20 20 54 68 65 20 64 61 74 61 20 62 61 73 65 20 61 6c 73 6f 20 63 6f 6e | ver)).....The.data.base.also.con |
| fe6c0 | 74 61 69 6e 73 20 61 73 73 65 72 74 69 6f 6e 73 20 61 62 6f 75 74 20 77 68 69 63 68 20 6b 69 6e | tains.assertions.about.which.kin |
| fe6e0 | 64 73 20 6f 66 20 6a 6f 62 73 20 63 61 6e 0a 62 65 20 64 6f 6e 65 20 62 79 20 70 65 6f 70 6c 65 | ds.of.jobs.can.be.done.by.people |
| fe700 | 20 68 6f 6c 64 69 6e 67 20 6f 74 68 65 72 20 6b 69 6e 64 73 20 6f 66 20 6a 6f 62 73 2e 20 20 46 | .holding.other.kinds.of.jobs...F |
| fe720 | 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 61 0a 63 6f 6d 70 75 74 65 72 20 77 69 7a 61 72 64 20 63 | or.instance,.a.computer.wizard.c |
| fe740 | 61 6e 20 64 6f 20 74 68 65 20 6a 6f 62 73 20 6f 66 20 62 6f 74 68 20 61 20 63 6f 6d 70 75 74 65 | an.do.the.jobs.of.both.a.compute |
| fe760 | 72 20 70 72 6f 67 72 61 6d 6d 65 72 20 61 6e 64 20 61 0a 63 6f 6d 70 75 74 65 72 20 74 65 63 68 | r.programmer.and.a.computer.tech |
| fe780 | 6e 69 63 69 61 6e 3a 0a 0a 20 20 20 20 20 28 63 61 6e 2d 64 6f 2d 6a 6f 62 20 28 63 6f 6d 70 75 | nician:.......(can-do-job.(compu |
| fe7a0 | 74 65 72 20 77 69 7a 61 72 64 29 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 | ter.wizard).(computer.programmer |
| fe7c0 | 29 29 0a 20 20 20 20 20 28 63 61 6e 2d 64 6f 2d 6a 6f 62 20 28 63 6f 6d 70 75 74 65 72 20 77 69 | ))......(can-do-job.(computer.wi |
| fe7e0 | 7a 61 72 64 29 20 28 63 6f 6d 70 75 74 65 72 20 74 65 63 68 6e 69 63 69 61 6e 29 29 0a 0a 20 20 | zard).(computer.technician)).... |
| fe800 | 20 41 20 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 20 63 6f 75 6c 64 20 66 69 6c | .A.computer.programmer.could.fil |
| fe820 | 6c 20 69 6e 20 66 6f 72 20 61 20 74 72 61 69 6e 65 65 3a 0a 0a 20 20 20 20 20 28 63 61 6e 2d 64 | l.in.for.a.trainee:.......(can-d |
| fe840 | 6f 2d 6a 6f 62 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 0a 20 20 20 20 | o-job.(computer.programmer)..... |
| fe860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 | .............(computer.programme |
| fe880 | 72 20 74 72 61 69 6e 65 65 29 29 0a 0a 20 20 20 41 6c 73 6f 2c 20 61 73 20 69 73 20 77 65 6c 6c | r.trainee)).....Also,.as.is.well |
| fe8a0 | 20 6b 6e 6f 77 6e 2c 0a 0a 20 20 20 20 20 28 63 61 6e 2d 64 6f 2d 6a 6f 62 20 28 61 64 6d 69 6e | .known,.......(can-do-job.(admin |
| fe8c0 | 69 73 74 72 61 74 69 6f 6e 20 73 65 63 72 65 74 61 72 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 | istration.secretary)............ |
| fe8e0 | 20 20 20 20 20 20 28 61 64 6d 69 6e 69 73 74 72 61 74 69 6f 6e 20 62 69 67 20 77 68 65 65 6c 29 | ......(administration.big.wheel) |
| fe900 | 29 0a 0a 53 69 6d 70 6c 65 20 71 75 65 72 69 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | )..Simple.queries............... |
| fe920 | 0a 0a 54 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 20 61 6c 6c 6f 77 73 20 75 73 65 72 | ..The.query.language.allows.user |
| fe940 | 73 20 74 6f 20 72 65 74 72 69 65 76 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 72 6f 6d 20 74 | s.to.retrieve.information.from.t |
| fe960 | 68 65 20 64 61 74 61 0a 62 61 73 65 20 62 79 20 70 6f 73 69 6e 67 20 71 75 65 72 69 65 73 20 69 | he.data.base.by.posing.queries.i |
| fe980 | 6e 20 72 65 73 70 6f 6e 73 65 20 74 6f 20 74 68 65 20 73 79 73 74 65 6d 27 73 20 70 72 6f 6d 70 | n.response.to.the.system's.promp |
| fe9a0 | 74 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 74 6f 20 66 69 6e 64 20 61 6c 6c 20 63 6f 6d | t...For.example,.to.find.all.com |
| fe9c0 | 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 6f 6e 65 20 63 61 6e 20 73 61 79 0a 0a 20 | puter.programmers.one.can.say... |
| fe9e0 | 20 20 20 20 3b 3b 3b 20 51 75 65 72 79 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 6a 6f 62 20 3f | ....;;;.Query.input:......(job.? |
| fea00 | 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a 0a 20 20 20 54 68 65 | x.(computer.programmer)).....The |
| fea20 | 20 73 79 73 74 65 6d 20 77 69 6c 6c 20 72 65 73 70 6f 6e 64 20 77 69 74 68 20 74 68 65 20 66 6f | .system.will.respond.with.the.fo |
| fea40 | 6c 6c 6f 77 69 6e 67 20 69 74 65 6d 73 3a 0a 0a 20 20 20 20 20 3b 3b 3b 20 51 75 65 72 79 20 72 | llowing.items:.......;;;.Query.r |
| fea60 | 65 73 75 6c 74 73 3a 0a 20 20 20 20 20 28 6a 6f 62 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 | esults:......(job.(Hacker.Alyssa |
| fea80 | 20 50 29 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a 20 20 20 20 20 | .P).(computer.programmer))...... |
| feaa0 | 28 6a 6f 62 20 28 46 65 63 74 20 43 79 20 44 29 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 | (job.(Fect.Cy.D).(computer.progr |
| feac0 | 61 6d 6d 65 72 29 29 0a 0a 20 20 20 54 68 65 20 69 6e 70 75 74 20 71 75 65 72 79 20 73 70 65 63 | ammer)).....The.input.query.spec |
| feae0 | 69 66 69 65 73 20 74 68 61 74 20 77 65 20 61 72 65 20 6c 6f 6f 6b 69 6e 67 20 66 6f 72 20 65 6e | ifies.that.we.are.looking.for.en |
| feb00 | 74 72 69 65 73 20 69 6e 20 74 68 65 0a 64 61 74 61 20 62 61 73 65 20 74 68 61 74 20 6d 61 74 63 | tries.in.the.data.base.that.matc |
| feb20 | 68 20 61 20 63 65 72 74 61 69 6e 20 22 70 61 74 74 65 72 6e 22 2e 20 20 49 6e 20 74 68 69 73 20 | h.a.certain."pattern"...In.this. |
| feb40 | 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 70 61 74 74 65 72 6e 0a 73 70 65 63 69 66 69 65 73 20 65 | example,.the.pattern.specifies.e |
| feb60 | 6e 74 72 69 65 73 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 74 68 72 65 65 20 69 74 65 6d 73 | ntries.consisting.of.three.items |
| feb80 | 2c 20 6f 66 20 77 68 69 63 68 20 74 68 65 20 66 69 72 73 74 20 69 73 20 74 68 65 0a 6c 69 74 65 | ,.of.which.the.first.is.the.lite |
| feba0 | 72 61 6c 20 73 79 6d 62 6f 6c 20 60 6a 6f 62 27 2c 20 74 68 65 20 73 65 63 6f 6e 64 20 63 61 6e | ral.symbol.`job',.the.second.can |
| febc0 | 20 62 65 20 61 6e 79 74 68 69 6e 67 2c 20 61 6e 64 20 74 68 65 20 74 68 69 72 64 20 69 73 20 74 | .be.anything,.and.the.third.is.t |
| febe0 | 68 65 0a 6c 69 74 65 72 61 6c 20 6c 69 73 74 20 60 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 | he.literal.list.`(computer.progr |
| fec00 | 61 6d 6d 65 72 29 27 2e 20 20 54 68 65 20 22 61 6e 79 74 68 69 6e 67 22 20 74 68 61 74 20 63 61 | ammer)'...The."anything".that.ca |
| fec20 | 6e 20 62 65 20 74 68 65 0a 73 65 63 6f 6e 64 20 69 74 65 6d 20 69 6e 20 74 68 65 20 6d 61 74 63 | n.be.the.second.item.in.the.matc |
| fec40 | 68 69 6e 67 20 6c 69 73 74 20 69 73 20 73 70 65 63 69 66 69 65 64 20 62 79 20 61 20 22 70 61 74 | hing.list.is.specified.by.a."pat |
| fec60 | 74 65 72 6e 20 76 61 72 69 61 62 6c 65 22 2c 0a 60 3f 78 27 2e 20 20 54 68 65 20 67 65 6e 65 72 | tern.variable",.`?x'...The.gener |
| fec80 | 61 6c 20 66 6f 72 6d 20 6f 66 20 61 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 20 69 73 | al.form.of.a.pattern.variable.is |
| feca0 | 20 61 20 73 79 6d 62 6f 6c 2c 20 74 61 6b 65 6e 20 74 6f 20 62 65 0a 74 68 65 20 6e 61 6d 65 20 | .a.symbol,.taken.to.be.the.name. |
| fecc0 | 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 2c 20 70 72 65 63 65 64 65 64 20 62 79 20 61 20 71 | of.the.variable,.preceded.by.a.q |
| fece0 | 75 65 73 74 69 6f 6e 20 6d 61 72 6b 2e 20 20 57 65 20 77 69 6c 6c 20 73 65 65 0a 62 65 6c 6f 77 | uestion.mark...We.will.see.below |
| fed00 | 20 77 68 79 20 69 74 20 69 73 20 75 73 65 66 75 6c 20 74 6f 20 73 70 65 63 69 66 79 20 6e 61 6d | .why.it.is.useful.to.specify.nam |
| fed20 | 65 73 20 66 6f 72 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 72 61 74 68 65 72 0a | es.for.pattern.variables.rather. |
| fed40 | 74 68 61 6e 20 6a 75 73 74 20 70 75 74 74 69 6e 67 20 60 3f 27 20 69 6e 74 6f 20 70 61 74 74 65 | than.just.putting.`?'.into.patte |
| fed60 | 72 6e 73 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 22 61 6e 79 74 68 69 6e 67 2e 22 20 20 54 68 | rns.to.represent."anything."..Th |
| fed80 | 65 0a 73 79 73 74 65 6d 20 72 65 73 70 6f 6e 64 73 20 74 6f 20 61 20 73 69 6d 70 6c 65 20 71 75 | e.system.responds.to.a.simple.qu |
| feda0 | 65 72 79 20 62 79 20 73 68 6f 77 69 6e 67 20 61 6c 6c 20 65 6e 74 72 69 65 73 20 69 6e 20 74 68 | ery.by.showing.all.entries.in.th |
| fedc0 | 65 20 64 61 74 61 0a 62 61 73 65 20 74 68 61 74 20 6d 61 74 63 68 20 74 68 65 20 73 70 65 63 69 | e.data.base.that.match.the.speci |
| fede0 | 66 69 65 64 20 70 61 74 74 65 72 6e 2e 0a 0a 20 20 20 41 20 70 61 74 74 65 72 6e 20 63 61 6e 20 | fied.pattern......A.pattern.can. |
| fee00 | 68 61 76 65 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 76 61 72 69 61 62 6c 65 2e 20 20 46 6f | have.more.than.one.variable...Fo |
| fee20 | 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 71 75 65 72 79 0a 0a 20 20 20 20 20 28 61 64 64 72 | r.example,.the.query.......(addr |
| fee40 | 65 73 73 20 3f 78 20 3f 79 29 0a 0a 77 69 6c 6c 20 6c 69 73 74 20 61 6c 6c 20 74 68 65 20 65 6d | ess.?x.?y)..will.list.all.the.em |
| fee60 | 70 6c 6f 79 65 65 73 27 20 61 64 64 72 65 73 73 65 73 2e 0a 0a 20 20 20 41 20 70 61 74 74 65 72 | ployees'.addresses......A.patter |
| fee80 | 6e 20 63 61 6e 20 68 61 76 65 20 6e 6f 20 76 61 72 69 61 62 6c 65 73 2c 20 69 6e 20 77 68 69 63 | n.can.have.no.variables,.in.whic |
| feea0 | 68 20 63 61 73 65 20 74 68 65 20 71 75 65 72 79 20 73 69 6d 70 6c 79 0a 64 65 74 65 72 6d 69 6e | h.case.the.query.simply.determin |
| feec0 | 65 73 20 77 68 65 74 68 65 72 20 74 68 61 74 20 70 61 74 74 65 72 6e 20 69 73 20 61 6e 20 65 6e | es.whether.that.pattern.is.an.en |
| feee0 | 74 72 79 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 20 20 49 66 20 73 6f 2c 0a 74 68 | try.in.the.data.base...If.so,.th |
| fef00 | 65 72 65 20 77 69 6c 6c 20 62 65 20 6f 6e 65 20 6d 61 74 63 68 3b 20 69 66 20 6e 6f 74 2c 20 74 | ere.will.be.one.match;.if.not,.t |
| fef20 | 68 65 72 65 20 77 69 6c 6c 20 62 65 20 6e 6f 20 6d 61 74 63 68 65 73 2e 0a 0a 20 20 20 54 68 65 | here.will.be.no.matches......The |
| fef40 | 20 73 61 6d 65 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 20 63 61 6e 20 61 70 70 65 61 | .same.pattern.variable.can.appea |
| fef60 | 72 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 63 65 20 69 6e 20 61 20 71 75 65 72 79 2c 0a 73 70 65 | r.more.than.once.in.a.query,.spe |
| fef80 | 63 69 66 79 69 6e 67 20 74 68 61 74 20 74 68 65 20 73 61 6d 65 20 22 61 6e 79 74 68 69 6e 67 22 | cifying.that.the.same."anything" |
| fefa0 | 20 6d 75 73 74 20 61 70 70 65 61 72 20 69 6e 20 65 61 63 68 20 70 6f 73 69 74 69 6f 6e 2e 20 20 | .must.appear.in.each.position... |
| fefc0 | 54 68 69 73 0a 69 73 20 77 68 79 20 76 61 72 69 61 62 6c 65 73 20 68 61 76 65 20 6e 61 6d 65 73 | This.is.why.variables.have.names |
| fefe0 | 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f | ...For.example,.......(superviso |
| ff000 | 72 20 3f 78 20 3f 78 29 0a 0a 66 69 6e 64 73 20 61 6c 6c 20 70 65 6f 70 6c 65 20 77 68 6f 20 73 | r.?x.?x)..finds.all.people.who.s |
| ff020 | 75 70 65 72 76 69 73 65 20 74 68 65 6d 73 65 6c 76 65 73 20 28 74 68 6f 75 67 68 20 74 68 65 72 | upervise.themselves.(though.ther |
| ff040 | 65 20 61 72 65 20 6e 6f 20 73 75 63 68 0a 61 73 73 65 72 74 69 6f 6e 73 20 69 6e 20 6f 75 72 20 | e.are.no.such.assertions.in.our. |
| ff060 | 73 61 6d 70 6c 65 20 64 61 74 61 20 62 61 73 65 29 2e 0a 0a 20 20 20 54 68 65 20 71 75 65 72 79 | sample.data.base)......The.query |
| ff080 | 0a 0a 20 20 20 20 20 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 3f 74 79 70 65 29 29 | .......(job.?x.(computer.?type)) |
| ff0a0 | 0a 0a 6d 61 74 63 68 65 73 20 61 6c 6c 20 6a 6f 62 20 65 6e 74 72 69 65 73 20 77 68 6f 73 65 20 | ..matches.all.job.entries.whose. |
| ff0c0 | 74 68 69 72 64 20 69 74 65 6d 20 69 73 20 61 20 74 77 6f 2d 65 6c 65 6d 65 6e 74 20 6c 69 73 74 | third.item.is.a.two-element.list |
| ff0e0 | 20 77 68 6f 73 65 0a 66 69 72 73 74 20 69 74 65 6d 20 69 73 20 60 63 6f 6d 70 75 74 65 72 27 3a | .whose.first.item.is.`computer': |
| ff100 | 0a 0a 20 20 20 20 20 28 6a 6f 62 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 20 28 63 6f 6d | .......(job.(Bitdiddle.Ben).(com |
| ff120 | 70 75 74 65 72 20 77 69 7a 61 72 64 29 29 0a 20 20 20 20 20 28 6a 6f 62 20 28 48 61 63 6b 65 72 | puter.wizard))......(job.(Hacker |
| ff140 | 20 41 6c 79 73 73 61 20 50 29 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 | .Alyssa.P).(computer.programmer) |
| ff160 | 29 0a 20 20 20 20 20 28 6a 6f 62 20 28 46 65 63 74 20 43 79 20 44 29 20 28 63 6f 6d 70 75 74 65 | )......(job.(Fect.Cy.D).(compute |
| ff180 | 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a 20 20 20 20 20 28 6a 6f 62 20 28 54 77 65 61 6b 69 | r.programmer))......(job.(Tweaki |
| ff1a0 | 74 20 4c 65 6d 20 45 29 20 28 63 6f 6d 70 75 74 65 72 20 74 65 63 68 6e 69 63 69 61 6e 29 29 0a | t.Lem.E).(computer.technician)). |
| ff1c0 | 0a 20 20 20 54 68 69 73 20 73 61 6d 65 20 70 61 74 74 65 72 6e 20 64 6f 65 73 20 5f 6e 6f 74 5f | ....This.same.pattern.does._not_ |
| ff1e0 | 20 6d 61 74 63 68 0a 0a 20 20 20 20 20 28 6a 6f 62 20 28 52 65 61 73 6f 6e 65 72 20 4c 6f 75 69 | .match.......(job.(Reasoner.Loui |
| ff200 | 73 29 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 20 74 72 61 69 6e 65 65 29 | s).(computer.programmer.trainee) |
| ff220 | 29 0a 0a 62 65 63 61 75 73 65 20 74 68 65 20 74 68 69 72 64 20 69 74 65 6d 20 69 6e 20 74 68 65 | )..because.the.third.item.in.the |
| ff240 | 20 65 6e 74 72 79 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68 72 65 65 20 65 6c 65 6d 65 6e | .entry.is.a.list.of.three.elemen |
| ff260 | 74 73 2c 20 61 6e 64 20 74 68 65 0a 70 61 74 74 65 72 6e 27 73 20 74 68 69 72 64 20 69 74 65 6d | ts,.and.the.pattern's.third.item |
| ff280 | 20 73 70 65 63 69 66 69 65 73 20 74 68 61 74 20 74 68 65 72 65 20 73 68 6f 75 6c 64 20 62 65 20 | .specifies.that.there.should.be. |
| ff2a0 | 74 77 6f 20 65 6c 65 6d 65 6e 74 73 2e 20 20 49 66 0a 77 65 20 77 61 6e 74 65 64 20 74 6f 20 63 | two.elements...If.we.wanted.to.c |
| ff2c0 | 68 61 6e 67 65 20 74 68 65 20 70 61 74 74 65 72 6e 20 73 6f 20 74 68 61 74 20 74 68 65 20 74 68 | hange.the.pattern.so.that.the.th |
| ff2e0 | 69 72 64 20 69 74 65 6d 20 63 6f 75 6c 64 20 62 65 20 61 6e 79 0a 6c 69 73 74 20 62 65 67 69 6e | ird.item.could.be.any.list.begin |
| ff300 | 6e 69 6e 67 20 77 69 74 68 20 60 63 6f 6d 70 75 74 65 72 27 2c 20 77 65 20 63 6f 75 6c 64 20 73 | ning.with.`computer',.we.could.s |
| ff320 | 70 65 63 69 66 79 28 31 29 0a 0a 20 20 20 20 20 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 | pecify(1).......(job.?x.(compute |
| ff340 | 72 20 2e 20 3f 74 79 70 65 29 29 0a 0a 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 | r...?type)).....For.example,.... |
| ff360 | 20 20 20 28 63 6f 6d 70 75 74 65 72 20 2e 20 3f 74 79 70 65 29 0a 0a 6d 61 74 63 68 65 73 20 74 | ...(computer...?type)..matches.t |
| ff380 | 68 65 20 64 61 74 61 0a 0a 20 20 20 20 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d | he.data.......(computer.programm |
| ff3a0 | 65 72 20 74 72 61 69 6e 65 65 29 0a 0a 77 69 74 68 20 60 3f 74 79 70 65 27 20 61 73 20 74 68 65 | er.trainee)..with.`?type'.as.the |
| ff3c0 | 20 6c 69 73 74 20 60 28 70 72 6f 67 72 61 6d 6d 65 72 20 74 72 61 69 6e 65 65 29 27 2e 20 20 49 | .list.`(programmer.trainee)'...I |
| ff3e0 | 74 20 61 6c 73 6f 20 6d 61 74 63 68 65 73 20 74 68 65 0a 64 61 74 61 0a 0a 20 20 20 20 20 28 63 | t.also.matches.the.data.......(c |
| ff400 | 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 0a 0a 77 69 74 68 20 60 3f 74 79 70 65 | omputer.programmer)..with.`?type |
| ff420 | 27 20 61 73 20 74 68 65 20 6c 69 73 74 20 60 28 70 72 6f 67 72 61 6d 6d 65 72 29 27 2c 20 61 6e | '.as.the.list.`(programmer)',.an |
| ff440 | 64 20 6d 61 74 63 68 65 73 20 74 68 65 20 64 61 74 61 0a 0a 20 20 20 20 20 28 63 6f 6d 70 75 74 | d.matches.the.data.......(comput |
| ff460 | 65 72 29 0a 0a 77 69 74 68 20 60 3f 74 79 70 65 27 20 61 73 20 74 68 65 20 65 6d 70 74 79 20 6c | er)..with.`?type'.as.the.empty.l |
| ff480 | 69 73 74 20 60 28 29 27 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 64 65 73 63 72 69 62 65 20 74 68 | ist.`()'......We.can.describe.th |
| ff4a0 | 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 27 73 20 70 72 6f 63 65 73 73 69 6e 67 20 6f 66 | e.query.language's.processing.of |
| ff4c0 | 20 73 69 6d 70 6c 65 20 71 75 65 72 69 65 73 20 61 73 0a 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 | .simple.queries.as.follows:..... |
| ff4e0 | 2a 20 54 68 65 20 73 79 73 74 65 6d 20 66 69 6e 64 73 20 61 6c 6c 20 61 73 73 69 67 6e 6d 65 6e | *.The.system.finds.all.assignmen |
| ff500 | 74 73 20 74 6f 20 76 61 72 69 61 62 6c 65 73 20 69 6e 20 74 68 65 20 71 75 65 72 79 20 70 61 74 | ts.to.variables.in.the.query.pat |
| ff520 | 74 65 72 6e 0a 20 20 20 20 20 74 68 61 74 20 22 73 61 74 69 73 66 79 22 20 74 68 65 20 70 61 74 | tern......that."satisfy".the.pat |
| ff540 | 74 65 72 6e 2d 2d 74 68 61 74 20 69 73 2c 20 61 6c 6c 20 73 65 74 73 20 6f 66 20 76 61 6c 75 65 | tern--that.is,.all.sets.of.value |
| ff560 | 73 20 66 6f 72 20 74 68 65 0a 20 20 20 20 20 76 61 72 69 61 62 6c 65 73 20 73 75 63 68 20 74 68 | s.for.the......variables.such.th |
| ff580 | 61 74 20 69 66 20 74 68 65 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 | at.if.the.pattern.variables.are. |
| ff5a0 | 22 69 6e 73 74 61 6e 74 69 61 74 65 64 0a 20 20 20 20 20 77 69 74 68 22 20 28 72 65 70 6c 61 63 | "instantiated......with".(replac |
| ff5c0 | 65 64 20 62 79 29 20 74 68 65 20 76 61 6c 75 65 73 2c 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 | ed.by).the.values,.the.result.is |
| ff5e0 | 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 0a 0a 20 20 20 2a 20 54 68 65 20 73 79 73 | .in.the.data.base......*.The.sys |
| ff600 | 74 65 6d 20 72 65 73 70 6f 6e 64 73 20 74 6f 20 74 68 65 20 71 75 65 72 79 20 62 79 20 6c 69 73 | tem.responds.to.the.query.by.lis |
| ff620 | 74 69 6e 67 20 61 6c 6c 20 69 6e 73 74 61 6e 74 69 61 74 69 6f 6e 73 20 6f 66 0a 20 20 20 20 20 | ting.all.instantiations.of...... |
| ff640 | 74 68 65 20 71 75 65 72 79 20 70 61 74 74 65 72 6e 20 77 69 74 68 20 74 68 65 20 76 61 72 69 61 | the.query.pattern.with.the.varia |
| ff660 | 62 6c 65 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 74 68 61 74 20 73 61 74 69 73 66 79 20 69 74 2e | ble.assignments.that.satisfy.it. |
| ff680 | 0a 0a 0a 20 20 20 4e 6f 74 65 20 74 68 61 74 20 69 66 20 74 68 65 20 70 61 74 74 65 72 6e 20 68 | ......Note.that.if.the.pattern.h |
| ff6a0 | 61 73 20 6e 6f 20 76 61 72 69 61 62 6c 65 73 2c 20 74 68 65 20 71 75 65 72 79 20 72 65 64 75 63 | as.no.variables,.the.query.reduc |
| ff6c0 | 65 73 20 74 6f 20 61 0a 64 65 74 65 72 6d 69 6e 61 74 69 6f 6e 20 6f 66 20 77 68 65 74 68 65 72 | es.to.a.determination.of.whether |
| ff6e0 | 20 74 68 61 74 20 70 61 74 74 65 72 6e 20 69 73 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 | .that.pattern.is.in.the.data.bas |
| ff700 | 65 2e 20 20 49 66 20 73 6f 2c 20 74 68 65 0a 65 6d 70 74 79 20 61 73 73 69 67 6e 6d 65 6e 74 2c | e...If.so,.the.empty.assignment, |
| ff720 | 20 77 68 69 63 68 20 61 73 73 69 67 6e 73 20 6e 6f 20 76 61 6c 75 65 73 20 74 6f 20 76 61 72 69 | .which.assigns.no.values.to.vari |
| ff740 | 61 62 6c 65 73 2c 20 73 61 74 69 73 66 69 65 73 20 74 68 61 74 0a 70 61 74 74 65 72 6e 20 66 6f | ables,.satisfies.that.pattern.fo |
| ff760 | 72 20 74 68 61 74 20 64 61 74 61 20 62 61 73 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 | r.that.data.base........*Exercis |
| ff780 | 65 20 34 2e 35 35 3a 2a 20 47 69 76 65 20 73 69 6d 70 6c 65 20 71 75 65 72 69 65 73 20 74 68 61 | e.4.55:*.Give.simple.queries.tha |
| ff7a0 | 74 20 72 65 74 72 69 65 76 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 20 20 20 20 20 69 6e | t.retrieve.the.following......in |
| ff7c0 | 66 6f 72 6d 61 74 69 6f 6e 20 66 72 6f 6d 20 74 68 65 20 64 61 74 61 20 62 61 73 65 3a 0a 0a 20 | formation.from.the.data.base:... |
| ff7e0 | 20 20 20 20 20 20 31 2e 20 61 6c 6c 20 70 65 6f 70 6c 65 20 73 75 70 65 72 76 69 73 65 64 20 62 | ......1..all.people.supervised.b |
| ff800 | 79 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 3b 0a 0a 20 20 20 20 20 20 20 32 2e 20 74 68 65 20 | y.Ben.Bitdiddle;.........2..the. |
| ff820 | 6e 61 6d 65 73 20 61 6e 64 20 6a 6f 62 73 20 6f 66 20 61 6c 6c 20 70 65 6f 70 6c 65 20 69 6e 20 | names.and.jobs.of.all.people.in. |
| ff840 | 74 68 65 20 61 63 63 6f 75 6e 74 69 6e 67 20 64 69 76 69 73 69 6f 6e 3b 0a 0a 20 20 20 20 20 20 | the.accounting.division;........ |
| ff860 | 20 33 2e 20 74 68 65 20 6e 61 6d 65 73 20 61 6e 64 20 61 64 64 72 65 73 73 65 73 20 6f 66 20 61 | .3..the.names.and.addresses.of.a |
| ff880 | 6c 6c 20 70 65 6f 70 6c 65 20 77 68 6f 20 6c 69 76 65 20 69 6e 20 53 6c 75 6d 65 72 76 69 6c 6c | ll.people.who.live.in.Slumervill |
| ff8a0 | 65 2e 0a 0a 0a 43 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | e....Compound.queries........... |
| ff8c0 | 2e 2e 2e 2e 2e 2e 0a 0a 53 69 6d 70 6c 65 20 71 75 65 72 69 65 73 20 66 6f 72 6d 20 74 68 65 20 | ........Simple.queries.form.the. |
| ff8e0 | 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 71 75 65 72 | primitive.operations.of.the.quer |
| ff900 | 79 20 6c 61 6e 67 75 61 67 65 2e 20 20 49 6e 0a 6f 72 64 65 72 20 74 6f 20 66 6f 72 6d 20 63 6f | y.language...In.order.to.form.co |
| ff920 | 6d 70 6f 75 6e 64 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e | mpound.operations,.the.query.lan |
| ff940 | 67 75 61 67 65 20 70 72 6f 76 69 64 65 73 20 6d 65 61 6e 73 20 6f 66 0a 63 6f 6d 62 69 6e 61 74 | guage.provides.means.of.combinat |
| ff960 | 69 6f 6e 2e 20 20 4f 6e 65 20 74 68 69 6e 67 20 74 68 61 74 20 6d 61 6b 65 73 20 74 68 65 20 71 | ion...One.thing.that.makes.the.q |
| ff980 | 75 65 72 79 20 6c 61 6e 67 75 61 67 65 20 61 20 6c 6f 67 69 63 0a 70 72 6f 67 72 61 6d 6d 69 6e | uery.language.a.logic.programmin |
| ff9a0 | 67 20 6c 61 6e 67 75 61 67 65 20 69 73 20 74 68 61 74 20 74 68 65 20 6d 65 61 6e 73 20 6f 66 20 | g.language.is.that.the.means.of. |
| ff9c0 | 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6d 69 72 72 6f 72 20 74 68 65 20 6d 65 61 6e 73 0a 6f 66 20 | combination.mirror.the.means.of. |
| ff9e0 | 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 75 73 65 64 20 69 6e 20 66 6f 72 6d 69 6e 67 20 6c 6f 67 69 | combination.used.in.forming.logi |
| ffa00 | 63 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 73 3a 20 60 61 6e 64 27 2c 20 60 6f 72 27 2c 20 61 6e | cal.expressions:.`and',.`or',.an |
| ffa20 | 64 0a 60 6e 6f 74 27 2e 20 20 28 48 65 72 65 20 60 61 6e 64 27 2c 20 60 6f 72 27 2c 20 61 6e 64 | d.`not'...(Here.`and',.`or',.and |
| ffa40 | 20 60 6e 6f 74 27 20 61 72 65 20 6e 6f 74 20 74 68 65 20 4c 69 73 70 20 70 72 69 6d 69 74 69 76 | .`not'.are.not.the.Lisp.primitiv |
| ffa60 | 65 73 2c 20 62 75 74 0a 72 61 74 68 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 62 75 69 6c 74 20 | es,.but.rather.operations.built. |
| ffa80 | 69 6e 74 6f 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 2e 29 0a 0a 20 20 20 57 65 | into.the.query.language.).....We |
| ffaa0 | 20 63 61 6e 20 75 73 65 20 60 61 6e 64 27 20 61 73 20 66 6f 6c 6c 6f 77 73 20 74 6f 20 66 69 6e | .can.use.`and'.as.follows.to.fin |
| ffac0 | 64 20 74 68 65 20 61 64 64 72 65 73 73 65 73 20 6f 66 20 61 6c 6c 20 74 68 65 20 63 6f 6d 70 75 | d.the.addresses.of.all.the.compu |
| ffae0 | 74 65 72 0a 70 72 6f 67 72 61 6d 6d 65 72 73 3a 0a 0a 20 20 20 20 20 28 61 6e 64 20 28 6a 6f 62 | ter.programmers:.......(and.(job |
| ffb00 | 20 3f 70 65 72 73 6f 6e 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a | .?person.(computer.programmer)). |
| ffb20 | 20 20 20 20 20 20 20 20 20 20 28 61 64 64 72 65 73 73 20 3f 70 65 72 73 6f 6e 20 3f 77 68 65 72 | ..........(address.?person.?wher |
| ffb40 | 65 29 29 0a 0a 20 20 20 54 68 65 20 72 65 73 75 6c 74 69 6e 67 20 6f 75 74 70 75 74 20 69 73 0a | e)).....The.resulting.output.is. |
| ffb60 | 0a 20 20 20 20 20 28 61 6e 64 20 28 6a 6f 62 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 | ......(and.(job.(Hacker.Alyssa.P |
| ffb80 | 29 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a 20 20 20 20 20 20 20 | ).(computer.programmer))........ |
| ffba0 | 20 20 20 28 61 64 64 72 65 73 73 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 20 28 43 | ...(address.(Hacker.Alyssa.P).(C |
| ffbc0 | 61 6d 62 72 69 64 67 65 20 28 4d 61 73 73 20 41 76 65 29 20 37 38 29 29 29 0a 0a 20 20 20 20 20 | ambridge.(Mass.Ave).78)))....... |
| ffbe0 | 28 61 6e 64 20 28 6a 6f 62 20 28 46 65 63 74 20 43 79 20 44 29 20 28 63 6f 6d 70 75 74 65 72 20 | (and.(job.(Fect.Cy.D).(computer. |
| ffc00 | 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 61 64 64 72 65 73 73 20 | programmer))...........(address. |
| ffc20 | 28 46 65 63 74 20 43 79 20 44 29 20 28 43 61 6d 62 72 69 64 67 65 20 28 41 6d 65 73 20 53 74 72 | (Fect.Cy.D).(Cambridge.(Ames.Str |
| ffc40 | 65 65 74 29 20 33 29 29 29 0a 0a 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 0a 0a 20 20 20 20 20 | eet).3))).....In.general,....... |
| ffc60 | 28 61 6e 64 20 3c 51 55 45 52 59 5f 31 3e 20 3c 51 55 45 52 59 5f 32 3e 20 2e 2e 2e 20 3c 51 55 | (and.<QUERY_1>.<QUERY_2>.....<QU |
| ffc80 | 45 52 59 5f 4e 3e 29 0a 0a 69 73 20 73 61 74 69 73 66 69 65 64 20 62 79 20 61 6c 6c 20 73 65 74 | ERY_N>)..is.satisfied.by.all.set |
| ffca0 | 73 20 6f 66 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 20 70 61 74 74 65 72 6e 20 76 61 72 69 | s.of.values.for.the.pattern.vari |
| ffcc0 | 61 62 6c 65 73 20 74 68 61 74 0a 73 69 6d 75 6c 74 61 6e 65 6f 75 73 6c 79 20 73 61 74 69 73 66 | ables.that.simultaneously.satisf |
| ffce0 | 79 20 3c 51 55 45 52 59 5f 31 3e 20 2e 2e 2e 20 3c 51 55 45 52 59 5f 4e 3e 2e 0a 0a 20 20 20 41 | y.<QUERY_1>.....<QUERY_N>......A |
| ffd00 | 73 20 66 6f 72 20 73 69 6d 70 6c 65 20 71 75 65 72 69 65 73 2c 20 74 68 65 20 73 79 73 74 65 6d | s.for.simple.queries,.the.system |
| ffd20 | 20 70 72 6f 63 65 73 73 65 73 20 61 20 63 6f 6d 70 6f 75 6e 64 20 71 75 65 72 79 20 62 79 0a 66 | .processes.a.compound.query.by.f |
| ffd40 | 69 6e 64 69 6e 67 20 61 6c 6c 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 74 6f 20 74 68 65 20 70 61 | inding.all.assignments.to.the.pa |
| ffd60 | 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 74 68 61 74 20 73 61 74 69 73 66 79 20 74 68 65 | ttern.variables.that.satisfy.the |
| ffd80 | 0a 71 75 65 72 79 2c 20 74 68 65 6e 20 64 69 73 70 6c 61 79 69 6e 67 20 69 6e 73 74 61 6e 74 69 | .query,.then.displaying.instanti |
| ffda0 | 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 71 75 65 72 79 20 77 69 74 68 20 74 68 6f 73 65 20 76 | ations.of.the.query.with.those.v |
| ffdc0 | 61 6c 75 65 73 2e 0a 0a 20 20 20 41 6e 6f 74 68 65 72 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6e 73 | alues......Another.means.of.cons |
| ffde0 | 74 72 75 63 74 69 6e 67 20 63 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 20 69 73 20 74 68 72 | tructing.compound.queries.is.thr |
| ffe00 | 6f 75 67 68 20 60 6f 72 27 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 28 | ough.`or'...For.example,.......( |
| ffe20 | 6f 72 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 78 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e | or.(supervisor.?x.(Bitdiddle.Ben |
| ffe40 | 29 29 0a 20 20 20 20 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 78 20 28 48 61 63 6b | ))..........(supervisor.?x.(Hack |
| ffe60 | 65 72 20 41 6c 79 73 73 61 20 50 29 29 29 0a 0a 77 69 6c 6c 20 66 69 6e 64 20 61 6c 6c 20 65 6d | er.Alyssa.P)))..will.find.all.em |
| ffe80 | 70 6c 6f 79 65 65 73 20 73 75 70 65 72 76 69 73 65 64 20 62 79 20 42 65 6e 20 42 69 74 64 69 64 | ployees.supervised.by.Ben.Bitdid |
| ffea0 | 64 6c 65 20 6f 72 20 41 6c 79 73 73 61 20 50 2e 0a 48 61 63 6b 65 72 3a 0a 0a 20 20 20 20 20 28 | dle.or.Alyssa.P..Hacker:.......( |
| ffec0 | 6f 72 20 28 73 75 70 65 72 76 69 73 6f 72 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 | or.(supervisor.(Hacker.Alyssa.P) |
| ffee0 | 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 0a 20 20 20 20 20 20 20 20 20 28 73 75 70 65 | .(Bitdiddle.Ben))..........(supe |
| fff00 | 72 76 69 73 6f 72 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 20 28 48 61 63 6b 65 72 | rvisor.(Hacker.Alyssa.P).(Hacker |
| fff20 | 20 41 6c 79 73 73 61 20 50 29 29 29 0a 0a 20 20 20 20 20 28 6f 72 20 28 73 75 70 65 72 76 69 73 | .Alyssa.P))).......(or.(supervis |
| fff40 | 6f 72 20 28 46 65 63 74 20 43 79 20 44 29 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 0a | or.(Fect.Cy.D).(Bitdiddle.Ben)). |
| fff60 | 20 20 20 20 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 28 46 65 63 74 20 43 79 20 44 29 | .........(supervisor.(Fect.Cy.D) |
| fff80 | 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 29 29 0a 0a 20 20 20 20 20 28 6f 72 20 28 | .(Hacker.Alyssa.P))).......(or.( |
| fffa0 | 73 75 70 65 72 76 69 73 6f 72 20 28 54 77 65 61 6b 69 74 20 4c 65 6d 20 45 29 20 28 42 69 74 64 | supervisor.(Tweakit.Lem.E).(Bitd |
| fffc0 | 69 64 64 6c 65 20 42 65 6e 29 29 0a 20 20 20 20 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 | iddle.Ben))..........(supervisor |
| fffe0 | 20 28 54 77 65 61 6b 69 74 20 4c 65 6d 20 45 29 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 | .(Tweakit.Lem.E).(Hacker.Alyssa. |
| 100000 | 50 29 29 29 0a 0a 20 20 20 20 20 28 6f 72 20 28 73 75 70 65 72 76 69 73 6f 72 20 28 52 65 61 73 | P))).......(or.(supervisor.(Reas |
| 100020 | 6f 6e 65 72 20 4c 6f 75 69 73 29 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 0a 20 20 20 | oner.Louis).(Bitdiddle.Ben)).... |
| 100040 | 20 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 28 52 65 61 73 6f 6e 65 72 20 4c 6f 75 69 | ......(supervisor.(Reasoner.Loui |
| 100060 | 73 29 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 29 29 0a 0a 20 20 20 49 6e 20 67 65 | s).(Hacker.Alyssa.P))).....In.ge |
| 100080 | 6e 65 72 61 6c 2c 0a 0a 20 20 20 20 20 28 6f 72 20 3c 51 55 45 52 59 5f 31 3e 20 3c 51 55 45 52 | neral,.......(or.<QUERY_1>.<QUER |
| 1000a0 | 59 5f 32 3e 20 2e 2e 2e 20 3c 51 55 45 52 59 5f 4e 3e 29 0a 0a 69 73 20 73 61 74 69 73 66 69 65 | Y_2>.....<QUERY_N>)..is.satisfie |
| 1000c0 | 64 20 62 79 20 61 6c 6c 20 73 65 74 73 20 6f 66 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 20 | d.by.all.sets.of.values.for.the. |
| 1000e0 | 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 74 68 61 74 0a 73 61 74 69 73 66 79 20 61 | pattern.variables.that.satisfy.a |
| 100100 | 74 20 6c 65 61 73 74 20 6f 6e 65 20 6f 66 20 3c 51 55 45 52 59 5f 31 3e 20 2e 2e 2e 20 3c 51 55 | t.least.one.of.<QUERY_1>.....<QU |
| 100120 | 45 52 59 5f 4e 3e 2e 0a 0a 20 20 20 43 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 20 63 61 6e | ERY_N>......Compound.queries.can |
| 100140 | 20 61 6c 73 6f 20 62 65 20 66 6f 72 6d 65 64 20 77 69 74 68 20 60 6e 6f 74 27 2e 20 46 6f 72 20 | .also.be.formed.with.`not'..For. |
| 100160 | 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 28 61 6e 64 20 28 73 75 70 65 72 76 69 73 6f 72 20 | example,.......(and.(supervisor. |
| 100180 | 3f 78 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 6e | ?x.(Bitdiddle.Ben))...........(n |
| 1001a0 | 6f 74 20 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 | ot.(job.?x.(computer.programmer) |
| 1001c0 | 29 29 29 0a 0a 66 69 6e 64 73 20 61 6c 6c 20 70 65 6f 70 6c 65 20 73 75 70 65 72 76 69 73 65 64 | )))..finds.all.people.supervised |
| 1001e0 | 20 62 79 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 77 68 6f 20 61 72 65 20 6e 6f 74 20 63 6f | .by.Ben.Bitdiddle.who.are.not.co |
| 100200 | 6d 70 75 74 65 72 0a 70 72 6f 67 72 61 6d 6d 65 72 73 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c | mputer.programmers...In.general, |
| 100220 | 0a 0a 20 20 20 20 20 28 6e 6f 74 20 3c 51 55 45 52 59 5f 31 3e 29 0a 0a 69 73 20 73 61 74 69 73 | .......(not.<QUERY_1>)..is.satis |
| 100240 | 66 69 65 64 20 62 79 20 61 6c 6c 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 74 6f 20 74 68 65 20 70 | fied.by.all.assignments.to.the.p |
| 100260 | 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 74 68 61 74 20 64 6f 20 6e 6f 74 0a 73 61 74 | attern.variables.that.do.not.sat |
| 100280 | 69 73 66 79 20 3c 51 55 45 52 59 5f 31 3e 2e 28 32 29 0a 0a 20 20 20 54 68 65 20 66 69 6e 61 6c | isfy.<QUERY_1>.(2).....The.final |
| 1002a0 | 20 63 6f 6d 62 69 6e 69 6e 67 20 66 6f 72 6d 20 69 73 20 63 61 6c 6c 65 64 20 60 6c 69 73 70 2d | .combining.form.is.called.`lisp- |
| 1002c0 | 76 61 6c 75 65 27 2e 20 20 57 68 65 6e 20 60 6c 69 73 70 2d 76 61 6c 75 65 27 0a 69 73 20 74 68 | value'...When.`lisp-value'.is.th |
| 1002e0 | 65 20 66 69 72 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 61 20 70 61 74 74 65 72 6e 2c 20 69 74 | e.first.element.of.a.pattern,.it |
| 100300 | 20 73 70 65 63 69 66 69 65 73 20 74 68 61 74 20 74 68 65 20 6e 65 78 74 20 65 6c 65 6d 65 6e 74 | .specifies.that.the.next.element |
| 100320 | 0a 69 73 20 61 20 4c 69 73 70 20 70 72 65 64 69 63 61 74 65 20 74 6f 20 62 65 20 61 70 70 6c 69 | .is.a.Lisp.predicate.to.be.appli |
| 100340 | 65 64 20 74 6f 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 28 69 6e 73 74 61 6e 74 69 61 | ed.to.the.rest.of.the.(instantia |
| 100360 | 74 65 64 29 0a 65 6c 65 6d 65 6e 74 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 2e 20 20 49 6e 20 | ted).elements.as.arguments...In. |
| 100380 | 67 65 6e 65 72 61 6c 2c 0a 0a 20 20 20 20 20 28 6c 69 73 70 2d 76 61 6c 75 65 20 3c 50 52 45 44 | general,.......(lisp-value.<PRED |
| 1003a0 | 49 43 41 54 45 3e 20 3c 41 52 47 5f 31 3e 20 2e 2e 2e 20 3c 41 52 47 5f 4e 3e 29 0a 0a 77 69 6c | ICATE>.<ARG_1>.....<ARG_N>)..wil |
| 1003c0 | 6c 20 62 65 20 73 61 74 69 73 66 69 65 64 20 62 79 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 74 6f | l.be.satisfied.by.assignments.to |
| 1003e0 | 20 74 68 65 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 66 6f 72 20 77 68 69 63 68 | .the.pattern.variables.for.which |
| 100400 | 20 74 68 65 0a 3c 50 52 45 44 49 43 41 54 45 3e 20 61 70 70 6c 69 65 64 20 74 6f 20 74 68 65 20 | .the.<PREDICATE>.applied.to.the. |
| 100420 | 69 6e 73 74 61 6e 74 69 61 74 65 64 20 3c 41 52 47 5f 31 3e 20 2e 2e 2e 20 20 3c 41 52 47 5f 4e | instantiated.<ARG_1>......<ARG_N |
| 100440 | 3e 20 69 73 20 74 72 75 65 2e 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 6f 20 66 69 6e 64 20 | >.is.true..For.example,.to.find. |
| 100460 | 61 6c 6c 20 70 65 6f 70 6c 65 20 77 68 6f 73 65 20 73 61 6c 61 72 79 20 69 73 20 67 72 65 61 74 | all.people.whose.salary.is.great |
| 100480 | 65 72 20 74 68 61 6e 20 24 33 30 2c 30 30 30 20 77 65 0a 63 6f 75 6c 64 20 77 72 69 74 65 28 33 | er.than.$30,000.we.could.write(3 |
| 1004a0 | 29 0a 0a 20 20 20 20 20 28 61 6e 64 20 28 73 61 6c 61 72 79 20 3f 70 65 72 73 6f 6e 20 3f 61 6d | ).......(and.(salary.?person.?am |
| 1004c0 | 6f 75 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 70 2d 76 61 6c 75 65 20 3e 20 3f 61 | ount)...........(lisp-value.>.?a |
| 1004e0 | 6d 6f 75 6e 74 20 33 30 30 30 30 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e | mount.30000)).......*Exercise.4. |
| 100500 | 35 36 3a 2a 20 46 6f 72 6d 75 6c 61 74 65 20 63 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 20 | 56:*.Formulate.compound.queries. |
| 100520 | 74 68 61 74 20 72 65 74 72 69 65 76 65 20 74 68 65 0a 20 20 20 20 20 66 6f 6c 6c 6f 77 69 6e 67 | that.retrieve.the......following |
| 100540 | 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 20 20 61 2e 20 74 68 65 20 6e 61 6d | .information:.........a..the.nam |
| 100560 | 65 73 20 6f 66 20 61 6c 6c 20 70 65 6f 70 6c 65 20 77 68 6f 20 61 72 65 20 73 75 70 65 72 76 69 | es.of.all.people.who.are.supervi |
| 100580 | 73 65 64 20 62 79 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 2c 0a 20 20 20 20 20 20 20 20 20 20 | sed.by.Ben.Bitdiddle,........... |
| 1005a0 | 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 69 72 20 61 64 64 72 65 73 73 65 73 3b 0a 0a | together.with.their.addresses;.. |
| 1005c0 | 20 20 20 20 20 20 20 62 2e 20 61 6c 6c 20 70 65 6f 70 6c 65 20 77 68 6f 73 65 20 73 61 6c 61 72 | .......b..all.people.whose.salar |
| 1005e0 | 79 20 69 73 20 6c 65 73 73 20 74 68 61 6e 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 27 73 2c 0a | y.is.less.than.Ben.Bitdiddle's,. |
| 100600 | 20 20 20 20 20 20 20 20 20 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 69 72 20 73 61 | ..........together.with.their.sa |
| 100620 | 6c 61 72 79 20 61 6e 64 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 27 73 20 73 61 6c 61 72 79 3b | lary.and.Ben.Bitdiddle's.salary; |
| 100640 | 0a 0a 20 20 20 20 20 20 20 63 2e 20 61 6c 6c 20 70 65 6f 70 6c 65 20 77 68 6f 20 61 72 65 20 73 | .........c..all.people.who.are.s |
| 100660 | 75 70 65 72 76 69 73 65 64 20 62 79 20 73 6f 6d 65 6f 6e 65 20 77 68 6f 20 69 73 20 6e 6f 74 20 | upervised.by.someone.who.is.not. |
| 100680 | 69 6e 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 70 75 74 65 72 20 64 69 76 69 73 69 | in.the...........computer.divisi |
| 1006a0 | 6f 6e 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 20 73 75 70 65 72 76 69 73 6f 72 | on,.together.with.the.supervisor |
| 1006c0 | 27 73 20 6e 61 6d 65 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 6a 6f 62 2e 0a 0a 0a 52 75 6c | 's.name.and...........job....Rul |
| 1006e0 | 65 73 0a 2e 2e 2e 2e 2e 0a 0a 49 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 70 72 69 6d 69 74 69 | es........In.addition.to.primiti |
| 100700 | 76 65 20 71 75 65 72 69 65 73 20 61 6e 64 20 63 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 2c | ve.queries.and.compound.queries, |
| 100720 | 20 74 68 65 20 71 75 65 72 79 0a 6c 61 6e 67 75 61 67 65 20 70 72 6f 76 69 64 65 73 20 6d 65 61 | .the.query.language.provides.mea |
| 100740 | 6e 73 20 66 6f 72 20 61 62 73 74 72 61 63 74 69 6e 67 20 71 75 65 72 69 65 73 2e 20 20 54 68 65 | ns.for.abstracting.queries...The |
| 100760 | 73 65 20 61 72 65 20 67 69 76 65 6e 20 62 79 20 22 72 75 6c 65 73 22 2e 0a 54 68 65 20 72 75 6c | se.are.given.by."rules"..The.rul |
| 100780 | 65 0a 0a 20 20 20 20 20 28 72 75 6c 65 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 3f 70 65 72 73 6f | e.......(rule.(lives-near.?perso |
| 1007a0 | 6e 2d 31 20 3f 70 65 72 73 6f 6e 2d 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 64 20 28 | n-1.?person-2)............(and.( |
| 1007c0 | 61 64 64 72 65 73 73 20 3f 70 65 72 73 6f 6e 2d 31 20 28 3f 74 6f 77 6e 20 2e 20 3f 72 65 73 74 | address.?person-1.(?town...?rest |
| 1007e0 | 2d 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 72 65 73 73 20 3f 70 | -1)).................(address.?p |
| 100800 | 65 72 73 6f 6e 2d 32 20 28 3f 74 6f 77 6e 20 2e 20 3f 72 65 73 74 2d 32 29 29 0a 20 20 20 20 20 | erson-2.(?town...?rest-2))...... |
| 100820 | 20 20 20 20 20 20 20 20 20 20 20 28 6e 6f 74 20 28 73 61 6d 65 20 3f 70 65 72 73 6f 6e 2d 31 20 | ...........(not.(same.?person-1. |
| 100840 | 3f 70 65 72 73 6f 6e 2d 32 29 29 29 29 0a 0a 73 70 65 63 69 66 69 65 73 20 74 68 61 74 20 74 77 | ?person-2))))..specifies.that.tw |
| 100860 | 6f 20 70 65 6f 70 6c 65 20 6c 69 76 65 20 6e 65 61 72 20 65 61 63 68 20 6f 74 68 65 72 20 69 66 | o.people.live.near.each.other.if |
| 100880 | 20 74 68 65 79 20 6c 69 76 65 20 69 6e 20 74 68 65 20 73 61 6d 65 0a 74 6f 77 6e 2e 20 20 54 68 | .they.live.in.the.same.town...Th |
| 1008a0 | 65 20 66 69 6e 61 6c 20 60 6e 6f 74 27 20 63 6c 61 75 73 65 20 70 72 65 76 65 6e 74 73 20 74 68 | e.final.`not'.clause.prevents.th |
| 1008c0 | 65 20 72 75 6c 65 20 66 72 6f 6d 20 73 61 79 69 6e 67 20 74 68 61 74 20 61 6c 6c 0a 70 65 6f 70 | e.rule.from.saying.that.all.peop |
| 1008e0 | 6c 65 20 6c 69 76 65 20 6e 65 61 72 20 74 68 65 6d 73 65 6c 76 65 73 2e 20 20 54 68 65 20 60 73 | le.live.near.themselves...The.`s |
| 100900 | 61 6d 65 27 20 72 65 6c 61 74 69 6f 6e 20 69 73 20 64 65 66 69 6e 65 64 20 62 79 20 61 20 76 65 | ame'.relation.is.defined.by.a.ve |
| 100920 | 72 79 0a 73 69 6d 70 6c 65 20 72 75 6c 65 3a 28 34 29 0a 0a 20 20 20 20 20 28 72 75 6c 65 20 28 | ry.simple.rule:(4).......(rule.( |
| 100940 | 73 61 6d 65 20 3f 78 20 3f 78 29 29 0a 0a 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 72 | same.?x.?x)).....The.following.r |
| 100960 | 75 6c 65 20 64 65 63 6c 61 72 65 73 20 74 68 61 74 20 61 20 70 65 72 73 6f 6e 20 69 73 20 61 20 | ule.declares.that.a.person.is.a. |
| 100980 | 22 77 68 65 65 6c 22 20 69 6e 20 61 6e 0a 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 69 66 20 68 65 | "wheel".in.an.organization.if.he |
| 1009a0 | 20 73 75 70 65 72 76 69 73 65 73 20 73 6f 6d 65 6f 6e 65 20 77 68 6f 20 69 73 20 69 6e 20 74 75 | .supervises.someone.who.is.in.tu |
| 1009c0 | 72 6e 20 61 20 73 75 70 65 72 76 69 73 6f 72 3a 0a 0a 20 20 20 20 20 28 72 75 6c 65 20 28 77 68 | rn.a.supervisor:.......(rule.(wh |
| 1009e0 | 65 65 6c 20 3f 70 65 72 73 6f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 64 20 28 73 75 | eel.?person)............(and.(su |
| 100a00 | 70 65 72 76 69 73 6f 72 20 3f 6d 69 64 64 6c 65 2d 6d 61 6e 61 67 65 72 20 3f 70 65 72 73 6f 6e | pervisor.?middle-manager.?person |
| 100a20 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 78 | ).................(supervisor.?x |
| 100a40 | 20 3f 6d 69 64 64 6c 65 2d 6d 61 6e 61 67 65 72 29 29 29 0a 0a 20 20 20 54 68 65 20 67 65 6e 65 | .?middle-manager))).....The.gene |
| 100a60 | 72 61 6c 20 66 6f 72 6d 20 6f 66 20 61 20 72 75 6c 65 20 69 73 0a 0a 20 20 20 20 20 28 72 75 6c | ral.form.of.a.rule.is.......(rul |
| 100a80 | 65 20 3c 43 4f 4e 43 4c 55 53 49 4f 4e 3e 20 3c 42 4f 44 59 3e 29 0a 0a 77 68 65 72 65 20 3c 43 | e.<CONCLUSION>.<BODY>)..where.<C |
| 100aa0 | 4f 4e 43 4c 55 53 49 4f 4e 3e 20 69 73 20 61 20 70 61 74 74 65 72 6e 20 61 6e 64 20 3c 42 4f 44 | ONCLUSION>.is.a.pattern.and.<BOD |
| 100ac0 | 59 3e 20 69 73 20 61 6e 79 20 71 75 65 72 79 2e 28 35 29 20 57 65 20 63 61 6e 0a 74 68 69 6e 6b | Y>.is.any.query.(5).We.can.think |
| 100ae0 | 20 6f 66 20 61 20 72 75 6c 65 20 61 73 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 61 20 6c 61 72 | .of.a.rule.as.representing.a.lar |
| 100b00 | 67 65 20 28 65 76 65 6e 20 69 6e 66 69 6e 69 74 65 29 20 73 65 74 20 6f 66 0a 61 73 73 65 72 74 | ge.(even.infinite).set.of.assert |
| 100b20 | 69 6f 6e 73 2c 20 6e 61 6d 65 6c 79 20 61 6c 6c 20 69 6e 73 74 61 6e 74 69 61 74 69 6f 6e 73 20 | ions,.namely.all.instantiations. |
| 100b40 | 6f 66 20 74 68 65 20 72 75 6c 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 20 77 69 74 68 0a 76 61 72 69 | of.the.rule.conclusion.with.vari |
| 100b60 | 61 62 6c 65 20 61 73 73 69 67 6e 6d 65 6e 74 73 20 74 68 61 74 20 73 61 74 69 73 66 79 20 74 68 | able.assignments.that.satisfy.th |
| 100b80 | 65 20 72 75 6c 65 20 62 6f 64 79 2e 20 20 57 68 65 6e 20 77 65 20 64 65 73 63 72 69 62 65 64 0a | e.rule.body...When.we.described. |
| 100ba0 | 73 69 6d 70 6c 65 20 71 75 65 72 69 65 73 20 28 70 61 74 74 65 72 6e 73 29 2c 20 77 65 20 73 61 | simple.queries.(patterns),.we.sa |
| 100bc0 | 69 64 20 74 68 61 74 20 61 6e 20 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 20 76 61 72 69 61 62 6c | id.that.an.assignment.to.variabl |
| 100be0 | 65 73 0a 73 61 74 69 73 66 69 65 73 20 61 20 70 61 74 74 65 72 6e 20 69 66 20 74 68 65 20 69 6e | es.satisfies.a.pattern.if.the.in |
| 100c00 | 73 74 61 6e 74 69 61 74 65 64 20 70 61 74 74 65 72 6e 20 69 73 20 69 6e 20 74 68 65 20 64 61 74 | stantiated.pattern.is.in.the.dat |
| 100c20 | 61 20 62 61 73 65 2e 0a 42 75 74 20 74 68 65 20 70 61 74 74 65 72 6e 20 6e 65 65 64 6e 27 74 20 | a.base..But.the.pattern.needn't. |
| 100c40 | 62 65 20 65 78 70 6c 69 63 69 74 6c 79 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 61 | be.explicitly.in.the.data.base.a |
| 100c60 | 73 20 61 6e 20 61 73 73 65 72 74 69 6f 6e 2e 0a 49 74 20 63 61 6e 20 62 65 20 61 6e 20 69 6d 70 | s.an.assertion..It.can.be.an.imp |
| 100c80 | 6c 69 63 69 74 20 61 73 73 65 72 74 69 6f 6e 20 69 6d 70 6c 69 65 64 20 62 79 20 61 20 72 75 6c | licit.assertion.implied.by.a.rul |
| 100ca0 | 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 0a 71 75 65 72 79 0a 0a 20 20 20 20 | e...For.example,.the.query...... |
| 100cc0 | 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 3f 78 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 | .(lives-near.?x.(Bitdiddle.Ben)) |
| 100ce0 | 0a 0a 72 65 73 75 6c 74 73 20 69 6e 0a 0a 20 20 20 20 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 28 | ..results.in.......(lives-near.( |
| 100d00 | 52 65 61 73 6f 6e 65 72 20 4c 6f 75 69 73 29 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 | Reasoner.Louis).(Bitdiddle.Ben)) |
| 100d20 | 0a 20 20 20 20 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 28 41 75 6c 6c 20 44 65 57 69 74 74 29 20 | ......(lives-near.(Aull.DeWitt). |
| 100d40 | 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 0a 0a 20 20 20 54 6f 20 66 69 6e 64 20 61 6c 6c | (Bitdiddle.Ben)).....To.find.all |
| 100d60 | 20 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 77 68 6f 20 6c 69 76 65 20 6e | .computer.programmers.who.live.n |
| 100d80 | 65 61 72 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 2c 20 77 65 20 63 61 6e 0a 61 73 6b 0a 0a 20 | ear.Ben.Bitdiddle,.we.can.ask... |
| 100da0 | 20 20 20 20 28 61 6e 64 20 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 | ....(and.(job.?x.(computer.progr |
| 100dc0 | 61 6d 6d 65 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 3f 78 | ammer))...........(lives-near.?x |
| 100de0 | 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 29 0a 0a 20 20 20 41 73 20 69 6e 20 74 68 65 | .(Bitdiddle.Ben))).....As.in.the |
| 100e00 | 20 63 61 73 65 20 6f 66 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 2c 20 72 75 | .case.of.compound.procedures,.ru |
| 100e20 | 6c 65 73 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 70 61 72 74 73 20 6f 66 0a 6f 74 68 65 | les.can.be.used.as.parts.of.othe |
| 100e40 | 72 20 72 75 6c 65 73 20 28 61 73 20 77 65 20 73 61 77 20 77 69 74 68 20 74 68 65 20 60 6c 69 76 | r.rules.(as.we.saw.with.the.`liv |
| 100e60 | 65 73 2d 6e 65 61 72 27 20 72 75 6c 65 20 61 62 6f 76 65 29 20 6f 72 20 65 76 65 6e 20 62 65 0a | es-near'.rule.above).or.even.be. |
| 100e80 | 64 65 66 69 6e 65 64 20 72 65 63 75 72 73 69 76 65 6c 79 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e | defined.recursively...For.instan |
| 100ea0 | 63 65 2c 20 74 68 65 20 72 75 6c 65 0a 0a 20 20 20 20 20 28 72 75 6c 65 20 28 6f 75 74 72 61 6e | ce,.the.rule.......(rule.(outran |
| 100ec0 | 6b 65 64 2d 62 79 20 3f 73 74 61 66 66 2d 70 65 72 73 6f 6e 20 3f 62 6f 73 73 29 0a 20 20 20 20 | ked-by.?staff-person.?boss)..... |
| 100ee0 | 20 20 20 20 20 20 20 28 6f 72 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 73 74 61 66 66 2d 70 65 | .......(or.(supervisor.?staff-pe |
| 100f00 | 72 73 6f 6e 20 3f 62 6f 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 64 20 | rson.?boss)................(and. |
| 100f20 | 28 73 75 70 65 72 76 69 73 6f 72 20 3f 73 74 61 66 66 2d 70 65 72 73 6f 6e 20 3f 6d 69 64 64 6c | (supervisor.?staff-person.?middl |
| 100f40 | 65 2d 6d 61 6e 61 67 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | e-manager).....................( |
| 100f60 | 6f 75 74 72 61 6e 6b 65 64 2d 62 79 20 3f 6d 69 64 64 6c 65 2d 6d 61 6e 61 67 65 72 20 3f 62 6f | outranked-by.?middle-manager.?bo |
| 100f80 | 73 73 29 29 29 29 0a 0a 73 61 79 73 20 74 68 61 74 20 61 20 73 74 61 66 66 20 70 65 72 73 6f 6e | ss))))..says.that.a.staff.person |
| 100fa0 | 20 69 73 20 6f 75 74 72 61 6e 6b 65 64 20 62 79 20 61 20 62 6f 73 73 20 69 6e 20 74 68 65 20 6f | .is.outranked.by.a.boss.in.the.o |
| 100fc0 | 72 67 61 6e 69 7a 61 74 69 6f 6e 20 69 66 0a 74 68 65 20 62 6f 73 73 20 69 73 20 74 68 65 20 70 | rganization.if.the.boss.is.the.p |
| 100fe0 | 65 72 73 6f 6e 27 73 20 73 75 70 65 72 76 69 73 6f 72 20 6f 72 20 28 72 65 63 75 72 73 69 76 65 | erson's.supervisor.or.(recursive |
| 101000 | 6c 79 29 20 69 66 20 74 68 65 20 70 65 72 73 6f 6e 27 73 0a 73 75 70 65 72 76 69 73 6f 72 20 69 | ly).if.the.person's.supervisor.i |
| 101020 | 73 20 6f 75 74 72 61 6e 6b 65 64 20 62 79 20 74 68 65 20 62 6f 73 73 2e 0a 0a 20 20 20 20 20 2a | s.outranked.by.the.boss........* |
| 101040 | 45 78 65 72 63 69 73 65 20 34 2e 35 37 3a 2a 20 44 65 66 69 6e 65 20 61 20 72 75 6c 65 20 74 68 | Exercise.4.57:*.Define.a.rule.th |
| 101060 | 61 74 20 73 61 79 73 20 74 68 61 74 20 70 65 72 73 6f 6e 20 31 20 63 61 6e 20 72 65 70 6c 61 63 | at.says.that.person.1.can.replac |
| 101080 | 65 0a 20 20 20 20 20 70 65 72 73 6f 6e 20 32 20 69 66 20 65 69 74 68 65 72 20 70 65 72 73 6f 6e | e......person.2.if.either.person |
| 1010a0 | 20 31 20 64 6f 65 73 20 74 68 65 20 73 61 6d 65 20 6a 6f 62 20 61 73 20 70 65 72 73 6f 6e 20 32 | .1.does.the.same.job.as.person.2 |
| 1010c0 | 20 6f 72 0a 20 20 20 20 20 73 6f 6d 65 6f 6e 65 20 77 68 6f 20 64 6f 65 73 20 70 65 72 73 6f 6e | .or......someone.who.does.person |
| 1010e0 | 20 31 27 73 20 6a 6f 62 20 63 61 6e 20 61 6c 73 6f 20 64 6f 20 70 65 72 73 6f 6e 20 32 27 73 20 | .1's.job.can.also.do.person.2's. |
| 101100 | 6a 6f 62 2c 20 61 6e 64 20 69 66 0a 20 20 20 20 20 70 65 72 73 6f 6e 20 31 20 61 6e 64 20 70 65 | job,.and.if......person.1.and.pe |
| 101120 | 72 73 6f 6e 20 32 20 61 72 65 20 6e 6f 74 20 74 68 65 20 73 61 6d 65 20 70 65 72 73 6f 6e 2e 20 | rson.2.are.not.the.same.person.. |
| 101140 | 55 73 69 6e 67 20 79 6f 75 72 20 72 75 6c 65 2c 0a 20 20 20 20 20 67 69 76 65 20 71 75 65 72 69 | Using.your.rule,......give.queri |
| 101160 | 65 73 20 74 68 61 74 20 66 69 6e 64 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 0a 20 20 20 | es.that.find.the.following:..... |
| 101180 | 20 20 20 20 61 2e 20 61 6c 6c 20 70 65 6f 70 6c 65 20 77 68 6f 20 63 61 6e 20 72 65 70 6c 61 63 | ....a..all.people.who.can.replac |
| 1011a0 | 65 20 43 79 20 44 2e 20 46 65 63 74 3b 0a 0a 20 20 20 20 20 20 20 62 2e 20 61 6c 6c 20 70 65 6f | e.Cy.D..Fect;.........b..all.peo |
| 1011c0 | 70 6c 65 20 77 68 6f 20 63 61 6e 20 72 65 70 6c 61 63 65 20 73 6f 6d 65 6f 6e 65 20 77 68 6f 20 | ple.who.can.replace.someone.who. |
| 1011e0 | 69 73 20 62 65 69 6e 67 20 70 61 69 64 20 6d 6f 72 65 0a 20 20 20 20 20 20 20 20 20 20 74 68 61 | is.being.paid.more...........tha |
| 101200 | 6e 20 74 68 65 79 20 61 72 65 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 20 74 77 | n.they.are,.together.with.the.tw |
| 101220 | 6f 20 73 61 6c 61 72 69 65 73 2e 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 35 | o.salaries.........*Exercise.4.5 |
| 101240 | 38 3a 2a 20 44 65 66 69 6e 65 20 61 20 72 75 6c 65 20 74 68 61 74 20 73 61 79 73 20 74 68 61 74 | 8:*.Define.a.rule.that.says.that |
| 101260 | 20 61 20 70 65 72 73 6f 6e 20 69 73 20 61 20 22 62 69 67 0a 20 20 20 20 20 73 68 6f 74 22 20 69 | .a.person.is.a."big......shot".i |
| 101280 | 6e 20 61 20 64 69 76 69 73 69 6f 6e 20 69 66 20 74 68 65 20 70 65 72 73 6f 6e 20 77 6f 72 6b 73 | n.a.division.if.the.person.works |
| 1012a0 | 20 69 6e 20 74 68 65 20 64 69 76 69 73 69 6f 6e 20 62 75 74 20 64 6f 65 73 0a 20 20 20 20 20 6e | .in.the.division.but.does......n |
| 1012c0 | 6f 74 20 68 61 76 65 20 61 20 73 75 70 65 72 76 69 73 6f 72 20 77 68 6f 20 77 6f 72 6b 73 20 69 | ot.have.a.supervisor.who.works.i |
| 1012e0 | 6e 20 74 68 65 20 64 69 76 69 73 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 | n.the.division........*Exercise. |
| 101300 | 34 2e 35 39 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 68 61 73 20 6d 69 73 73 65 64 20 | 4.59:*.Ben.Bitdiddle.has.missed. |
| 101320 | 6f 6e 65 20 6d 65 65 74 69 6e 67 20 74 6f 6f 20 6d 61 6e 79 2e 0a 20 20 20 20 20 46 65 61 72 69 | one.meeting.too.many.......Feari |
| 101340 | 6e 67 20 74 68 61 74 20 68 69 73 20 68 61 62 69 74 20 6f 66 20 66 6f 72 67 65 74 74 69 6e 67 20 | ng.that.his.habit.of.forgetting. |
| 101360 | 6d 65 65 74 69 6e 67 73 20 63 6f 75 6c 64 20 63 6f 73 74 20 68 69 6d 20 68 69 73 0a 20 20 20 20 | meetings.could.cost.him.his..... |
| 101380 | 20 6a 6f 62 2c 20 42 65 6e 20 64 65 63 69 64 65 73 20 74 6f 20 64 6f 20 73 6f 6d 65 74 68 69 6e | .job,.Ben.decides.to.do.somethin |
| 1013a0 | 67 20 61 62 6f 75 74 20 69 74 2e 20 20 48 65 20 61 64 64 73 20 61 6c 6c 20 74 68 65 20 77 65 65 | g.about.it...He.adds.all.the.wee |
| 1013c0 | 6b 6c 79 0a 20 20 20 20 20 6d 65 65 74 69 6e 67 73 20 6f 66 20 74 68 65 20 66 69 72 6d 20 74 6f | kly......meetings.of.the.firm.to |
| 1013e0 | 20 74 68 65 20 4d 69 63 72 6f 73 68 61 66 74 20 64 61 74 61 20 62 61 73 65 20 62 79 20 61 73 73 | .the.Microshaft.data.base.by.ass |
| 101400 | 65 72 74 69 6e 67 20 74 68 65 0a 20 20 20 20 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 0a 20 20 20 20 | erting.the......following:...... |
| 101420 | 20 20 20 20 20 20 28 6d 65 65 74 69 6e 67 20 61 63 63 6f 75 6e 74 69 6e 67 20 28 4d 6f 6e 64 61 | ......(meeting.accounting.(Monda |
| 101440 | 79 20 39 61 6d 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 6d 65 65 74 69 6e 67 20 61 64 6d 69 6e | y.9am))...........(meeting.admin |
| 101460 | 69 73 74 72 61 74 69 6f 6e 20 28 4d 6f 6e 64 61 79 20 31 30 61 6d 29 29 0a 20 20 20 20 20 20 20 | istration.(Monday.10am))........ |
| 101480 | 20 20 20 28 6d 65 65 74 69 6e 67 20 63 6f 6d 70 75 74 65 72 20 28 57 65 64 6e 65 73 64 61 79 20 | ...(meeting.computer.(Wednesday. |
| 1014a0 | 33 70 6d 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 6d 65 65 74 69 6e 67 20 61 64 6d 69 6e 69 73 | 3pm))...........(meeting.adminis |
| 1014c0 | 74 72 61 74 69 6f 6e 20 28 46 72 69 64 61 79 20 31 70 6d 29 29 0a 0a 20 20 20 20 20 45 61 63 68 | tration.(Friday.1pm)).......Each |
| 1014e0 | 20 6f 66 20 74 68 65 20 61 62 6f 76 65 20 61 73 73 65 72 74 69 6f 6e 73 20 69 73 20 66 6f 72 20 | .of.the.above.assertions.is.for. |
| 101500 | 61 20 6d 65 65 74 69 6e 67 20 6f 66 20 61 6e 20 65 6e 74 69 72 65 0a 20 20 20 20 20 64 69 76 69 | a.meeting.of.an.entire......divi |
| 101520 | 73 69 6f 6e 2e 20 20 42 65 6e 20 61 6c 73 6f 20 61 64 64 73 20 61 6e 20 65 6e 74 72 79 20 66 6f | sion...Ben.also.adds.an.entry.fo |
| 101540 | 72 20 74 68 65 20 63 6f 6d 70 61 6e 79 2d 77 69 64 65 20 6d 65 65 74 69 6e 67 0a 20 20 20 20 20 | r.the.company-wide.meeting...... |
| 101560 | 74 68 61 74 20 73 70 61 6e 73 20 61 6c 6c 20 74 68 65 20 64 69 76 69 73 69 6f 6e 73 2e 20 20 41 | that.spans.all.the.divisions...A |
| 101580 | 6c 6c 20 6f 66 20 74 68 65 20 63 6f 6d 70 61 6e 79 27 73 20 65 6d 70 6c 6f 79 65 65 73 0a 20 20 | ll.of.the.company's.employees... |
| 1015a0 | 20 20 20 61 74 74 65 6e 64 20 74 68 69 73 20 6d 65 65 74 69 6e 67 2e 0a 0a 20 20 20 20 20 20 20 | ...attend.this.meeting.......... |
| 1015c0 | 20 20 20 28 6d 65 65 74 69 6e 67 20 77 68 6f 6c 65 2d 63 6f 6d 70 61 6e 79 20 28 57 65 64 6e 65 | ...(meeting.whole-company.(Wedne |
| 1015e0 | 73 64 61 79 20 34 70 6d 29 29 0a 0a 20 20 20 20 20 20 20 61 2e 20 4f 6e 20 46 72 69 64 61 79 20 | sday.4pm)).........a..On.Friday. |
| 101600 | 6d 6f 72 6e 69 6e 67 2c 20 42 65 6e 20 77 61 6e 74 73 20 74 6f 20 71 75 65 72 79 20 74 68 65 20 | morning,.Ben.wants.to.query.the. |
| 101620 | 64 61 74 61 20 62 61 73 65 20 66 6f 72 20 61 6c 6c 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 20 | data.base.for.all...........the. |
| 101640 | 6d 65 65 74 69 6e 67 73 20 74 68 61 74 20 6f 63 63 75 72 20 74 68 61 74 20 64 61 79 2e 20 20 57 | meetings.that.occur.that.day...W |
| 101660 | 68 61 74 20 71 75 65 72 79 20 73 68 6f 75 6c 64 20 68 65 20 75 73 65 3f 0a 0a 20 20 20 20 20 20 | hat.query.should.he.use?........ |
| 101680 | 20 62 2e 20 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 20 69 73 20 75 6e 69 6d 70 72 65 73 | .b..Alyssa.P..Hacker.is.unimpres |
| 1016a0 | 73 65 64 2e 20 20 53 68 65 20 74 68 69 6e 6b 73 20 69 74 20 77 6f 75 6c 64 20 62 65 20 6d 75 63 | sed...She.thinks.it.would.be.muc |
| 1016c0 | 68 0a 20 20 20 20 20 20 20 20 20 20 6d 6f 72 65 20 75 73 65 66 75 6c 20 74 6f 20 62 65 20 61 62 | h...........more.useful.to.be.ab |
| 1016e0 | 6c 65 20 74 6f 20 61 73 6b 20 66 6f 72 20 68 65 72 20 6d 65 65 74 69 6e 67 73 20 62 79 20 73 70 | le.to.ask.for.her.meetings.by.sp |
| 101700 | 65 63 69 66 79 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 68 65 72 20 6e 61 6d 65 2e 20 20 53 6f | ecifying...........her.name...So |
| 101720 | 20 73 68 65 20 64 65 73 69 67 6e 73 20 61 20 72 75 6c 65 20 74 68 61 74 20 73 61 79 73 20 74 68 | .she.designs.a.rule.that.says.th |
| 101740 | 61 74 20 61 20 70 65 72 73 6f 6e 27 73 0a 20 20 20 20 20 20 20 20 20 20 6d 65 65 74 69 6e 67 73 | at.a.person's...........meetings |
| 101760 | 20 69 6e 63 6c 75 64 65 20 61 6c 6c 20 60 77 68 6f 6c 65 2d 63 6f 6d 70 61 6e 79 27 20 6d 65 65 | .include.all.`whole-company'.mee |
| 101780 | 74 69 6e 67 73 20 70 6c 75 73 20 61 6c 6c 0a 20 20 20 20 20 20 20 20 20 20 6d 65 65 74 69 6e 67 | tings.plus.all...........meeting |
| 1017a0 | 73 20 6f 66 20 74 68 61 74 20 70 65 72 73 6f 6e 27 73 20 64 69 76 69 73 69 6f 6e 2e 20 20 46 69 | s.of.that.person's.division...Fi |
| 1017c0 | 6c 6c 20 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 0a 20 20 20 20 20 20 20 20 20 20 41 6c 79 73 | ll.in.the.body.of...........Alys |
| 1017e0 | 73 61 27 73 20 72 75 6c 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 75 6c 65 | sa's.rule..................(rule |
| 101800 | 20 28 6d 65 65 74 69 6e 67 2d 74 69 6d 65 20 3f 70 65 72 73 6f 6e 20 3f 64 61 79 2d 61 6e 64 2d | .(meeting-time.?person.?day-and- |
| 101820 | 74 69 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 52 55 4c 45 | time)......................<RULE |
| 101840 | 2d 42 4f 44 59 3e 29 0a 0a 20 20 20 20 20 20 20 63 2e 20 41 6c 79 73 73 61 20 61 72 72 69 76 65 | -BODY>).........c..Alyssa.arrive |
| 101860 | 73 20 61 74 20 77 6f 72 6b 20 6f 6e 20 57 65 64 6e 65 73 64 61 79 20 6d 6f 72 6e 69 6e 67 20 61 | s.at.work.on.Wednesday.morning.a |
| 101880 | 6e 64 20 77 6f 6e 64 65 72 73 20 77 68 61 74 0a 20 20 20 20 20 20 20 20 20 20 6d 65 65 74 69 6e | nd.wonders.what...........meetin |
| 1018a0 | 67 73 20 73 68 65 20 68 61 73 20 74 6f 20 61 74 74 65 6e 64 20 74 68 61 74 20 64 61 79 2e 20 20 | gs.she.has.to.attend.that.day... |
| 1018c0 | 48 61 76 69 6e 67 20 64 65 66 69 6e 65 64 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 61 62 6f | Having.defined.the...........abo |
| 1018e0 | 76 65 20 72 75 6c 65 2c 20 77 68 61 74 20 71 75 65 72 79 20 73 68 6f 75 6c 64 20 73 68 65 20 6d | ve.rule,.what.query.should.she.m |
| 101900 | 61 6b 65 20 74 6f 20 66 69 6e 64 20 74 68 69 73 20 6f 75 74 3f 0a 0a 0a 20 20 20 20 20 2a 45 78 | ake.to.find.this.out?........*Ex |
| 101920 | 65 72 63 69 73 65 20 34 2e 36 30 3a 2a 20 42 79 20 67 69 76 69 6e 67 20 74 68 65 20 71 75 65 72 | ercise.4.60:*.By.giving.the.quer |
| 101940 | 79 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 3f 70 65 72 73 6f 6e | y............(lives-near.?person |
| 101960 | 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 29 0a 0a 20 20 20 20 20 41 6c 79 73 73 61 | .(Hacker.Alyssa.P)).......Alyssa |
| 101980 | 20 50 2e 20 48 61 63 6b 65 72 20 69 73 20 61 62 6c 65 20 74 6f 20 66 69 6e 64 20 70 65 6f 70 6c | .P..Hacker.is.able.to.find.peopl |
| 1019a0 | 65 20 77 68 6f 20 6c 69 76 65 20 6e 65 61 72 20 68 65 72 2c 20 77 69 74 68 0a 20 20 20 20 20 77 | e.who.live.near.her,.with......w |
| 1019c0 | 68 6f 6d 20 73 68 65 20 63 61 6e 20 72 69 64 65 20 74 6f 20 77 6f 72 6b 2e 20 20 4f 6e 20 74 68 | hom.she.can.ride.to.work...On.th |
| 1019e0 | 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 77 68 65 6e 20 73 68 65 20 74 72 69 65 73 20 74 6f 0a | e.other.hand,.when.she.tries.to. |
| 101a00 | 20 20 20 20 20 66 69 6e 64 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 70 65 6f 70 6c 65 20 77 68 | .....find.all.pairs.of.people.wh |
| 101a20 | 6f 20 6c 69 76 65 20 6e 65 61 72 20 65 61 63 68 20 6f 74 68 65 72 20 62 79 20 71 75 65 72 79 69 | o.live.near.each.other.by.queryi |
| 101a40 | 6e 67 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 3f 70 65 72 73 6f | ng............(lives-near.?perso |
| 101a60 | 6e 2d 31 20 3f 70 65 72 73 6f 6e 2d 32 29 0a 0a 20 20 20 20 20 73 68 65 20 6e 6f 74 69 63 65 73 | n-1.?person-2).......she.notices |
| 101a80 | 20 74 68 61 74 20 65 61 63 68 20 70 61 69 72 20 6f 66 20 70 65 6f 70 6c 65 20 77 68 6f 20 6c 69 | .that.each.pair.of.people.who.li |
| 101aa0 | 76 65 20 6e 65 61 72 20 65 61 63 68 20 6f 74 68 65 72 20 69 73 0a 20 20 20 20 20 6c 69 73 74 65 | ve.near.each.other.is......liste |
| 101ac0 | 64 20 74 77 69 63 65 3b 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 20 20 20 20 | d.twice;.for.example,........... |
| 101ae0 | 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 20 28 | .(lives-near.(Hacker.Alyssa.P).( |
| 101b00 | 46 65 63 74 20 43 79 20 44 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 76 65 73 2d 6e 65 61 | Fect.Cy.D))...........(lives-nea |
| 101b20 | 72 20 28 46 65 63 74 20 43 79 20 44 29 20 28 48 61 63 6b 65 72 20 41 6c 79 73 73 61 20 50 29 29 | r.(Fect.Cy.D).(Hacker.Alyssa.P)) |
| 101b40 | 0a 0a 20 20 20 20 20 57 68 79 20 64 6f 65 73 20 74 68 69 73 20 68 61 70 70 65 6e 3f 20 20 49 73 | .......Why.does.this.happen?..Is |
| 101b60 | 20 74 68 65 72 65 20 61 20 77 61 79 20 74 6f 20 66 69 6e 64 20 61 20 6c 69 73 74 20 6f 66 20 70 | .there.a.way.to.find.a.list.of.p |
| 101b80 | 65 6f 70 6c 65 20 77 68 6f 0a 20 20 20 20 20 6c 69 76 65 20 6e 65 61 72 20 65 61 63 68 20 6f 74 | eople.who......live.near.each.ot |
| 101ba0 | 68 65 72 2c 20 69 6e 20 77 68 69 63 68 20 65 61 63 68 20 70 61 69 72 20 61 70 70 65 61 72 73 20 | her,.in.which.each.pair.appears. |
| 101bc0 | 6f 6e 6c 79 20 6f 6e 63 65 3f 0a 20 20 20 20 20 45 78 70 6c 61 69 6e 2e 0a 0a 4c 6f 67 69 63 20 | only.once?......Explain...Logic. |
| 101be0 | 61 73 20 70 72 6f 67 72 61 6d 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 | as.programs....................W |
| 101c00 | 65 20 63 61 6e 20 72 65 67 61 72 64 20 61 20 72 75 6c 65 20 61 73 20 61 20 6b 69 6e 64 20 6f 66 | e.can.regard.a.rule.as.a.kind.of |
| 101c20 | 20 6c 6f 67 69 63 61 6c 20 69 6d 70 6c 69 63 61 74 69 6f 6e 3a 20 5f 49 66 5f 20 61 6e 0a 61 73 | .logical.implication:._If_.an.as |
| 101c40 | 73 69 67 6e 6d 65 6e 74 20 6f 66 20 76 61 6c 75 65 73 20 74 6f 20 70 61 74 74 65 72 6e 20 76 61 | signment.of.values.to.pattern.va |
| 101c60 | 72 69 61 62 6c 65 73 20 73 61 74 69 73 66 69 65 73 20 74 68 65 20 62 6f 64 79 2c 20 5f 74 68 65 | riables.satisfies.the.body,._the |
| 101c80 | 6e 5f 20 69 74 0a 73 61 74 69 73 66 69 65 73 20 74 68 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 2e 20 | n_.it.satisfies.the.conclusion.. |
| 101ca0 | 20 43 6f 6e 73 65 71 75 65 6e 74 6c 79 2c 20 77 65 20 63 61 6e 20 72 65 67 61 72 64 20 74 68 65 | .Consequently,.we.can.regard.the |
| 101cc0 | 20 71 75 65 72 79 0a 6c 61 6e 67 75 61 67 65 20 61 73 20 68 61 76 69 6e 67 20 74 68 65 20 61 62 | .query.language.as.having.the.ab |
| 101ce0 | 69 6c 69 74 79 20 74 6f 20 70 65 72 66 6f 72 6d 20 22 6c 6f 67 69 63 61 6c 20 64 65 64 75 63 74 | ility.to.perform."logical.deduct |
| 101d00 | 69 6f 6e 73 22 20 62 61 73 65 64 0a 75 70 6f 6e 20 74 68 65 20 72 75 6c 65 73 2e 20 20 41 73 20 | ions".based.upon.the.rules...As. |
| 101d20 | 61 6e 20 65 78 61 6d 70 6c 65 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 60 61 70 70 65 6e 64 | an.example,.consider.the.`append |
| 101d40 | 27 20 6f 70 65 72 61 74 69 6f 6e 0a 64 65 73 63 72 69 62 65 64 20 61 74 20 74 68 65 20 62 65 67 | '.operation.described.at.the.beg |
| 101d60 | 69 6e 6e 69 6e 67 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 3a 3a 2e 20 20 | inning.of.section.*Note.4-4::... |
| 101d80 | 41 73 20 77 65 20 73 61 69 64 2c 0a 60 61 70 70 65 6e 64 27 20 63 61 6e 20 62 65 20 63 68 61 72 | As.we.said,.`append'.can.be.char |
| 101da0 | 61 63 74 65 72 69 7a 65 64 20 62 79 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 77 6f 20 72 | acterized.by.the.following.two.r |
| 101dc0 | 75 6c 65 73 3a 0a 0a 20 20 20 2a 20 46 6f 72 20 61 6e 79 20 6c 69 73 74 20 60 79 27 2c 20 74 68 | ules:.....*.For.any.list.`y',.th |
| 101de0 | 65 20 65 6d 70 74 79 20 6c 69 73 74 20 61 6e 64 20 60 79 27 20 60 61 70 70 65 6e 64 27 20 74 6f | e.empty.list.and.`y'.`append'.to |
| 101e00 | 20 66 6f 72 6d 20 60 79 27 2e 0a 0a 20 20 20 2a 20 46 6f 72 20 61 6e 79 20 60 75 27 2c 20 60 76 | .form.`y'......*.For.any.`u',.`v |
| 101e20 | 27 2c 20 60 79 27 2c 20 61 6e 64 20 60 7a 27 2c 20 60 28 63 6f 6e 73 20 75 20 76 29 27 20 61 6e | ',.`y',.and.`z',.`(cons.u.v)'.an |
| 101e40 | 64 20 60 79 27 20 60 61 70 70 65 6e 64 27 20 74 6f 0a 20 20 20 20 20 66 6f 72 6d 20 60 28 63 6f | d.`y'.`append'.to......form.`(co |
| 101e60 | 6e 73 20 75 20 7a 29 27 20 69 66 20 60 76 27 20 61 6e 64 20 60 79 27 20 60 61 70 70 65 6e 64 27 | ns.u.z)'.if.`v'.and.`y'.`append' |
| 101e80 | 20 74 6f 20 66 6f 72 6d 20 60 7a 27 2e 0a 0a 0a 20 20 20 54 6f 20 65 78 70 72 65 73 73 20 74 68 | .to.form.`z'.......To.express.th |
| 101ea0 | 69 73 20 69 6e 20 6f 75 72 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 2c 20 77 65 20 64 65 66 | is.in.our.query.language,.we.def |
| 101ec0 | 69 6e 65 20 74 77 6f 20 72 75 6c 65 73 20 66 6f 72 20 61 0a 72 65 6c 61 74 69 6f 6e 0a 0a 20 20 | ine.two.rules.for.a.relation.... |
| 101ee0 | 20 20 20 28 61 70 70 65 6e 64 2d 74 6f 2d 66 6f 72 6d 20 78 20 79 20 7a 29 0a 0a 77 68 69 63 68 | ...(append-to-form.x.y.z)..which |
| 101f00 | 20 77 65 20 63 61 6e 20 69 6e 74 65 72 70 72 65 74 20 74 6f 20 6d 65 61 6e 20 22 60 78 27 20 61 | .we.can.interpret.to.mean."`x'.a |
| 101f20 | 6e 64 20 60 79 27 20 60 61 70 70 65 6e 64 27 20 74 6f 20 66 6f 72 6d 20 60 7a 27 22 3a 0a 0a 20 | nd.`y'.`append'.to.form.`z'":... |
| 101f40 | 20 20 20 20 28 72 75 6c 65 20 28 61 70 70 65 6e 64 2d 74 6f 2d 66 6f 72 6d 20 28 29 20 3f 79 20 | ....(rule.(append-to-form.().?y. |
| 101f60 | 3f 79 29 29 0a 0a 20 20 20 20 20 28 72 75 6c 65 20 28 61 70 70 65 6e 64 2d 74 6f 2d 66 6f 72 6d | ?y)).......(rule.(append-to-form |
| 101f80 | 20 28 3f 75 20 2e 20 3f 76 29 20 3f 79 20 28 3f 75 20 2e 20 3f 7a 29 29 0a 20 20 20 20 20 20 20 | .(?u...?v).?y.(?u...?z))........ |
| 101fa0 | 20 20 20 20 28 61 70 70 65 6e 64 2d 74 6f 2d 66 6f 72 6d 20 3f 76 20 3f 79 20 3f 7a 29 29 0a 0a | ....(append-to-form.?v.?y.?z)).. |
| 101fc0 | 20 20 20 54 68 65 20 66 69 72 73 74 20 72 75 6c 65 20 68 61 73 20 6e 6f 20 62 6f 64 79 2c 20 77 | ...The.first.rule.has.no.body,.w |
| 101fe0 | 68 69 63 68 20 6d 65 61 6e 73 20 74 68 61 74 20 74 68 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 20 68 | hich.means.that.the.conclusion.h |
| 102000 | 6f 6c 64 73 0a 66 6f 72 20 61 6e 79 20 76 61 6c 75 65 20 6f 66 20 60 3f 79 27 2e 20 20 4e 6f 74 | olds.for.any.value.of.`?y'...Not |
| 102020 | 65 20 68 6f 77 20 74 68 65 20 73 65 63 6f 6e 64 20 72 75 6c 65 20 6d 61 6b 65 73 20 75 73 65 20 | e.how.the.second.rule.makes.use. |
| 102040 | 6f 66 0a 64 6f 74 74 65 64 2d 74 61 69 6c 20 6e 6f 74 61 74 69 6f 6e 20 74 6f 20 6e 61 6d 65 20 | of.dotted-tail.notation.to.name. |
| 102060 | 74 68 65 20 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 20 6f 66 20 61 20 6c 69 73 74 2e 0a 0a | the.`car'.and.`cdr'.of.a.list... |
| 102080 | 20 20 20 47 69 76 65 6e 20 74 68 65 73 65 20 74 77 6f 20 72 75 6c 65 73 2c 20 77 65 20 63 61 6e | ...Given.these.two.rules,.we.can |
| 1020a0 | 20 66 6f 72 6d 75 6c 61 74 65 20 71 75 65 72 69 65 73 20 74 68 61 74 20 63 6f 6d 70 75 74 65 20 | .formulate.queries.that.compute. |
| 1020c0 | 74 68 65 0a 60 61 70 70 65 6e 64 27 20 6f 66 20 74 77 6f 20 6c 69 73 74 73 3a 0a 0a 20 20 20 20 | the.`append'.of.two.lists:...... |
| 1020e0 | 20 3b 3b 3b 20 51 75 65 72 79 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 61 70 70 65 6e 64 2d 74 | .;;;.Query.input:......(append-t |
| 102100 | 6f 2d 66 6f 72 6d 20 28 61 20 62 29 20 28 63 20 64 29 20 3f 7a 29 0a 20 20 20 20 20 3b 3b 3b 20 | o-form.(a.b).(c.d).?z)......;;;. |
| 102120 | 51 75 65 72 79 20 72 65 73 75 6c 74 73 3a 0a 20 20 20 20 20 28 61 70 70 65 6e 64 2d 74 6f 2d 66 | Query.results:......(append-to-f |
| 102140 | 6f 72 6d 20 28 61 20 62 29 20 28 63 20 64 29 20 28 61 20 62 20 63 20 64 29 29 0a 0a 20 20 20 57 | orm.(a.b).(c.d).(a.b.c.d)).....W |
| 102160 | 68 61 74 20 69 73 20 6d 6f 72 65 20 73 74 72 69 6b 69 6e 67 2c 20 77 65 20 63 61 6e 20 75 73 65 | hat.is.more.striking,.we.can.use |
| 102180 | 20 74 68 65 20 73 61 6d 65 20 72 75 6c 65 73 20 74 6f 20 61 73 6b 20 74 68 65 20 71 75 65 73 74 | .the.same.rules.to.ask.the.quest |
| 1021a0 | 69 6f 6e 0a 22 57 68 69 63 68 20 6c 69 73 74 2c 20 77 68 65 6e 20 60 61 70 70 65 6e 64 27 65 64 | ion."Which.list,.when.`append'ed |
| 1021c0 | 20 74 6f 20 60 28 61 20 62 29 27 2c 20 79 69 65 6c 64 73 20 60 28 61 20 62 20 63 20 64 29 27 3f | .to.`(a.b)',.yields.`(a.b.c.d)'? |
| 1021e0 | 22 20 20 54 68 69 73 20 69 73 0a 64 6f 6e 65 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 | "..This.is.done.as.follows:..... |
| 102200 | 20 20 3b 3b 3b 20 51 75 65 72 79 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 61 70 70 65 6e 64 2d | ..;;;.Query.input:......(append- |
| 102220 | 74 6f 2d 66 6f 72 6d 20 28 61 20 62 29 20 3f 79 20 28 61 20 62 20 63 20 64 29 29 0a 20 20 20 20 | to-form.(a.b).?y.(a.b.c.d))..... |
| 102240 | 20 3b 3b 3b 20 51 75 65 72 79 20 72 65 73 75 6c 74 73 3a 0a 20 20 20 20 20 28 61 70 70 65 6e 64 | .;;;.Query.results:......(append |
| 102260 | 2d 74 6f 2d 66 6f 72 6d 20 28 61 20 62 29 20 28 63 20 64 29 20 28 61 20 62 20 63 20 64 29 29 0a | -to-form.(a.b).(c.d).(a.b.c.d)). |
| 102280 | 0a 20 20 20 57 65 20 63 61 6e 20 61 6c 73 6f 20 61 73 6b 20 66 6f 72 20 61 6c 6c 20 70 61 69 72 | ....We.can.also.ask.for.all.pair |
| 1022a0 | 73 20 6f 66 20 6c 69 73 74 73 20 74 68 61 74 20 60 61 70 70 65 6e 64 27 20 74 6f 20 66 6f 72 6d | s.of.lists.that.`append'.to.form |
| 1022c0 | 20 60 28 61 20 62 20 63 0a 64 29 27 3a 0a 0a 20 20 20 20 20 3b 3b 3b 20 51 75 65 72 79 20 69 6e | .`(a.b.c.d)':.......;;;.Query.in |
| 1022e0 | 70 75 74 3a 0a 20 20 20 20 20 28 61 70 70 65 6e 64 2d 74 6f 2d 66 6f 72 6d 20 3f 78 20 3f 79 20 | put:......(append-to-form.?x.?y. |
| 102300 | 28 61 20 62 20 63 20 64 29 29 0a 20 20 20 20 20 3b 3b 3b 20 51 75 65 72 79 20 72 65 73 75 6c 74 | (a.b.c.d))......;;;.Query.result |
| 102320 | 73 3a 0a 20 20 20 20 20 28 61 70 70 65 6e 64 2d 74 6f 2d 66 6f 72 6d 20 28 29 20 28 61 20 62 20 | s:......(append-to-form.().(a.b. |
| 102340 | 63 20 64 29 20 28 61 20 62 20 63 20 64 29 29 0a 20 20 20 20 20 28 61 70 70 65 6e 64 2d 74 6f 2d | c.d).(a.b.c.d))......(append-to- |
| 102360 | 66 6f 72 6d 20 28 61 29 20 28 62 20 63 20 64 29 20 28 61 20 62 20 63 20 64 29 29 0a 20 20 20 20 | form.(a).(b.c.d).(a.b.c.d))..... |
| 102380 | 20 28 61 70 70 65 6e 64 2d 74 6f 2d 66 6f 72 6d 20 28 61 20 62 29 20 28 63 20 64 29 20 28 61 20 | .(append-to-form.(a.b).(c.d).(a. |
| 1023a0 | 62 20 63 20 64 29 29 0a 20 20 20 20 20 28 61 70 70 65 6e 64 2d 74 6f 2d 66 6f 72 6d 20 28 61 20 | b.c.d))......(append-to-form.(a. |
| 1023c0 | 62 20 63 29 20 28 64 29 20 28 61 20 62 20 63 20 64 29 29 0a 20 20 20 20 20 28 61 70 70 65 6e 64 | b.c).(d).(a.b.c.d))......(append |
| 1023e0 | 2d 74 6f 2d 66 6f 72 6d 20 28 61 20 62 20 63 20 64 29 20 28 29 20 28 61 20 62 20 63 20 64 29 29 | -to-form.(a.b.c.d).().(a.b.c.d)) |
| 102400 | 0a 0a 20 20 20 54 68 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 20 6d 61 79 20 73 65 65 6d 20 74 | .....The.query.system.may.seem.t |
| 102420 | 6f 20 65 78 68 69 62 69 74 20 71 75 69 74 65 20 61 20 62 69 74 20 6f 66 20 69 6e 74 65 6c 6c 69 | o.exhibit.quite.a.bit.of.intelli |
| 102440 | 67 65 6e 63 65 20 69 6e 0a 75 73 69 6e 67 20 74 68 65 20 72 75 6c 65 73 20 74 6f 20 64 65 64 75 | gence.in.using.the.rules.to.dedu |
| 102460 | 63 65 20 74 68 65 20 61 6e 73 77 65 72 73 20 74 6f 20 74 68 65 20 71 75 65 72 69 65 73 20 61 62 | ce.the.answers.to.the.queries.ab |
| 102480 | 6f 76 65 2e 20 20 41 63 74 75 61 6c 6c 79 2c 0a 61 73 20 77 65 20 77 69 6c 6c 20 73 65 65 20 69 | ove...Actually,.as.we.will.see.i |
| 1024a0 | 6e 20 74 68 65 20 6e 65 78 74 20 73 65 63 74 69 6f 6e 2c 20 74 68 65 20 73 79 73 74 65 6d 20 69 | n.the.next.section,.the.system.i |
| 1024c0 | 73 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 0a 77 65 6c 6c 2d 64 65 74 65 72 6d 69 6e 65 64 20 61 6c | s.following.a.well-determined.al |
| 1024e0 | 67 6f 72 69 74 68 6d 20 69 6e 20 75 6e 72 61 76 65 6c 69 6e 67 20 74 68 65 20 72 75 6c 65 73 2e | gorithm.in.unraveling.the.rules. |
| 102500 | 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 0a 61 6c 74 68 6f 75 67 68 20 74 68 65 20 73 79 | ..Unfortunately,.although.the.sy |
| 102520 | 73 74 65 6d 20 77 6f 72 6b 73 20 69 6d 70 72 65 73 73 69 76 65 6c 79 20 69 6e 20 74 68 65 20 60 | stem.works.impressively.in.the.` |
| 102540 | 61 70 70 65 6e 64 27 20 63 61 73 65 2c 20 74 68 65 0a 67 65 6e 65 72 61 6c 20 6d 65 74 68 6f 64 | append'.case,.the.general.method |
| 102560 | 73 20 6d 61 79 20 62 72 65 61 6b 20 64 6f 77 6e 20 69 6e 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 | s.may.break.down.in.more.complex |
| 102580 | 20 63 61 73 65 73 2c 20 61 73 20 77 65 20 77 69 6c 6c 20 73 65 65 20 69 6e 0a 73 65 63 74 69 6f | .cases,.as.we.will.see.in.sectio |
| 1025a0 | 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 33 3a 3a 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | n.*Note.4-4-3::........*Exercise |
| 1025c0 | 20 34 2e 36 31 3a 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 72 75 6c 65 73 20 69 6d 70 6c | .4.61:*.The.following.rules.impl |
| 1025e0 | 65 6d 65 6e 74 20 61 20 60 6e 65 78 74 2d 74 6f 27 0a 20 20 20 20 20 72 65 6c 61 74 69 6f 6e 20 | ement.a.`next-to'......relation. |
| 102600 | 74 68 61 74 20 66 69 6e 64 73 20 61 64 6a 61 63 65 6e 74 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 | that.finds.adjacent.elements.of. |
| 102620 | 61 20 6c 69 73 74 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 72 75 6c 65 20 28 3f 78 20 6e 65 78 | a.list:............(rule.(?x.nex |
| 102640 | 74 2d 74 6f 20 3f 79 20 69 6e 20 28 3f 78 20 3f 79 20 2e 20 3f 75 29 29 29 0a 0a 20 20 20 20 20 | t-to.?y.in.(?x.?y...?u)))....... |
| 102660 | 20 20 20 20 20 28 72 75 6c 65 20 28 3f 78 20 6e 65 78 74 2d 74 6f 20 3f 79 20 69 6e 20 28 3f 76 | .....(rule.(?x.next-to.?y.in.(?v |
| 102680 | 20 2e 20 3f 7a 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 3f 78 20 6e 65 78 74 | ...?z)).................(?x.next |
| 1026a0 | 2d 74 6f 20 3f 79 20 69 6e 20 3f 7a 29 29 0a 0a 20 20 20 20 20 57 68 61 74 20 77 69 6c 6c 20 74 | -to.?y.in.?z)).......What.will.t |
| 1026c0 | 68 65 20 72 65 73 70 6f 6e 73 65 20 62 65 20 74 6f 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 | he.response.be.to.the.following. |
| 1026e0 | 71 75 65 72 69 65 73 3f 0a 0a 20 20 20 20 20 20 20 20 20 20 28 3f 78 20 6e 65 78 74 2d 74 6f 20 | queries?............(?x.next-to. |
| 102700 | 3f 79 20 69 6e 20 28 31 20 28 32 20 33 29 20 34 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 3f | ?y.in.(1.(2.3).4))............(? |
| 102720 | 78 20 6e 65 78 74 2d 74 6f 20 31 20 69 6e 20 28 32 20 31 20 33 20 31 29 29 0a 0a 20 20 20 20 20 | x.next-to.1.in.(2.1.3.1))....... |
| 102740 | 2a 45 78 65 72 63 69 73 65 20 34 2e 36 32 3a 2a 20 44 65 66 69 6e 65 20 72 75 6c 65 73 20 74 6f | *Exercise.4.62:*.Define.rules.to |
| 102760 | 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 60 6c 61 73 74 2d 70 61 69 72 27 0a 20 20 20 20 20 | .implement.the.`last-pair'...... |
| 102780 | 6f 70 65 72 61 74 69 6f 6e 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 31 37 | operation.of.*Note.Exercise.2-17 |
| 1027a0 | 3a 3a 2c 20 77 68 69 63 68 20 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74 0a 20 20 20 20 20 63 6f | ::,.which.returns.a.list......co |
| 1027c0 | 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 6c 61 73 74 20 65 6c 65 6d 65 6e 74 20 6f 66 20 61 20 6e | ntaining.the.last.element.of.a.n |
| 1027e0 | 6f 6e 65 6d 70 74 79 20 6c 69 73 74 2e 20 20 43 68 65 63 6b 20 79 6f 75 72 20 72 75 6c 65 73 0a | onempty.list...Check.your.rules. |
| 102800 | 20 20 20 20 20 6f 6e 20 71 75 65 72 69 65 73 20 73 75 63 68 20 61 73 20 60 28 6c 61 73 74 2d 70 | .....on.queries.such.as.`(last-p |
| 102820 | 61 69 72 20 28 33 29 20 3f 78 29 27 2c 20 60 28 6c 61 73 74 2d 70 61 69 72 20 28 31 20 32 20 33 | air.(3).?x)',.`(last-pair.(1.2.3 |
| 102840 | 29 20 3f 78 29 27 2c 0a 20 20 20 20 20 61 6e 64 20 60 28 6c 61 73 74 2d 70 61 69 72 20 28 32 20 | ).?x)',......and.`(last-pair.(2. |
| 102860 | 3f 78 29 20 28 33 29 29 27 2e 20 20 44 6f 20 79 6f 75 72 20 72 75 6c 65 73 20 77 6f 72 6b 20 63 | ?x).(3))'...Do.your.rules.work.c |
| 102880 | 6f 72 72 65 63 74 6c 79 20 6f 6e 0a 20 20 20 20 20 71 75 65 72 69 65 73 20 73 75 63 68 20 61 73 | orrectly.on......queries.such.as |
| 1028a0 | 20 60 28 6c 61 73 74 2d 70 61 69 72 20 3f 78 20 28 33 29 29 27 20 3f 0a 0a 20 20 20 20 20 2a 45 | .`(last-pair.?x.(3))'.?.......*E |
| 1028c0 | 78 65 72 63 69 73 65 20 34 2e 36 33 3a 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 61 74 | xercise.4.63:*.The.following.dat |
| 1028e0 | 61 20 62 61 73 65 20 28 73 65 65 20 47 65 6e 65 73 69 73 20 34 29 20 74 72 61 63 65 73 0a 20 20 | a.base.(see.Genesis.4).traces... |
| 102900 | 20 20 20 74 68 65 20 67 65 6e 65 61 6c 6f 67 79 20 6f 66 20 74 68 65 20 64 65 73 63 65 6e 64 61 | ...the.genealogy.of.the.descenda |
| 102920 | 6e 74 73 20 6f 66 20 41 64 61 20 62 61 63 6b 20 74 6f 20 41 64 61 6d 2c 20 62 79 20 77 61 79 20 | nts.of.Ada.back.to.Adam,.by.way. |
| 102940 | 6f 66 0a 20 20 20 20 20 43 61 69 6e 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 6f 6e 20 41 64 | of......Cain:............(son.Ad |
| 102960 | 61 6d 20 43 61 69 6e 29 0a 20 20 20 20 20 20 20 20 20 20 28 73 6f 6e 20 43 61 69 6e 20 45 6e 6f | am.Cain)...........(son.Cain.Eno |
| 102980 | 63 68 29 0a 20 20 20 20 20 20 20 20 20 20 28 73 6f 6e 20 45 6e 6f 63 68 20 49 72 61 64 29 0a 20 | ch)...........(son.Enoch.Irad).. |
| 1029a0 | 20 20 20 20 20 20 20 20 20 28 73 6f 6e 20 49 72 61 64 20 4d 65 68 75 6a 61 65 6c 29 0a 20 20 20 | .........(son.Irad.Mehujael).... |
| 1029c0 | 20 20 20 20 20 20 20 28 73 6f 6e 20 4d 65 68 75 6a 61 65 6c 20 4d 65 74 68 75 73 68 61 65 6c 29 | .......(son.Mehujael.Methushael) |
| 1029e0 | 0a 20 20 20 20 20 20 20 20 20 20 28 73 6f 6e 20 4d 65 74 68 75 73 68 61 65 6c 20 4c 61 6d 65 63 | ...........(son.Methushael.Lamec |
| 102a00 | 68 29 0a 20 20 20 20 20 20 20 20 20 20 28 77 69 66 65 20 4c 61 6d 65 63 68 20 41 64 61 29 0a 20 | h)...........(wife.Lamech.Ada).. |
| 102a20 | 20 20 20 20 20 20 20 20 20 28 73 6f 6e 20 41 64 61 20 4a 61 62 61 6c 29 0a 20 20 20 20 20 20 20 | .........(son.Ada.Jabal)........ |
| 102a40 | 20 20 20 28 73 6f 6e 20 41 64 61 20 4a 75 62 61 6c 29 0a 0a 20 20 20 20 20 46 6f 72 6d 75 6c 61 | ...(son.Ada.Jubal).......Formula |
| 102a60 | 74 65 20 72 75 6c 65 73 20 73 75 63 68 20 61 73 20 22 49 66 20 53 20 69 73 20 74 68 65 20 73 6f | te.rules.such.as."If.S.is.the.so |
| 102a80 | 6e 20 6f 66 20 66 2c 20 61 6e 64 20 66 20 69 73 20 74 68 65 20 73 6f 6e 20 6f 66 0a 20 20 20 20 | n.of.f,.and.f.is.the.son.of..... |
| 102aa0 | 20 47 2c 20 74 68 65 6e 20 53 20 69 73 20 74 68 65 20 67 72 61 6e 64 73 6f 6e 20 6f 66 20 47 22 | .G,.then.S.is.the.grandson.of.G" |
| 102ac0 | 20 61 6e 64 20 22 49 66 20 57 20 69 73 20 74 68 65 20 77 69 66 65 20 6f 66 20 4d 2c 20 61 6e 64 | .and."If.W.is.the.wife.of.M,.and |
| 102ae0 | 20 53 0a 20 20 20 20 20 69 73 20 74 68 65 20 73 6f 6e 20 6f 66 20 57 2c 20 74 68 65 6e 20 53 20 | .S......is.the.son.of.W,.then.S. |
| 102b00 | 69 73 20 74 68 65 20 73 6f 6e 20 6f 66 20 4d 22 20 28 77 68 69 63 68 20 77 61 73 20 73 75 70 70 | is.the.son.of.M".(which.was.supp |
| 102b20 | 6f 73 65 64 6c 79 0a 20 20 20 20 20 6d 6f 72 65 20 74 72 75 65 20 69 6e 20 62 69 62 6c 69 63 61 | osedly......more.true.in.biblica |
| 102b40 | 6c 20 74 69 6d 65 73 20 74 68 61 6e 20 74 6f 64 61 79 29 20 74 68 61 74 20 77 69 6c 6c 20 65 6e | l.times.than.today).that.will.en |
| 102b60 | 61 62 6c 65 20 74 68 65 20 71 75 65 72 79 0a 20 20 20 20 20 73 79 73 74 65 6d 20 74 6f 20 66 69 | able.the.query......system.to.fi |
| 102b80 | 6e 64 20 74 68 65 20 67 72 61 6e 64 73 6f 6e 20 6f 66 20 43 61 69 6e 3b 20 74 68 65 20 73 6f 6e | nd.the.grandson.of.Cain;.the.son |
| 102ba0 | 73 20 6f 66 20 4c 61 6d 65 63 68 3b 20 74 68 65 0a 20 20 20 20 20 67 72 61 6e 64 73 6f 6e 73 20 | s.of.Lamech;.the......grandsons. |
| 102bc0 | 6f 66 20 4d 65 74 68 75 73 68 61 65 6c 2e 20 20 28 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 | of.Methushael...(See.*Note.Exerc |
| 102be0 | 69 73 65 20 34 2d 36 39 3a 3a 20 66 6f 72 20 73 6f 6d 65 0a 20 20 20 20 20 72 75 6c 65 73 20 74 | ise.4-69::.for.some......rules.t |
| 102c00 | 6f 20 64 65 64 75 63 65 20 6d 6f 72 65 20 63 6f 6d 70 6c 69 63 61 74 65 64 20 72 65 6c 61 74 69 | o.deduce.more.complicated.relati |
| 102c20 | 6f 6e 73 68 69 70 73 2e 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 | onships.).....----------.Footnot |
| 102c40 | 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 69 73 20 75 73 65 73 20 | es.----------.....(1).This.uses. |
| 102c60 | 74 68 65 20 64 6f 74 74 65 64 2d 74 61 69 6c 20 6e 6f 74 61 74 69 6f 6e 20 69 6e 74 72 6f 64 75 | the.dotted-tail.notation.introdu |
| 102c80 | 63 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 32 2d 32 30 3a 3a 2e 0a 0a 20 | ced.in.*Note.Exercise.2-20::.... |
| 102ca0 | 20 20 28 32 29 20 41 63 74 75 61 6c 6c 79 2c 20 74 68 69 73 20 64 65 73 63 72 69 70 74 69 6f 6e | ..(2).Actually,.this.description |
| 102cc0 | 20 6f 66 20 60 6e 6f 74 27 20 69 73 20 76 61 6c 69 64 20 6f 6e 6c 79 20 66 6f 72 20 73 69 6d 70 | .of.`not'.is.valid.only.for.simp |
| 102ce0 | 6c 65 0a 63 61 73 65 73 2e 20 20 54 68 65 20 72 65 61 6c 20 62 65 68 61 76 69 6f 72 20 6f 66 20 | le.cases...The.real.behavior.of. |
| 102d00 | 60 6e 6f 74 27 20 69 73 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 2e 20 20 57 65 20 77 69 6c 6c 20 | `not'.is.more.complex...We.will. |
| 102d20 | 65 78 61 6d 69 6e 65 0a 60 6e 6f 74 27 27 73 20 70 65 63 75 6c 69 61 72 69 74 69 65 73 20 69 6e | examine.`not''s.peculiarities.in |
| 102d40 | 20 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 20 34 2d 34 2d 32 3a 3a 20 61 6e 64 20 2a 4e 6f 74 | .sections.*Note.4-4-2::.and.*Not |
| 102d60 | 65 20 34 2d 34 2d 33 3a 3a 2e 0a 0a 20 20 20 28 33 29 20 60 4c 69 73 70 2d 76 61 6c 75 65 27 20 | e.4-4-3::......(3).`Lisp-value'. |
| 102d80 | 73 68 6f 75 6c 64 20 62 65 20 75 73 65 64 20 6f 6e 6c 79 20 74 6f 20 70 65 72 66 6f 72 6d 20 61 | should.be.used.only.to.perform.a |
| 102da0 | 6e 20 6f 70 65 72 61 74 69 6f 6e 20 6e 6f 74 0a 70 72 6f 76 69 64 65 64 20 69 6e 20 74 68 65 20 | n.operation.not.provided.in.the. |
| 102dc0 | 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 2e 20 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 | query.language...In.particular,. |
| 102de0 | 69 74 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 75 73 65 64 0a 74 6f 20 74 65 73 74 20 65 71 | it.should.not.be.used.to.test.eq |
| 102e00 | 75 61 6c 69 74 79 20 28 73 69 6e 63 65 20 74 68 61 74 20 69 73 20 77 68 61 74 20 74 68 65 20 6d | uality.(since.that.is.what.the.m |
| 102e20 | 61 74 63 68 69 6e 67 20 69 6e 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 0a 69 73 | atching.in.the.query.language.is |
| 102e40 | 20 64 65 73 69 67 6e 65 64 20 74 6f 20 64 6f 29 20 6f 72 20 69 6e 65 71 75 61 6c 69 74 79 20 28 | .designed.to.do).or.inequality.( |
| 102e60 | 73 69 6e 63 65 20 74 68 61 74 20 63 61 6e 20 62 65 20 64 6f 6e 65 20 77 69 74 68 20 74 68 65 0a | since.that.can.be.done.with.the. |
| 102e80 | 60 73 61 6d 65 27 20 72 75 6c 65 20 73 68 6f 77 6e 20 62 65 6c 6f 77 29 2e 0a 0a 20 20 20 28 34 | `same'.rule.shown.below)......(4 |
| 102ea0 | 29 20 4e 6f 74 69 63 65 20 74 68 61 74 20 77 65 20 64 6f 20 6e 6f 74 20 6e 65 65 64 20 60 73 61 | ).Notice.that.we.do.not.need.`sa |
| 102ec0 | 6d 65 27 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 6d 61 6b 65 20 74 77 6f 20 74 68 69 6e 67 73 20 | me'.in.order.to.make.two.things. |
| 102ee0 | 62 65 0a 74 68 65 20 73 61 6d 65 3a 20 57 65 20 6a 75 73 74 20 75 73 65 20 74 68 65 20 73 61 6d | be.the.same:.We.just.use.the.sam |
| 102f00 | 65 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 20 66 6f 72 20 65 61 63 68 2d 2d 69 6e 20 | e.pattern.variable.for.each--in. |
| 102f20 | 65 66 66 65 63 74 2c 20 77 65 0a 68 61 76 65 20 6f 6e 65 20 74 68 69 6e 67 20 69 6e 73 74 65 61 | effect,.we.have.one.thing.instea |
| 102f40 | 64 20 6f 66 20 74 77 6f 20 74 68 69 6e 67 73 20 69 6e 20 74 68 65 20 66 69 72 73 74 20 70 6c 61 | d.of.two.things.in.the.first.pla |
| 102f60 | 63 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 73 65 65 20 60 3f 74 6f 77 6e 27 20 69 6e | ce...For.example,.see.`?town'.in |
| 102f80 | 20 74 68 65 20 60 6c 69 76 65 73 2d 6e 65 61 72 27 20 72 75 6c 65 20 61 6e 64 20 60 3f 6d 69 64 | .the.`lives-near'.rule.and.`?mid |
| 102fa0 | 64 6c 65 2d 6d 61 6e 61 67 65 72 27 20 69 6e 20 74 68 65 0a 60 77 68 65 65 6c 27 20 72 75 6c 65 | dle-manager'.in.the.`wheel'.rule |
| 102fc0 | 20 62 65 6c 6f 77 2e 20 20 60 53 61 6d 65 27 20 69 73 20 75 73 65 66 75 6c 20 77 68 65 6e 20 77 | .below...`Same'.is.useful.when.w |
| 102fe0 | 65 20 77 61 6e 74 20 74 6f 20 66 6f 72 63 65 20 74 77 6f 20 74 68 69 6e 67 73 0a 74 6f 20 62 65 | e.want.to.force.two.things.to.be |
| 103000 | 20 64 69 66 66 65 72 65 6e 74 2c 20 73 75 63 68 20 61 73 20 60 3f 70 65 72 73 6f 6e 2d 31 27 20 | .different,.such.as.`?person-1'. |
| 103020 | 61 6e 64 20 60 3f 70 65 72 73 6f 6e 2d 32 27 20 69 6e 20 74 68 65 0a 60 6c 69 76 65 73 2d 6e 65 | and.`?person-2'.in.the.`lives-ne |
| 103040 | 61 72 27 20 72 75 6c 65 2e 20 20 41 6c 74 68 6f 75 67 68 20 75 73 69 6e 67 20 74 68 65 20 73 61 | ar'.rule...Although.using.the.sa |
| 103060 | 6d 65 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 20 69 6e 20 74 77 6f 0a 70 61 72 74 73 | me.pattern.variable.in.two.parts |
| 103080 | 20 6f 66 20 61 20 71 75 65 72 79 20 66 6f 72 63 65 73 20 74 68 65 20 73 61 6d 65 20 76 61 6c 75 | .of.a.query.forces.the.same.valu |
| 1030a0 | 65 20 74 6f 20 61 70 70 65 61 72 20 69 6e 20 62 6f 74 68 20 70 6c 61 63 65 73 2c 20 75 73 69 6e | e.to.appear.in.both.places,.usin |
| 1030c0 | 67 0a 64 69 66 66 65 72 65 6e 74 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 64 6f | g.different.pattern.variables.do |
| 1030e0 | 65 73 20 6e 6f 74 20 66 6f 72 63 65 20 64 69 66 66 65 72 65 6e 74 20 76 61 6c 75 65 73 20 74 6f | es.not.force.different.values.to |
| 103100 | 20 61 70 70 65 61 72 2e 0a 28 54 68 65 20 76 61 6c 75 65 73 20 61 73 73 69 67 6e 65 64 20 74 6f | .appear..(The.values.assigned.to |
| 103120 | 20 64 69 66 66 65 72 65 6e 74 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 6d 61 79 | .different.pattern.variables.may |
| 103140 | 20 62 65 20 74 68 65 20 73 61 6d 65 20 6f 72 0a 64 69 66 66 65 72 65 6e 74 2e 29 0a 0a 20 20 20 | .be.the.same.or.different.)..... |
| 103160 | 28 35 29 20 57 65 20 77 69 6c 6c 20 61 6c 73 6f 20 61 6c 6c 6f 77 20 72 75 6c 65 73 20 77 69 74 | (5).We.will.also.allow.rules.wit |
| 103180 | 68 6f 75 74 20 62 6f 64 69 65 73 2c 20 61 73 20 69 6e 20 60 73 61 6d 65 27 2c 20 61 6e 64 20 77 | hout.bodies,.as.in.`same',.and.w |
| 1031a0 | 65 0a 77 69 6c 6c 20 69 6e 74 65 72 70 72 65 74 20 73 75 63 68 20 61 20 72 75 6c 65 20 74 6f 20 | e.will.interpret.such.a.rule.to. |
| 1031c0 | 6d 65 61 6e 20 74 68 61 74 20 74 68 65 20 72 75 6c 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 20 69 73 | mean.that.the.rule.conclusion.is |
| 1031e0 | 0a 73 61 74 69 73 66 69 65 64 20 62 79 20 61 6e 79 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 | .satisfied.by.any.values.of.the. |
| 103200 | 76 61 72 69 61 62 6c 65 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 | variables.....File:.sicp.info,.. |
| 103220 | 4e 6f 64 65 3a 20 34 2d 34 2d 32 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2d 33 2c 20 20 50 72 65 76 | Node:.4-4-2,..Next:.4-4-3,..Prev |
| 103240 | 3a 20 34 2d 34 2d 31 2c 20 20 55 70 3a 20 34 2d 34 0a 0a 34 2e 34 2e 32 20 48 6f 77 20 74 68 65 | :.4-4-1,..Up:.4-4..4.4.2.How.the |
| 103260 | 20 51 75 65 72 79 20 53 79 73 74 65 6d 20 57 6f 72 6b 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .Query.System.Works.------------ |
| 103280 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 6e 20 73 65 63 74 69 6f 6e | --------------------..In.section |
| 1032a0 | 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 3a 3a 20 77 65 20 77 69 6c 6c 20 70 72 65 73 65 6e 74 20 61 | .*Note.4-4-4::.we.will.present.a |
| 1032c0 | 6e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 71 75 65 72 79 0a 69 6e | n.implementation.of.the.query.in |
| 1032e0 | 74 65 72 70 72 65 74 65 72 20 61 73 20 61 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 70 72 6f | terpreter.as.a.collection.of.pro |
| 103300 | 63 65 64 75 72 65 73 2e 20 20 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 77 65 20 67 69 76 | cedures...In.this.section.we.giv |
| 103320 | 65 20 61 6e 0a 6f 76 65 72 76 69 65 77 20 74 68 61 74 20 65 78 70 6c 61 69 6e 73 20 74 68 65 20 | e.an.overview.that.explains.the. |
| 103340 | 67 65 6e 65 72 61 6c 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 73 79 73 74 65 6d 20 | general.structure.of.the.system. |
| 103360 | 69 6e 64 65 70 65 6e 64 65 6e 74 0a 6f 66 20 6c 6f 77 2d 6c 65 76 65 6c 20 69 6d 70 6c 65 6d 65 | independent.of.low-level.impleme |
| 103380 | 6e 74 61 74 69 6f 6e 20 64 65 74 61 69 6c 73 2e 20 20 41 66 74 65 72 20 64 65 73 63 72 69 62 69 | ntation.details...After.describi |
| 1033a0 | 6e 67 20 74 68 65 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 69 6e 74 | ng.the.implementation.of.the.int |
| 1033c0 | 65 72 70 72 65 74 65 72 2c 20 77 65 20 77 69 6c 6c 20 62 65 20 69 6e 20 61 20 70 6f 73 69 74 69 | erpreter,.we.will.be.in.a.positi |
| 1033e0 | 6f 6e 20 74 6f 0a 75 6e 64 65 72 73 74 61 6e 64 20 73 6f 6d 65 20 6f 66 20 69 74 73 20 6c 69 6d | on.to.understand.some.of.its.lim |
| 103400 | 69 74 61 74 69 6f 6e 73 20 61 6e 64 20 73 6f 6d 65 20 6f 66 20 74 68 65 20 73 75 62 74 6c 65 20 | itations.and.some.of.the.subtle. |
| 103420 | 77 61 79 73 20 69 6e 20 77 68 69 63 68 0a 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 | ways.in.which.the.query.language |
| 103440 | 27 73 20 6c 6f 67 69 63 61 6c 20 6f 70 65 72 61 74 69 6f 6e 73 20 64 69 66 66 65 72 20 66 72 6f | 's.logical.operations.differ.fro |
| 103460 | 6d 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 66 0a 6d 61 74 68 65 6d 61 74 69 63 61 6c | m.the.operations.of.mathematical |
| 103480 | 20 6c 6f 67 69 63 2e 0a 0a 20 20 20 49 74 20 73 68 6f 75 6c 64 20 62 65 20 61 70 70 61 72 65 6e | .logic......It.should.be.apparen |
| 1034a0 | 74 20 74 68 61 74 20 74 68 65 20 71 75 65 72 79 20 65 76 61 6c 75 61 74 6f 72 20 6d 75 73 74 20 | t.that.the.query.evaluator.must. |
| 1034c0 | 70 65 72 66 6f 72 6d 20 73 6f 6d 65 0a 6b 69 6e 64 20 6f 66 20 73 65 61 72 63 68 20 69 6e 20 6f | perform.some.kind.of.search.in.o |
| 1034e0 | 72 64 65 72 20 74 6f 20 6d 61 74 63 68 20 71 75 65 72 69 65 73 20 61 67 61 69 6e 73 74 20 66 61 | rder.to.match.queries.against.fa |
| 103500 | 63 74 73 20 61 6e 64 20 72 75 6c 65 73 20 69 6e 20 74 68 65 0a 64 61 74 61 20 62 61 73 65 2e 20 | cts.and.rules.in.the.data.base.. |
| 103520 | 20 4f 6e 65 20 77 61 79 20 74 6f 20 64 6f 20 74 68 69 73 20 77 6f 75 6c 64 20 62 65 20 74 6f 20 | .One.way.to.do.this.would.be.to. |
| 103540 | 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 0a 61 73 20 61 20 | implement.the.query.system.as.a. |
| 103560 | 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 70 72 6f 67 72 61 6d 2c 20 75 73 69 6e 67 20 | nondeterministic.program,.using. |
| 103580 | 74 68 65 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 0a 2a | the.`amb'.evaluator.of.section.* |
| 1035a0 | 4e 6f 74 65 20 34 2d 33 3a 3a 20 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 | Note.4-3::.(see.*Note.Exercise.4 |
| 1035c0 | 2d 37 38 3a 3a 29 2e 20 20 41 6e 6f 74 68 65 72 20 70 6f 73 73 69 62 69 6c 69 74 79 20 69 73 20 | -78::)...Another.possibility.is. |
| 1035e0 | 74 6f 0a 6d 61 6e 61 67 65 20 74 68 65 20 73 65 61 72 63 68 20 77 69 74 68 20 74 68 65 20 61 69 | to.manage.the.search.with.the.ai |
| 103600 | 64 20 6f 66 20 73 74 72 65 61 6d 73 2e 20 20 4f 75 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | d.of.streams...Our.implementatio |
| 103620 | 6e 20 66 6f 6c 6c 6f 77 73 0a 74 68 69 73 20 73 65 63 6f 6e 64 20 61 70 70 72 6f 61 63 68 2e 0a | n.follows.this.second.approach.. |
| 103640 | 0a 20 20 20 54 68 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 20 69 73 20 6f 72 67 61 6e 69 7a 65 | ....The.query.system.is.organize |
| 103660 | 64 20 61 72 6f 75 6e 64 20 74 77 6f 20 63 65 6e 74 72 61 6c 20 6f 70 65 72 61 74 69 6f 6e 73 20 | d.around.two.central.operations. |
| 103680 | 63 61 6c 6c 65 64 20 22 70 61 74 74 65 72 6e 0a 6d 61 74 63 68 69 6e 67 22 20 61 6e 64 20 22 75 | called."pattern.matching".and."u |
| 1036a0 | 6e 69 66 69 63 61 74 69 6f 6e 22 2e 20 20 57 65 20 66 69 72 73 74 20 64 65 73 63 72 69 62 65 20 | nification"...We.first.describe. |
| 1036c0 | 70 61 74 74 65 72 6e 20 6d 61 74 63 68 69 6e 67 20 61 6e 64 0a 65 78 70 6c 61 69 6e 20 68 6f 77 | pattern.matching.and.explain.how |
| 1036e0 | 20 74 68 69 73 20 6f 70 65 72 61 74 69 6f 6e 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 | .this.operation,.together.with.t |
| 103700 | 68 65 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 6f 66 0a 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 | he.organization.of.information.i |
| 103720 | 6e 20 74 65 72 6d 73 20 6f 66 20 73 74 72 65 61 6d 73 20 6f 66 20 66 72 61 6d 65 73 2c 20 65 6e | n.terms.of.streams.of.frames,.en |
| 103740 | 61 62 6c 65 73 20 75 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 62 6f 74 68 0a 73 69 6d 70 6c | ables.us.to.implement.both.simpl |
| 103760 | 65 20 61 6e 64 20 63 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 2e 20 20 57 65 20 6e 65 78 74 | e.and.compound.queries...We.next |
| 103780 | 20 64 69 73 63 75 73 73 20 75 6e 69 66 69 63 61 74 69 6f 6e 2c 20 61 0a 67 65 6e 65 72 61 6c 69 | .discuss.unification,.a.generali |
| 1037a0 | 7a 61 74 69 6f 6e 20 6f 66 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 69 6e 67 20 6e 65 65 64 65 | zation.of.pattern.matching.neede |
| 1037c0 | 64 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 72 75 6c 65 73 2e 20 20 46 69 6e 61 6c 6c 79 2c 0a | d.to.implement.rules...Finally,. |
| 1037e0 | 77 65 20 73 68 6f 77 20 68 6f 77 20 74 68 65 20 65 6e 74 69 72 65 20 71 75 65 72 79 20 69 6e 74 | we.show.how.the.entire.query.int |
| 103800 | 65 72 70 72 65 74 65 72 20 66 69 74 73 20 74 6f 67 65 74 68 65 72 20 74 68 72 6f 75 67 68 20 61 | erpreter.fits.together.through.a |
| 103820 | 0a 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 63 6c 61 73 73 69 66 69 65 73 20 65 78 70 72 65 | .procedure.that.classifies.expre |
| 103840 | 73 73 69 6f 6e 73 20 69 6e 20 61 20 6d 61 6e 6e 65 72 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 | ssions.in.a.manner.analogous.to. |
| 103860 | 74 68 65 20 77 61 79 0a 60 65 76 61 6c 27 20 63 6c 61 73 73 69 66 69 65 73 20 65 78 70 72 65 73 | the.way.`eval'.classifies.expres |
| 103880 | 73 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 64 65 73 63 72 69 | sions.for.the.interpreter.descri |
| 1038a0 | 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 34 2d 31 3a 3a 2e 0a 0a 50 61 74 | bed.in.section.*Note.4-1::...Pat |
| 1038c0 | 74 65 72 6e 20 6d 61 74 63 68 69 6e 67 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | tern.matching................... |
| 1038e0 | 41 20 22 70 61 74 74 65 72 6e 20 6d 61 74 63 68 65 72 22 20 69 73 20 61 20 70 72 6f 67 72 61 6d | A."pattern.matcher".is.a.program |
| 103900 | 20 74 68 61 74 20 74 65 73 74 73 20 77 68 65 74 68 65 72 20 73 6f 6d 65 20 64 61 74 75 6d 20 66 | .that.tests.whether.some.datum.f |
| 103920 | 69 74 73 20 61 0a 73 70 65 63 69 66 69 65 64 20 70 61 74 74 65 72 6e 2e 20 20 46 6f 72 20 65 78 | its.a.specified.pattern...For.ex |
| 103940 | 61 6d 70 6c 65 2c 20 74 68 65 20 64 61 74 61 20 6c 69 73 74 20 60 28 28 61 20 62 29 20 63 20 28 | ample,.the.data.list.`((a.b).c.( |
| 103960 | 61 20 62 29 29 27 20 6d 61 74 63 68 65 73 0a 74 68 65 20 70 61 74 74 65 72 6e 20 60 28 3f 78 20 | a.b))'.matches.the.pattern.`(?x. |
| 103980 | 63 20 3f 78 29 27 20 77 69 74 68 20 74 68 65 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 | c.?x)'.with.the.pattern.variable |
| 1039a0 | 20 60 3f 78 27 20 62 6f 75 6e 64 20 74 6f 20 60 28 61 0a 62 29 27 2e 20 20 54 68 65 20 73 61 6d | .`?x'.bound.to.`(a.b)'...The.sam |
| 1039c0 | 65 20 64 61 74 61 20 6c 69 73 74 20 6d 61 74 63 68 65 73 20 74 68 65 20 70 61 74 74 65 72 6e 20 | e.data.list.matches.the.pattern. |
| 1039e0 | 60 28 3f 78 20 3f 79 20 3f 7a 29 27 20 77 69 74 68 20 60 3f 78 27 20 61 6e 64 0a 60 3f 7a 27 20 | `(?x.?y.?z)'.with.`?x'.and.`?z'. |
| 103a00 | 62 6f 74 68 20 62 6f 75 6e 64 20 74 6f 20 60 28 61 20 62 29 27 20 61 6e 64 20 60 3f 79 27 20 62 | both.bound.to.`(a.b)'.and.`?y'.b |
| 103a20 | 6f 75 6e 64 20 74 6f 20 60 63 27 2e 20 20 49 74 20 61 6c 73 6f 20 6d 61 74 63 68 65 73 20 74 68 | ound.to.`c'...It.also.matches.th |
| 103a40 | 65 0a 70 61 74 74 65 72 6e 20 60 28 28 3f 78 20 3f 79 29 20 63 20 28 3f 78 20 3f 79 29 29 27 20 | e.pattern.`((?x.?y).c.(?x.?y))'. |
| 103a60 | 77 69 74 68 20 60 3f 78 27 20 62 6f 75 6e 64 20 74 6f 20 60 61 27 20 61 6e 64 20 60 3f 79 27 20 | with.`?x'.bound.to.`a'.and.`?y'. |
| 103a80 | 62 6f 75 6e 64 20 74 6f 0a 60 62 27 2e 20 20 48 6f 77 65 76 65 72 2c 20 69 74 20 64 6f 65 73 20 | bound.to.`b'...However,.it.does. |
| 103aa0 | 6e 6f 74 20 6d 61 74 63 68 20 74 68 65 20 70 61 74 74 65 72 6e 20 60 28 3f 78 20 61 20 3f 79 29 | not.match.the.pattern.`(?x.a.?y) |
| 103ac0 | 27 2c 20 73 69 6e 63 65 20 74 68 61 74 0a 70 61 74 74 65 72 6e 20 73 70 65 63 69 66 69 65 73 20 | ',.since.that.pattern.specifies. |
| 103ae0 | 61 20 6c 69 73 74 20 77 68 6f 73 65 20 73 65 63 6f 6e 64 20 65 6c 65 6d 65 6e 74 20 69 73 20 74 | a.list.whose.second.element.is.t |
| 103b00 | 68 65 20 73 79 6d 62 6f 6c 20 60 61 27 2e 0a 0a 20 20 20 54 68 65 20 70 61 74 74 65 72 6e 20 6d | he.symbol.`a'......The.pattern.m |
| 103b20 | 61 74 63 68 65 72 20 75 73 65 64 20 62 79 20 74 68 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 20 | atcher.used.by.the.query.system. |
| 103b40 | 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 73 20 61 0a 70 61 74 74 65 72 6e 2c 20 61 20 64 61 74 | takes.as.inputs.a.pattern,.a.dat |
| 103b60 | 75 6d 2c 20 61 6e 64 20 61 20 22 66 72 61 6d 65 22 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 | um,.and.a."frame".that.specifies |
| 103b80 | 20 62 69 6e 64 69 6e 67 73 20 66 6f 72 20 76 61 72 69 6f 75 73 0a 70 61 74 74 65 72 6e 20 76 61 | .bindings.for.various.pattern.va |
| 103ba0 | 72 69 61 62 6c 65 73 2e 20 20 49 74 20 63 68 65 63 6b 73 20 77 68 65 74 68 65 72 20 74 68 65 20 | riables...It.checks.whether.the. |
| 103bc0 | 64 61 74 75 6d 20 6d 61 74 63 68 65 73 20 74 68 65 20 70 61 74 74 65 72 6e 20 69 6e 0a 61 20 77 | datum.matches.the.pattern.in.a.w |
| 103be0 | 61 79 20 74 68 61 74 20 69 73 20 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 74 68 65 20 62 | ay.that.is.consistent.with.the.b |
| 103c00 | 69 6e 64 69 6e 67 73 20 61 6c 72 65 61 64 79 20 69 6e 20 74 68 65 20 66 72 61 6d 65 2e 20 20 49 | indings.already.in.the.frame...I |
| 103c20 | 66 0a 73 6f 2c 20 69 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 67 69 76 65 6e 20 66 72 61 6d 65 | f.so,.it.returns.the.given.frame |
| 103c40 | 20 61 75 67 6d 65 6e 74 65 64 20 62 79 20 61 6e 79 20 62 69 6e 64 69 6e 67 73 20 74 68 61 74 20 | .augmented.by.any.bindings.that. |
| 103c60 | 6d 61 79 20 68 61 76 65 0a 62 65 65 6e 20 64 65 74 65 72 6d 69 6e 65 64 20 62 79 20 74 68 65 20 | may.have.been.determined.by.the. |
| 103c80 | 6d 61 74 63 68 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 69 74 20 69 6e 64 69 63 61 74 65 73 20 | match...Otherwise,.it.indicates. |
| 103ca0 | 74 68 61 74 20 74 68 65 20 6d 61 74 63 68 0a 68 61 73 20 66 61 69 6c 65 64 2e 0a 0a 20 20 20 46 | that.the.match.has.failed......F |
| 103cc0 | 6f 72 20 65 78 61 6d 70 6c 65 2c 20 75 73 69 6e 67 20 74 68 65 20 70 61 74 74 65 72 6e 20 60 28 | or.example,.using.the.pattern.`( |
| 103ce0 | 3f 78 20 3f 79 20 3f 78 29 27 20 74 6f 20 6d 61 74 63 68 20 60 28 61 20 62 20 61 29 27 20 67 69 | ?x.?y.?x)'.to.match.`(a.b.a)'.gi |
| 103d00 | 76 65 6e 0a 61 6e 20 65 6d 70 74 79 20 66 72 61 6d 65 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 61 | ven.an.empty.frame.will.return.a |
| 103d20 | 20 66 72 61 6d 65 20 73 70 65 63 69 66 79 69 6e 67 20 74 68 61 74 20 60 3f 78 27 20 69 73 20 62 | .frame.specifying.that.`?x'.is.b |
| 103d40 | 6f 75 6e 64 20 74 6f 20 60 61 27 0a 61 6e 64 20 60 3f 79 27 20 69 73 20 62 6f 75 6e 64 20 74 6f | ound.to.`a'.and.`?y'.is.bound.to |
| 103d60 | 20 60 62 27 2e 20 20 54 72 79 69 6e 67 20 74 68 65 20 6d 61 74 63 68 20 77 69 74 68 20 74 68 65 | .`b'...Trying.the.match.with.the |
| 103d80 | 20 73 61 6d 65 20 70 61 74 74 65 72 6e 2c 20 74 68 65 0a 73 61 6d 65 20 64 61 74 75 6d 2c 20 61 | .same.pattern,.the.same.datum,.a |
| 103da0 | 6e 64 20 61 20 66 72 61 6d 65 20 73 70 65 63 69 66 79 69 6e 67 20 74 68 61 74 20 60 3f 79 27 20 | nd.a.frame.specifying.that.`?y'. |
| 103dc0 | 69 73 20 62 6f 75 6e 64 20 74 6f 20 60 61 27 20 77 69 6c 6c 20 66 61 69 6c 2e 0a 54 72 79 69 6e | is.bound.to.`a'.will.fail..Tryin |
| 103de0 | 67 20 74 68 65 20 6d 61 74 63 68 20 77 69 74 68 20 74 68 65 20 73 61 6d 65 20 70 61 74 74 65 72 | g.the.match.with.the.same.patter |
| 103e00 | 6e 2c 20 74 68 65 20 73 61 6d 65 20 64 61 74 75 6d 2c 20 61 6e 64 20 61 20 66 72 61 6d 65 20 69 | n,.the.same.datum,.and.a.frame.i |
| 103e20 | 6e 0a 77 68 69 63 68 20 60 3f 79 27 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 60 62 27 20 61 6e 64 | n.which.`?y'.is.bound.to.`b'.and |
| 103e40 | 20 60 3f 78 27 20 69 73 20 75 6e 62 6f 75 6e 64 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 68 65 | .`?x'.is.unbound.will.return.the |
| 103e60 | 20 67 69 76 65 6e 0a 66 72 61 6d 65 20 61 75 67 6d 65 6e 74 65 64 20 62 79 20 61 20 62 69 6e 64 | .given.frame.augmented.by.a.bind |
| 103e80 | 69 6e 67 20 6f 66 20 60 3f 78 27 20 74 6f 20 60 61 27 2e 0a 0a 20 20 20 54 68 65 20 70 61 74 74 | ing.of.`?x'.to.`a'......The.patt |
| 103ea0 | 65 72 6e 20 6d 61 74 63 68 65 72 20 69 73 20 61 6c 6c 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d | ern.matcher.is.all.the.mechanism |
| 103ec0 | 20 74 68 61 74 20 69 73 20 6e 65 65 64 65 64 20 74 6f 20 70 72 6f 63 65 73 73 0a 73 69 6d 70 6c | .that.is.needed.to.process.simpl |
| 103ee0 | 65 20 71 75 65 72 69 65 73 20 74 68 61 74 20 64 6f 6e 27 74 20 69 6e 76 6f 6c 76 65 20 72 75 6c | e.queries.that.don't.involve.rul |
| 103f00 | 65 73 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 | es...For.instance,.to.process.th |
| 103f20 | 65 0a 71 75 65 72 79 0a 0a 20 20 20 20 20 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 | e.query.......(job.?x.(computer. |
| 103f40 | 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a 0a 77 65 20 73 63 61 6e 20 74 68 72 6f 75 67 68 20 61 6c | programmer))..we.scan.through.al |
| 103f60 | 6c 20 61 73 73 65 72 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 61 6e | l.assertions.in.the.data.base.an |
| 103f80 | 64 20 73 65 6c 65 63 74 20 74 68 6f 73 65 20 74 68 61 74 0a 6d 61 74 63 68 20 74 68 65 20 70 61 | d.select.those.that.match.the.pa |
| 103fa0 | 74 74 65 72 6e 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 6f 20 61 6e 20 69 6e 69 74 69 61 6c | ttern.with.respect.to.an.initial |
| 103fc0 | 6c 79 20 65 6d 70 74 79 20 66 72 61 6d 65 2e 20 20 46 6f 72 20 65 61 63 68 0a 6d 61 74 63 68 20 | ly.empty.frame...For.each.match. |
| 103fe0 | 77 65 20 66 69 6e 64 2c 20 77 65 20 75 73 65 20 74 68 65 20 66 72 61 6d 65 20 72 65 74 75 72 6e | we.find,.we.use.the.frame.return |
| 104000 | 65 64 20 62 79 20 74 68 65 20 6d 61 74 63 68 20 74 6f 20 69 6e 73 74 61 6e 74 69 61 74 65 0a 74 | ed.by.the.match.to.instantiate.t |
| 104020 | 68 65 20 70 61 74 74 65 72 6e 20 77 69 74 68 20 61 20 76 61 6c 75 65 20 66 6f 72 20 60 3f 78 27 | he.pattern.with.a.value.for.`?x' |
| 104040 | 2e 0a 0a 53 74 72 65 61 6d 73 20 6f 66 20 66 72 61 6d 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ...Streams.of.frames............ |
| 104060 | 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 74 65 73 74 69 6e 67 20 6f 66 20 70 61 74 74 65 72 6e 73 20 | ........The.testing.of.patterns. |
| 104080 | 61 67 61 69 6e 73 74 20 66 72 61 6d 65 73 20 69 73 20 6f 72 67 61 6e 69 7a 65 64 20 74 68 72 6f | against.frames.is.organized.thro |
| 1040a0 | 75 67 68 20 74 68 65 20 75 73 65 20 6f 66 0a 73 74 72 65 61 6d 73 2e 20 20 47 69 76 65 6e 20 61 | ugh.the.use.of.streams...Given.a |
| 1040c0 | 20 73 69 6e 67 6c 65 20 66 72 61 6d 65 2c 20 74 68 65 20 6d 61 74 63 68 69 6e 67 20 70 72 6f 63 | .single.frame,.the.matching.proc |
| 1040e0 | 65 73 73 20 72 75 6e 73 20 74 68 72 6f 75 67 68 20 74 68 65 0a 64 61 74 61 2d 62 61 73 65 20 65 | ess.runs.through.the.data-base.e |
| 104100 | 6e 74 72 69 65 73 20 6f 6e 65 20 62 79 20 6f 6e 65 2e 20 20 46 6f 72 20 65 61 63 68 20 64 61 74 | ntries.one.by.one...For.each.dat |
| 104120 | 61 2d 62 61 73 65 20 65 6e 74 72 79 2c 20 74 68 65 20 6d 61 74 63 68 65 72 0a 67 65 6e 65 72 61 | a-base.entry,.the.matcher.genera |
| 104140 | 74 65 73 20 65 69 74 68 65 72 20 61 20 73 70 65 63 69 61 6c 20 73 79 6d 62 6f 6c 20 69 6e 64 69 | tes.either.a.special.symbol.indi |
| 104160 | 63 61 74 69 6e 67 20 74 68 61 74 20 74 68 65 20 6d 61 74 63 68 20 68 61 73 20 66 61 69 6c 65 64 | cating.that.the.match.has.failed |
| 104180 | 0a 6f 72 20 61 6e 20 65 78 74 65 6e 73 69 6f 6e 20 74 6f 20 74 68 65 20 66 72 61 6d 65 2e 20 20 | .or.an.extension.to.the.frame... |
| 1041a0 | 54 68 65 20 72 65 73 75 6c 74 73 20 66 6f 72 20 61 6c 6c 20 74 68 65 20 64 61 74 61 2d 62 61 73 | The.results.for.all.the.data-bas |
| 1041c0 | 65 0a 65 6e 74 72 69 65 73 20 61 72 65 20 63 6f 6c 6c 65 63 74 65 64 20 69 6e 74 6f 20 61 20 73 | e.entries.are.collected.into.a.s |
| 1041e0 | 74 72 65 61 6d 2c 20 77 68 69 63 68 20 69 73 20 70 61 73 73 65 64 20 74 68 72 6f 75 67 68 20 61 | tream,.which.is.passed.through.a |
| 104200 | 20 66 69 6c 74 65 72 0a 74 6f 20 77 65 65 64 20 6f 75 74 20 74 68 65 20 66 61 69 6c 75 72 65 73 | .filter.to.weed.out.the.failures |
| 104220 | 2e 20 20 54 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 20 73 74 72 65 61 6d 20 6f 66 20 61 6c 6c | ...The.result.is.a.stream.of.all |
| 104240 | 20 74 68 65 20 66 72 61 6d 65 73 0a 74 68 61 74 20 65 78 74 65 6e 64 20 74 68 65 20 67 69 76 65 | .the.frames.that.extend.the.give |
| 104260 | 6e 20 66 72 61 6d 65 20 76 69 61 20 61 20 6d 61 74 63 68 20 74 6f 20 73 6f 6d 65 20 61 73 73 65 | n.frame.via.a.match.to.some.asse |
| 104280 | 72 74 69 6f 6e 20 69 6e 20 74 68 65 20 64 61 74 61 0a 62 61 73 65 2e 28 31 29 0a 0a 20 20 20 49 | rtion.in.the.data.base.(1).....I |
| 1042a0 | 6e 20 6f 75 72 20 73 79 73 74 65 6d 2c 20 61 20 71 75 65 72 79 20 74 61 6b 65 73 20 61 6e 20 69 | n.our.system,.a.query.takes.an.i |
| 1042c0 | 6e 70 75 74 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 20 61 6e 64 20 70 65 72 66 6f 72 | nput.stream.of.frames.and.perfor |
| 1042e0 | 6d 73 0a 74 68 65 20 61 62 6f 76 65 20 6d 61 74 63 68 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 20 | ms.the.above.matching.operation. |
| 104300 | 66 6f 72 20 65 76 65 72 79 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 73 74 72 65 61 6d 2c 20 61 | for.every.frame.in.the.stream,.a |
| 104320 | 73 0a 69 6e 64 69 63 61 74 65 64 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 34 2d 34 3a | s.indicated.in.*Note.Figure.4-4: |
| 104340 | 3a 2e 20 20 54 68 61 74 20 69 73 2c 20 66 6f 72 20 65 61 63 68 20 66 72 61 6d 65 20 69 6e 20 74 | :...That.is,.for.each.frame.in.t |
| 104360 | 68 65 20 69 6e 70 75 74 0a 73 74 72 65 61 6d 2c 20 74 68 65 20 71 75 65 72 79 20 67 65 6e 65 72 | he.input.stream,.the.query.gener |
| 104380 | 61 74 65 73 20 61 20 6e 65 77 20 73 74 72 65 61 6d 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 | ates.a.new.stream.consisting.of. |
| 1043a0 | 61 6c 6c 20 65 78 74 65 6e 73 69 6f 6e 73 0a 74 6f 20 74 68 61 74 20 66 72 61 6d 65 20 62 79 20 | all.extensions.to.that.frame.by. |
| 1043c0 | 6d 61 74 63 68 65 73 20 74 6f 20 61 73 73 65 72 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 64 61 74 | matches.to.assertions.in.the.dat |
| 1043e0 | 61 20 62 61 73 65 2e 20 20 41 6c 6c 20 74 68 65 73 65 0a 73 74 72 65 61 6d 73 20 61 72 65 20 74 | a.base...All.these.streams.are.t |
| 104400 | 68 65 6e 20 63 6f 6d 62 69 6e 65 64 20 74 6f 20 66 6f 72 6d 20 6f 6e 65 20 68 75 67 65 20 73 74 | hen.combined.to.form.one.huge.st |
| 104420 | 72 65 61 6d 2c 20 77 68 69 63 68 20 63 6f 6e 74 61 69 6e 73 20 61 6c 6c 0a 70 6f 73 73 69 62 6c | ream,.which.contains.all.possibl |
| 104440 | 65 20 65 78 74 65 6e 73 69 6f 6e 73 20 6f 66 20 65 76 65 72 79 20 66 72 61 6d 65 20 69 6e 20 74 | e.extensions.of.every.frame.in.t |
| 104460 | 68 65 20 69 6e 70 75 74 20 73 74 72 65 61 6d 2e 20 20 54 68 69 73 20 73 74 72 65 61 6d 20 69 73 | he.input.stream...This.stream.is |
| 104480 | 0a 74 68 65 20 6f 75 74 70 75 74 20 6f 66 20 74 68 65 20 71 75 65 72 79 2e 0a 0a 20 20 20 20 20 | .the.output.of.the.query........ |
| 1044a0 | 2a 46 69 67 75 72 65 20 34 2e 34 3a 2a 20 41 20 71 75 65 72 79 20 70 72 6f 63 65 73 73 65 73 20 | *Figure.4.4:*.A.query.processes. |
| 1044c0 | 61 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 | a.stream.of.frames.............. |
| 1044e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 104500 | 20 6f 75 74 70 75 74 20 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 70 75 74 | .output.stream.............input |
| 104520 | 20 73 74 72 65 61 6d 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 20 20 6f 66 20 66 72 | .stream...+-------------+..of.fr |
| 104540 | 61 6d 65 73 2c 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20 66 72 61 6d 65 73 20 20 20 20 20 | ames,.............of.frames..... |
| 104560 | 20 7c 20 20 20 20 71 75 65 72 79 20 20 20 20 7c 20 20 66 69 6c 74 65 72 65 64 20 61 6e 64 20 65 | .|....query....|..filtered.and.e |
| 104580 | 78 74 65 6e 64 65 64 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | xtended...........-------------- |
| 1045a0 | 2d 2d 3e 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -->|.............+-------------- |
| 1045c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ----------->.................... |
| 1045e0 | 20 20 20 20 20 20 20 20 7c 20 28 6a 6f 62 20 3f 78 20 3f 79 29 20 7c 0a 20 20 20 20 20 20 20 20 | ........|.(job.?x.?y).|......... |
| 104600 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ...................+------------ |
| 104620 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -+.............................. |
| 104640 | 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....^.......................... |
| 104660 | 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .........|...................... |
| 104680 | 20 20 20 20 73 74 72 65 61 6d 20 6f 66 20 61 73 73 65 72 74 69 6f 6e 73 0a 20 20 20 20 20 20 20 | ....stream.of.assertions........ |
| 1046a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 72 6f 6d 20 64 61 74 61 20 62 | .....................from.data.b |
| 1046c0 | 61 73 65 0a 0a 20 20 20 54 6f 20 61 6e 73 77 65 72 20 61 20 73 69 6d 70 6c 65 20 71 75 65 72 79 | ase.....To.answer.a.simple.query |
| 1046e0 | 2c 20 77 65 20 75 73 65 20 74 68 65 20 71 75 65 72 79 20 77 69 74 68 20 61 6e 20 69 6e 70 75 74 | ,.we.use.the.query.with.an.input |
| 104700 | 20 73 74 72 65 61 6d 0a 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 61 20 73 69 6e 67 6c 65 20 65 | .stream.consisting.of.a.single.e |
| 104720 | 6d 70 74 79 20 66 72 61 6d 65 2e 20 20 54 68 65 20 72 65 73 75 6c 74 69 6e 67 20 6f 75 74 70 75 | mpty.frame...The.resulting.outpu |
| 104740 | 74 20 73 74 72 65 61 6d 0a 63 6f 6e 74 61 69 6e 73 20 61 6c 6c 20 65 78 74 65 6e 73 69 6f 6e 73 | t.stream.contains.all.extensions |
| 104760 | 20 74 6f 20 74 68 65 20 65 6d 70 74 79 20 66 72 61 6d 65 20 28 74 68 61 74 20 69 73 2c 20 61 6c | .to.the.empty.frame.(that.is,.al |
| 104780 | 6c 20 61 6e 73 77 65 72 73 20 74 6f 20 6f 75 72 0a 71 75 65 72 79 29 2e 20 20 54 68 69 73 20 73 | l.answers.to.our.query)...This.s |
| 1047a0 | 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 20 69 73 20 74 68 65 6e 20 75 73 65 64 20 74 6f 20 | tream.of.frames.is.then.used.to. |
| 1047c0 | 67 65 6e 65 72 61 74 65 20 61 20 73 74 72 65 61 6d 20 6f 66 0a 63 6f 70 69 65 73 20 6f 66 20 74 | generate.a.stream.of.copies.of.t |
| 1047e0 | 68 65 20 6f 72 69 67 69 6e 61 6c 20 71 75 65 72 79 20 70 61 74 74 65 72 6e 20 77 69 74 68 20 74 | he.original.query.pattern.with.t |
| 104800 | 68 65 20 76 61 72 69 61 62 6c 65 73 20 69 6e 73 74 61 6e 74 69 61 74 65 64 20 62 79 0a 74 68 65 | he.variables.instantiated.by.the |
| 104820 | 20 76 61 6c 75 65 73 20 69 6e 20 65 61 63 68 20 66 72 61 6d 65 2c 20 61 6e 64 20 74 68 69 73 20 | .values.in.each.frame,.and.this. |
| 104840 | 69 73 20 74 68 65 20 73 74 72 65 61 6d 20 74 68 61 74 20 69 73 20 66 69 6e 61 6c 6c 79 0a 70 72 | is.the.stream.that.is.finally.pr |
| 104860 | 69 6e 74 65 64 2e 0a 0a 43 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 0a 2e 2e 2e 2e 2e 2e 2e | inted...Compound.queries........ |
| 104880 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 72 65 61 6c 20 65 6c 65 67 61 6e 63 65 20 6f 66 20 | ...........The.real.elegance.of. |
| 1048a0 | 74 68 65 20 73 74 72 65 61 6d 2d 6f 66 2d 66 72 61 6d 65 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 | the.stream-of-frames.implementat |
| 1048c0 | 69 6f 6e 20 69 73 20 65 76 69 64 65 6e 74 0a 77 68 65 6e 20 77 65 20 64 65 61 6c 20 77 69 74 68 | ion.is.evident.when.we.deal.with |
| 1048e0 | 20 63 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 2e 20 20 54 68 65 20 70 72 6f 63 65 73 73 69 | .compound.queries...The.processi |
| 104900 | 6e 67 20 6f 66 20 63 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 0a 6d 61 6b 65 73 20 75 73 65 | ng.of.compound.queries.makes.use |
| 104920 | 20 6f 66 20 74 68 65 20 61 62 69 6c 69 74 79 20 6f 66 20 6f 75 72 20 6d 61 74 63 68 65 72 20 74 | .of.the.ability.of.our.matcher.t |
| 104940 | 6f 20 64 65 6d 61 6e 64 20 74 68 61 74 20 61 20 6d 61 74 63 68 20 62 65 0a 63 6f 6e 73 69 73 74 | o.demand.that.a.match.be.consist |
| 104960 | 65 6e 74 20 77 69 74 68 20 61 20 73 70 65 63 69 66 69 65 64 20 66 72 61 6d 65 2e 20 20 46 6f 72 | ent.with.a.specified.frame...For |
| 104980 | 20 65 78 61 6d 70 6c 65 2c 20 74 6f 20 68 61 6e 64 6c 65 20 74 68 65 20 60 61 6e 64 27 20 6f 66 | .example,.to.handle.the.`and'.of |
| 1049a0 | 0a 74 77 6f 20 71 75 65 72 69 65 73 2c 20 73 75 63 68 20 61 73 0a 0a 20 20 20 20 20 28 61 6e 64 | .two.queries,.such.as.......(and |
| 1049c0 | 20 28 63 61 6e 2d 64 6f 2d 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 | .(can-do-job.?x.(computer.progra |
| 1049e0 | 6d 6d 65 72 20 74 72 61 69 6e 65 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 6a 6f 62 20 3f 70 | mmer.trainee))...........(job.?p |
| 104a00 | 65 72 73 6f 6e 20 3f 78 29 29 0a 0a 28 69 6e 66 6f 72 6d 61 6c 6c 79 2c 20 22 46 69 6e 64 20 61 | erson.?x))..(informally,."Find.a |
| 104a20 | 6c 6c 20 70 65 6f 70 6c 65 20 77 68 6f 20 63 61 6e 20 64 6f 20 74 68 65 20 6a 6f 62 20 6f 66 20 | ll.people.who.can.do.the.job.of. |
| 104a40 | 61 20 63 6f 6d 70 75 74 65 72 0a 70 72 6f 67 72 61 6d 6d 65 72 20 74 72 61 69 6e 65 65 22 29 2c | a.computer.programmer.trainee"), |
| 104a60 | 20 77 65 20 66 69 72 73 74 20 66 69 6e 64 20 61 6c 6c 20 65 6e 74 72 69 65 73 20 74 68 61 74 20 | .we.first.find.all.entries.that. |
| 104a80 | 6d 61 74 63 68 20 74 68 65 20 70 61 74 74 65 72 6e 0a 0a 20 20 20 20 20 28 63 61 6e 2d 64 6f 2d | match.the.pattern.......(can-do- |
| 104aa0 | 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 20 74 72 61 69 | job.?x.(computer.programmer.trai |
| 104ac0 | 6e 65 65 29 29 0a 0a 20 20 20 54 68 69 73 20 70 72 6f 64 75 63 65 73 20 61 20 73 74 72 65 61 6d | nee)).....This.produces.a.stream |
| 104ae0 | 20 6f 66 20 66 72 61 6d 65 73 2c 20 65 61 63 68 20 6f 66 20 77 68 69 63 68 20 63 6f 6e 74 61 69 | .of.frames,.each.of.which.contai |
| 104b00 | 6e 73 20 61 20 62 69 6e 64 69 6e 67 0a 66 6f 72 20 60 3f 78 27 2e 20 20 54 68 65 6e 20 66 6f 72 | ns.a.binding.for.`?x'...Then.for |
| 104b20 | 20 65 61 63 68 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 73 74 72 65 61 6d 20 77 65 20 66 69 6e | .each.frame.in.the.stream.we.fin |
| 104b40 | 64 20 61 6c 6c 20 65 6e 74 72 69 65 73 20 74 68 61 74 0a 6d 61 74 63 68 0a 0a 20 20 20 20 20 28 | d.all.entries.that.match.......( |
| 104b60 | 6a 6f 62 20 3f 70 65 72 73 6f 6e 20 3f 78 29 0a 0a 69 6e 20 61 20 77 61 79 20 74 68 61 74 20 69 | job.?person.?x)..in.a.way.that.i |
| 104b80 | 73 20 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 74 68 65 20 67 69 76 65 6e 20 62 69 6e 64 | s.consistent.with.the.given.bind |
| 104ba0 | 69 6e 67 20 66 6f 72 20 60 3f 78 27 2e 20 20 45 61 63 68 20 73 75 63 68 0a 6d 61 74 63 68 20 77 | ing.for.`?x'...Each.such.match.w |
| 104bc0 | 69 6c 6c 20 70 72 6f 64 75 63 65 20 61 20 66 72 61 6d 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 62 | ill.produce.a.frame.containing.b |
| 104be0 | 69 6e 64 69 6e 67 73 20 66 6f 72 20 60 3f 78 27 20 61 6e 64 20 60 3f 70 65 72 73 6f 6e 27 2e 0a | indings.for.`?x'.and.`?person'.. |
| 104c00 | 54 68 65 20 60 61 6e 64 27 20 6f 66 20 74 77 6f 20 71 75 65 72 69 65 73 20 63 61 6e 20 62 65 20 | The.`and'.of.two.queries.can.be. |
| 104c20 | 76 69 65 77 65 64 20 61 73 20 61 20 73 65 72 69 65 73 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f | viewed.as.a.series.combination.o |
| 104c40 | 66 20 74 68 65 0a 74 77 6f 20 63 6f 6d 70 6f 6e 65 6e 74 20 71 75 65 72 69 65 73 2c 20 61 73 20 | f.the.two.component.queries,.as. |
| 104c60 | 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 34 2d 35 3a 3a 2e 20 20 54 68 | shown.in.*Note.Figure.4-5::...Th |
| 104c80 | 65 20 66 72 61 6d 65 73 20 74 68 61 74 0a 70 61 73 73 20 74 68 72 6f 75 67 68 20 74 68 65 20 66 | e.frames.that.pass.through.the.f |
| 104ca0 | 69 72 73 74 20 71 75 65 72 79 20 66 69 6c 74 65 72 20 61 72 65 20 66 69 6c 74 65 72 65 64 20 61 | irst.query.filter.are.filtered.a |
| 104cc0 | 6e 64 20 66 75 72 74 68 65 72 20 65 78 74 65 6e 64 65 64 0a 62 79 20 74 68 65 20 73 65 63 6f 6e | nd.further.extended.by.the.secon |
| 104ce0 | 64 20 71 75 65 72 79 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 34 2e 35 3a 2a 20 54 68 65 | d.query........*Figure.4.5:*.The |
| 104d00 | 20 60 61 6e 64 27 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 74 77 6f 20 71 75 65 72 69 65 | .`and'.combination.of.two.querie |
| 104d20 | 73 20 69 73 20 70 72 6f 64 75 63 65 64 20 62 79 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6e 67 20 | s.is.produced.by......operating. |
| 104d40 | 6f 6e 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 20 69 6e 20 73 65 72 69 65 | on.the.stream.of.frames.in.serie |
| 104d60 | 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d | s.............................+- |
| 104d80 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 | ---------------------+.......... |
| 104da0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 28 61 6e 64 20 41 20 | .................|.......(and.A. |
| 104dc0 | 42 29 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 70 75 74 20 73 74 72 65 | B)......|.............input.stre |
| 104de0 | 61 6d 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 6f 75 | am..|......................|..ou |
| 104e00 | 74 70 75 74 20 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 6f 66 20 66 72 61 6d 65 | tput.stream.............of.frame |
| 104e20 | 73 20 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 7c 20 20 | s.....|...+---+.......+---+..|.. |
| 104e40 | 6f 66 20 66 72 61 6d 65 73 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | of.frames...........------------ |
| 104e60 | 2d 2d 2d 2d 2d 2d 2d 3e 7c 20 41 20 2b 2d 2d 2d 2d 2d 2d 3e 7c 20 42 20 2b 2d 2d 2d 2d 2d 2d 2d | ------->|.A.+------>|.B.+------- |
| 104e80 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ------------->.................. |
| 104ea0 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 | .........|...+---+.......+---+.. |
| 104ec0 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | |...........................|... |
| 104ee0 | 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | ..^...........^....|............ |
| 104f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | ...............|.....|.......... |
| 104f20 | 20 7c 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .|....|......................... |
| 104f40 | 20 20 7c 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2a 2d 2d 2d 2d 2d 2b 20 20 20 20 7c 0a 20 20 20 20 20 | ..|.....+-----*-----+....|...... |
| 104f60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .....................+---------- |
| 104f80 | 2d 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -|----------+................... |
| 104fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 | ....................|........... |
| 104fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 61 74 61 20 62 61 73 | ........................data.bas |
| 104fe0 | 65 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 34 2d 36 3a 3a 20 73 68 6f 77 73 20 74 | e.....*Note.Figure.4-6::.shows.t |
| 105000 | 68 65 20 61 6e 61 6c 6f 67 6f 75 73 20 6d 65 74 68 6f 64 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e | he.analogous.method.for.computin |
| 105020 | 67 20 74 68 65 20 60 6f 72 27 0a 6f 66 20 74 77 6f 20 71 75 65 72 69 65 73 20 61 73 20 61 20 70 | g.the.`or'.of.two.queries.as.a.p |
| 105040 | 61 72 61 6c 6c 65 6c 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 74 77 6f 20 63 | arallel.combination.of.the.two.c |
| 105060 | 6f 6d 70 6f 6e 65 6e 74 20 71 75 65 72 69 65 73 2e 0a 54 68 65 20 69 6e 70 75 74 20 73 74 72 65 | omponent.queries..The.input.stre |
| 105080 | 61 6d 20 6f 66 20 66 72 61 6d 65 73 20 69 73 20 65 78 74 65 6e 64 65 64 20 73 65 70 61 72 61 74 | am.of.frames.is.extended.separat |
| 1050a0 | 65 6c 79 20 62 79 20 65 61 63 68 20 71 75 65 72 79 2e 20 20 54 68 65 0a 74 77 6f 20 72 65 73 75 | ely.by.each.query...The.two.resu |
| 1050c0 | 6c 74 69 6e 67 20 73 74 72 65 61 6d 73 20 61 72 65 20 74 68 65 6e 20 6d 65 72 67 65 64 20 74 6f | lting.streams.are.then.merged.to |
| 1050e0 | 20 70 72 6f 64 75 63 65 20 74 68 65 20 66 69 6e 61 6c 20 6f 75 74 70 75 74 0a 73 74 72 65 61 6d | .produce.the.final.output.stream |
| 105100 | 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 34 2e 36 3a 2a 20 54 68 65 20 60 6f 72 27 20 63 | ........*Figure.4.6:*.The.`or'.c |
| 105120 | 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 74 77 6f 20 71 75 65 72 69 65 73 20 69 73 20 70 72 6f | ombination.of.two.queries.is.pro |
| 105140 | 64 75 63 65 64 20 62 79 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6e 67 20 6f 6e 20 74 68 65 20 73 | duced.by......operating.on.the.s |
| 105160 | 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 20 69 6e 20 70 61 72 61 6c 6c 65 6c 20 61 6e 64 20 | tream.of.frames.in.parallel.and. |
| 105180 | 6d 65 72 67 69 6e 67 20 74 68 65 0a 20 20 20 20 20 72 65 73 75 6c 74 73 2e 0a 0a 20 20 20 20 20 | merging.the......results........ |
| 1051a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ................+--------------- |
| 1051c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ------------+................... |
| 1051e0 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 28 6f 72 20 41 20 42 29 20 20 20 20 20 20 20 20 20 7c | ...|..........(or.A.B).........| |
| 105200 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 2b 2d 2d 2d 2b | ......................|....+---+ |
| 105220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 69 6e | ..................|...........in |
| 105240 | 70 75 74 20 20 20 20 20 20 7c 20 2b 2d 3e 7c 20 41 20 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b | put......|.+->|.A.|------------+ |
| 105260 | 20 20 20 20 20 7c 20 20 6f 75 74 70 75 74 0a 20 20 20 20 20 20 20 20 20 20 73 74 72 65 61 6d 20 | .....|..output...........stream. |
| 105280 | 6f 66 20 20 7c 20 7c 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 | of..|.|..+---+............V..... |
| 1052a0 | 7c 20 20 73 74 72 65 61 6d 20 6f 66 0a 20 20 20 20 20 20 20 20 20 20 66 72 61 6d 65 73 20 20 20 | |..stream.of...........frames... |
| 1052c0 | 20 20 7c 20 7c 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 7c 20 | ..|.|....^..........+-------+.|. |
| 1052e0 | 20 66 72 61 6d 65 73 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2a | .frames...........-------------* |
| 105300 | 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 7c 20 6d 65 72 67 65 20 2b 2d 2d 2d 2d 2d 2d 2d 2d | ....|..........|.merge.+-------- |
| 105320 | 2d 2d 2d 2d 2d 2d 2d 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ------->......................|. |
| 105340 | 7c 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 7c 0a 20 20 20 20 | |....|..........+-------+.|..... |
| 105360 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 7c 20 20 20 20 7c 20 20 20 20 20 20 20 | .................|.|....|....... |
| 105380 | 20 20 20 20 20 20 20 5e 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......^.....|.................. |
| 1053a0 | 20 20 20 20 7c 20 7c 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 7c 20 20 20 20 20 | ....|.|....|...+---+......|..... |
| 1053c0 | 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 2b 2d 2d 2d 2d 2d 2d | |......................|.+------ |
| 1053e0 | 2d 3e 7c 20 42 20 2b 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | ->|.B.+------+.....|............ |
| 105400 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 | ..........|......|...+---+...... |
| 105420 | 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ......|......................|.. |
| 105440 | 20 20 20 20 7c 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 | ....|.....^..............|...... |
| 105460 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 | ................|......|.....|.. |
| 105480 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............|................... |
| 1054a0 | 20 20 20 7c 20 20 20 20 20 20 2b 2d 2d 2a 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | ...|......+--*--+..............| |
| 1054c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d | ......................+--------- |
| 1054e0 | 7c 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 | |-----------------+............. |
| 105500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | ...................|............ |
| 105520 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 61 74 61 20 62 61 73 65 0a 0a 20 20 20 45 76 | ................data.base.....Ev |
| 105540 | 65 6e 20 66 72 6f 6d 20 74 68 69 73 20 68 69 67 68 2d 6c 65 76 65 6c 20 64 65 73 63 72 69 70 74 | en.from.this.high-level.descript |
| 105560 | 69 6f 6e 2c 20 69 74 20 69 73 20 61 70 70 61 72 65 6e 74 20 74 68 61 74 20 74 68 65 0a 70 72 6f | ion,.it.is.apparent.that.the.pro |
| 105580 | 63 65 73 73 69 6e 67 20 6f 66 20 63 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 20 63 61 6e 20 | cessing.of.compound.queries.can. |
| 1055a0 | 62 65 20 73 6c 6f 77 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 73 69 6e 63 65 20 61 20 71 | be.slow...For.example,.since.a.q |
| 1055c0 | 75 65 72 79 0a 6d 61 79 20 70 72 6f 64 75 63 65 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 6f | uery.may.produce.more.than.one.o |
| 1055e0 | 75 74 70 75 74 20 66 72 61 6d 65 20 66 6f 72 20 65 61 63 68 20 69 6e 70 75 74 20 66 72 61 6d 65 | utput.frame.for.each.input.frame |
| 105600 | 2c 20 61 6e 64 20 65 61 63 68 0a 71 75 65 72 79 20 69 6e 20 61 6e 20 60 61 6e 64 27 20 67 65 74 | ,.and.each.query.in.an.`and'.get |
| 105620 | 73 20 69 74 73 20 69 6e 70 75 74 20 66 72 61 6d 65 73 20 66 72 6f 6d 20 74 68 65 20 70 72 65 76 | s.its.input.frames.from.the.prev |
| 105640 | 69 6f 75 73 20 71 75 65 72 79 2c 20 61 6e 0a 60 61 6e 64 27 20 71 75 65 72 79 20 63 6f 75 6c 64 | ious.query,.an.`and'.query.could |
| 105660 | 2c 20 69 6e 20 74 68 65 20 77 6f 72 73 74 20 63 61 73 65 2c 20 68 61 76 65 20 74 6f 20 70 65 72 | ,.in.the.worst.case,.have.to.per |
| 105680 | 66 6f 72 6d 20 61 20 6e 75 6d 62 65 72 20 6f 66 0a 6d 61 74 63 68 65 73 20 74 68 61 74 20 69 73 | form.a.number.of.matches.that.is |
| 1056a0 | 20 65 78 70 6f 6e 65 6e 74 69 61 6c 20 69 6e 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 71 75 | .exponential.in.the.number.of.qu |
| 1056c0 | 65 72 69 65 73 20 28 73 65 65 20 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 20 34 2d 37 36 3a 3a | eries.(see.*Note.Exercise.4-76:: |
| 1056e0 | 29 2e 28 32 29 20 54 68 6f 75 67 68 20 73 79 73 74 65 6d 73 20 66 6f 72 20 68 61 6e 64 6c 69 6e | ).(2).Though.systems.for.handlin |
| 105700 | 67 20 6f 6e 6c 79 20 73 69 6d 70 6c 65 20 71 75 65 72 69 65 73 0a 61 72 65 20 71 75 69 74 65 20 | g.only.simple.queries.are.quite. |
| 105720 | 70 72 61 63 74 69 63 61 6c 2c 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 63 6f 6d 70 6c 65 78 20 | practical,.dealing.with.complex. |
| 105740 | 71 75 65 72 69 65 73 20 69 73 20 65 78 74 72 65 6d 65 6c 79 0a 64 69 66 66 69 63 75 6c 74 2e 28 | queries.is.extremely.difficult.( |
| 105760 | 33 29 0a 0a 20 20 20 46 72 6f 6d 20 74 68 65 20 73 74 72 65 61 6d 2d 6f 66 2d 66 72 61 6d 65 73 | 3).....From.the.stream-of-frames |
| 105780 | 20 76 69 65 77 70 6f 69 6e 74 2c 20 74 68 65 20 60 6e 6f 74 27 20 6f 66 20 73 6f 6d 65 20 71 75 | .viewpoint,.the.`not'.of.some.qu |
| 1057a0 | 65 72 79 20 61 63 74 73 20 61 73 0a 61 20 66 69 6c 74 65 72 20 74 68 61 74 20 72 65 6d 6f 76 65 | ery.acts.as.a.filter.that.remove |
| 1057c0 | 73 20 61 6c 6c 20 66 72 61 6d 65 73 20 66 6f 72 20 77 68 69 63 68 20 74 68 65 20 71 75 65 72 79 | s.all.frames.for.which.the.query |
| 1057e0 | 20 63 61 6e 20 62 65 20 73 61 74 69 73 66 69 65 64 2e 0a 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c | .can.be.satisfied..For.instance, |
| 105800 | 20 67 69 76 65 6e 20 74 68 65 20 70 61 74 74 65 72 6e 0a 0a 20 20 20 20 20 28 6e 6f 74 20 28 6a | .given.the.pattern.......(not.(j |
| 105820 | 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 29 0a 0a 77 | ob.?x.(computer.programmer)))..w |
| 105840 | 65 20 61 74 74 65 6d 70 74 2c 20 66 6f 72 20 65 61 63 68 20 66 72 61 6d 65 20 69 6e 20 74 68 65 | e.attempt,.for.each.frame.in.the |
| 105860 | 20 69 6e 70 75 74 20 73 74 72 65 61 6d 2c 20 74 6f 20 70 72 6f 64 75 63 65 20 65 78 74 65 6e 73 | .input.stream,.to.produce.extens |
| 105880 | 69 6f 6e 0a 66 72 61 6d 65 73 20 74 68 61 74 20 73 61 74 69 73 66 79 20 60 28 6a 6f 62 20 3f 78 | ion.frames.that.satisfy.`(job.?x |
| 1058a0 | 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 27 2e 20 20 57 65 20 72 65 | .(computer.programmer))'...We.re |
| 1058c0 | 6d 6f 76 65 20 66 72 6f 6d 0a 74 68 65 20 69 6e 70 75 74 20 73 74 72 65 61 6d 20 61 6c 6c 20 66 | move.from.the.input.stream.all.f |
| 1058e0 | 72 61 6d 65 73 20 66 6f 72 20 77 68 69 63 68 20 73 75 63 68 20 65 78 74 65 6e 73 69 6f 6e 73 20 | rames.for.which.such.extensions. |
| 105900 | 65 78 69 73 74 2e 20 20 54 68 65 0a 72 65 73 75 6c 74 20 69 73 20 61 20 73 74 72 65 61 6d 20 63 | exist...The.result.is.a.stream.c |
| 105920 | 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 6f 6e 6c 79 20 74 68 6f 73 65 20 66 72 61 6d 65 73 20 69 | onsisting.of.only.those.frames.i |
| 105940 | 6e 20 77 68 69 63 68 20 74 68 65 20 62 69 6e 64 69 6e 67 0a 66 6f 72 20 60 3f 78 27 20 64 6f 65 | n.which.the.binding.for.`?x'.doe |
| 105960 | 73 20 6e 6f 74 20 73 61 74 69 73 66 79 20 60 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 | s.not.satisfy.`(job.?x.(computer |
| 105980 | 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 27 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 69 6e | .programmer))'...For.example,.in |
| 1059a0 | 20 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20 71 75 65 72 79 0a 0a 20 20 20 20 20 28 61 6e 64 | .processing.the.query.......(and |
| 1059c0 | 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 78 20 3f 79 29 0a 20 20 20 20 20 20 20 20 20 20 28 6e | .(supervisor.?x.?y)...........(n |
| 1059e0 | 6f 74 20 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 | ot.(job.?x.(computer.programmer) |
| 105a00 | 29 29 29 0a 0a 74 68 65 20 66 69 72 73 74 20 63 6c 61 75 73 65 20 77 69 6c 6c 20 67 65 6e 65 72 | )))..the.first.clause.will.gener |
| 105a20 | 61 74 65 20 66 72 61 6d 65 73 20 77 69 74 68 20 62 69 6e 64 69 6e 67 73 20 66 6f 72 20 60 3f 78 | ate.frames.with.bindings.for.`?x |
| 105a40 | 27 20 61 6e 64 20 60 3f 79 27 2e 0a 54 68 65 20 60 6e 6f 74 27 20 63 6c 61 75 73 65 20 77 69 6c | '.and.`?y'..The.`not'.clause.wil |
| 105a60 | 6c 20 74 68 65 6e 20 66 69 6c 74 65 72 20 74 68 65 73 65 20 62 79 20 72 65 6d 6f 76 69 6e 67 20 | l.then.filter.these.by.removing. |
| 105a80 | 61 6c 6c 20 66 72 61 6d 65 73 20 69 6e 20 77 68 69 63 68 0a 74 68 65 20 62 69 6e 64 69 6e 67 20 | all.frames.in.which.the.binding. |
| 105aa0 | 66 6f 72 20 60 3f 78 27 20 73 61 74 69 73 66 69 65 73 20 74 68 65 20 72 65 73 74 72 69 63 74 69 | for.`?x'.satisfies.the.restricti |
| 105ac0 | 6f 6e 20 74 68 61 74 20 60 3f 78 27 20 69 73 20 61 20 63 6f 6d 70 75 74 65 72 0a 70 72 6f 67 72 | on.that.`?x'.is.a.computer.progr |
| 105ae0 | 61 6d 6d 65 72 2e 28 34 29 0a 0a 20 20 20 54 68 65 20 60 6c 69 73 70 2d 76 61 6c 75 65 27 20 73 | ammer.(4).....The.`lisp-value'.s |
| 105b00 | 70 65 63 69 61 6c 20 66 6f 72 6d 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 61 20 | pecial.form.is.implemented.as.a. |
| 105b20 | 73 69 6d 69 6c 61 72 20 66 69 6c 74 65 72 20 6f 6e 0a 66 72 61 6d 65 20 73 74 72 65 61 6d 73 2e | similar.filter.on.frame.streams. |
| 105b40 | 20 20 57 65 20 75 73 65 20 65 61 63 68 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 73 74 72 65 61 | ..We.use.each.frame.in.the.strea |
| 105b60 | 6d 20 74 6f 20 69 6e 73 74 61 6e 74 69 61 74 65 20 61 6e 79 0a 76 61 72 69 61 62 6c 65 73 20 69 | m.to.instantiate.any.variables.i |
| 105b80 | 6e 20 74 68 65 20 70 61 74 74 65 72 6e 2c 20 74 68 65 6e 20 61 70 70 6c 79 20 74 68 65 20 4c 69 | n.the.pattern,.then.apply.the.Li |
| 105ba0 | 73 70 20 70 72 65 64 69 63 61 74 65 2e 20 20 57 65 20 72 65 6d 6f 76 65 0a 66 72 6f 6d 20 74 68 | sp.predicate...We.remove.from.th |
| 105bc0 | 65 20 69 6e 70 75 74 20 73 74 72 65 61 6d 20 61 6c 6c 20 66 72 61 6d 65 73 20 66 6f 72 20 77 68 | e.input.stream.all.frames.for.wh |
| 105be0 | 69 63 68 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 66 61 69 6c 73 2e 0a 0a 55 6e 69 66 69 63 | ich.the.predicate.fails...Unific |
| 105c00 | 61 74 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 6f 72 64 65 72 20 74 6f 20 68 | ation..............In.order.to.h |
| 105c20 | 61 6e 64 6c 65 20 72 75 6c 65 73 20 69 6e 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 | andle.rules.in.the.query.languag |
| 105c40 | 65 2c 20 77 65 20 6d 75 73 74 20 62 65 20 61 62 6c 65 20 74 6f 20 66 69 6e 64 0a 74 68 65 20 72 | e,.we.must.be.able.to.find.the.r |
| 105c60 | 75 6c 65 73 20 77 68 6f 73 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 73 20 6d 61 74 63 68 20 61 20 67 | ules.whose.conclusions.match.a.g |
| 105c80 | 69 76 65 6e 20 71 75 65 72 79 20 70 61 74 74 65 72 6e 2e 20 20 52 75 6c 65 0a 63 6f 6e 63 6c 75 | iven.query.pattern...Rule.conclu |
| 105ca0 | 73 69 6f 6e 73 20 61 72 65 20 6c 69 6b 65 20 61 73 73 65 72 74 69 6f 6e 73 20 65 78 63 65 70 74 | sions.are.like.assertions.except |
| 105cc0 | 20 74 68 61 74 20 74 68 65 79 20 63 61 6e 20 63 6f 6e 74 61 69 6e 20 76 61 72 69 61 62 6c 65 73 | .that.they.can.contain.variables |
| 105ce0 | 2c 0a 73 6f 20 77 65 20 77 69 6c 6c 20 6e 65 65 64 20 61 20 67 65 6e 65 72 61 6c 69 7a 61 74 69 | ,.so.we.will.need.a.generalizati |
| 105d00 | 6f 6e 20 6f 66 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 69 6e 67 2d 2d 63 61 6c 6c 65 64 20 22 | on.of.pattern.matching--called." |
| 105d20 | 75 6e 69 66 69 63 61 74 69 6f 6e 22 2d 2d 69 6e 0a 77 68 69 63 68 20 62 6f 74 68 20 74 68 65 20 | unification"--in.which.both.the. |
| 105d40 | 22 70 61 74 74 65 72 6e 22 20 61 6e 64 20 74 68 65 20 22 64 61 74 75 6d 22 20 6d 61 79 20 63 6f | "pattern".and.the."datum".may.co |
| 105d60 | 6e 74 61 69 6e 20 76 61 72 69 61 62 6c 65 73 2e 0a 0a 20 20 20 41 20 75 6e 69 66 69 65 72 20 74 | ntain.variables......A.unifier.t |
| 105d80 | 61 6b 65 73 20 74 77 6f 20 70 61 74 74 65 72 6e 73 2c 20 65 61 63 68 20 63 6f 6e 74 61 69 6e 69 | akes.two.patterns,.each.containi |
| 105da0 | 6e 67 20 63 6f 6e 73 74 61 6e 74 73 20 61 6e 64 0a 76 61 72 69 61 62 6c 65 73 2c 20 61 6e 64 20 | ng.constants.and.variables,.and. |
| 105dc0 | 64 65 74 65 72 6d 69 6e 65 73 20 77 68 65 74 68 65 72 20 69 74 20 69 73 20 70 6f 73 73 69 62 6c | determines.whether.it.is.possibl |
| 105de0 | 65 20 74 6f 20 61 73 73 69 67 6e 20 76 61 6c 75 65 73 20 74 6f 0a 74 68 65 20 76 61 72 69 61 62 | e.to.assign.values.to.the.variab |
| 105e00 | 6c 65 73 20 74 68 61 74 20 77 69 6c 6c 20 6d 61 6b 65 20 74 68 65 20 74 77 6f 20 70 61 74 74 65 | les.that.will.make.the.two.patte |
| 105e20 | 72 6e 73 20 65 71 75 61 6c 2e 20 20 49 66 20 73 6f 2c 20 69 74 20 72 65 74 75 72 6e 73 0a 61 20 | rns.equal...If.so,.it.returns.a. |
| 105e40 | 66 72 61 6d 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 73 65 20 62 69 6e 64 69 6e 67 73 2e | frame.containing.these.bindings. |
| 105e60 | 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 75 6e 69 66 79 69 6e 67 20 60 28 3f 78 20 61 20 3f | ..For.example,.unifying.`(?x.a.? |
| 105e80 | 79 29 27 0a 61 6e 64 20 60 28 3f 79 20 3f 7a 20 61 29 27 20 77 69 6c 6c 20 73 70 65 63 69 66 79 | y)'.and.`(?y.?z.a)'.will.specify |
| 105ea0 | 20 61 20 66 72 61 6d 65 20 69 6e 20 77 68 69 63 68 20 60 3f 78 27 2c 20 60 3f 79 27 2c 20 61 6e | .a.frame.in.which.`?x',.`?y',.an |
| 105ec0 | 64 20 60 3f 7a 27 20 6d 75 73 74 0a 61 6c 6c 20 62 65 20 62 6f 75 6e 64 20 74 6f 20 60 61 27 2e | d.`?z'.must.all.be.bound.to.`a'. |
| 105ee0 | 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 75 6e 69 66 79 69 6e 67 20 60 28 | ..On.the.other.hand,.unifying.`( |
| 105f00 | 3f 78 20 3f 79 20 61 29 27 20 61 6e 64 20 60 28 3f 78 0a 62 20 3f 79 29 27 20 77 69 6c 6c 20 66 | ?x.?y.a)'.and.`(?x.b.?y)'.will.f |
| 105f20 | 61 69 6c 2c 20 62 65 63 61 75 73 65 20 74 68 65 72 65 20 69 73 20 6e 6f 20 76 61 6c 75 65 20 66 | ail,.because.there.is.no.value.f |
| 105f40 | 6f 72 20 60 3f 79 27 20 74 68 61 74 20 63 61 6e 20 6d 61 6b 65 20 74 68 65 0a 74 77 6f 20 70 61 | or.`?y'.that.can.make.the.two.pa |
| 105f60 | 74 74 65 72 6e 73 20 65 71 75 61 6c 2e 20 20 28 46 6f 72 20 74 68 65 20 73 65 63 6f 6e 64 20 65 | tterns.equal...(For.the.second.e |
| 105f80 | 6c 65 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 70 61 74 74 65 72 6e 73 20 74 6f 20 62 65 0a 65 71 | lements.of.the.patterns.to.be.eq |
| 105fa0 | 75 61 6c 2c 20 60 3f 79 27 20 77 6f 75 6c 64 20 68 61 76 65 20 74 6f 20 62 65 20 60 62 27 3b 20 | ual,.`?y'.would.have.to.be.`b';. |
| 105fc0 | 68 6f 77 65 76 65 72 2c 20 66 6f 72 20 74 68 65 20 74 68 69 72 64 20 65 6c 65 6d 65 6e 74 73 20 | however,.for.the.third.elements. |
| 105fe0 | 74 6f 20 62 65 0a 65 71 75 61 6c 2c 20 60 3f 79 27 20 77 6f 75 6c 64 20 68 61 76 65 20 74 6f 20 | to.be.equal,.`?y'.would.have.to. |
| 106000 | 62 65 20 60 61 27 2e 29 20 20 54 68 65 20 75 6e 69 66 69 65 72 20 75 73 65 64 20 69 6e 20 74 68 | be.`a'.)..The.unifier.used.in.th |
| 106020 | 65 20 71 75 65 72 79 0a 73 79 73 74 65 6d 2c 20 6c 69 6b 65 20 74 68 65 20 70 61 74 74 65 72 6e | e.query.system,.like.the.pattern |
| 106040 | 20 6d 61 74 63 68 65 72 2c 20 74 61 6b 65 73 20 61 20 66 72 61 6d 65 20 61 73 20 69 6e 70 75 74 | .matcher,.takes.a.frame.as.input |
| 106060 | 20 61 6e 64 20 70 65 72 66 6f 72 6d 73 0a 75 6e 69 66 69 63 61 74 69 6f 6e 73 20 74 68 61 74 20 | .and.performs.unifications.that. |
| 106080 | 61 72 65 20 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 74 68 69 73 20 66 72 61 6d 65 2e 0a | are.consistent.with.this.frame.. |
| 1060a0 | 0a 20 20 20 54 68 65 20 75 6e 69 66 69 63 61 74 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 20 69 73 | ....The.unification.algorithm.is |
| 1060c0 | 20 74 68 65 20 6d 6f 73 74 20 74 65 63 68 6e 69 63 61 6c 6c 79 20 64 69 66 66 69 63 75 6c 74 20 | .the.most.technically.difficult. |
| 1060e0 | 70 61 72 74 20 6f 66 0a 74 68 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 2e 20 20 57 69 74 68 20 | part.of.the.query.system...With. |
| 106100 | 63 6f 6d 70 6c 65 78 20 70 61 74 74 65 72 6e 73 2c 20 70 65 72 66 6f 72 6d 69 6e 67 20 75 6e 69 | complex.patterns,.performing.uni |
| 106120 | 66 69 63 61 74 69 6f 6e 20 6d 61 79 0a 73 65 65 6d 20 74 6f 20 72 65 71 75 69 72 65 20 64 65 64 | fication.may.seem.to.require.ded |
| 106140 | 75 63 74 69 6f 6e 2e 20 20 54 6f 20 75 6e 69 66 79 20 60 28 3f 78 20 3f 78 29 27 20 61 6e 64 20 | uction...To.unify.`(?x.?x)'.and. |
| 106160 | 60 28 28 61 20 3f 79 20 63 29 20 28 61 20 62 0a 3f 7a 29 29 27 2c 20 66 6f 72 20 65 78 61 6d 70 | `((a.?y.c).(a.b.?z))',.for.examp |
| 106180 | 6c 65 2c 20 74 68 65 20 61 6c 67 6f 72 69 74 68 6d 20 6d 75 73 74 20 69 6e 66 65 72 20 74 68 61 | le,.the.algorithm.must.infer.tha |
| 1061a0 | 74 20 60 3f 78 27 20 73 68 6f 75 6c 64 20 62 65 20 60 28 61 20 62 0a 63 29 27 2c 20 60 3f 79 27 | t.`?x'.should.be.`(a.b.c)',.`?y' |
| 1061c0 | 20 73 68 6f 75 6c 64 20 62 65 20 60 62 27 2c 20 61 6e 64 20 60 3f 7a 27 20 73 68 6f 75 6c 64 20 | .should.be.`b',.and.`?z'.should. |
| 1061e0 | 62 65 20 60 63 27 2e 20 20 57 65 20 6d 61 79 20 74 68 69 6e 6b 20 6f 66 20 74 68 69 73 0a 70 72 | be.`c'...We.may.think.of.this.pr |
| 106200 | 6f 63 65 73 73 20 61 73 20 73 6f 6c 76 69 6e 67 20 61 20 73 65 74 20 6f 66 20 65 71 75 61 74 69 | ocess.as.solving.a.set.of.equati |
| 106220 | 6f 6e 73 20 61 6d 6f 6e 67 20 74 68 65 20 70 61 74 74 65 72 6e 20 63 6f 6d 70 6f 6e 65 6e 74 73 | ons.among.the.pattern.components |
| 106240 | 2e 20 20 49 6e 0a 67 65 6e 65 72 61 6c 2c 20 74 68 65 73 65 20 61 72 65 20 73 69 6d 75 6c 74 61 | ...In.general,.these.are.simulta |
| 106260 | 6e 65 6f 75 73 20 65 71 75 61 74 69 6f 6e 73 2c 20 77 68 69 63 68 20 6d 61 79 20 72 65 71 75 69 | neous.equations,.which.may.requi |
| 106280 | 72 65 20 73 75 62 73 74 61 6e 74 69 61 6c 0a 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 74 6f 20 73 | re.substantial.manipulation.to.s |
| 1062a0 | 6f 6c 76 65 2e 28 35 29 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 75 6e 69 66 79 69 6e 67 20 60 | olve.(5).For.example,.unifying.` |
| 1062c0 | 28 3f 78 20 3f 78 29 27 20 61 6e 64 20 60 28 28 61 20 3f 79 0a 63 29 20 28 61 20 62 20 3f 7a 29 | (?x.?x)'.and.`((a.?y.c).(a.b.?z) |
| 1062e0 | 29 27 20 6d 61 79 20 62 65 20 74 68 6f 75 67 68 74 20 6f 66 20 61 73 20 73 70 65 63 69 66 79 69 | )'.may.be.thought.of.as.specifyi |
| 106300 | 6e 67 20 74 68 65 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 20 65 71 75 61 74 69 6f 6e 73 0a 0a 20 | ng.the.simultaneous.equations... |
| 106320 | 20 20 20 20 3f 78 20 20 3d 20 20 28 61 20 3f 79 20 63 29 0a 20 20 20 20 20 3f 78 20 20 3d 20 20 | ....?x..=..(a.?y.c)......?x..=.. |
| 106340 | 28 61 20 62 20 3f 7a 29 0a 0a 20 20 20 54 68 65 73 65 20 65 71 75 61 74 69 6f 6e 73 20 69 6d 70 | (a.b.?z).....These.equations.imp |
| 106360 | 6c 79 20 74 68 61 74 0a 0a 20 20 20 20 20 28 61 20 3f 79 20 63 29 20 20 3d 20 20 28 61 20 62 20 | ly.that.......(a.?y.c)..=..(a.b. |
| 106380 | 3f 7a 29 0a 0a 77 68 69 63 68 20 69 6e 20 74 75 72 6e 20 69 6d 70 6c 69 65 73 20 74 68 61 74 0a | ?z)..which.in.turn.implies.that. |
| 1063a0 | 0a 20 20 20 20 20 61 20 20 3d 20 20 61 2c 20 3f 79 20 20 3d 20 20 62 2c 20 63 20 20 3d 20 20 3f | ......a..=..a,.?y..=..b,.c..=..? |
| 1063c0 | 7a 2c 0a 0a 61 6e 64 20 68 65 6e 63 65 20 74 68 61 74 0a 0a 20 20 20 20 20 3f 78 20 20 3d 20 20 | z,..and.hence.that.......?x..=.. |
| 1063e0 | 28 61 20 62 20 63 29 0a 0a 20 20 20 49 6e 20 61 20 73 75 63 63 65 73 73 66 75 6c 20 70 61 74 74 | (a.b.c).....In.a.successful.patt |
| 106400 | 65 72 6e 20 6d 61 74 63 68 2c 20 61 6c 6c 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 | ern.match,.all.pattern.variables |
| 106420 | 20 62 65 63 6f 6d 65 20 62 6f 75 6e 64 2c 0a 61 6e 64 20 74 68 65 20 76 61 6c 75 65 73 20 74 6f | .become.bound,.and.the.values.to |
| 106440 | 20 77 68 69 63 68 20 74 68 65 79 20 61 72 65 20 62 6f 75 6e 64 20 63 6f 6e 74 61 69 6e 20 6f 6e | .which.they.are.bound.contain.on |
| 106460 | 6c 79 20 63 6f 6e 73 74 61 6e 74 73 2e 20 20 54 68 69 73 20 69 73 0a 61 6c 73 6f 20 74 72 75 65 | ly.constants...This.is.also.true |
| 106480 | 20 6f 66 20 61 6c 6c 20 74 68 65 20 65 78 61 6d 70 6c 65 73 20 6f 66 20 75 6e 69 66 69 63 61 74 | .of.all.the.examples.of.unificat |
| 1064a0 | 69 6f 6e 20 77 65 20 68 61 76 65 20 73 65 65 6e 20 73 6f 20 66 61 72 2e 20 20 49 6e 0a 67 65 6e | ion.we.have.seen.so.far...In.gen |
| 1064c0 | 65 72 61 6c 2c 20 68 6f 77 65 76 65 72 2c 20 61 20 73 75 63 63 65 73 73 66 75 6c 20 75 6e 69 66 | eral,.however,.a.successful.unif |
| 1064e0 | 69 63 61 74 69 6f 6e 20 6d 61 79 20 6e 6f 74 20 63 6f 6d 70 6c 65 74 65 6c 79 20 64 65 74 65 72 | ication.may.not.completely.deter |
| 106500 | 6d 69 6e 65 0a 74 68 65 20 76 61 72 69 61 62 6c 65 20 76 61 6c 75 65 73 3b 20 73 6f 6d 65 20 76 | mine.the.variable.values;.some.v |
| 106520 | 61 72 69 61 62 6c 65 73 20 6d 61 79 20 72 65 6d 61 69 6e 20 75 6e 62 6f 75 6e 64 20 61 6e 64 20 | ariables.may.remain.unbound.and. |
| 106540 | 6f 74 68 65 72 73 20 6d 61 79 0a 62 65 20 62 6f 75 6e 64 20 74 6f 20 76 61 6c 75 65 73 20 74 68 | others.may.be.bound.to.values.th |
| 106560 | 61 74 20 63 6f 6e 74 61 69 6e 20 76 61 72 69 61 62 6c 65 73 2e 0a 0a 20 20 20 43 6f 6e 73 69 64 | at.contain.variables......Consid |
| 106580 | 65 72 20 74 68 65 20 75 6e 69 66 69 63 61 74 69 6f 6e 20 6f 66 20 60 28 3f 78 20 61 29 27 20 61 | er.the.unification.of.`(?x.a)'.a |
| 1065a0 | 6e 64 20 60 28 28 62 20 3f 79 29 20 3f 7a 29 27 2e 20 20 57 65 20 63 61 6e 0a 64 65 64 75 63 65 | nd.`((b.?y).?z)'...We.can.deduce |
| 1065c0 | 20 74 68 61 74 20 60 3f 78 20 3d 20 28 62 20 3f 79 29 27 20 61 6e 64 20 60 61 20 3d 20 3f 7a 27 | .that.`?x.=.(b.?y)'.and.`a.=.?z' |
| 1065e0 | 2c 20 62 75 74 20 77 65 20 63 61 6e 6e 6f 74 20 66 75 72 74 68 65 72 20 73 6f 6c 76 65 20 66 6f | ,.but.we.cannot.further.solve.fo |
| 106600 | 72 0a 60 3f 78 27 20 6f 72 20 60 3f 79 27 2e 20 20 54 68 65 20 75 6e 69 66 69 63 61 74 69 6f 6e | r.`?x'.or.`?y'...The.unification |
| 106620 | 20 64 6f 65 73 6e 27 74 20 66 61 69 6c 2c 20 73 69 6e 63 65 20 69 74 20 69 73 20 63 65 72 74 61 | .doesn't.fail,.since.it.is.certa |
| 106640 | 69 6e 6c 79 0a 70 6f 73 73 69 62 6c 65 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 74 77 6f 20 70 61 | inly.possible.to.make.the.two.pa |
| 106660 | 74 74 65 72 6e 73 20 65 71 75 61 6c 20 62 79 20 61 73 73 69 67 6e 69 6e 67 20 76 61 6c 75 65 73 | tterns.equal.by.assigning.values |
| 106680 | 20 74 6f 20 60 3f 78 27 20 61 6e 64 0a 60 3f 79 27 2e 20 20 53 69 6e 63 65 20 74 68 69 73 20 6d | .to.`?x'.and.`?y'...Since.this.m |
| 1066a0 | 61 74 63 68 20 69 6e 20 6e 6f 20 77 61 79 20 72 65 73 74 72 69 63 74 73 20 74 68 65 20 76 61 6c | atch.in.no.way.restricts.the.val |
| 1066c0 | 75 65 73 20 60 3f 79 27 20 63 61 6e 20 74 61 6b 65 0a 6f 6e 2c 20 6e 6f 20 62 69 6e 64 69 6e 67 | ues.`?y'.can.take.on,.no.binding |
| 1066e0 | 20 66 6f 72 20 60 3f 79 27 20 69 73 20 70 75 74 20 69 6e 74 6f 20 74 68 65 20 72 65 73 75 6c 74 | .for.`?y'.is.put.into.the.result |
| 106700 | 20 66 72 61 6d 65 2e 20 20 54 68 65 20 6d 61 74 63 68 20 64 6f 65 73 2c 0a 68 6f 77 65 76 65 72 | .frame...The.match.does,.however |
| 106720 | 2c 20 72 65 73 74 72 69 63 74 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 3f 78 27 2e 20 20 57 | ,.restrict.the.value.of.`?x'...W |
| 106740 | 68 61 74 65 76 65 72 20 76 61 6c 75 65 20 60 3f 79 27 20 68 61 73 2c 20 60 3f 78 27 0a 6d 75 73 | hatever.value.`?y'.has,.`?x'.mus |
| 106760 | 74 20 62 65 20 60 28 62 20 3f 79 29 27 2e 20 20 41 20 62 69 6e 64 69 6e 67 20 6f 66 20 60 3f 78 | t.be.`(b.?y)'...A.binding.of.`?x |
| 106780 | 27 20 74 6f 20 74 68 65 20 70 61 74 74 65 72 6e 20 60 28 62 20 3f 79 29 27 20 69 73 20 74 68 75 | '.to.the.pattern.`(b.?y)'.is.thu |
| 1067a0 | 73 0a 70 75 74 20 69 6e 74 6f 20 74 68 65 20 66 72 61 6d 65 2e 20 20 49 66 20 61 20 76 61 6c 75 | s.put.into.the.frame...If.a.valu |
| 1067c0 | 65 20 66 6f 72 20 60 3f 79 27 20 69 73 20 6c 61 74 65 72 20 64 65 74 65 72 6d 69 6e 65 64 20 61 | e.for.`?y'.is.later.determined.a |
| 1067e0 | 6e 64 20 61 64 64 65 64 0a 74 6f 20 74 68 65 20 66 72 61 6d 65 20 28 62 79 20 61 20 70 61 74 74 | nd.added.to.the.frame.(by.a.patt |
| 106800 | 65 72 6e 20 6d 61 74 63 68 20 6f 72 20 75 6e 69 66 69 63 61 74 69 6f 6e 20 74 68 61 74 20 69 73 | ern.match.or.unification.that.is |
| 106820 | 20 72 65 71 75 69 72 65 64 20 74 6f 20 62 65 0a 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 | .required.to.be.consistent.with. |
| 106840 | 74 68 69 73 20 66 72 61 6d 65 29 2c 20 74 68 65 20 70 72 65 76 69 6f 75 73 6c 79 20 62 6f 75 6e | this.frame),.the.previously.boun |
| 106860 | 64 20 60 3f 78 27 20 77 69 6c 6c 20 72 65 66 65 72 20 74 6f 0a 74 68 69 73 20 76 61 6c 75 65 2e | d.`?x'.will.refer.to.this.value. |
| 106880 | 28 36 29 0a 0a 41 70 70 6c 79 69 6e 67 20 72 75 6c 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | (6)..Applying.rules............. |
| 1068a0 | 2e 2e 0a 0a 55 6e 69 66 69 63 61 74 69 6f 6e 20 69 73 20 74 68 65 20 6b 65 79 20 74 6f 20 74 68 | ....Unification.is.the.key.to.th |
| 1068c0 | 65 20 63 6f 6d 70 6f 6e 65 6e 74 20 6f 66 20 74 68 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 20 | e.component.of.the.query.system. |
| 1068e0 | 74 68 61 74 20 6d 61 6b 65 73 0a 69 6e 66 65 72 65 6e 63 65 73 20 66 72 6f 6d 20 72 75 6c 65 73 | that.makes.inferences.from.rules |
| 106900 | 2e 20 54 6f 20 73 65 65 20 68 6f 77 20 74 68 69 73 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 | ..To.see.how.this.is.accomplishe |
| 106920 | 64 2c 20 63 6f 6e 73 69 64 65 72 0a 70 72 6f 63 65 73 73 69 6e 67 20 61 20 71 75 65 72 79 20 74 | d,.consider.processing.a.query.t |
| 106940 | 68 61 74 20 69 6e 76 6f 6c 76 65 73 20 61 70 70 6c 79 69 6e 67 20 61 20 72 75 6c 65 2c 20 73 75 | hat.involves.applying.a.rule,.su |
| 106960 | 63 68 20 61 73 0a 0a 20 20 20 20 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 3f 78 20 28 48 61 63 6b | ch.as.......(lives-near.?x.(Hack |
| 106980 | 65 72 20 41 6c 79 73 73 61 20 50 29 29 0a 0a 20 20 20 54 6f 20 70 72 6f 63 65 73 73 20 74 68 69 | er.Alyssa.P)).....To.process.thi |
| 1069a0 | 73 20 71 75 65 72 79 2c 20 77 65 20 66 69 72 73 74 20 75 73 65 20 74 68 65 20 6f 72 64 69 6e 61 | s.query,.we.first.use.the.ordina |
| 1069c0 | 72 79 20 70 61 74 74 65 72 6e 2d 6d 61 74 63 68 0a 70 72 6f 63 65 64 75 72 65 20 64 65 73 63 72 | ry.pattern-match.procedure.descr |
| 1069e0 | 69 62 65 64 20 61 62 6f 76 65 20 74 6f 20 73 65 65 20 69 66 20 74 68 65 72 65 20 61 72 65 20 61 | ibed.above.to.see.if.there.are.a |
| 106a00 | 6e 79 20 61 73 73 65 72 74 69 6f 6e 73 20 69 6e 20 74 68 65 0a 64 61 74 61 20 62 61 73 65 20 74 | ny.assertions.in.the.data.base.t |
| 106a20 | 68 61 74 20 6d 61 74 63 68 20 74 68 69 73 20 70 61 74 74 65 72 6e 2e 20 20 28 54 68 65 72 65 20 | hat.match.this.pattern...(There. |
| 106a40 | 77 69 6c 6c 20 6e 6f 74 20 62 65 20 61 6e 79 20 69 6e 20 74 68 69 73 0a 63 61 73 65 2c 20 73 69 | will.not.be.any.in.this.case,.si |
| 106a60 | 6e 63 65 20 6f 75 72 20 64 61 74 61 20 62 61 73 65 20 69 6e 63 6c 75 64 65 73 20 6e 6f 20 64 69 | nce.our.data.base.includes.no.di |
| 106a80 | 72 65 63 74 20 61 73 73 65 72 74 69 6f 6e 73 20 61 62 6f 75 74 20 77 68 6f 20 6c 69 76 65 73 0a | rect.assertions.about.who.lives. |
| 106aa0 | 6e 65 61 72 20 77 68 6f 6d 2e 29 20 20 54 68 65 20 6e 65 78 74 20 73 74 65 70 20 69 73 20 74 6f | near.whom.)..The.next.step.is.to |
| 106ac0 | 20 61 74 74 65 6d 70 74 20 74 6f 20 75 6e 69 66 79 20 74 68 65 20 71 75 65 72 79 20 70 61 74 74 | .attempt.to.unify.the.query.patt |
| 106ae0 | 65 72 6e 0a 77 69 74 68 20 74 68 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 20 6f 66 20 65 61 63 68 20 | ern.with.the.conclusion.of.each. |
| 106b00 | 72 75 6c 65 2e 20 20 57 65 20 66 69 6e 64 20 74 68 61 74 20 74 68 65 20 70 61 74 74 65 72 6e 20 | rule...We.find.that.the.pattern. |
| 106b20 | 75 6e 69 66 69 65 73 0a 77 69 74 68 20 74 68 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 20 6f 66 20 74 | unifies.with.the.conclusion.of.t |
| 106b40 | 68 65 20 72 75 6c 65 0a 0a 20 20 20 20 20 28 72 75 6c 65 20 28 6c 69 76 65 73 2d 6e 65 61 72 20 | he.rule.......(rule.(lives-near. |
| 106b60 | 3f 70 65 72 73 6f 6e 2d 31 20 3f 70 65 72 73 6f 6e 2d 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ?person-1.?person-2)............ |
| 106b80 | 28 61 6e 64 20 28 61 64 64 72 65 73 73 20 3f 70 65 72 73 6f 6e 2d 31 20 28 3f 74 6f 77 6e 20 2e | (and.(address.?person-1.(?town.. |
| 106ba0 | 20 3f 72 65 73 74 2d 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 64 72 | .?rest-1)).................(addr |
| 106bc0 | 65 73 73 20 3f 70 65 72 73 6f 6e 2d 32 20 28 3f 74 6f 77 6e 20 2e 20 3f 72 65 73 74 2d 32 29 29 | ess.?person-2.(?town...?rest-2)) |
| 106be0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 6f 74 20 28 73 61 6d 65 20 3f 70 65 72 | .................(not.(same.?per |
| 106c00 | 73 6f 6e 2d 31 20 3f 70 65 72 73 6f 6e 2d 32 29 29 29 29 0a 0a 72 65 73 75 6c 74 69 6e 67 20 69 | son-1.?person-2))))..resulting.i |
| 106c20 | 6e 20 61 20 66 72 61 6d 65 20 73 70 65 63 69 66 79 69 6e 67 20 74 68 61 74 20 60 3f 70 65 72 73 | n.a.frame.specifying.that.`?pers |
| 106c40 | 6f 6e 2d 32 27 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 60 28 48 61 63 6b 65 72 0a 41 6c 79 73 73 | on-2'.is.bound.to.`(Hacker.Alyss |
| 106c60 | 61 20 50 29 27 20 61 6e 64 20 74 68 61 74 20 60 3f 78 27 20 73 68 6f 75 6c 64 20 62 65 20 62 6f | a.P)'.and.that.`?x'.should.be.bo |
| 106c80 | 75 6e 64 20 74 6f 20 28 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 76 61 6c 75 65 20 61 73 29 0a | und.to.(have.the.same.value.as). |
| 106ca0 | 60 3f 70 65 72 73 6f 6e 2d 31 27 2e 20 20 4e 6f 77 2c 20 72 65 6c 61 74 69 76 65 20 74 6f 20 74 | `?person-1'...Now,.relative.to.t |
| 106cc0 | 68 69 73 20 66 72 61 6d 65 2c 20 77 65 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 63 6f 6d 70 6f | his.frame,.we.evaluate.the.compo |
| 106ce0 | 75 6e 64 0a 71 75 65 72 79 20 67 69 76 65 6e 20 62 79 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 | und.query.given.by.the.body.of.t |
| 106d00 | 68 65 20 72 75 6c 65 2e 20 20 53 75 63 63 65 73 73 66 75 6c 20 6d 61 74 63 68 65 73 20 77 69 6c | he.rule...Successful.matches.wil |
| 106d20 | 6c 20 65 78 74 65 6e 64 0a 74 68 69 73 20 66 72 61 6d 65 20 62 79 20 70 72 6f 76 69 64 69 6e 67 | l.extend.this.frame.by.providing |
| 106d40 | 20 61 20 62 69 6e 64 69 6e 67 20 66 6f 72 20 60 3f 70 65 72 73 6f 6e 2d 31 27 2c 20 61 6e 64 20 | .a.binding.for.`?person-1',.and. |
| 106d60 | 63 6f 6e 73 65 71 75 65 6e 74 6c 79 20 61 0a 76 61 6c 75 65 20 66 6f 72 20 60 3f 78 27 2c 20 77 | consequently.a.value.for.`?x',.w |
| 106d80 | 68 69 63 68 20 77 65 20 63 61 6e 20 75 73 65 20 74 6f 20 69 6e 73 74 61 6e 74 69 61 74 65 20 74 | hich.we.can.use.to.instantiate.t |
| 106da0 | 68 65 20 6f 72 69 67 69 6e 61 6c 20 71 75 65 72 79 0a 70 61 74 74 65 72 6e 2e 0a 0a 20 20 20 49 | he.original.query.pattern......I |
| 106dc0 | 6e 20 67 65 6e 65 72 61 6c 2c 20 74 68 65 20 71 75 65 72 79 20 65 76 61 6c 75 61 74 6f 72 20 75 | n.general,.the.query.evaluator.u |
| 106de0 | 73 65 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d 65 74 68 6f 64 20 74 6f 20 61 70 70 6c | ses.the.following.method.to.appl |
| 106e00 | 79 20 61 0a 72 75 6c 65 20 77 68 65 6e 20 74 72 79 69 6e 67 20 74 6f 20 65 73 74 61 62 6c 69 73 | y.a.rule.when.trying.to.establis |
| 106e20 | 68 20 61 20 71 75 65 72 79 20 70 61 74 74 65 72 6e 20 69 6e 20 61 20 66 72 61 6d 65 20 74 68 61 | h.a.query.pattern.in.a.frame.tha |
| 106e40 | 74 20 73 70 65 63 69 66 69 65 73 0a 62 69 6e 64 69 6e 67 73 20 66 6f 72 20 73 6f 6d 65 20 6f 66 | t.specifies.bindings.for.some.of |
| 106e60 | 20 74 68 65 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 3a 0a 0a 20 20 20 2a 20 55 6e | .the.pattern.variables:.....*.Un |
| 106e80 | 69 66 79 20 74 68 65 20 71 75 65 72 79 20 77 69 74 68 20 74 68 65 20 63 6f 6e 63 6c 75 73 69 6f | ify.the.query.with.the.conclusio |
| 106ea0 | 6e 20 6f 66 20 74 68 65 20 72 75 6c 65 20 74 6f 20 66 6f 72 6d 2c 20 69 66 0a 20 20 20 20 20 73 | n.of.the.rule.to.form,.if......s |
| 106ec0 | 75 63 63 65 73 73 66 75 6c 2c 20 61 6e 20 65 78 74 65 6e 73 69 6f 6e 20 6f 66 20 74 68 65 20 6f | uccessful,.an.extension.of.the.o |
| 106ee0 | 72 69 67 69 6e 61 6c 20 66 72 61 6d 65 2e 0a 0a 20 20 20 2a 20 52 65 6c 61 74 69 76 65 20 74 6f | riginal.frame......*.Relative.to |
| 106f00 | 20 74 68 65 20 65 78 74 65 6e 64 65 64 20 66 72 61 6d 65 2c 20 65 76 61 6c 75 61 74 65 20 74 68 | .the.extended.frame,.evaluate.th |
| 106f20 | 65 20 71 75 65 72 79 20 66 6f 72 6d 65 64 20 62 79 20 74 68 65 0a 20 20 20 20 20 62 6f 64 79 20 | e.query.formed.by.the......body. |
| 106f40 | 6f 66 20 74 68 65 20 72 75 6c 65 2e 0a 0a 0a 20 20 20 4e 6f 74 69 63 65 20 68 6f 77 20 73 69 6d | of.the.rule.......Notice.how.sim |
| 106f60 | 69 6c 61 72 20 74 68 69 73 20 69 73 20 74 6f 20 74 68 65 20 6d 65 74 68 6f 64 20 66 6f 72 20 61 | ilar.this.is.to.the.method.for.a |
| 106f80 | 70 70 6c 79 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 20 69 6e 0a 74 68 65 20 60 65 76 61 6c | pplying.a.procedure.in.the.`eval |
| 106fa0 | 27 2f 60 61 70 70 6c 79 27 20 65 76 61 6c 75 61 74 6f 72 20 66 6f 72 20 4c 69 73 70 3a 0a 0a 20 | '/`apply'.evaluator.for.Lisp:... |
| 106fc0 | 20 20 2a 20 42 69 6e 64 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 27 73 20 70 61 72 61 6d 65 74 | ..*.Bind.the.procedure's.paramet |
| 106fe0 | 65 72 73 20 74 6f 20 69 74 73 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 66 6f 72 6d 20 61 20 66 | ers.to.its.arguments.to.form.a.f |
| 107000 | 72 61 6d 65 0a 20 20 20 20 20 74 68 61 74 20 65 78 74 65 6e 64 73 20 74 68 65 20 6f 72 69 67 69 | rame......that.extends.the.origi |
| 107020 | 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 20 20 20 2a | nal.procedure.environment......* |
| 107040 | 20 52 65 6c 61 74 69 76 65 20 74 6f 20 74 68 65 20 65 78 74 65 6e 64 65 64 20 65 6e 76 69 72 6f | .Relative.to.the.extended.enviro |
| 107060 | 6e 6d 65 6e 74 2c 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 20 | nment,.evaluate.the.expression.. |
| 107080 | 20 20 20 20 66 6f 72 6d 65 64 20 62 79 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 20 70 72 | ....formed.by.the.body.of.the.pr |
| 1070a0 | 6f 63 65 64 75 72 65 2e 0a 0a 0a 20 20 20 54 68 65 20 73 69 6d 69 6c 61 72 69 74 79 20 62 65 74 | ocedure.......The.similarity.bet |
| 1070c0 | 77 65 65 6e 20 74 68 65 20 74 77 6f 20 65 76 61 6c 75 61 74 6f 72 73 20 73 68 6f 75 6c 64 20 63 | ween.the.two.evaluators.should.c |
| 1070e0 | 6f 6d 65 20 61 73 20 6e 6f 0a 73 75 72 70 72 69 73 65 2e 20 20 4a 75 73 74 20 61 73 20 70 72 6f | ome.as.no.surprise...Just.as.pro |
| 107100 | 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 74 68 65 20 6d 65 61 6e 73 | cedure.definitions.are.the.means |
| 107120 | 20 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 0a 69 6e 20 4c 69 73 70 2c 20 72 75 6c 65 20 64 65 | .of.abstraction.in.Lisp,.rule.de |
| 107140 | 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 74 68 65 20 6d 65 61 6e 73 20 6f 66 20 61 62 73 74 72 | finitions.are.the.means.of.abstr |
| 107160 | 61 63 74 69 6f 6e 20 69 6e 20 74 68 65 20 71 75 65 72 79 0a 6c 61 6e 67 75 61 67 65 2e 20 20 49 | action.in.the.query.language...I |
| 107180 | 6e 20 65 61 63 68 20 63 61 73 65 2c 20 77 65 20 75 6e 77 69 6e 64 20 74 68 65 20 61 62 73 74 72 | n.each.case,.we.unwind.the.abstr |
| 1071a0 | 61 63 74 69 6f 6e 20 62 79 20 63 72 65 61 74 69 6e 67 0a 61 70 70 72 6f 70 72 69 61 74 65 20 62 | action.by.creating.appropriate.b |
| 1071c0 | 69 6e 64 69 6e 67 73 20 61 6e 64 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 72 75 6c 65 20 | indings.and.evaluating.the.rule. |
| 1071e0 | 6f 72 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 20 72 65 6c 61 74 69 76 65 0a 74 6f 20 74 68 | or.procedure.body.relative.to.th |
| 107200 | 65 73 65 2e 0a 0a 53 69 6d 70 6c 65 20 71 75 65 72 69 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ese...Simple.queries............ |
| 107220 | 2e 2e 2e 0a 0a 57 65 20 73 61 77 20 65 61 72 6c 69 65 72 20 69 6e 20 74 68 69 73 20 73 65 63 74 | .....We.saw.earlier.in.this.sect |
| 107240 | 69 6f 6e 20 68 6f 77 20 74 6f 20 65 76 61 6c 75 61 74 65 20 73 69 6d 70 6c 65 20 71 75 65 72 69 | ion.how.to.evaluate.simple.queri |
| 107260 | 65 73 20 69 6e 20 74 68 65 0a 61 62 73 65 6e 63 65 20 6f 66 20 72 75 6c 65 73 2e 20 20 4e 6f 77 | es.in.the.absence.of.rules...Now |
| 107280 | 20 74 68 61 74 20 77 65 20 68 61 76 65 20 73 65 65 6e 20 68 6f 77 20 74 6f 20 61 70 70 6c 79 20 | .that.we.have.seen.how.to.apply. |
| 1072a0 | 72 75 6c 65 73 2c 20 77 65 20 63 61 6e 0a 64 65 73 63 72 69 62 65 20 68 6f 77 20 74 6f 20 65 76 | rules,.we.can.describe.how.to.ev |
| 1072c0 | 61 6c 75 61 74 65 20 73 69 6d 70 6c 65 20 71 75 65 72 69 65 73 20 62 79 20 75 73 69 6e 67 20 62 | aluate.simple.queries.by.using.b |
| 1072e0 | 6f 74 68 20 72 75 6c 65 73 20 61 6e 64 0a 61 73 73 65 72 74 69 6f 6e 73 2e 0a 0a 20 20 20 47 69 | oth.rules.and.assertions......Gi |
| 107300 | 76 65 6e 20 74 68 65 20 71 75 65 72 79 20 70 61 74 74 65 72 6e 20 61 6e 64 20 61 20 73 74 72 65 | ven.the.query.pattern.and.a.stre |
| 107320 | 61 6d 20 6f 66 20 66 72 61 6d 65 73 2c 20 77 65 20 70 72 6f 64 75 63 65 2c 20 66 6f 72 20 65 61 | am.of.frames,.we.produce,.for.ea |
| 107340 | 63 68 0a 66 72 61 6d 65 20 69 6e 20 74 68 65 20 69 6e 70 75 74 20 73 74 72 65 61 6d 2c 20 74 77 | ch.frame.in.the.input.stream,.tw |
| 107360 | 6f 20 73 74 72 65 61 6d 73 3a 0a 0a 20 20 20 2a 20 61 20 73 74 72 65 61 6d 20 6f 66 20 65 78 74 | o.streams:.....*.a.stream.of.ext |
| 107380 | 65 6e 64 65 64 20 66 72 61 6d 65 73 20 6f 62 74 61 69 6e 65 64 20 62 79 20 6d 61 74 63 68 69 6e | ended.frames.obtained.by.matchin |
| 1073a0 | 67 20 74 68 65 20 70 61 74 74 65 72 6e 0a 20 20 20 20 20 61 67 61 69 6e 73 74 20 61 6c 6c 20 61 | g.the.pattern......against.all.a |
| 1073c0 | 73 73 65 72 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 28 75 73 69 6e | ssertions.in.the.data.base.(usin |
| 1073e0 | 67 20 74 68 65 20 70 61 74 74 65 72 6e 0a 20 20 20 20 20 6d 61 74 63 68 65 72 29 2c 20 61 6e 64 | g.the.pattern......matcher),.and |
| 107400 | 0a 0a 20 20 20 2a 20 61 20 73 74 72 65 61 6d 20 6f 66 20 65 78 74 65 6e 64 65 64 20 66 72 61 6d | .....*.a.stream.of.extended.fram |
| 107420 | 65 73 20 6f 62 74 61 69 6e 65 64 20 62 79 20 61 70 70 6c 79 69 6e 67 20 61 6c 6c 20 70 6f 73 73 | es.obtained.by.applying.all.poss |
| 107440 | 69 62 6c 65 0a 20 20 20 20 20 72 75 6c 65 73 20 28 75 73 69 6e 67 20 74 68 65 20 75 6e 69 66 69 | ible......rules.(using.the.unifi |
| 107460 | 65 72 29 2e 28 37 29 0a 0a 0a 20 20 20 41 70 70 65 6e 64 69 6e 67 20 74 68 65 73 65 20 74 77 6f | er).(7)......Appending.these.two |
| 107480 | 20 73 74 72 65 61 6d 73 20 70 72 6f 64 75 63 65 73 20 61 20 73 74 72 65 61 6d 20 74 68 61 74 20 | .streams.produces.a.stream.that. |
| 1074a0 | 63 6f 6e 73 69 73 74 73 20 6f 66 20 61 6c 6c 0a 74 68 65 20 77 61 79 73 20 74 68 61 74 20 74 68 | consists.of.all.the.ways.that.th |
| 1074c0 | 65 20 67 69 76 65 6e 20 70 61 74 74 65 72 6e 20 63 61 6e 20 62 65 20 73 61 74 69 73 66 69 65 64 | e.given.pattern.can.be.satisfied |
| 1074e0 | 20 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 74 68 65 0a 6f 72 69 67 69 6e 61 6c 20 66 72 | .consistent.with.the.original.fr |
| 107500 | 61 6d 65 2e 20 20 54 68 65 73 65 20 73 74 72 65 61 6d 73 20 28 6f 6e 65 20 66 6f 72 20 65 61 63 | ame...These.streams.(one.for.eac |
| 107520 | 68 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 69 6e 70 75 74 20 73 74 72 65 61 6d 29 0a 61 72 65 | h.frame.in.the.input.stream).are |
| 107540 | 20 6e 6f 77 20 61 6c 6c 20 63 6f 6d 62 69 6e 65 64 20 74 6f 20 66 6f 72 6d 20 6f 6e 65 20 6c 61 | .now.all.combined.to.form.one.la |
| 107560 | 72 67 65 20 73 74 72 65 61 6d 2c 20 77 68 69 63 68 20 74 68 65 72 65 66 6f 72 65 20 63 6f 6e 73 | rge.stream,.which.therefore.cons |
| 107580 | 69 73 74 73 0a 6f 66 20 61 6c 6c 20 74 68 65 20 77 61 79 73 20 74 68 61 74 20 61 6e 79 20 6f 66 | ists.of.all.the.ways.that.any.of |
| 1075a0 | 20 74 68 65 20 66 72 61 6d 65 73 20 69 6e 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 69 6e 70 75 | .the.frames.in.the.original.inpu |
| 1075c0 | 74 20 73 74 72 65 61 6d 20 63 61 6e 0a 62 65 20 65 78 74 65 6e 64 65 64 20 74 6f 20 70 72 6f 64 | t.stream.can.be.extended.to.prod |
| 1075e0 | 75 63 65 20 61 20 6d 61 74 63 68 20 77 69 74 68 20 74 68 65 20 67 69 76 65 6e 20 70 61 74 74 65 | uce.a.match.with.the.given.patte |
| 107600 | 72 6e 2e 0a 0a 54 68 65 20 71 75 65 72 79 20 65 76 61 6c 75 61 74 6f 72 20 61 6e 64 20 74 68 65 | rn...The.query.evaluator.and.the |
| 107620 | 20 64 72 69 76 65 72 20 6c 6f 6f 70 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | .driver.loop.................... |
| 107640 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 44 65 73 70 69 74 65 20 74 68 | ......................Despite.th |
| 107660 | 65 20 63 6f 6d 70 6c 65 78 69 74 79 20 6f 66 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 6d | e.complexity.of.the.underlying.m |
| 107680 | 61 74 63 68 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 74 68 65 0a 73 79 73 74 65 6d 20 69 | atching.operations,.the.system.i |
| 1076a0 | 73 20 6f 72 67 61 6e 69 7a 65 64 20 6d 75 63 68 20 6c 69 6b 65 20 61 6e 20 65 76 61 6c 75 61 74 | s.organized.much.like.an.evaluat |
| 1076c0 | 6f 72 20 66 6f 72 20 61 6e 79 20 6c 61 6e 67 75 61 67 65 2e 20 20 54 68 65 0a 70 72 6f 63 65 64 | or.for.any.language...The.proced |
| 1076e0 | 75 72 65 20 74 68 61 74 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 74 68 65 20 6d 61 74 63 68 69 6e | ure.that.coordinates.the.matchin |
| 107700 | 67 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 73 20 63 61 6c 6c 65 64 20 60 71 65 76 61 6c 27 2c 0a | g.operations.is.called.`qeval',. |
| 107720 | 61 6e 64 20 69 74 20 70 6c 61 79 73 20 61 20 72 6f 6c 65 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f | and.it.plays.a.role.analogous.to |
| 107740 | 20 74 68 61 74 20 6f 66 20 74 68 65 20 60 65 76 61 6c 27 20 70 72 6f 63 65 64 75 72 65 20 66 6f | .that.of.the.`eval'.procedure.fo |
| 107760 | 72 20 4c 69 73 70 2e 0a 60 51 65 76 61 6c 27 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 73 20 | r.Lisp..`Qeval'.takes.as.inputs. |
| 107780 | 61 20 71 75 65 72 79 20 61 6e 64 20 61 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 2e 20 | a.query.and.a.stream.of.frames.. |
| 1077a0 | 20 49 74 73 20 6f 75 74 70 75 74 20 69 73 0a 61 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 | .Its.output.is.a.stream.of.frame |
| 1077c0 | 73 2c 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 73 75 63 63 65 73 73 66 75 6c 20 6d | s,.corresponding.to.successful.m |
| 1077e0 | 61 74 63 68 65 73 20 74 6f 20 74 68 65 20 71 75 65 72 79 0a 70 61 74 74 65 72 6e 2c 20 74 68 61 | atches.to.the.query.pattern,.tha |
| 107800 | 74 20 65 78 74 65 6e 64 20 73 6f 6d 65 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 69 6e 70 75 74 | t.extend.some.frame.in.the.input |
| 107820 | 20 73 74 72 65 61 6d 2c 20 61 73 20 69 6e 64 69 63 61 74 65 64 20 69 6e 0a 2a 4e 6f 74 65 20 46 | .stream,.as.indicated.in.*Note.F |
| 107840 | 69 67 75 72 65 20 34 2d 34 3a 3a 2e 20 20 4c 69 6b 65 20 60 65 76 61 6c 27 2c 20 60 71 65 76 61 | igure.4-4::...Like.`eval',.`qeva |
| 107860 | 6c 27 20 63 6c 61 73 73 69 66 69 65 73 20 74 68 65 20 64 69 66 66 65 72 65 6e 74 0a 74 79 70 65 | l'.classifies.the.different.type |
| 107880 | 73 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 20 28 71 75 65 72 69 65 73 29 20 61 6e 64 20 64 | s.of.expressions.(queries).and.d |
| 1078a0 | 69 73 70 61 74 63 68 65 73 20 74 6f 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74 65 0a 70 72 6f 63 | ispatches.to.an.appropriate.proc |
| 1078c0 | 65 64 75 72 65 20 66 6f 72 20 65 61 63 68 2e 20 20 54 68 65 72 65 20 69 73 20 61 20 70 72 6f 63 | edure.for.each...There.is.a.proc |
| 1078e0 | 65 64 75 72 65 20 66 6f 72 20 65 61 63 68 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 28 60 61 6e | edure.for.each.special.form.(`an |
| 107900 | 64 27 2c 0a 60 6f 72 27 2c 20 60 6e 6f 74 27 2c 20 61 6e 64 20 60 6c 69 73 70 2d 76 61 6c 75 65 | d',.`or',.`not',.and.`lisp-value |
| 107920 | 27 29 20 61 6e 64 20 6f 6e 65 20 66 6f 72 20 73 69 6d 70 6c 65 20 71 75 65 72 69 65 73 2e 0a 0a | ').and.one.for.simple.queries... |
| 107940 | 20 20 20 54 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 2c 20 77 68 69 63 68 20 69 73 20 61 6e 61 | ...The.driver.loop,.which.is.ana |
| 107960 | 6c 6f 67 6f 75 73 20 74 6f 20 74 68 65 20 60 64 72 69 76 65 72 2d 6c 6f 6f 70 27 20 70 72 6f 63 | logous.to.the.`driver-loop'.proc |
| 107980 | 65 64 75 72 65 0a 66 6f 72 20 74 68 65 20 6f 74 68 65 72 20 65 76 61 6c 75 61 74 6f 72 73 20 69 | edure.for.the.other.evaluators.i |
| 1079a0 | 6e 20 74 68 69 73 20 63 68 61 70 74 65 72 2c 20 72 65 61 64 73 20 71 75 65 72 69 65 73 20 66 72 | n.this.chapter,.reads.queries.fr |
| 1079c0 | 6f 6d 20 74 68 65 0a 74 65 72 6d 69 6e 61 6c 2e 20 20 46 6f 72 20 65 61 63 68 20 71 75 65 72 79 | om.the.terminal...For.each.query |
| 1079e0 | 2c 20 69 74 20 63 61 6c 6c 73 20 60 71 65 76 61 6c 27 20 77 69 74 68 20 74 68 65 20 71 75 65 72 | ,.it.calls.`qeval'.with.the.quer |
| 107a00 | 79 20 61 6e 64 20 61 20 73 74 72 65 61 6d 0a 74 68 61 74 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 | y.and.a.stream.that.consists.of. |
| 107a20 | 61 20 73 69 6e 67 6c 65 20 65 6d 70 74 79 20 66 72 61 6d 65 2e 20 20 54 68 69 73 20 77 69 6c 6c | a.single.empty.frame...This.will |
| 107a40 | 20 70 72 6f 64 75 63 65 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 0a 61 6c 6c 20 70 6f 73 73 69 | .produce.the.stream.of.all.possi |
| 107a60 | 62 6c 65 20 6d 61 74 63 68 65 73 20 28 61 6c 6c 20 70 6f 73 73 69 62 6c 65 20 65 78 74 65 6e 73 | ble.matches.(all.possible.extens |
| 107a80 | 69 6f 6e 73 20 74 6f 20 74 68 65 20 65 6d 70 74 79 20 66 72 61 6d 65 29 2e 20 20 46 6f 72 0a 65 | ions.to.the.empty.frame)...For.e |
| 107aa0 | 61 63 68 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 73 74 72 65 61 | ach.frame.in.the.resulting.strea |
| 107ac0 | 6d 2c 20 69 74 20 69 6e 73 74 61 6e 74 69 61 74 65 73 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 | m,.it.instantiates.the.original. |
| 107ae0 | 71 75 65 72 79 0a 75 73 69 6e 67 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 20 76 61 | query.using.the.values.of.the.va |
| 107b00 | 72 69 61 62 6c 65 73 20 66 6f 75 6e 64 20 69 6e 20 74 68 65 20 66 72 61 6d 65 2e 20 20 54 68 69 | riables.found.in.the.frame...Thi |
| 107b20 | 73 20 73 74 72 65 61 6d 20 6f 66 0a 69 6e 73 74 61 6e 74 69 61 74 65 64 20 71 75 65 72 69 65 73 | s.stream.of.instantiated.queries |
| 107b40 | 20 69 73 20 74 68 65 6e 20 70 72 69 6e 74 65 64 2e 28 38 29 0a 0a 20 20 20 54 68 65 20 64 72 69 | .is.then.printed.(8).....The.dri |
| 107b60 | 76 65 72 20 61 6c 73 6f 20 63 68 65 63 6b 73 20 66 6f 72 20 74 68 65 20 73 70 65 63 69 61 6c 20 | ver.also.checks.for.the.special. |
| 107b80 | 63 6f 6d 6d 61 6e 64 20 60 61 73 73 65 72 74 21 27 2c 20 77 68 69 63 68 0a 73 69 67 6e 61 6c 73 | command.`assert!',.which.signals |
| 107ba0 | 20 74 68 61 74 20 74 68 65 20 69 6e 70 75 74 20 69 73 20 6e 6f 74 20 61 20 71 75 65 72 79 20 62 | .that.the.input.is.not.a.query.b |
| 107bc0 | 75 74 20 72 61 74 68 65 72 20 61 6e 20 61 73 73 65 72 74 69 6f 6e 20 6f 72 20 72 75 6c 65 0a 74 | ut.rather.an.assertion.or.rule.t |
| 107be0 | 6f 20 62 65 20 61 64 64 65 64 20 74 6f 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 20 20 46 6f | o.be.added.to.the.data.base...Fo |
| 107c00 | 72 20 69 6e 73 74 61 6e 63 65 2c 0a 0a 20 20 20 20 20 28 61 73 73 65 72 74 21 20 28 6a 6f 62 20 | r.instance,.......(assert!.(job. |
| 107c20 | 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 20 28 63 6f 6d 70 75 74 65 72 20 77 69 7a 61 72 64 | (Bitdiddle.Ben).(computer.wizard |
| 107c40 | 29 29 29 0a 0a 20 20 20 20 20 28 61 73 73 65 72 74 21 20 28 72 75 6c 65 20 28 77 68 65 65 6c 20 | ))).......(assert!.(rule.(wheel. |
| 107c60 | 3f 70 65 72 73 6f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 6e | ?person).....................(an |
| 107c80 | 64 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 6d 69 64 64 6c 65 2d 6d 61 6e 61 67 65 72 20 3f 70 | d.(supervisor.?middle-manager.?p |
| 107ca0 | 65 72 73 6f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | erson).......................... |
| 107cc0 | 28 73 75 70 65 72 76 69 73 6f 72 20 3f 78 20 3f 6d 69 64 64 6c 65 2d 6d 61 6e 61 67 65 72 29 29 | (supervisor.?x.?middle-manager)) |
| 107ce0 | 29 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d | )).....----------.Footnotes.---- |
| 107d00 | 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 42 65 63 61 75 73 65 20 6d 61 74 63 68 69 6e 67 20 | ------.....(1).Because.matching. |
| 107d20 | 69 73 20 67 65 6e 65 72 61 6c 6c 79 20 76 65 72 79 20 65 78 70 65 6e 73 69 76 65 2c 20 77 65 20 | is.generally.very.expensive,.we. |
| 107d40 | 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f 0a 61 76 6f 69 64 20 61 70 70 6c 79 69 6e 67 20 74 68 65 | would.like.to.avoid.applying.the |
| 107d60 | 20 66 75 6c 6c 20 6d 61 74 63 68 65 72 20 74 6f 20 65 76 65 72 79 20 65 6c 65 6d 65 6e 74 20 6f | .full.matcher.to.every.element.o |
| 107d80 | 66 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 0a 54 68 69 73 20 69 73 20 75 73 75 61 6c 6c 79 | f.the.data.base..This.is.usually |
| 107da0 | 20 61 72 72 61 6e 67 65 64 20 62 79 20 62 72 65 61 6b 69 6e 67 20 75 70 20 74 68 65 20 70 72 6f | .arranged.by.breaking.up.the.pro |
| 107dc0 | 63 65 73 73 20 69 6e 74 6f 20 61 20 66 61 73 74 2c 20 63 6f 61 72 73 65 0a 6d 61 74 63 68 20 61 | cess.into.a.fast,.coarse.match.a |
| 107de0 | 6e 64 20 74 68 65 20 66 69 6e 61 6c 20 6d 61 74 63 68 2e 20 20 54 68 65 20 63 6f 61 72 73 65 20 | nd.the.final.match...The.coarse. |
| 107e00 | 6d 61 74 63 68 20 66 69 6c 74 65 72 73 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 74 6f 0a 70 | match.filters.the.data.base.to.p |
| 107e20 | 72 6f 64 75 63 65 20 61 20 73 6d 61 6c 6c 20 73 65 74 20 6f 66 20 63 61 6e 64 69 64 61 74 65 73 | roduce.a.small.set.of.candidates |
| 107e40 | 20 66 6f 72 20 74 68 65 20 66 69 6e 61 6c 20 6d 61 74 63 68 2e 20 20 57 69 74 68 20 63 61 72 65 | .for.the.final.match...With.care |
| 107e60 | 2c 20 77 65 0a 63 61 6e 20 61 72 72 61 6e 67 65 20 6f 75 72 20 64 61 74 61 20 62 61 73 65 20 73 | ,.we.can.arrange.our.data.base.s |
| 107e80 | 6f 20 74 68 61 74 20 73 6f 6d 65 20 6f 66 20 74 68 65 20 77 6f 72 6b 20 6f 66 20 63 6f 61 72 73 | o.that.some.of.the.work.of.coars |
| 107ea0 | 65 20 6d 61 74 63 68 69 6e 67 0a 63 61 6e 20 62 65 20 64 6f 6e 65 20 77 68 65 6e 20 74 68 65 20 | e.matching.can.be.done.when.the. |
| 107ec0 | 64 61 74 61 20 62 61 73 65 20 69 73 20 63 6f 6e 73 74 72 75 63 74 65 64 20 72 61 74 68 65 72 20 | data.base.is.constructed.rather. |
| 107ee0 | 74 68 65 6e 20 77 68 65 6e 20 77 65 20 77 61 6e 74 0a 74 6f 20 73 65 6c 65 63 74 20 74 68 65 20 | then.when.we.want.to.select.the. |
| 107f00 | 63 61 6e 64 69 64 61 74 65 73 2e 20 20 54 68 69 73 20 69 73 20 63 61 6c 6c 65 64 20 22 69 6e 64 | candidates...This.is.called."ind |
| 107f20 | 65 78 69 6e 67 22 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 0a 54 68 65 72 65 20 69 73 20 61 | exing".the.data.base..There.is.a |
| 107f40 | 20 76 61 73 74 20 74 65 63 68 6e 6f 6c 6f 67 79 20 62 75 69 6c 74 20 61 72 6f 75 6e 64 20 64 61 | .vast.technology.built.around.da |
| 107f60 | 74 61 2d 62 61 73 65 2d 69 6e 64 65 78 69 6e 67 20 73 63 68 65 6d 65 73 2e 0a 4f 75 72 20 69 6d | ta-base-indexing.schemes..Our.im |
| 107f80 | 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 | plementation,.described.in.secti |
| 107fa0 | 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 3a 3a 2c 20 63 6f 6e 74 61 69 6e 73 20 61 0a 73 69 6d | on.*Note.4-4-4::,.contains.a.sim |
| 107fc0 | 70 6c 65 2d 6d 69 6e 64 65 64 20 66 6f 72 6d 20 6f 66 20 73 75 63 68 20 61 6e 20 6f 70 74 69 6d | ple-minded.form.of.such.an.optim |
| 107fe0 | 69 7a 61 74 69 6f 6e 2e 0a 0a 20 20 20 28 32 29 20 42 75 74 20 74 68 69 73 20 6b 69 6e 64 20 6f | ization......(2).But.this.kind.o |
| 108000 | 66 20 65 78 70 6f 6e 65 6e 74 69 61 6c 20 65 78 70 6c 6f 73 69 6f 6e 20 69 73 20 6e 6f 74 20 63 | f.exponential.explosion.is.not.c |
| 108020 | 6f 6d 6d 6f 6e 20 69 6e 20 60 61 6e 64 27 0a 71 75 65 72 69 65 73 20 62 65 63 61 75 73 65 20 74 | ommon.in.`and'.queries.because.t |
| 108040 | 68 65 20 61 64 64 65 64 20 63 6f 6e 64 69 74 69 6f 6e 73 20 74 65 6e 64 20 74 6f 20 72 65 64 75 | he.added.conditions.tend.to.redu |
| 108060 | 63 65 20 72 61 74 68 65 72 20 74 68 61 6e 20 65 78 70 61 6e 64 0a 74 68 65 20 6e 75 6d 62 65 72 | ce.rather.than.expand.the.number |
| 108080 | 20 6f 66 20 66 72 61 6d 65 73 20 70 72 6f 64 75 63 65 64 2e 0a 0a 20 20 20 28 33 29 20 54 68 65 | .of.frames.produced......(3).The |
| 1080a0 | 72 65 20 69 73 20 61 20 6c 61 72 67 65 20 6c 69 74 65 72 61 74 75 72 65 20 6f 6e 20 64 61 74 61 | re.is.a.large.literature.on.data |
| 1080c0 | 2d 62 61 73 65 2d 6d 61 6e 61 67 65 6d 65 6e 74 20 73 79 73 74 65 6d 73 20 74 68 61 74 0a 69 73 | -base-management.systems.that.is |
| 1080e0 | 20 63 6f 6e 63 65 72 6e 65 64 20 77 69 74 68 20 68 6f 77 20 74 6f 20 68 61 6e 64 6c 65 20 63 6f | .concerned.with.how.to.handle.co |
| 108100 | 6d 70 6c 65 78 20 71 75 65 72 69 65 73 20 65 66 66 69 63 69 65 6e 74 6c 79 2e 0a 0a 20 20 20 28 | mplex.queries.efficiently......( |
| 108120 | 34 29 20 54 68 65 72 65 20 69 73 20 61 20 73 75 62 74 6c 65 20 64 69 66 66 65 72 65 6e 63 65 20 | 4).There.is.a.subtle.difference. |
| 108140 | 62 65 74 77 65 65 6e 20 74 68 69 73 20 66 69 6c 74 65 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 | between.this.filter.implementati |
| 108160 | 6f 6e 0a 6f 66 20 60 6e 6f 74 27 20 61 6e 64 20 74 68 65 20 75 73 75 61 6c 20 6d 65 61 6e 69 6e | on.of.`not'.and.the.usual.meanin |
| 108180 | 67 20 6f 66 20 60 6e 6f 74 27 20 69 6e 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6c 6f 67 69 63 | g.of.`not'.in.mathematical.logic |
| 1081a0 | 2e 20 20 53 65 65 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 33 3a 3a 2e 0a 0a 20 | ...See.section.*Note.4-4-3::.... |
| 1081c0 | 20 20 28 35 29 20 49 6e 20 6f 6e 65 2d 73 69 64 65 64 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 | ..(5).In.one-sided.pattern.match |
| 1081e0 | 69 6e 67 2c 20 61 6c 6c 20 74 68 65 20 65 71 75 61 74 69 6f 6e 73 20 74 68 61 74 20 63 6f 6e 74 | ing,.all.the.equations.that.cont |
| 108200 | 61 69 6e 0a 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 65 78 70 6c 69 63 | ain.pattern.variables.are.explic |
| 108220 | 69 74 20 61 6e 64 20 61 6c 72 65 61 64 79 20 73 6f 6c 76 65 64 20 66 6f 72 20 74 68 65 20 75 6e | it.and.already.solved.for.the.un |
| 108240 | 6b 6e 6f 77 6e 20 28 74 68 65 0a 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 29 2e 0a 0a 20 | known.(the.pattern.variable).... |
| 108260 | 20 20 28 36 29 20 41 6e 6f 74 68 65 72 20 77 61 79 20 74 6f 20 74 68 69 6e 6b 20 6f 66 20 75 6e | ..(6).Another.way.to.think.of.un |
| 108280 | 69 66 69 63 61 74 69 6f 6e 20 69 73 20 74 68 61 74 20 69 74 20 67 65 6e 65 72 61 74 65 73 20 74 | ification.is.that.it.generates.t |
| 1082a0 | 68 65 0a 6d 6f 73 74 20 67 65 6e 65 72 61 6c 20 70 61 74 74 65 72 6e 20 74 68 61 74 20 69 73 20 | he.most.general.pattern.that.is. |
| 1082c0 | 61 20 73 70 65 63 69 61 6c 69 7a 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 74 77 6f 20 69 6e 70 75 | a.specialization.of.the.two.inpu |
| 1082e0 | 74 0a 70 61 74 74 65 72 6e 73 2e 20 20 54 68 61 74 20 69 73 2c 20 74 68 65 20 75 6e 69 66 69 63 | t.patterns...That.is,.the.unific |
| 108300 | 61 74 69 6f 6e 20 6f 66 20 60 28 3f 78 20 61 29 27 20 61 6e 64 20 60 28 28 62 20 3f 79 29 20 3f | ation.of.`(?x.a)'.and.`((b.?y).? |
| 108320 | 7a 29 27 20 69 73 0a 60 28 28 62 20 3f 79 29 20 61 29 27 2c 20 61 6e 64 20 74 68 65 20 75 6e 69 | z)'.is.`((b.?y).a)',.and.the.uni |
| 108340 | 66 69 63 61 74 69 6f 6e 20 6f 66 20 60 28 3f 78 20 61 20 3f 79 29 27 20 61 6e 64 20 60 28 3f 79 | fication.of.`(?x.a.?y)'.and.`(?y |
| 108360 | 20 3f 7a 20 61 29 27 2c 0a 64 69 73 63 75 73 73 65 64 20 61 62 6f 76 65 2c 20 69 73 20 60 28 61 | .?z.a)',.discussed.above,.is.`(a |
| 108380 | 20 61 20 61 29 27 2e 20 20 46 6f 72 20 6f 75 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2c | .a.a)'...For.our.implementation, |
| 1083a0 | 20 69 74 20 69 73 20 6d 6f 72 65 0a 63 6f 6e 76 65 6e 69 65 6e 74 20 74 6f 20 74 68 69 6e 6b 20 | .it.is.more.convenient.to.think. |
| 1083c0 | 6f 66 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 75 6e 69 66 69 63 61 74 69 6f 6e 20 61 73 20 | of.the.result.of.unification.as. |
| 1083e0 | 61 20 66 72 61 6d 65 20 72 61 74 68 65 72 20 74 68 61 6e 0a 61 20 70 61 74 74 65 72 6e 2e 0a 0a | a.frame.rather.than.a.pattern... |
| 108400 | 20 20 20 28 37 29 20 53 69 6e 63 65 20 75 6e 69 66 69 63 61 74 69 6f 6e 20 69 73 20 61 20 67 65 | ...(7).Since.unification.is.a.ge |
| 108420 | 6e 65 72 61 6c 69 7a 61 74 69 6f 6e 20 6f 66 20 6d 61 74 63 68 69 6e 67 2c 20 77 65 20 63 6f 75 | neralization.of.matching,.we.cou |
| 108440 | 6c 64 0a 73 69 6d 70 6c 69 66 79 20 74 68 65 20 73 79 73 74 65 6d 20 62 79 20 75 73 69 6e 67 20 | ld.simplify.the.system.by.using. |
| 108460 | 74 68 65 20 75 6e 69 66 69 65 72 20 74 6f 20 70 72 6f 64 75 63 65 20 62 6f 74 68 20 73 74 72 65 | the.unifier.to.produce.both.stre |
| 108480 | 61 6d 73 2e 0a 54 72 65 61 74 69 6e 67 20 74 68 65 20 65 61 73 79 20 63 61 73 65 20 77 69 74 68 | ams..Treating.the.easy.case.with |
| 1084a0 | 20 74 68 65 20 73 69 6d 70 6c 65 20 6d 61 74 63 68 65 72 2c 20 68 6f 77 65 76 65 72 2c 20 69 6c | .the.simple.matcher,.however,.il |
| 1084c0 | 6c 75 73 74 72 61 74 65 73 0a 68 6f 77 20 6d 61 74 63 68 69 6e 67 20 28 61 73 20 6f 70 70 6f 73 | lustrates.how.matching.(as.oppos |
| 1084e0 | 65 64 20 74 6f 20 66 75 6c 6c 2d 62 6c 6f 77 6e 20 75 6e 69 66 69 63 61 74 69 6f 6e 29 20 63 61 | ed.to.full-blown.unification).ca |
| 108500 | 6e 20 62 65 20 75 73 65 66 75 6c 20 69 6e 0a 69 74 73 20 6f 77 6e 20 72 69 67 68 74 2e 0a 0a 20 | n.be.useful.in.its.own.right.... |
| 108520 | 20 20 28 38 29 20 54 68 65 20 72 65 61 73 6f 6e 20 77 65 20 75 73 65 20 73 74 72 65 61 6d 73 20 | ..(8).The.reason.we.use.streams. |
| 108540 | 28 72 61 74 68 65 72 20 74 68 61 6e 20 6c 69 73 74 73 29 20 6f 66 20 66 72 61 6d 65 73 20 69 73 | (rather.than.lists).of.frames.is |
| 108560 | 20 74 68 61 74 0a 74 68 65 20 72 65 63 75 72 73 69 76 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 | .that.the.recursive.application. |
| 108580 | 6f 66 20 72 75 6c 65 73 20 63 61 6e 20 67 65 6e 65 72 61 74 65 20 69 6e 66 69 6e 69 74 65 20 6e | of.rules.can.generate.infinite.n |
| 1085a0 | 75 6d 62 65 72 73 20 6f 66 0a 76 61 6c 75 65 73 20 74 68 61 74 20 73 61 74 69 73 66 79 20 61 20 | umbers.of.values.that.satisfy.a. |
| 1085c0 | 71 75 65 72 79 2e 20 20 54 68 65 20 64 65 6c 61 79 65 64 20 65 76 61 6c 75 61 74 69 6f 6e 20 65 | query...The.delayed.evaluation.e |
| 1085e0 | 6d 62 6f 64 69 65 64 20 69 6e 0a 73 74 72 65 61 6d 73 20 69 73 20 63 72 75 63 69 61 6c 20 68 65 | mbodied.in.streams.is.crucial.he |
| 108600 | 72 65 3a 20 54 68 65 20 73 79 73 74 65 6d 20 77 69 6c 6c 20 70 72 69 6e 74 20 72 65 73 70 6f 6e | re:.The.system.will.print.respon |
| 108620 | 73 65 73 20 6f 6e 65 20 62 79 20 6f 6e 65 20 61 73 0a 74 68 65 79 20 61 72 65 20 67 65 6e 65 72 | ses.one.by.one.as.they.are.gener |
| 108640 | 61 74 65 64 2c 20 72 65 67 61 72 64 6c 65 73 73 20 6f 66 20 77 68 65 74 68 65 72 20 74 68 65 72 | ated,.regardless.of.whether.ther |
| 108660 | 65 20 61 72 65 20 61 20 66 69 6e 69 74 65 20 6f 72 0a 69 6e 66 69 6e 69 74 65 20 6e 75 6d 62 65 | e.are.a.finite.or.infinite.numbe |
| 108680 | 72 20 6f 66 20 72 65 73 70 6f 6e 73 65 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e | r.of.responses.....File:.sicp.in |
| 1086a0 | 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 34 2d 33 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2d 34 2c 20 | fo,..Node:.4-4-3,..Next:.4-4-4,. |
| 1086c0 | 20 50 72 65 76 3a 20 34 2d 34 2d 32 2c 20 20 55 70 3a 20 34 2d 34 0a 0a 34 2e 34 2e 33 20 49 73 | .Prev:.4-4-2,..Up:.4-4..4.4.3.Is |
| 1086e0 | 20 4c 6f 67 69 63 20 50 72 6f 67 72 61 6d 6d 69 6e 67 20 4d 61 74 68 65 6d 61 74 69 63 61 6c 20 | .Logic.Programming.Mathematical. |
| 108700 | 4c 6f 67 69 63 3f 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | Logic?.------------------------- |
| 108720 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 6d 65 61 6e 73 | ---------------------..The.means |
| 108740 | 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 75 73 65 64 20 69 6e 20 74 68 65 20 71 75 65 72 | .of.combination.used.in.the.quer |
| 108760 | 79 20 6c 61 6e 67 75 61 67 65 20 6d 61 79 20 61 74 20 66 69 72 73 74 20 73 65 65 6d 0a 69 64 65 | y.language.may.at.first.seem.ide |
| 108780 | 6e 74 69 63 61 6c 20 74 6f 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 60 61 6e 64 27 2c 20 | ntical.to.the.operations.`and',. |
| 1087a0 | 60 6f 72 27 2c 20 61 6e 64 20 60 6e 6f 74 27 20 6f 66 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 0a | `or',.and.`not'.of.mathematical. |
| 1087c0 | 6c 6f 67 69 63 2c 20 61 6e 64 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 71 75 | logic,.and.the.application.of.qu |
| 1087e0 | 65 72 79 2d 6c 61 6e 67 75 61 67 65 20 72 75 6c 65 73 20 69 73 20 69 6e 20 66 61 63 74 0a 61 63 | ery-language.rules.is.in.fact.ac |
| 108800 | 63 6f 6d 70 6c 69 73 68 65 64 20 74 68 72 6f 75 67 68 20 61 20 6c 65 67 69 74 69 6d 61 74 65 20 | complished.through.a.legitimate. |
| 108820 | 6d 65 74 68 6f 64 20 6f 66 20 69 6e 66 65 72 65 6e 63 65 2e 28 31 29 20 54 68 69 73 0a 69 64 65 | method.of.inference.(1).This.ide |
| 108840 | 6e 74 69 66 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 | ntification.of.the.query.languag |
| 108860 | 65 20 77 69 74 68 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6c 6f 67 69 63 20 69 73 20 6e 6f 74 | e.with.mathematical.logic.is.not |
| 108880 | 0a 72 65 61 6c 6c 79 20 76 61 6c 69 64 2c 20 74 68 6f 75 67 68 2c 20 62 65 63 61 75 73 65 20 74 | .really.valid,.though,.because.t |
| 1088a0 | 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 20 70 72 6f 76 69 64 65 73 20 61 20 73 74 72 | he.query.language.provides.a.str |
| 1088c0 | 75 63 74 75 72 65 0a 22 63 6f 6e 74 72 6f 6c 20 73 74 72 75 63 74 75 72 65 22 20 74 68 61 74 20 | ucture."control.structure".that. |
| 1088e0 | 69 6e 74 65 72 70 72 65 74 73 20 74 68 65 20 6c 6f 67 69 63 61 6c 20 73 74 61 74 65 6d 65 6e 74 | interprets.the.logical.statement |
| 108900 | 73 0a 70 72 6f 63 65 64 75 72 61 6c 6c 79 2e 20 20 57 65 20 63 61 6e 20 6f 66 74 65 6e 20 74 61 | s.procedurally...We.can.often.ta |
| 108920 | 6b 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 74 68 69 73 20 63 6f 6e 74 72 6f 6c 20 73 74 72 | ke.advantage.of.this.control.str |
| 108940 | 75 63 74 75 72 65 2e 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 6f 20 66 69 6e 64 20 61 6c 6c | ucture..For.example,.to.find.all |
| 108960 | 20 6f 66 20 74 68 65 20 73 75 70 65 72 76 69 73 6f 72 73 20 6f 66 20 70 72 6f 67 72 61 6d 6d 65 | .of.the.supervisors.of.programme |
| 108980 | 72 73 20 77 65 20 63 6f 75 6c 64 0a 66 6f 72 6d 75 6c 61 74 65 20 61 20 71 75 65 72 79 20 69 6e | rs.we.could.formulate.a.query.in |
| 1089a0 | 20 65 69 74 68 65 72 20 6f 66 20 74 77 6f 20 6c 6f 67 69 63 61 6c 6c 79 20 65 71 75 69 76 61 6c | .either.of.two.logically.equival |
| 1089c0 | 65 6e 74 20 66 6f 72 6d 73 3a 0a 0a 20 20 20 20 20 28 61 6e 64 20 28 6a 6f 62 20 3f 78 20 28 63 | ent.forms:.......(and.(job.?x.(c |
| 1089e0 | 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 | omputer.programmer))...........( |
| 108a00 | 73 75 70 65 72 76 69 73 6f 72 20 3f 78 20 3f 79 29 29 0a 0a 6f 72 0a 0a 20 20 20 20 20 28 61 6e | supervisor.?x.?y))..or.......(an |
| 108a20 | 64 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 78 20 3f 79 29 0a 20 20 20 20 20 20 20 20 20 20 28 | d.(supervisor.?x.?y)...........( |
| 108a40 | 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 29 0a 0a | job.?x.(computer.programmer))).. |
| 108a60 | 20 20 20 49 66 20 61 20 63 6f 6d 70 61 6e 79 20 68 61 73 20 6d 61 6e 79 20 6d 6f 72 65 20 73 75 | ...If.a.company.has.many.more.su |
| 108a80 | 70 65 72 76 69 73 6f 72 73 20 74 68 61 6e 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 28 74 68 65 20 | pervisors.than.programmers.(the. |
| 108aa0 | 75 73 75 61 6c 0a 63 61 73 65 29 2c 20 69 74 20 69 73 20 62 65 74 74 65 72 20 74 6f 20 75 73 65 | usual.case),.it.is.better.to.use |
| 108ac0 | 20 74 68 65 20 66 69 72 73 74 20 66 6f 72 6d 20 72 61 74 68 65 72 20 74 68 61 6e 20 74 68 65 20 | .the.first.form.rather.than.the. |
| 108ae0 | 73 65 63 6f 6e 64 0a 62 65 63 61 75 73 65 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 6d 75 73 | second.because.the.data.base.mus |
| 108b00 | 74 20 62 65 20 73 63 61 6e 6e 65 64 20 66 6f 72 20 65 61 63 68 20 69 6e 74 65 72 6d 65 64 69 61 | t.be.scanned.for.each.intermedia |
| 108b20 | 74 65 20 72 65 73 75 6c 74 0a 28 66 72 61 6d 65 29 20 70 72 6f 64 75 63 65 64 20 62 79 20 74 68 | te.result.(frame).produced.by.th |
| 108b40 | 65 20 66 69 72 73 74 20 63 6c 61 75 73 65 20 6f 66 20 74 68 65 20 60 61 6e 64 27 2e 0a 0a 20 20 | e.first.clause.of.the.`and'..... |
| 108b60 | 20 54 68 65 20 61 69 6d 20 6f 66 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 | .The.aim.of.logic.programming.is |
| 108b80 | 20 74 6f 20 70 72 6f 76 69 64 65 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 65 72 20 77 69 74 68 0a | .to.provide.the.programmer.with. |
| 108ba0 | 74 65 63 68 6e 69 71 75 65 73 20 66 6f 72 20 64 65 63 6f 6d 70 6f 73 69 6e 67 20 61 20 63 6f 6d | techniques.for.decomposing.a.com |
| 108bc0 | 70 75 74 61 74 69 6f 6e 61 6c 20 70 72 6f 62 6c 65 6d 20 69 6e 74 6f 20 74 77 6f 20 73 65 70 61 | putational.problem.into.two.sepa |
| 108be0 | 72 61 74 65 0a 70 72 6f 62 6c 65 6d 73 3a 20 22 77 68 61 74 22 20 69 73 20 74 6f 20 62 65 20 63 | rate.problems:."what".is.to.be.c |
| 108c00 | 6f 6d 70 75 74 65 64 2c 20 61 6e 64 20 22 68 6f 77 22 20 74 68 69 73 20 73 68 6f 75 6c 64 20 62 | omputed,.and."how".this.should.b |
| 108c20 | 65 20 63 6f 6d 70 75 74 65 64 2e 0a 54 68 69 73 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 | e.computed..This.is.accomplished |
| 108c40 | 20 62 79 20 73 65 6c 65 63 74 69 6e 67 20 61 20 73 75 62 73 65 74 20 6f 66 20 74 68 65 20 73 74 | .by.selecting.a.subset.of.the.st |
| 108c60 | 61 74 65 6d 65 6e 74 73 20 6f 66 0a 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6c 6f 67 69 63 20 74 | atements.of.mathematical.logic.t |
| 108c80 | 68 61 74 20 69 73 20 70 6f 77 65 72 66 75 6c 20 65 6e 6f 75 67 68 20 74 6f 20 62 65 20 61 62 6c | hat.is.powerful.enough.to.be.abl |
| 108ca0 | 65 20 74 6f 20 64 65 73 63 72 69 62 65 0a 61 6e 79 74 68 69 6e 67 20 6f 6e 65 20 6d 69 67 68 74 | e.to.describe.anything.one.might |
| 108cc0 | 20 77 61 6e 74 20 74 6f 20 63 6f 6d 70 75 74 65 2c 20 79 65 74 20 77 65 61 6b 20 65 6e 6f 75 67 | .want.to.compute,.yet.weak.enoug |
| 108ce0 | 68 20 74 6f 20 68 61 76 65 20 61 0a 63 6f 6e 74 72 6f 6c 6c 61 62 6c 65 20 70 72 6f 63 65 64 75 | h.to.have.a.controllable.procedu |
| 108d00 | 72 61 6c 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 2e 20 20 54 68 65 20 69 6e 74 65 6e 74 69 | ral.interpretation...The.intenti |
| 108d20 | 6f 6e 20 68 65 72 65 20 69 73 20 74 68 61 74 2c 20 6f 6e 0a 74 68 65 20 6f 6e 65 20 68 61 6e 64 | on.here.is.that,.on.the.one.hand |
| 108d40 | 2c 20 61 20 70 72 6f 67 72 61 6d 20 73 70 65 63 69 66 69 65 64 20 69 6e 20 61 20 6c 6f 67 69 63 | ,.a.program.specified.in.a.logic |
| 108d60 | 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 0a 73 68 6f 75 6c 64 20 62 65 20 | .programming.language.should.be. |
| 108d80 | 61 6e 20 65 66 66 65 63 74 69 76 65 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 63 61 6e 20 62 65 | an.effective.program.that.can.be |
| 108da0 | 20 63 61 72 72 69 65 64 20 6f 75 74 20 62 79 20 61 20 63 6f 6d 70 75 74 65 72 2e 0a 43 6f 6e 74 | .carried.out.by.a.computer..Cont |
| 108dc0 | 72 6f 6c 20 28 22 68 6f 77 22 20 74 6f 20 63 6f 6d 70 75 74 65 29 20 69 73 20 65 66 66 65 63 74 | rol.("how".to.compute).is.effect |
| 108de0 | 65 64 20 62 79 20 75 73 69 6e 67 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 65 76 61 6c 75 61 74 | ed.by.using.the.order.of.evaluat |
| 108e00 | 69 6f 6e 0a 6f 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 2e 20 20 57 65 20 73 68 6f 75 6c 64 20 | ion.of.the.language...We.should. |
| 108e20 | 62 65 20 61 62 6c 65 20 74 6f 20 61 72 72 61 6e 67 65 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 | be.able.to.arrange.the.order.of. |
| 108e40 | 63 6c 61 75 73 65 73 20 61 6e 64 0a 74 68 65 20 6f 72 64 65 72 20 6f 66 20 73 75 62 67 6f 61 6c | clauses.and.the.order.of.subgoal |
| 108e60 | 73 20 77 69 74 68 69 6e 20 65 61 63 68 20 63 6c 61 75 73 65 20 73 6f 20 74 68 61 74 20 74 68 65 | s.within.each.clause.so.that.the |
| 108e80 | 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 69 73 0a 64 6f 6e 65 20 69 6e 20 61 6e 20 6f 72 64 65 72 | .computation.is.done.in.an.order |
| 108ea0 | 20 64 65 65 6d 65 64 20 74 6f 20 62 65 20 65 66 66 65 63 74 69 76 65 20 61 6e 64 20 65 66 66 69 | .deemed.to.be.effective.and.effi |
| 108ec0 | 63 69 65 6e 74 2e 20 20 41 74 20 74 68 65 20 73 61 6d 65 0a 74 69 6d 65 2c 20 77 65 20 73 68 6f | cient...At.the.same.time,.we.sho |
| 108ee0 | 75 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 76 69 65 77 20 74 68 65 20 72 65 73 75 6c 74 20 6f | uld.be.able.to.view.the.result.o |
| 108f00 | 66 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 28 22 77 68 61 74 22 0a 74 6f 20 63 6f 6d | f.the.computation.("what".to.com |
| 108f20 | 70 75 74 65 29 20 61 73 20 61 20 73 69 6d 70 6c 65 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 6f 66 | pute).as.a.simple.consequence.of |
| 108f40 | 20 74 68 65 20 6c 61 77 73 20 6f 66 20 6c 6f 67 69 63 2e 0a 0a 20 20 20 4f 75 72 20 71 75 65 72 | .the.laws.of.logic......Our.quer |
| 108f60 | 79 20 6c 61 6e 67 75 61 67 65 20 63 61 6e 20 62 65 20 72 65 67 61 72 64 65 64 20 61 73 20 6a 75 | y.language.can.be.regarded.as.ju |
| 108f80 | 73 74 20 73 75 63 68 20 61 20 70 72 6f 63 65 64 75 72 61 6c 6c 79 0a 69 6e 74 65 72 70 72 65 74 | st.such.a.procedurally.interpret |
| 108fa0 | 61 62 6c 65 20 73 75 62 73 65 74 20 6f 66 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6c 6f 67 69 | able.subset.of.mathematical.logi |
| 108fc0 | 63 2e 20 20 41 6e 20 61 73 73 65 72 74 69 6f 6e 20 72 65 70 72 65 73 65 6e 74 73 20 61 0a 73 69 | c...An.assertion.represents.a.si |
| 108fe0 | 6d 70 6c 65 20 66 61 63 74 20 28 61 6e 20 61 74 6f 6d 69 63 20 70 72 6f 70 6f 73 69 74 69 6f 6e | mple.fact.(an.atomic.proposition |
| 109000 | 29 2e 20 20 41 20 72 75 6c 65 20 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 20 69 6d 70 6c 69 63 | )...A.rule.represents.the.implic |
| 109020 | 61 74 69 6f 6e 0a 74 68 61 74 20 74 68 65 20 72 75 6c 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 20 68 | ation.that.the.rule.conclusion.h |
| 109040 | 6f 6c 64 73 20 66 6f 72 20 74 68 6f 73 65 20 63 61 73 65 73 20 77 68 65 72 65 20 74 68 65 20 72 | olds.for.those.cases.where.the.r |
| 109060 | 75 6c 65 20 62 6f 64 79 0a 68 6f 6c 64 73 2e 20 20 41 20 72 75 6c 65 20 68 61 73 20 61 20 6e 61 | ule.body.holds...A.rule.has.a.na |
| 109080 | 74 75 72 61 6c 20 70 72 6f 63 65 64 75 72 61 6c 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 3a | tural.procedural.interpretation: |
| 1090a0 | 20 54 6f 20 65 73 74 61 62 6c 69 73 68 0a 74 68 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 20 6f 66 20 | .To.establish.the.conclusion.of. |
| 1090c0 | 74 68 65 20 72 75 6c 65 2c 20 65 73 74 61 62 6c 69 73 68 20 74 68 65 20 62 6f 64 79 20 6f 66 20 | the.rule,.establish.the.body.of. |
| 1090e0 | 74 68 65 20 72 75 6c 65 2e 20 20 52 75 6c 65 73 2c 0a 74 68 65 72 65 66 6f 72 65 2c 20 73 70 65 | the.rule...Rules,.therefore,.spe |
| 109100 | 63 69 66 79 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 2e 20 20 48 6f 77 65 76 65 72 2c 20 62 65 63 | cify.computations...However,.bec |
| 109120 | 61 75 73 65 20 72 75 6c 65 73 20 63 61 6e 20 61 6c 73 6f 20 62 65 0a 72 65 67 61 72 64 65 64 20 | ause.rules.can.also.be.regarded. |
| 109140 | 61 73 20 73 74 61 74 65 6d 65 6e 74 73 20 6f 66 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6c 6f | as.statements.of.mathematical.lo |
| 109160 | 67 69 63 2c 20 77 65 20 63 61 6e 20 6a 75 73 74 69 66 79 20 61 6e 79 0a 22 69 6e 66 65 72 65 6e | gic,.we.can.justify.any."inferen |
| 109180 | 63 65 22 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 61 20 6c 6f 67 69 63 20 70 72 6f 67 | ce".accomplished.by.a.logic.prog |
| 1091a0 | 72 61 6d 20 62 79 20 61 73 73 65 72 74 69 6e 67 20 74 68 61 74 20 74 68 65 20 73 61 6d 65 0a 72 | ram.by.asserting.that.the.same.r |
| 1091c0 | 65 73 75 6c 74 20 63 6f 75 6c 64 20 62 65 20 6f 62 74 61 69 6e 65 64 20 62 79 20 77 6f 72 6b 69 | esult.could.be.obtained.by.worki |
| 1091e0 | 6e 67 20 65 6e 74 69 72 65 6c 79 20 77 69 74 68 69 6e 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 0a | ng.entirely.within.mathematical. |
| 109200 | 6c 6f 67 69 63 2e 28 32 29 0a 0a 49 6e 66 69 6e 69 74 65 20 6c 6f 6f 70 73 0a 2e 2e 2e 2e 2e 2e | logic.(2)..Infinite.loops....... |
| 109220 | 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 6f 66 20 74 68 65 20 70 | ..........A.consequence.of.the.p |
| 109240 | 72 6f 63 65 64 75 72 61 6c 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 6c 6f 67 69 | rocedural.interpretation.of.logi |
| 109260 | 63 20 70 72 6f 67 72 61 6d 73 20 69 73 0a 74 68 61 74 20 69 74 20 69 73 20 70 6f 73 73 69 62 6c | c.programs.is.that.it.is.possibl |
| 109280 | 65 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 68 6f 70 65 6c 65 73 73 6c 79 20 69 6e 65 66 66 69 | e.to.construct.hopelessly.ineffi |
| 1092a0 | 63 69 65 6e 74 20 70 72 6f 67 72 61 6d 73 20 66 6f 72 0a 73 6f 6c 76 69 6e 67 20 63 65 72 74 61 | cient.programs.for.solving.certa |
| 1092c0 | 69 6e 20 70 72 6f 62 6c 65 6d 73 2e 20 20 41 6e 20 65 78 74 72 65 6d 65 20 63 61 73 65 20 6f 66 | in.problems...An.extreme.case.of |
| 1092e0 | 20 69 6e 65 66 66 69 63 69 65 6e 63 79 20 6f 63 63 75 72 73 20 77 68 65 6e 0a 74 68 65 20 73 79 | .inefficiency.occurs.when.the.sy |
| 109300 | 73 74 65 6d 20 66 61 6c 6c 73 20 69 6e 74 6f 20 69 6e 66 69 6e 69 74 65 20 6c 6f 6f 70 73 20 69 | stem.falls.into.infinite.loops.i |
| 109320 | 6e 20 6d 61 6b 69 6e 67 20 64 65 64 75 63 74 69 6f 6e 73 2e 20 20 41 73 20 61 20 73 69 6d 70 6c | n.making.deductions...As.a.simpl |
| 109340 | 65 0a 65 78 61 6d 70 6c 65 2c 20 73 75 70 70 6f 73 65 20 77 65 20 61 72 65 20 73 65 74 74 69 6e | e.example,.suppose.we.are.settin |
| 109360 | 67 20 75 70 20 61 20 64 61 74 61 20 62 61 73 65 20 6f 66 20 66 61 6d 6f 75 73 20 6d 61 72 72 69 | g.up.a.data.base.of.famous.marri |
| 109380 | 61 67 65 73 2c 0a 69 6e 63 6c 75 64 69 6e 67 0a 0a 20 20 20 20 20 28 61 73 73 65 72 74 21 20 28 | ages,.including.......(assert!.( |
| 1093a0 | 6d 61 72 72 69 65 64 20 4d 69 6e 6e 69 65 20 4d 69 63 6b 65 79 29 29 0a 0a 20 20 20 49 66 20 77 | married.Minnie.Mickey)).....If.w |
| 1093c0 | 65 20 6e 6f 77 20 61 73 6b 0a 0a 20 20 20 20 20 28 6d 61 72 72 69 65 64 20 4d 69 63 6b 65 79 20 | e.now.ask.......(married.Mickey. |
| 1093e0 | 3f 77 68 6f 29 0a 0a 77 65 20 77 69 6c 6c 20 67 65 74 20 6e 6f 20 72 65 73 70 6f 6e 73 65 2c 20 | ?who)..we.will.get.no.response,. |
| 109400 | 62 65 63 61 75 73 65 20 74 68 65 20 73 79 73 74 65 6d 20 64 6f 65 73 6e 27 74 20 6b 6e 6f 77 20 | because.the.system.doesn't.know. |
| 109420 | 74 68 61 74 20 69 66 20 41 20 69 73 0a 6d 61 72 72 69 65 64 20 74 6f 20 42 2c 20 74 68 65 6e 20 | that.if.A.is.married.to.B,.then. |
| 109440 | 42 20 69 73 20 6d 61 72 72 69 65 64 20 74 6f 20 41 2e 20 20 53 6f 20 77 65 20 61 73 73 65 72 74 | B.is.married.to.A...So.we.assert |
| 109460 | 20 74 68 65 20 72 75 6c 65 0a 0a 20 20 20 20 20 28 61 73 73 65 72 74 21 20 28 72 75 6c 65 20 28 | .the.rule.......(assert!.(rule.( |
| 109480 | 6d 61 72 72 69 65 64 20 3f 78 20 3f 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | married.?x.?y).................. |
| 1094a0 | 20 20 20 28 6d 61 72 72 69 65 64 20 3f 79 20 3f 78 29 29 29 0a 0a 61 6e 64 20 61 67 61 69 6e 20 | ...(married.?y.?x)))..and.again. |
| 1094c0 | 71 75 65 72 79 0a 0a 20 20 20 20 20 28 6d 61 72 72 69 65 64 20 4d 69 63 6b 65 79 20 3f 77 68 6f | query.......(married.Mickey.?who |
| 1094e0 | 29 0a 0a 20 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 74 68 69 73 20 77 69 6c 6c 20 64 | ).....Unfortunately,.this.will.d |
| 109500 | 72 69 76 65 20 74 68 65 20 73 79 73 74 65 6d 20 69 6e 74 6f 20 61 6e 20 69 6e 66 69 6e 69 74 65 | rive.the.system.into.an.infinite |
| 109520 | 20 6c 6f 6f 70 2c 20 61 73 0a 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 2a 20 54 68 65 20 73 79 73 | .loop,.as.follows:.....*.The.sys |
| 109540 | 74 65 6d 20 66 69 6e 64 73 20 74 68 61 74 20 74 68 65 20 60 6d 61 72 72 69 65 64 27 20 72 75 6c | tem.finds.that.the.`married'.rul |
| 109560 | 65 20 69 73 20 61 70 70 6c 69 63 61 62 6c 65 3b 20 74 68 61 74 20 69 73 2c 0a 20 20 20 20 20 74 | e.is.applicable;.that.is,......t |
| 109580 | 68 65 20 72 75 6c 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 20 60 28 6d 61 72 72 69 65 64 20 3f 78 20 | he.rule.conclusion.`(married.?x. |
| 1095a0 | 3f 79 29 27 20 73 75 63 63 65 73 73 66 75 6c 6c 79 20 75 6e 69 66 69 65 73 20 77 69 74 68 0a 20 | ?y)'.successfully.unifies.with.. |
| 1095c0 | 20 20 20 20 74 68 65 20 71 75 65 72 79 20 70 61 74 74 65 72 6e 20 60 28 6d 61 72 72 69 65 64 20 | ....the.query.pattern.`(married. |
| 1095e0 | 4d 69 63 6b 65 79 20 3f 77 68 6f 29 27 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 66 72 61 6d 65 | Mickey.?who)'.to.produce.a.frame |
| 109600 | 20 69 6e 0a 20 20 20 20 20 77 68 69 63 68 20 60 3f 78 27 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 | .in......which.`?x'.is.bound.to. |
| 109620 | 60 4d 69 63 6b 65 79 27 20 61 6e 64 20 60 3f 79 27 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 60 3f | `Mickey'.and.`?y'.is.bound.to.`? |
| 109640 | 77 68 6f 27 2e 20 20 53 6f 0a 20 20 20 20 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 70 | who'...So......the.interpreter.p |
| 109660 | 72 6f 63 65 65 64 73 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 72 75 6c 65 20 62 6f 64 | roceeds.to.evaluate.the.rule.bod |
| 109680 | 79 20 60 28 6d 61 72 72 69 65 64 20 3f 79 0a 20 20 20 20 20 3f 78 29 27 20 69 6e 20 74 68 69 73 | y.`(married.?y......?x)'.in.this |
| 1096a0 | 20 66 72 61 6d 65 2d 2d 69 6e 20 65 66 66 65 63 74 2c 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 | .frame--in.effect,.to.process.th |
| 1096c0 | 65 20 71 75 65 72 79 20 60 28 6d 61 72 72 69 65 64 20 3f 77 68 6f 0a 20 20 20 20 20 4d 69 63 6b | e.query.`(married.?who......Mick |
| 1096e0 | 65 79 29 27 2e 0a 0a 20 20 20 2a 20 4f 6e 65 20 61 6e 73 77 65 72 20 61 70 70 65 61 72 73 20 64 | ey)'......*.One.answer.appears.d |
| 109700 | 69 72 65 63 74 6c 79 20 61 73 20 61 6e 20 61 73 73 65 72 74 69 6f 6e 20 69 6e 20 74 68 65 20 64 | irectly.as.an.assertion.in.the.d |
| 109720 | 61 74 61 20 62 61 73 65 3a 0a 20 20 20 20 20 60 28 6d 61 72 72 69 65 64 20 4d 69 6e 6e 69 65 20 | ata.base:......`(married.Minnie. |
| 109740 | 4d 69 63 6b 65 79 29 27 2e 0a 0a 20 20 20 2a 20 54 68 65 20 60 6d 61 72 72 69 65 64 27 20 72 75 | Mickey)'......*.The.`married'.ru |
| 109760 | 6c 65 20 69 73 20 61 6c 73 6f 20 61 70 70 6c 69 63 61 62 6c 65 2c 20 73 6f 20 74 68 65 20 69 6e | le.is.also.applicable,.so.the.in |
| 109780 | 74 65 72 70 72 65 74 65 72 20 61 67 61 69 6e 0a 20 20 20 20 20 65 76 61 6c 75 61 74 65 73 20 74 | terpreter.again......evaluates.t |
| 1097a0 | 68 65 20 72 75 6c 65 20 62 6f 64 79 2c 20 77 68 69 63 68 20 74 68 69 73 20 74 69 6d 65 20 69 73 | he.rule.body,.which.this.time.is |
| 1097c0 | 20 65 71 75 69 76 61 6c 65 6e 74 20 74 6f 0a 20 20 20 20 20 60 28 6d 61 72 72 69 65 64 20 4d 69 | .equivalent.to......`(married.Mi |
| 1097e0 | 63 6b 65 79 20 3f 77 68 6f 29 27 2e 0a 0a 0a 20 20 20 54 68 65 20 73 79 73 74 65 6d 20 69 73 20 | ckey.?who)'.......The.system.is. |
| 109800 | 6e 6f 77 20 69 6e 20 61 6e 20 69 6e 66 69 6e 69 74 65 20 6c 6f 6f 70 2e 20 20 49 6e 64 65 65 64 | now.in.an.infinite.loop...Indeed |
| 109820 | 2c 20 77 68 65 74 68 65 72 20 74 68 65 20 73 79 73 74 65 6d 0a 77 69 6c 6c 20 66 69 6e 64 20 74 | ,.whether.the.system.will.find.t |
| 109840 | 68 65 20 73 69 6d 70 6c 65 20 61 6e 73 77 65 72 20 60 28 6d 61 72 72 69 65 64 20 4d 69 6e 6e 69 | he.simple.answer.`(married.Minni |
| 109860 | 65 20 4d 69 63 6b 65 79 29 27 20 62 65 66 6f 72 65 20 69 74 20 67 6f 65 73 0a 69 6e 74 6f 20 74 | e.Mickey)'.before.it.goes.into.t |
| 109880 | 68 65 20 6c 6f 6f 70 20 64 65 70 65 6e 64 73 20 6f 6e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | he.loop.depends.on.implementatio |
| 1098a0 | 6e 20 64 65 74 61 69 6c 73 20 63 6f 6e 63 65 72 6e 69 6e 67 20 74 68 65 20 6f 72 64 65 72 20 69 | n.details.concerning.the.order.i |
| 1098c0 | 6e 0a 77 68 69 63 68 20 74 68 65 20 73 79 73 74 65 6d 20 63 68 65 63 6b 73 20 74 68 65 20 69 74 | n.which.the.system.checks.the.it |
| 1098e0 | 65 6d 73 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 20 20 54 68 69 73 20 69 73 20 61 | ems.in.the.data.base...This.is.a |
| 109900 | 20 76 65 72 79 0a 73 69 6d 70 6c 65 20 65 78 61 6d 70 6c 65 20 6f 66 20 74 68 65 20 6b 69 6e 64 | .very.simple.example.of.the.kind |
| 109920 | 73 20 6f 66 20 6c 6f 6f 70 73 20 74 68 61 74 20 63 61 6e 20 6f 63 63 75 72 2e 20 20 43 6f 6c 6c | s.of.loops.that.can.occur...Coll |
| 109940 | 65 63 74 69 6f 6e 73 20 6f 66 0a 69 6e 74 65 72 72 65 6c 61 74 65 64 20 72 75 6c 65 73 20 63 61 | ections.of.interrelated.rules.ca |
| 109960 | 6e 20 6c 65 61 64 20 74 6f 20 6c 6f 6f 70 73 20 74 68 61 74 20 61 72 65 20 6d 75 63 68 20 68 61 | n.lead.to.loops.that.are.much.ha |
| 109980 | 72 64 65 72 20 74 6f 0a 61 6e 74 69 63 69 70 61 74 65 2c 20 61 6e 64 20 74 68 65 20 61 70 70 65 | rder.to.anticipate,.and.the.appe |
| 1099a0 | 61 72 61 6e 63 65 20 6f 66 20 61 20 6c 6f 6f 70 20 63 61 6e 20 64 65 70 65 6e 64 20 6f 6e 20 74 | arance.of.a.loop.can.depend.on.t |
| 1099c0 | 68 65 20 6f 72 64 65 72 20 6f 66 0a 63 6c 61 75 73 65 73 20 69 6e 20 61 6e 20 60 61 6e 64 27 20 | he.order.of.clauses.in.an.`and'. |
| 1099e0 | 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 36 34 3a 3a 29 20 6f 72 20 6f | (see.*Note.Exercise.4-64::).or.o |
| 109a00 | 6e 20 6c 6f 77 2d 6c 65 76 65 6c 20 64 65 74 61 69 6c 73 0a 63 6f 6e 63 65 72 6e 69 6e 67 20 74 | n.low-level.details.concerning.t |
| 109a20 | 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 73 79 73 74 65 6d 20 70 72 6f | he.order.in.which.the.system.pro |
| 109a40 | 63 65 73 73 65 73 20 71 75 65 72 69 65 73 2e 28 33 29 0a 0a 50 72 6f 62 6c 65 6d 73 20 77 69 74 | cesses.queries.(3)..Problems.wit |
| 109a60 | 68 20 60 6e 6f 74 27 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 6e 6f | h.`not'......................Ano |
| 109a80 | 74 68 65 72 20 71 75 69 72 6b 20 69 6e 20 74 68 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 20 63 | ther.quirk.in.the.query.system.c |
| 109aa0 | 6f 6e 63 65 72 6e 73 20 60 6e 6f 74 27 2e 20 20 47 69 76 65 6e 20 74 68 65 20 64 61 74 61 20 62 | oncerns.`not'...Given.the.data.b |
| 109ac0 | 61 73 65 0a 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 31 3a 3a 2c 20 63 6f | ase.of.section.*Note.4-4-1::,.co |
| 109ae0 | 6e 73 69 64 65 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 77 6f 20 71 75 65 72 69 65 73 | nsider.the.following.two.queries |
| 109b00 | 3a 0a 0a 20 20 20 20 20 28 61 6e 64 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 78 20 3f 79 29 0a | :.......(and.(supervisor.?x.?y). |
| 109b20 | 20 20 20 20 20 20 20 20 20 20 28 6e 6f 74 20 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 | ..........(not.(job.?x.(computer |
| 109b40 | 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 29 29 0a 0a 20 20 20 20 20 28 61 6e 64 20 28 6e 6f 74 20 | .programmer)))).......(and.(not. |
| 109b60 | 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 29 0a | (job.?x.(computer.programmer))). |
| 109b80 | 20 20 20 20 20 20 20 20 20 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 78 20 3f 79 29 29 0a 0a 20 | ..........(supervisor.?x.?y))... |
| 109ba0 | 20 20 54 68 65 73 65 20 74 77 6f 20 71 75 65 72 69 65 73 20 64 6f 20 6e 6f 74 20 70 72 6f 64 75 | ..These.two.queries.do.not.produ |
| 109bc0 | 63 65 20 74 68 65 20 73 61 6d 65 20 72 65 73 75 6c 74 2e 20 20 54 68 65 20 66 69 72 73 74 20 71 | ce.the.same.result...The.first.q |
| 109be0 | 75 65 72 79 0a 62 65 67 69 6e 73 20 62 79 20 66 69 6e 64 69 6e 67 20 61 6c 6c 20 65 6e 74 72 69 | uery.begins.by.finding.all.entri |
| 109c00 | 65 73 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 74 68 61 74 20 6d 61 74 63 68 20 60 | es.in.the.data.base.that.match.` |
| 109c20 | 28 73 75 70 65 72 76 69 73 6f 72 0a 3f 78 20 3f 79 29 27 2c 20 61 6e 64 20 74 68 65 6e 20 66 69 | (supervisor.?x.?y)',.and.then.fi |
| 109c40 | 6c 74 65 72 73 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 66 72 61 6d 65 73 20 62 79 20 72 65 | lters.the.resulting.frames.by.re |
| 109c60 | 6d 6f 76 69 6e 67 20 74 68 65 20 6f 6e 65 73 20 69 6e 0a 77 68 69 63 68 20 74 68 65 20 76 61 6c | moving.the.ones.in.which.the.val |
| 109c80 | 75 65 20 6f 66 20 60 3f 78 27 20 73 61 74 69 73 66 69 65 73 20 60 28 6a 6f 62 20 3f 78 20 28 63 | ue.of.`?x'.satisfies.`(job.?x.(c |
| 109ca0 | 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 27 2e 0a 54 68 65 20 73 65 63 6f 6e | omputer.programmer))'..The.secon |
| 109cc0 | 64 20 71 75 65 72 79 20 62 65 67 69 6e 73 20 62 79 20 66 69 6c 74 65 72 69 6e 67 20 74 68 65 20 | d.query.begins.by.filtering.the. |
| 109ce0 | 69 6e 63 6f 6d 69 6e 67 20 66 72 61 6d 65 73 20 74 6f 20 72 65 6d 6f 76 65 0a 74 68 6f 73 65 20 | incoming.frames.to.remove.those. |
| 109d00 | 74 68 61 74 20 63 61 6e 20 73 61 74 69 73 66 79 20 60 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 | that.can.satisfy.`(job.?x.(compu |
| 109d20 | 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 27 2e 20 20 53 69 6e 63 65 20 74 68 65 0a 6f 6e | ter.programmer))'...Since.the.on |
| 109d40 | 6c 79 20 69 6e 63 6f 6d 69 6e 67 20 66 72 61 6d 65 20 69 73 20 65 6d 70 74 79 2c 20 69 74 20 63 | ly.incoming.frame.is.empty,.it.c |
| 109d60 | 68 65 63 6b 73 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 74 6f 20 73 65 65 20 69 66 20 74 68 | hecks.the.data.base.to.see.if.th |
| 109d80 | 65 72 65 0a 61 72 65 20 61 6e 79 20 70 61 74 74 65 72 6e 73 20 74 68 61 74 20 73 61 74 69 73 66 | ere.are.any.patterns.that.satisf |
| 109da0 | 79 20 60 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 | y.`(job.?x.(computer.programmer) |
| 109dc0 | 29 27 2e 20 20 53 69 6e 63 65 0a 74 68 65 72 65 20 67 65 6e 65 72 61 6c 6c 79 20 61 72 65 20 65 | )'...Since.there.generally.are.e |
| 109de0 | 6e 74 72 69 65 73 20 6f 66 20 74 68 69 73 20 66 6f 72 6d 2c 20 74 68 65 20 60 6e 6f 74 27 20 63 | ntries.of.this.form,.the.`not'.c |
| 109e00 | 6c 61 75 73 65 20 66 69 6c 74 65 72 73 20 6f 75 74 0a 74 68 65 20 65 6d 70 74 79 20 66 72 61 6d | lause.filters.out.the.empty.fram |
| 109e20 | 65 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 6e 20 65 6d 70 74 79 20 73 74 72 65 61 6d 20 6f 66 | e.and.returns.an.empty.stream.of |
| 109e40 | 20 66 72 61 6d 65 73 2e 20 20 43 6f 6e 73 65 71 75 65 6e 74 6c 79 2c 0a 74 68 65 20 65 6e 74 69 | .frames...Consequently,.the.enti |
| 109e60 | 72 65 20 63 6f 6d 70 6f 75 6e 64 20 71 75 65 72 79 20 72 65 74 75 72 6e 73 20 61 6e 20 65 6d 70 | re.compound.query.returns.an.emp |
| 109e80 | 74 79 20 73 74 72 65 61 6d 2e 0a 0a 20 20 20 54 68 65 20 74 72 6f 75 62 6c 65 20 69 73 20 74 68 | ty.stream......The.trouble.is.th |
| 109ea0 | 61 74 20 6f 75 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 60 6e 6f 74 27 20 72 | at.our.implementation.of.`not'.r |
| 109ec0 | 65 61 6c 6c 79 20 69 73 20 6d 65 61 6e 74 20 74 6f 0a 73 65 72 76 65 20 61 73 20 61 20 66 69 6c | eally.is.meant.to.serve.as.a.fil |
| 109ee0 | 74 65 72 20 6f 6e 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 2e | ter.on.values.for.the.variables. |
| 109f00 | 20 20 49 66 20 61 20 60 6e 6f 74 27 20 63 6c 61 75 73 65 20 69 73 0a 70 72 6f 63 65 73 73 65 64 | ..If.a.`not'.clause.is.processed |
| 109f20 | 20 77 69 74 68 20 61 20 66 72 61 6d 65 20 69 6e 20 77 68 69 63 68 20 73 6f 6d 65 20 6f 66 20 74 | .with.a.frame.in.which.some.of.t |
| 109f40 | 68 65 20 76 61 72 69 61 62 6c 65 73 20 72 65 6d 61 69 6e 20 75 6e 62 6f 75 6e 64 0a 28 61 73 20 | he.variables.remain.unbound.(as. |
| 109f60 | 64 6f 65 73 20 60 3f 78 27 20 69 6e 20 74 68 65 20 65 78 61 6d 70 6c 65 20 61 62 6f 76 65 29 2c | does.`?x'.in.the.example.above), |
| 109f80 | 20 74 68 65 20 73 79 73 74 65 6d 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 75 6e 65 78 70 65 63 | .the.system.will.produce.unexpec |
| 109fa0 | 74 65 64 0a 72 65 73 75 6c 74 73 2e 20 53 69 6d 69 6c 61 72 20 70 72 6f 62 6c 65 6d 73 20 6f 63 | ted.results..Similar.problems.oc |
| 109fc0 | 63 75 72 20 77 69 74 68 20 74 68 65 20 75 73 65 20 6f 66 20 60 6c 69 73 70 2d 76 61 6c 75 65 27 | cur.with.the.use.of.`lisp-value' |
| 109fe0 | 2d 2d 74 68 65 20 4c 69 73 70 0a 70 72 65 64 69 63 61 74 65 20 63 61 6e 27 74 20 77 6f 72 6b 20 | --the.Lisp.predicate.can't.work. |
| 10a000 | 69 66 20 73 6f 6d 65 20 6f 66 20 69 74 73 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 75 6e 62 | if.some.of.its.arguments.are.unb |
| 10a020 | 6f 75 6e 64 2e 20 20 53 65 65 20 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 20 34 2d 37 37 3a 3a | ound...See.*Note.Exercise.4-77:: |
| 10a040 | 2e 0a 0a 20 20 20 54 68 65 72 65 20 69 73 20 61 6c 73 6f 20 61 20 6d 75 63 68 20 6d 6f 72 65 20 | ......There.is.also.a.much.more. |
| 10a060 | 73 65 72 69 6f 75 73 20 77 61 79 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 60 6e 6f 74 27 20 6f | serious.way.in.which.the.`not'.o |
| 10a080 | 66 20 74 68 65 20 71 75 65 72 79 0a 6c 61 6e 67 75 61 67 65 20 64 69 66 66 65 72 73 20 66 72 6f | f.the.query.language.differs.fro |
| 10a0a0 | 6d 20 74 68 65 20 60 6e 6f 74 27 20 6f 66 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6c 6f 67 69 | m.the.`not'.of.mathematical.logi |
| 10a0c0 | 63 2e 20 20 49 6e 20 6c 6f 67 69 63 2c 20 77 65 0a 69 6e 74 65 72 70 72 65 74 20 74 68 65 20 73 | c...In.logic,.we.interpret.the.s |
| 10a0e0 | 74 61 74 65 6d 65 6e 74 20 22 6e 6f 74 20 50 22 20 74 6f 20 6d 65 61 6e 20 74 68 61 74 20 50 20 | tatement."not.P".to.mean.that.P. |
| 10a100 | 69 73 20 6e 6f 74 20 74 72 75 65 2e 20 20 49 6e 20 74 68 65 0a 71 75 65 72 79 20 73 79 73 74 65 | is.not.true...In.the.query.syste |
| 10a120 | 6d 2c 20 68 6f 77 65 76 65 72 2c 20 22 6e 6f 74 20 50 22 20 6d 65 61 6e 73 20 74 68 61 74 20 50 | m,.however,."not.P".means.that.P |
| 10a140 | 20 69 73 20 6e 6f 74 20 64 65 64 75 63 69 62 6c 65 20 66 72 6f 6d 20 74 68 65 0a 6b 6e 6f 77 6c | .is.not.deducible.from.the.knowl |
| 10a160 | 65 64 67 65 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 20 20 46 6f 72 20 65 78 61 6d | edge.in.the.data.base...For.exam |
| 10a180 | 70 6c 65 2c 20 67 69 76 65 6e 20 74 68 65 20 70 65 72 73 6f 6e 6e 65 6c 20 64 61 74 61 20 62 61 | ple,.given.the.personnel.data.ba |
| 10a1a0 | 73 65 0a 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 31 3a 3a 2c 20 74 68 65 | se.of.section.*Note.4-4-1::,.the |
| 10a1c0 | 20 73 79 73 74 65 6d 20 77 6f 75 6c 64 20 68 61 70 70 69 6c 79 20 64 65 64 75 63 65 20 61 6c 6c | .system.would.happily.deduce.all |
| 10a1e0 | 20 73 6f 72 74 73 20 6f 66 0a 60 6e 6f 74 27 20 73 74 61 74 65 6d 65 6e 74 73 2c 20 73 75 63 68 | .sorts.of.`not'.statements,.such |
| 10a200 | 20 61 73 20 74 68 61 74 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 69 73 20 6e 6f 74 20 61 20 | .as.that.Ben.Bitdiddle.is.not.a. |
| 10a220 | 62 61 73 65 62 61 6c 6c 20 66 61 6e 2c 0a 74 68 61 74 20 69 74 20 69 73 20 6e 6f 74 20 72 61 69 | baseball.fan,.that.it.is.not.rai |
| 10a240 | 6e 69 6e 67 20 6f 75 74 73 69 64 65 2c 20 61 6e 64 20 74 68 61 74 20 32 20 2b 20 32 20 69 73 20 | ning.outside,.and.that.2.+.2.is. |
| 10a260 | 6e 6f 74 20 34 2e 28 34 29 20 49 6e 20 6f 74 68 65 72 0a 77 6f 72 64 73 2c 20 74 68 65 20 60 6e | not.4.(4).In.other.words,.the.`n |
| 10a280 | 6f 74 27 20 6f 66 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 | ot'.of.logic.programming.languag |
| 10a2a0 | 65 73 20 72 65 66 6c 65 63 74 73 20 74 68 65 20 73 6f 2d 63 61 6c 6c 65 64 20 22 63 6c 6f 73 65 | es.reflects.the.so-called."close |
| 10a2c0 | 64 0a 77 6f 72 6c 64 20 61 73 73 75 6d 70 74 69 6f 6e 22 20 74 68 61 74 20 61 6c 6c 20 72 65 6c | d.world.assumption".that.all.rel |
| 10a2e0 | 65 76 61 6e 74 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 69 6e 63 6c 75 | evant.information.has.been.inclu |
| 10a300 | 64 65 64 20 69 6e 0a 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 28 35 29 0a 0a 20 20 20 20 20 2a | ded.in.the.data.base.(5).......* |
| 10a320 | 45 78 65 72 63 69 73 65 20 34 2e 36 34 3a 2a 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 20 6d | Exercise.4.64:*.Louis.Reasoner.m |
| 10a340 | 69 73 74 61 6b 65 6e 6c 79 20 64 65 6c 65 74 65 73 20 74 68 65 0a 20 20 20 20 20 60 6f 75 74 72 | istakenly.deletes.the......`outr |
| 10a360 | 61 6e 6b 65 64 2d 62 79 27 20 72 75 6c 65 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d | anked-by'.rule.(section.*Note.4- |
| 10a380 | 34 2d 31 3a 3a 29 20 66 72 6f 6d 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 0a 20 20 20 20 20 | 4-1::).from.the.data.base....... |
| 10a3a0 | 57 68 65 6e 20 68 65 20 72 65 61 6c 69 7a 65 73 20 74 68 69 73 2c 20 68 65 20 71 75 69 63 6b 6c | When.he.realizes.this,.he.quickl |
| 10a3c0 | 79 20 72 65 69 6e 73 74 61 6c 6c 73 20 69 74 2e 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c | y.reinstalls.it...Unfortunately, |
| 10a3e0 | 0a 20 20 20 20 20 68 65 20 6d 61 6b 65 73 20 61 20 73 6c 69 67 68 74 20 63 68 61 6e 67 65 20 69 | ......he.makes.a.slight.change.i |
| 10a400 | 6e 20 74 68 65 20 72 75 6c 65 2c 20 61 6e 64 20 74 79 70 65 73 20 69 74 20 69 6e 20 61 73 0a 0a | n.the.rule,.and.types.it.in.as.. |
| 10a420 | 20 20 20 20 20 20 20 20 20 20 28 72 75 6c 65 20 28 6f 75 74 72 61 6e 6b 65 64 2d 62 79 20 3f 73 | ..........(rule.(outranked-by.?s |
| 10a440 | 74 61 66 66 2d 70 65 72 73 6f 6e 20 3f 62 6f 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | taff-person.?boss).............. |
| 10a460 | 20 20 20 28 6f 72 20 28 73 75 70 65 72 76 69 73 6f 72 20 3f 73 74 61 66 66 2d 70 65 72 73 6f 6e | ...(or.(supervisor.?staff-person |
| 10a480 | 20 3f 62 6f 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 64 | .?boss).....................(and |
| 10a4a0 | 20 28 6f 75 74 72 61 6e 6b 65 64 2d 62 79 20 3f 6d 69 64 64 6c 65 2d 6d 61 6e 61 67 65 72 20 3f | .(outranked-by.?middle-manager.? |
| 10a4c0 | 62 6f 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | boss)..........................( |
| 10a4e0 | 73 75 70 65 72 76 69 73 6f 72 20 3f 73 74 61 66 66 2d 70 65 72 73 6f 6e 20 3f 6d 69 64 64 6c 65 | supervisor.?staff-person.?middle |
| 10a500 | 2d 6d 61 6e 61 67 65 72 29 29 29 29 0a 0a 20 20 20 20 20 4a 75 73 74 20 61 66 74 65 72 20 4c 6f | -manager)))).......Just.after.Lo |
| 10a520 | 75 69 73 20 74 79 70 65 73 20 74 68 69 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 74 6f 20 | uis.types.this.information.into. |
| 10a540 | 74 68 65 20 73 79 73 74 65 6d 2c 20 44 65 57 69 74 74 0a 20 20 20 20 20 41 75 6c 6c 20 63 6f 6d | the.system,.DeWitt......Aull.com |
| 10a560 | 65 73 20 62 79 20 74 6f 20 66 69 6e 64 20 6f 75 74 20 77 68 6f 20 6f 75 74 72 61 6e 6b 73 20 42 | es.by.to.find.out.who.outranks.B |
| 10a580 | 65 6e 20 42 69 74 64 69 64 64 6c 65 2e 20 48 65 20 69 73 73 75 65 73 0a 20 20 20 20 20 74 68 65 | en.Bitdiddle..He.issues......the |
| 10a5a0 | 20 71 75 65 72 79 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6f 75 74 72 61 6e 6b 65 64 2d 62 79 20 | .query............(outranked-by. |
| 10a5c0 | 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 20 3f 77 68 6f 29 0a 0a 20 20 20 20 20 41 66 74 65 | (Bitdiddle.Ben).?who).......Afte |
| 10a5e0 | 72 20 61 6e 73 77 65 72 69 6e 67 2c 20 74 68 65 20 73 79 73 74 65 6d 20 67 6f 65 73 20 69 6e 74 | r.answering,.the.system.goes.int |
| 10a600 | 6f 20 61 6e 20 69 6e 66 69 6e 69 74 65 20 6c 6f 6f 70 2e 20 20 45 78 70 6c 61 69 6e 0a 20 20 20 | o.an.infinite.loop...Explain.... |
| 10a620 | 20 20 77 68 79 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 36 35 3a 2a 20 43 79 | ..why........*Exercise.4.65:*.Cy |
| 10a640 | 20 44 2e 20 46 65 63 74 2c 20 6c 6f 6f 6b 69 6e 67 20 66 6f 72 77 61 72 64 20 74 6f 20 74 68 65 | .D..Fect,.looking.forward.to.the |
| 10a660 | 20 64 61 79 20 77 68 65 6e 20 68 65 0a 20 20 20 20 20 77 69 6c 6c 20 72 69 73 65 20 69 6e 20 74 | .day.when.he......will.rise.in.t |
| 10a680 | 68 65 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 2c 20 67 69 76 65 73 20 61 20 71 75 65 72 79 20 74 | he.organization,.gives.a.query.t |
| 10a6a0 | 6f 20 66 69 6e 64 20 61 6c 6c 20 74 68 65 0a 20 20 20 20 20 77 68 65 65 6c 73 20 28 75 73 69 6e | o.find.all.the......wheels.(usin |
| 10a6c0 | 67 20 74 68 65 20 60 77 68 65 65 6c 27 20 72 75 6c 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e | g.the.`wheel'.rule.of.section.*N |
| 10a6e0 | 6f 74 65 20 34 2d 34 2d 31 3a 3a 29 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 77 68 65 65 6c 20 | ote.4-4-1::):............(wheel. |
| 10a700 | 3f 77 68 6f 29 0a 0a 20 20 20 20 20 54 6f 20 68 69 73 20 73 75 72 70 72 69 73 65 2c 20 74 68 65 | ?who).......To.his.surprise,.the |
| 10a720 | 20 73 79 73 74 65 6d 20 72 65 73 70 6f 6e 64 73 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 | .system.responds............;;;. |
| 10a740 | 51 75 65 72 79 20 72 65 73 75 6c 74 73 3a 0a 20 20 20 20 20 20 20 20 20 20 28 77 68 65 65 6c 20 | Query.results:...........(wheel. |
| 10a760 | 28 57 61 72 62 75 63 6b 73 20 4f 6c 69 76 65 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 77 68 | (Warbucks.Oliver))...........(wh |
| 10a780 | 65 65 6c 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 | eel.(Bitdiddle.Ben))...........( |
| 10a7a0 | 77 68 65 65 6c 20 28 57 61 72 62 75 63 6b 73 20 4f 6c 69 76 65 72 29 29 0a 20 20 20 20 20 20 20 | wheel.(Warbucks.Oliver))........ |
| 10a7c0 | 20 20 20 28 77 68 65 65 6c 20 28 57 61 72 62 75 63 6b 73 20 4f 6c 69 76 65 72 29 29 0a 20 20 20 | ...(wheel.(Warbucks.Oliver)).... |
| 10a7e0 | 20 20 20 20 20 20 20 28 77 68 65 65 6c 20 28 57 61 72 62 75 63 6b 73 20 4f 6c 69 76 65 72 29 29 | .......(wheel.(Warbucks.Oliver)) |
| 10a800 | 0a 0a 20 20 20 20 20 57 68 79 20 69 73 20 4f 6c 69 76 65 72 20 57 61 72 62 75 63 6b 73 20 6c 69 | .......Why.is.Oliver.Warbucks.li |
| 10a820 | 73 74 65 64 20 66 6f 75 72 20 74 69 6d 65 73 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | sted.four.times?.......*Exercise |
| 10a840 | 20 34 2e 36 36 3a 2a 20 42 65 6e 20 68 61 73 20 62 65 65 6e 20 67 65 6e 65 72 61 6c 69 7a 69 6e | .4.66:*.Ben.has.been.generalizin |
| 10a860 | 67 20 74 68 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 20 74 6f 0a 20 20 20 20 20 70 72 6f 76 69 | g.the.query.system.to......provi |
| 10a880 | 64 65 20 73 74 61 74 69 73 74 69 63 73 20 61 62 6f 75 74 20 74 68 65 20 63 6f 6d 70 61 6e 79 2e | de.statistics.about.the.company. |
| 10a8a0 | 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 6f 20 66 69 6e 64 20 74 68 65 0a 20 20 20 20 20 | ..For.example,.to.find.the...... |
| 10a8c0 | 74 6f 74 61 6c 20 73 61 6c 61 72 69 65 73 20 6f 66 20 61 6c 6c 20 74 68 65 20 63 6f 6d 70 75 74 | total.salaries.of.all.the.comput |
| 10a8e0 | 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 6f 6e 65 20 77 69 6c 6c 20 62 65 20 61 62 6c 65 20 | er.programmers.one.will.be.able. |
| 10a900 | 74 6f 0a 20 20 20 20 20 73 61 79 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 75 6d 20 3f 61 6d 6f | to......say............(sum.?amo |
| 10a920 | 75 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 6e 64 20 28 6a 6f 62 20 3f 78 20 | unt................(and.(job.?x. |
| 10a940 | 28 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 0a 20 20 20 20 20 20 20 20 20 | (computer.programmer)).......... |
| 10a960 | 20 20 20 20 20 20 20 20 20 20 20 28 73 61 6c 61 72 79 20 3f 78 20 3f 61 6d 6f 75 6e 74 29 29 29 | ...........(salary.?x.?amount))) |
| 10a980 | 0a 0a 20 20 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 42 65 6e 27 73 20 6e 65 77 20 73 79 73 | .......In.general,.Ben's.new.sys |
| 10a9a0 | 74 65 6d 20 61 6c 6c 6f 77 73 20 65 78 70 72 65 73 73 69 6f 6e 73 20 6f 66 20 74 68 65 20 66 6f | tem.allows.expressions.of.the.fo |
| 10a9c0 | 72 6d 0a 0a 20 20 20 20 20 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 69 6f 6e 2d 66 75 6e 63 | rm............(accumulation-func |
| 10a9e0 | 74 69 6f 6e 20 3c 56 41 52 49 41 42 4c 45 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tion.<VARIABLE>................. |
| 10aa00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 51 55 45 52 59 20 50 41 54 54 45 52 4e 3e | .................<QUERY.PATTERN> |
| 10aa20 | 29 0a 0a 20 20 20 20 20 77 68 65 72 65 20 60 61 63 63 75 6d 75 6c 61 74 69 6f 6e 2d 66 75 6e 63 | ).......where.`accumulation-func |
| 10aa40 | 74 69 6f 6e 27 20 63 61 6e 20 62 65 20 74 68 69 6e 67 73 20 6c 69 6b 65 20 60 73 75 6d 27 2c 20 | tion'.can.be.things.like.`sum',. |
| 10aa60 | 60 61 76 65 72 61 67 65 27 2c 0a 20 20 20 20 20 6f 72 20 60 6d 61 78 69 6d 75 6d 27 2e 20 20 42 | `average',......or.`maximum'...B |
| 10aa80 | 65 6e 20 72 65 61 73 6f 6e 73 20 74 68 61 74 20 69 74 20 73 68 6f 75 6c 64 20 62 65 20 61 20 63 | en.reasons.that.it.should.be.a.c |
| 10aaa0 | 69 6e 63 68 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 0a 20 20 20 20 20 74 68 69 73 2e 20 20 48 65 | inch.to.implement......this...He |
| 10aac0 | 20 77 69 6c 6c 20 73 69 6d 70 6c 79 20 66 65 65 64 20 74 68 65 20 71 75 65 72 79 20 70 61 74 74 | .will.simply.feed.the.query.patt |
| 10aae0 | 65 72 6e 20 74 6f 20 60 71 65 76 61 6c 27 2e 20 20 54 68 69 73 0a 20 20 20 20 20 77 69 6c 6c 20 | ern.to.`qeval'...This......will. |
| 10ab00 | 70 72 6f 64 75 63 65 20 61 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 2e 20 20 48 65 20 | produce.a.stream.of.frames...He. |
| 10ab20 | 77 69 6c 6c 20 74 68 65 6e 20 70 61 73 73 20 74 68 69 73 20 73 74 72 65 61 6d 0a 20 20 20 20 20 | will.then.pass.this.stream...... |
| 10ab40 | 74 68 72 6f 75 67 68 20 61 20 6d 61 70 70 69 6e 67 20 66 75 6e 63 74 69 6f 6e 20 74 68 61 74 20 | through.a.mapping.function.that. |
| 10ab60 | 65 78 74 72 61 63 74 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 20 20 20 20 20 64 | extracts.the.value.of.the......d |
| 10ab80 | 65 73 69 67 6e 61 74 65 64 20 76 61 72 69 61 62 6c 65 20 66 72 6f 6d 20 65 61 63 68 20 66 72 61 | esignated.variable.from.each.fra |
| 10aba0 | 6d 65 20 69 6e 20 74 68 65 20 73 74 72 65 61 6d 20 61 6e 64 20 66 65 65 64 20 74 68 65 0a 20 20 | me.in.the.stream.and.feed.the... |
| 10abc0 | 20 20 20 72 65 73 75 6c 74 69 6e 67 20 73 74 72 65 61 6d 20 6f 66 20 76 61 6c 75 65 73 20 74 6f | ...resulting.stream.of.values.to |
| 10abe0 | 20 74 68 65 20 61 63 63 75 6d 75 6c 61 74 69 6f 6e 20 66 75 6e 63 74 69 6f 6e 2e 20 20 4a 75 73 | .the.accumulation.function...Jus |
| 10ac00 | 74 20 61 73 0a 20 20 20 20 20 42 65 6e 20 63 6f 6d 70 6c 65 74 65 73 20 74 68 65 20 69 6d 70 6c | t.as......Ben.completes.the.impl |
| 10ac20 | 65 6d 65 6e 74 61 74 69 6f 6e 20 61 6e 64 20 69 73 20 61 62 6f 75 74 20 74 6f 20 74 72 79 20 69 | ementation.and.is.about.to.try.i |
| 10ac40 | 74 20 6f 75 74 2c 20 43 79 0a 20 20 20 20 20 77 61 6c 6b 73 20 62 79 2c 20 73 74 69 6c 6c 20 70 | t.out,.Cy......walks.by,.still.p |
| 10ac60 | 75 7a 7a 6c 69 6e 67 20 6f 76 65 72 20 74 68 65 20 60 77 68 65 65 6c 27 20 71 75 65 72 79 20 72 | uzzling.over.the.`wheel'.query.r |
| 10ac80 | 65 73 75 6c 74 20 69 6e 20 65 78 65 72 63 69 73 65 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 | esult.in.exercise......*Note.Exe |
| 10aca0 | 72 63 69 73 65 20 34 2d 36 35 3a 3a 2e 20 20 57 68 65 6e 20 43 79 20 73 68 6f 77 73 20 42 65 6e | rcise.4-65::...When.Cy.shows.Ben |
| 10acc0 | 20 74 68 65 20 73 79 73 74 65 6d 27 73 20 72 65 73 70 6f 6e 73 65 2c 0a 20 20 20 20 20 42 65 6e | .the.system's.response,......Ben |
| 10ace0 | 20 67 72 6f 61 6e 73 2c 20 22 4f 68 2c 20 6e 6f 2c 20 6d 79 20 73 69 6d 70 6c 65 20 61 63 63 75 | .groans,."Oh,.no,.my.simple.accu |
| 10ad00 | 6d 75 6c 61 74 69 6f 6e 20 73 63 68 65 6d 65 20 77 6f 6e 27 74 20 77 6f 72 6b 21 22 0a 0a 20 20 | mulation.scheme.won't.work!".... |
| 10ad20 | 20 20 20 57 68 61 74 20 68 61 73 20 42 65 6e 20 6a 75 73 74 20 72 65 61 6c 69 7a 65 64 3f 20 20 | ...What.has.Ben.just.realized?.. |
| 10ad40 | 4f 75 74 6c 69 6e 65 20 61 20 6d 65 74 68 6f 64 20 68 65 20 63 61 6e 20 75 73 65 20 74 6f 0a 20 | Outline.a.method.he.can.use.to.. |
| 10ad60 | 20 20 20 20 73 61 6c 76 61 67 65 20 74 68 65 20 73 69 74 75 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 | ....salvage.the.situation....... |
| 10ad80 | 20 2a 45 78 65 72 63 69 73 65 20 34 2e 36 37 3a 2a 20 44 65 76 69 73 65 20 61 20 77 61 79 20 74 | .*Exercise.4.67:*.Devise.a.way.t |
| 10ada0 | 6f 20 69 6e 73 74 61 6c 6c 20 61 20 6c 6f 6f 70 20 64 65 74 65 63 74 6f 72 20 69 6e 20 74 68 65 | o.install.a.loop.detector.in.the |
| 10adc0 | 0a 20 20 20 20 20 71 75 65 72 79 20 73 79 73 74 65 6d 20 73 6f 20 61 73 20 74 6f 20 61 76 6f 69 | ......query.system.so.as.to.avoi |
| 10ade0 | 64 20 74 68 65 20 6b 69 6e 64 73 20 6f 66 20 73 69 6d 70 6c 65 20 6c 6f 6f 70 73 20 69 6c 6c 75 | d.the.kinds.of.simple.loops.illu |
| 10ae00 | 73 74 72 61 74 65 64 0a 20 20 20 20 20 69 6e 20 74 68 65 20 74 65 78 74 20 61 6e 64 20 69 6e 20 | strated......in.the.text.and.in. |
| 10ae20 | 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 36 34 3a 3a 2e 20 20 54 68 65 20 67 65 6e 65 | *Note.Exercise.4-64::...The.gene |
| 10ae40 | 72 61 6c 20 69 64 65 61 20 69 73 20 74 68 61 74 0a 20 20 20 20 20 74 68 65 20 73 79 73 74 65 6d | ral.idea.is.that......the.system |
| 10ae60 | 20 73 68 6f 75 6c 64 20 6d 61 69 6e 74 61 69 6e 20 73 6f 6d 65 20 73 6f 72 74 20 6f 66 20 68 69 | .should.maintain.some.sort.of.hi |
| 10ae80 | 73 74 6f 72 79 20 6f 66 20 69 74 73 20 63 75 72 72 65 6e 74 0a 20 20 20 20 20 63 68 61 69 6e 20 | story.of.its.current......chain. |
| 10aea0 | 6f 66 20 64 65 64 75 63 74 69 6f 6e 73 20 61 6e 64 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 67 | of.deductions.and.should.not.beg |
| 10aec0 | 69 6e 20 70 72 6f 63 65 73 73 69 6e 67 20 61 20 71 75 65 72 79 20 74 68 61 74 0a 20 20 20 20 20 | in.processing.a.query.that...... |
| 10aee0 | 69 74 20 69 73 20 61 6c 72 65 61 64 79 20 77 6f 72 6b 69 6e 67 20 6f 6e 2e 20 20 44 65 73 63 72 | it.is.already.working.on...Descr |
| 10af00 | 69 62 65 20 77 68 61 74 20 6b 69 6e 64 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 20 20 20 | ibe.what.kind.of.information.... |
| 10af20 | 20 20 28 70 61 74 74 65 72 6e 73 20 61 6e 64 20 66 72 61 6d 65 73 29 20 69 73 20 69 6e 63 6c 75 | ..(patterns.and.frames).is.inclu |
| 10af40 | 64 65 64 20 69 6e 20 74 68 69 73 20 68 69 73 74 6f 72 79 2c 20 61 6e 64 20 68 6f 77 20 74 68 65 | ded.in.this.history,.and.how.the |
| 10af60 | 0a 20 20 20 20 20 63 68 65 63 6b 20 73 68 6f 75 6c 64 20 62 65 20 6d 61 64 65 2e 20 20 28 41 66 | ......check.should.be.made...(Af |
| 10af80 | 74 65 72 20 79 6f 75 20 73 74 75 64 79 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 74 68 65 | ter.you.study.the.details.of.the |
| 10afa0 | 0a 20 20 20 20 20 71 75 65 72 79 2d 73 79 73 74 65 6d 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | ......query-system.implementatio |
| 10afc0 | 6e 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 3a 3a 2c 20 79 6f 75 20 | n.in.section.*Note.4-4-4::,.you. |
| 10afe0 | 6d 61 79 20 77 61 6e 74 0a 20 20 20 20 20 74 6f 20 6d 6f 64 69 66 79 20 74 68 65 20 73 79 73 74 | may.want......to.modify.the.syst |
| 10b000 | 65 6d 20 74 6f 20 69 6e 63 6c 75 64 65 20 79 6f 75 72 20 6c 6f 6f 70 20 64 65 74 65 63 74 6f 72 | em.to.include.your.loop.detector |
| 10b020 | 2e 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 36 38 3a 2a 20 44 65 66 69 6e 65 | .).......*Exercise.4.68:*.Define |
| 10b040 | 20 72 75 6c 65 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 60 72 65 76 65 72 73 65 | .rules.to.implement.the.`reverse |
| 10b060 | 27 20 6f 70 65 72 61 74 69 6f 6e 0a 20 20 20 20 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 | '.operation......of.*Note.Exerci |
| 10b080 | 73 65 20 32 2d 31 38 3a 3a 2c 20 77 68 69 63 68 20 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20 | se.2-18::,.which.returns.a.list. |
| 10b0a0 | 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 73 61 6d 65 0a 20 20 20 20 20 65 6c 65 6d 65 6e 74 | containing.the.same......element |
| 10b0c0 | 73 20 61 73 20 61 20 67 69 76 65 6e 20 6c 69 73 74 20 69 6e 20 72 65 76 65 72 73 65 20 6f 72 64 | s.as.a.given.list.in.reverse.ord |
| 10b0e0 | 65 72 2e 20 20 28 48 69 6e 74 3a 20 55 73 65 0a 20 20 20 20 20 60 61 70 70 65 6e 64 2d 74 6f 2d | er...(Hint:.Use......`append-to- |
| 10b100 | 66 6f 72 6d 27 2e 29 20 20 43 61 6e 20 79 6f 75 72 20 72 75 6c 65 73 20 61 6e 73 77 65 72 20 62 | form'.)..Can.your.rules.answer.b |
| 10b120 | 6f 74 68 20 60 28 72 65 76 65 72 73 65 20 28 31 20 32 20 33 29 0a 20 20 20 20 20 3f 78 29 27 20 | oth.`(reverse.(1.2.3)......?x)'. |
| 10b140 | 61 6e 64 20 60 28 72 65 76 65 72 73 65 20 3f 78 20 28 31 20 32 20 33 29 29 27 20 3f 0a 0a 20 20 | and.`(reverse.?x.(1.2.3))'.?.... |
| 10b160 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 36 39 3a 2a 20 42 65 67 69 6e 6e 69 6e 67 20 77 69 | ...*Exercise.4.69:*.Beginning.wi |
| 10b180 | 74 68 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 61 6e 64 20 74 68 65 20 72 75 6c 65 73 20 79 | th.the.data.base.and.the.rules.y |
| 10b1a0 | 6f 75 0a 20 20 20 20 20 66 6f 72 6d 75 6c 61 74 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 | ou......formulated.in.*Note.Exer |
| 10b1c0 | 63 69 73 65 20 34 2d 36 33 3a 3a 2c 20 64 65 76 69 73 65 20 61 20 72 75 6c 65 20 66 6f 72 20 61 | cise.4-63::,.devise.a.rule.for.a |
| 10b1e0 | 64 64 69 6e 67 0a 20 20 20 20 20 22 67 72 65 61 74 73 22 20 74 6f 20 61 20 67 72 61 6e 64 73 6f | dding......"greats".to.a.grandso |
| 10b200 | 6e 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 2e 20 54 68 69 73 20 73 68 6f 75 6c 64 20 65 6e 61 62 | n.relationship..This.should.enab |
| 10b220 | 6c 65 20 74 68 65 20 73 79 73 74 65 6d 0a 20 20 20 20 20 74 6f 20 64 65 64 75 63 65 20 74 68 61 | le.the.system......to.deduce.tha |
| 10b240 | 74 20 49 72 61 64 20 69 73 20 74 68 65 20 67 72 65 61 74 2d 67 72 61 6e 64 73 6f 6e 20 6f 66 20 | t.Irad.is.the.great-grandson.of. |
| 10b260 | 41 64 61 6d 2c 20 6f 72 20 74 68 61 74 20 4a 61 62 61 6c 0a 20 20 20 20 20 61 6e 64 20 4a 75 62 | Adam,.or.that.Jabal......and.Jub |
| 10b280 | 61 6c 20 61 72 65 20 74 68 65 20 67 72 65 61 74 2d 67 72 65 61 74 2d 67 72 65 61 74 2d 67 72 65 | al.are.the.great-great-great-gre |
| 10b2a0 | 61 74 2d 67 72 65 61 74 2d 67 72 61 6e 64 73 6f 6e 73 20 6f 66 20 41 64 61 6d 2e 0a 20 20 20 20 | at-great-grandsons.of.Adam...... |
| 10b2c0 | 20 28 48 69 6e 74 3a 20 52 65 70 72 65 73 65 6e 74 20 74 68 65 20 66 61 63 74 20 61 62 6f 75 74 | .(Hint:.Represent.the.fact.about |
| 10b2e0 | 20 49 72 61 64 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 73 20 60 28 28 67 72 65 61 74 0a | .Irad,.for.example,.as.`((great. |
| 10b300 | 20 20 20 20 20 67 72 61 6e 64 73 6f 6e 29 20 41 64 61 6d 20 49 72 61 64 29 27 2e 20 20 57 72 69 | .....grandson).Adam.Irad)'...Wri |
| 10b320 | 74 65 20 72 75 6c 65 73 20 74 68 61 74 20 64 65 74 65 72 6d 69 6e 65 20 69 66 20 61 20 6c 69 73 | te.rules.that.determine.if.a.lis |
| 10b340 | 74 20 65 6e 64 73 0a 20 20 20 20 20 69 6e 20 74 68 65 20 77 6f 72 64 20 60 67 72 61 6e 64 73 6f | t.ends......in.the.word.`grandso |
| 10b360 | 6e 27 2e 20 20 55 73 65 20 74 68 69 73 20 74 6f 20 65 78 70 72 65 73 73 20 61 20 72 75 6c 65 20 | n'...Use.this.to.express.a.rule. |
| 10b380 | 74 68 61 74 20 61 6c 6c 6f 77 73 0a 20 20 20 20 20 6f 6e 65 20 74 6f 20 64 65 72 69 76 65 20 74 | that.allows......one.to.derive.t |
| 10b3a0 | 68 65 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 20 60 28 28 67 72 65 61 74 20 2e 20 20 3f 72 65 6c | he.relationship.`((great....?rel |
| 10b3c0 | 29 20 3f 78 20 3f 79 29 27 2c 20 77 68 65 72 65 0a 20 20 20 20 20 60 3f 72 65 6c 27 20 69 73 20 | ).?x.?y)',.where......`?rel'.is. |
| 10b3e0 | 61 20 6c 69 73 74 20 65 6e 64 69 6e 67 20 69 6e 20 60 67 72 61 6e 64 73 6f 6e 27 2e 29 20 20 43 | a.list.ending.in.`grandson'.)..C |
| 10b400 | 68 65 63 6b 20 79 6f 75 72 20 72 75 6c 65 73 20 6f 6e 0a 20 20 20 20 20 71 75 65 72 69 65 73 20 | heck.your.rules.on......queries. |
| 10b420 | 73 75 63 68 20 61 73 20 60 28 28 67 72 65 61 74 20 67 72 61 6e 64 73 6f 6e 29 20 3f 67 20 3f 67 | such.as.`((great.grandson).?g.?g |
| 10b440 | 67 73 29 27 20 61 6e 64 20 60 28 3f 72 65 6c 61 74 69 6f 6e 73 68 69 70 0a 20 20 20 20 20 41 64 | gs)'.and.`(?relationship......Ad |
| 10b460 | 61 6d 20 49 72 61 64 29 27 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f | am.Irad)'......----------.Footno |
| 10b480 | 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 61 74 20 61 20 70 61 | tes.----------.....(1).That.a.pa |
| 10b4a0 | 72 74 69 63 75 6c 61 72 20 6d 65 74 68 6f 64 20 6f 66 20 69 6e 66 65 72 65 6e 63 65 20 69 73 20 | rticular.method.of.inference.is. |
| 10b4c0 | 6c 65 67 69 74 69 6d 61 74 65 20 69 73 20 6e 6f 74 20 61 0a 74 72 69 76 69 61 6c 20 61 73 73 65 | legitimate.is.not.a.trivial.asse |
| 10b4e0 | 72 74 69 6f 6e 2e 20 20 4f 6e 65 20 6d 75 73 74 20 70 72 6f 76 65 20 74 68 61 74 20 69 66 20 6f | rtion...One.must.prove.that.if.o |
| 10b500 | 6e 65 20 73 74 61 72 74 73 20 77 69 74 68 20 74 72 75 65 0a 70 72 65 6d 69 73 65 73 2c 20 6f 6e | ne.starts.with.true.premises,.on |
| 10b520 | 6c 79 20 74 72 75 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 73 20 63 61 6e 20 62 65 20 64 65 72 69 76 | ly.true.conclusions.can.be.deriv |
| 10b540 | 65 64 2e 20 20 54 68 65 20 6d 65 74 68 6f 64 20 6f 66 0a 69 6e 66 65 72 65 6e 63 65 20 72 65 70 | ed...The.method.of.inference.rep |
| 10b560 | 72 65 73 65 6e 74 65 64 20 62 79 20 72 75 6c 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 69 73 | resented.by.rule.applications.is |
| 10b580 | 20 22 6d 6f 64 75 73 20 70 6f 6e 65 6e 73 22 2c 20 74 68 65 0a 66 61 6d 69 6c 69 61 72 20 6d 65 | ."modus.ponens",.the.familiar.me |
| 10b5a0 | 74 68 6f 64 20 6f 66 20 69 6e 66 65 72 65 6e 63 65 20 74 68 61 74 20 73 61 79 73 20 74 68 61 74 | thod.of.inference.that.says.that |
| 10b5c0 | 20 69 66 20 41 20 69 73 20 74 72 75 65 20 61 6e 64 20 5f 41 20 69 6d 70 6c 69 65 73 0a 42 5f 20 | .if.A.is.true.and._A.implies.B_. |
| 10b5e0 | 69 73 20 74 72 75 65 2c 20 74 68 65 6e 20 77 65 20 6d 61 79 20 63 6f 6e 63 6c 75 64 65 20 74 68 | is.true,.then.we.may.conclude.th |
| 10b600 | 61 74 20 42 20 69 73 20 74 72 75 65 2e 0a 0a 20 20 20 28 32 29 20 57 65 20 6d 75 73 74 20 71 75 | at.B.is.true......(2).We.must.qu |
| 10b620 | 61 6c 69 66 79 20 74 68 69 73 20 73 74 61 74 65 6d 65 6e 74 20 62 79 20 61 67 72 65 65 69 6e 67 | alify.this.statement.by.agreeing |
| 10b640 | 20 74 68 61 74 2c 20 69 6e 20 73 70 65 61 6b 69 6e 67 20 6f 66 0a 74 68 65 20 22 69 6e 66 65 72 | .that,.in.speaking.of.the."infer |
| 10b660 | 65 6e 63 65 22 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 61 20 6c 6f 67 69 63 20 70 72 | ence".accomplished.by.a.logic.pr |
| 10b680 | 6f 67 72 61 6d 2c 20 77 65 20 61 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 0a 63 6f 6d 70 75 74 | ogram,.we.assume.that.the.comput |
| 10b6a0 | 61 74 69 6f 6e 20 74 65 72 6d 69 6e 61 74 65 73 2e 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 | ation.terminates...Unfortunately |
| 10b6c0 | 2c 20 65 76 65 6e 20 74 68 69 73 20 71 75 61 6c 69 66 69 65 64 20 73 74 61 74 65 6d 65 6e 74 0a | ,.even.this.qualified.statement. |
| 10b6e0 | 69 73 20 66 61 6c 73 65 20 66 6f 72 20 6f 75 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 | is.false.for.our.implementation. |
| 10b700 | 6f 66 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 20 28 61 6e 64 20 61 6c 73 6f 20 | of.the.query.language.(and.also. |
| 10b720 | 66 61 6c 73 65 0a 66 6f 72 20 70 72 6f 67 72 61 6d 73 20 69 6e 20 50 72 6f 6c 6f 67 20 61 6e 64 | false.for.programs.in.Prolog.and |
| 10b740 | 20 6d 6f 73 74 20 6f 74 68 65 72 20 63 75 72 72 65 6e 74 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 | .most.other.current.logic.progra |
| 10b760 | 6d 6d 69 6e 67 0a 6c 61 6e 67 75 61 67 65 73 29 20 62 65 63 61 75 73 65 20 6f 66 20 6f 75 72 20 | mming.languages).because.of.our. |
| 10b780 | 75 73 65 20 6f 66 20 60 6e 6f 74 27 20 61 6e 64 20 60 6c 69 73 70 2d 76 61 6c 75 65 27 2e 20 20 | use.of.`not'.and.`lisp-value'... |
| 10b7a0 | 41 73 20 77 65 20 77 69 6c 6c 0a 64 65 73 63 72 69 62 65 20 62 65 6c 6f 77 2c 20 74 68 65 20 60 | As.we.will.describe.below,.the.` |
| 10b7c0 | 6e 6f 74 27 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 74 68 65 20 71 75 65 72 79 20 6c 61 | not'.implemented.in.the.query.la |
| 10b7e0 | 6e 67 75 61 67 65 20 69 73 20 6e 6f 74 0a 61 6c 77 61 79 73 20 63 6f 6e 73 69 73 74 65 6e 74 20 | nguage.is.not.always.consistent. |
| 10b800 | 77 69 74 68 20 74 68 65 20 60 6e 6f 74 27 20 6f 66 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6c | with.the.`not'.of.mathematical.l |
| 10b820 | 6f 67 69 63 2c 20 61 6e 64 0a 60 6c 69 73 70 2d 76 61 6c 75 65 27 20 69 6e 74 72 6f 64 75 63 65 | ogic,.and.`lisp-value'.introduce |
| 10b840 | 73 20 61 64 64 69 74 69 6f 6e 61 6c 20 63 6f 6d 70 6c 69 63 61 74 69 6f 6e 73 2e 20 20 57 65 20 | s.additional.complications...We. |
| 10b860 | 63 6f 75 6c 64 20 69 6d 70 6c 65 6d 65 6e 74 20 61 0a 6c 61 6e 67 75 61 67 65 20 63 6f 6e 73 69 | could.implement.a.language.consi |
| 10b880 | 73 74 65 6e 74 20 77 69 74 68 20 6d 61 74 68 65 6d 61 74 69 63 61 6c 20 6c 6f 67 69 63 20 62 79 | stent.with.mathematical.logic.by |
| 10b8a0 | 20 73 69 6d 70 6c 79 20 72 65 6d 6f 76 69 6e 67 20 60 6e 6f 74 27 0a 61 6e 64 20 60 6c 69 73 70 | .simply.removing.`not'.and.`lisp |
| 10b8c0 | 2d 76 61 6c 75 65 27 20 66 72 6f 6d 20 74 68 65 20 6c 61 6e 67 75 61 67 65 20 61 6e 64 20 61 67 | -value'.from.the.language.and.ag |
| 10b8e0 | 72 65 65 69 6e 67 20 74 6f 20 77 72 69 74 65 20 70 72 6f 67 72 61 6d 73 20 75 73 69 6e 67 0a 6f | reeing.to.write.programs.using.o |
| 10b900 | 6e 6c 79 20 73 69 6d 70 6c 65 20 71 75 65 72 69 65 73 2c 20 60 61 6e 64 27 2c 20 61 6e 64 20 60 | nly.simple.queries,.`and',.and.` |
| 10b920 | 6f 72 27 2e 20 20 48 6f 77 65 76 65 72 2c 20 74 68 69 73 20 77 6f 75 6c 64 20 67 72 65 61 74 6c | or'...However,.this.would.greatl |
| 10b940 | 79 0a 72 65 73 74 72 69 63 74 20 74 68 65 20 65 78 70 72 65 73 73 69 76 65 20 70 6f 77 65 72 20 | y.restrict.the.expressive.power. |
| 10b960 | 6f 66 20 74 68 65 20 6c 61 6e 67 75 61 67 65 2e 20 20 4f 6e 65 20 6f 66 20 74 68 65 20 6d 61 6a | of.the.language...One.of.the.maj |
| 10b980 | 6f 72 0a 63 6f 6e 63 65 72 6e 73 20 6f 66 20 72 65 73 65 61 72 63 68 20 69 6e 20 6c 6f 67 69 63 | or.concerns.of.research.in.logic |
| 10b9a0 | 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 74 6f 20 66 69 6e 64 20 77 61 79 73 20 74 6f 20 | .programming.is.to.find.ways.to. |
| 10b9c0 | 61 63 68 69 65 76 65 0a 6d 6f 72 65 20 63 6f 6e 73 69 73 74 65 6e 63 79 20 77 69 74 68 20 6d 61 | achieve.more.consistency.with.ma |
| 10b9e0 | 74 68 65 6d 61 74 69 63 61 6c 20 6c 6f 67 69 63 20 77 69 74 68 6f 75 74 20 75 6e 64 75 6c 79 20 | thematical.logic.without.unduly. |
| 10ba00 | 73 61 63 72 69 66 69 63 69 6e 67 0a 65 78 70 72 65 73 73 69 76 65 20 70 6f 77 65 72 2e 0a 0a 20 | sacrificing.expressive.power.... |
| 10ba20 | 20 20 28 33 29 20 54 68 69 73 20 69 73 20 6e 6f 74 20 61 20 70 72 6f 62 6c 65 6d 20 6f 66 20 74 | ..(3).This.is.not.a.problem.of.t |
| 10ba40 | 68 65 20 6c 6f 67 69 63 20 62 75 74 20 6f 6e 65 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 | he.logic.but.one.of.the.procedur |
| 10ba60 | 61 6c 0a 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6c 6f 67 69 63 20 70 | al.interpretation.of.the.logic.p |
| 10ba80 | 72 6f 76 69 64 65 64 20 62 79 20 6f 75 72 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20 20 57 65 20 | rovided.by.our.interpreter...We. |
| 10baa0 | 63 6f 75 6c 64 0a 77 72 69 74 65 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 68 61 74 20 | could.write.an.interpreter.that. |
| 10bac0 | 77 6f 75 6c 64 20 6e 6f 74 20 66 61 6c 6c 20 69 6e 74 6f 20 61 20 6c 6f 6f 70 20 68 65 72 65 2e | would.not.fall.into.a.loop.here. |
| 10bae0 | 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 6f 75 6c 64 20 65 6e 75 6d 65 72 61 74 | ..For.example,.we.could.enumerat |
| 10bb00 | 65 20 61 6c 6c 20 74 68 65 20 70 72 6f 6f 66 73 20 64 65 72 69 76 61 62 6c 65 20 66 72 6f 6d 20 | e.all.the.proofs.derivable.from. |
| 10bb20 | 6f 75 72 0a 61 73 73 65 72 74 69 6f 6e 73 20 61 6e 64 20 6f 75 72 20 72 75 6c 65 73 20 69 6e 20 | our.assertions.and.our.rules.in. |
| 10bb40 | 61 20 62 72 65 61 64 74 68 2d 66 69 72 73 74 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 20 64 65 | a.breadth-first.rather.than.a.de |
| 10bb60 | 70 74 68 2d 66 69 72 73 74 0a 6f 72 64 65 72 2e 20 20 48 6f 77 65 76 65 72 2c 20 73 75 63 68 20 | pth-first.order...However,.such. |
| 10bb80 | 61 20 73 79 73 74 65 6d 20 6d 61 6b 65 73 20 69 74 20 6d 6f 72 65 20 64 69 66 66 69 63 75 6c 74 | a.system.makes.it.more.difficult |
| 10bba0 | 20 74 6f 20 74 61 6b 65 0a 61 64 76 61 6e 74 61 67 65 20 6f 66 20 74 68 65 20 6f 72 64 65 72 20 | .to.take.advantage.of.the.order. |
| 10bbc0 | 6f 66 20 64 65 64 75 63 74 69 6f 6e 73 20 69 6e 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 2e 20 20 | of.deductions.in.our.programs... |
| 10bbe0 | 4f 6e 65 20 61 74 74 65 6d 70 74 20 74 6f 0a 62 75 69 6c 64 20 73 6f 70 68 69 73 74 69 63 61 74 | One.attempt.to.build.sophisticat |
| 10bc00 | 65 64 20 63 6f 6e 74 72 6f 6c 20 69 6e 74 6f 20 73 75 63 68 20 61 20 70 72 6f 67 72 61 6d 20 69 | ed.control.into.such.a.program.i |
| 10bc20 | 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 64 65 4b 6c 65 65 72 0a 65 74 20 61 6c 2e 20 31 39 | s.described.in.deKleer.et.al..19 |
| 10bc40 | 37 37 2e 20 20 41 6e 6f 74 68 65 72 20 74 65 63 68 6e 69 71 75 65 2c 20 77 68 69 63 68 20 64 6f | 77...Another.technique,.which.do |
| 10bc60 | 65 73 20 6e 6f 74 20 6c 65 61 64 20 74 6f 20 73 75 63 68 20 73 65 72 69 6f 75 73 0a 63 6f 6e 74 | es.not.lead.to.such.serious.cont |
| 10bc80 | 72 6f 6c 20 70 72 6f 62 6c 65 6d 73 2c 20 69 73 20 74 6f 20 70 75 74 20 69 6e 20 73 70 65 63 69 | rol.problems,.is.to.put.in.speci |
| 10bca0 | 61 6c 20 6b 6e 6f 77 6c 65 64 67 65 2c 20 73 75 63 68 20 61 73 20 64 65 74 65 63 74 6f 72 73 20 | al.knowledge,.such.as.detectors. |
| 10bcc0 | 66 6f 72 0a 70 61 72 74 69 63 75 6c 61 72 20 6b 69 6e 64 73 20 6f 66 20 6c 6f 6f 70 73 20 28 2a | for.particular.kinds.of.loops.(* |
| 10bce0 | 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 36 37 3a 3a 29 2e 20 20 48 6f 77 65 76 65 72 2c | Note.Exercise.4-67::)...However, |
| 10bd00 | 20 74 68 65 72 65 20 63 61 6e 0a 62 65 20 6e 6f 20 67 65 6e 65 72 61 6c 20 73 63 68 65 6d 65 20 | .there.can.be.no.general.scheme. |
| 10bd20 | 66 6f 72 20 72 65 6c 69 61 62 6c 79 20 70 72 65 76 65 6e 74 69 6e 67 20 61 20 73 79 73 74 65 6d | for.reliably.preventing.a.system |
| 10bd40 | 20 66 72 6f 6d 20 67 6f 69 6e 67 20 64 6f 77 6e 0a 69 6e 66 69 6e 69 74 65 20 70 61 74 68 73 20 | .from.going.down.infinite.paths. |
| 10bd60 | 69 6e 20 70 65 72 66 6f 72 6d 69 6e 67 20 64 65 64 75 63 74 69 6f 6e 73 2e 20 20 49 6d 61 67 69 | in.performing.deductions...Imagi |
| 10bd80 | 6e 65 20 61 20 64 69 61 62 6f 6c 69 63 61 6c 20 72 75 6c 65 20 6f 66 0a 74 68 65 20 66 6f 72 6d | ne.a.diabolical.rule.of.the.form |
| 10bda0 | 20 22 54 6f 20 73 68 6f 77 20 50 28 78 29 20 69 73 20 74 72 75 65 2c 20 73 68 6f 77 20 74 68 61 | ."To.show.P(x).is.true,.show.tha |
| 10bdc0 | 74 20 50 28 66 28 78 29 29 20 69 73 20 74 72 75 65 2c 22 20 66 6f 72 20 73 6f 6d 65 0a 73 75 69 | t.P(f(x)).is.true,".for.some.sui |
| 10bde0 | 74 61 62 6c 79 20 63 68 6f 73 65 6e 20 66 75 6e 63 74 69 6f 6e 20 66 2e 0a 0a 20 20 20 28 34 29 | tably.chosen.function.f......(4) |
| 10be00 | 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 71 75 65 72 79 20 60 28 6e 6f 74 20 28 62 61 73 65 62 | .Consider.the.query.`(not.(baseb |
| 10be20 | 61 6c 6c 2d 66 61 6e 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 29 27 2e 20 20 54 68 65 | all-fan.(Bitdiddle.Ben)))'...The |
| 10be40 | 0a 73 79 73 74 65 6d 20 66 69 6e 64 73 20 74 68 61 74 20 60 28 62 61 73 65 62 61 6c 6c 2d 66 61 | .system.finds.that.`(baseball-fa |
| 10be60 | 6e 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 29 27 20 69 73 20 6e 6f 74 20 69 6e 20 74 68 | n.(Bitdiddle.Ben))'.is.not.in.th |
| 10be80 | 65 20 64 61 74 61 0a 62 61 73 65 2c 20 73 6f 20 74 68 65 20 65 6d 70 74 79 20 66 72 61 6d 65 20 | e.data.base,.so.the.empty.frame. |
| 10bea0 | 64 6f 65 73 20 6e 6f 74 20 73 61 74 69 73 66 79 20 74 68 65 20 70 61 74 74 65 72 6e 20 61 6e 64 | does.not.satisfy.the.pattern.and |
| 10bec0 | 20 69 73 20 6e 6f 74 0a 66 69 6c 74 65 72 65 64 20 6f 75 74 20 6f 66 20 74 68 65 20 69 6e 69 74 | .is.not.filtered.out.of.the.init |
| 10bee0 | 69 61 6c 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 2e 20 20 54 68 65 20 72 65 73 75 6c | ial.stream.of.frames...The.resul |
| 10bf00 | 74 20 6f 66 20 74 68 65 20 71 75 65 72 79 0a 69 73 20 74 68 75 73 20 74 68 65 20 65 6d 70 74 79 | t.of.the.query.is.thus.the.empty |
| 10bf20 | 20 66 72 61 6d 65 2c 20 77 68 69 63 68 20 69 73 20 75 73 65 64 20 74 6f 20 69 6e 73 74 61 6e 74 | .frame,.which.is.used.to.instant |
| 10bf40 | 69 61 74 65 20 74 68 65 20 69 6e 70 75 74 20 71 75 65 72 79 0a 74 6f 20 70 72 6f 64 75 63 65 20 | iate.the.input.query.to.produce. |
| 10bf60 | 60 28 6e 6f 74 20 28 62 61 73 65 62 61 6c 6c 2d 66 61 6e 20 28 42 69 74 64 69 64 64 6c 65 20 42 | `(not.(baseball-fan.(Bitdiddle.B |
| 10bf80 | 65 6e 29 29 29 27 2e 0a 0a 20 20 20 28 35 29 20 41 20 64 69 73 63 75 73 73 69 6f 6e 20 61 6e 64 | en)))'......(5).A.discussion.and |
| 10bfa0 | 20 6a 75 73 74 69 66 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 69 73 20 74 72 65 61 74 6d 65 6e 74 | .justification.of.this.treatment |
| 10bfc0 | 20 6f 66 20 60 6e 6f 74 27 20 63 61 6e 20 62 65 0a 66 6f 75 6e 64 20 69 6e 20 74 68 65 20 61 72 | .of.`not'.can.be.found.in.the.ar |
| 10bfe0 | 74 69 63 6c 65 20 62 79 20 43 6c 61 72 6b 20 28 31 39 37 38 29 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 | ticle.by.Clark.(1978).....File:. |
| 10c000 | 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 34 2d 34 2c 20 20 50 72 65 76 3a 20 | sicp.info,..Node:.4-4-4,..Prev:. |
| 10c020 | 34 2d 34 2d 33 2c 20 20 55 70 3a 20 34 2d 34 0a 0a 34 2e 34 2e 34 20 49 6d 70 6c 65 6d 65 6e 74 | 4-4-3,..Up:.4-4..4.4.4.Implement |
| 10c040 | 69 6e 67 20 74 68 65 20 51 75 65 72 79 20 53 79 73 74 65 6d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ing.the.Query.System.----------- |
| 10c060 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 53 65 63 74 69 6f | ------------------------..Sectio |
| 10c080 | 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 32 3a 3a 20 64 65 73 63 72 69 62 65 64 20 68 6f 77 20 74 68 | n.*Note.4-4-2::.described.how.th |
| 10c0a0 | 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 20 77 6f 72 6b 73 2e 20 4e 6f 77 20 77 65 20 66 69 6c | e.query.system.works..Now.we.fil |
| 10c0c0 | 6c 0a 69 6e 20 74 68 65 20 64 65 74 61 69 6c 73 20 62 79 20 70 72 65 73 65 6e 74 69 6e 67 20 61 | l.in.the.details.by.presenting.a |
| 10c0e0 | 20 63 6f 6d 70 6c 65 74 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 | .complete.implementation.of.the. |
| 10c100 | 73 79 73 74 65 6d 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 34 2d 34 2d 34 2d 31 3a 3a 20 20 20 | system...*.Menu:..*.4-4-4-1::... |
| 10c120 | 20 20 20 20 20 20 20 54 68 65 20 44 72 69 76 65 72 20 4c 6f 6f 70 20 61 6e 64 20 49 6e 73 74 61 | .......The.Driver.Loop.and.Insta |
| 10c140 | 6e 74 69 61 74 69 6f 6e 0a 2a 20 34 2d 34 2d 34 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 54 68 | ntiation.*.4-4-4-2::..........Th |
| 10c160 | 65 20 45 76 61 6c 75 61 74 6f 72 0a 2a 20 34 2d 34 2d 34 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 | e.Evaluator.*.4-4-4-3::......... |
| 10c180 | 20 46 69 6e 64 69 6e 67 20 41 73 73 65 72 74 69 6f 6e 73 20 62 79 20 50 61 74 74 65 72 6e 20 4d | .Finding.Assertions.by.Pattern.M |
| 10c1a0 | 61 74 63 68 69 6e 67 0a 2a 20 34 2d 34 2d 34 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 52 75 6c | atching.*.4-4-4-4::..........Rul |
| 10c1c0 | 65 73 20 61 6e 64 20 55 6e 69 66 69 63 61 74 69 6f 6e 0a 2a 20 34 2d 34 2d 34 2d 35 3a 3a 20 20 | es.and.Unification.*.4-4-4-5::.. |
| 10c1e0 | 20 20 20 20 20 20 20 20 4d 61 69 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 44 61 74 61 20 42 61 73 | ........Maintaining.the.Data.Bas |
| 10c200 | 65 0a 2a 20 34 2d 34 2d 34 2d 36 3a 3a 20 20 20 20 20 20 20 20 20 20 53 74 72 65 61 6d 20 4f 70 | e.*.4-4-4-6::..........Stream.Op |
| 10c220 | 65 72 61 74 69 6f 6e 73 0a 2a 20 34 2d 34 2d 34 2d 37 3a 3a 20 20 20 20 20 20 20 20 20 20 51 75 | erations.*.4-4-4-7::..........Qu |
| 10c240 | 65 72 79 20 53 79 6e 74 61 78 20 50 72 6f 63 65 64 75 72 65 73 0a 2a 20 34 2d 34 2d 34 2d 38 3a | ery.Syntax.Procedures.*.4-4-4-8: |
| 10c260 | 3a 20 20 20 20 20 20 20 20 20 20 46 72 61 6d 65 73 20 61 6e 64 20 42 69 6e 64 69 6e 67 73 0a 0a | :..........Frames.and.Bindings.. |
| 10c280 | 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d | ..File:.sicp.info,..Node:.4-4-4- |
| 10c2a0 | 31 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2d 34 2d 32 2c 20 20 50 72 65 76 3a 20 34 2d 34 2d 34 2c | 1,..Next:.4-4-4-2,..Prev:.4-4-4, |
| 10c2c0 | 20 20 55 70 3a 20 34 2d 34 2d 34 0a 0a 34 2e 34 2e 34 2e 31 20 54 68 65 20 44 72 69 76 65 72 20 | ..Up:.4-4-4..4.4.4.1.The.Driver. |
| 10c2e0 | 4c 6f 6f 70 20 61 6e 64 20 49 6e 73 74 61 6e 74 69 61 74 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e | Loop.and.Instantiation.......... |
| 10c300 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ................................ |
| 10c320 | 0a 0a 54 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 20 66 6f 72 20 74 68 65 20 71 75 65 72 79 20 | ..The.driver.loop.for.the.query. |
| 10c340 | 73 79 73 74 65 6d 20 72 65 70 65 61 74 65 64 6c 79 20 72 65 61 64 73 20 69 6e 70 75 74 0a 65 78 | system.repeatedly.reads.input.ex |
| 10c360 | 70 72 65 73 73 69 6f 6e 73 2e 20 20 49 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 | pressions...If.the.expression.is |
| 10c380 | 20 61 20 72 75 6c 65 20 6f 72 20 61 73 73 65 72 74 69 6f 6e 20 74 6f 20 62 65 20 61 64 64 65 64 | .a.rule.or.assertion.to.be.added |
| 10c3a0 | 20 74 6f 0a 74 68 65 20 64 61 74 61 20 62 61 73 65 2c 20 74 68 65 6e 20 74 68 65 20 69 6e 66 6f | .to.the.data.base,.then.the.info |
| 10c3c0 | 72 6d 61 74 69 6f 6e 20 69 73 20 61 64 64 65 64 2e 20 20 4f 74 68 65 72 77 69 73 65 20 74 68 65 | rmation.is.added...Otherwise.the |
| 10c3e0 | 20 65 78 70 72 65 73 73 69 6f 6e 0a 69 73 20 61 73 73 75 6d 65 64 20 74 6f 20 62 65 20 61 20 71 | .expression.is.assumed.to.be.a.q |
| 10c400 | 75 65 72 79 2e 20 20 54 68 65 20 64 72 69 76 65 72 20 70 61 73 73 65 73 20 74 68 69 73 20 71 75 | uery...The.driver.passes.this.qu |
| 10c420 | 65 72 79 20 74 6f 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 20 60 71 65 76 61 6c 27 20 74 6f 67 | ery.to.the.evaluator.`qeval'.tog |
| 10c440 | 65 74 68 65 72 20 77 69 74 68 20 61 6e 20 69 6e 69 74 69 61 6c 20 66 72 61 6d 65 20 73 74 72 65 | ether.with.an.initial.frame.stre |
| 10c460 | 61 6d 20 63 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 61 0a 73 69 6e 67 6c 65 20 65 6d 70 74 79 20 | am.consisting.of.a.single.empty. |
| 10c480 | 66 72 61 6d 65 2e 20 20 54 68 65 20 72 65 73 75 6c 74 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 | frame...The.result.of.the.evalua |
| 10c4a0 | 74 69 6f 6e 20 69 73 20 61 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 0a 67 65 6e 65 72 | tion.is.a.stream.of.frames.gener |
| 10c4c0 | 61 74 65 64 20 62 79 20 73 61 74 69 73 66 79 69 6e 67 20 74 68 65 20 71 75 65 72 79 20 77 69 74 | ated.by.satisfying.the.query.wit |
| 10c4e0 | 68 20 76 61 72 69 61 62 6c 65 20 76 61 6c 75 65 73 20 66 6f 75 6e 64 20 69 6e 20 74 68 65 0a 64 | h.variable.values.found.in.the.d |
| 10c500 | 61 74 61 20 62 61 73 65 2e 20 20 54 68 65 73 65 20 66 72 61 6d 65 73 20 61 72 65 20 75 73 65 64 | ata.base...These.frames.are.used |
| 10c520 | 20 74 6f 20 66 6f 72 6d 20 61 20 6e 65 77 20 73 74 72 65 61 6d 20 63 6f 6e 73 69 73 74 69 6e 67 | .to.form.a.new.stream.consisting |
| 10c540 | 20 6f 66 0a 63 6f 70 69 65 73 20 6f 66 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 71 75 65 72 79 | .of.copies.of.the.original.query |
| 10c560 | 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 69 6e 73 74 | .in.which.the.variables.are.inst |
| 10c580 | 61 6e 74 69 61 74 65 64 0a 77 69 74 68 20 76 61 6c 75 65 73 20 73 75 70 70 6c 69 65 64 20 62 79 | antiated.with.values.supplied.by |
| 10c5a0 | 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 2c 20 61 6e 64 20 74 68 69 73 20 | .the.stream.of.frames,.and.this. |
| 10c5c0 | 66 69 6e 61 6c 20 73 74 72 65 61 6d 20 69 73 0a 70 72 69 6e 74 65 64 20 61 74 20 74 68 65 20 74 | final.stream.is.printed.at.the.t |
| 10c5e0 | 65 72 6d 69 6e 61 6c 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 69 6e 70 75 74 2d 70 72 6f | erminal:.......(define.input-pro |
| 10c600 | 6d 70 74 20 22 3b 3b 3b 20 51 75 65 72 79 20 69 6e 70 75 74 3a 22 29 0a 20 20 20 20 20 28 64 65 | mpt.";;;.Query.input:")......(de |
| 10c620 | 66 69 6e 65 20 6f 75 74 70 75 74 2d 70 72 6f 6d 70 74 20 22 3b 3b 3b 20 51 75 65 72 79 20 72 65 | fine.output-prompt.";;;.Query.re |
| 10c640 | 73 75 6c 74 73 3a 22 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 71 75 65 72 79 2d 64 72 | sults:").......(define.(query-dr |
| 10c660 | 69 76 65 72 2d 6c 6f 6f 70 29 0a 20 20 20 20 20 20 20 28 70 72 6f 6d 70 74 2d 66 6f 72 2d 69 6e | iver-loop)........(prompt-for-in |
| 10c680 | 70 75 74 20 69 6e 70 75 74 2d 70 72 6f 6d 70 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 | put.input-prompt)........(let.(( |
| 10c6a0 | 71 20 28 71 75 65 72 79 2d 73 79 6e 74 61 78 2d 70 72 6f 63 65 73 73 20 28 72 65 61 64 29 29 29 | q.(query-syntax-process.(read))) |
| 10c6c0 | 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 61 73 73 65 72 74 69 6f 6e 2d 74 6f 2d | )..........(cond.((assertion-to- |
| 10c6e0 | 62 65 2d 61 64 64 65 64 3f 20 71 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 | be-added?.q).................(ad |
| 10c700 | 64 2d 72 75 6c 65 2d 6f 72 2d 61 73 73 65 72 74 69 6f 6e 21 20 28 61 64 64 2d 61 73 73 65 72 74 | d-rule-or-assertion!.(add-assert |
| 10c720 | 69 6f 6e 2d 62 6f 64 79 20 71 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 | ion-body.q)).................(ne |
| 10c740 | 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 | wline).................(display. |
| 10c760 | 22 41 73 73 65 72 74 69 6f 6e 20 61 64 64 65 64 20 74 6f 20 64 61 74 61 20 62 61 73 65 2e 22 29 | "Assertion.added.to.data.base.") |
| 10c780 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 71 75 65 72 79 2d 64 72 69 76 65 72 2d 6c | .................(query-driver-l |
| 10c7a0 | 6f 6f 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 | oop))................(else...... |
| 10c7c0 | 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ...........(newline)............ |
| 10c7e0 | 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 6f 75 74 70 75 74 2d 70 72 6f 6d 70 74 29 0a 20 20 20 | .....(display.output-prompt).... |
| 10c800 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 2d 73 74 72 65 61 6d 0a 20 20 20 | .............(display-stream.... |
| 10c820 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 70 0a 20 20 20 20 20 20 | ..............(stream-map....... |
| 10c840 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 66 72 61 6d 65 29 0a 20 20 20 20 | ............(lambda.(frame)..... |
| 10c860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 6e 73 74 61 6e 74 69 61 74 65 20 71 0a 20 | ................(instantiate.q.. |
| 10c880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 10c8a0 | 66 72 61 6d 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | frame........................... |
| 10c8c0 | 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 76 20 66 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .......(lambda.(v.f)............ |
| 10c8e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 74 72 61 63 | ........................(contrac |
| 10c900 | 74 2d 71 75 65 73 74 69 6f 6e 2d 6d 61 72 6b 20 76 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | t-question-mark.v))))........... |
| 10c920 | 20 20 20 20 20 20 20 20 28 71 65 76 61 6c 20 71 20 28 73 69 6e 67 6c 65 74 6f 6e 2d 73 74 72 65 | ........(qeval.q.(singleton-stre |
| 10c940 | 61 6d 20 27 28 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 71 75 65 72 | am.'())))).................(quer |
| 10c960 | 79 2d 64 72 69 76 65 72 2d 6c 6f 6f 70 29 29 29 29 29 0a 0a 20 20 20 48 65 72 65 2c 20 61 73 20 | y-driver-loop))))).....Here,.as. |
| 10c980 | 69 6e 20 74 68 65 20 6f 74 68 65 72 20 65 76 61 6c 75 61 74 6f 72 73 20 69 6e 20 74 68 69 73 20 | in.the.other.evaluators.in.this. |
| 10c9a0 | 63 68 61 70 74 65 72 2c 20 77 65 20 75 73 65 20 61 6e 20 61 62 73 74 72 61 63 74 0a 73 79 6e 74 | chapter,.we.use.an.abstract.synt |
| 10c9c0 | 61 78 20 66 6f 72 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 6f 66 20 74 68 65 20 71 75 | ax.for.the.expressions.of.the.qu |
| 10c9e0 | 65 72 79 20 6c 61 6e 67 75 61 67 65 2e 20 20 54 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f | ery.language...The.implementatio |
| 10ca00 | 6e 0a 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 73 79 6e 74 61 78 2c 20 69 6e 63 6c | n.of.the.expression.syntax,.incl |
| 10ca20 | 75 64 69 6e 67 20 74 68 65 20 70 72 65 64 69 63 61 74 65 0a 60 61 73 73 65 72 74 69 6f 6e 2d 74 | uding.the.predicate.`assertion-t |
| 10ca40 | 6f 2d 62 65 2d 61 64 64 65 64 3f 27 20 61 6e 64 20 74 68 65 20 73 65 6c 65 63 74 6f 72 20 60 61 | o-be-added?'.and.the.selector.`a |
| 10ca60 | 64 64 2d 61 73 73 65 72 74 69 6f 6e 2d 62 6f 64 79 27 2c 20 69 73 0a 67 69 76 65 6e 20 69 6e 20 | dd-assertion-body',.is.given.in. |
| 10ca80 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 37 3a 3a 2e 20 20 60 41 64 64 2d 72 | section.*Note.4-4-4-7::...`Add-r |
| 10caa0 | 75 6c 65 2d 6f 72 2d 61 73 73 65 72 74 69 6f 6e 21 27 20 69 73 20 64 65 66 69 6e 65 64 0a 69 6e | ule-or-assertion!'.is.defined.in |
| 10cac0 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 35 3a 3a 2e 0a 0a 20 20 20 42 65 | .section.*Note.4-4-4-5::......Be |
| 10cae0 | 66 6f 72 65 20 64 6f 69 6e 67 20 61 6e 79 20 70 72 6f 63 65 73 73 69 6e 67 20 6f 6e 20 61 6e 20 | fore.doing.any.processing.on.an. |
| 10cb00 | 69 6e 70 75 74 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 74 68 65 20 64 72 69 76 65 72 20 6c 6f 6f | input.expression,.the.driver.loo |
| 10cb20 | 70 0a 74 72 61 6e 73 66 6f 72 6d 73 20 69 74 20 73 79 6e 74 61 63 74 69 63 61 6c 6c 79 20 69 6e | p.transforms.it.syntactically.in |
| 10cb40 | 74 6f 20 61 20 66 6f 72 6d 20 74 68 61 74 20 6d 61 6b 65 73 20 74 68 65 20 70 72 6f 63 65 73 73 | to.a.form.that.makes.the.process |
| 10cb60 | 69 6e 67 20 6d 6f 72 65 0a 65 66 66 69 63 69 65 6e 74 2e 20 20 54 68 69 73 20 69 6e 76 6f 6c 76 | ing.more.efficient...This.involv |
| 10cb80 | 65 73 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f | es.changing.the.representation.o |
| 10cba0 | 66 20 70 61 74 74 65 72 6e 0a 76 61 72 69 61 62 6c 65 73 2e 20 20 57 68 65 6e 20 74 68 65 20 71 | f.pattern.variables...When.the.q |
| 10cbc0 | 75 65 72 79 20 69 73 20 69 6e 73 74 61 6e 74 69 61 74 65 64 2c 20 61 6e 79 20 76 61 72 69 61 62 | uery.is.instantiated,.any.variab |
| 10cbe0 | 6c 65 73 20 74 68 61 74 20 72 65 6d 61 69 6e 0a 75 6e 62 6f 75 6e 64 20 61 72 65 20 74 72 61 6e | les.that.remain.unbound.are.tran |
| 10cc00 | 73 66 6f 72 6d 65 64 20 62 61 63 6b 20 74 6f 20 74 68 65 20 69 6e 70 75 74 20 72 65 70 72 65 73 | sformed.back.to.the.input.repres |
| 10cc20 | 65 6e 74 61 74 69 6f 6e 20 62 65 66 6f 72 65 20 62 65 69 6e 67 0a 70 72 69 6e 74 65 64 2e 20 20 | entation.before.being.printed... |
| 10cc40 | 54 68 65 73 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 73 20 61 72 65 20 70 65 72 66 6f 72 | These.transformations.are.perfor |
| 10cc60 | 6d 65 64 20 62 79 20 74 68 65 20 74 77 6f 20 70 72 6f 63 65 64 75 72 65 73 0a 60 71 75 65 72 79 | med.by.the.two.procedures.`query |
| 10cc80 | 2d 73 79 6e 74 61 78 2d 70 72 6f 63 65 73 73 27 20 61 6e 64 20 60 63 6f 6e 74 72 61 63 74 2d 71 | -syntax-process'.and.`contract-q |
| 10cca0 | 75 65 73 74 69 6f 6e 2d 6d 61 72 6b 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 34 2d 34 | uestion-mark'.(section.*Note.4-4 |
| 10ccc0 | 2d 34 2d 37 3a 3a 29 2e 0a 0a 20 20 20 54 6f 20 69 6e 73 74 61 6e 74 69 61 74 65 20 61 6e 20 65 | -4-7::)......To.instantiate.an.e |
| 10cce0 | 78 70 72 65 73 73 69 6f 6e 2c 20 77 65 20 63 6f 70 79 20 69 74 2c 20 72 65 70 6c 61 63 69 6e 67 | xpression,.we.copy.it,.replacing |
| 10cd00 | 20 61 6e 79 20 76 61 72 69 61 62 6c 65 73 20 69 6e 0a 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e | .any.variables.in.the.expression |
| 10cd20 | 20 62 79 20 74 68 65 69 72 20 76 61 6c 75 65 73 20 69 6e 20 61 20 67 69 76 65 6e 20 66 72 61 6d | .by.their.values.in.a.given.fram |
| 10cd40 | 65 2e 20 20 54 68 65 20 76 61 6c 75 65 73 20 61 72 65 0a 74 68 65 6d 73 65 6c 76 65 73 20 69 6e | e...The.values.are.themselves.in |
| 10cd60 | 73 74 61 6e 74 69 61 74 65 64 2c 20 73 69 6e 63 65 20 74 68 65 79 20 63 6f 75 6c 64 20 63 6f 6e | stantiated,.since.they.could.con |
| 10cd80 | 74 61 69 6e 20 76 61 72 69 61 62 6c 65 73 20 28 66 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 69 66 20 | tain.variables.(for.example,.if. |
| 10cda0 | 60 3f 78 27 20 69 6e 20 60 65 78 70 27 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 60 3f 79 27 20 61 | `?x'.in.`exp'.is.bound.to.`?y'.a |
| 10cdc0 | 73 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 75 6e 69 66 69 63 61 74 69 6f 6e 0a 61 6e 64 20 | s.the.result.of.unification.and. |
| 10cde0 | 60 3f 79 27 20 69 73 20 69 6e 20 74 75 72 6e 20 62 6f 75 6e 64 20 74 6f 20 35 29 2e 20 20 54 68 | `?y'.is.in.turn.bound.to.5)...Th |
| 10ce00 | 65 20 61 63 74 69 6f 6e 20 74 6f 20 74 61 6b 65 20 69 66 20 61 20 76 61 72 69 61 62 6c 65 0a 63 | e.action.to.take.if.a.variable.c |
| 10ce20 | 61 6e 6e 6f 74 20 62 65 20 69 6e 73 74 61 6e 74 69 61 74 65 64 20 69 73 20 67 69 76 65 6e 20 62 | annot.be.instantiated.is.given.b |
| 10ce40 | 79 20 61 20 70 72 6f 63 65 64 75 72 61 6c 20 61 72 67 75 6d 65 6e 74 20 74 6f 0a 60 69 6e 73 74 | y.a.procedural.argument.to.`inst |
| 10ce60 | 61 6e 74 69 61 74 65 27 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 73 74 61 6e 74 | antiate'........(define.(instant |
| 10ce80 | 69 61 74 65 20 65 78 70 20 66 72 61 6d 65 20 75 6e 62 6f 75 6e 64 2d 76 61 72 2d 68 61 6e 64 6c | iate.exp.frame.unbound-var-handl |
| 10cea0 | 65 72 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 70 79 20 65 78 70 29 0a 20 20 | er)........(define.(copy.exp)... |
| 10cec0 | 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 76 61 72 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 | .......(cond.((var?.exp)........ |
| 10cee0 | 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 62 69 6e 64 69 6e 67 20 28 62 69 6e 64 69 6e 67 | .........(let.((binding.(binding |
| 10cf00 | 2d 69 6e 2d 66 72 61 6d 65 20 65 78 70 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 | -in-frame.exp.frame))).......... |
| 10cf20 | 20 20 20 20 20 20 20 20 20 28 69 66 20 62 69 6e 64 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 | .........(if.binding............ |
| 10cf40 | 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 70 79 20 28 62 69 6e 64 69 6e 67 2d 76 61 6c 75 65 20 | ...........(copy.(binding-value. |
| 10cf60 | 62 69 6e 64 69 6e 67 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | binding))....................... |
| 10cf80 | 28 75 6e 62 6f 75 6e 64 2d 76 61 72 2d 68 61 6e 64 6c 65 72 20 65 78 70 20 66 72 61 6d 65 29 29 | (unbound-var-handler.exp.frame)) |
| 10cfa0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 70 61 69 72 3f 20 65 78 70 29 0a 20 | ))................((pair?.exp).. |
| 10cfc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 63 6f 70 79 20 28 63 61 72 20 | ...............(cons.(copy.(car. |
| 10cfe0 | 65 78 70 29 29 20 28 63 6f 70 79 20 28 63 64 72 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 | exp)).(copy.(cdr.exp))))........ |
| 10d000 | 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 20 28 63 6f 70 | ........(else.exp)))........(cop |
| 10d020 | 79 20 65 78 70 29 29 0a 0a 20 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 | y.exp)).....The.procedures.that. |
| 10d040 | 6d 61 6e 69 70 75 6c 61 74 65 20 62 69 6e 64 69 6e 67 73 20 61 72 65 20 64 65 66 69 6e 65 64 20 | manipulate.bindings.are.defined. |
| 10d060 | 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 34 2d 34 2d 34 2d 38 3a 3a 2e 0a 0a 1f 0a 46 | in.section.*Note.4-4-4-8::.....F |
| 10d080 | 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d 32 2c 20 | ile:.sicp.info,..Node:.4-4-4-2,. |
| 10d0a0 | 20 4e 65 78 74 3a 20 34 2d 34 2d 34 2d 33 2c 20 20 50 72 65 76 3a 20 34 2d 34 2d 34 2d 31 2c 20 | .Next:.4-4-4-3,..Prev:.4-4-4-1,. |
| 10d0c0 | 20 55 70 3a 20 34 2d 34 2d 34 0a 0a 34 2e 34 2e 34 2e 32 20 54 68 65 20 45 76 61 6c 75 61 74 6f | .Up:.4-4-4..4.4.4.2.The.Evaluato |
| 10d0e0 | 72 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 60 71 65 | r........................The.`qe |
| 10d100 | 76 61 6c 27 20 70 72 6f 63 65 64 75 72 65 2c 20 63 61 6c 6c 65 64 20 62 79 20 74 68 65 20 60 71 | val'.procedure,.called.by.the.`q |
| 10d120 | 75 65 72 79 2d 64 72 69 76 65 72 2d 6c 6f 6f 70 27 2c 20 69 73 20 74 68 65 20 62 61 73 69 63 0a | uery-driver-loop',.is.the.basic. |
| 10d140 | 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 74 68 65 20 71 75 65 72 79 20 73 79 73 74 65 6d 2e 20 20 | evaluator.of.the.query.system... |
| 10d160 | 49 74 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 73 20 61 20 71 75 65 72 79 20 61 6e 64 20 61 | It.takes.as.inputs.a.query.and.a |
| 10d180 | 20 73 74 72 65 61 6d 0a 6f 66 20 66 72 61 6d 65 73 2c 20 61 6e 64 20 69 74 20 72 65 74 75 72 6e | .stream.of.frames,.and.it.return |
| 10d1a0 | 73 20 61 20 73 74 72 65 61 6d 20 6f 66 20 65 78 74 65 6e 64 65 64 20 66 72 61 6d 65 73 2e 20 20 | s.a.stream.of.extended.frames... |
| 10d1c0 | 49 74 20 69 64 65 6e 74 69 66 69 65 73 0a 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 20 62 79 20 61 | It.identifies.special.forms.by.a |
| 10d1e0 | 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 64 69 73 70 61 74 63 68 20 75 73 69 6e 67 20 60 67 | .data-directed.dispatch.using.`g |
| 10d200 | 65 74 27 20 61 6e 64 20 60 70 75 74 27 2c 20 6a 75 73 74 0a 61 73 20 77 65 20 64 69 64 20 69 6e | et'.and.`put',.just.as.we.did.in |
| 10d220 | 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 | .implementing.generic.operations |
| 10d240 | 20 69 6e 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 32 3a 3a 2e 20 20 41 6e 79 0a 71 75 65 72 | .in.*Note.Chapter.2::...Any.quer |
| 10d260 | 79 20 74 68 61 74 20 69 73 20 6e 6f 74 20 69 64 65 6e 74 69 66 69 65 64 20 61 73 20 61 20 73 70 | y.that.is.not.identified.as.a.sp |
| 10d280 | 65 63 69 61 6c 20 66 6f 72 6d 20 69 73 20 61 73 73 75 6d 65 64 20 74 6f 20 62 65 20 61 0a 73 69 | ecial.form.is.assumed.to.be.a.si |
| 10d2a0 | 6d 70 6c 65 20 71 75 65 72 79 2c 20 74 6f 20 62 65 20 70 72 6f 63 65 73 73 65 64 20 62 79 20 60 | mple.query,.to.be.processed.by.` |
| 10d2c0 | 73 69 6d 70 6c 65 2d 71 75 65 72 79 27 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 71 65 | simple-query'........(define.(qe |
| 10d2e0 | 76 61 6c 20 71 75 65 72 79 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 28 | val.query.frame-stream)........( |
| 10d300 | 6c 65 74 20 28 28 71 70 72 6f 63 20 28 67 65 74 20 28 74 79 70 65 20 71 75 65 72 79 29 20 27 71 | let.((qproc.(get.(type.query).'q |
| 10d320 | 65 76 61 6c 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 71 70 72 6f 63 0a 20 20 20 20 20 | eval)))..........(if.qproc...... |
| 10d340 | 20 20 20 20 20 20 20 20 28 71 70 72 6f 63 20 28 63 6f 6e 74 65 6e 74 73 20 71 75 65 72 79 29 20 | ........(qproc.(contents.query). |
| 10d360 | 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 6d 70 | frame-stream)..............(simp |
| 10d380 | 6c 65 2d 71 75 65 72 79 20 71 75 65 72 79 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 29 29 29 0a | le-query.query.frame-stream)))). |
| 10d3a0 | 0a 20 20 20 60 54 79 70 65 27 20 61 6e 64 20 60 63 6f 6e 74 65 6e 74 73 27 2c 20 64 65 66 69 6e | ....`Type'.and.`contents',.defin |
| 10d3c0 | 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 37 3a 3a 2c 20 69 | ed.in.section.*Note.4-4-4-7::,.i |
| 10d3e0 | 6d 70 6c 65 6d 65 6e 74 0a 74 68 65 20 61 62 73 74 72 61 63 74 20 73 79 6e 74 61 78 20 6f 66 20 | mplement.the.abstract.syntax.of. |
| 10d400 | 74 68 65 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 2e 0a 0a 53 69 6d 70 6c 65 20 71 75 65 72 69 | the.special.forms...Simple.queri |
| 10d420 | 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 60 73 69 6d 70 6c 65 2d 71 | es.................The.`simple-q |
| 10d440 | 75 65 72 79 27 20 70 72 6f 63 65 64 75 72 65 20 68 61 6e 64 6c 65 73 20 73 69 6d 70 6c 65 20 71 | uery'.procedure.handles.simple.q |
| 10d460 | 75 65 72 69 65 73 2e 20 20 49 74 20 74 61 6b 65 73 20 61 73 0a 61 72 67 75 6d 65 6e 74 73 20 61 | ueries...It.takes.as.arguments.a |
| 10d480 | 20 73 69 6d 70 6c 65 20 71 75 65 72 79 20 28 61 20 70 61 74 74 65 72 6e 29 20 74 6f 67 65 74 68 | .simple.query.(a.pattern).togeth |
| 10d4a0 | 65 72 20 77 69 74 68 20 61 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 2c 0a 61 6e 64 20 | er.with.a.stream.of.frames,.and. |
| 10d4c0 | 69 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 74 72 65 61 6d 20 66 6f 72 6d 65 64 20 62 79 20 | it.returns.the.stream.formed.by. |
| 10d4e0 | 65 78 74 65 6e 64 69 6e 67 20 65 61 63 68 20 66 72 61 6d 65 20 62 79 20 61 6c 6c 0a 64 61 74 61 | extending.each.frame.by.all.data |
| 10d500 | 2d 62 61 73 65 20 6d 61 74 63 68 65 73 20 6f 66 20 74 68 65 20 71 75 65 72 79 2e 0a 0a 20 20 20 | -base.matches.of.the.query...... |
| 10d520 | 20 20 28 64 65 66 69 6e 65 20 28 73 69 6d 70 6c 65 2d 71 75 65 72 79 20 71 75 65 72 79 2d 70 61 | ..(define.(simple-query.query-pa |
| 10d540 | 74 74 65 72 6e 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 28 73 74 72 65 | ttern.frame-stream)........(stre |
| 10d560 | 61 6d 2d 66 6c 61 74 6d 61 70 0a 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 66 72 61 6d | am-flatmap.........(lambda.(fram |
| 10d580 | 65 29 0a 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 61 70 70 65 6e 64 2d 64 65 6c 61 | e)...........(stream-append-dela |
| 10d5a0 | 79 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 28 66 69 6e 64 2d 61 73 73 65 72 74 69 6f 6e 73 20 | yed............(find-assertions. |
| 10d5c0 | 71 75 65 72 79 2d 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 | query-pattern.frame)............ |
| 10d5e0 | 28 64 65 6c 61 79 20 28 61 70 70 6c 79 2d 72 75 6c 65 73 20 71 75 65 72 79 2d 70 61 74 74 65 72 | (delay.(apply-rules.query-patter |
| 10d600 | 6e 20 66 72 61 6d 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 66 72 61 6d 65 2d 73 74 72 65 61 6d | n.frame)))).........frame-stream |
| 10d620 | 29 29 0a 0a 20 20 20 46 6f 72 20 65 61 63 68 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 69 6e 70 | )).....For.each.frame.in.the.inp |
| 10d640 | 75 74 20 73 74 72 65 61 6d 2c 20 77 65 20 75 73 65 20 60 66 69 6e 64 2d 61 73 73 65 72 74 69 6f | ut.stream,.we.use.`find-assertio |
| 10d660 | 6e 73 27 20 28 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 33 3a 3a 29 20 74 6f | ns'.(section.*Note.4-4-4-3::).to |
| 10d680 | 20 6d 61 74 63 68 20 74 68 65 20 70 61 74 74 65 72 6e 20 61 67 61 69 6e 73 74 20 61 6c 6c 20 61 | .match.the.pattern.against.all.a |
| 10d6a0 | 73 73 65 72 74 69 6f 6e 73 20 69 6e 20 74 68 65 0a 64 61 74 61 20 62 61 73 65 2c 20 70 72 6f 64 | ssertions.in.the.data.base,.prod |
| 10d6c0 | 75 63 69 6e 67 20 61 20 73 74 72 65 61 6d 20 6f 66 20 65 78 74 65 6e 64 65 64 20 66 72 61 6d 65 | ucing.a.stream.of.extended.frame |
| 10d6e0 | 73 2c 20 61 6e 64 20 77 65 20 75 73 65 0a 60 61 70 70 6c 79 2d 72 75 6c 65 73 27 20 28 73 65 63 | s,.and.we.use.`apply-rules'.(sec |
| 10d700 | 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 34 3a 3a 29 20 74 6f 20 61 70 70 6c 79 20 61 | tion.*Note.4-4-4-4::).to.apply.a |
| 10d720 | 6c 6c 20 70 6f 73 73 69 62 6c 65 20 72 75 6c 65 73 2c 0a 70 72 6f 64 75 63 69 6e 67 20 61 6e 6f | ll.possible.rules,.producing.ano |
| 10d740 | 74 68 65 72 20 73 74 72 65 61 6d 20 6f 66 20 65 78 74 65 6e 64 65 64 20 66 72 61 6d 65 73 2e 20 | ther.stream.of.extended.frames.. |
| 10d760 | 20 54 68 65 73 65 20 74 77 6f 20 73 74 72 65 61 6d 73 20 61 72 65 0a 63 6f 6d 62 69 6e 65 64 20 | .These.two.streams.are.combined. |
| 10d780 | 28 75 73 69 6e 67 20 60 73 74 72 65 61 6d 2d 61 70 70 65 6e 64 2d 64 65 6c 61 79 65 64 27 2c 20 | (using.`stream-append-delayed',. |
| 10d7a0 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 36 3a 3a 29 20 74 6f 0a 6d 61 6b 65 | section.*Note.4-4-4-6::).to.make |
| 10d7c0 | 20 61 20 73 74 72 65 61 6d 20 6f 66 20 61 6c 6c 20 74 68 65 20 77 61 79 73 20 74 68 61 74 20 74 | .a.stream.of.all.the.ways.that.t |
| 10d7e0 | 68 65 20 67 69 76 65 6e 20 70 61 74 74 65 72 6e 20 63 61 6e 20 62 65 20 73 61 74 69 73 66 69 65 | he.given.pattern.can.be.satisfie |
| 10d800 | 64 0a 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 66 | d.consistent.with.the.original.f |
| 10d820 | 72 61 6d 65 20 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 37 31 3a 3a 29 | rame.(see.*Note.Exercise.4-71::) |
| 10d840 | 2e 20 20 54 68 65 0a 73 74 72 65 61 6d 73 20 66 6f 72 20 74 68 65 20 69 6e 64 69 76 69 64 75 61 | ...The.streams.for.the.individua |
| 10d860 | 6c 20 69 6e 70 75 74 20 66 72 61 6d 65 73 20 61 72 65 20 63 6f 6d 62 69 6e 65 64 20 75 73 69 6e | l.input.frames.are.combined.usin |
| 10d880 | 67 0a 60 73 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 | g.`stream-flatmap'.(section.*Not |
| 10d8a0 | 65 20 34 2d 34 2d 34 2d 36 3a 3a 29 20 74 6f 20 66 6f 72 6d 20 6f 6e 65 20 6c 61 72 67 65 20 73 | e.4-4-4-6::).to.form.one.large.s |
| 10d8c0 | 74 72 65 61 6d 20 6f 66 0a 61 6c 6c 20 74 68 65 20 77 61 79 73 20 74 68 61 74 20 61 6e 79 20 6f | tream.of.all.the.ways.that.any.o |
| 10d8e0 | 66 20 74 68 65 20 66 72 61 6d 65 73 20 69 6e 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 69 6e 70 | f.the.frames.in.the.original.inp |
| 10d900 | 75 74 20 73 74 72 65 61 6d 20 63 61 6e 20 62 65 0a 65 78 74 65 6e 64 65 64 20 74 6f 20 70 72 6f | ut.stream.can.be.extended.to.pro |
| 10d920 | 64 75 63 65 20 61 20 6d 61 74 63 68 20 77 69 74 68 20 74 68 65 20 67 69 76 65 6e 20 70 61 74 74 | duce.a.match.with.the.given.patt |
| 10d940 | 65 72 6e 2e 0a 0a 43 6f 6d 70 6f 75 6e 64 20 71 75 65 72 69 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e | ern...Compound.queries.......... |
| 10d960 | 2e 2e 2e 2e 2e 2e 2e 0a 0a 60 41 6e 64 27 20 71 75 65 72 69 65 73 20 61 72 65 20 68 61 6e 64 6c | .........`And'.queries.are.handl |
| 10d980 | 65 64 20 61 73 20 69 6c 6c 75 73 74 72 61 74 65 64 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 | ed.as.illustrated.in.*Note.Figur |
| 10d9a0 | 65 20 34 2d 35 3a 3a 20 62 79 20 74 68 65 0a 60 63 6f 6e 6a 6f 69 6e 27 20 70 72 6f 63 65 64 75 | e.4-5::.by.the.`conjoin'.procedu |
| 10d9c0 | 72 65 2e 20 20 60 43 6f 6e 6a 6f 69 6e 27 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 73 20 74 | re...`Conjoin'.takes.as.inputs.t |
| 10d9e0 | 68 65 20 63 6f 6e 6a 75 6e 63 74 73 20 61 6e 64 20 74 68 65 0a 66 72 61 6d 65 20 73 74 72 65 61 | he.conjuncts.and.the.frame.strea |
| 10da00 | 6d 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 65 78 74 65 | m.and.returns.the.stream.of.exte |
| 10da20 | 6e 64 65 64 20 66 72 61 6d 65 73 2e 20 20 46 69 72 73 74 2c 0a 60 63 6f 6e 6a 6f 69 6e 27 20 70 | nded.frames...First,.`conjoin'.p |
| 10da40 | 72 6f 63 65 73 73 65 73 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 20 74 6f | rocesses.the.stream.of.frames.to |
| 10da60 | 20 66 69 6e 64 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 61 6c 6c 0a 70 6f 73 73 69 62 6c 65 | .find.the.stream.of.all.possible |
| 10da80 | 20 66 72 61 6d 65 20 65 78 74 65 6e 73 69 6f 6e 73 20 74 68 61 74 20 73 61 74 69 73 66 79 20 74 | .frame.extensions.that.satisfy.t |
| 10daa0 | 68 65 20 66 69 72 73 74 20 71 75 65 72 79 20 69 6e 20 74 68 65 0a 63 6f 6e 6a 75 6e 63 74 69 6f | he.first.query.in.the.conjunctio |
| 10dac0 | 6e 2e 20 20 54 68 65 6e 2c 20 75 73 69 6e 67 20 74 68 69 73 20 61 73 20 74 68 65 20 6e 65 77 20 | n...Then,.using.this.as.the.new. |
| 10dae0 | 66 72 61 6d 65 20 73 74 72 65 61 6d 2c 20 69 74 20 72 65 63 75 72 73 69 76 65 6c 79 0a 61 70 70 | frame.stream,.it.recursively.app |
| 10db00 | 6c 69 65 73 20 60 63 6f 6e 6a 6f 69 6e 27 20 74 6f 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 | lies.`conjoin'.to.the.rest.of.th |
| 10db20 | 65 20 71 75 65 72 69 65 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 6a 6f 69 | e.queries........(define.(conjoi |
| 10db40 | 6e 20 63 6f 6e 6a 75 6e 63 74 73 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 | n.conjuncts.frame-stream)....... |
| 10db60 | 20 28 69 66 20 28 65 6d 70 74 79 2d 63 6f 6e 6a 75 6e 63 74 69 6f 6e 3f 20 63 6f 6e 6a 75 6e 63 | .(if.(empty-conjunction?.conjunc |
| 10db80 | 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 0a 20 20 20 20 | ts)............frame-stream..... |
| 10dba0 | 20 20 20 20 20 20 20 28 63 6f 6e 6a 6f 69 6e 20 28 72 65 73 74 2d 63 6f 6e 6a 75 6e 63 74 73 20 | .......(conjoin.(rest-conjuncts. |
| 10dbc0 | 63 6f 6e 6a 75 6e 63 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | conjuncts).....................( |
| 10dbe0 | 71 65 76 61 6c 20 28 66 69 72 73 74 2d 63 6f 6e 6a 75 6e 63 74 20 63 6f 6e 6a 75 6e 63 74 73 29 | qeval.(first-conjunct.conjuncts) |
| 10dc00 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 72 61 6d | ............................fram |
| 10dc20 | 65 2d 73 74 72 65 61 6d 29 29 29 29 0a 0a 20 20 20 54 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a | e-stream)))).....The.expression. |
| 10dc40 | 0a 20 20 20 20 20 28 70 75 74 20 27 61 6e 64 20 27 71 65 76 61 6c 20 63 6f 6e 6a 6f 69 6e 29 0a | ......(put.'and.'qeval.conjoin). |
| 10dc60 | 0a 73 65 74 73 20 75 70 20 60 71 65 76 61 6c 27 20 74 6f 20 64 69 73 70 61 74 63 68 20 74 6f 20 | .sets.up.`qeval'.to.dispatch.to. |
| 10dc80 | 60 63 6f 6e 6a 6f 69 6e 27 20 77 68 65 6e 20 61 6e 20 60 61 6e 64 27 20 66 6f 72 6d 20 69 73 0a | `conjoin'.when.an.`and'.form.is. |
| 10dca0 | 65 6e 63 6f 75 6e 74 65 72 65 64 2e 0a 0a 20 20 20 60 4f 72 27 20 71 75 65 72 69 65 73 20 61 72 | encountered......`Or'.queries.ar |
| 10dcc0 | 65 20 68 61 6e 64 6c 65 64 20 73 69 6d 69 6c 61 72 6c 79 2c 20 61 73 20 73 68 6f 77 6e 20 69 6e | e.handled.similarly,.as.shown.in |
| 10dce0 | 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 34 2d 36 3a 3a 2e 0a 54 68 65 20 6f 75 74 70 75 74 20 | .*Note.Figure.4-6::..The.output. |
| 10dd00 | 73 74 72 65 61 6d 73 20 66 6f 72 20 74 68 65 20 76 61 72 69 6f 75 73 20 64 69 73 6a 75 6e 63 74 | streams.for.the.various.disjunct |
| 10dd20 | 73 20 6f 66 20 74 68 65 20 60 6f 72 27 20 61 72 65 20 63 6f 6d 70 75 74 65 64 0a 73 65 70 61 72 | s.of.the.`or'.are.computed.separ |
| 10dd40 | 61 74 65 6c 79 20 61 6e 64 20 6d 65 72 67 65 64 20 75 73 69 6e 67 20 74 68 65 20 60 69 6e 74 65 | ately.and.merged.using.the.`inte |
| 10dd60 | 72 6c 65 61 76 65 2d 64 65 6c 61 79 65 64 27 20 70 72 6f 63 65 64 75 72 65 20 66 72 6f 6d 0a 73 | rleave-delayed'.procedure.from.s |
| 10dd80 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 36 3a 3a 2e 20 20 28 53 65 65 20 2a 4e | ection.*Note.4-4-4-6::...(See.*N |
| 10dda0 | 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 37 31 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 45 78 | ote.Exercise.4-71::.and.*Note.Ex |
| 10ddc0 | 65 72 63 69 73 65 0a 34 2d 37 32 3a 3a 2e 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 | ercise.4-72::.).......(define.(d |
| 10dde0 | 69 73 6a 6f 69 6e 20 64 69 73 6a 75 6e 63 74 73 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a 20 | isjoin.disjuncts.frame-stream).. |
| 10de00 | 20 20 20 20 20 20 28 69 66 20 28 65 6d 70 74 79 2d 64 69 73 6a 75 6e 63 74 69 6f 6e 3f 20 64 69 | ......(if.(empty-disjunction?.di |
| 10de20 | 73 6a 75 6e 63 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 | sjuncts)............the-empty-st |
| 10de40 | 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 6e 74 65 72 6c 65 61 76 65 2d 64 65 6c 61 | ream............(interleave-dela |
| 10de60 | 79 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 71 65 76 61 6c 20 28 66 69 72 73 74 2d 64 69 | yed.............(qeval.(first-di |
| 10de80 | 73 6a 75 6e 63 74 20 64 69 73 6a 75 6e 63 74 73 29 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a | sjunct.disjuncts).frame-stream). |
| 10dea0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 6c 61 79 20 28 64 69 73 6a 6f 69 6e 20 28 72 65 73 | ............(delay.(disjoin.(res |
| 10dec0 | 74 2d 64 69 73 6a 75 6e 63 74 73 20 64 69 73 6a 75 6e 63 74 73 29 0a 20 20 20 20 20 20 20 20 20 | t-disjuncts.disjuncts).......... |
| 10dee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 | ...................frame-stream) |
| 10df00 | 29 29 29 29 0a 0a 20 20 20 20 20 28 70 75 74 20 27 6f 72 20 27 71 65 76 61 6c 20 64 69 73 6a 6f | )))).......(put.'or.'qeval.disjo |
| 10df20 | 69 6e 29 0a 0a 20 20 20 54 68 65 20 70 72 65 64 69 63 61 74 65 73 20 61 6e 64 20 73 65 6c 65 63 | in).....The.predicates.and.selec |
| 10df40 | 74 6f 72 73 20 66 6f 72 20 74 68 65 20 73 79 6e 74 61 78 20 6f 66 20 63 6f 6e 6a 75 6e 63 74 73 | tors.for.the.syntax.of.conjuncts |
| 10df60 | 20 61 6e 64 0a 64 69 73 6a 75 6e 63 74 73 20 61 72 65 20 67 69 76 65 6e 20 69 6e 20 73 65 63 74 | .and.disjuncts.are.given.in.sect |
| 10df80 | 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 37 3a 3a 2e 0a 0a 46 69 6c 74 65 72 73 0a 2e 2e | ion.*Note.4-4-4-7::...Filters... |
| 10dfa0 | 2e 2e 2e 2e 2e 0a 0a 60 4e 6f 74 27 20 69 73 20 68 61 6e 64 6c 65 64 20 62 79 20 74 68 65 20 6d | .......`Not'.is.handled.by.the.m |
| 10dfc0 | 65 74 68 6f 64 20 6f 75 74 6c 69 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 | ethod.outlined.in.section.*Note. |
| 10dfe0 | 34 2d 34 2d 32 3a 3a 2e 20 20 57 65 0a 61 74 74 65 6d 70 74 20 74 6f 20 65 78 74 65 6e 64 20 65 | 4-4-2::...We.attempt.to.extend.e |
| 10e000 | 61 63 68 20 66 72 61 6d 65 20 69 6e 20 74 68 65 20 69 6e 70 75 74 20 73 74 72 65 61 6d 20 74 6f | ach.frame.in.the.input.stream.to |
| 10e020 | 20 73 61 74 69 73 66 79 20 74 68 65 20 71 75 65 72 79 0a 62 65 69 6e 67 20 6e 65 67 61 74 65 64 | .satisfy.the.query.being.negated |
| 10e040 | 2c 20 61 6e 64 20 77 65 20 69 6e 63 6c 75 64 65 20 61 20 67 69 76 65 6e 20 66 72 61 6d 65 20 69 | ,.and.we.include.a.given.frame.i |
| 10e060 | 6e 20 74 68 65 20 6f 75 74 70 75 74 20 73 74 72 65 61 6d 20 6f 6e 6c 79 0a 69 66 20 69 74 20 63 | n.the.output.stream.only.if.it.c |
| 10e080 | 61 6e 6e 6f 74 20 62 65 20 65 78 74 65 6e 64 65 64 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | annot.be.extended........(define |
| 10e0a0 | 20 28 6e 65 67 61 74 65 20 6f 70 65 72 61 6e 64 73 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a | .(negate.operands.frame-stream). |
| 10e0c0 | 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 0a 20 20 20 20 20 20 20 20 28 | .......(stream-flatmap.........( |
| 10e0e0 | 6c 61 6d 62 64 61 20 28 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 73 74 | lambda.(frame)...........(if.(st |
| 10e100 | 72 65 61 6d 2d 6e 75 6c 6c 3f 20 28 71 65 76 61 6c 20 28 6e 65 67 61 74 65 64 2d 71 75 65 72 79 | ream-null?.(qeval.(negated-query |
| 10e120 | 20 6f 70 65 72 61 6e 64 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .operands)...................... |
| 10e140 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 6e 67 6c 65 74 6f 6e 2d 73 74 72 65 61 6d 20 | ..............(singleton-stream. |
| 10e160 | 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 6e 67 6c 65 74 6f | frame)))...............(singleto |
| 10e180 | 6e 2d 73 74 72 65 61 6d 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 | n-stream.frame)...............th |
| 10e1a0 | 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 29 29 0a 20 20 20 20 20 20 20 20 66 72 61 6d 65 2d 73 | e-empty-stream)).........frame-s |
| 10e1c0 | 74 72 65 61 6d 29 29 0a 0a 20 20 20 20 20 28 70 75 74 20 27 6e 6f 74 20 27 71 65 76 61 6c 20 6e | tream)).......(put.'not.'qeval.n |
| 10e1e0 | 65 67 61 74 65 29 0a 0a 20 20 20 60 4c 69 73 70 2d 76 61 6c 75 65 27 20 69 73 20 61 20 66 69 6c | egate).....`Lisp-value'.is.a.fil |
| 10e200 | 74 65 72 20 73 69 6d 69 6c 61 72 20 74 6f 20 60 6e 6f 74 27 2e 20 20 45 61 63 68 20 66 72 61 6d | ter.similar.to.`not'...Each.fram |
| 10e220 | 65 20 69 6e 20 74 68 65 20 73 74 72 65 61 6d 0a 69 73 20 75 73 65 64 20 74 6f 20 69 6e 73 74 61 | e.in.the.stream.is.used.to.insta |
| 10e240 | 6e 74 69 61 74 65 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 69 6e 20 74 68 65 20 70 61 74 74 | ntiate.the.variables.in.the.patt |
| 10e260 | 65 72 6e 2c 20 74 68 65 20 69 6e 64 69 63 61 74 65 64 0a 70 72 65 64 69 63 61 74 65 20 69 73 20 | ern,.the.indicated.predicate.is. |
| 10e280 | 61 70 70 6c 69 65 64 2c 20 61 6e 64 20 74 68 65 20 66 72 61 6d 65 73 20 66 6f 72 20 77 68 69 63 | applied,.and.the.frames.for.whic |
| 10e2a0 | 68 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 72 65 74 75 72 6e 73 0a 66 61 6c 73 65 20 61 72 | h.the.predicate.returns.false.ar |
| 10e2c0 | 65 20 66 69 6c 74 65 72 65 64 20 6f 75 74 20 6f 66 20 74 68 65 20 69 6e 70 75 74 20 73 74 72 65 | e.filtered.out.of.the.input.stre |
| 10e2e0 | 61 6d 2e 20 20 41 6e 20 65 72 72 6f 72 20 72 65 73 75 6c 74 73 20 69 66 20 74 68 65 72 65 0a 61 | am...An.error.results.if.there.a |
| 10e300 | 72 65 20 75 6e 62 6f 75 6e 64 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 2e 0a 0a 20 | re.unbound.pattern.variables.... |
| 10e320 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 69 73 70 2d 76 61 6c 75 65 20 63 61 6c 6c 20 66 72 61 | ....(define.(lisp-value.call.fra |
| 10e340 | 6d 65 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 66 6c 61 74 6d 61 | me-stream)........(stream-flatma |
| 10e360 | 70 0a 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 66 72 61 6d 65 29 0a 20 20 20 20 20 20 | p.........(lambda.(frame)....... |
| 10e380 | 20 20 20 20 28 69 66 20 28 65 78 65 63 75 74 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....(if.(execute................ |
| 10e3a0 | 28 69 6e 73 74 61 6e 74 69 61 74 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c | (instantiate.................cal |
| 10e3c0 | 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 72 61 6d 65 0a 20 20 20 20 20 20 20 20 | l.................frame......... |
| 10e3e0 | 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 76 20 66 29 0a 20 20 20 20 20 20 20 20 20 20 | ........(lambda.(v.f)........... |
| 10e400 | 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 70 61 74 20 76 61 72 20 | ........(error."Unknown.pat.var. |
| 10e420 | 2d 2d 20 4c 49 53 50 2d 56 41 4c 55 45 22 20 76 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | --.LISP-VALUE".v))))............ |
| 10e440 | 20 20 20 28 73 69 6e 67 6c 65 74 6f 6e 2d 73 74 72 65 61 6d 20 66 72 61 6d 65 29 0a 20 20 20 20 | ...(singleton-stream.frame)..... |
| 10e460 | 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 29 29 0a 20 20 20 | ..........the-empty-stream)).... |
| 10e480 | 20 20 20 20 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 29 0a 0a 20 20 20 20 20 28 70 75 74 20 27 | .....frame-stream)).......(put.' |
| 10e4a0 | 6c 69 73 70 2d 76 61 6c 75 65 20 27 71 65 76 61 6c 20 6c 69 73 70 2d 76 61 6c 75 65 29 0a 0a 20 | lisp-value.'qeval.lisp-value)... |
| 10e4c0 | 20 20 60 45 78 65 63 75 74 65 27 2c 20 77 68 69 63 68 20 61 70 70 6c 69 65 73 20 74 68 65 20 70 | ..`Execute',.which.applies.the.p |
| 10e4e0 | 72 65 64 69 63 61 74 65 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 2c 20 6d 75 73 74 20 | redicate.to.the.arguments,.must. |
| 10e500 | 60 65 76 61 6c 27 0a 74 68 65 20 70 72 65 64 69 63 61 74 65 20 65 78 70 72 65 73 73 69 6f 6e 20 | `eval'.the.predicate.expression. |
| 10e520 | 74 6f 20 67 65 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 61 70 70 6c 79 2e 20 20 | to.get.the.procedure.to.apply... |
| 10e540 | 48 6f 77 65 76 65 72 2c 20 69 74 0a 6d 75 73 74 20 6e 6f 74 20 65 76 61 6c 75 61 74 65 20 74 68 | However,.it.must.not.evaluate.th |
| 10e560 | 65 20 61 72 67 75 6d 65 6e 74 73 2c 20 73 69 6e 63 65 20 74 68 65 79 20 61 72 65 20 61 6c 72 65 | e.arguments,.since.they.are.alre |
| 10e580 | 61 64 79 20 74 68 65 20 61 63 74 75 61 6c 0a 61 72 67 75 6d 65 6e 74 73 2c 20 6e 6f 74 20 65 78 | ady.the.actual.arguments,.not.ex |
| 10e5a0 | 70 72 65 73 73 69 6f 6e 73 20 77 68 6f 73 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 28 69 6e 20 4c | pressions.whose.evaluation.(in.L |
| 10e5c0 | 69 73 70 29 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 74 68 65 0a 61 72 67 75 6d 65 6e 74 73 2e | isp).will.produce.the.arguments. |
| 10e5e0 | 20 20 4e 6f 74 65 20 74 68 61 74 20 60 65 78 65 63 75 74 65 27 20 69 73 20 69 6d 70 6c 65 6d 65 | ..Note.that.`execute'.is.impleme |
| 10e600 | 6e 74 65 64 20 75 73 69 6e 67 20 60 65 76 61 6c 27 20 61 6e 64 20 60 61 70 70 6c 79 27 0a 66 72 | nted.using.`eval'.and.`apply'.fr |
| 10e620 | 6f 6d 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 4c 69 73 70 20 73 79 73 74 65 6d 2e 0a 0a | om.the.underlying.Lisp.system... |
| 10e640 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 65 63 75 74 65 20 65 78 70 29 0a 20 20 20 20 20 | .....(define.(execute.exp)...... |
| 10e660 | 20 20 28 61 70 70 6c 79 20 28 65 76 61 6c 20 28 70 72 65 64 69 63 61 74 65 20 65 78 70 29 20 75 | ..(apply.(eval.(predicate.exp).u |
| 10e680 | 73 65 72 2d 69 6e 69 74 69 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 0a 20 20 20 20 20 20 20 | ser-initial-environment)........ |
| 10e6a0 | 20 20 20 20 20 20 20 28 61 72 67 73 20 65 78 70 29 29 29 0a 0a 20 20 20 54 68 65 20 60 61 6c 77 | .......(args.exp))).....The.`alw |
| 10e6c0 | 61 79 73 2d 74 72 75 65 27 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 70 72 6f 76 69 64 65 73 20 | ays-true'.special.form.provides. |
| 10e6e0 | 66 6f 72 20 61 20 71 75 65 72 79 20 74 68 61 74 20 69 73 20 61 6c 77 61 79 73 0a 73 61 74 69 73 | for.a.query.that.is.always.satis |
| 10e700 | 66 69 65 64 2e 20 20 49 74 20 69 67 6e 6f 72 65 73 20 69 74 73 20 63 6f 6e 74 65 6e 74 73 20 28 | fied...It.ignores.its.contents.( |
| 10e720 | 6e 6f 72 6d 61 6c 6c 79 20 65 6d 70 74 79 29 20 61 6e 64 20 73 69 6d 70 6c 79 20 70 61 73 73 65 | normally.empty).and.simply.passe |
| 10e740 | 73 0a 74 68 72 6f 75 67 68 20 61 6c 6c 20 74 68 65 20 66 72 61 6d 65 73 20 69 6e 20 74 68 65 20 | s.through.all.the.frames.in.the. |
| 10e760 | 69 6e 70 75 74 20 73 74 72 65 61 6d 2e 20 20 60 41 6c 77 61 79 73 2d 74 72 75 65 27 20 69 73 20 | input.stream...`Always-true'.is. |
| 10e780 | 75 73 65 64 20 62 79 0a 74 68 65 20 60 72 75 6c 65 2d 62 6f 64 79 27 20 73 65 6c 65 63 74 6f 72 | used.by.the.`rule-body'.selector |
| 10e7a0 | 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 37 3a 3a 29 20 74 6f 20 70 72 | .(section.*Note.4-4-4-7::).to.pr |
| 10e7c0 | 6f 76 69 64 65 20 62 6f 64 69 65 73 0a 66 6f 72 20 72 75 6c 65 73 20 74 68 61 74 20 77 65 72 65 | ovide.bodies.for.rules.that.were |
| 10e7e0 | 20 64 65 66 69 6e 65 64 20 77 69 74 68 6f 75 74 20 62 6f 64 69 65 73 20 28 74 68 61 74 20 69 73 | .defined.without.bodies.(that.is |
| 10e800 | 2c 20 72 75 6c 65 73 20 77 68 6f 73 65 0a 63 6f 6e 63 6c 75 73 69 6f 6e 73 20 61 72 65 20 61 6c | ,.rules.whose.conclusions.are.al |
| 10e820 | 77 61 79 73 20 73 61 74 69 73 66 69 65 64 29 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | ways.satisfied)........(define.( |
| 10e840 | 61 6c 77 61 79 73 2d 74 72 75 65 20 69 67 6e 6f 72 65 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 | always-true.ignore.frame-stream) |
| 10e860 | 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a 0a 20 20 20 20 20 28 70 75 74 20 27 61 6c 77 61 79 | .frame-stream).......(put.'alway |
| 10e880 | 73 2d 74 72 75 65 20 27 71 65 76 61 6c 20 61 6c 77 61 79 73 2d 74 72 75 65 29 0a 0a 20 20 20 54 | s-true.'qeval.always-true).....T |
| 10e8a0 | 68 65 20 73 65 6c 65 63 74 6f 72 73 20 74 68 61 74 20 64 65 66 69 6e 65 20 74 68 65 20 73 79 6e | he.selectors.that.define.the.syn |
| 10e8c0 | 74 61 78 20 6f 66 20 60 6e 6f 74 27 20 61 6e 64 20 60 6c 69 73 70 2d 76 61 6c 75 65 27 20 61 72 | tax.of.`not'.and.`lisp-value'.ar |
| 10e8e0 | 65 0a 67 69 76 65 6e 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 37 | e.given.in.section.*Note.4-4-4-7 |
| 10e900 | 3a 3a 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 | ::.....File:.sicp.info,..Node:.4 |
| 10e920 | 2d 34 2d 34 2d 33 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2d 34 2d 34 2c 20 20 50 72 65 76 3a 20 34 | -4-4-3,..Next:.4-4-4-4,..Prev:.4 |
| 10e940 | 2d 34 2d 34 2d 32 2c 20 20 55 70 3a 20 34 2d 34 2d 34 0a 0a 34 2e 34 2e 34 2e 33 20 46 69 6e 64 | -4-4-2,..Up:.4-4-4..4.4.4.3.Find |
| 10e960 | 69 6e 67 20 41 73 73 65 72 74 69 6f 6e 73 20 62 79 20 50 61 74 74 65 72 6e 20 4d 61 74 63 68 69 | ing.Assertions.by.Pattern.Matchi |
| 10e980 | 6e 67 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ng.............................. |
| 10e9a0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 60 46 69 6e 64 2d 61 73 73 65 72 74 69 | ...................`Find-asserti |
| 10e9c0 | 6f 6e 73 27 2c 20 63 61 6c 6c 65 64 20 62 79 20 60 73 69 6d 70 6c 65 2d 71 75 65 72 79 27 20 28 | ons',.called.by.`simple-query'.( |
| 10e9e0 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 32 3a 3a 29 2c 0a 74 61 6b 65 73 20 | section.*Note.4-4-4-2::),.takes. |
| 10ea00 | 61 73 20 69 6e 70 75 74 20 61 20 70 61 74 74 65 72 6e 20 61 6e 64 20 61 20 66 72 61 6d 65 2e 20 | as.input.a.pattern.and.a.frame.. |
| 10ea20 | 20 49 74 20 72 65 74 75 72 6e 73 20 61 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 2c 0a | .It.returns.a.stream.of.frames,. |
| 10ea40 | 65 61 63 68 20 65 78 74 65 6e 64 69 6e 67 20 74 68 65 20 67 69 76 65 6e 20 6f 6e 65 20 62 79 20 | each.extending.the.given.one.by. |
| 10ea60 | 61 20 64 61 74 61 2d 62 61 73 65 20 6d 61 74 63 68 20 6f 66 20 74 68 65 20 67 69 76 65 6e 20 70 | a.data-base.match.of.the.given.p |
| 10ea80 | 61 74 74 65 72 6e 2e 0a 49 74 20 75 73 65 73 20 60 66 65 74 63 68 2d 61 73 73 65 72 74 69 6f 6e | attern..It.uses.`fetch-assertion |
| 10eaa0 | 73 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 35 3a 3a 29 20 74 6f 20 | s'.(section.*Note.4-4-4-5::).to. |
| 10eac0 | 67 65 74 20 61 20 73 74 72 65 61 6d 0a 6f 66 20 61 6c 6c 20 74 68 65 20 61 73 73 65 72 74 69 6f | get.a.stream.of.all.the.assertio |
| 10eae0 | 6e 73 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 74 68 61 74 20 73 68 6f 75 6c 64 20 | ns.in.the.data.base.that.should. |
| 10eb00 | 62 65 20 63 68 65 63 6b 65 64 20 66 6f 72 20 61 0a 6d 61 74 63 68 20 61 67 61 69 6e 73 74 20 74 | be.checked.for.a.match.against.t |
| 10eb20 | 68 65 20 70 61 74 74 65 72 6e 20 61 6e 64 20 74 68 65 20 66 72 61 6d 65 2e 20 20 54 68 65 20 72 | he.pattern.and.the.frame...The.r |
| 10eb40 | 65 61 73 6f 6e 20 66 6f 72 0a 60 66 65 74 63 68 2d 61 73 73 65 72 74 69 6f 6e 73 27 20 68 65 72 | eason.for.`fetch-assertions'.her |
| 10eb60 | 65 20 69 73 20 74 68 61 74 20 77 65 20 63 61 6e 20 6f 66 74 65 6e 20 61 70 70 6c 79 20 73 69 6d | e.is.that.we.can.often.apply.sim |
| 10eb80 | 70 6c 65 20 74 65 73 74 73 20 74 68 61 74 0a 77 69 6c 6c 20 65 6c 69 6d 69 6e 61 74 65 20 6d 61 | ple.tests.that.will.eliminate.ma |
| 10eba0 | 6e 79 20 6f 66 20 74 68 65 20 65 6e 74 72 69 65 73 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 | ny.of.the.entries.in.the.data.ba |
| 10ebc0 | 73 65 20 66 72 6f 6d 20 74 68 65 20 70 6f 6f 6c 20 6f 66 0a 63 61 6e 64 69 64 61 74 65 73 20 66 | se.from.the.pool.of.candidates.f |
| 10ebe0 | 6f 72 20 61 20 73 75 63 63 65 73 73 66 75 6c 20 6d 61 74 63 68 2e 20 20 54 68 65 20 73 79 73 74 | or.a.successful.match...The.syst |
| 10ec00 | 65 6d 20 77 6f 75 6c 64 20 73 74 69 6c 6c 20 77 6f 72 6b 20 69 66 20 77 65 0a 65 6c 69 6d 69 6e | em.would.still.work.if.we.elimin |
| 10ec20 | 61 74 65 64 20 60 66 65 74 63 68 2d 61 73 73 65 72 74 69 6f 6e 73 27 20 61 6e 64 20 73 69 6d 70 | ated.`fetch-assertions'.and.simp |
| 10ec40 | 6c 79 20 63 68 65 63 6b 65 64 20 61 20 73 74 72 65 61 6d 20 6f 66 20 61 6c 6c 0a 61 73 73 65 72 | ly.checked.a.stream.of.all.asser |
| 10ec60 | 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2c 20 62 75 74 20 74 68 65 20 | tions.in.the.data.base,.but.the. |
| 10ec80 | 63 6f 6d 70 75 74 61 74 69 6f 6e 20 77 6f 75 6c 64 20 62 65 20 6c 65 73 73 20 65 66 66 69 63 69 | computation.would.be.less.effici |
| 10eca0 | 65 6e 74 0a 62 65 63 61 75 73 65 20 77 65 20 77 6f 75 6c 64 20 6e 65 65 64 20 74 6f 20 6d 61 6b | ent.because.we.would.need.to.mak |
| 10ecc0 | 65 20 6d 61 6e 79 20 6d 6f 72 65 20 63 61 6c 6c 73 20 74 6f 20 74 68 65 20 6d 61 74 63 68 65 72 | e.many.more.calls.to.the.matcher |
| 10ece0 | 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 6e 64 2d 61 73 73 65 72 74 69 6f 6e 73 | ........(define.(find-assertions |
| 10ed00 | 20 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 66 | .pattern.frame)........(stream-f |
| 10ed20 | 6c 61 74 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 64 61 74 75 6d 29 0a 20 20 20 20 20 20 20 20 20 | latmap.(lambda.(datum).......... |
| 10ed40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 68 65 63 6b 2d 61 6e 2d 61 73 73 65 72 74 | ................(check-an-assert |
| 10ed60 | 69 6f 6e 20 64 61 74 75 6d 20 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 29 0a 20 20 20 20 20 20 | ion.datum.pattern.frame))....... |
| 10ed80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 65 74 63 68 2d 61 73 73 65 72 74 69 6f | .................(fetch-assertio |
| 10eda0 | 6e 73 20 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 29 29 0a 0a 20 20 20 60 43 68 65 63 6b 2d 61 | ns.pattern.frame))).....`Check-a |
| 10edc0 | 6e 2d 61 73 73 65 72 74 69 6f 6e 27 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 | n-assertion'.takes.as.arguments. |
| 10ede0 | 61 20 70 61 74 74 65 72 6e 2c 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 0a 28 61 73 73 65 72 74 | a.pattern,.a.data.object.(assert |
| 10ee00 | 69 6f 6e 29 2c 20 61 6e 64 20 61 20 66 72 61 6d 65 20 61 6e 64 20 72 65 74 75 72 6e 73 20 65 69 | ion),.and.a.frame.and.returns.ei |
| 10ee20 | 74 68 65 72 20 61 20 6f 6e 65 2d 65 6c 65 6d 65 6e 74 20 73 74 72 65 61 6d 0a 63 6f 6e 74 61 69 | ther.a.one-element.stream.contai |
| 10ee40 | 6e 69 6e 67 20 74 68 65 20 65 78 74 65 6e 64 65 64 20 66 72 61 6d 65 20 6f 72 20 60 74 68 65 2d | ning.the.extended.frame.or.`the- |
| 10ee60 | 65 6d 70 74 79 2d 73 74 72 65 61 6d 27 20 69 66 20 74 68 65 20 6d 61 74 63 68 20 66 61 69 6c 73 | empty-stream'.if.the.match.fails |
| 10ee80 | 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 68 65 63 6b 2d 61 6e 2d 61 73 73 65 72 74 | ........(define.(check-an-assert |
| 10eea0 | 69 6f 6e 20 61 73 73 65 72 74 69 6f 6e 20 71 75 65 72 79 2d 70 61 74 20 71 75 65 72 79 2d 66 72 | ion.assertion.query-pat.query-fr |
| 10eec0 | 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6d 61 74 63 68 2d 72 65 73 75 6c 74 0a | ame)........(let.((match-result. |
| 10eee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 74 74 65 72 6e 2d 6d 61 74 63 68 20 71 75 65 | ..............(pattern-match.que |
| 10ef00 | 72 79 2d 70 61 74 20 61 73 73 65 72 74 69 6f 6e 20 71 75 65 72 79 2d 66 72 61 6d 65 29 29 29 0a | ry-pat.assertion.query-frame))). |
| 10ef20 | 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 71 3f 20 6d 61 74 63 68 2d 72 65 73 75 6c 74 20 27 | .........(if.(eq?.match-result.' |
| 10ef40 | 66 61 69 6c 65 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 | failed)..............the-empty-s |
| 10ef60 | 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 6e 67 6c 65 74 6f 6e 2d 73 74 | tream..............(singleton-st |
| 10ef80 | 72 65 61 6d 20 6d 61 74 63 68 2d 72 65 73 75 6c 74 29 29 29 29 0a 0a 20 20 20 54 68 65 20 62 61 | ream.match-result)))).....The.ba |
| 10efa0 | 73 69 63 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 65 72 20 72 65 74 75 72 6e 73 20 65 69 74 68 | sic.pattern.matcher.returns.eith |
| 10efc0 | 65 72 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 66 61 69 6c 65 64 27 20 6f 72 20 61 6e 0a 65 78 74 | er.the.symbol.`failed'.or.an.ext |
| 10efe0 | 65 6e 73 69 6f 6e 20 6f 66 20 74 68 65 20 67 69 76 65 6e 20 66 72 61 6d 65 2e 20 20 54 68 65 20 | ension.of.the.given.frame...The. |
| 10f000 | 62 61 73 69 63 20 69 64 65 61 20 6f 66 20 74 68 65 20 6d 61 74 63 68 65 72 20 69 73 20 74 6f 0a | basic.idea.of.the.matcher.is.to. |
| 10f020 | 63 68 65 63 6b 20 74 68 65 20 70 61 74 74 65 72 6e 20 61 67 61 69 6e 73 74 20 74 68 65 20 64 61 | check.the.pattern.against.the.da |
| 10f040 | 74 61 2c 20 65 6c 65 6d 65 6e 74 20 62 79 20 65 6c 65 6d 65 6e 74 2c 20 61 63 63 75 6d 75 6c 61 | ta,.element.by.element,.accumula |
| 10f060 | 74 69 6e 67 0a 62 69 6e 64 69 6e 67 73 20 66 6f 72 20 74 68 65 20 70 61 74 74 65 72 6e 20 76 61 | ting.bindings.for.the.pattern.va |
| 10f080 | 72 69 61 62 6c 65 73 2e 20 20 49 66 20 74 68 65 20 70 61 74 74 65 72 6e 20 61 6e 64 20 74 68 65 | riables...If.the.pattern.and.the |
| 10f0a0 | 20 64 61 74 61 20 6f 62 6a 65 63 74 0a 61 72 65 20 74 68 65 20 73 61 6d 65 2c 20 74 68 65 20 6d | .data.object.are.the.same,.the.m |
| 10f0c0 | 61 74 63 68 20 73 75 63 63 65 65 64 73 20 61 6e 64 20 77 65 20 72 65 74 75 72 6e 20 74 68 65 20 | atch.succeeds.and.we.return.the. |
| 10f0e0 | 66 72 61 6d 65 20 6f 66 20 62 69 6e 64 69 6e 67 73 0a 61 63 63 75 6d 75 6c 61 74 65 64 20 73 6f | frame.of.bindings.accumulated.so |
| 10f100 | 20 66 61 72 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 69 66 20 74 68 65 20 70 61 74 74 65 72 6e | .far...Otherwise,.if.the.pattern |
| 10f120 | 20 69 73 20 61 20 76 61 72 69 61 62 6c 65 20 77 65 20 65 78 74 65 6e 64 0a 74 68 65 20 63 75 72 | .is.a.variable.we.extend.the.cur |
| 10f140 | 72 65 6e 74 20 66 72 61 6d 65 20 62 79 20 62 69 6e 64 69 6e 67 20 74 68 65 20 76 61 72 69 61 62 | rent.frame.by.binding.the.variab |
| 10f160 | 6c 65 20 74 6f 20 74 68 65 20 64 61 74 61 2c 20 73 6f 20 6c 6f 6e 67 20 61 73 20 74 68 69 73 0a | le.to.the.data,.so.long.as.this. |
| 10f180 | 69 73 20 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 74 68 65 20 62 69 6e 64 69 6e 67 73 20 | is.consistent.with.the.bindings. |
| 10f1a0 | 61 6c 72 65 61 64 79 20 69 6e 20 74 68 65 20 66 72 61 6d 65 2e 20 20 49 66 20 74 68 65 20 70 61 | already.in.the.frame...If.the.pa |
| 10f1c0 | 74 74 65 72 6e 0a 61 6e 64 20 74 68 65 20 64 61 74 61 20 61 72 65 20 62 6f 74 68 20 70 61 69 72 | ttern.and.the.data.are.both.pair |
| 10f1e0 | 73 2c 20 77 65 20 28 72 65 63 75 72 73 69 76 65 6c 79 29 20 6d 61 74 63 68 20 74 68 65 20 60 63 | s,.we.(recursively).match.the.`c |
| 10f200 | 61 72 27 20 6f 66 20 74 68 65 0a 70 61 74 74 65 72 6e 20 61 67 61 69 6e 73 74 20 74 68 65 20 60 | ar'.of.the.pattern.against.the.` |
| 10f220 | 63 61 72 27 20 6f 66 20 74 68 65 20 64 61 74 61 20 74 6f 20 70 72 6f 64 75 63 65 20 61 20 66 72 | car'.of.the.data.to.produce.a.fr |
| 10f240 | 61 6d 65 3b 20 69 6e 20 74 68 69 73 20 66 72 61 6d 65 0a 77 65 20 74 68 65 6e 20 6d 61 74 63 68 | ame;.in.this.frame.we.then.match |
| 10f260 | 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 74 68 65 20 70 61 74 74 65 72 6e 20 61 67 61 69 6e 73 | .the.`cdr'.of.the.pattern.agains |
| 10f280 | 74 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 74 68 65 20 64 61 74 61 2e 0a 49 66 20 6e 6f 6e 65 | t.the.`cdr'.of.the.data..If.none |
| 10f2a0 | 20 6f 66 20 74 68 65 73 65 20 63 61 73 65 73 20 61 72 65 20 61 70 70 6c 69 63 61 62 6c 65 2c 20 | .of.these.cases.are.applicable,. |
| 10f2c0 | 74 68 65 20 6d 61 74 63 68 20 66 61 69 6c 73 20 61 6e 64 20 77 65 20 72 65 74 75 72 6e 0a 74 68 | the.match.fails.and.we.return.th |
| 10f2e0 | 65 20 73 79 6d 62 6f 6c 20 60 66 61 69 6c 65 64 27 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | e.symbol.`failed'........(define |
| 10f300 | 20 28 70 61 74 74 65 72 6e 2d 6d 61 74 63 68 20 70 61 74 20 64 61 74 20 66 72 61 6d 65 29 0a 20 | .(pattern-match.pat.dat.frame).. |
| 10f320 | 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 66 72 61 6d 65 20 27 66 61 69 6c 65 64 29 | ......(cond.((eq?.frame.'failed) |
| 10f340 | 20 27 66 61 69 6c 65 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 75 61 6c 3f 20 | .'failed)..............((equal?. |
| 10f360 | 70 61 74 20 64 61 74 29 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 76 | pat.dat).frame)..............((v |
| 10f380 | 61 72 3f 20 70 61 74 29 20 28 65 78 74 65 6e 64 2d 69 66 2d 63 6f 6e 73 69 73 74 65 6e 74 20 70 | ar?.pat).(extend-if-consistent.p |
| 10f3a0 | 61 74 20 64 61 74 20 66 72 61 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 61 6e | at.dat.frame))..............((an |
| 10f3c0 | 64 20 28 70 61 69 72 3f 20 70 61 74 29 20 28 70 61 69 72 3f 20 64 61 74 29 29 0a 20 20 20 20 20 | d.(pair?.pat).(pair?.dat))...... |
| 10f3e0 | 20 20 20 20 20 20 20 20 20 28 70 61 74 74 65 72 6e 2d 6d 61 74 63 68 20 28 63 64 72 20 70 61 74 | .........(pattern-match.(cdr.pat |
| 10f400 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | )..............................( |
| 10f420 | 63 64 72 20 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | cdr.dat)........................ |
| 10f440 | 20 20 20 20 20 20 28 70 61 74 74 65 72 6e 2d 6d 61 74 63 68 20 28 63 61 72 20 70 61 74 29 0a 20 | ......(pattern-match.(car.pat).. |
| 10f460 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 10f480 | 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 64 61 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ...........(car.dat)............ |
| 10f4a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 10f4c0 | 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 27 66 61 | .frame)))..............(else.'fa |
| 10f4e0 | 69 6c 65 64 29 29 29 0a 0a 20 20 20 48 65 72 65 20 69 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 | iled))).....Here.is.the.procedur |
| 10f500 | 65 20 74 68 61 74 20 65 78 74 65 6e 64 73 20 61 20 66 72 61 6d 65 20 62 79 20 61 64 64 69 6e 67 | e.that.extends.a.frame.by.adding |
| 10f520 | 20 61 20 6e 65 77 20 62 69 6e 64 69 6e 67 2c 0a 69 66 20 74 68 69 73 20 69 73 20 63 6f 6e 73 69 | .a.new.binding,.if.this.is.consi |
| 10f540 | 73 74 65 6e 74 20 77 69 74 68 20 74 68 65 20 62 69 6e 64 69 6e 67 73 20 61 6c 72 65 61 64 79 20 | stent.with.the.bindings.already. |
| 10f560 | 69 6e 20 74 68 65 20 66 72 61 6d 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 74 | in.the.frame:.......(define.(ext |
| 10f580 | 65 6e 64 2d 69 66 2d 63 6f 6e 73 69 73 74 65 6e 74 20 76 61 72 20 64 61 74 20 66 72 61 6d 65 29 | end-if-consistent.var.dat.frame) |
| 10f5a0 | 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 62 69 6e 64 69 6e 67 20 28 62 69 6e 64 69 6e 67 2d | ........(let.((binding.(binding- |
| 10f5c0 | 69 6e 2d 66 72 61 6d 65 20 76 61 72 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 | in-frame.var.frame)))..........( |
| 10f5e0 | 69 66 20 62 69 6e 64 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 61 74 74 65 72 6e | if.binding..............(pattern |
| 10f600 | 2d 6d 61 74 63 68 20 28 62 69 6e 64 69 6e 67 2d 76 61 6c 75 65 20 62 69 6e 64 69 6e 67 29 20 64 | -match.(binding-value.binding).d |
| 10f620 | 61 74 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 74 65 6e 64 20 76 | at.frame)..............(extend.v |
| 10f640 | 61 72 20 64 61 74 20 66 72 61 6d 65 29 29 29 29 0a 0a 20 20 20 49 66 20 74 68 65 72 65 20 69 73 | ar.dat.frame)))).....If.there.is |
| 10f660 | 20 6e 6f 20 62 69 6e 64 69 6e 67 20 66 6f 72 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 6e 20 | .no.binding.for.the.variable.in. |
| 10f680 | 74 68 65 20 66 72 61 6d 65 2c 20 77 65 20 73 69 6d 70 6c 79 20 61 64 64 0a 74 68 65 20 62 69 6e | the.frame,.we.simply.add.the.bin |
| 10f6a0 | 64 69 6e 67 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 74 6f 20 74 68 65 20 64 61 74 61 | ding.of.the.variable.to.the.data |
| 10f6c0 | 2e 20 20 4f 74 68 65 72 77 69 73 65 20 77 65 20 6d 61 74 63 68 2c 20 69 6e 20 74 68 65 0a 66 72 | ...Otherwise.we.match,.in.the.fr |
| 10f6e0 | 61 6d 65 2c 20 74 68 65 20 64 61 74 61 20 61 67 61 69 6e 73 74 20 74 68 65 20 76 61 6c 75 65 20 | ame,.the.data.against.the.value. |
| 10f700 | 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 6e 20 74 68 65 20 66 72 61 6d 65 2e 20 20 49 | of.the.variable.in.the.frame...I |
| 10f720 | 66 20 74 68 65 0a 73 74 6f 72 65 64 20 76 61 6c 75 65 20 63 6f 6e 74 61 69 6e 73 20 6f 6e 6c 79 | f.the.stored.value.contains.only |
| 10f740 | 20 63 6f 6e 73 74 61 6e 74 73 2c 20 61 73 20 69 74 20 6d 75 73 74 20 69 66 20 69 74 20 77 61 73 | .constants,.as.it.must.if.it.was |
| 10f760 | 20 73 74 6f 72 65 64 0a 64 75 72 69 6e 67 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 69 6e 67 20 | .stored.during.pattern.matching. |
| 10f780 | 62 79 20 60 65 78 74 65 6e 64 2d 69 66 2d 63 6f 6e 73 69 73 74 65 6e 74 27 2c 20 74 68 65 6e 20 | by.`extend-if-consistent',.then. |
| 10f7a0 | 74 68 65 20 6d 61 74 63 68 0a 73 69 6d 70 6c 79 20 74 65 73 74 73 20 77 68 65 74 68 65 72 20 74 | the.match.simply.tests.whether.t |
| 10f7c0 | 68 65 20 73 74 6f 72 65 64 20 61 6e 64 20 6e 65 77 20 76 61 6c 75 65 73 20 61 72 65 20 74 68 65 | he.stored.and.new.values.are.the |
| 10f7e0 | 20 73 61 6d 65 2e 20 20 49 66 20 73 6f 2c 20 69 74 0a 72 65 74 75 72 6e 73 20 74 68 65 20 75 6e | .same...If.so,.it.returns.the.un |
| 10f800 | 6d 6f 64 69 66 69 65 64 20 66 72 61 6d 65 3b 20 69 66 20 6e 6f 74 2c 20 69 74 20 72 65 74 75 72 | modified.frame;.if.not,.it.retur |
| 10f820 | 6e 73 20 61 20 66 61 69 6c 75 72 65 20 69 6e 64 69 63 61 74 69 6f 6e 2e 0a 54 68 65 20 73 74 6f | ns.a.failure.indication..The.sto |
| 10f840 | 72 65 64 20 76 61 6c 75 65 20 6d 61 79 2c 20 68 6f 77 65 76 65 72 2c 20 63 6f 6e 74 61 69 6e 20 | red.value.may,.however,.contain. |
| 10f860 | 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 73 20 69 66 20 69 74 20 77 61 73 0a 73 74 6f 72 | pattern.variables.if.it.was.stor |
| 10f880 | 65 64 20 64 75 72 69 6e 67 20 75 6e 69 66 69 63 61 74 69 6f 6e 20 28 73 65 65 20 73 65 63 74 69 | ed.during.unification.(see.secti |
| 10f8a0 | 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 34 3a 3a 29 2e 20 20 54 68 65 20 72 65 63 75 72 73 | on.*Note.4-4-4-4::)...The.recurs |
| 10f8c0 | 69 76 65 0a 6d 61 74 63 68 20 6f 66 20 74 68 65 20 73 74 6f 72 65 64 20 70 61 74 74 65 72 6e 20 | ive.match.of.the.stored.pattern. |
| 10f8e0 | 61 67 61 69 6e 73 74 20 74 68 65 20 6e 65 77 20 64 61 74 61 20 77 69 6c 6c 20 61 64 64 20 6f 72 | against.the.new.data.will.add.or |
| 10f900 | 20 63 68 65 63 6b 0a 62 69 6e 64 69 6e 67 73 20 66 6f 72 20 74 68 65 20 76 61 72 69 61 62 6c 65 | .check.bindings.for.the.variable |
| 10f920 | 73 20 69 6e 20 74 68 69 73 20 70 61 74 74 65 72 6e 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c | s.in.this.pattern...For.example, |
| 10f940 | 20 73 75 70 70 6f 73 65 20 77 65 0a 68 61 76 65 20 61 20 66 72 61 6d 65 20 69 6e 20 77 68 69 63 | .suppose.we.have.a.frame.in.whic |
| 10f960 | 68 20 60 3f 78 27 20 69 73 20 62 6f 75 6e 64 20 74 6f 20 60 28 66 20 3f 79 29 27 20 61 6e 64 20 | h.`?x'.is.bound.to.`(f.?y)'.and. |
| 10f980 | 60 3f 79 27 20 69 73 20 75 6e 62 6f 75 6e 64 2c 0a 61 6e 64 20 77 65 20 77 69 73 68 20 74 6f 20 | `?y'.is.unbound,.and.we.wish.to. |
| 10f9a0 | 61 75 67 6d 65 6e 74 20 74 68 69 73 20 66 72 61 6d 65 20 62 79 20 61 20 62 69 6e 64 69 6e 67 20 | augment.this.frame.by.a.binding. |
| 10f9c0 | 6f 66 20 60 3f 78 27 20 74 6f 20 60 28 66 20 62 29 27 2e 20 20 57 65 0a 6c 6f 6f 6b 20 75 70 20 | of.`?x'.to.`(f.b)'...We.look.up. |
| 10f9e0 | 60 3f 78 27 20 61 6e 64 20 66 69 6e 64 20 74 68 61 74 20 69 74 20 69 73 20 62 6f 75 6e 64 20 74 | `?x'.and.find.that.it.is.bound.t |
| 10fa00 | 6f 20 60 28 66 20 3f 79 29 27 2e 20 20 54 68 69 73 20 6c 65 61 64 73 20 75 73 20 74 6f 0a 6d 61 | o.`(f.?y)'...This.leads.us.to.ma |
| 10fa20 | 74 63 68 20 60 28 66 20 3f 79 29 27 20 61 67 61 69 6e 73 74 20 74 68 65 20 70 72 6f 70 6f 73 65 | tch.`(f.?y)'.against.the.propose |
| 10fa40 | 64 20 6e 65 77 20 76 61 6c 75 65 20 60 28 66 20 62 29 27 20 69 6e 20 74 68 65 20 73 61 6d 65 0a | d.new.value.`(f.b)'.in.the.same. |
| 10fa60 | 66 72 61 6d 65 2e 20 20 45 76 65 6e 74 75 61 6c 6c 79 20 74 68 69 73 20 6d 61 74 63 68 20 65 78 | frame...Eventually.this.match.ex |
| 10fa80 | 74 65 6e 64 73 20 74 68 65 20 66 72 61 6d 65 20 62 79 20 61 64 64 69 6e 67 20 61 20 62 69 6e 64 | tends.the.frame.by.adding.a.bind |
| 10faa0 | 69 6e 67 20 6f 66 0a 60 3f 79 27 20 74 6f 20 60 62 27 2e 20 20 60 3f 58 27 20 72 65 6d 61 69 6e | ing.of.`?y'.to.`b'...`?X'.remain |
| 10fac0 | 73 20 62 6f 75 6e 64 20 74 6f 20 60 28 66 20 3f 79 29 27 2e 20 20 57 65 20 6e 65 76 65 72 20 6d | s.bound.to.`(f.?y)'...We.never.m |
| 10fae0 | 6f 64 69 66 79 20 61 20 73 74 6f 72 65 64 0a 62 69 6e 64 69 6e 67 20 61 6e 64 20 77 65 20 6e 65 | odify.a.stored.binding.and.we.ne |
| 10fb00 | 76 65 72 20 73 74 6f 72 65 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 62 69 6e 64 69 6e 67 20 | ver.store.more.than.one.binding. |
| 10fb20 | 66 6f 72 20 61 20 67 69 76 65 6e 20 76 61 72 69 61 62 6c 65 2e 0a 0a 20 20 20 54 68 65 20 70 72 | for.a.given.variable......The.pr |
| 10fb40 | 6f 63 65 64 75 72 65 73 20 75 73 65 64 20 62 79 20 60 65 78 74 65 6e 64 2d 69 66 2d 63 6f 6e 73 | ocedures.used.by.`extend-if-cons |
| 10fb60 | 69 73 74 65 6e 74 27 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 20 62 69 6e 64 69 6e 67 73 0a 61 | istent'.to.manipulate.bindings.a |
| 10fb80 | 72 65 20 64 65 66 69 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d | re.defined.in.section.*Note.4-4- |
| 10fba0 | 34 2d 38 3a 3a 2e 0a 0a 50 61 74 74 65 72 6e 73 20 77 69 74 68 20 64 6f 74 74 65 64 20 74 61 69 | 4-8::...Patterns.with.dotted.tai |
| 10fbc0 | 6c 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 | ls.............................I |
| 10fbe0 | 66 20 61 20 70 61 74 74 65 72 6e 20 63 6f 6e 74 61 69 6e 73 20 61 20 64 6f 74 20 66 6f 6c 6c 6f | f.a.pattern.contains.a.dot.follo |
| 10fc00 | 77 65 64 20 62 79 20 61 20 70 61 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 2c 20 74 68 65 20 70 | wed.by.a.pattern.variable,.the.p |
| 10fc20 | 61 74 74 65 72 6e 0a 76 61 72 69 61 62 6c 65 20 6d 61 74 63 68 65 73 20 74 68 65 20 72 65 73 74 | attern.variable.matches.the.rest |
| 10fc40 | 20 6f 66 20 74 68 65 20 64 61 74 61 20 6c 69 73 74 20 28 72 61 74 68 65 72 20 74 68 61 6e 20 74 | .of.the.data.list.(rather.than.t |
| 10fc60 | 68 65 20 6e 65 78 74 0a 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 64 61 74 61 20 6c 69 73 74 | he.next.element.of.the.data.list |
| 10fc80 | 29 2c 20 6a 75 73 74 20 61 73 20 6f 6e 65 20 77 6f 75 6c 64 20 65 78 70 65 63 74 20 77 69 74 68 | ),.just.as.one.would.expect.with |
| 10fca0 | 20 74 68 65 0a 64 6f 74 74 65 64 2d 74 61 69 6c 20 6e 6f 74 61 74 69 6f 6e 20 64 65 73 63 72 69 | .the.dotted-tail.notation.descri |
| 10fcc0 | 62 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 32 2d 32 30 3a 3a 2e 20 20 41 | bed.in.*Note.Exercise.2-20::...A |
| 10fce0 | 6c 74 68 6f 75 67 68 20 74 68 65 0a 70 61 74 74 65 72 6e 20 6d 61 74 63 68 65 72 20 77 65 20 68 | lthough.the.pattern.matcher.we.h |
| 10fd00 | 61 76 65 20 6a 75 73 74 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 64 6f 65 73 6e 27 74 20 6c 6f 6f | ave.just.implemented.doesn't.loo |
| 10fd20 | 6b 20 66 6f 72 20 64 6f 74 73 2c 20 69 74 20 64 6f 65 73 0a 62 65 68 61 76 65 20 61 73 20 77 65 | k.for.dots,.it.does.behave.as.we |
| 10fd40 | 20 77 61 6e 74 2e 20 20 54 68 69 73 20 69 73 20 62 65 63 61 75 73 65 20 74 68 65 20 4c 69 73 70 | .want...This.is.because.the.Lisp |
| 10fd60 | 20 60 72 65 61 64 27 20 70 72 69 6d 69 74 69 76 65 2c 20 77 68 69 63 68 20 69 73 0a 75 73 65 64 | .`read'.primitive,.which.is.used |
| 10fd80 | 20 62 79 20 60 71 75 65 72 79 2d 64 72 69 76 65 72 2d 6c 6f 6f 70 27 20 74 6f 20 72 65 61 64 20 | .by.`query-driver-loop'.to.read. |
| 10fda0 | 74 68 65 20 71 75 65 72 79 20 61 6e 64 20 72 65 70 72 65 73 65 6e 74 20 69 74 20 61 73 20 61 0a | the.query.and.represent.it.as.a. |
| 10fdc0 | 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 2c 20 74 72 65 61 74 73 20 64 6f 74 73 20 69 6e 20 61 | list.structure,.treats.dots.in.a |
| 10fde0 | 20 73 70 65 63 69 61 6c 20 77 61 79 2e 0a 0a 20 20 20 57 68 65 6e 20 60 72 65 61 64 27 20 73 65 | .special.way......When.`read'.se |
| 10fe00 | 65 73 20 61 20 64 6f 74 2c 20 69 6e 73 74 65 61 64 20 6f 66 20 6d 61 6b 69 6e 67 20 74 68 65 20 | es.a.dot,.instead.of.making.the. |
| 10fe20 | 6e 65 78 74 20 69 74 65 6d 20 62 65 20 74 68 65 20 6e 65 78 74 0a 65 6c 65 6d 65 6e 74 20 6f 66 | next.item.be.the.next.element.of |
| 10fe40 | 20 61 20 6c 69 73 74 20 28 74 68 65 20 60 63 61 72 27 20 6f 66 20 61 20 60 63 6f 6e 73 27 20 77 | .a.list.(the.`car'.of.a.`cons'.w |
| 10fe60 | 68 6f 73 65 20 60 63 64 72 27 20 77 69 6c 6c 20 62 65 20 74 68 65 20 72 65 73 74 0a 6f 66 20 74 | hose.`cdr'.will.be.the.rest.of.t |
| 10fe80 | 68 65 20 6c 69 73 74 29 20 69 74 20 6d 61 6b 65 73 20 74 68 65 20 6e 65 78 74 20 69 74 65 6d 20 | he.list).it.makes.the.next.item. |
| 10fea0 | 62 65 20 74 68 65 20 60 63 64 72 27 20 6f 66 20 74 68 65 20 6c 69 73 74 20 73 74 72 75 63 74 75 | be.the.`cdr'.of.the.list.structu |
| 10fec0 | 72 65 2e 0a 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 6c 69 73 74 20 73 74 72 75 63 74 | re..For.example,.the.list.struct |
| 10fee0 | 75 72 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 60 72 65 61 64 27 20 66 6f 72 20 74 68 65 20 70 | ure.produced.by.`read'.for.the.p |
| 10ff00 | 61 74 74 65 72 6e 0a 60 28 63 6f 6d 70 75 74 65 72 20 3f 74 79 70 65 29 27 20 63 6f 75 6c 64 20 | attern.`(computer.?type)'.could. |
| 10ff20 | 62 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 | be.constructed.by.evaluating.the |
| 10ff40 | 20 65 78 70 72 65 73 73 69 6f 6e 0a 60 28 63 6f 6e 73 20 27 63 6f 6d 70 75 74 65 72 20 28 63 6f | .expression.`(cons.'computer.(co |
| 10ff60 | 6e 73 20 27 3f 74 79 70 65 20 27 28 29 29 29 27 2c 20 61 6e 64 20 74 68 61 74 20 66 6f 72 20 60 | ns.'?type.'()))',.and.that.for.` |
| 10ff80 | 28 63 6f 6d 70 75 74 65 72 20 2e 20 3f 74 79 70 65 29 27 0a 63 6f 75 6c 64 20 62 65 20 63 6f 6e | (computer...?type)'.could.be.con |
| 10ffa0 | 73 74 72 75 63 74 65 64 20 62 79 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 | structed.by.evaluating.the.expre |
| 10ffc0 | 73 73 69 6f 6e 20 60 28 63 6f 6e 73 20 27 63 6f 6d 70 75 74 65 72 0a 27 3f 74 79 70 65 29 27 2e | ssion.`(cons.'computer.'?type)'. |
| 10ffe0 | 0a 0a 20 20 20 54 68 75 73 2c 20 61 73 20 60 70 61 74 74 65 72 6e 2d 6d 61 74 63 68 27 20 72 65 | .....Thus,.as.`pattern-match'.re |
| 110000 | 63 75 72 73 69 76 65 6c 79 20 63 6f 6d 70 61 72 65 73 20 60 63 61 72 27 73 20 61 6e 64 20 60 63 | cursively.compares.`car's.and.`c |
| 110020 | 64 72 27 73 20 6f 66 20 61 0a 64 61 74 61 20 6c 69 73 74 20 61 6e 64 20 61 20 70 61 74 74 65 72 | dr's.of.a.data.list.and.a.patter |
| 110040 | 6e 20 74 68 61 74 20 68 61 64 20 61 20 64 6f 74 2c 20 69 74 20 65 76 65 6e 74 75 61 6c 6c 79 20 | n.that.had.a.dot,.it.eventually. |
| 110060 | 6d 61 74 63 68 65 73 20 74 68 65 0a 76 61 72 69 61 62 6c 65 20 61 66 74 65 72 20 74 68 65 20 64 | matches.the.variable.after.the.d |
| 110080 | 6f 74 20 28 77 68 69 63 68 20 69 73 20 61 20 60 63 64 72 27 20 6f 66 20 74 68 65 20 70 61 74 74 | ot.(which.is.a.`cdr'.of.the.patt |
| 1100a0 | 65 72 6e 29 20 61 67 61 69 6e 73 74 20 61 0a 73 75 62 6c 69 73 74 20 6f 66 20 74 68 65 20 64 61 | ern).against.a.sublist.of.the.da |
| 1100c0 | 74 61 20 6c 69 73 74 2c 20 62 69 6e 64 69 6e 67 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 74 6f | ta.list,.binding.the.variable.to |
| 1100e0 | 20 74 68 61 74 20 6c 69 73 74 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 6d 61 74 63 68 69 | .that.list...For.example,.matchi |
| 110100 | 6e 67 20 74 68 65 20 70 61 74 74 65 72 6e 20 60 28 63 6f 6d 70 75 74 65 72 20 2e 20 3f 74 79 70 | ng.the.pattern.`(computer...?typ |
| 110120 | 65 29 27 20 61 67 61 69 6e 73 74 20 60 28 63 6f 6d 70 75 74 65 72 0a 70 72 6f 67 72 61 6d 6d 65 | e)'.against.`(computer.programme |
| 110140 | 72 20 74 72 61 69 6e 65 65 29 27 20 77 69 6c 6c 20 6d 61 74 63 68 20 60 3f 74 79 70 65 27 20 61 | r.trainee)'.will.match.`?type'.a |
| 110160 | 67 61 69 6e 73 74 20 74 68 65 20 6c 69 73 74 20 60 28 70 72 6f 67 72 61 6d 6d 65 72 0a 74 72 61 | gainst.the.list.`(programmer.tra |
| 110180 | 69 6e 65 65 29 27 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 | inee)'.....File:.sicp.info,..Nod |
| 1101a0 | 65 3a 20 34 2d 34 2d 34 2d 34 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2d 34 2d 35 2c 20 20 50 72 65 | e:.4-4-4-4,..Next:.4-4-4-5,..Pre |
| 1101c0 | 76 3a 20 34 2d 34 2d 34 2d 33 2c 20 20 55 70 3a 20 34 2d 34 2d 34 0a 0a 34 2e 34 2e 34 2e 34 20 | v:.4-4-4-3,..Up:.4-4-4..4.4.4.4. |
| 1101e0 | 52 75 6c 65 73 20 61 6e 64 20 55 6e 69 66 69 63 61 74 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | Rules.and.Unification........... |
| 110200 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 60 41 70 70 6c 79 2d 72 75 6c 65 | .....................`Apply-rule |
| 110220 | 73 27 20 69 73 20 74 68 65 20 72 75 6c 65 20 61 6e 61 6c 6f 67 20 6f 66 20 60 66 69 6e 64 2d 61 | s'.is.the.rule.analog.of.`find-a |
| 110240 | 73 73 65 72 74 69 6f 6e 73 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 34 2d 34 2d 34 2d | ssertions'.(section.*Note.4-4-4- |
| 110260 | 33 3a 3a 29 2e 20 20 49 74 20 74 61 6b 65 73 20 61 73 20 69 6e 70 75 74 20 61 20 70 61 74 74 65 | 3::)...It.takes.as.input.a.patte |
| 110280 | 72 6e 20 61 6e 64 20 61 20 66 72 61 6d 65 2c 20 61 6e 64 20 69 74 20 66 6f 72 6d 73 20 61 0a 73 | rn.and.a.frame,.and.it.forms.a.s |
| 1102a0 | 74 72 65 61 6d 20 6f 66 20 65 78 74 65 6e 73 69 6f 6e 20 66 72 61 6d 65 73 20 62 79 20 61 70 70 | tream.of.extension.frames.by.app |
| 1102c0 | 6c 79 69 6e 67 20 72 75 6c 65 73 20 66 72 6f 6d 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 0a | lying.rules.from.the.data.base.. |
| 1102e0 | 60 53 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 27 20 6d 61 70 73 20 60 61 70 70 6c 79 2d 61 2d 72 | `Stream-flatmap'.maps.`apply-a-r |
| 110300 | 75 6c 65 27 20 64 6f 77 6e 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 70 6f 73 73 69 62 6c 79 | ule'.down.the.stream.of.possibly |
| 110320 | 0a 61 70 70 6c 69 63 61 62 6c 65 20 72 75 6c 65 73 20 28 73 65 6c 65 63 74 65 64 20 62 79 20 60 | .applicable.rules.(selected.by.` |
| 110340 | 66 65 74 63 68 2d 72 75 6c 65 73 27 2c 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d | fetch-rules',.section.*Note.4-4- |
| 110360 | 34 2d 35 3a 3a 29 0a 61 6e 64 20 63 6f 6d 62 69 6e 65 73 20 74 68 65 20 72 65 73 75 6c 74 69 6e | 4-5::).and.combines.the.resultin |
| 110380 | 67 20 73 74 72 65 61 6d 73 20 6f 66 20 66 72 61 6d 65 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 | g.streams.of.frames........(defi |
| 1103a0 | 6e 65 20 28 61 70 70 6c 79 2d 72 75 6c 65 73 20 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 0a 20 | ne.(apply-rules.pattern.frame).. |
| 1103c0 | 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 72 | ......(stream-flatmap.(lambda.(r |
| 1103e0 | 75 6c 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 | ule)..........................(a |
| 110400 | 70 70 6c 79 2d 61 2d 72 75 6c 65 20 72 75 6c 65 20 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 29 | pply-a-rule.rule.pattern.frame)) |
| 110420 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 65 74 63 68 2d 72 | ........................(fetch-r |
| 110440 | 75 6c 65 73 20 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 29 29 0a 0a 20 20 20 60 41 70 70 6c 79 | ules.pattern.frame))).....`Apply |
| 110460 | 2d 61 2d 72 75 6c 65 27 20 61 70 70 6c 69 65 73 20 72 75 6c 65 73 20 75 73 69 6e 67 20 74 68 65 | -a-rule'.applies.rules.using.the |
| 110480 | 20 6d 65 74 68 6f 64 20 6f 75 74 6c 69 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 | .method.outlined.in.section.*Not |
| 1104a0 | 65 20 34 2d 34 2d 32 3a 3a 2e 20 20 49 74 20 66 69 72 73 74 20 61 75 67 6d 65 6e 74 73 20 69 74 | e.4-4-2::...It.first.augments.it |
| 1104c0 | 73 20 61 72 67 75 6d 65 6e 74 20 66 72 61 6d 65 20 62 79 20 75 6e 69 66 79 69 6e 67 20 74 68 65 | s.argument.frame.by.unifying.the |
| 1104e0 | 0a 72 75 6c 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 20 77 69 74 68 20 74 68 65 20 70 61 74 74 65 72 | .rule.conclusion.with.the.patter |
| 110500 | 6e 20 69 6e 20 74 68 65 20 67 69 76 65 6e 20 66 72 61 6d 65 2e 20 20 49 66 20 74 68 69 73 20 73 | n.in.the.given.frame...If.this.s |
| 110520 | 75 63 63 65 65 64 73 2c 0a 69 74 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 72 75 6c 65 20 62 | ucceeds,.it.evaluates.the.rule.b |
| 110540 | 6f 64 79 20 69 6e 20 74 68 69 73 20 6e 65 77 20 66 72 61 6d 65 2e 0a 0a 20 20 20 42 65 66 6f 72 | ody.in.this.new.frame......Befor |
| 110560 | 65 20 61 6e 79 20 6f 66 20 74 68 69 73 20 68 61 70 70 65 6e 73 2c 20 68 6f 77 65 76 65 72 2c 20 | e.any.of.this.happens,.however,. |
| 110580 | 74 68 65 20 70 72 6f 67 72 61 6d 20 72 65 6e 61 6d 65 73 20 61 6c 6c 20 74 68 65 0a 76 61 72 69 | the.program.renames.all.the.vari |
| 1105a0 | 61 62 6c 65 73 20 69 6e 20 74 68 65 20 72 75 6c 65 20 77 69 74 68 20 75 6e 69 71 75 65 20 6e 65 | ables.in.the.rule.with.unique.ne |
| 1105c0 | 77 20 6e 61 6d 65 73 2e 20 20 54 68 65 20 72 65 61 73 6f 6e 20 66 6f 72 20 74 68 69 73 20 69 73 | w.names...The.reason.for.this.is |
| 1105e0 | 20 74 6f 0a 70 72 65 76 65 6e 74 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 66 6f 72 20 64 69 | .to.prevent.the.variables.for.di |
| 110600 | 66 66 65 72 65 6e 74 20 72 75 6c 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 66 72 6f 6d 20 62 | fferent.rule.applications.from.b |
| 110620 | 65 63 6f 6d 69 6e 67 0a 63 6f 6e 66 75 73 65 64 20 77 69 74 68 20 65 61 63 68 20 6f 74 68 65 72 | ecoming.confused.with.each.other |
| 110640 | 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 66 20 74 77 6f 20 72 75 6c 65 73 20 62 6f | ...For.instance,.if.two.rules.bo |
| 110660 | 74 68 20 75 73 65 20 61 0a 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 64 20 60 3f 78 27 2c 20 74 68 | th.use.a.variable.named.`?x',.th |
| 110680 | 65 6e 20 65 61 63 68 20 6f 6e 65 20 6d 61 79 20 61 64 64 20 61 20 62 69 6e 64 69 6e 67 20 66 6f | en.each.one.may.add.a.binding.fo |
| 1106a0 | 72 20 60 3f 78 27 20 74 6f 20 74 68 65 0a 66 72 61 6d 65 20 77 68 65 6e 20 69 74 20 69 73 20 61 | r.`?x'.to.the.frame.when.it.is.a |
| 1106c0 | 70 70 6c 69 65 64 2e 20 20 54 68 65 73 65 20 74 77 6f 20 60 3f 78 27 27 73 20 68 61 76 65 20 6e | pplied...These.two.`?x''s.have.n |
| 1106e0 | 6f 74 68 69 6e 67 20 74 6f 20 64 6f 20 77 69 74 68 0a 65 61 63 68 20 6f 74 68 65 72 2c 20 61 6e | othing.to.do.with.each.other,.an |
| 110700 | 64 20 77 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 66 6f 6f 6c 65 64 20 69 6e 74 6f 20 74 | d.we.should.not.be.fooled.into.t |
| 110720 | 68 69 6e 6b 69 6e 67 20 74 68 61 74 20 74 68 65 20 74 77 6f 0a 62 69 6e 64 69 6e 67 73 20 6d 75 | hinking.that.the.two.bindings.mu |
| 110740 | 73 74 20 62 65 20 63 6f 6e 73 69 73 74 65 6e 74 2e 20 20 52 61 74 68 65 72 20 74 68 61 6e 20 72 | st.be.consistent...Rather.than.r |
| 110760 | 65 6e 61 6d 65 20 76 61 72 69 61 62 6c 65 73 2c 20 77 65 20 63 6f 75 6c 64 0a 64 65 76 69 73 65 | ename.variables,.we.could.devise |
| 110780 | 20 61 20 6d 6f 72 65 20 63 6c 65 76 65 72 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 | .a.more.clever.environment.struc |
| 1107a0 | 74 75 72 65 3b 20 68 6f 77 65 76 65 72 2c 20 74 68 65 20 72 65 6e 61 6d 69 6e 67 0a 61 70 70 72 | ture;.however,.the.renaming.appr |
| 1107c0 | 6f 61 63 68 20 77 65 20 68 61 76 65 20 63 68 6f 73 65 6e 20 68 65 72 65 20 69 73 20 74 68 65 20 | oach.we.have.chosen.here.is.the. |
| 1107e0 | 6d 6f 73 74 20 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 2c 20 65 76 65 6e 20 69 66 20 6e 6f | most.straightforward,.even.if.no |
| 110800 | 74 0a 74 68 65 20 6d 6f 73 74 20 65 66 66 69 63 69 65 6e 74 2e 20 20 28 53 65 65 20 2a 4e 6f 74 | t.the.most.efficient...(See.*Not |
| 110820 | 65 20 45 78 65 72 63 69 73 65 20 34 2d 37 39 3a 3a 2e 29 20 20 48 65 72 65 20 69 73 20 74 68 65 | e.Exercise.4-79::.)..Here.is.the |
| 110840 | 0a 60 61 70 70 6c 79 2d 61 2d 72 75 6c 65 27 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 | .`apply-a-rule'.procedure:...... |
| 110860 | 20 28 64 65 66 69 6e 65 20 28 61 70 70 6c 79 2d 61 2d 72 75 6c 65 20 72 75 6c 65 20 71 75 65 72 | .(define.(apply-a-rule.rule.quer |
| 110880 | 79 2d 70 61 74 74 65 72 6e 20 71 75 65 72 79 2d 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c | y-pattern.query-frame)........(l |
| 1108a0 | 65 74 20 28 28 63 6c 65 61 6e 2d 72 75 6c 65 20 28 72 65 6e 61 6d 65 2d 76 61 72 69 61 62 6c 65 | et.((clean-rule.(rename-variable |
| 1108c0 | 73 2d 69 6e 20 72 75 6c 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 75 6e 69 | s-in.rule)))..........(let.((uni |
| 1108e0 | 66 79 2d 72 65 73 75 6c 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 75 6e 69 66 79 | fy-result.................(unify |
| 110900 | 2d 6d 61 74 63 68 20 71 75 65 72 79 2d 70 61 74 74 65 72 6e 0a 20 20 20 20 20 20 20 20 20 20 20 | -match.query-pattern............ |
| 110920 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 63 6c 75 73 69 6f 6e 20 63 6c | ..................(conclusion.cl |
| 110940 | 65 61 6e 2d 72 75 6c 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ean-rule)....................... |
| 110960 | 20 20 20 20 20 20 20 71 75 65 72 79 2d 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | .......query-frame)))........... |
| 110980 | 20 28 69 66 20 28 65 71 3f 20 75 6e 69 66 79 2d 72 65 73 75 6c 74 20 27 66 61 69 6c 65 64 29 0a | .(if.(eq?.unify-result.'failed). |
| 1109a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 0a | ...............the-empty-stream. |
| 1109c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 71 65 76 61 6c 20 28 72 75 6c 65 2d 62 6f 64 79 | ...............(qeval.(rule-body |
| 1109e0 | 20 63 6c 65 61 6e 2d 72 75 6c 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .clean-rule).................... |
| 110a00 | 20 20 20 28 73 69 6e 67 6c 65 74 6f 6e 2d 73 74 72 65 61 6d 20 75 6e 69 66 79 2d 72 65 73 75 6c | ...(singleton-stream.unify-resul |
| 110a20 | 74 29 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 73 65 6c 65 63 74 6f 72 73 20 60 72 75 6c 65 2d | t)))))).....The.selectors.`rule- |
| 110a40 | 62 6f 64 79 27 20 61 6e 64 20 60 63 6f 6e 63 6c 75 73 69 6f 6e 27 20 74 68 61 74 20 65 78 74 72 | body'.and.`conclusion'.that.extr |
| 110a60 | 61 63 74 20 70 61 72 74 73 20 6f 66 20 61 0a 72 75 6c 65 20 61 72 65 20 64 65 66 69 6e 65 64 20 | act.parts.of.a.rule.are.defined. |
| 110a80 | 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 37 3a 3a 2e 0a 0a 20 20 20 | in.section.*Note.4-4-4-7::...... |
| 110aa0 | 57 65 20 67 65 6e 65 72 61 74 65 20 75 6e 69 71 75 65 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 | We.generate.unique.variable.name |
| 110ac0 | 73 20 62 79 20 61 73 73 6f 63 69 61 74 69 6e 67 20 61 20 75 6e 69 71 75 65 20 69 64 65 6e 74 69 | s.by.associating.a.unique.identi |
| 110ae0 | 66 69 65 72 0a 28 73 75 63 68 20 61 73 20 61 20 6e 75 6d 62 65 72 29 20 77 69 74 68 20 65 61 63 | fier.(such.as.a.number).with.eac |
| 110b00 | 68 20 72 75 6c 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 61 6e 64 20 63 6f 6d 62 69 6e 69 6e 67 | h.rule.application.and.combining |
| 110b20 | 20 74 68 69 73 0a 69 64 65 6e 74 69 66 69 65 72 20 77 69 74 68 20 74 68 65 20 6f 72 69 67 69 6e | .this.identifier.with.the.origin |
| 110b40 | 61 6c 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c | al.variable.names...For.example, |
| 110b60 | 20 69 66 20 74 68 65 0a 72 75 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 20 69 64 65 6e 74 69 66 | .if.the.rule-application.identif |
| 110b80 | 69 65 72 20 69 73 20 37 2c 20 77 65 20 6d 69 67 68 74 20 63 68 61 6e 67 65 20 65 61 63 68 20 60 | ier.is.7,.we.might.change.each.` |
| 110ba0 | 3f 78 27 20 69 6e 20 74 68 65 20 72 75 6c 65 0a 74 6f 20 60 3f 78 2d 37 27 20 61 6e 64 20 65 61 | ?x'.in.the.rule.to.`?x-7'.and.ea |
| 110bc0 | 63 68 20 60 3f 79 27 20 69 6e 20 74 68 65 20 72 75 6c 65 20 74 6f 20 60 3f 79 2d 37 27 2e 20 20 | ch.`?y'.in.the.rule.to.`?y-7'... |
| 110be0 | 28 60 4d 61 6b 65 2d 6e 65 77 2d 76 61 72 69 61 62 6c 65 27 20 61 6e 64 0a 60 6e 65 77 2d 72 75 | (`Make-new-variable'.and.`new-ru |
| 110c00 | 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 2d 69 64 27 20 61 72 65 20 69 6e 63 6c 75 64 65 64 20 | le-application-id'.are.included. |
| 110c20 | 77 69 74 68 20 74 68 65 20 73 79 6e 74 61 78 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 0a 73 65 | with.the.syntax.procedures.in.se |
| 110c40 | 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 37 3a 3a 2e 29 0a 0a 20 20 20 20 20 28 64 | ction.*Note.4-4-4-7::.).......(d |
| 110c60 | 65 66 69 6e 65 20 28 72 65 6e 61 6d 65 2d 76 61 72 69 61 62 6c 65 73 2d 69 6e 20 72 75 6c 65 29 | efine.(rename-variables-in.rule) |
| 110c80 | 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 75 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 2d | ........(let.((rule-application- |
| 110ca0 | 69 64 20 28 6e 65 77 2d 72 75 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 2d 69 64 29 29 29 0a 20 | id.(new-rule-application-id))).. |
| 110cc0 | 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 65 65 2d 77 61 6c 6b 20 65 78 70 29 0a | ........(define.(tree-walk.exp). |
| 110ce0 | 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 76 61 72 3f 20 65 78 70 29 0a 20 20 20 | ...........(cond.((var?.exp).... |
| 110d00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 6e 65 77 2d 76 61 72 69 61 62 6c | ...............(make-new-variabl |
| 110d20 | 65 20 65 78 70 20 72 75 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 2d 69 64 29 29 0a 20 20 20 20 | e.exp.rule-application-id))..... |
| 110d40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 70 61 69 72 3f 20 65 78 70 29 0a 20 20 20 20 20 20 | .............((pair?.exp)....... |
| 110d60 | 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 74 72 65 65 2d 77 61 6c 6b 20 28 63 61 | ............(cons.(tree-walk.(ca |
| 110d80 | 72 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | r.exp))......................... |
| 110da0 | 28 74 72 65 65 2d 77 61 6c 6b 20 28 63 64 72 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 | (tree-walk.(cdr.exp))))......... |
| 110dc0 | 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 | .........(else.exp)))..........( |
| 110de0 | 74 72 65 65 2d 77 61 6c 6b 20 72 75 6c 65 29 29 29 0a 0a 20 20 20 54 68 65 20 75 6e 69 66 69 63 | tree-walk.rule))).....The.unific |
| 110e00 | 61 74 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 | ation.algorithm.is.implemented.a |
| 110e20 | 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 0a 61 73 20 69 6e 70 75 | s.a.procedure.that.takes.as.inpu |
| 110e40 | 74 73 20 74 77 6f 20 70 61 74 74 65 72 6e 73 20 61 6e 64 20 61 20 66 72 61 6d 65 20 61 6e 64 20 | ts.two.patterns.and.a.frame.and. |
| 110e60 | 72 65 74 75 72 6e 73 20 65 69 74 68 65 72 20 74 68 65 20 65 78 74 65 6e 64 65 64 0a 66 72 61 6d | returns.either.the.extended.fram |
| 110e80 | 65 20 6f 72 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 66 61 69 6c 65 64 27 2e 20 20 54 68 65 20 75 | e.or.the.symbol.`failed'...The.u |
| 110ea0 | 6e 69 66 69 65 72 20 69 73 20 6c 69 6b 65 20 74 68 65 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 | nifier.is.like.the.pattern.match |
| 110ec0 | 65 72 0a 65 78 63 65 70 74 20 74 68 61 74 20 69 74 20 69 73 20 73 79 6d 6d 65 74 72 69 63 61 6c | er.except.that.it.is.symmetrical |
| 110ee0 | 2d 2d 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 61 6c 6c 6f 77 65 64 20 6f 6e 20 62 6f 74 68 20 | --variables.are.allowed.on.both. |
| 110f00 | 73 69 64 65 73 20 6f 66 0a 74 68 65 20 6d 61 74 63 68 2e 20 20 60 55 6e 69 66 79 2d 6d 61 74 63 | sides.of.the.match...`Unify-matc |
| 110f20 | 68 27 20 69 73 20 62 61 73 69 63 61 6c 6c 79 20 74 68 65 20 73 61 6d 65 20 61 73 20 60 70 61 74 | h'.is.basically.the.same.as.`pat |
| 110f40 | 74 65 72 6e 2d 6d 61 74 63 68 27 2c 0a 65 78 63 65 70 74 20 74 68 61 74 20 74 68 65 72 65 20 69 | tern-match',.except.that.there.i |
| 110f60 | 73 20 65 78 74 72 61 20 63 6f 64 65 20 28 6d 61 72 6b 65 64 20 22 60 2a 2a 2a 27 22 20 62 65 6c | s.extra.code.(marked."`***'".bel |
| 110f80 | 6f 77 29 20 74 6f 20 68 61 6e 64 6c 65 20 74 68 65 0a 63 61 73 65 20 77 68 65 72 65 20 74 68 65 | ow).to.handle.the.case.where.the |
| 110fa0 | 20 6f 62 6a 65 63 74 20 6f 6e 20 74 68 65 20 72 69 67 68 74 20 73 69 64 65 20 6f 66 20 74 68 65 | .object.on.the.right.side.of.the |
| 110fc0 | 20 6d 61 74 63 68 20 69 73 20 61 20 76 61 72 69 61 62 6c 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 | .match.is.a.variable........(def |
| 110fe0 | 69 6e 65 20 28 75 6e 69 66 79 2d 6d 61 74 63 68 20 70 31 20 70 32 20 66 72 61 6d 65 29 0a 20 20 | ine.(unify-match.p1.p2.frame)... |
| 111000 | 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 66 72 61 6d 65 20 27 66 61 69 6c 65 64 29 20 | .....(cond.((eq?.frame.'failed). |
| 111020 | 27 66 61 69 6c 65 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 75 61 6c 3f 20 70 | 'failed)..............((equal?.p |
| 111040 | 31 20 70 32 29 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 76 61 72 3f | 1.p2).frame)..............((var? |
| 111060 | 20 70 31 29 20 28 65 78 74 65 6e 64 2d 69 66 2d 70 6f 73 73 69 62 6c 65 20 70 31 20 70 32 20 66 | .p1).(extend-if-possible.p1.p2.f |
| 111080 | 72 61 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 76 61 72 3f 20 70 32 29 20 28 | rame))..............((var?.p2).( |
| 1110a0 | 65 78 74 65 6e 64 2d 69 66 2d 70 6f 73 73 69 62 6c 65 20 70 32 20 70 31 20 66 72 61 6d 65 29 29 | extend-if-possible.p2.p1.frame)) |
| 1110c0 | 20 20 3b 20 2a 2a 2a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 61 6e 64 20 28 70 61 69 72 | ..;.***..............((and.(pair |
| 1110e0 | 3f 20 70 31 29 20 28 70 61 69 72 3f 20 70 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ?.p1).(pair?.p2))............... |
| 111100 | 28 75 6e 69 66 79 2d 6d 61 74 63 68 20 28 63 64 72 20 70 31 29 0a 20 20 20 20 20 20 20 20 20 20 | (unify-match.(cdr.p1)........... |
| 111120 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 70 32 29 0a 20 20 20 20 20 20 | .................(cdr.p2)....... |
| 111140 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 75 6e 69 66 79 2d 6d 61 74 63 | .....................(unify-matc |
| 111160 | 68 20 28 63 61 72 20 70 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | h.(car.p1)...................... |
| 111180 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 70 32 29 0a 20 20 20 20 | ...................(car.p2)..... |
| 1111a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 1111c0 | 20 20 20 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 | ....frame)))..............(else. |
| 1111e0 | 27 66 61 69 6c 65 64 29 29 29 0a 0a 20 20 20 49 6e 20 75 6e 69 66 69 63 61 74 69 6f 6e 2c 20 61 | 'failed))).....In.unification,.a |
| 111200 | 73 20 69 6e 20 6f 6e 65 2d 73 69 64 65 64 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 69 6e 67 2c | s.in.one-sided.pattern.matching, |
| 111220 | 20 77 65 20 77 61 6e 74 20 74 6f 20 61 63 63 65 70 74 0a 61 20 70 72 6f 70 6f 73 65 64 20 65 78 | .we.want.to.accept.a.proposed.ex |
| 111240 | 74 65 6e 73 69 6f 6e 20 6f 66 20 74 68 65 20 66 72 61 6d 65 20 6f 6e 6c 79 20 69 66 20 69 74 20 | tension.of.the.frame.only.if.it. |
| 111260 | 69 73 20 63 6f 6e 73 69 73 74 65 6e 74 20 77 69 74 68 0a 65 78 69 73 74 69 6e 67 20 62 69 6e 64 | is.consistent.with.existing.bind |
| 111280 | 69 6e 67 73 2e 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 65 78 74 65 6e 64 2d 69 66 2d | ings...The.procedure.`extend-if- |
| 1112a0 | 70 6f 73 73 69 62 6c 65 27 20 75 73 65 64 20 69 6e 0a 75 6e 69 66 69 63 61 74 69 6f 6e 20 69 73 | possible'.used.in.unification.is |
| 1112c0 | 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 60 65 78 74 65 6e 64 2d 69 66 2d 63 6f 6e 73 | .the.same.as.the.`extend-if-cons |
| 1112e0 | 69 73 74 65 6e 74 27 20 75 73 65 64 20 69 6e 20 70 61 74 74 65 72 6e 0a 6d 61 74 63 68 69 6e 67 | istent'.used.in.pattern.matching |
| 111300 | 20 65 78 63 65 70 74 20 66 6f 72 20 74 77 6f 20 73 70 65 63 69 61 6c 20 63 68 65 63 6b 73 2c 20 | .except.for.two.special.checks,. |
| 111320 | 6d 61 72 6b 65 64 20 22 60 2a 2a 2a 27 22 20 69 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 0a 62 65 | marked."`***'".in.the.program.be |
| 111340 | 6c 6f 77 2e 20 20 49 6e 20 74 68 65 20 66 69 72 73 74 20 63 61 73 65 2c 20 69 66 20 74 68 65 20 | low...In.the.first.case,.if.the. |
| 111360 | 76 61 72 69 61 62 6c 65 20 77 65 20 61 72 65 20 74 72 79 69 6e 67 20 74 6f 20 6d 61 74 63 68 20 | variable.we.are.trying.to.match. |
| 111380 | 69 73 0a 6e 6f 74 20 62 6f 75 6e 64 2c 20 62 75 74 20 74 68 65 20 76 61 6c 75 65 20 77 65 20 61 | is.not.bound,.but.the.value.we.a |
| 1113a0 | 72 65 20 74 72 79 69 6e 67 20 74 6f 20 6d 61 74 63 68 20 69 74 20 77 69 74 68 20 69 73 20 69 74 | re.trying.to.match.it.with.is.it |
| 1113c0 | 73 65 6c 66 20 61 0a 28 64 69 66 66 65 72 65 6e 74 29 20 76 61 72 69 61 62 6c 65 2c 20 69 74 20 | self.a.(different).variable,.it. |
| 1113e0 | 69 73 20 6e 65 63 65 73 73 61 72 79 20 74 6f 20 63 68 65 63 6b 20 74 6f 20 73 65 65 20 69 66 20 | is.necessary.to.check.to.see.if. |
| 111400 | 74 68 65 20 76 61 6c 75 65 20 69 73 0a 62 6f 75 6e 64 2c 20 61 6e 64 20 69 66 20 73 6f 2c 20 74 | the.value.is.bound,.and.if.so,.t |
| 111420 | 6f 20 6d 61 74 63 68 20 69 74 73 20 76 61 6c 75 65 2e 20 20 49 66 20 62 6f 74 68 20 70 61 72 74 | o.match.its.value...If.both.part |
| 111440 | 69 65 73 20 74 6f 20 74 68 65 20 6d 61 74 63 68 20 61 72 65 0a 75 6e 62 6f 75 6e 64 2c 20 77 65 | ies.to.the.match.are.unbound,.we |
| 111460 | 20 6d 61 79 20 62 69 6e 64 20 65 69 74 68 65 72 20 74 6f 20 74 68 65 20 6f 74 68 65 72 2e 0a 0a | .may.bind.either.to.the.other... |
| 111480 | 20 20 20 54 68 65 20 73 65 63 6f 6e 64 20 63 68 65 63 6b 20 64 65 61 6c 73 20 77 69 74 68 20 61 | ...The.second.check.deals.with.a |
| 1114a0 | 74 74 65 6d 70 74 73 20 74 6f 20 62 69 6e 64 20 61 20 76 61 72 69 61 62 6c 65 20 74 6f 20 61 20 | ttempts.to.bind.a.variable.to.a. |
| 1114c0 | 70 61 74 74 65 72 6e 0a 74 68 61 74 20 69 6e 63 6c 75 64 65 73 20 74 68 61 74 20 76 61 72 69 61 | pattern.that.includes.that.varia |
| 1114e0 | 62 6c 65 2e 20 20 53 75 63 68 20 61 20 73 69 74 75 61 74 69 6f 6e 20 63 61 6e 20 6f 63 63 75 72 | ble...Such.a.situation.can.occur |
| 111500 | 20 77 68 65 6e 65 76 65 72 20 61 0a 76 61 72 69 61 62 6c 65 20 69 73 20 72 65 70 65 61 74 65 64 | .whenever.a.variable.is.repeated |
| 111520 | 20 69 6e 20 62 6f 74 68 20 70 61 74 74 65 72 6e 73 2e 20 20 43 6f 6e 73 69 64 65 72 2c 20 66 6f | .in.both.patterns...Consider,.fo |
| 111540 | 72 20 65 78 61 6d 70 6c 65 2c 20 75 6e 69 66 79 69 6e 67 0a 74 68 65 20 74 77 6f 20 70 61 74 74 | r.example,.unifying.the.two.patt |
| 111560 | 65 72 6e 73 20 60 28 3f 78 20 3f 78 29 27 20 61 6e 64 20 60 28 3f 79 20 3c 45 58 50 52 45 53 53 | erns.`(?x.?x)'.and.`(?y.<EXPRESS |
| 111580 | 49 4f 4e 20 49 4e 56 4f 4c 56 49 4e 47 20 60 3f 59 27 3e 29 27 20 69 6e 20 61 0a 66 72 61 6d 65 | ION.INVOLVING.`?Y'>)'.in.a.frame |
| 1115a0 | 20 77 68 65 72 65 20 62 6f 74 68 20 60 3f 78 27 20 61 6e 64 20 60 3f 79 27 20 61 72 65 20 75 6e | .where.both.`?x'.and.`?y'.are.un |
| 1115c0 | 62 6f 75 6e 64 2e 20 20 46 69 72 73 74 20 60 3f 78 27 20 69 73 20 6d 61 74 63 68 65 64 0a 61 67 | bound...First.`?x'.is.matched.ag |
| 1115e0 | 61 69 6e 73 74 20 60 3f 79 27 2c 20 6d 61 6b 69 6e 67 20 61 20 62 69 6e 64 69 6e 67 20 6f 66 20 | ainst.`?y',.making.a.binding.of. |
| 111600 | 60 3f 78 27 20 74 6f 20 60 3f 79 27 2e 20 20 4e 65 78 74 2c 20 74 68 65 20 73 61 6d 65 20 60 3f | `?x'.to.`?y'...Next,.the.same.`? |
| 111620 | 78 27 20 69 73 0a 6d 61 74 63 68 65 64 20 61 67 61 69 6e 73 74 20 74 68 65 20 67 69 76 65 6e 20 | x'.is.matched.against.the.given. |
| 111640 | 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 76 6f 6c 76 69 6e 67 20 60 3f 79 27 2e 20 20 53 69 6e 63 | expression.involving.`?y'...Sinc |
| 111660 | 65 20 60 3f 78 27 20 69 73 0a 61 6c 72 65 61 64 79 20 62 6f 75 6e 64 20 74 6f 20 60 3f 79 27 2c | e.`?x'.is.already.bound.to.`?y', |
| 111680 | 20 74 68 69 73 20 72 65 73 75 6c 74 73 20 69 6e 20 6d 61 74 63 68 69 6e 67 20 60 3f 79 27 20 61 | .this.results.in.matching.`?y'.a |
| 1116a0 | 67 61 69 6e 73 74 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 49 66 20 77 65 20 74 68 | gainst.the.expression...If.we.th |
| 1116c0 | 69 6e 6b 20 6f 66 20 74 68 65 20 75 6e 69 66 69 65 72 20 61 73 20 66 69 6e 64 69 6e 67 20 61 20 | ink.of.the.unifier.as.finding.a. |
| 1116e0 | 73 65 74 20 6f 66 20 76 61 6c 75 65 73 20 66 6f 72 0a 74 68 65 20 70 61 74 74 65 72 6e 20 76 61 | set.of.values.for.the.pattern.va |
| 111700 | 72 69 61 62 6c 65 73 20 74 68 61 74 20 6d 61 6b 65 20 74 68 65 20 70 61 74 74 65 72 6e 73 20 74 | riables.that.make.the.patterns.t |
| 111720 | 68 65 20 73 61 6d 65 2c 20 74 68 65 6e 20 74 68 65 73 65 0a 70 61 74 74 65 72 6e 73 20 69 6d 70 | he.same,.then.these.patterns.imp |
| 111740 | 6c 79 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 6f 20 66 69 6e 64 20 61 20 60 3f 79 27 20 73 | ly.instructions.to.find.a.`?y'.s |
| 111760 | 75 63 68 20 74 68 61 74 20 60 3f 79 27 20 69 73 20 65 71 75 61 6c 20 74 6f 0a 74 68 65 20 65 78 | uch.that.`?y'.is.equal.to.the.ex |
| 111780 | 70 72 65 73 73 69 6f 6e 20 69 6e 76 6f 6c 76 69 6e 67 20 60 3f 79 27 2e 20 20 54 68 65 72 65 20 | pression.involving.`?y'...There. |
| 1117a0 | 69 73 20 6e 6f 20 67 65 6e 65 72 61 6c 20 6d 65 74 68 6f 64 20 66 6f 72 20 73 6f 6c 76 69 6e 67 | is.no.general.method.for.solving |
| 1117c0 | 0a 73 75 63 68 20 65 71 75 61 74 69 6f 6e 73 2c 20 73 6f 20 77 65 20 72 65 6a 65 63 74 20 73 75 | .such.equations,.so.we.reject.su |
| 1117e0 | 63 68 20 62 69 6e 64 69 6e 67 73 3b 20 74 68 65 73 65 20 63 61 73 65 73 20 61 72 65 20 72 65 63 | ch.bindings;.these.cases.are.rec |
| 111800 | 6f 67 6e 69 7a 65 64 0a 62 79 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 60 64 65 70 65 6e 64 | ognized.by.the.predicate.`depend |
| 111820 | 73 2d 6f 6e 3f 27 2e 28 31 29 20 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 77 | s-on?'.(1)..On.the.other.hand,.w |
| 111840 | 65 20 64 6f 20 6e 6f 74 20 77 61 6e 74 0a 74 6f 20 72 65 6a 65 63 74 20 61 74 74 65 6d 70 74 73 | e.do.not.want.to.reject.attempts |
| 111860 | 20 74 6f 20 62 69 6e 64 20 61 20 76 61 72 69 61 62 6c 65 20 74 6f 20 69 74 73 65 6c 66 2e 20 20 | .to.bind.a.variable.to.itself... |
| 111880 | 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 63 6f 6e 73 69 64 65 72 0a 75 6e 69 66 79 69 6e 67 20 60 | For.example,.consider.unifying.` |
| 1118a0 | 28 3f 78 20 3f 78 29 27 20 61 6e 64 20 60 28 3f 79 20 3f 79 29 27 2e 20 20 54 68 65 20 73 65 63 | (?x.?x)'.and.`(?y.?y)'...The.sec |
| 1118c0 | 6f 6e 64 20 61 74 74 65 6d 70 74 20 74 6f 20 62 69 6e 64 20 60 3f 78 27 20 74 6f 0a 60 3f 79 27 | ond.attempt.to.bind.`?x'.to.`?y' |
| 1118e0 | 20 6d 61 74 63 68 65 73 20 60 3f 79 27 20 28 74 68 65 20 73 74 6f 72 65 64 20 76 61 6c 75 65 20 | .matches.`?y'.(the.stored.value. |
| 111900 | 6f 66 20 60 3f 78 27 29 20 61 67 61 69 6e 73 74 20 60 3f 79 27 20 28 74 68 65 20 6e 65 77 0a 76 | of.`?x').against.`?y'.(the.new.v |
| 111920 | 61 6c 75 65 20 6f 66 20 60 3f 78 27 29 2e 20 20 54 68 69 73 20 69 73 20 74 61 6b 65 6e 20 63 61 | alue.of.`?x')...This.is.taken.ca |
| 111940 | 72 65 20 6f 66 20 62 79 20 74 68 65 20 60 65 71 75 61 6c 3f 27 20 20 63 6c 61 75 73 65 20 6f 66 | re.of.by.the.`equal?'..clause.of |
| 111960 | 0a 60 75 6e 69 66 79 2d 6d 61 74 63 68 27 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 | .`unify-match'........(define.(e |
| 111980 | 78 74 65 6e 64 2d 69 66 2d 70 6f 73 73 69 62 6c 65 20 76 61 72 20 76 61 6c 20 66 72 61 6d 65 29 | xtend-if-possible.var.val.frame) |
| 1119a0 | 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 62 69 6e 64 69 6e 67 20 28 62 69 6e 64 69 6e 67 2d | ........(let.((binding.(binding- |
| 1119c0 | 69 6e 2d 66 72 61 6d 65 20 76 61 72 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 | in-frame.var.frame)))..........( |
| 1119e0 | 63 6f 6e 64 20 28 62 69 6e 64 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 75 | cond.(binding.................(u |
| 111a00 | 6e 69 66 79 2d 6d 61 74 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 69 6e | nify-match..................(bin |
| 111a20 | 64 69 6e 67 2d 76 61 6c 75 65 20 62 69 6e 64 69 6e 67 29 20 76 61 6c 20 66 72 61 6d 65 29 29 0a | ding-value.binding).val.frame)). |
| 111a40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 76 61 72 3f 20 76 61 6c 29 20 20 20 20 20 20 | ...............((var?.val)...... |
| 111a60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 2a 2a 2a 0a 20 20 20 20 20 20 20 20 20 20 | ................;.***........... |
| 111a80 | 20 20 20 20 20 20 28 6c 65 74 20 28 28 62 69 6e 64 69 6e 67 20 28 62 69 6e 64 69 6e 67 2d 69 6e | ......(let.((binding.(binding-in |
| 111aa0 | 2d 66 72 61 6d 65 20 76 61 6c 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | -frame.val.frame)))............. |
| 111ac0 | 20 20 20 20 20 20 28 69 66 20 62 69 6e 64 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......(if.binding............... |
| 111ae0 | 20 20 20 20 20 20 20 20 28 75 6e 69 66 79 2d 6d 61 74 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 | ........(unify-match............ |
| 111b00 | 20 20 20 20 20 20 20 20 20 20 20 20 76 61 72 20 28 62 69 6e 64 69 6e 67 2d 76 61 6c 75 65 20 62 | ............var.(binding-value.b |
| 111b20 | 69 6e 64 69 6e 67 29 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | inding).frame).................. |
| 111b40 | 20 20 20 20 20 28 65 78 74 65 6e 64 20 76 61 72 20 76 61 6c 20 66 72 61 6d 65 29 29 29 29 0a 20 | .....(extend.var.val.frame)))).. |
| 111b60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 64 65 70 65 6e 64 73 2d 6f 6e 3f 20 76 61 6c 20 | ..............((depends-on?.val. |
| 111b80 | 76 61 72 20 66 72 61 6d 65 29 20 20 20 20 20 3b 20 2a 2a 2a 0a 20 20 20 20 20 20 20 20 20 20 20 | var.frame).....;.***............ |
| 111ba0 | 20 20 20 20 20 27 66 61 69 6c 65 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c | .....'failed)................(el |
| 111bc0 | 73 65 20 28 65 78 74 65 6e 64 20 76 61 72 20 76 61 6c 20 66 72 61 6d 65 29 29 29 29 29 0a 0a 20 | se.(extend.var.val.frame)))))... |
| 111be0 | 20 20 60 44 65 70 65 6e 64 73 2d 6f 6e 3f 27 20 69 73 20 61 20 70 72 65 64 69 63 61 74 65 20 74 | ..`Depends-on?'.is.a.predicate.t |
| 111c00 | 68 61 74 20 74 65 73 74 73 20 77 68 65 74 68 65 72 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 0a | hat.tests.whether.an.expression. |
| 111c20 | 70 72 6f 70 6f 73 65 64 20 74 6f 20 62 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 61 20 70 61 | proposed.to.be.the.value.of.a.pa |
| 111c40 | 74 74 65 72 6e 20 76 61 72 69 61 62 6c 65 20 64 65 70 65 6e 64 73 20 6f 6e 20 74 68 65 20 76 61 | ttern.variable.depends.on.the.va |
| 111c60 | 72 69 61 62 6c 65 2e 0a 54 68 69 73 20 6d 75 73 74 20 62 65 20 64 6f 6e 65 20 72 65 6c 61 74 69 | riable..This.must.be.done.relati |
| 111c80 | 76 65 20 74 6f 20 74 68 65 20 63 75 72 72 65 6e 74 20 66 72 61 6d 65 20 62 65 63 61 75 73 65 20 | ve.to.the.current.frame.because. |
| 111ca0 | 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 6d 61 79 20 63 6f 6e 74 61 69 6e 20 6f 63 63 75 72 | the.expression.may.contain.occur |
| 111cc0 | 72 65 6e 63 65 73 20 6f 66 20 61 20 76 61 72 69 61 62 6c 65 20 74 68 61 74 20 61 6c 72 65 61 64 | rences.of.a.variable.that.alread |
| 111ce0 | 79 20 68 61 73 20 61 20 76 61 6c 75 65 20 74 68 61 74 0a 64 65 70 65 6e 64 73 20 6f 6e 20 6f 75 | y.has.a.value.that.depends.on.ou |
| 111d00 | 72 20 74 65 73 74 20 76 61 72 69 61 62 6c 65 2e 20 20 54 68 65 20 73 74 72 75 63 74 75 72 65 20 | r.test.variable...The.structure. |
| 111d20 | 6f 66 20 60 64 65 70 65 6e 64 73 2d 6f 6e 3f 27 20 69 73 20 61 0a 73 69 6d 70 6c 65 20 72 65 63 | of.`depends-on?'.is.a.simple.rec |
| 111d40 | 75 72 73 69 76 65 20 74 72 65 65 20 77 61 6c 6b 20 69 6e 20 77 68 69 63 68 20 77 65 20 73 75 62 | ursive.tree.walk.in.which.we.sub |
| 111d60 | 73 74 69 74 75 74 65 20 66 6f 72 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 0a 76 61 72 69 61 62 | stitute.for.the.values.of.variab |
| 111d80 | 6c 65 73 20 77 68 65 6e 65 76 65 72 20 6e 65 63 65 73 73 61 72 79 2e 0a 0a 20 20 20 20 20 28 64 | les.whenever.necessary........(d |
| 111da0 | 65 66 69 6e 65 20 28 64 65 70 65 6e 64 73 2d 6f 6e 3f 20 65 78 70 20 76 61 72 20 66 72 61 6d 65 | efine.(depends-on?.exp.var.frame |
| 111dc0 | 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 72 65 65 2d 77 61 6c 6b 20 65 29 0a 20 | )........(define.(tree-walk.e).. |
| 111de0 | 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 76 61 72 3f 20 65 29 0a 20 20 20 20 20 20 20 20 | ........(cond.((var?.e)......... |
| 111e00 | 20 20 20 20 20 20 20 20 28 69 66 20 28 65 71 75 61 6c 3f 20 76 61 72 20 65 29 0a 20 20 20 20 20 | ........(if.(equal?.var.e)...... |
| 111e20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 72 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ...............true............. |
| 111e40 | 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 62 20 28 62 69 6e 64 69 6e 67 2d 69 6e 2d 66 72 61 | ........(let.((b.(binding-in-fra |
| 111e60 | 6d 65 20 65 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | me.e.frame)))................... |
| 111e80 | 20 20 20 20 28 69 66 20 62 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....(if.b....................... |
| 111ea0 | 20 20 20 20 28 74 72 65 65 2d 77 61 6c 6b 20 28 62 69 6e 64 69 6e 67 2d 76 61 6c 75 65 20 62 29 | ....(tree-walk.(binding-value.b) |
| 111ec0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 6c 73 | )...........................fals |
| 111ee0 | 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 70 61 69 72 3f 20 65 29 0a | e))))................((pair?.e). |
| 111f00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 72 20 28 74 72 65 65 2d 77 61 6c 6b 20 28 | ................(or.(tree-walk.( |
| 111f20 | 63 61 72 20 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 72 65 | car.e)).....................(tre |
| 111f40 | 65 2d 77 61 6c 6b 20 28 63 64 72 20 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e-walk.(cdr.e))))............... |
| 111f60 | 20 28 65 6c 73 65 20 66 61 6c 73 65 29 29 29 0a 20 20 20 20 20 20 20 28 74 72 65 65 2d 77 61 6c | .(else.false)))........(tree-wal |
| 111f80 | 6b 20 65 78 70 29 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 | k.exp)).....----------.Footnotes |
| 111fa0 | 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 | .----------.....(1).In.general,. |
| 111fc0 | 75 6e 69 66 79 69 6e 67 20 60 3f 79 27 20 77 69 74 68 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e | unifying.`?y'.with.an.expression |
| 111fe0 | 20 69 6e 76 6f 6c 76 69 6e 67 20 60 3f 79 27 0a 77 6f 75 6c 64 20 72 65 71 75 69 72 65 20 6f 75 | .involving.`?y'.would.require.ou |
| 112000 | 72 20 62 65 69 6e 67 20 61 62 6c 65 20 74 6f 20 66 69 6e 64 20 61 20 66 69 78 65 64 20 70 6f 69 | r.being.able.to.find.a.fixed.poi |
| 112020 | 6e 74 20 6f 66 20 74 68 65 20 65 71 75 61 74 69 6f 6e 20 60 3f 79 27 0a 3d 20 3c 45 58 50 52 45 | nt.of.the.equation.`?y'.=.<EXPRE |
| 112040 | 53 53 49 4f 4e 20 49 4e 56 4f 4c 56 49 4e 47 20 60 3f 59 27 3e 2e 20 20 49 74 20 69 73 20 73 6f | SSION.INVOLVING.`?Y'>...It.is.so |
| 112060 | 6d 65 74 69 6d 65 73 20 70 6f 73 73 69 62 6c 65 20 74 6f 0a 73 79 6e 74 61 63 74 69 63 61 6c 6c | metimes.possible.to.syntacticall |
| 112080 | 79 20 66 6f 72 6d 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 61 70 70 65 61 72 | y.form.an.expression.that.appear |
| 1120a0 | 73 20 74 6f 20 62 65 20 74 68 65 20 73 6f 6c 75 74 69 6f 6e 2e 20 20 46 6f 72 0a 65 78 61 6d 70 | s.to.be.the.solution...For.examp |
| 1120c0 | 6c 65 2c 20 60 3f 79 27 20 3d 20 60 28 66 20 3f 79 29 27 20 73 65 65 6d 73 20 74 6f 20 68 61 76 | le,.`?y'.=.`(f.?y)'.seems.to.hav |
| 1120e0 | 65 20 74 68 65 20 66 69 78 65 64 20 70 6f 69 6e 74 20 60 28 66 20 28 66 20 28 66 20 2e 2e 2e 0a | e.the.fixed.point.`(f.(f.(f..... |
| 112100 | 29 29 29 27 2c 20 77 68 69 63 68 20 77 65 20 63 61 6e 20 70 72 6f 64 75 63 65 20 62 79 20 62 65 | )))',.which.we.can.produce.by.be |
| 112120 | 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 66 20 | ginning.with.the.expression.`(f. |
| 112140 | 3f 79 29 27 0a 61 6e 64 20 72 65 70 65 61 74 65 64 6c 79 20 73 75 62 73 74 69 74 75 74 69 6e 67 | ?y)'.and.repeatedly.substituting |
| 112160 | 20 60 28 66 20 3f 79 29 27 20 66 6f 72 20 60 3f 79 27 2e 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 | .`(f.?y)'.for.`?y'...Unfortunate |
| 112180 | 6c 79 2c 20 6e 6f 74 0a 65 76 65 72 79 20 73 75 63 68 20 65 71 75 61 74 69 6f 6e 20 68 61 73 20 | ly,.not.every.such.equation.has. |
| 1121a0 | 61 20 6d 65 61 6e 69 6e 67 66 75 6c 20 66 69 78 65 64 20 70 6f 69 6e 74 2e 20 20 54 68 65 20 69 | a.meaningful.fixed.point...The.i |
| 1121c0 | 73 73 75 65 73 20 74 68 61 74 0a 61 72 69 73 65 20 68 65 72 65 20 61 72 65 20 73 69 6d 69 6c 61 | ssues.that.arise.here.are.simila |
| 1121e0 | 72 20 74 6f 20 74 68 65 20 69 73 73 75 65 73 20 6f 66 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 | r.to.the.issues.of.manipulating. |
| 112200 | 69 6e 66 69 6e 69 74 65 20 73 65 72 69 65 73 20 69 6e 0a 6d 61 74 68 65 6d 61 74 69 63 73 2e 20 | infinite.series.in.mathematics.. |
| 112220 | 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 6b 6e 6f 77 20 74 68 61 74 20 32 20 69 73 20 | .For.example,.we.know.that.2.is. |
| 112240 | 74 68 65 20 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 74 68 65 0a 65 71 75 61 74 69 6f 6e 20 79 20 3d | the.solution.to.the.equation.y.= |
| 112260 | 20 31 20 2b 20 79 2f 32 2e 20 20 42 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 74 68 65 20 65 78 | .1.+.y/2...Beginning.with.the.ex |
| 112280 | 70 72 65 73 73 69 6f 6e 20 31 20 2b 20 79 2f 32 20 61 6e 64 0a 72 65 70 65 61 74 65 64 6c 79 20 | pression.1.+.y/2.and.repeatedly. |
| 1122a0 | 73 75 62 73 74 69 74 75 74 69 6e 67 20 31 20 2b 20 79 2f 32 20 66 6f 72 20 79 20 67 69 76 65 73 | substituting.1.+.y/2.for.y.gives |
| 1122c0 | 0a 0a 20 20 20 20 20 32 20 3d 20 79 20 3d 20 31 20 2b 20 79 2f 32 20 3d 20 31 20 2b 20 28 31 20 | .......2.=.y.=.1.+.y/2.=.1.+.(1. |
| 1122e0 | 2b 20 79 2f 32 29 2f 32 20 3d 20 31 20 2b 20 31 2f 32 20 2b 20 79 2f 34 20 3d 20 2e 2e 2e 0a 0a | +.y/2)/2.=.1.+.1/2.+.y/4.=...... |
| 112300 | 77 68 69 63 68 20 6c 65 61 64 73 20 74 6f 0a 0a 20 20 20 20 20 32 20 3d 20 31 20 2b 20 31 2f 32 | which.leads.to.......2.=.1.+.1/2 |
| 112320 | 20 2b 20 31 2f 34 20 2b 20 31 2f 38 20 2b 20 2e 2e 2e 0a 0a 48 6f 77 65 76 65 72 2c 20 69 66 20 | .+.1/4.+.1/8.+......However,.if. |
| 112340 | 77 65 20 74 72 79 20 74 68 65 20 73 61 6d 65 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 62 65 67 | we.try.the.same.manipulation.beg |
| 112360 | 69 6e 6e 69 6e 67 20 77 69 74 68 20 74 68 65 20 6f 62 73 65 72 76 61 74 69 6f 6e 0a 74 68 61 74 | inning.with.the.observation.that |
| 112380 | 20 2d 20 31 20 69 73 20 74 68 65 20 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 74 68 65 20 65 71 75 61 | .-.1.is.the.solution.to.the.equa |
| 1123a0 | 74 69 6f 6e 20 79 20 3d 20 31 20 2b 20 32 79 2c 20 77 65 20 6f 62 74 61 69 6e 0a 0a 20 20 20 20 | tion.y.=.1.+.2y,.we.obtain...... |
| 1123c0 | 20 2d 31 20 3d 20 79 20 3d 20 31 20 2b 20 32 79 20 3d 20 31 20 2b 20 32 28 31 20 2b 20 32 79 29 | .-1.=.y.=.1.+.2y.=.1.+.2(1.+.2y) |
| 1123e0 | 20 3d 20 31 20 2b 20 32 20 2b 20 34 79 20 3d 20 2e 2e 2e 0a 0a 77 68 69 63 68 20 6c 65 61 64 73 | .=.1.+.2.+.4y.=......which.leads |
| 112400 | 20 74 6f 0a 0a 20 20 20 20 20 2d 31 20 3d 20 31 20 2b 20 32 20 2b 20 34 20 2b 20 38 20 2b 20 2e | .to.......-1.=.1.+.2.+.4.+.8.+.. |
| 112420 | 2e 2e 0a 0a 41 6c 74 68 6f 75 67 68 20 74 68 65 20 66 6f 72 6d 61 6c 20 6d 61 6e 69 70 75 6c 61 | ....Although.the.formal.manipula |
| 112440 | 74 69 6f 6e 73 20 75 73 65 64 20 69 6e 20 64 65 72 69 76 69 6e 67 20 74 68 65 73 65 20 74 77 6f | tions.used.in.deriving.these.two |
| 112460 | 20 65 71 75 61 74 69 6f 6e 73 0a 61 72 65 20 69 64 65 6e 74 69 63 61 6c 2c 20 74 68 65 20 66 69 | .equations.are.identical,.the.fi |
| 112480 | 72 73 74 20 72 65 73 75 6c 74 20 69 73 20 61 20 76 61 6c 69 64 20 61 73 73 65 72 74 69 6f 6e 20 | rst.result.is.a.valid.assertion. |
| 1124a0 | 61 62 6f 75 74 20 69 6e 66 69 6e 69 74 65 0a 73 65 72 69 65 73 20 62 75 74 20 74 68 65 20 73 65 | about.infinite.series.but.the.se |
| 1124c0 | 63 6f 6e 64 20 69 73 20 6e 6f 74 2e 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 66 6f 72 20 6f 75 72 | cond.is.not...Similarly,.for.our |
| 1124e0 | 20 75 6e 69 66 69 63 61 74 69 6f 6e 20 72 65 73 75 6c 74 73 2c 0a 72 65 61 73 6f 6e 69 6e 67 20 | .unification.results,.reasoning. |
| 112500 | 77 69 74 68 20 61 6e 20 61 72 62 69 74 72 61 72 79 20 73 79 6e 74 61 63 74 69 63 61 6c 6c 79 20 | with.an.arbitrary.syntactically. |
| 112520 | 63 6f 6e 73 74 72 75 63 74 65 64 20 65 78 70 72 65 73 73 69 6f 6e 20 6d 61 79 0a 6c 65 61 64 20 | constructed.expression.may.lead. |
| 112540 | 74 6f 20 65 72 72 6f 72 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 | to.errors.....File:.sicp.info,.. |
| 112560 | 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d 35 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2d 34 2d 36 2c 20 20 | Node:.4-4-4-5,..Next:.4-4-4-6,.. |
| 112580 | 50 72 65 76 3a 20 34 2d 34 2d 34 2d 34 2c 20 20 55 70 3a 20 34 2d 34 2d 34 0a 0a 34 2e 34 2e 34 | Prev:.4-4-4-4,..Up:.4-4-4..4.4.4 |
| 1125a0 | 2e 35 20 4d 61 69 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 44 61 74 61 20 42 61 73 65 0a 2e 2e 2e | .5.Maintaining.the.Data.Base.... |
| 1125c0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | ................................ |
| 1125e0 | 4f 6e 65 20 69 6d 70 6f 72 74 61 6e 74 20 70 72 6f 62 6c 65 6d 20 69 6e 20 64 65 73 69 67 6e 69 | One.important.problem.in.designi |
| 112600 | 6e 67 20 6c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 73 20 69 | ng.logic.programming.languages.i |
| 112620 | 73 20 74 68 61 74 0a 6f 66 20 61 72 72 61 6e 67 69 6e 67 20 74 68 69 6e 67 73 20 73 6f 20 74 68 | s.that.of.arranging.things.so.th |
| 112640 | 61 74 20 61 73 20 66 65 77 20 69 72 72 65 6c 65 76 61 6e 74 20 64 61 74 61 2d 62 61 73 65 20 65 | at.as.few.irrelevant.data-base.e |
| 112660 | 6e 74 72 69 65 73 20 61 73 0a 70 6f 73 73 69 62 6c 65 20 77 69 6c 6c 20 62 65 20 65 78 61 6d 69 | ntries.as.possible.will.be.exami |
| 112680 | 6e 65 64 20 69 6e 20 63 68 65 63 6b 69 6e 67 20 61 20 67 69 76 65 6e 20 70 61 74 74 65 72 6e 2e | ned.in.checking.a.given.pattern. |
| 1126a0 | 20 20 49 6e 20 6f 75 72 20 73 79 73 74 65 6d 2c 0a 69 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 | ..In.our.system,.in.addition.to. |
| 1126c0 | 73 74 6f 72 69 6e 67 20 61 6c 6c 20 61 73 73 65 72 74 69 6f 6e 73 20 69 6e 20 6f 6e 65 20 62 69 | storing.all.assertions.in.one.bi |
| 1126e0 | 67 20 73 74 72 65 61 6d 2c 20 77 65 20 73 74 6f 72 65 20 61 6c 6c 0a 61 73 73 65 72 74 69 6f 6e | g.stream,.we.store.all.assertion |
| 112700 | 73 20 77 68 6f 73 65 20 60 63 61 72 27 73 20 61 72 65 20 63 6f 6e 73 74 61 6e 74 20 73 79 6d 62 | s.whose.`car's.are.constant.symb |
| 112720 | 6f 6c 73 20 69 6e 20 73 65 70 61 72 61 74 65 20 73 74 72 65 61 6d 73 2c 20 69 6e 20 61 0a 74 61 | ols.in.separate.streams,.in.a.ta |
| 112740 | 62 6c 65 20 69 6e 64 65 78 65 64 20 62 79 20 74 68 65 20 73 79 6d 62 6f 6c 2e 20 20 54 6f 20 66 | ble.indexed.by.the.symbol...To.f |
| 112760 | 65 74 63 68 20 61 6e 20 61 73 73 65 72 74 69 6f 6e 20 74 68 61 74 20 6d 61 79 20 6d 61 74 63 68 | etch.an.assertion.that.may.match |
| 112780 | 20 61 0a 70 61 74 74 65 72 6e 2c 20 77 65 20 66 69 72 73 74 20 63 68 65 63 6b 20 74 6f 20 73 65 | .a.pattern,.we.first.check.to.se |
| 1127a0 | 65 20 69 66 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 74 68 65 20 70 61 74 74 65 72 6e 20 69 73 | e.if.the.`car'.of.the.pattern.is |
| 1127c0 | 20 61 0a 63 6f 6e 73 74 61 6e 74 20 73 79 6d 62 6f 6c 2e 20 20 49 66 20 73 6f 2c 20 77 65 20 72 | .a.constant.symbol...If.so,.we.r |
| 1127e0 | 65 74 75 72 6e 20 28 74 6f 20 62 65 20 74 65 73 74 65 64 20 75 73 69 6e 67 20 74 68 65 20 6d 61 | eturn.(to.be.tested.using.the.ma |
| 112800 | 74 63 68 65 72 29 20 61 6c 6c 0a 74 68 65 20 73 74 6f 72 65 64 20 61 73 73 65 72 74 69 6f 6e 73 | tcher).all.the.stored.assertions |
| 112820 | 20 74 68 61 74 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 60 63 61 72 27 2e 20 20 49 66 20 74 | .that.have.the.same.`car'...If.t |
| 112840 | 68 65 20 70 61 74 74 65 72 6e 27 73 20 60 63 61 72 27 0a 69 73 20 6e 6f 74 20 61 20 63 6f 6e 73 | he.pattern's.`car'.is.not.a.cons |
| 112860 | 74 61 6e 74 20 73 79 6d 62 6f 6c 2c 20 77 65 20 72 65 74 75 72 6e 20 61 6c 6c 20 74 68 65 20 73 | tant.symbol,.we.return.all.the.s |
| 112880 | 74 6f 72 65 64 20 61 73 73 65 72 74 69 6f 6e 73 2e 0a 43 6c 65 76 65 72 65 72 20 6d 65 74 68 6f | tored.assertions..Cleverer.metho |
| 1128a0 | 64 73 20 63 6f 75 6c 64 20 61 6c 73 6f 20 74 61 6b 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 | ds.could.also.take.advantage.of. |
| 1128c0 | 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 66 72 61 6d 65 2c 0a 6f 72 20 74 72 79 | information.in.the.frame,.or.try |
| 1128e0 | 20 61 6c 73 6f 20 74 6f 20 6f 70 74 69 6d 69 7a 65 20 74 68 65 20 63 61 73 65 20 77 68 65 72 65 | .also.to.optimize.the.case.where |
| 112900 | 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 74 68 65 20 70 61 74 74 65 72 6e 20 69 73 20 6e 6f 74 | .the.`car'.of.the.pattern.is.not |
| 112920 | 0a 61 20 63 6f 6e 73 74 61 6e 74 20 73 79 6d 62 6f 6c 2e 20 20 57 65 20 61 76 6f 69 64 20 62 75 | .a.constant.symbol...We.avoid.bu |
| 112940 | 69 6c 64 69 6e 67 20 6f 75 72 20 63 72 69 74 65 72 69 61 20 66 6f 72 20 69 6e 64 65 78 69 6e 67 | ilding.our.criteria.for.indexing |
| 112960 | 20 28 75 73 69 6e 67 0a 74 68 65 20 60 63 61 72 27 2c 20 68 61 6e 64 6c 69 6e 67 20 6f 6e 6c 79 | .(using.the.`car',.handling.only |
| 112980 | 20 74 68 65 20 63 61 73 65 20 6f 66 20 63 6f 6e 73 74 61 6e 74 20 73 79 6d 62 6f 6c 73 29 20 69 | .the.case.of.constant.symbols).i |
| 1129a0 | 6e 74 6f 20 74 68 65 20 70 72 6f 67 72 61 6d 3b 0a 69 6e 73 74 65 61 64 20 77 65 20 63 61 6c 6c | nto.the.program;.instead.we.call |
| 1129c0 | 20 6f 6e 20 70 72 65 64 69 63 61 74 65 73 20 61 6e 64 20 73 65 6c 65 63 74 6f 72 73 20 74 68 61 | .on.predicates.and.selectors.tha |
| 1129e0 | 74 20 65 6d 62 6f 64 79 20 6f 75 72 20 63 72 69 74 65 72 69 61 2e 0a 0a 20 20 20 20 20 28 64 65 | t.embody.our.criteria........(de |
| 112a00 | 66 69 6e 65 20 54 48 45 2d 41 53 53 45 52 54 49 4f 4e 53 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 | fine.THE-ASSERTIONS.the-empty-st |
| 112a20 | 72 65 61 6d 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 65 74 63 68 2d 61 73 73 65 72 | ream).......(define.(fetch-asser |
| 112a40 | 74 69 6f 6e 73 20 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 28 69 66 20 | tions.pattern.frame)........(if. |
| 112a60 | 28 75 73 65 2d 69 6e 64 65 78 3f 20 70 61 74 74 65 72 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (use-index?.pattern)............ |
| 112a80 | 28 67 65 74 2d 69 6e 64 65 78 65 64 2d 61 73 73 65 72 74 69 6f 6e 73 20 70 61 74 74 65 72 6e 29 | (get-indexed-assertions.pattern) |
| 112aa0 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 65 74 2d 61 6c 6c 2d 61 73 73 65 72 74 69 6f 6e 73 29 | ............(get-all-assertions) |
| 112ac0 | 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 67 65 74 2d 61 6c 6c 2d 61 73 73 65 72 74 | )).......(define.(get-all-assert |
| 112ae0 | 69 6f 6e 73 29 20 54 48 45 2d 41 53 53 45 52 54 49 4f 4e 53 29 0a 0a 20 20 20 20 20 28 64 65 66 | ions).THE-ASSERTIONS).......(def |
| 112b00 | 69 6e 65 20 28 67 65 74 2d 69 6e 64 65 78 65 64 2d 61 73 73 65 72 74 69 6f 6e 73 20 70 61 74 74 | ine.(get-indexed-assertions.patt |
| 112b20 | 65 72 6e 29 0a 20 20 20 20 20 20 20 28 67 65 74 2d 73 74 72 65 61 6d 20 28 69 6e 64 65 78 2d 6b | ern)........(get-stream.(index-k |
| 112b40 | 65 79 2d 6f 66 20 70 61 74 74 65 72 6e 29 20 27 61 73 73 65 72 74 69 6f 6e 2d 73 74 72 65 61 6d | ey-of.pattern).'assertion-stream |
| 112b60 | 29 29 0a 0a 20 20 20 60 47 65 74 2d 73 74 72 65 61 6d 27 20 6c 6f 6f 6b 73 20 75 70 20 61 20 73 | )).....`Get-stream'.looks.up.a.s |
| 112b80 | 74 72 65 61 6d 20 69 6e 20 74 68 65 20 74 61 62 6c 65 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 | tream.in.the.table.and.returns.a |
| 112ba0 | 6e 20 65 6d 70 74 79 0a 73 74 72 65 61 6d 20 69 66 20 6e 6f 74 68 69 6e 67 20 69 73 20 73 74 6f | n.empty.stream.if.nothing.is.sto |
| 112bc0 | 72 65 64 20 74 68 65 72 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 67 65 74 2d 73 74 | red.there........(define.(get-st |
| 112be0 | 72 65 61 6d 20 6b 65 79 31 20 6b 65 79 32 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 20 | ream.key1.key2)........(let.((s. |
| 112c00 | 28 67 65 74 20 6b 65 79 31 20 6b 65 79 32 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 73 | (get.key1.key2)))..........(if.s |
| 112c20 | 20 73 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 29 29 29 0a 0a 20 20 20 52 75 6c 65 73 | .s.the-empty-stream))).....Rules |
| 112c40 | 20 61 72 65 20 73 74 6f 72 65 64 20 73 69 6d 69 6c 61 72 6c 79 2c 20 75 73 69 6e 67 20 74 68 65 | .are.stored.similarly,.using.the |
| 112c60 | 20 60 63 61 72 27 20 6f 66 20 74 68 65 20 72 75 6c 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 2e 0a 52 | .`car'.of.the.rule.conclusion..R |
| 112c80 | 75 6c 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 73 20 61 72 65 20 61 72 62 69 74 72 61 72 79 20 70 61 | ule.conclusions.are.arbitrary.pa |
| 112ca0 | 74 74 65 72 6e 73 2c 20 68 6f 77 65 76 65 72 2c 20 73 6f 20 74 68 65 79 20 64 69 66 66 65 72 20 | tterns,.however,.so.they.differ. |
| 112cc0 | 66 72 6f 6d 0a 61 73 73 65 72 74 69 6f 6e 73 20 69 6e 20 74 68 61 74 20 74 68 65 79 20 63 61 6e | from.assertions.in.that.they.can |
| 112ce0 | 20 63 6f 6e 74 61 69 6e 20 76 61 72 69 61 62 6c 65 73 2e 20 20 41 20 70 61 74 74 65 72 6e 20 77 | .contain.variables...A.pattern.w |
| 112d00 | 68 6f 73 65 20 60 63 61 72 27 0a 69 73 20 61 20 63 6f 6e 73 74 61 6e 74 20 73 79 6d 62 6f 6c 20 | hose.`car'.is.a.constant.symbol. |
| 112d20 | 63 61 6e 20 6d 61 74 63 68 20 72 75 6c 65 73 20 77 68 6f 73 65 20 63 6f 6e 63 6c 75 73 69 6f 6e | can.match.rules.whose.conclusion |
| 112d40 | 73 20 73 74 61 72 74 20 77 69 74 68 20 61 0a 76 61 72 69 61 62 6c 65 20 61 73 20 77 65 6c 6c 20 | s.start.with.a.variable.as.well. |
| 112d60 | 61 73 20 72 75 6c 65 73 20 77 68 6f 73 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 73 20 68 61 76 65 20 | as.rules.whose.conclusions.have. |
| 112d80 | 74 68 65 20 73 61 6d 65 20 60 63 61 72 27 2e 20 20 54 68 75 73 2c 0a 77 68 65 6e 20 66 65 74 63 | the.same.`car'...Thus,.when.fetc |
| 112da0 | 68 69 6e 67 20 72 75 6c 65 73 20 74 68 61 74 20 6d 69 67 68 74 20 6d 61 74 63 68 20 61 20 70 61 | hing.rules.that.might.match.a.pa |
| 112dc0 | 74 74 65 72 6e 20 77 68 6f 73 65 20 60 63 61 72 27 20 69 73 20 61 0a 63 6f 6e 73 74 61 6e 74 20 | ttern.whose.`car'.is.a.constant. |
| 112de0 | 73 79 6d 62 6f 6c 20 77 65 20 66 65 74 63 68 20 61 6c 6c 20 72 75 6c 65 73 20 77 68 6f 73 65 20 | symbol.we.fetch.all.rules.whose. |
| 112e00 | 63 6f 6e 63 6c 75 73 69 6f 6e 73 20 73 74 61 72 74 20 77 69 74 68 20 61 0a 76 61 72 69 61 62 6c | conclusions.start.with.a.variabl |
| 112e20 | 65 20 61 73 20 77 65 6c 6c 20 61 73 20 74 68 6f 73 65 20 77 68 6f 73 65 20 63 6f 6e 63 6c 75 73 | e.as.well.as.those.whose.conclus |
| 112e40 | 69 6f 6e 73 20 68 61 76 65 20 74 68 65 20 73 61 6d 65 20 60 63 61 72 27 20 61 73 20 74 68 65 0a | ions.have.the.same.`car'.as.the. |
| 112e60 | 70 61 74 74 65 72 6e 2e 20 20 46 6f 72 20 74 68 69 73 20 70 75 72 70 6f 73 65 20 77 65 20 73 74 | pattern...For.this.purpose.we.st |
| 112e80 | 6f 72 65 20 61 6c 6c 20 72 75 6c 65 73 20 77 68 6f 73 65 20 63 6f 6e 63 6c 75 73 69 6f 6e 73 20 | ore.all.rules.whose.conclusions. |
| 112ea0 | 73 74 61 72 74 0a 77 69 74 68 20 61 20 76 61 72 69 61 62 6c 65 20 69 6e 20 61 20 73 65 70 61 72 | start.with.a.variable.in.a.separ |
| 112ec0 | 61 74 65 20 73 74 72 65 61 6d 20 69 6e 20 6f 75 72 20 74 61 62 6c 65 2c 20 69 6e 64 65 78 65 64 | ate.stream.in.our.table,.indexed |
| 112ee0 | 20 62 79 20 74 68 65 0a 73 79 6d 62 6f 6c 20 60 3f 27 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | .by.the.symbol.`?'........(defin |
| 112f00 | 65 20 54 48 45 2d 52 55 4c 45 53 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 29 0a 0a 20 | e.THE-RULES.the-empty-stream)... |
| 112f20 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 65 74 63 68 2d 72 75 6c 65 73 20 70 61 74 74 65 72 6e | ....(define.(fetch-rules.pattern |
| 112f40 | 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 75 73 65 2d 69 6e 64 65 78 3f 20 70 | .frame)........(if.(use-index?.p |
| 112f60 | 61 74 74 65 72 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 65 74 2d 69 6e 64 65 78 65 64 2d | attern)............(get-indexed- |
| 112f80 | 72 75 6c 65 73 20 70 61 74 74 65 72 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 65 74 2d 61 | rules.pattern)............(get-a |
| 112fa0 | 6c 6c 2d 72 75 6c 65 73 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 67 65 74 2d 61 | ll-rules))).......(define.(get-a |
| 112fc0 | 6c 6c 2d 72 75 6c 65 73 29 20 54 48 45 2d 52 55 4c 45 53 29 0a 0a 20 20 20 20 20 28 64 65 66 69 | ll-rules).THE-RULES).......(defi |
| 112fe0 | 6e 65 20 28 67 65 74 2d 69 6e 64 65 78 65 64 2d 72 75 6c 65 73 20 70 61 74 74 65 72 6e 29 0a 20 | ne.(get-indexed-rules.pattern).. |
| 113000 | 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 61 70 70 65 6e 64 0a 20 20 20 20 20 20 20 20 28 67 65 | ......(stream-append.........(ge |
| 113020 | 74 2d 73 74 72 65 61 6d 20 28 69 6e 64 65 78 2d 6b 65 79 2d 6f 66 20 70 61 74 74 65 72 6e 29 20 | t-stream.(index-key-of.pattern). |
| 113040 | 27 72 75 6c 65 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 28 67 65 74 2d 73 74 72 65 61 | 'rule-stream).........(get-strea |
| 113060 | 6d 20 27 3f 20 27 72 75 6c 65 2d 73 74 72 65 61 6d 29 29 29 0a 0a 20 20 20 60 41 64 64 2d 72 75 | m.'?.'rule-stream))).....`Add-ru |
| 113080 | 6c 65 2d 6f 72 2d 61 73 73 65 72 74 69 6f 6e 21 27 20 69 73 20 75 73 65 64 20 62 79 20 60 71 75 | le-or-assertion!'.is.used.by.`qu |
| 1130a0 | 65 72 79 2d 64 72 69 76 65 72 2d 6c 6f 6f 70 27 20 74 6f 20 61 64 64 0a 61 73 73 65 72 74 69 6f | ery-driver-loop'.to.add.assertio |
| 1130c0 | 6e 73 20 61 6e 64 20 72 75 6c 65 73 20 74 6f 20 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 20 20 | ns.and.rules.to.the.data.base... |
| 1130e0 | 45 61 63 68 20 69 74 65 6d 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 0a 69 6e 64 65 78 | Each.item.is.stored.in.the.index |
| 113100 | 2c 20 69 66 20 61 70 70 72 6f 70 72 69 61 74 65 2c 20 61 6e 64 20 69 6e 20 61 20 73 74 72 65 61 | ,.if.appropriate,.and.in.a.strea |
| 113120 | 6d 20 6f 66 20 61 6c 6c 20 61 73 73 65 72 74 69 6f 6e 73 20 6f 72 20 72 75 6c 65 73 20 69 6e 0a | m.of.all.assertions.or.rules.in. |
| 113140 | 74 68 65 20 64 61 74 61 20 62 61 73 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 | the.data.base........(define.(ad |
| 113160 | 64 2d 72 75 6c 65 2d 6f 72 2d 61 73 73 65 72 74 69 6f 6e 21 20 61 73 73 65 72 74 69 6f 6e 29 0a | d-rule-or-assertion!.assertion). |
| 113180 | 20 20 20 20 20 20 20 28 69 66 20 28 72 75 6c 65 3f 20 61 73 73 65 72 74 69 6f 6e 29 0a 20 20 20 | .......(if.(rule?.assertion).... |
| 1131a0 | 20 20 20 20 20 20 20 20 28 61 64 64 2d 72 75 6c 65 21 20 61 73 73 65 72 74 69 6f 6e 29 0a 20 20 | ........(add-rule!.assertion)... |
| 1131c0 | 20 20 20 20 20 20 20 20 20 28 61 64 64 2d 61 73 73 65 72 74 69 6f 6e 21 20 61 73 73 65 72 74 69 | .........(add-assertion!.asserti |
| 1131e0 | 6f 6e 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 61 73 73 65 72 74 69 | on))).......(define.(add-asserti |
| 113200 | 6f 6e 21 20 61 73 73 65 72 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 28 73 74 6f 72 65 2d 61 73 73 | on!.assertion)........(store-ass |
| 113220 | 65 72 74 69 6f 6e 2d 69 6e 2d 69 6e 64 65 78 20 61 73 73 65 72 74 69 6f 6e 29 0a 20 20 20 20 20 | ertion-in-index.assertion)...... |
| 113240 | 20 20 28 6c 65 74 20 28 28 6f 6c 64 2d 61 73 73 65 72 74 69 6f 6e 73 20 54 48 45 2d 41 53 53 45 | ..(let.((old-assertions.THE-ASSE |
| 113260 | 52 54 49 4f 4e 53 29 29 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 54 48 45 2d 41 53 53 45 | RTIONS))..........(set!.THE-ASSE |
| 113280 | 52 54 49 4f 4e 53 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 | RTIONS................(cons-stre |
| 1132a0 | 61 6d 20 61 73 73 65 72 74 69 6f 6e 20 6f 6c 64 2d 61 73 73 65 72 74 69 6f 6e 73 29 29 0a 20 20 | am.assertion.old-assertions))... |
| 1132c0 | 20 20 20 20 20 20 20 27 6f 6b 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d | .......'ok)).......(define.(add- |
| 1132e0 | 72 75 6c 65 21 20 72 75 6c 65 29 0a 20 20 20 20 20 20 20 28 73 74 6f 72 65 2d 72 75 6c 65 2d 69 | rule!.rule)........(store-rule-i |
| 113300 | 6e 2d 69 6e 64 65 78 20 72 75 6c 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6f 6c 64 2d | n-index.rule)........(let.((old- |
| 113320 | 72 75 6c 65 73 20 54 48 45 2d 52 55 4c 45 53 29 29 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 21 | rules.THE-RULES))..........(set! |
| 113340 | 20 54 48 45 2d 52 55 4c 45 53 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 72 75 6c 65 20 6f 6c 64 | .THE-RULES.(cons-stream.rule.old |
| 113360 | 2d 72 75 6c 65 73 29 29 0a 20 20 20 20 20 20 20 20 20 27 6f 6b 29 29 0a 0a 20 20 20 54 6f 20 61 | -rules))..........'ok)).....To.a |
| 113380 | 63 74 75 61 6c 6c 79 20 73 74 6f 72 65 20 61 6e 20 61 73 73 65 72 74 69 6f 6e 20 6f 72 20 61 20 | ctually.store.an.assertion.or.a. |
| 1133a0 | 72 75 6c 65 2c 20 77 65 20 63 68 65 63 6b 20 74 6f 20 73 65 65 20 69 66 20 69 74 20 63 61 6e 0a | rule,.we.check.to.see.if.it.can. |
| 1133c0 | 62 65 20 69 6e 64 65 78 65 64 2e 20 20 49 66 20 73 6f 2c 20 77 65 20 73 74 6f 72 65 20 69 74 20 | be.indexed...If.so,.we.store.it. |
| 1133e0 | 69 6e 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 73 74 72 65 61 6d 2e 0a 0a 20 20 20 20 | in.the.appropriate.stream....... |
| 113400 | 20 28 64 65 66 69 6e 65 20 28 73 74 6f 72 65 2d 61 73 73 65 72 74 69 6f 6e 2d 69 6e 2d 69 6e 64 | .(define.(store-assertion-in-ind |
| 113420 | 65 78 20 61 73 73 65 72 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 69 6e 64 65 78 61 | ex.assertion)........(if.(indexa |
| 113440 | 62 6c 65 3f 20 61 73 73 65 72 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 | ble?.assertion)............(let. |
| 113460 | 28 28 6b 65 79 20 28 69 6e 64 65 78 2d 6b 65 79 2d 6f 66 20 61 73 73 65 72 74 69 6f 6e 29 29 29 | ((key.(index-key-of.assertion))) |
| 113480 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 75 72 72 65 6e 74 2d 61 73 73 | ..............(let.((current-ass |
| 1134a0 | 65 72 74 69 6f 6e 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ertion-stream................... |
| 1134c0 | 20 20 28 67 65 74 2d 73 74 72 65 61 6d 20 6b 65 79 20 27 61 73 73 65 72 74 69 6f 6e 2d 73 74 72 | ..(get-stream.key.'assertion-str |
| 1134e0 | 65 61 6d 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 75 74 20 6b 65 79 0a 20 | eam)))................(put.key.. |
| 113500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 61 73 73 65 72 74 69 6f 6e 2d 73 74 | ...................'assertion-st |
| 113520 | 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 | ream.....................(cons-s |
| 113540 | 74 72 65 61 6d 20 61 73 73 65 72 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tream.assertion................. |
| 113560 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 75 72 72 65 6e 74 2d 61 73 73 65 72 74 69 | .................current-asserti |
| 113580 | 6f 6e 2d 73 74 72 65 61 6d 29 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 | on-stream)))))).......(define.(s |
| 1135a0 | 74 6f 72 65 2d 72 75 6c 65 2d 69 6e 2d 69 6e 64 65 78 20 72 75 6c 65 29 0a 20 20 20 20 20 20 20 | tore-rule-in-index.rule)........ |
| 1135c0 | 28 6c 65 74 20 28 28 70 61 74 74 65 72 6e 20 28 63 6f 6e 63 6c 75 73 69 6f 6e 20 72 75 6c 65 29 | (let.((pattern.(conclusion.rule) |
| 1135e0 | 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 69 6e 64 65 78 61 62 6c 65 3f 20 70 61 74 74 | ))..........(if.(indexable?.patt |
| 113600 | 65 72 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6b 65 79 20 28 69 6e | ern)..............(let.((key.(in |
| 113620 | 64 65 78 2d 6b 65 79 2d 6f 66 20 70 61 74 74 65 72 6e 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | dex-key-of.pattern)))........... |
| 113640 | 20 20 20 20 20 28 6c 65 74 20 28 28 63 75 72 72 65 6e 74 2d 72 75 6c 65 2d 73 74 72 65 61 6d 0a | .....(let.((current-rule-stream. |
| 113660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 65 74 2d 73 74 72 65 61 | ......................(get-strea |
| 113680 | 6d 20 6b 65 79 20 27 72 75 6c 65 2d 73 74 72 65 61 6d 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | m.key.'rule-stream)))........... |
| 1136a0 | 20 20 20 20 20 20 20 28 70 75 74 20 6b 65 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......(put.key................. |
| 1136c0 | 20 20 20 20 20 20 27 72 75 6c 65 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......'rule-stream.............. |
| 1136e0 | 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 72 75 6c 65 0a 20 20 20 20 20 | .........(cons-stream.rule...... |
| 113700 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 75 | ..............................cu |
| 113720 | 72 72 65 6e 74 2d 72 75 6c 65 2d 73 74 72 65 61 6d 29 29 29 29 29 29 29 0a 0a 20 20 20 54 68 65 | rrent-rule-stream))))))).....The |
| 113740 | 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 64 65 66 69 6e 65 20 68 6f 77 | .following.procedures.define.how |
| 113760 | 20 74 68 65 20 64 61 74 61 2d 62 61 73 65 20 69 6e 64 65 78 20 69 73 20 75 73 65 64 2e 20 20 41 | .the.data-base.index.is.used...A |
| 113780 | 0a 70 61 74 74 65 72 6e 20 28 61 6e 20 61 73 73 65 72 74 69 6f 6e 20 6f 72 20 61 20 72 75 6c 65 | .pattern.(an.assertion.or.a.rule |
| 1137a0 | 20 63 6f 6e 63 6c 75 73 69 6f 6e 29 20 77 69 6c 6c 20 62 65 20 73 74 6f 72 65 64 20 69 6e 20 74 | .conclusion).will.be.stored.in.t |
| 1137c0 | 68 65 20 74 61 62 6c 65 0a 69 66 20 69 74 20 73 74 61 72 74 73 20 77 69 74 68 20 61 20 76 61 72 | he.table.if.it.starts.with.a.var |
| 1137e0 | 69 61 62 6c 65 20 6f 72 20 61 20 63 6f 6e 73 74 61 6e 74 20 73 79 6d 62 6f 6c 2e 0a 0a 20 20 20 | iable.or.a.constant.symbol...... |
| 113800 | 20 20 28 64 65 66 69 6e 65 20 28 69 6e 64 65 78 61 62 6c 65 3f 20 70 61 74 29 0a 20 20 20 20 20 | ..(define.(indexable?.pat)...... |
| 113820 | 20 20 28 6f 72 20 28 63 6f 6e 73 74 61 6e 74 2d 73 79 6d 62 6f 6c 3f 20 28 63 61 72 20 70 61 74 | ..(or.(constant-symbol?.(car.pat |
| 113840 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 76 61 72 3f 20 28 63 61 72 20 70 61 74 29 29 29 29 | ))............(var?.(car.pat)))) |
| 113860 | 0a 0a 20 20 20 54 68 65 20 6b 65 79 20 75 6e 64 65 72 20 77 68 69 63 68 20 61 20 70 61 74 74 65 | .....The.key.under.which.a.patte |
| 113880 | 72 6e 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 74 61 62 6c 65 20 69 73 20 65 69 74 | rn.is.stored.in.the.table.is.eit |
| 1138a0 | 68 65 72 20 60 3f 27 0a 28 69 66 20 69 74 20 73 74 61 72 74 73 20 77 69 74 68 20 61 20 76 61 72 | her.`?'.(if.it.starts.with.a.var |
| 1138c0 | 69 61 62 6c 65 29 20 6f 72 20 74 68 65 20 63 6f 6e 73 74 61 6e 74 20 73 79 6d 62 6f 6c 20 77 69 | iable).or.the.constant.symbol.wi |
| 1138e0 | 74 68 20 77 68 69 63 68 20 69 74 0a 73 74 61 72 74 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | th.which.it.starts........(defin |
| 113900 | 65 20 28 69 6e 64 65 78 2d 6b 65 79 2d 6f 66 20 70 61 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 | e.(index-key-of.pat)........(let |
| 113920 | 20 28 28 6b 65 79 20 28 63 61 72 20 70 61 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 | .((key.(car.pat)))..........(if. |
| 113940 | 28 76 61 72 3f 20 6b 65 79 29 20 27 3f 20 6b 65 79 29 29 29 0a 0a 20 20 20 54 68 65 20 69 6e 64 | (var?.key).'?.key))).....The.ind |
| 113960 | 65 78 20 77 69 6c 6c 20 62 65 20 75 73 65 64 20 74 6f 20 72 65 74 72 69 65 76 65 20 69 74 65 6d | ex.will.be.used.to.retrieve.item |
| 113980 | 73 20 74 68 61 74 20 6d 69 67 68 74 20 6d 61 74 63 68 20 61 20 70 61 74 74 65 72 6e 0a 69 66 20 | s.that.might.match.a.pattern.if. |
| 1139a0 | 74 68 65 20 70 61 74 74 65 72 6e 20 73 74 61 72 74 73 20 77 69 74 68 20 61 20 63 6f 6e 73 74 61 | the.pattern.starts.with.a.consta |
| 1139c0 | 6e 74 20 73 79 6d 62 6f 6c 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 75 73 65 2d 69 6e | nt.symbol........(define.(use-in |
| 1139e0 | 64 65 78 3f 20 70 61 74 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 74 61 6e 74 2d 73 79 6d 62 6f | dex?.pat)........(constant-symbo |
| 113a00 | 6c 3f 20 28 63 61 72 20 70 61 74 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 | l?.(car.pat))).......*Exercise.4 |
| 113a20 | 2e 37 30 3a 2a 20 57 68 61 74 20 69 73 20 74 68 65 20 70 75 72 70 6f 73 65 20 6f 66 20 74 68 65 | .70:*.What.is.the.purpose.of.the |
| 113a40 | 20 60 6c 65 74 27 20 62 69 6e 64 69 6e 67 73 20 69 6e 20 74 68 65 0a 20 20 20 20 20 70 72 6f 63 | .`let'.bindings.in.the......proc |
| 113a60 | 65 64 75 72 65 73 20 60 61 64 64 2d 61 73 73 65 72 74 69 6f 6e 21 27 20 61 6e 64 20 60 61 64 64 | edures.`add-assertion!'.and.`add |
| 113a80 | 2d 72 75 6c 65 21 27 20 3f 20 20 57 68 61 74 20 77 6f 75 6c 64 20 62 65 20 77 72 6f 6e 67 0a 20 | -rule!'.?..What.would.be.wrong.. |
| 113aa0 | 20 20 20 20 77 69 74 68 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 69 6d 70 6c 65 6d 65 6e 74 | ....with.the.following.implement |
| 113ac0 | 61 74 69 6f 6e 20 6f 66 20 60 61 64 64 2d 61 73 73 65 72 74 69 6f 6e 21 27 20 3f 20 20 48 69 6e | ation.of.`add-assertion!'.?..Hin |
| 113ae0 | 74 3a 0a 20 20 20 20 20 52 65 63 61 6c 6c 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 | t:......Recall.the.definition.of |
| 113b00 | 20 74 68 65 20 69 6e 66 69 6e 69 74 65 20 73 74 72 65 61 6d 20 6f 66 20 6f 6e 65 73 20 69 6e 20 | .the.infinite.stream.of.ones.in. |
| 113b20 | 73 65 63 74 69 6f 6e 0a 20 20 20 20 20 2a 4e 6f 74 65 20 33 2d 35 2d 32 3a 3a 3a 20 60 28 64 65 | section......*Note.3-5-2:::.`(de |
| 113b40 | 66 69 6e 65 20 6f 6e 65 73 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 31 20 6f 6e 65 73 29 29 27 | fine.ones.(cons-stream.1.ones))' |
| 113b60 | 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 64 64 2d 61 73 73 65 72 74 | .............(define.(add-assert |
| 113b80 | 69 6f 6e 21 20 61 73 73 65 72 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 6f | ion!.assertion).............(sto |
| 113ba0 | 72 65 2d 61 73 73 65 72 74 69 6f 6e 2d 69 6e 2d 69 6e 64 65 78 20 61 73 73 65 72 74 69 6f 6e 29 | re-assertion-in-index.assertion) |
| 113bc0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 54 48 45 2d 41 53 53 45 52 54 49 4f 4e | .............(set!.THE-ASSERTION |
| 113be0 | 53 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d | S...................(cons-stream |
| 113c00 | 20 61 73 73 65 72 74 69 6f 6e 20 54 48 45 2d 41 53 53 45 52 54 49 4f 4e 53 29 29 0a 20 20 20 20 | .assertion.THE-ASSERTIONS))..... |
| 113c20 | 20 20 20 20 20 20 20 20 27 6f 6b 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c | ........'ok)....File:.sicp.info, |
| 113c40 | 20 20 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d 36 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2d 34 2d 37 2c | ..Node:.4-4-4-6,..Next:.4-4-4-7, |
| 113c60 | 20 20 50 72 65 76 3a 20 34 2d 34 2d 34 2d 35 2c 20 20 55 70 3a 20 34 2d 34 2d 34 0a 0a 34 2e 34 | ..Prev:.4-4-4-5,..Up:.4-4-4..4.4 |
| 113c80 | 2e 34 2e 36 20 53 74 72 65 61 6d 20 4f 70 65 72 61 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e | .4.6.Stream.Operations.......... |
| 113ca0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 71 75 65 72 79 20 73 79 73 74 | ..................The.query.syst |
| 113cc0 | 65 6d 20 75 73 65 73 20 61 20 66 65 77 20 73 74 72 65 61 6d 20 6f 70 65 72 61 74 69 6f 6e 73 20 | em.uses.a.few.stream.operations. |
| 113ce0 | 74 68 61 74 20 77 65 72 65 20 6e 6f 74 20 70 72 65 73 65 6e 74 65 64 20 69 6e 0a 2a 4e 6f 74 65 | that.were.not.presented.in.*Note |
| 113d00 | 20 43 68 61 70 74 65 72 20 33 3a 3a 2e 0a 0a 20 20 20 60 53 74 72 65 61 6d 2d 61 70 70 65 6e 64 | .Chapter.3::......`Stream-append |
| 113d20 | 2d 64 65 6c 61 79 65 64 27 20 61 6e 64 20 60 69 6e 74 65 72 6c 65 61 76 65 2d 64 65 6c 61 79 65 | -delayed'.and.`interleave-delaye |
| 113d40 | 64 27 20 61 72 65 20 6a 75 73 74 20 6c 69 6b 65 0a 60 73 74 72 65 61 6d 2d 61 70 70 65 6e 64 27 | d'.are.just.like.`stream-append' |
| 113d60 | 20 61 6e 64 20 60 69 6e 74 65 72 6c 65 61 76 65 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | .and.`interleave'.(section.*Note |
| 113d80 | 20 33 2d 35 2d 33 3a 3a 29 2c 20 65 78 63 65 70 74 20 74 68 61 74 0a 74 68 65 79 20 74 61 6b 65 | .3-5-3::),.except.that.they.take |
| 113da0 | 20 61 20 64 65 6c 61 79 65 64 20 61 72 67 75 6d 65 6e 74 20 28 6c 69 6b 65 20 74 68 65 20 60 69 | .a.delayed.argument.(like.the.`i |
| 113dc0 | 6e 74 65 67 72 61 6c 27 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e | ntegral'.procedure.in.section.*N |
| 113de0 | 6f 74 65 20 33 2d 35 2d 34 3a 3a 29 2e 20 20 54 68 69 73 20 70 6f 73 74 70 6f 6e 65 73 20 6c 6f | ote.3-5-4::)...This.postpones.lo |
| 113e00 | 6f 70 69 6e 67 20 69 6e 20 73 6f 6d 65 20 63 61 73 65 73 20 28 73 65 65 20 2a 4e 6f 74 65 0a 45 | oping.in.some.cases.(see.*Note.E |
| 113e20 | 78 65 72 63 69 73 65 20 34 2d 37 31 3a 3a 29 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | xercise.4-71::)........(define.( |
| 113e40 | 73 74 72 65 61 6d 2d 61 70 70 65 6e 64 2d 64 65 6c 61 79 65 64 20 73 31 20 64 65 6c 61 79 65 64 | stream-append-delayed.s1.delayed |
| 113e60 | 2d 73 32 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 73 74 72 65 61 6d 2d 6e 75 6c 6c 3f 20 73 31 | -s2)........(if.(stream-null?.s1 |
| 113e80 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 66 6f 72 63 65 20 64 65 6c 61 79 65 64 2d 73 32 29 0a | )............(force.delayed-s2). |
| 113ea0 | 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 | ...........(cons-stream......... |
| 113ec0 | 20 20 20 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ....(stream-car.s1)............. |
| 113ee0 | 28 73 74 72 65 61 6d 2d 61 70 70 65 6e 64 2d 64 65 6c 61 79 65 64 20 28 73 74 72 65 61 6d 2d 63 | (stream-append-delayed.(stream-c |
| 113f00 | 64 72 20 73 31 29 20 64 65 6c 61 79 65 64 2d 73 32 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 | dr.s1).delayed-s2)))).......(def |
| 113f20 | 69 6e 65 20 28 69 6e 74 65 72 6c 65 61 76 65 2d 64 65 6c 61 79 65 64 20 73 31 20 64 65 6c 61 79 | ine.(interleave-delayed.s1.delay |
| 113f40 | 65 64 2d 73 32 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 73 74 72 65 61 6d 2d 6e 75 6c 6c 3f 20 | ed-s2)........(if.(stream-null?. |
| 113f60 | 73 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 66 6f 72 63 65 20 64 65 6c 61 79 65 64 2d 73 32 | s1)............(force.delayed-s2 |
| 113f80 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 | )............(cons-stream....... |
| 113fa0 | 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 31 29 0a 20 20 20 20 20 20 20 20 20 20 | ......(stream-car.s1)........... |
| 113fc0 | 20 20 28 69 6e 74 65 72 6c 65 61 76 65 2d 64 65 6c 61 79 65 64 20 28 66 6f 72 63 65 20 64 65 6c | ..(interleave-delayed.(force.del |
| 113fe0 | 61 79 65 64 2d 73 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ayed-s2)........................ |
| 114000 | 20 20 20 20 20 20 20 20 20 28 64 65 6c 61 79 20 28 73 74 72 65 61 6d 2d 63 64 72 20 73 31 29 29 | .........(delay.(stream-cdr.s1)) |
| 114020 | 29 29 29 29 0a 0a 20 20 20 60 53 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 27 2c 20 77 68 69 63 68 | )))).....`Stream-flatmap',.which |
| 114040 | 20 69 73 20 75 73 65 64 20 74 68 72 6f 75 67 68 6f 75 74 20 74 68 65 20 71 75 65 72 79 20 65 76 | .is.used.throughout.the.query.ev |
| 114060 | 61 6c 75 61 74 6f 72 20 74 6f 0a 6d 61 70 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 76 65 72 20 | aluator.to.map.a.procedure.over. |
| 114080 | 61 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d 65 73 20 61 6e 64 20 63 6f 6d 62 69 6e 65 20 74 | a.stream.of.frames.and.combine.t |
| 1140a0 | 68 65 20 72 65 73 75 6c 74 69 6e 67 0a 73 74 72 65 61 6d 73 20 6f 66 20 66 72 61 6d 65 73 2c 20 | he.resulting.streams.of.frames,. |
| 1140c0 | 69 73 20 74 68 65 20 73 74 72 65 61 6d 20 61 6e 61 6c 6f 67 20 6f 66 20 74 68 65 20 60 66 6c 61 | is.the.stream.analog.of.the.`fla |
| 1140e0 | 74 6d 61 70 27 20 70 72 6f 63 65 64 75 72 65 0a 69 6e 74 72 6f 64 75 63 65 64 20 66 6f 72 20 6f | tmap'.procedure.introduced.for.o |
| 114100 | 72 64 69 6e 61 72 79 20 6c 69 73 74 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 | rdinary.lists.in.section.*Note.2 |
| 114120 | 2d 32 2d 33 3a 3a 2e 20 20 55 6e 6c 69 6b 65 0a 6f 72 64 69 6e 61 72 79 20 60 66 6c 61 74 6d 61 | -2-3::...Unlike.ordinary.`flatma |
| 114140 | 70 27 2c 20 68 6f 77 65 76 65 72 2c 20 77 65 20 61 63 63 75 6d 75 6c 61 74 65 20 74 68 65 20 73 | p',.however,.we.accumulate.the.s |
| 114160 | 74 72 65 61 6d 73 20 77 69 74 68 20 61 6e 0a 69 6e 74 65 72 6c 65 61 76 69 6e 67 20 70 72 6f 63 | treams.with.an.interleaving.proc |
| 114180 | 65 73 73 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 73 69 6d 70 6c 79 20 61 70 70 65 6e 64 69 6e | ess,.rather.than.simply.appendin |
| 1141a0 | 67 20 74 68 65 6d 20 28 73 65 65 20 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 20 34 2d 37 32 3a | g.them.(see.*Note.Exercise.4-72: |
| 1141c0 | 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 37 33 3a 3a 29 2e 0a 0a 20 | :.and.*Note.Exercise.4-73::).... |
| 1141e0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 20 70 72 6f 63 | ....(define.(stream-flatmap.proc |
| 114200 | 20 73 29 0a 20 20 20 20 20 20 20 28 66 6c 61 74 74 65 6e 2d 73 74 72 65 61 6d 20 28 73 74 72 65 | .s)........(flatten-stream.(stre |
| 114220 | 61 6d 2d 6d 61 70 20 70 72 6f 63 20 73 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | am-map.proc.s))).......(define.( |
| 114240 | 66 6c 61 74 74 65 6e 2d 73 74 72 65 61 6d 20 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 28 69 | flatten-stream.stream)........(i |
| 114260 | 66 20 28 73 74 72 65 61 6d 2d 6e 75 6c 6c 3f 20 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 | f.(stream-null?.stream)......... |
| 114280 | 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 28 | ...the-empty-stream............( |
| 1142a0 | 69 6e 74 65 72 6c 65 61 76 65 2d 64 65 6c 61 79 65 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | interleave-delayed.............( |
| 1142c0 | 73 74 72 65 61 6d 2d 63 61 72 20 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | stream-car.stream).............( |
| 1142e0 | 64 65 6c 61 79 20 28 66 6c 61 74 74 65 6e 2d 73 74 72 65 61 6d 20 28 73 74 72 65 61 6d 2d 63 64 | delay.(flatten-stream.(stream-cd |
| 114300 | 72 20 73 74 72 65 61 6d 29 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 65 76 61 6c 75 61 74 6f 72 | r.stream)))))).....The.evaluator |
| 114320 | 20 61 6c 73 6f 20 75 73 65 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 69 6d 70 6c 65 20 | .also.uses.the.following.simple. |
| 114340 | 70 72 6f 63 65 64 75 72 65 20 74 6f 20 67 65 6e 65 72 61 74 65 20 61 0a 73 74 72 65 61 6d 20 63 | procedure.to.generate.a.stream.c |
| 114360 | 6f 6e 73 69 73 74 69 6e 67 20 6f 66 20 61 20 73 69 6e 67 6c 65 20 65 6c 65 6d 65 6e 74 3a 0a 0a | onsisting.of.a.single.element:.. |
| 114380 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 69 6e 67 6c 65 74 6f 6e 2d 73 74 72 65 61 6d 20 78 | .....(define.(singleton-stream.x |
| 1143a0 | 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 2d 73 74 72 65 61 6d 20 78 20 74 68 65 2d 65 6d 70 74 | )........(cons-stream.x.the-empt |
| 1143c0 | 79 2d 73 74 72 65 61 6d 29 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 | y-stream))....File:.sicp.info,.. |
| 1143e0 | 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d 37 2c 20 20 4e 65 78 74 3a 20 34 2d 34 2d 34 2d 38 2c 20 20 | Node:.4-4-4-7,..Next:.4-4-4-8,.. |
| 114400 | 50 72 65 76 3a 20 34 2d 34 2d 34 2d 36 2c 20 20 55 70 3a 20 34 2d 34 2d 34 0a 0a 34 2e 34 2e 34 | Prev:.4-4-4-6,..Up:.4-4-4..4.4.4 |
| 114420 | 2e 37 20 51 75 65 72 79 20 53 79 6e 74 61 78 20 50 72 6f 63 65 64 75 72 65 73 0a 2e 2e 2e 2e 2e | .7.Query.Syntax.Procedures...... |
| 114440 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 60 54 79 70 | ............................`Typ |
| 114460 | 65 27 20 61 6e 64 20 60 63 6f 6e 74 65 6e 74 73 27 2c 20 75 73 65 64 20 62 79 20 60 71 65 76 61 | e'.and.`contents',.used.by.`qeva |
| 114480 | 6c 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 32 3a 3a 29 2c 0a 73 70 | l'.(section.*Note.4-4-4-2::),.sp |
| 1144a0 | 65 63 69 66 79 20 74 68 61 74 20 61 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 69 73 20 69 64 65 | ecify.that.a.special.form.is.ide |
| 1144c0 | 6e 74 69 66 69 65 64 20 62 79 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 6e 20 69 74 73 20 60 63 61 | ntified.by.the.symbol.in.its.`ca |
| 1144e0 | 72 27 2e 0a 54 68 65 79 20 61 72 65 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 60 74 79 | r'..They.are.the.same.as.the.`ty |
| 114500 | 70 65 2d 74 61 67 27 20 61 6e 64 20 60 63 6f 6e 74 65 6e 74 73 27 20 70 72 6f 63 65 64 75 72 65 | pe-tag'.and.`contents'.procedure |
| 114520 | 73 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 32 2d 34 2d 32 3a 3a 2c 20 65 78 63 65 | s.in.section.*Note.2-4-2::,.exce |
| 114540 | 70 74 20 66 6f 72 20 74 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 2e 0a 0a 20 20 20 20 20 | pt.for.the.error.message........ |
| 114560 | 28 64 65 66 69 6e 65 20 28 74 79 70 65 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 70 | (define.(type.exp)........(if.(p |
| 114580 | 61 69 72 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 65 78 70 29 0a 20 | air?.exp)............(car.exp).. |
| 1145a0 | 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 65 78 70 72 65 73 | ..........(error."Unknown.expres |
| 1145c0 | 73 69 6f 6e 20 54 59 50 45 22 20 65 78 70 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | sion.TYPE".exp))).......(define. |
| 1145e0 | 28 63 6f 6e 74 65 6e 74 73 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 70 61 69 72 3f | (contents.exp)........(if.(pair? |
| 114600 | 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 64 72 20 65 78 70 29 0a 20 20 20 20 20 | .exp)............(cdr.exp)...... |
| 114620 | 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 65 78 70 72 65 73 73 69 6f 6e | ......(error."Unknown.expression |
| 114640 | 20 43 4f 4e 54 45 4e 54 53 22 20 65 78 70 29 29 29 0a 0a 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 | .CONTENTS".exp))).....The.follow |
| 114660 | 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 2c 20 75 73 65 64 20 62 79 20 60 71 75 65 72 79 2d 64 | ing.procedures,.used.by.`query-d |
| 114680 | 72 69 76 65 72 2d 6c 6f 6f 70 27 20 28 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 34 2d | river-loop'.(in.section.*Note.4- |
| 1146a0 | 34 2d 34 2d 31 3a 3a 29 2c 20 73 70 65 63 69 66 79 20 74 68 61 74 20 72 75 6c 65 73 20 61 6e 64 | 4-4-1::),.specify.that.rules.and |
| 1146c0 | 20 61 73 73 65 72 74 69 6f 6e 73 20 61 72 65 20 61 64 64 65 64 20 74 6f 20 74 68 65 0a 64 61 74 | .assertions.are.added.to.the.dat |
| 1146e0 | 61 20 62 61 73 65 20 62 79 20 65 78 70 72 65 73 73 69 6f 6e 73 20 6f 66 20 74 68 65 20 66 6f 72 | a.base.by.expressions.of.the.for |
| 114700 | 6d 20 60 28 61 73 73 65 72 74 21 20 3c 52 55 4c 45 2d 4f 52 2d 41 53 53 45 52 54 49 4f 4e 3e 29 | m.`(assert!.<RULE-OR-ASSERTION>) |
| 114720 | 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 73 73 65 72 74 69 6f 6e 2d 74 6f 2d 62 | ':.......(define.(assertion-to-b |
| 114740 | 65 2d 61 64 64 65 64 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 65 71 3f 20 28 74 79 70 65 20 | e-added?.exp)........(eq?.(type. |
| 114760 | 65 78 70 29 20 27 61 73 73 65 72 74 21 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 | exp).'assert!)).......(define.(a |
| 114780 | 64 64 2d 61 73 73 65 72 74 69 6f 6e 2d 62 6f 64 79 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 63 | dd-assertion-body.exp)........(c |
| 1147a0 | 61 72 20 28 63 6f 6e 74 65 6e 74 73 20 65 78 70 29 29 29 0a 0a 20 20 20 48 65 72 65 20 61 72 65 | ar.(contents.exp))).....Here.are |
| 1147c0 | 20 74 68 65 20 73 79 6e 74 61 78 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 | .the.syntax.definitions.for.the. |
| 1147e0 | 60 61 6e 64 27 2c 20 60 6f 72 27 2c 20 60 6e 6f 74 27 2c 20 61 6e 64 0a 60 6c 69 73 70 2d 76 61 | `and',.`or',.`not',.and.`lisp-va |
| 114800 | 6c 75 65 27 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 | lue'.special.forms.(section.*Not |
| 114820 | 65 20 34 2d 34 2d 34 2d 32 3a 3a 29 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6d 70 | e.4-4-4-2::):.......(define.(emp |
| 114840 | 74 79 2d 63 6f 6e 6a 75 6e 63 74 69 6f 6e 3f 20 65 78 70 73 29 20 28 6e 75 6c 6c 3f 20 65 78 70 | ty-conjunction?.exps).(null?.exp |
| 114860 | 73 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 72 73 74 2d 63 6f 6e 6a 75 6e 63 74 | s))......(define.(first-conjunct |
| 114880 | 20 65 78 70 73 29 20 28 63 61 72 20 65 78 70 73 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | .exps).(car.exps))......(define. |
| 1148a0 | 28 72 65 73 74 2d 63 6f 6e 6a 75 6e 63 74 73 20 65 78 70 73 29 20 28 63 64 72 20 65 78 70 73 29 | (rest-conjuncts.exps).(cdr.exps) |
| 1148c0 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6d 70 74 79 2d 64 69 73 6a 75 6e 63 74 69 | ).......(define.(empty-disjuncti |
| 1148e0 | 6f 6e 3f 20 65 78 70 73 29 20 28 6e 75 6c 6c 3f 20 65 78 70 73 29 29 0a 20 20 20 20 20 28 64 65 | on?.exps).(null?.exps))......(de |
| 114900 | 66 69 6e 65 20 28 66 69 72 73 74 2d 64 69 73 6a 75 6e 63 74 20 65 78 70 73 29 20 28 63 61 72 20 | fine.(first-disjunct.exps).(car. |
| 114920 | 65 78 70 73 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 73 74 2d 64 69 73 6a 75 6e | exps))......(define.(rest-disjun |
| 114940 | 63 74 73 20 65 78 70 73 29 20 28 63 64 72 20 65 78 70 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 | cts.exps).(cdr.exps)).......(def |
| 114960 | 69 6e 65 20 28 6e 65 67 61 74 65 64 2d 71 75 65 72 79 20 65 78 70 73 29 20 28 63 61 72 20 65 78 | ine.(negated-query.exps).(car.ex |
| 114980 | 70 73 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 65 64 69 63 61 74 65 20 65 78 | ps)).......(define.(predicate.ex |
| 1149a0 | 70 73 29 20 28 63 61 72 20 65 78 70 73 29 29 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 72 | ps).(car.exps))......(define.(ar |
| 1149c0 | 67 73 20 65 78 70 73 29 20 28 63 64 72 20 65 78 70 73 29 29 0a 0a 20 20 20 54 68 65 20 66 6f 6c | gs.exps).(cdr.exps)).....The.fol |
| 1149e0 | 6c 6f 77 69 6e 67 20 74 68 72 65 65 20 70 72 6f 63 65 64 75 72 65 73 20 64 65 66 69 6e 65 20 74 | lowing.three.procedures.define.t |
| 114a00 | 68 65 20 73 79 6e 74 61 78 20 6f 66 20 72 75 6c 65 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | he.syntax.of.rules:.......(defin |
| 114a20 | 65 20 28 72 75 6c 65 3f 20 73 74 61 74 65 6d 65 6e 74 29 0a 20 20 20 20 20 20 20 28 74 61 67 67 | e.(rule?.statement)........(tagg |
| 114a40 | 65 64 2d 6c 69 73 74 3f 20 73 74 61 74 65 6d 65 6e 74 20 27 72 75 6c 65 29 29 0a 0a 20 20 20 20 | ed-list?.statement.'rule))...... |
| 114a60 | 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 63 6c 75 73 69 6f 6e 20 72 75 6c 65 29 20 28 63 61 64 72 | .(define.(conclusion.rule).(cadr |
| 114a80 | 20 72 75 6c 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 75 6c 65 2d 62 6f 64 79 | .rule)).......(define.(rule-body |
| 114aa0 | 20 72 75 6c 65 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 63 64 64 72 20 72 | .rule)........(if.(null?.(cddr.r |
| 114ac0 | 75 6c 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 28 61 6c 77 61 79 73 2d 74 72 75 65 29 0a | ule))............'(always-true). |
| 114ae0 | 20 20 20 20 20 20 20 20 20 20 20 28 63 61 64 64 72 20 72 75 6c 65 29 29 29 0a 0a 20 20 20 60 51 | ...........(caddr.rule))).....`Q |
| 114b00 | 75 65 72 79 2d 64 72 69 76 65 72 2d 6c 6f 6f 70 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | uery-driver-loop'.(section.*Note |
| 114b20 | 20 34 2d 34 2d 34 2d 31 3a 3a 29 20 63 61 6c 6c 73 0a 60 71 75 65 72 79 2d 73 79 6e 74 61 78 2d | .4-4-4-1::).calls.`query-syntax- |
| 114b40 | 70 72 6f 63 65 73 73 27 20 74 6f 20 74 72 61 6e 73 66 6f 72 6d 20 70 61 74 74 65 72 6e 20 76 61 | process'.to.transform.pattern.va |
| 114b60 | 72 69 61 62 6c 65 73 20 69 6e 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2c 0a 77 68 69 63 68 | riables.in.the.expression,.which |
| 114b80 | 20 68 61 76 65 20 74 68 65 20 66 6f 72 6d 20 60 3f 73 79 6d 62 6f 6c 27 2c 20 69 6e 74 6f 20 74 | .have.the.form.`?symbol',.into.t |
| 114ba0 | 68 65 20 69 6e 74 65 72 6e 61 6c 20 66 6f 72 6d 61 74 20 60 28 3f 20 73 79 6d 62 6f 6c 29 27 2e | he.internal.format.`(?.symbol)'. |
| 114bc0 | 0a 54 68 61 74 20 69 73 20 74 6f 20 73 61 79 2c 20 61 20 70 61 74 74 65 72 6e 20 73 75 63 68 20 | .That.is.to.say,.a.pattern.such. |
| 114be0 | 61 73 20 60 28 6a 6f 62 20 3f 78 20 3f 79 29 27 20 69 73 20 61 63 74 75 61 6c 6c 79 20 72 65 70 | as.`(job.?x.?y)'.is.actually.rep |
| 114c00 | 72 65 73 65 6e 74 65 64 0a 69 6e 74 65 72 6e 61 6c 6c 79 20 62 79 20 74 68 65 20 73 79 73 74 65 | resented.internally.by.the.syste |
| 114c20 | 6d 20 61 73 20 60 28 6a 6f 62 20 28 3f 20 78 29 20 28 3f 20 79 29 29 27 2e 20 20 54 68 69 73 20 | m.as.`(job.(?.x).(?.y))'...This. |
| 114c40 | 69 6e 63 72 65 61 73 65 73 20 74 68 65 0a 65 66 66 69 63 69 65 6e 63 79 20 6f 66 20 71 75 65 72 | increases.the.efficiency.of.quer |
| 114c60 | 79 20 70 72 6f 63 65 73 73 69 6e 67 2c 20 73 69 6e 63 65 20 69 74 20 6d 65 61 6e 73 20 74 68 61 | y.processing,.since.it.means.tha |
| 114c80 | 74 20 74 68 65 20 73 79 73 74 65 6d 20 63 61 6e 0a 63 68 65 63 6b 20 74 6f 20 73 65 65 20 69 66 | t.the.system.can.check.to.see.if |
| 114ca0 | 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 61 20 70 61 74 74 65 72 6e 20 76 61 72 69 | .an.expression.is.a.pattern.vari |
| 114cc0 | 61 62 6c 65 20 62 79 20 63 68 65 63 6b 69 6e 67 20 77 68 65 74 68 65 72 0a 74 68 65 20 60 63 61 | able.by.checking.whether.the.`ca |
| 114ce0 | 72 27 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 74 68 65 20 73 79 6d 62 | r'.of.the.expression.is.the.symb |
| 114d00 | 6f 6c 20 60 3f 27 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 68 61 76 69 6e 67 20 74 6f 0a 65 78 | ol.`?',.rather.than.having.to.ex |
| 114d20 | 74 72 61 63 74 20 63 68 61 72 61 63 74 65 72 73 20 66 72 6f 6d 20 74 68 65 20 73 79 6d 62 6f 6c | tract.characters.from.the.symbol |
| 114d40 | 2e 20 20 54 68 65 20 73 79 6e 74 61 78 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 69 73 0a | ...The.syntax.transformation.is. |
| 114d60 | 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 | accomplished.by.the.following.pr |
| 114d80 | 6f 63 65 64 75 72 65 3a 28 31 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 71 75 65 72 79 | ocedure:(1).......(define.(query |
| 114da0 | 2d 73 79 6e 74 61 78 2d 70 72 6f 63 65 73 73 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 6d 61 70 | -syntax-process.exp)........(map |
| 114dc0 | 2d 6f 76 65 72 2d 73 79 6d 62 6f 6c 73 20 65 78 70 61 6e 64 2d 71 75 65 73 74 69 6f 6e 2d 6d 61 | -over-symbols.expand-question-ma |
| 114de0 | 72 6b 20 65 78 70 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 70 2d 6f 76 65 72 | rk.exp)).......(define.(map-over |
| 114e00 | 2d 73 79 6d 62 6f 6c 73 20 70 72 6f 63 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 | -symbols.proc.exp)........(cond. |
| 114e20 | 28 28 70 61 69 72 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 | ((pair?.exp)...............(cons |
| 114e40 | 20 28 6d 61 70 2d 6f 76 65 72 2d 73 79 6d 62 6f 6c 73 20 70 72 6f 63 20 28 63 61 72 20 65 78 70 | .(map-over-symbols.proc.(car.exp |
| 114e60 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 2d 6f 76 65 72 | )).....................(map-over |
| 114e80 | 2d 73 79 6d 62 6f 6c 73 20 70 72 6f 63 20 28 63 64 72 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 | -symbols.proc.(cdr.exp))))...... |
| 114ea0 | 20 20 20 20 20 20 20 20 28 28 73 79 6d 62 6f 6c 3f 20 65 78 70 29 20 28 70 72 6f 63 20 65 78 70 | ........((symbol?.exp).(proc.exp |
| 114ec0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 65 78 70 29 29 29 0a 0a 20 20 | ))..............(else.exp))).... |
| 114ee0 | 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 61 6e 64 2d 71 75 65 73 74 69 6f 6e 2d 6d 61 72 6b | ...(define.(expand-question-mark |
| 114f00 | 20 73 79 6d 62 6f 6c 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 68 61 72 73 20 28 73 79 | .symbol)........(let.((chars.(sy |
| 114f20 | 6d 62 6f 6c 2d 3e 73 74 72 69 6e 67 20 73 79 6d 62 6f 6c 29 29 29 0a 20 20 20 20 20 20 20 20 20 | mbol->string.symbol))).......... |
| 114f40 | 28 69 66 20 28 73 74 72 69 6e 67 3d 3f 20 28 73 75 62 73 74 72 69 6e 67 20 63 68 61 72 73 20 30 | (if.(string=?.(substring.chars.0 |
| 114f60 | 20 31 29 20 22 3f 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 3f 0a 20 | .1)."?")..............(list.'?.. |
| 114f80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f | ..................(string->symbo |
| 114fa0 | 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 75 62 73 74 72 69 6e 67 | l.....................(substring |
| 114fc0 | 20 63 68 61 72 73 20 31 20 28 73 74 72 69 6e 67 2d 6c 65 6e 67 74 68 20 63 68 61 72 73 29 29 29 | .chars.1.(string-length.chars))) |
| 114fe0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 73 79 6d 62 6f 6c 29 29 29 0a 0a 20 20 20 4f 6e 63 | )..............symbol))).....Onc |
| 115000 | 65 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 | e.the.variables.are.transformed. |
| 115020 | 69 6e 20 74 68 69 73 20 77 61 79 2c 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 69 6e 20 61 0a | in.this.way,.the.variables.in.a. |
| 115040 | 70 61 74 74 65 72 6e 20 61 72 65 20 6c 69 73 74 73 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 | pattern.are.lists.starting.with. |
| 115060 | 60 3f 27 2c 20 61 6e 64 20 74 68 65 20 63 6f 6e 73 74 61 6e 74 20 73 79 6d 62 6f 6c 73 20 28 77 | `?',.and.the.constant.symbols.(w |
| 115080 | 68 69 63 68 0a 6e 65 65 64 20 74 6f 20 62 65 20 72 65 63 6f 67 6e 69 7a 65 64 20 66 6f 72 20 64 | hich.need.to.be.recognized.for.d |
| 1150a0 | 61 74 61 2d 62 61 73 65 20 69 6e 64 65 78 69 6e 67 2c 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | ata-base.indexing,.section.*Note |
| 1150c0 | 20 34 2d 34 2d 34 2d 35 3a 3a 29 0a 61 72 65 20 6a 75 73 74 20 74 68 65 20 73 79 6d 62 6f 6c 73 | .4-4-4-5::).are.just.the.symbols |
| 1150e0 | 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 76 61 72 3f 20 65 78 70 29 0a 20 20 20 20 20 | ........(define.(var?.exp)...... |
| 115100 | 20 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 65 78 70 20 27 3f 29 29 0a 0a 20 20 20 20 20 28 | ..(tagged-list?.exp.'?)).......( |
| 115120 | 64 65 66 69 6e 65 20 28 63 6f 6e 73 74 61 6e 74 2d 73 79 6d 62 6f 6c 3f 20 65 78 70 29 20 28 73 | define.(constant-symbol?.exp).(s |
| 115140 | 79 6d 62 6f 6c 3f 20 65 78 70 29 29 0a 0a 20 20 20 55 6e 69 71 75 65 20 76 61 72 69 61 62 6c 65 | ymbol?.exp)).....Unique.variable |
| 115160 | 73 20 61 72 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 64 75 72 69 6e 67 20 72 75 6c 65 20 61 70 | s.are.constructed.during.rule.ap |
| 115180 | 70 6c 69 63 61 74 69 6f 6e 20 28 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 34 2d 34 2d | plication.(in.section.*Note.4-4- |
| 1151a0 | 34 2d 34 3a 3a 29 20 62 79 20 6d 65 61 6e 73 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 | 4-4::).by.means.of.the.following |
| 1151c0 | 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 54 68 65 20 75 6e 69 71 75 65 0a 69 64 65 6e 74 69 66 | .procedures...The.unique.identif |
| 1151e0 | 69 65 72 20 66 6f 72 20 61 20 72 75 6c 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 69 73 20 61 20 | ier.for.a.rule.application.is.a. |
| 115200 | 6e 75 6d 62 65 72 2c 20 77 68 69 63 68 20 69 73 20 69 6e 63 72 65 6d 65 6e 74 65 64 0a 65 61 63 | number,.which.is.incremented.eac |
| 115220 | 68 20 74 69 6d 65 20 61 20 72 75 6c 65 20 69 73 20 61 70 70 6c 69 65 64 2e 0a 0a 20 20 20 20 20 | h.time.a.rule.is.applied........ |
| 115240 | 28 64 65 66 69 6e 65 20 72 75 6c 65 2d 63 6f 75 6e 74 65 72 20 30 29 0a 0a 20 20 20 20 20 28 64 | (define.rule-counter.0).......(d |
| 115260 | 65 66 69 6e 65 20 28 6e 65 77 2d 72 75 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 2d 69 64 29 0a | efine.(new-rule-application-id). |
| 115280 | 20 20 20 20 20 20 20 28 73 65 74 21 20 72 75 6c 65 2d 63 6f 75 6e 74 65 72 20 28 2b 20 31 20 72 | .......(set!.rule-counter.(+.1.r |
| 1152a0 | 75 6c 65 2d 63 6f 75 6e 74 65 72 29 29 0a 20 20 20 20 20 20 20 72 75 6c 65 2d 63 6f 75 6e 74 65 | ule-counter))........rule-counte |
| 1152c0 | 72 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 6e 65 77 2d 76 61 72 69 61 | r).......(define.(make-new-varia |
| 1152e0 | 62 6c 65 20 76 61 72 20 72 75 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 2d 69 64 29 0a 20 20 20 | ble.var.rule-application-id).... |
| 115300 | 20 20 20 20 28 63 6f 6e 73 20 27 3f 20 28 63 6f 6e 73 20 72 75 6c 65 2d 61 70 70 6c 69 63 61 74 | ....(cons.'?.(cons.rule-applicat |
| 115320 | 69 6f 6e 2d 69 64 20 28 63 64 72 20 76 61 72 29 29 29 29 0a 0a 20 20 20 57 68 65 6e 20 60 71 75 | ion-id.(cdr.var)))).....When.`qu |
| 115340 | 65 72 79 2d 64 72 69 76 65 72 2d 6c 6f 6f 70 27 20 69 6e 73 74 61 6e 74 69 61 74 65 73 20 74 68 | ery-driver-loop'.instantiates.th |
| 115360 | 65 20 71 75 65 72 79 20 74 6f 20 70 72 69 6e 74 20 74 68 65 20 61 6e 73 77 65 72 2c 0a 69 74 20 | e.query.to.print.the.answer,.it. |
| 115380 | 63 6f 6e 76 65 72 74 73 20 61 6e 79 20 75 6e 62 6f 75 6e 64 20 70 61 74 74 65 72 6e 20 76 61 72 | converts.any.unbound.pattern.var |
| 1153a0 | 69 61 62 6c 65 73 20 62 61 63 6b 20 74 6f 20 74 68 65 20 72 69 67 68 74 20 66 6f 72 6d 20 66 6f | iables.back.to.the.right.form.fo |
| 1153c0 | 72 0a 70 72 69 6e 74 69 6e 67 2c 20 75 73 69 6e 67 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | r.printing,.using.......(define. |
| 1153e0 | 28 63 6f 6e 74 72 61 63 74 2d 71 75 65 73 74 69 6f 6e 2d 6d 61 72 6b 20 76 61 72 69 61 62 6c 65 | (contract-question-mark.variable |
| 115400 | 29 0a 20 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 0a 20 20 20 20 20 20 20 | )........(string->symbol........ |
| 115420 | 20 28 73 74 72 69 6e 67 2d 61 70 70 65 6e 64 20 22 3f 22 0a 20 20 20 20 20 20 20 20 20 20 28 69 | .(string-append."?"...........(i |
| 115440 | 66 20 28 6e 75 6d 62 65 72 3f 20 28 63 61 64 72 20 76 61 72 69 61 62 6c 65 29 29 0a 20 20 20 20 | f.(number?.(cadr.variable))..... |
| 115460 | 20 20 20 20 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 61 70 70 65 6e 64 20 28 73 79 6d 62 6f 6c | ..........(string-append.(symbol |
| 115480 | 2d 3e 73 74 72 69 6e 67 20 28 63 61 64 64 72 20 76 61 72 69 61 62 6c 65 29 29 0a 20 20 20 20 20 | ->string.(caddr.variable))...... |
| 1154a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 22 2d 22 0a 20 20 20 20 | ........................"-"..... |
| 1154c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 75 6d 62 65 72 | .........................(number |
| 1154e0 | 2d 3e 73 74 72 69 6e 67 20 28 63 61 64 72 20 76 61 72 69 61 62 6c 65 29 29 29 0a 20 20 20 20 20 | ->string.(cadr.variable)))...... |
| 115500 | 20 20 20 20 20 20 20 20 20 28 73 79 6d 62 6f 6c 2d 3e 73 74 72 69 6e 67 20 28 63 61 64 72 20 76 | .........(symbol->string.(cadr.v |
| 115520 | 61 72 69 61 62 6c 65 29 29 29 29 29 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f | ariable)))))).....----------.Foo |
| 115540 | 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 4d 6f 73 74 20 4c | tnotes.----------.....(1).Most.L |
| 115560 | 69 73 70 20 73 79 73 74 65 6d 73 20 67 69 76 65 20 74 68 65 20 75 73 65 72 20 74 68 65 20 61 62 | isp.systems.give.the.user.the.ab |
| 115580 | 69 6c 69 74 79 20 74 6f 20 6d 6f 64 69 66 79 20 74 68 65 0a 6f 72 64 69 6e 61 72 79 20 60 72 65 | ility.to.modify.the.ordinary.`re |
| 1155a0 | 61 64 27 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 70 65 72 66 6f 72 6d 20 73 75 63 68 20 74 72 | ad'.procedure.to.perform.such.tr |
| 1155c0 | 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 73 20 62 79 20 64 65 66 69 6e 69 6e 67 20 22 72 65 61 64 65 | ansformations.by.defining."reade |
| 1155e0 | 72 0a 6d 61 63 72 6f 20 63 68 61 72 61 63 74 65 72 73 22 2e 20 20 51 75 6f 74 65 64 20 65 78 70 | r.macro.characters"...Quoted.exp |
| 115600 | 72 65 73 73 69 6f 6e 73 20 61 72 65 20 61 6c 72 65 61 64 79 20 68 61 6e 64 6c 65 64 20 69 6e 20 | ressions.are.already.handled.in. |
| 115620 | 74 68 69 73 20 77 61 79 3a 0a 54 68 65 20 72 65 61 64 65 72 20 61 75 74 6f 6d 61 74 69 63 61 6c | this.way:.The.reader.automatical |
| 115640 | 6c 79 20 74 72 61 6e 73 6c 61 74 65 73 20 60 27 65 78 70 72 65 73 73 69 6f 6e 27 20 69 6e 74 6f | ly.translates.`'expression'.into |
| 115660 | 20 60 28 71 75 6f 74 65 0a 65 78 70 72 65 73 73 69 6f 6e 29 27 20 62 65 66 6f 72 65 20 74 68 65 | .`(quote.expression)'.before.the |
| 115680 | 20 65 76 61 6c 75 61 74 6f 72 20 73 65 65 73 20 69 74 2e 20 20 57 65 20 63 6f 75 6c 64 20 61 72 | .evaluator.sees.it...We.could.ar |
| 1156a0 | 72 61 6e 67 65 20 66 6f 72 0a 60 3f 65 78 70 72 65 73 73 69 6f 6e 27 20 74 6f 20 62 65 20 74 72 | range.for.`?expression'.to.be.tr |
| 1156c0 | 61 6e 73 66 6f 72 6d 65 64 20 69 6e 74 6f 20 60 28 3f 20 65 78 70 72 65 73 73 69 6f 6e 29 27 20 | ansformed.into.`(?.expression)'. |
| 1156e0 | 69 6e 20 74 68 65 20 73 61 6d 65 20 77 61 79 3b 0a 68 6f 77 65 76 65 72 2c 20 66 6f 72 20 74 68 | in.the.same.way;.however,.for.th |
| 115700 | 65 20 73 61 6b 65 20 6f 66 20 63 6c 61 72 69 74 79 20 77 65 20 68 61 76 65 20 69 6e 63 6c 75 64 | e.sake.of.clarity.we.have.includ |
| 115720 | 65 64 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 20 | ed.the.transformation.procedure. |
| 115740 | 68 65 72 65 20 65 78 70 6c 69 63 69 74 6c 79 2e 0a 0a 20 20 20 60 45 78 70 61 6e 64 2d 71 75 65 | here.explicitly......`Expand-que |
| 115760 | 73 74 69 6f 6e 2d 6d 61 72 6b 27 20 61 6e 64 20 60 63 6f 6e 74 72 61 63 74 2d 71 75 65 73 74 69 | stion-mark'.and.`contract-questi |
| 115780 | 6f 6e 2d 6d 61 72 6b 27 20 75 73 65 20 73 65 76 65 72 61 6c 0a 70 72 6f 63 65 64 75 72 65 73 20 | on-mark'.use.several.procedures. |
| 1157a0 | 77 69 74 68 20 60 73 74 72 69 6e 67 27 20 69 6e 20 74 68 65 69 72 20 6e 61 6d 65 73 2e 20 20 54 | with.`string'.in.their.names...T |
| 1157c0 | 68 65 73 65 20 61 72 65 20 53 63 68 65 6d 65 20 70 72 69 6d 69 74 69 76 65 73 2e 0a 0a 1f 0a 46 | hese.are.Scheme.primitives.....F |
| 1157e0 | 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d 38 2c 20 | ile:.sicp.info,..Node:.4-4-4-8,. |
| 115800 | 20 50 72 65 76 3a 20 34 2d 34 2d 34 2d 37 2c 20 20 55 70 3a 20 34 2d 34 2d 34 0a 0a 34 2e 34 2e | .Prev:.4-4-4-7,..Up:.4-4-4..4.4. |
| 115820 | 34 2e 38 20 46 72 61 6d 65 73 20 61 6e 64 20 42 69 6e 64 69 6e 67 73 0a 2e 2e 2e 2e 2e 2e 2e 2e | 4.8.Frames.and.Bindings......... |
| 115840 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 46 72 61 6d 65 73 20 61 72 65 20 | .....................Frames.are. |
| 115860 | 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 6c 69 73 74 73 20 6f 66 20 62 69 6e 64 69 6e 67 73 | represented.as.lists.of.bindings |
| 115880 | 2c 20 77 68 69 63 68 20 61 72 65 20 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 0a 70 61 69 72 73 | ,.which.are.variable-value.pairs |
| 1158a0 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 62 69 6e 64 69 6e 67 20 76 61 | :.......(define.(make-binding.va |
| 1158c0 | 72 69 61 62 6c 65 20 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 20 76 61 72 69 61 | riable.value)........(cons.varia |
| 1158e0 | 62 6c 65 20 76 61 6c 75 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 62 69 6e 64 69 | ble.value)).......(define.(bindi |
| 115900 | 6e 67 2d 76 61 72 69 61 62 6c 65 20 62 69 6e 64 69 6e 67 29 0a 20 20 20 20 20 20 20 28 63 61 72 | ng-variable.binding)........(car |
| 115920 | 20 62 69 6e 64 69 6e 67 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 62 69 6e 64 69 6e | .binding)).......(define.(bindin |
| 115940 | 67 2d 76 61 6c 75 65 20 62 69 6e 64 69 6e 67 29 0a 20 20 20 20 20 20 20 28 63 64 72 20 62 69 6e | g-value.binding)........(cdr.bin |
| 115960 | 64 69 6e 67 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 62 69 6e 64 69 6e 67 2d 69 6e | ding)).......(define.(binding-in |
| 115980 | 2d 66 72 61 6d 65 20 76 61 72 69 61 62 6c 65 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 28 61 | -frame.variable.frame)........(a |
| 1159a0 | 73 73 6f 63 20 76 61 72 69 61 62 6c 65 20 66 72 61 6d 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 | ssoc.variable.frame)).......(def |
| 1159c0 | 69 6e 65 20 28 65 78 74 65 6e 64 20 76 61 72 69 61 62 6c 65 20 76 61 6c 75 65 20 66 72 61 6d 65 | ine.(extend.variable.value.frame |
| 1159e0 | 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 6d 61 6b 65 2d 62 69 6e 64 69 6e 67 20 76 61 72 | )........(cons.(make-binding.var |
| 115a00 | 69 61 62 6c 65 20 76 61 6c 75 65 29 20 66 72 61 6d 65 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 | iable.value).frame)).......*Exer |
| 115a20 | 63 69 73 65 20 34 2e 37 31 3a 2a 20 4c 6f 75 69 73 20 52 65 61 73 6f 6e 65 72 20 77 6f 6e 64 65 | cise.4.71:*.Louis.Reasoner.wonde |
| 115a40 | 72 73 20 77 68 79 20 74 68 65 20 60 73 69 6d 70 6c 65 2d 71 75 65 72 79 27 20 61 6e 64 0a 20 20 | rs.why.the.`simple-query'.and... |
| 115a60 | 20 20 20 60 64 69 73 6a 6f 69 6e 27 20 70 72 6f 63 65 64 75 72 65 73 20 28 73 65 63 74 69 6f 6e | ...`disjoin'.procedures.(section |
| 115a80 | 20 2a 4e 6f 74 65 20 34 2d 34 2d 34 2d 32 3a 3a 29 20 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 | .*Note.4-4-4-2::).are.implemente |
| 115aa0 | 64 0a 20 20 20 20 20 75 73 69 6e 67 20 65 78 70 6c 69 63 69 74 20 60 64 65 6c 61 79 27 20 6f 70 | d......using.explicit.`delay'.op |
| 115ac0 | 65 72 61 74 69 6f 6e 73 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 62 65 69 6e 67 20 64 65 66 69 | erations,.rather.than.being.defi |
| 115ae0 | 6e 65 64 20 61 73 0a 20 20 20 20 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 | ned.as......follows:............ |
| 115b00 | 28 64 65 66 69 6e 65 20 28 73 69 6d 70 6c 65 2d 71 75 65 72 79 20 71 75 65 72 79 2d 70 61 74 74 | (define.(simple-query.query-patt |
| 115b20 | 65 72 6e 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 | ern.frame-stream).............(s |
| 115b40 | 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 | tream-flatmap..............(lamb |
| 115b60 | 64 61 20 28 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 | da.(frame)................(strea |
| 115b80 | 6d 2d 61 70 70 65 6e 64 20 28 66 69 6e 64 2d 61 73 73 65 72 74 69 6f 6e 73 20 71 75 65 72 79 2d | m-append.(find-assertions.query- |
| 115ba0 | 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | pattern.frame).................. |
| 115bc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 6c 79 2d 72 75 6c 65 73 20 71 75 65 72 79 2d | .............(apply-rules.query- |
| 115be0 | 70 61 74 74 65 72 6e 20 66 72 61 6d 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 66 72 | pattern.frame)))..............fr |
| 115c00 | 61 6d 65 2d 73 74 72 65 61 6d 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ame-stream))............(define. |
| 115c20 | 28 64 69 73 6a 6f 69 6e 20 64 69 73 6a 75 6e 63 74 73 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 | (disjoin.disjuncts.frame-stream) |
| 115c40 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 6d 70 74 79 2d 64 69 73 6a 75 6e 63 74 | .............(if.(empty-disjunct |
| 115c60 | 69 6f 6e 3f 20 64 69 73 6a 75 6e 63 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ion?.disjuncts)................. |
| 115c80 | 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | the-empty-stream................ |
| 115ca0 | 20 28 69 6e 74 65 72 6c 65 61 76 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 71 | .(interleave..................(q |
| 115cc0 | 65 76 61 6c 20 28 66 69 72 73 74 2d 64 69 73 6a 75 6e 63 74 20 64 69 73 6a 75 6e 63 74 73 29 20 | eval.(first-disjunct.disjuncts). |
| 115ce0 | 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | frame-stream)..................( |
| 115d00 | 64 69 73 6a 6f 69 6e 20 28 72 65 73 74 2d 64 69 73 6a 75 6e 63 74 73 20 64 69 73 6a 75 6e 63 74 | disjoin.(rest-disjuncts.disjunct |
| 115d20 | 73 29 20 66 72 61 6d 65 2d 73 74 72 65 61 6d 29 29 29 29 0a 0a 20 20 20 20 20 43 61 6e 20 79 6f | s).frame-stream)))).......Can.yo |
| 115d40 | 75 20 67 69 76 65 20 65 78 61 6d 70 6c 65 73 20 6f 66 20 71 75 65 72 69 65 73 20 77 68 65 72 65 | u.give.examples.of.queries.where |
| 115d60 | 20 74 68 65 73 65 20 73 69 6d 70 6c 65 72 20 64 65 66 69 6e 69 74 69 6f 6e 73 0a 20 20 20 20 20 | .these.simpler.definitions...... |
| 115d80 | 77 6f 75 6c 64 20 6c 65 61 64 20 74 6f 20 75 6e 64 65 73 69 72 61 62 6c 65 20 62 65 68 61 76 69 | would.lead.to.undesirable.behavi |
| 115da0 | 6f 72 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 37 32 3a 2a 20 57 68 79 20 64 | or?.......*Exercise.4.72:*.Why.d |
| 115dc0 | 6f 20 60 64 69 73 6a 6f 69 6e 27 20 61 6e 64 20 60 73 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 27 | o.`disjoin'.and.`stream-flatmap' |
| 115de0 | 20 69 6e 74 65 72 6c 65 61 76 65 0a 20 20 20 20 20 74 68 65 20 73 74 72 65 61 6d 73 20 72 61 74 | .interleave......the.streams.rat |
| 115e00 | 68 65 72 20 74 68 61 6e 20 73 69 6d 70 6c 79 20 61 70 70 65 6e 64 20 74 68 65 6d 3f 20 20 47 69 | her.than.simply.append.them?..Gi |
| 115e20 | 76 65 20 65 78 61 6d 70 6c 65 73 20 74 68 61 74 0a 20 20 20 20 20 69 6c 6c 75 73 74 72 61 74 65 | ve.examples.that......illustrate |
| 115e40 | 20 77 68 79 20 69 6e 74 65 72 6c 65 61 76 69 6e 67 20 77 6f 72 6b 73 20 62 65 74 74 65 72 2e 20 | .why.interleaving.works.better.. |
| 115e60 | 20 28 48 69 6e 74 3a 20 57 68 79 20 64 69 64 20 77 65 20 75 73 65 0a 20 20 20 20 20 60 69 6e 74 | .(Hint:.Why.did.we.use......`int |
| 115e80 | 65 72 6c 65 61 76 65 27 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 35 2d 33 3a | erleave'.in.section.*Note.3-5-3: |
| 115ea0 | 3a 3f 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 37 33 3a 2a 20 57 68 79 20 64 | :?).......*Exercise.4.73:*.Why.d |
| 115ec0 | 6f 65 73 20 60 66 6c 61 74 74 65 6e 2d 73 74 72 65 61 6d 27 20 75 73 65 20 60 64 65 6c 61 79 27 | oes.`flatten-stream'.use.`delay' |
| 115ee0 | 20 65 78 70 6c 69 63 69 74 6c 79 3f 0a 20 20 20 20 20 57 68 61 74 20 77 6f 75 6c 64 20 62 65 20 | .explicitly?......What.would.be. |
| 115f00 | 77 72 6f 6e 67 20 77 69 74 68 20 64 65 66 69 6e 69 6e 67 20 69 74 20 61 73 20 66 6f 6c 6c 6f 77 | wrong.with.defining.it.as.follow |
| 115f20 | 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 6c 61 74 74 65 6e 2d 73 | s:............(define.(flatten-s |
| 115f40 | 74 72 65 61 6d 20 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 73 | tream.stream).............(if.(s |
| 115f60 | 74 72 65 61 6d 2d 6e 75 6c 6c 3f 20 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | tream-null?.stream)............. |
| 115f80 | 20 20 20 20 74 68 65 2d 65 6d 70 74 79 2d 73 74 72 65 61 6d 0a 20 20 20 20 20 20 20 20 20 20 20 | ....the-empty-stream............ |
| 115fa0 | 20 20 20 20 20 28 69 6e 74 65 72 6c 65 61 76 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....(interleave................ |
| 115fc0 | 20 20 28 73 74 72 65 61 6d 2d 63 61 72 20 73 74 72 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 | ..(stream-car.stream)........... |
| 115fe0 | 20 20 20 20 20 20 20 28 66 6c 61 74 74 65 6e 2d 73 74 72 65 61 6d 20 28 73 74 72 65 61 6d 2d 63 | .......(flatten-stream.(stream-c |
| 116000 | 64 72 20 73 74 72 65 61 6d 29 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 | dr.stream))))).......*Exercise.4 |
| 116020 | 2e 37 34 3a 2a 20 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 20 70 72 6f 70 6f 73 65 73 20 | .74:*.Alyssa.P..Hacker.proposes. |
| 116040 | 74 6f 20 75 73 65 20 61 20 73 69 6d 70 6c 65 72 0a 20 20 20 20 20 76 65 72 73 69 6f 6e 20 6f 66 | to.use.a.simpler......version.of |
| 116060 | 20 60 73 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 27 20 69 6e 20 60 6e 65 67 61 74 65 27 2c 20 60 | .`stream-flatmap'.in.`negate',.` |
| 116080 | 6c 69 73 70 2d 76 61 6c 75 65 27 2c 20 61 6e 64 0a 20 20 20 20 20 60 66 69 6e 64 2d 61 73 73 65 | lisp-value',.and......`find-asse |
| 1160a0 | 72 74 69 6f 6e 73 27 2e 20 20 53 68 65 20 6f 62 73 65 72 76 65 73 20 74 68 61 74 20 74 68 65 20 | rtions'...She.observes.that.the. |
| 1160c0 | 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 69 73 20 6d 61 70 70 65 64 0a 20 20 20 20 20 6f 76 | procedure.that.is.mapped......ov |
| 1160e0 | 65 72 20 74 68 65 20 66 72 61 6d 65 20 73 74 72 65 61 6d 20 69 6e 20 74 68 65 73 65 20 63 61 73 | er.the.frame.stream.in.these.cas |
| 116100 | 65 73 20 61 6c 77 61 79 73 20 70 72 6f 64 75 63 65 73 20 65 69 74 68 65 72 20 74 68 65 0a 20 20 | es.always.produces.either.the... |
| 116120 | 20 20 20 65 6d 70 74 79 20 73 74 72 65 61 6d 20 6f 72 20 61 20 73 69 6e 67 6c 65 74 6f 6e 20 73 | ...empty.stream.or.a.singleton.s |
| 116140 | 74 72 65 61 6d 2c 20 73 6f 20 6e 6f 20 69 6e 74 65 72 6c 65 61 76 69 6e 67 20 69 73 20 6e 65 65 | tream,.so.no.interleaving.is.nee |
| 116160 | 64 65 64 0a 20 20 20 20 20 77 68 65 6e 20 63 6f 6d 62 69 6e 69 6e 67 20 74 68 65 73 65 20 73 74 | ded......when.combining.these.st |
| 116180 | 72 65 61 6d 73 2e 0a 0a 20 20 20 20 20 20 20 61 2e 20 46 69 6c 6c 20 69 6e 20 74 68 65 20 6d 69 | reams..........a..Fill.in.the.mi |
| 1161a0 | 73 73 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 41 6c 79 73 73 61 27 73 20 70 72 | ssing.expressions.in.Alyssa's.pr |
| 1161c0 | 6f 67 72 61 6d 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | ogram..................(define.( |
| 1161e0 | 73 69 6d 70 6c 65 2d 73 74 72 65 61 6d 2d 66 6c 61 74 6d 61 70 20 70 72 6f 63 20 73 29 0a 20 20 | simple-stream-flatmap.proc.s)... |
| 116200 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 69 6d 70 6c 65 2d 66 6c 61 74 74 65 6e 20 28 | ...............(simple-flatten.( |
| 116220 | 73 74 72 65 61 6d 2d 6d 61 70 20 70 72 6f 63 20 73 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 | stream-map.proc.s)))............ |
| 116240 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 69 6d 70 6c 65 2d 66 6c 61 74 74 65 6e 20 73 74 72 | .....(define.(simple-flatten.str |
| 116260 | 65 61 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 72 65 61 6d 2d 6d 61 | eam)..................(stream-ma |
| 116280 | 70 20 3c 3f 3f 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | p.<??>.......................... |
| 1162a0 | 20 20 20 20 28 73 74 72 65 61 6d 2d 66 69 6c 74 65 72 20 3c 3f 3f 3e 20 73 74 72 65 61 6d 29 29 | ....(stream-filter.<??>.stream)) |
| 1162c0 | 29 0a 0a 20 20 20 20 20 20 20 62 2e 20 44 6f 65 73 20 74 68 65 20 71 75 65 72 79 20 73 79 73 74 | ).........b..Does.the.query.syst |
| 1162e0 | 65 6d 27 73 20 62 65 68 61 76 69 6f 72 20 63 68 61 6e 67 65 20 69 66 20 77 65 20 63 68 61 6e 67 | em's.behavior.change.if.we.chang |
| 116300 | 65 20 69 74 20 69 6e 0a 20 20 20 20 20 20 20 20 20 20 74 68 69 73 20 77 61 79 3f 0a 0a 0a 20 20 | e.it.in...........this.way?..... |
| 116320 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 37 35 3a 2a 20 49 6d 70 6c 65 6d 65 6e 74 20 66 6f | ...*Exercise.4.75:*.Implement.fo |
| 116340 | 72 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 20 61 20 6e 65 77 20 73 70 65 63 69 | r.the.query.language.a.new.speci |
| 116360 | 61 6c 0a 20 20 20 20 20 66 6f 72 6d 20 63 61 6c 6c 65 64 20 60 75 6e 69 71 75 65 27 2e 20 20 60 | al......form.called.`unique'...` |
| 116380 | 55 6e 69 71 75 65 27 20 73 68 6f 75 6c 64 20 73 75 63 63 65 65 64 20 69 66 20 74 68 65 72 65 20 | Unique'.should.succeed.if.there. |
| 1163a0 | 69 73 0a 20 20 20 20 20 70 72 65 63 69 73 65 6c 79 20 6f 6e 65 20 69 74 65 6d 20 69 6e 20 74 68 | is......precisely.one.item.in.th |
| 1163c0 | 65 20 64 61 74 61 20 62 61 73 65 20 73 61 74 69 73 66 79 69 6e 67 20 61 20 73 70 65 63 69 66 69 | e.data.base.satisfying.a.specifi |
| 1163e0 | 65 64 20 71 75 65 72 79 2e 0a 20 20 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 | ed.query.......For.example,..... |
| 116400 | 20 20 20 20 20 20 20 28 75 6e 69 71 75 65 20 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 74 65 72 | .......(unique.(job.?x.(computer |
| 116420 | 20 77 69 7a 61 72 64 29 29 29 0a 0a 20 20 20 20 20 73 68 6f 75 6c 64 20 70 72 69 6e 74 20 74 68 | .wizard))).......should.print.th |
| 116440 | 65 20 6f 6e 65 2d 69 74 65 6d 20 73 74 72 65 61 6d 0a 0a 20 20 20 20 20 20 20 20 20 20 28 75 6e | e.one-item.stream............(un |
| 116460 | 69 71 75 65 20 28 6a 6f 62 20 28 42 69 74 64 69 64 64 6c 65 20 42 65 6e 29 20 28 63 6f 6d 70 75 | ique.(job.(Bitdiddle.Ben).(compu |
| 116480 | 74 65 72 20 77 69 7a 61 72 64 29 29 29 0a 0a 20 20 20 20 20 73 69 6e 63 65 20 42 65 6e 20 69 73 | ter.wizard))).......since.Ben.is |
| 1164a0 | 20 74 68 65 20 6f 6e 6c 79 20 63 6f 6d 70 75 74 65 72 20 77 69 7a 61 72 64 2c 20 61 6e 64 0a 0a | .the.only.computer.wizard,.and.. |
| 1164c0 | 20 20 20 20 20 20 20 20 20 20 28 75 6e 69 71 75 65 20 28 6a 6f 62 20 3f 78 20 28 63 6f 6d 70 75 | ..........(unique.(job.?x.(compu |
| 1164e0 | 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 29 29 29 0a 0a 20 20 20 20 20 73 68 6f 75 6c 64 20 70 | ter.programmer))).......should.p |
| 116500 | 72 69 6e 74 20 74 68 65 20 65 6d 70 74 79 20 73 74 72 65 61 6d 2c 20 73 69 6e 63 65 20 74 68 65 | rint.the.empty.stream,.since.the |
| 116520 | 72 65 20 69 73 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 0a 20 20 20 20 20 63 6f 6d 70 75 74 65 | re.is.more.than.one......compute |
| 116540 | 72 20 70 72 6f 67 72 61 6d 6d 65 72 2e 20 20 4d 6f 72 65 6f 76 65 72 2c 0a 0a 20 20 20 20 20 20 | r.programmer...Moreover,........ |
| 116560 | 20 20 20 20 28 61 6e 64 20 28 6a 6f 62 20 3f 78 20 3f 6a 29 20 28 75 6e 69 71 75 65 20 28 6a 6f | ....(and.(job.?x.?j).(unique.(jo |
| 116580 | 62 20 3f 61 6e 79 6f 6e 65 20 3f 6a 29 29 29 0a 0a 20 20 20 20 20 73 68 6f 75 6c 64 20 6c 69 73 | b.?anyone.?j))).......should.lis |
| 1165a0 | 74 20 61 6c 6c 20 74 68 65 20 6a 6f 62 73 20 74 68 61 74 20 61 72 65 20 66 69 6c 6c 65 64 20 62 | t.all.the.jobs.that.are.filled.b |
| 1165c0 | 79 20 6f 6e 6c 79 20 6f 6e 65 20 70 65 72 73 6f 6e 2c 20 61 6e 64 0a 20 20 20 20 20 74 68 65 20 | y.only.one.person,.and......the. |
| 1165e0 | 70 65 6f 70 6c 65 20 77 68 6f 20 66 69 6c 6c 20 74 68 65 6d 2e 0a 0a 20 20 20 20 20 54 68 65 72 | people.who.fill.them........Ther |
| 116600 | 65 20 61 72 65 20 74 77 6f 20 70 61 72 74 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 | e.are.two.parts.to.implementing. |
| 116620 | 60 75 6e 69 71 75 65 27 2e 20 20 54 68 65 20 66 69 72 73 74 20 69 73 20 74 6f 0a 20 20 20 20 20 | `unique'...The.first.is.to...... |
| 116640 | 77 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 68 61 6e 64 6c 65 73 20 74 | write.a.procedure.that.handles.t |
| 116660 | 68 69 73 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 2c 20 61 6e 64 20 74 68 65 20 73 65 63 6f 6e 64 | his.special.form,.and.the.second |
| 116680 | 0a 20 20 20 20 20 69 73 20 74 6f 20 6d 61 6b 65 20 60 71 65 76 61 6c 27 20 64 69 73 70 61 74 63 | ......is.to.make.`qeval'.dispatc |
| 1166a0 | 68 20 74 6f 20 74 68 61 74 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 65 20 73 65 63 6f 6e 64 | h.to.that.procedure...The.second |
| 1166c0 | 20 70 61 72 74 20 69 73 0a 20 20 20 20 20 74 72 69 76 69 61 6c 2c 20 73 69 6e 63 65 20 60 71 65 | .part.is......trivial,.since.`qe |
| 1166e0 | 76 61 6c 27 20 64 6f 65 73 20 69 74 73 20 64 69 73 70 61 74 63 68 69 6e 67 20 69 6e 20 61 20 64 | val'.does.its.dispatching.in.a.d |
| 116700 | 61 74 61 2d 64 69 72 65 63 74 65 64 0a 20 20 20 20 20 77 61 79 2e 20 20 49 66 20 79 6f 75 72 20 | ata-directed......way...If.your. |
| 116720 | 70 72 6f 63 65 64 75 72 65 20 69 73 20 63 61 6c 6c 65 64 20 60 75 6e 69 71 75 65 6c 79 2d 61 73 | procedure.is.called.`uniquely-as |
| 116740 | 73 65 72 74 65 64 27 2c 20 61 6c 6c 20 79 6f 75 0a 20 20 20 20 20 6e 65 65 64 20 74 6f 20 64 6f | serted',.all.you......need.to.do |
| 116760 | 20 69 73 0a 0a 20 20 20 20 20 20 20 20 20 20 28 70 75 74 20 27 75 6e 69 71 75 65 20 27 71 65 76 | .is............(put.'unique.'qev |
| 116780 | 61 6c 20 75 6e 69 71 75 65 6c 79 2d 61 73 73 65 72 74 65 64 29 0a 0a 20 20 20 20 20 61 6e 64 20 | al.uniquely-asserted).......and. |
| 1167a0 | 60 71 65 76 61 6c 27 20 77 69 6c 6c 20 64 69 73 70 61 74 63 68 20 74 6f 20 74 68 69 73 20 70 72 | `qeval'.will.dispatch.to.this.pr |
| 1167c0 | 6f 63 65 64 75 72 65 20 66 6f 72 20 65 76 65 72 79 20 71 75 65 72 79 20 77 68 6f 73 65 0a 20 20 | ocedure.for.every.query.whose... |
| 1167e0 | 20 20 20 60 74 79 70 65 27 20 28 60 63 61 72 27 29 20 69 73 20 74 68 65 20 73 79 6d 62 6f 6c 20 | ...`type'.(`car').is.the.symbol. |
| 116800 | 60 75 6e 69 71 75 65 27 2e 0a 0a 20 20 20 20 20 54 68 65 20 72 65 61 6c 20 70 72 6f 62 6c 65 6d | `unique'........The.real.problem |
| 116820 | 20 69 73 20 74 6f 20 77 72 69 74 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 75 6e 69 71 | .is.to.write.the.procedure.`uniq |
| 116840 | 75 65 6c 79 2d 61 73 73 65 72 74 65 64 27 2e 0a 20 20 20 20 20 54 68 69 73 20 73 68 6f 75 6c 64 | uely-asserted'.......This.should |
| 116860 | 20 74 61 6b 65 20 61 73 20 69 6e 70 75 74 20 74 68 65 20 60 63 6f 6e 74 65 6e 74 73 27 20 28 60 | .take.as.input.the.`contents'.(` |
| 116880 | 63 64 72 27 29 20 6f 66 20 74 68 65 20 60 75 6e 69 71 75 65 27 0a 20 20 20 20 20 71 75 65 72 79 | cdr').of.the.`unique'......query |
| 1168a0 | 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 61 20 73 74 72 65 61 6d 20 6f 66 20 66 72 61 6d | ,.together.with.a.stream.of.fram |
| 1168c0 | 65 73 2e 20 20 46 6f 72 20 65 61 63 68 20 66 72 61 6d 65 20 69 6e 20 74 68 65 0a 20 20 20 20 20 | es...For.each.frame.in.the...... |
| 1168e0 | 73 74 72 65 61 6d 2c 20 69 74 20 73 68 6f 75 6c 64 20 75 73 65 20 60 71 65 76 61 6c 27 20 74 6f | stream,.it.should.use.`qeval'.to |
| 116900 | 20 66 69 6e 64 20 74 68 65 20 73 74 72 65 61 6d 20 6f 66 20 61 6c 6c 20 65 78 74 65 6e 73 69 6f | .find.the.stream.of.all.extensio |
| 116920 | 6e 73 0a 20 20 20 20 20 74 6f 20 74 68 65 20 66 72 61 6d 65 20 74 68 61 74 20 73 61 74 69 73 66 | ns......to.the.frame.that.satisf |
| 116940 | 79 20 74 68 65 20 67 69 76 65 6e 20 71 75 65 72 79 2e 20 20 41 6e 79 20 73 74 72 65 61 6d 20 74 | y.the.given.query...Any.stream.t |
| 116960 | 68 61 74 20 64 6f 65 73 0a 20 20 20 20 20 6e 6f 74 20 68 61 76 65 20 65 78 61 63 74 6c 79 20 6f | hat.does......not.have.exactly.o |
| 116980 | 6e 65 20 69 74 65 6d 20 69 6e 20 69 74 20 73 68 6f 75 6c 64 20 62 65 20 65 6c 69 6d 69 6e 61 74 | ne.item.in.it.should.be.eliminat |
| 1169a0 | 65 64 2e 20 20 54 68 65 0a 20 20 20 20 20 72 65 6d 61 69 6e 69 6e 67 20 73 74 72 65 61 6d 73 20 | ed...The......remaining.streams. |
| 1169c0 | 73 68 6f 75 6c 64 20 62 65 20 70 61 73 73 65 64 20 62 61 63 6b 20 74 6f 20 62 65 20 61 63 63 75 | should.be.passed.back.to.be.accu |
| 1169e0 | 6d 75 6c 61 74 65 64 20 69 6e 74 6f 20 6f 6e 65 0a 20 20 20 20 20 62 69 67 20 73 74 72 65 61 6d | mulated.into.one......big.stream |
| 116a00 | 20 74 68 61 74 20 69 73 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 74 68 65 20 60 75 6e 69 71 | .that.is.the.result.of.the.`uniq |
| 116a20 | 75 65 27 20 71 75 65 72 79 2e 20 20 54 68 69 73 20 69 73 0a 20 20 20 20 20 73 69 6d 69 6c 61 72 | ue'.query...This.is......similar |
| 116a40 | 20 74 6f 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 60 6e | .to.the.implementation.of.the.`n |
| 116a60 | 6f 74 27 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 2e 0a 0a 20 20 20 20 20 54 65 73 74 20 79 6f 75 | ot'.special.form........Test.you |
| 116a80 | 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 62 79 20 66 6f 72 6d 69 6e 67 20 61 20 71 75 | r.implementation.by.forming.a.qu |
| 116aa0 | 65 72 79 20 74 68 61 74 20 6c 69 73 74 73 20 61 6c 6c 20 70 65 6f 70 6c 65 0a 20 20 20 20 20 77 | ery.that.lists.all.people......w |
| 116ac0 | 68 6f 20 73 75 70 65 72 76 69 73 65 20 70 72 65 63 69 73 65 6c 79 20 6f 6e 65 20 70 65 72 73 6f | ho.supervise.precisely.one.perso |
| 116ae0 | 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 37 36 3a 2a 20 4f 75 72 20 69 6d | n........*Exercise.4.76:*.Our.im |
| 116b00 | 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 60 61 6e 64 27 20 61 73 20 61 20 73 65 72 69 65 | plementation.of.`and'.as.a.serie |
| 116b20 | 73 0a 20 20 20 20 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 71 75 65 72 69 65 73 20 28 2a | s......combination.of.queries.(* |
| 116b40 | 4e 6f 74 65 20 46 69 67 75 72 65 20 34 2d 35 3a 3a 29 20 69 73 20 65 6c 65 67 61 6e 74 2c 20 62 | Note.Figure.4-5::).is.elegant,.b |
| 116b60 | 75 74 20 69 74 20 69 73 0a 20 20 20 20 20 69 6e 65 66 66 69 63 69 65 6e 74 20 62 65 63 61 75 73 | ut.it.is......inefficient.becaus |
| 116b80 | 65 20 69 6e 20 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20 73 65 63 6f 6e 64 20 71 75 65 72 79 | e.in.processing.the.second.query |
| 116ba0 | 20 6f 66 20 74 68 65 20 60 61 6e 64 27 20 77 65 0a 20 20 20 20 20 6d 75 73 74 20 73 63 61 6e 20 | .of.the.`and'.we......must.scan. |
| 116bc0 | 74 68 65 20 64 61 74 61 20 62 61 73 65 20 66 6f 72 20 65 61 63 68 20 66 72 61 6d 65 20 70 72 6f | the.data.base.for.each.frame.pro |
| 116be0 | 64 75 63 65 64 20 62 79 20 74 68 65 20 66 69 72 73 74 0a 20 20 20 20 20 71 75 65 72 79 2e 20 20 | duced.by.the.first......query... |
| 116c00 | 49 66 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 68 61 73 20 6e 20 65 6c 65 6d 65 6e 74 73 2c | If.the.data.base.has.n.elements, |
| 116c20 | 20 61 6e 64 20 61 20 74 79 70 69 63 61 6c 20 71 75 65 72 79 0a 20 20 20 20 20 70 72 6f 64 75 63 | .and.a.typical.query......produc |
| 116c40 | 65 73 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 6f 75 74 70 75 74 20 66 72 61 6d 65 73 20 70 72 6f | es.a.number.of.output.frames.pro |
| 116c60 | 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 6e 20 28 73 61 79 20 6e 2f 6b 29 2c 0a 20 20 20 20 20 74 | portional.to.n.(say.n/k),......t |
| 116c80 | 68 65 6e 20 73 63 61 6e 6e 69 6e 67 20 74 68 65 20 64 61 74 61 20 62 61 73 65 20 66 6f 72 20 65 | hen.scanning.the.data.base.for.e |
| 116ca0 | 61 63 68 20 66 72 61 6d 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 74 68 65 20 66 69 72 73 74 0a | ach.frame.produced.by.the.first. |
| 116cc0 | 20 20 20 20 20 71 75 65 72 79 20 77 69 6c 6c 20 72 65 71 75 69 72 65 20 6e 5e 32 2f 6b 20 63 61 | .....query.will.require.n^2/k.ca |
| 116ce0 | 6c 6c 73 20 74 6f 20 74 68 65 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 65 72 2e 20 20 41 6e 6f | lls.to.the.pattern.matcher...Ano |
| 116d00 | 74 68 65 72 0a 20 20 20 20 20 61 70 70 72 6f 61 63 68 20 77 6f 75 6c 64 20 62 65 20 74 6f 20 70 | ther......approach.would.be.to.p |
| 116d20 | 72 6f 63 65 73 73 20 74 68 65 20 74 77 6f 20 63 6c 61 75 73 65 73 20 6f 66 20 74 68 65 20 60 61 | rocess.the.two.clauses.of.the.`a |
| 116d40 | 6e 64 27 0a 20 20 20 20 20 73 65 70 61 72 61 74 65 6c 79 2c 20 74 68 65 6e 20 6c 6f 6f 6b 20 66 | nd'......separately,.then.look.f |
| 116d60 | 6f 72 20 61 6c 6c 20 70 61 69 72 73 20 6f 66 20 6f 75 74 70 75 74 20 66 72 61 6d 65 73 20 74 68 | or.all.pairs.of.output.frames.th |
| 116d80 | 61 74 20 61 72 65 0a 20 20 20 20 20 63 6f 6d 70 61 74 69 62 6c 65 2e 20 20 49 66 20 65 61 63 68 | at.are......compatible...If.each |
| 116da0 | 20 71 75 65 72 79 20 70 72 6f 64 75 63 65 73 20 6e 2f 6b 20 6f 75 74 70 75 74 20 66 72 61 6d 65 | .query.produces.n/k.output.frame |
| 116dc0 | 73 2c 20 74 68 65 6e 20 74 68 69 73 0a 20 20 20 20 20 6d 65 61 6e 73 20 74 68 61 74 20 77 65 20 | s,.then.this......means.that.we. |
| 116de0 | 6d 75 73 74 20 70 65 72 66 6f 72 6d 20 6e 5e 32 2f 6b 5e 32 20 63 6f 6d 70 61 74 69 62 69 6c 69 | must.perform.n^2/k^2.compatibili |
| 116e00 | 74 79 20 63 68 65 63 6b 73 2d 2d 61 20 66 61 63 74 6f 72 0a 20 20 20 20 20 6f 66 20 6b 20 66 65 | ty.checks--a.factor......of.k.fe |
| 116e20 | 77 65 72 20 74 68 61 6e 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 6d 61 74 63 68 65 73 20 72 | wer.than.the.number.of.matches.r |
| 116e40 | 65 71 75 69 72 65 64 20 69 6e 20 6f 75 72 20 63 75 72 72 65 6e 74 0a 20 20 20 20 20 6d 65 74 68 | equired.in.our.current......meth |
| 116e60 | 6f 64 2e 0a 0a 20 20 20 20 20 44 65 76 69 73 65 20 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 | od........Devise.an.implementati |
| 116e80 | 6f 6e 20 6f 66 20 60 61 6e 64 27 20 74 68 61 74 20 75 73 65 73 20 74 68 69 73 20 73 74 72 61 74 | on.of.`and'.that.uses.this.strat |
| 116ea0 | 65 67 79 2e 20 20 59 6f 75 0a 20 20 20 20 20 6d 75 73 74 20 69 6d 70 6c 65 6d 65 6e 74 20 61 20 | egy...You......must.implement.a. |
| 116ec0 | 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 20 74 77 6f 20 66 72 61 6d 65 73 20 | procedure.that.takes.two.frames. |
| 116ee0 | 61 73 20 69 6e 70 75 74 73 2c 20 63 68 65 63 6b 73 0a 20 20 20 20 20 77 68 65 74 68 65 72 20 74 | as.inputs,.checks......whether.t |
| 116f00 | 68 65 20 62 69 6e 64 69 6e 67 73 20 69 6e 20 74 68 65 20 66 72 61 6d 65 73 20 61 72 65 20 63 6f | he.bindings.in.the.frames.are.co |
| 116f20 | 6d 70 61 74 69 62 6c 65 2c 20 61 6e 64 2c 20 69 66 20 73 6f 2c 0a 20 20 20 20 20 70 72 6f 64 75 | mpatible,.and,.if.so,......produ |
| 116f40 | 63 65 73 20 61 20 66 72 61 6d 65 20 74 68 61 74 20 6d 65 72 67 65 73 20 74 68 65 20 74 77 6f 20 | ces.a.frame.that.merges.the.two. |
| 116f60 | 73 65 74 73 20 6f 66 20 62 69 6e 64 69 6e 67 73 2e 20 20 54 68 69 73 0a 20 20 20 20 20 6f 70 65 | sets.of.bindings...This......ope |
| 116f80 | 72 61 74 69 6f 6e 20 69 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 75 6e 69 66 69 63 61 74 69 6f 6e | ration.is.similar.to.unification |
| 116fa0 | 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 37 37 3a 2a 20 49 6e 20 73 65 63 74 | ........*Exercise.4.77:*.In.sect |
| 116fc0 | 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 34 2d 33 3a 3a 20 77 65 20 73 61 77 20 74 68 61 74 20 60 6e | ion.*Note.4-4-3::.we.saw.that.`n |
| 116fe0 | 6f 74 27 20 61 6e 64 0a 20 20 20 20 20 60 6c 69 73 70 2d 76 61 6c 75 65 27 20 63 61 6e 20 63 61 | ot'.and......`lisp-value'.can.ca |
| 117000 | 75 73 65 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 20 74 6f 20 67 69 76 65 20 22 | use.the.query.language.to.give." |
| 117020 | 77 72 6f 6e 67 22 20 61 6e 73 77 65 72 73 0a 20 20 20 20 20 69 66 20 74 68 65 73 65 20 66 69 6c | wrong".answers......if.these.fil |
| 117040 | 74 65 72 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 72 65 20 61 70 70 6c 69 65 64 20 74 6f | tering.operations.are.applied.to |
| 117060 | 20 66 72 61 6d 65 73 20 69 6e 20 77 68 69 63 68 0a 20 20 20 20 20 76 61 72 69 61 62 6c 65 73 20 | .frames.in.which......variables. |
| 117080 | 61 72 65 20 75 6e 62 6f 75 6e 64 2e 20 20 44 65 76 69 73 65 20 61 20 77 61 79 20 74 6f 20 66 69 | are.unbound...Devise.a.way.to.fi |
| 1170a0 | 78 20 74 68 69 73 20 73 68 6f 72 74 63 6f 6d 69 6e 67 2e 20 20 4f 6e 65 0a 20 20 20 20 20 69 64 | x.this.shortcoming...One......id |
| 1170c0 | 65 61 20 69 73 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 20 66 69 6c 74 65 72 69 6e 67 20 69 | ea.is.to.perform.the.filtering.i |
| 1170e0 | 6e 20 61 20 22 64 65 6c 61 79 65 64 22 20 6d 61 6e 6e 65 72 20 62 79 0a 20 20 20 20 20 61 70 70 | n.a."delayed".manner.by......app |
| 117100 | 65 6e 64 69 6e 67 20 74 6f 20 74 68 65 20 66 72 61 6d 65 20 61 20 22 70 72 6f 6d 69 73 65 22 20 | ending.to.the.frame.a."promise". |
| 117120 | 74 6f 20 66 69 6c 74 65 72 20 74 68 61 74 20 69 73 20 66 75 6c 66 69 6c 6c 65 64 0a 20 20 20 20 | to.filter.that.is.fulfilled..... |
| 117140 | 20 6f 6e 6c 79 20 77 68 65 6e 20 65 6e 6f 75 67 68 20 76 61 72 69 61 62 6c 65 73 20 68 61 76 65 | .only.when.enough.variables.have |
| 117160 | 20 62 65 65 6e 20 62 6f 75 6e 64 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 6f 70 65 72 61 74 69 6f | .been.bound.to.make.the.operatio |
| 117180 | 6e 0a 20 20 20 20 20 70 6f 73 73 69 62 6c 65 2e 20 20 57 65 20 63 6f 75 6c 64 20 77 61 69 74 20 | n......possible...We.could.wait. |
| 1171a0 | 74 6f 20 70 65 72 66 6f 72 6d 20 66 69 6c 74 65 72 69 6e 67 20 75 6e 74 69 6c 20 61 6c 6c 20 6f | to.perform.filtering.until.all.o |
| 1171c0 | 74 68 65 72 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 20 68 61 76 65 20 62 65 65 6e 20 70 | ther......operations.have.been.p |
| 1171e0 | 65 72 66 6f 72 6d 65 64 2e 20 20 48 6f 77 65 76 65 72 2c 20 66 6f 72 20 65 66 66 69 63 69 65 6e | erformed...However,.for.efficien |
| 117200 | 63 79 27 73 20 73 61 6b 65 2c 20 77 65 0a 20 20 20 20 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 6f | cy's.sake,.we......would.like.to |
| 117220 | 20 70 65 72 66 6f 72 6d 20 66 69 6c 74 65 72 69 6e 67 20 61 73 20 73 6f 6f 6e 20 61 73 20 70 6f | .perform.filtering.as.soon.as.po |
| 117240 | 73 73 69 62 6c 65 20 73 6f 20 61 73 20 74 6f 20 63 75 74 0a 20 20 20 20 20 64 6f 77 6e 20 6f 6e | ssible.so.as.to.cut......down.on |
| 117260 | 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20 66 72 61 6d | .the.number.of.intermediate.fram |
| 117280 | 65 73 20 67 65 6e 65 72 61 74 65 64 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e | es.generated........*Exercise.4. |
| 1172a0 | 37 38 3a 2a 20 52 65 64 65 73 69 67 6e 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 | 78:*.Redesign.the.query.language |
| 1172c0 | 20 61 73 20 61 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 0a 20 20 20 20 20 70 72 6f 67 | .as.a.nondeterministic......prog |
| 1172e0 | 72 61 6d 20 74 6f 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 75 73 69 6e 67 20 74 68 65 20 | ram.to.be.implemented.using.the. |
| 117300 | 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 | evaluator.of.section.*Note...... |
| 117320 | 34 2d 33 3a 3a 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 73 20 61 20 73 74 72 65 61 6d 20 70 | 4-3::,.rather.than.as.a.stream.p |
| 117340 | 72 6f 63 65 73 73 2e 20 20 49 6e 20 74 68 69 73 20 61 70 70 72 6f 61 63 68 2c 20 65 61 63 68 0a | rocess...In.this.approach,.each. |
| 117360 | 20 20 20 20 20 71 75 65 72 79 20 77 69 6c 6c 20 70 72 6f 64 75 63 65 20 61 20 73 69 6e 67 6c 65 | .....query.will.produce.a.single |
| 117380 | 20 61 6e 73 77 65 72 20 28 72 61 74 68 65 72 20 74 68 61 6e 20 74 68 65 20 73 74 72 65 61 6d 20 | .answer.(rather.than.the.stream. |
| 1173a0 | 6f 66 20 61 6c 6c 0a 20 20 20 20 20 61 6e 73 77 65 72 73 29 20 61 6e 64 20 74 68 65 20 75 73 65 | of.all......answers).and.the.use |
| 1173c0 | 72 20 63 61 6e 20 74 79 70 65 20 60 74 72 79 2d 61 67 61 69 6e 27 20 74 6f 20 73 65 65 20 6d 6f | r.can.type.`try-again'.to.see.mo |
| 1173e0 | 72 65 20 61 6e 73 77 65 72 73 2e 0a 20 20 20 20 20 59 6f 75 20 73 68 6f 75 6c 64 20 66 69 6e 64 | re.answers.......You.should.find |
| 117400 | 20 74 68 61 74 20 6d 75 63 68 20 6f 66 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d 20 77 65 20 62 | .that.much.of.the.mechanism.we.b |
| 117420 | 75 69 6c 74 20 69 6e 20 74 68 69 73 0a 20 20 20 20 20 73 65 63 74 69 6f 6e 20 69 73 20 73 75 62 | uilt.in.this......section.is.sub |
| 117440 | 73 75 6d 65 64 20 62 79 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 73 65 61 72 63 68 | sumed.by.nondeterministic.search |
| 117460 | 20 61 6e 64 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 2e 0a 20 20 20 20 20 59 6f 75 20 77 69 6c 6c | .and.backtracking.......You.will |
| 117480 | 20 70 72 6f 62 61 62 6c 79 20 61 6c 73 6f 20 66 69 6e 64 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 | .probably.also.find,.however,.th |
| 1174a0 | 61 74 20 79 6f 75 72 20 6e 65 77 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 0a 20 20 20 20 20 | at.your.new.query.language...... |
| 1174c0 | 68 61 73 20 73 75 62 74 6c 65 20 64 69 66 66 65 72 65 6e 63 65 73 20 69 6e 20 62 65 68 61 76 69 | has.subtle.differences.in.behavi |
| 1174e0 | 6f 72 20 66 72 6f 6d 20 74 68 65 20 6f 6e 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 68 65 72 65 | or.from.the.one.implemented.here |
| 117500 | 2e 0a 20 20 20 20 20 43 61 6e 20 79 6f 75 20 66 69 6e 64 20 65 78 61 6d 70 6c 65 73 20 74 68 61 | .......Can.you.find.examples.tha |
| 117520 | 74 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 69 73 20 64 69 66 66 65 72 65 6e 63 65 3f 0a 0a 20 | t.illustrate.this.difference?... |
| 117540 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 34 2e 37 39 3a 2a 20 57 68 65 6e 20 77 65 20 69 6d 70 | ....*Exercise.4.79:*.When.we.imp |
| 117560 | 6c 65 6d 65 6e 74 65 64 20 74 68 65 20 4c 69 73 70 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 73 | lemented.the.Lisp.evaluator.in.s |
| 117580 | 65 63 74 69 6f 6e 0a 20 20 20 20 20 2a 4e 6f 74 65 20 34 2d 31 3a 3a 2c 20 77 65 20 73 61 77 20 | ection......*Note.4-1::,.we.saw. |
| 1175a0 | 68 6f 77 20 74 6f 20 75 73 65 20 6c 6f 63 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 74 6f | how.to.use.local.environments.to |
| 1175c0 | 20 61 76 6f 69 64 20 6e 61 6d 65 0a 20 20 20 20 20 63 6f 6e 66 6c 69 63 74 73 20 62 65 74 77 65 | .avoid.name......conflicts.betwe |
| 1175e0 | 65 6e 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 2e | en.the.parameters.of.procedures. |
| 117600 | 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 6e 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6e | ..For.example,.in......evaluatin |
| 117620 | 67 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 75 61 72 65 20 78 29 0a | g............(define.(square.x). |
| 117640 | 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 78 20 78 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 | ............(*.x.x))............ |
| 117660 | 28 64 65 66 69 6e 65 20 28 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 20 78 20 79 29 0a 20 20 20 | (define.(sum-of-squares.x.y).... |
| 117680 | 20 20 20 20 20 20 20 20 20 28 2b 20 28 73 71 75 61 72 65 20 78 29 20 28 73 71 75 61 72 65 20 79 | .........(+.(square.x).(square.y |
| 1176a0 | 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 20 33 | )))............(sum-of-squares.3 |
| 1176c0 | 20 34 29 0a 0a 20 20 20 20 20 74 68 65 72 65 20 69 73 20 6e 6f 20 63 6f 6e 66 75 73 69 6f 6e 20 | .4).......there.is.no.confusion. |
| 1176e0 | 62 65 74 77 65 65 6e 20 74 68 65 20 60 78 27 20 69 6e 20 60 73 71 75 61 72 65 27 20 61 6e 64 20 | between.the.`x'.in.`square'.and. |
| 117700 | 74 68 65 20 60 78 27 20 69 6e 0a 20 20 20 20 20 60 73 75 6d 2d 6f 66 2d 73 71 75 61 72 65 73 27 | the.`x'.in......`sum-of-squares' |
| 117720 | 2c 20 62 65 63 61 75 73 65 20 77 65 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 62 6f 64 79 20 6f | ,.because.we.evaluate.the.body.o |
| 117740 | 66 20 65 61 63 68 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 69 6e 20 61 6e 20 65 6e 76 69 | f.each.procedure......in.an.envi |
| 117760 | 72 6f 6e 6d 65 6e 74 20 74 68 61 74 20 69 73 20 73 70 65 63 69 61 6c 6c 79 20 63 6f 6e 73 74 72 | ronment.that.is.specially.constr |
| 117780 | 75 63 74 65 64 20 74 6f 20 63 6f 6e 74 61 69 6e 0a 20 20 20 20 20 62 69 6e 64 69 6e 67 73 20 66 | ucted.to.contain......bindings.f |
| 1177a0 | 6f 72 20 74 68 65 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 2e 20 20 49 6e 20 74 68 65 20 | or.the.local.variables...In.the. |
| 1177c0 | 71 75 65 72 79 20 73 79 73 74 65 6d 2c 20 77 65 20 75 73 65 64 20 61 0a 20 20 20 20 20 64 69 66 | query.system,.we.used.a......dif |
| 1177e0 | 66 65 72 65 6e 74 20 73 74 72 61 74 65 67 79 20 74 6f 20 61 76 6f 69 64 20 6e 61 6d 65 20 63 6f | ferent.strategy.to.avoid.name.co |
| 117800 | 6e 66 6c 69 63 74 73 20 69 6e 20 61 70 70 6c 79 69 6e 67 20 72 75 6c 65 73 2e 0a 20 20 20 20 20 | nflicts.in.applying.rules....... |
| 117820 | 45 61 63 68 20 74 69 6d 65 20 77 65 20 61 70 70 6c 79 20 61 20 72 75 6c 65 20 77 65 20 72 65 6e | Each.time.we.apply.a.rule.we.ren |
| 117840 | 61 6d 65 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 77 69 74 68 20 6e 65 77 20 6e 61 6d 65 73 | ame.the.variables.with.new.names |
| 117860 | 0a 20 20 20 20 20 74 68 61 74 20 61 72 65 20 67 75 61 72 61 6e 74 65 65 64 20 74 6f 20 62 65 20 | ......that.are.guaranteed.to.be. |
| 117880 | 75 6e 69 71 75 65 2e 20 20 54 68 65 20 61 6e 61 6c 6f 67 6f 75 73 20 73 74 72 61 74 65 67 79 20 | unique...The.analogous.strategy. |
| 1178a0 | 66 6f 72 20 74 68 65 0a 20 20 20 20 20 4c 69 73 70 20 65 76 61 6c 75 61 74 6f 72 20 77 6f 75 6c | for.the......Lisp.evaluator.woul |
| 1178c0 | 64 20 62 65 20 74 6f 20 64 6f 20 61 77 61 79 20 77 69 74 68 20 6c 6f 63 61 6c 20 65 6e 76 69 72 | d.be.to.do.away.with.local.envir |
| 1178e0 | 6f 6e 6d 65 6e 74 73 20 61 6e 64 0a 20 20 20 20 20 73 69 6d 70 6c 79 20 72 65 6e 61 6d 65 20 74 | onments.and......simply.rename.t |
| 117900 | 68 65 20 76 61 72 69 61 62 6c 65 73 20 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 20 61 20 70 72 | he.variables.in.the.body.of.a.pr |
| 117920 | 6f 63 65 64 75 72 65 20 65 61 63 68 20 74 69 6d 65 0a 20 20 20 20 20 77 65 20 61 70 70 6c 79 20 | ocedure.each.time......we.apply. |
| 117940 | 74 68 65 20 70 72 6f 63 65 64 75 72 65 2e 0a 0a 20 20 20 20 20 49 6d 70 6c 65 6d 65 6e 74 20 66 | the.procedure........Implement.f |
| 117960 | 6f 72 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 20 61 20 72 75 6c 65 2d 61 70 70 | or.the.query.language.a.rule-app |
| 117980 | 6c 69 63 61 74 69 6f 6e 20 6d 65 74 68 6f 64 20 74 68 61 74 0a 20 20 20 20 20 75 73 65 73 20 65 | lication.method.that......uses.e |
| 1179a0 | 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 72 61 74 68 65 72 20 74 68 61 6e 20 72 65 6e 61 6d 69 6e 67 | nvironments.rather.than.renaming |
| 1179c0 | 2e 20 20 53 65 65 20 69 66 20 79 6f 75 20 63 61 6e 20 62 75 69 6c 64 20 6f 6e 0a 20 20 20 20 20 | ...See.if.you.can.build.on...... |
| 1179e0 | 79 6f 75 72 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 20 74 6f 20 63 72 | your.environment.structure.to.cr |
| 117a00 | 65 61 74 65 20 63 6f 6e 73 74 72 75 63 74 73 20 69 6e 20 74 68 65 20 71 75 65 72 79 0a 20 20 20 | eate.constructs.in.the.query.... |
| 117a20 | 20 20 6c 61 6e 67 75 61 67 65 20 66 6f 72 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 6c 61 72 67 | ..language.for.dealing.with.larg |
| 117a40 | 65 20 73 79 73 74 65 6d 73 2c 20 73 75 63 68 20 61 73 20 74 68 65 20 72 75 6c 65 20 61 6e 61 6c | e.systems,.such.as.the.rule.anal |
| 117a60 | 6f 67 0a 20 20 20 20 20 6f 66 20 62 6c 6f 63 6b 2d 73 74 72 75 63 74 75 72 65 64 20 70 72 6f 63 | og......of.block-structured.proc |
| 117a80 | 65 64 75 72 65 73 2e 20 20 43 61 6e 20 79 6f 75 20 72 65 6c 61 74 65 20 61 6e 79 20 6f 66 20 74 | edures...Can.you.relate.any.of.t |
| 117aa0 | 68 69 73 20 74 6f 20 74 68 65 0a 20 20 20 20 20 70 72 6f 62 6c 65 6d 20 6f 66 20 6d 61 6b 69 6e | his.to.the......problem.of.makin |
| 117ac0 | 67 20 64 65 64 75 63 74 69 6f 6e 73 20 69 6e 20 61 20 63 6f 6e 74 65 78 74 20 28 65 2e 67 2e 2c | g.deductions.in.a.context.(e.g., |
| 117ae0 | 20 22 49 66 20 49 20 73 75 70 70 6f 73 65 64 0a 20 20 20 20 20 74 68 61 74 20 50 20 77 65 72 65 | ."If.I.supposed......that.P.were |
| 117b00 | 20 74 72 75 65 2c 20 74 68 65 6e 20 49 20 77 6f 75 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 64 | .true,.then.I.would.be.able.to.d |
| 117b20 | 65 64 75 63 65 20 41 20 61 6e 64 20 42 2e 22 29 20 61 73 20 61 0a 20 20 20 20 20 6d 65 74 68 6f | educe.A.and.B.").as.a......metho |
| 117b40 | 64 20 6f 66 20 70 72 6f 62 6c 65 6d 20 73 6f 6c 76 69 6e 67 3f 20 20 28 54 68 69 73 20 70 72 6f | d.of.problem.solving?..(This.pro |
| 117b60 | 62 6c 65 6d 20 69 73 20 6f 70 65 6e 2d 65 6e 64 65 64 2e 20 20 41 20 67 6f 6f 64 0a 20 20 20 20 | blem.is.open-ended...A.good..... |
| 117b80 | 20 61 6e 73 77 65 72 20 69 73 20 70 72 6f 62 61 62 6c 79 20 77 6f 72 74 68 20 61 20 50 68 2e 44 | .answer.is.probably.worth.a.Ph.D |
| 117ba0 | 2e 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 43 68 | .)....File:.sicp.info,..Node:.Ch |
| 117bc0 | 61 70 74 65 72 20 35 2c 20 20 4e 65 78 74 3a 20 52 65 66 65 72 65 6e 63 65 73 2c 20 20 50 72 65 | apter.5,..Next:.References,..Pre |
| 117be0 | 76 3a 20 43 68 61 70 74 65 72 20 34 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 35 20 43 6f 6d 70 75 74 | v:.Chapter.4,..Up:.Top..5.Comput |
| 117c00 | 69 6e 67 20 77 69 74 68 20 52 65 67 69 73 74 65 72 20 4d 61 63 68 69 6e 65 73 0a 2a 2a 2a 2a 2a | ing.with.Register.Machines.***** |
| 117c20 | 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 0a 20 | *****************************... |
| 117c40 | 20 20 20 20 4d 79 20 61 69 6d 20 69 73 20 74 6f 20 73 68 6f 77 20 74 68 61 74 20 74 68 65 20 68 | ....My.aim.is.to.show.that.the.h |
| 117c60 | 65 61 76 65 6e 6c 79 20 6d 61 63 68 69 6e 65 20 69 73 20 6e 6f 74 20 61 20 6b 69 6e 64 20 6f 66 | eavenly.machine.is.not.a.kind.of |
| 117c80 | 0a 20 20 20 20 20 64 69 76 69 6e 65 2c 20 6c 69 76 65 20 62 65 69 6e 67 2c 20 62 75 74 20 61 20 | ......divine,.live.being,.but.a. |
| 117ca0 | 6b 69 6e 64 20 6f 66 20 63 6c 6f 63 6b 77 6f 72 6b 20 28 61 6e 64 20 68 65 20 77 68 6f 20 62 65 | kind.of.clockwork.(and.he.who.be |
| 117cc0 | 6c 69 65 76 65 73 0a 20 20 20 20 20 74 68 61 74 20 61 20 63 6c 6f 63 6b 20 68 61 73 20 73 6f 75 | lieves......that.a.clock.has.sou |
| 117ce0 | 6c 20 61 74 74 72 69 62 75 74 65 73 20 74 68 65 20 6d 61 6b 65 72 27 73 20 67 6c 6f 72 79 20 74 | l.attributes.the.maker's.glory.t |
| 117d00 | 6f 20 74 68 65 20 77 6f 72 6b 29 2c 0a 20 20 20 20 20 69 6e 73 6f 66 61 72 20 61 73 20 6e 65 61 | o.the.work),......insofar.as.nea |
| 117d20 | 72 6c 79 20 61 6c 6c 20 74 68 65 20 6d 61 6e 69 66 6f 6c 64 20 6d 6f 74 69 6f 6e 73 20 61 72 65 | rly.all.the.manifold.motions.are |
| 117d40 | 20 63 61 75 73 65 64 20 62 79 20 61 20 6d 6f 73 74 0a 20 20 20 20 20 73 69 6d 70 6c 65 20 61 6e | .caused.by.a.most......simple.an |
| 117d60 | 64 20 6d 61 74 65 72 69 61 6c 20 66 6f 72 63 65 2c 20 6a 75 73 74 20 61 73 20 61 6c 6c 20 6d 6f | d.material.force,.just.as.all.mo |
| 117d80 | 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 63 6c 6f 63 6b 20 61 72 65 0a 20 20 20 20 20 63 61 75 73 | tions.of.the.clock.are......caus |
| 117da0 | 65 64 20 62 79 20 61 20 73 69 6e 67 6c 65 20 77 65 69 67 68 74 2e 0a 0a 20 20 20 20 20 4a 6f 68 | ed.by.a.single.weight........Joh |
| 117dc0 | 61 6e 6e 65 73 20 4b 65 70 6c 65 72 20 28 6c 65 74 74 65 72 20 74 6f 20 48 65 72 77 61 72 74 20 | annes.Kepler.(letter.to.Herwart. |
| 117de0 | 76 6f 6e 20 48 6f 68 65 6e 62 75 72 67 2c 20 31 36 30 35 29 0a 0a 20 20 20 57 65 20 62 65 67 61 | von.Hohenburg,.1605).....We.bega |
| 117e00 | 6e 20 74 68 69 73 20 62 6f 6f 6b 20 62 79 20 73 74 75 64 79 69 6e 67 20 70 72 6f 63 65 73 73 65 | n.this.book.by.studying.processe |
| 117e20 | 73 20 61 6e 64 20 62 79 20 64 65 73 63 72 69 62 69 6e 67 20 70 72 6f 63 65 73 73 65 73 0a 69 6e | s.and.by.describing.processes.in |
| 117e40 | 20 74 65 72 6d 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 73 20 77 72 69 74 74 65 6e 20 69 6e 20 | .terms.of.procedures.written.in. |
| 117e60 | 4c 69 73 70 2e 20 20 54 6f 20 65 78 70 6c 61 69 6e 20 74 68 65 20 6d 65 61 6e 69 6e 67 73 20 6f | Lisp...To.explain.the.meanings.o |
| 117e80 | 66 0a 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 2c 20 77 65 20 75 73 65 64 20 61 20 73 75 | f.these.procedures,.we.used.a.su |
| 117ea0 | 63 63 65 73 73 69 6f 6e 20 6f 66 20 6d 6f 64 65 6c 73 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e | ccession.of.models.of.evaluation |
| 117ec0 | 3a 20 74 68 65 0a 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 6c 20 6f 66 20 2a 4e 6f 74 | :.the.substitution.model.of.*Not |
| 117ee0 | 65 20 43 68 61 70 74 65 72 20 31 3a 3a 2c 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d | e.Chapter.1::,.the.environment.m |
| 117f00 | 6f 64 65 6c 20 6f 66 20 2a 4e 6f 74 65 0a 43 68 61 70 74 65 72 20 33 3a 3a 2c 20 61 6e 64 20 74 | odel.of.*Note.Chapter.3::,.and.t |
| 117f20 | 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 2a 4e 6f | he.metacircular.evaluator.of.*No |
| 117f40 | 74 65 20 43 68 61 70 74 65 72 20 34 3a 3a 2e 20 20 4f 75 72 0a 65 78 61 6d 69 6e 61 74 69 6f 6e | te.Chapter.4::...Our.examination |
| 117f60 | 20 6f 66 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 2c 20 | .of.the.metacircular.evaluator,. |
| 117f80 | 69 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 64 69 73 70 65 6c 6c 65 64 0a 6d 75 63 68 20 6f 66 | in.particular,.dispelled.much.of |
| 117fa0 | 20 74 68 65 20 6d 79 73 74 65 72 79 20 6f 66 20 68 6f 77 20 4c 69 73 70 2d 6c 69 6b 65 20 6c 61 | .the.mystery.of.how.Lisp-like.la |
| 117fc0 | 6e 67 75 61 67 65 73 20 61 72 65 20 69 6e 74 65 72 70 72 65 74 65 64 2e 20 20 42 75 74 0a 65 76 | nguages.are.interpreted...But.ev |
| 117fe0 | 65 6e 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 20 6c 65 | en.the.metacircular.evaluator.le |
| 118000 | 61 76 65 73 20 69 6d 70 6f 72 74 61 6e 74 20 71 75 65 73 74 69 6f 6e 73 20 75 6e 61 6e 73 77 65 | aves.important.questions.unanswe |
| 118020 | 72 65 64 2c 0a 62 65 63 61 75 73 65 20 69 74 20 66 61 69 6c 73 20 74 6f 20 65 6c 75 63 69 64 61 | red,.because.it.fails.to.elucida |
| 118040 | 74 65 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d 73 20 6f 66 20 63 6f 6e 74 72 6f 6c 20 69 6e 20 | te.the.mechanisms.of.control.in. |
| 118060 | 61 20 4c 69 73 70 0a 73 79 73 74 65 6d 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 68 | a.Lisp.system...For.instance,.th |
| 118080 | 65 20 65 76 61 6c 75 61 74 6f 72 20 64 6f 65 73 20 6e 6f 74 20 65 78 70 6c 61 69 6e 20 68 6f 77 | e.evaluator.does.not.explain.how |
| 1180a0 | 20 74 68 65 0a 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 61 20 73 75 62 65 78 70 72 65 73 73 69 | .the.evaluation.of.a.subexpressi |
| 1180c0 | 6f 6e 20 6d 61 6e 61 67 65 73 20 74 6f 20 72 65 74 75 72 6e 20 61 20 76 61 6c 75 65 20 74 6f 20 | on.manages.to.return.a.value.to. |
| 1180e0 | 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 75 73 65 73 20 74 68 69 73 20 76 61 | the.expression.that.uses.this.va |
| 118100 | 6c 75 65 2c 20 6e 6f 72 20 64 6f 65 73 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 65 78 70 6c | lue,.nor.does.the.evaluator.expl |
| 118120 | 61 69 6e 20 68 6f 77 0a 73 6f 6d 65 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 64 75 72 65 | ain.how.some.recursive.procedure |
| 118140 | 73 20 67 65 6e 65 72 61 74 65 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 65 73 20 28 | s.generate.iterative.processes.( |
| 118160 | 74 68 61 74 20 69 73 2c 20 61 72 65 0a 65 76 61 6c 75 61 74 65 64 20 75 73 69 6e 67 20 63 6f 6e | that.is,.are.evaluated.using.con |
| 118180 | 73 74 61 6e 74 20 73 70 61 63 65 29 20 77 68 65 72 65 61 73 20 6f 74 68 65 72 20 72 65 63 75 72 | stant.space).whereas.other.recur |
| 1181a0 | 73 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 0a 67 65 6e 65 72 61 74 65 20 72 65 63 75 72 73 69 | sive.procedures.generate.recursi |
| 1181c0 | 76 65 20 70 72 6f 63 65 73 73 65 73 2e 20 20 54 68 65 73 65 20 71 75 65 73 74 69 6f 6e 73 20 72 | ve.processes...These.questions.r |
| 1181e0 | 65 6d 61 69 6e 20 75 6e 61 6e 73 77 65 72 65 64 0a 62 65 63 61 75 73 65 20 74 68 65 20 6d 65 74 | emain.unanswered.because.the.met |
| 118200 | 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 20 69 73 20 69 74 73 65 6c 66 20 61 20 | acircular.evaluator.is.itself.a. |
| 118220 | 4c 69 73 70 20 70 72 6f 67 72 61 6d 20 61 6e 64 20 68 65 6e 63 65 0a 69 6e 68 65 72 69 74 73 20 | Lisp.program.and.hence.inherits. |
| 118240 | 74 68 65 20 63 6f 6e 74 72 6f 6c 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 75 6e 64 | the.control.structure.of.the.und |
| 118260 | 65 72 6c 79 69 6e 67 20 4c 69 73 70 20 73 79 73 74 65 6d 2e 20 20 49 6e 20 6f 72 64 65 72 0a 74 | erlying.Lisp.system...In.order.t |
| 118280 | 6f 20 70 72 6f 76 69 64 65 20 61 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 74 65 20 64 65 73 63 72 69 | o.provide.a.more.complete.descri |
| 1182a0 | 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 73 74 72 75 63 74 75 72 65 20 6f | ption.of.the.control.structure.o |
| 1182c0 | 66 20 74 68 65 0a 4c 69 73 70 20 65 76 61 6c 75 61 74 6f 72 2c 20 77 65 20 6d 75 73 74 20 77 6f | f.the.Lisp.evaluator,.we.must.wo |
| 1182e0 | 72 6b 20 61 74 20 61 20 6d 6f 72 65 20 70 72 69 6d 69 74 69 76 65 20 6c 65 76 65 6c 20 74 68 61 | rk.at.a.more.primitive.level.tha |
| 118300 | 6e 20 4c 69 73 70 20 69 74 73 65 6c 66 2e 0a 0a 20 20 20 49 6e 20 74 68 69 73 20 63 68 61 70 74 | n.Lisp.itself......In.this.chapt |
| 118320 | 65 72 20 77 65 20 77 69 6c 6c 20 64 65 73 63 72 69 62 65 20 70 72 6f 63 65 73 73 65 73 20 69 6e | er.we.will.describe.processes.in |
| 118340 | 20 74 65 72 6d 73 20 6f 66 20 74 68 65 0a 73 74 65 70 2d 62 79 2d 73 74 65 70 20 6f 70 65 72 61 | .terms.of.the.step-by-step.opera |
| 118360 | 74 69 6f 6e 20 6f 66 20 61 20 74 72 61 64 69 74 69 6f 6e 61 6c 20 63 6f 6d 70 75 74 65 72 2e 20 | tion.of.a.traditional.computer.. |
| 118380 | 20 53 75 63 68 20 61 20 63 6f 6d 70 75 74 65 72 2c 20 6f 72 20 6d 61 63 68 69 6e 65 0a 22 72 65 | .Such.a.computer,.or.machine."re |
| 1183a0 | 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 22 2c 20 73 65 71 75 65 6e 74 69 61 6c 6c 79 20 65 78 | gister.machine",.sequentially.ex |
| 1183c0 | 65 63 75 74 65 73 20 22 69 6e 73 74 72 75 63 74 69 6f 6e 73 22 20 74 68 61 74 0a 6d 61 6e 69 70 | ecutes."instructions".that.manip |
| 1183e0 | 75 6c 61 74 65 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 61 20 66 69 78 65 64 20 73 65 | ulate.the.contents.of.a.fixed.se |
| 118400 | 74 20 6f 66 20 73 74 6f 72 61 67 65 20 65 6c 65 6d 65 6e 74 73 20 63 61 6c 6c 65 64 20 22 72 65 | t.of.storage.elements.called."re |
| 118420 | 67 69 73 74 65 72 73 22 2e 0a 41 20 74 79 70 69 63 61 6c 20 72 65 67 69 73 74 65 72 2d 6d 61 63 | gisters"..A.typical.register-mac |
| 118440 | 68 69 6e 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 61 70 70 6c 69 65 73 20 61 20 70 72 69 6d 69 | hine.instruction.applies.a.primi |
| 118460 | 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 0a 74 6f 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f | tive.operation.to.the.contents.o |
| 118480 | 66 20 73 6f 6d 65 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 20 61 73 73 69 67 6e 73 20 74 68 65 | f.some.registers.and.assigns.the |
| 1184a0 | 20 72 65 73 75 6c 74 20 74 6f 20 61 6e 6f 74 68 65 72 0a 72 65 67 69 73 74 65 72 2e 20 20 4f 75 | .result.to.another.register...Ou |
| 1184c0 | 72 20 64 65 73 63 72 69 70 74 69 6f 6e 73 20 6f 66 20 70 72 6f 63 65 73 73 65 73 20 65 78 65 63 | r.descriptions.of.processes.exec |
| 1184e0 | 75 74 65 64 20 62 79 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 73 0a 77 69 6c 6c 20 6c | uted.by.register.machines.will.l |
| 118500 | 6f 6f 6b 20 76 65 72 79 20 6d 75 63 68 20 6c 69 6b 65 20 22 6d 61 63 68 69 6e 65 2d 6c 61 6e 67 | ook.very.much.like."machine-lang |
| 118520 | 75 61 67 65 22 20 70 72 6f 67 72 61 6d 73 20 66 6f 72 20 74 72 61 64 69 74 69 6f 6e 61 6c 0a 63 | uage".programs.for.traditional.c |
| 118540 | 6f 6d 70 75 74 65 72 73 2e 20 20 48 6f 77 65 76 65 72 2c 20 69 6e 73 74 65 61 64 20 6f 66 20 66 | omputers...However,.instead.of.f |
| 118560 | 6f 63 75 73 69 6e 67 20 6f 6e 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 20 | ocusing.on.the.machine.language. |
| 118580 | 6f 66 20 61 6e 79 0a 70 61 72 74 69 63 75 6c 61 72 20 63 6f 6d 70 75 74 65 72 2c 20 77 65 20 77 | of.any.particular.computer,.we.w |
| 1185a0 | 69 6c 6c 20 65 78 61 6d 69 6e 65 20 73 65 76 65 72 61 6c 20 4c 69 73 70 20 70 72 6f 63 65 64 75 | ill.examine.several.Lisp.procedu |
| 1185c0 | 72 65 73 20 61 6e 64 20 64 65 73 69 67 6e 0a 61 20 73 70 65 63 69 66 69 63 20 72 65 67 69 73 74 | res.and.design.a.specific.regist |
| 1185e0 | 65 72 20 6d 61 63 68 69 6e 65 20 74 6f 20 65 78 65 63 75 74 65 20 65 61 63 68 20 70 72 6f 63 65 | er.machine.to.execute.each.proce |
| 118600 | 64 75 72 65 2e 20 20 54 68 75 73 2c 20 77 65 20 77 69 6c 6c 0a 61 70 70 72 6f 61 63 68 20 6f 75 | dure...Thus,.we.will.approach.ou |
| 118620 | 72 20 74 61 73 6b 20 66 72 6f 6d 20 74 68 65 20 70 65 72 73 70 65 63 74 69 76 65 20 6f 66 20 61 | r.task.from.the.perspective.of.a |
| 118640 | 20 68 61 72 64 77 61 72 65 20 61 72 63 68 69 74 65 63 74 20 72 61 74 68 65 72 0a 74 68 61 6e 20 | .hardware.architect.rather.than. |
| 118660 | 74 68 61 74 20 6f 66 20 61 20 6d 61 63 68 69 6e 65 2d 6c 61 6e 67 75 61 67 65 20 63 6f 6d 70 75 | that.of.a.machine-language.compu |
| 118680 | 74 65 72 20 70 72 6f 67 72 61 6d 6d 65 72 2e 20 20 49 6e 20 64 65 73 69 67 6e 69 6e 67 0a 72 65 | ter.programmer...In.designing.re |
| 1186a0 | 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 73 2c 20 77 65 20 77 69 6c 6c 20 64 65 76 65 6c 6f 70 | gister.machines,.we.will.develop |
| 1186c0 | 20 6d 65 63 68 61 6e 69 73 6d 73 20 66 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 0a 69 6d 70 | .mechanisms.for.implementing.imp |
| 1186e0 | 6f 72 74 61 6e 74 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 63 6f 6e 73 74 72 75 63 74 73 20 73 75 | ortant.programming.constructs.su |
| 118700 | 63 68 20 61 73 20 72 65 63 75 72 73 69 6f 6e 2e 20 20 57 65 20 77 69 6c 6c 20 61 6c 73 6f 0a 70 | ch.as.recursion...We.will.also.p |
| 118720 | 72 65 73 65 6e 74 20 61 20 6c 61 6e 67 75 61 67 65 20 66 6f 72 20 64 65 73 63 72 69 62 69 6e 67 | resent.a.language.for.describing |
| 118740 | 20 64 65 73 69 67 6e 73 20 66 6f 72 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 73 2e 20 | .designs.for.register.machines.. |
| 118760 | 20 49 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 32 3a 3a 20 77 65 20 77 69 6c 6c 20 | .In.section.*Note.5-2::.we.will. |
| 118780 | 69 6d 70 6c 65 6d 65 6e 74 20 61 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 75 73 | implement.a.Lisp.program.that.us |
| 1187a0 | 65 73 20 74 68 65 73 65 0a 64 65 73 63 72 69 70 74 69 6f 6e 73 20 74 6f 20 73 69 6d 75 6c 61 74 | es.these.descriptions.to.simulat |
| 1187c0 | 65 20 74 68 65 20 6d 61 63 68 69 6e 65 73 20 77 65 20 64 65 73 69 67 6e 2e 0a 0a 20 20 20 4d 6f | e.the.machines.we.design......Mo |
| 1187e0 | 73 74 20 6f 66 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f | st.of.the.primitive.operations.o |
| 118800 | 66 20 6f 75 72 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 73 20 61 72 65 20 76 65 72 79 | f.our.register.machines.are.very |
| 118820 | 0a 73 69 6d 70 6c 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 6e 20 6f 70 65 72 61 74 | .simple...For.example,.an.operat |
| 118840 | 69 6f 6e 20 6d 69 67 68 74 20 61 64 64 20 74 68 65 20 6e 75 6d 62 65 72 73 20 66 65 74 63 68 65 | ion.might.add.the.numbers.fetche |
| 118860 | 64 20 66 72 6f 6d 0a 74 77 6f 20 72 65 67 69 73 74 65 72 73 2c 20 70 72 6f 64 75 63 69 6e 67 20 | d.from.two.registers,.producing. |
| 118880 | 61 20 72 65 73 75 6c 74 20 74 6f 20 62 65 20 73 74 6f 72 65 64 20 69 6e 74 6f 20 61 20 74 68 69 | a.result.to.be.stored.into.a.thi |
| 1188a0 | 72 64 20 72 65 67 69 73 74 65 72 2e 0a 53 75 63 68 20 61 6e 20 6f 70 65 72 61 74 69 6f 6e 20 63 | rd.register..Such.an.operation.c |
| 1188c0 | 61 6e 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 62 79 20 65 61 73 69 6c 79 20 64 65 73 63 72 69 | an.be.performed.by.easily.descri |
| 1188e0 | 62 65 64 20 68 61 72 64 77 61 72 65 2e 20 20 49 6e 0a 6f 72 64 65 72 20 74 6f 20 64 65 61 6c 20 | bed.hardware...In.order.to.deal. |
| 118900 | 77 69 74 68 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 2c 20 68 6f 77 65 76 65 72 2c 20 77 65 | with.list.structure,.however,.we |
| 118920 | 20 77 69 6c 6c 20 61 6c 73 6f 20 75 73 65 20 74 68 65 20 6d 65 6d 6f 72 79 0a 6f 70 65 72 61 74 | .will.also.use.the.memory.operat |
| 118940 | 69 6f 6e 73 20 60 63 61 72 27 2c 20 60 63 64 72 27 2c 20 61 6e 64 20 60 63 6f 6e 73 27 2c 20 77 | ions.`car',.`cdr',.and.`cons',.w |
| 118960 | 68 69 63 68 20 72 65 71 75 69 72 65 20 61 6e 20 65 6c 61 62 6f 72 61 74 65 0a 73 74 6f 72 61 67 | hich.require.an.elaborate.storag |
| 118980 | 65 2d 61 6c 6c 6f 63 61 74 69 6f 6e 20 6d 65 63 68 61 6e 69 73 6d 2e 20 20 49 6e 20 73 65 63 74 | e-allocation.mechanism...In.sect |
| 1189a0 | 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 33 3a 3a 20 77 65 20 73 74 75 64 79 20 74 68 65 69 72 0a 69 | ion.*Note.5-3::.we.study.their.i |
| 1189c0 | 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6d 6f 72 65 20 65 | mplementation.in.terms.of.more.e |
| 1189e0 | 6c 65 6d 65 6e 74 61 72 79 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 49 6e 20 73 65 63 | lementary.operations......In.sec |
| 118a00 | 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 34 3a 3a 2c 20 61 66 74 65 72 20 77 65 20 68 61 76 65 20 | tion.*Note.5-4::,.after.we.have. |
| 118a20 | 61 63 63 75 6d 75 6c 61 74 65 64 20 65 78 70 65 72 69 65 6e 63 65 0a 66 6f 72 6d 75 6c 61 74 69 | accumulated.experience.formulati |
| 118a40 | 6e 67 20 73 69 6d 70 6c 65 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 72 65 67 69 73 74 65 72 | ng.simple.procedures.as.register |
| 118a60 | 20 6d 61 63 68 69 6e 65 73 2c 20 77 65 20 77 69 6c 6c 20 64 65 73 69 67 6e 20 61 0a 6d 61 63 68 | .machines,.we.will.design.a.mach |
| 118a80 | 69 6e 65 20 74 68 61 74 20 63 61 72 72 69 65 73 20 6f 75 74 20 74 68 65 20 61 6c 67 6f 72 69 74 | ine.that.carries.out.the.algorit |
| 118aa0 | 68 6d 20 64 65 73 63 72 69 62 65 64 20 62 79 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 | hm.described.by.the.metacircular |
| 118ac0 | 0a 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 3a | .evaluator.of.section.*Note.4-1: |
| 118ae0 | 3a 2e 20 20 54 68 69 73 20 77 69 6c 6c 20 66 69 6c 6c 20 69 6e 20 74 68 65 20 67 61 70 20 69 6e | :...This.will.fill.in.the.gap.in |
| 118b00 | 20 6f 75 72 0a 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 6f 66 20 68 6f 77 20 53 63 68 65 6d 65 | .our.understanding.of.how.Scheme |
| 118b20 | 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 69 6e 74 65 72 70 72 65 74 65 64 2c 20 62 79 | .expressions.are.interpreted,.by |
| 118b40 | 20 70 72 6f 76 69 64 69 6e 67 0a 61 6e 20 65 78 70 6c 69 63 69 74 20 6d 6f 64 65 6c 20 66 6f 72 | .providing.an.explicit.model.for |
| 118b60 | 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d 73 20 6f 66 20 63 6f 6e 74 72 6f 6c 20 69 6e 20 74 68 | .the.mechanisms.of.control.in.th |
| 118b80 | 65 20 65 76 61 6c 75 61 74 6f 72 2e 20 20 49 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 | e.evaluator...In.section.*Note.5 |
| 118ba0 | 2d 35 3a 3a 20 77 65 20 77 69 6c 6c 20 73 74 75 64 79 20 61 20 73 69 6d 70 6c 65 20 63 6f 6d 70 | -5::.we.will.study.a.simple.comp |
| 118bc0 | 69 6c 65 72 20 74 68 61 74 20 74 72 61 6e 73 6c 61 74 65 73 0a 53 63 68 65 6d 65 20 70 72 6f 67 | iler.that.translates.Scheme.prog |
| 118be0 | 72 61 6d 73 20 69 6e 74 6f 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 69 6e 73 74 72 75 63 74 69 | rams.into.sequences.of.instructi |
| 118c00 | 6f 6e 73 20 74 68 61 74 20 63 61 6e 20 62 65 20 65 78 65 63 75 74 65 64 0a 64 69 72 65 63 74 6c | ons.that.can.be.executed.directl |
| 118c20 | 79 20 77 69 74 68 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 20 6f 70 65 72 61 74 69 | y.with.the.registers.and.operati |
| 118c40 | 6f 6e 73 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 72 65 67 69 73 74 65 72 0a 6d 61 | ons.of.the.evaluator.register.ma |
| 118c60 | 63 68 69 6e 65 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 35 2d 31 3a 3a 20 20 20 20 20 20 20 20 | chine...*.Menu:..*.5-1::........ |
| 118c80 | 20 20 20 20 20 20 44 65 73 69 67 6e 69 6e 67 20 52 65 67 69 73 74 65 72 20 4d 61 63 68 69 6e 65 | ......Designing.Register.Machine |
| 118ca0 | 73 0a 2a 20 35 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 41 20 52 65 67 69 73 74 65 | s.*.5-2::..............A.Registe |
| 118cc0 | 72 2d 4d 61 63 68 69 6e 65 20 53 69 6d 75 6c 61 74 6f 72 0a 2a 20 35 2d 33 3a 3a 20 20 20 20 20 | r-Machine.Simulator.*.5-3::..... |
| 118ce0 | 20 20 20 20 20 20 20 20 20 53 74 6f 72 61 67 65 20 41 6c 6c 6f 63 61 74 69 6f 6e 20 61 6e 64 20 | .........Storage.Allocation.and. |
| 118d00 | 47 61 72 62 61 67 65 20 43 6f 6c 6c 65 63 74 69 6f 6e 0a 2a 20 35 2d 34 3a 3a 20 20 20 20 20 20 | Garbage.Collection.*.5-4::...... |
| 118d20 | 20 20 20 20 20 20 20 20 54 68 65 20 45 78 70 6c 69 63 69 74 2d 43 6f 6e 74 72 6f 6c 20 45 76 61 | ........The.Explicit-Control.Eva |
| 118d40 | 6c 75 61 74 6f 72 0a 2a 20 35 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6d 70 | luator.*.5-5::..............Comp |
| 118d60 | 69 6c 61 74 69 6f 6e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 | ilation....File:.sicp.info,..Nod |
| 118d80 | 65 3a 20 35 2d 31 2c 20 20 4e 65 78 74 3a 20 35 2d 32 2c 20 20 50 72 65 76 3a 20 43 68 61 70 74 | e:.5-1,..Next:.5-2,..Prev:.Chapt |
| 118da0 | 65 72 20 35 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 35 0a 0a 35 2e 31 20 44 65 73 69 67 6e | er.5,..Up:.Chapter.5..5.1.Design |
| 118dc0 | 69 6e 67 20 52 65 67 69 73 74 65 72 20 4d 61 63 68 69 6e 65 73 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ing.Register.Machines.========== |
| 118de0 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 54 6f 20 64 65 73 69 67 6e | =====================..To.design |
| 118e00 | 20 61 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 2c 20 77 65 20 6d 75 73 74 20 64 65 73 | .a.register.machine,.we.must.des |
| 118e20 | 69 67 6e 20 69 74 73 20 22 64 61 74 61 20 70 61 74 68 73 22 0a 28 72 65 67 69 73 74 65 72 73 20 | ign.its."data.paths".(registers. |
| 118e40 | 61 6e 64 20 6f 70 65 72 61 74 69 6f 6e 73 29 20 61 6e 64 20 74 68 65 20 22 63 6f 6e 74 72 6f 6c | and.operations).and.the."control |
| 118e60 | 6c 65 72 22 20 74 68 61 74 20 73 65 71 75 65 6e 63 65 73 20 74 68 65 73 65 0a 6f 70 65 72 61 74 | ler".that.sequences.these.operat |
| 118e80 | 69 6f 6e 73 2e 20 20 54 6f 20 69 6c 6c 75 73 74 72 61 74 65 20 74 68 65 20 64 65 73 69 67 6e 20 | ions...To.illustrate.the.design. |
| 118ea0 | 6f 66 20 61 20 73 69 6d 70 6c 65 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 2c 20 6c 65 | of.a.simple.register.machine,.le |
| 118ec0 | 74 0a 75 73 20 65 78 61 6d 69 6e 65 20 45 75 63 6c 69 64 27 73 20 41 6c 67 6f 72 69 74 68 6d 2c | t.us.examine.Euclid's.Algorithm, |
| 118ee0 | 20 77 68 69 63 68 20 69 73 20 75 73 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 67 72 | .which.is.used.to.compute.the.gr |
| 118f00 | 65 61 74 65 73 74 0a 63 6f 6d 6d 6f 6e 20 64 69 76 69 73 6f 72 20 28 47 43 44 29 20 6f 66 20 74 | eatest.common.divisor.(GCD).of.t |
| 118f20 | 77 6f 20 69 6e 74 65 67 65 72 73 2e 20 20 41 73 20 77 65 20 73 61 77 20 69 6e 20 73 65 63 74 69 | wo.integers...As.we.saw.in.secti |
| 118f40 | 6f 6e 20 2a 4e 6f 74 65 0a 31 2d 32 2d 35 3a 3a 2c 20 45 75 63 6c 69 64 27 73 20 41 6c 67 6f 72 | on.*Note.1-2-5::,.Euclid's.Algor |
| 118f60 | 69 74 68 6d 20 63 61 6e 20 62 65 20 63 61 72 72 69 65 64 20 6f 75 74 20 62 79 20 61 6e 20 69 74 | ithm.can.be.carried.out.by.an.it |
| 118f80 | 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 2c 0a 61 73 20 73 70 65 63 69 66 69 65 64 20 62 79 | erative.process,.as.specified.by |
| 118fa0 | 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 | .the.following.procedure:....... |
| 118fc0 | 28 64 65 66 69 6e 65 20 28 67 63 64 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 | (define.(gcd.a.b)........(if.(=. |
| 118fe0 | 62 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 61 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 63 | b.0)............a............(gc |
| 119000 | 64 20 62 20 28 72 65 6d 61 69 6e 64 65 72 20 61 20 62 29 29 29 29 0a 0a 20 20 20 41 20 6d 61 63 | d.b.(remainder.a.b)))).....A.mac |
| 119020 | 68 69 6e 65 20 74 6f 20 63 61 72 72 79 20 6f 75 74 20 74 68 69 73 20 61 6c 67 6f 72 69 74 68 6d | hine.to.carry.out.this.algorithm |
| 119040 | 20 6d 75 73 74 20 6b 65 65 70 20 74 72 61 63 6b 20 6f 66 20 74 77 6f 0a 6e 75 6d 62 65 72 73 2c | .must.keep.track.of.two.numbers, |
| 119060 | 20 61 20 61 6e 64 20 62 2c 20 73 6f 20 6c 65 74 20 75 73 20 61 73 73 75 6d 65 20 74 68 61 74 20 | .a.and.b,.so.let.us.assume.that. |
| 119080 | 74 68 65 73 65 20 6e 75 6d 62 65 72 73 20 61 72 65 20 73 74 6f 72 65 64 20 69 6e 20 74 77 6f 0a | these.numbers.are.stored.in.two. |
| 1190a0 | 72 65 67 69 73 74 65 72 73 20 77 69 74 68 20 74 68 6f 73 65 20 6e 61 6d 65 73 2e 20 20 54 68 65 | registers.with.those.names...The |
| 1190c0 | 20 62 61 73 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 72 65 71 75 69 72 65 64 20 61 72 65 20 74 | .basic.operations.required.are.t |
| 1190e0 | 65 73 74 69 6e 67 0a 77 68 65 74 68 65 72 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 | esting.whether.the.contents.of.r |
| 119100 | 65 67 69 73 74 65 72 20 60 62 27 20 69 73 20 7a 65 72 6f 20 61 6e 64 20 63 6f 6d 70 75 74 69 6e | egister.`b'.is.zero.and.computin |
| 119120 | 67 20 74 68 65 0a 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 | g.the.remainder.of.the.contents. |
| 119140 | 6f 66 20 72 65 67 69 73 74 65 72 20 60 61 27 20 64 69 76 69 64 65 64 20 62 79 20 74 68 65 20 63 | of.register.`a'.divided.by.the.c |
| 119160 | 6f 6e 74 65 6e 74 73 20 6f 66 0a 72 65 67 69 73 74 65 72 20 60 62 27 2e 20 20 54 68 65 20 72 65 | ontents.of.register.`b'...The.re |
| 119180 | 6d 61 69 6e 64 65 72 20 6f 70 65 72 61 74 69 6f 6e 20 69 73 20 61 20 63 6f 6d 70 6c 65 78 20 70 | mainder.operation.is.a.complex.p |
| 1191a0 | 72 6f 63 65 73 73 2c 20 62 75 74 20 61 73 73 75 6d 65 0a 66 6f 72 20 74 68 65 20 6d 6f 6d 65 6e | rocess,.but.assume.for.the.momen |
| 1191c0 | 74 20 74 68 61 74 20 77 65 20 68 61 76 65 20 61 20 70 72 69 6d 69 74 69 76 65 20 64 65 76 69 63 | t.that.we.have.a.primitive.devic |
| 1191e0 | 65 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 0a 72 65 6d 61 69 6e 64 65 72 73 2e 20 20 4f 6e 20 | e.that.computes.remainders...On. |
| 119200 | 65 61 63 68 20 63 79 63 6c 65 20 6f 66 20 74 68 65 20 47 43 44 20 61 6c 67 6f 72 69 74 68 6d 2c | each.cycle.of.the.GCD.algorithm, |
| 119220 | 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 0a 72 65 67 69 73 74 65 72 20 60 61 27 20 6d 75 | .the.contents.of.register.`a'.mu |
| 119240 | 73 74 20 62 65 20 72 65 70 6c 61 63 65 64 20 62 79 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f | st.be.replaced.by.the.contents.o |
| 119260 | 66 20 72 65 67 69 73 74 65 72 20 60 62 27 2c 20 61 6e 64 20 74 68 65 0a 63 6f 6e 74 65 6e 74 73 | f.register.`b',.and.the.contents |
| 119280 | 20 6f 66 20 60 62 27 20 6d 75 73 74 20 62 65 20 72 65 70 6c 61 63 65 64 20 62 79 20 74 68 65 20 | .of.`b'.must.be.replaced.by.the. |
| 1192a0 | 72 65 6d 61 69 6e 64 65 72 20 6f 66 20 74 68 65 20 6f 6c 64 20 63 6f 6e 74 65 6e 74 73 0a 6f 66 | remainder.of.the.old.contents.of |
| 1192c0 | 20 60 61 27 20 64 69 76 69 64 65 64 20 62 79 20 74 68 65 20 6f 6c 64 20 63 6f 6e 74 65 6e 74 73 | .`a'.divided.by.the.old.contents |
| 1192e0 | 20 6f 66 20 60 62 27 2e 20 20 49 74 20 77 6f 75 6c 64 20 62 65 20 63 6f 6e 76 65 6e 69 65 6e 74 | .of.`b'...It.would.be.convenient |
| 119300 | 20 69 66 0a 74 68 65 73 65 20 72 65 70 6c 61 63 65 6d 65 6e 74 73 20 63 6f 75 6c 64 20 62 65 20 | .if.these.replacements.could.be. |
| 119320 | 64 6f 6e 65 20 73 69 6d 75 6c 74 61 6e 65 6f 75 73 6c 79 2c 20 62 75 74 20 69 6e 20 6f 75 72 20 | done.simultaneously,.but.in.our. |
| 119340 | 6d 6f 64 65 6c 20 6f 66 0a 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 73 20 77 65 20 77 69 | model.of.register.machines.we.wi |
| 119360 | 6c 6c 20 61 73 73 75 6d 65 20 74 68 61 74 20 6f 6e 6c 79 20 6f 6e 65 20 72 65 67 69 73 74 65 72 | ll.assume.that.only.one.register |
| 119380 | 20 63 61 6e 20 62 65 20 61 73 73 69 67 6e 65 64 0a 61 20 6e 65 77 20 76 61 6c 75 65 20 61 74 20 | .can.be.assigned.a.new.value.at. |
| 1193a0 | 65 61 63 68 20 73 74 65 70 2e 20 20 54 6f 20 61 63 63 6f 6d 70 6c 69 73 68 20 74 68 65 20 72 65 | each.step...To.accomplish.the.re |
| 1193c0 | 70 6c 61 63 65 6d 65 6e 74 73 2c 20 6f 75 72 20 6d 61 63 68 69 6e 65 0a 77 69 6c 6c 20 75 73 65 | placements,.our.machine.will.use |
| 1193e0 | 20 61 20 74 68 69 72 64 20 22 74 65 6d 70 6f 72 61 72 79 22 20 72 65 67 69 73 74 65 72 2c 20 77 | .a.third."temporary".register,.w |
| 119400 | 68 69 63 68 20 77 65 20 63 61 6c 6c 20 60 74 27 2e 20 20 28 46 69 72 73 74 20 74 68 65 0a 72 65 | hich.we.call.`t'...(First.the.re |
| 119420 | 6d 61 69 6e 64 65 72 20 77 69 6c 6c 20 62 65 20 70 6c 61 63 65 64 20 69 6e 20 60 74 27 2c 20 74 | mainder.will.be.placed.in.`t',.t |
| 119440 | 68 65 6e 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 60 62 27 20 77 69 6c 6c 20 62 65 0a | hen.the.contents.of.`b'.will.be. |
| 119460 | 70 6c 61 63 65 64 20 69 6e 20 60 61 27 2c 20 61 6e 64 20 66 69 6e 61 6c 6c 79 20 74 68 65 20 72 | placed.in.`a',.and.finally.the.r |
| 119480 | 65 6d 61 69 6e 64 65 72 20 73 74 6f 72 65 64 20 69 6e 20 60 74 27 20 77 69 6c 6c 20 62 65 20 70 | emainder.stored.in.`t'.will.be.p |
| 1194a0 | 6c 61 63 65 64 0a 69 6e 20 60 62 27 2e 29 0a 0a 20 20 20 57 65 20 63 61 6e 20 69 6c 6c 75 73 74 | laced.in.`b'.).....We.can.illust |
| 1194c0 | 72 61 74 65 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 20 6f 70 65 72 61 74 69 6f 6e | rate.the.registers.and.operation |
| 1194e0 | 73 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 74 68 69 73 0a 6d 61 63 68 69 6e 65 20 62 79 20 75 | s.required.for.this.machine.by.u |
| 119500 | 73 69 6e 67 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 20 64 69 61 67 72 61 6d 20 73 68 6f 77 6e | sing.the.data-path.diagram.shown |
| 119520 | 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 3a 3a 2e 20 20 49 6e 0a 74 68 69 73 | .in.*Note.Figure.5-1::...In.this |
| 119540 | 20 64 69 61 67 72 61 6d 2c 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 28 60 61 27 2c 20 60 62 | .diagram,.the.registers.(`a',.`b |
| 119560 | 27 2c 20 61 6e 64 20 60 74 27 29 20 61 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 0a 72 | ',.and.`t').are.represented.by.r |
| 119580 | 65 63 74 61 6e 67 6c 65 73 2e 20 20 45 61 63 68 20 77 61 79 20 74 6f 20 61 73 73 69 67 6e 20 61 | ectangles...Each.way.to.assign.a |
| 1195a0 | 20 76 61 6c 75 65 20 74 6f 20 61 20 72 65 67 69 73 74 65 72 20 69 73 20 69 6e 64 69 63 61 74 65 | .value.to.a.register.is.indicate |
| 1195c0 | 64 20 62 79 0a 61 6e 20 61 72 72 6f 77 20 77 69 74 68 20 61 6e 20 60 58 27 20 62 65 68 69 6e 64 | d.by.an.arrow.with.an.`X'.behind |
| 1195e0 | 20 74 68 65 20 68 65 61 64 2c 20 70 6f 69 6e 74 69 6e 67 20 66 72 6f 6d 20 74 68 65 20 73 6f 75 | .the.head,.pointing.from.the.sou |
| 119600 | 72 63 65 20 6f 66 20 64 61 74 61 0a 74 6f 20 74 68 65 20 72 65 67 69 73 74 65 72 2e 20 20 57 65 | rce.of.data.to.the.register...We |
| 119620 | 20 63 61 6e 20 74 68 69 6e 6b 20 6f 66 20 74 68 65 20 60 58 27 20 61 73 20 61 20 62 75 74 74 6f | .can.think.of.the.`X'.as.a.butto |
| 119640 | 6e 20 74 68 61 74 2c 20 77 68 65 6e 0a 70 75 73 68 65 64 2c 20 61 6c 6c 6f 77 73 20 74 68 65 20 | n.that,.when.pushed,.allows.the. |
| 119660 | 76 61 6c 75 65 20 61 74 20 74 68 65 20 73 6f 75 72 63 65 20 74 6f 20 22 66 6c 6f 77 22 20 69 6e | value.at.the.source.to."flow".in |
| 119680 | 74 6f 20 74 68 65 20 64 65 73 69 67 6e 61 74 65 64 0a 72 65 67 69 73 74 65 72 2e 20 20 54 68 65 | to.the.designated.register...The |
| 1196a0 | 20 6c 61 62 65 6c 20 6e 65 78 74 20 74 6f 20 65 61 63 68 20 62 75 74 74 6f 6e 20 69 73 20 74 68 | .label.next.to.each.button.is.th |
| 1196c0 | 65 20 6e 61 6d 65 20 77 65 20 77 69 6c 6c 20 75 73 65 20 74 6f 0a 72 65 66 65 72 20 74 6f 20 74 | e.name.we.will.use.to.refer.to.t |
| 1196e0 | 68 65 20 62 75 74 74 6f 6e 2e 20 20 54 68 65 20 6e 61 6d 65 73 20 61 72 65 20 61 72 62 69 74 72 | he.button...The.names.are.arbitr |
| 119700 | 61 72 79 2c 20 61 6e 64 20 63 61 6e 20 62 65 20 63 68 6f 73 65 6e 20 74 6f 0a 68 61 76 65 20 6d | ary,.and.can.be.chosen.to.have.m |
| 119720 | 6e 65 6d 6f 6e 69 63 20 76 61 6c 75 65 20 28 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 60 61 3c 2d | nemonic.value.(for.example,.`a<- |
| 119740 | 62 27 20 64 65 6e 6f 74 65 73 20 70 75 73 68 69 6e 67 20 74 68 65 20 62 75 74 74 6f 6e 0a 74 68 | b'.denotes.pushing.the.button.th |
| 119760 | 61 74 20 61 73 73 69 67 6e 73 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 | at.assigns.the.contents.of.regis |
| 119780 | 74 65 72 20 60 62 27 20 74 6f 20 72 65 67 69 73 74 65 72 20 60 61 27 29 2e 20 20 54 68 65 20 73 | ter.`b'.to.register.`a')...The.s |
| 1197a0 | 6f 75 72 63 65 0a 6f 66 20 64 61 74 61 20 66 6f 72 20 61 20 72 65 67 69 73 74 65 72 20 63 61 6e | ource.of.data.for.a.register.can |
| 1197c0 | 20 62 65 20 61 6e 6f 74 68 65 72 20 72 65 67 69 73 74 65 72 20 28 61 73 20 69 6e 20 74 68 65 20 | .be.another.register.(as.in.the. |
| 1197e0 | 60 61 3c 2d 62 27 0a 61 73 73 69 67 6e 6d 65 6e 74 29 2c 20 61 6e 20 6f 70 65 72 61 74 69 6f 6e | `a<-b'.assignment),.an.operation |
| 119800 | 20 72 65 73 75 6c 74 20 28 61 73 20 69 6e 20 74 68 65 20 60 74 3c 2d 72 27 20 61 73 73 69 67 6e | .result.(as.in.the.`t<-r'.assign |
| 119820 | 6d 65 6e 74 29 2c 20 6f 72 20 61 0a 63 6f 6e 73 74 61 6e 74 20 28 61 20 62 75 69 6c 74 2d 69 6e | ment),.or.a.constant.(a.built-in |
| 119840 | 20 76 61 6c 75 65 20 74 68 61 74 20 63 61 6e 6e 6f 74 20 62 65 20 63 68 61 6e 67 65 64 2c 20 72 | .value.that.cannot.be.changed,.r |
| 119860 | 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 61 0a 64 61 74 61 2d 70 61 74 68 20 64 69 61 67 72 61 | epresented.in.a.data-path.diagra |
| 119880 | 6d 20 62 79 20 61 20 74 72 69 61 6e 67 6c 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 63 | m.by.a.triangle.containing.the.c |
| 1198a0 | 6f 6e 73 74 61 6e 74 29 2e 0a 0a 20 20 20 41 6e 20 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 | onstant)......An.operation.that. |
| 1198c0 | 63 6f 6d 70 75 74 65 73 20 61 20 76 61 6c 75 65 20 66 72 6f 6d 20 63 6f 6e 73 74 61 6e 74 73 20 | computes.a.value.from.constants. |
| 1198e0 | 61 6e 64 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 0a 6f 66 20 72 65 67 69 73 74 65 72 73 20 69 73 | and.the.contents.of.registers.is |
| 119900 | 20 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 61 20 64 61 74 61 2d 70 61 74 68 20 64 69 61 67 | .represented.in.a.data-path.diag |
| 119920 | 72 61 6d 20 62 79 20 61 20 74 72 61 70 65 7a 6f 69 64 0a 63 6f 6e 74 61 69 6e 69 6e 67 20 61 20 | ram.by.a.trapezoid.containing.a. |
| 119940 | 6e 61 6d 65 20 66 6f 72 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 2e 20 20 46 6f 72 20 65 78 61 | name.for.the.operation...For.exa |
| 119960 | 6d 70 6c 65 2c 20 74 68 65 20 62 6f 78 20 6d 61 72 6b 65 64 20 60 72 65 6d 27 0a 69 6e 20 2a 4e | mple,.the.box.marked.`rem'.in.*N |
| 119980 | 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 3a 3a 20 72 65 70 72 65 73 65 6e 74 73 20 61 6e 20 6f | ote.Figure.5-1::.represents.an.o |
| 1199a0 | 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 74 68 65 0a 72 65 6d 61 69 | peration.that.computes.the.remai |
| 1199c0 | 6e 64 65 72 20 6f 66 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 74 68 65 20 72 65 67 69 | nder.of.the.contents.of.the.regi |
| 1199e0 | 73 74 65 72 73 20 60 61 27 20 61 6e 64 20 60 62 27 20 74 6f 20 77 68 69 63 68 20 69 74 20 69 73 | sters.`a'.and.`b'.to.which.it.is |
| 119a00 | 0a 61 74 74 61 63 68 65 64 2e 20 20 41 72 72 6f 77 73 20 28 77 69 74 68 6f 75 74 20 62 75 74 74 | .attached...Arrows.(without.butt |
| 119a20 | 6f 6e 73 29 20 70 6f 69 6e 74 20 66 72 6f 6d 20 74 68 65 20 69 6e 70 75 74 20 72 65 67 69 73 74 | ons).point.from.the.input.regist |
| 119a40 | 65 72 73 20 61 6e 64 0a 63 6f 6e 73 74 61 6e 74 73 20 74 6f 20 74 68 65 20 62 6f 78 2c 20 61 6e | ers.and.constants.to.the.box,.an |
| 119a60 | 64 20 61 72 72 6f 77 73 20 63 6f 6e 6e 65 63 74 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 27 73 | d.arrows.connect.the.operation's |
| 119a80 | 20 6f 75 74 70 75 74 20 76 61 6c 75 65 0a 74 6f 20 72 65 67 69 73 74 65 72 73 2e 20 20 41 20 74 | .output.value.to.registers...A.t |
| 119aa0 | 65 73 74 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 61 20 63 69 72 63 6c 65 20 63 | est.is.represented.by.a.circle.c |
| 119ac0 | 6f 6e 74 61 69 6e 69 6e 67 20 61 20 6e 61 6d 65 20 66 6f 72 0a 74 68 65 20 74 65 73 74 2e 20 20 | ontaining.a.name.for.the.test... |
| 119ae0 | 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 6f 75 72 20 47 43 44 20 6d 61 63 68 69 6e 65 20 68 61 73 | For.example,.our.GCD.machine.has |
| 119b00 | 20 61 6e 20 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 74 65 73 74 73 0a 77 68 65 74 68 65 72 | .an.operation.that.tests.whether |
| 119b20 | 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 74 65 72 20 60 62 27 20 69 73 | .the.contents.of.register.`b'.is |
| 119b40 | 20 7a 65 72 6f 2e 20 20 41 20 74 65 73 74 20 61 6c 73 6f 20 68 61 73 20 61 72 72 6f 77 73 0a 66 | .zero...A.test.also.has.arrows.f |
| 119b60 | 72 6f 6d 20 69 74 73 20 69 6e 70 75 74 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 20 63 6f 6e 73 | rom.its.input.registers.and.cons |
| 119b80 | 74 61 6e 74 73 2c 20 62 75 74 20 69 74 20 68 61 73 20 6e 6f 20 6f 75 74 70 75 74 20 61 72 72 6f | tants,.but.it.has.no.output.arro |
| 119ba0 | 77 73 3b 0a 69 74 73 20 76 61 6c 75 65 20 69 73 20 75 73 65 64 20 62 79 20 74 68 65 20 63 6f 6e | ws;.its.value.is.used.by.the.con |
| 119bc0 | 74 72 6f 6c 6c 65 72 20 72 61 74 68 65 72 20 74 68 61 6e 20 62 79 20 74 68 65 20 64 61 74 61 20 | troller.rather.than.by.the.data. |
| 119be0 | 70 61 74 68 73 2e 0a 4f 76 65 72 61 6c 6c 2c 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 20 64 69 | paths..Overall,.the.data-path.di |
| 119c00 | 61 67 72 61 6d 20 73 68 6f 77 73 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 20 6f 70 | agram.shows.the.registers.and.op |
| 119c20 | 65 72 61 74 69 6f 6e 73 20 74 68 61 74 0a 61 72 65 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 74 | erations.that.are.required.for.t |
| 119c40 | 68 65 20 6d 61 63 68 69 6e 65 20 61 6e 64 20 68 6f 77 20 74 68 65 79 20 6d 75 73 74 20 62 65 20 | he.machine.and.how.they.must.be. |
| 119c60 | 63 6f 6e 6e 65 63 74 65 64 2e 20 20 49 66 20 77 65 0a 76 69 65 77 20 74 68 65 20 61 72 72 6f 77 | connected...If.we.view.the.arrow |
| 119c80 | 73 20 61 73 20 77 69 72 65 73 20 61 6e 64 20 74 68 65 20 60 58 27 20 62 75 74 74 6f 6e 73 20 61 | s.as.wires.and.the.`X'.buttons.a |
| 119ca0 | 73 20 73 77 69 74 63 68 65 73 2c 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 0a 64 69 61 67 72 61 | s.switches,.the.data-path.diagra |
| 119cc0 | 6d 20 69 73 20 76 65 72 79 20 6c 69 6b 65 20 74 68 65 20 77 69 72 69 6e 67 20 64 69 61 67 72 61 | m.is.very.like.the.wiring.diagra |
| 119ce0 | 6d 20 66 6f 72 20 61 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 63 6f 75 6c 64 20 62 65 0a 63 6f | m.for.a.machine.that.could.be.co |
| 119d00 | 6e 73 74 72 75 63 74 65 64 20 66 72 6f 6d 20 65 6c 65 63 74 72 69 63 61 6c 20 63 6f 6d 70 6f 6e | nstructed.from.electrical.compon |
| 119d20 | 65 6e 74 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 31 3a 2a 20 44 61 74 61 20 70 | ents........*Figure.5.1:*.Data.p |
| 119d40 | 61 74 68 73 20 66 6f 72 20 61 20 47 43 44 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 20 20 20 20 | aths.for.a.GCD.machine.......... |
| 119d60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 119d80 | 20 5f 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 | .___...........+-----+.......... |
| 119da0 | 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 2f 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 61 | +-----+...../...\...........|..a |
| 119dc0 | 20 20 7c 3c 2d 2d 28 58 29 2d 2d 2d 2d 7c 20 20 62 20 20 2b 2d 2d 2d 3e 7c 20 20 3d 20 20 7c 0a | ..|<--(X)----|..b..+--->|..=..|. |
| 119de0 | 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2b 2d 2d 2b 20 20 20 61 3c 2d 62 20 20 20 2b 2d 2b 2d 2d | ..........+--+--+...a<-b...+-+-- |
| 119e00 | 2d 2b 20 20 20 20 20 5c 5f 5f 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 | -+.....\___/..............|..... |
| 119e20 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 5e 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 | ..........|..^........^......... |
| 119e40 | 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 20 20 20 2b 2d 2d 2d 2d 2b 20 20 7c 20 20 20 20 20 20 20 | .....+------+...+----+..|....... |
| 119e60 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 20 | .|.....................|...|.... |
| 119e80 | 20 20 28 58 29 20 62 3c 2d 74 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e | ..(X).b<-t..|................... |
| 119ea0 | 2d 2d 2b 2d 2d 2d 2b 2d 2d 2e 20 20 20 20 7c 20 20 20 20 20 20 20 2f 20 5c 0a 20 20 20 20 20 20 | --+---+--.....|......./.\....... |
| 119ec0 | 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 20 72 65 6d 20 20 2f 20 20 20 20 20 7c 20 20 20 20 20 | ............\..rem../.....|..... |
| 119ee0 | 20 2f 20 4f 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 5f 5f | ./.O.\....................\_____ |
| 119f00 | 2f 20 20 20 20 20 20 7c 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 | /......|.....+-----+............ |
| 119f20 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 | ...........|.........|.......... |
| 119f40 | 20 20 20 20 20 20 20 20 20 20 20 20 28 58 29 20 74 3c 2d 72 20 20 20 7c 0a 20 20 20 20 20 20 20 | ............(X).t<-r...|........ |
| 119f60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 | ...............|.........|...... |
| 119f80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 | .................V.........|.... |
| 119fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 7c 0a 20 | ................+-----+......|.. |
| 119fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 74 20 20 2b 2d 2d 2d 2d 2d 2d 2b | ..................|..t..+------+ |
| 119fe0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 | ....................+-----+..... |
| 11a000 | 49 6e 20 6f 72 64 65 72 20 66 6f 72 20 74 68 65 20 64 61 74 61 20 70 61 74 68 73 20 74 6f 20 61 | In.order.for.the.data.paths.to.a |
| 11a020 | 63 74 75 61 6c 6c 79 20 63 6f 6d 70 75 74 65 20 47 43 44 73 2c 20 74 68 65 20 62 75 74 74 6f 6e | ctually.compute.GCDs,.the.button |
| 11a040 | 73 0a 6d 75 73 74 20 62 65 20 70 75 73 68 65 64 20 69 6e 20 74 68 65 20 63 6f 72 72 65 63 74 20 | s.must.be.pushed.in.the.correct. |
| 11a060 | 73 65 71 75 65 6e 63 65 2e 20 20 57 65 20 77 69 6c 6c 20 64 65 73 63 72 69 62 65 20 74 68 69 73 | sequence...We.will.describe.this |
| 11a080 | 20 73 65 71 75 65 6e 63 65 0a 69 6e 20 74 65 72 6d 73 20 6f 66 20 61 20 63 6f 6e 74 72 6f 6c 6c | .sequence.in.terms.of.a.controll |
| 11a0a0 | 65 72 20 64 69 61 67 72 61 6d 2c 20 61 73 20 69 6c 6c 75 73 74 72 61 74 65 64 20 69 6e 20 2a 4e | er.diagram,.as.illustrated.in.*N |
| 11a0c0 | 6f 74 65 20 46 69 67 75 72 65 20 35 2d 32 3a 3a 2e 0a 54 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f | ote.Figure.5-2::..The.elements.o |
| 11a0e0 | 66 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 64 69 61 67 72 61 6d 20 69 6e 64 69 63 61 74 | f.the.controller.diagram.indicat |
| 11a100 | 65 20 68 6f 77 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 0a 63 6f 6d 70 6f 6e 65 6e 74 73 20 73 | e.how.the.data-path.components.s |
| 11a120 | 68 6f 75 6c 64 20 62 65 20 6f 70 65 72 61 74 65 64 2e 20 20 54 68 65 20 72 65 63 74 61 6e 67 75 | hould.be.operated...The.rectangu |
| 11a140 | 6c 61 72 20 62 6f 78 65 73 20 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 0a 64 69 61 67 | lar.boxes.in.the.controller.diag |
| 11a160 | 72 61 6d 20 69 64 65 6e 74 69 66 79 20 64 61 74 61 2d 70 61 74 68 20 62 75 74 74 6f 6e 73 20 74 | ram.identify.data-path.buttons.t |
| 11a180 | 6f 20 62 65 20 70 75 73 68 65 64 2c 20 61 6e 64 20 74 68 65 20 61 72 72 6f 77 73 0a 64 65 73 63 | o.be.pushed,.and.the.arrows.desc |
| 11a1a0 | 72 69 62 65 20 74 68 65 20 73 65 71 75 65 6e 63 69 6e 67 20 66 72 6f 6d 20 6f 6e 65 20 73 74 65 | ribe.the.sequencing.from.one.ste |
| 11a1c0 | 70 20 74 6f 20 74 68 65 20 6e 65 78 74 2e 20 20 54 68 65 20 64 69 61 6d 6f 6e 64 20 69 6e 20 74 | p.to.the.next...The.diamond.in.t |
| 11a1e0 | 68 65 0a 64 69 61 67 72 61 6d 20 72 65 70 72 65 73 65 6e 74 73 20 61 20 64 65 63 69 73 69 6f 6e | he.diagram.represents.a.decision |
| 11a200 | 2e 20 20 4f 6e 65 20 6f 66 20 74 68 65 20 74 77 6f 20 73 65 71 75 65 6e 63 69 6e 67 20 61 72 72 | ...One.of.the.two.sequencing.arr |
| 11a220 | 6f 77 73 20 77 69 6c 6c 0a 62 65 20 66 6f 6c 6c 6f 77 65 64 2c 20 64 65 70 65 6e 64 69 6e 67 20 | ows.will.be.followed,.depending. |
| 11a240 | 6f 6e 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 20 74 65 | on.the.value.of.the.data-path.te |
| 11a260 | 73 74 20 69 64 65 6e 74 69 66 69 65 64 20 69 6e 0a 74 68 65 20 64 69 61 6d 6f 6e 64 2e 20 20 57 | st.identified.in.the.diamond...W |
| 11a280 | 65 20 63 61 6e 20 69 6e 74 65 72 70 72 65 74 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 69 | e.can.interpret.the.controller.i |
| 11a2a0 | 6e 20 74 65 72 6d 73 20 6f 66 20 61 20 70 68 79 73 69 63 61 6c 0a 61 6e 61 6c 6f 67 79 3a 20 54 | n.terms.of.a.physical.analogy:.T |
| 11a2c0 | 68 69 6e 6b 20 6f 66 20 74 68 65 20 64 69 61 67 72 61 6d 20 61 73 20 61 20 6d 61 7a 65 20 69 6e | hink.of.the.diagram.as.a.maze.in |
| 11a2e0 | 20 77 68 69 63 68 20 61 20 6d 61 72 62 6c 65 20 69 73 20 72 6f 6c 6c 69 6e 67 2e 0a 57 68 65 6e | .which.a.marble.is.rolling..When |
| 11a300 | 20 74 68 65 20 6d 61 72 62 6c 65 20 72 6f 6c 6c 73 20 69 6e 74 6f 20 61 20 62 6f 78 2c 20 69 74 | .the.marble.rolls.into.a.box,.it |
| 11a320 | 20 70 75 73 68 65 73 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 20 62 75 74 74 6f 6e 20 74 68 61 | .pushes.the.data-path.button.tha |
| 11a340 | 74 0a 69 73 20 6e 61 6d 65 64 20 62 79 20 74 68 65 20 62 6f 78 2e 20 20 57 68 65 6e 20 74 68 65 | t.is.named.by.the.box...When.the |
| 11a360 | 20 6d 61 72 62 6c 65 20 72 6f 6c 6c 73 20 69 6e 74 6f 20 61 20 64 65 63 69 73 69 6f 6e 20 6e 6f | .marble.rolls.into.a.decision.no |
| 11a380 | 64 65 20 28 73 75 63 68 0a 61 73 20 74 68 65 20 74 65 73 74 20 66 6f 72 20 60 62 27 20 3d 20 30 | de.(such.as.the.test.for.`b'.=.0 |
| 11a3a0 | 29 2c 20 69 74 20 6c 65 61 76 65 73 20 74 68 65 20 6e 6f 64 65 20 6f 6e 20 74 68 65 20 70 61 74 | ),.it.leaves.the.node.on.the.pat |
| 11a3c0 | 68 20 64 65 74 65 72 6d 69 6e 65 64 20 62 79 0a 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 74 68 | h.determined.by.the.result.of.th |
| 11a3e0 | 65 20 69 6e 64 69 63 61 74 65 64 20 74 65 73 74 2e 20 20 54 61 6b 65 6e 20 74 6f 67 65 74 68 65 | e.indicated.test...Taken.togethe |
| 11a400 | 72 2c 20 74 68 65 20 64 61 74 61 20 70 61 74 68 73 20 61 6e 64 0a 74 68 65 20 63 6f 6e 74 72 6f | r,.the.data.paths.and.the.contro |
| 11a420 | 6c 6c 65 72 20 63 6f 6d 70 6c 65 74 65 6c 79 20 64 65 73 63 72 69 62 65 20 61 20 6d 61 63 68 69 | ller.completely.describe.a.machi |
| 11a440 | 6e 65 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 20 47 43 44 73 2e 20 20 57 65 0a 73 74 61 72 74 | ne.for.computing.GCDs...We.start |
| 11a460 | 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 28 74 68 65 20 72 6f 6c 6c 69 6e 67 20 6d 61 72 | .the.controller.(the.rolling.mar |
| 11a480 | 62 6c 65 29 20 61 74 20 74 68 65 20 70 6c 61 63 65 20 6d 61 72 6b 65 64 20 60 73 74 61 72 74 27 | ble).at.the.place.marked.`start' |
| 11a4a0 | 2c 0a 61 66 74 65 72 20 70 6c 61 63 69 6e 67 20 6e 75 6d 62 65 72 73 20 69 6e 20 72 65 67 69 73 | ,.after.placing.numbers.in.regis |
| 11a4c0 | 74 65 72 73 20 60 61 27 20 61 6e 64 20 60 62 27 2e 20 20 57 68 65 6e 20 74 68 65 20 63 6f 6e 74 | ters.`a'.and.`b'...When.the.cont |
| 11a4e0 | 72 6f 6c 6c 65 72 0a 72 65 61 63 68 65 73 20 60 64 6f 6e 65 27 2c 20 77 65 20 77 69 6c 6c 20 66 | roller.reaches.`done',.we.will.f |
| 11a500 | 69 6e 64 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 47 43 44 20 69 6e 20 72 65 67 69 | ind.the.value.of.the.GCD.in.regi |
| 11a520 | 73 74 65 72 20 60 61 27 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 32 3a 2a 20 43 6f | ster.`a'........*Figure.5.2:*.Co |
| 11a540 | 6e 74 72 6f 6c 6c 65 72 20 66 6f 72 20 61 20 47 43 44 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 | ntroller.for.a.GCD.machine...... |
| 11a560 | 20 20 20 20 20 20 20 20 20 20 20 20 73 74 61 72 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............start............... |
| 11a580 | 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 | ...|..................V......... |
| 11a5a0 | 20 20 20 20 20 20 20 20 2f 20 5c 20 79 65 73 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 3e 3c | ......../.\.yes...........+--->< |
| 11a5c0 | 20 3d 20 3e 2d 2d 2d 2d 2d 3e 20 64 6f 6e 65 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 | .=.>----->.done...........|..... |
| 11a5e0 | 5c 20 2f 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 7c 20 6e 6f 0a 20 20 20 20 20 20 | \./...........|......|.no....... |
| 11a600 | 20 20 20 20 7c 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 2b 2d 2d 2d 2d 2d | ....|......V...........|..+----- |
| 11a620 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 74 3c 2d 72 20 7c 0a 20 20 20 20 20 20 20 | -+...........|..|.t<-r.|........ |
| 11a640 | 20 20 20 7c 20 20 2b 2d 2d 2d 2b 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | ...|..+---+--+...........|...... |
| 11a660 | 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 7c | |...........|......V...........| |
| 11a680 | 20 20 2b 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 61 3c 2d 62 20 7c | ..+------+...........|..|.a<-b.| |
| 11a6a0 | 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 2b 2d 2d 2d 2b 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 | ...........|..+---+--+.......... |
| 11a6c0 | 20 7c 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 56 0a 20 20 20 | .|......|...........|......V.... |
| 11a6e0 | 20 20 20 20 20 20 20 7c 20 20 2b 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d | .......|..+------+...........+-- |
| 11a700 | 2b 20 62 3c 2d 74 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 0a 0a | +.b<-t.|..............+------+.. |
| 11a720 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 31 3a 2a 20 44 65 73 69 67 6e 20 61 20 72 65 | .....*Exercise.5.1:*.Design.a.re |
| 11a740 | 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 66 61 63 74 6f 72 | gister.machine.to.compute.factor |
| 11a760 | 69 61 6c 73 0a 20 20 20 20 20 75 73 69 6e 67 20 74 68 65 20 69 74 65 72 61 74 69 76 65 20 61 6c | ials......using.the.iterative.al |
| 11a780 | 67 6f 72 69 74 68 6d 20 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 20 66 6f 6c 6c 6f 77 69 | gorithm.specified.by.the.followi |
| 11a7a0 | 6e 67 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 2e 20 20 44 72 61 77 20 64 61 74 61 2d 70 61 | ng......procedure...Draw.data-pa |
| 11a7c0 | 74 68 20 61 6e 64 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 64 69 61 67 72 61 6d 73 20 66 6f 72 20 74 | th.and.controller.diagrams.for.t |
| 11a7e0 | 68 69 73 0a 20 20 20 20 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 | his......machine.............(de |
| 11a800 | 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | fine.(factorial.n).............( |
| 11a820 | 64 65 66 69 6e 65 20 28 69 74 65 72 20 70 72 6f 64 75 63 74 20 63 6f 75 6e 74 65 72 29 0a 20 20 | define.(iter.product.counter)... |
| 11a840 | 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 63 6f 75 6e 74 65 72 20 6e 29 0a 20 20 | ............(if.(>.counter.n)... |
| 11a860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 20 | ................product......... |
| 11a880 | 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 28 2a 20 63 6f 75 6e 74 65 72 20 70 72 6f 64 75 | ..........(iter.(*.counter.produ |
| 11a8a0 | 63 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 63 | ct).........................(+.c |
| 11a8c0 | 6f 75 6e 74 65 72 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 31 | ounter.1)))).............(iter.1 |
| 11a8e0 | 20 31 29 29 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 35 2d 31 2d 31 3a 3a 20 20 20 20 20 20 20 20 | .1))..*.Menu:..*.5-1-1::........ |
| 11a900 | 20 20 20 20 41 20 4c 61 6e 67 75 61 67 65 20 66 6f 72 20 44 65 73 63 72 69 62 69 6e 67 20 52 65 | ....A.Language.for.Describing.Re |
| 11a920 | 67 69 73 74 65 72 20 4d 61 63 68 69 6e 65 73 0a 2a 20 35 2d 31 2d 32 3a 3a 20 20 20 20 20 20 20 | gister.Machines.*.5-1-2::....... |
| 11a940 | 20 20 20 20 20 41 62 73 74 72 61 63 74 69 6f 6e 20 69 6e 20 4d 61 63 68 69 6e 65 20 44 65 73 69 | .....Abstraction.in.Machine.Desi |
| 11a960 | 67 6e 0a 2a 20 35 2d 31 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 53 75 62 72 6f 75 74 69 | gn.*.5-1-3::............Subrouti |
| 11a980 | 6e 65 73 0a 2a 20 35 2d 31 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 55 73 69 6e 67 20 61 | nes.*.5-1-4::............Using.a |
| 11a9a0 | 20 53 74 61 63 6b 20 74 6f 20 49 6d 70 6c 65 6d 65 6e 74 20 52 65 63 75 72 73 69 6f 6e 0a 2a 20 | .Stack.to.Implement.Recursion.*. |
| 11a9c0 | 35 2d 31 2d 35 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 49 6e 73 74 72 75 63 74 69 6f 6e 20 53 | 5-1-5::............Instruction.S |
| 11a9e0 | 75 6d 6d 61 72 79 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 | ummary....File:.sicp.info,..Node |
| 11aa00 | 3a 20 35 2d 31 2d 31 2c 20 20 4e 65 78 74 3a 20 35 2d 31 2d 32 2c 20 20 50 72 65 76 3a 20 35 2d | :.5-1-1,..Next:.5-1-2,..Prev:.5- |
| 11aa20 | 31 2c 20 20 55 70 3a 20 35 2d 31 0a 0a 35 2e 31 2e 31 20 41 20 4c 61 6e 67 75 61 67 65 20 66 6f | 1,..Up:.5-1..5.1.1.A.Language.fo |
| 11aa40 | 72 20 44 65 73 63 72 69 62 69 6e 67 20 52 65 67 69 73 74 65 72 20 4d 61 63 68 69 6e 65 73 0a 2d | r.Describing.Register.Machines.- |
| 11aa60 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 11aa80 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 44 61 74 61 2d 70 61 74 68 20 61 6e 64 20 | ----------------..Data-path.and. |
| 11aaa0 | 63 6f 6e 74 72 6f 6c 6c 65 72 20 64 69 61 67 72 61 6d 73 20 61 72 65 20 61 64 65 71 75 61 74 65 | controller.diagrams.are.adequate |
| 11aac0 | 20 66 6f 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 73 69 6d 70 6c 65 0a 6d 61 63 68 69 6e 65 | .for.representing.simple.machine |
| 11aae0 | 73 20 73 75 63 68 20 61 73 20 47 43 44 2c 20 62 75 74 20 74 68 65 79 20 61 72 65 20 75 6e 77 69 | s.such.as.GCD,.but.they.are.unwi |
| 11ab00 | 65 6c 64 79 20 66 6f 72 20 64 65 73 63 72 69 62 69 6e 67 20 6c 61 72 67 65 0a 6d 61 63 68 69 6e | eldy.for.describing.large.machin |
| 11ab20 | 65 73 20 73 75 63 68 20 61 73 20 61 20 4c 69 73 70 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20 20 | es.such.as.a.Lisp.interpreter... |
| 11ab40 | 54 6f 20 6d 61 6b 65 20 69 74 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 64 65 61 6c 20 77 69 74 68 | To.make.it.possible.to.deal.with |
| 11ab60 | 0a 63 6f 6d 70 6c 65 78 20 6d 61 63 68 69 6e 65 73 2c 20 77 65 20 77 69 6c 6c 20 63 72 65 61 74 | .complex.machines,.we.will.creat |
| 11ab80 | 65 20 61 20 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 70 72 65 73 65 6e 74 73 2c 20 69 6e 20 74 | e.a.language.that.presents,.in.t |
| 11aba0 | 65 78 74 75 61 6c 0a 66 6f 72 6d 2c 20 61 6c 6c 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e | extual.form,.all.the.information |
| 11abc0 | 20 67 69 76 65 6e 20 62 79 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 20 61 6e 64 20 63 6f 6e 74 | .given.by.the.data-path.and.cont |
| 11abe0 | 72 6f 6c 6c 65 72 0a 64 69 61 67 72 61 6d 73 2e 20 20 57 65 20 77 69 6c 6c 20 73 74 61 72 74 20 | roller.diagrams...We.will.start. |
| 11ac00 | 77 69 74 68 20 61 20 6e 6f 74 61 74 69 6f 6e 20 74 68 61 74 20 64 69 72 65 63 74 6c 79 20 6d 69 | with.a.notation.that.directly.mi |
| 11ac20 | 72 72 6f 72 73 20 74 68 65 0a 64 69 61 67 72 61 6d 73 2e 0a 0a 20 20 20 57 65 20 64 65 66 69 6e | rrors.the.diagrams......We.defin |
| 11ac40 | 65 20 74 68 65 20 64 61 74 61 20 70 61 74 68 73 20 6f 66 20 61 20 6d 61 63 68 69 6e 65 20 62 79 | e.the.data.paths.of.a.machine.by |
| 11ac60 | 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 72 65 67 69 73 74 65 72 73 0a 61 6e 64 20 74 68 | .describing.the.registers.and.th |
| 11ac80 | 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 54 6f 20 64 65 73 63 72 69 62 65 20 61 20 72 65 67 | e.operations...To.describe.a.reg |
| 11aca0 | 69 73 74 65 72 2c 20 77 65 20 67 69 76 65 20 69 74 20 61 20 6e 61 6d 65 20 61 6e 64 0a 73 70 65 | ister,.we.give.it.a.name.and.spe |
| 11acc0 | 63 69 66 79 20 74 68 65 20 62 75 74 74 6f 6e 73 20 74 68 61 74 20 63 6f 6e 74 72 6f 6c 20 61 73 | cify.the.buttons.that.control.as |
| 11ace0 | 73 69 67 6e 6d 65 6e 74 20 74 6f 20 69 74 2e 20 20 57 65 20 67 69 76 65 20 65 61 63 68 20 6f 66 | signment.to.it...We.give.each.of |
| 11ad00 | 0a 74 68 65 73 65 20 62 75 74 74 6f 6e 73 20 61 20 6e 61 6d 65 20 61 6e 64 20 73 70 65 63 69 66 | .these.buttons.a.name.and.specif |
| 11ad20 | 79 20 74 68 65 20 73 6f 75 72 63 65 20 6f 66 20 74 68 65 20 64 61 74 61 20 74 68 61 74 20 65 6e | y.the.source.of.the.data.that.en |
| 11ad40 | 74 65 72 73 20 74 68 65 0a 72 65 67 69 73 74 65 72 20 75 6e 64 65 72 20 74 68 65 20 62 75 74 74 | ters.the.register.under.the.butt |
| 11ad60 | 6f 6e 27 73 20 63 6f 6e 74 72 6f 6c 2e 20 20 28 54 68 65 20 73 6f 75 72 63 65 20 69 73 20 61 20 | on's.control...(The.source.is.a. |
| 11ad80 | 72 65 67 69 73 74 65 72 2c 20 61 0a 63 6f 6e 73 74 61 6e 74 2c 20 6f 72 20 61 6e 20 6f 70 65 72 | register,.a.constant,.or.an.oper |
| 11ada0 | 61 74 69 6f 6e 2e 29 20 20 54 6f 20 64 65 73 63 72 69 62 65 20 61 6e 20 6f 70 65 72 61 74 69 6f | ation.)..To.describe.an.operatio |
| 11adc0 | 6e 2c 20 77 65 20 67 69 76 65 20 69 74 20 61 0a 6e 61 6d 65 20 61 6e 64 20 73 70 65 63 69 66 79 | n,.we.give.it.a.name.and.specify |
| 11ade0 | 20 69 74 73 20 69 6e 70 75 74 73 20 28 72 65 67 69 73 74 65 72 73 20 6f 72 20 63 6f 6e 73 74 61 | .its.inputs.(registers.or.consta |
| 11ae00 | 6e 74 73 29 2e 0a 0a 20 20 20 57 65 20 64 65 66 69 6e 65 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c | nts)......We.define.the.controll |
| 11ae20 | 65 72 20 6f 66 20 61 20 6d 61 63 68 69 6e 65 20 61 73 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 | er.of.a.machine.as.a.sequence.of |
| 11ae40 | 20 22 69 6e 73 74 72 75 63 74 69 6f 6e 73 22 0a 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 22 6c | ."instructions".together.with."l |
| 11ae60 | 61 62 65 6c 73 22 20 74 68 61 74 20 69 64 65 6e 74 69 66 79 20 22 65 6e 74 72 79 20 70 6f 69 6e | abels".that.identify."entry.poin |
| 11ae80 | 74 73 22 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 2e 20 41 6e 0a 69 6e 73 74 72 75 63 74 | ts".in.the.sequence..An.instruct |
| 11aea0 | 69 6f 6e 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 0a 20 20 | ion.is.one.of.the.following:.... |
| 11aec0 | 20 2a 20 54 68 65 20 6e 61 6d 65 20 6f 66 20 61 20 64 61 74 61 2d 70 61 74 68 20 62 75 74 74 6f | .*.The.name.of.a.data-path.butto |
| 11aee0 | 6e 20 74 6f 20 70 75 73 68 20 74 6f 20 61 73 73 69 67 6e 20 61 20 76 61 6c 75 65 20 74 6f 20 61 | n.to.push.to.assign.a.value.to.a |
| 11af00 | 0a 20 20 20 20 20 72 65 67 69 73 74 65 72 2e 20 20 28 54 68 69 73 20 63 6f 72 72 65 73 70 6f 6e | ......register...(This.correspon |
| 11af20 | 64 73 20 74 6f 20 61 20 62 6f 78 20 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 64 69 | ds.to.a.box.in.the.controller.di |
| 11af40 | 61 67 72 61 6d 2e 29 0a 0a 20 20 20 2a 20 41 20 60 74 65 73 74 27 20 69 6e 73 74 72 75 63 74 69 | agram.).....*.A.`test'.instructi |
| 11af60 | 6f 6e 2c 20 74 68 61 74 20 70 65 72 66 6f 72 6d 73 20 61 20 73 70 65 63 69 66 69 65 64 20 74 65 | on,.that.performs.a.specified.te |
| 11af80 | 73 74 2e 0a 0a 20 20 20 2a 20 41 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 62 72 61 6e 63 68 20 28 | st......*.A.conditional.branch.( |
| 11afa0 | 60 62 72 61 6e 63 68 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 29 20 74 6f 20 61 20 6c 6f 63 61 74 | `branch'.instruction).to.a.locat |
| 11afc0 | 69 6f 6e 0a 20 20 20 20 20 69 6e 64 69 63 61 74 65 64 20 62 79 20 61 20 63 6f 6e 74 72 6f 6c 6c | ion......indicated.by.a.controll |
| 11afe0 | 65 72 20 6c 61 62 65 6c 2c 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 | er.label,.based.on.the.result.of |
| 11b000 | 20 74 68 65 0a 20 20 20 20 20 70 72 65 76 69 6f 75 73 20 74 65 73 74 2e 20 20 28 54 68 65 20 74 | .the......previous.test...(The.t |
| 11b020 | 65 73 74 20 61 6e 64 20 62 72 61 6e 63 68 20 74 6f 67 65 74 68 65 72 20 63 6f 72 72 65 73 70 6f | est.and.branch.together.correspo |
| 11b040 | 6e 64 20 74 6f 20 61 0a 20 20 20 20 20 64 69 61 6d 6f 6e 64 20 69 6e 20 74 68 65 20 63 6f 6e 74 | nd.to.a......diamond.in.the.cont |
| 11b060 | 72 6f 6c 6c 65 72 20 64 69 61 67 72 61 6d 2e 29 20 20 49 66 20 74 68 65 20 74 65 73 74 20 69 73 | roller.diagram.)..If.the.test.is |
| 11b080 | 20 66 61 6c 73 65 2c 20 74 68 65 0a 20 20 20 20 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 68 6f 75 | .false,.the......controller.shou |
| 11b0a0 | 6c 64 20 63 6f 6e 74 69 6e 75 65 20 77 69 74 68 20 74 68 65 20 6e 65 78 74 20 69 6e 73 74 72 75 | ld.continue.with.the.next.instru |
| 11b0c0 | 63 74 69 6f 6e 20 69 6e 20 74 68 65 0a 20 20 20 20 20 73 65 71 75 65 6e 63 65 2e 20 20 4f 74 68 | ction.in.the......sequence...Oth |
| 11b0e0 | 65 72 77 69 73 65 2c 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 68 6f 75 6c 64 20 63 6f | erwise,.the.controller.should.co |
| 11b100 | 6e 74 69 6e 75 65 20 77 69 74 68 20 74 68 65 0a 20 20 20 20 20 69 6e 73 74 72 75 63 74 69 6f 6e | ntinue.with.the......instruction |
| 11b120 | 20 61 66 74 65 72 20 74 68 65 20 6c 61 62 65 6c 2e 0a 0a 20 20 20 2a 20 41 6e 20 75 6e 63 6f 6e | .after.the.label......*.An.uncon |
| 11b140 | 64 69 74 69 6f 6e 61 6c 20 62 72 61 6e 63 68 20 28 60 67 6f 74 6f 27 20 69 6e 73 74 72 75 63 74 | ditional.branch.(`goto'.instruct |
| 11b160 | 69 6f 6e 29 20 6e 61 6d 69 6e 67 20 61 20 63 6f 6e 74 72 6f 6c 6c 65 72 0a 20 20 20 20 20 6c 61 | ion).naming.a.controller......la |
| 11b180 | 62 65 6c 20 61 74 20 77 68 69 63 68 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20 65 78 65 63 75 74 69 | bel.at.which.to.continue.executi |
| 11b1a0 | 6f 6e 2e 0a 0a 0a 20 20 20 54 68 65 20 6d 61 63 68 69 6e 65 20 73 74 61 72 74 73 20 61 74 20 74 | on.......The.machine.starts.at.t |
| 11b1c0 | 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 69 | he.beginning.of.the.controller.i |
| 11b1e0 | 6e 73 74 72 75 63 74 69 6f 6e 0a 73 65 71 75 65 6e 63 65 20 61 6e 64 20 73 74 6f 70 73 20 77 68 | nstruction.sequence.and.stops.wh |
| 11b200 | 65 6e 20 65 78 65 63 75 74 69 6f 6e 20 72 65 61 63 68 65 73 20 74 68 65 20 65 6e 64 20 6f 66 20 | en.execution.reaches.the.end.of. |
| 11b220 | 74 68 65 20 73 65 71 75 65 6e 63 65 2e 0a 45 78 63 65 70 74 20 77 68 65 6e 20 61 20 62 72 61 6e | the.sequence..Except.when.a.bran |
| 11b240 | 63 68 20 63 68 61 6e 67 65 73 20 74 68 65 20 66 6c 6f 77 20 6f 66 20 63 6f 6e 74 72 6f 6c 2c 20 | ch.changes.the.flow.of.control,. |
| 11b260 | 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 61 72 65 0a 65 78 65 63 75 74 65 64 20 69 6e 20 74 68 65 | instructions.are.executed.in.the |
| 11b280 | 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 79 20 61 72 65 20 6c 69 73 74 65 64 2e | .order.in.which.they.are.listed. |
| 11b2a0 | 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 33 3a 2a 20 41 20 73 70 65 63 69 66 69 63 61 | .......*Figure.5.3:*.A.specifica |
| 11b2c0 | 74 69 6f 6e 20 6f 66 20 74 68 65 20 47 43 44 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 20 20 20 | tion.of.the.GCD.machine......... |
| 11b2e0 | 20 20 20 20 28 64 61 74 61 2d 70 61 74 68 73 0a 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 69 | ....(data-paths............(regi |
| 11b300 | 73 74 65 72 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e 61 6d 65 20 61 29 0a 20 20 20 20 | sters.............((name.a)..... |
| 11b320 | 20 20 20 20 20 20 20 20 20 28 62 75 74 74 6f 6e 73 20 28 28 6e 61 6d 65 20 61 3c 2d 62 29 20 28 | .........(buttons.((name.a<-b).( |
| 11b340 | 73 6f 75 72 63 65 20 28 72 65 67 69 73 74 65 72 20 62 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 | source.(register.b)))))......... |
| 11b360 | 20 20 20 20 28 28 6e 61 6d 65 20 62 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 75 74 74 | ....((name.b)..............(butt |
| 11b380 | 6f 6e 73 20 28 28 6e 61 6d 65 20 62 3c 2d 74 29 20 28 73 6f 75 72 63 65 20 28 72 65 67 69 73 74 | ons.((name.b<-t).(source.(regist |
| 11b3a0 | 65 72 20 74 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e 61 6d 65 20 74 29 0a | er.t))))).............((name.t). |
| 11b3c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 75 74 74 6f 6e 73 20 28 28 6e 61 6d 65 20 74 3c 2d | .............(buttons.((name.t<- |
| 11b3e0 | 72 29 20 28 73 6f 75 72 63 65 20 28 6f 70 65 72 61 74 69 6f 6e 20 72 65 6d 29 29 29 29 29 29 0a | r).(source.(operation.rem)))))). |
| 11b400 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 65 72 61 74 69 6f 6e 73 0a 20 20 20 20 20 20 20 20 | ............(operations......... |
| 11b420 | 20 20 20 20 28 28 6e 61 6d 65 20 72 65 6d 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 6e | ....((name.rem)..............(in |
| 11b440 | 70 75 74 73 20 28 72 65 67 69 73 74 65 72 20 61 29 20 28 72 65 67 69 73 74 65 72 20 62 29 29 29 | puts.(register.a).(register.b))) |
| 11b460 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e 61 6d 65 20 3d 29 0a 20 20 20 20 20 20 20 20 20 | .............((name.=).......... |
| 11b480 | 20 20 20 20 28 69 6e 70 75 74 73 20 28 72 65 67 69 73 74 65 72 20 62 29 20 28 63 6f 6e 73 74 61 | ....(inputs.(register.b).(consta |
| 11b4a0 | 6e 74 20 30 29 29 29 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 74 72 6f 6c 6c 65 72 | nt.0)))))............(controller |
| 11b4c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 2d 62 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............test-b.............. |
| 11b4e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 6c 61 62 65 6c 0a 20 20 20 20 20 20 20 20 20 20 20 | .............;.label............ |
| 11b500 | 20 20 28 74 65 73 74 20 3d 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..(test.=)...................... |
| 11b520 | 20 3b 20 74 65 73 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 | .;.test..............(branch.(la |
| 11b540 | 62 65 6c 20 67 63 64 2d 64 6f 6e 65 29 29 20 20 20 20 20 20 3b 20 63 6f 6e 64 69 74 69 6f 6e 61 | bel.gcd-done))......;.conditiona |
| 11b560 | 6c 20 62 72 61 6e 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 3c 2d 72 29 20 20 20 20 | l.branch..............(t<-r).... |
| 11b580 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 62 75 74 74 6f 6e 20 70 75 | .....................;.button.pu |
| 11b5a0 | 73 68 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 3c 2d 62 29 20 20 20 20 20 20 20 20 20 20 | sh..............(a<-b).......... |
| 11b5c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 62 75 74 74 6f 6e 20 70 75 73 68 0a 20 20 20 | ...............;.button.push.... |
| 11b5e0 | 20 20 20 20 20 20 20 20 20 20 28 62 3c 2d 74 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..........(b<-t)................ |
| 11b600 | 20 20 20 20 20 20 20 20 20 3b 20 62 75 74 74 6f 6e 20 70 75 73 68 0a 20 20 20 20 20 20 20 20 20 | .........;.button.push.......... |
| 11b620 | 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 74 65 73 74 2d 62 29 29 20 20 20 20 20 20 20 | ....(goto.(label.test-b))....... |
| 11b640 | 20 20 20 3b 20 75 6e 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 62 72 61 6e 63 68 0a 20 20 20 20 20 20 | ...;.unconditional.branch....... |
| 11b660 | 20 20 20 20 20 67 63 64 2d 64 6f 6e 65 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....gcd-done).................. |
| 11b680 | 20 20 20 20 20 20 3b 20 6c 61 62 65 6c 0a 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 | ......;.label......*Note.Figure. |
| 11b6a0 | 35 2d 33 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 47 43 44 20 6d 61 63 68 69 6e 65 20 64 65 73 63 | 5-3::.shows.the.GCD.machine.desc |
| 11b6c0 | 72 69 62 65 64 20 69 6e 20 74 68 69 73 20 77 61 79 2e 20 20 54 68 69 73 0a 65 78 61 6d 70 6c 65 | ribed.in.this.way...This.example |
| 11b6e0 | 20 6f 6e 6c 79 20 68 69 6e 74 73 20 61 74 20 74 68 65 20 67 65 6e 65 72 61 6c 69 74 79 20 6f 66 | .only.hints.at.the.generality.of |
| 11b700 | 20 74 68 65 73 65 20 64 65 73 63 72 69 70 74 69 6f 6e 73 2c 20 73 69 6e 63 65 20 74 68 65 0a 47 | .these.descriptions,.since.the.G |
| 11b720 | 43 44 20 6d 61 63 68 69 6e 65 20 69 73 20 61 20 76 65 72 79 20 73 69 6d 70 6c 65 20 63 61 73 65 | CD.machine.is.a.very.simple.case |
| 11b740 | 3a 20 45 61 63 68 20 72 65 67 69 73 74 65 72 20 68 61 73 20 6f 6e 6c 79 20 6f 6e 65 20 62 75 74 | :.Each.register.has.only.one.but |
| 11b760 | 74 6f 6e 2c 0a 61 6e 64 20 65 61 63 68 20 62 75 74 74 6f 6e 20 61 6e 64 20 74 65 73 74 20 69 73 | ton,.and.each.button.and.test.is |
| 11b780 | 20 75 73 65 64 20 6f 6e 6c 79 20 6f 6e 63 65 20 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 | .used.only.once.in.the.controlle |
| 11b7a0 | 72 2e 0a 0a 20 20 20 55 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 69 74 20 69 73 20 64 69 66 66 | r......Unfortunately,.it.is.diff |
| 11b7c0 | 69 63 75 6c 74 20 74 6f 20 72 65 61 64 20 73 75 63 68 20 61 20 64 65 73 63 72 69 70 74 69 6f 6e | icult.to.read.such.a.description |
| 11b7e0 | 2e 20 20 49 6e 20 6f 72 64 65 72 0a 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 74 68 65 20 63 6f | ...In.order.to.understand.the.co |
| 11b800 | 6e 74 72 6f 6c 6c 65 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 77 65 20 6d 75 73 74 20 63 6f | ntroller.instructions.we.must.co |
| 11b820 | 6e 73 74 61 6e 74 6c 79 20 72 65 66 65 72 20 62 61 63 6b 0a 74 6f 20 74 68 65 20 64 65 66 69 6e | nstantly.refer.back.to.the.defin |
| 11b840 | 69 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 62 75 74 74 6f 6e 20 6e 61 6d 65 73 20 61 6e 64 20 74 | itions.of.the.button.names.and.t |
| 11b860 | 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 6e 61 6d 65 73 2c 20 61 6e 64 20 74 6f 0a 75 6e 64 65 72 | he.operation.names,.and.to.under |
| 11b880 | 73 74 61 6e 64 20 77 68 61 74 20 74 68 65 20 62 75 74 74 6f 6e 73 20 64 6f 20 77 65 20 6d 61 79 | stand.what.the.buttons.do.we.may |
| 11b8a0 | 20 68 61 76 65 20 74 6f 20 72 65 66 65 72 20 74 6f 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e | .have.to.refer.to.the.definition |
| 11b8c0 | 73 0a 6f 66 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 6e 61 6d 65 73 2e 20 20 57 65 20 77 69 | s.of.the.operation.names...We.wi |
| 11b8e0 | 6c 6c 20 74 68 75 73 20 74 72 61 6e 73 66 6f 72 6d 20 6f 75 72 20 6e 6f 74 61 74 69 6f 6e 20 74 | ll.thus.transform.our.notation.t |
| 11b900 | 6f 20 63 6f 6d 62 69 6e 65 0a 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 72 6f 6d 20 74 | o.combine.the.information.from.t |
| 11b920 | 68 65 20 64 61 74 61 2d 70 61 74 68 20 61 6e 64 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 64 65 73 63 | he.data-path.and.controller.desc |
| 11b940 | 72 69 70 74 69 6f 6e 73 20 73 6f 20 74 68 61 74 0a 77 65 20 73 65 65 20 69 74 20 61 6c 6c 20 74 | riptions.so.that.we.see.it.all.t |
| 11b960 | 6f 67 65 74 68 65 72 2e 0a 0a 20 20 20 54 6f 20 6f 62 74 61 69 6e 20 74 68 69 73 20 66 6f 72 6d | ogether......To.obtain.this.form |
| 11b980 | 20 6f 66 20 64 65 73 63 72 69 70 74 69 6f 6e 2c 20 77 65 20 77 69 6c 6c 20 72 65 70 6c 61 63 65 | .of.description,.we.will.replace |
| 11b9a0 | 20 74 68 65 20 61 72 62 69 74 72 61 72 79 0a 62 75 74 74 6f 6e 20 61 6e 64 20 6f 70 65 72 61 74 | .the.arbitrary.button.and.operat |
| 11b9c0 | 69 6f 6e 20 6e 61 6d 65 73 20 62 79 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 | ion.names.by.the.definitions.of. |
| 11b9e0 | 74 68 65 69 72 20 62 65 68 61 76 69 6f 72 2e 20 20 54 68 61 74 0a 69 73 2c 20 69 6e 73 74 65 61 | their.behavior...That.is,.instea |
| 11ba00 | 64 20 6f 66 20 73 61 79 69 6e 67 20 28 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 29 20 | d.of.saying.(in.the.controller). |
| 11ba20 | 22 50 75 73 68 20 62 75 74 74 6f 6e 20 60 74 3c 2d 72 27 22 20 61 6e 64 0a 73 65 70 61 72 61 74 | "Push.button.`t<-r'".and.separat |
| 11ba40 | 65 6c 79 20 73 61 79 69 6e 67 20 28 69 6e 20 74 68 65 20 64 61 74 61 20 70 61 74 68 73 29 20 22 | ely.saying.(in.the.data.paths)." |
| 11ba60 | 42 75 74 74 6f 6e 20 60 74 3c 2d 72 27 20 61 73 73 69 67 6e 73 20 74 68 65 20 76 61 6c 75 65 0a | Button.`t<-r'.assigns.the.value. |
| 11ba80 | 6f 66 20 74 68 65 20 60 72 65 6d 27 20 6f 70 65 72 61 74 69 6f 6e 20 74 6f 20 72 65 67 69 73 74 | of.the.`rem'.operation.to.regist |
| 11baa0 | 65 72 20 60 74 27 22 20 61 6e 64 20 22 54 68 65 20 60 72 65 6d 27 20 6f 70 65 72 61 74 69 6f 6e | er.`t'".and."The.`rem'.operation |
| 11bac0 | 27 73 0a 69 6e 70 75 74 73 20 61 72 65 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 65 | 's.inputs.are.the.contents.of.re |
| 11bae0 | 67 69 73 74 65 72 73 20 60 61 27 20 61 6e 64 20 60 62 27 2c 22 20 77 65 20 77 69 6c 6c 20 73 61 | gisters.`a'.and.`b',".we.will.sa |
| 11bb00 | 79 20 28 69 6e 20 74 68 65 0a 63 6f 6e 74 72 6f 6c 6c 65 72 29 20 22 50 75 73 68 20 74 68 65 20 | y.(in.the.controller)."Push.the. |
| 11bb20 | 62 75 74 74 6f 6e 20 74 68 61 74 20 61 73 73 69 67 6e 73 20 74 6f 20 72 65 67 69 73 74 65 72 20 | button.that.assigns.to.register. |
| 11bb40 | 60 74 27 20 74 68 65 20 76 61 6c 75 65 20 6f 66 0a 74 68 65 20 60 72 65 6d 27 20 6f 70 65 72 61 | `t'.the.value.of.the.`rem'.opera |
| 11bb60 | 74 69 6f 6e 20 6f 6e 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 74 65 72 | tion.on.the.contents.of.register |
| 11bb80 | 73 20 60 61 27 20 61 6e 64 20 60 62 27 2e 22 0a 53 69 6d 69 6c 61 72 6c 79 2c 20 69 6e 73 74 65 | s.`a'.and.`b'.".Similarly,.inste |
| 11bba0 | 61 64 20 6f 66 20 73 61 79 69 6e 67 20 28 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 29 | ad.of.saying.(in.the.controller) |
| 11bbc0 | 20 22 50 65 72 66 6f 72 6d 20 74 68 65 20 60 3d 27 20 74 65 73 74 22 0a 61 6e 64 20 73 65 70 61 | ."Perform.the.`='.test".and.sepa |
| 11bbe0 | 72 61 74 65 6c 79 20 73 61 79 69 6e 67 20 28 69 6e 20 74 68 65 20 64 61 74 61 20 70 61 74 68 73 | rately.saying.(in.the.data.paths |
| 11bc00 | 29 20 22 54 68 65 20 60 3d 27 20 74 65 73 74 20 6f 70 65 72 61 74 65 73 20 6f 6e 20 74 68 65 0a | )."The.`='.test.operates.on.the. |
| 11bc20 | 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 74 65 72 20 60 62 27 20 61 6e 64 20 74 68 65 | contents.of.register.`b'.and.the |
| 11bc40 | 20 63 6f 6e 73 74 61 6e 74 20 30 2c 22 20 77 65 20 77 69 6c 6c 20 73 61 79 20 22 50 65 72 66 6f | .constant.0,".we.will.say."Perfo |
| 11bc60 | 72 6d 20 74 68 65 0a 60 3d 27 20 74 65 73 74 20 6f 6e 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 | rm.the.`='.test.on.the.contents. |
| 11bc80 | 6f 66 20 72 65 67 69 73 74 65 72 20 60 62 27 20 61 6e 64 20 74 68 65 20 63 6f 6e 73 74 61 6e 74 | of.register.`b'.and.the.constant |
| 11bca0 | 20 30 2e 22 20 20 57 65 20 77 69 6c 6c 0a 6f 6d 69 74 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 | .0."..We.will.omit.the.data-path |
| 11bcc0 | 20 64 65 73 63 72 69 70 74 69 6f 6e 2c 20 6c 65 61 76 69 6e 67 20 6f 6e 6c 79 20 74 68 65 20 63 | .description,.leaving.only.the.c |
| 11bce0 | 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 2e 0a 54 68 75 73 2c 20 74 68 65 20 47 43 | ontroller.sequence..Thus,.the.GC |
| 11bd00 | 44 20 6d 61 63 68 69 6e 65 20 69 73 20 64 65 73 63 72 69 62 65 64 20 61 73 20 66 6f 6c 6c 6f 77 | D.machine.is.described.as.follow |
| 11bd20 | 73 3a 0a 0a 20 20 20 20 20 28 63 6f 6e 74 72 6f 6c 6c 65 72 0a 20 20 20 20 20 20 74 65 73 74 2d | s:.......(controller.......test- |
| 11bd40 | 62 0a 20 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 3d 29 20 28 72 65 67 20 62 29 20 28 | b.........(test.(op.=).(reg.b).( |
| 11bd60 | 63 6f 6e 73 74 20 30 29 29 0a 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c | const.0)).........(branch.(label |
| 11bd80 | 20 67 63 64 2d 64 6f 6e 65 29 29 0a 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 20 28 6f | .gcd-done)).........(assign.t.(o |
| 11bda0 | 70 20 72 65 6d 29 20 28 72 65 67 20 61 29 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 | p.rem).(reg.a).(reg.b))......... |
| 11bdc0 | 28 61 73 73 69 67 6e 20 61 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 28 61 73 73 69 | (assign.a.(reg.b)).........(assi |
| 11bde0 | 67 6e 20 62 20 28 72 65 67 20 74 29 29 0a 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 | gn.b.(reg.t)).........(goto.(lab |
| 11be00 | 65 6c 20 74 65 73 74 2d 62 29 29 0a 20 20 20 20 20 20 67 63 64 2d 64 6f 6e 65 29 0a 0a 20 20 20 | el.test-b)).......gcd-done)..... |
| 11be20 | 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 64 65 73 63 72 69 70 74 69 6f 6e 20 69 73 20 65 61 73 69 | This.form.of.description.is.easi |
| 11be40 | 65 72 20 74 6f 20 72 65 61 64 20 74 68 61 6e 20 74 68 65 20 6b 69 6e 64 20 69 6c 6c 75 73 74 72 | er.to.read.than.the.kind.illustr |
| 11be60 | 61 74 65 64 0a 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 33 3a 3a 2c 20 62 75 74 20 | ated.in.*Note.Figure.5-3::,.but. |
| 11be80 | 69 74 20 61 6c 73 6f 20 68 61 73 20 64 69 73 61 64 76 61 6e 74 61 67 65 73 3a 0a 0a 20 20 20 2a | it.also.has.disadvantages:.....* |
| 11bea0 | 20 49 74 20 69 73 20 6d 6f 72 65 20 76 65 72 62 6f 73 65 20 66 6f 72 20 6c 61 72 67 65 20 6d 61 | .It.is.more.verbose.for.large.ma |
| 11bec0 | 63 68 69 6e 65 73 2c 20 62 65 63 61 75 73 65 20 63 6f 6d 70 6c 65 74 65 0a 20 20 20 20 20 64 65 | chines,.because.complete......de |
| 11bee0 | 73 63 72 69 70 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 20 65 6c 65 6d | scriptions.of.the.data-path.elem |
| 11bf00 | 65 6e 74 73 20 61 72 65 20 72 65 70 65 61 74 65 64 20 77 68 65 6e 65 76 65 72 20 74 68 65 0a 20 | ents.are.repeated.whenever.the.. |
| 11bf20 | 20 20 20 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 20 6d 65 6e 74 69 6f 6e 65 64 20 69 6e 20 74 68 | ....elements.are.mentioned.in.th |
| 11bf40 | 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 | e.controller.instruction.sequenc |
| 11bf60 | 65 2e 0a 20 20 20 20 20 28 54 68 69 73 20 69 73 20 6e 6f 74 20 61 20 70 72 6f 62 6c 65 6d 20 69 | e.......(This.is.not.a.problem.i |
| 11bf80 | 6e 20 74 68 65 20 47 43 44 20 65 78 61 6d 70 6c 65 2c 20 62 65 63 61 75 73 65 20 65 61 63 68 20 | n.the.GCD.example,.because.each. |
| 11bfa0 | 6f 70 65 72 61 74 69 6f 6e 0a 20 20 20 20 20 61 6e 64 20 62 75 74 74 6f 6e 20 69 73 20 75 73 65 | operation......and.button.is.use |
| 11bfc0 | 64 20 6f 6e 6c 79 20 6f 6e 63 65 2e 29 20 20 4d 6f 72 65 6f 76 65 72 2c 20 72 65 70 65 61 74 69 | d.only.once.)..Moreover,.repeati |
| 11bfe0 | 6e 67 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 0a 20 20 20 20 20 64 65 73 63 72 69 70 74 69 6f | ng.the.data-path......descriptio |
| 11c000 | 6e 73 20 6f 62 73 63 75 72 65 73 20 74 68 65 20 61 63 74 75 61 6c 20 64 61 74 61 2d 70 61 74 68 | ns.obscures.the.actual.data-path |
| 11c020 | 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 0a 20 20 20 20 20 6d 61 63 68 69 6e 65 3b 20 | .structure.of.the......machine;. |
| 11c040 | 69 74 20 69 73 20 6e 6f 74 20 6f 62 76 69 6f 75 73 20 66 6f 72 20 61 20 6c 61 72 67 65 20 6d 61 | it.is.not.obvious.for.a.large.ma |
| 11c060 | 63 68 69 6e 65 20 68 6f 77 20 6d 61 6e 79 20 72 65 67 69 73 74 65 72 73 2c 0a 20 20 20 20 20 6f | chine.how.many.registers,......o |
| 11c080 | 70 65 72 61 74 69 6f 6e 73 2c 20 61 6e 64 20 62 75 74 74 6f 6e 73 20 74 68 65 72 65 20 61 72 65 | perations,.and.buttons.there.are |
| 11c0a0 | 20 61 6e 64 20 68 6f 77 20 74 68 65 79 20 61 72 65 20 69 6e 74 65 72 63 6f 6e 6e 65 63 74 65 64 | .and.how.they.are.interconnected |
| 11c0c0 | 2e 0a 0a 20 20 20 2a 20 42 65 63 61 75 73 65 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 69 | ......*.Because.the.controller.i |
| 11c0e0 | 6e 73 74 72 75 63 74 69 6f 6e 73 20 69 6e 20 61 20 6d 61 63 68 69 6e 65 20 64 65 66 69 6e 69 74 | nstructions.in.a.machine.definit |
| 11c100 | 69 6f 6e 20 6c 6f 6f 6b 0a 20 20 20 20 20 6c 69 6b 65 20 4c 69 73 70 20 65 78 70 72 65 73 73 69 | ion.look......like.Lisp.expressi |
| 11c120 | 6f 6e 73 2c 20 69 74 20 69 73 20 65 61 73 79 20 74 6f 20 66 6f 72 67 65 74 20 74 68 61 74 20 74 | ons,.it.is.easy.to.forget.that.t |
| 11c140 | 68 65 79 20 61 72 65 20 6e 6f 74 0a 20 20 20 20 20 61 72 62 69 74 72 61 72 79 20 4c 69 73 70 20 | hey.are.not......arbitrary.Lisp. |
| 11c160 | 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 54 68 65 79 20 63 61 6e 20 6e 6f 74 61 74 65 20 6f 6e | expressions...They.can.notate.on |
| 11c180 | 6c 79 20 6c 65 67 61 6c 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 | ly.legal.machine......operations |
| 11c1a0 | 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 6f 70 65 72 61 74 69 6f 6e 73 20 63 61 6e 20 6f | ...For.example,.operations.can.o |
| 11c1c0 | 70 65 72 61 74 65 20 64 69 72 65 63 74 6c 79 20 6f 6e 6c 79 20 6f 6e 0a 20 20 20 20 20 63 6f 6e | perate.directly.only.on......con |
| 11c1e0 | 73 74 61 6e 74 73 20 61 6e 64 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 | stants.and.the.contents.of.regis |
| 11c200 | 74 65 72 73 2c 20 6e 6f 74 20 6f 6e 20 74 68 65 20 72 65 73 75 6c 74 73 20 6f 66 0a 20 20 20 20 | ters,.not.on.the.results.of..... |
| 11c220 | 20 6f 74 68 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 0a 20 20 20 49 6e 20 73 70 69 74 65 | .other.operations.......In.spite |
| 11c240 | 20 6f 66 20 74 68 65 73 65 20 64 69 73 61 64 76 61 6e 74 61 67 65 73 2c 20 77 65 20 77 69 6c 6c | .of.these.disadvantages,.we.will |
| 11c260 | 20 75 73 65 20 74 68 69 73 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 0a 6c 61 6e 67 75 | .use.this.register-machine.langu |
| 11c280 | 61 67 65 20 74 68 72 6f 75 67 68 6f 75 74 20 74 68 69 73 20 63 68 61 70 74 65 72 2c 20 62 65 63 | age.throughout.this.chapter,.bec |
| 11c2a0 | 61 75 73 65 20 77 65 20 77 69 6c 6c 20 62 65 20 6d 6f 72 65 20 63 6f 6e 63 65 72 6e 65 64 0a 77 | ause.we.will.be.more.concerned.w |
| 11c2c0 | 69 74 68 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 63 6f 6e 74 72 6f 6c 6c 65 72 73 20 74 68 | ith.understanding.controllers.th |
| 11c2e0 | 61 6e 20 77 69 74 68 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 74 68 65 20 65 6c 65 6d 65 6e | an.with.understanding.the.elemen |
| 11c300 | 74 73 20 61 6e 64 0a 63 6f 6e 6e 65 63 74 69 6f 6e 73 20 69 6e 20 64 61 74 61 20 70 61 74 68 73 | ts.and.connections.in.data.paths |
| 11c320 | 2e 20 20 57 65 20 73 68 6f 75 6c 64 20 6b 65 65 70 20 69 6e 20 6d 69 6e 64 2c 20 68 6f 77 65 76 | ...We.should.keep.in.mind,.howev |
| 11c340 | 65 72 2c 20 74 68 61 74 0a 64 61 74 61 2d 70 61 74 68 20 64 65 73 69 67 6e 20 69 73 20 63 72 75 | er,.that.data-path.design.is.cru |
| 11c360 | 63 69 61 6c 20 69 6e 20 64 65 73 69 67 6e 69 6e 67 20 72 65 61 6c 20 6d 61 63 68 69 6e 65 73 2e | cial.in.designing.real.machines. |
| 11c380 | 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 32 3a 2a 20 55 73 65 20 74 68 65 20 72 | .......*Exercise.5.2:*.Use.the.r |
| 11c3a0 | 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 20 74 6f 20 64 65 73 63 | egister-machine.language.to.desc |
| 11c3c0 | 72 69 62 65 20 74 68 65 0a 20 20 20 20 20 69 74 65 72 61 74 69 76 65 20 66 61 63 74 6f 72 69 61 | ribe.the......iterative.factoria |
| 11c3e0 | 6c 20 6d 61 63 68 69 6e 65 20 6f 66 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 31 3a | l.machine.of.*Note.Exercise.5-1: |
| 11c400 | 3a 2e 0a 0a 41 63 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 0a 0a 4c 65 74 20 75 73 20 6d 6f 64 69 | :...Actions..........Let.us.modi |
| 11c420 | 66 79 20 74 68 65 20 47 43 44 20 6d 61 63 68 69 6e 65 20 73 6f 20 74 68 61 74 20 77 65 20 63 61 | fy.the.GCD.machine.so.that.we.ca |
| 11c440 | 6e 20 74 79 70 65 20 69 6e 20 74 68 65 20 6e 75 6d 62 65 72 73 20 77 68 6f 73 65 0a 47 43 44 20 | n.type.in.the.numbers.whose.GCD. |
| 11c460 | 77 65 20 77 61 6e 74 20 61 6e 64 20 67 65 74 20 74 68 65 20 61 6e 73 77 65 72 20 70 72 69 6e 74 | we.want.and.get.the.answer.print |
| 11c480 | 65 64 20 61 74 20 6f 75 72 20 74 65 72 6d 69 6e 61 6c 2e 20 20 57 65 20 77 69 6c 6c 20 6e 6f 74 | ed.at.our.terminal...We.will.not |
| 11c4a0 | 0a 64 69 73 63 75 73 73 20 68 6f 77 20 74 6f 20 6d 61 6b 65 20 61 20 6d 61 63 68 69 6e 65 20 74 | .discuss.how.to.make.a.machine.t |
| 11c4c0 | 68 61 74 20 63 61 6e 20 72 65 61 64 20 61 6e 64 20 70 72 69 6e 74 2c 20 62 75 74 20 77 69 6c 6c | hat.can.read.and.print,.but.will |
| 11c4e0 | 20 61 73 73 75 6d 65 0a 28 61 73 20 77 65 20 64 6f 20 77 68 65 6e 20 77 65 20 75 73 65 20 60 72 | .assume.(as.we.do.when.we.use.`r |
| 11c500 | 65 61 64 27 20 61 6e 64 20 60 64 69 73 70 6c 61 79 27 20 69 6e 20 53 63 68 65 6d 65 29 20 74 68 | ead'.and.`display'.in.Scheme).th |
| 11c520 | 61 74 20 74 68 65 79 20 61 72 65 0a 61 76 61 69 6c 61 62 6c 65 20 61 73 20 70 72 69 6d 69 74 69 | at.they.are.available.as.primiti |
| 11c540 | 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 28 31 29 0a 0a 20 20 20 60 52 65 61 64 27 20 69 73 20 | ve.operations.(1).....`Read'.is. |
| 11c560 | 6c 69 6b 65 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 65 20 68 61 76 65 20 62 65 65 6e | like.the.operations.we.have.been |
| 11c580 | 20 75 73 69 6e 67 20 69 6e 20 74 68 61 74 20 69 74 20 70 72 6f 64 75 63 65 73 0a 61 20 76 61 6c | .using.in.that.it.produces.a.val |
| 11c5a0 | 75 65 20 74 68 61 74 20 63 61 6e 20 62 65 20 73 74 6f 72 65 64 20 69 6e 20 61 20 72 65 67 69 73 | ue.that.can.be.stored.in.a.regis |
| 11c5c0 | 74 65 72 2e 20 20 42 75 74 20 60 72 65 61 64 27 20 64 6f 65 73 20 6e 6f 74 20 74 61 6b 65 0a 69 | ter...But.`read'.does.not.take.i |
| 11c5e0 | 6e 70 75 74 73 20 66 72 6f 6d 20 61 6e 79 20 72 65 67 69 73 74 65 72 73 3b 20 69 74 73 20 76 61 | nputs.from.any.registers;.its.va |
| 11c600 | 6c 75 65 20 64 65 70 65 6e 64 73 20 6f 6e 20 73 6f 6d 65 74 68 69 6e 67 20 74 68 61 74 20 68 61 | lue.depends.on.something.that.ha |
| 11c620 | 70 70 65 6e 73 0a 6f 75 74 73 69 64 65 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 74 68 65 20 6d | ppens.outside.the.parts.of.the.m |
| 11c640 | 61 63 68 69 6e 65 20 77 65 20 61 72 65 20 64 65 73 69 67 6e 69 6e 67 2e 20 20 57 65 20 77 69 6c | achine.we.are.designing...We.wil |
| 11c660 | 6c 20 61 6c 6c 6f 77 20 6f 75 72 0a 6d 61 63 68 69 6e 65 27 73 20 6f 70 65 72 61 74 69 6f 6e 73 | l.allow.our.machine's.operations |
| 11c680 | 20 74 6f 20 68 61 76 65 20 73 75 63 68 20 62 65 68 61 76 69 6f 72 2c 20 61 6e 64 20 74 68 75 73 | .to.have.such.behavior,.and.thus |
| 11c6a0 | 20 77 69 6c 6c 20 64 72 61 77 20 61 6e 64 0a 6e 6f 74 61 74 65 20 74 68 65 20 75 73 65 20 6f 66 | .will.draw.and.notate.the.use.of |
| 11c6c0 | 20 60 72 65 61 64 27 20 6a 75 73 74 20 61 73 20 77 65 20 64 6f 20 61 6e 79 20 6f 74 68 65 72 20 | .`read'.just.as.we.do.any.other. |
| 11c6e0 | 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 0a 63 6f 6d 70 75 74 65 73 20 61 20 76 61 6c 75 65 2e | operation.that.computes.a.value. |
| 11c700 | 0a 0a 20 20 20 60 50 72 69 6e 74 27 2c 20 6f 6e 20 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c | .....`Print',.on.the.other.hand, |
| 11c720 | 20 64 69 66 66 65 72 73 20 66 72 6f 6d 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 65 20 | .differs.from.the.operations.we. |
| 11c740 | 68 61 76 65 20 62 65 65 6e 0a 75 73 69 6e 67 20 69 6e 20 61 20 66 75 6e 64 61 6d 65 6e 74 61 6c | have.been.using.in.a.fundamental |
| 11c760 | 20 77 61 79 3a 20 49 74 20 64 6f 65 73 20 6e 6f 74 20 70 72 6f 64 75 63 65 20 61 6e 20 6f 75 74 | .way:.It.does.not.produce.an.out |
| 11c780 | 70 75 74 20 76 61 6c 75 65 20 74 6f 20 62 65 0a 73 74 6f 72 65 64 20 69 6e 20 61 20 72 65 67 69 | put.value.to.be.stored.in.a.regi |
| 11c7a0 | 73 74 65 72 2e 20 20 54 68 6f 75 67 68 20 69 74 20 68 61 73 20 61 6e 20 65 66 66 65 63 74 2c 20 | ster...Though.it.has.an.effect,. |
| 11c7c0 | 74 68 69 73 20 65 66 66 65 63 74 20 69 73 20 6e 6f 74 20 6f 6e 20 61 0a 70 61 72 74 20 6f 66 20 | this.effect.is.not.on.a.part.of. |
| 11c7e0 | 74 68 65 20 6d 61 63 68 69 6e 65 20 77 65 20 61 72 65 20 64 65 73 69 67 6e 69 6e 67 2e 20 20 57 | the.machine.we.are.designing...W |
| 11c800 | 65 20 77 69 6c 6c 20 72 65 66 65 72 20 74 6f 20 74 68 69 73 20 6b 69 6e 64 20 6f 66 0a 6f 70 65 | e.will.refer.to.this.kind.of.ope |
| 11c820 | 72 61 74 69 6f 6e 20 61 73 20 61 6e 20 22 61 63 74 69 6f 6e 22 2e 20 20 57 65 20 77 69 6c 6c 20 | ration.as.an."action"...We.will. |
| 11c840 | 72 65 70 72 65 73 65 6e 74 20 61 6e 20 61 63 74 69 6f 6e 20 69 6e 20 61 20 64 61 74 61 2d 70 61 | represent.an.action.in.a.data-pa |
| 11c860 | 74 68 0a 64 69 61 67 72 61 6d 20 6a 75 73 74 20 61 73 20 77 65 20 72 65 70 72 65 73 65 6e 74 20 | th.diagram.just.as.we.represent. |
| 11c880 | 61 6e 20 6f 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 61 20 76 61 6c | an.operation.that.computes.a.val |
| 11c8a0 | 75 65 2d 2d 61 73 20 61 0a 74 72 61 70 65 7a 6f 69 64 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 | ue--as.a.trapezoid.that.contains |
| 11c8c0 | 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 61 63 74 69 6f 6e 2e 20 20 41 72 72 6f 77 73 | .the.name.of.the.action...Arrows |
| 11c8e0 | 20 70 6f 69 6e 74 20 74 6f 20 74 68 65 0a 61 63 74 69 6f 6e 20 62 6f 78 20 66 72 6f 6d 20 61 6e | .point.to.the.action.box.from.an |
| 11c900 | 79 20 69 6e 70 75 74 73 20 28 72 65 67 69 73 74 65 72 73 20 6f 72 20 63 6f 6e 73 74 61 6e 74 73 | y.inputs.(registers.or.constants |
| 11c920 | 29 2e 20 20 57 65 20 61 6c 73 6f 20 61 73 73 6f 63 69 61 74 65 0a 61 20 62 75 74 74 6f 6e 20 77 | )...We.also.associate.a.button.w |
| 11c940 | 69 74 68 20 74 68 65 20 61 63 74 69 6f 6e 2e 20 20 50 75 73 68 69 6e 67 20 74 68 65 20 62 75 74 | ith.the.action...Pushing.the.but |
| 11c960 | 74 6f 6e 20 6d 61 6b 65 73 20 74 68 65 20 61 63 74 69 6f 6e 20 68 61 70 70 65 6e 2e 0a 54 6f 20 | ton.makes.the.action.happen..To. |
| 11c980 | 6d 61 6b 65 20 61 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 70 75 73 68 20 61 6e 20 61 63 74 69 6f 6e | make.a.controller.push.an.action |
| 11c9a0 | 20 62 75 74 74 6f 6e 20 77 65 20 75 73 65 20 61 20 6e 65 77 20 6b 69 6e 64 20 6f 66 0a 69 6e 73 | .button.we.use.a.new.kind.of.ins |
| 11c9c0 | 74 72 75 63 74 69 6f 6e 20 63 61 6c 6c 65 64 20 60 70 65 72 66 6f 72 6d 27 2e 20 20 54 68 75 73 | truction.called.`perform'...Thus |
| 11c9e0 | 2c 20 74 68 65 20 61 63 74 69 6f 6e 20 6f 66 20 70 72 69 6e 74 69 6e 67 20 74 68 65 0a 63 6f 6e | ,.the.action.of.printing.the.con |
| 11ca00 | 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 74 65 72 20 60 61 27 20 69 73 20 72 65 70 72 65 73 65 | tents.of.register.`a'.is.represe |
| 11ca20 | 6e 74 65 64 20 69 6e 20 61 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 20 62 79 | nted.in.a.controller.sequence.by |
| 11ca40 | 20 74 68 65 0a 69 6e 73 74 72 75 63 74 69 6f 6e 0a 0a 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 | .the.instruction.......(perform. |
| 11ca60 | 28 6f 70 20 70 72 69 6e 74 29 20 28 72 65 67 20 61 29 29 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 | (op.print).(reg.a)).....*Note.Fi |
| 11ca80 | 67 75 72 65 20 35 2d 34 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 64 61 74 61 20 70 61 74 68 73 20 | gure.5-4::.shows.the.data.paths. |
| 11caa0 | 61 6e 64 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 66 6f 72 20 74 68 65 20 6e 65 77 0a 47 43 44 20 6d | and.controller.for.the.new.GCD.m |
| 11cac0 | 61 63 68 69 6e 65 2e 20 20 49 6e 73 74 65 61 64 20 6f 66 20 68 61 76 69 6e 67 20 74 68 65 20 6d | achine...Instead.of.having.the.m |
| 11cae0 | 61 63 68 69 6e 65 20 73 74 6f 70 20 61 66 74 65 72 20 70 72 69 6e 74 69 6e 67 20 74 68 65 0a 61 | achine.stop.after.printing.the.a |
| 11cb00 | 6e 73 77 65 72 2c 20 77 65 20 68 61 76 65 20 6d 61 64 65 20 69 74 20 73 74 61 72 74 20 6f 76 65 | nswer,.we.have.made.it.start.ove |
| 11cb20 | 72 2c 20 73 6f 20 74 68 61 74 20 69 74 20 72 65 70 65 61 74 65 64 6c 79 20 72 65 61 64 73 20 61 | r,.so.that.it.repeatedly.reads.a |
| 11cb40 | 20 70 61 69 72 0a 6f 66 20 6e 75 6d 62 65 72 73 2c 20 63 6f 6d 70 75 74 65 73 20 74 68 65 69 72 | .pair.of.numbers,.computes.their |
| 11cb60 | 20 47 43 44 2c 20 61 6e 64 20 70 72 69 6e 74 73 20 74 68 65 20 72 65 73 75 6c 74 2e 20 20 54 68 | .GCD,.and.prints.the.result...Th |
| 11cb80 | 69 73 20 73 74 72 75 63 74 75 72 65 0a 69 73 20 6c 69 6b 65 20 74 68 65 20 64 72 69 76 65 72 20 | is.structure.is.like.the.driver. |
| 11cba0 | 6c 6f 6f 70 73 20 77 65 20 75 73 65 64 20 69 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 | loops.we.used.in.the.interpreter |
| 11cbc0 | 73 20 6f 66 20 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 0a 34 3a 3a 2e 0a 0a 20 20 20 20 20 2a 46 | s.of.*Note.Chapter.4::........*F |
| 11cbe0 | 69 67 75 72 65 20 35 2e 34 3a 2a 20 41 20 47 43 44 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 72 | igure.5.4:*.A.GCD.machine.that.r |
| 11cc00 | 65 61 64 73 20 69 6e 70 75 74 73 20 61 6e 64 20 70 72 69 6e 74 73 20 72 65 73 75 6c 74 73 2e 0a | eads.inputs.and.prints.results.. |
| 11cc20 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2d | ...............................- |
| 11cc40 | 2d 2d 2d 2d 2d 2d 2d 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -------......................... |
| 11cc60 | 20 20 20 20 20 20 20 5c 20 72 65 61 64 20 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......\.read./................. |
| 11cc80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 | ...............\____/........... |
| 11cca0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 | .......................|........ |
| 11ccc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2a 2d 2d 2d 2d 2d | ..................+-------*----- |
| 11cce0 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | -+..........................|... |
| 11cd00 | 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 | ...........|...................a |
| 11cd20 | 3c 2d 72 64 20 28 58 29 20 20 20 20 20 20 20 20 20 20 20 20 28 58 29 20 62 3c 2d 72 64 0a 20 20 | <-rd.(X)............(X).b<-rd... |
| 11cd40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 | .......................|........ |
| 11cd60 | 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......|......................... |
| 11cd80 | 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 5f 5f 5f 0a | .V..............V...........___. |
| 11cda0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 | ......................+-----+... |
| 11cdc0 | 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 2f 20 20 20 5c 0a 20 20 20 20 20 20 20 | .....+-----+......./...\........ |
| 11cde0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 61 20 20 7c 3c 2d 2d 28 58 29 2d 2d 2b 20 | ...............|..a..|<--(X)--+. |
| 11ce00 | 20 62 20 20 2b 2d 2d 2d 2d 2d 3e 7c 20 20 3d 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .b..+----->|..=..|.............. |
| 11ce20 | 20 20 20 20 20 20 20 20 20 2b 2d 2b 2d 2b 2d 2b 20 20 61 3c 2d 62 20 20 2b 2d 2b 2d 2d 2d 2b 20 | .........+-+-+-+..a<-b..+-+---+. |
| 11ce40 | 20 20 20 20 20 20 5c 5f 5f 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......\___/..................... |
| 11ce60 | 20 20 20 20 7c 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 5e 20 20 20 20 20 20 20 20 20 | ....|.|............|..^......... |
| 11ce80 | 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2b 20 2b 2d 2d | .^......................+--+.+-- |
| 11cea0 | 2d 2d 2b 20 20 20 20 2b 2d 2d 2b 20 20 7c 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 | --+....+--+..|..........|....... |
| 11cec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 7c 20 | ...............|.........|....|. |
| 11cee0 | 20 20 20 28 58 29 20 62 3c 2d 74 20 20 20 2f 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...(X).b<-t.../.\............... |
| 11cf00 | 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 56 20 20 20 20 56 20 20 20 20 20 7c 20 20 20 | .......V.........V....V.....|... |
| 11cf20 | 20 20 20 20 20 2f 20 4f 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2d 2d 2d 2d | ...../.O.\..................---- |
| 11cf40 | 2d 2d 2d 2d 2d 2e 20 20 2e 2d 2d 2d 2d 2d 2d 2d 2d 2d 2e 20 20 7c 20 20 20 20 20 20 20 2f 5f 5f | -----....---------...|......./__ |
| 11cf60 | 5f 5f 5f 5c 0a 20 20 20 20 20 20 20 20 20 20 2d 2d 28 58 29 2d 3e 5c 20 70 72 69 6e 74 20 2f 20 | ___\...........--(X)->\.print./. |
| 11cf80 | 20 20 20 5c 20 20 72 65 6d 20 20 2f 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 50 20 | ...\..rem../...|..............P. |
| 11cfa0 | 20 20 20 5c 5f 5f 5f 5f 5f 2f 20 20 20 20 20 20 5c 5f 5f 5f 5f 5f 2f 20 20 20 20 7c 0a 20 20 20 | ...\_____/......\_____/....|.... |
| 11cfc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | ...............................| |
| 11cfe0 | 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......|........................ |
| 11d000 | 20 20 20 20 20 20 20 20 20 20 28 58 29 20 74 3c 2d 72 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | ..........(X).t<-r.|............ |
| 11d020 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 7c | .......................|.......| |
| 11d040 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 11d060 | 20 20 20 56 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...V.......|.................... |
| 11d080 | 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 7c 0a 20 20 20 20 20 20 20 | ............+-----+....|........ |
| 11d0a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 74 20 20 2b 2d | ........................|..t..+- |
| 11d0c0 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ---+............................ |
| 11d0e0 | 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 74 72 6f 6c | ....+-----+.............(control |
| 11d100 | 6c 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 67 63 64 2d 6c 6f 6f 70 0a 20 20 20 20 20 20 20 | ler.............gcd-loop........ |
| 11d120 | 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 20 28 6f 70 20 72 65 61 64 29 29 0a 20 20 20 20 | .......(assign.a.(op.read))..... |
| 11d140 | 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 62 20 28 6f 70 20 72 65 61 64 29 29 0a 20 | ..........(assign.b.(op.read)).. |
| 11d160 | 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 2d 62 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........test-b............... |
| 11d180 | 28 74 65 73 74 20 28 6f 70 20 3d 29 20 28 72 65 67 20 62 29 20 28 63 6f 6e 73 74 20 30 29 29 0a | (test.(op.=).(reg.b).(const.0)). |
| 11d1a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 67 63 64 | ..............(branch.(label.gcd |
| 11d1c0 | 2d 64 6f 6e 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 20 | -done))...............(assign.t. |
| 11d1e0 | 28 6f 70 20 72 65 6d 29 20 28 72 65 67 20 61 29 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 | (op.rem).(reg.a).(reg.b))....... |
| 11d200 | 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 | ........(assign.a.(reg.b))...... |
| 11d220 | 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 62 20 28 72 65 67 20 74 29 29 0a 20 20 20 20 | .........(assign.b.(reg.t))..... |
| 11d240 | 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 74 65 73 74 2d 62 29 29 0a | ..........(goto.(label.test-b)). |
| 11d260 | 20 20 20 20 20 20 20 20 20 20 20 20 67 63 64 2d 64 6f 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 | ............gcd-done............ |
| 11d280 | 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 70 72 69 6e 74 29 20 28 72 65 67 20 61 29 29 0a | ...(perform.(op.print).(reg.a)). |
| 11d2a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 67 63 64 2d 6c | ..............(goto.(label.gcd-l |
| 11d2c0 | 6f 6f 70 29 29 29 0a 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 | oop)))......----------.Footnotes |
| 11d2e0 | 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 69 73 20 61 73 73 75 6d 70 74 | .----------.....(1).This.assumpt |
| 11d300 | 69 6f 6e 20 67 6c 6f 73 73 65 73 20 6f 76 65 72 20 61 20 67 72 65 61 74 20 64 65 61 6c 20 6f 66 | ion.glosses.over.a.great.deal.of |
| 11d320 | 20 63 6f 6d 70 6c 65 78 69 74 79 2e 0a 55 73 75 61 6c 6c 79 20 61 20 6c 61 72 67 65 20 70 6f 72 | .complexity..Usually.a.large.por |
| 11d340 | 74 69 6f 6e 20 6f 66 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 20 | tion.of.the.implementation.of.a. |
| 11d360 | 4c 69 73 70 20 73 79 73 74 65 6d 20 69 73 0a 64 65 64 69 63 61 74 65 64 20 74 6f 20 6d 61 6b 69 | Lisp.system.is.dedicated.to.maki |
| 11d380 | 6e 67 20 72 65 61 64 69 6e 67 20 61 6e 64 20 70 72 69 6e 74 69 6e 67 20 77 6f 72 6b 2e 0a 0a 1f | ng.reading.and.printing.work.... |
| 11d3a0 | 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 31 2d 32 2c 20 | .File:.sicp.info,..Node:.5-1-2,. |
| 11d3c0 | 20 4e 65 78 74 3a 20 35 2d 31 2d 33 2c 20 20 50 72 65 76 3a 20 35 2d 31 2d 31 2c 20 20 55 70 3a | .Next:.5-1-3,..Prev:.5-1-1,..Up: |
| 11d3e0 | 20 35 2d 31 0a 0a 35 2e 31 2e 32 20 41 62 73 74 72 61 63 74 69 6f 6e 20 69 6e 20 4d 61 63 68 69 | .5-1..5.1.2.Abstraction.in.Machi |
| 11d400 | 6e 65 20 44 65 73 69 67 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ne.Design.---------------------- |
| 11d420 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 65 20 77 69 6c 6c 20 6f 66 74 65 6e 20 64 65 66 | -------------..We.will.often.def |
| 11d440 | 69 6e 65 20 61 20 6d 61 63 68 69 6e 65 20 74 6f 20 69 6e 63 6c 75 64 65 20 22 70 72 69 6d 69 74 | ine.a.machine.to.include."primit |
| 11d460 | 69 76 65 22 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 0a 61 72 65 20 61 63 74 75 61 6c 6c | ive".operations.that.are.actuall |
| 11d480 | 79 20 76 65 72 79 20 63 6f 6d 70 6c 65 78 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 6e | y.very.complex...For.example,.in |
| 11d4a0 | 20 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 20 35 2d 34 3a 3a 20 61 6e 64 0a 2a 4e 6f 74 65 20 | .sections.*Note.5-4::.and.*Note. |
| 11d4c0 | 35 2d 35 3a 3a 20 77 65 20 77 69 6c 6c 20 74 72 65 61 74 20 53 63 68 65 6d 65 27 73 20 65 6e 76 | 5-5::.we.will.treat.Scheme's.env |
| 11d4e0 | 69 72 6f 6e 6d 65 6e 74 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 73 20 61 73 0a 70 72 69 6d 69 74 | ironment.manipulations.as.primit |
| 11d500 | 69 76 65 2e 20 20 53 75 63 68 20 61 62 73 74 72 61 63 74 69 6f 6e 20 69 73 20 76 61 6c 75 61 62 | ive...Such.abstraction.is.valuab |
| 11d520 | 6c 65 20 62 65 63 61 75 73 65 20 69 74 20 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20 69 67 6e 6f 72 | le.because.it.allows.us.to.ignor |
| 11d540 | 65 0a 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 70 61 72 74 73 20 6f 66 20 61 20 6d 61 63 68 | e.the.details.of.parts.of.a.mach |
| 11d560 | 69 6e 65 20 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e 20 63 6f 6e 63 65 6e 74 72 61 74 65 20 6f | ine.so.that.we.can.concentrate.o |
| 11d580 | 6e 20 6f 74 68 65 72 0a 61 73 70 65 63 74 73 20 6f 66 20 74 68 65 20 64 65 73 69 67 6e 2e 20 20 | n.other.aspects.of.the.design... |
| 11d5a0 | 54 68 65 20 66 61 63 74 20 74 68 61 74 20 77 65 20 68 61 76 65 20 73 77 65 70 74 20 61 20 6c 6f | The.fact.that.we.have.swept.a.lo |
| 11d5c0 | 74 20 6f 66 20 63 6f 6d 70 6c 65 78 69 74 79 0a 75 6e 64 65 72 20 74 68 65 20 72 75 67 2c 20 68 | t.of.complexity.under.the.rug,.h |
| 11d5e0 | 6f 77 65 76 65 72 2c 20 64 6f 65 73 20 6e 6f 74 20 6d 65 61 6e 20 74 68 61 74 20 61 20 6d 61 63 | owever,.does.not.mean.that.a.mac |
| 11d600 | 68 69 6e 65 20 64 65 73 69 67 6e 20 69 73 0a 75 6e 72 65 61 6c 69 73 74 69 63 2e 20 20 57 65 20 | hine.design.is.unrealistic...We. |
| 11d620 | 63 61 6e 20 61 6c 77 61 79 73 20 72 65 70 6c 61 63 65 20 74 68 65 20 63 6f 6d 70 6c 65 78 20 22 | can.always.replace.the.complex." |
| 11d640 | 70 72 69 6d 69 74 69 76 65 73 22 20 62 79 20 73 69 6d 70 6c 65 72 0a 70 72 69 6d 69 74 69 76 65 | primitives".by.simpler.primitive |
| 11d660 | 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 47 43 | .operations......Consider.the.GC |
| 11d680 | 44 20 6d 61 63 68 69 6e 65 2e 20 54 68 65 20 6d 61 63 68 69 6e 65 20 68 61 73 20 61 6e 20 69 6e | D.machine..The.machine.has.an.in |
| 11d6a0 | 73 74 72 75 63 74 69 6f 6e 20 74 68 61 74 0a 63 6f 6d 70 75 74 65 73 20 74 68 65 20 72 65 6d 61 | struction.that.computes.the.rema |
| 11d6c0 | 69 6e 64 65 72 20 6f 66 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 74 65 | inder.of.the.contents.of.registe |
| 11d6e0 | 72 73 20 60 61 27 20 61 6e 64 20 60 62 27 20 61 6e 64 0a 61 73 73 69 67 6e 73 20 74 68 65 20 72 | rs.`a'.and.`b'.and.assigns.the.r |
| 11d700 | 65 73 75 6c 74 20 74 6f 20 72 65 67 69 73 74 65 72 20 60 74 27 2e 20 20 49 66 20 77 65 20 77 61 | esult.to.register.`t'...If.we.wa |
| 11d720 | 6e 74 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 47 43 44 0a 6d 61 63 68 69 6e 65 20 | nt.to.construct.the.GCD.machine. |
| 11d740 | 77 69 74 68 6f 75 74 20 75 73 69 6e 67 20 61 20 70 72 69 6d 69 74 69 76 65 20 72 65 6d 61 69 6e | without.using.a.primitive.remain |
| 11d760 | 64 65 72 20 6f 70 65 72 61 74 69 6f 6e 2c 20 77 65 20 6d 75 73 74 20 73 70 65 63 69 66 79 0a 68 | der.operation,.we.must.specify.h |
| 11d780 | 6f 77 20 74 6f 20 63 6f 6d 70 75 74 65 20 72 65 6d 61 69 6e 64 65 72 73 20 69 6e 20 74 65 72 6d | ow.to.compute.remainders.in.term |
| 11d7a0 | 73 20 6f 66 20 73 69 6d 70 6c 65 72 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 73 75 63 68 20 61 73 | s.of.simpler.operations,.such.as |
| 11d7c0 | 0a 73 75 62 74 72 61 63 74 69 6f 6e 2e 20 20 49 6e 64 65 65 64 2c 20 77 65 20 63 61 6e 20 77 72 | .subtraction...Indeed,.we.can.wr |
| 11d7e0 | 69 74 65 20 61 20 53 63 68 65 6d 65 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 66 69 6e 64 | ite.a.Scheme.procedure.that.find |
| 11d800 | 73 0a 72 65 6d 61 69 6e 64 65 72 73 20 69 6e 20 74 68 69 73 20 77 61 79 3a 0a 0a 20 20 20 20 20 | s.remainders.in.this.way:....... |
| 11d820 | 28 64 65 66 69 6e 65 20 28 72 65 6d 61 69 6e 64 65 72 20 6e 20 64 29 0a 20 20 20 20 20 20 20 28 | (define.(remainder.n.d)........( |
| 11d840 | 69 66 20 28 3c 20 6e 20 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 6e 0a 20 20 20 20 20 20 20 20 | if.(<.n.d)............n......... |
| 11d860 | 20 20 20 28 72 65 6d 61 69 6e 64 65 72 20 28 2d 20 6e 20 64 29 20 64 29 29 29 0a 0a 20 20 20 57 | ...(remainder.(-.n.d).d))).....W |
| 11d880 | 65 20 63 61 6e 20 74 68 75 73 20 72 65 70 6c 61 63 65 20 74 68 65 20 72 65 6d 61 69 6e 64 65 72 | e.can.thus.replace.the.remainder |
| 11d8a0 | 20 6f 70 65 72 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 47 43 44 20 6d 61 63 68 69 6e 65 27 73 20 | .operation.in.the.GCD.machine's. |
| 11d8c0 | 64 61 74 61 0a 70 61 74 68 73 20 77 69 74 68 20 61 20 73 75 62 74 72 61 63 74 69 6f 6e 20 6f 70 | data.paths.with.a.subtraction.op |
| 11d8e0 | 65 72 61 74 69 6f 6e 20 61 6e 64 20 61 20 63 6f 6d 70 61 72 69 73 6f 6e 20 74 65 73 74 2e 20 20 | eration.and.a.comparison.test... |
| 11d900 | 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a 35 2d 35 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 64 61 74 | *Note.Figure.5-5::.shows.the.dat |
| 11d920 | 61 20 70 61 74 68 73 20 61 6e 64 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 66 6f 72 20 74 68 65 20 65 | a.paths.and.controller.for.the.e |
| 11d940 | 6c 61 62 6f 72 61 74 65 64 20 6d 61 63 68 69 6e 65 2e 0a 54 68 65 20 69 6e 73 74 72 75 63 74 69 | laborated.machine..The.instructi |
| 11d960 | 6f 6e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 35 3a 2a 20 44 61 74 61 20 70 61 74 68 | on.......*Figure.5.5:*.Data.path |
| 11d980 | 73 20 61 6e 64 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 66 6f 72 20 74 68 65 20 65 6c 61 62 6f 72 61 | s.and.controller.for.the.elabora |
| 11d9a0 | 74 65 64 20 47 43 44 0a 20 20 20 20 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 | ted.GCD......machine............ |
| 11d9c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 11d9e0 | 20 20 20 20 20 5f 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 | .....___...........+-----+...... |
| 11da00 | 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 5c 0a 20 20 20 20 | ...+-----+............/...\..... |
| 11da20 | 20 20 20 20 20 20 7c 20 20 61 20 20 7c 3c 2d 2d 28 58 29 2d 2d 2d 2b 20 20 62 20 20 2b 2d 2d 2d | ......|..a..|<--(X)---+..b..+--- |
| 11da40 | 2d 2d 2d 2d 2a 2d 2d 3e 7c 20 20 3d 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2b 2d 2d | ----*-->|..=..|...........+--+-- |
| 11da60 | 2b 20 20 20 61 3c 2d 62 20 20 2b 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 7c 20 20 20 20 5c 5f 5f | +...a<-b..+-+---+.......|....\__ |
| 11da80 | 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c | _/..............|..............| |
| 11daa0 | 20 20 5e 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 58 29 20 74 3c 2d | ..^........|.............(X).t<- |
| 11dac0 | 61 20 20 20 20 20 20 20 20 7c 20 20 7c 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 | a........|..|........|.......... |
| 11dae0 | 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 28 58 29 20 62 3c 2d 74 20 20 7c | ....|..............|.(X).b<-t..| |
| 11db00 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | ..............V..............|.. |
| 11db20 | 7c 20 20 20 20 20 20 20 5f 56 5f 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 | |......._V_...........+-----+... |
| 11db40 | 20 20 20 20 20 20 20 20 7c 20 20 7c 20 20 20 20 20 20 2f 20 20 20 5c 0a 20 20 20 20 20 20 20 20 | ........|..|....../...\......... |
| 11db60 | 20 20 7c 20 20 74 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2a 2d 2d 2d 7c 2d 2d 2a 2d 2d 2d 2d 2d 7c 20 20 | ..|..t..+-------*---|--*-----|.. |
| 11db80 | 3c 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 7c 20 20 | <..|...........+-----+.......|.. |
| 11dba0 | 20 7c 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 | .|.........\___/..............^. |
| 11dbc0 | 20 20 20 20 20 20 20 20 20 56 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | .........V...V..............|... |
| 11dbe0 | 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 58 29 20 74 | .....---------.............(X).t |
| 11dc00 | 3c 2d 64 20 20 20 5c 20 20 2d 20 20 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 | <-d...\..-../..............|.... |
| 11dc20 | 20 20 20 20 20 20 2d 2d 2b 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 | ......--+--..............|...... |
| 11dc40 | 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ......|..............+---------- |
| 11dc60 | 2d 2d 2b 0a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 73 74 61 72 74 0a 20 20 20 20 20 20 20 | --+................start........ |
| 11dc80 | 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 0a 20 20 20 20 20 | ........|................V...... |
| 11dca0 | 20 20 20 20 20 20 20 20 20 2f 20 5c 20 79 65 73 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | ........./.\.yes............+--- |
| 11dcc0 | 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 3e 3c 20 3d 20 3e 2d 2d 2d 2d 3e 20 64 6f | ----+...........+-><.=.>---->.do |
| 11dce0 | 6e 65 20 20 20 20 20 7c 20 74 3c 2d 64 20 20 7c 3c 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c | ne.....|.t<-d..|<--+...........| |
| 11dd00 | 20 20 20 5c 20 2f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 | ...\./................+---+---+. |
| 11dd20 | 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 7c 20 6e 6f 20 20 20 20 20 20 20 20 20 | ..|...........|....|.no......... |
| 11dd40 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 | .........|.......|...........|.. |
| 11dd60 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 | ..|.....................V....... |
| 11dd80 | 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 7c 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 20 20 20 | |...........|....|...+------+... |
| 11dda0 | 20 20 20 20 20 20 2f 20 5c 20 6e 6f 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 | ....../.\.no...|...........|.... |
| 11ddc0 | 2b 2d 2d 3e 7c 20 74 3c 2d 61 20 2b 2d 2d 2d 2d 2d 2d 2d 3e 3c 20 3c 20 3e 2d 2d 2d 2d 2d 2b 0a | +-->|.t<-a.+-------><.<.>-----+. |
| 11dde0 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 | ..........|........+------+..... |
| 11de00 | 20 20 20 20 5c 20 2f 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....\./...........|............. |
| 11de20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 79 65 73 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 | .............|.yes...........|.. |
| 11de40 | 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 | ....+-------------------+....... |
| 11de60 | 20 20 20 20 7c 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 2b 2d 2d 2d 2d 2d | ....|......V...........|..+----- |
| 11de80 | 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 7c 20 61 3c 2d 62 20 20 7c 0a 20 20 20 20 20 | --+...........|..|.a<-b..|...... |
| 11dea0 | 20 20 20 20 20 7c 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | .....|..+---+---+...........|... |
| 11dec0 | 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 56 0a 20 20 20 20 20 20 20 20 | ...|...........|......V......... |
| 11dee0 | 20 20 7c 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2b 20 62 3c | ..|..+-------+...........+--+.b< |
| 11df00 | 2d 74 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 20 | -t..|..............+-------+.... |
| 11df20 | 20 20 20 28 61 73 73 69 67 6e 20 74 20 28 6f 70 20 72 65 6d 29 20 28 72 65 67 20 61 29 20 28 72 | ...(assign.t.(op.rem).(reg.a).(r |
| 11df40 | 65 67 20 62 29 29 0a 0a 69 6e 20 74 68 65 20 47 43 44 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 64 65 | eg.b))..in.the.GCD.controller.de |
| 11df60 | 66 69 6e 69 74 69 6f 6e 20 69 73 20 72 65 70 6c 61 63 65 64 20 62 79 20 61 20 73 65 71 75 65 6e | finition.is.replaced.by.a.sequen |
| 11df80 | 63 65 20 6f 66 0a 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 | ce.of.instructions.that.contains |
| 11dfa0 | 20 61 20 6c 6f 6f 70 2c 20 61 73 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 | .a.loop,.as.shown.in.*Note.Figur |
| 11dfc0 | 65 20 35 2d 36 3a 3a 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 36 3a 2a 20 43 6f 6e | e.5-6::........*Figure.5.6:*.Con |
| 11dfe0 | 74 72 6f 6c 6c 65 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 66 6f 72 | troller.instruction.sequence.for |
| 11e000 | 20 74 68 65 20 47 43 44 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 69 6e 20 2a 4e 6f 74 65 20 46 | .the.GCD.machine......in.*Note.F |
| 11e020 | 69 67 75 72 65 20 35 2d 35 3a 3a 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 74 72 6f 6c | igure.5-5::.............(control |
| 11e040 | 6c 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 74 65 73 74 2d 62 0a 20 20 20 20 20 20 20 20 20 20 | ler............test-b........... |
| 11e060 | 20 20 20 28 74 65 73 74 20 28 6f 70 20 3d 29 20 28 72 65 67 20 62 29 20 28 63 6f 6e 73 74 20 30 | ...(test.(op.=).(reg.b).(const.0 |
| 11e080 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 67 | ))..............(branch.(label.g |
| 11e0a0 | 63 64 2d 64 6f 6e 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 | cd-done))..............(assign.t |
| 11e0c0 | 20 28 72 65 67 20 61 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 2d 6c 6f 6f 70 0a 20 20 | .(reg.a))............rem-loop... |
| 11e0e0 | 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 3c 29 20 28 72 65 67 20 74 29 20 | ...........(test.(op.<).(reg.t). |
| 11e100 | 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c | (reg.b))..............(branch.(l |
| 11e120 | 61 62 65 6c 20 72 65 6d 2d 64 6f 6e 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 | abel.rem-done))..............(as |
| 11e140 | 73 69 67 6e 20 74 20 28 6f 70 20 2d 29 20 28 72 65 67 20 74 29 20 28 72 65 67 20 62 29 29 0a 20 | sign.t.(op.-).(reg.t).(reg.b)).. |
| 11e160 | 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 72 65 6d 2d 6c 6f 6f | ............(goto.(label.rem-loo |
| 11e180 | 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 2d 64 6f 6e 65 0a 20 20 20 20 20 20 20 20 | p))............rem-done......... |
| 11e1a0 | 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 | .....(assign.a.(reg.b))......... |
| 11e1c0 | 20 20 20 20 20 28 61 73 73 69 67 6e 20 62 20 28 72 65 67 20 74 29 29 0a 20 20 20 20 20 20 20 20 | .....(assign.b.(reg.t))......... |
| 11e1e0 | 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 74 65 73 74 2d 62 29 29 0a 20 20 20 20 20 | .....(goto.(label.test-b))...... |
| 11e200 | 20 20 20 20 20 20 67 63 64 2d 64 6f 6e 65 29 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | ......gcd-done)........*Exercise |
| 11e220 | 20 35 2e 33 3a 2a 20 44 65 73 69 67 6e 20 61 20 6d 61 63 68 69 6e 65 20 74 6f 20 63 6f 6d 70 75 | .5.3:*.Design.a.machine.to.compu |
| 11e240 | 74 65 20 73 71 75 61 72 65 20 72 6f 6f 74 73 20 75 73 69 6e 67 0a 20 20 20 20 20 4e 65 77 74 6f | te.square.roots.using......Newto |
| 11e260 | 6e 27 73 20 6d 65 74 68 6f 64 2c 20 61 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 | n's.method,.as.described.in.sect |
| 11e280 | 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 31 2d 37 3a 3a 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 | ion.*Note.1-1-7:::............(d |
| 11e2a0 | 65 66 69 6e 65 20 28 73 71 72 74 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 | efine.(sqrt.x).............(defi |
| 11e2c0 | 6e 65 20 28 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 | ne.(good-enough?.guess)......... |
| 11e2e0 | 20 20 20 20 20 20 28 3c 20 28 61 62 73 20 28 2d 20 28 73 71 75 61 72 65 20 67 75 65 73 73 29 20 | ......(<.(abs.(-.(square.guess). |
| 11e300 | 78 29 29 20 30 2e 30 30 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 | x)).0.001)).............(define. |
| 11e320 | 28 69 6d 70 72 6f 76 65 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 | (improve.guess)...............(a |
| 11e340 | 76 65 72 61 67 65 20 67 75 65 73 73 20 28 2f 20 78 20 67 75 65 73 73 29 29 29 0a 20 20 20 20 20 | verage.guess.(/.x.guess)))...... |
| 11e360 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 2d 69 74 65 72 20 67 75 65 73 73 29 | .......(define.(sqrt-iter.guess) |
| 11e380 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f | ...............(if.(good-enough? |
| 11e3a0 | 20 67 75 65 73 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 67 75 65 73 73 0a | .guess)...................guess. |
| 11e3c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 28 69 6d | ..................(sqrt-iter.(im |
| 11e3e0 | 70 72 6f 76 65 20 67 75 65 73 73 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 71 72 | prove.guess)))).............(sqr |
| 11e400 | 74 2d 69 74 65 72 20 31 2e 30 29 29 0a 0a 20 20 20 20 20 42 65 67 69 6e 20 62 79 20 61 73 73 75 | t-iter.1.0)).......Begin.by.assu |
| 11e420 | 6d 69 6e 67 20 74 68 61 74 20 60 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 27 20 61 6e 64 20 60 69 6d | ming.that.`good-enough?'.and.`im |
| 11e440 | 70 72 6f 76 65 27 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 72 65 0a 20 20 20 20 20 61 76 61 69 6c | prove'.operations.are......avail |
| 11e460 | 61 62 6c 65 20 61 73 20 70 72 69 6d 69 74 69 76 65 73 2e 20 20 54 68 65 6e 20 73 68 6f 77 20 68 | able.as.primitives...Then.show.h |
| 11e480 | 6f 77 20 74 6f 20 65 78 70 61 6e 64 20 74 68 65 73 65 20 69 6e 20 74 65 72 6d 73 0a 20 20 20 20 | ow.to.expand.these.in.terms..... |
| 11e4a0 | 20 6f 66 20 61 72 69 74 68 6d 65 74 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 44 65 73 63 | .of.arithmetic.operations...Desc |
| 11e4c0 | 72 69 62 65 20 65 61 63 68 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 60 73 71 72 74 27 0a | ribe.each.version.of.the.`sqrt'. |
| 11e4e0 | 20 20 20 20 20 6d 61 63 68 69 6e 65 20 64 65 73 69 67 6e 20 62 79 20 64 72 61 77 69 6e 67 20 61 | .....machine.design.by.drawing.a |
| 11e500 | 20 64 61 74 61 2d 70 61 74 68 20 64 69 61 67 72 61 6d 20 61 6e 64 20 77 72 69 74 69 6e 67 20 61 | .data-path.diagram.and.writing.a |
| 11e520 | 0a 20 20 20 20 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 6e 20 74 | ......controller.definition.in.t |
| 11e540 | 68 65 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 2e 0a 0a 1f | he.register-machine.language.... |
| 11e560 | 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 31 2d 33 2c 20 | .File:.sicp.info,..Node:.5-1-3,. |
| 11e580 | 20 4e 65 78 74 3a 20 35 2d 31 2d 34 2c 20 20 50 72 65 76 3a 20 35 2d 31 2d 32 2c 20 20 55 70 3a | .Next:.5-1-4,..Prev:.5-1-2,..Up: |
| 11e5a0 | 20 35 2d 31 0a 0a 35 2e 31 2e 33 20 53 75 62 72 6f 75 74 69 6e 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d | .5-1..5.1.3.Subroutines.-------- |
| 11e5c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 68 65 6e 20 64 65 73 69 67 6e 69 6e 67 20 61 20 6d 61 63 68 | ---------..When.designing.a.mach |
| 11e5e0 | 69 6e 65 20 74 6f 20 70 65 72 66 6f 72 6d 20 61 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 77 65 | ine.to.perform.a.computation,.we |
| 11e600 | 20 77 6f 75 6c 64 20 6f 66 74 65 6e 0a 70 72 65 66 65 72 20 74 6f 20 61 72 72 61 6e 67 65 20 66 | .would.often.prefer.to.arrange.f |
| 11e620 | 6f 72 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 74 6f 20 62 65 20 73 68 61 72 65 64 20 62 79 20 64 69 | or.components.to.be.shared.by.di |
| 11e640 | 66 66 65 72 65 6e 74 20 70 61 72 74 73 20 6f 66 20 74 68 65 0a 63 6f 6d 70 75 74 61 74 69 6f 6e | fferent.parts.of.the.computation |
| 11e660 | 20 72 61 74 68 65 72 20 74 68 61 6e 20 64 75 70 6c 69 63 61 74 65 20 74 68 65 20 63 6f 6d 70 6f | .rather.than.duplicate.the.compo |
| 11e680 | 6e 65 6e 74 73 2e 20 20 43 6f 6e 73 69 64 65 72 20 61 20 6d 61 63 68 69 6e 65 0a 74 68 61 74 20 | nents...Consider.a.machine.that. |
| 11e6a0 | 69 6e 63 6c 75 64 65 73 20 74 77 6f 20 47 43 44 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 2d 2d 6f | includes.two.GCD.computations--o |
| 11e6c0 | 6e 65 20 74 68 61 74 20 66 69 6e 64 73 20 74 68 65 20 47 43 44 20 6f 66 20 74 68 65 0a 63 6f 6e | ne.that.finds.the.GCD.of.the.con |
| 11e6e0 | 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 74 65 72 73 20 60 61 27 20 61 6e 64 20 60 62 27 20 61 | tents.of.registers.`a'.and.`b'.a |
| 11e700 | 6e 64 20 6f 6e 65 20 74 68 61 74 20 66 69 6e 64 73 20 74 68 65 20 47 43 44 20 6f 66 20 74 68 65 | nd.one.that.finds.the.GCD.of.the |
| 11e720 | 0a 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 74 65 72 73 20 60 63 27 20 61 6e 64 20 60 | .contents.of.registers.`c'.and.` |
| 11e740 | 64 27 2e 20 20 57 65 20 6d 69 67 68 74 20 73 74 61 72 74 20 62 79 20 61 73 73 75 6d 69 6e 67 20 | d'...We.might.start.by.assuming. |
| 11e760 | 77 65 20 68 61 76 65 0a 61 20 70 72 69 6d 69 74 69 76 65 20 60 67 63 64 27 20 6f 70 65 72 61 74 | we.have.a.primitive.`gcd'.operat |
| 11e780 | 69 6f 6e 2c 20 74 68 65 6e 20 65 78 70 61 6e 64 20 74 68 65 20 74 77 6f 20 69 6e 73 74 61 6e 63 | ion,.then.expand.the.two.instanc |
| 11e7a0 | 65 73 20 6f 66 20 60 67 63 64 27 20 69 6e 0a 74 65 72 6d 73 20 6f 66 20 6d 6f 72 65 20 70 72 69 | es.of.`gcd'.in.terms.of.more.pri |
| 11e7c0 | 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 | mitive.operations...*Note.Figure |
| 11e7e0 | 20 35 2d 37 3a 3a 20 73 68 6f 77 73 20 6a 75 73 74 20 74 68 65 0a 47 43 44 20 70 6f 72 74 69 6f | .5-7::.shows.just.the.GCD.portio |
| 11e800 | 6e 73 20 6f 66 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 6d 61 63 68 69 6e 65 27 73 20 64 61 | ns.of.the.resulting.machine's.da |
| 11e820 | 74 61 20 70 61 74 68 73 2c 20 77 69 74 68 6f 75 74 20 73 68 6f 77 69 6e 67 20 68 6f 77 0a 74 68 | ta.paths,.without.showing.how.th |
| 11e840 | 65 79 20 63 6f 6e 6e 65 63 74 20 74 6f 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 6d 61 | ey.connect.to.the.rest.of.the.ma |
| 11e860 | 63 68 69 6e 65 2e 20 20 54 68 65 20 66 69 67 75 72 65 20 61 6c 73 6f 20 73 68 6f 77 73 20 74 68 | chine...The.figure.also.shows.th |
| 11e880 | 65 0a 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 70 6f 72 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 | e.corresponding.portions.of.the. |
| 11e8a0 | 6d 61 63 68 69 6e 65 27 73 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 2e 0a 0a | machine's.controller.sequence... |
| 11e8c0 | 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 37 3a 2a 20 50 6f 72 74 69 6f 6e 73 20 6f 66 20 74 | .....*Figure.5.7:*.Portions.of.t |
| 11e8e0 | 68 65 20 64 61 74 61 20 70 61 74 68 73 20 61 6e 64 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 | he.data.paths.and.controller.seq |
| 11e900 | 75 65 6e 63 65 0a 20 20 20 20 20 66 6f 72 20 61 20 6d 61 63 68 69 6e 65 20 77 69 74 68 20 74 77 | uence......for.a.machine.with.tw |
| 11e920 | 6f 20 47 43 44 20 63 6f 6d 70 75 74 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 | o.GCD.computations.............. |
| 11e940 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f 5f 5f 20 20 | ...........................___.. |
| 11e960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5f | ..............................._ |
| 11e980 | 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b 2d 2d 2d | __...........+-----+........+--- |
| 11e9a0 | 2d 2d 2b 20 20 20 20 20 2f 20 20 20 5c 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 | --+...../...\....+-----+........ |
| 11e9c0 | 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 2f 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 61 | +-----+...../...\...........|..a |
| 11e9e0 | 20 20 7c 3c 2d 28 58 29 2d 2d 2d 2b 20 20 62 20 20 7c 2d 2d 2d 3e 7c 20 20 3d 20 20 7c 20 20 20 | ..|<-(X)---+..b..|--->|..=..|... |
| 11ea00 | 7c 20 20 63 20 20 7c 3c 2d 28 58 29 2d 2d 2d 2b 20 20 64 20 20 7c 2d 2d 2d 3e 7c 20 20 3d 20 20 | |..c..|<-(X)---+..d..|--->|..=.. |
| 11ea20 | 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2b 2d 2d 2b 20 20 61 3c 2d 62 20 20 2b 2b 2d 2d 2d | |...........+--+--+..a<-b..++--- |
| 11ea40 | 2d 2b 20 20 20 20 20 5c 5f 5f 5f 2f 20 20 20 20 2b 2d 2d 2b 2d 2d 2b 20 20 63 3c 2d 64 20 20 2b | -+.....\___/....+--+--+..c<-d..+ |
| 11ea60 | 2b 2d 2d 2d 2d 2b 20 20 20 20 20 5c 5f 5f 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | +----+.....\___/..............|. |
| 11ea80 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 5e 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 | ...........|..^.........^....... |
| 11eaa0 | 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 5e 20 20 20 20 20 20 20 20 20 5e 0a 20 20 | ..|............|..^.........^... |
| 11eac0 | 20 20 20 20 20 20 20 20 20 20 20 60 2d 2d 2d 2d 2e 20 20 20 2e 2d 2d 2d 27 20 20 7c 20 20 20 20 | ...........`----.....---'..|.... |
| 11eae0 | 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 60 2d 2d 2d 2d 2e 20 20 20 2e 2d 2d 2d 27 20 20 7c | .....|.........`----.....---'..| |
| 11eb00 | 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 | .........|...................V.. |
| 11eb20 | 20 56 20 20 20 20 20 28 58 29 20 62 3c 2d 74 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | .V.....(X).b<-t...|............. |
| 11eb40 | 20 56 20 20 20 56 20 20 20 20 20 28 58 29 20 64 3c 2d 74 20 20 20 7c 0a 20 20 20 20 20 20 20 20 | .V...V.....(X).d<-t...|......... |
| 11eb60 | 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 2f 20 | .........-------.....|......../. |
| 11eb80 | 5c 20 20 20 20 20 20 20 20 20 20 20 20 2d 2d 2d 2d 2d 2d 2d 20 20 20 20 20 7c 20 20 20 20 20 20 | \............-------.....|...... |
| 11eba0 | 20 20 2f 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5c 20 72 65 6d 20 2f 20 20 | ../.\..................\.rem./.. |
| 11ebc0 | 20 20 20 7c 20 20 20 20 20 20 20 2f 5f 30 5f 5c 20 20 20 20 20 20 20 20 20 20 20 5c 20 72 65 6d | ...|......./_0_\...........\.rem |
| 11ebe0 | 20 2f 20 20 20 20 20 7c 20 20 20 20 20 20 20 2f 5f 30 5f 5c 0a 20 20 20 20 20 20 20 20 20 20 20 | ./.....|......./_0_\............ |
| 11ec00 | 20 20 20 20 20 20 20 2d 2d 2b 2d 2d 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......--+--......|............. |
| 11ec20 | 20 20 20 20 20 20 20 20 20 20 20 2d 2d 2b 2d 2d 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 | ...........--+--......|......... |
| 11ec40 | 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | ............|........|.......... |
| 11ec60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 | ................|........|...... |
| 11ec80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 58 29 20 74 3c 2d 72 20 20 7c 20 20 20 20 20 20 20 | ..............(X).t<-r..|....... |
| 11eca0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 58 29 20 73 3c 2d 72 20 20 7c 0a 20 20 | ..................(X).s<-r..|... |
| 11ecc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 7c 20 20 20 20 | ..................|........|.... |
| 11ece0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 7c | ......................|........| |
| 11ed00 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 7c 20 | .....................V........|. |
| 11ed20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 | .........................V...... |
| 11ed40 | 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 | ..|..................+-----+.... |
| 11ed60 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b | .|.......................+-----+ |
| 11ed80 | 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 74 20 20 2b 2d | .....|..................|..t..+- |
| 11eda0 | 2d 2d 2d 2d 27 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 73 | ----'.......................|..s |
| 11edc0 | 20 20 2b 2d 2d 2d 2d 2d 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d | ..+-----'..................+---- |
| 11ede0 | 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b | -+.............................+ |
| 11ee00 | 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 20 20 20 20 20 20 20 67 63 64 2d 31 0a 20 20 20 20 20 20 20 20 | -----+............gcd-1......... |
| 11ee20 | 20 20 20 28 74 65 73 74 20 28 6f 70 20 3d 29 20 28 72 65 67 20 62 29 20 28 63 6f 6e 73 74 20 30 | ...(test.(op.=).(reg.b).(const.0 |
| 11ee40 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 61 66 74 | ))............(branch.(label.aft |
| 11ee60 | 65 72 2d 67 63 64 2d 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 20 | er-gcd-1))............(assign.t. |
| 11ee80 | 28 6f 70 20 72 65 6d 29 20 28 72 65 67 20 61 29 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 | (op.rem).(reg.a).(reg.b))....... |
| 11eea0 | 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 | .....(assign.a.(reg.b))......... |
| 11eec0 | 20 20 20 28 61 73 73 69 67 6e 20 62 20 28 72 65 67 20 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 | ...(assign.b.(reg.t))........... |
| 11eee0 | 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 67 63 64 2d 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 | .(goto.(label.gcd-1))........... |
| 11ef00 | 61 66 74 65 72 2d 67 63 64 2d 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 0a 20 20 20 | after-gcd-1..................... |
| 11ef20 | 20 20 20 20 20 20 20 67 63 64 2d 32 0a 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f | .......gcd-2............(test.(o |
| 11ef40 | 70 20 3d 29 20 28 72 65 67 20 64 29 20 28 63 6f 6e 73 74 20 30 29 29 0a 20 20 20 20 20 20 20 20 | p.=).(reg.d).(const.0))......... |
| 11ef60 | 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 67 63 64 2d 32 29 29 0a | ...(branch.(label.after-gcd-2)). |
| 11ef80 | 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 73 20 28 6f 70 20 72 65 6d 29 20 28 72 | ...........(assign.s.(op.rem).(r |
| 11efa0 | 65 67 20 63 29 20 28 72 65 67 20 64 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 | eg.c).(reg.d))............(assig |
| 11efc0 | 6e 20 63 20 28 72 65 67 20 64 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 | n.c.(reg.d))............(assign. |
| 11efe0 | 64 20 28 72 65 67 20 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 | d.(reg.s))............(goto.(lab |
| 11f000 | 65 6c 20 67 63 64 2d 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 67 63 64 2d 32 | el.gcd-2))...........after-gcd-2 |
| 11f020 | 0a 0a 0a 20 20 20 54 68 69 73 20 6d 61 63 68 69 6e 65 20 68 61 73 20 74 77 6f 20 72 65 6d 61 69 | ......This.machine.has.two.remai |
| 11f040 | 6e 64 65 72 20 6f 70 65 72 61 74 69 6f 6e 20 62 6f 78 65 73 20 61 6e 64 20 74 77 6f 20 62 6f 78 | nder.operation.boxes.and.two.box |
| 11f060 | 65 73 20 66 6f 72 0a 74 65 73 74 69 6e 67 20 65 71 75 61 6c 69 74 79 2e 20 20 49 66 20 74 68 65 | es.for.testing.equality...If.the |
| 11f080 | 20 64 75 70 6c 69 63 61 74 65 64 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 61 72 65 20 63 6f 6d 70 6c | .duplicated.components.are.compl |
| 11f0a0 | 69 63 61 74 65 64 2c 20 61 73 20 69 73 0a 74 68 65 20 72 65 6d 61 69 6e 64 65 72 20 62 6f 78 2c | icated,.as.is.the.remainder.box, |
| 11f0c0 | 20 74 68 69 73 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 61 6e 20 65 63 6f 6e 6f 6d 69 63 61 6c 20 | .this.will.not.be.an.economical. |
| 11f0e0 | 77 61 79 20 74 6f 20 62 75 69 6c 64 20 74 68 65 0a 6d 61 63 68 69 6e 65 2e 20 20 57 65 20 63 61 | way.to.build.the.machine...We.ca |
| 11f100 | 6e 20 61 76 6f 69 64 20 64 75 70 6c 69 63 61 74 69 6e 67 20 74 68 65 20 64 61 74 61 2d 70 61 74 | n.avoid.duplicating.the.data-pat |
| 11f120 | 68 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 62 79 20 75 73 69 6e 67 0a 74 68 65 20 73 61 6d 65 20 63 | h.components.by.using.the.same.c |
| 11f140 | 6f 6d 70 6f 6e 65 6e 74 73 20 66 6f 72 20 62 6f 74 68 20 47 43 44 20 63 6f 6d 70 75 74 61 74 69 | omponents.for.both.GCD.computati |
| 11f160 | 6f 6e 73 2c 20 70 72 6f 76 69 64 65 64 20 74 68 61 74 20 64 6f 69 6e 67 20 73 6f 0a 77 69 6c 6c | ons,.provided.that.doing.so.will |
| 11f180 | 20 6e 6f 74 20 61 66 66 65 63 74 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 6c 61 72 67 | .not.affect.the.rest.of.the.larg |
| 11f1a0 | 65 72 20 6d 61 63 68 69 6e 65 27 73 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 49 66 20 74 68 | er.machine's.computation...If.th |
| 11f1c0 | 65 0a 76 61 6c 75 65 73 20 69 6e 20 72 65 67 69 73 74 65 72 73 20 60 61 27 20 61 6e 64 20 60 62 | e.values.in.registers.`a'.and.`b |
| 11f1e0 | 27 20 61 72 65 20 6e 6f 74 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 74 69 6d 65 20 74 68 65 | '.are.not.needed.by.the.time.the |
| 11f200 | 0a 63 6f 6e 74 72 6f 6c 6c 65 72 20 67 65 74 73 20 74 6f 20 60 67 63 64 2d 32 27 20 28 6f 72 20 | .controller.gets.to.`gcd-2'.(or. |
| 11f220 | 69 66 20 74 68 65 73 65 20 76 61 6c 75 65 73 20 63 61 6e 20 62 65 20 6d 6f 76 65 64 20 74 6f 20 | if.these.values.can.be.moved.to. |
| 11f240 | 6f 74 68 65 72 0a 72 65 67 69 73 74 65 72 73 20 66 6f 72 20 73 61 66 65 6b 65 65 70 69 6e 67 29 | other.registers.for.safekeeping) |
| 11f260 | 2c 20 77 65 20 63 61 6e 20 63 68 61 6e 67 65 20 74 68 65 20 6d 61 63 68 69 6e 65 20 73 6f 20 74 | ,.we.can.change.the.machine.so.t |
| 11f280 | 68 61 74 20 69 74 20 75 73 65 73 0a 72 65 67 69 73 74 65 72 73 20 60 61 27 20 61 6e 64 20 60 62 | hat.it.uses.registers.`a'.and.`b |
| 11f2a0 | 27 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 72 65 67 69 73 74 65 72 73 20 60 63 27 20 61 6e 64 | ',.rather.than.registers.`c'.and |
| 11f2c0 | 20 60 64 27 2c 20 69 6e 20 63 6f 6d 70 75 74 69 6e 67 0a 74 68 65 20 73 65 63 6f 6e 64 20 47 43 | .`d',.in.computing.the.second.GC |
| 11f2e0 | 44 20 61 73 20 77 65 6c 6c 20 61 73 20 74 68 65 20 66 69 72 73 74 2e 20 20 49 66 20 77 65 20 64 | D.as.well.as.the.first...If.we.d |
| 11f300 | 6f 20 74 68 69 73 2c 20 77 65 20 6f 62 74 61 69 6e 20 74 68 65 0a 63 6f 6e 74 72 6f 6c 6c 65 72 | o.this,.we.obtain.the.controller |
| 11f320 | 20 73 65 71 75 65 6e 63 65 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 | .sequence.shown.in.*Note.Figure. |
| 11f340 | 35 2d 38 3a 3a 2e 0a 0a 20 20 20 57 65 20 68 61 76 65 20 72 65 6d 6f 76 65 64 20 74 68 65 20 64 | 5-8::......We.have.removed.the.d |
| 11f360 | 75 70 6c 69 63 61 74 65 20 64 61 74 61 2d 70 61 74 68 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 28 73 | uplicate.data-path.components.(s |
| 11f380 | 6f 20 74 68 61 74 20 74 68 65 20 64 61 74 61 0a 70 61 74 68 73 20 61 72 65 20 61 67 61 69 6e 20 | o.that.the.data.paths.are.again. |
| 11f3a0 | 61 73 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 3a 3a 29 2c 20 62 75 74 20 74 | as.in.*Note.Figure.5-1::),.but.t |
| 11f3c0 | 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 6e 6f 77 20 68 61 73 0a 74 77 6f 20 47 43 44 20 73 65 | he.controller.now.has.two.GCD.se |
| 11f3e0 | 71 75 65 6e 63 65 73 20 74 68 61 74 20 64 69 66 66 65 72 20 6f 6e 6c 79 20 69 6e 20 74 68 65 69 | quences.that.differ.only.in.thei |
| 11f400 | 72 20 65 6e 74 72 79 2d 70 6f 69 6e 74 20 6c 61 62 65 6c 73 2e 20 20 49 74 0a 77 6f 75 6c 64 20 | r.entry-point.labels...It.would. |
| 11f420 | 62 65 20 62 65 74 74 65 72 20 74 6f 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 74 77 6f 20 73 | be.better.to.replace.these.two.s |
| 11f440 | 65 71 75 65 6e 63 65 73 20 62 79 20 62 72 61 6e 63 68 65 73 20 74 6f 20 61 20 73 69 6e 67 6c 65 | equences.by.branches.to.a.single |
| 11f460 | 0a 73 65 71 75 65 6e 63 65 2d 2d 61 20 60 67 63 64 27 20 22 73 75 62 72 6f 75 74 69 6e 65 22 2d | .sequence--a.`gcd'."subroutine"- |
| 11f480 | 2d 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 77 68 69 63 68 20 77 65 20 62 72 61 6e 63 68 20 62 | -at.the.end.of.which.we.branch.b |
| 11f4a0 | 61 63 6b 20 74 6f 0a 74 68 65 20 63 6f 72 72 65 63 74 20 70 6c 61 63 65 20 69 6e 20 74 68 65 20 | ack.to.the.correct.place.in.the. |
| 11f4c0 | 6d 61 69 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 2e 20 20 57 65 20 63 | main.instruction.sequence...We.c |
| 11f4e0 | 61 6e 20 61 63 63 6f 6d 70 6c 69 73 68 0a 74 68 69 73 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 20 42 | an.accomplish.this.as.follows:.B |
| 11f500 | 65 66 6f 72 65 20 62 72 61 6e 63 68 69 6e 67 20 74 6f 20 60 67 63 64 27 2c 20 77 65 20 70 6c 61 | efore.branching.to.`gcd',.we.pla |
| 11f520 | 63 65 20 61 20 64 69 73 74 69 6e 67 75 69 73 68 69 6e 67 0a 76 61 6c 75 65 20 28 73 75 63 68 20 | ce.a.distinguishing.value.(such. |
| 11f540 | 61 73 20 30 20 6f 72 20 31 29 20 69 6e 74 6f 20 61 20 73 70 65 63 69 61 6c 20 72 65 67 69 73 74 | as.0.or.1).into.a.special.regist |
| 11f560 | 65 72 2c 20 60 63 6f 6e 74 69 6e 75 65 27 2e 20 20 41 74 20 74 68 65 20 65 6e 64 0a 6f 66 20 74 | er,.`continue'...At.the.end.of.t |
| 11f580 | 68 65 20 60 67 63 64 27 20 73 75 62 72 6f 75 74 69 6e 65 20 77 65 20 72 65 74 75 72 6e 20 65 69 | he.`gcd'.subroutine.we.return.ei |
| 11f5a0 | 74 68 65 72 20 74 6f 20 60 61 66 74 65 72 2d 67 63 64 2d 31 27 20 6f 72 20 74 6f 0a 60 61 66 74 | ther.to.`after-gcd-1'.or.to.`aft |
| 11f5c0 | 65 72 2d 67 63 64 2d 32 27 2c 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68 65 20 76 61 6c 75 | er-gcd-2',.depending.on.the.valu |
| 11f5e0 | 65 20 6f 66 20 74 68 65 20 60 63 6f 6e 74 69 6e 75 65 27 20 72 65 67 69 73 74 65 72 2e 0a 2a 4e | e.of.the.`continue'.register..*N |
| 11f600 | 6f 74 65 20 46 69 67 75 72 65 20 35 2d 39 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 72 65 6c 65 76 | ote.Figure.5-9::.shows.the.relev |
| 11f620 | 61 6e 74 20 70 6f 72 74 69 6f 6e 20 6f 66 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 0a 63 6f 6e | ant.portion.of.the.resulting.con |
| 11f640 | 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 2c 20 77 68 69 63 68 20 69 6e 63 6c 75 64 65 73 | troller.sequence,.which.includes |
| 11f660 | 20 6f 6e 6c 79 20 61 20 73 69 6e 67 6c 65 20 63 6f 70 79 20 6f 66 20 74 68 65 20 60 67 63 64 27 | .only.a.single.copy.of.the.`gcd' |
| 11f680 | 0a 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 38 | .instructions........*Figure.5.8 |
| 11f6a0 | 3a 2a 20 50 6f 72 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 | :*.Portions.of.the.controller.se |
| 11f6c0 | 71 75 65 6e 63 65 20 66 6f 72 20 61 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 74 68 61 74 20 75 | quence.for.a.machine......that.u |
| 11f6e0 | 73 65 73 20 74 68 65 20 73 61 6d 65 20 64 61 74 61 2d 70 61 74 68 20 63 6f 6d 70 6f 6e 65 6e 74 | ses.the.same.data-path.component |
| 11f700 | 73 20 66 6f 72 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 47 43 44 0a 20 20 20 20 20 63 6f 6d | s.for.two.different.GCD......com |
| 11f720 | 70 75 74 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 67 63 64 2d 31 0a 20 20 20 20 | putations.............gcd-1..... |
| 11f740 | 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 3d 29 20 28 72 65 67 20 62 29 20 28 63 6f 6e | .......(test.(op.=).(reg.b).(con |
| 11f760 | 73 74 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c | st.0))............(branch.(label |
| 11f780 | 20 61 66 74 65 72 2d 67 63 64 2d 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 | .after-gcd-1))............(assig |
| 11f7a0 | 6e 20 74 20 28 6f 70 20 72 65 6d 29 20 28 72 65 67 20 61 29 20 28 72 65 67 20 62 29 29 0a 20 20 | n.t.(op.rem).(reg.a).(reg.b))... |
| 11f7c0 | 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 | .........(assign.a.(reg.b))..... |
| 11f7e0 | 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 62 20 28 72 65 67 20 74 29 29 0a 20 20 20 20 20 20 | .......(assign.b.(reg.t))....... |
| 11f800 | 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 67 63 64 2d 31 29 29 0a 20 20 20 20 20 20 | .....(goto.(label.gcd-1))....... |
| 11f820 | 20 20 20 20 61 66 74 65 72 2d 67 63 64 2d 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 0a | ....after-gcd-1................. |
| 11f840 | 20 20 20 20 20 20 20 20 20 20 67 63 64 2d 32 0a 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 | ..........gcd-2............(test |
| 11f860 | 20 28 6f 70 20 3d 29 20 28 72 65 67 20 62 29 20 28 63 6f 6e 73 74 20 30 29 29 0a 20 20 20 20 20 | .(op.=).(reg.b).(const.0))...... |
| 11f880 | 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 67 63 64 2d 32 | ......(branch.(label.after-gcd-2 |
| 11f8a0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 20 28 6f 70 20 72 65 6d 29 | ))............(assign.t.(op.rem) |
| 11f8c0 | 20 28 72 65 67 20 61 29 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 | .(reg.a).(reg.b))............(as |
| 11f8e0 | 73 69 67 6e 20 61 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 | sign.a.(reg.b))............(assi |
| 11f900 | 67 6e 20 62 20 28 72 65 67 20 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 | gn.b.(reg.t))............(goto.( |
| 11f920 | 6c 61 62 65 6c 20 67 63 64 2d 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 67 63 | label.gcd-2))...........after-gc |
| 11f940 | 64 2d 32 0a 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 39 3a 2a 20 55 73 69 6e 67 20 61 | d-2........*Figure.5.9:*.Using.a |
| 11f960 | 20 60 63 6f 6e 74 69 6e 75 65 27 20 72 65 67 69 73 74 65 72 20 74 6f 20 61 76 6f 69 64 20 74 68 | .`continue'.register.to.avoid.th |
| 11f980 | 65 20 64 75 70 6c 69 63 61 74 65 0a 20 20 20 20 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 | e.duplicate......controller.sequ |
| 11f9a0 | 65 6e 63 65 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 38 3a 3a 2e 0a 0a 20 20 20 | ence.in.*Note.Figure.5-8::...... |
| 11f9c0 | 20 20 20 20 20 20 20 67 63 64 0a 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 | .......gcd............(test.(op. |
| 11f9e0 | 3d 29 20 28 72 65 67 20 62 29 20 28 63 6f 6e 73 74 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 | =).(reg.b).(const.0))........... |
| 11fa00 | 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 67 63 64 2d 64 6f 6e 65 29 29 0a 20 20 20 20 20 | .(branch.(label.gcd-done))...... |
| 11fa20 | 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 20 28 6f 70 20 72 65 6d 29 20 28 72 65 67 20 61 29 | ......(assign.t.(op.rem).(reg.a) |
| 11fa40 | 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 20 28 | .(reg.b))............(assign.a.( |
| 11fa60 | 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 62 20 28 72 65 | reg.b))............(assign.b.(re |
| 11fa80 | 67 20 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 67 63 | g.t))............(goto.(label.gc |
| 11faa0 | 64 29 29 0a 20 20 20 20 20 20 20 20 20 20 67 63 64 2d 64 6f 6e 65 0a 20 20 20 20 20 20 20 20 20 | d))...........gcd-done.......... |
| 11fac0 | 20 20 28 74 65 73 74 20 28 6f 70 20 3d 29 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 20 28 63 | ..(test.(op.=).(reg.continue).(c |
| 11fae0 | 6f 6e 73 74 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 | onst.0))............(branch.(lab |
| 11fb00 | 65 6c 20 61 66 74 65 72 2d 67 63 64 2d 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 | el.after-gcd-1))............(got |
| 11fb20 | 6f 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 67 63 64 2d 32 29 29 0a 20 20 20 20 20 20 20 20 20 | o.(label.after-gcd-2)).......... |
| 11fb40 | 20 20 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 20 42 65 66 6f 72 65 20 62 72 61 6e 63 | .................;;.Before.branc |
| 11fb60 | 68 69 6e 67 20 74 6f 20 60 67 63 64 27 20 66 72 6f 6d 20 74 68 65 20 66 69 72 73 74 20 70 6c 61 | hing.to.`gcd'.from.the.first.pla |
| 11fb80 | 63 65 20 77 68 65 72 65 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 20 69 74 20 69 73 20 6e 65 65 64 | ce.where...........;;.it.is.need |
| 11fba0 | 65 64 2c 20 77 65 20 70 6c 61 63 65 20 30 20 69 6e 20 74 68 65 20 60 63 6f 6e 74 69 6e 75 65 27 | ed,.we.place.0.in.the.`continue' |
| 11fbc0 | 20 72 65 67 69 73 74 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e | .register............(assign.con |
| 11fbe0 | 74 69 6e 75 65 20 28 63 6f 6e 73 74 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 | tinue.(const.0))............(got |
| 11fc00 | 6f 20 28 6c 61 62 65 6c 20 67 63 64 29 29 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 67 | o.(label.gcd))...........after-g |
| 11fc20 | 63 64 2d 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 3b | cd-1...........................; |
| 11fc40 | 3b 20 42 65 66 6f 72 65 20 74 68 65 20 73 65 63 6f 6e 64 20 75 73 65 20 6f 66 20 60 67 63 64 27 | ;.Before.the.second.use.of.`gcd' |
| 11fc60 | 2c 20 77 65 20 70 6c 61 63 65 20 31 20 69 6e 20 74 68 65 20 60 63 6f 6e 74 69 6e 75 65 27 20 72 | ,.we.place.1.in.the.`continue'.r |
| 11fc80 | 65 67 69 73 74 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 | egister............(assign.conti |
| 11fca0 | 6e 75 65 20 28 63 6f 6e 73 74 20 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 | nue.(const.1))............(goto. |
| 11fcc0 | 28 6c 61 62 65 6c 20 67 63 64 29 29 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 67 63 64 | (label.gcd))...........after-gcd |
| 11fce0 | 2d 32 0a 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 31 30 3a 2a 20 41 73 73 69 67 6e 69 | -2........*Figure.5.10:*.Assigni |
| 11fd00 | 6e 67 20 6c 61 62 65 6c 73 20 74 6f 20 74 68 65 20 60 63 6f 6e 74 69 6e 75 65 27 20 72 65 67 69 | ng.labels.to.the.`continue'.regi |
| 11fd20 | 73 74 65 72 0a 20 20 20 20 20 73 69 6d 70 6c 69 66 69 65 73 20 61 6e 64 20 67 65 6e 65 72 61 6c | ster......simplifies.and.general |
| 11fd40 | 69 7a 65 73 20 74 68 65 20 73 74 72 61 74 65 67 79 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 | izes.the.strategy.shown.in.*Note |
| 11fd60 | 20 46 69 67 75 72 65 0a 20 20 20 20 20 35 2d 39 3a 3a 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 67 | .Figure......5-9::.............g |
| 11fd80 | 63 64 0a 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 3d 29 20 28 72 65 67 20 | cd............(test.(op.=).(reg. |
| 11fda0 | 62 29 20 28 63 6f 6e 73 74 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 | b).(const.0))............(branch |
| 11fdc0 | 20 28 6c 61 62 65 6c 20 67 63 64 2d 64 6f 6e 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 | .(label.gcd-done))............(a |
| 11fde0 | 73 73 69 67 6e 20 74 20 28 6f 70 20 72 65 6d 29 20 28 72 65 67 20 61 29 20 28 72 65 67 20 62 29 | ssign.t.(op.rem).(reg.a).(reg.b) |
| 11fe00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 20 28 72 65 67 20 62 29 29 0a | )............(assign.a.(reg.b)). |
| 11fe20 | 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 62 20 28 72 65 67 20 74 29 29 0a 20 20 | ...........(assign.b.(reg.t))... |
| 11fe40 | 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 67 63 64 29 29 0a 20 20 20 20 | .........(goto.(label.gcd))..... |
| 11fe60 | 20 20 20 20 20 20 67 63 64 2d 64 6f 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 | ......gcd-done............(goto. |
| 11fe80 | 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 2e 2e 2e | (reg.continue))................. |
| 11fea0 | 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 20 42 65 66 6f 72 65 20 63 61 6c 6c 69 6e 67 20 60 67 63 | ...........;;.Before.calling.`gc |
| 11fec0 | 64 27 2c 20 77 65 20 61 73 73 69 67 6e 20 74 6f 20 60 63 6f 6e 74 69 6e 75 65 27 0a 20 20 20 20 | d',.we.assign.to.`continue'..... |
| 11fee0 | 20 20 20 20 20 20 3b 3b 20 74 68 65 20 6c 61 62 65 6c 20 74 6f 20 77 68 69 63 68 20 60 67 63 64 | ......;;.the.label.to.which.`gcd |
| 11ff00 | 27 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 | '.should.return.............(ass |
| 11ff20 | 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 67 63 64 2d 31 29 | ign.continue.(label.after-gcd-1) |
| 11ff40 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 67 63 64 29 29 0a | )............(goto.(label.gcd)). |
| 11ff60 | 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 67 63 64 2d 31 0a 20 20 20 20 20 20 20 20 20 20 | ..........after-gcd-1........... |
| 11ff80 | 20 20 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 20 48 65 72 65 20 69 73 20 74 68 65 20 | .................;;.Here.is.the. |
| 11ffa0 | 73 65 63 6f 6e 64 20 63 61 6c 6c 20 74 6f 20 60 67 63 64 27 2c 20 77 69 74 68 20 61 20 64 69 66 | second.call.to.`gcd',.with.a.dif |
| 11ffc0 | 66 65 72 65 6e 74 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 | ferent.continuation............. |
| 11ffe0 | 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 67 63 | (assign.continue.(label.after-gc |
| 120000 | 64 2d 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 67 63 | d-2))............(goto.(label.gc |
| 120020 | 64 29 29 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 67 63 64 2d 32 0a 0a 0a 20 20 20 54 | d))...........after-gcd-2......T |
| 120040 | 68 69 73 20 69 73 20 61 20 72 65 61 73 6f 6e 61 62 6c 65 20 61 70 70 72 6f 61 63 68 20 66 6f 72 | his.is.a.reasonable.approach.for |
| 120060 | 20 68 61 6e 64 6c 69 6e 67 20 73 6d 61 6c 6c 20 70 72 6f 62 6c 65 6d 73 2c 20 62 75 74 20 69 74 | .handling.small.problems,.but.it |
| 120080 | 0a 77 6f 75 6c 64 20 62 65 20 61 77 6b 77 61 72 64 20 69 66 20 74 68 65 72 65 20 77 65 72 65 20 | .would.be.awkward.if.there.were. |
| 1200a0 | 6d 61 6e 79 20 69 6e 73 74 61 6e 63 65 73 20 6f 66 20 47 43 44 20 63 6f 6d 70 75 74 61 74 69 6f | many.instances.of.GCD.computatio |
| 1200c0 | 6e 73 20 69 6e 20 74 68 65 0a 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 2e 20 20 | ns.in.the.controller.sequence... |
| 1200e0 | 54 6f 20 64 65 63 69 64 65 20 77 68 65 72 65 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20 65 78 65 63 | To.decide.where.to.continue.exec |
| 120100 | 75 74 69 6e 67 20 61 66 74 65 72 20 74 68 65 0a 60 67 63 64 27 20 73 75 62 72 6f 75 74 69 6e 65 | uting.after.the.`gcd'.subroutine |
| 120120 | 2c 20 77 65 20 77 6f 75 6c 64 20 6e 65 65 64 20 74 65 73 74 73 20 69 6e 20 74 68 65 20 64 61 74 | ,.we.would.need.tests.in.the.dat |
| 120140 | 61 20 70 61 74 68 73 20 61 6e 64 20 62 72 61 6e 63 68 0a 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 | a.paths.and.branch.instructions. |
| 120160 | 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 66 6f 72 20 61 6c 6c 20 74 68 65 20 70 6c | in.the.controller.for.all.the.pl |
| 120180 | 61 63 65 73 20 74 68 61 74 20 75 73 65 20 60 67 63 64 27 2e 20 20 41 0a 6d 6f 72 65 20 70 6f 77 | aces.that.use.`gcd'...A.more.pow |
| 1201a0 | 65 72 66 75 6c 20 6d 65 74 68 6f 64 20 66 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 73 75 | erful.method.for.implementing.su |
| 1201c0 | 62 72 6f 75 74 69 6e 65 73 20 69 73 20 74 6f 20 68 61 76 65 20 74 68 65 0a 60 63 6f 6e 74 69 6e | broutines.is.to.have.the.`contin |
| 1201e0 | 75 65 27 20 72 65 67 69 73 74 65 72 20 68 6f 6c 64 20 74 68 65 20 6c 61 62 65 6c 20 6f 66 20 74 | ue'.register.hold.the.label.of.t |
| 120200 | 68 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 | he.entry.point.in.the.controller |
| 120220 | 0a 73 65 71 75 65 6e 63 65 20 61 74 20 77 68 69 63 68 20 65 78 65 63 75 74 69 6f 6e 20 73 68 6f | .sequence.at.which.execution.sho |
| 120240 | 75 6c 64 20 63 6f 6e 74 69 6e 75 65 20 77 68 65 6e 20 74 68 65 20 73 75 62 72 6f 75 74 69 6e 65 | uld.continue.when.the.subroutine |
| 120260 | 20 69 73 0a 66 69 6e 69 73 68 65 64 2e 20 20 49 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 68 69 73 | .is.finished...Implementing.this |
| 120280 | 20 73 74 72 61 74 65 67 79 20 72 65 71 75 69 72 65 73 20 61 20 6e 65 77 20 6b 69 6e 64 20 6f 66 | .strategy.requires.a.new.kind.of |
| 1202a0 | 20 63 6f 6e 6e 65 63 74 69 6f 6e 0a 62 65 74 77 65 65 6e 20 74 68 65 20 64 61 74 61 20 70 61 74 | .connection.between.the.data.pat |
| 1202c0 | 68 73 20 61 6e 64 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 6f 66 20 61 20 72 65 67 69 73 | hs.and.the.controller.of.a.regis |
| 1202e0 | 74 65 72 20 6d 61 63 68 69 6e 65 3a 20 54 68 65 72 65 0a 6d 75 73 74 20 62 65 20 61 20 77 61 79 | ter.machine:.There.must.be.a.way |
| 120300 | 20 74 6f 20 61 73 73 69 67 6e 20 74 6f 20 61 20 72 65 67 69 73 74 65 72 20 61 20 6c 61 62 65 6c | .to.assign.to.a.register.a.label |
| 120320 | 20 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 0a 73 65 71 75 65 6e 63 65 20 69 6e 20 73 | .in.the.controller.sequence.in.s |
| 120340 | 75 63 68 20 61 20 77 61 79 20 74 68 61 74 20 74 68 69 73 20 76 61 6c 75 65 20 63 61 6e 20 62 65 | uch.a.way.that.this.value.can.be |
| 120360 | 20 66 65 74 63 68 65 64 20 66 72 6f 6d 20 74 68 65 20 72 65 67 69 73 74 65 72 0a 61 6e 64 20 75 | .fetched.from.the.register.and.u |
| 120380 | 73 65 64 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20 65 78 65 63 75 74 69 6f 6e 20 61 74 20 74 68 65 | sed.to.continue.execution.at.the |
| 1203a0 | 20 64 65 73 69 67 6e 61 74 65 64 20 65 6e 74 72 79 20 70 6f 69 6e 74 2e 0a 0a 20 20 20 54 6f 20 | .designated.entry.point......To. |
| 1203c0 | 72 65 66 6c 65 63 74 20 74 68 69 73 20 61 62 69 6c 69 74 79 2c 20 77 65 20 77 69 6c 6c 20 65 78 | reflect.this.ability,.we.will.ex |
| 1203e0 | 74 65 6e 64 20 74 68 65 20 60 61 73 73 69 67 6e 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 6f 66 | tend.the.`assign'.instruction.of |
| 120400 | 0a 74 68 65 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 20 74 | .the.register-machine.language.t |
| 120420 | 6f 20 61 6c 6c 6f 77 20 61 20 72 65 67 69 73 74 65 72 20 74 6f 20 62 65 20 61 73 73 69 67 6e 65 | o.allow.a.register.to.be.assigne |
| 120440 | 64 20 61 73 0a 76 61 6c 75 65 20 61 20 6c 61 62 65 6c 20 66 72 6f 6d 20 74 68 65 20 63 6f 6e 74 | d.as.value.a.label.from.the.cont |
| 120460 | 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 20 28 61 73 20 61 20 73 70 65 63 69 61 6c 20 6b 69 | roller.sequence.(as.a.special.ki |
| 120480 | 6e 64 20 6f 66 0a 63 6f 6e 73 74 61 6e 74 29 2e 20 20 57 65 20 77 69 6c 6c 20 61 6c 73 6f 20 65 | nd.of.constant)...We.will.also.e |
| 1204a0 | 78 74 65 6e 64 20 74 68 65 20 60 67 6f 74 6f 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 74 6f 20 | xtend.the.`goto'.instruction.to. |
| 1204c0 | 61 6c 6c 6f 77 0a 65 78 65 63 75 74 69 6f 6e 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20 61 74 20 74 | allow.execution.to.continue.at.t |
| 1204e0 | 68 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 64 65 73 63 72 69 62 65 64 20 62 79 20 74 68 65 20 | he.entry.point.described.by.the. |
| 120500 | 63 6f 6e 74 65 6e 74 73 20 6f 66 20 61 0a 72 65 67 69 73 74 65 72 20 72 61 74 68 65 72 20 74 68 | contents.of.a.register.rather.th |
| 120520 | 61 6e 20 6f 6e 6c 79 20 61 74 20 61 6e 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 64 65 73 63 72 69 | an.only.at.an.entry.point.descri |
| 120540 | 62 65 64 20 62 79 20 61 20 63 6f 6e 73 74 61 6e 74 0a 6c 61 62 65 6c 2e 20 20 55 73 69 6e 67 20 | bed.by.a.constant.label...Using. |
| 120560 | 74 68 65 73 65 20 6e 65 77 20 63 6f 6e 73 74 72 75 63 74 73 20 77 65 20 63 61 6e 20 74 65 72 6d | these.new.constructs.we.can.term |
| 120580 | 69 6e 61 74 65 20 74 68 65 20 60 67 63 64 27 0a 73 75 62 72 6f 75 74 69 6e 65 20 77 69 74 68 20 | inate.the.`gcd'.subroutine.with. |
| 1205a0 | 61 20 62 72 61 6e 63 68 20 74 6f 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 20 73 74 6f 72 65 64 20 | a.branch.to.the.location.stored. |
| 1205c0 | 69 6e 20 74 68 65 20 60 63 6f 6e 74 69 6e 75 65 27 0a 72 65 67 69 73 74 65 72 2e 20 20 54 68 69 | in.the.`continue'.register...Thi |
| 1205e0 | 73 20 6c 65 61 64 73 20 74 6f 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e | s.leads.to.the.controller.sequen |
| 120600 | 63 65 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a 35 2d 31 30 3a 3a 2e | ce.shown.in.*Note.Figure.5-10::. |
| 120620 | 0a 0a 20 20 20 41 20 6d 61 63 68 69 6e 65 20 77 69 74 68 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e | .....A.machine.with.more.than.on |
| 120640 | 65 20 73 75 62 72 6f 75 74 69 6e 65 20 63 6f 75 6c 64 20 75 73 65 20 6d 75 6c 74 69 70 6c 65 0a | e.subroutine.could.use.multiple. |
| 120660 | 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 72 65 67 69 73 74 65 72 73 20 28 65 2e 67 2e 2c 20 60 67 | continuation.registers.(e.g.,.`g |
| 120680 | 63 64 2d 63 6f 6e 74 69 6e 75 65 27 2c 20 60 66 61 63 74 6f 72 69 61 6c 2d 63 6f 6e 74 69 6e 75 | cd-continue',.`factorial-continu |
| 1206a0 | 65 27 29 20 6f 72 0a 77 65 20 63 6f 75 6c 64 20 68 61 76 65 20 61 6c 6c 20 73 75 62 72 6f 75 74 | e').or.we.could.have.all.subrout |
| 1206c0 | 69 6e 65 73 20 73 68 61 72 65 20 61 20 73 69 6e 67 6c 65 20 60 63 6f 6e 74 69 6e 75 65 27 20 72 | ines.share.a.single.`continue'.r |
| 1206e0 | 65 67 69 73 74 65 72 2e 0a 53 68 61 72 69 6e 67 20 69 73 20 6d 6f 72 65 20 65 63 6f 6e 6f 6d 69 | egister..Sharing.is.more.economi |
| 120700 | 63 61 6c 2c 20 62 75 74 20 77 65 20 6d 75 73 74 20 62 65 20 63 61 72 65 66 75 6c 20 69 66 20 77 | cal,.but.we.must.be.careful.if.w |
| 120720 | 65 20 68 61 76 65 20 61 0a 73 75 62 72 6f 75 74 69 6e 65 20 28 60 73 75 62 31 27 29 20 74 68 61 | e.have.a.subroutine.(`sub1').tha |
| 120740 | 74 20 63 61 6c 6c 73 20 61 6e 6f 74 68 65 72 20 73 75 62 72 6f 75 74 69 6e 65 20 28 60 73 75 62 | t.calls.another.subroutine.(`sub |
| 120760 | 32 27 29 2e 20 20 55 6e 6c 65 73 73 0a 60 73 75 62 31 27 20 73 61 76 65 73 20 74 68 65 20 63 6f | 2')...Unless.`sub1'.saves.the.co |
| 120780 | 6e 74 65 6e 74 73 20 6f 66 20 60 63 6f 6e 74 69 6e 75 65 27 20 69 6e 20 73 6f 6d 65 20 6f 74 68 | ntents.of.`continue'.in.some.oth |
| 1207a0 | 65 72 20 72 65 67 69 73 74 65 72 20 62 65 66 6f 72 65 0a 73 65 74 74 69 6e 67 20 75 70 20 60 63 | er.register.before.setting.up.`c |
| 1207c0 | 6f 6e 74 69 6e 75 65 27 20 66 6f 72 20 74 68 65 20 63 61 6c 6c 20 74 6f 20 60 73 75 62 32 27 2c | ontinue'.for.the.call.to.`sub2', |
| 1207e0 | 20 60 73 75 62 31 27 20 77 69 6c 6c 20 6e 6f 74 20 6b 6e 6f 77 0a 77 68 65 72 65 20 74 6f 20 67 | .`sub1'.will.not.know.where.to.g |
| 120800 | 6f 20 77 68 65 6e 20 69 74 20 69 73 20 66 69 6e 69 73 68 65 64 2e 20 20 54 68 65 20 6d 65 63 68 | o.when.it.is.finished...The.mech |
| 120820 | 61 6e 69 73 6d 20 64 65 76 65 6c 6f 70 65 64 20 69 6e 20 74 68 65 20 6e 65 78 74 0a 73 65 63 74 | anism.developed.in.the.next.sect |
| 120840 | 69 6f 6e 20 74 6f 20 68 61 6e 64 6c 65 20 72 65 63 75 72 73 69 6f 6e 20 61 6c 73 6f 20 70 72 6f | ion.to.handle.recursion.also.pro |
| 120860 | 76 69 64 65 73 20 61 20 62 65 74 74 65 72 20 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 74 68 69 73 0a | vides.a.better.solution.to.this. |
| 120880 | 70 72 6f 62 6c 65 6d 20 6f 66 20 6e 65 73 74 65 64 20 73 75 62 72 6f 75 74 69 6e 65 20 63 61 6c | problem.of.nested.subroutine.cal |
| 1208a0 | 6c 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 | ls.....File:.sicp.info,..Node:.5 |
| 1208c0 | 2d 31 2d 34 2c 20 20 4e 65 78 74 3a 20 35 2d 31 2d 35 2c 20 20 50 72 65 76 3a 20 35 2d 31 2d 33 | -1-4,..Next:.5-1-5,..Prev:.5-1-3 |
| 1208e0 | 2c 20 20 55 70 3a 20 35 2d 31 0a 0a 35 2e 31 2e 34 20 55 73 69 6e 67 20 61 20 53 74 61 63 6b 20 | ,..Up:.5-1..5.1.4.Using.a.Stack. |
| 120900 | 74 6f 20 49 6d 70 6c 65 6d 65 6e 74 20 52 65 63 75 72 73 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d | to.Implement.Recursion.--------- |
| 120920 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 120940 | 2d 0a 0a 57 69 74 68 20 74 68 65 20 69 64 65 61 73 20 69 6c 6c 75 73 74 72 61 74 65 64 20 73 6f | -..With.the.ideas.illustrated.so |
| 120960 | 20 66 61 72 2c 20 77 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 61 6e 79 20 69 74 65 72 61 | .far,.we.can.implement.any.itera |
| 120980 | 74 69 76 65 0a 70 72 6f 63 65 73 73 20 62 79 20 73 70 65 63 69 66 79 69 6e 67 20 61 20 72 65 67 | tive.process.by.specifying.a.reg |
| 1209a0 | 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 68 61 73 20 61 20 72 65 67 69 73 74 65 | ister.machine.that.has.a.registe |
| 1209c0 | 72 0a 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 65 61 63 68 20 73 74 61 74 65 20 76 61 | r.corresponding.to.each.state.va |
| 1209e0 | 72 69 61 62 6c 65 20 6f 66 20 74 68 65 20 70 72 6f 63 65 73 73 2e 20 20 54 68 65 20 6d 61 63 68 | riable.of.the.process...The.mach |
| 120a00 | 69 6e 65 0a 72 65 70 65 61 74 65 64 6c 79 20 65 78 65 63 75 74 65 73 20 61 20 63 6f 6e 74 72 6f | ine.repeatedly.executes.a.contro |
| 120a20 | 6c 6c 65 72 20 6c 6f 6f 70 2c 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 | ller.loop,.changing.the.contents |
| 120a40 | 20 6f 66 20 74 68 65 0a 72 65 67 69 73 74 65 72 73 2c 20 75 6e 74 69 6c 20 73 6f 6d 65 20 74 65 | .of.the.registers,.until.some.te |
| 120a60 | 72 6d 69 6e 61 74 69 6f 6e 20 63 6f 6e 64 69 74 69 6f 6e 20 69 73 20 73 61 74 69 73 66 69 65 64 | rmination.condition.is.satisfied |
| 120a80 | 2e 20 20 41 74 20 65 61 63 68 0a 70 6f 69 6e 74 20 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c | ...At.each.point.in.the.controll |
| 120aa0 | 65 72 20 73 65 71 75 65 6e 63 65 2c 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 6d 61 | er.sequence,.the.state.of.the.ma |
| 120ac0 | 63 68 69 6e 65 0a 28 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 65 20 73 74 61 74 65 20 6f 66 | chine.(representing.the.state.of |
| 120ae0 | 20 74 68 65 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 29 20 69 73 20 63 6f 6d 70 6c | .the.iterative.process).is.compl |
| 120b00 | 65 74 65 6c 79 0a 64 65 74 65 72 6d 69 6e 65 64 20 62 79 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 | etely.determined.by.the.contents |
| 120b20 | 20 6f 66 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 28 74 68 65 20 76 61 6c 75 65 73 20 6f 66 | .of.the.registers.(the.values.of |
| 120b40 | 20 74 68 65 20 73 74 61 74 65 0a 76 61 72 69 61 62 6c 65 73 29 2e 0a 0a 20 20 20 49 6d 70 6c 65 | .the.state.variables)......Imple |
| 120b60 | 6d 65 6e 74 69 6e 67 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 65 73 2c 20 68 6f 77 | menting.recursive.processes,.how |
| 120b80 | 65 76 65 72 2c 20 72 65 71 75 69 72 65 73 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 6c 0a 6d 65 63 | ever,.requires.an.additional.mec |
| 120ba0 | 68 61 6e 69 73 6d 2e 20 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 | hanism...Consider.the.following. |
| 120bc0 | 72 65 63 75 72 73 69 76 65 20 6d 65 74 68 6f 64 20 66 6f 72 20 63 6f 6d 70 75 74 69 6e 67 0a 66 | recursive.method.for.computing.f |
| 120be0 | 61 63 74 6f 72 69 61 6c 73 2c 20 77 68 69 63 68 20 77 65 20 66 69 72 73 74 20 65 78 61 6d 69 6e | actorials,.which.we.first.examin |
| 120c00 | 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 31 3a 3a 3a 0a 0a 20 20 | ed.in.section.*Note.1-2-1:::.... |
| 120c20 | 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 | ...(define.(factorial.n)........ |
| 120c40 | 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 | (if.(=.n.1)............1........ |
| 120c60 | 20 20 20 20 28 2a 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 29 29 0a | ....(*.(factorial.(-.n.1)).n))). |
| 120c80 | 0a 20 20 20 41 73 20 77 65 20 73 65 65 20 66 72 6f 6d 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 | ....As.we.see.from.the.procedure |
| 120ca0 | 2c 20 63 6f 6d 70 75 74 69 6e 67 20 6e 21 20 72 65 71 75 69 72 65 73 20 63 6f 6d 70 75 74 69 6e | ,.computing.n!.requires.computin |
| 120cc0 | 67 20 28 6e 20 2d 0a 31 29 21 2e 20 20 4f 75 72 20 47 43 44 20 6d 61 63 68 69 6e 65 2c 20 6d 6f | g.(n.-.1)!...Our.GCD.machine,.mo |
| 120ce0 | 64 65 6c 65 64 20 6f 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 20 20 28 64 65 | deled.on.the.procedure.......(de |
| 120d00 | 66 69 6e 65 20 28 67 63 64 20 61 20 62 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 62 20 30 | fine.(gcd.a.b)........(if.(=.b.0 |
| 120d20 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 61 0a 20 20 20 20 20 20 20 20 20 20 20 28 67 63 64 20 62 | )............a............(gcd.b |
| 120d40 | 20 28 72 65 6d 61 69 6e 64 65 72 20 61 20 62 29 29 29 29 0a 0a 73 69 6d 69 6c 61 72 6c 79 20 68 | .(remainder.a.b))))..similarly.h |
| 120d60 | 61 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 61 6e 6f 74 68 65 72 20 47 43 44 2e 20 20 42 75 74 20 | ad.to.compute.another.GCD...But. |
| 120d80 | 74 68 65 72 65 20 69 73 20 61 6e 20 69 6d 70 6f 72 74 61 6e 74 0a 64 69 66 66 65 72 65 6e 63 65 | there.is.an.important.difference |
| 120da0 | 20 62 65 74 77 65 65 6e 20 74 68 65 20 60 67 63 64 27 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 | .between.the.`gcd'.procedure,.wh |
| 120dc0 | 69 63 68 20 72 65 64 75 63 65 73 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 0a 63 6f 6d 70 75 74 61 | ich.reduces.the.original.computa |
| 120de0 | 74 69 6f 6e 20 74 6f 20 61 20 6e 65 77 20 47 43 44 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 61 | tion.to.a.new.GCD.computation,.a |
| 120e00 | 6e 64 20 60 66 61 63 74 6f 72 69 61 6c 27 2c 20 77 68 69 63 68 20 72 65 71 75 69 72 65 73 0a 63 | nd.`factorial',.which.requires.c |
| 120e20 | 6f 6d 70 75 74 69 6e 67 20 61 6e 6f 74 68 65 72 20 66 61 63 74 6f 72 69 61 6c 20 61 73 20 61 20 | omputing.another.factorial.as.a. |
| 120e40 | 73 75 62 70 72 6f 62 6c 65 6d 2e 20 20 49 6e 20 47 43 44 2c 20 74 68 65 20 61 6e 73 77 65 72 20 | subproblem...In.GCD,.the.answer. |
| 120e60 | 74 6f 20 74 68 65 0a 6e 65 77 20 47 43 44 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 69 73 20 74 68 | to.the.new.GCD.computation.is.th |
| 120e80 | 65 20 61 6e 73 77 65 72 20 74 6f 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 72 6f 62 6c 65 6d | e.answer.to.the.original.problem |
| 120ea0 | 2e 20 20 54 6f 20 63 6f 6d 70 75 74 65 0a 74 68 65 20 6e 65 78 74 20 47 43 44 2c 20 77 65 20 73 | ...To.compute.the.next.GCD,.we.s |
| 120ec0 | 69 6d 70 6c 79 20 70 6c 61 63 65 20 74 68 65 20 6e 65 77 20 61 72 67 75 6d 65 6e 74 73 20 69 6e | imply.place.the.new.arguments.in |
| 120ee0 | 20 74 68 65 20 69 6e 70 75 74 20 72 65 67 69 73 74 65 72 73 0a 6f 66 20 74 68 65 20 47 43 44 20 | .the.input.registers.of.the.GCD. |
| 120f00 | 6d 61 63 68 69 6e 65 20 61 6e 64 20 72 65 75 73 65 20 74 68 65 20 6d 61 63 68 69 6e 65 27 73 20 | machine.and.reuse.the.machine's. |
| 120f20 | 64 61 74 61 20 70 61 74 68 73 20 62 79 20 65 78 65 63 75 74 69 6e 67 20 74 68 65 0a 73 61 6d 65 | data.paths.by.executing.the.same |
| 120f40 | 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 2e 20 20 57 68 65 6e 20 74 68 65 20 | .controller.sequence...When.the. |
| 120f60 | 6d 61 63 68 69 6e 65 20 69 73 20 66 69 6e 69 73 68 65 64 20 73 6f 6c 76 69 6e 67 20 74 68 65 0a | machine.is.finished.solving.the. |
| 120f80 | 66 69 6e 61 6c 20 47 43 44 20 70 72 6f 62 6c 65 6d 2c 20 69 74 20 68 61 73 20 63 6f 6d 70 6c 65 | final.GCD.problem,.it.has.comple |
| 120fa0 | 74 65 64 20 74 68 65 20 65 6e 74 69 72 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 0a 0a 20 20 20 | ted.the.entire.computation...... |
| 120fc0 | 49 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 66 61 63 74 6f 72 69 61 6c 20 28 6f 72 20 61 6e 79 | In.the.case.of.factorial.(or.any |
| 120fe0 | 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 29 20 74 68 65 20 61 6e 73 77 65 72 20 74 | .recursive.process).the.answer.t |
| 121000 | 6f 0a 74 68 65 20 6e 65 77 20 66 61 63 74 6f 72 69 61 6c 20 73 75 62 70 72 6f 62 6c 65 6d 20 69 | o.the.new.factorial.subproblem.i |
| 121020 | 73 20 6e 6f 74 20 74 68 65 20 61 6e 73 77 65 72 20 74 6f 20 74 68 65 20 6f 72 69 67 69 6e 61 6c | s.not.the.answer.to.the.original |
| 121040 | 20 70 72 6f 62 6c 65 6d 2e 0a 54 68 65 20 76 61 6c 75 65 20 6f 62 74 61 69 6e 65 64 20 66 6f 72 | .problem..The.value.obtained.for |
| 121060 | 20 28 6e 20 2d 20 31 29 21 20 6d 75 73 74 20 62 65 20 6d 75 6c 74 69 70 6c 69 65 64 20 62 79 20 | .(n.-.1)!.must.be.multiplied.by. |
| 121080 | 6e 20 74 6f 20 67 65 74 20 74 68 65 0a 66 69 6e 61 6c 20 61 6e 73 77 65 72 2e 20 20 49 66 20 77 | n.to.get.the.final.answer...If.w |
| 1210a0 | 65 20 74 72 79 20 74 6f 20 69 6d 69 74 61 74 65 20 74 68 65 20 47 43 44 20 64 65 73 69 67 6e 2c | e.try.to.imitate.the.GCD.design, |
| 1210c0 | 20 61 6e 64 20 73 6f 6c 76 65 20 74 68 65 0a 66 61 63 74 6f 72 69 61 6c 20 73 75 62 70 72 6f 62 | .and.solve.the.factorial.subprob |
| 1210e0 | 6c 65 6d 20 62 79 20 64 65 63 72 65 6d 65 6e 74 69 6e 67 20 74 68 65 20 60 6e 27 20 72 65 67 69 | lem.by.decrementing.the.`n'.regi |
| 121100 | 73 74 65 72 20 61 6e 64 20 72 65 72 75 6e 6e 69 6e 67 20 74 68 65 0a 66 61 63 74 6f 72 69 61 6c | ster.and.rerunning.the.factorial |
| 121120 | 20 6d 61 63 68 69 6e 65 2c 20 77 65 20 77 69 6c 6c 20 6e 6f 20 6c 6f 6e 67 65 72 20 68 61 76 65 | .machine,.we.will.no.longer.have |
| 121140 | 20 61 76 61 69 6c 61 62 6c 65 20 74 68 65 20 6f 6c 64 20 76 61 6c 75 65 20 6f 66 0a 60 6e 27 20 | .available.the.old.value.of.`n'. |
| 121160 | 62 79 20 77 68 69 63 68 20 74 6f 20 6d 75 6c 74 69 70 6c 79 20 74 68 65 20 72 65 73 75 6c 74 2e | by.which.to.multiply.the.result. |
| 121180 | 20 20 57 65 20 74 68 75 73 20 6e 65 65 64 20 61 20 73 65 63 6f 6e 64 20 66 61 63 74 6f 72 69 61 | ..We.thus.need.a.second.factoria |
| 1211a0 | 6c 0a 6d 61 63 68 69 6e 65 20 74 6f 20 77 6f 72 6b 20 6f 6e 20 74 68 65 20 73 75 62 70 72 6f 62 | l.machine.to.work.on.the.subprob |
| 1211c0 | 6c 65 6d 2e 20 20 54 68 69 73 20 73 65 63 6f 6e 64 20 66 61 63 74 6f 72 69 61 6c 20 63 6f 6d 70 | lem...This.second.factorial.comp |
| 1211e0 | 75 74 61 74 69 6f 6e 0a 69 74 73 65 6c 66 20 68 61 73 20 61 20 66 61 63 74 6f 72 69 61 6c 20 73 | utation.itself.has.a.factorial.s |
| 121200 | 75 62 70 72 6f 62 6c 65 6d 2c 20 77 68 69 63 68 20 72 65 71 75 69 72 65 73 20 61 20 74 68 69 72 | ubproblem,.which.requires.a.thir |
| 121220 | 64 20 66 61 63 74 6f 72 69 61 6c 0a 6d 61 63 68 69 6e 65 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 | d.factorial.machine,.and.so.on.. |
| 121240 | 20 53 69 6e 63 65 20 65 61 63 68 20 66 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 20 63 6f | .Since.each.factorial.machine.co |
| 121260 | 6e 74 61 69 6e 73 20 61 6e 6f 74 68 65 72 0a 66 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 | ntains.another.factorial.machine |
| 121280 | 20 77 69 74 68 69 6e 20 69 74 2c 20 74 68 65 20 74 6f 74 61 6c 20 6d 61 63 68 69 6e 65 20 63 6f | .within.it,.the.total.machine.co |
| 1212a0 | 6e 74 61 69 6e 73 20 61 6e 20 69 6e 66 69 6e 69 74 65 0a 6e 65 73 74 20 6f 66 20 73 69 6d 69 6c | ntains.an.infinite.nest.of.simil |
| 1212c0 | 61 72 20 6d 61 63 68 69 6e 65 73 20 61 6e 64 20 68 65 6e 63 65 20 63 61 6e 6e 6f 74 20 62 65 20 | ar.machines.and.hence.cannot.be. |
| 1212e0 | 63 6f 6e 73 74 72 75 63 74 65 64 20 66 72 6f 6d 20 61 20 66 69 78 65 64 2c 0a 66 69 6e 69 74 65 | constructed.from.a.fixed,.finite |
| 121300 | 20 6e 75 6d 62 65 72 20 6f 66 20 70 61 72 74 73 2e 0a 0a 20 20 20 4e 65 76 65 72 74 68 65 6c 65 | .number.of.parts......Neverthele |
| 121320 | 73 73 2c 20 77 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 66 61 63 74 6f 72 69 | ss,.we.can.implement.the.factori |
| 121340 | 61 6c 20 70 72 6f 63 65 73 73 20 61 73 20 61 20 72 65 67 69 73 74 65 72 0a 6d 61 63 68 69 6e 65 | al.process.as.a.register.machine |
| 121360 | 20 69 66 20 77 65 20 63 61 6e 20 61 72 72 61 6e 67 65 20 74 6f 20 75 73 65 20 74 68 65 20 73 61 | .if.we.can.arrange.to.use.the.sa |
| 121380 | 6d 65 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 66 6f 72 20 65 61 63 68 20 6e 65 73 74 65 64 0a 69 6e | me.components.for.each.nested.in |
| 1213a0 | 73 74 61 6e 63 65 20 6f 66 20 74 68 65 20 6d 61 63 68 69 6e 65 2e 20 20 53 70 65 63 69 66 69 63 | stance.of.the.machine...Specific |
| 1213c0 | 61 6c 6c 79 2c 20 74 68 65 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 | ally,.the.machine.that.computes. |
| 1213e0 | 6e 21 0a 73 68 6f 75 6c 64 20 75 73 65 20 74 68 65 20 73 61 6d 65 20 63 6f 6d 70 6f 6e 65 6e 74 | n!.should.use.the.same.component |
| 121400 | 73 20 74 6f 20 77 6f 72 6b 20 6f 6e 20 74 68 65 20 73 75 62 70 72 6f 62 6c 65 6d 20 6f 66 20 63 | s.to.work.on.the.subproblem.of.c |
| 121420 | 6f 6d 70 75 74 69 6e 67 0a 28 6e 20 2d 20 31 29 21 2c 20 6f 6e 20 74 68 65 20 73 75 62 70 72 6f | omputing.(n.-.1)!,.on.the.subpro |
| 121440 | 62 6c 65 6d 20 66 6f 72 20 28 6e 20 2d 20 32 29 21 2c 20 61 6e 64 20 73 6f 20 6f 6e 2e 20 20 54 | blem.for.(n.-.2)!,.and.so.on...T |
| 121460 | 68 69 73 20 69 73 20 70 6c 61 75 73 69 62 6c 65 0a 62 65 63 61 75 73 65 2c 20 61 6c 74 68 6f 75 | his.is.plausible.because,.althou |
| 121480 | 67 68 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 70 72 6f 63 65 73 73 20 64 69 63 74 61 74 65 | gh.the.factorial.process.dictate |
| 1214a0 | 73 20 74 68 61 74 20 61 6e 20 75 6e 62 6f 75 6e 64 65 64 0a 6e 75 6d 62 65 72 20 6f 66 20 63 6f | s.that.an.unbounded.number.of.co |
| 1214c0 | 70 69 65 73 20 6f 66 20 74 68 65 20 73 61 6d 65 20 6d 61 63 68 69 6e 65 20 61 72 65 20 6e 65 65 | pies.of.the.same.machine.are.nee |
| 1214e0 | 64 65 64 20 74 6f 20 70 65 72 66 6f 72 6d 20 61 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 6f 6e | ded.to.perform.a.computation,.on |
| 121500 | 6c 79 20 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 63 6f 70 69 65 73 20 6e 65 65 64 73 20 74 6f 20 | ly.one.of.these.copies.needs.to. |
| 121520 | 62 65 20 61 63 74 69 76 65 20 61 74 20 61 6e 79 20 67 69 76 65 6e 0a 74 69 6d 65 2e 20 20 57 68 | be.active.at.any.given.time...Wh |
| 121540 | 65 6e 20 74 68 65 20 6d 61 63 68 69 6e 65 20 65 6e 63 6f 75 6e 74 65 72 73 20 61 20 72 65 63 75 | en.the.machine.encounters.a.recu |
| 121560 | 72 73 69 76 65 20 73 75 62 70 72 6f 62 6c 65 6d 2c 20 69 74 20 63 61 6e 0a 73 75 73 70 65 6e 64 | rsive.subproblem,.it.can.suspend |
| 121580 | 20 77 6f 72 6b 20 6f 6e 20 74 68 65 20 6d 61 69 6e 20 70 72 6f 62 6c 65 6d 2c 20 72 65 75 73 65 | .work.on.the.main.problem,.reuse |
| 1215a0 | 20 74 68 65 20 73 61 6d 65 20 70 68 79 73 69 63 61 6c 20 70 61 72 74 73 20 74 6f 20 77 6f 72 6b | .the.same.physical.parts.to.work |
| 1215c0 | 0a 6f 6e 20 74 68 65 20 73 75 62 70 72 6f 62 6c 65 6d 2c 20 74 68 65 6e 20 63 6f 6e 74 69 6e 75 | .on.the.subproblem,.then.continu |
| 1215e0 | 65 20 74 68 65 20 73 75 73 70 65 6e 64 65 64 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 0a 0a 20 20 | e.the.suspended.computation..... |
| 121600 | 20 49 6e 20 74 68 65 20 73 75 62 70 72 6f 62 6c 65 6d 2c 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 | .In.the.subproblem,.the.contents |
| 121620 | 20 6f 66 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 77 69 6c 6c 20 62 65 20 64 69 66 66 65 72 | .of.the.registers.will.be.differ |
| 121640 | 65 6e 74 0a 74 68 61 6e 20 74 68 65 79 20 77 65 72 65 20 69 6e 20 74 68 65 20 6d 61 69 6e 20 70 | ent.than.they.were.in.the.main.p |
| 121660 | 72 6f 62 6c 65 6d 2e 20 28 49 6e 20 74 68 69 73 20 63 61 73 65 20 74 68 65 20 60 6e 27 20 72 65 | roblem..(In.this.case.the.`n'.re |
| 121680 | 67 69 73 74 65 72 20 69 73 0a 64 65 63 72 65 6d 65 6e 74 65 64 2e 29 20 20 49 6e 20 6f 72 64 65 | gister.is.decremented.)..In.orde |
| 1216a0 | 72 20 74 6f 20 62 65 20 61 62 6c 65 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 73 75 73 | r.to.be.able.to.continue.the.sus |
| 1216c0 | 70 65 6e 64 65 64 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 74 68 65 20 6d 61 63 68 69 6e 65 20 | pended.computation,.the.machine. |
| 1216e0 | 6d 75 73 74 20 73 61 76 65 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 61 6e 79 20 72 65 | must.save.the.contents.of.any.re |
| 121700 | 67 69 73 74 65 72 73 20 74 68 61 74 0a 77 69 6c 6c 20 62 65 20 6e 65 65 64 65 64 20 61 66 74 65 | gisters.that.will.be.needed.afte |
| 121720 | 72 20 74 68 65 20 73 75 62 70 72 6f 62 6c 65 6d 20 69 73 20 73 6f 6c 76 65 64 20 73 6f 20 74 68 | r.the.subproblem.is.solved.so.th |
| 121740 | 61 74 20 74 68 65 73 65 20 63 61 6e 20 62 65 0a 72 65 73 74 6f 72 65 64 20 74 6f 20 63 6f 6e 74 | at.these.can.be.restored.to.cont |
| 121760 | 69 6e 75 65 20 74 68 65 20 73 75 73 70 65 6e 64 65 64 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 | inue.the.suspended.computation.. |
| 121780 | 20 49 6e 20 74 68 65 20 63 61 73 65 20 6f 66 0a 66 61 63 74 6f 72 69 61 6c 2c 20 77 65 20 77 69 | .In.the.case.of.factorial,.we.wi |
| 1217a0 | 6c 6c 20 73 61 76 65 20 74 68 65 20 6f 6c 64 20 76 61 6c 75 65 20 6f 66 20 60 6e 27 2c 20 74 6f | ll.save.the.old.value.of.`n',.to |
| 1217c0 | 20 62 65 20 72 65 73 74 6f 72 65 64 20 77 68 65 6e 20 77 65 0a 61 72 65 20 66 69 6e 69 73 68 65 | .be.restored.when.we.are.finishe |
| 1217e0 | 64 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 6f 66 20 74 68 65 | d.computing.the.factorial.of.the |
| 121800 | 20 64 65 63 72 65 6d 65 6e 74 65 64 20 60 6e 27 20 72 65 67 69 73 74 65 72 2e 28 31 29 0a 0a 20 | .decremented.`n'.register.(1)... |
| 121820 | 20 20 53 69 6e 63 65 20 74 68 65 72 65 20 69 73 20 6e 6f 20 5f 61 20 70 72 69 6f 72 69 5f 20 6c | ..Since.there.is.no._a.priori_.l |
| 121840 | 69 6d 69 74 20 6f 6e 20 74 68 65 20 64 65 70 74 68 20 6f 66 20 6e 65 73 74 65 64 20 72 65 63 75 | imit.on.the.depth.of.nested.recu |
| 121860 | 72 73 69 76 65 0a 63 61 6c 6c 73 2c 20 77 65 20 6d 61 79 20 6e 65 65 64 20 74 6f 20 73 61 76 65 | rsive.calls,.we.may.need.to.save |
| 121880 | 20 61 6e 20 61 72 62 69 74 72 61 72 79 20 6e 75 6d 62 65 72 20 6f 66 20 72 65 67 69 73 74 65 72 | .an.arbitrary.number.of.register |
| 1218a0 | 20 76 61 6c 75 65 73 2e 0a 54 68 65 73 65 20 76 61 6c 75 65 73 20 6d 75 73 74 20 62 65 20 72 65 | .values..These.values.must.be.re |
| 1218c0 | 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 72 65 76 65 72 73 65 20 6f 66 20 74 68 65 20 6f 72 64 | stored.in.the.reverse.of.the.ord |
| 1218e0 | 65 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 79 0a 77 65 72 65 20 73 61 76 65 64 2c 20 73 69 6e | er.in.which.they.were.saved,.sin |
| 121900 | 63 65 20 69 6e 20 61 20 6e 65 73 74 20 6f 66 20 72 65 63 75 72 73 69 6f 6e 73 20 74 68 65 20 6c | ce.in.a.nest.of.recursions.the.l |
| 121920 | 61 73 74 20 73 75 62 70 72 6f 62 6c 65 6d 20 74 6f 20 62 65 0a 65 6e 74 65 72 65 64 20 69 73 20 | ast.subproblem.to.be.entered.is. |
| 121940 | 74 68 65 20 66 69 72 73 74 20 74 6f 20 62 65 20 66 69 6e 69 73 68 65 64 2e 20 20 54 68 69 73 20 | the.first.to.be.finished...This. |
| 121960 | 64 69 63 74 61 74 65 73 20 74 68 65 20 75 73 65 20 6f 66 20 61 20 22 73 74 61 63 6b 22 2c 0a 6f | dictates.the.use.of.a."stack",.o |
| 121980 | 72 20 22 6c 61 73 74 20 69 6e 2c 20 66 69 72 73 74 20 6f 75 74 22 20 64 61 74 61 20 73 74 72 75 | r."last.in,.first.out".data.stru |
| 1219a0 | 63 74 75 72 65 2c 20 74 6f 20 73 61 76 65 20 72 65 67 69 73 74 65 72 20 76 61 6c 75 65 73 2e 20 | cture,.to.save.register.values.. |
| 1219c0 | 20 57 65 0a 63 61 6e 20 65 78 74 65 6e 64 20 74 68 65 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 | .We.can.extend.the.register-mach |
| 1219e0 | 69 6e 65 20 6c 61 6e 67 75 61 67 65 20 74 6f 20 69 6e 63 6c 75 64 65 20 61 20 73 74 61 63 6b 20 | ine.language.to.include.a.stack. |
| 121a00 | 62 79 20 61 64 64 69 6e 67 0a 74 77 6f 20 6b 69 6e 64 73 20 6f 66 20 69 6e 73 74 72 75 63 74 69 | by.adding.two.kinds.of.instructi |
| 121a20 | 6f 6e 73 3a 20 56 61 6c 75 65 73 20 61 72 65 20 70 6c 61 63 65 64 20 6f 6e 20 74 68 65 20 73 74 | ons:.Values.are.placed.on.the.st |
| 121a40 | 61 63 6b 20 75 73 69 6e 67 20 61 0a 60 73 61 76 65 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 61 | ack.using.a.`save'.instruction.a |
| 121a60 | 6e 64 20 72 65 73 74 6f 72 65 64 20 66 72 6f 6d 20 74 68 65 20 73 74 61 63 6b 20 75 73 69 6e 67 | nd.restored.from.the.stack.using |
| 121a80 | 20 61 20 60 72 65 73 74 6f 72 65 27 0a 69 6e 73 74 72 75 63 74 69 6f 6e 2e 20 20 41 66 74 65 72 | .a.`restore'.instruction...After |
| 121aa0 | 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 76 61 6c 75 65 73 20 68 61 73 20 62 65 65 6e 20 60 | .a.sequence.of.values.has.been.` |
| 121ac0 | 73 61 76 65 27 64 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 2c 0a 61 20 73 65 71 75 65 6e 63 65 20 | save'd.on.the.stack,.a.sequence. |
| 121ae0 | 6f 66 20 60 72 65 73 74 6f 72 65 27 73 20 77 69 6c 6c 20 72 65 74 72 69 65 76 65 20 74 68 65 73 | of.`restore's.will.retrieve.thes |
| 121b00 | 65 20 76 61 6c 75 65 73 20 69 6e 20 72 65 76 65 72 73 65 20 6f 72 64 65 72 2e 28 32 29 0a 0a 20 | e.values.in.reverse.order.(2)... |
| 121b20 | 20 20 57 69 74 68 20 74 68 65 20 61 69 64 20 6f 66 20 74 68 65 20 73 74 61 63 6b 2c 20 77 65 20 | ..With.the.aid.of.the.stack,.we. |
| 121b40 | 63 61 6e 20 72 65 75 73 65 20 61 20 73 69 6e 67 6c 65 20 63 6f 70 79 20 6f 66 20 74 68 65 0a 66 | can.reuse.a.single.copy.of.the.f |
| 121b60 | 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 27 73 20 64 61 74 61 20 70 61 74 68 73 20 66 6f | actorial.machine's.data.paths.fo |
| 121b80 | 72 20 65 61 63 68 20 66 61 63 74 6f 72 69 61 6c 20 73 75 62 70 72 6f 62 6c 65 6d 2e 20 20 54 68 | r.each.factorial.subproblem...Th |
| 121ba0 | 65 72 65 20 69 73 0a 61 20 73 69 6d 69 6c 61 72 20 64 65 73 69 67 6e 20 69 73 73 75 65 20 69 6e | ere.is.a.similar.design.issue.in |
| 121bc0 | 20 72 65 75 73 69 6e 67 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 | .reusing.the.controller.sequence |
| 121be0 | 20 74 68 61 74 20 6f 70 65 72 61 74 65 73 0a 74 68 65 20 64 61 74 61 20 70 61 74 68 73 2e 20 20 | .that.operates.the.data.paths... |
| 121c00 | 54 6f 20 72 65 65 78 65 63 75 74 65 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 63 6f 6d 70 75 | To.reexecute.the.factorial.compu |
| 121c20 | 74 61 74 69 6f 6e 2c 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 0a 63 61 6e 6e 6f 74 20 73 69 | tation,.the.controller.cannot.si |
| 121c40 | 6d 70 6c 79 20 6c 6f 6f 70 20 62 61 63 6b 20 74 6f 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 2c | mply.loop.back.to.the.beginning, |
| 121c60 | 20 61 73 20 77 69 74 68 20 61 6e 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 2c 0a 62 | .as.with.an.iterative.process,.b |
| 121c80 | 65 63 61 75 73 65 20 61 66 74 65 72 20 73 6f 6c 76 69 6e 67 20 74 68 65 20 28 6e 20 2d 20 31 29 | ecause.after.solving.the.(n.-.1) |
| 121ca0 | 21 20 73 75 62 70 72 6f 62 6c 65 6d 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6d 75 73 74 20 73 74 | !.subproblem.the.machine.must.st |
| 121cc0 | 69 6c 6c 0a 6d 75 6c 74 69 70 6c 79 20 74 68 65 20 72 65 73 75 6c 74 20 62 79 20 6e 2e 20 20 54 | ill.multiply.the.result.by.n...T |
| 121ce0 | 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 6d 75 73 74 20 73 75 73 70 65 6e 64 20 69 74 73 20 63 | he.controller.must.suspend.its.c |
| 121d00 | 6f 6d 70 75 74 61 74 69 6f 6e 0a 6f 66 20 6e 21 2c 20 73 6f 6c 76 65 20 74 68 65 20 28 6e 20 2d | omputation.of.n!,.solve.the.(n.- |
| 121d20 | 20 31 29 21 20 20 73 75 62 70 72 6f 62 6c 65 6d 2c 20 74 68 65 6e 20 63 6f 6e 74 69 6e 75 65 20 | .1)!..subproblem,.then.continue. |
| 121d40 | 69 74 73 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 6f 66 0a 6e 21 2e 20 20 54 68 69 73 20 76 69 65 | its.computation.of.n!...This.vie |
| 121d60 | 77 20 6f 66 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 73 | w.of.the.factorial.computation.s |
| 121d80 | 75 67 67 65 73 74 73 20 74 68 65 20 75 73 65 20 6f 66 20 74 68 65 0a 73 75 62 72 6f 75 74 69 6e | uggests.the.use.of.the.subroutin |
| 121da0 | 65 20 6d 65 63 68 61 6e 69 73 6d 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e | e.mechanism.described.in.section |
| 121dc0 | 20 2a 4e 6f 74 65 20 35 2d 31 2d 33 3a 3a 2c 20 77 68 69 63 68 20 68 61 73 20 74 68 65 0a 63 6f | .*Note.5-1-3::,.which.has.the.co |
| 121de0 | 6e 74 72 6f 6c 6c 65 72 20 75 73 65 20 61 20 60 63 6f 6e 74 69 6e 75 65 27 20 72 65 67 69 73 74 | ntroller.use.a.`continue'.regist |
| 121e00 | 65 72 20 74 6f 20 74 72 61 6e 73 66 65 72 20 74 6f 20 74 68 65 20 70 61 72 74 20 6f 66 20 74 68 | er.to.transfer.to.the.part.of.th |
| 121e20 | 65 0a 73 65 71 75 65 6e 63 65 20 74 68 61 74 20 73 6f 6c 76 65 73 20 61 20 73 75 62 70 72 6f 62 | e.sequence.that.solves.a.subprob |
| 121e40 | 6c 65 6d 20 61 6e 64 20 74 68 65 6e 20 63 6f 6e 74 69 6e 75 65 20 77 68 65 72 65 20 69 74 20 6c | lem.and.then.continue.where.it.l |
| 121e60 | 65 66 74 20 6f 66 66 0a 6f 6e 20 74 68 65 20 6d 61 69 6e 20 70 72 6f 62 6c 65 6d 2e 20 20 57 65 | eft.off.on.the.main.problem...We |
| 121e80 | 20 63 61 6e 20 74 68 75 73 20 6d 61 6b 65 20 61 20 66 61 63 74 6f 72 69 61 6c 20 73 75 62 72 6f | .can.thus.make.a.factorial.subro |
| 121ea0 | 75 74 69 6e 65 20 74 68 61 74 0a 72 65 74 75 72 6e 73 20 74 6f 20 74 68 65 20 65 6e 74 72 79 20 | utine.that.returns.to.the.entry. |
| 121ec0 | 70 6f 69 6e 74 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 60 63 6f 6e 74 69 6e 75 65 27 20 72 | point.stored.in.the.`continue'.r |
| 121ee0 | 65 67 69 73 74 65 72 2e 20 20 41 72 6f 75 6e 64 0a 65 61 63 68 20 73 75 62 72 6f 75 74 69 6e 65 | egister...Around.each.subroutine |
| 121f00 | 20 63 61 6c 6c 2c 20 77 65 20 73 61 76 65 20 61 6e 64 20 72 65 73 74 6f 72 65 20 60 63 6f 6e 74 | .call,.we.save.and.restore.`cont |
| 121f20 | 69 6e 75 65 27 20 6a 75 73 74 20 61 73 20 77 65 20 64 6f 20 74 68 65 0a 60 6e 27 20 72 65 67 69 | inue'.just.as.we.do.the.`n'.regi |
| 121f40 | 73 74 65 72 2c 20 73 69 6e 63 65 20 65 61 63 68 20 22 6c 65 76 65 6c 22 20 6f 66 20 74 68 65 20 | ster,.since.each."level".of.the. |
| 121f60 | 66 61 63 74 6f 72 69 61 6c 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 77 69 6c 6c 20 75 73 65 0a 74 | factorial.computation.will.use.t |
| 121f80 | 68 65 20 73 61 6d 65 20 60 63 6f 6e 74 69 6e 75 65 27 20 72 65 67 69 73 74 65 72 2e 20 20 54 68 | he.same.`continue'.register...Th |
| 121fa0 | 61 74 20 69 73 2c 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 73 75 62 72 6f 75 74 69 6e 65 20 | at.is,.the.factorial.subroutine. |
| 121fc0 | 6d 75 73 74 0a 70 75 74 20 61 20 6e 65 77 20 76 61 6c 75 65 20 69 6e 20 60 63 6f 6e 74 69 6e 75 | must.put.a.new.value.in.`continu |
| 121fe0 | 65 27 20 77 68 65 6e 20 69 74 20 63 61 6c 6c 73 20 69 74 73 65 6c 66 20 66 6f 72 20 61 20 73 75 | e'.when.it.calls.itself.for.a.su |
| 122000 | 62 70 72 6f 62 6c 65 6d 2c 0a 62 75 74 20 69 74 20 77 69 6c 6c 20 6e 65 65 64 20 74 68 65 20 6f | bproblem,.but.it.will.need.the.o |
| 122020 | 6c 64 20 76 61 6c 75 65 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 72 65 74 75 72 6e 20 74 6f 20 74 | ld.value.in.order.to.return.to.t |
| 122040 | 68 65 20 70 6c 61 63 65 20 74 68 61 74 0a 63 61 6c 6c 65 64 20 69 74 20 74 6f 20 73 6f 6c 76 65 | he.place.that.called.it.to.solve |
| 122060 | 20 61 20 73 75 62 70 72 6f 62 6c 65 6d 2e 0a 0a 20 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 | .a.subproblem......*Note.Figure. |
| 122080 | 35 2d 31 31 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 64 61 74 61 20 70 61 74 68 73 20 61 6e 64 20 | 5-11::.shows.the.data.paths.and. |
| 1220a0 | 63 6f 6e 74 72 6f 6c 6c 65 72 20 66 6f 72 20 61 0a 6d 61 63 68 69 6e 65 20 74 68 61 74 20 69 6d | controller.for.a.machine.that.im |
| 1220c0 | 70 6c 65 6d 65 6e 74 73 20 74 68 65 20 72 65 63 75 72 73 69 76 65 20 60 66 61 63 74 6f 72 69 61 | plements.the.recursive.`factoria |
| 1220e0 | 6c 27 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 65 0a 6d 61 63 68 69 6e 65 20 68 61 73 20 61 | l'.procedure...The.machine.has.a |
| 122100 | 20 73 74 61 63 6b 20 61 6e 64 20 74 68 72 65 65 20 72 65 67 69 73 74 65 72 73 2c 20 63 61 6c 6c | .stack.and.three.registers,.call |
| 122120 | 65 64 20 60 6e 27 2c 20 60 76 61 6c 27 2c 20 61 6e 64 0a 60 63 6f 6e 74 69 6e 75 65 27 2e 20 20 | ed.`n',.`val',.and.`continue'... |
| 122140 | 54 6f 20 73 69 6d 70 6c 69 66 79 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 20 64 69 61 67 72 61 | To.simplify.the.data-path.diagra |
| 122160 | 6d 2c 20 77 65 20 68 61 76 65 20 6e 6f 74 20 6e 61 6d 65 64 20 74 68 65 0a 72 65 67 69 73 74 65 | m,.we.have.not.named.the.registe |
| 122180 | 72 2d 61 73 73 69 67 6e 6d 65 6e 74 20 62 75 74 74 6f 6e 73 2c 20 6f 6e 6c 79 20 74 68 65 20 73 | r-assignment.buttons,.only.the.s |
| 1221a0 | 74 61 63 6b 2d 6f 70 65 72 61 74 69 6f 6e 20 62 75 74 74 6f 6e 73 20 28 60 73 63 27 20 61 6e 64 | tack-operation.buttons.(`sc'.and |
| 1221c0 | 0a 60 73 6e 27 20 74 6f 20 73 61 76 65 20 72 65 67 69 73 74 65 72 73 2c 20 60 72 63 27 20 61 6e | .`sn'.to.save.registers,.`rc'.an |
| 1221e0 | 64 20 60 72 6e 27 20 74 6f 20 72 65 73 74 6f 72 65 20 72 65 67 69 73 74 65 72 73 29 2e 20 20 54 | d.`rn'.to.restore.registers)...T |
| 122200 | 6f 0a 6f 70 65 72 61 74 65 20 74 68 65 20 6d 61 63 68 69 6e 65 2c 20 77 65 20 70 75 74 20 69 6e | o.operate.the.machine,.we.put.in |
| 122220 | 20 72 65 67 69 73 74 65 72 20 60 6e 27 20 74 68 65 20 6e 75 6d 62 65 72 20 77 68 6f 73 65 20 66 | .register.`n'.the.number.whose.f |
| 122240 | 61 63 74 6f 72 69 61 6c 0a 77 65 20 77 69 73 68 20 74 6f 20 63 6f 6d 70 75 74 65 20 61 6e 64 20 | actorial.we.wish.to.compute.and. |
| 122260 | 73 74 61 72 74 20 74 68 65 20 6d 61 63 68 69 6e 65 2e 20 20 57 68 65 6e 20 74 68 65 20 6d 61 63 | start.the.machine...When.the.mac |
| 122280 | 68 69 6e 65 20 72 65 61 63 68 65 73 0a 60 66 61 63 74 2d 64 6f 6e 65 27 2c 20 74 68 65 20 63 6f | hine.reaches.`fact-done',.the.co |
| 1222a0 | 6d 70 75 74 61 74 69 6f 6e 20 69 73 20 66 69 6e 69 73 68 65 64 20 61 6e 64 20 74 68 65 20 61 6e | mputation.is.finished.and.the.an |
| 1222c0 | 73 77 65 72 20 77 69 6c 6c 20 62 65 20 66 6f 75 6e 64 0a 69 6e 20 74 68 65 20 60 76 61 6c 27 20 | swer.will.be.found.in.the.`val'. |
| 1222e0 | 72 65 67 69 73 74 65 72 2e 20 20 49 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 | register...In.the.controller.seq |
| 122300 | 75 65 6e 63 65 2c 20 60 6e 27 20 61 6e 64 20 60 63 6f 6e 74 69 6e 75 65 27 0a 61 72 65 20 73 61 | uence,.`n'.and.`continue'.are.sa |
| 122320 | 76 65 64 20 62 65 66 6f 72 65 20 65 61 63 68 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c 20 61 | ved.before.each.recursive.call.a |
| 122340 | 6e 64 20 72 65 73 74 6f 72 65 64 20 75 70 6f 6e 20 72 65 74 75 72 6e 20 66 72 6f 6d 20 74 68 65 | nd.restored.upon.return.from.the |
| 122360 | 0a 63 61 6c 6c 2e 20 20 52 65 74 75 72 6e 69 6e 67 20 66 72 6f 6d 20 61 20 63 61 6c 6c 20 69 73 | .call...Returning.from.a.call.is |
| 122380 | 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 62 72 61 6e 63 68 69 6e 67 20 74 6f 20 74 68 | .accomplished.by.branching.to.th |
| 1223a0 | 65 0a 6c 6f 63 61 74 69 6f 6e 20 73 74 6f 72 65 64 20 69 6e 20 60 63 6f 6e 74 69 6e 75 65 27 2e | e.location.stored.in.`continue'. |
| 1223c0 | 20 20 60 43 6f 6e 74 69 6e 75 65 27 20 69 73 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 77 68 65 6e | ..`Continue'.is.initialized.when |
| 1223e0 | 20 74 68 65 0a 6d 61 63 68 69 6e 65 20 73 74 61 72 74 73 20 73 6f 20 74 68 61 74 20 74 68 65 20 | .the.machine.starts.so.that.the. |
| 122400 | 6c 61 73 74 20 72 65 74 75 72 6e 20 77 69 6c 6c 20 67 6f 20 74 6f 20 60 66 61 63 74 2d 64 6f 6e | last.return.will.go.to.`fact-don |
| 122420 | 65 27 2e 20 20 54 68 65 0a 60 76 61 6c 27 20 72 65 67 69 73 74 65 72 2c 20 77 68 69 63 68 20 68 | e'...The.`val'.register,.which.h |
| 122440 | 6f 6c 64 73 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c | olds.the.result.of.the.factorial |
| 122460 | 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 69 73 0a 6e 6f 74 20 73 61 76 65 64 20 62 65 66 6f 72 | .computation,.is.not.saved.befor |
| 122480 | 65 20 74 68 65 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c 2c 20 62 65 63 61 75 73 65 20 74 68 | e.the.recursive.call,.because.th |
| 1224a0 | 65 20 6f 6c 64 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 60 76 61 6c 27 0a 69 73 20 6e 6f 74 20 75 | e.old.contents.of.`val'.is.not.u |
| 1224c0 | 73 65 66 75 6c 20 61 66 74 65 72 20 74 68 65 20 73 75 62 72 6f 75 74 69 6e 65 20 72 65 74 75 72 | seful.after.the.subroutine.retur |
| 1224e0 | 6e 73 2e 20 20 4f 6e 6c 79 20 74 68 65 20 6e 65 77 20 76 61 6c 75 65 2c 20 77 68 69 63 68 0a 69 | ns...Only.the.new.value,.which.i |
| 122500 | 73 20 74 68 65 20 76 61 6c 75 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 74 68 65 20 73 75 62 63 | s.the.value.produced.by.the.subc |
| 122520 | 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 69 73 20 6e 65 65 64 65 64 2e 0a 0a 20 20 20 41 6c 74 68 6f | omputation,.is.needed......Altho |
| 122540 | 75 67 68 20 69 6e 20 70 72 69 6e 63 69 70 6c 65 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 63 | ugh.in.principle.the.factorial.c |
| 122560 | 6f 6d 70 75 74 61 74 69 6f 6e 20 72 65 71 75 69 72 65 73 20 61 6e 20 69 6e 66 69 6e 69 74 65 0a | omputation.requires.an.infinite. |
| 122580 | 6d 61 63 68 69 6e 65 2c 20 74 68 65 20 6d 61 63 68 69 6e 65 20 69 6e 20 2a 4e 6f 74 65 20 46 69 | machine,.the.machine.in.*Note.Fi |
| 1225a0 | 67 75 72 65 20 35 2d 31 31 3a 3a 20 69 73 20 61 63 74 75 61 6c 6c 79 20 66 69 6e 69 74 65 20 65 | gure.5-11::.is.actually.finite.e |
| 1225c0 | 78 63 65 70 74 0a 66 6f 72 20 74 68 65 20 73 74 61 63 6b 2c 20 77 68 69 63 68 20 69 73 20 70 6f | xcept.for.the.stack,.which.is.po |
| 1225e0 | 74 65 6e 74 69 61 6c 6c 79 20 75 6e 62 6f 75 6e 64 65 64 2e 20 20 41 6e 79 20 70 61 72 74 69 63 | tentially.unbounded...Any.partic |
| 122600 | 75 6c 61 72 20 70 68 79 73 69 63 61 6c 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 | ular.physical.implementation.of. |
| 122620 | 61 20 73 74 61 63 6b 2c 20 68 6f 77 65 76 65 72 2c 20 77 69 6c 6c 20 62 65 20 6f 66 20 66 69 6e | a.stack,.however,.will.be.of.fin |
| 122640 | 69 74 65 20 73 69 7a 65 2c 20 61 6e 64 20 74 68 69 73 0a 77 69 6c 6c 20 6c 69 6d 69 74 20 74 68 | ite.size,.and.this.will.limit.th |
| 122660 | 65 20 64 65 70 74 68 20 6f 66 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c 73 20 74 68 61 74 20 | e.depth.of.recursive.calls.that. |
| 122680 | 63 61 6e 20 62 65 20 68 61 6e 64 6c 65 64 20 62 79 20 74 68 65 0a 6d 61 63 68 69 6e 65 2e 20 20 | can.be.handled.by.the.machine... |
| 1226a0 | 54 68 69 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 66 61 63 74 6f 72 69 61 6c | This.implementation.of.factorial |
| 1226c0 | 20 69 6c 6c 75 73 74 72 61 74 65 73 20 74 68 65 20 67 65 6e 65 72 61 6c 0a 73 74 72 61 74 65 67 | .illustrates.the.general.strateg |
| 1226e0 | 79 20 66 6f 72 20 72 65 61 6c 69 7a 69 6e 67 20 72 65 63 75 72 73 69 76 65 20 61 6c 67 6f 72 69 | y.for.realizing.recursive.algori |
| 122700 | 74 68 6d 73 20 61 73 20 6f 72 64 69 6e 61 72 79 20 72 65 67 69 73 74 65 72 0a 6d 61 63 68 69 6e | thms.as.ordinary.register.machin |
| 122720 | 65 73 20 61 75 67 6d 65 6e 74 65 64 20 62 79 20 73 74 61 63 6b 73 2e 20 20 57 68 65 6e 20 61 20 | es.augmented.by.stacks...When.a. |
| 122740 | 72 65 63 75 72 73 69 76 65 20 73 75 62 70 72 6f 62 6c 65 6d 20 69 73 0a 65 6e 63 6f 75 6e 74 65 | recursive.subproblem.is.encounte |
| 122760 | 72 65 64 2c 20 77 65 20 73 61 76 65 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 74 68 65 20 72 65 | red,.we.save.on.the.stack.the.re |
| 122780 | 67 69 73 74 65 72 73 20 77 68 6f 73 65 20 63 75 72 72 65 6e 74 20 76 61 6c 75 65 73 0a 77 69 6c | gisters.whose.current.values.wil |
| 1227a0 | 6c 20 62 65 20 72 65 71 75 69 72 65 64 20 61 66 74 65 72 20 74 68 65 20 73 75 62 70 72 6f 62 6c | l.be.required.after.the.subprobl |
| 1227c0 | 65 6d 20 69 73 20 73 6f 6c 76 65 64 2c 20 73 6f 6c 76 65 20 74 68 65 20 72 65 63 75 72 73 69 76 | em.is.solved,.solve.the.recursiv |
| 1227e0 | 65 0a 73 75 62 70 72 6f 62 6c 65 6d 2c 20 74 68 65 6e 20 72 65 73 74 6f 72 65 20 74 68 65 20 73 | e.subproblem,.then.restore.the.s |
| 122800 | 61 76 65 64 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 20 63 6f 6e 74 69 6e 75 65 20 65 78 65 63 | aved.registers.and.continue.exec |
| 122820 | 75 74 69 6f 6e 20 6f 6e 0a 74 68 65 20 6d 61 69 6e 20 70 72 6f 62 6c 65 6d 2e 20 20 54 68 65 20 | ution.on.the.main.problem...The. |
| 122840 | 60 63 6f 6e 74 69 6e 75 65 27 20 72 65 67 69 73 74 65 72 20 6d 75 73 74 20 61 6c 77 61 79 73 20 | `continue'.register.must.always. |
| 122860 | 62 65 20 73 61 76 65 64 2e 0a 57 68 65 74 68 65 72 20 74 68 65 72 65 20 61 72 65 20 6f 74 68 65 | be.saved..Whether.there.are.othe |
| 122880 | 72 20 72 65 67 69 73 74 65 72 73 20 74 68 61 74 20 6e 65 65 64 20 74 6f 20 62 65 20 73 61 76 65 | r.registers.that.need.to.be.save |
| 1228a0 | 64 20 64 65 70 65 6e 64 73 20 6f 6e 20 74 68 65 0a 70 61 72 74 69 63 75 6c 61 72 20 6d 61 63 68 | d.depends.on.the.particular.mach |
| 1228c0 | 69 6e 65 2c 20 73 69 6e 63 65 20 6e 6f 74 20 61 6c 6c 20 72 65 63 75 72 73 69 76 65 20 63 6f 6d | ine,.since.not.all.recursive.com |
| 1228e0 | 70 75 74 61 74 69 6f 6e 73 20 6e 65 65 64 20 74 68 65 0a 6f 72 69 67 69 6e 61 6c 20 76 61 6c 75 | putations.need.the.original.valu |
| 122900 | 65 73 20 6f 66 20 72 65 67 69 73 74 65 72 73 20 74 68 61 74 20 61 72 65 20 6d 6f 64 69 66 69 65 | es.of.registers.that.are.modifie |
| 122920 | 64 20 64 75 72 69 6e 67 20 73 6f 6c 75 74 69 6f 6e 20 6f 66 20 74 68 65 0a 73 75 62 70 72 6f 62 | d.during.solution.of.the.subprob |
| 122940 | 6c 65 6d 20 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 34 3a 3a 29 2e 0a | lem.(see.*Note.Exercise.5-4::).. |
| 122960 | 0a 41 20 64 6f 75 62 6c 65 20 72 65 63 75 72 73 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | .A.double.recursion............. |
| 122980 | 2e 2e 2e 2e 2e 2e 0a 0a 4c 65 74 20 75 73 20 65 78 61 6d 69 6e 65 20 61 20 6d 6f 72 65 20 63 6f | ........Let.us.examine.a.more.co |
| 1229a0 | 6d 70 6c 65 78 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 2c 20 74 68 65 20 74 72 65 | mplex.recursive.process,.the.tre |
| 1229c0 | 65 2d 72 65 63 75 72 73 69 76 65 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 46 | e-recursive.computation.of.the.F |
| 1229e0 | 69 62 6f 6e 61 63 63 69 20 6e 75 6d 62 65 72 73 2c 20 77 68 69 63 68 20 77 65 20 69 6e 74 72 6f | ibonacci.numbers,.which.we.intro |
| 122a00 | 64 75 63 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 31 2d 32 2d 32 3a 3a 3a 0a | duced.in.section.*Note.1-2-2:::. |
| 122a20 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 62 20 6e 29 0a 20 20 20 20 20 20 20 28 69 66 | ......(define.(fib.n)........(if |
| 122a40 | 20 28 3c 20 6e 20 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 6e 0a 20 20 20 20 20 20 20 20 20 20 | .(<.n.2)............n........... |
| 122a60 | 20 28 2b 20 28 66 69 62 20 28 2d 20 6e 20 31 29 29 20 28 66 69 62 20 28 2d 20 6e 20 32 29 29 29 | .(+.(fib.(-.n.1)).(fib.(-.n.2))) |
| 122a80 | 29 29 0a 0a 20 20 20 4a 75 73 74 20 61 73 20 77 69 74 68 20 66 61 63 74 6f 72 69 61 6c 2c 20 77 | )).....Just.as.with.factorial,.w |
| 122aa0 | 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 72 65 63 75 72 73 69 76 65 20 46 69 | e.can.implement.the.recursive.Fi |
| 122ac0 | 62 6f 6e 61 63 63 69 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 20 61 73 20 61 20 72 65 67 69 73 74 65 | bonacci.computation.as.a.registe |
| 122ae0 | 72 20 6d 61 63 68 69 6e 65 20 77 69 74 68 20 72 65 67 69 73 74 65 72 73 20 60 6e 27 2c 20 60 76 | r.machine.with.registers.`n',.`v |
| 122b00 | 61 6c 27 2c 20 61 6e 64 0a 60 63 6f 6e 74 69 6e 75 65 27 2e 20 20 54 68 65 20 6d 61 63 68 69 6e | al',.and.`continue'...The.machin |
| 122b20 | 65 20 69 73 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 20 74 68 61 6e 20 74 68 65 20 6f 6e 65 20 66 | e.is.more.complex.than.the.one.f |
| 122b40 | 6f 72 20 66 61 63 74 6f 72 69 61 6c 2c 0a 62 65 63 61 75 73 65 20 74 68 65 72 65 20 61 72 65 20 | or.factorial,.because.there.are. |
| 122b60 | 74 77 6f 20 70 6c 61 63 65 73 20 69 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 | two.places.in.the.controller.seq |
| 122b80 | 75 65 6e 63 65 20 77 68 65 72 65 20 77 65 20 6e 65 65 64 0a 74 6f 20 70 65 72 66 6f 72 6d 20 72 | uence.where.we.need.to.perform.r |
| 122ba0 | 65 63 75 72 73 69 76 65 20 63 61 6c 6c 73 2d 2d 6f 6e 63 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 | ecursive.calls--once.to.compute. |
| 122bc0 | 46 69 62 28 6e 20 2d 20 31 29 20 61 6e 64 20 6f 6e 63 65 20 74 6f 0a 63 6f 6d 70 75 74 65 20 46 | Fib(n.-.1).and.once.to.compute.F |
| 122be0 | 69 62 28 6e 20 2d 20 32 29 2e 20 20 54 6f 20 73 65 74 20 75 70 20 66 6f 72 20 65 61 63 68 20 6f | ib(n.-.2)...To.set.up.for.each.o |
| 122c00 | 66 20 74 68 65 73 65 20 63 61 6c 6c 73 2c 20 77 65 20 73 61 76 65 20 74 68 65 0a 72 65 67 69 73 | f.these.calls,.we.save.the.regis |
| 122c20 | 74 65 72 73 20 77 68 6f 73 65 20 76 61 6c 75 65 73 20 77 69 6c 6c 20 62 65 20 6e 65 65 64 65 64 | ters.whose.values.will.be.needed |
| 122c40 | 20 6c 61 74 65 72 2c 20 73 65 74 20 74 68 65 20 60 6e 27 20 72 65 67 69 73 74 65 72 20 74 6f 0a | .later,.set.the.`n'.register.to. |
| 122c60 | 74 68 65 20 6e 75 6d 62 65 72 20 77 68 6f 73 65 20 46 69 62 20 77 65 20 6e 65 65 64 20 74 6f 20 | the.number.whose.Fib.we.need.to. |
| 122c80 | 63 6f 6d 70 75 74 65 20 72 65 63 75 72 73 69 76 65 6c 79 20 28 6e 20 2d 20 31 20 6f 72 20 6e 20 | compute.recursively.(n.-.1.or.n. |
| 122ca0 | 2d 20 32 29 2c 0a 61 6e 64 20 61 73 73 69 67 6e 20 74 6f 20 60 63 6f 6e 74 69 6e 75 65 27 20 74 | -.2),.and.assign.to.`continue'.t |
| 122cc0 | 68 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 69 6e 20 74 68 65 20 6d 61 69 6e 20 73 65 71 75 65 | he.entry.point.in.the.main.seque |
| 122ce0 | 6e 63 65 20 74 6f 20 77 68 69 63 68 0a 74 6f 20 72 65 74 75 72 6e 20 28 60 61 66 74 65 72 66 69 | nce.to.which.to.return.(`afterfi |
| 122d00 | 62 2d 6e 2d 31 27 20 6f 72 20 60 61 66 74 65 72 66 69 62 2d 6e 2d 32 27 2c 20 72 65 73 70 65 63 | b-n-1'.or.`afterfib-n-2',.respec |
| 122d20 | 74 69 76 65 6c 79 29 2e 20 20 57 65 20 74 68 65 6e 20 67 6f 0a 74 6f 20 60 66 69 62 2d 6c 6f 6f | tively)...We.then.go.to.`fib-loo |
| 122d40 | 70 27 2e 20 20 57 68 65 6e 20 77 65 20 72 65 74 75 72 6e 20 66 72 6f 6d 20 74 68 65 20 72 65 63 | p'...When.we.return.from.the.rec |
| 122d60 | 75 72 73 69 76 65 20 63 61 6c 6c 2c 20 74 68 65 20 61 6e 73 77 65 72 20 69 73 0a 69 6e 20 60 76 | ursive.call,.the.answer.is.in.`v |
| 122d80 | 61 6c 27 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 32 3a 3a 20 73 68 6f 77 73 20 | al'...*Note.Figure.5-12::.shows. |
| 122da0 | 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 20 66 6f 72 20 74 68 69 73 | the.controller.sequence.for.this |
| 122dc0 | 0a 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 31 31 3a 2a 20 41 | .machine........*Figure.5.11:*.A |
| 122de0 | 20 72 65 63 75 72 73 69 76 65 20 66 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 | .recursive.factorial.machine.... |
| 122e00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 122e20 | 20 20 20 20 20 20 5f 5f 5f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......___....................... |
| 122e40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 20 20 5c 0a 20 20 20 20 20 20 20 20 20 20 | ................/...\........... |
| 122e60 | 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 7c 20 20 3d 20 | ....+----------*-----------|..=. |
| 122e80 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | .|...............|..........|... |
| 122ea0 | 20 20 20 20 20 20 20 20 20 5c 5f 5f 5f 2f 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 58 29 20 | .........\___/..............(X). |
| 122ec0 | 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 | ........|..............^........ |
| 122ee0 | 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......|..........|............. |
| 122f00 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | .|...............V..........|... |
| 122f20 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 20 73 6e 20 20 20 20 2b 2d 2d 2d 2d 2d 2d | .......+---+---+...sn....+------ |
| 122f40 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 7c 20 20 20 | -+...........+-------+......|... |
| 122f60 | 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 2b 2d 2d 2d 28 58 29 2d 2d 3e 7c 20 20 20 20 20 20 | .......|.......+---(X)-->|...... |
| 122f80 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 7c 20 20 76 61 6c 20 20 7c 3c 2d 28 58 29 2d 7c 2d 2d 2d | .|...........|..val..|<-(X)-|--- |
| 122fa0 | 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 6e 20 20 20 7c 20 20 20 20 20 20 20 20 20 7c 20 73 74 61 63 6b | -------+...n...|.........|.stack |
| 122fc0 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 2d 2b 20 20 20 20 20 20 7c 20 20 20 | .|...........+-----+-+......|... |
| 122fe0 | 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 7c 3c 2d 2d 28 58 29 2d 2d 2d 2b 20 20 20 20 20 20 | .......|.......|<--(X)---+...... |
| 123000 | 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 5e 20 20 20 7c 20 20 20 20 20 20 20 20 7c 20 20 20 | .|.............^...|........|... |
| 123020 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2b 20 20 20 72 6e 20 20 20 20 2b 2d 2b 2d 2d 2d 2d | .......+-------+...rn....+-+---- |
| 123040 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 20 20 20 20 20 7c 20 20 20 | -+.............|...|........|... |
| 123060 | 20 20 20 20 20 20 20 20 20 5e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 5e | .........^.................|...^ |
| 123080 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 58 29 20 20 7c 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 | ............(X)..|........|..... |
| 1230a0 | 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 0a 20 | .......|.................|...|.. |
| 1230c0 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 2b 2d 2d 2d 2d 7c 2d 2d 2d 2d 2d 2d 2d | ...........|...|...+----|------- |
| 1230e0 | 2d 2a 20 20 28 58 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 28 58 29 20 73 63 | -*..(X)................|..(X).sc |
| 123100 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 20 7c 20 20 20 20 20 | .............|...|...|....|..... |
| 123120 | 20 20 20 7c 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 72 63 20 28 58 29 20 20 7c 0a 20 | ...|...|.............rc.(X)..|.. |
| 123140 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 20 20 20 7c 20 20 20 20 2a 2d 2d 2d 2d 2e 20 20 | ...........|...|...|....*----... |
| 123160 | 20 7c 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 7c 0a 20 20 20 | .|...|.................|...|.... |
| 123180 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 56 20 20 20 56 20 20 20 20 7c 20 20 20 20 56 20 20 20 56 | .........|...V...V....|....V...V |
| 1231a0 | 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 7c 0a 20 20 20 20 20 | ...|.................V...|...... |
| 1231c0 | 20 20 20 20 20 20 20 7c 20 20 2d 2d 2d 2d 2d 2d 2d 20 20 20 7c 20 20 20 2d 2d 2d 2d 2d 2d 2d 20 | .......|..-------...|...-------. |
| 1231e0 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2b 2d 2b 0a 20 20 20 20 20 | .|..............+------+-+...... |
| 123200 | 20 20 20 20 20 20 20 7c 20 20 5c 20 20 2a 20 20 2f 20 20 20 7c 20 20 20 5c 20 20 2d 20 20 2f 20 | .......|..\..*../...|...\..-../. |
| 123220 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 63 6f 6e 74 69 6e 75 65 2b 2d 2d 3e 20 63 6f | .|..............|continue+-->.co |
| 123240 | 6e 74 72 6f 6c 6c 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 2d 2d 2b 2d 2d 20 20 | ntroller.............|...--+--.. |
| 123260 | 20 20 7c 20 20 20 20 2d 2d 2b 2d 2d 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d | ..|....--+--...|..............+- |
| 123280 | 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 | -------+.............|.....|.... |
| 1232a0 | 20 20 7c 20 20 20 20 20 20 7c 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e | ..|......|.....|...............^ |
| 1232c0 | 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 | ......^.............+-----+..... |
| 1232e0 | 20 7c 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | .|......+-----+...............|. |
| 123300 | 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....|.......................... |
| 123320 | 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 58 29 20 | |...........................(X). |
| 123340 | 20 20 20 28 58 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...(X).......................... |
| 123360 | 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 | |............................|.. |
| 123380 | 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2f 20 | ....|........................./. |
| 1233a0 | 5c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 20 2f 20 5c 20 20 | \...................after-./.\.. |
| 1233c0 | 20 20 2f 20 5c 20 20 66 61 63 74 2d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ../.\..fact-.................... |
| 1233e0 | 20 20 20 20 2f 5f 31 5f 5c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66 61 63 74 20 | ..../_1_\..................fact. |
| 123400 | 20 2f 5f 5f 5f 5c 20 20 2f 5f 5f 5f 5c 20 64 6f 6e 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 | ./___\../___\.done............(c |
| 123420 | 6f 6e 74 72 6f 6c 6c 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 | ontroller..............(assign.c |
| 123440 | 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 66 61 63 74 2d 64 6f 6e 65 29 29 20 20 20 20 20 3b | ontinue.(label.fact-done)).....; |
| 123460 | 20 73 65 74 20 75 70 20 66 69 6e 61 6c 20 72 65 74 75 72 6e 20 61 64 64 72 65 73 73 0a 20 20 20 | .set.up.final.return.address.... |
| 123480 | 20 20 20 20 20 20 20 20 66 61 63 74 2d 6c 6f 6f 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ........fact-loop..............( |
| 1234a0 | 74 65 73 74 20 28 6f 70 20 3d 29 20 28 72 65 67 20 6e 29 20 28 63 6f 6e 73 74 20 31 29 29 0a 20 | test.(op.=).(reg.n).(const.1)).. |
| 1234c0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 62 61 73 65 2d | ............(branch.(label.base- |
| 1234e0 | 63 61 73 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 53 65 74 20 75 70 20 66 6f | case))..............;;.Set.up.fo |
| 123500 | 72 20 74 68 65 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c 20 62 79 20 73 61 76 69 6e 67 20 60 | r.the.recursive.call.by.saving.` |
| 123520 | 6e 27 20 61 6e 64 20 60 63 6f 6e 74 69 6e 75 65 27 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | n'.and.`continue'............... |
| 123540 | 3b 3b 20 53 65 74 20 75 70 20 60 63 6f 6e 74 69 6e 75 65 27 20 73 6f 20 74 68 61 74 20 74 68 65 | ;;.Set.up.`continue'.so.that.the |
| 123560 | 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 0a 20 20 20 20 20 | .computation.will.continue...... |
| 123580 | 20 20 20 20 20 20 20 20 3b 3b 20 61 74 20 60 61 66 74 65 72 2d 66 61 63 74 27 20 77 68 65 6e 20 | ........;;.at.`after-fact'.when. |
| 1235a0 | 74 68 65 20 73 75 62 72 6f 75 74 69 6e 65 20 72 65 74 75 72 6e 73 2e 0a 20 20 20 20 20 20 20 20 | the.subroutine.returns.......... |
| 1235c0 | 20 20 20 20 20 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .....(save.continue)............ |
| 1235e0 | 20 20 28 73 61 76 65 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 | ..(save.n)..............(assign. |
| 123600 | 6e 20 28 6f 70 20 2d 29 20 28 72 65 67 20 6e 29 20 28 63 6f 6e 73 74 20 31 29 29 0a 20 20 20 20 | n.(op.-).(reg.n).(const.1))..... |
| 123620 | 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c | .........(assign.continue.(label |
| 123640 | 20 61 66 74 65 72 2d 66 61 63 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f | .after-fact))..............(goto |
| 123660 | 20 28 6c 61 62 65 6c 20 66 61 63 74 2d 6c 6f 6f 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 61 | .(label.fact-loop))............a |
| 123680 | 66 74 65 72 2d 66 61 63 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 | fter-fact..............(restore. |
| 1236a0 | 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f 6e 74 69 6e 75 | n)..............(restore.continu |
| 1236c0 | 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 | e)..............(assign.val.(op. |
| 1236e0 | 2a 29 20 28 72 65 67 20 6e 29 20 28 72 65 67 20 76 61 6c 29 29 20 20 20 3b 20 60 76 61 6c 27 20 | *).(reg.n).(reg.val))...;.`val'. |
| 123700 | 6e 6f 77 20 63 6f 6e 74 61 69 6e 73 20 6e 28 6e 20 2d 20 31 29 21 0a 20 20 20 20 20 20 20 20 20 | now.contains.n(n.-.1)!.......... |
| 123720 | 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 20 20 20 20 20 20 20 | ....(goto.(reg.continue))....... |
| 123740 | 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 72 65 74 75 72 6e 20 74 6f 20 63 61 6c 6c 65 72 0a 20 | ............;.return.to.caller.. |
| 123760 | 20 20 20 20 20 20 20 20 20 20 62 61 73 65 2d 63 61 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..........base-case............. |
| 123780 | 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 63 6f 6e 73 74 20 31 29 29 20 20 20 20 20 20 20 20 20 | .(assign.val.(const.1))......... |
| 1237a0 | 20 20 20 20 20 20 20 20 20 3b 20 62 61 73 65 20 63 61 73 65 3a 20 31 21 20 3d 20 31 0a 20 20 20 | .........;.base.case:.1!.=.1.... |
| 1237c0 | 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 20 | ..........(goto.(reg.continue)). |
| 1237e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 72 65 74 75 72 6e 20 74 6f 20 63 61 | ..................;.return.to.ca |
| 123800 | 6c 6c 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 66 61 63 74 2d 64 6f 6e 65 29 0a 0a 0a 20 20 20 | ller............fact-done)...... |
| 123820 | 20 20 2a 46 69 67 75 72 65 20 35 2e 31 32 3a 2a 20 43 6f 6e 74 72 6f 6c 6c 65 72 20 66 6f 72 20 | ..*Figure.5.12:*.Controller.for. |
| 123840 | 61 20 6d 61 63 68 69 6e 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 46 69 62 6f 6e 61 63 63 69 0a 20 | a.machine.to.compute.Fibonacci.. |
| 123860 | 20 20 20 20 6e 75 6d 62 65 72 73 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 74 72 6f 6c | ....numbers.............(control |
| 123880 | 6c 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 | ler..............(assign.continu |
| 1238a0 | 65 20 28 6c 61 62 65 6c 20 66 69 62 2d 64 6f 6e 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 66 | e.(label.fib-done))............f |
| 1238c0 | 69 62 2d 6c 6f 6f 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 3c | ib-loop..............(test.(op.< |
| 1238e0 | 29 20 28 72 65 67 20 6e 29 20 28 63 6f 6e 73 74 20 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ).(reg.n).(const.2))............ |
| 123900 | 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 69 6d 6d 65 64 69 61 74 65 2d 61 6e 73 77 65 | ..(branch.(label.immediate-answe |
| 123920 | 72 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 73 65 74 20 75 70 20 74 6f 20 63 6f | r))..............;;.set.up.to.co |
| 123940 | 6d 70 75 74 65 20 5f 46 69 62 5f 28 6e 20 2d 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | mpute._Fib_(n.-.1).............. |
| 123960 | 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 | (save.continue)..............(as |
| 123980 | 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 61 66 74 65 72 66 69 62 2d 6e 2d | sign.continue.(label.afterfib-n- |
| 1239a0 | 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 6e 29 20 20 20 20 20 20 20 | 1))..............(save.n)....... |
| 1239c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 73 61 76 65 20 6f 6c 64 20 76 | ....................;.save.old.v |
| 1239e0 | 61 6c 75 65 20 6f 66 20 60 6e 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e | alue.of.`n'..............(assign |
| 123a00 | 20 6e 20 28 6f 70 20 2d 29 20 28 72 65 67 20 6e 29 20 28 63 6f 6e 73 74 20 31 29 29 3b 20 63 6c | .n.(op.-).(reg.n).(const.1));.cl |
| 123a20 | 6f 62 62 65 72 20 60 6e 27 20 74 6f 20 6e 20 2d 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | obber.`n'.to.n.-.1.............. |
| 123a40 | 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 66 69 62 2d 6c 6f 6f 70 29 29 20 20 20 20 20 20 20 20 20 | (goto.(label.fib-loop))......... |
| 123a60 | 20 20 20 3b 20 70 65 72 66 6f 72 6d 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c 0a 20 20 20 20 | ...;.perform.recursive.call..... |
| 123a80 | 20 20 20 20 20 20 20 61 66 74 65 72 66 69 62 2d 6e 2d 31 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......afterfib-n-1............. |
| 123aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 75 70 6f 6e 20 72 65 74 75 72 6e 2c 20 60 76 61 6c 27 | ............;.upon.return,.`val' |
| 123ac0 | 20 63 6f 6e 74 61 69 6e 73 20 5f 46 69 62 5f 28 6e 20 2d 20 31 29 0a 20 20 20 20 20 20 20 20 20 | .contains._Fib_(n.-.1).......... |
| 123ae0 | 20 20 20 20 28 72 65 73 74 6f 72 65 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 | ....(restore.n)..............(re |
| 123b00 | 73 74 6f 72 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 3b 20 | store.continue)..............;;. |
| 123b20 | 73 65 74 20 75 70 20 74 6f 20 63 6f 6d 70 75 74 65 20 5f 46 69 62 5f 28 6e 20 2d 20 32 29 0a 20 | set.up.to.compute._Fib_(n.-.2).. |
| 123b40 | 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 6e 20 28 6f 70 20 2d 29 20 28 72 65 | ............(assign.n.(op.-).(re |
| 123b60 | 67 20 6e 29 20 28 63 6f 6e 73 74 20 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 61 | g.n).(const.2))..............(sa |
| 123b80 | 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 | ve.continue)..............(assig |
| 123ba0 | 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 61 66 74 65 72 66 69 62 2d 6e 2d 32 29 29 | n.continue.(label.afterfib-n-2)) |
| 123bc0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 76 61 6c 29 20 20 20 20 20 20 20 20 | ..............(save.val)........ |
| 123be0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 73 61 76 65 20 5f 46 69 62 5f 28 6e 20 | .................;.save._Fib_(n. |
| 123c00 | 2d 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 66 | -.1)..............(goto.(label.f |
| 123c20 | 69 62 2d 6c 6f 6f 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 66 69 62 2d 6e 2d | ib-loop))............afterfib-n- |
| 123c40 | 32 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 75 70 6f 6e | 2.........................;.upon |
| 123c60 | 20 72 65 74 75 72 6e 2c 20 60 76 61 6c 27 20 63 6f 6e 74 61 69 6e 73 20 5f 46 69 62 5f 28 6e 20 | .return,.`val'.contains._Fib_(n. |
| 123c80 | 2d 20 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 6e 20 28 72 65 67 | -.2)..............(assign.n.(reg |
| 123ca0 | 20 76 61 6c 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 60 6e 27 20 6e 6f 77 20 63 | .val))...............;.`n'.now.c |
| 123cc0 | 6f 6e 74 61 69 6e 73 20 5f 46 69 62 5f 28 6e 20 2d 20 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ontains._Fib_(n.-.2)............ |
| 123ce0 | 20 20 28 72 65 73 74 6f 72 65 20 76 61 6c 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..(restore.val)................. |
| 123d00 | 20 20 20 20 20 3b 20 60 76 61 6c 27 20 6e 6f 77 20 63 6f 6e 74 61 69 6e 73 20 5f 46 69 62 5f 28 | .....;.`val'.now.contains._Fib_( |
| 123d20 | 6e 20 2d 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f 6e | n.-.1)..............(restore.con |
| 123d40 | 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 | tinue)..............(assign.val. |
| 123d60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 20 5f 46 69 62 5f 28 | .......................;.._Fib_( |
| 123d80 | 6e 20 2d 20 31 29 20 2b 20 20 5f 46 69 62 5f 28 6e 20 2d 20 32 29 0a 20 20 20 20 20 20 20 20 20 | n.-.1).+.._Fib_(n.-.2).......... |
| 123da0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 20 2b 29 20 28 72 65 67 20 76 61 6c 29 20 28 72 65 | ............(op.+).(reg.val).(re |
| 123dc0 | 67 20 6e 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f | g.n))..............(goto.(reg.co |
| 123de0 | 6e 74 69 6e 75 65 29 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 72 65 74 75 72 6e 20 74 | ntinue))..............;.return.t |
| 123e00 | 6f 20 63 61 6c 6c 65 72 2c 20 61 6e 73 77 65 72 20 69 73 20 69 6e 20 60 76 61 6c 27 0a 20 20 20 | o.caller,.answer.is.in.`val'.... |
| 123e20 | 20 20 20 20 20 20 20 20 69 6d 6d 65 64 69 61 74 65 2d 61 6e 73 77 65 72 0a 20 20 20 20 20 20 20 | ........immediate-answer........ |
| 123e40 | 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 72 65 67 20 6e 29 29 20 20 20 20 20 20 | ......(assign.val.(reg.n))...... |
| 123e60 | 20 20 20 20 20 20 20 20 20 3b 20 62 61 73 65 20 63 61 73 65 3a 20 20 5f 46 69 62 5f 28 6e 29 20 | .........;.base.case:.._Fib_(n). |
| 123e80 | 3d 20 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 | =.n..............(goto.(reg.cont |
| 123ea0 | 69 6e 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 66 69 62 2d 64 6f 6e 65 29 0a 0a 0a 20 20 | inue))............fib-done)..... |
| 123ec0 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 34 3a 2a 20 53 70 65 63 69 66 79 20 72 65 67 69 73 | ...*Exercise.5.4:*.Specify.regis |
| 123ee0 | 74 65 72 20 6d 61 63 68 69 6e 65 73 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 20 65 61 63 68 | ter.machines.that.implement.each |
| 123f00 | 20 6f 66 0a 20 20 20 20 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 | .of......the.following.procedure |
| 123f20 | 73 2e 20 20 46 6f 72 20 65 61 63 68 20 6d 61 63 68 69 6e 65 2c 20 77 72 69 74 65 20 61 20 63 6f | s...For.each.machine,.write.a.co |
| 123f40 | 6e 74 72 6f 6c 6c 65 72 0a 20 20 20 20 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e | ntroller......instruction.sequen |
| 123f60 | 63 65 20 61 6e 64 20 64 72 61 77 20 61 20 64 69 61 67 72 61 6d 20 73 68 6f 77 69 6e 67 20 74 68 | ce.and.draw.a.diagram.showing.th |
| 123f80 | 65 20 64 61 74 61 20 70 61 74 68 73 2e 0a 0a 20 20 20 20 20 20 20 61 2e 20 52 65 63 75 72 73 69 | e.data.paths..........a..Recursi |
| 123fa0 | 76 65 20 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ve.exponentiation:.............. |
| 123fc0 | 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 74 20 62 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 | ...(define.(expt.b.n)........... |
| 123fe0 | 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......(if.(=.n.0).............. |
| 124000 | 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ........1......................( |
| 124020 | 2a 20 62 20 28 65 78 70 74 20 62 20 28 2d 20 6e 20 31 29 29 29 29 29 0a 0a 20 20 20 20 20 20 20 | *.b.(expt.b.(-.n.1)))))......... |
| 124040 | 62 2e 20 49 74 65 72 61 74 69 76 65 20 65 78 70 6f 6e 65 6e 74 69 61 74 69 6f 6e 3a 0a 0a 20 20 | b..Iterative.exponentiation:.... |
| 124060 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 74 20 62 20 6e 29 0a | .............(define.(expt.b.n). |
| 124080 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 70 74 2d 69 | .................(define.(expt-i |
| 1240a0 | 74 65 72 20 63 6f 75 6e 74 65 72 20 70 72 6f 64 75 63 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ter.counter.product)............ |
| 1240c0 | 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 63 6f 75 6e 74 65 72 20 30 29 0a 20 20 20 20 20 20 | ........(if.(=.counter.0)....... |
| 1240e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 | .................product........ |
| 124100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 70 74 2d 69 74 65 72 20 28 2d 20 63 6f | ................(expt-iter.(-.co |
| 124120 | 75 6e 74 65 72 20 31 29 20 28 2a 20 62 20 70 72 6f 64 75 63 74 29 29 29 29 0a 20 20 20 20 20 20 | unter.1).(*.b.product))))....... |
| 124140 | 20 20 20 20 20 20 20 20 20 20 20 28 65 78 70 74 2d 69 74 65 72 20 6e 20 31 29 29 0a 0a 0a 20 20 | ...........(expt-iter.n.1))..... |
| 124160 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 35 3a 2a 20 48 61 6e 64 2d 73 69 6d 75 6c 61 74 65 | ...*Exercise.5.5:*.Hand-simulate |
| 124180 | 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 61 6e 64 20 46 69 62 6f 6e 61 63 63 69 0a 20 20 20 | .the.factorial.and.Fibonacci.... |
| 1241a0 | 20 20 6d 61 63 68 69 6e 65 73 2c 20 75 73 69 6e 67 20 73 6f 6d 65 20 6e 6f 6e 74 72 69 76 69 61 | ..machines,.using.some.nontrivia |
| 1241c0 | 6c 20 69 6e 70 75 74 20 28 72 65 71 75 69 72 69 6e 67 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 | l.input.(requiring.execution.of. |
| 1241e0 | 61 74 0a 20 20 20 20 20 6c 65 61 73 74 20 6f 6e 65 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c | at......least.one.recursive.call |
| 124200 | 29 2e 20 20 53 68 6f 77 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 74 68 65 20 73 74 61 | )...Show.the.contents.of.the.sta |
| 124220 | 63 6b 20 61 74 20 65 61 63 68 0a 20 20 20 20 20 73 69 67 6e 69 66 69 63 61 6e 74 20 70 6f 69 6e | ck.at.each......significant.poin |
| 124240 | 74 20 69 6e 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | t.in.the.execution........*Exerc |
| 124260 | 69 73 65 20 35 2e 36 3a 2a 20 42 65 6e 20 42 69 74 64 69 64 64 6c 65 20 6f 62 73 65 72 76 65 73 | ise.5.6:*.Ben.Bitdiddle.observes |
| 124280 | 20 74 68 61 74 20 74 68 65 20 46 69 62 6f 6e 61 63 63 69 0a 20 20 20 20 20 6d 61 63 68 69 6e 65 | .that.the.Fibonacci......machine |
| 1242a0 | 27 73 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 20 68 61 73 20 61 6e 20 65 78 | 's.controller.sequence.has.an.ex |
| 1242c0 | 74 72 61 20 60 73 61 76 65 27 20 61 6e 64 20 61 6e 20 65 78 74 72 61 0a 20 20 20 20 20 60 72 65 | tra.`save'.and.an.extra......`re |
| 1242e0 | 73 74 6f 72 65 27 2c 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 72 65 6d 6f 76 65 64 20 74 6f 20 | store',.which.can.be.removed.to. |
| 124300 | 6d 61 6b 65 20 61 20 66 61 73 74 65 72 20 6d 61 63 68 69 6e 65 2e 20 20 57 68 65 72 65 0a 20 20 | make.a.faster.machine...Where... |
| 124320 | 20 20 20 61 72 65 20 74 68 65 73 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 3f 0a 0a 20 20 20 2d | ...are.these.instructions?.....- |
| 124340 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a | ---------.Footnotes.----------.. |
| 124360 | 20 20 20 28 31 29 20 4f 6e 65 20 6d 69 67 68 74 20 61 72 67 75 65 20 74 68 61 74 20 77 65 20 64 | ...(1).One.might.argue.that.we.d |
| 124380 | 6f 6e 27 74 20 6e 65 65 64 20 74 6f 20 73 61 76 65 20 74 68 65 20 6f 6c 64 20 60 6e 27 3b 20 61 | on't.need.to.save.the.old.`n';.a |
| 1243a0 | 66 74 65 72 20 77 65 0a 64 65 63 72 65 6d 65 6e 74 20 69 74 20 61 6e 64 20 73 6f 6c 76 65 20 74 | fter.we.decrement.it.and.solve.t |
| 1243c0 | 68 65 20 73 75 62 70 72 6f 62 6c 65 6d 2c 20 77 65 20 63 6f 75 6c 64 20 73 69 6d 70 6c 79 20 69 | he.subproblem,.we.could.simply.i |
| 1243e0 | 6e 63 72 65 6d 65 6e 74 20 69 74 20 74 6f 0a 72 65 63 6f 76 65 72 20 74 68 65 20 6f 6c 64 20 76 | ncrement.it.to.recover.the.old.v |
| 124400 | 61 6c 75 65 2e 20 20 41 6c 74 68 6f 75 67 68 20 74 68 69 73 20 73 74 72 61 74 65 67 79 20 77 6f | alue...Although.this.strategy.wo |
| 124420 | 72 6b 73 20 66 6f 72 20 66 61 63 74 6f 72 69 61 6c 2c 20 69 74 0a 63 61 6e 6e 6f 74 20 77 6f 72 | rks.for.factorial,.it.cannot.wor |
| 124440 | 6b 20 69 6e 20 67 65 6e 65 72 61 6c 2c 20 73 69 6e 63 65 20 74 68 65 20 6f 6c 64 20 76 61 6c 75 | k.in.general,.since.the.old.valu |
| 124460 | 65 20 6f 66 20 61 20 72 65 67 69 73 74 65 72 20 63 61 6e 6e 6f 74 20 61 6c 77 61 79 73 0a 62 65 | e.of.a.register.cannot.always.be |
| 124480 | 20 63 6f 6d 70 75 74 65 64 20 66 72 6f 6d 20 74 68 65 20 6e 65 77 20 6f 6e 65 2e 0a 0a 20 20 20 | .computed.from.the.new.one...... |
| 1244a0 | 28 32 29 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 33 3a 3a 20 77 65 20 77 69 | (2).In.section.*Note.5-3::.we.wi |
| 1244c0 | 6c 6c 20 73 65 65 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 61 20 73 74 61 63 6b 20 | ll.see.how.to.implement.a.stack. |
| 1244e0 | 69 6e 0a 74 65 72 6d 73 20 6f 66 20 6d 6f 72 65 20 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 | in.terms.of.more.primitive.opera |
| 124500 | 74 69 6f 6e 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 | tions.....File:.sicp.info,..Node |
| 124520 | 3a 20 35 2d 31 2d 35 2c 20 20 50 72 65 76 3a 20 35 2d 31 2d 34 2c 20 20 55 70 3a 20 35 2d 31 0a | :.5-1-5,..Prev:.5-1-4,..Up:.5-1. |
| 124540 | 0a 35 2e 31 2e 35 20 49 6e 73 74 72 75 63 74 69 6f 6e 20 53 75 6d 6d 61 72 79 0a 2d 2d 2d 2d 2d | .5.1.5.Instruction.Summary.----- |
| 124560 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 41 20 63 6f 6e 74 72 6f 6c 6c | --------------------..A.controll |
| 124580 | 65 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 6e 20 6f 75 72 20 72 65 67 69 73 74 65 72 2d 6d | er.instruction.in.our.register-m |
| 1245a0 | 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 20 68 61 73 20 6f 6e 65 20 6f 66 20 74 68 65 0a 66 | achine.language.has.one.of.the.f |
| 1245c0 | 6f 6c 6c 6f 77 69 6e 67 20 66 6f 72 6d 73 2c 20 77 68 65 72 65 20 65 61 63 68 20 3c 49 4e 50 55 | ollowing.forms,.where.each.<INPU |
| 1245e0 | 54 5f 49 3e 20 69 73 20 65 69 74 68 65 72 20 60 28 72 65 67 20 3c 52 45 47 49 53 54 45 52 2d 4e | T_I>.is.either.`(reg.<REGISTER-N |
| 124600 | 41 4d 45 3e 29 27 0a 6f 72 20 60 28 63 6f 6e 73 74 20 3c 43 4f 4e 53 54 41 4e 54 2d 56 41 4c 55 | AME>)'.or.`(const.<CONSTANT-VALU |
| 124620 | 45 3e 29 27 2e 20 20 54 68 65 73 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 77 65 72 65 20 69 | E>)'...These.instructions.were.i |
| 124640 | 6e 74 72 6f 64 75 63 65 64 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 31 2d 31 | ntroduced.in.section.*Note.5-1-1 |
| 124660 | 3a 3a 3a 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 3c 52 45 47 49 53 54 45 52 2d 4e 41 4d 45 | :::.......(assign.<REGISTER-NAME |
| 124680 | 3e 20 28 72 65 67 20 3c 52 45 47 49 53 54 45 52 2d 4e 41 4d 45 3e 29 29 0a 0a 20 20 20 20 20 28 | >.(reg.<REGISTER-NAME>)).......( |
| 1246a0 | 61 73 73 69 67 6e 20 3c 52 45 47 49 53 54 45 52 2d 4e 41 4d 45 3e 20 28 63 6f 6e 73 74 20 3c 43 | assign.<REGISTER-NAME>.(const.<C |
| 1246c0 | 4f 4e 53 54 41 4e 54 2d 56 41 4c 55 45 3e 29 29 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 3c | ONSTANT-VALUE>)).......(assign.< |
| 1246e0 | 52 45 47 49 53 54 45 52 2d 4e 41 4d 45 3e 20 28 6f 70 20 3c 4f 50 45 52 41 54 49 4f 4e 2d 4e 41 | REGISTER-NAME>.(op.<OPERATION-NA |
| 124700 | 4d 45 3e 29 20 3c 49 4e 50 55 54 5f 31 3e 20 2e 2e 2e 20 3c 49 4e 50 55 54 5f 4e 3e 29 0a 0a 20 | ME>).<INPUT_1>.....<INPUT_N>)... |
| 124720 | 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 3c 4f 50 45 52 41 54 49 4f 4e 2d 4e 41 4d 45 | ....(perform.(op.<OPERATION-NAME |
| 124740 | 3e 29 20 3c 49 4e 50 55 54 5f 31 3e 20 2e 2e 2e 20 3c 49 4e 50 55 54 5f 4e 3e 29 0a 0a 20 20 20 | >).<INPUT_1>.....<INPUT_N>)..... |
| 124760 | 20 20 28 74 65 73 74 20 28 6f 70 20 3c 4f 50 45 52 41 54 49 4f 4e 2d 4e 41 4d 45 3e 29 20 3c 49 | ..(test.(op.<OPERATION-NAME>).<I |
| 124780 | 4e 50 55 54 5f 31 3e 20 2e 2e 2e 20 3c 49 4e 50 55 54 5f 4e 3e 29 0a 0a 20 20 20 20 20 28 62 72 | NPUT_1>.....<INPUT_N>).......(br |
| 1247a0 | 61 6e 63 68 20 28 6c 61 62 65 6c 20 3c 4c 41 42 45 4c 2d 4e 41 4d 45 3e 29 29 0a 0a 20 20 20 20 | anch.(label.<LABEL-NAME>))...... |
| 1247c0 | 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 3c 4c 41 42 45 4c 2d 4e 41 4d 45 3e 29 29 0a 0a 20 20 | .(goto.(label.<LABEL-NAME>)).... |
| 1247e0 | 20 54 68 65 20 75 73 65 20 6f 66 20 72 65 67 69 73 74 65 72 73 20 74 6f 20 68 6f 6c 64 20 6c 61 | .The.use.of.registers.to.hold.la |
| 124800 | 62 65 6c 73 20 77 61 73 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a | bels.was.introduced.in.section.* |
| 124820 | 4e 6f 74 65 0a 35 2d 31 2d 33 3a 3a 3a 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 3c 52 45 47 | Note.5-1-3:::.......(assign.<REG |
| 124840 | 49 53 54 45 52 2d 4e 41 4d 45 3e 20 28 6c 61 62 65 6c 20 3c 4c 41 42 45 4c 2d 4e 41 4d 45 3e 29 | ISTER-NAME>.(label.<LABEL-NAME>) |
| 124860 | 29 0a 0a 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 3c 52 45 47 49 53 54 45 52 2d 4e 41 4d | ).......(goto.(reg.<REGISTER-NAM |
| 124880 | 45 3e 29 29 0a 0a 20 20 20 49 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 6f 20 75 73 65 20 74 68 65 | E>)).....Instructions.to.use.the |
| 1248a0 | 20 73 74 61 63 6b 20 77 65 72 65 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 73 65 63 74 69 6f | .stack.were.introduced.in.sectio |
| 1248c0 | 6e 20 2a 4e 6f 74 65 0a 35 2d 31 2d 34 3a 3a 3a 0a 0a 20 20 20 20 20 28 73 61 76 65 20 3c 52 45 | n.*Note.5-1-4:::.......(save.<RE |
| 1248e0 | 47 49 53 54 45 52 2d 4e 41 4d 45 3e 29 0a 0a 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 3c 52 45 | GISTER-NAME>).......(restore.<RE |
| 124900 | 47 49 53 54 45 52 2d 4e 41 4d 45 3e 29 0a 0a 20 20 20 54 68 65 20 6f 6e 6c 79 20 6b 69 6e 64 20 | GISTER-NAME>).....The.only.kind. |
| 124920 | 6f 66 20 3c 43 4f 4e 53 54 41 4e 54 2d 56 41 4c 55 45 3e 20 77 65 20 68 61 76 65 20 73 65 65 6e | of.<CONSTANT-VALUE>.we.have.seen |
| 124940 | 20 73 6f 20 66 61 72 20 69 73 20 61 20 6e 75 6d 62 65 72 2c 0a 62 75 74 20 6c 61 74 65 72 20 77 | .so.far.is.a.number,.but.later.w |
| 124960 | 65 20 77 69 6c 6c 20 75 73 65 20 73 74 72 69 6e 67 73 2c 20 73 79 6d 62 6f 6c 73 2c 20 61 6e 64 | e.will.use.strings,.symbols,.and |
| 124980 | 20 6c 69 73 74 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 60 28 63 6f 6e 73 74 20 22 61 | .lists...For.example,.`(const."a |
| 1249a0 | 62 63 22 29 27 20 69 73 20 74 68 65 20 73 74 72 69 6e 67 20 60 22 61 62 63 22 27 2c 0a 60 28 63 | bc")'.is.the.string.`"abc"',.`(c |
| 1249c0 | 6f 6e 73 74 20 61 62 63 29 27 20 69 73 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 61 62 63 27 2c 0a | onst.abc)'.is.the.symbol.`abc',. |
| 1249e0 | 60 28 63 6f 6e 73 74 20 28 61 20 62 20 63 29 29 27 20 69 73 20 74 68 65 20 6c 69 73 74 20 60 28 | `(const.(a.b.c))'.is.the.list.`( |
| 124a00 | 61 20 62 20 63 29 27 2c 0a 61 6e 64 20 60 28 63 6f 6e 73 74 20 28 29 29 27 20 69 73 20 74 68 65 | a.b.c)',.and.`(const.())'.is.the |
| 124a20 | 20 65 6d 70 74 79 20 6c 69 73 74 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c | .empty.list.....File:.sicp.info, |
| 124a40 | 20 20 4e 6f 64 65 3a 20 35 2d 32 2c 20 20 4e 65 78 74 3a 20 35 2d 33 2c 20 20 50 72 65 76 3a 20 | ..Node:.5-2,..Next:.5-3,..Prev:. |
| 124a60 | 35 2d 31 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 35 0a 0a 35 2e 32 20 41 20 52 65 67 69 73 | 5-1,..Up:.Chapter.5..5.2.A.Regis |
| 124a80 | 74 65 72 2d 4d 61 63 68 69 6e 65 20 53 69 6d 75 6c 61 74 6f 72 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ter-Machine.Simulator.========== |
| 124aa0 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 49 6e 20 6f 72 64 65 72 | ======================..In.order |
| 124ac0 | 20 74 6f 20 67 61 69 6e 20 61 20 67 6f 6f 64 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 6f 66 | .to.gain.a.good.understanding.of |
| 124ae0 | 20 74 68 65 20 64 65 73 69 67 6e 20 6f 66 20 72 65 67 69 73 74 65 72 0a 6d 61 63 68 69 6e 65 73 | .the.design.of.register.machines |
| 124b00 | 2c 20 77 65 20 6d 75 73 74 20 74 65 73 74 20 74 68 65 20 6d 61 63 68 69 6e 65 73 20 77 65 20 64 | ,.we.must.test.the.machines.we.d |
| 124b20 | 65 73 69 67 6e 20 74 6f 20 73 65 65 20 69 66 20 74 68 65 79 20 70 65 72 66 6f 72 6d 20 61 73 0a | esign.to.see.if.they.perform.as. |
| 124b40 | 65 78 70 65 63 74 65 64 2e 20 20 4f 6e 65 20 77 61 79 20 74 6f 20 74 65 73 74 20 61 20 64 65 73 | expected...One.way.to.test.a.des |
| 124b60 | 69 67 6e 20 69 73 20 74 6f 20 68 61 6e 64 2d 73 69 6d 75 6c 61 74 65 20 74 68 65 20 6f 70 65 72 | ign.is.to.hand-simulate.the.oper |
| 124b80 | 61 74 69 6f 6e 0a 6f 66 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 2c 20 61 73 20 69 6e 20 2a | ation.of.the.controller,.as.in.* |
| 124ba0 | 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 35 3a 3a 2e 20 20 42 75 74 20 74 68 69 73 20 69 | Note.Exercise.5-5::...But.this.i |
| 124bc0 | 73 20 65 78 74 72 65 6d 65 6c 79 0a 74 65 64 69 6f 75 73 20 66 6f 72 20 61 6c 6c 20 62 75 74 20 | s.extremely.tedious.for.all.but. |
| 124be0 | 74 68 65 20 73 69 6d 70 6c 65 73 74 20 6d 61 63 68 69 6e 65 73 2e 20 20 49 6e 20 74 68 69 73 20 | the.simplest.machines...In.this. |
| 124c00 | 73 65 63 74 69 6f 6e 20 77 65 0a 63 6f 6e 73 74 72 75 63 74 20 61 20 73 69 6d 75 6c 61 74 6f 72 | section.we.construct.a.simulator |
| 124c20 | 20 66 6f 72 20 6d 61 63 68 69 6e 65 73 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 74 68 65 20 72 | .for.machines.described.in.the.r |
| 124c40 | 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 0a 6c 61 6e 67 75 61 67 65 2e 20 20 54 68 65 20 73 | egister-machine.language...The.s |
| 124c60 | 69 6d 75 6c 61 74 6f 72 20 69 73 20 61 20 53 63 68 65 6d 65 20 70 72 6f 67 72 61 6d 20 77 69 74 | imulator.is.a.Scheme.program.wit |
| 124c80 | 68 20 66 6f 75 72 20 69 6e 74 65 72 66 61 63 65 0a 70 72 6f 63 65 64 75 72 65 73 2e 20 20 54 68 | h.four.interface.procedures...Th |
| 124ca0 | 65 20 66 69 72 73 74 20 75 73 65 73 20 61 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 61 20 | e.first.uses.a.description.of.a. |
| 124cc0 | 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 74 6f 0a 63 6f 6e 73 74 72 75 63 74 20 61 20 | register.machine.to.construct.a. |
| 124ce0 | 6d 6f 64 65 6c 20 6f 66 20 74 68 65 20 6d 61 63 68 69 6e 65 20 28 61 20 64 61 74 61 20 73 74 72 | model.of.the.machine.(a.data.str |
| 124d00 | 75 63 74 75 72 65 20 77 68 6f 73 65 20 70 61 72 74 73 0a 63 6f 72 72 65 73 70 6f 6e 64 20 74 6f | ucture.whose.parts.correspond.to |
| 124d20 | 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 74 68 65 20 6d 61 63 68 69 6e 65 20 74 6f 20 62 65 20 | .the.parts.of.the.machine.to.be. |
| 124d40 | 73 69 6d 75 6c 61 74 65 64 29 2c 20 61 6e 64 20 74 68 65 20 6f 74 68 65 72 0a 74 68 72 65 65 20 | simulated),.and.the.other.three. |
| 124d60 | 61 6c 6c 6f 77 20 75 73 20 74 6f 20 73 69 6d 75 6c 61 74 65 20 74 68 65 20 6d 61 63 68 69 6e 65 | allow.us.to.simulate.the.machine |
| 124d80 | 20 62 79 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 74 68 65 20 6d 6f 64 65 6c 3a 0a 0a 20 20 20 | .by.manipulating.the.model:..... |
| 124da0 | 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 6d 61 63 68 69 6e 65 20 3c 52 45 47 49 53 54 45 52 2d 4e | .......(make-machine.<REGISTER-N |
| 124dc0 | 41 4d 45 53 3e 20 3c 4f 50 45 52 41 54 49 4f 4e 53 3e 20 3c 43 4f 4e 54 52 4f 4c 4c 45 52 3e 29 | AMES>.<OPERATIONS>.<CONTROLLER>) |
| 124de0 | 0a 0a 20 20 20 20 20 63 6f 6e 73 74 72 75 63 74 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 20 | .......constructs.and.returns.a. |
| 124e00 | 6d 6f 64 65 6c 20 6f 66 20 74 68 65 20 6d 61 63 68 69 6e 65 20 77 69 74 68 20 74 68 65 20 67 69 | model.of.the.machine.with.the.gi |
| 124e20 | 76 65 6e 0a 20 20 20 20 20 72 65 67 69 73 74 65 72 73 2c 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 | ven......registers,.operations,. |
| 124e40 | 61 6e 64 20 63 6f 6e 74 72 6f 6c 6c 65 72 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d | and.controller.............(set- |
| 124e60 | 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 21 20 3c 4d 41 43 48 49 4e 45 2d 4d 4f 44 45 | register-contents!.<MACHINE-MODE |
| 124e80 | 4c 3e 20 3c 52 45 47 49 53 54 45 52 2d 4e 41 4d 45 3e 20 3c 56 41 4c 55 45 3e 29 0a 0a 20 20 20 | L>.<REGISTER-NAME>.<VALUE>)..... |
| 124ea0 | 20 20 73 74 6f 72 65 73 20 61 20 76 61 6c 75 65 20 69 6e 20 61 20 73 69 6d 75 6c 61 74 65 64 20 | ..stores.a.value.in.a.simulated. |
| 124ec0 | 72 65 67 69 73 74 65 72 20 69 6e 20 74 68 65 20 67 69 76 65 6e 20 6d 61 63 68 69 6e 65 2e 0a 0a | register.in.the.given.machine... |
| 124ee0 | 20 20 20 20 20 20 20 20 20 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 | ..........(get-register-contents |
| 124f00 | 20 3c 4d 41 43 48 49 4e 45 2d 4d 4f 44 45 4c 3e 20 3c 52 45 47 49 53 54 45 52 2d 4e 41 4d 45 3e | .<MACHINE-MODEL>.<REGISTER-NAME> |
| 124f20 | 29 0a 0a 20 20 20 20 20 72 65 74 75 72 6e 73 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 | ).......returns.the.contents.of. |
| 124f40 | 61 20 73 69 6d 75 6c 61 74 65 64 20 72 65 67 69 73 74 65 72 20 69 6e 20 74 68 65 20 67 69 76 65 | a.simulated.register.in.the.give |
| 124f60 | 6e 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 74 61 72 74 20 3c 4d 41 | n.machine.............(start.<MA |
| 124f80 | 43 48 49 4e 45 2d 4d 4f 44 45 4c 3e 29 0a 0a 20 20 20 20 20 73 69 6d 75 6c 61 74 65 73 20 74 68 | CHINE-MODEL>).......simulates.th |
| 124fa0 | 65 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 74 68 65 20 67 69 76 65 6e 20 6d 61 63 68 69 6e 65 | e.execution.of.the.given.machine |
| 124fc0 | 2c 20 73 74 61 72 74 69 6e 67 20 66 72 6f 6d 20 74 68 65 0a 20 20 20 20 20 62 65 67 69 6e 6e 69 | ,.starting.from.the......beginni |
| 124fe0 | 6e 67 20 6f 66 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 20 61 6e | ng.of.the.controller.sequence.an |
| 125000 | 64 20 73 74 6f 70 70 69 6e 67 20 77 68 65 6e 20 69 74 20 72 65 61 63 68 65 73 0a 20 20 20 20 20 | d.stopping.when.it.reaches...... |
| 125020 | 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 2e 0a 0a 20 20 20 41 73 20 | the.end.of.the.sequence......As. |
| 125040 | 61 6e 20 65 78 61 6d 70 6c 65 20 6f 66 20 68 6f 77 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 | an.example.of.how.these.procedur |
| 125060 | 65 73 20 61 72 65 20 75 73 65 64 2c 20 77 65 20 63 61 6e 20 64 65 66 69 6e 65 0a 60 67 63 64 2d | es.are.used,.we.can.define.`gcd- |
| 125080 | 6d 61 63 68 69 6e 65 27 20 74 6f 20 62 65 20 61 20 6d 6f 64 65 6c 20 6f 66 20 74 68 65 20 47 43 | machine'.to.be.a.model.of.the.GC |
| 1250a0 | 44 20 6d 61 63 68 69 6e 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 31 2d 31 | D.machine.of.section.*Note.5-1-1 |
| 1250c0 | 3a 3a 0a 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 67 63 64 | ::.as.follows:.......(define.gcd |
| 1250e0 | 2d 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 6d 61 63 68 69 6e 65 0a 20 20 | -machine........(make-machine... |
| 125100 | 20 20 20 20 20 20 27 28 61 20 62 20 74 29 0a 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 28 6c 69 | ......'(a.b.t).........(list.(li |
| 125120 | 73 74 20 27 72 65 6d 20 72 65 6d 61 69 6e 64 65 72 29 20 28 6c 69 73 74 20 27 3d 20 3d 29 29 0a | st.'rem.remainder).(list.'=.=)). |
| 125140 | 20 20 20 20 20 20 20 20 27 28 74 65 73 74 2d 62 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 | ........'(test-b.............(te |
| 125160 | 73 74 20 28 6f 70 20 3d 29 20 28 72 65 67 20 62 29 20 28 63 6f 6e 73 74 20 30 29 29 0a 20 20 20 | st.(op.=).(reg.b).(const.0)).... |
| 125180 | 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 67 63 64 2d 64 6f 6e 65 | .........(branch.(label.gcd-done |
| 1251a0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 20 28 6f 70 20 72 65 6d | )).............(assign.t.(op.rem |
| 1251c0 | 29 20 28 72 65 67 20 61 29 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | ).(reg.a).(reg.b)).............( |
| 1251e0 | 61 73 73 69 67 6e 20 61 20 28 72 65 67 20 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 | assign.a.(reg.b)).............(a |
| 125200 | 73 73 69 67 6e 20 62 20 28 72 65 67 20 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f | ssign.b.(reg.t)).............(go |
| 125220 | 74 6f 20 28 6c 61 62 65 6c 20 74 65 73 74 2d 62 29 29 0a 20 20 20 20 20 20 20 20 20 20 67 63 64 | to.(label.test-b))...........gcd |
| 125240 | 2d 64 6f 6e 65 29 29 29 0a 0a 20 20 20 54 68 65 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 20 | -done))).....The.first.argument. |
| 125260 | 74 6f 20 60 6d 61 6b 65 2d 6d 61 63 68 69 6e 65 27 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20 72 | to.`make-machine'.is.a.list.of.r |
| 125280 | 65 67 69 73 74 65 72 20 6e 61 6d 65 73 2e 0a 54 68 65 20 6e 65 78 74 20 61 72 67 75 6d 65 6e 74 | egister.names..The.next.argument |
| 1252a0 | 20 69 73 20 61 20 74 61 62 6c 65 20 28 61 20 6c 69 73 74 20 6f 66 20 74 77 6f 2d 65 6c 65 6d 65 | .is.a.table.(a.list.of.two-eleme |
| 1252c0 | 6e 74 20 6c 69 73 74 73 29 20 74 68 61 74 20 70 61 69 72 73 0a 65 61 63 68 20 6f 70 65 72 61 74 | nt.lists).that.pairs.each.operat |
| 1252e0 | 69 6f 6e 20 6e 61 6d 65 20 77 69 74 68 20 61 20 53 63 68 65 6d 65 20 70 72 6f 63 65 64 75 72 65 | ion.name.with.a.Scheme.procedure |
| 125300 | 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 73 20 74 68 65 0a 6f 70 65 72 61 74 69 6f 6e 20 28 | .that.implements.the.operation.( |
| 125320 | 74 68 61 74 20 69 73 2c 20 70 72 6f 64 75 63 65 73 20 74 68 65 20 73 61 6d 65 20 6f 75 74 70 75 | that.is,.produces.the.same.outpu |
| 125340 | 74 20 76 61 6c 75 65 20 67 69 76 65 6e 20 74 68 65 20 73 61 6d 65 20 69 6e 70 75 74 0a 76 61 6c | t.value.given.the.same.input.val |
| 125360 | 75 65 73 29 2e 20 20 54 68 65 20 6c 61 73 74 20 61 72 67 75 6d 65 6e 74 20 73 70 65 63 69 66 69 | ues)...The.last.argument.specifi |
| 125380 | 65 73 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 61 73 20 61 20 6c 69 73 74 20 6f 66 0a 6c | es.the.controller.as.a.list.of.l |
| 1253a0 | 61 62 65 6c 73 20 61 6e 64 20 6d 61 63 68 69 6e 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2c 20 | abels.and.machine.instructions,. |
| 1253c0 | 61 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 31 3a 3a 2e 0a 0a 20 20 20 54 | as.in.section.*Note.5-1::......T |
| 1253e0 | 6f 20 63 6f 6d 70 75 74 65 20 47 43 44 73 20 77 69 74 68 20 74 68 69 73 20 6d 61 63 68 69 6e 65 | o.compute.GCDs.with.this.machine |
| 125400 | 2c 20 77 65 20 73 65 74 20 74 68 65 20 69 6e 70 75 74 20 72 65 67 69 73 74 65 72 73 2c 20 73 74 | ,.we.set.the.input.registers,.st |
| 125420 | 61 72 74 0a 74 68 65 20 6d 61 63 68 69 6e 65 2c 20 61 6e 64 20 65 78 61 6d 69 6e 65 20 74 68 65 | art.the.machine,.and.examine.the |
| 125440 | 20 72 65 73 75 6c 74 20 77 68 65 6e 20 74 68 65 20 73 69 6d 75 6c 61 74 69 6f 6e 20 74 65 72 6d | .result.when.the.simulation.term |
| 125460 | 69 6e 61 74 65 73 3a 0a 0a 20 20 20 20 20 28 73 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 | inates:.......(set-register-cont |
| 125480 | 65 6e 74 73 21 20 67 63 64 2d 6d 61 63 68 69 6e 65 20 27 61 20 32 30 36 29 0a 20 20 20 20 20 64 | ents!.gcd-machine.'a.206)......d |
| 1254a0 | 6f 6e 65 0a 0a 20 20 20 20 20 28 73 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 | one.......(set-register-contents |
| 1254c0 | 21 20 67 63 64 2d 6d 61 63 68 69 6e 65 20 27 62 20 34 30 29 0a 20 20 20 20 20 64 6f 6e 65 0a 0a | !.gcd-machine.'b.40)......done.. |
| 1254e0 | 20 20 20 20 20 28 73 74 61 72 74 20 67 63 64 2d 6d 61 63 68 69 6e 65 29 0a 20 20 20 20 20 64 6f | .....(start.gcd-machine)......do |
| 125500 | 6e 65 0a 0a 20 20 20 20 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 20 | ne.......(get-register-contents. |
| 125520 | 67 63 64 2d 6d 61 63 68 69 6e 65 20 27 61 29 0a 20 20 20 20 20 32 0a 0a 20 20 20 54 68 69 73 20 | gcd-machine.'a)......2.....This. |
| 125540 | 63 6f 6d 70 75 74 61 74 69 6f 6e 20 77 69 6c 6c 20 72 75 6e 20 6d 75 63 68 20 6d 6f 72 65 20 73 | computation.will.run.much.more.s |
| 125560 | 6c 6f 77 6c 79 20 74 68 61 6e 20 61 20 60 67 63 64 27 20 70 72 6f 63 65 64 75 72 65 0a 77 72 69 | lowly.than.a.`gcd'.procedure.wri |
| 125580 | 74 74 65 6e 20 69 6e 20 53 63 68 65 6d 65 2c 20 62 65 63 61 75 73 65 20 77 65 20 77 69 6c 6c 20 | tten.in.Scheme,.because.we.will. |
| 1255a0 | 73 69 6d 75 6c 61 74 65 20 6c 6f 77 2d 6c 65 76 65 6c 20 6d 61 63 68 69 6e 65 0a 69 6e 73 74 72 | simulate.low-level.machine.instr |
| 1255c0 | 75 63 74 69 6f 6e 73 2c 20 73 75 63 68 20 61 73 20 60 61 73 73 69 67 6e 27 2c 20 62 79 20 6d 75 | uctions,.such.as.`assign',.by.mu |
| 1255e0 | 63 68 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 | ch.more.complex.operations...... |
| 125600 | 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 37 3a 2a 20 55 73 65 20 74 68 65 20 73 69 6d 75 6c 61 | ..*Exercise.5.7:*.Use.the.simula |
| 125620 | 74 6f 72 20 74 6f 20 74 65 73 74 20 74 68 65 20 6d 61 63 68 69 6e 65 73 20 79 6f 75 0a 20 20 20 | tor.to.test.the.machines.you.... |
| 125640 | 20 20 64 65 73 69 67 6e 65 64 20 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 34 | ..designed.in.*Note.Exercise.5-4 |
| 125660 | 3a 3a 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 35 2d 32 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 | ::...*.Menu:..*.5-2-1::......... |
| 125680 | 20 20 20 54 68 65 20 4d 61 63 68 69 6e 65 20 4d 6f 64 65 6c 0a 2a 20 35 2d 32 2d 32 3a 3a 20 20 | ...The.Machine.Model.*.5-2-2::.. |
| 1256a0 | 20 20 20 20 20 20 20 20 20 20 54 68 65 20 41 73 73 65 6d 62 6c 65 72 0a 2a 20 35 2d 32 2d 33 3a | ..........The.Assembler.*.5-2-3: |
| 1256c0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 47 65 6e 65 72 61 74 69 6e 67 20 45 78 65 63 75 74 69 6f | :............Generating.Executio |
| 1256e0 | 6e 20 50 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 49 6e 73 74 72 75 63 74 69 6f 6e 73 0a 2a 20 | n.Procedures.for.Instructions.*. |
| 125700 | 35 2d 32 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4d 6f 6e 69 74 6f 72 69 6e 67 20 4d 61 | 5-2-4::............Monitoring.Ma |
| 125720 | 63 68 69 6e 65 20 50 65 72 66 6f 72 6d 61 6e 63 65 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e | chine.Performance....File:.sicp. |
| 125740 | 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 32 2d 31 2c 20 20 4e 65 78 74 3a 20 35 2d 32 2d 32 | info,..Node:.5-2-1,..Next:.5-2-2 |
| 125760 | 2c 20 20 50 72 65 76 3a 20 35 2d 32 2c 20 20 55 70 3a 20 35 2d 32 0a 0a 35 2e 32 2e 31 20 54 68 | ,..Prev:.5-2,..Up:.5-2..5.2.1.Th |
| 125780 | 65 20 4d 61 63 68 69 6e 65 20 4d 6f 64 65 6c 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | e.Machine.Model.---------------- |
| 1257a0 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 6d 61 63 68 69 6e 65 20 6d 6f 64 65 6c 20 67 65 6e 65 72 | -------..The.machine.model.gener |
| 1257c0 | 61 74 65 64 20 62 79 20 60 6d 61 6b 65 2d 6d 61 63 68 69 6e 65 27 20 69 73 20 72 65 70 72 65 73 | ated.by.`make-machine'.is.repres |
| 1257e0 | 65 6e 74 65 64 20 61 73 20 61 0a 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 6c 6f 63 61 6c 20 | ented.as.a.procedure.with.local. |
| 125800 | 73 74 61 74 65 20 75 73 69 6e 67 20 74 68 65 20 6d 65 73 73 61 67 65 2d 70 61 73 73 69 6e 67 20 | state.using.the.message-passing. |
| 125820 | 74 65 63 68 6e 69 71 75 65 73 0a 64 65 76 65 6c 6f 70 65 64 20 69 6e 20 2a 4e 6f 74 65 20 43 68 | techniques.developed.in.*Note.Ch |
| 125840 | 61 70 74 65 72 20 33 3a 3a 2e 20 20 54 6f 20 62 75 69 6c 64 20 74 68 69 73 20 6d 6f 64 65 6c 2c | apter.3::...To.build.this.model, |
| 125860 | 20 60 6d 61 6b 65 2d 6d 61 63 68 69 6e 65 27 0a 62 65 67 69 6e 73 20 62 79 20 63 61 6c 6c 69 6e | .`make-machine'.begins.by.callin |
| 125880 | 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 6d 61 6b 65 2d 6e 65 77 2d 6d 61 63 68 69 6e | g.the.procedure.`make-new-machin |
| 1258a0 | 65 27 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 0a 70 61 72 74 73 20 6f 66 20 74 68 65 | e'.to.construct.the.parts.of.the |
| 1258c0 | 20 6d 61 63 68 69 6e 65 20 6d 6f 64 65 6c 20 74 68 61 74 20 61 72 65 20 63 6f 6d 6d 6f 6e 20 74 | .machine.model.that.are.common.t |
| 1258e0 | 6f 20 61 6c 6c 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 73 2e 0a 54 68 69 73 20 62 61 | o.all.register.machines..This.ba |
| 125900 | 73 69 63 20 6d 61 63 68 69 6e 65 20 6d 6f 64 65 6c 20 63 6f 6e 73 74 72 75 63 74 65 64 20 62 79 | sic.machine.model.constructed.by |
| 125920 | 20 60 6d 61 6b 65 2d 6e 65 77 2d 6d 61 63 68 69 6e 65 27 20 69 73 0a 65 73 73 65 6e 74 69 61 6c | .`make-new-machine'.is.essential |
| 125940 | 6c 79 20 61 20 63 6f 6e 74 61 69 6e 65 72 20 66 6f 72 20 73 6f 6d 65 20 72 65 67 69 73 74 65 72 | ly.a.container.for.some.register |
| 125960 | 73 20 61 6e 64 20 61 20 73 74 61 63 6b 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 0a 61 6e 20 | s.and.a.stack,.together.with.an. |
| 125980 | 65 78 65 63 75 74 69 6f 6e 20 6d 65 63 68 61 6e 69 73 6d 20 74 68 61 74 20 70 72 6f 63 65 73 73 | execution.mechanism.that.process |
| 1259a0 | 65 73 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 6f | es.the.controller.instructions.o |
| 1259c0 | 6e 65 0a 62 79 20 6f 6e 65 2e 0a 0a 20 20 20 60 4d 61 6b 65 2d 6d 61 63 68 69 6e 65 27 20 74 68 | ne.by.one......`Make-machine'.th |
| 1259e0 | 65 6e 20 65 78 74 65 6e 64 73 20 74 68 69 73 20 62 61 73 69 63 20 6d 6f 64 65 6c 20 28 62 79 20 | en.extends.this.basic.model.(by. |
| 125a00 | 73 65 6e 64 69 6e 67 20 69 74 0a 6d 65 73 73 61 67 65 73 29 20 74 6f 20 69 6e 63 6c 75 64 65 20 | sending.it.messages).to.include. |
| 125a20 | 74 68 65 20 72 65 67 69 73 74 65 72 73 2c 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 61 6e 64 20 63 | the.registers,.operations,.and.c |
| 125a40 | 6f 6e 74 72 6f 6c 6c 65 72 20 6f 66 20 74 68 65 0a 70 61 72 74 69 63 75 6c 61 72 20 6d 61 63 68 | ontroller.of.the.particular.mach |
| 125a60 | 69 6e 65 20 62 65 69 6e 67 20 64 65 66 69 6e 65 64 2e 20 20 46 69 72 73 74 20 69 74 20 61 6c 6c | ine.being.defined...First.it.all |
| 125a80 | 6f 63 61 74 65 73 20 61 20 72 65 67 69 73 74 65 72 20 69 6e 20 74 68 65 0a 6e 65 77 20 6d 61 63 | ocates.a.register.in.the.new.mac |
| 125aa0 | 68 69 6e 65 20 66 6f 72 20 65 61 63 68 20 6f 66 20 74 68 65 20 73 75 70 70 6c 69 65 64 20 72 65 | hine.for.each.of.the.supplied.re |
| 125ac0 | 67 69 73 74 65 72 20 6e 61 6d 65 73 20 61 6e 64 20 69 6e 73 74 61 6c 6c 73 20 74 68 65 0a 64 65 | gister.names.and.installs.the.de |
| 125ae0 | 73 69 67 6e 61 74 65 64 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 6d 61 63 68 69 | signated.operations.in.the.machi |
| 125b00 | 6e 65 2e 20 20 54 68 65 6e 20 69 74 20 75 73 65 73 20 61 6e 20 22 61 73 73 65 6d 62 6c 65 72 22 | ne...Then.it.uses.an."assembler" |
| 125b20 | 0a 28 64 65 73 63 72 69 62 65 64 20 62 65 6c 6f 77 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f | .(described.below.in.section.*No |
| 125b40 | 74 65 20 35 2d 32 2d 32 3a 3a 29 20 74 6f 20 74 72 61 6e 73 66 6f 72 6d 20 74 68 65 20 63 6f 6e | te.5-2-2::).to.transform.the.con |
| 125b60 | 74 72 6f 6c 6c 65 72 0a 6c 69 73 74 20 69 6e 74 6f 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 66 | troller.list.into.instructions.f |
| 125b80 | 6f 72 20 74 68 65 20 6e 65 77 20 6d 61 63 68 69 6e 65 20 61 6e 64 20 69 6e 73 74 61 6c 6c 73 20 | or.the.new.machine.and.installs. |
| 125ba0 | 74 68 65 73 65 20 61 73 20 74 68 65 0a 6d 61 63 68 69 6e 65 27 73 20 69 6e 73 74 72 75 63 74 69 | these.as.the.machine's.instructi |
| 125bc0 | 6f 6e 20 73 65 71 75 65 6e 63 65 2e 20 20 60 4d 61 6b 65 2d 6d 61 63 68 69 6e 65 27 20 72 65 74 | on.sequence...`Make-machine'.ret |
| 125be0 | 75 72 6e 73 20 61 73 20 69 74 73 20 76 61 6c 75 65 0a 74 68 65 20 6d 6f 64 69 66 69 65 64 20 6d | urns.as.its.value.the.modified.m |
| 125c00 | 61 63 68 69 6e 65 20 6d 6f 64 65 6c 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b | achine.model........(define.(mak |
| 125c20 | 65 2d 6d 61 63 68 69 6e 65 20 72 65 67 69 73 74 65 72 2d 6e 61 6d 65 73 20 6f 70 73 20 63 6f 6e | e-machine.register-names.ops.con |
| 125c40 | 74 72 6f 6c 6c 65 72 2d 74 65 78 74 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6d 61 63 68 | troller-text)........(let.((mach |
| 125c60 | 69 6e 65 20 28 6d 61 6b 65 2d 6e 65 77 2d 6d 61 63 68 69 6e 65 29 29 29 0a 20 20 20 20 20 20 20 | ine.(make-new-machine)))........ |
| 125c80 | 20 20 28 66 6f 72 2d 65 61 63 68 20 28 6c 61 6d 62 64 61 20 28 72 65 67 69 73 74 65 72 2d 6e 61 | ..(for-each.(lambda.(register-na |
| 125ca0 | 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6d 61 63 68 69 | me)......................((machi |
| 125cc0 | 6e 65 20 27 61 6c 6c 6f 63 61 74 65 2d 72 65 67 69 73 74 65 72 29 20 72 65 67 69 73 74 65 72 2d | ne.'allocate-register).register- |
| 125ce0 | 6e 61 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 67 69 73 74 | name))....................regist |
| 125d00 | 65 72 2d 6e 61 6d 65 73 29 0a 20 20 20 20 20 20 20 20 20 28 28 6d 61 63 68 69 6e 65 20 27 69 6e | er-names)..........((machine.'in |
| 125d20 | 73 74 61 6c 6c 2d 6f 70 65 72 61 74 69 6f 6e 73 29 20 6f 70 73 29 0a 20 20 20 20 20 20 20 20 20 | stall-operations).ops).......... |
| 125d40 | 28 28 6d 61 63 68 69 6e 65 20 27 69 6e 73 74 61 6c 6c 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 | ((machine.'install-instruction-s |
| 125d60 | 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 28 61 73 73 65 6d 62 6c 65 20 63 6f 6e | equence)...........(assemble.con |
| 125d80 | 74 72 6f 6c 6c 65 72 2d 74 65 78 74 20 6d 61 63 68 69 6e 65 29 29 0a 20 20 20 20 20 20 20 20 20 | troller-text.machine)).......... |
| 125da0 | 6d 61 63 68 69 6e 65 29 29 0a 0a 52 65 67 69 73 74 65 72 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | machine))..Registers............ |
| 125dc0 | 57 65 20 77 69 6c 6c 20 72 65 70 72 65 73 65 6e 74 20 61 20 72 65 67 69 73 74 65 72 20 61 73 20 | We.will.represent.a.register.as. |
| 125de0 | 61 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 2c 20 61 73 | a.procedure.with.local.state,.as |
| 125e00 | 20 69 6e 0a 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 33 3a 3a 2e 20 20 54 68 65 20 70 72 6f 63 | .in.*Note.Chapter.3::...The.proc |
| 125e20 | 65 64 75 72 65 20 60 6d 61 6b 65 2d 72 65 67 69 73 74 65 72 27 20 63 72 65 61 74 65 73 20 61 20 | edure.`make-register'.creates.a. |
| 125e40 | 72 65 67 69 73 74 65 72 0a 74 68 61 74 20 68 6f 6c 64 73 20 61 20 76 61 6c 75 65 20 74 68 61 74 | register.that.holds.a.value.that |
| 125e60 | 20 63 61 6e 20 62 65 20 61 63 63 65 73 73 65 64 20 6f 72 20 63 68 61 6e 67 65 64 3a 0a 0a 20 20 | .can.be.accessed.or.changed:.... |
| 125e80 | 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 72 65 67 69 73 74 65 72 20 6e 61 6d 65 29 0a | ...(define.(make-register.name). |
| 125ea0 | 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 6f 6e 74 65 6e 74 73 20 27 2a 75 6e 61 73 73 69 67 | .......(let.((contents.'*unassig |
| 125ec0 | 6e 65 64 2a 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 70 61 74 63 | ned*))..........(define.(dispatc |
| 125ee0 | 68 20 6d 65 73 73 61 67 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 | h.message)............(cond.((eq |
| 125f00 | 3f 20 6d 65 73 73 61 67 65 20 27 67 65 74 29 20 63 6f 6e 74 65 6e 74 73 29 0a 20 20 20 20 20 20 | ?.message.'get).contents)....... |
| 125f20 | 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 65 73 73 61 67 65 20 27 73 65 74 29 0a 20 | ...........((eq?.message.'set).. |
| 125f40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 76 61 6c 75 65 29 | .................(lambda.(value) |
| 125f60 | 20 28 73 65 74 21 20 63 6f 6e 74 65 6e 74 73 20 76 61 6c 75 65 29 29 29 0a 20 20 20 20 20 20 20 | .(set!.contents.value)))........ |
| 125f80 | 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..........(else................. |
| 125fa0 | 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 2d 2d 20 52 45 47 | ..(error."Unknown.request.--.REG |
| 125fc0 | 49 53 54 45 52 22 20 6d 65 73 73 61 67 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 64 69 73 70 | ISTER".message))))..........disp |
| 125fe0 | 61 74 63 68 29 29 0a 0a 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 | atch)).....The.following.procedu |
| 126000 | 72 65 73 20 61 72 65 20 75 73 65 64 20 74 6f 20 61 63 63 65 73 73 20 72 65 67 69 73 74 65 72 73 | res.are.used.to.access.registers |
| 126020 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 67 65 74 2d 63 6f 6e 74 65 6e 74 73 20 72 65 | :.......(define.(get-contents.re |
| 126040 | 67 69 73 74 65 72 29 0a 20 20 20 20 20 20 20 28 72 65 67 69 73 74 65 72 20 27 67 65 74 29 29 0a | gister)........(register.'get)). |
| 126060 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 74 2d 63 6f 6e 74 65 6e 74 73 21 20 72 65 67 | ......(define.(set-contents!.reg |
| 126080 | 69 73 74 65 72 20 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 28 28 72 65 67 69 73 74 65 72 20 27 | ister.value)........((register.' |
| 1260a0 | 73 65 74 29 20 76 61 6c 75 65 29 29 0a 0a 54 68 65 20 73 74 61 63 6b 0a 2e 2e 2e 2e 2e 2e 2e 2e | set).value))..The.stack......... |
| 1260c0 | 2e 0a 0a 57 65 20 63 61 6e 20 61 6c 73 6f 20 72 65 70 72 65 73 65 6e 74 20 61 20 73 74 61 63 6b | ...We.can.also.represent.a.stack |
| 1260e0 | 20 61 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 6c 6f 63 61 6c 20 73 74 61 74 65 | .as.a.procedure.with.local.state |
| 126100 | 2e 20 20 54 68 65 0a 70 72 6f 63 65 64 75 72 65 20 60 6d 61 6b 65 2d 73 74 61 63 6b 27 20 63 72 | ...The.procedure.`make-stack'.cr |
| 126120 | 65 61 74 65 73 20 61 20 73 74 61 63 6b 20 77 68 6f 73 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 | eates.a.stack.whose.local.state. |
| 126140 | 63 6f 6e 73 69 73 74 73 20 6f 66 20 61 0a 6c 69 73 74 20 6f 66 20 74 68 65 20 69 74 65 6d 73 20 | consists.of.a.list.of.the.items. |
| 126160 | 6f 6e 20 74 68 65 20 73 74 61 63 6b 2e 20 20 41 20 73 74 61 63 6b 20 61 63 63 65 70 74 73 20 72 | on.the.stack...A.stack.accepts.r |
| 126180 | 65 71 75 65 73 74 73 20 74 6f 20 60 70 75 73 68 27 20 61 6e 0a 69 74 65 6d 20 6f 6e 74 6f 20 74 | equests.to.`push'.an.item.onto.t |
| 1261a0 | 68 65 20 73 74 61 63 6b 2c 20 74 6f 20 60 70 6f 70 27 20 74 68 65 20 74 6f 70 20 69 74 65 6d 20 | he.stack,.to.`pop'.the.top.item. |
| 1261c0 | 6f 66 66 20 74 68 65 20 73 74 61 63 6b 20 61 6e 64 20 72 65 74 75 72 6e 20 69 74 2c 0a 61 6e 64 | off.the.stack.and.return.it,.and |
| 1261e0 | 20 74 6f 20 60 69 6e 69 74 69 61 6c 69 7a 65 27 20 74 68 65 20 73 74 61 63 6b 20 74 6f 20 65 6d | .to.`initialize'.the.stack.to.em |
| 126200 | 70 74 79 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 73 74 61 63 6b 29 0a | pty........(define.(make-stack). |
| 126220 | 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 73 20 27 28 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 | .......(let.((s.'()))..........( |
| 126240 | 64 65 66 69 6e 65 20 28 70 75 73 68 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 | define.(push.x)............(set! |
| 126260 | 20 73 20 28 63 6f 6e 73 20 78 20 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | .s.(cons.x.s)))..........(define |
| 126280 | 20 28 70 6f 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 73 29 0a | .(pop)............(if.(null?.s). |
| 1262a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 45 6d 70 74 79 20 73 74 61 | ...............(error."Empty.sta |
| 1262c0 | 63 6b 20 2d 2d 20 50 4f 50 22 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 | ck.--.POP")................(let. |
| 1262e0 | 28 28 74 6f 70 20 28 63 61 72 20 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ((top.(car.s)))................. |
| 126300 | 20 28 73 65 74 21 20 73 20 28 63 64 72 20 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(set!.s.(cdr.s))............... |
| 126320 | 20 20 20 74 6f 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 69 74 | ...top)))..........(define.(init |
| 126340 | 69 61 6c 69 7a 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 73 20 27 28 29 29 0a | ialize)............(set!.s.'()). |
| 126360 | 20 20 20 20 20 20 20 20 20 20 20 27 64 6f 6e 65 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 | ...........'done)..........(defi |
| 126380 | 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 65 73 73 61 67 65 29 0a 20 20 20 20 20 20 20 20 20 20 | ne.(dispatch.message)........... |
| 1263a0 | 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6d 65 73 73 61 67 65 20 27 70 75 73 68 29 20 70 75 73 68 | .(cond.((eq?.message.'push).push |
| 1263c0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 65 73 73 61 67 65 | )..................((eq?.message |
| 1263e0 | 20 27 70 6f 70 29 20 28 70 6f 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .'pop).(pop))..................( |
| 126400 | 28 65 71 3f 20 6d 65 73 73 61 67 65 20 27 69 6e 69 74 69 61 6c 69 7a 65 29 20 28 69 6e 69 74 69 | (eq?.message.'initialize).(initi |
| 126420 | 61 6c 69 7a 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 | alize))..................(else.( |
| 126440 | 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 2d 2d 20 53 54 41 43 4b 22 | error."Unknown.request.--.STACK" |
| 126460 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6d | ...............................m |
| 126480 | 65 73 73 61 67 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 29 0a 0a | essage))))..........dispatch)).. |
| 1264a0 | 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 61 72 65 20 | ...The.following.procedures.are. |
| 1264c0 | 75 73 65 64 20 74 6f 20 61 63 63 65 73 73 20 73 74 61 63 6b 73 3a 0a 0a 20 20 20 20 20 28 64 65 | used.to.access.stacks:.......(de |
| 1264e0 | 66 69 6e 65 20 28 70 6f 70 20 73 74 61 63 6b 29 0a 20 20 20 20 20 20 20 28 73 74 61 63 6b 20 27 | fine.(pop.stack)........(stack.' |
| 126500 | 70 6f 70 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 75 73 68 20 73 74 61 63 6b 20 | pop)).......(define.(push.stack. |
| 126520 | 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 28 28 73 74 61 63 6b 20 27 70 75 73 68 29 20 76 61 6c | value)........((stack.'push).val |
| 126540 | 75 65 29 29 0a 0a 54 68 65 20 62 61 73 69 63 20 6d 61 63 68 69 6e 65 0a 2e 2e 2e 2e 2e 2e 2e 2e | ue))..The.basic.machine......... |
| 126560 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 60 6d 61 6b 65 2d 6e 65 77 2d 6d 61 63 68 69 6e 65 | ...........The.`make-new-machine |
| 126580 | 27 20 70 72 6f 63 65 64 75 72 65 2c 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 | '.procedure,.shown.in.*Note.Figu |
| 1265a0 | 72 65 20 35 2d 31 33 3a 3a 2c 0a 63 6f 6e 73 74 72 75 63 74 73 20 61 6e 20 6f 62 6a 65 63 74 20 | re.5-13::,.constructs.an.object. |
| 1265c0 | 77 68 6f 73 65 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 61 20 | whose.local.state.consists.of.a. |
| 1265e0 | 73 74 61 63 6b 2c 20 61 6e 0a 69 6e 69 74 69 61 6c 6c 79 20 65 6d 70 74 79 20 69 6e 73 74 72 75 | stack,.an.initially.empty.instru |
| 126600 | 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 2c 20 61 20 6c 69 73 74 20 6f 66 20 6f 70 65 72 61 74 | ction.sequence,.a.list.of.operat |
| 126620 | 69 6f 6e 73 20 74 68 61 74 0a 69 6e 69 74 69 61 6c 6c 79 20 63 6f 6e 74 61 69 6e 73 20 61 6e 20 | ions.that.initially.contains.an. |
| 126640 | 6f 70 65 72 61 74 69 6f 6e 20 74 6f 20 69 6e 69 74 69 61 6c 69 7a 65 20 74 68 65 20 73 74 61 63 | operation.to.initialize.the.stac |
| 126660 | 6b 2c 20 61 6e 64 20 61 20 22 72 65 67 69 73 74 65 72 0a 74 61 62 6c 65 22 20 74 68 61 74 20 69 | k,.and.a."register.table".that.i |
| 126680 | 6e 69 74 69 61 6c 6c 79 20 63 6f 6e 74 61 69 6e 73 20 74 77 6f 20 72 65 67 69 73 74 65 72 73 2c | nitially.contains.two.registers, |
| 1266a0 | 20 6e 61 6d 65 64 20 60 66 6c 61 67 27 20 61 6e 64 20 60 70 63 27 0a 28 66 6f 72 20 22 70 72 6f | .named.`flag'.and.`pc'.(for."pro |
| 1266c0 | 67 72 61 6d 20 63 6f 75 6e 74 65 72 22 29 2e 20 20 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 70 72 | gram.counter")...The.internal.pr |
| 1266e0 | 6f 63 65 64 75 72 65 20 60 61 6c 6c 6f 63 61 74 65 2d 72 65 67 69 73 74 65 72 27 0a 61 64 64 73 | ocedure.`allocate-register'.adds |
| 126700 | 20 6e 65 77 20 65 6e 74 72 69 65 73 20 74 6f 20 74 68 65 20 72 65 67 69 73 74 65 72 20 74 61 62 | .new.entries.to.the.register.tab |
| 126720 | 6c 65 2c 20 61 6e 64 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f 63 65 64 75 72 65 0a 60 | le,.and.the.internal.procedure.` |
| 126740 | 6c 6f 6f 6b 75 70 2d 72 65 67 69 73 74 65 72 27 20 6c 6f 6f 6b 73 20 75 70 20 72 65 67 69 73 74 | lookup-register'.looks.up.regist |
| 126760 | 65 72 73 20 69 6e 20 74 68 65 20 74 61 62 6c 65 2e 0a 0a 20 20 20 54 68 65 20 60 66 6c 61 67 27 | ers.in.the.table......The.`flag' |
| 126780 | 20 72 65 67 69 73 74 65 72 20 69 73 20 75 73 65 64 20 74 6f 20 63 6f 6e 74 72 6f 6c 20 62 72 61 | .register.is.used.to.control.bra |
| 1267a0 | 6e 63 68 69 6e 67 20 69 6e 20 74 68 65 20 73 69 6d 75 6c 61 74 65 64 0a 6d 61 63 68 69 6e 65 2e | nching.in.the.simulated.machine. |
| 1267c0 | 20 20 60 54 65 73 74 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 73 65 74 20 74 68 65 20 63 6f | ..`Test'.instructions.set.the.co |
| 1267e0 | 6e 74 65 6e 74 73 20 6f 66 20 60 66 6c 61 67 27 20 74 6f 20 74 68 65 20 72 65 73 75 6c 74 0a 6f | ntents.of.`flag'.to.the.result.o |
| 126800 | 66 20 74 68 65 20 74 65 73 74 20 28 74 72 75 65 20 6f 72 20 66 61 6c 73 65 29 2e 20 20 60 42 72 | f.the.test.(true.or.false)...`Br |
| 126820 | 61 6e 63 68 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 64 65 63 69 64 65 20 77 68 65 74 68 65 | anch'.instructions.decide.whethe |
| 126840 | 72 20 6f 72 0a 6e 6f 74 20 74 6f 20 62 72 61 6e 63 68 20 62 79 20 65 78 61 6d 69 6e 69 6e 67 20 | r.or.not.to.branch.by.examining. |
| 126860 | 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 60 66 6c 61 67 27 2e 0a 0a 20 20 20 54 68 65 20 | the.contents.of.`flag'......The. |
| 126880 | 60 70 63 27 20 72 65 67 69 73 74 65 72 20 64 65 74 65 72 6d 69 6e 65 73 20 74 68 65 20 73 65 71 | `pc'.register.determines.the.seq |
| 1268a0 | 75 65 6e 63 69 6e 67 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 61 73 20 74 68 65 0a 6d | uencing.of.instructions.as.the.m |
| 1268c0 | 61 63 68 69 6e 65 20 72 75 6e 73 2e 20 20 54 68 69 73 20 73 65 71 75 65 6e 63 69 6e 67 20 69 73 | achine.runs...This.sequencing.is |
| 1268e0 | 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 79 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f | .implemented.by.the.internal.pro |
| 126900 | 63 65 64 75 72 65 0a 60 65 78 65 63 75 74 65 27 2e 20 20 49 6e 20 74 68 65 20 73 69 6d 75 6c 61 | cedure.`execute'...In.the.simula |
| 126920 | 74 69 6f 6e 20 6d 6f 64 65 6c 2c 20 65 61 63 68 20 6d 61 63 68 69 6e 65 20 69 6e 73 74 72 75 63 | tion.model,.each.machine.instruc |
| 126940 | 74 69 6f 6e 20 69 73 20 61 20 64 61 74 61 0a 73 74 72 75 63 74 75 72 65 20 74 68 61 74 20 69 6e | tion.is.a.data.structure.that.in |
| 126960 | 63 6c 75 64 65 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 6e 6f 20 61 72 67 75 6d 65 6e | cludes.a.procedure.of.no.argumen |
| 126980 | 74 73 2c 20 63 61 6c 6c 65 64 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 22 69 6e 73 74 72 75 | ts,.called.the.procedure."instru |
| 1269a0 | 63 74 69 6f 6e 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 22 2c 20 73 75 63 68 | ction.execution.procedure",.such |
| 1269c0 | 20 74 68 61 74 20 63 61 6c 6c 69 6e 67 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 0a 73 69 6d | .that.calling.this.procedure.sim |
| 1269e0 | 75 6c 61 74 65 73 20 65 78 65 63 75 74 69 6e 67 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e | ulates.executing.the.instruction |
| 126a00 | 2e 20 20 41 73 20 74 68 65 20 73 69 6d 75 6c 61 74 69 6f 6e 20 72 75 6e 73 2c 20 60 70 63 27 0a | ...As.the.simulation.runs,.`pc'. |
| 126a20 | 70 6f 69 6e 74 73 20 74 6f 20 74 68 65 20 70 6c 61 63 65 20 69 6e 20 74 68 65 20 69 6e 73 74 72 | points.to.the.place.in.the.instr |
| 126a40 | 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 62 65 67 69 6e 6e 69 6e 67 20 77 69 74 68 20 74 | uction.sequence.beginning.with.t |
| 126a60 | 68 65 20 6e 65 78 74 0a 69 6e 73 74 72 75 63 74 69 6f 6e 20 74 6f 20 62 65 20 65 78 65 63 75 74 | he.next.instruction.to.be.execut |
| 126a80 | 65 64 2e 20 20 60 45 78 65 63 75 74 65 27 20 67 65 74 73 20 74 68 61 74 20 69 6e 73 74 72 75 63 | ed...`Execute'.gets.that.instruc |
| 126aa0 | 74 69 6f 6e 2c 20 65 78 65 63 75 74 65 73 0a 69 74 20 62 79 20 63 61 6c 6c 69 6e 67 20 74 68 65 | tion,.executes.it.by.calling.the |
| 126ac0 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 | .instruction.execution.procedure |
| 126ae0 | 2c 20 61 6e 64 20 72 65 70 65 61 74 73 20 74 68 69 73 0a 63 79 63 6c 65 20 75 6e 74 69 6c 20 74 | ,.and.repeats.this.cycle.until.t |
| 126b00 | 68 65 72 65 20 61 72 65 20 6e 6f 20 6d 6f 72 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 6f | here.are.no.more.instructions.to |
| 126b20 | 20 65 78 65 63 75 74 65 20 28 69 2e 65 2e 2c 20 75 6e 74 69 6c 20 60 70 63 27 0a 70 6f 69 6e 74 | .execute.(i.e.,.until.`pc'.point |
| 126b40 | 73 20 74 6f 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 | s.to.the.end.of.the.instruction. |
| 126b60 | 73 65 71 75 65 6e 63 65 29 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 31 33 3a 2a 20 | sequence)........*Figure.5.13:*. |
| 126b80 | 54 68 65 20 60 6d 61 6b 65 2d 6e 65 77 2d 6d 61 63 68 69 6e 65 27 20 70 72 6f 63 65 64 75 72 65 | The.`make-new-machine'.procedure |
| 126ba0 | 2c 20 77 68 69 63 68 20 69 6d 70 6c 65 6d 65 6e 74 73 0a 20 20 20 20 20 74 68 65 20 62 61 73 69 | ,.which.implements......the.basi |
| 126bc0 | 63 20 6d 61 63 68 69 6e 65 20 6d 6f 64 65 6c 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 | c.machine.model.............(def |
| 126be0 | 69 6e 65 20 28 6d 61 6b 65 2d 6e 65 77 2d 6d 61 63 68 69 6e 65 29 0a 20 20 20 20 20 20 20 20 20 | ine.(make-new-machine).......... |
| 126c00 | 20 20 20 28 6c 65 74 20 28 28 70 63 20 28 6d 61 6b 65 2d 72 65 67 69 73 74 65 72 20 27 70 63 29 | ...(let.((pc.(make-register.'pc) |
| 126c20 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 6c 61 67 20 28 6d 61 6b 65 2d | )...................(flag.(make- |
| 126c40 | 72 65 67 69 73 74 65 72 20 27 66 6c 61 67 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | register.'flag))................ |
| 126c60 | 20 20 20 28 73 74 61 63 6b 20 28 6d 61 6b 65 2d 73 74 61 63 6b 29 29 0a 20 20 20 20 20 20 20 20 | ...(stack.(make-stack))......... |
| 126c80 | 20 20 20 20 20 20 20 20 20 20 28 74 68 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 | ..........(the-instruction-seque |
| 126ca0 | 6e 63 65 20 27 28 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 | nce.'()))...............(let.((t |
| 126cc0 | 68 65 2d 6f 70 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 | he-ops......................(lis |
| 126ce0 | 74 20 28 6c 69 73 74 20 27 69 6e 69 74 69 61 6c 69 7a 65 2d 73 74 61 63 6b 0a 20 20 20 20 20 20 | t.(list.'initialize-stack....... |
| 126d00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 | ...........................(lamb |
| 126d20 | 64 61 20 28 29 20 28 73 74 61 63 6b 20 27 69 6e 69 74 69 61 6c 69 7a 65 29 29 29 29 29 0a 20 20 | da.().(stack.'initialize)))))... |
| 126d40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 69 73 74 65 72 2d 74 61 62 6c | ..................(register-tabl |
| 126d60 | 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 28 6c 69 | e......................(list.(li |
| 126d80 | 73 74 20 27 70 63 20 70 63 29 20 28 6c 69 73 74 20 27 66 6c 61 67 20 66 6c 61 67 29 29 29 29 0a | st.'pc.pc).(list.'flag.flag)))). |
| 126da0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 6c 6c 6f 63 61 74 | ................(define.(allocat |
| 126dc0 | 65 2d 72 65 67 69 73 74 65 72 20 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e-register.name)................ |
| 126de0 | 20 20 20 28 69 66 20 28 61 73 73 6f 63 20 6e 61 6d 65 20 72 65 67 69 73 74 65 72 2d 74 61 62 6c | ...(if.(assoc.name.register-tabl |
| 126e00 | 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 | e).......................(error. |
| 126e20 | 22 4d 75 6c 74 69 70 6c 79 20 64 65 66 69 6e 65 64 20 72 65 67 69 73 74 65 72 3a 20 22 20 6e 61 | "Multiply.defined.register:.".na |
| 126e40 | 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 | me).......................(set!. |
| 126e60 | 72 65 67 69 73 74 65 72 2d 74 61 62 6c 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | register-table.................. |
| 126e80 | 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 6c 69 73 74 20 6e 61 6d 65 20 28 6d 61 6b | ...........(cons.(list.name.(mak |
| 126ea0 | 65 2d 72 65 67 69 73 74 65 72 20 6e 61 6d 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e-register.name))............... |
| 126ec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 65 67 69 73 74 65 72 2d 74 61 62 | ....................register-tab |
| 126ee0 | 6c 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 72 65 67 69 73 74 65 | le)))...................'registe |
| 126f00 | 72 2d 61 6c 6c 6f 63 61 74 65 64 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 | r-allocated).................(de |
| 126f20 | 66 69 6e 65 20 28 6c 6f 6f 6b 75 70 2d 72 65 67 69 73 74 65 72 20 6e 61 6d 65 29 0a 20 20 20 20 | fine.(lookup-register.name)..... |
| 126f40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28 61 73 73 6f 63 20 | ..............(let.((val.(assoc. |
| 126f60 | 6e 61 6d 65 20 72 65 67 69 73 74 65 72 2d 74 61 62 6c 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 | name.register-table))).......... |
| 126f80 | 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 76 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........(if.val.............. |
| 126fa0 | 20 20 20 20 20 20 20 20 20 20 20 28 63 61 64 72 20 76 61 6c 29 0a 20 20 20 20 20 20 20 20 20 20 | ...........(cadr.val)........... |
| 126fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 | ..............(error."Unknown.re |
| 126fe0 | 67 69 73 74 65 72 3a 22 20 6e 61 6d 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | gister:".name))))............... |
| 127000 | 20 20 28 64 65 66 69 6e 65 20 28 65 78 65 63 75 74 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..(define.(execute)............. |
| 127020 | 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e 73 74 73 20 28 67 65 74 2d 63 6f 6e 74 65 6e 74 73 | ......(let.((insts.(get-contents |
| 127040 | 20 70 63 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 | .pc))).....................(if.( |
| 127060 | 6e 75 6c 6c 3f 20 69 6e 73 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | null?.insts).................... |
| 127080 | 20 20 20 20 20 27 64 6f 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....'done...................... |
| 1270a0 | 20 20 20 28 62 65 67 69 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...(begin....................... |
| 1270c0 | 20 20 20 20 28 28 69 6e 73 74 72 75 63 74 69 6f 6e 2d 65 78 65 63 75 74 69 6f 6e 2d 70 72 6f 63 | ....((instruction-execution-proc |
| 1270e0 | 20 28 63 61 72 20 69 6e 73 74 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(car.insts))).................. |
| 127100 | 20 20 20 20 20 20 20 20 20 28 65 78 65 63 75 74 65 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 | .........(execute))))).......... |
| 127120 | 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 69 73 70 61 74 63 68 20 6d 65 73 73 61 67 65 | .......(define.(dispatch.message |
| 127140 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 | )...................(cond.((eq?. |
| 127160 | 6d 65 73 73 61 67 65 20 27 73 74 61 72 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | message.'start)................. |
| 127180 | 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 6f 6e 74 65 6e 74 73 21 20 70 63 20 74 68 65 2d 69 | .........(set-contents!.pc.the-i |
| 1271a0 | 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 | nstruction-sequence)............ |
| 1271c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 78 65 63 75 74 65 29 29 0a 20 20 20 20 20 20 20 | ..............(execute))........ |
| 1271e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 65 73 73 61 67 65 20 27 | .................((eq?.message.' |
| 127200 | 69 6e 73 74 61 6c 6c 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 29 0a 20 20 | install-instruction-sequence)... |
| 127220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 | .......................(lambda.( |
| 127240 | 73 65 71 29 20 28 73 65 74 21 20 74 68 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 | seq).(set!.the-instruction-seque |
| 127260 | 6e 63 65 20 73 65 71 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | nce.seq)))...................... |
| 127280 | 20 20 20 28 28 65 71 3f 20 6d 65 73 73 61 67 65 20 27 61 6c 6c 6f 63 61 74 65 2d 72 65 67 69 73 | ...((eq?.message.'allocate-regis |
| 1272a0 | 74 65 72 29 20 61 6c 6c 6f 63 61 74 65 2d 72 65 67 69 73 74 65 72 29 0a 20 20 20 20 20 20 20 20 | ter).allocate-register)......... |
| 1272c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 65 73 73 61 67 65 20 27 67 | ................((eq?.message.'g |
| 1272e0 | 65 74 2d 72 65 67 69 73 74 65 72 29 20 6c 6f 6f 6b 75 70 2d 72 65 67 69 73 74 65 72 29 0a 20 20 | et-register).lookup-register)... |
| 127300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 65 73 73 | ......................((eq?.mess |
| 127320 | 61 67 65 20 27 69 6e 73 74 61 6c 6c 2d 6f 70 65 72 61 74 69 6f 6e 73 29 0a 20 20 20 20 20 20 20 | age.'install-operations)........ |
| 127340 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 6f 70 73 29 20 | ..................(lambda.(ops). |
| 127360 | 28 73 65 74 21 20 74 68 65 2d 6f 70 73 20 28 61 70 70 65 6e 64 20 74 68 65 2d 6f 70 73 20 6f 70 | (set!.the-ops.(append.the-ops.op |
| 127380 | 73 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | s)))).........................(( |
| 1273a0 | 65 71 3f 20 6d 65 73 73 61 67 65 20 27 73 74 61 63 6b 29 20 73 74 61 63 6b 29 0a 20 20 20 20 20 | eq?.message.'stack).stack)...... |
| 1273c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 65 73 73 61 67 65 | ...................((eq?.message |
| 1273e0 | 20 27 6f 70 65 72 61 74 69 6f 6e 73 29 20 74 68 65 2d 6f 70 73 29 0a 20 20 20 20 20 20 20 20 20 | .'operations).the-ops).......... |
| 127400 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 6e 6b | ...............(else.(error."Unk |
| 127420 | 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 2d 2d 20 4d 41 43 48 49 4e 45 22 20 6d 65 73 73 61 67 65 | nown.request.--.MACHINE".message |
| 127440 | 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 69 73 70 61 74 63 68 29 29 29 | )))).................dispatch))) |
| 127460 | 0a 0a 20 20 20 41 73 20 70 61 72 74 20 6f 66 20 69 74 73 20 6f 70 65 72 61 74 69 6f 6e 2c 20 65 | .....As.part.of.its.operation,.e |
| 127480 | 61 63 68 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 | ach.instruction.execution.proced |
| 1274a0 | 75 72 65 0a 6d 6f 64 69 66 69 65 73 20 60 70 63 27 20 74 6f 20 69 6e 64 69 63 61 74 65 20 74 68 | ure.modifies.`pc'.to.indicate.th |
| 1274c0 | 65 20 6e 65 78 74 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 74 6f 20 62 65 20 65 78 65 63 75 74 65 | e.next.instruction.to.be.execute |
| 1274e0 | 64 2e 0a 60 42 72 61 6e 63 68 27 20 61 6e 64 20 60 67 6f 74 6f 27 20 69 6e 73 74 72 75 63 74 69 | d..`Branch'.and.`goto'.instructi |
| 127500 | 6f 6e 73 20 63 68 61 6e 67 65 20 60 70 63 27 20 74 6f 20 70 6f 69 6e 74 20 74 6f 20 74 68 65 20 | ons.change.`pc'.to.point.to.the. |
| 127520 | 6e 65 77 0a 64 65 73 74 69 6e 61 74 69 6f 6e 2e 20 20 41 6c 6c 20 6f 74 68 65 72 20 69 6e 73 74 | new.destination...All.other.inst |
| 127540 | 72 75 63 74 69 6f 6e 73 20 73 69 6d 70 6c 79 20 61 64 76 61 6e 63 65 20 60 70 63 27 2c 20 6d 61 | ructions.simply.advance.`pc',.ma |
| 127560 | 6b 69 6e 67 20 69 74 0a 70 6f 69 6e 74 20 74 6f 20 74 68 65 20 6e 65 78 74 20 69 6e 73 74 72 75 | king.it.point.to.the.next.instru |
| 127580 | 63 74 69 6f 6e 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 2e 20 20 4f 62 73 65 72 76 65 20 | ction.in.the.sequence...Observe. |
| 1275a0 | 74 68 61 74 20 65 61 63 68 20 63 61 6c 6c 0a 74 6f 20 60 65 78 65 63 75 74 65 27 20 63 61 6c 6c | that.each.call.to.`execute'.call |
| 1275c0 | 73 20 60 65 78 65 63 75 74 65 27 20 61 67 61 69 6e 2c 20 62 75 74 20 74 68 69 73 20 64 6f 65 73 | s.`execute'.again,.but.this.does |
| 1275e0 | 20 6e 6f 74 20 70 72 6f 64 75 63 65 20 61 6e 0a 69 6e 66 69 6e 69 74 65 20 6c 6f 6f 70 20 62 65 | .not.produce.an.infinite.loop.be |
| 127600 | 63 61 75 73 65 20 72 75 6e 6e 69 6e 67 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 65 78 | cause.running.the.instruction.ex |
| 127620 | 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 0a 63 68 61 6e 67 65 73 20 74 68 65 20 63 6f | ecution.procedure.changes.the.co |
| 127640 | 6e 74 65 6e 74 73 20 6f 66 20 60 70 63 27 2e 0a 0a 20 20 20 60 4d 61 6b 65 2d 6e 65 77 2d 6d 61 | ntents.of.`pc'......`Make-new-ma |
| 127660 | 63 68 69 6e 65 27 20 72 65 74 75 72 6e 73 20 61 20 60 64 69 73 70 61 74 63 68 27 20 70 72 6f 63 | chine'.returns.a.`dispatch'.proc |
| 127680 | 65 64 75 72 65 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 73 0a 6d 65 73 73 61 67 65 2d 70 61 | edure.that.implements.message-pa |
| 1276a0 | 73 73 69 6e 67 20 61 63 63 65 73 73 20 74 6f 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 | ssing.access.to.the.internal.sta |
| 1276c0 | 74 65 2e 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 73 74 61 72 74 69 6e 67 20 74 68 65 0a 6d 61 | te...Notice.that.starting.the.ma |
| 1276e0 | 63 68 69 6e 65 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 73 65 74 74 69 6e 67 | chine.is.accomplished.by.setting |
| 127700 | 20 60 70 63 27 20 74 6f 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65 0a 69 6e | .`pc'.to.the.beginning.of.the.in |
| 127720 | 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 61 6e 64 20 63 61 6c 6c 69 6e 67 20 60 | struction.sequence.and.calling.` |
| 127740 | 65 78 65 63 75 74 65 27 2e 0a 0a 20 20 20 46 6f 72 20 63 6f 6e 76 65 6e 69 65 6e 63 65 2c 20 77 | execute'......For.convenience,.w |
| 127760 | 65 20 70 72 6f 76 69 64 65 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 20 70 72 6f 63 65 64 75 72 61 | e.provide.an.alternate.procedura |
| 127780 | 6c 20 69 6e 74 65 72 66 61 63 65 20 74 6f 20 61 0a 6d 61 63 68 69 6e 65 27 73 20 60 73 74 61 72 | l.interface.to.a.machine's.`star |
| 1277a0 | 74 27 20 6f 70 65 72 61 74 69 6f 6e 2c 20 61 73 20 77 65 6c 6c 20 61 73 20 70 72 6f 63 65 64 75 | t'.operation,.as.well.as.procedu |
| 1277c0 | 72 65 73 20 74 6f 20 73 65 74 20 61 6e 64 20 65 78 61 6d 69 6e 65 0a 72 65 67 69 73 74 65 72 20 | res.to.set.and.examine.register. |
| 1277e0 | 63 6f 6e 74 65 6e 74 73 2c 20 61 73 20 73 70 65 63 69 66 69 65 64 20 61 74 20 74 68 65 20 62 65 | contents,.as.specified.at.the.be |
| 127800 | 67 69 6e 6e 69 6e 67 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 32 3a 3a 3a 0a | ginning.of.section.*Note.5-2:::. |
| 127820 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 61 72 74 20 6d 61 63 68 69 6e 65 29 0a 20 20 | ......(define.(start.machine)... |
| 127840 | 20 20 20 20 20 28 6d 61 63 68 69 6e 65 20 27 73 74 61 72 74 29 29 0a 0a 20 20 20 20 20 28 64 65 | .....(machine.'start)).......(de |
| 127860 | 66 69 6e 65 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 20 6d 61 63 68 | fine.(get-register-contents.mach |
| 127880 | 69 6e 65 20 72 65 67 69 73 74 65 72 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 67 65 74 2d 63 | ine.register-name)........(get-c |
| 1278a0 | 6f 6e 74 65 6e 74 73 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 72 65 | ontents.(get-register.machine.re |
| 1278c0 | 67 69 73 74 65 72 2d 6e 61 6d 65 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 | gister-name))).......(define.(se |
| 1278e0 | 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 21 20 6d 61 63 68 69 6e 65 20 72 65 67 | t-register-contents!.machine.reg |
| 127900 | 69 73 74 65 72 2d 6e 61 6d 65 20 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 28 73 65 74 2d 63 6f | ister-name.value)........(set-co |
| 127920 | 6e 74 65 6e 74 73 21 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 72 65 | ntents!.(get-register.machine.re |
| 127940 | 67 69 73 74 65 72 2d 6e 61 6d 65 29 20 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 27 64 6f 6e 65 | gister-name).value)........'done |
| 127960 | 29 0a 0a 20 20 20 54 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 20 28 61 6e 64 20 6d 61 6e 79 | ).....These.procedures.(and.many |
| 127980 | 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 20 35 2d | .procedures.in.sections.*Note.5- |
| 1279a0 | 32 2d 32 3a 3a 20 61 6e 64 0a 2a 4e 6f 74 65 20 35 2d 32 2d 33 3a 3a 29 20 75 73 65 20 74 68 65 | 2-2::.and.*Note.5-2-3::).use.the |
| 1279c0 | 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 6f 20 6c 6f 6f 6b 20 75 70 20 74 68 65 20 72 65 67 69 73 74 | .following.to.look.up.the.regist |
| 1279e0 | 65 72 20 77 69 74 68 20 61 20 67 69 76 65 6e 0a 6e 61 6d 65 20 69 6e 20 61 20 67 69 76 65 6e 20 | er.with.a.given.name.in.a.given. |
| 127a00 | 6d 61 63 68 69 6e 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 67 65 74 2d 72 65 67 69 | machine:.......(define.(get-regi |
| 127a20 | 73 74 65 72 20 6d 61 63 68 69 6e 65 20 72 65 67 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 28 | ster.machine.reg-name)........(( |
| 127a40 | 6d 61 63 68 69 6e 65 20 27 67 65 74 2d 72 65 67 69 73 74 65 72 29 20 72 65 67 2d 6e 61 6d 65 29 | machine.'get-register).reg-name) |
| 127a60 | 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 32 | )....File:.sicp.info,..Node:.5-2 |
| 127a80 | 2d 32 2c 20 20 4e 65 78 74 3a 20 35 2d 32 2d 33 2c 20 20 50 72 65 76 3a 20 35 2d 32 2d 31 2c 20 | -2,..Next:.5-2-3,..Prev:.5-2-1,. |
| 127aa0 | 20 55 70 3a 20 35 2d 32 0a 0a 35 2e 32 2e 32 20 54 68 65 20 41 73 73 65 6d 62 6c 65 72 0a 2d 2d | .Up:.5-2..5.2.2.The.Assembler.-- |
| 127ac0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 61 73 73 65 6d 62 6c 65 72 | -----------------..The.assembler |
| 127ae0 | 20 74 72 61 6e 73 66 6f 72 6d 73 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 63 6f 6e 74 | .transforms.the.sequence.of.cont |
| 127b00 | 72 6f 6c 6c 65 72 20 65 78 70 72 65 73 73 69 6f 6e 73 20 66 6f 72 20 61 0a 6d 61 63 68 69 6e 65 | roller.expressions.for.a.machine |
| 127b20 | 20 69 6e 74 6f 20 61 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 6c 69 73 74 20 6f 66 20 6d 61 | .into.a.corresponding.list.of.ma |
| 127b40 | 63 68 69 6e 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2c 20 65 61 63 68 20 77 69 74 68 0a 69 74 | chine.instructions,.each.with.it |
| 127b60 | 73 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 2e 20 20 4f 76 65 72 61 6c 6c 2c | s.execution.procedure...Overall, |
| 127b80 | 20 74 68 65 20 61 73 73 65 6d 62 6c 65 72 20 69 73 20 6d 75 63 68 20 6c 69 6b 65 20 74 68 65 0a | .the.assembler.is.much.like.the. |
| 127ba0 | 65 76 61 6c 75 61 74 6f 72 73 20 77 65 20 73 74 75 64 69 65 64 20 69 6e 20 2a 4e 6f 74 65 20 43 | evaluators.we.studied.in.*Note.C |
| 127bc0 | 68 61 70 74 65 72 20 34 3a 3a 2d 2d 74 68 65 72 65 20 69 73 20 61 6e 20 69 6e 70 75 74 20 6c 61 | hapter.4::--there.is.an.input.la |
| 127be0 | 6e 67 75 61 67 65 0a 28 69 6e 20 74 68 69 73 20 63 61 73 65 2c 20 74 68 65 20 72 65 67 69 73 74 | nguage.(in.this.case,.the.regist |
| 127c00 | 65 72 2d 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 29 20 61 6e 64 20 77 65 20 6d 75 73 74 | er-machine.language).and.we.must |
| 127c20 | 20 70 65 72 66 6f 72 6d 20 61 6e 0a 61 70 70 72 6f 70 72 69 61 74 65 20 61 63 74 69 6f 6e 20 66 | .perform.an.appropriate.action.f |
| 127c40 | 6f 72 20 65 61 63 68 20 74 79 70 65 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 | or.each.type.of.expression.in.th |
| 127c60 | 65 20 6c 61 6e 67 75 61 67 65 2e 0a 0a 20 20 20 54 68 65 20 74 65 63 68 6e 69 71 75 65 20 6f 66 | e.language......The.technique.of |
| 127c80 | 20 70 72 6f 64 75 63 69 6e 67 20 61 6e 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 | .producing.an.execution.procedur |
| 127ca0 | 65 20 66 6f 72 20 65 61 63 68 0a 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 73 20 6a 75 73 74 20 77 | e.for.each.instruction.is.just.w |
| 127cc0 | 68 61 74 20 77 65 20 75 73 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 | hat.we.used.in.section.*Note.4-1 |
| 127ce0 | 2d 37 3a 3a 20 74 6f 20 73 70 65 65 64 20 75 70 0a 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 62 | -7::.to.speed.up.the.evaluator.b |
| 127d00 | 79 20 73 65 70 61 72 61 74 69 6e 67 20 61 6e 61 6c 79 73 69 73 20 66 72 6f 6d 20 72 75 6e 74 69 | y.separating.analysis.from.runti |
| 127d20 | 6d 65 20 65 78 65 63 75 74 69 6f 6e 2e 20 20 41 73 20 77 65 20 73 61 77 0a 69 6e 20 2a 4e 6f 74 | me.execution...As.we.saw.in.*Not |
| 127d40 | 65 20 43 68 61 70 74 65 72 20 34 3a 3a 2c 20 6d 75 63 68 20 75 73 65 66 75 6c 20 61 6e 61 6c 79 | e.Chapter.4::,.much.useful.analy |
| 127d60 | 73 69 73 20 6f 66 20 53 63 68 65 6d 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 63 6f 75 6c 64 0a | sis.of.Scheme.expressions.could. |
| 127d80 | 62 65 20 70 65 72 66 6f 72 6d 65 64 20 77 69 74 68 6f 75 74 20 6b 6e 6f 77 69 6e 67 20 74 68 65 | be.performed.without.knowing.the |
| 127da0 | 20 61 63 74 75 61 6c 20 76 61 6c 75 65 73 20 6f 66 20 76 61 72 69 61 62 6c 65 73 2e 20 20 48 65 | .actual.values.of.variables...He |
| 127dc0 | 72 65 2c 0a 61 6e 61 6c 6f 67 6f 75 73 6c 79 2c 20 6d 75 63 68 20 75 73 65 66 75 6c 20 61 6e 61 | re,.analogously,.much.useful.ana |
| 127de0 | 6c 79 73 69 73 20 6f 66 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 2d 6c 61 6e 67 75 61 | lysis.of.register-machine-langua |
| 127e00 | 67 65 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 63 61 6e 20 62 65 20 70 65 72 66 6f 72 6d 65 64 20 | ge.expressions.can.be.performed. |
| 127e20 | 77 69 74 68 6f 75 74 20 6b 6e 6f 77 69 6e 67 20 74 68 65 20 61 63 74 75 61 6c 20 63 6f 6e 74 65 | without.knowing.the.actual.conte |
| 127e40 | 6e 74 73 20 6f 66 0a 6d 61 63 68 69 6e 65 20 72 65 67 69 73 74 65 72 73 2e 20 20 46 6f 72 20 65 | nts.of.machine.registers...For.e |
| 127e60 | 78 61 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 72 65 70 6c 61 63 65 20 72 65 66 65 72 65 6e 63 65 | xample,.we.can.replace.reference |
| 127e80 | 73 20 74 6f 20 72 65 67 69 73 74 65 72 73 0a 62 79 20 70 6f 69 6e 74 65 72 73 20 74 6f 20 74 68 | s.to.registers.by.pointers.to.th |
| 127ea0 | 65 20 72 65 67 69 73 74 65 72 20 6f 62 6a 65 63 74 73 2c 20 61 6e 64 20 77 65 20 63 61 6e 20 72 | e.register.objects,.and.we.can.r |
| 127ec0 | 65 70 6c 61 63 65 20 72 65 66 65 72 65 6e 63 65 73 20 74 6f 0a 6c 61 62 65 6c 73 20 62 79 20 70 | eplace.references.to.labels.by.p |
| 127ee0 | 6f 69 6e 74 65 72 73 20 74 6f 20 74 68 65 20 70 6c 61 63 65 20 69 6e 20 74 68 65 20 69 6e 73 74 | ointers.to.the.place.in.the.inst |
| 127f00 | 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 74 68 61 74 20 74 68 65 0a 6c 61 62 65 6c 20 | ruction.sequence.that.the.label. |
| 127f20 | 64 65 73 69 67 6e 61 74 65 73 2e 0a 0a 20 20 20 42 65 66 6f 72 65 20 69 74 20 63 61 6e 20 67 65 | designates......Before.it.can.ge |
| 127f40 | 6e 65 72 61 74 65 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 65 78 65 63 75 74 69 6f 6e | nerate.the.instruction.execution |
| 127f60 | 20 70 72 6f 63 65 64 75 72 65 73 2c 20 74 68 65 0a 61 73 73 65 6d 62 6c 65 72 20 6d 75 73 74 20 | .procedures,.the.assembler.must. |
| 127f80 | 6b 6e 6f 77 20 77 68 61 74 20 61 6c 6c 20 74 68 65 20 6c 61 62 65 6c 73 20 72 65 66 65 72 20 74 | know.what.all.the.labels.refer.t |
| 127fa0 | 6f 2c 20 73 6f 20 69 74 20 62 65 67 69 6e 73 20 62 79 0a 73 63 61 6e 6e 69 6e 67 20 74 68 65 20 | o,.so.it.begins.by.scanning.the. |
| 127fc0 | 63 6f 6e 74 72 6f 6c 6c 65 72 20 74 65 78 74 20 74 6f 20 73 65 70 61 72 61 74 65 20 74 68 65 20 | controller.text.to.separate.the. |
| 127fe0 | 6c 61 62 65 6c 73 20 66 72 6f 6d 20 74 68 65 0a 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 20 20 41 | labels.from.the.instructions...A |
| 128000 | 73 20 69 74 20 73 63 61 6e 73 20 74 68 65 20 74 65 78 74 2c 20 69 74 20 63 6f 6e 73 74 72 75 63 | s.it.scans.the.text,.it.construc |
| 128020 | 74 73 20 62 6f 74 68 20 61 20 6c 69 73 74 20 6f 66 0a 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 61 | ts.both.a.list.of.instructions.a |
| 128040 | 6e 64 20 61 20 74 61 62 6c 65 20 74 68 61 74 20 61 73 73 6f 63 69 61 74 65 73 20 65 61 63 68 20 | nd.a.table.that.associates.each. |
| 128060 | 6c 61 62 65 6c 20 77 69 74 68 20 61 20 70 6f 69 6e 74 65 72 20 69 6e 74 6f 0a 74 68 61 74 20 6c | label.with.a.pointer.into.that.l |
| 128080 | 69 73 74 2e 20 20 54 68 65 6e 20 74 68 65 20 61 73 73 65 6d 62 6c 65 72 20 61 75 67 6d 65 6e 74 | ist...Then.the.assembler.augment |
| 1280a0 | 73 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 6c 69 73 74 20 62 79 0a 69 6e 73 65 72 74 | s.the.instruction.list.by.insert |
| 1280c0 | 69 6e 67 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 | ing.the.execution.procedure.for. |
| 1280e0 | 65 61 63 68 20 69 6e 73 74 72 75 63 74 69 6f 6e 2e 0a 0a 20 20 20 54 68 65 20 60 61 73 73 65 6d | each.instruction......The.`assem |
| 128100 | 62 6c 65 27 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 74 68 65 20 6d 61 69 6e 20 65 6e 74 72 79 | ble'.procedure.is.the.main.entry |
| 128120 | 20 74 6f 20 74 68 65 20 61 73 73 65 6d 62 6c 65 72 2e 20 20 49 74 0a 74 61 6b 65 73 20 74 68 65 | .to.the.assembler...It.takes.the |
| 128140 | 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 74 65 78 74 20 61 6e 64 20 74 68 65 20 6d 61 63 68 69 6e 65 | .controller.text.and.the.machine |
| 128160 | 20 6d 6f 64 65 6c 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 0a 72 65 74 75 72 6e 73 20 | .model.as.arguments.and.returns. |
| 128180 | 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 74 6f 20 62 65 20 73 | the.instruction.sequence.to.be.s |
| 1281a0 | 74 6f 72 65 64 20 69 6e 20 74 68 65 20 6d 6f 64 65 6c 2e 20 20 60 41 73 73 65 6d 62 6c 65 27 0a | tored.in.the.model...`Assemble'. |
| 1281c0 | 63 61 6c 6c 73 20 60 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 27 20 74 6f 20 62 75 69 6c 64 20 | calls.`extract-labels'.to.build. |
| 1281e0 | 74 68 65 20 69 6e 69 74 69 61 6c 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 6c 69 73 74 20 61 6e 64 | the.initial.instruction.list.and |
| 128200 | 20 6c 61 62 65 6c 0a 74 61 62 6c 65 20 66 72 6f 6d 20 74 68 65 20 73 75 70 70 6c 69 65 64 20 63 | .label.table.from.the.supplied.c |
| 128220 | 6f 6e 74 72 6f 6c 6c 65 72 20 74 65 78 74 2e 20 20 54 68 65 20 73 65 63 6f 6e 64 20 61 72 67 75 | ontroller.text...The.second.argu |
| 128240 | 6d 65 6e 74 20 74 6f 0a 60 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 27 20 69 73 20 61 20 70 72 | ment.to.`extract-labels'.is.a.pr |
| 128260 | 6f 63 65 64 75 72 65 20 74 6f 20 62 65 20 63 61 6c 6c 65 64 20 74 6f 20 70 72 6f 63 65 73 73 20 | ocedure.to.be.called.to.process. |
| 128280 | 74 68 65 73 65 20 72 65 73 75 6c 74 73 3a 0a 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 75 73 | these.results:.This.procedure.us |
| 1282a0 | 65 73 20 60 75 70 64 61 74 65 2d 69 6e 73 74 73 21 27 20 74 6f 20 67 65 6e 65 72 61 74 65 20 74 | es.`update-insts!'.to.generate.t |
| 1282c0 | 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 0a 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 | he.instruction.execution.procedu |
| 1282e0 | 72 65 73 20 61 6e 64 20 69 6e 73 65 72 74 20 74 68 65 6d 20 69 6e 74 6f 20 74 68 65 20 69 6e 73 | res.and.insert.them.into.the.ins |
| 128300 | 74 72 75 63 74 69 6f 6e 20 6c 69 73 74 2c 20 61 6e 64 0a 72 65 74 75 72 6e 73 20 74 68 65 20 6d | truction.list,.and.returns.the.m |
| 128320 | 6f 64 69 66 69 65 64 20 6c 69 73 74 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 73 73 | odified.list........(define.(ass |
| 128340 | 65 6d 62 6c 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 2d 74 65 78 74 20 6d 61 63 68 69 6e 65 29 0a 20 | emble.controller-text.machine).. |
| 128360 | 20 20 20 20 20 20 28 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 20 63 6f 6e 74 72 6f 6c 6c 65 72 | ......(extract-labels.controller |
| 128380 | 2d 74 65 78 74 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 69 6e 73 74 73 20 6c 61 | -text..........(lambda.(insts.la |
| 1283a0 | 62 65 6c 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 75 70 64 61 74 65 2d 69 6e 73 74 73 21 20 | bels)............(update-insts!. |
| 1283c0 | 69 6e 73 74 73 20 6c 61 62 65 6c 73 20 6d 61 63 68 69 6e 65 29 0a 20 20 20 20 20 20 20 20 20 20 | insts.labels.machine)........... |
| 1283e0 | 20 69 6e 73 74 73 29 29 29 0a 0a 20 20 20 60 45 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 27 20 74 | .insts))).....`Extract-labels'.t |
| 128400 | 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 20 6c 69 73 74 20 60 74 65 78 74 27 20 | akes.as.arguments.a.list.`text'. |
| 128420 | 28 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 63 6f 6e 74 72 6f 6c 6c 65 72 20 69 6e 73 74 | (the.sequence.of.controller.inst |
| 128440 | 72 75 63 74 69 6f 6e 20 65 78 70 72 65 73 73 69 6f 6e 73 29 20 61 6e 64 20 61 20 60 72 65 63 65 | ruction.expressions).and.a.`rece |
| 128460 | 69 76 65 27 20 70 72 6f 63 65 64 75 72 65 2e 0a 60 52 65 63 65 69 76 65 27 20 77 69 6c 6c 20 62 | ive'.procedure..`Receive'.will.b |
| 128480 | 65 20 63 61 6c 6c 65 64 20 77 69 74 68 20 74 77 6f 20 76 61 6c 75 65 73 3a 20 28 31 29 20 61 20 | e.called.with.two.values:.(1).a. |
| 1284a0 | 6c 69 73 74 20 60 69 6e 73 74 73 27 20 6f 66 0a 69 6e 73 74 72 75 63 74 69 6f 6e 20 64 61 74 61 | list.`insts'.of.instruction.data |
| 1284c0 | 20 73 74 72 75 63 74 75 72 65 73 2c 20 65 61 63 68 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 6e 20 | .structures,.each.containing.an. |
| 1284e0 | 69 6e 73 74 72 75 63 74 69 6f 6e 20 66 72 6f 6d 20 60 74 65 78 74 27 3b 0a 61 6e 64 20 28 32 29 | instruction.from.`text';.and.(2) |
| 128500 | 20 61 20 74 61 62 6c 65 20 63 61 6c 6c 65 64 20 60 6c 61 62 65 6c 73 27 2c 20 77 68 69 63 68 20 | .a.table.called.`labels',.which. |
| 128520 | 61 73 73 6f 63 69 61 74 65 73 20 65 61 63 68 20 6c 61 62 65 6c 20 66 72 6f 6d 0a 60 74 65 78 74 | associates.each.label.from.`text |
| 128540 | 27 20 77 69 74 68 20 74 68 65 20 70 6f 73 69 74 69 6f 6e 20 69 6e 20 74 68 65 20 6c 69 73 74 20 | '.with.the.position.in.the.list. |
| 128560 | 60 69 6e 73 74 73 27 20 74 68 61 74 20 74 68 65 20 6c 61 62 65 6c 20 64 65 73 69 67 6e 61 74 65 | `insts'.that.the.label.designate |
| 128580 | 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 | s........(define.(extract-labels |
| 1285a0 | 20 74 65 78 74 20 72 65 63 65 69 76 65 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f | .text.receive)........(if.(null? |
| 1285c0 | 20 74 65 78 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 72 65 63 65 69 76 65 20 27 28 29 20 27 | .text)............(receive.'().' |
| 1285e0 | 28 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 20 28 | ())............(extract-labels.( |
| 128600 | 63 64 72 20 74 65 78 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 69 | cdr.text).............(lambda.(i |
| 128620 | 6e 73 74 73 20 6c 61 62 65 6c 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 | nsts.labels)...............(let. |
| 128640 | 28 28 6e 65 78 74 2d 69 6e 73 74 20 28 63 61 72 20 74 65 78 74 29 29 29 0a 20 20 20 20 20 20 20 | ((next-inst.(car.text)))........ |
| 128660 | 20 20 20 20 20 20 20 20 20 28 69 66 20 28 73 79 6d 62 6f 6c 3f 20 6e 65 78 74 2d 69 6e 73 74 29 | .........(if.(symbol?.next-inst) |
| 128680 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 63 65 69 76 65 20 69 6e | .....................(receive.in |
| 1286a0 | 73 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | sts............................. |
| 1286c0 | 20 28 63 6f 6e 73 20 28 6d 61 6b 65 2d 6c 61 62 65 6c 2d 65 6e 74 72 79 20 6e 65 78 74 2d 69 6e | .(cons.(make-label-entry.next-in |
| 1286e0 | 73 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | st.............................. |
| 128700 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 73 74 73 29 0a 20 | ........................insts).. |
| 128720 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 128740 | 20 20 6c 61 62 65 6c 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..labels)).....................( |
| 128760 | 72 65 63 65 69 76 65 20 28 63 6f 6e 73 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 20 | receive.(cons.(make-instruction. |
| 128780 | 6e 65 78 74 2d 69 6e 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | next-inst)...................... |
| 1287a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 73 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ..............insts)............ |
| 1287c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6c 61 62 65 6c 73 29 29 29 29 29 29 29 0a | ..................labels))))))). |
| 1287e0 | 0a 20 20 20 60 45 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 27 20 77 6f 72 6b 73 20 62 79 20 73 65 | ....`Extract-labels'.works.by.se |
| 128800 | 71 75 65 6e 74 69 61 6c 6c 79 20 73 63 61 6e 6e 69 6e 67 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 | quentially.scanning.the.elements |
| 128820 | 20 6f 66 20 74 68 65 0a 60 74 65 78 74 27 20 61 6e 64 20 61 63 63 75 6d 75 6c 61 74 69 6e 67 20 | .of.the.`text'.and.accumulating. |
| 128840 | 74 68 65 20 60 69 6e 73 74 73 27 20 61 6e 64 20 74 68 65 20 60 6c 61 62 65 6c 73 27 2e 20 20 49 | the.`insts'.and.the.`labels'...I |
| 128860 | 66 20 61 6e 20 65 6c 65 6d 65 6e 74 20 69 73 0a 61 20 73 79 6d 62 6f 6c 20 28 61 6e 64 20 74 68 | f.an.element.is.a.symbol.(and.th |
| 128880 | 75 73 20 61 20 6c 61 62 65 6c 29 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20 65 6e 74 72 79 | us.a.label).an.appropriate.entry |
| 1288a0 | 20 69 73 20 61 64 64 65 64 20 74 6f 20 74 68 65 0a 60 6c 61 62 65 6c 73 27 20 74 61 62 6c 65 2e | .is.added.to.the.`labels'.table. |
| 1288c0 | 20 20 4f 74 68 65 72 77 69 73 65 20 74 68 65 20 65 6c 65 6d 65 6e 74 20 69 73 20 61 63 63 75 6d | ..Otherwise.the.element.is.accum |
| 1288e0 | 75 6c 61 74 65 64 20 6f 6e 74 6f 20 74 68 65 20 60 69 6e 73 74 73 27 0a 6c 69 73 74 2e 28 31 29 | ulated.onto.the.`insts'.list.(1) |
| 128900 | 0a 0a 20 20 20 60 55 70 64 61 74 65 2d 69 6e 73 74 73 21 27 20 6d 6f 64 69 66 69 65 73 20 74 68 | .....`Update-insts!'.modifies.th |
| 128920 | 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 6c 69 73 74 2c 20 77 68 69 63 68 20 69 6e 69 74 69 61 | e.instruction.list,.which.initia |
| 128940 | 6c 6c 79 0a 63 6f 6e 74 61 69 6e 73 20 6f 6e 6c 79 20 74 68 65 20 74 65 78 74 20 6f 66 20 74 68 | lly.contains.only.the.text.of.th |
| 128960 | 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2c 20 74 6f 20 69 6e 63 6c 75 64 65 20 74 68 65 0a 63 | e.instructions,.to.include.the.c |
| 128980 | 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 | orresponding.execution.procedure |
| 1289a0 | 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 75 70 64 61 74 65 2d 69 6e 73 74 73 21 20 | s:.......(define.(update-insts!. |
| 1289c0 | 69 6e 73 74 73 20 6c 61 62 65 6c 73 20 6d 61 63 68 69 6e 65 29 0a 20 20 20 20 20 20 20 28 6c 65 | insts.labels.machine)........(le |
| 1289e0 | 74 20 28 28 70 63 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 27 70 63 | t.((pc.(get-register.machine.'pc |
| 128a00 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 6c 61 67 20 28 67 65 74 2d 72 65 67 69 73 | ))..............(flag.(get-regis |
| 128a20 | 74 65 72 20 6d 61 63 68 69 6e 65 20 27 66 6c 61 67 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ter.machine.'flag))............. |
| 128a40 | 20 28 73 74 61 63 6b 20 28 6d 61 63 68 69 6e 65 20 27 73 74 61 63 6b 29 29 0a 20 20 20 20 20 20 | .(stack.(machine.'stack))....... |
| 128a60 | 20 20 20 20 20 20 20 28 6f 70 73 20 28 6d 61 63 68 69 6e 65 20 27 6f 70 65 72 61 74 69 6f 6e 73 | .......(ops.(machine.'operations |
| 128a80 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 66 6f 72 2d 65 61 63 68 0a 20 20 20 20 20 20 20 20 20 | )))..........(for-each.......... |
| 128aa0 | 20 28 6c 61 6d 62 64 61 20 28 69 6e 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 | .(lambda.(inst).............(set |
| 128ac0 | 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 65 78 65 63 75 74 69 6f 6e 2d 70 72 6f 63 21 0a 20 20 20 | -instruction-execution-proc!.... |
| 128ae0 | 20 20 20 20 20 20 20 20 20 20 69 6e 73 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b | ..........inst..............(mak |
| 128b00 | 65 2d 65 78 65 63 75 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 20 20 20 20 20 | e-execution-procedure........... |
| 128b20 | 20 20 20 20 28 69 6e 73 74 72 75 63 74 69 6f 6e 2d 74 65 78 74 20 69 6e 73 74 29 20 6c 61 62 65 | ....(instruction-text.inst).labe |
| 128b40 | 6c 73 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 63 20 66 6c 61 67 | ls.machine...............pc.flag |
| 128b60 | 20 73 74 61 63 6b 20 6f 70 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 69 6e 73 74 73 29 29 29 | .stack.ops)))...........insts))) |
| 128b80 | 0a 0a 20 20 20 54 68 65 20 6d 61 63 68 69 6e 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 64 61 74 | .....The.machine.instruction.dat |
| 128ba0 | 61 20 73 74 72 75 63 74 75 72 65 20 73 69 6d 70 6c 79 20 70 61 69 72 73 20 74 68 65 20 69 6e 73 | a.structure.simply.pairs.the.ins |
| 128bc0 | 74 72 75 63 74 69 6f 6e 0a 74 65 78 74 20 77 69 74 68 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e | truction.text.with.the.correspon |
| 128be0 | 64 69 6e 67 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 65 20 65 | ding.execution.procedure...The.e |
| 128c00 | 78 65 63 75 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 20 69 73 20 6e 6f 74 20 79 65 74 20 61 76 | xecution.procedure.is.not.yet.av |
| 128c20 | 61 69 6c 61 62 6c 65 20 77 68 65 6e 20 60 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 27 20 63 6f | ailable.when.`extract-labels'.co |
| 128c40 | 6e 73 74 72 75 63 74 73 20 74 68 65 0a 69 6e 73 74 72 75 63 74 69 6f 6e 2c 20 61 6e 64 20 69 73 | nstructs.the.instruction,.and.is |
| 128c60 | 20 69 6e 73 65 72 74 65 64 20 6c 61 74 65 72 20 62 79 20 60 75 70 64 61 74 65 2d 69 6e 73 74 73 | .inserted.later.by.`update-insts |
| 128c80 | 21 27 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 | !'........(define.(make-instruct |
| 128ca0 | 69 6f 6e 20 74 65 78 74 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 20 74 65 78 74 20 27 28 29 29 | ion.text)........(cons.text.'()) |
| 128cc0 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 6e 73 74 72 75 63 74 69 6f 6e 2d 74 65 78 | ).......(define.(instruction-tex |
| 128ce0 | 74 20 69 6e 73 74 29 0a 20 20 20 20 20 20 20 28 63 61 72 20 69 6e 73 74 29 29 0a 0a 20 20 20 20 | t.inst)........(car.inst))...... |
| 128d00 | 20 28 64 65 66 69 6e 65 20 28 69 6e 73 74 72 75 63 74 69 6f 6e 2d 65 78 65 63 75 74 69 6f 6e 2d | .(define.(instruction-execution- |
| 128d20 | 70 72 6f 63 20 69 6e 73 74 29 0a 20 20 20 20 20 20 20 28 63 64 72 20 69 6e 73 74 29 29 0a 0a 20 | proc.inst)........(cdr.inst))... |
| 128d40 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 65 74 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 65 78 65 | ....(define.(set-instruction-exe |
| 128d60 | 63 75 74 69 6f 6e 2d 70 72 6f 63 21 20 69 6e 73 74 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 28 | cution-proc!.inst.proc)........( |
| 128d80 | 73 65 74 2d 63 64 72 21 20 69 6e 73 74 20 70 72 6f 63 29 29 0a 0a 20 20 20 54 68 65 20 69 6e 73 | set-cdr!.inst.proc)).....The.ins |
| 128da0 | 74 72 75 63 74 69 6f 6e 20 74 65 78 74 20 69 73 20 6e 6f 74 20 75 73 65 64 20 62 79 20 6f 75 72 | truction.text.is.not.used.by.our |
| 128dc0 | 20 73 69 6d 75 6c 61 74 6f 72 2c 20 62 75 74 20 69 74 20 69 73 20 68 61 6e 64 79 0a 74 6f 20 6b | .simulator,.but.it.is.handy.to.k |
| 128de0 | 65 65 70 20 61 72 6f 75 6e 64 20 66 6f 72 20 64 65 62 75 67 67 69 6e 67 20 28 73 65 65 20 2a 4e | eep.around.for.debugging.(see.*N |
| 128e00 | 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 31 36 3a 3a 29 2e 0a 0a 20 20 20 45 6c 65 6d 65 6e | ote.Exercise.5-16::)......Elemen |
| 128e20 | 74 73 20 6f 66 20 74 68 65 20 6c 61 62 65 6c 20 74 61 62 6c 65 20 61 72 65 20 70 61 69 72 73 3a | ts.of.the.label.table.are.pairs: |
| 128e40 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 6c 61 62 65 6c 2d 65 6e 74 72 79 | .......(define.(make-label-entry |
| 128e60 | 20 6c 61 62 65 6c 2d 6e 61 6d 65 20 69 6e 73 74 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 73 20 | .label-name.insts)........(cons. |
| 128e80 | 6c 61 62 65 6c 2d 6e 61 6d 65 20 69 6e 73 74 73 29 29 0a 0a 20 20 20 45 6e 74 72 69 65 73 20 77 | label-name.insts)).....Entries.w |
| 128ea0 | 69 6c 6c 20 62 65 20 6c 6f 6f 6b 65 64 20 75 70 20 69 6e 20 74 68 65 20 74 61 62 6c 65 20 77 69 | ill.be.looked.up.in.the.table.wi |
| 128ec0 | 74 68 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 6b 75 70 2d 6c 61 62 65 6c 20 6c | th.......(define.(lookup-label.l |
| 128ee0 | 61 62 65 6c 73 20 6c 61 62 65 6c 2d 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 | abels.label-name)........(let.(( |
| 128f00 | 76 61 6c 20 28 61 73 73 6f 63 20 6c 61 62 65 6c 2d 6e 61 6d 65 20 6c 61 62 65 6c 73 29 29 29 0a | val.(assoc.label-name.labels))). |
| 128f20 | 20 20 20 20 20 20 20 20 20 28 69 66 20 76 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 | .........(if.val..............(c |
| 128f40 | 64 72 20 76 61 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 64 | dr.val)..............(error."Und |
| 128f60 | 65 66 69 6e 65 64 20 6c 61 62 65 6c 20 2d 2d 20 41 53 53 45 4d 42 4c 45 22 20 6c 61 62 65 6c 2d | efined.label.--.ASSEMBLE".label- |
| 128f80 | 6e 61 6d 65 29 29 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 38 3a 2a 20 54 | name)))).......*Exercise.5.8:*.T |
| 128fa0 | 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 63 6f | he.following.register-machine.co |
| 128fc0 | 64 65 20 69 73 20 61 6d 62 69 67 75 6f 75 73 2c 0a 20 20 20 20 20 62 65 63 61 75 73 65 20 74 68 | de.is.ambiguous,......because.th |
| 128fe0 | 65 20 6c 61 62 65 6c 20 60 68 65 72 65 27 20 69 73 20 64 65 66 69 6e 65 64 20 6d 6f 72 65 20 74 | e.label.`here'.is.defined.more.t |
| 129000 | 68 61 6e 20 6f 6e 63 65 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 73 74 61 72 74 0a 20 20 20 20 20 | han.once:............start...... |
| 129020 | 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 68 65 72 65 29 29 0a 20 20 20 20 20 | .......(goto.(label.here))...... |
| 129040 | 20 20 20 20 20 68 65 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 20 | .....here.............(assign.a. |
| 129060 | 28 63 6f 6e 73 74 20 33 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 | (const.3)).............(goto.(la |
| 129080 | 62 65 6c 20 74 68 65 72 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 68 65 72 65 0a 20 20 20 20 20 | bel.there))...........here...... |
| 1290a0 | 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 20 28 63 6f 6e 73 74 20 34 29 29 0a 20 20 20 20 | .......(assign.a.(const.4))..... |
| 1290c0 | 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 74 68 65 72 65 29 29 0a 20 20 20 | ........(goto.(label.there)).... |
| 1290e0 | 20 20 20 20 20 20 20 74 68 65 72 65 0a 0a 20 20 20 20 20 57 69 74 68 20 74 68 65 20 73 69 6d 75 | .......there.......With.the.simu |
| 129100 | 6c 61 74 6f 72 20 61 73 20 77 72 69 74 74 65 6e 2c 20 77 68 61 74 20 77 69 6c 6c 20 74 68 65 20 | lator.as.written,.what.will.the. |
| 129120 | 63 6f 6e 74 65 6e 74 73 20 6f 66 20 72 65 67 69 73 74 65 72 0a 20 20 20 20 20 60 61 27 20 62 65 | contents.of.register......`a'.be |
| 129140 | 20 77 68 65 6e 20 63 6f 6e 74 72 6f 6c 20 72 65 61 63 68 65 73 20 60 74 68 65 72 65 27 3f 20 20 | .when.control.reaches.`there'?.. |
| 129160 | 4d 6f 64 69 66 79 20 74 68 65 20 60 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 27 0a 20 20 20 20 | Modify.the.`extract-labels'..... |
| 129180 | 20 70 72 6f 63 65 64 75 72 65 20 73 6f 20 74 68 61 74 20 74 68 65 20 61 73 73 65 6d 62 6c 65 72 | .procedure.so.that.the.assembler |
| 1291a0 | 20 77 69 6c 6c 20 73 69 67 6e 61 6c 20 61 6e 20 65 72 72 6f 72 20 69 66 20 74 68 65 20 73 61 6d | .will.signal.an.error.if.the.sam |
| 1291c0 | 65 0a 20 20 20 20 20 6c 61 62 65 6c 20 6e 61 6d 65 20 69 73 20 75 73 65 64 20 74 6f 20 69 6e 64 | e......label.name.is.used.to.ind |
| 1291e0 | 69 63 61 74 65 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 6c 6f 63 61 74 69 6f 6e 73 2e 0a 0a | icate.two.different.locations... |
| 129200 | 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d | ...----------.Footnotes.-------- |
| 129220 | 2d 2d 0a 0a 20 20 20 28 31 29 20 55 73 69 6e 67 20 74 68 65 20 60 72 65 63 65 69 76 65 27 20 70 | --.....(1).Using.the.`receive'.p |
| 129240 | 72 6f 63 65 64 75 72 65 20 68 65 72 65 20 69 73 20 61 20 77 61 79 20 74 6f 20 67 65 74 0a 60 65 | rocedure.here.is.a.way.to.get.`e |
| 129260 | 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 27 20 74 6f 20 65 66 66 65 63 74 69 76 65 6c 79 20 72 65 | xtract-labels'.to.effectively.re |
| 129280 | 74 75 72 6e 20 74 77 6f 20 76 61 6c 75 65 73 2d 2d 60 6c 61 62 65 6c 73 27 20 61 6e 64 0a 60 69 | turn.two.values--`labels'.and.`i |
| 1292a0 | 6e 73 74 73 27 2d 2d 77 69 74 68 6f 75 74 20 65 78 70 6c 69 63 69 74 6c 79 20 6d 61 6b 69 6e 67 | nsts'--without.explicitly.making |
| 1292c0 | 20 61 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 20 74 6f 20 68 6f | .a.compound.data.structure.to.ho |
| 1292e0 | 6c 64 0a 74 68 65 6d 2e 20 20 41 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 69 6d 70 6c 65 6d 65 | ld.them...An.alternative.impleme |
| 129300 | 6e 74 61 74 69 6f 6e 2c 20 77 68 69 63 68 20 72 65 74 75 72 6e 73 20 61 6e 20 65 78 70 6c 69 63 | ntation,.which.returns.an.explic |
| 129320 | 69 74 20 70 61 69 72 20 6f 66 0a 76 61 6c 75 65 73 2c 20 69 73 0a 0a 20 20 20 20 20 28 64 65 66 | it.pair.of.values,.is.......(def |
| 129340 | 69 6e 65 20 28 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 20 74 65 78 74 29 0a 20 20 20 20 20 20 | ine.(extract-labels.text)....... |
| 129360 | 20 28 69 66 20 28 6e 75 6c 6c 3f 20 74 65 78 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f | .(if.(null?.text)............(co |
| 129380 | 6e 73 20 27 28 29 20 27 28 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 | ns.'().'())............(let.((re |
| 1293a0 | 73 75 6c 74 20 28 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 20 28 63 64 72 20 74 65 78 74 29 29 | sult.(extract-labels.(cdr.text)) |
| 1293c0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e 73 74 73 20 28 63 61 | ))..............(let.((insts.(ca |
| 1293e0 | 72 20 72 65 73 75 6c 74 29 29 20 28 6c 61 62 65 6c 73 20 28 63 64 72 20 72 65 73 75 6c 74 29 29 | r.result)).(labels.(cdr.result)) |
| 129400 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6e 65 78 74 2d 69 6e 73 | )................(let.((next-ins |
| 129420 | 74 20 28 63 61 72 20 74 65 78 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | t.(car.text))).................. |
| 129440 | 28 69 66 20 28 73 79 6d 62 6f 6c 3f 20 6e 65 78 74 2d 69 6e 73 74 29 0a 20 20 20 20 20 20 20 20 | (if.(symbol?.next-inst)......... |
| 129460 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 69 6e 73 74 73 0a 20 20 20 20 20 20 20 | .............(cons.insts........ |
| 129480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 20 28 6d 61 6b 65 2d | ....................(cons.(make- |
| 1294a0 | 6c 61 62 65 6c 2d 65 6e 74 72 79 20 6e 65 78 74 2d 69 6e 73 74 20 69 6e 73 74 73 29 20 6c 61 62 | label-entry.next-inst.insts).lab |
| 1294c0 | 65 6c 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 | els))......................(cons |
| 1294e0 | 20 28 63 6f 6e 73 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 20 6e 65 78 74 2d 69 6e | .(cons.(make-instruction.next-in |
| 129500 | 73 74 29 20 69 6e 73 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | st).insts)...................... |
| 129520 | 20 20 20 20 20 20 6c 61 62 65 6c 73 29 29 29 29 29 29 29 0a 0a 77 68 69 63 68 20 77 6f 75 6c 64 | ......labels)))))))..which.would |
| 129540 | 20 62 65 20 63 61 6c 6c 65 64 20 62 79 20 60 61 73 73 65 6d 62 6c 65 27 20 61 73 20 66 6f 6c 6c | .be.called.by.`assemble'.as.foll |
| 129560 | 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 73 73 65 6d 62 6c 65 20 63 6f 6e | ows:.......(define.(assemble.con |
| 129580 | 74 72 6f 6c 6c 65 72 2d 74 65 78 74 20 6d 61 63 68 69 6e 65 29 0a 20 20 20 20 20 20 20 28 6c 65 | troller-text.machine)........(le |
| 1295a0 | 74 20 28 28 72 65 73 75 6c 74 20 28 65 78 74 72 61 63 74 2d 6c 61 62 65 6c 73 20 63 6f 6e 74 72 | t.((result.(extract-labels.contr |
| 1295c0 | 6f 6c 6c 65 72 2d 74 65 78 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e | oller-text)))..........(let.((in |
| 1295e0 | 73 74 73 20 28 63 61 72 20 72 65 73 75 6c 74 29 29 20 28 6c 61 62 65 6c 73 20 28 63 64 72 20 72 | sts.(car.result)).(labels.(cdr.r |
| 129600 | 65 73 75 6c 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 75 70 64 61 74 65 2d 69 6e 73 74 | esult)))............(update-inst |
| 129620 | 73 21 20 69 6e 73 74 73 20 6c 61 62 65 6c 73 20 6d 61 63 68 69 6e 65 29 0a 20 20 20 20 20 20 20 | s!.insts.labels.machine)........ |
| 129640 | 20 20 20 20 69 6e 73 74 73 29 29 29 0a 0a 20 20 20 59 6f 75 20 63 61 6e 20 63 6f 6e 73 69 64 65 | ....insts))).....You.can.conside |
| 129660 | 72 20 6f 75 72 20 75 73 65 20 6f 66 20 60 72 65 63 65 69 76 65 27 20 61 73 20 64 65 6d 6f 6e 73 | r.our.use.of.`receive'.as.demons |
| 129680 | 74 72 61 74 69 6e 67 20 61 6e 20 65 6c 65 67 61 6e 74 0a 77 61 79 20 74 6f 20 72 65 74 75 72 6e | trating.an.elegant.way.to.return |
| 1296a0 | 20 6d 75 6c 74 69 70 6c 65 20 76 61 6c 75 65 73 2c 20 6f 72 20 73 69 6d 70 6c 79 20 61 6e 20 65 | .multiple.values,.or.simply.an.e |
| 1296c0 | 78 63 75 73 65 20 74 6f 20 73 68 6f 77 20 6f 66 66 20 61 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 | xcuse.to.show.off.a.programming. |
| 1296e0 | 74 72 69 63 6b 2e 20 20 41 6e 20 61 72 67 75 6d 65 6e 74 20 6c 69 6b 65 20 60 72 65 63 65 69 76 | trick...An.argument.like.`receiv |
| 129700 | 65 27 20 74 68 61 74 20 69 73 20 74 68 65 20 6e 65 78 74 0a 70 72 6f 63 65 64 75 72 65 20 74 6f | e'.that.is.the.next.procedure.to |
| 129720 | 20 62 65 20 69 6e 76 6f 6b 65 64 20 69 73 20 63 61 6c 6c 65 64 20 61 20 22 63 6f 6e 74 69 6e 75 | .be.invoked.is.called.a."continu |
| 129740 | 61 74 69 6f 6e 2e 22 20 20 52 65 63 61 6c 6c 20 74 68 61 74 20 77 65 0a 61 6c 73 6f 20 75 73 65 | ation."..Recall.that.we.also.use |
| 129760 | 64 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 | d.continuations.to.implement.the |
| 129780 | 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 20 63 6f 6e 74 72 6f 6c 20 73 74 72 75 63 74 75 72 65 0a | .backtracking.control.structure. |
| 1297a0 | 69 6e 20 74 68 65 20 60 61 6d 62 27 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 73 65 63 74 69 6f | in.the.`amb'.evaluator.in.sectio |
| 1297c0 | 6e 20 2a 4e 6f 74 65 20 34 2d 33 2d 33 3a 3a 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 | n.*Note.4-3-3::.....File:.sicp.i |
| 1297e0 | 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 32 2d 33 2c 20 20 4e 65 78 74 3a 20 35 2d 32 2d 34 2c | nfo,..Node:.5-2-3,..Next:.5-2-4, |
| 129800 | 20 20 50 72 65 76 3a 20 35 2d 32 2d 32 2c 20 20 55 70 3a 20 35 2d 32 0a 0a 35 2e 32 2e 33 20 47 | ..Prev:.5-2-2,..Up:.5-2..5.2.3.G |
| 129820 | 65 6e 65 72 61 74 69 6e 67 20 45 78 65 63 75 74 69 6f 6e 20 50 72 6f 63 65 64 75 72 65 73 20 66 | enerating.Execution.Procedures.f |
| 129840 | 6f 72 20 49 6e 73 74 72 75 63 74 69 6f 6e 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | or.Instructions.---------------- |
| 129860 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 129880 | 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 61 73 73 65 6d 62 6c 65 72 20 63 61 6c 6c 73 20 60 6d 61 6b | ------..The.assembler.calls.`mak |
| 1298a0 | 65 2d 65 78 65 63 75 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 27 20 74 6f 20 67 65 6e 65 72 61 | e-execution-procedure'.to.genera |
| 1298c0 | 74 65 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 0a 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 61 | te.the.execution.procedure.for.a |
| 1298e0 | 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 2e 20 20 4c 69 6b 65 20 74 68 65 20 60 61 6e 61 6c 79 7a | n.instruction...Like.the.`analyz |
| 129900 | 65 27 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 20 6f 66 | e'.procedure.in.the.evaluator.of |
| 129920 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 37 3a 3a 2c 20 74 68 69 73 20 64 69 73 | .section.*Note.4-1-7::,.this.dis |
| 129940 | 70 61 74 63 68 65 73 20 6f 6e 20 74 68 65 20 74 79 70 65 20 6f 66 0a 69 6e 73 74 72 75 63 74 69 | patches.on.the.type.of.instructi |
| 129960 | 6f 6e 20 74 6f 20 67 65 6e 65 72 61 74 65 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 65 | on.to.generate.the.appropriate.e |
| 129980 | 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | xecution.procedure........(defin |
| 1299a0 | 65 20 28 6d 61 6b 65 2d 65 78 65 63 75 74 69 6f 6e 2d 70 72 6f 63 65 64 75 72 65 20 69 6e 73 74 | e.(make-execution-procedure.inst |
| 1299c0 | 20 6c 61 62 65 6c 73 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .labels.machine................. |
| 1299e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 63 20 66 6c 61 67 20 73 | .......................pc.flag.s |
| 129a00 | 74 61 63 6b 20 6f 70 73 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 28 63 61 | tack.ops)........(cond.((eq?.(ca |
| 129a20 | 72 20 69 6e 73 74 29 20 27 61 73 73 69 67 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | r.inst).'assign)...............( |
| 129a40 | 6d 61 6b 65 2d 61 73 73 69 67 6e 20 69 6e 73 74 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 | make-assign.inst.machine.labels. |
| 129a60 | 6f 70 73 20 70 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 28 63 61 72 | ops.pc))..............((eq?.(car |
| 129a80 | 20 69 6e 73 74 29 20 27 74 65 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b | .inst).'test)...............(mak |
| 129aa0 | 65 2d 74 65 73 74 20 69 6e 73 74 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 6f 70 73 20 66 | e-test.inst.machine.labels.ops.f |
| 129ac0 | 6c 61 67 20 70 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 28 63 61 72 | lag.pc))..............((eq?.(car |
| 129ae0 | 20 69 6e 73 74 29 20 27 62 72 61 6e 63 68 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d | .inst).'branch)...............(m |
| 129b00 | 61 6b 65 2d 62 72 61 6e 63 68 20 69 6e 73 74 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 66 | ake-branch.inst.machine.labels.f |
| 129b20 | 6c 61 67 20 70 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 28 63 61 72 | lag.pc))..............((eq?.(car |
| 129b40 | 20 69 6e 73 74 29 20 27 67 6f 74 6f 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b | .inst).'goto)...............(mak |
| 129b60 | 65 2d 67 6f 74 6f 20 69 6e 73 74 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 70 63 29 29 0a | e-goto.inst.machine.labels.pc)). |
| 129b80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 28 63 61 72 20 69 6e 73 74 29 20 27 73 | .............((eq?.(car.inst).'s |
| 129ba0 | 61 76 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 73 61 76 65 20 69 6e | ave)...............(make-save.in |
| 129bc0 | 73 74 20 6d 61 63 68 69 6e 65 20 73 74 61 63 6b 20 70 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 | st.machine.stack.pc))........... |
| 129be0 | 20 20 20 28 28 65 71 3f 20 28 63 61 72 20 69 6e 73 74 29 20 27 72 65 73 74 6f 72 65 29 0a 20 20 | ...((eq?.(car.inst).'restore)... |
| 129c00 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 72 65 73 74 6f 72 65 20 69 6e 73 74 20 6d | ............(make-restore.inst.m |
| 129c20 | 61 63 68 69 6e 65 20 73 74 61 63 6b 20 70 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | achine.stack.pc))..............( |
| 129c40 | 28 65 71 3f 20 28 63 61 72 20 69 6e 73 74 29 20 27 70 65 72 66 6f 72 6d 29 0a 20 20 20 20 20 20 | (eq?.(car.inst).'perform)....... |
| 129c60 | 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 70 65 72 66 6f 72 6d 20 69 6e 73 74 20 6d 61 63 68 69 | ........(make-perform.inst.machi |
| 129c80 | 6e 65 20 6c 61 62 65 6c 73 20 6f 70 73 20 70 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ne.labels.ops.pc)).............. |
| 129ca0 | 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 69 6e 73 74 72 75 63 74 69 6f | (else.(error."Unknown.instructio |
| 129cc0 | 6e 20 74 79 70 65 20 2d 2d 20 41 53 53 45 4d 42 4c 45 22 0a 20 20 20 20 20 20 20 20 20 20 20 20 | n.type.--.ASSEMBLE"............. |
| 129ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 73 74 29 29 29 29 0a 0a 20 20 20 46 6f 72 20 65 | ..............inst)))).....For.e |
| 129d00 | 61 63 68 20 74 79 70 65 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 6e 20 74 68 65 20 72 | ach.type.of.instruction.in.the.r |
| 129d20 | 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 2c 20 74 68 65 72 65 0a | egister-machine.language,.there. |
| 129d40 | 69 73 20 61 20 67 65 6e 65 72 61 74 6f 72 20 74 68 61 74 20 62 75 69 6c 64 73 20 61 6e 20 61 70 | is.a.generator.that.builds.an.ap |
| 129d60 | 70 72 6f 70 72 69 61 74 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 2e 20 20 | propriate.execution.procedure... |
| 129d80 | 54 68 65 0a 64 65 74 61 69 6c 73 20 6f 66 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 20 | The.details.of.these.procedures. |
| 129da0 | 64 65 74 65 72 6d 69 6e 65 20 62 6f 74 68 20 74 68 65 20 73 79 6e 74 61 78 20 61 6e 64 20 6d 65 | determine.both.the.syntax.and.me |
| 129dc0 | 61 6e 69 6e 67 20 6f 66 0a 74 68 65 20 69 6e 64 69 76 69 64 75 61 6c 20 69 6e 73 74 72 75 63 74 | aning.of.the.individual.instruct |
| 129de0 | 69 6f 6e 73 20 69 6e 20 74 68 65 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 6c 61 6e | ions.in.the.register-machine.lan |
| 129e00 | 67 75 61 67 65 2e 20 20 57 65 20 75 73 65 0a 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 | guage...We.use.data.abstraction. |
| 129e20 | 74 6f 20 69 73 6f 6c 61 74 65 20 74 68 65 20 64 65 74 61 69 6c 65 64 20 73 79 6e 74 61 78 20 6f | to.isolate.the.detailed.syntax.o |
| 129e40 | 66 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 66 | f.register-machine.expressions.f |
| 129e60 | 72 6f 6d 20 74 68 65 20 67 65 6e 65 72 61 6c 20 65 78 65 63 75 74 69 6f 6e 20 6d 65 63 68 61 6e | rom.the.general.execution.mechan |
| 129e80 | 69 73 6d 2c 20 61 73 20 77 65 20 64 69 64 20 66 6f 72 0a 65 76 61 6c 75 61 74 6f 72 73 20 69 6e | ism,.as.we.did.for.evaluators.in |
| 129ea0 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 32 3a 3a 2c 20 62 79 20 75 73 69 6e 67 | .section.*Note.4-1-2::,.by.using |
| 129ec0 | 20 73 79 6e 74 61 78 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 0a 65 78 74 72 61 63 74 20 61 6e | .syntax.procedures.to.extract.an |
| 129ee0 | 64 20 63 6c 61 73 73 69 66 79 20 74 68 65 20 70 61 72 74 73 20 6f 66 20 61 6e 20 69 6e 73 74 72 | d.classify.the.parts.of.an.instr |
| 129f00 | 75 63 74 69 6f 6e 2e 0a 0a 60 41 73 73 69 67 6e 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 0a 2e | uction...`Assign'.instructions.. |
| 129f20 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 60 6d 61 6b 65 2d | ......................The.`make- |
| 129f40 | 61 73 73 69 67 6e 27 20 70 72 6f 63 65 64 75 72 65 20 68 61 6e 64 6c 65 73 20 60 61 73 73 69 67 | assign'.procedure.handles.`assig |
| 129f60 | 6e 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | n'.instructions:.......(define.( |
| 129f80 | 6d 61 6b 65 2d 61 73 73 69 67 6e 20 69 6e 73 74 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 | make-assign.inst.machine.labels. |
| 129fa0 | 6f 70 65 72 61 74 69 6f 6e 73 20 70 63 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 61 72 | operations.pc)........(let.((tar |
| 129fc0 | 67 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 20 | get...............(get-register. |
| 129fe0 | 6d 61 63 68 69 6e 65 20 28 61 73 73 69 67 6e 2d 72 65 67 2d 6e 61 6d 65 20 69 6e 73 74 29 29 29 | machine.(assign-reg-name.inst))) |
| 12a000 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 76 61 6c 75 65 2d 65 78 70 20 28 61 73 73 69 67 6e | ..............(value-exp.(assign |
| 12a020 | 2d 76 61 6c 75 65 2d 65 78 70 20 69 6e 73 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 | -value-exp.inst)))..........(let |
| 12a040 | 20 28 28 76 61 6c 75 65 2d 70 72 6f 63 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 | .((value-proc.................(i |
| 12a060 | 66 20 28 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 3f 20 76 61 6c 75 65 2d 65 78 70 29 0a 20 20 20 | f.(operation-exp?.value-exp).... |
| 12a080 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 6f 70 65 72 61 74 69 6f 6e | .................(make-operation |
| 12a0a0 | 2d 65 78 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 76 61 6c 75 65 2d | -exp......................value- |
| 12a0c0 | 65 78 70 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 6f 70 65 72 61 74 69 6f 6e 73 29 0a 20 | exp.machine.labels.operations).. |
| 12a0e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 70 72 69 6d 69 74 69 | ...................(make-primiti |
| 12a100 | 76 65 2d 65 78 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 | ve-exp......................(car |
| 12a120 | 20 76 61 6c 75 65 2d 65 78 70 29 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 29 29 29 29 0a 20 | .value-exp).machine.labels)))).. |
| 12a140 | 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 20 20 20 20 20 20 20 20 20 20 20 | ..........(lambda.()............ |
| 12a160 | 20 20 20 20 3b 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 60 61 | ....;.execution.procedure.for.`a |
| 12a180 | 73 73 69 67 6e 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 6f 6e 74 65 6e 74 | ssign'..............(set-content |
| 12a1a0 | 73 21 20 74 61 72 67 65 74 20 28 76 61 6c 75 65 2d 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 | s!.target.(value-proc))......... |
| 12a1c0 | 20 20 20 20 20 28 61 64 76 61 6e 63 65 2d 70 63 20 70 63 29 29 29 29 29 0a 0a 20 20 20 60 4d 61 | .....(advance-pc.pc))))).....`Ma |
| 12a1e0 | 6b 65 2d 61 73 73 69 67 6e 27 20 65 78 74 72 61 63 74 73 20 74 68 65 20 74 61 72 67 65 74 20 72 | ke-assign'.extracts.the.target.r |
| 12a200 | 65 67 69 73 74 65 72 20 6e 61 6d 65 20 28 74 68 65 20 73 65 63 6f 6e 64 20 65 6c 65 6d 65 6e 74 | egister.name.(the.second.element |
| 12a220 | 0a 6f 66 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 29 20 61 6e 64 20 74 68 65 20 76 61 6c | .of.the.instruction).and.the.val |
| 12a240 | 75 65 20 65 78 70 72 65 73 73 69 6f 6e 20 28 74 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 6c | ue.expression.(the.rest.of.the.l |
| 12a260 | 69 73 74 20 74 68 61 74 0a 66 6f 72 6d 73 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 29 20 | ist.that.forms.the.instruction). |
| 12a280 | 66 72 6f 6d 20 74 68 65 20 60 61 73 73 69 67 6e 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 75 73 | from.the.`assign'.instruction.us |
| 12a2a0 | 69 6e 67 20 74 68 65 20 73 65 6c 65 63 74 6f 72 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ing.the.selectors.......(define. |
| 12a2c0 | 28 61 73 73 69 67 6e 2d 72 65 67 2d 6e 61 6d 65 20 61 73 73 69 67 6e 2d 69 6e 73 74 72 75 63 74 | (assign-reg-name.assign-instruct |
| 12a2e0 | 69 6f 6e 29 0a 20 20 20 20 20 20 20 28 63 61 64 72 20 61 73 73 69 67 6e 2d 69 6e 73 74 72 75 63 | ion)........(cadr.assign-instruc |
| 12a300 | 74 69 6f 6e 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 73 73 69 67 6e 2d 76 61 6c | tion)).......(define.(assign-val |
| 12a320 | 75 65 2d 65 78 70 20 61 73 73 69 67 6e 2d 69 6e 73 74 72 75 63 74 69 6f 6e 29 0a 20 20 20 20 20 | ue-exp.assign-instruction)...... |
| 12a340 | 20 20 28 63 64 64 72 20 61 73 73 69 67 6e 2d 69 6e 73 74 72 75 63 74 69 6f 6e 29 29 0a 0a 20 20 | ..(cddr.assign-instruction)).... |
| 12a360 | 20 54 68 65 20 72 65 67 69 73 74 65 72 20 6e 61 6d 65 20 69 73 20 6c 6f 6f 6b 65 64 20 75 70 20 | .The.register.name.is.looked.up. |
| 12a380 | 77 69 74 68 20 60 67 65 74 2d 72 65 67 69 73 74 65 72 27 20 74 6f 20 70 72 6f 64 75 63 65 20 74 | with.`get-register'.to.produce.t |
| 12a3a0 | 68 65 0a 74 61 72 67 65 74 20 72 65 67 69 73 74 65 72 20 6f 62 6a 65 63 74 2e 20 20 54 68 65 20 | he.target.register.object...The. |
| 12a3c0 | 76 61 6c 75 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 70 61 73 73 65 64 20 74 6f 0a 60 6d | value.expression.is.passed.to.`m |
| 12a3e0 | 61 6b 65 2d 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 27 20 69 66 20 74 68 65 20 76 61 6c 75 65 20 | ake-operation-exp'.if.the.value. |
| 12a400 | 69 73 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 61 6e 20 6f 70 65 72 61 74 69 6f 6e 2c 20 61 | is.the.result.of.an.operation,.a |
| 12a420 | 6e 64 20 74 6f 0a 60 6d 61 6b 65 2d 70 72 69 6d 69 74 69 76 65 2d 65 78 70 27 20 6f 74 68 65 72 | nd.to.`make-primitive-exp'.other |
| 12a440 | 77 69 73 65 2e 20 20 54 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 20 28 73 68 6f 77 6e 20 62 | wise...These.procedures.(shown.b |
| 12a460 | 65 6c 6f 77 29 20 70 61 72 73 65 0a 74 68 65 20 76 61 6c 75 65 20 65 78 70 72 65 73 73 69 6f 6e | elow).parse.the.value.expression |
| 12a480 | 20 61 6e 64 20 70 72 6f 64 75 63 65 20 61 6e 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 | .and.produce.an.execution.proced |
| 12a4a0 | 75 72 65 20 66 6f 72 20 74 68 65 20 76 61 6c 75 65 2e 0a 54 68 69 73 20 69 73 20 61 20 70 72 6f | ure.for.the.value..This.is.a.pro |
| 12a4c0 | 63 65 64 75 72 65 20 6f 66 20 6e 6f 20 61 72 67 75 6d 65 6e 74 73 2c 20 63 61 6c 6c 65 64 20 60 | cedure.of.no.arguments,.called.` |
| 12a4e0 | 76 61 6c 75 65 2d 70 72 6f 63 27 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 62 65 0a 65 76 61 6c 75 | value-proc',.which.will.be.evalu |
| 12a500 | 61 74 65 64 20 64 75 72 69 6e 67 20 74 68 65 20 73 69 6d 75 6c 61 74 69 6f 6e 20 74 6f 20 70 72 | ated.during.the.simulation.to.pr |
| 12a520 | 6f 64 75 63 65 20 74 68 65 20 61 63 74 75 61 6c 20 76 61 6c 75 65 20 74 6f 20 62 65 0a 61 73 73 | oduce.the.actual.value.to.be.ass |
| 12a540 | 69 67 6e 65 64 20 74 6f 20 74 68 65 20 72 65 67 69 73 74 65 72 2e 20 20 4e 6f 74 69 63 65 20 74 | igned.to.the.register...Notice.t |
| 12a560 | 68 61 74 20 74 68 65 20 77 6f 72 6b 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 75 70 20 74 68 65 0a 72 | hat.the.work.of.looking.up.the.r |
| 12a580 | 65 67 69 73 74 65 72 20 6e 61 6d 65 20 61 6e 64 20 70 61 72 73 69 6e 67 20 74 68 65 20 76 61 6c | egister.name.and.parsing.the.val |
| 12a5a0 | 75 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 70 65 72 66 6f 72 6d 65 64 20 6a 75 73 74 20 | ue.expression.is.performed.just. |
| 12a5c0 | 6f 6e 63 65 2c 0a 61 74 20 61 73 73 65 6d 62 6c 79 20 74 69 6d 65 2c 20 6e 6f 74 20 65 76 65 72 | once,.at.assembly.time,.not.ever |
| 12a5e0 | 79 20 74 69 6d 65 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 73 20 73 69 6d 75 6c 61 | y.time.the.instruction.is.simula |
| 12a600 | 74 65 64 2e 20 20 54 68 69 73 0a 73 61 76 69 6e 67 20 6f 66 20 77 6f 72 6b 20 69 73 20 74 68 65 | ted...This.saving.of.work.is.the |
| 12a620 | 20 72 65 61 73 6f 6e 20 77 65 20 75 73 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 | .reason.we.use.execution.procedu |
| 12a640 | 72 65 73 2c 20 61 6e 64 0a 63 6f 72 72 65 73 70 6f 6e 64 73 20 64 69 72 65 63 74 6c 79 20 74 6f | res,.and.corresponds.directly.to |
| 12a660 | 20 74 68 65 20 73 61 76 69 6e 67 20 69 6e 20 77 6f 72 6b 20 77 65 20 6f 62 74 61 69 6e 65 64 20 | .the.saving.in.work.we.obtained. |
| 12a680 | 62 79 20 73 65 70 61 72 61 74 69 6e 67 0a 70 72 6f 67 72 61 6d 20 61 6e 61 6c 79 73 69 73 20 66 | by.separating.program.analysis.f |
| 12a6a0 | 72 6f 6d 20 65 78 65 63 75 74 69 6f 6e 20 69 6e 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6f | rom.execution.in.the.evaluator.o |
| 12a6c0 | 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 34 2d 31 2d 37 3a 3a 2e 0a 0a 20 20 20 54 68 65 | f.section.*Note.4-1-7::......The |
| 12a6e0 | 20 72 65 73 75 6c 74 20 72 65 74 75 72 6e 65 64 20 62 79 20 60 6d 61 6b 65 2d 61 73 73 69 67 6e | .result.returned.by.`make-assign |
| 12a700 | 27 20 69 73 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 | '.is.the.execution.procedure.for |
| 12a720 | 0a 74 68 65 20 60 61 73 73 69 67 6e 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 2e 20 20 57 68 65 6e | .the.`assign'.instruction...When |
| 12a740 | 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 63 61 6c 6c 65 64 20 28 62 79 20 74 68 | .this.procedure.is.called.(by.th |
| 12a760 | 65 20 6d 61 63 68 69 6e 65 0a 6d 6f 64 65 6c 27 73 20 60 65 78 65 63 75 74 65 27 20 70 72 6f 63 | e.machine.model's.`execute'.proc |
| 12a780 | 65 64 75 72 65 29 2c 20 69 74 20 73 65 74 73 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 | edure),.it.sets.the.contents.of. |
| 12a7a0 | 74 68 65 20 74 61 72 67 65 74 0a 72 65 67 69 73 74 65 72 20 74 6f 20 74 68 65 20 72 65 73 75 6c | the.target.register.to.the.resul |
| 12a7c0 | 74 20 6f 62 74 61 69 6e 65 64 20 62 79 20 65 78 65 63 75 74 69 6e 67 20 60 76 61 6c 75 65 2d 70 | t.obtained.by.executing.`value-p |
| 12a7e0 | 72 6f 63 27 2e 20 20 54 68 65 6e 20 69 74 0a 61 64 76 61 6e 63 65 73 20 74 68 65 20 60 70 63 27 | roc'...Then.it.advances.the.`pc' |
| 12a800 | 20 74 6f 20 74 68 65 20 6e 65 78 74 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 62 79 20 72 75 6e 6e | .to.the.next.instruction.by.runn |
| 12a820 | 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ing.the.procedure.......(define. |
| 12a840 | 28 61 64 76 61 6e 63 65 2d 70 63 20 70 63 29 0a 20 20 20 20 20 20 20 28 73 65 74 2d 63 6f 6e 74 | (advance-pc.pc)........(set-cont |
| 12a860 | 65 6e 74 73 21 20 70 63 20 28 63 64 72 20 28 67 65 74 2d 63 6f 6e 74 65 6e 74 73 20 70 63 29 29 | ents!.pc.(cdr.(get-contents.pc)) |
| 12a880 | 29 29 0a 0a 20 20 20 60 41 64 76 61 6e 63 65 2d 70 63 27 20 69 73 20 74 68 65 20 6e 6f 72 6d 61 | )).....`Advance-pc'.is.the.norma |
| 12a8a0 | 6c 20 74 65 72 6d 69 6e 61 74 69 6f 6e 20 66 6f 72 20 61 6c 6c 20 69 6e 73 74 72 75 63 74 69 6f | l.termination.for.all.instructio |
| 12a8c0 | 6e 73 20 65 78 63 65 70 74 0a 60 62 72 61 6e 63 68 27 20 61 6e 64 20 60 67 6f 74 6f 27 2e 0a 0a | ns.except.`branch'.and.`goto'... |
| 12a8e0 | 60 54 65 73 74 27 2c 20 60 62 72 61 6e 63 68 27 2c 20 61 6e 64 20 60 67 6f 74 6f 27 20 69 6e 73 | `Test',.`branch',.and.`goto'.ins |
| 12a900 | 74 72 75 63 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | tructions....................... |
| 12a920 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 60 4d 61 6b 65 2d 74 65 73 74 27 | .....................`Make-test' |
| 12a940 | 20 68 61 6e 64 6c 65 73 20 60 74 65 73 74 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 69 6e 20 | .handles.`test'.instructions.in. |
| 12a960 | 61 20 73 69 6d 69 6c 61 72 20 77 61 79 2e 20 20 49 74 20 65 78 74 72 61 63 74 73 0a 74 68 65 20 | a.similar.way...It.extracts.the. |
| 12a980 | 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 74 68 65 20 63 6f | expression.that.specifies.the.co |
| 12a9a0 | 6e 64 69 74 69 6f 6e 20 74 6f 20 62 65 20 74 65 73 74 65 64 20 61 6e 64 20 67 65 6e 65 72 61 74 | ndition.to.be.tested.and.generat |
| 12a9c0 | 65 73 0a 61 6e 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 69 74 | es.an.execution.procedure.for.it |
| 12a9e0 | 2e 20 20 41 74 20 73 69 6d 75 6c 61 74 69 6f 6e 20 74 69 6d 65 2c 20 74 68 65 20 70 72 6f 63 65 | ...At.simulation.time,.the.proce |
| 12aa00 | 64 75 72 65 20 66 6f 72 0a 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 20 69 73 20 63 61 6c 6c 65 64 | dure.for.the.condition.is.called |
| 12aa20 | 2c 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 73 73 69 67 6e 65 64 20 74 6f 20 74 68 65 20 | ,.the.result.is.assigned.to.the. |
| 12aa40 | 60 66 6c 61 67 27 20 72 65 67 69 73 74 65 72 2c 0a 61 6e 64 20 74 68 65 20 60 70 63 27 20 69 73 | `flag'.register,.and.the.`pc'.is |
| 12aa60 | 20 61 64 76 61 6e 63 65 64 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 74 | .advanced:.......(define.(make-t |
| 12aa80 | 65 73 74 20 69 6e 73 74 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 6f 70 65 72 61 74 69 6f | est.inst.machine.labels.operatio |
| 12aaa0 | 6e 73 20 66 6c 61 67 20 70 63 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 6f 6e 64 69 74 | ns.flag.pc)........(let.((condit |
| 12aac0 | 69 6f 6e 20 28 74 65 73 74 2d 63 6f 6e 64 69 74 69 6f 6e 20 69 6e 73 74 29 29 29 0a 20 20 20 20 | ion.(test-condition.inst)))..... |
| 12aae0 | 20 20 20 20 20 28 69 66 20 28 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 3f 20 63 6f 6e 64 69 74 69 | .....(if.(operation-exp?.conditi |
| 12ab00 | 6f 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 6f 6e 64 69 74 69 6f | on)..............(let.((conditio |
| 12ab20 | 6e 2d 70 72 6f 63 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 | n-proc.....................(make |
| 12ab40 | 2d 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -operation-exp.................. |
| 12ab60 | 20 20 20 20 63 6f 6e 64 69 74 69 6f 6e 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 6f 70 65 | ....condition.machine.labels.ope |
| 12ab80 | 72 61 74 69 6f 6e 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 | rations)))................(lambd |
| 12aba0 | 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 6f 6e 74 65 | a.()..................(set-conte |
| 12abc0 | 6e 74 73 21 20 66 6c 61 67 20 28 63 6f 6e 64 69 74 69 6f 6e 2d 70 72 6f 63 29 29 0a 20 20 20 20 | nts!.flag.(condition-proc))..... |
| 12abe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 76 61 6e 63 65 2d 70 63 20 70 63 29 29 29 0a 20 | .............(advance-pc.pc))).. |
| 12ac00 | 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 42 61 64 20 54 45 53 54 20 69 6e 73 | ............(error."Bad.TEST.ins |
| 12ac20 | 74 72 75 63 74 69 6f 6e 20 2d 2d 20 41 53 53 45 4d 42 4c 45 22 20 69 6e 73 74 29 29 29 29 0a 0a | truction.--.ASSEMBLE".inst)))).. |
| 12ac40 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 74 65 73 74 2d 63 6f 6e 64 69 74 69 6f 6e 20 74 65 73 | .....(define.(test-condition.tes |
| 12ac60 | 74 2d 69 6e 73 74 72 75 63 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 28 63 64 72 20 74 65 73 74 2d | t-instruction)........(cdr.test- |
| 12ac80 | 69 6e 73 74 72 75 63 74 69 6f 6e 29 29 0a 0a 20 20 20 54 68 65 20 65 78 65 63 75 74 69 6f 6e 20 | instruction)).....The.execution. |
| 12aca0 | 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 61 20 60 62 72 61 6e 63 68 27 20 69 6e 73 74 72 75 63 | procedure.for.a.`branch'.instruc |
| 12acc0 | 74 69 6f 6e 20 63 68 65 63 6b 73 20 74 68 65 0a 63 6f 6e 74 65 6e 74 73 20 6f 66 20 74 68 65 20 | tion.checks.the.contents.of.the. |
| 12ace0 | 60 66 6c 61 67 27 20 72 65 67 69 73 74 65 72 20 61 6e 64 20 65 69 74 68 65 72 20 73 65 74 73 20 | `flag'.register.and.either.sets. |
| 12ad00 | 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 74 68 65 0a 60 70 63 27 20 74 6f 20 74 68 65 20 | the.contents.of.the.`pc'.to.the. |
| 12ad20 | 62 72 61 6e 63 68 20 64 65 73 74 69 6e 61 74 69 6f 6e 20 28 69 66 20 74 68 65 20 62 72 61 6e 63 | branch.destination.(if.the.branc |
| 12ad40 | 68 20 69 73 20 74 61 6b 65 6e 29 20 6f 72 20 65 6c 73 65 20 6a 75 73 74 0a 61 64 76 61 6e 63 65 | h.is.taken).or.else.just.advance |
| 12ad60 | 73 20 74 68 65 20 60 70 63 27 20 28 69 66 20 74 68 65 20 62 72 61 6e 63 68 20 69 73 20 6e 6f 74 | s.the.`pc'.(if.the.branch.is.not |
| 12ad80 | 20 74 61 6b 65 6e 29 2e 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 74 68 65 0a 69 6e 64 69 63 61 | .taken)...Notice.that.the.indica |
| 12ada0 | 74 65 64 20 64 65 73 74 69 6e 61 74 69 6f 6e 20 69 6e 20 61 20 60 62 72 61 6e 63 68 27 20 69 6e | ted.destination.in.a.`branch'.in |
| 12adc0 | 73 74 72 75 63 74 69 6f 6e 20 6d 75 73 74 20 62 65 20 61 20 6c 61 62 65 6c 2c 20 61 6e 64 0a 74 | struction.must.be.a.label,.and.t |
| 12ade0 | 68 65 20 60 6d 61 6b 65 2d 62 72 61 6e 63 68 27 20 70 72 6f 63 65 64 75 72 65 20 65 6e 66 6f 72 | he.`make-branch'.procedure.enfor |
| 12ae00 | 63 65 73 20 74 68 69 73 2e 20 20 4e 6f 74 69 63 65 20 61 6c 73 6f 20 74 68 61 74 20 74 68 65 20 | ces.this...Notice.also.that.the. |
| 12ae20 | 6c 61 62 65 6c 0a 69 73 20 6c 6f 6f 6b 65 64 20 75 70 20 61 74 20 61 73 73 65 6d 62 6c 79 20 74 | label.is.looked.up.at.assembly.t |
| 12ae40 | 69 6d 65 2c 20 6e 6f 74 20 65 61 63 68 20 74 69 6d 65 20 74 68 65 20 60 62 72 61 6e 63 68 27 20 | ime,.not.each.time.the.`branch'. |
| 12ae60 | 69 6e 73 74 72 75 63 74 69 6f 6e 0a 69 73 20 73 69 6d 75 6c 61 74 65 64 2e 0a 0a 20 20 20 20 20 | instruction.is.simulated........ |
| 12ae80 | 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 62 72 61 6e 63 68 20 69 6e 73 74 20 6d 61 63 68 69 6e | (define.(make-branch.inst.machin |
| 12aea0 | 65 20 6c 61 62 65 6c 73 20 66 6c 61 67 20 70 63 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 | e.labels.flag.pc)........(let.(( |
| 12aec0 | 64 65 73 74 20 28 62 72 61 6e 63 68 2d 64 65 73 74 20 69 6e 73 74 29 29 29 0a 20 20 20 20 20 20 | dest.(branch-dest.inst)))....... |
| 12aee0 | 20 20 20 28 69 66 20 28 6c 61 62 65 6c 2d 65 78 70 3f 20 64 65 73 74 29 0a 20 20 20 20 20 20 20 | ...(if.(label-exp?.dest)........ |
| 12af00 | 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e 73 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......(let.((insts.............. |
| 12af20 | 20 20 20 20 20 20 20 28 6c 6f 6f 6b 75 70 2d 6c 61 62 65 6c 20 6c 61 62 65 6c 73 20 28 6c 61 62 | .......(lookup-label.labels.(lab |
| 12af40 | 65 6c 2d 65 78 70 2d 6c 61 62 65 6c 20 64 65 73 74 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | el-exp-label.dest))))........... |
| 12af60 | 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....(lambda.()................. |
| 12af80 | 20 28 69 66 20 28 67 65 74 2d 63 6f 6e 74 65 6e 74 73 20 66 6c 61 67 29 0a 20 20 20 20 20 20 20 | .(if.(get-contents.flag)........ |
| 12afa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 6f 6e 74 65 6e 74 73 21 20 70 63 20 | ..............(set-contents!.pc. |
| 12afc0 | 69 6e 73 74 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 64 76 | insts)......................(adv |
| 12afe0 | 61 6e 63 65 2d 70 63 20 70 63 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 | ance-pc.pc))))..............(err |
| 12b000 | 6f 72 20 22 42 61 64 20 42 52 41 4e 43 48 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 2d 2d 20 41 53 | or."Bad.BRANCH.instruction.--.AS |
| 12b020 | 53 45 4d 42 4c 45 22 20 69 6e 73 74 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | SEMBLE".inst)))).......(define.( |
| 12b040 | 62 72 61 6e 63 68 2d 64 65 73 74 20 62 72 61 6e 63 68 2d 69 6e 73 74 72 75 63 74 69 6f 6e 29 0a | branch-dest.branch-instruction). |
| 12b060 | 20 20 20 20 20 20 20 28 63 61 64 72 20 62 72 61 6e 63 68 2d 69 6e 73 74 72 75 63 74 69 6f 6e 29 | .......(cadr.branch-instruction) |
| 12b080 | 29 0a 0a 20 20 20 41 20 60 67 6f 74 6f 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 73 20 73 69 | ).....A.`goto'.instruction.is.si |
| 12b0a0 | 6d 69 6c 61 72 20 74 6f 20 61 20 62 72 61 6e 63 68 2c 20 65 78 63 65 70 74 20 74 68 61 74 20 74 | milar.to.a.branch,.except.that.t |
| 12b0c0 | 68 65 0a 64 65 73 74 69 6e 61 74 69 6f 6e 20 6d 61 79 20 62 65 20 73 70 65 63 69 66 69 65 64 20 | he.destination.may.be.specified. |
| 12b0e0 | 65 69 74 68 65 72 20 61 73 20 61 20 6c 61 62 65 6c 20 6f 72 20 61 73 20 61 20 72 65 67 69 73 74 | either.as.a.label.or.as.a.regist |
| 12b100 | 65 72 2c 20 61 6e 64 0a 74 68 65 72 65 20 69 73 20 6e 6f 20 63 6f 6e 64 69 74 69 6f 6e 20 74 6f | er,.and.there.is.no.condition.to |
| 12b120 | 20 63 68 65 63 6b 2d 2d 74 68 65 20 60 70 63 27 20 69 73 20 61 6c 77 61 79 73 20 73 65 74 20 74 | .check--the.`pc'.is.always.set.t |
| 12b140 | 6f 20 74 68 65 20 6e 65 77 0a 64 65 73 74 69 6e 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 28 64 65 | o.the.new.destination........(de |
| 12b160 | 66 69 6e 65 20 28 6d 61 6b 65 2d 67 6f 74 6f 20 69 6e 73 74 20 6d 61 63 68 69 6e 65 20 6c 61 62 | fine.(make-goto.inst.machine.lab |
| 12b180 | 65 6c 73 20 70 63 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 64 65 73 74 20 28 67 6f 74 6f | els.pc)........(let.((dest.(goto |
| 12b1a0 | 2d 64 65 73 74 20 69 6e 73 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6c | -dest.inst)))..........(cond.((l |
| 12b1c0 | 61 62 65 6c 2d 65 78 70 3f 20 64 65 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | abel-exp?.dest)................. |
| 12b1e0 | 28 6c 65 74 20 28 28 69 6e 73 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (let.((insts.................... |
| 12b200 | 20 20 20 20 28 6c 6f 6f 6b 75 70 2d 6c 61 62 65 6c 20 6c 61 62 65 6c 73 0a 20 20 20 20 20 20 20 | ....(lookup-label.labels........ |
| 12b220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | ..............................(l |
| 12b240 | 61 62 65 6c 2d 65 78 70 2d 6c 61 62 65 6c 20 64 65 73 74 29 29 29 29 0a 20 20 20 20 20 20 20 20 | abel-exp-label.dest))))......... |
| 12b260 | 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 28 73 65 74 2d 63 6f 6e 74 65 6e | ..........(lambda.().(set-conten |
| 12b280 | 74 73 21 20 70 63 20 69 6e 73 74 73 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ts!.pc.insts))))................ |
| 12b2a0 | 28 28 72 65 67 69 73 74 65 72 2d 65 78 70 3f 20 64 65 73 74 29 0a 20 20 20 20 20 20 20 20 20 20 | ((register-exp?.dest)........... |
| 12b2c0 | 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......(let.((reg................ |
| 12b2e0 | 20 20 20 20 20 20 20 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 0a 20 20 | ........(get-register.machine... |
| 12b300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 12b320 | 20 20 20 28 72 65 67 69 73 74 65 72 2d 65 78 70 2d 72 65 67 20 64 65 73 74 29 29 29 29 0a 20 20 | ...(register-exp-reg.dest))))... |
| 12b340 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 | ................(lambda.()...... |
| 12b360 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 6f 6e 74 65 6e 74 73 21 20 70 63 | ...............(set-contents!.pc |
| 12b380 | 20 28 67 65 74 2d 63 6f 6e 74 65 6e 74 73 20 72 65 67 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 | .(get-contents.reg)))))......... |
| 12b3a0 | 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 65 72 72 6f 72 20 22 42 61 64 20 47 4f 54 4f 20 69 6e | .......(else.(error."Bad.GOTO.in |
| 12b3c0 | 73 74 72 75 63 74 69 6f 6e 20 2d 2d 20 41 53 53 45 4d 42 4c 45 22 0a 20 20 20 20 20 20 20 20 20 | struction.--.ASSEMBLE".......... |
| 12b3e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 73 74 29 29 29 29 29 0a 0a 20 20 | ...................inst))))).... |
| 12b400 | 20 20 20 28 64 65 66 69 6e 65 20 28 67 6f 74 6f 2d 64 65 73 74 20 67 6f 74 6f 2d 69 6e 73 74 72 | ...(define.(goto-dest.goto-instr |
| 12b420 | 75 63 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 28 63 61 64 72 20 67 6f 74 6f 2d 69 6e 73 74 72 75 | uction)........(cadr.goto-instru |
| 12b440 | 63 74 69 6f 6e 29 29 0a 0a 4f 74 68 65 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 0a 2e 2e 2e 2e | ction))..Other.instructions..... |
| 12b460 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 73 74 61 63 6b 20 69 6e 73 74 72 75 | ................The.stack.instru |
| 12b480 | 63 74 69 6f 6e 73 20 60 73 61 76 65 27 20 61 6e 64 20 60 72 65 73 74 6f 72 65 27 20 73 69 6d 70 | ctions.`save'.and.`restore'.simp |
| 12b4a0 | 6c 79 20 75 73 65 20 74 68 65 20 73 74 61 63 6b 20 77 69 74 68 0a 74 68 65 20 64 65 73 69 67 6e | ly.use.the.stack.with.the.design |
| 12b4c0 | 61 74 65 64 20 72 65 67 69 73 74 65 72 20 61 6e 64 20 61 64 76 61 6e 63 65 20 74 68 65 20 60 70 | ated.register.and.advance.the.`p |
| 12b4e0 | 63 27 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 73 61 76 65 20 69 6e 73 | c':.......(define.(make-save.ins |
| 12b500 | 74 20 6d 61 63 68 69 6e 65 20 73 74 61 63 6b 20 70 63 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 | t.machine.stack.pc)........(let. |
| 12b520 | 28 28 72 65 67 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 | ((reg.(get-register.machine..... |
| 12b540 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 61 | ............................(sta |
| 12b560 | 63 6b 2d 69 6e 73 74 2d 72 65 67 2d 6e 61 6d 65 20 69 6e 73 74 29 29 29 29 0a 20 20 20 20 20 20 | ck-inst-reg-name.inst))))....... |
| 12b580 | 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 70 75 73 68 20 73 | ...(lambda.()............(push.s |
| 12b5a0 | 74 61 63 6b 20 28 67 65 74 2d 63 6f 6e 74 65 6e 74 73 20 72 65 67 29 29 0a 20 20 20 20 20 20 20 | tack.(get-contents.reg))........ |
| 12b5c0 | 20 20 20 20 28 61 64 76 61 6e 63 65 2d 70 63 20 70 63 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 | ....(advance-pc.pc)))).......(de |
| 12b5e0 | 66 69 6e 65 20 28 6d 61 6b 65 2d 72 65 73 74 6f 72 65 20 69 6e 73 74 20 6d 61 63 68 69 6e 65 20 | fine.(make-restore.inst.machine. |
| 12b600 | 73 74 61 63 6b 20 70 63 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 72 65 67 20 28 67 65 74 | stack.pc)........(let.((reg.(get |
| 12b620 | 2d 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -register.machine............... |
| 12b640 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 74 61 63 6b 2d 69 6e 73 74 2d 72 65 | ..................(stack-inst-re |
| 12b660 | 67 2d 6e 61 6d 65 20 69 6e 73 74 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 | g-name.inst))))..........(lambda |
| 12b680 | 20 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 63 6f 6e 74 65 6e 74 73 21 20 72 65 | .()............(set-contents!.re |
| 12b6a0 | 67 20 28 70 6f 70 20 73 74 61 63 6b 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 64 76 61 6e | g.(pop.stack))............(advan |
| 12b6c0 | 63 65 2d 70 63 20 70 63 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 61 63 | ce-pc.pc)))).......(define.(stac |
| 12b6e0 | 6b 2d 69 6e 73 74 2d 72 65 67 2d 6e 61 6d 65 20 73 74 61 63 6b 2d 69 6e 73 74 72 75 63 74 69 6f | k-inst-reg-name.stack-instructio |
| 12b700 | 6e 29 0a 20 20 20 20 20 20 20 28 63 61 64 72 20 73 74 61 63 6b 2d 69 6e 73 74 72 75 63 74 69 6f | n)........(cadr.stack-instructio |
| 12b720 | 6e 29 29 0a 0a 20 20 20 54 68 65 20 66 69 6e 61 6c 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 74 79 | n)).....The.final.instruction.ty |
| 12b740 | 70 65 2c 20 68 61 6e 64 6c 65 64 20 62 79 20 60 6d 61 6b 65 2d 70 65 72 66 6f 72 6d 27 2c 20 67 | pe,.handled.by.`make-perform',.g |
| 12b760 | 65 6e 65 72 61 74 65 73 20 61 6e 0a 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 | enerates.an.execution.procedure. |
| 12b780 | 66 6f 72 20 74 68 65 20 61 63 74 69 6f 6e 20 74 6f 20 62 65 20 70 65 72 66 6f 72 6d 65 64 2e 20 | for.the.action.to.be.performed.. |
| 12b7a0 | 20 41 74 20 73 69 6d 75 6c 61 74 69 6f 6e 0a 74 69 6d 65 2c 20 74 68 65 20 61 63 74 69 6f 6e 20 | .At.simulation.time,.the.action. |
| 12b7c0 | 70 72 6f 63 65 64 75 72 65 20 69 73 20 65 78 65 63 75 74 65 64 20 61 6e 64 20 74 68 65 20 60 70 | procedure.is.executed.and.the.`p |
| 12b7e0 | 63 27 20 61 64 76 61 6e 63 65 64 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 | c'.advanced........(define.(make |
| 12b800 | 2d 70 65 72 66 6f 72 6d 20 69 6e 73 74 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 6f 70 65 | -perform.inst.machine.labels.ope |
| 12b820 | 72 61 74 69 6f 6e 73 20 70 63 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 61 63 74 69 6f 6e | rations.pc)........(let.((action |
| 12b840 | 20 28 70 65 72 66 6f 72 6d 2d 61 63 74 69 6f 6e 20 69 6e 73 74 29 29 29 0a 20 20 20 20 20 20 20 | .(perform-action.inst)))........ |
| 12b860 | 20 20 28 69 66 20 28 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 3f 20 61 63 74 69 6f 6e 29 0a 20 20 | ..(if.(operation-exp?.action)... |
| 12b880 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 61 63 74 69 6f 6e 2d 70 72 6f 63 0a 20 20 | ...........(let.((action-proc... |
| 12b8a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 6f 70 65 72 61 74 69 6f | ..................(make-operatio |
| 12b8c0 | 6e 2d 65 78 70 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 63 74 69 6f | n-exp......................actio |
| 12b8e0 | 6e 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 6f 70 65 72 61 74 69 6f 6e 73 29 29 29 0a 20 | n.machine.labels.operations))).. |
| 12b900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 20 | ..............(lambda.()........ |
| 12b920 | 20 20 20 20 20 20 20 20 20 20 28 61 63 74 69 6f 6e 2d 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 | ..........(action-proc)......... |
| 12b940 | 20 20 20 20 20 20 20 20 20 28 61 64 76 61 6e 63 65 2d 70 63 20 70 63 29 29 29 0a 20 20 20 20 20 | .........(advance-pc.pc)))...... |
| 12b960 | 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 42 61 64 20 50 45 52 46 4f 52 4d 20 69 6e 73 74 | ........(error."Bad.PERFORM.inst |
| 12b980 | 72 75 63 74 69 6f 6e 20 2d 2d 20 41 53 53 45 4d 42 4c 45 22 20 69 6e 73 74 29 29 29 29 0a 0a 20 | ruction.--.ASSEMBLE".inst))))... |
| 12b9a0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 65 72 66 6f 72 6d 2d 61 63 74 69 6f 6e 20 69 6e 73 74 | ....(define.(perform-action.inst |
| 12b9c0 | 29 20 28 63 64 72 20 69 6e 73 74 29 29 0a 0a 45 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 | ).(cdr.inst))..Execution.procedu |
| 12b9e0 | 72 65 73 20 66 6f 72 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e | res.for.subexpressions.......... |
| 12ba00 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | ................................ |
| 12ba20 | 54 68 65 20 76 61 6c 75 65 20 6f 66 20 61 20 60 72 65 67 27 2c 20 60 6c 61 62 65 6c 27 2c 20 6f | The.value.of.a.`reg',.`label',.o |
| 12ba40 | 72 20 60 63 6f 6e 73 74 27 20 65 78 70 72 65 73 73 69 6f 6e 20 6d 61 79 20 62 65 20 6e 65 65 64 | r.`const'.expression.may.be.need |
| 12ba60 | 65 64 20 66 6f 72 0a 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 20 61 20 72 65 67 69 73 74 65 72 20 | ed.for.assignment.to.a.register. |
| 12ba80 | 28 60 6d 61 6b 65 2d 61 73 73 69 67 6e 27 29 20 6f 72 20 66 6f 72 20 69 6e 70 75 74 20 74 6f 20 | (`make-assign').or.for.input.to. |
| 12baa0 | 61 6e 20 6f 70 65 72 61 74 69 6f 6e 0a 28 60 6d 61 6b 65 2d 6f 70 65 72 61 74 69 6f 6e 2d 65 78 | an.operation.(`make-operation-ex |
| 12bac0 | 70 27 2c 20 62 65 6c 6f 77 29 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 | p',.below)...The.following.proce |
| 12bae0 | 64 75 72 65 20 67 65 6e 65 72 61 74 65 73 0a 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 | dure.generates.execution.procedu |
| 12bb00 | 72 65 73 20 74 6f 20 70 72 6f 64 75 63 65 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 73 65 20 | res.to.produce.values.for.these. |
| 12bb20 | 65 78 70 72 65 73 73 69 6f 6e 73 20 64 75 72 69 6e 67 20 74 68 65 0a 73 69 6d 75 6c 61 74 69 6f | expressions.during.the.simulatio |
| 12bb40 | 6e 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 70 72 69 6d 69 74 69 76 65 | n:.......(define.(make-primitive |
| 12bb60 | 2d 65 78 70 20 65 78 70 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 29 0a 20 20 20 20 20 20 20 | -exp.exp.machine.labels)........ |
| 12bb80 | 28 63 6f 6e 64 20 28 28 63 6f 6e 73 74 61 6e 74 2d 65 78 70 3f 20 65 78 70 29 0a 20 20 20 20 20 | (cond.((constant-exp?.exp)...... |
| 12bba0 | 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 20 28 63 6f 6e 73 74 61 6e 74 2d 65 78 70 2d | .........(let.((c.(constant-exp- |
| 12bbc0 | 76 61 6c 75 65 20 65 78 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 | value.exp))).................(la |
| 12bbe0 | 6d 62 64 61 20 28 29 20 63 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6c 61 62 65 | mbda.().c)))..............((labe |
| 12bc00 | 6c 2d 65 78 70 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 | l-exp?.exp)...............(let.( |
| 12bc20 | 28 69 6e 73 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 6f 6f | (insts......................(loo |
| 12bc40 | 6b 75 70 2d 6c 61 62 65 6c 20 6c 61 62 65 6c 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | kup-label.labels................ |
| 12bc60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 62 65 6c 2d 65 78 70 2d 6c | ....................(label-exp-l |
| 12bc80 | 61 62 65 6c 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 | abel.exp)))).................(la |
| 12bca0 | 6d 62 64 61 20 28 29 20 69 6e 73 74 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 | mbda.().insts)))..............(( |
| 12bcc0 | 72 65 67 69 73 74 65 72 2d 65 78 70 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | register-exp?.exp).............. |
| 12bce0 | 20 28 6c 65 74 20 28 28 72 20 28 67 65 74 2d 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 0a | .(let.((r.(get-register.machine. |
| 12bd00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 12bd20 | 20 20 20 20 20 28 72 65 67 69 73 74 65 72 2d 65 78 70 2d 72 65 67 20 65 78 70 29 29 29 29 0a 20 | .....(register-exp-reg.exp)))).. |
| 12bd40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 28 67 65 74 2d 63 | ...............(lambda.().(get-c |
| 12bd60 | 6f 6e 74 65 6e 74 73 20 72 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 | ontents.r))))..............(else |
| 12bd80 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 65 | ...............(error."Unknown.e |
| 12bda0 | 78 70 72 65 73 73 69 6f 6e 20 74 79 70 65 20 2d 2d 20 41 53 53 45 4d 42 4c 45 22 20 65 78 70 29 | xpression.type.--.ASSEMBLE".exp) |
| 12bdc0 | 29 29 29 0a 0a 20 20 20 54 68 65 20 73 79 6e 74 61 78 20 6f 66 20 60 72 65 67 27 2c 20 60 6c 61 | ))).....The.syntax.of.`reg',.`la |
| 12bde0 | 62 65 6c 27 2c 20 61 6e 64 20 60 63 6f 6e 73 74 27 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 73 | bel',.and.`const'.expressions.is |
| 12be00 | 20 64 65 74 65 72 6d 69 6e 65 64 0a 62 79 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 | .determined.by.......(define.(re |
| 12be20 | 67 69 73 74 65 72 2d 65 78 70 3f 20 65 78 70 29 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 65 | gister-exp?.exp).(tagged-list?.e |
| 12be40 | 78 70 20 27 72 65 67 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 67 69 73 74 65 | xp.'reg)).......(define.(registe |
| 12be60 | 72 2d 65 78 70 2d 72 65 67 20 65 78 70 29 20 28 63 61 64 72 20 65 78 70 29 29 0a 0a 20 20 20 20 | r-exp-reg.exp).(cadr.exp))...... |
| 12be80 | 20 28 64 65 66 69 6e 65 20 28 63 6f 6e 73 74 61 6e 74 2d 65 78 70 3f 20 65 78 70 29 20 28 74 61 | .(define.(constant-exp?.exp).(ta |
| 12bea0 | 67 67 65 64 2d 6c 69 73 74 3f 20 65 78 70 20 27 63 6f 6e 73 74 29 29 0a 0a 20 20 20 20 20 28 64 | gged-list?.exp.'const)).......(d |
| 12bec0 | 65 66 69 6e 65 20 28 63 6f 6e 73 74 61 6e 74 2d 65 78 70 2d 76 61 6c 75 65 20 65 78 70 29 20 28 | efine.(constant-exp-value.exp).( |
| 12bee0 | 63 61 64 72 20 65 78 70 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 61 62 65 6c 2d | cadr.exp)).......(define.(label- |
| 12bf00 | 65 78 70 3f 20 65 78 70 29 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 65 78 70 20 27 6c 61 62 | exp?.exp).(tagged-list?.exp.'lab |
| 12bf20 | 65 6c 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 61 62 65 6c 2d 65 78 70 2d 6c 61 | el)).......(define.(label-exp-la |
| 12bf40 | 62 65 6c 20 65 78 70 29 20 28 63 61 64 72 20 65 78 70 29 29 0a 0a 20 20 20 60 41 73 73 69 67 6e | bel.exp).(cadr.exp)).....`Assign |
| 12bf60 | 27 2c 20 60 70 65 72 66 6f 72 6d 27 2c 20 61 6e 64 20 60 74 65 73 74 27 20 69 6e 73 74 72 75 63 | ',.`perform',.and.`test'.instruc |
| 12bf80 | 74 69 6f 6e 73 20 6d 61 79 20 69 6e 63 6c 75 64 65 20 74 68 65 0a 61 70 70 6c 69 63 61 74 69 6f | tions.may.include.the.applicatio |
| 12bfa0 | 6e 20 6f 66 20 61 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 20 28 73 70 65 63 69 66 | n.of.a.machine.operation.(specif |
| 12bfc0 | 69 65 64 20 62 79 20 61 6e 20 60 6f 70 27 20 65 78 70 72 65 73 73 69 6f 6e 29 20 74 6f 0a 73 6f | ied.by.an.`op'.expression).to.so |
| 12bfe0 | 6d 65 20 6f 70 65 72 61 6e 64 73 20 28 73 70 65 63 69 66 69 65 64 20 62 79 20 60 72 65 67 27 20 | me.operands.(specified.by.`reg'. |
| 12c000 | 61 6e 64 20 60 63 6f 6e 73 74 27 20 65 78 70 72 65 73 73 69 6f 6e 73 29 2e 20 20 54 68 65 0a 66 | and.`const'.expressions)...The.f |
| 12c020 | 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 70 72 6f 64 75 63 65 73 20 61 6e 20 65 | ollowing.procedure.produces.an.e |
| 12c040 | 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 61 6e 20 22 6f 70 65 72 61 | xecution.procedure.for.an."opera |
| 12c060 | 74 69 6f 6e 0a 65 78 70 72 65 73 73 69 6f 6e 22 2d 2d 61 20 6c 69 73 74 20 63 6f 6e 74 61 69 6e | tion.expression"--a.list.contain |
| 12c080 | 69 6e 67 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 61 6e 64 20 6f 70 65 72 61 6e 64 20 65 78 | ing.the.operation.and.operand.ex |
| 12c0a0 | 70 72 65 73 73 69 6f 6e 73 0a 66 72 6f 6d 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 3a 0a | pressions.from.the.instruction:. |
| 12c0c0 | 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 6f 70 65 72 61 74 69 6f 6e 2d 65 78 | ......(define.(make-operation-ex |
| 12c0e0 | 70 20 65 78 70 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 20 6f 70 65 72 61 74 69 6f 6e 73 29 | p.exp.machine.labels.operations) |
| 12c100 | 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6f 70 20 28 6c 6f 6f 6b 75 70 2d 70 72 69 6d 20 28 | ........(let.((op.(lookup-prim.( |
| 12c120 | 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 2d 6f 70 20 65 78 70 29 20 6f 70 65 72 61 74 69 6f 6e 73 | operation-exp-op.exp).operations |
| 12c140 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 72 6f 63 73 0a 20 20 20 20 20 20 20 20 | ))..............(aprocs......... |
| 12c160 | 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 65 29 0a 20 20 20 20 20 20 20 20 20 | ......(map.(lambda.(e).......... |
| 12c180 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 70 72 69 6d 69 74 69 76 65 2d 65 78 70 20 | ............(make-primitive-exp. |
| 12c1a0 | 65 20 6d 61 63 68 69 6e 65 20 6c 61 62 65 6c 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | e.machine.labels)).............. |
| 12c1c0 | 20 20 20 20 20 20 28 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 2d 6f 70 65 72 61 6e 64 73 20 65 78 | ......(operation-exp-operands.ex |
| 12c1e0 | 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 0a 20 20 20 20 20 20 | p))))..........(lambda.()....... |
| 12c200 | 20 20 20 20 20 28 61 70 70 6c 79 20 6f 70 20 28 6d 61 70 20 28 6c 61 6d 62 64 61 20 28 70 29 20 | .....(apply.op.(map.(lambda.(p). |
| 12c220 | 28 70 29 29 20 61 70 72 6f 63 73 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 73 79 6e 74 61 78 20 | (p)).aprocs))))).....The.syntax. |
| 12c240 | 6f 66 20 6f 70 65 72 61 74 69 6f 6e 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 73 20 64 65 74 65 | of.operation.expressions.is.dete |
| 12c260 | 72 6d 69 6e 65 64 20 62 79 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6f 70 65 72 61 74 69 | rmined.by.......(define.(operati |
| 12c280 | 6f 6e 2d 65 78 70 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 61 6e 64 20 28 70 61 69 72 3f 20 | on-exp?.exp)........(and.(pair?. |
| 12c2a0 | 65 78 70 29 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 28 63 61 72 20 65 78 70 29 20 27 6f 70 | exp).(tagged-list?.(car.exp).'op |
| 12c2c0 | 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 | ))).......(define.(operation-exp |
| 12c2e0 | 2d 6f 70 20 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 29 0a 20 20 20 20 20 20 20 28 63 61 64 72 20 | -op.operation-exp)........(cadr. |
| 12c300 | 28 63 61 72 20 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 | (car.operation-exp))).......(def |
| 12c320 | 69 6e 65 20 28 6f 70 65 72 61 74 69 6f 6e 2d 65 78 70 2d 6f 70 65 72 61 6e 64 73 20 6f 70 65 72 | ine.(operation-exp-operands.oper |
| 12c340 | 61 74 69 6f 6e 2d 65 78 70 29 0a 20 20 20 20 20 20 20 28 63 64 72 20 6f 70 65 72 61 74 69 6f 6e | ation-exp)........(cdr.operation |
| 12c360 | 2d 65 78 70 29 29 0a 0a 20 20 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 74 68 65 20 74 72 65 61 | -exp)).....Observe.that.the.trea |
| 12c380 | 74 6d 65 6e 74 20 6f 66 20 6f 70 65 72 61 74 69 6f 6e 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 | tment.of.operation.expressions.i |
| 12c3a0 | 73 20 76 65 72 79 20 6d 75 63 68 0a 6c 69 6b 65 20 74 68 65 20 74 72 65 61 74 6d 65 6e 74 20 6f | s.very.much.like.the.treatment.o |
| 12c3c0 | 66 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 62 79 20 74 68 65 0a | f.procedure.applications.by.the. |
| 12c3e0 | 60 61 6e 61 6c 79 7a 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 27 20 70 72 6f 63 65 64 75 72 65 20 | `analyze-application'.procedure. |
| 12c400 | 69 6e 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 | in.the.evaluator.of.section.*Not |
| 12c420 | 65 0a 34 2d 31 2d 37 3a 3a 20 69 6e 20 74 68 61 74 20 77 65 20 67 65 6e 65 72 61 74 65 20 61 6e | e.4-1-7::.in.that.we.generate.an |
| 12c440 | 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 65 61 63 68 20 6f 70 | .execution.procedure.for.each.op |
| 12c460 | 65 72 61 6e 64 2e 0a 41 74 20 73 69 6d 75 6c 61 74 69 6f 6e 20 74 69 6d 65 2c 20 77 65 20 63 61 | erand..At.simulation.time,.we.ca |
| 12c480 | 6c 6c 20 74 68 65 20 6f 70 65 72 61 6e 64 20 70 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 61 70 | ll.the.operand.procedures.and.ap |
| 12c4a0 | 70 6c 79 20 74 68 65 20 53 63 68 65 6d 65 0a 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 73 69 | ply.the.Scheme.procedure.that.si |
| 12c4c0 | 6d 75 6c 61 74 65 73 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 74 6f 20 74 68 65 20 72 65 73 | mulates.the.operation.to.the.res |
| 12c4e0 | 75 6c 74 69 6e 67 20 76 61 6c 75 65 73 2e 20 20 54 68 65 0a 73 69 6d 75 6c 61 74 69 6f 6e 20 70 | ulting.values...The.simulation.p |
| 12c500 | 72 6f 63 65 64 75 72 65 20 69 73 20 66 6f 75 6e 64 20 62 79 20 6c 6f 6f 6b 69 6e 67 20 75 70 20 | rocedure.is.found.by.looking.up. |
| 12c520 | 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 6e 61 6d 65 20 69 6e 20 74 68 65 0a 6f 70 65 72 61 74 | the.operation.name.in.the.operat |
| 12c540 | 69 6f 6e 20 74 61 62 6c 65 20 66 6f 72 20 74 68 65 20 6d 61 63 68 69 6e 65 3a 0a 0a 20 20 20 20 | ion.table.for.the.machine:...... |
| 12c560 | 20 28 64 65 66 69 6e 65 20 28 6c 6f 6f 6b 75 70 2d 70 72 69 6d 20 73 79 6d 62 6f 6c 20 6f 70 65 | .(define.(lookup-prim.symbol.ope |
| 12c580 | 72 61 74 69 6f 6e 73 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 76 61 6c 20 28 61 73 73 6f | rations)........(let.((val.(asso |
| 12c5a0 | 63 20 73 79 6d 62 6f 6c 20 6f 70 65 72 61 74 69 6f 6e 73 29 29 29 0a 20 20 20 20 20 20 20 20 20 | c.symbol.operations))).......... |
| 12c5c0 | 28 69 66 20 76 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 61 64 72 20 76 61 6c 29 0a | (if.val..............(cadr.val). |
| 12c5e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 6f 70 65 | .............(error."Unknown.ope |
| 12c600 | 72 61 74 69 6f 6e 20 2d 2d 20 41 53 53 45 4d 42 4c 45 22 20 73 79 6d 62 6f 6c 29 29 29 29 0a 0a | ration.--.ASSEMBLE".symbol)))).. |
| 12c620 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 39 3a 2a 20 54 68 65 20 74 72 65 61 74 6d 65 | .....*Exercise.5.9:*.The.treatme |
| 12c640 | 6e 74 20 6f 66 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 62 6f 76 65 20 70 | nt.of.machine.operations.above.p |
| 12c660 | 65 72 6d 69 74 73 0a 20 20 20 20 20 74 68 65 6d 20 74 6f 20 6f 70 65 72 61 74 65 20 6f 6e 20 6c | ermits......them.to.operate.on.l |
| 12c680 | 61 62 65 6c 73 20 61 73 20 77 65 6c 6c 20 61 73 20 6f 6e 20 63 6f 6e 73 74 61 6e 74 73 20 61 6e | abels.as.well.as.on.constants.an |
| 12c6a0 | 64 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 0a 20 20 20 20 20 6f 66 20 72 65 67 69 73 74 65 72 73 | d.the.contents......of.registers |
| 12c6c0 | 2e 20 20 4d 6f 64 69 66 79 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2d 70 72 6f 63 65 73 73 | ...Modify.the.expression-process |
| 12c6e0 | 69 6e 67 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 0a 20 20 20 20 20 65 6e 66 6f 72 63 65 20 74 | ing.procedures.to......enforce.t |
| 12c700 | 68 65 20 63 6f 6e 64 69 74 69 6f 6e 20 74 68 61 74 20 6f 70 65 72 61 74 69 6f 6e 73 20 63 61 6e | he.condition.that.operations.can |
| 12c720 | 20 62 65 20 75 73 65 64 20 6f 6e 6c 79 20 77 69 74 68 0a 20 20 20 20 20 72 65 67 69 73 74 65 72 | .be.used.only.with......register |
| 12c740 | 73 20 61 6e 64 20 63 6f 6e 73 74 61 6e 74 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | s.and.constants........*Exercise |
| 12c760 | 20 35 2e 31 30 3a 2a 20 44 65 73 69 67 6e 20 61 20 6e 65 77 20 73 79 6e 74 61 78 20 66 6f 72 20 | .5.10:*.Design.a.new.syntax.for. |
| 12c780 | 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 69 6e 73 74 72 75 63 74 69 6f | register-machine......instructio |
| 12c7a0 | 6e 73 20 61 6e 64 20 6d 6f 64 69 66 79 20 74 68 65 20 73 69 6d 75 6c 61 74 6f 72 20 74 6f 20 75 | ns.and.modify.the.simulator.to.u |
| 12c7c0 | 73 65 20 79 6f 75 72 20 6e 65 77 20 73 79 6e 74 61 78 2e 20 20 43 61 6e 0a 20 20 20 20 20 79 6f | se.your.new.syntax...Can......yo |
| 12c7e0 | 75 20 69 6d 70 6c 65 6d 65 6e 74 20 79 6f 75 72 20 6e 65 77 20 73 79 6e 74 61 78 20 77 69 74 68 | u.implement.your.new.syntax.with |
| 12c800 | 6f 75 74 20 63 68 61 6e 67 69 6e 67 20 61 6e 79 20 70 61 72 74 20 6f 66 20 74 68 65 0a 20 20 20 | out.changing.any.part.of.the.... |
| 12c820 | 20 20 73 69 6d 75 6c 61 74 6f 72 20 65 78 63 65 70 74 20 74 68 65 20 73 79 6e 74 61 78 20 70 72 | ..simulator.except.the.syntax.pr |
| 12c840 | 6f 63 65 64 75 72 65 73 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 3f 0a 0a 20 20 20 20 20 | ocedures.in.this.section?....... |
| 12c860 | 2a 45 78 65 72 63 69 73 65 20 35 2e 31 31 3a 2a 20 57 68 65 6e 20 77 65 20 69 6e 74 72 6f 64 75 | *Exercise.5.11:*.When.we.introdu |
| 12c880 | 63 65 64 20 60 73 61 76 65 27 20 61 6e 64 20 60 72 65 73 74 6f 72 65 27 20 69 6e 0a 20 20 20 20 | ced.`save'.and.`restore'.in..... |
| 12c8a0 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 31 2d 34 3a 3a 2c 20 77 65 20 64 69 64 6e 27 | .section.*Note.5-1-4::,.we.didn' |
| 12c8c0 | 74 20 73 70 65 63 69 66 79 20 77 68 61 74 20 77 6f 75 6c 64 20 68 61 70 70 65 6e 20 69 66 20 79 | t.specify.what.would.happen.if.y |
| 12c8e0 | 6f 75 0a 20 20 20 20 20 74 72 69 65 64 20 74 6f 20 72 65 73 74 6f 72 65 20 61 20 72 65 67 69 73 | ou......tried.to.restore.a.regis |
| 12c900 | 74 65 72 20 74 68 61 74 20 77 61 73 20 6e 6f 74 20 74 68 65 20 6c 61 73 74 20 6f 6e 65 20 73 61 | ter.that.was.not.the.last.one.sa |
| 12c920 | 76 65 64 2c 20 61 73 20 69 6e 0a 20 20 20 20 20 74 68 65 20 73 65 71 75 65 6e 63 65 0a 0a 20 20 | ved,.as.in......the.sequence.... |
| 12c940 | 20 20 20 20 20 20 20 20 28 73 61 76 65 20 79 29 0a 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 | ........(save.y)...........(save |
| 12c960 | 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 79 29 0a 0a 20 20 20 20 20 | .x)...........(restore.y)....... |
| 12c980 | 54 68 65 72 65 20 61 72 65 20 73 65 76 65 72 61 6c 20 72 65 61 73 6f 6e 61 62 6c 65 20 70 6f 73 | There.are.several.reasonable.pos |
| 12c9a0 | 73 69 62 69 6c 69 74 69 65 73 20 66 6f 72 20 74 68 65 20 6d 65 61 6e 69 6e 67 20 6f 66 0a 20 20 | sibilities.for.the.meaning.of... |
| 12c9c0 | 20 20 20 60 72 65 73 74 6f 72 65 27 3a 0a 0a 20 20 20 20 20 20 20 61 2e 20 60 28 72 65 73 74 6f | ...`restore':.........a..`(resto |
| 12c9e0 | 72 65 20 79 29 27 20 70 75 74 73 20 69 6e 74 6f 20 60 79 27 20 74 68 65 20 6c 61 73 74 20 76 61 | re.y)'.puts.into.`y'.the.last.va |
| 12ca00 | 6c 75 65 20 73 61 76 65 64 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 2c 0a 20 20 20 20 20 20 20 20 | lue.saved.on.the.stack,......... |
| 12ca20 | 20 20 72 65 67 61 72 64 6c 65 73 73 20 6f 66 20 77 68 61 74 20 72 65 67 69 73 74 65 72 20 74 68 | ..regardless.of.what.register.th |
| 12ca40 | 61 74 20 76 61 6c 75 65 20 63 61 6d 65 20 66 72 6f 6d 2e 20 20 54 68 69 73 20 69 73 0a 20 20 20 | at.value.came.from...This.is.... |
| 12ca60 | 20 20 20 20 20 20 20 74 68 65 20 77 61 79 20 6f 75 72 20 73 69 6d 75 6c 61 74 6f 72 20 62 65 68 | .......the.way.our.simulator.beh |
| 12ca80 | 61 76 65 73 2e 20 20 53 68 6f 77 20 68 6f 77 20 74 6f 20 74 61 6b 65 20 61 64 76 61 6e 74 61 67 | aves...Show.how.to.take.advantag |
| 12caa0 | 65 20 6f 66 0a 20 20 20 20 20 20 20 20 20 20 74 68 69 73 20 62 65 68 61 76 69 6f 72 20 74 6f 20 | e.of...........this.behavior.to. |
| 12cac0 | 65 6c 69 6d 69 6e 61 74 65 20 6f 6e 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 66 72 6f 6d 20 74 | eliminate.one.instruction.from.t |
| 12cae0 | 68 65 20 46 69 62 6f 6e 61 63 63 69 0a 20 20 20 20 20 20 20 20 20 20 6d 61 63 68 69 6e 65 20 6f | he.Fibonacci...........machine.o |
| 12cb00 | 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 31 2d 34 3a 3a 20 28 2a 4e 6f 74 65 20 46 | f.section.*Note.5-1-4::.(*Note.F |
| 12cb20 | 69 67 75 72 65 20 35 2d 31 32 3a 3a 29 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 60 28 72 65 73 74 | igure.5-12::)..........b..`(rest |
| 12cb40 | 6f 72 65 20 79 29 27 20 70 75 74 73 20 69 6e 74 6f 20 60 79 27 20 74 68 65 20 6c 61 73 74 20 76 | ore.y)'.puts.into.`y'.the.last.v |
| 12cb60 | 61 6c 75 65 20 73 61 76 65 64 20 6f 6e 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 73 74 61 63 | alue.saved.on.the...........stac |
| 12cb80 | 6b 2c 20 62 75 74 20 6f 6e 6c 79 20 69 66 20 74 68 61 74 20 76 61 6c 75 65 20 77 61 73 20 73 61 | k,.but.only.if.that.value.was.sa |
| 12cba0 | 76 65 64 20 66 72 6f 6d 20 60 79 27 3b 20 6f 74 68 65 72 77 69 73 65 2c 0a 20 20 20 20 20 20 20 | ved.from.`y';.otherwise,........ |
| 12cbc0 | 20 20 20 69 74 20 73 69 67 6e 61 6c 73 20 61 6e 20 65 72 72 6f 72 2e 20 20 4d 6f 64 69 66 79 20 | ...it.signals.an.error...Modify. |
| 12cbe0 | 74 68 65 20 73 69 6d 75 6c 61 74 6f 72 20 74 6f 20 62 65 68 61 76 65 20 74 68 69 73 0a 20 20 20 | the.simulator.to.behave.this.... |
| 12cc00 | 20 20 20 20 20 20 20 77 61 79 2e 20 20 59 6f 75 20 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 63 68 | .......way...You.will.have.to.ch |
| 12cc20 | 61 6e 67 65 20 60 73 61 76 65 27 20 74 6f 20 70 75 74 20 74 68 65 20 72 65 67 69 73 74 65 72 20 | ange.`save'.to.put.the.register. |
| 12cc40 | 6e 61 6d 65 0a 20 20 20 20 20 20 20 20 20 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 61 6c 6f 6e | name...........on.the.stack.alon |
| 12cc60 | 67 20 77 69 74 68 20 74 68 65 20 76 61 6c 75 65 2e 0a 0a 20 20 20 20 20 20 20 63 2e 20 60 28 72 | g.with.the.value..........c..`(r |
| 12cc80 | 65 73 74 6f 72 65 20 79 29 27 20 70 75 74 73 20 69 6e 74 6f 20 60 79 27 20 74 68 65 20 6c 61 73 | estore.y)'.puts.into.`y'.the.las |
| 12cca0 | 74 20 76 61 6c 75 65 20 73 61 76 65 64 20 66 72 6f 6d 20 60 79 27 0a 20 20 20 20 20 20 20 20 20 | t.value.saved.from.`y'.......... |
| 12ccc0 | 20 72 65 67 61 72 64 6c 65 73 73 20 6f 66 20 77 68 61 74 20 6f 74 68 65 72 20 72 65 67 69 73 74 | .regardless.of.what.other.regist |
| 12cce0 | 65 72 73 20 77 65 72 65 20 73 61 76 65 64 20 61 66 74 65 72 20 60 79 27 20 61 6e 64 0a 20 20 20 | ers.were.saved.after.`y'.and.... |
| 12cd00 | 20 20 20 20 20 20 20 6e 6f 74 20 72 65 73 74 6f 72 65 64 2e 20 20 4d 6f 64 69 66 79 20 74 68 65 | .......not.restored...Modify.the |
| 12cd20 | 20 73 69 6d 75 6c 61 74 6f 72 20 74 6f 20 62 65 68 61 76 65 20 74 68 69 73 20 77 61 79 2e 20 20 | .simulator.to.behave.this.way... |
| 12cd40 | 59 6f 75 0a 20 20 20 20 20 20 20 20 20 20 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 61 73 73 6f 63 | You...........will.have.to.assoc |
| 12cd60 | 69 61 74 65 20 61 20 73 65 70 61 72 61 74 65 20 73 74 61 63 6b 20 77 69 74 68 20 65 61 63 68 20 | iate.a.separate.stack.with.each. |
| 12cd80 | 72 65 67 69 73 74 65 72 2e 0a 20 20 20 20 20 20 20 20 20 20 59 6f 75 20 73 68 6f 75 6c 64 20 6d | register............You.should.m |
| 12cda0 | 61 6b 65 20 74 68 65 20 60 69 6e 69 74 69 61 6c 69 7a 65 2d 73 74 61 63 6b 27 20 6f 70 65 72 61 | ake.the.`initialize-stack'.opera |
| 12cdc0 | 74 69 6f 6e 20 69 6e 69 74 69 61 6c 69 7a 65 0a 20 20 20 20 20 20 20 20 20 20 61 6c 6c 20 74 68 | tion.initialize...........all.th |
| 12cde0 | 65 20 72 65 67 69 73 74 65 72 20 73 74 61 63 6b 73 2e 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | e.register.stacks.........*Exerc |
| 12ce00 | 69 73 65 20 35 2e 31 32 3a 2a 20 54 68 65 20 73 69 6d 75 6c 61 74 6f 72 20 63 61 6e 20 62 65 20 | ise.5.12:*.The.simulator.can.be. |
| 12ce20 | 75 73 65 64 20 74 6f 20 68 65 6c 70 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 0a 20 20 20 20 20 | used.to.help.determine.the...... |
| 12ce40 | 64 61 74 61 20 70 61 74 68 73 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 69 6d 70 6c 65 6d 65 6e | data.paths.required.for.implemen |
| 12ce60 | 74 69 6e 67 20 61 20 6d 61 63 68 69 6e 65 20 77 69 74 68 20 61 20 67 69 76 65 6e 0a 20 20 20 20 | ting.a.machine.with.a.given..... |
| 12ce80 | 20 63 6f 6e 74 72 6f 6c 6c 65 72 2e 20 20 45 78 74 65 6e 64 20 74 68 65 20 61 73 73 65 6d 62 6c | .controller...Extend.the.assembl |
| 12cea0 | 65 72 20 74 6f 20 73 74 6f 72 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 20 20 20 20 20 69 | er.to.store.the.following......i |
| 12cec0 | 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6d 6f 64 65 6c 3a | nformation.in.the.machine.model: |
| 12cee0 | 0a 0a 20 20 20 20 20 20 20 20 2a 20 61 20 6c 69 73 74 20 6f 66 20 61 6c 6c 20 69 6e 73 74 72 75 | ..........*.a.list.of.all.instru |
| 12cf00 | 63 74 69 6f 6e 73 2c 20 77 69 74 68 20 64 75 70 6c 69 63 61 74 65 73 20 72 65 6d 6f 76 65 64 2c | ctions,.with.duplicates.removed, |
| 12cf20 | 20 73 6f 72 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 62 79 20 69 6e 73 74 72 75 63 74 69 6f 6e | .sorted...........by.instruction |
| 12cf40 | 20 74 79 70 65 20 28 60 61 73 73 69 67 6e 27 2c 20 60 67 6f 74 6f 27 2c 20 61 6e 64 20 73 6f 20 | .type.(`assign',.`goto',.and.so. |
| 12cf60 | 6f 6e 29 3b 0a 0a 20 20 20 20 20 20 20 20 2a 20 61 20 6c 69 73 74 20 28 77 69 74 68 6f 75 74 20 | on);..........*.a.list.(without. |
| 12cf80 | 64 75 70 6c 69 63 61 74 65 73 29 20 6f 66 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 75 73 65 | duplicates).of.the.registers.use |
| 12cfa0 | 64 20 74 6f 20 68 6f 6c 64 0a 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 79 20 70 6f 69 6e 74 73 | d.to.hold...........entry.points |
| 12cfc0 | 20 28 74 68 65 73 65 20 61 72 65 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 72 65 66 65 72 65 | .(these.are.the.registers.refere |
| 12cfe0 | 6e 63 65 64 20 62 79 20 60 67 6f 74 6f 27 0a 20 20 20 20 20 20 20 20 20 20 69 6e 73 74 72 75 63 | nced.by.`goto'...........instruc |
| 12d000 | 74 69 6f 6e 73 29 3b 0a 0a 20 20 20 20 20 20 20 20 2a 20 61 20 6c 69 73 74 20 28 77 69 74 68 6f | tions);..........*.a.list.(witho |
| 12d020 | 75 74 20 64 75 70 6c 69 63 61 74 65 73 29 20 6f 66 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 | ut.duplicates).of.the.registers. |
| 12d040 | 74 68 61 74 20 61 72 65 20 60 73 61 76 65 27 64 0a 20 20 20 20 20 20 20 20 20 20 6f 72 20 60 72 | that.are.`save'd...........or.`r |
| 12d060 | 65 73 74 6f 72 65 27 64 3b 0a 0a 20 20 20 20 20 20 20 20 2a 20 66 6f 72 20 65 61 63 68 20 72 65 | estore'd;..........*.for.each.re |
| 12d080 | 67 69 73 74 65 72 2c 20 61 20 6c 69 73 74 20 28 77 69 74 68 6f 75 74 20 64 75 70 6c 69 63 61 74 | gister,.a.list.(without.duplicat |
| 12d0a0 | 65 73 29 20 6f 66 20 74 68 65 20 73 6f 75 72 63 65 73 0a 20 20 20 20 20 20 20 20 20 20 66 72 6f | es).of.the.sources...........fro |
| 12d0c0 | 6d 20 77 68 69 63 68 20 69 74 20 69 73 20 61 73 73 69 67 6e 65 64 20 28 66 6f 72 20 65 78 61 6d | m.which.it.is.assigned.(for.exam |
| 12d0e0 | 70 6c 65 2c 20 74 68 65 20 73 6f 75 72 63 65 73 20 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20 72 | ple,.the.sources.for...........r |
| 12d100 | 65 67 69 73 74 65 72 20 60 76 61 6c 27 20 69 6e 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 6d | egister.`val'.in.the.factorial.m |
| 12d120 | 61 63 68 69 6e 65 20 6f 66 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 0a 20 20 20 20 20 20 20 20 20 | achine.of.*Note.Figure.......... |
| 12d140 | 20 35 2d 31 31 3a 3a 20 61 72 65 20 60 28 63 6f 6e 73 74 20 31 29 27 20 61 6e 64 20 60 28 28 6f | .5-11::.are.`(const.1)'.and.`((o |
| 12d160 | 70 20 2a 29 20 28 72 65 67 20 6e 29 20 28 72 65 67 20 76 61 6c 29 29 27 29 2e 0a 0a 0a 20 20 20 | p.*).(reg.n).(reg.val))')....... |
| 12d180 | 20 20 45 78 74 65 6e 64 20 74 68 65 20 6d 65 73 73 61 67 65 2d 70 61 73 73 69 6e 67 20 69 6e 74 | ..Extend.the.message-passing.int |
| 12d1a0 | 65 72 66 61 63 65 20 74 6f 20 74 68 65 20 6d 61 63 68 69 6e 65 20 74 6f 20 70 72 6f 76 69 64 65 | erface.to.the.machine.to.provide |
| 12d1c0 | 0a 20 20 20 20 20 61 63 63 65 73 73 20 74 6f 20 74 68 69 73 20 6e 65 77 20 69 6e 66 6f 72 6d 61 | ......access.to.this.new.informa |
| 12d1e0 | 74 69 6f 6e 2e 20 20 54 6f 20 74 65 73 74 20 79 6f 75 72 20 61 6e 61 6c 79 7a 65 72 2c 20 64 65 | tion...To.test.your.analyzer,.de |
| 12d200 | 66 69 6e 65 20 74 68 65 0a 20 20 20 20 20 46 69 62 6f 6e 61 63 63 69 20 6d 61 63 68 69 6e 65 20 | fine.the......Fibonacci.machine. |
| 12d220 | 66 72 6f 6d 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 32 3a 3a 20 61 6e 64 20 65 78 61 | from.*Note.Figure.5-12::.and.exa |
| 12d240 | 6d 69 6e 65 20 74 68 65 20 6c 69 73 74 73 0a 20 20 20 20 20 79 6f 75 20 63 6f 6e 73 74 72 75 63 | mine.the.lists......you.construc |
| 12d260 | 74 65 64 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 31 33 3a 2a 20 4d 6f 64 69 | ted........*Exercise.5.13:*.Modi |
| 12d280 | 66 79 20 74 68 65 20 73 69 6d 75 6c 61 74 6f 72 20 73 6f 20 74 68 61 74 20 69 74 20 75 73 65 73 | fy.the.simulator.so.that.it.uses |
| 12d2a0 | 20 74 68 65 0a 20 20 20 20 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 20 74 6f | .the......controller.sequence.to |
| 12d2c0 | 20 64 65 74 65 72 6d 69 6e 65 20 77 68 61 74 20 72 65 67 69 73 74 65 72 73 20 74 68 65 20 6d 61 | .determine.what.registers.the.ma |
| 12d2e0 | 63 68 69 6e 65 20 68 61 73 0a 20 20 20 20 20 72 61 74 68 65 72 20 74 68 61 6e 20 72 65 71 75 69 | chine.has......rather.than.requi |
| 12d300 | 72 69 6e 67 20 61 20 6c 69 73 74 20 6f 66 20 72 65 67 69 73 74 65 72 73 20 61 73 20 61 6e 20 61 | ring.a.list.of.registers.as.an.a |
| 12d320 | 72 67 75 6d 65 6e 74 20 74 6f 0a 20 20 20 20 20 60 6d 61 6b 65 2d 6d 61 63 68 69 6e 65 27 2e 20 | rgument.to......`make-machine'.. |
| 12d340 | 20 49 6e 73 74 65 61 64 20 6f 66 20 70 72 65 2d 61 6c 6c 6f 63 61 74 69 6e 67 20 74 68 65 20 72 | .Instead.of.pre-allocating.the.r |
| 12d360 | 65 67 69 73 74 65 72 73 20 69 6e 0a 20 20 20 20 20 60 6d 61 6b 65 2d 6d 61 63 68 69 6e 65 27 2c | egisters.in......`make-machine', |
| 12d380 | 20 79 6f 75 20 63 61 6e 20 61 6c 6c 6f 63 61 74 65 20 74 68 65 6d 20 6f 6e 65 20 61 74 20 61 20 | .you.can.allocate.them.one.at.a. |
| 12d3a0 | 74 69 6d 65 20 77 68 65 6e 20 74 68 65 79 20 61 72 65 0a 20 20 20 20 20 66 69 72 73 74 20 73 65 | time.when.they.are......first.se |
| 12d3c0 | 65 6e 20 64 75 72 69 6e 67 20 61 73 73 65 6d 62 6c 79 20 6f 66 20 74 68 65 20 69 6e 73 74 72 75 | en.during.assembly.of.the.instru |
| 12d3e0 | 63 74 69 6f 6e 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 | ctions.....File:.sicp.info,..Nod |
| 12d400 | 65 3a 20 35 2d 32 2d 34 2c 20 20 50 72 65 76 3a 20 35 2d 32 2d 33 2c 20 20 55 70 3a 20 35 2d 32 | e:.5-2-4,..Prev:.5-2-3,..Up:.5-2 |
| 12d420 | 0a 0a 35 2e 32 2e 34 20 4d 6f 6e 69 74 6f 72 69 6e 67 20 4d 61 63 68 69 6e 65 20 50 65 72 66 6f | ..5.2.4.Monitoring.Machine.Perfo |
| 12d440 | 72 6d 61 6e 63 65 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | rmance.------------------------- |
| 12d460 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 53 69 6d 75 6c 61 74 69 6f 6e 20 69 73 20 75 73 65 66 75 | -----------..Simulation.is.usefu |
| 12d480 | 6c 20 6e 6f 74 20 6f 6e 6c 79 20 66 6f 72 20 76 65 72 69 66 79 69 6e 67 20 74 68 65 20 63 6f 72 | l.not.only.for.verifying.the.cor |
| 12d4a0 | 72 65 63 74 6e 65 73 73 20 6f 66 20 61 0a 70 72 6f 70 6f 73 65 64 20 6d 61 63 68 69 6e 65 20 64 | rectness.of.a.proposed.machine.d |
| 12d4c0 | 65 73 69 67 6e 20 62 75 74 20 61 6c 73 6f 20 66 6f 72 20 6d 65 61 73 75 72 69 6e 67 20 74 68 65 | esign.but.also.for.measuring.the |
| 12d4e0 | 20 6d 61 63 68 69 6e 65 27 73 0a 70 65 72 66 6f 72 6d 61 6e 63 65 2e 20 20 46 6f 72 20 65 78 61 | .machine's.performance...For.exa |
| 12d500 | 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 69 6e 73 74 61 6c 6c 20 69 6e 20 6f 75 72 20 73 69 6d 75 | mple,.we.can.install.in.our.simu |
| 12d520 | 6c 61 74 69 6f 6e 20 70 72 6f 67 72 61 6d 20 61 0a 22 6d 65 74 65 72 22 20 74 68 61 74 20 6d 65 | lation.program.a."meter".that.me |
| 12d540 | 61 73 75 72 65 73 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 61 63 6b 20 6f 70 65 72 61 | asures.the.number.of.stack.opera |
| 12d560 | 74 69 6f 6e 73 20 75 73 65 64 20 69 6e 20 61 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 54 6f | tions.used.in.a.computation...To |
| 12d580 | 20 64 6f 20 74 68 69 73 2c 20 77 65 20 6d 6f 64 69 66 79 20 6f 75 72 20 73 69 6d 75 6c 61 74 65 | .do.this,.we.modify.our.simulate |
| 12d5a0 | 64 20 73 74 61 63 6b 20 74 6f 20 6b 65 65 70 20 74 72 61 63 6b 0a 6f 66 20 74 68 65 20 6e 75 6d | d.stack.to.keep.track.of.the.num |
| 12d5c0 | 62 65 72 20 6f 66 20 74 69 6d 65 73 20 72 65 67 69 73 74 65 72 73 20 61 72 65 20 73 61 76 65 64 | ber.of.times.registers.are.saved |
| 12d5e0 | 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 61 6e 64 20 74 68 65 20 6d 61 78 69 6d 75 6d 0a 64 65 | .on.the.stack.and.the.maximum.de |
| 12d600 | 70 74 68 20 72 65 61 63 68 65 64 20 62 79 20 74 68 65 20 73 74 61 63 6b 2c 20 61 6e 64 20 61 64 | pth.reached.by.the.stack,.and.ad |
| 12d620 | 64 20 61 20 6d 65 73 73 61 67 65 20 74 6f 20 74 68 65 20 73 74 61 63 6b 27 73 20 69 6e 74 65 72 | d.a.message.to.the.stack's.inter |
| 12d640 | 66 61 63 65 0a 74 68 61 74 20 70 72 69 6e 74 73 20 74 68 65 20 73 74 61 74 69 73 74 69 63 73 2c | face.that.prints.the.statistics, |
| 12d660 | 20 61 73 20 73 68 6f 77 6e 20 62 65 6c 6f 77 2e 20 20 57 65 20 61 6c 73 6f 20 61 64 64 20 61 6e | .as.shown.below...We.also.add.an |
| 12d680 | 20 6f 70 65 72 61 74 69 6f 6e 0a 74 6f 20 74 68 65 20 62 61 73 69 63 20 6d 61 63 68 69 6e 65 20 | .operation.to.the.basic.machine. |
| 12d6a0 | 6d 6f 64 65 6c 20 74 6f 20 70 72 69 6e 74 20 74 68 65 20 73 74 61 63 6b 20 73 74 61 74 69 73 74 | model.to.print.the.stack.statist |
| 12d6c0 | 69 63 73 2c 20 62 79 0a 69 6e 69 74 69 61 6c 69 7a 69 6e 67 20 60 74 68 65 2d 6f 70 73 27 20 69 | ics,.by.initializing.`the-ops'.i |
| 12d6e0 | 6e 20 60 6d 61 6b 65 2d 6e 65 77 2d 6d 61 63 68 69 6e 65 27 20 74 6f 0a 0a 20 20 20 20 20 28 6c | n.`make-new-machine'.to.......(l |
| 12d700 | 69 73 74 20 28 6c 69 73 74 20 27 69 6e 69 74 69 61 6c 69 7a 65 2d 73 74 61 63 6b 0a 20 20 20 20 | ist.(list.'initialize-stack..... |
| 12d720 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 28 73 74 61 63 6b 20 27 | .............(lambda.().(stack.' |
| 12d740 | 69 6e 69 74 69 61 6c 69 7a 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 | initialize)))............(list.' |
| 12d760 | 70 72 69 6e 74 2d 73 74 61 63 6b 2d 73 74 61 74 69 73 74 69 63 73 0a 20 20 20 20 20 20 20 20 20 | print-stack-statistics.......... |
| 12d780 | 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 29 20 28 73 74 61 63 6b 20 27 70 72 69 6e 74 | ........(lambda.().(stack.'print |
| 12d7a0 | 2d 73 74 61 74 69 73 74 69 63 73 29 29 29 29 0a 0a 20 20 20 48 65 72 65 20 69 73 20 74 68 65 20 | -statistics)))).....Here.is.the. |
| 12d7c0 | 6e 65 77 20 76 65 72 73 69 6f 6e 20 6f 66 20 60 6d 61 6b 65 2d 73 74 61 63 6b 27 3a 0a 0a 20 20 | new.version.of.`make-stack':.... |
| 12d7e0 | 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 73 74 61 63 6b 29 0a 20 20 20 20 20 20 20 28 | ...(define.(make-stack)........( |
| 12d800 | 6c 65 74 20 28 28 73 20 27 28 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 75 6d 62 65 | let.((s.'())..............(numbe |
| 12d820 | 72 2d 70 75 73 68 65 73 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 78 2d 64 65 | r-pushes.0)..............(max-de |
| 12d840 | 70 74 68 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 75 72 72 65 6e 74 2d 64 65 70 | pth.0)..............(current-dep |
| 12d860 | 74 68 20 30 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 75 73 68 20 78 29 | th.0))..........(define.(push.x) |
| 12d880 | 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 73 20 28 63 6f 6e 73 20 78 20 73 29 29 0a | ............(set!.s.(cons.x.s)). |
| 12d8a0 | 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 6e 75 6d 62 65 72 2d 70 75 73 68 65 73 20 28 | ...........(set!.number-pushes.( |
| 12d8c0 | 2b 20 31 20 6e 75 6d 62 65 72 2d 70 75 73 68 65 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 | +.1.number-pushes))............( |
| 12d8e0 | 73 65 74 21 20 63 75 72 72 65 6e 74 2d 64 65 70 74 68 20 28 2b 20 31 20 63 75 72 72 65 6e 74 2d | set!.current-depth.(+.1.current- |
| 12d900 | 64 65 70 74 68 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 6d 61 78 2d 64 65 70 | depth))............(set!.max-dep |
| 12d920 | 74 68 20 28 6d 61 78 20 63 75 72 72 65 6e 74 2d 64 65 70 74 68 20 6d 61 78 2d 64 65 70 74 68 29 | th.(max.current-depth.max-depth) |
| 12d940 | 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 6f 70 29 0a 20 20 20 20 20 20 | ))..........(define.(pop)....... |
| 12d960 | 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....(if.(null?.s).............. |
| 12d980 | 20 20 28 65 72 72 6f 72 20 22 45 6d 70 74 79 20 73 74 61 63 6b 20 2d 2d 20 50 4f 50 22 29 0a 20 | ..(error."Empty.stack.--.POP").. |
| 12d9a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 6f 70 20 28 63 61 72 20 73 29 | ..............(let.((top.(car.s) |
| 12d9c0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 73 20 28 63 64 72 | ))..................(set!.s.(cdr |
| 12d9e0 | 20 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 63 75 72 72 | .s))..................(set!.curr |
| 12da00 | 65 6e 74 2d 64 65 70 74 68 20 28 2d 20 63 75 72 72 65 6e 74 2d 64 65 70 74 68 20 31 29 29 0a 20 | ent-depth.(-.current-depth.1)).. |
| 12da20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 6f 70 29 29 29 0a 20 20 20 20 20 20 20 20 20 | ................top))).......... |
| 12da40 | 28 64 65 66 69 6e 65 20 28 69 6e 69 74 69 61 6c 69 7a 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (define.(initialize)............ |
| 12da60 | 28 73 65 74 21 20 73 20 27 28 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 6e 75 | (set!.s.'())............(set!.nu |
| 12da80 | 6d 62 65 72 2d 70 75 73 68 65 73 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 | mber-pushes.0)............(set!. |
| 12daa0 | 6d 61 78 2d 64 65 70 74 68 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 63 75 | max-depth.0)............(set!.cu |
| 12dac0 | 72 72 65 6e 74 2d 64 65 70 74 68 20 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 27 64 6f 6e 65 29 | rrent-depth.0)............'done) |
| 12dae0 | 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 70 72 69 6e 74 2d 73 74 61 74 69 73 74 | ..........(define.(print-statist |
| 12db00 | 69 63 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 | ics)............(newline)....... |
| 12db20 | 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 28 6c 69 73 74 20 27 74 6f 74 61 6c 2d 70 75 73 68 65 | .....(display.(list.'total-pushe |
| 12db40 | 73 20 20 27 3d 20 6e 75 6d 62 65 72 2d 70 75 73 68 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 | s..'=.number-pushes............. |
| 12db60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 6d 61 78 69 6d 75 6d 2d 64 65 70 74 68 20 27 3d 20 | ..............'maximum-depth.'=. |
| 12db80 | 6d 61 78 2d 64 65 70 74 68 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 64 | max-depth)))..........(define.(d |
| 12dba0 | 69 73 70 61 74 63 68 20 6d 65 73 73 61 67 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e | ispatch.message)............(con |
| 12dbc0 | 64 20 28 28 65 71 3f 20 6d 65 73 73 61 67 65 20 27 70 75 73 68 29 20 70 75 73 68 29 0a 20 20 20 | d.((eq?.message.'push).push).... |
| 12dbe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 65 73 73 61 67 65 20 27 70 6f 70 | ..............((eq?.message.'pop |
| 12dc00 | 29 20 28 70 6f 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 | ).(pop))..................((eq?. |
| 12dc20 | 6d 65 73 73 61 67 65 20 27 69 6e 69 74 69 61 6c 69 7a 65 29 20 28 69 6e 69 74 69 61 6c 69 7a 65 | message.'initialize).(initialize |
| 12dc40 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6d 65 73 73 61 67 | ))..................((eq?.messag |
| 12dc60 | 65 20 27 70 72 69 6e 74 2d 73 74 61 74 69 73 74 69 63 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 | e.'print-statistics)............ |
| 12dc80 | 20 20 20 20 20 20 20 28 70 72 69 6e 74 2d 73 74 61 74 69 73 74 69 63 73 29 29 0a 20 20 20 20 20 | .......(print-statistics))...... |
| 12dca0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............(else............... |
| 12dcc0 | 20 20 20 20 28 65 72 72 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 72 65 71 75 65 73 74 20 2d 2d 20 53 | ....(error."Unknown.request.--.S |
| 12dce0 | 54 41 43 4b 22 20 6d 65 73 73 61 67 65 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 64 69 73 70 61 | TACK".message))))..........dispa |
| 12dd00 | 74 63 68 29 29 0a 0a 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 31 35 3a 3a 20 | tch)).....*Note.Exercise.5-15::. |
| 12dd20 | 74 68 72 6f 75 67 68 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 31 39 3a 3a 20 64 65 | through.*Note.Exercise.5-19::.de |
| 12dd40 | 73 63 72 69 62 65 20 6f 74 68 65 72 0a 75 73 65 66 75 6c 20 6d 6f 6e 69 74 6f 72 69 6e 67 20 61 | scribe.other.useful.monitoring.a |
| 12dd60 | 6e 64 20 64 65 62 75 67 67 69 6e 67 20 66 65 61 74 75 72 65 73 20 74 68 61 74 20 63 61 6e 20 62 | nd.debugging.features.that.can.b |
| 12dd80 | 65 20 61 64 64 65 64 20 74 6f 20 74 68 65 0a 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 | e.added.to.the.register-machine. |
| 12dda0 | 73 69 6d 75 6c 61 74 6f 72 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 31 34 3a | simulator........*Exercise.5.14: |
| 12ddc0 | 2a 20 4d 65 61 73 75 72 65 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 75 73 68 65 73 20 61 | *.Measure.the.number.of.pushes.a |
| 12dde0 | 6e 64 20 74 68 65 20 6d 61 78 69 6d 75 6d 0a 20 20 20 20 20 73 74 61 63 6b 20 64 65 70 74 68 20 | nd.the.maximum......stack.depth. |
| 12de00 | 72 65 71 75 69 72 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 6e 21 20 66 6f 72 20 76 61 72 69 6f | required.to.compute.n!.for.vario |
| 12de20 | 75 73 20 73 6d 61 6c 6c 20 76 61 6c 75 65 73 20 6f 66 20 6e 0a 20 20 20 20 20 75 73 69 6e 67 20 | us.small.values.of.n......using. |
| 12de40 | 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 20 73 68 6f 77 6e 20 69 6e 20 2a | the.factorial.machine.shown.in.* |
| 12de60 | 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 31 3a 3a 2e 20 20 46 72 6f 6d 0a 20 20 20 20 20 79 | Note.Figure.5-11::...From......y |
| 12de80 | 6f 75 72 20 64 61 74 61 20 64 65 74 65 72 6d 69 6e 65 20 66 6f 72 6d 75 6c 61 73 20 69 6e 20 74 | our.data.determine.formulas.in.t |
| 12dea0 | 65 72 6d 73 20 6f 66 20 6e 20 66 6f 72 20 74 68 65 20 74 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f | erms.of.n.for.the.total.number.o |
| 12dec0 | 66 0a 20 20 20 20 20 70 75 73 68 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 6e 64 20 74 68 65 20 6d | f......push.operations.and.the.m |
| 12dee0 | 61 78 69 6d 75 6d 20 73 74 61 63 6b 20 64 65 70 74 68 20 75 73 65 64 20 69 6e 20 63 6f 6d 70 75 | aximum.stack.depth.used.in.compu |
| 12df00 | 74 69 6e 67 20 6e 21 0a 20 20 20 20 20 66 6f 72 20 61 6e 79 20 6e 20 3e 20 31 2e 20 4e 6f 74 65 | ting.n!......for.any.n.>.1..Note |
| 12df20 | 20 74 68 61 74 20 65 61 63 68 20 6f 66 20 74 68 65 73 65 20 69 73 20 61 20 6c 69 6e 65 61 72 20 | .that.each.of.these.is.a.linear. |
| 12df40 | 66 75 6e 63 74 69 6f 6e 20 6f 66 20 6e 0a 20 20 20 20 20 61 6e 64 20 69 73 20 74 68 75 73 20 64 | function.of.n......and.is.thus.d |
| 12df60 | 65 74 65 72 6d 69 6e 65 64 20 62 79 20 74 77 6f 20 63 6f 6e 73 74 61 6e 74 73 2e 20 20 49 6e 20 | etermined.by.two.constants...In. |
| 12df80 | 6f 72 64 65 72 20 74 6f 20 67 65 74 20 74 68 65 0a 20 20 20 20 20 73 74 61 74 69 73 74 69 63 73 | order.to.get.the......statistics |
| 12dfa0 | 20 70 72 69 6e 74 65 64 2c 20 79 6f 75 20 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 61 75 67 6d 65 | .printed,.you.will.have.to.augme |
| 12dfc0 | 6e 74 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 77 69 | nt.the.factorial.machine......wi |
| 12dfe0 | 74 68 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 6f 20 69 6e 69 74 69 61 6c 69 7a 65 20 74 68 | th.instructions.to.initialize.th |
| 12e000 | 65 20 73 74 61 63 6b 20 61 6e 64 20 70 72 69 6e 74 20 74 68 65 0a 20 20 20 20 20 73 74 61 74 69 | e.stack.and.print.the......stati |
| 12e020 | 73 74 69 63 73 2e 20 20 59 6f 75 20 6d 61 79 20 77 61 6e 74 20 74 6f 20 61 6c 73 6f 20 6d 6f 64 | stics...You.may.want.to.also.mod |
| 12e040 | 69 66 79 20 74 68 65 20 6d 61 63 68 69 6e 65 20 73 6f 20 74 68 61 74 20 69 74 0a 20 20 20 20 20 | ify.the.machine.so.that.it...... |
| 12e060 | 72 65 70 65 61 74 65 64 6c 79 20 72 65 61 64 73 20 61 20 76 61 6c 75 65 20 66 6f 72 20 6e 2c 20 | repeatedly.reads.a.value.for.n,. |
| 12e080 | 63 6f 6d 70 75 74 65 73 20 74 68 65 20 66 61 63 74 6f 72 69 61 6c 2c 20 61 6e 64 20 70 72 69 6e | computes.the.factorial,.and.prin |
| 12e0a0 | 74 73 0a 20 20 20 20 20 74 68 65 20 72 65 73 75 6c 74 20 28 61 73 20 77 65 20 64 69 64 20 66 6f | ts......the.result.(as.we.did.fo |
| 12e0c0 | 72 20 74 68 65 20 47 43 44 20 6d 61 63 68 69 6e 65 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 | r.the.GCD.machine.in.*Note.Figur |
| 12e0e0 | 65 20 35 2d 34 3a 3a 29 2c 0a 20 20 20 20 20 73 6f 20 74 68 61 74 20 79 6f 75 20 77 69 6c 6c 20 | e.5-4::),......so.that.you.will. |
| 12e100 | 6e 6f 74 20 68 61 76 65 20 74 6f 20 72 65 70 65 61 74 65 64 6c 79 20 69 6e 76 6f 6b 65 0a 20 20 | not.have.to.repeatedly.invoke... |
| 12e120 | 20 20 20 60 67 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 27 2c 20 60 73 65 74 | ...`get-register-contents',.`set |
| 12e140 | 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 21 27 2c 20 61 6e 64 20 60 73 74 61 72 74 | -register-contents!',.and.`start |
| 12e160 | 27 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 31 35 3a 2a 20 41 64 64 20 63 6f | '........*Exercise.5.15:*.Add.co |
| 12e180 | 75 6e 74 69 6e 67 20 22 69 6e 73 74 72 75 63 74 69 6f 6e 20 63 6f 75 6e 74 69 6e 67 22 20 74 6f | unting."instruction.counting".to |
| 12e1a0 | 20 74 68 65 0a 20 20 20 20 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 73 69 6d 75 6c | .the......register.machine.simul |
| 12e1c0 | 61 74 69 6f 6e 2e 20 20 54 68 61 74 20 69 73 2c 20 68 61 76 65 20 74 68 65 20 6d 61 63 68 69 6e | ation...That.is,.have.the.machin |
| 12e1e0 | 65 20 6d 6f 64 65 6c 20 6b 65 65 70 0a 20 20 20 20 20 74 72 61 63 6b 20 6f 66 20 74 68 65 20 6e | e.model.keep......track.of.the.n |
| 12e200 | 75 6d 62 65 72 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 65 78 65 63 75 74 65 64 2e 20 | umber.of.instructions.executed.. |
| 12e220 | 20 45 78 74 65 6e 64 20 74 68 65 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 6d 6f 64 65 6c 27 73 | .Extend.the.machine......model's |
| 12e240 | 20 69 6e 74 65 72 66 61 63 65 20 74 6f 20 61 63 63 65 70 74 20 61 20 6e 65 77 20 6d 65 73 73 61 | .interface.to.accept.a.new.messa |
| 12e260 | 67 65 20 74 68 61 74 20 70 72 69 6e 74 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 0a 20 20 20 20 | ge.that.prints.the.value.of..... |
| 12e280 | 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 63 6f 75 6e 74 20 61 6e 64 20 72 65 73 65 74 | .the.instruction.count.and.reset |
| 12e2a0 | 73 20 74 68 65 20 63 6f 75 6e 74 20 74 6f 20 7a 65 72 6f 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 | s.the.count.to.zero........*Exer |
| 12e2c0 | 63 69 73 65 20 35 2e 31 36 3a 2a 20 41 75 67 6d 65 6e 74 20 74 68 65 20 73 69 6d 75 6c 61 74 6f | cise.5.16:*.Augment.the.simulato |
| 12e2e0 | 72 20 74 6f 20 70 72 6f 76 69 64 65 20 66 6f 72 20 22 69 6e 73 74 72 75 63 74 69 6f 6e 0a 20 20 | r.to.provide.for."instruction... |
| 12e300 | 20 20 20 74 72 61 63 69 6e 67 22 2e 20 20 54 68 61 74 20 69 73 2c 20 62 65 66 6f 72 65 20 65 61 | ...tracing"...That.is,.before.ea |
| 12e320 | 63 68 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 73 20 65 78 65 63 75 74 65 64 2c 20 74 68 65 0a | ch.instruction.is.executed,.the. |
| 12e340 | 20 20 20 20 20 73 69 6d 75 6c 61 74 6f 72 20 73 68 6f 75 6c 64 20 70 72 69 6e 74 20 74 68 65 20 | .....simulator.should.print.the. |
| 12e360 | 74 65 78 74 20 6f 66 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 2e 20 20 4d 61 6b 65 20 74 | text.of.the.instruction...Make.t |
| 12e380 | 68 65 0a 20 20 20 20 20 6d 61 63 68 69 6e 65 20 6d 6f 64 65 6c 20 61 63 63 65 70 74 20 60 74 72 | he......machine.model.accept.`tr |
| 12e3a0 | 61 63 65 2d 6f 6e 27 20 61 6e 64 20 60 74 72 61 63 65 2d 6f 66 66 27 20 6d 65 73 73 61 67 65 73 | ace-on'.and.`trace-off'.messages |
| 12e3c0 | 20 74 6f 20 74 75 72 6e 0a 20 20 20 20 20 74 72 61 63 69 6e 67 20 6f 6e 20 61 6e 64 20 6f 66 66 | .to.turn......tracing.on.and.off |
| 12e3e0 | 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 31 37 3a 2a 20 45 78 74 65 6e 64 20 | ........*Exercise.5.17:*.Extend. |
| 12e400 | 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 74 72 61 63 69 6e 67 20 6f 66 20 2a 4e 6f 74 65 | the.instruction.tracing.of.*Note |
| 12e420 | 20 45 78 65 72 63 69 73 65 0a 20 20 20 20 20 35 2d 31 36 3a 3a 20 73 6f 20 74 68 61 74 20 62 65 | .Exercise......5-16::.so.that.be |
| 12e440 | 66 6f 72 65 20 70 72 69 6e 74 69 6e 67 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 2c 20 74 68 | fore.printing.an.instruction,.th |
| 12e460 | 65 20 73 69 6d 75 6c 61 74 6f 72 0a 20 20 20 20 20 70 72 69 6e 74 73 20 61 6e 79 20 6c 61 62 65 | e.simulator......prints.any.labe |
| 12e480 | 6c 73 20 74 68 61 74 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 70 72 65 63 65 64 65 20 74 68 61 74 | ls.that.immediately.precede.that |
| 12e4a0 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 6e 20 74 68 65 0a 20 20 20 20 20 63 6f 6e 74 72 6f 6c | .instruction.in.the......control |
| 12e4c0 | 6c 65 72 20 73 65 71 75 65 6e 63 65 2e 20 20 42 65 20 63 61 72 65 66 75 6c 20 74 6f 20 64 6f 20 | ler.sequence...Be.careful.to.do. |
| 12e4e0 | 74 68 69 73 20 69 6e 20 61 20 77 61 79 20 74 68 61 74 20 64 6f 65 73 20 6e 6f 74 0a 20 20 20 20 | this.in.a.way.that.does.not..... |
| 12e500 | 20 69 6e 74 65 72 66 65 72 65 20 77 69 74 68 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 63 6f 75 6e | .interfere.with.instruction.coun |
| 12e520 | 74 69 6e 67 20 28 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 31 35 3a 3a 29 2e 20 20 59 | ting.(*Note.Exercise.5-15::)...Y |
| 12e540 | 6f 75 0a 20 20 20 20 20 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 73 69 | ou......will.have.to.make.the.si |
| 12e560 | 6d 75 6c 61 74 6f 72 20 72 65 74 61 69 6e 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 20 6c 61 62 | mulator.retain.the.necessary.lab |
| 12e580 | 65 6c 0a 20 20 20 20 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 | el......information........*Exer |
| 12e5a0 | 63 69 73 65 20 35 2e 31 38 3a 2a 20 4d 6f 64 69 66 79 20 74 68 65 20 60 6d 61 6b 65 2d 72 65 67 | cise.5.18:*.Modify.the.`make-reg |
| 12e5c0 | 69 73 74 65 72 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 0a 20 20 20 20 | ister'.procedure.of.section..... |
| 12e5e0 | 20 2a 4e 6f 74 65 20 35 2d 32 2d 31 3a 3a 20 73 6f 20 74 68 61 74 20 72 65 67 69 73 74 65 72 73 | .*Note.5-2-1::.so.that.registers |
| 12e600 | 20 63 61 6e 20 62 65 20 74 72 61 63 65 64 2e 20 20 52 65 67 69 73 74 65 72 73 20 73 68 6f 75 6c | .can.be.traced...Registers.shoul |
| 12e620 | 64 0a 20 20 20 20 20 61 63 63 65 70 74 20 6d 65 73 73 61 67 65 73 20 74 68 61 74 20 74 75 72 6e | d......accept.messages.that.turn |
| 12e640 | 20 74 72 61 63 69 6e 67 20 6f 6e 20 61 6e 64 20 6f 66 66 2e 20 20 57 68 65 6e 20 61 20 72 65 67 | .tracing.on.and.off...When.a.reg |
| 12e660 | 69 73 74 65 72 20 69 73 0a 20 20 20 20 20 74 72 61 63 65 64 2c 20 61 73 73 69 67 6e 69 6e 67 20 | ister.is......traced,.assigning. |
| 12e680 | 61 20 76 61 6c 75 65 20 74 6f 20 74 68 65 20 72 65 67 69 73 74 65 72 20 73 68 6f 75 6c 64 20 70 | a.value.to.the.register.should.p |
| 12e6a0 | 72 69 6e 74 20 74 68 65 20 6e 61 6d 65 20 6f 66 0a 20 20 20 20 20 74 68 65 20 72 65 67 69 73 74 | rint.the.name.of......the.regist |
| 12e6c0 | 65 72 2c 20 74 68 65 20 6f 6c 64 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 74 68 65 20 72 65 67 69 | er,.the.old.contents.of.the.regi |
| 12e6e0 | 73 74 65 72 2c 20 61 6e 64 20 74 68 65 20 6e 65 77 0a 20 20 20 20 20 63 6f 6e 74 65 6e 74 73 20 | ster,.and.the.new......contents. |
| 12e700 | 62 65 69 6e 67 20 61 73 73 69 67 6e 65 64 2e 20 20 45 78 74 65 6e 64 20 74 68 65 20 69 6e 74 65 | being.assigned...Extend.the.inte |
| 12e720 | 72 66 61 63 65 20 74 6f 20 74 68 65 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 6d 6f 64 65 6c 20 | rface.to.the.machine......model. |
| 12e740 | 74 6f 20 70 65 72 6d 69 74 20 79 6f 75 20 74 6f 20 74 75 72 6e 20 74 72 61 63 69 6e 67 20 6f 6e | to.permit.you.to.turn.tracing.on |
| 12e760 | 20 61 6e 64 20 6f 66 66 20 66 6f 72 20 64 65 73 69 67 6e 61 74 65 64 0a 20 20 20 20 20 6d 61 63 | .and.off.for.designated......mac |
| 12e780 | 68 69 6e 65 20 72 65 67 69 73 74 65 72 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 | hine.registers........*Exercise. |
| 12e7a0 | 35 2e 31 39 3a 2a 20 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b 65 72 20 77 61 6e 74 73 20 61 20 | 5.19:*.Alyssa.P..Hacker.wants.a. |
| 12e7c0 | 22 62 72 65 61 6b 70 6f 69 6e 74 22 20 66 65 61 74 75 72 65 20 69 6e 0a 20 20 20 20 20 74 68 65 | "breakpoint".feature.in......the |
| 12e7e0 | 20 73 69 6d 75 6c 61 74 6f 72 20 74 6f 20 68 65 6c 70 20 68 65 72 20 64 65 62 75 67 20 68 65 72 | .simulator.to.help.her.debug.her |
| 12e800 | 20 6d 61 63 68 69 6e 65 20 64 65 73 69 67 6e 73 2e 20 20 59 6f 75 20 68 61 76 65 0a 20 20 20 20 | .machine.designs...You.have..... |
| 12e820 | 20 62 65 65 6e 20 68 69 72 65 64 20 74 6f 20 69 6e 73 74 61 6c 6c 20 74 68 69 73 20 66 65 61 74 | .been.hired.to.install.this.feat |
| 12e840 | 75 72 65 20 66 6f 72 20 68 65 72 2e 20 20 53 68 65 20 77 61 6e 74 73 20 74 6f 20 62 65 20 61 62 | ure.for.her...She.wants.to.be.ab |
| 12e860 | 6c 65 0a 20 20 20 20 20 74 6f 20 73 70 65 63 69 66 79 20 61 20 70 6c 61 63 65 20 69 6e 20 74 68 | le......to.specify.a.place.in.th |
| 12e880 | 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 20 77 68 65 72 65 20 74 68 65 20 | e.controller.sequence.where.the. |
| 12e8a0 | 73 69 6d 75 6c 61 74 6f 72 0a 20 20 20 20 20 77 69 6c 6c 20 73 74 6f 70 20 61 6e 64 20 61 6c 6c | simulator......will.stop.and.all |
| 12e8c0 | 6f 77 20 68 65 72 20 74 6f 20 65 78 61 6d 69 6e 65 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 74 | ow.her.to.examine.the.state.of.t |
| 12e8e0 | 68 65 20 6d 61 63 68 69 6e 65 2e 20 20 59 6f 75 0a 20 20 20 20 20 61 72 65 20 74 6f 20 69 6d 70 | he.machine...You......are.to.imp |
| 12e900 | 6c 65 6d 65 6e 74 20 61 20 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 | lement.a.procedure............(s |
| 12e920 | 65 74 2d 62 72 65 61 6b 70 6f 69 6e 74 20 3c 4d 41 43 48 49 4e 45 3e 20 3c 4c 41 42 45 4c 3e 20 | et-breakpoint.<MACHINE>.<LABEL>. |
| 12e940 | 3c 4e 3e 29 0a 0a 20 20 20 20 20 74 68 61 74 20 73 65 74 73 20 61 20 62 72 65 61 6b 70 6f 69 6e | <N>).......that.sets.a.breakpoin |
| 12e960 | 74 20 6a 75 73 74 20 62 65 66 6f 72 65 20 74 68 65 20 6e 74 68 20 69 6e 73 74 72 75 63 74 69 6f | t.just.before.the.nth.instructio |
| 12e980 | 6e 20 61 66 74 65 72 20 74 68 65 0a 20 20 20 20 20 67 69 76 65 6e 20 6c 61 62 65 6c 2e 20 20 46 | n.after.the......given.label...F |
| 12e9a0 | 6f 72 20 65 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 62 72 65 61 | or.example,............(set-brea |
| 12e9c0 | 6b 70 6f 69 6e 74 20 67 63 64 2d 6d 61 63 68 69 6e 65 20 27 74 65 73 74 2d 62 20 34 29 0a 0a 20 | kpoint.gcd-machine.'test-b.4)... |
| 12e9e0 | 20 20 20 20 69 6e 73 74 61 6c 6c 73 20 61 20 62 72 65 61 6b 70 6f 69 6e 74 20 69 6e 20 60 67 63 | ....installs.a.breakpoint.in.`gc |
| 12ea00 | 64 2d 6d 61 63 68 69 6e 65 27 20 6a 75 73 74 20 62 65 66 6f 72 65 20 74 68 65 20 61 73 73 69 67 | d-machine'.just.before.the.assig |
| 12ea20 | 6e 6d 65 6e 74 0a 20 20 20 20 20 74 6f 20 72 65 67 69 73 74 65 72 20 60 61 27 2e 20 20 57 68 65 | nment......to.register.`a'...Whe |
| 12ea40 | 6e 20 74 68 65 20 73 69 6d 75 6c 61 74 6f 72 20 72 65 61 63 68 65 73 20 74 68 65 20 62 72 65 61 | n.the.simulator.reaches.the.brea |
| 12ea60 | 6b 70 6f 69 6e 74 20 69 74 0a 20 20 20 20 20 73 68 6f 75 6c 64 20 70 72 69 6e 74 20 74 68 65 20 | kpoint.it......should.print.the. |
| 12ea80 | 6c 61 62 65 6c 20 61 6e 64 20 74 68 65 20 6f 66 66 73 65 74 20 6f 66 20 74 68 65 20 62 72 65 61 | label.and.the.offset.of.the.brea |
| 12eaa0 | 6b 70 6f 69 6e 74 20 61 6e 64 20 73 74 6f 70 0a 20 20 20 20 20 65 78 65 63 75 74 69 6e 67 20 69 | kpoint.and.stop......executing.i |
| 12eac0 | 6e 73 74 72 75 63 74 69 6f 6e 73 2e 20 20 41 6c 79 73 73 61 20 63 61 6e 20 74 68 65 6e 20 75 73 | nstructions...Alyssa.can.then.us |
| 12eae0 | 65 0a 20 20 20 20 20 60 67 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 27 20 61 | e......`get-register-contents'.a |
| 12eb00 | 6e 64 20 60 73 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 21 27 20 74 6f 20 6d | nd.`set-register-contents!'.to.m |
| 12eb20 | 61 6e 69 70 75 6c 61 74 65 0a 20 20 20 20 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 | anipulate......the.state.of.the. |
| 12eb40 | 73 69 6d 75 6c 61 74 65 64 20 6d 61 63 68 69 6e 65 2e 20 20 53 68 65 20 73 68 6f 75 6c 64 20 74 | simulated.machine...She.should.t |
| 12eb60 | 68 65 6e 20 62 65 20 61 62 6c 65 20 74 6f 0a 20 20 20 20 20 63 6f 6e 74 69 6e 75 65 20 65 78 65 | hen.be.able.to......continue.exe |
| 12eb80 | 63 75 74 69 6f 6e 20 62 79 20 73 61 79 69 6e 67 0a 0a 20 20 20 20 20 20 20 20 20 20 28 70 72 6f | cution.by.saying............(pro |
| 12eba0 | 63 65 65 64 2d 6d 61 63 68 69 6e 65 20 3c 4d 41 43 48 49 4e 45 3e 29 0a 0a 20 20 20 20 20 53 68 | ceed-machine.<MACHINE>).......Sh |
| 12ebc0 | 65 20 73 68 6f 75 6c 64 20 61 6c 73 6f 20 62 65 20 61 62 6c 65 20 74 6f 20 72 65 6d 6f 76 65 20 | e.should.also.be.able.to.remove. |
| 12ebe0 | 61 20 73 70 65 63 69 66 69 63 20 62 72 65 61 6b 70 6f 69 6e 74 20 62 79 20 6d 65 61 6e 73 20 6f | a.specific.breakpoint.by.means.o |
| 12ec00 | 66 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 61 6e 63 65 6c 2d 62 72 65 61 6b 70 6f 69 6e 74 20 | f............(cancel-breakpoint. |
| 12ec20 | 3c 4d 41 43 48 49 4e 45 3e 20 3c 4c 41 42 45 4c 3e 20 3c 4e 3e 29 0a 0a 20 20 20 20 20 6f 72 20 | <MACHINE>.<LABEL>.<N>).......or. |
| 12ec40 | 74 6f 20 72 65 6d 6f 76 65 20 61 6c 6c 20 62 72 65 61 6b 70 6f 69 6e 74 73 20 62 79 20 6d 65 61 | to.remove.all.breakpoints.by.mea |
| 12ec60 | 6e 73 20 6f 66 0a 0a 20 20 20 20 20 20 20 20 20 20 28 63 61 6e 63 65 6c 2d 61 6c 6c 2d 62 72 65 | ns.of............(cancel-all-bre |
| 12ec80 | 61 6b 70 6f 69 6e 74 73 20 3c 4d 41 43 48 49 4e 45 3e 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 | akpoints.<MACHINE>)....File:.sic |
| 12eca0 | 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 33 2c 20 20 4e 65 78 74 3a 20 35 2d 34 2c 20 | p.info,..Node:.5-3,..Next:.5-4,. |
| 12ecc0 | 20 50 72 65 76 3a 20 35 2d 32 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 35 0a 0a 35 2e 33 20 | .Prev:.5-2,..Up:.Chapter.5..5.3. |
| 12ece0 | 53 74 6f 72 61 67 65 20 41 6c 6c 6f 63 61 74 69 6f 6e 20 61 6e 64 20 47 61 72 62 61 67 65 20 43 | Storage.Allocation.and.Garbage.C |
| 12ed00 | 6f 6c 6c 65 63 74 69 6f 6e 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | ollection.====================== |
| 12ed20 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 49 6e 20 73 65 63 74 | =======================..In.sect |
| 12ed40 | 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 34 3a 3a 2c 20 77 65 20 77 69 6c 6c 20 73 68 6f 77 20 68 6f | ion.*Note.5-4::,.we.will.show.ho |
| 12ed60 | 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 61 20 53 63 68 65 6d 65 0a 65 76 61 6c 75 61 74 6f | w.to.implement.a.Scheme.evaluato |
| 12ed80 | 72 20 61 73 20 61 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 2e 20 20 49 6e 20 6f 72 64 | r.as.a.register.machine...In.ord |
| 12eda0 | 65 72 20 74 6f 20 73 69 6d 70 6c 69 66 79 20 74 68 65 20 64 69 73 63 75 73 73 69 6f 6e 2c 0a 77 | er.to.simplify.the.discussion,.w |
| 12edc0 | 65 20 77 69 6c 6c 20 61 73 73 75 6d 65 20 74 68 61 74 20 6f 75 72 20 72 65 67 69 73 74 65 72 20 | e.will.assume.that.our.register. |
| 12ede0 | 6d 61 63 68 69 6e 65 73 20 63 61 6e 20 62 65 20 65 71 75 69 70 70 65 64 20 77 69 74 68 20 61 20 | machines.can.be.equipped.with.a. |
| 12ee00 | 22 6c 69 73 74 2d 73 74 72 75 63 74 75 72 65 64 0a 6d 65 6d 6f 72 79 22 2c 20 69 6e 20 77 68 69 | "list-structured.memory",.in.whi |
| 12ee20 | 63 68 20 74 68 65 20 62 61 73 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 6d 61 6e 69 | ch.the.basic.operations.for.mani |
| 12ee40 | 70 75 6c 61 74 69 6e 67 20 6c 69 73 74 2d 73 74 72 75 63 74 75 72 65 64 0a 64 61 74 61 20 61 72 | pulating.list-structured.data.ar |
| 12ee60 | 65 20 70 72 69 6d 69 74 69 76 65 2e 20 20 50 6f 73 74 75 6c 61 74 69 6e 67 20 74 68 65 20 65 78 | e.primitive...Postulating.the.ex |
| 12ee80 | 69 73 74 65 6e 63 65 20 6f 66 20 73 75 63 68 20 61 20 6d 65 6d 6f 72 79 20 69 73 20 61 0a 75 73 | istence.of.such.a.memory.is.a.us |
| 12eea0 | 65 66 75 6c 20 61 62 73 74 72 61 63 74 69 6f 6e 20 77 68 65 6e 20 6f 6e 65 20 69 73 20 66 6f 63 | eful.abstraction.when.one.is.foc |
| 12eec0 | 75 73 69 6e 67 20 6f 6e 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d 73 20 6f 66 20 63 6f 6e 74 72 | using.on.the.mechanisms.of.contr |
| 12eee0 | 6f 6c 20 69 6e 0a 61 20 53 63 68 65 6d 65 20 69 6e 74 65 72 70 72 65 74 65 72 2c 20 62 75 74 20 | ol.in.a.Scheme.interpreter,.but. |
| 12ef00 | 74 68 69 73 20 64 6f 65 73 20 6e 6f 74 20 72 65 66 6c 65 63 74 20 61 20 72 65 61 6c 69 73 74 69 | this.does.not.reflect.a.realisti |
| 12ef20 | 63 20 76 69 65 77 20 6f 66 20 74 68 65 0a 61 63 74 75 61 6c 20 70 72 69 6d 69 74 69 76 65 20 64 | c.view.of.the.actual.primitive.d |
| 12ef40 | 61 74 61 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 66 20 63 6f 6e 74 65 6d 70 6f 72 61 72 79 20 63 | ata.operations.of.contemporary.c |
| 12ef60 | 6f 6d 70 75 74 65 72 73 2e 20 20 54 6f 20 6f 62 74 61 69 6e 0a 61 20 6d 6f 72 65 20 63 6f 6d 70 | omputers...To.obtain.a.more.comp |
| 12ef80 | 6c 65 74 65 20 70 69 63 74 75 72 65 20 6f 66 20 68 6f 77 20 61 20 4c 69 73 70 20 73 79 73 74 65 | lete.picture.of.how.a.Lisp.syste |
| 12efa0 | 6d 20 6f 70 65 72 61 74 65 73 2c 20 77 65 20 6d 75 73 74 0a 69 6e 76 65 73 74 69 67 61 74 65 20 | m.operates,.we.must.investigate. |
| 12efc0 | 68 6f 77 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 20 63 61 6e 20 62 65 20 72 65 70 72 65 73 | how.list.structure.can.be.repres |
| 12efe0 | 65 6e 74 65 64 20 69 6e 20 61 20 77 61 79 20 74 68 61 74 20 69 73 0a 63 6f 6d 70 61 74 69 62 6c | ented.in.a.way.that.is.compatibl |
| 12f000 | 65 20 77 69 74 68 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 63 6f 6d 70 75 74 65 72 20 6d 65 6d | e.with.conventional.computer.mem |
| 12f020 | 6f 72 69 65 73 2e 0a 0a 20 20 20 54 68 65 72 65 20 61 72 65 20 74 77 6f 20 63 6f 6e 73 69 64 65 | ories......There.are.two.conside |
| 12f040 | 72 61 74 69 6f 6e 73 20 69 6e 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 6c 69 73 74 20 73 74 72 | rations.in.implementing.list.str |
| 12f060 | 75 63 74 75 72 65 2e 20 20 54 68 65 0a 66 69 72 73 74 20 69 73 20 70 75 72 65 6c 79 20 61 6e 20 | ucture...The.first.is.purely.an. |
| 12f080 | 69 73 73 75 65 20 6f 66 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 3a 20 68 6f 77 20 74 6f 20 | issue.of.representation:.how.to. |
| 12f0a0 | 72 65 70 72 65 73 65 6e 74 20 74 68 65 0a 22 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 22 20 | represent.the."box-and-pointer". |
| 12f0c0 | 73 74 72 75 63 74 75 72 65 20 6f 66 20 4c 69 73 70 20 70 61 69 72 73 2c 20 75 73 69 6e 67 20 6f | structure.of.Lisp.pairs,.using.o |
| 12f0e0 | 6e 6c 79 20 74 68 65 20 73 74 6f 72 61 67 65 20 61 6e 64 0a 61 64 64 72 65 73 73 69 6e 67 20 63 | nly.the.storage.and.addressing.c |
| 12f100 | 61 70 61 62 69 6c 69 74 69 65 73 20 6f 66 20 74 79 70 69 63 61 6c 20 63 6f 6d 70 75 74 65 72 20 | apabilities.of.typical.computer. |
| 12f120 | 6d 65 6d 6f 72 69 65 73 2e 20 20 54 68 65 20 73 65 63 6f 6e 64 20 69 73 73 75 65 0a 63 6f 6e 63 | memories...The.second.issue.conc |
| 12f140 | 65 72 6e 73 20 74 68 65 20 6d 61 6e 61 67 65 6d 65 6e 74 20 6f 66 20 6d 65 6d 6f 72 79 20 61 73 | erns.the.management.of.memory.as |
| 12f160 | 20 61 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 70 72 6f 63 65 65 64 73 2e 20 20 54 68 65 0a 6f 70 | .a.computation.proceeds...The.op |
| 12f180 | 65 72 61 74 69 6f 6e 20 6f 66 20 61 20 4c 69 73 70 20 73 79 73 74 65 6d 20 64 65 70 65 6e 64 73 | eration.of.a.Lisp.system.depends |
| 12f1a0 | 20 63 72 75 63 69 61 6c 6c 79 20 6f 6e 20 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 0a 63 6f 6e | .crucially.on.the.ability.to.con |
| 12f1c0 | 74 69 6e 75 61 6c 6c 79 20 63 72 65 61 74 65 20 6e 65 77 20 64 61 74 61 20 6f 62 6a 65 63 74 73 | tinually.create.new.data.objects |
| 12f1e0 | 2e 20 20 54 68 65 73 65 20 69 6e 63 6c 75 64 65 20 6f 62 6a 65 63 74 73 20 74 68 61 74 20 61 72 | ...These.include.objects.that.ar |
| 12f200 | 65 0a 65 78 70 6c 69 63 69 74 6c 79 20 63 72 65 61 74 65 64 20 62 79 20 74 68 65 20 4c 69 73 70 | e.explicitly.created.by.the.Lisp |
| 12f220 | 20 70 72 6f 63 65 64 75 72 65 73 20 62 65 69 6e 67 20 69 6e 74 65 72 70 72 65 74 65 64 20 61 73 | .procedures.being.interpreted.as |
| 12f240 | 20 77 65 6c 6c 20 61 73 0a 73 74 72 75 63 74 75 72 65 73 20 63 72 65 61 74 65 64 20 62 79 20 74 | .well.as.structures.created.by.t |
| 12f260 | 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 69 74 73 65 6c 66 2c 20 73 75 63 68 20 61 73 20 65 | he.interpreter.itself,.such.as.e |
| 12f280 | 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 61 6e 64 0a 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 73 2e 20 | nvironments.and.argument.lists.. |
| 12f2a0 | 20 41 6c 74 68 6f 75 67 68 20 74 68 65 20 63 6f 6e 73 74 61 6e 74 20 63 72 65 61 74 69 6f 6e 20 | .Although.the.constant.creation. |
| 12f2c0 | 6f 66 20 6e 65 77 20 64 61 74 61 20 6f 62 6a 65 63 74 73 0a 77 6f 75 6c 64 20 70 6f 73 65 20 6e | of.new.data.objects.would.pose.n |
| 12f2e0 | 6f 20 70 72 6f 62 6c 65 6d 20 6f 6e 20 61 20 63 6f 6d 70 75 74 65 72 20 77 69 74 68 20 61 6e 20 | o.problem.on.a.computer.with.an. |
| 12f300 | 69 6e 66 69 6e 69 74 65 20 61 6d 6f 75 6e 74 20 6f 66 20 72 61 70 69 64 6c 79 0a 61 64 64 72 65 | infinite.amount.of.rapidly.addre |
| 12f320 | 73 73 61 62 6c 65 20 6d 65 6d 6f 72 79 2c 20 63 6f 6d 70 75 74 65 72 20 6d 65 6d 6f 72 69 65 73 | ssable.memory,.computer.memories |
| 12f340 | 20 61 72 65 20 61 76 61 69 6c 61 62 6c 65 20 6f 6e 6c 79 20 69 6e 20 66 69 6e 69 74 65 0a 73 69 | .are.available.only.in.finite.si |
| 12f360 | 7a 65 73 20 28 6d 6f 72 65 27 73 20 74 68 65 20 70 69 74 79 29 2e 20 20 4c 69 73 70 20 73 79 73 | zes.(more's.the.pity)...Lisp.sys |
| 12f380 | 74 65 6d 73 20 74 68 75 73 20 70 72 6f 76 69 64 65 20 61 6e 20 22 61 75 74 6f 6d 61 74 69 63 0a | tems.thus.provide.an."automatic. |
| 12f3a0 | 73 74 6f 72 61 67 65 20 61 6c 6c 6f 63 61 74 69 6f 6e 22 20 66 61 63 69 6c 69 74 79 20 74 6f 20 | storage.allocation".facility.to. |
| 12f3c0 | 73 75 70 70 6f 72 74 20 74 68 65 20 69 6c 6c 75 73 69 6f 6e 20 6f 66 20 61 6e 20 69 6e 66 69 6e | support.the.illusion.of.an.infin |
| 12f3e0 | 69 74 65 0a 6d 65 6d 6f 72 79 2e 20 20 57 68 65 6e 20 61 20 64 61 74 61 20 6f 62 6a 65 63 74 20 | ite.memory...When.a.data.object. |
| 12f400 | 69 73 20 6e 6f 20 6c 6f 6e 67 65 72 20 6e 65 65 64 65 64 2c 20 74 68 65 20 6d 65 6d 6f 72 79 20 | is.no.longer.needed,.the.memory. |
| 12f420 | 61 6c 6c 6f 63 61 74 65 64 0a 74 6f 20 69 74 20 69 73 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 | allocated.to.it.is.automatically |
| 12f440 | 20 72 65 63 79 63 6c 65 64 20 61 6e 64 20 75 73 65 64 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 | .recycled.and.used.to.construct. |
| 12f460 | 6e 65 77 20 64 61 74 61 20 6f 62 6a 65 63 74 73 2e 0a 54 68 65 72 65 20 61 72 65 20 76 61 72 69 | new.data.objects..There.are.vari |
| 12f480 | 6f 75 73 20 74 65 63 68 6e 69 71 75 65 73 20 66 6f 72 20 70 72 6f 76 69 64 69 6e 67 20 73 75 63 | ous.techniques.for.providing.suc |
| 12f4a0 | 68 20 61 75 74 6f 6d 61 74 69 63 20 73 74 6f 72 61 67 65 0a 61 6c 6c 6f 63 61 74 69 6f 6e 2e 20 | h.automatic.storage.allocation.. |
| 12f4c0 | 20 54 68 65 20 6d 65 74 68 6f 64 20 77 65 20 73 68 61 6c 6c 20 64 69 73 63 75 73 73 20 69 6e 20 | .The.method.we.shall.discuss.in. |
| 12f4e0 | 74 68 69 73 20 73 65 63 74 69 6f 6e 20 69 73 20 63 61 6c 6c 65 64 20 22 67 61 72 62 61 67 65 0a | this.section.is.called."garbage. |
| 12f500 | 63 6f 6c 6c 65 63 74 69 6f 6e 22 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 35 2d 33 2d 31 3a 3a | collection"...*.Menu:..*.5-3-1:: |
| 12f520 | 20 20 20 20 20 20 20 20 20 20 20 20 4d 65 6d 6f 72 79 20 61 73 20 56 65 63 74 6f 72 73 0a 2a 20 | ............Memory.as.Vectors.*. |
| 12f540 | 35 2d 33 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4d 61 69 6e 74 61 69 6e 69 6e 67 20 74 | 5-3-2::............Maintaining.t |
| 12f560 | 68 65 20 49 6c 6c 75 73 69 6f 6e 20 6f 66 20 49 6e 66 69 6e 69 74 65 20 4d 65 6d 6f 72 79 0a 0a | he.Illusion.of.Infinite.Memory.. |
| 12f580 | 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 33 2d 31 2c | ..File:.sicp.info,..Node:.5-3-1, |
| 12f5a0 | 20 20 4e 65 78 74 3a 20 35 2d 33 2d 32 2c 20 20 50 72 65 76 3a 20 35 2d 33 2c 20 20 55 70 3a 20 | ..Next:.5-3-2,..Prev:.5-3,..Up:. |
| 12f5c0 | 35 2d 33 0a 0a 35 2e 33 2e 31 20 4d 65 6d 6f 72 79 20 61 73 20 56 65 63 74 6f 72 73 0a 2d 2d 2d | 5-3..5.3.1.Memory.as.Vectors.--- |
| 12f5e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 41 20 63 6f 6e 76 65 6e 74 69 | --------------------..A.conventi |
| 12f600 | 6f 6e 61 6c 20 63 6f 6d 70 75 74 65 72 20 6d 65 6d 6f 72 79 20 63 61 6e 20 62 65 20 74 68 6f 75 | onal.computer.memory.can.be.thou |
| 12f620 | 67 68 74 20 6f 66 20 61 73 20 61 6e 20 61 72 72 61 79 20 6f 66 0a 63 75 62 62 79 68 6f 6c 65 73 | ght.of.as.an.array.of.cubbyholes |
| 12f640 | 2c 20 65 61 63 68 20 6f 66 20 77 68 69 63 68 20 63 61 6e 20 63 6f 6e 74 61 69 6e 20 61 20 70 69 | ,.each.of.which.can.contain.a.pi |
| 12f660 | 65 63 65 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 20 20 45 61 63 68 0a 63 75 62 62 79 68 | ece.of.information...Each.cubbyh |
| 12f680 | 6f 6c 65 20 68 61 73 20 61 20 75 6e 69 71 75 65 20 6e 61 6d 65 2c 20 63 61 6c 6c 65 64 20 69 74 | ole.has.a.unique.name,.called.it |
| 12f6a0 | 73 20 22 61 64 64 72 65 73 73 22 20 6f 72 20 22 6c 6f 63 61 74 69 6f 6e 22 2e 0a 54 79 70 69 63 | s."address".or."location"..Typic |
| 12f6c0 | 61 6c 20 6d 65 6d 6f 72 79 20 73 79 73 74 65 6d 73 20 70 72 6f 76 69 64 65 20 74 77 6f 20 70 72 | al.memory.systems.provide.two.pr |
| 12f6e0 | 69 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 3a 20 6f 6e 65 20 74 68 61 74 0a 66 65 74 | imitive.operations:.one.that.fet |
| 12f700 | 63 68 65 73 20 74 68 65 20 64 61 74 61 20 73 74 6f 72 65 64 20 69 6e 20 61 20 73 70 65 63 69 66 | ches.the.data.stored.in.a.specif |
| 12f720 | 69 65 64 20 6c 6f 63 61 74 69 6f 6e 20 61 6e 64 20 6f 6e 65 20 74 68 61 74 20 61 73 73 69 67 6e | ied.location.and.one.that.assign |
| 12f740 | 73 0a 6e 65 77 20 64 61 74 61 20 74 6f 20 61 20 73 70 65 63 69 66 69 65 64 20 6c 6f 63 61 74 69 | s.new.data.to.a.specified.locati |
| 12f760 | 6f 6e 2e 20 20 4d 65 6d 6f 72 79 20 61 64 64 72 65 73 73 65 73 20 63 61 6e 20 62 65 20 69 6e 63 | on...Memory.addresses.can.be.inc |
| 12f780 | 72 65 6d 65 6e 74 65 64 0a 74 6f 20 73 75 70 70 6f 72 74 20 73 65 71 75 65 6e 74 69 61 6c 20 61 | remented.to.support.sequential.a |
| 12f7a0 | 63 63 65 73 73 20 74 6f 20 73 6f 6d 65 20 73 65 74 20 6f 66 20 74 68 65 20 63 75 62 62 79 68 6f | ccess.to.some.set.of.the.cubbyho |
| 12f7c0 | 6c 65 73 2e 20 20 4d 6f 72 65 0a 67 65 6e 65 72 61 6c 6c 79 2c 20 6d 61 6e 79 20 69 6d 70 6f 72 | les...More.generally,.many.impor |
| 12f7e0 | 74 61 6e 74 20 64 61 74 61 20 6f 70 65 72 61 74 69 6f 6e 73 20 72 65 71 75 69 72 65 20 74 68 61 | tant.data.operations.require.tha |
| 12f800 | 74 20 6d 65 6d 6f 72 79 20 61 64 64 72 65 73 73 65 73 0a 62 65 20 74 72 65 61 74 65 64 20 61 73 | t.memory.addresses.be.treated.as |
| 12f820 | 20 64 61 74 61 2c 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 73 74 6f 72 65 64 20 69 6e 20 6d 65 | .data,.which.can.be.stored.in.me |
| 12f840 | 6d 6f 72 79 20 6c 6f 63 61 74 69 6f 6e 73 20 61 6e 64 0a 6d 61 6e 69 70 75 6c 61 74 65 64 20 69 | mory.locations.and.manipulated.i |
| 12f860 | 6e 20 6d 61 63 68 69 6e 65 20 72 65 67 69 73 74 65 72 73 2e 20 20 54 68 65 20 72 65 70 72 65 73 | n.machine.registers...The.repres |
| 12f880 | 65 6e 74 61 74 69 6f 6e 20 6f 66 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 0a 69 73 20 6f 6e | entation.of.list.structure.is.on |
| 12f8a0 | 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 73 75 63 68 20 22 61 64 64 72 65 73 73 20 61 | e.application.of.such."address.a |
| 12f8c0 | 72 69 74 68 6d 65 74 69 63 22 2e 0a 0a 20 20 20 54 6f 20 6d 6f 64 65 6c 20 63 6f 6d 70 75 74 65 | rithmetic"......To.model.compute |
| 12f8e0 | 72 20 6d 65 6d 6f 72 79 2c 20 77 65 20 75 73 65 20 61 20 6e 65 77 20 6b 69 6e 64 20 6f 66 20 64 | r.memory,.we.use.a.new.kind.of.d |
| 12f900 | 61 74 61 20 73 74 72 75 63 74 75 72 65 20 63 61 6c 6c 65 64 0a 61 20 22 76 65 63 74 6f 72 22 2e | ata.structure.called.a."vector". |
| 12f920 | 20 20 41 62 73 74 72 61 63 74 6c 79 2c 20 61 20 76 65 63 74 6f 72 20 69 73 20 61 20 63 6f 6d 70 | ..Abstractly,.a.vector.is.a.comp |
| 12f940 | 6f 75 6e 64 20 64 61 74 61 20 6f 62 6a 65 63 74 20 77 68 6f 73 65 0a 69 6e 64 69 76 69 64 75 61 | ound.data.object.whose.individua |
| 12f960 | 6c 20 65 6c 65 6d 65 6e 74 73 20 63 61 6e 20 62 65 20 61 63 63 65 73 73 65 64 20 62 79 20 6d 65 | l.elements.can.be.accessed.by.me |
| 12f980 | 61 6e 73 20 6f 66 20 61 6e 20 69 6e 74 65 67 65 72 20 69 6e 64 65 78 20 69 6e 20 61 6e 0a 61 6d | ans.of.an.integer.index.in.an.am |
| 12f9a0 | 6f 75 6e 74 20 6f 66 20 74 69 6d 65 20 74 68 61 74 20 69 73 20 69 6e 64 65 70 65 6e 64 65 6e 74 | ount.of.time.that.is.independent |
| 12f9c0 | 20 6f 66 20 74 68 65 20 69 6e 64 65 78 2e 28 31 29 20 49 6e 20 6f 72 64 65 72 20 74 6f 0a 64 65 | .of.the.index.(1).In.order.to.de |
| 12f9e0 | 73 63 72 69 62 65 20 6d 65 6d 6f 72 79 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 77 65 20 75 73 65 | scribe.memory.operations,.we.use |
| 12fa00 | 20 74 77 6f 20 70 72 69 6d 69 74 69 76 65 20 53 63 68 65 6d 65 20 70 72 6f 63 65 64 75 72 65 73 | .two.primitive.Scheme.procedures |
| 12fa20 | 20 66 6f 72 0a 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 76 65 63 74 6f 72 73 3a 0a 0a 20 20 20 2a | .for.manipulating.vectors:.....* |
| 12fa40 | 20 60 28 76 65 63 74 6f 72 2d 72 65 66 20 3c 56 45 43 54 4f 52 3e 20 3c 4e 3e 29 27 20 72 65 74 | .`(vector-ref.<VECTOR>.<N>)'.ret |
| 12fa60 | 75 72 6e 73 20 74 68 65 20 6e 74 68 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 76 65 63 74 | urns.the.nth.element.of.the.vect |
| 12fa80 | 6f 72 2e 0a 0a 20 20 20 2a 20 60 28 76 65 63 74 6f 72 2d 73 65 74 21 20 3c 56 45 43 54 4f 52 3e | or......*.`(vector-set!.<VECTOR> |
| 12faa0 | 20 3c 4e 3e 20 3c 56 41 4c 55 45 3e 29 27 20 73 65 74 73 20 74 68 65 20 6e 74 68 20 65 6c 65 6d | .<N>.<VALUE>)'.sets.the.nth.elem |
| 12fac0 | 65 6e 74 20 6f 66 20 74 68 65 0a 20 20 20 20 20 76 65 63 74 6f 72 20 74 6f 20 74 68 65 20 64 65 | ent.of.the......vector.to.the.de |
| 12fae0 | 73 69 67 6e 61 74 65 64 20 76 61 6c 75 65 2e 0a 0a 0a 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 | signated.value.......For.example |
| 12fb00 | 2c 20 69 66 20 60 76 27 20 69 73 20 61 20 76 65 63 74 6f 72 2c 20 74 68 65 6e 20 60 28 76 65 63 | ,.if.`v'.is.a.vector,.then.`(vec |
| 12fb20 | 74 6f 72 2d 72 65 66 20 76 20 35 29 27 20 67 65 74 73 20 74 68 65 0a 66 69 66 74 68 20 65 6e 74 | tor-ref.v.5)'.gets.the.fifth.ent |
| 12fb40 | 72 79 20 69 6e 20 74 68 65 20 76 65 63 74 6f 72 20 60 76 27 20 61 6e 64 20 60 28 76 65 63 74 6f | ry.in.the.vector.`v'.and.`(vecto |
| 12fb60 | 72 2d 73 65 74 21 20 76 20 35 20 37 29 27 20 63 68 61 6e 67 65 73 20 74 68 65 0a 76 61 6c 75 65 | r-set!.v.5.7)'.changes.the.value |
| 12fb80 | 20 6f 66 20 74 68 65 20 66 69 66 74 68 20 65 6e 74 72 79 20 6f 66 20 74 68 65 20 76 65 63 74 6f | .of.the.fifth.entry.of.the.vecto |
| 12fba0 | 72 20 60 76 27 20 74 6f 20 37 2e 28 32 29 20 20 46 6f 72 20 63 6f 6d 70 75 74 65 72 0a 6d 65 6d | r.`v'.to.7.(2)..For.computer.mem |
| 12fbc0 | 6f 72 79 2c 20 74 68 69 73 20 61 63 63 65 73 73 20 63 61 6e 20 62 65 20 69 6d 70 6c 65 6d 65 6e | ory,.this.access.can.be.implemen |
| 12fbe0 | 74 65 64 20 74 68 72 6f 75 67 68 20 74 68 65 20 75 73 65 20 6f 66 20 61 64 64 72 65 73 73 0a 61 | ted.through.the.use.of.address.a |
| 12fc00 | 72 69 74 68 6d 65 74 69 63 20 74 6f 20 63 6f 6d 62 69 6e 65 20 61 20 61 64 64 72 65 73 73 20 22 | rithmetic.to.combine.a.address." |
| 12fc20 | 62 61 73 65 20 61 64 64 72 65 73 73 22 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 74 68 65 | base.address".that.specifies.the |
| 12fc40 | 0a 62 65 67 69 6e 6e 69 6e 67 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 61 20 76 65 63 74 6f 72 20 | .beginning.location.of.a.vector. |
| 12fc60 | 69 6e 20 6d 65 6d 6f 72 79 20 77 69 74 68 20 61 6e 20 22 69 6e 64 65 78 22 20 74 68 61 74 20 73 | in.memory.with.an."index".that.s |
| 12fc80 | 70 65 63 69 66 69 65 73 0a 74 68 65 20 6f 66 66 73 65 74 20 6f 66 20 61 20 70 61 72 74 69 63 75 | pecifies.the.offset.of.a.particu |
| 12fca0 | 6c 61 72 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 76 65 63 74 6f 72 2e 0a 0a 52 65 70 72 | lar.element.of.the.vector...Repr |
| 12fcc0 | 65 73 65 6e 74 69 6e 67 20 4c 69 73 70 20 64 61 74 61 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | esenting.Lisp.data.............. |
| 12fce0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 65 20 63 61 6e 20 75 73 65 20 76 65 63 74 6f 72 73 20 74 6f | ...........We.can.use.vectors.to |
| 12fd00 | 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 62 61 73 69 63 20 70 61 69 72 20 73 74 72 75 63 74 | .implement.the.basic.pair.struct |
| 12fd20 | 75 72 65 73 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 61 0a 6c 69 73 74 2d 73 74 72 75 63 74 75 | ures.required.for.a.list-structu |
| 12fd40 | 72 65 64 20 6d 65 6d 6f 72 79 2e 20 20 4c 65 74 20 75 73 20 69 6d 61 67 69 6e 65 20 74 68 61 74 | red.memory...Let.us.imagine.that |
| 12fd60 | 20 63 6f 6d 70 75 74 65 72 20 6d 65 6d 6f 72 79 20 69 73 20 64 69 76 69 64 65 64 0a 69 6e 74 6f | .computer.memory.is.divided.into |
| 12fd80 | 20 74 77 6f 20 76 65 63 74 6f 72 73 3a 20 60 74 68 65 2d 63 61 72 73 27 20 61 6e 64 20 60 74 68 | .two.vectors:.`the-cars'.and.`th |
| 12fda0 | 65 2d 63 64 72 73 27 2e 20 20 57 65 20 77 69 6c 6c 20 72 65 70 72 65 73 65 6e 74 20 6c 69 73 74 | e-cdrs'...We.will.represent.list |
| 12fdc0 | 0a 73 74 72 75 63 74 75 72 65 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 20 41 20 70 6f 69 6e 74 65 72 | .structure.as.follows:.A.pointer |
| 12fde0 | 20 74 6f 20 61 20 70 61 69 72 20 69 73 20 61 6e 20 69 6e 64 65 78 20 69 6e 74 6f 20 74 68 65 20 | .to.a.pair.is.an.index.into.the. |
| 12fe00 | 74 77 6f 0a 76 65 63 74 6f 72 73 2e 20 20 54 68 65 20 60 63 61 72 27 20 6f 66 20 74 68 65 20 70 | two.vectors...The.`car'.of.the.p |
| 12fe20 | 61 69 72 20 69 73 20 74 68 65 20 65 6e 74 72 79 20 69 6e 20 60 74 68 65 2d 63 61 72 73 27 20 77 | air.is.the.entry.in.`the-cars'.w |
| 12fe40 | 69 74 68 20 74 68 65 0a 64 65 73 69 67 6e 61 74 65 64 20 69 6e 64 65 78 2c 20 61 6e 64 20 74 68 | ith.the.designated.index,.and.th |
| 12fe60 | 65 20 60 63 64 72 27 20 6f 66 20 74 68 65 20 70 61 69 72 20 69 73 20 74 68 65 20 65 6e 74 72 79 | e.`cdr'.of.the.pair.is.the.entry |
| 12fe80 | 20 69 6e 20 60 74 68 65 2d 63 64 72 73 27 0a 77 69 74 68 20 74 68 65 20 64 65 73 69 67 6e 61 74 | .in.`the-cdrs'.with.the.designat |
| 12fea0 | 65 64 20 69 6e 64 65 78 2e 20 20 57 65 20 61 6c 73 6f 20 6e 65 65 64 20 61 20 72 65 70 72 65 73 | ed.index...We.also.need.a.repres |
| 12fec0 | 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 6f 62 6a 65 63 74 73 0a 6f 74 68 65 72 20 74 68 61 6e 20 | entation.for.objects.other.than. |
| 12fee0 | 70 61 69 72 73 20 28 73 75 63 68 20 61 73 20 6e 75 6d 62 65 72 73 20 61 6e 64 20 73 79 6d 62 6f | pairs.(such.as.numbers.and.symbo |
| 12ff00 | 6c 73 29 20 61 6e 64 20 61 20 77 61 79 20 74 6f 20 64 69 73 74 69 6e 67 75 69 73 68 0a 6f 6e 65 | ls).and.a.way.to.distinguish.one |
| 12ff20 | 20 6b 69 6e 64 20 6f 66 20 64 61 74 61 20 66 72 6f 6d 20 61 6e 6f 74 68 65 72 2e 20 20 54 68 65 | .kind.of.data.from.another...The |
| 12ff40 | 72 65 20 61 72 65 20 6d 61 6e 79 20 6d 65 74 68 6f 64 73 20 6f 66 20 61 63 63 6f 6d 70 6c 69 73 | re.are.many.methods.of.accomplis |
| 12ff60 | 68 69 6e 67 0a 74 68 69 73 2c 20 62 75 74 20 74 68 65 79 20 61 6c 6c 20 72 65 64 75 63 65 20 74 | hing.this,.but.they.all.reduce.t |
| 12ff80 | 6f 20 75 73 69 6e 67 20 22 74 79 70 65 64 20 70 6f 69 6e 74 65 72 73 22 2c 20 74 68 61 74 20 69 | o.using."typed.pointers",.that.i |
| 12ffa0 | 73 2c 20 74 6f 0a 65 78 74 65 6e 64 69 6e 67 20 74 68 65 20 6e 6f 74 69 6f 6e 20 6f 66 20 22 70 | s,.to.extending.the.notion.of."p |
| 12ffc0 | 6f 69 6e 74 65 72 22 20 74 6f 20 69 6e 63 6c 75 64 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f | ointer".to.include.information.o |
| 12ffe0 | 6e 20 64 61 74 61 0a 74 79 70 65 2e 28 33 29 20 54 68 65 20 64 61 74 61 20 74 79 70 65 20 65 6e | n.data.type.(3).The.data.type.en |
| 130000 | 61 62 6c 65 73 20 74 68 65 20 73 79 73 74 65 6d 20 74 6f 20 64 69 73 74 69 6e 67 75 69 73 68 20 | ables.the.system.to.distinguish. |
| 130020 | 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 0a 70 61 69 72 20 28 77 68 69 63 68 20 63 6f 6e 73 69 | a.pointer.to.a.pair.(which.consi |
| 130040 | 73 74 73 20 6f 66 20 74 68 65 20 22 70 61 69 72 22 20 64 61 74 61 20 74 79 70 65 20 61 6e 64 20 | sts.of.the."pair".data.type.and. |
| 130060 | 61 6e 20 69 6e 64 65 78 20 69 6e 74 6f 20 74 68 65 0a 6d 65 6d 6f 72 79 20 76 65 63 74 6f 72 73 | an.index.into.the.memory.vectors |
| 130080 | 29 20 66 72 6f 6d 20 70 6f 69 6e 74 65 72 73 20 74 6f 20 6f 74 68 65 72 20 6b 69 6e 64 73 20 6f | ).from.pointers.to.other.kinds.o |
| 1300a0 | 66 20 64 61 74 61 20 28 77 68 69 63 68 20 63 6f 6e 73 69 73 74 20 6f 66 0a 73 6f 6d 65 20 6f 74 | f.data.(which.consist.of.some.ot |
| 1300c0 | 68 65 72 20 64 61 74 61 20 74 79 70 65 20 61 6e 64 20 77 68 61 74 65 76 65 72 20 69 73 20 62 65 | her.data.type.and.whatever.is.be |
| 1300e0 | 69 6e 67 20 75 73 65 64 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 64 61 74 61 20 6f 66 0a 74 68 | ing.used.to.represent.data.of.th |
| 130100 | 61 74 20 74 79 70 65 29 2e 20 20 54 77 6f 20 64 61 74 61 20 6f 62 6a 65 63 74 73 20 61 72 65 20 | at.type)...Two.data.objects.are. |
| 130120 | 63 6f 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65 20 74 68 65 20 73 61 6d 65 20 28 60 65 71 3f 27 | considered.to.be.the.same.(`eq?' |
| 130140 | 29 20 69 66 0a 74 68 65 69 72 20 70 6f 69 6e 74 65 72 73 20 61 72 65 20 69 64 65 6e 74 69 63 61 | ).if.their.pointers.are.identica |
| 130160 | 6c 2e 28 34 29 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 34 3a 3a 20 69 6c 6c 75 73 74 | l.(4).*Note.Figure.5-14::.illust |
| 130180 | 72 61 74 65 73 20 74 68 65 0a 75 73 65 20 6f 66 20 74 68 69 73 20 6d 65 74 68 6f 64 20 74 6f 20 | rates.the.use.of.this.method.to. |
| 1301a0 | 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 6c 69 73 74 20 60 28 28 31 20 32 29 20 33 20 34 29 27 | represent.the.list.`((1.2).3.4)' |
| 1301c0 | 2c 20 77 68 6f 73 65 0a 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 20 64 69 61 67 72 61 6d 20 | ,.whose.box-and-pointer.diagram. |
| 1301e0 | 69 73 20 61 6c 73 6f 20 73 68 6f 77 6e 2e 20 20 57 65 20 75 73 65 20 6c 65 74 74 65 72 20 70 72 | is.also.shown...We.use.letter.pr |
| 130200 | 65 66 69 78 65 73 20 74 6f 0a 64 65 6e 6f 74 65 20 74 68 65 20 64 61 74 61 2d 74 79 70 65 20 69 | efixes.to.denote.the.data-type.i |
| 130220 | 6e 66 6f 72 6d 61 74 69 6f 6e 2e 20 20 54 68 75 73 2c 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 | nformation...Thus,.a.pointer.to. |
| 130240 | 74 68 65 20 70 61 69 72 20 77 69 74 68 0a 69 6e 64 65 78 20 35 20 69 73 20 64 65 6e 6f 74 65 64 | the.pair.with.index.5.is.denoted |
| 130260 | 20 60 70 35 27 2c 20 74 68 65 20 65 6d 70 74 79 20 6c 69 73 74 20 69 73 20 64 65 6e 6f 74 65 64 | .`p5',.the.empty.list.is.denoted |
| 130280 | 20 62 79 20 74 68 65 20 70 6f 69 6e 74 65 72 20 60 65 30 27 2c 0a 61 6e 64 20 61 20 70 6f 69 6e | .by.the.pointer.`e0',.and.a.poin |
| 1302a0 | 74 65 72 20 74 6f 20 74 68 65 20 6e 75 6d 62 65 72 20 34 20 69 73 20 64 65 6e 6f 74 65 64 20 60 | ter.to.the.number.4.is.denoted.` |
| 1302c0 | 6e 34 27 2e 20 20 49 6e 20 74 68 65 20 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 0a 64 69 61 | n4'...In.the.box-and-pointer.dia |
| 1302e0 | 67 72 61 6d 2c 20 77 65 20 68 61 76 65 20 69 6e 64 69 63 61 74 65 64 20 61 74 20 74 68 65 20 6c | gram,.we.have.indicated.at.the.l |
| 130300 | 6f 77 65 72 20 6c 65 66 74 20 6f 66 20 65 61 63 68 20 70 61 69 72 20 74 68 65 20 76 65 63 74 6f | ower.left.of.each.pair.the.vecto |
| 130320 | 72 0a 69 6e 64 65 78 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 77 68 65 72 65 20 74 68 65 | r.index.that.specifies.where.the |
| 130340 | 20 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 20 6f 66 20 74 68 65 20 70 61 69 72 20 61 72 65 | .`car'.and.`cdr'.of.the.pair.are |
| 130360 | 20 73 74 6f 72 65 64 2e 0a 54 68 65 20 62 6c 61 6e 6b 20 6c 6f 63 61 74 69 6f 6e 73 20 69 6e 20 | .stored..The.blank.locations.in. |
| 130380 | 60 74 68 65 2d 63 61 72 73 27 20 61 6e 64 20 60 74 68 65 2d 63 64 72 73 27 20 6d 61 79 20 63 6f | `the-cars'.and.`the-cdrs'.may.co |
| 1303a0 | 6e 74 61 69 6e 20 70 61 72 74 73 20 6f 66 0a 6f 74 68 65 72 20 6c 69 73 74 20 73 74 72 75 63 74 | ntain.parts.of.other.list.struct |
| 1303c0 | 75 72 65 73 20 28 6e 6f 74 20 6f 66 20 69 6e 74 65 72 65 73 74 20 68 65 72 65 29 2e 0a 0a 20 20 | ures.(not.of.interest.here)..... |
| 1303e0 | 20 20 20 2a 46 69 67 75 72 65 20 35 2e 31 34 3a 2a 20 42 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 | ...*Figure.5.14:*.Box-and-pointe |
| 130400 | 72 20 61 6e 64 20 6d 65 6d 6f 72 79 2d 76 65 63 74 6f 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 | r.and.memory-vector.representati |
| 130420 | 6f 6e 73 0a 20 20 20 20 20 6f 66 20 74 68 65 20 6c 69 73 74 20 60 28 28 31 20 32 29 20 33 20 34 | ons......of.the.list.`((1.2).3.4 |
| 130440 | 29 27 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d | )'............................+- |
| 130460 | 2d 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 | --+---+...............+---+---+. |
| 130480 | 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 28 28 31 20 32 29 20 33 20 | ...+---+---+...........((1.2).3. |
| 1304a0 | 34 29 20 2d 2d 3e 7c 20 2a 20 7c 20 2a 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 3e 7c 20 | 4).-->|.*.|.*-+-------------->|. |
| 1304c0 | 2a 20 7c 20 2a 2d 2b 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 | *.|.*-+--->|.*.|./.|............ |
| 1304e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 20 | ..............+-|-+---+......... |
| 130500 | 20 20 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 0a 20 20 20 | ......+-|-+---+....+-|-+---+.... |
| 130520 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 20 20 7c 20 20 20 20 20 20 20 | .....................1..|....... |
| 130540 | 20 20 20 20 20 20 20 20 20 20 20 20 20 32 20 20 7c 20 20 20 20 20 20 20 20 20 34 20 20 7c 0a 20 | .............2..|.........4..|.. |
| 130560 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 | ..........................V..... |
| 130580 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 56 | ..................V............V |
| 1305a0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 2d | ..........................+---+- |
| 1305c0 | 2d 2d 2b 20 20 20 20 2b 2d 2d 2d 2b 2d 2d 2d 2b 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b | --+....+---+---+..+---+........+ |
| 1305e0 | 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ---+..........................|. |
| 130600 | 2a 20 7c 20 2a 2d 2b 2d 2d 2d 3e 7c 20 2a 20 7c 20 2f 20 7c 20 20 7c 20 33 20 7c 20 20 20 20 20 | *.|.*-+--->|.*.|./.|..|.3.|..... |
| 130620 | 20 20 20 7c 20 34 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...|.4.|........................ |
| 130640 | 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 20 20 2b 2d 7c 2d 2b 2d 2d 2d 2b 20 20 2b 2d 2d 2d 2b 20 | ..+-|-+---+....+-|-+---+..+---+. |
| 130660 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......+---+.................... |
| 130680 | 20 20 20 20 20 35 20 20 7c 20 20 20 20 20 20 20 20 20 37 20 20 7c 0a 20 20 20 20 20 20 20 20 20 | .....5..|.........7..|.......... |
| 1306a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 56 20 20 20 20 20 20 20 20 20 20 20 20 56 | ..................V............V |
| 1306c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 | ..........................+---+. |
| 1306e0 | 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......+---+.................... |
| 130700 | 20 20 20 20 20 20 7c 20 31 20 7c 20 20 20 20 20 20 20 20 7c 20 32 20 7c 0a 20 20 20 20 20 20 20 | ......|.1.|........|.2.|........ |
| 130720 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2b 20 20 20 20 20 20 20 20 2b | ..................+---+........+ |
| 130740 | 2d 2d 2d 2b 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 49 6e 64 65 78 20 20 20 30 20 20 20 20 | ---+...............Index...0.... |
| 130760 | 31 20 20 20 20 32 20 20 20 20 33 20 20 20 20 34 20 20 20 20 35 20 20 20 20 36 20 20 20 20 37 20 | 1....2....3....4....5....6....7. |
| 130780 | 20 20 20 38 20 20 20 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b | ...8...........................+ |
| 1307a0 | 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d | ----+----+----+----+----+----+-- |
| 1307c0 | 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 2d | --+----+----+----...........the- |
| 1307e0 | 63 61 72 73 20 7c 20 20 20 20 7c 20 70 35 20 7c 20 6e 33 20 7c 20 20 20 20 7c 20 6e 34 20 7c 20 | cars.|....|.p5.|.n3.|....|.n4.|. |
| 130800 | 6e 31 20 7c 20 20 20 20 7c 20 6e 32 20 7c 20 20 20 20 7c 20 2e 2e 2e 0a 20 20 20 20 20 20 20 20 | n1.|....|.n2.|....|............. |
| 130820 | 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b | ...........+----+----+----+----+ |
| 130840 | 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 0a 20 20 | ----+----+----+----+----+----... |
| 130860 | 20 20 20 20 20 20 20 20 74 68 65 2d 63 64 72 73 20 7c 20 20 20 20 7c 20 70 32 20 7c 20 70 34 20 | ........the-cdrs.|....|.p2.|.p4. |
| 130880 | 7c 20 20 20 20 7c 20 65 30 20 7c 20 70 37 20 7c 20 20 20 20 7c 20 65 30 20 7c 20 20 20 20 7c 20 | |....|.e0.|.p7.|....|.e0.|....|. |
| 1308a0 | 2e 2e 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2b 2d 2d 2d | .......................+----+--- |
| 1308c0 | 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b 2d 2d 2d 2d 2b | -+----+----+----+----+----+----+ |
| 1308e0 | 2d 2d 2d 2d 2b 2d 2d 2d 2d 0a 0a 20 20 20 41 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 20 6e 75 6d | ----+----.....A.pointer.to.a.num |
| 130900 | 62 65 72 2c 20 73 75 63 68 20 61 73 20 60 6e 34 27 2c 20 6d 69 67 68 74 20 63 6f 6e 73 69 73 74 | ber,.such.as.`n4',.might.consist |
| 130920 | 20 6f 66 20 61 20 74 79 70 65 0a 69 6e 64 69 63 61 74 69 6e 67 20 6e 75 6d 65 72 69 63 20 64 61 | .of.a.type.indicating.numeric.da |
| 130940 | 74 61 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 20 61 63 74 75 61 6c 20 72 65 70 72 | ta.together.with.the.actual.repr |
| 130960 | 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 0a 6e 75 6d 62 65 72 20 34 2e 28 35 29 20 20 | esentation.of.the.number.4.(5).. |
| 130980 | 54 6f 20 64 65 61 6c 20 77 69 74 68 20 6e 75 6d 62 65 72 73 20 74 68 61 74 20 61 72 65 20 74 6f | To.deal.with.numbers.that.are.to |
| 1309a0 | 6f 20 6c 61 72 67 65 20 74 6f 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 0a 69 6e 20 74 68 65 | o.large.to.be.represented.in.the |
| 1309c0 | 20 66 69 78 65 64 20 61 6d 6f 75 6e 74 20 6f 66 20 73 70 61 63 65 20 61 6c 6c 6f 63 61 74 65 64 | .fixed.amount.of.space.allocated |
| 1309e0 | 20 66 6f 72 20 61 20 73 69 6e 67 6c 65 20 70 6f 69 6e 74 65 72 2c 20 77 65 20 63 6f 75 6c 64 0a | .for.a.single.pointer,.we.could. |
| 130a00 | 75 73 65 20 61 20 64 69 73 74 69 6e 63 74 20 22 62 69 67 6e 75 6d 22 20 64 61 74 61 20 74 79 70 | use.a.distinct."bignum".data.typ |
| 130a20 | 65 2c 20 66 6f 72 20 77 68 69 63 68 20 74 68 65 20 70 6f 69 6e 74 65 72 20 64 65 73 69 67 6e 61 | e,.for.which.the.pointer.designa |
| 130a40 | 74 65 73 20 61 0a 6c 69 73 74 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 70 61 72 74 73 20 6f 66 | tes.a.list.in.which.the.parts.of |
| 130a60 | 20 74 68 65 20 6e 75 6d 62 65 72 20 61 72 65 20 73 74 6f 72 65 64 2e 28 36 29 0a 0a 20 20 20 41 | .the.number.are.stored.(6).....A |
| 130a80 | 20 73 79 6d 62 6f 6c 20 6d 69 67 68 74 20 62 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 | .symbol.might.be.represented.as. |
| 130aa0 | 61 20 74 79 70 65 64 20 70 6f 69 6e 74 65 72 20 74 68 61 74 20 64 65 73 69 67 6e 61 74 65 73 20 | a.typed.pointer.that.designates. |
| 130ac0 | 61 0a 73 65 71 75 65 6e 63 65 20 6f 66 20 74 68 65 20 63 68 61 72 61 63 74 65 72 73 20 74 68 61 | a.sequence.of.the.characters.tha |
| 130ae0 | 74 20 66 6f 72 6d 20 74 68 65 20 73 79 6d 62 6f 6c 27 73 20 70 72 69 6e 74 65 64 0a 72 65 70 72 | t.form.the.symbol's.printed.repr |
| 130b00 | 65 73 65 6e 74 61 74 69 6f 6e 2e 20 20 54 68 69 73 20 73 65 71 75 65 6e 63 65 20 69 73 20 63 6f | esentation...This.sequence.is.co |
| 130b20 | 6e 73 74 72 75 63 74 65 64 20 62 79 20 74 68 65 20 4c 69 73 70 20 72 65 61 64 65 72 20 77 68 65 | nstructed.by.the.Lisp.reader.whe |
| 130b40 | 6e 0a 74 68 65 20 63 68 61 72 61 63 74 65 72 20 73 74 72 69 6e 67 20 69 73 20 69 6e 69 74 69 61 | n.the.character.string.is.initia |
| 130b60 | 6c 6c 79 20 65 6e 63 6f 75 6e 74 65 72 65 64 20 69 6e 20 69 6e 70 75 74 2e 20 20 53 69 6e 63 65 | lly.encountered.in.input...Since |
| 130b80 | 20 77 65 20 77 61 6e 74 0a 74 77 6f 20 69 6e 73 74 61 6e 63 65 73 20 6f 66 20 61 20 73 79 6d 62 | .we.want.two.instances.of.a.symb |
| 130ba0 | 6f 6c 20 74 6f 20 62 65 20 72 65 63 6f 67 6e 69 7a 65 64 20 61 73 20 74 68 65 20 22 73 61 6d 65 | ol.to.be.recognized.as.the."same |
| 130bc0 | 22 20 73 79 6d 62 6f 6c 20 62 79 0a 60 65 71 3f 27 20 61 6e 64 20 77 65 20 77 61 6e 74 20 60 65 | ".symbol.by.`eq?'.and.we.want.`e |
| 130be0 | 71 3f 27 20 74 6f 20 62 65 20 61 20 73 69 6d 70 6c 65 20 74 65 73 74 20 66 6f 72 20 65 71 75 61 | q?'.to.be.a.simple.test.for.equa |
| 130c00 | 6c 69 74 79 20 6f 66 20 70 6f 69 6e 74 65 72 73 2c 0a 77 65 20 6d 75 73 74 20 65 6e 73 75 72 65 | lity.of.pointers,.we.must.ensure |
| 130c20 | 20 74 68 61 74 20 69 66 20 74 68 65 20 72 65 61 64 65 72 20 73 65 65 73 20 74 68 65 20 73 61 6d | .that.if.the.reader.sees.the.sam |
| 130c40 | 65 20 63 68 61 72 61 63 74 65 72 20 73 74 72 69 6e 67 20 74 77 69 63 65 2c 0a 69 74 20 77 69 6c | e.character.string.twice,.it.wil |
| 130c60 | 6c 20 75 73 65 20 74 68 65 20 73 61 6d 65 20 70 6f 69 6e 74 65 72 20 28 74 6f 20 74 68 65 20 73 | l.use.the.same.pointer.(to.the.s |
| 130c80 | 61 6d 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 63 68 61 72 61 63 74 65 72 73 29 20 74 6f 0a 72 | ame.sequence.of.characters).to.r |
| 130ca0 | 65 70 72 65 73 65 6e 74 20 62 6f 74 68 20 6f 63 63 75 72 72 65 6e 63 65 73 2e 20 20 54 6f 20 61 | epresent.both.occurrences...To.a |
| 130cc0 | 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 2c 20 74 68 65 20 72 65 61 64 65 72 20 6d 61 69 6e 74 | ccomplish.this,.the.reader.maint |
| 130ce0 | 61 69 6e 73 20 61 0a 74 61 62 6c 65 2c 20 74 72 61 64 69 74 69 6f 6e 61 6c 6c 79 20 63 61 6c 6c | ains.a.table,.traditionally.call |
| 130d00 | 65 64 20 74 68 65 20 22 6f 62 61 72 72 61 79 22 2c 20 6f 66 20 61 6c 6c 20 74 68 65 20 73 79 6d | ed.the."obarray",.of.all.the.sym |
| 130d20 | 62 6f 6c 73 20 69 74 20 68 61 73 0a 65 76 65 72 20 65 6e 63 6f 75 6e 74 65 72 65 64 2e 20 20 57 | bols.it.has.ever.encountered...W |
| 130d40 | 68 65 6e 20 74 68 65 20 72 65 61 64 65 72 20 65 6e 63 6f 75 6e 74 65 72 73 20 61 20 63 68 61 72 | hen.the.reader.encounters.a.char |
| 130d60 | 61 63 74 65 72 20 73 74 72 69 6e 67 20 61 6e 64 20 69 73 0a 61 62 6f 75 74 20 74 6f 20 63 6f 6e | acter.string.and.is.about.to.con |
| 130d80 | 73 74 72 75 63 74 20 61 20 73 79 6d 62 6f 6c 2c 20 69 74 20 63 68 65 63 6b 73 20 74 68 65 20 6f | struct.a.symbol,.it.checks.the.o |
| 130da0 | 62 61 72 72 61 79 20 74 6f 20 73 65 65 20 69 66 20 69 74 20 68 61 73 20 65 76 65 72 0a 62 65 66 | barray.to.see.if.it.has.ever.bef |
| 130dc0 | 6f 72 65 20 73 65 65 6e 20 74 68 65 20 73 61 6d 65 20 63 68 61 72 61 63 74 65 72 20 73 74 72 69 | ore.seen.the.same.character.stri |
| 130de0 | 6e 67 2e 20 20 49 66 20 69 74 20 68 61 73 20 6e 6f 74 2c 20 69 74 20 75 73 65 73 20 74 68 65 0a | ng...If.it.has.not,.it.uses.the. |
| 130e00 | 63 68 61 72 61 63 74 65 72 73 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 61 20 6e 65 77 20 73 79 | characters.to.construct.a.new.sy |
| 130e20 | 6d 62 6f 6c 20 28 61 20 74 79 70 65 64 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 20 6e 65 77 0a 63 | mbol.(a.typed.pointer.to.a.new.c |
| 130e40 | 68 61 72 61 63 74 65 72 20 73 65 71 75 65 6e 63 65 29 20 61 6e 64 20 65 6e 74 65 72 73 20 74 68 | haracter.sequence).and.enters.th |
| 130e60 | 69 73 20 70 6f 69 6e 74 65 72 20 69 6e 20 74 68 65 20 6f 62 61 72 72 61 79 2e 20 20 49 66 20 74 | is.pointer.in.the.obarray...If.t |
| 130e80 | 68 65 0a 72 65 61 64 65 72 20 68 61 73 20 73 65 65 6e 20 74 68 65 20 73 74 72 69 6e 67 20 62 65 | he.reader.has.seen.the.string.be |
| 130ea0 | 66 6f 72 65 2c 20 69 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 79 6d 62 6f 6c 20 70 6f 69 6e | fore,.it.returns.the.symbol.poin |
| 130ec0 | 74 65 72 20 73 74 6f 72 65 64 0a 69 6e 20 74 68 65 20 6f 62 61 72 72 61 79 2e 20 20 54 68 69 73 | ter.stored.in.the.obarray...This |
| 130ee0 | 20 70 72 6f 63 65 73 73 20 6f 66 20 72 65 70 6c 61 63 69 6e 67 20 63 68 61 72 61 63 74 65 72 20 | .process.of.replacing.character. |
| 130f00 | 73 74 72 69 6e 67 73 20 62 79 20 75 6e 69 71 75 65 0a 70 6f 69 6e 74 65 72 73 20 69 73 20 63 61 | strings.by.unique.pointers.is.ca |
| 130f20 | 6c 6c 65 64 20 22 69 6e 74 65 72 6e 69 6e 67 22 20 73 79 6d 62 6f 6c 73 2e 0a 0a 49 6d 70 6c 65 | lled."interning".symbols...Imple |
| 130f40 | 6d 65 6e 74 69 6e 67 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 6c 69 73 74 20 6f 70 65 72 61 | menting.the.primitive.list.opera |
| 130f60 | 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | tions........................... |
| 130f80 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 47 69 76 65 6e 20 74 68 65 20 61 62 6f 76 | ..................Given.the.abov |
| 130fa0 | 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 73 63 68 65 6d 65 2c 20 77 65 20 63 61 6e 20 | e.representation.scheme,.we.can. |
| 130fc0 | 72 65 70 6c 61 63 65 20 65 61 63 68 20 22 70 72 69 6d 69 74 69 76 65 22 0a 6c 69 73 74 20 6f 70 | replace.each."primitive".list.op |
| 130fe0 | 65 72 61 74 69 6f 6e 20 6f 66 20 61 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 77 69 | eration.of.a.register.machine.wi |
| 131000 | 74 68 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 20 70 72 69 6d 69 74 69 76 65 20 76 65 63 74 6f 72 0a | th.one.or.more.primitive.vector. |
| 131020 | 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 57 65 20 77 69 6c 6c 20 75 73 65 20 74 77 6f 20 72 65 67 | operations...We.will.use.two.reg |
| 131040 | 69 73 74 65 72 73 2c 20 60 74 68 65 2d 63 61 72 73 27 20 61 6e 64 20 60 74 68 65 2d 63 64 72 73 | isters,.`the-cars'.and.`the-cdrs |
| 131060 | 27 2c 20 74 6f 0a 69 64 65 6e 74 69 66 79 20 74 68 65 20 6d 65 6d 6f 72 79 20 76 65 63 74 6f 72 | ',.to.identify.the.memory.vector |
| 131080 | 73 2c 20 61 6e 64 20 77 69 6c 6c 20 61 73 73 75 6d 65 20 74 68 61 74 20 60 76 65 63 74 6f 72 2d | s,.and.will.assume.that.`vector- |
| 1310a0 | 72 65 66 27 20 61 6e 64 0a 60 76 65 63 74 6f 72 2d 73 65 74 21 27 20 61 72 65 20 61 76 61 69 6c | ref'.and.`vector-set!'.are.avail |
| 1310c0 | 61 62 6c 65 20 61 73 20 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 57 | able.as.primitive.operations...W |
| 1310e0 | 65 20 61 6c 73 6f 20 61 73 73 75 6d 65 0a 74 68 61 74 20 6e 75 6d 65 72 69 63 20 6f 70 65 72 61 | e.also.assume.that.numeric.opera |
| 131100 | 74 69 6f 6e 73 20 6f 6e 20 70 6f 69 6e 74 65 72 73 20 28 73 75 63 68 20 61 73 20 69 6e 63 72 65 | tions.on.pointers.(such.as.incre |
| 131120 | 6d 65 6e 74 69 6e 67 20 61 20 70 6f 69 6e 74 65 72 2c 0a 75 73 69 6e 67 20 61 20 70 61 69 72 20 | menting.a.pointer,.using.a.pair. |
| 131140 | 70 6f 69 6e 74 65 72 20 74 6f 20 69 6e 64 65 78 20 61 20 76 65 63 74 6f 72 2c 20 6f 72 20 61 64 | pointer.to.index.a.vector,.or.ad |
| 131160 | 64 69 6e 67 20 74 77 6f 20 6e 75 6d 62 65 72 73 29 20 75 73 65 20 6f 6e 6c 79 0a 74 68 65 20 69 | ding.two.numbers).use.only.the.i |
| 131180 | 6e 64 65 78 20 70 6f 72 74 69 6f 6e 20 6f 66 20 74 68 65 20 74 79 70 65 64 20 70 6f 69 6e 74 65 | ndex.portion.of.the.typed.pointe |
| 1311a0 | 72 2e 0a 0a 20 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 63 61 6e 20 6d 61 6b 65 20 | r......For.example,.we.can.make. |
| 1311c0 | 61 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 73 75 70 70 6f 72 74 20 74 68 65 20 69 | a.register.machine.support.the.i |
| 1311e0 | 6e 73 74 72 75 63 74 69 6f 6e 73 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 3c 52 45 47 5f 31 | nstructions.......(assign.<REG_1 |
| 131200 | 3e 20 28 6f 70 20 63 61 72 29 20 28 72 65 67 20 3c 52 45 47 5f 32 3e 29 29 0a 0a 20 20 20 20 20 | >.(op.car).(reg.<REG_2>))....... |
| 131220 | 28 61 73 73 69 67 6e 20 3c 52 45 47 5f 31 3e 20 28 6f 70 20 63 64 72 29 20 28 72 65 67 20 3c 52 | (assign.<REG_1>.(op.cdr).(reg.<R |
| 131240 | 45 47 5f 32 3e 29 29 0a 0a 69 66 20 77 65 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 73 65 2c 20 | EG_2>))..if.we.implement.these,. |
| 131260 | 72 65 73 70 65 63 74 69 76 65 6c 79 2c 20 61 73 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 3c | respectively,.as.......(assign.< |
| 131280 | 52 45 47 5f 31 3e 20 28 6f 70 20 76 65 63 74 6f 72 2d 72 65 66 29 20 28 72 65 67 20 74 68 65 2d | REG_1>.(op.vector-ref).(reg.the- |
| 1312a0 | 63 61 72 73 29 20 28 72 65 67 20 3c 52 45 47 5f 32 3e 29 29 0a 0a 20 20 20 20 20 28 61 73 73 69 | cars).(reg.<REG_2>)).......(assi |
| 1312c0 | 67 6e 20 3c 52 45 47 5f 31 3e 20 28 6f 70 20 76 65 63 74 6f 72 2d 72 65 66 29 20 28 72 65 67 20 | gn.<REG_1>.(op.vector-ref).(reg. |
| 1312e0 | 74 68 65 2d 63 64 72 73 29 20 28 72 65 67 20 3c 52 45 47 5f 32 3e 29 29 0a 0a 20 20 20 54 68 65 | the-cdrs).(reg.<REG_2>)).....The |
| 131300 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 0a 0a 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 | .instructions.......(perform.(op |
| 131320 | 20 73 65 74 2d 63 61 72 21 29 20 28 72 65 67 20 3c 52 45 47 5f 31 3e 29 20 28 72 65 67 20 3c 52 | .set-car!).(reg.<REG_1>).(reg.<R |
| 131340 | 45 47 5f 32 3e 29 29 0a 0a 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 73 65 74 2d 63 | EG_2>)).......(perform.(op.set-c |
| 131360 | 64 72 21 29 20 28 72 65 67 20 3c 52 45 47 5f 31 3e 29 20 28 72 65 67 20 3c 52 45 47 5f 32 3e 29 | dr!).(reg.<REG_1>).(reg.<REG_2>) |
| 131380 | 29 0a 0a 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 0a 0a 20 20 20 20 20 28 70 65 72 | )..are.implemented.as.......(per |
| 1313a0 | 66 6f 72 6d 0a 20 20 20 20 20 20 28 6f 70 20 76 65 63 74 6f 72 2d 73 65 74 21 29 20 28 72 65 67 | form.......(op.vector-set!).(reg |
| 1313c0 | 20 74 68 65 2d 63 61 72 73 29 20 28 72 65 67 20 3c 52 45 47 5f 31 3e 29 20 28 72 65 67 20 3c 52 | .the-cars).(reg.<REG_1>).(reg.<R |
| 1313e0 | 45 47 5f 32 3e 29 29 0a 0a 20 20 20 20 20 28 70 65 72 66 6f 72 6d 0a 20 20 20 20 20 20 28 6f 70 | EG_2>)).......(perform.......(op |
| 131400 | 20 76 65 63 74 6f 72 2d 73 65 74 21 29 20 28 72 65 67 20 74 68 65 2d 63 64 72 73 29 20 28 72 65 | .vector-set!).(reg.the-cdrs).(re |
| 131420 | 67 20 3c 52 45 47 5f 31 3e 29 20 28 72 65 67 20 3c 52 45 47 5f 32 3e 29 29 0a 0a 20 20 20 60 43 | g.<REG_1>).(reg.<REG_2>)).....`C |
| 131440 | 6f 6e 73 27 20 69 73 20 70 65 72 66 6f 72 6d 65 64 20 62 79 20 61 6c 6c 6f 63 61 74 69 6e 67 20 | ons'.is.performed.by.allocating. |
| 131460 | 61 6e 20 75 6e 75 73 65 64 20 69 6e 64 65 78 20 61 6e 64 20 73 74 6f 72 69 6e 67 20 74 68 65 0a | an.unused.index.and.storing.the. |
| 131480 | 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 60 63 6f 6e 73 27 20 69 6e 20 60 74 68 65 2d 63 61 72 73 | arguments.to.`cons'.in.`the-cars |
| 1314a0 | 27 20 61 6e 64 20 60 74 68 65 2d 63 64 72 73 27 20 61 74 20 74 68 61 74 20 69 6e 64 65 78 65 64 | '.and.`the-cdrs'.at.that.indexed |
| 1314c0 | 20 76 65 63 74 6f 72 0a 70 6f 73 69 74 69 6f 6e 2e 20 20 57 65 20 70 72 65 73 75 6d 65 20 74 68 | .vector.position...We.presume.th |
| 1314e0 | 61 74 20 74 68 65 72 65 20 69 73 20 61 20 73 70 65 63 69 61 6c 20 72 65 67 69 73 74 65 72 2c 20 | at.there.is.a.special.register,. |
| 131500 | 60 66 72 65 65 27 2c 20 74 68 61 74 0a 61 6c 77 61 79 73 20 68 6f 6c 64 73 20 61 20 70 61 69 72 | `free',.that.always.holds.a.pair |
| 131520 | 20 70 6f 69 6e 74 65 72 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 6e 65 78 74 20 61 76 61 | .pointer.containing.the.next.ava |
| 131540 | 69 6c 61 62 6c 65 20 69 6e 64 65 78 2c 20 61 6e 64 0a 74 68 61 74 20 77 65 20 63 61 6e 20 69 6e | ilable.index,.and.that.we.can.in |
| 131560 | 63 72 65 6d 65 6e 74 20 74 68 65 20 69 6e 64 65 78 20 70 61 72 74 20 6f 66 20 74 68 61 74 20 70 | crement.the.index.part.of.that.p |
| 131580 | 6f 69 6e 74 65 72 20 74 6f 20 66 69 6e 64 20 74 68 65 20 6e 65 78 74 0a 66 72 65 65 20 6c 6f 63 | ointer.to.find.the.next.free.loc |
| 1315a0 | 61 74 69 6f 6e 2e 28 37 29 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 69 6e 73 74 | ation.(7)..For.example,.the.inst |
| 1315c0 | 72 75 63 74 69 6f 6e 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 3c 52 45 47 5f 31 3e 20 28 6f | ruction.......(assign.<REG_1>.(o |
| 1315e0 | 70 20 63 6f 6e 73 29 20 28 72 65 67 20 3c 52 45 47 5f 32 3e 29 20 28 72 65 67 20 3c 52 45 47 5f | p.cons).(reg.<REG_2>).(reg.<REG_ |
| 131600 | 33 3e 29 29 0a 0a 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 74 68 65 20 66 6f 6c 6c | 3>))..is.implemented.as.the.foll |
| 131620 | 6f 77 69 6e 67 20 73 65 71 75 65 6e 63 65 20 6f 66 20 76 65 63 74 6f 72 20 6f 70 65 72 61 74 69 | owing.sequence.of.vector.operati |
| 131640 | 6f 6e 73 3a 28 38 29 0a 0a 20 20 20 20 20 28 70 65 72 66 6f 72 6d 0a 20 20 20 20 20 20 28 6f 70 | ons:(8).......(perform.......(op |
| 131660 | 20 76 65 63 74 6f 72 2d 73 65 74 21 29 20 28 72 65 67 20 74 68 65 2d 63 61 72 73 29 20 28 72 65 | .vector-set!).(reg.the-cars).(re |
| 131680 | 67 20 66 72 65 65 29 20 28 72 65 67 20 3c 52 45 47 5f 32 3e 29 29 0a 20 20 20 20 20 28 70 65 72 | g.free).(reg.<REG_2>))......(per |
| 1316a0 | 66 6f 72 6d 0a 20 20 20 20 20 20 28 6f 70 20 76 65 63 74 6f 72 2d 73 65 74 21 29 20 28 72 65 67 | form.......(op.vector-set!).(reg |
| 1316c0 | 20 74 68 65 2d 63 64 72 73 29 20 28 72 65 67 20 66 72 65 65 29 20 28 72 65 67 20 3c 52 45 47 5f | .the-cdrs).(reg.free).(reg.<REG_ |
| 1316e0 | 33 3e 29 29 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 3c 52 45 47 5f 31 3e 20 28 72 65 67 20 66 | 3>))......(assign.<REG_1>.(reg.f |
| 131700 | 72 65 65 29 29 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 66 72 65 65 20 28 6f 70 20 2b 29 20 28 | ree))......(assign.free.(op.+).( |
| 131720 | 72 65 67 20 66 72 65 65 29 20 28 63 6f 6e 73 74 20 31 29 29 0a 0a 20 20 20 54 68 65 20 60 65 71 | reg.free).(const.1)).....The.`eq |
| 131740 | 3f 27 20 6f 70 65 72 61 74 69 6f 6e 0a 0a 20 20 20 20 20 28 6f 70 20 65 71 3f 29 20 28 72 65 67 | ?'.operation.......(op.eq?).(reg |
| 131760 | 20 3c 52 45 47 5f 31 3e 29 20 28 72 65 67 20 3c 52 45 47 5f 32 3e 29 0a 0a 73 69 6d 70 6c 79 20 | .<REG_1>).(reg.<REG_2>)..simply. |
| 131780 | 74 65 73 74 73 20 74 68 65 20 65 71 75 61 6c 69 74 79 20 6f 66 20 61 6c 6c 20 66 69 65 6c 64 73 | tests.the.equality.of.all.fields |
| 1317a0 | 20 69 6e 20 74 68 65 20 72 65 67 69 73 74 65 72 73 2c 20 61 6e 64 0a 70 72 65 64 69 63 61 74 65 | .in.the.registers,.and.predicate |
| 1317c0 | 73 20 73 75 63 68 20 61 73 20 60 70 61 69 72 3f 27 2c 20 60 6e 75 6c 6c 3f 27 2c 20 60 73 79 6d | s.such.as.`pair?',.`null?',.`sym |
| 1317e0 | 62 6f 6c 3f 27 2c 20 61 6e 64 20 60 6e 75 6d 62 65 72 3f 27 20 6e 65 65 64 20 6f 6e 6c 79 0a 63 | bol?',.and.`number?'.need.only.c |
| 131800 | 68 65 63 6b 20 74 68 65 20 74 79 70 65 20 66 69 65 6c 64 2e 0a 0a 49 6d 70 6c 65 6d 65 6e 74 69 | heck.the.type.field...Implementi |
| 131820 | 6e 67 20 73 74 61 63 6b 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 | ng.stacks......................A |
| 131840 | 6c 74 68 6f 75 67 68 20 6f 75 72 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 73 20 75 73 | lthough.our.register.machines.us |
| 131860 | 65 20 73 74 61 63 6b 73 2c 20 77 65 20 6e 65 65 64 20 64 6f 20 6e 6f 74 68 69 6e 67 20 73 70 65 | e.stacks,.we.need.do.nothing.spe |
| 131880 | 63 69 61 6c 0a 68 65 72 65 2c 20 73 69 6e 63 65 20 73 74 61 63 6b 73 20 63 61 6e 20 62 65 20 6d | cial.here,.since.stacks.can.be.m |
| 1318a0 | 6f 64 65 6c 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 6c 69 73 74 73 2e 20 20 54 68 65 20 73 | odeled.in.terms.of.lists...The.s |
| 1318c0 | 74 61 63 6b 20 63 61 6e 20 62 65 0a 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 73 61 76 65 64 20 | tack.can.be.a.list.of.the.saved. |
| 1318e0 | 76 61 6c 75 65 73 2c 20 70 6f 69 6e 74 65 64 20 74 6f 20 62 79 20 61 20 73 70 65 63 69 61 6c 20 | values,.pointed.to.by.a.special. |
| 131900 | 72 65 67 69 73 74 65 72 0a 60 74 68 65 2d 73 74 61 63 6b 27 2e 20 20 54 68 75 73 2c 20 60 20 28 | register.`the-stack'...Thus,.`.( |
| 131920 | 73 61 76 65 20 3c 52 45 47 3e 29 27 20 63 61 6e 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 | save.<REG>)'.can.be.implemented. |
| 131940 | 61 73 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 68 65 2d 73 74 61 63 6b 20 28 6f 70 20 63 | as.......(assign.the-stack.(op.c |
| 131960 | 6f 6e 73 29 20 28 72 65 67 20 3c 52 45 47 3e 29 20 28 72 65 67 20 74 68 65 2d 73 74 61 63 6b 29 | ons).(reg.<REG>).(reg.the-stack) |
| 131980 | 29 0a 0a 53 69 6d 69 6c 61 72 6c 79 2c 20 60 28 72 65 73 74 6f 72 65 20 3c 52 45 47 3e 29 27 20 | )..Similarly,.`(restore.<REG>)'. |
| 1319a0 | 63 61 6e 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 0a 0a 20 20 20 20 20 28 61 73 73 | can.be.implemented.as.......(ass |
| 1319c0 | 69 67 6e 20 3c 52 45 47 3e 20 28 6f 70 20 63 61 72 29 20 28 72 65 67 20 74 68 65 2d 73 74 61 63 | ign.<REG>.(op.car).(reg.the-stac |
| 1319e0 | 6b 29 29 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 68 65 2d 73 74 61 63 6b 20 28 6f 70 20 63 | k))......(assign.the-stack.(op.c |
| 131a00 | 64 72 29 20 28 72 65 67 20 74 68 65 2d 73 74 61 63 6b 29 29 0a 0a 61 6e 64 20 60 28 70 65 72 66 | dr).(reg.the-stack))..and.`(perf |
| 131a20 | 6f 72 6d 20 28 6f 70 20 69 6e 69 74 69 61 6c 69 7a 65 2d 73 74 61 63 6b 29 29 27 20 63 61 6e 20 | orm.(op.initialize-stack))'.can. |
| 131a40 | 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 | be.implemented.as.......(assign. |
| 131a60 | 74 68 65 2d 73 74 61 63 6b 20 28 63 6f 6e 73 74 20 28 29 29 29 0a 0a 20 20 20 54 68 65 73 65 20 | the-stack.(const.())).....These. |
| 131a80 | 6f 70 65 72 61 74 69 6f 6e 73 20 63 61 6e 20 62 65 20 66 75 72 74 68 65 72 20 65 78 70 61 6e 64 | operations.can.be.further.expand |
| 131aa0 | 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 20 76 65 63 74 6f 72 0a 6f 70 65 72 61 74 | ed.in.terms.of.the.vector.operat |
| 131ac0 | 69 6f 6e 73 20 67 69 76 65 6e 20 61 62 6f 76 65 2e 20 20 49 6e 20 63 6f 6e 76 65 6e 74 69 6f 6e | ions.given.above...In.convention |
| 131ae0 | 61 6c 20 63 6f 6d 70 75 74 65 72 20 61 72 63 68 69 74 65 63 74 75 72 65 73 2c 0a 68 6f 77 65 76 | al.computer.architectures,.howev |
| 131b00 | 65 72 2c 20 69 74 20 69 73 20 75 73 75 61 6c 6c 79 20 61 64 76 61 6e 74 61 67 65 6f 75 73 20 74 | er,.it.is.usually.advantageous.t |
| 131b20 | 6f 20 61 6c 6c 6f 63 61 74 65 20 74 68 65 20 73 74 61 63 6b 20 61 73 20 61 20 73 65 70 61 72 61 | o.allocate.the.stack.as.a.separa |
| 131b40 | 74 65 0a 76 65 63 74 6f 72 2e 20 20 54 68 65 6e 20 70 75 73 68 69 6e 67 20 61 6e 64 20 70 6f 70 | te.vector...Then.pushing.and.pop |
| 131b60 | 70 69 6e 67 20 74 68 65 20 73 74 61 63 6b 20 63 61 6e 20 62 65 20 61 63 63 6f 6d 70 6c 69 73 68 | ping.the.stack.can.be.accomplish |
| 131b80 | 65 64 20 62 79 0a 69 6e 63 72 65 6d 65 6e 74 69 6e 67 20 6f 72 20 64 65 63 72 65 6d 65 6e 74 69 | ed.by.incrementing.or.decrementi |
| 131ba0 | 6e 67 20 61 6e 20 69 6e 64 65 78 20 69 6e 74 6f 20 74 68 61 74 20 76 65 63 74 6f 72 2e 0a 0a 20 | ng.an.index.into.that.vector.... |
| 131bc0 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 32 30 3a 2a 20 44 72 61 77 20 74 68 65 20 62 6f | ....*Exercise.5.20:*.Draw.the.bo |
| 131be0 | 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 61 6e 64 | x-and-pointer.representation.and |
| 131c00 | 20 74 68 65 0a 20 20 20 20 20 6d 65 6d 6f 72 79 2d 76 65 63 74 6f 72 20 72 65 70 72 65 73 65 6e | .the......memory-vector.represen |
| 131c20 | 74 61 74 69 6f 6e 20 28 61 73 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 34 3a | tation.(as.in.*Note.Figure.5-14: |
| 131c40 | 3a 29 20 6f 66 20 74 68 65 0a 20 20 20 20 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 20 70 72 | :).of.the......list.structure.pr |
| 131c60 | 6f 64 75 63 65 64 20 62 79 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 78 20 28 | oduced.by............(define.x.( |
| 131c80 | 63 6f 6e 73 20 31 20 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 79 20 28 | cons.1.2))...........(define.y.( |
| 131ca0 | 6c 69 73 74 20 78 20 78 29 29 0a 0a 20 20 20 20 20 77 69 74 68 20 74 68 65 20 60 66 72 65 65 27 | list.x.x)).......with.the.`free' |
| 131cc0 | 20 70 6f 69 6e 74 65 72 20 69 6e 69 74 69 61 6c 6c 79 20 60 70 31 27 2e 20 20 57 68 61 74 20 69 | .pointer.initially.`p1'...What.i |
| 131ce0 | 73 20 74 68 65 20 66 69 6e 61 6c 20 76 61 6c 75 65 20 6f 66 0a 20 20 20 20 20 60 66 72 65 65 27 | s.the.final.value.of......`free' |
| 131d00 | 20 3f 20 20 57 68 61 74 20 70 6f 69 6e 74 65 72 73 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 | .?..What.pointers.represent.the. |
| 131d20 | 76 61 6c 75 65 73 20 6f 66 20 60 78 27 20 61 6e 64 20 60 79 27 20 3f 0a 0a 20 20 20 20 20 2a 45 | values.of.`x'.and.`y'.?.......*E |
| 131d40 | 78 65 72 63 69 73 65 20 35 2e 32 31 3a 2a 20 49 6d 70 6c 65 6d 65 6e 74 20 72 65 67 69 73 74 65 | xercise.5.21:*.Implement.registe |
| 131d60 | 72 20 6d 61 63 68 69 6e 65 73 20 66 6f 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 20 20 20 | r.machines.for.the.following.... |
| 131d80 | 20 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 41 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 20 6c | ..procedures...Assume.that.the.l |
| 131da0 | 69 73 74 2d 73 74 72 75 63 74 75 72 65 20 6d 65 6d 6f 72 79 20 6f 70 65 72 61 74 69 6f 6e 73 20 | ist-structure.memory.operations. |
| 131dc0 | 61 72 65 0a 20 20 20 20 20 61 76 61 69 6c 61 62 6c 65 20 61 73 20 6d 61 63 68 69 6e 65 20 70 72 | are......available.as.machine.pr |
| 131de0 | 69 6d 69 74 69 76 65 73 2e 0a 0a 20 20 20 20 20 20 20 61 2e 20 52 65 63 75 72 73 69 76 65 20 60 | imitives..........a..Recursive.` |
| 131e00 | 63 6f 75 6e 74 2d 6c 65 61 76 65 73 27 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | count-leaves':.................( |
| 131e20 | 64 65 66 69 6e 65 20 28 63 6f 75 6e 74 2d 6c 65 61 76 65 73 20 74 72 65 65 29 0a 20 20 20 20 20 | define.(count-leaves.tree)...... |
| 131e40 | 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 74 72 65 65 29 20 | ............(cond.((null?.tree). |
| 131e60 | 30 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6e 6f 74 20 | 0)........................((not. |
| 131e80 | 28 70 61 69 72 3f 20 74 72 65 65 29 29 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (pair?.tree)).1)................ |
| 131ea0 | 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 2b 20 28 63 6f 75 6e 74 2d 6c 65 61 76 65 73 20 28 | ........(else.(+.(count-leaves.( |
| 131ec0 | 63 61 72 20 74 72 65 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | car.tree))...................... |
| 131ee0 | 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 75 6e 74 2d 6c 65 61 76 65 73 20 28 63 64 72 20 74 72 | ...........(count-leaves.(cdr.tr |
| 131f00 | 65 65 29 29 29 29 29 29 0a 0a 20 20 20 20 20 20 20 62 2e 20 52 65 63 75 72 73 69 76 65 20 60 63 | ee)))))).........b..Recursive.`c |
| 131f20 | 6f 75 6e 74 2d 6c 65 61 76 65 73 27 20 77 69 74 68 20 65 78 70 6c 69 63 69 74 20 63 6f 75 6e 74 | ount-leaves'.with.explicit.count |
| 131f40 | 65 72 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 75 | er:.................(define.(cou |
| 131f60 | 6e 74 2d 6c 65 61 76 65 73 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | nt-leaves.tree)................. |
| 131f80 | 20 28 64 65 66 69 6e 65 20 28 63 6f 75 6e 74 2d 69 74 65 72 20 74 72 65 65 20 6e 29 0a 20 20 20 | .(define.(count-iter.tree.n).... |
| 131fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 6c 6c 3f 20 74 72 | ................(cond.((null?.tr |
| 131fc0 | 65 65 29 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ee).n).......................... |
| 131fe0 | 28 28 6e 6f 74 20 28 70 61 69 72 3f 20 74 72 65 65 29 29 20 28 2b 20 6e 20 31 29 29 0a 20 20 20 | ((not.(pair?.tree)).(+.n.1)).... |
| 132000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 63 6f 75 | ......................(else.(cou |
| 132020 | 6e 74 2d 69 74 65 72 20 28 63 64 72 20 74 72 65 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | nt-iter.(cdr.tree).............. |
| 132040 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 | ..............................(c |
| 132060 | 6f 75 6e 74 2d 69 74 65 72 20 28 63 61 72 20 74 72 65 65 29 20 6e 29 29 29 29 29 0a 20 20 20 20 | ount-iter.(car.tree).n)))))..... |
| 132080 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 75 6e 74 2d 69 74 65 72 20 74 72 65 65 20 30 29 | .............(count-iter.tree.0) |
| 1320a0 | 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 32 32 3a 2a 20 2a 4e 6f 74 65 20 45 | ).......*Exercise.5.22:*.*Note.E |
| 1320c0 | 78 65 72 63 69 73 65 20 33 2d 31 32 3a 3a 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 | xercise.3-12::.of.section.*Note. |
| 1320e0 | 33 2d 33 2d 31 3a 3a 0a 20 20 20 20 20 70 72 65 73 65 6e 74 65 64 20 61 6e 20 60 61 70 70 65 6e | 3-3-1::......presented.an.`appen |
| 132100 | 64 27 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 61 70 70 65 6e 64 73 20 74 77 6f 20 6c 69 | d'.procedure.that.appends.two.li |
| 132120 | 73 74 73 20 74 6f 20 66 6f 72 6d 20 61 0a 20 20 20 20 20 6e 65 77 20 6c 69 73 74 20 61 6e 64 20 | sts.to.form.a......new.list.and. |
| 132140 | 61 6e 20 60 61 70 70 65 6e 64 21 27 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 73 70 6c 69 | an.`append!'.procedure.that.spli |
| 132160 | 63 65 73 20 74 77 6f 20 6c 69 73 74 73 0a 20 20 20 20 20 74 6f 67 65 74 68 65 72 2e 20 20 44 65 | ces.two.lists......together...De |
| 132180 | 73 69 67 6e 20 61 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 74 6f 20 69 6d 70 6c 65 | sign.a.register.machine.to.imple |
| 1321a0 | 6d 65 6e 74 20 65 61 63 68 20 6f 66 20 74 68 65 73 65 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 | ment.each.of.these......procedur |
| 1321c0 | 65 73 2e 20 20 41 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 20 6c 69 73 74 2d 73 74 72 75 63 74 | es...Assume.that.the.list-struct |
| 1321e0 | 75 72 65 20 6d 65 6d 6f 72 79 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 72 65 0a 20 20 20 20 20 61 | ure.memory.operations.are......a |
| 132200 | 76 61 69 6c 61 62 6c 65 20 61 73 20 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 | vailable.as.primitive.operations |
| 132220 | 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d | ......----------.Footnotes.----- |
| 132240 | 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 57 65 20 63 6f 75 6c 64 20 72 65 70 72 65 73 65 6e 74 | -----.....(1).We.could.represent |
| 132260 | 20 6d 65 6d 6f 72 79 20 61 73 20 6c 69 73 74 73 20 6f 66 20 69 74 65 6d 73 2e 20 20 48 6f 77 65 | .memory.as.lists.of.items...Howe |
| 132280 | 76 65 72 2c 20 74 68 65 0a 61 63 63 65 73 73 20 74 69 6d 65 20 77 6f 75 6c 64 20 74 68 65 6e 20 | ver,.the.access.time.would.then. |
| 1322a0 | 6e 6f 74 20 62 65 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 69 6e 64 65 78 2c | not.be.independent.of.the.index, |
| 1322c0 | 20 73 69 6e 63 65 20 61 63 63 65 73 73 69 6e 67 0a 74 68 65 20 6e 74 68 20 65 6c 65 6d 65 6e 74 | .since.accessing.the.nth.element |
| 1322e0 | 20 6f 66 20 61 20 6c 69 73 74 20 72 65 71 75 69 72 65 73 20 6e 20 2d 20 31 20 60 63 64 72 27 20 | .of.a.list.requires.n.-.1.`cdr'. |
| 132300 | 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 28 32 29 20 46 6f 72 20 63 6f 6d 70 6c 65 74 65 | operations......(2).For.complete |
| 132320 | 6e 65 73 73 2c 20 77 65 20 73 68 6f 75 6c 64 20 73 70 65 63 69 66 79 20 61 20 60 6d 61 6b 65 2d | ness,.we.should.specify.a.`make- |
| 132340 | 76 65 63 74 6f 72 27 20 6f 70 65 72 61 74 69 6f 6e 0a 74 68 61 74 20 63 6f 6e 73 74 72 75 63 74 | vector'.operation.that.construct |
| 132360 | 73 20 76 65 63 74 6f 72 73 2e 20 20 48 6f 77 65 76 65 72 2c 20 69 6e 20 74 68 65 20 70 72 65 73 | s.vectors...However,.in.the.pres |
| 132380 | 65 6e 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 77 65 20 77 69 6c 6c 0a 75 73 65 20 76 65 63 74 | ent.application.we.will.use.vect |
| 1323a0 | 6f 72 73 20 6f 6e 6c 79 20 74 6f 20 6d 6f 64 65 6c 20 66 69 78 65 64 20 64 69 76 69 73 69 6f 6e | ors.only.to.model.fixed.division |
| 1323c0 | 73 20 6f 66 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 6d 65 6d 6f 72 79 2e 0a 0a 20 20 20 28 33 | s.of.the.computer.memory......(3 |
| 1323e0 | 29 20 54 68 69 73 20 69 73 20 70 72 65 63 69 73 65 6c 79 20 74 68 65 20 73 61 6d 65 20 22 74 61 | ).This.is.precisely.the.same."ta |
| 132400 | 67 67 65 64 20 64 61 74 61 22 20 69 64 65 61 20 77 65 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e | gged.data".idea.we.introduced.in |
| 132420 | 0a 2a 4e 6f 74 65 20 43 68 61 70 74 65 72 20 32 3a 3a 20 66 6f 72 20 64 65 61 6c 69 6e 67 20 77 | .*Note.Chapter.2::.for.dealing.w |
| 132440 | 69 74 68 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 48 65 72 65 2c 20 68 | ith.generic.operations...Here,.h |
| 132460 | 6f 77 65 76 65 72 2c 0a 74 68 65 20 64 61 74 61 20 74 79 70 65 73 20 61 72 65 20 69 6e 63 6c 75 | owever,.the.data.types.are.inclu |
| 132480 | 64 65 64 20 61 74 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 6d 61 63 68 69 6e 65 20 6c 65 76 | ded.at.the.primitive.machine.lev |
| 1324a0 | 65 6c 20 72 61 74 68 65 72 20 74 68 61 6e 0a 63 6f 6e 73 74 72 75 63 74 65 64 20 74 68 72 6f 75 | el.rather.than.constructed.throu |
| 1324c0 | 67 68 20 74 68 65 20 75 73 65 20 6f 66 20 6c 69 73 74 73 2e 0a 0a 20 20 20 28 34 29 20 54 79 70 | gh.the.use.of.lists......(4).Typ |
| 1324e0 | 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6d 61 79 20 62 65 20 65 6e 63 6f 64 65 64 20 69 6e 20 | e.information.may.be.encoded.in. |
| 132500 | 61 20 76 61 72 69 65 74 79 20 6f 66 20 77 61 79 73 2c 20 64 65 70 65 6e 64 69 6e 67 0a 6f 6e 20 | a.variety.of.ways,.depending.on. |
| 132520 | 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6f 6e 20 77 68 | the.details.of.the.machine.on.wh |
| 132540 | 69 63 68 20 74 68 65 20 4c 69 73 70 20 73 79 73 74 65 6d 20 69 73 20 74 6f 20 62 65 0a 69 6d 70 | ich.the.Lisp.system.is.to.be.imp |
| 132560 | 6c 65 6d 65 6e 74 65 64 2e 20 20 54 68 65 20 65 78 65 63 75 74 69 6f 6e 20 65 66 66 69 63 69 65 | lemented...The.execution.efficie |
| 132580 | 6e 63 79 20 6f 66 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 73 20 77 69 6c 6c 20 62 65 0a 73 74 72 | ncy.of.Lisp.programs.will.be.str |
| 1325a0 | 6f 6e 67 6c 79 20 64 65 70 65 6e 64 65 6e 74 20 6f 6e 20 68 6f 77 20 63 6c 65 76 65 72 6c 79 20 | ongly.dependent.on.how.cleverly. |
| 1325c0 | 74 68 69 73 20 63 68 6f 69 63 65 20 69 73 20 6d 61 64 65 2c 20 62 75 74 20 69 74 20 69 73 0a 64 | this.choice.is.made,.but.it.is.d |
| 1325e0 | 69 66 66 69 63 75 6c 74 20 74 6f 20 66 6f 72 6d 75 6c 61 74 65 20 67 65 6e 65 72 61 6c 20 64 65 | ifficult.to.formulate.general.de |
| 132600 | 73 69 67 6e 20 72 75 6c 65 73 20 66 6f 72 20 67 6f 6f 64 20 63 68 6f 69 63 65 73 2e 20 20 54 68 | sign.rules.for.good.choices...Th |
| 132620 | 65 20 6d 6f 73 74 0a 73 74 72 61 69 67 68 74 66 6f 72 77 61 72 64 20 77 61 79 20 74 6f 20 69 6d | e.most.straightforward.way.to.im |
| 132640 | 70 6c 65 6d 65 6e 74 20 74 79 70 65 64 20 70 6f 69 6e 74 65 72 73 20 69 73 20 74 6f 20 61 6c 6c | plement.typed.pointers.is.to.all |
| 132660 | 6f 63 61 74 65 20 61 20 66 69 78 65 64 0a 73 65 74 20 6f 66 20 62 69 74 73 20 69 6e 20 65 61 63 | ocate.a.fixed.set.of.bits.in.eac |
| 132680 | 68 20 70 6f 69 6e 74 65 72 20 74 6f 20 62 65 20 61 20 22 74 79 70 65 20 66 69 65 6c 64 22 20 74 | h.pointer.to.be.a."type.field".t |
| 1326a0 | 68 61 74 20 65 6e 63 6f 64 65 73 20 74 68 65 20 64 61 74 61 0a 74 79 70 65 2e 20 20 49 6d 70 6f | hat.encodes.the.data.type...Impo |
| 1326c0 | 72 74 61 6e 74 20 71 75 65 73 74 69 6f 6e 73 20 74 6f 20 62 65 20 61 64 64 72 65 73 73 65 64 20 | rtant.questions.to.be.addressed. |
| 1326e0 | 69 6e 20 64 65 73 69 67 6e 69 6e 67 20 73 75 63 68 20 61 0a 72 65 70 72 65 73 65 6e 74 61 74 69 | in.designing.such.a.representati |
| 132700 | 6f 6e 20 69 6e 63 6c 75 64 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 20 48 6f 77 20 6d 61 | on.include.the.following:.How.ma |
| 132720 | 6e 79 20 74 79 70 65 20 62 69 74 73 20 61 72 65 20 72 65 71 75 69 72 65 64 3f 0a 48 6f 77 20 6c | ny.type.bits.are.required?.How.l |
| 132740 | 61 72 67 65 20 6d 75 73 74 20 74 68 65 20 76 65 63 74 6f 72 20 69 6e 64 69 63 65 73 20 62 65 3f | arge.must.the.vector.indices.be? |
| 132760 | 20 20 48 6f 77 20 65 66 66 69 63 69 65 6e 74 6c 79 20 63 61 6e 20 74 68 65 0a 70 72 69 6d 69 74 | ..How.efficiently.can.the.primit |
| 132780 | 69 76 65 20 6d 61 63 68 69 6e 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 62 65 20 75 73 65 64 | ive.machine.instructions.be.used |
| 1327a0 | 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 68 65 20 74 79 70 65 20 66 69 65 6c 64 73 20 6f | .to.manipulate.the.type.fields.o |
| 1327c0 | 66 0a 70 6f 69 6e 74 65 72 73 3f 20 20 4d 61 63 68 69 6e 65 73 20 74 68 61 74 20 69 6e 63 6c 75 | f.pointers?..Machines.that.inclu |
| 1327e0 | 64 65 20 73 70 65 63 69 61 6c 20 68 61 72 64 77 61 72 65 20 66 6f 72 20 74 68 65 20 65 66 66 69 | de.special.hardware.for.the.effi |
| 132800 | 63 69 65 6e 74 0a 68 61 6e 64 6c 69 6e 67 20 6f 66 20 74 79 70 65 20 66 69 65 6c 64 73 20 61 72 | cient.handling.of.type.fields.ar |
| 132820 | 65 20 73 61 69 64 20 74 6f 20 68 61 76 65 20 61 72 63 68 69 74 65 63 74 75 72 65 73 20 22 74 61 | e.said.to.have.architectures."ta |
| 132840 | 67 67 65 64 0a 61 72 63 68 69 74 65 63 74 75 72 65 73 22 2e 0a 0a 20 20 20 28 35 29 20 54 68 69 | gged.architectures"......(5).Thi |
| 132860 | 73 20 64 65 63 69 73 69 6f 6e 20 6f 6e 20 74 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e | s.decision.on.the.representation |
| 132880 | 20 6f 66 20 6e 75 6d 62 65 72 73 20 64 65 74 65 72 6d 69 6e 65 73 20 77 68 65 74 68 65 72 0a 60 | .of.numbers.determines.whether.` |
| 1328a0 | 65 71 3f 27 2c 20 77 68 69 63 68 20 74 65 73 74 73 20 65 71 75 61 6c 69 74 79 20 6f 66 20 70 6f | eq?',.which.tests.equality.of.po |
| 1328c0 | 69 6e 74 65 72 73 2c 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 74 65 73 74 20 66 6f 72 0a | inters,.can.be.used.to.test.for. |
| 1328e0 | 65 71 75 61 6c 69 74 79 20 6f 66 20 6e 75 6d 62 65 72 73 2e 20 20 49 66 20 74 68 65 20 70 6f 69 | equality.of.numbers...If.the.poi |
| 132900 | 6e 74 65 72 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 6e 75 6d 62 65 72 20 69 74 73 65 6c 66 2c | nter.contains.the.number.itself, |
| 132920 | 20 74 68 65 6e 0a 65 71 75 61 6c 20 6e 75 6d 62 65 72 73 20 77 69 6c 6c 20 68 61 76 65 20 74 68 | .then.equal.numbers.will.have.th |
| 132940 | 65 20 73 61 6d 65 20 70 6f 69 6e 74 65 72 2e 20 20 42 75 74 20 69 66 20 74 68 65 20 70 6f 69 6e | e.same.pointer...But.if.the.poin |
| 132960 | 74 65 72 20 63 6f 6e 74 61 69 6e 73 0a 74 68 65 20 69 6e 64 65 78 20 6f 66 20 61 20 6c 6f 63 61 | ter.contains.the.index.of.a.loca |
| 132980 | 74 69 6f 6e 20 77 68 65 72 65 20 74 68 65 20 6e 75 6d 62 65 72 20 69 73 20 73 74 6f 72 65 64 2c | tion.where.the.number.is.stored, |
| 1329a0 | 20 65 71 75 61 6c 20 6e 75 6d 62 65 72 73 20 77 69 6c 6c 0a 62 65 20 67 75 61 72 61 6e 74 65 65 | .equal.numbers.will.be.guarantee |
| 1329c0 | 64 20 74 6f 20 68 61 76 65 20 65 71 75 61 6c 20 70 6f 69 6e 74 65 72 73 20 6f 6e 6c 79 20 69 66 | d.to.have.equal.pointers.only.if |
| 1329e0 | 20 77 65 20 61 72 65 20 63 61 72 65 66 75 6c 20 6e 65 76 65 72 20 74 6f 0a 73 74 6f 72 65 20 74 | .we.are.careful.never.to.store.t |
| 132a00 | 68 65 20 73 61 6d 65 20 6e 75 6d 62 65 72 20 69 6e 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 | he.same.number.in.more.than.one. |
| 132a20 | 6c 6f 63 61 74 69 6f 6e 2e 0a 0a 20 20 20 28 36 29 20 54 68 69 73 20 69 73 20 6a 75 73 74 20 6c | location......(6).This.is.just.l |
| 132a40 | 69 6b 65 20 77 72 69 74 69 6e 67 20 61 20 6e 75 6d 62 65 72 20 61 73 20 61 20 73 65 71 75 65 6e | ike.writing.a.number.as.a.sequen |
| 132a60 | 63 65 20 6f 66 20 64 69 67 69 74 73 2c 0a 65 78 63 65 70 74 20 74 68 61 74 20 65 61 63 68 20 22 | ce.of.digits,.except.that.each." |
| 132a80 | 64 69 67 69 74 22 20 69 73 20 61 20 6e 75 6d 62 65 72 20 62 65 74 77 65 65 6e 20 30 20 61 6e 64 | digit".is.a.number.between.0.and |
| 132aa0 | 20 74 68 65 20 6c 61 72 67 65 73 74 20 6e 75 6d 62 65 72 0a 74 68 61 74 20 63 61 6e 20 62 65 20 | .the.largest.number.that.can.be. |
| 132ac0 | 73 74 6f 72 65 64 20 69 6e 20 61 20 73 69 6e 67 6c 65 20 70 6f 69 6e 74 65 72 2e 0a 0a 20 20 20 | stored.in.a.single.pointer...... |
| 132ae0 | 28 37 29 20 54 68 65 72 65 20 61 72 65 20 6f 74 68 65 72 20 77 61 79 73 20 6f 66 20 66 69 6e 64 | (7).There.are.other.ways.of.find |
| 132b00 | 69 6e 67 20 66 72 65 65 20 73 74 6f 72 61 67 65 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 | ing.free.storage...For.example,. |
| 132b20 | 77 65 0a 63 6f 75 6c 64 20 6c 69 6e 6b 20 74 6f 67 65 74 68 65 72 20 61 6c 6c 20 74 68 65 20 75 | we.could.link.together.all.the.u |
| 132b40 | 6e 75 73 65 64 20 70 61 69 72 73 20 69 6e 74 6f 20 61 20 22 66 72 65 65 20 6c 69 73 74 22 2e 20 | nused.pairs.into.a."free.list".. |
| 132b60 | 20 4f 75 72 20 66 72 65 65 0a 6c 6f 63 61 74 69 6f 6e 73 20 61 72 65 20 63 6f 6e 73 65 63 75 74 | .Our.free.locations.are.consecut |
| 132b80 | 69 76 65 20 28 61 6e 64 20 68 65 6e 63 65 20 63 61 6e 20 62 65 20 61 63 63 65 73 73 65 64 20 62 | ive.(and.hence.can.be.accessed.b |
| 132ba0 | 79 20 69 6e 63 72 65 6d 65 6e 74 69 6e 67 20 61 0a 70 6f 69 6e 74 65 72 29 20 62 65 63 61 75 73 | y.incrementing.a.pointer).becaus |
| 132bc0 | 65 20 77 65 20 61 72 65 20 75 73 69 6e 67 20 61 20 63 6f 6d 70 61 63 74 69 6e 67 20 67 61 72 62 | e.we.are.using.a.compacting.garb |
| 132be0 | 61 67 65 20 63 6f 6c 6c 65 63 74 6f 72 2c 20 61 73 20 77 65 0a 77 69 6c 6c 20 73 65 65 20 69 6e | age.collector,.as.we.will.see.in |
| 132c00 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 33 2d 32 3a 3a 2e 0a 0a 20 20 20 28 38 29 20 | .section.*Note.5-3-2::......(8). |
| 132c20 | 54 68 69 73 20 69 73 20 65 73 73 65 6e 74 69 61 6c 6c 79 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e | This.is.essentially.the.implemen |
| 132c40 | 74 61 74 69 6f 6e 20 6f 66 20 60 63 6f 6e 73 27 20 69 6e 20 74 65 72 6d 73 20 6f 66 0a 60 73 65 | tation.of.`cons'.in.terms.of.`se |
| 132c60 | 74 2d 63 61 72 21 27 20 61 6e 64 20 60 73 65 74 2d 63 64 72 21 27 2c 20 61 73 20 64 65 73 63 72 | t-car!'.and.`set-cdr!',.as.descr |
| 132c80 | 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 33 2d 33 2d 31 3a 3a 2e 20 20 | ibed.in.section.*Note.3-3-1::... |
| 132ca0 | 54 68 65 0a 6f 70 65 72 61 74 69 6f 6e 20 60 67 65 74 2d 6e 65 77 2d 70 61 69 72 27 20 75 73 65 | The.operation.`get-new-pair'.use |
| 132cc0 | 64 20 69 6e 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 69 73 20 72 65 61 6c | d.in.that.implementation.is.real |
| 132ce0 | 69 7a 65 64 20 68 65 72 65 0a 62 79 20 74 68 65 20 60 66 72 65 65 27 20 70 6f 69 6e 74 65 72 2e | ized.here.by.the.`free'.pointer. |
| 132d00 | 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 33 2d | ....File:.sicp.info,..Node:.5-3- |
| 132d20 | 32 2c 20 20 50 72 65 76 3a 20 35 2d 33 2d 31 2c 20 20 55 70 3a 20 35 2d 33 0a 0a 35 2e 33 2e 32 | 2,..Prev:.5-3-1,..Up:.5-3..5.3.2 |
| 132d40 | 20 4d 61 69 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 49 6c 6c 75 73 69 6f 6e 20 6f 66 20 49 6e 66 | .Maintaining.the.Illusion.of.Inf |
| 132d60 | 69 6e 69 74 65 20 4d 65 6d 6f 72 79 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | inite.Memory.------------------- |
| 132d80 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a | ------------------------------.. |
| 132da0 | 54 68 65 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6d 65 74 68 6f 64 20 6f 75 74 6c 69 6e | The.representation.method.outlin |
| 132dc0 | 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 33 2d 31 3a 3a 20 73 6f 6c 76 | ed.in.section.*Note.5-3-1::.solv |
| 132de0 | 65 73 20 74 68 65 0a 70 72 6f 62 6c 65 6d 20 6f 66 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 6c | es.the.problem.of.implementing.l |
| 132e00 | 69 73 74 20 73 74 72 75 63 74 75 72 65 2c 20 70 72 6f 76 69 64 65 64 20 74 68 61 74 20 77 65 20 | ist.structure,.provided.that.we. |
| 132e20 | 68 61 76 65 20 61 6e 0a 69 6e 66 69 6e 69 74 65 20 61 6d 6f 75 6e 74 20 6f 66 20 6d 65 6d 6f 72 | have.an.infinite.amount.of.memor |
| 132e40 | 79 2e 20 20 57 69 74 68 20 61 20 72 65 61 6c 20 63 6f 6d 70 75 74 65 72 20 77 65 20 77 69 6c 6c | y...With.a.real.computer.we.will |
| 132e60 | 20 65 76 65 6e 74 75 61 6c 6c 79 20 72 75 6e 0a 6f 75 74 20 6f 66 20 66 72 65 65 20 73 70 61 63 | .eventually.run.out.of.free.spac |
| 132e80 | 65 20 69 6e 20 77 68 69 63 68 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 6e 65 77 20 70 61 69 72 | e.in.which.to.construct.new.pair |
| 132ea0 | 73 2e 28 31 29 20 20 48 6f 77 65 76 65 72 2c 20 6d 6f 73 74 20 6f 66 0a 74 68 65 20 70 61 69 72 | s.(1)..However,.most.of.the.pair |
| 132ec0 | 73 20 67 65 6e 65 72 61 74 65 64 20 69 6e 20 61 20 74 79 70 69 63 61 6c 20 63 6f 6d 70 75 74 61 | s.generated.in.a.typical.computa |
| 132ee0 | 74 69 6f 6e 20 61 72 65 20 75 73 65 64 20 6f 6e 6c 79 20 74 6f 20 68 6f 6c 64 0a 69 6e 74 65 72 | tion.are.used.only.to.hold.inter |
| 132f00 | 6d 65 64 69 61 74 65 20 72 65 73 75 6c 74 73 2e 20 20 41 66 74 65 72 20 74 68 65 73 65 20 72 65 | mediate.results...After.these.re |
| 132f20 | 73 75 6c 74 73 20 61 72 65 20 61 63 63 65 73 73 65 64 2c 20 74 68 65 20 70 61 69 72 73 20 61 72 | sults.are.accessed,.the.pairs.ar |
| 132f40 | 65 0a 6e 6f 20 6c 6f 6e 67 65 72 20 6e 65 65 64 65 64 2d 2d 74 68 65 79 20 61 72 65 20 22 67 61 | e.no.longer.needed--they.are."ga |
| 132f60 | 72 62 61 67 65 22 2e 20 20 46 6f 72 20 69 6e 73 74 61 6e 63 65 2c 20 74 68 65 20 63 6f 6d 70 75 | rbage"...For.instance,.the.compu |
| 132f80 | 74 61 74 69 6f 6e 0a 0a 20 20 20 20 20 28 61 63 63 75 6d 75 6c 61 74 65 20 2b 20 30 20 28 66 69 | tation.......(accumulate.+.0.(fi |
| 132fa0 | 6c 74 65 72 20 6f 64 64 3f 20 28 65 6e 75 6d 65 72 61 74 65 2d 69 6e 74 65 72 76 61 6c 20 30 20 | lter.odd?.(enumerate-interval.0. |
| 132fc0 | 6e 29 29 29 0a 0a 63 6f 6e 73 74 72 75 63 74 73 20 74 77 6f 20 6c 69 73 74 73 3a 20 74 68 65 20 | n)))..constructs.two.lists:.the. |
| 132fe0 | 65 6e 75 6d 65 72 61 74 69 6f 6e 20 61 6e 64 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 66 69 | enumeration.and.the.result.of.fi |
| 133000 | 6c 74 65 72 69 6e 67 20 74 68 65 0a 65 6e 75 6d 65 72 61 74 69 6f 6e 2e 20 20 57 68 65 6e 20 74 | ltering.the.enumeration...When.t |
| 133020 | 68 65 20 61 63 63 75 6d 75 6c 61 74 69 6f 6e 20 69 73 20 63 6f 6d 70 6c 65 74 65 2c 20 74 68 65 | he.accumulation.is.complete,.the |
| 133040 | 73 65 20 6c 69 73 74 73 20 61 72 65 20 6e 6f 0a 6c 6f 6e 67 65 72 20 6e 65 65 64 65 64 2c 20 61 | se.lists.are.no.longer.needed,.a |
| 133060 | 6e 64 20 74 68 65 20 61 6c 6c 6f 63 61 74 65 64 20 6d 65 6d 6f 72 79 20 63 61 6e 20 62 65 20 72 | nd.the.allocated.memory.can.be.r |
| 133080 | 65 63 6c 61 69 6d 65 64 2e 20 20 49 66 20 77 65 20 63 61 6e 0a 61 72 72 61 6e 67 65 20 74 6f 20 | eclaimed...If.we.can.arrange.to. |
| 1330a0 | 63 6f 6c 6c 65 63 74 20 61 6c 6c 20 74 68 65 20 67 61 72 62 61 67 65 20 70 65 72 69 6f 64 69 63 | collect.all.the.garbage.periodic |
| 1330c0 | 61 6c 6c 79 2c 20 61 6e 64 20 69 66 20 74 68 69 73 20 74 75 72 6e 73 20 6f 75 74 0a 74 6f 20 72 | ally,.and.if.this.turns.out.to.r |
| 1330e0 | 65 63 79 63 6c 65 20 6d 65 6d 6f 72 79 20 61 74 20 61 62 6f 75 74 20 74 68 65 20 73 61 6d 65 20 | ecycle.memory.at.about.the.same. |
| 133100 | 72 61 74 65 20 61 74 20 77 68 69 63 68 20 77 65 20 63 6f 6e 73 74 72 75 63 74 20 6e 65 77 0a 70 | rate.at.which.we.construct.new.p |
| 133120 | 61 69 72 73 2c 20 77 65 20 77 69 6c 6c 20 68 61 76 65 20 70 72 65 73 65 72 76 65 64 20 74 68 65 | airs,.we.will.have.preserved.the |
| 133140 | 20 69 6c 6c 75 73 69 6f 6e 20 74 68 61 74 20 74 68 65 72 65 20 69 73 20 61 6e 20 69 6e 66 69 6e | .illusion.that.there.is.an.infin |
| 133160 | 69 74 65 0a 61 6d 6f 75 6e 74 20 6f 66 20 6d 65 6d 6f 72 79 2e 0a 0a 20 20 20 49 6e 20 6f 72 64 | ite.amount.of.memory......In.ord |
| 133180 | 65 72 20 74 6f 20 72 65 63 79 63 6c 65 20 70 61 69 72 73 2c 20 77 65 20 6d 75 73 74 20 68 61 76 | er.to.recycle.pairs,.we.must.hav |
| 1331a0 | 65 20 61 20 77 61 79 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68 69 63 68 0a 61 6c 6c 6f 63 | e.a.way.to.determine.which.alloc |
| 1331c0 | 61 74 65 64 20 70 61 69 72 73 20 61 72 65 20 6e 6f 74 20 6e 65 65 64 65 64 20 28 69 6e 20 74 68 | ated.pairs.are.not.needed.(in.th |
| 1331e0 | 65 20 73 65 6e 73 65 20 74 68 61 74 20 74 68 65 69 72 20 63 6f 6e 74 65 6e 74 73 20 63 61 6e 20 | e.sense.that.their.contents.can. |
| 133200 | 6e 6f 0a 6c 6f 6e 67 65 72 20 69 6e 66 6c 75 65 6e 63 65 20 74 68 65 20 66 75 74 75 72 65 20 6f | no.longer.influence.the.future.o |
| 133220 | 66 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 29 2e 20 20 54 68 65 20 6d 65 74 68 6f 64 20 | f.the.computation)...The.method. |
| 133240 | 77 65 20 73 68 61 6c 6c 0a 65 78 61 6d 69 6e 65 20 66 6f 72 20 61 63 63 6f 6d 70 6c 69 73 68 69 | we.shall.examine.for.accomplishi |
| 133260 | 6e 67 20 74 68 69 73 20 69 73 20 6b 6e 6f 77 6e 20 61 73 20 22 67 61 72 62 61 67 65 20 63 6f 6c | ng.this.is.known.as."garbage.col |
| 133280 | 6c 65 63 74 69 6f 6e 22 2e 0a 47 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 69 73 20 | lection"..Garbage.collection.is. |
| 1332a0 | 62 61 73 65 64 20 6f 6e 20 74 68 65 20 6f 62 73 65 72 76 61 74 69 6f 6e 20 74 68 61 74 2c 20 61 | based.on.the.observation.that,.a |
| 1332c0 | 74 20 61 6e 79 20 6d 6f 6d 65 6e 74 20 69 6e 20 61 0a 4c 69 73 70 20 69 6e 74 65 72 70 72 65 74 | t.any.moment.in.a.Lisp.interpret |
| 1332e0 | 61 74 69 6f 6e 2c 20 74 68 65 20 6f 6e 6c 79 20 6f 62 6a 65 63 74 73 20 74 68 61 74 20 63 61 6e | ation,.the.only.objects.that.can |
| 133300 | 20 61 66 66 65 63 74 20 74 68 65 20 66 75 74 75 72 65 20 6f 66 20 74 68 65 0a 63 6f 6d 70 75 74 | .affect.the.future.of.the.comput |
| 133320 | 61 74 69 6f 6e 20 61 72 65 20 74 68 6f 73 65 20 74 68 61 74 20 63 61 6e 20 62 65 20 72 65 61 63 | ation.are.those.that.can.be.reac |
| 133340 | 68 65 64 20 62 79 20 73 6f 6d 65 20 73 75 63 63 65 73 73 69 6f 6e 20 6f 66 20 60 63 61 72 27 0a | hed.by.some.succession.of.`car'. |
| 133360 | 61 6e 64 20 60 63 64 72 27 20 6f 70 65 72 61 74 69 6f 6e 73 20 73 74 61 72 74 69 6e 67 20 66 72 | and.`cdr'.operations.starting.fr |
| 133380 | 6f 6d 20 74 68 65 20 70 6f 69 6e 74 65 72 73 20 74 68 61 74 20 61 72 65 20 63 75 72 72 65 6e 74 | om.the.pointers.that.are.current |
| 1333a0 | 6c 79 20 69 6e 0a 74 68 65 20 6d 61 63 68 69 6e 65 20 72 65 67 69 73 74 65 72 73 2e 28 32 29 20 | ly.in.the.machine.registers.(2). |
| 1333c0 | 41 6e 79 20 6d 65 6d 6f 72 79 20 63 65 6c 6c 20 74 68 61 74 20 69 73 20 6e 6f 74 20 73 6f 20 61 | Any.memory.cell.that.is.not.so.a |
| 1333e0 | 63 63 65 73 73 69 62 6c 65 20 6d 61 79 0a 62 65 20 72 65 63 79 63 6c 65 64 2e 0a 0a 20 20 20 54 | ccessible.may.be.recycled......T |
| 133400 | 68 65 72 65 20 61 72 65 20 6d 61 6e 79 20 77 61 79 73 20 74 6f 20 70 65 72 66 6f 72 6d 20 67 61 | here.are.many.ways.to.perform.ga |
| 133420 | 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 2e 20 20 54 68 65 20 6d 65 74 68 6f 64 20 77 65 | rbage.collection...The.method.we |
| 133440 | 0a 73 68 61 6c 6c 20 65 78 61 6d 69 6e 65 20 68 65 72 65 20 69 73 20 63 61 6c 6c 65 64 20 22 73 | .shall.examine.here.is.called."s |
| 133460 | 74 6f 70 2d 61 6e 64 2d 63 6f 70 79 22 2e 20 20 54 68 65 20 62 61 73 69 63 20 69 64 65 61 20 69 | top-and-copy"...The.basic.idea.i |
| 133480 | 73 20 74 6f 0a 64 69 76 69 64 65 20 6d 65 6d 6f 72 79 20 69 6e 74 6f 20 74 77 6f 20 68 61 6c 76 | s.to.divide.memory.into.two.halv |
| 1334a0 | 65 73 3a 20 22 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 79 22 20 61 6e 64 20 22 66 72 65 65 20 6d | es:."working.memory".and."free.m |
| 1334c0 | 65 6d 6f 72 79 2e 22 0a 57 68 65 6e 20 60 63 6f 6e 73 27 20 63 6f 6e 73 74 72 75 63 74 73 20 70 | emory.".When.`cons'.constructs.p |
| 1334e0 | 61 69 72 73 2c 20 69 74 20 61 6c 6c 6f 63 61 74 65 73 20 74 68 65 73 65 20 69 6e 20 77 6f 72 6b | airs,.it.allocates.these.in.work |
| 133500 | 69 6e 67 20 6d 65 6d 6f 72 79 2e 0a 57 68 65 6e 20 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 79 20 | ing.memory..When.working.memory. |
| 133520 | 69 73 20 66 75 6c 6c 2c 20 77 65 20 70 65 72 66 6f 72 6d 20 67 61 72 62 61 67 65 20 63 6f 6c 6c | is.full,.we.perform.garbage.coll |
| 133540 | 65 63 74 69 6f 6e 20 62 79 20 6c 6f 63 61 74 69 6e 67 0a 61 6c 6c 20 74 68 65 20 75 73 65 66 75 | ection.by.locating.all.the.usefu |
| 133560 | 6c 20 70 61 69 72 73 20 69 6e 20 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 79 20 61 6e 64 20 63 6f | l.pairs.in.working.memory.and.co |
| 133580 | 70 79 69 6e 67 20 74 68 65 73 65 20 69 6e 74 6f 0a 63 6f 6e 73 65 63 75 74 69 76 65 20 6c 6f 63 | pying.these.into.consecutive.loc |
| 1335a0 | 61 74 69 6f 6e 73 20 69 6e 20 66 72 65 65 20 6d 65 6d 6f 72 79 2e 20 20 28 54 68 65 20 75 73 65 | ations.in.free.memory...(The.use |
| 1335c0 | 66 75 6c 20 70 61 69 72 73 20 61 72 65 20 6c 6f 63 61 74 65 64 20 62 79 0a 74 72 61 63 69 6e 67 | ful.pairs.are.located.by.tracing |
| 1335e0 | 20 61 6c 6c 20 74 68 65 20 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 20 70 6f 69 6e 74 65 72 | .all.the.`car'.and.`cdr'.pointer |
| 133600 | 73 2c 20 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 74 68 65 20 6d 61 63 68 69 6e 65 0a 72 65 67 | s,.starting.with.the.machine.reg |
| 133620 | 69 73 74 65 72 73 2e 29 20 20 53 69 6e 63 65 20 77 65 20 64 6f 20 6e 6f 74 20 63 6f 70 79 20 74 | isters.)..Since.we.do.not.copy.t |
| 133640 | 68 65 20 67 61 72 62 61 67 65 2c 20 74 68 65 72 65 20 77 69 6c 6c 20 70 72 65 73 75 6d 61 62 6c | he.garbage,.there.will.presumabl |
| 133660 | 79 20 62 65 0a 61 64 64 69 74 69 6f 6e 61 6c 20 66 72 65 65 20 6d 65 6d 6f 72 79 20 74 68 61 74 | y.be.additional.free.memory.that |
| 133680 | 20 77 65 20 63 61 6e 20 75 73 65 20 74 6f 20 61 6c 6c 6f 63 61 74 65 20 6e 65 77 20 70 61 69 72 | .we.can.use.to.allocate.new.pair |
| 1336a0 | 73 2e 20 20 49 6e 0a 61 64 64 69 74 69 6f 6e 2c 20 6e 6f 74 68 69 6e 67 20 69 6e 20 74 68 65 20 | s...In.addition,.nothing.in.the. |
| 1336c0 | 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 79 20 69 73 20 6e 65 65 64 65 64 2c 20 73 69 6e 63 65 20 | working.memory.is.needed,.since. |
| 1336e0 | 61 6c 6c 20 74 68 65 20 75 73 65 66 75 6c 0a 70 61 69 72 73 20 69 6e 20 69 74 20 68 61 76 65 20 | all.the.useful.pairs.in.it.have. |
| 133700 | 62 65 65 6e 20 63 6f 70 69 65 64 2e 20 20 54 68 75 73 2c 20 69 66 20 77 65 20 69 6e 74 65 72 63 | been.copied...Thus,.if.we.interc |
| 133720 | 68 61 6e 67 65 20 74 68 65 20 72 6f 6c 65 73 20 6f 66 0a 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 | hange.the.roles.of.working.memor |
| 133740 | 79 20 61 6e 64 20 66 72 65 65 20 6d 65 6d 6f 72 79 2c 20 77 65 20 63 61 6e 20 63 6f 6e 74 69 6e | y.and.free.memory,.we.can.contin |
| 133760 | 75 65 20 70 72 6f 63 65 73 73 69 6e 67 3b 20 6e 65 77 20 70 61 69 72 73 0a 77 69 6c 6c 20 62 65 | ue.processing;.new.pairs.will.be |
| 133780 | 20 61 6c 6c 6f 63 61 74 65 64 20 69 6e 20 74 68 65 20 6e 65 77 20 77 6f 72 6b 69 6e 67 20 6d 65 | .allocated.in.the.new.working.me |
| 1337a0 | 6d 6f 72 79 20 28 77 68 69 63 68 20 77 61 73 20 74 68 65 20 6f 6c 64 20 66 72 65 65 0a 6d 65 6d | mory.(which.was.the.old.free.mem |
| 1337c0 | 6f 72 79 29 2e 20 20 57 68 65 6e 20 74 68 69 73 20 69 73 20 66 75 6c 6c 2c 20 77 65 20 63 61 6e | ory)...When.this.is.full,.we.can |
| 1337e0 | 20 63 6f 70 79 20 74 68 65 20 75 73 65 66 75 6c 20 70 61 69 72 73 20 69 6e 74 6f 20 74 68 65 20 | .copy.the.useful.pairs.into.the. |
| 133800 | 6e 65 77 0a 66 72 65 65 20 6d 65 6d 6f 72 79 20 28 77 68 69 63 68 20 77 61 73 20 74 68 65 20 6f | new.free.memory.(which.was.the.o |
| 133820 | 6c 64 20 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 79 29 2e 28 33 29 0a 0a 49 6d 70 6c 65 6d 65 6e | ld.working.memory).(3)..Implemen |
| 133840 | 74 61 74 69 6f 6e 20 6f 66 20 61 20 73 74 6f 70 2d 61 6e 64 2d 63 6f 70 79 20 67 61 72 62 61 67 | tation.of.a.stop-and-copy.garbag |
| 133860 | 65 20 63 6f 6c 6c 65 63 74 6f 72 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | e.collector..................... |
| 133880 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a | ................................ |
| 1338a0 | 0a 57 65 20 6e 6f 77 20 75 73 65 20 6f 75 72 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 | .We.now.use.our.register-machine |
| 1338c0 | 20 6c 61 6e 67 75 61 67 65 20 74 6f 20 64 65 73 63 72 69 62 65 20 74 68 65 20 73 74 6f 70 2d 61 | .language.to.describe.the.stop-a |
| 1338e0 | 6e 64 2d 63 6f 70 79 0a 61 6c 67 6f 72 69 74 68 6d 20 69 6e 20 6d 6f 72 65 20 64 65 74 61 69 6c | nd-copy.algorithm.in.more.detail |
| 133900 | 2e 20 20 57 65 20 77 69 6c 6c 20 61 73 73 75 6d 65 20 74 68 61 74 20 74 68 65 72 65 20 69 73 20 | ...We.will.assume.that.there.is. |
| 133920 | 61 20 72 65 67 69 73 74 65 72 0a 63 61 6c 6c 65 64 20 60 72 6f 6f 74 27 20 74 68 61 74 20 63 6f | a.register.called.`root'.that.co |
| 133940 | 6e 74 61 69 6e 73 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 20 73 74 72 75 63 74 75 72 65 20 | ntains.a.pointer.to.a.structure. |
| 133960 | 74 68 61 74 20 65 76 65 6e 74 75 61 6c 6c 79 0a 70 6f 69 6e 74 73 20 61 74 20 61 6c 6c 20 61 63 | that.eventually.points.at.all.ac |
| 133980 | 63 65 73 73 69 62 6c 65 20 64 61 74 61 2e 20 20 54 68 69 73 20 63 61 6e 20 62 65 20 61 72 72 61 | cessible.data...This.can.be.arra |
| 1339a0 | 6e 67 65 64 20 62 79 20 73 74 6f 72 69 6e 67 20 74 68 65 0a 63 6f 6e 74 65 6e 74 73 20 6f 66 20 | nged.by.storing.the.contents.of. |
| 1339c0 | 61 6c 6c 20 74 68 65 20 6d 61 63 68 69 6e 65 20 72 65 67 69 73 74 65 72 73 20 69 6e 20 61 20 70 | all.the.machine.registers.in.a.p |
| 1339e0 | 72 65 2d 61 6c 6c 6f 63 61 74 65 64 20 6c 69 73 74 20 70 6f 69 6e 74 65 64 0a 61 74 20 62 79 20 | re-allocated.list.pointed.at.by. |
| 133a00 | 60 72 6f 6f 74 27 20 6a 75 73 74 20 62 65 66 6f 72 65 20 73 74 61 72 74 69 6e 67 20 67 61 72 62 | `root'.just.before.starting.garb |
| 133a20 | 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 2e 28 34 29 20 57 65 20 61 6c 73 6f 20 61 73 73 75 6d | age.collection.(4).We.also.assum |
| 133a40 | 65 0a 74 68 61 74 2c 20 69 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 74 68 65 20 63 75 72 72 65 | e.that,.in.addition.to.the.curre |
| 133a60 | 6e 74 20 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 79 2c 20 74 68 65 72 65 20 69 73 20 66 72 65 65 | nt.working.memory,.there.is.free |
| 133a80 | 20 6d 65 6d 6f 72 79 0a 61 76 61 69 6c 61 62 6c 65 20 69 6e 74 6f 20 77 68 69 63 68 20 77 65 20 | .memory.available.into.which.we. |
| 133aa0 | 63 61 6e 20 63 6f 70 79 20 74 68 65 20 75 73 65 66 75 6c 20 64 61 74 61 2e 20 20 54 68 65 20 63 | can.copy.the.useful.data...The.c |
| 133ac0 | 75 72 72 65 6e 74 20 77 6f 72 6b 69 6e 67 0a 6d 65 6d 6f 72 79 20 63 6f 6e 73 69 73 74 73 20 6f | urrent.working.memory.consists.o |
| 133ae0 | 66 20 76 65 63 74 6f 72 73 20 77 68 6f 73 65 20 62 61 73 65 20 61 64 64 72 65 73 73 65 73 20 61 | f.vectors.whose.base.addresses.a |
| 133b00 | 72 65 20 69 6e 20 72 65 67 69 73 74 65 72 73 20 63 61 6c 6c 65 64 0a 60 74 68 65 2d 63 61 72 73 | re.in.registers.called.`the-cars |
| 133b20 | 27 20 61 6e 64 20 60 74 68 65 2d 63 64 72 73 27 2c 20 61 6e 64 20 74 68 65 20 66 72 65 65 20 6d | '.and.`the-cdrs',.and.the.free.m |
| 133b40 | 65 6d 6f 72 79 20 69 73 20 69 6e 20 72 65 67 69 73 74 65 72 73 20 63 61 6c 6c 65 64 0a 60 6e 65 | emory.is.in.registers.called.`ne |
| 133b60 | 77 2d 63 61 72 73 27 20 61 6e 64 20 60 6e 65 77 2d 63 64 72 73 27 2e 0a 0a 20 20 20 47 61 72 62 | w-cars'.and.`new-cdrs'......Garb |
| 133b80 | 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 69 73 20 74 72 69 67 67 65 72 65 64 20 77 68 65 6e | age.collection.is.triggered.when |
| 133ba0 | 20 77 65 20 65 78 68 61 75 73 74 20 74 68 65 20 66 72 65 65 20 63 65 6c 6c 73 20 69 6e 0a 74 68 | .we.exhaust.the.free.cells.in.th |
| 133bc0 | 65 20 63 75 72 72 65 6e 74 20 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 79 2c 20 74 68 61 74 20 69 | e.current.working.memory,.that.i |
| 133be0 | 73 2c 20 77 68 65 6e 20 61 20 60 63 6f 6e 73 27 20 6f 70 65 72 61 74 69 6f 6e 20 61 74 74 65 6d | s,.when.a.`cons'.operation.attem |
| 133c00 | 70 74 73 0a 74 6f 20 69 6e 63 72 65 6d 65 6e 74 20 74 68 65 20 60 66 72 65 65 27 20 70 6f 69 6e | pts.to.increment.the.`free'.poin |
| 133c20 | 74 65 72 20 62 65 79 6f 6e 64 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 6d 65 6d 6f 72 79 | ter.beyond.the.end.of.the.memory |
| 133c40 | 20 76 65 63 74 6f 72 2e 0a 57 68 65 6e 20 74 68 65 20 67 61 72 62 61 67 65 2d 63 6f 6c 6c 65 63 | .vector..When.the.garbage-collec |
| 133c60 | 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 69 73 20 63 6f 6d 70 6c 65 74 65 2c 20 74 68 65 20 60 72 | tion.process.is.complete,.the.`r |
| 133c80 | 6f 6f 74 27 20 70 6f 69 6e 74 65 72 0a 77 69 6c 6c 20 70 6f 69 6e 74 20 69 6e 74 6f 20 74 68 65 | oot'.pointer.will.point.into.the |
| 133ca0 | 20 6e 65 77 20 6d 65 6d 6f 72 79 2c 20 61 6c 6c 20 6f 62 6a 65 63 74 73 20 61 63 63 65 73 73 69 | .new.memory,.all.objects.accessi |
| 133cc0 | 62 6c 65 20 66 72 6f 6d 20 74 68 65 20 60 72 6f 6f 74 27 0a 77 69 6c 6c 20 68 61 76 65 20 62 65 | ble.from.the.`root'.will.have.be |
| 133ce0 | 65 6e 20 6d 6f 76 65 64 20 74 6f 20 74 68 65 20 6e 65 77 20 6d 65 6d 6f 72 79 2c 20 61 6e 64 20 | en.moved.to.the.new.memory,.and. |
| 133d00 | 74 68 65 20 60 66 72 65 65 27 20 70 6f 69 6e 74 65 72 20 77 69 6c 6c 0a 69 6e 64 69 63 61 74 65 | the.`free'.pointer.will.indicate |
| 133d20 | 20 74 68 65 20 6e 65 78 74 20 70 6c 61 63 65 20 69 6e 20 74 68 65 20 6e 65 77 20 6d 65 6d 6f 72 | .the.next.place.in.the.new.memor |
| 133d40 | 79 20 77 68 65 72 65 20 61 20 6e 65 77 20 70 61 69 72 20 63 61 6e 20 62 65 0a 61 6c 6c 6f 63 61 | y.where.a.new.pair.can.be.alloca |
| 133d60 | 74 65 64 2e 20 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 74 68 65 20 72 6f 6c 65 73 20 6f 66 20 | ted...In.addition,.the.roles.of. |
| 133d80 | 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 79 20 61 6e 64 20 6e 65 77 20 6d 65 6d 6f 72 79 0a 77 69 | working.memory.and.new.memory.wi |
| 133da0 | 6c 6c 20 68 61 76 65 20 62 65 65 6e 20 69 6e 74 65 72 63 68 61 6e 67 65 64 2d 2d 6e 65 77 20 70 | ll.have.been.interchanged--new.p |
| 133dc0 | 61 69 72 73 20 77 69 6c 6c 20 62 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 69 6e 20 74 68 65 20 | airs.will.be.constructed.in.the. |
| 133de0 | 6e 65 77 0a 6d 65 6d 6f 72 79 2c 20 62 65 67 69 6e 6e 69 6e 67 20 61 74 20 74 68 65 20 70 6c 61 | new.memory,.beginning.at.the.pla |
| 133e00 | 63 65 20 69 6e 64 69 63 61 74 65 64 20 62 79 20 60 66 72 65 65 27 2c 20 61 6e 64 20 74 68 65 20 | ce.indicated.by.`free',.and.the. |
| 133e20 | 28 70 72 65 76 69 6f 75 73 29 0a 77 6f 72 6b 69 6e 67 20 6d 65 6d 6f 72 79 20 77 69 6c 6c 20 62 | (previous).working.memory.will.b |
| 133e40 | 65 20 61 76 61 69 6c 61 62 6c 65 20 61 73 20 74 68 65 20 6e 65 77 20 6d 65 6d 6f 72 79 20 66 6f | e.available.as.the.new.memory.fo |
| 133e60 | 72 20 74 68 65 20 6e 65 78 74 20 67 61 72 62 61 67 65 0a 63 6f 6c 6c 65 63 74 69 6f 6e 2e 20 20 | r.the.next.garbage.collection... |
| 133e80 | 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 35 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 61 72 | *Note.Figure.5-15::.shows.the.ar |
| 133ea0 | 72 61 6e 67 65 6d 65 6e 74 20 6f 66 20 6d 65 6d 6f 72 79 20 6a 75 73 74 0a 62 65 66 6f 72 65 20 | rangement.of.memory.just.before. |
| 133ec0 | 61 6e 64 20 6a 75 73 74 20 61 66 74 65 72 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f | and.just.after.garbage.collectio |
| 133ee0 | 6e 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 31 35 3a 2a 20 52 65 63 6f 6e 66 69 67 | n........*Figure.5.15:*.Reconfig |
| 133f00 | 75 72 61 74 69 6f 6e 20 6f 66 20 6d 65 6d 6f 72 79 20 62 79 20 74 68 65 20 67 61 72 62 61 67 65 | uration.of.memory.by.the.garbage |
| 133f20 | 2d 63 6f 6c 6c 65 63 74 69 6f 6e 0a 20 20 20 20 20 70 72 6f 63 65 73 73 2e 0a 0a 20 20 20 20 20 | -collection......process........ |
| 133f40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4a 75 73 74 20 62 65 66 6f 72 65 20 67 61 | ..................Just.before.ga |
| 133f60 | 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rbage.collection................ |
| 133f80 | 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .....+-------------------------- |
| 133fa0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 63 61 72 73 20 7c | ----------+...........the-cars.| |
| 133fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 133fe0 | 20 20 20 20 7c 20 77 6f 72 6b 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....|.working................... |
| 134000 | 20 7c 20 6d 69 78 74 75 72 65 20 6f 66 20 75 73 65 66 75 6c 20 64 61 74 61 20 61 6e 64 20 67 61 | .|.mixture.of.useful.data.and.ga |
| 134020 | 72 62 61 67 65 20 7c 20 6d 65 6d 6f 72 79 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 63 64 72 | rbage.|.memory...........the-cdr |
| 134040 | 73 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | s.|............................. |
| 134060 | 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d | .......|....................+--- |
| 134080 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 1340a0 | 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -+.............................. |
| 1340c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 | .........................^...... |
| 1340e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 134100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 66 72 65 65 0a 0a 20 20 20 20 20 20 20 | .................|.free......... |
| 134120 | 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ............+------------------- |
| 134140 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 6e 65 77 | -----------------+...........new |
| 134160 | 2d 63 61 72 73 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -cars.|......................... |
| 134180 | 20 20 20 20 20 20 20 20 20 20 20 7c 20 66 72 65 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........|.free............... |
| 1341a0 | 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 66 72 65 65 20 6d 65 6d 6f 72 79 20 20 20 | .....|............free.memory... |
| 1341c0 | 20 20 20 20 20 20 20 20 20 20 7c 20 6d 65 6d 6f 72 79 0a 20 20 20 20 20 20 20 20 20 20 6e 65 77 | ..........|.memory...........new |
| 1341e0 | 2d 63 64 72 73 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -cdrs.|......................... |
| 134200 | 20 20 20 20 20 20 20 20 20 20 20 7c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........|.................... |
| 134220 | 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | +------------------------------- |
| 134240 | 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4a | -----+.........................J |
| 134260 | 75 73 74 20 61 66 74 65 72 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 0a 0a 20 20 | ust.after.garbage.collection.... |
| 134280 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .................+-------------- |
| 1342a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 | ----------------------+......... |
| 1342c0 | 20 20 6e 65 77 2d 63 61 72 73 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..new-cars.|.................... |
| 1342e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 6e 65 77 0a 20 20 20 20 20 20 20 20 20 20 | ................|.new........... |
| 134300 | 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 64 69 73 63 61 72 64 65 64 20 6d 65 | .........|..........discarded.me |
| 134320 | 6d 6f 72 79 20 20 20 20 20 20 20 20 20 20 7c 20 66 72 65 65 0a 20 20 20 20 20 20 20 20 20 20 6e | mory..........|.free...........n |
| 134340 | 65 77 2d 63 64 72 73 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ew-cdrs.|....................... |
| 134360 | 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 6d 65 6d 6f 72 79 0a 20 20 20 20 20 20 20 20 20 20 | .............|.memory........... |
| 134380 | 20 20 20 20 20 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .........+---------------------- |
| 1343a0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | --------------+................. |
| 1343c0 | 20 20 20 20 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d | ....+------------------+-------- |
| 1343e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 63 61 72 73 20 7c 20 | ---------+...........the-cars.|. |
| 134400 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .................|.............. |
| 134420 | 20 20 20 7c 20 6e 65 77 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 | ...|.new....................|... |
| 134440 | 75 73 65 66 75 6c 20 64 61 74 61 20 20 20 20 7c 20 20 20 20 66 72 65 65 20 61 72 65 61 20 20 20 | useful.data....|....free.area... |
| 134460 | 20 7c 20 77 6f 72 6b 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 2d 63 64 72 73 20 7c 20 | .|.working...........the-cdrs.|. |
| 134480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .................|.............. |
| 1344a0 | 20 20 20 7c 20 6d 65 6d 6f 72 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2b | ...|.memory....................+ |
| 1344c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2b 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ------------------+------------- |
| 1344e0 | 2d 2d 2d 2d 2b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ----+........................... |
| 134500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............^................. |
| 134520 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 66 72 65 65 0a 0a | ........................|.free.. |
| 134540 | 20 20 20 54 68 65 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 67 61 72 62 61 67 65 2d 63 6f 6c 6c | ...The.state.of.the.garbage-coll |
| 134560 | 65 63 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 69 73 20 63 6f 6e 74 72 6f 6c 6c 65 64 20 62 79 0a | ection.process.is.controlled.by. |
| 134580 | 6d 61 69 6e 74 61 69 6e 69 6e 67 20 74 77 6f 20 70 6f 69 6e 74 65 72 73 3a 20 60 66 72 65 65 27 | maintaining.two.pointers:.`free' |
| 1345a0 | 20 61 6e 64 20 60 73 63 61 6e 27 2e 20 20 54 68 65 73 65 20 61 72 65 20 69 6e 69 74 69 61 6c 69 | .and.`scan'...These.are.initiali |
| 1345c0 | 7a 65 64 20 74 6f 0a 70 6f 69 6e 74 20 74 6f 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 | zed.to.point.to.the.beginning.of |
| 1345e0 | 20 74 68 65 20 6e 65 77 20 6d 65 6d 6f 72 79 2e 20 20 54 68 65 20 61 6c 67 6f 72 69 74 68 6d 20 | .the.new.memory...The.algorithm. |
| 134600 | 62 65 67 69 6e 73 20 62 79 0a 72 65 6c 6f 63 61 74 69 6e 67 20 74 68 65 20 70 61 69 72 20 70 6f | begins.by.relocating.the.pair.po |
| 134620 | 69 6e 74 65 64 20 61 74 20 62 79 20 60 72 6f 6f 74 27 20 74 6f 20 74 68 65 20 62 65 67 69 6e 6e | inted.at.by.`root'.to.the.beginn |
| 134640 | 69 6e 67 20 6f 66 20 74 68 65 20 6e 65 77 0a 6d 65 6d 6f 72 79 2e 20 20 54 68 65 20 70 61 69 72 | ing.of.the.new.memory...The.pair |
| 134660 | 20 69 73 20 63 6f 70 69 65 64 2c 20 74 68 65 20 60 72 6f 6f 74 27 20 70 6f 69 6e 74 65 72 20 69 | .is.copied,.the.`root'.pointer.i |
| 134680 | 73 20 61 64 6a 75 73 74 65 64 20 74 6f 20 70 6f 69 6e 74 20 74 6f 0a 74 68 65 20 6e 65 77 20 6c | s.adjusted.to.point.to.the.new.l |
| 1346a0 | 6f 63 61 74 69 6f 6e 2c 20 61 6e 64 20 74 68 65 20 60 66 72 65 65 27 20 70 6f 69 6e 74 65 72 20 | ocation,.and.the.`free'.pointer. |
| 1346c0 | 69 73 20 69 6e 63 72 65 6d 65 6e 74 65 64 2e 20 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 0a 74 68 | is.incremented...In.addition,.th |
| 1346e0 | 65 20 6f 6c 64 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 70 61 69 72 20 69 73 20 6d 61 | e.old.location.of.the.pair.is.ma |
| 134700 | 72 6b 65 64 20 74 6f 20 73 68 6f 77 20 74 68 61 74 20 69 74 73 20 63 6f 6e 74 65 6e 74 73 20 68 | rked.to.show.that.its.contents.h |
| 134720 | 61 76 65 0a 62 65 65 6e 20 6d 6f 76 65 64 2e 20 20 54 68 69 73 20 6d 61 72 6b 69 6e 67 20 69 73 | ave.been.moved...This.marking.is |
| 134740 | 20 64 6f 6e 65 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 20 49 6e 20 74 68 65 20 60 63 61 72 27 20 70 | .done.as.follows:.In.the.`car'.p |
| 134760 | 6f 73 69 74 69 6f 6e 2c 20 77 65 0a 70 6c 61 63 65 20 61 20 73 70 65 63 69 61 6c 20 74 61 67 20 | osition,.we.place.a.special.tag. |
| 134780 | 74 68 61 74 20 73 69 67 6e 61 6c 73 20 74 68 61 74 20 74 68 69 73 20 69 73 20 61 6e 20 61 6c 72 | that.signals.that.this.is.an.alr |
| 1347a0 | 65 61 64 79 2d 6d 6f 76 65 64 20 6f 62 6a 65 63 74 2e 0a 28 53 75 63 68 20 61 6e 20 6f 62 6a 65 | eady-moved.object..(Such.an.obje |
| 1347c0 | 63 74 20 69 73 20 74 72 61 64 69 74 69 6f 6e 61 6c 6c 79 20 63 61 6c 6c 65 64 20 61 20 22 62 72 | ct.is.traditionally.called.a."br |
| 1347e0 | 6f 6b 65 6e 20 68 65 61 72 74 22 2e 29 28 35 29 20 20 49 6e 20 74 68 65 0a 60 63 64 72 27 20 70 | oken.heart".)(5)..In.the.`cdr'.p |
| 134800 | 6f 73 69 74 69 6f 6e 20 77 65 20 70 6c 61 63 65 20 61 20 22 66 6f 72 77 61 72 64 69 6e 67 20 61 | osition.we.place.a."forwarding.a |
| 134820 | 64 64 72 65 73 73 22 20 74 68 61 74 20 70 6f 69 6e 74 73 20 61 74 20 74 68 65 0a 6c 6f 63 61 74 | ddress".that.points.at.the.locat |
| 134840 | 69 6f 6e 20 74 6f 20 77 68 69 63 68 20 74 68 65 20 6f 62 6a 65 63 74 20 68 61 73 20 62 65 65 6e | ion.to.which.the.object.has.been |
| 134860 | 20 6d 6f 76 65 64 2e 0a 0a 20 20 20 41 66 74 65 72 20 72 65 6c 6f 63 61 74 69 6e 67 20 74 68 65 | .moved......After.relocating.the |
| 134880 | 20 72 6f 6f 74 2c 20 74 68 65 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 6f 72 20 65 6e 74 | .root,.the.garbage.collector.ent |
| 1348a0 | 65 72 73 20 69 74 73 20 62 61 73 69 63 0a 63 79 63 6c 65 2e 20 20 41 74 20 65 61 63 68 20 73 74 | ers.its.basic.cycle...At.each.st |
| 1348c0 | 65 70 20 69 6e 20 74 68 65 20 61 6c 67 6f 72 69 74 68 6d 2c 20 74 68 65 20 60 73 63 61 6e 27 20 | ep.in.the.algorithm,.the.`scan'. |
| 1348e0 | 70 6f 69 6e 74 65 72 20 28 69 6e 69 74 69 61 6c 6c 79 0a 70 6f 69 6e 74 69 6e 67 20 61 74 20 74 | pointer.(initially.pointing.at.t |
| 134900 | 68 65 20 72 65 6c 6f 63 61 74 65 64 20 72 6f 6f 74 29 20 70 6f 69 6e 74 73 20 61 74 20 61 20 70 | he.relocated.root).points.at.a.p |
| 134920 | 61 69 72 20 74 68 61 74 20 68 61 73 20 62 65 65 6e 20 6d 6f 76 65 64 20 74 6f 0a 74 68 65 20 6e | air.that.has.been.moved.to.the.n |
| 134940 | 65 77 20 6d 65 6d 6f 72 79 20 62 75 74 20 77 68 6f 73 65 20 60 63 61 72 27 20 61 6e 64 20 60 63 | ew.memory.but.whose.`car'.and.`c |
| 134960 | 64 72 27 20 70 6f 69 6e 74 65 72 73 20 73 74 69 6c 6c 20 72 65 66 65 72 20 74 6f 0a 6f 62 6a 65 | dr'.pointers.still.refer.to.obje |
| 134980 | 63 74 73 20 69 6e 20 74 68 65 20 6f 6c 64 20 6d 65 6d 6f 72 79 2e 20 20 54 68 65 73 65 20 6f 62 | cts.in.the.old.memory...These.ob |
| 1349a0 | 6a 65 63 74 73 20 61 72 65 20 65 61 63 68 20 72 65 6c 6f 63 61 74 65 64 2c 20 61 6e 64 20 74 68 | jects.are.each.relocated,.and.th |
| 1349c0 | 65 0a 60 73 63 61 6e 27 20 70 6f 69 6e 74 65 72 20 69 73 20 69 6e 63 72 65 6d 65 6e 74 65 64 2e | e.`scan'.pointer.is.incremented. |
| 1349e0 | 20 20 54 6f 20 72 65 6c 6f 63 61 74 65 20 61 6e 20 6f 62 6a 65 63 74 20 28 66 6f 72 20 65 78 61 | ..To.relocate.an.object.(for.exa |
| 134a00 | 6d 70 6c 65 2c 20 74 68 65 0a 6f 62 6a 65 63 74 20 69 6e 64 69 63 61 74 65 64 20 62 79 20 74 68 | mple,.the.object.indicated.by.th |
| 134a20 | 65 20 60 63 61 72 27 20 70 6f 69 6e 74 65 72 20 6f 66 20 74 68 65 20 70 61 69 72 20 77 65 20 61 | e.`car'.pointer.of.the.pair.we.a |
| 134a40 | 72 65 20 73 63 61 6e 6e 69 6e 67 29 20 77 65 0a 63 68 65 63 6b 20 74 6f 20 73 65 65 20 69 66 20 | re.scanning).we.check.to.see.if. |
| 134a60 | 74 68 65 20 6f 62 6a 65 63 74 20 68 61 73 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 6d 6f 76 65 | the.object.has.already.been.move |
| 134a80 | 64 20 28 61 73 20 69 6e 64 69 63 61 74 65 64 20 62 79 20 74 68 65 0a 70 72 65 73 65 6e 63 65 20 | d.(as.indicated.by.the.presence. |
| 134aa0 | 6f 66 20 61 20 62 72 6f 6b 65 6e 2d 68 65 61 72 74 20 74 61 67 20 69 6e 20 74 68 65 20 60 63 61 | of.a.broken-heart.tag.in.the.`ca |
| 134ac0 | 72 27 20 70 6f 73 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 6f 62 6a 65 63 74 29 2e 0a 49 66 20 74 | r'.position.of.the.object)..If.t |
| 134ae0 | 68 65 20 6f 62 6a 65 63 74 20 68 61 73 20 6e 6f 74 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 6d | he.object.has.not.already.been.m |
| 134b00 | 6f 76 65 64 2c 20 77 65 20 63 6f 70 79 20 69 74 20 74 6f 20 74 68 65 20 70 6c 61 63 65 0a 69 6e | oved,.we.copy.it.to.the.place.in |
| 134b20 | 64 69 63 61 74 65 64 20 62 79 20 60 66 72 65 65 27 2c 20 75 70 64 61 74 65 20 60 66 72 65 65 27 | dicated.by.`free',.update.`free' |
| 134b40 | 2c 20 73 65 74 20 75 70 20 61 20 62 72 6f 6b 65 6e 20 68 65 61 72 74 20 61 74 20 74 68 65 0a 6f | ,.set.up.a.broken.heart.at.the.o |
| 134b60 | 62 6a 65 63 74 27 73 20 6f 6c 64 20 6c 6f 63 61 74 69 6f 6e 2c 20 61 6e 64 20 75 70 64 61 74 65 | bject's.old.location,.and.update |
| 134b80 | 20 74 68 65 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 6f 62 6a 65 63 74 20 28 69 6e 20 74 | .the.pointer.to.the.object.(in.t |
| 134ba0 | 68 69 73 0a 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 60 63 61 72 27 20 70 6f 69 6e 74 65 72 20 6f | his.example,.the.`car'.pointer.o |
| 134bc0 | 66 20 74 68 65 20 70 61 69 72 20 77 65 20 61 72 65 20 73 63 61 6e 6e 69 6e 67 29 20 74 6f 20 70 | f.the.pair.we.are.scanning).to.p |
| 134be0 | 6f 69 6e 74 20 74 6f 20 74 68 65 0a 6e 65 77 20 6c 6f 63 61 74 69 6f 6e 2e 20 20 49 66 20 74 68 | oint.to.the.new.location...If.th |
| 134c00 | 65 20 6f 62 6a 65 63 74 20 68 61 73 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 6d 6f 76 65 64 2c | e.object.has.already.been.moved, |
| 134c20 | 20 69 74 73 20 66 6f 72 77 61 72 64 69 6e 67 0a 61 64 64 72 65 73 73 20 28 66 6f 75 6e 64 20 69 | .its.forwarding.address.(found.i |
| 134c40 | 6e 20 74 68 65 20 60 63 64 72 27 20 70 6f 73 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 72 6f 6b | n.the.`cdr'.position.of.the.brok |
| 134c60 | 65 6e 20 68 65 61 72 74 29 20 69 73 0a 73 75 62 73 74 69 74 75 74 65 64 20 66 6f 72 20 74 68 65 | en.heart).is.substituted.for.the |
| 134c80 | 20 70 6f 69 6e 74 65 72 20 69 6e 20 74 68 65 20 70 61 69 72 20 62 65 69 6e 67 20 73 63 61 6e 6e | .pointer.in.the.pair.being.scann |
| 134ca0 | 65 64 2e 20 20 45 76 65 6e 74 75 61 6c 6c 79 2c 20 61 6c 6c 0a 61 63 63 65 73 73 69 62 6c 65 20 | ed...Eventually,.all.accessible. |
| 134cc0 | 6f 62 6a 65 63 74 73 20 77 69 6c 6c 20 68 61 76 65 20 62 65 65 6e 20 6d 6f 76 65 64 20 61 6e 64 | objects.will.have.been.moved.and |
| 134ce0 | 20 73 63 61 6e 6e 65 64 2c 20 61 74 20 77 68 69 63 68 20 70 6f 69 6e 74 20 74 68 65 0a 60 73 63 | .scanned,.at.which.point.the.`sc |
| 134d00 | 61 6e 27 20 70 6f 69 6e 74 65 72 20 77 69 6c 6c 20 6f 76 65 72 74 61 6b 65 20 74 68 65 20 60 66 | an'.pointer.will.overtake.the.`f |
| 134d20 | 72 65 65 27 20 70 6f 69 6e 74 65 72 20 61 6e 64 20 74 68 65 20 70 72 6f 63 65 73 73 20 77 69 6c | ree'.pointer.and.the.process.wil |
| 134d40 | 6c 0a 74 65 72 6d 69 6e 61 74 65 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 73 70 65 63 69 66 79 20 | l.terminate......We.can.specify. |
| 134d60 | 74 68 65 20 73 74 6f 70 2d 61 6e 64 2d 63 6f 70 79 20 61 6c 67 6f 72 69 74 68 6d 20 61 73 20 61 | the.stop-and-copy.algorithm.as.a |
| 134d80 | 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 66 6f 72 20 61 20 | .sequence.of.instructions.for.a. |
| 134da0 | 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 2e 20 20 54 68 65 20 62 61 73 69 63 20 73 74 65 | register.machine...The.basic.ste |
| 134dc0 | 70 20 6f 66 20 72 65 6c 6f 63 61 74 69 6e 67 20 61 6e 0a 6f 62 6a 65 63 74 20 69 73 20 61 63 63 | p.of.relocating.an.object.is.acc |
| 134de0 | 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 61 20 73 75 62 72 6f 75 74 69 6e 65 20 63 61 6c 6c 65 64 | omplished.by.a.subroutine.called |
| 134e00 | 0a 60 72 65 6c 6f 63 61 74 65 2d 6f 6c 64 2d 72 65 73 75 6c 74 2d 69 6e 2d 6e 65 77 27 2e 20 20 | .`relocate-old-result-in-new'... |
| 134e20 | 54 68 69 73 20 73 75 62 72 6f 75 74 69 6e 65 20 67 65 74 73 20 69 74 73 20 61 72 67 75 6d 65 6e | This.subroutine.gets.its.argumen |
| 134e40 | 74 2c 20 61 0a 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 6f 62 6a 65 63 74 20 74 6f 20 62 65 | t,.a.pointer.to.the.object.to.be |
| 134e60 | 20 72 65 6c 6f 63 61 74 65 64 2c 20 66 72 6f 6d 20 61 20 72 65 67 69 73 74 65 72 20 6e 61 6d 65 | .relocated,.from.a.register.name |
| 134e80 | 64 20 60 6f 6c 64 27 2e 20 20 49 74 0a 72 65 6c 6f 63 61 74 65 73 20 74 68 65 20 64 65 73 69 67 | d.`old'...It.relocates.the.desig |
| 134ea0 | 6e 61 74 65 64 20 6f 62 6a 65 63 74 20 28 69 6e 63 72 65 6d 65 6e 74 69 6e 67 20 60 66 72 65 65 | nated.object.(incrementing.`free |
| 134ec0 | 27 20 69 6e 20 74 68 65 20 70 72 6f 63 65 73 73 29 2c 0a 70 75 74 73 20 61 20 70 6f 69 6e 74 65 | '.in.the.process),.puts.a.pointe |
| 134ee0 | 72 20 74 6f 20 74 68 65 20 72 65 6c 6f 63 61 74 65 64 20 6f 62 6a 65 63 74 20 69 6e 74 6f 20 61 | r.to.the.relocated.object.into.a |
| 134f00 | 20 72 65 67 69 73 74 65 72 20 63 61 6c 6c 65 64 20 60 6e 65 77 27 2c 0a 61 6e 64 20 72 65 74 75 | .register.called.`new',.and.retu |
| 134f20 | 72 6e 73 20 62 79 20 62 72 61 6e 63 68 69 6e 67 20 74 6f 20 74 68 65 20 65 6e 74 72 79 20 70 6f | rns.by.branching.to.the.entry.po |
| 134f40 | 69 6e 74 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 72 65 67 69 73 74 65 72 0a 60 72 65 6c 6f | int.stored.in.the.register.`relo |
| 134f60 | 63 61 74 65 2d 63 6f 6e 74 69 6e 75 65 27 2e 20 20 54 6f 20 62 65 67 69 6e 20 67 61 72 62 61 67 | cate-continue'...To.begin.garbag |
| 134f80 | 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 2c 20 77 65 20 69 6e 76 6f 6b 65 20 74 68 69 73 0a 73 75 62 | e.collection,.we.invoke.this.sub |
| 134fa0 | 72 6f 75 74 69 6e 65 20 74 6f 20 72 65 6c 6f 63 61 74 65 20 74 68 65 20 60 72 6f 6f 74 27 20 70 | routine.to.relocate.the.`root'.p |
| 134fc0 | 6f 69 6e 74 65 72 2c 20 61 66 74 65 72 20 69 6e 69 74 69 61 6c 69 7a 69 6e 67 20 60 66 72 65 65 | ointer,.after.initializing.`free |
| 134fe0 | 27 0a 61 6e 64 20 60 73 63 61 6e 27 2e 20 20 57 68 65 6e 20 74 68 65 20 72 65 6c 6f 63 61 74 69 | '.and.`scan'...When.the.relocati |
| 135000 | 6f 6e 20 6f 66 20 60 72 6f 6f 74 27 20 68 61 73 20 62 65 65 6e 20 61 63 63 6f 6d 70 6c 69 73 68 | on.of.`root'.has.been.accomplish |
| 135020 | 65 64 2c 20 77 65 0a 69 6e 73 74 61 6c 6c 20 74 68 65 20 6e 65 77 20 70 6f 69 6e 74 65 72 20 61 | ed,.we.install.the.new.pointer.a |
| 135040 | 73 20 74 68 65 20 6e 65 77 20 60 72 6f 6f 74 27 20 61 6e 64 20 65 6e 74 65 72 20 74 68 65 20 6d | s.the.new.`root'.and.enter.the.m |
| 135060 | 61 69 6e 20 6c 6f 6f 70 20 6f 66 20 74 68 65 0a 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 6f | ain.loop.of.the.garbage.collecto |
| 135080 | 72 2e 0a 0a 20 20 20 20 20 62 65 67 69 6e 2d 67 61 72 62 61 67 65 2d 63 6f 6c 6c 65 63 74 69 6f | r........begin-garbage-collectio |
| 1350a0 | 6e 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 66 72 65 65 20 28 63 6f 6e 73 74 20 30 29 29 | n........(assign.free.(const.0)) |
| 1350c0 | 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 73 63 61 6e 20 28 63 6f 6e 73 74 20 30 29 29 0a | ........(assign.scan.(const.0)). |
| 1350e0 | 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 6f 6c 64 20 28 72 65 67 20 72 6f 6f 74 29 29 0a 20 | .......(assign.old.(reg.root)).. |
| 135100 | 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 72 65 6c 6f 63 61 74 65 2d 63 6f 6e 74 69 6e 75 65 20 | ......(assign.relocate-continue. |
| 135120 | 28 6c 61 62 65 6c 20 72 65 61 73 73 69 67 6e 2d 72 6f 6f 74 29 29 0a 20 20 20 20 20 20 20 28 67 | (label.reassign-root))........(g |
| 135140 | 6f 74 6f 20 28 6c 61 62 65 6c 20 72 65 6c 6f 63 61 74 65 2d 6f 6c 64 2d 72 65 73 75 6c 74 2d 69 | oto.(label.relocate-old-result-i |
| 135160 | 6e 2d 6e 65 77 29 29 0a 20 20 20 20 20 72 65 61 73 73 69 67 6e 2d 72 6f 6f 74 0a 20 20 20 20 20 | n-new))......reassign-root...... |
| 135180 | 20 20 28 61 73 73 69 67 6e 20 72 6f 6f 74 20 28 72 65 67 20 6e 65 77 29 29 0a 20 20 20 20 20 20 | ..(assign.root.(reg.new))....... |
| 1351a0 | 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 67 63 2d 6c 6f 6f 70 29 29 0a 0a 20 20 20 49 6e 20 74 | .(goto.(label.gc-loop)).....In.t |
| 1351c0 | 68 65 20 6d 61 69 6e 20 6c 6f 6f 70 20 6f 66 20 74 68 65 20 67 61 72 62 61 67 65 20 63 6f 6c 6c | he.main.loop.of.the.garbage.coll |
| 1351e0 | 65 63 74 6f 72 20 77 65 20 6d 75 73 74 20 64 65 74 65 72 6d 69 6e 65 20 77 68 65 74 68 65 72 0a | ector.we.must.determine.whether. |
| 135200 | 74 68 65 72 65 20 61 72 65 20 61 6e 79 20 6d 6f 72 65 20 6f 62 6a 65 63 74 73 20 74 6f 20 62 65 | there.are.any.more.objects.to.be |
| 135220 | 20 73 63 61 6e 6e 65 64 2e 20 20 57 65 20 64 6f 20 74 68 69 73 20 62 79 20 74 65 73 74 69 6e 67 | .scanned...We.do.this.by.testing |
| 135240 | 0a 77 68 65 74 68 65 72 20 74 68 65 20 60 73 63 61 6e 27 20 70 6f 69 6e 74 65 72 20 69 73 20 63 | .whether.the.`scan'.pointer.is.c |
| 135260 | 6f 69 6e 63 69 64 65 6e 74 20 77 69 74 68 20 74 68 65 20 60 66 72 65 65 27 20 70 6f 69 6e 74 65 | oincident.with.the.`free'.pointe |
| 135280 | 72 2e 20 20 49 66 0a 74 68 65 20 70 6f 69 6e 74 65 72 73 20 61 72 65 20 65 71 75 61 6c 2c 20 74 | r...If.the.pointers.are.equal,.t |
| 1352a0 | 68 65 6e 20 61 6c 6c 20 61 63 63 65 73 73 69 62 6c 65 20 6f 62 6a 65 63 74 73 20 68 61 76 65 20 | hen.all.accessible.objects.have. |
| 1352c0 | 62 65 65 6e 0a 72 65 6c 6f 63 61 74 65 64 2c 20 61 6e 64 20 77 65 20 62 72 61 6e 63 68 20 74 6f | been.relocated,.and.we.branch.to |
| 1352e0 | 20 60 67 63 2d 66 6c 69 70 27 2c 20 77 68 69 63 68 20 63 6c 65 61 6e 73 20 74 68 69 6e 67 73 20 | .`gc-flip',.which.cleans.things. |
| 135300 | 75 70 20 73 6f 20 74 68 61 74 0a 77 65 20 63 61 6e 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 69 | up.so.that.we.can.continue.the.i |
| 135320 | 6e 74 65 72 72 75 70 74 65 64 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 49 66 20 74 68 65 72 | nterrupted.computation...If.ther |
| 135340 | 65 20 61 72 65 20 73 74 69 6c 6c 20 70 61 69 72 73 0a 74 6f 20 62 65 20 73 63 61 6e 6e 65 64 2c | e.are.still.pairs.to.be.scanned, |
| 135360 | 20 77 65 20 63 61 6c 6c 20 74 68 65 20 72 65 6c 6f 63 61 74 65 20 73 75 62 72 6f 75 74 69 6e 65 | .we.call.the.relocate.subroutine |
| 135380 | 20 74 6f 20 72 65 6c 6f 63 61 74 65 20 74 68 65 20 60 63 61 72 27 20 6f 66 0a 74 68 65 20 6e 65 | .to.relocate.the.`car'.of.the.ne |
| 1353a0 | 78 74 20 70 61 69 72 20 28 62 79 20 70 6c 61 63 69 6e 67 20 74 68 65 20 60 63 61 72 27 20 70 6f | xt.pair.(by.placing.the.`car'.po |
| 1353c0 | 69 6e 74 65 72 20 69 6e 20 60 6f 6c 64 27 29 2e 20 20 54 68 65 0a 60 72 65 6c 6f 63 61 74 65 2d | inter.in.`old')...The.`relocate- |
| 1353e0 | 63 6f 6e 74 69 6e 75 65 27 20 72 65 67 69 73 74 65 72 20 69 73 20 73 65 74 20 75 70 20 73 6f 20 | continue'.register.is.set.up.so. |
| 135400 | 74 68 61 74 20 74 68 65 20 73 75 62 72 6f 75 74 69 6e 65 20 77 69 6c 6c 0a 72 65 74 75 72 6e 20 | that.the.subroutine.will.return. |
| 135420 | 74 6f 20 75 70 64 61 74 65 20 74 68 65 20 60 63 61 72 27 20 70 6f 69 6e 74 65 72 2e 0a 0a 20 20 | to.update.the.`car'.pointer..... |
| 135440 | 20 20 20 67 63 2d 6c 6f 6f 70 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 3d 29 20 28 | ...gc-loop........(test.(op.=).( |
| 135460 | 72 65 67 20 73 63 61 6e 29 20 28 72 65 67 20 66 72 65 65 29 29 0a 20 20 20 20 20 20 20 28 62 72 | reg.scan).(reg.free))........(br |
| 135480 | 61 6e 63 68 20 28 6c 61 62 65 6c 20 67 63 2d 66 6c 69 70 29 29 0a 20 20 20 20 20 20 20 28 61 73 | anch.(label.gc-flip))........(as |
| 1354a0 | 73 69 67 6e 20 6f 6c 64 20 28 6f 70 20 76 65 63 74 6f 72 2d 72 65 66 29 20 28 72 65 67 20 6e 65 | sign.old.(op.vector-ref).(reg.ne |
| 1354c0 | 77 2d 63 61 72 73 29 20 28 72 65 67 20 73 63 61 6e 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 | w-cars).(reg.scan))........(assi |
| 1354e0 | 67 6e 20 72 65 6c 6f 63 61 74 65 2d 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 75 70 64 61 | gn.relocate-continue.(label.upda |
| 135500 | 74 65 2d 63 61 72 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 72 65 6c | te-car))........(goto.(label.rel |
| 135520 | 6f 63 61 74 65 2d 6f 6c 64 2d 72 65 73 75 6c 74 2d 69 6e 2d 6e 65 77 29 29 0a 0a 20 20 20 41 74 | ocate-old-result-in-new)).....At |
| 135540 | 20 60 75 70 64 61 74 65 2d 63 61 72 27 2c 20 77 65 20 6d 6f 64 69 66 79 20 74 68 65 20 60 63 61 | .`update-car',.we.modify.the.`ca |
| 135560 | 72 27 20 70 6f 69 6e 74 65 72 20 6f 66 20 74 68 65 20 70 61 69 72 20 62 65 69 6e 67 0a 73 63 61 | r'.pointer.of.the.pair.being.sca |
| 135580 | 6e 6e 65 64 2c 20 74 68 65 6e 20 70 72 6f 63 65 65 64 20 74 6f 20 72 65 6c 6f 63 61 74 65 20 74 | nned,.then.proceed.to.relocate.t |
| 1355a0 | 68 65 20 60 63 64 72 27 20 6f 66 20 74 68 65 20 70 61 69 72 2e 20 20 57 65 20 72 65 74 75 72 6e | he.`cdr'.of.the.pair...We.return |
| 1355c0 | 20 74 6f 0a 60 75 70 64 61 74 65 2d 63 64 72 27 20 77 68 65 6e 20 74 68 61 74 20 72 65 6c 6f 63 | .to.`update-cdr'.when.that.reloc |
| 1355e0 | 61 74 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 2e 20 20 41 66 | ation.has.been.accomplished...Af |
| 135600 | 74 65 72 0a 72 65 6c 6f 63 61 74 69 6e 67 20 61 6e 64 20 75 70 64 61 74 69 6e 67 20 74 68 65 20 | ter.relocating.and.updating.the. |
| 135620 | 60 63 64 72 27 2c 20 77 65 20 61 72 65 20 66 69 6e 69 73 68 65 64 20 73 63 61 6e 6e 69 6e 67 20 | `cdr',.we.are.finished.scanning. |
| 135640 | 74 68 61 74 20 70 61 69 72 2c 0a 73 6f 20 77 65 20 63 6f 6e 74 69 6e 75 65 20 77 69 74 68 20 74 | that.pair,.so.we.continue.with.t |
| 135660 | 68 65 20 6d 61 69 6e 20 6c 6f 6f 70 2e 0a 0a 20 20 20 20 20 75 70 64 61 74 65 2d 63 61 72 0a 20 | he.main.loop........update-car.. |
| 135680 | 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 28 6f 70 20 76 65 63 74 6f | ......(perform.........(op.vecto |
| 1356a0 | 72 2d 73 65 74 21 29 20 28 72 65 67 20 6e 65 77 2d 63 61 72 73 29 20 28 72 65 67 20 73 63 61 6e | r-set!).(reg.new-cars).(reg.scan |
| 1356c0 | 29 20 28 72 65 67 20 6e 65 77 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 6f 6c 64 20 | ).(reg.new))........(assign.old. |
| 1356e0 | 28 6f 70 20 76 65 63 74 6f 72 2d 72 65 66 29 20 28 72 65 67 20 6e 65 77 2d 63 64 72 73 29 20 28 | (op.vector-ref).(reg.new-cdrs).( |
| 135700 | 72 65 67 20 73 63 61 6e 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 72 65 6c 6f 63 61 | reg.scan))........(assign.reloca |
| 135720 | 74 65 2d 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 75 70 64 61 74 65 2d 63 64 72 29 29 0a | te-continue.(label.update-cdr)). |
| 135740 | 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 72 65 6c 6f 63 61 74 65 2d 6f 6c 64 | .......(goto.(label.relocate-old |
| 135760 | 2d 72 65 73 75 6c 74 2d 69 6e 2d 6e 65 77 29 29 0a 0a 20 20 20 20 20 75 70 64 61 74 65 2d 63 64 | -result-in-new)).......update-cd |
| 135780 | 72 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 28 6f 70 20 76 65 | r........(perform.........(op.ve |
| 1357a0 | 63 74 6f 72 2d 73 65 74 21 29 20 28 72 65 67 20 6e 65 77 2d 63 64 72 73 29 20 28 72 65 67 20 73 | ctor-set!).(reg.new-cdrs).(reg.s |
| 1357c0 | 63 61 6e 29 20 28 72 65 67 20 6e 65 77 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 73 | can).(reg.new))........(assign.s |
| 1357e0 | 63 61 6e 20 28 6f 70 20 2b 29 20 28 72 65 67 20 73 63 61 6e 29 20 28 63 6f 6e 73 74 20 31 29 29 | can.(op.+).(reg.scan).(const.1)) |
| 135800 | 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 67 63 2d 6c 6f 6f 70 29 29 0a 0a | ........(goto.(label.gc-loop)).. |
| 135820 | 20 20 20 54 68 65 20 73 75 62 72 6f 75 74 69 6e 65 20 60 72 65 6c 6f 63 61 74 65 2d 6f 6c 64 2d | ...The.subroutine.`relocate-old- |
| 135840 | 72 65 73 75 6c 74 2d 69 6e 2d 6e 65 77 27 20 72 65 6c 6f 63 61 74 65 73 20 6f 62 6a 65 63 74 73 | result-in-new'.relocates.objects |
| 135860 | 20 61 73 0a 66 6f 6c 6c 6f 77 73 3a 20 49 66 20 74 68 65 20 6f 62 6a 65 63 74 20 74 6f 20 62 65 | .as.follows:.If.the.object.to.be |
| 135880 | 20 72 65 6c 6f 63 61 74 65 64 20 28 70 6f 69 6e 74 65 64 20 61 74 20 62 79 20 60 6f 6c 64 27 29 | .relocated.(pointed.at.by.`old') |
| 1358a0 | 20 69 73 20 6e 6f 74 20 61 0a 70 61 69 72 2c 20 74 68 65 6e 20 77 65 20 72 65 74 75 72 6e 20 74 | .is.not.a.pair,.then.we.return.t |
| 1358c0 | 68 65 20 73 61 6d 65 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 6f 62 6a 65 63 74 20 75 6e | he.same.pointer.to.the.object.un |
| 1358e0 | 63 68 61 6e 67 65 64 20 28 69 6e 0a 60 6e 65 77 27 29 2e 20 20 28 46 6f 72 20 65 78 61 6d 70 6c | changed.(in.`new')...(For.exampl |
| 135900 | 65 2c 20 77 65 20 6d 61 79 20 62 65 20 73 63 61 6e 6e 69 6e 67 20 61 20 70 61 69 72 20 77 68 6f | e,.we.may.be.scanning.a.pair.who |
| 135920 | 73 65 20 60 63 61 72 27 20 69 73 20 74 68 65 0a 6e 75 6d 62 65 72 20 34 2e 20 20 49 66 20 77 65 | se.`car'.is.the.number.4...If.we |
| 135940 | 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 60 63 61 72 27 20 62 79 20 60 6e 34 27 2c 20 61 73 | .represent.the.`car'.by.`n4',.as |
| 135960 | 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 0a 2a 4e 6f 74 65 20 35 2d 33 2d | .described.in.section.*Note.5-3- |
| 135980 | 31 3a 3a 2c 20 74 68 65 6e 20 77 65 20 77 61 6e 74 20 74 68 65 20 22 72 65 6c 6f 63 61 74 65 64 | 1::,.then.we.want.the."relocated |
| 1359a0 | 22 20 60 63 61 72 27 20 70 6f 69 6e 74 65 72 20 74 6f 20 73 74 69 6c 6c 20 62 65 0a 60 6e 34 27 | ".`car'.pointer.to.still.be.`n4' |
| 1359c0 | 2e 29 20 20 4f 74 68 65 72 77 69 73 65 2c 20 77 65 20 6d 75 73 74 20 70 65 72 66 6f 72 6d 20 74 | .)..Otherwise,.we.must.perform.t |
| 1359e0 | 68 65 20 72 65 6c 6f 63 61 74 69 6f 6e 2e 20 20 49 66 20 74 68 65 20 60 63 61 72 27 0a 70 6f 73 | he.relocation...If.the.`car'.pos |
| 135a00 | 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 70 61 69 72 20 74 6f 20 62 65 20 72 65 6c 6f 63 61 74 65 | ition.of.the.pair.to.be.relocate |
| 135a20 | 64 20 63 6f 6e 74 61 69 6e 73 20 61 20 62 72 6f 6b 65 6e 2d 68 65 61 72 74 20 74 61 67 2c 20 74 | d.contains.a.broken-heart.tag,.t |
| 135a40 | 68 65 6e 0a 74 68 65 20 70 61 69 72 20 68 61 73 20 69 6e 20 66 61 63 74 20 61 6c 72 65 61 64 79 | hen.the.pair.has.in.fact.already |
| 135a60 | 20 62 65 65 6e 20 6d 6f 76 65 64 2c 20 73 6f 20 77 65 20 72 65 74 72 69 65 76 65 20 74 68 65 20 | .been.moved,.so.we.retrieve.the. |
| 135a80 | 66 6f 72 77 61 72 64 69 6e 67 0a 61 64 64 72 65 73 73 20 28 66 72 6f 6d 20 74 68 65 20 60 63 64 | forwarding.address.(from.the.`cd |
| 135aa0 | 72 27 20 70 6f 73 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 62 72 6f 6b 65 6e 20 68 65 61 72 74 29 | r'.position.of.the.broken.heart) |
| 135ac0 | 20 61 6e 64 20 72 65 74 75 72 6e 20 74 68 69 73 0a 69 6e 20 60 6e 65 77 27 2e 20 20 49 66 20 74 | .and.return.this.in.`new'...If.t |
| 135ae0 | 68 65 20 70 6f 69 6e 74 65 72 20 69 6e 20 60 6f 6c 64 27 20 70 6f 69 6e 74 73 20 61 74 20 61 20 | he.pointer.in.`old'.points.at.a. |
| 135b00 | 79 65 74 2d 75 6e 6d 6f 76 65 64 20 70 61 69 72 2c 20 74 68 65 6e 0a 77 65 20 6d 6f 76 65 20 74 | yet-unmoved.pair,.then.we.move.t |
| 135b20 | 68 65 20 70 61 69 72 20 74 6f 20 74 68 65 20 66 69 72 73 74 20 66 72 65 65 20 63 65 6c 6c 20 69 | he.pair.to.the.first.free.cell.i |
| 135b40 | 6e 20 6e 65 77 20 6d 65 6d 6f 72 79 20 28 70 6f 69 6e 74 65 64 20 61 74 20 62 79 0a 60 66 72 65 | n.new.memory.(pointed.at.by.`fre |
| 135b60 | 65 27 29 20 61 6e 64 20 73 65 74 20 75 70 20 74 68 65 20 62 72 6f 6b 65 6e 20 68 65 61 72 74 20 | e').and.set.up.the.broken.heart. |
| 135b80 | 62 79 20 73 74 6f 72 69 6e 67 20 61 20 62 72 6f 6b 65 6e 2d 68 65 61 72 74 20 74 61 67 20 61 6e | by.storing.a.broken-heart.tag.an |
| 135ba0 | 64 0a 66 6f 72 77 61 72 64 69 6e 67 20 61 64 64 72 65 73 73 20 61 74 20 74 68 65 20 6f 6c 64 20 | d.forwarding.address.at.the.old. |
| 135bc0 | 6c 6f 63 61 74 69 6f 6e 2e 20 20 60 52 65 6c 6f 63 61 74 65 2d 6f 6c 64 2d 72 65 73 75 6c 74 2d | location...`Relocate-old-result- |
| 135be0 | 69 6e 2d 6e 65 77 27 0a 75 73 65 73 20 61 20 72 65 67 69 73 74 65 72 20 60 6f 6c 64 63 72 27 20 | in-new'.uses.a.register.`oldcr'. |
| 135c00 | 74 6f 20 68 6f 6c 64 20 74 68 65 20 60 63 61 72 27 20 6f 72 20 74 68 65 20 60 63 64 72 27 20 6f | to.hold.the.`car'.or.the.`cdr'.o |
| 135c20 | 66 20 74 68 65 20 6f 62 6a 65 63 74 0a 70 6f 69 6e 74 65 64 20 61 74 20 62 79 20 60 6f 6c 64 27 | f.the.object.pointed.at.by.`old' |
| 135c40 | 2e 28 36 29 0a 0a 20 20 20 20 20 72 65 6c 6f 63 61 74 65 2d 6f 6c 64 2d 72 65 73 75 6c 74 2d 69 | .(6).......relocate-old-result-i |
| 135c60 | 6e 2d 6e 65 77 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 70 6f 69 6e 74 65 72 2d 74 | n-new........(test.(op.pointer-t |
| 135c80 | 6f 2d 70 61 69 72 3f 29 20 28 72 65 67 20 6f 6c 64 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e | o-pair?).(reg.old))........(bran |
| 135ca0 | 63 68 20 28 6c 61 62 65 6c 20 70 61 69 72 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 | ch.(label.pair))........(assign. |
| 135cc0 | 6e 65 77 20 28 72 65 67 20 6f 6c 64 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 | new.(reg.old))........(goto.(reg |
| 135ce0 | 20 72 65 6c 6f 63 61 74 65 2d 63 6f 6e 74 69 6e 75 65 29 29 0a 20 20 20 20 20 70 61 69 72 0a 20 | .relocate-continue))......pair.. |
| 135d00 | 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 6f 6c 64 63 72 20 28 6f 70 20 76 65 63 74 6f 72 2d 72 | ......(assign.oldcr.(op.vector-r |
| 135d20 | 65 66 29 20 28 72 65 67 20 74 68 65 2d 63 61 72 73 29 20 28 72 65 67 20 6f 6c 64 29 29 0a 20 20 | ef).(reg.the-cars).(reg.old))... |
| 135d40 | 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 62 72 6f 6b 65 6e 2d 68 65 61 72 74 3f 29 20 28 72 | .....(test.(op.broken-heart?).(r |
| 135d60 | 65 67 20 6f 6c 64 63 72 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c | eg.oldcr))........(branch.(label |
| 135d80 | 20 61 6c 72 65 61 64 79 2d 6d 6f 76 65 64 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 | .already-moved))........(assign. |
| 135da0 | 6e 65 77 20 28 72 65 67 20 66 72 65 65 29 29 20 3b 20 6e 65 77 20 6c 6f 63 61 74 69 6f 6e 20 66 | new.(reg.free)).;.new.location.f |
| 135dc0 | 6f 72 20 70 61 69 72 0a 20 20 20 20 20 20 20 3b 3b 20 55 70 64 61 74 65 20 60 66 72 65 65 27 20 | or.pair........;;.Update.`free'. |
| 135de0 | 70 6f 69 6e 74 65 72 2e 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 66 72 65 65 20 28 6f 70 | pointer.........(assign.free.(op |
| 135e00 | 20 2b 29 20 28 72 65 67 20 66 72 65 65 29 20 28 63 6f 6e 73 74 20 31 29 29 0a 20 20 20 20 20 20 | .+).(reg.free).(const.1))....... |
| 135e20 | 20 3b 3b 20 43 6f 70 79 20 74 68 65 20 60 63 61 72 27 20 61 6e 64 20 60 63 64 72 27 20 74 6f 20 | .;;.Copy.the.`car'.and.`cdr'.to. |
| 135e40 | 6e 65 77 20 6d 65 6d 6f 72 79 2e 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 | new.memory.........(perform.(op. |
| 135e60 | 76 65 63 74 6f 72 2d 73 65 74 21 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 | vector-set!).................(re |
| 135e80 | 67 20 6e 65 77 2d 63 61 72 73 29 20 28 72 65 67 20 6e 65 77 29 20 28 72 65 67 20 6f 6c 64 63 72 | g.new-cars).(reg.new).(reg.oldcr |
| 135ea0 | 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 6f 6c 64 63 72 20 28 6f 70 20 76 65 63 74 | ))........(assign.oldcr.(op.vect |
| 135ec0 | 6f 72 2d 72 65 66 29 20 28 72 65 67 20 74 68 65 2d 63 64 72 73 29 20 28 72 65 67 20 6f 6c 64 29 | or-ref).(reg.the-cdrs).(reg.old) |
| 135ee0 | 29 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 76 65 63 74 6f 72 2d 73 65 74 | )........(perform.(op.vector-set |
| 135f00 | 21 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 6e 65 77 2d 63 64 72 73 | !).................(reg.new-cdrs |
| 135f20 | 29 20 28 72 65 67 20 6e 65 77 29 20 28 72 65 67 20 6f 6c 64 63 72 29 29 0a 20 20 20 20 20 20 20 | ).(reg.new).(reg.oldcr))........ |
| 135f40 | 3b 3b 20 43 6f 6e 73 74 72 75 63 74 20 74 68 65 20 62 72 6f 6b 65 6e 20 68 65 61 72 74 2e 0a 20 | ;;.Construct.the.broken.heart... |
| 135f60 | 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 76 65 63 74 6f 72 2d 73 65 74 21 29 0a | ......(perform.(op.vector-set!). |
| 135f80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 74 68 65 2d 63 61 72 73 29 20 28 | ................(reg.the-cars).( |
| 135fa0 | 72 65 67 20 6f 6c 64 29 20 28 63 6f 6e 73 74 20 62 72 6f 6b 65 6e 2d 68 65 61 72 74 29 29 0a 20 | reg.old).(const.broken-heart)).. |
| 135fc0 | 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 28 6f 70 20 76 65 63 74 6f | ......(perform.........(op.vecto |
| 135fe0 | 72 2d 73 65 74 21 29 20 28 72 65 67 20 74 68 65 2d 63 64 72 73 29 20 28 72 65 67 20 6f 6c 64 29 | r-set!).(reg.the-cdrs).(reg.old) |
| 136000 | 20 28 72 65 67 20 6e 65 77 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 72 65 | .(reg.new))........(goto.(reg.re |
| 136020 | 6c 6f 63 61 74 65 2d 63 6f 6e 74 69 6e 75 65 29 29 0a 20 20 20 20 20 61 6c 72 65 61 64 79 2d 6d | locate-continue))......already-m |
| 136040 | 6f 76 65 64 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 6e 65 77 20 28 6f 70 20 76 65 63 74 | oved........(assign.new.(op.vect |
| 136060 | 6f 72 2d 72 65 66 29 20 28 72 65 67 20 74 68 65 2d 63 64 72 73 29 20 28 72 65 67 20 6f 6c 64 29 | or-ref).(reg.the-cdrs).(reg.old) |
| 136080 | 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 72 65 6c 6f 63 61 74 65 2d 63 6f 6e | )........(goto.(reg.relocate-con |
| 1360a0 | 74 69 6e 75 65 29 29 0a 0a 20 20 20 41 74 20 74 68 65 20 76 65 72 79 20 65 6e 64 20 6f 66 20 74 | tinue)).....At.the.very.end.of.t |
| 1360c0 | 68 65 20 67 61 72 62 61 67 65 2d 63 6f 6c 6c 65 63 74 69 6f 6e 20 70 72 6f 63 65 73 73 2c 20 77 | he.garbage-collection.process,.w |
| 1360e0 | 65 20 69 6e 74 65 72 63 68 61 6e 67 65 0a 74 68 65 20 72 6f 6c 65 20 6f 66 20 6f 6c 64 20 61 6e | e.interchange.the.role.of.old.an |
| 136100 | 64 20 6e 65 77 20 6d 65 6d 6f 72 69 65 73 20 62 79 20 69 6e 74 65 72 63 68 61 6e 67 69 6e 67 20 | d.new.memories.by.interchanging. |
| 136120 | 70 6f 69 6e 74 65 72 73 3a 0a 69 6e 74 65 72 63 68 61 6e 67 69 6e 67 20 60 74 68 65 2d 63 61 72 | pointers:.interchanging.`the-car |
| 136140 | 73 27 20 77 69 74 68 20 60 6e 65 77 2d 63 61 72 73 27 2c 20 61 6e 64 20 60 74 68 65 2d 63 64 72 | s'.with.`new-cars',.and.`the-cdr |
| 136160 | 73 27 20 77 69 74 68 0a 60 6e 65 77 2d 63 64 72 73 27 2e 20 20 57 65 20 77 69 6c 6c 20 74 68 65 | s'.with.`new-cdrs'...We.will.the |
| 136180 | 6e 20 62 65 20 72 65 61 64 79 20 74 6f 20 70 65 72 66 6f 72 6d 20 61 6e 6f 74 68 65 72 20 67 61 | n.be.ready.to.perform.another.ga |
| 1361a0 | 72 62 61 67 65 0a 63 6f 6c 6c 65 63 74 69 6f 6e 20 74 68 65 20 6e 65 78 74 20 74 69 6d 65 20 6d | rbage.collection.the.next.time.m |
| 1361c0 | 65 6d 6f 72 79 20 72 75 6e 73 20 6f 75 74 2e 0a 0a 20 20 20 20 20 67 63 2d 66 6c 69 70 0a 20 20 | emory.runs.out........gc-flip... |
| 1361e0 | 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 65 6d 70 20 28 72 65 67 20 74 68 65 2d 63 64 72 73 29 | .....(assign.temp.(reg.the-cdrs) |
| 136200 | 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 68 65 2d 63 64 72 73 20 28 72 65 67 20 6e | )........(assign.the-cdrs.(reg.n |
| 136220 | 65 77 2d 63 64 72 73 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 6e 65 77 2d 63 64 72 | ew-cdrs))........(assign.new-cdr |
| 136240 | 73 20 28 72 65 67 20 74 65 6d 70 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 74 65 6d | s.(reg.temp))........(assign.tem |
| 136260 | 70 20 28 72 65 67 20 74 68 65 2d 63 61 72 73 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e | p.(reg.the-cars))........(assign |
| 136280 | 20 74 68 65 2d 63 61 72 73 20 28 72 65 67 20 6e 65 77 2d 63 61 72 73 29 29 0a 20 20 20 20 20 20 | .the-cars.(reg.new-cars))....... |
| 1362a0 | 20 28 61 73 73 69 67 6e 20 6e 65 77 2d 63 61 72 73 20 28 72 65 67 20 74 65 6d 70 29 29 0a 0a 20 | .(assign.new-cars.(reg.temp))... |
| 1362c0 | 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d | ..----------.Footnotes.--------- |
| 1362e0 | 2d 0a 0a 20 20 20 28 31 29 20 54 68 69 73 20 6d 61 79 20 6e 6f 74 20 62 65 20 74 72 75 65 20 65 | -.....(1).This.may.not.be.true.e |
| 136300 | 76 65 6e 74 75 61 6c 6c 79 2c 20 62 65 63 61 75 73 65 20 6d 65 6d 6f 72 69 65 73 20 6d 61 79 20 | ventually,.because.memories.may. |
| 136320 | 67 65 74 20 6c 61 72 67 65 0a 65 6e 6f 75 67 68 20 73 6f 20 74 68 61 74 20 69 74 20 77 6f 75 6c | get.large.enough.so.that.it.woul |
| 136340 | 64 20 62 65 20 69 6d 70 6f 73 73 69 62 6c 65 20 74 6f 20 72 75 6e 20 6f 75 74 20 6f 66 20 66 72 | d.be.impossible.to.run.out.of.fr |
| 136360 | 65 65 20 6d 65 6d 6f 72 79 20 69 6e 20 74 68 65 0a 6c 69 66 65 74 69 6d 65 20 6f 66 20 74 68 65 | ee.memory.in.the.lifetime.of.the |
| 136380 | 20 63 6f 6d 70 75 74 65 72 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 72 65 20 61 | .computer...For.example,.there.a |
| 1363a0 | 72 65 20 61 62 6f 75 74 20 33 2a 28 31 30 5e 31 33 29 2c 0a 6d 69 63 72 6f 73 65 63 6f 6e 64 73 | re.about.3*(10^13),.microseconds |
| 1363c0 | 20 69 6e 20 61 20 79 65 61 72 2c 20 73 6f 20 69 66 20 77 65 20 77 65 72 65 20 74 6f 20 60 63 6f | .in.a.year,.so.if.we.were.to.`co |
| 1363e0 | 6e 73 27 20 6f 6e 63 65 20 70 65 72 20 6d 69 63 72 6f 73 65 63 6f 6e 64 20 77 65 0a 77 6f 75 6c | ns'.once.per.microsecond.we.woul |
| 136400 | 64 20 6e 65 65 64 20 61 62 6f 75 74 20 31 30 5e 31 35 20 63 65 6c 6c 73 20 6f 66 20 6d 65 6d 6f | d.need.about.10^15.cells.of.memo |
| 136420 | 72 79 20 74 6f 20 62 75 69 6c 64 20 61 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 63 6f 75 6c 64 | ry.to.build.a.machine.that.could |
| 136440 | 0a 6f 70 65 72 61 74 65 20 66 6f 72 20 33 30 20 79 65 61 72 73 20 77 69 74 68 6f 75 74 20 72 75 | .operate.for.30.years.without.ru |
| 136460 | 6e 6e 69 6e 67 20 6f 75 74 20 6f 66 20 6d 65 6d 6f 72 79 2e 20 20 54 68 61 74 20 6d 75 63 68 20 | nning.out.of.memory...That.much. |
| 136480 | 6d 65 6d 6f 72 79 0a 73 65 65 6d 73 20 61 62 73 75 72 64 6c 79 20 6c 61 72 67 65 20 62 79 20 74 | memory.seems.absurdly.large.by.t |
| 1364a0 | 6f 64 61 79 27 73 20 73 74 61 6e 64 61 72 64 73 2c 20 62 75 74 20 69 74 20 69 73 20 6e 6f 74 20 | oday's.standards,.but.it.is.not. |
| 1364c0 | 70 68 79 73 69 63 61 6c 6c 79 0a 69 6d 70 6f 73 73 69 62 6c 65 2e 20 20 4f 6e 20 74 68 65 20 6f | physically.impossible...On.the.o |
| 1364e0 | 74 68 65 72 20 68 61 6e 64 2c 20 70 72 6f 63 65 73 73 6f 72 73 20 61 72 65 20 67 65 74 74 69 6e | ther.hand,.processors.are.gettin |
| 136500 | 67 20 66 61 73 74 65 72 20 61 6e 64 20 61 0a 66 75 74 75 72 65 20 63 6f 6d 70 75 74 65 72 20 6d | g.faster.and.a.future.computer.m |
| 136520 | 61 79 20 68 61 76 65 20 6c 61 72 67 65 20 6e 75 6d 62 65 72 73 20 6f 66 20 70 72 6f 63 65 73 73 | ay.have.large.numbers.of.process |
| 136540 | 6f 72 73 20 6f 70 65 72 61 74 69 6e 67 20 69 6e 0a 70 61 72 61 6c 6c 65 6c 20 6f 6e 20 61 20 73 | ors.operating.in.parallel.on.a.s |
| 136560 | 69 6e 67 6c 65 20 6d 65 6d 6f 72 79 2c 20 73 6f 20 69 74 20 6d 61 79 20 62 65 20 70 6f 73 73 69 | ingle.memory,.so.it.may.be.possi |
| 136580 | 62 6c 65 20 74 6f 20 75 73 65 20 75 70 20 6d 65 6d 6f 72 79 0a 6d 75 63 68 20 66 61 73 74 65 72 | ble.to.use.up.memory.much.faster |
| 1365a0 | 20 74 68 61 6e 20 77 65 20 68 61 76 65 20 70 6f 73 74 75 6c 61 74 65 64 2e 0a 0a 20 20 20 28 32 | .than.we.have.postulated......(2 |
| 1365c0 | 29 20 57 65 20 61 73 73 75 6d 65 20 68 65 72 65 20 74 68 61 74 20 74 68 65 20 73 74 61 63 6b 20 | ).We.assume.here.that.the.stack. |
| 1365e0 | 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 6c 69 73 74 20 61 73 0a 64 65 73 63 | is.represented.as.a.list.as.desc |
| 136600 | 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 33 2d 31 3a 3a 2c 20 | ribed.in.section.*Note.5-3-1::,. |
| 136620 | 73 6f 20 74 68 61 74 20 69 74 65 6d 73 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 61 72 65 0a 61 | so.that.items.on.the.stack.are.a |
| 136640 | 63 63 65 73 73 69 62 6c 65 20 76 69 61 20 74 68 65 20 70 6f 69 6e 74 65 72 20 69 6e 20 74 68 65 | ccessible.via.the.pointer.in.the |
| 136660 | 20 73 74 61 63 6b 20 72 65 67 69 73 74 65 72 2e 0a 0a 20 20 20 28 33 29 20 54 68 69 73 20 69 64 | .stack.register......(3).This.id |
| 136680 | 65 61 20 77 61 73 20 69 6e 76 65 6e 74 65 64 20 61 6e 64 20 66 69 72 73 74 20 69 6d 70 6c 65 6d | ea.was.invented.and.first.implem |
| 1366a0 | 65 6e 74 65 64 20 62 79 20 4d 69 6e 73 6b 79 2c 20 61 73 20 70 61 72 74 0a 6f 66 20 74 68 65 20 | ented.by.Minsky,.as.part.of.the. |
| 1366c0 | 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 4c 69 73 70 20 66 6f 72 20 74 68 65 20 50 | implementation.of.Lisp.for.the.P |
| 1366e0 | 44 50 2d 31 20 61 74 20 74 68 65 20 4d 49 54 20 52 65 73 65 61 72 63 68 0a 4c 61 62 6f 72 61 74 | DP-1.at.the.MIT.Research.Laborat |
| 136700 | 6f 72 79 20 6f 66 20 45 6c 65 63 74 72 6f 6e 69 63 73 2e 20 20 49 74 20 77 61 73 20 66 75 72 74 | ory.of.Electronics...It.was.furt |
| 136720 | 68 65 72 20 64 65 76 65 6c 6f 70 65 64 20 62 79 20 46 65 6e 69 63 68 65 6c 20 61 6e 64 0a 59 6f | her.developed.by.Fenichel.and.Yo |
| 136740 | 63 68 65 6c 73 6f 6e 20 28 31 39 36 39 29 20 66 6f 72 20 75 73 65 20 69 6e 20 74 68 65 20 4c 69 | chelson.(1969).for.use.in.the.Li |
| 136760 | 73 70 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 4d 75 6c 74 69 63 | sp.implementation.for.the.Multic |
| 136780 | 73 0a 74 69 6d 65 2d 73 68 61 72 69 6e 67 20 73 79 73 74 65 6d 2e 20 20 4c 61 74 65 72 2c 20 42 | s.time-sharing.system...Later,.B |
| 1367a0 | 61 6b 65 72 20 28 31 39 37 38 29 20 64 65 76 65 6c 6f 70 65 64 20 61 20 22 72 65 61 6c 2d 74 69 | aker.(1978).developed.a."real-ti |
| 1367c0 | 6d 65 22 0a 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 6d 65 74 68 6f 64 2c 20 77 68 69 63 68 | me".version.of.the.method,.which |
| 1367e0 | 20 64 6f 65 73 20 6e 6f 74 20 72 65 71 75 69 72 65 20 74 68 65 20 63 6f 6d 70 75 74 61 74 69 6f | .does.not.require.the.computatio |
| 136800 | 6e 20 74 6f 20 73 74 6f 70 0a 64 75 72 69 6e 67 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 | n.to.stop.during.garbage.collect |
| 136820 | 69 6f 6e 2e 20 20 42 61 6b 65 72 27 73 20 69 64 65 61 20 77 61 73 20 65 78 74 65 6e 64 65 64 20 | ion...Baker's.idea.was.extended. |
| 136840 | 62 79 20 48 65 77 69 74 74 2c 0a 4c 69 65 62 65 72 6d 61 6e 2c 20 61 6e 64 20 4d 6f 6f 6e 20 28 | by.Hewitt,.Lieberman,.and.Moon.( |
| 136860 | 73 65 65 20 4c 69 65 62 65 72 6d 61 6e 20 61 6e 64 20 48 65 77 69 74 74 20 31 39 38 33 29 20 74 | see.Lieberman.and.Hewitt.1983).t |
| 136880 | 6f 20 74 61 6b 65 20 61 64 76 61 6e 74 61 67 65 0a 6f 66 20 74 68 65 20 66 61 63 74 20 74 68 61 | o.take.advantage.of.the.fact.tha |
| 1368a0 | 74 20 73 6f 6d 65 20 73 74 72 75 63 74 75 72 65 20 69 73 20 6d 6f 72 65 20 76 6f 6c 61 74 69 6c | t.some.structure.is.more.volatil |
| 1368c0 | 65 20 61 6e 64 20 6f 74 68 65 72 20 73 74 72 75 63 74 75 72 65 20 69 73 0a 6d 6f 72 65 20 70 65 | e.and.other.structure.is.more.pe |
| 1368e0 | 72 6d 61 6e 65 6e 74 2e 0a 0a 20 20 20 41 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 63 6f 6d 6d | rmanent......An.alternative.comm |
| 136900 | 6f 6e 6c 79 20 75 73 65 64 20 67 61 72 62 61 67 65 2d 63 6f 6c 6c 65 63 74 69 6f 6e 20 74 65 63 | only.used.garbage-collection.tec |
| 136920 | 68 6e 69 71 75 65 20 69 73 20 74 68 65 20 22 6d 61 72 6b 2d 73 77 65 65 70 22 0a 6d 65 74 68 6f | hnique.is.the."mark-sweep".metho |
| 136940 | 64 2e 20 20 54 68 69 73 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 74 72 61 63 69 6e 67 20 61 6c 6c | d...This.consists.of.tracing.all |
| 136960 | 20 74 68 65 20 73 74 72 75 63 74 75 72 65 20 61 63 63 65 73 73 69 62 6c 65 20 66 72 6f 6d 20 74 | .the.structure.accessible.from.t |
| 136980 | 68 65 0a 6d 61 63 68 69 6e 65 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 20 6d 61 72 6b 69 6e 67 | he.machine.registers.and.marking |
| 1369a0 | 20 65 61 63 68 20 70 61 69 72 20 77 65 20 72 65 61 63 68 2e 20 20 57 65 20 74 68 65 6e 20 73 63 | .each.pair.we.reach...We.then.sc |
| 1369c0 | 61 6e 20 61 6c 6c 20 6f 66 0a 6d 65 6d 6f 72 79 2c 20 61 6e 64 20 61 6e 79 20 6c 6f 63 61 74 69 | an.all.of.memory,.and.any.locati |
| 1369e0 | 6f 6e 20 74 68 61 74 20 69 73 20 75 6e 6d 61 72 6b 65 64 20 69 73 20 22 73 77 65 70 74 20 75 70 | on.that.is.unmarked.is."swept.up |
| 136a00 | 22 20 61 73 20 67 61 72 62 61 67 65 20 61 6e 64 0a 6d 61 64 65 20 61 76 61 69 6c 61 62 6c 65 20 | ".as.garbage.and.made.available. |
| 136a20 | 66 6f 72 20 72 65 75 73 65 2e 20 20 41 20 66 75 6c 6c 20 64 69 73 63 75 73 73 69 6f 6e 20 6f 66 | for.reuse...A.full.discussion.of |
| 136a40 | 20 74 68 65 20 6d 61 72 6b 2d 73 77 65 65 70 20 6d 65 74 68 6f 64 0a 63 61 6e 20 62 65 20 66 6f | .the.mark-sweep.method.can.be.fo |
| 136a60 | 75 6e 64 20 69 6e 20 41 6c 6c 65 6e 20 31 39 37 38 2e 0a 0a 20 20 20 54 68 65 20 4d 69 6e 73 6b | und.in.Allen.1978......The.Minsk |
| 136a80 | 79 2d 46 65 6e 69 63 68 65 6c 2d 59 6f 63 68 65 6c 73 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 20 69 | y-Fenichel-Yochelson.algorithm.i |
| 136aa0 | 73 20 74 68 65 20 64 6f 6d 69 6e 61 6e 74 20 61 6c 67 6f 72 69 74 68 6d 20 69 6e 0a 75 73 65 20 | s.the.dominant.algorithm.in.use. |
| 136ac0 | 66 6f 72 20 6c 61 72 67 65 2d 6d 65 6d 6f 72 79 20 73 79 73 74 65 6d 73 20 62 65 63 61 75 73 65 | for.large-memory.systems.because |
| 136ae0 | 20 69 74 20 65 78 61 6d 69 6e 65 73 20 6f 6e 6c 79 20 74 68 65 20 75 73 65 66 75 6c 20 70 61 72 | .it.examines.only.the.useful.par |
| 136b00 | 74 0a 6f 66 20 6d 65 6d 6f 72 79 2e 20 20 54 68 69 73 20 69 73 20 69 6e 20 63 6f 6e 74 72 61 73 | t.of.memory...This.is.in.contras |
| 136b20 | 74 20 74 6f 20 6d 61 72 6b 2d 73 77 65 65 70 2c 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 73 77 | t.to.mark-sweep,.in.which.the.sw |
| 136b40 | 65 65 70 20 70 68 61 73 65 0a 6d 75 73 74 20 63 68 65 63 6b 20 61 6c 6c 20 6f 66 20 6d 65 6d 6f | eep.phase.must.check.all.of.memo |
| 136b60 | 72 79 2e 20 20 41 20 73 65 63 6f 6e 64 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 73 74 6f 70 2d | ry...A.second.advantage.of.stop- |
| 136b80 | 61 6e 64 2d 63 6f 70 79 20 69 73 20 74 68 61 74 0a 69 74 20 69 73 20 61 20 22 63 6f 6d 70 61 63 | and-copy.is.that.it.is.a."compac |
| 136ba0 | 74 69 6e 67 22 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 6f 72 2e 20 20 54 68 61 74 20 69 | ting".garbage.collector...That.i |
| 136bc0 | 73 2c 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 0a 67 61 72 62 61 67 65 2d 63 6f 6c | s,.at.the.end.of.the.garbage-col |
| 136be0 | 6c 65 63 74 69 6f 6e 20 70 68 61 73 65 20 74 68 65 20 75 73 65 66 75 6c 20 64 61 74 61 20 77 69 | lection.phase.the.useful.data.wi |
| 136c00 | 6c 6c 20 68 61 76 65 20 62 65 65 6e 20 6d 6f 76 65 64 20 74 6f 0a 63 6f 6e 73 65 63 75 74 69 76 | ll.have.been.moved.to.consecutiv |
| 136c20 | 65 20 6d 65 6d 6f 72 79 20 6c 6f 63 61 74 69 6f 6e 73 2c 20 77 69 74 68 20 61 6c 6c 20 67 61 72 | e.memory.locations,.with.all.gar |
| 136c40 | 62 61 67 65 20 70 61 69 72 73 20 63 6f 6d 70 72 65 73 73 65 64 20 6f 75 74 2e 0a 54 68 69 73 20 | bage.pairs.compressed.out..This. |
| 136c60 | 63 61 6e 20 62 65 20 61 6e 20 65 78 74 72 65 6d 65 6c 79 20 69 6d 70 6f 72 74 61 6e 74 20 70 65 | can.be.an.extremely.important.pe |
| 136c80 | 72 66 6f 72 6d 61 6e 63 65 20 63 6f 6e 73 69 64 65 72 61 74 69 6f 6e 20 69 6e 0a 6d 61 63 68 69 | rformance.consideration.in.machi |
| 136ca0 | 6e 65 73 20 77 69 74 68 20 76 69 72 74 75 61 6c 20 6d 65 6d 6f 72 79 2c 20 69 6e 20 77 68 69 63 | nes.with.virtual.memory,.in.whic |
| 136cc0 | 68 20 61 63 63 65 73 73 65 73 20 74 6f 20 77 69 64 65 6c 79 20 73 65 70 61 72 61 74 65 64 0a 6d | h.accesses.to.widely.separated.m |
| 136ce0 | 65 6d 6f 72 79 20 61 64 64 72 65 73 73 65 73 20 6d 61 79 20 72 65 71 75 69 72 65 20 65 78 74 72 | emory.addresses.may.require.extr |
| 136d00 | 61 20 70 61 67 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 28 34 29 20 54 68 69 | a.paging.operations......(4).Thi |
| 136d20 | 73 20 6c 69 73 74 20 6f 66 20 72 65 67 69 73 74 65 72 73 20 64 6f 65 73 20 6e 6f 74 20 69 6e 63 | s.list.of.registers.does.not.inc |
| 136d40 | 6c 75 64 65 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 75 73 65 64 20 62 79 0a 74 68 65 20 73 | lude.the.registers.used.by.the.s |
| 136d60 | 74 6f 72 61 67 65 2d 61 6c 6c 6f 63 61 74 69 6f 6e 20 73 79 73 74 65 6d 2d 2d 60 72 6f 6f 74 27 | torage-allocation.system--`root' |
| 136d80 | 2c 20 60 74 68 65 2d 63 61 72 73 27 2c 20 60 74 68 65 2d 63 64 72 73 27 2c 20 61 6e 64 20 74 68 | ,.`the-cars',.`the-cdrs',.and.th |
| 136da0 | 65 0a 6f 74 68 65 72 20 72 65 67 69 73 74 65 72 73 20 74 68 61 74 20 77 69 6c 6c 20 62 65 20 69 | e.other.registers.that.will.be.i |
| 136dc0 | 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2e 0a 0a 20 20 20 28 | ntroduced.in.this.section......( |
| 136de0 | 35 29 20 54 68 65 20 74 65 72 6d 20 5f 62 72 6f 6b 65 6e 20 68 65 61 72 74 5f 20 77 61 73 20 63 | 5).The.term._broken.heart_.was.c |
| 136e00 | 6f 69 6e 65 64 20 62 79 20 44 61 76 69 64 20 43 72 65 73 73 65 79 2c 20 77 68 6f 20 77 72 6f 74 | oined.by.David.Cressey,.who.wrot |
| 136e20 | 65 20 61 0a 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 6f 72 20 66 6f 72 20 4d 44 4c 2c 20 61 | e.a.garbage.collector.for.MDL,.a |
| 136e40 | 20 64 69 61 6c 65 63 74 20 6f 66 20 4c 69 73 70 20 64 65 76 65 6c 6f 70 65 64 20 61 74 20 4d 49 | .dialect.of.Lisp.developed.at.MI |
| 136e60 | 54 20 64 75 72 69 6e 67 0a 74 68 65 20 65 61 72 6c 79 20 31 39 37 30 73 2e 0a 0a 20 20 20 28 36 | T.during.the.early.1970s......(6 |
| 136e80 | 29 20 54 68 65 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 6f 72 20 75 73 65 73 20 74 68 65 | ).The.garbage.collector.uses.the |
| 136ea0 | 20 6c 6f 77 2d 6c 65 76 65 6c 20 70 72 65 64 69 63 61 74 65 0a 60 70 6f 69 6e 74 65 72 2d 74 6f | .low-level.predicate.`pointer-to |
| 136ec0 | 2d 70 61 69 72 3f 27 20 69 6e 73 74 65 61 64 20 6f 66 20 74 68 65 20 6c 69 73 74 2d 73 74 72 75 | -pair?'.instead.of.the.list-stru |
| 136ee0 | 63 74 75 72 65 20 60 70 61 69 72 3f 27 20 20 6f 70 65 72 61 74 69 6f 6e 0a 62 65 63 61 75 73 65 | cture.`pair?'..operation.because |
| 136f00 | 20 69 6e 20 61 20 72 65 61 6c 20 73 79 73 74 65 6d 20 74 68 65 72 65 20 6d 69 67 68 74 20 62 65 | .in.a.real.system.there.might.be |
| 136f20 | 20 76 61 72 69 6f 75 73 20 74 68 69 6e 67 73 20 74 68 61 74 20 61 72 65 20 74 72 65 61 74 65 64 | .various.things.that.are.treated |
| 136f40 | 0a 61 73 20 70 61 69 72 73 20 66 6f 72 20 67 61 72 62 61 67 65 2d 63 6f 6c 6c 65 63 74 69 6f 6e | .as.pairs.for.garbage-collection |
| 136f60 | 20 70 75 72 70 6f 73 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 6e 20 61 20 53 63 | .purposes...For.example,.in.a.Sc |
| 136f80 | 68 65 6d 65 0a 73 79 73 74 65 6d 20 74 68 61 74 20 63 6f 6e 66 6f 72 6d 73 20 74 6f 20 74 68 65 | heme.system.that.conforms.to.the |
| 136fa0 | 20 49 45 45 45 20 73 74 61 6e 64 61 72 64 20 61 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 | .IEEE.standard.a.procedure.objec |
| 136fc0 | 74 20 6d 61 79 20 62 65 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 61 20 73 70 65 63 69 61 | t.may.be.implemented.as.a.specia |
| 136fe0 | 6c 20 6b 69 6e 64 20 6f 66 20 22 70 61 69 72 22 20 74 68 61 74 20 64 6f 65 73 6e 27 74 20 73 61 | l.kind.of."pair".that.doesn't.sa |
| 137000 | 74 69 73 66 79 20 74 68 65 0a 60 70 61 69 72 3f 27 20 70 72 65 64 69 63 61 74 65 2e 20 20 46 6f | tisfy.the.`pair?'.predicate...Fo |
| 137020 | 72 20 73 69 6d 75 6c 61 74 69 6f 6e 20 70 75 72 70 6f 73 65 73 2c 20 60 70 6f 69 6e 74 65 72 2d | r.simulation.purposes,.`pointer- |
| 137040 | 74 6f 2d 70 61 69 72 3f 27 20 63 61 6e 20 62 65 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 | to-pair?'.can.be.implemented.as. |
| 137060 | 60 70 61 69 72 3f 27 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f | `pair?'.....File:.sicp.info,..No |
| 137080 | 64 65 3a 20 35 2d 34 2c 20 20 4e 65 78 74 3a 20 35 2d 35 2c 20 20 50 72 65 76 3a 20 35 2d 33 2c | de:.5-4,..Next:.5-5,..Prev:.5-3, |
| 1370a0 | 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 35 0a 0a 35 2e 34 20 54 68 65 20 45 78 70 6c 69 63 69 | ..Up:.Chapter.5..5.4.The.Explici |
| 1370c0 | 74 2d 43 6f 6e 74 72 6f 6c 20 45 76 61 6c 75 61 74 6f 72 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | t-Control.Evaluator.============ |
| 1370e0 | 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 0a 49 6e 20 73 65 63 74 69 | ======================..In.secti |
| 137100 | 6f 6e 20 2a 4e 6f 74 65 20 35 2d 31 3a 3a 20 77 65 20 73 61 77 20 68 6f 77 20 74 6f 20 74 72 61 | on.*Note.5-1::.we.saw.how.to.tra |
| 137120 | 6e 73 66 6f 72 6d 20 73 69 6d 70 6c 65 20 53 63 68 65 6d 65 20 70 72 6f 67 72 61 6d 73 0a 69 6e | nsform.simple.Scheme.programs.in |
| 137140 | 74 6f 20 64 65 73 63 72 69 70 74 69 6f 6e 73 20 6f 66 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 | to.descriptions.of.register.mach |
| 137160 | 69 6e 65 73 2e 20 20 57 65 20 77 69 6c 6c 20 6e 6f 77 20 70 65 72 66 6f 72 6d 20 74 68 69 73 0a | ines...We.will.now.perform.this. |
| 137180 | 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 61 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 | transformation.on.a.more.complex |
| 1371a0 | 20 70 72 6f 67 72 61 6d 2c 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 | .program,.the.metacircular.evalu |
| 1371c0 | 61 74 6f 72 20 6f 66 0a 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 2d 2a | ator.of.sections.*Note.4-1-1::-* |
| 1371e0 | 4e 6f 74 65 20 34 2d 31 2d 34 3a 3a 2c 20 77 68 69 63 68 20 73 68 6f 77 73 20 68 6f 77 20 74 68 | Note.4-1-4::,.which.shows.how.th |
| 137200 | 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 61 0a 53 63 68 65 6d 65 20 69 6e 74 65 72 70 72 65 74 | e.behavior.of.a.Scheme.interpret |
| 137220 | 65 72 20 63 61 6e 20 62 65 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 | er.can.be.described.in.terms.of. |
| 137240 | 74 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 60 65 76 61 6c 27 0a 61 6e 64 20 60 61 70 70 6c 79 | the.procedures.`eval'.and.`apply |
| 137260 | 27 2e 20 20 54 68 65 20 22 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 | '...The."explicit-control.evalua |
| 137280 | 74 6f 72 22 20 74 68 61 74 20 77 65 20 64 65 76 65 6c 6f 70 20 69 6e 20 74 68 69 73 0a 73 65 63 | tor".that.we.develop.in.this.sec |
| 1372a0 | 74 69 6f 6e 20 73 68 6f 77 73 20 68 6f 77 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 70 72 | tion.shows.how.the.underlying.pr |
| 1372c0 | 6f 63 65 64 75 72 65 2d 63 61 6c 6c 69 6e 67 20 61 6e 64 20 61 72 67 75 6d 65 6e 74 2d 70 61 73 | ocedure-calling.and.argument-pas |
| 1372e0 | 73 69 6e 67 0a 6d 65 63 68 61 6e 69 73 6d 73 20 75 73 65 64 20 69 6e 20 74 68 65 20 65 76 61 6c | sing.mechanisms.used.in.the.eval |
| 137300 | 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 63 61 6e 20 62 65 20 64 65 73 63 72 69 62 65 64 20 | uation.process.can.be.described. |
| 137320 | 69 6e 20 74 65 72 6d 73 20 6f 66 0a 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 72 65 67 69 73 74 | in.terms.of.operations.on.regist |
| 137340 | 65 72 73 20 61 6e 64 20 73 74 61 63 6b 73 2e 20 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 74 68 | ers.and.stacks...In.addition,.th |
| 137360 | 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 0a 65 76 61 6c 75 61 74 6f 72 20 63 61 6e | e.explicit-control.evaluator.can |
| 137380 | 20 73 65 72 76 65 20 61 73 20 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 | .serve.as.an.implementation.of.a |
| 1373a0 | 20 53 63 68 65 6d 65 20 69 6e 74 65 72 70 72 65 74 65 72 2c 0a 77 72 69 74 74 65 6e 20 69 6e 20 | .Scheme.interpreter,.written.in. |
| 1373c0 | 61 20 6c 61 6e 67 75 61 67 65 20 74 68 61 74 20 69 73 20 76 65 72 79 20 73 69 6d 69 6c 61 72 20 | a.language.that.is.very.similar. |
| 1373e0 | 74 6f 20 74 68 65 20 6e 61 74 69 76 65 20 6d 61 63 68 69 6e 65 0a 6c 61 6e 67 75 61 67 65 20 6f | to.the.native.machine.language.o |
| 137400 | 66 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 63 6f 6d 70 75 74 65 72 73 2e 20 20 54 68 65 20 65 | f.conventional.computers...The.e |
| 137420 | 76 61 6c 75 61 74 6f 72 20 63 61 6e 20 62 65 20 65 78 65 63 75 74 65 64 20 62 79 0a 74 68 65 20 | valuator.can.be.executed.by.the. |
| 137440 | 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 73 69 6d 75 6c 61 74 6f 72 20 6f 66 20 73 65 | register-machine.simulator.of.se |
| 137460 | 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 32 3a 3a 2e 20 20 41 6c 74 65 72 6e 61 74 69 76 65 6c | ction.*Note.5-2::...Alternativel |
| 137480 | 79 2c 0a 69 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 61 20 73 74 61 72 74 69 6e 67 20 | y,.it.can.be.used.as.a.starting. |
| 1374a0 | 70 6f 69 6e 74 20 66 6f 72 20 62 75 69 6c 64 69 6e 67 20 61 20 6d 61 63 68 69 6e 65 2d 6c 61 6e | point.for.building.a.machine-lan |
| 1374c0 | 67 75 61 67 65 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 20 53 63 68 65 6d 65 | guage.implementation.of.a.Scheme |
| 1374e0 | 20 65 76 61 6c 75 61 74 6f 72 2c 20 6f 72 20 65 76 65 6e 20 61 20 73 70 65 63 69 61 6c 2d 70 75 | .evaluator,.or.even.a.special-pu |
| 137500 | 72 70 6f 73 65 20 6d 61 63 68 69 6e 65 0a 66 6f 72 20 65 76 61 6c 75 61 74 69 6e 67 20 53 63 68 | rpose.machine.for.evaluating.Sch |
| 137520 | 65 6d 65 20 65 78 70 72 65 73 73 69 6f 6e 73 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 | eme.expressions...*Note.Figure.5 |
| 137540 | 2d 31 36 3a 3a 20 73 68 6f 77 73 20 73 75 63 68 20 61 0a 68 61 72 64 77 61 72 65 20 69 6d 70 6c | -16::.shows.such.a.hardware.impl |
| 137560 | 65 6d 65 6e 74 61 74 69 6f 6e 3a 20 61 20 73 69 6c 69 63 6f 6e 20 63 68 69 70 20 74 68 61 74 20 | ementation:.a.silicon.chip.that. |
| 137580 | 61 63 74 73 20 61 73 20 61 6e 20 65 76 61 6c 75 61 74 6f 72 20 66 6f 72 0a 53 63 68 65 6d 65 2e | acts.as.an.evaluator.for.Scheme. |
| 1375a0 | 20 20 54 68 65 20 63 68 69 70 20 64 65 73 69 67 6e 65 72 73 20 73 74 61 72 74 65 64 20 77 69 74 | ..The.chip.designers.started.wit |
| 1375c0 | 68 20 74 68 65 20 64 61 74 61 2d 70 61 74 68 20 61 6e 64 20 63 6f 6e 74 72 6f 6c 6c 65 72 0a 73 | h.the.data-path.and.controller.s |
| 1375e0 | 70 65 63 69 66 69 63 61 74 69 6f 6e 73 20 66 6f 72 20 61 20 72 65 67 69 73 74 65 72 20 6d 61 63 | pecifications.for.a.register.mac |
| 137600 | 68 69 6e 65 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 0a 64 65 | hine.similar.to.the.evaluator.de |
| 137620 | 73 63 72 69 62 65 64 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 61 6e 64 20 75 73 65 64 | scribed.in.this.section.and.used |
| 137640 | 20 64 65 73 69 67 6e 20 61 75 74 6f 6d 61 74 69 6f 6e 20 70 72 6f 67 72 61 6d 73 20 74 6f 0a 63 | .design.automation.programs.to.c |
| 137660 | 6f 6e 73 74 72 75 63 74 20 74 68 65 20 69 6e 74 65 67 72 61 74 65 64 2d 63 69 72 63 75 69 74 20 | onstruct.the.integrated-circuit. |
| 137680 | 6c 61 79 6f 75 74 2e 28 31 29 0a 0a 52 65 67 69 73 74 65 72 73 20 61 6e 64 20 6f 70 65 72 61 74 | layout.(1)..Registers.and.operat |
| 1376a0 | 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 | ions...........................I |
| 1376c0 | 6e 20 64 65 73 69 67 6e 69 6e 67 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c | n.designing.the.explicit-control |
| 1376e0 | 20 65 76 61 6c 75 61 74 6f 72 2c 20 77 65 20 6d 75 73 74 20 73 70 65 63 69 66 79 20 74 68 65 0a | .evaluator,.we.must.specify.the. |
| 137700 | 6f 70 65 72 61 74 69 6f 6e 73 20 74 6f 20 62 65 20 75 73 65 64 20 69 6e 20 6f 75 72 20 72 65 67 | operations.to.be.used.in.our.reg |
| 137720 | 69 73 74 65 72 20 6d 61 63 68 69 6e 65 2e 20 20 57 65 20 64 65 73 63 72 69 62 65 64 20 74 68 65 | ister.machine...We.described.the |
| 137740 | 0a 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 74 65 72 6d 73 | .metacircular.evaluator.in.terms |
| 137760 | 20 6f 66 20 61 62 73 74 72 61 63 74 20 73 79 6e 74 61 78 2c 20 75 73 69 6e 67 20 70 72 6f 63 65 | .of.abstract.syntax,.using.proce |
| 137780 | 64 75 72 65 73 0a 73 75 63 68 20 61 73 20 60 71 75 6f 74 65 64 3f 27 20 61 6e 64 20 60 6d 61 6b | dures.such.as.`quoted?'.and.`mak |
| 1377a0 | 65 2d 70 72 6f 63 65 64 75 72 65 27 2e 20 20 49 6e 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 74 | e-procedure'...In.implementing.t |
| 1377c0 | 68 65 20 72 65 67 69 73 74 65 72 0a 6d 61 63 68 69 6e 65 2c 20 77 65 20 63 6f 75 6c 64 20 65 78 | he.register.machine,.we.could.ex |
| 1377e0 | 70 61 6e 64 20 74 68 65 73 65 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 74 6f 20 73 65 71 75 65 | pand.these.procedures.into.seque |
| 137800 | 6e 63 65 73 20 6f 66 20 65 6c 65 6d 65 6e 74 61 72 79 0a 6c 69 73 74 2d 73 74 72 75 63 74 75 72 | nces.of.elementary.list-structur |
| 137820 | 65 20 6d 65 6d 6f 72 79 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 61 6e 64 20 69 6d 70 6c 65 6d 65 | e.memory.operations,.and.impleme |
| 137840 | 6e 74 20 74 68 65 73 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 6f 75 72 0a 72 65 67 69 73 | nt.these.operations.on.our.regis |
| 137860 | 74 65 72 20 6d 61 63 68 69 6e 65 2e 20 20 48 6f 77 65 76 65 72 2c 20 74 68 69 73 20 77 6f 75 6c | ter.machine...However,.this.woul |
| 137880 | 64 20 6d 61 6b 65 20 6f 75 72 20 65 76 61 6c 75 61 74 6f 72 20 76 65 72 79 20 6c 6f 6e 67 2c 0a | d.make.our.evaluator.very.long,. |
| 1378a0 | 6f 62 73 63 75 72 69 6e 67 20 74 68 65 20 62 61 73 69 63 20 73 74 72 75 63 74 75 72 65 20 77 69 | obscuring.the.basic.structure.wi |
| 1378c0 | 74 68 20 64 65 74 61 69 6c 73 2e 20 20 54 6f 20 63 6c 61 72 69 66 79 20 74 68 65 0a 70 72 65 73 | th.details...To.clarify.the.pres |
| 1378e0 | 65 6e 74 61 74 69 6f 6e 2c 20 77 65 20 77 69 6c 6c 20 69 6e 63 6c 75 64 65 20 61 73 20 70 72 69 | entation,.we.will.include.as.pri |
| 137900 | 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 72 65 67 69 73 74 65 | mitive.operations.of.the.registe |
| 137920 | 72 0a 6d 61 63 68 69 6e 65 20 74 68 65 20 73 79 6e 74 61 78 20 70 72 6f 63 65 64 75 72 65 73 20 | r.machine.the.syntax.procedures. |
| 137940 | 67 69 76 65 6e 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 32 3a 3a 20 61 | given.in.section.*Note.4-1-2::.a |
| 137960 | 6e 64 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 72 65 70 72 65 73 65 6e 74 69 | nd.the.procedures.for.representi |
| 137980 | 6e 67 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 61 6e 64 20 6f 74 68 65 72 20 72 75 6e 2d 74 69 | ng.environments.and.other.run-ti |
| 1379a0 | 6d 65 20 64 61 74 61 20 67 69 76 65 6e 0a 69 6e 20 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 20 | me.data.given.in.sections.*Note. |
| 1379c0 | 34 2d 31 2d 33 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 34 2d 31 2d 34 3a 3a 2e 20 20 49 6e 20 6f | 4-1-3::.and.*Note.4-1-4::...In.o |
| 1379e0 | 72 64 65 72 20 74 6f 20 63 6f 6d 70 6c 65 74 65 6c 79 0a 73 70 65 63 69 66 79 20 61 6e 20 65 76 | rder.to.completely.specify.an.ev |
| 137a00 | 61 6c 75 61 74 6f 72 20 74 68 61 74 20 63 6f 75 6c 64 20 62 65 20 70 72 6f 67 72 61 6d 6d 65 64 | aluator.that.could.be.programmed |
| 137a20 | 20 69 6e 20 61 20 6c 6f 77 2d 6c 65 76 65 6c 20 6d 61 63 68 69 6e 65 0a 6c 61 6e 67 75 61 67 65 | .in.a.low-level.machine.language |
| 137a40 | 20 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 68 61 72 64 77 61 72 65 2c 20 77 65 20 | .or.implemented.in.hardware,.we. |
| 137a60 | 77 6f 75 6c 64 20 72 65 70 6c 61 63 65 20 74 68 65 73 65 20 6f 70 65 72 61 74 69 6f 6e 73 0a 62 | would.replace.these.operations.b |
| 137a80 | 79 20 6d 6f 72 65 20 65 6c 65 6d 65 6e 74 61 72 79 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 75 73 | y.more.elementary.operations,.us |
| 137aa0 | 69 6e 67 20 74 68 65 20 6c 69 73 74 2d 73 74 72 75 63 74 75 72 65 20 69 6d 70 6c 65 6d 65 6e 74 | ing.the.list-structure.implement |
| 137ac0 | 61 74 69 6f 6e 0a 77 65 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e | ation.we.described.in.section.*N |
| 137ae0 | 6f 74 65 20 35 2d 33 3a 3a 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 31 36 3a 2a 20 | ote.5-3::........*Figure.5.16:*. |
| 137b00 | 41 20 73 69 6c 69 63 6f 6e 2d 63 68 69 70 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 | A.silicon-chip.implementation.of |
| 137b20 | 20 61 6e 20 65 76 61 6c 75 61 74 6f 72 20 66 6f 72 0a 20 20 20 20 20 53 63 68 65 6d 65 2e 0a 0a | .an.evaluator.for......Scheme... |
| 137b40 | 20 20 20 20 20 5b 54 68 69 73 20 66 69 67 75 72 65 20 69 73 20 6d 69 73 73 69 6e 67 2e 5d 0a 0a | .....[This.figure.is.missing.].. |
| 137b60 | 0a 20 20 20 4f 75 72 20 53 63 68 65 6d 65 20 65 76 61 6c 75 61 74 6f 72 20 72 65 67 69 73 74 65 | ....Our.Scheme.evaluator.registe |
| 137b80 | 72 20 6d 61 63 68 69 6e 65 20 69 6e 63 6c 75 64 65 73 20 61 20 73 74 61 63 6b 20 61 6e 64 20 73 | r.machine.includes.a.stack.and.s |
| 137ba0 | 65 76 65 6e 0a 72 65 67 69 73 74 65 72 73 3a 20 60 65 78 70 27 2c 20 60 65 6e 76 27 2c 20 60 76 | even.registers:.`exp',.`env',.`v |
| 137bc0 | 61 6c 27 2c 20 60 63 6f 6e 74 69 6e 75 65 27 2c 20 60 70 72 6f 63 27 2c 20 60 61 72 67 6c 27 2c | al',.`continue',.`proc',.`argl', |
| 137be0 | 20 61 6e 64 20 60 75 6e 65 76 27 2e 0a 60 45 78 70 27 20 69 73 20 75 73 65 64 20 74 6f 20 68 6f | .and.`unev'..`Exp'.is.used.to.ho |
| 137c00 | 6c 64 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 | ld.the.expression.to.be.evaluate |
| 137c20 | 64 2c 20 61 6e 64 20 60 65 6e 76 27 0a 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 65 6e 76 69 72 6f | d,.and.`env'.contains.the.enviro |
| 137c40 | 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 73 | nment.in.which.the.evaluation.is |
| 137c60 | 20 74 6f 20 62 65 20 70 65 72 66 6f 72 6d 65 64 2e 0a 41 74 20 74 68 65 20 65 6e 64 20 6f 66 20 | .to.be.performed..At.the.end.of. |
| 137c80 | 61 6e 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 60 76 61 6c 27 20 63 6f 6e 74 61 69 6e 73 20 74 68 | an.evaluation,.`val'.contains.th |
| 137ca0 | 65 20 76 61 6c 75 65 20 6f 62 74 61 69 6e 65 64 20 62 79 0a 65 76 61 6c 75 61 74 69 6e 67 20 74 | e.value.obtained.by.evaluating.t |
| 137cc0 | 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 20 64 65 73 69 67 6e 61 74 65 64 20 | he.expression.in.the.designated. |
| 137ce0 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 54 68 65 0a 60 63 6f 6e 74 69 6e 75 65 27 20 72 65 67 | environment...The.`continue'.reg |
| 137d00 | 69 73 74 65 72 20 69 73 20 75 73 65 64 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 72 65 63 75 72 | ister.is.used.to.implement.recur |
| 137d20 | 73 69 6f 6e 2c 20 61 73 20 65 78 70 6c 61 69 6e 65 64 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e | sion,.as.explained.in.section.*N |
| 137d40 | 6f 74 65 20 35 2d 31 2d 34 3a 3a 2e 20 20 28 54 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6e 65 65 | ote.5-1-4::...(The.evaluator.nee |
| 137d60 | 64 73 20 74 6f 20 63 61 6c 6c 20 69 74 73 65 6c 66 0a 72 65 63 75 72 73 69 76 65 6c 79 2c 20 73 | ds.to.call.itself.recursively,.s |
| 137d80 | 69 6e 63 65 20 65 76 61 6c 75 61 74 69 6e 67 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 72 65 | ince.evaluating.an.expression.re |
| 137da0 | 71 75 69 72 65 73 20 65 76 61 6c 75 61 74 69 6e 67 20 69 74 73 0a 73 75 62 65 78 70 72 65 73 73 | quires.evaluating.its.subexpress |
| 137dc0 | 69 6f 6e 73 2e 29 20 20 54 68 65 20 72 65 67 69 73 74 65 72 73 20 60 70 72 6f 63 27 2c 20 60 61 | ions.)..The.registers.`proc',.`a |
| 137de0 | 72 67 6c 27 2c 20 61 6e 64 20 60 75 6e 65 76 27 20 61 72 65 20 75 73 65 64 20 69 6e 0a 65 76 61 | rgl',.and.`unev'.are.used.in.eva |
| 137e00 | 6c 75 61 74 69 6e 67 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 57 65 20 77 69 6c | luating.combinations......We.wil |
| 137e20 | 6c 20 6e 6f 74 20 70 72 6f 76 69 64 65 20 61 20 64 61 74 61 2d 70 61 74 68 20 64 69 61 67 72 61 | l.not.provide.a.data-path.diagra |
| 137e40 | 6d 20 74 6f 20 73 68 6f 77 20 68 6f 77 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 0a | m.to.show.how.the.registers.and. |
| 137e60 | 6f 70 65 72 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 61 72 65 20 | operations.of.the.evaluator.are. |
| 137e80 | 63 6f 6e 6e 65 63 74 65 64 2c 20 6e 6f 72 20 77 69 6c 6c 20 77 65 20 67 69 76 65 20 74 68 65 0a | connected,.nor.will.we.give.the. |
| 137ea0 | 63 6f 6d 70 6c 65 74 65 20 6c 69 73 74 20 6f 66 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 | complete.list.of.machine.operati |
| 137ec0 | 6f 6e 73 2e 20 20 54 68 65 73 65 20 61 72 65 20 69 6d 70 6c 69 63 69 74 20 69 6e 20 74 68 65 0a | ons...These.are.implicit.in.the. |
| 137ee0 | 65 76 61 6c 75 61 74 6f 72 27 73 20 63 6f 6e 74 72 6f 6c 6c 65 72 2c 20 77 68 69 63 68 20 77 69 | evaluator's.controller,.which.wi |
| 137f00 | 6c 6c 20 62 65 20 70 72 65 73 65 6e 74 65 64 20 69 6e 20 64 65 74 61 69 6c 2e 0a 0a 2a 20 4d 65 | ll.be.presented.in.detail...*.Me |
| 137f20 | 6e 75 3a 0a 0a 2a 20 35 2d 34 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 54 68 65 20 43 6f | nu:..*.5-4-1::............The.Co |
| 137f40 | 72 65 20 6f 66 20 74 68 65 20 45 78 70 6c 69 63 69 74 2d 43 6f 6e 74 72 6f 6c 20 45 76 61 6c 75 | re.of.the.Explicit-Control.Evalu |
| 137f60 | 61 74 6f 72 0a 2a 20 35 2d 34 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 53 65 71 75 65 6e | ator.*.5-4-2::............Sequen |
| 137f80 | 63 65 20 45 76 61 6c 75 61 74 69 6f 6e 20 61 6e 64 20 54 61 69 6c 20 52 65 63 75 72 73 69 6f 6e | ce.Evaluation.and.Tail.Recursion |
| 137fa0 | 0a 2a 20 35 2d 34 2d 33 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6e 64 69 74 69 6f 6e 61 | .*.5-4-3::............Conditiona |
| 137fc0 | 6c 73 2c 20 41 73 73 69 67 6e 6d 65 6e 74 73 2c 20 61 6e 64 20 44 65 66 69 6e 69 74 69 6f 6e 73 | ls,.Assignments,.and.Definitions |
| 137fe0 | 0a 2a 20 35 2d 34 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 52 75 6e 6e 69 6e 67 20 74 68 | .*.5-4-4::............Running.th |
| 138000 | 65 20 45 76 61 6c 75 61 74 6f 72 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e | e.Evaluator.....----------.Footn |
| 138020 | 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 53 65 65 20 42 61 74 61 | otes.----------.....(1).See.Bata |
| 138040 | 6c 69 20 65 74 20 61 6c 2e 20 31 39 38 32 20 66 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 | li.et.al..1982.for.more.informat |
| 138060 | 69 6f 6e 20 6f 6e 20 74 68 65 20 63 68 69 70 20 61 6e 64 20 74 68 65 0a 6d 65 74 68 6f 64 20 62 | ion.on.the.chip.and.the.method.b |
| 138080 | 79 20 77 68 69 63 68 20 69 74 20 77 61 73 20 64 65 73 69 67 6e 65 64 2e 0a 0a 1f 0a 46 69 6c 65 | y.which.it.was.designed.....File |
| 1380a0 | 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 34 2d 31 2c 20 20 4e 65 78 74 | :.sicp.info,..Node:.5-4-1,..Next |
| 1380c0 | 3a 20 35 2d 34 2d 32 2c 20 20 50 72 65 76 3a 20 35 2d 34 2c 20 20 55 70 3a 20 35 2d 34 0a 0a 35 | :.5-4-2,..Prev:.5-4,..Up:.5-4..5 |
| 1380e0 | 2e 34 2e 31 20 54 68 65 20 43 6f 72 65 20 6f 66 20 74 68 65 20 45 78 70 6c 69 63 69 74 2d 43 6f | .4.1.The.Core.of.the.Explicit-Co |
| 138100 | 6e 74 72 6f 6c 20 45 76 61 6c 75 61 74 6f 72 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ntrol.Evaluator.---------------- |
| 138120 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 138140 | 0a 0a 54 68 65 20 63 65 6e 74 72 61 6c 20 65 6c 65 6d 65 6e 74 20 69 6e 20 74 68 65 20 65 76 61 | ..The.central.element.in.the.eva |
| 138160 | 6c 75 61 74 6f 72 20 69 73 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 69 6e 73 74 72 75 | luator.is.the.sequence.of.instru |
| 138180 | 63 74 69 6f 6e 73 0a 62 65 67 69 6e 6e 69 6e 67 20 61 74 20 60 65 76 61 6c 2d 64 69 73 70 61 74 | ctions.beginning.at.`eval-dispat |
| 1381a0 | 63 68 27 2e 20 20 54 68 69 73 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 74 68 65 20 60 65 | ch'...This.corresponds.to.the.`e |
| 1381c0 | 76 61 6c 27 20 70 72 6f 63 65 64 75 72 65 0a 6f 66 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c | val'.procedure.of.the.metacircul |
| 1381e0 | 61 72 20 65 76 61 6c 75 61 74 6f 72 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f | ar.evaluator.described.in.sectio |
| 138200 | 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 2e 20 20 57 68 65 6e 0a 74 68 65 20 63 6f 6e 74 72 | n.*Note.4-1-1::...When.the.contr |
| 138220 | 6f 6c 6c 65 72 20 73 74 61 72 74 73 20 61 74 20 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 2c | oller.starts.at.`eval-dispatch', |
| 138240 | 20 69 74 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 73 70 65 | .it.evaluates.the.expression.spe |
| 138260 | 63 69 66 69 65 64 20 62 79 20 60 65 78 70 27 20 69 6e 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 | cified.by.`exp'.in.the.environme |
| 138280 | 6e 74 20 73 70 65 63 69 66 69 65 64 20 62 79 20 60 65 6e 76 27 2e 20 20 57 68 65 6e 0a 65 76 61 | nt.specified.by.`env'...When.eva |
| 1382a0 | 6c 75 61 74 69 6f 6e 20 69 73 20 63 6f 6d 70 6c 65 74 65 2c 20 74 68 65 20 63 6f 6e 74 72 6f 6c | luation.is.complete,.the.control |
| 1382c0 | 6c 65 72 20 77 69 6c 6c 20 67 6f 20 74 6f 20 74 68 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 0a 73 | ler.will.go.to.the.entry.point.s |
| 1382e0 | 74 6f 72 65 64 20 69 6e 20 60 63 6f 6e 74 69 6e 75 65 27 2c 20 61 6e 64 20 74 68 65 20 60 76 61 | tored.in.`continue',.and.the.`va |
| 138300 | 6c 27 20 72 65 67 69 73 74 65 72 20 77 69 6c 6c 20 68 6f 6c 64 20 74 68 65 20 76 61 6c 75 65 20 | l'.register.will.hold.the.value. |
| 138320 | 6f 66 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 41 73 20 77 69 74 68 20 74 68 65 20 | of.the.expression...As.with.the. |
| 138340 | 6d 65 74 61 63 69 72 63 75 6c 61 72 20 60 65 76 61 6c 27 2c 20 74 68 65 20 73 74 72 75 63 74 75 | metacircular.`eval',.the.structu |
| 138360 | 72 65 20 6f 66 0a 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 20 69 73 20 61 20 63 61 73 65 20 | re.of.`eval-dispatch'.is.a.case. |
| 138380 | 61 6e 61 6c 79 73 69 73 20 6f 6e 20 74 68 65 20 73 79 6e 74 61 63 74 69 63 20 74 79 70 65 20 6f | analysis.on.the.syntactic.type.o |
| 1383a0 | 66 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 | f.the.expression.to.be.evaluated |
| 1383c0 | 2e 28 31 29 0a 0a 20 20 20 20 20 65 76 61 6c 2d 64 69 73 70 61 74 63 68 0a 20 20 20 20 20 20 20 | .(1).......eval-dispatch........ |
| 1383e0 | 28 74 65 73 74 20 28 6f 70 20 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 3f 29 20 28 72 65 67 | (test.(op.self-evaluating?).(reg |
| 138400 | 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d | .exp))........(branch.(label.ev- |
| 138420 | 73 65 6c 66 2d 65 76 61 6c 29 29 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 76 61 72 | self-eval))........(test.(op.var |
| 138440 | 69 61 62 6c 65 3f 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 | iable?).(reg.exp))........(branc |
| 138460 | 68 20 28 6c 61 62 65 6c 20 65 76 2d 76 61 72 69 61 62 6c 65 29 29 0a 20 20 20 20 20 20 20 28 74 | h.(label.ev-variable))........(t |
| 138480 | 65 73 74 20 28 6f 70 20 71 75 6f 74 65 64 3f 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 | est.(op.quoted?).(reg.exp))..... |
| 1384a0 | 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d 71 75 6f 74 65 64 29 29 0a 20 20 | ...(branch.(label.ev-quoted))... |
| 1384c0 | 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 61 73 73 69 67 6e 6d 65 6e 74 3f 29 20 28 72 65 67 | .....(test.(op.assignment?).(reg |
| 1384e0 | 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d | .exp))........(branch.(label.ev- |
| 138500 | 61 73 73 69 67 6e 6d 65 6e 74 29 29 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 64 65 | assignment))........(test.(op.de |
| 138520 | 66 69 6e 69 74 69 6f 6e 3f 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 62 72 | finition?).(reg.exp))........(br |
| 138540 | 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d 64 65 66 69 6e 69 74 69 6f 6e 29 29 0a 20 20 20 20 | anch.(label.ev-definition))..... |
| 138560 | 20 20 20 28 74 65 73 74 20 28 6f 70 20 69 66 3f 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 | ...(test.(op.if?).(reg.exp)).... |
| 138580 | 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d 69 66 29 29 0a 20 20 20 20 20 | ....(branch.(label.ev-if))...... |
| 1385a0 | 20 20 28 74 65 73 74 20 28 6f 70 20 6c 61 6d 62 64 61 3f 29 20 28 72 65 67 20 65 78 70 29 29 0a | ..(test.(op.lambda?).(reg.exp)). |
| 1385c0 | 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d 6c 61 6d 62 64 61 29 | .......(branch.(label.ev-lambda) |
| 1385e0 | 29 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 62 65 67 69 6e 3f 29 20 28 72 65 67 20 | )........(test.(op.begin?).(reg. |
| 138600 | 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d 62 | exp))........(branch.(label.ev-b |
| 138620 | 65 67 69 6e 29 29 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 61 70 70 6c 69 63 61 74 | egin))........(test.(op.applicat |
| 138640 | 69 6f 6e 3f 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 | ion?).(reg.exp))........(branch. |
| 138660 | 28 6c 61 62 65 6c 20 65 76 2d 61 70 70 6c 69 63 61 74 69 6f 6e 29 29 0a 20 20 20 20 20 20 20 28 | (label.ev-application))........( |
| 138680 | 67 6f 74 6f 20 28 6c 61 62 65 6c 20 75 6e 6b 6e 6f 77 6e 2d 65 78 70 72 65 73 73 69 6f 6e 2d 74 | goto.(label.unknown-expression-t |
| 1386a0 | 79 70 65 29 29 0a 0a 45 76 61 6c 75 61 74 69 6e 67 20 73 69 6d 70 6c 65 20 65 78 70 72 65 73 73 | ype))..Evaluating.simple.express |
| 1386c0 | 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ions............................ |
| 1386e0 | 2e 2e 0a 0a 4e 75 6d 62 65 72 73 20 61 6e 64 20 73 74 72 69 6e 67 73 20 28 77 68 69 63 68 20 61 | ....Numbers.and.strings.(which.a |
| 138700 | 72 65 20 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 29 2c 20 76 61 72 69 61 62 6c 65 73 2c 20 | re.self-evaluating),.variables,. |
| 138720 | 71 75 6f 74 61 74 69 6f 6e 73 2c 0a 61 6e 64 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 | quotations,.and.`lambda'.express |
| 138740 | 69 6f 6e 73 20 68 61 76 65 20 6e 6f 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 20 74 6f 20 62 | ions.have.no.subexpressions.to.b |
| 138760 | 65 20 65 76 61 6c 75 61 74 65 64 2e 20 20 46 6f 72 0a 74 68 65 73 65 2c 20 74 68 65 20 65 76 61 | e.evaluated...For.these,.the.eva |
| 138780 | 6c 75 61 74 6f 72 20 73 69 6d 70 6c 79 20 70 6c 61 63 65 73 20 74 68 65 20 63 6f 72 72 65 63 74 | luator.simply.places.the.correct |
| 1387a0 | 20 76 61 6c 75 65 20 69 6e 20 74 68 65 20 60 76 61 6c 27 0a 72 65 67 69 73 74 65 72 20 61 6e 64 | .value.in.the.`val'.register.and |
| 1387c0 | 20 63 6f 6e 74 69 6e 75 65 73 20 65 78 65 63 75 74 69 6f 6e 20 61 74 20 74 68 65 20 65 6e 74 72 | .continues.execution.at.the.entr |
| 1387e0 | 79 20 70 6f 69 6e 74 20 73 70 65 63 69 66 69 65 64 20 62 79 0a 60 63 6f 6e 74 69 6e 75 65 27 2e | y.point.specified.by.`continue'. |
| 138800 | 20 20 45 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 73 69 6d 70 6c 65 20 65 78 70 72 65 73 73 69 6f | ..Evaluation.of.simple.expressio |
| 138820 | 6e 73 20 69 73 20 70 65 72 66 6f 72 6d 65 64 20 62 79 20 74 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 | ns.is.performed.by.the.following |
| 138840 | 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 63 6f 64 65 3a 0a 0a 20 20 20 20 20 65 76 2d 73 65 6c 66 2d | .controller.code:.......ev-self- |
| 138860 | 65 76 61 6c 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 72 65 67 20 65 78 70 | eval........(assign.val.(reg.exp |
| 138880 | 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a | ))........(goto.(reg.continue)). |
| 1388a0 | 20 20 20 20 20 65 76 2d 76 61 72 69 61 62 6c 65 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 | .....ev-variable........(assign. |
| 1388c0 | 76 61 6c 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 29 20 28 | val.(op.lookup-variable-value).( |
| 1388e0 | 72 65 67 20 65 78 70 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f | reg.exp).(reg.env))........(goto |
| 138900 | 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a 20 20 20 20 20 65 76 2d 71 75 6f 74 65 64 0a | .(reg.continue))......ev-quoted. |
| 138920 | 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 74 65 78 74 2d 6f 66 2d 71 | .......(assign.val.(op.text-of-q |
| 138940 | 75 6f 74 61 74 69 6f 6e 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 | uotation).(reg.exp))........(got |
| 138960 | 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a 20 20 20 20 20 65 76 2d 6c 61 6d 62 64 61 | o.(reg.continue))......ev-lambda |
| 138980 | 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 75 6e 65 76 20 28 6f 70 20 6c 61 6d 62 64 61 2d | ........(assign.unev.(op.lambda- |
| 1389a0 | 70 61 72 61 6d 65 74 65 72 73 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 61 | parameters).(reg.exp))........(a |
| 1389c0 | 73 73 69 67 6e 20 65 78 70 20 28 6f 70 20 6c 61 6d 62 64 61 2d 62 6f 64 79 29 20 28 72 65 67 20 | ssign.exp.(op.lambda-body).(reg. |
| 1389e0 | 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 6d 61 6b | exp))........(assign.val.(op.mak |
| 138a00 | 65 2d 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e-procedure).................... |
| 138a20 | 28 72 65 67 20 75 6e 65 76 29 20 28 72 65 67 20 65 78 70 29 20 28 72 65 67 20 65 6e 76 29 29 0a | (reg.unev).(reg.exp).(reg.env)). |
| 138a40 | 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a 0a 20 20 | .......(goto.(reg.continue)).... |
| 138a60 | 20 4f 62 73 65 72 76 65 20 68 6f 77 20 60 65 76 2d 6c 61 6d 62 64 61 27 20 75 73 65 73 20 74 68 | .Observe.how.`ev-lambda'.uses.th |
| 138a80 | 65 20 60 75 6e 65 76 27 20 61 6e 64 20 60 65 78 70 27 20 72 65 67 69 73 74 65 72 73 20 74 6f 20 | e.`unev'.and.`exp'.registers.to. |
| 138aa0 | 68 6f 6c 64 0a 74 68 65 20 70 61 72 61 6d 65 74 65 72 73 20 61 6e 64 20 62 6f 64 79 20 6f 66 20 | hold.the.parameters.and.body.of. |
| 138ac0 | 74 68 65 20 6c 61 6d 62 64 61 20 65 78 70 72 65 73 73 69 6f 6e 20 73 6f 20 74 68 61 74 20 74 68 | the.lambda.expression.so.that.th |
| 138ae0 | 65 79 20 63 61 6e 20 62 65 0a 70 61 73 73 65 64 20 74 6f 20 74 68 65 20 60 6d 61 6b 65 2d 70 72 | ey.can.be.passed.to.the.`make-pr |
| 138b00 | 6f 63 65 64 75 72 65 27 20 6f 70 65 72 61 74 69 6f 6e 2c 20 61 6c 6f 6e 67 20 77 69 74 68 20 74 | ocedure'.operation,.along.with.t |
| 138b20 | 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 0a 60 65 6e 76 27 2e 0a 0a 45 76 61 6c 75 61 | he.environment.in.`env'...Evalua |
| 138b40 | 74 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 0a 2e 2e 2e 2e | ting.procedure.applications..... |
| 138b60 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 | ...............................A |
| 138b80 | 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 69 73 20 73 70 65 63 69 66 | .procedure.application.is.specif |
| 138ba0 | 69 65 64 20 62 79 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 63 6f 6e 74 61 69 6e 69 6e 67 20 | ied.by.a.combination.containing. |
| 138bc0 | 61 6e 0a 6f 70 65 72 61 74 6f 72 20 61 6e 64 20 6f 70 65 72 61 6e 64 73 2e 20 20 54 68 65 20 6f | an.operator.and.operands...The.o |
| 138be0 | 70 65 72 61 74 6f 72 20 69 73 20 61 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 20 77 68 6f 73 65 | perator.is.a.subexpression.whose |
| 138c00 | 20 76 61 6c 75 65 20 69 73 0a 61 20 70 72 6f 63 65 64 75 72 65 2c 20 61 6e 64 20 74 68 65 20 6f | .value.is.a.procedure,.and.the.o |
| 138c20 | 70 65 72 61 6e 64 73 20 61 72 65 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 73 20 77 68 6f 73 65 | perands.are.subexpressions.whose |
| 138c40 | 20 76 61 6c 75 65 73 20 61 72 65 20 74 68 65 0a 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 77 68 69 | .values.are.the.arguments.to.whi |
| 138c60 | 63 68 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 73 68 6f 75 6c 64 20 62 65 20 61 70 70 6c 69 | ch.the.procedure.should.be.appli |
| 138c80 | 65 64 2e 20 20 54 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 0a 60 65 76 61 6c 27 20 68 61 6e | ed...The.metacircular.`eval'.han |
| 138ca0 | 64 6c 65 73 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 62 79 20 63 61 6c 6c 69 6e 67 20 69 74 73 | dles.applications.by.calling.its |
| 138cc0 | 65 6c 66 20 72 65 63 75 72 73 69 76 65 6c 79 20 74 6f 20 65 76 61 6c 75 61 74 65 0a 65 61 63 68 | elf.recursively.to.evaluate.each |
| 138ce0 | 20 65 6c 65 6d 65 6e 74 20 6f 66 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 2c 20 61 6e 64 | .element.of.the.combination,.and |
| 138d00 | 20 74 68 65 6e 20 70 61 73 73 69 6e 67 20 74 68 65 20 72 65 73 75 6c 74 73 20 74 6f 0a 60 61 70 | .then.passing.the.results.to.`ap |
| 138d20 | 70 6c 79 27 2c 20 77 68 69 63 68 20 70 65 72 66 6f 72 6d 73 20 74 68 65 20 61 63 74 75 61 6c 20 | ply',.which.performs.the.actual. |
| 138d40 | 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 20 20 54 68 65 0a 65 78 70 6c | procedure.application...The.expl |
| 138d60 | 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 64 6f 65 73 20 74 68 65 20 | icit-control.evaluator.does.the. |
| 138d80 | 73 61 6d 65 20 74 68 69 6e 67 3b 20 74 68 65 73 65 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c | same.thing;.these.recursive.call |
| 138da0 | 73 0a 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 79 20 60 67 6f 74 6f 27 20 69 6e 73 74 | s.are.implemented.by.`goto'.inst |
| 138dc0 | 72 75 63 74 69 6f 6e 73 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 75 73 65 20 6f 66 20 74 | ructions,.together.with.use.of.t |
| 138de0 | 68 65 20 73 74 61 63 6b 0a 74 6f 20 73 61 76 65 20 72 65 67 69 73 74 65 72 73 20 74 68 61 74 20 | he.stack.to.save.registers.that. |
| 138e00 | 77 69 6c 6c 20 62 65 20 72 65 73 74 6f 72 65 64 20 61 66 74 65 72 20 74 68 65 20 72 65 63 75 72 | will.be.restored.after.the.recur |
| 138e20 | 73 69 76 65 20 63 61 6c 6c 0a 72 65 74 75 72 6e 73 2e 20 20 42 65 66 6f 72 65 20 65 61 63 68 20 | sive.call.returns...Before.each. |
| 138e40 | 63 61 6c 6c 20 77 65 20 77 69 6c 6c 20 62 65 20 63 61 72 65 66 75 6c 20 74 6f 20 69 64 65 6e 74 | call.we.will.be.careful.to.ident |
| 138e60 | 69 66 79 20 77 68 69 63 68 0a 72 65 67 69 73 74 65 72 73 20 6d 75 73 74 20 62 65 20 73 61 76 65 | ify.which.registers.must.be.save |
| 138e80 | 64 20 28 62 65 63 61 75 73 65 20 74 68 65 69 72 20 76 61 6c 75 65 73 20 77 69 6c 6c 20 62 65 20 | d.(because.their.values.will.be. |
| 138ea0 | 6e 65 65 64 65 64 20 6c 61 74 65 72 29 2e 28 32 29 0a 0a 20 20 20 57 65 20 62 65 67 69 6e 20 74 | needed.later).(2).....We.begin.t |
| 138ec0 | 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 | he.evaluation.of.an.application. |
| 138ee0 | 62 79 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 6f 70 65 72 61 74 6f 72 0a 74 6f 20 70 72 | by.evaluating.the.operator.to.pr |
| 138f00 | 6f 64 75 63 65 20 61 20 70 72 6f 63 65 64 75 72 65 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 6c 61 | oduce.a.procedure,.which.will.la |
| 138f20 | 74 65 72 20 62 65 20 61 70 70 6c 69 65 64 20 74 6f 20 74 68 65 20 65 76 61 6c 75 61 74 65 64 0a | ter.be.applied.to.the.evaluated. |
| 138f40 | 6f 70 65 72 61 6e 64 73 2e 20 20 54 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 6f 70 65 72 61 | operands...To.evaluate.the.opera |
| 138f60 | 74 6f 72 2c 20 77 65 20 6d 6f 76 65 20 69 74 20 74 6f 20 74 68 65 20 60 65 78 70 27 20 72 65 67 | tor,.we.move.it.to.the.`exp'.reg |
| 138f80 | 69 73 74 65 72 0a 61 6e 64 20 67 6f 20 74 6f 20 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 2e | ister.and.go.to.`eval-dispatch'. |
| 138fa0 | 20 20 54 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 74 68 65 20 60 65 6e 76 27 20 72 | ..The.environment.in.the.`env'.r |
| 138fc0 | 65 67 69 73 74 65 72 20 69 73 0a 61 6c 72 65 61 64 79 20 74 68 65 20 63 6f 72 72 65 63 74 20 6f | egister.is.already.the.correct.o |
| 138fe0 | 6e 65 20 69 6e 20 77 68 69 63 68 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 6f 70 65 72 | ne.in.which.to.evaluate.the.oper |
| 139000 | 61 74 6f 72 2e 20 20 48 6f 77 65 76 65 72 2c 20 77 65 0a 73 61 76 65 20 60 65 6e 76 27 20 62 65 | ator...However,.we.save.`env'.be |
| 139020 | 63 61 75 73 65 20 77 65 20 77 69 6c 6c 20 6e 65 65 64 20 69 74 20 6c 61 74 65 72 20 74 6f 20 65 | cause.we.will.need.it.later.to.e |
| 139040 | 76 61 6c 75 61 74 65 20 74 68 65 20 6f 70 65 72 61 6e 64 73 2e 20 20 57 65 0a 61 6c 73 6f 20 65 | valuate.the.operands...We.also.e |
| 139060 | 78 74 72 61 63 74 20 74 68 65 20 6f 70 65 72 61 6e 64 73 20 69 6e 74 6f 20 60 75 6e 65 76 27 20 | xtract.the.operands.into.`unev'. |
| 139080 | 61 6e 64 20 73 61 76 65 20 74 68 69 73 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 2e 20 20 57 65 0a | and.save.this.on.the.stack...We. |
| 1390a0 | 73 65 74 20 75 70 20 60 63 6f 6e 74 69 6e 75 65 27 20 73 6f 20 74 68 61 74 20 60 65 76 61 6c 2d | set.up.`continue'.so.that.`eval- |
| 1390c0 | 64 69 73 70 61 74 63 68 27 20 77 69 6c 6c 20 72 65 73 75 6d 65 20 61 74 0a 60 65 76 2d 61 70 70 | dispatch'.will.resume.at.`ev-app |
| 1390e0 | 6c 2d 64 69 64 2d 6f 70 65 72 61 74 6f 72 27 20 61 66 74 65 72 20 74 68 65 20 6f 70 65 72 61 74 | l-did-operator'.after.the.operat |
| 139100 | 6f 72 20 68 61 73 20 62 65 65 6e 20 65 76 61 6c 75 61 74 65 64 2e 20 20 46 69 72 73 74 2c 0a 68 | or.has.been.evaluated...First,.h |
| 139120 | 6f 77 65 76 65 72 2c 20 77 65 20 73 61 76 65 20 74 68 65 20 6f 6c 64 20 76 61 6c 75 65 20 6f 66 | owever,.we.save.the.old.value.of |
| 139140 | 20 60 63 6f 6e 74 69 6e 75 65 27 2c 20 77 68 69 63 68 20 74 65 6c 6c 73 20 74 68 65 20 63 6f 6e | .`continue',.which.tells.the.con |
| 139160 | 74 72 6f 6c 6c 65 72 0a 77 68 65 72 65 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20 61 66 74 65 72 20 | troller.where.to.continue.after. |
| 139180 | 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 65 76 2d 61 70 70 6c 69 63 | the.application........ev-applic |
| 1391a0 | 61 74 69 6f 6e 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 | ation........(save.continue).... |
| 1391c0 | 20 20 20 20 28 73 61 76 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 75 6e | ....(save.env)........(assign.un |
| 1391e0 | 65 76 20 28 6f 70 20 6f 70 65 72 61 6e 64 73 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 | ev.(op.operands).(reg.exp))..... |
| 139200 | 20 20 20 28 73 61 76 65 20 75 6e 65 76 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 78 | ...(save.unev)........(assign.ex |
| 139220 | 70 20 28 6f 70 20 6f 70 65 72 61 74 6f 72 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 | p.(op.operator).(reg.exp))...... |
| 139240 | 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 65 76 2d 61 70 70 | ..(assign.continue.(label.ev-app |
| 139260 | 6c 2d 64 69 64 2d 6f 70 65 72 61 74 6f 72 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c | l-did-operator))........(goto.(l |
| 139280 | 61 62 65 6c 20 65 76 61 6c 2d 64 69 73 70 61 74 63 68 29 29 0a 0a 20 20 20 55 70 6f 6e 20 72 65 | abel.eval-dispatch)).....Upon.re |
| 1392a0 | 74 75 72 6e 69 6e 67 20 66 72 6f 6d 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 6f 70 65 72 | turning.from.evaluating.the.oper |
| 1392c0 | 61 74 6f 72 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 2c 20 77 65 0a 70 72 6f 63 65 65 64 20 74 | ator.subexpression,.we.proceed.t |
| 1392e0 | 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 6f 70 65 72 61 6e 64 73 20 6f 66 20 74 68 65 20 63 | o.evaluate.the.operands.of.the.c |
| 139300 | 6f 6d 62 69 6e 61 74 69 6f 6e 20 61 6e 64 20 74 6f 20 61 63 63 75 6d 75 6c 61 74 65 0a 74 68 65 | ombination.and.to.accumulate.the |
| 139320 | 20 72 65 73 75 6c 74 69 6e 67 20 61 72 67 75 6d 65 6e 74 73 20 69 6e 20 61 20 6c 69 73 74 2c 20 | .resulting.arguments.in.a.list,. |
| 139340 | 68 65 6c 64 20 69 6e 20 60 61 72 67 6c 27 2e 20 20 46 69 72 73 74 20 77 65 20 72 65 73 74 6f 72 | held.in.`argl'...First.we.restor |
| 139360 | 65 0a 74 68 65 20 75 6e 65 76 61 6c 75 61 74 65 64 20 6f 70 65 72 61 6e 64 73 20 61 6e 64 20 74 | e.the.unevaluated.operands.and.t |
| 139380 | 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 57 65 20 69 6e 69 74 69 61 6c 69 7a 65 20 60 | he.environment...We.initialize.` |
| 1393a0 | 61 72 67 6c 27 20 74 6f 0a 61 6e 20 65 6d 70 74 79 20 6c 69 73 74 2e 20 20 54 68 65 6e 20 77 65 | argl'.to.an.empty.list...Then.we |
| 1393c0 | 20 61 73 73 69 67 6e 20 74 6f 20 74 68 65 20 60 70 72 6f 63 27 20 72 65 67 69 73 74 65 72 20 74 | .assign.to.the.`proc'.register.t |
| 1393e0 | 68 65 20 70 72 6f 63 65 64 75 72 65 0a 74 68 61 74 20 77 61 73 20 70 72 6f 64 75 63 65 64 20 62 | he.procedure.that.was.produced.b |
| 139400 | 79 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 6f 70 65 72 61 74 6f 72 2e 20 20 49 66 20 74 | y.evaluating.the.operator...If.t |
| 139420 | 68 65 72 65 20 61 72 65 20 6e 6f 0a 6f 70 65 72 61 6e 64 73 2c 20 77 65 20 67 6f 20 64 69 72 65 | here.are.no.operands,.we.go.dire |
| 139440 | 63 74 6c 79 20 74 6f 20 60 61 70 70 6c 79 2d 64 69 73 70 61 74 63 68 27 2e 20 20 4f 74 68 65 72 | ctly.to.`apply-dispatch'...Other |
| 139460 | 77 69 73 65 20 77 65 20 73 61 76 65 20 60 70 72 6f 63 27 0a 6f 6e 20 74 68 65 20 73 74 61 63 6b | wise.we.save.`proc'.on.the.stack |
| 139480 | 20 61 6e 64 20 73 74 61 72 74 20 74 68 65 20 61 72 67 75 6d 65 6e 74 2d 65 76 61 6c 75 61 74 69 | .and.start.the.argument-evaluati |
| 1394a0 | 6f 6e 20 6c 6f 6f 70 3a 28 33 29 0a 0a 20 20 20 20 20 65 76 2d 61 70 70 6c 2d 64 69 64 2d 6f 70 | on.loop:(3).......ev-appl-did-op |
| 1394c0 | 65 72 61 74 6f 72 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 75 6e 65 76 29 20 20 20 20 | erator........(restore.unev).... |
| 1394e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 74 68 65 20 6f 70 65 72 61 6e 64 73 0a 20 20 20 | ..............;.the.operands.... |
| 139500 | 20 20 20 20 28 72 65 73 74 6f 72 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e | ....(restore.env)........(assign |
| 139520 | 20 61 72 67 6c 20 28 6f 70 20 65 6d 70 74 79 2d 61 72 67 6c 69 73 74 29 29 0a 20 20 20 20 20 20 | .argl.(op.empty-arglist))....... |
| 139540 | 20 28 61 73 73 69 67 6e 20 70 72 6f 63 20 28 72 65 67 20 76 61 6c 29 29 20 20 20 20 20 20 20 20 | .(assign.proc.(reg.val))........ |
| 139560 | 20 3b 20 74 68 65 20 6f 70 65 72 61 74 6f 72 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 | .;.the.operator........(test.(op |
| 139580 | 20 6e 6f 2d 6f 70 65 72 61 6e 64 73 3f 29 20 28 72 65 67 20 75 6e 65 76 29 29 0a 20 20 20 20 20 | .no-operands?).(reg.unev))...... |
| 1395a0 | 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 61 70 70 6c 79 2d 64 69 73 70 61 74 63 68 29 | ..(branch.(label.apply-dispatch) |
| 1395c0 | 29 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 70 72 6f 63 29 0a 0a 20 20 20 45 61 63 68 20 63 79 | )........(save.proc).....Each.cy |
| 1395e0 | 63 6c 65 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 2d 65 76 61 6c 75 61 74 69 6f 6e 20 6c | cle.of.the.argument-evaluation.l |
| 139600 | 6f 6f 70 20 65 76 61 6c 75 61 74 65 73 20 61 6e 20 6f 70 65 72 61 6e 64 20 66 72 6f 6d 0a 74 68 | oop.evaluates.an.operand.from.th |
| 139620 | 65 20 6c 69 73 74 20 69 6e 20 60 75 6e 65 76 27 20 61 6e 64 20 61 63 63 75 6d 75 6c 61 74 65 73 | e.list.in.`unev'.and.accumulates |
| 139640 | 20 74 68 65 20 72 65 73 75 6c 74 20 69 6e 74 6f 20 60 61 72 67 6c 27 2e 20 20 54 6f 20 65 76 61 | .the.result.into.`argl'...To.eva |
| 139660 | 6c 75 61 74 65 0a 61 6e 20 6f 70 65 72 61 6e 64 2c 20 77 65 20 70 6c 61 63 65 20 69 74 20 69 6e | luate.an.operand,.we.place.it.in |
| 139680 | 20 74 68 65 20 60 65 78 70 27 20 72 65 67 69 73 74 65 72 20 61 6e 64 20 67 6f 20 74 6f 20 60 65 | .the.`exp'.register.and.go.to.`e |
| 1396a0 | 76 61 6c 2d 64 69 73 70 61 74 63 68 27 2c 0a 61 66 74 65 72 20 73 65 74 74 69 6e 67 20 60 63 6f | val-dispatch',.after.setting.`co |
| 1396c0 | 6e 74 69 6e 75 65 27 20 73 6f 20 74 68 61 74 20 65 78 65 63 75 74 69 6f 6e 20 77 69 6c 6c 20 72 | ntinue'.so.that.execution.will.r |
| 1396e0 | 65 73 75 6d 65 20 77 69 74 68 20 74 68 65 0a 61 72 67 75 6d 65 6e 74 2d 61 63 63 75 6d 75 6c 61 | esume.with.the.argument-accumula |
| 139700 | 74 69 6f 6e 20 70 68 61 73 65 2e 20 20 42 75 74 20 66 69 72 73 74 20 77 65 20 73 61 76 65 20 74 | tion.phase...But.first.we.save.t |
| 139720 | 68 65 20 61 72 67 75 6d 65 6e 74 73 0a 61 63 63 75 6d 75 6c 61 74 65 64 20 73 6f 20 66 61 72 20 | he.arguments.accumulated.so.far. |
| 139740 | 28 68 65 6c 64 20 69 6e 20 60 61 72 67 6c 27 29 2c 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e | (held.in.`argl'),.the.environmen |
| 139760 | 74 20 28 68 65 6c 64 20 69 6e 20 60 65 6e 76 27 29 2c 0a 61 6e 64 20 74 68 65 20 72 65 6d 61 69 | t.(held.in.`env'),.and.the.remai |
| 139780 | 6e 69 6e 67 20 6f 70 65 72 61 6e 64 73 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 28 68 | ning.operands.to.be.evaluated.(h |
| 1397a0 | 65 6c 64 20 69 6e 20 60 75 6e 65 76 27 29 2e 20 20 41 20 73 70 65 63 69 61 6c 0a 63 61 73 65 20 | eld.in.`unev')...A.special.case. |
| 1397c0 | 69 73 20 6d 61 64 65 20 66 6f 72 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 | is.made.for.the.evaluation.of.th |
| 1397e0 | 65 20 6c 61 73 74 20 6f 70 65 72 61 6e 64 2c 20 77 68 69 63 68 20 69 73 20 68 61 6e 64 6c 65 64 | e.last.operand,.which.is.handled |
| 139800 | 20 61 74 0a 60 65 76 2d 61 70 70 6c 2d 6c 61 73 74 2d 61 72 67 27 2e 0a 0a 20 20 20 20 20 65 76 | .at.`ev-appl-last-arg'........ev |
| 139820 | 2d 61 70 70 6c 2d 6f 70 65 72 61 6e 64 2d 6c 6f 6f 70 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 | -appl-operand-loop........(save. |
| 139840 | 61 72 67 6c 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 78 70 20 28 6f 70 20 66 69 72 | argl)........(assign.exp.(op.fir |
| 139860 | 73 74 2d 6f 70 65 72 61 6e 64 29 20 28 72 65 67 20 75 6e 65 76 29 29 0a 20 20 20 20 20 20 20 28 | st-operand).(reg.unev))........( |
| 139880 | 74 65 73 74 20 28 6f 70 20 6c 61 73 74 2d 6f 70 65 72 61 6e 64 3f 29 20 28 72 65 67 20 75 6e 65 | test.(op.last-operand?).(reg.une |
| 1398a0 | 76 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d 61 70 70 | v))........(branch.(label.ev-app |
| 1398c0 | 6c 2d 6c 61 73 74 2d 61 72 67 29 29 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 65 6e 76 29 0a 20 | l-last-arg))........(save.env).. |
| 1398e0 | 20 20 20 20 20 20 28 73 61 76 65 20 75 6e 65 76 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e | ......(save.unev)........(assign |
| 139900 | 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 65 76 2d 61 70 70 6c 2d 61 63 63 75 6d 75 6c | .continue.(label.ev-appl-accumul |
| 139920 | 61 74 65 2d 61 72 67 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 76 | ate-arg))........(goto.(label.ev |
| 139940 | 61 6c 2d 64 69 73 70 61 74 63 68 29 29 0a 0a 20 20 20 57 68 65 6e 20 61 6e 20 6f 70 65 72 61 6e | al-dispatch)).....When.an.operan |
| 139960 | 64 20 68 61 73 20 62 65 65 6e 20 65 76 61 6c 75 61 74 65 64 2c 20 74 68 65 20 76 61 6c 75 65 20 | d.has.been.evaluated,.the.value. |
| 139980 | 69 73 20 61 63 63 75 6d 75 6c 61 74 65 64 20 69 6e 74 6f 0a 74 68 65 20 6c 69 73 74 20 68 65 6c | is.accumulated.into.the.list.hel |
| 1399a0 | 64 20 69 6e 20 60 61 72 67 6c 27 2e 20 20 54 68 65 20 6f 70 65 72 61 6e 64 20 69 73 20 74 68 65 | d.in.`argl'...The.operand.is.the |
| 1399c0 | 6e 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20 74 68 65 20 6c 69 73 74 20 6f 66 0a 75 6e 65 76 61 | n.removed.from.the.list.of.uneva |
| 1399e0 | 6c 75 61 74 65 64 20 6f 70 65 72 61 6e 64 73 20 69 6e 20 60 75 6e 65 76 27 2c 20 61 6e 64 20 74 | luated.operands.in.`unev',.and.t |
| 139a00 | 68 65 20 61 72 67 75 6d 65 6e 74 2d 65 76 61 6c 75 61 74 69 6f 6e 20 63 6f 6e 74 69 6e 75 65 73 | he.argument-evaluation.continues |
| 139a20 | 2e 0a 0a 20 20 20 20 20 65 76 2d 61 70 70 6c 2d 61 63 63 75 6d 75 6c 61 74 65 2d 61 72 67 0a 20 | ........ev-appl-accumulate-arg.. |
| 139a40 | 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 75 6e 65 76 29 0a 20 20 20 20 20 20 20 28 72 65 73 | ......(restore.unev)........(res |
| 139a60 | 74 6f 72 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 61 72 67 6c 29 0a | tore.env)........(restore.argl). |
| 139a80 | 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 61 64 6a 6f 69 6e 2d 61 | .......(assign.argl.(op.adjoin-a |
| 139aa0 | 72 67 29 20 28 72 65 67 20 76 61 6c 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 | rg).(reg.val).(reg.argl))....... |
| 139ac0 | 20 28 61 73 73 69 67 6e 20 75 6e 65 76 20 28 6f 70 20 72 65 73 74 2d 6f 70 65 72 61 6e 64 73 29 | .(assign.unev.(op.rest-operands) |
| 139ae0 | 20 28 72 65 67 20 75 6e 65 76 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c | .(reg.unev))........(goto.(label |
| 139b00 | 20 65 76 2d 61 70 70 6c 2d 6f 70 65 72 61 6e 64 2d 6c 6f 6f 70 29 29 0a 0a 20 20 20 45 76 61 6c | .ev-appl-operand-loop)).....Eval |
| 139b20 | 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6c 61 73 74 20 61 72 67 75 6d 65 6e 74 20 69 73 20 68 | uation.of.the.last.argument.is.h |
| 139b40 | 61 6e 64 6c 65 64 20 64 69 66 66 65 72 65 6e 74 6c 79 2e 20 20 54 68 65 72 65 20 69 73 20 6e 6f | andled.differently...There.is.no |
| 139b60 | 0a 6e 65 65 64 20 74 6f 20 73 61 76 65 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6f 72 | .need.to.save.the.environment.or |
| 139b80 | 20 74 68 65 20 6c 69 73 74 20 6f 66 20 75 6e 65 76 61 6c 75 61 74 65 64 20 6f 70 65 72 61 6e 64 | .the.list.of.unevaluated.operand |
| 139ba0 | 73 20 62 65 66 6f 72 65 0a 67 6f 69 6e 67 20 74 6f 20 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 | s.before.going.to.`eval-dispatch |
| 139bc0 | 27 2c 20 73 69 6e 63 65 20 74 68 65 79 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 72 65 71 75 69 72 | ',.since.they.will.not.be.requir |
| 139be0 | 65 64 20 61 66 74 65 72 20 74 68 65 0a 6c 61 73 74 20 6f 70 65 72 61 6e 64 20 69 73 20 65 76 61 | ed.after.the.last.operand.is.eva |
| 139c00 | 6c 75 61 74 65 64 2e 20 20 54 68 75 73 2c 20 77 65 20 72 65 74 75 72 6e 20 66 72 6f 6d 20 74 68 | luated...Thus,.we.return.from.th |
| 139c20 | 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 74 6f 20 61 0a 73 70 65 63 69 61 6c 20 65 6e 74 72 79 20 | e.evaluation.to.a.special.entry. |
| 139c40 | 70 6f 69 6e 74 20 60 65 76 2d 61 70 70 6c 2d 61 63 63 75 6d 2d 6c 61 73 74 2d 61 72 67 27 2c 20 | point.`ev-appl-accum-last-arg',. |
| 139c60 | 77 68 69 63 68 20 72 65 73 74 6f 72 65 73 20 74 68 65 0a 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 | which.restores.the.argument.list |
| 139c80 | 2c 20 61 63 63 75 6d 75 6c 61 74 65 73 20 74 68 65 20 6e 65 77 20 61 72 67 75 6d 65 6e 74 2c 20 | ,.accumulates.the.new.argument,. |
| 139ca0 | 72 65 73 74 6f 72 65 73 20 74 68 65 20 73 61 76 65 64 0a 70 72 6f 63 65 64 75 72 65 2c 20 61 6e | restores.the.saved.procedure,.an |
| 139cc0 | 64 20 67 6f 65 73 20 6f 66 66 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 20 61 70 70 6c 69 63 | d.goes.off.to.perform.the.applic |
| 139ce0 | 61 74 69 6f 6e 2e 28 34 29 0a 0a 20 20 20 20 20 65 76 2d 61 70 70 6c 2d 6c 61 73 74 2d 61 72 67 | ation.(4).......ev-appl-last-arg |
| 139d00 | 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 | ........(assign.continue.(label. |
| 139d20 | 65 76 2d 61 70 70 6c 2d 61 63 63 75 6d 2d 6c 61 73 74 2d 61 72 67 29 29 0a 20 20 20 20 20 20 20 | ev-appl-accum-last-arg))........ |
| 139d40 | 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 76 61 6c 2d 64 69 73 70 61 74 63 68 29 29 0a 20 20 20 | (goto.(label.eval-dispatch)).... |
| 139d60 | 20 20 65 76 2d 61 70 70 6c 2d 61 63 63 75 6d 2d 6c 61 73 74 2d 61 72 67 0a 20 20 20 20 20 20 20 | ..ev-appl-accum-last-arg........ |
| 139d80 | 28 72 65 73 74 6f 72 65 20 61 72 67 6c 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 | (restore.argl)........(assign.ar |
| 139da0 | 67 6c 20 28 6f 70 20 61 64 6a 6f 69 6e 2d 61 72 67 29 20 28 72 65 67 20 76 61 6c 29 20 28 72 65 | gl.(op.adjoin-arg).(reg.val).(re |
| 139dc0 | 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 70 72 6f 63 29 0a 20 | g.argl))........(restore.proc).. |
| 139de0 | 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 61 70 70 6c 79 2d 64 69 73 70 61 74 63 | ......(goto.(label.apply-dispatc |
| 139e00 | 68 29 29 0a 0a 20 20 20 54 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 74 68 65 20 61 72 67 75 6d | h)).....The.details.of.the.argum |
| 139e20 | 65 6e 74 2d 65 76 61 6c 75 61 74 69 6f 6e 20 6c 6f 6f 70 20 64 65 74 65 72 6d 69 6e 65 20 74 68 | ent-evaluation.loop.determine.th |
| 139e40 | 65 20 6f 72 64 65 72 20 69 6e 0a 77 68 69 63 68 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 | e.order.in.which.the.interpreter |
| 139e60 | 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 6f 70 65 72 61 6e 64 73 20 6f 66 20 61 20 63 6f 6d | .evaluates.the.operands.of.a.com |
| 139e80 | 62 69 6e 61 74 69 6f 6e 20 28 65 2e 67 2e 2c 0a 6c 65 66 74 20 74 6f 20 72 69 67 68 74 20 6f 72 | bination.(e.g.,.left.to.right.or |
| 139ea0 | 20 72 69 67 68 74 20 74 6f 20 6c 65 66 74 2d 2d 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 | .right.to.left--see.*Note.Exerci |
| 139ec0 | 73 65 20 33 2d 38 3a 3a 29 2e 20 20 54 68 69 73 20 6f 72 64 65 72 0a 69 73 20 6e 6f 74 20 64 65 | se.3-8::)...This.order.is.not.de |
| 139ee0 | 74 65 72 6d 69 6e 65 64 20 62 79 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 | termined.by.the.metacircular.eva |
| 139f00 | 6c 75 61 74 6f 72 2c 20 77 68 69 63 68 20 69 6e 68 65 72 69 74 73 20 69 74 73 0a 63 6f 6e 74 72 | luator,.which.inherits.its.contr |
| 139f20 | 6f 6c 20 73 74 72 75 63 74 75 72 65 20 66 72 6f 6d 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 | ol.structure.from.the.underlying |
| 139f40 | 20 53 63 68 65 6d 65 20 69 6e 20 77 68 69 63 68 20 69 74 20 69 73 0a 69 6d 70 6c 65 6d 65 6e 74 | .Scheme.in.which.it.is.implement |
| 139f60 | 65 64 2e 28 35 29 20 42 65 63 61 75 73 65 20 74 68 65 20 60 66 69 72 73 74 2d 6f 70 65 72 61 6e | ed.(5).Because.the.`first-operan |
| 139f80 | 64 27 20 73 65 6c 65 63 74 6f 72 20 28 75 73 65 64 20 69 6e 0a 60 65 76 2d 61 70 70 6c 2d 6f 70 | d'.selector.(used.in.`ev-appl-op |
| 139fa0 | 65 72 61 6e 64 2d 6c 6f 6f 70 27 20 74 6f 20 65 78 74 72 61 63 74 20 73 75 63 63 65 73 73 69 76 | erand-loop'.to.extract.successiv |
| 139fc0 | 65 20 6f 70 65 72 61 6e 64 73 20 66 72 6f 6d 20 60 75 6e 65 76 27 29 20 69 73 0a 69 6d 70 6c 65 | e.operands.from.`unev').is.imple |
| 139fe0 | 6d 65 6e 74 65 64 20 61 73 20 60 63 61 72 27 20 61 6e 64 20 74 68 65 20 60 72 65 73 74 2d 6f 70 | mented.as.`car'.and.the.`rest-op |
| 13a000 | 65 72 61 6e 64 73 27 20 73 65 6c 65 63 74 6f 72 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 | erands'.selector.is.implemented. |
| 13a020 | 61 73 0a 60 63 64 72 27 2c 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 | as.`cdr',.the.explicit-control.e |
| 13a040 | 76 61 6c 75 61 74 6f 72 20 77 69 6c 6c 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 6f 70 65 72 61 | valuator.will.evaluate.the.opera |
| 13a060 | 6e 64 73 20 6f 66 20 61 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 69 6e 20 6c 65 66 74 2d 74 6f 2d | nds.of.a.combination.in.left-to- |
| 13a080 | 72 69 67 68 74 20 6f 72 64 65 72 2e 0a 0a 50 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 | right.order...Procedure.applicat |
| 13a0a0 | 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 65 | ion........................The.e |
| 13a0c0 | 6e 74 72 79 20 70 6f 69 6e 74 20 60 61 70 70 6c 79 2d 64 69 73 70 61 74 63 68 27 20 63 6f 72 72 | ntry.point.`apply-dispatch'.corr |
| 13a0e0 | 65 73 70 6f 6e 64 73 20 74 6f 20 74 68 65 20 60 61 70 70 6c 79 27 20 70 72 6f 63 65 64 75 72 65 | esponds.to.the.`apply'.procedure |
| 13a100 | 0a 6f 66 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 2e 20 | .of.the.metacircular.evaluator.. |
| 13a120 | 20 42 79 20 74 68 65 20 74 69 6d 65 20 77 65 20 67 65 74 20 74 6f 20 60 61 70 70 6c 79 2d 64 69 | .By.the.time.we.get.to.`apply-di |
| 13a140 | 73 70 61 74 63 68 27 2c 0a 74 68 65 20 60 70 72 6f 63 27 20 72 65 67 69 73 74 65 72 20 63 6f 6e | spatch',.the.`proc'.register.con |
| 13a160 | 74 61 69 6e 73 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 61 70 70 6c 79 20 61 6e 64 | tains.the.procedure.to.apply.and |
| 13a180 | 20 60 61 72 67 6c 27 20 63 6f 6e 74 61 69 6e 73 0a 74 68 65 20 6c 69 73 74 20 6f 66 20 65 76 61 | .`argl'.contains.the.list.of.eva |
| 13a1a0 | 6c 75 61 74 65 64 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 77 68 69 63 68 20 69 74 20 6d 75 73 | luated.arguments.to.which.it.mus |
| 13a1c0 | 74 20 62 65 20 61 70 70 6c 69 65 64 2e 20 20 54 68 65 20 73 61 76 65 64 0a 76 61 6c 75 65 20 6f | t.be.applied...The.saved.value.o |
| 13a1e0 | 66 20 60 63 6f 6e 74 69 6e 75 65 27 20 28 6f 72 69 67 69 6e 61 6c 6c 79 20 70 61 73 73 65 64 20 | f.`continue'.(originally.passed. |
| 13a200 | 74 6f 20 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 20 61 6e 64 20 73 61 76 65 64 20 61 74 0a | to.`eval-dispatch'.and.saved.at. |
| 13a220 | 60 65 76 2d 61 70 70 6c 69 63 61 74 69 6f 6e 27 29 2c 20 77 68 69 63 68 20 74 65 6c 6c 73 20 77 | `ev-application'),.which.tells.w |
| 13a240 | 68 65 72 65 20 74 6f 20 72 65 74 75 72 6e 20 77 69 74 68 20 74 68 65 20 72 65 73 75 6c 74 20 6f | here.to.return.with.the.result.o |
| 13a260 | 66 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 69 73 20 | f.the.procedure.application,.is. |
| 13a280 | 6f 6e 20 74 68 65 20 73 74 61 63 6b 2e 20 20 57 68 65 6e 20 74 68 65 20 61 70 70 6c 69 63 61 74 | on.the.stack...When.the.applicat |
| 13a2a0 | 69 6f 6e 20 69 73 0a 63 6f 6d 70 6c 65 74 65 2c 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 | ion.is.complete,.the.controller. |
| 13a2c0 | 74 72 61 6e 73 66 65 72 73 20 74 6f 20 74 68 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 73 70 65 | transfers.to.the.entry.point.spe |
| 13a2e0 | 63 69 66 69 65 64 20 62 79 20 74 68 65 0a 73 61 76 65 64 20 60 63 6f 6e 74 69 6e 75 65 27 2c 20 | cified.by.the.saved.`continue',. |
| 13a300 | 77 69 74 68 20 74 68 65 20 72 65 73 75 6c 74 20 6f 66 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 | with.the.result.of.the.applicati |
| 13a320 | 6f 6e 20 69 6e 20 60 76 61 6c 27 2e 20 20 41 73 20 77 69 74 68 0a 74 68 65 20 6d 65 74 61 63 69 | on.in.`val'...As.with.the.metaci |
| 13a340 | 72 63 75 6c 61 72 20 60 61 70 70 6c 79 27 2c 20 74 68 65 72 65 20 61 72 65 20 74 77 6f 20 63 61 | rcular.`apply',.there.are.two.ca |
| 13a360 | 73 65 73 20 74 6f 20 63 6f 6e 73 69 64 65 72 2e 20 20 45 69 74 68 65 72 20 74 68 65 0a 70 72 6f | ses.to.consider...Either.the.pro |
| 13a380 | 63 65 64 75 72 65 20 74 6f 20 62 65 20 61 70 70 6c 69 65 64 20 69 73 20 61 20 70 72 69 6d 69 74 | cedure.to.be.applied.is.a.primit |
| 13a3a0 | 69 76 65 20 6f 72 20 69 74 20 69 73 20 61 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 | ive.or.it.is.a.compound.procedur |
| 13a3c0 | 65 2e 0a 0a 20 20 20 20 20 61 70 70 6c 79 2d 64 69 73 70 61 74 63 68 0a 20 20 20 20 20 20 20 28 | e........apply-dispatch........( |
| 13a3e0 | 74 65 73 74 20 28 6f 70 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 | test.(op.primitive-procedure?).( |
| 13a400 | 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c | reg.proc))........(branch.(label |
| 13a420 | 20 70 72 69 6d 69 74 69 76 65 2d 61 70 70 6c 79 29 29 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 | .primitive-apply))........(test. |
| 13a440 | 28 6f 70 20 63 6f 6d 70 6f 75 6e 64 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 67 20 70 72 | (op.compound-procedure?).(reg.pr |
| 13a460 | 6f 63 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 63 6f 6d 70 6f | oc))........(branch.(label.compo |
| 13a480 | 75 6e 64 2d 61 70 70 6c 79 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 | und-apply))........(goto.(label. |
| 13a4a0 | 75 6e 6b 6e 6f 77 6e 2d 70 72 6f 63 65 64 75 72 65 2d 74 79 70 65 29 29 0a 0a 20 20 20 57 65 20 | unknown-procedure-type)).....We. |
| 13a4c0 | 61 73 73 75 6d 65 20 74 68 61 74 20 65 61 63 68 20 70 72 69 6d 69 74 69 76 65 20 69 73 20 69 6d | assume.that.each.primitive.is.im |
| 13a4e0 | 70 6c 65 6d 65 6e 74 65 64 20 73 6f 20 61 73 20 74 6f 20 6f 62 74 61 69 6e 20 69 74 73 0a 61 72 | plemented.so.as.to.obtain.its.ar |
| 13a500 | 67 75 6d 65 6e 74 73 20 66 72 6f 6d 20 60 61 72 67 6c 27 20 61 6e 64 20 70 6c 61 63 65 20 69 74 | guments.from.`argl'.and.place.it |
| 13a520 | 73 20 72 65 73 75 6c 74 20 69 6e 20 60 76 61 6c 27 2e 20 20 54 6f 20 73 70 65 63 69 66 79 20 68 | s.result.in.`val'...To.specify.h |
| 13a540 | 6f 77 0a 74 68 65 20 6d 61 63 68 69 6e 65 20 68 61 6e 64 6c 65 73 20 70 72 69 6d 69 74 69 76 65 | ow.the.machine.handles.primitive |
| 13a560 | 73 2c 20 77 65 20 77 6f 75 6c 64 20 68 61 76 65 20 74 6f 20 70 72 6f 76 69 64 65 20 61 20 73 65 | s,.we.would.have.to.provide.a.se |
| 13a580 | 71 75 65 6e 63 65 20 6f 66 0a 63 6f 6e 74 72 6f 6c 6c 65 72 20 69 6e 73 74 72 75 63 74 69 6f 6e | quence.of.controller.instruction |
| 13a5a0 | 73 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 65 61 63 68 20 70 72 69 6d 69 74 69 76 65 20 61 6e | s.to.implement.each.primitive.an |
| 13a5c0 | 64 20 61 72 72 61 6e 67 65 20 66 6f 72 0a 60 70 72 69 6d 69 74 69 76 65 2d 61 70 70 6c 79 27 20 | d.arrange.for.`primitive-apply'. |
| 13a5e0 | 74 6f 20 64 69 73 70 61 74 63 68 20 74 6f 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 | to.dispatch.to.the.instructions. |
| 13a600 | 66 6f 72 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 0a 69 64 65 6e 74 69 66 69 65 64 20 62 79 20 | for.the.primitive.identified.by. |
| 13a620 | 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 60 70 72 6f 63 27 2e 20 20 53 69 6e 63 65 20 77 | the.contents.of.`proc'...Since.w |
| 13a640 | 65 20 61 72 65 20 69 6e 74 65 72 65 73 74 65 64 20 69 6e 20 74 68 65 0a 73 74 72 75 63 74 75 72 | e.are.interested.in.the.structur |
| 13a660 | 65 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 72 61 74 68 | e.of.the.evaluation.process.rath |
| 13a680 | 65 72 20 74 68 61 6e 20 74 68 65 20 64 65 74 61 69 6c 73 20 6f 66 20 74 68 65 0a 70 72 69 6d 69 | er.than.the.details.of.the.primi |
| 13a6a0 | 74 69 76 65 73 2c 20 77 65 20 77 69 6c 6c 20 69 6e 73 74 65 61 64 20 6a 75 73 74 20 75 73 65 20 | tives,.we.will.instead.just.use. |
| 13a6c0 | 61 6e 20 60 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 27 0a 6f | an.`apply-primitive-procedure'.o |
| 13a6e0 | 70 65 72 61 74 69 6f 6e 20 74 68 61 74 20 61 70 70 6c 69 65 73 20 74 68 65 20 70 72 6f 63 65 64 | peration.that.applies.the.proced |
| 13a700 | 75 72 65 20 69 6e 20 60 70 72 6f 63 27 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 69 | ure.in.`proc'.to.the.arguments.i |
| 13a720 | 6e 0a 60 61 72 67 6c 27 2e 20 20 46 6f 72 20 74 68 65 20 70 75 72 70 6f 73 65 20 6f 66 20 73 69 | n.`argl'...For.the.purpose.of.si |
| 13a740 | 6d 75 6c 61 74 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 77 69 74 68 20 74 68 65 20 | mulating.the.evaluator.with.the. |
| 13a760 | 73 69 6d 75 6c 61 74 6f 72 0a 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 32 3a 3a | simulator.of.section.*Note.5-2:: |
| 13a780 | 20 77 65 20 75 73 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 60 61 70 70 6c 79 2d 70 72 69 | .we.use.the.procedure.`apply-pri |
| 13a7a0 | 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 27 2c 20 77 68 69 63 68 20 63 61 6c 6c 73 20 6f | mitive-procedure',.which.calls.o |
| 13a7c0 | 6e 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 53 63 68 65 6d 65 20 73 79 73 74 65 6d 0a 74 | n.the.underlying.Scheme.system.t |
| 13a7e0 | 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 6a 75 73 74 20 | o.perform.the.application,.just. |
| 13a800 | 61 73 20 77 65 20 64 69 64 20 66 6f 72 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 0a 65 | as.we.did.for.the.metacircular.e |
| 13a820 | 76 61 6c 75 61 74 6f 72 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 34 3a | valuator.in.section.*Note.4-1-4: |
| 13a840 | 3a 2e 20 20 41 66 74 65 72 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 76 61 6c 75 65 20 6f 66 | :...After.computing.the.value.of |
| 13a860 | 20 74 68 65 0a 70 72 69 6d 69 74 69 76 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 77 65 20 72 | .the.primitive.application,.we.r |
| 13a880 | 65 73 74 6f 72 65 20 60 63 6f 6e 74 69 6e 75 65 27 20 61 6e 64 20 67 6f 20 74 6f 20 74 68 65 20 | estore.`continue'.and.go.to.the. |
| 13a8a0 | 64 65 73 69 67 6e 61 74 65 64 0a 65 6e 74 72 79 20 70 6f 69 6e 74 2e 0a 0a 20 20 20 20 20 70 72 | designated.entry.point........pr |
| 13a8c0 | 69 6d 69 74 69 76 65 2d 61 70 70 6c 79 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c | imitive-apply........(assign.val |
| 13a8e0 | 20 28 6f 70 20 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 29 0a | .(op.apply-primitive-procedure). |
| 13a900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 70 72 6f 63 29 0a 20 20 | ...................(reg.proc)... |
| 13a920 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 | .................(reg.argl)).... |
| 13a940 | 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 28 67 | ....(restore.continue)........(g |
| 13a960 | 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a 0a 20 20 20 54 6f 20 61 70 70 6c 79 | oto.(reg.continue)).....To.apply |
| 13a980 | 20 61 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 2c 20 77 65 20 70 72 6f 63 65 65 | .a.compound.procedure,.we.procee |
| 13a9a0 | 64 20 6a 75 73 74 20 61 73 20 77 69 74 68 20 74 68 65 0a 6d 65 74 61 63 69 72 63 75 6c 61 72 20 | d.just.as.with.the.metacircular. |
| 13a9c0 | 65 76 61 6c 75 61 74 6f 72 2e 20 20 57 65 20 63 6f 6e 73 74 72 75 63 74 20 61 20 66 72 61 6d 65 | evaluator...We.construct.a.frame |
| 13a9e0 | 20 74 68 61 74 20 62 69 6e 64 73 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 27 73 20 70 61 72 61 | .that.binds.the.procedure's.para |
| 13aa00 | 6d 65 74 65 72 73 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 2c 20 75 73 65 20 74 68 69 | meters.to.the.arguments,.use.thi |
| 13aa20 | 73 20 66 72 61 6d 65 20 74 6f 20 65 78 74 65 6e 64 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e | s.frame.to.extend.the.environmen |
| 13aa40 | 74 20 63 61 72 72 69 65 64 20 62 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2c 20 61 6e 64 20 | t.carried.by.the.procedure,.and. |
| 13aa60 | 65 76 61 6c 75 61 74 65 20 69 6e 20 74 68 69 73 20 65 78 74 65 6e 64 65 64 0a 65 6e 76 69 72 6f | evaluate.in.this.extended.enviro |
| 13aa80 | 6e 6d 65 6e 74 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e | nment.the.sequence.of.expression |
| 13aaa0 | 73 20 74 68 61 74 20 66 6f 72 6d 73 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 0a 70 72 6f | s.that.forms.the.body.of.the.pro |
| 13aac0 | 63 65 64 75 72 65 2e 20 20 60 45 76 2d 73 65 71 75 65 6e 63 65 27 2c 20 64 65 73 63 72 69 62 65 | cedure...`Ev-sequence',.describe |
| 13aae0 | 64 20 62 65 6c 6f 77 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 34 2d 32 3a 3a | d.below.in.section.*Note.5-4-2:: |
| 13ab00 | 2c 0a 68 61 6e 64 6c 65 73 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 | ,.handles.the.evaluation.of.the. |
| 13ab20 | 73 65 71 75 65 6e 63 65 2e 0a 0a 20 20 20 20 20 63 6f 6d 70 6f 75 6e 64 2d 61 70 70 6c 79 0a 20 | sequence........compound-apply.. |
| 13ab40 | 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 75 6e 65 76 20 28 6f 70 20 70 72 6f 63 65 64 75 72 65 | ......(assign.unev.(op.procedure |
| 13ab60 | 2d 70 61 72 61 6d 65 74 65 72 73 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 | -parameters).(reg.proc))........ |
| 13ab80 | 28 61 73 73 69 67 6e 20 65 6e 76 20 28 6f 70 20 70 72 6f 63 65 64 75 72 65 2d 65 6e 76 69 72 6f | (assign.env.(op.procedure-enviro |
| 13aba0 | 6e 6d 65 6e 74 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 | nment).(reg.proc))........(assig |
| 13abc0 | 6e 20 65 6e 76 20 28 6f 70 20 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 0a 20 20 | n.env.(op.extend-environment)... |
| 13abe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 75 6e 65 76 29 20 28 72 65 67 | .................(reg.unev).(reg |
| 13ac00 | 20 61 72 67 6c 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e | .argl).(reg.env))........(assign |
| 13ac20 | 20 75 6e 65 76 20 28 6f 70 20 70 72 6f 63 65 64 75 72 65 2d 62 6f 64 79 29 20 28 72 65 67 20 70 | .unev.(op.procedure-body).(reg.p |
| 13ac40 | 72 6f 63 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 76 2d 73 65 71 | roc))........(goto.(label.ev-seq |
| 13ac60 | 75 65 6e 63 65 29 29 0a 0a 20 20 20 60 43 6f 6d 70 6f 75 6e 64 2d 61 70 70 6c 79 27 20 69 73 20 | uence)).....`Compound-apply'.is. |
| 13ac80 | 74 68 65 20 6f 6e 6c 79 20 70 6c 61 63 65 20 69 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 | the.only.place.in.the.interprete |
| 13aca0 | 72 20 77 68 65 72 65 20 74 68 65 20 60 65 6e 76 27 0a 72 65 67 69 73 74 65 72 20 69 73 20 65 76 | r.where.the.`env'.register.is.ev |
| 13acc0 | 65 72 20 61 73 73 69 67 6e 65 64 20 61 20 6e 65 77 20 76 61 6c 75 65 2e 20 20 4a 75 73 74 20 61 | er.assigned.a.new.value...Just.a |
| 13ace0 | 73 20 69 6e 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 0a 65 76 61 6c 75 61 74 6f 72 2c | s.in.the.metacircular.evaluator, |
| 13ad00 | 20 74 68 65 20 6e 65 77 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 63 6f 6e 73 74 72 75 63 | .the.new.environment.is.construc |
| 13ad20 | 74 65 64 20 66 72 6f 6d 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 63 61 72 72 69 65 64 | ted.from.the.environment.carried |
| 13ad40 | 20 62 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 | .by.the.procedure,.together.with |
| 13ad60 | 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 61 6e 64 20 74 68 65 0a 63 6f 72 72 65 | .the.argument.list.and.the.corre |
| 13ad80 | 73 70 6f 6e 64 69 6e 67 20 6c 69 73 74 20 6f 66 20 76 61 72 69 61 62 6c 65 73 20 74 6f 20 62 65 | sponding.list.of.variables.to.be |
| 13ada0 | 20 62 6f 75 6e 64 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 | .bound......----------.Footnotes |
| 13adc0 | 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 49 6e 20 6f 75 72 20 63 6f 6e 74 72 | .----------.....(1).In.our.contr |
| 13ade0 | 6f 6c 6c 65 72 2c 20 74 68 65 20 64 69 73 70 61 74 63 68 20 69 73 20 77 72 69 74 74 65 6e 20 61 | oller,.the.dispatch.is.written.a |
| 13ae00 | 73 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 60 74 65 73 74 27 20 61 6e 64 20 60 62 72 61 6e | s.a.sequence.of.`test'.and.`bran |
| 13ae20 | 63 68 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 20 20 41 6c 74 65 72 6e 61 74 69 76 65 6c 79 | ch'.instructions...Alternatively |
| 13ae40 | 2c 20 69 74 20 63 6f 75 6c 64 20 68 61 76 65 20 62 65 65 6e 0a 77 72 69 74 74 65 6e 20 69 6e 20 | ,.it.could.have.been.written.in. |
| 13ae60 | 61 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 73 74 79 6c 65 20 28 61 6e 64 20 69 6e 20 61 20 | a.data-directed.style.(and.in.a. |
| 13ae80 | 72 65 61 6c 20 73 79 73 74 65 6d 20 69 74 20 70 72 6f 62 61 62 6c 79 0a 77 6f 75 6c 64 20 68 61 | real.system.it.probably.would.ha |
| 13aea0 | 76 65 20 62 65 65 6e 29 20 74 6f 20 61 76 6f 69 64 20 74 68 65 20 6e 65 65 64 20 74 6f 20 70 65 | ve.been).to.avoid.the.need.to.pe |
| 13aec0 | 72 66 6f 72 6d 20 73 65 71 75 65 6e 74 69 61 6c 20 74 65 73 74 73 20 61 6e 64 20 74 6f 0a 66 61 | rform.sequential.tests.and.to.fa |
| 13aee0 | 63 69 6c 69 74 61 74 65 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 6e 65 77 20 65 | cilitate.the.definition.of.new.e |
| 13af00 | 78 70 72 65 73 73 69 6f 6e 20 74 79 70 65 73 2e 20 20 41 20 6d 61 63 68 69 6e 65 20 64 65 73 69 | xpression.types...A.machine.desi |
| 13af20 | 67 6e 65 64 0a 74 6f 20 72 75 6e 20 4c 69 73 70 20 77 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 | gned.to.run.Lisp.would.probably. |
| 13af40 | 69 6e 63 6c 75 64 65 20 61 20 60 64 69 73 70 61 74 63 68 2d 6f 6e 2d 74 79 70 65 27 20 69 6e 73 | include.a.`dispatch-on-type'.ins |
| 13af60 | 74 72 75 63 74 69 6f 6e 0a 74 68 61 74 20 77 6f 75 6c 64 20 65 66 66 69 63 69 65 6e 74 6c 79 20 | truction.that.would.efficiently. |
| 13af80 | 65 78 65 63 75 74 65 20 73 75 63 68 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 64 69 73 70 61 | execute.such.data-directed.dispa |
| 13afa0 | 74 63 68 65 73 2e 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 69 73 20 61 6e 20 69 6d 70 6f 72 74 | tches......(2).This.is.an.import |
| 13afc0 | 61 6e 74 20 62 75 74 20 73 75 62 74 6c 65 20 70 6f 69 6e 74 20 69 6e 20 74 72 61 6e 73 6c 61 74 | ant.but.subtle.point.in.translat |
| 13afe0 | 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 73 0a 66 72 6f 6d 20 61 20 70 72 6f 63 65 64 75 72 61 6c | ing.algorithms.from.a.procedural |
| 13b000 | 20 6c 61 6e 67 75 61 67 65 2c 20 73 75 63 68 20 61 73 20 4c 69 73 70 2c 20 74 6f 20 61 20 72 65 | .language,.such.as.Lisp,.to.a.re |
| 13b020 | 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 0a 6c 61 6e 67 75 61 67 65 2e 20 20 41 73 20 61 6e 20 | gister-machine.language...As.an. |
| 13b040 | 61 6c 74 65 72 6e 61 74 69 76 65 20 74 6f 20 73 61 76 69 6e 67 20 6f 6e 6c 79 20 77 68 61 74 20 | alternative.to.saving.only.what. |
| 13b060 | 69 73 20 6e 65 65 64 65 64 2c 20 77 65 20 63 6f 75 6c 64 0a 73 61 76 65 20 61 6c 6c 20 74 68 65 | is.needed,.we.could.save.all.the |
| 13b080 | 20 72 65 67 69 73 74 65 72 73 20 28 65 78 63 65 70 74 20 60 76 61 6c 27 29 20 62 65 66 6f 72 65 | .registers.(except.`val').before |
| 13b0a0 | 20 65 61 63 68 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c 2e 20 54 68 69 73 0a 69 73 20 63 61 | .each.recursive.call..This.is.ca |
| 13b0c0 | 6c 6c 65 64 20 61 20 22 66 72 61 6d 65 64 2d 73 74 61 63 6b 22 20 64 69 73 63 69 70 6c 69 6e 65 | lled.a."framed-stack".discipline |
| 13b0e0 | 2e 20 20 54 68 69 73 20 77 6f 75 6c 64 20 77 6f 72 6b 20 62 75 74 20 6d 69 67 68 74 20 73 61 76 | ...This.would.work.but.might.sav |
| 13b100 | 65 0a 6d 6f 72 65 20 72 65 67 69 73 74 65 72 73 20 74 68 61 6e 20 6e 65 63 65 73 73 61 72 79 3b | e.more.registers.than.necessary; |
| 13b120 | 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 61 6e 20 69 6d 70 6f 72 74 61 6e 74 20 63 6f 6e 73 | .this.could.be.an.important.cons |
| 13b140 | 69 64 65 72 61 74 69 6f 6e 0a 69 6e 20 61 20 73 79 73 74 65 6d 20 77 68 65 72 65 20 73 74 61 63 | ideration.in.a.system.where.stac |
| 13b160 | 6b 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 72 65 20 65 78 70 65 6e 73 69 76 65 2e 20 20 53 61 76 | k.operations.are.expensive...Sav |
| 13b180 | 69 6e 67 20 72 65 67 69 73 74 65 72 73 0a 77 68 6f 73 65 20 63 6f 6e 74 65 6e 74 73 20 77 69 6c | ing.registers.whose.contents.wil |
| 13b1a0 | 6c 20 6e 6f 74 20 62 65 20 6e 65 65 64 65 64 20 6c 61 74 65 72 20 6d 61 79 20 61 6c 73 6f 20 68 | l.not.be.needed.later.may.also.h |
| 13b1c0 | 6f 6c 64 20 6f 6e 74 6f 20 75 73 65 6c 65 73 73 20 64 61 74 61 0a 74 68 61 74 20 63 6f 75 6c 64 | old.onto.useless.data.that.could |
| 13b1e0 | 20 6f 74 68 65 72 77 69 73 65 20 62 65 20 67 61 72 62 61 67 65 2d 63 6f 6c 6c 65 63 74 65 64 2c | .otherwise.be.garbage-collected, |
| 13b200 | 20 66 72 65 65 69 6e 67 20 73 70 61 63 65 20 74 6f 20 62 65 20 72 65 75 73 65 64 2e 0a 0a 20 20 | .freeing.space.to.be.reused..... |
| 13b220 | 20 28 33 29 20 57 65 20 61 64 64 20 74 6f 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 64 61 74 | .(3).We.add.to.the.evaluator.dat |
| 13b240 | 61 2d 73 74 72 75 63 74 75 72 65 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 20 73 65 63 74 69 6f | a-structure.procedures.in.sectio |
| 13b260 | 6e 0a 2a 4e 6f 74 65 20 34 2d 31 2d 33 3a 3a 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 77 | n.*Note.4-1-3::.the.following.tw |
| 13b280 | 6f 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 69 6e 67 20 61 72 | o.procedures.for.manipulating.ar |
| 13b2a0 | 67 75 6d 65 6e 74 0a 6c 69 73 74 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6d 70 | gument.lists:.......(define.(emp |
| 13b2c0 | 74 79 2d 61 72 67 6c 69 73 74 29 20 27 28 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | ty-arglist).'()).......(define.( |
| 13b2e0 | 61 64 6a 6f 69 6e 2d 61 72 67 20 61 72 67 20 61 72 67 6c 69 73 74 29 0a 20 20 20 20 20 20 20 28 | adjoin-arg.arg.arglist)........( |
| 13b300 | 61 70 70 65 6e 64 20 61 72 67 6c 69 73 74 20 28 6c 69 73 74 20 61 72 67 29 29 29 0a 0a 20 20 20 | append.arglist.(list.arg)))..... |
| 13b320 | 57 65 20 61 6c 73 6f 20 75 73 65 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 6c 20 73 79 6e 74 61 78 | We.also.use.an.additional.syntax |
| 13b340 | 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 74 65 73 74 20 66 6f 72 20 74 68 65 20 6c 61 73 74 0a | .procedure.to.test.for.the.last. |
| 13b360 | 6f 70 65 72 61 6e 64 20 69 6e 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 | operand.in.a.combination:....... |
| 13b380 | 28 64 65 66 69 6e 65 20 28 6c 61 73 74 2d 6f 70 65 72 61 6e 64 3f 20 6f 70 73 29 0a 20 20 20 20 | (define.(last-operand?.ops)..... |
| 13b3a0 | 20 20 20 28 6e 75 6c 6c 3f 20 28 63 64 72 20 6f 70 73 29 29 29 0a 0a 20 20 20 28 34 29 20 54 68 | ...(null?.(cdr.ops))).....(4).Th |
| 13b3c0 | 65 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 6f 66 20 74 72 65 61 74 69 6e 67 20 74 68 65 20 6c | e.optimization.of.treating.the.l |
| 13b3e0 | 61 73 74 20 6f 70 65 72 61 6e 64 20 73 70 65 63 69 61 6c 6c 79 20 69 73 20 6b 6e 6f 77 6e 0a 61 | ast.operand.specially.is.known.a |
| 13b400 | 73 20 22 65 76 6c 69 73 20 74 61 69 6c 20 72 65 63 75 72 73 69 6f 6e 22 20 28 73 65 65 20 57 61 | s."evlis.tail.recursion".(see.Wa |
| 13b420 | 6e 64 20 31 39 38 30 29 2e 20 20 57 65 20 63 6f 75 6c 64 20 62 65 20 73 6f 6d 65 77 68 61 74 20 | nd.1980)...We.could.be.somewhat. |
| 13b440 | 6d 6f 72 65 0a 65 66 66 69 63 69 65 6e 74 20 69 6e 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 65 | more.efficient.in.the.argument.e |
| 13b460 | 76 61 6c 75 61 74 69 6f 6e 20 6c 6f 6f 70 20 69 66 20 77 65 20 6d 61 64 65 20 65 76 61 6c 75 61 | valuation.loop.if.we.made.evalua |
| 13b480 | 74 69 6f 6e 20 6f 66 20 74 68 65 0a 66 69 72 73 74 20 6f 70 65 72 61 6e 64 20 61 20 73 70 65 63 | tion.of.the.first.operand.a.spec |
| 13b4a0 | 69 61 6c 20 63 61 73 65 20 74 6f 6f 2e 20 20 54 68 69 73 20 77 6f 75 6c 64 20 70 65 72 6d 69 74 | ial.case.too...This.would.permit |
| 13b4c0 | 20 75 73 20 74 6f 20 70 6f 73 74 70 6f 6e 65 0a 69 6e 69 74 69 61 6c 69 7a 69 6e 67 20 60 61 72 | .us.to.postpone.initializing.`ar |
| 13b4e0 | 67 6c 27 20 75 6e 74 69 6c 20 61 66 74 65 72 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 66 | gl'.until.after.evaluating.the.f |
| 13b500 | 69 72 73 74 20 6f 70 65 72 61 6e 64 2c 20 73 6f 20 61 73 20 74 6f 0a 61 76 6f 69 64 20 73 61 76 | irst.operand,.so.as.to.avoid.sav |
| 13b520 | 69 6e 67 20 60 61 72 67 6c 27 20 69 6e 20 74 68 69 73 20 63 61 73 65 2e 20 20 54 68 65 20 63 6f | ing.`argl'.in.this.case...The.co |
| 13b540 | 6d 70 69 6c 65 72 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 3a 3a 0a 70 65 | mpiler.in.section.*Note.5-5::.pe |
| 13b560 | 72 66 6f 72 6d 73 20 74 68 69 73 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 2e 20 20 28 43 6f 6d 70 | rforms.this.optimization...(Comp |
| 13b580 | 61 72 65 20 74 68 65 20 60 63 6f 6e 73 74 72 75 63 74 2d 61 72 67 6c 69 73 74 27 20 70 72 6f 63 | are.the.`construct-arglist'.proc |
| 13b5a0 | 65 64 75 72 65 0a 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 2d 33 3a 3a 2e 29 | edure.of.section.*Note.5-5-3::.) |
| 13b5c0 | 0a 0a 20 20 20 28 35 29 20 54 68 65 20 6f 72 64 65 72 20 6f 66 20 6f 70 65 72 61 6e 64 20 65 76 | .....(5).The.order.of.operand.ev |
| 13b5e0 | 61 6c 75 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 | aluation.in.the.metacircular.eva |
| 13b600 | 6c 75 61 74 6f 72 20 69 73 0a 64 65 74 65 72 6d 69 6e 65 64 20 62 79 20 74 68 65 20 6f 72 64 65 | luator.is.determined.by.the.orde |
| 13b620 | 72 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 | r.of.evaluation.of.the.arguments |
| 13b640 | 20 74 6f 20 60 63 6f 6e 73 27 20 69 6e 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 60 6c 69 73 | .to.`cons'.in.the.procedure.`lis |
| 13b660 | 74 2d 6f 66 2d 76 61 6c 75 65 73 27 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d | t-of-values'.of.section.*Note.4- |
| 13b680 | 31 2d 31 3a 3a 20 28 73 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 0a 34 2d 31 3a 3a 29 | 1-1::.(see.*Note.Exercise.4-1::) |
| 13b6a0 | 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 34 | .....File:.sicp.info,..Node:.5-4 |
| 13b6c0 | 2d 32 2c 20 20 4e 65 78 74 3a 20 35 2d 34 2d 33 2c 20 20 50 72 65 76 3a 20 35 2d 34 2d 31 2c 20 | -2,..Next:.5-4-3,..Prev:.5-4-1,. |
| 13b6e0 | 20 55 70 3a 20 35 2d 34 0a 0a 35 2e 34 2e 32 20 53 65 71 75 65 6e 63 65 20 45 76 61 6c 75 61 74 | .Up:.5-4..5.4.2.Sequence.Evaluat |
| 13b700 | 69 6f 6e 20 61 6e 64 20 54 61 69 6c 20 52 65 63 75 72 73 69 6f 6e 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d | ion.and.Tail.Recursion.--------- |
| 13b720 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 13b740 | 2d 2d 2d 0a 0a 54 68 65 20 70 6f 72 74 69 6f 6e 20 6f 66 20 74 68 65 20 65 78 70 6c 69 63 69 74 | ---..The.portion.of.the.explicit |
| 13b760 | 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 61 74 20 60 65 76 2d 73 65 71 75 65 6e | -control.evaluator.at.`ev-sequen |
| 13b780 | 63 65 27 20 69 73 0a 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 74 68 65 20 6d 65 74 61 63 69 72 63 | ce'.is.analogous.to.the.metacirc |
| 13b7a0 | 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 27 73 20 60 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 27 | ular.evaluator's.`eval-sequence' |
| 13b7c0 | 20 70 72 6f 63 65 64 75 72 65 2e 20 20 49 74 0a 68 61 6e 64 6c 65 73 20 73 65 71 75 65 6e 63 65 | .procedure...It.handles.sequence |
| 13b7e0 | 73 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 70 72 6f 63 65 64 75 72 65 20 62 6f | s.of.expressions.in.procedure.bo |
| 13b800 | 64 69 65 73 20 6f 72 20 69 6e 20 65 78 70 6c 69 63 69 74 0a 60 62 65 67 69 6e 27 20 65 78 70 72 | dies.or.in.explicit.`begin'.expr |
| 13b820 | 65 73 73 69 6f 6e 73 2e 0a 0a 20 20 20 45 78 70 6c 69 63 69 74 20 60 62 65 67 69 6e 27 20 65 78 | essions......Explicit.`begin'.ex |
| 13b840 | 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 65 76 61 6c 75 61 74 65 64 20 62 79 20 70 6c 61 63 69 | pressions.are.evaluated.by.placi |
| 13b860 | 6e 67 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 66 0a 65 78 70 72 65 73 73 69 6f 6e 73 20 74 | ng.the.sequence.of.expressions.t |
| 13b880 | 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 69 6e 20 60 75 6e 65 76 27 2c 20 73 61 76 69 6e 67 | o.be.evaluated.in.`unev',.saving |
| 13b8a0 | 20 60 63 6f 6e 74 69 6e 75 65 27 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 2c 0a 61 6e 64 20 6a 75 | .`continue'.on.the.stack,.and.ju |
| 13b8c0 | 6d 70 69 6e 67 20 74 6f 20 60 65 76 2d 73 65 71 75 65 6e 63 65 27 2e 0a 0a 20 20 20 20 20 65 76 | mping.to.`ev-sequence'........ev |
| 13b8e0 | 2d 62 65 67 69 6e 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 75 6e 65 76 20 28 6f 70 20 62 | -begin........(assign.unev.(op.b |
| 13b900 | 65 67 69 6e 2d 61 63 74 69 6f 6e 73 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 | egin-actions).(reg.exp))........ |
| 13b920 | 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 | (save.continue)........(goto.(la |
| 13b940 | 62 65 6c 20 65 76 2d 73 65 71 75 65 6e 63 65 29 29 0a 0a 20 20 20 54 68 65 20 69 6d 70 6c 69 63 | bel.ev-sequence)).....The.implic |
| 13b960 | 69 74 20 73 65 71 75 65 6e 63 65 73 20 69 6e 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 69 65 73 | it.sequences.in.procedure.bodies |
| 13b980 | 20 61 72 65 20 68 61 6e 64 6c 65 64 20 62 79 20 6a 75 6d 70 69 6e 67 20 74 6f 0a 60 65 76 2d 73 | .are.handled.by.jumping.to.`ev-s |
| 13b9a0 | 65 71 75 65 6e 63 65 27 20 66 72 6f 6d 20 60 63 6f 6d 70 6f 75 6e 64 2d 61 70 70 6c 79 27 2c 20 | equence'.from.`compound-apply',. |
| 13b9c0 | 61 74 20 77 68 69 63 68 20 70 6f 69 6e 74 20 60 63 6f 6e 74 69 6e 75 65 27 20 69 73 0a 61 6c 72 | at.which.point.`continue'.is.alr |
| 13b9e0 | 65 61 64 79 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 2c 20 68 61 76 69 6e 67 20 62 65 65 6e 20 73 | eady.on.the.stack,.having.been.s |
| 13ba00 | 61 76 65 64 20 61 74 20 60 65 76 2d 61 70 70 6c 69 63 61 74 69 6f 6e 27 2e 0a 0a 20 20 20 54 68 | aved.at.`ev-application'......Th |
| 13ba20 | 65 20 65 6e 74 72 69 65 73 20 61 74 20 60 65 76 2d 73 65 71 75 65 6e 63 65 27 20 61 6e 64 20 60 | e.entries.at.`ev-sequence'.and.` |
| 13ba40 | 65 76 2d 73 65 71 75 65 6e 63 65 2d 63 6f 6e 74 69 6e 75 65 27 20 66 6f 72 6d 20 61 20 6c 6f 6f | ev-sequence-continue'.form.a.loo |
| 13ba60 | 70 0a 74 68 61 74 20 73 75 63 63 65 73 73 69 76 65 6c 79 20 65 76 61 6c 75 61 74 65 73 20 65 61 | p.that.successively.evaluates.ea |
| 13ba80 | 63 68 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 61 20 73 65 71 75 65 6e 63 65 2e 20 20 54 68 | ch.expression.in.a.sequence...Th |
| 13baa0 | 65 20 6c 69 73 74 20 6f 66 0a 75 6e 65 76 61 6c 75 61 74 65 64 20 65 78 70 72 65 73 73 69 6f 6e | e.list.of.unevaluated.expression |
| 13bac0 | 73 20 69 73 20 6b 65 70 74 20 69 6e 20 60 75 6e 65 76 27 2e 20 20 42 65 66 6f 72 65 20 65 76 61 | s.is.kept.in.`unev'...Before.eva |
| 13bae0 | 6c 75 61 74 69 6e 67 20 65 61 63 68 0a 65 78 70 72 65 73 73 69 6f 6e 2c 20 77 65 20 63 68 65 63 | luating.each.expression,.we.chec |
| 13bb00 | 6b 20 74 6f 20 73 65 65 20 69 66 20 74 68 65 72 65 20 61 72 65 20 61 64 64 69 74 69 6f 6e 61 6c | k.to.see.if.there.are.additional |
| 13bb20 | 20 65 78 70 72 65 73 73 69 6f 6e 73 20 74 6f 20 62 65 0a 65 76 61 6c 75 61 74 65 64 20 69 6e 20 | .expressions.to.be.evaluated.in. |
| 13bb40 | 74 68 65 20 73 65 71 75 65 6e 63 65 2e 20 20 49 66 20 73 6f 2c 20 77 65 20 73 61 76 65 20 74 68 | the.sequence...If.so,.we.save.th |
| 13bb60 | 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 75 6e 65 76 61 6c 75 61 74 65 64 0a 65 78 70 72 65 73 | e.rest.of.the.unevaluated.expres |
| 13bb80 | 73 69 6f 6e 73 20 28 68 65 6c 64 20 69 6e 20 60 75 6e 65 76 27 29 20 61 6e 64 20 74 68 65 20 65 | sions.(held.in.`unev').and.the.e |
| 13bba0 | 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 77 68 69 63 68 20 74 68 65 73 65 20 6d 75 73 74 20 62 | nvironment.in.which.these.must.b |
| 13bbc0 | 65 0a 65 76 61 6c 75 61 74 65 64 20 28 68 65 6c 64 20 69 6e 20 60 65 6e 76 27 29 20 61 6e 64 20 | e.evaluated.(held.in.`env').and. |
| 13bbe0 | 63 61 6c 6c 20 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 20 74 6f 20 65 76 61 6c 75 61 74 65 | call.`eval-dispatch'.to.evaluate |
| 13bc00 | 20 74 68 65 0a 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 54 68 65 20 74 77 6f 20 73 61 76 65 64 20 | .the.expression...The.two.saved. |
| 13bc20 | 72 65 67 69 73 74 65 72 73 20 61 72 65 20 72 65 73 74 6f 72 65 64 20 75 70 6f 6e 20 74 68 65 20 | registers.are.restored.upon.the. |
| 13bc40 | 72 65 74 75 72 6e 20 66 72 6f 6d 0a 74 68 69 73 20 65 76 61 6c 75 61 74 69 6f 6e 2c 20 61 74 20 | return.from.this.evaluation,.at. |
| 13bc60 | 60 65 76 2d 73 65 71 75 65 6e 63 65 2d 63 6f 6e 74 69 6e 75 65 27 2e 0a 0a 20 20 20 54 68 65 20 | `ev-sequence-continue'......The. |
| 13bc80 | 66 69 6e 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 | final.expression.in.the.sequence |
| 13bca0 | 20 69 73 20 68 61 6e 64 6c 65 64 20 64 69 66 66 65 72 65 6e 74 6c 79 2c 20 61 74 20 74 68 65 0a | .is.handled.differently,.at.the. |
| 13bcc0 | 65 6e 74 72 79 20 70 6f 69 6e 74 20 60 65 76 2d 73 65 71 75 65 6e 63 65 2d 6c 61 73 74 2d 65 78 | entry.point.`ev-sequence-last-ex |
| 13bce0 | 70 27 2e 20 20 53 69 6e 63 65 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 6d 6f 72 65 0a 65 78 70 | p'...Since.there.are.no.more.exp |
| 13bd00 | 72 65 73 73 69 6f 6e 73 20 74 6f 20 62 65 20 65 76 61 6c 75 61 74 65 64 20 61 66 74 65 72 20 74 | ressions.to.be.evaluated.after.t |
| 13bd20 | 68 69 73 20 6f 6e 65 2c 20 77 65 20 6e 65 65 64 20 6e 6f 74 20 73 61 76 65 20 60 75 6e 65 76 27 | his.one,.we.need.not.save.`unev' |
| 13bd40 | 20 6f 72 0a 60 65 6e 76 27 20 62 65 66 6f 72 65 20 67 6f 69 6e 67 20 74 6f 20 60 65 76 61 6c 2d | .or.`env'.before.going.to.`eval- |
| 13bd60 | 64 69 73 70 61 74 63 68 27 2e 20 20 54 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 77 68 6f | dispatch'...The.value.of.the.who |
| 13bd80 | 6c 65 20 73 65 71 75 65 6e 63 65 0a 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 | le.sequence.is.the.value.of.the. |
| 13bda0 | 6c 61 73 74 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 73 6f 20 61 66 74 65 72 20 74 68 65 20 65 76 | last.expression,.so.after.the.ev |
| 13bdc0 | 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 0a 6c 61 73 74 20 65 78 70 72 65 73 73 69 6f 6e 20 | aluation.of.the.last.expression. |
| 13bde0 | 74 68 65 72 65 20 69 73 20 6e 6f 74 68 69 6e 67 20 6c 65 66 74 20 74 6f 20 64 6f 20 65 78 63 65 | there.is.nothing.left.to.do.exce |
| 13be00 | 70 74 20 63 6f 6e 74 69 6e 75 65 20 61 74 20 74 68 65 0a 65 6e 74 72 79 20 70 6f 69 6e 74 20 63 | pt.continue.at.the.entry.point.c |
| 13be20 | 75 72 72 65 6e 74 6c 79 20 68 65 6c 64 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 28 77 68 69 63 | urrently.held.on.the.stack.(whic |
| 13be40 | 68 20 77 61 73 20 73 61 76 65 64 20 62 79 0a 60 65 76 2d 61 70 70 6c 69 63 61 74 69 6f 6e 27 20 | h.was.saved.by.`ev-application'. |
| 13be60 | 6f 72 20 60 65 76 2d 62 65 67 69 6e 27 2e 29 20 20 52 61 74 68 65 72 20 74 68 61 6e 20 73 65 74 | or.`ev-begin'.)..Rather.than.set |
| 13be80 | 74 69 6e 67 20 75 70 20 60 63 6f 6e 74 69 6e 75 65 27 20 74 6f 0a 61 72 72 61 6e 67 65 20 66 6f | ting.up.`continue'.to.arrange.fo |
| 13bea0 | 72 20 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 20 74 6f 20 72 65 74 75 72 6e 20 68 65 72 65 | r.`eval-dispatch'.to.return.here |
| 13bec0 | 20 61 6e 64 20 74 68 65 6e 20 72 65 73 74 6f 72 69 6e 67 0a 60 63 6f 6e 74 69 6e 75 65 27 20 66 | .and.then.restoring.`continue'.f |
| 13bee0 | 72 6f 6d 20 74 68 65 20 73 74 61 63 6b 20 61 6e 64 20 63 6f 6e 74 69 6e 75 69 6e 67 20 61 74 20 | rom.the.stack.and.continuing.at. |
| 13bf00 | 74 68 61 74 20 65 6e 74 72 79 20 70 6f 69 6e 74 2c 20 77 65 0a 72 65 73 74 6f 72 65 20 60 63 6f | that.entry.point,.we.restore.`co |
| 13bf20 | 6e 74 69 6e 75 65 27 20 66 72 6f 6d 20 74 68 65 20 73 74 61 63 6b 20 62 65 66 6f 72 65 20 67 6f | ntinue'.from.the.stack.before.go |
| 13bf40 | 69 6e 67 20 74 6f 20 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 2c 20 73 6f 0a 74 68 61 74 20 | ing.to.`eval-dispatch',.so.that. |
| 13bf60 | 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 61 74 | `eval-dispatch'.will.continue.at |
| 13bf80 | 20 74 68 61 74 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 61 66 74 65 72 20 65 76 61 6c 75 61 74 69 | .that.entry.point.after.evaluati |
| 13bfa0 | 6e 67 0a 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 0a 20 20 20 20 20 65 76 2d 73 65 71 75 | ng.the.expression........ev-sequ |
| 13bfc0 | 65 6e 63 65 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 78 70 20 28 6f 70 20 66 69 72 73 | ence........(assign.exp.(op.firs |
| 13bfe0 | 74 2d 65 78 70 29 20 28 72 65 67 20 75 6e 65 76 29 29 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 | t-exp).(reg.unev))........(test. |
| 13c000 | 28 6f 70 20 6c 61 73 74 2d 65 78 70 3f 29 20 28 72 65 67 20 75 6e 65 76 29 29 0a 20 20 20 20 20 | (op.last-exp?).(reg.unev))...... |
| 13c020 | 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d 73 65 71 75 65 6e 63 65 2d 6c 61 73 | ..(branch.(label.ev-sequence-las |
| 13c040 | 74 2d 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 75 6e 65 76 29 0a 20 20 20 20 20 | t-exp))........(save.unev)...... |
| 13c060 | 20 20 28 73 61 76 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 | ..(save.env)........(assign.cont |
| 13c080 | 69 6e 75 65 20 28 6c 61 62 65 6c 20 65 76 2d 73 65 71 75 65 6e 63 65 2d 63 6f 6e 74 69 6e 75 65 | inue.(label.ev-sequence-continue |
| 13c0a0 | 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 76 61 6c 2d 64 69 73 70 | ))........(goto.(label.eval-disp |
| 13c0c0 | 61 74 63 68 29 29 0a 20 20 20 20 20 65 76 2d 73 65 71 75 65 6e 63 65 2d 63 6f 6e 74 69 6e 75 65 | atch))......ev-sequence-continue |
| 13c0e0 | 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 72 65 | ........(restore.env)........(re |
| 13c100 | 73 74 6f 72 65 20 75 6e 65 76 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 75 6e 65 76 20 | store.unev)........(assign.unev. |
| 13c120 | 28 6f 70 20 72 65 73 74 2d 65 78 70 73 29 20 28 72 65 67 20 75 6e 65 76 29 29 0a 20 20 20 20 20 | (op.rest-exps).(reg.unev))...... |
| 13c140 | 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 76 2d 73 65 71 75 65 6e 63 65 29 29 0a 20 20 20 | ..(goto.(label.ev-sequence)).... |
| 13c160 | 20 20 65 76 2d 73 65 71 75 65 6e 63 65 2d 6c 61 73 74 2d 65 78 70 0a 20 20 20 20 20 20 20 28 72 | ..ev-sequence-last-exp........(r |
| 13c180 | 65 73 74 6f 72 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c | estore.continue)........(goto.(l |
| 13c1a0 | 61 62 65 6c 20 65 76 61 6c 2d 64 69 73 70 61 74 63 68 29 29 0a 0a 54 61 69 6c 20 72 65 63 75 72 | abel.eval-dispatch))..Tail.recur |
| 13c1c0 | 73 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 49 6e 20 2a 4e 6f 74 65 20 43 68 | sion.................In.*Note.Ch |
| 13c1e0 | 61 70 74 65 72 20 31 3a 3a 20 77 65 20 73 61 69 64 20 74 68 61 74 20 74 68 65 20 70 72 6f 63 65 | apter.1::.we.said.that.the.proce |
| 13c200 | 73 73 20 64 65 73 63 72 69 62 65 64 20 62 79 20 61 20 70 72 6f 63 65 64 75 72 65 0a 73 75 63 68 | ss.described.by.a.procedure.such |
| 13c220 | 20 61 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 71 72 74 2d 69 74 65 72 20 67 75 65 | .as.......(define.(sqrt-iter.gue |
| 13c240 | 73 73 20 78 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 67 6f 6f 64 2d 65 6e 6f 75 67 68 3f 20 67 | ss.x)........(if.(good-enough?.g |
| 13c260 | 75 65 73 73 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 67 75 65 73 73 0a 20 20 20 20 20 20 20 | uess.x)............guess........ |
| 13c280 | 20 20 20 20 28 73 71 72 74 2d 69 74 65 72 20 28 69 6d 70 72 6f 76 65 20 67 75 65 73 73 20 78 29 | ....(sqrt-iter.(improve.guess.x) |
| 13c2a0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 78 29 29 29 0a 0a 69 73 20 | .......................x)))..is. |
| 13c2c0 | 61 6e 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 2e 20 20 45 76 65 6e 20 74 68 6f 75 | an.iterative.process...Even.thou |
| 13c2e0 | 67 68 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 73 79 6e 74 61 63 74 69 63 61 6c 6c | gh.the.procedure.is.syntacticall |
| 13c300 | 79 0a 72 65 63 75 72 73 69 76 65 20 28 64 65 66 69 6e 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 | y.recursive.(defined.in.terms.of |
| 13c320 | 20 69 74 73 65 6c 66 29 2c 20 69 74 20 69 73 20 6e 6f 74 20 6c 6f 67 69 63 61 6c 6c 79 20 6e 65 | .itself),.it.is.not.logically.ne |
| 13c340 | 63 65 73 73 61 72 79 0a 66 6f 72 20 61 6e 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 73 61 76 65 | cessary.for.an.evaluator.to.save |
| 13c360 | 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 20 70 61 73 73 69 6e 67 20 66 72 6f 6d 20 6f 6e 65 | .information.in.passing.from.one |
| 13c380 | 20 63 61 6c 6c 20 74 6f 0a 60 73 71 72 74 2d 69 74 65 72 27 20 74 6f 20 74 68 65 20 6e 65 78 74 | .call.to.`sqrt-iter'.to.the.next |
| 13c3a0 | 2e 28 31 29 20 41 6e 20 65 76 61 6c 75 61 74 6f 72 20 74 68 61 74 20 63 61 6e 20 65 78 65 63 75 | .(1).An.evaluator.that.can.execu |
| 13c3c0 | 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 0a 73 75 63 68 20 61 73 20 60 73 71 72 74 2d 69 74 65 | te.a.procedure.such.as.`sqrt-ite |
| 13c3e0 | 72 27 20 77 69 74 68 6f 75 74 20 72 65 71 75 69 72 69 6e 67 20 69 6e 63 72 65 61 73 69 6e 67 20 | r'.without.requiring.increasing. |
| 13c400 | 73 74 6f 72 61 67 65 20 61 73 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 63 6f 6e 74 69 6e 75 | storage.as.the.procedure.continu |
| 13c420 | 65 73 20 74 6f 20 63 61 6c 6c 20 69 74 73 65 6c 66 20 69 73 20 63 61 6c 6c 65 64 20 61 20 22 74 | es.to.call.itself.is.called.a."t |
| 13c440 | 61 69 6c 2d 72 65 63 75 72 73 69 76 65 22 0a 65 76 61 6c 75 61 74 6f 72 2e 20 20 54 68 65 20 6d | ail-recursive".evaluator...The.m |
| 13c460 | 65 74 61 63 69 72 63 75 6c 61 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 | etacircular.implementation.of.th |
| 13c480 | 65 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 2a 4e 6f 74 65 0a 43 68 61 70 74 65 72 20 34 3a 3a | e.evaluator.in.*Note.Chapter.4:: |
| 13c4a0 | 20 64 6f 65 73 20 6e 6f 74 20 73 70 65 63 69 66 79 20 77 68 65 74 68 65 72 20 74 68 65 20 65 76 | .does.not.specify.whether.the.ev |
| 13c4c0 | 61 6c 75 61 74 6f 72 20 69 73 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 2c 0a 62 65 63 61 75 | aluator.is.tail-recursive,.becau |
| 13c4e0 | 73 65 20 74 68 61 74 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 68 65 72 69 74 73 20 69 74 73 20 6d | se.that.evaluator.inherits.its.m |
| 13c500 | 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 73 61 76 69 6e 67 20 73 74 61 74 65 20 66 72 6f 6d 20 74 | echanism.for.saving.state.from.t |
| 13c520 | 68 65 0a 75 6e 64 65 72 6c 79 69 6e 67 20 53 63 68 65 6d 65 2e 20 20 57 69 74 68 20 74 68 65 20 | he.underlying.Scheme...With.the. |
| 13c540 | 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 2c 20 68 6f 77 65 | explicit-control.evaluator,.howe |
| 13c560 | 76 65 72 2c 20 77 65 0a 63 61 6e 20 74 72 61 63 65 20 74 68 72 6f 75 67 68 20 74 68 65 20 65 76 | ver,.we.can.trace.through.the.ev |
| 13c580 | 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 74 6f 20 73 65 65 20 77 68 65 6e 20 70 72 6f | aluation.process.to.see.when.pro |
| 13c5a0 | 63 65 64 75 72 65 20 63 61 6c 6c 73 0a 63 61 75 73 65 20 61 20 6e 65 74 20 61 63 63 75 6d 75 6c | cedure.calls.cause.a.net.accumul |
| 13c5c0 | 61 74 69 6f 6e 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20 73 74 61 63 | ation.of.information.on.the.stac |
| 13c5e0 | 6b 2e 0a 0a 20 20 20 4f 75 72 20 65 76 61 6c 75 61 74 6f 72 20 69 73 20 74 61 69 6c 2d 72 65 63 | k......Our.evaluator.is.tail-rec |
| 13c600 | 75 72 73 69 76 65 2c 20 62 65 63 61 75 73 65 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 65 76 61 6c | ursive,.because.in.order.to.eval |
| 13c620 | 75 61 74 65 20 74 68 65 0a 66 69 6e 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 20 6f 66 20 61 20 73 | uate.the.final.expression.of.a.s |
| 13c640 | 65 71 75 65 6e 63 65 20 77 65 20 74 72 61 6e 73 66 65 72 20 64 69 72 65 63 74 6c 79 20 74 6f 20 | equence.we.transfer.directly.to. |
| 13c660 | 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 0a 77 69 74 68 6f 75 74 20 73 61 76 69 6e 67 20 61 | `eval-dispatch'.without.saving.a |
| 13c680 | 6e 79 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 2e 20 20 48 65 | ny.information.on.the.stack...He |
| 13c6a0 | 6e 63 65 2c 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 0a 66 69 6e 61 6c 20 65 78 70 72 65 73 | nce,.evaluating.the.final.expres |
| 13c6c0 | 73 69 6f 6e 20 69 6e 20 61 20 73 65 71 75 65 6e 63 65 2d 2d 65 76 65 6e 20 69 66 20 69 74 20 69 | sion.in.a.sequence--even.if.it.i |
| 13c6e0 | 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 20 28 61 73 20 69 6e 0a 60 73 71 72 74 2d | s.a.procedure.call.(as.in.`sqrt- |
| 13c700 | 69 74 65 72 27 2c 20 77 68 65 72 65 20 74 68 65 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e | iter',.where.the.`if'.expression |
| 13c720 | 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 6c 61 73 74 20 65 78 70 72 65 73 73 69 6f 6e 20 69 | ,.which.is.the.last.expression.i |
| 13c740 | 6e 0a 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 2c 20 72 65 64 75 63 65 73 20 74 6f | n.the.procedure.body,.reduces.to |
| 13c760 | 20 61 20 63 61 6c 6c 20 74 6f 20 60 73 71 72 74 2d 69 74 65 72 27 29 2d 2d 77 69 6c 6c 20 6e 6f | .a.call.to.`sqrt-iter')--will.no |
| 13c780 | 74 20 63 61 75 73 65 0a 61 6e 79 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 74 6f 20 62 65 20 61 63 | t.cause.any.information.to.be.ac |
| 13c7a0 | 63 75 6d 75 6c 61 74 65 64 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 2e 28 32 29 0a 0a 20 20 20 49 | cumulated.on.the.stack.(2).....I |
| 13c7c0 | 66 20 77 65 20 64 69 64 20 6e 6f 74 20 74 68 69 6e 6b 20 74 6f 20 74 61 6b 65 20 61 64 76 61 6e | f.we.did.not.think.to.take.advan |
| 13c7e0 | 74 61 67 65 20 6f 66 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 69 74 20 77 61 73 0a 75 6e 6e | tage.of.the.fact.that.it.was.unn |
| 13c800 | 65 63 65 73 73 61 72 79 20 74 6f 20 73 61 76 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 20 | ecessary.to.save.information.in. |
| 13c820 | 74 68 69 73 20 63 61 73 65 2c 20 77 65 20 6d 69 67 68 74 20 68 61 76 65 20 69 6d 70 6c 65 6d 65 | this.case,.we.might.have.impleme |
| 13c840 | 6e 74 65 64 0a 60 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 27 20 62 79 20 74 72 65 61 74 69 6e 67 | nted.`eval-sequence'.by.treating |
| 13c860 | 20 61 6c 6c 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 61 20 73 65 71 75 65 6e | .all.the.expressions.in.a.sequen |
| 13c880 | 63 65 20 69 6e 20 74 68 65 0a 73 61 6d 65 20 77 61 79 2d 2d 73 61 76 69 6e 67 20 74 68 65 20 72 | ce.in.the.same.way--saving.the.r |
| 13c8a0 | 65 67 69 73 74 65 72 73 2c 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 | egisters,.evaluating.the.express |
| 13c8c0 | 69 6f 6e 2c 20 72 65 74 75 72 6e 69 6e 67 20 74 6f 0a 72 65 73 74 6f 72 65 20 74 68 65 20 72 65 | ion,.returning.to.restore.the.re |
| 13c8e0 | 67 69 73 74 65 72 73 2c 20 61 6e 64 20 72 65 70 65 61 74 69 6e 67 20 74 68 69 73 20 75 6e 74 69 | gisters,.and.repeating.this.unti |
| 13c900 | 6c 20 61 6c 6c 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 73 0a 68 61 76 65 20 62 65 65 6e 20 | l.all.the.expressions.have.been. |
| 13c920 | 65 76 61 6c 75 61 74 65 64 3a 28 33 29 0a 0a 20 20 20 20 20 65 76 2d 73 65 71 75 65 6e 63 65 0a | evaluated:(3).......ev-sequence. |
| 13c940 | 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 6e 6f 2d 6d 6f 72 65 2d 65 78 70 73 3f 29 20 | .......(test.(op.no-more-exps?). |
| 13c960 | 28 72 65 67 20 75 6e 65 76 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 | (reg.unev))........(branch.(labe |
| 13c980 | 6c 20 65 76 2d 73 65 71 75 65 6e 63 65 2d 65 6e 64 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 | l.ev-sequence-end))........(assi |
| 13c9a0 | 67 6e 20 65 78 70 20 28 6f 70 20 66 69 72 73 74 2d 65 78 70 29 20 28 72 65 67 20 75 6e 65 76 29 | gn.exp.(op.first-exp).(reg.unev) |
| 13c9c0 | 29 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 75 6e 65 76 29 0a 20 20 20 20 20 20 20 28 73 61 76 | )........(save.unev)........(sav |
| 13c9e0 | 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 | e.env)........(assign.continue.( |
| 13ca00 | 6c 61 62 65 6c 20 65 76 2d 73 65 71 75 65 6e 63 65 2d 63 6f 6e 74 69 6e 75 65 29 29 0a 20 20 20 | label.ev-sequence-continue)).... |
| 13ca20 | 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 76 61 6c 2d 64 69 73 70 61 74 63 68 29 29 | ....(goto.(label.eval-dispatch)) |
| 13ca40 | 0a 20 20 20 20 20 65 76 2d 73 65 71 75 65 6e 63 65 2d 63 6f 6e 74 69 6e 75 65 0a 20 20 20 20 20 | ......ev-sequence-continue...... |
| 13ca60 | 20 20 28 72 65 73 74 6f 72 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 | ..(restore.env)........(restore. |
| 13ca80 | 75 6e 65 76 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 75 6e 65 76 20 28 6f 70 20 72 65 | unev)........(assign.unev.(op.re |
| 13caa0 | 73 74 2d 65 78 70 73 29 20 28 72 65 67 20 75 6e 65 76 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 | st-exps).(reg.unev))........(got |
| 13cac0 | 6f 20 28 6c 61 62 65 6c 20 65 76 2d 73 65 71 75 65 6e 63 65 29 29 0a 20 20 20 20 20 65 76 2d 73 | o.(label.ev-sequence))......ev-s |
| 13cae0 | 65 71 75 65 6e 63 65 2d 65 6e 64 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f 6e 74 | equence-end........(restore.cont |
| 13cb00 | 69 6e 75 65 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 | inue)........(goto.(reg.continue |
| 13cb20 | 29 29 0a 0a 20 20 20 54 68 69 73 20 6d 61 79 20 73 65 65 6d 20 6c 69 6b 65 20 61 20 6d 69 6e 6f | )).....This.may.seem.like.a.mino |
| 13cb40 | 72 20 63 68 61 6e 67 65 20 74 6f 20 6f 75 72 20 70 72 65 76 69 6f 75 73 20 63 6f 64 65 20 66 6f | r.change.to.our.previous.code.fo |
| 13cb60 | 72 0a 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 61 20 73 65 71 75 65 6e 63 65 3a 20 54 68 65 20 | r.evaluation.of.a.sequence:.The. |
| 13cb80 | 6f 6e 6c 79 20 64 69 66 66 65 72 65 6e 63 65 20 69 73 20 74 68 61 74 20 77 65 20 67 6f 20 74 68 | only.difference.is.that.we.go.th |
| 13cba0 | 72 6f 75 67 68 20 74 68 65 0a 73 61 76 65 2d 72 65 73 74 6f 72 65 20 63 79 63 6c 65 20 66 6f 72 | rough.the.save-restore.cycle.for |
| 13cbc0 | 20 74 68 65 20 6c 61 73 74 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 61 20 73 65 71 75 65 6e | .the.last.expression.in.a.sequen |
| 13cbe0 | 63 65 20 61 73 20 77 65 6c 6c 20 61 73 20 66 6f 72 0a 74 68 65 20 6f 74 68 65 72 73 2e 20 20 54 | ce.as.well.as.for.the.others...T |
| 13cc00 | 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 77 69 6c 6c 20 73 74 69 6c 6c 20 67 69 76 65 20 74 | he.interpreter.will.still.give.t |
| 13cc20 | 68 65 20 73 61 6d 65 20 76 61 6c 75 65 20 66 6f 72 20 61 6e 79 0a 65 78 70 72 65 73 73 69 6f 6e | he.same.value.for.any.expression |
| 13cc40 | 2e 20 20 42 75 74 20 74 68 69 73 20 63 68 61 6e 67 65 20 69 73 20 66 61 74 61 6c 20 74 6f 20 74 | ...But.this.change.is.fatal.to.t |
| 13cc60 | 68 65 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e | he.tail-recursive.implementation |
| 13cc80 | 2c 20 62 65 63 61 75 73 65 20 77 65 20 6d 75 73 74 20 6e 6f 77 20 72 65 74 75 72 6e 20 61 66 74 | ,.because.we.must.now.return.aft |
| 13cca0 | 65 72 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 66 69 6e 61 6c 0a 65 78 70 72 65 73 73 69 | er.evaluating.the.final.expressi |
| 13ccc0 | 6f 6e 20 69 6e 20 61 20 73 65 71 75 65 6e 63 65 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 75 6e 64 | on.in.a.sequence.in.order.to.und |
| 13cce0 | 6f 20 74 68 65 20 28 75 73 65 6c 65 73 73 29 20 72 65 67 69 73 74 65 72 20 73 61 76 65 73 2e 0a | o.the.(useless).register.saves.. |
| 13cd00 | 54 68 65 73 65 20 65 78 74 72 61 20 73 61 76 65 73 20 77 69 6c 6c 20 61 63 63 75 6d 75 6c 61 74 | These.extra.saves.will.accumulat |
| 13cd20 | 65 20 64 75 72 69 6e 67 20 61 20 6e 65 73 74 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c | e.during.a.nest.of.procedure.cal |
| 13cd40 | 6c 73 2e 0a 43 6f 6e 73 65 71 75 65 6e 74 6c 79 2c 20 70 72 6f 63 65 73 73 65 73 20 73 75 63 68 | ls..Consequently,.processes.such |
| 13cd60 | 20 61 73 20 60 73 71 72 74 2d 69 74 65 72 27 20 77 69 6c 6c 20 72 65 71 75 69 72 65 20 73 70 61 | .as.`sqrt-iter'.will.require.spa |
| 13cd80 | 63 65 0a 70 72 6f 70 6f 72 74 69 6f 6e 61 6c 20 74 6f 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 | ce.proportional.to.the.number.of |
| 13cda0 | 20 69 74 65 72 61 74 69 6f 6e 73 20 72 61 74 68 65 72 20 74 68 61 6e 20 72 65 71 75 69 72 69 6e | .iterations.rather.than.requirin |
| 13cdc0 | 67 20 63 6f 6e 73 74 61 6e 74 0a 73 70 61 63 65 2e 20 20 54 68 69 73 20 64 69 66 66 65 72 65 6e | g.constant.space...This.differen |
| 13cde0 | 63 65 20 63 61 6e 20 62 65 20 73 69 67 6e 69 66 69 63 61 6e 74 2e 20 20 46 6f 72 20 65 78 61 6d | ce.can.be.significant...For.exam |
| 13ce00 | 70 6c 65 2c 20 77 69 74 68 20 74 61 69 6c 0a 72 65 63 75 72 73 69 6f 6e 2c 20 61 6e 20 69 6e 66 | ple,.with.tail.recursion,.an.inf |
| 13ce20 | 69 6e 69 74 65 20 6c 6f 6f 70 20 63 61 6e 20 62 65 20 65 78 70 72 65 73 73 65 64 20 75 73 69 6e | inite.loop.can.be.expressed.usin |
| 13ce40 | 67 20 6f 6e 6c 79 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 2d 63 61 6c 6c 20 6d 65 63 68 61 6e | g.only.the.procedure-call.mechan |
| 13ce60 | 69 73 6d 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 75 6e 74 20 6e 29 0a 20 20 20 | ism:.......(define.(count.n).... |
| 13ce80 | 20 20 20 20 28 6e 65 77 6c 69 6e 65 29 0a 20 20 20 20 20 20 20 28 64 69 73 70 6c 61 79 20 6e 29 | ....(newline)........(display.n) |
| 13cea0 | 0a 20 20 20 20 20 20 20 28 63 6f 75 6e 74 20 28 2b 20 6e 20 31 29 29 29 0a 0a 20 20 20 57 69 74 | ........(count.(+.n.1))).....Wit |
| 13cec0 | 68 6f 75 74 20 74 61 69 6c 20 72 65 63 75 72 73 69 6f 6e 2c 20 73 75 63 68 20 61 20 70 72 6f 63 | hout.tail.recursion,.such.a.proc |
| 13cee0 | 65 64 75 72 65 20 77 6f 75 6c 64 20 65 76 65 6e 74 75 61 6c 6c 79 20 72 75 6e 20 6f 75 74 20 6f | edure.would.eventually.run.out.o |
| 13cf00 | 66 0a 73 74 61 63 6b 20 73 70 61 63 65 2c 20 61 6e 64 20 65 78 70 72 65 73 73 69 6e 67 20 61 20 | f.stack.space,.and.expressing.a. |
| 13cf20 | 74 72 75 65 20 69 74 65 72 61 74 69 6f 6e 20 77 6f 75 6c 64 20 72 65 71 75 69 72 65 20 73 6f 6d | true.iteration.would.require.som |
| 13cf40 | 65 20 63 6f 6e 74 72 6f 6c 0a 6d 65 63 68 61 6e 69 73 6d 20 6f 74 68 65 72 20 74 68 61 6e 20 70 | e.control.mechanism.other.than.p |
| 13cf60 | 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f | rocedure.call......----------.Fo |
| 13cf80 | 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 57 65 20 73 61 | otnotes.----------.....(1).We.sa |
| 13cfa0 | 77 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 31 3a 3a 20 68 6f 77 20 74 6f 20 | w.in.section.*Note.5-1::.how.to. |
| 13cfc0 | 69 6d 70 6c 65 6d 65 6e 74 20 73 75 63 68 20 61 20 70 72 6f 63 65 73 73 0a 77 69 74 68 20 61 20 | implement.such.a.process.with.a. |
| 13cfe0 | 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 68 61 64 20 6e 6f 20 73 74 61 | register.machine.that.had.no.sta |
| 13d000 | 63 6b 3b 20 74 68 65 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 70 72 6f 63 65 73 73 20 77 61 73 | ck;.the.state.of.the.process.was |
| 13d020 | 0a 73 74 6f 72 65 64 20 69 6e 20 61 20 66 69 78 65 64 20 73 65 74 20 6f 66 20 72 65 67 69 73 74 | .stored.in.a.fixed.set.of.regist |
| 13d040 | 65 72 73 2e 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e | ers......(2).This.implementation |
| 13d060 | 20 6f 66 20 74 61 69 6c 20 72 65 63 75 72 73 69 6f 6e 20 69 6e 20 60 65 76 2d 73 65 71 75 65 6e | .of.tail.recursion.in.`ev-sequen |
| 13d080 | 63 65 27 20 69 73 20 6f 6e 65 0a 76 61 72 69 65 74 79 20 6f 66 20 61 20 77 65 6c 6c 2d 6b 6e 6f | ce'.is.one.variety.of.a.well-kno |
| 13d0a0 | 77 6e 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 74 65 63 68 6e 69 71 75 65 20 75 73 65 64 20 62 | wn.optimization.technique.used.b |
| 13d0c0 | 79 20 6d 61 6e 79 20 63 6f 6d 70 69 6c 65 72 73 2e 0a 49 6e 20 63 6f 6d 70 69 6c 69 6e 67 20 61 | y.many.compilers..In.compiling.a |
| 13d0e0 | 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 65 6e 64 73 20 77 69 74 68 20 61 20 70 72 6f 63 | .procedure.that.ends.with.a.proc |
| 13d100 | 65 64 75 72 65 20 63 61 6c 6c 2c 20 6f 6e 65 20 63 61 6e 0a 72 65 70 6c 61 63 65 20 74 68 65 20 | edure.call,.one.can.replace.the. |
| 13d120 | 63 61 6c 6c 20 62 79 20 61 20 6a 75 6d 70 20 74 6f 20 74 68 65 20 63 61 6c 6c 65 64 20 70 72 6f | call.by.a.jump.to.the.called.pro |
| 13d140 | 63 65 64 75 72 65 27 73 20 65 6e 74 72 79 20 70 6f 69 6e 74 2e 0a 42 75 69 6c 64 69 6e 67 20 74 | cedure's.entry.point..Building.t |
| 13d160 | 68 69 73 20 73 74 72 61 74 65 67 79 20 69 6e 74 6f 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 | his.strategy.into.the.interprete |
| 13d180 | 72 2c 20 61 73 20 77 65 20 68 61 76 65 20 64 6f 6e 65 20 69 6e 20 74 68 69 73 0a 73 65 63 74 69 | r,.as.we.have.done.in.this.secti |
| 13d1a0 | 6f 6e 2c 20 70 72 6f 76 69 64 65 73 20 74 68 65 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 75 6e | on,.provides.the.optimization.un |
| 13d1c0 | 69 66 6f 72 6d 6c 79 20 74 68 72 6f 75 67 68 6f 75 74 20 74 68 65 20 6c 61 6e 67 75 61 67 65 2e | iformly.throughout.the.language. |
| 13d1e0 | 0a 0a 20 20 20 28 33 29 20 57 65 20 63 61 6e 20 64 65 66 69 6e 65 20 60 6e 6f 2d 6d 6f 72 65 2d | .....(3).We.can.define.`no-more- |
| 13d200 | 65 78 70 73 3f 27 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | exps?'.as.follows:.......(define |
| 13d220 | 20 28 6e 6f 2d 6d 6f 72 65 2d 65 78 70 73 3f 20 73 65 71 29 20 28 6e 75 6c 6c 3f 20 73 65 71 29 | .(no-more-exps?.seq).(null?.seq) |
| 13d240 | 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 34 | )....File:.sicp.info,..Node:.5-4 |
| 13d260 | 2d 33 2c 20 20 4e 65 78 74 3a 20 35 2d 34 2d 34 2c 20 20 50 72 65 76 3a 20 35 2d 34 2d 32 2c 20 | -3,..Next:.5-4-4,..Prev:.5-4-2,. |
| 13d280 | 20 55 70 3a 20 35 2d 34 0a 0a 35 2e 34 2e 33 20 43 6f 6e 64 69 74 69 6f 6e 61 6c 73 2c 20 41 73 | .Up:.5-4..5.4.3.Conditionals,.As |
| 13d2a0 | 73 69 67 6e 6d 65 6e 74 73 2c 20 61 6e 64 20 44 65 66 69 6e 69 74 69 6f 6e 73 0a 2d 2d 2d 2d 2d | signments,.and.Definitions.----- |
| 13d2c0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | -------------------------------- |
| 13d2e0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 41 73 20 77 69 74 68 20 74 68 65 20 6d 65 74 61 63 69 72 | -----------..As.with.the.metacir |
| 13d300 | 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 2c 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 73 20 61 | cular.evaluator,.special.forms.a |
| 13d320 | 72 65 20 68 61 6e 64 6c 65 64 20 62 79 0a 73 65 6c 65 63 74 69 76 65 6c 79 20 65 76 61 6c 75 61 | re.handled.by.selectively.evalua |
| 13d340 | 74 69 6e 67 20 66 72 61 67 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e | ting.fragments.of.the.expression |
| 13d360 | 2e 20 20 46 6f 72 20 61 6e 20 60 69 66 27 0a 65 78 70 72 65 73 73 69 6f 6e 2c 20 77 65 20 6d 75 | ...For.an.`if'.expression,.we.mu |
| 13d380 | 73 74 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 61 6e 64 20 64 65 | st.evaluate.the.predicate.and.de |
| 13d3a0 | 63 69 64 65 2c 20 62 61 73 65 64 20 6f 6e 20 74 68 65 0a 76 61 6c 75 65 20 6f 66 20 70 72 65 64 | cide,.based.on.the.value.of.pred |
| 13d3c0 | 69 63 61 74 65 2c 20 77 68 65 74 68 65 72 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 63 | icate,.whether.to.evaluate.the.c |
| 13d3e0 | 6f 6e 73 65 71 75 65 6e 74 20 6f 72 20 74 68 65 0a 61 6c 74 65 72 6e 61 74 69 76 65 2e 0a 0a 20 | onsequent.or.the.alternative.... |
| 13d400 | 20 20 42 65 66 6f 72 65 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 70 72 65 64 69 63 61 74 | ..Before.evaluating.the.predicat |
| 13d420 | 65 2c 20 77 65 20 73 61 76 65 20 74 68 65 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 | e,.we.save.the.`if'.expression.i |
| 13d440 | 74 73 65 6c 66 0a 73 6f 20 74 68 61 74 20 77 65 20 63 61 6e 20 6c 61 74 65 72 20 65 78 74 72 61 | tself.so.that.we.can.later.extra |
| 13d460 | 63 74 20 74 68 65 20 63 6f 6e 73 65 71 75 65 6e 74 20 6f 72 20 61 6c 74 65 72 6e 61 74 69 76 65 | ct.the.consequent.or.alternative |
| 13d480 | 2e 20 20 57 65 20 61 6c 73 6f 0a 73 61 76 65 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c | ...We.also.save.the.environment, |
| 13d4a0 | 20 77 68 69 63 68 20 77 65 20 77 69 6c 6c 20 6e 65 65 64 20 6c 61 74 65 72 20 69 6e 20 6f 72 64 | .which.we.will.need.later.in.ord |
| 13d4c0 | 65 72 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 0a 63 6f 6e 73 65 71 75 65 6e 74 20 6f 72 | er.to.evaluate.the.consequent.or |
| 13d4e0 | 20 74 68 65 20 61 6c 74 65 72 6e 61 74 69 76 65 2c 20 61 6e 64 20 77 65 20 73 61 76 65 20 60 63 | .the.alternative,.and.we.save.`c |
| 13d500 | 6f 6e 74 69 6e 75 65 27 2c 20 77 68 69 63 68 20 77 65 20 77 69 6c 6c 0a 6e 65 65 64 20 6c 61 74 | ontinue',.which.we.will.need.lat |
| 13d520 | 65 72 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 72 65 74 75 72 6e 20 74 6f 20 74 68 65 20 65 76 61 | er.in.order.to.return.to.the.eva |
| 13d540 | 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 0a 69 | luation.of.the.expression.that.i |
| 13d560 | 73 20 77 61 69 74 69 6e 67 20 66 6f 72 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 | s.waiting.for.the.value.of.the.` |
| 13d580 | 69 66 27 2e 0a 0a 20 20 20 20 20 65 76 2d 69 66 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 65 78 | if'........ev-if........(save.ex |
| 13d5a0 | 70 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 73 61 76 65 20 65 78 70 | p)....................;.save.exp |
| 13d5c0 | 72 65 73 73 69 6f 6e 20 66 6f 72 20 6c 61 74 65 72 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 65 | ression.for.later........(save.e |
| 13d5e0 | 6e 76 29 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 | nv)........(save.continue)...... |
| 13d600 | 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 65 76 2d 69 66 2d | ..(assign.continue.(label.ev-if- |
| 13d620 | 64 65 63 69 64 65 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 78 70 20 28 6f 70 20 | decide))........(assign.exp.(op. |
| 13d640 | 69 66 2d 70 72 65 64 69 63 61 74 65 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 | if-predicate).(reg.exp))........ |
| 13d660 | 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 76 61 6c 2d 64 69 73 70 61 74 63 68 29 29 20 20 3b 20 | (goto.(label.eval-dispatch))..;. |
| 13d680 | 65 76 61 6c 75 61 74 65 20 74 68 65 20 70 72 65 64 69 63 61 74 65 0a 0a 20 20 20 57 68 65 6e 20 | evaluate.the.predicate.....When. |
| 13d6a0 | 77 65 20 72 65 74 75 72 6e 20 66 72 6f 6d 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 70 72 | we.return.from.evaluating.the.pr |
| 13d6c0 | 65 64 69 63 61 74 65 2c 20 77 65 20 74 65 73 74 20 77 68 65 74 68 65 72 20 69 74 20 77 61 73 0a | edicate,.we.test.whether.it.was. |
| 13d6e0 | 74 72 75 65 20 6f 72 20 66 61 6c 73 65 20 61 6e 64 2c 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 | true.or.false.and,.depending.on. |
| 13d700 | 74 68 65 20 72 65 73 75 6c 74 2c 20 70 6c 61 63 65 20 65 69 74 68 65 72 20 74 68 65 20 63 6f 6e | the.result,.place.either.the.con |
| 13d720 | 73 65 71 75 65 6e 74 0a 6f 72 20 74 68 65 20 61 6c 74 65 72 6e 61 74 69 76 65 20 69 6e 20 60 65 | sequent.or.the.alternative.in.`e |
| 13d740 | 78 70 27 20 62 65 66 6f 72 65 20 67 6f 69 6e 67 20 74 6f 20 60 65 76 61 6c 2d 64 69 73 70 61 74 | xp'.before.going.to.`eval-dispat |
| 13d760 | 63 68 27 2e 20 20 4e 6f 74 69 63 65 0a 74 68 61 74 20 72 65 73 74 6f 72 69 6e 67 20 60 65 6e 76 | ch'...Notice.that.restoring.`env |
| 13d780 | 27 20 61 6e 64 20 60 63 6f 6e 74 69 6e 75 65 27 20 68 65 72 65 20 73 65 74 73 20 75 70 20 60 65 | '.and.`continue'.here.sets.up.`e |
| 13d7a0 | 76 61 6c 2d 64 69 73 70 61 74 63 68 27 20 74 6f 0a 68 61 76 65 20 74 68 65 20 63 6f 72 72 65 63 | val-dispatch'.to.have.the.correc |
| 13d7c0 | 74 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 6e 64 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20 61 74 | t.environment.and.to.continue.at |
| 13d7e0 | 20 74 68 65 20 72 69 67 68 74 20 70 6c 61 63 65 20 74 6f 0a 72 65 63 65 69 76 65 20 74 68 65 20 | .the.right.place.to.receive.the. |
| 13d800 | 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 0a 20 | value.of.the.`if'.expression.... |
| 13d820 | 20 20 20 20 65 76 2d 69 66 2d 64 65 63 69 64 65 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 | ....ev-if-decide........(restore |
| 13d840 | 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 65 6e 76 29 0a | .continue)........(restore.env). |
| 13d860 | 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 65 78 70 29 0a 20 20 20 20 20 20 20 28 74 65 73 | .......(restore.exp)........(tes |
| 13d880 | 74 20 28 6f 70 20 74 72 75 65 3f 29 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 28 | t.(op.true?).(reg.val))........( |
| 13d8a0 | 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 76 2d 69 66 2d 63 6f 6e 73 65 71 75 65 6e 74 29 29 | branch.(label.ev-if-consequent)) |
| 13d8c0 | 0a 0a 20 20 20 20 20 65 76 2d 69 66 2d 61 6c 74 65 72 6e 61 74 69 76 65 0a 20 20 20 20 20 20 20 | .......ev-if-alternative........ |
| 13d8e0 | 28 61 73 73 69 67 6e 20 65 78 70 20 28 6f 70 20 69 66 2d 61 6c 74 65 72 6e 61 74 69 76 65 29 20 | (assign.exp.(op.if-alternative). |
| 13d900 | 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 | (reg.exp))........(goto.(label.e |
| 13d920 | 76 61 6c 2d 64 69 73 70 61 74 63 68 29 29 0a 20 20 20 20 20 65 76 2d 69 66 2d 63 6f 6e 73 65 71 | val-dispatch))......ev-if-conseq |
| 13d940 | 75 65 6e 74 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 78 70 20 28 6f 70 20 69 66 2d 63 | uent........(assign.exp.(op.if-c |
| 13d960 | 6f 6e 73 65 71 75 65 6e 74 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 67 6f | onsequent).(reg.exp))........(go |
| 13d980 | 74 6f 20 28 6c 61 62 65 6c 20 65 76 61 6c 2d 64 69 73 70 61 74 63 68 29 29 0a 0a 41 73 73 69 67 | to.(label.eval-dispatch))..Assig |
| 13d9a0 | 6e 6d 65 6e 74 73 20 61 6e 64 20 64 65 66 69 6e 69 74 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e | nments.and.definitions.......... |
| 13d9c0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 73 73 69 67 6e 6d 65 6e 74 73 20 | ....................Assignments. |
| 13d9e0 | 61 72 65 20 68 61 6e 64 6c 65 64 20 62 79 20 60 65 76 2d 61 73 73 69 67 6e 6d 65 6e 74 27 2c 20 | are.handled.by.`ev-assignment',. |
| 13da00 | 77 68 69 63 68 20 69 73 20 72 65 61 63 68 65 64 20 66 72 6f 6d 0a 60 65 76 61 6c 2d 64 69 73 70 | which.is.reached.from.`eval-disp |
| 13da20 | 61 74 63 68 27 20 77 69 74 68 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 20 65 78 70 72 65 73 | atch'.with.the.assignment.expres |
| 13da40 | 73 69 6f 6e 20 69 6e 20 60 65 78 70 27 2e 20 20 54 68 65 20 63 6f 64 65 20 61 74 0a 60 65 76 2d | sion.in.`exp'...The.code.at.`ev- |
| 13da60 | 61 73 73 69 67 6e 6d 65 6e 74 27 20 66 69 72 73 74 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 | assignment'.first.evaluates.the. |
| 13da80 | 76 61 6c 75 65 20 70 61 72 74 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 61 6e 64 | value.part.of.the.expression.and |
| 13daa0 | 0a 74 68 65 6e 20 69 6e 73 74 61 6c 6c 73 20 74 68 65 20 6e 65 77 20 76 61 6c 75 65 20 69 6e 20 | .then.installs.the.new.value.in. |
| 13dac0 | 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 60 53 65 74 2d 76 61 72 69 61 62 6c 65 2d | the.environment...`Set-variable- |
| 13dae0 | 76 61 6c 75 65 21 27 0a 69 73 20 61 73 73 75 6d 65 64 20 74 6f 20 62 65 20 61 76 61 69 6c 61 62 | value!'.is.assumed.to.be.availab |
| 13db00 | 6c 65 20 61 73 20 61 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 | le.as.a.machine.operation....... |
| 13db20 | 20 65 76 2d 61 73 73 69 67 6e 6d 65 6e 74 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 75 6e | .ev-assignment........(assign.un |
| 13db40 | 65 76 20 28 6f 70 20 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 72 69 61 62 6c 65 29 20 28 72 65 67 | ev.(op.assignment-variable).(reg |
| 13db60 | 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 75 6e 65 76 29 20 20 20 20 20 20 20 | .exp))........(save.unev)....... |
| 13db80 | 20 20 20 20 20 20 20 20 20 20 20 20 3b 20 73 61 76 65 20 76 61 72 69 61 62 6c 65 20 66 6f 72 20 | ............;.save.variable.for. |
| 13dba0 | 6c 61 74 65 72 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 78 70 20 28 6f 70 20 61 73 73 | later........(assign.exp.(op.ass |
| 13dbc0 | 69 67 6e 6d 65 6e 74 2d 76 61 6c 75 65 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 | ignment-value).(reg.exp))....... |
| 13dbe0 | 20 28 73 61 76 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 | .(save.env)........(save.continu |
| 13dc00 | 65 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 | e)........(assign.continue.(labe |
| 13dc20 | 6c 20 65 76 2d 61 73 73 69 67 6e 6d 65 6e 74 2d 31 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f | l.ev-assignment-1))........(goto |
| 13dc40 | 20 28 6c 61 62 65 6c 20 65 76 61 6c 2d 64 69 73 70 61 74 63 68 29 29 20 20 3b 20 65 76 61 6c 75 | .(label.eval-dispatch))..;.evalu |
| 13dc60 | 61 74 65 20 74 68 65 20 61 73 73 69 67 6e 6d 65 6e 74 20 76 61 6c 75 65 0a 20 20 20 20 20 65 76 | ate.the.assignment.value......ev |
| 13dc80 | 2d 61 73 73 69 67 6e 6d 65 6e 74 2d 31 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f | -assignment-1........(restore.co |
| 13dca0 | 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 65 6e 76 29 0a 20 20 20 | ntinue)........(restore.env).... |
| 13dcc0 | 20 20 20 20 28 72 65 73 74 6f 72 65 20 75 6e 65 76 29 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f | ....(restore.unev)........(perfo |
| 13dce0 | 72 6d 0a 20 20 20 20 20 20 20 20 28 6f 70 20 73 65 74 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 | rm.........(op.set-variable-valu |
| 13dd00 | 65 21 29 20 28 72 65 67 20 75 6e 65 76 29 20 28 72 65 67 20 76 61 6c 29 20 28 72 65 67 20 65 6e | e!).(reg.unev).(reg.val).(reg.en |
| 13dd20 | 76 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 63 6f 6e 73 74 20 6f 6b | v))........(assign.val.(const.ok |
| 13dd40 | 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a | ))........(goto.(reg.continue)). |
| 13dd60 | 0a 20 20 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 68 61 6e 64 6c 65 64 20 69 6e 20 61 | ....Definitions.are.handled.in.a |
| 13dd80 | 20 73 69 6d 69 6c 61 72 20 77 61 79 3a 0a 0a 20 20 20 20 20 65 76 2d 64 65 66 69 6e 69 74 69 6f | .similar.way:.......ev-definitio |
| 13dda0 | 6e 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 75 6e 65 76 20 28 6f 70 20 64 65 66 69 6e 69 | n........(assign.unev.(op.defini |
| 13ddc0 | 74 69 6f 6e 2d 76 61 72 69 61 62 6c 65 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 | tion-variable).(reg.exp))....... |
| 13dde0 | 20 28 73 61 76 65 20 75 6e 65 76 29 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3b | .(save.unev)...................; |
| 13de00 | 20 73 61 76 65 20 76 61 72 69 61 62 6c 65 20 66 6f 72 20 6c 61 74 65 72 0a 20 20 20 20 20 20 20 | .save.variable.for.later........ |
| 13de20 | 28 61 73 73 69 67 6e 20 65 78 70 20 28 6f 70 20 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 6c 75 65 | (assign.exp.(op.definition-value |
| 13de40 | 29 20 28 72 65 67 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 28 73 61 76 65 20 65 6e 76 29 0a 20 | ).(reg.exp))........(save.env).. |
| 13de60 | 20 20 20 20 20 20 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 28 61 73 | ......(save.continue)........(as |
| 13de80 | 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 65 76 2d 64 65 66 69 6e 69 74 69 | sign.continue.(label.ev-definiti |
| 13dea0 | 6f 6e 2d 31 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 76 61 6c 2d | on-1))........(goto.(label.eval- |
| 13dec0 | 64 69 73 70 61 74 63 68 29 29 20 20 3b 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 64 65 66 69 6e | dispatch))..;.evaluate.the.defin |
| 13dee0 | 69 74 69 6f 6e 20 76 61 6c 75 65 0a 20 20 20 20 20 65 76 2d 64 65 66 69 6e 69 74 69 6f 6e 2d 31 | ition.value......ev-definition-1 |
| 13df00 | 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 | ........(restore.continue)...... |
| 13df20 | 20 20 28 72 65 73 74 6f 72 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 | ..(restore.env)........(restore. |
| 13df40 | 75 6e 65 76 29 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 28 6f | unev)........(perform.........(o |
| 13df60 | 70 20 64 65 66 69 6e 65 2d 76 61 72 69 61 62 6c 65 21 29 20 28 72 65 67 20 75 6e 65 76 29 20 28 | p.define-variable!).(reg.unev).( |
| 13df80 | 72 65 67 20 76 61 6c 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 | reg.val).(reg.env))........(assi |
| 13dfa0 | 67 6e 20 76 61 6c 20 28 63 6f 6e 73 74 20 6f 6b 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 | gn.val.(const.ok))........(goto. |
| 13dfc0 | 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 | (reg.continue)).......*Exercise. |
| 13dfe0 | 35 2e 32 33 3a 2a 20 45 78 74 65 6e 64 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 68 | 5.23:*.Extend.the.evaluator.to.h |
| 13e000 | 61 6e 64 6c 65 20 64 65 72 69 76 65 64 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 73 20 73 | andle.derived......expressions.s |
| 13e020 | 75 63 68 20 61 73 20 60 63 6f 6e 64 27 2c 20 60 6c 65 74 27 2c 20 61 6e 64 20 73 6f 20 6f 6e 20 | uch.as.`cond',.`let',.and.so.on. |
| 13e040 | 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 34 2d 31 2d 32 3a 3a 29 2e 20 20 59 | (section.*Note......4-1-2::)...Y |
| 13e060 | 6f 75 20 6d 61 79 20 22 63 68 65 61 74 22 20 61 6e 64 20 61 73 73 75 6d 65 20 74 68 61 74 20 74 | ou.may."cheat".and.assume.that.t |
| 13e080 | 68 65 20 73 79 6e 74 61 78 20 74 72 61 6e 73 66 6f 72 6d 65 72 73 0a 20 20 20 20 20 73 75 63 68 | he.syntax.transformers......such |
| 13e0a0 | 20 61 73 20 60 63 6f 6e 64 2d 3e 69 66 27 20 61 72 65 20 61 76 61 69 6c 61 62 6c 65 20 61 73 20 | .as.`cond->if'.are.available.as. |
| 13e0c0 | 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 28 31 29 0a 0a 20 20 20 20 20 2a 45 78 | machine.operations.(1).......*Ex |
| 13e0e0 | 65 72 63 69 73 65 20 35 2e 32 34 3a 2a 20 49 6d 70 6c 65 6d 65 6e 74 20 60 63 6f 6e 64 27 20 61 | ercise.5.24:*.Implement.`cond'.a |
| 13e100 | 73 20 61 20 6e 65 77 20 62 61 73 69 63 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 0a 20 20 20 20 20 | s.a.new.basic.special.form...... |
| 13e120 | 77 69 74 68 6f 75 74 20 72 65 64 75 63 69 6e 67 20 69 74 20 74 6f 20 60 69 66 27 2e 20 20 59 6f | without.reducing.it.to.`if'...Yo |
| 13e140 | 75 20 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 61 20 6c 6f 6f 70 0a | u.will.have.to.construct.a.loop. |
| 13e160 | 20 20 20 20 20 74 68 61 74 20 74 65 73 74 73 20 74 68 65 20 70 72 65 64 69 63 61 74 65 73 20 6f | .....that.tests.the.predicates.o |
| 13e180 | 66 20 73 75 63 63 65 73 73 69 76 65 20 60 63 6f 6e 64 27 20 63 6c 61 75 73 65 73 20 75 6e 74 69 | f.successive.`cond'.clauses.unti |
| 13e1a0 | 6c 20 79 6f 75 0a 20 20 20 20 20 66 69 6e 64 20 6f 6e 65 20 74 68 61 74 20 69 73 20 74 72 75 65 | l.you......find.one.that.is.true |
| 13e1c0 | 2c 20 61 6e 64 20 74 68 65 6e 20 75 73 65 20 60 65 76 2d 73 65 71 75 65 6e 63 65 27 20 74 6f 20 | ,.and.then.use.`ev-sequence'.to. |
| 13e1e0 | 65 76 61 6c 75 61 74 65 20 74 68 65 0a 20 20 20 20 20 61 63 74 69 6f 6e 73 20 6f 66 20 74 68 65 | evaluate.the......actions.of.the |
| 13e200 | 20 63 6c 61 75 73 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 32 35 3a 2a 20 | .clause........*Exercise.5.25:*. |
| 13e220 | 4d 6f 64 69 66 79 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 73 6f 20 74 68 61 74 20 69 74 20 | Modify.the.evaluator.so.that.it. |
| 13e240 | 75 73 65 73 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6f | uses.normal-order......evaluatio |
| 13e260 | 6e 2c 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 6c 61 7a 79 20 65 76 61 6c 75 61 74 6f 72 20 6f | n,.based.on.the.lazy.evaluator.o |
| 13e280 | 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 32 3a 3a 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d | f.section.*Note.4-2::......----- |
| 13e2a0 | 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 | -----.Footnotes.----------.....( |
| 13e2c0 | 31 29 20 54 68 69 73 20 69 73 6e 27 74 20 72 65 61 6c 6c 79 20 63 68 65 61 74 69 6e 67 2e 20 20 | 1).This.isn't.really.cheating... |
| 13e2e0 | 49 6e 20 61 6e 20 61 63 74 75 61 6c 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 62 75 69 6c | In.an.actual.implementation.buil |
| 13e300 | 74 0a 66 72 6f 6d 20 73 63 72 61 74 63 68 2c 20 77 65 20 77 6f 75 6c 64 20 75 73 65 20 6f 75 72 | t.from.scratch,.we.would.use.our |
| 13e320 | 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 69 | .explicit-control.evaluator.to.i |
| 13e340 | 6e 74 65 72 70 72 65 74 0a 61 20 53 63 68 65 6d 65 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 70 | nterpret.a.Scheme.program.that.p |
| 13e360 | 65 72 66 6f 72 6d 73 20 73 6f 75 72 63 65 2d 6c 65 76 65 6c 20 74 72 61 6e 73 66 6f 72 6d 61 74 | erforms.source-level.transformat |
| 13e380 | 69 6f 6e 73 20 6c 69 6b 65 0a 60 63 6f 6e 64 2d 3e 69 66 27 20 69 6e 20 61 20 73 79 6e 74 61 78 | ions.like.`cond->if'.in.a.syntax |
| 13e3a0 | 20 70 68 61 73 65 20 74 68 61 74 20 72 75 6e 73 20 62 65 66 6f 72 65 20 65 78 65 63 75 74 69 6f | .phase.that.runs.before.executio |
| 13e3c0 | 6e 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d | n.....File:.sicp.info,..Node:.5- |
| 13e3e0 | 34 2d 34 2c 20 20 50 72 65 76 3a 20 35 2d 34 2d 33 2c 20 20 55 70 3a 20 35 2d 34 0a 0a 35 2e 34 | 4-4,..Prev:.5-4-3,..Up:.5-4..5.4 |
| 13e400 | 2e 34 20 52 75 6e 6e 69 6e 67 20 74 68 65 20 45 76 61 6c 75 61 74 6f 72 0a 2d 2d 2d 2d 2d 2d 2d | .4.Running.the.Evaluator.------- |
| 13e420 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 69 74 68 20 74 68 65 20 69 | --------------------..With.the.i |
| 13e440 | 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f | mplementation.of.the.explicit-co |
| 13e460 | 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 77 65 20 63 6f 6d 65 20 74 6f 0a 74 68 65 20 65 | ntrol.evaluator.we.come.to.the.e |
| 13e480 | 6e 64 20 6f 66 20 61 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2c 20 62 65 67 75 6e 20 69 6e 20 2a 4e | nd.of.a.development,.begun.in.*N |
| 13e4a0 | 6f 74 65 20 43 68 61 70 74 65 72 20 31 3a 3a 2c 20 69 6e 20 77 68 69 63 68 20 77 65 20 68 61 76 | ote.Chapter.1::,.in.which.we.hav |
| 13e4c0 | 65 0a 65 78 70 6c 6f 72 65 64 20 73 75 63 63 65 73 73 69 76 65 6c 79 20 6d 6f 72 65 20 70 72 65 | e.explored.successively.more.pre |
| 13e4e0 | 63 69 73 65 20 6d 6f 64 65 6c 73 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 | cise.models.of.the.evaluation.pr |
| 13e500 | 6f 63 65 73 73 2e 0a 57 65 20 73 74 61 72 74 65 64 20 77 69 74 68 20 74 68 65 20 72 65 6c 61 74 | ocess..We.started.with.the.relat |
| 13e520 | 69 76 65 6c 79 20 69 6e 66 6f 72 6d 61 6c 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f 64 65 | ively.informal.substitution.mode |
| 13e540 | 6c 2c 20 74 68 65 6e 0a 65 78 74 65 6e 64 65 64 20 74 68 69 73 20 69 6e 20 2a 4e 6f 74 65 20 43 | l,.then.extended.this.in.*Note.C |
| 13e560 | 68 61 70 74 65 72 20 33 3a 3a 20 74 6f 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 6d 6f | hapter.3::.to.the.environment.mo |
| 13e580 | 64 65 6c 2c 20 77 68 69 63 68 0a 65 6e 61 62 6c 65 64 20 75 73 20 74 6f 20 64 65 61 6c 20 77 69 | del,.which.enabled.us.to.deal.wi |
| 13e5a0 | 74 68 20 73 74 61 74 65 20 61 6e 64 20 63 68 61 6e 67 65 2e 20 20 49 6e 20 74 68 65 20 6d 65 74 | th.state.and.change...In.the.met |
| 13e5c0 | 61 63 69 72 63 75 6c 61 72 0a 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 2a 4e 6f 74 65 20 43 68 61 | acircular.evaluator.of.*Note.Cha |
| 13e5e0 | 70 74 65 72 20 34 3a 3a 2c 20 77 65 20 75 73 65 64 20 53 63 68 65 6d 65 20 69 74 73 65 6c 66 20 | pter.4::,.we.used.Scheme.itself. |
| 13e600 | 61 73 20 61 20 6c 61 6e 67 75 61 67 65 20 66 6f 72 0a 6d 61 6b 69 6e 67 20 6d 6f 72 65 20 65 78 | as.a.language.for.making.more.ex |
| 13e620 | 70 6c 69 63 69 74 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 73 74 72 75 63 74 75 72 65 | plicit.the.environment.structure |
| 13e640 | 20 63 6f 6e 73 74 72 75 63 74 65 64 20 64 75 72 69 6e 67 0a 65 76 61 6c 75 61 74 69 6f 6e 20 6f | .constructed.during.evaluation.o |
| 13e660 | 66 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 4e 6f 77 2c 20 77 69 74 68 20 72 65 67 69 | f.an.expression...Now,.with.regi |
| 13e680 | 73 74 65 72 20 6d 61 63 68 69 6e 65 73 2c 20 77 65 20 68 61 76 65 0a 74 61 6b 65 6e 20 61 20 63 | ster.machines,.we.have.taken.a.c |
| 13e6a0 | 6c 6f 73 65 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 27 73 20 6d 65 63 | lose.look.at.the.evaluator's.mec |
| 13e6c0 | 68 61 6e 69 73 6d 73 20 66 6f 72 20 73 74 6f 72 61 67 65 0a 6d 61 6e 61 67 65 6d 65 6e 74 2c 20 | hanisms.for.storage.management,. |
| 13e6e0 | 61 72 67 75 6d 65 6e 74 20 70 61 73 73 69 6e 67 2c 20 61 6e 64 20 63 6f 6e 74 72 6f 6c 2e 20 20 | argument.passing,.and.control... |
| 13e700 | 41 74 20 65 61 63 68 20 6e 65 77 20 6c 65 76 65 6c 20 6f 66 0a 64 65 73 63 72 69 70 74 69 6f 6e | At.each.new.level.of.description |
| 13e720 | 2c 20 77 65 20 68 61 76 65 20 68 61 64 20 74 6f 20 72 61 69 73 65 20 69 73 73 75 65 73 20 61 6e | ,.we.have.had.to.raise.issues.an |
| 13e740 | 64 20 72 65 73 6f 6c 76 65 20 61 6d 62 69 67 75 69 74 69 65 73 20 74 68 61 74 0a 77 65 72 65 20 | d.resolve.ambiguities.that.were. |
| 13e760 | 6e 6f 74 20 61 70 70 61 72 65 6e 74 20 61 74 20 74 68 65 20 70 72 65 76 69 6f 75 73 2c 20 6c 65 | not.apparent.at.the.previous,.le |
| 13e780 | 73 73 20 70 72 65 63 69 73 65 20 74 72 65 61 74 6d 65 6e 74 20 6f 66 0a 65 76 61 6c 75 61 74 69 | ss.precise.treatment.of.evaluati |
| 13e7a0 | 6f 6e 2e 20 20 54 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 | on...To.understand.the.behavior. |
| 13e7c0 | 6f 66 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 0a 65 76 61 6c 75 61 74 6f | of.the.explicit-control.evaluato |
| 13e7e0 | 72 2c 20 77 65 20 63 61 6e 20 73 69 6d 75 6c 61 74 65 20 69 74 20 61 6e 64 20 6d 6f 6e 69 74 6f | r,.we.can.simulate.it.and.monito |
| 13e800 | 72 20 69 74 73 20 70 65 72 66 6f 72 6d 61 6e 63 65 2e 0a 0a 20 20 20 57 65 20 77 69 6c 6c 20 69 | r.its.performance......We.will.i |
| 13e820 | 6e 73 74 61 6c 6c 20 61 20 64 72 69 76 65 72 20 6c 6f 6f 70 20 69 6e 20 6f 75 72 20 65 76 61 6c | nstall.a.driver.loop.in.our.eval |
| 13e840 | 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 2e 20 20 54 68 69 73 20 70 6c 61 79 73 0a 74 68 65 20 72 | uator.machine...This.plays.the.r |
| 13e860 | 6f 6c 65 20 6f 66 20 74 68 65 20 60 64 72 69 76 65 72 2d 6c 6f 6f 70 27 20 70 72 6f 63 65 64 75 | ole.of.the.`driver-loop'.procedu |
| 13e880 | 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 34 3a 3a 2e 20 20 54 68 | re.of.section.*Note.4-1-4::...Th |
| 13e8a0 | 65 0a 65 76 61 6c 75 61 74 6f 72 20 77 69 6c 6c 20 72 65 70 65 61 74 65 64 6c 79 20 70 72 69 6e | e.evaluator.will.repeatedly.prin |
| 13e8c0 | 74 20 61 20 70 72 6f 6d 70 74 2c 20 72 65 61 64 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 | t.a.prompt,.read.an.expression,. |
| 13e8e0 | 65 76 61 6c 75 61 74 65 0a 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 62 79 20 67 6f 69 6e 67 | evaluate.the.expression.by.going |
| 13e900 | 20 74 6f 20 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 2c 20 61 6e 64 20 70 72 69 6e 74 20 74 | .to.`eval-dispatch',.and.print.t |
| 13e920 | 68 65 20 72 65 73 75 6c 74 2e 20 20 54 68 65 0a 66 6f 6c 6c 6f 77 69 6e 67 20 69 6e 73 74 72 75 | he.result...The.following.instru |
| 13e940 | 63 74 69 6f 6e 73 20 66 6f 72 6d 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65 | ctions.form.the.beginning.of.the |
| 13e960 | 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 0a 65 76 61 6c 75 61 74 6f 72 27 73 20 63 6f | .explicit-control.evaluator's.co |
| 13e980 | 6e 74 72 6f 6c 6c 65 72 20 73 65 71 75 65 6e 63 65 3a 28 31 29 0a 0a 20 20 20 20 20 72 65 61 64 | ntroller.sequence:(1).......read |
| 13e9a0 | 2d 65 76 61 6c 2d 70 72 69 6e 74 2d 6c 6f 6f 70 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d | -eval-print-loop........(perform |
| 13e9c0 | 20 28 6f 70 20 69 6e 69 74 69 61 6c 69 7a 65 2d 73 74 61 63 6b 29 29 0a 20 20 20 20 20 20 20 28 | .(op.initialize-stack))........( |
| 13e9e0 | 70 65 72 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 28 6f 70 20 70 72 6f 6d 70 74 2d 66 6f 72 2d 69 | perform.........(op.prompt-for-i |
| 13ea00 | 6e 70 75 74 29 20 28 63 6f 6e 73 74 20 22 3b 3b 3b 20 45 43 2d 45 76 61 6c 20 69 6e 70 75 74 3a | nput).(const.";;;.EC-Eval.input: |
| 13ea20 | 22 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 78 70 20 28 6f 70 20 72 65 61 64 29 | "))........(assign.exp.(op.read) |
| 13ea40 | 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 6e 76 20 28 6f 70 20 67 65 74 2d 67 6c 6f | )........(assign.env.(op.get-glo |
| 13ea60 | 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e | bal-environment))........(assign |
| 13ea80 | 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 70 72 69 6e 74 2d 72 65 73 75 6c 74 29 29 0a | .continue.(label.print-result)). |
| 13eaa0 | 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 65 76 61 6c 2d 64 69 73 70 61 74 63 | .......(goto.(label.eval-dispatc |
| 13eac0 | 68 29 29 0a 20 20 20 20 20 70 72 69 6e 74 2d 72 65 73 75 6c 74 0a 20 20 20 20 20 20 20 28 70 65 | h))......print-result........(pe |
| 13eae0 | 72 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 28 6f 70 20 61 6e 6e 6f 75 6e 63 65 2d 6f 75 74 70 75 | rform.........(op.announce-outpu |
| 13eb00 | 74 29 20 28 63 6f 6e 73 74 20 22 3b 3b 3b 20 45 43 2d 45 76 61 6c 20 76 61 6c 75 65 3a 22 29 29 | t).(const.";;;.EC-Eval.value:")) |
| 13eb20 | 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 75 73 65 72 2d 70 72 69 6e 74 29 | ........(perform.(op.user-print) |
| 13eb40 | 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 | .(reg.val))........(goto.(label. |
| 13eb60 | 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 6e 74 2d 6c 6f 6f 70 29 29 0a 0a 20 20 20 57 68 65 6e 20 | read-eval-print-loop)).....When. |
| 13eb80 | 77 65 20 65 6e 63 6f 75 6e 74 65 72 20 61 6e 20 65 72 72 6f 72 20 69 6e 20 61 20 70 72 6f 63 65 | we.encounter.an.error.in.a.proce |
| 13eba0 | 64 75 72 65 20 28 73 75 63 68 20 61 73 20 74 68 65 20 22 75 6e 6b 6e 6f 77 6e 0a 70 72 6f 63 65 | dure.(such.as.the."unknown.proce |
| 13ebc0 | 64 75 72 65 20 74 79 70 65 20 65 72 72 6f 72 22 20 69 6e 64 69 63 61 74 65 64 20 61 74 20 60 61 | dure.type.error".indicated.at.`a |
| 13ebe0 | 70 70 6c 79 2d 64 69 73 70 61 74 63 68 27 29 2c 20 77 65 20 70 72 69 6e 74 20 61 6e 20 65 72 72 | pply-dispatch'),.we.print.an.err |
| 13ec00 | 6f 72 0a 6d 65 73 73 61 67 65 20 61 6e 64 20 72 65 74 75 72 6e 20 74 6f 20 74 68 65 20 64 72 69 | or.message.and.return.to.the.dri |
| 13ec20 | 76 65 72 20 6c 6f 6f 70 2e 28 32 29 0a 0a 20 20 20 20 20 75 6e 6b 6e 6f 77 6e 2d 65 78 70 72 65 | ver.loop.(2).......unknown-expre |
| 13ec40 | 73 73 69 6f 6e 2d 74 79 70 65 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 63 | ssion-type........(assign.val.(c |
| 13ec60 | 6f 6e 73 74 20 75 6e 6b 6e 6f 77 6e 2d 65 78 70 72 65 73 73 69 6f 6e 2d 74 79 70 65 2d 65 72 72 | onst.unknown-expression-type-err |
| 13ec80 | 6f 72 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 73 69 67 6e 61 6c 2d | or))........(goto.(label.signal- |
| 13eca0 | 65 72 72 6f 72 29 29 0a 0a 20 20 20 20 20 75 6e 6b 6e 6f 77 6e 2d 70 72 6f 63 65 64 75 72 65 2d | error)).......unknown-procedure- |
| 13ecc0 | 74 79 70 65 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f 6e 74 69 6e 75 65 29 20 20 | type........(restore.continue).. |
| 13ece0 | 20 20 3b 20 63 6c 65 61 6e 20 75 70 20 73 74 61 63 6b 20 28 66 72 6f 6d 20 60 61 70 70 6c 79 2d | ..;.clean.up.stack.(from.`apply- |
| 13ed00 | 64 69 73 70 61 74 63 68 27 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 63 | dispatch')........(assign.val.(c |
| 13ed20 | 6f 6e 73 74 20 75 6e 6b 6e 6f 77 6e 2d 70 72 6f 63 65 64 75 72 65 2d 74 79 70 65 2d 65 72 72 6f | onst.unknown-procedure-type-erro |
| 13ed40 | 72 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 73 69 67 6e 61 6c 2d 65 | r))........(goto.(label.signal-e |
| 13ed60 | 72 72 6f 72 29 29 0a 0a 20 20 20 20 20 73 69 67 6e 61 6c 2d 65 72 72 6f 72 0a 20 20 20 20 20 20 | rror)).......signal-error....... |
| 13ed80 | 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 75 73 65 72 2d 70 72 69 6e 74 29 20 28 72 65 67 20 76 | .(perform.(op.user-print).(reg.v |
| 13eda0 | 61 6c 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 72 65 61 64 2d 65 76 | al))........(goto.(label.read-ev |
| 13edc0 | 61 6c 2d 70 72 69 6e 74 2d 6c 6f 6f 70 29 29 0a 0a 20 20 20 46 6f 72 20 74 68 65 20 70 75 72 70 | al-print-loop)).....For.the.purp |
| 13ede0 | 6f 73 65 73 20 6f 66 20 74 68 65 20 73 69 6d 75 6c 61 74 69 6f 6e 2c 20 77 65 20 69 6e 69 74 69 | oses.of.the.simulation,.we.initi |
| 13ee00 | 61 6c 69 7a 65 20 74 68 65 20 73 74 61 63 6b 20 65 61 63 68 0a 74 69 6d 65 20 74 68 72 6f 75 67 | alize.the.stack.each.time.throug |
| 13ee20 | 68 20 74 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 2c 20 73 69 6e 63 65 20 69 74 20 6d 69 67 68 | h.the.driver.loop,.since.it.migh |
| 13ee40 | 74 20 6e 6f 74 20 62 65 20 65 6d 70 74 79 20 61 66 74 65 72 20 61 6e 0a 65 72 72 6f 72 20 28 73 | t.not.be.empty.after.an.error.(s |
| 13ee60 | 75 63 68 20 61 73 20 61 6e 20 75 6e 64 65 66 69 6e 65 64 20 76 61 72 69 61 62 6c 65 29 20 69 6e | uch.as.an.undefined.variable).in |
| 13ee80 | 74 65 72 72 75 70 74 73 20 61 6e 20 65 76 61 6c 75 61 74 69 6f 6e 2e 28 33 29 0a 0a 20 20 20 49 | terrupts.an.evaluation.(3).....I |
| 13eea0 | 66 20 77 65 20 63 6f 6d 62 69 6e 65 20 61 6c 6c 20 74 68 65 20 63 6f 64 65 20 66 72 61 67 6d 65 | f.we.combine.all.the.code.fragme |
| 13eec0 | 6e 74 73 20 70 72 65 73 65 6e 74 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 73 20 2a 4e 6f 74 65 0a | nts.presented.in.sections.*Note. |
| 13eee0 | 35 2d 34 2d 31 3a 3a 2d 2a 4e 6f 74 65 20 35 2d 34 2d 34 3a 3a 2c 20 77 65 20 63 61 6e 20 63 72 | 5-4-1::-*Note.5-4-4::,.we.can.cr |
| 13ef00 | 65 61 74 65 20 61 6e 20 65 76 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 20 6d 6f 64 65 6c 20 | eate.an.evaluator.machine.model. |
| 13ef20 | 74 68 61 74 20 77 65 0a 63 61 6e 20 72 75 6e 20 75 73 69 6e 67 20 74 68 65 20 72 65 67 69 73 74 | that.we.can.run.using.the.regist |
| 13ef40 | 65 72 2d 6d 61 63 68 69 6e 65 20 73 69 6d 75 6c 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 | er-machine.simulator.of.section. |
| 13ef60 | 2a 4e 6f 74 65 20 35 2d 32 3a 3a 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 65 63 65 76 61 | *Note.5-2::........(define.eceva |
| 13ef80 | 6c 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 20 20 20 27 | l........(make-machine.........' |
| 13efa0 | 28 65 78 70 20 65 6e 76 20 76 61 6c 20 70 72 6f 63 20 61 72 67 6c 20 63 6f 6e 74 69 6e 75 65 20 | (exp.env.val.proc.argl.continue. |
| 13efc0 | 75 6e 65 76 29 0a 20 20 20 20 20 20 20 20 65 63 65 76 61 6c 2d 6f 70 65 72 61 74 69 6f 6e 73 0a | unev).........eceval-operations. |
| 13efe0 | 20 20 20 20 20 20 20 27 28 0a 20 20 20 20 20 20 20 20 20 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 | .......'(..........read-eval-pri |
| 13f000 | 6e 74 2d 6c 6f 6f 70 0a 20 20 20 20 20 20 20 20 20 20 20 3c 5f 65 6e 74 69 72 65 20 6d 61 63 68 | nt-loop............<_entire.mach |
| 13f020 | 69 6e 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 61 73 20 67 69 76 65 6e 20 61 62 6f 76 65 5f 3e 0a | ine.controller.as.given.above_>. |
| 13f040 | 20 20 20 20 20 20 20 20 29 29 29 0a 0a 20 20 20 57 65 20 6d 75 73 74 20 64 65 66 69 6e 65 20 53 | ........))).....We.must.define.S |
| 13f060 | 63 68 65 6d 65 20 70 72 6f 63 65 64 75 72 65 73 20 74 6f 20 73 69 6d 75 6c 61 74 65 20 74 68 65 | cheme.procedures.to.simulate.the |
| 13f080 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 75 73 65 64 20 61 73 0a 70 72 69 6d 69 74 69 76 65 73 20 62 | .operations.used.as.primitives.b |
| 13f0a0 | 79 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 2e 20 20 54 68 65 73 65 20 61 72 65 20 74 68 65 20 | y.the.evaluator...These.are.the. |
| 13f0c0 | 73 61 6d 65 20 70 72 6f 63 65 64 75 72 65 73 20 77 65 20 75 73 65 64 20 66 6f 72 0a 74 68 65 20 | same.procedures.we.used.for.the. |
| 13f0e0 | 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 73 65 63 74 69 6f | metacircular.evaluator.in.sectio |
| 13f100 | 6e 20 2a 4e 6f 74 65 20 34 2d 31 3a 3a 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 65 | n.*Note.4-1::,.together.with.the |
| 13f120 | 0a 66 65 77 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 6e 65 73 20 64 65 66 69 6e 65 64 20 69 6e 20 | .few.additional.ones.defined.in. |
| 13f140 | 66 6f 6f 74 6e 6f 74 65 73 20 74 68 72 6f 75 67 68 6f 75 74 20 73 65 63 74 69 6f 6e 20 2a 4e 6f | footnotes.throughout.section.*No |
| 13f160 | 74 65 20 35 2d 34 3a 3a 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 65 63 65 76 61 6c 2d 6f | te.5-4::........(define.eceval-o |
| 13f180 | 70 65 72 61 74 69 6f 6e 73 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 28 6c 69 73 74 20 27 73 65 | perations........(list.(list.'se |
| 13f1a0 | 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 3f 20 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 29 0a | lf-evaluating?.self-evaluating). |
| 13f1c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 3c 5f 63 6f 6d 70 6c 65 74 65 20 6c 69 73 74 20 6f 66 20 | .............<_complete.list.of. |
| 13f1e0 | 6f 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 65 63 65 76 61 6c 20 6d 61 63 68 69 6e 65 5f 3e 29 | operations.for.eceval.machine_>) |
| 13f200 | 29 0a 0a 20 20 20 46 69 6e 61 6c 6c 79 2c 20 77 65 20 63 61 6e 20 69 6e 69 74 69 61 6c 69 7a 65 | ).....Finally,.we.can.initialize |
| 13f220 | 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 6e 64 20 72 75 6e 20 | .the.global.environment.and.run. |
| 13f240 | 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 74 68 65 | the.evaluator:.......(define.the |
| 13f260 | 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 28 73 65 74 75 70 2d 65 6e 76 69 72 | -global-environment.(setup-envir |
| 13f280 | 6f 6e 6d 65 6e 74 29 29 0a 0a 20 20 20 20 20 28 73 74 61 72 74 20 65 63 65 76 61 6c 29 0a 0a 20 | onment)).......(start.eceval)... |
| 13f2a0 | 20 20 20 20 3b 3b 3b 20 45 43 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 64 65 66 | ....;;;.EC-Eval.input:......(def |
| 13f2c0 | 69 6e 65 20 28 61 70 70 65 6e 64 20 78 20 79 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c | ine.(append.x.y)........(if.(nul |
| 13f2e0 | 6c 3f 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 79 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 | l?.x)............y............(c |
| 13f300 | 6f 6e 73 20 28 63 61 72 20 78 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 | ons.(car.x)..................(ap |
| 13f320 | 70 65 6e 64 20 28 63 64 72 20 78 29 20 79 29 29 29 29 0a 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 | pend.(cdr.x).y))))......;;;.EC-E |
| 13f340 | 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 3b 3b 3b 20 45 43 2d | val.value:......ok.......;;;.EC- |
| 13f360 | 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 61 70 70 65 6e 64 20 27 28 61 20 62 20 63 | Eval.input:......(append.'(a.b.c |
| 13f380 | 29 20 27 28 64 20 65 20 66 29 29 0a 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 76 61 6c 20 76 61 6c | ).'(d.e.f))......;;;.EC-Eval.val |
| 13f3a0 | 75 65 3a 0a 20 20 20 20 20 28 61 20 62 20 63 20 64 20 65 20 66 29 0a 0a 20 20 20 4f 66 20 63 6f | ue:......(a.b.c.d.e.f).....Of.co |
| 13f3c0 | 75 72 73 65 2c 20 65 76 61 6c 75 61 74 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 | urse,.evaluating.expressions.in. |
| 13f3e0 | 74 68 69 73 20 77 61 79 20 77 69 6c 6c 20 74 61 6b 65 20 6d 75 63 68 20 6c 6f 6e 67 65 72 0a 74 | this.way.will.take.much.longer.t |
| 13f400 | 68 61 6e 20 69 66 20 77 65 20 68 61 64 20 64 69 72 65 63 74 6c 79 20 74 79 70 65 64 20 74 68 65 | han.if.we.had.directly.typed.the |
| 13f420 | 6d 20 69 6e 74 6f 20 53 63 68 65 6d 65 2c 20 62 65 63 61 75 73 65 20 6f 66 20 74 68 65 20 6d 75 | m.into.Scheme,.because.of.the.mu |
| 13f440 | 6c 74 69 70 6c 65 0a 6c 65 76 65 6c 73 20 6f 66 20 73 69 6d 75 6c 61 74 69 6f 6e 20 69 6e 76 6f | ltiple.levels.of.simulation.invo |
| 13f460 | 6c 76 65 64 2e 20 20 4f 75 72 20 65 78 70 72 65 73 73 69 6f 6e 73 20 61 72 65 20 65 76 61 6c 75 | lved...Our.expressions.are.evalu |
| 13f480 | 61 74 65 64 20 62 79 20 74 68 65 0a 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 2d 65 76 61 | ated.by.the.explicit-control-eva |
| 13f4a0 | 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 2c 20 77 68 69 63 68 20 69 73 20 62 65 69 6e 67 20 73 | luator.machine,.which.is.being.s |
| 13f4c0 | 69 6d 75 6c 61 74 65 64 20 62 79 20 61 20 53 63 68 65 6d 65 0a 70 72 6f 67 72 61 6d 2c 20 77 68 | imulated.by.a.Scheme.program,.wh |
| 13f4e0 | 69 63 68 20 69 73 20 69 74 73 65 6c 66 20 62 65 69 6e 67 20 65 76 61 6c 75 61 74 65 64 20 62 79 | ich.is.itself.being.evaluated.by |
| 13f500 | 20 74 68 65 20 53 63 68 65 6d 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0a 0a 4d 6f 6e 69 74 6f | .the.Scheme.interpreter...Monito |
| 13f520 | 72 69 6e 67 20 74 68 65 20 70 65 72 66 6f 72 6d 61 6e 63 65 20 6f 66 20 74 68 65 20 65 76 61 6c | ring.the.performance.of.the.eval |
| 13f540 | 75 61 74 6f 72 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | uator........................... |
| 13f560 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 53 69 6d 75 6c 61 74 69 6f 6e 20 63 61 | ...................Simulation.ca |
| 13f580 | 6e 20 62 65 20 61 20 70 6f 77 65 72 66 75 6c 20 74 6f 6f 6c 20 74 6f 20 67 75 69 64 65 20 74 68 | n.be.a.powerful.tool.to.guide.th |
| 13f5a0 | 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 0a 65 76 61 6c 75 61 74 6f 72 73 2e 20 | e.implementation.of.evaluators.. |
| 13f5c0 | 20 53 69 6d 75 6c 61 74 69 6f 6e 73 20 6d 61 6b 65 20 69 74 20 65 61 73 79 20 6e 6f 74 20 6f 6e | .Simulations.make.it.easy.not.on |
| 13f5e0 | 6c 79 20 74 6f 20 65 78 70 6c 6f 72 65 20 76 61 72 69 61 74 69 6f 6e 73 20 6f 66 0a 74 68 65 20 | ly.to.explore.variations.of.the. |
| 13f600 | 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 64 65 73 69 67 6e 20 62 75 74 20 61 6c 73 6f | register-machine.design.but.also |
| 13f620 | 20 74 6f 20 6d 6f 6e 69 74 6f 72 20 74 68 65 20 70 65 72 66 6f 72 6d 61 6e 63 65 20 6f 66 20 74 | .to.monitor.the.performance.of.t |
| 13f640 | 68 65 0a 73 69 6d 75 6c 61 74 65 64 20 65 76 61 6c 75 61 74 6f 72 2e 20 20 46 6f 72 20 65 78 61 | he.simulated.evaluator...For.exa |
| 13f660 | 6d 70 6c 65 2c 20 6f 6e 65 20 69 6d 70 6f 72 74 61 6e 74 20 66 61 63 74 6f 72 20 69 6e 20 70 65 | mple,.one.important.factor.in.pe |
| 13f680 | 72 66 6f 72 6d 61 6e 63 65 0a 69 73 20 68 6f 77 20 65 66 66 69 63 69 65 6e 74 6c 79 20 74 68 65 | rformance.is.how.efficiently.the |
| 13f6a0 | 20 65 76 61 6c 75 61 74 6f 72 20 75 73 65 73 20 74 68 65 20 73 74 61 63 6b 2e 20 20 57 65 20 63 | .evaluator.uses.the.stack...We.c |
| 13f6c0 | 61 6e 20 6f 62 73 65 72 76 65 20 74 68 65 0a 6e 75 6d 62 65 72 20 6f 66 20 73 74 61 63 6b 20 6f | an.observe.the.number.of.stack.o |
| 13f6e0 | 70 65 72 61 74 69 6f 6e 73 20 72 65 71 75 69 72 65 64 20 74 6f 20 65 76 61 6c 75 61 74 65 20 76 | perations.required.to.evaluate.v |
| 13f700 | 61 72 69 6f 75 73 20 65 78 70 72 65 73 73 69 6f 6e 73 20 62 79 0a 64 65 66 69 6e 69 6e 67 20 74 | arious.expressions.by.defining.t |
| 13f720 | 68 65 20 65 76 61 6c 75 61 74 6f 72 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 77 69 | he.evaluator.register.machine.wi |
| 13f740 | 74 68 20 74 68 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 0a 73 69 6d 75 6c 61 74 6f 72 20 | th.the.version.of.the.simulator. |
| 13f760 | 74 68 61 74 20 63 6f 6c 6c 65 63 74 73 20 73 74 61 74 69 73 74 69 63 73 20 6f 6e 20 73 74 61 63 | that.collects.statistics.on.stac |
| 13f780 | 6b 20 75 73 65 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 35 2d 32 2d 34 3a 3a 29 2c 20 61 | k.use.(section.*Note.5-2-4::),.a |
| 13f7a0 | 6e 64 20 61 64 64 69 6e 67 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 61 74 20 74 68 65 20 | nd.adding.an.instruction.at.the. |
| 13f7c0 | 65 76 61 6c 75 61 74 6f 72 27 73 20 60 70 72 69 6e 74 2d 72 65 73 75 6c 74 27 0a 65 6e 74 72 79 | evaluator's.`print-result'.entry |
| 13f7e0 | 20 70 6f 69 6e 74 20 74 6f 20 70 72 69 6e 74 20 74 68 65 20 73 74 61 74 69 73 74 69 63 73 3a 0a | .point.to.print.the.statistics:. |
| 13f800 | 0a 20 20 20 20 20 70 72 69 6e 74 2d 72 65 73 75 6c 74 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f | ......print-result........(perfo |
| 13f820 | 72 6d 20 28 6f 70 20 70 72 69 6e 74 2d 73 74 61 63 6b 2d 73 74 61 74 69 73 74 69 63 73 29 29 3b | rm.(op.print-stack-statistics)); |
| 13f840 | 20 61 64 64 65 64 20 69 6e 73 74 72 75 63 74 69 6f 6e 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f | .added.instruction........(perfo |
| 13f860 | 72 6d 0a 20 20 20 20 20 20 20 20 28 6f 70 20 61 6e 6e 6f 75 6e 63 65 2d 6f 75 74 70 75 74 29 20 | rm.........(op.announce-output). |
| 13f880 | 28 63 6f 6e 73 74 20 22 3b 3b 3b 20 45 43 2d 45 76 61 6c 20 76 61 6c 75 65 3a 22 29 29 0a 20 20 | (const.";;;.EC-Eval.value:"))... |
| 13f8a0 | 20 20 20 20 20 2e 2e 2e 20 3b 20 73 61 6d 65 20 61 73 20 62 65 66 6f 72 65 0a 0a 20 20 20 49 6e | .........;.same.as.before.....In |
| 13f8c0 | 74 65 72 61 63 74 69 6f 6e 73 20 77 69 74 68 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6e 6f | teractions.with.the.evaluator.no |
| 13f8e0 | 77 20 6c 6f 6f 6b 20 6c 69 6b 65 20 74 68 69 73 3a 0a 0a 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 | w.look.like.this:.......;;;.EC-E |
| 13f900 | 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 | val.input:......(define.(factori |
| 13f920 | 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 20 20 | al.n)........(if.(=.n.1)........ |
| 13f940 | 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 66 61 63 74 6f 72 69 61 6c 20 28 | ....1............(*.(factorial.( |
| 13f960 | 2d 20 6e 20 31 29 29 20 6e 29 29 29 0a 20 20 20 20 20 28 74 6f 74 61 6c 2d 70 75 73 68 65 73 20 | -.n.1)).n)))......(total-pushes. |
| 13f980 | 3d 20 33 20 6d 61 78 69 6d 75 6d 2d 64 65 70 74 68 20 3d 20 33 29 0a 20 20 20 20 20 3b 3b 3b 20 | =.3.maximum-depth.=.3)......;;;. |
| 13f9a0 | 45 43 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 3b 3b 3b | EC-Eval.value:......ok.......;;; |
| 13f9c0 | 20 45 43 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 66 61 63 74 6f 72 69 61 6c 20 | .EC-Eval.input:......(factorial. |
| 13f9e0 | 35 29 0a 20 20 20 20 20 28 74 6f 74 61 6c 2d 70 75 73 68 65 73 20 3d 20 31 34 34 20 6d 61 78 69 | 5)......(total-pushes.=.144.maxi |
| 13fa00 | 6d 75 6d 2d 64 65 70 74 68 20 3d 20 32 38 29 0a 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 76 61 6c | mum-depth.=.28)......;;;.EC-Eval |
| 13fa20 | 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 31 32 30 0a 0a 20 20 20 4e 6f 74 65 20 74 68 61 74 20 74 | .value:......120.....Note.that.t |
| 13fa40 | 68 65 20 64 72 69 76 65 72 20 6c 6f 6f 70 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 | he.driver.loop.of.the.evaluator. |
| 13fa60 | 72 65 69 6e 69 74 69 61 6c 69 7a 65 73 20 74 68 65 20 73 74 61 63 6b 0a 61 74 20 74 68 65 20 73 | reinitializes.the.stack.at.the.s |
| 13fa80 | 74 61 72 74 20 6f 66 20 65 61 63 68 20 69 6e 74 65 72 61 63 74 69 6f 6e 2c 20 73 6f 20 74 68 61 | tart.of.each.interaction,.so.tha |
| 13faa0 | 74 20 74 68 65 20 73 74 61 74 69 73 74 69 63 73 20 70 72 69 6e 74 65 64 20 77 69 6c 6c 0a 72 65 | t.the.statistics.printed.will.re |
| 13fac0 | 66 65 72 20 6f 6e 6c 79 20 74 6f 20 73 74 61 63 6b 20 6f 70 65 72 61 74 69 6f 6e 73 20 75 73 65 | fer.only.to.stack.operations.use |
| 13fae0 | 64 20 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 70 72 65 76 69 6f 75 73 20 65 78 70 72 65 | d.to.evaluate.the.previous.expre |
| 13fb00 | 73 73 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 32 36 3a 2a 20 55 73 | ssion........*Exercise.5.26:*.Us |
| 13fb20 | 65 20 74 68 65 20 6d 6f 6e 69 74 6f 72 65 64 20 73 74 61 63 6b 20 74 6f 20 65 78 70 6c 6f 72 65 | e.the.monitored.stack.to.explore |
| 13fb40 | 20 74 68 65 0a 20 20 20 20 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 20 70 72 6f 70 65 72 74 | .the......tail-recursive.propert |
| 13fb60 | 79 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 | y.of.the.evaluator.(section.*Not |
| 13fb80 | 65 20 35 2d 34 2d 32 3a 3a 29 2e 0a 20 20 20 20 20 53 74 61 72 74 20 74 68 65 20 65 76 61 6c 75 | e.5-4-2::).......Start.the.evalu |
| 13fba0 | 61 74 6f 72 20 61 6e 64 20 64 65 66 69 6e 65 20 74 68 65 20 69 74 65 72 61 74 69 76 65 20 60 66 | ator.and.define.the.iterative.`f |
| 13fbc0 | 61 63 74 6f 72 69 61 6c 27 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 66 72 6f 6d 20 73 65 | actorial'.procedure......from.se |
| 13fbe0 | 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 31 2d 32 2d 31 3a 3a 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 | ction.*Note.1-2-1:::............ |
| 13fc00 | 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 | (define.(factorial.n)........... |
| 13fc20 | 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 20 70 72 6f 64 75 63 74 20 63 6f 75 6e 74 65 72 29 | ..(define.(iter.product.counter) |
| 13fc40 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3e 20 63 6f 75 6e 74 65 72 20 6e 29 | ...............(if.(>.counter.n) |
| 13fc60 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 | ...................product...... |
| 13fc80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 28 2a 20 63 6f 75 6e 74 65 72 20 70 72 | .............(iter.(*.counter.pr |
| 13fca0 | 6f 64 75 63 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | oduct).........................( |
| 13fcc0 | 2b 20 63 6f 75 6e 74 65 72 20 31 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 | +.counter.1)))).............(ite |
| 13fce0 | 72 20 31 20 31 29 29 0a 0a 20 20 20 20 20 52 75 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 | r.1.1)).......Run.the.procedure. |
| 13fd00 | 77 69 74 68 20 73 6f 6d 65 20 73 6d 61 6c 6c 20 76 61 6c 75 65 73 20 6f 66 20 6e 2e 20 20 52 65 | with.some.small.values.of.n...Re |
| 13fd20 | 63 6f 72 64 20 74 68 65 20 6d 61 78 69 6d 75 6d 0a 20 20 20 20 20 73 74 61 63 6b 20 64 65 70 74 | cord.the.maximum......stack.dept |
| 13fd40 | 68 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 75 73 68 65 73 20 72 65 71 75 69 | h.and.the.number.of.pushes.requi |
| 13fd60 | 72 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 6e 21 20 66 6f 72 0a 20 20 20 20 20 65 61 63 68 20 | red.to.compute.n!.for......each. |
| 13fd80 | 6f 66 20 74 68 65 73 65 20 76 61 6c 75 65 73 2e 0a 0a 20 20 20 20 20 20 20 61 2e 20 59 6f 75 20 | of.these.values..........a..You. |
| 13fda0 | 77 69 6c 6c 20 66 69 6e 64 20 74 68 61 74 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 64 65 70 74 68 | will.find.that.the.maximum.depth |
| 13fdc0 | 20 72 65 71 75 69 72 65 64 20 74 6f 20 65 76 61 6c 75 61 74 65 20 6e 21 0a 20 20 20 20 20 20 20 | .required.to.evaluate.n!........ |
| 13fde0 | 20 20 20 69 73 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 6e 2e 20 20 57 68 61 74 20 69 73 | ...is.independent.of.n...What.is |
| 13fe00 | 20 74 68 61 74 20 64 65 70 74 68 3f 0a 0a 20 20 20 20 20 20 20 62 2e 20 44 65 74 65 72 6d 69 6e | .that.depth?.........b..Determin |
| 13fe20 | 65 20 66 72 6f 6d 20 79 6f 75 72 20 64 61 74 61 20 61 20 66 6f 72 6d 75 6c 61 20 69 6e 20 74 65 | e.from.your.data.a.formula.in.te |
| 13fe40 | 72 6d 73 20 6f 66 20 6e 20 66 6f 72 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 74 6f 74 61 6c | rms.of.n.for.the...........total |
| 13fe60 | 20 6e 75 6d 62 65 72 20 6f 66 20 70 75 73 68 20 6f 70 65 72 61 74 69 6f 6e 73 20 75 73 65 64 20 | .number.of.push.operations.used. |
| 13fe80 | 69 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 6e 21 20 66 6f 72 20 61 6e 79 0a 20 20 20 20 20 20 20 | in.evaluating.n!.for.any........ |
| 13fea0 | 20 20 20 6e 20 3e 3d 20 31 2e 20 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65 20 6e 75 6d 62 65 72 | ...n.>=.1...Note.that.the.number |
| 13fec0 | 20 6f 66 20 6f 70 65 72 61 74 69 6f 6e 73 20 75 73 65 64 20 69 73 20 61 20 6c 69 6e 65 61 72 0a | .of.operations.used.is.a.linear. |
| 13fee0 | 20 20 20 20 20 20 20 20 20 20 66 75 6e 63 74 69 6f 6e 20 6f 66 20 6e 20 61 6e 64 20 69 73 20 74 | ..........function.of.n.and.is.t |
| 13ff00 | 68 75 73 20 64 65 74 65 72 6d 69 6e 65 64 20 62 79 20 74 77 6f 20 63 6f 6e 73 74 61 6e 74 73 2e | hus.determined.by.two.constants. |
| 13ff20 | 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 32 37 3a 2a 20 46 6f 72 20 63 6f 6d | ........*Exercise.5.27:*.For.com |
| 13ff40 | 70 61 72 69 73 6f 6e 20 77 69 74 68 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 32 36 | parison.with.*Note.Exercise.5-26 |
| 13ff60 | 3a 3a 2c 0a 20 20 20 20 20 65 78 70 6c 6f 72 65 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 | ::,......explore.the.behavior.of |
| 13ff80 | 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 63 6f 6d | .the.following.procedure.for.com |
| 13ffa0 | 70 75 74 69 6e 67 0a 20 20 20 20 20 66 61 63 74 6f 72 69 61 6c 73 20 72 65 63 75 72 73 69 76 65 | puting......factorials.recursive |
| 13ffc0 | 6c 79 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 | ly:............(define.(factoria |
| 13ffe0 | 6c 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 | l.n).............(if.(=.n.1).... |
| 140000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .............1.................( |
| 140020 | 2a 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 29 29 0a 0a 20 20 20 20 | *.(factorial.(-.n.1)).n)))...... |
| 140040 | 20 42 79 20 72 75 6e 6e 69 6e 67 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 | .By.running.this.procedure.with. |
| 140060 | 74 68 65 20 6d 6f 6e 69 74 6f 72 65 64 20 73 74 61 63 6b 2c 20 64 65 74 65 72 6d 69 6e 65 2c 20 | the.monitored.stack,.determine,. |
| 140080 | 61 73 0a 20 20 20 20 20 61 20 66 75 6e 63 74 69 6f 6e 20 6f 66 20 6e 2c 20 74 68 65 20 6d 61 78 | as......a.function.of.n,.the.max |
| 1400a0 | 69 6d 75 6d 20 64 65 70 74 68 20 6f 66 20 74 68 65 20 73 74 61 63 6b 20 61 6e 64 20 74 68 65 20 | imum.depth.of.the.stack.and.the. |
| 1400c0 | 74 6f 74 61 6c 0a 20 20 20 20 20 6e 75 6d 62 65 72 20 6f 66 20 70 75 73 68 65 73 20 75 73 65 64 | total......number.of.pushes.used |
| 1400e0 | 20 69 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 6e 21 20 66 6f 72 20 6e 20 3e 3d 20 31 2e 20 20 28 | .in.evaluating.n!.for.n.>=.1...( |
| 140100 | 41 67 61 69 6e 2c 20 74 68 65 73 65 0a 20 20 20 20 20 66 75 6e 63 74 69 6f 6e 73 20 77 69 6c 6c | Again,.these......functions.will |
| 140120 | 20 62 65 20 6c 69 6e 65 61 72 2e 29 20 20 53 75 6d 6d 61 72 69 7a 65 20 79 6f 75 72 20 65 78 70 | .be.linear.)..Summarize.your.exp |
| 140140 | 65 72 69 6d 65 6e 74 73 20 62 79 20 66 69 6c 6c 69 6e 67 0a 20 20 20 20 20 69 6e 20 74 68 65 20 | eriments.by.filling......in.the. |
| 140160 | 66 6f 6c 6c 6f 77 69 6e 67 20 74 61 62 6c 65 20 77 69 74 68 20 74 68 65 20 61 70 70 72 6f 70 72 | following.table.with.the.appropr |
| 140180 | 69 61 74 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 65 72 6d 73 0a 20 20 20 20 20 6f | iate.expressions.in.terms......o |
| 1401a0 | 66 20 6e 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4d | f.n:...........................M |
| 1401c0 | 61 78 69 6d 75 6d 20 64 65 70 74 68 20 20 20 20 20 20 20 4e 75 6d 62 65 72 20 6f 66 20 70 75 73 | aximum.depth.......Number.of.pus |
| 1401e0 | 68 65 73 0a 0a 20 20 20 20 20 20 20 20 20 20 52 65 63 75 72 73 69 76 65 0a 20 20 20 20 20 20 20 | hes............Recursive........ |
| 140200 | 20 20 20 66 61 63 74 6f 72 69 61 6c 0a 0a 20 20 20 20 20 20 20 20 20 20 49 74 65 72 61 74 69 76 | ...factorial............Iterativ |
| 140220 | 65 0a 20 20 20 20 20 20 20 20 20 20 66 61 63 74 6f 72 69 61 6c 0a 0a 20 20 20 20 20 54 68 65 20 | e...........factorial.......The. |
| 140240 | 6d 61 78 69 6d 75 6d 20 64 65 70 74 68 20 69 73 20 61 20 6d 65 61 73 75 72 65 20 6f 66 20 74 68 | maximum.depth.is.a.measure.of.th |
| 140260 | 65 20 61 6d 6f 75 6e 74 20 6f 66 20 73 70 61 63 65 20 75 73 65 64 20 62 79 20 74 68 65 0a 20 20 | e.amount.of.space.used.by.the... |
| 140280 | 20 20 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 63 61 72 72 79 69 6e 67 20 6f 75 74 20 74 68 65 | ...evaluator.in.carrying.out.the |
| 1402a0 | 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 0a | .computation,.and.the.number.of. |
| 1402c0 | 20 20 20 20 20 70 75 73 68 65 73 20 63 6f 72 72 65 6c 61 74 65 73 20 77 65 6c 6c 20 77 69 74 68 | .....pushes.correlates.well.with |
| 1402e0 | 20 74 68 65 20 74 69 6d 65 20 72 65 71 75 69 72 65 64 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 | .the.time.required........*Exerc |
| 140300 | 69 73 65 20 35 2e 32 38 3a 2a 20 4d 6f 64 69 66 79 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e | ise.5.28:*.Modify.the.definition |
| 140320 | 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 62 79 0a 20 20 20 20 20 63 68 61 6e 67 69 | .of.the.evaluator.by......changi |
| 140340 | 6e 67 20 60 65 76 61 6c 2d 73 65 71 75 65 6e 63 65 27 20 61 73 20 64 65 73 63 72 69 62 65 64 20 | ng.`eval-sequence'.as.described. |
| 140360 | 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 34 2d 32 3a 3a 20 73 6f 0a 20 20 20 20 | in.section.*Note.5-4-2::.so..... |
| 140380 | 20 74 68 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 69 73 20 6e 6f 20 6c 6f 6e 67 65 72 | .that.the.evaluator.is.no.longer |
| 1403a0 | 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 2e 20 20 52 65 72 75 6e 20 79 6f 75 72 0a 20 20 20 | .tail-recursive...Rerun.your.... |
| 1403c0 | 20 20 65 78 70 65 72 69 6d 65 6e 74 73 20 66 72 6f 6d 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 | ..experiments.from.*Note.Exercis |
| 1403e0 | 65 20 35 2d 32 36 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 32 37 | e.5-26::.and.*Note.Exercise.5-27 |
| 140400 | 3a 3a 0a 20 20 20 20 20 74 6f 20 64 65 6d 6f 6e 73 74 72 61 74 65 20 74 68 61 74 20 62 6f 74 68 | ::......to.demonstrate.that.both |
| 140420 | 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 74 68 65 20 60 66 61 63 74 6f 72 69 61 6c 27 20 70 72 6f | .versions.of.the.`factorial'.pro |
| 140440 | 63 65 64 75 72 65 20 6e 6f 77 0a 20 20 20 20 20 72 65 71 75 69 72 65 20 73 70 61 63 65 20 74 68 | cedure.now......require.space.th |
| 140460 | 61 74 20 67 72 6f 77 73 20 6c 69 6e 65 61 72 6c 79 20 77 69 74 68 20 74 68 65 69 72 20 69 6e 70 | at.grows.linearly.with.their.inp |
| 140480 | 75 74 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 32 39 3a 2a 20 4d 6f 6e 69 74 | ut........*Exercise.5.29:*.Monit |
| 1404a0 | 6f 72 20 74 68 65 20 73 74 61 63 6b 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 74 68 65 0a 20 | or.the.stack.operations.in.the.. |
| 1404c0 | 20 20 20 20 74 72 65 65 2d 72 65 63 75 72 73 69 76 65 20 46 69 62 6f 6e 61 63 63 69 20 63 6f 6d | ....tree-recursive.Fibonacci.com |
| 1404e0 | 70 75 74 61 74 69 6f 6e 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 | putation:............(define.(fi |
| 140500 | 62 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3c 20 6e 20 32 29 0a 20 20 20 | b.n).............(if.(<.n.2).... |
| 140520 | 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | .............n.................( |
| 140540 | 2b 20 28 66 69 62 20 28 2d 20 6e 20 31 29 29 20 28 66 69 62 20 28 2d 20 6e 20 32 29 29 29 29 29 | +.(fib.(-.n.1)).(fib.(-.n.2))))) |
| 140560 | 0a 0a 20 20 20 20 20 20 20 61 2e 20 47 69 76 65 20 61 20 66 6f 72 6d 75 6c 61 20 69 6e 20 74 65 | .........a..Give.a.formula.in.te |
| 140580 | 72 6d 73 20 6f 66 20 6e 20 66 6f 72 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 64 65 70 74 68 20 6f | rms.of.n.for.the.maximum.depth.o |
| 1405a0 | 66 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 73 74 61 63 6b 20 72 65 71 75 69 72 65 64 20 74 | f.the...........stack.required.t |
| 1405c0 | 6f 20 63 6f 6d 70 75 74 65 20 5f 46 69 62 5f 28 6e 29 20 66 6f 72 20 6e 20 3e 3d 20 32 2e 20 20 | o.compute._Fib_(n).for.n.>=.2... |
| 1405e0 | 48 69 6e 74 3a 20 49 6e 0a 20 20 20 20 20 20 20 20 20 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | Hint:.In...........section.*Note |
| 140600 | 20 31 2d 32 2d 32 3a 3a 20 77 65 20 61 72 67 75 65 64 20 74 68 61 74 20 74 68 65 20 73 70 61 63 | .1-2-2::.we.argued.that.the.spac |
| 140620 | 65 20 75 73 65 64 20 62 79 20 74 68 69 73 0a 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 73 73 | e.used.by.this...........process |
| 140640 | 20 67 72 6f 77 73 20 6c 69 6e 65 61 72 6c 79 20 77 69 74 68 20 6e 2e 0a 0a 20 20 20 20 20 20 20 | .grows.linearly.with.n.......... |
| 140660 | 62 2e 20 47 69 76 65 20 61 20 66 6f 72 6d 75 6c 61 20 66 6f 72 20 74 68 65 20 74 6f 74 61 6c 20 | b..Give.a.formula.for.the.total. |
| 140680 | 6e 75 6d 62 65 72 20 6f 66 20 70 75 73 68 65 73 20 75 73 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 | number.of.pushes.used.to.compute |
| 1406a0 | 0a 20 20 20 20 20 20 20 20 20 20 5f 46 69 62 5f 28 6e 29 20 66 6f 72 20 6e 20 3e 3d 20 32 2e 20 | ..........._Fib_(n).for.n.>=.2.. |
| 1406c0 | 20 59 6f 75 20 73 68 6f 75 6c 64 20 66 69 6e 64 20 74 68 61 74 20 74 68 65 20 6e 75 6d 62 65 72 | .You.should.find.that.the.number |
| 1406e0 | 20 6f 66 0a 20 20 20 20 20 20 20 20 20 20 70 75 73 68 65 73 20 28 77 68 69 63 68 20 63 6f 72 72 | .of...........pushes.(which.corr |
| 140700 | 65 6c 61 74 65 73 20 77 65 6c 6c 20 77 69 74 68 20 74 68 65 20 74 69 6d 65 20 75 73 65 64 29 20 | elates.well.with.the.time.used). |
| 140720 | 67 72 6f 77 73 0a 20 20 20 20 20 20 20 20 20 20 65 78 70 6f 6e 65 6e 74 69 61 6c 6c 79 20 77 69 | grows...........exponentially.wi |
| 140740 | 74 68 20 6e 2e 20 20 48 69 6e 74 3a 20 4c 65 74 20 53 28 6e 29 20 62 65 20 74 68 65 20 6e 75 6d | th.n...Hint:.Let.S(n).be.the.num |
| 140760 | 62 65 72 20 6f 66 20 70 75 73 68 65 73 0a 20 20 20 20 20 20 20 20 20 20 75 73 65 64 20 69 6e 20 | ber.of.pushes...........used.in. |
| 140780 | 63 6f 6d 70 75 74 69 6e 67 20 5f 46 69 62 5f 28 6e 29 2e 20 20 59 6f 75 20 73 68 6f 75 6c 64 20 | computing._Fib_(n)...You.should. |
| 1407a0 | 62 65 20 61 62 6c 65 20 74 6f 20 61 72 67 75 65 20 74 68 61 74 0a 20 20 20 20 20 20 20 20 20 20 | be.able.to.argue.that........... |
| 1407c0 | 74 68 65 72 65 20 69 73 20 61 20 66 6f 72 6d 75 6c 61 20 74 68 61 74 20 65 78 70 72 65 73 73 65 | there.is.a.formula.that.expresse |
| 1407e0 | 73 20 53 28 6e 29 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 53 28 6e 20 2d 20 31 29 2c 0a 20 20 20 | s.S(n).in.terms.of.S(n.-.1),.... |
| 140800 | 20 20 20 20 20 20 20 53 28 6e 20 2d 20 32 29 2c 20 61 6e 64 20 73 6f 6d 65 20 66 69 78 65 64 20 | .......S(n.-.2),.and.some.fixed. |
| 140820 | 22 6f 76 65 72 68 65 61 64 22 20 63 6f 6e 73 74 61 6e 74 20 6b 20 74 68 61 74 20 69 73 0a 20 20 | "overhead".constant.k.that.is... |
| 140840 | 20 20 20 20 20 20 20 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 6e 2e 20 20 47 69 76 65 20 | ........independent.of.n...Give. |
| 140860 | 74 68 65 20 66 6f 72 6d 75 6c 61 2c 20 61 6e 64 20 73 61 79 20 77 68 61 74 20 6b 20 69 73 2e 20 | the.formula,.and.say.what.k.is.. |
| 140880 | 20 54 68 65 6e 0a 20 20 20 20 20 20 20 20 20 20 73 68 6f 77 20 74 68 61 74 20 53 28 6e 29 20 63 | .Then...........show.that.S(n).c |
| 1408a0 | 61 6e 20 62 65 20 65 78 70 72 65 73 73 65 64 20 61 73 20 61 20 5f 46 69 62 5f 28 6e 20 2b 20 31 | an.be.expressed.as.a._Fib_(n.+.1 |
| 1408c0 | 29 20 2b 20 62 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 67 69 76 65 20 74 68 65 20 76 61 6c | ).+.b.and...........give.the.val |
| 1408e0 | 75 65 73 20 6f 66 20 61 20 61 6e 64 20 62 2e 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 | ues.of.a.and.b.........*Exercise |
| 140900 | 20 35 2e 33 30 3a 2a 20 4f 75 72 20 65 76 61 6c 75 61 74 6f 72 20 63 75 72 72 65 6e 74 6c 79 20 | .5.30:*.Our.evaluator.currently. |
| 140920 | 63 61 74 63 68 65 73 20 61 6e 64 20 73 69 67 6e 61 6c 73 20 6f 6e 6c 79 0a 20 20 20 20 20 74 77 | catches.and.signals.only......tw |
| 140940 | 6f 20 6b 69 6e 64 73 20 6f 66 20 65 72 72 6f 72 73 2d 2d 75 6e 6b 6e 6f 77 6e 20 65 78 70 72 65 | o.kinds.of.errors--unknown.expre |
| 140960 | 73 73 69 6f 6e 20 74 79 70 65 73 20 61 6e 64 20 75 6e 6b 6e 6f 77 6e 0a 20 20 20 20 20 70 72 6f | ssion.types.and.unknown......pro |
| 140980 | 63 65 64 75 72 65 20 74 79 70 65 73 2e 20 20 4f 74 68 65 72 20 65 72 72 6f 72 73 20 77 69 6c 6c | cedure.types...Other.errors.will |
| 1409a0 | 20 74 61 6b 65 20 75 73 20 6f 75 74 20 6f 66 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 0a 20 20 | .take.us.out.of.the.evaluator... |
| 1409c0 | 20 20 20 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 6e 74 20 6c 6f 6f 70 2e 20 20 57 68 65 6e 20 77 | ...read-eval-print.loop...When.w |
| 1409e0 | 65 20 72 75 6e 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 75 73 69 6e 67 20 74 68 65 0a 20 20 | e.run.the.evaluator.using.the... |
| 140a00 | 20 20 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 73 69 6d 75 6c 61 74 6f 72 2c 20 74 | ...register-machine.simulator,.t |
| 140a20 | 68 65 73 65 20 65 72 72 6f 72 73 20 61 72 65 20 63 61 75 67 68 74 20 62 79 20 74 68 65 0a 20 20 | hese.errors.are.caught.by.the... |
| 140a40 | 20 20 20 75 6e 64 65 72 6c 79 69 6e 67 20 53 63 68 65 6d 65 20 73 79 73 74 65 6d 2e 20 20 54 68 | ...underlying.Scheme.system...Th |
| 140a60 | 69 73 20 69 73 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 74 68 65 20 63 6f 6d 70 75 74 65 72 0a | is.is.analogous.to.the.computer. |
| 140a80 | 20 20 20 20 20 63 72 61 73 68 69 6e 67 20 77 68 65 6e 20 61 20 75 73 65 72 20 70 72 6f 67 72 61 | .....crashing.when.a.user.progra |
| 140aa0 | 6d 20 6d 61 6b 65 73 20 61 6e 20 65 72 72 6f 72 2e 28 34 29 20 20 49 74 20 69 73 20 61 20 6c 61 | m.makes.an.error.(4)..It.is.a.la |
| 140ac0 | 72 67 65 0a 20 20 20 20 20 70 72 6f 6a 65 63 74 20 74 6f 20 6d 61 6b 65 20 61 20 72 65 61 6c 20 | rge......project.to.make.a.real. |
| 140ae0 | 65 72 72 6f 72 20 73 79 73 74 65 6d 20 77 6f 72 6b 2c 20 62 75 74 20 69 74 20 69 73 20 77 65 6c | error.system.work,.but.it.is.wel |
| 140b00 | 6c 20 77 6f 72 74 68 20 74 68 65 0a 20 20 20 20 20 65 66 66 6f 72 74 20 74 6f 20 75 6e 64 65 72 | l.worth.the......effort.to.under |
| 140b20 | 73 74 61 6e 64 20 77 68 61 74 20 69 73 20 69 6e 76 6f 6c 76 65 64 20 68 65 72 65 2e 0a 0a 20 20 | stand.what.is.involved.here..... |
| 140b40 | 20 20 20 20 20 61 2e 20 45 72 72 6f 72 73 20 74 68 61 74 20 6f 63 63 75 72 20 69 6e 20 74 68 65 | .....a..Errors.that.occur.in.the |
| 140b60 | 20 65 76 61 6c 75 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 2c 20 73 75 63 68 20 61 73 20 61 6e 0a | .evaluation.process,.such.as.an. |
| 140b80 | 20 20 20 20 20 20 20 20 20 20 61 74 74 65 6d 70 74 20 74 6f 20 61 63 63 65 73 73 20 61 6e 20 75 | ..........attempt.to.access.an.u |
| 140ba0 | 6e 62 6f 75 6e 64 20 76 61 72 69 61 62 6c 65 2c 20 63 6f 75 6c 64 20 62 65 20 63 61 75 67 68 74 | nbound.variable,.could.be.caught |
| 140bc0 | 20 62 79 0a 20 20 20 20 20 20 20 20 20 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 6c 6f 6f 6b 75 | .by...........changing.the.looku |
| 140be0 | 70 20 6f 70 65 72 61 74 69 6f 6e 20 74 6f 20 6d 61 6b 65 20 69 74 20 72 65 74 75 72 6e 20 61 0a | p.operation.to.make.it.return.a. |
| 140c00 | 20 20 20 20 20 20 20 20 20 20 64 69 73 74 69 6e 67 75 69 73 68 65 64 20 63 6f 6e 64 69 74 69 6f | ..........distinguished.conditio |
| 140c20 | 6e 20 63 6f 64 65 2c 20 77 68 69 63 68 20 63 61 6e 6e 6f 74 20 62 65 20 61 20 70 6f 73 73 69 62 | n.code,.which.cannot.be.a.possib |
| 140c40 | 6c 65 0a 20 20 20 20 20 20 20 20 20 20 76 61 6c 75 65 20 6f 66 20 61 6e 79 20 75 73 65 72 20 76 | le...........value.of.any.user.v |
| 140c60 | 61 72 69 61 62 6c 65 2e 20 20 54 68 65 20 65 76 61 6c 75 61 74 6f 72 20 63 61 6e 20 74 65 73 74 | ariable...The.evaluator.can.test |
| 140c80 | 20 66 6f 72 20 74 68 69 73 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6e 64 69 74 69 6f 6e 20 63 6f | .for.this...........condition.co |
| 140ca0 | 64 65 20 61 6e 64 20 74 68 65 6e 20 64 6f 20 77 68 61 74 20 69 73 20 6e 65 63 65 73 73 61 72 79 | de.and.then.do.what.is.necessary |
| 140cc0 | 20 74 6f 20 67 6f 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 60 73 69 67 6e 61 6c 2d 65 72 72 6f | .to.go.to...........`signal-erro |
| 140ce0 | 72 27 2e 20 20 46 69 6e 64 20 61 6c 6c 20 6f 66 20 74 68 65 20 70 6c 61 63 65 73 20 69 6e 20 74 | r'...Find.all.of.the.places.in.t |
| 140d00 | 68 65 20 65 76 61 6c 75 61 74 6f 72 0a 20 20 20 20 20 20 20 20 20 20 77 68 65 72 65 20 73 75 63 | he.evaluator...........where.suc |
| 140d20 | 68 20 61 20 63 68 61 6e 67 65 20 69 73 20 6e 65 63 65 73 73 61 72 79 20 61 6e 64 20 66 69 78 20 | h.a.change.is.necessary.and.fix. |
| 140d40 | 74 68 65 6d 2e 20 20 54 68 69 73 20 69 73 20 6c 6f 74 73 0a 20 20 20 20 20 20 20 20 20 20 6f 66 | them...This.is.lots...........of |
| 140d60 | 20 77 6f 72 6b 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 4d 75 63 68 20 77 6f 72 73 65 20 69 73 20 | .work..........b..Much.worse.is. |
| 140d80 | 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 68 61 6e 64 6c 69 6e 67 20 65 72 72 6f 72 73 20 74 | the.problem.of.handling.errors.t |
| 140da0 | 68 61 74 20 61 72 65 0a 20 20 20 20 20 20 20 20 20 20 73 69 67 6e 61 6c 65 64 20 62 79 20 61 70 | hat.are...........signaled.by.ap |
| 140dc0 | 70 6c 79 69 6e 67 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 2c 20 73 75 63 | plying.primitive.procedures,.suc |
| 140de0 | 68 20 61 73 20 61 6e 20 61 74 74 65 6d 70 74 0a 20 20 20 20 20 20 20 20 20 20 74 6f 20 64 69 76 | h.as.an.attempt...........to.div |
| 140e00 | 69 64 65 20 62 79 20 7a 65 72 6f 20 6f 72 20 61 6e 20 61 74 74 65 6d 70 74 20 74 6f 20 65 78 74 | ide.by.zero.or.an.attempt.to.ext |
| 140e20 | 72 61 63 74 20 74 68 65 20 60 63 61 72 27 20 6f 66 20 61 0a 20 20 20 20 20 20 20 20 20 20 73 79 | ract.the.`car'.of.a...........sy |
| 140e40 | 6d 62 6f 6c 2e 20 20 49 6e 20 61 20 70 72 6f 66 65 73 73 69 6f 6e 61 6c 6c 79 20 77 72 69 74 74 | mbol...In.a.professionally.writt |
| 140e60 | 65 6e 20 68 69 67 68 2d 71 75 61 6c 69 74 79 20 73 79 73 74 65 6d 2c 0a 20 20 20 20 20 20 20 20 | en.high-quality.system,......... |
| 140e80 | 20 20 65 61 63 68 20 70 72 69 6d 69 74 69 76 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 69 73 20 | ..each.primitive.application.is. |
| 140ea0 | 63 68 65 63 6b 65 64 20 66 6f 72 20 73 61 66 65 74 79 20 61 73 20 70 61 72 74 20 6f 66 0a 20 20 | checked.for.safety.as.part.of... |
| 140ec0 | 20 20 20 20 20 20 20 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 2e 20 20 46 6f 72 20 65 78 61 6d | ........the.primitive...For.exam |
| 140ee0 | 70 6c 65 2c 20 65 76 65 72 79 20 63 61 6c 6c 20 74 6f 20 60 63 61 72 27 20 63 6f 75 6c 64 20 66 | ple,.every.call.to.`car'.could.f |
| 140f00 | 69 72 73 74 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 63 6b 20 74 68 61 74 20 74 68 65 20 61 72 | irst...........check.that.the.ar |
| 140f20 | 67 75 6d 65 6e 74 20 69 73 20 61 20 70 61 69 72 2e 20 20 49 66 20 74 68 65 20 61 72 67 75 6d 65 | gument.is.a.pair...If.the.argume |
| 140f40 | 6e 74 20 69 73 20 6e 6f 74 20 61 0a 20 20 20 20 20 20 20 20 20 20 70 61 69 72 2c 20 74 68 65 20 | nt.is.not.a...........pair,.the. |
| 140f60 | 61 70 70 6c 69 63 61 74 69 6f 6e 20 77 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 20 64 69 73 74 69 | application.would.return.a.disti |
| 140f80 | 6e 67 75 69 73 68 65 64 20 63 6f 6e 64 69 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 20 20 63 6f 64 | nguished.condition...........cod |
| 140fa0 | 65 20 74 6f 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 2c 20 77 68 69 63 68 20 77 6f 75 6c 64 20 | e.to.the.evaluator,.which.would. |
| 140fc0 | 74 68 65 6e 20 72 65 70 6f 72 74 20 74 68 65 20 66 61 69 6c 75 72 65 2e 0a 20 20 20 20 20 20 20 | then.report.the.failure......... |
| 140fe0 | 20 20 20 57 65 20 63 6f 75 6c 64 20 61 72 72 61 6e 67 65 20 66 6f 72 20 74 68 69 73 20 69 6e 20 | ...We.could.arrange.for.this.in. |
| 141000 | 6f 75 72 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 73 69 6d 75 6c 61 74 6f 72 20 62 | our.register-machine.simulator.b |
| 141020 | 79 0a 20 20 20 20 20 20 20 20 20 20 6d 61 6b 69 6e 67 20 65 61 63 68 20 70 72 69 6d 69 74 69 76 | y...........making.each.primitiv |
| 141040 | 65 20 70 72 6f 63 65 64 75 72 65 20 63 68 65 63 6b 20 66 6f 72 20 61 70 70 6c 69 63 61 62 69 6c | e.procedure.check.for.applicabil |
| 141060 | 69 74 79 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 69 6e 67 20 61 6e 20 61 | ity.and...........returning.an.a |
| 141080 | 70 70 72 6f 70 72 69 61 74 65 20 64 69 73 74 69 6e 67 75 69 73 68 65 64 20 63 6f 6e 64 69 74 69 | ppropriate.distinguished.conditi |
| 1410a0 | 6f 6e 20 63 6f 64 65 20 6f 6e 0a 20 20 20 20 20 20 20 20 20 20 66 61 69 6c 75 72 65 2e 20 54 68 | on.code.on...........failure..Th |
| 1410c0 | 65 6e 20 74 68 65 20 60 70 72 69 6d 69 74 69 76 65 2d 61 70 70 6c 79 27 20 63 6f 64 65 20 69 6e | en.the.`primitive-apply'.code.in |
| 1410e0 | 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 63 61 6e 0a 20 20 20 20 20 20 20 20 20 20 63 68 65 | .the.evaluator.can...........che |
| 141100 | 63 6b 20 66 6f 72 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 20 63 6f 64 65 20 61 6e 64 20 67 6f | ck.for.the.condition.code.and.go |
| 141120 | 20 74 6f 20 60 73 69 67 6e 61 6c 2d 65 72 72 6f 72 27 20 69 66 0a 20 20 20 20 20 20 20 20 20 20 | .to.`signal-error'.if........... |
| 141140 | 6e 65 63 65 73 73 61 72 79 2e 20 20 42 75 69 6c 64 20 74 68 69 73 20 73 74 72 75 63 74 75 72 65 | necessary...Build.this.structure |
| 141160 | 20 61 6e 64 20 6d 61 6b 65 20 69 74 20 77 6f 72 6b 2e 20 20 54 68 69 73 20 69 73 20 61 0a 20 20 | .and.make.it.work...This.is.a... |
| 141180 | 20 20 20 20 20 20 20 20 6d 61 6a 6f 72 20 70 72 6f 6a 65 63 74 2e 0a 0a 0a 20 20 20 2d 2d 2d 2d | ........major.project.......---- |
| 1411a0 | 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 | ------.Footnotes.----------..... |
| 1411c0 | 28 31 29 20 57 65 20 61 73 73 75 6d 65 20 68 65 72 65 20 74 68 61 74 20 60 72 65 61 64 27 20 61 | (1).We.assume.here.that.`read'.a |
| 1411e0 | 6e 64 20 74 68 65 20 76 61 72 69 6f 75 73 20 70 72 69 6e 74 69 6e 67 20 6f 70 65 72 61 74 69 6f | nd.the.various.printing.operatio |
| 141200 | 6e 73 0a 61 72 65 20 61 76 61 69 6c 61 62 6c 65 20 61 73 20 70 72 69 6d 69 74 69 76 65 20 6d 61 | ns.are.available.as.primitive.ma |
| 141220 | 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 77 68 69 63 68 20 69 73 20 75 73 65 66 75 | chine.operations,.which.is.usefu |
| 141240 | 6c 20 66 6f 72 20 6f 75 72 0a 73 69 6d 75 6c 61 74 69 6f 6e 2c 20 62 75 74 20 63 6f 6d 70 6c 65 | l.for.our.simulation,.but.comple |
| 141260 | 74 65 6c 79 20 75 6e 72 65 61 6c 69 73 74 69 63 20 69 6e 20 70 72 61 63 74 69 63 65 2e 20 20 54 | tely.unrealistic.in.practice...T |
| 141280 | 68 65 73 65 20 61 72 65 20 61 63 74 75 61 6c 6c 79 0a 65 78 74 72 65 6d 65 6c 79 20 63 6f 6d 70 | hese.are.actually.extremely.comp |
| 1412a0 | 6c 65 78 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 49 6e 20 70 72 61 63 74 69 63 65 2c 20 74 68 | lex.operations...In.practice,.th |
| 1412c0 | 65 79 20 77 6f 75 6c 64 20 62 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 0a 75 73 69 6e 67 20 6c 6f | ey.would.be.implemented.using.lo |
| 1412e0 | 77 2d 6c 65 76 65 6c 20 69 6e 70 75 74 2d 6f 75 74 70 75 74 20 6f 70 65 72 61 74 69 6f 6e 73 20 | w-level.input-output.operations. |
| 141300 | 73 75 63 68 20 61 73 20 74 72 61 6e 73 66 65 72 72 69 6e 67 20 73 69 6e 67 6c 65 0a 63 68 61 72 | such.as.transferring.single.char |
| 141320 | 61 63 74 65 72 73 20 74 6f 20 61 6e 64 20 66 72 6f 6d 20 61 20 64 65 76 69 63 65 2e 0a 0a 20 20 | acters.to.and.from.a.device..... |
| 141340 | 20 54 6f 20 73 75 70 70 6f 72 74 20 74 68 65 20 60 67 65 74 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 | .To.support.the.`get-global-envi |
| 141360 | 72 6f 6e 6d 65 6e 74 27 20 6f 70 65 72 61 74 69 6f 6e 20 77 65 20 64 65 66 69 6e 65 0a 0a 20 20 | ronment'.operation.we.define.... |
| 141380 | 20 20 20 28 64 65 66 69 6e 65 20 74 68 65 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e | ...(define.the-global-environmen |
| 1413a0 | 74 20 28 73 65 74 75 70 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 29 0a 0a 20 20 20 20 20 28 64 65 | t.(setup-environment)).......(de |
| 1413c0 | 66 69 6e 65 20 28 67 65 74 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 0a 20 20 | fine.(get-global-environment)... |
| 1413e0 | 20 20 20 20 20 74 68 65 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 0a 0a 20 20 | .....the-global-environment).... |
| 141400 | 20 28 32 29 20 54 68 65 72 65 20 61 72 65 20 6f 74 68 65 72 20 65 72 72 6f 72 73 20 74 68 61 74 | .(2).There.are.other.errors.that |
| 141420 | 20 77 65 20 77 6f 75 6c 64 20 6c 69 6b 65 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 | .we.would.like.the.interpreter.t |
| 141440 | 6f 0a 68 61 6e 64 6c 65 2c 20 62 75 74 20 74 68 65 73 65 20 61 72 65 20 6e 6f 74 20 73 6f 20 73 | o.handle,.but.these.are.not.so.s |
| 141460 | 69 6d 70 6c 65 2e 20 20 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 33 30 3a | imple...See.*Note.Exercise.5-30: |
| 141480 | 3a 2e 0a 0a 20 20 20 28 33 29 20 57 65 20 63 6f 75 6c 64 20 70 65 72 66 6f 72 6d 20 74 68 65 20 | :......(3).We.could.perform.the. |
| 1414a0 | 73 74 61 63 6b 20 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 20 6f 6e 6c 79 20 61 66 74 65 72 20 | stack.initialization.only.after. |
| 1414c0 | 65 72 72 6f 72 73 2c 20 62 75 74 0a 64 6f 69 6e 67 20 69 74 20 69 6e 20 74 68 65 20 64 72 69 76 | errors,.but.doing.it.in.the.driv |
| 1414e0 | 65 72 20 6c 6f 6f 70 20 77 69 6c 6c 20 62 65 20 63 6f 6e 76 65 6e 69 65 6e 74 20 66 6f 72 20 6d | er.loop.will.be.convenient.for.m |
| 141500 | 6f 6e 69 74 6f 72 69 6e 67 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 27 73 20 70 65 72 66 6f 72 | onitoring.the.evaluator's.perfor |
| 141520 | 6d 61 6e 63 65 2c 20 61 73 20 64 65 73 63 72 69 62 65 64 20 62 65 6c 6f 77 2e 0a 0a 20 20 20 28 | mance,.as.described.below......( |
| 141540 | 34 29 20 52 65 67 72 65 74 74 61 62 6c 79 2c 20 74 68 69 73 20 69 73 20 74 68 65 20 6e 6f 72 6d | 4).Regrettably,.this.is.the.norm |
| 141560 | 61 6c 20 73 74 61 74 65 20 6f 66 20 61 66 66 61 69 72 73 20 69 6e 20 63 6f 6e 76 65 6e 74 69 6f | al.state.of.affairs.in.conventio |
| 141580 | 6e 61 6c 0a 63 6f 6d 70 69 6c 65 72 2d 62 61 73 65 64 20 6c 61 6e 67 75 61 67 65 20 73 79 73 74 | nal.compiler-based.language.syst |
| 1415a0 | 65 6d 73 20 73 75 63 68 20 61 73 20 43 2e 20 20 49 6e 20 55 4e 49 58 28 74 6d 29 20 74 68 65 20 | ems.such.as.C...In.UNIX(tm).the. |
| 1415c0 | 73 79 73 74 65 6d 0a 22 64 75 6d 70 73 20 63 6f 72 65 2c 22 20 61 6e 64 20 69 6e 20 44 4f 53 2f | system."dumps.core,".and.in.DOS/ |
| 1415e0 | 57 69 6e 64 6f 77 73 28 74 6d 29 20 69 74 20 62 65 63 6f 6d 65 73 20 63 61 74 61 74 6f 6e 69 63 | Windows(tm).it.becomes.catatonic |
| 141600 | 2e 20 20 54 68 65 0a 4d 61 63 69 6e 74 6f 73 68 28 74 6d 29 20 64 69 73 70 6c 61 79 73 20 61 20 | ...The.Macintosh(tm).displays.a. |
| 141620 | 70 69 63 74 75 72 65 20 6f 66 20 61 6e 20 65 78 70 6c 6f 64 69 6e 67 20 62 6f 6d 62 20 61 6e 64 | picture.of.an.exploding.bomb.and |
| 141640 | 20 6f 66 66 65 72 73 20 79 6f 75 0a 74 68 65 20 6f 70 70 6f 72 74 75 6e 69 74 79 20 74 6f 20 72 | .offers.you.the.opportunity.to.r |
| 141660 | 65 62 6f 6f 74 20 74 68 65 20 63 6f 6d 70 75 74 65 72 2d 2d 69 66 20 79 6f 75 27 72 65 20 6c 75 | eboot.the.computer--if.you're.lu |
| 141680 | 63 6b 79 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 | cky.....File:.sicp.info,..Node:. |
| 1416a0 | 35 2d 35 2c 20 20 50 72 65 76 3a 20 35 2d 34 2c 20 20 55 70 3a 20 43 68 61 70 74 65 72 20 35 0a | 5-5,..Prev:.5-4,..Up:.Chapter.5. |
| 1416c0 | 0a 35 2e 35 20 43 6f 6d 70 69 6c 61 74 69 6f 6e 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d | .5.5.Compilation.=============== |
| 1416e0 | 0a 0a 54 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 | ..The.explicit-control.evaluator |
| 141700 | 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 34 3a 3a 20 69 73 20 61 20 72 65 67 | .of.section.*Note.5-4::.is.a.reg |
| 141720 | 69 73 74 65 72 0a 6d 61 63 68 69 6e 65 20 77 68 6f 73 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 69 | ister.machine.whose.controller.i |
| 141740 | 6e 74 65 72 70 72 65 74 73 20 53 63 68 65 6d 65 20 70 72 6f 67 72 61 6d 73 2e 20 20 49 6e 20 74 | nterprets.Scheme.programs...In.t |
| 141760 | 68 69 73 20 73 65 63 74 69 6f 6e 0a 77 65 20 77 69 6c 6c 20 73 65 65 20 68 6f 77 20 74 6f 20 72 | his.section.we.will.see.how.to.r |
| 141780 | 75 6e 20 53 63 68 65 6d 65 20 70 72 6f 67 72 61 6d 73 20 6f 6e 20 61 20 72 65 67 69 73 74 65 72 | un.Scheme.programs.on.a.register |
| 1417a0 | 20 6d 61 63 68 69 6e 65 20 77 68 6f 73 65 0a 63 6f 6e 74 72 6f 6c 6c 65 72 20 69 73 20 6e 6f 74 | .machine.whose.controller.is.not |
| 1417c0 | 20 61 20 53 63 68 65 6d 65 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0a 0a 20 20 20 54 68 65 20 65 | .a.Scheme.interpreter......The.e |
| 1417e0 | 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e | xplicit-control.evaluator.machin |
| 141800 | 65 20 69 73 20 75 6e 69 76 65 72 73 61 6c 2d 2d 69 74 20 63 61 6e 20 63 61 72 72 79 0a 6f 75 74 | e.is.universal--it.can.carry.out |
| 141820 | 20 61 6e 79 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 70 72 6f 63 65 73 73 20 74 68 61 74 20 | .any.computational.process.that. |
| 141840 | 63 61 6e 20 62 65 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 53 63 68 65 6d 65 2e 20 20 54 68 65 | can.be.described.in.Scheme...The |
| 141860 | 0a 65 76 61 6c 75 61 74 6f 72 27 73 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 6f 72 63 68 65 73 74 72 | .evaluator's.controller.orchestr |
| 141880 | 61 74 65 73 20 74 68 65 20 75 73 65 20 6f 66 20 69 74 73 20 64 61 74 61 20 70 61 74 68 73 20 74 | ates.the.use.of.its.data.paths.t |
| 1418a0 | 6f 0a 70 65 72 66 6f 72 6d 20 74 68 65 20 64 65 73 69 72 65 64 20 63 6f 6d 70 75 74 61 74 69 6f | o.perform.the.desired.computatio |
| 1418c0 | 6e 2e 20 20 54 68 75 73 2c 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 27 73 20 64 61 74 61 20 70 | n...Thus,.the.evaluator's.data.p |
| 1418e0 | 61 74 68 73 20 61 72 65 0a 75 6e 69 76 65 72 73 61 6c 3a 20 54 68 65 79 20 61 72 65 20 73 75 66 | aths.are.universal:.They.are.suf |
| 141900 | 66 69 63 69 65 6e 74 20 74 6f 20 70 65 72 66 6f 72 6d 20 61 6e 79 20 63 6f 6d 70 75 74 61 74 69 | ficient.to.perform.any.computati |
| 141920 | 6f 6e 20 77 65 20 64 65 73 69 72 65 2c 0a 67 69 76 65 6e 20 61 6e 20 61 70 70 72 6f 70 72 69 61 | on.we.desire,.given.an.appropria |
| 141940 | 74 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 2e 28 31 29 0a 0a 20 20 20 43 6f 6d 6d 65 72 63 69 61 6c | te.controller.(1).....Commercial |
| 141960 | 20 67 65 6e 65 72 61 6c 2d 70 75 72 70 6f 73 65 20 63 6f 6d 70 75 74 65 72 73 20 61 72 65 20 72 | .general-purpose.computers.are.r |
| 141980 | 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 73 20 6f 72 67 61 6e 69 7a 65 64 0a 61 72 6f 75 6e | egister.machines.organized.aroun |
| 1419a0 | 64 20 61 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 72 65 67 69 73 74 65 72 73 20 61 6e 64 20 | d.a.collection.of.registers.and. |
| 1419c0 | 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 63 6f 6e 73 74 69 74 75 74 65 20 61 6e 0a 65 66 | operations.that.constitute.an.ef |
| 1419e0 | 66 69 63 69 65 6e 74 20 61 6e 64 20 63 6f 6e 76 65 6e 69 65 6e 74 20 75 6e 69 76 65 72 73 61 6c | ficient.and.convenient.universal |
| 141a00 | 20 73 65 74 20 6f 66 20 64 61 74 61 20 70 61 74 68 73 2e 20 20 54 68 65 20 63 6f 6e 74 72 6f 6c | .set.of.data.paths...The.control |
| 141a20 | 6c 65 72 0a 66 6f 72 20 61 20 67 65 6e 65 72 61 6c 2d 70 75 72 70 6f 73 65 20 6d 61 63 68 69 6e | ler.for.a.general-purpose.machin |
| 141a40 | 65 20 69 73 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 66 6f 72 20 61 20 72 65 67 69 73 74 | e.is.an.interpreter.for.a.regist |
| 141a60 | 65 72 2d 6d 61 63 68 69 6e 65 0a 6c 61 6e 67 75 61 67 65 20 6c 69 6b 65 20 74 68 65 20 6f 6e 65 | er-machine.language.like.the.one |
| 141a80 | 20 77 65 20 68 61 76 65 20 62 65 65 6e 20 75 73 69 6e 67 2e 20 20 54 68 69 73 20 6c 61 6e 67 75 | .we.have.been.using...This.langu |
| 141aa0 | 61 67 65 20 69 73 20 63 61 6c 6c 65 64 20 74 68 65 20 22 6e 61 74 69 76 65 0a 6c 61 6e 67 75 61 | age.is.called.the."native.langua |
| 141ac0 | 67 65 22 20 6f 66 20 74 68 65 20 6d 61 63 68 69 6e 65 2c 20 6f 72 20 73 69 6d 70 6c 79 20 22 6d | ge".of.the.machine,.or.simply."m |
| 141ae0 | 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 22 2e 20 20 50 72 6f 67 72 61 6d 73 0a 77 72 69 74 | achine.language"...Programs.writ |
| 141b00 | 74 65 6e 20 69 6e 20 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 20 61 72 65 20 73 65 71 75 | ten.in.machine.language.are.sequ |
| 141b20 | 65 6e 63 65 73 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 68 61 74 20 75 73 65 20 74 | ences.of.instructions.that.use.t |
| 141b40 | 68 65 0a 6d 61 63 68 69 6e 65 27 73 20 64 61 74 61 20 70 61 74 68 73 2e 20 20 46 6f 72 20 65 78 | he.machine's.data.paths...For.ex |
| 141b60 | 61 6d 70 6c 65 2c 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c | ample,.the.explicit-control.eval |
| 141b80 | 75 61 74 6f 72 27 73 0a 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 63 61 6e | uator's.instruction.sequence.can |
| 141ba0 | 20 62 65 20 74 68 6f 75 67 68 74 20 6f 66 20 61 73 20 61 20 6d 61 63 68 69 6e 65 2d 6c 61 6e 67 | .be.thought.of.as.a.machine-lang |
| 141bc0 | 75 61 67 65 20 70 72 6f 67 72 61 6d 0a 66 6f 72 20 61 20 67 65 6e 65 72 61 6c 2d 70 75 72 70 6f | uage.program.for.a.general-purpo |
| 141be0 | 73 65 20 63 6f 6d 70 75 74 65 72 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 73 20 74 68 65 20 63 | se.computer.rather.than.as.the.c |
| 141c00 | 6f 6e 74 72 6f 6c 6c 65 72 20 66 6f 72 20 61 0a 73 70 65 63 69 61 6c 69 7a 65 64 20 69 6e 74 65 | ontroller.for.a.specialized.inte |
| 141c20 | 72 70 72 65 74 65 72 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 54 68 65 72 65 20 61 72 65 20 74 | rpreter.machine......There.are.t |
| 141c40 | 77 6f 20 63 6f 6d 6d 6f 6e 20 73 74 72 61 74 65 67 69 65 73 20 66 6f 72 20 62 72 69 64 67 69 6e | wo.common.strategies.for.bridgin |
| 141c60 | 67 20 74 68 65 20 67 61 70 20 62 65 74 77 65 65 6e 0a 68 69 67 68 65 72 2d 6c 65 76 65 6c 20 6c | g.the.gap.between.higher-level.l |
| 141c80 | 61 6e 67 75 61 67 65 73 20 61 6e 64 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 20 6c 61 | anguages.and.register-machine.la |
| 141ca0 | 6e 67 75 61 67 65 73 2e 20 20 54 68 65 0a 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 | nguages...The.explicit-control.e |
| 141cc0 | 76 61 6c 75 61 74 6f 72 20 69 6c 6c 75 73 74 72 61 74 65 73 20 74 68 65 20 73 74 72 61 74 65 67 | valuator.illustrates.the.strateg |
| 141ce0 | 79 20 6f 66 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 2e 0a 41 6e 20 69 6e 74 65 72 70 72 65 | y.of.interpretation..An.interpre |
| 141d00 | 74 65 72 20 77 72 69 74 74 65 6e 20 69 6e 20 74 68 65 20 6e 61 74 69 76 65 20 6c 61 6e 67 75 61 | ter.written.in.the.native.langua |
| 141d20 | 67 65 20 6f 66 20 61 20 6d 61 63 68 69 6e 65 20 63 6f 6e 66 69 67 75 72 65 73 0a 74 68 65 20 6d | ge.of.a.machine.configures.the.m |
| 141d40 | 61 63 68 69 6e 65 20 74 6f 20 65 78 65 63 75 74 65 20 70 72 6f 67 72 61 6d 73 20 77 72 69 74 74 | achine.to.execute.programs.writt |
| 141d60 | 65 6e 20 69 6e 20 61 20 6c 61 6e 67 75 61 67 65 20 28 63 61 6c 6c 65 64 20 74 68 65 20 22 73 6f | en.in.a.language.(called.the."so |
| 141d80 | 75 72 63 65 0a 6c 61 6e 67 75 61 67 65 22 29 20 74 68 61 74 20 6d 61 79 20 64 69 66 66 65 72 20 | urce.language").that.may.differ. |
| 141da0 | 66 72 6f 6d 20 74 68 65 20 6e 61 74 69 76 65 20 6c 61 6e 67 75 61 67 65 20 6f 66 20 74 68 65 20 | from.the.native.language.of.the. |
| 141dc0 | 6d 61 63 68 69 6e 65 0a 70 65 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f | machine.performing.the.evaluatio |
| 141de0 | 6e 2e 20 20 54 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 20 6f 66 20 | n...The.primitive.procedures.of. |
| 141e00 | 74 68 65 20 73 6f 75 72 63 65 0a 6c 61 6e 67 75 61 67 65 20 61 72 65 20 69 6d 70 6c 65 6d 65 6e | the.source.language.are.implemen |
| 141e20 | 74 65 64 20 61 73 20 61 20 6c 69 62 72 61 72 79 20 6f 66 20 73 75 62 72 6f 75 74 69 6e 65 73 20 | ted.as.a.library.of.subroutines. |
| 141e40 | 77 72 69 74 74 65 6e 20 69 6e 20 74 68 65 0a 6e 61 74 69 76 65 20 6c 61 6e 67 75 61 67 65 20 6f | written.in.the.native.language.o |
| 141e60 | 66 20 74 68 65 20 67 69 76 65 6e 20 6d 61 63 68 69 6e 65 2e 20 20 41 20 70 72 6f 67 72 61 6d 20 | f.the.given.machine...A.program. |
| 141e80 | 74 6f 20 62 65 20 69 6e 74 65 72 70 72 65 74 65 64 0a 28 63 61 6c 6c 65 64 20 74 68 65 20 22 73 | to.be.interpreted.(called.the."s |
| 141ea0 | 6f 75 72 63 65 20 70 72 6f 67 72 61 6d 22 29 20 69 73 20 72 65 70 72 65 73 65 6e 74 65 64 20 61 | ource.program").is.represented.a |
| 141ec0 | 73 20 61 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 2e 20 20 54 68 65 0a 69 6e 74 65 72 70 72 | s.a.data.structure...The.interpr |
| 141ee0 | 65 74 65 72 20 74 72 61 76 65 72 73 65 73 20 74 68 69 73 20 64 61 74 61 20 73 74 72 75 63 74 75 | eter.traverses.this.data.structu |
| 141f00 | 72 65 2c 20 61 6e 61 6c 79 7a 69 6e 67 20 74 68 65 20 73 6f 75 72 63 65 0a 70 72 6f 67 72 61 6d | re,.analyzing.the.source.program |
| 141f20 | 2e 20 20 41 73 20 69 74 20 64 6f 65 73 20 73 6f 2c 20 69 74 20 73 69 6d 75 6c 61 74 65 73 20 74 | ...As.it.does.so,.it.simulates.t |
| 141f40 | 68 65 20 69 6e 74 65 6e 64 65 64 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 0a 73 6f 75 72 | he.intended.behavior.of.the.sour |
| 141f60 | 63 65 20 70 72 6f 67 72 61 6d 20 62 79 20 63 61 6c 6c 69 6e 67 20 61 70 70 72 6f 70 72 69 61 74 | ce.program.by.calling.appropriat |
| 141f80 | 65 20 70 72 69 6d 69 74 69 76 65 20 73 75 62 72 6f 75 74 69 6e 65 73 20 66 72 6f 6d 20 74 68 65 | e.primitive.subroutines.from.the |
| 141fa0 | 0a 6c 69 62 72 61 72 79 2e 0a 0a 20 20 20 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 20 77 | .library......In.this.section,.w |
| 141fc0 | 65 20 65 78 70 6c 6f 72 65 20 74 68 65 20 61 6c 74 65 72 6e 61 74 69 76 65 20 73 74 72 61 74 65 | e.explore.the.alternative.strate |
| 141fe0 | 67 79 20 6f 66 20 22 63 6f 6d 70 69 6c 61 74 69 6f 6e 22 2e 0a 41 20 63 6f 6d 70 69 6c 65 72 20 | gy.of."compilation"..A.compiler. |
| 142000 | 66 6f 72 20 61 20 67 69 76 65 6e 20 73 6f 75 72 63 65 20 6c 61 6e 67 75 61 67 65 20 61 6e 64 20 | for.a.given.source.language.and. |
| 142020 | 6d 61 63 68 69 6e 65 20 74 72 61 6e 73 6c 61 74 65 73 20 61 20 73 6f 75 72 63 65 0a 70 72 6f 67 | machine.translates.a.source.prog |
| 142040 | 72 61 6d 20 69 6e 74 6f 20 61 6e 20 65 71 75 69 76 61 6c 65 6e 74 20 70 72 6f 67 72 61 6d 20 28 | ram.into.an.equivalent.program.( |
| 142060 | 63 61 6c 6c 65 64 20 74 68 65 20 22 6f 62 6a 65 63 74 20 70 72 6f 67 72 61 6d 22 29 0a 77 72 69 | called.the."object.program").wri |
| 142080 | 74 74 65 6e 20 69 6e 20 74 68 65 20 6d 61 63 68 69 6e 65 27 73 20 6e 61 74 69 76 65 20 6c 61 6e | tten.in.the.machine's.native.lan |
| 1420a0 | 67 75 61 67 65 2e 20 20 54 68 65 20 63 6f 6d 70 69 6c 65 72 20 74 68 61 74 20 77 65 0a 69 6d 70 | guage...The.compiler.that.we.imp |
| 1420c0 | 6c 65 6d 65 6e 74 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 74 72 61 6e 73 6c 61 74 65 | lement.in.this.section.translate |
| 1420e0 | 73 20 70 72 6f 67 72 61 6d 73 20 77 72 69 74 74 65 6e 20 69 6e 20 53 63 68 65 6d 65 20 69 6e 74 | s.programs.written.in.Scheme.int |
| 142100 | 6f 0a 73 65 71 75 65 6e 63 65 73 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 6f 20 62 | o.sequences.of.instructions.to.b |
| 142120 | 65 20 65 78 65 63 75 74 65 64 20 75 73 69 6e 67 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f | e.executed.using.the.explicit-co |
| 142140 | 6e 74 72 6f 6c 0a 65 76 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 27 73 20 64 61 74 61 20 70 | ntrol.evaluator.machine's.data.p |
| 142160 | 61 74 68 73 2e 28 32 29 0a 0a 20 20 20 43 6f 6d 70 61 72 65 64 20 77 69 74 68 20 69 6e 74 65 72 | aths.(2).....Compared.with.inter |
| 142180 | 70 72 65 74 61 74 69 6f 6e 2c 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 63 61 6e 20 70 72 6f 76 69 | pretation,.compilation.can.provi |
| 1421a0 | 64 65 20 61 20 67 72 65 61 74 0a 69 6e 63 72 65 61 73 65 20 69 6e 20 74 68 65 20 65 66 66 69 63 | de.a.great.increase.in.the.effic |
| 1421c0 | 69 65 6e 63 79 20 6f 66 20 70 72 6f 67 72 61 6d 20 65 78 65 63 75 74 69 6f 6e 2c 20 61 73 20 77 | iency.of.program.execution,.as.w |
| 1421e0 | 65 20 77 69 6c 6c 20 65 78 70 6c 61 69 6e 0a 62 65 6c 6f 77 20 69 6e 20 74 68 65 20 6f 76 65 72 | e.will.explain.below.in.the.over |
| 142200 | 76 69 65 77 20 6f 66 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 2e 20 20 4f 6e 20 74 68 65 20 6f 74 | view.of.the.compiler...On.the.ot |
| 142220 | 68 65 72 20 68 61 6e 64 2c 20 61 6e 0a 69 6e 74 65 72 70 72 65 74 65 72 20 70 72 6f 76 69 64 65 | her.hand,.an.interpreter.provide |
| 142240 | 73 20 61 20 6d 6f 72 65 20 70 6f 77 65 72 66 75 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 66 6f | s.a.more.powerful.environment.fo |
| 142260 | 72 20 69 6e 74 65 72 61 63 74 69 76 65 0a 70 72 6f 67 72 61 6d 20 64 65 76 65 6c 6f 70 6d 65 6e | r.interactive.program.developmen |
| 142280 | 74 20 61 6e 64 20 64 65 62 75 67 67 69 6e 67 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 73 6f 75 | t.and.debugging,.because.the.sou |
| 1422a0 | 72 63 65 20 70 72 6f 67 72 61 6d 20 62 65 69 6e 67 0a 65 78 65 63 75 74 65 64 20 69 73 20 61 76 | rce.program.being.executed.is.av |
| 1422c0 | 61 69 6c 61 62 6c 65 20 61 74 20 72 75 6e 20 74 69 6d 65 20 74 6f 20 62 65 20 65 78 61 6d 69 6e | ailable.at.run.time.to.be.examin |
| 1422e0 | 65 64 20 61 6e 64 20 6d 6f 64 69 66 69 65 64 2e 20 20 49 6e 0a 61 64 64 69 74 69 6f 6e 2c 20 62 | ed.and.modified...In.addition,.b |
| 142300 | 65 63 61 75 73 65 20 74 68 65 20 65 6e 74 69 72 65 20 6c 69 62 72 61 72 79 20 6f 66 20 70 72 69 | ecause.the.entire.library.of.pri |
| 142320 | 6d 69 74 69 76 65 73 20 69 73 20 70 72 65 73 65 6e 74 2c 20 6e 65 77 0a 70 72 6f 67 72 61 6d 73 | mitives.is.present,.new.programs |
| 142340 | 20 63 61 6e 20 62 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 61 6e 64 20 61 64 64 65 64 20 74 6f | .can.be.constructed.and.added.to |
| 142360 | 20 74 68 65 20 73 79 73 74 65 6d 20 64 75 72 69 6e 67 20 64 65 62 75 67 67 69 6e 67 2e 0a 0a 20 | .the.system.during.debugging.... |
| 142380 | 20 20 49 6e 20 76 69 65 77 20 6f 66 20 74 68 65 20 63 6f 6d 70 6c 65 6d 65 6e 74 61 72 79 20 61 | ..In.view.of.the.complementary.a |
| 1423a0 | 64 76 61 6e 74 61 67 65 73 20 6f 66 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 61 6e 64 0a 69 6e 74 | dvantages.of.compilation.and.int |
| 1423c0 | 65 72 70 72 65 74 61 74 69 6f 6e 2c 20 6d 6f 64 65 72 6e 20 70 72 6f 67 72 61 6d 2d 64 65 76 65 | erpretation,.modern.program-deve |
| 1423e0 | 6c 6f 70 6d 65 6e 74 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 70 75 72 73 75 65 20 61 20 6d 69 | lopment.environments.pursue.a.mi |
| 142400 | 78 65 64 0a 73 74 72 61 74 65 67 79 2e 20 20 4c 69 73 70 20 69 6e 74 65 72 70 72 65 74 65 72 73 | xed.strategy...Lisp.interpreters |
| 142420 | 20 61 72 65 20 67 65 6e 65 72 61 6c 6c 79 20 6f 72 67 61 6e 69 7a 65 64 20 73 6f 20 74 68 61 74 | .are.generally.organized.so.that |
| 142440 | 0a 69 6e 74 65 72 70 72 65 74 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 61 6e 64 20 63 6f 6d 70 | .interpreted.procedures.and.comp |
| 142460 | 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 63 61 6e 20 63 61 6c 6c 20 65 61 63 68 20 6f 74 | iled.procedures.can.call.each.ot |
| 142480 | 68 65 72 2e 0a 54 68 69 73 20 65 6e 61 62 6c 65 73 20 61 20 70 72 6f 67 72 61 6d 6d 65 72 20 74 | her..This.enables.a.programmer.t |
| 1424a0 | 6f 20 63 6f 6d 70 69 6c 65 20 74 68 6f 73 65 20 70 61 72 74 73 20 6f 66 20 61 20 70 72 6f 67 72 | o.compile.those.parts.of.a.progr |
| 1424c0 | 61 6d 20 74 68 61 74 20 61 72 65 0a 61 73 73 75 6d 65 64 20 74 6f 20 62 65 20 64 65 62 75 67 67 | am.that.are.assumed.to.be.debugg |
| 1424e0 | 65 64 2c 20 74 68 75 73 20 67 61 69 6e 69 6e 67 20 74 68 65 20 65 66 66 69 63 69 65 6e 63 79 20 | ed,.thus.gaining.the.efficiency. |
| 142500 | 61 64 76 61 6e 74 61 67 65 20 6f 66 0a 63 6f 6d 70 69 6c 61 74 69 6f 6e 2c 20 77 68 69 6c 65 20 | advantage.of.compilation,.while. |
| 142520 | 72 65 74 61 69 6e 69 6e 67 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 69 76 65 20 6d 6f 64 65 20 | retaining.the.interpretive.mode. |
| 142540 | 6f 66 20 65 78 65 63 75 74 69 6f 6e 20 66 6f 72 0a 74 68 6f 73 65 20 70 61 72 74 73 20 6f 66 20 | of.execution.for.those.parts.of. |
| 142560 | 74 68 65 20 70 72 6f 67 72 61 6d 20 74 68 61 74 20 61 72 65 20 69 6e 20 74 68 65 20 66 6c 75 78 | the.program.that.are.in.the.flux |
| 142580 | 20 6f 66 20 69 6e 74 65 72 61 63 74 69 76 65 0a 64 65 76 65 6c 6f 70 6d 65 6e 74 20 61 6e 64 20 | .of.interactive.development.and. |
| 1425a0 | 64 65 62 75 67 67 69 6e 67 2e 20 20 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 | debugging...In.section.*Note.5-5 |
| 1425c0 | 2d 37 3a 3a 2c 20 61 66 74 65 72 20 77 65 20 68 61 76 65 0a 69 6d 70 6c 65 6d 65 6e 74 65 64 20 | -7::,.after.we.have.implemented. |
| 1425e0 | 74 68 65 20 63 6f 6d 70 69 6c 65 72 2c 20 77 65 20 77 69 6c 6c 20 73 68 6f 77 20 68 6f 77 20 74 | the.compiler,.we.will.show.how.t |
| 142600 | 6f 20 69 6e 74 65 72 66 61 63 65 20 69 74 20 77 69 74 68 20 6f 75 72 0a 69 6e 74 65 72 70 72 65 | o.interface.it.with.our.interpre |
| 142620 | 74 65 72 20 74 6f 20 70 72 6f 64 75 63 65 20 61 6e 20 69 6e 74 65 67 72 61 74 65 64 20 69 6e 74 | ter.to.produce.an.integrated.int |
| 142640 | 65 72 70 72 65 74 65 72 2d 63 6f 6d 70 69 6c 65 72 20 64 65 76 65 6c 6f 70 6d 65 6e 74 0a 73 79 | erpreter-compiler.development.sy |
| 142660 | 73 74 65 6d 2e 0a 0a 41 6e 20 6f 76 65 72 76 69 65 77 20 6f 66 20 74 68 65 20 63 6f 6d 70 69 6c | stem...An.overview.of.the.compil |
| 142680 | 65 72 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a | er.............................. |
| 1426a0 | 4f 75 72 20 63 6f 6d 70 69 6c 65 72 20 69 73 20 6d 75 63 68 20 6c 69 6b 65 20 6f 75 72 20 69 6e | Our.compiler.is.much.like.our.in |
| 1426c0 | 74 65 72 70 72 65 74 65 72 2c 20 62 6f 74 68 20 69 6e 20 69 74 73 20 73 74 72 75 63 74 75 72 65 | terpreter,.both.in.its.structure |
| 1426e0 | 20 61 6e 64 20 69 6e 0a 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 69 74 20 70 65 72 66 6f 72 6d 73 | .and.in.the.function.it.performs |
| 142700 | 2e 20 20 41 63 63 6f 72 64 69 6e 67 6c 79 2c 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d 73 20 75 | ...Accordingly,.the.mechanisms.u |
| 142720 | 73 65 64 20 62 79 20 74 68 65 0a 63 6f 6d 70 69 6c 65 72 20 66 6f 72 20 61 6e 61 6c 79 7a 69 6e | sed.by.the.compiler.for.analyzin |
| 142740 | 67 20 65 78 70 72 65 73 73 69 6f 6e 73 20 77 69 6c 6c 20 62 65 20 73 69 6d 69 6c 61 72 20 74 6f | g.expressions.will.be.similar.to |
| 142760 | 20 74 68 6f 73 65 20 75 73 65 64 20 62 79 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 72 2e 20 | .those.used.by.the.interpreter.. |
| 142780 | 20 4d 6f 72 65 6f 76 65 72 2c 20 74 6f 20 6d 61 6b 65 20 69 74 20 65 61 73 79 20 74 6f 20 69 6e | .Moreover,.to.make.it.easy.to.in |
| 1427a0 | 74 65 72 66 61 63 65 20 63 6f 6d 70 69 6c 65 64 20 61 6e 64 0a 69 6e 74 65 72 70 72 65 74 65 64 | terface.compiled.and.interpreted |
| 1427c0 | 20 63 6f 64 65 2c 20 77 65 20 77 69 6c 6c 20 64 65 73 69 67 6e 20 74 68 65 20 63 6f 6d 70 69 6c | .code,.we.will.design.the.compil |
| 1427e0 | 65 72 20 74 6f 20 67 65 6e 65 72 61 74 65 20 63 6f 64 65 20 74 68 61 74 0a 6f 62 65 79 73 20 74 | er.to.generate.code.that.obeys.t |
| 142800 | 68 65 20 73 61 6d 65 20 63 6f 6e 76 65 6e 74 69 6f 6e 73 20 6f 66 20 72 65 67 69 73 74 65 72 20 | he.same.conventions.of.register. |
| 142820 | 75 73 61 67 65 20 61 73 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 3a 20 54 68 65 0a 65 6e | usage.as.the.interpreter:.The.en |
| 142840 | 76 69 72 6f 6e 6d 65 6e 74 20 77 69 6c 6c 20 62 65 20 6b 65 70 74 20 69 6e 20 74 68 65 20 60 65 | vironment.will.be.kept.in.the.`e |
| 142860 | 6e 76 27 20 72 65 67 69 73 74 65 72 2c 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 73 20 77 69 6c | nv'.register,.argument.lists.wil |
| 142880 | 6c 20 62 65 0a 61 63 63 75 6d 75 6c 61 74 65 64 20 69 6e 20 60 61 72 67 6c 27 2c 20 61 20 70 72 | l.be.accumulated.in.`argl',.a.pr |
| 1428a0 | 6f 63 65 64 75 72 65 20 74 6f 20 62 65 20 61 70 70 6c 69 65 64 20 77 69 6c 6c 20 62 65 20 69 6e | ocedure.to.be.applied.will.be.in |
| 1428c0 | 20 60 70 72 6f 63 27 2c 0a 70 72 6f 63 65 64 75 72 65 73 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 | .`proc',.procedures.will.return. |
| 1428e0 | 74 68 65 69 72 20 61 6e 73 77 65 72 73 20 69 6e 20 60 76 61 6c 27 2c 20 61 6e 64 20 74 68 65 20 | their.answers.in.`val',.and.the. |
| 142900 | 6c 6f 63 61 74 69 6f 6e 20 74 6f 0a 77 68 69 63 68 20 61 20 70 72 6f 63 65 64 75 72 65 20 73 68 | location.to.which.a.procedure.sh |
| 142920 | 6f 75 6c 64 20 72 65 74 75 72 6e 20 77 69 6c 6c 20 62 65 20 6b 65 70 74 20 69 6e 20 60 63 6f 6e | ould.return.will.be.kept.in.`con |
| 142940 | 74 69 6e 75 65 27 2e 20 20 49 6e 0a 67 65 6e 65 72 61 6c 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 | tinue'...In.general,.the.compile |
| 142960 | 72 20 74 72 61 6e 73 6c 61 74 65 73 20 61 20 73 6f 75 72 63 65 20 70 72 6f 67 72 61 6d 20 69 6e | r.translates.a.source.program.in |
| 142980 | 74 6f 20 61 6e 20 6f 62 6a 65 63 74 0a 70 72 6f 67 72 61 6d 20 74 68 61 74 20 70 65 72 66 6f 72 | to.an.object.program.that.perfor |
| 1429a0 | 6d 73 20 65 73 73 65 6e 74 69 61 6c 6c 79 20 74 68 65 20 73 61 6d 65 20 72 65 67 69 73 74 65 72 | ms.essentially.the.same.register |
| 1429c0 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 73 20 77 6f 75 6c 64 0a 74 68 65 20 69 6e 74 65 72 70 72 | .operations.as.would.the.interpr |
| 1429e0 | 65 74 65 72 20 69 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 73 61 6d 65 20 73 6f 75 72 | eter.in.evaluating.the.same.sour |
| 142a00 | 63 65 20 70 72 6f 67 72 61 6d 2e 0a 0a 20 20 20 54 68 69 73 20 64 65 73 63 72 69 70 74 69 6f 6e | ce.program......This.description |
| 142a20 | 20 73 75 67 67 65 73 74 73 20 61 20 73 74 72 61 74 65 67 79 20 66 6f 72 20 69 6d 70 6c 65 6d 65 | .suggests.a.strategy.for.impleme |
| 142a40 | 6e 74 69 6e 67 20 61 20 72 75 64 69 6d 65 6e 74 61 72 79 0a 63 6f 6d 70 69 6c 65 72 3a 20 57 65 | nting.a.rudimentary.compiler:.We |
| 142a60 | 20 74 72 61 76 65 72 73 65 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 6e 20 74 68 65 20 | .traverse.the.expression.in.the. |
| 142a80 | 73 61 6d 65 20 77 61 79 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 0a 64 6f 65 73 2e 20 20 | same.way.the.interpreter.does... |
| 142aa0 | 57 68 65 6e 20 77 65 20 65 6e 63 6f 75 6e 74 65 72 20 61 20 72 65 67 69 73 74 65 72 20 69 6e 73 | When.we.encounter.a.register.ins |
| 142ac0 | 74 72 75 63 74 69 6f 6e 20 74 68 61 74 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 0a 77 6f | truction.that.the.interpreter.wo |
| 142ae0 | 75 6c 64 20 70 65 72 66 6f 72 6d 20 69 6e 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 78 | uld.perform.in.evaluating.the.ex |
| 142b00 | 70 72 65 73 73 69 6f 6e 2c 20 77 65 20 64 6f 20 6e 6f 74 20 65 78 65 63 75 74 65 20 74 68 65 0a | pression,.we.do.not.execute.the. |
| 142b20 | 69 6e 73 74 72 75 63 74 69 6f 6e 20 62 75 74 20 69 6e 73 74 65 61 64 20 61 63 63 75 6d 75 6c 61 | instruction.but.instead.accumula |
| 142b40 | 74 65 20 69 74 20 69 6e 74 6f 20 61 20 73 65 71 75 65 6e 63 65 2e 20 20 54 68 65 20 72 65 73 75 | te.it.into.a.sequence...The.resu |
| 142b60 | 6c 74 69 6e 67 0a 73 65 71 75 65 6e 63 65 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 77 | lting.sequence.of.instructions.w |
| 142b80 | 69 6c 6c 20 62 65 20 74 68 65 20 6f 62 6a 65 63 74 20 63 6f 64 65 2e 20 20 4f 62 73 65 72 76 65 | ill.be.the.object.code...Observe |
| 142ba0 | 20 74 68 65 0a 65 66 66 69 63 69 65 6e 63 79 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 63 6f 6d | .the.efficiency.advantage.of.com |
| 142bc0 | 70 69 6c 61 74 69 6f 6e 20 6f 76 65 72 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 2e 20 20 45 | pilation.over.interpretation...E |
| 142be0 | 61 63 68 20 74 69 6d 65 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 72 20 65 76 61 6c 75 61 74 | ach.time.the.interpreter.evaluat |
| 142c00 | 65 73 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2d 2d 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 60 | es.an.expression--for.example,.` |
| 142c20 | 28 66 20 38 34 20 39 36 29 27 2d 2d 69 74 0a 70 65 72 66 6f 72 6d 73 20 74 68 65 20 77 6f 72 6b | (f.84.96)'--it.performs.the.work |
| 142c40 | 20 6f 66 20 63 6c 61 73 73 69 66 79 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 28 | .of.classifying.the.expression.( |
| 142c60 | 64 69 73 63 6f 76 65 72 69 6e 67 20 74 68 61 74 20 74 68 69 73 0a 69 73 20 61 20 70 72 6f 63 65 | discovering.that.this.is.a.proce |
| 142c80 | 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 29 20 61 6e 64 20 74 65 73 74 69 6e 67 20 66 6f | dure.application).and.testing.fo |
| 142ca0 | 72 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 6f 70 65 72 61 6e 64 20 6c 69 73 74 0a 28 64 | r.the.end.of.the.operand.list.(d |
| 142cc0 | 69 73 63 6f 76 65 72 69 6e 67 20 74 68 61 74 20 74 68 65 72 65 20 61 72 65 20 74 77 6f 20 6f 70 | iscovering.that.there.are.two.op |
| 142ce0 | 65 72 61 6e 64 73 29 2e 20 20 57 69 74 68 20 61 20 63 6f 6d 70 69 6c 65 72 2c 20 74 68 65 0a 65 | erands)...With.a.compiler,.the.e |
| 142d00 | 78 70 72 65 73 73 69 6f 6e 20 69 73 20 61 6e 61 6c 79 7a 65 64 20 6f 6e 6c 79 20 6f 6e 63 65 2c | xpression.is.analyzed.only.once, |
| 142d20 | 20 77 68 65 6e 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 69 | .when.the.instruction.sequence.i |
| 142d40 | 73 0a 67 65 6e 65 72 61 74 65 64 20 61 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 2e 20 20 54 68 | s.generated.at.compile.time...Th |
| 142d60 | 65 20 6f 62 6a 65 63 74 20 63 6f 64 65 20 70 72 6f 64 75 63 65 64 20 62 79 20 74 68 65 20 63 6f | e.object.code.produced.by.the.co |
| 142d80 | 6d 70 69 6c 65 72 0a 63 6f 6e 74 61 69 6e 73 20 6f 6e 6c 79 20 74 68 65 20 69 6e 73 74 72 75 63 | mpiler.contains.only.the.instruc |
| 142da0 | 74 69 6f 6e 73 20 74 68 61 74 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 6f 70 65 72 61 74 6f 72 | tions.that.evaluate.the.operator |
| 142dc0 | 20 61 6e 64 20 74 68 65 20 74 77 6f 0a 6f 70 65 72 61 6e 64 73 2c 20 61 73 73 65 6d 62 6c 65 20 | .and.the.two.operands,.assemble. |
| 142de0 | 74 68 65 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 2c 20 61 6e 64 20 61 70 70 6c 79 20 74 68 65 | the.argument.list,.and.apply.the |
| 142e00 | 20 70 72 6f 63 65 64 75 72 65 20 28 69 6e 0a 60 70 72 6f 63 27 29 20 74 6f 20 74 68 65 20 61 72 | .procedure.(in.`proc').to.the.ar |
| 142e20 | 67 75 6d 65 6e 74 73 20 28 69 6e 20 60 61 72 67 6c 27 29 2e 0a 0a 20 20 20 54 68 69 73 20 69 73 | guments.(in.`argl')......This.is |
| 142e40 | 20 74 68 65 20 73 61 6d 65 20 6b 69 6e 64 20 6f 66 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 77 | .the.same.kind.of.optimization.w |
| 142e60 | 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 74 68 65 0a 61 6e 61 6c 79 7a 69 6e 67 20 65 | e.implemented.in.the.analyzing.e |
| 142e80 | 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 37 3a | valuator.of.section.*Note.4-1-7: |
| 142ea0 | 3a 2e 20 20 42 75 74 20 74 68 65 72 65 20 61 72 65 20 66 75 72 74 68 65 72 0a 6f 70 70 6f 72 74 | :...But.there.are.further.opport |
| 142ec0 | 75 6e 69 74 69 65 73 20 74 6f 20 67 61 69 6e 20 65 66 66 69 63 69 65 6e 63 79 20 69 6e 20 63 6f | unities.to.gain.efficiency.in.co |
| 142ee0 | 6d 70 69 6c 65 64 20 63 6f 64 65 2e 20 20 41 73 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 | mpiled.code...As.the.interpreter |
| 142f00 | 0a 72 75 6e 73 2c 20 69 74 20 66 6f 6c 6c 6f 77 73 20 61 20 70 72 6f 63 65 73 73 20 74 68 61 74 | .runs,.it.follows.a.process.that |
| 142f20 | 20 6d 75 73 74 20 62 65 20 61 70 70 6c 69 63 61 62 6c 65 20 74 6f 20 61 6e 79 20 65 78 70 72 65 | .must.be.applicable.to.any.expre |
| 142f40 | 73 73 69 6f 6e 20 69 6e 0a 74 68 65 20 6c 61 6e 67 75 61 67 65 2e 20 20 49 6e 20 63 6f 6e 74 72 | ssion.in.the.language...In.contr |
| 142f60 | 61 73 74 2c 20 61 20 67 69 76 65 6e 20 73 65 67 6d 65 6e 74 20 6f 66 20 63 6f 6d 70 69 6c 65 64 | ast,.a.given.segment.of.compiled |
| 142f80 | 20 63 6f 64 65 20 69 73 20 6d 65 61 6e 74 0a 74 6f 20 65 78 65 63 75 74 65 20 73 6f 6d 65 20 70 | .code.is.meant.to.execute.some.p |
| 142fa0 | 61 72 74 69 63 75 6c 61 72 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 54 68 69 73 20 63 61 6e 20 | articular.expression...This.can. |
| 142fc0 | 6d 61 6b 65 20 61 20 62 69 67 20 64 69 66 66 65 72 65 6e 63 65 2c 0a 66 6f 72 20 65 78 61 6d 70 | make.a.big.difference,.for.examp |
| 142fe0 | 6c 65 20 69 6e 20 74 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 73 74 61 63 6b 20 74 6f 20 73 61 | le.in.the.use.of.the.stack.to.sa |
| 143000 | 76 65 20 72 65 67 69 73 74 65 72 73 2e 20 20 57 68 65 6e 20 74 68 65 0a 69 6e 74 65 72 70 72 65 | ve.registers...When.the.interpre |
| 143020 | 74 65 72 20 65 76 61 6c 75 61 74 65 73 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 69 74 20 | ter.evaluates.an.expression,.it. |
| 143040 | 6d 75 73 74 20 62 65 20 70 72 65 70 61 72 65 64 20 66 6f 72 20 61 6e 79 0a 63 6f 6e 74 69 6e 67 | must.be.prepared.for.any.conting |
| 143060 | 65 6e 63 79 2e 20 20 42 65 66 6f 72 65 20 65 76 61 6c 75 61 74 69 6e 67 20 61 20 73 75 62 65 78 | ency...Before.evaluating.a.subex |
| 143080 | 70 72 65 73 73 69 6f 6e 2c 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 73 61 76 65 73 0a | pression,.the.interpreter.saves. |
| 1430a0 | 61 6c 6c 20 72 65 67 69 73 74 65 72 73 20 74 68 61 74 20 77 69 6c 6c 20 62 65 20 6e 65 65 64 65 | all.registers.that.will.be.neede |
| 1430c0 | 64 20 6c 61 74 65 72 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 73 75 62 65 78 70 72 65 73 73 69 | d.later,.because.the.subexpressi |
| 1430e0 | 6f 6e 0a 6d 69 67 68 74 20 72 65 71 75 69 72 65 20 61 6e 20 61 72 62 69 74 72 61 72 79 20 65 76 | on.might.require.an.arbitrary.ev |
| 143100 | 61 6c 75 61 74 69 6f 6e 2e 20 20 41 20 63 6f 6d 70 69 6c 65 72 2c 20 6f 6e 20 74 68 65 20 6f 74 | aluation...A.compiler,.on.the.ot |
| 143120 | 68 65 72 20 68 61 6e 64 2c 0a 63 61 6e 20 65 78 70 6c 6f 69 74 20 74 68 65 20 73 74 72 75 63 74 | her.hand,.can.exploit.the.struct |
| 143140 | 75 72 65 20 6f 66 20 74 68 65 20 70 61 72 74 69 63 75 6c 61 72 20 65 78 70 72 65 73 73 69 6f 6e | ure.of.the.particular.expression |
| 143160 | 20 69 74 20 69 73 20 70 72 6f 63 65 73 73 69 6e 67 0a 74 6f 20 67 65 6e 65 72 61 74 65 20 63 6f | .it.is.processing.to.generate.co |
| 143180 | 64 65 20 74 68 61 74 20 61 76 6f 69 64 73 20 75 6e 6e 65 63 65 73 73 61 72 79 20 73 74 61 63 6b | de.that.avoids.unnecessary.stack |
| 1431a0 | 20 6f 70 65 72 61 74 69 6f 6e 73 2e 0a 0a 20 20 20 41 73 20 61 20 63 61 73 65 20 69 6e 20 70 6f | .operations......As.a.case.in.po |
| 1431c0 | 69 6e 74 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 60 28 | int,.consider.the.combination.`( |
| 1431e0 | 66 20 38 34 20 39 36 29 27 2e 20 20 42 65 66 6f 72 65 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 | f.84.96)'...Before.the.interpret |
| 143200 | 65 72 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 6f 66 20 74 68 65 | er.evaluates.the.operator.of.the |
| 143220 | 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 2c 20 69 74 20 70 72 65 70 61 72 65 73 20 66 6f 72 0a 74 68 | .combination,.it.prepares.for.th |
| 143240 | 69 73 20 65 76 61 6c 75 61 74 69 6f 6e 20 62 79 20 73 61 76 69 6e 67 20 74 68 65 20 72 65 67 69 | is.evaluation.by.saving.the.regi |
| 143260 | 73 74 65 72 73 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 6f 70 65 72 61 6e 64 73 20 61 6e | sters.containing.the.operands.an |
| 143280 | 64 20 74 68 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 77 68 6f 73 65 20 76 61 6c 75 65 73 20 | d.the.environment,.whose.values. |
| 1432a0 | 77 69 6c 6c 20 62 65 20 6e 65 65 64 65 64 20 6c 61 74 65 72 2e 20 20 54 68 65 20 69 6e 74 65 72 | will.be.needed.later...The.inter |
| 1432c0 | 70 72 65 74 65 72 20 74 68 65 6e 0a 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 6f 70 65 72 61 74 | preter.then.evaluates.the.operat |
| 1432e0 | 6f 72 20 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 72 65 73 75 6c 74 20 69 6e 20 60 76 61 6c 27 | or.to.obtain.the.result.in.`val' |
| 143300 | 2c 20 72 65 73 74 6f 72 65 73 20 74 68 65 0a 73 61 76 65 64 20 72 65 67 69 73 74 65 72 73 2c 20 | ,.restores.the.saved.registers,. |
| 143320 | 61 6e 64 20 66 69 6e 61 6c 6c 79 20 6d 6f 76 65 73 20 74 68 65 20 72 65 73 75 6c 74 20 66 72 6f | and.finally.moves.the.result.fro |
| 143340 | 6d 20 60 76 61 6c 27 20 74 6f 20 60 70 72 6f 63 27 2e 0a 48 6f 77 65 76 65 72 2c 20 69 6e 20 74 | m.`val'.to.`proc'..However,.in.t |
| 143360 | 68 65 20 70 61 72 74 69 63 75 6c 61 72 20 65 78 70 72 65 73 73 69 6f 6e 20 77 65 20 61 72 65 20 | he.particular.expression.we.are. |
| 143380 | 64 65 61 6c 69 6e 67 20 77 69 74 68 2c 20 74 68 65 20 6f 70 65 72 61 74 6f 72 0a 69 73 20 74 68 | dealing.with,.the.operator.is.th |
| 1433a0 | 65 20 73 79 6d 62 6f 6c 20 60 66 27 2c 20 77 68 6f 73 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 69 | e.symbol.`f',.whose.evaluation.i |
| 1433c0 | 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 74 68 65 20 6d 61 63 68 69 6e 65 0a 6f 70 | s.accomplished.by.the.machine.op |
| 1433e0 | 65 72 61 74 69 6f 6e 20 60 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 27 2c | eration.`lookup-variable-value', |
| 143400 | 20 77 68 69 63 68 20 64 6f 65 73 20 6e 6f 74 20 61 6c 74 65 72 20 61 6e 79 20 72 65 67 69 73 74 | .which.does.not.alter.any.regist |
| 143420 | 65 72 73 2e 0a 54 68 65 20 63 6f 6d 70 69 6c 65 72 20 74 68 61 74 20 77 65 20 69 6d 70 6c 65 6d | ers..The.compiler.that.we.implem |
| 143440 | 65 6e 74 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 77 69 6c 6c 20 74 61 6b 65 20 61 64 | ent.in.this.section.will.take.ad |
| 143460 | 76 61 6e 74 61 67 65 20 6f 66 0a 74 68 69 73 20 66 61 63 74 20 61 6e 64 20 67 65 6e 65 72 61 74 | vantage.of.this.fact.and.generat |
| 143480 | 65 20 63 6f 64 65 20 74 68 61 74 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 6f 70 65 72 61 74 | e.code.that.evaluates.the.operat |
| 1434a0 | 6f 72 20 75 73 69 6e 67 20 74 68 65 0a 69 6e 73 74 72 75 63 74 69 6f 6e 0a 0a 20 20 20 20 20 28 | or.using.the.instruction.......( |
| 1434c0 | 61 73 73 69 67 6e 20 70 72 6f 63 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d | assign.proc.(op.lookup-variable- |
| 1434e0 | 76 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 66 29 20 28 72 65 67 20 65 6e 76 29 29 0a 0a 20 20 20 | value).(const.f).(reg.env))..... |
| 143500 | 54 68 69 73 20 63 6f 64 65 20 6e 6f 74 20 6f 6e 6c 79 20 61 76 6f 69 64 73 20 74 68 65 20 75 6e | This.code.not.only.avoids.the.un |
| 143520 | 6e 65 63 65 73 73 61 72 79 20 73 61 76 65 73 20 61 6e 64 20 72 65 73 74 6f 72 65 73 20 62 75 74 | necessary.saves.and.restores.but |
| 143540 | 0a 61 6c 73 6f 20 61 73 73 69 67 6e 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 6c | .also.assigns.the.value.of.the.l |
| 143560 | 6f 6f 6b 75 70 20 64 69 72 65 63 74 6c 79 20 74 6f 20 60 70 72 6f 63 27 2c 20 77 68 65 72 65 61 | ookup.directly.to.`proc',.wherea |
| 143580 | 73 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 72 20 77 6f 75 6c 64 20 6f 62 74 61 69 6e 20 74 | s.the.interpreter.would.obtain.t |
| 1435a0 | 68 65 20 72 65 73 75 6c 74 20 69 6e 20 60 76 61 6c 27 20 61 6e 64 20 74 68 65 6e 20 6d 6f 76 65 | he.result.in.`val'.and.then.move |
| 1435c0 | 20 74 68 69 73 20 74 6f 0a 60 70 72 6f 63 27 2e 0a 0a 20 20 20 41 20 63 6f 6d 70 69 6c 65 72 20 | .this.to.`proc'......A.compiler. |
| 1435e0 | 63 61 6e 20 61 6c 73 6f 20 6f 70 74 69 6d 69 7a 65 20 61 63 63 65 73 73 20 74 6f 20 74 68 65 20 | can.also.optimize.access.to.the. |
| 143600 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 48 61 76 69 6e 67 0a 61 6e 61 6c 79 7a 65 64 20 74 68 | environment...Having.analyzed.th |
| 143620 | 65 20 63 6f 64 65 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 63 61 6e 20 69 6e 20 6d 61 6e 79 | e.code,.the.compiler.can.in.many |
| 143640 | 20 63 61 73 65 73 20 6b 6e 6f 77 20 69 6e 20 77 68 69 63 68 20 66 72 61 6d 65 20 61 0a 70 61 72 | .cases.know.in.which.frame.a.par |
| 143660 | 74 69 63 75 6c 61 72 20 76 61 72 69 61 62 6c 65 20 77 69 6c 6c 20 62 65 20 6c 6f 63 61 74 65 64 | ticular.variable.will.be.located |
| 143680 | 20 61 6e 64 20 61 63 63 65 73 73 20 74 68 61 74 20 66 72 61 6d 65 20 64 69 72 65 63 74 6c 79 2c | .and.access.that.frame.directly, |
| 1436a0 | 0a 72 61 74 68 65 72 20 74 68 61 6e 20 70 65 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 60 6c 6f 6f | .rather.than.performing.the.`loo |
| 1436c0 | 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 27 20 73 65 61 72 63 68 2e 20 20 57 65 20 | kup-variable-value'.search...We. |
| 1436e0 | 77 69 6c 6c 0a 64 69 73 63 75 73 73 20 68 6f 77 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 73 75 | will.discuss.how.to.implement.su |
| 143700 | 63 68 20 76 61 72 69 61 62 6c 65 20 61 63 63 65 73 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e | ch.variable.access.in.section.*N |
| 143720 | 6f 74 65 20 35 2d 35 2d 36 3a 3a 2e 0a 55 6e 74 69 6c 20 74 68 65 6e 2c 20 68 6f 77 65 76 65 72 | ote.5-5-6::..Until.then,.however |
| 143740 | 2c 20 77 65 20 77 69 6c 6c 20 66 6f 63 75 73 20 6f 6e 20 74 68 65 20 6b 69 6e 64 20 6f 66 20 72 | ,.we.will.focus.on.the.kind.of.r |
| 143760 | 65 67 69 73 74 65 72 20 61 6e 64 20 73 74 61 63 6b 0a 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 73 20 | egister.and.stack.optimizations. |
| 143780 | 64 65 73 63 72 69 62 65 64 20 61 62 6f 76 65 2e 20 20 54 68 65 72 65 20 61 72 65 20 6d 61 6e 79 | described.above...There.are.many |
| 1437a0 | 20 6f 74 68 65 72 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 73 20 74 68 61 74 0a 63 61 6e 20 62 65 | .other.optimizations.that.can.be |
| 1437c0 | 20 70 65 72 66 6f 72 6d 65 64 20 62 79 20 61 20 63 6f 6d 70 69 6c 65 72 2c 20 73 75 63 68 20 61 | .performed.by.a.compiler,.such.a |
| 1437e0 | 73 20 63 6f 64 69 6e 67 20 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 22 69 | s.coding.primitive.operations."i |
| 143800 | 6e 0a 6c 69 6e 65 22 20 69 6e 73 74 65 61 64 20 6f 66 20 75 73 69 6e 67 20 61 20 67 65 6e 65 72 | n.line".instead.of.using.a.gener |
| 143820 | 61 6c 20 60 61 70 70 6c 79 27 20 6d 65 63 68 61 6e 69 73 6d 20 28 73 65 65 20 2a 4e 6f 74 65 20 | al.`apply'.mechanism.(see.*Note. |
| 143840 | 45 78 65 72 63 69 73 65 0a 35 2d 33 38 3a 3a 29 3b 20 62 75 74 20 77 65 20 77 69 6c 6c 20 6e 6f | Exercise.5-38::);.but.we.will.no |
| 143860 | 74 20 65 6d 70 68 61 73 69 7a 65 20 74 68 65 73 65 20 68 65 72 65 2e 20 20 4f 75 72 20 6d 61 69 | t.emphasize.these.here...Our.mai |
| 143880 | 6e 20 67 6f 61 6c 20 69 6e 20 74 68 69 73 0a 73 65 63 74 69 6f 6e 20 69 73 20 74 6f 20 69 6c 6c | n.goal.in.this.section.is.to.ill |
| 1438a0 | 75 73 74 72 61 74 65 20 74 68 65 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 | ustrate.the.compilation.process. |
| 1438c0 | 69 6e 20 61 20 73 69 6d 70 6c 69 66 69 65 64 20 28 62 75 74 0a 73 74 69 6c 6c 20 69 6e 74 65 72 | in.a.simplified.(but.still.inter |
| 1438e0 | 65 73 74 69 6e 67 29 20 63 6f 6e 74 65 78 74 2e 0a 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a 20 35 2d 35 | esting).context...*.Menu:..*.5-5 |
| 143900 | 2d 31 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 53 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 | -1::............Structure.of.the |
| 143920 | 20 43 6f 6d 70 69 6c 65 72 0a 2a 20 35 2d 35 2d 32 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 | .Compiler.*.5-5-2::............C |
| 143940 | 6f 6d 70 69 6c 69 6e 67 20 45 78 70 72 65 73 73 69 6f 6e 73 0a 2a 20 35 2d 35 2d 33 3a 3a 20 20 | ompiling.Expressions.*.5-5-3::.. |
| 143960 | 20 20 20 20 20 20 20 20 20 20 43 6f 6d 70 69 6c 69 6e 67 20 43 6f 6d 62 69 6e 61 74 69 6f 6e 73 | ..........Compiling.Combinations |
| 143980 | 0a 2a 20 35 2d 35 2d 34 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 43 6f 6d 62 69 6e 69 6e 67 20 | .*.5-5-4::............Combining. |
| 1439a0 | 49 6e 73 74 72 75 63 74 69 6f 6e 20 53 65 71 75 65 6e 63 65 73 0a 2a 20 35 2d 35 2d 35 3a 3a 20 | Instruction.Sequences.*.5-5-5::. |
| 1439c0 | 20 20 20 20 20 20 20 20 20 20 20 41 6e 20 45 78 61 6d 70 6c 65 20 6f 66 20 43 6f 6d 70 69 6c 65 | ...........An.Example.of.Compile |
| 1439e0 | 64 20 43 6f 64 65 0a 2a 20 35 2d 35 2d 36 3a 3a 20 20 20 20 20 20 20 20 20 20 20 20 4c 65 78 69 | d.Code.*.5-5-6::............Lexi |
| 143a00 | 63 61 6c 20 41 64 64 72 65 73 73 69 6e 67 0a 2a 20 35 2d 35 2d 37 3a 3a 20 20 20 20 20 20 20 20 | cal.Addressing.*.5-5-7::........ |
| 143a20 | 20 20 20 20 49 6e 74 65 72 66 61 63 69 6e 67 20 43 6f 6d 70 69 6c 65 64 20 43 6f 64 65 20 74 6f | ....Interfacing.Compiled.Code.to |
| 143a40 | 20 74 68 65 20 45 76 61 6c 75 61 74 6f 72 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f | .the.Evaluator.....----------.Fo |
| 143a60 | 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 69 73 20 | otnotes.----------.....(1).This. |
| 143a80 | 69 73 20 61 20 74 68 65 6f 72 65 74 69 63 61 6c 20 73 74 61 74 65 6d 65 6e 74 2e 20 20 57 65 20 | is.a.theoretical.statement...We. |
| 143aa0 | 61 72 65 20 6e 6f 74 20 63 6c 61 69 6d 69 6e 67 20 74 68 61 74 20 74 68 65 0a 65 76 61 6c 75 61 | are.not.claiming.that.the.evalua |
| 143ac0 | 74 6f 72 27 73 20 64 61 74 61 20 70 61 74 68 73 20 61 72 65 20 61 20 70 61 72 74 69 63 75 6c 61 | tor's.data.paths.are.a.particula |
| 143ae0 | 72 6c 79 20 63 6f 6e 76 65 6e 69 65 6e 74 20 6f 72 20 65 66 66 69 63 69 65 6e 74 20 73 65 74 20 | rly.convenient.or.efficient.set. |
| 143b00 | 6f 66 0a 64 61 74 61 20 70 61 74 68 73 20 66 6f 72 20 61 20 67 65 6e 65 72 61 6c 2d 70 75 72 70 | of.data.paths.for.a.general-purp |
| 143b20 | 6f 73 65 20 63 6f 6d 70 75 74 65 72 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 79 | ose.computer...For.example,.they |
| 143b40 | 20 61 72 65 20 6e 6f 74 0a 76 65 72 79 20 67 6f 6f 64 20 66 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 | .are.not.very.good.for.implement |
| 143b60 | 69 6e 67 20 68 69 67 68 2d 70 65 72 66 6f 72 6d 61 6e 63 65 20 66 6c 6f 61 74 69 6e 67 2d 70 6f | ing.high-performance.floating-po |
| 143b80 | 69 6e 74 20 63 61 6c 63 75 6c 61 74 69 6f 6e 73 0a 6f 72 20 63 61 6c 63 75 6c 61 74 69 6f 6e 73 | int.calculations.or.calculations |
| 143ba0 | 20 74 68 61 74 20 69 6e 74 65 6e 73 69 76 65 6c 79 20 6d 61 6e 69 70 75 6c 61 74 65 20 62 69 74 | .that.intensively.manipulate.bit |
| 143bc0 | 20 76 65 63 74 6f 72 73 2e 0a 0a 20 20 20 28 32 29 20 41 63 74 75 61 6c 6c 79 2c 20 74 68 65 20 | .vectors......(2).Actually,.the. |
| 143be0 | 6d 61 63 68 69 6e 65 20 74 68 61 74 20 72 75 6e 73 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 | machine.that.runs.compiled.code. |
| 143c00 | 63 61 6e 20 62 65 20 73 69 6d 70 6c 65 72 0a 74 68 61 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 | can.be.simpler.than.the.interpre |
| 143c20 | 74 65 72 20 6d 61 63 68 69 6e 65 2c 20 62 65 63 61 75 73 65 20 77 65 20 77 6f 6e 27 74 20 75 73 | ter.machine,.because.we.won't.us |
| 143c40 | 65 20 74 68 65 20 60 65 78 70 27 20 61 6e 64 20 60 75 6e 65 76 27 0a 72 65 67 69 73 74 65 72 73 | e.the.`exp'.and.`unev'.registers |
| 143c60 | 2e 20 20 54 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20 75 73 65 64 20 74 68 65 73 65 20 74 6f | ...The.interpreter.used.these.to |
| 143c80 | 20 68 6f 6c 64 20 70 69 65 63 65 73 20 6f 66 20 75 6e 65 76 61 6c 75 61 74 65 64 0a 65 78 70 72 | .hold.pieces.of.unevaluated.expr |
| 143ca0 | 65 73 73 69 6f 6e 73 2e 20 20 57 69 74 68 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 2c 20 68 6f 77 | essions...With.the.compiler,.how |
| 143cc0 | 65 76 65 72 2c 20 74 68 65 73 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 67 65 74 20 62 75 69 6c | ever,.these.expressions.get.buil |
| 143ce0 | 74 0a 69 6e 74 6f 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 74 68 61 74 20 74 68 | t.into.the.compiled.code.that.th |
| 143d00 | 65 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 77 69 6c 6c 20 72 75 6e 2e 20 20 46 6f | e.register.machine.will.run...Fo |
| 143d20 | 72 20 74 68 65 20 73 61 6d 65 0a 72 65 61 73 6f 6e 2c 20 77 65 20 64 6f 6e 27 74 20 6e 65 65 64 | r.the.same.reason,.we.don't.need |
| 143d40 | 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 64 65 61 | .the.machine.operations.that.dea |
| 143d60 | 6c 20 77 69 74 68 20 65 78 70 72 65 73 73 69 6f 6e 0a 73 79 6e 74 61 78 2e 20 20 42 75 74 20 63 | l.with.expression.syntax...But.c |
| 143d80 | 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 77 69 6c 6c 20 75 73 65 20 61 20 66 65 77 20 61 64 64 69 | ompiled.code.will.use.a.few.addi |
| 143da0 | 74 69 6f 6e 61 6c 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 0a 28 74 6f 20 72 65 | tional.machine.operations.(to.re |
| 143dc0 | 70 72 65 73 65 6e 74 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 | present.compiled.procedure.objec |
| 143de0 | 74 73 29 20 74 68 61 74 20 64 69 64 6e 27 74 20 61 70 70 65 61 72 20 69 6e 20 74 68 65 0a 65 78 | ts).that.didn't.appear.in.the.ex |
| 143e00 | 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 | plicit-control.evaluator.machine |
| 143e20 | 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 35 | .....File:.sicp.info,..Node:.5-5 |
| 143e40 | 2d 31 2c 20 20 4e 65 78 74 3a 20 35 2d 35 2d 32 2c 20 20 50 72 65 76 3a 20 35 2d 35 2c 20 20 55 | -1,..Next:.5-5-2,..Prev:.5-5,..U |
| 143e60 | 70 3a 20 35 2d 35 0a 0a 35 2e 35 2e 31 20 53 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 43 | p:.5-5..5.5.1.Structure.of.the.C |
| 143e80 | 6f 6d 70 69 6c 65 72 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ompiler.------------------------ |
| 143ea0 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 37 3a | -------..In.section.*Note.4-1-7: |
| 143ec0 | 3a 20 77 65 20 6d 6f 64 69 66 69 65 64 20 6f 75 72 20 6f 72 69 67 69 6e 61 6c 20 6d 65 74 61 63 | :.we.modified.our.original.metac |
| 143ee0 | 69 72 63 75 6c 61 72 0a 69 6e 74 65 72 70 72 65 74 65 72 20 74 6f 20 73 65 70 61 72 61 74 65 20 | ircular.interpreter.to.separate. |
| 143f00 | 61 6e 61 6c 79 73 69 73 20 66 72 6f 6d 20 65 78 65 63 75 74 69 6f 6e 2e 20 20 57 65 20 61 6e 61 | analysis.from.execution...We.ana |
| 143f20 | 6c 79 7a 65 64 20 65 61 63 68 0a 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 70 72 6f 64 75 63 65 | lyzed.each.expression.to.produce |
| 143f40 | 20 61 6e 20 65 78 65 63 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 74 68 61 74 20 74 6f 6f | .an.execution.procedure.that.too |
| 143f60 | 6b 20 61 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 61 73 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 | k.an.environment.as.argument.and |
| 143f80 | 20 70 65 72 66 6f 72 6d 65 64 20 74 68 65 20 72 65 71 75 69 72 65 64 20 6f 70 65 72 61 74 69 6f | .performed.the.required.operatio |
| 143fa0 | 6e 73 2e 20 20 49 6e 20 6f 75 72 20 63 6f 6d 70 69 6c 65 72 2c 20 77 65 0a 77 69 6c 6c 20 64 6f | ns...In.our.compiler,.we.will.do |
| 143fc0 | 20 65 73 73 65 6e 74 69 61 6c 6c 79 20 74 68 65 20 73 61 6d 65 20 61 6e 61 6c 79 73 69 73 2e 20 | .essentially.the.same.analysis.. |
| 143fe0 | 20 49 6e 73 74 65 61 64 20 6f 66 20 70 72 6f 64 75 63 69 6e 67 20 65 78 65 63 75 74 69 6f 6e 0a | .Instead.of.producing.execution. |
| 144000 | 70 72 6f 63 65 64 75 72 65 73 2c 20 68 6f 77 65 76 65 72 2c 20 77 65 20 77 69 6c 6c 20 67 65 6e | procedures,.however,.we.will.gen |
| 144020 | 65 72 61 74 65 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 | erate.sequences.of.instructions. |
| 144040 | 74 6f 20 62 65 0a 72 75 6e 20 62 79 20 6f 75 72 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e | to.be.run.by.our.register.machin |
| 144060 | 65 2e 0a 0a 20 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 63 6f 6d 70 69 6c 65 27 20 69 | e......The.procedure.`compile'.i |
| 144080 | 73 20 74 68 65 20 74 6f 70 2d 6c 65 76 65 6c 20 64 69 73 70 61 74 63 68 20 69 6e 20 74 68 65 20 | s.the.top-level.dispatch.in.the. |
| 1440a0 | 63 6f 6d 70 69 6c 65 72 2e 0a 49 74 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 74 68 65 20 | compiler..It.corresponds.to.the. |
| 1440c0 | 60 65 76 61 6c 27 20 70 72 6f 63 65 64 75 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 | `eval'.procedure.of.section.*Not |
| 1440e0 | 65 20 34 2d 31 2d 31 3a 3a 2c 20 74 68 65 0a 60 61 6e 61 6c 79 7a 65 27 20 70 72 6f 63 65 64 75 | e.4-1-1::,.the.`analyze'.procedu |
| 144100 | 72 65 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 37 3a 3a 2c 20 61 6e 64 | re.of.section.*Note.4-1-7::,.and |
| 144120 | 20 74 68 65 20 60 65 76 61 6c 2d 64 69 73 70 61 74 63 68 27 0a 65 6e 74 72 79 20 70 6f 69 6e 74 | .the.`eval-dispatch'.entry.point |
| 144140 | 20 6f 66 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 2d 65 76 61 6c 75 61 74 | .of.the.explicit-control-evaluat |
| 144160 | 6f 72 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 34 2d 31 3a 3a 2e 0a 54 68 65 | or.in.section.*Note.5-4-1::..The |
| 144180 | 20 63 6f 6d 70 69 6c 65 72 2c 20 6c 69 6b 65 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 73 | .compiler,.like.the.interpreters |
| 1441a0 | 2c 20 75 73 65 73 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2d 73 79 6e 74 61 78 0a 70 72 6f | ,.uses.the.expression-syntax.pro |
| 1441c0 | 63 65 64 75 72 65 73 20 64 65 66 69 6e 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | cedures.defined.in.section.*Note |
| 1441e0 | 20 34 2d 31 2d 32 3a 3a 2e 28 31 29 20 20 60 43 6f 6d 70 69 6c 65 27 20 70 65 72 66 6f 72 6d 73 | .4-1-2::.(1)..`Compile'.performs |
| 144200 | 20 61 0a 63 61 73 65 20 61 6e 61 6c 79 73 69 73 20 6f 6e 20 74 68 65 20 73 79 6e 74 61 63 74 69 | .a.case.analysis.on.the.syntacti |
| 144220 | 63 20 74 79 70 65 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 62 65 20 63 | c.type.of.the.expression.to.be.c |
| 144240 | 6f 6d 70 69 6c 65 64 2e 0a 46 6f 72 20 65 61 63 68 20 74 79 70 65 20 6f 66 20 65 78 70 72 65 73 | ompiled..For.each.type.of.expres |
| 144260 | 73 69 6f 6e 2c 20 69 74 20 64 69 73 70 61 74 63 68 65 73 20 74 6f 20 61 20 73 70 65 63 69 61 6c | sion,.it.dispatches.to.a.special |
| 144280 | 69 7a 65 64 20 22 63 6f 64 65 0a 67 65 6e 65 72 61 74 6f 72 22 3a 0a 0a 20 20 20 20 20 28 64 65 | ized."code.generator":.......(de |
| 1442a0 | 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 | fine.(compile.exp.target.linkage |
| 1442c0 | 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 | )........(cond.((self-evaluating |
| 1442e0 | 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 73 65 | ?.exp)...............(compile-se |
| 144300 | 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 | lf-evaluating.exp.target.linkage |
| 144320 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 71 75 6f 74 65 64 3f 20 65 78 70 29 20 28 | ))..............((quoted?.exp).( |
| 144340 | 63 6f 6d 70 69 6c 65 2d 71 75 6f 74 65 64 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 | compile-quoted.exp.target.linkag |
| 144360 | 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 76 61 72 69 61 62 6c 65 3f 20 65 78 70 | e))..............((variable?.exp |
| 144380 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 76 61 72 69 61 62 6c | )...............(compile-variabl |
| 1443a0 | 65 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 29 0a 20 20 20 20 20 20 20 20 20 | e.exp.target.linkage)).......... |
| 1443c0 | 20 20 20 20 28 28 61 73 73 69 67 6e 6d 65 6e 74 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 | ....((assignment?.exp).......... |
| 1443e0 | 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 61 73 73 69 67 6e 6d 65 6e 74 20 65 78 70 20 74 61 72 | .....(compile-assignment.exp.tar |
| 144400 | 67 65 74 20 6c 69 6e 6b 61 67 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 64 65 66 | get.linkage))..............((def |
| 144420 | 69 6e 69 74 69 6f 6e 3f 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d | inition?.exp)...............(com |
| 144440 | 70 69 6c 65 2d 64 65 66 69 6e 69 74 69 6f 6e 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 | pile-definition.exp.target.linka |
| 144460 | 67 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 69 66 3f 20 65 78 70 29 20 28 63 6f | ge))..............((if?.exp).(co |
| 144480 | 6d 70 69 6c 65 2d 69 66 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 29 0a 20 20 | mpile-if.exp.target.linkage))... |
| 1444a0 | 20 20 20 20 20 20 20 20 20 20 20 28 28 6c 61 6d 62 64 61 3f 20 65 78 70 29 20 28 63 6f 6d 70 69 | ...........((lambda?.exp).(compi |
| 1444c0 | 6c 65 2d 6c 61 6d 62 64 61 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 29 0a 20 | le-lambda.exp.target.linkage)).. |
| 1444e0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 28 62 65 67 69 6e 3f 20 65 78 70 29 0a 20 20 20 20 20 20 | ............((begin?.exp)....... |
| 144500 | 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 73 65 71 75 65 6e 63 65 20 28 62 65 67 69 6e | ........(compile-sequence.(begin |
| 144520 | 2d 61 63 74 69 6f 6e 73 20 65 78 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -actions.exp)................... |
| 144540 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 61 72 67 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 | ..............target............ |
| 144560 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6c 69 6e 6b 61 67 65 29 29 0a 20 | .....................linkage)).. |
| 144580 | 20 20 20 20 20 20 20 20 20 20 20 20 28 28 63 6f 6e 64 3f 20 65 78 70 29 20 28 63 6f 6d 70 69 6c | ............((cond?.exp).(compil |
| 1445a0 | 65 20 28 63 6f 6e 64 2d 3e 69 66 20 65 78 70 29 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 | e.(cond->if.exp).target.linkage) |
| 1445c0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 61 70 70 6c 69 63 61 74 69 6f 6e 3f 20 65 78 | )..............((application?.ex |
| 1445e0 | 70 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 61 70 70 6c 69 63 | p)...............(compile-applic |
| 144600 | 61 74 69 6f 6e 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 29 0a 20 20 20 20 20 | ation.exp.target.linkage))...... |
| 144620 | 20 20 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 72 72 | ........(else...............(err |
| 144640 | 6f 72 20 22 55 6e 6b 6e 6f 77 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 74 79 70 65 20 2d 2d 20 43 | or."Unknown.expression.type.--.C |
| 144660 | 4f 4d 50 49 4c 45 22 20 65 78 70 29 29 29 29 0a 0a 54 61 72 67 65 74 73 20 61 6e 64 20 6c 69 6e | OMPILE".exp))))..Targets.and.lin |
| 144680 | 6b 61 67 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 60 43 6f 6d | kages.......................`Com |
| 1446a0 | 70 69 6c 65 27 20 61 6e 64 20 74 68 65 20 63 6f 64 65 20 67 65 6e 65 72 61 74 6f 72 73 20 74 68 | pile'.and.the.code.generators.th |
| 1446c0 | 61 74 20 69 74 20 63 61 6c 6c 73 20 74 61 6b 65 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 20 69 | at.it.calls.take.two.arguments.i |
| 1446e0 | 6e 0a 61 64 64 69 74 69 6f 6e 20 74 6f 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 6f 20 | n.addition.to.the.expression.to. |
| 144700 | 63 6f 6d 70 69 6c 65 2e 20 20 54 68 65 72 65 20 69 73 20 61 20 22 74 61 72 67 65 74 22 2c 20 77 | compile...There.is.a."target",.w |
| 144720 | 68 69 63 68 0a 73 70 65 63 69 66 69 65 73 20 74 68 65 20 72 65 67 69 73 74 65 72 20 69 6e 20 77 | hich.specifies.the.register.in.w |
| 144740 | 68 69 63 68 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 69 73 20 74 6f 20 72 65 74 | hich.the.compiled.code.is.to.ret |
| 144760 | 75 72 6e 20 74 68 65 0a 76 61 6c 75 65 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2e | urn.the.value.of.the.expression. |
| 144780 | 20 20 54 68 65 72 65 20 69 73 20 61 6c 73 6f 20 61 20 22 6c 69 6e 6b 61 67 65 20 64 65 73 63 72 | ..There.is.also.a."linkage.descr |
| 1447a0 | 69 70 74 6f 72 22 2c 20 77 68 69 63 68 0a 64 65 73 63 72 69 62 65 73 20 68 6f 77 20 74 68 65 20 | iptor",.which.describes.how.the. |
| 1447c0 | 63 6f 64 65 20 72 65 73 75 6c 74 69 6e 67 20 66 72 6f 6d 20 74 68 65 20 63 6f 6d 70 69 6c 61 74 | code.resulting.from.the.compilat |
| 1447e0 | 69 6f 6e 20 6f 66 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 73 68 6f 75 6c 64 20 70 72 6f | ion.of.the.expression.should.pro |
| 144800 | 63 65 65 64 20 77 68 65 6e 20 69 74 20 68 61 73 20 66 69 6e 69 73 68 65 64 20 69 74 73 20 65 78 | ceed.when.it.has.finished.its.ex |
| 144820 | 65 63 75 74 69 6f 6e 2e 20 20 54 68 65 20 6c 69 6e 6b 61 67 65 0a 64 65 73 63 72 69 70 74 6f 72 | ecution...The.linkage.descriptor |
| 144840 | 20 63 61 6e 20 72 65 71 75 69 72 65 20 74 68 61 74 20 74 68 65 20 63 6f 64 65 20 64 6f 20 6f 6e | .can.require.that.the.code.do.on |
| 144860 | 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 72 65 65 0a 74 68 69 6e 67 73 3a | e.of.the.following.three.things: |
| 144880 | 0a 0a 20 20 20 2a 20 63 6f 6e 74 69 6e 75 65 20 61 74 20 74 68 65 20 6e 65 78 74 20 69 6e 73 74 | .....*.continue.at.the.next.inst |
| 1448a0 | 72 75 63 74 69 6f 6e 20 69 6e 20 73 65 71 75 65 6e 63 65 20 28 74 68 69 73 20 69 73 20 73 70 65 | ruction.in.sequence.(this.is.spe |
| 1448c0 | 63 69 66 69 65 64 20 62 79 0a 20 20 20 20 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 64 65 73 63 72 | cified.by......the.linkage.descr |
| 1448e0 | 69 70 74 6f 72 20 60 6e 65 78 74 27 29 2c 0a 0a 20 20 20 2a 20 72 65 74 75 72 6e 20 66 72 6f 6d | iptor.`next'),.....*.return.from |
| 144900 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 62 65 69 6e 67 20 63 6f 6d 70 69 6c 65 64 20 28 74 | .the.procedure.being.compiled.(t |
| 144920 | 68 69 73 20 69 73 20 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 0a 20 20 20 20 20 6c 69 6e | his.is.specified.by.the......lin |
| 144940 | 6b 61 67 65 20 64 65 73 63 72 69 70 74 6f 72 20 60 72 65 74 75 72 6e 27 29 2c 20 6f 72 0a 0a 20 | kage.descriptor.`return'),.or... |
| 144960 | 20 20 2a 20 6a 75 6d 70 20 74 6f 20 61 20 6e 61 6d 65 64 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 | ..*.jump.to.a.named.entry.point. |
| 144980 | 28 74 68 69 73 20 69 73 20 73 70 65 63 69 66 69 65 64 20 62 79 20 75 73 69 6e 67 20 74 68 65 0a | (this.is.specified.by.using.the. |
| 1449a0 | 20 20 20 20 20 64 65 73 69 67 6e 61 74 65 64 20 6c 61 62 65 6c 20 61 73 20 74 68 65 20 6c 69 6e | .....designated.label.as.the.lin |
| 1449c0 | 6b 61 67 65 20 64 65 73 63 72 69 70 74 6f 72 29 2e 0a 0a 0a 20 20 20 46 6f 72 20 65 78 61 6d 70 | kage.descriptor).......For.examp |
| 1449e0 | 6c 65 2c 20 63 6f 6d 70 69 6c 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 35 27 | le,.compiling.the.expression.`5' |
| 144a00 | 20 28 77 68 69 63 68 20 69 73 20 73 65 6c 66 2d 65 76 61 6c 75 61 74 69 6e 67 29 0a 77 69 74 68 | .(which.is.self-evaluating).with |
| 144a20 | 20 61 20 74 61 72 67 65 74 20 6f 66 20 74 68 65 20 60 76 61 6c 27 20 72 65 67 69 73 74 65 72 20 | .a.target.of.the.`val'.register. |
| 144a40 | 61 6e 64 20 61 20 6c 69 6e 6b 61 67 65 20 6f 66 20 60 6e 65 78 74 27 20 73 68 6f 75 6c 64 0a 70 | and.a.linkage.of.`next'.should.p |
| 144a60 | 72 6f 64 75 63 65 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 0a 0a 20 20 20 20 20 28 61 73 | roduce.the.instruction.......(as |
| 144a80 | 73 69 67 6e 20 76 61 6c 20 28 63 6f 6e 73 74 20 35 29 29 0a 0a 43 6f 6d 70 69 6c 69 6e 67 20 74 | sign.val.(const.5))..Compiling.t |
| 144aa0 | 68 65 20 73 61 6d 65 20 65 78 70 72 65 73 73 69 6f 6e 20 77 69 74 68 20 61 20 6c 69 6e 6b 61 67 | he.same.expression.with.a.linkag |
| 144ac0 | 65 20 6f 66 20 60 72 65 74 75 72 6e 27 20 73 68 6f 75 6c 64 20 70 72 6f 64 75 63 65 0a 74 68 65 | e.of.`return'.should.produce.the |
| 144ae0 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 | .instructions.......(assign.val. |
| 144b00 | 28 63 6f 6e 73 74 20 35 29 29 0a 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 | (const.5))......(goto.(reg.conti |
| 144b20 | 6e 75 65 29 29 0a 0a 20 20 20 49 6e 20 74 68 65 20 66 69 72 73 74 20 63 61 73 65 2c 20 65 78 65 | nue)).....In.the.first.case,.exe |
| 144b40 | 63 75 74 69 6f 6e 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 77 69 74 68 20 74 68 65 20 6e 65 | cution.will.continue.with.the.ne |
| 144b60 | 78 74 20 69 6e 73 74 72 75 63 74 69 6f 6e 0a 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 2e 20 | xt.instruction.in.the.sequence.. |
| 144b80 | 49 6e 20 74 68 65 20 73 65 63 6f 6e 64 20 63 61 73 65 2c 20 77 65 20 77 69 6c 6c 20 72 65 74 75 | In.the.second.case,.we.will.retu |
| 144ba0 | 72 6e 20 66 72 6f 6d 20 61 20 70 72 6f 63 65 64 75 72 65 0a 63 61 6c 6c 2e 20 20 49 6e 20 62 6f | rn.from.a.procedure.call...In.bo |
| 144bc0 | 74 68 20 63 61 73 65 73 2c 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 65 78 70 72 65 | th.cases,.the.value.of.the.expre |
| 144be0 | 73 73 69 6f 6e 20 77 69 6c 6c 20 62 65 20 70 6c 61 63 65 64 20 69 6e 74 6f 0a 74 68 65 20 74 61 | ssion.will.be.placed.into.the.ta |
| 144c00 | 72 67 65 74 20 60 76 61 6c 27 20 72 65 67 69 73 74 65 72 2e 0a 0a 49 6e 73 74 72 75 63 74 69 6f | rget.`val'.register...Instructio |
| 144c20 | 6e 20 73 65 71 75 65 6e 63 65 73 20 61 6e 64 20 73 74 61 63 6b 20 75 73 61 67 65 0a 2e 2e 2e 2e | n.sequences.and.stack.usage..... |
| 144c40 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ................................ |
| 144c60 | 2e 0a 0a 45 61 63 68 20 63 6f 64 65 20 67 65 6e 65 72 61 74 6f 72 20 72 65 74 75 72 6e 73 20 61 | ...Each.code.generator.returns.a |
| 144c80 | 6e 20 22 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 22 20 63 6f 6e 74 61 69 6e | n."instruction.sequence".contain |
| 144ca0 | 69 6e 67 20 74 68 65 0a 6f 62 6a 65 63 74 20 63 6f 64 65 20 69 74 20 68 61 73 20 67 65 6e 65 72 | ing.the.object.code.it.has.gener |
| 144cc0 | 61 74 65 64 20 66 6f 72 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 43 6f 64 65 20 67 | ated.for.the.expression...Code.g |
| 144ce0 | 65 6e 65 72 61 74 69 6f 6e 20 66 6f 72 20 61 0a 63 6f 6d 70 6f 75 6e 64 20 65 78 70 72 65 73 73 | eneration.for.a.compound.express |
| 144d00 | 69 6f 6e 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 62 79 20 63 6f 6d 62 69 6e 69 6e 67 | ion.is.accomplished.by.combining |
| 144d20 | 20 74 68 65 20 6f 75 74 70 75 74 20 66 72 6f 6d 0a 73 69 6d 70 6c 65 72 20 63 6f 64 65 20 67 65 | .the.output.from.simpler.code.ge |
| 144d40 | 6e 65 72 61 74 6f 72 73 20 66 6f 72 20 63 6f 6d 70 6f 6e 65 6e 74 20 65 78 70 72 65 73 73 69 6f | nerators.for.component.expressio |
| 144d60 | 6e 73 2c 20 6a 75 73 74 20 61 73 20 65 76 61 6c 75 61 74 69 6f 6e 0a 6f 66 20 61 20 63 6f 6d 70 | ns,.just.as.evaluation.of.a.comp |
| 144d80 | 6f 75 6e 64 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 61 63 63 6f 6d 70 6c 69 73 68 65 64 20 | ound.expression.is.accomplished. |
| 144da0 | 62 79 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 63 6f 6d 70 6f 6e 65 6e 74 0a 65 78 70 72 | by.evaluating.the.component.expr |
| 144dc0 | 65 73 73 69 6f 6e 73 2e 0a 0a 20 20 20 54 68 65 20 73 69 6d 70 6c 65 73 74 20 6d 65 74 68 6f 64 | essions......The.simplest.method |
| 144de0 | 20 66 6f 72 20 63 6f 6d 62 69 6e 69 6e 67 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 | .for.combining.instruction.seque |
| 144e00 | 6e 63 65 73 20 69 73 20 61 0a 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 65 64 20 60 61 70 70 65 | nces.is.a.procedure.called.`appe |
| 144e20 | 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 27 2e 20 20 49 74 20 74 | nd-instruction-sequences'...It.t |
| 144e40 | 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 0a 61 6e 79 20 6e 75 6d 62 65 72 20 6f 66 20 | akes.as.arguments.any.number.of. |
| 144e60 | 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 74 68 61 74 20 61 72 65 20 74 | instruction.sequences.that.are.t |
| 144e80 | 6f 20 62 65 20 65 78 65 63 75 74 65 64 0a 73 65 71 75 65 6e 74 69 61 6c 6c 79 3b 20 69 74 20 61 | o.be.executed.sequentially;.it.a |
| 144ea0 | 70 70 65 6e 64 73 20 74 68 65 6d 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 63 6f 6d 62 | ppends.them.and.returns.the.comb |
| 144ec0 | 69 6e 65 64 20 73 65 71 75 65 6e 63 65 2e 20 20 54 68 61 74 0a 69 73 2c 20 69 66 20 3c 53 45 51 | ined.sequence...That.is,.if.<SEQ |
| 144ee0 | 5f 31 3e 20 61 6e 64 20 3c 53 45 51 5f 32 3e 20 61 72 65 20 73 65 71 75 65 6e 63 65 73 20 6f 66 | _1>.and.<SEQ_2>.are.sequences.of |
| 144f00 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2c 20 74 68 65 6e 0a 65 76 61 6c 75 61 74 69 6e 67 0a 0a | .instructions,.then.evaluating.. |
| 144f20 | 20 20 20 20 20 28 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 | .....(append-instruction-sequenc |
| 144f40 | 65 73 20 3c 53 45 51 5f 31 3e 20 3c 53 45 51 5f 32 3e 29 0a 0a 70 72 6f 64 75 63 65 73 20 74 68 | es.<SEQ_1>.<SEQ_2>)..produces.th |
| 144f60 | 65 20 73 65 71 75 65 6e 63 65 0a 0a 20 20 20 20 20 3c 53 45 51 5f 31 3e 0a 20 20 20 20 20 3c 53 | e.sequence.......<SEQ_1>......<S |
| 144f80 | 45 51 5f 32 3e 0a 0a 20 20 20 57 68 65 6e 65 76 65 72 20 72 65 67 69 73 74 65 72 73 20 6d 69 67 | EQ_2>.....Whenever.registers.mig |
| 144fa0 | 68 74 20 6e 65 65 64 20 74 6f 20 62 65 20 73 61 76 65 64 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 | ht.need.to.be.saved,.the.compile |
| 144fc0 | 72 27 73 20 63 6f 64 65 0a 67 65 6e 65 72 61 74 6f 72 73 20 75 73 65 20 60 70 72 65 73 65 72 76 | r's.code.generators.use.`preserv |
| 144fe0 | 69 6e 67 27 2c 20 77 68 69 63 68 20 69 73 20 61 20 6d 6f 72 65 20 73 75 62 74 6c 65 20 6d 65 74 | ing',.which.is.a.more.subtle.met |
| 145000 | 68 6f 64 20 66 6f 72 0a 63 6f 6d 62 69 6e 69 6e 67 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 | hod.for.combining.instruction.se |
| 145020 | 71 75 65 6e 63 65 73 2e 20 20 60 50 72 65 73 65 72 76 69 6e 67 27 20 74 61 6b 65 73 20 74 68 72 | quences...`Preserving'.takes.thr |
| 145040 | 65 65 20 61 72 67 75 6d 65 6e 74 73 3a 20 61 0a 73 65 74 20 6f 66 20 72 65 67 69 73 74 65 72 73 | ee.arguments:.a.set.of.registers |
| 145060 | 20 61 6e 64 20 74 77 6f 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 74 | .and.two.instruction.sequences.t |
| 145080 | 68 61 74 20 61 72 65 20 74 6f 20 62 65 20 65 78 65 63 75 74 65 64 0a 73 65 71 75 65 6e 74 69 61 | hat.are.to.be.executed.sequentia |
| 1450a0 | 6c 6c 79 2e 20 20 49 74 20 61 70 70 65 6e 64 73 20 74 68 65 20 73 65 71 75 65 6e 63 65 73 20 69 | lly...It.appends.the.sequences.i |
| 1450c0 | 6e 20 73 75 63 68 20 61 20 77 61 79 20 74 68 61 74 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 0a 6f | n.such.a.way.that.the.contents.o |
| 1450e0 | 66 20 65 61 63 68 20 72 65 67 69 73 74 65 72 20 69 6e 20 74 68 65 20 73 65 74 20 69 73 20 70 72 | f.each.register.in.the.set.is.pr |
| 145100 | 65 73 65 72 76 65 64 20 6f 76 65 72 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 74 68 | eserved.over.the.execution.of.th |
| 145120 | 65 0a 66 69 72 73 74 20 73 65 71 75 65 6e 63 65 2c 20 69 66 20 74 68 69 73 20 69 73 20 6e 65 65 | e.first.sequence,.if.this.is.nee |
| 145140 | 64 65 64 20 66 6f 72 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 65 63 | ded.for.the.execution.of.the.sec |
| 145160 | 6f 6e 64 0a 73 65 71 75 65 6e 63 65 2e 20 20 54 68 61 74 20 69 73 2c 20 69 66 20 74 68 65 20 66 | ond.sequence...That.is,.if.the.f |
| 145180 | 69 72 73 74 20 73 65 71 75 65 6e 63 65 20 6d 6f 64 69 66 69 65 73 20 74 68 65 20 72 65 67 69 73 | irst.sequence.modifies.the.regis |
| 1451a0 | 74 65 72 20 61 6e 64 20 74 68 65 0a 73 65 63 6f 6e 64 20 73 65 71 75 65 6e 63 65 20 61 63 74 75 | ter.and.the.second.sequence.actu |
| 1451c0 | 61 6c 6c 79 20 6e 65 65 64 73 20 74 68 65 20 72 65 67 69 73 74 65 72 27 73 20 6f 72 69 67 69 6e | ally.needs.the.register's.origin |
| 1451e0 | 61 6c 20 63 6f 6e 74 65 6e 74 73 2c 20 74 68 65 6e 0a 60 70 72 65 73 65 72 76 69 6e 67 27 20 77 | al.contents,.then.`preserving'.w |
| 145200 | 72 61 70 73 20 61 20 60 73 61 76 65 27 20 61 6e 64 20 61 20 60 72 65 73 74 6f 72 65 27 20 6f 66 | raps.a.`save'.and.a.`restore'.of |
| 145220 | 20 74 68 65 20 72 65 67 69 73 74 65 72 20 61 72 6f 75 6e 64 20 74 68 65 0a 66 69 72 73 74 20 73 | .the.register.around.the.first.s |
| 145240 | 65 71 75 65 6e 63 65 20 62 65 66 6f 72 65 20 61 70 70 65 6e 64 69 6e 67 20 74 68 65 20 73 65 71 | equence.before.appending.the.seq |
| 145260 | 75 65 6e 63 65 73 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 60 70 72 65 73 65 72 76 69 6e 67 27 | uences...Otherwise,.`preserving' |
| 145280 | 0a 73 69 6d 70 6c 79 20 72 65 74 75 72 6e 73 20 74 68 65 20 61 70 70 65 6e 64 65 64 20 69 6e 73 | .simply.returns.the.appended.ins |
| 1452a0 | 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 2e 20 20 54 68 75 73 2c 20 66 6f 72 20 65 | truction.sequences...Thus,.for.e |
| 1452c0 | 78 61 6d 70 6c 65 2c 0a 0a 20 20 20 20 20 28 70 72 65 73 65 72 76 69 6e 67 20 28 6c 69 73 74 20 | xample,.......(preserving.(list. |
| 1452e0 | 3c 52 45 47 5f 31 3e 20 3c 52 45 47 5f 32 3e 29 20 3c 53 45 51 5f 31 3e 20 3c 53 45 51 5f 32 3e | <REG_1>.<REG_2>).<SEQ_1>.<SEQ_2> |
| 145300 | 29 0a 0a 70 72 6f 64 75 63 65 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 | )..produces.one.of.the.following |
| 145320 | 20 66 6f 75 72 20 73 65 71 75 65 6e 63 65 73 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2c | .four.sequences.of.instructions, |
| 145340 | 20 64 65 70 65 6e 64 69 6e 67 0a 6f 6e 20 68 6f 77 20 3c 53 45 51 5f 31 3e 20 61 6e 64 20 3c 53 | .depending.on.how.<SEQ_1>.and.<S |
| 145360 | 45 51 5f 32 3e 20 75 73 65 20 3c 52 45 47 5f 31 3e 20 61 6e 64 20 3c 52 45 47 5f 32 3e 3a 0a 0a | EQ_2>.use.<REG_1>.and.<REG_2>:.. |
| 145380 | 20 20 20 20 20 3c 73 65 71 5f 31 3e 20 7c 20 28 73 61 76 65 20 3c 72 65 67 5f 31 3e 29 20 20 20 | .....<seq_1>.|.(save.<reg_1>)... |
| 1453a0 | 20 7c 20 28 73 61 76 65 20 3c 72 65 67 5f 32 3e 29 20 20 20 20 7c 20 28 73 61 76 65 20 3c 72 65 | .|.(save.<reg_2>)....|.(save.<re |
| 1453c0 | 67 5f 32 3e 29 0a 20 20 20 20 20 3c 73 65 71 5f 32 3e 20 7c 20 3c 73 65 71 5f 31 3e 20 20 20 20 | g_2>)......<seq_2>.|.<seq_1>.... |
| 1453e0 | 20 20 20 20 20 20 20 7c 20 3c 73 65 71 5f 31 3e 20 20 20 20 20 20 20 20 20 20 20 7c 20 28 73 61 | .......|.<seq_1>...........|.(sa |
| 145400 | 76 65 20 3c 72 65 67 5f 31 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 28 72 65 73 74 | ve.<reg_1>)..............|.(rest |
| 145420 | 6f 72 65 20 3c 72 65 67 5f 31 3e 29 20 7c 20 28 72 65 73 74 6f 72 65 20 3c 72 65 67 5f 32 3e 29 | ore.<reg_1>).|.(restore.<reg_2>) |
| 145440 | 20 7c 20 3c 73 65 71 5f 31 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 3c 73 65 71 5f 32 | .|.<seq_1>..............|.<seq_2 |
| 145460 | 3e 20 20 20 20 20 20 20 20 20 20 20 7c 20 3c 73 65 71 5f 32 3e 20 20 20 20 20 20 20 20 20 20 20 | >...........|.<seq_2>........... |
| 145480 | 7c 20 28 72 65 73 74 6f 72 65 20 3c 72 65 67 5f 31 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | |.(restore.<reg_1>)............. |
| 1454a0 | 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 | .|...................|.......... |
| 1454c0 | 20 20 20 20 20 20 20 20 20 7c 20 28 72 65 73 74 6f 72 65 20 3c 72 65 67 5f 32 3e 29 0a 20 20 20 | .........|.(restore.<reg_2>).... |
| 1454e0 | 20 20 20 20 20 20 20 20 20 20 7c 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 | ..........|...................|. |
| 145500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c 20 3c 73 65 71 5f 32 3e 0a 0a 20 20 20 | ..................|.<seq_2>..... |
| 145520 | 42 79 20 75 73 69 6e 67 20 60 70 72 65 73 65 72 76 69 6e 67 27 20 74 6f 20 63 6f 6d 62 69 6e 65 | By.using.`preserving'.to.combine |
| 145540 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 74 68 65 20 63 6f 6d 70 69 | .instruction.sequences.the.compi |
| 145560 | 6c 65 72 0a 61 76 6f 69 64 73 20 75 6e 6e 65 63 65 73 73 61 72 79 20 73 74 61 63 6b 20 6f 70 65 | ler.avoids.unnecessary.stack.ope |
| 145580 | 72 61 74 69 6f 6e 73 2e 20 20 54 68 69 73 20 61 6c 73 6f 20 69 73 6f 6c 61 74 65 73 20 74 68 65 | rations...This.also.isolates.the |
| 1455a0 | 20 64 65 74 61 69 6c 73 20 6f 66 0a 77 68 65 74 68 65 72 20 6f 72 20 6e 6f 74 20 74 6f 20 67 65 | .details.of.whether.or.not.to.ge |
| 1455c0 | 6e 65 72 61 74 65 20 60 73 61 76 65 27 20 61 6e 64 20 60 72 65 73 74 6f 72 65 27 20 69 6e 73 74 | nerate.`save'.and.`restore'.inst |
| 1455e0 | 72 75 63 74 69 6f 6e 73 20 77 69 74 68 69 6e 20 74 68 65 0a 60 70 72 65 73 65 72 76 69 6e 67 27 | ructions.within.the.`preserving' |
| 145600 | 20 70 72 6f 63 65 64 75 72 65 2c 20 73 65 70 61 72 61 74 69 6e 67 20 74 68 65 6d 20 66 72 6f 6d | .procedure,.separating.them.from |
| 145620 | 20 74 68 65 20 63 6f 6e 63 65 72 6e 73 20 74 68 61 74 20 61 72 69 73 65 20 69 6e 0a 77 72 69 74 | .the.concerns.that.arise.in.writ |
| 145640 | 69 6e 67 20 65 61 63 68 20 6f 66 20 74 68 65 20 69 6e 64 69 76 69 64 75 61 6c 20 63 6f 64 65 20 | ing.each.of.the.individual.code. |
| 145660 | 67 65 6e 65 72 61 74 6f 72 73 2e 20 20 49 6e 20 66 61 63 74 20 6e 6f 20 60 73 61 76 65 27 20 6f | generators...In.fact.no.`save'.o |
| 145680 | 72 0a 60 72 65 73 74 6f 72 65 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 61 72 65 20 65 78 70 | r.`restore'.instructions.are.exp |
| 1456a0 | 6c 69 63 69 74 6c 79 20 70 72 6f 64 75 63 65 64 20 62 79 20 74 68 65 20 63 6f 64 65 20 67 65 6e | licitly.produced.by.the.code.gen |
| 1456c0 | 65 72 61 74 6f 72 73 2e 0a 0a 20 20 20 49 6e 20 70 72 69 6e 63 69 70 6c 65 2c 20 77 65 20 63 6f | erators......In.principle,.we.co |
| 1456e0 | 75 6c 64 20 72 65 70 72 65 73 65 6e 74 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 | uld.represent.an.instruction.seq |
| 145700 | 75 65 6e 63 65 20 73 69 6d 70 6c 79 20 61 73 20 61 0a 6c 69 73 74 20 6f 66 20 69 6e 73 74 72 75 | uence.simply.as.a.list.of.instru |
| 145720 | 63 74 69 6f 6e 73 2e 20 20 60 41 70 70 65 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 | ctions...`Append-instruction-seq |
| 145740 | 75 65 6e 63 65 73 27 20 63 6f 75 6c 64 20 74 68 65 6e 20 63 6f 6d 62 69 6e 65 0a 69 6e 73 74 72 | uences'.could.then.combine.instr |
| 145760 | 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 62 79 20 70 65 72 66 6f 72 6d 69 6e 67 20 61 | uction.sequences.by.performing.a |
| 145780 | 6e 20 6f 72 64 69 6e 61 72 79 20 6c 69 73 74 20 60 61 70 70 65 6e 64 27 2e 20 20 48 6f 77 65 76 | n.ordinary.list.`append'...Howev |
| 1457a0 | 65 72 2c 0a 60 70 72 65 73 65 72 76 69 6e 67 27 20 77 6f 75 6c 64 20 74 68 65 6e 20 62 65 20 61 | er,.`preserving'.would.then.be.a |
| 1457c0 | 20 63 6f 6d 70 6c 65 78 20 6f 70 65 72 61 74 69 6f 6e 2c 20 62 65 63 61 75 73 65 20 69 74 20 77 | .complex.operation,.because.it.w |
| 1457e0 | 6f 75 6c 64 20 68 61 76 65 20 74 6f 0a 61 6e 61 6c 79 7a 65 20 65 61 63 68 20 69 6e 73 74 72 75 | ould.have.to.analyze.each.instru |
| 145800 | 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 68 6f 77 20 | ction.sequence.to.determine.how. |
| 145820 | 74 68 65 20 73 65 71 75 65 6e 63 65 20 75 73 65 73 20 69 74 73 0a 72 65 67 69 73 74 65 72 73 2e | the.sequence.uses.its.registers. |
| 145840 | 20 20 60 50 72 65 73 65 72 76 69 6e 67 27 20 77 6f 75 6c 64 20 62 65 20 69 6e 65 66 66 69 63 69 | ..`Preserving'.would.be.ineffici |
| 145860 | 65 6e 74 20 61 73 20 77 65 6c 6c 20 61 73 20 63 6f 6d 70 6c 65 78 2c 0a 62 65 63 61 75 73 65 20 | ent.as.well.as.complex,.because. |
| 145880 | 69 74 20 77 6f 75 6c 64 20 68 61 76 65 20 74 6f 20 61 6e 61 6c 79 7a 65 20 65 61 63 68 20 6f 66 | it.would.have.to.analyze.each.of |
| 1458a0 | 20 69 74 73 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 0a 61 72 67 75 6d 65 | .its.instruction.sequence.argume |
| 1458c0 | 6e 74 73 2c 20 65 76 65 6e 20 74 68 6f 75 67 68 20 74 68 65 73 65 20 73 65 71 75 65 6e 63 65 73 | nts,.even.though.these.sequences |
| 1458e0 | 20 6d 69 67 68 74 20 74 68 65 6d 73 65 6c 76 65 73 20 68 61 76 65 20 62 65 65 6e 0a 63 6f 6e 73 | .might.themselves.have.been.cons |
| 145900 | 74 72 75 63 74 65 64 20 62 79 20 63 61 6c 6c 73 20 74 6f 20 60 70 72 65 73 65 72 76 69 6e 67 27 | tructed.by.calls.to.`preserving' |
| 145920 | 2c 20 69 6e 20 77 68 69 63 68 20 63 61 73 65 20 74 68 65 69 72 20 70 61 72 74 73 20 77 6f 75 6c | ,.in.which.case.their.parts.woul |
| 145940 | 64 0a 68 61 76 65 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 61 6e 61 6c 79 7a 65 64 2e 20 20 54 | d.have.already.been.analyzed...T |
| 145960 | 6f 20 61 76 6f 69 64 20 73 75 63 68 20 72 65 70 65 74 69 74 69 6f 75 73 20 61 6e 61 6c 79 73 69 | o.avoid.such.repetitious.analysi |
| 145980 | 73 20 77 65 20 77 69 6c 6c 0a 61 73 73 6f 63 69 61 74 65 20 77 69 74 68 20 65 61 63 68 20 69 6e | s.we.will.associate.with.each.in |
| 1459a0 | 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 73 6f 6d 65 20 69 6e 66 6f 72 6d 61 74 | struction.sequence.some.informat |
| 1459c0 | 69 6f 6e 20 61 62 6f 75 74 20 69 74 73 0a 72 65 67 69 73 74 65 72 20 75 73 65 2e 20 20 57 68 65 | ion.about.its.register.use...Whe |
| 1459e0 | 6e 20 77 65 20 63 6f 6e 73 74 72 75 63 74 20 61 20 62 61 73 69 63 20 69 6e 73 74 72 75 63 74 69 | n.we.construct.a.basic.instructi |
| 145a00 | 6f 6e 20 73 65 71 75 65 6e 63 65 20 77 65 20 77 69 6c 6c 0a 70 72 6f 76 69 64 65 20 74 68 69 73 | on.sequence.we.will.provide.this |
| 145a20 | 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 65 78 70 6c 69 63 69 74 6c 79 2c 20 61 6e 64 20 74 68 65 | .information.explicitly,.and.the |
| 145a40 | 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 63 6f 6d 62 69 6e 65 0a 69 6e 73 74 72 75 63 | .procedures.that.combine.instruc |
| 145a60 | 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 77 69 6c 6c 20 64 65 72 69 76 65 20 72 65 67 69 73 | tion.sequences.will.derive.regis |
| 145a80 | 74 65 72 2d 75 73 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 0a 63 6f 6d 62 | ter-use.information.for.the.comb |
| 145aa0 | 69 6e 65 64 20 73 65 71 75 65 6e 63 65 20 66 72 6f 6d 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 | ined.sequence.from.the.informati |
| 145ac0 | 6f 6e 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 65 20 63 6f 6d 70 6f 6e 65 6e 74 | on.associated.with.the.component |
| 145ae0 | 0a 73 65 71 75 65 6e 63 65 73 2e 0a 0a 20 20 20 41 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 | .sequences......An.instruction.s |
| 145b00 | 65 71 75 65 6e 63 65 20 77 69 6c 6c 20 63 6f 6e 74 61 69 6e 20 74 68 72 65 65 20 70 69 65 63 65 | equence.will.contain.three.piece |
| 145b20 | 73 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 0a 20 20 20 2a 20 74 68 65 20 73 65 74 20 | s.of.information:.....*.the.set. |
| 145b40 | 6f 66 20 72 65 67 69 73 74 65 72 73 20 74 68 61 74 20 6d 75 73 74 20 62 65 20 69 6e 69 74 69 61 | of.registers.that.must.be.initia |
| 145b60 | 6c 69 7a 65 64 20 62 65 66 6f 72 65 20 74 68 65 0a 20 20 20 20 20 69 6e 73 74 72 75 63 74 69 6f | lized.before.the......instructio |
| 145b80 | 6e 73 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 61 72 65 20 65 78 65 63 75 74 65 64 20 | ns.in.the.sequence.are.executed. |
| 145ba0 | 28 74 68 65 73 65 20 72 65 67 69 73 74 65 72 73 20 61 72 65 0a 20 20 20 20 20 73 61 69 64 20 74 | (these.registers.are......said.t |
| 145bc0 | 6f 20 62 65 20 22 6e 65 65 64 65 64 22 20 62 79 20 74 68 65 20 73 65 71 75 65 6e 63 65 29 2c 0a | o.be."needed".by.the.sequence),. |
| 145be0 | 0a 20 20 20 2a 20 74 68 65 20 73 65 74 20 6f 66 20 72 65 67 69 73 74 65 72 73 20 77 68 6f 73 65 | ....*.the.set.of.registers.whose |
| 145c00 | 20 76 61 6c 75 65 73 20 61 72 65 20 6d 6f 64 69 66 69 65 64 20 62 79 20 74 68 65 20 69 6e 73 74 | .values.are.modified.by.the.inst |
| 145c20 | 72 75 63 74 69 6f 6e 73 0a 20 20 20 20 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 2c 20 61 | ructions......in.the.sequence,.a |
| 145c40 | 6e 64 0a 0a 20 20 20 2a 20 74 68 65 20 61 63 74 75 61 6c 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 | nd.....*.the.actual.instructions |
| 145c60 | 20 28 61 6c 73 6f 20 63 61 6c 6c 65 64 20 22 73 74 61 74 65 6d 65 6e 74 73 22 29 20 69 6e 20 74 | .(also.called."statements").in.t |
| 145c80 | 68 65 20 73 65 71 75 65 6e 63 65 2e 0a 0a 0a 20 20 20 57 65 20 77 69 6c 6c 20 72 65 70 72 65 73 | he.sequence.......We.will.repres |
| 145ca0 | 65 6e 74 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 61 73 20 61 | ent.an.instruction.sequence.as.a |
| 145cc0 | 20 6c 69 73 74 20 6f 66 20 69 74 73 20 74 68 72 65 65 0a 70 61 72 74 73 2e 20 20 54 68 65 20 63 | .list.of.its.three.parts...The.c |
| 145ce0 | 6f 6e 73 74 72 75 63 74 6f 72 20 66 6f 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 | onstructor.for.instruction.seque |
| 145d00 | 6e 63 65 73 20 69 73 20 74 68 75 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 | nces.is.thus.......(define.(make |
| 145d20 | 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 6e 65 65 64 73 20 6d 6f 64 69 | -instruction-sequence.needs.modi |
| 145d40 | 66 69 65 73 20 73 74 61 74 65 6d 65 6e 74 73 29 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 6e 65 | fies.statements)........(list.ne |
| 145d60 | 65 64 73 20 6d 6f 64 69 66 69 65 73 20 73 74 61 74 65 6d 65 6e 74 73 29 29 0a 0a 20 20 20 46 6f | eds.modifies.statements)).....Fo |
| 145d80 | 72 20 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 74 77 6f 2d 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 | r.example,.the.two-instruction.s |
| 145da0 | 65 71 75 65 6e 63 65 20 74 68 61 74 20 6c 6f 6f 6b 73 20 75 70 20 74 68 65 20 76 61 6c 75 65 20 | equence.that.looks.up.the.value. |
| 145dc0 | 6f 66 0a 74 68 65 20 76 61 72 69 61 62 6c 65 20 60 78 27 20 69 6e 20 74 68 65 20 63 75 72 72 65 | of.the.variable.`x'.in.the.curre |
| 145de0 | 6e 74 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 61 73 73 69 67 6e 73 20 74 68 65 20 72 65 73 75 | nt.environment,.assigns.the.resu |
| 145e00 | 6c 74 20 74 6f 0a 60 76 61 6c 27 2c 20 61 6e 64 20 74 68 65 6e 20 72 65 74 75 72 6e 73 2c 20 72 | lt.to.`val',.and.then.returns,.r |
| 145e20 | 65 71 75 69 72 65 73 20 72 65 67 69 73 74 65 72 73 20 60 65 6e 76 27 20 61 6e 64 20 60 63 6f 6e | equires.registers.`env'.and.`con |
| 145e40 | 74 69 6e 75 65 27 20 74 6f 20 68 61 76 65 0a 62 65 65 6e 20 69 6e 69 74 69 61 6c 69 7a 65 64 2c | tinue'.to.have.been.initialized, |
| 145e60 | 20 61 6e 64 20 6d 6f 64 69 66 69 65 73 20 72 65 67 69 73 74 65 72 20 60 76 61 6c 27 2e 20 20 54 | .and.modifies.register.`val'...T |
| 145e80 | 68 69 73 20 73 65 71 75 65 6e 63 65 20 77 6f 75 6c 64 0a 74 68 65 72 65 66 6f 72 65 20 62 65 20 | his.sequence.would.therefore.be. |
| 145ea0 | 63 6f 6e 73 74 72 75 63 74 65 64 20 61 73 0a 0a 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 | constructed.as.......(make-instr |
| 145ec0 | 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 65 6e 76 20 63 6f 6e 74 69 6e 75 65 29 20 | uction-sequence.'(env.continue). |
| 145ee0 | 27 28 76 61 6c 29 0a 20 20 20 20 20 20 27 28 28 61 73 73 69 67 6e 20 76 61 6c 0a 20 20 20 20 20 | '(val).......'((assign.val...... |
| 145f00 | 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 | ...........(op.lookup-variable-v |
| 145f20 | 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 78 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 | alue).(const.x).(reg.env))...... |
| 145f40 | 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 29 29 0a 0a 20 20 20 57 | ...(goto.(reg.continue)))).....W |
| 145f60 | 65 20 73 6f 6d 65 74 69 6d 65 73 20 6e 65 65 64 20 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 61 6e | e.sometimes.need.to.construct.an |
| 145f80 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 77 69 74 68 20 6e 6f 0a 73 74 | .instruction.sequence.with.no.st |
| 145fa0 | 61 74 65 6d 65 6e 74 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6d 70 74 79 2d 69 | atements:.......(define.(empty-i |
| 145fc0 | 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 28 6d 61 6b | nstruction-sequence)........(mak |
| 145fe0 | 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 29 20 27 28 29 20 27 | e-instruction-sequence.'().'().' |
| 146000 | 28 29 29 29 0a 0a 20 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 73 20 66 6f 72 20 63 6f 6d 62 | ())).....The.procedures.for.comb |
| 146020 | 69 6e 69 6e 67 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 61 72 65 20 | ining.instruction.sequences.are. |
| 146040 | 73 68 6f 77 6e 20 69 6e 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 2d 34 3a 3a 2e 0a | shown.in.section.*Note.5-5-4::.. |
| 146060 | 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 33 31 3a 2a 20 49 6e 20 65 76 61 6c 75 61 | ......*Exercise.5.31:*.In.evalua |
| 146080 | 74 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 2c 20 74 68 | ting.a.procedure.application,.th |
| 1460a0 | 65 0a 20 20 20 20 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f | e......explicit-control.evaluato |
| 1460c0 | 72 20 61 6c 77 61 79 73 20 73 61 76 65 73 20 61 6e 64 20 72 65 73 74 6f 72 65 73 20 74 68 65 20 | r.always.saves.and.restores.the. |
| 1460e0 | 60 65 6e 76 27 0a 20 20 20 20 20 72 65 67 69 73 74 65 72 20 61 72 6f 75 6e 64 20 74 68 65 20 65 | `env'......register.around.the.e |
| 146100 | 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6f 70 65 72 61 74 6f 72 2c 20 73 61 76 65 73 | valuation.of.the.operator,.saves |
| 146120 | 20 61 6e 64 20 72 65 73 74 6f 72 65 73 0a 20 20 20 20 20 60 65 6e 76 27 20 61 72 6f 75 6e 64 20 | .and.restores......`env'.around. |
| 146140 | 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 65 61 63 68 20 6f 70 65 72 61 6e 64 20 28 | the.evaluation.of.each.operand.( |
| 146160 | 65 78 63 65 70 74 20 74 68 65 20 66 69 6e 61 6c 0a 20 20 20 20 20 6f 6e 65 29 2c 20 73 61 76 65 | except.the.final......one),.save |
| 146180 | 73 20 61 6e 64 20 72 65 73 74 6f 72 65 73 20 60 61 72 67 6c 27 20 61 72 6f 75 6e 64 20 74 68 65 | s.and.restores.`argl'.around.the |
| 1461a0 | 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 65 61 63 68 0a 20 20 20 20 20 6f 70 65 72 61 6e 64 | .evaluation.of.each......operand |
| 1461c0 | 2c 20 61 6e 64 20 73 61 76 65 73 20 61 6e 64 20 72 65 73 74 6f 72 65 73 20 60 70 72 6f 63 27 20 | ,.and.saves.and.restores.`proc'. |
| 1461e0 | 61 72 6f 75 6e 64 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 74 68 | around.the.evaluation.of......th |
| 146200 | 65 20 6f 70 65 72 61 6e 64 20 73 65 71 75 65 6e 63 65 2e 20 20 46 6f 72 20 65 61 63 68 20 6f 66 | e.operand.sequence...For.each.of |
| 146220 | 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 2c 20 73 61 79 | .the.following.combinations,.say |
| 146240 | 0a 20 20 20 20 20 77 68 69 63 68 20 6f 66 20 74 68 65 73 65 20 60 73 61 76 65 27 20 61 6e 64 20 | ......which.of.these.`save'.and. |
| 146260 | 60 72 65 73 74 6f 72 65 27 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 72 65 20 73 75 70 65 72 66 6c | `restore'.operations.are.superfl |
| 146280 | 75 6f 75 73 20 61 6e 64 0a 20 20 20 20 20 74 68 75 73 20 63 6f 75 6c 64 20 62 65 20 65 6c 69 6d | uous.and......thus.could.be.elim |
| 1462a0 | 69 6e 61 74 65 64 20 62 79 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 27 73 20 60 70 72 65 73 65 72 | inated.by.the.compiler's.`preser |
| 1462c0 | 76 69 6e 67 27 20 6d 65 63 68 61 6e 69 73 6d 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 20 27 | ving'.mechanism:............(f.' |
| 1462e0 | 78 20 27 79 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 28 66 29 20 27 78 20 27 79 29 0a 0a 20 20 | x.'y)............((f).'x.'y).... |
| 146300 | 20 20 20 20 20 20 20 20 28 66 20 28 67 20 27 78 29 20 79 29 0a 0a 20 20 20 20 20 20 20 20 20 20 | ........(f.(g.'x).y)............ |
| 146320 | 28 66 20 28 67 20 27 78 29 20 27 79 29 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e | (f.(g.'x).'y).......*Exercise.5. |
| 146340 | 33 32 3a 2a 20 55 73 69 6e 67 20 74 68 65 20 60 70 72 65 73 65 72 76 69 6e 67 27 20 6d 65 63 68 | 32:*.Using.the.`preserving'.mech |
| 146360 | 61 6e 69 73 6d 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 0a 20 20 20 20 20 77 69 6c 6c 20 61 76 | anism,.the.compiler......will.av |
| 146380 | 6f 69 64 20 73 61 76 69 6e 67 20 61 6e 64 20 72 65 73 74 6f 72 69 6e 67 20 60 65 6e 76 27 20 61 | oid.saving.and.restoring.`env'.a |
| 1463a0 | 72 6f 75 6e 64 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 0a 20 20 20 20 | round.the.evaluation.of.the..... |
| 1463c0 | 20 6f 70 65 72 61 74 6f 72 20 6f 66 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 69 6e 20 74 68 | .operator.of.a.combination.in.th |
| 1463e0 | 65 20 63 61 73 65 20 77 68 65 72 65 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 69 73 20 61 0a 20 | e.case.where.the.operator.is.a.. |
| 146400 | 20 20 20 20 73 79 6d 62 6f 6c 2e 20 20 57 65 20 63 6f 75 6c 64 20 61 6c 73 6f 20 62 75 69 6c 64 | ....symbol...We.could.also.build |
| 146420 | 20 73 75 63 68 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 73 20 69 6e 74 6f 20 74 68 65 0a 20 20 20 | .such.optimizations.into.the.... |
| 146440 | 20 20 65 76 61 6c 75 61 74 6f 72 2e 20 20 49 6e 64 65 65 64 2c 20 74 68 65 20 65 78 70 6c 69 63 | ..evaluator...Indeed,.the.explic |
| 146460 | 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 0a | it-control.evaluator.of.section. |
| 146480 | 20 20 20 20 20 2a 4e 6f 74 65 20 35 2d 34 3a 3a 20 61 6c 72 65 61 64 79 20 70 65 72 66 6f 72 6d | .....*Note.5-4::.already.perform |
| 1464a0 | 73 20 61 20 73 69 6d 69 6c 61 72 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 2c 20 62 79 20 74 72 65 | s.a.similar.optimization,.by.tre |
| 1464c0 | 61 74 69 6e 67 0a 20 20 20 20 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 77 69 74 68 20 6e 6f 20 | ating......combinations.with.no. |
| 1464e0 | 6f 70 65 72 61 6e 64 73 20 61 73 20 61 20 73 70 65 63 69 61 6c 20 63 61 73 65 2e 0a 0a 20 20 20 | operands.as.a.special.case...... |
| 146500 | 20 20 20 20 61 2e 20 45 78 74 65 6e 64 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 | ....a..Extend.the.explicit-contr |
| 146520 | 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 72 65 63 6f 67 6e 69 7a 65 20 61 73 20 61 0a 20 | ol.evaluator.to.recognize.as.a.. |
| 146540 | 20 20 20 20 20 20 20 20 20 73 65 70 61 72 61 74 65 20 63 6c 61 73 73 20 6f 66 20 65 78 70 72 65 | .........separate.class.of.expre |
| 146560 | 73 73 69 6f 6e 73 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 20 77 68 6f 73 65 20 6f 70 65 72 61 74 | ssions.combinations.whose.operat |
| 146580 | 6f 72 20 69 73 0a 20 20 20 20 20 20 20 20 20 20 61 20 73 79 6d 62 6f 6c 2c 20 61 6e 64 20 74 6f | or.is...........a.symbol,.and.to |
| 1465a0 | 20 74 61 6b 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 74 68 69 73 20 66 61 63 74 20 69 6e 20 | .take.advantage.of.this.fact.in. |
| 1465c0 | 65 76 61 6c 75 61 74 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 73 75 63 68 20 65 78 70 72 65 73 | evaluating...........such.expres |
| 1465e0 | 73 69 6f 6e 73 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 41 6c 79 73 73 61 20 50 2e 20 48 61 63 6b | sions..........b..Alyssa.P..Hack |
| 146600 | 65 72 20 73 75 67 67 65 73 74 73 20 74 68 61 74 20 62 79 20 65 78 74 65 6e 64 69 6e 67 20 74 68 | er.suggests.that.by.extending.th |
| 146620 | 65 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 0a 20 20 20 20 20 20 20 20 20 20 72 65 63 6f 67 6e 69 | e.evaluator.to...........recogni |
| 146640 | 7a 65 20 6d 6f 72 65 20 61 6e 64 20 6d 6f 72 65 20 73 70 65 63 69 61 6c 20 63 61 73 65 73 20 77 | ze.more.and.more.special.cases.w |
| 146660 | 65 20 63 6f 75 6c 64 20 69 6e 63 6f 72 70 6f 72 61 74 65 0a 20 20 20 20 20 20 20 20 20 20 61 6c | e.could.incorporate...........al |
| 146680 | 6c 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 27 73 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 73 2c 20 | l.the.compiler's.optimizations,. |
| 1466a0 | 61 6e 64 20 74 68 61 74 20 74 68 69 73 20 77 6f 75 6c 64 0a 20 20 20 20 20 20 20 20 20 20 65 6c | and.that.this.would...........el |
| 1466c0 | 69 6d 69 6e 61 74 65 20 74 68 65 20 61 64 76 61 6e 74 61 67 65 20 6f 66 20 63 6f 6d 70 69 6c 61 | iminate.the.advantage.of.compila |
| 1466e0 | 74 69 6f 6e 20 61 6c 74 6f 67 65 74 68 65 72 2e 20 20 57 68 61 74 20 64 6f 0a 20 20 20 20 20 20 | tion.altogether...What.do....... |
| 146700 | 20 20 20 20 79 6f 75 20 74 68 69 6e 6b 20 6f 66 20 74 68 69 73 20 69 64 65 61 3f 0a 0a 0a 20 20 | ....you.think.of.this.idea?..... |
| 146720 | 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | .----------.Footnotes.---------- |
| 146740 | 0a 0a 20 20 20 28 31 29 20 4e 6f 74 69 63 65 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 61 74 20 6f | .....(1).Notice,.however,.that.o |
| 146760 | 75 72 20 63 6f 6d 70 69 6c 65 72 20 69 73 20 61 20 53 63 68 65 6d 65 20 70 72 6f 67 72 61 6d 2c | ur.compiler.is.a.Scheme.program, |
| 146780 | 20 61 6e 64 20 74 68 65 0a 73 79 6e 74 61 78 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 74 20 | .and.the.syntax.procedures.that. |
| 1467a0 | 69 74 20 75 73 65 73 20 74 6f 20 6d 61 6e 69 70 75 6c 61 74 65 20 65 78 70 72 65 73 73 69 6f 6e | it.uses.to.manipulate.expression |
| 1467c0 | 73 20 61 72 65 20 74 68 65 20 61 63 74 75 61 6c 0a 53 63 68 65 6d 65 20 70 72 6f 63 65 64 75 72 | s.are.the.actual.Scheme.procedur |
| 1467e0 | 65 73 20 75 73 65 64 20 77 69 74 68 20 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 | es.used.with.the.metacircular.ev |
| 146800 | 61 6c 75 61 74 6f 72 2e 20 20 46 6f 72 20 74 68 65 0a 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 | aluator...For.the.explicit-contr |
| 146820 | 6f 6c 20 65 76 61 6c 75 61 74 6f 72 2c 20 69 6e 20 63 6f 6e 74 72 61 73 74 2c 20 77 65 20 61 73 | ol.evaluator,.in.contrast,.we.as |
| 146840 | 73 75 6d 65 64 20 74 68 61 74 20 65 71 75 69 76 61 6c 65 6e 74 0a 73 79 6e 74 61 78 20 6f 70 65 | sumed.that.equivalent.syntax.ope |
| 146860 | 72 61 74 69 6f 6e 73 20 77 65 72 65 20 61 76 61 69 6c 61 62 6c 65 20 61 73 20 6f 70 65 72 61 74 | rations.were.available.as.operat |
| 146880 | 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 72 65 67 69 73 74 65 72 0a 6d 61 63 68 69 6e 65 2e 20 20 | ions.for.the.register.machine... |
| 1468a0 | 28 4f 66 20 63 6f 75 72 73 65 2c 20 77 68 65 6e 20 77 65 20 73 69 6d 75 6c 61 74 65 64 20 74 68 | (Of.course,.when.we.simulated.th |
| 1468c0 | 65 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 69 6e 20 53 63 68 65 6d 65 2c 0a 77 65 | e.register.machine.in.Scheme,.we |
| 1468e0 | 20 75 73 65 64 20 74 68 65 20 61 63 74 75 61 6c 20 53 63 68 65 6d 65 20 70 72 6f 63 65 64 75 72 | .used.the.actual.Scheme.procedur |
| 146900 | 65 73 20 69 6e 20 6f 75 72 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 0a 73 69 6d 75 6c | es.in.our.register.machine.simul |
| 146920 | 61 74 69 6f 6e 2e 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 | ation.)....File:.sicp.info,..Nod |
| 146940 | 65 3a 20 35 2d 35 2d 32 2c 20 20 4e 65 78 74 3a 20 35 2d 35 2d 33 2c 20 20 50 72 65 76 3a 20 35 | e:.5-5-2,..Next:.5-5-3,..Prev:.5 |
| 146960 | 2d 35 2d 31 2c 20 20 55 70 3a 20 35 2d 35 0a 0a 35 2e 35 2e 32 20 43 6f 6d 70 69 6c 69 6e 67 20 | -5-1,..Up:.5-5..5.5.2.Compiling. |
| 146980 | 45 78 70 72 65 73 73 69 6f 6e 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | Expressions.-------------------- |
| 1469a0 | 2d 2d 2d 2d 2d 2d 2d 0a 0a 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 61 6e 64 20 74 68 65 | -------..In.this.section.and.the |
| 1469c0 | 20 6e 65 78 74 20 77 65 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 63 6f 64 65 20 67 65 6e 65 | .next.we.implement.the.code.gene |
| 1469e0 | 72 61 74 6f 72 73 20 74 6f 20 77 68 69 63 68 0a 74 68 65 20 60 63 6f 6d 70 69 6c 65 27 20 70 72 | rators.to.which.the.`compile'.pr |
| 146a00 | 6f 63 65 64 75 72 65 20 64 69 73 70 61 74 63 68 65 73 2e 0a 0a 43 6f 6d 70 69 6c 69 6e 67 20 6c | ocedure.dispatches...Compiling.l |
| 146a20 | 69 6e 6b 61 67 65 20 63 6f 64 65 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | inkage.code..................... |
| 146a40 | 2e 2e 0a 0a 49 6e 20 67 65 6e 65 72 61 6c 2c 20 74 68 65 20 6f 75 74 70 75 74 20 6f 66 20 65 61 | ....In.general,.the.output.of.ea |
| 146a60 | 63 68 20 63 6f 64 65 20 67 65 6e 65 72 61 74 6f 72 20 77 69 6c 6c 20 65 6e 64 20 77 69 74 68 0a | ch.code.generator.will.end.with. |
| 146a80 | 69 6e 73 74 72 75 63 74 69 6f 6e 73 2d 2d 67 65 6e 65 72 61 74 65 64 20 62 79 20 74 68 65 20 70 | instructions--generated.by.the.p |
| 146aa0 | 72 6f 63 65 64 75 72 65 20 60 63 6f 6d 70 69 6c 65 2d 6c 69 6e 6b 61 67 65 27 2d 2d 74 68 61 74 | rocedure.`compile-linkage'--that |
| 146ac0 | 0a 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 72 65 71 75 69 72 65 64 20 6c 69 6e 6b 61 67 65 2e | .implement.the.required.linkage. |
| 146ae0 | 20 20 49 66 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 69 73 20 60 72 65 74 75 72 6e 27 20 74 68 65 | ..If.the.linkage.is.`return'.the |
| 146b00 | 6e 20 77 65 20 6d 75 73 74 0a 67 65 6e 65 72 61 74 65 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 | n.we.must.generate.the.instructi |
| 146b20 | 6f 6e 20 60 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 27 2e 20 20 54 68 69 | on.`(goto.(reg.continue))'...Thi |
| 146b40 | 73 20 6e 65 65 64 73 20 74 68 65 0a 60 63 6f 6e 74 69 6e 75 65 27 20 72 65 67 69 73 74 65 72 20 | s.needs.the.`continue'.register. |
| 146b60 | 61 6e 64 20 64 6f 65 73 20 6e 6f 74 20 6d 6f 64 69 66 79 20 61 6e 79 20 72 65 67 69 73 74 65 72 | and.does.not.modify.any.register |
| 146b80 | 73 2e 20 20 49 66 20 74 68 65 20 6c 69 6e 6b 61 67 65 0a 69 73 20 60 6e 65 78 74 27 2c 20 74 68 | s...If.the.linkage.is.`next',.th |
| 146ba0 | 65 6e 20 77 65 20 6e 65 65 64 6e 27 74 20 69 6e 63 6c 75 64 65 20 61 6e 79 20 61 64 64 69 74 69 | en.we.needn't.include.any.additi |
| 146bc0 | 6f 6e 61 6c 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 0a 4f 74 68 65 72 77 69 73 65 2c 20 74 68 | onal.instructions..Otherwise,.th |
| 146be0 | 65 20 6c 69 6e 6b 61 67 65 20 69 73 20 61 20 6c 61 62 65 6c 2c 20 61 6e 64 20 77 65 20 67 65 6e | e.linkage.is.a.label,.and.we.gen |
| 146c00 | 65 72 61 74 65 20 61 20 60 67 6f 74 6f 27 20 74 6f 20 74 68 61 74 0a 6c 61 62 65 6c 2c 20 61 6e | erate.a.`goto'.to.that.label,.an |
| 146c20 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 74 68 61 74 20 64 6f 65 73 20 6e 6f 74 20 6e 65 65 64 20 | .instruction.that.does.not.need. |
| 146c40 | 6f 72 20 6d 6f 64 69 66 79 20 61 6e 79 20 72 65 67 69 73 74 65 72 73 2e 28 31 29 0a 0a 20 20 20 | or.modify.any.registers.(1)..... |
| 146c60 | 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d 6c 69 6e 6b 61 67 65 20 6c 69 6e 6b 61 | ..(define.(compile-linkage.linka |
| 146c80 | 67 65 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 65 71 3f 20 6c 69 6e 6b 61 67 65 20 27 | ge)........(cond.((eq?.linkage.' |
| 146ca0 | 72 65 74 75 72 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 | return)...............(make-inst |
| 146cc0 | 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 63 6f 6e 74 69 6e 75 65 29 20 27 28 29 | ruction-sequence.'(continue).'() |
| 146ce0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 28 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e | ................'((goto.(reg.con |
| 146d00 | 74 69 6e 75 65 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 65 71 3f 20 6c 69 | tinue)))))..............((eq?.li |
| 146d20 | 6e 6b 61 67 65 20 27 6e 65 78 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6d 70 74 | nkage.'next)...............(empt |
| 146d40 | 79 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 29 29 0a 20 20 20 20 20 20 20 | y-instruction-sequence))........ |
| 146d60 | 20 20 20 20 20 20 28 65 6c 73 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d | ......(else...............(make- |
| 146d80 | 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 29 20 27 28 29 0a 20 20 20 | instruction-sequence.'().'().... |
| 146da0 | 20 20 20 20 20 20 20 20 20 20 20 20 60 28 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 2c 6c 69 6e 6b | ............`((goto.(label.,link |
| 146dc0 | 61 67 65 29 29 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 6c 69 6e 6b 61 67 65 20 63 6f 64 65 20 | age))))))).....The.linkage.code. |
| 146de0 | 69 73 20 61 70 70 65 6e 64 65 64 20 74 6f 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 | is.appended.to.an.instruction.se |
| 146e00 | 71 75 65 6e 63 65 20 62 79 0a 60 70 72 65 73 65 72 76 69 6e 67 27 20 74 68 65 20 60 63 6f 6e 74 | quence.by.`preserving'.the.`cont |
| 146e20 | 69 6e 75 65 27 20 72 65 67 69 73 74 65 72 2c 20 73 69 6e 63 65 20 61 20 60 72 65 74 75 72 6e 27 | inue'.register,.since.a.`return' |
| 146e40 | 20 6c 69 6e 6b 61 67 65 20 77 69 6c 6c 0a 72 65 71 75 69 72 65 20 74 68 65 20 60 63 6f 6e 74 69 | .linkage.will.require.the.`conti |
| 146e60 | 6e 75 65 27 20 72 65 67 69 73 74 65 72 3a 20 49 66 20 74 68 65 20 67 69 76 65 6e 20 69 6e 73 74 | nue'.register:.If.the.given.inst |
| 146e80 | 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 0a 6d 6f 64 69 66 69 65 73 20 60 63 6f 6e 74 69 | ruction.sequence.modifies.`conti |
| 146ea0 | 6e 75 65 27 20 61 6e 64 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 63 6f 64 65 20 6e 65 65 64 73 20 | nue'.and.the.linkage.code.needs. |
| 146ec0 | 69 74 2c 20 60 63 6f 6e 74 69 6e 75 65 27 20 77 69 6c 6c 20 62 65 0a 73 61 76 65 64 20 61 6e 64 | it,.`continue'.will.be.saved.and |
| 146ee0 | 20 72 65 73 74 6f 72 65 64 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 65 6e 64 2d 77 69 | .restored........(define.(end-wi |
| 146f00 | 74 68 2d 6c 69 6e 6b 61 67 65 20 6c 69 6e 6b 61 67 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 | th-linkage.linkage.instruction-s |
| 146f20 | 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 28 70 72 65 73 65 72 76 69 6e 67 20 27 28 63 6f | equence)........(preserving.'(co |
| 146f40 | 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 | ntinue).........instruction-sequ |
| 146f60 | 65 6e 63 65 0a 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 6c 69 6e 6b 61 67 65 20 6c 69 | ence.........(compile-linkage.li |
| 146f80 | 6e 6b 61 67 65 29 29 29 0a 0a 43 6f 6d 70 69 6c 69 6e 67 20 73 69 6d 70 6c 65 20 65 78 70 72 65 | nkage)))..Compiling.simple.expre |
| 146fa0 | 73 73 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | ssions.......................... |
| 146fc0 | 2e 2e 2e 0a 0a 54 68 65 20 63 6f 64 65 20 67 65 6e 65 72 61 74 6f 72 73 20 66 6f 72 20 73 65 6c | .....The.code.generators.for.sel |
| 146fe0 | 66 2d 65 76 61 6c 75 61 74 69 6e 67 20 65 78 70 72 65 73 73 69 6f 6e 73 2c 20 71 75 6f 74 61 74 | f-evaluating.expressions,.quotat |
| 147000 | 69 6f 6e 73 2c 20 61 6e 64 0a 76 61 72 69 61 62 6c 65 73 20 63 6f 6e 73 74 72 75 63 74 20 69 6e | ions,.and.variables.construct.in |
| 147020 | 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 74 68 61 74 20 61 73 73 69 67 6e 20 | struction.sequences.that.assign. |
| 147040 | 74 68 65 20 72 65 71 75 69 72 65 64 0a 76 61 6c 75 65 20 74 6f 20 74 68 65 20 74 61 72 67 65 74 | the.required.value.to.the.target |
| 147060 | 20 72 65 67 69 73 74 65 72 20 61 6e 64 20 74 68 65 6e 20 70 72 6f 63 65 65 64 20 61 73 20 73 70 | .register.and.then.proceed.as.sp |
| 147080 | 65 63 69 66 69 65 64 20 62 79 20 74 68 65 0a 6c 69 6e 6b 61 67 65 20 64 65 73 63 72 69 70 74 6f | ecified.by.the.linkage.descripto |
| 1470a0 | 72 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d 73 65 6c 66 2d 65 | r........(define.(compile-self-e |
| 1470c0 | 76 61 6c 75 61 74 69 6e 67 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 0a 20 20 | valuating.exp.target.linkage)... |
| 1470e0 | 20 20 20 20 20 28 65 6e 64 2d 77 69 74 68 2d 6c 69 6e 6b 61 67 65 20 6c 69 6e 6b 61 67 65 0a 20 | .....(end-with-linkage.linkage.. |
| 147100 | 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 | .......(make-instruction-sequenc |
| 147120 | 65 20 27 28 29 20 28 6c 69 73 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 20 20 20 60 28 28 | e.'().(list.target)..........`(( |
| 147140 | 61 73 73 69 67 6e 20 2c 74 61 72 67 65 74 20 28 63 6f 6e 73 74 20 2c 65 78 70 29 29 29 29 29 29 | assign.,target.(const.,exp)))))) |
| 147160 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d 71 75 6f 74 65 64 20 65 | .......(define.(compile-quoted.e |
| 147180 | 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 0a 20 20 20 20 20 20 20 28 65 6e 64 2d 77 | xp.target.linkage)........(end-w |
| 1471a0 | 69 74 68 2d 6c 69 6e 6b 61 67 65 20 6c 69 6e 6b 61 67 65 0a 20 20 20 20 20 20 20 20 28 6d 61 6b | ith-linkage.linkage.........(mak |
| 1471c0 | 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 29 20 28 6c 69 73 74 | e-instruction-sequence.'().(list |
| 1471e0 | 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 20 20 20 60 28 28 61 73 73 69 67 6e 20 2c 74 61 72 | .target)..........`((assign.,tar |
| 147200 | 67 65 74 20 28 63 6f 6e 73 74 20 2c 28 74 65 78 74 2d 6f 66 2d 71 75 6f 74 61 74 69 6f 6e 20 65 | get.(const.,(text-of-quotation.e |
| 147220 | 78 70 29 29 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 | xp))))))).......(define.(compile |
| 147240 | 2d 76 61 72 69 61 62 6c 65 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 0a 20 20 | -variable.exp.target.linkage)... |
| 147260 | 20 20 20 20 20 28 65 6e 64 2d 77 69 74 68 2d 6c 69 6e 6b 61 67 65 20 6c 69 6e 6b 61 67 65 0a 20 | .....(end-with-linkage.linkage.. |
| 147280 | 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 | .......(make-instruction-sequenc |
| 1472a0 | 65 20 27 28 65 6e 76 29 20 28 6c 69 73 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 20 20 20 | e.'(env).(list.target).......... |
| 1472c0 | 60 28 28 61 73 73 69 67 6e 20 2c 74 61 72 67 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | `((assign.,target............... |
| 1472e0 | 20 20 20 20 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 29 0a | .....(op.lookup-variable-value). |
| 147300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 74 20 2c 65 78 70 29 0a | ...................(const.,exp). |
| 147320 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 65 6e 76 29 29 29 29 29 | ...................(reg.env))))) |
| 147340 | 29 0a 0a 20 20 20 41 6c 6c 20 74 68 65 73 65 20 61 73 73 69 67 6e 6d 65 6e 74 20 69 6e 73 74 72 | ).....All.these.assignment.instr |
| 147360 | 75 63 74 69 6f 6e 73 20 6d 6f 64 69 66 79 20 74 68 65 20 74 61 72 67 65 74 20 72 65 67 69 73 74 | uctions.modify.the.target.regist |
| 147380 | 65 72 2c 20 61 6e 64 0a 74 68 65 20 6f 6e 65 20 74 68 61 74 20 6c 6f 6f 6b 73 20 75 70 20 61 20 | er,.and.the.one.that.looks.up.a. |
| 1473a0 | 76 61 72 69 61 62 6c 65 20 6e 65 65 64 73 20 74 68 65 20 60 65 6e 76 27 20 72 65 67 69 73 74 65 | variable.needs.the.`env'.registe |
| 1473c0 | 72 2e 0a 0a 20 20 20 41 73 73 69 67 6e 6d 65 6e 74 73 20 61 6e 64 20 64 65 66 69 6e 69 74 69 6f | r......Assignments.and.definitio |
| 1473e0 | 6e 73 20 61 72 65 20 68 61 6e 64 6c 65 64 20 6d 75 63 68 20 61 73 20 74 68 65 79 20 61 72 65 20 | ns.are.handled.much.as.they.are. |
| 147400 | 69 6e 20 74 68 65 0a 69 6e 74 65 72 70 72 65 74 65 72 2e 20 20 57 65 20 72 65 63 75 72 73 69 76 | in.the.interpreter...We.recursiv |
| 147420 | 65 6c 79 20 67 65 6e 65 72 61 74 65 20 63 6f 64 65 20 74 68 61 74 20 63 6f 6d 70 75 74 65 73 20 | ely.generate.code.that.computes. |
| 147440 | 74 68 65 20 76 61 6c 75 65 20 74 6f 0a 62 65 20 61 73 73 69 67 6e 65 64 20 74 6f 20 74 68 65 20 | the.value.to.be.assigned.to.the. |
| 147460 | 76 61 72 69 61 62 6c 65 2c 20 61 6e 64 20 61 70 70 65 6e 64 20 74 6f 20 69 74 20 61 20 74 77 6f | variable,.and.append.to.it.a.two |
| 147480 | 2d 69 6e 73 74 72 75 63 74 69 6f 6e 0a 73 65 71 75 65 6e 63 65 20 74 68 61 74 20 61 63 74 75 61 | -instruction.sequence.that.actua |
| 1474a0 | 6c 6c 79 20 73 65 74 73 20 6f 72 20 64 65 66 69 6e 65 73 20 74 68 65 20 76 61 72 69 61 62 6c 65 | lly.sets.or.defines.the.variable |
| 1474c0 | 20 61 6e 64 20 61 73 73 69 67 6e 73 20 74 68 65 0a 76 61 6c 75 65 20 6f 66 20 74 68 65 20 77 68 | .and.assigns.the.value.of.the.wh |
| 1474e0 | 6f 6c 65 20 65 78 70 72 65 73 73 69 6f 6e 20 28 74 68 65 20 73 79 6d 62 6f 6c 20 60 6f 6b 27 29 | ole.expression.(the.symbol.`ok') |
| 147500 | 20 74 6f 20 74 68 65 20 74 61 72 67 65 74 20 72 65 67 69 73 74 65 72 2e 0a 54 68 65 20 72 65 63 | .to.the.target.register..The.rec |
| 147520 | 75 72 73 69 76 65 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 68 61 73 20 74 61 72 67 65 74 20 60 76 | ursive.compilation.has.target.`v |
| 147540 | 61 6c 27 20 61 6e 64 20 6c 69 6e 6b 61 67 65 20 60 6e 65 78 74 27 20 73 6f 20 74 68 61 74 0a 74 | al'.and.linkage.`next'.so.that.t |
| 147560 | 68 65 20 63 6f 64 65 20 77 69 6c 6c 20 70 75 74 20 69 74 73 20 72 65 73 75 6c 74 20 69 6e 74 6f | he.code.will.put.its.result.into |
| 147580 | 20 60 76 61 6c 27 20 61 6e 64 20 63 6f 6e 74 69 6e 75 65 20 77 69 74 68 20 74 68 65 20 63 6f 64 | .`val'.and.continue.with.the.cod |
| 1475a0 | 65 20 74 68 61 74 0a 69 73 20 61 70 70 65 6e 64 65 64 20 61 66 74 65 72 20 69 74 2e 20 20 54 68 | e.that.is.appended.after.it...Th |
| 1475c0 | 65 20 61 70 70 65 6e 64 69 6e 67 20 69 73 20 64 6f 6e 65 20 70 72 65 73 65 72 76 69 6e 67 20 60 | e.appending.is.done.preserving.` |
| 1475e0 | 65 6e 76 27 2c 20 73 69 6e 63 65 0a 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 6e | env',.since.the.environment.is.n |
| 147600 | 65 65 64 65 64 20 66 6f 72 20 73 65 74 74 69 6e 67 20 6f 72 20 64 65 66 69 6e 69 6e 67 20 74 68 | eeded.for.setting.or.defining.th |
| 147620 | 65 20 76 61 72 69 61 62 6c 65 20 61 6e 64 20 74 68 65 0a 63 6f 64 65 20 66 6f 72 20 74 68 65 20 | e.variable.and.the.code.for.the. |
| 147640 | 76 61 72 69 61 62 6c 65 20 76 61 6c 75 65 20 63 6f 75 6c 64 20 62 65 20 74 68 65 20 63 6f 6d 70 | variable.value.could.be.the.comp |
| 147660 | 69 6c 61 74 69 6f 6e 20 6f 66 20 61 20 63 6f 6d 70 6c 65 78 0a 65 78 70 72 65 73 73 69 6f 6e 20 | ilation.of.a.complex.expression. |
| 147680 | 74 68 61 74 20 6d 69 67 68 74 20 6d 6f 64 69 66 79 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 | that.might.modify.the.registers. |
| 1476a0 | 69 6e 20 61 72 62 69 74 72 61 72 79 20 77 61 79 73 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | in.arbitrary.ways........(define |
| 1476c0 | 20 28 63 6f 6d 70 69 6c 65 2d 61 73 73 69 67 6e 6d 65 6e 74 20 65 78 70 20 74 61 72 67 65 74 20 | .(compile-assignment.exp.target. |
| 1476e0 | 6c 69 6e 6b 61 67 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 76 61 72 20 28 61 73 73 69 | linkage)........(let.((var.(assi |
| 147700 | 67 6e 6d 65 6e 74 2d 76 61 72 69 61 62 6c 65 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 | gnment-variable.exp))........... |
| 147720 | 20 20 20 28 67 65 74 2d 76 61 6c 75 65 2d 63 6f 64 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...(get-value-code.............. |
| 147740 | 20 28 63 6f 6d 70 69 6c 65 20 28 61 73 73 69 67 6e 6d 65 6e 74 2d 76 61 6c 75 65 20 65 78 70 29 | .(compile.(assignment-value.exp) |
| 147760 | 20 27 76 61 6c 20 27 6e 65 78 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 65 6e 64 2d 77 69 74 | .'val.'next)))..........(end-wit |
| 147780 | 68 2d 6c 69 6e 6b 61 67 65 20 6c 69 6e 6b 61 67 65 0a 20 20 20 20 20 20 20 20 20 20 28 70 72 65 | h-linkage.linkage...........(pre |
| 1477a0 | 73 65 72 76 69 6e 67 20 27 28 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 67 65 74 2d 76 61 | serving.'(env)............get-va |
| 1477c0 | 6c 75 65 2d 63 6f 64 65 0a 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 | lue-code............(make-instru |
| 1477e0 | 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 65 6e 76 20 76 61 6c 29 20 28 6c 69 73 74 20 | ction-sequence.'(env.val).(list. |
| 147800 | 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 60 28 28 70 65 72 66 6f 72 6d 20 28 | target).............`((perform.( |
| 147820 | 6f 70 20 73 65 74 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 21 29 0a 20 20 20 20 20 20 20 20 | op.set-variable-value!)......... |
| 147840 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 74 20 2c 76 61 72 29 0a 20 20 20 20 | ...............(const.,var)..... |
| 147860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 76 61 6c 29 0a 20 20 20 | ...................(reg.val).... |
| 147880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 65 6e 76 29 29 0a 20 | ....................(reg.env)).. |
| 1478a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 2c 74 61 72 67 65 74 20 28 63 6f | .............(assign.,target.(co |
| 1478c0 | 6e 73 74 20 6f 6b 29 29 29 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f | nst.ok)))))))).......(define.(co |
| 1478e0 | 6d 70 69 6c 65 2d 64 65 66 69 6e 69 74 69 6f 6e 20 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b | mpile-definition.exp.target.link |
| 147900 | 61 67 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 76 61 72 20 28 64 65 66 69 6e 69 74 69 | age)........(let.((var.(definiti |
| 147920 | 6f 6e 2d 76 61 72 69 61 62 6c 65 20 65 78 70 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | on-variable.exp))..............( |
| 147940 | 67 65 74 2d 76 61 6c 75 65 2d 63 6f 64 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f | get-value-code...............(co |
| 147960 | 6d 70 69 6c 65 20 28 64 65 66 69 6e 69 74 69 6f 6e 2d 76 61 6c 75 65 20 65 78 70 29 20 27 76 61 | mpile.(definition-value.exp).'va |
| 147980 | 6c 20 27 6e 65 78 74 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 65 6e 64 2d 77 69 74 68 2d 6c 69 | l.'next)))..........(end-with-li |
| 1479a0 | 6e 6b 61 67 65 20 6c 69 6e 6b 61 67 65 0a 20 20 20 20 20 20 20 20 20 20 28 70 72 65 73 65 72 76 | nkage.linkage...........(preserv |
| 1479c0 | 69 6e 67 20 27 28 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 67 65 74 2d 76 61 6c 75 65 2d | ing.'(env)............get-value- |
| 1479e0 | 63 6f 64 65 0a 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f | code............(make-instructio |
| 147a00 | 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 65 6e 76 20 76 61 6c 29 20 28 6c 69 73 74 20 74 61 72 67 | n-sequence.'(env.val).(list.targ |
| 147a20 | 65 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 60 28 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 64 | et).............`((perform.(op.d |
| 147a40 | 65 66 69 6e 65 2d 76 61 72 69 61 62 6c 65 21 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | efine-variable!)................ |
| 147a60 | 20 20 20 20 20 20 20 20 28 63 6f 6e 73 74 20 2c 76 61 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ........(const.,var)............ |
| 147a80 | 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 76 61 6c 29 0a 20 20 20 20 20 20 20 20 20 20 | ............(reg.val)........... |
| 147aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 | .............(reg.env))......... |
| 147ac0 | 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 2c 74 61 72 67 65 74 20 28 63 6f 6e 73 74 20 6f 6b 29 | ......(assign.,target.(const.ok) |
| 147ae0 | 29 29 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 61 70 70 65 6e 64 65 64 20 74 77 6f 2d 69 6e 73 | ))))))).....The.appended.two-ins |
| 147b00 | 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 72 65 71 75 69 72 65 73 20 60 65 6e 76 27 | truction.sequence.requires.`env' |
| 147b20 | 20 61 6e 64 20 60 76 61 6c 27 20 61 6e 64 0a 6d 6f 64 69 66 69 65 73 20 74 68 65 20 74 61 72 67 | .and.`val'.and.modifies.the.targ |
| 147b40 | 65 74 2e 20 20 4e 6f 74 65 20 74 68 61 74 20 61 6c 74 68 6f 75 67 68 20 77 65 20 70 72 65 73 65 | et...Note.that.although.we.prese |
| 147b60 | 72 76 65 20 60 65 6e 76 27 20 66 6f 72 20 74 68 69 73 0a 73 65 71 75 65 6e 63 65 2c 20 77 65 20 | rve.`env'.for.this.sequence,.we. |
| 147b80 | 64 6f 20 6e 6f 74 20 70 72 65 73 65 72 76 65 20 60 76 61 6c 27 2c 20 62 65 63 61 75 73 65 20 74 | do.not.preserve.`val',.because.t |
| 147ba0 | 68 65 20 60 67 65 74 2d 76 61 6c 75 65 2d 63 6f 64 65 27 20 69 73 0a 64 65 73 69 67 6e 65 64 20 | he.`get-value-code'.is.designed. |
| 147bc0 | 74 6f 20 65 78 70 6c 69 63 69 74 6c 79 20 70 6c 61 63 65 20 69 74 73 20 72 65 73 75 6c 74 20 69 | to.explicitly.place.its.result.i |
| 147be0 | 6e 20 60 76 61 6c 27 20 66 6f 72 20 75 73 65 20 62 79 20 74 68 69 73 0a 73 65 71 75 65 6e 63 65 | n.`val'.for.use.by.this.sequence |
| 147c00 | 2e 20 20 28 49 6e 20 66 61 63 74 2c 20 69 66 20 77 65 20 64 69 64 20 70 72 65 73 65 72 76 65 20 | ...(In.fact,.if.we.did.preserve. |
| 147c20 | 60 76 61 6c 27 2c 20 77 65 20 77 6f 75 6c 64 20 68 61 76 65 20 61 20 62 75 67 2c 0a 62 65 63 61 | `val',.we.would.have.a.bug,.beca |
| 147c40 | 75 73 65 20 74 68 69 73 20 77 6f 75 6c 64 20 63 61 75 73 65 20 74 68 65 20 70 72 65 76 69 6f 75 | use.this.would.cause.the.previou |
| 147c60 | 73 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 60 76 61 6c 27 20 74 6f 20 62 65 20 72 65 73 74 6f 72 | s.contents.of.`val'.to.be.restor |
| 147c80 | 65 64 0a 72 69 67 68 74 20 61 66 74 65 72 20 74 68 65 20 60 67 65 74 2d 76 61 6c 75 65 2d 63 6f | ed.right.after.the.`get-value-co |
| 147ca0 | 64 65 27 20 69 73 20 72 75 6e 2e 29 0a 0a 43 6f 6d 70 69 6c 69 6e 67 20 63 6f 6e 64 69 74 69 6f | de'.is.run.)..Compiling.conditio |
| 147cc0 | 6e 61 6c 20 65 78 70 72 65 73 73 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | nal.expressions................. |
| 147ce0 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 63 6f 64 65 20 66 6f 72 20 | ...................The.code.for. |
| 147d00 | 61 6e 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 20 63 6f 6d 70 69 6c 65 64 20 77 69 74 68 | an.`if'.expression.compiled.with |
| 147d20 | 20 61 20 67 69 76 65 6e 20 74 61 72 67 65 74 20 61 6e 64 20 6c 69 6e 6b 61 67 65 0a 68 61 73 20 | .a.given.target.and.linkage.has. |
| 147d40 | 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 3c 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 | the.form.......<_compilation.of. |
| 147d60 | 70 72 65 64 69 63 61 74 65 2c 20 74 61 72 67 65 74 20 60 76 61 6c 27 2c 20 6c 69 6e 6b 61 67 65 | predicate,.target.`val',.linkage |
| 147d80 | 20 60 6e 65 78 74 27 5f 3e 0a 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 66 61 6c 73 65 3f | .`next'_>.......(test.(op.false? |
| 147da0 | 29 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 | ).(reg.val)).......(branch.(labe |
| 147dc0 | 6c 20 66 61 6c 73 65 2d 62 72 61 6e 63 68 29 29 0a 20 20 20 20 20 74 72 75 65 2d 62 72 61 6e 63 | l.false-branch))......true-branc |
| 147de0 | 68 0a 20 20 20 20 20 20 3c 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 63 6f 6e 73 65 71 75 | h.......<_compilation.of.consequ |
| 147e00 | 65 6e 74 20 77 69 74 68 20 67 69 76 65 6e 20 74 61 72 67 65 74 20 61 6e 64 20 67 69 76 65 6e 20 | ent.with.given.target.and.given. |
| 147e20 | 6c 69 6e 6b 61 67 65 20 6f 72 20 60 61 66 74 65 72 2d 69 66 27 5f 3e 0a 20 20 20 20 20 66 61 6c | linkage.or.`after-if'_>......fal |
| 147e40 | 73 65 2d 62 72 61 6e 63 68 0a 20 20 20 20 20 20 3c 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 | se-branch.......<_compilation.of |
| 147e60 | 20 61 6c 74 65 72 6e 61 74 69 76 65 20 77 69 74 68 20 67 69 76 65 6e 20 74 61 72 67 65 74 20 61 | .alternative.with.given.target.a |
| 147e80 | 6e 64 20 6c 69 6e 6b 61 67 65 5f 3e 0a 20 20 20 20 20 61 66 74 65 72 2d 69 66 0a 0a 20 20 20 54 | nd.linkage_>......after-if.....T |
| 147ea0 | 6f 20 67 65 6e 65 72 61 74 65 20 74 68 69 73 20 63 6f 64 65 2c 20 77 65 20 63 6f 6d 70 69 6c 65 | o.generate.this.code,.we.compile |
| 147ec0 | 20 74 68 65 20 70 72 65 64 69 63 61 74 65 2c 20 63 6f 6e 73 65 71 75 65 6e 74 2c 20 61 6e 64 0a | .the.predicate,.consequent,.and. |
| 147ee0 | 61 6c 74 65 72 6e 61 74 69 76 65 2c 20 61 6e 64 20 63 6f 6d 62 69 6e 65 20 74 68 65 20 72 65 73 | alternative,.and.combine.the.res |
| 147f00 | 75 6c 74 69 6e 67 20 63 6f 64 65 20 77 69 74 68 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 6f | ulting.code.with.instructions.to |
| 147f20 | 20 74 65 73 74 0a 74 68 65 20 70 72 65 64 69 63 61 74 65 20 72 65 73 75 6c 74 20 61 6e 64 20 77 | .test.the.predicate.result.and.w |
| 147f40 | 69 74 68 20 6e 65 77 6c 79 20 67 65 6e 65 72 61 74 65 64 20 6c 61 62 65 6c 73 20 74 6f 20 6d 61 | ith.newly.generated.labels.to.ma |
| 147f60 | 72 6b 20 74 68 65 20 74 72 75 65 0a 61 6e 64 20 66 61 6c 73 65 20 62 72 61 6e 63 68 65 73 20 61 | rk.the.true.and.false.branches.a |
| 147f80 | 6e 64 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 2e 28 32 | nd.the.end.of.the.conditional.(2 |
| 147fa0 | 29 20 49 6e 20 74 68 69 73 0a 61 72 72 61 6e 67 65 6d 65 6e 74 20 6f 66 20 63 6f 64 65 2c 20 77 | ).In.this.arrangement.of.code,.w |
| 147fc0 | 65 20 6d 75 73 74 20 62 72 61 6e 63 68 20 61 72 6f 75 6e 64 20 74 68 65 20 74 72 75 65 20 62 72 | e.must.branch.around.the.true.br |
| 147fe0 | 61 6e 63 68 20 69 66 20 74 68 65 20 74 65 73 74 0a 69 73 20 66 61 6c 73 65 2e 20 20 54 68 65 20 | anch.if.the.test.is.false...The. |
| 148000 | 6f 6e 6c 79 20 73 6c 69 67 68 74 20 63 6f 6d 70 6c 69 63 61 74 69 6f 6e 20 69 73 20 69 6e 20 68 | only.slight.complication.is.in.h |
| 148020 | 6f 77 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 66 6f 72 20 74 68 65 0a 74 72 75 65 20 62 72 61 6e | ow.the.linkage.for.the.true.bran |
| 148040 | 63 68 20 73 68 6f 75 6c 64 20 62 65 20 68 61 6e 64 6c 65 64 2e 20 20 49 66 20 74 68 65 20 6c 69 | ch.should.be.handled...If.the.li |
| 148060 | 6e 6b 61 67 65 20 66 6f 72 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 69 73 0a 60 72 65 | nkage.for.the.conditional.is.`re |
| 148080 | 74 75 72 6e 27 20 6f 72 20 61 20 6c 61 62 65 6c 2c 20 74 68 65 6e 20 74 68 65 20 74 72 75 65 20 | turn'.or.a.label,.then.the.true. |
| 1480a0 | 61 6e 64 20 66 61 6c 73 65 20 62 72 61 6e 63 68 65 73 20 77 69 6c 6c 20 62 6f 74 68 20 75 73 65 | and.false.branches.will.both.use |
| 1480c0 | 0a 74 68 69 73 20 73 61 6d 65 20 6c 69 6e 6b 61 67 65 2e 20 20 49 66 20 74 68 65 20 6c 69 6e 6b | .this.same.linkage...If.the.link |
| 1480e0 | 61 67 65 20 69 73 20 60 6e 65 78 74 27 2c 20 74 68 65 20 74 72 75 65 20 62 72 61 6e 63 68 20 65 | age.is.`next',.the.true.branch.e |
| 148100 | 6e 64 73 20 77 69 74 68 0a 61 20 6a 75 6d 70 20 61 72 6f 75 6e 64 20 74 68 65 20 63 6f 64 65 20 | nds.with.a.jump.around.the.code. |
| 148120 | 66 6f 72 20 74 68 65 20 66 61 6c 73 65 20 62 72 61 6e 63 68 20 74 6f 20 74 68 65 20 6c 61 62 65 | for.the.false.branch.to.the.labe |
| 148140 | 6c 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 0a 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 2e | l.at.the.end.of.the.conditional. |
| 148160 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d 69 66 20 65 78 70 20 74 | .......(define.(compile-if.exp.t |
| 148180 | 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 74 2d 62 | arget.linkage)........(let.((t-b |
| 1481a0 | 72 61 6e 63 68 20 28 6d 61 6b 65 2d 6c 61 62 65 6c 20 27 74 72 75 65 2d 62 72 61 6e 63 68 29 29 | ranch.(make-label.'true-branch)) |
| 1481c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 66 2d 62 72 61 6e 63 68 20 28 6d 61 6b 65 2d 6c 61 | ..............(f-branch.(make-la |
| 1481e0 | 62 65 6c 20 27 66 61 6c 73 65 2d 62 72 61 6e 63 68 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | bel.'false-branch))............. |
| 148200 | 20 28 61 66 74 65 72 2d 69 66 20 28 6d 61 6b 65 2d 6c 61 62 65 6c 20 27 61 66 74 65 72 2d 69 66 | .(after-if.(make-label.'after-if |
| 148220 | 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 6f 6e 73 65 71 75 65 6e 74 2d 6c | )))..........(let.((consequent-l |
| 148240 | 69 6e 6b 61 67 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 71 3f 20 | inkage.................(if.(eq?. |
| 148260 | 6c 69 6e 6b 61 67 65 20 27 6e 65 78 74 29 20 61 66 74 65 72 2d 69 66 20 6c 69 6e 6b 61 67 65 29 | linkage.'next).after-if.linkage) |
| 148280 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 2d 63 6f 64 65 20 28 63 6f 6d | ))............(let.((p-code.(com |
| 1482a0 | 70 69 6c 65 20 28 69 66 2d 70 72 65 64 69 63 61 74 65 20 65 78 70 29 20 27 76 61 6c 20 27 6e 65 | pile.(if-predicate.exp).'val.'ne |
| 1482c0 | 78 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 2d 63 6f 64 65 0a 20 20 | xt))..................(c-code... |
| 1482e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 0a 20 20 20 20 20 20 20 | ................(compile........ |
| 148300 | 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 2d 63 6f 6e 73 65 71 75 65 6e 74 20 65 78 70 29 20 | ............(if-consequent.exp). |
| 148320 | 74 61 72 67 65 74 20 63 6f 6e 73 65 71 75 65 6e 74 2d 6c 69 6e 6b 61 67 65 29 29 0a 20 20 20 20 | target.consequent-linkage))..... |
| 148340 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 2d 63 6f 64 65 0a 20 20 20 20 20 20 20 20 20 20 20 | .............(a-code............ |
| 148360 | 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 20 28 69 66 2d 61 6c 74 65 72 6e 61 74 69 76 65 20 | .......(compile.(if-alternative. |
| 148380 | 65 78 70 29 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 | exp).target.linkage))).......... |
| 1483a0 | 20 20 20 20 28 70 72 65 73 65 72 76 69 6e 67 20 27 28 65 6e 76 20 63 6f 6e 74 69 6e 75 65 29 0a | ....(preserving.'(env.continue). |
| 1483c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 70 2d 63 6f 64 65 0a 20 20 20 20 20 20 20 20 20 20 20 | ..............p-code............ |
| 1483e0 | 20 20 20 28 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 | ...(append-instruction-sequences |
| 148400 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f | ................(make-instructio |
| 148420 | 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 76 61 6c 29 20 27 28 29 0a 20 20 20 20 20 20 20 20 20 20 | n-sequence.'(val).'()........... |
| 148440 | 20 20 20 20 20 20 60 28 28 74 65 73 74 20 28 6f 70 20 66 61 6c 73 65 3f 29 20 28 72 65 67 20 76 | ......`((test.(op.false?).(reg.v |
| 148460 | 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 | al))...................(branch.( |
| 148480 | 6c 61 62 65 6c 20 2c 66 2d 62 72 61 6e 63 68 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | label.,f-branch))))............. |
| 1484a0 | 20 20 20 28 70 61 72 61 6c 6c 65 6c 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 | ...(parallel-instruction-sequenc |
| 1484c0 | 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 2d 69 6e 73 74 72 | es.................(append-instr |
| 1484e0 | 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 20 74 2d 62 72 61 6e 63 68 20 63 2d 63 6f 64 65 | uction-sequences.t-branch.c-code |
| 148500 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 | ).................(append-instru |
| 148520 | 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 20 66 2d 62 72 61 6e 63 68 20 61 2d 63 6f 64 65 29 | ction-sequences.f-branch.a-code) |
| 148540 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 69 66 29 29 29 29 29 29 0a | )................after-if)))))). |
| 148560 | 0a 20 20 20 60 45 6e 76 27 20 69 73 20 70 72 65 73 65 72 76 65 64 20 61 72 6f 75 6e 64 20 74 68 | ....`Env'.is.preserved.around.th |
| 148580 | 65 20 70 72 65 64 69 63 61 74 65 20 63 6f 64 65 20 62 65 63 61 75 73 65 20 69 74 20 63 6f 75 6c | e.predicate.code.because.it.coul |
| 1485a0 | 64 20 62 65 0a 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 74 72 75 65 20 61 6e 64 20 66 61 6c 73 | d.be.needed.by.the.true.and.fals |
| 1485c0 | 65 20 62 72 61 6e 63 68 65 73 2c 20 61 6e 64 20 60 63 6f 6e 74 69 6e 75 65 27 20 69 73 20 70 72 | e.branches,.and.`continue'.is.pr |
| 1485e0 | 65 73 65 72 76 65 64 0a 62 65 63 61 75 73 65 20 69 74 20 63 6f 75 6c 64 20 62 65 20 6e 65 65 64 | eserved.because.it.could.be.need |
| 148600 | 65 64 20 62 79 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 63 6f 64 65 20 69 6e 20 74 68 6f 73 65 20 | ed.by.the.linkage.code.in.those. |
| 148620 | 62 72 61 6e 63 68 65 73 2e 20 20 54 68 65 0a 63 6f 64 65 20 66 6f 72 20 74 68 65 20 74 72 75 65 | branches...The.code.for.the.true |
| 148640 | 20 61 6e 64 20 66 61 6c 73 65 20 62 72 61 6e 63 68 65 73 20 28 77 68 69 63 68 20 61 72 65 20 6e | .and.false.branches.(which.are.n |
| 148660 | 6f 74 20 65 78 65 63 75 74 65 64 0a 73 65 71 75 65 6e 74 69 61 6c 6c 79 29 20 69 73 20 61 70 70 | ot.executed.sequentially).is.app |
| 148680 | 65 6e 64 65 64 20 75 73 69 6e 67 20 61 20 73 70 65 63 69 61 6c 20 63 6f 6d 62 69 6e 65 72 0a 60 | ended.using.a.special.combiner.` |
| 1486a0 | 70 61 72 61 6c 6c 65 6c 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 27 20 | parallel-instruction-sequences'. |
| 1486c0 | 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 2d 34 | described.in.section.*Note.5-5-4 |
| 1486e0 | 3a 3a 2e 0a 0a 20 20 20 4e 6f 74 65 20 74 68 61 74 20 60 63 6f 6e 64 27 20 69 73 20 61 20 64 65 | ::......Note.that.`cond'.is.a.de |
| 148700 | 72 69 76 65 64 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 73 6f 20 61 6c 6c 20 74 68 61 74 20 74 68 | rived.expression,.so.all.that.th |
| 148720 | 65 20 63 6f 6d 70 69 6c 65 72 0a 6e 65 65 64 73 20 74 6f 20 64 6f 20 68 61 6e 64 6c 65 20 69 74 | e.compiler.needs.to.do.handle.it |
| 148740 | 20 69 73 20 74 6f 20 61 70 70 6c 79 20 74 68 65 20 60 63 6f 6e 64 2d 3e 69 66 27 20 74 72 61 6e | .is.to.apply.the.`cond->if'.tran |
| 148760 | 73 66 6f 72 6d 65 72 20 28 66 72 6f 6d 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d | sformer.(from.section.*Note.4-1- |
| 148780 | 32 3a 3a 29 20 61 6e 64 20 63 6f 6d 70 69 6c 65 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 60 | 2::).and.compile.the.resulting.` |
| 1487a0 | 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 2e 0a 0a 43 6f 6d 70 69 6c 69 6e 67 20 73 65 71 75 65 | if'.expression...Compiling.seque |
| 1487c0 | 6e 63 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 54 68 65 20 63 6f | nces......................The.co |
| 1487e0 | 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 73 65 71 75 65 6e 63 65 73 20 28 66 72 6f 6d 20 70 72 6f | mpilation.of.sequences.(from.pro |
| 148800 | 63 65 64 75 72 65 20 62 6f 64 69 65 73 20 6f 72 20 65 78 70 6c 69 63 69 74 20 60 62 65 67 69 6e | cedure.bodies.or.explicit.`begin |
| 148820 | 27 0a 65 78 70 72 65 73 73 69 6f 6e 73 29 20 70 61 72 61 6c 6c 65 6c 73 20 74 68 65 69 72 20 65 | '.expressions).parallels.their.e |
| 148840 | 76 61 6c 75 61 74 69 6f 6e 2e 20 20 45 61 63 68 20 65 78 70 72 65 73 73 69 6f 6e 20 6f 66 20 74 | valuation...Each.expression.of.t |
| 148860 | 68 65 0a 73 65 71 75 65 6e 63 65 20 69 73 20 63 6f 6d 70 69 6c 65 64 2d 2d 74 68 65 20 6c 61 73 | he.sequence.is.compiled--the.las |
| 148880 | 74 20 65 78 70 72 65 73 73 69 6f 6e 20 77 69 74 68 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 73 70 | t.expression.with.the.linkage.sp |
| 1488a0 | 65 63 69 66 69 65 64 0a 66 6f 72 20 74 68 65 20 73 65 71 75 65 6e 63 65 2c 20 61 6e 64 20 74 68 | ecified.for.the.sequence,.and.th |
| 1488c0 | 65 20 6f 74 68 65 72 20 65 78 70 72 65 73 73 69 6f 6e 73 20 77 69 74 68 20 6c 69 6e 6b 61 67 65 | e.other.expressions.with.linkage |
| 1488e0 | 20 60 6e 65 78 74 27 20 28 74 6f 0a 65 78 65 63 75 74 65 20 74 68 65 20 72 65 73 74 20 6f 66 20 | .`next'.(to.execute.the.rest.of. |
| 148900 | 74 68 65 20 73 65 71 75 65 6e 63 65 29 2e 20 20 54 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 | the.sequence)...The.instruction. |
| 148920 | 73 65 71 75 65 6e 63 65 73 20 66 6f 72 20 74 68 65 0a 69 6e 64 69 76 69 64 75 61 6c 20 65 78 70 | sequences.for.the.individual.exp |
| 148940 | 72 65 73 73 69 6f 6e 73 20 61 72 65 20 61 70 70 65 6e 64 65 64 20 74 6f 20 66 6f 72 6d 20 61 20 | ressions.are.appended.to.form.a. |
| 148960 | 73 69 6e 67 6c 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 0a 73 65 71 75 65 6e 63 65 2c 20 73 75 63 | single.instruction.sequence,.suc |
| 148980 | 68 20 74 68 61 74 20 60 65 6e 76 27 20 28 6e 65 65 64 65 64 20 66 6f 72 20 74 68 65 20 72 65 73 | h.that.`env'.(needed.for.the.res |
| 1489a0 | 74 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 29 20 61 6e 64 0a 60 63 6f 6e 74 69 6e 75 65 | t.of.the.sequence).and.`continue |
| 1489c0 | 27 20 28 70 6f 73 73 69 62 6c 79 20 6e 65 65 64 65 64 20 66 6f 72 20 74 68 65 20 6c 69 6e 6b 61 | '.(possibly.needed.for.the.linka |
| 1489e0 | 67 65 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 29 0a 61 | ge.at.the.end.of.the.sequence).a |
| 148a00 | 72 65 20 70 72 65 73 65 72 76 65 64 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d | re.preserved........(define.(com |
| 148a20 | 70 69 6c 65 2d 73 65 71 75 65 6e 63 65 20 73 65 71 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 | pile-sequence.seq.target.linkage |
| 148a40 | 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6c 61 73 74 2d 65 78 70 3f 20 73 65 71 29 0a 20 20 20 | )........(if.(last-exp?.seq).... |
| 148a60 | 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 20 28 66 69 72 73 74 2d 65 78 70 20 73 65 71 29 | ........(compile.(first-exp.seq) |
| 148a80 | 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 70 72 65 | .target.linkage)............(pre |
| 148aa0 | 73 65 72 76 69 6e 67 20 27 28 65 6e 76 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 | serving.'(env.continue)......... |
| 148ac0 | 20 20 20 20 28 63 6f 6d 70 69 6c 65 20 28 66 69 72 73 74 2d 65 78 70 20 73 65 71 29 20 74 61 72 | ....(compile.(first-exp.seq).tar |
| 148ae0 | 67 65 74 20 27 6e 65 78 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d | get.'next).............(compile- |
| 148b00 | 73 65 71 75 65 6e 63 65 20 28 72 65 73 74 2d 65 78 70 73 20 73 65 71 29 20 74 61 72 67 65 74 20 | sequence.(rest-exps.seq).target. |
| 148b20 | 6c 69 6e 6b 61 67 65 29 29 29 29 0a 0a 43 6f 6d 70 69 6c 69 6e 67 20 60 6c 61 6d 62 64 61 27 20 | linkage))))..Compiling.`lambda'. |
| 148b40 | 65 78 70 72 65 73 73 69 6f 6e 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | expressions..................... |
| 148b60 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 60 4c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 73 | ............`Lambda'.expressions |
| 148b80 | 20 63 6f 6e 73 74 72 75 63 74 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 54 68 65 20 6f 62 6a 65 | .construct.procedures...The.obje |
| 148ba0 | 63 74 20 63 6f 64 65 20 66 6f 72 20 61 0a 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f | ct.code.for.a.`lambda'.expressio |
| 148bc0 | 6e 20 6d 75 73 74 20 68 61 76 65 20 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 3c 5f 63 6f 6e | n.must.have.the.form.......<_con |
| 148be0 | 73 74 72 75 63 74 20 70 72 6f 63 65 64 75 72 65 20 6f 62 6a 65 63 74 20 61 6e 64 20 61 73 73 69 | struct.procedure.object.and.assi |
| 148c00 | 67 6e 20 69 74 20 74 6f 20 74 61 72 67 65 74 20 72 65 67 69 73 74 65 72 5f 3e 0a 20 20 20 20 20 | gn.it.to.target.register_>...... |
| 148c20 | 3c 4c 49 4e 4b 41 47 45 3e 0a 0a 20 20 20 57 68 65 6e 20 77 65 20 63 6f 6d 70 69 6c 65 20 74 68 | <LINKAGE>.....When.we.compile.th |
| 148c40 | 65 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 77 65 20 61 6c 73 6f 20 67 | e.`lambda'.expression,.we.also.g |
| 148c60 | 65 6e 65 72 61 74 65 20 74 68 65 20 63 6f 64 65 0a 66 6f 72 20 74 68 65 20 70 72 6f 63 65 64 75 | enerate.the.code.for.the.procedu |
| 148c80 | 72 65 20 62 6f 64 79 2e 20 20 41 6c 74 68 6f 75 67 68 20 74 68 65 20 62 6f 64 79 20 77 6f 6e 27 | re.body...Although.the.body.won' |
| 148ca0 | 74 20 62 65 20 65 78 65 63 75 74 65 64 20 61 74 20 74 68 65 0a 74 69 6d 65 20 6f 66 20 70 72 6f | t.be.executed.at.the.time.of.pro |
| 148cc0 | 63 65 64 75 72 65 20 63 6f 6e 73 74 72 75 63 74 69 6f 6e 2c 20 69 74 20 69 73 20 63 6f 6e 76 65 | cedure.construction,.it.is.conve |
| 148ce0 | 6e 69 65 6e 74 20 74 6f 20 69 6e 73 65 72 74 20 69 74 20 69 6e 74 6f 20 74 68 65 0a 6f 62 6a 65 | nient.to.insert.it.into.the.obje |
| 148d00 | 63 74 20 63 6f 64 65 20 72 69 67 68 74 20 61 66 74 65 72 20 74 68 65 20 63 6f 64 65 20 66 6f 72 | ct.code.right.after.the.code.for |
| 148d20 | 20 74 68 65 20 60 6c 61 6d 62 64 61 27 2e 20 20 49 66 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 66 | .the.`lambda'...If.the.linkage.f |
| 148d40 | 6f 72 0a 74 68 65 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 61 20 | or.the.`lambda'.expression.is.a. |
| 148d60 | 6c 61 62 65 6c 20 6f 72 20 60 72 65 74 75 72 6e 27 2c 20 74 68 69 73 20 69 73 20 66 69 6e 65 2e | label.or.`return',.this.is.fine. |
| 148d80 | 20 20 42 75 74 20 69 66 0a 74 68 65 20 6c 69 6e 6b 61 67 65 20 69 73 20 60 6e 65 78 74 27 2c 20 | ..But.if.the.linkage.is.`next',. |
| 148da0 | 77 65 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 73 6b 69 70 20 61 72 6f 75 6e 64 20 74 68 65 20 | we.will.need.to.skip.around.the. |
| 148dc0 | 63 6f 64 65 20 66 6f 72 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 20 62 79 20 75 | code.for.the.procedure.body.by.u |
| 148de0 | 73 69 6e 67 20 61 20 6c 69 6e 6b 61 67 65 20 74 68 61 74 20 6a 75 6d 70 73 20 74 6f 20 61 20 6c | sing.a.linkage.that.jumps.to.a.l |
| 148e00 | 61 62 65 6c 20 74 68 61 74 20 69 73 0a 69 6e 73 65 72 74 65 64 20 61 66 74 65 72 20 74 68 65 20 | abel.that.is.inserted.after.the. |
| 148e20 | 62 6f 64 79 2e 20 20 54 68 65 20 6f 62 6a 65 63 74 20 63 6f 64 65 20 74 68 75 73 20 68 61 73 20 | body...The.object.code.thus.has. |
| 148e40 | 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 3c 5f 63 6f 6e 73 74 72 75 63 74 20 70 72 6f 63 65 | the.form.......<_construct.proce |
| 148e60 | 64 75 72 65 20 6f 62 6a 65 63 74 20 61 6e 64 20 61 73 73 69 67 6e 20 69 74 20 74 6f 20 74 61 72 | dure.object.and.assign.it.to.tar |
| 148e80 | 67 65 74 20 72 65 67 69 73 74 65 72 5f 3e 0a 20 20 20 20 20 20 3c 5f 63 6f 64 65 20 66 6f 72 20 | get.register_>.......<_code.for. |
| 148ea0 | 67 69 76 65 6e 20 6c 69 6e 6b 61 67 65 5f 3e 20 5f 6f 72 5f 20 60 28 67 6f 74 6f 20 28 6c 61 62 | given.linkage_>._or_.`(goto.(lab |
| 148ec0 | 65 6c 20 61 66 74 65 72 2d 6c 61 6d 62 64 61 29 29 27 0a 20 20 20 20 20 20 3c 5f 63 6f 6d 70 69 | el.after-lambda))'.......<_compi |
| 148ee0 | 6c 61 74 69 6f 6e 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 5f 3e 0a 20 20 20 20 20 | lation.of.procedure.body_>...... |
| 148f00 | 61 66 74 65 72 2d 6c 61 6d 62 64 61 0a 0a 20 20 20 60 43 6f 6d 70 69 6c 65 2d 6c 61 6d 62 64 61 | after-lambda.....`Compile-lambda |
| 148f20 | 27 20 67 65 6e 65 72 61 74 65 73 20 74 68 65 20 63 6f 64 65 20 66 6f 72 20 63 6f 6e 73 74 72 75 | '.generates.the.code.for.constru |
| 148f40 | 63 74 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 6f 62 6a 65 63 74 20 66 6f 6c 6c 6f | cting.the.procedure.object.follo |
| 148f60 | 77 65 64 20 62 79 20 74 68 65 20 63 6f 64 65 20 66 6f 72 20 74 68 65 20 70 72 6f 63 65 64 75 72 | wed.by.the.code.for.the.procedur |
| 148f80 | 65 20 62 6f 64 79 2e 20 20 54 68 65 20 70 72 6f 63 65 64 75 72 65 0a 6f 62 6a 65 63 74 20 77 69 | e.body...The.procedure.object.wi |
| 148fa0 | 6c 6c 20 62 65 20 63 6f 6e 73 74 72 75 63 74 65 64 20 61 74 20 72 75 6e 20 74 69 6d 65 20 62 79 | ll.be.constructed.at.run.time.by |
| 148fc0 | 20 63 6f 6d 62 69 6e 69 6e 67 20 74 68 65 20 63 75 72 72 65 6e 74 0a 65 6e 76 69 72 6f 6e 6d 65 | .combining.the.current.environme |
| 148fe0 | 6e 74 20 28 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 74 20 74 68 65 20 70 6f 69 6e 74 | nt.(the.environment.at.the.point |
| 149000 | 20 6f 66 20 64 65 66 69 6e 69 74 69 6f 6e 29 20 77 69 74 68 20 74 68 65 20 65 6e 74 72 79 0a 70 | .of.definition).with.the.entry.p |
| 149020 | 6f 69 6e 74 20 74 6f 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 20 62 | oint.to.the.compiled.procedure.b |
| 149040 | 6f 64 79 20 28 61 20 6e 65 77 6c 79 20 67 65 6e 65 72 61 74 65 64 20 6c 61 62 65 6c 29 2e 28 33 | ody.(a.newly.generated.label).(3 |
| 149060 | 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d 6c 61 6d 62 64 61 20 | ).......(define.(compile-lambda. |
| 149080 | 65 78 70 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 | exp.target.linkage)........(let. |
| 1490a0 | 28 28 70 72 6f 63 2d 65 6e 74 72 79 20 28 6d 61 6b 65 2d 6c 61 62 65 6c 20 27 65 6e 74 72 79 29 | ((proc-entry.(make-label.'entry) |
| 1490c0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 66 74 65 72 2d 6c 61 6d 62 64 61 20 28 6d 61 | )..............(after-lambda.(ma |
| 1490e0 | 6b 65 2d 6c 61 62 65 6c 20 27 61 66 74 65 72 2d 6c 61 6d 62 64 61 29 29 29 0a 20 20 20 20 20 20 | ke-label.'after-lambda)))....... |
| 149100 | 20 20 20 28 6c 65 74 20 28 28 6c 61 6d 62 64 61 2d 6c 69 6e 6b 61 67 65 0a 20 20 20 20 20 20 20 | ...(let.((lambda-linkage........ |
| 149120 | 20 20 20 20 20 20 20 20 20 28 69 66 20 28 65 71 3f 20 6c 69 6e 6b 61 67 65 20 27 6e 65 78 74 29 | .........(if.(eq?.linkage.'next) |
| 149140 | 20 61 66 74 65 72 2d 6c 61 6d 62 64 61 20 6c 69 6e 6b 61 67 65 29 29 29 0a 20 20 20 20 20 20 20 | .after-lambda.linkage)))........ |
| 149160 | 20 20 20 20 28 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 | ....(append-instruction-sequence |
| 149180 | 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 74 61 63 6b 2d 6f 6e 2d 69 6e 73 74 72 75 63 74 69 | s.............(tack-on-instructi |
| 1491a0 | 6f 6e 2d 73 65 71 75 65 6e 63 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6e 64 2d 77 69 | on-sequence..............(end-wi |
| 1491c0 | 74 68 2d 6c 69 6e 6b 61 67 65 20 6c 61 6d 62 64 61 2d 6c 69 6e 6b 61 67 65 0a 20 20 20 20 20 20 | th-linkage.lambda-linkage....... |
| 1491e0 | 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e | ........(make-instruction-sequen |
| 149200 | 63 65 20 27 28 65 6e 76 29 20 28 6c 69 73 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 20 20 | ce.'(env).(list.target)......... |
| 149220 | 20 20 20 20 20 20 20 60 28 28 61 73 73 69 67 6e 20 2c 74 61 72 67 65 74 0a 20 20 20 20 20 20 20 | .......`((assign.,target........ |
| 149240 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 20 6d 61 6b 65 2d 63 6f 6d 70 69 | ..................(op.make-compi |
| 149260 | 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | led-procedure).................. |
| 149280 | 20 20 20 20 20 20 20 20 28 6c 61 62 65 6c 20 2c 70 72 6f 63 2d 65 6e 74 72 79 29 0a 20 20 20 20 | ........(label.,proc-entry)..... |
| 1492a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 65 6e 76 29 29 29 | .....................(reg.env))) |
| 1492c0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 6c 61 6d 62 64 61 2d | ))..............(compile-lambda- |
| 1492e0 | 62 6f 64 79 20 65 78 70 20 70 72 6f 63 2d 65 6e 74 72 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 | body.exp.proc-entry))........... |
| 149300 | 20 20 61 66 74 65 72 2d 6c 61 6d 62 64 61 29 29 29 29 0a 0a 20 20 20 60 43 6f 6d 70 69 6c 65 2d | ..after-lambda)))).....`Compile- |
| 149320 | 6c 61 6d 62 64 61 27 20 75 73 65 73 20 74 68 65 20 73 70 65 63 69 61 6c 20 63 6f 6d 62 69 6e 65 | lambda'.uses.the.special.combine |
| 149340 | 72 0a 60 74 61 63 6b 2d 6f 6e 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 27 | r.`tack-on-instruction-sequence' |
| 149360 | 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 2d 34 3a 3a 29 20 72 61 74 68 65 72 20 | .(section.*Note.5-5-4::).rather. |
| 149380 | 74 68 61 6e 0a 60 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 | than.`append-instruction-sequenc |
| 1493a0 | 65 73 27 20 74 6f 20 61 70 70 65 6e 64 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 | es'.to.append.the.procedure.body |
| 1493c0 | 20 74 6f 20 74 68 65 0a 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 63 6f 64 65 | .to.the.`lambda'.expression.code |
| 1493e0 | 2c 20 62 65 63 61 75 73 65 20 74 68 65 20 62 6f 64 79 20 69 73 20 6e 6f 74 20 70 61 72 74 20 6f | ,.because.the.body.is.not.part.o |
| 149400 | 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 0a 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 74 | f.the.sequence.of.instructions.t |
| 149420 | 68 61 74 20 77 69 6c 6c 20 62 65 20 65 78 65 63 75 74 65 64 20 77 68 65 6e 20 74 68 65 20 63 6f | hat.will.be.executed.when.the.co |
| 149440 | 6d 62 69 6e 65 64 20 73 65 71 75 65 6e 63 65 20 69 73 0a 65 6e 74 65 72 65 64 3b 20 72 61 74 68 | mbined.sequence.is.entered;.rath |
| 149460 | 65 72 2c 20 69 74 20 69 73 20 69 6e 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6f 6e 6c 79 20 62 | er,.it.is.in.the.sequence.only.b |
| 149480 | 65 63 61 75 73 65 20 74 68 61 74 20 77 61 73 20 61 0a 63 6f 6e 76 65 6e 69 65 6e 74 20 70 6c 61 | ecause.that.was.a.convenient.pla |
| 1494a0 | 63 65 20 74 6f 20 70 75 74 20 69 74 2e 0a 0a 20 20 20 60 43 6f 6d 70 69 6c 65 2d 6c 61 6d 62 64 | ce.to.put.it......`Compile-lambd |
| 1494c0 | 61 2d 62 6f 64 79 27 20 63 6f 6e 73 74 72 75 63 74 73 20 74 68 65 20 63 6f 64 65 20 66 6f 72 20 | a-body'.constructs.the.code.for. |
| 1494e0 | 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 2e 20 20 54 68 69 73 | the.body.of.the.procedure...This |
| 149500 | 20 63 6f 64 65 20 62 65 67 69 6e 73 20 77 69 74 68 20 61 20 6c 61 62 65 6c 20 66 6f 72 20 74 68 | .code.begins.with.a.label.for.th |
| 149520 | 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 2e 20 20 4e 65 78 74 0a 63 6f 6d 65 20 69 6e 73 74 72 75 | e.entry.point...Next.come.instru |
| 149540 | 63 74 69 6f 6e 73 20 74 68 61 74 20 77 69 6c 6c 20 63 61 75 73 65 20 74 68 65 20 72 75 6e 2d 74 | ctions.that.will.cause.the.run-t |
| 149560 | 69 6d 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 74 6f 20 73 77 | ime.evaluation.environment.to.sw |
| 149580 | 69 74 63 68 20 74 6f 20 74 68 65 20 63 6f 72 72 65 63 74 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 | itch.to.the.correct.environment. |
| 1495a0 | 66 6f 72 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 0a 62 6f 64 | for.evaluating.the.procedure.bod |
| 1495c0 | 79 2d 2d 6e 61 6d 65 6c 79 2c 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 65 6e 76 69 72 6f | y--namely,.the.definition.enviro |
| 1495e0 | 6e 6d 65 6e 74 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2c 20 65 78 74 65 6e 64 65 64 | nment.of.the.procedure,.extended |
| 149600 | 20 74 6f 0a 69 6e 63 6c 75 64 65 20 74 68 65 20 62 69 6e 64 69 6e 67 73 20 6f 66 20 74 68 65 20 | .to.include.the.bindings.of.the. |
| 149620 | 66 6f 72 6d 61 6c 20 70 61 72 61 6d 65 74 65 72 73 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e | formal.parameters.to.the.argumen |
| 149640 | 74 73 20 77 69 74 68 0a 77 68 69 63 68 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 63 | ts.with.which.the.procedure.is.c |
| 149660 | 61 6c 6c 65 64 2e 20 20 41 66 74 65 72 20 74 68 69 73 20 63 6f 6d 65 73 20 74 68 65 20 63 6f 64 | alled...After.this.comes.the.cod |
| 149680 | 65 20 66 6f 72 20 74 68 65 0a 73 65 71 75 65 6e 63 65 20 6f 66 20 65 78 70 72 65 73 73 69 6f 6e | e.for.the.sequence.of.expression |
| 1496a0 | 73 20 74 68 61 74 20 6d 61 6b 65 73 20 75 70 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 62 6f | s.that.makes.up.the.procedure.bo |
| 1496c0 | 64 79 2e 20 20 54 68 65 20 73 65 71 75 65 6e 63 65 0a 69 73 20 63 6f 6d 70 69 6c 65 64 20 77 69 | dy...The.sequence.is.compiled.wi |
| 1496e0 | 74 68 20 6c 69 6e 6b 61 67 65 20 60 72 65 74 75 72 6e 27 20 61 6e 64 20 74 61 72 67 65 74 20 60 | th.linkage.`return'.and.target.` |
| 149700 | 76 61 6c 27 20 73 6f 20 74 68 61 74 20 69 74 20 77 69 6c 6c 20 65 6e 64 0a 62 79 20 72 65 74 75 | val'.so.that.it.will.end.by.retu |
| 149720 | 72 6e 69 6e 67 20 66 72 6f 6d 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 77 69 74 68 20 74 68 | rning.from.the.procedure.with.th |
| 149740 | 65 20 70 72 6f 63 65 64 75 72 65 20 72 65 73 75 6c 74 20 69 6e 20 60 76 61 6c 27 2e 0a 0a 20 20 | e.procedure.result.in.`val'..... |
| 149760 | 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d 6c 61 6d 62 64 61 2d 62 6f 64 79 20 | ...(define.(compile-lambda-body. |
| 149780 | 65 78 70 20 70 72 6f 63 2d 65 6e 74 72 79 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 66 6f | exp.proc-entry)........(let.((fo |
| 1497a0 | 72 6d 61 6c 73 20 28 6c 61 6d 62 64 61 2d 70 61 72 61 6d 65 74 65 72 73 20 65 78 70 29 29 29 0a | rmals.(lambda-parameters.exp))). |
| 1497c0 | 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 | .........(append-instruction-seq |
| 1497e0 | 75 65 6e 63 65 73 0a 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 | uences...........(make-instructi |
| 149800 | 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 65 6e 76 20 70 72 6f 63 20 61 72 67 6c 29 20 27 28 65 | on-sequence.'(env.proc.argl).'(e |
| 149820 | 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 60 28 2c 70 72 6f 63 2d 65 6e 74 72 79 0a 20 20 20 | nv)............`(,proc-entry.... |
| 149840 | 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 6e 76 20 28 6f 70 20 63 6f 6d 70 69 6c | ..........(assign.env.(op.compil |
| 149860 | 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 76 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 | ed-procedure-env).(reg.proc))... |
| 149880 | 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 | ...........(assign.env.......... |
| 1498a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 20 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 | ............(op.extend-environme |
| 1498c0 | 6e 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 74 20 | nt)......................(const. |
| 1498e0 | 2c 66 6f 72 6d 61 6c 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ,formals)......................( |
| 149900 | 72 65 67 20 61 72 67 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | reg.argl)......................( |
| 149920 | 72 65 67 20 65 6e 76 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 73 | reg.env))))...........(compile-s |
| 149940 | 65 71 75 65 6e 63 65 20 28 6c 61 6d 62 64 61 2d 62 6f 64 79 20 65 78 70 29 20 27 76 61 6c 20 27 | equence.(lambda-body.exp).'val.' |
| 149960 | 72 65 74 75 72 6e 29 29 29 29 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f | return)))).....----------.Footno |
| 149980 | 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 54 68 69 73 20 70 72 6f 63 | tes.----------.....(1).This.proc |
| 1499a0 | 65 64 75 72 65 20 75 73 65 73 20 61 20 66 65 61 74 75 72 65 20 6f 66 20 4c 69 73 70 20 63 61 6c | edure.uses.a.feature.of.Lisp.cal |
| 1499c0 | 6c 65 64 20 22 62 61 63 6b 71 75 6f 74 65 22 20 28 6f 72 20 22 71 75 61 73 69 71 75 6f 74 65 22 | led."backquote".(or."quasiquote" |
| 1499e0 | 29 0a 74 68 61 74 20 69 73 20 68 61 6e 64 79 20 66 6f 72 20 63 6f 6e 73 74 72 75 63 74 69 6e 67 | ).that.is.handy.for.constructing |
| 149a00 | 20 6c 69 73 74 73 2e 20 20 50 72 65 63 65 64 69 6e 67 20 61 20 6c 69 73 74 20 77 69 74 68 20 61 | .lists...Preceding.a.list.with.a |
| 149a20 | 0a 62 61 63 6b 71 75 6f 74 65 20 73 79 6d 62 6f 6c 20 69 73 20 6d 75 63 68 20 6c 69 6b 65 20 71 | .backquote.symbol.is.much.like.q |
| 149a40 | 75 6f 74 69 6e 67 20 69 74 2c 20 65 78 63 65 70 74 20 74 68 61 74 20 61 6e 79 74 68 69 6e 67 20 | uoting.it,.except.that.anything. |
| 149a60 | 69 6e 20 74 68 65 0a 6c 69 73 74 20 74 68 61 74 20 69 73 20 66 6c 61 67 67 65 64 20 77 69 74 68 | in.the.list.that.is.flagged.with |
| 149a80 | 20 61 20 63 6f 6d 6d 61 20 69 73 20 65 76 61 6c 75 61 74 65 64 2e 0a 0a 20 20 20 46 6f 72 20 65 | .a.comma.is.evaluated......For.e |
| 149aa0 | 78 61 6d 70 6c 65 2c 20 69 66 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 6c 69 6e 6b 61 67 65 | xample,.if.the.value.of.`linkage |
| 149ac0 | 27 20 69 73 20 74 68 65 20 73 79 6d 62 6f 6c 0a 60 62 72 61 6e 63 68 32 35 27 2c 20 74 68 65 6e | '.is.the.symbol.`branch25',.then |
| 149ae0 | 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 0a 60 60 28 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 | .the.expression.``((goto.(label. |
| 149b00 | 2c 6c 69 6e 6b 61 67 65 29 29 29 27 0a 65 76 61 6c 75 61 74 65 73 20 74 6f 20 74 68 65 20 6c 69 | ,linkage)))'.evaluates.to.the.li |
| 149b20 | 73 74 0a 60 28 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 62 72 61 6e 63 68 32 35 29 29 29 27 2e 0a | st.`((goto.(label.branch25)))'.. |
| 149b40 | 53 69 6d 69 6c 61 72 6c 79 2c 20 69 66 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 78 27 20 69 | Similarly,.if.the.value.of.`x'.i |
| 149b60 | 73 20 74 68 65 20 6c 69 73 74 20 60 28 61 20 62 20 63 29 27 2c 20 74 68 65 6e 0a 60 60 28 31 20 | s.the.list.`(a.b.c)',.then.``(1. |
| 149b80 | 32 20 2c 28 63 61 72 20 78 29 29 27 0a 65 76 61 6c 75 61 74 65 73 20 74 6f 20 74 68 65 20 6c 69 | 2.,(car.x))'.evaluates.to.the.li |
| 149ba0 | 73 74 0a 60 28 31 20 32 20 61 29 27 2e 0a 0a 20 20 20 28 32 29 20 57 65 20 63 61 6e 27 74 20 6a | st.`(1.2.a)'......(2).We.can't.j |
| 149bc0 | 75 73 74 20 75 73 65 20 74 68 65 20 6c 61 62 65 6c 73 20 60 74 72 75 65 2d 62 72 61 6e 63 68 27 | ust.use.the.labels.`true-branch' |
| 149be0 | 2c 20 60 66 61 6c 73 65 2d 62 72 61 6e 63 68 27 2c 20 61 6e 64 0a 60 61 66 74 65 72 2d 69 66 27 | ,.`false-branch',.and.`after-if' |
| 149c00 | 20 61 73 20 73 68 6f 77 6e 20 61 62 6f 76 65 2c 20 62 65 63 61 75 73 65 20 74 68 65 72 65 20 6d | .as.shown.above,.because.there.m |
| 149c20 | 69 67 68 74 20 62 65 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 60 69 66 27 20 69 6e 0a 74 68 | ight.be.more.than.one.`if'.in.th |
| 149c40 | 65 20 70 72 6f 67 72 61 6d 2e 20 20 54 68 65 20 63 6f 6d 70 69 6c 65 72 20 75 73 65 73 20 74 68 | e.program...The.compiler.uses.th |
| 149c60 | 65 20 70 72 6f 63 65 64 75 72 65 20 60 6d 61 6b 65 2d 6c 61 62 65 6c 27 20 74 6f 20 67 65 6e 65 | e.procedure.`make-label'.to.gene |
| 149c80 | 72 61 74 65 0a 6c 61 62 65 6c 73 2e 20 20 60 4d 61 6b 65 2d 6c 61 62 65 6c 27 20 74 61 6b 65 73 | rate.labels...`Make-label'.takes |
| 149ca0 | 20 61 20 73 79 6d 62 6f 6c 20 61 73 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 72 65 74 75 72 6e | .a.symbol.as.argument.and.return |
| 149cc0 | 73 20 61 20 6e 65 77 0a 73 79 6d 62 6f 6c 20 74 68 61 74 20 62 65 67 69 6e 73 20 77 69 74 68 20 | s.a.new.symbol.that.begins.with. |
| 149ce0 | 74 68 65 20 67 69 76 65 6e 20 73 79 6d 62 6f 6c 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 | the.given.symbol...For.example,. |
| 149d00 | 73 75 63 63 65 73 73 69 76 65 0a 63 61 6c 6c 73 20 74 6f 20 60 28 6d 61 6b 65 2d 6c 61 62 65 6c | successive.calls.to.`(make-label |
| 149d20 | 20 27 61 29 27 20 77 6f 75 6c 64 20 72 65 74 75 72 6e 20 60 61 31 27 2c 20 60 61 32 27 2c 20 61 | .'a)'.would.return.`a1',.`a2',.a |
| 149d40 | 6e 64 20 73 6f 20 6f 6e 2e 0a 60 4d 61 6b 65 2d 6c 61 62 65 6c 27 20 63 61 6e 20 62 65 20 69 6d | nd.so.on..`Make-label'.can.be.im |
| 149d60 | 70 6c 65 6d 65 6e 74 65 64 20 73 69 6d 69 6c 61 72 6c 79 20 74 6f 20 74 68 65 20 67 65 6e 65 72 | plemented.similarly.to.the.gener |
| 149d80 | 61 74 69 6f 6e 20 6f 66 20 75 6e 69 71 75 65 0a 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 73 20 69 | ation.of.unique.variable.names.i |
| 149da0 | 6e 20 74 68 65 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 2c 20 61 73 20 66 6f 6c 6c 6f 77 73 | n.the.query.language,.as.follows |
| 149dc0 | 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 6c 61 62 65 6c 2d 63 6f 75 6e 74 65 72 20 30 29 | :.......(define.label-counter.0) |
| 149de0 | 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6e 65 77 2d 6c 61 62 65 6c 2d 6e 75 6d 62 65 72 | .......(define.(new-label-number |
| 149e00 | 29 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 6c 61 62 65 6c 2d 63 6f 75 6e 74 65 72 20 28 2b 20 | )........(set!.label-counter.(+. |
| 149e20 | 31 20 6c 61 62 65 6c 2d 63 6f 75 6e 74 65 72 29 29 0a 20 20 20 20 20 20 20 6c 61 62 65 6c 2d 63 | 1.label-counter))........label-c |
| 149e40 | 6f 75 6e 74 65 72 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6d 61 6b 65 2d 6c 61 62 65 | ounter).......(define.(make-labe |
| 149e60 | 6c 20 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 3e 73 79 6d 62 6f 6c 0a 20 | l.name)........(string->symbol.. |
| 149e80 | 20 20 20 20 20 20 20 20 28 73 74 72 69 6e 67 2d 61 70 70 65 6e 64 20 28 73 79 6d 62 6f 6c 2d 3e | ........(string-append.(symbol-> |
| 149ea0 | 73 74 72 69 6e 67 20 6e 61 6d 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | string.name).................... |
| 149ec0 | 20 20 20 20 20 28 6e 75 6d 62 65 72 2d 3e 73 74 72 69 6e 67 20 28 6e 65 77 2d 6c 61 62 65 6c 2d | .....(number->string.(new-label- |
| 149ee0 | 6e 75 6d 62 65 72 29 29 29 29 29 0a 0a 20 20 20 28 33 29 20 5b 46 6f 6f 74 6e 6f 74 65 20 33 38 | number))))).....(3).[Footnote.38 |
| 149f00 | 5d 20 57 65 20 6e 65 65 64 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 6f 20 | ].We.need.machine.operations.to. |
| 149f20 | 69 6d 70 6c 65 6d 65 6e 74 20 61 20 64 61 74 61 0a 73 74 72 75 63 74 75 72 65 20 66 6f 72 20 72 | implement.a.data.structure.for.r |
| 149f40 | 65 70 72 65 73 65 6e 74 69 6e 67 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 73 2c | epresenting.compiled.procedures, |
| 149f60 | 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 74 68 65 0a 73 74 72 75 63 74 75 72 65 20 66 6f 72 20 | .analogous.to.the.structure.for. |
| 149f80 | 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 73 20 64 65 73 63 72 69 62 65 64 20 69 6e | compound.procedures.described.in |
| 149fa0 | 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 33 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 | .section.*Note.4-1-3:::.......(d |
| 149fc0 | 65 66 69 6e 65 20 28 6d 61 6b 65 2d 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 20 65 | efine.(make-compiled-procedure.e |
| 149fe0 | 6e 74 72 79 20 65 6e 76 29 0a 20 20 20 20 20 20 20 28 6c 69 73 74 20 27 63 6f 6d 70 69 6c 65 64 | ntry.env)........(list.'compiled |
| 14a000 | 2d 70 72 6f 63 65 64 75 72 65 20 65 6e 74 72 79 20 65 6e 76 29 29 0a 0a 20 20 20 20 20 28 64 65 | -procedure.entry.env)).......(de |
| 14a020 | 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 3f 20 70 72 6f 63 29 0a | fine.(compiled-procedure?.proc). |
| 14a040 | 20 20 20 20 20 20 20 28 74 61 67 67 65 64 2d 6c 69 73 74 3f 20 70 72 6f 63 20 27 63 6f 6d 70 69 | .......(tagged-list?.proc.'compi |
| 14a060 | 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 | led-procedure)).......(define.(c |
| 14a080 | 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 20 63 2d 70 72 6f 63 29 20 | ompiled-procedure-entry.c-proc). |
| 14a0a0 | 28 63 61 64 72 20 63 2d 70 72 6f 63 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f | (cadr.c-proc)).......(define.(co |
| 14a0c0 | 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 76 20 63 2d 70 72 6f 63 29 20 28 63 61 | mpiled-procedure-env.c-proc).(ca |
| 14a0e0 | 64 64 72 20 63 2d 70 72 6f 63 29 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c | ddr.c-proc))....File:.sicp.info, |
| 14a100 | 20 20 4e 6f 64 65 3a 20 35 2d 35 2d 33 2c 20 20 4e 65 78 74 3a 20 35 2d 35 2d 34 2c 20 20 50 72 | ..Node:.5-5-3,..Next:.5-5-4,..Pr |
| 14a120 | 65 76 3a 20 35 2d 35 2d 32 2c 20 20 55 70 3a 20 35 2d 35 0a 0a 35 2e 35 2e 33 20 43 6f 6d 70 69 | ev:.5-5-2,..Up:.5-5..5.5.3.Compi |
| 14a140 | 6c 69 6e 67 20 43 6f 6d 62 69 6e 61 74 69 6f 6e 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ling.Combinations.-------------- |
| 14a160 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 65 20 65 73 73 65 6e 63 65 20 6f 66 20 74 | --------------..The.essence.of.t |
| 14a180 | 68 65 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 69 73 20 74 68 65 20 63 6f | he.compilation.process.is.the.co |
| 14a1a0 | 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 70 72 6f 63 65 64 75 72 65 0a 61 70 70 6c 69 63 61 74 69 | mpilation.of.procedure.applicati |
| 14a1c0 | 6f 6e 73 2e 20 20 54 68 65 20 63 6f 64 65 20 66 6f 72 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e | ons...The.code.for.a.combination |
| 14a1e0 | 20 63 6f 6d 70 69 6c 65 64 20 77 69 74 68 20 61 20 67 69 76 65 6e 20 74 61 72 67 65 74 0a 61 6e | .compiled.with.a.given.target.an |
| 14a200 | 64 20 6c 69 6e 6b 61 67 65 20 68 61 73 20 74 68 65 20 66 6f 72 6d 0a 0a 20 20 20 20 20 3c 5f 63 | d.linkage.has.the.form.......<_c |
| 14a220 | 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 6f 70 65 72 61 74 6f 72 2c 20 74 61 72 67 65 74 20 60 | ompilation.of.operator,.target.` |
| 14a240 | 70 72 6f 63 27 2c 20 6c 69 6e 6b 61 67 65 20 60 6e 65 78 74 27 5f 3e 0a 20 20 20 20 20 3c 5f 65 | proc',.linkage.`next'_>......<_e |
| 14a260 | 76 61 6c 75 61 74 65 20 6f 70 65 72 61 6e 64 73 20 61 6e 64 20 63 6f 6e 73 74 72 75 63 74 20 61 | valuate.operands.and.construct.a |
| 14a280 | 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 69 6e 20 60 61 72 67 6c 27 5f 3e 0a 20 20 20 20 20 3c 5f | rgument.list.in.`argl'_>......<_ |
| 14a2a0 | 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 20 77 69 | compilation.of.procedure.call.wi |
| 14a2c0 | 74 68 20 67 69 76 65 6e 20 74 61 72 67 65 74 20 61 6e 64 20 6c 69 6e 6b 61 67 65 5f 3e 0a 0a 20 | th.given.target.and.linkage_>... |
| 14a2e0 | 20 20 54 68 65 20 72 65 67 69 73 74 65 72 73 20 60 65 6e 76 27 2c 20 60 70 72 6f 63 27 2c 20 61 | ..The.registers.`env',.`proc',.a |
| 14a300 | 6e 64 20 60 61 72 67 6c 27 20 6d 61 79 20 68 61 76 65 20 74 6f 20 62 65 20 73 61 76 65 64 20 61 | nd.`argl'.may.have.to.be.saved.a |
| 14a320 | 6e 64 0a 72 65 73 74 6f 72 65 64 20 64 75 72 69 6e 67 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 | nd.restored.during.evaluation.of |
| 14a340 | 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 61 6e 64 20 6f 70 65 72 61 6e 64 73 2e 20 20 4e 6f 74 | .the.operator.and.operands...Not |
| 14a360 | 65 20 74 68 61 74 0a 74 68 69 73 20 69 73 20 74 68 65 20 6f 6e 6c 79 20 70 6c 61 63 65 20 69 6e | e.that.this.is.the.only.place.in |
| 14a380 | 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 77 68 65 72 65 20 61 20 74 61 72 67 65 74 20 6f 74 68 | .the.compiler.where.a.target.oth |
| 14a3a0 | 65 72 20 74 68 61 6e 20 60 76 61 6c 27 0a 69 73 20 73 70 65 63 69 66 69 65 64 2e 0a 0a 20 20 20 | er.than.`val'.is.specified...... |
| 14a3c0 | 54 68 65 20 72 65 71 75 69 72 65 64 20 63 6f 64 65 20 69 73 20 67 65 6e 65 72 61 74 65 64 20 62 | The.required.code.is.generated.b |
| 14a3e0 | 79 20 60 63 6f 6d 70 69 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 27 2e 20 20 54 68 69 73 0a 72 | y.`compile-application'...This.r |
| 14a400 | 65 63 75 72 73 69 76 65 6c 79 20 63 6f 6d 70 69 6c 65 73 20 74 68 65 20 6f 70 65 72 61 74 6f 72 | ecursively.compiles.the.operator |
| 14a420 | 2c 20 74 6f 20 70 72 6f 64 75 63 65 20 63 6f 64 65 20 74 68 61 74 20 70 75 74 73 20 74 68 65 0a | ,.to.produce.code.that.puts.the. |
| 14a440 | 70 72 6f 63 65 64 75 72 65 20 74 6f 20 62 65 20 61 70 70 6c 69 65 64 20 69 6e 74 6f 20 60 70 72 | procedure.to.be.applied.into.`pr |
| 14a460 | 6f 63 27 2c 20 61 6e 64 20 63 6f 6d 70 69 6c 65 73 20 74 68 65 20 6f 70 65 72 61 6e 64 73 2c 20 | oc',.and.compiles.the.operands,. |
| 14a480 | 74 6f 0a 70 72 6f 64 75 63 65 20 63 6f 64 65 20 74 68 61 74 20 65 76 61 6c 75 61 74 65 73 20 74 | to.produce.code.that.evaluates.t |
| 14a4a0 | 68 65 20 69 6e 64 69 76 69 64 75 61 6c 20 6f 70 65 72 61 6e 64 73 20 6f 66 20 74 68 65 20 61 70 | he.individual.operands.of.the.ap |
| 14a4c0 | 70 6c 69 63 61 74 69 6f 6e 2e 0a 54 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 | plication..The.instruction.seque |
| 14a4e0 | 6e 63 65 73 20 66 6f 72 20 74 68 65 20 6f 70 65 72 61 6e 64 73 20 61 72 65 20 63 6f 6d 62 69 6e | nces.for.the.operands.are.combin |
| 14a500 | 65 64 20 28 62 79 0a 60 63 6f 6e 73 74 72 75 63 74 2d 61 72 67 6c 69 73 74 27 29 20 77 69 74 68 | ed.(by.`construct-arglist').with |
| 14a520 | 20 63 6f 64 65 20 74 68 61 74 20 63 6f 6e 73 74 72 75 63 74 73 20 74 68 65 20 6c 69 73 74 20 6f | .code.that.constructs.the.list.o |
| 14a540 | 66 20 61 72 67 75 6d 65 6e 74 73 20 69 6e 0a 60 61 72 67 6c 27 2c 20 61 6e 64 20 74 68 65 20 72 | f.arguments.in.`argl',.and.the.r |
| 14a560 | 65 73 75 6c 74 69 6e 67 20 61 72 67 75 6d 65 6e 74 2d 6c 69 73 74 20 63 6f 64 65 20 69 73 20 63 | esulting.argument-list.code.is.c |
| 14a580 | 6f 6d 62 69 6e 65 64 20 77 69 74 68 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 63 6f 64 65 20 | ombined.with.the.procedure.code. |
| 14a5a0 | 61 6e 64 20 74 68 65 20 63 6f 64 65 20 74 68 61 74 20 70 65 72 66 6f 72 6d 73 20 74 68 65 20 70 | and.the.code.that.performs.the.p |
| 14a5c0 | 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 20 28 70 72 6f 64 75 63 65 64 0a 62 79 20 60 63 6f 6d 70 | rocedure.call.(produced.by.`comp |
| 14a5e0 | 69 6c 65 2d 70 72 6f 63 65 64 75 72 65 2d 63 61 6c 6c 27 29 2e 20 20 49 6e 20 61 70 70 65 6e 64 | ile-procedure-call')...In.append |
| 14a600 | 69 6e 67 20 74 68 65 20 63 6f 64 65 20 73 65 71 75 65 6e 63 65 73 2c 20 74 68 65 0a 60 65 6e 76 | ing.the.code.sequences,.the.`env |
| 14a620 | 27 20 72 65 67 69 73 74 65 72 20 6d 75 73 74 20 62 65 20 70 72 65 73 65 72 76 65 64 20 61 72 6f | '.register.must.be.preserved.aro |
| 14a640 | 75 6e 64 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6f 70 65 72 61 74 | und.the.evaluation.of.the.operat |
| 14a660 | 6f 72 0a 28 73 69 6e 63 65 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 6f 70 65 72 61 74 6f | or.(since.evaluating.the.operato |
| 14a680 | 72 20 6d 69 67 68 74 20 6d 6f 64 69 66 79 20 60 65 6e 76 27 2c 20 77 68 69 63 68 20 77 69 6c 6c | r.might.modify.`env',.which.will |
| 14a6a0 | 20 62 65 20 6e 65 65 64 65 64 0a 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 6f 70 65 72 61 | .be.needed.to.evaluate.the.opera |
| 14a6c0 | 6e 64 73 29 2c 20 61 6e 64 20 74 68 65 20 60 70 72 6f 63 27 20 72 65 67 69 73 74 65 72 20 6d 75 | nds),.and.the.`proc'.register.mu |
| 14a6e0 | 73 74 20 62 65 20 70 72 65 73 65 72 76 65 64 0a 61 72 6f 75 6e 64 20 74 68 65 20 63 6f 6e 73 74 | st.be.preserved.around.the.const |
| 14a700 | 72 75 63 74 69 6f 6e 20 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 28 73 69 | ruction.of.the.argument.list.(si |
| 14a720 | 6e 63 65 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 0a 6f 70 65 72 61 6e 64 73 20 6d 69 67 68 | nce.evaluating.the.operands.migh |
| 14a740 | 74 20 6d 6f 64 69 66 79 20 60 70 72 6f 63 27 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 62 65 20 6e | t.modify.`proc',.which.will.be.n |
| 14a760 | 65 65 64 65 64 20 66 6f 72 20 74 68 65 20 61 63 74 75 61 6c 0a 70 72 6f 63 65 64 75 72 65 20 61 | eeded.for.the.actual.procedure.a |
| 14a780 | 70 70 6c 69 63 61 74 69 6f 6e 29 2e 20 20 60 43 6f 6e 74 69 6e 75 65 27 20 6d 75 73 74 20 61 6c | pplication)...`Continue'.must.al |
| 14a7a0 | 73 6f 20 62 65 20 70 72 65 73 65 72 76 65 64 20 74 68 72 6f 75 67 68 6f 75 74 2c 0a 73 69 6e 63 | so.be.preserved.throughout,.sinc |
| 14a7c0 | 65 20 69 74 20 69 73 20 6e 65 65 64 65 64 20 66 6f 72 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 69 | e.it.is.needed.for.the.linkage.i |
| 14a7e0 | 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 2e 0a 0a 20 20 20 20 20 28 64 65 66 | n.the.procedure.call........(def |
| 14a800 | 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 20 65 78 70 20 74 61 72 | ine.(compile-application.exp.tar |
| 14a820 | 67 65 74 20 6c 69 6e 6b 61 67 65 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 6f 63 2d | get.linkage)........(let.((proc- |
| 14a840 | 63 6f 64 65 20 28 63 6f 6d 70 69 6c 65 20 28 6f 70 65 72 61 74 6f 72 20 65 78 70 29 20 27 70 72 | code.(compile.(operator.exp).'pr |
| 14a860 | 6f 63 20 27 6e 65 78 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 65 72 61 6e 64 | oc.'next))..............(operand |
| 14a880 | 2d 63 6f 64 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 70 20 28 6c 61 6d 62 64 | -codes...............(map.(lambd |
| 14a8a0 | 61 20 28 6f 70 65 72 61 6e 64 29 20 28 63 6f 6d 70 69 6c 65 20 6f 70 65 72 61 6e 64 20 27 76 61 | a.(operand).(compile.operand.'va |
| 14a8c0 | 6c 20 27 6e 65 78 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 | l.'next))....................(op |
| 14a8e0 | 65 72 61 6e 64 73 20 65 78 70 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 70 72 65 73 65 72 76 | erands.exp))))..........(preserv |
| 14a900 | 69 6e 67 20 27 28 65 6e 76 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 70 72 | ing.'(env.continue)...........pr |
| 14a920 | 6f 63 2d 63 6f 64 65 0a 20 20 20 20 20 20 20 20 20 20 28 70 72 65 73 65 72 76 69 6e 67 20 27 28 | oc-code...........(preserving.'( |
| 14a940 | 70 72 6f 63 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 74 | proc.continue)............(const |
| 14a960 | 72 75 63 74 2d 61 72 67 6c 69 73 74 20 6f 70 65 72 61 6e 64 2d 63 6f 64 65 73 29 0a 20 20 20 20 | ruct-arglist.operand-codes)..... |
| 14a980 | 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 70 72 6f 63 65 64 75 72 65 2d 63 61 6c 6c 20 74 | .......(compile-procedure-call.t |
| 14a9a0 | 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 29 29 29 29 0a 0a 20 20 20 54 68 65 20 63 6f 64 65 20 | arget.linkage))))).....The.code. |
| 14a9c0 | 74 6f 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 77 | to.construct.the.argument.list.w |
| 14a9e0 | 69 6c 6c 20 65 76 61 6c 75 61 74 65 20 65 61 63 68 20 6f 70 65 72 61 6e 64 0a 69 6e 74 6f 20 60 | ill.evaluate.each.operand.into.` |
| 14aa00 | 76 61 6c 27 20 61 6e 64 20 74 68 65 6e 20 60 63 6f 6e 73 27 20 74 68 61 74 20 76 61 6c 75 65 20 | val'.and.then.`cons'.that.value. |
| 14aa20 | 6f 6e 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 62 65 69 6e 67 0a 61 63 63 | onto.the.argument.list.being.acc |
| 14aa40 | 75 6d 75 6c 61 74 65 64 20 69 6e 20 60 61 72 67 6c 27 2e 20 20 53 69 6e 63 65 20 77 65 20 60 63 | umulated.in.`argl'...Since.we.`c |
| 14aa60 | 6f 6e 73 27 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 6f 6e 74 6f 20 60 61 72 67 6c 27 20 69 | ons'.the.arguments.onto.`argl'.i |
| 14aa80 | 6e 0a 73 65 71 75 65 6e 63 65 2c 20 77 65 20 6d 75 73 74 20 73 74 61 72 74 20 77 69 74 68 20 74 | n.sequence,.we.must.start.with.t |
| 14aaa0 | 68 65 20 6c 61 73 74 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 65 6e 64 20 77 69 74 68 20 74 68 | he.last.argument.and.end.with.th |
| 14aac0 | 65 20 66 69 72 73 74 2c 0a 73 6f 20 74 68 61 74 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 77 | e.first,.so.that.the.arguments.w |
| 14aae0 | 69 6c 6c 20 61 70 70 65 61 72 20 69 6e 20 6f 72 64 65 72 20 66 72 6f 6d 20 66 69 72 73 74 20 74 | ill.appear.in.order.from.first.t |
| 14ab00 | 6f 20 6c 61 73 74 20 69 6e 20 74 68 65 0a 72 65 73 75 6c 74 69 6e 67 20 6c 69 73 74 2e 20 20 52 | o.last.in.the.resulting.list...R |
| 14ab20 | 61 74 68 65 72 20 74 68 61 6e 20 77 61 73 74 65 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 | ather.than.waste.an.instruction. |
| 14ab40 | 62 79 20 69 6e 69 74 69 61 6c 69 7a 69 6e 67 20 60 61 72 67 6c 27 0a 74 6f 20 74 68 65 20 65 6d | by.initializing.`argl'.to.the.em |
| 14ab60 | 70 74 79 20 6c 69 73 74 20 74 6f 20 73 65 74 20 75 70 20 66 6f 72 20 74 68 69 73 20 73 65 71 75 | pty.list.to.set.up.for.this.sequ |
| 14ab80 | 65 6e 63 65 20 6f 66 20 65 76 61 6c 75 61 74 69 6f 6e 73 2c 20 77 65 20 6d 61 6b 65 0a 74 68 65 | ence.of.evaluations,.we.make.the |
| 14aba0 | 20 66 69 72 73 74 20 63 6f 64 65 20 73 65 71 75 65 6e 63 65 20 63 6f 6e 73 74 72 75 63 74 20 74 | .first.code.sequence.construct.t |
| 14abc0 | 68 65 20 69 6e 69 74 69 61 6c 20 60 61 72 67 6c 27 2e 20 20 54 68 65 20 67 65 6e 65 72 61 6c 20 | he.initial.`argl'...The.general. |
| 14abe0 | 66 6f 72 6d 0a 6f 66 20 74 68 65 20 61 72 67 75 6d 65 6e 74 2d 6c 69 73 74 20 63 6f 6e 73 74 72 | form.of.the.argument-list.constr |
| 14ac00 | 75 63 74 69 6f 6e 20 69 73 20 74 68 75 73 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 | uction.is.thus.as.follows:...... |
| 14ac20 | 20 3c 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 6c 61 73 74 20 6f 70 65 72 61 6e 64 2c 20 | .<_compilation.of.last.operand,. |
| 14ac40 | 74 61 72 67 65 74 65 64 20 74 6f 20 60 76 61 6c 27 5f 3e 0a 20 20 20 20 20 28 61 73 73 69 67 6e | targeted.to.`val'_>......(assign |
| 14ac60 | 20 61 72 67 6c 20 28 6f 70 20 6c 69 73 74 29 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 | .argl.(op.list).(reg.val))...... |
| 14ac80 | 3c 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 6e 65 78 74 20 6f 70 65 72 61 6e 64 2c 20 74 | <_compilation.of.next.operand,.t |
| 14aca0 | 61 72 67 65 74 65 64 20 74 6f 20 60 76 61 6c 27 5f 3e 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 | argeted.to.`val'_>......(assign. |
| 14acc0 | 61 72 67 6c 20 28 6f 70 20 63 6f 6e 73 29 20 28 72 65 67 20 76 61 6c 29 20 28 72 65 67 20 61 72 | argl.(op.cons).(reg.val).(reg.ar |
| 14ace0 | 67 6c 29 29 0a 20 20 20 20 20 2e 2e 2e 0a 20 20 20 20 20 3c 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e | gl))...............<_compilation |
| 14ad00 | 20 6f 66 20 66 69 72 73 74 20 6f 70 65 72 61 6e 64 2c 20 74 61 72 67 65 74 65 64 20 74 6f 20 60 | .of.first.operand,.targeted.to.` |
| 14ad20 | 76 61 6c 27 5f 3e 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 63 6f 6e | val'_>......(assign.argl.(op.con |
| 14ad40 | 73 29 20 28 72 65 67 20 76 61 6c 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 0a 20 20 20 60 41 72 | s).(reg.val).(reg.argl)).....`Ar |
| 14ad60 | 67 6c 27 20 6d 75 73 74 20 62 65 20 70 72 65 73 65 72 76 65 64 20 61 72 6f 75 6e 64 20 65 61 63 | gl'.must.be.preserved.around.eac |
| 14ad80 | 68 20 6f 70 65 72 61 6e 64 20 65 76 61 6c 75 61 74 69 6f 6e 20 65 78 63 65 70 74 20 74 68 65 0a | h.operand.evaluation.except.the. |
| 14ada0 | 66 69 72 73 74 20 28 73 6f 20 74 68 61 74 20 61 72 67 75 6d 65 6e 74 73 20 61 63 63 75 6d 75 6c | first.(so.that.arguments.accumul |
| 14adc0 | 61 74 65 64 20 73 6f 20 66 61 72 20 77 6f 6e 27 74 20 62 65 20 6c 6f 73 74 29 2c 20 61 6e 64 20 | ated.so.far.won't.be.lost),.and. |
| 14ade0 | 60 65 6e 76 27 0a 6d 75 73 74 20 62 65 20 70 72 65 73 65 72 76 65 64 20 61 72 6f 75 6e 64 20 65 | `env'.must.be.preserved.around.e |
| 14ae00 | 61 63 68 20 6f 70 65 72 61 6e 64 20 65 76 61 6c 75 61 74 69 6f 6e 20 65 78 63 65 70 74 20 74 68 | ach.operand.evaluation.except.th |
| 14ae20 | 65 20 6c 61 73 74 20 28 66 6f 72 0a 75 73 65 20 62 79 20 73 75 62 73 65 71 75 65 6e 74 20 6f 70 | e.last.(for.use.by.subsequent.op |
| 14ae40 | 65 72 61 6e 64 20 65 76 61 6c 75 61 74 69 6f 6e 73 29 2e 0a 0a 20 20 20 43 6f 6d 70 69 6c 69 6e | erand.evaluations)......Compilin |
| 14ae60 | 67 20 74 68 69 73 20 61 72 67 75 6d 65 6e 74 20 63 6f 64 65 20 69 73 20 61 20 62 69 74 20 74 72 | g.this.argument.code.is.a.bit.tr |
| 14ae80 | 69 63 6b 79 2c 20 62 65 63 61 75 73 65 20 6f 66 20 74 68 65 20 73 70 65 63 69 61 6c 0a 74 72 65 | icky,.because.of.the.special.tre |
| 14aea0 | 61 74 6d 65 6e 74 20 6f 66 20 74 68 65 20 66 69 72 73 74 20 6f 70 65 72 61 6e 64 20 74 6f 20 62 | atment.of.the.first.operand.to.b |
| 14aec0 | 65 20 65 76 61 6c 75 61 74 65 64 20 61 6e 64 20 74 68 65 20 6e 65 65 64 20 74 6f 20 70 72 65 73 | e.evaluated.and.the.need.to.pres |
| 14aee0 | 65 72 76 65 0a 60 61 72 67 6c 27 20 61 6e 64 20 60 65 6e 76 27 20 69 6e 20 64 69 66 66 65 72 65 | erve.`argl'.and.`env'.in.differe |
| 14af00 | 6e 74 20 70 6c 61 63 65 73 2e 20 20 54 68 65 20 60 63 6f 6e 73 74 72 75 63 74 2d 61 72 67 6c 69 | nt.places...The.`construct-argli |
| 14af20 | 73 74 27 0a 70 72 6f 63 65 64 75 72 65 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 | st'.procedure.takes.as.arguments |
| 14af40 | 20 74 68 65 20 63 6f 64 65 20 74 68 61 74 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 69 6e 64 | .the.code.that.evaluates.the.ind |
| 14af60 | 69 76 69 64 75 61 6c 0a 6f 70 65 72 61 6e 64 73 2e 20 20 49 66 20 74 68 65 72 65 20 61 72 65 20 | ividual.operands...If.there.are. |
| 14af80 | 6e 6f 20 6f 70 65 72 61 6e 64 73 20 61 74 20 61 6c 6c 2c 20 69 74 20 73 69 6d 70 6c 79 20 65 6d | no.operands.at.all,.it.simply.em |
| 14afa0 | 69 74 73 20 74 68 65 0a 69 6e 73 74 72 75 63 74 69 6f 6e 0a 0a 20 20 20 20 20 28 61 73 73 69 67 | its.the.instruction.......(assig |
| 14afc0 | 6e 20 61 72 67 6c 20 28 63 6f 6e 73 74 20 28 29 29 29 0a 0a 20 20 20 4f 74 68 65 72 77 69 73 65 | n.argl.(const.())).....Otherwise |
| 14afe0 | 2c 20 60 63 6f 6e 73 74 72 75 63 74 2d 61 72 67 6c 69 73 74 27 20 63 72 65 61 74 65 73 20 63 6f | ,.`construct-arglist'.creates.co |
| 14b000 | 64 65 20 74 68 61 74 20 69 6e 69 74 69 61 6c 69 7a 65 73 20 60 61 72 67 6c 27 0a 77 69 74 68 20 | de.that.initializes.`argl'.with. |
| 14b020 | 74 68 65 20 6c 61 73 74 20 61 72 67 75 6d 65 6e 74 2c 20 61 6e 64 20 61 70 70 65 6e 64 73 20 63 | the.last.argument,.and.appends.c |
| 14b040 | 6f 64 65 20 74 68 61 74 20 65 76 61 6c 75 61 74 65 73 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 | ode.that.evaluates.the.rest.of.t |
| 14b060 | 68 65 0a 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 61 64 6a 6f 69 6e 73 20 74 68 65 6d 20 74 6f | he.arguments.and.adjoins.them.to |
| 14b080 | 20 60 61 72 67 6c 27 20 69 6e 20 73 75 63 63 65 73 73 69 6f 6e 2e 20 20 49 6e 20 6f 72 64 65 72 | .`argl'.in.succession...In.order |
| 14b0a0 | 20 74 6f 20 70 72 6f 63 65 73 73 0a 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 66 72 6f 6d 20 6c | .to.process.the.arguments.from.l |
| 14b0c0 | 61 73 74 20 74 6f 20 66 69 72 73 74 2c 20 77 65 20 6d 75 73 74 20 72 65 76 65 72 73 65 20 74 68 | ast.to.first,.we.must.reverse.th |
| 14b0e0 | 65 20 6c 69 73 74 20 6f 66 20 6f 70 65 72 61 6e 64 0a 63 6f 64 65 20 73 65 71 75 65 6e 63 65 73 | e.list.of.operand.code.sequences |
| 14b100 | 20 66 72 6f 6d 20 74 68 65 20 6f 72 64 65 72 20 73 75 70 70 6c 69 65 64 20 62 79 20 60 63 6f 6d | .from.the.order.supplied.by.`com |
| 14b120 | 70 69 6c 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 27 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | pile-application'........(define |
| 14b140 | 20 28 63 6f 6e 73 74 72 75 63 74 2d 61 72 67 6c 69 73 74 20 6f 70 65 72 61 6e 64 2d 63 6f 64 65 | .(construct-arglist.operand-code |
| 14b160 | 73 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 6f 70 65 72 61 6e 64 2d 63 6f 64 65 73 20 28 | s)........(let.((operand-codes.( |
| 14b180 | 72 65 76 65 72 73 65 20 6f 70 65 72 61 6e 64 2d 63 6f 64 65 73 29 29 29 0a 20 20 20 20 20 20 20 | reverse.operand-codes)))........ |
| 14b1a0 | 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 6f 70 65 72 61 6e 64 2d 63 6f 64 65 73 29 0a 20 20 20 20 | ..(if.(null?.operand-codes)..... |
| 14b1c0 | 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 | .........(make-instruction-seque |
| 14b1e0 | 6e 63 65 20 27 28 29 20 27 28 61 72 67 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 28 | nce.'().'(argl)...............'( |
| 14b200 | 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 63 6f 6e 73 74 20 28 29 29 29 29 29 0a 20 20 20 20 20 | (assign.argl.(const.()))))...... |
| 14b220 | 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 6f 64 65 2d 74 6f 2d 67 65 74 2d 6c 61 73 74 2d | ........(let.((code-to-get-last- |
| 14b240 | 61 72 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 2d | arg.....................(append- |
| 14b260 | 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 0a 20 20 20 20 20 20 20 20 20 20 | instruction-sequences........... |
| 14b280 | 20 20 20 20 20 20 20 20 20 20 20 28 63 61 72 20 6f 70 65 72 61 6e 64 2d 63 6f 64 65 73 29 0a 20 | ...........(car.operand-codes).. |
| 14b2a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 | ....................(make-instru |
| 14b2c0 | 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 76 61 6c 29 20 27 28 61 72 67 6c 29 0a 20 20 | ction-sequence.'(val).'(argl)... |
| 14b2e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 28 28 61 73 73 69 67 6e 20 61 72 | ....................'((assign.ar |
| 14b300 | 67 6c 20 28 6f 70 20 6c 69 73 74 29 20 28 72 65 67 20 76 61 6c 29 29 29 29 29 29 29 0a 20 20 20 | gl.(op.list).(reg.val))))))).... |
| 14b320 | 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 28 63 64 72 20 6f 70 65 72 | ............(if.(null?.(cdr.oper |
| 14b340 | 61 6e 64 2d 63 6f 64 65 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 | and-codes))....................c |
| 14b360 | 6f 64 65 2d 74 6f 2d 67 65 74 2d 6c 61 73 74 2d 61 72 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ode-to-get-last-arg............. |
| 14b380 | 20 20 20 20 20 20 20 28 70 72 65 73 65 72 76 69 6e 67 20 27 28 65 6e 76 29 0a 20 20 20 20 20 20 | .......(preserving.'(env)....... |
| 14b3a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 64 65 2d 74 6f 2d 67 65 74 2d 6c 61 73 74 2d 61 | ..............code-to-get-last-a |
| 14b3c0 | 72 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 64 65 2d 74 6f 2d | rg.....................(code-to- |
| 14b3e0 | 67 65 74 2d 72 65 73 74 2d 61 72 67 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | get-rest-args................... |
| 14b400 | 20 20 20 28 63 64 72 20 6f 70 65 72 61 6e 64 2d 63 6f 64 65 73 29 29 29 29 29 29 29 29 0a 0a 20 | ...(cdr.operand-codes))))))))... |
| 14b420 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 64 65 2d 74 6f 2d 67 65 74 2d 72 65 73 74 2d 61 72 | ....(define.(code-to-get-rest-ar |
| 14b440 | 67 73 20 6f 70 65 72 61 6e 64 2d 63 6f 64 65 73 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 | gs.operand-codes)........(let.(( |
| 14b460 | 63 6f 64 65 2d 66 6f 72 2d 6e 65 78 74 2d 61 72 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | code-for-next-arg............... |
| 14b480 | 28 70 72 65 73 65 72 76 69 6e 67 20 27 28 61 72 67 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | (preserving.'(argl)............. |
| 14b4a0 | 20 20 20 28 63 61 72 20 6f 70 65 72 61 6e 64 2d 63 6f 64 65 73 29 0a 20 20 20 20 20 20 20 20 20 | ...(car.operand-codes).......... |
| 14b4c0 | 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 | ......(make-instruction-sequence |
| 14b4e0 | 20 27 28 76 61 6c 20 61 72 67 6c 29 20 27 28 61 72 67 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .'(val.argl).'(argl)............ |
| 14b500 | 20 20 20 20 20 27 28 28 61 73 73 69 67 6e 20 61 72 67 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 | .....'((assign.argl............. |
| 14b520 | 20 20 20 20 20 20 20 28 6f 70 20 63 6f 6e 73 29 20 28 72 65 67 20 76 61 6c 29 20 28 72 65 67 20 | .......(op.cons).(reg.val).(reg. |
| 14b540 | 61 72 67 6c 29 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 | argl)))))))..........(if.(null?. |
| 14b560 | 28 63 64 72 20 6f 70 65 72 61 6e 64 2d 63 6f 64 65 73 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (cdr.operand-codes))............ |
| 14b580 | 20 20 63 6f 64 65 2d 66 6f 72 2d 6e 65 78 74 2d 61 72 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..code-for-next-arg............. |
| 14b5a0 | 20 28 70 72 65 73 65 72 76 69 6e 67 20 27 28 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | .(preserving.'(env)............. |
| 14b5c0 | 20 20 63 6f 64 65 2d 66 6f 72 2d 6e 65 78 74 2d 61 72 67 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..code-for-next-arg............. |
| 14b5e0 | 20 20 28 63 6f 64 65 2d 74 6f 2d 67 65 74 2d 72 65 73 74 2d 61 72 67 73 20 28 63 64 72 20 6f 70 | ..(code-to-get-rest-args.(cdr.op |
| 14b600 | 65 72 61 6e 64 2d 63 6f 64 65 73 29 29 29 29 29 29 0a 0a 41 70 70 6c 79 69 6e 67 20 70 72 6f 63 | erand-codes))))))..Applying.proc |
| 14b620 | 65 64 75 72 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 41 66 74 65 | edures......................Afte |
| 14b640 | 72 20 65 76 61 6c 75 61 74 69 6e 67 20 74 68 65 20 65 6c 65 6d 65 6e 74 73 20 6f 66 20 61 20 63 | r.evaluating.the.elements.of.a.c |
| 14b660 | 6f 6d 62 69 6e 61 74 69 6f 6e 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 6d 75 | ombination,.the.compiled.code.mu |
| 14b680 | 73 74 0a 61 70 70 6c 79 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 69 6e 20 60 70 72 6f 63 27 | st.apply.the.procedure.in.`proc' |
| 14b6a0 | 20 74 6f 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 69 6e 20 60 61 72 67 6c 27 2e 20 20 54 68 | .to.the.arguments.in.`argl'...Th |
| 14b6c0 | 65 20 63 6f 64 65 0a 70 65 72 66 6f 72 6d 73 20 65 73 73 65 6e 74 69 61 6c 6c 79 20 74 68 65 20 | e.code.performs.essentially.the. |
| 14b6e0 | 73 61 6d 65 20 64 69 73 70 61 74 63 68 20 61 73 20 74 68 65 20 60 61 70 70 6c 79 27 20 70 72 6f | same.dispatch.as.the.`apply'.pro |
| 14b700 | 63 65 64 75 72 65 20 69 6e 20 74 68 65 0a 6d 65 74 61 63 69 72 63 75 6c 61 72 20 65 76 61 6c 75 | cedure.in.the.metacircular.evalu |
| 14b720 | 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 31 3a 3a 20 6f 72 | ator.of.section.*Note.4-1-1::.or |
| 14b740 | 20 74 68 65 20 60 61 70 70 6c 79 2d 64 69 73 70 61 74 63 68 27 0a 65 6e 74 72 79 20 70 6f 69 6e | .the.`apply-dispatch'.entry.poin |
| 14b760 | 74 20 69 6e 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 | t.in.the.explicit-control.evalua |
| 14b780 | 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 34 2d 31 3a 3a 2e 0a 49 74 | tor.of.section.*Note.5-4-1::..It |
| 14b7a0 | 20 63 68 65 63 6b 73 20 77 68 65 74 68 65 72 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f | .checks.whether.the.procedure.to |
| 14b7c0 | 20 62 65 20 61 70 70 6c 69 65 64 20 69 73 20 61 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 | .be.applied.is.a.primitive.proce |
| 14b7e0 | 64 75 72 65 0a 6f 72 20 61 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 2e 20 20 46 | dure.or.a.compiled.procedure...F |
| 14b800 | 6f 72 20 61 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 2c 20 69 74 20 75 73 65 | or.a.primitive.procedure,.it.use |
| 14b820 | 73 0a 60 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 27 3b 20 77 | s.`apply-primitive-procedure';.w |
| 14b840 | 65 20 77 69 6c 6c 20 73 65 65 20 73 68 6f 72 74 6c 79 20 68 6f 77 20 69 74 20 68 61 6e 64 6c 65 | e.will.see.shortly.how.it.handle |
| 14b860 | 73 20 63 6f 6d 70 69 6c 65 64 0a 70 72 6f 63 65 64 75 72 65 73 2e 20 20 54 68 65 20 70 72 6f 63 | s.compiled.procedures...The.proc |
| 14b880 | 65 64 75 72 65 2d 61 70 70 6c 69 63 61 74 69 6f 6e 20 63 6f 64 65 20 68 61 73 20 74 68 65 20 66 | edure-application.code.has.the.f |
| 14b8a0 | 6f 6c 6c 6f 77 69 6e 67 20 66 6f 72 6d 3a 0a 0a 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 70 | ollowing.form:.......(test.(op.p |
| 14b8c0 | 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 67 20 70 72 6f 63 29 29 | rimitive-procedure?).(reg.proc)) |
| 14b8e0 | 0a 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 70 72 69 6d 69 74 69 76 65 2d | .......(branch.(label.primitive- |
| 14b900 | 62 72 61 6e 63 68 29 29 0a 20 20 20 20 20 63 6f 6d 70 69 6c 65 64 2d 62 72 61 6e 63 68 0a 20 20 | branch))......compiled-branch... |
| 14b920 | 20 20 20 20 3c 5f 63 6f 64 65 20 74 6f 20 61 70 70 6c 79 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f | ....<_code.to.apply.compiled.pro |
| 14b940 | 63 65 64 75 72 65 20 77 69 74 68 20 67 69 76 65 6e 20 74 61 72 67 65 74 20 61 6e 64 20 61 70 70 | cedure.with.given.target.and.app |
| 14b960 | 72 6f 70 72 69 61 74 65 20 6c 69 6e 6b 61 67 65 5f 3e 0a 20 20 20 20 20 70 72 69 6d 69 74 69 76 | ropriate.linkage_>......primitiv |
| 14b980 | 65 2d 62 72 61 6e 63 68 0a 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 3c 54 41 52 47 45 54 3e 0a | e-branch.......(assign.<TARGET>. |
| 14b9a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 20 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 | ..............(op.apply-primitiv |
| 14b9c0 | 65 2d 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 | e-procedure)...............(reg. |
| 14b9e0 | 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 61 72 67 6c 29 29 0a | proc)...............(reg.argl)). |
| 14ba00 | 20 20 20 20 20 20 3c 4c 49 4e 4b 41 47 45 3e 0a 20 20 20 20 20 61 66 74 65 72 2d 63 61 6c 6c 0a | ......<LINKAGE>......after-call. |
| 14ba20 | 0a 20 20 20 4f 62 73 65 72 76 65 20 74 68 61 74 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 62 72 | ....Observe.that.the.compiled.br |
| 14ba40 | 61 6e 63 68 20 6d 75 73 74 20 73 6b 69 70 20 61 72 6f 75 6e 64 20 74 68 65 20 70 72 69 6d 69 74 | anch.must.skip.around.the.primit |
| 14ba60 | 69 76 65 0a 62 72 61 6e 63 68 2e 20 20 54 68 65 72 65 66 6f 72 65 2c 20 69 66 20 74 68 65 20 6c | ive.branch...Therefore,.if.the.l |
| 14ba80 | 69 6e 6b 61 67 65 20 66 6f 72 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 72 6f 63 65 64 75 72 | inkage.for.the.original.procedur |
| 14baa0 | 65 20 63 61 6c 6c 20 77 61 73 0a 60 6e 65 78 74 27 2c 20 74 68 65 20 63 6f 6d 70 6f 75 6e 64 20 | e.call.was.`next',.the.compound. |
| 14bac0 | 62 72 61 6e 63 68 20 6d 75 73 74 20 75 73 65 20 61 20 6c 69 6e 6b 61 67 65 20 74 68 61 74 20 6a | branch.must.use.a.linkage.that.j |
| 14bae0 | 75 6d 70 73 20 74 6f 20 61 20 6c 61 62 65 6c 0a 74 68 61 74 20 69 73 20 69 6e 73 65 72 74 65 64 | umps.to.a.label.that.is.inserted |
| 14bb00 | 20 61 66 74 65 72 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 62 72 61 6e 63 68 2e 20 20 28 54 | .after.the.primitive.branch...(T |
| 14bb20 | 68 69 73 20 69 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 0a 6c 69 6e 6b 61 67 65 20 75 73 | his.is.similar.to.the.linkage.us |
| 14bb40 | 65 64 20 66 6f 72 20 74 68 65 20 74 72 75 65 20 62 72 61 6e 63 68 20 69 6e 20 60 63 6f 6d 70 69 | ed.for.the.true.branch.in.`compi |
| 14bb60 | 6c 65 2d 69 66 27 2e 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d | le-if'.).......(define.(compile- |
| 14bb80 | 70 72 6f 63 65 64 75 72 65 2d 63 61 6c 6c 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 0a 20 | procedure-call.target.linkage).. |
| 14bba0 | 20 20 20 20 20 20 28 6c 65 74 20 28 28 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 20 28 6d | ......(let.((primitive-branch.(m |
| 14bbc0 | 61 6b 65 2d 6c 61 62 65 6c 20 27 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 29 29 0a 20 20 | ake-label.'primitive-branch))... |
| 14bbe0 | 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 64 2d 62 72 61 6e 63 68 20 28 6d 61 6b | ...........(compiled-branch.(mak |
| 14bc00 | 65 2d 6c 61 62 65 6c 20 27 63 6f 6d 70 69 6c 65 64 2d 62 72 61 6e 63 68 29 29 0a 20 20 20 20 20 | e-label.'compiled-branch))...... |
| 14bc20 | 20 20 20 20 20 20 20 20 28 61 66 74 65 72 2d 63 61 6c 6c 20 28 6d 61 6b 65 2d 6c 61 62 65 6c 20 | ........(after-call.(make-label. |
| 14bc40 | 27 61 66 74 65 72 2d 63 61 6c 6c 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 63 | 'after-call)))..........(let.((c |
| 14bc60 | 6f 6d 70 69 6c 65 64 2d 6c 69 6e 6b 61 67 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ompiled-linkage................. |
| 14bc80 | 28 69 66 20 28 65 71 3f 20 6c 69 6e 6b 61 67 65 20 27 6e 65 78 74 29 20 61 66 74 65 72 2d 63 61 | (if.(eq?.linkage.'next).after-ca |
| 14bca0 | 6c 6c 20 6c 69 6e 6b 61 67 65 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 | ll.linkage)))............(append |
| 14bcc0 | 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 0a 20 20 20 20 20 20 20 20 20 | -instruction-sequences.......... |
| 14bce0 | 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 | ...(make-instruction-sequence.'( |
| 14bd00 | 70 72 6f 63 29 20 27 28 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 60 28 28 74 65 73 74 20 28 | proc).'()..............`((test.( |
| 14bd20 | 6f 70 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 67 20 70 72 | op.primitive-procedure?).(reg.pr |
| 14bd40 | 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 | oc))................(branch.(lab |
| 14bd60 | 65 6c 20 2c 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 29 29 29 29 0a 20 20 20 20 20 20 20 | el.,primitive-branch))))........ |
| 14bd80 | 20 20 20 20 20 28 70 61 72 61 6c 6c 65 6c 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 | .....(parallel-instruction-seque |
| 14bda0 | 6e 63 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 | nces..............(append-instru |
| 14bdc0 | 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 6f | ction-sequences...............co |
| 14bde0 | 6d 70 69 6c 65 64 2d 62 72 61 6e 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d | mpiled-branch...............(com |
| 14be00 | 70 69 6c 65 2d 70 72 6f 63 2d 61 70 70 6c 20 74 61 72 67 65 74 20 63 6f 6d 70 69 6c 65 64 2d 6c | pile-proc-appl.target.compiled-l |
| 14be20 | 69 6e 6b 61 67 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 2d 69 6e | inkage))..............(append-in |
| 14be40 | 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 | struction-sequences............. |
| 14be60 | 20 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..primitive-branch.............. |
| 14be80 | 20 28 65 6e 64 2d 77 69 74 68 2d 6c 69 6e 6b 61 67 65 20 6c 69 6e 6b 61 67 65 0a 20 20 20 20 20 | .(end-with-linkage.linkage...... |
| 14bea0 | 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 | ..........(make-instruction-sequ |
| 14bec0 | 65 6e 63 65 20 27 28 70 72 6f 63 20 61 72 67 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ence.'(proc.argl)............... |
| 14bee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 | ............................(lis |
| 14bf00 | 74 20 74 61 72 67 65 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 28 28 61 73 73 | t.target).................`((ass |
| 14bf20 | 69 67 6e 20 2c 74 61 72 67 65 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ign.,target..................... |
| 14bf40 | 20 20 20 20 20 20 28 6f 70 20 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 | ......(op.apply-primitive-proced |
| 14bf60 | 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ure)...........................( |
| 14bf80 | 72 65 67 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | reg.proc)....................... |
| 14bfa0 | 20 20 20 20 28 72 65 67 20 61 72 67 6c 29 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ....(reg.argl)))))))............ |
| 14bfc0 | 20 61 66 74 65 72 2d 63 61 6c 6c 29 29 29 29 0a 0a 20 20 20 54 68 65 20 70 72 69 6d 69 74 69 76 | .after-call)))).....The.primitiv |
| 14bfe0 | 65 20 61 6e 64 20 63 6f 6d 70 6f 75 6e 64 20 62 72 61 6e 63 68 65 73 2c 20 6c 69 6b 65 20 74 68 | e.and.compound.branches,.like.th |
| 14c000 | 65 20 74 72 75 65 20 61 6e 64 20 66 61 6c 73 65 0a 62 72 61 6e 63 68 65 73 20 69 6e 20 60 63 6f | e.true.and.false.branches.in.`co |
| 14c020 | 6d 70 69 6c 65 2d 69 66 27 2c 20 61 72 65 20 61 70 70 65 6e 64 65 64 20 75 73 69 6e 67 0a 60 70 | mpile-if',.are.appended.using.`p |
| 14c040 | 61 72 61 6c 6c 65 6c 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 27 20 72 | arallel-instruction-sequences'.r |
| 14c060 | 61 74 68 65 72 20 74 68 61 6e 20 74 68 65 20 6f 72 64 69 6e 61 72 79 0a 60 61 70 70 65 6e 64 2d | ather.than.the.ordinary.`append- |
| 14c080 | 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 27 2c 20 62 65 63 61 75 73 65 20 | instruction-sequences',.because. |
| 14c0a0 | 74 68 65 79 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 65 78 65 63 75 74 65 64 0a 73 65 71 75 65 6e | they.will.not.be.executed.sequen |
| 14c0c0 | 74 69 61 6c 6c 79 2e 0a 0a 41 70 70 6c 79 69 6e 67 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 | tially...Applying.compiled.proce |
| 14c0e0 | 64 75 72 65 73 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | dures........................... |
| 14c100 | 2e 2e 0a 0a 54 68 65 20 63 6f 64 65 20 74 68 61 74 20 68 61 6e 64 6c 65 73 20 70 72 6f 63 65 64 | ....The.code.that.handles.proced |
| 14c120 | 75 72 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 69 73 20 74 68 65 20 6d 6f 73 74 20 73 75 62 74 | ure.application.is.the.most.subt |
| 14c140 | 6c 65 20 70 61 72 74 20 6f 66 0a 74 68 65 20 63 6f 6d 70 69 6c 65 72 2c 20 65 76 65 6e 20 74 68 | le.part.of.the.compiler,.even.th |
| 14c160 | 6f 75 67 68 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 69 | ough.the.instruction.sequences.i |
| 14c180 | 74 20 67 65 6e 65 72 61 74 65 73 20 61 72 65 0a 76 65 72 79 20 73 68 6f 72 74 2e 20 20 41 20 63 | t.generates.are.very.short...A.c |
| 14c1a0 | 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 20 28 61 73 20 63 6f 6e 73 74 72 75 63 74 65 | ompiled.procedure.(as.constructe |
| 14c1c0 | 64 20 62 79 20 60 63 6f 6d 70 69 6c 65 2d 6c 61 6d 62 64 61 27 29 0a 68 61 73 20 61 6e 20 65 6e | d.by.`compile-lambda').has.an.en |
| 14c1e0 | 74 72 79 20 70 6f 69 6e 74 2c 20 77 68 69 63 68 20 69 73 20 61 20 6c 61 62 65 6c 20 74 68 61 74 | try.point,.which.is.a.label.that |
| 14c200 | 20 64 65 73 69 67 6e 61 74 65 73 20 77 68 65 72 65 20 74 68 65 20 63 6f 64 65 20 66 6f 72 0a 74 | .designates.where.the.code.for.t |
| 14c220 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 73 74 61 72 74 73 2e 20 20 54 68 65 20 63 6f 64 65 20 61 | he.procedure.starts...The.code.a |
| 14c240 | 74 20 74 68 69 73 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 63 6f 6d 70 75 74 65 73 20 61 20 72 65 | t.this.entry.point.computes.a.re |
| 14c260 | 73 75 6c 74 0a 69 6e 20 60 76 61 6c 27 20 61 6e 64 20 72 65 74 75 72 6e 73 20 62 79 20 65 78 65 | sult.in.`val'.and.returns.by.exe |
| 14c280 | 63 75 74 69 6e 67 20 74 68 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 60 28 67 6f 74 6f 20 28 72 | cuting.the.instruction.`(goto.(r |
| 14c2a0 | 65 67 0a 63 6f 6e 74 69 6e 75 65 29 29 27 2e 20 20 54 68 75 73 2c 20 77 65 20 6d 69 67 68 74 20 | eg.continue))'...Thus,.we.might. |
| 14c2c0 | 65 78 70 65 63 74 20 74 68 65 20 63 6f 64 65 20 66 6f 72 20 61 20 63 6f 6d 70 69 6c 65 64 2d 70 | expect.the.code.for.a.compiled-p |
| 14c2e0 | 72 6f 63 65 64 75 72 65 0a 61 70 70 6c 69 63 61 74 69 6f 6e 20 28 74 6f 20 62 65 20 67 65 6e 65 | rocedure.application.(to.be.gene |
| 14c300 | 72 61 74 65 64 20 62 79 20 60 63 6f 6d 70 69 6c 65 2d 70 72 6f 63 2d 61 70 70 6c 27 29 20 77 69 | rated.by.`compile-proc-appl').wi |
| 14c320 | 74 68 20 61 20 67 69 76 65 6e 0a 74 61 72 67 65 74 20 61 6e 64 20 6c 69 6e 6b 61 67 65 20 74 6f | th.a.given.target.and.linkage.to |
| 14c340 | 20 6c 6f 6f 6b 20 6c 69 6b 65 20 74 68 69 73 20 69 66 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 69 | .look.like.this.if.the.linkage.i |
| 14c360 | 73 20 61 20 6c 61 62 65 6c 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 | s.a.label.......(assign.continue |
| 14c380 | 20 28 6c 61 62 65 6c 20 70 72 6f 63 2d 72 65 74 75 72 6e 29 29 0a 20 20 20 20 20 20 28 61 73 73 | .(label.proc-return)).......(ass |
| 14c3a0 | 69 67 6e 20 76 61 6c 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 | ign.val.(op.compiled-procedure-e |
| 14c3c0 | 6e 74 72 79 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 | ntry).(reg.proc)).......(goto.(r |
| 14c3e0 | 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 70 72 6f 63 2d 72 65 74 75 72 6e 0a 20 20 20 20 20 20 | eg.val))......proc-return....... |
| 14c400 | 28 61 73 73 69 67 6e 20 3c 54 41 52 47 45 54 3e 20 28 72 65 67 20 76 61 6c 29 29 20 20 20 3b 20 | (assign.<TARGET>.(reg.val))...;. |
| 14c420 | 69 6e 63 6c 75 64 65 64 20 69 66 20 74 61 72 67 65 74 20 69 73 20 6e 6f 74 20 60 76 61 6c 27 0a | included.if.target.is.not.`val'. |
| 14c440 | 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 3c 4c 49 4e 4b 41 47 45 3e 29 29 20 20 | ......(goto.(label.<LINKAGE>)).. |
| 14c460 | 20 3b 20 6c 69 6e 6b 61 67 65 20 63 6f 64 65 0a 0a 6f 72 20 6c 69 6b 65 20 74 68 69 73 20 69 66 | .;.linkage.code..or.like.this.if |
| 14c480 | 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 69 73 20 60 72 65 74 75 72 6e 27 2e 0a 0a 20 20 20 20 20 | .the.linkage.is.`return'........ |
| 14c4a0 | 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f | (save.continue).......(assign.co |
| 14c4c0 | 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 70 72 6f 63 2d 72 65 74 75 72 6e 29 29 0a 20 20 20 20 | ntinue.(label.proc-return))..... |
| 14c4e0 | 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 | ..(assign.val.(op.compiled-proce |
| 14c500 | 64 75 72 65 2d 65 6e 74 72 79 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 28 67 | dure-entry).(reg.proc)).......(g |
| 14c520 | 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 70 72 6f 63 2d 72 65 74 75 72 6e 0a | oto.(reg.val))......proc-return. |
| 14c540 | 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 3c 54 41 52 47 45 54 3e 20 28 72 65 67 20 76 61 6c 29 | ......(assign.<TARGET>.(reg.val) |
| 14c560 | 29 20 20 20 3b 20 69 6e 63 6c 75 64 65 64 20 69 66 20 74 61 72 67 65 74 20 69 73 20 6e 6f 74 20 | )...;.included.if.target.is.not. |
| 14c580 | 60 76 61 6c 27 0a 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 | `val'.......(restore.continue).. |
| 14c5a0 | 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 20 20 20 3b 20 6c | .....(goto.(reg.continue))...;.l |
| 14c5c0 | 69 6e 6b 61 67 65 20 63 6f 64 65 0a 0a 20 20 20 54 68 69 73 20 63 6f 64 65 20 73 65 74 73 20 75 | inkage.code.....This.code.sets.u |
| 14c5e0 | 70 20 60 63 6f 6e 74 69 6e 75 65 27 20 73 6f 20 74 68 61 74 20 74 68 65 20 70 72 6f 63 65 64 75 | p.`continue'.so.that.the.procedu |
| 14c600 | 72 65 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 6f 20 61 0a 6c 61 62 65 6c 20 60 70 72 6f 63 2d | re.will.return.to.a.label.`proc- |
| 14c620 | 72 65 74 75 72 6e 27 20 61 6e 64 20 6a 75 6d 70 73 20 74 6f 20 74 68 65 20 70 72 6f 63 65 64 75 | return'.and.jumps.to.the.procedu |
| 14c640 | 72 65 27 73 20 65 6e 74 72 79 20 70 6f 69 6e 74 2e 20 20 54 68 65 20 63 6f 64 65 0a 61 74 20 60 | re's.entry.point...The.code.at.` |
| 14c660 | 70 72 6f 63 2d 72 65 74 75 72 6e 27 20 74 72 61 6e 73 66 65 72 73 20 74 68 65 20 70 72 6f 63 65 | proc-return'.transfers.the.proce |
| 14c680 | 64 75 72 65 27 73 20 72 65 73 75 6c 74 20 66 72 6f 6d 20 60 76 61 6c 27 20 74 6f 20 74 68 65 0a | dure's.result.from.`val'.to.the. |
| 14c6a0 | 74 61 72 67 65 74 20 72 65 67 69 73 74 65 72 20 28 69 66 20 6e 65 63 65 73 73 61 72 79 29 20 61 | target.register.(if.necessary).a |
| 14c6c0 | 6e 64 20 74 68 65 6e 20 6a 75 6d 70 73 20 74 6f 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 20 73 70 | nd.then.jumps.to.the.location.sp |
| 14c6e0 | 65 63 69 66 69 65 64 0a 62 79 20 74 68 65 20 6c 69 6e 6b 61 67 65 2e 20 20 28 54 68 65 20 6c 69 | ecified.by.the.linkage...(The.li |
| 14c700 | 6e 6b 61 67 65 20 69 73 20 61 6c 77 61 79 73 20 60 72 65 74 75 72 6e 27 20 6f 72 20 61 20 6c 61 | nkage.is.always.`return'.or.a.la |
| 14c720 | 62 65 6c 2c 20 62 65 63 61 75 73 65 0a 60 63 6f 6d 70 69 6c 65 2d 70 72 6f 63 65 64 75 72 65 2d | bel,.because.`compile-procedure- |
| 14c740 | 63 61 6c 6c 27 20 72 65 70 6c 61 63 65 73 20 61 20 60 6e 65 78 74 27 20 6c 69 6e 6b 61 67 65 20 | call'.replaces.a.`next'.linkage. |
| 14c760 | 66 6f 72 20 74 68 65 0a 63 6f 6d 70 6f 75 6e 64 2d 70 72 6f 63 65 64 75 72 65 20 62 72 61 6e 63 | for.the.compound-procedure.branc |
| 14c780 | 68 20 62 79 20 61 6e 20 60 61 66 74 65 72 2d 63 61 6c 6c 27 20 6c 61 62 65 6c 2e 29 0a 0a 20 20 | h.by.an.`after-call'.label.).... |
| 14c7a0 | 20 49 6e 20 66 61 63 74 2c 20 69 66 20 74 68 65 20 74 61 72 67 65 74 20 69 73 20 6e 6f 74 20 60 | .In.fact,.if.the.target.is.not.` |
| 14c7c0 | 76 61 6c 27 2c 20 74 68 61 74 20 69 73 20 65 78 61 63 74 6c 79 20 74 68 65 20 63 6f 64 65 20 6f | val',.that.is.exactly.the.code.o |
| 14c7e0 | 75 72 0a 63 6f 6d 70 69 6c 65 72 20 77 69 6c 6c 20 67 65 6e 65 72 61 74 65 2e 28 31 29 20 20 55 | ur.compiler.will.generate.(1)..U |
| 14c800 | 73 75 61 6c 6c 79 2c 20 68 6f 77 65 76 65 72 2c 20 74 68 65 20 74 61 72 67 65 74 20 69 73 20 60 | sually,.however,.the.target.is.` |
| 14c820 | 76 61 6c 27 20 28 74 68 65 0a 6f 6e 6c 79 20 74 69 6d 65 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 | val'.(the.only.time.the.compiler |
| 14c840 | 20 73 70 65 63 69 66 69 65 73 20 61 20 64 69 66 66 65 72 65 6e 74 20 72 65 67 69 73 74 65 72 20 | .specifies.a.different.register. |
| 14c860 | 69 73 20 77 68 65 6e 20 74 61 72 67 65 74 69 6e 67 0a 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e | is.when.targeting.the.evaluation |
| 14c880 | 20 6f 66 20 61 6e 20 6f 70 65 72 61 74 6f 72 20 74 6f 20 60 70 72 6f 63 27 29 2c 20 73 6f 20 74 | .of.an.operator.to.`proc'),.so.t |
| 14c8a0 | 68 65 20 70 72 6f 63 65 64 75 72 65 20 72 65 73 75 6c 74 20 69 73 0a 70 75 74 20 64 69 72 65 63 | he.procedure.result.is.put.direc |
| 14c8c0 | 74 6c 79 20 69 6e 74 6f 20 74 68 65 20 74 61 72 67 65 74 20 72 65 67 69 73 74 65 72 20 61 6e 64 | tly.into.the.target.register.and |
| 14c8e0 | 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6e 65 65 64 20 74 6f 20 72 65 74 75 72 6e 20 74 6f 0a 61 | .there.is.no.need.to.return.to.a |
| 14c900 | 20 73 70 65 63 69 61 6c 20 6c 6f 63 61 74 69 6f 6e 20 74 68 61 74 20 63 6f 70 69 65 73 20 69 74 | .special.location.that.copies.it |
| 14c920 | 2e 20 20 49 6e 73 74 65 61 64 2c 20 77 65 20 73 69 6d 70 6c 69 66 79 20 74 68 65 20 63 6f 64 65 | ...Instead,.we.simplify.the.code |
| 14c940 | 20 62 79 0a 73 65 74 74 69 6e 67 20 75 70 20 60 63 6f 6e 74 69 6e 75 65 27 20 73 6f 20 74 68 61 | .by.setting.up.`continue'.so.tha |
| 14c960 | 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 77 69 6c 6c 20 22 72 65 74 75 72 6e 22 20 64 69 | t.the.procedure.will."return".di |
| 14c980 | 72 65 63 74 6c 79 20 74 6f 0a 74 68 65 20 70 6c 61 63 65 20 73 70 65 63 69 66 69 65 64 20 62 79 | rectly.to.the.place.specified.by |
| 14c9a0 | 20 74 68 65 20 63 61 6c 6c 65 72 27 73 20 6c 69 6e 6b 61 67 65 3a 0a 0a 20 20 20 20 20 3c 5f 73 | .the.caller's.linkage:.......<_s |
| 14c9c0 | 65 74 20 75 70 20 60 63 6f 6e 74 69 6e 75 65 27 20 66 6f 72 20 6c 69 6e 6b 61 67 65 5f 3e 0a 20 | et.up.`continue'.for.linkage_>.. |
| 14c9e0 | 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f | ....(assign.val.(op.compiled-pro |
| 14ca00 | 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 28 | cedure-entry).(reg.proc))......( |
| 14ca20 | 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 0a 0a 20 20 20 49 66 20 74 68 65 20 6c 69 6e 6b 61 | goto.(reg.val)).....If.the.linka |
| 14ca40 | 67 65 20 69 73 20 61 20 6c 61 62 65 6c 2c 20 77 65 20 73 65 74 20 75 70 20 60 63 6f 6e 74 69 6e | ge.is.a.label,.we.set.up.`contin |
| 14ca60 | 75 65 27 20 73 6f 20 74 68 61 74 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 77 69 6c 6c 20 72 | ue'.so.that.the.procedure.will.r |
| 14ca80 | 65 74 75 72 6e 20 74 6f 20 74 68 61 74 20 6c 61 62 65 6c 2e 20 20 28 54 68 61 74 20 69 73 2c 20 | eturn.to.that.label...(That.is,. |
| 14caa0 | 74 68 65 20 60 28 67 6f 74 6f 20 28 72 65 67 0a 63 6f 6e 74 69 6e 75 65 29 29 27 20 74 68 65 20 | the.`(goto.(reg.continue))'.the. |
| 14cac0 | 70 72 6f 63 65 64 75 72 65 20 65 6e 64 73 20 77 69 74 68 20 62 65 63 6f 6d 65 73 20 65 71 75 69 | procedure.ends.with.becomes.equi |
| 14cae0 | 76 61 6c 65 6e 74 20 74 6f 20 74 68 65 20 60 28 67 6f 74 6f 0a 28 6c 61 62 65 6c 20 3c 4c 49 4e | valent.to.the.`(goto.(label.<LIN |
| 14cb00 | 4b 41 47 45 3e 29 29 27 20 61 74 20 60 70 72 6f 63 2d 72 65 74 75 72 6e 27 20 61 62 6f 76 65 2e | KAGE>))'.at.`proc-return'.above. |
| 14cb20 | 29 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 | ).......(assign.continue.(label. |
| 14cb40 | 3c 4c 49 4e 4b 41 47 45 3e 29 29 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 | <LINKAGE>))......(assign.val.(op |
| 14cb60 | 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 28 72 65 67 20 | .compiled-procedure-entry).(reg. |
| 14cb80 | 70 72 6f 63 29 29 0a 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 0a 0a 20 20 | proc))......(goto.(reg.val)).... |
| 14cba0 | 20 49 66 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 69 73 20 60 72 65 74 75 72 6e 27 2c 20 77 65 20 | .If.the.linkage.is.`return',.we. |
| 14cbc0 | 64 6f 6e 27 74 20 6e 65 65 64 20 74 6f 20 73 65 74 20 75 70 20 60 63 6f 6e 74 69 6e 75 65 27 20 | don't.need.to.set.up.`continue'. |
| 14cbe0 | 61 74 0a 61 6c 6c 3a 20 49 74 20 61 6c 72 65 61 64 79 20 68 6f 6c 64 73 20 74 68 65 20 64 65 73 | at.all:.It.already.holds.the.des |
| 14cc00 | 69 72 65 64 20 6c 6f 63 61 74 69 6f 6e 2e 20 20 28 54 68 61 74 20 69 73 2c 20 74 68 65 20 60 28 | ired.location...(That.is,.the.`( |
| 14cc20 | 67 6f 74 6f 20 28 72 65 67 0a 63 6f 6e 74 69 6e 75 65 29 29 27 20 74 68 65 20 70 72 6f 63 65 64 | goto.(reg.continue))'.the.proced |
| 14cc40 | 75 72 65 20 65 6e 64 73 20 77 69 74 68 20 67 6f 65 73 20 64 69 72 65 63 74 6c 79 20 74 6f 20 74 | ure.ends.with.goes.directly.to.t |
| 14cc60 | 68 65 20 70 6c 61 63 65 20 77 68 65 72 65 20 74 68 65 0a 60 28 67 6f 74 6f 20 28 72 65 67 20 63 | he.place.where.the.`(goto.(reg.c |
| 14cc80 | 6f 6e 74 69 6e 75 65 29 29 27 20 61 74 20 60 70 72 6f 63 2d 72 65 74 75 72 6e 27 20 77 6f 75 6c | ontinue))'.at.`proc-return'.woul |
| 14cca0 | 64 20 68 61 76 65 20 67 6f 6e 65 2e 29 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 | d.have.gone.).......(assign.val. |
| 14ccc0 | 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 28 72 | (op.compiled-procedure-entry).(r |
| 14cce0 | 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 0a | eg.proc))......(goto.(reg.val)). |
| 14cd00 | 0a 20 20 20 57 69 74 68 20 74 68 69 73 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 | ....With.this.implementation.of. |
| 14cd20 | 74 68 65 20 60 72 65 74 75 72 6e 27 20 6c 69 6e 6b 61 67 65 2c 20 74 68 65 20 63 6f 6d 70 69 6c | the.`return'.linkage,.the.compil |
| 14cd40 | 65 72 0a 67 65 6e 65 72 61 74 65 73 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 20 63 6f 64 65 | er.generates.tail-recursive.code |
| 14cd60 | 2e 20 20 43 61 6c 6c 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 20 61 73 20 74 68 65 20 66 69 | ...Calling.a.procedure.as.the.fi |
| 14cd80 | 6e 61 6c 20 73 74 65 70 0a 69 6e 20 61 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 20 64 6f 65 | nal.step.in.a.procedure.body.doe |
| 14cda0 | 73 20 61 20 64 69 72 65 63 74 20 74 72 61 6e 73 66 65 72 2c 20 77 69 74 68 6f 75 74 20 73 61 76 | s.a.direct.transfer,.without.sav |
| 14cdc0 | 69 6e 67 20 61 6e 79 0a 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20 73 74 61 63 6b | ing.any.information.on.the.stack |
| 14cde0 | 2e 0a 0a 20 20 20 53 75 70 70 6f 73 65 20 69 6e 73 74 65 61 64 20 74 68 61 74 20 77 65 20 68 61 | ......Suppose.instead.that.we.ha |
| 14ce00 | 64 20 68 61 6e 64 6c 65 64 20 74 68 65 20 63 61 73 65 20 6f 66 20 61 20 70 72 6f 63 65 64 75 72 | d.handled.the.case.of.a.procedur |
| 14ce20 | 65 20 63 61 6c 6c 0a 77 69 74 68 20 61 20 6c 69 6e 6b 61 67 65 20 6f 66 20 60 72 65 74 75 72 6e | e.call.with.a.linkage.of.`return |
| 14ce40 | 27 20 61 6e 64 20 61 20 74 61 72 67 65 74 20 6f 66 20 60 76 61 6c 27 20 61 73 20 73 68 6f 77 6e | '.and.a.target.of.`val'.as.shown |
| 14ce60 | 20 61 62 6f 76 65 20 66 6f 72 20 61 0a 6e 6f 6e 2d 60 76 61 6c 27 20 74 61 72 67 65 74 2e 20 20 | .above.for.a.non-`val'.target... |
| 14ce80 | 54 68 69 73 20 77 6f 75 6c 64 20 64 65 73 74 72 6f 79 20 74 61 69 6c 20 72 65 63 75 72 73 69 6f | This.would.destroy.tail.recursio |
| 14cea0 | 6e 2e 20 20 4f 75 72 20 73 79 73 74 65 6d 20 77 6f 75 6c 64 0a 73 74 69 6c 6c 20 67 69 76 65 20 | n...Our.system.would.still.give. |
| 14cec0 | 74 68 65 20 73 61 6d 65 20 76 61 6c 75 65 20 66 6f 72 20 61 6e 79 20 65 78 70 72 65 73 73 69 6f | the.same.value.for.any.expressio |
| 14cee0 | 6e 2e 20 20 42 75 74 20 65 61 63 68 20 74 69 6d 65 20 77 65 20 63 61 6c 6c 65 64 0a 61 20 70 72 | n...But.each.time.we.called.a.pr |
| 14cf00 | 6f 63 65 64 75 72 65 2c 20 77 65 20 77 6f 75 6c 64 20 73 61 76 65 20 60 63 6f 6e 74 69 6e 75 65 | ocedure,.we.would.save.`continue |
| 14cf20 | 27 20 61 6e 64 20 72 65 74 75 72 6e 20 61 66 74 65 72 20 74 68 65 20 63 61 6c 6c 20 74 6f 20 75 | '.and.return.after.the.call.to.u |
| 14cf40 | 6e 64 6f 0a 74 68 65 20 28 75 73 65 6c 65 73 73 29 20 73 61 76 65 2e 20 20 54 68 65 73 65 20 65 | ndo.the.(useless).save...These.e |
| 14cf60 | 78 74 72 61 20 73 61 76 65 73 20 77 6f 75 6c 64 20 61 63 63 75 6d 75 6c 61 74 65 20 64 75 72 69 | xtra.saves.would.accumulate.duri |
| 14cf80 | 6e 67 20 61 20 6e 65 73 74 0a 6f 66 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 73 2e 28 32 29 | ng.a.nest.of.procedure.calls.(2) |
| 14cfa0 | 0a 0a 20 20 20 60 43 6f 6d 70 69 6c 65 2d 70 72 6f 63 2d 61 70 70 6c 27 20 67 65 6e 65 72 61 74 | .....`Compile-proc-appl'.generat |
| 14cfc0 | 65 73 20 74 68 65 20 61 62 6f 76 65 20 70 72 6f 63 65 64 75 72 65 2d 61 70 70 6c 69 63 61 74 69 | es.the.above.procedure-applicati |
| 14cfe0 | 6f 6e 20 63 6f 64 65 20 62 79 0a 63 6f 6e 73 69 64 65 72 69 6e 67 20 66 6f 75 72 20 63 61 73 65 | on.code.by.considering.four.case |
| 14d000 | 73 2c 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 77 68 65 74 68 65 72 20 74 68 65 20 74 61 72 67 | s,.depending.on.whether.the.targ |
| 14d020 | 65 74 20 66 6f 72 20 74 68 65 20 63 61 6c 6c 20 69 73 0a 60 76 61 6c 27 20 61 6e 64 20 77 68 65 | et.for.the.call.is.`val'.and.whe |
| 14d040 | 74 68 65 72 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 69 73 20 60 72 65 74 75 72 6e 27 2e 20 20 4f | ther.the.linkage.is.`return'...O |
| 14d060 | 62 73 65 72 76 65 20 74 68 61 74 20 74 68 65 0a 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 | bserve.that.the.instruction.sequ |
| 14d080 | 65 6e 63 65 73 20 61 72 65 20 64 65 63 6c 61 72 65 64 20 74 6f 20 6d 6f 64 69 66 79 20 61 6c 6c | ences.are.declared.to.modify.all |
| 14d0a0 | 20 74 68 65 20 72 65 67 69 73 74 65 72 73 2c 20 73 69 6e 63 65 0a 65 78 65 63 75 74 69 6e 67 20 | .the.registers,.since.executing. |
| 14d0c0 | 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 20 63 61 6e 20 63 68 61 6e 67 65 20 74 68 | the.procedure.body.can.change.th |
| 14d0e0 | 65 20 72 65 67 69 73 74 65 72 73 20 69 6e 20 61 72 62 69 74 72 61 72 79 0a 77 61 79 73 2e 28 33 | e.registers.in.arbitrary.ways.(3 |
| 14d100 | 29 20 41 6c 73 6f 20 6e 6f 74 65 20 74 68 61 74 20 74 68 65 20 63 6f 64 65 20 73 65 71 75 65 6e | ).Also.note.that.the.code.sequen |
| 14d120 | 63 65 20 66 6f 72 20 74 68 65 20 63 61 73 65 20 77 69 74 68 20 74 61 72 67 65 74 0a 60 76 61 6c | ce.for.the.case.with.target.`val |
| 14d140 | 27 20 61 6e 64 20 6c 69 6e 6b 61 67 65 20 60 72 65 74 75 72 6e 27 20 69 73 20 64 65 63 6c 61 72 | '.and.linkage.`return'.is.declar |
| 14d160 | 65 64 20 74 6f 20 6e 65 65 64 20 60 63 6f 6e 74 69 6e 75 65 27 3a 20 45 76 65 6e 20 74 68 6f 75 | ed.to.need.`continue':.Even.thou |
| 14d180 | 67 68 0a 60 63 6f 6e 74 69 6e 75 65 27 20 69 73 20 6e 6f 74 20 65 78 70 6c 69 63 69 74 6c 79 20 | gh.`continue'.is.not.explicitly. |
| 14d1a0 | 75 73 65 64 20 69 6e 20 74 68 65 20 74 77 6f 2d 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 | used.in.the.two-instruction.sequ |
| 14d1c0 | 65 6e 63 65 2c 20 77 65 0a 6d 75 73 74 20 62 65 20 73 75 72 65 20 74 68 61 74 20 60 63 6f 6e 74 | ence,.we.must.be.sure.that.`cont |
| 14d1e0 | 69 6e 75 65 27 20 77 69 6c 6c 20 68 61 76 65 20 74 68 65 20 63 6f 72 72 65 63 74 20 76 61 6c 75 | inue'.will.have.the.correct.valu |
| 14d200 | 65 20 77 68 65 6e 20 77 65 20 65 6e 74 65 72 0a 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f | e.when.we.enter.the.compiled.pro |
| 14d220 | 63 65 64 75 72 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d 70 | cedure........(define.(compile-p |
| 14d240 | 72 6f 63 2d 61 70 70 6c 20 74 61 72 67 65 74 20 6c 69 6e 6b 61 67 65 29 0a 20 20 20 20 20 20 20 | roc-appl.target.linkage)........ |
| 14d260 | 28 63 6f 6e 64 20 28 28 61 6e 64 20 28 65 71 3f 20 74 61 72 67 65 74 20 27 76 61 6c 29 20 28 6e | (cond.((and.(eq?.target.'val).(n |
| 14d280 | 6f 74 20 28 65 71 3f 20 6c 69 6e 6b 61 67 65 20 27 72 65 74 75 72 6e 29 29 29 0a 20 20 20 20 20 | ot.(eq?.linkage.'return)))...... |
| 14d2a0 | 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 | .........(make-instruction-seque |
| 14d2c0 | 6e 63 65 20 27 28 70 72 6f 63 29 20 61 6c 6c 2d 72 65 67 73 0a 20 20 20 20 20 20 20 20 20 20 20 | nce.'(proc).all-regs............ |
| 14d2e0 | 20 20 20 20 20 60 28 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 2c | .....`((assign.continue.(label., |
| 14d300 | 6c 69 6e 6b 61 67 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 | linkage))...................(ass |
| 14d320 | 69 67 6e 20 76 61 6c 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 | ign.val.(op.compiled-procedure-e |
| 14d340 | 6e 74 72 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ntry)........................... |
| 14d360 | 20 20 20 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....(reg.proc))................. |
| 14d380 | 20 20 28 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 | ..(goto.(reg.val)))))........... |
| 14d3a0 | 20 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 65 71 3f 20 74 61 72 67 65 74 20 27 76 61 6c 29 29 | ...((and.(not.(eq?.target.'val)) |
| 14d3c0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6e 6f 74 20 28 65 71 3f 20 6c 69 | ....................(not.(eq?.li |
| 14d3e0 | 6e 6b 61 67 65 20 27 72 65 74 75 72 6e 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | nkage.'return)))...............( |
| 14d400 | 6c 65 74 20 28 28 70 72 6f 63 2d 72 65 74 75 72 6e 20 28 6d 61 6b 65 2d 6c 61 62 65 6c 20 27 70 | let.((proc-return.(make-label.'p |
| 14d420 | 72 6f 63 2d 72 65 74 75 72 6e 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d | roc-return))).................(m |
| 14d440 | 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 70 72 6f 63 29 | ake-instruction-sequence.'(proc) |
| 14d460 | 20 61 6c 6c 2d 72 65 67 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 28 28 61 73 | .all-regs..................`((as |
| 14d480 | 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 2c 70 72 6f 63 2d 72 65 74 75 72 | sign.continue.(label.,proc-retur |
| 14d4a0 | 6e 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 | n))....................(assign.v |
| 14d4c0 | 61 6c 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 | al.(op.compiled-procedure-entry) |
| 14d4e0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 14d500 | 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | (reg.proc))....................( |
| 14d520 | 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | goto.(reg.val))................. |
| 14d540 | 20 20 20 2c 70 72 6f 63 2d 72 65 74 75 72 6e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...,proc-return................. |
| 14d560 | 20 20 20 28 61 73 73 69 67 6e 20 2c 74 61 72 67 65 74 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 | ...(assign.,target.(reg.val))... |
| 14d580 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 2c 6c | .................(goto.(label.,l |
| 14d5a0 | 69 6e 6b 61 67 65 29 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 61 6e 64 20 | inkage))))))..............((and. |
| 14d5c0 | 28 65 71 3f 20 74 61 72 67 65 74 20 27 76 61 6c 29 20 28 65 71 3f 20 6c 69 6e 6b 61 67 65 20 27 | (eq?.target.'val).(eq?.linkage.' |
| 14d5e0 | 72 65 74 75 72 6e 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 | return))...............(make-ins |
| 14d600 | 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 27 28 70 72 6f 63 20 63 6f 6e 74 69 6e 75 | truction-sequence.'(proc.continu |
| 14d620 | 65 29 20 61 6c 6c 2d 72 65 67 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 28 28 61 73 | e).all-regs................'((as |
| 14d640 | 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d | sign.val.(op.compiled-procedure- |
| 14d660 | 65 6e 74 72 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | entry).......................... |
| 14d680 | 20 20 20 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ....(reg.proc))................. |
| 14d6a0 | 20 28 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | .(goto.(reg.val)))))............ |
| 14d6c0 | 20 20 28 28 61 6e 64 20 28 6e 6f 74 20 28 65 71 3f 20 74 61 72 67 65 74 20 27 76 61 6c 29 29 20 | ..((and.(not.(eq?.target.'val)). |
| 14d6e0 | 28 65 71 3f 20 6c 69 6e 6b 61 67 65 20 27 72 65 74 75 72 6e 29 29 0a 20 20 20 20 20 20 20 20 20 | (eq?.linkage.'return)).......... |
| 14d700 | 20 20 20 20 20 28 65 72 72 6f 72 20 22 72 65 74 75 72 6e 20 6c 69 6e 6b 61 67 65 2c 20 74 61 72 | .....(error."return.linkage,.tar |
| 14d720 | 67 65 74 20 6e 6f 74 20 76 61 6c 20 2d 2d 20 43 4f 4d 50 49 4c 45 22 0a 20 20 20 20 20 20 20 20 | get.not.val.--.COMPILE"......... |
| 14d740 | 20 20 20 20 20 20 20 20 20 20 20 20 20 74 61 72 67 65 74 29 29 29 29 0a 0a 20 20 20 2d 2d 2d 2d | .............target)))).....---- |
| 14d760 | 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 | ------.Footnotes.----------..... |
| 14d780 | 28 31 29 20 41 63 74 75 61 6c 6c 79 2c 20 77 65 20 73 69 67 6e 61 6c 20 61 6e 20 65 72 72 6f 72 | (1).Actually,.we.signal.an.error |
| 14d7a0 | 20 77 68 65 6e 20 74 68 65 20 74 61 72 67 65 74 20 69 73 20 6e 6f 74 20 60 76 61 6c 27 20 61 6e | .when.the.target.is.not.`val'.an |
| 14d7c0 | 64 0a 74 68 65 20 6c 69 6e 6b 61 67 65 20 69 73 20 60 72 65 74 75 72 6e 27 2c 20 73 69 6e 63 65 | d.the.linkage.is.`return',.since |
| 14d7e0 | 20 74 68 65 20 6f 6e 6c 79 20 70 6c 61 63 65 20 77 65 20 72 65 71 75 65 73 74 20 60 72 65 74 75 | .the.only.place.we.request.`retu |
| 14d800 | 72 6e 27 0a 6c 69 6e 6b 61 67 65 73 20 69 73 20 69 6e 20 63 6f 6d 70 69 6c 69 6e 67 20 70 72 6f | rn'.linkages.is.in.compiling.pro |
| 14d820 | 63 65 64 75 72 65 73 2c 20 61 6e 64 20 6f 75 72 20 63 6f 6e 76 65 6e 74 69 6f 6e 20 69 73 20 74 | cedures,.and.our.convention.is.t |
| 14d840 | 68 61 74 0a 70 72 6f 63 65 64 75 72 65 73 20 72 65 74 75 72 6e 20 74 68 65 69 72 20 76 61 6c 75 | hat.procedures.return.their.valu |
| 14d860 | 65 73 20 69 6e 20 60 76 61 6c 27 2e 0a 0a 20 20 20 28 32 29 20 4d 61 6b 69 6e 67 20 61 20 63 6f | es.in.`val'......(2).Making.a.co |
| 14d880 | 6d 70 69 6c 65 72 20 67 65 6e 65 72 61 74 65 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 20 63 | mpiler.generate.tail-recursive.c |
| 14d8a0 | 6f 64 65 20 6d 69 67 68 74 20 73 65 65 6d 20 6c 69 6b 65 20 61 0a 73 74 72 61 69 67 68 74 66 6f | ode.might.seem.like.a.straightfo |
| 14d8c0 | 72 77 61 72 64 20 69 64 65 61 2e 20 20 42 75 74 20 6d 6f 73 74 20 63 6f 6d 70 69 6c 65 72 73 20 | rward.idea...But.most.compilers. |
| 14d8e0 | 66 6f 72 20 63 6f 6d 6d 6f 6e 20 6c 61 6e 67 75 61 67 65 73 2c 0a 69 6e 63 6c 75 64 69 6e 67 20 | for.common.languages,.including. |
| 14d900 | 43 20 61 6e 64 20 50 61 73 63 61 6c 2c 20 64 6f 20 6e 6f 74 20 64 6f 20 74 68 69 73 2c 20 61 6e | C.and.Pascal,.do.not.do.this,.an |
| 14d920 | 64 20 74 68 65 72 65 66 6f 72 65 20 74 68 65 73 65 20 6c 61 6e 67 75 61 67 65 73 0a 63 61 6e 6e | d.therefore.these.languages.cann |
| 14d940 | 6f 74 20 72 65 70 72 65 73 65 6e 74 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 65 73 | ot.represent.iterative.processes |
| 14d960 | 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 20 61 6c 6f 6e | .in.terms.of.procedure.call.alon |
| 14d980 | 65 2e 0a 54 68 65 20 64 69 66 66 69 63 75 6c 74 79 20 77 69 74 68 20 74 61 69 6c 20 72 65 63 75 | e..The.difficulty.with.tail.recu |
| 14d9a0 | 72 73 69 6f 6e 20 69 6e 20 74 68 65 73 65 20 6c 61 6e 67 75 61 67 65 73 20 69 73 20 74 68 61 74 | rsion.in.these.languages.is.that |
| 14d9c0 | 20 74 68 65 69 72 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 75 73 65 20 74 68 65 20 73 | .their.implementations.use.the.s |
| 14d9e0 | 74 61 63 6b 20 74 6f 20 73 74 6f 72 65 20 70 72 6f 63 65 64 75 72 65 20 61 72 67 75 6d 65 6e 74 | tack.to.store.procedure.argument |
| 14da00 | 73 20 61 6e 64 20 6c 6f 63 61 6c 0a 76 61 72 69 61 62 6c 65 73 20 61 73 20 77 65 6c 6c 20 61 73 | s.and.local.variables.as.well.as |
| 14da20 | 20 72 65 74 75 72 6e 20 61 64 64 72 65 73 73 65 73 2e 20 20 54 68 65 20 53 63 68 65 6d 65 20 69 | .return.addresses...The.Scheme.i |
| 14da40 | 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 0a 64 65 73 63 72 69 62 65 64 20 69 6e 20 74 68 69 73 | mplementations.described.in.this |
| 14da60 | 20 62 6f 6f 6b 20 73 74 6f 72 65 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 64 20 76 61 72 69 61 62 | .book.store.arguments.and.variab |
| 14da80 | 6c 65 73 20 69 6e 20 6d 65 6d 6f 72 79 20 74 6f 20 62 65 0a 67 61 72 62 61 67 65 2d 63 6f 6c 6c | les.in.memory.to.be.garbage-coll |
| 14daa0 | 65 63 74 65 64 2e 20 20 54 68 65 20 72 65 61 73 6f 6e 20 66 6f 72 20 75 73 69 6e 67 20 74 68 65 | ected...The.reason.for.using.the |
| 14dac0 | 20 73 74 61 63 6b 20 66 6f 72 20 76 61 72 69 61 62 6c 65 73 20 61 6e 64 0a 61 72 67 75 6d 65 6e | .stack.for.variables.and.argumen |
| 14dae0 | 74 73 20 69 73 20 74 68 61 74 20 69 74 20 61 76 6f 69 64 73 20 74 68 65 20 6e 65 65 64 20 66 6f | ts.is.that.it.avoids.the.need.fo |
| 14db00 | 72 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 69 6e 20 6c 61 6e 67 75 61 67 65 | r.garbage.collection.in.language |
| 14db20 | 73 0a 74 68 61 74 20 77 6f 75 6c 64 20 6e 6f 74 20 6f 74 68 65 72 77 69 73 65 20 72 65 71 75 69 | s.that.would.not.otherwise.requi |
| 14db40 | 72 65 20 69 74 2c 20 61 6e 64 20 69 73 20 67 65 6e 65 72 61 6c 6c 79 20 62 65 6c 69 65 76 65 64 | re.it,.and.is.generally.believed |
| 14db60 | 20 74 6f 20 62 65 0a 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 2e 20 20 53 6f 70 68 69 73 74 69 | .to.be.more.efficient...Sophisti |
| 14db80 | 63 61 74 65 64 20 4c 69 73 70 20 63 6f 6d 70 69 6c 65 72 73 20 63 61 6e 2c 20 69 6e 20 66 61 63 | cated.Lisp.compilers.can,.in.fac |
| 14dba0 | 74 2c 20 75 73 65 20 74 68 65 0a 73 74 61 63 6b 20 66 6f 72 20 61 72 67 75 6d 65 6e 74 73 20 77 | t,.use.the.stack.for.arguments.w |
| 14dbc0 | 69 74 68 6f 75 74 20 64 65 73 74 72 6f 79 69 6e 67 20 74 61 69 6c 20 72 65 63 75 72 73 69 6f 6e | ithout.destroying.tail.recursion |
| 14dbe0 | 2e 20 20 28 53 65 65 20 48 61 6e 73 6f 6e 0a 31 39 39 30 20 66 6f 72 20 61 20 64 65 73 63 72 69 | ...(See.Hanson.1990.for.a.descri |
| 14dc00 | 70 74 69 6f 6e 2e 29 20 20 54 68 65 72 65 20 69 73 20 61 6c 73 6f 20 73 6f 6d 65 20 64 65 62 61 | ption.)..There.is.also.some.deba |
| 14dc20 | 74 65 20 61 62 6f 75 74 20 77 68 65 74 68 65 72 20 73 74 61 63 6b 0a 61 6c 6c 6f 63 61 74 69 6f | te.about.whether.stack.allocatio |
| 14dc40 | 6e 20 69 73 20 61 63 74 75 61 6c 6c 79 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20 74 68 61 | n.is.actually.more.efficient.tha |
| 14dc60 | 6e 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 69 6e 20 74 68 65 0a 66 69 72 73 | n.garbage.collection.in.the.firs |
| 14dc80 | 74 20 70 6c 61 63 65 2c 20 62 75 74 20 74 68 65 20 64 65 74 61 69 6c 73 20 73 65 65 6d 20 74 6f | t.place,.but.the.details.seem.to |
| 14dca0 | 20 68 69 6e 67 65 20 6f 6e 20 66 69 6e 65 20 70 6f 69 6e 74 73 20 6f 66 20 63 6f 6d 70 75 74 65 | .hinge.on.fine.points.of.compute |
| 14dcc0 | 72 0a 61 72 63 68 69 74 65 63 74 75 72 65 2e 20 20 28 53 65 65 20 41 70 70 65 6c 20 31 39 38 37 | r.architecture...(See.Appel.1987 |
| 14dce0 | 20 61 6e 64 20 4d 69 6c 6c 65 72 20 61 6e 64 20 52 6f 7a 61 73 20 31 39 39 34 20 66 6f 72 20 6f | .and.Miller.and.Rozas.1994.for.o |
| 14dd00 | 70 70 6f 73 69 6e 67 0a 76 69 65 77 73 20 6f 6e 20 74 68 69 73 20 69 73 73 75 65 2e 29 0a 0a 20 | pposing.views.on.this.issue.)... |
| 14dd20 | 20 20 28 33 29 20 54 68 65 20 76 61 72 69 61 62 6c 65 20 60 61 6c 6c 2d 72 65 67 73 27 20 69 73 | ..(3).The.variable.`all-regs'.is |
| 14dd40 | 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20 6e 61 6d 65 73 20 6f 66 20 61 | .bound.to.the.list.of.names.of.a |
| 14dd60 | 6c 6c 20 74 68 65 0a 72 65 67 69 73 74 65 72 73 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 | ll.the.registers:.......(define. |
| 14dd80 | 61 6c 6c 2d 72 65 67 73 20 27 28 65 6e 76 20 70 72 6f 63 20 76 61 6c 20 61 72 67 6c 20 63 6f 6e | all-regs.'(env.proc.val.argl.con |
| 14dda0 | 74 69 6e 75 65 29 29 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 | tinue))....File:.sicp.info,..Nod |
| 14ddc0 | 65 3a 20 35 2d 35 2d 34 2c 20 20 4e 65 78 74 3a 20 35 2d 35 2d 35 2c 20 20 50 72 65 76 3a 20 35 | e:.5-5-4,..Next:.5-5-5,..Prev:.5 |
| 14dde0 | 2d 35 2d 33 2c 20 20 55 70 3a 20 35 2d 35 0a 0a 35 2e 35 2e 34 20 43 6f 6d 62 69 6e 69 6e 67 20 | -5-3,..Up:.5-5..5.5.4.Combining. |
| 14de00 | 49 6e 73 74 72 75 63 74 69 6f 6e 20 53 65 71 75 65 6e 63 65 73 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | Instruction.Sequences.---------- |
| 14de20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 54 68 69 | ---------------------------..Thi |
| 14de40 | 73 20 73 65 63 74 69 6f 6e 20 64 65 73 63 72 69 62 65 73 20 74 68 65 20 64 65 74 61 69 6c 73 20 | s.section.describes.the.details. |
| 14de60 | 6f 6e 20 68 6f 77 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 61 72 65 | on.how.instruction.sequences.are |
| 14de80 | 0a 72 65 70 72 65 73 65 6e 74 65 64 20 61 6e 64 20 63 6f 6d 62 69 6e 65 64 2e 20 20 52 65 63 61 | .represented.and.combined...Reca |
| 14dea0 | 6c 6c 20 66 72 6f 6d 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 35 2d 31 3a 3a 20 74 68 | ll.from.section.*Note.5-5-1::.th |
| 14dec0 | 61 74 20 61 6e 0a 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 69 73 20 72 65 | at.an.instruction.sequence.is.re |
| 14dee0 | 70 72 65 73 65 6e 74 65 64 20 61 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 72 65 67 69 73 | presented.as.a.list.of.the.regis |
| 14df00 | 74 65 72 73 20 6e 65 65 64 65 64 2c 0a 74 68 65 20 72 65 67 69 73 74 65 72 73 20 6d 6f 64 69 66 | ters.needed,.the.registers.modif |
| 14df20 | 69 65 64 2c 20 61 6e 64 20 74 68 65 20 61 63 74 75 61 6c 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 | ied,.and.the.actual.instructions |
| 14df40 | 2e 20 20 57 65 20 77 69 6c 6c 20 61 6c 73 6f 0a 63 6f 6e 73 69 64 65 72 20 61 20 6c 61 62 65 6c | ...We.will.also.consider.a.label |
| 14df60 | 20 28 73 79 6d 62 6f 6c 29 20 74 6f 20 62 65 20 61 20 64 65 67 65 6e 65 72 61 74 65 20 63 61 73 | .(symbol).to.be.a.degenerate.cas |
| 14df80 | 65 20 6f 66 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 0a 73 65 71 75 65 6e 63 65 2c 20 77 68 | e.of.an.instruction.sequence,.wh |
| 14dfa0 | 69 63 68 20 64 6f 65 73 6e 27 74 20 6e 65 65 64 20 6f 72 20 6d 6f 64 69 66 79 20 61 6e 79 20 72 | ich.doesn't.need.or.modify.any.r |
| 14dfc0 | 65 67 69 73 74 65 72 73 2e 20 20 53 6f 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 0a 74 68 65 20 72 | egisters...So.to.determine.the.r |
| 14dfe0 | 65 67 69 73 74 65 72 73 20 6e 65 65 64 65 64 20 61 6e 64 20 6d 6f 64 69 66 69 65 64 20 62 79 20 | egisters.needed.and.modified.by. |
| 14e000 | 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 77 65 20 75 73 65 20 74 68 65 | instruction.sequences.we.use.the |
| 14e020 | 0a 73 65 6c 65 63 74 6f 72 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 72 65 67 69 73 74 | .selectors.......(define.(regist |
| 14e040 | 65 72 73 2d 6e 65 65 64 65 64 20 73 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 73 79 6d 62 6f 6c | ers-needed.s)........(if.(symbol |
| 14e060 | 3f 20 73 29 20 27 28 29 20 28 63 61 72 20 73 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 | ?.s).'().(car.s))).......(define |
| 14e080 | 20 28 72 65 67 69 73 74 65 72 73 2d 6d 6f 64 69 66 69 65 64 20 73 29 0a 20 20 20 20 20 20 20 28 | .(registers-modified.s)........( |
| 14e0a0 | 69 66 20 28 73 79 6d 62 6f 6c 3f 20 73 29 20 27 28 29 20 28 63 61 64 72 20 73 29 29 29 0a 0a 20 | if.(symbol?.s).'().(cadr.s)))... |
| 14e0c0 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 73 74 61 74 65 6d 65 6e 74 73 20 73 29 0a 20 20 20 20 20 | ....(define.(statements.s)...... |
| 14e0e0 | 20 20 28 69 66 20 28 73 79 6d 62 6f 6c 3f 20 73 29 20 28 6c 69 73 74 20 73 29 20 28 63 61 64 64 | ..(if.(symbol?.s).(list.s).(cadd |
| 14e100 | 72 20 73 29 29 29 0a 0a 61 6e 64 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68 65 74 68 65 72 | r.s)))..and.to.determine.whether |
| 14e120 | 20 61 20 67 69 76 65 6e 20 73 65 71 75 65 6e 63 65 20 6e 65 65 64 73 20 6f 72 20 6d 6f 64 69 66 | .a.given.sequence.needs.or.modif |
| 14e140 | 69 65 73 20 61 20 67 69 76 65 6e 0a 72 65 67 69 73 74 65 72 20 77 65 20 75 73 65 20 74 68 65 20 | ies.a.given.register.we.use.the. |
| 14e160 | 70 72 65 64 69 63 61 74 65 73 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6e 65 65 64 73 2d | predicates.......(define.(needs- |
| 14e180 | 72 65 67 69 73 74 65 72 3f 20 73 65 71 20 72 65 67 29 0a 20 20 20 20 20 20 20 28 6d 65 6d 71 20 | register?.seq.reg)........(memq. |
| 14e1a0 | 72 65 67 20 28 72 65 67 69 73 74 65 72 73 2d 6e 65 65 64 65 64 20 73 65 71 29 29 29 0a 0a 20 20 | reg.(registers-needed.seq))).... |
| 14e1c0 | 20 20 20 28 64 65 66 69 6e 65 20 28 6d 6f 64 69 66 69 65 73 2d 72 65 67 69 73 74 65 72 3f 20 73 | ...(define.(modifies-register?.s |
| 14e1e0 | 65 71 20 72 65 67 29 0a 20 20 20 20 20 20 20 28 6d 65 6d 71 20 72 65 67 20 28 72 65 67 69 73 74 | eq.reg)........(memq.reg.(regist |
| 14e200 | 65 72 73 2d 6d 6f 64 69 66 69 65 64 20 73 65 71 29 29 29 0a 0a 20 20 20 49 6e 20 74 65 72 6d 73 | ers-modified.seq))).....In.terms |
| 14e220 | 20 6f 66 20 74 68 65 73 65 20 70 72 65 64 69 63 61 74 65 73 20 61 6e 64 20 73 65 6c 65 63 74 6f | .of.these.predicates.and.selecto |
| 14e240 | 72 73 2c 20 77 65 20 63 61 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 0a 76 61 72 69 6f 75 73 | rs,.we.can.implement.the.various |
| 14e260 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 20 63 6f 6d 62 69 6e 65 72 73 20 | .instruction.sequence.combiners. |
| 14e280 | 75 73 65 64 20 74 68 72 6f 75 67 68 6f 75 74 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 2e 0a 0a 20 | used.throughout.the.compiler.... |
| 14e2a0 | 20 20 54 68 65 20 62 61 73 69 63 20 63 6f 6d 62 69 6e 65 72 20 69 73 20 60 61 70 70 65 6e 64 2d | ..The.basic.combiner.is.`append- |
| 14e2c0 | 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 27 2e 20 20 54 68 69 73 20 74 61 | instruction-sequences'...This.ta |
| 14e2e0 | 6b 65 73 20 61 73 0a 61 72 67 75 6d 65 6e 74 73 20 61 6e 20 61 72 62 69 74 72 61 72 79 20 6e 75 | kes.as.arguments.an.arbitrary.nu |
| 14e300 | 6d 62 65 72 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 74 68 | mber.of.instruction.sequences.th |
| 14e320 | 61 74 20 61 72 65 20 74 6f 20 62 65 0a 65 78 65 63 75 74 65 64 20 73 65 71 75 65 6e 74 69 61 6c | at.are.to.be.executed.sequential |
| 14e340 | 6c 79 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 | ly.and.returns.an.instruction.se |
| 14e360 | 71 75 65 6e 63 65 20 77 68 6f 73 65 0a 73 74 61 74 65 6d 65 6e 74 73 20 61 72 65 20 74 68 65 20 | quence.whose.statements.are.the. |
| 14e380 | 73 74 61 74 65 6d 65 6e 74 73 20 6f 66 20 61 6c 6c 20 74 68 65 20 73 65 71 75 65 6e 63 65 73 20 | statements.of.all.the.sequences. |
| 14e3a0 | 61 70 70 65 6e 64 65 64 20 74 6f 67 65 74 68 65 72 2e 0a 54 68 65 20 73 75 62 74 6c 65 20 70 6f | appended.together..The.subtle.po |
| 14e3c0 | 69 6e 74 20 69 73 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 72 65 67 69 73 74 65 72 | int.is.to.determine.the.register |
| 14e3e0 | 73 20 74 68 61 74 20 61 72 65 20 6e 65 65 64 65 64 20 61 6e 64 0a 6d 6f 64 69 66 69 65 64 20 62 | s.that.are.needed.and.modified.b |
| 14e400 | 79 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 73 65 71 75 65 6e 63 65 2e 20 20 49 74 20 6d 6f | y.the.resulting.sequence...It.mo |
| 14e420 | 64 69 66 69 65 73 20 74 68 6f 73 65 20 72 65 67 69 73 74 65 72 73 20 74 68 61 74 0a 61 72 65 20 | difies.those.registers.that.are. |
| 14e440 | 6d 6f 64 69 66 69 65 64 20 62 79 20 61 6e 79 20 6f 66 20 74 68 65 20 73 65 71 75 65 6e 63 65 73 | modified.by.any.of.the.sequences |
| 14e460 | 3b 20 69 74 20 6e 65 65 64 73 20 74 68 6f 73 65 20 72 65 67 69 73 74 65 72 73 20 74 68 61 74 0a | ;.it.needs.those.registers.that. |
| 14e480 | 6d 75 73 74 20 62 65 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 62 65 66 6f 72 65 20 74 68 65 20 66 | must.be.initialized.before.the.f |
| 14e4a0 | 69 72 73 74 20 73 65 71 75 65 6e 63 65 20 63 61 6e 20 62 65 20 72 75 6e 20 28 74 68 65 20 72 65 | irst.sequence.can.be.run.(the.re |
| 14e4c0 | 67 69 73 74 65 72 73 0a 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 66 69 72 73 74 20 73 65 71 75 | gisters.needed.by.the.first.sequ |
| 14e4e0 | 65 6e 63 65 29 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 20 74 68 6f 73 65 20 72 65 67 69 73 | ence),.together.with.those.regis |
| 14e500 | 74 65 72 73 20 6e 65 65 64 65 64 20 62 79 0a 61 6e 79 20 6f 66 20 74 68 65 20 6f 74 68 65 72 20 | ters.needed.by.any.of.the.other. |
| 14e520 | 73 65 71 75 65 6e 63 65 73 20 74 68 61 74 20 61 72 65 20 6e 6f 74 20 69 6e 69 74 69 61 6c 69 7a | sequences.that.are.not.initializ |
| 14e540 | 65 64 20 28 6d 6f 64 69 66 69 65 64 29 20 62 79 0a 73 65 71 75 65 6e 63 65 73 20 70 72 65 63 65 | ed.(modified).by.sequences.prece |
| 14e560 | 64 69 6e 67 20 69 74 2e 0a 0a 20 20 20 54 68 65 20 73 65 71 75 65 6e 63 65 73 20 61 72 65 20 61 | ding.it......The.sequences.are.a |
| 14e580 | 70 70 65 6e 64 65 64 20 74 77 6f 20 61 74 20 61 20 74 69 6d 65 20 62 79 20 60 61 70 70 65 6e 64 | ppended.two.at.a.time.by.`append |
| 14e5a0 | 2d 32 2d 73 65 71 75 65 6e 63 65 73 27 2e 0a 54 68 69 73 20 74 61 6b 65 73 20 74 77 6f 20 69 6e | -2-sequences'..This.takes.two.in |
| 14e5c0 | 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 73 20 60 73 65 71 31 27 20 61 6e 64 20 60 | struction.sequences.`seq1'.and.` |
| 14e5e0 | 73 65 71 32 27 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 0a 69 6e 73 74 72 75 63 74 69 6f | seq2'.and.returns.the.instructio |
| 14e600 | 6e 20 73 65 71 75 65 6e 63 65 20 77 68 6f 73 65 20 73 74 61 74 65 6d 65 6e 74 73 20 61 72 65 20 | n.sequence.whose.statements.are. |
| 14e620 | 74 68 65 20 73 74 61 74 65 6d 65 6e 74 73 20 6f 66 20 60 73 65 71 31 27 0a 66 6f 6c 6c 6f 77 65 | the.statements.of.`seq1'.followe |
| 14e640 | 64 20 62 79 20 74 68 65 20 73 74 61 74 65 6d 65 6e 74 73 20 6f 66 20 60 73 65 71 32 27 2c 20 77 | d.by.the.statements.of.`seq2',.w |
| 14e660 | 68 6f 73 65 20 6d 6f 64 69 66 69 65 64 20 72 65 67 69 73 74 65 72 73 20 61 72 65 20 74 68 6f 73 | hose.modified.registers.are.thos |
| 14e680 | 65 0a 72 65 67 69 73 74 65 72 73 20 74 68 61 74 20 61 72 65 20 6d 6f 64 69 66 69 65 64 20 62 79 | e.registers.that.are.modified.by |
| 14e6a0 | 20 65 69 74 68 65 72 20 60 73 65 71 31 27 20 6f 72 20 60 73 65 71 32 27 2c 20 61 6e 64 20 77 68 | .either.`seq1'.or.`seq2',.and.wh |
| 14e6c0 | 6f 73 65 0a 6e 65 65 64 65 64 20 72 65 67 69 73 74 65 72 73 20 61 72 65 20 74 68 65 20 72 65 67 | ose.needed.registers.are.the.reg |
| 14e6e0 | 69 73 74 65 72 73 20 6e 65 65 64 65 64 20 62 79 20 60 73 65 71 31 27 20 74 6f 67 65 74 68 65 72 | isters.needed.by.`seq1'.together |
| 14e700 | 20 77 69 74 68 20 74 68 6f 73 65 0a 72 65 67 69 73 74 65 72 73 20 6e 65 65 64 65 64 20 62 79 20 | .with.those.registers.needed.by. |
| 14e720 | 60 73 65 71 32 27 20 74 68 61 74 20 61 72 65 20 6e 6f 74 20 6d 6f 64 69 66 69 65 64 20 62 79 20 | `seq2'.that.are.not.modified.by. |
| 14e740 | 60 73 65 71 31 27 2e 20 20 28 49 6e 20 74 65 72 6d 73 0a 6f 66 20 73 65 74 20 6f 70 65 72 61 74 | `seq1'...(In.terms.of.set.operat |
| 14e760 | 69 6f 6e 73 2c 20 74 68 65 20 6e 65 77 20 73 65 74 20 6f 66 20 6e 65 65 64 65 64 20 72 65 67 69 | ions,.the.new.set.of.needed.regi |
| 14e780 | 73 74 65 72 73 20 69 73 20 74 68 65 20 75 6e 69 6f 6e 20 6f 66 20 74 68 65 0a 73 65 74 20 6f 66 | sters.is.the.union.of.the.set.of |
| 14e7a0 | 20 72 65 67 69 73 74 65 72 73 20 6e 65 65 64 65 64 20 62 79 20 60 73 65 71 31 27 20 77 69 74 68 | .registers.needed.by.`seq1'.with |
| 14e7c0 | 20 74 68 65 20 73 65 74 20 64 69 66 66 65 72 65 6e 63 65 20 6f 66 20 74 68 65 0a 72 65 67 69 73 | .the.set.difference.of.the.regis |
| 14e7e0 | 74 65 72 73 20 6e 65 65 64 65 64 20 62 79 20 60 73 65 71 32 27 20 61 6e 64 20 74 68 65 20 72 65 | ters.needed.by.`seq2'.and.the.re |
| 14e800 | 67 69 73 74 65 72 73 20 6d 6f 64 69 66 69 65 64 20 62 79 20 60 73 65 71 31 27 2e 29 20 20 54 68 | gisters.modified.by.`seq1'.)..Th |
| 14e820 | 75 73 2c 0a 60 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 | us,.`append-instruction-sequence |
| 14e840 | 73 27 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 | s'.is.implemented.as.follows:... |
| 14e860 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d | ....(define.(append-instruction- |
| 14e880 | 73 65 71 75 65 6e 63 65 73 20 2e 20 73 65 71 73 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 | sequences...seqs)........(define |
| 14e8a0 | 20 28 61 70 70 65 6e 64 2d 32 2d 73 65 71 75 65 6e 63 65 73 20 73 65 71 31 20 73 65 71 32 29 0a | .(append-2-sequences.seq1.seq2). |
| 14e8c0 | 20 20 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 | .........(make-instruction-seque |
| 14e8e0 | 6e 63 65 0a 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 75 6e 69 6f 6e 20 28 72 65 67 69 73 | nce...........(list-union.(regis |
| 14e900 | 74 65 72 73 2d 6e 65 65 64 65 64 20 73 65 71 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ters-needed.seq1)............... |
| 14e920 | 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 64 69 66 66 65 72 65 6e 63 65 20 28 72 65 67 69 73 74 | ........(list-difference.(regist |
| 14e940 | 65 72 73 2d 6e 65 65 64 65 64 20 73 65 71 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ers-needed.seq2)................ |
| 14e960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 69 73 74 65 | ........................(registe |
| 14e980 | 72 73 2d 6d 6f 64 69 66 69 65 64 20 73 65 71 31 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 6c | rs-modified.seq1)))...........(l |
| 14e9a0 | 69 73 74 2d 75 6e 69 6f 6e 20 28 72 65 67 69 73 74 65 72 73 2d 6d 6f 64 69 66 69 65 64 20 73 65 | ist-union.(registers-modified.se |
| 14e9c0 | 71 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 69 73 | q1).......................(regis |
| 14e9e0 | 74 65 72 73 2d 6d 6f 64 69 66 69 65 64 20 73 65 71 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 | ters-modified.seq2))...........( |
| 14ea00 | 61 70 70 65 6e 64 20 28 73 74 61 74 65 6d 65 6e 74 73 20 73 65 71 31 29 20 28 73 74 61 74 65 6d | append.(statements.seq1).(statem |
| 14ea20 | 65 6e 74 73 20 73 65 71 32 29 29 29 29 0a 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 61 70 | ents.seq2))))........(define.(ap |
| 14ea40 | 70 65 6e 64 2d 73 65 71 2d 6c 69 73 74 20 73 65 71 73 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 | pend-seq-list.seqs)..........(if |
| 14ea60 | 20 28 6e 75 6c 6c 3f 20 73 65 71 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6d 70 74 | .(null?.seqs)..............(empt |
| 14ea80 | 79 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 29 0a 20 20 20 20 20 20 20 20 | y-instruction-sequence)......... |
| 14eaa0 | 20 20 20 20 20 28 61 70 70 65 6e 64 2d 32 2d 73 65 71 75 65 6e 63 65 73 20 28 63 61 72 20 73 65 | .....(append-2-sequences.(car.se |
| 14eac0 | 71 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | qs)............................. |
| 14eae0 | 20 20 20 20 20 28 61 70 70 65 6e 64 2d 73 65 71 2d 6c 69 73 74 20 28 63 64 72 20 73 65 71 73 29 | .....(append-seq-list.(cdr.seqs) |
| 14eb00 | 29 29 29 29 0a 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 2d 73 65 71 2d 6c 69 73 74 20 73 65 71 | ))))........(append-seq-list.seq |
| 14eb20 | 73 29 29 0a 0a 20 20 20 54 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 75 73 65 73 20 73 6f 6d 65 | s)).....This.procedure.uses.some |
| 14eb40 | 20 73 69 6d 70 6c 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 66 6f 72 20 6d 61 6e 69 70 75 6c 61 74 | .simple.operations.for.manipulat |
| 14eb60 | 69 6e 67 20 73 65 74 73 0a 72 65 70 72 65 73 65 6e 74 65 64 20 61 73 20 6c 69 73 74 73 2c 20 73 | ing.sets.represented.as.lists,.s |
| 14eb80 | 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 28 75 6e 6f 72 64 65 72 65 64 29 20 73 65 74 20 72 65 | imilar.to.the.(unordered).set.re |
| 14eba0 | 70 72 65 73 65 6e 74 61 74 69 6f 6e 0a 64 65 73 63 72 69 62 65 64 20 69 6e 20 73 65 63 74 69 6f | presentation.described.in.sectio |
| 14ebc0 | 6e 20 2a 4e 6f 74 65 20 32 2d 33 2d 33 3a 3a 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 | n.*Note.2-3-3:::.......(define.( |
| 14ebe0 | 6c 69 73 74 2d 75 6e 69 6f 6e 20 73 31 20 73 32 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 | list-union.s1.s2)........(cond.( |
| 14ec00 | 28 6e 75 6c 6c 3f 20 73 31 29 20 73 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6d 65 | (null?.s1).s2)..............((me |
| 14ec20 | 6d 71 20 28 63 61 72 20 73 31 29 20 73 32 29 20 28 6c 69 73 74 2d 75 6e 69 6f 6e 20 28 63 64 72 | mq.(car.s1).s2).(list-union.(cdr |
| 14ec40 | 20 73 31 29 20 73 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 63 6f | .s1).s2))..............(else.(co |
| 14ec60 | 6e 73 20 28 63 61 72 20 73 31 29 20 28 6c 69 73 74 2d 75 6e 69 6f 6e 20 28 63 64 72 20 73 31 29 | ns.(car.s1).(list-union.(cdr.s1) |
| 14ec80 | 20 73 32 29 29 29 29 29 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 6c 69 73 74 2d 64 69 66 | .s2))))).......(define.(list-dif |
| 14eca0 | 66 65 72 65 6e 63 65 20 73 31 20 73 32 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 6e 75 | ference.s1.s2)........(cond.((nu |
| 14ecc0 | 6c 6c 3f 20 73 31 29 20 27 28 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 6d 65 6d 71 | ll?.s1).'())..............((memq |
| 14ece0 | 20 28 63 61 72 20 73 31 29 20 73 32 29 20 28 6c 69 73 74 2d 64 69 66 66 65 72 65 6e 63 65 20 28 | .(car.s1).s2).(list-difference.( |
| 14ed00 | 63 64 72 20 73 31 29 20 73 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 | cdr.s1).s2))..............(else. |
| 14ed20 | 28 63 6f 6e 73 20 28 63 61 72 20 73 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (cons.(car.s1).................. |
| 14ed40 | 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 64 69 66 66 65 72 65 6e 63 65 20 28 63 64 72 20 73 31 | ........(list-difference.(cdr.s1 |
| 14ed60 | 29 20 73 32 29 29 29 29 29 0a 0a 20 20 20 60 50 72 65 73 65 72 76 69 6e 67 27 2c 20 74 68 65 20 | ).s2))))).....`Preserving',.the. |
| 14ed80 | 73 65 63 6f 6e 64 20 6d 61 6a 6f 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 | second.major.instruction.sequenc |
| 14eda0 | 65 20 63 6f 6d 62 69 6e 65 72 2c 20 74 61 6b 65 73 0a 61 20 6c 69 73 74 20 6f 66 20 72 65 67 69 | e.combiner,.takes.a.list.of.regi |
| 14edc0 | 73 74 65 72 73 20 60 72 65 67 73 27 20 61 6e 64 20 74 77 6f 20 69 6e 73 74 72 75 63 74 69 6f 6e | sters.`regs'.and.two.instruction |
| 14ede0 | 20 73 65 71 75 65 6e 63 65 73 20 60 73 65 71 31 27 20 61 6e 64 0a 60 73 65 71 32 27 20 74 68 61 | .sequences.`seq1'.and.`seq2'.tha |
| 14ee00 | 74 20 61 72 65 20 74 6f 20 62 65 20 65 78 65 63 75 74 65 64 20 73 65 71 75 65 6e 74 69 61 6c 6c | t.are.to.be.executed.sequentiall |
| 14ee20 | 79 2e 20 20 49 74 20 72 65 74 75 72 6e 73 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 0a 73 65 | y...It.returns.an.instruction.se |
| 14ee40 | 71 75 65 6e 63 65 20 77 68 6f 73 65 20 73 74 61 74 65 6d 65 6e 74 73 20 61 72 65 20 74 68 65 20 | quence.whose.statements.are.the. |
| 14ee60 | 73 74 61 74 65 6d 65 6e 74 73 20 6f 66 20 60 73 65 71 31 27 20 66 6f 6c 6c 6f 77 65 64 20 62 79 | statements.of.`seq1'.followed.by |
| 14ee80 | 20 74 68 65 0a 73 74 61 74 65 6d 65 6e 74 73 20 6f 66 20 60 73 65 71 32 27 2c 20 77 69 74 68 20 | .the.statements.of.`seq2',.with. |
| 14eea0 | 61 70 70 72 6f 70 72 69 61 74 65 20 60 73 61 76 65 27 20 61 6e 64 20 60 72 65 73 74 6f 72 65 27 | appropriate.`save'.and.`restore' |
| 14eec0 | 0a 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 61 72 6f 75 6e 64 20 60 73 65 71 31 27 20 74 6f 20 70 | .instructions.around.`seq1'.to.p |
| 14eee0 | 72 6f 74 65 63 74 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 69 6e 20 60 72 65 67 73 27 20 74 | rotect.the.registers.in.`regs'.t |
| 14ef00 | 68 61 74 20 61 72 65 0a 6d 6f 64 69 66 69 65 64 20 62 79 20 60 73 65 71 31 27 20 62 75 74 20 6e | hat.are.modified.by.`seq1'.but.n |
| 14ef20 | 65 65 64 65 64 20 62 79 20 60 73 65 71 32 27 2e 20 20 54 6f 20 61 63 63 6f 6d 70 6c 69 73 68 20 | eeded.by.`seq2'...To.accomplish. |
| 14ef40 | 74 68 69 73 2c 0a 60 70 72 65 73 65 72 76 69 6e 67 27 20 66 69 72 73 74 20 63 72 65 61 74 65 73 | this,.`preserving'.first.creates |
| 14ef60 | 20 61 20 73 65 71 75 65 6e 63 65 20 74 68 61 74 20 68 61 73 20 74 68 65 20 72 65 71 75 69 72 65 | .a.sequence.that.has.the.require |
| 14ef80 | 64 20 60 73 61 76 65 27 73 0a 66 6f 6c 6c 6f 77 65 64 20 62 79 20 74 68 65 20 73 74 61 74 65 6d | d.`save's.followed.by.the.statem |
| 14efa0 | 65 6e 74 73 20 6f 66 20 60 73 65 71 31 27 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 74 68 65 20 72 | ents.of.`seq1'.followed.by.the.r |
| 14efc0 | 65 71 75 69 72 65 64 0a 60 72 65 73 74 6f 72 65 27 73 2e 20 20 54 68 69 73 20 73 65 71 75 65 6e | equired.`restore's...This.sequen |
| 14efe0 | 63 65 20 6e 65 65 64 73 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 62 65 69 6e 67 20 73 61 76 | ce.needs.the.registers.being.sav |
| 14f000 | 65 64 20 61 6e 64 20 72 65 73 74 6f 72 65 64 0a 69 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 74 | ed.and.restored.in.addition.to.t |
| 14f020 | 68 65 20 72 65 67 69 73 74 65 72 73 20 6e 65 65 64 65 64 20 62 79 20 60 73 65 71 31 27 2c 20 61 | he.registers.needed.by.`seq1',.a |
| 14f040 | 6e 64 20 6d 6f 64 69 66 69 65 73 20 74 68 65 0a 72 65 67 69 73 74 65 72 73 20 6d 6f 64 69 66 69 | nd.modifies.the.registers.modifi |
| 14f060 | 65 64 20 62 79 20 60 73 65 71 31 27 20 65 78 63 65 70 74 20 66 6f 72 20 74 68 65 20 6f 6e 65 73 | ed.by.`seq1'.except.for.the.ones |
| 14f080 | 20 62 65 69 6e 67 20 73 61 76 65 64 20 61 6e 64 0a 72 65 73 74 6f 72 65 64 2e 20 20 54 68 69 73 | .being.saved.and.restored...This |
| 14f0a0 | 20 61 75 67 6d 65 6e 74 65 64 20 73 65 71 75 65 6e 63 65 20 61 6e 64 20 60 73 65 71 32 27 20 61 | .augmented.sequence.and.`seq2'.a |
| 14f0c0 | 72 65 20 74 68 65 6e 20 61 70 70 65 6e 64 65 64 20 69 6e 20 74 68 65 0a 75 73 75 61 6c 20 77 61 | re.then.appended.in.the.usual.wa |
| 14f0e0 | 79 2e 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 69 6d 70 6c | y...The.following.procedure.impl |
| 14f100 | 65 6d 65 6e 74 73 20 74 68 69 73 20 73 74 72 61 74 65 67 79 0a 72 65 63 75 72 73 69 76 65 6c 79 | ements.this.strategy.recursively |
| 14f120 | 2c 20 77 61 6c 6b 69 6e 67 20 64 6f 77 6e 20 74 68 65 20 6c 69 73 74 20 6f 66 20 72 65 67 69 73 | ,.walking.down.the.list.of.regis |
| 14f140 | 74 65 72 73 20 74 6f 20 62 65 20 70 72 65 73 65 72 76 65 64 3a 28 31 29 0a 0a 20 20 20 20 20 28 | ters.to.be.preserved:(1).......( |
| 14f160 | 64 65 66 69 6e 65 20 28 70 72 65 73 65 72 76 69 6e 67 20 72 65 67 73 20 73 65 71 31 20 73 65 71 | define.(preserving.regs.seq1.seq |
| 14f180 | 32 29 0a 20 20 20 20 20 20 20 28 69 66 20 28 6e 75 6c 6c 3f 20 72 65 67 73 29 0a 20 20 20 20 20 | 2)........(if.(null?.regs)...... |
| 14f1a0 | 20 20 20 20 20 20 28 61 70 70 65 6e 64 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e | ......(append-instruction-sequen |
| 14f1c0 | 63 65 73 20 73 65 71 31 20 73 65 71 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 | ces.seq1.seq2)............(let.( |
| 14f1e0 | 28 66 69 72 73 74 2d 72 65 67 20 28 63 61 72 20 72 65 67 73 29 29 29 0a 20 20 20 20 20 20 20 20 | (first-reg.(car.regs)))......... |
| 14f200 | 20 20 20 20 20 28 69 66 20 28 61 6e 64 20 28 6e 65 65 64 73 2d 72 65 67 69 73 74 65 72 3f 20 73 | .....(if.(and.(needs-register?.s |
| 14f220 | 65 71 32 20 66 69 72 73 74 2d 72 65 67 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | eq2.first-reg).................. |
| 14f240 | 20 20 20 20 20 28 6d 6f 64 69 66 69 65 73 2d 72 65 67 69 73 74 65 72 3f 20 73 65 71 31 20 66 69 | .....(modifies-register?.seq1.fi |
| 14f260 | 72 73 74 2d 72 65 67 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 65 73 | rst-reg))..................(pres |
| 14f280 | 65 72 76 69 6e 67 20 28 63 64 72 20 72 65 67 73 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | erving.(cdr.regs)............... |
| 14f2a0 | 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 0a 20 | ....(make-instruction-sequence.. |
| 14f2c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 75 6e 69 6f 6e 20 28 6c | ..................(list-union.(l |
| 14f2e0 | 69 73 74 20 66 69 72 73 74 2d 72 65 67 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ist.first-reg).................. |
| 14f300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 69 73 74 65 72 73 2d 6e 65 65 64 65 64 20 | ..............(registers-needed. |
| 14f320 | 73 65 71 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d | seq1))....................(list- |
| 14f340 | 64 69 66 66 65 72 65 6e 63 65 20 28 72 65 67 69 73 74 65 72 73 2d 6d 6f 64 69 66 69 65 64 20 73 | difference.(registers-modified.s |
| 14f360 | 65 71 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | eq1)............................ |
| 14f380 | 20 20 20 20 20 20 20 20 20 28 6c 69 73 74 20 66 69 72 73 74 2d 72 65 67 29 29 0a 20 20 20 20 20 | .........(list.first-reg))...... |
| 14f3a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 20 60 28 28 73 61 76 65 20 2c 66 | ..............(append.`((save.,f |
| 14f3c0 | 69 72 73 74 2d 72 65 67 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | irst-reg))...................... |
| 14f3e0 | 20 20 20 20 20 20 28 73 74 61 74 65 6d 65 6e 74 73 20 73 65 71 31 29 0a 20 20 20 20 20 20 20 20 | ......(statements.seq1)......... |
| 14f400 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 60 28 28 72 65 73 74 6f 72 65 20 2c 66 | ...................`((restore.,f |
| 14f420 | 69 72 73 74 2d 72 65 67 29 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 73 | irst-reg))))...................s |
| 14f440 | 65 71 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 70 72 65 73 65 72 76 69 6e | eq2)..................(preservin |
| 14f460 | 67 20 28 63 64 72 20 72 65 67 73 29 20 73 65 71 31 20 73 65 71 32 29 29 29 29 29 0a 0a 20 20 20 | g.(cdr.regs).seq1.seq2)))))..... |
| 14f480 | 41 6e 6f 74 68 65 72 20 73 65 71 75 65 6e 63 65 20 63 6f 6d 62 69 6e 65 72 2c 20 60 74 61 63 6b | Another.sequence.combiner,.`tack |
| 14f4a0 | 2d 6f 6e 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 27 2c 20 69 73 20 75 73 | -on-instruction-sequence',.is.us |
| 14f4c0 | 65 64 20 62 79 0a 60 63 6f 6d 70 69 6c 65 2d 6c 61 6d 62 64 61 27 20 74 6f 20 61 70 70 65 6e 64 | ed.by.`compile-lambda'.to.append |
| 14f4e0 | 20 61 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 20 74 6f 20 61 6e 6f 74 68 65 72 20 73 65 71 | .a.procedure.body.to.another.seq |
| 14f500 | 75 65 6e 63 65 2e 0a 42 65 63 61 75 73 65 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 | uence..Because.the.procedure.bod |
| 14f520 | 79 20 69 73 20 6e 6f 74 20 22 69 6e 20 6c 69 6e 65 22 20 74 6f 20 62 65 20 65 78 65 63 75 74 65 | y.is.not."in.line".to.be.execute |
| 14f540 | 64 20 61 73 20 70 61 72 74 20 6f 66 0a 74 68 65 20 63 6f 6d 62 69 6e 65 64 20 73 65 71 75 65 6e | d.as.part.of.the.combined.sequen |
| 14f560 | 63 65 2c 20 69 74 73 20 72 65 67 69 73 74 65 72 20 75 73 65 20 68 61 73 20 6e 6f 20 69 6d 70 61 | ce,.its.register.use.has.no.impa |
| 14f580 | 63 74 20 6f 6e 20 74 68 65 20 72 65 67 69 73 74 65 72 0a 75 73 65 20 6f 66 20 74 68 65 20 73 65 | ct.on.the.register.use.of.the.se |
| 14f5a0 | 71 75 65 6e 63 65 20 69 6e 20 77 68 69 63 68 20 69 74 20 69 73 20 65 6d 62 65 64 64 65 64 2e 20 | quence.in.which.it.is.embedded.. |
| 14f5c0 | 20 57 65 20 74 68 75 73 20 69 67 6e 6f 72 65 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 62 6f | .We.thus.ignore.the.procedure.bo |
| 14f5e0 | 64 79 27 73 20 73 65 74 73 20 6f 66 20 6e 65 65 64 65 64 20 61 6e 64 20 6d 6f 64 69 66 69 65 64 | dy's.sets.of.needed.and.modified |
| 14f600 | 20 72 65 67 69 73 74 65 72 73 20 77 68 65 6e 20 77 65 20 74 61 63 6b 20 69 74 0a 6f 6e 74 6f 20 | .registers.when.we.tack.it.onto. |
| 14f620 | 74 68 65 20 6f 74 68 65 72 20 73 65 71 75 65 6e 63 65 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | the.other.sequence........(defin |
| 14f640 | 65 20 28 74 61 63 6b 2d 6f 6e 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 20 | e.(tack-on-instruction-sequence. |
| 14f660 | 73 65 71 20 62 6f 64 79 2d 73 65 71 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 | seq.body-seq)........(make-instr |
| 14f680 | 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 0a 20 20 20 20 20 20 20 20 28 72 65 67 69 73 74 65 | uction-sequence.........(registe |
| 14f6a0 | 72 73 2d 6e 65 65 64 65 64 20 73 65 71 29 0a 20 20 20 20 20 20 20 20 28 72 65 67 69 73 74 65 72 | rs-needed.seq).........(register |
| 14f6c0 | 73 2d 6d 6f 64 69 66 69 65 64 20 73 65 71 29 0a 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 20 | s-modified.seq).........(append. |
| 14f6e0 | 28 73 74 61 74 65 6d 65 6e 74 73 20 73 65 71 29 20 28 73 74 61 74 65 6d 65 6e 74 73 20 62 6f 64 | (statements.seq).(statements.bod |
| 14f700 | 79 2d 73 65 71 29 29 29 29 0a 0a 20 20 20 60 43 6f 6d 70 69 6c 65 2d 69 66 27 20 61 6e 64 20 60 | y-seq)))).....`Compile-if'.and.` |
| 14f720 | 63 6f 6d 70 69 6c 65 2d 70 72 6f 63 65 64 75 72 65 2d 63 61 6c 6c 27 20 75 73 65 20 61 20 73 70 | compile-procedure-call'.use.a.sp |
| 14f740 | 65 63 69 61 6c 20 63 6f 6d 62 69 6e 65 72 0a 63 61 6c 6c 65 64 20 60 70 61 72 61 6c 6c 65 6c 2d | ecial.combiner.called.`parallel- |
| 14f760 | 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 73 27 20 74 6f 20 61 70 70 65 6e 64 | instruction-sequences'.to.append |
| 14f780 | 20 74 68 65 20 74 77 6f 20 61 6c 74 65 72 6e 61 74 69 76 65 0a 62 72 61 6e 63 68 65 73 20 74 68 | .the.two.alternative.branches.th |
| 14f7a0 | 61 74 20 66 6f 6c 6c 6f 77 20 61 20 74 65 73 74 2e 20 20 54 68 65 20 74 77 6f 20 62 72 61 6e 63 | at.follow.a.test...The.two.branc |
| 14f7c0 | 68 65 73 20 77 69 6c 6c 20 6e 65 76 65 72 20 62 65 20 65 78 65 63 75 74 65 64 0a 73 65 71 75 65 | hes.will.never.be.executed.seque |
| 14f7e0 | 6e 74 69 61 6c 6c 79 3b 20 66 6f 72 20 61 6e 79 20 70 61 72 74 69 63 75 6c 61 72 20 65 76 61 6c | ntially;.for.any.particular.eval |
| 14f800 | 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 74 65 73 74 2c 20 6f 6e 65 20 62 72 61 6e 63 68 20 6f | uation.of.the.test,.one.branch.o |
| 14f820 | 72 0a 74 68 65 20 6f 74 68 65 72 20 77 69 6c 6c 20 62 65 20 65 6e 74 65 72 65 64 2e 20 20 42 65 | r.the.other.will.be.entered...Be |
| 14f840 | 63 61 75 73 65 20 6f 66 20 74 68 69 73 2c 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 6e 65 65 | cause.of.this,.the.registers.nee |
| 14f860 | 64 65 64 20 62 79 0a 74 68 65 20 73 65 63 6f 6e 64 20 62 72 61 6e 63 68 20 61 72 65 20 73 74 69 | ded.by.the.second.branch.are.sti |
| 14f880 | 6c 6c 20 6e 65 65 64 65 64 20 62 79 20 74 68 65 20 63 6f 6d 62 69 6e 65 64 20 73 65 71 75 65 6e | ll.needed.by.the.combined.sequen |
| 14f8a0 | 63 65 2c 20 65 76 65 6e 20 69 66 0a 74 68 65 73 65 20 61 72 65 20 6d 6f 64 69 66 69 65 64 20 62 | ce,.even.if.these.are.modified.b |
| 14f8c0 | 79 20 74 68 65 20 66 69 72 73 74 20 62 72 61 6e 63 68 2e 0a 0a 20 20 20 20 20 28 64 65 66 69 6e | y.the.first.branch........(defin |
| 14f8e0 | 65 20 28 70 61 72 61 6c 6c 65 6c 2d 69 6e 73 74 72 75 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 | e.(parallel-instruction-sequence |
| 14f900 | 73 20 73 65 71 31 20 73 65 71 32 29 0a 20 20 20 20 20 20 20 28 6d 61 6b 65 2d 69 6e 73 74 72 75 | s.seq1.seq2)........(make-instru |
| 14f920 | 63 74 69 6f 6e 2d 73 65 71 75 65 6e 63 65 0a 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 75 6e 69 | ction-sequence.........(list-uni |
| 14f940 | 6f 6e 20 28 72 65 67 69 73 74 65 72 73 2d 6e 65 65 64 65 64 20 73 65 71 31 29 0a 20 20 20 20 20 | on.(registers-needed.seq1)...... |
| 14f960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 69 73 74 65 72 73 2d 6e 65 65 64 65 64 | ...............(registers-needed |
| 14f980 | 20 73 65 71 32 29 29 0a 20 20 20 20 20 20 20 20 28 6c 69 73 74 2d 75 6e 69 6f 6e 20 28 72 65 67 | .seq2)).........(list-union.(reg |
| 14f9a0 | 69 73 74 65 72 73 2d 6d 6f 64 69 66 69 65 64 20 73 65 71 31 29 0a 20 20 20 20 20 20 20 20 20 20 | isters-modified.seq1)........... |
| 14f9c0 | 20 20 20 20 20 20 20 20 20 20 28 72 65 67 69 73 74 65 72 73 2d 6d 6f 64 69 66 69 65 64 20 73 65 | ..........(registers-modified.se |
| 14f9e0 | 71 32 29 29 0a 20 20 20 20 20 20 20 20 28 61 70 70 65 6e 64 20 28 73 74 61 74 65 6d 65 6e 74 73 | q2)).........(append.(statements |
| 14fa00 | 20 73 65 71 31 29 20 28 73 74 61 74 65 6d 65 6e 74 73 20 73 65 71 32 29 29 29 29 0a 0a 20 20 20 | .seq1).(statements.seq2))))..... |
| 14fa20 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a | ----------.Footnotes.----------. |
| 14fa40 | 0a 20 20 20 28 31 29 20 4e 6f 74 65 20 74 68 61 74 20 60 70 72 65 73 65 72 76 69 6e 67 27 20 63 | ....(1).Note.that.`preserving'.c |
| 14fa60 | 61 6c 6c 73 20 60 61 70 70 65 6e 64 27 20 77 69 74 68 20 74 68 72 65 65 20 61 72 67 75 6d 65 6e | alls.`append'.with.three.argumen |
| 14fa80 | 74 73 2e 0a 54 68 6f 75 67 68 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 60 61 70 | ts..Though.the.definition.of.`ap |
| 14faa0 | 70 65 6e 64 27 20 73 68 6f 77 6e 20 69 6e 20 74 68 69 73 20 62 6f 6f 6b 20 61 63 63 65 70 74 73 | pend'.shown.in.this.book.accepts |
| 14fac0 | 20 6f 6e 6c 79 20 74 77 6f 0a 61 72 67 75 6d 65 6e 74 73 2c 20 53 63 68 65 6d 65 20 73 74 61 6e | .only.two.arguments,.Scheme.stan |
| 14fae0 | 64 61 72 64 6c 79 20 70 72 6f 76 69 64 65 73 20 61 6e 20 60 61 70 70 65 6e 64 27 20 70 72 6f 63 | dardly.provides.an.`append'.proc |
| 14fb00 | 65 64 75 72 65 20 74 68 61 74 20 74 61 6b 65 73 0a 61 6e 20 61 72 62 69 74 72 61 72 79 20 6e 75 | edure.that.takes.an.arbitrary.nu |
| 14fb20 | 6d 62 65 72 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 | mber.of.arguments.....File:.sicp |
| 14fb40 | 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 35 2d 35 2c 20 20 4e 65 78 74 3a 20 35 2d 35 2d | .info,..Node:.5-5-5,..Next:.5-5- |
| 14fb60 | 36 2c 20 20 50 72 65 76 3a 20 35 2d 35 2d 34 2c 20 20 55 70 3a 20 35 2d 35 0a 0a 35 2e 35 2e 35 | 6,..Prev:.5-5-4,..Up:.5-5..5.5.5 |
| 14fb80 | 20 41 6e 20 45 78 61 6d 70 6c 65 20 6f 66 20 43 6f 6d 70 69 6c 65 64 20 43 6f 64 65 0a 2d 2d 2d | .An.Example.of.Compiled.Code.--- |
| 14fba0 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a | ------------------------------.. |
| 14fbc0 | 4e 6f 77 20 74 68 61 74 20 77 65 20 68 61 76 65 20 73 65 65 6e 20 61 6c 6c 20 74 68 65 20 65 6c | Now.that.we.have.seen.all.the.el |
| 14fbe0 | 65 6d 65 6e 74 73 20 6f 66 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 2c 20 6c 65 74 20 75 73 20 65 | ements.of.the.compiler,.let.us.e |
| 14fc00 | 78 61 6d 69 6e 65 0a 61 6e 20 65 78 61 6d 70 6c 65 20 6f 66 20 63 6f 6d 70 69 6c 65 64 20 63 6f | xamine.an.example.of.compiled.co |
| 14fc20 | 64 65 20 74 6f 20 73 65 65 20 68 6f 77 20 74 68 69 6e 67 73 20 66 69 74 20 74 6f 67 65 74 68 65 | de.to.see.how.things.fit.togethe |
| 14fc40 | 72 2e 20 20 57 65 20 77 69 6c 6c 0a 63 6f 6d 70 69 6c 65 20 74 68 65 20 64 65 66 69 6e 69 74 69 | r...We.will.compile.the.definiti |
| 14fc60 | 6f 6e 20 6f 66 20 61 20 72 65 63 75 72 73 69 76 65 20 60 66 61 63 74 6f 72 69 61 6c 27 20 70 72 | on.of.a.recursive.`factorial'.pr |
| 14fc80 | 6f 63 65 64 75 72 65 20 62 79 20 63 61 6c 6c 69 6e 67 0a 60 63 6f 6d 70 69 6c 65 27 3a 0a 0a 20 | ocedure.by.calling.`compile':... |
| 14fca0 | 20 20 20 20 28 63 6f 6d 70 69 6c 65 0a 20 20 20 20 20 20 27 28 64 65 66 69 6e 65 20 28 66 61 63 | ....(compile.......'(define.(fac |
| 14fcc0 | 74 6f 72 69 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 | torial.n)..........(if.(=.n.1).. |
| 14fce0 | 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 66 | ............1..............(*.(f |
| 14fd00 | 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 29 29 0a 20 20 20 20 20 20 27 76 61 | actorial.(-.n.1)).n))).......'va |
| 14fd20 | 6c 0a 20 20 20 20 20 20 27 6e 65 78 74 29 0a 0a 20 20 20 57 65 20 68 61 76 65 20 73 70 65 63 69 | l.......'next).....We.have.speci |
| 14fd40 | 66 69 65 64 20 74 68 61 74 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 64 65 66 69 | fied.that.the.value.of.the.`defi |
| 14fd60 | 6e 65 27 20 65 78 70 72 65 73 73 69 6f 6e 20 73 68 6f 75 6c 64 20 62 65 0a 70 6c 61 63 65 64 20 | ne'.expression.should.be.placed. |
| 14fd80 | 69 6e 20 74 68 65 20 60 76 61 6c 27 20 72 65 67 69 73 74 65 72 2e 20 20 57 65 20 64 6f 6e 27 74 | in.the.`val'.register...We.don't |
| 14fda0 | 20 63 61 72 65 20 77 68 61 74 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 64 6f 65 | .care.what.the.compiled.code.doe |
| 14fdc0 | 73 0a 61 66 74 65 72 20 65 78 65 63 75 74 69 6e 67 20 74 68 65 20 60 64 65 66 69 6e 65 27 2c 20 | s.after.executing.the.`define',. |
| 14fde0 | 73 6f 20 6f 75 72 20 63 68 6f 69 63 65 20 6f 66 20 60 6e 65 78 74 27 20 61 73 20 74 68 65 20 6c | so.our.choice.of.`next'.as.the.l |
| 14fe00 | 69 6e 6b 61 67 65 0a 64 65 73 63 72 69 70 74 6f 72 20 69 73 20 61 72 62 69 74 72 61 72 79 2e 0a | inkage.descriptor.is.arbitrary.. |
| 14fe20 | 0a 20 20 20 60 43 6f 6d 70 69 6c 65 27 20 64 65 74 65 72 6d 69 6e 65 73 20 74 68 61 74 20 74 68 | ....`Compile'.determines.that.th |
| 14fe40 | 65 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 61 20 64 65 66 69 6e 69 74 69 6f 6e 2c 20 73 6f | e.expression.is.a.definition,.so |
| 14fe60 | 20 69 74 20 63 61 6c 6c 73 0a 60 63 6f 6d 70 69 6c 65 2d 64 65 66 69 6e 69 74 69 6f 6e 27 20 74 | .it.calls.`compile-definition'.t |
| 14fe80 | 6f 20 63 6f 6d 70 69 6c 65 20 63 6f 64 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 74 68 65 20 76 61 | o.compile.code.to.compute.the.va |
| 14fea0 | 6c 75 65 20 74 6f 20 62 65 20 61 73 73 69 67 6e 65 64 0a 28 74 61 72 67 65 74 65 64 20 74 6f 20 | lue.to.be.assigned.(targeted.to. |
| 14fec0 | 60 76 61 6c 27 29 2c 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 63 6f 64 65 20 74 6f 20 69 6e 73 74 | `val'),.followed.by.code.to.inst |
| 14fee0 | 61 6c 6c 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 2c 0a 66 6f 6c 6c 6f 77 65 64 20 62 79 20 | all.the.definition,.followed.by. |
| 14ff00 | 63 6f 64 65 20 74 6f 20 70 75 74 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 60 64 65 | code.to.put.the.value.of.the.`de |
| 14ff20 | 66 69 6e 65 27 20 28 77 68 69 63 68 20 69 73 20 74 68 65 20 73 79 6d 62 6f 6c 0a 60 6f 6b 27 29 | fine'.(which.is.the.symbol.`ok') |
| 14ff40 | 20 69 6e 74 6f 20 74 68 65 20 74 61 72 67 65 74 20 72 65 67 69 73 74 65 72 2c 20 66 6f 6c 6c 6f | .into.the.target.register,.follo |
| 14ff60 | 77 65 64 20 66 69 6e 61 6c 6c 79 20 62 79 20 74 68 65 20 6c 69 6e 6b 61 67 65 20 63 6f 64 65 2e | wed.finally.by.the.linkage.code. |
| 14ff80 | 0a 60 45 6e 76 27 20 69 73 20 70 72 65 73 65 72 76 65 64 20 61 72 6f 75 6e 64 20 74 68 65 20 63 | .`Env'.is.preserved.around.the.c |
| 14ffa0 | 6f 6d 70 75 74 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 76 61 6c 75 65 2c 20 62 65 63 61 75 73 65 | omputation.of.the.value,.because |
| 14ffc0 | 20 69 74 20 69 73 0a 6e 65 65 64 65 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 69 6e 73 74 61 6c | .it.is.needed.in.order.to.instal |
| 14ffe0 | 6c 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 2e 20 20 42 65 63 61 75 73 65 20 74 68 65 20 6c | l.the.definition...Because.the.l |
| 150000 | 69 6e 6b 61 67 65 20 69 73 0a 60 6e 65 78 74 27 2c 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6c 69 | inkage.is.`next',.there.is.no.li |
| 150020 | 6e 6b 61 67 65 20 63 6f 64 65 20 69 6e 20 74 68 69 73 20 63 61 73 65 2e 20 20 54 68 65 20 73 6b | nkage.code.in.this.case...The.sk |
| 150040 | 65 6c 65 74 6f 6e 20 6f 66 20 74 68 65 0a 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 69 73 20 74 | eleton.of.the.compiled.code.is.t |
| 150060 | 68 75 73 0a 0a 20 20 20 20 20 3c 5f 73 61 76 65 20 60 65 6e 76 27 20 69 66 20 6d 6f 64 69 66 69 | hus.......<_save.`env'.if.modifi |
| 150080 | 65 64 20 62 79 20 63 6f 64 65 20 74 6f 20 63 6f 6d 70 75 74 65 20 76 61 6c 75 65 5f 3e 0a 20 20 | ed.by.code.to.compute.value_>... |
| 1500a0 | 20 20 20 20 20 3c 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 64 65 66 69 6e 69 74 69 6f 6e | .....<_compilation.of.definition |
| 1500c0 | 20 76 61 6c 75 65 2c 20 74 61 72 67 65 74 20 60 76 61 6c 27 2c 20 6c 69 6e 6b 61 67 65 20 60 6e | .value,.target.`val',.linkage.`n |
| 1500e0 | 65 78 74 27 5f 3e 0a 20 20 20 20 20 20 20 3c 5f 72 65 73 74 6f 72 65 20 60 65 6e 76 27 20 69 66 | ext'_>........<_restore.`env'.if |
| 150100 | 20 73 61 76 65 64 20 61 62 6f 76 65 5f 3e 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 | .saved.above_>........(perform.( |
| 150120 | 6f 70 20 64 65 66 69 6e 65 2d 76 61 72 69 61 62 6c 65 21 29 0a 20 20 20 20 20 20 20 20 20 20 20 | op.define-variable!)............ |
| 150140 | 20 20 20 20 20 28 63 6f 6e 73 74 20 66 61 63 74 6f 72 69 61 6c 29 0a 20 20 20 20 20 20 20 20 20 | .....(const.factorial).......... |
| 150160 | 20 20 20 20 20 20 20 28 72 65 67 20 76 61 6c 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......(reg.val)................ |
| 150180 | 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 | .(reg.env))........(assign.val.( |
| 1501a0 | 63 6f 6e 73 74 20 6f 6b 29 29 0a 0a 20 20 20 54 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 | const.ok)).....The.expression.th |
| 1501c0 | 61 74 20 69 73 20 74 6f 20 62 65 20 63 6f 6d 70 69 6c 65 64 20 74 6f 20 70 72 6f 64 75 63 65 20 | at.is.to.be.compiled.to.produce. |
| 1501e0 | 74 68 65 20 76 61 6c 75 65 20 66 6f 72 20 74 68 65 0a 76 61 72 69 61 62 6c 65 20 60 66 61 63 74 | the.value.for.the.variable.`fact |
| 150200 | 6f 72 69 61 6c 27 20 69 73 20 61 20 60 6c 61 6d 62 64 61 27 20 65 78 70 72 65 73 73 69 6f 6e 20 | orial'.is.a.`lambda'.expression. |
| 150220 | 77 68 6f 73 65 20 76 61 6c 75 65 20 69 73 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 74 68 61 | whose.value.is.the.procedure.tha |
| 150240 | 74 20 63 6f 6d 70 75 74 65 73 20 66 61 63 74 6f 72 69 61 6c 73 2e 20 20 60 43 6f 6d 70 69 6c 65 | t.computes.factorials...`Compile |
| 150260 | 27 20 68 61 6e 64 6c 65 73 20 74 68 69 73 20 62 79 20 63 61 6c 6c 69 6e 67 0a 60 63 6f 6d 70 69 | '.handles.this.by.calling.`compi |
| 150280 | 6c 65 2d 6c 61 6d 62 64 61 27 2c 20 77 68 69 63 68 20 63 6f 6d 70 69 6c 65 73 20 74 68 65 20 70 | le-lambda',.which.compiles.the.p |
| 1502a0 | 72 6f 63 65 64 75 72 65 20 62 6f 64 79 2c 20 6c 61 62 65 6c 73 20 69 74 20 61 73 20 61 20 6e 65 | rocedure.body,.labels.it.as.a.ne |
| 1502c0 | 77 0a 65 6e 74 72 79 20 70 6f 69 6e 74 2c 20 61 6e 64 20 67 65 6e 65 72 61 74 65 73 20 74 68 65 | w.entry.point,.and.generates.the |
| 1502e0 | 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 74 68 61 74 20 77 69 6c 6c 20 63 6f 6d 62 69 6e 65 20 74 | .instruction.that.will.combine.t |
| 150300 | 68 65 0a 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 20 61 74 20 74 68 65 20 6e 65 77 20 65 6e 74 | he.procedure.body.at.the.new.ent |
| 150320 | 72 79 20 70 6f 69 6e 74 20 77 69 74 68 20 74 68 65 20 72 75 6e 2d 74 69 6d 65 20 65 6e 76 69 72 | ry.point.with.the.run-time.envir |
| 150340 | 6f 6e 6d 65 6e 74 20 61 6e 64 0a 61 73 73 69 67 6e 20 74 68 65 20 72 65 73 75 6c 74 20 74 6f 20 | onment.and.assign.the.result.to. |
| 150360 | 60 76 61 6c 27 2e 20 20 54 68 65 20 73 65 71 75 65 6e 63 65 20 74 68 65 6e 20 73 6b 69 70 73 20 | `val'...The.sequence.then.skips. |
| 150380 | 61 72 6f 75 6e 64 20 74 68 65 0a 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 20 63 6f | around.the.compiled.procedure.co |
| 1503a0 | 64 65 2c 20 77 68 69 63 68 20 69 73 20 69 6e 73 65 72 74 65 64 20 61 74 20 74 68 69 73 20 70 6f | de,.which.is.inserted.at.this.po |
| 1503c0 | 69 6e 74 2e 20 20 54 68 65 0a 70 72 6f 63 65 64 75 72 65 20 63 6f 64 65 20 69 74 73 65 6c 66 20 | int...The.procedure.code.itself. |
| 1503e0 | 62 65 67 69 6e 73 20 62 79 20 65 78 74 65 6e 64 69 6e 67 20 74 68 65 20 70 72 6f 63 65 64 75 72 | begins.by.extending.the.procedur |
| 150400 | 65 27 73 20 64 65 66 69 6e 69 74 69 6f 6e 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 62 79 20 61 20 | e's.definition.environment.by.a. |
| 150420 | 66 72 61 6d 65 20 74 68 61 74 20 62 69 6e 64 73 20 74 68 65 20 66 6f 72 6d 61 6c 20 70 61 72 61 | frame.that.binds.the.formal.para |
| 150440 | 6d 65 74 65 72 20 60 6e 27 20 74 6f 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 61 72 67 75 6d | meter.`n'.to.the.procedure.argum |
| 150460 | 65 6e 74 2e 20 20 54 68 65 6e 20 63 6f 6d 65 73 20 74 68 65 20 61 63 74 75 61 6c 20 70 72 6f 63 | ent...Then.comes.the.actual.proc |
| 150480 | 65 64 75 72 65 20 62 6f 64 79 2e 20 20 53 69 6e 63 65 20 74 68 69 73 0a 63 6f 64 65 20 66 6f 72 | edure.body...Since.this.code.for |
| 1504a0 | 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 64 6f 65 73 6e | .the.value.of.the.variable.doesn |
| 1504c0 | 27 74 20 6d 6f 64 69 66 79 20 74 68 65 20 60 65 6e 76 27 20 72 65 67 69 73 74 65 72 2c 0a 74 68 | 't.modify.the.`env'.register,.th |
| 1504e0 | 65 20 6f 70 74 69 6f 6e 61 6c 20 60 73 61 76 65 27 20 61 6e 64 20 60 72 65 73 74 6f 72 65 27 20 | e.optional.`save'.and.`restore'. |
| 150500 | 73 68 6f 77 6e 20 61 62 6f 76 65 20 61 72 65 6e 27 74 20 67 65 6e 65 72 61 74 65 64 2e 20 20 28 | shown.above.aren't.generated...( |
| 150520 | 54 68 65 0a 70 72 6f 63 65 64 75 72 65 20 63 6f 64 65 20 61 74 20 60 65 6e 74 72 79 32 27 20 69 | The.procedure.code.at.`entry2'.i |
| 150540 | 73 6e 27 74 20 65 78 65 63 75 74 65 64 20 61 74 20 74 68 69 73 20 70 6f 69 6e 74 2c 20 73 6f 20 | sn't.executed.at.this.point,.so. |
| 150560 | 69 74 73 20 75 73 65 20 6f 66 0a 60 65 6e 76 27 20 69 73 20 69 72 72 65 6c 65 76 61 6e 74 2e 29 | its.use.of.`env'.is.irrelevant.) |
| 150580 | 20 20 54 68 65 72 65 66 6f 72 65 2c 20 74 68 65 20 73 6b 65 6c 65 74 6f 6e 20 66 6f 72 20 74 68 | ..Therefore,.the.skeleton.for.th |
| 1505a0 | 65 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 0a 62 65 63 6f 6d 65 73 0a 0a 20 20 20 20 20 28 61 | e.compiled.code.becomes.......(a |
| 1505c0 | 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 6d 61 6b 65 2d 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 | ssign.val.(op.make-compiled-proc |
| 1505e0 | 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 61 62 65 6c | edure)....................(label |
| 150600 | 20 65 6e 74 72 79 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 | .entry2)....................(reg |
| 150620 | 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 61 66 74 65 72 | .env))........(goto.(label.after |
| 150640 | 2d 6c 61 6d 62 64 61 31 29 29 0a 20 20 20 20 20 65 6e 74 72 79 32 0a 20 20 20 20 20 20 20 28 61 | -lambda1))......entry2........(a |
| 150660 | 73 73 69 67 6e 20 65 6e 76 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 | ssign.env.(op.compiled-procedure |
| 150680 | 2d 65 6e 76 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e | -env).(reg.proc))........(assign |
| 1506a0 | 20 65 6e 76 20 28 6f 70 20 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 0a 20 20 20 | .env.(op.extend-environment).... |
| 1506c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 74 20 28 6e 29 29 0a 20 20 20 20 | ................(const.(n))..... |
| 1506e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 61 72 67 6c 29 0a 20 20 20 20 20 20 | ...............(reg.argl)....... |
| 150700 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 3c | .............(reg.env))........< |
| 150720 | 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 5f 3e | _compilation.of.procedure.body_> |
| 150740 | 0a 20 20 20 20 20 61 66 74 65 72 2d 6c 61 6d 62 64 61 31 0a 20 20 20 20 20 20 20 28 70 65 72 66 | ......after-lambda1........(perf |
| 150760 | 6f 72 6d 20 28 6f 70 20 64 65 66 69 6e 65 2d 76 61 72 69 61 62 6c 65 21 29 0a 20 20 20 20 20 20 | orm.(op.define-variable!)....... |
| 150780 | 20 20 20 20 20 20 20 20 20 20 28 63 6f 6e 73 74 20 66 61 63 74 6f 72 69 61 6c 29 0a 20 20 20 20 | ..........(const.factorial)..... |
| 1507a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 76 61 6c 29 0a 20 20 20 20 20 20 20 20 20 20 | ............(reg.val)........... |
| 1507c0 | 20 20 20 20 20 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 | ......(reg.env))........(assign. |
| 1507e0 | 76 61 6c 20 28 63 6f 6e 73 74 20 6f 6b 29 29 0a 0a 20 20 20 41 20 70 72 6f 63 65 64 75 72 65 20 | val.(const.ok)).....A.procedure. |
| 150800 | 62 6f 64 79 20 69 73 20 61 6c 77 61 79 73 20 63 6f 6d 70 69 6c 65 64 20 28 62 79 20 60 63 6f 6d | body.is.always.compiled.(by.`com |
| 150820 | 70 69 6c 65 2d 6c 61 6d 62 64 61 2d 62 6f 64 79 27 29 20 61 73 20 61 0a 73 65 71 75 65 6e 63 65 | pile-lambda-body').as.a.sequence |
| 150840 | 20 77 69 74 68 20 74 61 72 67 65 74 20 60 76 61 6c 27 20 61 6e 64 20 6c 69 6e 6b 61 67 65 20 60 | .with.target.`val'.and.linkage.` |
| 150860 | 72 65 74 75 72 6e 27 2e 20 20 54 68 65 20 73 65 71 75 65 6e 63 65 20 69 6e 20 74 68 69 73 0a 63 | return'...The.sequence.in.this.c |
| 150880 | 61 73 65 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 61 20 73 69 6e 67 6c 65 20 60 69 66 27 20 65 78 | ase.consists.of.a.single.`if'.ex |
| 1508a0 | 70 72 65 73 73 69 6f 6e 3a 0a 0a 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 | pression:.......(if.(=.n.1)..... |
| 1508c0 | 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 28 2a 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d | .....1..........(*.(factorial.(- |
| 1508e0 | 20 6e 20 31 29 29 20 6e 29 29 0a 0a 20 20 20 60 43 6f 6d 70 69 6c 65 2d 69 66 27 20 67 65 6e 65 | .n.1)).n)).....`Compile-if'.gene |
| 150900 | 72 61 74 65 73 20 63 6f 64 65 20 74 68 61 74 20 66 69 72 73 74 20 63 6f 6d 70 75 74 65 73 20 74 | rates.code.that.first.computes.t |
| 150920 | 68 65 20 70 72 65 64 69 63 61 74 65 0a 28 74 61 72 67 65 74 65 64 20 74 6f 20 60 76 61 6c 27 29 | he.predicate.(targeted.to.`val') |
| 150940 | 2c 20 74 68 65 6e 20 63 68 65 63 6b 73 20 74 68 65 20 72 65 73 75 6c 74 20 61 6e 64 20 62 72 61 | ,.then.checks.the.result.and.bra |
| 150960 | 6e 63 68 65 73 20 61 72 6f 75 6e 64 20 74 68 65 0a 74 72 75 65 20 62 72 61 6e 63 68 20 69 66 20 | nches.around.the.true.branch.if. |
| 150980 | 74 68 65 20 70 72 65 64 69 63 61 74 65 20 69 73 20 66 61 6c 73 65 2e 20 20 60 45 6e 76 27 20 61 | the.predicate.is.false...`Env'.a |
| 1509a0 | 6e 64 20 60 63 6f 6e 74 69 6e 75 65 27 20 61 72 65 0a 70 72 65 73 65 72 76 65 64 20 61 72 6f 75 | nd.`continue'.are.preserved.arou |
| 1509c0 | 6e 64 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 63 6f 64 65 2c 20 73 69 6e 63 65 20 74 68 65 | nd.the.predicate.code,.since.the |
| 1509e0 | 79 20 6d 61 79 20 62 65 20 6e 65 65 64 65 64 20 66 6f 72 20 74 68 65 0a 72 65 73 74 20 6f 66 20 | y.may.be.needed.for.the.rest.of. |
| 150a00 | 74 68 65 20 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 2e 20 20 53 69 6e 63 65 20 74 68 65 20 | the.`if'.expression...Since.the. |
| 150a20 | 60 69 66 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 74 68 65 20 66 69 6e 61 6c 0a 65 78 70 | `if'.expression.is.the.final.exp |
| 150a40 | 72 65 73 73 69 6f 6e 20 28 61 6e 64 20 6f 6e 6c 79 20 65 78 70 72 65 73 73 69 6f 6e 29 20 69 6e | ression.(and.only.expression).in |
| 150a60 | 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6d 61 6b 69 6e 67 20 75 70 20 74 68 65 0a 70 72 6f 63 | .the.sequence.making.up.the.proc |
| 150a80 | 65 64 75 72 65 20 62 6f 64 79 2c 20 69 74 73 20 74 61 72 67 65 74 20 69 73 20 60 76 61 6c 27 20 | edure.body,.its.target.is.`val'. |
| 150aa0 | 61 6e 64 20 69 74 73 20 6c 69 6e 6b 61 67 65 20 69 73 20 60 72 65 74 75 72 6e 27 2c 20 73 6f 20 | and.its.linkage.is.`return',.so. |
| 150ac0 | 74 68 65 0a 74 72 75 65 20 61 6e 64 20 66 61 6c 73 65 20 62 72 61 6e 63 68 65 73 20 61 72 65 20 | the.true.and.false.branches.are. |
| 150ae0 | 62 6f 74 68 20 63 6f 6d 70 69 6c 65 64 20 77 69 74 68 20 74 61 72 67 65 74 20 60 76 61 6c 27 20 | both.compiled.with.target.`val'. |
| 150b00 | 61 6e 64 20 6c 69 6e 6b 61 67 65 0a 60 72 65 74 75 72 6e 27 2e 20 20 28 54 68 61 74 20 69 73 2c | and.linkage.`return'...(That.is, |
| 150b20 | 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 2c 20 77 | .the.value.of.the.conditional,.w |
| 150b40 | 68 69 63 68 20 69 73 20 74 68 65 20 76 61 6c 75 65 0a 63 6f 6d 70 75 74 65 64 20 62 79 20 65 69 | hich.is.the.value.computed.by.ei |
| 150b60 | 74 68 65 72 20 6f 66 20 69 74 73 20 62 72 61 6e 63 68 65 73 2c 20 69 73 20 74 68 65 20 76 61 6c | ther.of.its.branches,.is.the.val |
| 150b80 | 75 65 20 6f 66 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 2e 29 0a 0a 20 20 20 20 20 3c 5f 73 61 | ue.of.the.procedure.).......<_sa |
| 150ba0 | 76 65 20 60 63 6f 6e 74 69 6e 75 65 27 2c 20 60 65 6e 76 27 20 69 66 20 6d 6f 64 69 66 69 65 64 | ve.`continue',.`env'.if.modified |
| 150bc0 | 20 62 79 20 70 72 65 64 69 63 61 74 65 20 61 6e 64 20 6e 65 65 64 65 64 20 62 79 20 62 72 61 6e | .by.predicate.and.needed.by.bran |
| 150be0 | 63 68 65 73 5f 3e 0a 20 20 20 20 20 20 20 3c 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 70 | ches_>........<_compilation.of.p |
| 150c00 | 72 65 64 69 63 61 74 65 2c 20 74 61 72 67 65 74 20 60 76 61 6c 27 2c 20 6c 69 6e 6b 61 67 65 20 | redicate,.target.`val',.linkage. |
| 150c20 | 60 6e 65 78 74 27 5f 3e 0a 20 20 20 20 20 20 20 3c 5f 72 65 73 74 6f 72 65 20 60 63 6f 6e 74 69 | `next'_>........<_restore.`conti |
| 150c40 | 6e 75 65 27 2c 20 60 65 6e 76 27 20 69 66 20 73 61 76 65 64 20 61 62 6f 76 65 5f 3e 0a 20 20 20 | nue',.`env'.if.saved.above_>.... |
| 150c60 | 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 66 61 6c 73 65 3f 29 20 28 72 65 67 20 76 61 6c 29 29 | ....(test.(op.false?).(reg.val)) |
| 150c80 | 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 66 61 6c 73 65 2d 62 72 61 | ........(branch.(label.false-bra |
| 150ca0 | 6e 63 68 34 29 29 0a 20 20 20 20 20 74 72 75 65 2d 62 72 61 6e 63 68 35 0a 20 20 20 20 20 20 20 | nch4))......true-branch5........ |
| 150cc0 | 3c 5f 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 74 72 75 65 20 62 72 61 6e 63 68 2c 20 74 61 | <_compilation.of.true.branch,.ta |
| 150ce0 | 72 67 65 74 20 60 76 61 6c 27 2c 20 6c 69 6e 6b 61 67 65 20 60 72 65 74 75 72 6e 27 5f 3e 0a 20 | rget.`val',.linkage.`return'_>.. |
| 150d00 | 20 20 20 20 66 61 6c 73 65 2d 62 72 61 6e 63 68 34 0a 20 20 20 20 20 20 20 3c 5f 63 6f 6d 70 69 | ....false-branch4........<_compi |
| 150d20 | 6c 61 74 69 6f 6e 20 6f 66 20 66 61 6c 73 65 20 62 72 61 6e 63 68 2c 20 74 61 72 67 65 74 20 60 | lation.of.false.branch,.target.` |
| 150d40 | 76 61 6c 27 2c 20 6c 69 6e 6b 61 67 65 20 60 72 65 74 75 72 6e 27 5f 3e 0a 20 20 20 20 20 61 66 | val',.linkage.`return'_>......af |
| 150d60 | 74 65 72 2d 69 66 33 0a 0a 20 20 20 54 68 65 20 70 72 65 64 69 63 61 74 65 20 60 28 3d 20 6e 20 | ter-if3.....The.predicate.`(=.n. |
| 150d80 | 31 29 27 20 69 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 2e 20 20 54 68 69 73 20 6c | 1)'.is.a.procedure.call...This.l |
| 150da0 | 6f 6f 6b 73 20 75 70 20 74 68 65 0a 6f 70 65 72 61 74 6f 72 20 28 74 68 65 20 73 79 6d 62 6f 6c | ooks.up.the.operator.(the.symbol |
| 150dc0 | 20 60 3d 27 29 20 61 6e 64 20 70 6c 61 63 65 73 20 74 68 69 73 20 76 61 6c 75 65 20 69 6e 20 60 | .`=').and.places.this.value.in.` |
| 150de0 | 70 72 6f 63 27 2e 20 20 49 74 20 74 68 65 6e 0a 61 73 73 65 6d 62 6c 65 73 20 74 68 65 20 61 72 | proc'...It.then.assembles.the.ar |
| 150e00 | 67 75 6d 65 6e 74 73 20 60 31 27 20 61 6e 64 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 60 6e 27 | guments.`1'.and.the.value.of.`n' |
| 150e20 | 20 69 6e 74 6f 20 60 61 72 67 6c 27 2e 20 20 54 68 65 6e 20 69 74 0a 74 65 73 74 73 20 77 68 65 | .into.`argl'...Then.it.tests.whe |
| 150e40 | 74 68 65 72 20 60 70 72 6f 63 27 20 63 6f 6e 74 61 69 6e 73 20 61 20 70 72 69 6d 69 74 69 76 65 | ther.`proc'.contains.a.primitive |
| 150e60 | 20 6f 72 20 61 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 75 72 65 2c 20 61 6e 64 0a 64 69 | .or.a.compound.procedure,.and.di |
| 150e80 | 73 70 61 74 63 68 65 73 20 74 6f 20 61 20 70 72 69 6d 69 74 69 76 65 20 62 72 61 6e 63 68 20 6f | spatches.to.a.primitive.branch.o |
| 150ea0 | 72 20 61 20 63 6f 6d 70 6f 75 6e 64 20 62 72 61 6e 63 68 20 61 63 63 6f 72 64 69 6e 67 6c 79 2e | r.a.compound.branch.accordingly. |
| 150ec0 | 20 20 42 6f 74 68 0a 62 72 61 6e 63 68 65 73 20 72 65 73 75 6d 65 20 61 74 20 74 68 65 20 60 61 | ..Both.branches.resume.at.the.`a |
| 150ee0 | 66 74 65 72 2d 63 61 6c 6c 27 20 6c 61 62 65 6c 2e 20 20 54 68 65 20 72 65 71 75 69 72 65 6d 65 | fter-call'.label...The.requireme |
| 150f00 | 6e 74 73 20 74 6f 20 70 72 65 73 65 72 76 65 0a 72 65 67 69 73 74 65 72 73 20 61 72 6f 75 6e 64 | nts.to.preserve.registers.around |
| 150f20 | 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 6f 70 65 72 61 74 6f 72 20 | .the.evaluation.of.the.operator. |
| 150f40 | 61 6e 64 20 6f 70 65 72 61 6e 64 73 20 64 6f 6e 27 74 0a 72 65 73 75 6c 74 20 69 6e 20 61 6e 79 | and.operands.don't.result.in.any |
| 150f60 | 20 73 61 76 69 6e 67 20 6f 66 20 72 65 67 69 73 74 65 72 73 2c 20 62 65 63 61 75 73 65 20 69 6e | .saving.of.registers,.because.in |
| 150f80 | 20 74 68 69 73 20 63 61 73 65 20 74 68 6f 73 65 0a 65 76 61 6c 75 61 74 69 6f 6e 73 20 64 6f 6e | .this.case.those.evaluations.don |
| 150fa0 | 27 74 20 6d 6f 64 69 66 79 20 74 68 65 20 72 65 67 69 73 74 65 72 73 20 69 6e 20 71 75 65 73 74 | 't.modify.the.registers.in.quest |
| 150fc0 | 69 6f 6e 2e 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 70 72 6f 63 0a 20 20 20 20 20 20 20 20 | ion........(assign.proc......... |
| 150fe0 | 20 20 20 20 20 20 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 | .......(op.lookup-variable-value |
| 151000 | 29 20 28 63 6f 6e 73 74 20 3d 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 28 61 | ).(const.=).(reg.env))........(a |
| 151020 | 73 73 69 67 6e 20 76 61 6c 20 28 63 6f 6e 73 74 20 31 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 | ssign.val.(const.1))........(ass |
| 151040 | 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 6c 69 73 74 29 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 | ign.argl.(op.list).(reg.val))... |
| 151060 | 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 | .....(assign.val.(op.lookup-vari |
| 151080 | 61 62 6c 65 2d 76 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 6e 29 20 28 72 65 67 20 65 6e 76 29 29 | able-value).(const.n).(reg.env)) |
| 1510a0 | 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 63 6f 6e 73 29 20 28 | ........(assign.argl.(op.cons).( |
| 1510c0 | 72 65 67 20 76 61 6c 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 20 28 74 65 73 | reg.val).(reg.argl))........(tes |
| 1510e0 | 74 20 28 6f 70 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 67 | t.(op.primitive-procedure?).(reg |
| 151100 | 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 70 72 | .proc))........(branch.(label.pr |
| 151120 | 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 31 37 29 29 0a 20 20 20 20 20 63 6f 6d 70 69 6c 65 64 | imitive-branch17))......compiled |
| 151140 | 2d 62 72 61 6e 63 68 31 36 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 | -branch16........(assign.continu |
| 151160 | 65 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 63 61 6c 6c 31 35 29 29 0a 20 20 20 20 20 20 20 28 | e.(label.after-call15))........( |
| 151180 | 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 | assign.val.(op.compiled-procedur |
| 1511a0 | 65 2d 65 6e 74 72 79 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 | e-entry).(reg.proc))........(got |
| 1511c0 | 6f 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e | o.(reg.val))......primitive-bran |
| 1511e0 | 63 68 31 37 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 61 70 70 6c | ch17........(assign.val.(op.appl |
| 151200 | 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 29 0a 20 20 20 20 20 20 20 20 20 | y-primitive-procedure).......... |
| 151220 | 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ..........(reg.proc)............ |
| 151240 | 20 20 20 20 20 20 20 20 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 61 66 74 65 72 2d 63 | ........(reg.argl))......after-c |
| 151260 | 61 6c 6c 31 35 0a 0a 20 20 20 54 68 65 20 74 72 75 65 20 62 72 61 6e 63 68 2c 20 77 68 69 63 68 | all15.....The.true.branch,.which |
| 151280 | 20 69 73 20 74 68 65 20 63 6f 6e 73 74 61 6e 74 20 31 2c 20 63 6f 6d 70 69 6c 65 73 20 28 77 69 | .is.the.constant.1,.compiles.(wi |
| 1512a0 | 74 68 20 74 61 72 67 65 74 0a 60 76 61 6c 27 20 61 6e 64 20 6c 69 6e 6b 61 67 65 20 60 72 65 74 | th.target.`val'.and.linkage.`ret |
| 1512c0 | 75 72 6e 27 29 20 74 6f 0a 0a 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 63 6f 6e 73 | urn').to.......(assign.val.(cons |
| 1512e0 | 74 20 31 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 | t.1))........(goto.(reg.continue |
| 151300 | 29 29 0a 0a 20 20 20 54 68 65 20 63 6f 64 65 20 66 6f 72 20 74 68 65 20 66 61 6c 73 65 20 62 72 | )).....The.code.for.the.false.br |
| 151320 | 61 6e 63 68 20 69 73 20 61 6e 6f 74 68 65 72 20 61 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c | anch.is.another.a.procedure.call |
| 151340 | 2c 20 77 68 65 72 65 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 20 69 73 20 74 68 65 20 76 61 6c | ,.where.the.procedure.is.the.val |
| 151360 | 75 65 20 6f 66 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 2a 27 2c 20 61 6e 64 20 74 68 65 20 61 72 | ue.of.the.symbol.`*',.and.the.ar |
| 151380 | 67 75 6d 65 6e 74 73 20 61 72 65 20 60 6e 27 20 61 6e 64 0a 74 68 65 20 72 65 73 75 6c 74 20 6f | guments.are.`n'.and.the.result.o |
| 1513a0 | 66 20 61 6e 6f 74 68 65 72 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 20 28 61 20 63 61 6c 6c | f.another.procedure.call.(a.call |
| 1513c0 | 20 74 6f 20 60 66 61 63 74 6f 72 69 61 6c 27 29 2e 20 20 45 61 63 68 20 6f 66 0a 74 68 65 73 65 | .to.`factorial')...Each.of.these |
| 1513e0 | 20 63 61 6c 6c 73 20 73 65 74 73 20 75 70 20 60 70 72 6f 63 27 20 61 6e 64 20 60 61 72 67 6c 27 | .calls.sets.up.`proc'.and.`argl' |
| 151400 | 20 61 6e 64 20 69 74 73 20 6f 77 6e 20 70 72 69 6d 69 74 69 76 65 20 61 6e 64 20 63 6f 6d 70 6f | .and.its.own.primitive.and.compo |
| 151420 | 75 6e 64 0a 62 72 61 6e 63 68 65 73 2e 20 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 37 | und.branches...*Note.Figure.5-17 |
| 151440 | 3a 3a 20 73 68 6f 77 73 20 74 68 65 20 63 6f 6d 70 6c 65 74 65 20 63 6f 6d 70 69 6c 61 74 69 6f | ::.shows.the.complete.compilatio |
| 151460 | 6e 20 6f 66 20 74 68 65 0a 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 60 66 61 63 74 | n.of.the.definition.of.the.`fact |
| 151480 | 6f 72 69 61 6c 27 20 70 72 6f 63 65 64 75 72 65 2e 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 74 | orial'.procedure...Notice.that.t |
| 1514a0 | 68 65 20 70 6f 73 73 69 62 6c 65 0a 60 73 61 76 65 27 20 61 6e 64 20 60 72 65 73 74 6f 72 65 27 | he.possible.`save'.and.`restore' |
| 1514c0 | 20 6f 66 20 60 63 6f 6e 74 69 6e 75 65 27 20 61 6e 64 20 60 65 6e 76 27 20 61 72 6f 75 6e 64 20 | .of.`continue'.and.`env'.around. |
| 1514e0 | 74 68 65 20 70 72 65 64 69 63 61 74 65 2c 20 73 68 6f 77 6e 0a 61 62 6f 76 65 2c 20 61 72 65 20 | the.predicate,.shown.above,.are. |
| 151500 | 69 6e 20 66 61 63 74 20 67 65 6e 65 72 61 74 65 64 2c 20 62 65 63 61 75 73 65 20 74 68 65 73 65 | in.fact.generated,.because.these |
| 151520 | 20 72 65 67 69 73 74 65 72 73 20 61 72 65 20 6d 6f 64 69 66 69 65 64 20 62 79 0a 74 68 65 20 70 | .registers.are.modified.by.the.p |
| 151540 | 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 20 69 6e 20 74 68 65 20 70 72 65 64 69 63 61 74 65 20 61 | rocedure.call.in.the.predicate.a |
| 151560 | 6e 64 20 6e 65 65 64 65 64 20 66 6f 72 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c | nd.needed.for.the.procedure.call |
| 151580 | 0a 61 6e 64 20 74 68 65 20 60 72 65 74 75 72 6e 27 20 6c 69 6e 6b 61 67 65 20 69 6e 20 74 68 65 | .and.the.`return'.linkage.in.the |
| 1515a0 | 20 62 72 61 6e 63 68 65 73 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 33 33 3a | .branches........*Exercise.5.33: |
| 1515c0 | 2a 20 43 6f 6e 73 69 64 65 72 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 | *.Consider.the.following.definit |
| 1515e0 | 69 6f 6e 20 6f 66 20 61 20 66 61 63 74 6f 72 69 61 6c 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 | ion.of.a.factorial......procedur |
| 151600 | 65 2c 20 77 68 69 63 68 20 69 73 20 73 6c 69 67 68 74 6c 79 20 64 69 66 66 65 72 65 6e 74 20 66 | e,.which.is.slightly.different.f |
| 151620 | 72 6f 6d 20 74 68 65 20 6f 6e 65 20 67 69 76 65 6e 20 61 62 6f 76 65 3a 0a 0a 20 20 20 20 20 20 | rom.the.one.given.above:........ |
| 151640 | 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 2d 61 6c 74 20 6e 29 0a 20 20 | ....(define.(factorial-alt.n)... |
| 151660 | 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 | ..........(if.(=.n.1)........... |
| 151680 | 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 6e 20 28 66 61 | ......1.................(*.n.(fa |
| 1516a0 | 63 74 6f 72 69 61 6c 2d 61 6c 74 20 28 2d 20 6e 20 31 29 29 29 29 29 0a 0a 20 20 20 20 20 43 6f | ctorial-alt.(-.n.1))))).......Co |
| 1516c0 | 6d 70 69 6c 65 20 74 68 69 73 20 70 72 6f 63 65 64 75 72 65 20 61 6e 64 20 63 6f 6d 70 61 72 65 | mpile.this.procedure.and.compare |
| 1516e0 | 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 63 6f 64 65 20 77 69 74 68 20 74 68 61 74 0a 20 20 | .the.resulting.code.with.that... |
| 151700 | 20 20 20 70 72 6f 64 75 63 65 64 20 66 6f 72 20 60 66 61 63 74 6f 72 69 61 6c 27 2e 20 20 45 78 | ...produced.for.`factorial'...Ex |
| 151720 | 70 6c 61 69 6e 20 61 6e 79 20 64 69 66 66 65 72 65 6e 63 65 73 20 79 6f 75 20 66 69 6e 64 2e 20 | plain.any.differences.you.find.. |
| 151740 | 20 44 6f 65 73 0a 20 20 20 20 20 65 69 74 68 65 72 20 70 72 6f 67 72 61 6d 20 65 78 65 63 75 74 | .Does......either.program.execut |
| 151760 | 65 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 6c 79 20 74 68 61 6e 20 74 68 65 20 6f 74 68 65 | e.more.efficiently.than.the.othe |
| 151780 | 72 3f 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 33 34 3a 2a 20 43 6f 6d 70 69 6c | r?.......*Exercise.5.34:*.Compil |
| 1517a0 | 65 20 74 68 65 20 69 74 65 72 61 74 69 76 65 20 66 61 63 74 6f 72 69 61 6c 20 70 72 6f 63 65 64 | e.the.iterative.factorial.proced |
| 1517c0 | 75 72 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 | ure............(define.(factoria |
| 1517e0 | 6c 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 69 74 65 72 20 70 | l.n).............(define.(iter.p |
| 151800 | 72 6f 64 75 63 74 20 63 6f 75 6e 74 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 | roduct.counter)...............(i |
| 151820 | 66 20 28 3e 20 63 6f 75 6e 74 65 72 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | f.(>.counter.n)................. |
| 151840 | 20 20 70 72 6f 64 75 63 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 | ..product...................(ite |
| 151860 | 72 20 28 2a 20 63 6f 75 6e 74 65 72 20 70 72 6f 64 75 63 74 29 0a 20 20 20 20 20 20 20 20 20 20 | r.(*.counter.product)........... |
| 151880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 63 6f 75 6e 74 65 72 20 31 29 29 29 29 0a 20 | ..............(+.counter.1)))).. |
| 1518a0 | 20 20 20 20 20 20 20 20 20 20 20 28 69 74 65 72 20 31 20 31 29 29 0a 0a 20 20 20 20 20 41 6e 6e | ...........(iter.1.1)).......Ann |
| 1518c0 | 6f 74 61 74 65 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 63 6f 64 65 2c 20 73 68 6f 77 69 6e | otate.the.resulting.code,.showin |
| 1518e0 | 67 20 74 68 65 20 65 73 73 65 6e 74 69 61 6c 20 64 69 66 66 65 72 65 6e 63 65 0a 20 20 20 20 20 | g.the.essential.difference...... |
| 151900 | 62 65 74 77 65 65 6e 20 74 68 65 20 63 6f 64 65 20 66 6f 72 20 69 74 65 72 61 74 69 76 65 20 61 | between.the.code.for.iterative.a |
| 151920 | 6e 64 20 72 65 63 75 72 73 69 76 65 20 76 65 72 73 69 6f 6e 73 20 6f 66 0a 20 20 20 20 20 60 66 | nd.recursive.versions.of......`f |
| 151940 | 61 63 74 6f 72 69 61 6c 27 20 74 68 61 74 20 6d 61 6b 65 73 20 6f 6e 65 20 70 72 6f 63 65 73 73 | actorial'.that.makes.one.process |
| 151960 | 20 62 75 69 6c 64 20 75 70 20 73 74 61 63 6b 20 73 70 61 63 65 20 61 6e 64 20 74 68 65 0a 20 20 | .build.up.stack.space.and.the... |
| 151980 | 20 20 20 6f 74 68 65 72 20 72 75 6e 20 69 6e 20 63 6f 6e 73 74 61 6e 74 20 73 74 61 63 6b 20 73 | ...other.run.in.constant.stack.s |
| 1519a0 | 70 61 63 65 2e 0a 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 31 37 3a 2a 20 43 6f 6d 70 69 | pace........*Figure.5.17:*.Compi |
| 1519c0 | 6c 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 | lation.of.the.definition.of.the. |
| 1519e0 | 60 66 61 63 74 6f 72 69 61 6c 27 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 20 | `factorial'......procedure...... |
| 151a00 | 20 20 20 20 20 20 3b 3b 20 63 6f 6e 73 74 72 75 63 74 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 | ......;;.construct.the.procedure |
| 151a20 | 20 61 6e 64 20 73 6b 69 70 20 6f 76 65 72 20 63 6f 64 65 20 66 6f 72 20 74 68 65 20 70 72 6f 63 | .and.skip.over.code.for.the.proc |
| 151a40 | 65 64 75 72 65 20 62 6f 64 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 | edure.body.............(assign.v |
| 151a60 | 61 6c 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 20 6d 61 6b 65 2d | al.....................(op.make- |
| 151a80 | 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 29 20 28 6c 61 62 65 6c 20 65 6e 74 72 79 | compiled-procedure).(label.entry |
| 151aa0 | 32 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 | 2).(reg.env)).............(goto. |
| 151ac0 | 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 6c 61 6d 62 64 61 31 29 29 0a 0a 20 20 20 20 20 20 20 20 | (label.after-lambda1)).......... |
| 151ae0 | 20 20 65 6e 74 72 79 32 20 20 20 20 20 3b 20 63 61 6c 6c 73 20 74 6f 20 60 66 61 63 74 6f 72 69 | ..entry2.....;.calls.to.`factori |
| 151b00 | 61 6c 27 20 77 69 6c 6c 20 65 6e 74 65 72 20 68 65 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | al'.will.enter.here............. |
| 151b20 | 28 61 73 73 69 67 6e 20 65 6e 76 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 | (assign.env.(op.compiled-procedu |
| 151b40 | 72 65 2d 65 6e 76 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 | re-env).(reg.proc))............. |
| 151b60 | 28 61 73 73 69 67 6e 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (assign.env..................... |
| 151b80 | 28 6f 70 20 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 20 28 63 6f 6e 73 74 20 28 | (op.extend-environment).(const.( |
| 151ba0 | 6e 29 29 20 28 72 65 67 20 61 72 67 6c 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 | n)).(reg.argl).(reg.env))....... |
| 151bc0 | 20 20 20 20 3b 3b 20 62 65 67 69 6e 20 61 63 74 75 61 6c 20 70 72 6f 63 65 64 75 72 65 20 62 6f | ....;;.begin.actual.procedure.bo |
| 151be0 | 64 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 | dy.............(save.continue).. |
| 151c00 | 20 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 65 6e 76 29 0a 0a 20 20 20 20 20 20 20 20 20 | ...........(save.env)........... |
| 151c20 | 20 3b 3b 20 63 6f 6d 70 75 74 65 20 60 28 3d 20 6e 20 31 29 27 0a 20 20 20 20 20 20 20 20 20 20 | .;;.compute.`(=.n.1)'........... |
| 151c40 | 20 20 28 61 73 73 69 67 6e 20 70 72 6f 63 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 | ..(assign.proc.(op.lookup-variab |
| 151c60 | 6c 65 2d 76 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 3d 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 | le-value).(const.=).(reg.env)).. |
| 151c80 | 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 63 6f 6e 73 74 20 31 29 | ...........(assign.val.(const.1) |
| 151ca0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 6c | ).............(assign.argl.(op.l |
| 151cc0 | 69 73 74 29 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 | ist).(reg.val)).............(ass |
| 151ce0 | 69 67 6e 20 76 61 6c 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 | ign.val.(op.lookup-variable-valu |
| 151d00 | 65 29 20 28 63 6f 6e 73 74 20 6e 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 | e).(const.n).(reg.env))......... |
| 151d20 | 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 63 6f 6e 73 29 20 28 72 65 67 20 | ....(assign.argl.(op.cons).(reg. |
| 151d40 | 76 61 6c 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 | val).(reg.argl)).............(te |
| 151d60 | 73 74 20 28 6f 70 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 | st.(op.primitive-procedure?).(re |
| 151d80 | 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 | g.proc)).............(branch.(la |
| 151da0 | 62 65 6c 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 31 37 29 29 0a 20 20 20 20 20 20 20 | bel.primitive-branch17))........ |
| 151dc0 | 20 20 20 63 6f 6d 70 69 6c 65 64 2d 62 72 61 6e 63 68 31 36 0a 20 20 20 20 20 20 20 20 20 20 20 | ...compiled-branch16............ |
| 151de0 | 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 63 | .(assign.continue.(label.after-c |
| 151e00 | 61 6c 6c 31 35 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 | all15)).............(assign.val. |
| 151e20 | 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 28 72 | (op.compiled-procedure-entry).(r |
| 151e40 | 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 | eg.proc)).............(goto.(reg |
| 151e60 | 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 | .val))...........primitive-branc |
| 151e80 | 68 31 37 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 | h17.............(assign.val.(op. |
| 151ea0 | 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 29 20 28 72 65 67 20 | apply-primitive-procedure).(reg. |
| 151ec0 | 70 72 6f 63 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 | proc).(reg.argl))............aft |
| 151ee0 | 65 72 2d 63 61 6c 6c 31 35 20 20 20 3b 20 60 76 61 6c 27 20 6e 6f 77 20 63 6f 6e 74 61 69 6e 73 | er-call15...;.`val'.now.contains |
| 151f00 | 20 72 65 73 75 6c 74 20 6f 66 20 60 28 3d 20 6e 20 31 29 27 0a 20 20 20 20 20 20 20 20 20 20 20 | .result.of.`(=.n.1)'............ |
| 151f20 | 20 28 72 65 73 74 6f 72 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 | .(restore.env).............(rest |
| 151f40 | 6f 72 65 20 63 6f 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 | ore.continue).............(test. |
| 151f60 | 28 6f 70 20 66 61 6c 73 65 3f 29 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 | (op.false?).(reg.val)).......... |
| 151f80 | 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 66 61 6c 73 65 2d 62 72 61 6e 63 68 34 29 | ...(branch.(label.false-branch4) |
| 151fa0 | 29 0a 20 20 20 20 20 20 20 20 20 20 74 72 75 65 2d 62 72 61 6e 63 68 35 20 20 3b 20 72 65 74 75 | )...........true-branch5..;.retu |
| 151fc0 | 72 6e 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 63 6f | rn.1.............(assign.val.(co |
| 151fe0 | 6e 73 74 20 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 | nst.1)).............(goto.(reg.c |
| 152000 | 6f 6e 74 69 6e 75 65 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 66 61 6c 73 65 2d 62 72 61 6e 63 | ontinue))............false-branc |
| 152020 | 68 34 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 6f 6d 70 75 74 65 20 61 6e 64 20 72 65 74 75 | h4...........;;.compute.and.retu |
| 152040 | 72 6e 20 60 28 2a 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 27 0a 20 | rn.`(*.(factorial.(-.n.1)).n)'.. |
| 152060 | 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 70 72 6f 63 20 28 6f 70 20 6c 6f 6f 6b | ...........(assign.proc.(op.look |
| 152080 | 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 2a 29 20 28 72 65 | up-variable-value).(const.*).(re |
| 1520a0 | 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 63 6f 6e 74 69 6e | g.env)).............(save.contin |
| 1520c0 | 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 70 72 6f 63 29 20 20 20 3b 20 | ue).............(save.proc)...;. |
| 1520e0 | 73 61 76 65 20 60 2a 27 20 70 72 6f 63 65 64 75 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | save.`*'.procedure.............( |
| 152100 | 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 | assign.val.(op.lookup-variable-v |
| 152120 | 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 6e 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 | alue).(const.n).(reg.env))...... |
| 152140 | 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 6c 69 73 74 29 20 28 72 | .......(assign.argl.(op.list).(r |
| 152160 | 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 61 72 67 6c 29 | eg.val)).............(save.argl) |
| 152180 | 20 20 20 3b 20 73 61 76 65 20 70 61 72 74 69 61 6c 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 | ...;.save.partial.argument.list. |
| 1521a0 | 66 6f 72 20 60 2a 27 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 20 63 6f 6d 70 75 74 65 20 60 28 | for.`*'............;;.compute.`( |
| 1521c0 | 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 27 2c 20 77 68 69 63 68 20 69 73 20 74 68 | factorial.(-.n.1))',.which.is.th |
| 1521e0 | 65 20 6f 74 68 65 72 20 61 72 67 75 6d 65 6e 74 20 66 6f 72 20 60 2a 27 0a 20 20 20 20 20 20 20 | e.other.argument.for.`*'........ |
| 152200 | 20 20 20 20 20 28 61 73 73 69 67 6e 20 70 72 6f 63 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .....(assign.proc............... |
| 152220 | 20 20 20 20 20 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 29 | ......(op.lookup-variable-value) |
| 152240 | 20 28 63 6f 6e 73 74 20 66 61 63 74 6f 72 69 61 6c 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 | .(const.factorial).(reg.env))... |
| 152260 | 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 70 72 6f 63 29 20 20 3b 20 73 61 76 65 20 60 66 | ..........(save.proc)..;.save.`f |
| 152280 | 61 63 74 6f 72 69 61 6c 27 20 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 20 20 20 20 20 20 20 3b | actorial'.procedure............; |
| 1522a0 | 3b 20 63 6f 6d 70 75 74 65 20 60 28 2d 20 6e 20 31 29 27 2c 20 77 68 69 63 68 20 69 73 20 74 68 | ;.compute.`(-.n.1)',.which.is.th |
| 1522c0 | 65 20 61 72 67 75 6d 65 6e 74 20 66 6f 72 20 60 66 61 63 74 6f 72 69 61 6c 27 0a 20 20 20 20 20 | e.argument.for.`factorial'...... |
| 1522e0 | 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 70 72 6f 63 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 | .......(assign.proc.(op.lookup-v |
| 152300 | 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 2d 29 20 28 72 65 67 20 65 6e | ariable-value).(const.-).(reg.en |
| 152320 | 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 63 6f 6e | v)).............(assign.val.(con |
| 152340 | 73 74 20 31 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 | st.1)).............(assign.argl. |
| 152360 | 28 6f 70 20 6c 69 73 74 29 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (op.list).(reg.val))............ |
| 152380 | 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 | .(assign.val.(op.lookup-variable |
| 1523a0 | 2d 76 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 6e 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 | -value).(const.n).(reg.env)).... |
| 1523c0 | 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 63 6f 6e 73 29 20 | .........(assign.argl.(op.cons). |
| 1523e0 | 28 72 65 67 20 76 61 6c 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 | (reg.val).(reg.argl))........... |
| 152400 | 20 20 28 74 65 73 74 20 28 6f 70 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f | ..(test.(op.primitive-procedure? |
| 152420 | 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 | ).(reg.proc)).............(branc |
| 152440 | 68 20 28 6c 61 62 65 6c 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 38 29 29 0a 20 20 20 | h.(label.primitive-branch8)).... |
| 152460 | 20 20 20 20 20 20 20 63 6f 6d 70 69 6c 65 64 2d 62 72 61 6e 63 68 37 0a 20 20 20 20 20 20 20 20 | .......compiled-branch7......... |
| 152480 | 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 61 66 74 65 | ....(assign.continue.(label.afte |
| 1524a0 | 72 2d 63 61 6c 6c 36 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 | r-call6)).............(assign.va |
| 1524c0 | 6c 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 | l.(op.compiled-procedure-entry). |
| 1524e0 | 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 | (reg.proc)).............(goto.(r |
| 152500 | 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 | eg.val))...........primitive-bra |
| 152520 | 6e 63 68 38 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 | nch8.............(assign.val.(op |
| 152540 | 20 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 29 20 28 72 65 67 | .apply-primitive-procedure).(reg |
| 152560 | 20 70 72 6f 63 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 61 66 | .proc).(reg.argl))............af |
| 152580 | 74 65 72 2d 63 61 6c 6c 36 20 20 20 3b 20 60 76 61 6c 27 20 6e 6f 77 20 63 6f 6e 74 61 69 6e 73 | ter-call6...;.`val'.now.contains |
| 1525a0 | 20 72 65 73 75 6c 74 20 6f 66 20 60 28 2d 20 6e 20 31 29 27 0a 20 20 20 20 20 20 20 20 20 20 20 | .result.of.`(-.n.1)'............ |
| 1525c0 | 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 6c 69 73 74 29 20 28 72 65 67 20 76 61 6c | .(assign.argl.(op.list).(reg.val |
| 1525e0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 70 72 6f 63 29 20 3b 20 | )).............(restore.proc).;. |
| 152600 | 72 65 73 74 6f 72 65 20 60 66 61 63 74 6f 72 69 61 6c 27 0a 20 20 20 20 20 20 20 20 20 20 3b 3b | restore.`factorial'...........;; |
| 152620 | 20 61 70 70 6c 79 20 60 66 61 63 74 6f 72 69 61 6c 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | .apply.`factorial'.............( |
| 152640 | 74 65 73 74 20 28 6f 70 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 | test.(op.primitive-procedure?).( |
| 152660 | 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 | reg.proc)).............(branch.( |
| 152680 | 6c 61 62 65 6c 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 31 31 29 29 0a 20 20 20 20 20 | label.primitive-branch11))...... |
| 1526a0 | 20 20 20 20 20 63 6f 6d 70 69 6c 65 64 2d 62 72 61 6e 63 68 31 30 0a 20 20 20 20 20 20 20 20 20 | .....compiled-branch10.......... |
| 1526c0 | 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 61 66 74 65 72 | ...(assign.continue.(label.after |
| 1526e0 | 2d 63 61 6c 6c 39 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c | -call9)).............(assign.val |
| 152700 | 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 28 | .(op.compiled-procedure-entry).( |
| 152720 | 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 | reg.proc)).............(goto.(re |
| 152740 | 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e | g.val))...........primitive-bran |
| 152760 | 63 68 31 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 | ch11.............(assign.val.(op |
| 152780 | 20 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 29 20 28 72 65 67 | .apply-primitive-procedure).(reg |
| 1527a0 | 20 70 72 6f 63 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 61 66 | .proc).(reg.argl))............af |
| 1527c0 | 74 65 72 2d 63 61 6c 6c 39 20 20 20 20 20 20 3b 20 60 76 61 6c 27 20 6e 6f 77 20 63 6f 6e 74 61 | ter-call9......;.`val'.now.conta |
| 1527e0 | 69 6e 73 20 72 65 73 75 6c 74 20 6f 66 20 60 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 | ins.result.of.`(factorial.(-.n.1 |
| 152800 | 29 29 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 61 72 67 6c 29 20 3b | ))'.............(restore.argl).; |
| 152820 | 20 72 65 73 74 6f 72 65 20 70 61 72 74 69 61 6c 20 61 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 66 | .restore.partial.argument.list.f |
| 152840 | 6f 72 20 60 2a 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 | or.`*'.............(assign.argl. |
| 152860 | 28 6f 70 20 63 6f 6e 73 29 20 28 72 65 67 20 76 61 6c 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a | (op.cons).(reg.val).(reg.argl)). |
| 152880 | 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 70 72 6f 63 29 20 3b 20 72 65 73 | ............(restore.proc).;.res |
| 1528a0 | 74 6f 72 65 20 60 2a 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f | tore.`*'.............(restore.co |
| 1528c0 | 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 20 61 70 70 6c 79 20 60 2a 27 20 61 | ntinue)...........;;.apply.`*'.a |
| 1528e0 | 6e 64 20 72 65 74 75 72 6e 20 69 74 73 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 | nd.return.its.value............. |
| 152900 | 28 74 65 73 74 20 28 6f 70 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 | (test.(op.primitive-procedure?). |
| 152920 | 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 | (reg.proc)).............(branch. |
| 152940 | 28 6c 61 62 65 6c 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 31 34 29 29 0a 20 20 20 20 | (label.primitive-branch14))..... |
| 152960 | 20 20 20 20 20 20 63 6f 6d 70 69 6c 65 64 2d 62 72 61 6e 63 68 31 33 0a 20 20 20 20 20 20 20 20 | ......compiled-branch13......... |
| 152980 | 20 20 3b 3b 20 6e 6f 74 65 20 74 68 61 74 20 61 20 63 6f 6d 70 6f 75 6e 64 20 70 72 6f 63 65 64 | ..;;.note.that.a.compound.proced |
| 1529a0 | 75 72 65 20 68 65 72 65 20 69 73 20 63 61 6c 6c 65 64 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 | ure.here.is.called.tail-recursiv |
| 1529c0 | 65 6c 79 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 | ely.............(assign.val.(op. |
| 1529e0 | 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 28 72 65 67 20 70 | compiled-procedure-entry).(reg.p |
| 152a00 | 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 76 61 6c | roc)).............(goto.(reg.val |
| 152a20 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 31 34 0a | ))...........primitive-branch14. |
| 152a40 | 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 61 70 70 6c | ............(assign.val.(op.appl |
| 152a60 | 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 29 20 28 72 65 67 20 70 72 6f 63 | y-primitive-procedure).(reg.proc |
| 152a80 | 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 | ).(reg.argl)).............(goto. |
| 152aa0 | 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d | (reg.continue))...........after- |
| 152ac0 | 63 61 6c 6c 31 32 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 69 66 33 0a 20 20 20 20 20 | call12...........after-if3...... |
| 152ae0 | 20 20 20 20 20 61 66 74 65 72 2d 6c 61 6d 62 64 61 31 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 20 | .....after-lambda1...........;;. |
| 152b00 | 61 73 73 69 67 6e 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 74 68 65 20 76 61 72 69 | assign.the.procedure.to.the.vari |
| 152b20 | 61 62 6c 65 20 60 66 61 63 74 6f 72 69 61 6c 27 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 70 65 | able.`factorial'.............(pe |
| 152b40 | 72 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6f 70 20 64 65 66 69 6e 65 2d 76 61 | rform..............(op.define-va |
| 152b60 | 72 69 61 62 6c 65 21 29 20 28 63 6f 6e 73 74 20 66 61 63 74 6f 72 69 61 6c 29 20 28 72 65 67 20 | riable!).(const.factorial).(reg. |
| 152b80 | 76 61 6c 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 | val).(reg.env)).............(ass |
| 152ba0 | 69 67 6e 20 76 61 6c 20 28 63 6f 6e 73 74 20 6f 6b 29 29 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 | ign.val.(const.ok))........*Exer |
| 152bc0 | 63 69 73 65 20 35 2e 33 35 3a 2a 20 57 68 61 74 20 65 78 70 72 65 73 73 69 6f 6e 20 77 61 73 20 | cise.5.35:*.What.expression.was. |
| 152be0 | 63 6f 6d 70 69 6c 65 64 20 74 6f 20 70 72 6f 64 75 63 65 20 74 68 65 20 63 6f 64 65 0a 20 20 20 | compiled.to.produce.the.code.... |
| 152c00 | 20 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 38 3a 3a 3f 0a | ..shown.in.*Note.Figure.5-18::?. |
| 152c20 | 0a 20 20 20 20 20 2a 46 69 67 75 72 65 20 35 2e 31 38 3a 2a 20 41 6e 20 65 78 61 6d 70 6c 65 20 | ......*Figure.5.18:*.An.example. |
| 152c40 | 6f 66 20 63 6f 6d 70 69 6c 65 72 20 6f 75 74 70 75 74 2e 20 20 53 65 65 20 2a 4e 6f 74 65 20 45 | of.compiler.output...See.*Note.E |
| 152c60 | 78 65 72 63 69 73 65 0a 20 20 20 20 20 35 2d 33 35 3a 3a 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 | xercise......5-35::............. |
| 152c80 | 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 6d 61 6b 65 2d 63 6f 6d 70 69 6c 65 64 2d 70 72 | (assign.val.(op.make-compiled-pr |
| 152ca0 | 6f 63 65 64 75 72 65 29 20 28 6c 61 62 65 6c 20 65 6e 74 72 79 31 36 29 0a 20 20 20 20 20 20 20 | ocedure).(label.entry16)........ |
| 152cc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 152ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 | ..............(reg.env))........ |
| 152d00 | 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 6c 61 6d 62 64 61 31 35 | .....(goto.(label.after-lambda15 |
| 152d20 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 79 31 36 0a 20 20 20 20 20 20 20 20 20 20 20 | ))...........entry16............ |
| 152d40 | 20 28 61 73 73 69 67 6e 20 65 6e 76 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 | .(assign.env.(op.compiled-proced |
| 152d60 | 75 72 65 2d 65 6e 76 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | ure-env).(reg.proc))............ |
| 152d80 | 20 28 61 73 73 69 67 6e 20 65 6e 76 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(assign.env.................... |
| 152da0 | 20 28 6f 70 20 65 78 74 65 6e 64 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 20 28 63 6f 6e 73 74 20 | .(op.extend-environment).(const. |
| 152dc0 | 28 78 29 29 20 28 72 65 67 20 61 72 67 6c 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 | (x)).(reg.argl).(reg.env))...... |
| 152de0 | 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 70 72 6f 63 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 | .......(assign.proc.(op.lookup-v |
| 152e00 | 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 2b 29 20 28 72 65 67 20 65 6e | ariable-value).(const.+).(reg.en |
| 152e20 | 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 63 6f 6e 74 69 6e 75 65 29 0a | v)).............(save.continue). |
| 152e40 | 20 20 20 20 20 20 20 20 20 20 20 20 28 73 61 76 65 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 | ............(save.proc)......... |
| 152e60 | 20 20 20 20 28 73 61 76 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 | ....(save.env).............(assi |
| 152e80 | 67 6e 20 70 72 6f 63 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 | gn.proc.(op.lookup-variable-valu |
| 152ea0 | 65 29 20 28 63 6f 6e 73 74 20 67 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 | e).(const.g).(reg.env))......... |
| 152ec0 | 20 20 20 20 28 73 61 76 65 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 | ....(save.proc).............(ass |
| 152ee0 | 69 67 6e 20 70 72 6f 63 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c | ign.proc.(op.lookup-variable-val |
| 152f00 | 75 65 29 20 28 63 6f 6e 73 74 20 2b 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 | ue).(const.+).(reg.env))........ |
| 152f20 | 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 63 6f 6e 73 74 20 32 29 29 0a 20 20 20 20 | .....(assign.val.(const.2))..... |
| 152f40 | 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 6c 69 73 74 29 20 28 | ........(assign.argl.(op.list).( |
| 152f60 | 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 | reg.val)).............(assign.va |
| 152f80 | 6c 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 29 20 28 63 6f | l.(op.lookup-variable-value).(co |
| 152fa0 | 6e 73 74 20 78 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 | nst.x).(reg.env)).............(a |
| 152fc0 | 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 63 6f 6e 73 29 20 28 72 65 67 20 76 61 6c 29 20 28 | ssign.argl.(op.cons).(reg.val).( |
| 152fe0 | 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 | reg.argl)).............(test.(op |
| 153000 | 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 67 20 70 72 6f 63 | .primitive-procedure?).(reg.proc |
| 153020 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 70 72 | )).............(branch.(label.pr |
| 153040 | 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 31 39 29 29 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d | imitive-branch19))...........com |
| 153060 | 70 69 6c 65 64 2d 62 72 61 6e 63 68 31 38 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 | piled-branch18.............(assi |
| 153080 | 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 63 61 6c 6c 31 37 29 | gn.continue.(label.after-call17) |
| 1530a0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 63 6f | ).............(assign.val.(op.co |
| 1530c0 | 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 28 72 65 67 20 70 72 6f | mpiled-procedure-entry).(reg.pro |
| 1530e0 | 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 | c)).............(goto.(reg.val)) |
| 153100 | 0a 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 31 39 0a 20 20 | ...........primitive-branch19... |
| 153120 | 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 61 70 70 6c 79 2d | ..........(assign.val.(op.apply- |
| 153140 | 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 29 20 28 72 65 67 20 70 72 6f 63 29 20 | primitive-procedure).(reg.proc). |
| 153160 | 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 63 61 6c 6c | (reg.argl))...........after-call |
| 153180 | 31 37 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 | 17.............(assign.argl.(op. |
| 1531a0 | 6c 69 73 74 29 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 | list).(reg.val)).............(re |
| 1531c0 | 73 74 6f 72 65 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f | store.proc).............(test.(o |
| 1531e0 | 70 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 67 20 70 72 6f | p.primitive-procedure?).(reg.pro |
| 153200 | 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 70 | c)).............(branch.(label.p |
| 153220 | 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 32 32 29 29 0a 20 20 20 20 20 20 20 20 20 20 63 6f | rimitive-branch22))...........co |
| 153240 | 6d 70 69 6c 65 64 2d 62 72 61 6e 63 68 32 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 | mpiled-branch21.............(ass |
| 153260 | 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 61 66 74 65 72 2d 63 61 6c 6c 32 30 | ign.continue.(label.after-call20 |
| 153280 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 63 | )).............(assign.val.(op.c |
| 1532a0 | 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 28 72 65 67 20 70 72 | ompiled-procedure-entry).(reg.pr |
| 1532c0 | 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 | oc)).............(goto.(reg.val) |
| 1532e0 | 29 0a 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 2d 62 72 61 6e 63 68 32 32 0a 20 | )...........primitive-branch22.. |
| 153300 | 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 61 70 70 6c 79 | ...........(assign.val.(op.apply |
| 153320 | 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 29 20 28 72 65 67 20 70 72 6f 63 29 | -primitive-procedure).(reg.proc) |
| 153340 | 20 28 72 65 67 20 61 72 67 6c 29 29 0a 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 63 61 | .(reg.argl))............after-ca |
| 153360 | 6c 6c 32 30 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f | ll20.............(assign.argl.(o |
| 153380 | 70 20 6c 69 73 74 29 20 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | p.list).(reg.val)).............( |
| 1533a0 | 72 65 73 74 6f 72 65 20 65 6e 76 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e | restore.env).............(assign |
| 1533c0 | 20 76 61 6c 20 28 6f 70 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 29 20 | .val.(op.lookup-variable-value). |
| 1533e0 | 28 63 6f 6e 73 74 20 78 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 | (const.x).(reg.env))............ |
| 153400 | 20 28 61 73 73 69 67 6e 20 61 72 67 6c 20 28 6f 70 20 63 6f 6e 73 29 20 28 72 65 67 20 76 61 6c | .(assign.argl.(op.cons).(reg.val |
| 153420 | 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f | ).(reg.argl)).............(resto |
| 153440 | 72 65 20 70 72 6f 63 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f | re.proc).............(restore.co |
| 153460 | 6e 74 69 6e 75 65 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 70 72 | ntinue).............(test.(op.pr |
| 153480 | 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a | imitive-procedure?).(reg.proc)). |
| 1534a0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 70 72 69 6d 69 | ............(branch.(label.primi |
| 1534c0 | 74 69 76 65 2d 62 72 61 6e 63 68 32 35 29 29 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 70 69 6c | tive-branch25))...........compil |
| 1534e0 | 65 64 2d 62 72 61 6e 63 68 32 34 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 | ed-branch24.............(assign. |
| 153500 | 76 61 6c 20 28 6f 70 20 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 | val.(op.compiled-procedure-entry |
| 153520 | 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 67 6f 74 6f 20 | ).(reg.proc)).............(goto. |
| 153540 | 28 72 65 67 20 76 61 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 2d 62 | (reg.val))...........primitive-b |
| 153560 | 72 61 6e 63 68 32 35 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 | ranch25.............(assign.val. |
| 153580 | 28 6f 70 20 61 70 70 6c 79 2d 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 29 20 28 | (op.apply-primitive-procedure).( |
| 1535a0 | 72 65 67 20 70 72 6f 63 29 20 28 72 65 67 20 61 72 67 6c 29 29 0a 20 20 20 20 20 20 20 20 20 20 | reg.proc).(reg.argl))........... |
| 1535c0 | 20 20 28 67 6f 74 6f 20 28 72 65 67 20 63 6f 6e 74 69 6e 75 65 29 29 0a 20 20 20 20 20 20 20 20 | ..(goto.(reg.continue))......... |
| 1535e0 | 20 20 61 66 74 65 72 2d 63 61 6c 6c 32 33 0a 20 20 20 20 20 20 20 20 20 20 61 66 74 65 72 2d 6c | ..after-call23...........after-l |
| 153600 | 61 6d 62 64 61 31 35 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 | ambda15.............(perform.(op |
| 153620 | 20 64 65 66 69 6e 65 2d 76 61 72 69 61 62 6c 65 21 29 20 28 63 6f 6e 73 74 20 66 29 20 28 72 65 | .define-variable!).(const.f).(re |
| 153640 | 67 20 76 61 6c 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 61 | g.val).(reg.env)).............(a |
| 153660 | 73 73 69 67 6e 20 76 61 6c 20 28 63 6f 6e 73 74 20 6f 6b 29 29 0a 0a 0a 20 20 20 20 20 2a 45 78 | ssign.val.(const.ok))........*Ex |
| 153680 | 65 72 63 69 73 65 20 35 2e 33 36 3a 2a 20 57 68 61 74 20 6f 72 64 65 72 20 6f 66 20 65 76 61 6c | ercise.5.36:*.What.order.of.eval |
| 1536a0 | 75 61 74 69 6f 6e 20 64 6f 65 73 20 6f 75 72 20 63 6f 6d 70 69 6c 65 72 0a 20 20 20 20 20 70 72 | uation.does.our.compiler......pr |
| 1536c0 | 6f 64 75 63 65 20 66 6f 72 20 6f 70 65 72 61 6e 64 73 20 6f 66 20 61 20 63 6f 6d 62 69 6e 61 74 | oduce.for.operands.of.a.combinat |
| 1536e0 | 69 6f 6e 3f 20 20 49 73 20 69 74 20 6c 65 66 74 2d 74 6f 2d 72 69 67 68 74 2c 0a 20 20 20 20 20 | ion?..Is.it.left-to-right,...... |
| 153700 | 72 69 67 68 74 2d 74 6f 2d 6c 65 66 74 2c 20 6f 72 20 73 6f 6d 65 20 6f 74 68 65 72 20 6f 72 64 | right-to-left,.or.some.other.ord |
| 153720 | 65 72 3f 20 20 57 68 65 72 65 20 69 6e 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 69 73 20 74 68 | er?..Where.in.the.compiler.is.th |
| 153740 | 69 73 0a 20 20 20 20 20 6f 72 64 65 72 20 64 65 74 65 72 6d 69 6e 65 64 3f 20 20 4d 6f 64 69 66 | is......order.determined?..Modif |
| 153760 | 79 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 73 6f 20 74 68 61 74 20 69 74 20 70 72 6f 64 75 63 | y.the.compiler.so.that.it.produc |
| 153780 | 65 73 20 73 6f 6d 65 0a 20 20 20 20 20 6f 74 68 65 72 20 6f 72 64 65 72 20 6f 66 20 65 76 61 6c | es.some......other.order.of.eval |
| 1537a0 | 75 61 74 69 6f 6e 2e 20 20 28 53 65 65 20 74 68 65 20 64 69 73 63 75 73 73 69 6f 6e 20 6f 66 20 | uation...(See.the.discussion.of. |
| 1537c0 | 6f 72 64 65 72 20 6f 66 0a 20 20 20 20 20 65 76 61 6c 75 61 74 69 6f 6e 20 66 6f 72 20 74 68 65 | order.of......evaluation.for.the |
| 1537e0 | 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 69 6e 20 73 | .explicit-control.evaluator.in.s |
| 153800 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 35 2d 34 2d 31 3a 3a 2e 29 20 20 48 6f 77 | ection.*Note......5-4-1::.)..How |
| 153820 | 20 64 6f 65 73 20 63 68 61 6e 67 69 6e 67 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 6f 70 65 72 | .does.changing.the.order.of.oper |
| 153840 | 61 6e 64 20 65 76 61 6c 75 61 74 69 6f 6e 0a 20 20 20 20 20 61 66 66 65 63 74 20 74 68 65 20 65 | and.evaluation......affect.the.e |
| 153860 | 66 66 69 63 69 65 6e 63 79 20 6f 66 20 74 68 65 20 63 6f 64 65 20 74 68 61 74 20 63 6f 6e 73 74 | fficiency.of.the.code.that.const |
| 153880 | 72 75 63 74 73 20 74 68 65 20 61 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 6c 69 73 74 3f 0a 0a 20 | ructs.the.argument......list?... |
| 1538a0 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 33 37 3a 2a 20 4f 6e 65 20 77 61 79 20 74 6f 20 | ....*Exercise.5.37:*.One.way.to. |
| 1538c0 | 75 6e 64 65 72 73 74 61 6e 64 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 27 73 20 60 70 72 65 73 65 | understand.the.compiler's.`prese |
| 1538e0 | 72 76 69 6e 67 27 0a 20 20 20 20 20 6d 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 6f 70 74 69 6d 69 | rving'......mechanism.for.optimi |
| 153900 | 7a 69 6e 67 20 73 74 61 63 6b 20 75 73 61 67 65 20 69 73 20 74 6f 20 73 65 65 20 77 68 61 74 20 | zing.stack.usage.is.to.see.what. |
| 153920 | 65 78 74 72 61 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 6f 75 6c 64 20 62 65 20 67 | extra......operations.would.be.g |
| 153940 | 65 6e 65 72 61 74 65 64 20 69 66 20 77 65 20 64 69 64 20 6e 6f 74 20 75 73 65 20 74 68 69 73 20 | enerated.if.we.did.not.use.this. |
| 153960 | 69 64 65 61 2e 20 20 4d 6f 64 69 66 79 0a 20 20 20 20 20 60 70 72 65 73 65 72 76 69 6e 67 27 20 | idea...Modify......`preserving'. |
| 153980 | 73 6f 20 74 68 61 74 20 69 74 20 61 6c 77 61 79 73 20 67 65 6e 65 72 61 74 65 73 20 74 68 65 20 | so.that.it.always.generates.the. |
| 1539a0 | 60 73 61 76 65 27 20 61 6e 64 20 60 72 65 73 74 6f 72 65 27 0a 20 20 20 20 20 6f 70 65 72 61 74 | `save'.and.`restore'......operat |
| 1539c0 | 69 6f 6e 73 2e 20 20 43 6f 6d 70 69 6c 65 20 73 6f 6d 65 20 73 69 6d 70 6c 65 20 65 78 70 72 65 | ions...Compile.some.simple.expre |
| 1539e0 | 73 73 69 6f 6e 73 20 61 6e 64 20 69 64 65 6e 74 69 66 79 20 74 68 65 0a 20 20 20 20 20 75 6e 6e | ssions.and.identify.the......unn |
| 153a00 | 65 63 65 73 73 61 72 79 20 73 74 61 63 6b 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 61 | ecessary.stack.operations.that.a |
| 153a20 | 72 65 20 67 65 6e 65 72 61 74 65 64 2e 20 20 43 6f 6d 70 61 72 65 20 74 68 65 20 63 6f 64 65 0a | re.generated...Compare.the.code. |
| 153a40 | 20 20 20 20 20 74 6f 20 74 68 61 74 20 67 65 6e 65 72 61 74 65 64 20 77 69 74 68 20 74 68 65 20 | .....to.that.generated.with.the. |
| 153a60 | 60 70 72 65 73 65 72 76 69 6e 67 27 20 6d 65 63 68 61 6e 69 73 6d 20 69 6e 74 61 63 74 2e 0a 0a | `preserving'.mechanism.intact... |
| 153a80 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 33 38 3a 2a 20 4f 75 72 20 63 6f 6d 70 69 6c | .....*Exercise.5.38:*.Our.compil |
| 153aa0 | 65 72 20 69 73 20 63 6c 65 76 65 72 20 61 62 6f 75 74 20 61 76 6f 69 64 69 6e 67 20 75 6e 6e 65 | er.is.clever.about.avoiding.unne |
| 153ac0 | 63 65 73 73 61 72 79 0a 20 20 20 20 20 73 74 61 63 6b 20 6f 70 65 72 61 74 69 6f 6e 73 2c 20 62 | cessary......stack.operations,.b |
| 153ae0 | 75 74 20 69 74 20 69 73 20 6e 6f 74 20 63 6c 65 76 65 72 20 61 74 20 61 6c 6c 20 77 68 65 6e 20 | ut.it.is.not.clever.at.all.when. |
| 153b00 | 69 74 20 63 6f 6d 65 73 20 74 6f 0a 20 20 20 20 20 63 6f 6d 70 69 6c 69 6e 67 20 63 61 6c 6c 73 | it.comes.to......compiling.calls |
| 153b20 | 20 74 6f 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 20 6f 66 20 | .to.the.primitive.procedures.of. |
| 153b40 | 74 68 65 20 6c 61 6e 67 75 61 67 65 20 69 6e 0a 20 20 20 20 20 74 65 72 6d 73 20 6f 66 20 74 68 | the.language.in......terms.of.th |
| 153b60 | 65 20 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 74 69 6f 6e 73 20 73 75 70 70 6c 69 65 64 20 | e.primitive.operations.supplied. |
| 153b80 | 62 79 20 74 68 65 20 6d 61 63 68 69 6e 65 2e 20 20 46 6f 72 0a 20 20 20 20 20 65 78 61 6d 70 6c | by.the.machine...For......exampl |
| 153ba0 | 65 2c 20 63 6f 6e 73 69 64 65 72 20 68 6f 77 20 6d 75 63 68 20 63 6f 64 65 20 69 73 20 63 6f 6d | e,.consider.how.much.code.is.com |
| 153bc0 | 70 69 6c 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 20 60 28 2b 20 61 20 31 29 27 3a 0a 20 20 20 20 | piled.to.compute.`(+.a.1)':..... |
| 153be0 | 20 54 68 65 20 63 6f 64 65 20 73 65 74 73 20 75 70 20 61 6e 20 61 72 67 75 6d 65 6e 74 20 6c 69 | .The.code.sets.up.an.argument.li |
| 153c00 | 73 74 20 69 6e 20 60 61 72 67 6c 27 2c 20 70 75 74 73 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 | st.in.`argl',.puts.the.primitive |
| 153c20 | 0a 20 20 20 20 20 61 64 64 69 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 28 77 68 69 63 68 20 | ......addition.procedure.(which. |
| 153c40 | 69 74 20 66 69 6e 64 73 20 62 79 20 6c 6f 6f 6b 69 6e 67 20 75 70 20 74 68 65 20 73 79 6d 62 6f | it.finds.by.looking.up.the.symbo |
| 153c60 | 6c 20 60 2b 27 20 69 6e 0a 20 20 20 20 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 20 69 | l.`+'.in......the.environment).i |
| 153c80 | 6e 74 6f 20 60 70 72 6f 63 27 2c 20 61 6e 64 20 74 65 73 74 73 20 77 68 65 74 68 65 72 20 74 68 | nto.`proc',.and.tests.whether.th |
| 153ca0 | 65 20 70 72 6f 63 65 64 75 72 65 20 69 73 0a 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 20 6f 72 | e.procedure.is......primitive.or |
| 153cc0 | 20 63 6f 6d 70 6f 75 6e 64 2e 20 20 54 68 65 20 63 6f 6d 70 69 6c 65 72 20 61 6c 77 61 79 73 20 | .compound...The.compiler.always. |
| 153ce0 | 67 65 6e 65 72 61 74 65 73 20 63 6f 64 65 20 74 6f 0a 20 20 20 20 20 70 65 72 66 6f 72 6d 20 74 | generates.code.to......perform.t |
| 153d00 | 68 65 20 74 65 73 74 2c 20 61 73 20 77 65 6c 6c 20 61 73 20 63 6f 64 65 20 66 6f 72 20 70 72 69 | he.test,.as.well.as.code.for.pri |
| 153d20 | 6d 69 74 69 76 65 20 61 6e 64 20 63 6f 6d 70 6f 75 6e 64 0a 20 20 20 20 20 62 72 61 6e 63 68 65 | mitive.and.compound......branche |
| 153d40 | 73 20 28 6f 6e 6c 79 20 6f 6e 65 20 6f 66 20 77 68 69 63 68 20 77 69 6c 6c 20 62 65 20 65 78 65 | s.(only.one.of.which.will.be.exe |
| 153d60 | 63 75 74 65 64 29 2e 20 20 57 65 20 68 61 76 65 20 6e 6f 74 20 73 68 6f 77 6e 0a 20 20 20 20 20 | cuted)...We.have.not.shown...... |
| 153d80 | 74 68 65 20 70 61 72 74 20 6f 66 20 74 68 65 20 63 6f 6e 74 72 6f 6c 6c 65 72 20 74 68 61 74 20 | the.part.of.the.controller.that. |
| 153da0 | 69 6d 70 6c 65 6d 65 6e 74 73 20 70 72 69 6d 69 74 69 76 65 73 2c 20 62 75 74 20 77 65 0a 20 20 | implements.primitives,.but.we... |
| 153dc0 | 20 20 20 70 72 65 73 75 6d 65 20 74 68 61 74 20 74 68 65 73 65 20 69 6e 73 74 72 75 63 74 69 6f | ...presume.that.these.instructio |
| 153de0 | 6e 73 20 6d 61 6b 65 20 75 73 65 20 6f 66 20 70 72 69 6d 69 74 69 76 65 20 61 72 69 74 68 6d 65 | ns.make.use.of.primitive.arithme |
| 153e00 | 74 69 63 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 6d 61 63 68 69 | tic......operations.in.the.machi |
| 153e20 | 6e 65 27 73 20 64 61 74 61 20 70 61 74 68 73 2e 20 20 43 6f 6e 73 69 64 65 72 20 68 6f 77 20 6d | ne's.data.paths...Consider.how.m |
| 153e40 | 75 63 68 20 6c 65 73 73 0a 20 20 20 20 20 63 6f 64 65 20 77 6f 75 6c 64 20 62 65 20 67 65 6e 65 | uch.less......code.would.be.gene |
| 153e60 | 72 61 74 65 64 20 69 66 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 63 6f 75 6c 64 20 22 6f 70 65 | rated.if.the.compiler.could."ope |
| 153e80 | 6e 2d 63 6f 64 65 22 0a 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 73 2d 2d 74 68 61 74 20 69 73 | n-code"......primitives--that.is |
| 153ea0 | 2c 20 69 66 20 69 74 20 63 6f 75 6c 64 20 67 65 6e 65 72 61 74 65 20 63 6f 64 65 20 74 6f 20 64 | ,.if.it.could.generate.code.to.d |
| 153ec0 | 69 72 65 63 74 6c 79 20 75 73 65 0a 20 20 20 20 20 74 68 65 73 65 20 70 72 69 6d 69 74 69 76 65 | irectly.use......these.primitive |
| 153ee0 | 20 6d 61 63 68 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 20 54 68 65 20 65 78 70 72 65 73 | .machine.operations...The.expres |
| 153f00 | 73 69 6f 6e 20 60 28 2b 20 61 20 31 29 27 0a 20 20 20 20 20 6d 69 67 68 74 20 62 65 20 63 6f 6d | sion.`(+.a.1)'......might.be.com |
| 153f20 | 70 69 6c 65 64 20 69 6e 74 6f 20 73 6f 6d 65 74 68 69 6e 67 20 61 73 20 73 69 6d 70 6c 65 20 61 | piled.into.something.as.simple.a |
| 153f40 | 73 20 28 31 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 | s.(1)............(assign.val.(op |
| 153f60 | 20 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 29 20 28 63 6f 6e 73 74 20 61 | .lookup-variable-value).(const.a |
| 153f80 | 29 20 28 72 65 67 20 65 6e 76 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 | ).(reg.env))...........(assign.v |
| 153fa0 | 61 6c 20 28 6f 70 20 2b 29 20 28 72 65 67 20 76 61 6c 29 20 28 63 6f 6e 73 74 20 31 29 29 0a 0a | al.(op.+).(reg.val).(const.1)).. |
| 153fc0 | 20 20 20 20 20 49 6e 20 74 68 69 73 20 65 78 65 72 63 69 73 65 20 77 65 20 77 69 6c 6c 20 65 78 | .....In.this.exercise.we.will.ex |
| 153fe0 | 74 65 6e 64 20 6f 75 72 20 63 6f 6d 70 69 6c 65 72 20 74 6f 20 73 75 70 70 6f 72 74 20 6f 70 65 | tend.our.compiler.to.support.ope |
| 154000 | 6e 0a 20 20 20 20 20 63 6f 64 69 6e 67 20 6f 66 20 73 65 6c 65 63 74 65 64 20 70 72 69 6d 69 74 | n......coding.of.selected.primit |
| 154020 | 69 76 65 73 2e 20 20 53 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 63 6f 64 65 20 77 69 6c 6c | ives...Special-purpose.code.will |
| 154040 | 20 62 65 0a 20 20 20 20 20 67 65 6e 65 72 61 74 65 64 20 66 6f 72 20 63 61 6c 6c 73 20 74 6f 20 | .be......generated.for.calls.to. |
| 154060 | 74 68 65 73 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 20 69 6e 73 74 65 | these.primitive.procedures.inste |
| 154080 | 61 64 20 6f 66 20 74 68 65 0a 20 20 20 20 20 67 65 6e 65 72 61 6c 20 70 72 6f 63 65 64 75 72 65 | ad.of.the......general.procedure |
| 1540a0 | 2d 61 70 70 6c 69 63 61 74 69 6f 6e 20 63 6f 64 65 2e 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 | -application.code...In.order.to. |
| 1540c0 | 73 75 70 70 6f 72 74 20 74 68 69 73 2c 20 77 65 0a 20 20 20 20 20 77 69 6c 6c 20 61 75 67 6d 65 | support.this,.we......will.augme |
| 1540e0 | 6e 74 20 6f 75 72 20 6d 61 63 68 69 6e 65 20 77 69 74 68 20 73 70 65 63 69 61 6c 20 61 72 67 75 | nt.our.machine.with.special.argu |
| 154100 | 6d 65 6e 74 20 72 65 67 69 73 74 65 72 73 20 60 61 72 67 31 27 0a 20 20 20 20 20 61 6e 64 20 60 | ment.registers.`arg1'......and.` |
| 154120 | 61 72 67 32 27 2e 20 20 54 68 65 20 70 72 69 6d 69 74 69 76 65 20 61 72 69 74 68 6d 65 74 69 63 | arg2'...The.primitive.arithmetic |
| 154140 | 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 | .operations.of.the.machine...... |
| 154160 | 77 69 6c 6c 20 74 61 6b 65 20 74 68 65 69 72 20 69 6e 70 75 74 73 20 66 72 6f 6d 20 60 61 72 67 | will.take.their.inputs.from.`arg |
| 154180 | 31 27 20 61 6e 64 20 60 61 72 67 32 27 2e 20 54 68 65 20 72 65 73 75 6c 74 73 20 6d 61 79 20 62 | 1'.and.`arg2'..The.results.may.b |
| 1541a0 | 65 0a 20 20 20 20 20 70 75 74 20 69 6e 74 6f 20 60 76 61 6c 27 2c 20 60 61 72 67 31 27 2c 20 6f | e......put.into.`val',.`arg1',.o |
| 1541c0 | 72 20 60 61 72 67 32 27 2e 0a 0a 20 20 20 20 20 54 68 65 20 63 6f 6d 70 69 6c 65 72 20 6d 75 73 | r.`arg2'........The.compiler.mus |
| 1541e0 | 74 20 62 65 20 61 62 6c 65 20 74 6f 20 72 65 63 6f 67 6e 69 7a 65 20 74 68 65 20 61 70 70 6c 69 | t.be.able.to.recognize.the.appli |
| 154200 | 63 61 74 69 6f 6e 20 6f 66 20 61 6e 0a 20 20 20 20 20 6f 70 65 6e 2d 63 6f 64 65 64 20 70 72 69 | cation.of.an......open-coded.pri |
| 154220 | 6d 69 74 69 76 65 20 69 6e 20 74 68 65 20 73 6f 75 72 63 65 20 70 72 6f 67 72 61 6d 2e 20 20 57 | mitive.in.the.source.program...W |
| 154240 | 65 20 77 69 6c 6c 20 61 75 67 6d 65 6e 74 20 74 68 65 0a 20 20 20 20 20 64 69 73 70 61 74 63 68 | e.will.augment.the......dispatch |
| 154260 | 20 69 6e 20 74 68 65 20 60 63 6f 6d 70 69 6c 65 27 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 72 | .in.the.`compile'.procedure.to.r |
| 154280 | 65 63 6f 67 6e 69 7a 65 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 0a 20 20 20 20 20 74 68 65 73 65 | ecognize.the.names.of......these |
| 1542a0 | 20 70 72 69 6d 69 74 69 76 65 73 20 69 6e 20 61 64 64 69 74 69 6f 6e 20 74 6f 20 74 68 65 20 72 | .primitives.in.addition.to.the.r |
| 1542c0 | 65 73 65 72 76 65 64 20 77 6f 72 64 73 20 28 74 68 65 20 73 70 65 63 69 61 6c 0a 20 20 20 20 20 | eserved.words.(the.special...... |
| 1542e0 | 66 6f 72 6d 73 29 20 69 74 20 63 75 72 72 65 6e 74 6c 79 20 72 65 63 6f 67 6e 69 7a 65 73 2e 28 | forms).it.currently.recognizes.( |
| 154300 | 32 29 20 46 6f 72 20 65 61 63 68 20 73 70 65 63 69 61 6c 20 66 6f 72 6d 20 6f 75 72 0a 20 20 20 | 2).For.each.special.form.our.... |
| 154320 | 20 20 63 6f 6d 70 69 6c 65 72 20 68 61 73 20 61 20 63 6f 64 65 20 67 65 6e 65 72 61 74 6f 72 2e | ..compiler.has.a.code.generator. |
| 154340 | 20 20 49 6e 20 74 68 69 73 20 65 78 65 72 63 69 73 65 20 77 65 20 77 69 6c 6c 20 63 6f 6e 73 74 | ..In.this.exercise.we.will.const |
| 154360 | 72 75 63 74 0a 20 20 20 20 20 61 20 66 61 6d 69 6c 79 20 6f 66 20 63 6f 64 65 20 67 65 6e 65 72 | ruct......a.family.of.code.gener |
| 154380 | 61 74 6f 72 73 20 66 6f 72 20 74 68 65 20 6f 70 65 6e 2d 63 6f 64 65 64 20 70 72 69 6d 69 74 69 | ators.for.the.open-coded.primiti |
| 1543a0 | 76 65 73 2e 0a 0a 20 20 20 20 20 20 20 61 2e 20 54 68 65 20 6f 70 65 6e 2d 63 6f 64 65 64 20 70 | ves..........a..The.open-coded.p |
| 1543c0 | 72 69 6d 69 74 69 76 65 73 2c 20 75 6e 6c 69 6b 65 20 74 68 65 20 73 70 65 63 69 61 6c 20 66 6f | rimitives,.unlike.the.special.fo |
| 1543e0 | 72 6d 73 2c 20 61 6c 6c 20 6e 65 65 64 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 69 72 20 6f 70 | rms,.all.need...........their.op |
| 154400 | 65 72 61 6e 64 73 20 65 76 61 6c 75 61 74 65 64 2e 20 20 57 72 69 74 65 20 61 20 63 6f 64 65 20 | erands.evaluated...Write.a.code. |
| 154420 | 67 65 6e 65 72 61 74 6f 72 0a 20 20 20 20 20 20 20 20 20 20 60 73 70 72 65 61 64 2d 61 72 67 75 | generator...........`spread-argu |
| 154440 | 6d 65 6e 74 73 27 20 66 6f 72 20 75 73 65 20 62 79 20 61 6c 6c 20 74 68 65 20 6f 70 65 6e 2d 63 | ments'.for.use.by.all.the.open-c |
| 154460 | 6f 64 69 6e 67 20 63 6f 64 65 0a 20 20 20 20 20 20 20 20 20 20 67 65 6e 65 72 61 74 6f 72 73 2e | oding.code...........generators. |
| 154480 | 20 20 60 53 70 72 65 61 64 2d 61 72 67 75 6d 65 6e 74 73 27 20 73 68 6f 75 6c 64 20 74 61 6b 65 | ..`Spread-arguments'.should.take |
| 1544a0 | 20 61 6e 20 6f 70 65 72 61 6e 64 20 6c 69 73 74 0a 20 20 20 20 20 20 20 20 20 20 61 6e 64 20 63 | .an.operand.list...........and.c |
| 1544c0 | 6f 6d 70 69 6c 65 20 74 68 65 20 67 69 76 65 6e 20 6f 70 65 72 61 6e 64 73 20 74 61 72 67 65 74 | ompile.the.given.operands.target |
| 1544e0 | 65 64 20 74 6f 20 73 75 63 63 65 73 73 69 76 65 0a 20 20 20 20 20 20 20 20 20 20 61 72 67 75 6d | ed.to.successive...........argum |
| 154500 | 65 6e 74 20 72 65 67 69 73 74 65 72 73 2e 20 20 4e 6f 74 65 20 74 68 61 74 20 61 6e 20 6f 70 65 | ent.registers...Note.that.an.ope |
| 154520 | 72 61 6e 64 20 6d 61 79 20 63 6f 6e 74 61 69 6e 20 61 20 63 61 6c 6c 0a 20 20 20 20 20 20 20 20 | rand.may.contain.a.call......... |
| 154540 | 20 20 74 6f 20 61 6e 20 6f 70 65 6e 2d 63 6f 64 65 64 20 70 72 69 6d 69 74 69 76 65 2c 20 73 6f | ..to.an.open-coded.primitive,.so |
| 154560 | 20 61 72 67 75 6d 65 6e 74 20 72 65 67 69 73 74 65 72 73 20 77 69 6c 6c 20 68 61 76 65 0a 20 20 | .argument.registers.will.have... |
| 154580 | 20 20 20 20 20 20 20 20 74 6f 20 62 65 20 70 72 65 73 65 72 76 65 64 20 64 75 72 69 6e 67 20 6f | ........to.be.preserved.during.o |
| 1545a0 | 70 65 72 61 6e 64 20 65 76 61 6c 75 61 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 20 20 62 2e 20 46 6f | perand.evaluation..........b..Fo |
| 1545c0 | 72 20 65 61 63 68 20 6f 66 20 74 68 65 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 | r.each.of.the.primitive.procedur |
| 1545e0 | 65 73 20 60 3d 27 2c 20 60 2a 27 2c 20 60 2d 27 2c 20 61 6e 64 20 60 2b 27 2c 0a 20 20 20 20 20 | es.`=',.`*',.`-',.and.`+',...... |
| 154600 | 20 20 20 20 20 77 72 69 74 65 20 61 20 63 6f 64 65 20 67 65 6e 65 72 61 74 6f 72 20 74 68 61 74 | .....write.a.code.generator.that |
| 154620 | 20 74 61 6b 65 73 20 61 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 77 69 74 68 20 74 68 61 74 0a 20 | .takes.a.combination.with.that.. |
| 154640 | 20 20 20 20 20 20 20 20 20 6f 70 65 72 61 74 6f 72 2c 20 74 6f 67 65 74 68 65 72 20 77 69 74 68 | .........operator,.together.with |
| 154660 | 20 61 20 74 61 72 67 65 74 20 61 6e 64 20 61 20 6c 69 6e 6b 61 67 65 20 64 65 73 63 72 69 70 74 | .a.target.and.a.linkage.descript |
| 154680 | 6f 72 2c 0a 20 20 20 20 20 20 20 20 20 20 61 6e 64 20 70 72 6f 64 75 63 65 73 20 63 6f 64 65 20 | or,...........and.produces.code. |
| 1546a0 | 74 6f 20 73 70 72 65 61 64 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 69 6e 74 6f 20 74 68 65 | to.spread.the.arguments.into.the |
| 1546c0 | 20 72 65 67 69 73 74 65 72 73 0a 20 20 20 20 20 20 20 20 20 20 61 6e 64 20 74 68 65 6e 20 70 65 | .registers...........and.then.pe |
| 1546e0 | 72 66 6f 72 6d 20 74 68 65 20 6f 70 65 72 61 74 69 6f 6e 20 74 61 72 67 65 74 65 64 20 74 6f 20 | rform.the.operation.targeted.to. |
| 154700 | 74 68 65 20 67 69 76 65 6e 20 74 61 72 67 65 74 0a 20 20 20 20 20 20 20 20 20 20 77 69 74 68 20 | the.given.target...........with. |
| 154720 | 74 68 65 20 67 69 76 65 6e 20 6c 69 6e 6b 61 67 65 2e 20 20 59 6f 75 20 6e 65 65 64 20 6f 6e 6c | the.given.linkage...You.need.onl |
| 154740 | 79 20 68 61 6e 64 6c 65 20 65 78 70 72 65 73 73 69 6f 6e 73 0a 20 20 20 20 20 20 20 20 20 20 77 | y.handle.expressions...........w |
| 154760 | 69 74 68 20 74 77 6f 20 6f 70 65 72 61 6e 64 73 2e 20 20 4d 61 6b 65 20 60 63 6f 6d 70 69 6c 65 | ith.two.operands...Make.`compile |
| 154780 | 27 20 64 69 73 70 61 74 63 68 20 74 6f 20 74 68 65 73 65 20 63 6f 64 65 0a 20 20 20 20 20 20 20 | '.dispatch.to.these.code........ |
| 1547a0 | 20 20 20 67 65 6e 65 72 61 74 6f 72 73 2e 0a 0a 20 20 20 20 20 20 20 63 2e 20 54 72 79 20 79 6f | ...generators..........c..Try.yo |
| 1547c0 | 75 72 20 6e 65 77 20 63 6f 6d 70 69 6c 65 72 20 6f 6e 20 74 68 65 20 60 66 61 63 74 6f 72 69 61 | ur.new.compiler.on.the.`factoria |
| 1547e0 | 6c 27 20 65 78 61 6d 70 6c 65 2e 20 20 43 6f 6d 70 61 72 65 0a 20 20 20 20 20 20 20 20 20 20 74 | l'.example...Compare...........t |
| 154800 | 68 65 20 72 65 73 75 6c 74 69 6e 67 20 63 6f 64 65 20 77 69 74 68 20 74 68 65 20 72 65 73 75 6c | he.resulting.code.with.the.resul |
| 154820 | 74 20 70 72 6f 64 75 63 65 64 20 77 69 74 68 6f 75 74 20 6f 70 65 6e 0a 20 20 20 20 20 20 20 20 | t.produced.without.open......... |
| 154840 | 20 20 63 6f 64 69 6e 67 2e 0a 0a 20 20 20 20 20 20 20 64 2e 20 45 78 74 65 6e 64 20 79 6f 75 72 | ..coding..........d..Extend.your |
| 154860 | 20 63 6f 64 65 20 67 65 6e 65 72 61 74 6f 72 73 20 66 6f 72 20 60 2b 27 20 61 6e 64 20 60 2a 27 | .code.generators.for.`+'.and.`*' |
| 154880 | 20 73 6f 20 74 68 61 74 20 74 68 65 79 20 63 61 6e 0a 20 20 20 20 20 20 20 20 20 20 68 61 6e 64 | .so.that.they.can...........hand |
| 1548a0 | 6c 65 20 65 78 70 72 65 73 73 69 6f 6e 73 20 77 69 74 68 20 61 72 62 69 74 72 61 72 79 20 6e 75 | le.expressions.with.arbitrary.nu |
| 1548c0 | 6d 62 65 72 73 20 6f 66 20 6f 70 65 72 61 6e 64 73 2e 20 20 41 6e 0a 20 20 20 20 20 20 20 20 20 | mbers.of.operands...An.......... |
| 1548e0 | 20 65 78 70 72 65 73 73 69 6f 6e 20 77 69 74 68 20 6d 6f 72 65 20 74 68 61 6e 20 74 77 6f 20 6f | .expression.with.more.than.two.o |
| 154900 | 70 65 72 61 6e 64 73 20 77 69 6c 6c 20 68 61 76 65 20 74 6f 20 62 65 0a 20 20 20 20 20 20 20 20 | perands.will.have.to.be......... |
| 154920 | 20 20 63 6f 6d 70 69 6c 65 64 20 69 6e 74 6f 20 61 20 73 65 71 75 65 6e 63 65 20 6f 66 20 6f 70 | ..compiled.into.a.sequence.of.op |
| 154940 | 65 72 61 74 69 6f 6e 73 2c 20 65 61 63 68 20 77 69 74 68 20 6f 6e 6c 79 20 74 77 6f 0a 20 20 20 | erations,.each.with.only.two.... |
| 154960 | 20 20 20 20 20 20 20 69 6e 70 75 74 73 2e 0a 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 | .......inputs.......----------.F |
| 154980 | 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 57 65 20 68 | ootnotes.----------.....(1).We.h |
| 1549a0 | 61 76 65 20 75 73 65 64 20 74 68 65 20 73 61 6d 65 20 73 79 6d 62 6f 6c 20 60 2b 27 20 68 65 72 | ave.used.the.same.symbol.`+'.her |
| 1549c0 | 65 20 74 6f 20 64 65 6e 6f 74 65 20 62 6f 74 68 20 74 68 65 0a 73 6f 75 72 63 65 2d 6c 61 6e 67 | e.to.denote.both.the.source-lang |
| 1549e0 | 75 61 67 65 20 70 72 6f 63 65 64 75 72 65 20 61 6e 64 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6f | uage.procedure.and.the.machine.o |
| 154a00 | 70 65 72 61 74 69 6f 6e 2e 20 20 49 6e 20 67 65 6e 65 72 61 6c 20 74 68 65 72 65 0a 77 69 6c 6c | peration...In.general.there.will |
| 154a20 | 20 6e 6f 74 20 62 65 20 61 20 6f 6e 65 2d 74 6f 2d 6f 6e 65 20 63 6f 72 72 65 73 70 6f 6e 64 65 | .not.be.a.one-to-one.corresponde |
| 154a40 | 6e 63 65 20 62 65 74 77 65 65 6e 20 70 72 69 6d 69 74 69 76 65 73 20 6f 66 20 74 68 65 0a 73 6f | nce.between.primitives.of.the.so |
| 154a60 | 75 72 63 65 20 6c 61 6e 67 75 61 67 65 20 61 6e 64 20 70 72 69 6d 69 74 69 76 65 73 20 6f 66 20 | urce.language.and.primitives.of. |
| 154a80 | 74 68 65 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 28 32 29 20 4d 61 6b 69 6e 67 20 74 68 65 20 | the.machine......(2).Making.the. |
| 154aa0 | 70 72 69 6d 69 74 69 76 65 73 20 69 6e 74 6f 20 72 65 73 65 72 76 65 64 20 77 6f 72 64 73 20 69 | primitives.into.reserved.words.i |
| 154ac0 | 73 20 69 6e 20 67 65 6e 65 72 61 6c 20 61 20 62 61 64 0a 69 64 65 61 2c 20 73 69 6e 63 65 20 61 | s.in.general.a.bad.idea,.since.a |
| 154ae0 | 20 75 73 65 72 20 63 61 6e 6e 6f 74 20 74 68 65 6e 20 72 65 62 69 6e 64 20 74 68 65 73 65 20 6e | .user.cannot.then.rebind.these.n |
| 154b00 | 61 6d 65 73 20 74 6f 20 64 69 66 66 65 72 65 6e 74 0a 70 72 6f 63 65 64 75 72 65 73 2e 20 20 4d | ames.to.different.procedures...M |
| 154b20 | 6f 72 65 6f 76 65 72 2c 20 69 66 20 77 65 20 61 64 64 20 72 65 73 65 72 76 65 64 20 77 6f 72 64 | oreover,.if.we.add.reserved.word |
| 154b40 | 73 20 74 6f 20 61 20 63 6f 6d 70 69 6c 65 72 20 74 68 61 74 20 69 73 0a 69 6e 20 75 73 65 2c 20 | s.to.a.compiler.that.is.in.use,. |
| 154b60 | 65 78 69 73 74 69 6e 67 20 70 72 6f 67 72 61 6d 73 20 74 68 61 74 20 64 65 66 69 6e 65 20 70 72 | existing.programs.that.define.pr |
| 154b80 | 6f 63 65 64 75 72 65 73 20 77 69 74 68 20 74 68 65 73 65 20 6e 61 6d 65 73 20 77 69 6c 6c 0a 73 | ocedures.with.these.names.will.s |
| 154ba0 | 74 6f 70 20 77 6f 72 6b 69 6e 67 2e 20 20 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 | top.working...See.*Note.Exercise |
| 154bc0 | 20 35 2d 34 34 3a 3a 20 66 6f 72 20 69 64 65 61 73 20 6f 6e 20 68 6f 77 20 74 6f 20 61 76 6f 69 | .5-44::.for.ideas.on.how.to.avoi |
| 154be0 | 64 20 74 68 69 73 0a 70 72 6f 62 6c 65 6d 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e | d.this.problem.....File:.sicp.in |
| 154c00 | 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 35 2d 36 2c 20 20 4e 65 78 74 3a 20 35 2d 35 2d 37 2c 20 | fo,..Node:.5-5-6,..Next:.5-5-7,. |
| 154c20 | 20 50 72 65 76 3a 20 35 2d 35 2d 35 2c 20 20 55 70 3a 20 35 2d 35 0a 0a 35 2e 35 2e 36 20 4c 65 | .Prev:.5-5-5,..Up:.5-5..5.5.6.Le |
| 154c40 | 78 69 63 61 6c 20 41 64 64 72 65 73 73 69 6e 67 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | xical.Addressing.--------------- |
| 154c60 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 4f 6e 65 20 6f 66 20 74 68 65 20 6d 6f 73 74 20 63 6f 6d 6d 6f | ---------..One.of.the.most.commo |
| 154c80 | 6e 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 73 20 70 65 72 66 6f 72 6d 65 64 20 62 79 20 63 6f 6d | n.optimizations.performed.by.com |
| 154ca0 | 70 69 6c 65 72 73 20 69 73 20 74 68 65 0a 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 20 6f 66 20 76 61 | pilers.is.the.optimization.of.va |
| 154cc0 | 72 69 61 62 6c 65 20 6c 6f 6f 6b 75 70 2e 20 20 4f 75 72 20 63 6f 6d 70 69 6c 65 72 2c 20 61 73 | riable.lookup...Our.compiler,.as |
| 154ce0 | 20 77 65 20 68 61 76 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 0a 69 74 20 73 6f 20 66 61 72 2c 20 | .we.have.implemented.it.so.far,. |
| 154d00 | 67 65 6e 65 72 61 74 65 73 20 63 6f 64 65 20 74 68 61 74 20 75 73 65 73 20 74 68 65 20 60 6c 6f | generates.code.that.uses.the.`lo |
| 154d20 | 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 27 0a 6f 70 65 72 61 74 69 6f 6e 20 6f | okup-variable-value'.operation.o |
| 154d40 | 66 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 2e 20 20 54 68 69 73 20 73 | f.the.evaluator.machine...This.s |
| 154d60 | 65 61 72 63 68 65 73 20 66 6f 72 20 61 20 76 61 72 69 61 62 6c 65 20 62 79 0a 63 6f 6d 70 61 72 | earches.for.a.variable.by.compar |
| 154d80 | 69 6e 67 20 69 74 20 77 69 74 68 20 65 61 63 68 20 76 61 72 69 61 62 6c 65 20 74 68 61 74 20 69 | ing.it.with.each.variable.that.i |
| 154da0 | 73 20 63 75 72 72 65 6e 74 6c 79 20 62 6f 75 6e 64 2c 20 77 6f 72 6b 69 6e 67 20 66 72 61 6d 65 | s.currently.bound,.working.frame |
| 154dc0 | 0a 62 79 20 66 72 61 6d 65 20 6f 75 74 77 61 72 64 20 74 68 72 6f 75 67 68 20 74 68 65 20 72 75 | .by.frame.outward.through.the.ru |
| 154de0 | 6e 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 54 68 69 73 20 73 65 61 72 63 68 | n-time.environment...This.search |
| 154e00 | 20 63 61 6e 20 62 65 0a 65 78 70 65 6e 73 69 76 65 20 69 66 20 74 68 65 20 66 72 61 6d 65 73 20 | .can.be.expensive.if.the.frames. |
| 154e20 | 61 72 65 20 64 65 65 70 6c 79 20 6e 65 73 74 65 64 20 6f 72 20 69 66 20 74 68 65 72 65 20 61 72 | are.deeply.nested.or.if.there.ar |
| 154e40 | 65 20 6d 61 6e 79 0a 76 61 72 69 61 62 6c 65 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 | e.many.variables...For.example,. |
| 154e60 | 63 6f 6e 73 69 64 65 72 20 74 68 65 20 70 72 6f 62 6c 65 6d 20 6f 66 20 6c 6f 6f 6b 69 6e 67 20 | consider.the.problem.of.looking. |
| 154e80 | 75 70 20 74 68 65 20 76 61 6c 75 65 0a 6f 66 20 60 78 27 20 77 68 69 6c 65 20 65 76 61 6c 75 61 | up.the.value.of.`x'.while.evalua |
| 154ea0 | 74 69 6e 67 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 60 28 2a 20 78 20 79 20 7a 29 27 20 | ting.the.expression.`(*.x.y.z)'. |
| 154ec0 | 69 6e 20 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 0a 74 68 65 20 70 72 6f 63 65 64 75 | in.an.application.of.the.procedu |
| 154ee0 | 72 65 20 74 68 61 74 20 69 73 20 72 65 74 75 72 6e 65 64 20 62 79 0a 0a 20 20 20 20 20 28 6c 65 | re.that.is.returned.by.......(le |
| 154f00 | 74 20 28 28 78 20 33 29 20 28 79 20 34 29 29 0a 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 | t.((x.3).(y.4))........(lambda.( |
| 154f20 | 61 20 62 20 63 20 64 20 65 29 0a 20 20 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 79 20 28 2a 20 | a.b.c.d.e)..........(let.((y.(*. |
| 154f40 | 61 20 62 20 78 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 7a 20 28 2b 20 63 20 64 | a.b.x))................(z.(+.c.d |
| 154f60 | 20 78 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 78 20 79 20 7a 29 29 29 29 0a 0a 20 | .x)))............(*.x.y.z))))... |
| 154f80 | 20 20 53 69 6e 63 65 20 61 20 60 6c 65 74 27 20 65 78 70 72 65 73 73 69 6f 6e 20 69 73 20 6a 75 | ..Since.a.`let'.expression.is.ju |
| 154fa0 | 73 74 20 73 79 6e 74 61 63 74 69 63 20 73 75 67 61 72 20 66 6f 72 20 61 20 60 6c 61 6d 62 64 61 | st.syntactic.sugar.for.a.`lambda |
| 154fc0 | 27 0a 63 6f 6d 62 69 6e 61 74 69 6f 6e 2c 20 74 68 69 73 20 65 78 70 72 65 73 73 69 6f 6e 20 69 | '.combination,.this.expression.i |
| 154fe0 | 73 20 65 71 75 69 76 61 6c 65 6e 74 20 74 6f 0a 0a 20 20 20 20 20 28 28 6c 61 6d 62 64 61 20 28 | s.equivalent.to.......((lambda.( |
| 155000 | 78 20 79 29 0a 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 20 62 20 63 20 64 20 65 29 | x.y).........(lambda.(a.b.c.d.e) |
| 155020 | 0a 20 20 20 20 20 20 20 20 20 20 28 28 6c 61 6d 62 64 61 20 28 79 20 7a 29 20 28 2a 20 78 20 79 | ...........((lambda.(y.z).(*.x.y |
| 155040 | 20 7a 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 61 20 62 20 78 29 0a 20 20 20 20 20 20 | .z))............(*.a.b.x)....... |
| 155060 | 20 20 20 20 20 28 2b 20 63 20 64 20 78 29 29 29 29 0a 20 20 20 20 20 20 33 0a 20 20 20 20 20 20 | .....(+.c.d.x)))).......3....... |
| 155080 | 34 29 0a 0a 20 20 20 45 61 63 68 20 74 69 6d 65 20 60 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c | 4).....Each.time.`lookup-variabl |
| 1550a0 | 65 2d 76 61 6c 75 65 27 20 73 65 61 72 63 68 65 73 20 66 6f 72 20 60 78 27 2c 20 69 74 20 6d 75 | e-value'.searches.for.`x',.it.mu |
| 1550c0 | 73 74 20 64 65 74 65 72 6d 69 6e 65 0a 74 68 61 74 20 74 68 65 20 73 79 6d 62 6f 6c 20 60 78 27 | st.determine.that.the.symbol.`x' |
| 1550e0 | 20 69 73 20 6e 6f 74 20 60 65 71 3f 27 20 74 6f 20 60 79 27 20 6f 72 20 60 7a 27 20 28 69 6e 20 | .is.not.`eq?'.to.`y'.or.`z'.(in. |
| 155100 | 74 68 65 20 66 69 72 73 74 20 66 72 61 6d 65 29 2c 0a 6e 6f 72 20 74 6f 20 60 61 27 2c 20 60 62 | the.first.frame),.nor.to.`a',.`b |
| 155120 | 27 2c 20 60 63 27 2c 20 60 64 27 2c 20 6f 72 20 60 65 27 20 28 69 6e 20 74 68 65 20 73 65 63 6f | ',.`c',.`d',.or.`e'.(in.the.seco |
| 155140 | 6e 64 20 66 72 61 6d 65 29 2e 20 20 57 65 20 77 69 6c 6c 0a 61 73 73 75 6d 65 2c 20 66 6f 72 20 | nd.frame)...We.will.assume,.for. |
| 155160 | 74 68 65 20 6d 6f 6d 65 6e 74 2c 20 74 68 61 74 20 6f 75 72 20 70 72 6f 67 72 61 6d 73 20 64 6f | the.moment,.that.our.programs.do |
| 155180 | 20 6e 6f 74 20 75 73 65 20 60 64 65 66 69 6e 65 27 2d 2d 74 68 61 74 0a 76 61 72 69 61 62 6c 65 | .not.use.`define'--that.variable |
| 1551a0 | 73 20 61 72 65 20 62 6f 75 6e 64 20 6f 6e 6c 79 20 77 69 74 68 20 60 6c 61 6d 62 64 61 27 2e 20 | s.are.bound.only.with.`lambda'.. |
| 1551c0 | 20 42 65 63 61 75 73 65 20 6f 75 72 20 6c 61 6e 67 75 61 67 65 20 69 73 0a 6c 65 78 69 63 61 6c | .Because.our.language.is.lexical |
| 1551e0 | 6c 79 20 73 63 6f 70 65 64 2c 20 74 68 65 20 72 75 6e 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d | ly.scoped,.the.run-time.environm |
| 155200 | 65 6e 74 20 66 6f 72 20 61 6e 79 20 65 78 70 72 65 73 73 69 6f 6e 20 77 69 6c 6c 20 68 61 76 65 | ent.for.any.expression.will.have |
| 155220 | 0a 61 20 73 74 72 75 63 74 75 72 65 20 74 68 61 74 20 70 61 72 61 6c 6c 65 6c 73 20 74 68 65 20 | .a.structure.that.parallels.the. |
| 155240 | 6c 65 78 69 63 61 6c 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d | lexical.structure.of.the.program |
| 155260 | 20 69 6e 0a 77 68 69 63 68 20 74 68 65 20 65 78 70 72 65 73 73 69 6f 6e 20 61 70 70 65 61 72 73 | .in.which.the.expression.appears |
| 155280 | 2e 28 31 29 20 54 68 75 73 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 63 61 6e 20 6b 6e 6f 77 | .(1).Thus,.the.compiler.can.know |
| 1552a0 | 2c 20 77 68 65 6e 20 69 74 0a 61 6e 61 6c 79 7a 65 73 20 74 68 65 20 61 62 6f 76 65 20 65 78 70 | ,.when.it.analyzes.the.above.exp |
| 1552c0 | 72 65 73 73 69 6f 6e 2c 20 74 68 61 74 20 65 61 63 68 20 74 69 6d 65 20 74 68 65 20 70 72 6f 63 | ression,.that.each.time.the.proc |
| 1552e0 | 65 64 75 72 65 20 69 73 20 61 70 70 6c 69 65 64 0a 74 68 65 20 76 61 72 69 61 62 6c 65 20 60 78 | edure.is.applied.the.variable.`x |
| 155300 | 27 20 69 6e 20 60 28 2a 20 78 20 79 20 7a 29 27 20 77 69 6c 6c 20 62 65 20 66 6f 75 6e 64 20 74 | '.in.`(*.x.y.z)'.will.be.found.t |
| 155320 | 77 6f 20 66 72 61 6d 65 73 20 6f 75 74 20 66 72 6f 6d 20 74 68 65 0a 63 75 72 72 65 6e 74 20 66 | wo.frames.out.from.the.current.f |
| 155340 | 72 61 6d 65 20 61 6e 64 20 77 69 6c 6c 20 62 65 20 74 68 65 20 66 69 72 73 74 20 76 61 72 69 61 | rame.and.will.be.the.first.varia |
| 155360 | 62 6c 65 20 69 6e 20 74 68 61 74 20 66 72 61 6d 65 2e 0a 0a 20 20 20 57 65 20 63 61 6e 20 65 78 | ble.in.that.frame......We.can.ex |
| 155380 | 70 6c 6f 69 74 20 74 68 69 73 20 66 61 63 74 20 62 79 20 69 6e 76 65 6e 74 69 6e 67 20 61 20 6e | ploit.this.fact.by.inventing.a.n |
| 1553a0 | 65 77 20 6b 69 6e 64 20 6f 66 20 76 61 72 69 61 62 6c 65 2d 6c 6f 6f 6b 75 70 0a 6f 70 65 72 61 | ew.kind.of.variable-lookup.opera |
| 1553c0 | 74 69 6f 6e 2c 20 60 6c 65 78 69 63 61 6c 2d 61 64 64 72 65 73 73 2d 6c 6f 6f 6b 75 70 27 2c 20 | tion,.`lexical-address-lookup',. |
| 1553e0 | 74 68 61 74 20 74 61 6b 65 73 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 61 6e 0a 65 6e 76 69 72 | that.takes.as.arguments.an.envir |
| 155400 | 6f 6e 6d 65 6e 74 20 61 6e 64 20 61 20 22 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 22 20 74 | onment.and.a."lexical.address".t |
| 155420 | 68 61 74 20 63 6f 6e 73 69 73 74 73 20 6f 66 20 74 77 6f 20 6e 75 6d 62 65 72 73 3a 20 61 20 6e | hat.consists.of.two.numbers:.a.n |
| 155440 | 75 6d 62 65 72 0a 22 66 72 61 6d 65 20 6e 75 6d 62 65 72 22 2c 20 77 68 69 63 68 20 73 70 65 63 | umber."frame.number",.which.spec |
| 155460 | 69 66 69 65 73 20 68 6f 77 20 6d 61 6e 79 20 66 72 61 6d 65 73 20 74 6f 20 70 61 73 73 20 6f 76 | ifies.how.many.frames.to.pass.ov |
| 155480 | 65 72 2c 20 61 6e 64 20 61 20 22 64 69 73 70 6c 61 63 65 6d 65 6e 74 0a 6e 75 6d 62 65 72 22 2c | er,.and.a."displacement.number", |
| 1554a0 | 20 77 68 69 63 68 20 73 70 65 63 69 66 69 65 73 20 68 6f 77 20 6d 61 6e 79 20 76 61 72 69 61 62 | .which.specifies.how.many.variab |
| 1554c0 | 6c 65 73 20 74 6f 20 70 61 73 73 20 6f 76 65 72 20 69 6e 20 74 68 61 74 20 66 72 61 6d 65 2e 0a | les.to.pass.over.in.that.frame.. |
| 1554e0 | 60 4c 65 78 69 63 61 6c 2d 61 64 64 72 65 73 73 2d 6c 6f 6f 6b 75 70 27 20 77 69 6c 6c 20 70 72 | `Lexical-address-lookup'.will.pr |
| 155500 | 6f 64 75 63 65 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 | oduce.the.value.of.the.variable. |
| 155520 | 73 74 6f 72 65 64 0a 61 74 20 74 68 61 74 20 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 20 72 | stored.at.that.lexical.address.r |
| 155540 | 65 6c 61 74 69 76 65 20 74 6f 20 74 68 65 20 63 75 72 72 65 6e 74 20 65 6e 76 69 72 6f 6e 6d 65 | elative.to.the.current.environme |
| 155560 | 6e 74 2e 20 20 49 66 20 77 65 20 61 64 64 0a 74 68 65 20 60 6c 65 78 69 63 61 6c 2d 61 64 64 72 | nt...If.we.add.the.`lexical-addr |
| 155580 | 65 73 73 2d 6c 6f 6f 6b 75 70 27 20 6f 70 65 72 61 74 69 6f 6e 20 74 6f 20 6f 75 72 20 6d 61 63 | ess-lookup'.operation.to.our.mac |
| 1555a0 | 68 69 6e 65 2c 20 77 65 20 63 61 6e 20 6d 61 6b 65 20 74 68 65 0a 63 6f 6d 70 69 6c 65 72 20 67 | hine,.we.can.make.the.compiler.g |
| 1555c0 | 65 6e 65 72 61 74 65 20 63 6f 64 65 20 74 68 61 74 20 72 65 66 65 72 65 6e 63 65 73 20 76 61 72 | enerate.code.that.references.var |
| 1555e0 | 69 61 62 6c 65 73 20 75 73 69 6e 67 20 74 68 69 73 20 6f 70 65 72 61 74 69 6f 6e 2c 0a 72 61 74 | iables.using.this.operation,.rat |
| 155600 | 68 65 72 20 74 68 61 6e 20 60 6c 6f 6f 6b 75 70 2d 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 27 | her.than.`lookup-variable-value' |
| 155620 | 2e 20 20 53 69 6d 69 6c 61 72 6c 79 2c 20 6f 75 72 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 | ...Similarly,.our.compiled.code. |
| 155640 | 63 61 6e 0a 75 73 65 20 61 20 6e 65 77 20 60 6c 65 78 69 63 61 6c 2d 61 64 64 72 65 73 73 2d 73 | can.use.a.new.`lexical-address-s |
| 155660 | 65 74 21 27 20 20 6f 70 65 72 61 74 69 6f 6e 20 69 6e 73 74 65 61 64 20 6f 66 0a 60 73 65 74 2d | et!'..operation.instead.of.`set- |
| 155680 | 76 61 72 69 61 62 6c 65 2d 76 61 6c 75 65 21 27 2e 0a 0a 20 20 20 49 6e 20 6f 72 64 65 72 20 74 | variable-value!'......In.order.t |
| 1556a0 | 6f 20 67 65 6e 65 72 61 74 65 20 73 75 63 68 20 63 6f 64 65 2c 20 74 68 65 20 63 6f 6d 70 69 6c | o.generate.such.code,.the.compil |
| 1556c0 | 65 72 20 6d 75 73 74 20 62 65 20 61 62 6c 65 20 74 6f 0a 64 65 74 65 72 6d 69 6e 65 20 74 68 65 | er.must.be.able.to.determine.the |
| 1556e0 | 20 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 20 6f 66 20 61 20 76 61 72 69 61 62 6c 65 20 69 | .lexical.address.of.a.variable.i |
| 155700 | 74 20 69 73 20 61 62 6f 75 74 20 74 6f 20 63 6f 6d 70 69 6c 65 20 61 0a 72 65 66 65 72 65 6e 63 | t.is.about.to.compile.a.referenc |
| 155720 | 65 20 74 6f 2e 20 20 54 68 65 20 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 20 6f 66 20 61 20 | e.to...The.lexical.address.of.a. |
| 155740 | 76 61 72 69 61 62 6c 65 20 69 6e 20 61 20 70 72 6f 67 72 61 6d 20 64 65 70 65 6e 64 73 0a 6f 6e | variable.in.a.program.depends.on |
| 155760 | 20 77 68 65 72 65 20 6f 6e 65 20 69 73 20 69 6e 20 74 68 65 20 63 6f 64 65 2e 20 20 46 6f 72 20 | .where.one.is.in.the.code...For. |
| 155780 | 65 78 61 6d 70 6c 65 2c 20 69 6e 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f 67 72 61 | example,.in.the.following.progra |
| 1557a0 | 6d 2c 0a 74 68 65 20 61 64 64 72 65 73 73 20 6f 66 20 60 78 27 20 69 6e 20 65 78 70 72 65 73 73 | m,.the.address.of.`x'.in.express |
| 1557c0 | 69 6f 6e 20 3c 45 31 3e 20 69 73 20 28 32 2c 30 29 2d 2d 74 77 6f 20 66 72 61 6d 65 73 20 62 61 | ion.<E1>.is.(2,0)--two.frames.ba |
| 1557e0 | 63 6b 20 61 6e 64 20 74 68 65 0a 66 69 72 73 74 20 76 61 72 69 61 62 6c 65 20 69 6e 20 74 68 65 | ck.and.the.first.variable.in.the |
| 155800 | 20 66 72 61 6d 65 2e 20 20 41 74 20 74 68 61 74 20 70 6f 69 6e 74 20 60 79 27 20 69 73 20 61 74 | .frame...At.that.point.`y'.is.at |
| 155820 | 20 61 64 64 72 65 73 73 20 28 30 2c 30 29 20 61 6e 64 0a 60 63 27 20 69 73 20 61 74 20 61 64 64 | .address.(0,0).and.`c'.is.at.add |
| 155840 | 72 65 73 73 20 28 31 2c 32 29 2e 20 20 49 6e 20 65 78 70 72 65 73 73 69 6f 6e 20 3c 45 32 3e 2c | ress.(1,2)...In.expression.<E2>, |
| 155860 | 20 60 78 27 20 69 73 20 61 74 20 28 31 2c 30 29 2c 20 60 79 27 20 69 73 0a 61 74 20 28 31 2c 31 | .`x'.is.at.(1,0),.`y'.is.at.(1,1 |
| 155880 | 29 2c 20 61 6e 64 20 60 63 27 20 69 73 20 61 74 20 28 30 2c 32 29 2e 0a 0a 20 20 20 20 20 28 28 | ),.and.`c'.is.at.(0,2)........(( |
| 1558a0 | 6c 61 6d 62 64 61 20 28 78 20 79 29 0a 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 61 20 | lambda.(x.y).........(lambda.(a. |
| 1558c0 | 62 20 63 20 64 20 65 29 0a 20 20 20 20 20 20 20 20 20 20 28 28 6c 61 6d 62 64 61 20 28 79 20 7a | b.c.d.e)...........((lambda.(y.z |
| 1558e0 | 29 20 3c 45 31 3e 29 0a 20 20 20 20 20 20 20 20 20 20 20 3c 45 32 3e 0a 20 20 20 20 20 20 20 20 | ).<E1>)............<E2>......... |
| 155900 | 20 20 20 28 2b 20 63 20 64 20 78 29 29 29 29 0a 20 20 20 20 20 20 33 0a 20 20 20 20 20 20 34 29 | ...(+.c.d.x)))).......3.......4) |
| 155920 | 0a 0a 20 20 20 4f 6e 65 20 77 61 79 20 66 6f 72 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 74 6f | .....One.way.for.the.compiler.to |
| 155940 | 20 70 72 6f 64 75 63 65 20 63 6f 64 65 20 74 68 61 74 20 75 73 65 73 20 6c 65 78 69 63 61 6c 0a | .produce.code.that.uses.lexical. |
| 155960 | 61 64 64 72 65 73 73 69 6e 67 20 69 73 20 74 6f 20 6d 61 69 6e 74 61 69 6e 20 61 20 64 61 74 61 | addressing.is.to.maintain.a.data |
| 155980 | 20 73 74 72 75 63 74 75 72 65 20 63 61 6c 6c 65 64 20 61 20 22 63 6f 6d 70 69 6c 65 2d 74 69 6d | .structure.called.a."compile-tim |
| 1559a0 | 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 22 2e 20 20 54 68 69 73 20 6b 65 65 70 73 20 74 72 61 63 | e.environment"...This.keeps.trac |
| 1559c0 | 6b 20 6f 66 20 77 68 69 63 68 20 76 61 72 69 61 62 6c 65 73 20 77 69 6c 6c 20 62 65 20 61 74 20 | k.of.which.variables.will.be.at. |
| 1559e0 | 77 68 69 63 68 0a 70 6f 73 69 74 69 6f 6e 73 20 69 6e 20 77 68 69 63 68 20 66 72 61 6d 65 73 20 | which.positions.in.which.frames. |
| 155a00 | 69 6e 20 74 68 65 20 72 75 6e 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 77 68 65 6e | in.the.run-time.environment.when |
| 155a20 | 20 61 20 70 61 72 74 69 63 75 6c 61 72 0a 76 61 72 69 61 62 6c 65 2d 61 63 63 65 73 73 20 6f 70 | .a.particular.variable-access.op |
| 155a40 | 65 72 61 74 69 6f 6e 20 69 73 20 65 78 65 63 75 74 65 64 2e 20 20 54 68 65 20 63 6f 6d 70 69 6c | eration.is.executed...The.compil |
| 155a60 | 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 73 0a 61 20 6c 69 73 74 20 6f 66 20 | e-time.environment.is.a.list.of. |
| 155a80 | 66 72 61 6d 65 73 2c 20 65 61 63 68 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 20 6c 69 73 74 20 6f | frames,.each.containing.a.list.o |
| 155aa0 | 66 20 76 61 72 69 61 62 6c 65 73 2e 20 20 28 54 68 65 72 65 20 77 69 6c 6c 20 6f 66 0a 63 6f 75 | f.variables...(There.will.of.cou |
| 155ac0 | 72 73 65 20 62 65 20 6e 6f 20 76 61 6c 75 65 73 20 62 6f 75 6e 64 20 74 6f 20 74 68 65 20 76 61 | rse.be.no.values.bound.to.the.va |
| 155ae0 | 72 69 61 62 6c 65 73 2c 20 73 69 6e 63 65 20 76 61 6c 75 65 73 20 61 72 65 20 6e 6f 74 0a 63 6f | riables,.since.values.are.not.co |
| 155b00 | 6d 70 75 74 65 64 20 61 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 2e 29 20 20 54 68 65 20 63 6f | mputed.at.compile.time.)..The.co |
| 155b20 | 6d 70 69 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 62 65 63 6f 6d 65 73 20 61 | mpile-time.environment.becomes.a |
| 155b40 | 6e 0a 61 64 64 69 74 69 6f 6e 61 6c 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 60 63 6f 6d 70 69 6c | n.additional.argument.to.`compil |
| 155b60 | 65 27 20 61 6e 64 20 69 73 20 70 61 73 73 65 64 20 61 6c 6f 6e 67 20 74 6f 20 65 61 63 68 20 63 | e'.and.is.passed.along.to.each.c |
| 155b80 | 6f 64 65 0a 67 65 6e 65 72 61 74 6f 72 2e 20 20 54 68 65 20 74 6f 70 2d 6c 65 76 65 6c 20 63 61 | ode.generator...The.top-level.ca |
| 155ba0 | 6c 6c 20 74 6f 20 60 63 6f 6d 70 69 6c 65 27 20 75 73 65 73 20 61 6e 20 65 6d 70 74 79 20 63 6f | ll.to.`compile'.uses.an.empty.co |
| 155bc0 | 6d 70 69 6c 65 2d 74 69 6d 65 0a 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 57 68 65 6e 20 61 20 | mpile-time.environment...When.a. |
| 155be0 | 60 6c 61 6d 62 64 61 27 20 62 6f 64 79 20 69 73 20 63 6f 6d 70 69 6c 65 64 2c 20 60 63 6f 6d 70 | `lambda'.body.is.compiled,.`comp |
| 155c00 | 69 6c 65 2d 6c 61 6d 62 64 61 2d 62 6f 64 79 27 0a 65 78 74 65 6e 64 73 20 74 68 65 20 63 6f 6d | ile-lambda-body'.extends.the.com |
| 155c20 | 70 69 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 62 79 20 61 20 66 72 61 6d 65 | pile-time.environment.by.a.frame |
| 155c40 | 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 0a 70 72 6f 63 65 64 75 72 65 27 73 20 70 61 72 61 | .containing.the.procedure's.para |
| 155c60 | 6d 65 74 65 72 73 2c 20 73 6f 20 74 68 61 74 20 74 68 65 20 73 65 71 75 65 6e 63 65 20 6d 61 6b | meters,.so.that.the.sequence.mak |
| 155c80 | 69 6e 67 20 75 70 20 74 68 65 20 62 6f 64 79 20 69 73 0a 63 6f 6d 70 69 6c 65 64 20 77 69 74 68 | ing.up.the.body.is.compiled.with |
| 155ca0 | 20 74 68 61 74 20 65 78 74 65 6e 64 65 64 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 41 74 20 | .that.extended.environment...At. |
| 155cc0 | 65 61 63 68 20 70 6f 69 6e 74 20 69 6e 20 74 68 65 0a 63 6f 6d 70 69 6c 61 74 69 6f 6e 2c 20 60 | each.point.in.the.compilation,.` |
| 155ce0 | 63 6f 6d 70 69 6c 65 2d 76 61 72 69 61 62 6c 65 27 20 61 6e 64 20 60 63 6f 6d 70 69 6c 65 2d 61 | compile-variable'.and.`compile-a |
| 155d00 | 73 73 69 67 6e 6d 65 6e 74 27 20 75 73 65 20 74 68 65 0a 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 | ssignment'.use.the.compile-time. |
| 155d20 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 67 65 6e 65 72 61 74 65 | environment.in.order.to.generate |
| 155d40 | 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 6c 65 78 69 63 61 6c 0a 61 64 64 72 65 73 73 | .the.appropriate.lexical.address |
| 155d60 | 65 73 2e 0a 0a 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 33 39 3a 3a 20 74 68 | es......*Note.Exercise.5-39::.th |
| 155d80 | 72 6f 75 67 68 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 34 33 3a 3a 20 64 65 73 63 | rough.*Note.Exercise.5-43::.desc |
| 155da0 | 72 69 62 65 20 68 6f 77 20 74 6f 0a 63 6f 6d 70 6c 65 74 65 20 74 68 69 73 20 73 6b 65 74 63 68 | ribe.how.to.complete.this.sketch |
| 155dc0 | 20 6f 66 20 74 68 65 20 6c 65 78 69 63 61 6c 2d 61 64 64 72 65 73 73 69 6e 67 20 73 74 72 61 74 | .of.the.lexical-addressing.strat |
| 155de0 | 65 67 79 20 69 6e 20 6f 72 64 65 72 20 74 6f 0a 69 6e 63 6f 72 70 6f 72 61 74 65 20 6c 65 78 69 | egy.in.order.to.incorporate.lexi |
| 155e00 | 63 61 6c 20 6c 6f 6f 6b 75 70 20 69 6e 74 6f 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 2e 20 20 2a | cal.lookup.into.the.compiler...* |
| 155e20 | 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 34 34 3a 3a 0a 64 65 73 63 72 69 62 65 73 20 61 | Note.Exercise.5-44::.describes.a |
| 155e40 | 6e 6f 74 68 65 72 20 75 73 65 20 66 6f 72 20 74 68 65 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 | nother.use.for.the.compile-time. |
| 155e60 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 33 | environment........*Exercise.5.3 |
| 155e80 | 39 3a 2a 20 57 72 69 74 65 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 6c 65 78 69 63 61 6c 2d 61 | 9:*.Write.a.procedure.`lexical-a |
| 155ea0 | 64 64 72 65 73 73 2d 6c 6f 6f 6b 75 70 27 20 74 68 61 74 0a 20 20 20 20 20 69 6d 70 6c 65 6d 65 | ddress-lookup'.that......impleme |
| 155ec0 | 6e 74 73 20 74 68 65 20 6e 65 77 20 6c 6f 6f 6b 75 70 20 6f 70 65 72 61 74 69 6f 6e 2e 20 20 49 | nts.the.new.lookup.operation...I |
| 155ee0 | 74 20 73 68 6f 75 6c 64 20 74 61 6b 65 20 74 77 6f 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 | t.should.take.two......arguments |
| 155f00 | 2d 2d 61 20 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 20 61 6e 64 20 61 20 72 75 6e 2d 74 69 | --a.lexical.address.and.a.run-ti |
| 155f20 | 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2d 2d 61 6e 64 0a 20 20 20 20 20 72 65 74 75 72 6e 20 | me.environment--and......return. |
| 155f40 | 74 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 73 74 6f 72 65 64 | the.value.of.the.variable.stored |
| 155f60 | 20 61 74 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 6c 65 78 69 63 61 6c 0a 20 20 20 20 20 61 | .at.the.specified.lexical......a |
| 155f80 | 64 64 72 65 73 73 2e 20 20 60 4c 65 78 69 63 61 6c 2d 61 64 64 72 65 73 73 2d 6c 6f 6f 6b 75 70 | ddress...`Lexical-address-lookup |
| 155fa0 | 27 20 73 68 6f 75 6c 64 20 73 69 67 6e 61 6c 20 61 6e 20 65 72 72 6f 72 20 69 66 20 74 68 65 0a | '.should.signal.an.error.if.the. |
| 155fc0 | 20 20 20 20 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 73 20 74 68 | .....value.of.the.variable.is.th |
| 155fe0 | 65 20 73 79 6d 62 6f 6c 20 60 2a 75 6e 61 73 73 69 67 6e 65 64 2a 27 2e 28 32 29 20 41 6c 73 6f | e.symbol.`*unassigned*'.(2).Also |
| 156000 | 20 77 72 69 74 65 0a 20 20 20 20 20 61 20 70 72 6f 63 65 64 75 72 65 20 60 6c 65 78 69 63 61 6c | .write......a.procedure.`lexical |
| 156020 | 2d 61 64 64 72 65 73 73 2d 73 65 74 21 27 20 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 73 20 74 | -address-set!'.that.implements.t |
| 156040 | 68 65 20 6f 70 65 72 61 74 69 6f 6e 0a 20 20 20 20 20 74 68 61 74 20 63 68 61 6e 67 65 73 20 74 | he.operation......that.changes.t |
| 156060 | 68 65 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 61 74 20 61 20 73 70 | he.value.of.the.variable.at.a.sp |
| 156080 | 65 63 69 66 69 65 64 20 6c 65 78 69 63 61 6c 0a 20 20 20 20 20 61 64 64 72 65 73 73 2e 0a 0a 20 | ecified.lexical......address.... |
| 1560a0 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 34 30 3a 2a 20 4d 6f 64 69 66 79 20 74 68 65 20 | ....*Exercise.5.40:*.Modify.the. |
| 1560c0 | 63 6f 6d 70 69 6c 65 72 20 74 6f 20 6d 61 69 6e 74 61 69 6e 20 74 68 65 20 63 6f 6d 70 69 6c 65 | compiler.to.maintain.the.compile |
| 1560e0 | 2d 74 69 6d 65 0a 20 20 20 20 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 73 20 64 65 73 63 72 69 | -time......environment.as.descri |
| 156100 | 62 65 64 20 61 62 6f 76 65 2e 20 20 54 68 61 74 20 69 73 2c 20 61 64 64 20 61 0a 20 20 20 20 20 | bed.above...That.is,.add.a...... |
| 156120 | 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 72 67 75 6d 65 6e | compile-time-environment.argumen |
| 156140 | 74 20 74 6f 20 60 63 6f 6d 70 69 6c 65 27 20 61 6e 64 20 74 68 65 20 76 61 72 69 6f 75 73 20 63 | t.to.`compile'.and.the.various.c |
| 156160 | 6f 64 65 0a 20 20 20 20 20 67 65 6e 65 72 61 74 6f 72 73 2c 20 61 6e 64 20 65 78 74 65 6e 64 20 | ode......generators,.and.extend. |
| 156180 | 69 74 20 69 6e 20 60 63 6f 6d 70 69 6c 65 2d 6c 61 6d 62 64 61 2d 62 6f 64 79 27 2e 0a 0a 20 20 | it.in.`compile-lambda-body'..... |
| 1561a0 | 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 34 31 3a 2a 20 57 72 69 74 65 20 61 20 70 72 6f 63 | ...*Exercise.5.41:*.Write.a.proc |
| 1561c0 | 65 64 75 72 65 20 60 66 69 6e 64 2d 76 61 72 69 61 62 6c 65 27 20 74 68 61 74 20 74 61 6b 65 73 | edure.`find-variable'.that.takes |
| 1561e0 | 20 61 73 0a 20 20 20 20 20 61 72 67 75 6d 65 6e 74 73 20 61 20 76 61 72 69 61 62 6c 65 20 61 6e | .as......arguments.a.variable.an |
| 156200 | 64 20 61 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 61 6e 64 | d.a.compile-time.environment.and |
| 156220 | 20 72 65 74 75 72 6e 73 0a 20 20 20 20 20 74 68 65 20 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 | .returns......the.lexical.addres |
| 156240 | 73 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 77 69 74 68 20 72 65 73 70 65 63 74 20 74 | s.of.the.variable.with.respect.t |
| 156260 | 6f 20 74 68 61 74 0a 20 20 20 20 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 46 6f 72 20 65 78 | o.that......environment...For.ex |
| 156280 | 61 6d 70 6c 65 2c 20 69 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 20 66 72 61 67 6d 65 6e 74 20 74 | ample,.in.the.program.fragment.t |
| 1562a0 | 68 61 74 20 69 73 20 73 68 6f 77 6e 0a 20 20 20 20 20 61 62 6f 76 65 2c 20 74 68 65 20 63 6f 6d | hat.is.shown......above,.the.com |
| 1562c0 | 70 69 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 64 75 72 69 6e 67 20 74 68 65 | pile-time.environment.during.the |
| 1562e0 | 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 65 78 70 72 65 73 73 69 6f 6e 20 | .compilation.of......expression. |
| 156300 | 3c 45 31 3e 20 69 73 20 60 28 28 79 20 7a 29 20 28 61 20 62 20 63 20 64 20 65 29 20 28 78 20 79 | <E1>.is.`((y.z).(a.b.c.d.e).(x.y |
| 156320 | 29 29 27 2e 20 20 60 46 69 6e 64 2d 76 61 72 69 61 62 6c 65 27 0a 20 20 20 20 20 73 68 6f 75 6c | ))'...`Find-variable'......shoul |
| 156340 | 64 20 70 72 6f 64 75 63 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 69 6e 64 2d 76 61 72 69 61 | d.produce............(find-varia |
| 156360 | 62 6c 65 20 27 63 20 27 28 28 79 20 7a 29 20 28 61 20 62 20 63 20 64 20 65 29 20 28 78 20 79 29 | ble.'c.'((y.z).(a.b.c.d.e).(x.y) |
| 156380 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 31 20 32 29 0a 0a 20 20 20 20 20 20 20 20 20 20 28 66 | ))...........(1.2)............(f |
| 1563a0 | 69 6e 64 2d 76 61 72 69 61 62 6c 65 20 27 78 20 27 28 28 79 20 7a 29 20 28 61 20 62 20 63 20 64 | ind-variable.'x.'((y.z).(a.b.c.d |
| 1563c0 | 20 65 29 20 28 78 20 79 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 28 32 20 30 29 0a 0a 20 20 20 | .e).(x.y)))...........(2.0)..... |
| 1563e0 | 20 20 20 20 20 20 20 28 66 69 6e 64 2d 76 61 72 69 61 62 6c 65 20 27 77 20 27 28 28 79 20 7a 29 | .......(find-variable.'w.'((y.z) |
| 156400 | 20 28 61 20 62 20 63 20 64 20 65 29 20 28 78 20 79 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 6e | .(a.b.c.d.e).(x.y)))...........n |
| 156420 | 6f 74 2d 66 6f 75 6e 64 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 34 32 3a 2a 20 | ot-found.......*Exercise.5.42:*. |
| 156440 | 55 73 69 6e 67 20 60 66 69 6e 64 2d 76 61 72 69 61 62 6c 65 27 20 66 72 6f 6d 20 2a 4e 6f 74 65 | Using.`find-variable'.from.*Note |
| 156460 | 20 45 78 65 72 63 69 73 65 20 35 2d 34 31 3a 3a 2c 0a 20 20 20 20 20 72 65 77 72 69 74 65 20 60 | .Exercise.5-41::,......rewrite.` |
| 156480 | 63 6f 6d 70 69 6c 65 2d 76 61 72 69 61 62 6c 65 27 20 61 6e 64 20 60 63 6f 6d 70 69 6c 65 2d 61 | compile-variable'.and.`compile-a |
| 1564a0 | 73 73 69 67 6e 6d 65 6e 74 27 20 74 6f 20 6f 75 74 70 75 74 0a 20 20 20 20 20 6c 65 78 69 63 61 | ssignment'.to.output......lexica |
| 1564c0 | 6c 2d 61 64 64 72 65 73 73 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 20 20 49 6e 20 63 61 73 65 | l-address.instructions...In.case |
| 1564e0 | 73 20 77 68 65 72 65 20 60 66 69 6e 64 2d 76 61 72 69 61 62 6c 65 27 0a 20 20 20 20 20 72 65 74 | s.where.`find-variable'......ret |
| 156500 | 75 72 6e 73 20 60 6e 6f 74 2d 66 6f 75 6e 64 27 20 28 74 68 61 74 20 69 73 2c 20 77 68 65 72 65 | urns.`not-found'.(that.is,.where |
| 156520 | 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 73 20 6e 6f 74 20 69 6e 20 74 68 65 0a 20 20 20 20 | .the.variable.is.not.in.the..... |
| 156540 | 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 2c 20 79 6f 75 20 | .compile-time.environment),.you. |
| 156560 | 73 68 6f 75 6c 64 20 68 61 76 65 20 74 68 65 20 63 6f 64 65 20 67 65 6e 65 72 61 74 6f 72 73 20 | should.have.the.code.generators. |
| 156580 | 75 73 65 0a 20 20 20 20 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6f 70 65 72 61 74 69 6f 6e | use......the.evaluator.operation |
| 1565a0 | 73 2c 20 61 73 20 62 65 66 6f 72 65 2c 20 74 6f 20 73 65 61 72 63 68 20 66 6f 72 20 74 68 65 20 | s,.as.before,.to.search.for.the. |
| 1565c0 | 62 69 6e 64 69 6e 67 2e 0a 20 20 20 20 20 28 54 68 65 20 6f 6e 6c 79 20 70 6c 61 63 65 20 61 20 | binding.......(The.only.place.a. |
| 1565e0 | 76 61 72 69 61 62 6c 65 20 74 68 61 74 20 69 73 20 6e 6f 74 20 66 6f 75 6e 64 20 61 74 20 63 6f | variable.that.is.not.found.at.co |
| 156600 | 6d 70 69 6c 65 20 74 69 6d 65 20 63 61 6e 0a 20 20 20 20 20 62 65 20 69 73 20 69 6e 20 74 68 65 | mpile.time.can......be.is.in.the |
| 156620 | 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 77 68 69 63 68 20 69 73 20 70 61 | .global.environment,.which.is.pa |
| 156640 | 72 74 20 6f 66 20 74 68 65 20 72 75 6e 2d 74 69 6d 65 0a 20 20 20 20 20 65 6e 76 69 72 6f 6e 6d | rt.of.the.run-time......environm |
| 156660 | 65 6e 74 20 62 75 74 20 69 73 20 6e 6f 74 20 70 61 72 74 20 6f 66 20 74 68 65 20 63 6f 6d 70 69 | ent.but.is.not.part.of.the.compi |
| 156680 | 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 28 33 29 0a 20 20 20 20 20 54 68 75 | le-time.environment.(3)......Thu |
| 1566a0 | 73 2c 20 69 66 20 79 6f 75 20 77 69 73 68 2c 20 79 6f 75 20 6d 61 79 20 68 61 76 65 20 74 68 65 | s,.if.you.wish,.you.may.have.the |
| 1566c0 | 20 65 76 61 6c 75 61 74 6f 72 20 6f 70 65 72 61 74 69 6f 6e 73 20 6c 6f 6f 6b 0a 20 20 20 20 20 | .evaluator.operations.look...... |
| 1566e0 | 64 69 72 65 63 74 6c 79 20 69 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 | directly.in.the.global.environme |
| 156700 | 6e 74 2c 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 6f 62 74 61 69 6e 65 64 20 77 69 74 68 20 74 | nt,.which.can.be.obtained.with.t |
| 156720 | 68 65 0a 20 20 20 20 20 6f 70 65 72 61 74 69 6f 6e 20 60 28 6f 70 20 67 65 74 2d 67 6c 6f 62 61 | he......operation.`(op.get-globa |
| 156740 | 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 27 2c 20 69 6e 73 74 65 61 64 20 6f 66 20 68 61 76 69 | l-environment)',.instead.of.havi |
| 156760 | 6e 67 20 74 68 65 6d 0a 20 20 20 20 20 73 65 61 72 63 68 20 74 68 65 20 77 68 6f 6c 65 20 72 75 | ng.them......search.the.whole.ru |
| 156780 | 6e 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 66 6f 75 6e 64 20 69 6e 20 60 65 6e 76 | n-time.environment.found.in.`env |
| 1567a0 | 27 2e 29 20 20 54 65 73 74 20 74 68 65 0a 20 20 20 20 20 6d 6f 64 69 66 69 65 64 20 63 6f 6d 70 | '.)..Test.the......modified.comp |
| 1567c0 | 69 6c 65 72 20 6f 6e 20 61 20 66 65 77 20 73 69 6d 70 6c 65 20 63 61 73 65 73 2c 20 73 75 63 68 | iler.on.a.few.simple.cases,.such |
| 1567e0 | 20 61 73 20 74 68 65 20 6e 65 73 74 65 64 0a 20 20 20 20 20 60 6c 61 6d 62 64 61 27 20 63 6f 6d | .as.the.nested......`lambda'.com |
| 156800 | 62 69 6e 61 74 69 6f 6e 20 61 74 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 69 | bination.at.the.beginning.of.thi |
| 156820 | 73 20 73 65 63 74 69 6f 6e 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 34 33 3a | s.section........*Exercise.5.43: |
| 156840 | 2a 20 57 65 20 61 72 67 75 65 64 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 | *.We.argued.in.section.*Note.4-1 |
| 156860 | 2d 36 3a 3a 20 74 68 61 74 20 69 6e 74 65 72 6e 61 6c 0a 20 20 20 20 20 64 65 66 69 6e 69 74 69 | -6::.that.internal......definiti |
| 156880 | 6f 6e 73 20 66 6f 72 20 62 6c 6f 63 6b 20 73 74 72 75 63 74 75 72 65 20 73 68 6f 75 6c 64 20 6e | ons.for.block.structure.should.n |
| 1568a0 | 6f 74 20 62 65 20 63 6f 6e 73 69 64 65 72 65 64 20 22 72 65 61 6c 22 0a 20 20 20 20 20 60 64 65 | ot.be.considered."real"......`de |
| 1568c0 | 66 69 6e 65 27 73 2e 20 20 52 61 74 68 65 72 2c 20 61 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 | fine's...Rather,.a.procedure.bod |
| 1568e0 | 79 20 73 68 6f 75 6c 64 20 62 65 20 69 6e 74 65 72 70 72 65 74 65 64 20 61 73 20 69 66 0a 20 20 | y.should.be.interpreted.as.if... |
| 156900 | 20 20 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 76 61 72 69 61 62 6c 65 73 20 62 65 69 6e 67 20 | ...the.internal.variables.being. |
| 156920 | 64 65 66 69 6e 65 64 20 77 65 72 65 20 69 6e 73 74 61 6c 6c 65 64 20 61 73 20 6f 72 64 69 6e 61 | defined.were.installed.as.ordina |
| 156940 | 72 79 0a 20 20 20 20 20 60 6c 61 6d 62 64 61 27 20 76 61 72 69 61 62 6c 65 73 20 69 6e 69 74 69 | ry......`lambda'.variables.initi |
| 156960 | 61 6c 69 7a 65 64 20 74 6f 20 74 68 65 69 72 20 63 6f 72 72 65 63 74 20 76 61 6c 75 65 73 20 75 | alized.to.their.correct.values.u |
| 156980 | 73 69 6e 67 0a 20 20 20 20 20 60 73 65 74 21 27 2e 20 20 53 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 | sing......`set!'...Section.*Note |
| 1569a0 | 20 34 2d 31 2d 36 3a 3a 20 61 6e 64 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 34 2d 31 36 | .4-1-6::.and.*Note.Exercise.4-16 |
| 1569c0 | 3a 3a 20 73 68 6f 77 65 64 0a 20 20 20 20 20 68 6f 77 20 74 6f 20 6d 6f 64 69 66 79 20 74 68 65 | ::.showed......how.to.modify.the |
| 1569e0 | 20 6d 65 74 61 63 69 72 63 75 6c 61 72 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 6f 20 61 63 63 | .metacircular.interpreter.to.acc |
| 156a00 | 6f 6d 70 6c 69 73 68 20 74 68 69 73 20 62 79 0a 20 20 20 20 20 73 63 61 6e 6e 69 6e 67 20 6f 75 | omplish.this.by......scanning.ou |
| 156a20 | 74 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 2e 20 20 4d 6f 64 69 66 79 20 | t.internal.definitions...Modify. |
| 156a40 | 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 74 6f 20 70 65 72 66 6f 72 6d 0a 20 20 20 20 20 74 68 65 | the.compiler.to.perform......the |
| 156a60 | 20 73 61 6d 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 62 65 66 6f 72 65 20 69 74 20 63 | .same.transformation.before.it.c |
| 156a80 | 6f 6d 70 69 6c 65 73 20 61 20 70 72 6f 63 65 64 75 72 65 20 62 6f 64 79 2e 0a 0a 20 20 20 20 20 | ompiles.a.procedure.body........ |
| 156aa0 | 2a 45 78 65 72 63 69 73 65 20 35 2e 34 34 3a 2a 20 49 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e | *Exercise.5.44:*.In.this.section |
| 156ac0 | 20 77 65 20 68 61 76 65 20 66 6f 63 75 73 65 64 20 6f 6e 20 74 68 65 20 75 73 65 20 6f 66 20 74 | .we.have.focused.on.the.use.of.t |
| 156ae0 | 68 65 0a 20 20 20 20 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 | he......compile-time.environment |
| 156b00 | 20 74 6f 20 70 72 6f 64 75 63 65 20 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 65 73 2e 20 20 | .to.produce.lexical.addresses... |
| 156b20 | 42 75 74 20 74 68 65 72 65 0a 20 20 20 20 20 61 72 65 20 6f 74 68 65 72 20 75 73 65 73 20 66 6f | But.there......are.other.uses.fo |
| 156b40 | 72 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 2e 20 20 46 6f | r.compile-time.environments...Fo |
| 156b60 | 72 20 69 6e 73 74 61 6e 63 65 2c 20 69 6e 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 | r.instance,.in......*Note.Exerci |
| 156b80 | 73 65 20 35 2d 33 38 3a 3a 20 77 65 20 69 6e 63 72 65 61 73 65 64 20 74 68 65 20 65 66 66 69 63 | se.5-38::.we.increased.the.effic |
| 156ba0 | 69 65 6e 63 79 20 6f 66 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 0a 20 20 20 20 20 62 79 20 6f | iency.of.compiled.code......by.o |
| 156bc0 | 70 65 6e 2d 63 6f 64 69 6e 67 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 2e | pen-coding.primitive.procedures. |
| 156be0 | 20 20 4f 75 72 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 74 72 65 61 74 65 64 0a 20 20 20 | ..Our.implementation.treated.... |
| 156c00 | 20 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 6f 70 65 6e 2d 63 6f 64 65 64 20 70 72 6f 63 65 64 | ..the.names.of.open-coded.proced |
| 156c20 | 75 72 65 73 20 61 73 20 72 65 73 65 72 76 65 64 20 77 6f 72 64 73 2e 20 20 49 66 20 61 0a 20 20 | ures.as.reserved.words...If.a... |
| 156c40 | 20 20 20 70 72 6f 67 72 61 6d 20 77 65 72 65 20 74 6f 20 72 65 62 69 6e 64 20 73 75 63 68 20 61 | ...program.were.to.rebind.such.a |
| 156c60 | 20 6e 61 6d 65 2c 20 74 68 65 20 6d 65 63 68 61 6e 69 73 6d 20 64 65 73 63 72 69 62 65 64 20 69 | .name,.the.mechanism.described.i |
| 156c80 | 6e 0a 20 20 20 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 33 38 3a 3a 20 77 6f 75 | n......*Note.Exercise.5-38::.wou |
| 156ca0 | 6c 64 20 73 74 69 6c 6c 20 6f 70 65 6e 2d 63 6f 64 65 20 69 74 20 61 73 20 61 20 70 72 69 6d 69 | ld.still.open-code.it.as.a.primi |
| 156cc0 | 74 69 76 65 2c 0a 20 20 20 20 20 69 67 6e 6f 72 69 6e 67 20 74 68 65 20 6e 65 77 20 62 69 6e 64 | tive,......ignoring.the.new.bind |
| 156ce0 | 69 6e 67 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 | ing...For.example,.consider.the. |
| 156d00 | 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 20 20 20 20 20 20 20 28 6c 61 6d 62 64 61 20 28 2b 20 | procedure............(lambda.(+. |
| 156d20 | 2a 20 61 20 62 20 78 20 79 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 2a 20 61 20 78 | *.a.b.x.y).............(+.(*.a.x |
| 156d40 | 29 20 28 2a 20 62 20 79 29 29 29 0a 0a 20 20 20 20 20 77 68 69 63 68 20 63 6f 6d 70 75 74 65 73 | ).(*.b.y))).......which.computes |
| 156d60 | 20 61 20 6c 69 6e 65 61 72 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 60 78 27 20 61 6e 64 | .a.linear.combination.of.`x'.and |
| 156d80 | 20 60 79 27 2e 20 20 57 65 20 6d 69 67 68 74 20 63 61 6c 6c 0a 20 20 20 20 20 69 74 20 77 69 74 | .`y'...We.might.call......it.wit |
| 156da0 | 68 20 61 72 67 75 6d 65 6e 74 73 20 60 2b 6d 61 74 72 69 78 27 2c 20 60 2a 6d 61 74 72 69 78 27 | h.arguments.`+matrix',.`*matrix' |
| 156dc0 | 2c 20 61 6e 64 20 66 6f 75 72 20 6d 61 74 72 69 63 65 73 2c 20 62 75 74 20 74 68 65 0a 20 20 20 | ,.and.four.matrices,.but.the.... |
| 156de0 | 20 20 6f 70 65 6e 2d 63 6f 64 69 6e 67 20 63 6f 6d 70 69 6c 65 72 20 77 6f 75 6c 64 20 73 74 69 | ..open-coding.compiler.would.sti |
| 156e00 | 6c 6c 20 6f 70 65 6e 2d 63 6f 64 65 20 74 68 65 20 60 2b 27 20 61 6e 64 20 74 68 65 20 60 2a 27 | ll.open-code.the.`+'.and.the.`*' |
| 156e20 | 20 69 6e 0a 20 20 20 20 20 60 28 2b 20 28 2a 20 61 20 78 29 20 28 2a 20 62 20 79 29 29 27 20 61 | .in......`(+.(*.a.x).(*.b.y))'.a |
| 156e40 | 73 20 70 72 69 6d 69 74 69 76 65 20 60 2b 27 20 61 6e 64 20 60 2a 27 2e 20 20 4d 6f 64 69 66 79 | s.primitive.`+'.and.`*'...Modify |
| 156e60 | 20 74 68 65 0a 20 20 20 20 20 6f 70 65 6e 2d 63 6f 64 69 6e 67 20 63 6f 6d 70 69 6c 65 72 20 74 | .the......open-coding.compiler.t |
| 156e80 | 6f 20 63 6f 6e 73 75 6c 74 20 74 68 65 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 | o.consult.the.compile-time.envir |
| 156ea0 | 6f 6e 6d 65 6e 74 20 69 6e 0a 20 20 20 20 20 6f 72 64 65 72 20 74 6f 20 63 6f 6d 70 69 6c 65 20 | onment.in......order.to.compile. |
| 156ec0 | 74 68 65 20 63 6f 72 72 65 63 74 20 63 6f 64 65 20 66 6f 72 20 65 78 70 72 65 73 73 69 6f 6e 73 | the.correct.code.for.expressions |
| 156ee0 | 20 69 6e 76 6f 6c 76 69 6e 67 20 74 68 65 0a 20 20 20 20 20 6e 61 6d 65 73 20 6f 66 20 70 72 69 | .involving.the......names.of.pri |
| 156f00 | 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 28 54 68 65 20 63 6f 64 65 20 77 69 | mitive.procedures...(The.code.wi |
| 156f20 | 6c 6c 20 77 6f 72 6b 20 63 6f 72 72 65 63 74 6c 79 20 61 73 0a 20 20 20 20 20 6c 6f 6e 67 20 61 | ll.work.correctly.as......long.a |
| 156f40 | 73 20 74 68 65 20 70 72 6f 67 72 61 6d 20 64 6f 65 73 20 6e 6f 74 20 60 64 65 66 69 6e 65 27 20 | s.the.program.does.not.`define'. |
| 156f60 | 6f 72 20 60 73 65 74 21 27 20 74 68 65 73 65 20 6e 61 6d 65 73 2e 29 0a 0a 20 20 20 2d 2d 2d 2d | or.`set!'.these.names.).....---- |
| 156f80 | 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 | ------.Footnotes.----------..... |
| 156fa0 | 28 31 29 20 54 68 69 73 20 69 73 20 6e 6f 74 20 74 72 75 65 20 69 66 20 77 65 20 61 6c 6c 6f 77 | (1).This.is.not.true.if.we.allow |
| 156fc0 | 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 2c 20 75 6e 6c 65 73 73 20 77 65 | .internal.definitions,.unless.we |
| 156fe0 | 0a 73 63 61 6e 20 74 68 65 6d 20 6f 75 74 2e 20 20 53 65 65 20 2a 4e 6f 74 65 20 45 78 65 72 63 | .scan.them.out...See.*Note.Exerc |
| 157000 | 69 73 65 20 35 2d 34 33 3a 3a 2e 0a 0a 20 20 20 28 32 29 20 54 68 69 73 20 69 73 20 74 68 65 20 | ise.5-43::......(2).This.is.the. |
| 157020 | 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 74 6f 20 76 61 72 69 61 62 6c 65 20 6c 6f 6f 6b 75 70 20 | modification.to.variable.lookup. |
| 157040 | 72 65 71 75 69 72 65 64 20 69 66 20 77 65 0a 69 6d 70 6c 65 6d 65 6e 74 20 74 68 65 20 73 63 61 | required.if.we.implement.the.sca |
| 157060 | 6e 6e 69 6e 67 20 6d 65 74 68 6f 64 20 74 6f 20 65 6c 69 6d 69 6e 61 74 65 20 69 6e 74 65 72 6e | nning.method.to.eliminate.intern |
| 157080 | 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 28 2a 4e 6f 74 65 0a 45 78 65 72 63 69 73 65 20 35 | al.definitions.(*Note.Exercise.5 |
| 1570a0 | 2d 34 33 3a 3a 29 2e 20 20 57 65 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 65 6c 69 6d 69 6e 61 | -43::)...We.will.need.to.elimina |
| 1570c0 | 74 65 20 74 68 65 73 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 69 6e 20 6f 72 64 65 72 0a 66 6f | te.these.definitions.in.order.fo |
| 1570e0 | 72 20 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 69 6e 67 20 74 6f 20 77 6f 72 6b 2e 0a 0a 20 | r.lexical.addressing.to.work.... |
| 157100 | 20 20 28 33 29 20 4c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 65 73 20 63 61 6e 6e 6f 74 20 62 | ..(3).Lexical.addresses.cannot.b |
| 157120 | 65 20 75 73 65 64 20 74 6f 20 61 63 63 65 73 73 20 76 61 72 69 61 62 6c 65 73 20 69 6e 20 74 68 | e.used.to.access.variables.in.th |
| 157140 | 65 0a 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2c 20 62 65 63 61 75 73 65 20 74 68 | e.global.environment,.because.th |
| 157160 | 65 73 65 20 6e 61 6d 65 73 20 63 61 6e 20 62 65 20 64 65 66 69 6e 65 64 20 61 6e 64 20 72 65 64 | ese.names.can.be.defined.and.red |
| 157180 | 65 66 69 6e 65 64 0a 69 6e 74 65 72 61 63 74 69 76 65 6c 79 20 61 74 20 61 6e 79 20 74 69 6d 65 | efined.interactively.at.any.time |
| 1571a0 | 2e 20 20 57 69 74 68 20 69 6e 74 65 72 6e 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 73 63 61 | ...With.internal.definitions.sca |
| 1571c0 | 6e 6e 65 64 20 6f 75 74 2c 20 61 73 0a 69 6e 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 | nned.out,.as.in.*Note.Exercise.5 |
| 1571e0 | 2d 34 33 3a 3a 2c 20 74 68 65 20 6f 6e 6c 79 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 74 68 65 20 | -43::,.the.only.definitions.the. |
| 157200 | 63 6f 6d 70 69 6c 65 72 20 73 65 65 73 20 61 72 65 0a 74 68 6f 73 65 20 61 74 20 74 6f 70 20 6c | compiler.sees.are.those.at.top.l |
| 157220 | 65 76 65 6c 2c 20 77 68 69 63 68 20 61 63 74 20 6f 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 65 6e | evel,.which.act.on.the.global.en |
| 157240 | 76 69 72 6f 6e 6d 65 6e 74 2e 20 20 43 6f 6d 70 69 6c 61 74 69 6f 6e 0a 6f 66 20 61 20 64 65 66 | vironment...Compilation.of.a.def |
| 157260 | 69 6e 69 74 69 6f 6e 20 64 6f 65 73 20 6e 6f 74 20 63 61 75 73 65 20 74 68 65 20 64 65 66 69 6e | inition.does.not.cause.the.defin |
| 157280 | 65 64 20 6e 61 6d 65 20 74 6f 20 62 65 20 65 6e 74 65 72 65 64 20 69 6e 20 74 68 65 0a 63 6f 6d | ed.name.to.be.entered.in.the.com |
| 1572a0 | 70 69 6c 65 2d 74 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 | pile-time.environment.....File:. |
| 1572c0 | 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 35 2d 35 2d 37 2c 20 20 50 72 65 76 3a 20 | sicp.info,..Node:.5-5-7,..Prev:. |
| 1572e0 | 35 2d 35 2d 36 2c 20 20 55 70 3a 20 35 2d 35 0a 0a 35 2e 35 2e 37 20 49 6e 74 65 72 66 61 63 69 | 5-5-6,..Up:.5-5..5.5.7.Interfaci |
| 157300 | 6e 67 20 43 6f 6d 70 69 6c 65 64 20 43 6f 64 65 20 74 6f 20 74 68 65 20 45 76 61 6c 75 61 74 6f | ng.Compiled.Code.to.the.Evaluato |
| 157320 | 72 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | r.------------------------------ |
| 157340 | 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 57 65 20 68 61 76 65 20 6e 6f 74 20 | ------------------..We.have.not. |
| 157360 | 79 65 74 20 65 78 70 6c 61 69 6e 65 64 20 68 6f 77 20 74 6f 20 6c 6f 61 64 20 63 6f 6d 70 69 6c | yet.explained.how.to.load.compil |
| 157380 | 65 64 20 63 6f 64 65 20 69 6e 74 6f 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 0a 6d 61 63 68 69 | ed.code.into.the.evaluator.machi |
| 1573a0 | 6e 65 20 6f 72 20 68 6f 77 20 74 6f 20 72 75 6e 20 69 74 2e 20 20 57 65 20 77 69 6c 6c 20 61 73 | ne.or.how.to.run.it...We.will.as |
| 1573c0 | 73 75 6d 65 20 74 68 61 74 20 74 68 65 0a 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 2d 65 | sume.that.the.explicit-control-e |
| 1573e0 | 76 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 20 68 61 73 20 62 65 65 6e 20 64 65 66 69 6e 65 | valuator.machine.has.been.define |
| 157400 | 64 20 61 73 20 69 6e 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 35 2d 34 2d 34 3a 3a 2c 20 77 | d.as.in.section.*Note.5-4-4::,.w |
| 157420 | 69 74 68 20 74 68 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70 65 72 61 74 69 6f 6e 73 20 73 70 | ith.the.additional.operations.sp |
| 157440 | 65 63 69 66 69 65 64 20 69 6e 20 66 6f 6f 74 6e 6f 74 65 20 2a 4e 6f 74 65 0a 46 6f 6f 74 6e 6f | ecified.in.footnote.*Note.Footno |
| 157460 | 74 65 20 33 38 3a 3a 2e 20 20 57 65 20 77 69 6c 6c 20 69 6d 70 6c 65 6d 65 6e 74 20 61 20 70 72 | te.38::...We.will.implement.a.pr |
| 157480 | 6f 63 65 64 75 72 65 20 60 63 6f 6d 70 69 6c 65 2d 61 6e 64 2d 67 6f 27 20 74 68 61 74 0a 63 6f | ocedure.`compile-and-go'.that.co |
| 1574a0 | 6d 70 69 6c 65 73 20 61 20 53 63 68 65 6d 65 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 6c 6f 61 64 | mpiles.a.Scheme.expression,.load |
| 1574c0 | 73 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 6f 62 6a 65 63 74 20 63 6f 64 65 20 69 6e 74 6f | s.the.resulting.object.code.into |
| 1574e0 | 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 2c 20 61 6e 64 20 63 61 75 73 | .the.evaluator.machine,.and.caus |
| 157500 | 65 73 20 74 68 65 20 6d 61 63 68 69 6e 65 20 74 6f 20 72 75 6e 20 74 68 65 20 63 6f 64 65 20 69 | es.the.machine.to.run.the.code.i |
| 157520 | 6e 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 20 67 6c 6f 62 61 6c 20 65 6e 76 69 72 6f 6e 6d 65 | n.the.evaluator.global.environme |
| 157540 | 6e 74 2c 20 70 72 69 6e 74 20 74 68 65 20 72 65 73 75 6c 74 2c 20 61 6e 64 20 65 6e 74 65 72 20 | nt,.print.the.result,.and.enter. |
| 157560 | 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 27 73 20 64 72 69 76 65 72 20 6c 6f 6f 70 2e 20 20 57 65 | the.evaluator's.driver.loop...We |
| 157580 | 20 77 69 6c 6c 20 61 6c 73 6f 20 6d 6f 64 69 66 79 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 | .will.also.modify.the.evaluator. |
| 1575a0 | 73 6f 20 74 68 61 74 0a 69 6e 74 65 72 70 72 65 74 65 64 20 65 78 70 72 65 73 73 69 6f 6e 73 20 | so.that.interpreted.expressions. |
| 1575c0 | 63 61 6e 20 63 61 6c 6c 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 | can.call.compiled.procedures.as. |
| 1575e0 | 77 65 6c 6c 20 61 73 0a 69 6e 74 65 72 70 72 65 74 65 64 20 6f 6e 65 73 2e 20 20 57 65 20 63 61 | well.as.interpreted.ones...We.ca |
| 157600 | 6e 20 74 68 65 6e 20 70 75 74 20 61 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 20 | n.then.put.a.compiled.procedure. |
| 157620 | 69 6e 74 6f 20 74 68 65 0a 6d 61 63 68 69 6e 65 20 61 6e 64 20 75 73 65 20 74 68 65 20 65 76 61 | into.the.machine.and.use.the.eva |
| 157640 | 6c 75 61 74 6f 72 20 74 6f 20 63 61 6c 6c 20 69 74 3a 0a 0a 20 20 20 20 20 28 63 6f 6d 70 69 6c | luator.to.call.it:.......(compil |
| 157660 | 65 2d 61 6e 64 2d 67 6f 0a 20 20 20 20 20 20 27 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 | e-and-go.......'(define.(factori |
| 157680 | 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 | al.n)..........(if.(=.n.1)...... |
| 1576a0 | 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 66 61 63 74 6f | ........1..............(*.(facto |
| 1576c0 | 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 29 29 29 0a 20 20 20 20 20 20 3b 3b 3b 20 45 43 | rial.(-.n.1)).n)))).......;;;.EC |
| 1576e0 | 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 20 3b 3b 3b 20 | -Eval.value:......ok........;;;. |
| 157700 | 45 43 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 66 61 63 74 6f 72 69 61 6c 20 35 | EC-Eval.input:......(factorial.5 |
| 157720 | 29 0a 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 31 | )......;;;.EC-Eval.value:......1 |
| 157740 | 32 30 0a 0a 20 20 20 54 6f 20 61 6c 6c 6f 77 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 74 6f | 20.....To.allow.the.evaluator.to |
| 157760 | 20 68 61 6e 64 6c 65 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 28 66 6f 72 | .handle.compiled.procedures.(for |
| 157780 | 20 65 78 61 6d 70 6c 65 2c 0a 74 6f 20 65 76 61 6c 75 61 74 65 20 74 68 65 20 63 61 6c 6c 20 74 | .example,.to.evaluate.the.call.t |
| 1577a0 | 6f 20 60 66 61 63 74 6f 72 69 61 6c 27 20 61 62 6f 76 65 29 2c 20 77 65 20 6e 65 65 64 20 74 6f | o.`factorial'.above),.we.need.to |
| 1577c0 | 20 63 68 61 6e 67 65 20 74 68 65 20 63 6f 64 65 0a 61 74 20 60 61 70 70 6c 79 2d 64 69 73 70 61 | .change.the.code.at.`apply-dispa |
| 1577e0 | 74 63 68 27 20 28 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 34 2d 31 3a 3a 29 20 73 6f 20 | tch'.(section.*Note.5-4-1::).so. |
| 157800 | 74 68 61 74 20 69 74 20 72 65 63 6f 67 6e 69 7a 65 73 0a 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 | that.it.recognizes.compiled.proc |
| 157820 | 65 64 75 72 65 73 20 28 61 73 20 64 69 73 74 69 6e 63 74 20 66 72 6f 6d 20 63 6f 6d 70 6f 75 6e | edures.(as.distinct.from.compoun |
| 157840 | 64 20 6f 72 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 65 73 29 0a 61 6e 64 20 74 | d.or.primitive.procedures).and.t |
| 157860 | 72 61 6e 73 66 65 72 73 20 63 6f 6e 74 72 6f 6c 20 64 69 72 65 63 74 6c 79 20 74 6f 20 74 68 65 | ransfers.control.directly.to.the |
| 157880 | 20 65 6e 74 72 79 20 70 6f 69 6e 74 20 6f 66 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 0a 63 6f 64 | .entry.point.of.the.compiled.cod |
| 1578a0 | 65 3a 28 31 29 0a 0a 20 20 20 20 20 61 70 70 6c 79 2d 64 69 73 70 61 74 63 68 0a 20 20 20 20 20 | e:(1).......apply-dispatch...... |
| 1578c0 | 20 20 28 74 65 73 74 20 28 6f 70 20 70 72 69 6d 69 74 69 76 65 2d 70 72 6f 63 65 64 75 72 65 3f | ..(test.(op.primitive-procedure? |
| 1578e0 | 29 20 28 72 65 67 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 | ).(reg.proc))........(branch.(la |
| 157900 | 62 65 6c 20 70 72 69 6d 69 74 69 76 65 2d 61 70 70 6c 79 29 29 0a 20 20 20 20 20 20 20 28 74 65 | bel.primitive-apply))........(te |
| 157920 | 73 74 20 28 6f 70 20 63 6f 6d 70 6f 75 6e 64 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 67 | st.(op.compound-procedure?).(reg |
| 157940 | 20 70 72 6f 63 29 29 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 63 6f | .proc))........(branch.(label.co |
| 157960 | 6d 70 6f 75 6e 64 2d 61 70 70 6c 79 29 29 0a 20 20 20 20 20 20 20 28 74 65 73 74 20 28 6f 70 20 | mpound-apply))........(test.(op. |
| 157980 | 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 3f 29 20 28 72 65 67 20 70 72 6f 63 29 29 | compiled-procedure?).(reg.proc)) |
| 1579a0 | 0a 20 20 20 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 63 6f 6d 70 69 6c 65 64 2d | ........(branch.(label.compiled- |
| 1579c0 | 61 70 70 6c 79 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 6c 61 62 65 6c 20 75 6e 6b 6e | apply))........(goto.(label.unkn |
| 1579e0 | 6f 77 6e 2d 70 72 6f 63 65 64 75 72 65 2d 74 79 70 65 29 29 0a 0a 20 20 20 20 20 63 6f 6d 70 69 | own-procedure-type)).......compi |
| 157a00 | 6c 65 64 2d 61 70 70 6c 79 0a 20 20 20 20 20 20 20 28 72 65 73 74 6f 72 65 20 63 6f 6e 74 69 6e | led-apply........(restore.contin |
| 157a20 | 75 65 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 76 61 6c 20 28 6f 70 20 63 6f 6d 70 69 | ue)........(assign.val.(op.compi |
| 157a40 | 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 2d 65 6e 74 72 79 29 20 28 72 65 67 20 70 72 6f 63 29 29 | led-procedure-entry).(reg.proc)) |
| 157a60 | 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 0a 0a 20 20 20 4e 6f 74 | ........(goto.(reg.val)).....Not |
| 157a80 | 65 20 74 68 65 20 72 65 73 74 6f 72 65 20 6f 66 20 60 63 6f 6e 74 69 6e 75 65 27 20 61 74 20 60 | e.the.restore.of.`continue'.at.` |
| 157aa0 | 63 6f 6d 70 69 6c 65 64 2d 61 70 70 6c 79 27 2e 20 20 52 65 63 61 6c 6c 20 74 68 61 74 20 74 68 | compiled-apply'...Recall.that.th |
| 157ac0 | 65 0a 65 76 61 6c 75 61 74 6f 72 20 77 61 73 20 61 72 72 61 6e 67 65 64 20 73 6f 20 74 68 61 74 | e.evaluator.was.arranged.so.that |
| 157ae0 | 20 61 74 20 60 61 70 70 6c 79 2d 64 69 73 70 61 74 63 68 27 2c 20 74 68 65 20 63 6f 6e 74 69 6e | .at.`apply-dispatch',.the.contin |
| 157b00 | 75 61 74 69 6f 6e 0a 77 6f 75 6c 64 20 62 65 20 61 74 20 74 68 65 20 74 6f 70 20 6f 66 20 74 68 | uation.would.be.at.the.top.of.th |
| 157b20 | 65 20 73 74 61 63 6b 2e 20 20 54 68 65 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 65 6e 74 72 | e.stack...The.compiled.code.entr |
| 157b40 | 79 20 70 6f 69 6e 74 2c 20 6f 6e 0a 74 68 65 20 6f 74 68 65 72 20 68 61 6e 64 2c 20 65 78 70 65 | y.point,.on.the.other.hand,.expe |
| 157b60 | 63 74 73 20 74 68 65 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 74 6f 20 62 65 20 69 6e 20 60 63 | cts.the.continuation.to.be.in.`c |
| 157b80 | 6f 6e 74 69 6e 75 65 27 2c 20 73 6f 0a 60 63 6f 6e 74 69 6e 75 65 27 20 6d 75 73 74 20 62 65 20 | ontinue',.so.`continue'.must.be. |
| 157ba0 | 72 65 73 74 6f 72 65 64 20 62 65 66 6f 72 65 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 | restored.before.the.compiled.cod |
| 157bc0 | 65 20 69 73 20 65 78 65 63 75 74 65 64 2e 0a 0a 20 20 20 54 6f 20 65 6e 61 62 6c 65 20 75 73 20 | e.is.executed......To.enable.us. |
| 157be0 | 74 6f 20 72 75 6e 20 73 6f 6d 65 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 77 68 65 6e 20 77 | to.run.some.compiled.code.when.w |
| 157c00 | 65 20 73 74 61 72 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 0a 6d 61 63 68 69 6e 65 2c 20 77 | e.start.the.evaluator.machine,.w |
| 157c20 | 65 20 61 64 64 20 61 20 60 62 72 61 6e 63 68 27 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 61 74 20 | e.add.a.`branch'.instruction.at. |
| 157c40 | 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 20 6d | the.beginning.of.the.evaluator.m |
| 157c60 | 61 63 68 69 6e 65 2c 20 77 68 69 63 68 20 63 61 75 73 65 73 20 74 68 65 20 6d 61 63 68 69 6e 65 | achine,.which.causes.the.machine |
| 157c80 | 20 74 6f 20 67 6f 20 74 6f 20 61 20 6e 65 77 20 65 6e 74 72 79 20 70 6f 69 6e 74 0a 69 66 20 74 | .to.go.to.a.new.entry.point.if.t |
| 157ca0 | 68 65 20 60 66 6c 61 67 27 20 72 65 67 69 73 74 65 72 20 69 73 20 73 65 74 2e 28 32 29 0a 0a 20 | he.`flag'.register.is.set.(2)... |
| 157cc0 | 20 20 20 20 28 62 72 61 6e 63 68 20 28 6c 61 62 65 6c 20 65 78 74 65 72 6e 61 6c 2d 65 6e 74 72 | ....(branch.(label.external-entr |
| 157ce0 | 79 29 29 20 20 20 20 20 20 3b 20 62 72 61 6e 63 68 65 73 20 69 66 20 60 66 6c 61 67 27 20 69 73 | y))......;.branches.if.`flag'.is |
| 157d00 | 20 73 65 74 0a 20 20 20 20 20 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 6e 74 2d 6c 6f 6f 70 0a 20 | .set......read-eval-print-loop.. |
| 157d20 | 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 69 6e 69 74 69 61 6c 69 7a 65 2d 73 74 | ......(perform.(op.initialize-st |
| 157d40 | 61 63 6b 29 29 0a 20 20 20 20 20 20 20 2e 2e 2e 0a 0a 20 20 20 60 45 78 74 65 72 6e 61 6c 2d 65 | ack))................`External-e |
| 157d60 | 6e 74 72 79 27 20 61 73 73 75 6d 65 73 20 74 68 61 74 20 74 68 65 20 6d 61 63 68 69 6e 65 20 69 | ntry'.assumes.that.the.machine.i |
| 157d80 | 73 20 73 74 61 72 74 65 64 20 77 69 74 68 20 60 76 61 6c 27 0a 63 6f 6e 74 61 69 6e 69 6e 67 20 | s.started.with.`val'.containing. |
| 157da0 | 74 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 | the.location.of.an.instruction.s |
| 157dc0 | 65 71 75 65 6e 63 65 20 74 68 61 74 20 70 75 74 73 20 61 20 72 65 73 75 6c 74 0a 69 6e 74 6f 20 | equence.that.puts.a.result.into. |
| 157de0 | 60 76 61 6c 27 20 61 6e 64 20 65 6e 64 73 20 77 69 74 68 20 60 28 67 6f 74 6f 20 28 72 65 67 20 | `val'.and.ends.with.`(goto.(reg. |
| 157e00 | 63 6f 6e 74 69 6e 75 65 29 29 27 2e 20 20 53 74 61 72 74 69 6e 67 20 61 74 20 74 68 69 73 0a 65 | continue))'...Starting.at.this.e |
| 157e20 | 6e 74 72 79 20 70 6f 69 6e 74 20 6a 75 6d 70 73 20 74 6f 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e | ntry.point.jumps.to.the.location |
| 157e40 | 20 64 65 73 69 67 6e 61 74 65 64 20 62 79 20 60 76 61 6c 27 2c 20 62 75 74 20 66 69 72 73 74 20 | .designated.by.`val',.but.first. |
| 157e60 | 61 73 73 69 67 6e 73 0a 60 63 6f 6e 74 69 6e 75 65 27 20 73 6f 20 74 68 61 74 20 65 78 65 63 75 | assigns.`continue'.so.that.execu |
| 157e80 | 74 69 6f 6e 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 6f 20 60 70 72 69 6e 74 2d 72 65 73 75 6c | tion.will.return.to.`print-resul |
| 157ea0 | 74 27 2c 20 77 68 69 63 68 0a 70 72 69 6e 74 73 20 74 68 65 20 76 61 6c 75 65 20 69 6e 20 60 76 | t',.which.prints.the.value.in.`v |
| 157ec0 | 61 6c 27 20 61 6e 64 20 74 68 65 6e 20 67 6f 65 73 20 74 6f 20 74 68 65 20 62 65 67 69 6e 6e 69 | al'.and.then.goes.to.the.beginni |
| 157ee0 | 6e 67 20 6f 66 20 74 68 65 0a 65 76 61 6c 75 61 74 6f 72 27 73 20 72 65 61 64 2d 65 76 61 6c 2d | ng.of.the.evaluator's.read-eval- |
| 157f00 | 70 72 69 6e 74 20 6c 6f 6f 70 2e 28 33 29 0a 0a 20 20 20 20 20 65 78 74 65 72 6e 61 6c 2d 65 6e | print.loop.(3).......external-en |
| 157f20 | 74 72 79 0a 20 20 20 20 20 20 20 28 70 65 72 66 6f 72 6d 20 28 6f 70 20 69 6e 69 74 69 61 6c 69 | try........(perform.(op.initiali |
| 157f40 | 7a 65 2d 73 74 61 63 6b 29 29 0a 20 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 65 6e 76 20 28 6f | ze-stack))........(assign.env.(o |
| 157f60 | 70 20 67 65 74 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 29 0a 20 20 20 20 20 | p.get-global-environment))...... |
| 157f80 | 20 20 28 61 73 73 69 67 6e 20 63 6f 6e 74 69 6e 75 65 20 28 6c 61 62 65 6c 20 70 72 69 6e 74 2d | ..(assign.continue.(label.print- |
| 157fa0 | 72 65 73 75 6c 74 29 29 0a 20 20 20 20 20 20 20 28 67 6f 74 6f 20 28 72 65 67 20 76 61 6c 29 29 | result))........(goto.(reg.val)) |
| 157fc0 | 0a 0a 20 20 20 4e 6f 77 20 77 65 20 63 61 6e 20 75 73 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e | .....Now.we.can.use.the.followin |
| 157fe0 | 67 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 63 6f 6d 70 69 6c 65 20 61 20 70 72 6f 63 65 64 75 | g.procedure.to.compile.a.procedu |
| 158000 | 72 65 0a 64 65 66 69 6e 69 74 69 6f 6e 2c 20 65 78 65 63 75 74 65 20 74 68 65 20 63 6f 6d 70 69 | re.definition,.execute.the.compi |
| 158020 | 6c 65 64 20 63 6f 64 65 2c 20 61 6e 64 20 72 75 6e 20 74 68 65 20 72 65 61 64 2d 65 76 61 6c 2d | led.code,.and.run.the.read-eval- |
| 158040 | 70 72 69 6e 74 20 6c 6f 6f 70 0a 73 6f 20 77 65 20 63 61 6e 20 74 72 79 20 74 68 65 20 70 72 6f | print.loop.so.we.can.try.the.pro |
| 158060 | 63 65 64 75 72 65 2e 20 20 42 65 63 61 75 73 65 20 77 65 20 77 61 6e 74 20 74 68 65 20 63 6f 6d | cedure...Because.we.want.the.com |
| 158080 | 70 69 6c 65 64 20 63 6f 64 65 20 74 6f 0a 72 65 74 75 72 6e 20 74 6f 20 74 68 65 20 6c 6f 63 61 | piled.code.to.return.to.the.loca |
| 1580a0 | 74 69 6f 6e 20 69 6e 20 60 63 6f 6e 74 69 6e 75 65 27 20 77 69 74 68 20 69 74 73 20 72 65 73 75 | tion.in.`continue'.with.its.resu |
| 1580c0 | 6c 74 20 69 6e 20 60 76 61 6c 27 2c 20 77 65 0a 63 6f 6d 70 69 6c 65 20 74 68 65 20 65 78 70 72 | lt.in.`val',.we.compile.the.expr |
| 1580e0 | 65 73 73 69 6f 6e 20 77 69 74 68 20 61 20 74 61 72 67 65 74 20 6f 66 20 60 76 61 6c 27 20 61 6e | ession.with.a.target.of.`val'.an |
| 158100 | 64 20 61 20 6c 69 6e 6b 61 67 65 20 6f 66 0a 60 72 65 74 75 72 6e 27 2e 20 20 49 6e 20 6f 72 64 | d.a.linkage.of.`return'...In.ord |
| 158120 | 65 72 20 74 6f 20 74 72 61 6e 73 66 6f 72 6d 20 74 68 65 20 6f 62 6a 65 63 74 20 63 6f 64 65 20 | er.to.transform.the.object.code. |
| 158140 | 70 72 6f 64 75 63 65 64 20 62 79 20 74 68 65 0a 63 6f 6d 70 69 6c 65 72 20 69 6e 74 6f 20 65 78 | produced.by.the.compiler.into.ex |
| 158160 | 65 63 75 74 61 62 6c 65 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 65 76 | ecutable.instructions.for.the.ev |
| 158180 | 61 6c 75 61 74 6f 72 20 72 65 67 69 73 74 65 72 0a 6d 61 63 68 69 6e 65 2c 20 77 65 20 75 73 65 | aluator.register.machine,.we.use |
| 1581a0 | 20 74 68 65 20 70 72 6f 63 65 64 75 72 65 20 60 61 73 73 65 6d 62 6c 65 27 20 66 72 6f 6d 20 74 | .the.procedure.`assemble'.from.t |
| 1581c0 | 68 65 20 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 0a 73 69 6d 75 6c 61 74 6f 72 20 28 73 | he.register-machine.simulator.(s |
| 1581e0 | 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 32 2d 32 3a 3a 29 2e 20 20 57 65 20 74 68 65 6e 20 | ection.*Note.5-2-2::)...We.then. |
| 158200 | 69 6e 69 74 69 61 6c 69 7a 65 20 74 68 65 20 60 76 61 6c 27 0a 72 65 67 69 73 74 65 72 20 74 6f | initialize.the.`val'.register.to |
| 158220 | 20 70 6f 69 6e 74 20 74 6f 20 74 68 65 20 6c 69 73 74 20 6f 66 20 69 6e 73 74 72 75 63 74 69 6f | .point.to.the.list.of.instructio |
| 158240 | 6e 73 2c 20 73 65 74 20 74 68 65 20 60 66 6c 61 67 27 20 73 6f 20 74 68 61 74 0a 74 68 65 20 65 | ns,.set.the.`flag'.so.that.the.e |
| 158260 | 76 61 6c 75 61 74 6f 72 20 77 69 6c 6c 20 67 6f 20 74 6f 20 60 65 78 74 65 72 6e 61 6c 2d 65 6e | valuator.will.go.to.`external-en |
| 158280 | 74 72 79 27 2c 20 61 6e 64 20 73 74 61 72 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 2e 0a 0a | try',.and.start.the.evaluator... |
| 1582a0 | 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 63 6f 6d 70 69 6c 65 2d 61 6e 64 2d 67 6f 20 65 78 70 | .....(define.(compile-and-go.exp |
| 1582c0 | 72 65 73 73 69 6f 6e 29 0a 20 20 20 20 20 20 20 28 6c 65 74 20 28 28 69 6e 73 74 72 75 63 74 69 | ression)........(let.((instructi |
| 1582e0 | 6f 6e 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 61 73 73 65 6d 62 6c 65 20 28 73 74 61 | ons...............(assemble.(sta |
| 158300 | 74 65 6d 65 6e 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tements......................... |
| 158320 | 20 28 63 6f 6d 70 69 6c 65 20 65 78 70 72 65 73 73 69 6f 6e 20 27 76 61 6c 20 27 72 65 74 75 72 | .(compile.expression.'val.'retur |
| 158340 | 6e 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 63 65 76 | n)).........................ecev |
| 158360 | 61 6c 29 29 29 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 21 20 74 68 65 2d 67 6c 6f 62 61 6c 2d | al)))..........(set!.the-global- |
| 158380 | 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 28 73 65 74 75 70 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 29 29 | environment.(setup-environment)) |
| 1583a0 | 0a 20 20 20 20 20 20 20 20 20 28 73 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 | ..........(set-register-contents |
| 1583c0 | 21 20 65 63 65 76 61 6c 20 27 76 61 6c 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 29 0a 20 20 20 20 | !.eceval.'val.instructions)..... |
| 1583e0 | 20 20 20 20 20 28 73 65 74 2d 72 65 67 69 73 74 65 72 2d 63 6f 6e 74 65 6e 74 73 21 20 65 63 65 | .....(set-register-contents!.ece |
| 158400 | 76 61 6c 20 27 66 6c 61 67 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 20 28 73 74 61 72 74 20 | val.'flag.true)..........(start. |
| 158420 | 65 63 65 76 61 6c 29 29 29 0a 0a 20 20 20 49 66 20 77 65 20 68 61 76 65 20 73 65 74 20 75 70 20 | eceval))).....If.we.have.set.up. |
| 158440 | 73 74 61 63 6b 20 6d 6f 6e 69 74 6f 72 69 6e 67 2c 20 61 73 20 61 74 20 74 68 65 20 65 6e 64 20 | stack.monitoring,.as.at.the.end. |
| 158460 | 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 0a 35 2d 34 2d 34 3a 3a 2c 20 77 65 20 63 61 6e | of.section.*Note.5-4-4::,.we.can |
| 158480 | 20 65 78 61 6d 69 6e 65 20 74 68 65 20 73 74 61 63 6b 20 75 73 61 67 65 20 6f 66 20 63 6f 6d 70 | .examine.the.stack.usage.of.comp |
| 1584a0 | 69 6c 65 64 20 63 6f 64 65 3a 0a 0a 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 61 6e 64 2d 67 6f | iled.code:.......(compile-and-go |
| 1584c0 | 0a 20 20 20 20 20 20 27 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 61 6c 20 6e 29 0a 20 20 | .......'(define.(factorial.n)... |
| 1584e0 | 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .......(if.(=.n.1).............. |
| 158500 | 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 | 1..............(*.(factorial.(-. |
| 158520 | 6e 20 31 29 29 20 6e 29 29 29 29 0a 0a 20 20 20 20 20 28 74 6f 74 61 6c 2d 70 75 73 68 65 73 20 | n.1)).n)))).......(total-pushes. |
| 158540 | 3d 20 30 20 6d 61 78 69 6d 75 6d 2d 64 65 70 74 68 20 3d 20 30 29 0a 20 20 20 20 20 20 3b 3b 3b | =.0.maximum-depth.=.0).......;;; |
| 158560 | 20 45 43 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 20 3b | .EC-Eval.value:......ok........; |
| 158580 | 3b 3b 20 45 43 2d 45 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 28 66 61 63 74 6f 72 69 61 | ;;.EC-Eval.input:......(factoria |
| 1585a0 | 6c 20 35 29 0a 20 20 20 20 20 28 74 6f 74 61 6c 2d 70 75 73 68 65 73 20 3d 20 33 31 20 6d 61 78 | l.5)......(total-pushes.=.31.max |
| 1585c0 | 69 6d 75 6d 2d 64 65 70 74 68 20 3d 20 31 34 29 0a 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 76 61 | imum-depth.=.14)......;;;.EC-Eva |
| 1585e0 | 6c 20 76 61 6c 75 65 3a 0a 20 20 20 20 20 31 32 30 0a 0a 20 20 20 43 6f 6d 70 61 72 65 20 74 68 | l.value:......120.....Compare.th |
| 158600 | 69 73 20 65 78 61 6d 70 6c 65 20 77 69 74 68 20 74 68 65 20 65 76 61 6c 75 61 74 69 6f 6e 20 6f | is.example.with.the.evaluation.o |
| 158620 | 66 20 60 28 66 61 63 74 6f 72 69 61 6c 20 35 29 27 20 75 73 69 6e 67 20 74 68 65 0a 69 6e 74 65 | f.`(factorial.5)'.using.the.inte |
| 158640 | 72 70 72 65 74 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 73 61 6d 65 20 70 72 6f 63 | rpreted.version.of.the.same.proc |
| 158660 | 65 64 75 72 65 2c 20 73 68 6f 77 6e 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 73 65 63 74 69 | edure,.shown.at.the.end.of.secti |
| 158680 | 6f 6e 0a 2a 4e 6f 74 65 20 35 2d 34 2d 34 3a 3a 2e 20 20 54 68 65 20 69 6e 74 65 72 70 72 65 74 | on.*Note.5-4-4::...The.interpret |
| 1586a0 | 65 64 20 76 65 72 73 69 6f 6e 20 72 65 71 75 69 72 65 64 20 31 34 34 20 70 75 73 68 65 73 20 61 | ed.version.required.144.pushes.a |
| 1586c0 | 6e 64 20 61 0a 6d 61 78 69 6d 75 6d 20 73 74 61 63 6b 20 64 65 70 74 68 20 6f 66 20 32 38 2e 20 | nd.a.maximum.stack.depth.of.28.. |
| 1586e0 | 20 54 68 69 73 20 69 6c 6c 75 73 74 72 61 74 65 73 20 74 68 65 20 6f 70 74 69 6d 69 7a 61 74 69 | .This.illustrates.the.optimizati |
| 158700 | 6f 6e 20 74 68 61 74 0a 72 65 73 75 6c 74 73 20 66 72 6f 6d 20 6f 75 72 20 63 6f 6d 70 69 6c 61 | on.that.results.from.our.compila |
| 158720 | 74 69 6f 6e 20 73 74 72 61 74 65 67 79 2e 0a 0a 49 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 61 | tion.strategy...Interpretation.a |
| 158740 | 6e 64 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 0a 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e | nd.compilation.................. |
| 158760 | 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 2e 0a 0a 57 69 74 68 20 74 68 65 20 70 72 6f 67 72 61 6d 73 | ...............With.the.programs |
| 158780 | 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 2c 20 77 65 20 63 61 6e 20 6e 6f 77 20 65 78 70 | .in.this.section,.we.can.now.exp |
| 1587a0 | 65 72 69 6d 65 6e 74 20 77 69 74 68 20 74 68 65 0a 61 6c 74 65 72 6e 61 74 69 76 65 20 65 78 65 | eriment.with.the.alternative.exe |
| 1587c0 | 63 75 74 69 6f 6e 20 73 74 72 61 74 65 67 69 65 73 20 6f 66 20 69 6e 74 65 72 70 72 65 74 61 74 | cution.strategies.of.interpretat |
| 1587e0 | 69 6f 6e 20 61 6e 64 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 2e 28 34 29 0a 41 6e 20 69 6e 74 65 72 | ion.and.compilation.(4).An.inter |
| 158800 | 70 72 65 74 65 72 20 72 61 69 73 65 73 20 74 68 65 20 6d 61 63 68 69 6e 65 20 74 6f 20 74 68 65 | preter.raises.the.machine.to.the |
| 158820 | 20 6c 65 76 65 6c 20 6f 66 20 74 68 65 20 75 73 65 72 20 70 72 6f 67 72 61 6d 3b 20 61 0a 63 6f | .level.of.the.user.program;.a.co |
| 158840 | 6d 70 69 6c 65 72 20 6c 6f 77 65 72 73 20 74 68 65 20 75 73 65 72 20 70 72 6f 67 72 61 6d 20 74 | mpiler.lowers.the.user.program.t |
| 158860 | 6f 20 74 68 65 20 6c 65 76 65 6c 20 6f 66 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 | o.the.level.of.the.machine.langu |
| 158880 | 61 67 65 2e 0a 57 65 20 63 61 6e 20 72 65 67 61 72 64 20 74 68 65 20 53 63 68 65 6d 65 20 6c 61 | age..We.can.regard.the.Scheme.la |
| 1588a0 | 6e 67 75 61 67 65 20 28 6f 72 20 61 6e 79 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 | nguage.(or.any.programming.langu |
| 1588c0 | 61 67 65 29 20 61 73 20 61 0a 63 6f 68 65 72 65 6e 74 20 66 61 6d 69 6c 79 20 6f 66 20 61 62 73 | age).as.a.coherent.family.of.abs |
| 1588e0 | 74 72 61 63 74 69 6f 6e 73 20 65 72 65 63 74 65 64 20 6f 6e 20 74 68 65 20 6d 61 63 68 69 6e 65 | tractions.erected.on.the.machine |
| 158900 | 20 6c 61 6e 67 75 61 67 65 2e 0a 49 6e 74 65 72 70 72 65 74 65 72 73 20 61 72 65 20 67 6f 6f 64 | .language..Interpreters.are.good |
| 158920 | 20 66 6f 72 20 69 6e 74 65 72 61 63 74 69 76 65 20 70 72 6f 67 72 61 6d 20 64 65 76 65 6c 6f 70 | .for.interactive.program.develop |
| 158940 | 6d 65 6e 74 20 61 6e 64 20 64 65 62 75 67 67 69 6e 67 0a 62 65 63 61 75 73 65 20 74 68 65 20 73 | ment.and.debugging.because.the.s |
| 158960 | 74 65 70 73 20 6f 66 20 70 72 6f 67 72 61 6d 20 65 78 65 63 75 74 69 6f 6e 20 61 72 65 20 6f 72 | teps.of.program.execution.are.or |
| 158980 | 67 61 6e 69 7a 65 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 65 73 65 0a 61 62 73 74 72 61 | ganized.in.terms.of.these.abstra |
| 1589a0 | 63 74 69 6f 6e 73 2c 20 61 6e 64 20 61 72 65 20 74 68 65 72 65 66 6f 72 65 20 6d 6f 72 65 20 69 | ctions,.and.are.therefore.more.i |
| 1589c0 | 6e 74 65 6c 6c 69 67 69 62 6c 65 20 74 6f 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 65 72 2e 0a 43 | ntelligible.to.the.programmer..C |
| 1589e0 | 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 63 61 6e 20 65 78 65 63 75 74 65 20 66 61 73 74 65 72 2c | ompiled.code.can.execute.faster, |
| 158a00 | 20 62 65 63 61 75 73 65 20 74 68 65 20 73 74 65 70 73 20 6f 66 20 70 72 6f 67 72 61 6d 0a 65 78 | .because.the.steps.of.program.ex |
| 158a20 | 65 63 75 74 69 6f 6e 20 61 72 65 20 6f 72 67 61 6e 69 7a 65 64 20 69 6e 20 74 65 72 6d 73 20 6f | ecution.are.organized.in.terms.o |
| 158a40 | 66 20 74 68 65 20 6d 61 63 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 2c 20 61 6e 64 20 74 68 65 0a | f.the.machine.language,.and.the. |
| 158a60 | 63 6f 6d 70 69 6c 65 72 20 69 73 20 66 72 65 65 20 74 6f 20 6d 61 6b 65 20 6f 70 74 69 6d 69 7a | compiler.is.free.to.make.optimiz |
| 158a80 | 61 74 69 6f 6e 73 20 74 68 61 74 20 63 75 74 20 61 63 72 6f 73 73 20 74 68 65 20 68 69 67 68 65 | ations.that.cut.across.the.highe |
| 158aa0 | 72 2d 6c 65 76 65 6c 0a 61 62 73 74 72 61 63 74 69 6f 6e 73 2e 28 35 29 0a 0a 20 20 20 54 68 65 | r-level.abstractions.(5).....The |
| 158ac0 | 20 61 6c 74 65 72 6e 61 74 69 76 65 73 20 6f 66 20 69 6e 74 65 72 70 72 65 74 61 74 69 6f 6e 20 | .alternatives.of.interpretation. |
| 158ae0 | 61 6e 64 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 61 6c 73 6f 20 6c 65 61 64 20 74 6f 0a 64 69 66 | and.compilation.also.lead.to.dif |
| 158b00 | 66 65 72 65 6e 74 20 73 74 72 61 74 65 67 69 65 73 20 66 6f 72 20 70 6f 72 74 69 6e 67 20 6c 61 | ferent.strategies.for.porting.la |
| 158b20 | 6e 67 75 61 67 65 73 20 74 6f 20 6e 65 77 20 63 6f 6d 70 75 74 65 72 73 2e 20 53 75 70 70 6f 73 | nguages.to.new.computers..Suppos |
| 158b40 | 65 0a 74 68 61 74 20 77 65 20 77 69 73 68 20 74 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 4c 69 73 70 | e.that.we.wish.to.implement.Lisp |
| 158b60 | 20 66 6f 72 20 61 20 6e 65 77 20 6d 61 63 68 69 6e 65 2e 20 20 4f 6e 65 20 73 74 72 61 74 65 67 | .for.a.new.machine...One.strateg |
| 158b80 | 79 20 69 73 20 74 6f 0a 62 65 67 69 6e 20 77 69 74 68 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d | y.is.to.begin.with.the.explicit- |
| 158ba0 | 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f | control.evaluator.of.section.*No |
| 158bc0 | 74 65 20 35 2d 34 3a 3a 20 61 6e 64 0a 74 72 61 6e 73 6c 61 74 65 20 69 74 73 20 69 6e 73 74 72 | te.5-4::.and.translate.its.instr |
| 158be0 | 75 63 74 69 6f 6e 73 20 74 6f 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 | uctions.to.instructions.for.the. |
| 158c00 | 6e 65 77 20 6d 61 63 68 69 6e 65 2e 20 20 41 0a 64 69 66 66 65 72 65 6e 74 20 73 74 72 61 74 65 | new.machine...A.different.strate |
| 158c20 | 67 79 20 69 73 20 74 6f 20 62 65 67 69 6e 20 77 69 74 68 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 | gy.is.to.begin.with.the.compiler |
| 158c40 | 20 61 6e 64 20 63 68 61 6e 67 65 20 74 68 65 20 63 6f 64 65 0a 67 65 6e 65 72 61 74 6f 72 73 20 | .and.change.the.code.generators. |
| 158c60 | 73 6f 20 74 68 61 74 20 74 68 65 79 20 67 65 6e 65 72 61 74 65 20 63 6f 64 65 20 66 6f 72 20 74 | so.that.they.generate.code.for.t |
| 158c80 | 68 65 20 6e 65 77 20 6d 61 63 68 69 6e 65 2e 20 20 54 68 65 20 73 65 63 6f 6e 64 0a 73 74 72 61 | he.new.machine...The.second.stra |
| 158ca0 | 74 65 67 79 20 61 6c 6c 6f 77 73 20 75 73 20 74 6f 20 72 75 6e 20 61 6e 79 20 4c 69 73 70 20 70 | tegy.allows.us.to.run.any.Lisp.p |
| 158cc0 | 72 6f 67 72 61 6d 20 6f 6e 20 74 68 65 20 6e 65 77 20 6d 61 63 68 69 6e 65 20 62 79 20 66 69 72 | rogram.on.the.new.machine.by.fir |
| 158ce0 | 73 74 0a 63 6f 6d 70 69 6c 69 6e 67 20 69 74 20 77 69 74 68 20 74 68 65 20 63 6f 6d 70 69 6c 65 | st.compiling.it.with.the.compile |
| 158d00 | 72 20 72 75 6e 6e 69 6e 67 20 6f 6e 20 6f 75 72 20 6f 72 69 67 69 6e 61 6c 20 4c 69 73 70 20 73 | r.running.on.our.original.Lisp.s |
| 158d20 | 79 73 74 65 6d 2c 20 61 6e 64 0a 6c 69 6e 6b 69 6e 67 20 69 74 20 77 69 74 68 20 61 20 63 6f 6d | ystem,.and.linking.it.with.a.com |
| 158d40 | 70 69 6c 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 72 75 6e 2d 74 69 6d 65 20 6c 69 | piled.version.of.the.run-time.li |
| 158d60 | 62 72 61 72 79 2e 28 36 29 20 42 65 74 74 65 72 0a 79 65 74 2c 20 77 65 20 63 61 6e 20 63 6f 6d | brary.(6).Better.yet,.we.can.com |
| 158d80 | 70 69 6c 65 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 69 74 73 65 6c 66 2c 20 61 6e 64 20 72 75 | pile.the.compiler.itself,.and.ru |
| 158da0 | 6e 20 74 68 69 73 20 6f 6e 20 74 68 65 20 6e 65 77 0a 6d 61 63 68 69 6e 65 20 74 6f 20 63 6f 6d | n.this.on.the.new.machine.to.com |
| 158dc0 | 70 69 6c 65 20 6f 74 68 65 72 20 4c 69 73 70 20 70 72 6f 67 72 61 6d 73 2e 28 37 29 20 20 4f 72 | pile.other.Lisp.programs.(7)..Or |
| 158de0 | 20 77 65 20 63 61 6e 20 63 6f 6d 70 69 6c 65 20 6f 6e 65 20 6f 66 0a 74 68 65 20 69 6e 74 65 72 | .we.can.compile.one.of.the.inter |
| 158e00 | 70 72 65 74 65 72 73 20 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 3a 3a 20 74 | preters.of.section.*Note.4-1::.t |
| 158e20 | 6f 20 70 72 6f 64 75 63 65 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 72 20 74 68 61 74 0a 72 75 | o.produce.an.interpreter.that.ru |
| 158e40 | 6e 73 20 6f 6e 20 74 68 65 20 6e 65 77 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 20 20 2a 45 78 | ns.on.the.new.machine........*Ex |
| 158e60 | 65 72 63 69 73 65 20 35 2e 34 35 3a 2a 20 42 79 20 63 6f 6d 70 61 72 69 6e 67 20 74 68 65 20 73 | ercise.5.45:*.By.comparing.the.s |
| 158e80 | 74 61 63 6b 20 6f 70 65 72 61 74 69 6f 6e 73 20 75 73 65 64 20 62 79 0a 20 20 20 20 20 63 6f 6d | tack.operations.used.by......com |
| 158ea0 | 70 69 6c 65 64 20 63 6f 64 65 20 74 6f 20 74 68 65 20 73 74 61 63 6b 20 6f 70 65 72 61 74 69 6f | piled.code.to.the.stack.operatio |
| 158ec0 | 6e 73 20 75 73 65 64 20 62 79 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 66 6f 72 20 74 68 65 | ns.used.by.the.evaluator.for.the |
| 158ee0 | 0a 20 20 20 20 20 73 61 6d 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 2c 20 77 65 20 63 61 6e 20 64 | ......same.computation,.we.can.d |
| 158f00 | 65 74 65 72 6d 69 6e 65 20 74 68 65 20 65 78 74 65 6e 74 20 74 6f 20 77 68 69 63 68 20 74 68 65 | etermine.the.extent.to.which.the |
| 158f20 | 0a 20 20 20 20 20 63 6f 6d 70 69 6c 65 72 20 6f 70 74 69 6d 69 7a 65 73 20 75 73 65 20 6f 66 20 | ......compiler.optimizes.use.of. |
| 158f40 | 74 68 65 20 73 74 61 63 6b 2c 20 62 6f 74 68 20 69 6e 20 73 70 65 65 64 20 28 72 65 64 75 63 69 | the.stack,.both.in.speed.(reduci |
| 158f60 | 6e 67 20 74 68 65 0a 20 20 20 20 20 74 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 61 63 | ng.the......total.number.of.stac |
| 158f80 | 6b 20 6f 70 65 72 61 74 69 6f 6e 73 29 20 61 6e 64 20 69 6e 20 73 70 61 63 65 20 28 72 65 64 75 | k.operations).and.in.space.(redu |
| 158fa0 | 63 69 6e 67 20 74 68 65 0a 20 20 20 20 20 6d 61 78 69 6d 75 6d 20 73 74 61 63 6b 20 64 65 70 74 | cing.the......maximum.stack.dept |
| 158fc0 | 68 29 2e 20 20 43 6f 6d 70 61 72 69 6e 67 20 74 68 69 73 20 6f 70 74 69 6d 69 7a 65 64 20 73 74 | h)...Comparing.this.optimized.st |
| 158fe0 | 61 63 6b 20 75 73 65 20 74 6f 20 74 68 65 0a 20 20 20 20 20 70 65 72 66 6f 72 6d 61 6e 63 65 20 | ack.use.to.the......performance. |
| 159000 | 6f 66 20 61 20 73 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 6d 61 63 68 69 6e 65 20 66 6f 72 | of.a.special-purpose.machine.for |
| 159020 | 20 74 68 65 20 73 61 6d 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 0a 20 20 20 20 20 67 69 76 65 73 | .the.same.computation......gives |
| 159040 | 20 73 6f 6d 65 20 69 6e 64 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 71 75 61 6c 69 74 79 20 | .some.indication.of.the.quality. |
| 159060 | 6f 66 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 2e 0a 0a 20 20 20 20 20 20 20 61 2e 20 2a 4e 6f 74 | of.the.compiler..........a..*Not |
| 159080 | 65 20 45 78 65 72 63 69 73 65 20 35 2d 32 37 3a 3a 20 61 73 6b 65 64 20 79 6f 75 20 74 6f 20 64 | e.Exercise.5-27::.asked.you.to.d |
| 1590a0 | 65 74 65 72 6d 69 6e 65 2c 20 61 73 20 61 20 66 75 6e 63 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 | etermine,.as.a.function......... |
| 1590c0 | 20 20 6f 66 20 6e 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 75 73 68 65 73 20 61 6e 64 | ..of.n,.the.number.of.pushes.and |
| 1590e0 | 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 73 74 61 63 6b 20 64 65 70 74 68 20 6e 65 65 64 65 64 0a | .the.maximum.stack.depth.needed. |
| 159100 | 20 20 20 20 20 20 20 20 20 20 62 79 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 74 6f 20 63 6f | ..........by.the.evaluator.to.co |
| 159120 | 6d 70 75 74 65 20 6e 21 20 20 75 73 69 6e 67 20 74 68 65 20 72 65 63 75 72 73 69 76 65 20 66 61 | mpute.n!..using.the.recursive.fa |
| 159140 | 63 74 6f 72 69 61 6c 0a 20 20 20 20 20 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 20 67 69 76 65 | ctorial...........procedure.give |
| 159160 | 6e 20 61 62 6f 76 65 2e 20 20 2a 4e 6f 74 65 20 45 78 65 72 63 69 73 65 20 35 2d 31 34 3a 3a 20 | n.above...*Note.Exercise.5-14::. |
| 159180 | 61 73 6b 65 64 20 79 6f 75 20 74 6f 20 64 6f 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 20 73 61 | asked.you.to.do...........the.sa |
| 1591a0 | 6d 65 20 6d 65 61 73 75 72 65 6d 65 6e 74 73 20 66 6f 72 20 74 68 65 20 73 70 65 63 69 61 6c 2d | me.measurements.for.the.special- |
| 1591c0 | 70 75 72 70 6f 73 65 20 66 61 63 74 6f 72 69 61 6c 0a 20 20 20 20 20 20 20 20 20 20 6d 61 63 68 | purpose.factorial...........mach |
| 1591e0 | 69 6e 65 20 73 68 6f 77 6e 20 69 6e 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 31 3a 3a | ine.shown.in.*Note.Figure.5-11:: |
| 159200 | 2e 20 4e 6f 77 20 70 65 72 66 6f 72 6d 20 74 68 65 20 73 61 6d 65 0a 20 20 20 20 20 20 20 20 20 | ..Now.perform.the.same.......... |
| 159220 | 20 61 6e 61 6c 79 73 69 73 20 75 73 69 6e 67 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 60 66 61 | .analysis.using.the.compiled.`fa |
| 159240 | 63 74 6f 72 69 61 6c 27 20 70 72 6f 63 65 64 75 72 65 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 54 | ctorial'.procedure.............T |
| 159260 | 61 6b 65 20 74 68 65 20 72 61 74 69 6f 20 6f 66 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 | ake.the.ratio.of.the.number.of.p |
| 159280 | 75 73 68 65 73 20 69 6e 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 0a 20 20 20 20 20 20 20 20 20 20 | ushes.in.the.compiled........... |
| 1592a0 | 76 65 72 73 69 6f 6e 20 74 6f 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 75 73 68 65 73 20 | version.to.the.number.of.pushes. |
| 1592c0 | 69 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 64 20 76 65 72 73 69 6f 6e 2c 0a 20 20 20 20 | in.the.interpreted.version,..... |
| 1592e0 | 20 20 20 20 20 20 61 6e 64 20 64 6f 20 74 68 65 20 73 61 6d 65 20 66 6f 72 20 74 68 65 20 6d 61 | ......and.do.the.same.for.the.ma |
| 159300 | 78 69 6d 75 6d 20 73 74 61 63 6b 20 64 65 70 74 68 2e 20 20 53 69 6e 63 65 20 74 68 65 0a 20 20 | ximum.stack.depth...Since.the... |
| 159320 | 20 20 20 20 20 20 20 20 6e 75 6d 62 65 72 20 6f 66 20 6f 70 65 72 61 74 69 6f 6e 73 20 61 6e 64 | ........number.of.operations.and |
| 159340 | 20 74 68 65 20 73 74 61 63 6b 20 64 65 70 74 68 20 75 73 65 64 20 74 6f 20 63 6f 6d 70 75 74 65 | .the.stack.depth.used.to.compute |
| 159360 | 20 6e 21 0a 20 20 20 20 20 20 20 20 20 20 61 72 65 20 6c 69 6e 65 61 72 20 69 6e 20 6e 2c 20 74 | .n!...........are.linear.in.n,.t |
| 159380 | 68 65 73 65 20 72 61 74 69 6f 73 20 73 68 6f 75 6c 64 20 61 70 70 72 6f 61 63 68 20 63 6f 6e 73 | hese.ratios.should.approach.cons |
| 1593a0 | 74 61 6e 74 73 20 61 73 20 6e 0a 20 20 20 20 20 20 20 20 20 20 62 65 63 6f 6d 65 73 20 6c 61 72 | tants.as.n...........becomes.lar |
| 1593c0 | 67 65 2e 20 20 57 68 61 74 20 61 72 65 20 74 68 65 73 65 20 63 6f 6e 73 74 61 6e 74 73 3f 20 20 | ge...What.are.these.constants?.. |
| 1593e0 | 53 69 6d 69 6c 61 72 6c 79 2c 20 66 69 6e 64 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 20 72 61 | Similarly,.find...........the.ra |
| 159400 | 74 69 6f 73 20 6f 66 20 74 68 65 20 73 74 61 63 6b 20 75 73 61 67 65 20 69 6e 20 74 68 65 20 73 | tios.of.the.stack.usage.in.the.s |
| 159420 | 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 20 20 20 20 | pecial-purpose.machine.......... |
| 159440 | 20 74 6f 20 74 68 65 20 75 73 61 67 65 20 69 6e 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 64 | .to.the.usage.in.the.interpreted |
| 159460 | 20 76 65 72 73 69 6f 6e 2e 0a 0a 20 20 20 20 20 20 20 20 20 20 43 6f 6d 70 61 72 65 20 74 68 65 | .version.............Compare.the |
| 159480 | 20 72 61 74 69 6f 73 20 66 6f 72 20 73 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 20 76 65 72 73 | .ratios.for.special-purpose.vers |
| 1594a0 | 75 73 20 69 6e 74 65 72 70 72 65 74 65 64 0a 20 20 20 20 20 20 20 20 20 20 63 6f 64 65 20 74 6f | us.interpreted...........code.to |
| 1594c0 | 20 74 68 65 20 72 61 74 69 6f 73 20 66 6f 72 20 63 6f 6d 70 69 6c 65 64 20 76 65 72 73 75 73 20 | .the.ratios.for.compiled.versus. |
| 1594e0 | 69 6e 74 65 72 70 72 65 74 65 64 20 63 6f 64 65 2e 20 20 59 6f 75 0a 20 20 20 20 20 20 20 20 20 | interpreted.code...You.......... |
| 159500 | 20 73 68 6f 75 6c 64 20 66 69 6e 64 20 74 68 61 74 20 74 68 65 20 73 70 65 63 69 61 6c 2d 70 75 | .should.find.that.the.special-pu |
| 159520 | 72 70 6f 73 65 20 6d 61 63 68 69 6e 65 20 64 6f 65 73 20 6d 75 63 68 20 62 65 74 74 65 72 0a 20 | rpose.machine.does.much.better.. |
| 159540 | 20 20 20 20 20 20 20 20 20 74 68 61 6e 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 2c | .........than.the.compiled.code, |
| 159560 | 20 73 69 6e 63 65 20 74 68 65 20 68 61 6e 64 2d 74 61 69 6c 6f 72 65 64 20 63 6f 6e 74 72 6f 6c | .since.the.hand-tailored.control |
| 159580 | 6c 65 72 0a 20 20 20 20 20 20 20 20 20 20 63 6f 64 65 20 73 68 6f 75 6c 64 20 62 65 20 6d 75 63 | ler...........code.should.be.muc |
| 1595a0 | 68 20 62 65 74 74 65 72 20 74 68 61 6e 20 77 68 61 74 20 69 73 20 70 72 6f 64 75 63 65 64 20 62 | h.better.than.what.is.produced.b |
| 1595c0 | 79 20 6f 75 72 0a 20 20 20 20 20 20 20 20 20 20 72 75 64 69 6d 65 6e 74 61 72 79 20 67 65 6e 65 | y.our...........rudimentary.gene |
| 1595e0 | 72 61 6c 2d 70 75 72 70 6f 73 65 20 63 6f 6d 70 69 6c 65 72 2e 0a 0a 20 20 20 20 20 20 20 62 2e | ral-purpose.compiler..........b. |
| 159600 | 20 43 61 6e 20 79 6f 75 20 73 75 67 67 65 73 74 20 69 6d 70 72 6f 76 65 6d 65 6e 74 73 20 74 6f | .Can.you.suggest.improvements.to |
| 159620 | 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 74 68 61 74 20 77 6f 75 6c 64 20 68 65 6c 70 0a 20 20 | .the.compiler.that.would.help... |
| 159640 | 20 20 20 20 20 20 20 20 69 74 20 67 65 6e 65 72 61 74 65 20 63 6f 64 65 20 74 68 61 74 20 77 6f | ........it.generate.code.that.wo |
| 159660 | 75 6c 64 20 63 6f 6d 65 20 63 6c 6f 73 65 72 20 69 6e 20 70 65 72 66 6f 72 6d 61 6e 63 65 20 74 | uld.come.closer.in.performance.t |
| 159680 | 6f 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 68 61 6e 64 2d 74 61 69 6c 6f 72 65 64 20 76 65 | o.the...........hand-tailored.ve |
| 1596a0 | 72 73 69 6f 6e 3f 0a 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 34 36 3a 2a 20 43 | rsion?........*Exercise.5.46:*.C |
| 1596c0 | 61 72 72 79 20 6f 75 74 20 61 6e 20 61 6e 61 6c 79 73 69 73 20 6c 69 6b 65 20 74 68 65 20 6f 6e | arry.out.an.analysis.like.the.on |
| 1596e0 | 65 20 69 6e 20 2a 4e 6f 74 65 0a 20 20 20 20 20 45 78 65 72 63 69 73 65 20 35 2d 34 35 3a 3a 20 | e.in.*Note......Exercise.5-45::. |
| 159700 | 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 65 66 66 65 63 74 69 76 65 6e 65 73 73 20 6f | to.determine.the.effectiveness.o |
| 159720 | 66 20 63 6f 6d 70 69 6c 69 6e 67 20 74 68 65 0a 20 20 20 20 20 74 72 65 65 2d 72 65 63 75 72 73 | f.compiling.the......tree-recurs |
| 159740 | 69 76 65 20 46 69 62 6f 6e 61 63 63 69 20 70 72 6f 63 65 64 75 72 65 0a 0a 20 20 20 20 20 20 20 | ive.Fibonacci.procedure......... |
| 159760 | 20 20 20 28 64 65 66 69 6e 65 20 28 66 69 62 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 | ...(define.(fib.n).............( |
| 159780 | 69 66 20 28 3c 20 6e 20 32 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 6e 0a 20 20 20 | if.(<.n.2).................n.... |
| 1597a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2b 20 28 66 69 62 20 28 2d 20 6e 20 31 29 29 20 28 66 | .............(+.(fib.(-.n.1)).(f |
| 1597c0 | 69 62 20 28 2d 20 6e 20 32 29 29 29 29 29 0a 0a 20 20 20 20 20 63 6f 6d 70 61 72 65 64 20 74 6f | ib.(-.n.2))))).......compared.to |
| 1597e0 | 20 74 68 65 20 65 66 66 65 63 74 69 76 65 6e 65 73 73 20 6f 66 20 75 73 69 6e 67 20 74 68 65 20 | .the.effectiveness.of.using.the. |
| 159800 | 73 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 0a 20 20 20 20 20 46 69 62 6f 6e 61 63 63 69 20 6d | special-purpose......Fibonacci.m |
| 159820 | 61 63 68 69 6e 65 20 6f 66 20 2a 4e 6f 74 65 20 46 69 67 75 72 65 20 35 2d 31 32 3a 3a 2e 20 20 | achine.of.*Note.Figure.5-12::... |
| 159840 | 28 46 6f 72 20 6d 65 61 73 75 72 65 6d 65 6e 74 20 6f 66 20 74 68 65 0a 20 20 20 20 20 69 6e 74 | (For.measurement.of.the......int |
| 159860 | 65 72 70 72 65 74 65 64 20 70 65 72 66 6f 72 6d 61 6e 63 65 2c 20 73 65 65 20 2a 4e 6f 74 65 20 | erpreted.performance,.see.*Note. |
| 159880 | 45 78 65 72 63 69 73 65 20 35 2d 32 39 3a 3a 2e 29 20 20 46 6f 72 0a 20 20 20 20 20 46 69 62 6f | Exercise.5-29::.)..For......Fibo |
| 1598a0 | 6e 61 63 63 69 2c 20 74 68 65 20 74 69 6d 65 20 72 65 73 6f 75 72 63 65 20 75 73 65 64 20 69 73 | nacci,.the.time.resource.used.is |
| 1598c0 | 20 6e 6f 74 20 6c 69 6e 65 61 72 20 69 6e 20 6e 3b 20 68 65 6e 63 65 20 74 68 65 0a 20 20 20 20 | .not.linear.in.n;.hence.the..... |
| 1598e0 | 20 72 61 74 69 6f 73 20 6f 66 20 73 74 61 63 6b 20 6f 70 65 72 61 74 69 6f 6e 73 20 77 69 6c 6c | .ratios.of.stack.operations.will |
| 159900 | 20 6e 6f 74 20 61 70 70 72 6f 61 63 68 20 61 20 6c 69 6d 69 74 69 6e 67 20 76 61 6c 75 65 20 74 | .not.approach.a.limiting.value.t |
| 159920 | 68 61 74 0a 20 20 20 20 20 69 73 20 69 6e 64 65 70 65 6e 64 65 6e 74 20 6f 66 20 6e 2e 0a 0a 20 | hat......is.independent.of.n.... |
| 159940 | 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 34 37 3a 2a 20 54 68 69 73 20 73 65 63 74 69 6f | ....*Exercise.5.47:*.This.sectio |
| 159960 | 6e 20 64 65 73 63 72 69 62 65 64 20 68 6f 77 20 74 6f 20 6d 6f 64 69 66 79 20 74 68 65 0a 20 20 | n.described.how.to.modify.the... |
| 159980 | 20 20 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 73 6f | ...explicit-control.evaluator.so |
| 1599a0 | 20 74 68 61 74 20 69 6e 74 65 72 70 72 65 74 65 64 20 63 6f 64 65 20 63 61 6e 20 63 61 6c 6c 0a | .that.interpreted.code.can.call. |
| 1599c0 | 20 20 20 20 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 53 68 6f 77 20 | .....compiled.procedures...Show. |
| 1599e0 | 68 6f 77 20 74 6f 20 6d 6f 64 69 66 79 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 73 6f 20 74 68 | how.to.modify.the.compiler.so.th |
| 159a00 | 61 74 0a 20 20 20 20 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 63 61 6e 20 | at......compiled.procedures.can. |
| 159a20 | 63 61 6c 6c 20 6e 6f 74 20 6f 6e 6c 79 20 70 72 69 6d 69 74 69 76 65 20 70 72 6f 63 65 64 75 72 | call.not.only.primitive.procedur |
| 159a40 | 65 73 20 61 6e 64 0a 20 20 20 20 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 73 2c | es.and......compiled.procedures, |
| 159a60 | 20 62 75 74 20 69 6e 74 65 72 70 72 65 74 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 77 | .but.interpreted.procedures.as.w |
| 159a80 | 65 6c 6c 2e 20 20 54 68 69 73 0a 20 20 20 20 20 72 65 71 75 69 72 65 73 20 6d 6f 64 69 66 79 69 | ell...This......requires.modifyi |
| 159aa0 | 6e 67 20 60 63 6f 6d 70 69 6c 65 2d 70 72 6f 63 65 64 75 72 65 2d 63 61 6c 6c 27 20 74 6f 20 68 | ng.`compile-procedure-call'.to.h |
| 159ac0 | 61 6e 64 6c 65 20 74 68 65 20 63 61 73 65 20 6f 66 0a 20 20 20 20 20 63 6f 6d 70 6f 75 6e 64 20 | andle.the.case.of......compound. |
| 159ae0 | 28 69 6e 74 65 72 70 72 65 74 65 64 29 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 42 65 20 73 75 | (interpreted).procedures...Be.su |
| 159b00 | 72 65 20 74 6f 20 68 61 6e 64 6c 65 20 61 6c 6c 20 74 68 65 20 73 61 6d 65 0a 20 20 20 20 20 60 | re.to.handle.all.the.same......` |
| 159b20 | 74 61 72 67 65 74 27 20 61 6e 64 20 60 6c 69 6e 6b 61 67 65 27 20 63 6f 6d 62 69 6e 61 74 69 6f | target'.and.`linkage'.combinatio |
| 159b40 | 6e 73 20 61 73 20 69 6e 20 60 63 6f 6d 70 69 6c 65 2d 70 72 6f 63 2d 61 70 70 6c 27 2e 20 20 54 | ns.as.in.`compile-proc-appl'...T |
| 159b60 | 6f 0a 20 20 20 20 20 64 6f 20 74 68 65 20 61 63 74 75 61 6c 20 70 72 6f 63 65 64 75 72 65 20 61 | o......do.the.actual.procedure.a |
| 159b80 | 70 70 6c 69 63 61 74 69 6f 6e 2c 20 74 68 65 20 63 6f 64 65 20 6e 65 65 64 73 20 74 6f 20 6a 75 | pplication,.the.code.needs.to.ju |
| 159ba0 | 6d 70 20 74 6f 20 74 68 65 0a 20 20 20 20 20 65 76 61 6c 75 61 74 6f 72 27 73 20 60 63 6f 6d 70 | mp.to.the......evaluator's.`comp |
| 159bc0 | 6f 75 6e 64 2d 61 70 70 6c 79 27 20 65 6e 74 72 79 20 70 6f 69 6e 74 2e 20 20 54 68 69 73 20 6c | ound-apply'.entry.point...This.l |
| 159be0 | 61 62 65 6c 20 63 61 6e 6e 6f 74 20 62 65 0a 20 20 20 20 20 64 69 72 65 63 74 6c 79 20 72 65 66 | abel.cannot.be......directly.ref |
| 159c00 | 65 72 65 6e 63 65 64 20 69 6e 20 6f 62 6a 65 63 74 20 63 6f 64 65 20 28 73 69 6e 63 65 20 74 68 | erenced.in.object.code.(since.th |
| 159c20 | 65 20 61 73 73 65 6d 62 6c 65 72 20 72 65 71 75 69 72 65 73 0a 20 20 20 20 20 74 68 61 74 20 61 | e.assembler.requires......that.a |
| 159c40 | 6c 6c 20 6c 61 62 65 6c 73 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 63 6f 64 65 | ll.labels.referenced.by.the.code |
| 159c60 | 20 69 74 20 69 73 20 61 73 73 65 6d 62 6c 69 6e 67 20 62 65 20 64 65 66 69 6e 65 64 0a 20 20 20 | .it.is.assembling.be.defined.... |
| 159c80 | 20 20 74 68 65 72 65 29 2c 20 73 6f 20 77 65 20 77 69 6c 6c 20 61 64 64 20 61 20 72 65 67 69 73 | ..there),.so.we.will.add.a.regis |
| 159ca0 | 74 65 72 20 63 61 6c 6c 65 64 20 60 63 6f 6d 70 61 70 70 27 20 74 6f 20 74 68 65 0a 20 20 20 20 | ter.called.`compapp'.to.the..... |
| 159cc0 | 20 65 76 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 20 74 6f 20 68 6f 6c 64 20 74 68 69 73 20 | .evaluator.machine.to.hold.this. |
| 159ce0 | 65 6e 74 72 79 20 70 6f 69 6e 74 2c 20 61 6e 64 20 61 64 64 20 61 6e 20 69 6e 73 74 72 75 63 74 | entry.point,.and.add.an.instruct |
| 159d00 | 69 6f 6e 0a 20 20 20 20 20 74 6f 20 69 6e 69 74 69 61 6c 69 7a 65 20 69 74 3a 0a 0a 20 20 20 20 | ion......to.initialize.it:...... |
| 159d20 | 20 20 20 20 20 20 28 61 73 73 69 67 6e 20 63 6f 6d 70 61 70 70 20 28 6c 61 62 65 6c 20 63 6f 6d | ......(assign.compapp.(label.com |
| 159d40 | 70 6f 75 6e 64 2d 61 70 70 6c 79 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 62 72 61 6e 63 | pound-apply)).............(branc |
| 159d60 | 68 20 28 6c 61 62 65 6c 20 65 78 74 65 72 6e 61 6c 2d 65 6e 74 72 79 29 29 20 20 20 20 20 20 3b | h.(label.external-entry))......; |
| 159d80 | 20 62 72 61 6e 63 68 65 73 20 69 66 20 60 66 6c 61 67 27 20 69 73 20 73 65 74 0a 20 20 20 20 20 | .branches.if.`flag'.is.set...... |
| 159da0 | 20 20 20 20 20 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 6e 74 2d 6c 6f 6f 70 0a 20 20 20 20 20 20 | .....read-eval-print-loop....... |
| 159dc0 | 20 20 20 20 20 20 2e 2e 2e 0a 0a 20 20 20 20 20 54 6f 20 74 65 73 74 20 79 6f 75 72 20 63 6f 64 | ................To.test.your.cod |
| 159de0 | 65 2c 20 73 74 61 72 74 20 62 79 20 64 65 66 69 6e 69 6e 67 20 61 20 70 72 6f 63 65 64 75 72 65 | e,.start.by.defining.a.procedure |
| 159e00 | 20 60 66 27 20 74 68 61 74 20 63 61 6c 6c 73 20 61 0a 20 20 20 20 20 70 72 6f 63 65 64 75 72 65 | .`f'.that.calls.a......procedure |
| 159e20 | 20 60 67 27 2e 20 20 55 73 65 20 60 63 6f 6d 70 69 6c 65 2d 61 6e 64 2d 67 6f 27 20 74 6f 20 63 | .`g'...Use.`compile-and-go'.to.c |
| 159e40 | 6f 6d 70 69 6c 65 20 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f 66 0a 20 20 20 20 20 60 66 | ompile.the.definition.of......`f |
| 159e60 | 27 20 61 6e 64 20 73 74 61 72 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 2e 20 20 4e 6f 77 2c | '.and.start.the.evaluator...Now, |
| 159e80 | 20 74 79 70 69 6e 67 20 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 2c 20 64 65 66 69 6e 65 | .typing.at.the.evaluator,.define |
| 159ea0 | 0a 20 20 20 20 20 60 67 27 20 61 6e 64 20 74 72 79 20 74 6f 20 63 61 6c 6c 20 60 66 27 2e 0a 0a | ......`g'.and.try.to.call.`f'... |
| 159ec0 | 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 34 38 3a 2a 20 54 68 65 20 60 63 6f 6d 70 69 | .....*Exercise.5.48:*.The.`compi |
| 159ee0 | 6c 65 2d 61 6e 64 2d 67 6f 27 20 69 6e 74 65 72 66 61 63 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 | le-and-go'.interface.implemented |
| 159f00 | 20 69 6e 0a 20 20 20 20 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 69 73 20 61 77 6b 77 61 72 64 | .in......this.section.is.awkward |
| 159f20 | 2c 20 73 69 6e 63 65 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 63 61 6e 20 62 65 20 63 61 6c 6c | ,.since.the.compiler.can.be.call |
| 159f40 | 65 64 20 6f 6e 6c 79 0a 20 20 20 20 20 6f 6e 63 65 20 28 77 68 65 6e 20 74 68 65 20 65 76 61 6c | ed.only......once.(when.the.eval |
| 159f60 | 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 20 69 73 20 73 74 61 72 74 65 64 29 2e 20 20 41 75 67 6d | uator.machine.is.started)...Augm |
| 159f80 | 65 6e 74 20 74 68 65 0a 20 20 20 20 20 63 6f 6d 70 69 6c 65 72 2d 69 6e 74 65 72 70 72 65 74 65 | ent.the......compiler-interprete |
| 159fa0 | 72 20 69 6e 74 65 72 66 61 63 65 20 62 79 20 70 72 6f 76 69 64 69 6e 67 20 61 20 60 63 6f 6d 70 | r.interface.by.providing.a.`comp |
| 159fc0 | 69 6c 65 2d 61 6e 64 2d 72 75 6e 27 0a 20 20 20 20 20 70 72 69 6d 69 74 69 76 65 20 74 68 61 74 | ile-and-run'......primitive.that |
| 159fe0 | 20 63 61 6e 20 62 65 20 63 61 6c 6c 65 64 20 66 72 6f 6d 20 77 69 74 68 69 6e 20 74 68 65 20 65 | .can.be.called.from.within.the.e |
| 15a000 | 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 0a 20 20 20 20 20 65 76 61 6c 75 61 74 6f 72 20 61 | xplicit-control......evaluator.a |
| 15a020 | 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 76 61 | s.follows:............;;;.EC-Eva |
| 15a040 | 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 28 63 6f 6d 70 69 6c 65 2d 61 6e 64 2d | l.input:...........(compile-and- |
| 15a060 | 72 75 6e 0a 20 20 20 20 20 20 20 20 20 20 20 27 28 64 65 66 69 6e 65 20 28 66 61 63 74 6f 72 69 | run............'(define.(factori |
| 15a080 | 61 6c 20 6e 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 69 66 20 28 3d 20 6e 20 31 29 0a | al.n)...............(if.(=.n.1). |
| 15a0a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 0a 20 20 20 20 20 20 20 20 20 20 20 20 | ..................1............. |
| 15a0c0 | 20 20 20 20 20 20 28 2a 20 28 66 61 63 74 6f 72 69 61 6c 20 28 2d 20 6e 20 31 29 29 20 6e 29 29 | ......(*.(factorial.(-.n.1)).n)) |
| 15a0e0 | 29 29 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a | ))...........;;;.EC-Eval.value:. |
| 15a100 | 20 20 20 20 20 20 20 20 20 20 6f 6b 0a 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 | ..........ok............;;;.EC-E |
| 15a120 | 76 61 6c 20 69 6e 70 75 74 3a 0a 20 20 20 20 20 20 20 20 20 20 28 66 61 63 74 6f 72 69 61 6c 20 | val.input:...........(factorial. |
| 15a140 | 35 29 0a 20 20 20 20 20 20 20 20 20 20 3b 3b 3b 20 45 43 2d 45 76 61 6c 20 76 61 6c 75 65 3a 0a | 5)...........;;;.EC-Eval.value:. |
| 15a160 | 20 20 20 20 20 20 20 20 20 20 31 32 30 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e | ..........120.......*Exercise.5. |
| 15a180 | 34 39 3a 2a 20 41 73 20 61 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 74 6f 20 75 73 69 6e 67 20 | 49:*.As.an.alternative.to.using. |
| 15a1a0 | 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 0a 20 20 20 20 20 65 76 61 6c 75 61 | the.explicit-control......evalua |
| 15a1c0 | 74 6f 72 27 73 20 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 6e 74 20 6c 6f 6f 70 2c 20 64 65 73 69 | tor's.read-eval-print.loop,.desi |
| 15a1e0 | 67 6e 20 61 20 72 65 67 69 73 74 65 72 20 6d 61 63 68 69 6e 65 20 74 68 61 74 0a 20 20 20 20 20 | gn.a.register.machine.that...... |
| 15a200 | 70 65 72 66 6f 72 6d 73 20 61 20 72 65 61 64 2d 63 6f 6d 70 69 6c 65 2d 65 78 65 63 75 74 65 2d | performs.a.read-compile-execute- |
| 15a220 | 70 72 69 6e 74 20 6c 6f 6f 70 2e 20 20 54 68 61 74 20 69 73 2c 20 74 68 65 20 6d 61 63 68 69 6e | print.loop...That.is,.the.machin |
| 15a240 | 65 0a 20 20 20 20 20 73 68 6f 75 6c 64 20 72 75 6e 20 61 20 6c 6f 6f 70 20 74 68 61 74 20 72 65 | e......should.run.a.loop.that.re |
| 15a260 | 61 64 73 20 61 6e 20 65 78 70 72 65 73 73 69 6f 6e 2c 20 63 6f 6d 70 69 6c 65 73 20 69 74 2c 20 | ads.an.expression,.compiles.it,. |
| 15a280 | 61 73 73 65 6d 62 6c 65 73 0a 20 20 20 20 20 61 6e 64 20 65 78 65 63 75 74 65 73 20 74 68 65 20 | assembles......and.executes.the. |
| 15a2a0 | 72 65 73 75 6c 74 69 6e 67 20 63 6f 64 65 2c 20 61 6e 64 20 70 72 69 6e 74 73 20 74 68 65 20 72 | resulting.code,.and.prints.the.r |
| 15a2c0 | 65 73 75 6c 74 2e 20 20 54 68 69 73 20 69 73 0a 20 20 20 20 20 65 61 73 79 20 74 6f 20 72 75 6e | esult...This.is......easy.to.run |
| 15a2e0 | 20 69 6e 20 6f 75 72 20 73 69 6d 75 6c 61 74 65 64 20 73 65 74 75 70 2c 20 73 69 6e 63 65 20 77 | .in.our.simulated.setup,.since.w |
| 15a300 | 65 20 63 61 6e 20 61 72 72 61 6e 67 65 20 74 6f 20 63 61 6c 6c 0a 20 20 20 20 20 74 68 65 20 70 | e.can.arrange.to.call......the.p |
| 15a320 | 72 6f 63 65 64 75 72 65 73 20 60 63 6f 6d 70 69 6c 65 27 20 61 6e 64 20 60 61 73 73 65 6d 62 6c | rocedures.`compile'.and.`assembl |
| 15a340 | 65 27 20 61 73 20 22 72 65 67 69 73 74 65 72 2d 6d 61 63 68 69 6e 65 0a 20 20 20 20 20 6f 70 65 | e'.as."register-machine......ope |
| 15a360 | 72 61 74 69 6f 6e 73 2e 22 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 35 30 3a 2a | rations.".......*Exercise.5.50:* |
| 15a380 | 20 55 73 65 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 74 6f 20 63 6f 6d 70 69 6c 65 20 74 68 65 | .Use.the.compiler.to.compile.the |
| 15a3a0 | 20 6d 65 74 61 63 69 72 63 75 6c 61 72 0a 20 20 20 20 20 65 76 61 6c 75 61 74 6f 72 20 6f 66 20 | .metacircular......evaluator.of. |
| 15a3c0 | 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 3a 3a 20 61 6e 64 20 72 75 6e 20 74 68 69 73 | section.*Note.4-1::.and.run.this |
| 15a3e0 | 20 70 72 6f 67 72 61 6d 20 75 73 69 6e 67 20 74 68 65 0a 20 20 20 20 20 72 65 67 69 73 74 65 72 | .program.using.the......register |
| 15a400 | 2d 6d 61 63 68 69 6e 65 20 73 69 6d 75 6c 61 74 6f 72 2e 20 20 28 54 6f 20 63 6f 6d 70 69 6c 65 | -machine.simulator...(To.compile |
| 15a420 | 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 64 65 66 69 6e 69 74 69 6f 6e 0a 20 20 20 20 20 61 | .more.than.one.definition......a |
| 15a440 | 74 20 61 20 74 69 6d 65 2c 20 79 6f 75 20 63 61 6e 20 70 61 63 6b 61 67 65 20 74 68 65 20 64 65 | t.a.time,.you.can.package.the.de |
| 15a460 | 66 69 6e 69 74 69 6f 6e 73 20 69 6e 20 61 20 60 62 65 67 69 6e 27 2e 29 20 20 54 68 65 0a 20 20 | finitions.in.a.`begin'.)..The... |
| 15a480 | 20 20 20 72 65 73 75 6c 74 69 6e 67 20 69 6e 74 65 72 70 72 65 74 65 72 20 77 69 6c 6c 20 72 75 | ...resulting.interpreter.will.ru |
| 15a4a0 | 6e 20 76 65 72 79 20 73 6c 6f 77 6c 79 20 62 65 63 61 75 73 65 20 6f 66 20 74 68 65 20 6d 75 6c | n.very.slowly.because.of.the.mul |
| 15a4c0 | 74 69 70 6c 65 0a 20 20 20 20 20 6c 65 76 65 6c 73 20 6f 66 20 69 6e 74 65 72 70 72 65 74 61 74 | tiple......levels.of.interpretat |
| 15a4e0 | 69 6f 6e 2c 20 62 75 74 20 67 65 74 74 69 6e 67 20 61 6c 6c 20 74 68 65 20 64 65 74 61 69 6c 73 | ion,.but.getting.all.the.details |
| 15a500 | 20 74 6f 20 77 6f 72 6b 20 69 73 0a 20 20 20 20 20 61 6e 20 69 6e 73 74 72 75 63 74 69 76 65 20 | .to.work.is......an.instructive. |
| 15a520 | 65 78 65 72 63 69 73 65 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 35 31 3a 2a | exercise........*Exercise.5.51:* |
| 15a540 | 20 44 65 76 65 6c 6f 70 20 61 20 72 75 64 69 6d 65 6e 74 61 72 79 20 69 6d 70 6c 65 6d 65 6e 74 | .Develop.a.rudimentary.implement |
| 15a560 | 61 74 69 6f 6e 20 6f 66 20 53 63 68 65 6d 65 20 69 6e 0a 20 20 20 20 20 43 20 28 6f 72 20 73 6f | ation.of.Scheme.in......C.(or.so |
| 15a580 | 6d 65 20 6f 74 68 65 72 20 6c 6f 77 2d 6c 65 76 65 6c 20 6c 61 6e 67 75 61 67 65 20 6f 66 20 79 | me.other.low-level.language.of.y |
| 15a5a0 | 6f 75 72 20 63 68 6f 69 63 65 29 20 62 79 20 74 72 61 6e 73 6c 61 74 69 6e 67 0a 20 20 20 20 20 | our.choice).by.translating...... |
| 15a5c0 | 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 20 6f | the.explicit-control.evaluator.o |
| 15a5e0 | 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 35 2d 34 3a 3a 20 69 6e 74 6f 20 43 2e 20 20 49 | f.section.*Note.5-4::.into.C...I |
| 15a600 | 6e 0a 20 20 20 20 20 6f 72 64 65 72 20 74 6f 20 72 75 6e 20 74 68 69 73 20 63 6f 64 65 20 79 6f | n......order.to.run.this.code.yo |
| 15a620 | 75 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 61 6c 73 6f 20 70 72 6f 76 69 64 65 20 61 70 70 72 | u.will.need.to.also.provide.appr |
| 15a640 | 6f 70 72 69 61 74 65 0a 20 20 20 20 20 73 74 6f 72 61 67 65 2d 61 6c 6c 6f 63 61 74 69 6f 6e 20 | opriate......storage-allocation. |
| 15a660 | 72 6f 75 74 69 6e 65 73 20 61 6e 64 20 6f 74 68 65 72 20 72 75 6e 2d 74 69 6d 65 20 73 75 70 70 | routines.and.other.run-time.supp |
| 15a680 | 6f 72 74 2e 0a 0a 20 20 20 20 20 2a 45 78 65 72 63 69 73 65 20 35 2e 35 32 3a 2a 20 41 73 20 61 | ort........*Exercise.5.52:*.As.a |
| 15a6a0 | 20 63 6f 75 6e 74 65 72 70 6f 69 6e 74 20 74 6f 20 65 78 65 72 63 69 73 65 20 2a 4e 6f 74 65 20 | .counterpoint.to.exercise.*Note. |
| 15a6c0 | 45 78 65 72 63 69 73 65 0a 20 20 20 20 20 35 2d 35 31 3a 3a 2c 20 6d 6f 64 69 66 79 20 74 68 65 | Exercise......5-51::,.modify.the |
| 15a6e0 | 20 63 6f 6d 70 69 6c 65 72 20 73 6f 20 74 68 61 74 20 69 74 20 63 6f 6d 70 69 6c 65 73 20 53 63 | .compiler.so.that.it.compiles.Sc |
| 15a700 | 68 65 6d 65 20 70 72 6f 63 65 64 75 72 65 73 0a 20 20 20 20 20 69 6e 74 6f 20 73 65 71 75 65 6e | heme.procedures......into.sequen |
| 15a720 | 63 65 73 20 6f 66 20 43 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 20 20 43 6f 6d 70 69 6c 65 20 | ces.of.C.instructions...Compile. |
| 15a740 | 74 68 65 20 6d 65 74 61 63 69 72 63 75 6c 61 72 0a 20 20 20 20 20 65 76 61 6c 75 61 74 6f 72 20 | the.metacircular......evaluator. |
| 15a760 | 6f 66 20 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 3a 3a 20 74 6f 20 70 72 6f 64 75 63 | of.section.*Note.4-1::.to.produc |
| 15a780 | 65 20 61 20 53 63 68 65 6d 65 20 69 6e 74 65 72 70 72 65 74 65 72 0a 20 20 20 20 20 77 72 69 74 | e.a.Scheme.interpreter......writ |
| 15a7a0 | 74 65 6e 20 69 6e 20 43 2e 0a 0a 20 20 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 20 46 6f 6f 74 6e 6f 74 | ten.in.C......----------.Footnot |
| 15a7c0 | 65 73 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 20 20 20 28 31 29 20 4f 66 20 63 6f 75 72 73 65 2c | es.----------.....(1).Of.course, |
| 15a7e0 | 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 73 20 61 73 20 77 65 6c 6c 20 61 73 20 | .compiled.procedures.as.well.as. |
| 15a800 | 69 6e 74 65 72 70 72 65 74 65 64 20 70 72 6f 63 65 64 75 72 65 73 0a 61 72 65 20 63 6f 6d 70 6f | interpreted.procedures.are.compo |
| 15a820 | 75 6e 64 20 28 6e 6f 6e 70 72 69 6d 69 74 69 76 65 29 2e 20 20 46 6f 72 20 63 6f 6d 70 61 74 69 | und.(nonprimitive)...For.compati |
| 15a840 | 62 69 6c 69 74 79 20 77 69 74 68 20 74 68 65 20 74 65 72 6d 69 6e 6f 6c 6f 67 79 0a 75 73 65 64 | bility.with.the.terminology.used |
| 15a860 | 20 69 6e 20 74 68 65 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 | .in.the.explicit-control.evaluat |
| 15a880 | 6f 72 2c 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 6f 6e 20 77 65 20 77 69 6c 6c 20 75 73 65 0a | or,.in.this.section.we.will.use. |
| 15a8a0 | 22 63 6f 6d 70 6f 75 6e 64 22 20 74 6f 20 6d 65 61 6e 20 69 6e 74 65 72 70 72 65 74 65 64 20 28 | "compound".to.mean.interpreted.( |
| 15a8c0 | 61 73 20 6f 70 70 6f 73 65 64 20 74 6f 20 63 6f 6d 70 69 6c 65 64 29 2e 0a 0a 20 20 20 28 32 29 | as.opposed.to.compiled)......(2) |
| 15a8e0 | 20 4e 6f 77 20 74 68 61 74 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 6d 61 63 68 69 6e 65 20 | .Now.that.the.evaluator.machine. |
| 15a900 | 73 74 61 72 74 73 20 77 69 74 68 20 61 20 60 62 72 61 6e 63 68 27 2c 20 77 65 20 6d 75 73 74 0a | starts.with.a.`branch',.we.must. |
| 15a920 | 61 6c 77 61 79 73 20 69 6e 69 74 69 61 6c 69 7a 65 20 74 68 65 20 60 66 6c 61 67 27 20 72 65 67 | always.initialize.the.`flag'.reg |
| 15a940 | 69 73 74 65 72 20 62 65 66 6f 72 65 20 73 74 61 72 74 69 6e 67 20 74 68 65 20 65 76 61 6c 75 61 | ister.before.starting.the.evalua |
| 15a960 | 74 6f 72 0a 6d 61 63 68 69 6e 65 2e 20 20 54 6f 20 73 74 61 72 74 20 74 68 65 20 6d 61 63 68 69 | tor.machine...To.start.the.machi |
| 15a980 | 6e 65 20 61 74 20 69 74 73 20 6f 72 64 69 6e 61 72 79 20 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 | ne.at.its.ordinary.read-eval-pri |
| 15a9a0 | 6e 74 20 6c 6f 6f 70 2c 20 77 65 0a 63 6f 75 6c 64 20 75 73 65 0a 0a 20 20 20 20 20 28 64 65 66 | nt.loop,.we.could.use.......(def |
| 15a9c0 | 69 6e 65 20 28 73 74 61 72 74 2d 65 63 65 76 61 6c 29 0a 20 20 20 20 20 20 20 28 73 65 74 21 20 | ine.(start-eceval)........(set!. |
| 15a9e0 | 74 68 65 2d 67 6c 6f 62 61 6c 2d 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 28 73 65 74 75 70 2d 65 6e | the-global-environment.(setup-en |
| 15aa00 | 76 69 72 6f 6e 6d 65 6e 74 29 29 0a 20 20 20 20 20 20 20 28 73 65 74 2d 72 65 67 69 73 74 65 72 | vironment))........(set-register |
| 15aa20 | 2d 63 6f 6e 74 65 6e 74 73 21 20 65 63 65 76 61 6c 20 27 66 6c 61 67 20 66 61 6c 73 65 29 0a 20 | -contents!.eceval.'flag.false).. |
| 15aa40 | 20 20 20 20 20 20 28 73 74 61 72 74 20 65 63 65 76 61 6c 29 29 0a 0a 20 20 20 28 33 29 20 53 69 | ......(start.eceval)).....(3).Si |
| 15aa60 | 6e 63 65 20 61 20 63 6f 6d 70 69 6c 65 64 20 70 72 6f 63 65 64 75 72 65 20 69 73 20 61 6e 20 6f | nce.a.compiled.procedure.is.an.o |
| 15aa80 | 62 6a 65 63 74 20 74 68 61 74 20 74 68 65 20 73 79 73 74 65 6d 20 6d 61 79 20 74 72 79 0a 74 6f | bject.that.the.system.may.try.to |
| 15aaa0 | 20 70 72 69 6e 74 2c 20 77 65 20 61 6c 73 6f 20 6d 6f 64 69 66 79 20 74 68 65 20 73 79 73 74 65 | .print,.we.also.modify.the.syste |
| 15aac0 | 6d 20 70 72 69 6e 74 20 6f 70 65 72 61 74 69 6f 6e 20 60 75 73 65 72 2d 70 72 69 6e 74 27 20 28 | m.print.operation.`user-print'.( |
| 15aae0 | 66 72 6f 6d 0a 73 65 63 74 69 6f 6e 20 2a 4e 6f 74 65 20 34 2d 31 2d 34 3a 3a 29 20 73 6f 20 74 | from.section.*Note.4-1-4::).so.t |
| 15ab00 | 68 61 74 20 69 74 20 77 69 6c 6c 20 6e 6f 74 20 61 74 74 65 6d 70 74 20 74 6f 20 70 72 69 6e 74 | hat.it.will.not.attempt.to.print |
| 15ab20 | 20 74 68 65 0a 63 6f 6d 70 6f 6e 65 6e 74 73 20 6f 66 20 61 20 63 6f 6d 70 69 6c 65 64 20 70 72 | .the.components.of.a.compiled.pr |
| 15ab40 | 6f 63 65 64 75 72 65 3a 0a 0a 20 20 20 20 20 28 64 65 66 69 6e 65 20 28 75 73 65 72 2d 70 72 69 | ocedure:.......(define.(user-pri |
| 15ab60 | 6e 74 20 6f 62 6a 65 63 74 29 0a 20 20 20 20 20 20 20 28 63 6f 6e 64 20 28 28 63 6f 6d 70 6f 75 | nt.object)........(cond.((compou |
| 15ab80 | 6e 64 2d 70 72 6f 63 65 64 75 72 65 3f 20 6f 62 6a 65 63 74 29 0a 20 20 20 20 20 20 20 20 20 20 | nd-procedure?.object)........... |
| 15aba0 | 20 20 20 20 28 64 69 73 70 6c 61 79 20 28 6c 69 73 74 20 27 63 6f 6d 70 6f 75 6e 64 2d 70 72 6f | ....(display.(list.'compound-pro |
| 15abc0 | 63 65 64 75 72 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | cedure.......................... |
| 15abe0 | 20 20 20 20 28 70 72 6f 63 65 64 75 72 65 2d 70 61 72 61 6d 65 74 65 72 73 20 6f 62 6a 65 63 74 | ....(procedure-parameters.object |
| 15ac00 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | )..............................( |
| 15ac20 | 70 72 6f 63 65 64 75 72 65 2d 62 6f 64 79 20 6f 62 6a 65 63 74 29 0a 20 20 20 20 20 20 20 20 20 | procedure-body.object).......... |
| 15ac40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 3c 70 72 6f 63 65 64 75 72 65 2d | ....................'<procedure- |
| 15ac60 | 65 6e 76 3e 29 29 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 28 63 6f 6d 70 69 6c 65 64 2d | env>)))..............((compiled- |
| 15ac80 | 70 72 6f 63 65 64 75 72 65 3f 20 6f 62 6a 65 63 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 | procedure?.object).............. |
| 15aca0 | 20 28 64 69 73 70 6c 61 79 20 27 3c 63 6f 6d 70 69 6c 65 64 2d 70 72 6f 63 65 64 75 72 65 3e 29 | .(display.'<compiled-procedure>) |
| 15acc0 | 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 28 65 6c 73 65 20 28 64 69 73 70 6c 61 79 20 6f 62 | )..............(else.(display.ob |
| 15ace0 | 6a 65 63 74 29 29 29 29 0a 0a 20 20 20 28 34 29 20 57 65 20 63 61 6e 20 64 6f 20 65 76 65 6e 20 | ject)))).....(4).We.can.do.even. |
| 15ad00 | 62 65 74 74 65 72 20 62 79 20 65 78 74 65 6e 64 69 6e 67 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 | better.by.extending.the.compiler |
| 15ad20 | 20 74 6f 20 61 6c 6c 6f 77 0a 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 20 74 6f 20 63 61 6c 6c 20 | .to.allow.compiled.code.to.call. |
| 15ad40 | 69 6e 74 65 72 70 72 65 74 65 64 20 70 72 6f 63 65 64 75 72 65 73 2e 20 20 53 65 65 20 2a 4e 6f | interpreted.procedures...See.*No |
| 15ad60 | 74 65 20 45 78 65 72 63 69 73 65 0a 35 2d 34 37 3a 3a 2e 0a 0a 20 20 20 28 35 29 20 49 6e 64 65 | te.Exercise.5-47::......(5).Inde |
| 15ad80 | 70 65 6e 64 65 6e 74 20 6f 66 20 74 68 65 20 73 74 72 61 74 65 67 79 20 6f 66 20 65 78 65 63 75 | pendent.of.the.strategy.of.execu |
| 15ada0 | 74 69 6f 6e 2c 20 77 65 20 69 6e 63 75 72 20 73 69 67 6e 69 66 69 63 61 6e 74 0a 6f 76 65 72 68 | tion,.we.incur.significant.overh |
| 15adc0 | 65 61 64 20 69 66 20 77 65 20 69 6e 73 69 73 74 20 74 68 61 74 20 65 72 72 6f 72 73 20 65 6e 63 | ead.if.we.insist.that.errors.enc |
| 15ade0 | 6f 75 6e 74 65 72 65 64 20 69 6e 20 65 78 65 63 75 74 69 6f 6e 20 6f 66 20 61 20 75 73 65 72 0a | ountered.in.execution.of.a.user. |
| 15ae00 | 70 72 6f 67 72 61 6d 20 62 65 20 64 65 74 65 63 74 65 64 20 61 6e 64 20 73 69 67 6e 61 6c 65 64 | program.be.detected.and.signaled |
| 15ae20 | 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 62 65 69 6e 67 20 61 6c 6c 6f 77 65 64 20 74 6f 20 6b | ,.rather.than.being.allowed.to.k |
| 15ae40 | 69 6c 6c 20 74 68 65 0a 73 79 73 74 65 6d 20 6f 72 20 70 72 6f 64 75 63 65 20 77 72 6f 6e 67 20 | ill.the.system.or.produce.wrong. |
| 15ae60 | 61 6e 73 77 65 72 73 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 6e 20 6f 75 74 2d 6f 66 | answers...For.example,.an.out-of |
| 15ae80 | 2d 62 6f 75 6e 64 73 20 61 72 72 61 79 0a 72 65 66 65 72 65 6e 63 65 20 63 61 6e 20 62 65 20 64 | -bounds.array.reference.can.be.d |
| 15aea0 | 65 74 65 63 74 65 64 20 62 79 20 63 68 65 63 6b 69 6e 67 20 74 68 65 20 76 61 6c 69 64 69 74 79 | etected.by.checking.the.validity |
| 15aec0 | 20 6f 66 20 74 68 65 20 72 65 66 65 72 65 6e 63 65 0a 62 65 66 6f 72 65 20 70 65 72 66 6f 72 6d | .of.the.reference.before.perform |
| 15aee0 | 69 6e 67 20 69 74 2e 20 20 54 68 65 20 6f 76 65 72 68 65 61 64 20 6f 66 20 63 68 65 63 6b 69 6e | ing.it...The.overhead.of.checkin |
| 15af00 | 67 2c 20 68 6f 77 65 76 65 72 2c 20 63 61 6e 20 62 65 20 6d 61 6e 79 0a 74 69 6d 65 73 20 74 68 | g,.however,.can.be.many.times.th |
| 15af20 | 65 20 63 6f 73 74 20 6f 66 20 74 68 65 20 61 72 72 61 79 20 72 65 66 65 72 65 6e 63 65 20 69 74 | e.cost.of.the.array.reference.it |
| 15af40 | 73 65 6c 66 2c 20 61 6e 64 20 61 20 70 72 6f 67 72 61 6d 6d 65 72 20 73 68 6f 75 6c 64 0a 77 65 | self,.and.a.programmer.should.we |
| 15af60 | 69 67 68 20 73 70 65 65 64 20 61 67 61 69 6e 73 74 20 73 61 66 65 74 79 20 69 6e 20 64 65 74 65 | igh.speed.against.safety.in.dete |
| 15af80 | 72 6d 69 6e 69 6e 67 20 77 68 65 74 68 65 72 20 73 75 63 68 20 61 20 63 68 65 63 6b 20 69 73 0a | rmining.whether.such.a.check.is. |
| 15afa0 | 64 65 73 69 72 61 62 6c 65 2e 20 20 41 20 67 6f 6f 64 20 63 6f 6d 70 69 6c 65 72 20 73 68 6f 75 | desirable...A.good.compiler.shou |
| 15afc0 | 6c 64 20 62 65 20 61 62 6c 65 20 74 6f 20 70 72 6f 64 75 63 65 20 63 6f 64 65 20 77 69 74 68 20 | ld.be.able.to.produce.code.with. |
| 15afe0 | 73 75 63 68 0a 63 68 65 63 6b 73 2c 20 73 68 6f 75 6c 64 20 61 76 6f 69 64 20 72 65 64 75 6e 64 | such.checks,.should.avoid.redund |
| 15b000 | 61 6e 74 20 63 68 65 63 6b 73 2c 20 61 6e 64 20 73 68 6f 75 6c 64 20 61 6c 6c 6f 77 20 70 72 6f | ant.checks,.and.should.allow.pro |
| 15b020 | 67 72 61 6d 6d 65 72 73 20 74 6f 0a 63 6f 6e 74 72 6f 6c 20 74 68 65 20 65 78 74 65 6e 74 20 61 | grammers.to.control.the.extent.a |
| 15b040 | 6e 64 20 74 79 70 65 20 6f 66 20 65 72 72 6f 72 20 63 68 65 63 6b 69 6e 67 20 69 6e 20 74 68 65 | nd.type.of.error.checking.in.the |
| 15b060 | 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 65 2e 0a 0a 20 20 20 43 6f 6d 70 69 6c 65 72 73 20 66 6f | .compiled.code......Compilers.fo |
| 15b080 | 72 20 70 6f 70 75 6c 61 72 20 6c 61 6e 67 75 61 67 65 73 2c 20 73 75 63 68 20 61 73 20 43 20 61 | r.popular.languages,.such.as.C.a |
| 15b0a0 | 6e 64 20 43 2b 2b 2c 20 70 75 74 20 68 61 72 64 6c 79 20 61 6e 79 0a 65 72 72 6f 72 2d 63 68 65 | nd.C++,.put.hardly.any.error-che |
| 15b0c0 | 63 6b 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 74 6f 20 72 75 6e 6e 69 6e 67 20 63 6f | cking.operations.into.running.co |
| 15b0e0 | 64 65 2c 20 73 6f 20 61 73 20 74 6f 20 6d 61 6b 65 20 74 68 69 6e 67 73 20 72 75 6e 0a 61 73 20 | de,.so.as.to.make.things.run.as. |
| 15b100 | 66 61 73 74 20 61 73 20 70 6f 73 73 69 62 6c 65 2e 20 20 41 73 20 61 20 72 65 73 75 6c 74 2c 20 | fast.as.possible...As.a.result,. |
| 15b120 | 69 74 20 66 61 6c 6c 73 20 74 6f 20 70 72 6f 67 72 61 6d 6d 65 72 73 20 74 6f 0a 65 78 70 6c 69 | it.falls.to.programmers.to.expli |
| 15b140 | 63 69 74 6c 79 20 70 72 6f 76 69 64 65 20 65 72 72 6f 72 20 63 68 65 63 6b 69 6e 67 2e 20 20 55 | citly.provide.error.checking...U |
| 15b160 | 6e 66 6f 72 74 75 6e 61 74 65 6c 79 2c 20 70 65 6f 70 6c 65 20 6f 66 74 65 6e 20 6e 65 67 6c 65 | nfortunately,.people.often.negle |
| 15b180 | 63 74 0a 74 6f 20 64 6f 20 74 68 69 73 2c 20 65 76 65 6e 20 69 6e 20 63 72 69 74 69 63 61 6c 20 | ct.to.do.this,.even.in.critical. |
| 15b1a0 | 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 77 68 65 72 65 20 73 70 65 65 64 20 69 73 20 6e 6f 74 20 | applications.where.speed.is.not. |
| 15b1c0 | 61 0a 63 6f 6e 73 74 72 61 69 6e 74 2e 20 20 54 68 65 69 72 20 70 72 6f 67 72 61 6d 73 20 6c 65 | a.constraint...Their.programs.le |
| 15b1e0 | 61 64 20 66 61 73 74 20 61 6e 64 20 64 61 6e 67 65 72 6f 75 73 20 6c 69 76 65 73 2e 20 20 46 6f | ad.fast.and.dangerous.lives...Fo |
| 15b200 | 72 0a 65 78 61 6d 70 6c 65 2c 20 74 68 65 20 6e 6f 74 6f 72 69 6f 75 73 20 22 57 6f 72 6d 22 20 | r.example,.the.notorious."Worm". |
| 15b220 | 74 68 61 74 20 70 61 72 61 6c 79 7a 65 64 20 74 68 65 20 49 6e 74 65 72 6e 65 74 20 69 6e 20 31 | that.paralyzed.the.Internet.in.1 |
| 15b240 | 39 38 38 0a 65 78 70 6c 6f 69 74 65 64 20 74 68 65 20 55 4e 49 58 28 74 6d 29 20 6f 70 65 72 61 | 988.exploited.the.UNIX(tm).opera |
| 15b260 | 74 69 6e 67 20 73 79 73 74 65 6d 27 73 20 66 61 69 6c 75 72 65 20 74 6f 20 63 68 65 63 6b 20 77 | ting.system's.failure.to.check.w |
| 15b280 | 68 65 74 68 65 72 20 74 68 65 0a 69 6e 70 75 74 20 62 75 66 66 65 72 20 68 61 73 20 6f 76 65 72 | hether.the.input.buffer.has.over |
| 15b2a0 | 66 6c 6f 77 65 64 20 69 6e 20 74 68 65 20 66 69 6e 67 65 72 20 64 61 65 6d 6f 6e 2e 20 28 53 65 | flowed.in.the.finger.daemon..(Se |
| 15b2c0 | 65 20 53 70 61 66 66 6f 72 64 20 31 39 38 39 2e 29 0a 0a 20 20 20 28 36 29 20 4f 66 20 63 6f 75 | e.Spafford.1989.).....(6).Of.cou |
| 15b2e0 | 72 73 65 2c 20 77 69 74 68 20 65 69 74 68 65 72 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 61 74 | rse,.with.either.the.interpretat |
| 15b300 | 69 6f 6e 20 6f 72 20 74 68 65 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 0a 73 74 72 61 74 65 67 79 20 | ion.or.the.compilation.strategy. |
| 15b320 | 77 65 20 6d 75 73 74 20 61 6c 73 6f 20 69 6d 70 6c 65 6d 65 6e 74 20 66 6f 72 20 74 68 65 20 6e | we.must.also.implement.for.the.n |
| 15b340 | 65 77 20 6d 61 63 68 69 6e 65 20 73 74 6f 72 61 67 65 20 61 6c 6c 6f 63 61 74 69 6f 6e 2c 0a 69 | ew.machine.storage.allocation,.i |
| 15b360 | 6e 70 75 74 20 61 6e 64 20 6f 75 74 70 75 74 2c 20 61 6e 64 20 61 6c 6c 20 74 68 65 20 76 61 72 | nput.and.output,.and.all.the.var |
| 15b380 | 69 6f 75 73 20 6f 70 65 72 61 74 69 6f 6e 73 20 74 68 61 74 20 77 65 20 74 6f 6f 6b 20 61 73 0a | ious.operations.that.we.took.as. |
| 15b3a0 | 22 70 72 69 6d 69 74 69 76 65 22 20 69 6e 20 6f 75 72 20 64 69 73 63 75 73 73 69 6f 6e 20 6f 66 | "primitive".in.our.discussion.of |
| 15b3c0 | 20 74 68 65 20 65 76 61 6c 75 61 74 6f 72 20 61 6e 64 20 63 6f 6d 70 69 6c 65 72 2e 20 20 4f 6e | .the.evaluator.and.compiler...On |
| 15b3e0 | 65 0a 73 74 72 61 74 65 67 79 20 66 6f 72 20 6d 69 6e 69 6d 69 7a 69 6e 67 20 77 6f 72 6b 20 68 | e.strategy.for.minimizing.work.h |
| 15b400 | 65 72 65 20 69 73 20 74 6f 20 77 72 69 74 65 20 61 73 20 6d 61 6e 79 20 6f 66 20 74 68 65 73 65 | ere.is.to.write.as.many.of.these |
| 15b420 | 0a 6f 70 65 72 61 74 69 6f 6e 73 20 61 73 20 70 6f 73 73 69 62 6c 65 20 69 6e 20 4c 69 73 70 20 | .operations.as.possible.in.Lisp. |
| 15b440 | 61 6e 64 20 74 68 65 6e 20 63 6f 6d 70 69 6c 65 20 74 68 65 6d 20 66 6f 72 20 74 68 65 20 6e 65 | and.then.compile.them.for.the.ne |
| 15b460 | 77 0a 6d 61 63 68 69 6e 65 2e 20 20 55 6c 74 69 6d 61 74 65 6c 79 2c 20 65 76 65 72 79 74 68 69 | w.machine...Ultimately,.everythi |
| 15b480 | 6e 67 20 72 65 64 75 63 65 73 20 74 6f 20 61 20 73 6d 61 6c 6c 20 6b 65 72 6e 65 6c 20 28 73 75 | ng.reduces.to.a.small.kernel.(su |
| 15b4a0 | 63 68 20 61 73 0a 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 61 6e 64 20 74 68 65 | ch.as.garbage.collection.and.the |
| 15b4c0 | 20 6d 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 61 70 70 6c 79 69 6e 67 20 61 63 74 75 61 6c 20 6d | .mechanism.for.applying.actual.m |
| 15b4e0 | 61 63 68 69 6e 65 0a 70 72 69 6d 69 74 69 76 65 73 29 20 74 68 61 74 20 69 73 20 68 61 6e 64 2d | achine.primitives).that.is.hand- |
| 15b500 | 63 6f 64 65 64 20 66 6f 72 20 74 68 65 20 6e 65 77 20 6d 61 63 68 69 6e 65 2e 0a 0a 20 20 20 28 | coded.for.the.new.machine......( |
| 15b520 | 37 29 20 54 68 69 73 20 73 74 72 61 74 65 67 79 20 6c 65 61 64 73 20 74 6f 20 61 6d 75 73 69 6e | 7).This.strategy.leads.to.amusin |
| 15b540 | 67 20 74 65 73 74 73 20 6f 66 20 63 6f 72 72 65 63 74 6e 65 73 73 20 6f 66 20 74 68 65 0a 63 6f | g.tests.of.correctness.of.the.co |
| 15b560 | 6d 70 69 6c 65 72 2c 20 73 75 63 68 20 61 73 20 63 68 65 63 6b 69 6e 67 20 77 68 65 74 68 65 72 | mpiler,.such.as.checking.whether |
| 15b580 | 20 74 68 65 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 61 20 70 72 6f 67 72 61 6d 20 6f 6e | .the.compilation.of.a.program.on |
| 15b5a0 | 20 74 68 65 0a 6e 65 77 20 6d 61 63 68 69 6e 65 2c 20 75 73 69 6e 67 20 74 68 65 20 63 6f 6d 70 | .the.new.machine,.using.the.comp |
| 15b5c0 | 69 6c 65 64 20 63 6f 6d 70 69 6c 65 72 2c 20 69 73 20 69 64 65 6e 74 69 63 61 6c 20 77 69 74 68 | iled.compiler,.is.identical.with |
| 15b5e0 | 20 74 68 65 0a 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 70 72 6f 67 72 61 6d 20 | .the.compilation.of.the.program. |
| 15b600 | 6f 6e 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 4c 69 73 70 20 73 79 73 74 65 6d 2e 20 20 54 72 | on.the.original.Lisp.system...Tr |
| 15b620 | 61 63 6b 69 6e 67 20 64 6f 77 6e 0a 74 68 65 20 73 6f 75 72 63 65 20 6f 66 20 64 69 66 66 65 72 | acking.down.the.source.of.differ |
| 15b640 | 65 6e 63 65 73 20 69 73 20 66 75 6e 20 62 75 74 20 6f 66 74 65 6e 20 66 72 75 73 74 72 61 74 69 | ences.is.fun.but.often.frustrati |
| 15b660 | 6e 67 2c 20 62 65 63 61 75 73 65 20 74 68 65 0a 72 65 73 75 6c 74 73 20 61 72 65 20 65 78 74 72 | ng,.because.the.results.are.extr |
| 15b680 | 65 6d 65 6c 79 20 73 65 6e 73 69 74 69 76 65 20 74 6f 20 6d 69 6e 75 73 63 75 6c 65 20 64 65 74 | emely.sensitive.to.minuscule.det |
| 15b6a0 | 61 69 6c 73 2e 0a 0a 1f 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a | ails.....File:.sicp.info,..Node: |
| 15b6c0 | 20 52 65 66 65 72 65 6e 63 65 73 2c 20 20 4e 65 78 74 3a 20 49 6e 64 65 78 2c 20 20 50 72 65 76 | .References,..Next:.Index,..Prev |
| 15b6e0 | 3a 20 43 68 61 70 74 65 72 20 35 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 52 65 66 65 72 65 6e 63 65 | :.Chapter.5,..Up:.Top..Reference |
| 15b700 | 73 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 0a 0a 41 62 65 6c 73 6f 6e 2c 20 48 61 72 6f 6c 64 2c 20 41 | s.**********..Abelson,.Harold,.A |
| 15b720 | 6e 64 72 65 77 20 42 65 72 6c 69 6e 2c 20 4a 61 63 6f 62 20 4b 61 74 7a 65 6e 65 6c 73 6f 6e 2c | ndrew.Berlin,.Jacob.Katzenelson, |
| 15b740 | 20 57 69 6c 6c 69 61 6d 20 4d 63 41 6c 6c 69 73 74 65 72 2c 0a 47 75 69 6c 6c 65 72 6d 6f 20 52 | .William.McAllister,.Guillermo.R |
| 15b760 | 6f 7a 61 73 2c 20 47 65 72 61 6c 64 20 4a 61 79 20 53 75 73 73 6d 61 6e 2c 20 61 6e 64 20 4a 61 | ozas,.Gerald.Jay.Sussman,.and.Ja |
| 15b780 | 63 6b 20 57 69 73 64 6f 6d 2e 20 31 39 39 32 2e 20 20 54 68 65 0a 53 75 70 65 72 63 6f 6d 70 75 | ck.Wisdom..1992...The.Supercompu |
| 15b7a0 | 74 65 72 20 54 6f 6f 6c 6b 69 74 3a 20 41 20 67 65 6e 65 72 61 6c 20 66 72 61 6d 65 77 6f 72 6b | ter.Toolkit:.A.general.framework |
| 15b7c0 | 20 66 6f 72 20 73 70 65 63 69 61 6c 2d 70 75 72 70 6f 73 65 0a 63 6f 6d 70 75 74 69 6e 67 2e 20 | .for.special-purpose.computing.. |
| 15b7e0 | 20 60 49 6e 74 65 72 6e 61 74 69 6f 6e 61 6c 20 4a 6f 75 72 6e 61 6c 20 6f 66 20 48 69 67 68 2d | .`International.Journal.of.High- |
| 15b800 | 53 70 65 65 64 20 45 6c 65 63 74 72 6f 6e 69 63 73 27 0a 33 28 33 29 3a 33 33 37 2d 33 36 31 2e | Speed.Electronics'.3(3):337-361. |
| 15b820 | 0a 0a 20 20 20 41 6c 6c 65 6e 2c 20 4a 6f 68 6e 2e 20 20 31 39 37 38 2e 20 20 60 41 6e 61 74 6f | .....Allen,.John...1978...`Anato |
| 15b840 | 6d 79 20 6f 66 20 4c 69 73 70 27 2e 20 4e 65 77 20 59 6f 72 6b 3a 20 4d 63 47 72 61 77 2d 48 69 | my.of.Lisp'..New.York:.McGraw-Hi |
| 15b860 | 6c 6c 2e 0a 0a 20 20 20 41 4e 53 49 20 58 33 2e 32 32 36 2d 31 39 39 34 2e 20 60 41 6d 65 72 69 | ll......ANSI.X3.226-1994..`Ameri |
| 15b880 | 63 61 6e 20 4e 61 74 69 6f 6e 61 6c 20 53 74 61 6e 64 61 72 64 20 66 6f 72 20 49 6e 66 6f 72 6d | can.National.Standard.for.Inform |
| 15b8a0 | 61 74 69 6f 6e 0a 53 79 73 74 65 6d 73 2d 2d 50 72 6f 67 72 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 | ation.Systems--Programming.Langu |
| 15b8c0 | 61 67 65 2d 2d 43 6f 6d 6d 6f 6e 20 4c 69 73 70 27 2e 0a 0a 20 20 20 41 70 70 65 6c 2c 20 41 6e | age--Common.Lisp'......Appel,.An |
| 15b8e0 | 64 72 65 77 20 57 2e 20 20 31 39 38 37 2e 20 20 47 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 | drew.W...1987...Garbage.collecti |
| 15b900 | 6f 6e 20 63 61 6e 20 62 65 20 66 61 73 74 65 72 20 74 68 61 6e 20 73 74 61 63 6b 0a 61 6c 6c 6f | on.can.be.faster.than.stack.allo |
| 15b920 | 63 61 74 69 6f 6e 2e 20 20 60 49 6e 66 6f 72 6d 61 74 69 6f 6e 20 50 72 6f 63 65 73 73 69 6e 67 | cation...`Information.Processing |
| 15b940 | 20 4c 65 74 74 65 72 73 27 20 32 35 28 34 29 3a 32 37 35 2d 32 37 39 2e 0a 0a 20 20 20 42 61 63 | .Letters'.25(4):275-279......Bac |
| 15b960 | 6b 75 73 2c 20 4a 6f 68 6e 2e 20 20 31 39 37 38 2e 20 20 43 61 6e 20 70 72 6f 67 72 61 6d 6d 69 | kus,.John...1978...Can.programmi |
| 15b980 | 6e 67 20 62 65 20 6c 69 62 65 72 61 74 65 64 20 66 72 6f 6d 20 74 68 65 20 76 6f 6e 0a 4e 65 75 | ng.be.liberated.from.the.von.Neu |
| 15b9a0 | 6d 61 6e 6e 20 73 74 79 6c 65 3f 20 20 60 43 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 73 20 6f 66 20 | mann.style?..`Communications.of. |
| 15b9c0 | 74 68 65 20 41 43 4d 27 20 32 31 28 38 29 3a 36 31 33 2d 36 34 31 2e 0a 0a 20 20 20 42 61 6b 65 | the.ACM'.21(8):613-641......Bake |
| 15b9e0 | 72 2c 20 48 65 6e 72 79 20 47 2e 2c 20 4a 72 2e 20 20 31 39 37 38 2e 20 20 4c 69 73 74 20 70 72 | r,.Henry.G.,.Jr...1978...List.pr |
| 15ba00 | 6f 63 65 73 73 69 6e 67 20 69 6e 20 72 65 61 6c 20 74 69 6d 65 20 6f 6e 20 61 0a 73 65 72 69 61 | ocessing.in.real.time.on.a.seria |
| 15ba20 | 6c 20 63 6f 6d 70 75 74 65 72 2e 20 20 60 43 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 73 20 6f 66 20 | l.computer...`Communications.of. |
| 15ba40 | 74 68 65 20 41 43 4d 27 20 32 31 28 34 29 3a 32 38 30 2d 32 39 33 2e 0a 0a 20 20 20 42 61 74 61 | the.ACM'.21(4):280-293......Bata |
| 15ba60 | 6c 69 2c 20 4a 6f 68 6e 2c 20 4e 65 69 6c 20 4d 61 79 6c 65 2c 20 48 6f 77 61 72 64 20 53 68 72 | li,.John,.Neil.Mayle,.Howard.Shr |
| 15ba80 | 6f 62 65 2c 20 47 65 72 61 6c 64 20 4a 61 79 20 53 75 73 73 6d 61 6e 2c 20 61 6e 64 0a 44 61 6e | obe,.Gerald.Jay.Sussman,.and.Dan |
| 15baa0 | 69 65 6c 20 57 65 69 73 65 2e 20 20 31 39 38 32 2e 20 20 54 68 65 20 53 63 68 65 6d 65 2d 38 31 | iel.Weise...1982...The.Scheme-81 |
| 15bac0 | 20 61 72 63 68 69 74 65 63 74 75 72 65 2d 2d 53 79 73 74 65 6d 20 61 6e 64 20 63 68 69 70 2e 20 | .architecture--System.and.chip.. |
| 15bae0 | 20 49 6e 0a 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 20 4d 49 54 20 43 6f 6e 66 | .In.`Proceedings.of.the.MIT.Conf |
| 15bb00 | 65 72 65 6e 63 65 20 6f 6e 20 41 64 76 61 6e 63 65 64 20 52 65 73 65 61 72 63 68 20 69 6e 20 56 | erence.on.Advanced.Research.in.V |
| 15bb20 | 4c 53 49 27 2c 0a 65 64 69 74 65 64 20 62 79 20 50 61 75 6c 20 50 65 6e 66 69 65 6c 64 2c 20 4a | LSI',.edited.by.Paul.Penfield,.J |
| 15bb40 | 72 2e 20 44 65 64 68 61 6d 2c 20 4d 41 3a 20 41 72 74 65 63 68 20 48 6f 75 73 65 2e 0a 0a 20 20 | r..Dedham,.MA:.Artech.House..... |
| 15bb60 | 20 42 6f 72 6e 69 6e 67 2c 20 41 6c 61 6e 2e 20 20 31 39 37 37 2e 20 20 54 68 69 6e 67 4c 61 62 | .Borning,.Alan...1977...ThingLab |
| 15bb80 | 2d 2d 41 6e 20 6f 62 6a 65 63 74 2d 6f 72 69 65 6e 74 65 64 20 73 79 73 74 65 6d 20 66 6f 72 0a | --An.object-oriented.system.for. |
| 15bba0 | 62 75 69 6c 64 69 6e 67 20 73 69 6d 75 6c 61 74 69 6f 6e 73 20 75 73 69 6e 67 20 63 6f 6e 73 74 | building.simulations.using.const |
| 15bbc0 | 72 61 69 6e 74 73 2e 20 49 6e 20 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 20 35 | raints..In.`Proceedings.of.the.5 |
| 15bbe0 | 74 68 0a 49 6e 74 65 72 6e 61 74 69 6f 6e 61 6c 20 4a 6f 69 6e 74 20 43 6f 6e 66 65 72 65 6e 63 | th.International.Joint.Conferenc |
| 15bc00 | 65 20 6f 6e 20 41 72 74 69 66 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 27 2e 0a 0a | e.on.Artificial.Intelligence'... |
| 15bc20 | 20 20 20 42 6f 72 6f 64 69 6e 2c 20 41 6c 61 6e 2c 20 61 6e 64 20 49 61 6e 20 4d 75 6e 72 6f 2e | ...Borodin,.Alan,.and.Ian.Munro. |
| 15bc40 | 20 20 31 39 37 35 2e 20 20 60 54 68 65 20 43 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 43 6f 6d 70 | ..1975...`The.Computational.Comp |
| 15bc60 | 6c 65 78 69 74 79 0a 6f 66 20 41 6c 67 65 62 72 61 69 63 20 61 6e 64 20 4e 75 6d 65 72 69 63 20 | lexity.of.Algebraic.and.Numeric. |
| 15bc80 | 50 72 6f 62 6c 65 6d 73 27 2e 20 4e 65 77 20 59 6f 72 6b 3a 20 41 6d 65 72 69 63 61 6e 20 45 6c | Problems'..New.York:.American.El |
| 15bca0 | 73 65 76 69 65 72 2e 0a 0a 20 20 20 43 68 61 69 74 69 6e 2c 20 47 72 65 67 6f 72 79 20 4a 2e 20 | sevier......Chaitin,.Gregory.J.. |
| 15bcc0 | 20 31 39 37 35 2e 20 20 52 61 6e 64 6f 6d 6e 65 73 73 20 61 6e 64 20 6d 61 74 68 65 6d 61 74 69 | .1975...Randomness.and.mathemati |
| 15bce0 | 63 61 6c 20 70 72 6f 6f 66 2e 0a 60 53 63 69 65 6e 74 69 66 69 63 20 41 6d 65 72 69 63 61 6e 27 | cal.proof..`Scientific.American' |
| 15bd00 | 20 32 33 32 28 35 29 3a 34 37 2d 35 32 2e 0a 0a 20 20 20 43 68 75 72 63 68 2c 20 41 6c 6f 6e 7a | .232(5):47-52......Church,.Alonz |
| 15bd20 | 6f 2e 20 20 31 39 34 31 2e 20 20 60 54 68 65 20 43 61 6c 63 75 6c 69 20 6f 66 20 4c 61 6d 62 64 | o...1941...`The.Calculi.of.Lambd |
| 15bd40 | 61 2d 43 6f 6e 76 65 72 73 69 6f 6e 27 2e 0a 50 72 69 6e 63 65 74 6f 6e 2c 20 4e 2e 4a 2e 3a 20 | a-Conversion'..Princeton,.N.J.:. |
| 15bd60 | 50 72 69 6e 63 65 74 6f 6e 20 55 6e 69 76 65 72 73 69 74 79 20 50 72 65 73 73 2e 0a 0a 20 20 20 | Princeton.University.Press...... |
| 15bd80 | 43 6c 61 72 6b 2c 20 4b 65 69 74 68 20 4c 2e 20 20 31 39 37 38 2e 20 20 4e 65 67 61 74 69 6f 6e | Clark,.Keith.L...1978...Negation |
| 15bda0 | 20 61 73 20 66 61 69 6c 75 72 65 2e 20 20 49 6e 20 60 4c 6f 67 69 63 20 61 6e 64 20 44 61 74 61 | .as.failure...In.`Logic.and.Data |
| 15bdc0 | 0a 42 61 73 65 73 27 2e 20 20 4e 65 77 20 59 6f 72 6b 3a 20 50 6c 65 6e 75 6d 20 50 72 65 73 73 | .Bases'...New.York:.Plenum.Press |
| 15bde0 | 2c 20 70 70 2e 20 32 39 33 2d 33 32 32 2e 0a 0a 20 20 20 43 6c 69 6e 67 65 72 2c 20 57 69 6c 6c | ,.pp..293-322......Clinger,.Will |
| 15be00 | 69 61 6d 2e 20 20 31 39 38 32 2e 20 20 4e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 63 61 | iam...1982...Nondeterministic.ca |
| 15be20 | 6c 6c 20 62 79 20 6e 65 65 64 20 69 73 20 6e 65 69 74 68 65 72 0a 6c 61 7a 79 20 6e 6f 72 20 62 | ll.by.need.is.neither.lazy.nor.b |
| 15be40 | 79 20 6e 61 6d 65 2e 20 49 6e 20 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 20 41 | y.name..In.`Proceedings.of.the.A |
| 15be60 | 43 4d 20 53 79 6d 70 6f 73 69 75 6d 20 6f 6e 20 4c 69 73 70 20 61 6e 64 0a 46 75 6e 63 74 69 6f | CM.Symposium.on.Lisp.and.Functio |
| 15be80 | 6e 61 6c 20 50 72 6f 67 72 61 6d 6d 69 6e 67 27 2c 20 70 70 2e 20 32 32 36 2d 32 33 34 2e 0a 0a | nal.Programming',.pp..226-234... |
| 15bea0 | 20 20 20 43 6c 69 6e 67 65 72 2c 20 57 69 6c 6c 69 61 6d 2c 20 61 6e 64 20 4a 6f 6e 61 74 68 61 | ...Clinger,.William,.and.Jonatha |
| 15bec0 | 6e 20 52 65 65 73 2e 20 20 31 39 39 31 2e 20 20 4d 61 63 72 6f 73 20 74 68 61 74 20 77 6f 72 6b | n.Rees...1991...Macros.that.work |
| 15bee0 | 2e 20 20 49 6e 0a 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 20 31 39 39 31 20 41 | ...In.`Proceedings.of.the.1991.A |
| 15bf00 | 43 4d 20 43 6f 6e 66 65 72 65 6e 63 65 20 6f 6e 20 50 72 69 6e 63 69 70 6c 65 73 20 6f 66 20 50 | CM.Conference.on.Principles.of.P |
| 15bf20 | 72 6f 67 72 61 6d 6d 69 6e 67 0a 4c 61 6e 67 75 61 67 65 73 27 2c 20 70 70 2e 20 31 35 35 2d 31 | rogramming.Languages',.pp..155-1 |
| 15bf40 | 36 32 2e 0a 0a 20 20 20 43 6f 6c 6d 65 72 61 75 65 72 20 41 2e 2c 20 48 2e 20 4b 61 6e 6f 75 69 | 62......Colmerauer.A.,.H..Kanoui |
| 15bf60 | 2c 20 52 2e 20 50 61 73 65 72 6f 2c 20 61 6e 64 20 50 2e 20 52 6f 75 73 73 65 6c 2e 20 20 31 39 | ,.R..Pasero,.and.P..Roussel...19 |
| 15bf80 | 37 33 2e 20 20 55 6e 0a 73 79 73 74 65 60 6d 65 20 64 65 20 63 6f 6d 6d 75 6e 69 63 61 74 69 6f | 73...Un.syste`me.de.communicatio |
| 15bfa0 | 6e 20 68 6f 6d 6d 65 2d 6d 61 63 68 69 6e 65 20 65 6e 20 66 72 61 6e 63 2c 61 69 73 2e 20 20 54 | n.homme-machine.en.franc,ais...T |
| 15bfc0 | 65 63 68 6e 69 63 61 6c 0a 72 65 70 6f 72 74 2c 20 47 72 6f 75 70 65 20 49 6e 74 65 6c 6c 69 67 | echnical.report,.Groupe.Intellig |
| 15bfe0 | 65 6e 63 65 20 41 72 74 69 66 69 63 69 65 6c 6c 65 2c 20 55 6e 69 76 65 72 73 69 74 65 27 20 64 | ence.Artificielle,.Universite'.d |
| 15c000 | 27 41 69 78 20 4d 61 72 73 65 69 6c 6c 65 2c 0a 4c 75 6d 69 6e 79 2e 0a 0a 20 20 20 43 6f 72 6d | 'Aix.Marseille,.Luminy......Corm |
| 15c020 | 65 6e 2c 20 54 68 6f 6d 61 73 2c 20 43 68 61 72 6c 65 73 20 4c 65 69 73 65 72 73 6f 6e 2c 20 61 | en,.Thomas,.Charles.Leiserson,.a |
| 15c040 | 6e 64 20 52 6f 6e 61 6c 64 20 52 69 76 65 73 74 2e 20 20 31 39 39 30 2e 0a 60 49 6e 74 72 6f 64 | nd.Ronald.Rivest...1990..`Introd |
| 15c060 | 75 63 74 69 6f 6e 20 74 6f 20 41 6c 67 6f 72 69 74 68 6d 73 27 2e 20 43 61 6d 62 72 69 64 67 65 | uction.to.Algorithms'..Cambridge |
| 15c080 | 2c 20 4d 41 3a 20 4d 49 54 20 50 72 65 73 73 2e 0a 0a 20 20 20 44 61 72 6c 69 6e 67 74 6f 6e 2c | ,.MA:.MIT.Press......Darlington, |
| 15c0a0 | 20 4a 6f 68 6e 2c 20 50 65 74 65 72 20 48 65 6e 64 65 72 73 6f 6e 2c 20 61 6e 64 20 44 61 76 69 | .John,.Peter.Henderson,.and.Davi |
| 15c0c0 | 64 20 54 75 72 6e 65 72 2e 20 20 31 39 38 32 2e 0a 60 46 75 6e 63 74 69 6f 6e 61 6c 20 50 72 6f | d.Turner...1982..`Functional.Pro |
| 15c0e0 | 67 72 61 6d 6d 69 6e 67 20 61 6e 64 20 49 74 73 20 41 70 70 6c 69 63 61 74 69 6f 6e 73 27 2e 20 | gramming.and.Its.Applications'.. |
| 15c100 | 4e 65 77 20 59 6f 72 6b 3a 20 43 61 6d 62 72 69 64 67 65 0a 55 6e 69 76 65 72 73 69 74 79 20 50 | New.York:.Cambridge.University.P |
| 15c120 | 72 65 73 73 2e 0a 0a 20 20 20 44 69 6a 6b 73 74 72 61 2c 20 45 64 73 67 65 72 20 57 2e 20 31 39 | ress......Dijkstra,.Edsger.W..19 |
| 15c140 | 36 38 61 2e 20 20 54 68 65 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 22 54 48 45 22 | 68a...The.structure.of.the."THE" |
| 15c160 | 0a 6d 75 6c 74 69 70 72 6f 67 72 61 6d 6d 69 6e 67 20 73 79 73 74 65 6d 2e 20 20 60 43 6f 6d 6d | .multiprogramming.system...`Comm |
| 15c180 | 75 6e 69 63 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 41 43 4d 27 20 31 31 28 35 29 3a 33 34 31 | unications.of.the.ACM'.11(5):341 |
| 15c1a0 | 2d 33 34 36 2e 0a 0a 20 20 20 44 69 6a 6b 73 74 72 61 2c 20 45 64 73 67 65 72 20 57 2e 20 31 39 | -346......Dijkstra,.Edsger.W..19 |
| 15c1c0 | 36 38 62 2e 20 20 43 6f 6f 70 65 72 61 74 69 6e 67 20 73 65 71 75 65 6e 74 69 61 6c 20 70 72 6f | 68b...Cooperating.sequential.pro |
| 15c1e0 | 63 65 73 73 65 73 2e 20 20 49 6e 0a 60 50 72 6f 67 72 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 61 67 | cesses...In.`Programming.Languag |
| 15c200 | 65 73 27 2c 20 65 64 69 74 65 64 20 62 79 20 46 2e 20 47 65 6e 75 79 73 2e 20 4e 65 77 20 59 6f | es',.edited.by.F..Genuys..New.Yo |
| 15c220 | 72 6b 3a 20 41 63 61 64 65 6d 69 63 20 50 72 65 73 73 2c 0a 70 70 2e 20 20 34 33 2d 31 31 32 2e | rk:.Academic.Press,.pp...43-112. |
| 15c240 | 0a 0a 20 20 20 44 69 6e 65 73 6d 61 6e 2c 20 48 6f 77 61 72 64 20 50 2e 20 20 31 39 36 38 2e 20 | .....Dinesman,.Howard.P...1968.. |
| 15c260 | 20 60 53 75 70 65 72 69 6f 72 20 4d 61 74 68 65 6d 61 74 69 63 61 6c 20 50 75 7a 7a 6c 65 73 27 | .`Superior.Mathematical.Puzzles' |
| 15c280 | 2e 20 20 4e 65 77 0a 59 6f 72 6b 3a 20 53 69 6d 6f 6e 20 61 6e 64 20 53 63 68 75 73 74 65 72 2e | ...New.York:.Simon.and.Schuster. |
| 15c2a0 | 0a 0a 20 20 20 64 65 4b 6c 65 65 72 2c 20 4a 6f 68 61 6e 2c 20 4a 6f 6e 20 44 6f 79 6c 65 2c 20 | .....deKleer,.Johan,.Jon.Doyle,. |
| 15c2c0 | 47 75 79 20 53 74 65 65 6c 65 2c 20 61 6e 64 20 47 65 72 61 6c 64 20 4a 2e 20 53 75 73 73 6d 61 | Guy.Steele,.and.Gerald.J..Sussma |
| 15c2e0 | 6e 2e 20 20 31 39 37 37 2e 0a 41 4d 4f 52 44 3a 20 45 78 70 6c 69 63 69 74 20 63 6f 6e 74 72 6f | n...1977..AMORD:.Explicit.contro |
| 15c300 | 6c 20 6f 66 20 72 65 61 73 6f 6e 69 6e 67 2e 20 20 49 6e 20 60 50 72 6f 63 65 65 64 69 6e 67 73 | l.of.reasoning...In.`Proceedings |
| 15c320 | 20 6f 66 20 74 68 65 20 41 43 4d 0a 53 79 6d 70 6f 73 69 75 6d 20 6f 6e 20 41 72 74 69 66 69 63 | .of.the.ACM.Symposium.on.Artific |
| 15c340 | 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 20 61 6e 64 20 50 72 6f 67 72 61 6d 6d 69 6e 67 | ial.Intelligence.and.Programming |
| 15c360 | 20 4c 61 6e 67 75 61 67 65 73 27 2c 20 70 70 2e 0a 31 31 36 2d 31 32 35 2e 0a 0a 20 20 20 44 6f | .Languages',.pp..116-125......Do |
| 15c380 | 79 6c 65 2c 20 4a 6f 6e 2e 20 31 39 37 39 2e 20 41 20 74 72 75 74 68 20 6d 61 69 6e 74 65 6e 61 | yle,.Jon..1979..A.truth.maintena |
| 15c3a0 | 6e 63 65 20 73 79 73 74 65 6d 2e 20 60 41 72 74 69 66 69 63 69 61 6c 0a 49 6e 74 65 6c 6c 69 67 | nce.system..`Artificial.Intellig |
| 15c3c0 | 65 6e 63 65 27 20 31 32 3a 32 33 31 2d 32 37 32 2e 0a 0a 20 20 20 46 65 69 67 65 6e 62 61 75 6d | ence'.12:231-272......Feigenbaum |
| 15c3e0 | 2c 20 45 64 77 61 72 64 2c 20 61 6e 64 20 48 6f 77 61 72 64 20 53 68 72 6f 62 65 2e 20 31 39 39 | ,.Edward,.and.Howard.Shrobe..199 |
| 15c400 | 33 2e 20 54 68 65 20 4a 61 70 61 6e 65 73 65 20 4e 61 74 69 6f 6e 61 6c 0a 46 69 66 74 68 20 47 | 3..The.Japanese.National.Fifth.G |
| 15c420 | 65 6e 65 72 61 74 69 6f 6e 20 50 72 6f 6a 65 63 74 3a 20 49 6e 74 72 6f 64 75 63 74 69 6f 6e 2c | eneration.Project:.Introduction, |
| 15c440 | 20 73 75 72 76 65 79 2c 20 61 6e 64 20 65 76 61 6c 75 61 74 69 6f 6e 2e 20 20 49 6e 0a 60 46 75 | .survey,.and.evaluation...In.`Fu |
| 15c460 | 74 75 72 65 20 47 65 6e 65 72 61 74 69 6f 6e 20 43 6f 6d 70 75 74 65 72 20 53 79 73 74 65 6d 73 | ture.Generation.Computer.Systems |
| 15c480 | 27 2c 20 76 6f 6c 2e 20 39 2c 20 70 70 2e 20 31 30 35 2d 31 31 37 2e 0a 0a 20 20 20 46 65 65 6c | ',.vol..9,.pp..105-117......Feel |
| 15c4a0 | 65 79 2c 20 4d 61 72 63 2e 20 20 31 39 38 36 2e 20 20 44 65 75 78 20 61 70 70 72 6f 63 68 65 73 | ey,.Marc...1986...Deux.approches |
| 15c4c0 | 20 61 60 20 6c 27 69 6d 70 6c 61 6e 74 61 74 69 6f 6e 20 64 75 20 6c 61 6e 67 75 61 67 65 0a 53 | .a`.l'implantation.du.language.S |
| 15c4e0 | 63 68 65 6d 65 2e 20 20 4d 61 73 74 65 72 73 20 74 68 65 73 69 73 2c 20 55 6e 69 76 65 72 73 69 | cheme...Masters.thesis,.Universi |
| 15c500 | 74 65 27 20 64 65 20 4d 6f 6e 74 72 65 27 61 6c 2e 0a 0a 20 20 20 46 65 65 6c 65 79 2c 20 4d 61 | te'.de.Montre'al......Feeley,.Ma |
| 15c520 | 72 63 20 61 6e 64 20 47 75 79 20 4c 61 70 61 6c 6d 65 2e 20 20 31 39 38 37 2e 20 20 55 73 69 6e | rc.and.Guy.Lapalme...1987...Usin |
| 15c540 | 67 20 63 6c 6f 73 75 72 65 73 20 66 6f 72 20 63 6f 64 65 0a 67 65 6e 65 72 61 74 69 6f 6e 2e 20 | g.closures.for.code.generation.. |
| 15c560 | 20 60 4a 6f 75 72 6e 61 6c 20 6f 66 20 43 6f 6d 70 75 74 65 72 20 4c 61 6e 67 75 61 67 65 73 27 | .`Journal.of.Computer.Languages' |
| 15c580 | 20 31 32 28 31 29 3a 34 37 2d 36 36 2e 0a 0a 20 20 20 46 65 6c 6c 65 72 2c 20 57 69 6c 6c 69 61 | .12(1):47-66......Feller,.Willia |
| 15c5a0 | 6d 2e 20 20 31 39 35 37 2e 20 20 60 41 6e 20 49 6e 74 72 6f 64 75 63 74 69 6f 6e 20 74 6f 20 50 | m...1957...`An.Introduction.to.P |
| 15c5c0 | 72 6f 62 61 62 69 6c 69 74 79 20 54 68 65 6f 72 79 20 61 6e 64 0a 49 74 73 20 41 70 70 6c 69 63 | robability.Theory.and.Its.Applic |
| 15c5e0 | 61 74 69 6f 6e 73 27 2c 20 76 6f 6c 75 6d 65 20 31 2e 20 4e 65 77 20 59 6f 72 6b 3a 20 4a 6f 68 | ations',.volume.1..New.York:.Joh |
| 15c600 | 6e 20 57 69 6c 65 79 20 26 20 53 6f 6e 73 2e 0a 0a 20 20 20 46 65 6e 69 63 68 65 6c 2c 20 52 2e | n.Wiley.&.Sons......Fenichel,.R. |
| 15c620 | 2c 20 61 6e 64 20 4a 2e 20 59 6f 63 68 65 6c 73 6f 6e 2e 20 20 31 39 36 39 2e 20 20 41 20 4c 69 | ,.and.J..Yochelson...1969...A.Li |
| 15c640 | 73 70 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 6f 72 20 66 6f 72 0a 76 69 72 74 75 61 6c | sp.garbage.collector.for.virtual |
| 15c660 | 20 6d 65 6d 6f 72 79 20 63 6f 6d 70 75 74 65 72 20 73 79 73 74 65 6d 73 2e 20 20 60 43 6f 6d 6d | .memory.computer.systems...`Comm |
| 15c680 | 75 6e 69 63 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 41 43 4d 27 0a 31 32 28 31 31 29 3a 36 31 | unications.of.the.ACM'.12(11):61 |
| 15c6a0 | 31 2d 36 31 32 2e 0a 0a 20 20 20 46 6c 6f 79 64 2c 20 52 6f 62 65 72 74 2e 20 31 39 36 37 2e 20 | 1-612......Floyd,.Robert..1967.. |
| 15c6c0 | 4e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 61 6c 67 6f 72 69 74 68 6d 73 2e 20 60 4a 41 | Nondeterministic.algorithms..`JA |
| 15c6e0 | 43 4d 27 2c 0a 31 34 28 34 29 3a 36 33 36 2d 36 34 34 2e 0a 0a 20 20 20 46 6f 72 62 75 73 2c 20 | CM',.14(4):636-644......Forbus,. |
| 15c700 | 4b 65 6e 6e 65 74 68 20 44 2e 2c 20 61 6e 64 20 4a 6f 68 61 6e 20 64 65 4b 6c 65 65 72 2e 20 20 | Kenneth.D.,.and.Johan.deKleer... |
| 15c720 | 31 39 39 33 2e 20 60 42 75 69 6c 64 69 6e 67 20 50 72 6f 62 6c 65 6d 0a 53 6f 6c 76 65 72 73 27 | 1993..`Building.Problem.Solvers' |
| 15c740 | 2e 20 43 61 6d 62 72 69 64 67 65 2c 20 4d 41 3a 20 4d 49 54 20 50 72 65 73 73 2e 0a 0a 20 20 20 | ..Cambridge,.MA:.MIT.Press...... |
| 15c760 | 46 72 69 65 64 6d 61 6e 2c 20 44 61 6e 69 65 6c 20 50 2e 2c 20 61 6e 64 20 44 61 76 69 64 20 53 | Friedman,.Daniel.P.,.and.David.S |
| 15c780 | 2e 20 57 69 73 65 2e 20 20 31 39 37 36 2e 20 20 43 4f 4e 53 20 73 68 6f 75 6c 64 20 6e 6f 74 0a | ..Wise...1976...CONS.should.not. |
| 15c7a0 | 65 76 61 6c 75 61 74 65 20 69 74 73 20 61 72 67 75 6d 65 6e 74 73 2e 20 49 6e 20 60 41 75 74 6f | evaluate.its.arguments..In.`Auto |
| 15c7c0 | 6d 61 74 61 2c 20 4c 61 6e 67 75 61 67 65 73 2c 20 61 6e 64 20 50 72 6f 67 72 61 6d 6d 69 6e 67 | mata,.Languages,.and.Programming |
| 15c7e0 | 3a 20 54 68 69 72 64 0a 49 6e 74 65 72 6e 61 74 69 6f 6e 61 6c 20 43 6f 6c 6c 6f 71 75 69 75 6d | :.Third.International.Colloquium |
| 15c800 | 27 2c 20 65 64 69 74 65 64 20 62 79 20 53 2e 20 4d 69 63 68 61 65 6c 73 6f 6e 20 61 6e 64 20 52 | ',.edited.by.S..Michaelson.and.R |
| 15c820 | 2e 20 20 4d 69 6c 6e 65 72 2c 20 70 70 2e 0a 32 35 37 2d 32 38 34 2e 0a 0a 20 20 20 46 72 69 65 | ...Milner,.pp..257-284......Frie |
| 15c840 | 64 6d 61 6e 2c 20 44 61 6e 69 65 6c 20 50 2e 2c 20 4d 69 74 63 68 65 6c 6c 20 57 61 6e 64 2c 20 | dman,.Daniel.P.,.Mitchell.Wand,. |
| 15c860 | 61 6e 64 20 43 68 72 69 73 74 6f 70 68 65 72 20 54 2e 20 48 61 79 6e 65 73 2e 20 31 39 39 32 2e | and.Christopher.T..Haynes..1992. |
| 15c880 | 0a 60 45 73 73 65 6e 74 69 61 6c 73 20 6f 66 20 50 72 6f 67 72 61 6d 6d 69 6e 67 20 4c 61 6e 67 | .`Essentials.of.Programming.Lang |
| 15c8a0 | 75 61 67 65 73 27 2e 20 20 43 61 6d 62 72 69 64 67 65 2c 20 4d 41 3a 20 4d 49 54 0a 50 72 65 73 | uages'...Cambridge,.MA:.MIT.Pres |
| 15c8c0 | 73 2f 4d 63 47 72 61 77 2d 48 69 6c 6c 2e 0a 0a 20 20 20 47 61 62 72 69 65 6c 2c 20 52 69 63 68 | s/McGraw-Hill......Gabriel,.Rich |
| 15c8e0 | 61 72 64 20 50 2e 20 31 39 38 38 2e 20 20 54 68 65 20 57 68 79 20 6f 66 20 5f 59 5f 2e 20 20 60 | ard.P..1988...The.Why.of._Y_...` |
| 15c900 | 4c 69 73 70 20 50 6f 69 6e 74 65 72 73 27 0a 32 28 32 29 3a 31 35 2d 32 35 2e 0a 0a 20 20 20 47 | Lisp.Pointers'.2(2):15-25......G |
| 15c920 | 6f 6c 64 62 65 72 67 2c 20 41 64 65 6c 65 2c 20 61 6e 64 20 44 61 76 69 64 20 52 6f 62 73 6f 6e | oldberg,.Adele,.and.David.Robson |
| 15c940 | 2e 20 20 31 39 38 33 2e 20 20 60 53 6d 61 6c 6c 74 61 6c 6b 2d 38 30 3a 20 54 68 65 0a 4c 61 6e | ...1983...`Smalltalk-80:.The.Lan |
| 15c960 | 67 75 61 67 65 20 61 6e 64 20 49 74 73 20 49 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 27 2e 20 52 | guage.and.Its.Implementation'..R |
| 15c980 | 65 61 64 69 6e 67 2c 20 4d 41 3a 20 41 64 64 69 73 6f 6e 2d 57 65 73 6c 65 79 2e 0a 0a 20 20 20 | eading,.MA:.Addison-Wesley...... |
| 15c9a0 | 47 6f 72 64 6f 6e 2c 20 4d 69 63 68 61 65 6c 2c 20 52 6f 62 69 6e 20 4d 69 6c 6e 65 72 2c 20 61 | Gordon,.Michael,.Robin.Milner,.a |
| 15c9c0 | 6e 64 20 43 68 72 69 73 74 6f 70 68 65 72 20 57 61 64 73 77 6f 72 74 68 2e 20 20 31 39 37 39 2e | nd.Christopher.Wadsworth...1979. |
| 15c9e0 | 0a 60 45 64 69 6e 62 75 72 67 68 20 4c 43 46 27 2e 20 4c 65 63 74 75 72 65 20 4e 6f 74 65 73 20 | .`Edinburgh.LCF'..Lecture.Notes. |
| 15ca00 | 69 6e 20 43 6f 6d 70 75 74 65 72 20 53 63 69 65 6e 63 65 2c 20 76 6f 6c 75 6d 65 20 37 38 2e 20 | in.Computer.Science,.volume.78.. |
| 15ca20 | 4e 65 77 20 59 6f 72 6b 3a 0a 53 70 72 69 6e 67 65 72 2d 56 65 72 6c 61 67 2e 0a 0a 20 20 20 47 | New.York:.Springer-Verlag......G |
| 15ca40 | 72 61 79 2c 20 4a 69 6d 2c 20 61 6e 64 20 41 6e 64 72 65 61 73 20 52 65 75 74 65 72 2e 20 31 39 | ray,.Jim,.and.Andreas.Reuter..19 |
| 15ca60 | 39 33 2e 20 60 54 72 61 6e 73 61 63 74 69 6f 6e 20 50 72 6f 63 65 73 73 69 6e 67 3a 0a 43 6f 6e | 93..`Transaction.Processing:.Con |
| 15ca80 | 63 65 70 74 73 20 61 6e 64 20 4d 6f 64 65 6c 73 27 2e 20 53 61 6e 20 4d 61 74 65 6f 2c 20 43 41 | cepts.and.Models'..San.Mateo,.CA |
| 15caa0 | 3a 20 4d 6f 72 67 61 6e 2d 4b 61 75 66 6d 61 6e 2e 0a 0a 20 20 20 47 72 65 65 6e 2c 20 43 6f 72 | :.Morgan-Kaufman......Green,.Cor |
| 15cac0 | 64 65 6c 6c 2e 20 20 31 39 36 39 2e 20 20 41 70 70 6c 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 | dell...1969...Application.of.the |
| 15cae0 | 6f 72 65 6d 20 70 72 6f 76 69 6e 67 20 74 6f 20 70 72 6f 62 6c 65 6d 0a 73 6f 6c 76 69 6e 67 2e | orem.proving.to.problem.solving. |
| 15cb00 | 20 20 49 6e 20 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 20 49 6e 74 65 72 6e 61 | ..In.`Proceedings.of.the.Interna |
| 15cb20 | 74 69 6f 6e 61 6c 20 4a 6f 69 6e 74 20 43 6f 6e 66 65 72 65 6e 63 65 20 6f 6e 0a 41 72 74 69 66 | tional.Joint.Conference.on.Artif |
| 15cb40 | 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 27 2c 20 70 70 2e 20 32 31 39 2d 32 34 30 | icial.Intelligence',.pp..219-240 |
| 15cb60 | 2e 0a 0a 20 20 20 47 72 65 65 6e 2c 20 43 6f 72 64 65 6c 6c 2c 20 61 6e 64 20 42 65 72 74 72 61 | ......Green,.Cordell,.and.Bertra |
| 15cb80 | 6d 20 52 61 70 68 61 65 6c 2e 20 20 31 39 36 38 2e 20 20 54 68 65 20 75 73 65 20 6f 66 0a 74 68 | m.Raphael...1968...The.use.of.th |
| 15cba0 | 65 6f 72 65 6d 2d 70 72 6f 76 69 6e 67 20 74 65 63 68 6e 69 71 75 65 73 20 69 6e 20 71 75 65 73 | eorem-proving.techniques.in.ques |
| 15cbc0 | 74 69 6f 6e 2d 61 6e 73 77 65 72 69 6e 67 20 73 79 73 74 65 6d 73 2e 20 20 49 6e 0a 60 50 72 6f | tion-answering.systems...In.`Pro |
| 15cbe0 | 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 20 41 43 4d 20 4e 61 74 69 6f 6e 61 6c 20 43 6f 6e | ceedings.of.the.ACM.National.Con |
| 15cc00 | 66 65 72 65 6e 63 65 27 2c 20 70 70 2e 20 31 36 39 2d 31 38 31 2e 0a 0a 20 20 20 47 72 69 73 73 | ference',.pp..169-181......Griss |
| 15cc20 | 2c 20 4d 61 72 74 69 6e 20 4c 2e 20 20 31 39 38 31 2e 20 20 50 6f 72 74 61 62 6c 65 20 53 74 61 | ,.Martin.L...1981...Portable.Sta |
| 15cc40 | 6e 64 61 72 64 20 4c 69 73 70 2c 20 61 20 62 72 69 65 66 20 6f 76 65 72 76 69 65 77 2e 0a 55 74 | ndard.Lisp,.a.brief.overview..Ut |
| 15cc60 | 61 68 20 53 79 6d 62 6f 6c 69 63 20 43 6f 6d 70 75 74 61 74 69 6f 6e 20 47 72 6f 75 70 20 4f 70 | ah.Symbolic.Computation.Group.Op |
| 15cc80 | 65 72 61 74 69 6e 67 20 4e 6f 74 65 20 35 38 2c 20 55 6e 69 76 65 72 73 69 74 79 20 6f 66 20 55 | erating.Note.58,.University.of.U |
| 15cca0 | 74 61 68 2e 0a 0a 20 20 20 47 75 74 74 61 67 2c 20 4a 6f 68 6e 20 56 2e 20 20 31 39 37 37 2e 20 | tah......Guttag,.John.V...1977.. |
| 15ccc0 | 20 41 62 73 74 72 61 63 74 20 64 61 74 61 20 74 79 70 65 73 20 61 6e 64 20 74 68 65 20 64 65 76 | .Abstract.data.types.and.the.dev |
| 15cce0 | 65 6c 6f 70 6d 65 6e 74 20 6f 66 0a 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 2e 20 20 60 43 | elopment.of.data.structures...`C |
| 15cd00 | 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 41 43 4d 27 20 32 30 28 36 29 3a | ommunications.of.the.ACM'.20(6): |
| 15cd20 | 33 39 37 2d 34 30 34 2e 0a 0a 20 20 20 48 61 6d 6d 69 6e 67 2c 20 52 69 63 68 61 72 64 20 57 2e | 397-404......Hamming,.Richard.W. |
| 15cd40 | 20 20 31 39 38 30 2e 20 20 60 43 6f 64 69 6e 67 20 61 6e 64 20 49 6e 66 6f 72 6d 61 74 69 6f 6e | ..1980...`Coding.and.Information |
| 15cd60 | 20 54 68 65 6f 72 79 27 2e 0a 45 6e 67 6c 65 77 6f 6f 64 20 43 6c 69 66 66 73 2c 20 4e 2e 4a 2e | .Theory'..Englewood.Cliffs,.N.J. |
| 15cd80 | 3a 20 50 72 65 6e 74 69 63 65 2d 48 61 6c 6c 2e 0a 0a 20 20 20 48 61 6e 73 6f 6e 2c 20 43 68 72 | :.Prentice-Hall......Hanson,.Chr |
| 15cda0 | 69 73 74 6f 70 68 65 72 20 50 2e 20 20 31 39 39 30 2e 20 20 45 66 66 69 63 69 65 6e 74 20 73 74 | istopher.P...1990...Efficient.st |
| 15cdc0 | 61 63 6b 20 61 6c 6c 6f 63 61 74 69 6f 6e 20 66 6f 72 0a 74 61 69 6c 2d 72 65 63 75 72 73 69 76 | ack.allocation.for.tail-recursiv |
| 15cde0 | 65 20 6c 61 6e 67 75 61 67 65 73 2e 20 20 49 6e 20 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 | e.languages...In.`Proceedings.of |
| 15ce00 | 20 41 43 4d 20 43 6f 6e 66 65 72 65 6e 63 65 20 6f 6e 20 4c 69 73 70 20 61 6e 64 0a 46 75 6e 63 | .ACM.Conference.on.Lisp.and.Func |
| 15ce20 | 74 69 6f 6e 61 6c 20 50 72 6f 67 72 61 6d 6d 69 6e 67 27 2c 20 70 70 2e 20 31 30 36 2d 31 31 38 | tional.Programming',.pp..106-118 |
| 15ce40 | 2e 0a 0a 20 20 20 48 61 6e 73 6f 6e 2c 20 43 68 72 69 73 74 6f 70 68 65 72 20 50 2e 20 20 31 39 | ......Hanson,.Christopher.P...19 |
| 15ce60 | 39 31 2e 20 20 41 20 73 79 6e 74 61 63 74 69 63 20 63 6c 6f 73 75 72 65 73 20 6d 61 63 72 6f 20 | 91...A.syntactic.closures.macro. |
| 15ce80 | 66 61 63 69 6c 69 74 79 2e 0a 60 4c 69 73 70 20 50 6f 69 6e 74 65 72 73 27 2c 20 34 28 33 29 2e | facility..`Lisp.Pointers',.4(3). |
| 15cea0 | 0a 0a 20 20 20 48 61 72 64 79 2c 20 47 6f 64 66 72 65 79 20 48 2e 20 20 31 39 32 31 2e 20 20 53 | .....Hardy,.Godfrey.H...1921...S |
| 15cec0 | 72 69 6e 69 76 61 73 61 20 52 61 6d 61 6e 75 6a 61 6e 2e 20 20 60 50 72 6f 63 65 65 64 69 6e 67 | rinivasa.Ramanujan...`Proceeding |
| 15cee0 | 73 20 6f 66 20 74 68 65 0a 4c 6f 6e 64 6f 6e 20 4d 61 74 68 65 6d 61 74 69 63 61 6c 20 53 6f 63 | s.of.the.London.Mathematical.Soc |
| 15cf00 | 69 65 74 79 27 20 58 49 58 28 32 29 2e 0a 0a 20 20 20 48 61 72 64 79 2c 20 47 6f 64 66 72 65 79 | iety'.XIX(2)......Hardy,.Godfrey |
| 15cf20 | 20 48 2e 2c 20 61 6e 64 20 45 2e 20 4d 2e 20 57 72 69 67 68 74 2e 20 20 31 39 36 30 2e 20 20 60 | .H.,.and.E..M..Wright...1960...` |
| 15cf40 | 41 6e 20 49 6e 74 72 6f 64 75 63 74 69 6f 6e 20 74 6f 20 74 68 65 0a 54 68 65 6f 72 79 20 6f 66 | An.Introduction.to.the.Theory.of |
| 15cf60 | 20 4e 75 6d 62 65 72 73 27 2e 20 20 34 74 68 20 65 64 69 74 69 6f 6e 2e 20 20 4e 65 77 20 59 6f | .Numbers'...4th.edition...New.Yo |
| 15cf80 | 72 6b 3a 20 4f 78 66 6f 72 64 20 55 6e 69 76 65 72 73 69 74 79 20 50 72 65 73 73 2e 0a 0a 20 20 | rk:.Oxford.University.Press..... |
| 15cfa0 | 20 48 61 76 65 6e 64 65 72 2c 20 4a 2e 20 31 39 36 38 2e 20 41 76 6f 69 64 69 6e 67 20 64 65 61 | .Havender,.J..1968..Avoiding.dea |
| 15cfc0 | 64 6c 6f 63 6b 73 20 69 6e 20 6d 75 6c 74 69 2d 74 61 73 6b 69 6e 67 20 73 79 73 74 65 6d 73 2e | dlocks.in.multi-tasking.systems. |
| 15cfe0 | 20 60 49 42 4d 0a 53 79 73 74 65 6d 73 20 4a 6f 75 72 6e 61 6c 27 20 37 28 32 29 3a 37 34 2d 38 | .`IBM.Systems.Journal'.7(2):74-8 |
| 15d000 | 34 2e 0a 0a 20 20 20 48 65 61 72 6e 2c 20 41 6e 74 68 6f 6e 79 20 43 2e 20 20 31 39 36 39 2e 20 | 4......Hearn,.Anthony.C...1969.. |
| 15d020 | 20 53 74 61 6e 64 61 72 64 20 4c 69 73 70 2e 20 20 54 65 63 68 6e 69 63 61 6c 20 72 65 70 6f 72 | .Standard.Lisp...Technical.repor |
| 15d040 | 74 20 41 49 4d 2d 39 30 2c 0a 41 72 74 69 66 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 | t.AIM-90,.Artificial.Intelligenc |
| 15d060 | 65 20 50 72 6f 6a 65 63 74 2c 20 53 74 61 6e 66 6f 72 64 20 55 6e 69 76 65 72 73 69 74 79 2e 0a | e.Project,.Stanford.University.. |
| 15d080 | 0a 20 20 20 48 65 6e 64 65 72 73 6f 6e 2c 20 50 65 74 65 72 2e 20 31 39 38 30 2e 20 20 60 46 75 | ....Henderson,.Peter..1980...`Fu |
| 15d0a0 | 6e 63 74 69 6f 6e 61 6c 20 50 72 6f 67 72 61 6d 6d 69 6e 67 3a 20 41 70 70 6c 69 63 61 74 69 6f | nctional.Programming:.Applicatio |
| 15d0c0 | 6e 20 61 6e 64 0a 49 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 27 2e 20 45 6e 67 6c 65 77 6f 6f 64 | n.and.Implementation'..Englewood |
| 15d0e0 | 20 43 6c 69 66 66 73 2c 20 4e 2e 4a 2e 3a 20 50 72 65 6e 74 69 63 65 2d 48 61 6c 6c 2e 0a 0a 20 | .Cliffs,.N.J.:.Prentice-Hall.... |
| 15d100 | 20 20 48 65 6e 64 65 72 73 6f 6e 2e 20 50 65 74 65 72 2e 20 31 39 38 32 2e 20 46 75 6e 63 74 69 | ..Henderson..Peter..1982..Functi |
| 15d120 | 6f 6e 61 6c 20 47 65 6f 6d 65 74 72 79 2e 20 49 6e 20 60 43 6f 6e 66 65 72 65 6e 63 65 20 52 65 | onal.Geometry..In.`Conference.Re |
| 15d140 | 63 6f 72 64 0a 6f 66 20 74 68 65 20 31 39 38 32 20 41 43 4d 20 53 79 6d 70 6f 73 69 75 6d 20 6f | cord.of.the.1982.ACM.Symposium.o |
| 15d160 | 6e 20 4c 69 73 70 20 61 6e 64 20 46 75 6e 63 74 69 6f 6e 61 6c 20 50 72 6f 67 72 61 6d 6d 69 6e | n.Lisp.and.Functional.Programmin |
| 15d180 | 67 27 2c 20 70 70 2e 0a 31 37 39 2d 31 38 37 2e 0a 0a 20 20 20 48 65 77 69 74 74 2c 20 43 61 72 | g',.pp..179-187......Hewitt,.Car |
| 15d1a0 | 6c 20 45 2e 20 20 31 39 36 39 2e 20 20 50 4c 41 4e 4e 45 52 3a 20 41 20 6c 61 6e 67 75 61 67 65 | l.E...1969...PLANNER:.A.language |
| 15d1c0 | 20 66 6f 72 20 70 72 6f 76 69 6e 67 20 74 68 65 6f 72 65 6d 73 20 69 6e 0a 72 6f 62 6f 74 73 2e | .for.proving.theorems.in.robots. |
| 15d1e0 | 20 20 49 6e 20 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 20 49 6e 74 65 72 6e 61 | ..In.`Proceedings.of.the.Interna |
| 15d200 | 74 69 6f 6e 61 6c 20 4a 6f 69 6e 74 20 43 6f 6e 66 65 72 65 6e 63 65 20 6f 6e 0a 41 72 74 69 66 | tional.Joint.Conference.on.Artif |
| 15d220 | 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 27 2c 20 70 70 2e 20 32 39 35 2d 33 30 31 | icial.Intelligence',.pp..295-301 |
| 15d240 | 2e 0a 0a 20 20 20 48 65 77 69 74 74 2c 20 43 61 72 6c 20 45 2e 20 20 31 39 37 37 2e 20 20 56 69 | ......Hewitt,.Carl.E...1977...Vi |
| 15d260 | 65 77 69 6e 67 20 63 6f 6e 74 72 6f 6c 20 73 74 72 75 63 74 75 72 65 73 20 61 73 20 70 61 74 74 | ewing.control.structures.as.patt |
| 15d280 | 65 72 6e 73 20 6f 66 0a 70 61 73 73 69 6e 67 20 6d 65 73 73 61 67 65 73 2e 20 20 60 4a 6f 75 72 | erns.of.passing.messages...`Jour |
| 15d2a0 | 6e 61 6c 20 6f 66 20 41 72 74 69 66 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 27 20 | nal.of.Artificial.Intelligence'. |
| 15d2c0 | 38 28 33 29 3a 33 32 33 2d 33 36 34 2e 0a 0a 20 20 20 48 6f 61 72 65 2c 20 43 2e 20 41 2e 20 52 | 8(3):323-364......Hoare,.C..A..R |
| 15d2e0 | 2e 20 31 39 37 32 2e 20 20 50 72 6f 6f 66 20 6f 66 20 63 6f 72 72 65 63 74 6e 65 73 73 20 6f 66 | ..1972...Proof.of.correctness.of |
| 15d300 | 20 64 61 74 61 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 2e 0a 60 41 63 74 61 20 49 6e 66 | .data.representations..`Acta.Inf |
| 15d320 | 6f 72 6d 61 74 69 63 61 27 20 31 28 31 29 2e 0a 0a 20 20 20 48 6f 64 67 65 73 2c 20 41 6e 64 72 | ormatica'.1(1)......Hodges,.Andr |
| 15d340 | 65 77 2e 20 31 39 38 33 2e 20 20 60 41 6c 61 6e 20 54 75 72 69 6e 67 3a 20 54 68 65 20 45 6e 69 | ew..1983...`Alan.Turing:.The.Eni |
| 15d360 | 67 6d 61 27 2e 20 4e 65 77 20 59 6f 72 6b 3a 20 53 69 6d 6f 6e 20 61 6e 64 0a 53 63 68 75 73 74 | gma'..New.York:.Simon.and.Schust |
| 15d380 | 65 72 2e 0a 0a 20 20 20 48 6f 66 73 74 61 64 74 65 72 2c 20 44 6f 75 67 6c 61 73 20 52 2e 20 20 | er......Hofstadter,.Douglas.R... |
| 15d3a0 | 31 39 37 39 2e 20 20 60 47 6f 22 64 65 6c 2c 20 45 73 63 68 65 72 2c 20 42 61 63 68 3a 20 41 6e | 1979...`Go"del,.Escher,.Bach:.An |
| 15d3c0 | 20 45 74 65 72 6e 61 6c 0a 47 6f 6c 64 65 6e 20 42 72 61 69 64 27 2e 20 4e 65 77 20 59 6f 72 6b | .Eternal.Golden.Braid'..New.York |
| 15d3e0 | 3a 20 42 61 73 69 63 20 42 6f 6f 6b 73 2e 0a 0a 20 20 20 48 75 67 68 65 73 2c 20 52 2e 20 4a 2e | :.Basic.Books......Hughes,.R..J. |
| 15d400 | 20 4d 2e 20 20 31 39 39 30 2e 20 20 57 68 79 20 66 75 6e 63 74 69 6f 6e 61 6c 20 70 72 6f 67 72 | .M...1990...Why.functional.progr |
| 15d420 | 61 6d 6d 69 6e 67 20 6d 61 74 74 65 72 73 2e 20 20 49 6e 0a 60 52 65 73 65 61 72 63 68 20 54 6f | amming.matters...In.`Research.To |
| 15d440 | 70 69 63 73 20 69 6e 20 46 75 6e 63 74 69 6f 6e 61 6c 20 50 72 6f 67 72 61 6d 6d 69 6e 67 27 2c | pics.in.Functional.Programming', |
| 15d460 | 20 65 64 69 74 65 64 20 62 79 20 44 61 76 69 64 20 54 75 72 6e 65 72 2e 0a 52 65 61 64 69 6e 67 | .edited.by.David.Turner..Reading |
| 15d480 | 2c 20 4d 41 3a 20 41 64 64 69 73 6f 6e 2d 57 65 73 6c 65 79 2c 20 70 70 2e 20 31 37 2d 34 32 2e | ,.MA:.Addison-Wesley,.pp..17-42. |
| 15d4a0 | 0a 0a 20 20 20 49 45 45 45 20 53 74 64 20 31 31 37 38 2d 31 39 39 30 2e 20 20 31 39 39 30 2e 20 | .....IEEE.Std.1178-1990...1990.. |
| 15d4c0 | 20 60 49 45 45 45 20 53 74 61 6e 64 61 72 64 20 66 6f 72 20 74 68 65 20 53 63 68 65 6d 65 0a 50 | .`IEEE.Standard.for.the.Scheme.P |
| 15d4e0 | 72 6f 67 72 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 61 67 65 27 2e 0a 0a 20 20 20 49 6e 67 65 72 6d | rogramming.Language'......Ingerm |
| 15d500 | 61 6e 2c 20 50 65 74 65 72 2c 20 45 64 67 61 72 20 49 72 6f 6e 73 2c 20 4b 69 72 6b 20 53 61 74 | an,.Peter,.Edgar.Irons,.Kirk.Sat |
| 15d520 | 74 6c 65 79 2c 20 61 6e 64 20 57 61 6c 6c 61 63 65 20 46 65 75 72 7a 65 69 67 3b 0a 61 73 73 69 | tley,.and.Wallace.Feurzeig;.assi |
| 15d540 | 73 74 65 64 20 62 79 20 4d 2e 20 4c 69 6e 64 2c 20 48 65 72 62 65 72 74 20 4b 61 6e 6e 65 72 2c | sted.by.M..Lind,.Herbert.Kanner, |
| 15d560 | 20 61 6e 64 20 52 6f 62 65 72 74 20 46 6c 6f 79 64 2e 20 20 31 39 36 30 2e 20 20 54 48 55 4e 4b | .and.Robert.Floyd...1960...THUNK |
| 15d580 | 53 3a 0a 41 20 77 61 79 20 6f 66 20 63 6f 6d 70 69 6c 69 6e 67 20 70 72 6f 63 65 64 75 72 65 20 | S:.A.way.of.compiling.procedure. |
| 15d5a0 | 73 74 61 74 65 6d 65 6e 74 73 2c 20 77 69 74 68 20 73 6f 6d 65 20 63 6f 6d 6d 65 6e 74 73 20 6f | statements,.with.some.comments.o |
| 15d5c0 | 6e 0a 70 72 6f 63 65 64 75 72 65 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 2e 20 20 55 6e 70 75 62 | n.procedure.declarations...Unpub |
| 15d5e0 | 6c 69 73 68 65 64 20 6d 61 6e 75 73 63 72 69 70 74 2e 20 20 28 41 6c 73 6f 2c 20 70 72 69 76 61 | lished.manuscript...(Also,.priva |
| 15d600 | 74 65 0a 63 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 20 66 72 6f 6d 20 57 61 6c 6c 61 63 65 20 46 65 | te.communication.from.Wallace.Fe |
| 15d620 | 75 72 7a 65 69 67 2e 29 0a 0a 20 20 20 4b 61 6c 64 65 77 61 69 6a 2c 20 41 6e 6e 65 2e 20 31 39 | urzeig.).....Kaldewaij,.Anne..19 |
| 15d640 | 39 30 2e 20 20 60 50 72 6f 67 72 61 6d 6d 69 6e 67 3a 20 54 68 65 20 44 65 72 69 76 61 74 69 6f | 90...`Programming:.The.Derivatio |
| 15d660 | 6e 20 6f 66 20 41 6c 67 6f 72 69 74 68 6d 73 27 2e 0a 4e 65 77 20 59 6f 72 6b 3a 20 50 72 65 6e | n.of.Algorithms'..New.York:.Pren |
| 15d680 | 74 69 63 65 2d 48 61 6c 6c 2e 0a 0a 20 20 20 4b 6f 68 6c 62 65 63 6b 65 72 2c 20 45 75 67 65 6e | tice-Hall......Kohlbecker,.Eugen |
| 15d6a0 | 65 20 45 64 6d 75 6e 64 2c 20 4a 72 2e 20 31 39 38 36 2e 20 20 53 79 6e 74 61 63 74 69 63 20 65 | e.Edmund,.Jr..1986...Syntactic.e |
| 15d6c0 | 78 74 65 6e 73 69 6f 6e 73 20 69 6e 20 74 68 65 0a 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e | xtensions.in.the.programming.lan |
| 15d6e0 | 67 75 61 67 65 20 4c 69 73 70 2e 20 20 50 68 2e 44 2e 20 74 68 65 73 69 73 2c 20 49 6e 64 69 61 | guage.Lisp...Ph.D..thesis,.India |
| 15d700 | 6e 61 20 55 6e 69 76 65 72 73 69 74 79 2e 0a 0a 20 20 20 4b 6f 6e 6f 70 61 73 65 6b 2c 20 4d 69 | na.University......Konopasek,.Mi |
| 15d720 | 6c 6f 73 2c 20 61 6e 64 20 53 75 6e 64 61 72 65 73 61 6e 20 4a 61 79 61 72 61 6d 61 6e 2e 20 20 | los,.and.Sundaresan.Jayaraman... |
| 15d740 | 31 39 38 34 2e 20 20 60 54 68 65 20 54 4b 21 53 6f 6c 76 65 72 0a 42 6f 6f 6b 3a 20 41 20 47 75 | 1984...`The.TK!Solver.Book:.A.Gu |
| 15d760 | 69 64 65 20 74 6f 20 50 72 6f 62 6c 65 6d 2d 53 6f 6c 76 69 6e 67 20 69 6e 20 53 63 69 65 6e 63 | ide.to.Problem-Solving.in.Scienc |
| 15d780 | 65 2c 20 45 6e 67 69 6e 65 65 72 69 6e 67 2c 20 42 75 73 69 6e 65 73 73 2c 20 61 6e 64 0a 45 64 | e,.Engineering,.Business,.and.Ed |
| 15d7a0 | 75 63 61 74 69 6f 6e 27 2e 20 42 65 72 6b 65 6c 65 79 2c 20 43 41 3a 20 4f 73 62 6f 72 6e 65 2f | ucation'..Berkeley,.CA:.Osborne/ |
| 15d7c0 | 4d 63 47 72 61 77 2d 48 69 6c 6c 2e 0a 0a 20 20 20 4b 6e 75 74 68 2c 20 44 6f 6e 61 6c 64 20 45 | McGraw-Hill......Knuth,.Donald.E |
| 15d7e0 | 2e 20 20 31 39 37 33 2e 20 20 60 46 75 6e 64 61 6d 65 6e 74 61 6c 20 41 6c 67 6f 72 69 74 68 6d | ...1973...`Fundamental.Algorithm |
| 15d800 | 73 27 2e 20 56 6f 6c 75 6d 65 20 31 20 6f 66 20 60 54 68 65 0a 41 72 74 20 6f 66 20 43 6f 6d 70 | s'..Volume.1.of.`The.Art.of.Comp |
| 15d820 | 75 74 65 72 20 50 72 6f 67 72 61 6d 6d 69 6e 67 27 2e 20 20 32 6e 64 20 65 64 69 74 69 6f 6e 2e | uter.Programming'...2nd.edition. |
| 15d840 | 20 52 65 61 64 69 6e 67 2c 20 4d 41 3a 20 41 64 64 69 73 6f 6e 2d 57 65 73 6c 65 79 2e 0a 0a 20 | .Reading,.MA:.Addison-Wesley.... |
| 15d860 | 20 20 4b 6e 75 74 68 2c 20 44 6f 6e 61 6c 64 20 45 2e 20 20 31 39 38 31 2e 20 20 60 53 65 6d 69 | ..Knuth,.Donald.E...1981...`Semi |
| 15d880 | 6e 75 6d 65 72 69 63 61 6c 20 41 6c 67 6f 72 69 74 68 6d 73 27 2e 20 56 6f 6c 75 6d 65 20 32 20 | numerical.Algorithms'..Volume.2. |
| 15d8a0 | 6f 66 20 60 54 68 65 0a 41 72 74 20 6f 66 20 43 6f 6d 70 75 74 65 72 20 50 72 6f 67 72 61 6d 6d | of.`The.Art.of.Computer.Programm |
| 15d8c0 | 69 6e 67 27 2e 20 20 32 6e 64 20 65 64 69 74 69 6f 6e 2e 20 52 65 61 64 69 6e 67 2c 20 4d 41 3a | ing'...2nd.edition..Reading,.MA: |
| 15d8e0 | 20 41 64 64 69 73 6f 6e 2d 57 65 73 6c 65 79 2e 0a 0a 20 20 20 4b 6f 77 61 6c 73 6b 69 2c 20 52 | .Addison-Wesley......Kowalski,.R |
| 15d900 | 6f 62 65 72 74 2e 20 20 31 39 37 33 2e 20 20 50 72 65 64 69 63 61 74 65 20 6c 6f 67 69 63 20 61 | obert...1973...Predicate.logic.a |
| 15d920 | 73 20 61 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 0a 54 65 63 68 6e 69 | s.a.programming.language..Techni |
| 15d940 | 63 61 6c 20 72 65 70 6f 72 74 20 37 30 2c 20 44 65 70 61 72 74 6d 65 6e 74 20 6f 66 20 43 6f 6d | cal.report.70,.Department.of.Com |
| 15d960 | 70 75 74 61 74 69 6f 6e 61 6c 20 4c 6f 67 69 63 2c 20 53 63 68 6f 6f 6c 20 6f 66 0a 41 72 74 69 | putational.Logic,.School.of.Arti |
| 15d980 | 66 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 2c 20 55 6e 69 76 65 72 73 69 74 79 20 | ficial.Intelligence,.University. |
| 15d9a0 | 6f 66 20 45 64 69 6e 62 75 72 67 68 2e 0a 0a 20 20 20 4b 6f 77 61 6c 73 6b 69 2c 20 52 6f 62 65 | of.Edinburgh......Kowalski,.Robe |
| 15d9c0 | 72 74 2e 20 20 31 39 37 39 2e 20 20 60 4c 6f 67 69 63 20 66 6f 72 20 50 72 6f 62 6c 65 6d 20 53 | rt...1979...`Logic.for.Problem.S |
| 15d9e0 | 6f 6c 76 69 6e 67 27 2e 20 4e 65 77 20 59 6f 72 6b 3a 0a 4e 6f 72 74 68 2d 48 6f 6c 6c 61 6e 64 | olving'..New.York:.North-Holland |
| 15da00 | 2e 0a 0a 20 20 20 4c 61 6d 70 6f 72 74 2c 20 4c 65 73 6c 69 65 2e 20 31 39 37 38 2e 20 20 54 69 | ......Lamport,.Leslie..1978...Ti |
| 15da20 | 6d 65 2c 20 63 6c 6f 63 6b 73 2c 20 61 6e 64 20 74 68 65 20 6f 72 64 65 72 69 6e 67 20 6f 66 20 | me,.clocks,.and.the.ordering.of. |
| 15da40 | 65 76 65 6e 74 73 20 69 6e 20 61 0a 64 69 73 74 72 69 62 75 74 65 64 20 73 79 73 74 65 6d 2e 20 | events.in.a.distributed.system.. |
| 15da60 | 20 60 43 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 41 43 4d 27 20 32 31 28 | .`Communications.of.the.ACM'.21( |
| 15da80 | 37 29 3a 35 35 38 2d 35 36 35 2e 0a 0a 20 20 20 4c 61 6d 70 73 6f 6e 2c 20 42 75 74 6c 65 72 2c | 7):558-565......Lampson,.Butler, |
| 15daa0 | 20 4a 2e 20 4a 2e 20 48 6f 72 6e 69 6e 67 2c 20 52 2e 20 20 4c 6f 6e 64 6f 6e 2c 20 4a 2e 20 47 | .J..J..Horning,.R...London,.J..G |
| 15dac0 | 2e 20 4d 69 74 63 68 65 6c 6c 2c 20 61 6e 64 20 47 2e 0a 4b 2e 20 20 50 6f 70 65 6b 2e 20 20 31 | ..Mitchell,.and.G..K...Popek...1 |
| 15dae0 | 39 38 31 2e 20 20 52 65 70 6f 72 74 20 6f 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 | 981...Report.on.the.programming. |
| 15db00 | 6c 61 6e 67 75 61 67 65 20 45 75 63 6c 69 64 2e 0a 54 65 63 68 6e 69 63 61 6c 20 72 65 70 6f 72 | language.Euclid..Technical.repor |
| 15db20 | 74 2c 20 43 6f 6d 70 75 74 65 72 20 53 79 73 74 65 6d 73 20 52 65 73 65 61 72 63 68 20 47 72 6f | t,.Computer.Systems.Research.Gro |
| 15db40 | 75 70 2c 20 55 6e 69 76 65 72 73 69 74 79 20 6f 66 0a 54 6f 72 6f 6e 74 6f 2e 0a 0a 20 20 20 4c | up,.University.of.Toronto......L |
| 15db60 | 61 6e 64 69 6e 2c 20 50 65 74 65 72 2e 20 20 31 39 36 35 2e 20 20 41 20 63 6f 72 72 65 73 70 6f | andin,.Peter...1965...A.correspo |
| 15db80 | 6e 64 65 6e 63 65 20 62 65 74 77 65 65 6e 20 41 6c 67 6f 6c 20 36 30 20 61 6e 64 0a 43 68 75 72 | ndence.between.Algol.60.and.Chur |
| 15dba0 | 63 68 27 73 20 6c 61 6d 62 64 61 20 6e 6f 74 61 74 69 6f 6e 3a 20 50 61 72 74 20 49 2e 20 20 60 | ch's.lambda.notation:.Part.I...` |
| 15dbc0 | 43 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 41 43 4d 27 0a 38 28 32 29 3a | Communications.of.the.ACM'.8(2): |
| 15dbe0 | 38 39 2d 31 30 31 2e 0a 0a 20 20 20 4c 69 65 62 65 72 6d 61 6e 2c 20 48 65 6e 72 79 2c 20 61 6e | 89-101......Lieberman,.Henry,.an |
| 15dc00 | 64 20 43 61 72 6c 20 45 2e 20 48 65 77 69 74 74 2e 20 31 39 38 33 2e 20 41 20 72 65 61 6c 2d 74 | d.Carl.E..Hewitt..1983..A.real-t |
| 15dc20 | 69 6d 65 20 67 61 72 62 61 67 65 0a 63 6f 6c 6c 65 63 74 6f 72 20 62 61 73 65 64 20 6f 6e 20 74 | ime.garbage.collector.based.on.t |
| 15dc40 | 68 65 20 6c 69 66 65 74 69 6d 65 73 20 6f 66 20 6f 62 6a 65 63 74 73 2e 20 60 43 6f 6d 6d 75 6e | he.lifetimes.of.objects..`Commun |
| 15dc60 | 69 63 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 41 43 4d 27 0a 32 36 28 36 29 3a 34 31 39 2d 34 | ications.of.the.ACM'.26(6):419-4 |
| 15dc80 | 32 39 2e 0a 0a 20 20 20 4c 69 73 6b 6f 76 2c 20 42 61 72 62 61 72 61 20 48 2e 2c 20 61 6e 64 20 | 29......Liskov,.Barbara.H.,.and. |
| 15dca0 | 53 74 65 70 68 65 6e 20 4e 2e 20 5a 69 6c 6c 65 73 2e 20 20 31 39 37 35 2e 20 20 53 70 65 63 69 | Stephen.N..Zilles...1975...Speci |
| 15dcc0 | 66 69 63 61 74 69 6f 6e 0a 74 65 63 68 6e 69 71 75 65 73 20 66 6f 72 20 64 61 74 61 20 61 62 73 | fication.techniques.for.data.abs |
| 15dce0 | 74 72 61 63 74 69 6f 6e 73 2e 20 20 60 49 45 45 45 20 54 72 61 6e 73 61 63 74 69 6f 6e 73 20 6f | tractions...`IEEE.Transactions.o |
| 15dd00 | 6e 20 53 6f 66 74 77 61 72 65 0a 45 6e 67 69 6e 65 65 72 69 6e 67 27 20 31 28 31 29 3a 37 2d 31 | n.Software.Engineering'.1(1):7-1 |
| 15dd20 | 39 2e 0a 0a 20 20 20 4d 63 41 6c 6c 65 73 74 65 72 2c 20 44 61 76 69 64 20 41 6c 6c 65 6e 2e 20 | 9......McAllester,.David.Allen.. |
| 15dd40 | 20 31 39 37 38 2e 20 20 41 20 74 68 72 65 65 2d 76 61 6c 75 65 64 20 74 72 75 74 68 2d 6d 61 69 | .1978...A.three-valued.truth-mai |
| 15dd60 | 6e 74 65 6e 61 6e 63 65 0a 73 79 73 74 65 6d 2e 20 20 4d 65 6d 6f 20 34 37 33 2c 20 4d 49 54 20 | ntenance.system...Memo.473,.MIT. |
| 15dd80 | 41 72 74 69 66 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 20 4c 61 62 6f 72 61 74 6f | Artificial.Intelligence.Laborato |
| 15dda0 | 72 79 2e 0a 0a 20 20 20 4d 63 41 6c 6c 65 73 74 65 72 2c 20 44 61 76 69 64 20 41 6c 6c 65 6e 2e | ry......McAllester,.David.Allen. |
| 15ddc0 | 20 20 31 39 38 30 2e 20 20 41 6e 20 6f 75 74 6c 6f 6f 6b 20 6f 6e 20 74 72 75 74 68 20 6d 61 69 | ..1980...An.outlook.on.truth.mai |
| 15dde0 | 6e 74 65 6e 61 6e 63 65 2e 0a 4d 65 6d 6f 20 35 35 31 2c 20 4d 49 54 20 41 72 74 69 66 69 63 69 | ntenance..Memo.551,.MIT.Artifici |
| 15de00 | 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 20 4c 61 62 6f 72 61 74 6f 72 79 2e 0a 0a 20 20 20 | al.Intelligence.Laboratory...... |
| 15de20 | 4d 63 43 61 72 74 68 79 2c 20 4a 6f 68 6e 2e 20 20 31 39 36 30 2e 20 20 52 65 63 75 72 73 69 76 | McCarthy,.John...1960...Recursiv |
| 15de40 | 65 20 66 75 6e 63 74 69 6f 6e 73 20 6f 66 20 73 79 6d 62 6f 6c 69 63 20 65 78 70 72 65 73 73 69 | e.functions.of.symbolic.expressi |
| 15de60 | 6f 6e 73 0a 61 6e 64 20 74 68 65 69 72 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 62 79 20 6d 61 63 | ons.and.their.computation.by.mac |
| 15de80 | 68 69 6e 65 2e 20 20 60 43 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 41 43 | hine...`Communications.of.the.AC |
| 15dea0 | 4d 27 0a 33 28 34 29 3a 31 38 34 2d 31 39 35 2e 0a 0a 20 20 20 4d 63 43 61 72 74 68 79 2c 20 4a | M'.3(4):184-195......McCarthy,.J |
| 15dec0 | 6f 68 6e 2e 20 20 31 39 36 37 2e 20 20 41 20 62 61 73 69 73 20 66 6f 72 20 61 20 6d 61 74 68 65 | ohn...1967...A.basis.for.a.mathe |
| 15dee0 | 6d 61 74 69 63 61 6c 20 74 68 65 6f 72 79 20 6f 66 0a 63 6f 6d 70 75 74 61 74 69 6f 6e 2e 20 20 | matical.theory.of.computation... |
| 15df00 | 49 6e 20 60 43 6f 6d 70 75 74 65 72 20 50 72 6f 67 72 61 6d 69 6e 67 20 61 6e 64 20 46 6f 72 6d | In.`Computer.Programing.and.Form |
| 15df20 | 61 6c 20 53 79 73 74 65 6d 73 27 2c 20 65 64 69 74 65 64 20 62 79 20 50 2e 0a 42 72 61 66 66 6f | al.Systems',.edited.by.P..Braffo |
| 15df40 | 72 74 20 61 6e 64 20 44 2e 20 48 69 72 73 63 68 62 65 72 67 2e 20 20 4e 6f 72 74 68 2d 48 6f 6c | rt.and.D..Hirschberg...North-Hol |
| 15df60 | 6c 61 6e 64 2e 0a 0a 20 20 20 4d 63 43 61 72 74 68 79 2c 20 4a 6f 68 6e 2e 20 20 31 39 37 38 2e | land......McCarthy,.John...1978. |
| 15df80 | 20 20 54 68 65 20 68 69 73 74 6f 72 79 20 6f 66 20 4c 69 73 70 2e 20 20 49 6e 20 60 50 72 6f 63 | ..The.history.of.Lisp...In.`Proc |
| 15dfa0 | 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 0a 41 43 4d 20 53 49 47 50 4c 41 4e 20 43 6f 6e 66 65 | eedings.of.the.ACM.SIGPLAN.Confe |
| 15dfc0 | 72 65 6e 63 65 20 6f 6e 20 74 68 65 20 48 69 73 74 6f 72 79 20 6f 66 20 50 72 6f 67 72 61 6d 6d | rence.on.the.History.of.Programm |
| 15dfe0 | 69 6e 67 20 4c 61 6e 67 75 61 67 65 73 27 2e 0a 0a 20 20 20 4d 63 43 61 72 74 68 79 2c 20 4a 6f | ing.Languages'......McCarthy,.Jo |
| 15e000 | 68 6e 2c 20 50 2e 20 57 2e 20 41 62 72 61 68 61 6d 73 2c 20 44 2e 20 4a 2e 20 45 64 77 61 72 64 | hn,.P..W..Abrahams,.D..J..Edward |
| 15e020 | 73 2c 20 54 2e 20 50 2e 20 48 61 72 74 2c 20 61 6e 64 20 4d 2e 20 49 2e 0a 4c 65 76 69 6e 2e 20 | s,.T..P..Hart,.and.M..I..Levin.. |
| 15e040 | 20 31 39 36 35 2e 20 20 60 4c 69 73 70 20 31 2e 35 20 50 72 6f 67 72 61 6d 6d 65 72 27 73 20 4d | .1965...`Lisp.1.5.Programmer's.M |
| 15e060 | 61 6e 75 61 6c 27 2e 20 20 32 6e 64 20 65 64 69 74 69 6f 6e 2e 0a 43 61 6d 62 72 69 64 67 65 2c | anual'...2nd.edition..Cambridge, |
| 15e080 | 20 4d 41 3a 20 4d 49 54 20 50 72 65 73 73 2e 0a 0a 20 20 20 4d 63 44 65 72 6d 6f 74 74 2c 20 44 | .MA:.MIT.Press......McDermott,.D |
| 15e0a0 | 72 65 77 2c 20 61 6e 64 20 47 65 72 61 6c 64 20 4a 61 79 20 53 75 73 73 6d 61 6e 2e 20 20 31 39 | rew,.and.Gerald.Jay.Sussman...19 |
| 15e0c0 | 37 32 2e 20 43 6f 6e 6e 69 76 65 72 20 72 65 66 65 72 65 6e 63 65 0a 6d 61 6e 75 61 6c 2e 20 20 | 72..Conniver.reference.manual... |
| 15e0e0 | 4d 65 6d 6f 20 32 35 39 2c 20 4d 49 54 20 41 72 74 69 66 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 | Memo.259,.MIT.Artificial.Intelli |
| 15e100 | 67 65 6e 63 65 20 4c 61 62 6f 72 61 74 6f 72 79 2e 0a 0a 20 20 20 4d 69 6c 6c 65 72 2c 20 47 61 | gence.Laboratory......Miller,.Ga |
| 15e120 | 72 79 20 4c 2e 20 20 31 39 37 36 2e 20 20 52 69 65 6d 61 6e 6e 27 73 20 48 79 70 6f 74 68 65 73 | ry.L...1976...Riemann's.Hypothes |
| 15e140 | 69 73 20 61 6e 64 20 74 65 73 74 73 20 66 6f 72 20 70 72 69 6d 61 6c 69 74 79 2e 0a 60 4a 6f 75 | is.and.tests.for.primality..`Jou |
| 15e160 | 72 6e 61 6c 20 6f 66 20 43 6f 6d 70 75 74 65 72 20 61 6e 64 20 53 79 73 74 65 6d 20 53 63 69 65 | rnal.of.Computer.and.System.Scie |
| 15e180 | 6e 63 65 73 27 20 31 33 28 33 29 3a 33 30 30 2d 33 31 37 2e 0a 0a 20 20 20 4d 69 6c 6c 65 72 2c | nces'.13(3):300-317......Miller, |
| 15e1a0 | 20 4a 61 6d 65 73 20 53 2e 2c 20 61 6e 64 20 47 75 69 6c 6c 65 72 6d 6f 20 4a 2e 20 52 6f 7a 61 | .James.S.,.and.Guillermo.J..Roza |
| 15e1c0 | 73 2e 20 31 39 39 34 2e 20 20 47 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 0a 69 73 20 | s..1994...Garbage.collection.is. |
| 15e1e0 | 66 61 73 74 2c 20 62 75 74 20 61 20 73 74 61 63 6b 20 69 73 20 66 61 73 74 65 72 2e 20 20 4d 65 | fast,.but.a.stack.is.faster...Me |
| 15e200 | 6d 6f 20 31 34 36 32 2c 20 4d 49 54 20 41 72 74 69 66 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 | mo.1462,.MIT.Artificial.Intellig |
| 15e220 | 65 6e 63 65 0a 4c 61 62 6f 72 61 74 6f 72 79 2e 0a 0a 20 20 20 4d 6f 6f 6e 2c 20 44 61 76 69 64 | ence.Laboratory......Moon,.David |
| 15e240 | 2e 20 20 31 39 37 38 2e 20 20 4d 61 63 4c 69 73 70 20 72 65 66 65 72 65 6e 63 65 20 6d 61 6e 75 | ...1978...MacLisp.reference.manu |
| 15e260 | 61 6c 2c 20 56 65 72 73 69 6f 6e 20 30 2e 20 20 54 65 63 68 6e 69 63 61 6c 0a 72 65 70 6f 72 74 | al,.Version.0...Technical.report |
| 15e280 | 2c 20 4d 49 54 20 4c 61 62 6f 72 61 74 6f 72 79 20 66 6f 72 20 43 6f 6d 70 75 74 65 72 20 53 63 | ,.MIT.Laboratory.for.Computer.Sc |
| 15e2a0 | 69 65 6e 63 65 2e 0a 0a 20 20 20 4d 6f 6f 6e 2c 20 44 61 76 69 64 2c 20 61 6e 64 20 44 61 6e 69 | ience......Moon,.David,.and.Dani |
| 15e2c0 | 65 6c 20 57 65 69 6e 72 65 62 2e 20 20 31 39 38 31 2e 20 20 4c 69 73 70 20 6d 61 63 68 69 6e 65 | el.Weinreb...1981...Lisp.machine |
| 15e2e0 | 20 6d 61 6e 75 61 6c 2e 0a 54 65 63 68 6e 69 63 61 6c 20 72 65 70 6f 72 74 2c 20 4d 49 54 20 41 | .manual..Technical.report,.MIT.A |
| 15e300 | 72 74 69 66 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 20 4c 61 62 6f 72 61 74 6f 72 | rtificial.Intelligence.Laborator |
| 15e320 | 79 2e 0a 0a 20 20 20 4d 6f 72 72 69 73 2c 20 4a 2e 20 48 2e 2c 20 45 72 69 63 20 53 63 68 6d 69 | y......Morris,.J..H.,.Eric.Schmi |
| 15e340 | 64 74 2c 20 61 6e 64 20 50 68 69 6c 69 70 20 57 61 64 6c 65 72 2e 20 20 31 39 38 30 2e 20 20 45 | dt,.and.Philip.Wadler...1980...E |
| 15e360 | 78 70 65 72 69 65 6e 63 65 0a 77 69 74 68 20 61 6e 20 61 70 70 6c 69 63 61 74 69 76 65 20 73 74 | xperience.with.an.applicative.st |
| 15e380 | 72 69 6e 67 20 70 72 6f 63 65 73 73 69 6e 67 20 6c 61 6e 67 75 61 67 65 2e 20 20 49 6e 20 60 50 | ring.processing.language...In.`P |
| 15e3a0 | 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 0a 37 74 68 20 41 6e 6e 75 61 6c 20 41 43 4d | roceedings.of.the.7th.Annual.ACM |
| 15e3c0 | 20 53 49 47 41 43 54 2f 53 49 47 50 4c 41 4e 20 53 79 6d 70 6f 73 69 75 6d 20 6f 6e 20 74 68 65 | .SIGACT/SIGPLAN.Symposium.on.the |
| 15e3e0 | 20 50 72 69 6e 63 69 70 6c 65 73 20 6f 66 0a 50 72 6f 67 72 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 | .Principles.of.Programming.Langu |
| 15e400 | 61 67 65 73 27 2e 0a 0a 20 20 20 50 68 69 6c 6c 69 70 73 2c 20 48 75 62 65 72 74 2e 20 20 31 39 | ages'......Phillips,.Hubert...19 |
| 15e420 | 33 34 2e 20 60 54 68 65 20 53 70 68 69 6e 78 20 50 72 6f 62 6c 65 6d 20 42 6f 6f 6b 27 2e 20 20 | 34..`The.Sphinx.Problem.Book'... |
| 15e440 | 4c 6f 6e 64 6f 6e 3a 20 46 61 62 65 72 0a 61 6e 64 20 46 61 62 65 72 2e 0a 0a 20 20 20 50 69 74 | London:.Faber.and.Faber......Pit |
| 15e460 | 6d 61 6e 2c 20 4b 65 6e 74 2e 20 20 31 39 38 33 2e 20 20 54 68 65 20 72 65 76 69 73 65 64 20 4d | man,.Kent...1983...The.revised.M |
| 15e480 | 61 63 4c 69 73 70 20 4d 61 6e 75 61 6c 20 28 53 61 74 75 72 64 61 79 20 65 76 65 6e 69 6e 67 0a | acLisp.Manual.(Saturday.evening. |
| 15e4a0 | 65 64 69 74 69 6f 6e 29 2e 20 20 54 65 63 68 6e 69 63 61 6c 20 72 65 70 6f 72 74 20 32 39 35 2c | edition)...Technical.report.295, |
| 15e4c0 | 20 4d 49 54 20 4c 61 62 6f 72 61 74 6f 72 79 20 66 6f 72 20 43 6f 6d 70 75 74 65 72 20 53 63 69 | .MIT.Laboratory.for.Computer.Sci |
| 15e4e0 | 65 6e 63 65 2e 0a 0a 20 20 20 52 61 62 69 6e 2c 20 4d 69 63 68 61 65 6c 20 4f 2e 20 31 39 38 30 | ence......Rabin,.Michael.O..1980 |
| 15e500 | 2e 20 50 72 6f 62 61 62 69 6c 69 73 74 69 63 20 61 6c 67 6f 72 69 74 68 6d 20 66 6f 72 20 74 65 | ..Probabilistic.algorithm.for.te |
| 15e520 | 73 74 69 6e 67 0a 70 72 69 6d 61 6c 69 74 79 2e 20 20 60 4a 6f 75 72 6e 61 6c 20 6f 66 20 4e 75 | sting.primality...`Journal.of.Nu |
| 15e540 | 6d 62 65 72 20 54 68 65 6f 72 79 27 20 31 32 3a 31 32 38 2d 31 33 38 2e 0a 0a 20 20 20 52 61 79 | mber.Theory'.12:128-138......Ray |
| 15e560 | 6d 6f 6e 64 2c 20 45 72 69 63 2e 20 20 31 39 39 33 2e 20 60 54 68 65 20 4e 65 77 20 48 61 63 6b | mond,.Eric...1993..`The.New.Hack |
| 15e580 | 65 72 27 73 20 44 69 63 74 69 6f 6e 61 72 79 27 2e 20 32 6e 64 20 65 64 69 74 69 6f 6e 2e 0a 43 | er's.Dictionary'..2nd.edition..C |
| 15e5a0 | 61 6d 62 72 69 64 67 65 2c 20 4d 41 3a 20 4d 49 54 20 50 72 65 73 73 2e 0a 0a 20 20 20 52 61 79 | ambridge,.MA:.MIT.Press......Ray |
| 15e5c0 | 6e 61 6c 2c 20 4d 69 63 68 65 6c 2e 20 31 39 38 36 2e 20 60 41 6c 67 6f 72 69 74 68 6d 73 20 66 | nal,.Michel..1986..`Algorithms.f |
| 15e5e0 | 6f 72 20 4d 75 74 75 61 6c 20 45 78 63 6c 75 73 69 6f 6e 27 2e 20 20 43 61 6d 62 72 69 64 67 65 | or.Mutual.Exclusion'...Cambridge |
| 15e600 | 2c 0a 4d 41 3a 20 4d 49 54 20 50 72 65 73 73 2e 0a 0a 20 20 20 52 65 65 73 2c 20 4a 6f 6e 61 74 | ,.MA:.MIT.Press......Rees,.Jonat |
| 15e620 | 68 61 6e 20 41 2e 2c 20 61 6e 64 20 4e 6f 72 6d 61 6e 20 49 2e 20 41 64 61 6d 73 20 49 56 2e 20 | han.A.,.and.Norman.I..Adams.IV.. |
| 15e640 | 31 39 38 32 2e 20 20 54 3a 20 41 20 64 69 61 6c 65 63 74 20 6f 66 0a 4c 69 73 70 20 6f 72 2c 20 | 1982...T:.A.dialect.of.Lisp.or,. |
| 15e660 | 6c 61 6d 62 64 61 3a 20 54 68 65 20 75 6c 74 69 6d 61 74 65 20 73 6f 66 74 77 61 72 65 20 74 6f | lambda:.The.ultimate.software.to |
| 15e680 | 6f 6c 2e 20 20 49 6e 20 60 43 6f 6e 66 65 72 65 6e 63 65 20 52 65 63 6f 72 64 20 6f 66 0a 74 68 | ol...In.`Conference.Record.of.th |
| 15e6a0 | 65 20 31 39 38 32 20 41 43 4d 20 53 79 6d 70 6f 73 69 75 6d 20 6f 6e 20 4c 69 73 70 20 61 6e 64 | e.1982.ACM.Symposium.on.Lisp.and |
| 15e6c0 | 20 46 75 6e 63 74 69 6f 6e 61 6c 20 50 72 6f 67 72 61 6d 6d 69 6e 67 27 2c 20 70 70 2e 0a 31 31 | .Functional.Programming',.pp..11 |
| 15e6e0 | 34 2d 31 32 32 2e 0a 0a 20 20 20 52 65 65 73 2c 20 4a 6f 6e 61 74 68 61 6e 2c 20 61 6e 64 20 57 | 4-122......Rees,.Jonathan,.and.W |
| 15e700 | 69 6c 6c 69 61 6d 20 43 6c 69 6e 67 65 72 20 28 65 64 73 29 2e 20 31 39 39 31 2e 20 20 54 68 65 | illiam.Clinger.(eds)..1991...The |
| 15e720 | 20 72 65 76 69 73 65 64 5e 34 0a 72 65 70 6f 72 74 20 6f 6e 20 74 68 65 20 61 6c 67 6f 72 69 74 | .revised^4.report.on.the.algorit |
| 15e740 | 68 6d 69 63 20 6c 61 6e 67 75 61 67 65 20 53 63 68 65 6d 65 2e 20 20 60 4c 69 73 70 20 50 6f 69 | hmic.language.Scheme...`Lisp.Poi |
| 15e760 | 6e 74 65 72 73 27 2c 20 34 28 33 29 2e 0a 0a 20 20 20 52 69 76 65 73 74 2c 20 52 6f 6e 61 6c 64 | nters',.4(3)......Rivest,.Ronald |
| 15e780 | 2c 20 41 64 69 20 53 68 61 6d 69 72 2c 20 61 6e 64 20 4c 65 6f 6e 61 72 64 20 41 64 6c 65 6d 61 | ,.Adi.Shamir,.and.Leonard.Adlema |
| 15e7a0 | 6e 2e 20 20 31 39 37 37 2e 20 20 41 20 6d 65 74 68 6f 64 0a 66 6f 72 20 6f 62 74 61 69 6e 69 6e | n...1977...A.method.for.obtainin |
| 15e7c0 | 67 20 64 69 67 69 74 61 6c 20 73 69 67 6e 61 74 75 72 65 73 20 61 6e 64 20 70 75 62 6c 69 63 2d | g.digital.signatures.and.public- |
| 15e7e0 | 6b 65 79 20 63 72 79 70 74 6f 73 79 73 74 65 6d 73 2e 0a 54 65 63 68 6e 69 63 61 6c 20 6d 65 6d | key.cryptosystems..Technical.mem |
| 15e800 | 6f 20 4c 43 53 2f 54 4d 38 32 2c 20 4d 49 54 20 4c 61 62 6f 72 61 74 6f 72 79 20 66 6f 72 20 43 | o.LCS/TM82,.MIT.Laboratory.for.C |
| 15e820 | 6f 6d 70 75 74 65 72 20 53 63 69 65 6e 63 65 2e 0a 0a 20 20 20 52 6f 62 69 6e 73 6f 6e 2c 20 4a | omputer.Science......Robinson,.J |
| 15e840 | 2e 20 41 2e 20 31 39 36 35 2e 20 20 41 20 6d 61 63 68 69 6e 65 2d 6f 72 69 65 6e 74 65 64 20 6c | ..A..1965...A.machine-oriented.l |
| 15e860 | 6f 67 69 63 20 62 61 73 65 64 20 6f 6e 20 74 68 65 0a 72 65 73 6f 6c 75 74 69 6f 6e 20 70 72 69 | ogic.based.on.the.resolution.pri |
| 15e880 | 6e 63 69 70 6c 65 2e 20 20 60 4a 6f 75 72 6e 61 6c 20 6f 66 20 74 68 65 20 41 43 4d 27 20 31 32 | nciple...`Journal.of.the.ACM'.12 |
| 15e8a0 | 28 31 29 3a 32 33 2e 0a 0a 20 20 20 52 6f 62 69 6e 73 6f 6e 2c 20 4a 2e 20 41 2e 20 31 39 38 33 | (1):23......Robinson,.J..A..1983 |
| 15e8c0 | 2e 20 20 4c 6f 67 69 63 20 70 72 6f 67 72 61 6d 6d 69 6e 67 2d 2d 50 61 73 74 2c 20 70 72 65 73 | ...Logic.programming--Past,.pres |
| 15e8e0 | 65 6e 74 2c 20 61 6e 64 20 66 75 74 75 72 65 2e 0a 60 4e 65 77 20 47 65 6e 65 72 61 74 69 6f 6e | ent,.and.future..`New.Generation |
| 15e900 | 20 43 6f 6d 70 75 74 69 6e 67 27 20 31 3a 31 30 37 2d 31 32 34 2e 0a 0a 20 20 20 53 70 61 66 66 | .Computing'.1:107-124......Spaff |
| 15e920 | 6f 72 64 2c 20 45 75 67 65 6e 65 20 48 2e 20 20 31 39 38 39 2e 20 20 54 68 65 20 49 6e 74 65 72 | ord,.Eugene.H...1989...The.Inter |
| 15e940 | 6e 65 74 20 57 6f 72 6d 3a 20 43 72 69 73 69 73 20 61 6e 64 20 61 66 74 65 72 6d 61 74 68 2e 0a | net.Worm:.Crisis.and.aftermath.. |
| 15e960 | 60 43 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 41 43 4d 27 20 33 32 28 36 | `Communications.of.the.ACM'.32(6 |
| 15e980 | 29 3a 36 37 38 2d 36 38 38 2e 0a 0a 20 20 20 53 74 65 65 6c 65 2c 20 47 75 79 20 4c 65 77 69 73 | ):678-688......Steele,.Guy.Lewis |
| 15e9a0 | 2c 20 4a 72 2e 20 20 31 39 37 37 2e 20 20 44 65 62 75 6e 6b 69 6e 67 20 74 68 65 20 22 65 78 70 | ,.Jr...1977...Debunking.the."exp |
| 15e9c0 | 65 6e 73 69 76 65 20 70 72 6f 63 65 64 75 72 65 0a 63 61 6c 6c 22 20 6d 79 74 68 2e 20 20 49 6e | ensive.procedure.call".myth...In |
| 15e9e0 | 20 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 20 4e 61 74 69 6f 6e 61 6c 20 43 6f | .`Proceedings.of.the.National.Co |
| 15ea00 | 6e 66 65 72 65 6e 63 65 20 6f 66 20 74 68 65 20 41 43 4d 27 2c 0a 70 70 2e 20 31 35 33 2d 36 32 | nference.of.the.ACM',.pp..153-62 |
| 15ea20 | 2e 0a 0a 20 20 20 53 74 65 65 6c 65 2c 20 47 75 79 20 4c 65 77 69 73 2c 20 4a 72 2e 20 20 31 39 | ......Steele,.Guy.Lewis,.Jr...19 |
| 15ea40 | 38 32 2e 20 20 41 6e 20 6f 76 65 72 76 69 65 77 20 6f 66 20 43 6f 6d 6d 6f 6e 20 4c 69 73 70 2e | 82...An.overview.of.Common.Lisp. |
| 15ea60 | 20 20 49 6e 0a 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 20 74 68 65 20 41 43 4d 20 53 79 6d | ..In.`Proceedings.of.the.ACM.Sym |
| 15ea80 | 70 6f 73 69 75 6d 20 6f 6e 20 4c 69 73 70 20 61 6e 64 20 46 75 6e 63 74 69 6f 6e 61 6c 20 50 72 | posium.on.Lisp.and.Functional.Pr |
| 15eaa0 | 6f 67 72 61 6d 6d 69 6e 67 27 2c 0a 70 70 2e 20 39 38 2d 31 30 37 2e 0a 0a 20 20 20 53 74 65 65 | ogramming',.pp..98-107......Stee |
| 15eac0 | 6c 65 2c 20 47 75 79 20 4c 65 77 69 73 2c 20 4a 72 2e 20 20 31 39 39 30 2e 20 20 60 43 6f 6d 6d | le,.Guy.Lewis,.Jr...1990...`Comm |
| 15eae0 | 6f 6e 20 4c 69 73 70 3a 20 54 68 65 20 4c 61 6e 67 75 61 67 65 27 2e 20 32 6e 64 0a 65 64 69 74 | on.Lisp:.The.Language'..2nd.edit |
| 15eb00 | 69 6f 6e 2e 20 20 44 69 67 69 74 61 6c 20 50 72 65 73 73 2e 0a 0a 20 20 20 53 74 65 65 6c 65 2c | ion...Digital.Press......Steele, |
| 15eb20 | 20 47 75 79 20 4c 65 77 69 73 2c 20 4a 72 2e 2c 20 61 6e 64 20 47 65 72 61 6c 64 20 4a 61 79 20 | .Guy.Lewis,.Jr.,.and.Gerald.Jay. |
| 15eb40 | 53 75 73 73 6d 61 6e 2e 20 20 31 39 37 35 2e 20 20 53 63 68 65 6d 65 3a 20 41 6e 0a 69 6e 74 65 | Sussman...1975...Scheme:.An.inte |
| 15eb60 | 72 70 72 65 74 65 72 20 66 6f 72 20 74 68 65 20 65 78 74 65 6e 64 65 64 20 6c 61 6d 62 64 61 20 | rpreter.for.the.extended.lambda. |
| 15eb80 | 63 61 6c 63 75 6c 75 73 2e 20 20 4d 65 6d 6f 20 33 34 39 2c 20 4d 49 54 20 41 72 74 69 66 69 63 | calculus...Memo.349,.MIT.Artific |
| 15eba0 | 69 61 6c 0a 49 6e 74 65 6c 6c 69 67 65 6e 63 65 20 4c 61 62 6f 72 61 74 6f 72 79 2e 0a 0a 20 20 | ial.Intelligence.Laboratory..... |
| 15ebc0 | 20 53 74 65 65 6c 65 2c 20 47 75 79 20 4c 65 77 69 73 2c 20 4a 72 2e 2c 20 44 6f 6e 61 6c 64 20 | .Steele,.Guy.Lewis,.Jr.,.Donald. |
| 15ebe0 | 52 2e 20 57 6f 6f 64 73 2c 20 52 61 70 68 61 65 6c 20 41 2e 20 46 69 6e 6b 65 6c 2c 20 4d 61 72 | R..Woods,.Raphael.A..Finkel,.Mar |
| 15ec00 | 6b 20 52 2e 0a 43 72 69 73 70 69 6e 2c 20 52 69 63 68 61 72 64 20 4d 2e 20 53 74 61 6c 6c 6d 61 | k.R..Crispin,.Richard.M..Stallma |
| 15ec20 | 6e 2c 20 61 6e 64 20 47 65 6f 66 66 72 65 79 20 53 2e 20 47 6f 6f 64 66 65 6c 6c 6f 77 2e 20 20 | n,.and.Geoffrey.S..Goodfellow... |
| 15ec40 | 31 39 38 33 2e 20 20 60 54 68 65 0a 48 61 63 6b 65 72 27 73 20 44 69 63 74 69 6f 6e 61 72 79 27 | 1983...`The.Hacker's.Dictionary' |
| 15ec60 | 2e 20 4e 65 77 20 59 6f 72 6b 3a 20 48 61 72 70 65 72 20 26 20 52 6f 77 2e 0a 0a 20 20 20 53 74 | ..New.York:.Harper.&.Row......St |
| 15ec80 | 6f 79 2c 20 4a 6f 73 65 70 68 20 45 2e 20 20 31 39 37 37 2e 20 20 60 44 65 6e 6f 74 61 74 69 6f | oy,.Joseph.E...1977...`Denotatio |
| 15eca0 | 6e 61 6c 20 53 65 6d 61 6e 74 69 63 73 27 2e 20 43 61 6d 62 72 69 64 67 65 2c 20 4d 41 3a 20 4d | nal.Semantics'..Cambridge,.MA:.M |
| 15ecc0 | 49 54 0a 50 72 65 73 73 2e 0a 0a 20 20 20 53 75 73 73 6d 61 6e 2c 20 47 65 72 61 6c 64 20 4a 61 | IT.Press......Sussman,.Gerald.Ja |
| 15ece0 | 79 2c 20 61 6e 64 20 52 69 63 68 61 72 64 20 4d 2e 20 53 74 61 6c 6c 6d 61 6e 2e 20 20 31 39 37 | y,.and.Richard.M..Stallman...197 |
| 15ed00 | 35 2e 20 20 48 65 75 72 69 73 74 69 63 0a 74 65 63 68 6e 69 71 75 65 73 20 69 6e 20 63 6f 6d 70 | 5...Heuristic.techniques.in.comp |
| 15ed20 | 75 74 65 72 2d 61 69 64 65 64 20 63 69 72 63 75 69 74 20 61 6e 61 6c 79 73 69 73 2e 20 20 60 49 | uter-aided.circuit.analysis...`I |
| 15ed40 | 45 45 45 20 54 72 61 6e 73 61 63 74 69 6f 6e 73 20 6f 6e 0a 43 69 72 63 75 69 74 73 20 61 6e 64 | EEE.Transactions.on.Circuits.and |
| 15ed60 | 20 53 79 73 74 65 6d 73 27 20 43 41 53 2d 32 32 28 31 31 29 3a 38 35 37 2d 38 36 35 2e 0a 0a 20 | .Systems'.CAS-22(11):857-865.... |
| 15ed80 | 20 20 53 75 73 73 6d 61 6e 2c 20 47 65 72 61 6c 64 20 4a 61 79 2c 20 61 6e 64 20 47 75 79 20 4c | ..Sussman,.Gerald.Jay,.and.Guy.L |
| 15eda0 | 65 77 69 73 20 53 74 65 65 6c 65 20 4a 72 2e 20 20 31 39 38 30 2e 20 20 43 6f 6e 73 74 72 61 69 | ewis.Steele.Jr...1980...Constrai |
| 15edc0 | 6e 74 73 2d 2d 41 0a 6c 61 6e 67 75 61 67 65 20 66 6f 72 20 65 78 70 72 65 73 73 69 6e 67 20 61 | nts--A.language.for.expressing.a |
| 15ede0 | 6c 6d 6f 73 74 2d 68 69 65 72 61 63 68 69 63 61 6c 20 64 65 73 63 72 69 70 74 69 6f 6e 73 2e 20 | lmost-hierachical.descriptions.. |
| 15ee00 | 20 60 41 49 20 4a 6f 75 72 6e 61 6c 27 0a 31 34 3a 31 2d 33 39 2e 0a 0a 20 20 20 53 75 73 73 6d | .`AI.Journal'.14:1-39......Sussm |
| 15ee20 | 61 6e 2c 20 47 65 72 61 6c 64 20 4a 61 79 2c 20 61 6e 64 20 4a 61 63 6b 20 57 69 73 64 6f 6d 2e | an,.Gerald.Jay,.and.Jack.Wisdom. |
| 15ee40 | 20 20 31 39 39 32 2e 20 43 68 61 6f 74 69 63 20 65 76 6f 6c 75 74 69 6f 6e 20 6f 66 0a 74 68 65 | ..1992..Chaotic.evolution.of.the |
| 15ee60 | 20 73 6f 6c 61 72 20 73 79 73 74 65 6d 2e 20 20 60 53 63 69 65 6e 63 65 27 20 32 35 37 3a 32 35 | .solar.system...`Science'.257:25 |
| 15ee80 | 36 2d 32 36 32 2e 0a 0a 20 20 20 53 75 73 73 6d 61 6e 2c 20 47 65 72 61 6c 64 20 4a 61 79 2c 20 | 6-262......Sussman,.Gerald.Jay,. |
| 15eea0 | 54 65 72 72 79 20 57 69 6e 6f 67 72 61 64 2c 20 61 6e 64 20 45 75 67 65 6e 65 20 43 68 61 72 6e | Terry.Winograd,.and.Eugene.Charn |
| 15eec0 | 69 61 6b 2e 20 20 31 39 37 31 2e 0a 4d 69 63 72 6f 70 6c 61 6e 6e 65 72 20 72 65 66 65 72 65 6e | iak...1971..Microplanner.referen |
| 15eee0 | 63 65 20 6d 61 6e 75 61 6c 2e 20 20 4d 65 6d 6f 20 32 30 33 41 2c 20 4d 49 54 20 41 72 74 69 66 | ce.manual...Memo.203A,.MIT.Artif |
| 15ef00 | 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 0a 4c 61 62 6f 72 61 74 6f 72 79 2e 0a 0a | icial.Intelligence.Laboratory... |
| 15ef20 | 20 20 20 53 75 74 68 65 72 6c 61 6e 64 2c 20 49 76 61 6e 20 45 2e 20 20 31 39 36 33 2e 20 20 53 | ...Sutherland,.Ivan.E...1963...S |
| 15ef40 | 4b 45 54 43 48 50 41 44 3a 20 41 20 6d 61 6e 2d 6d 61 63 68 69 6e 65 20 67 72 61 70 68 69 63 61 | KETCHPAD:.A.man-machine.graphica |
| 15ef60 | 6c 0a 63 6f 6d 6d 75 6e 69 63 61 74 69 6f 6e 20 73 79 73 74 65 6d 2e 20 20 54 65 63 68 6e 69 63 | l.communication.system...Technic |
| 15ef80 | 61 6c 20 72 65 70 6f 72 74 20 32 39 36 2c 20 4d 49 54 20 4c 69 6e 63 6f 6c 6e 20 4c 61 62 6f 72 | al.report.296,.MIT.Lincoln.Labor |
| 15efa0 | 61 74 6f 72 79 2e 0a 0a 20 20 20 54 65 69 74 65 6c 6d 61 6e 2c 20 57 61 72 72 65 6e 2e 20 20 31 | atory......Teitelman,.Warren...1 |
| 15efc0 | 39 37 34 2e 20 20 49 6e 74 65 72 6c 69 73 70 20 72 65 66 65 72 65 6e 63 65 20 6d 61 6e 75 61 6c | 974...Interlisp.reference.manual |
| 15efe0 | 2e 20 20 54 65 63 68 6e 69 63 61 6c 0a 72 65 70 6f 72 74 2c 20 58 65 72 6f 78 20 50 61 6c 6f 20 | ...Technical.report,.Xerox.Palo. |
| 15f000 | 41 6c 74 6f 20 52 65 73 65 61 72 63 68 20 43 65 6e 74 65 72 2e 0a 0a 20 20 20 54 68 61 74 63 68 | Alto.Research.Center......Thatch |
| 15f020 | 65 72 2c 20 4a 61 6d 65 73 20 57 2e 2c 20 45 72 69 63 20 47 2e 20 57 61 67 6e 65 72 2c 20 61 6e | er,.James.W.,.Eric.G..Wagner,.an |
| 15f040 | 64 20 4a 65 73 73 65 20 42 2e 20 57 72 69 67 68 74 2e 20 31 39 37 38 2e 20 20 44 61 74 61 0a 74 | d.Jesse.B..Wright..1978...Data.t |
| 15f060 | 79 70 65 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 3a 20 50 61 72 61 6d 65 74 65 72 69 7a 61 74 | ype.specification:.Parameterizat |
| 15f080 | 69 6f 6e 20 61 6e 64 20 74 68 65 20 70 6f 77 65 72 20 6f 66 20 73 70 65 63 69 66 69 63 61 74 69 | ion.and.the.power.of.specificati |
| 15f0a0 | 6f 6e 0a 74 65 63 68 6e 69 71 75 65 73 2e 20 49 6e 20 60 43 6f 6e 66 65 72 65 6e 63 65 20 52 65 | on.techniques..In.`Conference.Re |
| 15f0c0 | 63 6f 72 64 20 6f 66 20 74 68 65 20 54 65 6e 74 68 20 41 6e 6e 75 61 6c 20 41 43 4d 20 53 79 6d | cord.of.the.Tenth.Annual.ACM.Sym |
| 15f0e0 | 70 6f 73 69 75 6d 20 6f 6e 0a 54 68 65 6f 72 79 20 6f 66 20 43 6f 6d 70 75 74 69 6e 67 27 2c 20 | posium.on.Theory.of.Computing',. |
| 15f100 | 70 70 2e 20 31 31 39 2d 31 33 32 2e 0a 0a 20 20 20 54 75 72 6e 65 72 2c 20 44 61 76 69 64 2e 20 | pp..119-132......Turner,.David.. |
| 15f120 | 20 31 39 38 31 2e 20 20 54 68 65 20 66 75 74 75 72 65 20 6f 66 20 61 70 70 6c 69 63 61 74 69 76 | .1981...The.future.of.applicativ |
| 15f140 | 65 20 6c 61 6e 67 75 61 67 65 73 2e 20 20 49 6e 0a 60 50 72 6f 63 65 65 64 69 6e 67 73 20 6f 66 | e.languages...In.`Proceedings.of |
| 15f160 | 20 74 68 65 20 33 72 64 20 45 75 72 6f 70 65 61 6e 20 43 6f 6e 66 65 72 65 6e 63 65 20 6f 6e 20 | .the.3rd.European.Conference.on. |
| 15f180 | 49 6e 66 6f 72 6d 61 74 69 63 73 27 2c 20 4c 65 63 74 75 72 65 0a 4e 6f 74 65 73 20 69 6e 20 43 | Informatics',.Lecture.Notes.in.C |
| 15f1a0 | 6f 6d 70 75 74 65 72 20 53 63 69 65 6e 63 65 2c 20 76 6f 6c 75 6d 65 20 31 32 33 2e 20 4e 65 77 | omputer.Science,.volume.123..New |
| 15f1c0 | 20 59 6f 72 6b 3a 20 53 70 72 69 6e 67 65 72 2d 56 65 72 6c 61 67 2c 20 70 70 2e 0a 33 33 34 2d | .York:.Springer-Verlag,.pp..334- |
| 15f1e0 | 33 34 38 2e 0a 0a 20 20 20 57 61 6e 64 2c 20 4d 69 74 63 68 65 6c 6c 2e 20 20 31 39 38 30 2e 20 | 348......Wand,.Mitchell...1980.. |
| 15f200 | 20 43 6f 6e 74 69 6e 75 61 74 69 6f 6e 2d 62 61 73 65 64 20 70 72 6f 67 72 61 6d 20 74 72 61 6e | .Continuation-based.program.tran |
| 15f220 | 73 66 6f 72 6d 61 74 69 6f 6e 0a 73 74 72 61 74 65 67 69 65 73 2e 20 20 60 4a 6f 75 72 6e 61 6c | sformation.strategies...`Journal |
| 15f240 | 20 6f 66 20 74 68 65 20 41 43 4d 27 20 32 37 28 31 29 3a 31 36 34 2d 31 38 30 2e 0a 0a 20 20 20 | .of.the.ACM'.27(1):164-180...... |
| 15f260 | 57 61 74 65 72 73 2c 20 52 69 63 68 61 72 64 20 43 2e 20 20 31 39 37 39 2e 20 20 41 20 6d 65 74 | Waters,.Richard.C...1979...A.met |
| 15f280 | 68 6f 64 20 66 6f 72 20 61 6e 61 6c 79 7a 69 6e 67 20 6c 6f 6f 70 20 70 72 6f 67 72 61 6d 73 2e | hod.for.analyzing.loop.programs. |
| 15f2a0 | 0a 60 49 45 45 45 20 54 72 61 6e 73 61 63 74 69 6f 6e 73 20 6f 6e 20 53 6f 66 74 77 61 72 65 20 | .`IEEE.Transactions.on.Software. |
| 15f2c0 | 45 6e 67 69 6e 65 65 72 69 6e 67 27 20 35 28 33 29 3a 32 33 37 2d 32 34 37 2e 0a 0a 20 20 20 57 | Engineering'.5(3):237-247......W |
| 15f2e0 | 69 6e 6f 67 72 61 64 2c 20 54 65 72 72 79 2e 20 20 31 39 37 31 2e 20 20 50 72 6f 63 65 64 75 72 | inograd,.Terry...1971...Procedur |
| 15f300 | 65 73 20 61 73 20 61 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 64 61 74 61 20 | es.as.a.representation.for.data. |
| 15f320 | 69 6e 0a 61 20 63 6f 6d 70 75 74 65 72 20 70 72 6f 67 72 61 6d 20 66 6f 72 20 75 6e 64 65 72 73 | in.a.computer.program.for.unders |
| 15f340 | 74 61 6e 64 69 6e 67 20 6e 61 74 75 72 61 6c 20 6c 61 6e 67 75 61 67 65 2e 20 20 54 65 63 68 6e | tanding.natural.language...Techn |
| 15f360 | 69 63 61 6c 0a 72 65 70 6f 72 74 20 41 49 20 54 52 2d 31 37 2c 20 4d 49 54 20 41 72 74 69 66 69 | ical.report.AI.TR-17,.MIT.Artifi |
| 15f380 | 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 20 4c 61 62 6f 72 61 74 6f 72 79 2e 0a 0a 20 | cial.Intelligence.Laboratory.... |
| 15f3a0 | 20 20 57 69 6e 73 74 6f 6e 2c 20 50 61 74 72 69 63 6b 2e 20 31 39 39 32 2e 20 60 41 72 74 69 66 | ..Winston,.Patrick..1992..`Artif |
| 15f3c0 | 69 63 69 61 6c 20 49 6e 74 65 6c 6c 69 67 65 6e 63 65 27 2e 20 20 33 72 64 20 65 64 69 74 69 6f | icial.Intelligence'...3rd.editio |
| 15f3e0 | 6e 2e 0a 52 65 61 64 69 6e 67 2c 20 4d 41 3a 20 41 64 64 69 73 6f 6e 2d 57 65 73 6c 65 79 2e 0a | n..Reading,.MA:.Addison-Wesley.. |
| 15f400 | 0a 20 20 20 5a 61 62 69 68 2c 20 52 61 6d 69 6e 2c 20 44 61 76 69 64 20 4d 63 41 6c 6c 65 73 74 | ....Zabih,.Ramin,.David.McAllest |
| 15f420 | 65 72 2c 20 61 6e 64 20 44 61 76 69 64 20 43 68 61 70 6d 61 6e 2e 20 20 31 39 38 37 2e 0a 4e 6f | er,.and.David.Chapman...1987..No |
| 15f440 | 6e 2d 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 4c 69 73 70 20 77 69 74 68 20 64 65 70 65 6e 64 | n-deterministic.Lisp.with.depend |
| 15f460 | 65 6e 63 79 2d 64 69 72 65 63 74 65 64 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 2e 0a 60 41 41 41 | ency-directed.backtracking..`AAA |
| 15f480 | 49 2d 38 37 27 2c 20 70 70 2e 20 35 39 2d 36 34 2e 0a 0a 20 20 20 5a 69 70 70 65 6c 2c 20 52 69 | I-87',.pp..59-64......Zippel,.Ri |
| 15f4a0 | 63 68 61 72 64 2e 20 20 31 39 37 39 2e 20 20 50 72 6f 62 61 62 69 6c 69 73 74 69 63 20 61 6c 67 | chard...1979...Probabilistic.alg |
| 15f4c0 | 6f 72 69 74 68 6d 73 20 66 6f 72 20 73 70 61 72 73 65 0a 70 6f 6c 79 6e 6f 6d 69 61 6c 73 2e 20 | orithms.for.sparse.polynomials.. |
| 15f4e0 | 20 50 68 2e 44 2e 20 64 69 73 73 65 72 74 61 74 69 6f 6e 2c 20 44 65 70 61 72 74 6d 65 6e 74 20 | .Ph.D..dissertation,.Department. |
| 15f500 | 6f 66 20 45 6c 65 63 74 72 69 63 61 6c 20 45 6e 67 69 6e 65 65 72 69 6e 67 0a 61 6e 64 20 43 6f | of.Electrical.Engineering.and.Co |
| 15f520 | 6d 70 75 74 65 72 20 53 63 69 65 6e 63 65 2c 20 4d 49 54 2e 0a 0a 20 20 20 5a 69 70 70 65 6c 2c | mputer.Science,.MIT......Zippel, |
| 15f540 | 20 52 69 63 68 61 72 64 2e 20 20 31 39 39 33 2e 20 20 60 45 66 66 65 63 74 69 76 65 20 50 6f 6c | .Richard...1993...`Effective.Pol |
| 15f560 | 79 6e 6f 6d 69 61 6c 20 43 6f 6d 70 75 74 61 74 69 6f 6e 27 2e 0a 42 6f 73 74 6f 6e 2c 20 4d 41 | ynomial.Computation'..Boston,.MA |
| 15f580 | 3a 20 4b 6c 75 77 65 72 20 41 63 61 64 65 6d 69 63 20 50 75 62 6c 69 73 68 65 72 73 2e 0a 0a 1f | :.Kluwer.Academic.Publishers.... |
| 15f5a0 | 0a 46 69 6c 65 3a 20 73 69 63 70 2e 69 6e 66 6f 2c 20 20 4e 6f 64 65 3a 20 49 6e 64 65 78 2c 20 | .File:.sicp.info,..Node:.Index,. |
| 15f5c0 | 20 50 72 65 76 3a 20 52 65 66 65 72 65 6e 63 65 73 2c 20 20 55 70 3a 20 54 6f 70 0a 0a 49 6e 64 | .Prev:.References,..Up:.Top..Ind |
| 15f5e0 | 65 78 0a 2a 2a 2a 2a 2a 0a 0a 00 08 5b 69 6e 64 65 78 00 08 5d 0a 2a 20 4d 65 6e 75 3a 0a 0a 2a | ex.*****....[index..].*.Menu:..* |
| 15f600 | 20 61 62 73 74 72 61 63 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .abstract:...................... |
| 15f620 | 20 20 20 20 20 20 20 20 32 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........2-1-3................(li |
| 15f640 | 6e 65 20 31 33 39 29 0a 2a 20 61 62 73 74 72 61 63 74 20 73 79 6e 74 61 78 3a 20 20 20 20 20 20 | ne.139).*.abstract.syntax:...... |
| 15f660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 | .................4-1-1.......... |
| 15f680 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 34 29 0a 2a 20 61 62 73 74 72 61 63 74 69 6f 6e 3a 20 | ......(line..44).*.abstraction:. |
| 15f6a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 31 2d 32 2e | ..........................2-1-2. |
| 15f6c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 36 29 0a 2a 20 61 62 73 74 | ...............(line..16).*.abst |
| 15f6e0 | 72 61 63 74 69 6f 6e 20 62 61 72 72 69 65 72 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | raction.barriers:............... |
| 15f700 | 20 20 20 43 68 61 70 74 65 72 20 32 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 31 | ...Chapter.2............(line.11 |
| 15f720 | 38 29 0a 2a 20 61 63 63 75 6d 75 6c 61 74 6f 72 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 | 8).*.accumulator.<1>:........... |
| 15f740 | 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............3-1-1............... |
| 15f760 | 20 28 6c 69 6e 65 20 32 31 36 29 0a 2a 20 61 63 63 75 6d 75 6c 61 74 6f 72 3a 20 20 20 20 20 20 | .(line.216).*.accumulator:...... |
| 15f780 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2d 33 2e 20 20 20 20 20 | .....................2-2-3...... |
| 15f7a0 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 37 36 29 0a 2a 20 61 63 71 75 69 72 65 64 3a | ..........(line..76).*.acquired: |
| 15f7c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d | ..............................3- |
| 15f7e0 | 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 38 38 29 0a 2a 20 | 4-2................(line.388).*. |
| 15f800 | 61 63 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | action:......................... |
| 15f820 | 20 20 20 20 20 20 20 35 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......5-1-1................(lin |
| 15f840 | 65 20 31 36 34 29 0a 2a 20 61 64 64 69 74 69 76 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e.164).*.additive:.............. |
| 15f860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 34 2d 33 2e 20 20 20 20 20 20 20 20 20 20 | ................2-4-3........... |
| 15f880 | 20 20 20 20 20 28 6c 69 6e 65 20 20 32 36 29 0a 2a 20 61 64 64 69 74 69 76 65 6c 79 20 3c 31 3e | .....(line..26).*.additively.<1> |
| 15f8a0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 34 2e 20 20 20 | :........................2-4.... |
| 15f8c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 31 29 0a 2a 20 61 64 64 69 74 | ..............(line..51).*.addit |
| 15f8e0 | 69 76 65 6c 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ively:.......................... |
| 15f900 | 20 20 43 68 61 70 74 65 72 20 32 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 35 38 | ..Chapter.2............(line.158 |
| 15f920 | 29 0a 2a 20 61 64 64 72 65 73 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.address:.................... |
| 15f940 | 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........5-3-1................ |
| 15f960 | 28 6c 69 6e 65 20 20 20 38 29 0a 2a 20 61 64 64 72 65 73 73 20 61 72 69 74 68 6d 65 74 69 63 3a | (line...8).*.address.arithmetic: |
| 15f980 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 20 20 | ....................5-3-1....... |
| 15f9a0 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 36 29 0a 2a 20 61 67 65 6e 64 61 3a 20 20 20 | .........(line..16).*.agenda:... |
| 15f9c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 | .............................3-3 |
| 15f9e0 | 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 34 35 29 0a 2a 20 61 | -4................(line.345).*.a |
| 15fa00 | 6c 67 65 62 72 61 69 63 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 | lgebraic.specification:......... |
| 15fa20 | 20 20 20 20 20 20 32 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......2-1-3................(line |
| 15fa40 | 20 31 34 39 29 0a 2a 20 61 6c 69 61 73 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .149).*.aliasing:............... |
| 15fa60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............3-1-3............ |
| 15fa80 | 20 20 20 20 28 6c 69 6e 65 20 33 31 33 29 0a 2a 20 61 6e 64 2d 67 61 74 65 3a 20 20 20 20 20 20 | ....(line.313).*.and-gate:...... |
| 15faa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 20 | ........................3-3-4... |
| 15fac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 30 29 0a 2a 20 61 70 70 6c 69 63 | .............(line..30).*.applic |
| 15fae0 | 61 74 69 76 65 2d 6f 72 64 65 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ative-order:.................... |
| 15fb00 | 20 34 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 37 29 | .4-2-1................(line...7) |
| 15fb20 | 0a 2a 20 61 70 70 6c 69 63 61 74 69 76 65 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 3a | .*.applicative-order.evaluation: |
| 15fb40 | 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........1-1-5................( |
| 15fb60 | 6c 69 6e 65 20 31 32 37 29 0a 2a 20 61 72 62 69 74 65 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 | line.127).*.arbiter:............ |
| 15fb80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 2d 32 2e 20 20 20 20 20 20 20 | ...................3-4-2........ |
| 15fba0 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 36 33 33 29 0a 2a 20 61 72 67 75 6d 65 6e 74 73 3a 20 | ........(line.633).*.arguments:. |
| 15fbc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d | ............................1-1- |
| 15fbe0 | 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 37 29 0a 2a 20 61 73 | 1................(line..47).*.as |
| 15fc00 | 73 65 6d 62 6c 65 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | sembler:........................ |
| 15fc20 | 20 20 20 20 20 35 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....5-2-1................(line. |
| 15fc40 | 20 32 30 29 0a 2a 20 61 73 73 65 72 74 69 6f 6e 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .20).*.assertions:.............. |
| 15fc60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............4-4-1............. |
| 15fc80 | 20 20 20 28 6c 69 6e 65 20 20 32 30 29 0a 2a 20 61 73 73 69 67 6e 6d 65 6e 74 3a 20 20 20 20 20 | ...(line..20).*.assignment:..... |
| 15fca0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 31 2e 20 20 20 20 20 | .......................3-1...... |
| 15fcc0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 37 29 0a 2a 20 61 74 6f 6d 69 63 61 | ............(line..37).*.atomica |
| 15fce0 | 6c 6c 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | lly:............................ |
| 15fd00 | 33 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 34 37 29 0a | 3-4-2................(line.447). |
| 15fd20 | 2a 20 61 75 74 6f 6d 61 74 69 63 20 73 74 6f 72 61 67 65 20 61 6c 6c 6f 63 61 74 69 6f 6e 3a 20 | *.automatic.storage.allocation:. |
| 15fd40 | 20 20 20 20 20 20 20 20 20 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........5-3..................(l |
| 15fd60 | 69 6e 65 20 20 33 30 29 0a 2a 20 61 76 65 72 61 67 65 20 64 61 6d 70 69 6e 67 3a 20 20 20 20 20 | ine..30).*.average.damping:..... |
| 15fd80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d 33 2e 20 20 20 20 20 20 20 20 | ..................1-3-3......... |
| 15fda0 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 38 30 29 0a 2a 20 42 2d 74 72 65 65 73 3a 20 20 20 20 | .......(line.180).*.B-trees:.... |
| 15fdc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 33 2d 33 | ...........................2-3-3 |
| 15fde0 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 35 39 29 0a 2a 20 62 61 63 | ................(line.459).*.bac |
| 15fe00 | 6b 62 6f 6e 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | kbone:.......................... |
| 15fe20 | 20 20 20 20 33 2d 33 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 | ....3-3-3................(line.. |
| 15fe40 | 31 39 29 0a 2a 20 62 61 63 6b 71 75 6f 74 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 19).*.backquote:................ |
| 15fe60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............5-5-2.............. |
| 15fe80 | 20 20 28 6c 69 6e 65 20 32 37 39 29 0a 2a 20 62 61 63 6b 74 72 61 63 6b 73 3a 20 20 20 20 20 20 | ..(line.279).*.backtracks:...... |
| 15fea0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 33 2d 31 2e 20 20 20 20 | ......................4-3-1..... |
| 15fec0 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 38 32 29 0a 2a 20 62 61 6c 61 6e 63 65 64 | ...........(line..82).*.balanced |
| 15fee0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 | :..............................2 |
| 15ff00 | 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 39 35 29 0a 2a | -2-2................(line.195).* |
| 15ff20 | 20 62 61 72 72 69 65 72 20 73 79 6e 63 68 72 6f 6e 69 7a 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 | .barrier.synchronization:....... |
| 15ff40 | 20 20 20 20 20 20 20 20 33 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........3-4-2................(li |
| 15ff60 | 6e 65 20 36 35 32 29 0a 2a 20 62 61 73 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ne.652).*.base:................. |
| 15ff80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 | .................5-3-1.......... |
| 15ffa0 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 35 29 0a 2a 20 42 65 72 74 72 61 6e 64 27 73 3a 20 20 | ......(line..35).*.Bertrand's:.. |
| 15ffc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 32 2e | ..........................3-5-2. |
| 15ffe0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 31 31 29 0a 2a 20 62 69 67 6e | ...............(line.411).*.bign |
| 160000 | 75 6d 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | um:............................. |
| 160020 | 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 39 | ...5-3-1................(line..9 |
| 160040 | 37 29 0a 2a 20 62 69 6e 64 69 6e 67 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 7).*.bindings:.................. |
| 160060 | 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............3-2................. |
| 160080 | 20 28 6c 69 6e 65 20 20 32 34 29 0a 2a 20 62 69 6e 64 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 | .(line..24).*.binds:............ |
| 1600a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 38 2e 20 20 20 20 20 | .....................1-1-8...... |
| 1600c0 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 30 39 29 0a 2a 20 62 69 6e 6f 6d 69 61 6c 20 | ..........(line.109).*.binomial. |
| 1600e0 | 63 6f 65 66 66 69 63 69 65 6e 74 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d | coefficients:.................1- |
| 160100 | 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 35 31 29 0a 2a 20 | 2-2................(line.251).*. |
| 160120 | 62 6c 6f 63 6b 20 73 74 72 75 63 74 75 72 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | block.structure:................ |
| 160140 | 20 20 20 20 20 20 20 31 2d 31 2d 38 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......1-1-8................(lin |
| 160160 | 65 20 31 38 32 29 0a 2a 20 62 6f 75 6e 64 20 76 61 72 69 61 62 6c 65 3a 20 20 20 20 20 20 20 20 | e.182).*.bound.variable:........ |
| 160180 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 38 2e 20 20 20 20 20 20 20 20 20 20 | ................1-1-8........... |
| 1601a0 | 20 20 20 20 20 28 6c 69 6e 65 20 31 30 38 29 0a 2a 20 62 6f 78 2d 61 6e 64 2d 70 6f 69 6e 74 65 | .....(line.108).*.box-and-pointe |
| 1601c0 | 72 20 6e 6f 74 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2e 20 20 20 | r.notation:..............2-2.... |
| 1601e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 39 29 0a 2a 20 62 72 65 61 6b | ..............(line...9).*.break |
| 160200 | 70 6f 69 6e 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | point:.......................... |
| 160220 | 20 20 35 2d 32 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 30 39 | ..5-2-4................(line.109 |
| 160240 | 29 0a 2a 20 62 72 6f 6b 65 6e 20 68 65 61 72 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.broken.heart:............... |
| 160260 | 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........5-3-2................ |
| 160280 | 28 6c 69 6e 65 20 31 32 35 29 0a 2a 20 62 75 67 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | (line.125).*.bugs:.............. |
| 1602a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 31 2e 20 20 | ....................Chapter.1... |
| 1602c0 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 38 29 0a 2a 20 63 61 63 68 65 2d 63 6f 68 65 | .........(line..38).*.cache-cohe |
| 1602e0 | 72 65 6e 63 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 | rence:.......................3-4 |
| 160300 | 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 32 32 29 0a 2a 20 63 | -1................(line.222).*.c |
| 160320 | 61 6c 6c 2d 62 79 2d 6e 61 6d 65 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | all-by-name.<1>:................ |
| 160340 | 20 20 20 20 20 20 33 2d 35 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......3-5-1................(line |
| 160360 | 20 34 30 35 29 0a 2a 20 63 61 6c 6c 2d 62 79 2d 6e 61 6d 65 3a 20 20 20 20 20 20 20 20 20 20 20 | .405).*.call-by-name:........... |
| 160380 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............4-2-2............ |
| 1603a0 | 20 20 20 20 28 6c 69 6e 65 20 33 38 33 29 0a 2a 20 63 61 6c 6c 2d 62 79 2d 6e 61 6d 65 20 74 68 | ....(line.383).*.call-by-name.th |
| 1603c0 | 75 6e 6b 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 31 2e 20 20 | unks:...................3-5-1... |
| 1603e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 31 32 29 0a 2a 20 63 61 6c 6c 2d 62 | .............(line.412).*.call-b |
| 160400 | 79 2d 6e 65 65 64 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | y-need.<1>:..................... |
| 160420 | 20 33 2d 35 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 31 31 29 | .3-5-1................(line.411) |
| 160440 | 0a 2a 20 63 61 6c 6c 2d 62 79 2d 6e 65 65 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.call-by-need:................ |
| 160460 | 20 20 20 20 20 20 20 20 20 20 34 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........4-2-2................( |
| 160480 | 6c 69 6e 65 20 33 38 33 29 0a 2a 20 63 61 6c 6c 2d 62 79 2d 6e 65 65 64 20 74 68 75 6e 6b 73 3a | line.383).*.call-by-need.thunks: |
| 1604a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 31 2e 20 20 20 20 20 20 20 | ...................3-5-1........ |
| 1604c0 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 31 33 29 0a 2a 20 63 61 70 74 75 72 69 6e 67 3a 20 | ........(line.413).*.capturing:. |
| 1604e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d | ............................1-1- |
| 160500 | 38 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 32 33 29 0a 2a 20 43 61 | 8................(line.123).*.Ca |
| 160520 | 72 6d 69 63 68 61 65 6c 20 6e 75 6d 62 65 72 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rmichael.numbers:............... |
| 160540 | 20 20 20 20 20 31 2d 32 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....1-2-6................(line. |
| 160560 | 33 30 35 29 0a 2a 20 63 61 73 65 20 61 6e 61 6c 79 73 69 73 3a 20 20 20 20 20 20 20 20 20 20 20 | 305).*.case.analysis:........... |
| 160580 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............1-1-6............. |
| 1605a0 | 20 20 20 28 6c 69 6e 65 20 20 32 30 29 0a 2a 20 63 65 6c 6c 3a 20 20 20 20 20 20 20 20 20 20 20 | ...(line..20).*.cell:........... |
| 1605c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 2d 32 2e 20 20 20 | .......................3-4-2.... |
| 1605e0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 30 39 29 0a 2a 20 63 68 72 6f 6e 6f 6c | ............(line.409).*.chronol |
| 160600 | 6f 67 69 63 61 6c 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ogical:......................... |
| 160620 | 34 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 38 36 29 0a | 4-3-1................(line..86). |
| 160640 | 2a 20 43 68 75 72 63 68 20 6e 75 6d 65 72 61 6c 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | *.Church.numerals:.............. |
| 160660 | 20 20 20 20 20 20 20 20 20 32 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........2-1-3................(l |
| 160680 | 69 6e 65 20 31 32 36 29 0a 2a 20 43 68 75 72 63 68 2d 54 75 72 69 6e 67 20 74 68 65 73 69 73 3a | ine.126).*.Church-Turing.thesis: |
| 1606a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 35 2e 20 20 20 20 20 20 20 20 | ..................4-1-5......... |
| 1606c0 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 34 37 29 0a 2a 20 63 6c 61 75 73 65 73 3a 20 20 20 20 | .......(line.147).*.clauses:.... |
| 1606e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 36 | ...........................1-1-6 |
| 160700 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 31 29 0a 2a 20 63 6c 6f | ................(line..41).*.clo |
| 160720 | 73 65 64 20 77 6f 72 6c 64 20 61 73 73 75 6d 70 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 | sed.world.assumption:........... |
| 160740 | 20 20 20 20 34 2d 34 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 | ....4-4-3................(line.1 |
| 160760 | 35 33 29 0a 2a 20 63 6c 6f 73 75 72 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 53).*.closure:.................. |
| 160780 | 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 32 2e 20 20 20 20 20 20 20 20 20 | .............Chapter.2.......... |
| 1607a0 | 20 20 28 6c 69 6e 65 20 31 33 30 29 0a 2a 20 63 6c 6f 73 75 72 65 20 70 72 6f 70 65 72 74 79 3a | ..(line.130).*.closure.property: |
| 1607c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2e 20 20 20 20 20 20 | ......................2-2....... |
| 1607e0 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 36 29 0a 2a 20 63 6f 64 65 20 67 65 6e | ...........(line..56).*.code.gen |
| 160800 | 65 72 61 74 6f 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 | erator:........................5 |
| 160820 | 2d 35 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 31 29 0a 2a | -5-1................(line..21).* |
| 160840 | 20 63 6f 65 72 63 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .coerce:........................ |
| 160860 | 20 20 20 20 20 20 20 20 32 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........2-5-2................(li |
| 160880 | 6e 65 20 32 37 30 29 0a 2a 20 63 6f 65 72 63 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ne.270).*.coercion:............. |
| 1608a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 | .................2-5-2.......... |
| 1608c0 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 36 33 29 0a 2a 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 73 3a | ......(line..63).*.combinations: |
| 1608e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 31 2e | ..........................1-1-1. |
| 160900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 34 29 0a 2a 20 63 6f 6d 6d | ...............(line..44).*.comm |
| 160920 | 65 6e 74 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ents:........................... |
| 160940 | 20 20 20 32 2d 32 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 36 37 | ...2-2-3................(line.67 |
| 160960 | 31 29 0a 2a 20 63 6f 6d 70 61 63 74 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 1).*.compacting:................ |
| 160980 | 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............5-3-2............... |
| 1609a0 | 20 28 6c 69 6e 65 20 33 30 39 29 0a 2a 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 3a 20 20 20 20 20 20 | .(line.309).*.compilation:...... |
| 1609c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 35 2e 20 20 20 20 20 20 20 | .....................5-5........ |
| 1609e0 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 35 29 0a 2a 20 63 6f 6d 70 69 6c 65 2d 74 | ..........(line..45).*.compile-t |
| 160a00 | 69 6d 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d | ime.environment:..............5- |
| 160a20 | 35 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 37 37 29 0a 2a 20 | 5-6................(line..77).*. |
| 160a40 | 63 6f 6d 70 6f 73 69 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | composition:.................... |
| 160a60 | 20 20 20 20 20 20 20 31 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......1-3-4................(lin |
| 160a80 | 65 20 32 33 33 29 0a 2a 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 3a 20 20 20 20 20 20 20 20 20 | e.233).*.compound.data:......... |
| 160aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 32 2e 20 20 20 20 20 20 | ................Chapter.2....... |
| 160ac0 | 20 20 20 20 20 28 6c 69 6e 65 20 20 33 37 29 0a 2a 20 63 6f 6d 70 6f 75 6e 64 20 64 61 74 61 20 | .....(line..37).*.compound.data. |
| 160ae0 | 6f 62 6a 65 63 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 | object:..................Chapter |
| 160b00 | 20 32 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 36 34 29 0a 2a 20 63 6f 6d 70 6f | .2............(line..64).*.compo |
| 160b20 | 75 6e 64 20 70 72 6f 63 65 64 75 72 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | und.procedure:.................. |
| 160b40 | 20 20 31 2d 31 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 34 | ..1-1-4................(line..34 |
| 160b60 | 29 0a 2a 20 63 6f 6d 70 75 74 61 62 69 6c 69 74 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.computability:.............. |
| 160b80 | 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........4-1-5................ |
| 160ba0 | 28 6c 69 6e 65 20 31 34 32 29 0a 2a 20 63 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 70 72 6f 63 65 | (line.142).*.computational.proce |
| 160bc0 | 73 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 31 2e 20 20 | ss:.................Chapter.1... |
| 160be0 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 38 29 0a 2a 20 63 6f 6e 63 75 72 72 65 6e 74 | .........(line..18).*.concurrent |
| 160c00 | 6c 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 | ly:..........................3-4 |
| 160c20 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 38 29 0a 2a 20 63 | ..................(line..38).*.c |
| 160c40 | 6f 6e 67 72 75 65 6e 74 20 6d 6f 64 75 6c 6f 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ongruent.modulo:................ |
| 160c60 | 20 20 20 20 20 20 31 2d 32 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......1-2-6................(line |
| 160c80 | 20 20 35 36 29 0a 2a 20 63 6f 6e 6e 65 63 74 6f 72 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..56).*.connectors:............. |
| 160ca0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............3-3-5............ |
| 160cc0 | 20 20 20 20 28 6c 69 6e 65 20 20 33 35 29 0a 2a 20 63 6f 6e 73 65 71 75 65 6e 74 3a 20 20 20 20 | ....(line..35).*.consequent:.... |
| 160ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 36 2e 20 20 | ........................1-1-6... |
| 160d00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 38 29 0a 2a 20 63 6f 6e 73 74 72 | .............(line..48).*.constr |
| 160d20 | 61 69 6e 74 20 6e 65 74 77 6f 72 6b 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | aint.networks:.................. |
| 160d40 | 20 33 2d 33 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 35 29 | .3-3-5................(line..35) |
| 160d60 | 0a 2a 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.constructors:................ |
| 160d80 | 20 20 20 20 20 20 20 20 20 20 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........2-1..................( |
| 160da0 | 6c 69 6e 65 20 20 32 37 29 0a 2a 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 20 70 72 6f 63 65 64 75 | line..27).*.continuation.procedu |
| 160dc0 | 72 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 33 2d 33 2e 20 20 20 20 20 20 20 | res:...............4-3-3........ |
| 160de0 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 37 29 0a 2a 20 63 6f 6e 74 69 6e 75 65 64 20 66 | ........(line..27).*.continued.f |
| 160e00 | 72 61 63 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d | raction:....................1-3- |
| 160e20 | 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 39 39 29 0a 2a 20 63 6f | 3................(line.199).*.co |
| 160e40 | 6e 74 72 6f 6c 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ntrol:.......................... |
| 160e60 | 20 20 20 20 20 34 2d 34 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....4-4-3................(line. |
| 160e80 | 20 31 31 29 0a 2a 20 63 6f 6e 74 72 6f 6c 6c 65 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .11).*.controller:.............. |
| 160ea0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............5-1............... |
| 160ec0 | 20 20 20 28 6c 69 6e 65 20 20 20 37 29 0a 2a 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 69 6e 74 | ...(line...7).*.conventional.int |
| 160ee0 | 65 72 66 61 63 65 73 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 32 | erfaces.<1>:...........Chapter.2 |
| 160f00 | 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 33 33 29 0a 2a 20 63 6f 6e 76 65 6e 74 | ............(line.133).*.convent |
| 160f20 | 69 6f 6e 61 6c 20 69 6e 74 65 72 66 61 63 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ional.interfaces:............... |
| 160f40 | 32 2d 32 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 31 29 0a | 2-2-3................(line..11). |
| 160f60 | 2a 20 63 75 72 72 65 6e 74 20 74 69 6d 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | *.current.time:................. |
| 160f80 | 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........3-3-4................(l |
| 160fa0 | 69 6e 65 20 34 39 31 29 0a 2a 20 64 61 74 61 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 | ine.491).*.data.<1>:............ |
| 160fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 | ..................2-1-3......... |
| 160fe0 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 33 29 0a 2a 20 64 61 74 61 3a 20 20 20 20 20 20 20 | .......(line..13).*.data:....... |
| 161000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 | ...........................Chapt |
| 161020 | 65 72 20 31 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 30 29 0a 2a 20 64 61 74 | er.1............(line..20).*.dat |
| 161040 | 61 20 61 62 73 74 72 61 63 74 69 6f 6e 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | a.abstraction.<1>:.............. |
| 161060 | 20 20 20 20 43 68 61 70 74 65 72 20 32 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 | ....Chapter.2............(line.. |
| 161080 | 37 35 29 0a 2a 20 64 61 74 61 20 61 62 73 74 72 61 63 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 | 75).*.data.abstraction:......... |
| 1610a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............2-1................ |
| 1610c0 | 20 20 28 6c 69 6e 65 20 20 31 35 29 0a 2a 20 64 61 74 61 20 70 61 74 68 73 3a 20 20 20 20 20 20 | ..(line..15).*.data.paths:...... |
| 1610e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 31 2e 20 20 20 20 20 20 | ......................5-1....... |
| 161100 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 36 29 0a 2a 20 64 61 74 61 2d 64 69 72 | ...........(line...6).*.data-dir |
| 161120 | 65 63 74 65 64 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 | ected.<1>:.....................C |
| 161140 | 68 61 70 74 65 72 20 32 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 35 36 29 0a 2a | hapter.2............(line.156).* |
| 161160 | 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 20 3c 32 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .data-directed.<2>:............. |
| 161180 | 20 20 20 20 20 20 20 20 32 2d 34 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........2-4-3................(li |
| 1611a0 | 6e 65 20 20 34 32 29 0a 2a 20 64 61 74 61 2d 64 69 72 65 63 74 65 64 3a 20 20 20 20 20 20 20 20 | ne..42).*.data-directed:........ |
| 1611c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 | .................2-4............ |
| 1611e0 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 36 31 29 0a 2a 20 64 65 61 64 6c 6f 63 6b 3a 20 20 20 20 | ......(line..61).*.deadlock:.... |
| 161200 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 2d 32 2e | ..........................3-4-2. |
| 161220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 39 37 29 0a 2a 20 64 65 61 64 | ...............(line.497).*.dead |
| 161240 | 6c 6f 63 6b 2d 72 65 63 6f 76 65 72 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | lock-recovery:.................. |
| 161260 | 20 20 20 33 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 36 34 | ...3-4-2................(line.64 |
| 161280 | 36 29 0a 2a 20 64 65 62 75 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 6).*.debug:..................... |
| 1612a0 | 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 31 2e 20 20 20 20 20 20 20 20 20 20 | ............Chapter.1........... |
| 1612c0 | 20 28 6c 69 6e 65 20 20 35 33 29 0a 2a 20 64 65 65 70 20 62 69 6e 64 69 6e 67 3a 20 20 20 20 20 | .(line..53).*.deep.binding:..... |
| 1612e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 33 2e 20 20 20 20 20 | .....................4-1-3...... |
| 161300 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 32 37 29 0a 2a 20 64 65 66 65 72 72 65 64 3a | ..........(line.227).*.deferred: |
| 161320 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d | ..............................1- |
| 161340 | 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 39 36 29 0a 2a 20 | 2-1................(line..96).*. |
| 161360 | 64 65 6c 61 79 65 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | delayed:........................ |
| 161380 | 20 20 20 20 20 20 20 33 2d 35 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......3-5-1................(lin |
| 1613a0 | 65 20 31 33 37 29 0a 2a 20 64 65 6c 61 79 65 64 20 61 72 67 75 6d 65 6e 74 3a 20 20 20 20 20 20 | e.137).*.delayed.argument:...... |
| 1613c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 34 2e 20 20 20 20 20 20 20 20 20 20 | ................3-5-4........... |
| 1613e0 | 20 20 20 20 20 28 6c 69 6e 65 20 20 37 33 29 0a 2a 20 64 65 6c 61 79 65 64 20 65 76 61 6c 75 61 | .....(line..73).*.delayed.evalua |
| 161400 | 74 69 6f 6e 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 | tion.<1>:................Chapter |
| 161420 | 20 33 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 36 34 29 0a 2a 20 64 65 6c 61 79 | .3............(line..64).*.delay |
| 161440 | 65 64 20 65 76 61 6c 75 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ed.evaluation:.................. |
| 161460 | 20 20 33 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 30 | ..3-5..................(line..40 |
| 161480 | 29 0a 2a 20 64 65 6e 73 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.dense:...................... |
| 1614a0 | 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........2-5-3................ |
| 1614c0 | 28 6c 69 6e 65 20 32 35 32 29 0a 2a 20 64 65 70 65 6e 64 65 6e 63 79 2d 64 69 72 65 63 74 65 64 | (line.252).*.dependency-directed |
| 1614e0 | 20 62 61 63 6b 74 72 61 63 6b 69 6e 67 3a 20 20 20 20 20 20 34 2d 33 2d 31 2e 20 20 20 20 20 20 | .backtracking:......4-3-1....... |
| 161500 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 31 35 29 0a 2a 20 64 65 70 74 68 2d 66 69 72 73 | .........(line.215).*.depth-firs |
| 161520 | 74 20 73 65 61 72 63 68 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 33 | t.search:....................4-3 |
| 161540 | 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 38 36 29 0a 2a 20 64 | -1................(line..86).*.d |
| 161560 | 65 71 75 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | eque:........................... |
| 161580 | 20 20 20 20 20 20 33 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......3-3-2................(line |
| 1615a0 | 20 32 35 33 29 0a 2a 20 64 65 72 69 76 65 64 20 65 78 70 72 65 73 73 69 6f 6e 73 3a 20 20 20 20 | .253).*.derived.expressions:.... |
| 1615c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............4-1-2............ |
| 1615e0 | 20 20 20 20 28 6c 69 6e 65 20 32 33 30 29 0a 2a 20 64 69 67 69 74 61 6c 20 73 69 67 6e 61 6c 73 | ....(line.230).*.digital.signals |
| 161600 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 20 | :.......................3-3-4... |
| 161620 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 39 29 0a 2a 20 64 69 73 70 61 74 | .............(line..19).*.dispat |
| 161640 | 63 68 69 6e 67 20 6f 6e 20 74 79 70 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ching.on.type:.................. |
| 161660 | 20 32 2d 34 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 37 29 | .2-4-3................(line...7) |
| 161680 | 0a 2a 20 64 69 73 70 6c 61 63 65 6d 65 6e 74 20 6e 75 6d 62 65 72 3a 20 20 20 20 20 20 20 20 20 | .*.displacement.number:......... |
| 1616a0 | 20 20 20 20 20 20 20 20 20 20 35 2d 35 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........5-5-6................( |
| 1616c0 | 6c 69 6e 65 20 20 34 39 29 0a 2a 20 64 6f 74 74 65 64 2d 74 61 69 6c 3a 20 20 20 20 20 20 20 20 | line..49).*.dotted-tail:........ |
| 1616e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2d 31 2e 20 20 20 20 20 20 20 | ...................2-2-1........ |
| 161700 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 33 39 29 0a 2a 20 64 72 69 76 65 72 20 6c 6f 6f 70 | ........(line.239).*.driver.loop |
| 161720 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d | :...........................4-1- |
| 161740 | 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 37 37 29 0a 2a 20 65 6d | 4................(line..77).*.em |
| 161760 | 70 74 79 20 6c 69 73 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | pty.list:....................... |
| 161780 | 20 20 20 20 20 32 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....2-2-1................(line. |
| 1617a0 | 20 39 30 29 0a 2a 20 65 6e 63 61 70 73 75 6c 61 74 65 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 | .90).*.encapsulated:............ |
| 1617c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............3-1-1............. |
| 1617e0 | 20 20 20 28 6c 69 6e 65 20 33 30 30 29 0a 2a 20 65 6e 63 6c 6f 73 69 6e 67 3a 20 20 20 20 20 20 | ...(line.300).*.enclosing:...... |
| 161800 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 32 2e 20 20 20 20 20 | .......................3-2...... |
| 161820 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 36 29 0a 2a 20 65 6e 74 72 79 20 70 | ............(line..26).*.entry.p |
| 161840 | 6f 69 6e 74 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | oints:.......................... |
| 161860 | 35 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 33 29 0a | 5-1-1................(line..23). |
| 161880 | 2a 20 65 6e 75 6d 65 72 61 74 6f 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | *.enumerator:................... |
| 1618a0 | 20 20 20 20 20 20 20 20 20 32 2d 32 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........2-2-3................(l |
| 1618c0 | 69 6e 65 20 20 37 31 29 0a 2a 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 3a 20 20 20 20 20 20 20 20 20 | ine..71).*.environment:......... |
| 1618e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 32 2e 20 20 20 20 20 20 20 20 | ..................1-1-2......... |
| 161900 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 35 29 0a 2a 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 | .......(line..55).*.environment. |
| 161920 | 6d 6f 64 65 6c 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 | model:.....................Chapt |
| 161940 | 65 72 20 33 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 36 29 0a 2a 20 65 6e 76 | er.3............(line..56).*.env |
| 161960 | 69 72 6f 6e 6d 65 6e 74 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ironments:...................... |
| 161980 | 20 20 20 20 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 | ....3-2..................(line.. |
| 1619a0 | 32 31 29 0a 2a 20 45 75 63 6c 69 64 27 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 21).*.Euclid's:................. |
| 1619c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............1-2-5.............. |
| 1619e0 | 20 20 28 6c 69 6e 65 20 20 33 38 29 0a 2a 20 45 75 63 6c 69 64 65 61 6e 20 72 69 6e 67 3a 20 20 | ..(line..38).*.Euclidean.ring:.. |
| 161a00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 2e 20 20 20 20 | ......................2-5-3..... |
| 161a20 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 36 38 34 29 0a 2a 20 65 76 61 6c 75 61 74 69 | ...........(line.684).*.evaluati |
| 161a40 | 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 | ng:............................1 |
| 161a60 | 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 39 29 0a 2a | -1-1................(line...9).* |
| 161a80 | 20 65 76 61 6c 75 61 74 6f 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .evaluator:..................... |
| 161aa0 | 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 34 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........Chapter.4............(li |
| 161ac0 | 6e 65 20 20 35 36 29 0a 2a 20 65 76 65 6e 74 2d 64 72 69 76 65 6e 20 73 69 6d 75 6c 61 74 69 6f | ne..56).*.event-driven.simulatio |
| 161ae0 | 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 | n:...............3-3-4.......... |
| 161b00 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 33 29 0a 2a 20 65 76 6c 69 73 20 74 61 69 6c 20 72 65 | ......(line..13).*.evlis.tail.re |
| 161b20 | 63 75 72 73 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 34 2d 31 2e | cursion:..................5-4-1. |
| 161b40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 38 38 29 0a 2a 20 65 78 65 63 | ...............(line.288).*.exec |
| 161b60 | 75 74 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ution.procedure:................ |
| 161b80 | 20 20 20 34 2d 31 2d 37 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 | ...4-1-7................(line..3 |
| 161ba0 | 30 29 0a 2a 20 65 78 70 6c 69 63 69 74 2d 63 6f 6e 74 72 6f 6c 20 65 76 61 6c 75 61 74 6f 72 3a | 0).*.explicit-control.evaluator: |
| 161bc0 | 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............5-4................. |
| 161be0 | 20 28 6c 69 6e 65 20 20 31 31 29 0a 2a 20 65 78 70 72 65 73 73 69 6f 6e 3a 20 20 20 20 20 20 20 | .(line..11).*.expression:....... |
| 161c00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 31 2e 20 20 20 20 20 | .....................1-1-1...... |
| 161c20 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 38 29 0a 2a 20 66 61 69 6c 75 72 65 20 63 | ..........(line...8).*.failure.c |
| 161c40 | 6f 6e 74 69 6e 75 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d | ontinuation:..................4- |
| 161c60 | 33 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 31 29 0a 2a 20 | 3-3................(line..31).*. |
| 161c80 | 46 49 46 4f 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | FIFO:........................... |
| 161ca0 | 20 20 20 20 20 20 20 33 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......3-3-2................(lin |
| 161cc0 | 65 20 20 31 37 29 0a 2a 20 66 69 6c 74 65 72 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 | e..17).*.filter.<1>:............ |
| 161ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2d 33 2e 20 20 20 20 20 20 20 20 20 20 | ................2-2-3........... |
| 161d00 | 20 20 20 20 20 28 6c 69 6e 65 20 20 37 33 29 0a 2a 20 66 69 6c 74 65 72 3a 20 20 20 20 20 20 20 | .....(line..73).*.filter:....... |
| 161d20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d 31 2e 20 | .........................1-3-1.. |
| 161d40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 31 38 29 0a 2a 20 66 69 72 73 74 | ..............(line.218).*.first |
| 161d60 | 2d 63 6c 61 73 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -class:......................... |
| 161d80 | 20 20 31 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 30 30 | ..1-3-4................(line.200 |
| 161da0 | 29 0a 2a 20 66 69 78 65 64 20 70 6f 69 6e 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.fixed.point:................ |
| 161dc0 | 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........1-3-3................ |
| 161de0 | 28 6c 69 6e 65 20 31 30 32 29 0a 2a 20 66 69 78 65 64 2d 6c 65 6e 67 74 68 3a 20 20 20 20 20 20 | (line.102).*.fixed-length:...... |
| 161e00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 33 2d 34 2e 20 20 20 20 20 20 | ....................2-3-4....... |
| 161e20 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 38 29 0a 2a 20 66 6f 72 63 69 6e 67 3a 20 20 | .........(line..28).*.forcing:.. |
| 161e40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 32 | .............................4-2 |
| 161e60 | 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 32 29 0a 2a 20 66 | -2................(line..22).*.f |
| 161e80 | 6f 72 77 61 72 64 69 6e 67 20 61 64 64 72 65 73 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | orwarding.address:.............. |
| 161ea0 | 20 20 20 20 20 20 35 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......5-3-2................(line |
| 161ec0 | 20 31 32 36 29 0a 2a 20 66 72 61 6d 65 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .126).*.frame.<1>:.............. |
| 161ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............4-4-2............ |
| 161f00 | 20 20 20 20 28 6c 69 6e 65 20 20 34 37 29 0a 2a 20 66 72 61 6d 65 3a 20 20 20 20 20 20 20 20 20 | ....(line..47).*.frame:......... |
| 161f20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 35 2d 36 2e 20 20 | ........................5-5-6... |
| 161f40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 38 29 0a 2a 20 66 72 61 6d 65 20 | .............(line..48).*.frame. |
| 161f60 | 63 6f 6f 72 64 69 6e 61 74 65 20 6d 61 70 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | coordinate.map:................. |
| 161f80 | 20 32 2d 32 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 36 35 29 | .2-2-4................(line.265) |
| 161fa0 | 0a 2a 20 66 72 61 6d 65 64 2d 73 74 61 63 6b 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.framed-stack:................ |
| 161fc0 | 20 20 20 20 20 20 20 20 20 20 35 2d 34 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........5-4-1................( |
| 161fe0 | 6c 69 6e 65 20 32 36 36 29 0a 2a 20 66 72 61 6d 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | line.266).*.frames:............. |
| 162000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 32 2e 20 20 20 20 20 20 20 20 20 | ...................3-2.......... |
| 162020 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 33 29 0a 2a 20 66 72 65 65 3a 20 20 20 20 20 20 | ........(line..23).*.free:...... |
| 162040 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d | ............................1-1- |
| 162060 | 38 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 31 32 29 0a 2a 20 66 72 | 8................(line.112).*.fr |
| 162080 | 65 65 20 6c 69 73 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ee.list:........................ |
| 1620a0 | 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....5-3-1................(line. |
| 1620c0 | 32 39 30 29 0a 2a 20 66 72 6f 6e 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 290).*.front:................... |
| 1620e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............3-3-2............. |
| 162100 | 20 20 20 28 6c 69 6e 65 20 20 31 33 29 0a 2a 20 66 75 6c 6c 2d 61 64 64 65 72 3a 20 20 20 20 20 | ...(line..13).*.full-adder:..... |
| 162120 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 20 20 | .......................3-3-4.... |
| 162140 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 32 37 29 0a 2a 20 66 75 6e 63 74 69 6f | ............(line.127).*.functio |
| 162160 | 6e 20 62 6f 78 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | n.boxes:........................ |
| 162180 | 33 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 31 29 0a | 3-3-4................(line..21). |
| 1621a0 | 2a 20 66 75 6e 63 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e 67 3a 20 20 20 20 20 20 20 | *.functional.programming:....... |
| 1621c0 | 20 20 20 20 20 20 20 20 20 33 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........3-1-3................(l |
| 1621e0 | 69 6e 65 20 20 31 38 29 0a 2a 20 66 75 6e 63 74 69 6f 6e 61 6c 20 70 72 6f 67 72 61 6d 6d 69 6e | ine..18).*.functional.programmin |
| 162200 | 67 20 6c 61 6e 67 75 61 67 65 73 3a 20 20 20 20 20 20 33 2d 35 2d 35 2e 20 20 20 20 20 20 20 20 | g.languages:......3-5-5......... |
| 162220 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 37 32 29 0a 2a 20 67 61 72 62 61 67 65 3a 20 20 20 20 | .......(line.172).*.garbage:.... |
| 162240 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 32 | ...........................5-3-2 |
| 162260 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 32 29 0a 2a 20 67 61 72 | ................(line..12).*.gar |
| 162280 | 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 | bage.collection.<1>:............ |
| 1622a0 | 20 20 20 20 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 | ....5-3..................(line.. |
| 1622c0 | 33 35 29 0a 2a 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 69 6f 6e 3a 20 20 20 20 20 20 20 | 35).*.garbage.collection:....... |
| 1622e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............5-3-2.............. |
| 162300 | 20 20 28 6c 69 6e 65 20 20 32 37 29 0a 2a 20 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 6f 72 | ..(line..27).*.garbage.collector |
| 162320 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 31 2e 20 20 20 20 | :.....................3-3-1..... |
| 162340 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 35 34 29 0a 2a 20 67 61 72 62 61 67 65 2d | ...........(line.454).*.garbage- |
| 162360 | 63 6f 6c 6c 65 63 74 65 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 | collected:.....................4 |
| 162380 | 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 39 38 29 0a 2a | -2-2................(line.398).* |
| 1623a0 | 20 67 65 6e 65 72 69 63 20 6f 70 65 72 61 74 69 6f 6e 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 | .generic.operations:............ |
| 1623c0 | 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 32 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........Chapter.2............(li |
| 1623e0 | 6e 65 20 31 35 32 29 0a 2a 20 67 65 6e 65 72 69 63 20 70 72 6f 63 65 64 75 72 65 73 20 3c 31 3e | ne.152).*.generic.procedures.<1> |
| 162400 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 | :................2-3-4.......... |
| 162420 | 20 20 20 20 20 20 28 6c 69 6e 65 20 32 32 30 29 0a 2a 20 67 65 6e 65 72 69 63 20 70 72 6f 63 65 | ......(line.220).*.generic.proce |
| 162440 | 64 75 72 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 34 2e 20 20 | dures:....................2-4... |
| 162460 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 36 29 0a 2a 20 67 6c 69 74 | ...............(line..56).*.glit |
| 162480 | 63 68 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ches:........................... |
| 1624a0 | 20 20 20 43 68 61 70 74 65 72 20 31 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 | ...Chapter.1............(line..3 |
| 1624c0 | 38 29 0a 2a 20 67 6c 6f 62 61 6c 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 8).*.global.<1>:................ |
| 1624e0 | 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............3-2................. |
| 162500 | 20 28 6c 69 6e 65 20 20 32 38 29 0a 2a 20 67 6c 6f 62 61 6c 3a 20 20 20 20 20 20 20 20 20 20 20 | .(line..28).*.global:........... |
| 162520 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2e 20 20 20 20 20 20 20 | .....................1-2........ |
| 162540 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 35 29 0a 2a 20 67 6c 6f 62 61 6c 20 65 6e | ..........(line..35).*.global.en |
| 162560 | 76 69 72 6f 6e 6d 65 6e 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d | vironment:....................1- |
| 162580 | 31 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 35 29 0a 2a 20 | 1-2................(line..55).*. |
| 1625a0 | 67 6f 6c 64 65 6e 20 72 61 74 69 6f 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | golden.ratio:................... |
| 1625c0 | 20 20 20 20 20 20 20 31 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......1-2-2................(lin |
| 1625e0 | 65 20 20 37 30 29 0a 2a 20 67 72 61 6d 6d 61 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e..70).*.grammar:............... |
| 162600 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 | ................4-3-2........... |
| 162620 | 20 20 20 20 20 28 6c 69 6e 65 20 31 34 38 29 0a 2a 20 68 61 6c 66 2d 61 64 64 65 72 3a 20 20 20 | .....(line.148).*.half-adder:... |
| 162640 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 | .........................3-3-4.. |
| 162660 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 32 29 0a 2a 20 68 61 6c 66 2d | ..............(line..52).*.half- |
| 162680 | 69 6e 74 65 72 76 61 6c 20 6d 65 74 68 6f 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | interval.method:................ |
| 1626a0 | 20 20 31 2d 33 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 30 | ..1-3-3................(line..20 |
| 1626c0 | 29 0a 2a 20 48 61 6c 74 69 6e 67 20 54 68 65 6f 72 65 6d 3a 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.Halting.Theorem:............ |
| 1626e0 | 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........4-1-5................ |
| 162700 | 28 6c 69 6e 65 20 31 38 35 29 0a 2a 20 68 65 61 64 65 64 20 6c 69 73 74 3a 20 20 20 20 20 20 20 | (line.185).*.headed.list:....... |
| 162720 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 33 2e 20 20 20 20 20 20 | ....................3-3-3....... |
| 162740 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 31 29 0a 2a 20 68 69 64 69 6e 67 20 70 72 69 | .........(line..21).*.hiding.pri |
| 162760 | 6e 63 69 70 6c 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 31 | nciple:......................3-1 |
| 162780 | 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 30 31 29 0a 2a 20 68 | -1................(line.301).*.h |
| 1627a0 | 69 65 72 61 72 63 68 69 63 61 6c 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ierarchical:.................... |
| 1627c0 | 20 20 20 20 20 20 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......2-2..................(line |
| 1627e0 | 20 20 36 30 29 0a 2a 20 68 69 65 72 61 72 63 68 79 20 6f 66 20 74 79 70 65 73 3a 20 20 20 20 20 | ..60).*.hierarchy.of.types:..... |
| 162800 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............2-5-2............ |
| 162820 | 20 20 20 20 28 6c 69 6e 65 20 31 35 39 29 0a 2a 20 68 69 67 68 65 72 2d 6f 72 64 65 72 20 70 72 | ....(line.159).*.higher-order.pr |
| 162840 | 6f 63 65 64 75 72 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2e 20 20 20 20 | ocedures:...............1-3..... |
| 162860 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 39 29 0a 2a 20 48 6f 72 6e 65 72 | .............(line..39).*.Horner |
| 162880 | 27 73 20 72 75 6c 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 's.rule:........................ |
| 1628a0 | 20 32 2d 32 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 38 35 29 | .2-2-3................(line.285) |
| 1628c0 | 0a 2a 20 69 6d 70 65 72 61 74 69 76 65 20 70 72 6f 67 72 61 6d 6d 69 6e 67 3a 20 20 20 20 20 20 | .*.imperative.programming:...... |
| 1628e0 | 20 20 20 20 20 20 20 20 20 20 33 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........3-1-3................( |
| 162900 | 6c 69 6e 65 20 32 32 33 29 0a 2a 20 69 6e 64 65 74 65 72 6d 69 6e 61 74 65 73 3a 20 20 20 20 20 | line.223).*.indeterminates:..... |
| 162920 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 2e 20 20 20 20 20 20 20 | ...................2-5-3........ |
| 162940 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 39 29 0a 2a 20 69 6e 64 65 78 3a 20 20 20 20 20 | ........(line..39).*.index:..... |
| 162960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d | ............................5-3- |
| 162980 | 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 36 29 0a 2a 20 69 6e | 1................(line..36).*.in |
| 1629a0 | 64 65 78 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | dexing:......................... |
| 1629c0 | 20 20 20 20 20 34 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....4-4-2................(line. |
| 1629e0 | 34 32 31 29 0a 2a 20 69 6e 73 74 61 6e 74 69 61 74 65 64 20 77 69 74 68 3a 20 20 20 20 20 20 20 | 421).*.instantiated.with:....... |
| 162a00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............4-4-1............. |
| 162a20 | 20 20 20 28 6c 69 6e 65 20 32 30 32 29 0a 2a 20 69 6e 73 74 72 75 63 74 69 6f 6e 3a 20 20 20 20 | ...(line.202).*.instruction:.... |
| 162a40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 32 2d 34 2e 20 20 20 | .......................5-2-4.... |
| 162a60 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 38 30 29 0a 2a 20 69 6e 73 74 72 75 63 | ............(line..80).*.instruc |
| 162a80 | 74 69 6f 6e 20 65 78 65 63 75 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tion.execution:................. |
| 162aa0 | 35 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 31 39 29 0a | 5-2-1................(line.119). |
| 162ac0 | 2a 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 71 75 65 6e 63 65 3a 20 20 20 20 20 20 20 20 20 | *.instruction.sequence:......... |
| 162ae0 | 20 20 20 20 20 20 20 20 20 35 2d 35 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........5-5-1................(l |
| 162b00 | 69 6e 65 20 20 38 38 29 0a 2a 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 74 72 61 63 69 6e 67 3a 20 | ine..88).*.instruction.tracing:. |
| 162b20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 32 2d 34 2e 20 20 20 20 20 20 20 20 | ..................5-2-4......... |
| 162b40 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 38 36 29 0a 2a 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 | .......(line..86).*.instructions |
| 162b60 | 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 | .<1>:......................Chapt |
| 162b80 | 65 72 20 35 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 37 29 0a 2a 20 69 6e 73 | er.5............(line..37).*.ins |
| 162ba0 | 74 72 75 63 74 69 6f 6e 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tructions:...................... |
| 162bc0 | 20 20 20 20 35 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 | ....5-1-1................(line.. |
| 162be0 | 32 32 29 0a 2a 20 69 6e 74 65 67 65 72 69 7a 69 6e 67 20 66 61 63 74 6f 72 3a 20 20 20 20 20 20 | 22).*.integerizing.factor:...... |
| 162c00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............2-5-3.............. |
| 162c20 | 20 20 28 6c 69 6e 65 20 35 33 34 29 0a 2a 20 69 6e 74 65 67 65 72 73 3a 20 20 20 20 20 20 20 20 | ..(line.534).*.integers:........ |
| 162c40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2e 20 20 20 20 20 20 | ......................1-1....... |
| 162c60 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 34 29 0a 2a 20 69 6e 74 65 67 72 61 74 | ...........(line..54).*.integrat |
| 162c80 | 6f 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 | or:............................3 |
| 162ca0 | 2d 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 32 31 29 0a 2a | -5-3................(line.421).* |
| 162cc0 | 20 69 6e 74 65 72 6e 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .interning:..................... |
| 162ce0 | 20 20 20 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........5-3-1................(li |
| 162d00 | 6e 65 20 31 31 37 29 0a 2a 20 69 6e 74 65 72 70 72 65 74 65 72 20 3c 31 3e 3a 20 20 20 20 20 20 | ne.117).*.interpreter.<1>:...... |
| 162d20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 31 2e 20 20 20 20 20 | .................Chapter.1...... |
| 162d40 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 37 34 29 0a 2a 20 69 6e 74 65 72 70 72 65 74 65 72 3a 20 | ......(line..74).*.interpreter:. |
| 162d60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 | ..........................Chapte |
| 162d80 | 72 20 34 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 36 29 0a 2a 20 69 6e 76 61 | r.4............(line..56).*.inva |
| 162da0 | 72 69 61 6e 74 20 71 75 61 6e 74 69 74 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | riant.quantity:................. |
| 162dc0 | 20 20 20 31 2d 32 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 39 | ...1-2-4................(line..9 |
| 162de0 | 35 29 0a 2a 20 69 6e 76 65 72 74 65 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 5).*.inverter:.................. |
| 162e00 | 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............3-3-4............... |
| 162e20 | 20 28 6c 69 6e 65 20 20 32 35 29 0a 2a 20 69 74 65 72 61 74 69 76 65 20 69 6d 70 72 6f 76 65 6d | .(line..25).*.iterative.improvem |
| 162e40 | 65 6e 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d 34 2e 20 20 20 20 20 | ent:.................1-3-4...... |
| 162e60 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 39 30 29 0a 2a 20 69 74 65 72 61 74 69 76 65 | ..........(line.290).*.iterative |
| 162e80 | 20 70 72 6f 63 65 73 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d | .process:.....................1- |
| 162ea0 | 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 31 30 29 0a 2a 20 | 2-1................(line.110).*. |
| 162ec0 | 6b 2d 74 65 72 6d 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | k-term:......................... |
| 162ee0 | 20 20 20 20 20 20 20 31 2d 33 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......1-3-3................(lin |
| 162f00 | 65 20 32 31 35 29 0a 2a 20 6b 65 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e.215).*.key:................... |
| 162f20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 33 2d 33 2e 20 20 20 20 20 20 20 20 20 20 | ................2-3-3........... |
| 162f40 | 20 20 20 20 20 28 6c 69 6e 65 20 33 38 39 29 0a 2a 20 6c 61 62 65 6c 73 3a 20 20 20 20 20 20 20 | .....(line.389).*.labels:....... |
| 162f60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 31 2d 31 2e 20 | .........................5-1-1.. |
| 162f80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 33 29 0a 2a 20 6c 61 7a 79 3a | ..............(line..23).*.lazy: |
| 162fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 162fc0 | 20 20 34 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 33 | ..4-2-1................(line..13 |
| 162fe0 | 29 0a 2a 20 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.lexical.address:............ |
| 163000 | 20 20 20 20 20 20 20 20 20 20 20 35 2d 35 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........5-5-6................ |
| 163020 | 28 6c 69 6e 65 20 20 34 38 29 0a 2a 20 6c 65 78 69 63 61 6c 20 61 64 64 72 65 73 73 69 6e 67 3a | (line..48).*.lexical.addressing: |
| 163040 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 33 2e 20 20 20 20 20 20 | ....................4-1-3....... |
| 163060 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 32 38 29 0a 2a 20 6c 65 78 69 63 61 6c 20 73 63 | .........(line.228).*.lexical.sc |
| 163080 | 6f 70 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 | oping:.......................1-1 |
| 1630a0 | 2d 38 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 39 32 29 0a 2a 20 6c | -8................(line.192).*.l |
| 1630c0 | 69 6e 65 61 72 20 69 74 65 72 61 74 69 76 65 20 70 72 6f 63 65 73 73 3a 20 20 20 20 20 20 20 20 | inear.iterative.process:........ |
| 1630e0 | 20 20 20 20 20 20 31 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......1-2-1................(line |
| 163100 | 20 31 31 37 29 0a 2a 20 6c 69 6e 65 61 72 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 | .117).*.linear.recursive.process |
| 163120 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 | :..............1-2-1............ |
| 163140 | 20 20 20 20 28 6c 69 6e 65 20 31 30 35 29 0a 2a 20 6c 69 6e 6b 61 67 65 20 64 65 73 63 72 69 70 | ....(line.105).*.linkage.descrip |
| 163160 | 74 6f 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 35 2d 31 2e 20 20 | tor:....................5-5-1... |
| 163180 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 32 29 0a 2a 20 6c 69 73 74 3a 20 | .............(line..52).*.list:. |
| 1631a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 1631c0 | 20 32 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 30 34 29 | .2-2-1................(line.404) |
| 1631e0 | 0a 2a 20 6c 69 73 74 20 73 74 72 75 63 74 75 72 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.list.structure:.............. |
| 163200 | 20 20 20 20 20 20 20 20 20 20 32 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........2-2-1................( |
| 163220 | 6c 69 6e 65 20 34 30 35 29 0a 2a 20 6c 69 73 74 2d 73 74 72 75 63 74 75 72 65 64 3a 20 20 20 20 | line.405).*.list-structured:.... |
| 163240 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 31 2d 31 2e 20 20 20 20 20 20 20 | ...................2-1-1........ |
| 163260 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 32 31 29 0a 2a 20 6c 69 73 74 2d 73 74 72 75 63 74 | ........(line.121).*.list-struct |
| 163280 | 75 72 65 64 20 6d 65 6d 6f 72 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2e | ured.memory:................5-3. |
| 1632a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 38 29 0a 2a 20 6c 6f | .................(line...8).*.lo |
| 1632c0 | 63 61 6c 20 65 76 6f 6c 75 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | cal.evolution:.................. |
| 1632e0 | 20 20 20 20 20 31 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....1-2..................(line. |
| 163300 | 20 33 32 29 0a 2a 20 6c 6f 63 61 6c 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 3a 20 20 20 | .32).*.local.state.variables:... |
| 163320 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..............3-1............... |
| 163340 | 20 20 20 28 6c 69 6e 65 20 20 32 39 29 0a 2a 20 6c 6f 63 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 | ...(line..29).*.location:....... |
| 163360 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 | .......................5-3-1.... |
| 163380 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 38 29 0a 2a 20 6c 6f 67 69 63 2d 70 | ............(line...8).*.logic-p |
| 1633a0 | 72 6f 67 72 61 6d 6d 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rogramming:..................... |
| 1633c0 | 43 68 61 70 74 65 72 20 34 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 32 39 29 0a | Chapter.4............(line.129). |
| 1633e0 | 2a 20 6c 6f 67 69 63 61 6c 20 61 6e 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | *.logical.and:.................. |
| 163400 | 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........3-3-4................(l |
| 163420 | 69 6e 65 20 20 33 33 29 0a 2a 20 6c 6f 67 69 63 61 6c 20 64 65 64 75 63 74 69 6f 6e 73 3a 20 20 | ine..33).*.logical.deductions:.. |
| 163440 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2d 31 2e 20 20 20 20 20 20 20 20 | ..................4-4-1......... |
| 163460 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 37 34 29 0a 2a 20 6c 6f 67 69 63 61 6c 20 6f 72 3a 20 | .......(line.474).*.logical.or:. |
| 163480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 | ...........................3-3-4 |
| 1634a0 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 37 29 0a 2a 20 6d 61 63 | ................(line..37).*.mac |
| 1634c0 | 68 69 6e 65 20 6c 61 6e 67 75 61 67 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | hine.language:.................. |
| 1634e0 | 20 20 20 20 35 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 | ....5-5..................(line.. |
| 163500 | 32 33 29 0a 2a 20 6d 61 63 72 6f 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 23).*.macro:.................... |
| 163520 | 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............4-1-2.............. |
| 163540 | 20 20 28 6c 69 6e 65 20 34 30 31 29 0a 2a 20 6d 61 70 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ..(line.401).*.map:............. |
| 163560 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2d 33 2e 20 20 20 20 | ......................2-2-3..... |
| 163580 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 37 34 29 0a 2a 20 6d 61 72 6b 2d 73 77 65 | ...........(line..74).*.mark-swe |
| 1635a0 | 65 70 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 | ep:............................5 |
| 1635c0 | 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 39 38 29 0a 2a | -3-2................(line.298).* |
| 1635e0 | 20 6d 65 61 6e 73 20 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 | .means.of.abstraction:.......... |
| 163600 | 20 20 20 20 20 20 20 20 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........1-1..................(li |
| 163620 | 6e 65 20 20 32 31 29 0a 2a 20 6d 65 61 6e 73 20 6f 66 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 3a 20 | ne..21).*.means.of.combination:. |
| 163640 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 | .................1-1............ |
| 163660 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 38 29 0a 2a 20 4d 65 6d 6f 69 7a 61 74 69 6f 6e 3a 20 | ......(line..18).*.Memoization:. |
| 163680 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 33 2e | ..........................3-3-3. |
| 1636a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 35 38 29 0a 2a 20 6d 65 6d 6f | ...............(line.258).*.memo |
| 1636c0 | 69 7a 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ization:........................ |
| 1636e0 | 20 20 20 31 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 34 | ...1-2-2................(line.24 |
| 163700 | 35 29 0a 2a 20 6d 65 6d 6f 69 7a 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 5).*.memoize:................... |
| 163720 | 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............4-2-2............... |
| 163740 | 20 28 6c 69 6e 65 20 20 32 37 29 0a 2a 20 6d 65 72 67 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 | .(line..27).*.merge:............ |
| 163760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 35 2e 20 20 20 20 20 | .....................3-5-5...... |
| 163780 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 30 36 29 0a 2a 20 6d 65 73 73 61 67 65 20 70 | ..........(line.206).*.message.p |
| 1637a0 | 61 73 73 69 6e 67 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d | assing.<1>:...................2- |
| 1637c0 | 34 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 35 39 29 0a 2a 20 | 4-3................(line.359).*. |
| 1637e0 | 6d 65 73 73 61 67 65 20 70 61 73 73 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | message.passing:................ |
| 163800 | 20 20 20 20 20 20 20 32 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......2-1-3................(lin |
| 163820 | 65 20 20 39 31 29 0a 2a 20 6d 65 73 73 61 67 65 2d 70 61 73 73 69 6e 67 3a 20 20 20 20 20 20 20 | e..91).*.message-passing:....... |
| 163840 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 | ................3-1-1........... |
| 163860 | 20 20 20 20 20 28 6c 69 6e 65 20 31 38 37 29 0a 2a 20 6d 65 74 61 63 69 72 63 75 6c 61 72 3a 20 | .....(line.187).*.metacircular:. |
| 163880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2e 20 20 20 | .........................4-1.... |
| 1638a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 32 29 0a 2a 20 4d 65 74 61 6c | ..............(line..12).*.Metal |
| 1638c0 | 69 6e 67 75 69 73 74 69 63 20 61 62 73 74 72 61 63 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 | inguistic.abstraction:.......... |
| 1638e0 | 20 20 43 68 61 70 74 65 72 20 34 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 32 | ..Chapter.4............(line..52 |
| 163900 | 29 0a 2a 20 4d 69 6c 6c 65 72 2d 52 61 62 69 6e 20 74 65 73 74 3a 20 20 20 20 20 20 20 20 20 20 | ).*.Miller-Rabin.test:.......... |
| 163920 | 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........1-2-6................ |
| 163940 | 28 6c 69 6e 65 20 32 35 33 29 0a 2a 20 6d 6f 64 75 6c 61 72 3a 20 20 20 20 20 20 20 20 20 20 20 | (line.253).*.modular:........... |
| 163960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 33 2e 20 20 | ....................Chapter.3... |
| 163980 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 34 29 0a 2a 20 6d 6f 64 75 6c 6f 3a 20 20 20 | .........(line..24).*.modulo:... |
| 1639a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 | .............................1-2 |
| 1639c0 | 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 39 29 0a 2a 20 6d | -6................(line..59).*.m |
| 1639e0 | 6f 64 75 73 20 70 6f 6e 65 6e 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | odus.ponens:.................... |
| 163a00 | 20 20 20 20 20 20 34 2d 34 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......4-4-3................(line |
| 163a20 | 20 32 35 37 29 0a 2a 20 6d 6f 6d 65 6e 74 73 20 69 6e 20 74 69 6d 65 3a 20 20 20 20 20 20 20 20 | .257).*.moments.in.time:........ |
| 163a40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...............3-4.............. |
| 163a60 | 20 20 20 20 28 6c 69 6e 65 20 20 33 30 29 0a 2a 20 4d 6f 6e 74 65 20 43 61 72 6c 6f 3a 20 20 20 | ....(line..30).*.Monte.Carlo:... |
| 163a80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 31 2d 32 2e 20 20 | ........................3-1-2... |
| 163aa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 33 29 0a 2a 20 4d 6f 6e 74 65 20 | .............(line..43).*.Monte. |
| 163ac0 | 43 61 72 6c 6f 20 69 6e 74 65 67 72 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | Carlo.integration:.............. |
| 163ae0 | 20 33 2d 31 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 34 30 29 | .3-1-2................(line.140) |
| 163b00 | 0a 2a 20 6d 75 74 61 62 6c 65 20 64 61 74 61 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.mutable.data:................ |
| 163b20 | 20 20 20 20 20 20 20 20 20 20 33 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........3-3..................( |
| 163b40 | 6c 69 6e 65 20 20 32 36 29 0a 2a 20 6d 75 74 61 74 6f 72 73 3a 20 20 20 20 20 20 20 20 20 20 20 | line..26).*.mutators:........... |
| 163b60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2e 20 20 20 20 20 20 20 20 20 | ...................3-3.......... |
| 163b80 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 38 29 0a 2a 20 6d 75 74 65 78 3a 20 20 20 20 20 | ........(line..18).*.mutex:..... |
| 163ba0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 2d | ............................3-4- |
| 163bc0 | 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 38 37 29 0a 2a 20 6d 75 | 2................(line.387).*.mu |
| 163be0 | 74 75 61 6c 20 65 78 63 6c 75 73 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tual.exclusion:................. |
| 163c00 | 20 20 20 20 20 33 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....3-4-2................(line. |
| 163c20 | 35 39 33 29 0a 2a 20 6e 2d 66 6f 6c 64 20 73 6d 6f 6f 74 68 65 64 20 66 75 6e 63 74 69 6f 6e 3a | 593).*.n-fold.smoothed.function: |
| 163c40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............1-3-4............. |
| 163c60 | 20 20 20 28 6c 69 6e 65 20 32 36 37 29 0a 2a 20 6e 61 74 69 76 65 20 6c 61 6e 67 75 61 67 65 3a | ...(line.267).*.native.language: |
| 163c80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 35 2e 20 20 20 20 20 | .......................5-5...... |
| 163ca0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 32 29 0a 2a 20 6e 65 65 64 65 64 3a | ............(line..22).*.needed: |
| 163cc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 163ce0 | 35 2d 35 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 36 32 29 0a | 5-5-1................(line.162). |
| 163d00 | 2a 20 6e 65 74 77 6f 72 6b 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | *.networks:..................... |
| 163d20 | 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 34 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........Chapter.4............(l |
| 163d40 | 69 6e 65 20 31 34 37 29 0a 2a 20 4e 65 77 74 6f 6e 27 73 20 6d 65 74 68 6f 64 3a 20 20 20 20 20 | ine.147).*.Newton's.method:..... |
| 163d60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 | ..................1-3-4......... |
| 163d80 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 36 37 29 0a 2a 20 6e 69 6c 3a 20 20 20 20 20 20 20 20 | .......(line..67).*.nil:........ |
| 163da0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2d 31 | ...........................2-2-1 |
| 163dc0 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 39 30 29 0a 2a 20 6e 6f 6e | ................(line..90).*.non |
| 163de0 | 2d 63 6f 6d 70 75 74 61 62 6c 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | -computable:.................... |
| 163e00 | 20 20 20 20 34 2d 31 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 | ....4-1-5................(line.1 |
| 163e20 | 38 36 29 0a 2a 20 6e 6f 6e 2d 73 74 72 69 63 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 86).*.non-strict:............... |
| 163e40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............4-2-1.............. |
| 163e60 | 20 20 28 6c 69 6e 65 20 20 34 34 29 0a 2a 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 3a | ..(line..44).*.nondeterministic: |
| 163e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 2d 31 2e 20 20 20 20 | ......................3-4-1..... |
| 163ea0 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 33 37 29 0a 2a 20 6e 6f 6e 64 65 74 65 72 | ...........(line.237).*.nondeter |
| 163ec0 | 6d 69 6e 69 73 74 69 63 20 63 68 6f 69 63 65 20 70 6f 69 6e 74 3a 20 20 20 20 20 20 20 20 20 34 | ministic.choice.point:.........4 |
| 163ee0 | 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 39 29 0a 2a | -3-1................(line..59).* |
| 163f00 | 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 63 6f 6d 70 75 74 69 6e 67 20 3c 31 3e 3a | .nondeterministic.computing.<1>: |
| 163f20 | 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 34 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........Chapter.4............(li |
| 163f40 | 6e 65 20 31 32 30 29 0a 2a 20 6e 6f 6e 64 65 74 65 72 6d 69 6e 69 73 74 69 63 20 63 6f 6d 70 75 | ne.120).*.nondeterministic.compu |
| 163f60 | 74 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 | ting:............4-3............ |
| 163f80 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 37 29 0a 2a 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 3a | ......(line...7).*.normal-order: |
| 163fa0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 32 2d 31 2e | ..........................4-2-1. |
| 163fc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 39 29 0a 2a 20 6e 6f 72 6d | ...............(line...9).*.norm |
| 163fe0 | 61 6c 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 | al-order.evaluation.<1>:........ |
| 164000 | 20 20 20 31 2d 31 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 32 | ...1-1-5................(line.12 |
| 164020 | 35 29 0a 2a 20 6e 6f 72 6d 61 6c 2d 6f 72 64 65 72 20 65 76 61 6c 75 61 74 69 6f 6e 3a 20 20 20 | 5).*.normal-order.evaluation:... |
| 164040 | 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 34 2e 20 20 20 20 20 20 20 20 20 20 | ............Chapter.4........... |
| 164060 | 20 28 6c 69 6e 65 20 31 31 36 29 0a 2a 20 6f 62 61 72 72 61 79 3a 20 20 20 20 20 20 20 20 20 20 | .(line.116).*.obarray:.......... |
| 164080 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 20 | .....................5-3-1...... |
| 1640a0 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 30 39 29 0a 2a 20 6f 62 6a 65 63 74 20 70 72 | ..........(line.109).*.object.pr |
| 1640c0 | 6f 67 72 61 6d 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d | ogram:........................5- |
| 1640e0 | 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 37 29 0a 2a 20 | 5..................(line..47).*. |
| 164100 | 6f 62 6a 65 63 74 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | objects:........................ |
| 164120 | 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 33 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......Chapter.3............(lin |
| 164140 | 65 20 20 34 35 29 0a 2a 20 6f 70 65 6e 2d 63 6f 64 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | e..45).*.open-code:............. |
| 164160 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 35 2d 35 2e 20 20 20 20 20 20 20 20 20 20 | ................5-5-5........... |
| 164180 | 20 20 20 20 20 28 6c 69 6e 65 20 33 38 33 29 0a 2a 20 6f 70 65 72 61 6e 64 73 3a 20 20 20 20 20 | .....(line.383).*.operands:..... |
| 1641a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 31 2e 20 | .........................1-1-1.. |
| 1641c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 35 29 0a 2a 20 6f 70 65 72 61 | ..............(line..45).*.opera |
| 1641e0 | 74 6f 72 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tor.<1>:........................ |
| 164200 | 20 20 34 2d 31 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 30 32 | ..4-1-6................(line.302 |
| 164220 | 29 0a 2a 20 6f 70 65 72 61 74 6f 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.operator:................... |
| 164240 | 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........1-1-1................ |
| 164260 | 28 6c 69 6e 65 20 20 34 35 29 0a 2a 20 6f 72 2d 67 61 74 65 3a 20 20 20 20 20 20 20 20 20 20 20 | (line..45).*.or-gate:........... |
| 164280 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 20 20 20 20 20 | ....................3-3-4....... |
| 1642a0 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 35 29 0a 2a 20 6f 72 64 65 72 20 6f 66 20 67 | .........(line..35).*.order.of.g |
| 1642c0 | 72 6f 77 74 68 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 | rowth:.......................1-2 |
| 1642e0 | 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 38 29 0a 2a 20 6f | -3................(line...8).*.o |
| 164300 | 72 64 69 6e 61 72 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | rdinary:........................ |
| 164320 | 20 20 20 20 20 20 32 2d 35 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......2-5-1................(line |
| 164340 | 20 20 32 35 29 0a 2a 20 6f 75 74 70 75 74 20 70 72 6f 6d 70 74 3a 20 20 20 20 20 20 20 20 20 20 | ..25).*.output.prompt:.......... |
| 164360 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............4-1-4............ |
| 164380 | 20 20 20 20 28 6c 69 6e 65 20 20 38 31 29 0a 2a 20 70 61 63 6b 61 67 65 3a 20 20 20 20 20 20 20 | ....(line..81).*.package:....... |
| 1643a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 34 2d 33 2e 20 20 | ........................2-4-3... |
| 1643c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 39 37 29 0a 2a 20 70 61 69 6e 74 65 | .............(line..97).*.painte |
| 1643e0 | 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | r:.............................. |
| 164400 | 20 32 2d 32 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 31 29 | .2-2-4................(line..31) |
| 164420 | 0a 2a 20 70 61 69 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.pair:........................ |
| 164440 | 20 20 20 20 20 20 20 20 20 20 32 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........2-1-1................( |
| 164460 | 6c 69 6e 65 20 20 38 35 29 0a 2a 20 70 61 72 73 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | line..85).*.parse:.............. |
| 164480 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 33 2d 32 2e 20 20 20 20 20 20 20 | ...................4-3-2........ |
| 1644a0 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 33 35 29 0a 2a 20 50 61 73 63 61 6c 27 73 20 74 72 | ........(line.135).*.Pascal's.tr |
| 1644c0 | 69 61 6e 67 6c 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d | iangle:.....................1-2- |
| 1644e0 | 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 31 31 29 0a 2a 20 70 61 | 2................(line.211).*.pa |
| 164500 | 74 74 65 72 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ttern:.......................... |
| 164520 | 20 20 20 20 20 34 2d 34 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....4-4-1................(line. |
| 164540 | 31 32 34 29 0a 2a 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 65 72 3a 20 20 20 20 20 20 20 20 20 | 124).*.pattern.matcher:......... |
| 164560 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............4-4-2............. |
| 164580 | 20 20 20 28 6c 69 6e 65 20 20 33 37 29 0a 2a 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 69 6e 67 | ...(line..37).*.pattern.matching |
| 1645a0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2d 32 2e 20 20 20 | :......................4-4-2.... |
| 1645c0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 33 29 0a 2a 20 70 61 74 74 65 72 6e | ............(line..23).*.pattern |
| 1645e0 | 20 76 61 72 69 61 62 6c 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .variable:...................... |
| 164600 | 34 2d 34 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 32 38 29 0a | 4-4-1................(line.128). |
| 164620 | 2a 20 70 69 70 65 6c 69 6e 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | *.pipelining:................... |
| 164640 | 20 20 20 20 20 20 20 20 20 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........3-4..................(l |
| 164660 | 69 6e 65 20 20 37 33 29 0a 2a 20 70 6f 69 6e 74 65 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ine..73).*.pointer:............. |
| 164680 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 | ..................2-2........... |
| 1646a0 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 30 29 0a 2a 20 70 6f 6c 79 3a 20 20 20 20 20 20 20 | .......(line..10).*.poly:....... |
| 1646c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 | ...........................2-5-3 |
| 1646e0 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 37 37 29 0a 2a 20 70 6f 77 | ................(line..77).*.pow |
| 164700 | 65 72 20 73 65 72 69 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | er.series:...................... |
| 164720 | 20 20 20 20 33 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 | ....3-5-2................(line.2 |
| 164740 | 39 33 29 0a 2a 20 70 72 65 64 69 63 61 74 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 93).*.predicate:................ |
| 164760 | 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............1-1-6.............. |
| 164780 | 20 20 28 6c 69 6e 65 20 20 34 31 29 0a 2a 20 70 72 65 66 69 78 3a 20 20 20 20 20 20 20 20 20 20 | ..(line..41).*.prefix:.......... |
| 1647a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 33 2d 34 2e 20 20 20 20 | ......................2-3-4..... |
| 1647c0 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 36 29 0a 2a 20 70 72 65 66 69 78 20 63 | ...........(line..56).*.prefix.c |
| 1647e0 | 6f 64 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 | ode:...........................2 |
| 164800 | 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 37 29 0a 2a | -3-4................(line..57).* |
| 164820 | 20 70 72 65 66 69 78 20 6e 6f 74 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .prefix.notation:............... |
| 164840 | 20 20 20 20 20 20 20 20 31 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........1-1-1................(li |
| 164860 | 6e 65 20 20 35 31 29 0a 2a 20 70 72 65 74 74 79 2d 70 72 69 6e 74 69 6e 67 3a 20 20 20 20 20 20 | ne..51).*.pretty-printing:...... |
| 164880 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 | .................1-1-1.......... |
| 1648a0 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 38 39 29 0a 2a 20 70 72 69 6d 69 74 69 76 65 20 63 6f 6e | ......(line..89).*.primitive.con |
| 1648c0 | 73 74 72 61 69 6e 74 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 35 2e | straints:.................3-3-5. |
| 1648e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 37 29 0a 2a 20 70 72 69 6d | ...............(line..27).*.prim |
| 164900 | 69 74 69 76 65 20 65 78 70 72 65 73 73 69 6f 6e 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | itive.expressions:.............. |
| 164920 | 20 20 20 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 | ...1-1..................(line..1 |
| 164940 | 34 29 0a 2a 20 70 72 6f 62 61 62 69 6c 69 73 74 69 63 20 61 6c 67 6f 72 69 74 68 6d 73 3a 20 20 | 4).*.probabilistic.algorithms:.. |
| 164960 | 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 36 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............1-2-6............... |
| 164980 | 20 28 6c 69 6e 65 20 31 34 34 29 0a 2a 20 70 72 6f 63 65 64 75 72 61 6c 20 61 62 73 74 72 61 63 | .(line.144).*.procedural.abstrac |
| 1649a0 | 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 38 2e 20 20 20 20 20 | tion:................1-1-8...... |
| 1649c0 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 35 29 0a 2a 20 70 72 6f 63 65 64 75 72 61 | ..........(line..45).*.procedura |
| 1649e0 | 6c 20 65 70 69 73 74 65 6d 6f 6c 6f 67 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 50 72 | l.epistemology:...............Pr |
| 164a00 | 65 66 61 63 65 20 31 65 2e 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 36 36 29 0a 2a 20 | eface.1e...........(line..66).*. |
| 164a20 | 70 72 6f 63 65 64 75 72 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | procedure:...................... |
| 164a40 | 20 20 20 20 20 20 20 31 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......1-2-1................(lin |
| 164a60 | 65 20 31 33 32 29 0a 2a 20 70 72 6f 63 65 64 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 3a 20 | e.132).*.procedure.definitions:. |
| 164a80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 34 2e 20 20 20 20 20 20 20 20 20 20 | ................1-1-4........... |
| 164aa0 | 20 20 20 20 20 28 6c 69 6e 65 20 20 31 38 29 0a 2a 20 70 72 6f 63 65 64 75 72 65 73 3a 20 20 20 | .....(line..18).*.procedures:... |
| 164ac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 | .........................Chapter |
| 164ae0 | 20 31 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 31 39 29 0a 2a 20 70 72 6f 63 65 | .1............(line.119).*.proce |
| 164b00 | 73 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ss:............................. |
| 164b20 | 20 20 31 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 33 31 | ..1-2-1................(line.131 |
| 164b40 | 29 0a 2a 20 70 72 6f 67 72 61 6d 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.program:.................... |
| 164b60 | 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 31 2e 20 20 20 20 20 20 20 20 20 20 20 | ...........Chapter.1............ |
| 164b80 | 28 6c 69 6e 65 20 20 32 31 29 0a 2a 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 6c 61 6e 67 75 61 67 | (line..21).*.programming.languag |
| 164ba0 | 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 31 2e 20 20 | es:.................Chapter.1... |
| 164bc0 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 31 29 0a 2a 20 70 72 6f 6d 70 74 3a 20 20 20 | .........(line..31).*.prompt:... |
| 164be0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 | .............................4-1 |
| 164c00 | 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 37 39 29 0a 2a 20 70 | -4................(line..79).*.p |
| 164c20 | 73 65 75 64 6f 2d 72 61 6e 64 6f 6d 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | seudo-random:................... |
| 164c40 | 20 20 20 20 20 20 33 2d 31 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......3-1-2................(line |
| 164c60 | 20 32 30 30 29 0a 2a 20 70 73 65 75 64 6f 64 69 76 69 73 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 | .200).*.pseudodivision:......... |
| 164c80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............2-5-3............ |
| 164ca0 | 20 20 20 20 28 6c 69 6e 65 20 35 33 38 29 0a 2a 20 70 73 65 75 64 6f 72 65 6d 61 69 6e 64 65 72 | ....(line.538).*.pseudoremainder |
| 164cc0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 2e 20 20 | :.......................2-5-3... |
| 164ce0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 35 33 39 29 0a 2a 20 71 75 61 73 69 71 | .............(line.539).*.quasiq |
| 164d00 | 75 6f 74 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | uote:........................... |
| 164d20 | 20 35 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 37 39 29 | .5-5-2................(line.279) |
| 164d40 | 0a 2a 20 71 75 65 72 69 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.queries:..................... |
| 164d60 | 20 20 20 20 20 20 20 20 20 20 34 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........4-4..................( |
| 164d80 | 6c 69 6e 65 20 20 39 39 29 0a 2a 20 71 75 65 72 79 20 6c 61 6e 67 75 61 67 65 3a 20 20 20 20 20 | line..99).*.query.language:..... |
| 164da0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2e 20 20 20 20 20 20 20 20 20 | ...................4-4.......... |
| 164dc0 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 39 38 29 0a 2a 20 71 75 65 75 65 3a 20 20 20 20 20 | ........(line..98).*.queue:..... |
| 164de0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d | ............................3-3- |
| 164e00 | 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 32 29 0a 2a 20 71 75 | 2................(line..12).*.qu |
| 164e20 | 6f 74 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ote:............................ |
| 164e40 | 20 20 20 20 20 32 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....2-3-1................(line. |
| 164e60 | 20 32 30 29 0a 2a 20 52 61 6d 61 6e 75 6a 61 6e 20 6e 75 6d 62 65 72 73 3a 20 20 20 20 20 20 20 | .20).*.Ramanujan.numbers:....... |
| 164e80 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............3-5-3............. |
| 164ea0 | 20 20 20 28 6c 69 6e 65 20 33 39 38 29 0a 2a 20 72 61 74 69 6f 6e 61 6c 3a 20 20 20 20 20 20 20 | ...(line.398).*.rational:....... |
| 164ec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 2e 20 20 20 | .......................2-5-3.... |
| 164ee0 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 32 36 29 0a 2a 20 52 43 20 63 69 72 63 | ............(line.426).*.RC.circ |
| 164f00 | 75 69 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | uit:............................ |
| 164f20 | 33 2d 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 36 35 29 0a | 3-5-3................(line.465). |
| 164f40 | 2a 20 72 65 61 64 2d 65 76 61 6c 2d 70 72 69 6e 74 20 6c 6f 6f 70 3a 20 20 20 20 20 20 20 20 20 | *.read-eval-print.loop:......... |
| 164f60 | 20 20 20 20 20 20 20 20 20 31 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........1-1-1................(l |
| 164f80 | 69 6e 65 20 20 39 37 29 0a 2a 20 72 65 61 64 65 72 20 6d 61 63 72 6f 20 63 68 61 72 61 63 74 65 | ine..97).*.reader.macro.characte |
| 164fa0 | 72 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2d 34 2d 37 2e 20 20 20 20 20 20 | rs:...............4-4-4-7....... |
| 164fc0 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 32 38 29 0a 2a 20 72 65 61 6c 20 6e 75 6d 62 65 72 73 | .......(line.128).*.real.numbers |
| 164fe0 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2e 20 | :..........................1-1.. |
| 165000 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 35 29 0a 2a 20 72 65 61 | ................(line..55).*.rea |
| 165020 | 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | r:.............................. |
| 165040 | 20 20 20 20 33 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 | ....3-3-2................(line.. |
| 165060 | 31 33 29 0a 2a 20 52 65 63 75 72 73 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 13).*.Recursion:................ |
| 165080 | 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............4-1-5.............. |
| 1650a0 | 20 20 28 6c 69 6e 65 20 31 36 32 29 0a 2a 20 72 65 63 75 72 73 69 6f 6e 20 65 71 75 61 74 69 6f | ..(line.162).*.recursion.equatio |
| 1650c0 | 6e 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 31 2e | ns:...................Chapter.1. |
| 1650e0 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 36 38 29 0a 2a 20 72 65 63 75 72 73 69 76 | ...........(line..68).*.recursiv |
| 165100 | 65 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 | e.<1>:.........................1 |
| 165120 | 2d 31 2d 38 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 37 29 0a 2a | -1-8................(line...7).* |
| 165140 | 20 72 65 63 75 72 73 69 76 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .recursive:..................... |
| 165160 | 20 20 20 20 20 20 20 20 31 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........1-1-3................(li |
| 165180 | 6e 65 20 20 32 33 29 0a 2a 20 72 65 63 75 72 73 69 76 65 20 70 72 6f 63 65 73 73 3a 20 20 20 20 | ne..23).*.recursive.process:.... |
| 1651a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 | .................1-2-1.......... |
| 1651c0 | 20 20 20 20 20 20 28 6c 69 6e 65 20 31 30 30 29 0a 2a 20 72 65 64 2d 62 6c 61 63 6b 20 74 72 65 | ......(line.100).*.red-black.tre |
| 1651e0 | 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 33 2d 33 2e | es:.......................2-3-3. |
| 165200 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 35 39 29 0a 2a 20 72 65 66 65 | ...............(line.459).*.refe |
| 165220 | 72 65 6e 74 69 61 6c 6c 79 20 74 72 61 6e 73 70 61 72 65 6e 74 3a 20 20 20 20 20 20 20 20 20 20 | rentially.transparent:.......... |
| 165240 | 20 20 20 33 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 35 | ...3-1-3................(line.15 |
| 165260 | 36 29 0a 2a 20 72 65 67 69 73 74 65 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 6).*.register:.................. |
| 165280 | 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 35 2e 20 20 20 20 20 20 20 20 20 20 | ............Chapter.5........... |
| 1652a0 | 20 28 6c 69 6e 65 20 20 33 36 29 0a 2a 20 72 65 67 69 73 74 65 72 20 74 61 62 6c 65 3a 20 20 20 | .(line..36).*.register.table:... |
| 1652c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 32 2d 31 2e 20 20 20 20 20 | .....................5-2-1...... |
| 1652e0 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 30 35 29 0a 2a 20 72 65 67 69 73 74 65 72 73 | ..........(line.105).*.registers |
| 165300 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 | :.............................Ch |
| 165320 | 61 70 74 65 72 20 35 2e 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 38 29 0a 2a 20 | apter.5............(line..38).*. |
| 165340 | 72 65 6c 65 61 73 65 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | released:....................... |
| 165360 | 20 20 20 20 20 20 20 33 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......3-4-2................(lin |
| 165380 | 65 20 33 38 38 29 0a 2a 20 72 65 6d 61 69 6e 64 65 72 20 6f 66 3a 20 20 20 20 20 20 20 20 20 20 | e.388).*.remainder.of:.......... |
| 1653a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 36 2e 20 20 20 20 20 20 20 20 20 20 | ................1-2-6........... |
| 1653c0 | 20 20 20 20 20 28 6c 69 6e 65 20 20 35 38 29 0a 2a 20 72 65 73 6f 6c 75 74 69 6f 6e 3a 20 20 20 | .....(line..58).*.resolution:... |
| 1653e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2e 20 20 20 | .........................4-4.... |
| 165400 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 33 34 29 0a 2a 20 72 69 70 70 6c | ..............(line.134).*.rippl |
| 165420 | 65 2d 63 61 72 72 79 20 61 64 64 65 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e-carry.adder:.................. |
| 165440 | 20 20 33 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 33 38 | ..3-3-4................(line.238 |
| 165460 | 29 0a 2a 20 72 6f 62 75 73 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.robust:..................... |
| 165480 | 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........2-2-4................ |
| 1654a0 | 28 6c 69 6e 65 20 35 33 30 29 0a 2a 20 52 53 41 20 61 6c 67 6f 72 69 74 68 6d 3a 20 20 20 20 20 | (line.530).*.RSA.algorithm:..... |
| 1654c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 36 2e 20 20 20 20 20 20 | ....................1-2-6....... |
| 1654e0 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 32 32 29 0a 2a 20 72 75 6c 65 73 20 3c 31 3e 3a | .........(line.322).*.rules.<1>: |
| 165500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 | .............................4-4 |
| 165520 | 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 33 34 29 0a 2a 20 72 | -1................(line.334).*.r |
| 165540 | 75 6c 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ules:........................... |
| 165560 | 20 20 20 20 20 20 34 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......4-4..................(line |
| 165580 | 20 31 31 33 29 0a 2a 20 73 61 74 69 73 66 79 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .113).*.satisfy:................ |
| 1655a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............4-4-1............ |
| 1655c0 | 20 20 20 20 28 6c 69 6e 65 20 32 30 31 29 0a 2a 20 73 63 6f 70 65 3a 20 20 20 20 20 20 20 20 20 | ....(line.201).*.scope:......... |
| 1655e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 38 2e 20 20 | ........................1-1-8... |
| 165600 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 31 33 29 0a 2a 20 73 65 6c 65 63 74 | .............(line.113).*.select |
| 165620 | 6f 72 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ors:............................ |
| 165640 | 20 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 37 29 | .2-1..................(line..27) |
| 165660 | 0a 2a 20 73 65 6d 61 70 68 6f 72 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.semaphore:................... |
| 165680 | 20 20 20 20 20 20 20 20 20 20 33 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........3-4-2................( |
| 1656a0 | 6c 69 6e 65 20 35 39 36 29 0a 2a 20 73 65 70 61 72 61 74 6f 72 20 63 6f 64 65 3a 20 20 20 20 20 | line.596).*.separator.code:..... |
| 1656c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 33 2d 34 2e 20 20 20 20 20 20 20 | ...................2-3-4........ |
| 1656e0 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 33 29 0a 2a 20 73 65 71 75 65 6e 63 65 3a 20 20 | ........(line..53).*.sequence:.. |
| 165700 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2d | ............................2-2- |
| 165720 | 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 38 29 0a 2a 20 73 65 | 1................(line..18).*.se |
| 165740 | 71 75 65 6e 63 65 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | quence.accelerator:............. |
| 165760 | 20 20 20 20 20 33 2d 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....3-5-3................(line. |
| 165780 | 20 39 37 29 0a 2a 20 73 65 71 75 65 6e 63 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .97).*.sequences:............... |
| 1657a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............1-3-1............. |
| 1657c0 | 20 20 20 28 6c 69 6e 65 20 32 35 34 29 0a 2a 20 73 65 72 69 61 6c 69 7a 65 72 3a 20 20 20 20 20 | ...(line.254).*.serializer:..... |
| 1657e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 2d 32 2e 20 20 20 | .......................3-4-2.... |
| 165800 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 30 29 0a 2a 20 73 65 72 69 61 6c 69 | ............(line..30).*.seriali |
| 165820 | 7a 65 72 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | zers:........................... |
| 165840 | 33 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 39 31 29 0a | 3-4-2................(line..91). |
| 165860 | 2a 20 73 65 72 69 65 73 20 52 4c 43 20 63 69 72 63 75 69 74 3a 20 20 20 20 20 20 20 20 20 20 20 | *.series.RLC.circuit:........... |
| 165880 | 20 20 20 20 20 20 20 20 20 33 2d 35 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........3-5-4................(l |
| 1658a0 | 69 6e 65 20 31 36 31 29 0a 2a 20 73 68 61 64 6f 77 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ine.161).*.shadow:.............. |
| 1658c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 | ..................3-2........... |
| 1658e0 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 36 32 29 0a 2a 20 73 68 61 72 65 64 3a 20 20 20 20 20 | .......(line..62).*.shared:..... |
| 165900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 31 | ...........................3-3-1 |
| 165920 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 34 38 29 0a 2a 20 73 69 64 | ................(line.248).*.sid |
| 165940 | 65 2d 65 66 66 65 63 74 20 62 75 67 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e-effect.bugs:.................. |
| 165960 | 20 20 20 20 33 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 | ....3-1-3................(line.3 |
| 165980 | 32 30 29 0a 2a 20 73 69 65 76 65 20 6f 66 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 20).*.sieve.of:................. |
| 1659a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............3-5-2.............. |
| 1659c0 | 20 20 28 6c 69 6e 65 20 20 35 35 29 0a 2a 20 73 6d 6f 6f 74 68 69 6e 67 3a 20 20 20 20 20 20 20 | ..(line..55).*.smoothing:....... |
| 1659e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d 34 2e 20 20 20 20 | ......................1-3-4..... |
| 165a00 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 35 39 29 0a 2a 20 73 6f 75 72 63 65 20 6c | ...........(line.259).*.source.l |
| 165a20 | 61 6e 67 75 61 67 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 | anguage:.......................5 |
| 165a40 | 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 34 29 0a 2a | -5..................(line..34).* |
| 165a60 | 20 73 6f 75 72 63 65 20 70 72 6f 67 72 61 6d 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .source.program:................ |
| 165a80 | 20 20 20 20 20 20 20 20 35 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........5-5..................(li |
| 165aa0 | 6e 65 20 20 33 39 29 0a 2a 20 73 70 61 72 73 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ne..39).*.sparse:............... |
| 165ac0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 2e 20 20 20 20 20 20 20 20 20 | .................2-5-3.......... |
| 165ae0 | 20 20 20 20 20 20 28 6c 69 6e 65 20 32 35 34 29 0a 2a 20 73 70 65 63 69 61 6c 3a 20 20 20 20 20 | ......(line.254).*.special:..... |
| 165b00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 33 2e | ..........................1-1-3. |
| 165b20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 39 36 29 0a 2a 20 73 74 61 63 | ...............(line..96).*.stac |
| 165b40 | 6b 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | k.<1>:.......................... |
| 165b60 | 20 20 20 35 2d 31 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 38 | ...5-1-4................(line..8 |
| 165b80 | 32 29 0a 2a 20 73 74 61 63 6b 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 2).*.stack:..................... |
| 165ba0 | 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............1-2-1............... |
| 165bc0 | 20 28 6c 69 6e 65 20 32 33 33 29 0a 2a 20 73 74 61 74 65 20 76 61 72 69 61 62 6c 65 73 20 3c 31 | .(line.233).*.state.variables.<1 |
| 165be0 | 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 31 2e 20 20 20 20 20 | >:...................1-2-1...... |
| 165c00 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 31 32 29 0a 2a 20 73 74 61 74 65 20 76 61 72 | ..........(line.112).*.state.var |
| 165c20 | 69 61 62 6c 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d | iables:.......................3- |
| 165c40 | 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 31 29 0a 2a 20 | 1..................(line..11).*. |
| 165c60 | 73 74 61 74 65 6d 65 6e 74 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | statements:..................... |
| 165c80 | 20 20 20 20 20 20 20 35 2d 35 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......5-5-1................(lin |
| 165ca0 | 65 20 31 36 37 29 0a 2a 20 73 74 6f 70 2d 61 6e 64 2d 63 6f 70 79 3a 20 20 20 20 20 20 20 20 20 | e.167).*.stop-and-copy:......... |
| 165cc0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 | ................5-3-2........... |
| 165ce0 | 20 20 20 20 20 28 6c 69 6e 65 20 20 33 36 29 0a 2a 20 73 74 72 61 74 69 66 69 65 64 20 64 65 73 | .....(line..36).*.stratified.des |
| 165d00 | 69 67 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 32 2d 34 2e 20 | ign:.....................2-2-4.. |
| 165d20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 39 39 29 0a 2a 20 73 74 72 65 61 | ..............(line.499).*.strea |
| 165d40 | 6d 20 70 72 6f 63 65 73 73 69 6e 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | m.processing:................... |
| 165d60 | 20 20 31 2d 31 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 35 37 | ..1-1-5................(line.157 |
| 165d80 | 29 0a 2a 20 73 74 72 65 61 6d 73 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ).*.streams.<1>:................ |
| 165da0 | 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........3-5.................. |
| 165dc0 | 28 6c 69 6e 65 20 20 31 31 29 0a 2a 20 73 74 72 65 61 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20 | (line..11).*.streams:........... |
| 165de0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 33 2e 20 20 | ....................Chapter.3... |
| 165e00 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 38 29 0a 2a 20 73 74 72 69 63 74 3a 20 20 20 | .........(line..48).*.strict:... |
| 165e20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 32 | .............................4-2 |
| 165e40 | 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 36 29 0a 2a 20 73 | -1................(line..46).*.s |
| 165e60 | 75 62 72 6f 75 74 69 6e 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ubroutine:...................... |
| 165e80 | 20 20 20 20 20 20 35 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......5-1-3................(line |
| 165ea0 | 20 20 37 35 29 0a 2a 20 73 75 62 73 74 69 74 75 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 | ..75).*.substitution:........... |
| 165ec0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 35 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............1-1-5............ |
| 165ee0 | 20 20 20 20 28 6c 69 6e 65 20 31 35 33 29 0a 2a 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6d 6f | ....(line.153).*.substitution.mo |
| 165f00 | 64 65 6c 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 35 2e 20 20 | del:....................1-1-5... |
| 165f20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 38 29 0a 2a 20 73 75 62 74 79 70 | .............(line..58).*.subtyp |
| 165f40 | 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | e:.............................. |
| 165f60 | 20 32 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 35 39 29 | .2-5-2................(line.159) |
| 165f80 | 0a 2a 20 73 75 63 63 65 73 73 20 63 6f 6e 74 69 6e 75 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 | .*.success.continuation:........ |
| 165fa0 | 20 20 20 20 20 20 20 20 20 20 34 2d 33 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........4-3-3................( |
| 165fc0 | 6c 69 6e 65 20 20 32 39 29 0a 2a 20 73 75 6d 6d 61 74 69 6f 6e 20 6f 66 20 61 20 73 65 72 69 65 | line..29).*.summation.of.a.serie |
| 165fe0 | 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 33 2d 31 2e 20 20 20 20 20 20 20 | s:.................1-3-1........ |
| 166000 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 30 29 0a 2a 20 73 75 6d 6d 65 72 3a 20 20 20 20 | ........(line..50).*.summer:.... |
| 166020 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d | ............................3-5- |
| 166040 | 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 32 32 29 0a 2a 20 73 75 | 3................(line.422).*.su |
| 166060 | 70 65 72 74 79 70 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | pertype:........................ |
| 166080 | 20 20 20 20 20 32 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....2-5-2................(line. |
| 1660a0 | 31 36 32 29 0a 2a 20 73 79 6d 62 6f 6c 69 63 20 65 78 70 72 65 73 73 69 6f 6e 73 3a 20 20 20 20 | 162).*.symbolic.expressions:.... |
| 1660c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 32 2e 20 20 20 20 20 20 20 20 | ..............Chapter.2......... |
| 1660e0 | 20 20 20 28 6c 69 6e 65 20 31 33 39 29 0a 2a 20 73 79 6e 74 61 63 74 69 63 20 73 75 67 61 72 3a | ...(line.139).*.syntactic.sugar: |
| 166100 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 33 2e 20 20 20 | .......................1-1-3.... |
| 166120 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 31 38 29 0a 2a 20 73 79 6e 74 61 78 3a | ............(line.118).*.syntax: |
| 166140 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ................................ |
| 166160 | 34 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 32 29 0a | 4-1..................(line..42). |
| 166180 | 2a 20 73 79 73 74 65 6d 61 74 69 63 61 6c 6c 79 20 73 65 61 72 63 68 3a 20 20 20 20 20 20 20 20 | *.systematically.search:........ |
| 1661a0 | 20 20 20 20 20 20 20 20 20 34 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........4-3-1................(l |
| 1661c0 | 69 6e 65 20 20 37 35 29 0a 2a 20 73 79 73 74 65 6d 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | ine..75).*.systems:............. |
| 1661e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 68 61 70 74 65 72 20 34 2e 20 20 20 20 | ..................Chapter.4..... |
| 166200 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 34 38 29 0a 2a 20 74 61 62 6c 65 61 75 3a 20 20 20 20 | .......(line.148).*.tableau:.... |
| 166220 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 33 | ...........................3-5-3 |
| 166240 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 33 38 29 0a 2a 20 74 61 62 | ................(line.138).*.tab |
| 166260 | 75 6c 61 74 69 6f 6e 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ulation.<1>:.................... |
| 166280 | 20 20 20 20 31 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 | ....1-2-2................(line.2 |
| 1662a0 | 34 35 29 0a 2a 20 74 61 62 75 6c 61 74 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 45).*.tabulation:............... |
| 1662c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 33 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............3-3-3.............. |
| 1662e0 | 20 20 28 6c 69 6e 65 20 32 35 38 29 0a 2a 20 74 61 67 67 65 64 3a 20 20 20 20 20 20 20 20 20 20 | ..(line.258).*.tagged:.......... |
| 166300 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 | ......................5-3-1..... |
| 166320 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 32 37 34 29 0a 2a 20 74 61 69 6c 2d 72 65 63 | ...........(line.274).*.tail-rec |
| 166340 | 75 72 73 69 76 65 20 3c 31 3e 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 | ursive.<1>:....................1 |
| 166360 | 2d 32 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 35 35 29 0a 2a | -2-1................(line.155).* |
| 166380 | 20 74 61 69 6c 2d 72 65 63 75 72 73 69 76 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .tail-recursive:................ |
| 1663a0 | 20 20 20 20 20 20 20 20 35 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........5-4-2................(li |
| 1663c0 | 6e 65 20 20 38 32 29 0a 2a 20 74 61 72 67 65 74 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ne..82).*.target:............... |
| 1663e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 35 2d 31 2e 20 20 20 20 20 20 20 20 20 | .................5-5-1.......... |
| 166400 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 30 29 0a 2a 20 74 68 72 61 73 68 69 6e 67 3a 20 20 20 | ......(line..50).*.thrashing:... |
| 166420 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 55 54 46 2e 20 20 | ..........................UTF... |
| 166440 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 32 29 0a 2a 20 74 68 75 6e | ...............(line..22).*.thun |
| 166460 | 6b 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | k:.............................. |
| 166480 | 20 20 20 34 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 36 | ...4-2-2................(line.36 |
| 1664a0 | 39 29 0a 2a 20 74 68 75 6e 6b 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 9).*.thunks:.................... |
| 1664c0 | 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ............4-2-2............... |
| 1664e0 | 20 28 6c 69 6e 65 20 20 31 36 29 0a 2a 20 74 69 6d 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | .(line..16).*.time:............. |
| 166500 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 34 2e 20 20 20 20 20 20 20 | .....................3-4........ |
| 166520 | 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 34 29 0a 2a 20 74 69 6d 65 20 73 65 67 6d | ..........(line..14).*.time.segm |
| 166540 | 65 6e 74 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d | ents:.........................3- |
| 166560 | 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 34 37 33 29 0a 2a 20 | 3-4................(line.473).*. |
| 166580 | 74 6f 77 65 72 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | tower:.......................... |
| 1665a0 | 20 20 20 20 20 20 20 32 2d 35 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e | .......2-5-2................(lin |
| 1665c0 | 65 20 31 36 35 29 0a 2a 20 74 72 65 65 20 61 63 63 75 6d 75 6c 61 74 69 6f 6e 3a 20 20 20 20 20 | e.165).*.tree.accumulation:..... |
| 1665e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 31 2d 33 2e 20 20 20 20 20 20 20 20 20 20 | ................1-1-3........... |
| 166600 | 20 20 20 20 20 28 6c 69 6e 65 20 20 34 36 29 0a 2a 20 74 72 65 65 20 72 65 63 75 72 73 69 6f 6e | .....(line..46).*.tree.recursion |
| 166620 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 31 2d 32 2d 32 2e 20 | :........................1-2-2.. |
| 166640 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 20 36 29 0a 2a 20 74 72 65 65 73 | ..............(line...6).*.trees |
| 166660 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | :............................... |
| 166680 | 20 20 32 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 33 36 | ..2-2-2................(line..36 |
| 1666a0 | 29 0a 2a 20 74 72 75 74 68 20 6d 61 69 6e 74 65 6e 61 6e 63 65 3a 20 20 20 20 20 20 20 20 20 20 | ).*.truth.maintenance:.......... |
| 1666c0 | 20 20 20 20 20 20 20 20 20 20 20 34 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ...........4-3-1................ |
| 1666e0 | 28 6c 69 6e 65 20 32 32 30 29 0a 2a 20 54 75 72 69 6e 67 20 6d 61 63 68 69 6e 65 3a 20 20 20 20 | (line.220).*.Turing.machine:.... |
| 166700 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 35 2e 20 20 20 20 20 20 | ....................4-1-5....... |
| 166720 | 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 31 34 35 29 0a 2a 20 74 79 70 65 3a 20 20 20 20 20 | .........(line.145).*.type:..... |
| 166740 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 34 | .............................2-4 |
| 166760 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 39 29 0a 2a 20 74 | ..................(line..59).*.t |
| 166780 | 79 70 65 20 66 69 65 6c 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ype.field:...................... |
| 1667a0 | 20 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 | ......5-3-1................(line |
| 1667c0 | 20 32 36 38 29 0a 2a 20 74 79 70 65 20 74 61 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .268).*.type.tag:............... |
| 1667e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 34 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 | ...............2-4-2............ |
| 166800 | 20 20 20 20 28 6c 69 6e 65 20 20 32 35 29 0a 2a 20 74 79 70 65 2d 69 6e 66 65 72 65 6e 63 69 6e | ....(line..25).*.type-inferencin |
| 166820 | 67 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 34 2e 20 20 | g:......................3-5-4... |
| 166840 | 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 31 30 29 0a 2a 20 74 79 70 65 64 20 | .............(line.310).*.typed. |
| 166860 | 70 6f 69 6e 74 65 72 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | pointers:....................... |
| 166880 | 20 35 2d 33 2d 31 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 35 31 29 | .5-3-1................(line..51) |
| 1668a0 | 0a 2a 20 75 6e 62 6f 75 6e 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .*.unbound:..................... |
| 1668c0 | 20 20 20 20 20 20 20 20 20 20 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 | ..........3-2..................( |
| 1668e0 | 6c 69 6e 65 20 20 33 32 29 0a 2a 20 75 6e 69 66 69 63 61 74 69 6f 6e 20 3c 31 3e 3a 20 20 20 20 | line..32).*.unification.<1>:.... |
| 166900 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2d 32 2e 20 20 20 20 20 20 20 | ...................4-4-2........ |
| 166920 | 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 34 29 0a 2a 20 75 6e 69 66 69 63 61 74 69 6f 6e | ........(line..24).*.unification |
| 166940 | 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 34 2e | :...........................4-4. |
| 166960 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 34 33 29 0a 2a 20 75 6e | .................(line..43).*.un |
| 166980 | 69 66 69 63 61 74 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 3a 20 20 20 20 20 20 20 20 20 20 20 20 | ification.algorithm:............ |
| 1669a0 | 20 20 20 20 20 34 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 | .....4-4..................(line. |
| 1669c0 | 31 33 33 29 0a 2a 20 75 6e 69 76 61 72 69 61 74 65 20 70 6f 6c 79 6e 6f 6d 69 61 6c 73 3a 20 20 | 133).*.univariate.polynomials:.. |
| 1669e0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 35 2d 33 2e 20 20 20 20 20 20 20 20 20 20 20 20 | ..............2-5-3............. |
| 166a00 | 20 20 20 28 6c 69 6e 65 20 20 34 31 29 0a 2a 20 75 6e 69 76 65 72 73 61 6c 3a 20 20 20 20 20 20 | ...(line..41).*.universal:...... |
| 166a20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 34 2d 31 2d 35 2e 20 20 20 | .......................4-1-5.... |
| 166a40 | 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 37 33 29 0a 2a 20 75 70 77 61 72 64 2d | ............(line..73).*.upward- |
| 166a60 | 63 6f 6d 70 61 74 69 62 6c 65 20 65 78 74 65 6e 73 69 6f 6e 3a 20 20 20 20 20 20 20 20 20 20 20 | compatible.extension:........... |
| 166a80 | 34 2d 32 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 33 34 31 29 0a | 4-2-2................(line.341). |
| 166aa0 | 2a 20 76 61 6c 75 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | *.value:........................ |
| 166ac0 | 20 20 20 20 20 20 20 20 20 31 2d 31 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c | .........1-1-2................(l |
| 166ae0 | 69 6e 65 20 20 20 38 29 0a 2a 20 76 61 6c 75 65 20 6f 66 20 61 20 76 61 72 69 61 62 6c 65 3a 20 | ine...8).*.value.of.a.variable:. |
| 166b00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 32 2e 20 20 20 20 20 20 20 20 20 20 | ..................3-2........... |
| 166b20 | 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 38 29 0a 2a 20 76 61 6c 75 65 73 3a 20 20 20 20 20 | .......(line..28).*.values:..... |
| 166b40 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 33 2d 31 | ...........................2-3-1 |
| 166b60 | 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 32 29 0a 2a 20 76 61 72 | ................(line..22).*.var |
| 166b80 | 69 61 62 6c 65 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | iable:.......................... |
| 166ba0 | 20 20 20 20 31 2d 31 2d 32 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 | ....1-1-2................(line.. |
| 166bc0 | 20 38 29 0a 2a 20 76 61 72 69 61 62 6c 65 2d 6c 65 6e 67 74 68 3a 20 20 20 20 20 20 20 20 20 20 | .8).*.variable-length:.......... |
| 166be0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 | .............2-3-4.............. |
| 166c00 | 20 20 28 6c 69 6e 65 20 20 33 30 29 0a 2a 20 76 65 63 74 6f 72 3a 20 20 20 20 20 20 20 20 20 20 | ..(line..30).*.vector:.......... |
| 166c20 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 2d 33 2d 31 2e 20 20 20 20 | ......................5-3-1..... |
| 166c40 | 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 31 39 29 0a 2a 20 77 69 64 74 68 3a 20 20 | ...........(line..19).*.width:.. |
| 166c60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 | ...............................2 |
| 166c80 | 2d 31 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 20 38 37 29 0a 2a | -1-4................(line..87).* |
| 166ca0 | 20 77 69 72 65 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | .wires:......................... |
| 166cc0 | 20 20 20 20 20 20 20 20 33 2d 33 2d 34 2e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 | ........3-3-4................(li |
| 166ce0 | 6e 65 20 20 31 39 29 0a 2a 20 77 69 73 68 66 75 6c 20 74 68 69 6e 6b 69 6e 67 3a 20 20 20 20 20 | ne..19).*.wishful.thinking:..... |
| 166d00 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 32 2d 31 2d 31 2e 20 20 20 20 20 20 20 20 20 | .................2-1-1.......... |
| 166d20 | 20 20 20 20 20 20 28 6c 69 6e 65 20 20 32 34 29 0a 2a 20 7a 65 72 6f 20 63 72 6f 73 73 69 6e 67 | ......(line..24).*.zero.crossing |
| 166d40 | 73 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 33 2d 35 2d 33 2e | s:........................3-5-3. |
| 166d60 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 28 6c 69 6e 65 20 35 30 36 29 0a 0a 0a 1f 0a 54 61 | ...............(line.506).....Ta |
| 166d80 | 67 20 54 61 62 6c 65 3a 0a 4e 6f 64 65 3a 20 54 6f 70 7f 32 32 35 0a 4e 6f 64 65 3a 20 55 54 46 | g.Table:.Node:.Top.225.Node:.UTF |
| 166da0 | 7f 38 34 38 31 0a 4e 6f 64 65 3a 20 44 65 64 69 63 61 74 69 6f 6e 7f 31 31 34 33 31 0a 4e 6f 64 | .8481.Node:.Dedication.11431.Nod |
| 166dc0 | 65 3a 20 46 6f 72 65 77 6f 72 64 7f 31 32 37 38 30 0a 4e 6f 64 65 3a 20 50 72 65 66 61 63 65 7f | e:.Foreword.12780.Node:.Preface. |
| 166de0 | 32 33 35 31 34 0a 4e 6f 64 65 3a 20 50 72 65 66 61 63 65 20 31 65 7f 32 36 34 33 33 0a 4e 6f 64 | 23514.Node:.Preface.1e.26433.Nod |
| 166e00 | 65 3a 20 41 63 6b 6e 6f 77 6c 65 64 67 65 6d 65 6e 74 73 7f 33 32 38 30 32 0a 4e 6f 64 65 3a 20 | e:.Acknowledgements.32802.Node:. |
| 166e20 | 43 68 61 70 74 65 72 20 31 7f 33 39 33 39 32 0a 52 65 66 3a 20 43 68 61 70 74 65 72 20 31 2d 46 | Chapter.1.39392.Ref:.Chapter.1-F |
| 166e40 | 6f 6f 74 6e 6f 74 65 2d 31 7f 34 37 31 32 34 0a 52 65 66 3a 20 43 68 61 70 74 65 72 20 31 2d 46 | ootnote-1.47124.Ref:.Chapter.1-F |
| 166e60 | 6f 6f 74 6e 6f 74 65 2d 32 7f 34 37 33 31 39 0a 52 65 66 3a 20 43 68 61 70 74 65 72 20 31 2d 46 | ootnote-2.47319.Ref:.Chapter.1-F |
| 166e80 | 6f 6f 74 6e 6f 74 65 2d 33 7f 34 38 35 32 38 0a 4e 6f 64 65 3a 20 31 2d 31 7f 34 39 30 34 31 0a | ootnote-3.48528.Node:.1-1.49041. |
| 166ea0 | 52 65 66 3a 20 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 35 31 30 36 35 0a 4e 6f 64 65 3a 20 | Ref:.1-1-Footnote-1.51065.Node:. |
| 166ec0 | 31 2d 31 2d 31 7f 35 32 32 35 39 0a 52 65 66 3a 20 31 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d | 1-1-1.52259.Ref:.1-1-1-Footnote- |
| 166ee0 | 31 7f 35 35 37 34 37 0a 52 65 66 3a 20 31 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 35 35 | 1.55747.Ref:.1-1-1-Footnote-2.55 |
| 166f00 | 39 34 37 0a 52 65 66 3a 20 31 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 35 36 32 36 35 0a | 947.Ref:.1-1-1-Footnote-3.56265. |
| 166f20 | 4e 6f 64 65 3a 20 31 2d 31 2d 32 7f 35 36 35 36 36 0a 52 65 66 3a 20 31 2d 31 2d 32 2d 46 6f 6f | Node:.1-1-2.56566.Ref:.1-1-2-Foo |
| 166f40 | 74 6e 6f 74 65 2d 31 7f 35 38 37 33 30 0a 52 65 66 3a 20 31 2d 31 2d 32 2d 46 6f 6f 74 6e 6f 74 | tnote-1.58730.Ref:.1-1-2-Footnot |
| 166f60 | 65 2d 32 7f 35 38 38 36 38 0a 4e 6f 64 65 3a 20 31 2d 31 2d 33 7f 35 39 30 33 32 0a 52 65 66 3a | e-2.58868.Node:.1-1-3.59032.Ref: |
| 166f80 | 20 46 69 67 75 72 65 20 31 2d 31 7f 36 31 32 35 30 0a 52 65 66 3a 20 31 2d 31 2d 33 2d 46 6f 6f | .Figure.1-1.61250.Ref:.1-1-3-Foo |
| 166fa0 | 74 6e 6f 74 65 2d 31 7f 36 34 30 31 32 0a 52 65 66 3a 20 31 2d 31 2d 33 2d 46 6f 6f 74 6e 6f 74 | tnote-1.64012.Ref:.1-1-3-Footnot |
| 166fc0 | 65 2d 32 7f 36 34 34 33 36 0a 4e 6f 64 65 3a 20 31 2d 31 2d 34 7f 36 35 32 37 36 0a 52 65 66 3a | e-2.64436.Node:.1-1-4.65276.Ref: |
| 166fe0 | 20 31 2d 31 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 36 38 34 31 30 0a 52 65 66 3a 20 31 2d 31 | .1-1-4-Footnote-1.68410.Ref:.1-1 |
| 167000 | 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 36 38 37 39 35 0a 52 65 66 3a 20 31 2d 31 2d 34 2d 46 | -4-Footnote-2.68795.Ref:.1-1-4-F |
| 167020 | 6f 6f 74 6e 6f 74 65 2d 33 7f 36 39 30 34 31 0a 4e 6f 64 65 3a 20 31 2d 31 2d 35 7f 36 39 32 39 | ootnote-3.69041.Node:.1-1-5.6929 |
| 167040 | 35 0a 52 65 66 3a 20 31 2d 31 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 37 35 37 30 30 0a 52 65 | 5.Ref:.1-1-5-Footnote-1.75700.Re |
| 167060 | 66 3a 20 31 2d 31 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 37 36 32 37 36 0a 4e 6f 64 65 3a 20 | f:.1-1-5-Footnote-2.76276.Node:. |
| 167080 | 31 2d 31 2d 36 7f 37 36 35 37 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 31 7f 38 31 | 1-1-6.76576.Ref:.Exercise.1-1.81 |
| 1670a0 | 37 32 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 32 7f 38 32 34 38 32 0a 52 65 66 3a | 726.Ref:.Exercise.1-2.82482.Ref: |
| 1670c0 | 20 45 78 65 72 63 69 73 65 20 31 2d 33 7f 38 32 36 37 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | .Exercise.1-3.82676.Ref:.Exercis |
| 1670e0 | 65 20 31 2d 34 7f 38 32 38 32 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 35 7f 38 33 | e.1-4.82827.Ref:.Exercise.1-5.83 |
| 167100 | 31 31 31 0a 52 65 66 3a 20 31 2d 31 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 38 34 30 36 39 0a | 111.Ref:.1-1-6-Footnote-1.84069. |
| 167120 | 52 65 66 3a 20 31 2d 31 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 38 34 35 32 37 0a 52 65 66 3a | Ref:.1-1-6-Footnote-2.84527.Ref: |
| 167140 | 20 31 2d 31 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 38 34 36 35 32 0a 4e 6f 64 65 3a 20 31 2d | .1-1-6-Footnote-3.84652.Node:.1- |
| 167160 | 31 2d 37 7f 38 35 30 36 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 36 7f 38 39 35 38 | 1-7.85063.Ref:.Exercise.1-6.8958 |
| 167180 | 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 37 7f 39 30 35 32 34 0a 52 65 66 3a 20 45 | 2.Ref:.Exercise.1-7.90524.Ref:.E |
| 1671a0 | 78 65 72 63 69 73 65 20 31 2d 38 7f 39 31 32 38 37 0a 52 65 66 3a 20 31 2d 31 2d 37 2d 46 6f 6f | xercise.1-8.91287.Ref:.1-1-7-Foo |
| 1671c0 | 74 6e 6f 74 65 2d 31 7f 39 31 38 32 35 0a 52 65 66 3a 20 31 2d 31 2d 37 2d 46 6f 6f 74 6e 6f 74 | tnote-1.91825.Ref:.1-1-7-Footnot |
| 1671e0 | 65 2d 32 7f 39 32 39 32 36 0a 52 65 66 3a 20 31 2d 31 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f | e-2.92926.Ref:.1-1-7-Footnote-3. |
| 167200 | 39 33 32 36 38 0a 52 65 66 3a 20 31 2d 31 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 39 33 35 31 | 93268.Ref:.1-1-7-Footnote-4.9351 |
| 167220 | 36 0a 52 65 66 3a 20 31 2d 31 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 39 34 33 36 30 0a 4e 6f | 6.Ref:.1-1-7-Footnote-5.94360.No |
| 167240 | 64 65 3a 20 31 2d 31 2d 38 7f 39 34 35 34 37 0a 52 65 66 3a 20 46 69 67 75 72 65 20 31 2d 32 7f | de:.1-1-8.94547.Ref:.Figure.1-2. |
| 167260 | 39 35 36 39 37 0a 52 65 66 3a 20 31 2d 31 2d 38 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 30 34 34 | 95697.Ref:.1-1-8-Footnote-1.1044 |
| 167280 | 36 30 0a 52 65 66 3a 20 31 2d 31 2d 38 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 30 34 37 39 33 0a | 60.Ref:.1-1-8-Footnote-2.104793. |
| 1672a0 | 52 65 66 3a 20 31 2d 31 2d 38 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 30 34 39 34 33 0a 52 65 66 | Ref:.1-1-8-Footnote-3.104943.Ref |
| 1672c0 | 3a 20 46 6f 6f 74 6e 6f 74 65 20 32 38 7f 31 30 34 39 36 33 0a 52 65 66 3a 20 31 2d 31 2d 38 2d | :.Footnote.28.104963.Ref:.1-1-8- |
| 1672e0 | 46 6f 6f 74 6e 6f 74 65 2d 34 7f 31 30 35 33 30 33 0a 4e 6f 64 65 3a 20 31 2d 32 7f 31 30 35 34 | Footnote-4.105303.Node:.1-2.1054 |
| 167300 | 38 30 0a 4e 6f 64 65 3a 20 31 2d 32 2d 31 7f 31 30 38 34 31 37 0a 52 65 66 3a 20 46 69 67 75 72 | 80.Node:.1-2-1.108417.Ref:.Figur |
| 167320 | 65 20 31 2d 33 7f 31 30 38 35 36 37 0a 52 65 66 3a 20 46 69 67 75 72 65 20 31 2d 34 7f 31 31 30 | e.1-3.108567.Ref:.Figure.1-4.110 |
| 167340 | 36 39 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 39 7f 31 31 36 30 39 36 0a 52 65 66 | 699.Ref:.Exercise.1-9.116096.Ref |
| 167360 | 3a 20 45 78 65 72 63 69 73 65 20 31 2d 31 30 7f 31 31 36 37 31 38 0a 52 65 66 3a 20 31 2d 32 2d | :.Exercise.1-10.116718.Ref:.1-2- |
| 167380 | 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 31 37 35 39 33 0a 52 65 66 3a 20 31 2d 32 2d 31 2d 46 | 1-Footnote-1.117593.Ref:.1-2-1-F |
| 1673a0 | 6f 6f 74 6e 6f 74 65 2d 32 7f 31 31 38 30 39 33 0a 52 65 66 3a 20 31 2d 32 2d 31 2d 46 6f 6f 74 | ootnote-2.118093.Ref:.1-2-1-Foot |
| 1673c0 | 6e 6f 74 65 2d 33 7f 31 31 38 34 35 35 0a 4e 6f 64 65 3a 20 31 2d 32 2d 32 7f 31 31 39 30 36 36 | note-3.118455.Node:.1-2-2.119066 |
| 1673e0 | 0a 52 65 66 3a 20 46 69 67 75 72 65 20 31 2d 35 7f 31 31 39 39 32 33 0a 52 65 66 3a 20 45 78 65 | .Ref:.Figure.1-5.119923.Ref:.Exe |
| 167400 | 72 63 69 73 65 20 31 2d 31 31 7f 31 32 38 30 31 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | rcise.1-11.128012.Ref:.Exercise. |
| 167420 | 31 2d 31 32 7f 31 32 38 33 30 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 31 33 7f 31 | 1-12.128301.Ref:.Exercise.1-13.1 |
| 167440 | 32 38 37 36 30 0a 52 65 66 3a 20 31 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 32 39 31 | 28760.Ref:.1-2-2-Footnote-1.1291 |
| 167460 | 33 36 0a 52 65 66 3a 20 31 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 32 39 32 38 30 0a | 36.Ref:.1-2-2-Footnote-2.129280. |
| 167480 | 52 65 66 3a 20 31 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 32 39 34 32 37 0a 52 65 66 | Ref:.1-2-2-Footnote-3.129427.Ref |
| 1674a0 | 3a 20 31 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 31 33 30 31 30 38 0a 4e 6f 64 65 3a 20 | :.1-2-2-Footnote-4.130108.Node:. |
| 1674c0 | 31 2d 32 2d 33 7f 31 33 30 37 38 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 31 34 7f | 1-2-3.130786.Ref:.Exercise.1-14. |
| 1674e0 | 31 33 33 39 35 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 31 35 7f 31 33 34 32 35 34 | 133950.Ref:.Exercise.1-15.134254 |
| 167500 | 0a 52 65 66 3a 20 31 2d 32 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 33 35 33 39 30 0a 4e 6f | .Ref:.1-2-3-Footnote-1.135390.No |
| 167520 | 64 65 3a 20 31 2d 32 2d 34 7f 31 33 35 39 31 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 | de:.1-2-4.135918.Ref:.Exercise.1 |
| 167540 | 2d 31 36 7f 31 33 38 38 34 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 31 37 7f 31 33 | -16.138846.Ref:.Exercise.1-17.13 |
| 167560 | 39 36 33 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 31 38 7f 31 34 30 34 39 33 0a 52 | 9630.Ref:.Exercise.1-18.140493.R |
| 167580 | 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 31 39 7f 31 34 30 37 37 30 0a 52 65 66 3a 20 31 2d | ef:.Exercise.1-19.140770.Ref:.1- |
| 1675a0 | 32 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 34 32 36 38 35 0a 52 65 66 3a 20 31 2d 32 2d 34 | 2-4-Footnote-1.142685.Ref:.1-2-4 |
| 1675c0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 34 33 31 33 35 0a 52 65 66 3a 20 31 2d 32 2d 34 2d 46 6f | -Footnote-2.143135.Ref:.1-2-4-Fo |
| 1675e0 | 6f 74 6e 6f 74 65 2d 33 7f 31 34 33 32 35 31 0a 52 65 66 3a 20 31 2d 32 2d 34 2d 46 6f 6f 74 6e | otnote-3.143251.Ref:.1-2-4-Footn |
| 167600 | 6f 74 65 2d 34 7f 31 34 33 34 38 38 0a 52 65 66 3a 20 31 2d 32 2d 34 2d 46 6f 6f 74 6e 6f 74 65 | ote-4.143488.Ref:.1-2-4-Footnote |
| 167620 | 2d 35 7f 31 34 33 38 31 36 0a 4e 6f 64 65 3a 20 31 2d 32 2d 35 7f 31 34 33 39 31 30 0a 52 65 66 | -5.143816.Node:.1-2-5.143910.Ref |
| 167640 | 3a 20 45 78 65 72 63 69 73 65 20 31 2d 32 30 7f 31 34 36 35 38 37 0a 52 65 66 3a 20 31 2d 32 2d | :.Exercise.1-20.146587.Ref:.1-2- |
| 167660 | 35 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 34 37 33 38 36 0a 52 65 66 3a 20 31 2d 32 2d 35 2d 46 | 5-Footnote-1.147386.Ref:.1-2-5-F |
| 167680 | 6f 6f 74 6e 6f 74 65 2d 32 7f 31 34 37 38 32 35 0a 4e 6f 64 65 3a 20 31 2d 32 2d 36 7f 31 34 39 | ootnote-2.147825.Node:.1-2-6.149 |
| 1676a0 | 34 36 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 32 31 7f 31 35 36 30 37 39 0a 52 65 | 468.Ref:.Exercise.1-21.156079.Re |
| 1676c0 | 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 32 32 7f 31 35 36 32 33 30 0a 52 65 66 3a 20 45 78 65 | f:.Exercise.1-22.156230.Ref:.Exe |
| 1676e0 | 72 63 69 73 65 20 31 2d 32 33 7f 31 35 37 39 34 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | rcise.1-23.157945.Ref:.Exercise. |
| 167700 | 31 2d 32 34 7f 31 35 39 30 36 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 32 35 7f 31 | 1-24.159069.Ref:.Exercise.1-25.1 |
| 167720 | 35 39 35 33 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 32 36 7f 31 35 39 39 34 31 0a | 59530.Ref:.Exercise.1-26.159941. |
| 167740 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 32 37 7f 31 36 30 39 34 32 0a 52 65 66 3a 20 45 | Ref:.Exercise.1-27.160942.Ref:.E |
| 167760 | 78 65 72 63 69 73 65 20 31 2d 32 38 7f 31 36 31 32 36 31 0a 52 65 66 3a 20 31 2d 32 2d 36 2d 46 | xercise.1-28.161261.Ref:.1-2-6-F |
| 167780 | 6f 6f 74 6e 6f 74 65 2d 31 7f 31 36 32 38 30 35 0a 52 65 66 3a 20 31 2d 32 2d 36 2d 46 6f 6f 74 | ootnote-1.162805.Ref:.1-2-6-Foot |
| 1677a0 | 6e 6f 74 65 2d 32 7f 31 36 32 39 30 39 0a 52 65 66 3a 20 31 2d 32 2d 36 2d 46 6f 6f 74 6e 6f 74 | note-2.162909.Ref:.1-2-6-Footnot |
| 1677c0 | 65 2d 33 7f 31 36 33 38 32 32 0a 52 65 66 3a 20 31 2d 32 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 34 | e-3.163822.Ref:.1-2-6-Footnote-4 |
| 1677e0 | 7f 31 36 34 34 35 35 0a 52 65 66 3a 20 46 6f 6f 74 6e 6f 74 65 20 31 2d 34 37 7f 31 36 34 34 37 | .164455.Ref:.Footnote.1-47.16447 |
| 167800 | 37 0a 52 65 66 3a 20 31 2d 32 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 31 36 35 31 33 34 0a 4e | 7.Ref:.1-2-6-Footnote-5.165134.N |
| 167820 | 6f 64 65 3a 20 31 2d 33 7f 31 36 35 39 36 38 0a 4e 6f 64 65 3a 20 31 2d 33 2d 31 7f 31 36 38 32 | ode:.1-3.165968.Node:.1-3-1.1682 |
| 167840 | 31 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 32 39 7f 31 37 32 36 32 31 0a 52 65 66 | 15.Ref:.Exercise.1-29.172621.Ref |
| 167860 | 3a 20 45 78 65 72 63 69 73 65 20 31 2d 33 30 7f 31 37 33 34 30 31 0a 52 65 66 3a 20 45 78 65 72 | :.Exercise.1-30.173401.Ref:.Exer |
| 167880 | 63 69 73 65 20 31 2d 33 31 7f 31 37 33 38 34 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 | cise.1-31.173845.Ref:.Exercise.1 |
| 1678a0 | 2d 33 32 7f 31 37 34 37 30 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 33 33 7f 31 37 | -32.174704.Ref:.Exercise.1-33.17 |
| 1678c0 | 35 37 39 31 0a 52 65 66 3a 20 31 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 37 36 37 35 | 5791.Ref:.1-3-1-Footnote-1.17675 |
| 1678e0 | 35 0a 52 65 66 3a 20 31 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 37 36 39 37 36 0a 52 | 5.Ref:.1-3-1-Footnote-2.176976.R |
| 167900 | 65 66 3a 20 31 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 37 37 32 36 32 0a 52 65 66 3a | ef:.1-3-1-Footnote-3.177262.Ref: |
| 167920 | 20 31 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 31 37 38 30 31 34 0a 4e 6f 64 65 3a 20 31 | .1-3-1-Footnote-4.178014.Node:.1 |
| 167940 | 2d 33 2d 32 7f 31 37 38 31 31 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 33 34 7f 31 | -3-2.178112.Ref:.Exercise.1-34.1 |
| 167960 | 38 34 34 33 35 0a 52 65 66 3a 20 31 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 38 34 37 | 84435.Ref:.1-3-2-Footnote-1.1847 |
| 167980 | 38 31 0a 52 65 66 3a 20 31 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 38 35 33 37 30 0a | 81.Ref:.1-3-2-Footnote-2.185370. |
| 1679a0 | 4e 6f 64 65 3a 20 31 2d 33 2d 33 7f 31 38 35 37 34 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | Node:.1-3-3.185749.Ref:.Exercise |
| 1679c0 | 20 31 2d 33 35 7f 31 39 33 38 34 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 33 36 7f | .1-35.193848.Ref:.Exercise.1-36. |
| 1679e0 | 31 39 34 30 37 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 33 37 7f 31 39 34 36 35 30 | 194073.Ref:.Exercise.1-37.194650 |
| 167a00 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 33 38 7f 31 39 36 36 33 39 0a 52 65 66 3a 20 | .Ref:.Exercise.1-38.196639.Ref:. |
| 167a20 | 45 78 65 72 63 69 73 65 20 31 2d 33 39 7f 31 39 37 31 32 34 0a 52 65 66 3a 20 31 2d 33 2d 33 2d | Exercise.1-39.197124.Ref:.1-3-3- |
| 167a40 | 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 39 37 37 37 34 0a 52 65 66 3a 20 31 2d 33 2d 33 2d 46 6f 6f | Footnote-1.197774.Ref:.1-3-3-Foo |
| 167a60 | 74 6e 6f 74 65 2d 32 7f 31 39 38 31 36 31 0a 52 65 66 3a 20 31 2d 33 2d 33 2d 46 6f 6f 74 6e 6f | tnote-2.198161.Ref:.1-3-3-Footno |
| 167a80 | 74 65 2d 33 7f 31 39 38 32 38 38 0a 52 65 66 3a 20 31 2d 33 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d | te-3.198288.Ref:.1-3-3-Footnote- |
| 167aa0 | 34 7f 31 39 38 34 34 33 0a 4e 6f 64 65 3a 20 31 2d 33 2d 34 7f 31 39 38 36 31 33 0a 52 65 66 3a | 4.198443.Node:.1-3-4.198613.Ref: |
| 167ac0 | 20 45 78 65 72 63 69 73 65 20 31 2d 34 30 7f 32 30 37 34 36 36 0a 52 65 66 3a 20 45 78 65 72 63 | .Exercise.1-40.207466.Ref:.Exerc |
| 167ae0 | 69 73 65 20 31 2d 34 31 7f 32 30 37 37 32 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d | ise.1-41.207720.Ref:.Exercise.1- |
| 167b00 | 34 32 7f 32 30 38 31 30 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 34 33 7f 32 30 38 | 42.208104.Ref:.Exercise.1-43.208 |
| 167b20 | 34 33 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 34 34 7f 32 30 39 33 31 34 0a 52 65 | 434.Ref:.Exercise.1-44.209314.Re |
| 167b40 | 66 3a 20 45 78 65 72 63 69 73 65 20 31 2d 34 35 7f 32 31 30 30 35 33 0a 52 65 66 3a 20 45 78 65 | f:.Exercise.1-45.210053.Ref:.Exe |
| 167b60 | 72 63 69 73 65 20 31 2d 34 36 7f 32 31 31 31 33 35 0a 52 65 66 3a 20 31 2d 33 2d 34 2d 46 6f 6f | rcise.1-46.211135.Ref:.1-3-4-Foo |
| 167b80 | 74 6e 6f 74 65 2d 31 7f 32 31 32 31 30 31 0a 52 65 66 3a 20 31 2d 33 2d 34 2d 46 6f 6f 74 6e 6f | tnote-1.212101.Ref:.1-3-4-Footno |
| 167ba0 | 74 65 2d 32 7f 32 31 32 34 35 32 0a 52 65 66 3a 20 31 2d 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d | te-2.212452.Ref:.1-3-4-Footnote- |
| 167bc0 | 33 7f 32 31 32 35 31 36 0a 52 65 66 3a 20 31 2d 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 32 | 3.212516.Ref:.1-3-4-Footnote-4.2 |
| 167be0 | 31 32 37 37 39 0a 52 65 66 3a 20 31 2d 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 32 31 33 30 | 12779.Ref:.1-3-4-Footnote-5.2130 |
| 167c00 | 37 32 0a 52 65 66 3a 20 31 2d 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 32 31 33 31 38 39 0a | 72.Ref:.1-3-4-Footnote-6.213189. |
| 167c20 | 52 65 66 3a 20 31 2d 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 37 7f 32 31 33 33 33 38 0a 52 65 66 | Ref:.1-3-4-Footnote-7.213338.Ref |
| 167c40 | 3a 20 31 2d 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 38 7f 32 31 33 34 33 30 0a 4e 6f 64 65 3a 20 | :.1-3-4-Footnote-8.213430.Node:. |
| 167c60 | 43 68 61 70 74 65 72 20 32 7f 32 31 33 37 37 37 0a 52 65 66 3a 20 43 68 61 70 74 65 72 20 32 2d | Chapter.2.213777.Ref:.Chapter.2- |
| 167c80 | 46 6f 6f 74 6e 6f 74 65 2d 31 7f 32 32 33 35 34 34 0a 4e 6f 64 65 3a 20 32 2d 31 7f 32 32 34 33 | Footnote-1.223544.Node:.2-1.2243 |
| 167ca0 | 39 36 0a 4e 6f 64 65 3a 20 32 2d 31 2d 31 7f 32 32 36 33 35 31 0a 52 65 66 3a 20 45 78 65 72 63 | 96.Node:.2-1-1.226351.Ref:.Exerc |
| 167cc0 | 69 73 65 20 32 2d 31 7f 32 33 32 31 32 39 0a 52 65 66 3a 20 32 2d 31 2d 31 2d 46 6f 6f 74 6e 6f | ise.2-1.232129.Ref:.2-1-1-Footno |
| 167ce0 | 74 65 2d 31 7f 32 33 32 34 39 33 0a 52 65 66 3a 20 32 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d | te-1.232493.Ref:.2-1-1-Footnote- |
| 167d00 | 32 7f 32 33 32 39 30 32 0a 52 65 66 3a 20 32 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 32 | 2.232902.Ref:.2-1-1-Footnote-3.2 |
| 167d20 | 33 33 37 36 39 0a 4e 6f 64 65 3a 20 32 2d 31 2d 32 7f 32 33 34 30 39 32 0a 52 65 66 3a 20 46 69 | 33769.Node:.2-1-2.234092.Ref:.Fi |
| 167d40 | 67 75 72 65 20 32 2d 31 7f 32 33 35 38 30 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d | gure.2-1.235801.Ref:.Exercise.2- |
| 167d60 | 32 7f 32 33 39 30 33 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 33 7f 32 34 30 31 33 | 2.239032.Ref:.Exercise.2-3.24013 |
| 167d80 | 36 0a 4e 6f 64 65 3a 20 32 2d 31 2d 33 7f 32 34 30 36 33 33 0a 52 65 66 3a 20 45 78 65 72 63 69 | 6.Node:.2-1-3.240633.Ref:.Exerci |
| 167da0 | 73 65 20 32 2d 34 7f 32 34 35 34 38 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 35 7f | se.2-4.245489.Ref:.Exercise.2-5. |
| 167dc0 | 32 34 35 39 36 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 36 7f 32 34 36 32 36 32 0a | 245961.Ref:.Exercise.2-6.246262. |
| 167de0 | 52 65 66 3a 20 32 2d 31 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 32 34 37 31 34 30 0a 4e 6f 64 | Ref:.2-1-3-Footnote-1.247140.Nod |
| 167e00 | 65 3a 20 32 2d 31 2d 34 7f 32 34 38 33 36 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d | e:.2-1-4.248368.Ref:.Exercise.2- |
| 167e20 | 37 7f 32 35 31 37 34 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 38 7f 32 35 32 30 37 | 7.251742.Ref:.Exercise.2-8.25207 |
| 167e40 | 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 39 7f 32 35 32 32 38 30 0a 52 65 66 3a 20 | 7.Ref:.Exercise.2-9.252280.Ref:. |
| 167e60 | 45 78 65 72 63 69 73 65 20 32 2d 31 30 7f 32 35 32 39 39 36 0a 52 65 66 3a 20 45 78 65 72 63 69 | Exercise.2-10.252996.Ref:.Exerci |
| 167e80 | 73 65 20 32 2d 31 31 7f 32 35 33 32 39 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 31 | se.2-11.253290.Ref:.Exercise.2-1 |
| 167ea0 | 32 7f 32 35 34 37 30 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 31 33 7f 32 35 35 30 | 2.254707.Ref:.Exercise.2-13.2550 |
| 167ec0 | 33 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 31 34 7f 32 35 36 34 35 38 0a 52 65 66 | 38.Ref:.Exercise.2-14.256458.Ref |
| 167ee0 | 3a 20 45 78 65 72 63 69 73 65 20 32 2d 31 35 7f 32 35 36 39 30 32 0a 52 65 66 3a 20 45 78 65 72 | :.Exercise.2-15.256902.Ref:.Exer |
| 167f00 | 63 69 73 65 20 32 2d 31 36 7f 32 35 37 34 30 34 0a 4e 6f 64 65 3a 20 32 2d 32 7f 32 35 37 36 38 | cise.2-16.257404.Node:.2-2.25768 |
| 167f20 | 36 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 32 7f 32 35 38 34 36 31 0a 52 65 66 3a 20 46 69 | 6.Ref:.Figure.2-2.258461.Ref:.Fi |
| 167f40 | 67 75 72 65 20 32 2d 33 7f 32 35 39 31 33 39 0a 52 65 66 3a 20 32 2d 32 2d 46 6f 6f 74 6e 6f 74 | gure.2-3.259139.Ref:.2-2-Footnot |
| 167f60 | 65 2d 31 7f 32 36 31 35 34 34 0a 52 65 66 3a 20 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 32 | e-1.261544.Ref:.2-2-Footnote-2.2 |
| 167f80 | 36 32 30 35 31 0a 4e 6f 64 65 3a 20 32 2d 32 2d 31 7f 32 36 33 31 39 35 0a 52 65 66 3a 20 46 69 | 62051.Node:.2-2-1.263195.Ref:.Fi |
| 167fa0 | 67 75 72 65 20 32 2d 34 7f 32 36 33 33 32 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d | gure.2-4.263329.Ref:.Exercise.2- |
| 167fc0 | 31 37 7f 32 36 39 31 31 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 31 38 7f 32 36 39 | 17.269117.Ref:.Exercise.2-18.269 |
| 167fe0 | 33 32 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 31 39 7f 32 36 39 35 33 34 0a 52 65 | 325.Ref:.Exercise.2-19.269534.Re |
| 168000 | 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 32 30 7f 32 37 31 34 30 39 0a 52 65 66 3a 20 45 78 65 | f:.Exercise.2-20.271409.Ref:.Exe |
| 168020 | 72 63 69 73 65 20 32 2d 32 31 7f 32 37 35 32 37 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | rcise.2-21.275272.Ref:.Exercise. |
| 168040 | 32 2d 32 32 7f 32 37 35 38 30 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 32 33 7f 32 | 2-22.275800.Ref:.Exercise.2-23.2 |
| 168060 | 37 36 38 31 38 0a 52 65 66 3a 20 32 2d 32 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 32 37 37 36 | 76818.Ref:.2-2-1-Footnote-1.2776 |
| 168080 | 32 34 0a 52 65 66 3a 20 32 2d 32 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 32 37 37 38 33 30 0a | 24.Ref:.2-2-1-Footnote-2.277830. |
| 1680a0 | 52 65 66 3a 20 32 2d 32 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 32 37 38 33 32 34 0a 52 65 66 | Ref:.2-2-1-Footnote-3.278324.Ref |
| 1680c0 | 3a 20 32 2d 32 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 32 37 39 31 32 32 0a 52 65 66 3a 20 32 | :.2-2-1-Footnote-4.279122.Ref:.2 |
| 1680e0 | 2d 32 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 32 37 39 32 35 39 0a 52 65 66 3a 20 46 6f 6f 74 | -2-1-Footnote-5.279259.Ref:.Foot |
| 168100 | 6e 6f 74 65 20 31 32 7f 32 37 39 32 37 39 0a 4e 6f 64 65 3a 20 32 2d 32 2d 32 7f 32 37 39 38 30 | note.12.279279.Node:.2-2-2.27980 |
| 168120 | 33 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 35 7f 32 38 30 34 32 38 0a 52 65 66 3a 20 46 69 | 3.Ref:.Figure.2-5.280428.Ref:.Fi |
| 168140 | 67 75 72 65 20 32 2d 36 7f 32 38 31 37 32 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d | gure.2-6.281728.Ref:.Exercise.2- |
| 168160 | 32 34 7f 32 38 33 36 39 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 32 35 7f 32 38 33 | 24.283697.Ref:.Exercise.2-25.283 |
| 168180 | 39 36 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 32 36 7f 32 38 34 31 35 38 0a 52 65 | 961.Ref:.Exercise.2-26.284158.Re |
| 1681a0 | 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 32 37 7f 32 38 34 34 38 30 0a 52 65 66 3a 20 45 78 65 | f:.Exercise.2-27.284480.Ref:.Exe |
| 1681c0 | 72 63 69 73 65 20 32 2d 32 38 7f 32 38 34 39 35 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | rcise.2-28.284950.Ref:.Exercise. |
| 1681e0 | 32 2d 32 39 7f 32 38 35 33 33 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 33 30 7f 32 | 2-29.285332.Ref:.Exercise.2-30.2 |
| 168200 | 38 38 37 30 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 33 31 7f 32 38 39 31 37 30 0a | 88704.Ref:.Exercise.2-31.289170. |
| 168220 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 33 32 7f 32 38 39 34 30 32 0a 52 65 66 3a 20 32 | Ref:.Exercise.2-32.289402.Ref:.2 |
| 168240 | 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 32 39 30 30 35 33 0a 4e 6f 64 65 3a 20 32 2d 32 | -2-2-Footnote-1.290053.Node:.2-2 |
| 168260 | 2d 33 7f 32 39 30 31 38 32 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 37 7f 32 39 33 33 34 31 | -3.290182.Ref:.Figure.2-7.293341 |
| 168280 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 33 33 7f 33 30 30 38 37 30 0a 52 65 66 3a 20 | .Ref:.Exercise.2-33.300870.Ref:. |
| 1682a0 | 45 78 65 72 63 69 73 65 20 32 2d 33 34 7f 33 30 31 32 38 37 0a 52 65 66 3a 20 45 78 65 72 63 69 | Exercise.2-34.301287.Ref:.Exerci |
| 1682c0 | 73 65 20 32 2d 33 35 7f 33 30 32 33 31 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 33 | se.2-35.302315.Ref:.Exercise.2-3 |
| 1682e0 | 36 7f 33 30 32 35 30 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 33 37 7f 33 30 33 34 | 6.302502.Ref:.Exercise.2-37.3034 |
| 168300 | 30 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 33 38 7f 33 30 34 39 39 36 0a 52 65 66 | 09.Ref:.Exercise.2-38.304996.Ref |
| 168320 | 3a 20 45 78 65 72 63 69 73 65 20 32 2d 33 39 7f 33 30 35 39 36 38 0a 52 65 66 3a 20 45 78 65 72 | :.Exercise.2-39.305968.Ref:.Exer |
| 168340 | 63 69 73 65 20 32 2d 34 30 7f 33 31 30 37 37 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 | cise.2-40.310779.Ref:.Exercise.2 |
| 168360 | 2d 34 31 7f 33 31 31 30 31 37 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 38 7f 33 31 31 32 30 | -41.311017.Ref:.Figure.2-8.31120 |
| 168380 | 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 34 32 7f 33 31 32 30 31 37 0a 52 65 66 3a | 9.Ref:.Exercise.2-42.312017.Ref: |
| 1683a0 | 20 45 78 65 72 63 69 73 65 20 32 2d 34 33 7f 33 31 34 38 34 37 0a 52 65 66 3a 20 32 2d 32 2d 33 | .Exercise.2-43.314847.Ref:.2-2-3 |
| 1683c0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 33 31 35 37 37 34 0a 52 65 66 3a 20 32 2d 32 2d 33 2d 46 6f | -Footnote-1.315774.Ref:.2-2-3-Fo |
| 1683e0 | 6f 74 6e 6f 74 65 2d 32 7f 33 31 35 39 37 30 0a 52 65 66 3a 20 32 2d 32 2d 33 2d 46 6f 6f 74 6e | otnote-2.315970.Ref:.2-2-3-Footn |
| 168400 | 6f 74 65 2d 33 7f 33 31 36 36 39 34 0a 52 65 66 3a 20 32 2d 32 2d 33 2d 46 6f 6f 74 6e 6f 74 65 | ote-3.316694.Ref:.2-2-3-Footnote |
| 168420 | 2d 34 7f 33 31 37 36 34 31 0a 52 65 66 3a 20 32 2d 32 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f | -4.317641.Ref:.2-2-3-Footnote-5. |
| 168440 | 33 31 37 37 33 34 0a 52 65 66 3a 20 32 2d 32 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 33 31 38 | 317734.Ref:.2-2-3-Footnote-6.318 |
| 168460 | 30 38 35 0a 52 65 66 3a 20 32 2d 32 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 37 7f 33 31 38 32 35 32 | 085.Ref:.2-2-3-Footnote-7.318252 |
| 168480 | 0a 52 65 66 3a 20 32 2d 32 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 38 7f 33 31 38 33 32 30 0a 4e 6f | .Ref:.2-2-3-Footnote-8.318320.No |
| 1684a0 | 64 65 3a 20 32 2d 32 2d 34 7f 33 31 38 35 38 37 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 39 | de:.2-2-4.318587.Ref:.Figure.2-9 |
| 1684c0 | 7f 33 31 39 34 35 31 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 31 30 7f 33 32 31 34 31 33 0a | .319451.Ref:.Figure.2-10.321413. |
| 1684e0 | 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 31 31 7f 33 32 31 36 32 39 0a 52 65 66 3a 20 46 69 67 | Ref:.Figure.2-11.321629.Ref:.Fig |
| 168500 | 75 72 65 20 32 2d 31 32 7f 33 32 32 31 32 37 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 31 33 | ure.2-12.322127.Ref:.Figure.2-13 |
| 168520 | 7f 33 32 33 39 37 34 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 31 34 7f 33 32 35 36 38 37 0a | .323974.Ref:.Figure.2-14.325687. |
| 168540 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 34 34 7f 33 32 36 35 31 36 0a 52 65 66 3a 20 45 | Ref:.Exercise.2-44.326516.Ref:.E |
| 168560 | 78 65 72 63 69 73 65 20 32 2d 34 35 7f 33 32 38 34 34 35 0a 52 65 66 3a 20 46 69 67 75 72 65 20 | xercise.2-45.328445.Ref:.Figure. |
| 168580 | 32 2d 31 35 7f 33 32 39 37 34 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 34 36 7f 33 | 2-15.329747.Ref:.Exercise.2-46.3 |
| 1685a0 | 33 31 36 33 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 34 37 7f 33 33 32 33 34 31 0a | 31633.Ref:.Exercise.2-47.332341. |
| 1685c0 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 34 38 7f 33 33 34 33 31 38 0a 52 65 66 3a 20 45 | Ref:.Exercise.2-48.334318.Ref:.E |
| 1685e0 | 78 65 72 63 69 73 65 20 32 2d 34 39 7f 33 33 34 37 37 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | xercise.2-49.334773.Ref:.Exercis |
| 168600 | 65 20 32 2d 35 30 7f 33 33 39 33 38 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 35 31 | e.2-50.339384.Ref:.Exercise.2-51 |
| 168620 | 7f 33 33 39 35 38 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 35 32 7f 33 34 33 33 30 | .339582.Ref:.Exercise.2-52.34330 |
| 168640 | 39 0a 52 65 66 3a 20 32 2d 32 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 33 34 34 30 36 38 0a 52 | 9.Ref:.2-2-4-Footnote-1.344068.R |
| 168660 | 65 66 3a 20 32 2d 32 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 33 34 34 33 36 39 0a 52 65 66 3a | ef:.2-2-4-Footnote-2.344369.Ref: |
| 168680 | 20 32 2d 32 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 33 34 37 30 37 36 0a 52 65 66 3a 20 32 2d | .2-2-4-Footnote-3.347076.Ref:.2- |
| 1686a0 | 32 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 33 34 37 32 30 34 0a 52 65 66 3a 20 32 2d 32 2d 34 | 2-4-Footnote-4.347204.Ref:.2-2-4 |
| 1686c0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 33 34 37 34 31 35 0a 52 65 66 3a 20 32 2d 32 2d 34 2d 46 6f | -Footnote-5.347415.Ref:.2-2-4-Fo |
| 1686e0 | 6f 74 6e 6f 74 65 2d 36 7f 33 34 37 37 32 32 0a 52 65 66 3a 20 32 2d 32 2d 34 2d 46 6f 6f 74 6e | otnote-6.347722.Ref:.2-2-4-Footn |
| 168700 | 6f 74 65 2d 37 7f 33 34 37 39 30 39 0a 52 65 66 3a 20 32 2d 32 2d 34 2d 46 6f 6f 74 6e 6f 74 65 | ote-7.347909.Ref:.2-2-4-Footnote |
| 168720 | 2d 38 7f 33 34 38 37 31 38 0a 52 65 66 3a 20 32 2d 32 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 39 7f | -8.348718.Ref:.2-2-4-Footnote-9. |
| 168740 | 33 34 38 38 35 39 0a 52 65 66 3a 20 32 2d 32 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 30 7f 33 34 | 348859.Ref:.2-2-4-Footnote-10.34 |
| 168760 | 39 30 31 35 0a 4e 6f 64 65 3a 20 32 2d 33 7f 33 34 39 30 37 35 0a 4e 6f 64 65 3a 20 32 2d 33 2d | 9015.Node:.2-3.349075.Node:.2-3- |
| 168780 | 31 7f 33 34 39 36 31 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 35 33 7f 33 35 32 38 | 1.349615.Ref:.Exercise.2-53.3528 |
| 1687a0 | 34 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 35 34 7f 33 35 33 32 33 39 0a 52 65 66 | 45.Ref:.Exercise.2-54.353239.Ref |
| 1687c0 | 3a 20 45 78 65 72 63 69 73 65 20 32 2d 35 35 7f 33 35 33 39 31 32 0a 52 65 66 3a 20 32 2d 33 2d | :.Exercise.2-55.353912.Ref:.2-3- |
| 1687e0 | 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 33 35 34 31 32 33 0a 52 65 66 3a 20 32 2d 33 2d 31 2d 46 | 1-Footnote-1.354123.Ref:.2-3-1-F |
| 168800 | 6f 6f 74 6e 6f 74 65 2d 32 7f 33 35 35 30 37 37 0a 52 65 66 3a 20 32 2d 33 2d 31 2d 46 6f 6f 74 | ootnote-2.355077.Ref:.2-3-1-Foot |
| 168820 | 6e 6f 74 65 2d 33 7f 33 35 35 33 39 37 0a 52 65 66 3a 20 32 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 | note-3.355397.Ref:.2-3-1-Footnot |
| 168840 | 65 2d 34 7f 33 35 36 33 30 30 0a 52 65 66 3a 20 32 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 35 | e-4.356300.Ref:.2-3-1-Footnote-5 |
| 168860 | 7f 33 35 36 36 31 31 0a 4e 6f 64 65 3a 20 32 2d 33 2d 32 7f 33 35 37 30 39 30 0a 52 65 66 3a 20 | .356611.Node:.2-3-2.357090.Ref:. |
| 168880 | 45 78 65 72 63 69 73 65 20 32 2d 35 36 7f 33 36 36 32 38 32 0a 52 65 66 3a 20 45 78 65 72 63 69 | Exercise.2-56.366282.Ref:.Exerci |
| 1688a0 | 73 65 20 32 2d 35 37 7f 33 36 36 38 39 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 35 | se.2-57.366894.Ref:.Exercise.2-5 |
| 1688c0 | 38 7f 33 36 37 33 38 38 0a 4e 6f 64 65 3a 20 32 2d 33 2d 33 7f 33 36 38 36 32 31 0a 52 65 66 3a | 8.367388.Node:.2-3-3.368621.Ref: |
| 1688e0 | 20 45 78 65 72 63 69 73 65 20 32 2d 35 39 7f 33 37 32 37 35 38 0a 52 65 66 3a 20 45 78 65 72 63 | .Exercise.2-59.372758.Ref:.Exerc |
| 168900 | 69 73 65 20 32 2d 36 30 7f 33 37 32 38 36 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d | ise.2-60.372869.Ref:.Exercise.2- |
| 168920 | 36 31 7f 33 37 37 34 38 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 36 32 7f 33 37 37 | 61.377483.Ref:.Exercise.2-62.377 |
| 168940 | 37 39 32 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 31 36 7f 33 37 38 36 36 38 0a 52 65 66 3a | 792.Ref:.Figure.2-16.378668.Ref: |
| 168960 | 20 46 69 67 75 72 65 20 32 2d 31 37 7f 33 38 33 31 38 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | .Figure.2-17.383184.Ref:.Exercis |
| 168980 | 65 20 32 2d 36 33 7f 33 38 33 34 36 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 36 34 | e.2-63.383461.Ref:.Exercise.2-64 |
| 1689a0 | 7f 33 38 34 36 36 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 36 35 7f 33 38 36 34 34 | .384666.Ref:.Exercise.2-65.38644 |
| 1689c0 | 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 36 36 7f 33 38 39 34 30 38 0a 52 65 66 3a | 7.Ref:.Exercise.2-66.389408.Ref: |
| 1689e0 | 20 32 2d 33 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 33 38 39 36 31 39 0a 52 65 66 3a 20 32 2d | .2-3-3-Footnote-1.389619.Ref:.2- |
| 168a00 | 33 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 33 39 30 33 36 32 0a 52 65 66 3a 20 32 2d 33 2d 33 | 3-3-Footnote-2.390362.Ref:.2-3-3 |
| 168a20 | 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 33 39 30 36 31 31 0a 52 65 66 3a 20 32 2d 33 2d 33 2d 46 6f | -Footnote-3.390611.Ref:.2-3-3-Fo |
| 168a40 | 6f 74 6e 6f 74 65 2d 34 7f 33 39 30 39 38 36 0a 52 65 66 3a 20 32 2d 33 2d 33 2d 46 6f 6f 74 6e | otnote-4.390986.Ref:.2-3-3-Footn |
| 168a60 | 6f 74 65 2d 35 7f 33 39 31 31 37 37 0a 4e 6f 64 65 3a 20 32 2d 33 2d 34 7f 33 39 31 32 36 34 0a | ote-5.391177.Node:.2-3-4.391264. |
| 168a80 | 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 31 38 7f 33 39 34 38 34 36 0a 52 65 66 3a 20 45 78 65 | Ref:.Figure.2-18.394846.Ref:.Exe |
| 168aa0 | 72 63 69 73 65 20 32 2d 36 37 7f 34 30 34 38 39 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | rcise.2-67.404897.Ref:.Exercise. |
| 168ac0 | 32 2d 36 38 7f 34 30 35 34 30 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 36 39 7f 34 | 2-68.405406.Ref:.Exercise.2-69.4 |
| 168ae0 | 30 36 32 31 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 37 30 7f 34 30 37 32 30 30 0a | 06219.Ref:.Exercise.2-70.407200. |
| 168b00 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 37 31 7f 34 30 38 31 33 32 0a 52 65 66 3a 20 45 | Ref:.Exercise.2-71.408132.Ref:.E |
| 168b20 | 78 65 72 63 69 73 65 20 32 2d 37 32 7f 34 30 38 34 37 30 0a 52 65 66 3a 20 32 2d 33 2d 34 2d 46 | xercise.2-72.408470.Ref:.2-3-4-F |
| 168b40 | 6f 6f 74 6e 6f 74 65 2d 31 7f 34 30 39 31 34 31 0a 4e 6f 64 65 3a 20 32 2d 34 7f 34 30 39 32 33 | ootnote-1.409141.Node:.2-4.40923 |
| 168b60 | 32 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 31 39 7f 34 31 33 38 38 33 0a 4e 6f 64 65 3a 20 | 2.Ref:.Figure.2-19.413883.Node:. |
| 168b80 | 32 2d 34 2d 31 7f 34 31 35 31 33 35 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 32 30 7f 34 31 | 2-4-1.415135.Ref:.Figure.2-20.41 |
| 168ba0 | 36 39 31 37 0a 52 65 66 3a 20 32 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 34 32 32 34 30 | 6917.Ref:.2-4-1-Footnote-1.42240 |
| 168bc0 | 37 0a 52 65 66 3a 20 32 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 34 32 32 38 33 37 0a 4e | 7.Ref:.2-4-1-Footnote-2.422837.N |
| 168be0 | 6f 64 65 3a 20 32 2d 34 2d 32 7f 34 32 33 30 38 34 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d | ode:.2-4-2.423084.Ref:.Figure.2- |
| 168c00 | 32 31 7f 34 32 39 37 38 31 0a 4e 6f 64 65 3a 20 32 2d 34 2d 33 7f 34 33 32 31 31 33 0a 52 65 66 | 21.429781.Node:.2-4-3.432113.Ref |
| 168c20 | 3a 20 46 69 67 75 72 65 20 32 2d 32 32 7f 34 33 36 30 32 34 0a 52 65 66 3a 20 45 78 65 72 63 69 | :.Figure.2-22.436024.Ref:.Exerci |
| 168c40 | 73 65 20 32 2d 37 33 7f 34 34 32 31 33 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 37 | se.2-73.442131.Ref:.Exercise.2-7 |
| 168c60 | 34 7f 34 34 34 36 34 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 37 35 7f 34 34 39 39 | 4.444642.Ref:.Exercise.2-75.4499 |
| 168c80 | 30 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 37 36 7f 34 35 30 30 39 38 0a 52 65 66 | 05.Ref:.Exercise.2-76.450098.Ref |
| 168ca0 | 3a 20 32 2d 34 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 34 35 30 37 31 31 0a 52 65 66 3a 20 32 | :.2-4-3-Footnote-1.450711.Ref:.2 |
| 168cc0 | 2d 34 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 34 35 30 38 38 32 0a 52 65 66 3a 20 32 2d 34 2d | -4-3-Footnote-2.450882.Ref:.2-4- |
| 168ce0 | 33 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 34 35 31 30 33 33 0a 52 65 66 3a 20 32 2d 34 2d 33 2d 46 | 3-Footnote-3.451033.Ref:.2-4-3-F |
| 168d00 | 6f 6f 74 6e 6f 74 65 2d 34 7f 34 35 31 35 39 34 0a 4e 6f 64 65 3a 20 32 2d 35 7f 34 35 31 36 39 | ootnote-4.451594.Node:.2-5.45169 |
| 168d20 | 33 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 32 33 7f 34 35 33 36 32 39 0a 4e 6f 64 65 3a 20 | 3.Ref:.Figure.2-23.453629.Node:. |
| 168d40 | 32 2d 35 2d 31 7f 34 35 34 37 38 34 0a 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 32 34 7f 34 36 | 2-5-1.454784.Ref:.Figure.2-24.46 |
| 168d60 | 32 31 33 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 37 37 7f 34 36 32 39 37 32 0a 52 | 2133.Ref:.Exercise.2-77.462972.R |
| 168d80 | 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 37 38 7f 34 36 34 31 31 30 0a 52 65 66 3a 20 45 78 | ef:.Exercise.2-78.464110.Ref:.Ex |
| 168da0 | 65 72 63 69 73 65 20 32 2d 37 39 7f 34 36 35 30 35 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | ercise.2-79.465056.Ref:.Exercise |
| 168dc0 | 20 32 2d 38 30 7f 34 36 35 33 31 36 0a 4e 6f 64 65 3a 20 32 2d 35 2d 32 7f 34 36 35 35 35 39 0a | .2-80.465316.Node:.2-5-2.465559. |
| 168de0 | 52 65 66 3a 20 46 69 67 75 72 65 20 32 2d 32 35 7f 34 37 34 34 36 35 0a 52 65 66 3a 20 46 69 67 | Ref:.Figure.2-25.474465.Ref:.Fig |
| 168e00 | 75 72 65 20 32 2d 32 36 7f 34 37 37 31 37 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d | ure.2-26.477175.Ref:.Exercise.2- |
| 168e20 | 38 31 7f 34 37 39 34 37 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 38 32 7f 34 38 31 | 81.479477.Ref:.Exercise.2-82.481 |
| 168e40 | 32 37 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 38 33 7f 34 38 31 38 33 31 0a 52 65 | 274.Ref:.Exercise.2-83.481831.Re |
| 168e60 | 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 38 34 7f 34 38 32 32 33 38 0a 52 65 66 3a 20 45 78 65 | f:.Exercise.2-84.482238.Ref:.Exe |
| 168e80 | 72 63 69 73 65 20 32 2d 38 35 7f 34 38 32 37 32 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | rcise.2-85.482721.Ref:.Exercise. |
| 168ea0 | 32 2d 38 36 7f 34 38 34 32 31 33 0a 52 65 66 3a 20 32 2d 35 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d | 2-86.484213.Ref:.2-5-2-Footnote- |
| 168ec0 | 31 7f 34 38 34 37 30 32 0a 52 65 66 3a 20 32 2d 35 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 34 | 1.484702.Ref:.2-5-2-Footnote-2.4 |
| 168ee0 | 38 34 38 31 30 0a 52 65 66 3a 20 32 2d 35 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 34 38 34 38 | 84810.Ref:.2-5-2-Footnote-3.4848 |
| 168f00 | 36 35 0a 52 65 66 3a 20 32 2d 35 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 34 38 35 34 39 37 0a | 65.Ref:.2-5-2-Footnote-4.485497. |
| 168f20 | 52 65 66 3a 20 32 2d 35 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 34 38 36 37 36 37 0a 4e 6f 64 | Ref:.2-5-2-Footnote-5.486767.Nod |
| 168f40 | 65 3a 20 32 2d 35 2d 33 7f 34 38 36 39 30 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d | e:.2-5-3.486900.Ref:.Exercise.2- |
| 168f60 | 38 37 7f 35 30 31 30 36 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 38 38 7f 35 30 31 | 87.501069.Ref:.Exercise.2-88.501 |
| 168f80 | 32 37 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 38 39 7f 35 30 31 34 35 30 0a 52 65 | 276.Ref:.Exercise.2-89.501450.Re |
| 168fa0 | 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 39 30 7f 35 30 31 35 39 39 0a 52 65 66 3a 20 45 78 65 | f:.Exercise.2-90.501599.Ref:.Exe |
| 168fc0 | 72 63 69 73 65 20 32 2d 39 31 7f 35 30 32 32 31 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | rcise.2-91.502211.Ref:.Exercise. |
| 168fe0 | 32 2d 39 32 7f 35 30 37 30 39 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 39 33 7f 35 | 2-92.507097.Ref:.Exercise.2-93.5 |
| 169000 | 30 38 32 31 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 39 34 7f 35 30 39 38 31 39 0a | 08218.Ref:.Exercise.2-94.509819. |
| 169020 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 32 2d 39 35 7f 35 31 30 35 33 33 0a 52 65 66 3a 20 45 | Ref:.Exercise.2-95.510533.Ref:.E |
| 169040 | 78 65 72 63 69 73 65 20 32 2d 39 36 7f 35 31 32 35 35 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | xercise.2-96.512557.Ref:.Exercis |
| 169060 | 65 20 32 2d 39 37 7f 35 31 34 35 39 33 0a 52 65 66 3a 20 32 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 | e.2-97.514593.Ref:.2-5-3-Footnot |
| 169080 | 65 2d 31 7f 35 31 37 32 30 38 0a 52 65 66 3a 20 32 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 32 | e-1.517208.Ref:.2-5-3-Footnote-2 |
| 1690a0 | 7f 35 31 37 34 38 35 0a 52 65 66 3a 20 32 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 35 31 | .517485.Ref:.2-5-3-Footnote-3.51 |
| 1690c0 | 38 30 34 38 0a 52 65 66 3a 20 32 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 35 31 38 33 37 | 8048.Ref:.2-5-3-Footnote-4.51837 |
| 1690e0 | 37 0a 52 65 66 3a 20 32 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 35 31 38 37 38 31 0a 52 | 7.Ref:.2-5-3-Footnote-5.518781.R |
| 169100 | 65 66 3a 20 32 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 35 31 39 31 30 31 0a 52 65 66 3a | ef:.2-5-3-Footnote-6.519101.Ref: |
| 169120 | 20 32 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 37 7f 35 31 39 36 33 39 0a 52 65 66 3a 20 32 2d | .2-5-3-Footnote-7.519639.Ref:.2- |
| 169140 | 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 38 7f 35 32 30 34 34 31 0a 52 65 66 3a 20 32 2d 35 2d 33 | 5-3-Footnote-8.520441.Ref:.2-5-3 |
| 169160 | 2d 46 6f 6f 74 6e 6f 74 65 2d 39 7f 35 32 30 37 33 31 0a 4e 6f 64 65 3a 20 43 68 61 70 74 65 72 | -Footnote-9.520731.Node:.Chapter |
| 169180 | 20 33 7f 35 32 31 30 36 37 0a 4e 6f 64 65 3a 20 33 2d 31 7f 35 32 34 36 36 34 0a 4e 6f 64 65 3a | .3.521067.Node:.3-1.524664.Node: |
| 1691a0 | 20 33 2d 31 2d 31 7f 35 32 37 30 35 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 31 7f | .3-1-1.527051.Ref:.Exercise.3-1. |
| 1691c0 | 35 33 35 34 34 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 32 7f 35 33 35 39 38 39 0a | 535441.Ref:.Exercise.3-2.535989. |
| 1691e0 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 33 7f 35 33 36 39 38 36 0a 52 65 66 3a 20 45 78 | Ref:.Exercise.3-3.536986.Ref:.Ex |
| 169200 | 65 72 63 69 73 65 20 33 2d 34 7f 35 33 37 35 37 35 0a 52 65 66 3a 20 33 2d 31 2d 31 2d 46 6f 6f | ercise.3-4.537575.Ref:.3-1-1-Foo |
| 169220 | 74 6e 6f 74 65 2d 31 7f 35 33 37 38 38 30 0a 52 65 66 3a 20 33 2d 31 2d 31 2d 46 6f 6f 74 6e 6f | tnote-1.537880.Ref:.3-1-1-Footno |
| 169240 | 74 65 2d 32 7f 35 33 38 32 39 35 0a 52 65 66 3a 20 33 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d | te-2.538295.Ref:.3-1-1-Footnote- |
| 169260 | 33 7f 35 33 38 37 36 34 0a 52 65 66 3a 20 33 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 35 | 3.538764.Ref:.3-1-1-Footnote-4.5 |
| 169280 | 33 39 30 33 37 0a 52 65 66 3a 20 33 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 35 33 39 34 | 39037.Ref:.3-1-1-Footnote-5.5394 |
| 1692a0 | 35 38 0a 4e 6f 64 65 3a 20 33 2d 31 2d 32 7f 35 33 39 37 35 33 0a 52 65 66 3a 20 45 78 65 72 63 | 58.Node:.3-1-2.539753.Ref:.Exerc |
| 1692c0 | 69 73 65 20 33 2d 35 7f 35 34 36 35 33 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 36 | ise.3-5.546537.Ref:.Exercise.3-6 |
| 1692e0 | 7f 35 34 38 37 39 36 0a 52 65 66 3a 20 33 2d 31 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 35 34 | .548796.Ref:.3-1-2-Footnote-1.54 |
| 169300 | 39 34 34 39 0a 52 65 66 3a 20 33 2d 31 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 35 35 30 34 37 | 9449.Ref:.3-1-2-Footnote-2.55047 |
| 169320 | 35 0a 52 65 66 3a 20 33 2d 31 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 35 35 30 35 38 31 0a 4e | 5.Ref:.3-1-2-Footnote-3.550581.N |
| 169340 | 6f 64 65 3a 20 33 2d 31 2d 33 7f 35 35 30 38 31 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | ode:.3-1-3.550810.Ref:.Exercise. |
| 169360 | 33 2d 37 7f 35 36 31 39 35 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 38 7f 35 36 33 | 3-7.561953.Ref:.Exercise.3-8.563 |
| 169380 | 30 32 36 0a 52 65 66 3a 20 33 2d 31 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 35 36 33 37 34 33 | 026.Ref:.3-1-3-Footnote-1.563743 |
| 1693a0 | 0a 52 65 66 3a 20 33 2d 31 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 35 36 33 39 36 39 0a 52 65 | .Ref:.3-1-3-Footnote-2.563969.Re |
| 1693c0 | 66 3a 20 33 2d 31 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 35 36 34 37 38 32 0a 4e 6f 64 65 3a | f:.3-1-3-Footnote-3.564782.Node: |
| 1693e0 | 20 33 2d 32 7f 35 36 35 34 34 32 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 31 7f 35 36 37 31 | .3-2.565442.Ref:.Figure.3-1.5671 |
| 169400 | 30 33 0a 4e 6f 64 65 3a 20 33 2d 32 2d 31 7f 35 36 39 37 35 31 0a 52 65 66 3a 20 46 69 67 75 72 | 03.Node:.3-2-1.569751.Ref:.Figur |
| 169420 | 65 20 33 2d 32 7f 35 37 31 38 31 38 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 33 7f 35 37 33 | e.3-2.571818.Ref:.Figure.3-3.573 |
| 169440 | 38 32 31 0a 52 65 66 3a 20 33 2d 32 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 35 37 36 36 32 35 | 821.Ref:.3-2-1-Footnote-1.576625 |
| 169460 | 0a 52 65 66 3a 20 33 2d 32 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 35 37 37 33 30 32 0a 4e 6f | .Ref:.3-2-1-Footnote-2.577302.No |
| 169480 | 64 65 3a 20 33 2d 32 2d 32 7f 35 37 37 37 31 36 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 34 | de:.3-2-2.577716.Ref:.Figure.3-4 |
| 1694a0 | 7f 35 37 38 35 31 38 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 35 7f 35 37 39 39 37 37 0a 52 | .578518.Ref:.Figure.3-5.579977.R |
| 1694c0 | 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 39 7f 35 38 33 31 30 39 0a 52 65 66 3a 20 33 2d 32 | ef:.Exercise.3-9.583109.Ref:.3-2 |
| 1694e0 | 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 35 38 33 38 39 33 0a 4e 6f 64 65 3a 20 33 2d 32 2d 33 | -2-Footnote-1.583893.Node:.3-2-3 |
| 169500 | 7f 35 38 34 32 30 37 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 36 7f 35 38 35 32 37 36 0a 52 | .584207.Ref:.Figure.3-6.585276.R |
| 169520 | 65 66 3a 20 46 69 67 75 72 65 20 33 2d 37 7f 35 38 37 30 31 35 0a 52 65 66 3a 20 46 69 67 75 72 | ef:.Figure.3-7.587015.Ref:.Figur |
| 169540 | 65 20 33 2d 38 7f 35 38 39 32 31 32 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 39 7f 35 39 31 | e.3-8.589212.Ref:.Figure.3-9.591 |
| 169560 | 33 38 38 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 31 30 7f 35 39 33 31 38 38 0a 52 65 66 3a | 388.Ref:.Figure.3-10.593188.Ref: |
| 169580 | 20 45 78 65 72 63 69 73 65 20 33 2d 31 30 7f 35 39 34 34 31 37 0a 52 65 66 3a 20 33 2d 32 2d 33 | .Exercise.3-10.594417.Ref:.3-2-3 |
| 1695a0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 35 39 35 36 35 32 0a 4e 6f 64 65 3a 20 33 2d 32 2d 34 7f 35 | -Footnote-1.595652.Node:.3-2-4.5 |
| 1695c0 | 39 35 39 30 30 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 31 31 7f 35 39 36 38 31 31 0a 52 65 | 95900.Ref:.Figure.3-11.596811.Re |
| 1695e0 | 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 31 31 7f 36 30 31 31 36 34 0a 4e 6f 64 65 3a 20 33 2d | f:.Exercise.3-11.601164.Node:.3- |
| 169600 | 33 7f 36 30 32 36 31 32 0a 4e 6f 64 65 3a 20 33 2d 33 2d 31 7f 36 30 34 37 39 30 0a 52 65 66 3a | 3.602612.Node:.3-3-1.604790.Ref: |
| 169620 | 20 46 69 67 75 72 65 20 33 2d 31 32 7f 36 30 35 33 32 32 0a 52 65 66 3a 20 46 69 67 75 72 65 20 | .Figure.3-12.605322.Ref:.Figure. |
| 169640 | 33 2d 31 33 7f 36 30 36 34 34 36 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 31 34 7f 36 30 37 | 3-13.606446.Ref:.Figure.3-14.607 |
| 169660 | 35 39 36 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 31 35 7f 36 30 38 37 35 39 0a 52 65 66 3a | 596.Ref:.Figure.3-15.608759.Ref: |
| 169680 | 20 45 78 65 72 63 69 73 65 20 33 2d 31 32 7f 36 31 32 30 32 30 0a 52 65 66 3a 20 45 78 65 72 63 | .Exercise.3-12.612020.Ref:.Exerc |
| 1696a0 | 69 73 65 20 33 2d 31 33 7f 36 31 33 33 34 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d | ise.3-13.613349.Ref:.Exercise.3- |
| 1696c0 | 31 34 7f 36 31 33 37 37 38 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 31 36 7f 36 31 35 34 37 | 14.613778.Ref:.Figure.3-16.61547 |
| 1696e0 | 32 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 31 37 7f 36 31 35 38 39 36 0a 52 65 66 3a 20 45 | 2.Ref:.Figure.3-17.615896.Ref:.E |
| 169700 | 78 65 72 63 69 73 65 20 33 2d 31 35 7f 36 31 38 38 30 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | xercise.3-15.618802.Ref:.Exercis |
| 169720 | 65 20 33 2d 31 36 7f 36 31 38 39 33 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 31 37 | e.3-16.618938.Ref:.Exercise.3-17 |
| 169740 | 7f 36 31 39 37 32 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 31 38 7f 36 32 30 30 34 | .619721.Ref:.Exercise.3-18.62004 |
| 169760 | 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 31 39 7f 36 32 30 33 34 36 0a 52 65 66 3a | 7.Ref:.Exercise.3-19.620346.Ref: |
| 169780 | 20 45 78 65 72 63 69 73 65 20 33 2d 32 30 7f 36 32 32 31 30 38 0a 52 65 66 3a 20 33 2d 33 2d 31 | .Exercise.3-20.622108.Ref:.3-3-1 |
| 1697a0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 36 32 32 34 38 34 0a 52 65 66 3a 20 33 2d 33 2d 31 2d 46 6f | -Footnote-1.622484.Ref:.3-3-1-Fo |
| 1697c0 | 6f 74 6e 6f 74 65 2d 32 7f 36 32 32 36 31 35 0a 52 65 66 3a 20 33 2d 33 2d 31 2d 46 6f 6f 74 6e | otnote-2.622615.Ref:.3-3-1-Footn |
| 1697e0 | 6f 74 65 2d 33 7f 36 32 32 39 31 37 0a 52 65 66 3a 20 33 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 | ote-3.622917.Ref:.3-3-1-Footnote |
| 169800 | 2d 34 7f 36 32 33 31 30 36 0a 52 65 66 3a 20 33 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f | -4.623106.Ref:.3-3-1-Footnote-5. |
| 169820 | 36 32 33 34 37 31 0a 52 65 66 3a 20 33 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 36 32 34 | 623471.Ref:.3-3-1-Footnote-6.624 |
| 169840 | 33 34 31 0a 4e 6f 64 65 3a 20 33 2d 33 2d 32 7f 36 32 34 35 39 32 0a 52 65 66 3a 20 46 69 67 75 | 341.Node:.3-3-2.624592.Ref:.Figu |
| 169860 | 72 65 20 33 2d 31 38 7f 36 32 35 34 38 38 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 31 39 7f | re.3-18.625488.Ref:.Figure.3-19. |
| 169880 | 36 32 38 34 39 35 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 32 30 7f 36 33 30 36 33 34 0a 52 | 628495.Ref:.Figure.3-20.630634.R |
| 1698a0 | 65 66 3a 20 46 69 67 75 72 65 20 33 2d 32 31 7f 36 33 32 31 32 36 0a 52 65 66 3a 20 45 78 65 72 | ef:.Figure.3-21.632126.Ref:.Exer |
| 1698c0 | 63 69 73 65 20 33 2d 32 31 7f 36 33 33 32 33 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 | cise.3-21.633233.Ref:.Exercise.3 |
| 1698e0 | 2d 32 32 7f 36 33 34 35 34 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 32 33 7f 36 33 | -22.634543.Ref:.Exercise.3-23.63 |
| 169900 | 35 31 38 37 0a 52 65 66 3a 20 33 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 36 33 35 37 38 | 5187.Ref:.3-3-2-Footnote-1.63578 |
| 169920 | 38 0a 52 65 66 3a 20 33 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 36 33 36 30 39 33 0a 4e | 8.Ref:.3-3-2-Footnote-2.636093.N |
| 169940 | 6f 64 65 3a 20 33 2d 33 2d 33 7f 36 33 36 32 31 37 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d | ode:.3-3-3.636217.Ref:.Figure.3- |
| 169960 | 32 32 7f 36 33 37 35 33 35 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 32 33 7f 36 34 30 36 34 | 22.637535.Ref:.Figure.3-23.64064 |
| 169980 | 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 32 34 7f 36 34 36 32 31 33 0a 52 65 66 3a | 0.Ref:.Exercise.3-24.646213.Ref: |
| 1699a0 | 20 45 78 65 72 63 69 73 65 20 33 2d 32 35 7f 36 34 36 38 38 30 0a 52 65 66 3a 20 45 78 65 72 63 | .Exercise.3-25.646880.Ref:.Exerc |
| 1699c0 | 69 73 65 20 33 2d 32 36 7f 36 34 37 32 32 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d | ise.3-26.647229.Ref:.Exercise.3- |
| 1699e0 | 32 37 7f 36 34 37 37 38 37 0a 52 65 66 3a 20 33 2d 33 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f | 27.647787.Ref:.3-3-3-Footnote-1. |
| 169a00 | 36 34 39 37 38 39 0a 52 65 66 3a 20 33 2d 33 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 36 34 39 | 649789.Ref:.3-3-3-Footnote-2.649 |
| 169a20 | 38 39 36 0a 4e 6f 64 65 3a 20 33 2d 33 2d 34 7f 36 35 30 32 33 34 0a 52 65 66 3a 20 46 69 67 75 | 896.Node:.3-3-4.650234.Ref:.Figu |
| 169a40 | 72 65 20 33 2d 32 34 7f 36 35 32 36 33 30 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 32 35 7f | re.3-24.652630.Ref:.Figure.3-25. |
| 169a60 | 36 35 33 36 30 36 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 32 36 7f 36 35 36 35 32 37 0a 52 | 653606.Ref:.Figure.3-26.656527.R |
| 169a80 | 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 32 38 7f 36 36 30 30 31 38 0a 52 65 66 3a 20 45 78 | ef:.Exercise.3-28.660018.Ref:.Ex |
| 169aa0 | 65 72 63 69 73 65 20 33 2d 32 39 7f 36 36 30 31 35 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | ercise.3-29.660153.Ref:.Exercise |
| 169ac0 | 20 33 2d 33 30 7f 36 36 30 34 35 30 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 32 37 7f 36 36 | .3-30.660450.Ref:.Figure.3-27.66 |
| 169ae0 | 31 34 31 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 33 31 7f 36 36 38 39 30 36 0a 52 | 1415.Ref:.Exercise.3-31.668906.R |
| 169b00 | 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 33 32 7f 36 37 33 35 38 31 0a 52 65 66 3a 20 33 2d | ef:.Exercise.3-32.673581.Ref:.3- |
| 169b20 | 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 36 37 34 31 39 34 0a 52 65 66 3a 20 33 2d 33 2d 34 | 3-4-Footnote-1.674194.Ref:.3-3-4 |
| 169b40 | 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 36 37 34 35 37 39 0a 52 65 66 3a 20 46 6f 6f 74 6e 6f 74 65 | -Footnote-2.674579.Ref:.Footnote |
| 169b60 | 20 32 37 7f 36 37 34 35 39 39 0a 52 65 66 3a 20 33 2d 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 33 | .27.674599.Ref:.3-3-4-Footnote-3 |
| 169b80 | 7f 36 37 35 33 36 36 0a 52 65 66 3a 20 33 2d 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 36 37 | .675366.Ref:.3-3-4-Footnote-4.67 |
| 169ba0 | 35 35 37 38 0a 52 65 66 3a 20 33 2d 33 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 36 37 35 39 30 | 5578.Ref:.3-3-4-Footnote-5.67590 |
| 169bc0 | 31 0a 4e 6f 64 65 3a 20 33 2d 33 2d 35 7f 36 37 36 31 34 31 0a 52 65 66 3a 20 46 69 67 75 72 65 | 1.Node:.3-3-5.676141.Ref:.Figure |
| 169be0 | 20 33 2d 32 38 7f 36 37 38 38 36 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 33 33 7f | .3-28.678861.Ref:.Exercise.3-33. |
| 169c00 | 36 39 34 36 33 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 33 34 7f 36 39 34 39 32 31 | 694633.Ref:.Exercise.3-34.694921 |
| 169c20 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 33 35 7f 36 39 35 33 35 34 0a 52 65 66 3a 20 | .Ref:.Exercise.3-35.695354.Ref:. |
| 169c40 | 45 78 65 72 63 69 73 65 20 33 2d 33 36 7f 36 39 36 30 36 36 0a 52 65 66 3a 20 45 78 65 72 63 69 | Exercise.3-36.696066.Ref:.Exerci |
| 169c60 | 73 65 20 33 2d 33 37 7f 36 39 36 36 30 33 0a 52 65 66 3a 20 33 2d 33 2d 35 2d 46 6f 6f 74 6e 6f | se.3-37.696603.Ref:.3-3-5-Footno |
| 169c80 | 74 65 2d 31 7f 36 39 37 35 34 38 0a 52 65 66 3a 20 33 2d 33 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d | te-1.697548.Ref:.3-3-5-Footnote- |
| 169ca0 | 32 7f 36 39 38 30 36 37 0a 52 65 66 3a 20 33 2d 33 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 36 | 2.698067.Ref:.3-3-5-Footnote-3.6 |
| 169cc0 | 39 38 31 37 36 0a 4e 6f 64 65 3a 20 33 2d 34 7f 37 30 30 31 33 34 0a 52 65 66 3a 20 33 2d 34 2d | 98176.Node:.3-4.700134.Ref:.3-4- |
| 169ce0 | 46 6f 6f 74 6e 6f 74 65 2d 31 7f 37 30 33 36 30 35 0a 4e 6f 64 65 3a 20 33 2d 34 2d 31 7f 37 30 | Footnote-1.703605.Node:.3-4-1.70 |
| 169d00 | 33 39 34 30 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 32 39 7f 37 30 38 37 30 32 0a 52 65 66 | 3940.Ref:.Figure.3-29.708702.Ref |
| 169d20 | 3a 20 46 69 67 75 72 65 20 33 2d 33 30 7f 37 31 31 35 32 37 0a 52 65 66 3a 20 45 78 65 72 63 69 | :.Figure.3-30.711527.Ref:.Exerci |
| 169d40 | 73 65 20 33 2d 33 38 7f 37 31 34 34 32 35 0a 52 65 66 3a 20 33 2d 34 2d 31 2d 46 6f 6f 74 6e 6f | se.3-38.714425.Ref:.3-4-1-Footno |
| 169d60 | 74 65 2d 31 7f 37 31 35 33 36 34 0a 52 65 66 3a 20 33 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d | te-1.715364.Ref:.3-4-1-Footnote- |
| 169d80 | 32 7f 37 31 35 35 31 30 0a 52 65 66 3a 20 33 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 37 | 2.715510.Ref:.3-4-1-Footnote-3.7 |
| 169da0 | 31 36 33 31 38 0a 52 65 66 3a 20 33 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 37 31 36 34 | 16318.Ref:.3-4-1-Footnote-4.7164 |
| 169dc0 | 32 33 0a 52 65 66 3a 20 33 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 37 31 36 37 30 39 0a | 23.Ref:.3-4-1-Footnote-5.716709. |
| 169de0 | 52 65 66 3a 20 46 6f 6f 74 6e 6f 74 65 20 33 39 7f 37 31 36 37 32 39 0a 4e 6f 64 65 3a 20 33 2d | Ref:.Footnote.39.716729.Node:.3- |
| 169e00 | 34 2d 32 7f 37 31 37 30 35 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 33 39 7f 37 32 | 4-2.717055.Ref:.Exercise.3-39.72 |
| 169e20 | 33 32 34 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 34 30 7f 37 32 33 36 30 32 0a 52 | 3243.Ref:.Exercise.3-40.723602.R |
| 169e40 | 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 34 31 7f 37 32 34 31 31 35 0a 52 65 66 3a 20 45 78 | ef:.Exercise.3-41.724115.Ref:.Ex |
| 169e60 | 65 72 63 69 73 65 20 33 2d 34 32 7f 37 32 35 33 31 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | ercise.3-42.725311.Ref:.Exercise |
| 169e80 | 20 33 2d 34 33 7f 37 33 30 37 37 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 34 34 7f | .3-43.730773.Ref:.Exercise.3-44. |
| 169ea0 | 37 33 31 36 33 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 34 35 7f 37 33 32 36 32 32 | 731634.Ref:.Exercise.3-45.732622 |
| 169ec0 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 34 36 7f 37 33 37 39 30 38 0a 52 65 66 3a 20 | .Ref:.Exercise.3-46.737908.Ref:. |
| 169ee0 | 45 78 65 72 63 69 73 65 20 33 2d 34 37 7f 37 33 38 32 37 35 0a 52 65 66 3a 20 45 78 65 72 63 69 | Exercise.3-47.738275.Ref:.Exerci |
| 169f00 | 73 65 20 33 2d 34 38 7f 37 34 30 31 34 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 34 | se.3-48.740140.Ref:.Exercise.3-4 |
| 169f20 | 39 7f 37 34 30 36 31 38 0a 52 65 66 3a 20 33 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 37 | 9.740618.Ref:.3-4-2-Footnote-1.7 |
| 169f40 | 34 33 37 32 36 0a 52 65 66 3a 20 33 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 37 34 34 30 | 43726.Ref:.3-4-2-Footnote-2.7440 |
| 169f60 | 38 37 0a 52 65 66 3a 20 33 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 37 34 34 32 34 39 0a | 87.Ref:.3-4-2-Footnote-3.744249. |
| 169f80 | 52 65 66 3a 20 33 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 37 34 34 35 33 36 0a 52 65 66 | Ref:.3-4-2-Footnote-4.744536.Ref |
| 169fa0 | 3a 20 33 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 37 34 34 36 36 33 0a 52 65 66 3a 20 33 | :.3-4-2-Footnote-5.744663.Ref:.3 |
| 169fc0 | 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 37 34 35 35 33 34 0a 52 65 66 3a 20 33 2d 34 2d | -4-2-Footnote-6.745534.Ref:.3-4- |
| 169fe0 | 32 2d 46 6f 6f 74 6e 6f 74 65 2d 37 7f 37 34 35 38 31 34 0a 52 65 66 3a 20 33 2d 34 2d 32 2d 46 | 2-Footnote-7.745814.Ref:.3-4-2-F |
| 16a000 | 6f 6f 74 6e 6f 74 65 2d 38 7f 37 34 36 32 34 35 0a 52 65 66 3a 20 33 2d 34 2d 32 2d 46 6f 6f 74 | ootnote-8.746245.Ref:.3-4-2-Foot |
| 16a020 | 6e 6f 74 65 2d 39 7f 37 34 37 33 37 37 0a 52 65 66 3a 20 33 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 | note-9.747377.Ref:.3-4-2-Footnot |
| 16a040 | 65 2d 31 30 7f 37 34 37 38 31 36 0a 52 65 66 3a 20 33 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d | e-10.747816.Ref:.3-4-2-Footnote- |
| 16a060 | 31 31 7f 37 34 38 34 31 33 0a 52 65 66 3a 20 33 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 32 | 11.748413.Ref:.3-4-2-Footnote-12 |
| 16a080 | 7f 37 34 38 37 35 33 0a 4e 6f 64 65 3a 20 33 2d 35 7f 37 34 38 39 37 34 0a 52 65 66 3a 20 33 2d | .748753.Node:.3-5.748974.Ref:.3- |
| 16a0a0 | 35 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 37 35 32 30 34 39 0a 4e 6f 64 65 3a 20 33 2d 35 2d 31 7f | 5-Footnote-1.752049.Node:.3-5-1. |
| 16a0c0 | 37 35 32 33 39 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 35 30 7f 37 36 35 37 39 31 | 752393.Ref:.Exercise.3-50.765791 |
| 16a0e0 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 35 31 7f 37 36 36 33 31 34 0a 52 65 66 3a 20 | .Ref:.Exercise.3-51.766314.Ref:. |
| 16a100 | 45 78 65 72 63 69 73 65 20 33 2d 35 32 7f 37 36 36 38 30 37 0a 52 65 66 3a 20 33 2d 35 2d 31 2d | Exercise.3-52.766807.Ref:.3-5-1- |
| 16a120 | 46 6f 6f 74 6e 6f 74 65 2d 31 7f 37 36 37 36 36 30 0a 52 65 66 3a 20 33 2d 35 2d 31 2d 46 6f 6f | Footnote-1.767660.Ref:.3-5-1-Foo |
| 16a140 | 74 6e 6f 74 65 2d 32 7f 37 36 37 37 37 31 0a 52 65 66 3a 20 33 2d 35 2d 31 2d 46 6f 6f 74 6e 6f | tnote-2.767771.Ref:.3-5-1-Footno |
| 16a160 | 74 65 2d 33 7f 37 36 37 39 30 35 0a 52 65 66 3a 20 33 2d 35 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d | te-3.767905.Ref:.3-5-1-Footnote- |
| 16a180 | 34 7f 37 36 38 33 37 34 0a 52 65 66 3a 20 33 2d 35 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 37 | 4.768374.Ref:.3-5-1-Footnote-5.7 |
| 16a1a0 | 36 38 38 30 30 0a 52 65 66 3a 20 33 2d 35 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 37 36 39 31 | 68800.Ref:.3-5-1-Footnote-6.7691 |
| 16a1c0 | 30 32 0a 52 65 66 3a 20 33 2d 35 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 37 7f 37 36 39 38 34 30 0a | 02.Ref:.3-5-1-Footnote-7.769840. |
| 16a1e0 | 4e 6f 64 65 3a 20 33 2d 35 2d 32 7f 37 37 30 36 32 32 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 | Node:.3-5-2.770622.Ref:.Figure.3 |
| 16a200 | 2d 33 31 7f 37 37 34 35 36 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 35 33 7f 37 37 | -31.774565.Ref:.Exercise.3-53.77 |
| 16a220 | 39 35 34 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 35 34 7f 37 37 39 37 30 31 0a 52 | 9541.Ref:.Exercise.3-54.779701.R |
| 16a240 | 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 35 35 7f 37 38 30 30 39 37 0a 52 65 66 3a 20 45 78 | ef:.Exercise.3-55.780097.Ref:.Ex |
| 16a260 | 65 72 63 69 73 65 20 33 2d 35 36 7f 37 38 30 33 36 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | ercise.3-56.780366.Ref:.Exercise |
| 16a280 | 20 33 2d 35 37 7f 37 38 32 32 39 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 35 38 7f | .3-57.782294.Ref:.Exercise.3-58. |
| 16a2a0 | 37 38 32 37 33 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 35 39 7f 37 38 33 32 30 38 | 782733.Ref:.Exercise.3-59.783208 |
| 16a2c0 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 36 30 7f 37 38 35 35 33 31 0a 52 65 66 3a 20 | .Ref:.Exercise.3-60.785531.Ref:. |
| 16a2e0 | 45 78 65 72 63 69 73 65 20 33 2d 36 31 7f 37 38 35 39 39 37 0a 52 65 66 3a 20 45 78 65 72 63 69 | Exercise.3-61.785997.Ref:.Exerci |
| 16a300 | 73 65 20 33 2d 36 32 7f 37 38 36 37 37 35 0a 52 65 66 3a 20 33 2d 35 2d 32 2d 46 6f 6f 74 6e 6f | se.3-62.786775.Ref:.3-5-2-Footno |
| 16a320 | 74 65 2d 31 7f 37 38 37 33 32 38 0a 52 65 66 3a 20 33 2d 35 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d | te-1.787328.Ref:.3-5-2-Footnote- |
| 16a340 | 32 7f 37 38 37 39 31 34 0a 52 65 66 3a 20 33 2d 35 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 37 | 2.787914.Ref:.3-5-2-Footnote-3.7 |
| 16a360 | 38 38 32 36 36 0a 52 65 66 3a 20 33 2d 35 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 37 38 38 33 | 88266.Ref:.3-5-2-Footnote-4.7883 |
| 16a380 | 35 32 0a 52 65 66 3a 20 33 2d 35 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 37 38 38 39 35 30 0a | 52.Ref:.3-5-2-Footnote-5.788950. |
| 16a3a0 | 4e 6f 64 65 3a 20 33 2d 35 2d 33 7f 37 38 39 33 30 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | Node:.3-5-3.789303.Ref:.Exercise |
| 16a3c0 | 20 33 2d 36 33 7f 37 39 36 31 37 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 36 34 7f | .3-63.796170.Ref:.Exercise.3-64. |
| 16a3e0 | 37 39 36 39 37 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 36 35 7f 37 39 37 34 34 39 | 796973.Ref:.Exercise.3-65.797449 |
| 16a400 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 36 36 7f 38 30 32 31 33 37 0a 52 65 66 3a 20 | .Ref:.Exercise.3-66.802137.Ref:. |
| 16a420 | 45 78 65 72 63 69 73 65 20 33 2d 36 37 7f 38 30 32 35 39 36 0a 52 65 66 3a 20 45 78 65 72 63 69 | Exercise.3-67.802596.Ref:.Exerci |
| 16a440 | 73 65 20 33 2d 36 38 7f 38 30 32 38 34 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 36 | se.3-68.802841.Ref:.Exercise.3-6 |
| 16a460 | 39 7f 38 30 33 34 35 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 37 30 7f 38 30 33 38 | 9.803458.Ref:.Exercise.3-70.8038 |
| 16a480 | 30 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 37 31 7f 38 30 35 32 34 30 0a 52 65 66 | 00.Ref:.Exercise.3-71.805240.Ref |
| 16a4a0 | 3a 20 45 78 65 72 63 69 73 65 20 33 2d 37 32 7f 38 30 35 39 37 36 0a 52 65 66 3a 20 46 69 67 75 | :.Exercise.3-72.805976.Ref:.Figu |
| 16a4c0 | 72 65 20 33 2d 33 32 7f 38 30 37 36 30 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 37 | re.3-32.807605.Ref:.Exercise.3-7 |
| 16a4e0 | 33 7f 38 30 38 32 37 34 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 33 33 7f 38 30 39 34 34 35 | 3.808274.Ref:.Figure.3-33.809445 |
| 16a500 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 37 34 7f 38 31 30 32 38 31 0a 52 65 66 3a 20 | .Ref:.Exercise.3-74.810281.Ref:. |
| 16a520 | 45 78 65 72 63 69 73 65 20 33 2d 37 35 7f 38 31 32 31 39 30 0a 52 65 66 3a 20 45 78 65 72 63 69 | Exercise.3-75.812190.Ref:.Exerci |
| 16a540 | 73 65 20 33 2d 37 36 7f 38 31 33 34 35 36 0a 52 65 66 3a 20 33 2d 35 2d 33 2d 46 6f 6f 74 6e 6f | se.3-76.813456.Ref:.3-5-3-Footno |
| 16a560 | 74 65 2d 31 7f 38 31 34 31 33 39 0a 52 65 66 3a 20 33 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d | te-1.814139.Ref:.3-5-3-Footnote- |
| 16a580 | 32 7f 38 31 34 33 33 32 0a 52 65 66 3a 20 33 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 38 | 2.814332.Ref:.3-5-3-Footnote-3.8 |
| 16a5a0 | 31 34 34 33 36 0a 52 65 66 3a 20 33 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 38 31 34 35 | 14436.Ref:.3-5-3-Footnote-4.8145 |
| 16a5c0 | 32 35 0a 52 65 66 3a 20 33 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 38 31 34 39 36 35 0a | 25.Ref:.3-5-3-Footnote-5.814965. |
| 16a5e0 | 52 65 66 3a 20 33 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 38 31 35 31 33 34 0a 4e 6f 64 | Ref:.3-5-3-Footnote-6.815134.Nod |
| 16a600 | 65 3a 20 33 2d 35 2d 34 7f 38 31 35 37 36 39 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 33 34 | e:.3-5-4.815769.Ref:.Figure.3-34 |
| 16a620 | 7f 38 31 37 35 30 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 37 37 7f 38 32 30 32 39 | .817508.Ref:.Exercise.3-77.82029 |
| 16a640 | 35 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 33 35 7f 38 32 31 33 31 35 0a 52 65 66 3a 20 45 | 5.Ref:.Figure.3-35.821315.Ref:.E |
| 16a660 | 78 65 72 63 69 73 65 20 33 2d 37 38 7f 38 32 32 31 38 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | xercise.3-78.822184.Ref:.Exercis |
| 16a680 | 65 20 33 2d 37 39 7f 38 32 32 39 35 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 38 30 | e.3-79.822954.Ref:.Exercise.3-80 |
| 16a6a0 | 7f 38 32 33 31 35 31 0a 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 33 36 7f 38 32 34 33 32 38 0a | .823151.Ref:.Figure.3-36.824328. |
| 16a6c0 | 52 65 66 3a 20 46 69 67 75 72 65 20 33 2d 33 37 7f 38 32 34 37 36 36 0a 52 65 66 3a 20 33 2d 35 | Ref:.Figure.3-37.824766.Ref:.3-5 |
| 16a6e0 | 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 38 32 38 36 36 30 0a 52 65 66 3a 20 33 2d 35 2d 34 2d | -4-Footnote-1.828660.Ref:.3-5-4- |
| 16a700 | 46 6f 6f 74 6e 6f 74 65 2d 32 7f 38 32 38 39 36 32 0a 4e 6f 64 65 3a 20 33 2d 35 2d 35 7f 38 33 | Footnote-2.828962.Node:.3-5-5.83 |
| 16a720 | 30 32 30 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 38 31 7f 38 33 33 31 31 32 0a 52 | 0205.Ref:.Exercise.3-81.833112.R |
| 16a740 | 65 66 3a 20 45 78 65 72 63 69 73 65 20 33 2d 38 32 7f 38 33 33 36 32 36 0a 52 65 66 3a 20 46 69 | ef:.Exercise.3-82.833626.Ref:.Fi |
| 16a760 | 67 75 72 65 20 33 2d 33 38 7f 38 33 39 39 38 33 0a 52 65 66 3a 20 33 2d 35 2d 35 2d 46 6f 6f 74 | gure.3-38.839983.Ref:.3-5-5-Foot |
| 16a780 | 6e 6f 74 65 2d 31 7f 38 34 31 39 36 37 0a 52 65 66 3a 20 33 2d 35 2d 35 2d 46 6f 6f 74 6e 6f 74 | note-1.841967.Ref:.3-5-5-Footnot |
| 16a7a0 | 65 2d 32 7f 38 34 32 31 39 37 0a 52 65 66 3a 20 33 2d 35 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d 33 | e-2.842197.Ref:.3-5-5-Footnote-3 |
| 16a7c0 | 7f 38 34 32 35 33 38 0a 52 65 66 3a 20 33 2d 35 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 38 34 | .842538.Ref:.3-5-5-Footnote-4.84 |
| 16a7e0 | 33 30 36 39 0a 4e 6f 64 65 3a 20 43 68 61 70 74 65 72 20 34 7f 38 34 33 36 34 32 0a 52 65 66 3a | 3069.Node:.Chapter.4.843642.Ref: |
| 16a800 | 20 43 68 61 70 74 65 72 20 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 38 35 31 37 31 30 0a 52 65 66 | .Chapter.4-Footnote-1.851710.Ref |
| 16a820 | 3a 20 43 68 61 70 74 65 72 20 34 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 38 35 33 31 38 39 0a 4e 6f | :.Chapter.4-Footnote-2.853189.No |
| 16a840 | 64 65 3a 20 34 2d 31 7f 38 35 33 35 31 34 0a 52 65 66 3a 20 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 | de:.4-1.853514.Ref:.4-1-Footnote |
| 16a860 | 2d 31 7f 38 35 36 38 35 31 0a 52 65 66 3a 20 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 38 35 | -1.856851.Ref:.4-1-Footnote-2.85 |
| 16a880 | 37 32 37 33 0a 4e 6f 64 65 3a 20 34 2d 31 2d 31 7f 38 35 38 38 37 39 0a 52 65 66 3a 20 46 69 67 | 7273.Node:.4-1-1.858879.Ref:.Fig |
| 16a8a0 | 75 72 65 20 34 2d 31 7f 38 35 39 30 31 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 31 | ure.4-1.859019.Ref:.Exercise.4-1 |
| 16a8c0 | 7f 38 36 38 31 31 38 0a 52 65 66 3a 20 34 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 38 36 | .868118.Ref:.4-1-1-Footnote-1.86 |
| 16a8e0 | 38 39 31 33 0a 52 65 66 3a 20 34 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 38 36 39 34 30 | 8913.Ref:.4-1-1-Footnote-2.86940 |
| 16a900 | 36 0a 52 65 66 3a 20 34 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 38 36 39 36 31 37 0a 52 | 6.Ref:.4-1-1-Footnote-3.869617.R |
| 16a920 | 65 66 3a 20 34 2d 31 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 38 36 39 38 34 33 0a 4e 6f 64 65 | ef:.4-1-1-Footnote-4.869843.Node |
| 16a940 | 3a 20 34 2d 31 2d 32 7f 38 37 30 30 31 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 32 | :.4-1-2.870013.Ref:.Exercise.4-2 |
| 16a960 | 7f 38 37 37 38 39 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 33 7f 38 37 39 30 33 35 | .877896.Ref:.Exercise.4-3.879035 |
| 16a980 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 34 7f 38 37 39 33 37 37 0a 52 65 66 3a 20 45 | .Ref:.Exercise.4-4.879377.Ref:.E |
| 16a9a0 | 78 65 72 63 69 73 65 20 34 2d 35 7f 38 38 30 34 32 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | xercise.4-5.880427.Ref:.Exercise |
| 16a9c0 | 20 34 2d 36 7f 38 38 30 39 38 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 37 7f 38 38 | .4-6.880989.Ref:.Exercise.4-7.88 |
| 16a9e0 | 31 35 32 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 38 7f 38 38 32 34 30 37 0a 52 65 | 1521.Ref:.Exercise.4-8.882407.Re |
| 16aa00 | 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 39 7f 38 38 33 32 38 34 0a 52 65 66 3a 20 45 78 65 72 | f:.Exercise.4-9.883284.Ref:.Exer |
| 16aa20 | 63 69 73 65 20 34 2d 31 30 7f 38 38 33 37 38 37 0a 52 65 66 3a 20 34 2d 31 2d 32 2d 46 6f 6f 74 | cise.4-10.883787.Ref:.4-1-2-Foot |
| 16aa40 | 6e 6f 74 65 2d 31 7f 38 38 34 31 35 34 0a 52 65 66 3a 20 34 2d 31 2d 32 2d 46 6f 6f 74 6e 6f 74 | note-1.884154.Ref:.4-1-2-Footnot |
| 16aa60 | 65 2d 32 7f 38 38 34 34 34 30 0a 52 65 66 3a 20 34 2d 31 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 33 | e-2.884440.Ref:.4-1-2-Footnote-3 |
| 16aa80 | 7f 38 38 34 37 36 33 0a 52 65 66 3a 20 34 2d 31 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 38 38 | .884763.Ref:.4-1-2-Footnote-4.88 |
| 16aaa0 | 35 30 36 39 0a 52 65 66 3a 20 34 2d 31 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 38 38 35 32 33 | 5069.Ref:.4-1-2-Footnote-5.88523 |
| 16aac0 | 38 0a 4e 6f 64 65 3a 20 34 2d 31 2d 33 7f 38 38 35 38 30 31 0a 52 65 66 3a 20 45 78 65 72 63 69 | 8.Node:.4-1-3.885801.Ref:.Exerci |
| 16aae0 | 73 65 20 34 2d 31 31 7f 38 39 33 30 37 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 31 | se.4-11.893079.Ref:.Exercise.4-1 |
| 16ab00 | 32 7f 38 39 33 33 33 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 31 33 7f 38 39 33 36 | 2.893334.Ref:.Exercise.4-13.8936 |
| 16ab20 | 38 34 0a 52 65 66 3a 20 34 2d 31 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 38 39 34 32 36 30 0a | 84.Ref:.4-1-3-Footnote-1.894260. |
| 16ab40 | 52 65 66 3a 20 34 2d 31 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 38 39 34 35 33 37 0a 4e 6f 64 | Ref:.4-1-3-Footnote-2.894537.Nod |
| 16ab60 | 65 3a 20 34 2d 31 2d 34 7f 38 39 34 39 34 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d | e:.4-1-4.894941.Ref:.Exercise.4- |
| 16ab80 | 31 34 7f 38 39 39 39 38 38 0a 52 65 66 3a 20 34 2d 31 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f | 14.899988.Ref:.4-1-4-Footnote-1. |
| 16aba0 | 39 30 30 34 36 36 0a 52 65 66 3a 20 34 2d 31 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 39 30 30 | 900466.Ref:.4-1-4-Footnote-2.900 |
| 16abc0 | 39 33 31 0a 52 65 66 3a 20 34 2d 31 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 39 30 31 37 32 38 | 931.Ref:.4-1-4-Footnote-3.901728 |
| 16abe0 | 0a 4e 6f 64 65 3a 20 34 2d 31 2d 35 7f 39 30 32 31 30 35 0a 52 65 66 3a 20 46 69 67 75 72 65 20 | .Node:.4-1-5.902105.Ref:.Figure. |
| 16ac00 | 34 2d 32 7f 39 30 33 30 32 33 0a 52 65 66 3a 20 46 69 67 75 72 65 20 34 2d 33 7f 39 30 34 36 31 | 4-2.903023.Ref:.Figure.4-3.90461 |
| 16ac20 | 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 31 35 7f 39 30 37 32 33 38 0a 52 65 66 3a | 0.Ref:.Exercise.4-15.907238.Ref: |
| 16ac40 | 20 34 2d 31 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 39 30 38 31 33 35 0a 52 65 66 3a 20 34 2d | .4-1-5-Footnote-1.908135.Ref:.4- |
| 16ac60 | 31 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 39 30 39 37 36 34 0a 52 65 66 3a 20 34 2d 31 2d 35 | 1-5-Footnote-2.909764.Ref:.4-1-5 |
| 16ac80 | 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 39 31 30 32 35 36 0a 52 65 66 3a 20 34 2d 31 2d 35 2d 46 6f | -Footnote-3.910256.Ref:.4-1-5-Fo |
| 16aca0 | 6f 74 6e 6f 74 65 2d 34 7f 39 31 30 38 37 35 0a 52 65 66 3a 20 34 2d 31 2d 35 2d 46 6f 6f 74 6e | otnote-4.910875.Ref:.4-1-5-Footn |
| 16acc0 | 6f 74 65 2d 35 7f 39 31 31 30 37 34 0a 4e 6f 64 65 3a 20 34 2d 31 2d 36 7f 39 31 31 34 36 32 0a | ote-5.911074.Node:.4-1-6.911462. |
| 16ace0 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 31 36 7f 39 31 35 33 32 31 0a 52 65 66 3a 20 45 | Ref:.Exercise.4-16.915321.Ref:.E |
| 16ad00 | 78 65 72 63 69 73 65 20 34 2d 31 37 7f 39 31 36 30 37 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | xercise.4-17.916073.Ref:.Exercis |
| 16ad20 | 65 20 34 2d 31 38 7f 39 31 36 37 32 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 31 39 | e.4-18.916728.Ref:.Exercise.4-19 |
| 16ad40 | 7f 39 31 37 36 31 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 32 30 7f 39 31 38 39 38 | .917612.Ref:.Exercise.4-20.91898 |
| 16ad60 | 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 32 31 7f 39 32 31 35 30 39 0a 52 65 66 3a | 1.Ref:.Exercise.4-21.921509.Ref: |
| 16ad80 | 20 34 2d 31 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 39 32 33 32 34 31 0a 52 65 66 3a 20 34 2d | .4-1-6-Footnote-1.923241.Ref:.4- |
| 16ada0 | 31 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 39 32 34 30 30 35 0a 52 65 66 3a 20 34 2d 31 2d 36 | 1-6-Footnote-2.924005.Ref:.4-1-6 |
| 16adc0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 39 32 34 33 38 39 0a 52 65 66 3a 20 34 2d 31 2d 36 2d 46 6f | -Footnote-3.924389.Ref:.4-1-6-Fo |
| 16ade0 | 6f 74 6e 6f 74 65 2d 34 7f 39 32 34 38 34 38 0a 4e 6f 64 65 3a 20 34 2d 31 2d 37 7f 39 32 35 32 | otnote-4.924848.Node:.4-1-7.9252 |
| 16ae00 | 32 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 32 32 7f 39 33 33 31 30 33 0a 52 65 66 | 21.Ref:.Exercise.4-22.933103.Ref |
| 16ae20 | 3a 20 45 78 65 72 63 69 73 65 20 34 2d 32 33 7f 39 33 33 32 33 32 0a 52 65 66 3a 20 45 78 65 72 | :.Exercise.4-23.933232.Ref:.Exer |
| 16ae40 | 63 69 73 65 20 34 2d 32 34 7f 39 33 34 38 39 32 0a 52 65 66 3a 20 34 2d 31 2d 37 2d 46 6f 6f 74 | cise.4-24.934892.Ref:.4-1-7-Foot |
| 16ae60 | 6e 6f 74 65 2d 31 7f 39 33 35 32 31 30 0a 52 65 66 3a 20 34 2d 31 2d 37 2d 46 6f 6f 74 6e 6f 74 | note-1.935210.Ref:.4-1-7-Footnot |
| 16ae80 | 65 2d 32 7f 39 33 35 35 35 30 0a 52 65 66 3a 20 34 2d 31 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 33 | e-2.935550.Ref:.4-1-7-Footnote-3 |
| 16aea0 | 7f 39 33 35 39 31 31 0a 4e 6f 64 65 3a 20 34 2d 32 7f 39 33 35 39 39 36 0a 52 65 66 3a 20 34 2d | .935911.Node:.4-2.935996.Ref:.4- |
| 16aec0 | 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 39 33 37 34 39 37 0a 4e 6f 64 65 3a 20 34 2d 32 2d 31 7f | 2-Footnote-1.937497.Node:.4-2-1. |
| 16aee0 | 39 33 37 38 31 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 32 35 7f 39 34 30 37 38 39 | 937816.Ref:.Exercise.4-25.940789 |
| 16af00 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 32 36 7f 39 34 31 32 31 33 0a 52 65 66 3a 20 | .Ref:.Exercise.4-26.941213.Ref:. |
| 16af20 | 34 2d 32 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 39 34 31 39 35 36 0a 52 65 66 3a 20 34 2d 32 | 4-2-1-Footnote-1.941956.Ref:.4-2 |
| 16af40 | 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 39 34 32 33 34 38 0a 4e 6f 64 65 3a 20 34 2d 32 2d 32 | -1-Footnote-2.942348.Node:.4-2-2 |
| 16af60 | 7f 39 34 32 37 37 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 32 37 7f 39 35 31 32 36 | .942776.Ref:.Exercise.4-27.95126 |
| 16af80 | 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 32 38 7f 39 35 31 38 38 39 0a 52 65 66 3a | 7.Ref:.Exercise.4-28.951889.Ref: |
| 16afa0 | 20 45 78 65 72 63 69 73 65 20 34 2d 32 39 7f 39 35 32 31 33 35 0a 52 65 66 3a 20 45 78 65 72 63 | .Exercise.4-29.952135.Ref:.Exerc |
| 16afc0 | 69 73 65 20 34 2d 33 30 7f 39 35 32 37 34 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d | ise.4-30.952747.Ref:.Exercise.4- |
| 16afe0 | 33 31 7f 39 35 35 36 36 34 0a 52 65 66 3a 20 34 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f | 31.955664.Ref:.4-2-2-Footnote-1. |
| 16b000 | 39 35 37 32 37 32 0a 52 65 66 3a 20 34 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 39 35 37 | 957272.Ref:.4-2-2-Footnote-2.957 |
| 16b020 | 36 31 32 0a 52 65 66 3a 20 34 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 39 35 37 39 37 33 | 612.Ref:.4-2-2-Footnote-3.957973 |
| 16b040 | 0a 52 65 66 3a 20 34 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 39 35 38 36 37 33 0a 52 65 | .Ref:.4-2-2-Footnote-4.958673.Re |
| 16b060 | 66 3a 20 34 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 39 35 39 34 30 39 0a 4e 6f 64 65 3a | f:.4-2-2-Footnote-5.959409.Node: |
| 16b080 | 20 34 2d 32 2d 33 7f 39 35 39 36 30 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 33 32 | .4-2-3.959607.Ref:.Exercise.4-32 |
| 16b0a0 | 7f 39 36 33 35 30 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 33 33 7f 39 36 33 37 33 | .963502.Ref:.Exercise.4-33.96373 |
| 16b0c0 | 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 33 34 7f 39 36 34 32 37 31 0a 52 65 66 3a | 8.Ref:.Exercise.4-34.964271.Ref: |
| 16b0e0 | 20 34 2d 32 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 39 36 34 36 32 35 0a 52 65 66 3a 20 34 2d | .4-2-3-Footnote-1.964625.Ref:.4- |
| 16b100 | 32 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 39 36 34 37 31 39 0a 52 65 66 3a 20 34 2d 32 2d 33 | 2-3-Footnote-2.964719.Ref:.4-2-3 |
| 16b120 | 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 39 36 35 31 39 33 0a 4e 6f 64 65 3a 20 34 2d 33 7f 39 36 35 | -Footnote-3.965193.Node:.4-3.965 |
| 16b140 | 33 36 34 0a 52 65 66 3a 20 34 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 39 36 39 39 39 33 0a 4e | 364.Ref:.4-3-Footnote-1.969993.N |
| 16b160 | 6f 64 65 3a 20 34 2d 33 2d 31 7f 39 37 30 36 38 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | ode:.4-3-1.970682.Ref:.Exercise. |
| 16b180 | 34 2d 33 35 7f 39 37 35 38 36 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 33 36 7f 39 | 4-35.975869.Ref:.Exercise.4-36.9 |
| 16b1a0 | 37 36 35 30 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 33 37 7f 39 37 37 30 39 34 0a | 76500.Ref:.Exercise.4-37.977094. |
| 16b1c0 | 52 65 66 3a 20 34 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 39 37 37 38 30 30 0a 52 65 66 | Ref:.4-3-1-Footnote-1.977800.Ref |
| 16b1e0 | 3a 20 34 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 39 37 37 39 32 35 0a 52 65 66 3a 20 34 | :.4-3-1-Footnote-2.977925.Ref:.4 |
| 16b200 | 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 39 37 38 33 39 35 0a 52 65 66 3a 20 34 2d 33 2d | -3-1-Footnote-3.978395.Ref:.4-3- |
| 16b220 | 31 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 39 37 38 39 36 30 0a 52 65 66 3a 20 34 2d 33 2d 31 2d 46 | 1-Footnote-4.978960.Ref:.4-3-1-F |
| 16b240 | 6f 6f 74 6e 6f 74 65 2d 35 7f 39 37 39 31 39 31 0a 52 65 66 3a 20 46 6f 6f 74 6e 6f 74 65 20 34 | ootnote-5.979191.Ref:.Footnote.4 |
| 16b260 | 2d 34 37 7f 39 37 39 32 31 33 0a 4e 6f 64 65 3a 20 34 2d 33 2d 32 7f 39 38 31 35 31 35 0a 52 65 | -47.979213.Node:.4-3-2.981515.Re |
| 16b280 | 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 33 38 7f 39 38 33 38 35 32 0a 52 65 66 3a 20 45 78 65 | f:.Exercise.4-38.983852.Ref:.Exe |
| 16b2a0 | 72 63 69 73 65 20 34 2d 33 39 7f 39 38 34 30 35 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | rcise.4-39.984059.Ref:.Exercise. |
| 16b2c0 | 34 2d 34 30 7f 39 38 34 34 30 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 34 31 7f 39 | 4-40.984400.Ref:.Exercise.4-41.9 |
| 16b2e0 | 38 35 32 31 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 34 32 7f 39 38 35 33 31 30 0a | 85210.Ref:.Exercise.4-42.985310. |
| 16b300 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 34 33 7f 39 38 36 31 37 31 0a 52 65 66 3a 20 45 | Ref:.Exercise.4-43.986171.Ref:.E |
| 16b320 | 78 65 72 63 69 73 65 20 34 2d 34 34 7f 39 38 37 30 36 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | xercise.4-44.987060.Ref:.Exercis |
| 16b340 | 65 20 34 2d 34 35 7f 39 39 34 31 39 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 34 36 | e.4-45.994191.Ref:.Exercise.4-46 |
| 16b360 | 7f 39 39 34 34 37 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 34 37 7f 39 39 34 37 39 | .994470.Ref:.Exercise.4-47.99479 |
| 16b380 | 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 34 38 7f 39 39 35 34 31 33 0a 52 65 66 3a | 5.Ref:.Exercise.4-48.995413.Ref: |
| 16b3a0 | 20 45 78 65 72 63 69 73 65 20 34 2d 34 39 7f 39 39 35 36 35 35 0a 52 65 66 3a 20 34 2d 33 2d 32 | .Exercise.4-49.995655.Ref:.4-3-2 |
| 16b3c0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 39 39 36 31 36 30 0a 52 65 66 3a 20 34 2d 33 2d 32 2d 46 6f | -Footnote-1.996160.Ref:.4-3-2-Fo |
| 16b3e0 | 6f 74 6e 6f 74 65 2d 32 7f 39 39 36 35 36 34 0a 52 65 66 3a 20 34 2d 33 2d 32 2d 46 6f 6f 74 6e | otnote-2.996564.Ref:.4-3-2-Footn |
| 16b400 | 6f 74 65 2d 33 7f 39 39 36 37 33 37 0a 52 65 66 3a 20 34 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 | ote-3.996737.Ref:.4-3-2-Footnote |
| 16b420 | 2d 34 7f 39 39 36 38 37 37 0a 52 65 66 3a 20 34 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f | -4.996877.Ref:.4-3-2-Footnote-5. |
| 16b440 | 39 39 37 30 35 39 0a 52 65 66 3a 20 34 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 39 39 37 | 997059.Ref:.4-3-2-Footnote-6.997 |
| 16b460 | 31 37 33 0a 52 65 66 3a 20 34 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 37 7f 39 39 37 37 32 39 | 173.Ref:.4-3-2-Footnote-7.997729 |
| 16b480 | 0a 4e 6f 64 65 3a 20 34 2d 33 2d 33 7f 39 39 38 31 33 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | .Node:.4-3-3.998130.Ref:.Exercis |
| 16b4a0 | 65 20 34 2d 35 30 7f 31 30 31 38 33 38 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 35 | e.4-50.1018381.Ref:.Exercise.4-5 |
| 16b4c0 | 31 7f 31 30 31 38 36 33 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 35 32 7f 31 30 31 | 1.1018634.Ref:.Exercise.4-52.101 |
| 16b4e0 | 39 34 33 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 35 33 7f 31 30 32 30 33 34 39 0a | 9432.Ref:.Exercise.4-53.1020349. |
| 16b500 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 35 34 7f 31 30 32 30 37 34 36 0a 52 65 66 3a 20 | Ref:.Exercise.4-54.1020746.Ref:. |
| 16b520 | 34 2d 33 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 30 32 31 38 31 36 0a 52 65 66 3a 20 34 2d | 4-3-3-Footnote-1.1021816.Ref:.4- |
| 16b540 | 33 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 30 32 32 31 38 34 0a 52 65 66 3a 20 34 2d 33 2d | 3-3-Footnote-2.1022184.Ref:.4-3- |
| 16b560 | 33 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 30 32 32 33 31 38 0a 4e 6f 64 65 3a 20 34 2d 34 7f 31 | 3-Footnote-3.1022318.Node:.4-4.1 |
| 16b580 | 30 32 32 34 35 36 0a 52 65 66 3a 20 34 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 30 32 39 30 | 022456.Ref:.4-4-Footnote-1.10290 |
| 16b5a0 | 31 34 0a 52 65 66 3a 20 34 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 30 33 30 39 38 33 0a 52 | 14.Ref:.4-4-Footnote-2.1030983.R |
| 16b5c0 | 65 66 3a 20 34 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 30 33 31 32 31 35 0a 52 65 66 3a 20 | ef:.4-4-Footnote-3.1031215.Ref:. |
| 16b5e0 | 34 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 31 30 33 31 36 37 30 0a 4e 6f 64 65 3a 20 34 2d 34 | 4-4-Footnote-4.1031670.Node:.4-4 |
| 16b600 | 2d 31 7f 31 30 33 32 35 36 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 35 35 7f 31 30 | -1.1032564.Ref:.Exercise.4-55.10 |
| 16b620 | 34 30 32 34 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 35 36 7f 31 30 34 33 37 30 31 | 40249.Ref:.Exercise.4-56.1043701 |
| 16b640 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 35 37 7f 31 30 34 36 35 39 32 0a 52 65 66 3a | .Ref:.Exercise.4-57.1046592.Ref: |
| 16b660 | 20 45 78 65 72 63 69 73 65 20 34 2d 35 38 7f 31 30 34 37 30 39 32 0a 52 65 66 3a 20 45 78 65 72 | .Exercise.4-58.1047092.Ref:.Exer |
| 16b680 | 63 69 73 65 20 34 2d 35 39 7f 31 30 34 37 32 38 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | cise.4-59.1047287.Ref:.Exercise. |
| 16b6a0 | 34 2d 36 30 7f 31 30 34 38 38 36 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 36 31 7f | 4-60.1048862.Ref:.Exercise.4-61. |
| 16b6c0 | 31 30 35 32 30 38 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 36 32 7f 31 30 35 32 34 | 1052088.Ref:.Exercise.4-62.10524 |
| 16b6e0 | 38 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 36 33 7f 31 30 35 32 38 36 33 0a 52 65 | 81.Ref:.Exercise.4-63.1052863.Re |
| 16b700 | 66 3a 20 34 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 30 35 33 37 37 35 0a 52 65 66 3a | f:.4-4-1-Footnote-1.1053775.Ref: |
| 16b720 | 20 34 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 30 35 33 38 35 35 0a 52 65 66 3a 20 34 | .4-4-1-Footnote-2.1053855.Ref:.4 |
| 16b740 | 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 30 35 34 30 36 30 0a 52 65 66 3a 20 34 2d 34 | -4-1-Footnote-3.1054060.Ref:.4-4 |
| 16b760 | 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 31 30 35 34 33 36 33 0a 52 65 66 3a 20 34 2d 34 2d 31 | -1-Footnote-4.1054363.Ref:.4-4-1 |
| 16b780 | 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 31 30 35 35 30 36 39 0a 4e 6f 64 65 3a 20 34 2d 34 2d 32 7f | -Footnote-5.1055069.Node:.4-4-2. |
| 16b7a0 | 31 30 35 35 32 34 34 0a 52 65 66 3a 20 46 69 67 75 72 65 20 34 2d 34 7f 31 30 36 30 30 30 31 0a | 1055244.Ref:.Figure.4-4.1060001. |
| 16b7c0 | 52 65 66 3a 20 46 69 67 75 72 65 20 34 2d 35 7f 31 30 36 32 31 32 38 0a 52 65 66 3a 20 46 69 67 | Ref:.Figure.4-5.1062128.Ref:.Fig |
| 16b7e0 | 75 72 65 20 34 2d 36 7f 31 30 36 33 31 37 37 0a 52 65 66 3a 20 34 2d 34 2d 32 2d 46 6f 6f 74 6e | ure.4-6.1063177.Ref:.4-4-2-Footn |
| 16b800 | 6f 74 65 2d 31 7f 31 30 37 34 34 34 30 0a 52 65 66 3a 20 34 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 | ote-1.1074440.Ref:.4-4-2-Footnot |
| 16b820 | 65 2d 32 7f 31 30 37 35 31 37 38 0a 52 65 66 3a 20 34 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d | e-2.1075178.Ref:.4-4-2-Footnote- |
| 16b840 | 33 7f 31 30 37 35 33 35 30 0a 52 65 66 3a 20 34 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f | 3.1075350.Ref:.4-4-2-Footnote-4. |
| 16b860 | 31 30 37 35 34 38 34 0a 52 65 66 3a 20 34 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 31 30 | 1075484.Ref:.4-4-2-Footnote-5.10 |
| 16b880 | 37 35 36 34 37 0a 52 65 66 3a 20 34 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 31 30 37 35 | 75647.Ref:.4-4-2-Footnote-6.1075 |
| 16b8a0 | 38 30 37 0a 52 65 66 3a 20 34 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 37 7f 31 30 37 36 32 32 | 807.Ref:.4-4-2-Footnote-7.107622 |
| 16b8c0 | 34 0a 52 65 66 3a 20 34 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 38 7f 31 30 37 36 35 31 31 0a | 4.Ref:.4-4-2-Footnote-8.1076511. |
| 16b8e0 | 4e 6f 64 65 3a 20 34 2d 34 2d 33 7f 31 30 37 36 38 38 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | Node:.4-4-3.1076881.Ref:.Exercis |
| 16b900 | 65 20 34 2d 36 34 7f 31 30 38 34 31 39 32 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 36 | e.4-64.1084192.Ref:.Exercise.4-6 |
| 16b920 | 35 7f 31 30 38 34 39 37 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 36 36 7f 31 30 38 | 5.1084974.Ref:.Exercise.4-66.108 |
| 16b940 | 35 34 39 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 36 37 7f 31 30 38 36 38 35 30 0a | 5496.Ref:.Exercise.4-67.1086850. |
| 16b960 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 36 38 7f 31 30 38 37 35 33 30 0a 52 65 66 3a 20 | Ref:.Exercise.4-68.1087530.Ref:. |
| 16b980 | 45 78 65 72 63 69 73 65 20 34 2d 36 39 7f 31 30 38 37 38 34 34 0a 52 65 66 3a 20 34 2d 34 2d 33 | Exercise.4-69.1087844.Ref:.4-4-3 |
| 16b9a0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 30 38 38 36 35 36 0a 52 65 66 3a 20 34 2d 34 2d 33 2d 46 | -Footnote-1.1088656.Ref:.4-4-3-F |
| 16b9c0 | 6f 6f 74 6e 6f 74 65 2d 32 7f 31 30 38 39 30 33 39 0a 52 65 66 3a 20 34 2d 34 2d 33 2d 46 6f 6f | ootnote-2.1089039.Ref:.4-4-3-Foo |
| 16b9e0 | 74 6e 6f 74 65 2d 33 7f 31 30 39 30 30 37 39 0a 52 65 66 3a 20 34 2d 34 2d 33 2d 46 6f 6f 74 6e | tnote-3.1090079.Ref:.4-4-3-Footn |
| 16ba00 | 6f 74 65 2d 34 7f 31 30 39 31 30 36 36 0a 52 65 66 3a 20 34 2d 34 2d 33 2d 46 6f 6f 74 6e 6f 74 | ote-4.1091066.Ref:.4-4-3-Footnot |
| 16ba20 | 65 2d 35 7f 31 30 39 31 34 36 35 0a 4e 6f 64 65 3a 20 34 2d 34 2d 34 7f 31 30 39 31 35 37 36 0a | e-5.1091465.Node:.4-4-4.1091576. |
| 16ba40 | 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d 31 7f 31 30 39 32 32 32 34 0a 4e 6f 64 65 3a 20 34 2d 34 2d | Node:.4-4-4-1.1092224.Node:.4-4- |
| 16ba60 | 34 2d 32 7f 31 30 39 35 38 30 35 0a 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d 33 7f 31 31 30 32 30 38 | 4-2.1095805.Node:.4-4-4-3.110208 |
| 16ba80 | 35 0a 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d 34 7f 31 31 30 38 33 36 31 0a 52 65 66 3a 20 34 2d 34 | 5.Node:.4-4-4-4.1108361.Ref:.4-4 |
| 16baa0 | 2d 34 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 31 31 36 30 37 37 0a 4e 6f 64 65 3a 20 34 2d | -4-4-Footnote-1.1116077.Node:.4- |
| 16bac0 | 34 2d 34 2d 35 7f 31 31 31 37 35 31 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 37 30 | 4-4-5.1117516.Ref:.Exercise.4-70 |
| 16bae0 | 7f 31 31 32 32 38 33 38 0a 4e 6f 64 65 3a 20 34 2d 34 2d 34 2d 36 7f 31 31 32 33 33 37 34 0a 4e | .1122838.Node:.4-4-4-6.1123374.N |
| 16bb00 | 6f 64 65 3a 20 34 2d 34 2d 34 2d 37 7f 31 31 32 35 33 32 34 0a 52 65 66 3a 20 34 2d 34 2d 34 2d | ode:.4-4-4-7.1125324.Ref:.4-4-4- |
| 16bb20 | 37 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 31 32 39 38 31 31 0a 4e 6f 64 65 3a 20 34 2d 34 2d 34 | 7-Footnote-1.1129811.Node:.4-4-4 |
| 16bb40 | 2d 38 7f 31 31 33 30 34 36 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 37 31 7f 31 31 | -8.1130461.Ref:.Exercise.4-71.11 |
| 16bb60 | 33 31 30 33 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 37 32 7f 31 31 33 31 39 34 37 | 31036.Ref:.Exercise.4-72.1131947 |
| 16bb80 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 37 33 7f 31 31 33 32 32 30 33 0a 52 65 66 3a | .Ref:.Exercise.4-73.1132203.Ref: |
| 16bba0 | 20 45 78 65 72 63 69 73 65 20 34 2d 37 34 7f 31 31 33 32 35 36 36 0a 52 65 66 3a 20 45 78 65 72 | .Exercise.4-74.1132566.Ref:.Exer |
| 16bbc0 | 63 69 73 65 20 34 2d 37 35 7f 31 31 33 33 33 34 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | cise.4-75.1133348.Ref:.Exercise. |
| 16bbe0 | 34 2d 37 36 7f 31 31 33 35 33 33 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 37 37 7f | 4-76.1135338.Ref:.Exercise.4-77. |
| 16bc00 | 31 31 33 36 35 35 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 37 38 7f 31 31 33 37 33 | 1136553.Ref:.Exercise.4-78.11373 |
| 16bc20 | 30 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 34 2d 37 39 7f 31 31 33 37 39 38 39 0a 4e 6f | 01.Ref:.Exercise.4-79.1137989.No |
| 16bc40 | 64 65 3a 20 43 68 61 70 74 65 72 20 35 7f 31 31 33 39 36 32 30 0a 4e 6f 64 65 3a 20 35 2d 31 7f | de:.Chapter.5.1139620.Node:.5-1. |
| 16bc60 | 31 31 34 34 31 36 39 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 31 7f 31 31 34 38 32 30 35 0a | 1144169.Ref:.Figure.5-1.1148205. |
| 16bc80 | 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 32 7f 31 31 35 30 32 35 37 0a 52 65 66 3a 20 45 78 65 | Ref:.Figure.5-2.1150257.Ref:.Exe |
| 16bca0 | 72 63 69 73 65 20 35 2d 31 7f 31 31 35 30 37 35 38 0a 4e 6f 64 65 3a 20 35 2d 31 2d 31 7f 31 31 | rcise.5-1.1150758.Node:.5-1-1.11 |
| 16bcc0 | 35 31 34 36 34 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 33 7f 31 31 35 33 37 30 34 0a 52 65 | 51464.Ref:.Figure.5-3.1153704.Re |
| 16bce0 | 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 32 7f 31 31 35 38 30 32 34 0a 52 65 66 3a 20 46 69 67 | f:.Exercise.5-2.1158024.Ref:.Fig |
| 16bd00 | 75 72 65 20 35 2d 34 7f 31 31 36 30 31 35 39 0a 52 65 66 3a 20 35 2d 31 2d 31 2d 46 6f 6f 74 6e | ure.5-4.1160159.Ref:.5-1-1-Footn |
| 16bd20 | 6f 74 65 2d 31 7f 31 31 36 31 39 36 35 0a 4e 6f 64 65 3a 20 35 2d 31 2d 32 7f 31 31 36 32 31 34 | ote-1.1161965.Node:.5-1-2.116214 |
| 16bd40 | 33 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 35 7f 31 31 36 33 36 32 36 0a 52 65 66 3a 20 46 | 3.Ref:.Figure.5-5.1163626.Ref:.F |
| 16bd60 | 69 67 75 72 65 20 35 2d 36 7f 31 31 36 35 32 36 34 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | igure.5-6.1165264.Ref:.Exercise. |
| 16bd80 | 35 2d 33 7f 31 31 36 35 38 34 38 0a 4e 6f 64 65 3a 20 35 2d 31 2d 33 7f 31 31 36 36 36 38 37 0a | 5-3.1165848.Node:.5-1-3.1166687. |
| 16bda0 | 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 37 7f 31 31 36 37 35 35 38 0a 52 65 66 3a 20 46 69 67 | Ref:.Figure.5-7.1167558.Ref:.Fig |
| 16bdc0 | 75 72 65 20 35 2d 38 7f 31 31 37 31 30 39 34 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 39 7f | ure.5-8.1171094.Ref:.Figure.5-9. |
| 16bde0 | 31 31 37 31 37 38 38 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 31 30 7f 31 31 37 32 37 31 35 | 1171788.Ref:.Figure.5-10.1172715 |
| 16be00 | 0a 4e 6f 64 65 3a 20 35 2d 31 2d 34 7f 31 31 37 35 37 31 37 0a 52 65 66 3a 20 46 69 67 75 72 65 | .Node:.5-1-4.1175717.Ref:.Figure |
| 16be20 | 20 35 2d 31 31 7f 31 31 38 35 32 33 33 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 31 32 7f 31 | .5-11.1185233.Ref:.Figure.5-12.1 |
| 16be40 | 31 38 37 38 37 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 34 7f 31 31 38 39 35 37 32 | 187875.Ref:.Exercise.5-4.1189572 |
| 16be60 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 35 7f 31 31 39 30 32 34 34 0a 52 65 66 3a 20 | .Ref:.Exercise.5-5.1190244.Ref:. |
| 16be80 | 45 78 65 72 63 69 73 65 20 35 2d 36 7f 31 31 39 30 34 39 31 0a 52 65 66 3a 20 35 2d 31 2d 34 2d | Exercise.5-6.1190491.Ref:.5-1-4- |
| 16bea0 | 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 31 39 30 37 35 32 0a 52 65 66 3a 20 35 2d 31 2d 34 2d 46 6f | Footnote-1.1190752.Ref:.5-1-4-Fo |
| 16bec0 | 6f 74 6e 6f 74 65 2d 32 7f 31 31 39 31 30 36 39 0a 4e 6f 64 65 3a 20 35 2d 31 2d 35 7f 31 31 39 | otnote-2.1191069.Node:.5-1-5.119 |
| 16bee0 | 31 31 37 36 0a 4e 6f 64 65 3a 20 35 2d 32 7f 31 31 39 32 34 39 34 0a 52 65 66 3a 20 45 78 65 72 | 1176.Node:.5-2.1192494.Ref:.Exer |
| 16bf00 | 63 69 73 65 20 35 2d 37 7f 31 31 39 35 35 32 33 0a 4e 6f 64 65 3a 20 35 2d 32 2d 31 7f 31 31 39 | cise.5-7.1195523.Node:.5-2-1.119 |
| 16bf20 | 35 38 32 37 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 31 33 7f 31 32 30 31 30 31 30 0a 4e 6f | 5827.Ref:.Figure.5-13.1201010.No |
| 16bf40 | 64 65 3a 20 35 2d 32 2d 32 7f 31 32 30 34 38 33 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | de:.5-2-2.1204835.Ref:.Exercise. |
| 16bf60 | 35 2d 38 7f 31 32 31 30 32 35 36 0a 52 65 66 3a 20 35 2d 32 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d | 5-8.1210256.Ref:.5-2-2-Footnote- |
| 16bf80 | 31 7f 31 32 31 30 39 31 36 0a 4e 6f 64 65 3a 20 35 2d 32 2d 33 7f 31 32 31 32 33 37 30 0a 52 65 | 1.1210916.Node:.5-2-3.1212370.Re |
| 16bfa0 | 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 39 7f 31 32 32 34 32 33 30 0a 52 65 66 3a 20 45 78 65 | f:.Exercise.5-9.1224230.Ref:.Exe |
| 16bfc0 | 72 63 69 73 65 20 35 2d 31 30 7f 31 32 32 34 35 33 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | rcise.5-10.1224536.Ref:.Exercise |
| 16bfe0 | 20 35 2d 31 31 7f 31 32 32 34 38 30 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 31 32 | .5-11.1224801.Ref:.Exercise.5-12 |
| 16c000 | 7f 31 32 32 36 32 33 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 31 33 7f 31 32 32 37 | .1226235.Ref:.Exercise.5-13.1227 |
| 16c020 | 33 37 32 0a 4e 6f 64 65 3a 20 35 2d 32 2d 34 7f 31 32 32 37 37 35 33 0a 52 65 66 3a 20 45 78 65 | 372.Node:.5-2-4.1227753.Ref:.Exe |
| 16c040 | 72 63 69 73 65 20 35 2d 31 34 7f 31 32 33 30 32 35 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | rcise.5-14.1230258.Ref:.Exercise |
| 16c060 | 20 35 2d 31 35 7f 31 32 33 31 32 31 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 31 36 | .5-15.1231210.Ref:.Exercise.5-16 |
| 16c080 | 7f 31 32 33 31 35 34 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 31 37 7f 31 32 33 31 | .1231548.Ref:.Exercise.5-17.1231 |
| 16c0a0 | 38 34 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 31 38 7f 31 32 33 32 32 38 34 0a 52 | 849.Ref:.Exercise.5-18.1232284.R |
| 16c0c0 | 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 31 39 7f 31 32 33 32 37 39 31 0a 4e 6f 64 65 3a 20 | ef:.Exercise.5-19.1232791.Node:. |
| 16c0e0 | 35 2d 33 7f 31 32 33 34 30 36 39 0a 4e 6f 64 65 3a 20 35 2d 33 2d 31 7f 31 32 33 36 33 35 32 0a | 5-3.1234069.Node:.5-3-1.1236352. |
| 16c100 | 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 31 34 7f 31 32 34 30 30 33 36 0a 52 65 66 3a 20 45 78 | Ref:.Figure.5-14.1240036.Ref:.Ex |
| 16c120 | 65 72 63 69 73 65 20 35 2d 32 30 7f 31 32 34 36 31 34 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 | ercise.5-20.1246149.Ref:.Exercis |
| 16c140 | 65 20 35 2d 32 31 7f 31 32 34 36 35 32 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 32 | e.5-21.1246527.Ref:.Exercise.5-2 |
| 16c160 | 32 7f 31 32 34 37 34 30 31 0a 52 65 66 3a 20 35 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f | 2.1247401.Ref:.5-3-1-Footnote-1. |
| 16c180 | 31 32 34 37 38 31 35 0a 52 65 66 3a 20 35 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 32 | 1247815.Ref:.5-3-1-Footnote-2.12 |
| 16c1a0 | 34 38 30 31 33 0a 52 65 66 3a 20 35 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 32 34 38 | 48013.Ref:.5-3-1-Footnote-3.1248 |
| 16c1c0 | 32 31 39 0a 52 65 66 3a 20 35 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 31 32 34 38 34 37 | 219.Ref:.5-3-1-Footnote-4.124847 |
| 16c1e0 | 30 0a 52 65 66 3a 20 35 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 31 32 34 39 33 36 36 0a | 0.Ref:.5-3-1-Footnote-5.1249366. |
| 16c200 | 52 65 66 3a 20 35 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 31 32 34 39 38 33 35 0a 52 65 | Ref:.5-3-1-Footnote-6.1249835.Re |
| 16c220 | 66 3a 20 35 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 37 7f 31 32 35 30 30 31 33 0a 52 65 66 3a | f:.5-3-1-Footnote-7.1250013.Ref: |
| 16c240 | 20 35 2d 33 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 38 7f 31 32 35 30 33 32 39 0a 4e 6f 64 65 3a 20 | .5-3-1-Footnote-8.1250329.Node:. |
| 16c260 | 35 2d 33 2d 32 7f 31 32 35 30 35 36 32 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 31 35 7f 31 | 5-3-2.1250562.Ref:.Figure.5-15.1 |
| 16c280 | 32 35 35 31 34 36 0a 52 65 66 3a 20 35 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 32 36 | 255146.Ref:.5-3-2-Footnote-1.126 |
| 16c2a0 | 34 33 35 35 0a 52 65 66 3a 20 35 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 32 36 35 30 | 4355.Ref:.5-3-2-Footnote-2.12650 |
| 16c2c0 | 38 33 0a 52 65 66 3a 20 35 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 32 36 35 32 36 36 | 83.Ref:.5-3-2-Footnote-3.1265266 |
| 16c2e0 | 0a 52 65 66 3a 20 35 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 31 32 36 36 39 36 36 0a 52 | .Ref:.5-3-2-Footnote-4.1266966.R |
| 16c300 | 65 66 3a 20 35 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 31 32 36 37 31 36 34 0a 52 65 66 | ef:.5-3-2-Footnote-5.1267164.Ref |
| 16c320 | 3a 20 35 2d 33 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 31 32 36 37 33 32 33 0a 4e 6f 64 65 3a | :.5-3-2-Footnote-6.1267323.Node: |
| 16c340 | 20 35 2d 34 7f 31 32 36 37 38 31 38 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 31 36 7f 31 32 | .5-4.1267818.Ref:.Figure.5-16.12 |
| 16c360 | 37 30 35 31 34 0a 52 65 66 3a 20 35 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 32 37 31 38 35 | 70514.Ref:.5-4-Footnote-1.127185 |
| 16c380 | 37 0a 4e 6f 64 65 3a 20 35 2d 34 2d 31 7f 31 32 37 31 39 36 32 0a 52 65 66 3a 20 35 2d 34 2d 31 | 7.Node:.5-4-1.1271962.Ref:.5-4-1 |
| 16c3a0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 32 38 33 35 33 33 0a 52 65 66 3a 20 35 2d 34 2d 31 2d 46 | -Footnote-1.1283533.Ref:.5-4-1-F |
| 16c3c0 | 6f 6f 74 6e 6f 74 65 2d 32 7f 31 32 38 34 30 30 38 0a 52 65 66 3a 20 35 2d 34 2d 31 2d 46 6f 6f | ootnote-2.1284008.Ref:.5-4-1-Foo |
| 16c3e0 | 74 6e 6f 74 65 2d 33 7f 31 32 38 34 36 33 38 0a 52 65 66 3a 20 35 2d 34 2d 31 2d 46 6f 6f 74 6e | tnote-3.1284638.Ref:.5-4-1-Footn |
| 16c400 | 6f 74 65 2d 34 7f 31 32 38 35 30 34 37 0a 52 65 66 3a 20 35 2d 34 2d 31 2d 46 6f 6f 74 6e 6f 74 | ote-4.1285047.Ref:.5-4-1-Footnot |
| 16c420 | 65 2d 35 7f 31 32 38 35 35 37 30 0a 4e 6f 64 65 3a 20 35 2d 34 2d 32 7f 31 32 38 35 37 39 35 0a | e-5.1285570.Node:.5-4-2.1285795. |
| 16c440 | 52 65 66 3a 20 35 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 32 39 32 31 38 30 0a 52 65 | Ref:.5-4-2-Footnote-1.1292180.Re |
| 16c460 | 66 3a 20 35 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 32 39 32 33 35 38 0a 52 65 66 3a | f:.5-4-2-Footnote-2.1292358.Ref: |
| 16c480 | 20 35 2d 34 2d 32 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 32 39 32 37 37 30 0a 4e 6f 64 65 3a 20 | .5-4-2-Footnote-3.1292770.Node:. |
| 16c4a0 | 35 2d 34 2d 33 7f 31 32 39 32 38 36 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 32 33 | 5-4-3.1292867.Ref:.Exercise.5-23 |
| 16c4c0 | 7f 31 32 39 36 33 34 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 32 34 7f 31 32 39 36 | .1296343.Ref:.Exercise.5-24.1296 |
| 16c4e0 | 36 30 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 32 35 7f 31 32 39 36 39 31 32 0a 52 | 606.Ref:.Exercise.5-25.1296912.R |
| 16c500 | 65 66 3a 20 35 2d 34 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 32 39 37 30 38 34 0a 4e 6f 64 | ef:.5-4-3-Footnote-1.1297084.Nod |
| 16c520 | 65 3a 20 35 2d 34 2d 34 7f 31 32 39 37 33 34 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 | e:.5-4-4.1297348.Ref:.Exercise.5 |
| 16c540 | 2d 32 36 7f 31 33 30 33 33 31 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 32 37 7f 31 | -26.1303310.Ref:.Exercise.5-27.1 |
| 16c560 | 33 30 34 33 36 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 32 38 7f 31 33 30 35 33 33 | 304361.Ref:.Exercise.5-28.130533 |
| 16c580 | 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 32 39 7f 31 33 30 35 37 33 39 0a 52 65 66 | 9.Ref:.Exercise.5-29.1305739.Ref |
| 16c5a0 | 3a 20 45 78 65 72 63 69 73 65 20 35 2d 33 30 7f 31 33 30 36 38 37 32 0a 52 65 66 3a 20 35 2d 34 | :.Exercise.5-30.1306872.Ref:.5-4 |
| 16c5c0 | 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 33 30 39 31 31 37 0a 52 65 66 3a 20 35 2d 34 2d 34 | -4-Footnote-1.1309117.Ref:.5-4-4 |
| 16c5e0 | 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 33 30 39 36 39 34 0a 52 65 66 3a 20 35 2d 34 2d 34 2d 46 | -Footnote-2.1309694.Ref:.5-4-4-F |
| 16c600 | 6f 6f 74 6e 6f 74 65 2d 33 7f 31 33 30 39 38 32 38 0a 52 65 66 3a 20 35 2d 34 2d 34 2d 46 6f 6f | ootnote-3.1309828.Ref:.5-4-4-Foo |
| 16c620 | 74 6e 6f 74 65 2d 34 7f 31 33 31 30 30 31 32 0a 4e 6f 64 65 3a 20 35 2d 35 7f 31 33 31 30 33 34 | tnote-4.1310012.Node:.5-5.131034 |
| 16c640 | 32 0a 52 65 66 3a 20 35 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 33 31 39 35 34 30 0a 52 65 | 2.Ref:.5-5-Footnote-1.1319540.Re |
| 16c660 | 66 3a 20 35 2d 35 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 33 31 39 38 38 33 0a 4e 6f 64 65 3a 20 | f:.5-5-Footnote-2.1319883.Node:. |
| 16c680 | 35 2d 35 2d 31 7f 31 33 32 30 34 38 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 33 31 | 5-5-1.1320483.Ref:.Exercise.5-31 |
| 16c6a0 | 7f 31 33 32 39 32 35 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 33 32 7f 31 33 32 39 | .1329255.Ref:.Exercise.5-32.1329 |
| 16c6c0 | 39 37 33 0a 52 65 66 3a 20 35 2d 35 2d 31 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 33 33 31 30 31 | 973.Ref:.5-5-1-Footnote-1.133101 |
| 16c6e0 | 30 0a 4e 6f 64 65 3a 20 35 2d 35 2d 32 7f 31 33 33 31 34 39 37 0a 52 65 66 3a 20 35 2d 35 2d 32 | 0.Node:.5-5-2.1331497.Ref:.5-5-2 |
| 16c700 | 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 33 34 33 38 38 38 0a 52 65 66 3a 20 35 2d 35 2d 32 2d 46 | -Footnote-1.1343888.Ref:.5-5-2-F |
| 16c720 | 6f 6f 74 6e 6f 74 65 2d 32 7f 31 33 34 34 34 33 31 0a 52 65 66 3a 20 35 2d 35 2d 32 2d 46 6f 6f | ootnote-2.1344431.Ref:.5-5-2-Foo |
| 16c740 | 74 6e 6f 74 65 2d 33 7f 31 33 34 35 32 36 31 0a 52 65 66 3a 20 46 6f 6f 74 6e 6f 74 65 20 33 38 | tnote-3.1345261.Ref:.Footnote.38 |
| 16c760 | 7f 31 33 34 35 32 38 31 0a 4e 6f 64 65 3a 20 35 2d 35 2d 33 7f 31 33 34 35 37 37 34 0a 52 65 66 | .1345281.Node:.5-5-3.1345774.Ref |
| 16c780 | 3a 20 35 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 33 35 39 37 34 31 0a 52 65 66 3a 20 | :.5-5-3-Footnote-1.1359741.Ref:. |
| 16c7a0 | 35 2d 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 33 35 39 39 38 32 0a 52 65 66 3a 20 35 2d | 5-5-3-Footnote-2.1359982.Ref:.5- |
| 16c7c0 | 35 2d 33 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 33 36 31 31 38 33 0a 4e 6f 64 65 3a 20 35 2d 35 | 5-3-Footnote-3.1361183.Node:.5-5 |
| 16c7e0 | 2d 34 7f 31 33 36 31 33 32 31 0a 52 65 66 3a 20 35 2d 35 2d 34 2d 46 6f 6f 74 6e 6f 74 65 2d 31 | -4.1361321.Ref:.5-5-4-Footnote-1 |
| 16c800 | 7f 31 33 36 38 36 34 31 0a 4e 6f 64 65 3a 20 35 2d 35 2d 35 7f 31 33 36 38 38 38 34 0a 52 65 66 | .1368641.Node:.5-5-5.1368884.Ref |
| 16c820 | 3a 20 45 78 65 72 63 69 73 65 20 35 2d 33 33 7f 31 33 37 35 36 36 36 0a 52 65 66 3a 20 45 78 65 | :.Exercise.5-33.1375666.Ref:.Exe |
| 16c840 | 72 63 69 73 65 20 35 2d 33 34 7f 31 33 37 36 31 33 38 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 | rcise.5-34.1376138.Ref:.Figure.5 |
| 16c860 | 2d 31 37 7f 31 33 37 36 36 38 35 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 33 35 7f 31 | -17.1376685.Ref:.Exercise.5-35.1 |
| 16c880 | 33 38 31 33 30 38 0a 52 65 66 3a 20 46 69 67 75 72 65 20 35 2d 31 38 7f 31 33 38 31 34 31 35 0a | 381308.Ref:.Figure.5-18.1381415. |
| 16c8a0 | 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 33 36 7f 31 33 38 34 30 36 32 0a 52 65 66 3a 20 | Ref:.Exercise.5-36.1384062.Ref:. |
| 16c8c0 | 45 78 65 72 63 69 73 65 20 35 2d 33 37 7f 31 33 38 34 36 31 33 0a 52 65 66 3a 20 45 78 65 72 63 | Exercise.5-37.1384613.Ref:.Exerc |
| 16c8e0 | 69 73 65 20 35 2d 33 38 7f 31 33 38 35 30 39 34 0a 52 65 66 3a 20 35 2d 35 2d 35 2d 46 6f 6f 74 | ise.5-38.1385094.Ref:.5-5-5-Foot |
| 16c900 | 6e 6f 74 65 2d 31 7f 31 33 38 38 39 34 39 0a 52 65 66 3a 20 35 2d 35 2d 35 2d 46 6f 6f 74 6e 6f | note-1.1388949.Ref:.5-5-5-Footno |
| 16c920 | 74 65 2d 32 7f 31 33 38 39 31 39 38 0a 4e 6f 64 65 3a 20 35 2d 35 2d 36 7f 31 33 38 39 35 35 33 | te-2.1389198.Node:.5-5-6.1389553 |
| 16c940 | 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 33 39 7f 31 33 39 34 32 39 32 0a 52 65 66 3a | .Ref:.Exercise.5-39.1394292.Ref: |
| 16c960 | 20 45 78 65 72 63 69 73 65 20 35 2d 34 30 7f 31 33 39 34 38 35 33 0a 52 65 66 3a 20 45 78 65 72 | .Exercise.5-40.1394853.Ref:.Exer |
| 16c980 | 63 69 73 65 20 35 2d 34 31 7f 31 33 39 35 31 30 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 | cise.5-41.1395108.Ref:.Exercise. |
| 16c9a0 | 35 2d 34 32 7f 31 33 39 35 37 36 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 34 33 7f | 5-42.1395760.Ref:.Exercise.5-43. |
| 16c9c0 | 31 33 39 36 37 38 36 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 34 34 7f 31 33 39 37 34 | 1396786.Ref:.Exercise.5-44.13974 |
| 16c9e0 | 30 39 0a 52 65 66 3a 20 35 2d 35 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 33 39 38 36 38 35 | 09.Ref:.5-5-6-Footnote-1.1398685 |
| 16ca00 | 0a 52 65 66 3a 20 35 2d 35 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 33 39 38 37 39 37 0a 52 | .Ref:.5-5-6-Footnote-2.1398797.R |
| 16ca20 | 65 66 3a 20 35 2d 35 2d 36 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 33 39 39 30 33 39 0a 4e 6f 64 | ef:.5-5-6-Footnote-3.1399039.Nod |
| 16ca40 | 65 3a 20 35 2d 35 2d 37 7f 31 33 39 39 34 38 30 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 | e:.5-5-7.1399480.Ref:.Exercise.5 |
| 16ca60 | 2d 34 35 7f 31 34 30 36 35 35 38 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 34 36 7f 31 | -45.1406558.Ref:.Exercise.5-46.1 |
| 16ca80 | 34 30 38 36 38 37 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 34 37 7f 31 34 30 39 33 34 | 408687.Ref:.Exercise.5-47.140934 |
| 16caa0 | 39 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 34 38 7f 31 34 31 30 37 35 38 0a 52 65 66 | 9.Ref:.Exercise.5-48.1410758.Ref |
| 16cac0 | 3a 20 45 78 65 72 63 69 73 65 20 35 2d 34 39 7f 31 34 31 31 34 34 35 0a 52 65 66 3a 20 45 78 65 | :.Exercise.5-49.1411445.Ref:.Exe |
| 16cae0 | 72 63 69 73 65 20 35 2d 35 30 7f 31 34 31 31 39 35 33 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 | rcise.5-50.1411953.Ref:.Exercise |
| 16cb00 | 20 35 2d 35 31 7f 31 34 31 32 34 30 31 0a 52 65 66 3a 20 45 78 65 72 63 69 73 65 20 35 2d 35 32 | .5-51.1412401.Ref:.Exercise.5-52 |
| 16cb20 | 7f 31 34 31 32 37 34 38 0a 52 65 66 3a 20 35 2d 35 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 31 7f 31 | .1412748.Ref:.5-5-7-Footnote-1.1 |
| 16cb40 | 34 31 33 30 37 31 0a 52 65 66 3a 20 35 2d 35 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 32 7f 31 34 31 | 413071.Ref:.5-5-7-Footnote-2.141 |
| 16cb60 | 33 33 33 38 0a 52 65 66 3a 20 35 2d 35 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 33 7f 31 34 31 33 37 | 3338.Ref:.5-5-7-Footnote-3.14137 |
| 16cb80 | 31 39 0a 52 65 66 3a 20 35 2d 35 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 34 7f 31 34 31 34 33 37 38 | 19.Ref:.5-5-7-Footnote-4.1414378 |
| 16cba0 | 0a 52 65 66 3a 20 35 2d 35 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 35 7f 31 34 31 34 35 31 37 0a 52 | .Ref:.5-5-7-Footnote-5.1414517.R |
| 16cbc0 | 65 66 3a 20 35 2d 35 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 36 7f 31 34 31 35 38 39 31 0a 52 65 66 | ef:.5-5-7-Footnote-6.1415891.Ref |
| 16cbe0 | 3a 20 35 2d 35 2d 37 2d 46 6f 6f 74 6e 6f 74 65 2d 37 7f 31 34 31 36 34 37 36 0a 4e 6f 64 65 3a | :.5-5-7-Footnote-7.1416476.Node: |
| 16cc00 | 20 52 65 66 65 72 65 6e 63 65 73 7f 31 34 31 36 38 37 31 0a 4e 6f 64 65 3a 20 49 6e 64 65 78 7f | .References.1416871.Node:.Index. |
| 16cc20 | 31 34 33 32 39 39 31 0a 1f 0a 45 6e 64 20 54 61 67 20 54 61 62 6c 65 0a 00 00 00 00 00 00 00 00 | 1432991...End.Tag.Table......... |
| 16cc40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cc60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cc80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cca0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ccc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cce0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cd00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cd20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cd40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cd60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cd80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cda0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cdc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cde0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ce00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ce20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ce40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ce60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ce80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cea0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cec0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cee0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cf00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cf20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cf40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cf60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cf80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cfa0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cfc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16cfe0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d000 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d020 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d080 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d0a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d0c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d0e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d100 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d120 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d140 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d160 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d180 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d1a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d1c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d1e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d200 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d220 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d240 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d260 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d280 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d2a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d2c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d2e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d300 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d320 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d340 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d360 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d380 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d3a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d3c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d3e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d400 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d420 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d440 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d460 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d480 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d4a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d4c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d4e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d500 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d520 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d540 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d560 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d580 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d5a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d5c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d5e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d600 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d620 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d640 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d660 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d680 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d6a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d6c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d6e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d700 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d720 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d740 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d760 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d780 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d7a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d7c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d7e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d800 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d820 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d840 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d860 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d880 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d8a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d8c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d8e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d900 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d920 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d940 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d960 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d980 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d9a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d9c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16d9e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16da00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16da20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16da40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16da60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16da80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16daa0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dac0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dae0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16db00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16db20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16db40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16db60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16db80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dba0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dbc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dbe0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dc00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dc20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dc40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dc60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dc80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dca0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dcc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dce0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dd00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dd20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dd40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dd60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dd80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dda0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ddc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dde0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16de00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16de20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16de40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16de60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16de80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dea0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dec0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dee0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16df00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16df20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16df40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16df60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16df80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dfa0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dfc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16dfe0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e000 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e020 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e080 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e0a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e0c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e0e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e100 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e120 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e140 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e160 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e180 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e1a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e1c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e1e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e200 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e220 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e240 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e260 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e280 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e2a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e2c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e2e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e300 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e320 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e340 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e360 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e380 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e3a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e3c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e3e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e400 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e420 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e440 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e460 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e480 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e4a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e4c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e4e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e500 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e520 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e540 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e560 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e580 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e5a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e5c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e5e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e600 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e620 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e640 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e660 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e680 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e6a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e6c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e6e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e700 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e720 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e740 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e760 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e780 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e7a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e7c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e7e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e800 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e820 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e840 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e860 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e880 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e8a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e8c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e8e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e900 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e920 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e940 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e960 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e980 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e9a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e9c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16e9e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ea00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ea20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ea40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ea60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ea80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eaa0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eac0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eae0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eb00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eb20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eb40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eb60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eb80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eba0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ebc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ebe0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ec00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ec20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ec40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ec60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ec80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eca0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ecc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ece0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ed00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ed20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ed40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ed60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ed80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eda0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16edc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ede0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ee00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ee20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ee40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ee60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ee80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eea0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eec0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16eee0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ef00 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ef20 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ef40 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ef60 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16ef80 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16efa0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16efc0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16efe0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f000 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f020 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f040 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f060 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f080 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f0a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f0c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f0e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f100 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f120 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f140 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f160 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f180 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f1a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f1c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f1e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f200 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f220 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f240 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f260 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f280 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f2a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f2c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f2e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f300 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f320 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f340 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f360 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f380 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f3a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f3c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f3e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f400 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f420 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f440 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f460 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f480 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f4a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f4c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f4e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f500 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f520 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f540 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f560 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f580 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f5a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f5c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f5e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f600 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f620 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f640 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f660 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f680 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f6a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f6c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f6e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f700 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f720 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f740 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f760 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f780 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f7a0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f7c0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |
| 16f7e0 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................................ |