Personal tools
Document Actions

odra.8 warren

by Paul McJones last modified 2019-05-20 16:52

WARREN' S TESTS: PROGRAMY POCHODZA Z PRACY DOKTORSKIEJ D H D WARRENA: IMPLEMENTING PROLOG-COMPILING PREDICATE LOGIC PROGRAMS, UNIVERSITY OF EDINBURGH,1977

* ************************************************************
*                                                            *
*   PROGRAMY POCHODZA Z PRACY DOKTORSKIEJ D H D WARRENA:     *
*   IMPLEMENTING PROLOG-COMPILING PREDICATE LOGIC PROGRAMS,  *
*   UNIVERSITY OF EDINBURGH,1977^                            *
* ************************************************************.


*** WARREN' S  TESTS *** .
-AJOP(".",1,"X'(X'X)")!

+SSORT(*X) -IMPRHET -SORT(*X) -LIGNE -IMPRHET.

+TESTMANY(1) -/ -TEST(*X) -SSORT(*X).
+TESTMANY(*N) -TEST(*X) -FAIL.
+TESTMANY(*N) -MOINS(*N,1,*M) -TESTMANY(*M).


* 1) REVERSE A LIST.
+LIST30(1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.
27.28.29.30.NIL).

+NREVERSE(*X.*L0,*L) -NREVERSE(*L0,*L1) -CONCATENATE(*L1,*X.NIL,*L).
+NREVERSE(NIL,NIL).

+CONCATENATE(*X.*L1,*L2,*X .*L3) -CONCATENATE(*L1,*L2,*L3).
+CONCATENATE(NIL,*L,*L).


* 2) QUICKSORT.
+LIST50(27.74.17.33.94.18.46.83.65.2.32.53.28.85.99.47.28.82.6.11.55.29.39.81.
90.37.10.0.66.51.7.21.85.27.31.63.75.4.95.99.11.28.61.74.18.92.40.53.59.8.NIL).

+QSORT(*X.*L,*R,*R0) -PARTITION(*L,*X,*L1,*L2)
   -QSORT(*L2,*R1,*R0) -QSORT(*L1,*R,*X.*R1).
+QSORT(NIL,*R,*R).

+PARTITION(*X.*L,*Y,*X.*L1,*L2) - INF(*X,*Y) -/ -PARTITION(*L,*Y,*L1,*L2).
+PARTITION(*X.*L,*Y,*L1,*X.*L2) -PARTITION(*L,*Y,*L1,*L2).
+PARTITION(NIL,*Z,NIL,NIL).

* 3) DERIV.
-AJOP("+",2,"X'(X'X)")!  -AJOP("-",2,"X'(X'X)")!
-AJOP("*",3,"X'(X'X)")!
-AJOP("/",3,"X'(X'X)")!
-AJOP(" ",4,"X'(X'X)")!
-AJOP("MINUS",5,"'X")!

+TIMES10( ((((((((X * X)* X)* X) * X) * X)* X)* X)* X)* X  ).
+DIVIDE10( ((((((((X/X)/X)/X)/X)/X)/X)/X)/X)/X ).
+LOG10( LOG(LOG(LOG(LOG(LOG(LOG(LOG(LOG(LOG(LOG(X)))))))))) ).
+OPS8( (X+1)*(X 2+2)*(X 3+3)).

