Public Domain Prolog Interpreters 
Author Message
 Public Domain Prolog Interpreters

I am in need of a prolog interpreter that supports the following utilities:

recorda
recordz
erase
recorded

We are currently using version 3.0 of the SBProlog interpreter from Sunny Brook
New York, running on a MicroVAX on top of Berkeley UNIX.  Does anyone know of
any public domain Prolog which supports these utilities?

If so, how can I get them? (I can ftp if I know the archive)   Please email any
relevant information.  Thanx in advance.

Ken Collier                            ...arizona!naucse!kwc

Northern Arizona University
Flagstaff, Arizona



Wed, 29 Jul 1992 06:15:00 GMT  
 Public Domain Prolog Interpreters

Quote:

> I need a Prolog interpreter that supports the following utilities:
> recorda/3
> recordz/3
> erase/1
> recorded/3
> We are currently using version 3.0 of the SB Prolog interpreter from
> Sunny Brook New York, running on a MicroVAX on top of Berkeley UNIX.

Given that the SB in SB Prolog stands for Stony Brook and that
SB Prolog is a compiler, are you _sure_ you're using SB Prolog?
I just FTPd a copy of the 3.1 SB Prolog manual, and each of these
commands is described in that manual.

The commands recorda/3, recordz/3, recorded/3, and erase/1 can be
simulated quite easily.  Recall the interface:
        recorda(+Key, +Term, -Ref)
        recordz(+Key, +Term, -Ref)
        recorded(+Key, ?Term, ?Ref)
    or  recorded(?Key, ?Term, +Ref)
        erase(+Ref)
In this interface, the significant part of Key is the FUNCTOR,
that is the *pair* FunctionSymbol/Arity; Term is any term, even a
variable, and all that is guaranteed about Refs is that
they are ground terms uniquely labelling (records in the recorded
data base or clauses in the clause store).  Data base references
are not an "efficiency" hack but a SEMANTIC hack; they are unique
names.

So, let's maintain two tables.  The first table will be a table
of counters and the second will be a table of the actual records.
We'll represent a data base reference by a triple '$REF'(F,N,I)
meaning the Ith tuple to be stored under the key F/N.

        :- dynamic
                ref_counter/2,
                recorded/3.

        recorda(Key, Term, Ref) :-
                ref_counter(Key, Tag, Ref),
                asserta(recorded(Tag,Term,Ref)).

        recordz(Key, Term, Ref) :-
                ref_counter(Key, Tag, Ref),
                assertz(recorded(Tag,Term,Ref)).

        erase(Ref) :-
                retractall(recorded(_,_,Ref)).

        ref_counter(Key, Tag, '$REF'(F,N,I)) :-
                functor(Key, F, N),
                functor(Tag, F, N),
                (   ref_counter(Tag, I0) ->
                    I is I0+1,
                    asserta(ref_counter(Tag,I)),
                    retractall(ref_counter(Tag, I0))
                ;/* this Tag has not been used as a Key before */
                    I is 1,
                    asserta(ref_counter(Tag,I))
                ).

Note that DEC-10 Prolog accepts integers as Keys (Quintus Prolog imitates
this) and so does this code.  However, this code also accepts floats as
Keys, which DEC-10 Prolog and Quintus Prolog don't.  I assume that this
doesn't matter.

This implementation is not supposed to be particularly fast, but then
if speed were of the first importance you wouldn't be using a free
compiler.  More seriously, the counters may run out, but you should be
able to do ~100 million recordas or recordzs under any given key before
that happens.  There are obvious ways around that.



Sat, 01 Aug 1992 16:13:40 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Public domain Prolog interpreter/compiler ...

2. public domain prolog interpreter

3. Looking for Public Domain Prolog Interpreter

4. Looking for public-domain Prolog interpreters

5. Prolog interpreter in public domain ?

6. Public domain (or inexpensive) PROLOG interpreter??

7. public domain prolog for apollo domain

8. Public Domain Unix APL Interpreter

9. Public Domain FORTH Interpreter/Compiler for BSD/VMS

10. Summary: Public-domain Ada interpreters

11. Public Domain or Shareware Interpreter for IBM Platform

12. Public domain ST interpreter

 

 
Powered by phpBB® Forum Software