[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::amiga_v1

Title:AMIGA NOTES
Notice:Join us in the *NEW* conference - HYDRA::AMIGA_V2
Moderator:HYDRA::MOORE
Created:Sat Apr 26 1986
Last Modified:Wed Feb 05 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:5378
Total number of notes:38326

1486.0. "pd prolog" by AUNTB::PRESSLEY () Tue Jun 21 1988 03:01

    I have the pd interpreter for prolog.  If anyone is interested I'll
    post it.  Also does anyone know of an ops5 pd floating around?
T.RTitleUserPersonal
Name
DateLines
1486.1C-PrologYIPPEE::GOULNIKOogaboogaBox typeTue Jun 21 1988 10:216
	I'm interested. I also the sources for C-Prolog (from F.Pereira, 
	University of Edinburgh). I havent received my C compiler yet so
	I couldnt try but I think it's fairly portable.

Iv.
1486.2may the source be with youAUNTB::PRESSLEYTue Jun 21 1988 11:221
    The source is included.  Written in C.
1486.3here it isAUNTB::PRESSLEYTue Jun 21 1988 11:241
    $1$dus13:[pressley.amiga.public]
1486.4Where?AYOV10::ATHOMSONC'mon, git aff! /The Kelty ClippieTue Jun 21 1988 12:1020
1486.5WJG::GUINEAUTue Jun 21 1988 13:305
What kind of language is PROLOG?  Is it any good?

John

1486.6Logicians do it backwardsYIPPEE::GOULNIKOogaboogaBox typeTue Jun 21 1988 14:289

	It's a funny sort of language, based on 1st order logic.
	It is non-deterministic and supposedly declarative, it's
	got an AI label and is very well thought of in Europe,
	but it requires a very different mindset. It's to C and
	Pascal what Chinese is to English.

Iv
1486.7RSNAUNTB::PRESSLEYTue Jun 21 1988 14:492
    I will post it tonite.  Check in at about 8:00pm
    
1486.8WJG::GUINEAUTue Jun 21 1988 16:375
could someone post a small PROLOG program??


John
1486.9Example (long)NAC::PLOUFFBeautiful downtown LittletonTue Jun 21 1988 18:4980
    Minor warning.  After PD Prolog appeared on Usenet, several people
    complained that it didn't work exactly right.  This appears to be
    a "toy" implementation and quite limited.
    
    Re: .1
    
    C-Prolog should be quite robust, as Pereira and U. Edinburgh are
    both pioneers in the language.  If the sources are freely
    redistributable I would like to get them.
    
    Re: example program
    
    Here is a short program from _How to Solve It in Prolog_, by Pereira
    and two others.  The syntax may differ slightly from the "Edinburgh"
    syntax commonly used. 
    
    PROBLEM:  Determine whether a word is a palindrome, i.e. whether it
    reads the same forward or backward. 
    
    PROGRAM:
    
    begin(X):- read(X),(X=stop ; test_palindrome(X),begin(Y)).
    
    test_palindrome(X):- name(X,Nx),palindrome(Nn),write(X),
    			 write(' is a palindrome'),n1,!.
    test_palindrome(X):- write(X),
    			 write(' is not a palindrome'),n1.
    
    palindrome(X):- reverse2(X,X).
    
    reverse2(L1,L):- reverse_append(L1,[],L).
    
    reverse_append([H|T],L,M):- reverse_append(T,[H|L],M).
    reverse_append([],L,L).

    EXECUTION:
    
    :-begin(X).
    
    madam. john. astyuytsa. horse. bull. stop.
    
    madam is a palindrome
    john is not a palindrome
    [etc...]
    bull is not a palindrome
    
    
    Oversimplified explanation:  Each statement or set of statements
    defines a logic function which may be true or false.  Successive lines
    defining the same function are evaluated in order; otherwise there are
    no rules about statement order.  On execution, Prolog evaluates the top
    level statement, here ":-begin(X)." down through myriad levels until it
    finds a chain where every function is true. If not, the evaluation
    returns the value "false."  There are list operators, operators to
    force evaluation of a function to stop or keep going, and recursion.
    Functions like input and output always succeed Line by line, this
    program does the following (disclaimer: explanation done from rusty
    memory): 
    
    begin		evaluate an input word and invoke next instance of
    			begin(X) until the word "stop" is found.
    
    test_palindrome    test whether input passes palindrome test and
    			print result
    
    palindrome		succeeds if reverse2 of string with itself succeeds
    
    reverse2		call reverse_append with two strings and empty list
    
    reverse_append	place first character of left argument at beginning
    			of middle argument recursively.  succeeds when
    			left argument exhausted and middle argument
    			matches right argument.
    

    Requires a different mind-set from procedural languages!  I think
    it's more like high school geometry proofs than computer programming.

    
    Wes
1486.10WJG::GUINEAUTue Jun 21 1988 20:156
thanks Wes,  I think I'll stick to C :-)


John

1486.11C-Prolog KitYIPPEE::GOULNIKOogaboogaBox typeThu Jun 23 1988 08:4911
	RE: .9

		I don't know for sure but I do believe C-Prolog
		is freely redistributable. The backup kit, which
		contains sources, examples, documentation and VMS
		image can be fetched from:
	
		LAPUTA::DUA1:[CPROLOG]CPROLOG_V15.BCK