+D(*U + *V,*X,*DU + *DV) -/ -D(*U,*X,*DU) -D(*V,*X,*DV).
+D(*U - *V, *X,*DU - *DV) -/ -D(*U,*X,*DU) -D(*V,*X,*DV).
+D(*U * *V, *X,*DU * *V + *U * *DV) -/ -D(*U,*X,*DU) -D(*V,*X,*DV).
+D(*U/*V,*X,(*DU * *V-*U * *DV)/*V 2)-/ -D(*U,*X,*DU) -D(*V,*X,*DV).
+D(*U *N,*X,*DU* *N * *U *N1) -/ -MOINS(*N,1,*N1) -D(*U,*X,*DU).
+D(MINUS *U, *X ,MINUS *DU) -/ -D(*U,*X,*DU).
+D(EXP(*U),*X,EXP(*U)**DU) -/ -D(*U,*X,*DU).
+D(LOG(*U),*X,*DU / *U) -/ -D(*U,*X,*DU).
+D(*X,*X,1) -/.
+D(*C,*X,0).
  -OPS8(*X) -SSORT(*X) -D(*X,X,*Y) -SSORT(*Y)!


*  4) SERIALISE.
+PALIN25("ABLE WAS I ERE I SAW ELBA").

+SERIALISE(*L,*R) -PAIRLISTS(*L,*R,*A) -ARRANGE(*A,*T) -NUMBERED(*T,1,*N).

+PAIRLISTS(*X.*L,*Y.*R,PAIR(*X,*Y).*A) -PAIRLISTS(*L,*R,*A).
+PAIRLISTS(NIL,NIL,NIL).

+ARRANGE(*X.*L,TREE(*T1,*X,*T2)) -SPLIT(*L,*X,*L1,*L2)
   -ARRANGE(*L1,*T1) -ARRANGE(*L2,*T2).
+ARRANGE(NIL,VOID).

+SPLIT(*X.*L,*X,*L1,*L2) -/ -SPLIT(*L,*X,*L1,*L2).
+SPLIT(*X.*L,*Y,*X.*L1,*L2) -BEFORE(*X,*Y) -/ -SPLIT(*L,*Y,*L1,*L2).
+SPLIT(*X.*L,*Y,*L1,*X.*L2) -BEFORE(*Y,*X) -/ -SPLIT(*L,*Y,*L1,*L2).
+SPLIT(NIL,*Z,NIL,NIL).

+BEFORE(PAIR(*X1,*Y1),PAIR(*X2,*Y2)) -INF(*X1,*X2).

+NUMBERED(TREE(*T1,PAIR(*X,*N1),*T2),*N0,*N)
   -NUMBERED(*T1,*N0,*N1) -PLUS(*N1,1,*N2) -NUMBERED(*T2,*N2,*N).
+NUMBERED(VOID,*N,*N).

*  5) QUERY.
+POP(CHINA,8250). +POP(INDIA,5863). +POP(USSR,2521). +POP(USA,2119).
+POP(INDONESIA,1276). +POP(JAPAN,1097). +POP(BRAZIL,1042). +POP(BANGLADESH,750).
+POP(PAKISTAN,682). +POP(WESTGERMANY,620). +POP(NIGERIA,613).+POP(MEXICO,581).
+POP(UK,559). +POP(ITALY,554). +POP(FRANCE,525).
+POP(PHILLIPINES,415). +POP(THAILAND,410). +POP(TURKEY,383). +POP(EGYPT,364).
+POP(SPAIN,352). +POP(POLAND,337). +POP(SOUTHKOREA,335). +POP(IRAN,320).
+POP(ETHIOPIA,272). +POP(ARGENTINA,251).

+AREA(CHINA,3380). +AREA(INDIA,1139). +AREA(USSR,8708). +AREA(USA,3609).
+AREA(INDONESIA,570). +AREA(JAPAN,148). +AREA(BRAZIL,3288). +AREA(BANGLADESH,55)
. +AREA(PAKISTAN,311). +AREA(WESTGERMANY,96). +AREA(NIGERIA,373). +AREA(MEXICO,7
64). +AREA(UK,86).
+AREA(ITALY,116). +AREA(FRANCE,213). +AREA(PHILLIPINES,90).
+AREA(THAILAND,200).
+AREA(TURKEY,296). +AREA(EGYPT,386). +AREA(SPAIN,190). +AREA(POLAND,121). +AREA(
SOUTHKOREA,37). +AREA(IRAN,628). +AREA(ETHIOPIA,350). +AREA(ARGENTINA,1080).

-POP(*X,*Y) -AREA(*X,*Z) -SORT(*X) -SORM("   ") -SORT(*Y) -SORM("   ")
   -SORT(*Z)!

+QUERY(*C1.*D1.*C2.*D2) -DENSITY(*C1,*D1) -DENSITY(*C2,*D2) -INF(*D2,*D1)
   -MULT(*D1,20,*D11) -MULT(*D2,21,*D22) -INF(*D11,*D22).
+DENSITY(*C,*D) -POP(*C,*P) -AREA(*C,*A) -MULT(*P,100,*P100) -DIV(*P100,*A,*D).



+BREAK.
+TEST(*Y) -LIST30(*X) -NREVERSE(*X,*Y) -/.
-IMPRHET -TESTMANY(10)!

+BREAK.
+TEST(*Y) -LIST50(*X) -QSORT(*X,*Y,NIL) -/.
-IMPRHET -TESTMANY(10)!

+BREAK.
+TEST(*Y) -TIMES10(*X) -D(*X,X,*Y) -/.
-IMPRHET -TESTMANY(10)!

+BREAK.
+TEST(*Y) -DIVIDE10(*X) -D(*X,X,*Y) -/.
-IMPRHET -TESTMANY(10)!

+BREAK.
+TEST(*Y) -LOG10(*X) -D(*X,X,*Y) -/.
-IMPRHET -TESTMANY(10)!

+BREAK.
+TEST(*Y) -OPS8(*X) -D(*X,X,*Y) -/.
-IMPRHET -TESTMANY(10)!

+BREAK.
+TEST(*Y) -PALIN25(*X) -SERIALISE(*X,*Y).
-IMPRHET -TESTMANY(10)!

+BREAK.
+PALIN25(2.3.6.4.1.9.2.8.1.5.1.4.7.4.1.5.1.8.2.9.1.4.6.3.2.NIL).
+TEST(*Y) -PALIN25(*X) -SERIALISE(*X,*Y).
-IMPRHET -TESTMANY(10)!

+BREAK.
+TEST(*X) -QUERY(*X).
-IMPRHET -TESTMANY(10)!
-TTY!
« November 2020 »
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: