home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
You can browse this item here: art_tex
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text, with very long lines (711)
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 64 6f 63 75 6d 65 6e | 74 73 74 79 6c 65 5b 31 |\documen|tstyle[1|
|00000010| 31 70 74 5d 7b 61 72 74 | 69 63 6c 65 7d 0a 0a 5c |1pt]{art|icle}..\|
|00000020| 74 65 78 74 68 65 69 67 | 68 74 20 32 31 20 63 6d |textheig|ht 21 cm|
|00000030| 0a 5c 74 65 78 74 77 69 | 64 74 68 20 31 34 20 63 |.\textwi|dth 14 c|
|00000040| 6d 0a 20 0a 5c 74 6f 70 | 6d 61 72 67 69 6e 20 2d |m. .\top|margin -|
|00000050| 31 6d 6d 0a 5c 6d 61 72 | 67 69 6e 70 61 72 77 69 |1mm.\mar|ginparwi|
|00000060| 64 74 68 20 30 6d 6d 0a | 5c 65 76 65 6e 73 69 64 |dth 0mm.|\evensid|
|00000070| 65 6d 61 72 67 69 6e 20 | 31 2e 35 20 63 6d 0a 5c |emargin |1.5 cm.\|
|00000080| 6f 64 64 73 69 64 65 6d | 61 72 67 69 6e 20 31 2e |oddsidem|argin 1.|
|00000090| 35 20 63 6d 0a 0a 5c 62 | 65 67 69 6e 7b 64 6f 63 |5 cm..\b|egin{doc|
|000000a0| 75 6d 65 6e 74 7d 0a 5c | 70 61 67 65 73 74 79 6c |ument}.\|pagestyl|
|000000b0| 65 7b 70 6c 61 69 6e 7d | 0a 0a 5c 62 69 62 6c 69 |e{plain}|..\bibli|
|000000c0| 6f 67 72 61 70 68 79 73 | 74 79 6c 65 7b 61 62 62 |ographys|tyle{abb|
|000000d0| 72 76 7d 0a 0a 5c 6e 65 | 77 74 68 65 6f 72 65 6d |rv}..\ne|wtheorem|
|000000e0| 7b 64 66 7d 7b 44 65 66 | 69 6e 69 74 69 6f 6e 7d |{df}{Def|inition}|
|000000f0| 0a 5c 6e 65 77 74 68 65 | 6f 72 65 6d 7b 74 68 7d |.\newthe|orem{th}|
|00000100| 7b 54 68 65 6f 72 65 6d | 7d 0a 0a 5c 74 69 74 6c |{Theorem|}..\titl|
|00000110| 65 7b 0a 5c 48 75 67 65 | 0a 42 69 6e 50 72 6f 6c |e{.\Huge|.BinProl|
|00000120| 6f 67 20 33 2e 33 30 20 | 5c 5c 0a 55 73 65 72 20 |og 3.30 |\\.User |
|00000130| 47 75 69 64 65 20 5c 5c | 0a 5c 76 73 6b 69 70 20 |Guide \\|.\vskip |
|00000140| 35 63 6d 0a 7d 0a 0a 0a | 5c 61 75 74 68 6f 72 7b |5cm.}...|\author{|
|00000150| 0a 5c 4c 61 72 67 65 0a | 09 50 61 75 6c 20 54 61 |.\Large.|.Paul Ta|
|00000160| 72 61 75 09 5c 5c 5c 5c | 0a 5c 6c 61 72 67 65 0a |rau.\\\\|.\large.|
|00000170| 20 20 20 20 20 20 20 20 | 44 65 70 61 72 74 65 6d | |Departem|
|00000180| 65 6e 74 20 64 27 49 6e | 66 6f 72 6d 61 74 69 71 |ent d'In|formatiq|
|00000190| 75 65 20 5c 5c 0a 09 55 | 6e 69 76 65 72 73 69 74 |ue \\..U|niversit|
|000001a0| 5c 27 7b 65 7d 20 64 65 | 20 4d 6f 6e 63 74 6f 6e |\'{e} de| Moncton|
|000001b0| 20 5c 5c 0a 09 4d 6f 6e | 63 74 6f 6e 2c 20 43 61 | \\..Mon|cton, Ca|
|000001c0| 6e 61 64 61 2c 20 45 31 | 41 20 33 45 39 2c 20 5c |nada, E1|A 3E9, \|
|000001d0| 5c 0a 09 74 61 72 61 75 | 40 69 6e 66 6f 2e 75 6d |\..tarau|@info.um|
|000001e0| 6f 6e 63 74 6f 6e 2e 63 | 61 20 5c 5c 0a 5c 6e 6f |oncton.c|a \\.\no|
|000001f0| 72 6d 61 6c 73 69 7a 65 | 0a 7d 0a 0a 25 5c 64 61 |rmalsize|.}..%\da|
|00000200| 74 65 7b 7d 0a 0a 5c 76 | 73 6b 69 70 20 35 63 6d |te{}..\v|skip 5cm|
|00000210| 0a 5c 6d 61 6b 65 74 69 | 74 6c 65 0a 0a 5c 6e 65 |.\maketi|tle..\ne|
|00000220| 77 70 61 67 65 0a 5c 73 | 65 63 74 69 6f 6e 7b 49 |wpage.\s|ection{I|
|00000230| 6e 73 74 61 6c 6c 61 74 | 69 6f 6e 7d 0a 0a 5c 62 |nstallat|ion}..\b|
|00000240| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0a 45 |egin{ver|batim}.E|
|00000250| 49 54 48 45 52 3a 0a 0a | 20 20 20 45 64 69 74 20 |ITHER:..| Edit |
|00000260| 60 4d 61 6b 65 66 69 6c | 65 27 2e 20 43 68 61 6e |`Makefil|e'. Chan|
|00000270| 67 65 20 42 49 4e 44 49 | 52 20 61 6e 64 20 63 6f |ge BINDI|R and co|
|00000280| 6d 6d 65 6e 74 20 6f 75 | 74 20 41 52 43 48 5f 41 |mment ou|t ARCH_A|
|00000290| 4e 44 5f 4f 53 2c 0a 20 | 20 20 66 6f 72 20 65 78 |ND_OS,. | for ex|
|000002a0| 61 6d 70 6c 65 3a 0a 0a | 20 20 20 42 49 4e 44 49 |ample:..| BINDI|
|000002b0| 52 20 3d 20 2f 75 73 72 | 2f 6c 6f 63 61 6c 2f 62 |R = /usr|/local/b|
|000002c0| 69 6e 0a 20 20 20 41 52 | 43 48 5f 41 4e 44 5f 4f |in. AR|CH_AND_O|
|000002d0| 53 20 3d 20 73 70 61 72 | 63 2e 73 75 6e 6f 73 0a |S = spar|c.sunos.|
|000002e0| 0a 20 20 20 74 68 65 6e | 20 54 59 50 45 3a 0a 0a |. then| TYPE:..|
|000002f0| 20 20 20 20 20 20 6d 61 | 6b 65 20 69 6e 73 74 61 | ma|ke insta|
|00000300| 6c 6c 0a 0a 4f 52 3a 0a | 0a 20 20 43 6f 70 79 20 |ll..OR:.|. Copy |
|00000310| 6f 72 20 73 79 6d 62 6f | 6c 69 63 61 6c 6c 79 20 |or symbo|lically |
|00000320| 6c 69 6e 6b 20 62 69 6e | 2f 62 70 3c 41 52 43 48 |link bin|/bp<ARCH|
|00000330| 3e 2e 3c 4f 53 3e 20 20 | 74 6f 20 60 62 70 27 0a |>.<OS> |to `bp'.|
|00000340| 20 20 73 6f 6d 65 77 68 | 65 72 65 20 69 6e 20 79 | somewh|ere in y|
|00000350| 6f 75 72 20 70 61 74 68 | 2c 20 74 68 65 6e 20 74 |our path|, then t|
|00000360| 79 70 65 20 60 62 70 27 | 2e 0a 0a 5c 65 6e 64 7b |ype `bp'|...\end{|
|00000370| 76 65 72 62 61 74 69 6d | 7d 0a 0a 4e 6f 72 6d 61 |verbatim|}..Norma|
|00000380| 6c 6c 79 20 74 68 65 20 | 61 70 70 72 6f 70 72 69 |lly the |appropri|
|00000390| 61 74 65 20 60 77 61 6d | 27 20 28 61 20 43 2d 69 |ate `wam|' (a C-i|
|000003a0| 66 69 65 64 20 73 65 6c | 66 20 63 6f 6e 74 61 69 |fied sel|f contai|
|000003b0| 6e 65 64 20 65 78 65 63 | 75 74 61 62 6c 65 29 20 |ned exec|utable) |
|000003c0| 6f 72 0a 28 66 6f 72 20 | 73 6f 6d 65 20 6f 6c 64 |or.(for |some old|
|000003d0| 20 61 72 63 68 69 74 65 | 63 74 75 72 65 73 29 20 | archite|ctures) |
|000003e0| 74 79 70 69 6e 67 20 60 | 72 75 20 77 61 6d 2e 62 |typing `|ru wam.b|
|000003f0| 70 27 20 28 70 6f 73 73 | 69 62 6c 79 20 61 20 73 |p' (poss|ibly a s|
|00000400| 6d 61 6c 6c 20 60 62 70 | 27 0a 73 68 65 6c 6c 2d |mall `bp|'.shell-|
|00000410| 73 63 72 69 70 74 29 20 | 61 72 65 20 61 6c 6c 20 |script) |are all |
|00000420| 79 6f 75 20 6e 65 65 64 | 20 74 6f 20 68 61 76 65 |you need| to have|
|00000430| 20 42 69 6e 50 72 6f 6c | 6f 67 20 33 2e 33 30 20 | BinProl|og 3.30 |
|00000440| 72 75 6e 6e 69 6e 67 2e | 20 20 46 6f 72 0a 44 4f |running.| For.DO|
|00000450| 53 2f 57 69 6e 64 6f 77 | 73 20 33 38 36 2f 34 38 |S/Window|s 386/48|
|00000460| 36 20 50 43 73 20 79 6f | 75 20 77 69 6c 6c 20 68 |6 PCs yo|u will h|
|00000470| 61 76 65 20 74 6f 20 65 | 64 69 74 20 5c 76 65 72 |ave to e|dit \ver|
|00000480| 62 7e 62 70 2e 62 61 74 | 7e 0a 77 69 74 68 20 79 |b~bp.bat|~.with y|
|00000490| 6f 75 72 20 70 61 74 68 | 20 69 6e 66 6f 72 6d 61 |our path| informa|
|000004a0| 74 69 6f 6e 20 61 6e 64 | 20 74 68 65 6e 20 74 79 |tion and| then ty|
|000004b0| 70 65 20 5c 76 65 72 62 | 7e 62 70 7e 2e 0a 53 6f |pe \verb|~bp~..So|
|000004c0| 6d 65 74 68 69 6e 67 20 | 6c 69 6b 65 20 60 67 6f |mething |like `go|
|000004d0| 33 32 20 72 75 2e 33 38 | 36 20 77 61 6d 2e 62 70 |32 ru.38|6 wam.bp|
|000004e0| 27 20 64 69 72 65 63 74 | 6c 79 20 5c 0a 69 6e 20 |' direct|ly \.in |
|000004f0| 74 68 65 20 64 69 73 74 | 72 69 62 75 74 69 6f 6e |the dist|ribution|
|00000500| 20 64 69 72 65 63 74 6f | 72 79 20 73 68 6f 75 6c | directo|ry shoul|
|00000510| 64 20 61 6c 73 6f 20 77 | 6f 72 6b 2e 0a 0a 54 6f |d also w|ork...To|
|00000520| 20 73 74 61 72 74 20 42 | 69 6e 50 72 6f 6c 6f 67 | start B|inProlog|
|00000530| 20 75 73 65 0a 0a 5c 62 | 65 67 69 6e 7b 76 65 72 | use..\b|egin{ver|
|00000540| 62 61 74 69 6d 7d 0a 24 | 20 62 70 20 3c 63 6f 6d |batim}.$| bp <com|
|00000550| 6d 61 6e 64 2d 6c 69 6e | 65 20 6f 70 74 69 6f 6e |mand-lin|e option|
|00000560| 73 3e 20 3c 77 61 6d 2d | 62 79 74 65 63 6f 64 65 |s> <wam-|bytecode|
|00000570| 2d 66 69 6c 65 3e 0a 5c | 65 6e 64 7b 76 65 72 62 |-file>.\|end{verb|
|00000580| 61 74 69 6d 7d 0a 0a 6f | 72 20 73 69 6d 70 6c 79 |atim}..o|r simply|
|00000590| 0a 0a 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |..\begin|{verbati|
|000005a0| 6d 7d 0a 24 20 62 70 0a | 5c 65 6e 64 7b 76 65 72 |m}.$ bp.|\end{ver|
|000005b0| 62 61 74 69 6d 7d 0a 0a | 53 69 7a 65 73 20 6f 66 |batim}..|Sizes of|
|000005c0| 20 74 68 65 20 62 6c 61 | 63 6b 62 6f 61 72 64 2c | the bla|ckboard,|
|000005d0| 20 68 65 61 70 2c 20 73 | 74 61 63 6b 2c 20 74 72 | heap, s|tack, tr|
|000005e0| 61 69 6c 20 61 6e 64 20 | 63 6f 64 65 20 61 72 65 |ail and |code are|
|000005f0| 61 73 20 63 61 6e 20 62 | 65 20 70 61 73 73 65 64 |as can b|e passed|
|00000600| 20 61 73 0a 63 6f 6d 6d | 61 6e 64 20 6c 69 6e 65 | as.comm|and line|
|00000610| 20 70 61 72 61 6d 65 74 | 65 72 73 20 65 74 63 2c | paramet|ers etc,|
|00000620| 20 69 6e 20 4b 62 79 74 | 65 73 3a 0a 0a 7b 5c 66 | in Kbyt|es:..{\f|
|00000630| 6c 75 73 68 6c 65 66 74 | 20 75 73 61 67 65 3a 7d |lushleft| usage:}|
|00000640| 20 5b 2d 68 20 68 65 61 | 70 5d 20 5b 2d 73 20 73 | [-h hea|p] [-s s|
|00000650| 74 61 63 6b 5d 20 5b 2d | 74 20 74 72 61 69 6c 5d |tack] [-|t trail]|
|00000660| 20 5b 2d 63 20 63 6f 64 | 65 5d 20 5b 2d 62 20 62 | [-c cod|e] [-b b|
|00000670| 62 6f 61 72 64 5d 0a 5b | 2d 61 20 32 5c 5e 61 74 |board].[|-a 2\^at|
|00000680| 6f 6d 73 5d 20 5b 2d 64 | 20 32 5c 5e 68 61 73 68 |oms] [-d| 2\^hash|
|00000690| 74 61 62 6c 65 20 65 6e | 74 72 69 65 73 5d 20 5b |table en|tries] [|
|000006a0| 2d 69 20 73 69 7a 65 20 | 6f 66 20 49 4f 2d 62 75 |-i size |of IO-bu|
|000006b0| 66 66 65 72 5d 20 5b 2d | 71 20 71 75 69 65 74 6e |ffer] [-|q quietn|
|000006c0| 65 73 73 5d 20 77 61 6d | 66 69 6c 65 20 28 64 65 |ess] wam|file (de|
|000006d0| 66 61 75 6c 74 3a 20 77 | 61 6d 2e 62 70 29 2e 0a |fault: w|am.bp)..|
|000006e0| 0a 5c 73 65 63 74 69 6f | 6e 7b 4f 62 74 61 69 6e |.\sectio|n{Obtain|
|000006f0| 69 6e 67 20 42 69 6e 50 | 72 6f 6c 6f 67 7d 0a 0a |ing BinP|rolog}..|
|00000700| 54 68 65 20 4f 52 49 47 | 49 4e 41 4c 20 44 49 53 |The ORIG|INAL DIS|
|00000710| 54 52 49 42 55 54 49 4f | 4e 20 53 49 54 45 20 66 |TRIBUTIO|N SITE f|
|00000720| 6f 72 20 42 69 6e 50 72 | 6f 6c 6f 67 5c 66 6f 6f |or BinPr|olog\foo|
|00000730| 74 6e 6f 74 65 7b 42 69 | 6e 50 72 6f 6c 6f 67 20 |tnote{Bi|nProlog |
|00000740| 43 6f 70 79 72 69 67 68 | 74 20 24 5c 63 6f 70 79 |Copyrigh|t $\copy|
|00000750| 72 69 67 68 74 24 20 50 | 61 75 6c 20 54 61 72 61 |right$ P|aul Tara|
|00000760| 75 20 31 39 39 32 2d 39 | 34 20 41 6c 6c 20 72 69 |u 1992-9|4 All ri|
|00000770| 67 68 74 73 20 72 65 73 | 65 72 76 65 64 7d 20 69 |ghts res|erved} i|
|00000780| 73 3a 0a 0a 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |s:..\beg|in{verba|
|00000790| 74 69 6d 7d 0a 20 20 20 | 66 74 70 20 63 6c 65 6d |tim}. |ftp clem|
|000007a0| 65 6e 74 2e 69 6e 66 6f | 2e 75 6d 6f 6e 63 74 6f |ent.info|.umoncto|
|000007b0| 6e 2e 63 61 20 28 31 33 | 39 2e 31 30 33 2e 31 36 |n.ca (13|9.103.16|
|000007c0| 2e 32 29 0a 5c 65 6e 64 | 7b 76 65 72 62 61 74 69 |.2).\end|{verbati|
|000007d0| 6d 7d 0a 0a 7b 5c 66 6c | 75 73 68 6c 65 66 74 20 |m}..{\fl|ushleft |
|000007e0| 69 6e 7d 20 74 68 65 20 | 64 69 72 65 63 74 6f 72 |in} the |director|
|000007f0| 79 3a 0a 0a 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |y:..\beg|in{verba|
|00000800| 74 69 6d 7d 0a 20 20 2f | 70 75 62 2f 42 69 6e 50 |tim}. /|pub/BinP|
|00000810| 72 6f 6c 6f 67 2e 0a 5c | 65 6e 64 7b 76 65 72 62 |rolog..\|end{verb|
|00000820| 61 74 69 6d 7d 0a 0a 7b | 5c 66 6c 75 73 68 6c 65 |atim}..{|\flushle|
|00000830| 66 74 20 54 68 65 7d 20 | 66 74 70 20 73 65 72 76 |ft The} |ftp serv|
|00000840| 65 72 0a 63 6c 65 6d 65 | 6e 74 2e 69 6e 66 6f 2e |er.cleme|nt.info.|
|00000850| 75 6d 6f 6e 63 74 6f 6e | 2e 63 61 20 69 73 20 61 |umoncton|.ca is a|
|00000860| 20 53 70 61 72 63 73 74 | 61 74 69 6f 6e 20 45 4c | Sparcst|ation EL|
|00000870| 43 20 77 69 74 68 20 53 | 55 4e 4f 53 20 34 2e 31 |C with S|UNOS 4.1|
|00000880| 2e 31 29 2e 0a 50 6c 65 | 61 73 65 20 73 65 6e 64 |.1)..Ple|ase send|
|00000890| 20 63 6f 6d 6d 65 6e 74 | 73 20 61 6e 64 20 62 75 | comment|s and bu|
|000008a0| 67 20 72 65 70 6f 72 74 | 73 20 74 6f 20 0a 7b 5c |g report|s to .{\|
|000008b0| 74 74 20 62 69 6e 70 72 | 6f 6c 6f 67 40 69 6e 66 |tt binpr|olog@inf|
|000008c0| 6f 2e 75 6d 6f 6e 63 74 | 6f 6e 2e 63 61 2e 7d 0a |o.umonct|on.ca.}.|
|000008d0| 0a 5c 73 65 63 74 69 6f | 6e 7b 49 6e 74 72 6f 64 |.\sectio|n{Introd|
|000008e0| 75 63 74 69 6f 6e 20 74 | 6f 20 42 69 6e 50 72 6f |uction t|o BinPro|
|000008f0| 6c 6f 67 7d 0a 0a 42 69 | 6e 50 72 6f 6c 6f 67 20 |log}..Bi|nProlog |
|00000900| 68 61 73 20 62 65 65 6e | 20 64 65 76 65 6c 6f 70 |has been| develop|
|00000910| 70 65 64 20 62 79 20 50 | 61 75 6c 20 54 61 72 61 |ped by P|aul Tara|
|00000920| 75 20 6d 6f 73 74 6c 79 | 0a 61 74 20 74 68 65 20 |u mostly|.at the |
|00000930| 55 6e 69 76 65 72 73 69 | 74 79 20 6f 66 20 4d 6f |Universi|ty of Mo|
|00000940| 6e 63 74 6f 6e 2c 20 43 | 61 6e 61 64 61 2c 0a 61 |ncton, C|anada,.a|
|00000950| 6e 64 20 69 73 20 62 61 | 73 65 64 20 6f 6e 20 68 |nd is ba|sed on h|
|00000960| 69 73 20 42 69 6e 57 41 | 4d 20 61 62 73 74 72 61 |is BinWA|M abstra|
|00000970| 63 74 20 6d 61 63 68 69 | 6e 65 2c 0a 61 20 73 70 |ct machi|ne,.a sp|
|00000980| 65 63 69 61 6c 69 7a 61 | 74 69 6f 6e 20 6f 66 20 |ecializa|tion of |
|00000990| 74 68 65 20 57 41 4d 0a | 66 6f 72 20 74 68 65 20 |the WAM.|for the |
|000009a0| 65 66 66 69 63 69 65 6e | 74 20 65 78 65 63 75 74 |efficien|t execut|
|000009b0| 69 6f 6e 20 6f 66 20 62 | 69 6e 61 72 79 20 6c 6f |ion of b|inary lo|
|000009c0| 67 69 63 20 70 72 6f 67 | 72 61 6d 73 2e 0a 0a 42 |gic prog|rams...B|
|000009d0| 69 6e 50 72 6f 6c 6f 67 | 20 69 73 20 61 20 66 61 |inProlog| is a fa|
|000009e0| 73 74 20 61 6e 64 20 73 | 6d 61 6c 6c 20 50 72 6f |st and s|mall Pro|
|000009f0| 6c 6f 67 20 63 6f 6d 70 | 69 6c 65 72 2c 20 62 61 |log comp|iler, ba|
|00000a00| 73 65 64 20 6f 6e 20 74 | 68 65 0a 74 72 61 6e 73 |sed on t|he.trans|
|00000a10| 66 6f 72 6d 61 74 69 6f | 6e 20 20 6f 66 20 50 72 |formatio|n of Pr|
|00000a20| 6f 6c 6f 67 20 74 6f 20 | 62 69 6e 61 72 79 20 63 |olog to |binary c|
|00000a30| 6c 61 75 73 65 73 2e 20 | 54 68 65 20 63 6f 6d 70 |lauses. |The comp|
|00000a40| 69 6c 61 74 69 6f 6e 20 | 74 65 63 68 6e 69 71 75 |ilation |techniqu|
|00000a50| 65 0a 69 73 20 73 69 6d | 69 6c 61 72 20 74 6f 20 |e.is sim|ilar to |
|00000a60| 74 68 65 20 43 6f 6e 74 | 69 6e 75 61 74 69 6f 6e |the Cont|inuation|
|00000a70| 20 50 61 73 73 69 6e 67 | 20 53 74 79 6c 65 20 74 | Passing| Style t|
|00000a80| 72 61 6e 73 66 6f 72 6d | 61 74 69 6f 6e 20 75 73 |ransform|ation us|
|00000a90| 65 64 20 69 6e 0a 73 6f | 6d 65 20 4d 4c 20 69 6d |ed in.so|me ML im|
|00000aa0| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 73 2e 0a 0a |plementa|tions...|
|00000ab0| 41 6c 74 68 6f 75 67 68 | 20 69 74 20 28 75 73 65 |Although| it (use|
|00000ac0| 64 20 74 6f 29 20 69 6e | 63 6f 72 70 6f 72 61 74 |d to) in|corporat|
|00000ad0| 65 20 73 6f 6d 65 20 6c | 61 73 74 20 6d 69 6e 75 |e some l|ast minu|
|00000ae0| 74 65 20 72 65 73 65 61 | 72 63 68 20 65 78 70 65 |te resea|rch expe|
|00000af0| 72 69 6d 65 6e 74 73 2c | 0a 77 68 69 63 68 20 6d |riments,|.which m|
|00000b00| 69 67 68 74 20 6c 6f 6f | 6b 20 61 64 76 65 6e 74 |ight loo|k advent|
|00000b10| 75 72 6f 75 73 20 61 74 | 20 74 68 65 20 66 69 72 |urous at| the fir|
|00000b20| 73 74 20 73 69 67 68 74 | 2c 0a 42 69 6e 50 72 6f |st sight|,.BinPro|
|00000b30| 6c 6f 67 20 69 73 20 61 | 20 66 61 69 72 6c 79 20 |log is a| fairly |
|00000b40| 72 6f 62 75 73 74 20 61 | 6e 64 20 63 6f 6d 70 6c |robust a|nd compl|
|00000b50| 65 74 65 20 50 72 6f 6c | 6f 67 0a 69 6d 70 6c 65 |ete Prol|og.imple|
|00000b60| 6d 65 6e 74 61 74 69 6f | 6e 20 66 65 61 74 75 72 |mentatio|n featur|
|00000b70| 69 6e 67 20 62 6f 74 68 | 20 43 2d 65 6d 75 6c 61 |ing both| C-emula|
|00000b80| 74 65 64 20 65 78 65 63 | 75 74 69 6f 6e 0a 61 6e |ted exec|ution.an|
|00000b90| 64 20 67 65 6e 65 72 61 | 74 69 6f 6e 20 6f 66 20 |d genera|tion of |
|00000ba0| 73 74 61 6e 64 61 6c 6f | 6e 65 20 61 70 70 6c 69 |standalo|ne appli|
|00000bb0| 63 61 74 69 6f 6e 73 0a | 62 79 20 63 6f 6d 70 69 |cations.|by compi|
|00000bc0| 6c 61 74 69 6f 6e 20 74 | 6f 20 43 2e 20 53 6f 6d |lation t|o C. Som|
|00000bd0| 65 20 6f 66 20 69 74 73 | 20 66 65 61 74 75 72 65 |e of its| feature|
|00000be0| 73 20 61 72 65 3a 0a 0a | 5c 62 65 67 69 6e 7b 69 |s are:..|\begin{i|
|00000bf0| 74 65 6d 69 7a 65 7d 0a | 5c 69 74 65 6d 20 73 6f |temize}.|\item so|
|00000c00| 75 72 63 65 2d 6c 65 76 | 65 6c 20 74 72 61 6e 73 |urce-lev|el trans|
|00000c10| 66 6f 72 6d 61 74 69 6f | 6e 20 62 61 73 65 64 20 |formatio|n based |
|00000c20| 73 74 61 74 65 6c 65 73 | 73 20 6d 6f 64 75 6c 65 |stateles|s module|
|00000c30| 20 73 79 73 74 65 6d 0a | 5c 69 74 65 6d 20 64 79 | system.|\item dy|
|00000c40| 6e 61 6d 69 63 20 63 6f | 64 65 2c 0a 5c 69 74 65 |namic co|de,.\ite|
|00000c50| 6d 20 69 6e 74 75 69 74 | 69 6f 6e 69 73 74 69 63 |m intuit|ionistic|
|00000c60| 20 61 6e 64 20 6c 69 6e | 65 61 72 20 69 6d 70 6c | and lin|ear impl|
|00000c70| 69 63 61 74 69 6f 6e 2c | 0a 5c 69 74 65 6d 20 65 |ication,|.\item e|
|00000c80| 66 66 69 63 69 65 6e 74 | 20 68 69 67 68 2d 6f 72 |fficient| high-or|
|00000c90| 64 65 72 20 70 72 6f 67 | 72 61 6d 6d 69 6e 67 20 |der prog|ramming |
|00000ca0| 62 75 69 6c 74 69 6e 73 | 2c 20 0a 5c 69 74 65 6d |builtins|, .\item|
|00000cb0| 20 6c 6f 67 69 63 61 6c | 20 67 6c 6f 62 61 6c 20 | logical| global |
|00000cc0| 76 61 72 69 61 62 6c 65 | 73 2c 20 0a 5c 69 74 65 |variable|s, .\ite|
|00000cd0| 6d 20 62 61 63 6b 74 72 | 61 63 6b 61 62 6c 65 20 |m backtr|ackable |
|00000ce0| 64 65 73 74 72 75 63 74 | 69 76 65 20 61 73 73 69 |destruct|ive assi|
|00000cf0| 67 6e 6d 65 6e 74 2c 0a | 5c 69 74 65 6d 20 63 69 |gnment,.|\item ci|
|00000d00| 72 63 75 6c 61 72 20 74 | 65 72 6d 20 75 6e 69 66 |rcular t|erm unif|
|00000d10| 69 63 61 74 69 6f 6e 2c | 20 0a 5c 69 74 65 6d 20 |ication,| .\item |
|00000d20| 65 78 74 65 6e 64 65 64 | 20 44 43 47 73 20 28 6e |extended| DCGs (n|
|00000d30| 6f 77 20 62 75 69 6c 74 | 20 69 6e 20 74 68 65 20 |ow built| in the |
|00000d40| 65 6e 67 69 6e 65 20 61 | 73 20 60 69 6e 76 69 73 |engine a|s `invis|
|00000d50| 69 62 6c 65 20 67 72 61 | 6d 6d 61 72 73 27 29 2c |ible gra|mmars'),|
|00000d60| 20 0a 5c 69 74 65 6d 20 | 63 6f 6e 74 69 6e 75 61 | .\item |continua|
|00000d70| 74 69 6f 6e 20 6d 61 6e | 69 70 75 6c 61 74 69 6f |tion man|ipulatio|
|00000d80| 6e 20 70 72 69 6d 69 74 | 69 76 65 73 2c 20 0a 5c |n primit|ives, .\|
|00000d90| 69 74 65 6d 20 61 20 67 | 61 72 62 61 67 65 2d 63 |item a g|arbage-c|
|00000da0| 6f 6c 6c 65 63 74 65 64 | 0a 68 61 73 68 69 6e 67 |ollected|.hashing|
|00000db0| 20 62 61 73 65 64 20 67 | 6c 6f 62 61 6c 20 64 69 | based g|lobal di|
|00000dc0| 63 74 69 6f 6e 6e 61 72 | 79 20 66 6f 72 20 63 6f |ctionnar|y for co|
|00000dd0| 6e 73 74 61 6e 74 2d 74 | 69 6d 65 20 73 70 61 72 |nstant-t|ime spar|
|00000de0| 73 65 0a 61 72 72 61 79 | 73 20 61 6e 64 20 67 72 |se.array|s and gr|
|00000df0| 61 70 68 73 2c 0a 5c 69 | 74 65 6d 20 43 2d 63 6f |aphs,.\i|tem C-co|
|00000e00| 6d 70 61 74 69 62 6c 65 | 20 66 6c 6f 61 74 69 6e |mpatible| floatin|
|00000e10| 67 20 70 6f 69 6e 74 20 | 6f 70 65 72 61 74 69 6f |g point |operatio|
|00000e20| 6e 73 2c 20 0a 5c 69 74 | 65 6d 20 61 20 43 2d 69 |ns, .\it|em a C-i|
|00000e30| 6e 74 65 72 66 61 63 65 | 20 65 74 63 2e 0a 5c 65 |nterface| etc..\e|
|00000e40| 6e 64 7b 69 74 65 6d 69 | 7a 65 7d 0a 0a 4e 65 77 |nd{itemi|ze}..New|
|00000e50| 20 66 65 61 74 75 72 65 | 73 20 69 6e 20 61 64 64 | feature|s in add|
|00000e60| 65 64 20 69 6e 20 76 65 | 72 73 69 6f 6e 20 33 2e |ed in ve|rsion 3.|
|00000e70| 33 30 3a 0a 0a 5c 62 65 | 67 69 6e 7b 69 74 65 6d |30:..\be|gin{item|
|00000e80| 69 7a 65 7d 0a 5c 69 74 | 65 6d 20 73 6f 75 72 63 |ize}.\it|em sourc|
|00000e90| 65 2d 6c 65 76 65 6c 20 | 6d 6f 64 75 6c 65 73 0a |e-level |modules.|
|00000ea0| 5c 69 74 65 6d 20 66 61 | 73 74 65 72 20 63 6f 6d |\item fa|ster com|
|00000eb0| 70 69 6c 61 74 69 6f 6e | 20 74 6f 20 43 20 61 6e |pilation| to C an|
|00000ec0| 64 20 66 61 73 74 65 72 | 20 72 65 73 75 6c 74 69 |d faster| resulti|
|00000ed0| 6e 67 20 43 2d 63 6f 64 | 65 0a 5c 69 74 65 6d 20 |ng C-cod|e.\item |
|00000ee0| 76 65 72 79 20 73 6d 61 | 6c 6c 20 28 64 79 6e 61 |very sma|ll (dyna|
|00000ef0| 6d 69 63 61 6c 6c 79 20 | 6c 69 6e 6b 65 64 29 20 |mically |linked) |
|00000f00| 73 74 61 6e 64 61 6c 6f | 6e 65 20 65 78 65 63 75 |standalo|ne execu|
|00000f10| 74 61 62 6c 65 73 20 28 | 35 4b 29 20 0a 20 20 20 |tables (|5K) . |
|00000f20| 20 66 6f 72 20 53 6f 6c | 61 72 69 73 20 32 2e 78 | for Sol|aris 2.x|
|00000f30| 0a 5c 69 74 65 6d 20 69 | 6d 70 72 6f 76 65 64 20 |.\item i|mproved |
|00000f40| 28 66 69 6c 65 65 76 65 | 6e 74 20 62 61 73 65 64 |(fileeve|nt based|
|00000f50| 29 20 54 63 6c 2f 54 6b | 20 69 6e 74 65 72 66 61 |) Tcl/Tk| interfa|
|00000f60| 63 65 20 6e 6f 77 20 72 | 75 6e 6e 69 6e 67 20 75 |ce now r|unning u|
|00000f70| 6e 64 65 72 0a 20 20 20 | 20 74 63 6c 37 2e 34 62 |nder. | tcl7.4b|
|00000f80| 32 20 61 6e 64 20 74 6b | 34 2e 30 62 32 0a 5c 69 |2 and tk|4.0b2.\i|
|00000f90| 74 65 6d 20 68 65 6c 70 | 2f 31 20 64 65 74 65 63 |tem help|/1 detec|
|00000fa0| 74 69 6e 67 20 6e 65 61 | 72 2d 6d 61 74 63 68 69 |ting nea|r-matchi|
|00000fb0| 6e 67 20 70 72 65 64 69 | 63 61 74 65 20 64 65 66 |ng predi|cate def|
|00000fc0| 69 6e 69 74 69 6f 6e 73 | 0a 5c 69 74 65 6d 20 68 |initions|.\item h|
|00000fd0| 65 6c 70 20 77 61 72 6e | 69 6e 67 73 20 66 6f 72 |elp warn|ings for|
|00000fe0| 20 73 69 6e 67 6c 65 74 | 6f 6e 20 76 61 72 69 61 | singlet|on varia|
|00000ff0| 62 6c 65 73 0a 5c 69 74 | 65 6d 20 73 70 79 2f 31 |bles.\it|em spy/1|
|00001000| 20 66 6f 72 20 64 65 62 | 75 67 67 69 6e 67 20 63 | for deb|ugging c|
|00001010| 6f 6d 70 69 6c 65 64 20 | 63 6f 64 65 0a 0a 5c 65 |ompiled |code..\e|
|00001020| 6e 64 7b 69 74 65 6d 69 | 7a 65 7d 0a 0a 54 68 65 |nd{itemi|ze}..The|
|00001030| 20 7b 5c 74 74 20 62 70 | 7d 20 63 6f 6d 6d 61 6e | {\tt bp|} comman|
|00001040| 64 20 73 74 61 72 74 73 | 20 74 68 65 20 42 69 6e |d starts| the Bin|
|00001050| 50 72 6f 6c 6f 67 20 74 | 6f 70 6c 65 76 65 6c 2e |Prolog t|oplevel.|
|00001060| 0a 0a 50 72 6f 6c 6f 67 | 20 73 6f 75 72 63 65 73 |..Prolog| sources|
|00001070| 20 66 6f 72 20 74 68 65 | 20 63 6f 6d 70 69 6c 65 | for the| compile|
|00001080| 72 20 61 6e 64 20 62 75 | 69 6c 74 69 6e 73 0a 61 |r and bu|iltins.a|
|00001090| 72 65 20 69 6e 20 64 69 | 72 65 63 74 6f 72 79 20 |re in di|rectory |
|000010a0| 7b 5c 74 74 20 73 72 63 | 7d 2e 0a 0a 54 68 65 20 |{\tt src|}...The |
|000010b0| 64 69 72 65 63 74 6f 72 | 69 65 73 20 7b 5c 74 74 |director|ies {\tt|
|000010c0| 20 70 6c 32 63 20 61 6e | 64 20 64 79 6e 70 6c 32 | pl2c an|d dynpl2|
|000010d0| 63 20 7d 20 63 6f 6e 74 | 61 69 6e 0a 76 61 72 69 |c } cont|ain.vari|
|000010e0| 6f 75 73 20 70 72 6f 6a | 65 63 74 20 28 2a 2e 70 |ous proj|ect (*.p|
|000010f0| 72 6f 29 20 66 69 6c 65 | 73 0a 61 6e 64 20 61 20 |ro) file|s.and a |
|00001100| 6d 61 6b 65 66 69 6c 65 | 20 66 6f 72 20 67 65 6e |makefile| for gen|
|00001110| 65 72 61 74 69 6e 67 20 | 61 20 73 74 61 6e 64 61 |erating |a standa|
|00001120| 6c 6f 6e 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |lone app|lication|
|00001130| 73 0a 74 68 72 6f 75 67 | 68 20 63 6f 6d 70 69 6c |s.throug|h compil|
|00001140| 61 74 69 6f 6e 20 74 6f | 20 43 2e 0a 0a 54 68 65 |ation to| C...The|
|00001150| 20 64 69 72 65 63 74 6f | 72 79 20 7b 5c 74 74 20 | directo|ry {\tt |
|00001160| 54 43 4c 7d 20 63 6f 6e | 74 61 69 6e 73 20 61 20 |TCL} con|tains a |
|00001170| 62 69 64 69 72 65 63 74 | 69 6f 6e 61 6c 20 70 69 |bidirect|ional pi|
|00001180| 70 65 20 62 61 73 65 64 | 0a 42 69 6e 50 72 6f 6c |pe based|.BinProl|
|00001190| 6f 67 20 74 6f 20 54 63 | 6c 2f 54 6b 20 69 6e 74 |og to Tc|l/Tk int|
|000011a0| 65 72 66 61 63 65 2e 0a | 0a 54 68 65 20 64 69 72 |erface..|.The dir|
|000011b0| 65 63 74 6f 72 79 20 7b | 5c 74 74 20 63 70 61 72 |ectory {|\tt cpar|
|000011c0| 73 65 72 7d 20 63 6f 6e | 74 61 69 6e 73 0a 4b 6f |ser} con|tains.Ko|
|000011d0| 65 6e 20 44 65 20 42 6f | 73 73 63 68 65 72 65 27 |en De Bo|sschere'|
|000011e0| 73 20 49 53 4f 20 50 72 | 6f 6c 6f 67 0a 70 61 72 |s ISO Pr|olog.par|
|000011f0| 73 65 72 20 28 77 72 69 | 74 74 65 6e 20 69 6e 20 |ser (wri|tten in |
|00001200| 43 29 20 61 6e 64 20 42 | 69 6e 50 72 6f 6c 6f 67 |C) and B|inProlog|
|00001210| 20 73 74 61 6e 64 61 6c | 6f 6e 65 73 0a 62 61 73 | standal|ones.bas|
|00001220| 65 64 20 6f 6e 20 74 68 | 65 20 70 61 72 73 65 72 |ed on th|e parser|
|00001230| 20 28 63 62 70 2e 2a 29 | 2e 0a 0a 54 68 65 20 64 | (cbp.*)|...The d|
|00001240| 69 72 65 63 74 6f 72 79 | 20 7b 5c 74 74 20 6d 75 |irectory| {\tt mu|
|00001250| 6c 74 69 7d 20 63 6f 6e | 74 61 69 6e 73 20 4b 6f |lti} con|tains Ko|
|00001260| 65 6e 20 44 65 20 42 6f | 73 73 63 68 65 72 65 27 |en De Bo|sschere'|
|00001270| 73 0a 61 20 62 6c 61 63 | 6b 62 6f 61 72 64 20 62 |s.a blac|kboard b|
|00001280| 61 73 65 64 20 64 69 73 | 74 72 69 62 75 74 65 64 |ased dis|tributed|
|00001290| 20 70 72 6f 67 72 61 6d | 6d 69 6e 67 20 65 78 74 | program|ming ext|
|000012a0| 65 6e 73 69 6f 6e 0a 74 | 6f 20 42 69 6e 50 72 6f |ension.t|o BinPro|
|000012b0| 6c 6f 67 20 61 6e 64 20 | 42 69 6e 50 72 6f 6c 6f |log and |BinProlo|
|000012c0| 67 20 65 78 65 63 75 74 | 61 62 6c 65 73 20 77 68 |g execut|ables wh|
|000012d0| 69 63 68 20 0a 69 6e 74 | 65 67 72 61 74 65 20 74 |ich .int|egrate t|
|000012e0| 68 65 6d 20 28 6d 62 70 | 2e 2a 29 2e 0a 0a 5c 73 |hem (mbp|.*)...\s|
|000012f0| 75 62 73 65 63 74 69 6f | 6e 7b 42 69 6e 61 72 69 |ubsectio|n{Binari|
|00001300| 7a 61 74 69 6f 6e 7d 0a | 42 69 6e 50 72 6f 6c 6f |zation}.|BinProlo|
|00001310| 67 20 69 73 20 61 20 73 | 6d 61 6c 6c 2c 20 70 72 |g is a s|mall, pr|
|00001320| 6f 67 72 61 6d 2d 74 72 | 61 6e 73 66 6f 72 6d 61 |ogram-tr|ansforma|
|00001330| 74 69 6f 6e 20 62 61 73 | 65 64 20 63 6f 6d 70 69 |tion bas|ed compi|
|00001340| 6c 65 72 2e 20 45 76 65 | 72 79 74 68 69 6e 67 20 |ler. Eve|rything |
|00001350| 69 73 0a 63 6f 6e 76 65 | 72 74 65 64 20 74 6f 20 |is.conve|rted to |
|00001360| 43 6f 6e 74 69 6e 75 61 | 74 69 6f 6e 20 50 61 73 |Continua|tion Pas|
|00001370| 73 69 6e 67 20 42 69 6e | 61 72 79 20 43 6c 61 75 |sing Bin|ary Clau|
|00001380| 73 65 73 3a 0a 0a 7b 5c | 66 6c 75 73 68 6c 65 66 |ses:..{\|flushlef|
|00001390| 74 20 41 20 72 75 6c 65 | 20 6c 69 6b 65 7d 20 0a |t A rule| like} .|
|000013a0| 0a 5c 62 65 67 69 6e 7b | 76 65 72 62 61 74 69 6d |.\begin{|verbatim|
|000013b0| 7d 0a 20 20 61 28 58 29 | 3a 2d 62 28 58 29 2c 63 |}. a(X)|:-b(X),c|
|000013c0| 28 58 2c 59 29 2c 64 28 | 59 29 2e 0a 5c 65 6e 64 |(X,Y),d(|Y)..\end|
|000013d0| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 0a 7b 5c 66 6c |{verbati|m}..{\fl|
|000013e0| 75 73 68 6c 65 66 74 20 | 62 65 63 6f 6d 65 73 7d |ushleft |becomes}|
|000013f0| 0a 0a 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |..\begin|{verbati|
|00001400| 6d 7d 0a 20 20 61 28 58 | 2c 43 6f 6e 74 29 3a 2d |m}. a(X|,Cont):-|
|00001410| 62 28 58 2c 63 28 58 2c | 59 2c 64 28 59 2c 43 6f |b(X,c(X,|Y,d(Y,Co|
|00001420| 6e 74 29 29 29 2e 0a 5c | 65 6e 64 7b 76 65 72 62 |nt)))..\|end{verb|
|00001430| 61 74 69 6d 7d 0a 0a 7b | 5c 66 6c 75 73 68 6c 65 |atim}..{|\flushle|
|00001440| 66 74 20 41 7d 20 66 61 | 63 74 20 6c 69 6b 65 0a |ft A} fa|ct like.|
|00001450| 0a 5c 62 65 67 69 6e 7b | 76 65 72 62 61 74 69 6d |.\begin{|verbatim|
|00001460| 7d 0a 20 20 61 28 31 33 | 29 2e 0a 5c 65 6e 64 7b |}. a(13|)..\end{|
|00001470| 76 65 72 62 61 74 69 6d | 7d 0a 0a 7b 5c 66 6c 75 |verbatim|}..{\flu|
|00001480| 73 68 6c 65 66 74 20 62 | 65 63 6f 6d 65 73 7d 0a |shleft b|ecomes}.|
|00001490| 0a 5c 62 65 67 69 6e 7b | 76 65 72 62 61 74 69 6d |.\begin{|verbatim|
|000014a0| 7d 0a 20 20 61 28 31 33 | 2c 43 6f 6e 74 29 3a 2d |}. a(13|,Cont):-|
|000014b0| 74 72 75 65 28 43 6f 6e | 74 29 2e 0a 5c 65 6e 64 |true(Con|t)..\end|
|000014c0| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 0a 7b 5c 66 6c |{verbati|m}..{\fl|
|000014d0| 75 73 68 6c 65 66 74 20 | 41 7d 20 70 72 65 64 69 |ushleft |A} predi|
|000014e0| 63 61 74 65 20 75 73 69 | 6e 67 20 6d 65 74 61 76 |cate usi|ng metav|
|000014f0| 61 72 69 61 62 6c 65 73 | 20 6c 69 6b 65 0a 0a 5c |ariables| like..\|
|00001500| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0a |begin{ve|rbatim}.|
|00001510| 20 20 70 28 58 2c 59 29 | 3a 2d 58 2c 59 2e 0a 5c | p(X,Y)|:-X,Y..\|
|00001520| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0a 0a 7b |end{verb|atim}..{|
|00001530| 5c 66 6c 75 73 68 6c 65 | 66 74 20 62 65 63 6f 6d |\flushle|ft becom|
|00001540| 65 73 7d 0a 0a 5c 62 65 | 67 69 6e 7b 76 65 72 62 |es}..\be|gin{verb|
|00001550| 61 74 69 6d 7d 0a 20 20 | 70 28 58 2c 59 2c 43 6f |atim}. |p(X,Y,Co|
|00001560| 6e 74 29 3b 2d 63 61 6c | 6c 28 58 2c 63 61 6c 6c |nt);-cal|l(X,call|
|00001570| 28 59 2c 43 6f 6e 74 29 | 29 29 2e 0a 5c 65 6e 64 |(Y,Cont)|))..\end|
|00001580| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 0a 7b 5c 66 6c |{verbati|m}..{\fl|
|00001590| 75 73 68 6c 65 66 74 20 | 77 69 74 68 7d 20 74 72 |ushleft |with} tr|
|000015a0| 75 65 2f 31 20 61 6e 64 | 20 63 61 6c 6c 2f 32 20 |ue/1 and| call/2 |
|000015b0| 65 66 66 69 63 69 65 6e | 74 20 62 75 69 6c 74 69 |efficien|t builti|
|000015c0| 6e 73 20 69 6e 20 42 69 | 6e 50 72 6f 6c 6f 67 2e |ns in Bi|nProlog.|
|000015d0| 0a 0a 59 6f 75 20 63 61 | 6e 20 6e 6f 77 20 74 72 |..You ca|n now tr|
|000015e0| 79 20 6f 75 74 20 69 6e | 20 42 69 6e 50 72 6f 6c |y out in| BinProl|
|000015f0| 6f 67 20 33 2e 33 30 20 | 79 6f 75 72 20 6f 77 6e |og 3.30 |your own|
|00001600| 20 62 69 6e 61 72 79 20 | 70 72 6f 67 72 61 6d 73 | binary |programs|
|00001610| 20 62 79 20 75 73 69 6e | 67 0a 5c 76 65 72 62 7e | by usin|g.\verb~|
|00001620| 3a 3a 2d 7e 20 69 6e 73 | 74 65 61 64 20 6f 66 20 |::-~ ins|tead of |
|00001630| 5c 76 65 72 62 7e 3a 2d | 7e 20 73 6f 20 74 68 61 |\verb~:-|~ so tha|
|00001640| 74 20 74 68 65 20 70 72 | 65 70 72 6f 63 65 73 73 |t the pr|eprocess|
|00001650| 6f 72 20 77 69 6c 6c 20 | 6e 6f 74 20 74 6f 75 63 |or will |not touc|
|00001660| 68 0a 74 68 65 6d 5c 66 | 6f 6f 74 6e 6f 74 65 7b |h.them\f|ootnote{|
|00001670| 54 61 6b 65 20 63 61 72 | 65 20 69 66 20 79 6f 75 |Take car|e if you|
|00001680| 20 75 73 65 20 79 6f 75 | 72 20 6f 77 6e 20 62 69 | use you|r own bi|
|00001690| 6e 61 72 79 20 63 6c 61 | 75 73 65 73 20 74 6f 20 |nary cla|uses to |
|000016a0| 6b 65 65 70 20 61 6c 77 | 61 79 73 0a 74 68 65 20 |keep alw|ays.the |
|000016b0| 63 6f 6e 74 69 6e 75 61 | 74 69 6f 6e 20 61 73 20 |continua|tion as |
|000016c0| 61 20 6c 61 73 74 20 61 | 72 67 75 6d 65 6e 74 20 |a last a|rgument |
|000016d0| 6f 66 20 74 68 65 20 6c | 61 73 74 20 65 6d 62 65 |of the l|ast embe|
|000016e0| 64 64 65 64 20 63 6f 6e | 74 69 6e 75 61 74 69 6f |dded con|tinuatio|
|000016f0| 6e 20 60 70 72 65 64 69 | 63 61 74 65 27 2e 20 4c |n `predi|cate'. L|
|00001700| 6f 6f 6b 20 61 74 20 74 | 68 65 20 61 73 6d 2f 30 |ook at t|he asm/0|
|00001710| 20 74 72 61 63 65 72 20 | 68 6f 77 0a 42 69 6e 50 | tracer |how.BinP|
|00001720| 72 6f 6c 6f 67 20 69 74 | 73 65 6c 66 20 64 6f 65 |rolog it|self doe|
|00001730| 73 20 74 68 69 73 2e 7d | 2e 20 4f 74 68 65 72 77 |s this.}|. Otherw|
|00001740| 69 73 65 2c 20 66 72 6f | 6d 20 74 68 65 20 6f 75 |ise, fro|m the ou|
|00001750| 74 73 69 64 65 2c 20 42 | 69 6e 50 72 6f 6c 6f 67 |tside, B|inProlog|
|00001760| 0a 6c 6f 6f 6b 73 20 6c | 69 6b 65 20 61 6e 79 20 |.looks l|ike any |
|00001770| 6f 74 68 65 72 20 50 72 | 6f 6c 6f 67 2e 0a 0a 42 |other Pr|olog...B|
|00001780| 69 6e 61 72 69 7a 61 74 | 69 6f 6e 20 61 6c 6c 6f |inarizat|ion allo|
|00001790| 77 73 20 61 20 73 69 67 | 6e 69 66 69 63 61 6e 74 |ws a sig|nificant|
|000017a0| 20 73 69 6d 70 6c 69 66 | 69 63 61 74 69 6f 6e 20 | simplif|ication |
|000017b0| 6f 66 20 74 68 65 20 50 | 72 6f 6c 6f 67 20 65 6e |of the P|rolog en|
|000017c0| 67 69 6e 65 2c 0a 77 68 | 69 63 68 20 63 61 6e 20 |gine,.wh|ich can |
|000017d0| 62 65 20 73 65 65 6e 20 | 61 73 20 73 70 65 63 69 |be seen |as speci|
|000017e0| 61 6c 69 7a 61 74 69 6f | 6e 20 6f 66 20 74 68 65 |alizatio|n of the|
|000017f0| 20 57 41 4d 20 66 6f 72 | 20 74 68 65 20 65 78 65 | WAM for| the exe|
|00001800| 63 75 74 69 6f 6e 20 6f | 66 0a 43 6f 6e 74 69 6e |cution o|f.Contin|
|00001810| 75 61 74 69 6f 6e 20 50 | 61 73 73 69 6e 67 20 42 |uation P|assing B|
|00001820| 69 6e 61 72 79 20 50 72 | 6f 67 72 61 6d 73 2e 0a |inary Pr|ograms..|
|00001830| 0a 41 73 20 61 20 63 6f | 6e 73 65 71 75 65 6e 63 |.As a co|nsequenc|
|00001840| 65 2c 20 61 20 76 65 72 | 79 20 73 6d 61 6c 6c 20 |e, a ver|y small |
|00001850| 65 6d 75 6c 61 74 6f 72 | 20 28 61 62 6f 75 74 20 |emulator| (about |
|00001860| 36 30 4b 20 6f 6e 20 53 | 6f 6c 61 72 69 73 29 20 |60K on S|olaris) |
|00001870| 74 68 61 74 20 6f 66 74 | 65 6e 0a 66 69 74 73 20 |that oft|en.fits |
|00001880| 63 6f 6d 70 6c 65 74 65 | 6c 79 20 69 6e 20 74 68 |complete|ly in th|
|00001890| 65 20 63 61 63 68 65 20 | 6f 66 20 74 68 65 20 70 |e cache |of the p|
|000018a0| 72 6f 63 65 73 73 6f 72 | 2c 20 61 20 6d 6f 72 65 |rocessor|, a more|
|000018b0| 20 65 66 66 69 63 69 65 | 6e 74 20 6e 65 77 0a 64 | efficie|nt new.d|
|000018c0| 61 74 61 20 72 65 70 72 | 65 73 65 6e 74 61 74 69 |ata repr|esentati|
|000018d0| 6f 6e 20 61 6e 64 20 73 | 6f 6d 65 20 6c 6f 77 2d |on and s|ome low-|
|000018e0| 6c 65 76 65 6c 20 6f 70 | 74 69 6d 69 7a 61 74 69 |level op|timizati|
|000018f0| 6f 6e 73 20 6d 61 6b 65 | 20 42 69 6e 50 72 6f 6c |ons make| BinProl|
|00001900| 6f 67 0a 70 72 6f 62 61 | 62 6c 79 20 74 68 65 20 |og.proba|bly the |
|00001910| 66 61 73 74 65 73 74 20 | 66 72 65 65 6c 79 20 61 |fastest |freely a|
|00001920| 76 61 69 6c 61 62 6c 65 | 20 43 2d 65 6d 75 6c 61 |vailable| C-emula|
|00001930| 74 65 64 20 50 72 6f 6c | 6f 67 20 61 74 20 74 68 |ted Prol|og at th|
|00001940| 69 73 20 74 69 6d 65 0a | 28 38 31 32 20 4b 4c 49 |is time.|(812 KLI|
|00001950| 50 53 20 6f 6e 20 61 20 | 53 70 61 72 63 73 74 61 |PS on a |Sparcsta|
|00001960| 74 69 6f 6e 20 32 30 2d | 34 31 29 2e 0a 0a 54 68 |tion 20-|41)...Th|
|00001970| 69 73 20 6d 65 61 6e 73 | 20 33 2d 35 20 74 69 6d |is means| 3-5 tim|
|00001980| 65 73 20 66 61 73 74 65 | 72 20 74 68 61 6e 20 43 |es faste|r than C|
|00001990| 2d 50 72 6f 6c 6f 67 2c | 20 32 2d 33 20 74 69 6d |-Prolog,| 2-3 tim|
|000019a0| 65 73 20 66 61 73 74 65 | 72 20 74 68 61 6e 0a 53 |es faste|r than.S|
|000019b0| 57 49 2d 50 72 6f 6c 6f | 67 2c 20 31 2e 35 2d 32 |WI-Prolo|g, 1.5-2|
|000019c0| 20 74 69 6d 65 73 20 66 | 61 73 74 65 72 20 74 68 | times f|aster th|
|000019d0| 61 6e 20 28 58 29 53 42 | 2d 50 72 6f 6c 6f 67 20 |an (X)SB|-Prolog |
|000019e0| 61 6e 64 20 63 6c 6f 73 | 65 20 74 6f 20 43 2d 65 |and clos|e to C-e|
|000019f0| 6d 75 6c 61 74 65 64 0a | 53 69 63 73 74 75 73 20 |mulated.|Sicstus |
|00001a00| 32 2e 31 2e 0a 0a 5c 73 | 75 62 73 65 63 74 69 6f |2.1...\s|ubsectio|
|00001a10| 6e 7b 4d 61 63 68 69 6e | 65 73 20 73 75 70 70 6f |n{Machin|es suppo|
|00001a20| 72 74 65 64 7d 0a 0a 54 | 68 69 73 20 64 69 73 74 |rted}..T|his dist|
|00001a30| 72 69 62 75 74 69 6f 6e | 20 63 6f 6e 74 61 69 6e |ribution| contain|
|00001a40| 73 20 74 68 65 20 50 72 | 6f 6c 6f 67 20 73 6f 75 |s the Pr|olog sou|
|00001a50| 72 63 65 20 6f 66 20 74 | 68 65 20 63 6f 6d 70 69 |rce of t|he compi|
|00001a60| 6c 65 72 20 61 6e 64 0a | 65 78 65 63 75 74 61 62 |ler and.|executab|
|00001a70| 6c 65 20 65 6d 75 6c 61 | 74 6f 72 73 20 66 6f 72 |le emula|tors for|
|00001a80| 3a 0a 0a 5c 62 65 67 69 | 6e 7b 76 65 72 62 61 74 |:..\begi|n{verbat|
|00001a90| 69 6d 7d 0a 20 20 2d 20 | 53 70 61 72 63 20 2d 20 |im}. - |Sparc - |
|00001aa0| 53 75 6e 4f 53 20 34 2e | 78 2c 20 53 6f 6c 61 72 |SunOS 4.|x, Solar|
|00001ab0| 69 73 20 32 2e 78 3b 0a | 20 20 2d 20 44 45 43 20 |is 2.x;.| - DEC |
|00001ac0| 41 6c 70 68 61 20 2d 20 | 36 34 20 62 69 74 0a 20 |Alpha - |64 bit. |
|00001ad0| 20 2d 20 36 38 6b 20 4e | 65 58 54 20 2d 20 4d 61 | - 68k N|eXT - Ma|
|00001ae0| 63 68 3b 20 53 55 4e 33 | 20 2d 20 53 75 6e 4f 53 |ch; SUN3| - SunOS|
|00001af0| 20 34 2e 78 0a 20 20 2d | 20 4d 49 50 53 20 2d 20 | 4.x. -| MIPS - |
|00001b00| 44 45 43 3b 0a 20 20 2d | 20 49 42 4d 20 52 36 30 |DEC;. -| IBM R60|
|00001b10| 30 30 3b 0a 20 20 2d 20 | 33 38 36 2d 34 38 36 2d |00;. - |386-486-|
|00001b20| 50 65 6e 74 69 75 6d 20 | 28 4d 73 44 4f 53 2b 57 |Pentium |(MsDOS+W|
|00001b30| 69 6e 64 6f 77 73 20 2d | 20 77 69 74 68 20 33 32 |indows -| with 32|
|00001b40| 62 69 74 73 20 44 4f 53 | 2d 65 78 74 65 6e 64 65 |bits DOS|-extende|
|00001b50| 72 20 0a 20 20 20 20 67 | 6f 33 32 20 76 65 72 2e |r . g|o32 ver.|
|00001b60| 20 31 2e 31 30 2c 20 4c | 69 6e 75 78 2c 20 46 72 | 1.10, L|inux, Fr|
|00001b70| 65 65 42 53 44 29 2e 0a | 5c 65 6e 64 7b 76 65 72 |eeBSD)..|\end{ver|
|00001b80| 62 61 74 69 6d 7d 0a 0a | 7b 5c 66 6c 75 73 68 6c |batim}..|{\flushl|
|00001b90| 65 66 74 20 41 73 7d 0a | 20 74 68 65 20 69 6d 70 |eft As}.| the imp|
|00001ba0| 6c 65 6d 65 6e 74 61 74 | 69 6f 6e 20 6d 61 6b 65 |lementat|ion make|
|00001bb0| 73 20 6e 6f 20 61 73 73 | 75 6d 70 74 69 6f 6e 20 |s no ass|umption |
|00001bc0| 61 62 6f 75 74 20 6d 61 | 63 68 69 6e 65 20 77 6f |about ma|chine wo|
|00001bd0| 72 64 20 73 69 7a 65 20 | 69 74 20 69 73 0a 6c 69 |rd size |it is.li|
|00001be0| 6b 65 6c 79 20 74 6f 20 | 63 6f 6d 70 69 6c 65 20 |kely to |compile |
|00001bf0| 65 76 65 6e 20 6f 6e 20 | 76 65 72 79 20 73 74 72 |even on |very str|
|00001c00| 61 6e 67 65 20 6d 61 63 | 68 69 6e 65 73 20 74 68 |ange mac|hines th|
|00001c10| 61 74 20 68 61 76 65 20 | 61 20 43 2d 63 6f 6d 70 |at have |a C-comp|
|00001c20| 69 6c 65 72 2e 0a 42 69 | 6e 50 72 6f 6c 6f 67 27 |iler..Bi|nProlog'|
|00001c30| 73 20 69 6e 74 65 67 65 | 72 73 20 61 72 65 20 69 |s intege|rs are i|
|00001c40| 6e 68 65 72 69 74 65 64 | 20 66 72 6f 6d 20 74 68 |nherited| from th|
|00001c50| 65 20 6e 61 74 69 76 65 | 20 43 2d 73 79 73 74 65 |e native| C-syste|
|00001c60| 6d 2e 0a 46 6f 72 20 65 | 78 61 6d 70 6c 65 20 6f |m..For e|xample o|
|00001c70| 6e 20 44 45 43 20 41 4c | 50 48 41 20 6d 61 63 68 |n DEC AL|PHA mach|
|00001c80| 69 6e 65 73 20 42 69 6e | 50 72 6f 6c 6f 67 20 68 |ines Bin|Prolog h|
|00001c90| 61 73 20 24 36 34 2d 33 | 3d 36 31 24 20 62 69 74 |as $64-3|=61$ bit|
|00001ca0| 20 69 6e 74 65 67 65 72 | 73 2e 0a 4f 6e 20 33 32 | integer|s..On 32|
|00001cb0| 2d 62 69 74 20 73 79 73 | 74 65 6d 73 20 69 74 20 |-bit sys|tems it |
|00001cc0| 68 61 73 20 24 33 32 2d | 32 3d 33 30 24 20 62 69 |has $32-|2=30$ bi|
|00001cd0| 74 20 69 6e 74 65 67 65 | 72 73 2e 0a 46 6c 6f 61 |t intege|rs..Floa|
|00001ce0| 74 69 6e 67 20 70 6f 69 | 6e 74 20 69 73 20 64 6f |ting poi|nt is do|
|00001cf0| 75 62 6c 65 20 28 36 34 | 20 62 69 74 73 29 20 61 |uble (64| bits) a|
|00001d00| 6e 64 20 69 74 20 69 73 | 20 67 75 61 72 61 6e 74 |nd it is| guarant|
|00001d10| 65 65 64 20 74 68 61 74 | 20 63 6f 6d 70 75 74 61 |eed that| computa|
|00001d20| 74 69 6f 6e 73 0a 69 6e | 20 50 72 6f 6c 6f 67 20 |tions.in| Prolog |
|00001d30| 77 69 6c 6c 20 61 6c 77 | 61 79 73 20 67 69 76 65 |will alw|ays give|
|00001d40| 20 74 68 65 20 73 61 6d | 65 20 72 65 73 75 6c 74 | the sam|e result|
|00001d50| 73 20 61 73 20 69 6e 20 | 74 68 65 20 75 6e 64 65 |s as in |the unde|
|00001d60| 72 6c 79 69 6e 67 20 43 | 2e 0a 41 73 20 61 20 6d |rlying C|..As a m|
|00001d70| 61 74 74 65 72 20 6f 66 | 20 66 61 63 74 20 42 69 |atter of| fact Bi|
|00001d80| 6e 50 72 6f 6c 6f 67 20 | 64 6f 65 73 20 6e 6f 74 |nProlog |does not|
|00001d90| 20 72 65 61 6c 6c 79 20 | 6b 6e 6f 77 20 74 68 61 | really |know tha|
|00001da0| 74 20 69 74 20 68 61 73 | 20 66 6c 6f 61 74 73 0a |t it has| floats.|
|00001db0| 62 75 74 20 68 6f 77 20 | 74 68 69 73 20 68 61 70 |but how |this hap|
|00001dc0| 70 65 6e 73 20 69 73 20 | 72 61 74 68 65 72 20 6c |pens is |rather l|
|00001dd0| 6f 6e 67 20 74 6f 20 65 | 78 70 6c 61 69 6e 20 68 |ong to e|xplain h|
|00001de0| 65 72 65 2e 0a 0a 5c 73 | 65 63 74 69 6f 6e 7b 55 |ere...\s|ection{U|
|00001df0| 73 69 6e 67 20 42 69 6e | 50 72 6f 6c 6f 67 7d 0a |sing Bin|Prolog}.|
|00001e00| 0a 42 69 6e 50 72 6f 6c | 6f 67 20 75 73 65 73 20 |.BinProl|og uses |
|00001e10| 52 2e 41 2e 20 4f 27 4b | 65 65 66 65 27 73 20 70 |R.A. O'K|eefe's p|
|00001e20| 75 62 6c 69 63 20 64 6f | 6d 61 69 6e 20 74 6f 6b |ublic do|main tok|
|00001e30| 65 6e 69 73 65 72 20 61 | 6e 64 20 70 61 72 73 65 |eniser a|nd parse|
|00001e40| 72 20 61 6e 64 0a 77 72 | 69 74 65 20 75 74 69 6c |r and.wr|ite util|
|00001e50| 69 74 69 65 73 20 28 73 | 65 65 20 74 68 65 20 66 |ities (s|ee the f|
|00001e60| 69 6c 65 73 20 72 65 61 | 64 2e 70 6c 2c 20 77 72 |iles rea|d.pl, wr|
|00001e70| 69 74 65 2e 70 6c 29 2c | 20 44 43 47 73 20 61 6e |ite.pl),| DCGs an|
|00001e80| 64 20 61 0a 74 72 61 6e | 73 66 6f 72 6d 65 72 20 |d a.tran|sformer |
|00001e90| 74 6f 20 62 69 6e 61 72 | 79 20 70 72 6f 67 72 61 |to binar|y progra|
|00001ea0| 6d 73 2e 20 49 74 20 63 | 6f 6d 70 69 6c 65 73 20 |ms. It c|ompiles |
|00001eb0| 69 74 73 65 6c 66 20 69 | 6e 20 6c 65 73 73 20 74 |itself i|n less t|
|00001ec0| 68 61 6e 20 31 20 6d 69 | 6e 75 74 65 20 0a 6f 6e |han 1 mi|nute .on|
|00001ed0| 20 61 20 53 70 61 72 63 | 73 74 61 74 69 6f 6e 20 | a Sparc|station |
|00001ee0| 31 30 2d 34 30 2e 0a 0a | 54 68 65 20 73 79 73 74 |10-40...|The syst|
|00001ef0| 65 6d 20 68 61 73 20 76 | 65 72 79 20 66 61 73 74 |em has v|ery fast|
|00001f00| 20 28 68 65 61 70 2d 62 | 61 73 65 64 29 20 7b 5c | (heap-b|ased) {\|
|00001f10| 74 74 20 63 6f 70 79 5c | 5f 74 65 72 6d 2f 32 7d |tt copy\|_term/2}|
|00001f20| 2c 20 7b 5c 74 74 0a 66 | 69 6e 64 61 6c 6c 2f 33 |, {\tt.f|indall/3|
|00001f30| 7d 20 61 6e 64 20 7b 5c | 74 74 20 66 69 6e 64 61 |} and {\|tt finda|
|00001f40| 6c 6c 2f 34 7d 20 70 72 | 65 64 69 63 61 74 65 73 |ll/4} pr|edicates|
|00001f50| 2c 20 66 6c 6f 61 74 69 | 6e 67 20 70 6f 69 6e 74 |, floati|ng point|
|00001f60| 2c 20 67 6c 6f 62 61 6c | 0a 6c 6f 67 69 63 61 6c |, global|.logical|
|00001f70| 20 76 61 72 69 61 62 6c | 65 73 2c 20 62 75 74 20 | variabl|es, but |
|00001f80| 73 74 69 6c 6c 20 6c 61 | 63 6b 73 20 66 75 6c 6c |still la|cks full|
|00001f90| 20 67 61 72 62 61 67 65 | 20 63 6f 6c 6c 65 63 74 | garbage| collect|
|00001fa0| 69 6f 6e 2e 0a 0a 41 20 | 6e 65 77 20 74 65 72 6d |ion...A |new term|
|00001fb0| 20 63 6f 6d 70 72 65 73 | 73 69 6f 6e 20 74 65 63 | compres|sion tec|
|00001fc0| 68 6e 69 71 75 65 20 5c | 63 69 74 65 7b 54 4e 39 |hnique \|cite{TN9|
|00001fd0| 34 3a 50 4c 49 4c 50 7d | 20 28 6a 6f 69 6e 74 20 |4:PLILP}| (joint |
|00001fe0| 77 6f 72 6b 20 77 69 74 | 68 0a 55 6c 72 69 63 68 |work wit|h.Ulrich|
|00001ff0| 20 4e 65 75 6d 65 72 6b | 65 6c 29 20 72 65 64 75 | Neumerk|el) redu|
|00002000| 63 65 73 20 68 65 61 70 | 2d 63 6f 6e 73 75 6d 70 |ces heap|-consump|
|00002010| 74 69 6f 6e 20 61 6e 64 | 20 61 64 64 73 20 73 6f |tion and| adds so|
|00002020| 6d 65 20 65 78 74 72 61 | 20 73 70 65 65 64 20 2e |me extra| speed .|
|00002030| 0a 55 6c 72 69 63 68 27 | 73 20 69 74 65 72 61 74 |.Ulrich'|s iterat|
|00002040| 69 76 65 20 7b 5c 74 74 | 20 63 6f 70 79 5c 5f 74 |ive {\tt| copy\_t|
|00002050| 65 72 6d 2f 32 7d 20 61 | 6c 67 6f 72 69 74 68 6d |erm/2} a|lgorithm|
|00002060| 20 66 75 72 74 68 65 72 | 20 61 63 63 65 6c 65 72 | further| acceler|
|00002070| 61 74 65 73 0a 42 69 6e | 50 72 6f 6c 6f 67 27 73 |ates.Bin|Prolog's|
|00002080| 20 60 63 6f 70 79 2d 6f | 6e 63 65 27 20 68 65 61 | `copy-o|nce' hea|
|00002090| 70 2d 62 61 73 65 64 20 | 7b 5c 74 74 20 66 69 6e |p-based |{\tt fin|
|000020a0| 64 61 6c 6c 2f 33 7d 20 | 61 6e 64 20 7b 5c 74 74 |dall/3} |and {\tt|
|000020b0| 20 66 69 6e 64 61 6c 6c | 2f 34 7d 0a 73 6f 20 74 | findall|/4}.so t|
|000020c0| 68 61 74 20 66 69 6e 64 | 61 6c 6c 2d 69 6e 74 65 |hat find|all-inte|
|000020d0| 6e 73 69 76 65 20 70 72 | 6f 67 72 61 6d 73 20 6d |nsive pr|ograms m|
|000020e0| 61 79 20 72 75 6e 20 32 | 2d 33 20 74 69 6d 65 73 |ay run 2|-3 times|
|000020f0| 20 66 61 73 74 65 72 20 | 69 6e 0a 42 69 6e 50 72 | faster |in.BinPr|
|00002100| 6f 6c 6f 67 20 74 68 61 | 6e 20 69 6e 20 6f 74 68 |olog tha|n in oth|
|00002110| 65 72 20 28 65 76 65 6e | 20 6e 61 74 69 76 65 20 |er (even| native |
|00002120| 63 6f 64 65 29 20 69 6d | 70 6c 65 6d 65 6e 74 61 |code) im|plementa|
|00002130| 74 69 6f 6e 73 2e 0a 0a | 41 6c 6c 20 64 61 74 61 |tions...|All data|
|00002140| 20 61 72 65 61 73 20 61 | 72 65 20 6e 6f 77 20 75 | areas a|re now u|
|00002150| 73 65 72 20 63 6f 6e 66 | 69 67 75 72 61 62 6c 65 |ser conf|igurable|
|00002160| 2c 20 61 6e 64 20 61 6c | 6c 20 65 78 63 65 70 74 |, and al|l except|
|00002170| 20 74 68 65 20 68 65 61 | 70 20 61 72 65 0a 67 61 | the hea|p are.ga|
|00002180| 72 62 61 67 65 20 63 6f | 6c 6c 65 63 74 65 64 2e |rbage co|llected.|
|00002190| 20 41 20 67 61 72 62 61 | 67 65 20 63 6f 6c 6c 65 | A garba|ge colle|
|000021a0| 63 74 6f 72 20 66 6f 72 | 20 74 68 65 20 68 65 61 |ctor for| the hea|
|000021b0| 70 20 77 69 6c 6c 20 62 | 65 20 72 65 6c 65 61 73 |p will b|e releas|
|000021c0| 65 64 0a 73 6f 6f 6e 2e | 0a 0a 41 6c 74 68 6f 75 |ed.soon.|..Althou|
|000021d0| 67 68 20 6f 74 68 65 72 | 20 50 72 6f 6c 6f 67 27 |gh other| Prolog'|
|000021e0| 73 20 61 73 73 65 72 74 | 20 61 6e 64 20 72 65 74 |s assert| and ret|
|000021f0| 72 61 63 74 20 70 72 69 | 6d 69 74 69 76 65 73 20 |ract pri|mitives |
|00002200| 61 72 65 20 65 6d 75 6c | 61 74 65 64 20 69 6e 0a |are emul|ated in.|
|00002210| 42 69 6e 50 72 6f 6c 6f | 67 2c 20 74 68 65 69 72 |BinProlo|g, their|
|00002220| 20 66 75 6e 63 74 69 6f | 6e 61 6c 69 74 79 20 68 | functio|nality h|
|00002230| 61 73 20 62 65 65 6e 20 | 64 65 63 6f 6d 70 6f 73 |as been |decompos|
|00002240| 65 64 20 69 6e 0a 73 65 | 70 61 72 61 74 65 20 73 |ed in.se|parate s|
|00002250| 69 6d 70 6c 65 72 20 6f | 70 65 72 61 74 69 6f 6e |impler o|peration|
|00002260| 73 20 74 68 61 74 20 67 | 69 76 65 20 61 6c 73 6f |s that g|ive also|
|00002270| 20 69 6d 70 72 6f 76 65 | 64 20 65 66 66 69 63 69 | improve|d effici|
|00002280| 65 6e 63 79 2e 0a 0a 46 | 6f 72 20 70 65 72 6d 61 |ency...F|or perma|
|00002290| 6e 65 6e 74 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |nent inf|ormation|
|000022a0| 20 42 69 6e 50 72 6f 6c | 6f 67 20 68 61 73 20 61 | BinProl|og has a|
|000022b0| 20 6e 65 77 2c 20 67 61 | 72 62 61 67 65 2d 63 6f | new, ga|rbage-co|
|000022c0| 6c 6c 65 63 74 65 64 20 | 64 61 74 61 0a 61 72 65 |llected |data.are|
|000022d0| 61 20 74 68 65 20 7b 5c | 65 6d 20 62 6c 61 63 6b |a the {\|em black|
|000022e0| 62 6f 61 72 64 7d 20 77 | 68 65 72 65 20 74 65 72 |board} w|here ter|
|000022f0| 6d 73 20 63 61 6e 20 62 | 65 20 73 74 6f 72 65 64 |ms can b|e stored|
|00002300| 20 61 6e 64 20 61 63 63 | 65 73 73 65 64 0a 65 66 | and acc|essed.ef|
|00002310| 66 69 63 69 65 6e 74 6c | 79 20 77 69 74 68 20 61 |ficientl|y with a|
|00002320| 20 61 20 32 2d 6b 65 79 | 20 68 61 73 68 69 6e 67 | a 2-key| hashing|
|00002330| 20 66 75 6e 63 74 69 6f | 6e 20 75 73 69 6e 67 20 | functio|n using |
|00002340| 73 6f 6d 65 74 68 69 6e | 67 20 6c 69 6b 65 0a 0a |somethin|g like..|
|00002350| 5c 62 65 67 69 6e 7b 76 | 65 72 62 61 74 69 6d 7d |\begin{v|erbatim}|
|00002360| 0a 3f 2d 62 62 5f 64 65 | 66 28 6c 69 6b 65 73 2c |.?-bb_de|f(likes,|
|00002370| 6a 6f 65 2c 5b 61 6e 79 | 28 62 65 65 72 29 2c 67 |joe,[any|(beer),g|
|00002380| 6f 6f 64 28 76 69 6e 65 | 29 2c 76 65 67 65 74 61 |ood(vine|),vegeta|
|00002390| 72 69 61 6e 28 66 6f 6f | 64 29 5d 29 2e 0a 5c 65 |rian(foo|d)])..\e|
|000023a0| 6e 64 7b 76 65 72 62 61 | 74 69 6d 7d 0a 0a 61 6e |nd{verba|tim}..an|
|000023b0| 64 20 75 70 64 61 74 65 | 64 20 77 69 74 68 20 73 |d update|d with s|
|000023c0| 6f 6d 65 74 68 69 6e 67 | 20 6c 69 6b 65 0a 0a 5c |omething| like..\|
|000023d0| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0a |begin{ve|rbatim}.|
|000023e0| 3f 2d 62 62 5f 73 65 74 | 28 6c 69 6b 65 73 2c 6a |?-bb_set|(likes,j|
|000023f0| 6f 65 2c 6e 6f 74 68 69 | 6e 67 29 2e 0a 5c 65 6e |oe,nothi|ng)..\en|
|00002400| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0a 0a 6f 72 20 |d{verbat|im}..or |
|00002410| 0a 0a 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |..\begin|{verbati|
|00002420| 6d 7d 0a 3f 2d 62 62 5f | 72 6d 28 6c 69 6b 65 73 |m}.?-bb_|rm(likes|
|00002430| 2c 6a 6f 65 29 2e 0a 5c | 65 6e 64 7b 76 65 72 62 |,joe)..\|end{verb|
|00002440| 61 74 69 6d 7d 0a 0a 54 | 6f 20 67 65 74 20 69 74 |atim}..T|o get it|
|00002450| 73 20 76 61 6c 75 65 3a | 0a 0a 5c 62 65 67 69 6e |s value:|..\begin|
|00002460| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 3f 2d 62 62 5f |{verbati|m}.?-bb_|
|00002470| 76 61 6c 28 6c 69 6b 65 | 73 2c 6a 6f 65 2c 57 68 |val(like|s,joe,Wh|
|00002480| 61 74 29 2e 0a 5c 65 6e | 64 7b 76 65 72 62 61 74 |at)..\en|d{verbat|
|00002490| 69 6d 7d 0a 0a 42 69 6e | 50 72 6f 6c 6f 67 20 33 |im}..Bin|Prolog 3|
|000024a0| 2e 33 30 20 68 61 73 20 | 61 6c 73 6f 20 62 61 63 |.30 has |also bac|
|000024b0| 6b 74 72 61 63 6b 61 62 | 6c 65 20 67 6c 6f 62 61 |ktrackab|le globa|
|000024c0| 6c 20 76 61 72 69 61 62 | 6c 65 73 2c 0a 77 69 74 |l variab|les,.wit|
|000024d0| 68 20 32 2d 6b 65 79 65 | 64 20 6e 61 6d 65 73 2e |h 2-keye|d names.|
|000024e0| 0a 0a 54 72 79 3a 0a 0a | 5c 62 65 67 69 6e 7b 76 |..Try:..|\begin{v|
|000024f0| 65 72 62 61 74 69 6d 7d | 0a 3f 2d 20 50 65 72 73 |erbatim}|.?- Pers|
|00002500| 6f 6e 3d 6a 6f 65 2c 20 | 66 72 69 65 6e 64 23 50 |on=joe, |friend#P|
|00002510| 65 72 73 6f 6e 3a 3d 3a | 6d 61 72 79 2c 20 62 62 |erson:=:|mary, bb|
|00002520| 2e 0a 5c 65 6e 64 7b 76 | 65 72 62 61 74 69 6d 7d |..\end{v|erbatim}|
|00002530| 0a 0a 61 6e 64 20 74 68 | 65 6e 0a 5c 62 65 67 69 |..and th|en.\begi|
|00002540| 6e 7b 76 65 72 62 61 74 | 69 6d 7d 0a 3f 2d 20 66 |n{verbat|im}.?- f|
|00002550| 72 69 65 6e 64 20 23 20 | 6a 6f 65 3a 3d 3a 58 2e |riend # |joe:=:X.|
|00002560| 0a 5c 65 6e 64 7b 76 65 | 72 62 61 74 69 6d 7d 0a |.\end{ve|rbatim}.|
|00002570| 0a 54 68 65 20 62 6c 61 | 63 6b 62 6f 61 72 64 20 |.The bla|ckboard |
|00002580| 63 61 6e 20 62 65 20 75 | 73 65 64 20 65 69 74 68 |can be u|sed eith|
|00002590| 65 72 20 64 69 72 65 63 | 74 6c 79 20 6f 72 0a 74 |er direc|tly or.t|
|000025a0| 68 72 6f 75 67 68 20 61 | 6e 20 61 73 73 65 72 74 |hrough a|n assert|
|000025b0| 2d 72 65 74 72 61 63 74 | 20 73 74 79 6c 65 20 69 |-retract| style i|
|000025c0| 6e 74 65 72 66 61 63 65 | 2e 0a 0a 7b 5c 65 6d 20 |nterface|...{\em |
|000025d0| 41 20 73 6d 61 6c 6c 20 | 65 78 65 72 63 69 73 65 |A small |exercise|
|000025e0| 3a 7d 20 20 69 66 20 79 | 6f 75 20 77 61 6e 74 20 |:} if y|ou want |
|000025f0| 62 61 63 6b 74 72 61 63 | 6b 61 62 6c 65 20 62 65 |backtrac|kable be|
|00002600| 68 61 76 69 6f 75 72 20 | 6f 66 20 61 73 73 65 72 |haviour |of asser|
|00002610| 74 20 61 6e 64 0a 72 65 | 74 72 61 63 74 20 79 6f |t and.re|tract yo|
|00002620| 75 20 63 61 6e 20 6d 6f | 64 69 66 79 20 65 78 74 |u can mo|dify ext|
|00002630| 72 61 2e 70 6c 20 61 6e | 64 20 75 73 65 20 5c 76 |ra.pl an|d use \v|
|00002640| 65 72 62 7e 41 23 42 3a | 3d 3a 58 7e 20 73 74 79 |erb~A#B:|=:X~ sty|
|00002650| 6c 65 20 67 6c 6f 62 61 | 6c 20 76 61 72 69 61 62 |le globa|l variab|
|00002660| 6c 65 73 0a 69 6e 20 74 | 68 65 69 72 20 64 65 66 |les.in t|heir def|
|00002670| 69 6e 69 74 69 6f 6e 2c | 20 69 6e 73 74 65 61 64 |inition,| instead|
|00002680| 20 6f 66 20 7b 5c 74 74 | 20 62 62 5c 5f 64 65 66 | of {\tt| bb\_def|
|00002690| 2f 33 7d 20 65 74 63 2e | 0a 0a 54 68 65 20 62 6c |/3} etc.|..The bl|
|000026a0| 61 63 6b 62 6f 61 72 64 | 20 61 6c 73 6f 20 67 69 |ackboard| also gi|
|000026b0| 76 65 73 20 63 6f 6e 73 | 74 61 6e 74 2d 74 69 6d |ves cons|tant-tim|
|000026c0| 65 20 73 70 61 72 73 65 | 20 61 72 72 61 79 73 20 |e sparse| arrays |
|000026d0| 61 6e 64 20 6c 65 6d 6d | 61 73 2e 0a 46 6f 72 20 |and lemm|as..For |
|000026e0| 65 78 61 6d 70 6c 65 20 | 74 72 79 3a 0a 0a 5c 62 |example |try:..\b|
|000026f0| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0a 3f |egin{ver|batim}.?|
|00002700| 2d 20 66 6f 72 28 49 2c | 31 2c 39 39 29 2c 62 62 |- for(I,|1,99),bb|
|00002710| 5f 64 65 66 28 74 61 62 | 6c 65 2c 49 2c 66 28 49 |_def(tab|le,I,f(I|
|00002720| 2c 49 29 29 2c 66 61 69 | 6c 2e 0a 3f 2d 20 62 62 |,I)),fai|l..?- bb|
|00002730| 2e 0a 5c 65 6e 64 7b 76 | 65 72 62 61 74 69 6d 7d |..\end{v|erbatim}|
|00002740| 0a 0a 42 69 6e 50 72 6f | 6c 6f 67 20 33 2e 33 30 |..BinPro|log 3.30|
|00002750| 20 68 61 73 20 45 64 69 | 6e 62 75 72 67 68 20 62 | has Edi|nburgh b|
|00002760| 65 68 61 76 69 6f 75 72 | 20 61 6e 64 20 74 72 69 |ehaviour| and tri|
|00002770| 65 73 20 74 6f 20 62 65 | 20 63 6c 6f 73 65 0a 74 |es to be| close.t|
|00002780| 6f 20 53 69 63 73 74 75 | 73 20 61 6e 64 20 51 75 |o Sicstu|s and Qu|
|00002790| 69 6e 74 75 73 20 50 72 | 6f 6c 6f 67 20 6f 6e 20 |intus Pr|olog on |
|000027a0| 74 68 65 20 73 65 6d 61 | 6e 74 69 63 73 20 6f 66 |the sema|ntics of|
|000027b0| 20 62 75 69 6c 74 69 6e | 73 0a 77 69 74 68 6f 75 | builtin|s.withou|
|000027c0| 74 20 62 65 69 6e 67 20 | 74 6f 6f 20 70 65 64 61 |t being |too peda|
|000027d0| 6e 74 69 63 20 6f 6e 20 | 77 68 61 74 27 73 20 6e |ntic on |what's n|
|000027e0| 6f 74 20 72 65 61 6c 6c | 79 20 69 6d 70 6f 72 74 |ot reall|y import|
|000027f0| 61 6e 74 2e 0a 0a 41 6c | 6c 20 74 68 65 20 62 61 |ant...Al|l the ba|
|00002800| 73 69 63 20 50 72 6f 6c | 6f 67 20 75 74 69 6c 69 |sic Prol|og utili|
|00002810| 74 69 65 73 20 61 72 65 | 20 6e 6f 77 20 73 75 70 |ties are| now sup|
|00002820| 70 6f 72 74 65 64 20 28 | 64 79 6e 61 6d 69 63 20 |ported (|dynamic |
|00002830| 63 6c 61 75 73 65 73 2c | 20 61 0a 6d 65 74 61 69 |clauses,| a.metai|
|00002840| 6e 74 65 72 70 72 65 74 | 65 72 20 77 69 74 68 20 |nterpret|er with |
|00002850| 74 72 61 63 69 6e 67 20 | 66 61 63 69 6c 69 74 79 |tracing |facility|
|00002860| 2c 20 73 6f 72 74 2c 20 | 73 65 74 6f 66 2c 20 64 |, sort, |setof, d|
|00002870| 79 6e 61 6d 69 63 20 6f | 70 65 72 61 74 6f 72 73 |ynamic o|perators|
|00002880| 0a 66 6c 6f 61 74 69 6e | 67 20 70 6f 69 6e 74 20 |.floatin|g point |
|00002890| 6f 70 65 72 61 74 69 6f | 6e 73 20 61 6e 64 20 66 |operatio|ns and f|
|000028a0| 75 6e 63 74 69 6f 6e 73 | 29 2e 0a 0a 41 20 66 61 |unctions|)...A fa|
|000028b0| 73 74 0a 64 65 74 65 72 | 6d 69 6e 69 73 74 69 63 |st.deter|ministic|
|000028c0| 20 61 70 70 65 6e 64 20 | 5c 76 65 72 62 7e 64 65 | append |\verb~de|
|000028d0| 74 5f 61 70 70 65 6e 64 | 2f 33 20 28 69 2c 69 2c |t_append|/3 (i,i,|
|000028e0| 6f 29 7e 20 68 61 73 20 | 62 65 65 6e 20 61 64 64 |o)~ has |been add|
|000028f0| 65 64 2e 20 4e 61 69 76 | 65 0a 72 65 76 65 72 73 |ed. Naiv|e.revers|
|00002900| 65 20 75 73 69 6e 67 20 | 5c 76 65 72 62 7e 64 65 |e using |\verb~de|
|00002910| 74 5f 61 70 70 65 6e 64 | 2f 33 7e 20 6d 61 6b 65 |t_append|/3~ make|
|00002920| 73 20 6d 6f 72 65 20 74 | 68 61 6e 20 33 20 4d 65 |s more t|han 3 Me|
|00002930| 67 61 4c 49 50 53 20 6f | 6e 20 61 0a 53 70 61 72 |gaLIPS o|n a.Spar|
|00002940| 63 20 32 30 2d 34 31 20 | 28 61 20 33 2d 74 69 6d |c 20-41 |(a 3-tim|
|00002950| 65 73 20 73 70 65 65 64 | 2d 75 70 29 2e 0a 0a 41 |es speed|-up)...A|
|00002960| 6c 6d 6f 73 74 20 61 6c | 6c 20 74 68 65 20 62 75 |lmost al|l the bu|
|00002970| 69 6c 74 69 6e 73 20 61 | 72 65 20 6e 6f 77 20 65 |iltins a|re now e|
|00002980| 78 70 61 6e 64 65 64 20 | 69 6e 6c 69 6e 65 20 72 |xpanded |inline r|
|00002990| 65 73 75 6c 74 69 6e 67 | 20 69 6e 20 69 6d 70 72 |esulting| in impr|
|000029a0| 6f 76 65 64 0a 68 65 61 | 70 20 63 6f 6e 73 75 6d |oved.hea|p consum|
|000029b0| 70 74 69 6f 6e 20 61 6e | 64 20 70 65 72 66 6f 72 |ption an|d perfor|
|000029c0| 6d 61 6e 63 65 2e 0a 0a | 41 20 66 65 77 20 70 72 |mance...|A few pr|
|000029d0| 6f 67 72 61 6d 73 20 28 | 61 6e 20 61 75 74 6f 6d |ograms (|an autom|
|000029e0| 61 74 69 63 20 54 65 74 | 72 69 73 20 70 6c 61 79 |atic Tet|ris play|
|000029f0| 65 72 2c 20 61 20 6b 6e | 69 67 68 74 2d 74 6f 75 |er, a kn|ight-tou|
|00002a00| 72 2c 20 61 6e 0a 4f 52 | 2d 70 61 72 61 6c 6c 65 |r, an.OR|-paralle|
|00002a10| 6c 20 73 69 6d 75 6c 61 | 74 6f 72 2c 20 46 69 62 |l simula|tor, Fib|
|00002a20| 6f 6e 61 63 63 69 2c 20 | 54 61 6b 20 77 69 74 68 |onacci, |Tak with|
|00002a30| 20 6c 65 6d 6d 61 73 2c | 20 61 20 73 6d 61 6c 6c | lemmas,| a small|
|00002a40| 20 6e 65 75 72 61 6c 2d | 6e 65 74 0a 73 69 6d 75 | neural-|net.simu|
|00002a50| 6c 61 74 6f 72 20 62 61 | 63 6b 70 72 6f 70 2e 70 |lator ba|ckprop.p|
|00002a60| 6c 29 20 69 6c 6c 75 73 | 74 72 61 74 65 20 73 6f |l) illus|trate so|
|00002a70| 6d 65 20 6f 66 20 74 68 | 65 20 6e 65 77 20 66 65 |me of th|e new fe|
|00002a80| 61 74 75 72 65 73 2e 20 | 41 20 66 65 77 20 77 65 |atures. |A few we|
|00002a90| 6c 6c 2d 6b 6e 6f 77 6e | 0a 62 65 6e 63 68 6d 61 |ll-known|.benchma|
|00002aa0| 72 6b 73 20 68 61 76 65 | 20 62 65 65 6e 20 61 64 |rks have| been ad|
|00002ab0| 64 65 64 20 74 6f 20 68 | 65 6c 70 20 63 6f 6d 70 |ded to h|elp comp|
|00002ac0| 61 72 65 20 42 69 6e 50 | 72 6f 6c 6f 67 20 77 69 |are BinP|rolog wi|
|00002ad0| 74 68 20 6f 74 68 65 72 | 0a 69 6d 70 6c 65 6d 65 |th other|.impleme|
|00002ae0| 6e 74 61 74 69 6f 6e 73 | 2e 0a 0a 42 69 6e 50 72 |ntations|...BinPr|
|00002af0| 6f 6c 6f 67 20 68 61 73 | 20 73 75 70 70 6f 72 74 |olog has| support|
|00002b00| 65 64 20 66 72 6f 6d 20 | 73 74 61 72 74 20 33 30 |ed from |start 30|
|00002b10| 20 62 69 74 20 69 6e 74 | 65 67 65 72 20 61 72 69 | bit int|eger ari|
|00002b20| 74 68 6d 65 74 69 63 2e | 0a 4e 6f 77 20 69 74 20 |thmetic.|.Now it |
|00002b30| 68 61 73 20 61 6c 73 6f | 20 7b 5c 65 6d 20 66 6c |has also| {\em fl|
|00002b40| 6f 61 74 69 6e 67 20 70 | 6f 69 6e 74 20 6f 70 65 |oating p|oint ope|
|00002b50| 72 61 74 69 6f 6e 73 7d | 20 61 6e 64 20 66 75 6e |rations}| and fun|
|00002b60| 63 74 69 6f 6e 73 20 6c | 69 6b 65 0a 73 69 6e 2c |ctions l|ike.sin,|
|00002b70| 20 63 6f 73 2c 20 74 61 | 6e 2c 20 6c 6f 67 2c 20 | cos, ta|n, log, |
|00002b80| 65 78 70 2c 20 70 6f 77 | 2c 20 65 74 63 2e 0a 54 |exp, pow|, etc..T|
|00002b90| 68 65 79 20 63 61 6e 20 | 62 65 20 75 73 65 64 20 |hey can |be used |
|00002ba0| 65 69 74 68 65 72 20 74 | 68 72 6f 75 67 68 20 74 |either t|hrough t|
|00002bb0| 68 65 20 69 73 2f 32 20 | 69 6e 74 65 72 66 61 63 |he is/2 |interfac|
|00002bc0| 65 5c 66 6f 6f 74 6e 6f | 74 65 7b 49 73 2f 32 20 |e\footno|te{Is/2 |
|00002bd0| 6e 6f 77 0a 61 63 63 65 | 70 74 73 20 65 78 65 63 |now.acce|pts exec|
|00002be0| 75 74 69 6f 6e 20 6f 66 | 20 61 6e 79 20 70 72 65 |ution of| any pre|
|00002bf0| 64 69 63 61 74 65 20 6f | 66 20 61 72 69 74 79 20 |dicate o|f arity |
|00002c00| 24 6e 2b 31 24 20 61 73 | 20 61 20 66 75 6e 63 74 |$n+1$ as| a funct|
|00002c10| 69 6f 6e 0a 6f 66 20 61 | 72 69 74 79 20 24 6e 24 |ion.of a|rity $n$|
|00002c20| 2e 7d 3a 0a 0a 5c 62 65 | 67 69 6e 7b 76 65 72 62 |.}:..\be|gin{verb|
|00002c30| 61 74 69 6d 7d 0a 3f 2d | 20 58 20 69 73 20 63 6f |atim}.?-| X is co|
|00002c40| 73 28 33 2e 31 34 29 2b | 73 69 6e 28 30 29 2e 0a |s(3.14)+|sin(0)..|
|00002c50| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0a 0a |\end{ver|batim}..|
|00002c60| 6f 72 20 69 6e 20 72 65 | 6c 61 74 69 6f 6e 61 6c |or in re|lational|
|00002c70| 20 66 6f 72 6d 0a 0a 5c | 62 65 67 69 6e 7b 76 65 | form..\|begin{ve|
|00002c80| 72 62 61 74 69 6d 7d 0a | 3f 2d 20 63 6f 73 28 31 |rbatim}.|?- cos(1|
|00002c90| 2c 58 29 2e 0a 5c 65 6e | 64 7b 76 65 72 62 61 74 |,X)..\en|d{verbat|
|00002ca0| 69 6d 7d 0a 0a 4e 6f 74 | 65 20 74 68 61 74 20 79 |im}..Not|e that y|
|00002cb0| 6f 75 20 73 68 6f 75 6c | 64 20 75 73 65 20 73 6f |ou shoul|d use so|
|00002cc0| 6d 65 74 68 69 6e 67 20 | 6c 69 6b 65 20 5c 76 65 |mething |like \ve|
|00002cd0| 72 62 7e 59 3d 33 2b 34 | 2c 20 58 20 69 73 20 31 |rb~Y=3+4|, X is 1|
|00002ce0| 2b 65 78 70 72 28 59 29 | 7e 0a 69 6e 73 74 65 61 |+expr(Y)|~.instea|
|00002cf0| 64 20 6f 66 20 5c 76 65 | 72 62 7e 59 3d 33 2b 34 |d of \ve|rb~Y=3+4|
|00002d00| 2c 20 58 20 69 73 20 31 | 2b 59 7e 20 77 68 69 63 |, X is 1|+Y~ whic|
|00002d10| 68 20 77 69 6c 6c 20 6e | 6f 74 20 77 6f 72 6b 20 |h will n|ot work |
|00002d20| 69 6e 20 63 6f 6d 70 69 | 6c 65 64 20 63 6f 64 65 |in compi|led code|
|00002d30| 2e 0a 0a 46 6c 6f 61 74 | 69 6e 67 20 70 6f 69 6e |...Float|ing poin|
|00002d40| 74 20 77 6f 72 6b 73 20 | 68 61 73 20 74 68 65 20 |t works |has the |
|00002d50| 73 61 6d 65 20 70 72 65 | 63 69 73 69 6f 6e 20 61 |same pre|cision a|
|00002d60| 6e 64 20 73 65 6d 61 6e | 74 69 63 73 0a 61 73 20 |nd seman|tics.as |
|00002d70| 74 68 65 20 74 79 70 65 | 20 64 6f 75 62 6c 65 20 |the type| double |
|00002d80| 69 6e 20 43 2e 0a 46 6c | 6f 61 74 69 6e 67 20 70 |in C..Fl|oating p|
|00002d90| 6f 69 6e 74 20 6f 70 65 | 72 61 74 69 6f 6e 73 20 |oint ope|rations |
|00002da0| 61 72 65 20 63 6c 6f 73 | 65 20 69 6e 20 73 70 65 |are clos|e in spe|
|00002db0| 65 64 20 74 6f 20 65 6d | 75 6c 61 74 65 64 20 53 |ed to em|ulated S|
|00002dc0| 69 63 73 74 75 73 2e 0a | 54 6f 20 74 72 79 20 74 |icstus..|To try t|
|00002dd0| 68 65 6d 20 6f 75 74 20 | 75 73 65 20 74 68 65 20 |hem out |use the |
|00002de0| 74 6f 79 20 6e 65 75 72 | 61 6c 2d 6e 65 74 77 6f |toy neur|al-netwo|
|00002df0| 72 6b 20 73 69 6d 75 6c | 61 74 6f 72 20 5c 76 65 |rk simul|ator \ve|
|00002e00| 72 62 7e 62 70 2e 70 6c | 2e 7e 0a 54 68 69 73 20 |rb~bp.pl|.~.This |
|00002e10| 70 72 6f 67 72 61 6d 20 | 75 73 65 73 20 61 6c 73 |program |uses als|
|00002e20| 6f 20 63 6f 6e 73 74 61 | 6e 74 20 74 69 6d 65 20 |o consta|nt time |
|00002e30| 61 72 72 61 79 73 20 61 | 6e 64 20 69 73 20 74 68 |arrays a|nd is th|
|00002e40| 65 72 65 66 6f 72 65 0a | 75 6e 75 73 75 61 6c 6c |erefore.|unusuall|
|00002e50| 79 20 66 61 73 74 20 63 | 6f 6d 70 61 72 65 64 20 |y fast c|ompared |
|00002e60| 74 6f 20 69 74 73 20 65 | 78 65 63 75 74 69 6f 6e |to its e|xecution|
|00002e70| 20 69 6e 20 6f 74 68 65 | 72 20 50 72 6f 6c 6f 67 | in othe|r Prolog|
|00002e80| 73 20 6c 69 6b 65 0a 51 | 75 69 6e 74 75 73 20 6f |s like.Q|uintus o|
|00002e90| 72 20 53 69 63 73 74 75 | 73 2e 0a 0a 5c 73 75 62 |r Sicstu|s...\sub|
|00002ea0| 73 65 63 74 69 6f 6e 7b | 54 68 65 20 69 6e 74 65 |section{|The inte|
|00002eb0| 72 61 63 74 69 76 65 20 | 74 6f 70 6c 65 76 65 6c |ractive |toplevel|
|00002ec0| 20 73 68 65 6c 6c 7d 0a | 0a 54 6f 20 73 65 65 20 | shell}.|.To see |
|00002ed0| 74 68 65 20 63 6f 6d 6d | 61 6e 64 20 6c 69 6e 65 |the comm|and line|
|00002ee0| 20 6f 70 74 69 6f 6e 73 | 3a 0a 0a 5c 76 65 72 62 | options|:..\verb|
|00002ef0| 7e 20 20 24 20 62 70 20 | 2d 68 65 6c 70 7e 0a 0a |~ $ bp |-help~..|
|00002f00| 7b 5c 66 6c 75 73 68 6c | 65 66 74 20 54 6f 7d 20 |{\flushl|eft To} |
|00002f10| 63 6f 6d 70 69 6c 65 20 | 61 6e 64 20 6c 6f 61 64 |compile |and load|
|00002f20| 20 5c 76 65 72 62 7e 3c | 66 69 6c 65 3e 7e 20 6f | \verb~<|file>~ o|
|00002f30| 72 20 0a 5c 76 65 72 62 | 7e 3c 66 69 6c 65 3e 2e |r .\verb|~<file>.|
|00002f40| 70 6c 7e 20 6f 72 20 5c | 76 65 72 62 7e 3c 66 69 |pl~ or \|verb~<fi|
|00002f50| 6c 65 3e 2e 70 72 6f 7e | 3a 20 0a 0a 5c 76 65 72 |le>.pro~|: ..\ver|
|00002f60| 62 7e 20 20 3f 2d 5b 3c | 66 69 6c 65 3e 5d 2e 7e |b~ ?-[<|file>].~|
|00002f70| 0a 0a 7b 5c 66 6c 75 73 | 68 6c 65 66 74 20 42 69 |..{\flus|hleft Bi|
|00002f80| 6e 50 72 6f 6c 6f 67 7d | 20 73 65 61 72 63 68 65 |nProlog}| searche|
|00002f90| 73 20 74 68 65 6d 20 69 | 6e 20 74 68 65 20 64 69 |s them i|n the di|
|00002fa0| 72 65 63 74 6f 72 69 65 | 73 20 7b 5c 74 74 20 2e |rectorie|s {\tt .|
|00002fb0| 2c 20 2e 2f 70 72 6f 67 | 73 7d 0a 20 61 6e 64 20 |, ./prog|s}. and |
|00002fc0| 7b 5c 74 74 20 2e 2f 6d | 79 70 72 6f 67 73 2c 20 |{\tt ./m|yprogs, |
|00002fd0| 2e 2e 2f 73 72 63 20 2e | 2e 2f 6c 69 62 72 61 72 |../src .|./librar|
|00002fe0| 79 7d 2e 0a 0a 5c 73 75 | 62 73 65 63 74 69 6f 6e |y}...\su|bsection|
|00002ff0| 7b 52 65 61 6c 20 73 74 | 61 6e 64 61 6c 6f 6e 65 |{Real st|andalone|
|00003000| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 73 20 74 68 | applica|tions th|
|00003010| 72 6f 75 67 68 20 63 6f | 6d 70 69 6c 61 74 69 6f |rough co|mpilatio|
|00003020| 6e 20 74 6f 20 43 7d 0a | 0a 53 74 61 72 74 69 6e |n to C}.|.Startin|
|00003030| 67 20 77 69 74 68 20 76 | 65 72 73 69 6f 6e 20 33 |g with v|ersion 3|
|00003040| 2e 33 30 20 69 74 20 69 | 73 20 70 6f 73 73 69 62 |.30 it i|s possib|
|00003050| 6c 65 20 74 6f 20 73 65 | 70 61 72 61 74 65 6c 79 |le to se|parately|
|00003060| 20 63 6f 6d 70 69 6c 65 | 20 75 73 65 72 0a 61 70 | compile| user.ap|
|00003070| 70 6c 69 63 61 74 69 6f | 6e 73 20 61 6e 64 20 6a |plicatio|ns and j|
|00003080| 75 73 74 20 6c 69 6e 6b | 20 74 68 65 6d 20 77 69 |ust link| them wi|
|00003090| 74 68 20 74 68 65 20 65 | 6d 75 6c 61 74 6f 72 20 |th the e|mulator |
|000030a0| 6c 69 62 72 61 72 79 20 | 61 6e 64 20 74 68 65 0a |library |and the.|
|000030b0| 43 2d 69 66 69 65 64 20 | 63 6f 6d 70 69 6c 65 72 |C-ified |compiler|
|000030c0| 20 28 73 65 65 20 64 69 | 72 65 63 74 6f 72 79 20 | (see di|rectory |
|000030d0| 5c 76 65 72 62 7e 70 6c | 32 63 7e 29 2e 20 20 54 |\verb~pl|2c~). T|
|000030e0| 68 69 73 20 61 6c 6c 6f | 77 73 20 63 72 65 61 74 |his allo|ws creat|
|000030f0| 69 6f 6e 20 6f 66 0a 61 | 20 66 75 6c 6c 79 20 43 |ion of.a| fully C|
|00003100| 2d 69 66 69 65 64 20 61 | 70 70 6c 69 63 61 74 69 |-ified a|pplicati|
|00003110| 6f 6e 20 69 6e 20 61 20 | 66 65 77 20 73 65 63 6f |on in a |few seco|
|00003120| 6e 64 73 2e 0a 0a 4a 75 | 73 74 20 74 79 70 65 20 |nds...Ju|st type |
|00003130| 5c 76 65 72 62 7e 6d 61 | 6b 65 20 50 52 4f 4a 3d |\verb~ma|ke PROJ=|
|00003140| 71 75 65 65 6e 73 7e 20 | 69 6e 20 64 69 72 65 63 |queens~ |in direc|
|00003150| 74 6f 72 79 20 5c 76 65 | 72 62 7e 70 6c 32 63 7e |tory \ve|rb~pl2c~|
|00003160| 2e 0a 54 68 65 20 73 74 | 61 6e 64 61 6c 6f 6e 65 |..The st|andalone|
|00003170| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 5c 76 65 | applica|tion \ve|
|00003180| 72 62 7e 71 75 65 65 6e | 73 7e 20 69 73 20 72 65 |rb~queen|s~ is re|
|00003190| 61 64 79 20 74 6f 20 62 | 65 20 65 78 65 63 75 74 |ady to b|e execut|
|000031a0| 65 64 0a 62 79 20 74 79 | 70 69 6e 67 20 5c 76 65 |ed.by ty|ping \ve|
|000031b0| 72 62 7e 71 75 65 65 6e | 73 7e 2e 0a 54 68 65 20 |rb~queen|s~..The |
|000031c0| 67 65 6e 65 72 61 74 65 | 64 20 43 2d 63 6f 64 65 |generate|d C-code|
|000031d0| 20 63 61 6e 20 62 65 20 | 73 65 65 6e 20 69 6e 20 | can be |seen in |
|000031e0| 66 69 6c 65 73 0a 5c 76 | 65 72 62 7e 71 75 65 65 |files.\v|erb~quee|
|000031f0| 6e 73 2e 68 7e 20 61 6e | 64 20 5c 76 65 72 62 7e |ns.h~ an|d \verb~|
|00003200| 71 75 65 65 6e 73 2e 63 | 7e 2e 0a 0a 4d 6f 72 65 |queens.c|~...More|
|00003210| 6f 76 65 72 2c 20 6f 6e | 20 73 79 73 74 65 6d 73 |over, on| systems|
|00003220| 20 77 69 74 68 20 64 79 | 6e 61 6d 69 63 20 6c 69 | with dy|namic li|
|00003230| 6e 6b 69 6e 67 20 6c 69 | 6b 65 20 53 6f 6c 61 72 |nking li|ke Solar|
|00003240| 69 73 20 32 2e 78 20 0a | 74 72 75 65 20 65 78 65 |is 2.x .|true exe|
|00003250| 63 75 74 61 62 6c 65 73 | 20 6f 66 20 73 69 7a 65 |cutables| of size|
|00003260| 20 73 74 61 72 74 69 6e | 67 20 61 74 20 61 62 6f | startin|g at abo|
|00003270| 75 74 20 36 4b 20 63 61 | 6e 20 62 65 20 63 72 65 |ut 6K ca|n be cre|
|00003280| 61 74 65 64 20 73 74 61 | 72 74 69 6e 67 0a 77 69 |ated sta|rting.wi|
|00003290| 74 68 20 76 65 72 73 69 | 6f 6e 20 33 2e 33 30 20 |th versi|on 3.30 |
|000032a0| 28 73 65 65 20 64 69 72 | 65 63 74 6f 72 79 20 5c |(see dir|ectory \|
|000032b0| 76 65 72 62 7e 64 79 6e | 6c 69 62 32 63 7e 29 2e |verb~dyn|lib2c~).|
|000032c0| 0a 0a 49 66 20 79 6f 75 | 20 64 65 66 69 6e 65 20 |..If you| define |
|000032d0| 61 20 70 72 65 64 69 63 | 61 74 65 20 5c 76 65 72 |a predic|ate \ver|
|000032e0| 62 7e 6d 61 69 6e 2f 30 | 7e 20 74 68 65 6e 20 79 |b~main/0|~ then y|
|000032f0| 6f 75 72 0a 65 78 65 63 | 75 74 61 62 6c 65 20 77 |our.exec|utable w|
|00003300| 69 6c 6c 20 73 74 61 72 | 74 20 64 69 72 65 63 74 |ill star|t direct|
|00003310| 6c 79 20 66 72 6f 6d 20 | 74 68 65 72 65 20 69 6e |ly from |there in|
|00003320| 73 74 65 61 64 0a 6f 66 | 20 74 68 65 20 75 73 75 |stead.of| the usu|
|00003330| 61 6c 20 69 6e 74 65 72 | 61 63 74 69 76 65 20 74 |al inter|active t|
|00003340| 6f 70 2d 6c 65 76 65 6c | 2e 20 43 61 6c 6c 69 6e |op-level|. Callin|
|00003350| 67 20 69 74 20 77 69 74 | 68 20 61 20 68 69 67 68 |g it wit|h a high|
|00003360| 0a 71 75 69 65 74 6e 65 | 73 73 2d 6c 65 76 65 6c |.quietne|ss-level|
|00003370| 20 28 69 2e 65 2e 20 63 | 6f 6d 6d 61 6e 64 20 6c | (i.e. c|ommand l|
|00003380| 69 6e 65 20 73 77 69 74 | 63 68 20 5c 76 65 72 62 |ine swit|ch \verb|
|00003390| 7e 2d 71 35 7e 29 20 77 | 69 6c 6c 0a 73 75 70 70 |~-q5~) w|ill.supp|
|000033a0| 72 65 73 73 20 77 61 72 | 6e 69 6e 67 73 20 61 6e |ress war|nings an|
|000033b0| 64 20 75 6e 77 61 6e 74 | 65 64 20 6d 65 73 73 61 |d unwant|ed messa|
|000033c0| 67 65 73 2e 0a 0a 5c 73 | 75 62 73 65 63 74 69 6f |ges...\s|ubsectio|
|000033d0| 6e 7b 55 6e 69 78 20 70 | 73 65 75 64 6f 2d 65 78 |n{Unix p|seudo-ex|
|000033e0| 65 63 75 74 61 62 6c 65 | 73 7d 0a 0a 54 68 65 20 |ecutable|s}..The |
|000033f0| 66 6f 6c 6c 6f 77 69 6e | 67 20 73 74 69 6c 6c 20 |followin|g still |
|00003400| 77 6f 72 6b 73 2c 20 61 | 6c 74 68 6f 75 67 68 20 |works, a|lthough |
|00003410| 74 68 65 20 6e 65 77 20 | 43 2d 69 66 69 63 61 74 |the new |C-ificat|
|00003420| 69 6f 6e 20 74 65 63 68 | 6e 69 71 75 65 0a 28 73 |ion tech|nique.(s|
|00003430| 65 65 20 64 69 72 65 63 | 74 6f 72 69 65 73 20 70 |ee direc|tories p|
|00003440| 6c 32 63 2c 20 64 79 6e | 70 6c 32 63 29 20 63 61 |l2c, dyn|pl2c) ca|
|00003450| 6e 20 6e 6f 77 20 63 72 | 65 61 74 65 20 74 72 75 |n now cr|eate tru|
|00003460| 65 20 6f 6e 65 2d 66 69 | 6c 65 20 73 74 61 6e 64 |e one-fi|le stand|
|00003470| 61 6c 6f 6e 65 73 2e 0a | 0a 7b 5c 66 6c 75 73 68 |alones..|.{\flush|
|00003480| 6c 65 66 74 20 49 74 7d | 20 69 73 20 70 6f 73 73 |left It}| is poss|
|00003490| 69 62 6c 65 20 74 6f 20 | 63 72 65 61 74 65 20 28 |ible to |create (|
|000034a0| 61 73 20 69 6e 20 74 68 | 65 20 70 61 73 74 29 0a |as in th|e past).|
|000034b0| 61 20 73 6d 61 6c 6c 20 | 72 75 6e 74 69 6d 65 20 |a small |runtime |
|000034c0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 66 72 6f 6d |applicat|ion from|
|000034d0| 20 5c 76 65 72 62 7e 3c | 66 69 6c 65 3e 7e 20 6f | \verb~<|file>~ o|
|000034e0| 72 20 0a 5c 76 65 72 62 | 7e 3c 66 69 6c 65 3e 2e |r .\verb|~<file>.|
|000034f0| 70 6c 7e 20 61 73 20 66 | 6f 6c 6c 6f 77 73 3a 0a |pl~ as f|ollows:.|
|00003500| 0a 5c 62 65 67 69 6e 7b | 76 65 72 62 61 74 69 6d |.\begin{|verbatim|
|00003510| 7d 0a 20 20 3f 2d 6d 61 | 6b 65 5f 61 70 70 6c 28 |}. ?-ma|ke_appl(|
|00003520| 3c 66 69 6c 65 3e 29 2e | 0a 5c 65 6e 64 7b 76 65 |<file>).|.\end{ve|
|00003530| 72 62 61 74 69 6d 7d 0a | 0a 7b 5c 66 6c 75 73 68 |rbatim}.|.{\flush|
|00003540| 6c 65 66 74 20 4e 6f 74 | 65 3a 7d 20 74 68 65 20 |left Not|e:} the |
|00003550| 66 69 6c 65 20 6d 75 73 | 74 20 63 6f 6e 74 61 69 |file mus|t contai|
|00003560| 6e 20 61 20 63 6c 61 75 | 73 65 0a 0a 5c 62 65 67 |n a clau|se..\beg|
|00003570| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0a 20 20 20 |in{verba|tim}. |
|00003580| 6d 61 69 6e 28 58 29 3a | 2d 2e 2e 2e 0a 5c 65 6e |main(X):|-....\en|
|00003590| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0a 0a 7b 5c 66 |d{verbat|im}..{\f|
|000035a0| 6c 75 73 68 6c 65 66 74 | 20 54 68 61 74 27 73 7d |lushleft| That's}|
|000035b0| 20 77 68 65 72 65 20 65 | 78 65 63 75 74 69 6f 6e | where e|xecution|
|000035c0| 20 73 74 61 72 74 73 2e | 20 42 69 6e 50 72 6f 6c | starts.| BinProl|
|000035d0| 6f 67 27 73 20 73 68 65 | 6c 6c 0a 28 74 68 65 20 |og's she|ll.(the |
|000035e0| 70 72 65 63 6f 6d 70 69 | 6c 65 64 20 77 61 6d 2e |precompi|led wam.|
|000035f0| 62 70 29 20 66 69 6c 65 | 20 69 73 20 6e 6f 74 68 |bp) file| is noth|
|00003600| 69 6e 67 20 62 75 74 20 | 73 75 63 68 20 61 6e 20 |ing but |such an |
|00003610| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 77 68 69 63 |applicat|ion whic|
|00003620| 68 0a 73 74 61 72 74 73 | 20 77 69 74 68 20 61 20 |h.starts| with a |
|00003630| 74 6f 70 6c 65 76 65 6c | 20 6c 6f 6f 70 20 69 2e |toplevel| loop i.|
|00003640| 65 2e 20 73 6f 6d 65 74 | 68 69 6e 67 20 6c 69 6b |e. somet|hing lik|
|00003650| 65 3a 0a 0a 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |e:..\beg|in{verba|
|00003660| 74 69 6d 7d 0a 20 20 20 | 6d 61 69 6e 28 58 29 3a |tim}. |main(X):|
|00003670| 2d 74 6f 70 6c 65 76 65 | 6c 28 58 29 2e 0a 5c 65 |-topleve|l(X)..\e|
|00003680| 6e 64 7b 76 65 72 62 61 | 74 69 6d 7d 0a 0a 7b 5c |nd{verba|tim}..{\|
|00003690| 66 6c 75 73 68 6c 65 66 | 74 20 44 65 6c 69 76 65 |flushlef|t Delive|
|000036a0| 72 7d 20 74 68 65 20 61 | 70 70 72 6f 70 72 69 61 |r} the a|ppropria|
|000036b0| 74 65 20 77 61 6d 20 72 | 75 20 6f 72 20 72 75 2e |te wam r|u or ru.|
|000036c0| 65 78 65 20 66 69 6c 65 | 20 28 74 68 65 20 50 72 |exe file| (the Pr|
|000036d0| 6f 6c 6f 67 20 65 6e 67 | 69 6e 65 29 20 77 69 74 |olog eng|ine) wit|
|000036e0| 68 20 79 6f 75 72 20 61 | 70 70 6c 69 63 61 74 69 |h your a|pplicati|
|000036f0| 6f 6e 2e 20 54 68 65 20 | 75 73 65 72 20 6d 75 73 |on. The |user mus|
|00003700| 74 20 74 79 70 65 3a 0a | 0a 5c 76 65 72 62 7e 20 |t type:.|.\verb~ |
|00003710| 20 24 20 72 75 20 6e 65 | 77 61 70 70 6c 2e 62 70 | $ ru ne|wappl.bp|
|00003720| 7e 0a 0a 7b 5c 66 6c 75 | 73 68 6c 65 66 74 20 74 |~..{\flu|shleft t|
|00003730| 6f 7d 20 73 74 61 72 74 | 20 69 74 2e 20 0a 0a 7b |o} start| it. ..{|
|00003740| 5c 66 6c 75 73 68 6c 65 | 66 74 20 41 73 7d 20 61 |\flushle|ft As} a|
|00003750| 20 6e 65 77 20 66 65 61 | 74 75 72 65 2c 20 79 6f | new fea|ture, yo|
|00003760| 75 20 63 61 6e 20 6f 76 | 65 72 72 69 64 65 20 74 |u can ov|erride t|
|00003770| 68 69 73 20 62 65 68 61 | 76 69 6f 75 72 0a 62 79 |his beha|viour.by|
|00003780| 20 73 69 6d 70 6c 65 20 | 64 65 66 69 6e 69 6e 67 | simple |defining|
|00003790| 20 61 20 70 72 65 64 69 | 63 61 74 65 20 6d 61 69 | a predi|cate mai|
|000037a0| 6e 2f 30 20 77 68 69 63 | 68 20 74 68 65 6e 20 62 |n/0 whic|h then b|
|000037b0| 65 63 6f 6d 65 73 0a 74 | 68 65 20 6e 65 77 20 73 |ecomes.t|he new s|
|000037c0| 74 61 72 74 69 6e 67 20 | 70 6f 69 6e 74 2e 0a 0a |tarting |point...|
|000037d0| 59 6f 75 20 63 61 6e 20 | 61 6c 73 6f 20 67 65 6e |You can |also gen|
|000037e0| 65 72 61 74 65 20 28 6f | 6e 20 55 4e 49 58 20 73 |erate (o|n UNIX s|
|000037f0| 79 73 74 65 6d 73 29 20 | 73 74 61 6e 64 2d 61 6c |ystems) |stand-al|
|00003800| 6f 6e 65 20 65 78 65 63 | 75 74 61 62 6c 65 73 0a |one exec|utables.|
|00003810| 74 68 61 74 20 64 79 6e | 61 6d 69 63 61 6c 6c 79 |that dyn|amically|
|00003820| 20 73 74 61 72 74 20 74 | 68 65 20 65 6d 75 6c 61 | start t|he emula|
|00003830| 74 6f 72 20 28 74 68 61 | 6e 6b 73 20 74 6f 20 50 |tor (tha|nks to P|
|00003840| 65 74 65 72 20 52 65 69 | 6e 74 6a 65 73 0a 66 6f |eter Rei|ntjes.fo|
|00003850| 72 20 73 75 67 67 65 73 | 74 69 6e 67 20 74 68 69 |r sugges|ting thi|
|00003860| 73 29 2e 20 59 6f 75 20 | 63 61 6e 20 64 6f 20 73 |s). You |can do s|
|00003870| 6f 6d 65 74 68 69 6e 67 | 20 6c 69 6b 65 3a 0a 0a |omething| like:..|
|00003880| 5c 62 65 67 69 6e 7b 76 | 65 72 62 61 74 69 6d 7d |\begin{v|erbatim}|
|00003890| 0a 3f 2d 20 6d 61 6b 65 | 5f 65 78 65 63 75 74 61 |.?- make|_executa|
|000038a0| 62 6c 65 5f 75 6e 69 78 | 5f 61 70 70 6c 28 27 2e |ble_unix|_appl('.|
|000038b0| 2f 72 75 27 2c 27 70 72 | 6f 67 73 2f 68 65 6c 6c |/ru','pr|ogs/hell|
|000038c0| 6f 2e 70 6c 27 2c 27 68 | 65 6c 6c 6f 27 29 2e 0a |o.pl','h|ello')..|
|000038d0| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0a 0a |\end{ver|batim}..|
|000038e0| 7b 5c 66 6c 75 73 68 6c | 65 66 74 20 54 68 65 6e |{\flushl|eft Then|
|000038f0| 7d 20 79 6f 75 20 63 61 | 6e 20 72 75 6e 20 69 74 |} you ca|n run it|
|00003900| 20 64 69 72 65 63 74 6c | 79 20 66 72 6f 6d 20 74 | directl|y from t|
|00003910| 68 65 20 75 6e 69 78 20 | 70 72 6f 6d 70 74 3a 0a |he unix |prompt:.|
|00003920| 0a 5c 62 65 67 69 6e 7b | 76 65 72 62 61 74 69 6d |.\begin{|verbatim|
|00003930| 7d 0a 24 20 68 65 6c 6c | 6f 0a 5c 65 6e 64 7b 76 |}.$ hell|o.\end{v|
|00003940| 65 72 62 61 74 69 6d 7d | 0a 0a 7b 5c 66 6c 75 73 |erbatim}|..{\flus|
|00003950| 68 6c 65 66 74 20 54 68 | 65 7d 20 63 6f 64 65 20 |hleft Th|e} code |
|00003960| 6f 66 20 74 68 69 73 20 | 70 72 69 6d 69 74 69 76 |of this |primitiv|
|00003970| 65 20 69 73 20 61 74 20 | 74 68 65 20 65 6e 64 20 |e is at |the end |
|00003980| 6f 66 20 74 68 65 20 66 | 69 6c 65 20 0a 5c 76 65 |of the f|ile .\ve|
|00003990| 72 62 7e 63 6f 2e 70 6c | 7e 2e 0a 0a 41 67 61 69 |rb~co.pl|~...Agai|
|000039a0| 6e 2c 20 77 65 20 72 65 | 63 6f 6d 6d 65 6e 64 20 |n, we re|commend |
|000039b0| 75 73 69 6e 67 20 74 68 | 65 20 43 2d 69 66 69 63 |using th|e C-ific|
|000039c0| 61 74 69 6f 6e 20 74 65 | 63 68 6e 69 71 75 65 20 |ation te|chnique |
|000039d0| 77 68 69 63 68 0a 63 61 | 6e 20 61 6c 72 65 61 64 |which.ca|n alread|
|000039e0| 79 20 73 70 65 65 64 20 | 75 70 20 6d 6f 73 74 20 |y speed |up most |
|000039f0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 73 20 61 6e 64 |applicat|ions and|
|00003a00| 0a 69 6e 20 74 68 65 20 | 66 75 74 75 72 65 20 77 |.in the |future w|
|00003a10| 69 6c 6c 20 67 65 6e 65 | 72 61 74 65 20 76 65 72 |ill gene|rate ver|
|00003a20| 79 20 66 61 73 74 20 63 | 6f 64 65 20 63 6f 6d 70 |y fast c|ode comp|
|00003a30| 65 74 69 74 69 76 65 0a | 77 69 74 68 20 6e 61 74 |etitive.|with nat|
|00003a40| 69 76 65 20 63 6f 64 65 | 20 63 6f 6d 70 69 6c 65 |ive code| compile|
|00003a50| 72 73 2e 0a 0a 7b 5c 66 | 6c 75 73 68 6c 65 66 74 |rs...{\f|lushleft|
|00003a60| 20 59 6f 75 7d 20 63 61 | 6e 20 62 6f 6f 74 73 74 | You} ca|n bootst|
|00003a70| 72 61 70 20 74 68 65 20 | 63 6f 6d 70 69 6c 65 72 |rap the |compiler|
|00003a80| 2c 20 61 66 74 65 72 20 | 6d 6f 64 69 66 79 69 6e |, after |modifyin|
|00003a90| 67 20 74 68 65 20 0a 5c | 76 65 72 62 7e 2a 2e 70 |g the .\|verb~*.p|
|00003aa0| 6c 7e 20 66 69 6c 65 73 | 20 62 79 3a 0a 0a 5c 62 |l~ files| by:..\b|
|00003ab0| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0a 20 |egin{ver|batim}. |
|00003ac0| 20 3f 2d 20 62 6f 6f 74 | 2e 0a 20 20 3f 2d 20 6d | ?- boot|.. ?- m|
|00003ad0| 61 6b 65 2e 0a 5c 65 6e | 64 7b 76 65 72 62 61 74 |ake..\en|d{verbat|
|00003ae0| 69 6d 7d 0a 0a 6f 72 2c | 20 73 69 6d 69 6c 61 72 |im}..or,| similar|
|00003af0| 6c 79 20 66 6f 72 20 61 | 6e 79 20 6f 74 68 65 72 |ly for a|ny other|
|00003b00| 20 70 72 6f 6a 65 63 74 | 20 68 61 76 69 6e 67 20 | project| having |
|00003b10| 61 20 74 6f 70 20 5c 76 | 65 72 62 7e 2a 2e 70 72 |a top \v|erb~*.pr|
|00003b20| 6f 7e 20 66 69 6c 65 3a | 0a 0a 5c 62 65 67 69 6e |o~ file:|..\begin|
|00003b30| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 20 20 3f 2d 6d |{verbati|m}. ?-m|
|00003b40| 61 6b 65 28 50 72 6f 6a | 65 63 74 46 69 6c 65 29 |ake(Proj|ectFile)|
|00003b50| 2e 0a 20 20 3f 2d 6d 61 | 6b 65 28 50 72 6f 6a 65 |.. ?-ma|ke(Proje|
|00003b60| 63 74 46 69 6c 65 2c 4d | 6f 64 75 6c 65 29 2e 0a |ctFile,M|odule)..|
|00003b70| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0a 0a |\end{ver|batim}..|
|00003b80| 6f 72 0a 0a 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |or..\beg|in{verba|
|00003b90| 74 69 6d 7d 0a 20 20 3f | 2d 63 6d 61 6b 65 28 50 |tim}. ?|-cmake(P|
|00003ba0| 72 6f 6a 65 63 74 46 69 | 6c 65 29 2e 0a 20 20 3f |rojectFi|le).. ?|
|00003bb0| 2d 63 6d 61 6b 65 28 50 | 72 6f 6a 65 63 74 46 69 |-cmake(P|rojectFi|
|00003bc0| 6c 65 2c 4d 6f 64 75 6c | 65 29 2e 0a 5c 65 6e 64 |le,Modul|e)..\end|
|00003bd0| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 0a 69 66 20 79 |{verbati|m}..if y|
|00003be0| 6f 75 20 69 6e 74 65 6e | 64 20 74 6f 20 67 65 6e |ou inten|d to gen|
|00003bf0| 65 72 61 74 65 20 43 2d | 63 6f 64 65 20 61 6e 64 |erate C-|code and|
|00003c00| 20 70 6f 73 73 69 62 6c | 79 20 68 69 64 65 20 6e | possibl|y hide n|
|00003c10| 6f 6e 2d 70 75 62 6c 69 | 63 20 70 72 65 64 69 63 |on-publi|c predic|
|00003c20| 61 74 65 73 0a 69 6e 73 | 69 64 65 20 61 20 6d 6f |ates.ins|ide a mo|
|00003c30| 64 75 6c 65 2e 0a 0a 7b | 5c 66 6c 75 73 68 6c 65 |dule...{|\flushle|
|00003c40| 66 74 20 54 68 69 73 7d | 20 61 6c 6c 6f 77 73 20 |ft This}| allows |
|00003c50| 74 6f 20 69 6e 74 65 67 | 72 61 74 65 20 79 6f 75 |to integ|rate you|
|00003c60| 72 20 70 72 65 66 65 72 | 65 6e 63 65 73 20 61 6e |r prefer|ences an|
|00003c70| 64 20 65 78 74 65 6e 73 | 69 6f 6e 73 0a 77 72 69 |d extens|ions.wri|
|00003c80| 74 74 65 6e 20 69 6e 20 | 50 72 6f 6c 6f 67 20 74 |tten in |Prolog t|
|00003c90| 6f 20 74 68 65 20 42 69 | 6e 50 72 6f 6c 6f 67 20 |o the Bi|nProlog |
|00003ca0| 6b 65 72 6e 65 6c 2e 0a | 0a 7b 5c 65 6d 20 7b 5c |kernel..|.{\em {\|
|00003cb0| 66 6c 75 73 68 6c 65 66 | 74 20 4d 61 6b 65 7d 20 |flushlef|t Make} |
|00003cc0| 73 75 72 65 20 79 6f 75 | 20 6b 65 65 70 20 61 20 |sure you| keep a |
|00003cd0| 63 6f 70 79 20 74 68 65 | 20 6f 72 69 67 69 6e 61 |copy the| origina|
|00003ce0| 6c 20 0a 7b 5c 65 6d 20 | 77 61 6d 2e 62 70 7d 20 |l .{\em |wam.bp} |
|00003cf0| 69 6e 20 61 20 73 61 66 | 65 20 70 6c 61 63 65 2c |in a saf|e place,|
|00003d00| 20 69 6e 20 63 61 73 65 | 20 74 68 69 6e 67 73 20 | in case| things |
|00003d10| 67 6f 20 77 72 6f 6e 67 | 20 77 68 65 6e 20 79 6f |go wrong| when yo|
|00003d20| 75 20 74 79 70 65 7d 20 | 5c 76 65 72 62 7e 3f 2d |u type} |\verb~?-|
|00003d30| 62 6f 6f 74 2e 7e 0a 0a | 5c 73 75 62 73 65 63 74 |boot.~..|\subsect|
|00003d40| 69 6f 6e 7b 53 6f 6d 65 | 20 6c 69 6d 69 74 61 74 |ion{Some| limitat|
|00003d50| 69 6f 6e 73 2f 66 65 61 | 74 75 72 65 73 20 6f 66 |ions/fea|tures of|
|00003d60| 20 42 69 6e 50 72 6f 6c | 6f 67 7d 0a 0a 57 65 20 | BinProl|og}..We |
|00003d70| 70 61 73 73 65 64 20 4f | 63 63 61 6d 27 73 20 72 |passed O|ccam's r|
|00003d80| 61 7a 6f 72 20 6f 6e 20 | 61 20 66 65 77 20 22 66 |azor on |a few "f|
|00003d90| 65 61 74 75 72 65 73 22 | 20 6f 66 20 50 72 6f 6c |eatures"| of Prol|
|00003da0| 6f 67 20 74 68 61 74 20 | 61 72 65 20 0a 6f 62 73 |og that |are .obs|
|00003db0| 6f 6c 65 74 65 20 69 6e | 20 6d 6f 64 65 72 6e 20 |olete in| modern |
|00003dc0| 70 72 6f 67 72 61 6d 6d | 69 6e 67 20 65 6e 76 69 |programm|ing envi|
|00003dd0| 72 6f 6e 6d 65 6e 74 73 | 20 61 6e 64 20 6f 6e 20 |ronments| and on |
|00003de0| 73 6f 6d 65 20 6f 74 68 | 65 72 73 20 74 68 61 74 |some oth|ers that|
|00003df0| 20 61 72 65 2c 0a 69 6e | 20 6f 75 72 20 6f 70 69 | are,.in| our opi|
|00003e00| 6e 69 6f 6e 2c 20 62 61 | 64 20 73 6f 66 74 77 61 |nion, ba|d softwa|
|00003e10| 72 65 20 70 72 61 63 74 | 69 63 65 2e 0a 0a 4f 6e |re pract|ice...On|
|00003e20| 6c 79 20 6f 6e 65 20 66 | 69 6c 65 20 61 74 20 61 |ly one f|ile at a|
|00003e30| 20 74 69 6d 65 20 63 61 | 6e 20 62 65 20 63 6f 6d | time ca|n be com|
|00003e40| 70 69 6c 65 64 20 69 6e | 20 74 68 65 20 69 6e 74 |piled in| the int|
|00003e50| 65 72 61 63 74 69 76 65 | 20 65 6e 76 69 72 6f 6e |eractive| environ|
|00003e60| 6d 65 6e 74 3a 0a 0a 5c | 62 65 67 69 6e 7b 76 65 |ment:..\|begin{ve|
|00003e70| 72 62 61 74 69 6d 7d 0a | 20 20 3f 2d 5b 6d 79 66 |rbatim}.| ?-[myf|
|00003e80| 69 6c 65 5d 2e 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |ile]..\e|nd{verba|
|00003e90| 74 69 6d 7d 0a 0a 6f 72 | 0a 0a 5c 62 65 67 69 6e |tim}..or|..\begin|
|00003ea0| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 20 20 3f 2d 20 |{verbati|m}. ?- |
|00003eb0| 63 6f 6d 70 69 6c 65 28 | 6d 79 66 69 6c 65 29 2e |compile(|myfile).|
|00003ec0| 0a 5c 65 6e 64 7b 76 65 | 72 62 61 74 69 6d 7d 0a |.\end{ve|rbatim}.|
|00003ed0| 0a 4e 6f 77 20 42 69 6e | 50 72 6f 6c 6f 67 20 73 |.Now Bin|Prolog s|
|00003ee0| 75 70 70 6f 72 74 73 0a | 61 6e 20 69 6e 63 6c 75 |upports.|an inclu|
|00003ef0| 64 65 20 64 69 72 65 63 | 74 69 76 65 3a 0a 0a 5c |de direc|tive:..\|
|00003f00| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0a |begin{ve|rbatim}.|
|00003f10| 3a 2d 5b 69 6e 63 6c 75 | 64 65 31 5d 2e 0a 3a 2d |:-[inclu|de1]..:-|
|00003f20| 5b 69 6e 63 6c 75 64 65 | 32 5d 2e 0a 2e 2e 2e 2e |[include|2]......|
|00003f30| 0a 5c 65 6e 64 7b 76 65 | 72 62 61 74 69 6d 7d 0a |.\end{ve|rbatim}.|
|00003f40| 0a 54 68 69 73 20 73 75 | 67 67 65 73 74 20 74 6f |.This su|ggest to|
|00003f50| 20 6d 61 6b 65 20 61 20 | 70 72 6f 6a 65 63 74 20 | make a |project |
|00003f60| 5c 76 65 72 62 7e 28 2a | 2e 70 72 6f 29 7e 20 66 |\verb~(*|.pro)~ f|
|00003f70| 69 6c 65 20 75 73 69 6e | 67 20 61 20 73 65 74 20 |ile usin|g a set |
|00003f80| 6f 66 0a 69 6e 63 6c 75 | 64 65 20 64 69 72 65 63 |of.inclu|de direc|
|00003f90| 74 69 76 65 73 20 65 61 | 63 68 20 72 65 66 65 72 |tives ea|ch refer|
|00003fa0| 65 69 6e 67 20 74 6f 20 | 61 20 5c 76 65 72 62 7e |eing to |a \verb~|
|00003fb0| 2a 2e 70 6c 7e 20 66 69 | 6c 65 2e 20 0a 57 68 65 |*.pl~ fi|le. .Whe|
|00003fc0| 6e 20 63 6f 6d 70 69 6c | 65 64 20 74 6f 20 61 20 |n compil|ed to a |
|00003fd0| 66 69 6c 65 20 28 62 79 | 20 75 73 69 6e 67 20 74 |file (by| using t|
|00003fe0| 68 65 20 0a 5c 76 65 72 | 62 7e 3f 2d 6d 61 6b 65 |he .\ver|b~?-make|
|00003ff0| 28 4d 79 50 72 6f 6a 65 | 63 74 29 7e 0a 63 6f 6d |(MyProje|ct)~.com|
|00004000| 6d 61 6e 64 29 20 61 20 | 6d 61 6b 65 2d 6c 69 6b |mand) a |make-lik|
|00004010| 65 20 6d 65 6d 6f 69 6e | 67 20 66 61 63 69 6c 69 |e memoin|g facili|
|00004020| 74 79 20 77 69 6c 6c 20 | 61 76 6f 69 64 20 75 73 |ty will |avoid us|
|00004030| 65 6c 65 73 73 20 72 65 | 63 6f 6d 70 69 6c 61 74 |eless re|compilat|
|00004040| 69 6f 6e 0a 6f 66 20 74 | 68 65 20 69 6e 63 6c 75 |ion.of t|he inclu|
|00004050| 64 65 64 20 5c 76 65 72 | 62 7e 28 2a 2e 70 6c 29 |ded \ver|b~(*.pl)|
|00004060| 7e 20 66 69 6c 65 73 20 | 62 79 20 63 72 65 61 74 |~ files |by creat|
|00004070| 69 6f 6e 20 6f 66 20 70 | 72 65 63 6f 6d 70 69 6c |ion of p|recompil|
|00004080| 65 64 20 0a 5c 76 65 72 | 62 7e 28 2a 2e 70 6c 5f |ed .\ver|b~(*.pl_|
|00004090| 77 61 6d 29 7e 0a 66 69 | 6c 65 73 2e 20 46 6f 72 |wam)~.fi|les. For|
|000040a0| 20 6c 61 72 67 65 20 70 | 72 6f 6a 65 63 74 73 20 | large p|rojects |
|000040b0| 74 68 69 73 20 69 73 20 | 74 68 65 20 72 65 63 6f |this is |the reco|
|000040c0| 6d 6d 65 6e 64 65 64 20 | 74 65 63 68 6e 69 71 75 |mmended |techniqu|
|000040d0| 65 2e 0a 43 72 65 61 74 | 69 6f 6e 20 6f 66 20 43 |e..Creat|ion of C|
|000040e0| 2d 69 66 69 65 64 20 73 | 74 61 6e 64 61 6c 6f 6e |-ified s|tandalon|
|000040f0| 65 20 66 69 6c 65 73 20 | 69 73 20 61 6c 73 6f 20 |e files |is also |
|00004100| 70 6f 73 73 69 62 6c 65 | 20 0a 28 73 65 65 20 74 |possible| .(see t|
|00004110| 68 65 20 5c 76 65 72 62 | 7e 70 6c 32 63 7e 20 64 |he \verb|~pl2c~ d|
|00004120| 69 72 65 63 74 6f 72 79 | 29 2e 0a 0a 7b 5c 66 6c |irectory|)...{\fl|
|00004130| 75 73 68 6c 65 66 74 20 | 50 72 6f 67 72 61 6d 73 |ushleft |Programs|
|00004140| 7d 20 74 68 61 74 20 77 | 6f 72 6b 20 77 65 6c 6c |} that w|ork well|
|00004150| 20 63 61 6e 20 62 65 20 | 61 64 64 65 64 20 74 6f | can be |added to|
|00004160| 20 74 68 65 20 42 69 6e | 50 72 6f 6c 6f 67 20 6b | the Bin|Prolog k|
|00004170| 65 72 6e 65 6c 2e 0a 54 | 68 69 73 20 61 76 6f 69 |ernel..T|his avoi|
|00004180| 64 73 20 72 65 70 65 61 | 74 65 64 20 72 65 63 6f |ds repea|ted reco|
|00004190| 6d 70 69 6c 61 74 69 6f | 6e 20 6f 66 20 77 6f 72 |mpilatio|n of wor|
|000041a0| 6b 69 6e 67 20 63 6f 64 | 65 20 61 6e 64 20 70 72 |king cod|e and pr|
|000041b0| 65 64 69 63 61 74 65 73 | 20 69 6e 20 74 68 65 0a |edicates| in the.|
|000041c0| 6b 65 72 6e 65 6c 20 61 | 72 65 20 70 72 6f 74 65 |kernel a|re prote|
|000041d0| 63 74 65 64 20 61 67 61 | 69 6e 73 74 20 6e 61 6d |cted aga|inst nam|
|000041e0| 65 20 63 6c 61 73 68 69 | 6e 67 2e 0a 0a 4e 65 77 |e clashi|ng...New|
|000041f0| 20 70 72 6f 67 72 61 6d | 73 20 63 61 6e 20 62 65 | program|s can be|
|00004200| 20 6c 6f 61 64 65 64 20 | 69 6e 20 74 68 65 20 69 | loaded |in the i|
|00004210| 6e 74 65 72 61 63 74 69 | 76 65 20 65 6e 76 69 72 |nteracti|ve envir|
|00004220| 6f 6e 6d 65 6e 74 2e 20 | 20 57 68 65 6e 20 74 68 |onment. | When th|
|00004230| 65 79 0a 77 6f 72 6b 20 | 77 65 6c 6c 2c 20 74 68 |ey.work |well, th|
|00004240| 65 79 20 6d 69 67 72 61 | 74 65 20 74 6f 20 74 68 |ey migra|te to th|
|00004250| 65 20 6b 65 72 6e 65 6c | 2e 20 59 6f 75 20 63 61 |e kernel|. You ca|
|00004260| 6e 20 70 72 65 70 61 72 | 65 20 61 20 67 6f 6f 64 |n prepar|e a good|
|00004270| 20 4d 61 6b 65 66 69 6c | 65 0a 74 6f 20 64 6f 20 | Makefil|e.to do |
|00004280| 74 68 65 20 6a 6f 62 20 | 6f 66 20 5c 76 65 72 62 |the job |of \verb|
|00004290| 7e 65 6e 73 75 72 65 5f | 6c 6f 61 64 65 64 7e 20 |~ensure_|loaded~ |
|000042a0| 6f 66 20 6f 74 68 65 72 | 20 50 72 6f 6c 6f 67 27 |of other| Prolog'|
|000042b0| 73 2e 20 20 57 68 65 6e | 20 65 76 65 72 79 74 68 |s. When| everyth|
|000042c0| 69 6e 67 20 69 73 20 4f | 4b 20 79 6f 75 20 63 61 |ing is O|K you ca|
|000042d0| 6e 20 64 65 6c 69 76 65 | 72 20 69 74 20 61 73 20 |n delive|r it as |
|000042e0| 61 20 72 75 6e 2d 74 69 | 6d 65 2d 6f 6e 6c 79 20 |a run-ti|me-only |
|000042f0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2e 0a 0a 50 72 |applicat|ion...Pr|
|00004300| 6f 67 72 61 6d 73 20 61 | 72 65 20 73 65 61 72 63 |ograms a|re searc|
|00004310| 68 65 64 20 77 69 74 68 | 20 73 75 66 66 69 78 65 |hed with| suffixe|
|00004320| 73 20 7b 5c 74 74 20 22 | 22 2c 20 22 2e 70 6c 22 |s {\tt "|", ".pl"|
|00004330| 2c 20 22 2e 70 72 6f 22 | 7d 20 69 6e 20 74 68 65 |, ".pro"|} in the|
|00004340| 20 64 69 72 65 63 74 6f | 72 69 65 73 0a 7b 5c 74 | directo|ries.{\t|
|00004350| 74 20 2e 2c 20 2e 2f 70 | 72 6f 67 73 20 61 6e 64 |t ., ./p|rogs and|
|00004360| 20 2e 2f 6d 79 70 72 6f | 67 73 7d 2e 0a 0a 54 68 | ./mypro|gs}...Th|
|00004370| 65 72 65 27 73 20 6e 6f | 20 6c 69 6d 69 74 20 6f |ere's no| limit o|
|00004380| 6e 20 74 68 65 20 6e 75 | 6d 62 65 72 20 6f 66 20 |n the nu|mber of |
|00004390| 66 69 6c 65 73 20 79 6f | 75 20 63 61 6e 20 63 6f |files yo|u can co|
|000043a0| 6d 70 69 6c 65 20 74 6f | 20 64 69 73 6b 3a 0a 5c |mpile to| disk:.\|
|000043b0| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0a |begin{ve|rbatim}.|
|000043c0| 20 20 3f 2d 20 63 6f 6d | 70 69 6c 65 28 77 61 6d | ?- com|pile(wam|
|000043d0| 2c 5b 66 69 6c 65 31 2c | 66 69 6c 65 32 2c 2e 2e |,[file1,|file2,..|
|000043e0| 2e 5d 2c 27 61 70 70 6c | 69 63 61 74 69 6f 6e 2e |.],'appl|ication.|
|000043f0| 62 70 27 29 2e 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |bp')..\e|nd{verba|
|00004400| 74 69 6d 7d 0a 0a 4e 6f | 77 20 42 69 6e 50 72 6f |tim}..No|w BinPro|
|00004410| 6c 6f 67 20 64 6f 65 73 | 20 69 6d 70 6c 65 6d 65 |log does| impleme|
|00004420| 6e 74 20 63 6f 6e 73 75 | 6c 74 2f 31 2c 20 72 65 |nt consu|lt/1, re|
|00004430| 63 6f 6e 73 75 6c 74 2f | 31 20 61 6e 64 20 6c 69 |consult/|1 and li|
|00004440| 73 74 69 6e 67 2f 30 20 | 66 6f 72 0a 69 6e 74 65 |sting/0 |for.inte|
|00004450| 72 70 72 65 74 65 64 20 | 63 6f 64 65 20 62 75 74 |rpreted |code but|
|00004460| 20 75 73 65 20 6f 66 20 | 63 6f 6d 70 69 6c 65 2f | use of |compile/|
|00004470| 31 20 69 73 20 68 69 67 | 68 6c 79 20 72 65 63 6f |1 is hig|hly reco|
|00004480| 6d 6d 65 6e 64 65 64 20 | 69 6e 73 74 65 61 64 2e |mmended |instead.|
|00004490| 0a 53 65 65 20 74 68 65 | 20 66 69 6c 65 20 65 78 |.See the| file ex|
|000044a0| 74 72 61 2e 70 6c 20 66 | 6f 72 20 74 68 65 20 69 |tra.pl f|or the i|
|000044b0| 6d 70 6c 65 6d 65 6e 74 | 61 74 69 6f 6e 2e 0a 46 |mplement|ation..F|
|000044c0| 61 73 74 65 72 20 74 68 | 61 6e 20 61 73 73 65 72 |aster th|an asser|
|000044d0| 74 65 64 20 63 6f 64 65 | 20 69 73 20 73 6f 20 63 |ted code| is so c|
|000044e0| 61 6c 6c 65 64 20 61 73 | 73 75 6d 65 64 20 63 6f |alled as|sumed co|
|000044f0| 64 65 20 28 73 65 65 20 | 74 68 65 0a 6e 65 78 74 |de (see |the.next|
|00004500| 20 73 65 63 74 69 6f 6e | 73 29 20 69 2e 65 2e 20 | section|s) i.e. |
|00004510| 69 6e 74 75 69 74 69 6f | 6e 69 73 74 69 63 20 61 |intuitio|nistic a|
|00004520| 6e 64 20 6c 69 6e 65 61 | 72 20 69 6d 70 6c 69 63 |nd linea|r implic|
|00004530| 61 74 69 6f 6e 2e 0a 0a | 7b 5c 66 6c 75 73 68 6c |ation...|{\flushl|
|00004540| 65 66 74 20 48 65 72 65 | 7d 20 61 72 65 20 73 6f |eft Here|} are so|
|00004550| 6d 65 20 6f 74 68 65 72 | 20 6c 69 6d 69 74 61 74 |me other| limitat|
|00004560| 69 6f 6e 73 2f 66 65 61 | 74 75 72 65 73 3a 0a 0a |ions/fea|tures:..|
|00004570| 5c 62 65 67 69 6e 7b 69 | 74 65 6d 69 7a 65 7d 0a |\begin{i|temize}.|
|00004580| 5c 69 74 65 6d 20 43 6c | 61 75 73 65 73 20 6f 66 |\item Cl|auses of|
|00004590| 20 61 20 70 72 65 64 69 | 63 61 74 65 20 6d 75 73 | a predi|cate mus|
|000045a0| 74 20 62 65 20 67 72 6f | 75 70 65 64 2e 0a 5c 69 |t be gro|uped..\i|
|000045b0| 74 65 6d 20 43 6c 61 75 | 73 65 73 20 68 61 76 69 |tem Clau|ses havi|
|000045c0| 6e 67 20 75 6e 64 65 66 | 69 6e 65 64 20 70 72 65 |ng undef|ined pre|
|000045d0| 64 69 63 61 74 65 73 20 | 6f 63 63 75 72 72 69 6e |dicates |occurrin|
|000045e0| 67 20 72 69 67 68 74 20 | 61 66 74 65 72 20 74 68 |g right |after th|
|000045f0| 65 20 68 65 61 64 20 61 | 72 65 20 72 65 6a 65 63 |e head a|re rejec|
|00004600| 74 65 64 2e 0a 5c 69 74 | 65 6d 20 41 52 49 54 59 |ted..\it|em ARITY|
|00004610| 20 69 73 20 6c 69 6d 69 | 74 65 64 20 74 6f 20 32 | is limi|ted to 2|
|00004620| 35 35 2e 0a 5c 69 74 65 | 6d 20 54 68 65 20 68 65 |55..\ite|m The he|
|00004630| 61 70 20 67 61 72 62 61 | 67 65 20 63 6f 6c 6c 65 |ap garba|ge colle|
|00004640| 63 74 6f 72 20 69 73 20 | 6e 6f 74 20 79 65 74 20 |ctor is |not yet |
|00004650| 69 6d 70 6c 65 6d 65 6e | 74 65 64 2c 20 62 75 74 |implemen|ted, but|
|00004660| 20 77 65 20 70 6c 61 6e | 20 74 6f 20 61 64 64 20 | we plan| to add |
|00004670| 69 74 20 73 6f 6f 6e 2e | 20 48 6f 77 65 76 65 72 |it soon.| However|
|00004680| 2c 20 74 68 65 20 62 6c | 61 63 6b 62 6f 61 72 64 |, the bl|ackboard|
|00004690| 2c 20 64 79 6e 61 6d 69 | 63 20 63 6f 64 65 20 73 |, dynami|c code s|
|000046a0| 70 61 63 65 2c 20 74 68 | 65 20 73 74 72 69 6e 67 |pace, th|e string|
|000046b0| 20 73 70 61 63 65 20 61 | 6e 64 20 74 68 65 20 68 | space a|nd the h|
|000046c0| 61 73 68 69 6e 67 20 74 | 61 62 6c 65 20 41 52 45 |ashing t|able ARE|
|000046d0| 20 67 61 72 62 61 67 65 | 20 63 6f 6c 6c 65 63 74 | garbage| collect|
|000046e0| 65 64 20 62 65 66 6f 72 | 65 20 6c 6f 61 64 69 6e |ed befor|e loadin|
|000046f0| 67 20 61 20 6e 65 77 20 | 70 72 6f 67 72 61 6d 2e |g a new |program.|
|00004700| 0a 0a 5c 65 6e 64 7b 69 | 74 65 6d 69 7a 65 7d 0a |..\end{i|temize}.|
|00004710| 0a 7b 5c 66 6c 75 73 68 | 6c 65 66 74 20 4d 6f 64 |.{\flush|left Mod|
|00004720| 65 7d 0a 69 73 20 69 6e | 74 65 72 61 63 74 69 76 |e}.is in|teractiv|
|00004730| 65 20 62 79 20 64 65 66 | 61 75 6c 74 20 28 66 6f |e by def|ault (fo|
|00004740| 72 20 63 6f 6d 70 61 74 | 69 62 69 6c 69 74 79 20 |r compat|ibility |
|00004750| 77 69 74 68 20 6f 74 68 | 65 72 20 50 72 6f 6c 6f |with oth|er Prolo|
|00004760| 67 73 29 20 62 75 74 20 | 69 66 0a 79 6f 75 20 75 |gs) but |if.you u|
|00004770| 73 65 20 61 20 6d 6f 64 | 65 72 6e 2c 20 77 69 6e |se a mod|ern, win|
|00004780| 64 6f 77 73 20 62 61 73 | 65 64 20 65 6e 76 69 72 |dows bas|ed envir|
|00004790| 6f 6e 6d 65 6e 74 20 79 | 6f 75 20 6d 61 79 20 77 |onment y|ou may w|
|000047a0| 61 6e 74 20 74 6f 20 73 | 77 69 74 63 68 20 69 74 |ant to s|witch it|
|000047b0| 0a 6f 66 66 20 77 69 74 | 68 3a 0a 0a 5c 62 65 67 |.off wit|h:..\beg|
|000047c0| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0a 3f 2d 20 |in{verba|tim}.?- |
|000047d0| 69 6e 74 65 72 61 63 74 | 69 76 65 28 6e 6f 29 2e |interact|ive(no).|
|000047e0| 0a 5c 65 6e 64 7b 76 65 | 72 62 61 74 69 6d 7d 0a |.\end{ve|rbatim}.|
|000047f0| 0a 7b 5c 66 6c 75 73 68 | 6c 65 66 74 20 6f 72 7d |.{\flush|left or}|
|00004800| 20 74 75 72 6e 20 69 74 | 20 6f 6e 20 61 67 61 69 | turn it| on agai|
|00004810| 6e 20 77 69 74 68 0a 0a | 5c 62 65 67 69 6e 7b 76 |n with..|\begin{v|
|00004820| 65 72 62 61 74 69 6d 7d | 0a 3f 2d 20 69 6e 74 65 |erbatim}|.?- inte|
|00004830| 72 61 63 74 69 76 65 28 | 79 65 73 29 2e 0a 5c 65 |ractive(|yes)..\e|
|00004840| 6e 64 7b 76 65 72 62 61 | 74 69 6d 7d 0a 0a 0a 5c |nd{verba|tim}...\|
|00004850| 73 75 62 73 65 63 74 69 | 6f 6e 7b 4f 74 68 65 72 |subsecti|on{Other|
|00004860| 20 42 69 6e 50 72 6f 6c | 6f 67 20 67 6f 6f 64 69 | BinProl|og goodi|
|00004870| 65 73 20 61 6e 64 20 6e | 65 77 20 70 72 65 64 69 |es and n|ew predi|
|00004880| 63 61 74 65 73 7d 0a 0a | 41 20 66 65 77 20 42 69 |cates}..|A few Bi|
|00004890| 6e 50 72 6f 6c 6f 67 20 | 73 70 65 63 69 66 69 63 |nProlog |specific|
|000048a0| 20 70 72 65 64 69 63 61 | 74 65 73 20 61 72 65 20 | predica|tes are |
|000048b0| 61 76 61 69 6c 61 62 6c | 65 3a 0a 0a 5c 62 65 67 |availabl|e:..\beg|
|000048c0| 69 6e 7b 69 74 65 6d 69 | 7a 65 7d 0a 5c 69 74 65 |in{itemi|ze}.\ite|
|000048d0| 6d 20 7b 5c 74 74 20 72 | 65 73 74 61 72 74 2f 30 |m {\tt r|estart/0|
|000048e0| 7d 20 2d 20 63 6c 65 61 | 6e 73 20 65 76 65 72 79 |} - clea|ns every|
|000048f0| 20 64 61 74 61 20 61 72 | 65 61 0a 5c 69 74 65 6d | data ar|ea.\item|
|00004900| 20 7b 5c 74 74 20 63 77 | 72 69 74 65 2f 31 7d 20 | {\tt cw|rite/1} |
|00004910| 2d 20 66 61 73 74 20 62 | 75 74 20 72 65 73 74 72 |- fast b|ut restr|
|00004920| 69 63 74 65 64 20 77 72 | 69 74 65 0a 5c 69 74 65 |icted wr|ite.\ite|
|00004930| 6d 20 7b 5c 74 74 20 73 | 79 6d 63 61 74 2f 33 20 |m {\tt s|ymcat/3 |
|00004940| 28 69 2c 69 2c 6f 29 7d | 20 72 65 74 75 72 6e 73 |(i,i,o)}| returns|
|00004950| 20 61 20 6e 65 77 20 73 | 79 6d 62 6f 6c 20 6f 66 | a new s|ymbol of|
|00004960| 20 74 68 65 20 66 6f 72 | 6d 20 0a 20 20 20 20 20 | the for|m . |
|00004970| 20 20 5c 76 65 72 62 7e | 3c 66 69 72 73 74 3e 5f | \verb~|<first>_|
|00004980| 3c 73 65 63 6f 6e 64 3e | 2e 7e 0a 5c 69 74 65 6d |<second>|.~.\item|
|00004990| 20 7b 5c 74 74 20 67 65 | 6e 73 79 6d 2f 32 20 28 | {\tt ge|nsym/2 (|
|000049a0| 69 2c 6f 29 7d 20 66 6f | 72 6d 73 20 61 20 6e 65 |i,o)} fo|rms a ne|
|000049b0| 77 20 6e 61 6d 65 20 6f | 66 20 74 68 65 20 66 6f |w name o|f the fo|
|000049c0| 72 6d 0a 20 20 20 20 20 | 20 20 5c 76 65 72 62 7e |rm. | \verb~|
|000049d0| 3c 6e 61 6d 65 3e 5f 3c | 63 6f 75 6e 74 65 72 3e |<name>_<|counter>|
|000049e0| 2e 7e 0a 5c 69 74 65 6d | 20 5c 76 65 72 62 7e 73 |.~.\item| \verb~s|
|000049f0| 72 65 61 64 2f 32 20 28 | 69 2c 6f 29 7e 20 72 65 |read/2 (|i,o)~ re|
|00004a00| 61 64 73 20 66 72 6f 6d | 20 61 20 6e 61 6d 65 20 |ads from| a name |
|00004a10| 61 0a 20 20 20 20 20 20 | 28 67 72 6f 75 6e 64 29 |a. |(ground)|
|00004a20| 20 74 65 72 6d 2c 20 5c | 76 65 72 62 7e 73 77 72 | term, \|verb~swr|
|00004a30| 69 74 65 28 69 2c 6f 29 | 7e 20 77 72 69 74 65 73 |ite(i,o)|~ writes|
|00004a40| 20 61 20 74 65 72 6d 20 | 74 6f 20 61 20 6e 61 6d | a term |to a nam|
|00004a50| 65 2e 0a 5c 69 74 65 6d | 20 74 65 72 6d 20 5c 76 |e..\item| term \v|
|00004a60| 65 72 62 7e 74 65 72 6d | 63 61 74 2f 33 20 28 69 |erb~term|cat/3 (i|
|00004a70| 2c 69 2c 6f 29 7e 20 61 | 64 64 73 20 69 74 73 20 |,i,o)~ a|dds its |
|00004a80| 73 65 63 6f 6e 64 20 61 | 72 67 75 6d 65 6e 74 20 |second a|rgument |
|00004a90| 61 73 20 6c 61 73 74 0a | 61 72 67 75 6d 65 6e 74 |as last.|argument|
|00004aa0| 20 6f 66 20 69 74 73 20 | 66 69 72 73 74 20 61 72 | of its |first ar|
|00004ab0| 67 75 6d 65 6e 74 20 61 | 6e 64 20 72 65 74 75 72 |gument a|nd retur|
|00004ac0| 6e 73 20 74 68 65 20 6e | 65 77 20 74 65 72 6d 0a |ns the n|ew term.|
|00004ad0| 5c 69 74 65 6d 20 7b 5c | 74 74 20 74 65 72 6d 5c |\item {\|tt term\|
|00004ae0| 5f 63 68 61 72 73 2f 32 | 7d 20 63 6f 6e 76 65 72 |_chars/2|} conver|
|00004af0| 74 73 20 62 65 74 77 65 | 65 6e 20 61 20 67 72 6f |ts betwe|en a gro|
|00004b00| 75 6e 64 20 74 65 72 6d | 20 61 6e 64 20 69 74 73 |und term| and its|
|00004b10| 0a 73 74 72 69 6e 67 20 | 72 65 70 72 65 73 65 6e |.string |represen|
|00004b20| 74 61 74 69 6f 6e 0a 5c | 69 74 65 6d 20 5c 76 65 |tation.\|item \ve|
|00004b30| 72 62 7e 6e 6f 74 2f 31 | 7e 20 69 73 20 61 20 66 |rb~not/1|~ is a f|
|00004b40| 6f 72 6d 20 6f 66 20 73 | 6f 75 6e 64 20 6e 65 67 |orm of s|ound neg|
|00004b50| 61 74 69 6f 6e 0a 5c 69 | 74 65 6d 20 5c 76 65 72 |ation.\i|tem \ver|
|00004b60| 62 7e 66 6f 72 2f 33 7e | 20 20 61 73 20 66 6f 72 |b~for/3~| as for|
|00004b70| 20 69 6e 73 74 61 6e 63 | 65 0a 20 20 20 20 20 20 | instanc|e. |
|00004b80| 69 6e 20 5c 76 65 72 62 | 7e 3f 2d 66 6f 72 28 49 |in \verb|~?-for(I|
|00004b90| 2c 31 2c 35 29 2c 77 72 | 69 74 65 28 49 29 2c 6e |,1,5),wr|ite(I),n|
|00004ba0| 6c 2c 66 61 69 6c 7e 20 | 67 65 6e 65 72 61 74 65 |l,fail~ |generate|
|00004bb0| 73 20 61 20 66 61 69 6c | 75 72 65 20 64 72 69 76 |s a fail|ure driv|
|00004bc0| 65 6e 20 6c 6f 6f 70 0a | 5c 65 6e 64 7b 69 74 65 |en loop.|\end{ite|
|00004bd0| 6d 69 7a 65 7d 0a 0a 49 | 74 20 69 73 20 61 20 67 |mize}..I|t is a g|
|00004be0| 6f 6f 64 20 69 64 65 61 | 20 74 6f 20 74 61 6b 65 |ood idea| to take|
|00004bf0| 20 61 20 6c 6f 6f 6b 20 | 61 74 20 42 69 6e 50 72 | a look |at BinPr|
|00004c00| 6f 6c 6f 67 27 73 20 5c | 76 65 72 62 7e 2a 2e 70 |olog's \|verb~*.p|
|00004c10| 6c 7e 20 66 6f 72 0a 6f | 74 68 65 72 20 62 75 69 |l~ for.o|ther bui|
|00004c20| 6c 74 69 6e 2d 6f 72 2d | 6c 69 62 72 61 72 79 20 |ltin-or-|library |
|00004c30| 70 72 65 64 69 63 61 74 | 65 73 20 62 65 66 6f 72 |predicat|es befor|
|00004c40| 65 20 69 6d 70 6c 65 6d | 65 6e 74 69 6e 67 20 74 |e implem|enting t|
|00004c50| 68 65 6d 20 79 6f 75 72 | 73 65 6c 66 2e 0a 54 68 |hem your|self..Th|
|00004c60| 65 20 66 69 6c 65 20 5c | 76 65 72 62 7e 77 72 69 |e file \|verb~wri|
|00004c70| 74 65 2e 70 6c 7e 20 63 | 6f 6e 74 61 69 6e 20 76 |te.pl~ c|ontain v|
|00004c80| 61 72 69 6f 75 73 20 6f | 75 74 70 75 74 20 70 72 |arious o|utput pr|
|00004c90| 65 64 69 63 61 74 65 73 | 20 6c 69 6b 65 0a 5c 62 |edicates| like.\b|
|00004ca0| 65 67 69 6e 7b 69 74 65 | 6d 69 7a 65 7d 0a 5c 69 |egin{ite|mize}.\i|
|00004cb0| 74 65 6d 20 77 72 69 74 | 65 2f 31 0a 5c 69 74 65 |tem writ|e/1.\ite|
|00004cc0| 6d 20 77 72 69 74 65 71 | 2f 31 0a 5c 69 74 65 6d |m writeq|/1.\item|
|00004cd0| 20 70 6f 72 74 72 61 79 | 5c 5f 63 6c 61 75 73 65 | portray|\_clause|
|00004ce0| 2f 31 0a 5c 69 74 65 6d | 20 70 72 69 6e 74 2f 31 |/1.\item| print/1|
|00004cf0| 0a 5c 69 74 65 6d 20 64 | 69 73 70 6c 61 79 2f 31 |.\item d|isplay/1|
|00004d00| 0a 5c 69 74 65 6d 20 74 | 74 79 70 72 69 6e 74 2f |.\item t|typrint/|
|00004d10| 31 0a 5c 69 74 65 6d 20 | 74 74 79 6e 6c 2f 31 0a |1.\item |ttynl/1.|
|00004d20| 5c 65 6e 64 7b 69 74 65 | 6d 69 7a 65 7d 0a 0a 7b |\end{ite|mize}..{|
|00004d30| 5c 66 6c 75 73 68 6c 65 | 66 74 20 59 6f 75 7d 20 |\flushle|ft You} |
|00004d40| 63 61 6e 20 65 78 74 65 | 6e 64 20 42 69 6e 50 72 |can exte|nd BinPr|
|00004d50| 6f 6c 6f 67 20 62 79 20 | 61 64 64 69 6e 67 20 6e |olog by |adding n|
|00004d60| 65 77 20 70 72 65 64 69 | 63 61 74 65 73 20 74 6f |ew predi|cates to|
|00004d70| 20 74 68 65 20 66 69 6c | 65 20 65 78 74 72 61 2e | the fil|e extra.|
|00004d80| 70 6c 0a 61 6e 64 20 74 | 68 65 6e 20 75 73 65 20 |pl.and t|hen use |
|00004d90| 74 68 65 20 70 72 65 64 | 69 63 61 74 65 20 7b 5c |the pred|icate {\|
|00004da0| 74 74 20 62 6f 6f 74 2f | 30 7d 20 64 65 66 69 6e |tt boot/|0} defin|
|00004db0| 65 64 20 69 6e 20 74 68 | 65 20 66 69 6c 65 20 63 |ed in th|e file c|
|00004dc0| 6f 2e 70 6c 2e 0a 0a 5c | 73 75 62 73 65 63 74 69 |o.pl...\|subsecti|
|00004dd0| 6f 6e 7b 45 66 66 69 63 | 69 65 6e 74 20 66 69 6e |on{Effic|ient fin|
|00004de0| 64 61 6c 6c 20 62 61 73 | 65 64 20 6d 65 74 61 2d |dall bas|ed meta-|
|00004df0| 70 72 6f 67 72 61 6d 6d | 69 6e 67 7d 0a 0a 42 69 |programm|ing}..Bi|
|00004e00| 6e 50 72 6f 6c 6f 67 27 | 73 20 7b 5c 74 74 20 66 |nProlog'|s {\tt f|
|00004e10| 69 6e 64 61 6c 6c 2f 33 | 7d 20 69 73 20 73 6f 20 |indall/3|} is so |
|00004e20| 65 66 66 69 63 69 65 6e | 74 20 74 68 61 74 20 79 |efficien|t that y|
|00004e30| 6f 75 20 63 61 6e 0a 61 | 66 66 6f 72 64 20 28 77 |ou can.a|fford (w|
|00004e40| 69 74 68 20 73 6f 6d 65 | 20 63 61 72 65 29 20 74 |ith some| care) t|
|00004e50| 6f 20 75 73 65 20 69 74 | 20 69 6e 73 74 65 61 64 |o use it| instead|
|00004e60| 20 6f 66 20 65 78 70 6c | 69 63 69 74 0a 28 61 6e | of expl|icit.(an|
|00004e70| 64 20 6d 6f 72 65 20 70 | 61 69 6e 66 75 6c 29 20 |d more p|ainful) |
|00004e80| 66 69 72 73 74 2d 6f 72 | 64 65 72 20 70 72 6f 67 |first-or|der prog|
|00004e90| 72 61 6d 73 20 61 73 20 | 69 6e 3a 0a 0a 5c 62 65 |rams as |in:..\be|
|00004ea0| 67 69 6e 7b 76 65 72 62 | 61 74 69 6d 7d 0a 25 20 |gin{verb|atim}.% |
|00004eb0| 6d 61 70 6c 69 73 74 20 | 77 69 74 68 20 66 69 6e |maplist |with fin|
|00004ec0| 64 61 6c 6c 0a 6d 61 70 | 6c 69 73 74 28 43 6c 6f |dall.map|list(Clo|
|00004ed0| 73 75 72 65 2c 49 73 2c | 4f 73 29 3a 2d 0a 20 20 |sure,Is,|Os):-. |
|00004ee0| 43 6c 6f 73 75 72 65 3d | 2e 2e 4c 31 2c 0a 20 20 |Closure=|..L1,. |
|00004ef0| 64 65 74 5f 61 70 70 65 | 6e 64 28 4c 31 2c 5b 49 |det_appe|nd(L1,[I|
|00004f00| 2c 4f 5d 2c 4c 32 29 2c | 0a 20 20 50 3d 2e 2e 4c |,O],L2),|. P=..L|
|00004f10| 32 2c 0a 20 20 66 69 6e | 64 61 6c 6c 28 4f 2c 6d |2,. fin|dall(O,m|
|00004f20| 61 70 31 28 50 2c 49 2c | 49 73 29 2c 4f 73 29 2e |ap1(P,I,|Is),Os).|
|00004f30| 0a 0a 6d 61 70 31 28 50 | 2c 49 2c 49 73 29 3a 2d |..map1(P|,I,Is):-|
|00004f40| 6d 65 6d 62 65 72 28 49 | 2c 49 73 29 2c 50 2e 0a |member(I|,Is),P..|
|00004f50| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0a 0a |\end{ver|batim}..|
|00004f60| 54 68 69 73 20 63 61 6e | 20 62 65 20 75 73 65 64 |This can| be used|
|00004f70| 20 61 73 20 66 6f 6c 6c | 6f 77 73 3a 0a 0a 5c 62 | as foll|ows:..\b|
|00004f80| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0a 3f |egin{ver|batim}.?|
|00004f90| 2d 20 6d 61 70 6c 69 73 | 74 28 2b 28 31 29 2c 5b |- maplis|t(+(1),[|
|00004fa0| 31 30 2c 32 30 2c 33 30 | 5d 2c 54 29 2e 0a 3d 3e |10,20,30|],T)..=>|
|00004fb0| 20 54 3d 5b 31 31 2c 32 | 31 2c 33 31 5d 0a 5c 65 | T=[11,2|1,31].\e|
|00004fc0| 6e 64 7b 76 65 72 62 61 | 74 69 6d 7d 0a 0a 4e 6f |nd{verba|tim}..No|
|00004fd0| 74 65 20 74 68 61 74 20 | 63 6f 6e 73 74 72 75 63 |te that |construc|
|00004fe0| 74 69 6e 67 20 7b 5c 74 | 74 20 43 6c 6f 73 75 72 |ting {\t|t Closur|
|00004ff0| 65 7d 20 6f 6e 6c 79 20 | 6f 6e 63 65 20 28 61 6c |e} only |once (al|
|00005000| 74 68 6f 75 67 68 20 74 | 68 69 73 20 0a 6d 61 79 |though t|his .may|
|00005010| 20 6e 6f 74 20 62 65 20 | 69 6e 20 61 6e 79 20 50 | not be |in any P|
|00005020| 72 6f 6c 6f 67 20 74 65 | 78 74 2d 62 6f 6f 6b 21 |rolog te|xt-book!|
|00005030| 29 20 69 73 20 6d 6f 72 | 65 20 65 66 66 69 63 69 |) is mor|e effici|
|00005040| 65 6e 74 0a 74 68 61 6e | 20 64 6f 69 6e 67 20 69 |ent.than| doing i|
|00005050| 74 20 61 74 20 65 61 63 | 68 20 73 74 65 70 2e 0a |t at eac|h step..|
|00005060| 0a 54 68 65 20 70 72 65 | 64 69 63 61 74 65 20 7b |.The pre|dicate {|
|00005070| 5c 74 74 20 67 63 5c 5f | 63 61 6c 6c 28 47 6f 61 |\tt gc\_|call(Goa|
|00005080| 6c 29 7d 20 64 65 66 69 | 6e 65 64 20 69 6e 20 74 |l)} defi|ned in t|
|00005090| 68 65 20 66 69 6c 65 20 | 7b 5c 74 74 20 6c 69 62 |he file |{\tt lib|
|000050a0| 2e 70 6c 7d 0a 65 78 65 | 63 75 74 65 73 20 47 6f |.pl}.exe|cutes Go|
|000050b0| 61 6c 20 69 6e 20 6d 69 | 6e 69 6d 61 6c 20 73 70 |al in mi|nimal sp|
|000050c0| 61 63 65 2e 20 20 49 74 | 20 69 73 20 65 78 70 6c |ace. It| is expl|
|000050d0| 61 69 6e 65 64 20 69 6e | 20 74 68 65 20 43 72 61 |ained in| the Cra|
|000050e0| 66 74 20 6f 66 20 50 72 | 6f 6c 6f 67 0a 62 79 20 |ft of Pr|olog.by |
|000050f0| 52 2e 41 2e 20 4f 27 4b | 65 65 66 65 2c 20 4d 49 |R.A. O'K|eefe, MI|
|00005100| 54 20 50 72 65 73 73 2e | 0a 44 6f 20 6e 6f 74 20 |T Press.|.Do not |
|00005110| 68 65 73 69 74 61 74 65 | 20 74 6f 20 75 73 65 20 |hesitate| to use |
|00005120| 69 74 2e 20 42 69 6e 50 | 72 6f 6c 6f 67 20 6f 66 |it. BinP|rolog of|
|00005130| 66 65 72 73 20 61 20 76 | 65 72 79 20 66 61 73 74 |fers a v|ery fast|
|00005140| 2c 20 68 65 61 70 2d 6f | 72 69 65 6e 74 65 64 0a |, heap-o|riented.|
|00005150| 66 69 6e 64 61 6c 6c 2c | 20 73 6f 20 79 6f 75 20 |findall,| so you |
|00005160| 63 61 6e 20 61 66 66 6f | 72 64 20 74 6f 20 75 73 |can affo|rd to us|
|00005170| 65 20 7b 5c 74 74 20 67 | 63 5c 5f 63 61 6c 6c 7d |e {\tt g|c\_call}|
|00005180| 2e 20 49 6e 20 67 6f 6f | 64 20 68 61 6e 64 73 2c |. In goo|d hands,|
|00005190| 20 69 74 20 69 73 0a 70 | 72 6f 62 61 62 6c 79 20 | it is.p|robably |
|000051a0| 66 61 73 74 65 72 20 74 | 68 61 6e 20 75 73 69 6e |faster t|han usin|
|000051b0| 67 20 61 73 73 65 72 74 | 2f 72 65 74 72 61 63 74 |g assert|/retract|
|000051c0| 20 6f 72 20 74 68 65 20 | 75 73 75 61 6c 20 6d 61 | or the |usual ma|
|000051d0| 72 6b 2d 61 6e 64 2d 73 | 77 65 65 70 0a 67 61 72 |rk-and-s|weep.gar|
|000051e0| 62 61 67 65 20 63 6f 6c | 6c 65 63 74 6f 72 20 6f |bage col|lector o|
|000051f0| 66 20 6f 74 68 65 72 20 | 69 6d 70 6c 65 6d 65 6e |f other |implemen|
|00005200| 74 61 74 69 6f 6e 73 2e | 0a 0a 5c 73 75 62 73 65 |tations.|..\subse|
|00005210| 63 74 69 6f 6e 7b 42 75 | 69 6c 74 69 6e 73 7d 0a |ction{Bu|iltins}.|
|00005220| 0a 54 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 28 |.The fol|lowing (|
|00005230| 75 73 65 72 2d 6c 65 76 | 65 6c 29 20 62 75 69 6c |user-lev|el) buil|
|00005240| 74 69 6e 73 20 61 72 65 | 20 73 75 70 70 6f 72 74 |tins are| support|
|00005250| 65 64 2c 20 77 69 74 68 | 20 73 65 6d 61 6e 74 69 |ed, with| semanti|
|00005260| 63 73 0a 28 69 6e 74 65 | 6e 64 65 64 20 74 6f 20 |cs.(inte|nded to |
|00005270| 62 65 29 20 63 6c 6f 73 | 65 20 74 6f 20 53 49 43 |be) clos|e to SIC|
|00005280| 53 54 55 53 20 61 6e 64 | 20 51 55 49 4e 54 55 53 |STUS and| QUINTUS|
|00005290| 20 50 72 6f 6c 6f 67 2e | 0a 5c 62 65 67 69 6e 7b | Prolog.|.\begin{|
|000052a0| 76 65 72 62 61 74 69 6d | 7d 0a 0a 66 61 69 6c 2f |verbatim|}..fail/|
|000052b0| 30 0a 6e 6c 2f 30 0a 76 | 61 72 2f 31 0a 6e 6f 6e |0.nl/0.v|ar/1.non|
|000052c0| 76 61 72 2f 31 0a 69 6e | 74 65 67 65 72 2f 31 0a |var/1.in|teger/1.|
|000052d0| 61 74 6f 6d 69 63 2f 31 | 0a 2b 2f 33 20 20 20 25 |atomic/1|.+/3 %|
|000052e0| 20 61 72 69 74 68 6d 65 | 74 69 63 20 6f 66 66 65 | arithme|tic offe|
|000052f0| 72 73 20 61 6c 73 6f 20 | 74 68 65 20 75 73 75 61 |rs also |the usua|
|00005300| 6c 20 69 73 2f 32 20 69 | 6e 74 65 72 66 61 63 65 |l is/2 i|nterface|
|00005310| 0a 2d 2f 33 0a 2a 20 2f | 33 0a 2f 2f 20 2f 33 0a |.-/3.* /|3.// /3.|
|00005320| 6d 6f 64 2f 33 0a 3c 3c | 20 2f 33 0a 3e 3e 20 2f |mod/3.<<| /3.>> /|
|00005330| 33 0a 2f 5c 20 2f 33 0a | 5c 2f 20 2f 33 0a 23 20 |3./\ /3.|\/ /3.# |
|00005340| 2f 33 20 20 20 20 25 20 | 62 69 74 77 69 73 65 20 |/3 % |bitwise |
|00005350| 58 4f 52 0a 5c 20 2f 33 | 20 20 20 20 20 25 20 62 |XOR.\ /3| % b|
|00005360| 69 74 77 69 73 65 20 4e | 4f 54 0a 72 61 6e 64 6f |itwise N|OT.rando|
|00005370| 6d 2f 31 20 25 20 72 65 | 74 75 72 6e 73 20 61 6e |m/1 % re|turns an|
|00005380| 20 69 6e 74 65 67 65 72 | 2c 20 6e 6f 74 20 61 20 | integer|, not a |
|00005390| 66 6c 6f 61 74 0a 67 65 | 74 30 2f 31 0a 70 75 74 |float.ge|t0/1.put|
|000053a0| 2f 31 0a 3c 20 2f 32 0a | 3e 20 2f 32 0a 3d 3c 20 |/1.< /2.|> /2.=< |
|000053b0| 2f 32 0a 3e 3d 20 2f 32 | 0a 3d 3a 3d 20 2f 32 0a |/2.>= /2|.=:= /2.|
|000053c0| 3d 5c 3d 20 2f 32 0a 63 | 6f 6d 70 61 72 65 2f 33 |=\= /2.c|ompare/3|
|000053d0| 0a 73 65 65 69 6e 67 2f | 31 0a 73 65 65 6e 2f 30 |.seeing/|1.seen/0|
|000053e0| 0a 74 65 6c 6c 69 6e 67 | 2f 31 0a 74 6f 6c 64 2f |.telling|/1.told/|
|000053f0| 30 0a 63 6f 70 79 5f 74 | 65 72 6d 2f 32 0a 66 75 |0.copy_t|erm/2.fu|
|00005400| 6e 63 74 6f 72 2f 33 0a | 61 72 67 2f 33 0a 6e 61 |nctor/3.|arg/3.na|
|00005410| 6d 65 2f 32 0a 61 62 6f | 72 74 2f 30 0a 69 73 5f |me/2.abo|rt/0.is_|
|00005420| 63 6f 6d 70 69 6c 65 64 | 2f 31 20 25 20 63 68 65 |compiled|/1 % che|
|00005430| 63 6b 73 20 69 66 20 61 | 20 70 72 65 64 69 63 61 |cks if a| predica|
|00005440| 74 65 20 69 73 20 63 6f | 6d 70 69 6c 65 64 0a 5c |te is co|mpiled.\|
|00005450| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0a 0a 7b |end{verb|atim}..{|
|00005460| 5c 66 6c 75 73 68 6c 65 | 66 74 20 4f 74 68 65 72 |\flushle|ft Other|
|00005470| 7d 0a 20 75 73 65 66 75 | 6c 20 70 72 65 64 69 63 |}. usefu|l predic|
|00005480| 61 74 65 73 20 61 72 65 | 20 64 65 66 69 6e 65 64 |ates are| defined|
|00005490| 20 69 6e 20 74 68 65 20 | 66 69 6c 65 20 6c 69 62 | in the |file lib|
|000054a0| 2e 70 6c 20 61 6e 64 20 | 77 6f 72 6b 20 61 73 0a |.pl and |work as.|
|000054b0| 65 78 70 65 63 74 65 64 | 2e 0a 0a 5c 62 65 67 69 |expected|...\begi|
|000054c0| 6e 7b 76 65 72 62 61 74 | 69 6d 7d 0a 74 72 75 65 |n{verbat|im}.true|
|000054d0| 2f 30 2c 0a 3d 2f 32 2c | 0a 2e 2e 20 2d 3e 20 2e |/0,.=/2,|... -> .|
|000054e0| 2e 20 3b 20 2e 2e 0a 3b | 2f 31 0a 63 61 6c 6c 2f |. ; ...;|/1.call/|
|000054f0| 31 0a 5c 2b 2f 31 0a 72 | 65 70 65 61 74 2f 30 0a |1.\+/1.r|epeat/0.|
|00005500| 66 69 6e 64 61 6c 6c 2f | 33 0a 66 69 6e 64 61 6c |findall/|3.findal|
|00005510| 6c 2f 34 0a 66 6f 72 2f | 33 0a 6e 75 6d 62 65 72 |l/4.for/|3.number|
|00005520| 76 61 72 73 2f 34 0a 73 | 65 65 2f 31 0a 74 65 6c |vars/4.s|ee/1.tel|
|00005530| 6c 2f 31 0a 73 79 73 74 | 65 6d 2f 31 0a 73 74 61 |l/1.syst|em/1.sta|
|00005540| 74 69 73 74 69 63 73 2f | 30 0a 73 74 61 74 69 73 |tistics/|0.statis|
|00005550| 74 69 63 73 2f 32 0a 61 | 74 6f 6d 2f 31 0a 63 6f |tics/2.a|tom/1.co|
|00005560| 6d 70 6f 75 6e 64 2f 31 | 0a 3d 2e 2e 2f 32 0a 6c |mpound/1|.=../2.l|
|00005570| 65 6e 67 74 68 2f 32 0a | 74 61 62 2f 31 0a 67 65 |ength/2.|tab/1.ge|
|00005580| 74 2f 31 0a 3d 3d 20 2f | 32 0a 5c 3d 3d 20 2f 32 |t/1.== /|2.\== /2|
|00005590| 0a 41 20 40 3c 20 42 20 | 0a 41 20 40 3e 20 42 0a |.A @< B |.A @> B.|
|000055a0| 41 20 40 3d 3c 20 42 0a | 41 20 40 3e 3d 20 42 20 |A @=< B.|A @>= B |
|000055b0| 0a 63 6f 6d 70 69 6c 65 | 2f 31 20 2d 20 73 65 65 |.compile|/1 - see|
|000055c0| 20 63 6f 2e 70 6c 20 66 | 6f 72 20 74 68 65 20 63 | co.pl f|or the c|
|000055d0| 6f 6d 70 69 6c 65 72 0a | 72 65 61 64 2f 31 20 20 |ompiler.|read/1 |
|000055e0| 2d 20 73 65 65 20 74 68 | 65 20 66 69 6c 65 3a 20 |- see th|e file: |
|000055f0| 72 65 61 64 2e 70 6c 0a | 77 72 69 74 65 2f 31 20 |read.pl.|write/1 |
|00005600| 2d 20 73 65 65 20 74 68 | 65 20 66 69 6c 65 3a 20 |- see th|e file: |
|00005610| 77 72 69 74 65 2e 70 6c | 0a 68 61 6c 74 2f 30 2c |write.pl|.halt/0,|
|00005620| 0a 68 61 6c 74 28 52 65 | 74 75 72 6e 43 6f 64 65 |.halt(Re|turnCode|
|00005630| 29 2c 0a 6c 69 73 74 69 | 6e 67 2f 30 2c 20 25 20 |),.listi|ng/0, % |
|00005640| 6f 6e 6c 79 20 66 6f 72 | 20 69 6e 74 65 72 70 72 |only for| interpr|
|00005650| 65 74 65 64 20 63 6f 64 | 65 0a 6c 69 73 74 69 6e |eted cod|e.listin|
|00005660| 67 28 50 72 65 64 2c 41 | 72 69 74 79 29 2c 0a 61 |g(Pred,A|rity),.a|
|00005670| 73 73 65 72 74 2f 31 2c | 0a 61 73 73 65 72 74 61 |ssert/1,|.asserta|
|00005680| 2f 31 2c 20 0a 61 73 73 | 65 72 74 7a 2f 31 2c 0a |/1, .ass|ertz/1,.|
|00005690| 72 65 74 72 61 63 74 2f | 31 2c 0a 72 65 74 72 61 |retract/|1,.retra|
|000056a0| 63 74 61 6c 6c 2f 31 0a | 65 72 61 73 65 2f 31 2c |ctall/1.|erase/1,|
|000056b0| 0a 64 79 6e 61 6d 69 63 | 2f 31 2c 0a 69 6e 73 74 |.dynamic|/1,.inst|
|000056c0| 61 6e 63 65 2f 32 2c 0a | 63 6c 61 75 73 65 2f 32 |ance/2,.|clause/2|
|000056d0| 2c 0a 63 6c 61 75 73 65 | 2f 33 2c 0a 63 6f 6e 73 |,.clause|/3,.cons|
|000056e0| 75 6c 74 2f 31 2c 20 20 | 20 25 20 75 73 61 62 6c |ult/1, | % usabl|
|000056f0| 65 20 66 6f 72 20 64 65 | 62 75 67 67 69 6e 67 20 |e for de|bugging |
|00005700| 6f 72 20 64 79 6e 61 6d | 69 63 20 63 6f 64 65 0a |or dynam|ic code.|
|00005710| 72 65 63 6f 6e 73 75 6c | 74 2f 31 2c 20 25 20 74 |reconsul|t/1, % t|
|00005720| 68 65 79 20 6f 76 65 72 | 72 69 64 65 20 63 6f 6d |hey over|ride com|
|00005730| 70 69 6c 65 64 20 64 65 | 66 69 6e 69 74 69 6f 6e |piled de|finition|
|00005740| 73 20 21 21 21 0a 73 65 | 74 6f 66 2f 33 2c 0a 62 |s !!!.se|tof/3,.b|
|00005750| 61 67 6f 66 2f 33 2c 20 | 0a 73 6f 72 74 2f 33 2c |agof/3, |.sort/3,|
|00005760| 20 0a 6b 65 79 73 6f 72 | 74 2f 33 2c 0a 73 65 74 | .keysor|t/3,.set|
|00005770| 61 72 67 2f 33 2c 20 25 | 20 62 61 63 6b 74 72 61 |arg/3, %| backtra|
|00005780| 63 6b 61 62 6c 65 20 75 | 70 64 61 74 65 20 6f 66 |ckable u|pdate of|
|00005790| 20 61 72 67 20 49 20 6f | 66 20 74 65 72 6d 20 54 | arg I o|f term T|
|000057a0| 20 77 69 74 68 20 6e 65 | 77 20 74 65 72 6d 20 58 | with ne|w term X|
|000057b0| 0a 0a 69 73 5f 62 75 69 | 6c 74 69 6e 2f 31 20 25 |..is_bui|ltin/1 %|
|000057c0| 20 6c 69 73 74 73 20 74 | 68 65 20 73 79 73 74 65 | lists t|he syste|
|000057d0| 6d 2d 6c 65 76 65 6c 20 | 62 75 69 6c 74 69 6e 73 |m-level |builtins|
|000057e0| 20 28 77 72 69 74 74 65 | 6e 20 69 6e 20 43 29 3a | (writte|n in C):|
|000057f0| 0a 63 75 72 72 65 6e 74 | 5f 70 72 65 64 69 63 61 |.current|_predica|
|00005800| 74 65 2f 31 20 25 20 6c | 69 73 74 73 2f 63 68 65 |te/1 % l|ists/che|
|00005810| 63 6b 73 20 65 78 69 73 | 74 65 6e 63 65 20 6f 66 |cks exis|tence of|
|00005820| 20 61 20 20 70 72 65 64 | 69 63 61 74 65 2f 61 72 | a pred|icate/ar|
|00005830| 69 74 79 0a 70 72 65 64 | 69 63 61 74 65 5f 70 72 |ity.pred|icate_pr|
|00005840| 6f 70 65 72 74 79 2f 32 | 20 25 20 6c 69 73 74 73 |operty/2| % lists|
|00005850| 2f 63 68 65 63 6b 73 20 | 69 66 20 61 20 70 72 6f |/checks |if a pro|
|00005860| 70 65 72 74 79 20 28 61 | 72 67 20 32 29 20 69 73 |perty (a|rg 2) is|
|00005870| 20 61 73 73 6f 63 69 61 | 74 65 64 20 77 69 74 68 | associa|ted with|
|00005880| 20 61 20 68 65 61 64 20 | 28 61 72 67 20 31 29 0a | a head |(arg 1).|
|00005890| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0a 0a |\end{ver|batim}..|
|000058a0| 7b 5c 66 6c 75 73 68 6c | 65 66 74 20 4f 70 65 72 |{\flushl|eft Oper|
|000058b0| 61 74 6f 72 73 7d 20 61 | 72 65 20 64 65 66 69 6e |ators} a|re defin|
|000058c0| 65 64 20 61 6e 64 20 72 | 65 74 72 69 65 76 65 64 |ed and r|etrieved|
|000058d0| 20 77 69 74 68 0a 0a 5c | 62 65 67 69 6e 7b 76 65 | with..\|begin{ve|
|000058e0| 72 62 61 74 69 6d 7d 0a | 3a 2d 6f 70 2f 33 2c 20 |rbatim}.|:-op/3, |
|000058f0| 63 75 72 72 65 6e 74 5f | 6f 70 2f 33 2e 0a 5c 65 |current_|op/3..\e|
|00005900| 6e 64 7b 76 65 72 62 61 | 74 69 6d 7d 0a 0a 49 6e |nd{verba|tim}..In|
|00005910| 63 6c 75 64 69 6e 67 20 | 66 69 6c 65 73 20 61 72 |cluding |files ar|
|00005920| 65 20 73 75 70 70 6f 72 | 74 65 64 2e 20 46 6f 72 |e suppor|ted. For|
|00005930| 20 7b 5c 74 74 20 63 6f | 6d 70 69 6c 65 2f 31 7d | {\tt co|mpile/1}|
|00005940| 20 75 73 65 0a 0a 5c 62 | 65 67 69 6e 7b 76 65 72 | use..\b|egin{ver|
|00005950| 62 61 74 69 6d 7d 0a 3a | 2d 63 6f 6d 70 69 6c 65 |batim}.:|-compile|
|00005960| 28 66 69 6c 65 29 2e 0a | 5c 65 6e 64 7b 76 65 72 |(file)..|\end{ver|
|00005970| 62 61 74 69 6d 7d 0a 0a | 6f 72 0a 0a 5c 62 65 67 |batim}..|or..\beg|
|00005980| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0a 3a 2d 5b |in{verba|tim}.:-[|
|00005990| 66 69 6c 65 5d 2e 20 25 | 20 74 68 69 73 20 63 61 |file]. %| this ca|
|000059a0| 6c 6c 73 20 74 68 65 20 | 63 6f 6d 70 69 6c 65 72 |lls the |compiler|
|000059b0| 20 74 6f 6f 20 21 21 21 | 0a 5c 65 6e 64 7b 76 65 | too !!!|.\end{ve|
|000059c0| 72 62 61 74 69 6d 7d 0a | 0a 46 6f 72 20 63 6f 6e |rbatim}.|.For con|
|000059d0| 73 75 6c 74 69 6e 67 20 | 69 6e 63 6c 75 64 65 64 |sulting |included|
|000059e0| 20 69 6e 74 65 72 70 72 | 65 74 65 64 20 63 6f 64 | interpr|eted cod|
|000059f0| 65 20 77 69 74 68 69 6e | 20 61 6e 20 65 6d 62 65 |e within| an embe|
|00005a00| 64 64 69 6e 67 20 72 65 | 63 6f 6e 73 75 6c 74 2f |dding re|consult/|
|00005a10| 31 0a 75 73 65 3a 0a 0a | 5c 62 65 67 69 6e 7b 76 |1.use:..|\begin{v|
|00005a20| 65 72 62 61 74 69 6d 7d | 0a 3a 2d 63 6f 6e 73 75 |erbatim}|.:-consu|
|00005a30| 6c 74 28 66 69 6c 65 29 | 2e 0a 5c 65 6e 64 7b 76 |lt(file)|..\end{v|
|00005a40| 65 72 62 61 74 69 6d 7d | 0a 0a 7b 5c 66 6c 75 73 |erbatim}|..{\flus|
|00005a50| 68 6c 65 66 74 20 69 6e | 7d 20 79 6f 75 72 20 28 |hleft in|} your (|
|00005a60| 75 6e 69 71 75 65 29 20 | 74 6f 70 2d 6c 65 76 65 |unique) |top-leve|
|00005a70| 6c 20 66 69 6c 65 2e 0a | 54 68 69 73 20 6f 76 65 |l file..|This ove|
|00005a80| 72 63 6f 6d 65 73 20 74 | 68 65 20 6c 69 6d 69 74 |rcomes t|he limit|
|00005a90| 61 74 69 6f 6e 20 6f 66 | 20 68 61 76 69 6e 67 20 |ation of| having |
|00005aa0| 6f 6e 6c 79 20 6f 6e 65 | 20 74 6f 70 2d 6c 65 76 |only one| top-lev|
|00005ab0| 65 6c 20 66 69 6c 65 2e | 0a 0a 5c 73 65 63 74 69 |el file.|..\secti|
|00005ac0| 6f 6e 7b 53 6f 75 72 63 | 65 2d 6c 65 76 65 6c 20 |on{Sourc|e-level |
|00005ad0| 73 74 61 74 65 6c 65 73 | 20 6d 6f 64 75 6c 65 73 |stateles| modules|
|00005ae0| 7d 0a 0a 5c 62 65 67 69 | 6e 7b 76 65 72 62 61 74 |}..\begi|n{verbat|
|00005af0| 69 6d 7d 0a 28 6d 6f 64 | 75 6c 65 29 2f 31 0a 63 |im}.(mod|ule)/1.c|
|00005b00| 75 72 72 65 6e 74 5f 6d | 6f 64 75 6c 65 2f 31 0a |urrent_m|odule/1.|
|00005b10| 69 73 5f 6d 6f 64 75 6c | 65 2f 31 20 20 20 20 20 |is_modul|e/1 |
|00005b20| 20 20 20 20 20 2d 20 63 | 68 65 63 6b 73 2f 67 65 | - c|hecks/ge|
|00005b30| 6e 65 72 61 74 65 73 20 | 61 6e 20 65 78 69 73 74 |nerates |an exist|
|00005b40| 69 6e 67 20 6d 6f 64 75 | 6c 65 2d 6e 61 6d 65 0a |ing modu|le-name.|
|00005b50| 6d 6f 64 75 6c 65 5f 63 | 61 6c 6c 2f 32 2c 20 27 |module_c|all/2, '|
|00005b60| 3a 27 2f 32 20 2d 20 63 | 61 6c 6c 73 20 61 20 70 |:'/2 - c|alls a p|
|00005b70| 72 65 64 69 63 61 74 65 | 20 68 69 64 64 65 6e 20 |redicate| hidden |
|00005b80| 69 6e 20 61 20 6d 6f 64 | 75 6c 65 0a 6d 6f 64 75 |in a mod|ule.modu|
|00005b90| 6c 65 5f 6e 61 6d 65 2f | 33 20 20 20 20 20 20 20 |le_name/|3 |
|00005ba0| 20 2d 20 61 64 64 73 20 | 74 68 65 20 6e 61 6d 65 | - adds |the name|
|00005bb0| 20 6f 66 20 61 20 6d 6f | 64 75 6c 65 20 74 6f 20 | of a mo|dule to |
|00005bc0| 61 20 73 79 6d 62 6f 6c | 0a 6d 6f 64 75 6c 65 5f |a symbol|.module_|
|00005bd0| 70 72 65 64 69 63 61 74 | 65 2f 33 20 20 20 2d 20 |predicat|e/3 - |
|00005be0| 61 64 64 73 20 74 68 65 | 20 6e 61 6d 65 20 6f 66 |adds the| name of|
|00005bf0| 20 61 20 6d 6f 64 75 6c | 65 20 74 6f 20 61 20 67 | a modul|e to a g|
|00005c00| 6f 61 6c 0a 6d 6f 64 75 | 6c 65 73 2f 31 20 20 20 |oal.modu|les/1 |
|00005c10| 20 20 20 20 20 20 20 20 | 20 2d 20 67 69 76 65 73 | | - gives|
|00005c20| 20 74 68 65 20 6c 69 73 | 74 20 6f 66 20 65 78 69 | the lis|t of exi|
|00005c30| 73 74 69 6e 67 20 6d 6f | 64 75 6c 65 73 0a 5c 65 |sting mo|dules.\e|
|00005c40| 6e 64 7b 76 65 72 62 61 | 74 69 6d 7d 0a 0a 54 68 |nd{verba|tim}..Th|
|00005c50| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 65 78 61 6d |e follow|ing exam|
|00005c60| 70 6c 65 3a 0a 5c 62 65 | 67 69 6e 7b 76 65 72 62 |ple:.\be|gin{verb|
|00005c70| 61 74 69 6d 7d 0a 3a 2d | 6d 6f 64 75 6c 65 20 6d |atim}.:-|module m|
|00005c80| 31 2e 0a 3a 2d 70 75 62 | 6c 69 63 20 64 2f 31 2e |1..:-pub|lic d/1.|
|00005c90| 0a 0a 61 28 31 29 2e 0a | 61 28 32 29 2e 0a 61 28 |..a(1)..|a(2)..a(|
|00005ca0| 33 29 2e 0a 61 28 34 29 | 2e 0a 0a 64 28 58 29 3a |3)..a(4)|...d(X):|
|00005cb0| 2d 61 28 58 29 2e 0a 0a | 3a 2d 6d 6f 64 75 6c 65 |-a(X)...|:-module|
|00005cc0| 20 6d 32 2e 0a 0a 3a 2d | 70 75 62 6c 69 63 20 62 | m2...:-|public b|
|00005cd0| 2f 31 2e 0a 0a 62 28 58 | 29 3a 2d 63 28 58 29 2e |/1...b(X|):-c(X).|
|00005ce0| 0a 0a 63 28 32 29 2e 0a | 63 28 33 29 2e 0a 63 28 |..c(2)..|c(3)..c(|
|00005cf0| 34 29 2e 0a 63 28 35 29 | 2e 0a 63 28 36 29 2e 0a |4)..c(5)|..c(6)..|
|00005d00| 0a 3a 2d 6d 6f 64 75 6c | 65 20 6d 33 2e 0a 0a 3a |.:-modul|e m3...:|
|00005d10| 2d 70 75 62 6c 69 63 20 | 74 65 73 74 2f 31 2e 0a |-public |test/1..|
|00005d20| 0a 74 65 73 74 28 58 29 | 3a 2d 62 28 58 29 2c 64 |.test(X)|:-b(X),d|
|00005d30| 28 58 29 2e 0a 0a 3a 2d | 6d 6f 64 75 6c 65 20 75 |(X)...:-|module u|
|00005d40| 73 65 72 2e 0a 0a 67 6f | 3a 2d 6d 6f 64 75 6c 65 |ser...go|:-module|
|00005d50| 73 28 4d 73 29 2c 77 72 | 69 74 65 28 4d 73 29 2c |s(Ms),wr|ite(Ms),|
|00005d60| 6e 6c 2c 66 61 69 6c 2e | 0a 67 6f 3a 2d 74 65 73 |nl,fail.|.go:-tes|
|00005d70| 74 28 58 29 2c 77 72 69 | 74 65 28 58 29 2c 6e 6c |t(X),wri|te(X),nl|
|00005d80| 2c 66 61 69 6c 2e 0a 5c | 65 6e 64 7b 76 65 72 62 |,fail..\|end{verb|
|00005d90| 61 74 69 6d 7d 0a 0a 45 | 78 65 63 75 74 69 6f 6e |atim}..E|xecution|
|00005da0| 67 20 5c 76 65 72 62 7e | 3f 2d 67 6f 2e 7e 20 77 |g \verb~|?-go.~ w|
|00005db0| 69 6c 6c 20 67 65 6e 65 | 72 61 74 65 20 74 68 65 |ill gene|rate the|
|00005dc0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 6f 75 74 70 75 | followi|ng outpu|
|00005dd0| 74 3a 0a 0a 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |t:..\beg|in{verba|
|00005de0| 74 69 6d 7d 0a 5b 75 73 | 65 72 2f 30 2c 6d 31 2f |tim}.[us|er/0,m1/|
|00005df0| 30 2c 6d 32 2f 30 2c 6d | 33 2f 30 5d 0a 32 0a 33 |0,m2/0,m|3/0].2.3|
|00005e00| 0a 34 0a 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d |.4.\end{|verbatim|
|00005e10| 7d 0a 0a 53 74 61 72 74 | 69 6e 67 20 77 69 74 68 |}..Start|ing with|
|00005e20| 20 76 65 72 73 69 6f 6e | 20 33 2e 33 30 2c 20 70 | version| 3.30, p|
|00005e30| 72 65 64 69 63 61 74 65 | 73 20 69 6e 20 74 68 65 |redicate|s in the|
|00005e40| 20 42 69 6e 50 72 6f 6c | 6f 67 20 73 79 73 74 65 | BinProl|og syste|
|00005e50| 6d 0a 69 74 73 65 6c 66 | 20 77 68 69 63 68 20 61 |m.itself| which a|
|00005e60| 72 65 20 6e 6f 74 20 69 | 6e 74 65 6e 64 65 64 20 |re not i|ntended |
|00005e70| 74 6f 20 62 65 20 75 73 | 65 64 20 62 79 20 61 70 |to be us|ed by ap|
|00005e80| 70 6c 69 63 61 74 69 6f | 6e 73 2c 20 61 72 65 20 |plicatio|ns, are |
|00005e90| 68 69 64 64 65 6e 20 69 | 6e 0a 74 68 65 20 6d 6f |hidden i|n.the mo|
|00005ea0| 64 75 6c 65 20 5c 76 65 | 72 62 7e 70 72 6f 6c 6f |dule \ve|rb~prolo|
|00005eb0| 67 7e 20 62 75 74 20 63 | 61 6e 20 62 65 20 61 63 |g~ but c|an be ac|
|00005ec0| 63 65 73 73 65 64 20 62 | 79 20 63 61 6c 6c 69 6e |cessed b|y callin|
|00005ed0| 67 20 74 68 65 6d 20 77 | 69 74 68 0a 5c 76 65 72 |g them w|ith.\ver|
|00005ee0| 62 7e 27 70 72 6f 6c 6f | 67 3a 6d 79 5f 70 72 65 |b~'prolo|g:my_pre|
|00005ef0| 64 69 63 61 74 65 27 28 | 2e 2e 2e 29 7e 2e 0a 0a |dicate'(|...)~...|
|00005f00| 45 78 70 6c 69 63 69 74 | 20 6e 61 6d 69 6e 67 20 |Explicit| naming |
|00005f10| 6f 66 20 74 68 65 20 6d | 6f 64 75 6c 65 20 77 68 |of the m|odule wh|
|00005f20| 65 72 65 20 74 68 65 20 | 68 69 64 64 65 6e 20 70 |ere the |hidden p|
|00005f30| 72 65 64 69 63 61 74 65 | 0a 69 73 20 64 65 66 69 |redicate|.is defi|
|00005f40| 6e 65 64 20 73 68 6f 75 | 6c 64 20 62 65 20 75 73 |ned shou|ld be us|
|00005f50| 65 64 20 77 68 65 6e 20 | 63 61 6c 6c 2f 31 2c 20 |ed when |call/1, |
|00005f60| 66 69 6e 64 61 6c 6c 2f | 33 20 65 74 63 2e 20 75 |findall/|3 etc. u|
|00005f70| 73 65 73 0a 61 20 68 69 | 64 64 65 6e 20 70 72 65 |ses.a hi|dden pre|
|00005f80| 64 69 63 61 74 65 2c 20 | 65 76 65 6e 20 69 66 20 |dicate, |even if |
|00005f90| 69 74 20 69 73 20 69 6e | 20 74 68 65 20 6d 6f 64 |it is in| the mod|
|00005fa0| 75 6c 65 20 69 74 73 65 | 6c 66 2e 0a 0a 54 68 69 |ule itse|lf...Thi|
|00005fb0| 73 20 64 72 61 63 6f 6e | 69 61 6e 20 63 6f 6e 73 |s dracon|ian cons|
|00005fc0| 74 72 61 69 6e 74 20 69 | 73 20 6d 6f 74 69 76 61 |traint i|s motiva|
|00005fd0| 74 65 64 20 62 79 20 73 | 69 6d 70 6c 69 63 69 74 |ted by s|implicit|
|00005fe0| 79 20 6f 66 0a 42 69 6e | 50 72 6f 6c 6f 67 27 73 |y of.Bin|Prolog's|
|00005ff0| 20 73 74 61 74 65 6c 65 | 73 73 20 70 75 72 65 6c | statele|ss purel|
|00006000| 79 20 73 6f 75 72 63 65 | 2d 6c 65 76 65 6c 20 6d |y source|-level m|
|00006010| 6f 64 75 6c 65 20 73 79 | 73 74 65 6d 2e 0a 42 61 |odule sy|stem..Ba|
|00006020| 73 69 63 61 6c 6c 79 20 | 70 72 65 64 69 63 61 74 |sically |predicat|
|00006030| 65 73 20 69 6e 20 61 20 | 6d 6f 64 75 6c 65 20 68 |es in a |module h|
|00006040| 61 76 65 20 74 68 65 69 | 72 20 6e 61 6d 65 73 20 |ave thei|r names |
|00006050| 70 72 65 66 69 78 65 64 | 0a 61 73 20 69 6e 20 5c |prefixed|.as in \|
|00006060| 76 65 72 62 7e 27 6d 79 | 5f 63 75 72 72 65 6e 74 |verb~'my|_current|
|00006070| 5f 6d 6f 64 75 6c 65 3a | 6d 79 5f 70 72 65 64 69 |_module:|my_predi|
|00006080| 63 61 74 65 27 20 69 6e | 20 61 20 70 72 65 70 72 |cate' in| a prepr|
|00006090| 6f 63 65 73 73 69 6e 67 | 0a 73 74 65 70 2c 20 65 |ocessing|.step, e|
|000060a0| 78 63 65 70 74 20 69 66 | 20 74 68 65 79 20 61 72 |xcept if| they ar|
|000060b0| 65 20 64 65 63 6c 61 72 | 65 64 20 5c 76 65 72 62 |e declar|ed \verb|
|000060c0| 7e 70 75 62 6c 69 63 7e | 20 6f 72 20 61 72 65 20 |~public~| or are |
|000060d0| 6b 6e 6f 77 6e 20 74 6f | 0a 74 68 65 20 73 79 73 |known to|.the sys|
|000060e0| 74 65 6d 20 61 73 20 62 | 65 69 6e 67 20 73 6f 20 |tem as b|eing so |
|000060f0| 28 69 2e 65 2e 20 69 6e | 20 74 68 65 20 63 61 73 |(i.e. in| the cas|
|00006100| 65 20 6f 66 20 62 75 69 | 6c 74 69 6e 73 29 2e 0a |e of bui|ltins)..|
|00006110| 0a 54 68 69 73 20 62 61 | 73 69 63 20 63 6f 6e 63 |.This ba|sic conc|
|00006120| 65 70 74 20 6f 66 20 6d | 6f 64 75 6c 65 73 20 28 |ept of m|odules (|
|00006130| 65 73 73 65 6e 74 69 61 | 6c 6c 79 20 74 68 65 20 |essentia|lly the |
|00006140| 73 61 6d 65 20 61 73 0a | 77 68 61 74 20 63 61 6e |same as.|what can|
|00006150| 20 62 65 20 61 63 68 69 | 65 76 65 64 20 77 69 74 | be achi|eved wit|
|00006160| 68 20 5c 76 65 72 62 7e | 65 78 74 65 72 6e 7e 20 |h \verb~|extern~ |
|00006170| 61 6e 64 20 5c 76 65 72 | 62 7e 73 74 61 74 69 63 |and \ver|b~static|
|00006180| 7e 0a 64 65 63 6c 61 72 | 61 74 69 6f 6e 73 20 69 |~.declar|ations i|
|00006190| 6e 20 43 29 20 63 6f 76 | 65 72 73 20 6f 6e 6c 79 |n C) cov|ers only|
|000061a0| 20 63 6f 6d 70 69 6c 65 | 64 20 63 6f 64 65 2c 0a | compile|d code,.|
|000061b0| 61 6e 64 20 69 73 20 6d | 6f 73 74 6c 79 20 69 6e |and is m|ostly in|
|000061c0| 74 65 6e 64 65 64 20 74 | 6f 20 65 6e 73 75 72 65 |tended t|o ensure|
|000061d0| 0a 6d 75 6c 74 69 70 6c | 65 20 6e 61 6d 65 20 73 |.multipl|e name s|
|000061e0| 70 61 63 65 73 20 77 69 | 74 68 20 61 20 76 65 72 |paces wi|th a ver|
|000061f0| 79 20 73 69 6d 70 6c 65 | 20 73 65 6d 61 6e 74 69 |y simple| semanti|
|00006200| 63 73 0a 61 6e 64 20 6e | 6f 20 61 64 69 74 69 6f |cs.and n|o aditio|
|00006210| 6e 61 6c 20 73 70 61 63 | 65 20 6f 72 20 74 69 6d |nal spac|e or tim|
|00006220| 65 20 6f 76 65 72 68 65 | 61 64 2e 20 4f 6e 20 74 |e overhe|ad. On t|
|00006230| 68 65 20 6f 74 68 65 72 | 0a 68 61 6e 64 20 75 73 |he other|.hand us|
|00006240| 65 20 6f 66 20 6c 69 6e | 65 61 72 20 61 6e 64 20 |e of lin|ear and |
|00006250| 69 6e 74 75 74 69 6f 6e | 69 73 74 69 63 20 69 6d |intution|istic im|
|00006260| 70 6c 69 63 61 74 69 6f | 6e 0a 69 73 20 73 75 67 |plicatio|n.is sug|
|00006270| 67 65 73 74 65 64 20 66 | 6f 72 20 64 79 6e 61 6d |gested f|or dynam|
|00006280| 69 63 20 6d 6f 64 75 6c | 61 72 20 61 6e 64 20 68 |ic modul|ar and h|
|00006290| 79 70 6f 74 68 65 74 69 | 63 61 6c 20 72 65 61 73 |ypotheti|cal reas|
|000062a0| 6f 6e 69 6e 67 0a 63 6f | 6e 73 74 72 75 63 74 73 |oning.co|nstructs|
|000062b0| 2e 0a 0a 7b 5c 65 6d 20 | 4d 65 74 61 2d 70 72 65 |...{\em |Meta-pre|
|000062c0| 64 69 63 61 74 65 7d 20 | 64 65 63 6c 61 72 61 74 |dicate} |declarat|
|000062d0| 69 6f 6e 73 20 61 72 65 | 20 6e 6f 74 20 73 75 70 |ions are| not sup|
|000062e0| 70 6f 72 74 65 64 20 61 | 74 20 74 68 69 73 20 74 |ported a|t this t|
|000062f0| 69 6d 65 20 28 6d 6f 73 | 74 6c 79 0a 62 65 63 61 |ime (mos|tly.beca|
|00006300| 75 73 65 20 74 68 65 79 | 20 61 72 65 20 61 74 20 |use they| are at |
|00006310| 6c 65 61 73 74 20 61 73 | 20 63 75 6d 62 65 72 73 |least as| cumbers|
|00006320| 6f 6d 65 20 61 73 20 6a | 75 73 74 20 70 75 74 69 |ome as j|ust puti|
|00006330| 6e 67 20 74 68 65 20 72 | 69 67 68 74 0a 6e 61 6d |ng the r|ight.nam|
|00006340| 65 20 65 78 74 65 6e 73 | 69 6f 6e 20 69 6e 20 61 |e extens|ion in a|
|00006350| 72 67 75 6d 65 6e 74 20 | 70 6f 73 69 74 69 6f 6e |rgument |position|
|00006360| 73 20 77 68 69 63 68 20 | 72 65 71 75 69 72 65 20 |s which |require |
|00006370| 69 74 20 5c 76 65 72 62 | 7e 3a 2d 29 7e 29 2c 20 |it \verb|~:-)~), |
|00006380| 62 75 74 20 74 68 65 79 | 0a 6d 69 67 68 74 20 62 |but they|.might b|
|00006390| 65 20 61 64 64 65 64 20 | 69 6e 20 74 68 65 20 66 |e added |in the f|
|000063a0| 75 74 75 72 65 20 69 66 | 20 61 20 73 69 67 6e 69 |uture if| a signi|
|000063b0| 66 69 63 61 6e 74 20 6e | 75 6d 62 65 72 20 6f 66 |ficant n|umber of|
|000063c0| 0a 75 73 65 72 73 20 77 | 69 6c 6c 20 61 73 6b 20 |.users w|ill ask |
|000063d0| 74 6f 20 68 61 76 65 20 | 74 68 65 6d 2e 0a 0a 4e |to have |them...N|
|000063e0| 6f 74 65 20 74 68 61 74 | 20 62 75 69 6c 74 69 6e |ote that| builtin|
|000063f0| 73 20 61 6e 64 20 70 72 | 65 64 69 63 61 74 65 73 |s and pr|edicates|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.