I had a little talk at a BarCamp in Phuket once that contains some Pilog: http://www.prodevtips.com/2008/12/02/my-barcamp-phuket-presentation-= prolog-as-a-dating-aid/
Warning though, I can't guarantee that the code listings are the most effective or beautiful, they do however produce the results I wanted. /Henrik On Tue, Nov 24, 2009 at 5:28 PM, Alexander Burger <a...@software-lab.de> wro= te: > Hi Cle, > >> The Prolog definitions are: >> >> =A0 member(X, [X|_]). >> =A0 member(X, [_|T]) :- member(X, T). >> >> =A0 append([], L, L). >> =A0 append([H|L1], L2, [H|L3]) :- append(L1, L2, L3). > > You can directly translate them to Pilog, if you follow the rules: > > =A0 1. Define clauses with 'be' in the style of 'de' > =A0 2. Variables start with '@' instead of an uppercase letter > =A0 3. Commas, :- and the final dot are omitted > =A0 4. Lists are surrounded by parentheses instead of brackets > =A0 5. Dotted pairs have a dot instead of '|' > =A0 6. The 'cut' operator is 'T' instead of '!' > > With that you get; > > =A0 (be member (@X (@X . @))) > =A0 (be member (@X (@ . @Y)) (member @X @Y)) > > =A0 (be append (NIL @X @X)) > =A0 (be append ((@A . @X) @Y (@A . @Z)) (append @X @Y @Z)) > > (in fact, I copy/pasted that from "lib/pilog.l:117" :-) > > >> I already fail defining a correct Pilog member. This is, what I already = got: >> >> =A0 (be mymember (@ NIL) T) >> =A0 (be mymember (@X @L) (equal (-> @X) (car (-> @L)))) >> =A0 (be mymember (@X @L) (mymember @X (cdr (-> @L)))) > > This is not so bad. The first clause is OK as it is. > > In the second clause you are doing it halfway correct. (-> @X) is the > way to access a Pilog binding in a Lisp expression. You can use a > Lisp expression in a clause if that expression has a variable in its > CAR, then the CDR should be Lisp. The second clause could be > > =A0 (be mymember (@X @L) (@ =3D (-> @X) (car (-> @L)))) > > The third clause, however, is difficult to get straight in this way, as > 'mymember' is not a Lisp function. So it is better to use the standard > Prolog method of supplying a pattern like (@X . @) or (@ . @Y) to split > a list, as in the Pilog clauses above. > > > I really need to document Pilog! I have it on my todo list, but > currently I try to document the database classes first. > > Cheers, > - Alex > -- > UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe > -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe