<< $Id: example.txt,v 1.10 2005/11/17 00:29:29 layer Exp $ >> << Instructions in this template appear in comments like this. You can leave them in your entry or remove them. It is up to you. They are ignored by the entry processing program. INSTRUCTIONS FOR FILLING IN THIS TEMPLATE A bit about the formatting is this file, which is somewhat like the markup language that some wiki's use. * Please leave the section headers (== foo ==) as they are. * Paragraphs should not be indented. * Examples should be indented 2 spaces. They will be put into an HTML `pre' and will appear verbatim. * No HTML is allowed. All occurances of < and > will be escaped. * Links in your text can be described like this: href(name of link,http://...) * Emails in text can be specified as mailto(foo@bar.com) so they appear as links on the site. * Bold and italic are accomplished with bold(text) and italic(text). * Lists of items are accomplished with a ``* '', with no indentation before the first and subsequent lines. This sentence is in a valid list item. Each section for an entry starts with ``== ... ==''. The first comment inside each section gives a description of the type of text you should enter for that section. The first part of this comment has the form: TYPE: where will vary from section to section. Here are the valid types and the format for each: type description ---- ----------- plain-text Plain text. wml `wml' stands for `wiki-like markup language'. Sections of this type can use href(), mailto(), bold(), italic(), `* ' lists, and use indentation to distinguish from paragraphs and examples. url a fully formed and valid URL urls a list of URLs, one per line date a date (currently any format will do) version a version (currently any format will do) >> << ******************************************************************* >> << ********* ENTRY STARTS HERE *************************************** >> << ******************************************************************* >> == name == << The name of your entry. Anything from one word to a few is OK. The name can contain spaces, too. TYPE: plain-text >> Allegro Prolog == category == << Looking at the menu on the left of lispwire.com, which one would you say best describes your entry, or should we make a new entry? If we should make a new menu entry for your application, what would you suggest it be? TYPE: plain-text >> AI -> Logic Languages -> Prolog -> Allegro Prolog == author == << Descriptive text about the author(s). Use the mailto() macro to specify an email address. TYPE: wml >> Steven M. Haflich (mailto(smh@franz.com), mailto(support@franz.com)) adapted Peter Norvig's Common Lisp implementation. == author-image == << If there is a url with your favorite picture, please include it here, otherwise send it to us via email. If there is more than one author, you can send us multiple links. TYPE: url >> == short-description == << A short description, 3 or 4 sentences long at the most. This description will appear on index pages of applications, which is why it needs to be short and concise. TYPE: wml >> Prolog is a logic programming language built around a backward-chaining inference engine. Allegro Prolog is a highly efficient implementation of Prolog within Common Lisp. There are extensions for interfacing in both directions with Lisp code, for unifying against Lisp object slots, and for interfacing the inference engine to Lisp databases. == long-description == << A long description of your entry. Keep in mind this is probably the first thing potential users of your application will read. TYPE: wml >> Prolog is a logic programming language based on first-order logic and horn clauses. Prolog is a back-chaining system, that is, it starts with a desired result and attempts to derive a path to that result using truth rules it has been given. Prolog is a mature and complete language with its own ISO standard. There exist quality implementations both commercial and free. As a self-contained programming language, ISO Prolog necessarily contains functionality in all the usual places necessary for general-purpose for a computer languages such as reading and printing, file manipulation, and operating system interface. It isn't the purpose of Allegro Prolog to compete with full Prolog implementations -- rather, it intends only to provide Lisp programs with the logic inference engine of Prolog, efficiently implemented and tightly integrated with Lisp computation. It includes a number of the usual Prolog operators, but not those concerned with capabilities such as I/O, system interface, or filesystem operations. Lisp programmers using Prolog for its inferencing capabilities would probably prefer to keep these other system areas in Lisp code. This makes the Prolog system smaller and easier for Lisp programmers to learn. There are two equivalent syntaxes traditionally used for expressing Prolog code. Edinburgh syntax, the more common of the two, is similar to C syntax, while Lisp sexpr syntax is more-often used by systems implemented in and interfacing with Lisp. Allegro Prolog uses sexpr syntax. There is more info and additional links on the Franz Inc. href(Tech Corner article about Allegro Prolog, http://www.franz.com/support/tech_corner/prolog-071504.lhtml). == examples == << Some examples of your code in action; they need not be self-contained, just code segments that show the power of your code. The more examples the better. These will likely be the first example uses new users of your code will see. Wow them! TYPE: wml >> Here is a solution for the "Who owns the zebra?" puzzle in Allegro Prolog: (<-- (nextto ?x ?y ?list) (iright ?x ?y ?list)) (<- (nextto ?x ?y ?list) (iright ?y ?x ?list)) (<-- (iright ?left ?right (?left ?right . ?rest))) (<- (iright ?left ?right (?x . ?rest)) (iright ?left ?right ?rest)) (<-- (zebra ?h ?w ?z) ;; Each house is of the form: ;; (house nationality pet cigarette drink house-color) (= ?h ((house norwegian ? ? ? ?) ? (house ? ? ? milk ?) ? ?)) (member (house englishman ? ? ? red) ?h) (member (house spaniard dog ? ? ?) ?h) (member (house ? ? ? coffee green) ?h) (member (house ukrainian ? ? tea ?) ?h) (iright (house ? ? ? ? ivory) (house ? ? ? ? green) ?h) (member (house ? snails winston ? ?) ?h) (member (house ? ? kools ? yellow) ?h) (nextto (house ? ? chesterfield ? ?) (house ? fox ? ? ?) ?h) (nextto (house ? ? kools ? ?) (house ? horse ? ? ?) ?h) (member (house ? ? luckystrike oj ?) ?h) (member (house japanese ? parliaments ? ?) ?h) (nextto (house norwegian ? ? ? ?) (house ? ? ? ? blue) ?h) (member (house ?w ? ? water ?) ?h) (member (house ?z zebra ? ? ?) ?h) ) ;; This runs the query: (?- (zebra ?houses ?water-drinker ?zebra-owner)) For comparison, here is how the first few rules above would be expressed in Edinburgh syntax: nextto(X, Y, List) :- iright(X, Y, List). nextto(X, Y, List) :- iright(Y, X, List). iright(Left, Right, [Left, Right | _]). iright(Left, Right, [_ | Rest]) :- iright(Left, Right, Rest). == instructions == << Instructions on how to load and use your code. We encourage everyone to have a file called "load.cl" that loads their project. TYPE: wml >> Allegro Prolog is included with Allegro CL 7.0 and available as a patch for Allegro CL 6.2. Before using Allegro Prolog it must be loaded into the Lisp image, and it is convenient to use the symbols exported by the prolog package.. This can be done interactively with (require :prolog) (use-package :prolog) In a source file these forms would typically be expressed this way (eval-when (compile load eval) (require :prolog) (use-package :prolog)) Once loaded, interactive use of prolog is mostly through two Lisp macros. The <- macro adds rules to the internal Prolog database. The ?- macro invokes the prolog engine to try to find a solution to a series of clauses. Here is an example using the built-in Prolog append functor. It has three arguments and succeeds if appending first and second arguments results in the same same list as the third argument: cl-user(11): (?- (append (a b) (c d) (a b c d))) Yes No. cl-user(12): (?- (append (a b) (c d) (a c d))) No. This isn't so interesting, but the neat thing about append is that it also computes correctly if bold(any) two of the three list arguments are given! cl-user(13): (?- (append ?x (b c d) (a b c d))) ?x = (a) No. Here ?x is a variable, and Prolog tells us the values of any variables when it finds a solution. It is necessary to explain how the programmer interacts with ?- macro, which is copied exactly from traditional Prolog top-level loops. A succession of Prolog clauses like the calls to append above might have zero, one, or more solutions. For each solution, ?- prints the varues of any variables, or if there are no variables, prints the word "Yes". It then waits for input: if the programmer tells ?- to continue by typing Return (or Enter, or a semicolon, or whatever passes for an empty line on his particular system) ?- then searches for another solution. If there are no more solutions, it prints the word "No". The programmer can instruct Prolog not to look for more solutions by typing the period character. cl-user(14): (?- (append (a b) ?x (a b c d))) ?x = (c d) No. So in the example above, the programmer typed Return after Prolog printed the ?x line, and then Prolog reported that there were no more solutions and returned. Finally, Prolog append also computes results when both of the first two arguments are variables. cl-user(15): (?- (append ?x ?y (a b c d))) ?x = () ?y = (a b c d) ?x = (a) ?y = (b c d) ?x = (a b) ?y = (c d) ?x = (a b c) ?y = (d) ?x = (a b c d) ?y = () No. In this example Prolog found five solutions, and in each case the programmer typed Return to find the next solution. The fifth time Prolog reported no more solutions. You usually don't want to use Prolog append if the third argument and at least one of the first two arguments are variables. Prolog will find an infinite number of solutions, all of which contain additional unbound variables, but discussion of this issue is beyond the scope of this simple example. The <-- macro used in some places above is a variant of the <- macro. It first removes any existing clauses for the same functor and arity (number of arguments), and is useful when interactively entering and reentering Prolog code. A Prolog functor is defined as a combination of all the clauses that have been entered into its database. When correcting an earlier definition it is generally necessary to remove previously-defined clauses rather than adding to them. <-- is a convenience macro that does this. == tutorial == << A tutorial of how to do simple to complex things; intermix code and description. A comprehensive tutorial is strongly recommended. Remember, example text is indented, explanatory text is not. TYPE: wml >> Computation done by a Prolog engine is fundamentally different from computation done by functional languages like Lisp, C, and Java. Programmers unfamiliar with Prolog would do well to consult one of several Prolog tutorials on the web. Although these will cover aspects of Prolog programming that won't be used in Allegro Prolog (e.g. reading and printing) but they will introduce the standard Prolog operators and acquaint the programmer with the Prolog way of thinking. << Some tutorial pages specific to Allegro Prolog are href(online at Franz,http://www.franz.com/support/documentation/7.0/doc/prolog-tut.html). >> The Allegro Prolog tutorial touches on Prolog programming itself, but concentrates more on issues specific to Lisp integration. Programmers without sufficient background in Prolog are encouraged to read one of the several available Prolog tutorials. In addition to the classic Clocksyn and Mellish cited under book links, several free tutorials are available via the www.swi-prolog.org site from the "links" navigation menu. The recent _Learn Prolog Now!_ by Blackburn, Bos, and Striegnitz seems particularly strong on the issues of Prolog programming, rather than Prolog theory and implementation. == home-url == << The URL of the home page for your project. In some cases this will be empty. Just list the URL without using the href() macro. TYPE: url >> == doc-url == << The URLs to your documentation -- just list the URLs one per line, without using the href() macro. TYPE: urls >> http://www.franz.com/support/documentation/7.0/doc/prolog.html == license == << If you have a specific license for the code, include the URL here. If not, and you want it to be public domain, specify that here too. TYPE: wml >> Allegro Prolog requires no additional license beyond the license to use Allegro CL 6.2 or later. Supported (including Trial) users of 6.2 can download Allego Prolog as a normal patch file with sys:update-allegro. == book == << If there are books that are relevant to the audience of your program, list them here. Please include the title and book URL (to amazon.com or some other site). Recommended syntax is one "paragraph" per book (with no indentation): href(book title,http://...) by author. descriptive text... more text... TYPE: wml >> href(Paradigms of Artificial Intelligence Programming,http://www.amazon.com/exec/obidos/ASIN/1558601910/) by Peter Norvig. Allegro Prolog is an extended, optimized version of the original Prolog implementation developed by Norvig in this volume. The development and explanation are excellent for anyone who wants both to understand how to use Prolog and what the Prolog engine is doing inside. href(Programming in Prolog,http://www.amazon.com/exec/obidos/tg/detail/-/3540583505) by W.F. Clocksyn, C.S. Mellish. "Clocksin and Mellish" through its several versions has been to Prolog what "K&R" has been to C. It is the standard Prolog tutorial and reference. << TODO: Jans has one more favorite Prolog book to add to this collection. >> == references == << Include text which would be of interest to readers wishing to dive deeper into the subject of your application. TYPE: wml >> Anyone who wants to play with a standalone Prolog implementation is encouraged to check out href(SWI Prolog,http://www.swi-prolog.org/). It is an excellent, mature, open-souce Prolog implementation. The web site also has numerous links to other Prolog resources. Allegro Prolog is not in competition with standalone Prologs. Allegro Prolog exists to make the Prolog inference engine and standard predefined functors -- the core of the Prolog language model -- available from a Common Lisp program. == source-fooball == << The URL where the source code can be obtained, or some description of the status of obtaining source code. TYPE: wml >> Currently sources are not available. Meanwhile, parties interested in obtaining the source may contact Franz Inc. at mailto(info@franz.com). == release-date == << Specify the date of the current release. TYPE: date >> 15 July, 2004 == release-version == << Specify the version of the current release. TYPE: version >> 0.92 == status == << One of: alpha, beta or stable. You may also include descriptive text relevant to the status of the current version. TYPE: wml >> Stable. Allegro Prolog is a supported product, but it is also a new product and still evolving. Integration of Prolog, Comon Lisp, and large database support is somewhat an experimental project, and this experimentation will drive evolution. So much as possible, of course, such evolution will be backward compatible. Updated patch versions for Allegro 6.2 and 7.0 will be released from time to time through the regular Franz Inc support site. The usual update-allegro procedure will retrieve the latest version. == history == << Any relevant version history. TYPE: wml >> Initial release as an Allegro CL 6.2 patch was 15 July, 2004. == acl-dependencies == << Include here a description of dependencies on particlar versions of ACL. TYPE: wml >> Should run in any Allegro CL 6.2 or later. 7.0 or later preferred for slight performance gain. == other-dependencies == << Include here a description of dependencies on other software; for example, if the software relies on another package (e.g., AllegroServe) to run, say that here. Also, if a specific operating system package (i.e., rpm package) is needed specify it here. TYPE: wml >> None. == platform == << If the software runs only on specific platforms for this software, include that information here. TYPE: wml >> Any Allegro CL supported platform. == ad == << IGNORE -- this is an internal field. >> aiprogramming