🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #3621

Seattle tutorial Prolog

#3621
From: Bart Demoen
Date: Tue, 30 Aug 1988 10:37
45 lines
1626 bytes
Tutorial No:8 of LP'88 Seattle (R. O'Keefe) makes 'interesting' reading, but
don't think that the topics were completely exhausted; here is an example:

Section 9 p.106 shows some meta-interpreters and their timings on naive reverse.
A very simple change in the representation of the program to be interpreted,
gives a much better speed improvement than from

	defaulty (4.6 KLips)    to   rule/3 (5.5 KLips)

I based my measurements on rule/2, so

instead of representing the nrev program as:

rule(append([],_l,_l),[]) .
rule(append([_x|_l1],_l2,[_x|_l3]),[append(_l1,_l2,_l3)]) .

rule(nrev([],[]),[]) .
rule(nrev([_x|_r],_o),[nrev(_r,_o1) , append(_o1,[_x],_o)]) .


do it as:

rule(append(_x,_y,_z),_b) :- append(_x,_y,_z,_b) .
rule(nrev(_x,_y),_b) :- nrev(_x,_y,_b) .

append([],_l,_l,[]) .
append([_x|_l1],_l2,[_x|_l3],[append(_l1,_l2,_l3)]) .

nrev([],[],[]) .
nrev([_x|_r],_o,[nrev(_r,_o1) , append(_o1,[_x],_o)]) .


and the KLips went up from 5.2 to 7.2 (on a SUN3/50 BIMprolog 2.3)

in this way, you regain the indexing lost previously

This is not the topspeed in meta-interpreting nrev: 10 KLips is also reachable.


bimbart@kulcs.uucp
Bart Demoen
Dept. of Computer Science
Celestijnenlaan 200A
B-3030 Leuven
Belgium
Technical Details
Message-ID: <1416@kulcs.kulcs.uucp>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!prlb2!kulcs!bimbart

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!prlb2!kulcs!bimbart
From: bimbart@kulcs.uucp (Bart Demoen)
Newsgroups: comp.lang.prolog
Subject: Seattle tutorial Prolog
Message-ID: <1416@kulcs.kulcs.uucp>
Date: 30 Aug 88 10:37:42 GMT
Reply-To: bimbart@kulcs.UUCP (Bart Demoen)
Organization: Katholieke Universiteit Leuven, Dept. Computer Science
Lines: 45