Iv
1486.12SBProlog ?KETJE::VLASIUTry with a bigger hammerMon Oct 30 1989 12:008
    Hello,
    Has anyone used SBProlog ? I'm trying to start it on my 1MB A500 and
    after invoking the prolog command file (which starts sim .. (??)) I
    receive the message: "Not enough core !". Does it function this prolog
    (from Fish disks 140-141) ? And if it's ok, how much memory does it
    need ?
    Regards,
    Sorin
1486.13Unfortunately...AYOV28::ATHOMSONC'mon, git aff! /The Kelty ClippieMon Oct 30 1989 14:016
1486.14And retract seems broken...BARDIC::RAVANMon Oct 30 1989 14:3216
I had some code which ran under CProlog on VAX.  I took it home
and tried to get it to run on SBProlog.  Whew!  After I finally
implemented keysort, it almost worked.  But it was barfing on
retract.  I looked at the code for retract and got a rude suprise.
The comments stated that retract was a bad thing to do in general
so they weren't going to go out of their way to implement it
efficiently.  The code just jammed a return instruction in the
code for the rule!  Argh!  Looked to me like code which counted
on the memory for retracted rules being returned for reuse (which
mine certainly did!) was not going to work correctly even if the
bug that was causing retract to barf was fixed.  So I gave up.
There is a new version of SBProlog (V2.5) available on unix machines.
If you can get a copy, maybe retract has been fixed.

regards,
-jim
1486.15ThanksKETJE::VLASIUTry with a bigger hammerTue Oct 31 1989 14:227
    Ref .13,.14
    Thank you for the answers. I'll wait to upgrade my A500 via the A590
    with some more memory. Is it another Prolog for Amiga ? Maybe a smaller
    one. Is the TinyProlog usable for learning ? Is there any CProlog on Amiga
    ? 
    Regards,
    Sorin
1486.16SCRITH::GLINNAndrew Glinn, MIG, REO F/J2, 830-4430Thu Dec 21 1989 00:1312
    Ref SBProlog

    I have a 3Mb Amiga and I still get the Insufficient core error.

    I am using the supplied Prolog procedure to start it.  What am I missing.
    I am a total novice with Prolog, but it looks interesting.  And would realy
    like to make it work.

    Thanks for any help.

    Andrew
1486.17stack?WJG::GUINEAUQuantum RealityThu Dec 21 1989 01:316
Just a guess, but have you tried a larger stack?


	1> STACK 10000
	1> PROLOG whatever
1486.18Tried the stack but broke something elseSCRITH::GLINNAndrew Glinn, MIG, REO F/J2, 830-4430Thu Dec 21 1989 20:1414
Re: .17

>	1> STACK 10000
>	1> PROLOG whatever

Yea tried that.  The PROLOG command is a script that sets the stack to 50000.
I have put it up to 1000000 with no luck.  But then whenever I try to execute
something, anything, after uping the stack to 1000000 and executing the PROLOG
startup command I get an insufficient memory error.  I can do anything normal
from another shell though, its just the shell I set the stack to 1000000 thats
dead.

Any ideas?
1486.19WJG::GUINEAUQuantum RealityFri Dec 22 1989 15:007
Type AVAIL and see just how much is free before running prolog.
Kill unnecessary programs if you need to.

There may also be special requirementsa for prolog that you have overlooked.
Does it mention any thing in the documentation?

John
1486.20SB-Prolog revisitedKETJE::VLASIUMon Mar 12 1990 09:1743
Hello,

I'm back after fighting for running SB-Prolog on my 1MB A500.
Now it works. You have to modify the prolog script by adding the options
-m xxxxxx -p yyyyyy before the -i option. To resume, I've tried first the next
settings:
..sim -s -m 50000 -p 50000 -i .... (in the last line of prolog script).
-m is for memory space (local prolog internal stack, heap ..) and
-p is for program space. (-s is for statistics activation).
For both -m and -p options xxxxxx and yyyyyy are expressed in 4 BYTE WORDS !
Additionally it will be allocated 1/5 of the memory space for the trail stack.
This gives (x*6/5+y)*4 bytes and you have to consider also the 50000 bytes
stack required in the script.
With -m 50000 -p 50000 you will not go too far as compiling requires about
55000 for program space (-p option). (Once you're under prolog try the
command "statistics." (don't forget the ".") to see your memory spaces.)
But you can interpret programs (hanoi.p is included).
After, I started increasing both options but I've succeeded only to obtain
success with -m 50000 -p 95000. No way to improve -m option (it's the data space
and seems quite tight at 50000).
You will ask maybe: what about -m 75000 -p 50000 ?
Well, the problem is that SB-Prolog allocates first for -p memory and only after
for -m, so if you have the biggest piece of free memory in first place (what
happens in my case), it will be fragmented and you'll have no more place for
the -m memory. The ideea is, in this case, to allocate first the biggest piece
which was asked (maximum between -p and -m options) as the trail stack
allocation needs much less memory and could fit in a remaining piece.
I think memory fragmentation is the cause also for my Cambridge Lisp not taking
more than 540K in a 1MB machine.
Finally with -m 50000 and -p 95000 I've succeeded to compile hanoi.p example
and I've also interpreted (-m insufficient for compiling) an amusing prolog
program named Eliza (written in C-Prolog). For Eliza there were signaled 
syntactic errors at loading but after it seemed to work like under C-Prolog on
Vax. I decided finally to go for the upgrade of my memory in the A590 to 2MB
additionally.
One more final observation: as SB-Prolog loads things dynamically from the disk
libraries it is very preferable to use it with a hard disk.

Regards,
Sorin

PS. Try to have more than 780000 bytes free in memory (no arp, clean ram:, etc)
for using SB-Prolog with the biggest spaces on a 1MB machine.