home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-1.iso / Files / Educ / Calc / MathPad 2.35.sit / Programming < prev    next >
MacBinary  |  1994-06-20  |  6.6 KB  |  [TEXT/MPad]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: Programming

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Mon Jun 20 14:37:27 1994, modified Mon Jun 20 14:37:27 1994, creator 'MPad', type ASCII, 6187 bytes "Programming" , at 0x18ab 342 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPad]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0b 50 72 6f 67 72 61 | 6d 6d 69 6e 67 00 00 00 |..Progra|mming...|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 61 | 64 01 00 00 00 00 00 00 |.TEXTMPa|d.......|
|00000050| 00 00 00 00 00 18 2b 00 | 00 01 56 aa 2b 92 67 aa |......+.|..V.+.g.|
|00000060| 2b 92 67 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |+.g.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 44 0b 00 00 |........|....D...|
|00000080| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 20 50 | 72 6f 67 72 61 6d 6d 69 |------ P|rogrammi|
|000000a0| 6e 67 20 69 6e 20 4d 61 | 74 68 50 61 64 0d 0d 2d |ng in Ma|thPad..-|
|000000b0| 2d 20 54 68 65 20 62 61 | 73 69 63 20 4d 61 74 68 |- The ba|sic Math|
|000000c0| 50 61 64 20 6c 61 6e 67 | 75 61 67 65 20 69 73 20 |Pad lang|uage is |
|000000d0| 69 6e 74 65 6e 64 65 64 | 20 74 6f 20 62 65 20 6d |intended| to be m|
|000000e0| 61 74 68 65 6d 61 74 69 | 63 61 6c 20 72 61 74 68 |athemati|cal rath|
|000000f0| 65 72 20 74 68 61 6e 20 | 70 72 6f 63 65 64 75 72 |er than |procedur|
|00000100| 61 6c 2e 20 45 71 75 61 | 74 69 6f 6e 73 20 63 61 |al. Equa|tions ca|
|00000110| 6e 20 62 65 20 77 72 69 | 74 74 65 6e 20 61 6e 64 |n be wri|tten and|
|00000120| 20 65 76 61 6c 75 61 74 | 65 64 20 69 6e 20 61 20 | evaluat|ed in a |
|00000130| 6e 61 74 75 72 61 6c 20 | 77 61 79 20 74 68 61 74 |natural |way that|
|00000140| 20 64 6f 65 73 20 6e 6f | 74 20 72 65 61 6c 6c 79 | does no|t really|
|00000150| 20 72 65 71 75 69 72 65 | 20 61 6e 79 20 70 72 6f | require| any pro|
|00000160| 67 72 61 6d 6d 69 6e 67 | 2e 20 54 68 65 72 65 20 |gramming|. There |
|00000170| 61 72 65 20 68 6f 77 65 | 76 65 72 20 73 6f 6d 65 |are howe|ver some|
|00000180| 20 68 61 6e 64 79 20 6e | 75 6d 65 72 69 63 61 6c | handy n|umerical|
|00000190| 20 61 6c 67 6f 72 69 74 | 68 6d 73 20 74 68 61 74 | algorit|hms that|
|000001a0| 20 64 6f 20 72 65 71 75 | 69 72 65 20 73 6f 6d 65 | do requ|ire some|
|000001b0| 20 70 72 6f 63 65 64 75 | 72 61 6c 20 6f 70 65 72 | procedu|ral oper|
|000001c0| 61 74 69 6f 6e 73 2e 0d | 0d 2d 2d 20 4d 61 74 68 |ations..|.-- Math|
|000001d0| 50 61 64 20 64 6f 65 73 | 20 6e 6f 74 20 68 61 76 |Pad does| not hav|
|000001e0| 65 20 61 6c 6c 20 74 68 | 65 20 68 61 6e 64 79 20 |e all th|e handy |
|000001f0| 66 65 61 74 75 72 65 73 | 20 6f 66 20 61 20 70 72 |features| of a pr|
|00000200| 6f 67 72 61 6d 6d 69 6e | 67 20 6c 61 6e 67 75 61 |ogrammin|g langua|
|00000210| 67 65 20 6c 69 6b 65 20 | 43 20 6f 72 20 50 61 73 |ge like |C or Pas|
|00000220| 63 61 6c 20 62 75 74 20 | 69 74 20 64 6f 65 73 20 |cal but |it does |
|00000230| 68 61 76 65 20 61 6c 6c | 20 74 68 65 20 65 73 73 |have all| the ess|
|00000240| 65 6e 74 69 61 6c 20 65 | 6c 65 6d 65 6e 74 73 20 |ential e|lements |
|00000250| 6e 65 65 64 65 64 20 74 | 6f 20 64 6f 20 70 72 6f |needed t|o do pro|
|00000260| 67 72 61 6d 6d 69 6e 67 | 2e 0d 0d 2d 2d 20 54 68 |gramming|...-- Th|
|00000270| 65 20 61 73 73 69 67 6e | 6d 65 6e 74 20 6f 70 65 |e assign|ment ope|
|00000280| 72 61 74 6f 72 2e 0d 2d | 2d 20 49 74 20 69 73 20 |rator..-|- It is |
|00000290| 76 65 72 79 20 69 6d 70 | 6f 72 74 61 6e 74 20 74 |very imp|ortant t|
|000002a0| 6f 20 75 6e 64 65 72 73 | 74 61 6e 64 20 74 68 65 |o unders|tand the|
|000002b0| 20 64 69 66 66 65 72 65 | 6e 63 65 20 62 65 74 77 | differe|nce betw|
|000002c0| 65 65 6e 20 3d 20 61 6e | 64 20 3a 3d 2e 20 54 68 |een = an|d :=. Th|
|000002d0| 65 20 3d 20 73 74 61 74 | 65 6d 65 6e 74 20 67 69 |e = stat|ement gi|
|000002e0| 76 65 73 20 61 20 64 65 | 66 69 6e 69 74 69 6f 6e |ves a de|finition|
|000002f0| 20 61 6e 64 20 64 6f 65 | 73 20 6e 6f 74 20 70 65 | and doe|s not pe|
|00000300| 72 66 6f 72 6d 20 61 6e | 79 20 63 61 6c 63 75 6c |rform an|y calcul|
|00000310| 61 74 69 6f 6e 2e 20 54 | 68 65 20 3d 20 73 74 61 |ation. T|he = sta|
|00000320| 74 65 6d 65 6e 74 20 69 | 73 20 61 6e 61 6c 6f 67 |tement i|s analog|
|00000330| 6f 75 73 20 74 6f 20 61 | 20 66 75 6e 63 74 69 6f |ous to a| functio|
|00000340| 6e 20 64 65 66 69 6e 69 | 74 69 6f 6e 20 69 6e 20 |n defini|tion in |
|00000350| 43 20 6f 72 20 50 61 73 | 63 61 6c 2e 0d 0d 2d 2d |C or Pas|cal...--|
|00000360| 20 4d 61 74 68 50 61 64 | 20 6d 61 6b 65 73 20 74 | MathPad| makes t|
|00000370| 77 6f 20 70 61 73 73 65 | 73 20 6f 76 65 72 20 74 |wo passe|s over t|
|00000380| 68 65 20 74 65 78 74 2e | 20 54 68 65 20 66 69 72 |he text.| The fir|
|00000390| 73 74 20 70 61 73 73 20 | 73 61 76 65 73 20 61 6c |st pass |saves al|
|000003a0| 6c 20 74 68 65 20 64 65 | 66 69 6e 69 74 69 6f 6e |l the de|finition|
|000003b0| 73 2e 20 54 68 65 20 73 | 65 63 6f 6e 64 20 70 61 |s. The s|econd pa|
|000003c0| 73 73 20 65 76 61 6c 75 | 61 74 65 73 20 73 74 61 |ss evalu|ates sta|
|000003d0| 74 65 6d 65 6e 74 73 20 | 69 6e 20 6f 72 64 65 72 |tements |in order|
|000003e0| 2e 0d 0d 20 20 61 3a 37 | 2e 30 30 3b 20 20 20 20 |... a:7|.00; |
|000003f0| 2d 2d 20 6c 6f 6f 6b 20 | 61 74 20 64 65 66 69 6e |-- look |at defin|
|00000400| 69 74 69 6f 6e 20 6f 66 | 20 22 61 22 20 61 6e 64 |ition of| "a" and|
|00000410| 20 70 65 72 66 6f 72 6d | 20 63 61 6c 63 75 6c 61 | perform| calcula|
|00000420| 74 69 6f 6e 2e 0d 20 20 | 61 20 3d 20 62 2b 32 20 |tion.. |a = b+2 |
|00000430| 20 20 20 2d 2d 20 64 65 | 66 69 6e 65 20 22 61 22 | -- de|fine "a"|
|00000440| 20 28 6f 6e 20 70 61 73 | 73 20 31 29 0d 20 20 62 | (on pas|s 1). b|
|00000450| 20 3d 20 35 20 20 20 20 | 20 20 2d 2d 20 64 65 66 | = 5 | -- def|
|00000460| 69 6e 65 20 22 62 22 20 | 28 6f 6e 20 70 61 73 73 |ine "b" |(on pass|
|00000470| 20 31 29 0d 0d 2d 2d 20 | 54 68 65 20 3a 3d 20 6f | 1)..-- |The := o|
|00000480| 70 65 72 61 74 6f 72 20 | 72 65 70 6c 61 63 65 73 |perator |replaces|
|00000490| 20 61 6e 79 20 64 65 66 | 69 6e 69 74 69 6f 6e 20 | any def|inition |
|000004a0| 6f 66 20 74 68 65 20 6c | 65 66 74 20 68 61 6e 64 |of the l|eft hand|
|000004b0| 20 76 61 72 69 61 62 6c | 65 20 77 69 74 68 20 74 | variabl|e with t|
|000004c0| 68 65 20 63 61 6c 63 75 | 6c 61 74 65 64 20 76 61 |he calcu|lated va|
|000004d0| 6c 75 65 20 6f 66 20 74 | 68 65 20 72 69 67 68 74 |lue of t|he right|
|000004e0| 20 68 61 6e 64 20 73 69 | 64 65 2e 0d 0d 20 20 63 | hand si|de... c|
|000004f0| 3a 3f 3b 20 20 20 20 20 | 20 20 2d 2d 20 74 68 65 |:?; | -- the|
|00000500| 72 65 20 69 73 20 6e 6f | 20 64 65 66 69 6e 69 74 |re is no| definit|
|00000510| 69 6f 6e 20 66 6f 72 20 | 22 63 22 0d 20 20 63 3a |ion for |"c". c:|
|00000520| 3d 20 62 2b 32 3a 3b 20 | 20 2d 2d 20 70 65 72 66 |= b+2:; | -- perf|
|00000530| 6f 72 6d 20 63 61 6c 63 | 75 6c 61 74 69 6f 6e 2e |orm calc|ulation.|
|00000540| 20 73 61 76 65 20 72 65 | 73 75 6c 74 20 69 6e 20 | save re|sult in |
|00000550| 22 63 22 0d 20 20 63 3a | 37 2e 30 30 3b 20 20 20 |"c". c:|7.00; |
|00000560| 20 2d 2d 20 61 63 63 65 | 73 73 20 74 68 65 20 73 | -- acce|ss the s|
|00000570| 61 76 65 64 20 76 61 6c | 75 65 2e 20 6e 6f 20 63 |aved val|ue. no c|
|00000580| 61 6c 63 75 6c 61 74 69 | 6f 6e 20 70 65 72 66 6f |alculati|on perfo|
|00000590| 72 6d 65 64 0d 20 20 62 | 3a 3d 31 30 3a 3b 20 20 |rmed. b|:=10:; |
|000005a0| 20 20 2d 2d 20 63 68 61 | 6e 67 65 20 76 61 6c 75 | -- cha|nge valu|
|000005b0| 65 20 6f 66 20 22 62 22 | 0d 20 20 61 3a 31 32 2e |e of "b"|. a:12.|
|000005c0| 30 30 3b 20 20 20 2d 2d | 20 63 61 6c 63 75 6c 61 |00; --| calcula|
|000005d0| 74 65 20 22 61 22 20 75 | 73 69 6e 67 20 6e 65 77 |te "a" u|sing new|
|000005e0| 20 76 61 6c 75 65 20 6f | 66 20 22 62 22 0d 20 20 | value o|f "b". |
|000005f0| 63 3a 37 2e 30 30 3b 20 | 20 20 20 2d 2d 20 76 61 |c:7.00; | -- va|
|00000600| 6c 75 65 20 6f 66 20 22 | 63 22 20 64 6f 65 73 20 |lue of "|c" does |
|00000610| 6e 6f 74 20 63 68 61 6e | 67 65 0d 0d 2d 2d 20 4e |not chan|ge..-- N|
|00000620| 6f 72 6d 61 6c 6c 79 20 | 74 68 65 20 64 65 73 74 |ormally |the dest|
|00000630| 69 6e 61 74 69 6f 6e 20 | 6f 66 20 3a 3d 20 69 73 |ination |of := is|
|00000640| 20 61 20 73 79 6d 62 6f | 6c 20 74 68 61 74 20 64 | a symbo|l that d|
|00000650| 6f 65 73 20 6e 6f 74 20 | 68 61 76 65 20 61 6e 79 |oes not |have any|
|00000660| 20 3d 20 64 65 66 69 6e | 69 74 69 6f 6e 2e 20 49 | = defin|ition. I|
|00000670| 74 20 69 73 20 73 6f 6d | 65 74 69 6d 65 73 20 75 |t is som|etimes u|
|00000680| 73 65 66 75 6c 20 74 6f | 20 68 61 76 65 20 61 6e |seful to| have an|
|00000690| 20 3d 20 64 65 66 69 6e | 69 74 69 6f 6e 20 63 61 | = defin|ition ca|
|000006a0| 6c 63 75 6c 61 74 65 20 | 61 6e 20 69 6e 69 74 69 |lculate |an initi|
|000006b0| 61 6c 20 76 61 6c 75 65 | 20 62 75 74 20 72 65 6d |al value| but rem|
|000006c0| 65 6d 62 65 72 20 74 68 | 61 74 20 6f 6e 63 65 20 |ember th|at once |
|000006d0| 3a 3d 20 69 73 20 75 73 | 65 64 20 74 68 65 20 64 |:= is us|ed the d|
|000006e0| 65 66 69 6e 69 74 69 6f | 6e 20 77 69 6c 6c 20 62 |efinitio|n will b|
|000006f0| 65 20 65 72 61 73 65 64 | 2e 0d 2d 2d 20 53 69 6e |e erased|..-- Sin|
|00000700| 63 65 20 3a 3d 20 69 73 | 20 73 65 71 75 65 6e 74 |ce := is| sequent|
|00000710| 69 61 6c 20 61 6e 64 20 | 3d 20 69 73 20 6e 6f 74 |ial and |= is not|
|00000720| 2c 20 69 74 20 69 73 20 | 70 6f 73 73 69 62 6c 65 |, it is |possible|
|00000730| 20 28 62 75 74 20 6e 6f | 74 20 72 65 63 6f 6d 6d | (but no|t recomm|
|00000740| 65 6e 64 65 64 29 20 74 | 6f 20 77 72 69 74 65 20 |ended) t|o write |
|00000750| 74 68 69 6e 67 73 20 74 | 68 61 74 20 6c 6f 6f 6b |things t|hat look|
|00000760| 20 72 61 74 68 65 72 20 | 63 6f 6e 66 75 73 69 6e | rather |confusin|
|00000770| 67 2e 0d 0d 20 20 64 3a | 3d 64 2b 31 3a 0d 20 20 |g... d:|=d+1:. |
|00000780| 64 20 3d 20 33 0d 20 20 | 64 3a 34 2e 30 30 0d 0d |d = 3. |d:4.00..|
|00000790| 2d 2d 20 45 6e 74 69 72 | 65 20 61 72 72 61 79 73 |-- Entir|e arrays|
|000007a0| 20 63 61 6e 20 62 65 20 | 61 73 73 69 67 6e 65 64 | can be |assigned|
|000007b0| 20 69 66 20 74 68 65 79 | 20 61 72 65 20 66 69 6e | if they| are fin|
|000007c0| 69 74 65 20 28 61 6e 64 | 20 74 68 65 72 65 20 69 |ite (and| there i|
|000007d0| 73 20 65 6e 6f 75 67 68 | 20 6d 65 6d 6f 72 79 29 |s enough| memory)|
|000007e0| 2e 20 49 6e 64 69 76 69 | 64 75 61 6c 20 61 72 72 |. Indivi|dual arr|
|000007f0| 61 79 20 65 6c 65 6d 65 | 6e 74 73 20 63 61 6e 20 |ay eleme|nts can |
|00000800| 62 65 20 61 73 73 69 67 | 6e 65 64 20 69 6e 20 6c |be assig|ned in l|
|00000810| 69 6d 69 74 65 64 20 63 | 61 73 65 73 2e 20 41 20 |imited c|ases. A |
|00000820| 73 69 6e 67 6c 65 20 6e | 75 6d 65 72 69 63 20 76 |single n|umeric v|
|00000830| 61 6c 75 65 20 63 61 6e | 20 62 65 20 61 73 73 69 |alue can| be assi|
|00000840| 67 6e 65 64 20 74 6f 20 | 61 6e 20 65 6c 65 6d 65 |gned to |an eleme|
|00000850| 6e 74 20 6f 66 20 61 6e | 20 61 72 72 61 79 20 74 |nt of an| array t|
|00000860| 68 61 74 20 68 61 73 20 | 70 72 65 76 69 6f 75 73 |hat has |previous|
|00000870| 6c 79 20 62 65 65 6e 20 | 69 6e 69 74 69 61 6c 69 |ly been |initiali|
|00000880| 7a 65 64 20 62 79 20 61 | 73 73 69 67 6e 6d 65 6e |zed by a|ssignmen|
|00000890| 74 2e 0d 0d 20 41 20 3a | 3d 20 7b 7b 31 2c 32 2c |t... A :|= {{1,2,|
|000008a0| 33 2c 34 7d 2c 7b 35 2c | 36 2c 37 2c 38 7d 7d 3a |3,4},{5,|6,7,8}}:|
|000008b0| 0d 20 41 5b 31 2c 32 5d | 20 3a 3d 20 30 3a 0d 20 |. A[1,2]| := 0:. |
|000008c0| 41 3a 7b 7b 31 2e 30 30 | 2c 30 2e 30 30 2c 33 2e |A:{{1.00|,0.00,3.|
|000008d0| 30 30 2c 34 2e 30 30 7d | 2c 7b 35 2e 30 30 2c 36 |00,4.00}|,{5.00,6|
|000008e0| 2e 30 30 2c 37 2e 30 30 | 2c 38 2e 30 30 7d 7d 0d |.00,7.00|,8.00}}.|
|000008f0| 0d 2d 2d 20 53 6f 6d 65 | 20 73 79 6d 62 6f 6c 73 |.-- Some| symbols|
|00000900| 20 61 72 65 20 6e 6f 74 | 20 61 6c 6c 6f 77 65 64 | are not| allowed|
|00000910| 20 61 73 20 3a 3d 20 64 | 65 73 74 69 6e 61 74 69 | as := d|estinati|
|00000920| 6f 6e 73 2e 20 41 72 72 | 61 79 20 64 65 66 69 6e |ons. Arr|ay defin|
|00000930| 69 74 69 6f 6e 73 20 77 | 69 74 68 20 65 78 70 6c |itions w|ith expl|
|00000940| 69 63 69 74 20 69 6e 64 | 65 78 65 73 20 63 61 6e |icit ind|exes can|
|00000950| 20 6e 6f 74 20 62 65 20 | 61 73 73 69 67 6e 65 64 | not be |assigned|
|00000960| 20 74 6f 2e 20 41 6c 73 | 6f 20 73 70 65 63 69 61 | to. Als|o specia|
|00000970| 6c 20 73 79 6d 62 6f 6c | 73 20 73 75 63 68 20 61 |l symbol|s such a|
|00000980| 73 20 74 68 65 20 70 6c | 6f 74 20 76 61 72 69 61 |s the pl|ot varia|
|00000990| 62 6c 65 20 58 20 6f 72 | 20 73 75 6d 28 29 20 76 |ble X or| sum() v|
|000009a0| 61 72 69 61 62 6c 65 73 | 20 63 61 6e 20 6e 6f 74 |ariables| can not|
|000009b0| 20 62 65 20 61 73 73 69 | 67 6e 65 64 20 74 6f 2e | be assi|gned to.|
|000009c0| 0d 0d 20 20 20 42 5b 69 | 5d 3d 69 0d 2d 2d 20 42 |.. B[i|]=i.-- B|
|000009d0| 3a 3d 33 3a 20 20 20 2d | 2d 20 69 73 20 6e 6f 74 |:=3: -|- is not|
|000009e0| 20 61 6c 6c 6f 77 65 64 | 0d 0d 0d 2d 2d 2d 2d 2d | allowed|...-----|
|000009f0| 2d 2d 2d 2d 2d 20 54 68 | 65 20 63 6f 6d 6d 61 20 |----- Th|e comma |
|00000a00| 6f 70 65 72 61 74 6f 72 | 0d 2d 2d 20 4d 61 74 68 |operator|.-- Math|
|00000a10| 50 61 64 27 73 20 66 75 | 6e 63 74 69 6f 6e 61 6c |Pad's fu|nctional|
|00000a20| 20 61 70 70 72 6f 61 63 | 68 20 64 65 61 6c 73 20 | approac|h deals |
|00000a30| 77 69 74 68 20 65 78 70 | 72 65 73 73 69 6f 6e 73 |with exp|ressions|
|00000a40| 20 61 6e 64 20 64 6f 65 | 73 20 6e 6f 74 20 75 73 | and doe|s not us|
|00000a50| 65 20 62 6c 6f 63 6b 73 | 20 63 6f 6e 74 61 69 6e |e blocks| contain|
|00000a60| 69 6e 67 20 73 65 71 75 | 65 6e 63 65 73 20 6f 66 |ing sequ|ences of|
|00000a70| 20 73 74 61 74 65 6d 65 | 6e 74 73 2e 20 48 6f 77 | stateme|nts. How|
|00000a80| 65 76 65 72 2c 20 74 68 | 65 20 63 6f 6d 6d 61 20 |ever, th|e comma |
|00000a90| 6f 70 65 72 61 74 6f 72 | 20 63 61 6e 20 62 65 20 |operator| can be |
|00000aa0| 75 73 65 64 20 74 6f 20 | 70 65 72 66 6f 72 6d 20 |used to |perform |
|00000ab0| 61 20 73 65 71 75 65 6e | 63 65 20 6f 66 20 6f 70 |a sequen|ce of op|
|00000ac0| 65 72 61 74 69 6f 6e 73 | 2e 20 50 61 72 65 6e 74 |erations|. Parent|
|00000ad0| 68 65 73 69 73 20 67 72 | 6f 75 70 20 74 68 65 20 |hesis gr|oup the |
|00000ae0| 73 65 71 75 65 6e 63 65 | 20 69 6e 74 6f 20 61 20 |sequence| into a |
|00000af0| 73 69 6e 67 6c 65 20 65 | 78 70 72 65 73 73 69 6f |single e|xpressio|
|00000b00| 6e 2e 0d 2d 2d 20 54 68 | 65 20 66 69 72 73 74 20 |n..-- Th|e first |
|00000b10| 70 75 72 70 6f 73 65 20 | 6f 66 20 74 68 65 20 63 |purpose |of the c|
|00000b20| 6f 6d 6d 61 20 6f 70 65 | 72 61 74 6f 72 20 69 73 |omma ope|rator is|
|00000b30| 20 74 6f 20 73 65 70 61 | 72 61 74 65 20 63 6f 6e | to sepa|rate con|
|00000b40| 64 69 74 69 6f 6e 61 6c | 20 22 77 68 65 6e 22 20 |ditional| "when" |
|00000b50| 63 6c 61 75 73 65 73 2e | 20 54 68 65 20 72 65 73 |clauses.| The res|
|00000b60| 75 6c 74 20 77 69 6c 6c | 20 62 65 20 74 68 65 20 |ult will| be the |
|00000b70| 76 61 6c 75 65 20 63 6f | 72 72 65 73 70 6f 6e 64 |value co|rrespond|
|00000b80| 69 6e 67 20 74 6f 20 66 | 69 72 73 74 20 63 6f 6e |ing to f|irst con|
|00000b90| 64 69 74 69 6f 6e 20 69 | 6e 20 74 68 65 20 6c 69 |dition i|n the li|
|00000ba0| 73 74 20 74 68 61 74 20 | 65 76 61 6c 75 61 74 65 |st that |evaluate|
|00000bb0| 73 20 74 72 75 65 2e 0d | 0d 20 20 73 65 6c 65 63 |s true..|. selec|
|00000bc0| 74 28 73 29 20 3d 20 61 | 20 77 68 65 6e 20 73 3d |t(s) = a| when s=|
|00000bd0| 31 2c 20 62 20 77 68 65 | 6e 20 73 3d 32 2c 20 63 |1, b whe|n s=2, c|
|00000be0| 20 77 68 65 6e 20 73 3d | 33 0d 20 20 73 65 6c 65 | when s=|3. sele|
|00000bf0| 63 74 28 31 29 3a 31 32 | 2e 30 30 3b 20 20 73 65 |ct(1):12|.00; se|
|00000c00| 6c 65 63 74 28 32 29 3a | 31 30 2e 30 30 3b 0d 0d |lect(2):|10.00;..|
|00000c10| 2d 2d 20 54 68 65 20 6d | 65 61 6e 69 6e 67 20 6f |-- The m|eaning o|
|00000c20| 66 20 74 68 65 20 63 6f | 6d 6d 61 20 6f 70 65 72 |f the co|mma oper|
|00000c30| 61 74 6f 72 20 69 73 20 | 65 78 74 65 6e 64 65 64 |ator is |extended|
|00000c40| 20 74 6f 20 61 6c 6c 6f | 77 20 61 6e 79 20 65 78 | to allo|w any ex|
|00000c50| 70 72 65 73 73 69 6f 6e | 20 28 6e 6f 74 20 6a 75 |pression| (not ju|
|00000c60| 73 74 20 77 68 65 6e 20 | 63 6c 61 75 73 65 73 29 |st when |clauses)|
|00000c70| 2e 20 54 68 65 20 72 65 | 73 75 6c 74 20 77 69 6c |. The re|sult wil|
|00000c80| 6c 20 62 65 20 74 68 65 | 20 66 69 72 73 74 20 69 |l be the| first i|
|00000c90| 74 65 6d 20 69 6e 20 74 | 68 65 20 6c 69 73 74 20 |tem in t|he list |
|00000ca0| 77 69 74 68 20 61 20 74 | 72 75 65 20 22 77 68 65 |with a t|rue "whe|
|00000cb0| 6e 22 20 63 6c 61 75 73 | 65 20 6f 72 20 74 68 65 |n" claus|e or the|
|00000cc0| 20 66 69 72 73 74 20 65 | 78 70 72 65 73 73 69 6f | first e|xpressio|
|00000cd0| 6e 20 74 68 61 74 20 65 | 76 61 6c 75 61 74 65 73 |n that e|valuates|
|00000ce0| 20 74 6f 20 61 20 6b 6e | 6f 77 6e 20 76 61 6c 75 | to a kn|own valu|
|00000cf0| 65 2e 20 45 76 61 6c 75 | 61 74 69 6f 6e 20 6f 66 |e. Evalu|ation of|
|00000d00| 20 61 6e 20 61 73 73 69 | 67 6e 6d 65 6e 74 20 70 | an assi|gnment p|
|00000d10| 65 72 66 6f 72 6d 73 20 | 74 68 65 20 73 69 64 65 |erforms |the side|
|00000d20| 20 65 66 66 65 63 74 20 | 6f 6e 6c 79 20 61 6e 64 | effect |only and|
|00000d30| 20 64 6f 65 73 20 6e 6f | 74 20 72 65 73 75 6c 74 | does no|t result|
|00000d40| 20 69 6e 20 61 20 6b 6e | 6f 77 6e 20 76 61 6c 75 | in a kn|own valu|
|00000d50| 65 2e 20 54 68 69 73 20 | 61 6c 6c 6f 77 73 20 61 |e. This |allows a|
|00000d60| 20 73 65 71 75 65 6e 63 | 65 20 6f 66 20 61 73 73 | sequenc|e of ass|
|00000d70| 69 67 6e 6d 65 6e 74 73 | 20 74 6f 20 62 65 20 64 |ignments| to be d|
|00000d80| 6f 6e 65 20 73 69 6d 70 | 6c 79 20 62 79 20 73 65 |one simp|ly by se|
|00000d90| 70 61 72 61 74 69 6e 67 | 20 74 68 65 6d 20 77 69 |parating| them wi|
|00000da0| 74 68 20 63 6f 6d 6d 61 | 73 2e 0d 0d 20 20 62 3a |th comma|s... b:|
|00000db0| 3d 62 2b 31 2c 20 63 3a | 3d 62 2c 20 61 3a 31 33 |=b+1, c:|=b, a:13|
|00000dc0| 2e 30 30 0d 20 20 62 3a | 31 31 2e 30 30 3b 20 20 |.00. b:|11.00; |
|00000dd0| 63 3a 31 31 2e 30 30 0d | 0d 2d 2d 20 54 68 65 20 |c:11.00.|.-- The |
|00000de0| 64 6f 75 62 6c 65 20 63 | 6f 6d 6d 61 20 6f 70 65 |double c|omma ope|
|00000df0| 72 61 74 6f 72 0d 2d 2d | 20 49 6e 20 63 61 73 65 |rator.--| In case|
|00000e00| 73 20 69 6e 76 6f 6c 76 | 69 6e 67 20 61 73 73 69 |s involv|ing assi|
|00000e10| 67 6e 6d 65 6e 74 73 20 | 69 74 20 69 73 20 73 6f |gnments |it is so|
|00000e20| 6d 65 74 69 6d 65 73 20 | 64 65 73 69 72 61 62 6c |metimes |desirabl|
|00000e30| 65 20 74 6f 20 68 61 76 | 65 20 65 76 61 6c 75 61 |e to hav|e evalua|
|00000e40| 74 69 6f 6e 20 6f 66 20 | 61 20 73 65 71 75 65 6e |tion of |a sequen|
|00000e50| 63 65 20 63 6f 6e 74 69 | 6e 75 65 20 65 76 65 6e |ce conti|nue even|
|00000e60| 20 69 66 20 61 20 74 72 | 75 65 20 77 68 65 6e 20 | if a tr|ue when |
|00000e70| 63 6c 61 75 73 65 20 69 | 73 20 65 6e 63 6f 75 6e |clause i|s encoun|
|00000e80| 74 65 72 65 64 2e 20 46 | 6f 72 20 74 68 65 20 64 |tered. F|or the d|
|00000e90| 6f 75 62 6c 65 20 63 6f | 6d 6d 61 2c 20 65 61 63 |ouble co|mma, eac|
|00000ea0| 68 20 65 78 70 72 65 73 | 73 69 6f 6e 20 69 73 20 |h expres|sion is |
|00000eb0| 65 76 61 6c 75 61 74 65 | 64 20 72 65 67 61 72 64 |evaluate|d regard|
|00000ec0| 6c 65 73 73 20 6f 66 20 | 77 68 65 6e 20 63 6c 61 |less of |when cla|
|00000ed0| 75 73 65 73 20 6f 72 20 | 6b 6e 6f 77 6e 20 72 65 |uses or |known re|
|00000ee0| 73 75 6c 74 73 2e 20 54 | 68 65 20 72 65 73 75 6c |sults. T|he resul|
|00000ef0| 74 20 6f 66 20 61 20 64 | 6f 75 62 6c 65 20 63 6f |t of a d|ouble co|
|00000f00| 6d 6d 61 20 6c 69 73 74 | 20 69 73 20 74 68 65 20 |mma list| is the |
|00000f10| 6c 61 73 74 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |last exp|ression |
|00000f20| 69 6e 20 74 68 65 20 6c | 69 73 74 2e 20 53 69 6e |in the l|ist. Sin|
|00000f30| 67 6c 65 20 61 6e 64 20 | 64 6f 75 62 6c 65 20 63 |gle and |double c|
|00000f40| 6f 6d 6d 61 73 20 63 61 | 6e 20 62 65 20 6d 69 78 |ommas ca|n be mix|
|00000f50| 65 64 20 69 6e 20 74 68 | 65 20 73 61 6d 65 20 6c |ed in th|e same l|
|00000f60| 69 73 74 2e 0d 0d 20 20 | 61 62 73 62 28 78 29 20 |ist... |absb(x) |
|00000f70| 3d 20 62 3a 3d 78 2c 0d | 20 20 20 20 20 20 20 20 |= b:=x,.| |
|00000f80| 20 20 20 62 3a 3d 2d 62 | 20 77 68 65 6e 20 62 3c | b:=-b| when b<|
|00000f90| 30 2c 2c 20 20 2d 2d 20 | 63 6f 6e 74 69 6e 75 65 |0,, -- |continue|
|00000fa0| 20 65 76 65 6e 20 69 66 | 20 62 3c 30 0d 20 20 20 | even if| b<0. |
|00000fb0| 20 20 20 20 20 20 20 20 | 62 20 20 20 20 20 20 20 | |b |
|00000fc0| 20 20 20 20 20 20 20 20 | 20 20 2d 2d 20 72 65 74 | | -- ret|
|00000fd0| 75 72 6e 20 76 61 6c 75 | 65 20 6f 66 20 62 0d 0d |urn valu|e of b..|
|00000fe0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 20 49 74 65 72 61 |--------|-- Itera|
|00000ff0| 74 69 6f 6e 0d 2d 2d 20 | 54 68 65 20 27 77 68 69 |tion.-- |The 'whi|
|00001000| 6c 65 27 20 6f 70 65 72 | 61 74 6f 72 20 63 61 6e |le' oper|ator can|
|00001010| 20 62 65 20 75 73 65 64 | 20 74 6f 20 65 76 61 6c | be used| to eval|
|00001020| 75 61 74 65 20 61 6e 20 | 65 78 70 72 65 73 73 69 |uate an |expressi|
|00001030| 6f 6e 20 72 65 70 65 61 | 74 65 64 6c 79 2e 20 54 |on repea|tedly. T|
|00001040| 68 65 20 77 68 69 6c 65 | 20 6b 65 79 77 6f 72 64 |he while| keyword|
|00001050| 20 66 6f 6c 6c 6f 77 73 | 20 74 68 65 20 65 78 70 | follows| the exp|
|00001060| 72 65 73 73 69 6f 6e 20 | 62 75 74 20 74 68 65 20 |ression |but the |
|00001070| 63 6f 6e 64 69 74 69 6f | 6e 20 69 73 20 63 68 65 |conditio|n is che|
|00001080| 63 6b 65 64 20 62 65 66 | 6f 72 65 20 65 61 63 68 |cked bef|ore each|
|00001090| 20 65 76 61 6c 75 61 74 | 69 6f 6e 2e 0d 0d 20 20 | evaluat|ion... |
|000010a0| 66 61 63 74 6f 72 69 61 | 6c 28 6e 29 20 3d 20 69 |factoria|l(n) = i|
|000010b0| 3a 3d 31 2c 0d 20 20 20 | 20 20 20 20 20 20 20 20 |:=1,. | |
|000010c0| 20 20 20 20 20 20 6d 3a | 3d 31 2c 20 20 2d 2d 20 | m:|=1, -- |
|000010d0| 73 65 74 20 75 70 20 62 | 65 66 6f 72 65 20 73 74 |set up b|efore st|
|000010e0| 61 72 74 69 6e 67 20 6c | 6f 6f 70 0d 20 20 20 20 |arting l|oop. |
|000010f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 28 69 3a | | (i:|
|00001100| 3d 69 2b 31 2c 6d 3a 3d | 6d 2a 69 29 20 77 68 69 |=i+1,m:=|m*i) whi|
|00001110| 6c 65 20 69 3c 6e 2c 20 | 2d 2d 20 64 6f 65 73 20 |le i<n, |-- does |
|00001120| 6e 6f 74 68 69 6e 67 20 | 69 66 20 6e 3c 3d 31 0d |nothing |if n<=1.|
|00001130| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001140| 20 6d 20 20 20 20 20 20 | 2d 2d 20 72 65 74 75 72 | m |-- retur|
|00001150| 6e 20 66 69 6e 61 6c 20 | 76 61 6c 75 65 20 66 6f |n final |value fo|
|00001160| 72 20 6d 0d 0d 20 20 66 | 61 63 74 6f 72 69 61 6c |r m.. f|actorial|
|00001170| 28 31 29 3a 31 2e 30 30 | 3b 20 20 69 3a 31 2e 30 |(1):1.00|; i:1.0|
|00001180| 30 3b 20 20 6d 3a 31 2e | 30 30 0d 20 20 66 61 63 |0; m:1.|00. fac|
|00001190| 74 6f 72 69 61 6c 28 32 | 29 3a 32 2e 30 30 3b 20 |torial(2|):2.00; |
|000011a0| 20 69 3a 32 2e 30 30 3b | 20 20 6d 3a 32 2e 30 30 | i:2.00;| m:2.00|
|000011b0| 0d 0d 2d 2d 20 4e 65 73 | 74 65 64 20 77 68 69 6c |..-- Nes|ted whil|
|000011c0| 65 20 6c 6f 6f 70 73 20 | 61 72 65 20 66 69 6e 65 |e loops |are fine|
|000011d0| 20 62 75 74 20 72 65 6d | 65 6d 62 65 72 20 74 68 | but rem|ember th|
|000011e0| 61 74 20 61 6c 6c 20 3a | 3d 20 76 61 72 69 61 62 |at all :|= variab|
|000011f0| 6c 65 73 20 61 72 65 20 | 67 6c 6f 62 61 6c 20 73 |les are |global s|
|00001200| 6f 20 64 6f 6e 27 74 20 | 74 72 79 20 75 73 69 6e |o don't |try usin|
|00001210| 67 20 27 69 27 20 61 73 | 20 74 68 65 20 69 6e 64 |g 'i' as| the ind|
|00001220| 65 78 20 66 6f 72 20 62 | 6f 74 68 20 61 6e 20 69 |ex for b|oth an i|
|00001230| 6e 6e 65 72 20 61 6e 64 | 20 6f 75 74 65 72 20 6c |nner and| outer l|
|00001240| 6f 6f 70 2e 0d 0d 2d 2d | 20 73 75 6d 28 29 2c 20 |oop...--| sum(), |
|00001250| 70 6c 6f 74 20 61 6e 64 | 20 74 61 62 6c 65 20 63 |plot and| table c|
|00001260| 61 6e 20 61 6c 73 6f 20 | 62 65 20 75 73 65 64 20 |an also |be used |
|00001270| 74 6f 20 70 65 72 66 6f | 72 6d 20 69 74 65 72 61 |to perfo|rm itera|
|00001280| 74 69 6f 6e 2e 20 54 68 | 65 20 66 6f 6c 6c 6f 77 |tion. Th|e follow|
|00001290| 69 6e 67 20 65 78 61 6d | 70 6c 65 73 20 61 6c 6c |ing exam|ples all|
|000012a0| 20 65 76 61 6c 75 61 74 | 65 20 64 6f 73 74 75 66 | evaluat|e dostuf|
|000012b0| 66 28 29 20 6e 20 74 69 | 6d 65 73 20 77 68 69 6c |f() n ti|mes whil|
|000012c0| 65 20 73 74 65 70 70 69 | 6e 67 20 69 74 73 20 70 |e steppi|ng its p|
|000012d0| 61 72 61 6d 65 74 65 72 | 20 66 72 6f 6d 20 31 20 |arameter| from 1 |
|000012e0| 74 6f 20 6e 2e 20 64 6f | 73 74 75 66 66 28 29 20 |to n. do|stuff() |
|000012f0| 63 61 6e 20 62 65 20 61 | 6e 79 20 65 78 70 72 65 |can be a|ny expre|
|00001300| 73 73 69 6f 6e 20 61 6e | 64 20 63 61 6e 20 63 6f |ssion an|d can co|
|00001310| 6e 74 61 69 6e 20 61 6e | 79 74 68 69 6e 67 20 69 |ntain an|ything i|
|00001320| 6e 63 6c 75 64 69 6e 67 | 20 3a 3d 2e 0d 0d 20 20 |ncluding| :=... |
|00001330| 64 6f 73 74 75 66 66 28 | 78 29 20 3d 20 28 63 74 |dostuff(|x) = (ct|
|00001340| 3a 3d 31 2c 31 29 20 77 | 68 65 6e 20 78 3d 31 2c |:=1,1) w|hen x=1,|
|00001350| 0d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00001360| 63 74 3a 3d 63 74 2b 78 | 2c 20 63 74 0d 20 20 6e |ct:=ct+x|, ct. n|
|00001370| 3d 35 0d 0d 20 20 73 75 | 6d 28 64 6f 73 74 75 66 |=5.. su|m(dostuf|
|00001380| 66 28 78 29 2c 78 2c 31 | 2c 6e 29 3a 33 35 2e 30 |f(x),x,1|,n):35.0|
|00001390| 30 3b 20 20 2d 2d 20 4e | 6f 74 65 3a 20 73 75 6d |0; -- N|ote: sum|
|000013a0| 28 29 20 77 69 6c 6c 20 | 73 74 6f 70 20 6f 6e 20 |() will |stop on |
|000013b0| 75 6e 6b 6e 6f 77 6e 0d | 0d 20 20 58 6d 69 6e 3d |unknown.|. Xmin=|
|000013c0| 31 3b 20 58 6d 61 78 3d | 6e 3b 20 58 73 74 65 70 |1; Xmax=|n; Xstep|
|000013d0| 73 3d 6e 0d 20 20 70 6c | 6f 74 20 64 6f 73 74 75 |s=n. pl|ot dostu|
|000013e0| 66 66 28 58 29 0d 0d 20 | 20 4e 6d 69 6e 3d 31 3b |ff(X).. | Nmin=1;|
|000013f0| 20 4e 6d 61 78 3d 6e 3b | 20 4e 73 74 65 70 73 3d | Nmax=n;| Nsteps=|
|00001400| 6e 0d 20 20 74 61 62 6c | 65 20 64 6f 73 74 75 66 |n. tabl|e dostuf|
|00001410| 66 28 4e 29 0d 20 20 20 | 20 20 20 20 31 2e 30 30 |f(N). | 1.00|
|00001420| 0d 20 20 20 20 20 20 20 | 33 2e 30 30 0d 20 20 20 |. |3.00. |
|00001430| 20 20 20 20 36 2e 30 30 | 0d 20 20 20 20 20 20 31 | 6.00|. 1|
|00001440| 30 2e 30 30 0d 20 20 20 | 20 20 20 31 35 2e 30 30 |0.00. | 15.00|
|00001450| 0d 0d 2d 2d 20 42 6f 74 | 68 20 70 6c 6f 74 20 61 |..-- Bot|h plot a|
|00001460| 6e 64 20 74 61 62 6c 65 | 20 65 76 61 6c 75 61 74 |nd table| evaluat|
|00001470| 65 20 74 68 65 69 72 20 | 65 78 70 72 65 73 73 69 |e their |expressi|
|00001480| 6f 6e 20 65 78 74 72 61 | 20 74 69 6d 65 73 20 61 |on extra| times a|
|00001490| 74 20 74 68 65 20 31 73 | 74 20 76 61 6c 75 65 20 |t the 1s|t value |
|000014a0| 69 6e 20 6f 72 64 65 72 | 20 74 6f 20 64 65 74 65 |in order| to dete|
|000014b0| 72 6d 69 6e 65 20 61 72 | 72 61 79 20 64 69 6d 65 |rmine ar|ray dime|
|000014c0| 6e 73 69 6f 6e 73 2e 20 | 54 6f 20 77 6f 72 6b 20 |nsions. |To work |
|000014d0| 70 72 6f 70 65 72 6c 79 | 20 64 6f 73 74 75 66 66 |properly| dostuff|
|000014e0| 28 29 20 6d 75 73 74 20 | 72 65 73 65 74 20 69 74 |() must |reset it|
|000014f0| 73 20 69 6e 69 74 69 61 | 6c 20 73 74 61 74 65 20 |s initia|l state |
|00001500| 62 61 73 65 64 20 6f 6e | 20 69 74 73 20 70 61 72 |based on| its par|
|00001510| 61 6d 65 74 65 72 2e 0d | 2d 2d 20 55 73 69 6e 67 |ameter..|-- Using|
|00001520| 20 70 6c 6f 74 20 77 69 | 74 68 20 65 78 70 72 65 | plot wi|th expre|
|00001530| 73 73 69 6f 6e 73 20 74 | 68 61 74 20 68 61 76 65 |ssions t|hat have|
|00001540| 20 73 69 64 65 20 65 66 | 66 65 63 74 73 20 63 61 | side ef|fects ca|
|00001550| 6e 20 62 65 20 74 72 69 | 63 6b 79 2e 20 49 66 20 |n be tri|cky. If |
|00001560| 74 68 65 20 70 6c 6f 74 | 20 65 78 70 72 65 73 73 |the plot| express|
|00001570| 69 6f 6e 20 69 73 20 61 | 6e 20 7b 78 2c 79 7d 20 |ion is a|n {x,y} |
|00001580| 61 72 72 61 79 20 69 74 | 20 67 65 74 73 20 65 76 |array it| gets ev|
|00001590| 61 6c 75 61 74 65 64 20 | 74 77 69 63 65 20 70 65 |aluated |twice pe|
|000015a0| 72 20 70 6c 6f 74 74 65 | 64 20 70 6f 69 6e 74 20 |r plotte|d point |
|000015b0| 28 6f 6e 63 65 20 66 6f | 72 20 74 68 65 20 78 20 |(once fo|r the x |
|000015c0| 63 6f 6f 72 64 2c 20 6f | 6e 63 65 20 66 6f 72 20 |coord, o|nce for |
|000015d0| 74 68 65 20 79 20 63 6f | 6f 72 64 29 2e 20 49 74 |the y co|ord). It|
|000015e0| 20 69 73 20 62 65 73 74 | 20 74 6f 20 67 65 6e 65 | is best| to gene|
|000015f0| 72 61 74 65 20 76 61 6c | 75 65 73 20 62 61 73 65 |rate val|ues base|
|00001600| 64 20 6f 6e 20 74 68 65 | 20 69 6e 64 65 70 65 6e |d on the| indepen|
|00001610| 64 65 6e 74 20 76 61 72 | 69 61 62 6c 65 20 72 61 |dent var|iable ra|
|00001620| 74 68 65 72 20 74 68 61 | 6e 20 62 61 73 65 64 20 |ther tha|n based |
|00001630| 6f 6e 20 6f 6e 6c 79 20 | 6f 6e 20 70 72 65 76 69 |on only |on previ|
|00001640| 6f 75 73 20 76 61 6c 75 | 65 73 2e 0d 0d 0d 2d 2d |ous valu|es....--|
|00001650| 2d 2d 2d 2d 2d 2d 2d 2d | 20 44 65 62 75 67 67 69 |--------| Debuggi|
|00001660| 6e 67 0d 2d 2d 20 49 74 | 20 6d 61 79 20 62 65 20 |ng.-- It| may be |
|00001670| 68 65 6c 70 66 75 6c 20 | 74 6f 20 63 72 65 61 74 |helpful |to creat|
|00001680| 65 20 61 20 64 65 62 75 | 67 67 69 6e 67 20 66 75 |e a debu|gging fu|
|00001690| 6e 63 74 69 6f 6e 20 74 | 6f 20 73 61 76 65 20 76 |nction t|o save v|
|000016a0| 61 6c 75 65 73 20 64 75 | 72 69 6e 67 20 65 76 61 |alues du|ring eva|
|000016b0| 6c 75 61 74 69 6f 6e 2e | 20 54 68 65 20 66 6f 6c |luation.| The fol|
|000016c0| 6c 6f 77 69 6e 67 20 72 | 6f 75 74 69 6e 65 73 20 |lowing r|outines |
|000016d0| 77 69 6c 6c 20 73 61 76 | 65 20 61 20 73 65 71 75 |will sav|e a sequ|
|000016e0| 65 6e 63 65 20 6f 66 20 | 75 70 20 74 6f 20 6e 6d |ence of |up to nm|
|000016f0| 61 78 20 76 61 6c 75 65 | 73 20 69 6e 20 74 68 65 |ax value|s in the|
|00001700| 20 61 72 72 61 79 20 64 | 62 67 64 61 74 61 2e 0d | array d|bgdata..|
|00001710| 0d 20 20 73 74 61 72 74 | 64 62 67 28 6e 6d 61 78 |. start|dbg(nmax|
|00001720| 29 20 3d 20 64 62 67 64 | 61 74 61 3a 3d 20 30 2f |) = dbgd|ata:= 0/|
|00001730| 30 5b 3a 6e 6d 61 78 5d | 2c 2d 2d 20 69 6e 69 74 |0[:nmax]|,-- init|
|00001740| 69 61 6c 69 7a 65 20 61 | 72 72 61 79 0d 20 20 20 |ialize a|rray. |
|00001750| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001760| 6e 64 62 67 3a 3d 30 0d | 0d 20 20 64 62 67 28 76 |ndbg:=0.|. dbg(v|
|00001770| 61 6c 29 20 3d 20 6e 64 | 62 67 3a 3d 6e 64 62 67 |al) = nd|bg:=ndbg|
|00001780| 2b 31 2c 0d 20 20 20 20 | 20 20 20 20 20 20 20 20 |+1,. | |
|00001790| 20 64 62 67 64 61 74 61 | 5b 6e 64 62 67 5d 3a 3d | dbgdata|[ndbg]:=|
|000017a0| 76 61 6c 20 0d 0d 0d 2d | 2d 20 74 72 79 20 6c 6f |val ...-|- try lo|
|000017b0| 6f 6b 69 6e 67 20 61 74 | 20 74 68 65 20 76 61 6c |oking at| the val|
|000017c0| 75 65 73 20 6f 66 20 74 | 68 65 20 22 63 74 22 20 |ues of t|he "ct" |
|000017d0| 67 6c 6f 62 61 6c 20 64 | 75 72 69 6e 67 20 64 6f |global d|uring do|
|000017e0| 73 74 75 66 66 28 29 20 | 73 75 6d 6d 61 74 69 6f |stuff() |summatio|
|000017f0| 6e 2e 0d 0d 20 20 73 74 | 61 72 74 64 62 67 28 31 |n... st|artdbg(1|
|00001800| 30 29 3a 0d 20 20 73 75 | 6d 28 28 64 62 67 28 63 |0):. su|m((dbg(c|
|00001810| 74 29 2c 64 6f 73 74 75 | 66 66 28 78 29 29 2c 78 |t),dostu|ff(x)),x|
|00001820| 2c 31 2c 6e 29 3a 33 35 | 2e 30 30 3b 0d 0d 20 20 |,1,n):35|.00;.. |
|00001830| 6e 64 62 67 3a 35 2e 30 | 30 3b 20 20 20 20 20 20 |ndbg:5.0|0; |
|00001840| 2d 2d 20 35 20 76 61 6c | 75 65 73 20 77 65 72 65 |-- 5 val|ues were|
|00001850| 20 73 61 76 65 64 0d 0d | 20 20 74 61 62 6c 65 20 | saved..| table |
|00001860| 64 62 67 64 61 74 61 5b | 3a 6e 64 62 67 5d 0d 20 |dbgdata[|:ndbg]. |
|00001870| 20 20 20 20 20 31 35 2e | 30 30 0d 20 20 20 20 20 | 15.|00. |
|00001880| 20 20 31 2e 30 30 0d 20 | 20 20 20 20 20 20 33 2e | 1.00. | 3.|
|00001890| 30 30 0d 20 20 20 20 20 | 20 20 36 2e 30 30 0d 20 |00. | 6.00. |
|000018a0| 20 20 20 20 20 31 30 2e | 30 30 0d 00 00 00 00 00 | 10.|00......|
|000018b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000018f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001900| 00 00 01 00 00 00 01 24 | 00 00 00 24 00 00 00 32 |.......$|...$...2|
|00001910| a2 76 11 fe 8c 11 42 10 | 01 10 2d 11 fe 02 03 65 |.v....B.|..-....e|
|00001920| 00 03 9a 0c 00 e8 02 62 | 00 03 92 8b 06 12 00 d2 |.......b|........|
|00001930| 0b 50 72 6f 67 72 61 6d | 6d 69 6e 67 02 00 00 00 |.Program|ming....|
|00001940| 54 45 58 54 4d 50 61 64 | 01 00 00 34 00 c0 00 00 |TEXTMPad|...4....|
|00001950| 00 00 54 45 58 54 4d 50 | 61 64 01 00 00 34 00 c0 |..TEXTMP|ad...4..|
|00001960| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001970| 00 00 aa 0a 85 dc 00 00 | 18 2b 00 00 01 56 da 2d |........|.+...V.-|
|00001980| 40 01 fe 88 68 54 80 01 | 03 2e 86 12 43 62 20 6e |@...hT..|....Cb n|
|00001990| 01 fe 88 14 2f 08 20 50 | 20 50 22 68 4f 13 4e 91 |..../. P| P"hO.N.|
|000019a0| 4a 00 50 8f 80 01 03 12 | 7f f9 11 80 00 69 13 1b |J.P.....|.....i..|
|000019b0| 7c 00 02 fe 02 99 02 70 | 72 6e 74 99 6c 2d 50 01 ||......p|rnt.l-P.|
|000019c0| 12 72 11 2b 40 11 fd fe | c2 01 b0 ad 30 6d 80 01 |.r.+@...|....0m..|
|000019d0| 02 e4 55 2f 11 fd fa 2f | 11 fd f6 02 72 ff 2b 41 |..U/.../|....r.+A|
|000019e0| 11 fd f2 13 1b 7c 00 03 | fe 02 76 17 fe 84 20 b8 |.....|..|..v... .|
|000019f0| 02 0c 20 2d fd f2 b0 ae | fe 84 02 62 00 01 84 86 |.. -....|...b....|
|00001a00| 00 00 00 20 04 00 00 02 | 00 02 3f f9 8e fa 35 12 |... ....|..?...5.|
|00001a10| 94 e9 c8 ae 01 b6 01 2b | 00 03 00 28 01 06 01 2c |.......+|...(...,|
|00001a20| 00 ef 00 27 00 00 01 00 | 00 00 01 24 00 00 00 24 |...'....|...$...$|
|00001a30| 00 00 00 32 00 64 15 70 | 05 e2 00 00 00 1c 00 32 |...2.d.p|.......2|
|00001a40| 00 00 50 52 65 66 00 00 | 00 0a 00 80 ff ff 00 00 |..PRef..|........|
|00001a50| 00 00 00 64 14 98 00 00 | 00 00 00 00 00 00 00 00 |...d....|........|
|00001a60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001a70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+