Article View: comp.lang.prolog
Article #473Re: More fun with WG17
From: Richard O'Keefe
Date: Wed, 15 Nov 1989 08:38
Date: Wed, 15 Nov 1989 08:38
51 lines
2229 bytes
2229 bytes
In article <310@unizh.UUCP>, fuchs@unizh.UUCP (fuchs) writes:
> where does one find your 1984 formal definition of Prolog? Would you care
> to put it on comp.lang.prolog? --- nef
Well, it was sent to the BSI committee, so it _should_ have been assigned
a PS/ number and it _should_ be obtainable from them. It also saw the
light of day as an Auckland University Computer Science report entitled
"A Formal Specification of Prolog".
I've retyped it from memory here, and it runs naive reverse at the
incredible speed of 1.3 LIPS. Trouble is that the definition is written
in a pure functional style and can't take advantage of Prolog. Here's
what the data base for naive reverse looks like:
db_example(
mu(append/3, [
clause([ nonvar('[]',0,[]), % append([]
var(1), % ,X
var(1) ], % ,X) :-
true), % true.
clause([ nonvar('.',2,[ % append([
var(1), % H|
var(2)]), % T]
var(3), % ,L
nonvar('.',2,[ % ,[
var(1), % H|
var(4)]) ], % R]) :-
user(append/3, [ % append(
var(2), var(3), var(4)]) % T, L, R)
)],
mu(reverse/2, [
clause([ nonvar('[]',0,[]), % reverse([]
nonvar('[]',0,[]) ], % ,[]) :-
true), % true.
clause([ nonvar('.',2,[ % reverse([
var(1), % H|
var(2)]), % T]
var(3) ], % ,R) :-
( user(reverse/2, [ % reverse(
var(2), var(4) ]) % T, L)
, user(append/3, [ % , append(
var(4), % L
nonvar('.',2,[ % ,[
var(1), % H|
nonvar('[]',0,[])]), % []]
var(3) ]) % ,R)
))],
none))
).
I mean to post the thing to the net when I've got findall/3 defined.
Technical Details
Message-ID:
<2713@munnari.oz.au>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!munnari.oz.au!mudla!okReferences:
<2609@munnari.oz.au> <696@sce.carleton.ca> <2643@munnari.oz.au> <310@unizh.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!munnari.oz.au!mudla!ok From: ok@mudla.cs.mu.OZ.AU (Richard O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: More fun with WG17 Message-ID: <2713@munnari.oz.au> Date: 15 Nov 89 08:38:56 GMT References: <2609@munnari.oz.au> <696@sce.carleton.ca> <2643@munnari.oz.au> <310@unizh.UUCP> Sender: news@cs.mu.oz.au Lines: 51