home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 1: Collection A / 17Bit_Collection_A.iso / files / 134.dms / in.adf < prev   
Amiga Disk Format (OFS)  |  1993-02-16  |  880.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: Amiga Disk Format (OFS) (archive/adfOFS).

You can browse this item here: in.adf

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Amiga Disk Format (OFS) (archive/adfOFS) magic Supported
65% dexvert Amiga Disk Format (FFS) (archive/adfFFS) ext Supported
1% dexvert ABackup Disk Image (archive/abackupDiskImage) ext Unsupported
100% file Amiga DOS disk (DD 880 KiB), probably root block 880, bootable 0x43fa00184eaeffa0.., "Blank" default
99% file data default
57% TrID Amiga Disk image File (OFS) default
42% TrID Amiga Disk image File (generic) default (weak)
100% siegfried fmt/1361 Amiga Disk File default
100% disktype Amiga OFS file system (non-intl.) Type "DOS\0" Size matches DD floppy default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 44 4f 53 00 62 6f bf 61 | 00 00 03 70 43 fa 00 18 |DOS.bo.a|...pC...|
|00000010| 4e ae ff a0 4a 80 67 0a | 20 40 20 68 00 16 70 00 |N...J.g.| @ h..p.|
|00000020| 4e 75 70 ff 60 fa 64 6f | 73 2e 6c 69 62 72 61 72 |Nup.`.do|s.librar|
|00000030| 79 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 08 |y.......|........|
|00000040| 00 00 00 d8 00 c0 65 d8 | 00 00 00 08 4e f9 00 fe |......e.|....N...|
|00000050| 49 96 4e f9 00 fe 49 80 | 4e f9 00 fe 49 16 00 c0 |I.N...I.|N...I...|
|00000060| 16 18 00 c0 03 c6 08 00 | 00 fe 48 9a 06 00 00 12 |........|..H.....|
|00000070| 00 29 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.)......|........|
|00000080| 00 c0 02 76 0f 00 0f 00 | 00 00 00 00 00 c0 16 80 |...v....|........|
|00000090| 00 c0 15 ea 08 00 00 fe | 4f fe 00 c0 96 78 00 00 |........|O....x..|
|000000a0| 00 00 00 c0 16 34 00 00 | 00 c0 16 2a 00 c0 96 78 |.....4..|...*...x|
|000000b0| 00 00 00 fe 88 7e 00 fe | 84 6c 00 fe 84 e4 00 fe |.....~..|.l......|
|000000c0| 84 4e 00 fe 84 5d 00 fe | 84 ac 00 fe 85 e4 00 fe |.N...]..|........|
|000000d0| 84 56 00 fe 84 65 00 00 | 00 00 00 00 4e f9 00 fc |.V...e..|....N...|
|000000e0| 47 28 4e f9 00 fc 47 0a | 4e f9 00 fc 46 e6 4e f9 |G(N...G.|N...F.N.|
|000000f0| 00 fc 46 90 00 c0 17 18 | 00 c0 16 18 08 00 00 fc |..F.....|........|
|00000100| 45 34 00 00 00 18 00 7c | 00 00 00 00 00 00 00 00 |E4.....||........|
|00000110| 00 00 00 00 00 00 00 bf | e0 01 00 08 0a 04 00 c0 |........|........|
|00000120| 04 ec 00 c0 04 e8 02 00 | 00 fc 45 34 00 c0 16 80 |........|..E4....|
|00000130| 00 fc 46 1c 00 00 00 00 | 00 00 00 00 00 00 00 00 |..F.....|........|
|00000140| 00 c0 22 a8 00 fe 97 26 | 00 c0 22 d2 00 00 00 00 |.."....&|..".....|
|00000150| 00 00 00 00 00 00 00 00 | 00 c0 1f bc 00 fe 57 1c |........|......W.|
|00000160| 00 c0 20 16 00 00 00 00 | 00 00 00 00 00 00 00 00 |.. .....|........|
|00000170| 00 c0 16 c8 4e f9 00 fc | 47 28 4e f9 00 fc 47 0a |....N...|G(N...G.|
|00000180| 4e f9 00 fc 46 e6 4e f9 | 00 fc 46 90 00 c0 1a de |N...F.N.|..F.....|
|00000190| 00 c0 16 80 08 00 00 fc | 45 42 00 00 00 18 00 7c |........|EB.....||
|000001a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 bf |........|........|
|000001b0| d0 00 20 00 04 00 00 c0 | 05 2e 00 c0 05 2a 02 00 |.. .....|.....*..|
|000001c0| 00 fc 45 42 00 c0 17 18 | 00 fc 46 10 00 00 00 00 |..EB....|..F.....|
|000001d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000001e0| 00 00 00 00 00 c0 1d fe | 00 fc 6d 68 00 c0 1e 5e |........|..mh...^|
|000001f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 c0 1a de |........|........|
|00000200| 00 fc 4a b0 00 c0 1b 58 | a0 8a 00 c0 4e f9 00 fe |..J....X|....N...|
|00000210| 48 62 4e f9 00 fe 48 2a | 00 c0 03 ca 00 c0 1a de |HbN...H*|........|
|00000220| 08 00 00 fe 47 8e 06 00 | 00 0c 00 32 00 20 00 0a |....G...|...2. ..|
|00000230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 c0 42 18 |........|......B.|
|00000250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000260| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 c0 45 c8 |........|......E.|
|00000270| 00 00 00 08 00 fc 00 b6 | 00 fc 4a fc 00 fe 48 80 |........|..J...H.|
|00000280| 00 fe 4f e4 00 fc 45 0c | 00 fc 47 94 00 fe 47 74 |..O...E.|..G...Gt|
|00000290| 00 fe 49 cc 00 fc 53 78 | 00 fe 50 2e 00 fe 50 7a |..I...Sx|..P...Pz|
|000002a0| 00 fe 90 ec 00 fc 34 cc | 00 fe 50 c6 00 fe 0d 90 |......4.|..P.....|
|000002b0| 00 fe 51 0e 00 fe 98 e4 | 00 fd 3f 5c 00 fc 32 3a |..Q.....|..?\..2:|
|000002c0| 00 fe 42 4c 00 fe b4 00 | 00 ff 42 5a 00 c0 a0 70 |..BL....|..BZ...p|
|000002d0| 00 00 00 00 4e f9 00 fc | 52 84 4e f9 00 fc 51 70 |....N...|R.N...Qp|
|000002e0| 4e f9 00 fc 51 3e 4e f9 | 00 fc 51 32 4e f9 00 fc |N...Q>N.|..Q2N...|
|000002f0| 51 20 4e f9 00 fc 51 0e | 4e f9 00 fc 50 4a 4e f9 |Q N...Q.|N...PJN.|
|00000300| 00 fc 4f d8 4e f9 00 fc | 50 5e 4e f9 00 fc 50 2e |..O.N...|P^N...P.|
|00000310| 4e f9 00 fc 4f 84 4e f9 | 00 fc 4e a2 4e f9 00 fc |N...O.N.|..N.N...|
|00000320| 4f 68 4e f9 00 fc 4f f8 | 4e f9 00 fc 4e 1e 4e f9 |OhN...O.|N...N.N.|
|00000330| 00 fc 4c 72 4e f9 00 fc | 4e b4 4e f9 00 fc 4e 8c |..LrN...|N.N...N.|
|00000340| 4e f9 00 fc 4f 50 4e f9 | 00 fc 4e 74 4e f9 00 fc |N...OPN.|..NtN...|
|00000350| 4f bc 4e f9 00 fc 4c 08 | 4e f9 00 fc 4c 08 4e f9 |O.N...L.|N...L.N.|
|00000360| 00 fc 4c 04 4e f9 00 fc | 4b fc 00 c0 1d fe 00 c0 |..L.N...|K.......|
|00000370| 02 76 08 00 00 fc 4b 48 | 04 00 00 96 01 c8 00 21 |.v....KH|.......!|
|00000380| 00 79 00 fc 4b 16 8b 13 | 00 00 00 00 00 00 00 c0 |.y..K...|........|
|00000390| 02 76 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.v......|........|
|000003a0| 00 00 00 00 00 00 00 c0 | 19 36 00 00 00 00 00 c0 |........|.6......|
|000003b0| 19 32 00 00 00 c0 19 44 | 00 00 00 00 00 c0 19 40 |.2.....D|.......@|
|000003c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000003e0| 00 00 01 01 01 01 01 01 | 01 01 01 01 01 01 01 01 |........|........|
|000003f0| 01 01 01 01 01 01 01 01 | 01 01 01 01 01 01 01 01 |........|........|
|00000400| 00 00 00 08 00 00 04 03 | 00 00 00 2a 00 00 01 e8 |........|...*....|
|00000410| 00 00 00 03 09 cc 65 0c | 20 20 20 20 20 20 20 20 |......e.| |
|00000420| 20 20 20 20 20 20 73 6f | 72 74 65 64 20 7c 7c 3a | so|rted ||:|
|00000430| 3d 20 72 6f 6f 74 73 20 | 20 20 20 20 20 20 20 20 |= roots | |
|00000440| 23 20 61 64 64 20 74 6f | 20 73 6f 72 74 65 64 20 |# add to| sorted |
|00000450| 6e 6f 64 65 73 0a 20 20 | 20 20 20 20 20 20 20 20 |nodes. | |
|00000460| 20 20 20 20 20 20 20 6e | 6f 64 65 73 20 2d 2d 3a | n|odes --:|
|00000470| 3d 20 72 6f 6f 74 73 20 | 20 20 20 20 20 20 20 20 |= roots | |
|00000480| 20 23 20 64 65 6c 65 74 | 65 20 74 68 65 73 65 20 | # delet|e these |
|00000490| 6e 6f 64 65 73 0a 20 20 | 20 20 20 20 20 20 20 20 |nodes. | |
|000004a0| 20 20 20 20 20 20 20 61 | 72 63 73 20 3a 3d 20 64 | a|rcs := d|
|000004b0| 65 6c 61 72 63 73 28 61 | 72 63 73 2c 72 6f 6f 74 |elarcs(a|rcs,root|
|000004c0| 73 29 23 20 64 65 6c 65 | 74 65 20 74 68 65 69 72 |s)# dele|te their|
|000004d0| 20 61 72 63 73 0a 20 20 | 20 20 20 20 20 20 20 20 | arcs. | |
|000004e0| 20 20 20 20 20 20 20 7d | 0a 20 20 20 20 20 20 20 | }|. |
|000004f0| 20 20 20 20 20 20 20 69 | 66 20 2a 61 72 63 73 20 | i|f *arcs |
|00000500| 3d 20 30 20 74 68 65 6e | 20 77 72 69 74 65 28 73 |= 0 then| write(s|
|00000510| 6f 72 74 65 64 29 23 20 | 73 75 63 63 65 73 73 66 |orted)# |successf|
|00000520| 75 6c 6c 79 20 73 6f 72 | 74 65 64 0a 20 20 20 20 |ully sor|ted. |
|00000530| 20 20 20 20 20 20 20 20 | 20 20 65 6c 73 65 20 77 | | else w|
|00000540| 72 69 74 65 28 22 67 72 | 61 70 68 20 68 61 73 20 |rite("gr|aph has |
|00000550| 63 79 63 6c 65 22 29 23 | 20 63 79 63 6c 65 20 69 |cycle")#| cycle i|
|00000560| 66 20 6e 6f 64 65 20 72 | 65 6d 61 69 6e 73 0a 20 |f node r|emains. |
|00000570| 20 20 20 20 20 20 20 20 | 20 20 7d 0a 20 20 20 20 | | }. |
|00000580| 20 20 20 20 65 6e 64 0a | 0a 0a 20 20 20 20 20 20 | end.|.. |
|00000590| 20 20 70 72 6f 63 65 64 | 75 72 65 20 73 6e 6f 64 | proced|ure snod|
|000005a0| 65 73 28 61 72 63 73 29 | 0a 20 20 20 20 20 20 20 |es(arcs)|. |
|000005b0| 20 20 20 20 6c 6f 63 61 | 6c 20 6e 6f 64 65 73 0a | loca|l nodes.|
|000005c0| 20 20 20 20 20 20 20 20 | 20 20 20 6e 6f 64 65 73 | | nodes|
|000005d0| 20 3a 3d 20 22 22 0a 20 | 20 20 20 20 20 20 20 20 | := "". | |
|000005e0| 20 20 61 72 63 73 20 3f | 20 77 68 69 6c 65 20 6d | arcs ?| while m|
|000005f0| 6f 76 65 28 31 29 20 64 | 6f 20 7b 20 20 20 20 20 |ove(1) d|o { |
|00000600| 00 00 00 08 00 00 04 03 | 00 00 00 2b 00 00 01 e8 |........|...+....|
|00000610| 00 00 00 04 54 43 24 89 | 20 20 23 20 70 72 65 64 |....TC$.| # pred|
|00000620| 65 63 65 73 73 6f 72 0a | 20 20 20 20 20 20 20 20 |ecessor.| |
|00000630| 20 20 20 20 20 20 6d 6f | 76 65 28 32 29 20 20 20 | mo|ve(2) |
|00000640| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000650| 20 20 20 23 20 73 6b 69 | 70 20 22 2d 3e 22 0a 20 | # ski|p "->". |
|00000660| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 6e 6f 64 | | nod|
|00000670| 65 73 20 7c 7c 3a 3d 20 | 6d 6f 76 65 28 31 29 20 |es ||:= |move(1) |
|00000680| 20 20 20 20 20 20 20 20 | 20 20 23 20 73 75 63 63 | | # succ|
|00000690| 65 73 73 6f 72 0a 20 20 | 20 20 20 20 20 20 20 20 |essor. | |
|000006a0| 20 20 20 20 6d 6f 76 65 | 28 31 29 20 20 20 20 20 | move|(1) |
|000006b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000006c0| 20 23 20 73 6b 69 70 20 | 22 3b 22 0a 20 20 20 20 | # skip |";". |
|000006d0| 20 20 20 20 20 20 20 20 | 20 20 7d 0a 20 20 20 20 | | }. |
|000006e0| 20 20 20 20 20 20 20 72 | 65 74 75 72 6e 20 6e 6f | r|eturn no|
|000006f0| 64 65 73 0a 20 20 20 20 | 20 20 20 20 65 6e 64 0a |des. | end.|
|00000700| 0a 0a 20 20 20 20 20 20 | 20 20 70 72 6f 63 65 64 |.. | proced|
|00000710| 75 72 65 20 64 65 6c 61 | 72 63 73 28 61 72 63 73 |ure dela|rcs(arcs|
|00000720| 2c 72 6f 6f 74 73 29 0a | 20 20 20 20 20 20 20 20 |,roots).| |
|00000730| 20 20 20 6c 6f 63 61 6c | 20 6e 65 77 61 72 63 73 | local| newarcs|
|00000740| 2c 20 6e 6f 64 65 0a 20 | 20 20 20 20 20 20 20 20 |, node. | |
|00000750| 20 20 6e 65 77 61 72 63 | 73 20 3a 3d 20 22 22 0a | newarc|s := "".|
|00000760| 20 20 20 20 20 20 20 20 | 20 20 20 61 72 63 73 20 | | arcs |
|00000770| 3f 20 77 68 69 6c 65 20 | 6e 6f 64 65 20 3a 3d 20 |? while |node := |
|00000780| 6d 6f 76 65 28 31 29 20 | 64 6f 20 7b 23 20 67 65 |move(1) |do {# ge|
|00000790| 74 20 70 72 65 64 65 63 | 65 73 73 6f 72 20 6e 6f |t predec|essor no|
|000007a0| 64 65 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |de. | |
|000007b0| 20 69 66 20 6d 61 6e 79 | 28 72 6f 6f 74 73 2c 6e | if many|(roots,n|
|000007c0| 6f 64 65 29 20 74 68 65 | 6e 20 6d 6f 76 65 28 34 |ode) the|n move(4|
|000007d0| 29 23 20 64 65 6c 65 74 | 65 20 61 72 63 20 66 72 |)# delet|e arc fr|
|000007e0| 6f 6d 20 72 6f 6f 74 20 | 6e 6f 64 65 0a 20 20 20 |om root |node. |
|000007f0| 20 20 20 20 20 20 20 20 | 20 20 20 65 6c 73 65 20 | | else |
|00000800| 00 00 00 08 00 00 04 03 | 00 00 00 2c 00 00 01 e8 |........|...,....|
|00000810| 00 00 00 05 1f e2 34 da | 6e 65 77 61 72 63 73 20 |......4.|newarcs |
|00000820| 7c 7c 3a 3d 20 6e 6f 64 | 65 20 7c 7c 20 6d 6f 76 |||:= nod|e || mov|
|00000830| 65 28 34 29 23 20 65 6c | 73 65 20 6b 65 65 70 20 |e(4)# el|se keep |
|00000840| 61 72 63 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |arc. | |
|00000850| 20 20 7d 0a 20 20 20 20 | 20 20 20 20 20 20 20 72 | }. | r|
|00000860| 65 74 75 72 6e 20 6e 65 | 77 61 72 63 73 0a 20 20 |eturn ne|warcs. |
|00000870| 20 20 20 20 20 20 65 6e | 64 0a 0a 47 72 61 70 68 | en|d..Graph|
|00000880| 20 6e 6f 64 65 73 20 61 | 72 65 20 72 65 70 72 65 | nodes a|re repre|
|00000890| 73 65 6e 74 65 64 20 62 | 79 20 73 69 6e 67 6c 65 |sented b|y single|
|000008a0| 20 63 68 61 72 61 63 74 | 65 72 73 20 77 69 74 68 | charact|ers with|
|000008b0| 20 61 20 6c 69 73 74 20 | 6f 66 0a 74 68 65 20 6e | a list |of.the n|
|000008c0| 6f 64 65 73 20 6f 6e 20 | 6f 6e 65 20 69 6e 70 75 |odes on |one inpu|
|000008d0| 74 20 6c 69 6e 65 20 66 | 6f 6c 6c 6f 77 65 64 20 |t line f|ollowed |
|000008e0| 62 79 20 61 20 6c 69 73 | 74 20 6f 66 20 61 72 63 |by a lis|t of arc|
|000008f0| 73 2e 20 46 6f 72 20 65 | 78 61 6d 2d 0a 70 6c 65 |s. For e|xam-.ple|
|00000900| 2c 20 74 68 65 20 67 72 | 61 70 68 0a 0a 0a 0a 0a |, the gr|aph.....|
|00000910| 0a 0a 0a 0a 0a 0a 0a 20 | 20 20 20 20 20 20 20 20 |....... | |
|00000920| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000930| 20 20 20 20 2d 20 31 32 | 20 2d 0a 0a 0a 0a 0a 0a | - 12| -......|
|00000940| 0a 0a 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|00000950| 20 20 20 20 20 2e 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d | .--|--------|
|00000960| 2d 2d 2d 2d 2d 2e 0a 20 | 20 20 20 20 20 20 20 20 |-----.. | |
|00000970| 20 20 20 20 20 20 20 20 | 20 7c 20 20 20 20 20 20 | | | |
|00000980| 20 20 20 20 20 20 20 20 | 20 7c 0a 20 20 20 20 20 | | |. |
|00000990| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7c 20 20 | | | |
|000009a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 7c 0a 20 | | |. |
|000009b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000009c0| 20 61 2d 2d 2d 2d 2d 2d | 3e 62 2d 2d 2d 2d 2d 2d | a------|>b------|
|000009d0| 3e 63 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |>c. | |
|000009e0| 20 20 20 20 20 7c 20 20 | 20 20 20 20 20 7c 20 20 | | | | |
|000009f0| 20 20 20 20 20 7c 0a 20 | 20 20 20 20 20 20 20 20 | |. | |
|00000a00| 00 00 00 08 00 00 04 03 | 00 00 00 2d 00 00 01 e8 |........|...-....|
|00000a10| 00 00 00 06 95 99 8e 75 | 20 20 20 20 20 20 20 20 |.......u| |
|00000a20| 20 7c 20 20 20 20 20 20 | 20 7c 20 20 20 20 20 20 | | | | |
|00000a30| 20 7c 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | |. | |
|00000a40| 20 20 20 20 20 7c 20 20 | 20 20 20 20 20 76 20 20 | | | v |
|00000a50| 20 20 20 20 20 7c 0a 20 | 20 20 20 20 20 20 20 20 | |. | |
|00000a60| 20 20 20 20 20 20 20 20 | 20 64 2d 2d 2d 2d 2d 2d | | d------|
|00000a70| 3e 65 2d 2d 2d 2d 2d 2d | 2d 27 0a 0a 0a 69 73 20 |>e------|-'...is |
|00000a80| 67 69 76 65 6e 20 61 73 | 0a 0a 20 20 20 20 20 20 |given as|.. |
|00000a90| 20 20 61 62 63 64 65 0a | 20 20 20 20 20 20 20 20 | abcde.| |
|00000aa0| 61 2d 3e 62 3b 61 2d 3e | 63 3b 62 2d 3e 63 3b 62 |a->b;a->|c;b->c;b|
|00000ab0| 2d 3e 65 3b 64 2d 3e 61 | 3b 64 2d 3e 65 3b 65 2d |->e;d->a|;d->e;e-|
|00000ac0| 3e 63 3b 0a 0a 66 6f 72 | 20 77 68 69 63 68 20 74 |>c;..for| which t|
|00000ad0| 68 65 20 6f 75 74 70 75 | 74 20 69 73 0a 0a 20 20 |he outpu|t is.. |
|00000ae0| 20 20 20 20 20 20 64 61 | 62 65 63 0a 0a 0a 20 20 | da|bec... |
|00000af0| 20 54 68 65 20 6e 6f 64 | 65 73 20 61 72 65 20 72 | The nod|es are r|
|00000b00| 65 70 72 65 73 65 6e 74 | 65 64 20 62 79 20 63 73 |epresent|ed by cs|
|00000b10| 65 74 73 20 61 6e 64 20 | 61 75 74 6f 6d 61 74 69 |ets and |automati|
|00000b20| 63 20 74 79 70 65 20 63 | 6f 6e 76 65 72 2d 0a 73 |c type c|onver-.s|
|00000b30| 69 6f 6e 20 69 73 20 75 | 73 65 64 20 74 6f 20 63 |ion is u|sed to c|
|00000b40| 6f 6e 76 65 72 74 20 73 | 74 72 69 6e 67 73 20 74 |onvert s|trings t|
|00000b50| 6f 20 63 73 65 74 73 20 | 61 6e 64 20 76 69 63 65 |o csets |and vice|
|00000b60| 20 76 65 72 73 61 2e 20 | 20 4e 6f 74 65 0a 74 68 | versa. | Note.th|
|00000b70| 65 20 75 73 65 20 6f 66 | 20 61 75 67 6d 65 6e 74 |e use of| augment|
|00000b80| 65 64 20 61 73 73 69 67 | 6e 6d 65 6e 74 20 6f 70 |ed assig|nment op|
|00000b90| 65 72 61 74 69 6f 6e 73 | 20 66 6f 72 20 63 6f 6e |erations| for con|
|00000ba0| 63 61 74 65 6e 61 74 69 | 6f 6e 20 61 6e 64 0a 69 |catenati|on and.i|
|00000bb0| 6e 20 74 68 65 20 63 6f | 6d 70 75 74 61 74 69 6f |n the co|mputatio|
|00000bc0| 6e 20 6f 66 20 63 73 65 | 74 20 64 69 66 66 65 72 |n of cse|t differ|
|00000bd0| 65 6e 63 65 73 2e 0a 0a | 41 63 6b 6e 6f 77 6c 65 |ences...|Acknowle|
|00000be0| 64 67 65 6d 65 6e 74 0a | 0a 20 20 20 49 63 6f 6e |dgement.|. Icon|
|00000bf0| 20 77 61 73 20 64 65 73 | 69 67 6e 65 64 20 62 79 | was des|igned by|
|00000c00| 00 00 00 08 00 00 04 03 | 00 00 00 2e 00 00 01 e8 |........|........|
|00000c10| 00 00 00 07 08 4b 2b 14 | 20 74 68 65 20 74 68 65 |.....K+.| the the|
|00000c20| 20 61 75 74 68 6f 72 20 | 69 6e 20 63 6f 6c 6c 61 | author |in colla|
|00000c30| 62 6f 72 61 74 69 6f 6e | 20 77 69 74 68 20 44 61 |boration| with Da|
|00000c40| 76 65 0a 48 61 6e 73 6f | 6e 2c 20 54 69 6d 20 4b |ve.Hanso|n, Tim K|
|00000c50| 6f 72 62 2c 20 43 61 72 | 79 20 43 6f 75 74 61 6e |orb, Car|y Coutan|
|00000c60| 74 2c 20 61 6e 64 20 53 | 74 65 76 65 20 57 61 6d |t, and S|teve Wam|
|00000c70| 70 6c 65 72 2e 20 54 68 | 65 20 63 75 72 72 65 6e |pler. Th|e curren|
|00000c80| 74 0a 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |t.implem|entation|
|00000c90| 20 69 73 20 6c 61 72 67 | 65 6c 79 20 74 68 65 20 | is larg|ely the |
|00000ca0| 77 6f 72 6b 20 6f 66 20 | 43 61 72 79 20 43 6f 75 |work of |Cary Cou|
|00000cb0| 74 61 6e 74 20 61 6e 64 | 20 53 74 65 76 65 0a 57 |tant and| Steve.W|
|00000cc0| 61 6d 70 6c 65 72 20 77 | 69 74 68 20 72 65 63 65 |ampler w|ith rece|
|00000cd0| 6e 74 20 63 6f 6e 74 72 | 69 62 75 74 69 6f 6e 73 |nt contr|ibutions|
|00000ce0| 20 62 79 20 42 69 6c 6c | 20 4d 69 74 63 68 65 6c | by Bill| Mitchel|
|00000cf0| 6c 2e 20 20 44 61 76 65 | 20 48 61 6e 73 6f 6e 0a |l. Dave| Hanson.|
|00000d00| 61 6e 64 20 42 69 6c 6c | 20 4d 69 74 63 68 65 6c |and Bill| Mitchel|
|00000d10| 6c 20 61 6c 73 6f 20 6d | 61 64 65 20 73 65 76 65 |l also m|ade seve|
|00000d20| 72 61 6c 20 68 65 6c 70 | 66 75 6c 20 73 75 67 67 |ral help|ful sugg|
|00000d30| 65 73 74 69 6f 6e 73 20 | 6f 6e 20 74 68 65 0a 70 |estions |on the.p|
|00000d40| 72 65 73 65 6e 74 61 74 | 69 6f 6e 20 6f 66 20 6d |resentat|ion of m|
|00000d50| 61 74 65 72 69 61 6c 20 | 69 6e 20 74 68 69 73 20 |aterial |in this |
|00000d60| 70 61 70 65 72 2e 0a 0a | 52 65 66 65 72 65 6e 63 |paper...|Referenc|
|00000d70| 65 73 0a 0a 0a 31 2e 20 | 47 72 69 73 77 6f 6c 64 |es...1. |Griswold|
|00000d80| 2c 20 52 61 6c 70 68 20 | 45 2e 2c 20 50 6f 61 67 |, Ralph |E., Poag|
|00000d90| 65 2c 20 4a 61 6d 65 73 | 20 46 2e 2c 20 61 6e 64 |e, James| F., and|
|00000da0| 20 50 6f 6c 6f 6e 73 6b | 79 2c 20 49 76 61 6e 20 | Polonsk|y, Ivan |
|00000db0| 50 2e 0a 20 20 20 54 68 | 65 20 53 4e 4f 42 4f 4c |P.. Th|e SNOBOL|
|00000dc0| 34 20 50 72 6f 67 72 61 | 6d 6d 69 6e 67 20 4c 61 |4 Progra|mming La|
|00000dd0| 6e 67 75 61 67 65 2c 20 | 73 65 63 6f 6e 64 20 65 |nguage, |second e|
|00000de0| 64 69 74 69 6f 6e 2e 20 | 20 50 72 65 6e 74 69 63 |dition. | Prentic|
|00000df0| 65 2d 0a 20 20 20 48 61 | 6c 6c 2c 20 49 6e 63 2e |e-. Ha|ll, Inc.|
|00000e00| 00 00 00 08 00 00 04 03 | 00 00 00 2f 00 00 01 e8 |........|.../....|
|00000e10| 00 00 00 08 d3 1d 6e cb | 2c 20 45 6e 67 6c 65 77 |......n.|, Englew|
|00000e20| 6f 6f 64 20 43 6c 69 66 | 66 73 2c 20 4e 65 77 20 |ood Clif|fs, New |
|00000e30| 4a 65 72 73 65 79 2e 20 | 31 39 37 31 2e 0a 0a 32 |Jersey. |1971...2|
|00000e40| 2e 20 4b 65 72 6e 69 67 | 68 61 6e 2c 20 42 72 69 |. Kernig|han, Bri|
|00000e50| 61 6e 20 57 2e 20 61 6e | 64 20 52 69 74 63 68 69 |an W. an|d Ritchi|
|00000e60| 65 2c 20 44 65 6e 6e 69 | 73 20 4d 2e 20 54 68 65 |e, Denni|s M. The|
|00000e70| 20 43 20 50 72 6f 67 72 | 61 6d 6d 69 6e 67 0a 20 | C Progr|amming. |
|00000e80| 20 20 4c 61 6e 67 75 61 | 67 65 2e 20 50 72 65 6e | Langua|ge. Pren|
|00000e90| 74 69 63 65 2d 48 61 6c | 6c 2c 20 49 6e 63 2e 2c |tice-Hal|l, Inc.,|
|00000ea0| 20 45 6e 67 6c 65 77 6f | 6f 64 20 43 6c 69 66 66 | Englewo|od Cliff|
|00000eb0| 73 2c 20 4e 65 77 20 4a | 65 72 73 65 79 2e 0a 20 |s, New J|ersey.. |
|00000ec0| 20 20 31 39 37 38 2e 0a | 0a 33 2e 20 47 72 69 73 | 1978..|.3. Gris|
|00000ed0| 77 6f 6c 64 2c 20 52 61 | 6c 70 68 20 45 2e 20 44 |wold, Ra|lph E. D|
|00000ee0| 69 66 66 65 72 65 6e 63 | 65 73 20 42 65 74 77 65 |ifferenc|es Betwe|
|00000ef0| 65 6e 20 56 65 72 73 69 | 6f 6e 73 20 32 20 61 6e |en Versi|ons 2 an|
|00000f00| 64 20 35 20 6f 66 0a 20 | 20 20 49 63 6f 6e 2c 20 |d 5 of. | Icon, |
|00000f10| 54 65 63 68 6e 69 63 61 | 6c 20 52 65 70 6f 72 74 |Technica|l Report|
|00000f20| 20 54 52 20 38 33 2d 35 | 2c 20 44 65 70 61 72 74 | TR 83-5|, Depart|
|00000f30| 6d 65 6e 74 20 6f 66 20 | 43 6f 6d 70 75 74 65 72 |ment of |Computer|
|00000f40| 20 53 63 69 2d 0a 20 20 | 20 65 6e 63 65 2c 20 54 | Sci-. | ence, T|
|00000f50| 68 65 20 55 6e 69 76 65 | 72 73 69 74 79 20 6f 66 |he Unive|rsity of|
|00000f60| 20 41 72 69 7a 6f 6e 61 | 2e 20 31 39 38 33 2e 0a | Arizona|. 1983..|
|00000f70| 0a 34 2e 20 47 72 69 73 | 77 6f 6c 64 2c 20 52 61 |.4. Gris|wold, Ra|
|00000f80| 6c 70 68 20 45 2e 20 61 | 6e 64 20 47 72 69 73 77 |lph E. a|nd Grisw|
|00000f90| 6f 6c 64 2c 20 4d 61 64 | 67 65 20 54 2e 20 54 68 |old, Mad|ge T. Th|
|00000fa0| 65 20 49 63 6f 6e 20 50 | 72 6f 67 72 61 6d 6d 69 |e Icon P|rogrammi|
|00000fb0| 6e 67 0a 20 20 20 4c 61 | 6e 67 75 61 67 65 2e 20 |ng. La|nguage. |
|00000fc0| 50 72 65 6e 74 69 63 65 | 2d 48 61 6c 6c 2c 20 49 |Prentice|-Hall, I|
|00000fd0| 6e 63 2e 2c 20 45 6e 67 | 6c 65 77 6f 6f 64 20 43 |nc., Eng|lewood C|
|00000fe0| 6c 69 66 66 73 2c 20 4e | 65 77 20 4a 65 72 73 65 |liffs, N|ew Jerse|
|00000ff0| 79 2e 0a 20 20 20 31 39 | 38 33 2e 0a 0a 0a 0a 0a |y.. 19|83......|
|00001000| 00 00 00 08 00 00 04 03 | 00 00 00 30 00 00 01 e8 |........|...0....|
|00001010| 00 00 00 09 48 01 76 9b | 0a 20 20 20 20 20 20 20 |....H.v.|. |
|00001020| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001030| 20 20 20 20 20 20 2d 20 | 31 33 20 2d 0a 0a 0a 0a | - |13 -....|
|00001040| 0a 0a 0a 0a 0a 35 2e 20 | 47 72 69 73 77 6f 6c 64 |.....5. |Griswold|
|00001050| 2c 20 52 61 6c 70 68 20 | 45 2e 20 45 78 74 65 6e |, Ralph |E. Exten|
|00001060| 73 69 6f 6e 73 20 74 6f | 20 56 65 72 73 69 6f 6e |sions to| Version|
|00001070| 20 35 20 6f 66 20 74 68 | 65 20 49 63 6f 6e 20 50 | 5 of th|e Icon P|
|00001080| 72 6f 2d 0a 20 20 20 67 | 72 61 6d 6d 69 6e 67 20 |ro-. g|ramming |
|00001090| 4c 61 6e 67 75 61 67 65 | 2c 20 54 65 63 68 6e 69 |Language|, Techni|
|000010a0| 63 61 6c 20 72 65 70 6f | 72 74 2c 20 44 65 70 61 |cal repo|rt, Depa|
|000010b0| 72 74 6d 65 6e 74 20 6f | 66 20 43 6f 6d 70 75 74 |rtment o|f Comput|
|000010c0| 65 72 0a 20 20 20 53 63 | 69 65 6e 63 65 2c 20 54 |er. Sc|ience, T|
|000010d0| 68 65 20 55 6e 69 76 65 | 72 73 69 74 79 20 6f 66 |he Unive|rsity of|
|000010e0| 20 41 72 69 7a 6f 6e 61 | 2e 20 31 39 38 35 2e 0a | Arizona|. 1985..|
|000010f0| 0a 0a 0a 0a 20 20 20 52 | 61 6c 70 68 20 45 2e 20 |.... R|alph E. |
|00001100| 47 72 69 73 77 6f 6c 64 | 0a 20 20 20 44 65 70 61 |Griswold|. Depa|
|00001110| 72 74 6d 65 6e 74 20 6f | 66 20 43 6f 6d 70 75 74 |rtment o|f Comput|
|00001120| 65 72 20 53 63 69 65 6e | 63 65 0a 20 20 20 54 68 |er Scien|ce. Th|
|00001130| 65 20 55 6e 69 76 65 72 | 73 69 74 79 20 6f 66 20 |e Univer|sity of |
|00001140| 41 72 69 7a 6f 6e 61 0a | 0a 20 20 20 53 65 70 74 |Arizona.|. Sept|
|00001150| 65 6d 62 65 72 20 33 30 | 2c 20 31 39 38 35 0a 0a |ember 30|, 1985..|
|00001160| 0a 0a 0a 0a 0a 0a 0a 0a | 0a 0a 0a 0a 0a 0a 0a 0a |........|........|
|00001170| 0a 0a 0a 0a 0a 0a 0a 0a | 0a 0a 0a 0a 0a 0a 0a 0a |........|........|
|00001180| 0a 0a 0a 0a 0a 0a 0a 0a | 0a 0a 0a 0a 20 20 20 20 |........|.... |
|00001190| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000011a0| 20 20 20 20 20 20 20 20 | 20 2d 20 31 34 20 2d 0a | | - 14 -.|
|000011b0| 0a 0a 0a 0a 1b 5b 32 33 | 48 1b 5b 4a 50 72 65 73 |.....[23|H.[JPres|
|000011c0| 73 20 3c 43 52 3e 20 74 | 6f 20 63 6f 6e 74 69 6e |s <CR> t|o contin|
|000011d0| 75 65 20 21 0a 1b 5b 48 | 1b 5b 32 4a 0a 5b 37 36 |ue !..[H|.[2J.[76|
|000011e0| 37 30 33 2c 37 35 30 5d | 0a 49 43 4f 4e 2e 44 4f |703,750]|.ICON.DO|
|000011f0| 43 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |C | |
|00001200| 00 00 00 08 00 00 04 03 | 00 00 00 31 00 00 00 61 |........|...1...a|
|00001210| 00 00 00 00 60 01 13 98 | 20 20 20 30 36 2d 4a 75 |....`...| 06-Ju|
|00001220| 6c 2d 38 36 20 32 34 32 | 36 35 20 20 20 20 20 20 |l-86 242|65 |
|00001230| 20 20 20 20 20 20 20 20 | 36 37 0a 0a 45 6e 74 65 | |67..Ente|
|00001240| 72 20 63 6f 6d 6d 61 6e | 64 2c 20 4e 20 66 6f 72 |r comman|d, N for|
|00001250| 20 6e 65 78 74 20 66 69 | 6c 65 0a 6f 72 20 3c 43 | next fi|le.or <C|
|00001260| 52 3e 20 66 6f 72 20 64 | 69 73 70 6f 73 69 74 69 |R> for d|ispositi|
|00001270| 6f 6e 20 6d 65 6e 75 20 | 21 6d 6d 69 6e 67 0a 20 |on menu |!mming. |
|00001280| 20 20 4c 61 6e 67 75 61 | 67 65 2e 20 50 72 65 6e | Langua|ge. Pren|
|00001290| 74 69 63 65 2d 48 61 6c | 6c 2c 20 49 6e 63 2e 2c |tice-Hal|l, Inc.,|
|000012a0| 20 45 6e 67 6c 65 77 6f | 6f 64 20 43 6c 69 66 66 | Englewo|od Cliff|
|000012b0| 73 2c 20 4e 65 77 20 4a | 65 72 73 65 79 2e 0a 20 |s, New J|ersey.. |
|000012c0| 20 20 31 39 37 38 2e 0a | 0a 33 2e 20 47 72 69 73 | 1978..|.3. Gris|
|000012d0| 77 6f 6c 64 2c 20 52 61 | 6c 70 68 20 45 2e 20 44 |wold, Ra|lph E. D|
|000012e0| 69 66 66 65 72 65 6e 63 | 65 73 20 42 65 74 77 65 |ifferenc|es Betwe|
|000012f0| 65 6e 20 56 65 72 73 69 | 6f 6e 73 20 32 20 61 6e |en Versi|ons 2 an|
|00001300| 64 20 35 20 6f 66 0a 20 | 20 20 49 63 6f 6e 2c 20 |d 5 of. | Icon, |
|00001310| 54 65 63 68 6e 69 63 61 | 6c 20 52 65 70 6f 72 74 |Technica|l Report|
|00001320| 20 54 52 20 38 33 2d 35 | 2c 20 44 65 70 61 72 74 | TR 83-5|, Depart|
|00001330| 6d 65 6e 74 20 6f 66 20 | 43 6f 6d 70 75 74 65 72 |ment of |Computer|
|00001340| 20 53 63 69 2d 0a 20 20 | 20 65 6e 63 65 2c 20 54 | Sci-. | ence, T|
|00001350| 68 65 20 55 6e 69 76 65 | 72 73 69 74 79 20 6f 66 |he Unive|rsity of|
|00001360| 20 41 72 69 7a 6f 6e 61 | 2e 20 31 39 38 33 2e 0a | Arizona|. 1983..|
|00001370| 0a 34 2e 20 47 72 69 73 | 77 6f 6c 64 2c 20 52 61 |.4. Gris|wold, Ra|
|00001380| 6c 70 68 20 45 2e 20 61 | 6e 64 20 47 72 69 73 77 |lph E. a|nd Grisw|
|00001390| 6f 6c 64 2c 20 4d 61 64 | 67 65 20 54 2e 20 54 68 |old, Mad|ge T. Th|
|000013a0| 65 20 49 63 6f 6e 20 50 | 72 6f 67 72 61 6d 6d 69 |e Icon P|rogrammi|
|000013b0| 6e 67 0a 20 20 20 4c 61 | 6e 67 75 61 67 65 2e 20 |ng. La|nguage. |
|000013c0| 50 72 65 6e 74 69 63 65 | 2d 48 61 6c 6c 2c 20 49 |Prentice|-Hall, I|
|000013d0| 6e 63 2e 2c 20 45 6e 67 | 6c 65 77 6f 6f 64 20 43 |nc., Eng|lewood C|
|000013e0| 6c 69 66 66 73 2c 20 4e | 65 77 20 4a 65 72 73 65 |liffs, N|ew Jerse|
|000013f0| 79 2e 0a 20 20 20 31 39 | 38 33 2e 0a 0a 0a 0a 0a |y.. 19|83......|
|00001400| 00 00 00 08 00 00 03 f6 | 00 00 00 05 00 00 01 e8 |........|........|
|00001410| 00 00 06 d5 12 9e 7e 98 | ff fc 4e 75 30 3c 7f ff |......~.|..Nu0<..|
|00001420| 60 04 30 2f 00 0c 20 6f | 00 04 4a 18 66 fc 53 48 |`.0/.. o|..J.f.SH|
|00001430| 22 6f 00 08 53 40 10 d9 | 57 c8 ff fc 67 02 42 10 |"o..S@..|W...g.B.|
|00001440| 20 2f 00 04 4e 75 20 6f | 00 04 30 2f 00 08 12 18 | /..Nu o|..0/....|
|00001450| b2 00 67 08 4a 01 66 f6 | 70 00 4e 75 20 08 53 80 |..g.J.f.|p.Nu .S.|
|00001460| 4e 75 30 3c 7f ff 60 04 | 30 2f 00 0c 53 40 6b 14 |Nu0<..`.|0/..S@k.|
|00001470| 20 6f 00 04 22 6f 00 08 | b1 09 66 0c 53 48 4a 18 | o.."o..|..f.SHJ.|
|00001480| 57 c8 ff f6 70 00 4e 75 | 63 04 70 01 4e 75 70 ff |W...p.Nu|c.p.Nup.|
|00001490| 4e 75 20 6f 00 04 20 08 | 22 6f 00 08 10 d9 66 fc |Nu o.. .|"o....f.|
|000014a0| 4e 75 4e 55 00 00 2f 0a | 24 6d 00 08 4a 12 67 20 |NuNU../.|$m..J.g |
|000014b0| 20 4a 52 8a 10 10 48 80 | 3f 00 4e ba 05 52 54 4f | JR...H.|?.N..RTO|
|000014c0| b0 7c ff ff 66 08 70 ff | 24 5f 4e 5d 4e 75 60 dc |.|..f.p.|$_N]Nu`.|
|000014d0| 3f 3c 00 0a 4e ba 05 38 | 54 4f 60 ec 4e 55 00 00 |?<..N..8|TO`.NU..|
|000014e0| 48 e7 0e 30 24 6d 00 08 | 42 a7 48 7a 00 8e 4e ba |H..0$m..|B.Hz..N.|
|000014f0| 0c 3c 50 4f 29 40 82 e6 | 66 08 4c df 0c 70 4e 5d |.<PO)@..|f.L..pN]|
|00001500| 4e 75 20 6d 00 0c 22 68 | 00 24 2f 29 00 04 4e ba |Nu m.."h|.$/)..N.|
|00001510| 0c 74 58 4f 28 00 67 52 | 48 7a 00 6d 20 44 2f 28 |.tXO(.gR|Hz.m D/(|
|00001520| 00 36 4e ba 0c 46 50 4f | 26 40 4a 80 67 34 48 78 |.6N..FPO|&@J.g4Hx|
|00001530| 03 ed 2f 0b 4e ba 0b 54 | 50 4f 2c 00 67 24 20 06 |../.N..T|PO,.g$ .|
|00001540| e5 80 2a 00 20 45 25 68 | 00 08 00 a4 25 46 00 9c |..*. E%h|....%F..|
|00001550| 48 78 03 ed 48 7a 00 38 | 4e ba 0b 30 50 4f 25 40 |Hx..Hz.8|N..0PO%@|
|00001560| 00 a0 2f 04 4e ba 0c 12 | 58 4f 2f 2c 82 e6 4e ba |../.N...|XO/,..N.|
|00001570| 0b 62 58 4f 42 ac 82 e6 | 60 80 69 63 6f 6e 2e 6c |.bXOB...|`.icon.l|
|00001580| 69 62 72 61 72 79 00 57 | 49 4e 44 4f 57 00 2a 00 |ibrary.W|INDOW.*.|
|00001590| 4e 55 00 00 48 6d 00 0c | 2f 2d 00 08 48 7a 04 70 |NU..Hm..|/-..Hz.p|
|000015a0| 4e ba 00 98 4f ef 00 0c | 4e 5d 4e 75 4e 55 00 00 |N...O...|N]NuNU..|
|000015b0| 48 e7 08 20 24 6d 00 0e | 0c 6d 00 04 00 12 66 08 |H.. $m..|.m....f.|
|000015c0| 20 6d 00 08 28 10 60 1c | 4a 6d 00 0c 6f 0c 20 6d | m..(.`.|Jm..o. m|
|000015d0| 00 08 70 00 30 10 28 00 | 60 0a 20 6d 00 08 30 10 |..p.0.(.|`. m..0.|
|000015e0| 48 c0 28 00 42 6d 00 12 | 4a 6d 00 0c 6c 10 44 6d |H.(.Bm..|Jm..l.Dm|
|000015f0| 00 0c 4a 84 6c 08 44 84 | 3b 7c 00 01 00 12 32 2d |..J.l.D.|;|....2-|
|00001600| 00 00 00 08 00 00 04 03 | 00 00 00 1f 00 00 01 e8 |........|........|
|00001610| 00 00 00 0c ee f6 ba 86 | 20 20 20 20 63 61 72 31 |........| car1|
|00001620| 20 3a 3d 20 5b 22 62 75 | 69 63 6b 22 2c 22 73 6b | := ["bu|ick","sk|
|00001630| 79 6c 61 72 6b 22 2c 31 | 39 37 38 2c 32 34 35 30 |ylark",1|978,2450|
|00001640| 5d 0a 0a 69 6e 20 77 68 | 69 63 68 20 74 68 65 20 |]..in wh|ich the |
|00001650| 6c 69 73 74 20 63 61 72 | 31 20 68 61 73 20 66 6f |list car|1 has fo|
|00001660| 75 72 20 76 61 6c 75 65 | 73 2c 20 74 77 6f 20 6f |ur value|s, two o|
|00001670| 66 20 77 68 69 63 68 20 | 61 72 65 20 73 74 72 69 |f which |are stri|
|00001680| 6e 67 73 0a 61 6e 64 20 | 74 77 6f 20 6f 66 20 77 |ngs.and |two of w|
|00001690| 68 69 63 68 20 61 72 65 | 20 69 6e 74 65 67 65 72 |hich are| integer|
|000016a0| 73 2e 20 4e 6f 74 65 20 | 74 68 61 74 20 74 68 65 |s. Note |that the|
|000016b0| 20 76 61 6c 75 65 73 20 | 69 6e 20 61 20 6c 69 73 | values |in a lis|
|000016c0| 74 0a 6e 65 65 64 20 6e | 6f 74 20 61 6c 6c 20 62 |t.need n|ot all b|
|000016d0| 65 20 6f 66 20 74 68 65 | 20 73 61 6d 65 20 74 79 |e of the| same ty|
|000016e0| 70 65 2e 20 49 6e 20 66 | 61 63 74 2c 20 61 6e 79 |pe. In f|act, any|
|000016f0| 20 6b 69 6e 64 20 6f 66 | 20 76 61 6c 75 65 20 63 | kind of| value c|
|00001700| 61 6e 0a 6f 63 63 75 72 | 20 69 6e 20 61 20 6c 69 |an.occur| in a li|
|00001710| 73 74 20 2d 2d 20 65 76 | 65 6e 20 61 6e 6f 74 68 |st -- ev|en anoth|
|00001720| 65 72 20 6c 69 73 74 2c | 20 61 73 20 69 6e 0a 0a |er list,| as in..|
|00001730| 20 20 20 20 20 20 20 20 | 69 6e 76 65 6e 74 6f 72 | |inventor|
|00001740| 79 20 3a 3d 20 5b 63 61 | 72 31 2c 63 61 72 32 2c |y := [ca|r1,car2,|
|00001750| 63 61 72 33 2c 63 61 72 | 34 5d 0a 0a 0a 20 20 20 |car3,car|4]... |
|00001760| 4c 69 73 74 73 20 61 6c | 73 6f 20 63 61 6e 20 62 |Lists al|so can b|
|00001770| 65 20 63 72 65 61 74 65 | 64 20 62 79 0a 0a 20 20 |e create|d by.. |
|00001780| 20 20 20 20 20 20 61 20 | 3a 3d 20 6c 69 73 74 28 | a |:= list(|
|00001790| 69 2c 78 29 0a 0a 77 68 | 69 63 68 20 63 72 65 61 |i,x)..wh|ich crea|
|000017a0| 74 65 73 20 61 20 6c 69 | 73 74 20 6f 66 20 69 20 |tes a li|st of i |
|000017b0| 76 61 6c 75 65 73 2c 20 | 65 61 63 68 20 6f 66 20 |values, |each of |
|000017c0| 77 68 69 63 68 20 68 61 | 73 20 74 68 65 20 76 61 |which ha|s the va|
|000017d0| 6c 75 65 20 78 2e 0a 0a | 20 20 20 54 68 65 20 76 |lue x...| The v|
|000017e0| 61 6c 75 65 73 20 69 6e | 20 61 20 6c 69 73 74 20 |alues in| a list |
|000017f0| 63 61 6e 20 62 65 20 72 | 65 66 65 72 65 6e 63 65 |can be r|eference|
|00001800| 00 00 00 08 00 00 04 03 | 00 00 00 20 00 00 01 e8 |........|... ....|
|00001810| 00 00 00 0d dc c7 a2 4d | 64 20 62 79 20 70 6f 73 |.......M|d by pos|
|00001820| 69 74 69 6f 6e 20 6d 75 | 63 68 20 6c 69 6b 65 0a |ition mu|ch like.|
|00001830| 74 68 65 20 63 68 61 72 | 61 63 74 65 72 73 20 69 |the char|acters i|
|00001840| 6e 20 61 20 73 74 72 69 | 6e 67 2e 20 54 68 75 73 |n a stri|ng. Thus|
|00001850| 0a 0a 20 20 20 20 20 20 | 20 20 63 61 72 31 5b 34 |.. | car1[4|
|00001860| 5d 20 3a 3d 20 32 34 30 | 30 0a 0a 63 68 61 6e 67 |] := 240|0..chang|
|00001870| 65 73 20 74 68 65 20 6c | 61 73 74 20 76 61 6c 75 |es the l|ast valu|
|00001880| 65 20 69 6e 20 63 61 72 | 31 20 74 6f 20 32 34 30 |e in car|1 to 240|
|00001890| 30 2e 20 20 41 20 72 65 | 66 65 72 65 6e 63 65 20 |0. A re|ference |
|000018a0| 74 68 61 74 20 69 73 20 | 6f 75 74 0a 6f 66 20 74 |that is |out.of t|
|000018b0| 68 65 20 72 61 6e 67 65 | 20 6f 66 20 74 68 65 20 |he range| of the |
|000018c0| 6c 69 73 74 20 66 61 69 | 6c 73 2e 20 46 6f 72 20 |list fai|ls. For |
|000018d0| 65 78 61 6d 70 6c 65 2c | 0a 0a 20 20 20 20 20 20 |example,|.. |
|000018e0| 20 20 77 72 69 74 65 28 | 63 61 72 31 5b 35 5d 29 | write(|car1[5])|
|000018f0| 0a 0a 66 61 69 6c 73 2e | 0a 0a 20 20 20 54 68 65 |..fails.|.. The|
|00001900| 20 76 61 6c 75 65 73 20 | 69 6e 20 61 20 6c 69 73 | values |in a lis|
|00001910| 74 20 61 20 61 72 65 20 | 67 65 6e 65 72 61 74 65 |t a are |generate|
|00001920| 64 20 62 79 20 21 61 2e | 20 54 68 75 73 0a 0a 20 |d by !a.| Thus.. |
|00001930| 20 20 20 20 20 20 20 65 | 76 65 72 79 20 77 72 69 | e|very wri|
|00001940| 74 65 28 21 61 29 0a 0a | 77 72 69 74 65 73 20 61 |te(!a)..|writes a|
|00001950| 6c 6c 20 74 68 65 20 76 | 61 6c 75 65 73 20 69 6e |ll the v|alues in|
|00001960| 20 61 2e 0a 0a 20 20 20 | 4c 69 73 74 73 20 63 61 | a... |Lists ca|
|00001970| 6e 20 62 65 20 6d 61 6e | 69 70 75 6c 61 74 65 64 |n be man|ipulated|
|00001980| 20 6c 69 6b 65 20 73 74 | 61 63 6b 73 20 61 6e 64 | like st|acks and|
|00001990| 20 71 75 65 75 65 73 2e | 20 54 68 65 20 66 75 6e | queues.| The fun|
|000019a0| 63 74 69 6f 6e 0a 70 75 | 73 68 28 61 2c 78 29 20 |ction.pu|sh(a,x) |
|000019b0| 61 64 64 73 20 74 68 65 | 20 76 61 6c 75 65 20 6f |adds the| value o|
|000019c0| 66 20 78 20 74 6f 20 74 | 68 65 20 6c 65 66 74 20 |f x to t|he left |
|000019d0| 65 6e 64 20 6f 66 20 74 | 68 65 20 6c 69 73 74 20 |end of t|he list |
|000019e0| 61 2c 0a 61 75 74 6f 6d | 61 74 69 63 61 6c 6c 79 |a,.autom|atically|
|000019f0| 20 69 6e 63 72 65 61 73 | 69 6e 67 20 74 68 65 20 | increas|ing the |
|00001a00| 00 00 00 08 00 00 04 03 | 00 00 00 21 00 00 01 e8 |........|...!....|
|00001a10| 00 00 00 0e ff 53 d4 ac | 73 69 7a 65 20 6f 66 20 |.....S..|size of |
|00001a20| 61 20 62 79 20 6f 6e 65 | 2e 20 53 69 6d 69 6c 61 |a by one|. Simila|
|00001a30| 72 6c 79 2c 20 70 6f 70 | 28 61 29 0a 72 65 6d 6f |rly, pop|(a).remo|
|00001a40| 76 65 73 20 74 68 65 20 | 6c 65 66 74 6d 6f 73 74 |ves the |leftmost|
|00001a50| 20 76 61 6c 75 65 20 66 | 72 6f 6d 20 61 2c 20 61 | value f|rom a, a|
|00001a60| 75 74 6f 6d 61 74 69 63 | 61 6c 6c 79 20 64 65 63 |utomatic|ally dec|
|00001a70| 72 65 61 73 69 6e 67 20 | 74 68 65 0a 73 69 7a 65 |reasing |the.size|
|00001a80| 20 6f 66 20 61 20 62 79 | 20 6f 6e 65 2c 20 61 6e | of a by| one, an|
|00001a90| 64 20 70 72 6f 64 75 63 | 65 73 20 74 68 65 20 72 |d produc|es the r|
|00001aa0| 65 6d 6f 76 65 64 20 76 | 61 6c 75 65 2e 0a 0a 20 |emoved v|alue... |
|00001ab0| 20 20 41 20 6c 69 73 74 | 20 76 61 6c 75 65 20 69 | A list| value i|
|00001ac0| 6e 20 49 63 6f 6e 20 69 | 73 20 61 20 70 6f 69 6e |n Icon i|s a poin|
|00001ad0| 74 65 72 20 28 72 65 66 | 65 72 65 6e 63 65 29 20 |ter (ref|erence) |
|00001ae0| 74 6f 20 61 20 73 74 72 | 75 63 74 75 72 65 2e 0a |to a str|ucture..|
|00001af0| 41 73 73 69 67 6e 6d 65 | 6e 74 20 6f 66 20 61 20 |Assignme|nt of a |
|00001b00| 73 74 72 75 63 74 75 72 | 65 20 69 6e 20 49 63 6f |structur|e in Ico|
|00001b10| 6e 20 64 6f 65 73 20 6e | 6f 74 20 63 6f 70 79 20 |n does n|ot copy |
|00001b20| 74 68 65 20 73 74 72 75 | 63 74 75 72 65 0a 69 74 |the stru|cture.it|
|00001b30| 73 65 6c 66 20 62 75 74 | 20 6f 6e 6c 79 20 74 68 |self but| only th|
|00001b40| 65 20 70 6f 69 6e 74 65 | 72 20 74 6f 20 69 74 2e |e pointe|r to it.|
|00001b50| 20 54 68 75 73 20 74 68 | 65 20 72 65 73 75 6c 74 | Thus th|e result|
|00001b60| 20 6f 66 0a 0a 20 20 20 | 20 20 20 20 20 64 65 6d | of.. | dem|
|00001b70| 6f 20 3a 3d 20 63 61 72 | 31 0a 0a 63 61 75 73 65 |o := car|1..cause|
|00001b80| 73 20 64 65 6d 6f 20 61 | 6e 64 20 63 61 72 31 20 |s demo a|nd car1 |
|00001b90| 74 6f 20 72 65 66 65 72 | 65 6e 63 65 20 74 68 65 |to refer|ence the|
|00001ba0| 20 73 61 6d 65 20 6c 69 | 73 74 2e 20 47 72 61 70 | same li|st. Grap|
|00001bb0| 68 73 20 77 69 74 68 0a | 6c 6f 6f 70 73 20 63 61 |hs with.|loops ca|
|00001bc0| 6e 20 62 65 20 63 6f 6e | 73 74 72 75 63 74 65 64 |n be con|structed|
|00001bd0| 20 69 6e 20 74 68 69 73 | 20 77 61 79 2e 20 46 6f | in this| way. Fo|
|00001be0| 72 20 65 78 61 6d 70 6c | 65 2c 0a 0a 20 20 20 20 |r exampl|e,.. |
|00001bf0| 20 20 20 20 6e 6f 64 65 | 31 20 3a 3d 20 5b 22 61 | node|1 := ["a|
|00001c00| 00 00 00 08 00 00 04 03 | 00 00 00 22 00 00 01 e8 |........|..."....|
|00001c10| 00 00 00 0f 61 b1 f1 b7 | 22 5d 0a 20 20 20 20 20 |....a...|"]. |
|00001c20| 20 20 20 6e 6f 64 65 32 | 20 3a 3d 20 5b 6e 6f 64 | node2| := [nod|
|00001c30| 65 31 2c 22 62 22 5d 0a | 20 20 20 20 20 20 20 20 |e1,"b"].| |
|00001c40| 70 75 73 68 28 6e 6f 64 | 65 31 2c 6e 6f 64 65 32 |push(nod|e1,node2|
|00001c50| 29 0a 0a 0a 0a 0a 0a 20 | 20 20 20 20 20 20 20 20 |)...... | |
|00001c60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001c70| 20 20 20 20 20 2d 20 39 | 20 2d 0a 0a 0a 0a 0a 0a | - 9| -......|
|00001c80| 0a 0a 0a 63 6f 6e 73 74 | 72 75 63 74 73 20 61 20 |...const|ructs a |
|00001c90| 73 74 72 75 63 74 75 72 | 65 20 74 68 61 74 20 63 |structur|e that c|
|00001ca0| 61 6e 20 62 65 20 70 69 | 63 74 75 72 65 64 20 61 |an be pi|ctured a|
|00001cb0| 73 20 66 6f 6c 6c 6f 77 | 73 3a 0a 0a 0a 20 20 20 |s follow|s:... |
|00001cc0| 20 20 20 20 20 20 20 6e | 6f 64 65 31 20 20 2e 2d | n|ode1 .-|
|00001cd0| 3e 61 2d 2d 2e 0a 20 20 | 20 20 20 20 20 20 20 20 |>a--.. | |
|00001ce0| 20 20 20 20 20 20 20 7c | 20 20 20 20 20 7c 0a 20 | || |. |
|00001cf0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001d00| 7c 20 20 20 20 20 7c 0a | 20 20 20 20 20 20 20 20 || |.| |
|00001d10| 20 20 6e 6f 64 65 32 20 | 20 27 2d 2d 62 3c 2d 27 | node2 | '--b<-'|
|00001d20| 0a 0a 0a 0a 36 2e 32 20 | 20 54 61 62 6c 65 73 0a |....6.2 | Tables.|
|00001d30| 0a 20 20 20 49 63 6f 6e | 20 68 61 73 20 61 20 74 |. Icon| has a t|
|00001d40| 61 62 6c 65 20 64 61 74 | 61 20 74 79 70 65 20 73 |able dat|a type s|
|00001d50| 69 6d 69 6c 61 72 20 74 | 6f 20 74 68 61 74 20 6f |imilar t|o that o|
|00001d60| 66 20 53 4e 4f 42 4f 4c | 34 2e 20 54 61 62 6c 65 |f SNOBOL|4. Table|
|00001d70| 73 0a 65 73 73 65 6e 74 | 69 61 6c 6c 79 20 61 72 |s.essent|ially ar|
|00001d80| 65 20 73 65 74 73 20 6f | 66 20 70 61 69 72 73 20 |e sets o|f pairs |
|00001d90| 6f 66 20 76 61 6c 75 65 | 73 2c 20 61 6e 20 65 6e |of value|s, an en|
|00001da0| 74 72 79 20 76 61 6c 75 | 65 20 61 6e 64 20 61 0a |try valu|e and a.|
|00001db0| 63 6f 72 72 65 73 70 6f | 6e 64 69 6e 67 20 61 73 |correspo|nding as|
|00001dc0| 73 69 67 6e 65 64 20 76 | 61 6c 75 65 2e 20 54 68 |signed v|alue. Th|
|00001dd0| 65 20 65 6e 74 72 79 20 | 61 6e 64 20 61 73 73 69 |e entry |and assi|
|00001de0| 67 6e 65 64 20 76 61 6c | 75 65 73 20 6d 61 79 0a |gned val|ues may.|
|00001df0| 62 65 20 6f 66 20 61 6e | 79 20 74 79 70 65 2c 20 |be of an|y type, |
|00001e00| 00 00 00 08 00 00 04 03 | 00 00 00 23 00 00 01 e8 |........|...#....|
|00001e10| 00 00 00 10 62 43 6c 6f | 61 6e 64 20 74 68 65 20 |....bClo|and the |
|00001e20| 61 73 73 69 67 6e 65 64 | 20 76 61 6c 75 65 20 66 |assigned| value f|
|00001e30| 6f 72 20 61 6e 79 20 65 | 6e 74 72 79 20 76 61 6c |or any e|ntry val|
|00001e40| 75 65 20 63 61 6e 20 62 | 65 0a 6c 6f 6f 6b 65 64 |ue can b|e.looked|
|00001e50| 20 75 70 20 61 75 74 6f | 6d 61 74 69 63 61 6c 6c | up auto|maticall|
|00001e60| 79 2e 20 20 54 68 75 73 | 20 74 61 62 6c 65 73 20 |y. Thus| tables |
|00001e70| 70 72 6f 76 69 64 65 20 | 61 20 66 6f 72 6d 20 6f |provide |a form o|
|00001e80| 66 20 61 73 73 6f 63 69 | 61 2d 0a 74 69 76 65 20 |f associ|a-.tive |
|00001e90| 61 63 63 65 73 73 20 69 | 6e 20 63 6f 6e 74 72 61 |access i|n contra|
|00001ea0| 73 74 20 77 69 74 68 20 | 74 68 65 20 70 6f 73 69 |st with |the posi|
|00001eb0| 74 69 6f 6e 61 6c 20 61 | 63 63 65 73 73 20 74 6f |tional a|ccess to|
|00001ec0| 20 76 61 6c 75 65 73 20 | 69 6e 0a 6c 69 73 74 73 | values |in.lists|
|00001ed0| 2e 0a 0a 20 20 20 41 20 | 74 61 62 6c 65 20 69 73 |... A |table is|
|00001ee0| 20 63 72 65 61 74 65 64 | 20 62 79 20 61 6e 20 65 | created| by an e|
|00001ef0| 78 70 72 65 73 73 69 6f | 6e 20 73 75 63 68 20 61 |xpressio|n such a|
|00001f00| 73 0a 0a 20 20 20 20 20 | 20 20 20 73 79 6d 62 6f |s.. | symbo|
|00001f10| 6c 73 20 3a 3d 20 74 61 | 62 6c 65 28 78 29 0a 0a |ls := ta|ble(x)..|
|00001f20| 77 68 69 63 68 20 61 73 | 73 69 67 6e 73 20 74 6f |which as|signs to|
|00001f30| 20 73 79 6d 62 6f 6c 73 | 20 61 20 74 61 62 6c 65 | symbols| a table|
|00001f40| 20 77 69 74 68 20 74 68 | 65 20 64 65 66 61 75 6c | with th|e defaul|
|00001f50| 74 20 61 73 73 69 67 6e | 65 64 20 76 61 6c 75 65 |t assign|ed value|
|00001f60| 0a 78 2e 20 20 53 75 62 | 73 65 71 75 65 6e 74 6c |.x. Sub|sequentl|
|00001f70| 79 2c 20 73 79 6d 62 6f | 6c 73 20 63 61 6e 20 62 |y, symbo|ls can b|
|00001f80| 65 20 72 65 66 65 72 65 | 6e 63 65 64 20 62 79 20 |e refere|nced by |
|00001f90| 61 6e 79 20 65 6e 74 72 | 79 20 76 61 6c 75 65 2c |any entr|y value,|
|00001fa0| 0a 73 75 63 68 20 61 73 | 0a 0a 20 20 20 20 20 20 |.such as|.. |
|00001fb0| 20 20 73 79 6d 62 6f 6c | 73 5b 22 74 68 65 72 65 | symbol|s["there|
|00001fc0| 22 5d 20 3a 3d 20 31 0a | 0a 77 68 69 63 68 20 61 |"] := 1.|.which a|
|00001fd0| 73 73 69 67 6e 73 20 74 | 68 65 20 76 61 6c 75 65 |ssigns t|he value|
|00001fe0| 20 31 20 74 6f 20 74 68 | 65 20 74 68 65 72 65 74 | 1 to th|e theret|
|00001ff0| 68 20 65 6e 74 72 79 20 | 69 6e 20 73 79 6d 62 6f |h entry |in symbo|
|00002000| 00 00 00 08 00 00 04 03 | 00 00 00 24 00 00 01 e8 |........|...$....|
|00002010| 00 00 00 11 8b ab e6 d0 | 6c 73 2e 0a 0a 20 20 20 |........|ls... |
|00002020| 54 61 62 6c 65 73 20 67 | 72 6f 77 20 61 75 74 6f |Tables g|row auto|
|00002030| 6d 61 74 69 63 61 6c 6c | 79 20 61 73 20 6e 65 77 |maticall|y as new|
|00002040| 20 65 6e 74 72 79 20 76 | 61 6c 75 65 73 20 61 72 | entry v|alues ar|
|00002050| 65 20 61 64 64 65 64 2e | 20 20 46 6f 72 0a 65 78 |e added.| For.ex|
|00002060| 61 6d 70 6c 65 2c 20 74 | 68 65 20 66 6f 6c 6c 6f |ample, t|he follo|
|00002070| 77 69 6e 67 20 70 72 6f | 67 72 61 6d 20 73 65 67 |wing pro|gram seg|
|00002080| 6d 65 6e 74 20 70 72 6f | 64 75 63 65 73 20 61 20 |ment pro|duces a |
|00002090| 74 61 62 6c 65 20 63 6f | 6e 74 61 69 6e 2d 0a 69 |table co|ntain-.i|
|000020a0| 6e 67 20 61 20 63 6f 75 | 6e 74 20 6f 66 20 74 68 |ng a cou|nt of th|
|000020b0| 65 20 77 6f 72 64 73 20 | 74 68 61 74 20 61 70 70 |e words |that app|
|000020c0| 65 61 72 20 69 6e 20 74 | 68 65 20 69 6e 70 75 74 |ear in t|he input|
|000020d0| 20 66 69 6c 65 3a 0a 0a | 20 20 20 20 20 20 20 20 | file:..| |
|000020e0| 77 6f 72 64 73 20 3a 3d | 20 74 61 62 6c 65 28 30 |words :=| table(0|
|000020f0| 29 0a 20 20 20 20 20 20 | 20 20 77 68 69 6c 65 20 |). | while |
|00002100| 6c 69 6e 65 20 3a 3d 20 | 72 65 61 64 28 29 20 64 |line := |read() d|
|00002110| 6f 0a 20 20 20 20 20 20 | 20 20 20 20 20 6c 69 6e |o. | lin|
|00002120| 65 20 3f 20 77 68 69 6c | 65 20 74 61 62 28 75 70 |e ? whil|e tab(up|
|00002130| 74 6f 28 6c 65 74 74 65 | 72 73 29 29 20 64 6f 0a |to(lette|rs)) do.|
|00002140| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 77 6f | | wo|
|00002150| 72 64 73 5b 74 61 62 28 | 6d 61 6e 79 28 6c 65 74 |rds[tab(|many(let|
|00002160| 74 65 72 73 29 29 5d 20 | 2b 3a 3d 20 31 0a 0a 48 |ters))] |+:= 1..H|
|00002170| 65 72 65 20 74 68 65 20 | 64 65 66 61 75 6c 74 20 |ere the |default |
|00002180| 61 73 73 69 67 6e 65 64 | 20 76 61 6c 75 65 20 66 |assigned| value f|
|00002190| 6f 72 20 65 61 63 68 20 | 77 6f 72 64 20 69 73 20 |or each |word is |
|000021a0| 30 2c 20 61 73 20 67 69 | 76 65 6e 20 69 6e 0a 74 |0, as gi|ven in.t|
|000021b0| 61 62 6c 65 28 30 29 2c | 20 61 6e 64 20 2b 3a 3d |able(0),| and +:=|
|000021c0| 20 69 73 20 61 6e 20 61 | 75 67 6d 65 6e 74 65 64 | is an a|ugmented|
|000021d0| 20 61 73 73 69 67 6e 6d | 65 6e 74 20 6f 70 65 72 | assignm|ent oper|
|000021e0| 61 74 69 6f 6e 20 74 68 | 61 74 0a 69 6e 63 72 65 |ation th|at.incre|
|000021f0| 6d 65 6e 74 73 20 74 68 | 65 20 61 73 73 69 67 6e |ments th|e assign|
|00002200| 00 00 00 08 00 00 04 03 | 00 00 00 25 00 00 01 e8 |........|...%....|
|00002210| 00 00 00 12 26 f9 c9 69 | 65 64 20 76 61 6c 75 65 |....&..i|ed value|
|00002220| 73 20 62 79 20 6f 6e 65 | 2e 20 20 54 68 65 72 65 |s by one|. There|
|00002230| 20 61 72 65 20 61 75 67 | 6d 65 6e 74 65 64 0a 61 | are aug|mented.a|
|00002240| 73 73 69 67 6e 6d 65 6e | 74 20 6f 70 65 72 61 74 |ssignmen|t operat|
|00002250| 69 6f 6e 73 20 66 6f 72 | 20 61 6c 6c 20 62 69 6e |ions for| all bin|
|00002260| 61 72 79 20 6f 70 65 72 | 61 74 6f 72 73 2e 0a 0a |ary oper|ators...|
|00002270| 20 20 20 54 61 62 6c 65 | 73 20 63 61 6e 20 62 65 | Table|s can be|
|00002280| 20 63 6f 6e 76 65 72 74 | 65 64 20 74 6f 20 6c 69 | convert|ed to li|
|00002290| 73 74 73 2c 20 73 6f 20 | 74 68 61 74 20 74 68 65 |sts, so |that the|
|000022a0| 69 72 20 65 6e 74 72 79 | 20 61 6e 64 0a 61 73 73 |ir entry| and.ass|
|000022b0| 69 67 6e 65 64 20 76 61 | 6c 75 65 73 20 63 61 6e |igned va|lues can|
|000022c0| 20 62 65 20 61 63 63 65 | 73 73 65 64 20 62 79 20 | be acce|ssed by |
|000022d0| 70 6f 73 69 74 69 6f 6e | 2e 20 20 54 68 69 73 20 |position|. This |
|000022e0| 69 73 20 64 6f 6e 65 20 | 62 79 0a 73 6f 72 74 28 |is done |by.sort(|
|000022f0| 74 29 2c 20 77 68 69 63 | 68 20 70 72 6f 64 75 63 |t), whic|h produc|
|00002300| 65 73 20 61 20 6c 69 73 | 74 20 6f 66 20 74 77 6f |es a lis|t of two|
|00002310| 2d 65 6c 65 6d 65 6e 74 | 20 6c 69 73 74 73 20 66 |-element| lists f|
|00002320| 72 6f 6d 20 74 2c 20 77 | 68 65 72 65 0a 65 61 63 |rom t, w|here.eac|
|00002330| 68 20 74 77 6f 2d 65 6c | 65 6d 65 6e 74 20 6c 69 |h two-el|ement li|
|00002340| 73 74 20 63 6f 6e 73 69 | 73 74 73 20 6f 66 20 61 |st consi|sts of a|
|00002350| 6e 20 65 6e 74 72 79 20 | 76 61 6c 75 65 20 61 6e |n entry |value an|
|00002360| 64 20 69 74 73 0a 63 6f | 72 72 65 73 70 6f 6e 64 |d its.co|rrespond|
|00002370| 69 6e 67 20 61 73 73 69 | 67 6e 65 64 20 76 61 6c |ing assi|gned val|
|00002380| 75 65 2e 20 46 6f 72 20 | 65 78 61 6d 70 6c 65 2c |ue. For |example,|
|00002390| 0a 0a 0a 0a 0a 0a 0a 20 | 20 20 20 20 20 20 20 20 |....... | |
|000023a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000023b0| 20 20 20 20 2d 20 31 30 | 20 2d 0a 0a 0a 0a 0a 0a | - 10| -......|
|000023c0| 0a 0a 0a 20 20 20 20 20 | 20 20 20 77 6f 72 64 6c |... | wordl|
|000023d0| 69 73 74 20 3a 3d 20 73 | 6f 72 74 28 77 6f 72 64 |ist := s|ort(word|
|000023e0| 73 29 0a 20 20 20 20 20 | 20 20 20 65 76 65 72 79 |s). | every|
|000023f0| 20 70 61 69 72 20 3a 3d | 20 21 77 6f 72 64 6c 69 | pair :=| !wordli|
|00002400| 00 00 00 08 00 00 04 03 | 00 00 00 26 00 00 01 e8 |........|...&....|
|00002410| 00 00 00 13 73 79 9d 8b | 73 74 20 64 6f 0a 20 20 |....sy..|st do. |
|00002420| 20 20 20 20 20 20 20 20 | 20 77 72 69 74 65 28 70 | | write(p|
|00002430| 61 69 72 5b 31 5d 2c 22 | 20 3a 20 22 2c 70 61 69 |air[1],"| : ",pai|
|00002440| 72 5b 32 5d 29 0a 0a 77 | 72 69 74 65 73 20 74 68 |r[2])..w|rites th|
|00002450| 65 20 77 6f 72 64 73 20 | 61 6e 64 20 74 68 65 69 |e words |and thei|
|00002460| 72 20 63 6f 75 6e 74 73 | 20 66 72 6f 6d 20 77 6f |r counts| from wo|
|00002470| 72 64 73 2e 0a 0a 0a 37 | 2e 20 20 50 72 6f 63 65 |rds....7|. Proce|
|00002480| 64 75 72 65 73 0a 0a 20 | 20 20 41 6e 20 49 63 6f |dures.. | An Ico|
|00002490| 6e 20 70 72 6f 67 72 61 | 6d 20 63 6f 6e 73 69 73 |n progra|m consis|
|000024a0| 74 73 20 6f 66 20 61 20 | 73 65 71 75 65 6e 63 65 |ts of a |sequence|
|000024b0| 20 6f 66 20 70 72 6f 63 | 65 64 75 72 65 20 64 65 | of proc|edure de|
|000024c0| 63 6c 61 72 61 2d 0a 74 | 69 6f 6e 73 2e 20 20 41 |clara-.t|ions. A|
|000024d0| 6e 20 65 78 61 6d 70 6c | 65 20 6f 66 20 61 20 70 |n exampl|e of a p|
|000024e0| 72 6f 63 65 64 75 72 65 | 20 64 65 63 6c 61 72 61 |rocedure| declara|
|000024f0| 74 69 6f 6e 20 69 73 0a | 0a 20 20 20 20 20 20 20 |tion is.|. |
|00002500| 20 70 72 6f 63 65 64 75 | 72 65 20 6d 61 78 28 69 | procedu|re max(i|
|00002510| 2c 6a 29 0a 20 20 20 20 | 20 20 20 20 20 20 20 69 |,j). | i|
|00002520| 66 20 69 20 3e 20 6a 20 | 74 68 65 6e 20 72 65 74 |f i > j |then ret|
|00002530| 75 72 6e 20 69 20 65 6c | 73 65 20 72 65 74 75 72 |urn i el|se retur|
|00002540| 6e 20 6a 0a 20 20 20 20 | 20 20 20 20 65 6e 64 0a |n j. | end.|
|00002550| 0a 77 68 65 72 65 20 74 | 68 65 20 6e 61 6d 65 20 |.where t|he name |
|00002560| 6f 66 20 74 68 65 20 70 | 72 6f 63 65 64 75 72 65 |of the p|rocedure|
|00002570| 20 69 73 20 6d 61 78 20 | 61 6e 64 20 69 74 73 20 | is max |and its |
|00002580| 66 6f 72 6d 61 6c 20 70 | 61 72 61 6d 65 74 65 72 |formal p|arameter|
|00002590| 73 0a 61 72 65 20 69 20 | 61 6e 64 20 6a 2e 20 54 |s.are i |and j. T|
|000025a0| 68 65 20 72 65 74 75 72 | 6e 20 65 78 70 72 65 73 |he retur|n expres|
|000025b0| 73 69 6f 6e 73 20 72 65 | 74 75 72 6e 20 74 68 65 |sions re|turn the|
|000025c0| 20 76 61 6c 75 65 20 6f | 66 20 69 20 6f 72 20 6a | value o|f i or j|
|000025d0| 2c 0a 77 68 69 63 68 65 | 76 65 72 20 69 73 20 6c |,.whiche|ver is l|
|000025e0| 61 72 67 65 72 2e 0a 0a | 20 20 20 50 72 6f 63 65 |arger...| Proce|
|000025f0| 64 75 72 65 73 20 61 72 | 65 20 63 61 6c 6c 65 64 |dures ar|e called|
|00002600| 00 00 00 08 00 00 04 03 | 00 00 00 27 00 00 01 e8 |........|...'....|
|00002610| 00 00 00 14 b6 06 12 af | 20 6c 69 6b 65 20 62 75 |........| like bu|
|00002620| 69 6c 74 2d 69 6e 20 66 | 75 6e 63 74 69 6f 6e 73 |ilt-in f|unctions|
|00002630| 2e 20 54 68 75 73 0a 0a | 20 20 20 20 20 20 20 20 |. Thus..| |
|00002640| 6b 20 3a 3d 20 6d 61 78 | 28 2a 73 31 2c 2a 73 32 |k := max|(*s1,*s2|
|00002650| 29 0a 0a 61 73 73 69 67 | 6e 73 20 74 6f 20 6b 20 |)..assig|ns to k |
|00002660| 74 68 65 20 73 69 7a 65 | 20 6f 66 20 74 68 65 20 |the size| of the |
|00002670| 6c 6f 6e 67 65 72 20 6f | 66 20 74 68 65 20 73 74 |longer o|f the st|
|00002680| 72 69 6e 67 73 20 73 31 | 20 61 6e 64 20 73 32 2e |rings s1| and s2.|
|00002690| 0a 0a 20 20 20 41 20 70 | 72 6f 63 65 64 75 72 65 |.. A p|rocedure|
|000026a0| 20 61 6c 73 6f 20 6d 61 | 79 20 73 75 73 70 65 6e | also ma|y suspen|
|000026b0| 64 20 69 6e 73 74 65 61 | 64 20 6f 66 20 72 65 74 |d instea|d of ret|
|000026c0| 75 72 6e 69 6e 67 2e 20 | 49 6e 20 74 68 69 73 0a |urning. |In this.|
|000026d0| 63 61 73 65 2c 20 61 20 | 72 65 73 75 6c 74 20 69 |case, a |result i|
|000026e0| 73 20 70 72 6f 64 75 63 | 65 64 20 61 73 20 69 6e |s produc|ed as in|
|000026f0| 20 74 68 65 20 63 61 73 | 65 20 6f 66 20 61 20 72 | the cas|e of a r|
|00002700| 65 74 75 72 6e 2c 20 62 | 75 74 20 74 68 65 0a 70 |eturn, b|ut the.p|
|00002710| 72 6f 63 65 64 75 72 65 | 20 63 61 6e 20 62 65 20 |rocedure| can be |
|00002720| 72 65 73 75 6d 65 64 20 | 74 6f 20 70 72 6f 64 75 |resumed |to produ|
|00002730| 63 65 20 6f 74 68 65 72 | 20 72 65 73 75 6c 74 73 |ce other| results|
|00002740| 2e 20 41 6e 20 65 78 61 | 6d 70 6c 65 20 69 73 0a |. An exa|mple is.|
|00002750| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 70 72 |the foll|owing pr|
|00002760| 6f 63 65 64 75 72 65 20 | 74 68 61 74 20 67 65 6e |ocedure |that gen|
|00002770| 65 72 61 74 65 73 20 74 | 68 65 20 77 6f 72 64 73 |erates t|he words|
|00002780| 20 69 6e 20 74 68 65 20 | 69 6e 70 75 74 0a 66 69 | in the |input.fi|
|00002790| 6c 65 2e 0a 0a 20 20 20 | 20 20 20 20 20 70 72 6f |le... | pro|
|000027a0| 63 65 64 75 72 65 20 67 | 65 6e 77 6f 72 64 28 29 |cedure g|enword()|
|000027b0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 6c 6f 63 61 |. | loca|
|000027c0| 6c 20 6c 69 6e 65 2c 20 | 6c 65 74 74 65 72 73 2c |l line, |letters,|
|000027d0| 20 77 6f 72 64 73 0a 20 | 20 20 20 20 20 20 20 20 | words. | |
|000027e0| 20 20 6c 65 74 74 65 72 | 73 20 3a 3d 20 26 6c 63 | letter|s := &lc|
|000027f0| 61 73 65 20 2b 2b 20 26 | 75 63 61 73 65 0a 20 20 |ase ++ &|ucase. |
|00002800| 00 00 00 08 00 00 04 03 | 00 00 00 28 00 00 01 e8 |........|...(....|
|00002810| 00 00 00 15 91 21 34 a1 | 20 20 20 20 20 20 20 20 |.....!4.| |
|00002820| 20 77 68 69 6c 65 20 6c | 69 6e 65 20 3a 3d 20 72 | while l|ine := r|
|00002830| 65 61 64 28 29 20 64 6f | 0a 20 20 20 20 20 20 20 |ead() do|. |
|00002840| 20 20 20 20 20 20 20 6c | 69 6e 65 20 3f 20 77 68 | l|ine ? wh|
|00002850| 69 6c 65 20 74 61 62 28 | 75 70 74 6f 28 6c 65 74 |ile tab(|upto(let|
|00002860| 74 65 72 73 29 29 20 64 | 6f 20 7b 0a 20 20 20 20 |ters)) d|o {. |
|00002870| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 77 6f 72 | | wor|
|00002880| 64 20 3a 3d 20 74 61 62 | 28 6d 61 6e 79 28 6c 65 |d := tab|(many(le|
|00002890| 74 74 65 72 73 29 29 0a | 20 20 20 20 20 20 20 20 |tters)).| |
|000028a0| 20 20 20 20 20 20 20 20 | 20 73 75 73 70 65 6e 64 | | suspend|
|000028b0| 20 77 6f 72 64 0a 20 20 | 20 20 20 20 20 20 20 20 | word. | |
|000028c0| 20 20 20 20 20 20 20 7d | 0a 20 20 20 20 20 20 20 | }|. |
|000028d0| 20 65 6e 64 0a 0a 54 68 | 65 20 62 72 61 63 65 73 | end..Th|e braces|
|000028e0| 20 65 6e 63 6c 6f 73 65 | 20 61 20 63 6f 6d 70 6f | enclose| a compo|
|000028f0| 75 6e 64 20 65 78 70 72 | 65 73 73 69 6f 6e 2e 0a |und expr|ession..|
|00002900| 0a 20 20 20 53 75 63 68 | 20 61 20 67 65 6e 65 72 |. Such| a gener|
|00002910| 61 74 6f 72 20 69 73 20 | 75 73 65 64 20 69 6e 20 |ator is |used in |
|00002920| 74 68 65 20 73 61 6d 65 | 20 77 61 79 20 74 68 61 |the same| way tha|
|00002930| 74 20 61 20 62 75 69 6c | 74 2d 69 6e 20 67 65 6e |t a buil|t-in gen|
|00002940| 2d 0a 65 72 61 74 6f 72 | 20 69 73 20 75 73 65 64 |-.erator| is used|
|00002950| 2e 20 46 6f 72 20 65 78 | 61 6d 70 6c 65 0a 0a 20 |. For ex|ample.. |
|00002960| 20 20 20 20 20 20 20 65 | 76 65 72 79 20 77 6f 72 | e|very wor|
|00002970| 64 20 3a 3d 20 67 65 6e | 77 6f 72 64 28 29 20 64 |d := gen|word() d|
|00002980| 6f 0a 20 20 20 20 20 20 | 20 20 20 20 20 69 66 20 |o. | if |
|00002990| 66 69 6e 64 28 22 6f 72 | 22 2c 77 6f 72 64 29 20 |find("or|",word) |
|000029a0| 74 68 65 6e 20 77 72 69 | 74 65 28 77 6f 72 64 29 |then wri|te(word)|
|000029b0| 0a 0a 77 72 69 74 65 73 | 20 6f 6e 6c 79 20 74 68 |..writes| only th|
|000029c0| 6f 73 65 20 77 6f 72 64 | 73 20 74 68 61 74 20 63 |ose word|s that c|
|000029d0| 6f 6e 74 61 69 6e 20 74 | 68 65 20 73 75 62 73 74 |ontain t|he subst|
|000029e0| 72 69 6e 67 20 6f 72 2e | 0a 0a 0a 0a 0a 0a 0a 20 |ring or.|....... |
|000029f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002a00| 00 00 00 08 00 00 04 03 | 00 00 00 29 00 00 01 e8 |........|...)....|
|00002a10| 00 00 00 02 34 23 0c e8 | 20 20 20 20 20 20 20 20 |....4#..| |
|00002a20| 20 20 20 20 2d 20 31 31 | 20 2d 0a 0a 0a 0a 0a 0a | - 11| -......|
|00002a30| 0a 0a 0a 38 2e 20 20 41 | 6e 20 45 78 61 6d 70 6c |...8. A|n Exampl|
|00002a40| 65 0a 0a 20 20 20 54 68 | 65 20 66 6f 6c 6c 6f 77 |e.. Th|e follow|
|00002a50| 69 6e 67 20 70 72 6f 67 | 72 61 6d 20 73 6f 72 74 |ing prog|ram sort|
|00002a60| 73 20 67 72 61 70 68 73 | 20 74 6f 70 6f 6c 6f 67 |s graphs| topolog|
|00002a70| 69 63 61 6c 6c 79 2e 0a | 0a 20 20 20 20 20 20 20 |ically..|. |
|00002a80| 20 70 72 6f 63 65 64 75 | 72 65 20 6d 61 69 6e 28 | procedu|re main(|
|00002a90| 29 0a 20 20 20 20 20 20 | 20 20 20 20 20 6c 6f 63 |). | loc|
|00002aa0| 61 6c 20 73 6f 72 74 65 | 64 2c 20 6e 6f 64 65 73 |al sorte|d, nodes|
|00002ab0| 2c 20 61 72 63 73 2c 20 | 72 6f 6f 74 73 0a 20 20 |, arcs, |roots. |
|00002ac0| 20 20 20 20 20 20 20 20 | 20 77 68 69 6c 65 20 6e | | while n|
|00002ad0| 6f 64 65 73 20 3a 3d 20 | 72 65 61 64 28 29 20 64 |odes := |read() d|
|00002ae0| 6f 20 7b 20 20 20 20 20 | 20 23 20 67 65 74 20 6e |o { | # get n|
|00002af0| 65 78 74 20 6e 6f 64 65 | 20 6c 69 73 74 0a 20 20 |ext node| list. |
|00002b00| 20 20 20 20 20 20 20 20 | 20 20 20 20 61 72 63 73 | | arcs|
|00002b10| 20 3a 3d 20 72 65 61 64 | 28 29 20 20 20 20 20 20 | := read|() |
|00002b20| 20 20 20 20 20 20 20 20 | 20 23 20 67 65 74 20 61 | | # get a|
|00002b30| 72 63 20 6c 69 73 74 0a | 20 20 20 20 20 20 20 20 |rc list.| |
|00002b40| 20 20 20 20 20 20 73 6f | 72 74 65 64 20 3a 3d 20 | so|rted := |
|00002b50| 22 22 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |"" | |
|00002b60| 20 20 20 23 20 73 6f 72 | 74 65 64 20 6e 6f 64 65 | # sor|ted node|
|00002b70| 73 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |s. | |
|00002b80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002b90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 23 20 67 | | # g|
|00002ba0| 65 74 20 6e 6f 64 65 73 | 20 77 69 74 68 6f 75 74 |et nodes| without|
|00002bb0| 20 70 72 65 64 65 63 65 | 73 73 6f 72 73 0a 20 20 | predece|ssors. |
|00002bc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 77 68 69 6c | | whil|
|00002bd0| 65 20 2a 28 72 6f 6f 74 | 73 20 3a 3d 20 6e 6f 64 |e *(root|s := nod|
|00002be0| 65 73 20 2d 2d 20 73 6e | 6f 64 65 73 28 61 72 63 |es -- sn|odes(arc|
|00002bf0| 73 29 29 20 3e 20 30 20 | 64 6f 20 7b 0a 20 20 20 |s)) > 0 |do {. |
|00002c00| 00 00 00 08 00 00 04 03 | 00 00 00 14 00 00 01 e8 |........|........|
|00002c10| 00 00 00 17 1f 52 7c f8 | 69 74 65 28 69 29 0a 0a |.....R|.|ite(i)..|
|00002c20| 48 65 72 65 20 74 68 65 | 20 66 69 72 73 74 20 72 |Here the| first r|
|00002c30| 65 73 75 6c 74 20 70 72 | 6f 64 75 63 65 64 20 62 |esult pr|oduced b|
|00002c40| 79 20 74 68 65 20 67 65 | 6e 65 72 61 74 6f 72 2c |y the ge|nerator,|
|00002c50| 20 33 2c 20 69 73 20 61 | 73 73 69 67 6e 65 64 0a | 3, is a|ssigned.|
|00002c60| 74 6f 20 69 2c 20 62 75 | 74 20 74 68 69 73 20 76 |to i, bu|t this v|
|00002c70| 61 6c 75 65 20 69 73 20 | 6e 6f 74 20 67 72 65 61 |alue is |not grea|
|00002c80| 74 65 72 20 74 68 61 6e | 20 35 20 61 6e 64 20 74 |ter than| 5 and t|
|00002c90| 68 65 20 63 6f 6d 70 61 | 72 69 73 6f 6e 0a 6f 70 |he compa|rison.op|
|00002ca0| 65 72 61 74 69 6f 6e 20 | 66 61 69 6c 73 2e 20 41 |eration |fails. A|
|00002cb0| 74 20 74 68 69 73 20 70 | 6f 69 6e 74 2c 20 74 68 |t this p|oint, th|
|00002cc0| 65 20 67 65 6e 65 72 61 | 74 6f 72 20 69 73 20 72 |e genera|tor is r|
|00002cd0| 65 73 75 6d 65 64 20 61 | 6e 64 20 70 72 6f 2d 0a |esumed a|nd pro-.|
|00002ce0| 64 75 63 65 73 20 74 68 | 65 20 73 65 63 6f 6e 64 |duces th|e second|
|00002cf0| 20 70 6f 73 69 74 69 6f | 6e 2c 20 32 33 2c 20 77 | positio|n, 23, w|
|00002d00| 68 69 63 68 20 69 73 20 | 67 72 65 61 74 65 72 20 |hich is |greater |
|00002d10| 74 68 61 6e 20 35 2e 20 | 54 68 65 20 63 6f 6d 2d |than 5. |The com-|
|00002d20| 0a 70 61 72 69 73 6f 6e | 20 6f 70 65 72 61 74 69 |.parison| operati|
|00002d30| 6f 6e 20 74 68 65 6e 20 | 73 75 63 63 65 65 64 73 |on then |succeeds|
|00002d40| 20 61 6e 64 20 74 68 65 | 20 76 61 6c 75 65 20 32 | and the| value 2|
|00002d50| 33 20 69 73 20 77 72 69 | 74 74 65 6e 2e 0a 42 65 |3 is wri|tten..Be|
|00002d60| 63 61 75 73 65 20 6f 66 | 20 74 68 65 20 69 6e 68 |cause of| the inh|
|00002d70| 65 72 69 74 61 6e 63 65 | 20 6f 66 20 66 61 69 6c |eritance| of fail|
|00002d80| 75 72 65 20 61 6e 64 20 | 74 68 65 20 66 61 63 74 |ure and |the fact|
|00002d90| 20 74 68 61 74 20 63 6f | 6d 2d 0a 70 61 72 69 73 | that co|m-.paris|
|00002da0| 6f 6e 20 6f 70 65 72 61 | 74 69 6f 6e 73 20 72 65 |on opera|tions re|
|00002db0| 74 75 72 6e 20 74 68 65 | 20 76 61 6c 75 65 20 6f |turn the| value o|
|00002dc0| 66 20 74 68 65 69 72 20 | 72 69 67 68 74 20 61 72 |f their |right ar|
|00002dd0| 67 75 6d 65 6e 74 2c 20 | 74 68 69 73 0a 65 78 70 |gument, |this.exp|
|00002de0| 72 65 73 73 69 6f 6e 20 | 63 61 6e 20 62 65 20 77 |ression |can be w|
|00002df0| 72 69 74 74 65 6e 20 69 | 6e 20 74 68 65 20 66 6f |ritten i|n the fo|
|00002e00| 00 00 00 08 00 00 04 03 | 00 00 00 15 00 00 01 e8 |........|........|
|00002e10| 00 00 00 18 10 fe 57 ec | 6c 6c 6f 77 69 6e 67 20 |......W.|llowing |
|00002e20| 6d 6f 72 65 20 63 6f 6d | 70 61 63 74 20 66 6f 72 |more com|pact for|
|00002e30| 6d 3a 0a 0a 20 20 20 20 | 20 20 20 20 77 72 69 74 |m:.. | writ|
|00002e40| 65 28 35 20 3c 20 66 69 | 6e 64 28 22 6f 72 22 2c |e(5 < fi|nd("or",|
|00002e50| 73 65 6e 74 65 6e 63 65 | 29 29 0a 0a 0a 20 20 20 |sentence|))... |
|00002e60| 47 6f 61 6c 2d 64 69 72 | 65 63 74 65 64 20 65 76 |Goal-dir|ected ev|
|00002e70| 61 6c 75 61 74 69 6f 6e | 20 69 73 20 69 6e 68 65 |aluation| is inhe|
|00002e80| 72 65 6e 74 20 69 6e 20 | 74 68 65 20 65 78 70 72 |rent in |the expr|
|00002e90| 65 73 73 69 6f 6e 20 65 | 76 61 6c 75 61 2d 0a 74 |ession e|valua-.t|
|00002ea0| 69 6f 6e 20 6d 65 63 68 | 61 6e 69 73 6d 20 6f 66 |ion mech|anism of|
|00002eb0| 20 49 63 6f 6e 20 61 6e | 64 20 63 61 6e 20 62 65 | Icon an|d can be|
|00002ec0| 20 75 73 65 64 20 69 6e | 20 61 72 62 69 74 72 61 | used in| arbitra|
|00002ed0| 72 69 6c 79 20 63 6f 6d | 70 6c 69 63 61 74 65 64 |rily com|plicated|
|00002ee0| 0a 73 69 74 75 61 74 69 | 6f 6e 73 2e 20 20 46 6f |.situati|ons. Fo|
|00002ef0| 72 20 65 78 61 6d 70 6c | 65 2c 0a 0a 20 20 20 20 |r exampl|e,.. |
|00002f00| 20 20 20 20 66 69 6e 64 | 28 22 6f 72 22 2c 73 65 | find|("or",se|
|00002f10| 6e 74 65 6e 63 65 31 29 | 20 3d 20 66 69 6e 64 28 |ntence1)| = find(|
|00002f20| 22 61 6e 64 22 2c 73 65 | 6e 74 65 6e 63 65 32 29 |"and",se|ntence2)|
|00002f30| 0a 0a 73 75 63 63 65 65 | 64 73 20 69 66 20 6f 72 |..succee|ds if or|
|00002f40| 20 6f 63 63 75 72 73 20 | 69 6e 20 73 65 6e 74 65 | occurs |in sente|
|00002f50| 6e 63 65 31 20 61 74 20 | 74 68 65 20 73 61 6d 65 |nce1 at |the same|
|00002f60| 20 70 6f 73 69 74 69 6f | 6e 20 61 73 20 61 6e 64 | positio|n as and|
|00002f70| 0a 6f 63 63 75 72 73 20 | 69 6e 20 73 65 6e 74 65 |.occurs |in sente|
|00002f80| 6e 63 65 32 2e 0a 0a 20 | 20 20 41 20 67 65 6e 65 |nce2... | A gene|
|00002f90| 72 61 74 6f 72 20 63 61 | 6e 20 62 65 20 72 65 73 |rator ca|n be res|
|00002fa0| 75 6d 65 64 20 72 65 70 | 65 61 74 65 64 6c 79 20 |umed rep|eatedly |
|00002fb0| 74 6f 20 70 72 6f 64 75 | 63 65 20 61 6c 6c 20 69 |to produ|ce all i|
|00002fc0| 74 73 0a 72 65 73 75 6c | 74 73 20 62 79 20 75 73 |ts.resul|ts by us|
|00002fd0| 69 6e 67 20 74 68 65 20 | 65 76 65 72 79 2d 64 6f |ing the |every-do|
|00002fe0| 20 63 6f 6e 74 72 6f 6c | 20 73 74 72 75 63 74 75 | control| structu|
|00002ff0| 72 65 2e 20 41 6e 20 65 | 78 61 6d 70 6c 65 20 69 |re. An e|xample i|
|00003000| 00 00 00 08 00 00 04 03 | 00 00 00 16 00 00 01 e8 |........|........|
|00003010| 00 00 00 19 db a4 16 78 | 73 0a 0a 20 20 20 20 20 |.......x|s.. |
|00003020| 20 20 20 65 76 65 72 79 | 20 69 20 3a 3d 20 66 69 | every| i := fi|
|00003030| 6e 64 28 22 6f 72 22 2c | 73 65 6e 74 65 6e 63 65 |nd("or",|sentence|
|00003040| 29 0a 20 20 20 20 20 20 | 20 20 20 20 20 64 6f 20 |). | do |
|00003050| 77 72 69 74 65 28 69 29 | 0a 0a 77 68 69 63 68 20 |write(i)|..which |
|00003060| 77 72 69 74 65 73 20 61 | 6c 6c 20 74 68 65 20 70 |writes a|ll the p|
|00003070| 6f 73 69 74 69 6f 6e 73 | 20 61 74 20 77 68 69 63 |ositions| at whic|
|00003080| 68 20 6f 72 20 6f 63 63 | 75 72 73 20 69 6e 20 73 |h or occ|urs in s|
|00003090| 65 6e 74 65 6e 63 65 2e | 0a 46 6f 72 20 74 68 65 |entence.|.For the|
|000030a0| 20 65 78 61 6d 70 6c 65 | 20 61 62 6f 76 65 2c 20 | example| above, |
|000030b0| 74 68 65 73 65 20 61 72 | 65 20 33 2c 20 32 33 2c |these ar|e 3, 23,|
|000030c0| 20 61 6e 64 20 33 33 2e | 0a 0a 20 20 20 47 65 6e | and 33.|.. Gen|
|000030d0| 65 72 61 74 69 6f 6e 20 | 69 73 20 69 6e 68 65 72 |eration |is inher|
|000030e0| 69 74 65 64 20 6c 69 6b | 65 20 66 61 69 6c 75 72 |ited lik|e failur|
|000030f0| 65 2c 20 61 6e 64 20 74 | 68 69 73 20 65 78 70 72 |e, and t|his expr|
|00003100| 65 73 73 69 6f 6e 20 63 | 61 6e 0a 62 65 20 77 72 |ession c|an.be wr|
|00003110| 69 74 74 65 6e 20 6d 6f | 72 65 20 63 6f 6e 63 69 |itten mo|re conci|
|00003120| 73 65 6c 79 20 62 79 20 | 6f 6d 69 74 74 69 6e 67 |sely by |omitting|
|00003130| 20 74 68 65 20 6f 70 74 | 69 6f 6e 61 6c 20 64 6f | the opt|ional do|
|00003140| 20 63 6c 61 75 73 65 3a | 0a 0a 20 20 20 20 20 20 | clause:|.. |
|00003150| 20 20 65 76 65 72 79 20 | 77 72 69 74 65 28 66 69 | every |write(fi|
|00003160| 6e 64 28 22 6f 72 22 2c | 73 65 6e 74 65 6e 63 65 |nd("or",|sentence|
|00003170| 29 29 0a 0a 0a 20 20 20 | 54 68 65 72 65 20 61 72 |))... |There ar|
|00003180| 65 20 73 65 76 65 72 61 | 6c 20 62 75 69 6c 74 2d |e severa|l built-|
|00003190| 69 6e 20 67 65 6e 65 72 | 61 74 6f 72 73 20 69 6e |in gener|ators in|
|000031a0| 20 49 63 6f 6e 2e 20 4f | 6e 65 20 6f 66 20 74 68 | Icon. O|ne of th|
|000031b0| 65 20 6d 6f 73 74 0a 66 | 72 65 71 75 65 6e 74 6c |e most.f|requentl|
|000031c0| 79 20 75 73 65 64 20 6f | 66 20 74 68 65 73 65 20 |y used o|f these |
|000031d0| 69 73 0a 0a 20 20 20 20 | 20 20 20 20 69 20 74 6f |is.. | i to|
|000031e0| 20 6a 0a 0a 77 68 69 63 | 68 20 67 65 6e 65 72 61 | j..whic|h genera|
|000031f0| 74 65 73 20 74 68 65 20 | 69 6e 74 65 67 65 72 73 |tes the |integers|
|00003200| 00 00 00 08 00 00 04 03 | 00 00 00 17 00 00 01 e8 |........|........|
|00003210| 00 00 00 1a ec 80 d3 33 | 20 66 72 6f 6d 20 69 20 |.......3| from i |
|00003220| 74 6f 20 6a 2e 20 54 68 | 69 73 20 67 65 6e 65 72 |to j. Th|is gener|
|00003230| 61 74 6f 72 20 63 61 6e | 20 62 65 0a 63 6f 6d 62 |ator can| be.comb|
|00003240| 69 6e 65 64 20 77 69 74 | 68 20 65 76 65 72 79 2d |ined wit|h every-|
|00003250| 64 6f 20 74 6f 20 66 6f | 72 6d 75 6c 61 74 65 20 |do to fo|rmulate |
|00003260| 74 68 65 20 74 72 61 64 | 69 74 69 6f 6e 61 6c 20 |the trad|itional |
|00003270| 66 6f 72 2d 73 74 79 6c | 65 0a 63 6f 6e 74 72 6f |for-styl|e.contro|
|00003280| 6c 20 73 74 72 75 63 74 | 75 72 65 3a 0a 0a 0a 0a |l struct|ure:....|
|00003290| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000032a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2d 20 | | - |
|000032b0| 36 20 2d 0a 0a 0a 0a 0a | 0a 0a 0a 0a 20 20 20 20 |6 -.....|.... |
|000032c0| 20 20 20 20 65 76 65 72 | 79 20 6b 20 3a 3d 20 69 | ever|y k := i|
|000032d0| 20 74 6f 20 6a 20 64 6f | 0a 20 20 20 20 20 20 20 | to j do|. |
|000032e0| 20 20 20 20 66 28 6b 29 | 0a 0a 4e 6f 74 65 20 74 | f(k)|..Note t|
|000032f0| 68 61 74 20 74 68 69 73 | 20 65 78 70 72 65 73 73 |hat this| express|
|00003300| 69 6f 6e 20 63 61 6e 20 | 62 65 20 77 72 69 74 74 |ion can |be writt|
|00003310| 65 6e 20 6d 6f 72 65 20 | 63 6f 6d 70 61 63 74 6c |en more |compactl|
|00003320| 79 20 61 73 0a 0a 20 20 | 20 20 20 20 20 20 65 76 |y as.. | ev|
|00003330| 65 72 79 20 66 28 69 20 | 74 6f 20 6a 29 0a 0a 0a |ery f(i |to j)...|
|00003340| 20 20 20 54 68 65 72 65 | 20 61 72 65 20 61 20 6e | There| are a n|
|00003350| 75 6d 62 65 72 20 6f 66 | 20 6f 74 68 65 72 20 63 |umber of| other c|
|00003360| 6f 6e 74 72 6f 6c 20 73 | 74 72 75 63 74 75 72 65 |ontrol s|tructure|
|00003370| 73 20 72 65 6c 61 74 65 | 64 20 74 6f 20 67 65 6e |s relate|d to gen|
|00003380| 2d 0a 65 72 61 74 69 6f | 6e 2e 20 20 4f 6e 65 20 |-.eratio|n. One |
|00003390| 69 73 20 61 6c 74 65 72 | 6e 61 74 69 6f 6e 2c 0a |is alter|nation,.|
|000033a0| 0a 20 20 20 20 20 20 20 | 20 65 78 70 72 31 20 7c |. | expr1 ||
|000033b0| 20 65 78 70 72 32 0a 0a | 77 68 69 63 68 20 67 65 | expr2..|which ge|
|000033c0| 6e 65 72 61 74 65 73 20 | 74 68 65 20 72 65 73 75 |nerates |the resu|
|000033d0| 6c 74 73 20 6f 66 20 65 | 78 70 72 31 20 66 6f 6c |lts of e|xpr1 fol|
|000033e0| 6c 6f 77 65 64 20 62 79 | 20 74 68 65 20 72 65 73 |lowed by| the res|
|000033f0| 75 6c 74 73 20 6f 66 0a | 65 78 70 72 32 2e 20 20 |ults of.|expr2. |
|00003400| 00 00 00 08 00 00 04 03 | 00 00 00 18 00 00 01 e8 |........|........|
|00003410| 00 00 00 1b 09 a1 b8 cf | 54 68 75 73 0a 0a 20 20 |........|Thus.. |
|00003420| 20 20 20 20 20 20 65 76 | 65 72 79 20 77 72 69 74 | ev|ery writ|
|00003430| 65 28 66 69 6e 64 28 22 | 6f 72 22 2c 73 65 6e 74 |e(find("|or",sent|
|00003440| 65 6e 63 65 31 29 20 7c | 20 66 69 6e 64 28 22 6f |ence1) || find("o|
|00003450| 72 22 2c 73 65 6e 74 65 | 6e 63 65 32 29 29 0a 0a |r",sente|nce2))..|
|00003460| 77 72 69 74 65 73 20 74 | 68 65 20 70 6f 73 69 74 |writes t|he posit|
|00003470| 69 6f 6e 73 20 6f 66 20 | 6f 72 20 69 6e 20 73 65 |ions of |or in se|
|00003480| 6e 74 65 6e 63 65 31 20 | 66 6f 6c 6c 6f 77 65 64 |ntence1 |followed|
|00003490| 20 62 79 20 74 68 65 20 | 70 6f 73 69 74 69 6f 6e | by the |position|
|000034a0| 73 0a 6f 66 20 6f 72 20 | 69 6e 20 73 65 6e 74 65 |s.of or |in sente|
|000034b0| 6e 63 65 32 2e 20 41 67 | 61 69 6e 2c 20 74 68 69 |nce2. Ag|ain, thi|
|000034c0| 73 20 73 65 6e 74 65 6e | 63 65 20 63 61 6e 20 62 |s senten|ce can b|
|000034d0| 65 20 77 72 69 74 74 65 | 6e 20 6d 6f 72 65 20 63 |e writte|n more c|
|000034e0| 6f 6d 2d 0a 70 61 63 74 | 6c 79 20 62 79 20 75 73 |om-.pact|ly by us|
|000034f0| 69 6e 67 20 61 6c 74 65 | 72 6e 61 74 69 6f 6e 20 |ing alte|rnation |
|00003500| 69 6e 20 74 68 65 20 73 | 65 63 6f 6e 64 20 61 72 |in the s|econd ar|
|00003510| 67 75 6d 65 6e 74 20 6f | 66 20 66 69 6e 64 3a 0a |gument o|f find:.|
|00003520| 0a 20 20 20 20 20 20 20 | 20 65 76 65 72 79 20 77 |. | every w|
|00003530| 72 69 74 65 28 66 69 6e | 64 28 22 6f 72 22 2c 73 |rite(fin|d("or",s|
|00003540| 65 6e 74 65 6e 63 65 31 | 20 7c 20 73 65 6e 74 65 |entence1| | sente|
|00003550| 6e 63 65 32 29 29 0a 0a | 0a 20 20 20 41 6e 6f 74 |nce2))..|. Anot|
|00003560| 68 65 72 20 75 73 65 20 | 6f 66 20 61 6c 74 65 72 |her use |of alter|
|00003570| 6e 61 74 69 6f 6e 20 69 | 73 20 69 6c 6c 75 73 74 |nation i|s illust|
|00003580| 72 61 74 65 64 20 62 79 | 0a 0a 20 20 20 20 20 20 |rated by|.. |
|00003590| 20 20 28 69 20 7c 20 6a | 20 7c 20 6b 29 20 3d 20 | (i | j| | k) = |
|000035a0| 28 30 20 7c 20 31 29 0a | 0a 77 68 69 63 68 20 73 |(0 | 1).|.which s|
|000035b0| 75 63 63 65 65 64 73 20 | 69 66 20 61 6e 79 20 6f |ucceeds |if any o|
|000035c0| 66 20 69 2c 20 6a 2c 20 | 6f 72 20 6b 20 68 61 73 |f i, j, |or k has|
|000035d0| 20 74 68 65 20 76 61 6c | 75 65 20 30 20 6f 72 20 | the val|ue 0 or |
|000035e0| 31 2e 0a 0a 0a 35 2e 20 | 20 53 74 72 69 6e 67 20 |1....5. | String |
|000035f0| 53 63 61 6e 6e 69 6e 67 | 0a 0a 20 20 20 54 68 65 |Scanning|.. The|
|00003600| 00 00 00 08 00 00 04 03 | 00 00 00 19 00 00 01 e8 |........|........|
|00003610| 00 00 00 1c c9 09 05 6f | 20 73 74 72 69 6e 67 20 |.......o| string |
|00003620| 61 6e 61 6c 79 73 69 73 | 20 61 6e 64 20 73 79 6e |analysis| and syn|
|00003630| 74 68 65 73 69 73 20 6f | 70 65 72 61 74 69 6f 6e |thesis o|peration|
|00003640| 73 20 64 65 73 63 72 69 | 62 65 64 20 69 6e 20 53 |s descri|bed in S|
|00003650| 65 63 2d 0a 74 69 6f 6e | 73 20 32 20 61 6e 64 20 |ec-.tion|s 2 and |
|00003660| 33 20 77 6f 72 6b 20 62 | 65 73 74 20 66 6f 72 20 |3 work b|est for |
|00003670| 72 65 6c 61 74 69 76 65 | 6c 79 20 73 69 6d 70 6c |relative|ly simpl|
|00003680| 65 20 6f 70 65 72 61 74 | 69 6f 6e 73 20 6f 6e 0a |e operat|ions on.|
|00003690| 73 74 72 69 6e 67 73 2e | 20 20 46 6f 72 20 63 6f |strings.| For co|
|000036a0| 6d 70 6c 69 63 61 74 65 | 64 20 6f 70 65 72 61 74 |mplicate|d operat|
|000036b0| 69 6f 6e 73 2c 20 74 68 | 65 20 62 6f 6f 6b 6b 65 |ions, th|e bookke|
|000036c0| 65 70 69 6e 67 20 69 6e | 76 6f 6c 76 65 64 20 69 |eping in|volved i|
|000036d0| 6e 0a 6b 65 65 70 69 6e | 67 20 74 72 61 63 6b 20 |n.keepin|g track |
|000036e0| 6f 66 20 70 6f 73 69 74 | 69 6f 6e 73 20 69 6e 20 |of posit|ions in |
|000036f0| 73 74 72 69 6e 67 73 20 | 62 65 63 6f 6d 65 73 20 |strings |becomes |
|00003700| 62 75 72 64 65 6e 73 6f | 6d 65 20 61 6e 64 0a 65 |burdenso|me and.e|
|00003710| 72 72 6f 72 20 70 72 6f | 6e 65 2e 20 20 49 6e 20 |rror pro|ne. In |
|00003720| 73 75 63 68 20 63 61 73 | 65 73 2c 20 49 63 6f 6e |such cas|es, Icon|
|00003730| 20 68 61 73 20 61 20 73 | 74 72 69 6e 67 20 73 63 | has a s|tring sc|
|00003740| 61 6e 6e 69 6e 67 20 66 | 61 63 69 6c 69 74 79 0a |anning f|acility.|
|00003750| 74 68 61 74 20 69 73 20 | 61 6e 61 6c 6f 67 6f 75 |that is |analogou|
|00003760| 73 20 69 6e 20 6d 61 6e | 79 20 72 65 73 70 65 63 |s in man|y respec|
|00003770| 74 73 20 74 6f 20 70 61 | 74 74 65 72 6e 20 6d 61 |ts to pa|ttern ma|
|00003780| 74 63 68 69 6e 67 20 69 | 6e 20 53 4e 4f 2d 0a 42 |tching i|n SNO-.B|
|00003790| 4f 4c 34 2e 20 49 6e 20 | 73 74 72 69 6e 67 20 73 |OL4. In |string s|
|000037a0| 63 61 6e 6e 69 6e 67 2c | 20 70 6f 73 69 74 69 6f |canning,| positio|
|000037b0| 6e 73 20 61 72 65 20 6d | 61 6e 61 67 65 64 20 61 |ns are m|anaged a|
|000037c0| 75 74 6f 6d 61 74 69 63 | 61 6c 6c 79 20 61 6e 64 |utomatic|ally and|
|000037d0| 0a 61 74 74 65 6e 74 69 | 6f 6e 20 69 73 20 66 6f |.attenti|on is fo|
|000037e0| 63 75 73 65 64 20 6f 6e | 20 61 20 63 75 72 72 65 |cused on| a curre|
|000037f0| 6e 74 20 70 6f 73 69 74 | 69 6f 6e 20 69 6e 20 61 |nt posit|ion in a|
|00003800| 00 00 00 08 00 00 04 03 | 00 00 00 1a 00 00 01 e8 |........|........|
|00003810| 00 00 00 1d 9c 1c 14 77 | 20 73 74 72 69 6e 67 20 |.......w| string |
|00003820| 61 73 20 69 74 20 69 73 | 0a 65 78 61 6d 69 6e 65 |as it is|.examine|
|00003830| 64 20 62 79 20 61 20 73 | 65 71 75 65 6e 63 65 20 |d by a s|equence |
|00003840| 6f 66 20 6f 70 65 72 61 | 74 69 6f 6e 73 2e 0a 0a |of opera|tions...|
|00003850| 20 20 20 54 68 65 20 73 | 74 72 69 6e 67 20 73 63 | The s|tring sc|
|00003860| 61 6e 6e 69 6e 67 20 6f | 70 65 72 61 74 69 6f 6e |anning o|peration|
|00003870| 20 68 61 73 20 74 68 65 | 20 66 6f 72 6d 0a 0a 20 | has the| form.. |
|00003880| 20 20 20 20 20 20 20 73 | 20 3f 20 65 78 70 72 0a | s| ? expr.|
|00003890| 0a 77 68 65 72 65 20 73 | 20 69 73 20 74 68 65 20 |.where s| is the |
|000038a0| 73 75 62 6a 65 63 74 20 | 73 74 72 69 6e 67 20 74 |subject |string t|
|000038b0| 6f 20 62 65 20 65 78 61 | 6d 69 6e 65 64 20 61 6e |o be exa|mined an|
|000038c0| 64 20 65 78 70 72 20 69 | 73 20 61 6e 0a 65 78 70 |d expr i|s an.exp|
|000038d0| 72 65 73 73 69 6f 6e 20 | 74 68 61 74 20 70 65 72 |ression |that per|
|000038e0| 66 6f 72 6d 73 20 74 68 | 65 20 65 78 61 6d 69 6e |forms th|e examin|
|000038f0| 61 74 69 6f 6e 2e 20 20 | 41 20 70 6f 73 69 74 69 |ation. |A positi|
|00003900| 6f 6e 20 69 6e 20 74 68 | 65 20 73 75 62 2d 0a 6a |on in th|e sub-.j|
|00003910| 65 63 74 2c 20 77 68 69 | 63 68 20 73 74 61 72 74 |ect, whi|ch start|
|00003920| 73 20 61 74 20 31 2c 20 | 69 73 20 74 68 65 20 66 |s at 1, |is the f|
|00003930| 6f 63 75 73 20 6f 66 20 | 65 78 61 6d 69 6e 61 74 |ocus of |examinat|
|00003940| 69 6f 6e 2e 0a 0a 20 20 | 20 4d 61 74 63 68 69 6e |ion... | Matchin|
|00003950| 67 20 66 75 6e 63 74 69 | 6f 6e 73 20 63 68 61 6e |g functi|ons chan|
|00003960| 67 65 20 74 68 69 73 20 | 70 6f 73 69 74 69 6f 6e |ge this |position|
|00003970| 2e 20 20 4f 6e 65 20 6d | 61 74 63 68 69 6e 67 20 |. One m|atching |
|00003980| 66 75 6e 63 2d 0a 74 69 | 6f 6e 2c 20 6d 6f 76 65 |func-.ti|on, move|
|00003990| 28 69 29 2c 20 6d 6f 76 | 65 73 20 74 68 65 20 70 |(i), mov|es the p|
|000039a0| 6f 73 69 74 69 6f 6e 20 | 62 79 20 69 20 61 6e 64 |osition |by i and|
|000039b0| 20 70 72 6f 64 75 63 65 | 73 20 74 68 65 20 73 75 | produce|s the su|
|000039c0| 62 73 74 72 69 6e 67 0a | 0a 0a 0a 20 20 20 20 20 |bstring.|... |
|000039d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000039e0| 20 20 20 20 20 20 20 20 | 20 2d 20 37 20 2d 0a 0a | | - 7 -..|
|000039f0| 0a 0a 0a 0a 0a 0a 0a 6f | 66 20 74 68 65 20 73 75 |.......o|f the su|
|00003a00| 00 00 00 08 00 00 04 03 | 00 00 00 1b 00 00 01 e8 |........|........|
|00003a10| 00 00 00 1e 84 5b 95 fd | 62 6a 65 63 74 20 62 65 |.....[..|bject be|
|00003a20| 74 77 65 65 6e 20 74 68 | 65 20 70 72 65 76 69 6f |tween th|e previo|
|00003a30| 75 73 20 61 6e 64 20 6e | 65 77 20 70 6f 73 69 74 |us and n|ew posit|
|00003a40| 69 6f 6e 73 2e 20 49 66 | 20 74 68 65 0a 70 6f 73 |ions. If| the.pos|
|00003a50| 69 74 69 6f 6e 20 63 61 | 6e 6e 6f 74 20 62 65 20 |ition ca|nnot be |
|00003a60| 6d 6f 76 65 64 20 62 79 | 20 74 68 65 20 73 70 65 |moved by| the spe|
|00003a70| 63 69 66 69 65 64 20 61 | 6d 6f 75 6e 74 20 28 62 |cified a|mount (b|
|00003a80| 65 63 61 75 73 65 20 74 | 68 65 0a 73 75 62 6a 65 |ecause t|he.subje|
|00003a90| 63 74 20 69 73 20 6e 6f | 74 20 6c 6f 6e 67 20 65 |ct is no|t long e|
|00003aa0| 6e 6f 75 67 68 29 2c 20 | 6d 6f 76 65 28 69 29 20 |nough), |move(i) |
|00003ab0| 66 61 69 6c 73 2e 20 41 | 20 73 69 6d 70 6c 65 20 |fails. A| simple |
|00003ac0| 65 78 61 6d 70 6c 65 20 | 69 73 0a 0a 20 20 20 20 |example |is.. |
|00003ad0| 20 20 20 20 6c 69 6e 65 | 20 3f 20 77 68 69 6c 65 | line| ? while|
|00003ae0| 20 77 72 69 74 65 28 6d | 6f 76 65 28 32 29 29 0a | write(m|ove(2)).|
|00003af0| 0a 77 68 69 63 68 20 77 | 72 69 74 65 73 20 73 75 |.which w|rites su|
|00003b00| 63 63 65 73 73 69 76 65 | 20 74 77 6f 2d 63 68 61 |ccessive| two-cha|
|00003b10| 72 61 63 74 65 72 20 73 | 75 62 73 74 72 69 6e 67 |racter s|ubstring|
|00003b20| 73 20 6f 66 20 6c 69 6e | 65 2c 20 73 74 6f 70 2d |s of lin|e, stop-|
|00003b30| 0a 70 69 6e 67 20 77 68 | 65 6e 20 74 68 65 72 65 |.ping wh|en there|
|00003b40| 20 61 72 65 20 6e 6f 20 | 6d 6f 72 65 20 63 68 61 | are no |more cha|
|00003b50| 72 61 63 74 65 72 73 2e | 0a 0a 20 20 20 41 6e 6f |racters.|.. Ano|
|00003b60| 74 68 65 72 20 6d 61 74 | 63 68 69 6e 67 20 66 75 |ther mat|ching fu|
|00003b70| 6e 63 74 69 6f 6e 20 69 | 73 20 74 61 62 28 69 29 |nction i|s tab(i)|
|00003b80| 2c 20 77 68 69 63 68 20 | 73 65 74 73 20 74 68 65 |, which |sets the|
|00003b90| 20 70 6f 73 69 74 69 6f | 6e 0a 69 6e 20 74 68 65 | positio|n.in the|
|00003ba0| 20 73 75 62 6a 65 63 74 | 20 74 6f 20 69 20 61 6e | subject| to i an|
|00003bb0| 64 20 61 6c 73 6f 20 72 | 65 74 75 72 6e 73 20 74 |d also r|eturns t|
|00003bc0| 68 65 20 73 75 62 73 74 | 72 69 6e 67 20 6f 66 20 |he subst|ring of |
|00003bd0| 74 68 65 20 73 75 62 6a | 65 63 74 0a 62 65 74 77 |the subj|ect.betw|
|00003be0| 65 65 6e 20 74 68 65 20 | 70 72 65 76 69 6f 75 73 |een the |previous|
|00003bf0| 20 61 6e 64 20 6e 65 77 | 20 70 6f 73 69 74 69 6f | and new| positio|
|00003c00| 00 00 00 08 00 00 04 03 | 00 00 00 1c 00 00 01 e8 |........|........|
|00003c10| 00 00 00 1f e3 63 f2 a8 | 6e 73 2e 20 20 46 6f 72 |.....c..|ns. For|
|00003c20| 20 65 78 61 6d 70 6c 65 | 2c 0a 0a 20 20 20 20 20 | example|,.. |
|00003c30| 20 20 20 6c 69 6e 65 20 | 3f 20 69 66 20 74 61 62 | line |? if tab|
|00003c40| 28 31 30 29 20 74 68 65 | 6e 20 77 72 69 74 65 28 |(10) the|n write(|
|00003c50| 74 61 62 28 30 29 29 0a | 0a 66 69 72 73 74 20 73 |tab(0)).|.first s|
|00003c60| 65 74 73 20 74 68 65 20 | 70 6f 73 69 74 69 6f 6e |ets the |position|
|00003c70| 20 69 6e 20 74 68 65 20 | 73 75 62 6a 65 63 74 20 | in the |subject |
|00003c80| 74 6f 20 31 30 20 61 6e | 64 20 74 68 65 6e 20 74 |to 10 an|d then t|
|00003c90| 6f 20 74 68 65 20 65 6e | 64 0a 6f 66 20 74 68 65 |o the en|d.of the|
|00003ca0| 20 73 75 62 6a 65 63 74 | 2c 20 77 72 69 74 69 6e | subject|, writin|
|00003cb0| 67 20 6c 69 6e 65 5b 31 | 30 3a 30 5d 2e 20 20 4e |g line[1|0:0]. N|
|00003cc0| 6f 74 65 20 74 68 61 74 | 20 6e 6f 20 76 61 6c 75 |ote that| no valu|
|00003cd0| 65 20 69 73 20 77 72 69 | 74 2d 0a 74 65 6e 20 69 |e is wri|t-.ten i|
|00003ce0| 66 20 74 68 65 20 73 75 | 62 6a 65 63 74 20 69 73 |f the su|bject is|
|00003cf0| 20 6e 6f 74 20 6c 6f 6e | 67 20 65 6e 6f 75 67 68 | not lon|g enough|
|00003d00| 2e 0a 0a 20 20 20 53 74 | 72 69 6e 67 20 61 6e 61 |... St|ring ana|
|00003d10| 6c 79 73 69 73 20 66 75 | 6e 63 74 69 6f 6e 73 20 |lysis fu|nctions |
|00003d20| 73 75 63 68 20 61 73 20 | 66 69 6e 64 20 63 61 6e |such as |find can|
|00003d30| 20 62 65 20 75 73 65 64 | 20 69 6e 20 73 74 72 69 | be used| in stri|
|00003d40| 6e 67 0a 73 63 61 6e 6e | 69 6e 67 2e 20 49 6e 20 |ng.scann|ing. In |
|00003d50| 74 68 69 73 20 63 6f 6e | 74 65 78 74 2c 20 74 68 |this con|text, th|
|00003d60| 65 20 73 74 72 69 6e 67 | 20 74 68 61 74 20 74 68 |e string| that th|
|00003d70| 65 79 20 6f 70 65 72 61 | 74 65 20 6f 6e 20 69 73 |ey opera|te on is|
|00003d80| 20 6e 6f 74 0a 73 70 65 | 63 69 66 69 65 64 20 61 | not.spe|cified a|
|00003d90| 6e 64 20 69 73 20 74 61 | 6b 65 6e 20 74 6f 20 62 |nd is ta|ken to b|
|00003da0| 65 20 74 68 65 20 73 75 | 62 6a 65 63 74 2e 20 46 |e the su|bject. F|
|00003db0| 6f 72 20 65 78 61 6d 70 | 6c 65 2c 0a 0a 20 20 20 |or examp|le,.. |
|00003dc0| 20 20 20 20 20 6c 69 6e | 65 20 3f 20 77 68 69 6c | lin|e ? whil|
|00003dd0| 65 20 77 72 69 74 65 28 | 74 61 62 28 66 69 6e 64 |e write(|tab(find|
|00003de0| 28 22 6f 72 22 29 29 29 | 0a 20 20 20 20 20 20 20 |("or")))|. |
|00003df0| 20 20 20 20 64 6f 20 6d | 6f 76 65 28 32 29 0a 0a | do m|ove(2)..|
|00003e00| 00 00 00 08 00 00 04 03 | 00 00 00 1d 00 00 01 e8 |........|........|
|00003e10| 00 00 00 20 fa 02 b7 36 | 77 72 69 74 65 73 20 61 |... ...6|writes a|
|00003e20| 6c 6c 20 74 68 65 20 73 | 75 62 73 74 72 69 6e 67 |ll the s|ubstring|
|00003e30| 73 20 6f 66 20 6c 69 6e | 65 20 70 72 69 6f 72 20 |s of lin|e prior |
|00003e40| 74 6f 20 6f 63 63 75 72 | 72 65 6e 63 65 73 20 6f |to occur|rences o|
|00003e50| 66 20 6f 72 2e 0a 4e 6f | 74 65 20 74 68 61 74 20 |f or..No|te that |
|00003e60| 66 69 6e 64 20 70 72 6f | 64 75 63 65 73 20 61 20 |find pro|duces a |
|00003e70| 70 6f 73 69 74 69 6f 6e | 2c 20 77 68 69 63 68 20 |position|, which |
|00003e80| 69 73 20 74 68 65 6e 20 | 75 73 65 64 20 62 79 20 |is then |used by |
|00003e90| 74 61 62 20 74 6f 0a 63 | 68 61 6e 67 65 20 74 68 |tab to.c|hange th|
|00003ea0| 65 20 70 6f 73 69 74 69 | 6f 6e 20 61 6e 64 20 70 |e positi|on and p|
|00003eb0| 72 6f 64 75 63 65 20 74 | 68 65 20 64 65 73 69 72 |roduce t|he desir|
|00003ec0| 65 64 20 73 75 62 73 74 | 72 69 6e 67 2e 20 54 68 |ed subst|ring. Th|
|00003ed0| 65 0a 6d 6f 76 65 28 32 | 29 20 73 6b 69 70 73 20 |e.move(2|) skips |
|00003ee0| 74 68 65 20 6f 72 20 74 | 68 61 74 20 69 73 20 66 |the or t|hat is f|
|00003ef0| 6f 75 6e 64 2e 0a 0a 20 | 20 20 41 6e 6f 74 68 65 |ound... | Anothe|
|00003f00| 72 20 65 78 61 6d 70 6c | 65 20 6f 66 20 74 68 65 |r exampl|e of the|
|00003f10| 20 75 73 65 20 6f 66 20 | 73 74 72 69 6e 67 20 61 | use of |string a|
|00003f20| 6e 61 6c 79 73 69 73 20 | 66 75 6e 63 74 69 6f 6e |nalysis |function|
|00003f30| 73 20 69 6e 0a 73 63 61 | 6e 6e 69 6e 67 20 69 73 |s in.sca|nning is|
|00003f40| 0a 0a 20 20 20 20 20 20 | 20 20 6c 69 6e 65 20 3f |.. | line ?|
|00003f50| 20 77 68 69 6c 65 20 74 | 61 62 28 75 70 74 6f 28 | while t|ab(upto(|
|00003f60| 6c 65 74 74 65 72 73 29 | 29 20 64 6f 0a 20 20 20 |letters)|) do. |
|00003f70| 20 20 20 20 20 20 20 20 | 77 72 69 74 65 28 74 61 | |write(ta|
|00003f80| 62 28 6d 61 6e 79 28 6c | 65 74 74 65 72 73 29 29 |b(many(l|etters))|
|00003f90| 29 0a 0a 77 68 69 63 68 | 20 77 72 69 74 65 73 20 |)..which| writes |
|00003fa0| 61 6c 6c 20 74 68 65 20 | 77 6f 72 64 73 20 69 6e |all the |words in|
|00003fb0| 20 6c 69 6e 65 2e 0a 0a | 20 20 20 41 73 20 69 6c | line...| As il|
|00003fc0| 6c 75 73 74 72 61 74 65 | 64 20 69 6e 20 74 68 65 |lustrate|d in the|
|00003fd0| 20 65 78 61 6d 70 6c 65 | 73 20 61 62 6f 76 65 2c | example|s above,|
|00003fe0| 20 61 6e 79 20 65 78 70 | 72 65 73 73 69 6f 6e 20 | any exp|ression |
|00003ff0| 6d 61 79 20 6f 63 63 75 | 72 0a 69 6e 20 74 68 65 |may occu|r.in the|
|00004000| 00 00 00 08 00 00 04 03 | 00 00 00 1e 00 00 01 e8 |........|........|
|00004010| 00 00 00 0b 8b d0 fc a7 | 20 73 63 61 6e 6e 69 6e |........| scannin|
|00004020| 67 20 65 78 70 72 65 73 | 73 69 6f 6e 2e 20 55 6e |g expres|sion. Un|
|00004030| 6c 69 6b 65 20 53 4e 4f | 42 4f 4c 34 2c 20 69 6e |like SNO|BOL4, in|
|00004040| 20 77 68 69 63 68 20 74 | 68 65 20 6f 70 65 72 61 | which t|he opera|
|00004050| 2d 0a 74 69 6f 6e 73 20 | 74 68 61 74 20 61 72 65 |-.tions |that are|
|00004060| 20 61 6c 6c 6f 77 65 64 | 20 69 6e 20 70 61 74 74 | allowed| in patt|
|00004070| 65 72 6e 20 6d 61 74 63 | 68 69 6e 67 20 61 72 65 |ern matc|hing are|
|00004080| 20 6c 69 6d 69 74 65 64 | 20 61 6e 64 0a 69 64 69 | limited| and.idi|
|00004090| 6f 73 79 6e 63 72 61 74 | 69 63 2c 20 73 74 72 69 |osyncrat|ic, stri|
|000040a0| 6e 67 20 73 63 61 6e 6e | 69 6e 67 20 69 73 20 63 |ng scann|ing is c|
|000040b0| 6f 6d 70 6c 65 74 65 6c | 79 20 69 6e 74 65 67 72 |ompletel|y integr|
|000040c0| 61 74 65 64 20 77 69 74 | 68 20 74 68 65 0a 72 65 |ated wit|h the.re|
|000040d0| 73 74 20 6f 66 20 74 68 | 65 20 6f 70 65 72 61 74 |st of th|e operat|
|000040e0| 69 6f 6e 20 72 65 70 65 | 72 74 6f 69 72 65 20 6f |ion repe|rtoire o|
|000040f0| 66 20 49 63 6f 6e 2e 0a | 0a 0a 36 2e 20 20 53 74 |f Icon..|..6. St|
|00004100| 72 75 63 74 75 72 65 73 | 0a 0a 36 2e 31 20 20 4c |ructures|..6.1 L|
|00004110| 69 73 74 73 0a 0a 20 20 | 20 57 68 69 6c 65 20 73 |ists.. | While s|
|00004120| 74 72 69 6e 67 73 20 61 | 72 65 20 73 65 71 75 65 |trings a|re seque|
|00004130| 6e 63 65 73 20 6f 66 20 | 63 68 61 72 61 63 74 65 |nces of |characte|
|00004140| 72 73 2c 20 6c 69 73 74 | 73 20 69 6e 20 49 63 6f |rs, list|s in Ico|
|00004150| 6e 20 61 72 65 0a 73 65 | 71 75 65 6e 63 65 73 20 |n are.se|quences |
|00004160| 6f 66 20 76 61 6c 75 65 | 73 20 6f 66 20 61 72 62 |of value|s of arb|
|00004170| 69 74 72 61 72 79 20 74 | 79 70 65 73 2e 20 4c 69 |itrary t|ypes. Li|
|00004180| 73 74 73 20 61 72 65 20 | 63 72 65 61 74 65 64 20 |sts are |created |
|00004190| 62 79 0a 65 6e 63 6c 6f | 73 69 6e 67 20 74 68 65 |by.enclo|sing the|
|000041a0| 20 6c 69 73 74 73 20 6f | 66 20 76 61 6c 75 65 73 | lists o|f values|
|000041b0| 20 69 6e 20 62 72 61 63 | 6b 65 74 73 2e 20 41 6e | in brac|kets. An|
|000041c0| 20 65 78 61 6d 70 6c 65 | 20 69 73 0a 0a 0a 0a 0a | example| is.....|
|000041d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000041e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2d 20 | | - |
|000041f0| 38 20 2d 0a 0a 0a 0a 0a | 0a 0a 0a 0a 20 20 20 20 |8 -.....|.... |
|00004200| 00 00 00 08 00 00 04 03 | 00 00 00 09 00 00 01 e8 |........|........|
|00004210| 00 00 00 22 08 fb d0 21 | 20 20 20 20 20 20 6d 69 |..."...!| mi|
|00004220| 64 64 6c 65 20 3a 3d 20 | 6c 69 6e 65 5b 31 30 3a |ddle := |line[10:|
|00004230| 32 30 5d 0a 0a 61 73 73 | 69 67 6e 73 20 74 6f 20 |20]..ass|igns to |
|00004240| 6d 69 64 64 6c 65 20 74 | 68 65 20 73 74 72 69 6e |middle t|he strin|
|00004250| 67 20 6f 66 20 63 68 61 | 72 61 63 74 65 72 73 20 |g of cha|racters |
|00004260| 6f 66 20 6c 69 6e 65 20 | 62 65 74 77 65 65 6e 20 |of line |between |
|00004270| 70 6f 73 69 2d 0a 74 69 | 6f 6e 73 20 31 30 20 61 |posi-.ti|ons 10 a|
|00004280| 6e 64 20 32 30 2e 20 20 | 53 69 6d 69 6c 61 72 6c |nd 20. |Similarl|
|00004290| 79 2c 0a 0a 20 20 20 20 | 20 20 20 20 77 72 69 74 |y,.. | writ|
|000042a0| 65 28 6c 69 6e 65 5b 32 | 5d 29 0a 0a 77 72 69 74 |e(line[2|])..writ|
|000042b0| 65 73 20 74 68 65 20 73 | 65 63 6f 6e 64 20 63 68 |es the s|econd ch|
|000042c0| 61 72 61 63 74 65 72 20 | 6f 66 20 6c 69 6e 65 2e |aracter |of line.|
|000042d0| 20 20 54 68 65 20 76 61 | 6c 75 65 20 30 20 69 73 | The va|lue 0 is|
|000042e0| 20 75 73 65 64 20 74 6f | 0a 72 65 66 65 72 20 74 | used to|.refer t|
|000042f0| 6f 20 74 68 65 20 70 6f | 73 69 74 69 6f 6e 20 61 |o the po|sition a|
|00004300| 66 74 65 72 20 74 68 65 | 20 6c 61 73 74 20 63 68 |fter the| last ch|
|00004310| 61 72 61 63 74 65 72 20 | 6f 66 20 61 20 73 74 72 |aracter |of a str|
|00004320| 69 6e 67 2e 20 54 68 75 | 73 0a 0a 20 20 20 20 20 |ing. Thu|s.. |
|00004330| 20 20 20 77 72 69 74 65 | 28 6c 69 6e 65 5b 32 3a | write|(line[2:|
|00004340| 30 5d 29 0a 0a 77 72 69 | 74 65 73 20 74 68 65 20 |0])..wri|tes the |
|00004350| 73 75 62 73 74 72 69 6e | 67 20 6f 66 20 6c 69 6e |substrin|g of lin|
|00004360| 65 20 66 72 6f 6d 20 74 | 68 65 20 73 65 63 6f 6e |e from t|he secon|
|00004370| 64 20 63 68 61 72 61 63 | 74 65 72 20 74 6f 20 74 |d charac|ter to t|
|00004380| 68 65 0a 65 6e 64 2c 20 | 74 68 75 73 20 6f 6d 69 |he.end, |thus omi|
|00004390| 74 74 69 6e 67 20 74 68 | 65 20 66 69 72 73 74 20 |tting th|e first |
|000043a0| 63 68 61 72 61 63 74 65 | 72 2e 0a 0a 20 20 20 41 |characte|r... A|
|000043b0| 6e 20 61 73 73 69 67 6e | 6d 65 6e 74 20 63 61 6e |n assign|ment can|
|000043c0| 20 62 65 20 6d 61 64 65 | 20 74 6f 20 74 68 65 20 | be made| to the |
|000043d0| 73 75 62 73 74 72 69 6e | 67 20 6f 66 20 73 74 72 |substrin|g of str|
|000043e0| 69 6e 67 2d 76 61 6c 75 | 65 64 0a 76 61 72 69 61 |ing-valu|ed.varia|
|000043f0| 62 6c 65 20 74 6f 20 63 | 68 61 6e 67 65 20 69 74 |ble to c|hange it|
|00004400| 00 00 00 08 00 00 04 03 | 00 00 00 0a 00 00 01 e8 |........|........|
|00004410| 00 00 00 23 e0 a6 47 55 | 73 20 76 61 6c 75 65 2e |...#..GU|s value.|
|00004420| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 0a 0a 20 | For exa|mple,.. |
|00004430| 20 20 20 20 20 20 20 6c | 69 6e 65 5b 32 5d 20 3a | l|ine[2] :|
|00004440| 3d 20 22 2e 2e 2e 22 0a | 0a 72 65 70 6c 61 63 65 |= "...".|.replace|
|00004450| 73 20 74 68 65 20 73 65 | 63 6f 6e 64 20 63 68 61 |s the se|cond cha|
|00004460| 72 61 63 74 65 72 20 6f | 66 20 6c 69 6e 65 20 62 |racter o|f line b|
|00004470| 79 20 74 68 72 65 65 20 | 64 6f 74 73 2e 20 4e 6f |y three |dots. No|
|00004480| 74 65 20 74 68 61 74 0a | 74 68 65 20 73 69 7a 65 |te that.|the size|
|00004490| 20 6f 66 20 6c 69 6e 65 | 20 63 68 61 6e 67 65 73 | of line| changes|
|000044a0| 20 61 75 74 6f 6d 61 74 | 69 63 61 6c 6c 79 2e 0a | automat|ically..|
|000044b0| 0a 20 20 20 54 68 65 72 | 65 20 61 72 65 20 6d 61 |. Ther|e are ma|
|000044c0| 6e 79 20 66 75 6e 63 74 | 69 6f 6e 73 20 66 6f 72 |ny funct|ions for|
|000044d0| 20 61 6e 61 6c 79 7a 69 | 6e 67 20 73 74 72 69 6e | analyzi|ng strin|
|000044e0| 67 73 2e 20 41 6e 20 65 | 78 61 6d 70 6c 65 20 69 |gs. An e|xample i|
|000044f0| 73 0a 0a 20 20 20 20 20 | 20 20 20 66 69 6e 64 28 |s.. | find(|
|00004500| 73 31 2c 73 32 29 0a 0a | 77 68 69 63 68 20 70 72 |s1,s2)..|which pr|
|00004510| 6f 64 75 63 65 73 20 74 | 68 65 20 70 6f 73 69 74 |oduces t|he posit|
|00004520| 69 6f 6e 20 69 6e 20 73 | 32 20 61 74 20 77 68 69 |ion in s|2 at whi|
|00004530| 63 68 20 73 31 20 6f 63 | 63 75 72 73 20 61 73 20 |ch s1 oc|curs as |
|00004540| 61 20 73 75 62 2d 0a 73 | 74 72 69 6e 67 2e 20 46 |a sub-.s|tring. F|
|00004550| 6f 72 20 65 78 61 6d 70 | 6c 65 2c 20 69 66 20 74 |or examp|le, if t|
|00004560| 68 65 20 76 61 6c 75 65 | 20 6f 66 20 67 72 65 65 |he value| of gree|
|00004570| 74 69 6e 67 20 69 73 20 | 61 73 20 67 69 76 65 6e |ting is |as given|
|00004580| 20 65 61 72 2d 0a 6c 69 | 65 72 2c 0a 0a 20 20 20 | ear-.li|er,.. |
|00004590| 20 20 20 20 20 66 69 6e | 64 28 22 6f 72 22 2c 67 | fin|d("or",g|
|000045a0| 72 65 65 74 69 6e 67 29 | 0a 0a 70 72 6f 64 75 63 |reeting)|..produc|
|000045b0| 65 73 20 74 68 65 20 76 | 61 6c 75 65 20 38 2e 20 |es the v|alue 8. |
|000045c0| 20 53 65 65 20 53 65 63 | 74 69 6f 6e 20 34 2e 32 | See Sec|tion 4.2|
|000045d0| 20 66 6f 72 20 74 68 65 | 20 68 61 6e 64 6c 69 6e | for the| handlin|
|000045e0| 67 20 6f 66 20 73 69 74 | 75 61 2d 0a 74 69 6f 6e |g of sit|ua-.tion|
|000045f0| 73 20 69 6e 20 77 68 69 | 63 68 20 73 31 20 64 6f |s in whi|ch s1 do|
|00004600| 00 00 00 08 00 00 04 03 | 00 00 00 0b 00 00 01 e8 |........|........|
|00004610| 00 00 00 24 6e 26 0f 5b | 65 73 20 6e 6f 74 20 6f |...$n&.[|es not o|
|00004620| 63 63 75 72 20 69 6e 20 | 73 32 2c 20 6f 72 20 69 |ccur in |s2, or i|
|00004630| 6e 20 77 68 69 63 68 20 | 69 74 20 6f 63 63 75 72 |n which |it occur|
|00004640| 73 20 61 74 0a 73 65 76 | 65 72 61 6c 20 64 69 66 |s at.sev|eral dif|
|00004650| 66 65 72 65 6e 74 20 70 | 6f 73 69 74 69 6f 6e 73 |ferent p|ositions|
|00004660| 2e 0a 0a 0a 33 2e 20 20 | 43 68 61 72 61 63 74 65 |....3. |Characte|
|00004670| 72 20 53 65 74 73 0a 0a | 20 20 20 57 68 69 6c 65 |r Sets..| While|
|00004680| 20 73 74 72 69 6e 67 73 | 20 61 72 65 20 73 65 71 | strings| are seq|
|00004690| 75 65 6e 63 65 73 20 6f | 66 20 63 68 61 72 61 63 |uences o|f charac|
|000046a0| 74 65 72 73 2c 20 63 73 | 65 74 73 20 61 72 65 20 |ters, cs|ets are |
|000046b0| 73 65 74 73 20 6f 66 0a | 63 68 61 72 61 63 74 65 |sets of.|characte|
|000046c0| 72 73 20 69 6e 20 77 68 | 69 63 68 20 6d 65 6d 62 |rs in wh|ich memb|
|000046d0| 65 72 73 68 69 70 20 72 | 61 74 68 65 72 20 74 68 |ership r|ather th|
|000046e0| 61 6e 20 6f 72 64 65 72 | 20 69 73 20 73 69 67 6e |an order| is sign|
|000046f0| 69 66 69 63 61 6e 74 2e | 0a 43 73 65 74 73 20 61 |ificant.|.Csets a|
|00004700| 72 65 20 72 65 70 72 65 | 73 65 6e 74 65 64 20 6c |re repre|sented l|
|00004710| 69 74 65 72 61 6c 6c 79 | 20 75 73 69 6e 67 20 73 |iterally| using s|
|00004720| 69 6e 67 6c 65 20 65 6e | 63 6c 6f 73 69 6e 67 20 |ingle en|closing |
|00004730| 71 75 6f 74 61 74 69 6f | 6e 0a 6d 61 72 6b 73 2c |quotatio|n.marks,|
|00004740| 20 61 73 20 69 6e 0a 0a | 20 20 20 20 20 20 20 20 | as in..| |
|00004750| 76 6f 77 65 6c 73 20 3a | 3d 20 27 61 65 69 6f 75 |vowels :|= 'aeiou|
|00004760| 41 45 49 4f 55 27 0a 0a | 54 77 6f 20 75 73 65 66 |AEIOU'..|Two usef|
|00004770| 75 6c 20 62 75 69 6c 74 | 2d 69 6e 20 63 73 65 74 |ul built|-in cset|
|00004780| 73 20 61 72 65 20 26 6c | 63 61 73 65 20 61 6e 64 |s are &l|case and|
|00004790| 20 26 75 63 61 73 65 2c | 20 77 68 69 63 68 20 63 | &ucase,| which c|
|000047a0| 6f 6e 73 69 73 74 20 6f | 66 0a 74 68 65 20 6c 6f |onsist o|f.the lo|
|000047b0| 77 65 72 63 61 73 65 20 | 61 6e 64 20 75 70 70 65 |wercase |and uppe|
|000047c0| 72 63 61 73 65 20 6c 65 | 74 74 65 72 73 2c 20 72 |rcase le|tters, r|
|000047d0| 65 73 70 65 63 74 69 76 | 65 6c 79 2e 20 20 53 65 |espectiv|ely. Se|
|000047e0| 74 20 6f 70 65 72 61 2d | 0a 74 69 6f 6e 73 20 61 |t opera-|.tions a|
|000047f0| 72 65 20 70 72 6f 76 69 | 64 65 64 20 66 6f 72 20 |re provi|ded for |
|00004800| 00 00 00 08 00 00 04 03 | 00 00 00 0c 00 00 01 e8 |........|........|
|00004810| 00 00 00 25 31 96 69 96 | 63 73 65 74 73 2e 20 46 |...%1.i.|csets. F|
|00004820| 6f 72 20 65 78 61 6d 70 | 6c 65 2c 0a 0a 0a 0a 20 |or examp|le,.... |
|00004830| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004840| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2d 20 33 | | - 3|
|00004850| 20 2d 0a 0a 0a 0a 0a 0a | 0a 0a 0a 20 20 20 20 20 | -......|... |
|00004860| 20 20 20 6c 65 74 74 65 | 72 73 20 3a 3d 20 26 6c | lette|rs := &l|
|00004870| 63 61 73 65 20 2b 2b 20 | 26 75 63 61 73 65 0a 0a |case ++ |&ucase..|
|00004880| 66 6f 72 6d 73 20 74 68 | 65 20 63 73 65 74 20 75 |forms th|e cset u|
|00004890| 6e 69 6f 6e 20 6f 66 20 | 74 68 65 20 6c 6f 77 65 |nion of |the lowe|
|000048a0| 72 63 61 73 65 20 61 6e | 64 20 75 70 70 65 72 63 |rcase an|d upperc|
|000048b0| 61 73 65 20 6c 65 74 74 | 65 72 73 20 61 6e 64 0a |ase lett|ers and.|
|000048c0| 61 73 73 69 67 6e 73 20 | 74 68 65 20 72 65 73 75 |assigns |the resu|
|000048d0| 6c 74 69 6e 67 20 63 73 | 65 74 20 74 6f 20 6c 65 |lting cs|et to le|
|000048e0| 74 74 65 72 73 2c 20 77 | 68 69 6c 65 0a 0a 20 20 |tters, w|hile.. |
|000048f0| 20 20 20 20 20 20 63 6f | 6e 73 6f 6e 61 6e 74 73 | co|nsonants|
|00004900| 20 3a 3d 20 6c 65 74 74 | 65 72 73 20 2d 2d 20 27 | := lett|ers -- '|
|00004910| 61 65 69 6f 75 41 45 49 | 4f 55 27 0a 0a 66 6f 72 |aeiouAEI|OU'..for|
|00004920| 6d 73 20 74 68 65 20 63 | 73 65 74 20 64 69 66 66 |ms the c|set diff|
|00004930| 65 72 65 6e 63 65 20 6f | 66 20 74 68 65 20 6c 65 |erence o|f the le|
|00004940| 74 74 65 72 73 20 61 6e | 64 20 74 68 65 20 76 6f |tters an|d the vo|
|00004950| 77 65 6c 73 20 61 6e 64 | 0a 61 73 73 69 67 6e 73 |wels and|.assigns|
|00004960| 20 74 68 65 20 72 65 73 | 75 6c 74 69 6e 67 20 63 | the res|ulting c|
|00004970| 73 65 74 20 74 6f 20 63 | 6f 6e 73 6f 6e 61 6e 74 |set to c|onsonant|
|00004980| 73 2e 0a 0a 20 20 20 43 | 73 65 74 73 20 61 72 65 |s... C|sets are|
|00004990| 20 75 73 65 66 75 6c 20 | 69 6e 20 73 69 74 75 61 | useful |in situa|
|000049a0| 74 69 6f 6e 73 20 69 6e | 20 77 68 69 63 68 20 61 |tions in| which a|
|000049b0| 6e 79 20 6f 6e 65 20 6f | 66 20 61 20 6e 75 6d 62 |ny one o|f a numb|
|000049c0| 65 72 20 6f 66 0a 63 68 | 61 72 61 63 74 65 72 73 |er of.ch|aracters|
|000049d0| 20 69 73 20 73 69 67 6e | 69 66 69 63 61 6e 74 2e | is sign|ificant.|
|000049e0| 20 41 6e 20 65 78 61 6d | 70 6c 65 20 69 73 20 74 | An exam|ple is t|
|000049f0| 68 65 20 73 74 72 69 6e | 67 20 61 6e 61 6c 79 73 |he strin|g analys|
|00004a00| 00 00 00 08 00 00 04 03 | 00 00 00 0d 00 00 01 e8 |........|........|
|00004a10| 00 00 00 26 37 97 6f 97 | 69 73 0a 66 75 6e 63 74 |...&7.o.|is.funct|
|00004a20| 69 6f 6e 0a 0a 20 20 20 | 20 20 20 20 20 75 70 74 |ion.. | upt|
|00004a30| 6f 28 63 2c 73 29 0a 0a | 77 68 69 63 68 20 70 72 |o(c,s)..|which pr|
|00004a40| 6f 64 75 63 65 73 20 74 | 68 65 20 70 6f 73 69 74 |oduces t|he posit|
|00004a50| 69 6f 6e 20 73 20 61 74 | 20 77 68 69 63 68 20 61 |ion s at| which a|
|00004a60| 6e 79 20 63 68 61 72 61 | 63 74 65 72 20 69 6e 20 |ny chara|cter in |
|00004a70| 63 20 6f 63 63 75 72 73 | 2e 0a 46 6f 72 20 65 78 |c occurs|..For ex|
|00004a80| 61 6d 70 6c 65 2c 0a 0a | 20 20 20 20 20 20 20 20 |ample,..| |
|00004a90| 75 70 74 6f 28 76 6f 77 | 65 6c 73 2c 67 72 65 65 |upto(vow|els,gree|
|00004aa0| 74 69 6e 67 29 0a 0a 70 | 72 6f 64 75 63 65 73 20 |ting)..p|roduces |
|00004ab0| 32 2e 20 41 6e 6f 74 68 | 65 72 20 73 74 72 69 6e |2. Anoth|er strin|
|00004ac0| 67 20 61 6e 61 6c 79 73 | 69 73 20 66 75 6e 63 74 |g analys|is funct|
|00004ad0| 69 6f 6e 20 74 68 61 74 | 20 75 73 65 73 20 63 73 |ion that| uses cs|
|00004ae0| 65 74 73 20 69 73 0a 0a | 20 20 20 20 20 20 20 20 |ets is..| |
|00004af0| 6d 61 6e 79 28 63 2c 73 | 29 0a 0a 77 68 69 63 68 |many(c,s|)..which|
|00004b00| 20 70 72 6f 64 75 63 65 | 73 20 74 68 65 20 70 6f | produce|s the po|
|00004b10| 73 69 74 69 6f 6e 20 69 | 6e 20 73 20 61 66 74 65 |sition i|n s afte|
|00004b20| 72 20 61 6e 20 69 6e 69 | 74 69 61 6c 20 73 75 62 |r an ini|tial sub|
|00004b30| 73 74 72 69 6e 67 20 63 | 6f 6e 2d 0a 73 69 73 74 |string c|on-.sist|
|00004b40| 69 6e 67 20 6f 6e 6c 79 | 20 6f 66 20 63 68 61 72 |ing only| of char|
|00004b50| 61 63 74 65 72 73 20 74 | 68 61 74 20 6f 63 63 75 |acters t|hat occu|
|00004b60| 72 20 69 6e 20 73 2e 20 | 20 41 6e 20 65 78 61 6d |r in s. | An exam|
|00004b70| 70 6c 65 20 6f 66 20 74 | 68 65 0a 75 73 65 20 6f |ple of t|he.use o|
|00004b80| 66 20 6d 61 6e 79 20 69 | 73 20 69 6e 20 6c 6f 63 |f many i|s in loc|
|00004b90| 61 74 69 6e 67 20 77 6f | 72 64 73 2e 20 53 75 70 |ating wo|rds. Sup|
|00004ba0| 70 6f 73 65 2c 20 66 6f | 72 20 65 78 61 6d 70 6c |pose, fo|r exampl|
|00004bb0| 65 2c 20 74 68 61 74 20 | 61 0a 77 6f 72 64 20 69 |e, that |a.word i|
|00004bc0| 73 20 64 65 66 69 6e 65 | 64 20 74 6f 20 63 6f 6e |s define|d to con|
|00004bd0| 73 69 73 74 20 6f 66 20 | 61 20 73 74 72 69 6e 67 |sist of |a string|
|00004be0| 20 6f 66 20 6c 65 74 74 | 65 72 73 2e 20 20 54 68 | of lett|ers. Th|
|00004bf0| 65 20 65 78 70 72 65 73 | 2d 0a 73 69 6f 6e 0a 0a |e expres|-.sion..|
|00004c00| 00 00 00 08 00 00 04 03 | 00 00 00 0e 00 00 01 e8 |........|........|
|00004c10| 00 00 00 27 3a 42 06 e6 | 20 20 20 20 20 20 20 20 |...':B..| |
|00004c20| 77 72 69 74 65 28 6c 69 | 6e 65 5b 31 3a 6d 61 6e |write(li|ne[1:man|
|00004c30| 79 28 6c 65 74 74 65 72 | 73 2c 6c 69 6e 65 29 5d |y(letter|s,line)]|
|00004c40| 29 0a 0a 77 72 69 74 65 | 73 20 61 20 77 6f 72 64 |)..write|s a word|
|00004c50| 20 61 74 20 74 68 65 20 | 62 65 67 69 6e 6e 69 6e | at the |beginnin|
|00004c60| 67 20 6f 66 20 6c 69 6e | 65 2e 20 4e 6f 74 65 20 |g of lin|e. Note |
|00004c70| 74 68 65 20 75 73 65 20 | 6f 66 20 74 68 65 20 70 |the use |of the p|
|00004c80| 6f 73 69 2d 0a 74 69 6f | 6e 20 72 65 74 75 72 6e |osi-.tio|n return|
|00004c90| 65 64 20 62 79 20 61 20 | 73 74 72 69 6e 67 20 61 |ed by a |string a|
|00004ca0| 6e 61 6c 79 73 69 73 20 | 66 75 6e 63 74 69 6f 6e |nalysis |function|
|00004cb0| 20 74 6f 20 73 70 65 63 | 69 66 79 20 74 68 65 20 | to spec|ify the |
|00004cc0| 65 6e 64 20 6f 66 0a 61 | 20 73 75 62 73 74 72 69 |end of.a| substri|
|00004cd0| 6e 67 2e 0a 0a 0a 34 2e | 20 20 45 78 70 72 65 73 |ng....4.| Expres|
|00004ce0| 73 69 6f 6e 20 45 76 61 | 6c 75 61 74 69 6f 6e 0a |sion Eva|luation.|
|00004cf0| 0a 34 2e 31 20 20 43 6f | 6e 64 69 74 69 6f 6e 61 |.4.1 Co|nditiona|
|00004d00| 6c 20 45 78 70 72 65 73 | 73 69 6f 6e 73 0a 0a 20 |l Expres|sions.. |
|00004d10| 20 20 49 6e 20 49 63 6f | 6e 20 74 68 65 72 65 20 | In Ico|n there |
|00004d20| 61 72 65 20 63 6f 6e 64 | 69 74 69 6f 6e 61 6c 20 |are cond|itional |
|00004d30| 65 78 70 72 65 73 73 69 | 6f 6e 73 20 74 68 61 74 |expressi|ons that|
|00004d40| 20 6d 61 79 20 73 75 63 | 63 65 65 64 20 61 6e 64 | may suc|ceed and|
|00004d50| 0a 70 72 6f 64 75 63 65 | 20 61 20 72 65 73 75 6c |.produce| a resul|
|00004d60| 74 2c 20 6f 72 20 6d 61 | 79 20 66 61 69 6c 20 61 |t, or ma|y fail a|
|00004d70| 6e 64 20 6e 6f 74 20 70 | 72 6f 64 75 63 65 20 61 |nd not p|roduce a|
|00004d80| 6e 79 20 72 65 73 75 6c | 74 2e 20 41 6e 0a 65 78 |ny resul|t. An.ex|
|00004d90| 61 6d 70 6c 65 20 69 73 | 20 74 68 65 20 63 6f 6d |ample is| the com|
|00004da0| 70 61 72 69 73 6f 6e 20 | 6f 70 65 72 61 74 69 6f |parison |operatio|
|00004db0| 6e 0a 0a 20 20 20 20 20 | 20 20 20 69 20 3e 20 6a |n.. | i > j|
|00004dc0| 0a 0a 77 68 69 63 68 20 | 73 75 63 63 65 65 64 73 |..which |succeeds|
|00004dd0| 20 28 61 6e 64 20 70 72 | 6f 64 75 63 65 73 20 74 | (and pr|oduces t|
|00004de0| 68 65 20 76 61 6c 75 65 | 20 6f 66 20 6a 29 20 70 |he value| of j) p|
|00004df0| 72 6f 76 69 64 65 64 20 | 74 68 61 74 20 74 68 65 |rovided |that the|
|00004e00| 00 00 00 08 00 00 04 03 | 00 00 00 0f 00 00 01 e8 |........|........|
|00004e10| 00 00 00 28 09 c9 d5 74 | 0a 76 61 6c 75 65 20 6f |...(...t|.value o|
|00004e20| 66 20 69 20 69 73 20 67 | 72 65 61 74 65 72 20 74 |f i is g|reater t|
|00004e30| 68 61 6e 20 74 68 65 20 | 76 61 6c 75 65 20 6f 66 |han the |value of|
|00004e40| 20 6a 2c 20 62 75 74 20 | 66 61 69 6c 73 20 6f 74 | j, but |fails ot|
|00004e50| 68 65 72 77 69 73 65 2e | 0a 0a 20 20 20 54 68 65 |herwise.|.. The|
|00004e60| 20 73 75 63 63 65 73 73 | 20 6f 72 20 66 61 69 6c | success| or fail|
|00004e70| 75 72 65 20 6f 66 20 63 | 6f 6e 64 69 74 69 6f 6e |ure of c|ondition|
|00004e80| 61 6c 20 6f 70 65 72 61 | 74 69 6f 6e 73 20 69 73 |al opera|tions is|
|00004e90| 20 75 73 65 64 0a 69 6e | 73 74 65 61 64 20 6f 66 | used.in|stead of|
|00004ea0| 20 42 6f 6f 6c 65 61 6e | 20 76 61 6c 75 65 73 20 | Boolean| values |
|00004eb0| 74 6f 20 64 72 69 76 65 | 20 63 6f 6e 74 72 6f 6c |to drive| control|
|00004ec0| 20 73 74 72 75 63 74 75 | 72 65 73 20 69 6e 20 49 | structu|res in I|
|00004ed0| 63 6f 6e 2e 20 41 6e 0a | 65 78 61 6d 70 6c 65 20 |con. An.|example |
|00004ee0| 69 73 0a 0a 0a 0a 20 20 | 20 20 20 20 20 20 20 20 |is.... | |
|00004ef0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004f00| 20 20 20 20 2d 20 34 20 | 2d 0a 0a 0a 0a 0a 0a 0a | - 4 |-.......|
|00004f10| 0a 0a 20 20 20 20 20 20 | 20 20 69 66 20 69 20 3e |.. | if i >|
|00004f20| 20 6a 20 74 68 65 6e 20 | 6b 20 3a 3d 20 69 20 65 | j then |k := i e|
|00004f30| 6c 73 65 20 6b 20 3a 3d | 20 6a 0a 0a 77 68 69 63 |lse k :=| j..whic|
|00004f40| 68 20 61 73 73 69 67 6e | 73 20 74 68 65 20 76 61 |h assign|s the va|
|00004f50| 6c 75 65 20 6f 66 20 69 | 20 74 6f 20 6b 20 69 66 |lue of i| to k if|
|00004f60| 20 74 68 65 20 76 61 6c | 75 65 20 6f 66 20 69 20 | the val|ue of i |
|00004f70| 69 73 20 67 72 65 61 74 | 65 72 0a 74 68 61 6e 20 |is great|er.than |
|00004f80| 74 68 65 20 76 61 6c 75 | 65 20 6f 66 20 6a 2c 20 |the valu|e of j, |
|00004f90| 62 75 74 20 61 73 73 69 | 67 6e 73 20 74 68 65 20 |but assi|gns the |
|00004fa0| 76 61 6c 75 65 20 6f 66 | 20 6a 20 74 6f 20 6b 20 |value of| j to k |
|00004fb0| 6f 74 68 65 72 77 69 73 | 65 2e 0a 0a 20 20 20 54 |otherwis|e... T|
|00004fc0| 68 65 20 75 73 65 66 75 | 6c 6e 65 73 73 20 6f 66 |he usefu|lness of|
|00004fd0| 20 74 68 65 20 63 6f 6e | 63 65 70 74 73 20 6f 66 | the con|cepts of|
|00004fe0| 20 73 75 63 63 65 73 73 | 20 61 6e 64 20 66 61 69 | success| and fai|
|00004ff0| 6c 75 72 65 20 69 73 0a | 69 6c 6c 75 73 74 72 61 |lure is.|illustra|
|00005000| 00 00 00 08 00 00 04 03 | 00 00 00 10 00 00 01 e8 |........|........|
|00005010| 00 00 00 29 f5 f8 68 36 | 74 65 64 20 62 79 20 66 |...)..h6|ted by f|
|00005020| 69 6e 64 28 73 31 2c 73 | 32 29 2c 20 77 68 69 63 |ind(s1,s|2), whic|
|00005030| 68 20 66 61 69 6c 73 20 | 69 66 20 73 31 20 64 6f |h fails |if s1 do|
|00005040| 65 73 20 6e 6f 74 20 6f | 63 63 75 72 20 61 73 20 |es not o|ccur as |
|00005050| 61 0a 73 75 62 73 74 72 | 69 6e 67 20 6f 66 20 73 |a.substr|ing of s|
|00005060| 32 2e 20 20 54 68 75 73 | 0a 0a 20 20 20 20 20 20 |2. Thus|.. |
|00005070| 20 20 69 66 20 69 20 3a | 3d 20 66 69 6e 64 28 22 | if i :|= find("|
|00005080| 6f 72 22 2c 6c 69 6e 65 | 29 20 74 68 65 6e 20 77 |or",line|) then w|
|00005090| 72 69 74 65 28 69 29 0a | 0a 77 72 69 74 65 73 20 |rite(i).|.writes |
|000050a0| 74 68 65 20 70 6f 73 69 | 74 69 6f 6e 20 61 74 20 |the posi|tion at |
|000050b0| 77 68 69 63 68 20 6f 72 | 20 6f 63 63 75 72 73 20 |which or| occurs |
|000050c0| 69 6e 20 6c 69 6e 65 2c | 20 69 66 20 69 74 20 6f |in line,| if it o|
|000050d0| 63 63 75 72 73 2c 20 62 | 75 74 0a 64 6f 65 73 20 |ccurs, b|ut.does |
|000050e0| 6e 6f 74 20 77 72 69 74 | 65 20 61 20 76 61 6c 75 |not writ|e a valu|
|000050f0| 65 20 69 66 20 69 74 20 | 64 6f 65 73 20 6e 6f 74 |e if it |does not|
|00005100| 20 6f 63 63 75 72 2e 0a | 0a 20 20 20 4d 61 6e 79 | occur..|. Many|
|00005110| 20 65 78 70 72 65 73 73 | 69 6f 6e 73 20 69 6e 20 | express|ions in |
|00005120| 49 63 6f 6e 20 61 72 65 | 20 63 6f 6e 64 69 74 69 |Icon are| conditi|
|00005130| 6f 6e 61 6c 2e 20 41 6e | 20 65 78 61 6d 70 6c 65 |onal. An| example|
|00005140| 20 69 73 0a 72 65 61 64 | 28 29 2c 20 77 68 69 63 | is.read|(), whic|
|00005150| 68 20 70 72 6f 64 75 63 | 65 73 20 74 68 65 20 6e |h produc|es the n|
|00005160| 65 78 74 20 6c 69 6e 65 | 20 66 72 6f 6d 20 74 68 |ext line| from th|
|00005170| 65 20 69 6e 70 75 74 20 | 66 69 6c 65 2c 20 62 75 |e input |file, bu|
|00005180| 74 0a 66 61 69 6c 73 20 | 77 68 65 6e 20 74 68 65 |t.fails |when the|
|00005190| 20 65 6e 64 20 6f 66 20 | 74 68 65 20 66 69 6c 65 | end of |the file|
|000051a0| 20 69 73 20 72 65 61 63 | 68 65 64 2e 20 54 68 65 | is reac|hed. The|
|000051b0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 65 78 70 72 65 | followi|ng expre|
|000051c0| 73 2d 0a 73 69 6f 6e 20 | 69 73 20 74 79 70 69 63 |s-.sion |is typic|
|000051d0| 61 6c 20 6f 66 20 70 72 | 6f 67 72 61 6d 6d 69 6e |al of pr|ogrammin|
|000051e0| 67 20 69 6e 20 49 63 6f | 6e 20 61 6e 64 20 69 6c |g in Ico|n and il|
|000051f0| 6c 75 73 74 72 61 74 65 | 73 20 74 68 65 0a 69 6e |lustrate|s the.in|
|00005200| 00 00 00 08 00 00 04 03 | 00 00 00 11 00 00 01 e8 |........|........|
|00005210| 00 00 00 2a d2 b2 58 0b | 74 65 67 72 61 74 69 6f |...*..X.|tegratio|
|00005220| 6e 20 6f 66 20 63 6f 6e | 64 69 74 69 6f 6e 61 6c |n of con|ditional|
|00005230| 20 65 78 70 72 65 73 73 | 69 6f 6e 73 20 61 6e 64 | express|ions and|
|00005240| 20 63 6f 6e 76 65 6e 74 | 69 6f 6e 61 6c 20 63 6f | convent|ional co|
|00005250| 6e 74 72 6f 6c 0a 73 74 | 72 75 63 74 75 72 65 73 |ntrol.st|ructures|
|00005260| 3a 0a 0a 20 20 20 20 20 | 20 20 20 77 68 69 6c 65 |:.. | while|
|00005270| 20 6c 69 6e 65 20 3a 3d | 20 72 65 61 64 28 29 20 | line :=| read() |
|00005280| 64 6f 0a 20 20 20 20 20 | 20 20 20 20 20 20 77 72 |do. | wr|
|00005290| 69 74 65 28 6c 69 6e 65 | 29 0a 0a 54 68 69 73 20 |ite(line|)..This |
|000052a0| 65 78 70 72 65 73 73 69 | 6f 6e 20 63 6f 70 69 65 |expressi|on copie|
|000052b0| 73 20 74 68 65 20 69 6e | 70 75 74 20 66 69 6c 65 |s the in|put file|
|000052c0| 20 74 6f 20 74 68 65 20 | 6f 75 74 70 75 74 20 66 | to the |output f|
|000052d0| 69 6c 65 2e 0a 0a 20 20 | 20 49 66 20 61 6e 20 61 |ile... | If an a|
|000052e0| 72 67 75 6d 65 6e 74 20 | 6f 66 20 61 20 66 75 6e |rgument |of a fun|
|000052f0| 63 74 69 6f 6e 20 66 61 | 69 6c 73 2c 20 74 68 65 |ction fa|ils, the|
|00005300| 20 66 75 6e 63 74 69 6f | 6e 20 69 73 20 6e 6f 74 | functio|n is not|
|00005310| 0a 63 61 6c 6c 65 64 2c | 20 61 6e 64 20 74 68 65 |.called,| and the|
|00005320| 20 66 75 6e 63 74 69 6f | 6e 20 63 61 6c 6c 20 66 | functio|n call f|
|00005330| 61 69 6c 73 20 61 73 20 | 77 65 6c 6c 2e 20 54 68 |ails as |well. Th|
|00005340| 69 73 20 22 69 6e 68 65 | 72 69 74 61 6e 63 65 22 |is "inhe|ritance"|
|00005350| 0a 6f 66 20 66 61 69 6c | 75 72 65 20 61 6c 6c 6f |.of fail|ure allo|
|00005360| 77 73 20 74 68 65 20 63 | 6f 6e 63 69 73 65 20 66 |ws the c|oncise f|
|00005370| 6f 72 6d 75 6c 61 74 69 | 6f 6e 20 6f 66 20 6d 61 |ormulati|on of ma|
|00005380| 6e 79 20 70 72 6f 67 72 | 61 6d 6d 69 6e 67 0a 74 |ny progr|amming.t|
|00005390| 61 73 6b 73 2e 20 4f 6d | 69 74 74 69 6e 67 20 74 |asks. Om|itting t|
|000053a0| 68 65 20 6f 70 74 69 6f | 6e 61 6c 20 64 6f 20 63 |he optio|nal do c|
|000053b0| 6c 61 75 73 65 20 69 6e | 20 77 68 69 6c 65 2d 64 |lause in| while-d|
|000053c0| 6f 2c 20 74 68 65 20 70 | 72 65 76 69 6f 75 73 0a |o, the p|revious.|
|000053d0| 65 78 70 72 65 73 73 69 | 6f 6e 20 63 61 6e 20 62 |expressi|on can b|
|000053e0| 65 20 72 65 77 72 69 74 | 74 65 6e 20 61 73 0a 0a |e rewrit|ten as..|
|000053f0| 20 20 20 20 20 20 20 20 | 77 68 69 6c 65 20 77 72 | |while wr|
|00005400| 00 00 00 08 00 00 04 03 | 00 00 00 12 00 00 01 e8 |........|........|
|00005410| 00 00 00 2b 60 ef 56 36 | 69 74 65 28 72 65 61 64 |...+`.V6|ite(read|
|00005420| 28 29 29 0a 0a 0a 34 2e | 32 20 20 47 65 6e 65 72 |())...4.|2 Gener|
|00005430| 61 74 6f 72 73 0a 0a 20 | 20 20 49 6e 20 73 6f 6d |ators.. | In som|
|00005440| 65 20 73 69 74 75 61 74 | 69 6f 6e 73 2c 20 61 6e |e situat|ions, an|
|00005450| 20 65 78 70 72 65 73 73 | 69 6f 6e 20 6d 61 79 20 | express|ion may |
|00005460| 62 65 20 63 61 70 61 62 | 6c 65 20 6f 66 20 70 72 |be capab|le of pr|
|00005470| 6f 64 75 63 69 6e 67 0a | 6d 6f 72 65 20 74 68 61 |oducing.|more tha|
|00005480| 6e 20 6f 6e 65 20 72 65 | 73 75 6c 74 2e 20 43 6f |n one re|sult. Co|
|00005490| 6e 73 69 64 65 72 0a 0a | 20 20 20 20 20 20 20 20 |nsider..| |
|000054a0| 73 65 6e 74 65 6e 63 65 | 20 3a 3d 20 22 53 74 6f |sentence| := "Sto|
|000054b0| 72 65 20 69 74 20 69 6e | 20 74 68 65 20 6e 65 69 |re it in| the nei|
|000054c0| 67 68 62 6f 72 69 6e 67 | 20 68 61 72 62 6f 72 22 |ghboring| harbor"|
|000054d0| 0a 20 20 20 20 20 20 20 | 20 66 69 6e 64 28 22 6f |. | find("o|
|000054e0| 72 22 2c 73 65 6e 74 65 | 6e 63 65 29 0a 0a 48 65 |r",sente|nce)..He|
|000054f0| 72 65 20 6f 72 20 6f 63 | 63 75 72 73 20 69 6e 20 |re or oc|curs in |
|00005500| 73 65 6e 74 65 6e 63 65 | 20 61 74 20 70 6f 73 69 |sentence| at posi|
|00005510| 74 69 6f 6e 73 20 33 2c | 20 32 33 2c 20 61 6e 64 |tions 3,| 23, and|
|00005520| 20 33 33 2e 20 4d 6f 73 | 74 20 70 72 6f 2d 0a 67 | 33. Mos|t pro-.g|
|00005530| 72 61 6d 6d 69 6e 67 20 | 6c 61 6e 67 75 61 67 65 |ramming |language|
|00005540| 73 20 74 72 65 61 74 20 | 74 68 69 73 20 73 69 74 |s treat |this sit|
|00005550| 75 61 74 69 6f 6e 20 62 | 79 20 73 65 6c 65 63 74 |uation b|y select|
|00005560| 69 6e 67 20 6f 6e 65 20 | 6f 66 20 74 68 65 0a 70 |ing one |of the.p|
|00005570| 6f 73 69 74 69 6f 6e 73 | 2c 20 73 75 63 68 20 61 |ositions|, such a|
|00005580| 73 20 74 68 65 20 66 69 | 72 73 74 2c 20 61 73 20 |s the fi|rst, as |
|00005590| 74 68 65 20 72 65 73 75 | 6c 74 20 6f 66 20 74 68 |the resu|lt of th|
|000055a0| 65 20 65 78 70 72 65 73 | 73 69 6f 6e 2e 20 49 6e |e expres|sion. In|
|000055b0| 0a 49 63 6f 6e 2c 20 73 | 75 63 68 20 61 6e 20 65 |.Icon, s|uch an e|
|000055c0| 78 70 72 65 73 73 69 6f | 6e 20 69 73 20 61 20 67 |xpressio|n is a g|
|000055d0| 65 6e 65 72 61 74 6f 72 | 20 61 6e 64 20 69 73 20 |enerator| and is |
|000055e0| 63 61 70 61 62 6c 65 20 | 6f 66 20 70 72 6f 64 75 |capable |of produ|
|000055f0| 63 2d 0a 69 6e 67 20 61 | 6c 6c 20 74 68 72 65 65 |c-.ing a|ll three|
|00005600| 00 00 00 08 00 00 04 03 | 00 00 00 13 00 00 01 e8 |........|........|
|00005610| 00 00 00 16 48 df 2c 06 | 20 70 6f 73 69 74 69 6f |....H.,.| positio|
|00005620| 6e 73 2e 0a 0a 20 20 20 | 54 68 65 20 72 65 73 75 |ns... |The resu|
|00005630| 6c 74 73 20 74 68 61 74 | 20 61 20 67 65 6e 65 72 |lts that| a gener|
|00005640| 61 74 6f 72 20 70 72 6f | 64 75 63 65 73 20 64 65 |ator pro|duces de|
|00005650| 70 65 6e 64 20 6f 6e 20 | 63 6f 6e 74 65 78 74 2e |pend on |context.|
|00005660| 20 49 6e 20 61 0a 73 69 | 74 75 61 74 69 6f 6e 20 | In a.si|tuation |
|00005670| 77 68 65 72 65 20 6f 6e | 6c 79 20 6f 6e 65 20 72 |where on|ly one r|
|00005680| 65 73 75 6c 74 20 69 73 | 20 6e 65 65 64 65 64 2c |esult is| needed,|
|00005690| 20 74 68 65 20 66 69 72 | 73 74 20 69 73 20 70 72 | the fir|st is pr|
|000056a0| 6f 64 75 63 65 64 2c 0a | 61 73 20 69 6e 0a 0a 0a |oduced,.|as in...|
|000056b0| 0a 0a 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |... | |
|000056c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000056d0| 20 2d 20 35 20 2d 0a 0a | 0a 0a 0a 0a 0a 0a 0a 20 | - 5 -..|....... |
|000056e0| 20 20 20 20 20 20 20 69 | 20 3a 3d 20 66 69 6e 64 | i| := find|
|000056f0| 28 22 6f 72 22 2c 73 65 | 6e 74 65 6e 63 65 29 0a |("or",se|ntence).|
|00005700| 0a 77 68 69 63 68 20 61 | 73 73 69 67 6e 73 20 74 |.which a|ssigns t|
|00005710| 68 65 20 76 61 6c 75 65 | 20 33 20 74 6f 20 69 2e |he value| 3 to i.|
|00005720| 0a 0a 20 20 20 49 66 20 | 74 68 65 20 72 65 73 75 |.. If |the resu|
|00005730| 6c 74 20 70 72 6f 64 75 | 63 65 64 20 62 79 20 61 |lt produ|ced by a|
|00005740| 20 67 65 6e 65 72 61 74 | 6f 72 20 64 6f 65 73 20 | generat|or does |
|00005750| 6e 6f 74 20 6c 65 61 64 | 20 74 6f 20 74 68 65 0a |not lead| to the.|
|00005760| 73 75 63 63 65 73 73 20 | 6f 66 20 61 6e 20 65 6e |success |of an en|
|00005770| 63 6c 6f 73 69 6e 67 20 | 65 78 70 72 65 73 73 69 |closing |expressi|
|00005780| 6f 6e 2c 20 68 6f 77 65 | 76 65 72 2c 20 74 68 65 |on, howe|ver, the|
|00005790| 20 67 65 6e 65 72 61 74 | 6f 72 20 69 73 0a 72 65 | generat|or is.re|
|000057a0| 73 75 6d 65 64 20 74 6f | 20 70 72 6f 64 75 63 65 |sumed to| produce|
|000057b0| 20 61 6e 6f 74 68 65 72 | 20 76 61 6c 75 65 2e 20 | another| value. |
|000057c0| 41 6e 20 65 78 61 6d 70 | 6c 65 20 69 73 0a 0a 20 |An examp|le is.. |
|000057d0| 20 20 20 20 20 20 20 69 | 66 20 28 69 20 3a 3d 20 | i|f (i := |
|000057e0| 66 69 6e 64 28 22 6f 72 | 22 2c 73 65 6e 74 65 6e |find("or|",senten|
|000057f0| 63 65 29 29 20 3e 20 35 | 20 74 68 65 6e 20 77 72 |ce)) > 5| then wr|
|00005800| 00 00 00 08 00 00 03 dc | 00 00 00 3a 00 00 01 e8 |........|...:....|
|00005810| 00 00 00 2d f2 4c 4c 1f | 20 20 20 20 20 20 20 20 |...-.LL.| |
|00005820| 20 20 20 20 20 20 20 32 | 30 34 20 20 20 20 20 72 | 2|04 r|
|00005830| 65 61 6c 20 6f 76 65 72 | 66 6c 6f 77 20 75 6e 64 |eal over|flow und|
|00005840| 65 72 66 6c 6f 77 20 6f | 72 20 64 69 76 69 73 69 |erflow o|r divisi|
|00005850| 6f 6e 20 62 79 20 7a 65 | 72 6f 0a 20 20 20 20 20 |on by ze|ro. |
|00005860| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005870| 20 32 30 35 20 20 20 20 | 20 76 61 6c 75 65 20 6f | 205 | value o|
|00005880| 75 74 20 6f 66 20 72 61 | 6e 67 65 0a 20 20 20 20 |ut of ra|nge. |
|00005890| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000058a0| 20 20 32 30 36 20 20 20 | 20 20 6e 65 67 61 74 69 | 206 | negati|
|000058b0| 76 65 20 66 69 72 73 74 | 20 6f 70 65 72 61 6e 64 |ve first| operand|
|000058c0| 20 74 6f 20 72 65 61 6c | 20 65 78 70 6f 6e 65 6e | to real| exponen|
|000058d0| 74 69 61 74 69 6f 6e 0a | 20 20 20 20 20 20 20 20 |tiation.| |
|000058e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 32 30 | | 20|
|000058f0| 37 20 20 20 20 20 69 6e | 76 61 6c 69 64 20 66 69 |7 in|valid fi|
|00005900| 65 6c 64 20 6e 61 6d 65 | 0a 20 20 20 20 20 20 20 |eld name|. |
|00005910| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 32 | | 2|
|00005920| 30 38 20 20 20 20 20 73 | 65 63 6f 6e 64 20 61 6e |08 s|econd an|
|00005930| 64 20 74 68 69 72 64 20 | 61 72 67 75 6d 65 6e 74 |d third |argument|
|00005940| 73 20 74 6f 20 6d 61 70 | 20 6f 66 20 75 6e 65 71 |s to map| of uneq|
|00005950| 75 61 6c 20 6c 65 6e 67 | 74 68 0a 20 20 20 20 20 |ual leng|th. |
|00005960| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005970| 20 32 30 39 20 20 20 20 | 20 69 6e 76 61 6c 69 64 | 209 | invalid|
|00005980| 20 73 65 63 6f 6e 64 20 | 61 72 67 75 6d 65 6e 74 | second |argument|
|00005990| 20 74 6f 20 6f 70 65 6e | 0a 20 20 20 20 20 20 20 | to open|. |
|000059a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 32 | | 2|
|000059b0| 31 30 20 20 20 20 20 61 | 72 67 75 6d 65 6e 74 20 |10 a|rgument |
|000059c0| 74 6f 20 73 79 73 74 65 | 6d 20 66 75 6e 63 74 69 |to syste|m functi|
|000059d0| 6f 6e 20 74 6f 6f 20 6c | 6f 6e 67 0a 20 20 20 20 |on too l|ong. |
|000059e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000059f0| 20 20 32 31 31 20 20 20 | 20 20 62 79 20 63 6c 61 | 211 | by cla|
|00005a00| 00 00 00 08 00 00 03 dc | 00 00 00 3b 00 00 01 e8 |........|...;....|
|00005a10| 00 00 00 2e b4 24 a9 3d | 75 73 65 20 65 71 75 61 |.....$.=|use equa|
|00005a20| 6c 20 74 6f 20 7a 65 72 | 6f 0a 20 20 20 20 20 20 |l to zer|o. |
|00005a30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005a40| 32 31 32 20 20 20 20 20 | 61 74 74 65 6d 70 74 20 |212 |attempt |
|00005a50| 74 6f 20 72 65 61 64 20 | 66 69 6c 65 20 6e 6f 74 |to read |file not|
|00005a60| 20 6f 70 65 6e 20 66 6f | 72 20 72 65 61 64 69 6e | open fo|r readin|
|00005a70| 67 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |g. | |
|00005a80| 20 20 20 20 20 20 20 20 | 32 31 33 20 20 20 20 20 | |213 |
|00005a90| 61 74 74 65 6d 70 74 20 | 74 6f 20 77 72 69 74 65 |attempt |to write|
|00005aa0| 20 66 69 6c 65 20 6e 6f | 74 20 6f 70 65 6e 20 66 | file no|t open f|
|00005ab0| 6f 72 20 77 72 69 74 69 | 6e 67 0a 20 20 20 20 20 |or writi|ng. |
|00005ac0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005ad0| 20 32 31 34 20 20 20 20 | 20 72 65 63 75 72 73 69 | 214 | recursi|
|00005ae0| 76 65 20 63 6f 2d 65 78 | 70 72 65 73 73 69 6f 6e |ve co-ex|pression|
|00005af0| 20 61 63 74 69 76 61 74 | 69 6f 6e 0a 0a 20 20 20 | activat|ion.. |
|00005b00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005b10| 20 20 20 33 30 31 20 20 | 20 20 20 69 6e 74 65 72 | 301 | inter|
|00005b20| 70 72 65 74 65 72 20 73 | 74 61 63 6b 20 6f 76 65 |preter s|tack ove|
|00005b30| 72 66 6c 6f 77 0a 20 20 | 20 20 20 20 20 20 20 20 |rflow. | |
|00005b40| 20 20 20 20 20 20 20 20 | 20 20 20 20 33 30 32 20 | | 302 |
|00005b50| 20 20 20 20 43 20 73 74 | 61 63 6b 20 6f 76 65 72 | C st|ack over|
|00005b60| 66 6c 6f 77 0a 20 20 20 | 20 20 20 20 20 20 20 20 |flow. | |
|00005b70| 20 20 20 20 20 20 20 20 | 20 20 20 33 30 33 20 20 | | 303 |
|00005b80| 20 20 20 75 6e 61 62 6c | 65 20 74 6f 20 65 78 70 | unabl|e to exp|
|00005b90| 61 6e 64 20 6d 65 6d 6f | 72 79 20 72 65 67 69 6f |and memo|ry regio|
|00005ba0| 6e 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |n. | |
|00005bb0| 20 20 20 20 20 20 20 20 | 33 30 34 20 20 20 20 20 | |304 |
|00005bc0| 6d 65 6d 6f 72 79 20 72 | 65 67 69 6f 6e 20 73 69 |memory r|egion si|
|00005bd0| 7a 65 20 63 68 61 6e 67 | 65 64 0a 0a 0a 0a 0a 0a |ze chang|ed......|
|00005be0| 0a 0a 0a 0a 0a 0a 0a 20 | 20 20 20 20 20 20 20 20 |....... | |
|00005bf0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005c00| 00 00 00 08 00 00 03 dc | 00 00 00 3c 00 00 00 12 |........|...<....|
|00005c10| 00 00 00 00 0b 59 53 34 | 20 20 20 20 20 20 20 20 |.....YS4| |
|00005c20| 2d 20 31 34 20 2d 0a 0a | 0a 1a 20 20 20 20 20 72 |- 14 -..|.. r|
|00005c30| 65 61 6c 20 6f 76 65 72 | 66 6c 6f 77 20 75 6e 64 |eal over|flow und|
|00005c40| 65 72 66 6c 6f 77 20 6f | 72 20 64 69 76 69 73 69 |erflow o|r divisi|
|00005c50| 6f 6e 20 62 79 20 7a 65 | 72 6f 0a 20 20 20 20 20 |on by ze|ro. |
|00005c60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005c70| 20 32 30 35 20 20 20 20 | 20 76 61 6c 75 65 20 6f | 205 | value o|
|00005c80| 75 74 20 6f 66 20 72 61 | 6e 67 65 0a 20 20 20 20 |ut of ra|nge. |
|00005c90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005ca0| 20 20 32 30 36 20 20 20 | 20 20 6e 65 67 61 74 69 | 206 | negati|
|00005cb0| 76 65 20 66 69 72 73 74 | 20 6f 70 65 72 61 6e 64 |ve first| operand|
|00005cc0| 20 74 6f 20 72 65 61 6c | 20 65 78 70 6f 6e 65 6e | to real| exponen|
|00005cd0| 74 69 61 74 69 6f 6e 0a | 20 20 20 20 20 20 20 20 |tiation.| |
|00005ce0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 32 30 | | 20|
|00005cf0| 37 20 20 20 20 20 69 6e | 76 61 6c 69 64 20 66 69 |7 in|valid fi|
|00005d00| 65 6c 64 20 6e 61 6d 65 | 0a 20 20 20 20 20 20 20 |eld name|. |
|00005d10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 32 | | 2|
|00005d20| 30 38 20 20 20 20 20 73 | 65 63 6f 6e 64 20 61 6e |08 s|econd an|
|00005d30| 64 20 74 68 69 72 64 20 | 61 72 67 75 6d 65 6e 74 |d third |argument|
|00005d40| 73 20 74 6f 20 6d 61 70 | 20 6f 66 20 75 6e 65 71 |s to map| of uneq|
|00005d50| 75 61 6c 20 6c 65 6e 67 | 74 68 0a 20 20 20 20 20 |ual leng|th. |
|00005d60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005d70| 20 32 30 39 20 20 20 20 | 20 69 6e 76 61 6c 69 64 | 209 | invalid|
|00005d80| 20 73 65 63 6f 6e 64 20 | 61 72 67 75 6d 65 6e 74 | second |argument|
|00005d90| 20 74 6f 20 6f 70 65 6e | 0a 20 20 20 20 20 20 20 | to open|. |
|00005da0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 32 | | 2|
|00005db0| 31 30 20 20 20 20 20 61 | 72 67 75 6d 65 6e 74 20 |10 a|rgument |
|00005dc0| 74 6f 20 73 79 73 74 65 | 6d 20 66 75 6e 63 74 69 |to syste|m functi|
|00005dd0| 6f 6e 20 74 6f 6f 20 6c | 6f 6e 67 0a 20 20 20 20 |on too l|ong. |
|00005de0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005df0| 20 20 32 31 31 20 20 20 | 20 20 62 79 20 63 6c 61 | 211 | by cla|
|00005e00| 00 00 00 08 00 00 04 03 | 00 00 00 07 00 00 01 e8 |........|........|
|00005e10| 00 00 00 31 92 e2 d0 15 | 74 72 69 6e 67 20 74 6f |...1....|tring to|
|00005e20| 20 67 72 65 65 74 69 6e | 67 2c 20 61 6e 64 0a 0a | greetin|g, and..|
|00005e30| 20 20 20 20 20 20 20 20 | 61 64 64 72 65 73 73 20 | |address |
|00005e40| 3a 3d 20 22 22 0a 0a 77 | 68 69 63 68 20 61 73 73 |:= ""..w|hich ass|
|00005e50| 69 67 6e 73 20 74 68 65 | 20 7a 65 72 6f 2d 6c 65 |igns the| zero-le|
|00005e60| 6e 67 74 68 20 65 6d 70 | 74 79 20 73 74 72 69 6e |ngth emp|ty strin|
|00005e70| 67 20 74 6f 20 61 64 64 | 72 65 73 73 2e 20 20 54 |g to add|ress. T|
|00005e80| 68 65 0a 6e 75 6d 62 65 | 72 20 6f 66 20 63 68 61 |he.numbe|r of cha|
|00005e90| 72 61 63 74 65 72 73 20 | 69 6e 20 61 20 73 74 72 |racters |in a str|
|00005ea0| 69 6e 67 20 73 2c 20 69 | 74 73 20 73 69 7a 65 2c |ing s, i|ts size,|
|00005eb0| 20 69 73 20 67 69 76 65 | 6e 20 62 79 20 2a 73 2e | is give|n by *s.|
|00005ec0| 20 46 6f 72 0a 65 78 61 | 6d 70 6c 65 2c 20 2a 67 | For.exa|mple, *g|
|00005ed0| 72 65 65 74 69 6e 67 20 | 69 73 20 31 31 20 61 6e |reeting |is 11 an|
|00005ee0| 64 20 2a 61 64 64 72 65 | 73 73 20 69 73 20 30 2e |d *addre|ss is 0.|
|00005ef0| 0a 0a 20 20 20 49 63 6f | 6e 20 75 73 65 73 20 74 |.. Ico|n uses t|
|00005f00| 68 65 20 41 53 43 49 49 | 20 63 68 61 72 61 63 74 |he ASCII| charact|
|00005f10| 65 72 20 73 65 74 2c 20 | 65 78 74 65 6e 64 65 64 |er set, |extended|
|00005f20| 20 74 6f 20 32 35 36 20 | 63 68 61 72 61 63 74 65 | to 256 |characte|
|00005f30| 72 73 2e 0a 54 68 65 72 | 65 20 61 72 65 20 65 73 |rs..Ther|e are es|
|00005f40| 63 61 70 65 20 63 6f 6e | 76 65 6e 74 69 6f 6e 73 |cape con|ventions|
|00005f50| 2c 20 73 69 6d 69 6c 61 | 72 20 74 6f 20 74 68 6f |, simila|r to tho|
|00005f60| 73 65 20 6f 66 20 43 2c | 20 66 6f 72 0a 72 65 70 |se of C,| for.rep|
|00005f70| 72 65 73 65 6e 74 69 6e | 67 20 63 68 61 72 61 63 |resentin|g charac|
|00005f80| 74 65 72 73 20 74 68 61 | 74 20 63 61 6e 6e 6f 74 |ters tha|t cannot|
|00005f90| 20 62 65 20 6b 65 79 62 | 6f 61 72 64 65 64 2e 0a | be keyb|oarded..|
|00005fa0| 0a 20 20 20 53 74 72 69 | 6e 67 73 20 61 6c 73 6f |. Stri|ngs also|
|00005fb0| 20 63 61 6e 20 62 65 20 | 72 65 61 64 20 69 6e 20 | can be |read in |
|00005fc0| 61 6e 64 20 77 72 69 74 | 74 65 6e 20 6f 75 74 2c |and writ|ten out,|
|00005fd0| 20 61 73 20 69 6e 0a 0a | 20 20 20 20 20 20 20 20 | as in..| |
|00005fe0| 6c 69 6e 65 20 3a 3d 20 | 72 65 61 64 28 29 0a 0a |line := |read()..|
|00005ff0| 61 6e 64 0a 0a 20 20 20 | 20 20 20 20 20 77 72 69 |and.. | wri|
|00006000| 00 00 00 08 00 00 04 01 | 00 00 00 02 00 00 00 b5 |........|........|
|00006010| 00 00 00 00 5f cb f0 b7 | 6f 28 73 31 5b 6a 5d 2c |...._...|o(s1[j],|
|00006020| 73 32 29 20 64 6f 0a 20 | 20 20 20 20 20 20 20 20 |s2) do. | |
|00006030| 78 70 72 69 6e 74 28 73 | 31 2c 73 32 2c 6a 2c 6b |xprint(s|1,s2,j,k|
|00006040| 29 0a 65 6e 64 0a 0a 70 | 72 6f 63 65 64 75 72 65 |).end..p|rocedure|
|00006050| 20 78 70 72 69 6e 74 28 | 73 31 2c 73 32 2c 6a 2c | xprint(|s1,s2,j,|
|00006060| 6b 29 0a 20 20 20 77 72 | 69 74 65 28 29 0a 20 20 |k). wr|ite(). |
|00006070| 20 65 76 65 72 79 20 77 | 72 69 74 65 28 72 69 67 | every w|rite(rig|
|00006080| 68 74 28 73 32 5b 31 20 | 74 6f 20 6b 2d 31 5d 2c |ht(s2[1 |to k-1],|
|00006090| 6a 29 29 0a 20 20 20 77 | 72 69 74 65 28 73 31 29 |j)). w|rite(s1)|
|000060a0| 0a 20 20 20 65 76 65 72 | 79 20 77 72 69 74 65 28 |. ever|y write(|
|000060b0| 72 69 67 68 74 28 73 32 | 5b 6b 2b 31 20 74 6f 20 |right(s2|[k+1 to |
|000060c0| 2a 73 32 5d 2c 6a 29 29 | 0a 65 6e 64 0a 00 00 4f |*s2],j))|.end...O|
|000060d0| 00 00 00 4e 00 00 00 4d | 00 00 00 62 00 00 00 61 |...N...M|...b...a|
|000060e0| 00 00 00 60 00 00 00 5f | 00 00 00 5e 00 00 00 5d |...`..._|...^...]|
|000060f0| 00 00 00 5c 00 00 00 5b | 00 00 00 5a 00 00 00 59 |...\...[|...Z...Y|
|00006100| 00 00 00 58 00 00 00 6d | 00 00 00 6c 00 00 00 6b |...X...m|...l...k|
|00006110| 00 00 00 6a 00 00 00 69 | 00 00 03 fe 00 00 03 fd |...j...i|........|
|00006120| 00 00 03 fc 00 00 03 fb | 00 00 03 fa 00 00 03 f9 |........|........|
|00006130| 00 00 03 f8 00 00 03 f7 | 00 00 00 00 00 00 00 00 |........|........|
|00006140| 00 00 00 00 00 00 70 8a | 00 00 00 00 00 00 00 00 |......p.|........|
|00006150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006180| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00006190| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061a0| 00 00 00 00 00 00 0f 13 | 00 00 00 2a 00 00 04 dc |........|...*....|
|000061b0| 0c 76 65 72 73 69 6f 6e | 36 2e 64 6f 63 00 00 00 |.version|6.doc...|
|000061c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000061f0| 00 00 00 00 00 00 03 d3 | 00 00 00 00 ff ff ff fd |........|........|
|00006200| 00 00 00 08 00 00 04 03 | 00 00 00 08 00 00 01 e8 |........|........|
|00006210| 00 00 00 21 b1 ca e0 4f | 74 65 28 6c 69 6e 65 29 |...!...O|te(line)|
|00006220| 0a 0a 53 74 72 69 6e 67 | 73 20 63 61 6e 20 62 65 |..String|s can be|
|00006230| 20 63 6f 6e 73 74 72 75 | 63 74 65 64 20 62 79 20 | constru|cted by |
|00006240| 63 6f 6e 63 61 74 65 6e | 61 74 69 6f 6e 2c 20 61 |concaten|ation, a|
|00006250| 73 20 69 6e 0a 0a 20 20 | 20 20 20 20 20 20 65 6c |s in.. | el|
|00006260| 65 6d 65 6e 74 20 3a 3d | 20 22 28 22 20 7c 7c 20 |ement :=| "(" || |
|00006270| 72 65 61 64 28 29 20 7c | 7c 20 22 29 22 0a 0a 49 |read() ||| ")"..I|
|00006280| 66 20 74 68 65 20 63 6f | 6e 63 61 74 65 6e 61 74 |f the co|ncatenat|
|00006290| 69 6f 6e 20 6f 66 20 61 | 20 6e 75 6d 62 65 72 20 |ion of a| number |
|000062a0| 6f 66 20 73 74 72 69 6e | 67 73 20 69 73 20 74 6f |of strin|gs is to|
|000062b0| 20 62 65 20 77 72 69 74 | 74 65 6e 20 6f 75 74 2c | be writ|ten out,|
|000062c0| 0a 74 68 65 20 77 72 69 | 74 65 20 66 75 6e 63 74 |.the wri|te funct|
|000062d0| 69 6f 6e 20 63 61 6e 20 | 62 65 20 75 73 65 64 20 |ion can |be used |
|000062e0| 77 69 74 68 20 73 65 76 | 65 72 61 6c 20 61 72 67 |with sev|eral arg|
|000062f0| 75 6d 65 6e 74 73 20 74 | 6f 20 61 76 6f 69 64 0a |uments t|o avoid.|
|00006300| 61 63 74 75 61 6c 20 63 | 6f 6e 63 61 74 65 6e 61 |actual c|oncatena|
|00006310| 74 69 6f 6e 3a 0a 0a 20 | 20 20 20 20 20 20 20 77 |tion:.. | w|
|00006320| 72 69 74 65 28 22 28 22 | 2c 72 65 61 64 28 29 2c |rite("("|,read(),|
|00006330| 22 29 22 29 0a 0a 0a 0a | 0a 20 20 20 20 20 20 20 |")")....|. |
|00006340| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00006350| 20 20 20 20 20 20 20 2d | 20 32 20 2d 0a 0a 0a 0a | -| 2 -....|
|00006360| 0a 0a 0a 0a 0a 20 20 20 | 53 75 62 73 74 72 69 6e |..... |Substrin|
|00006370| 67 73 20 63 61 6e 20 62 | 65 20 66 6f 72 6d 65 64 |gs can b|e formed|
|00006380| 20 62 79 20 73 75 62 73 | 63 72 69 70 74 69 6e 67 | by subs|cripting|
|00006390| 20 73 74 72 69 6e 67 73 | 20 77 69 74 68 20 72 61 | strings| with ra|
|000063a0| 6e 67 65 0a 73 70 65 63 | 69 66 69 63 61 74 69 6f |nge.spec|ificatio|
|000063b0| 6e 73 20 74 68 61 74 20 | 69 6e 64 69 63 61 74 65 |ns that |indicate|
|000063c0| 2c 20 62 79 20 70 6f 73 | 69 74 69 6f 6e 2c 20 74 |, by pos|ition, t|
|000063d0| 68 65 20 64 65 73 69 72 | 65 64 20 72 61 6e 67 65 |he desir|ed range|
|000063e0| 20 6f 66 0a 63 68 61 72 | 61 63 74 65 72 73 2e 20 | of.char|acters. |
|000063f0| 46 6f 72 20 65 78 61 6d | 70 6c 65 2c 0a 0a 20 20 |For exam|ple,.. |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.