T.R | Title | User | Personal Name | Date | Lines |
---|
1486.1 | C-Prolog | YIPPEE::GOULNIK | OogaboogaBox type | Tue Jun 21 1988 07:21 | 6 |
|
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.2 | may the source be with you | AUNTB::PRESSLEY | | Tue Jun 21 1988 08:22 | 1 |
| The source is included. Written in C.
|
1486.3 | here it is | AUNTB::PRESSLEY | | Tue Jun 21 1988 08:24 | 1 |
| $1$dus13:[pressley.amiga.public]
|
1486.4 | Where? | AYOV10::ATHOMSON | C'mon, git aff! /The Kelty Clippie | Tue Jun 21 1988 09:10 | 20 |
| �< Note 1486.3 by AUNTB::PRESSLEY >
� -< here it is >-
�
� $1$dus13:[pressley.amiga.public]
Eh.. where it is ?
Alan T.
Directory 33834::$1$DUS13:[PRESSLEY.AMIGA.PUBLIC]
ARP11.ARC;1 89/90 28-APR-1988 19:28 (RWED,RWED,R,R)
HEARTS.ARC;1 140/141 28-APR-1988 20:52 (RWED,RWED,R,R)
ILBMDUMP.ARC;1 36/36 21-MAR-1988 19:56 (RWED,RWED,R,R)
PYRO.PAK;1 29/30 28-APR-1988 19:19 (RWED,RWED,R,R)
VT200.ARC;1 200/201 2-MAY-1988 16:30 (RWED,RWED,R,R)
YAHTZEE.ARC;1 35/36 28-APR-1988 20:00 (RWED,RWED,R,R)
Total of 6 files, 529/534 blocks.
|
1486.5 | | WJG::GUINEAU | | Tue Jun 21 1988 10:30 | 5 |
|
What kind of language is PROLOG? Is it any good?
John
|
1486.6 | Logicians do it backwards | YIPPEE::GOULNIK | OogaboogaBox type | Tue Jun 21 1988 11:28 | 9 |
|
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.7 | RSN | AUNTB::PRESSLEY | | Tue Jun 21 1988 11:49 | 2 |
| I will post it tonite. Check in at about 8:00pm
|
1486.8 | | WJG::GUINEAU | | Tue Jun 21 1988 13:37 | 5 |
|
could someone post a small PROLOG program??
John
|
1486.9 | Example (long) | NAC::PLOUFF | Beautiful downtown Littleton | Tue Jun 21 1988 15:49 | 80 |
| 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.10 | | WJG::GUINEAU | | Tue Jun 21 1988 17:15 | 6 |
|
thanks Wes, I think I'll stick to C :-)
John
|
1486.11 | C-Prolog Kit | YIPPEE::GOULNIK | OogaboogaBox type | Thu Jun 23 1988 05:49 | 11 |
|
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.12 | SBProlog ? | KETJE::VLASIU | Try with a bigger hammer | Mon Oct 30 1989 09:00 | 8 |
| 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.13 | Unfortunately... | AYOV28::ATHOMSON | C'mon, git aff! /The Kelty Clippie | Mon Oct 30 1989 11:01 | 6 |
|
� (from Fish disks 140-141) ? And if it's ok, how much memory does it
� need ?
1.5Mb minimum :-(
|
1486.14 | And retract seems broken... | BARDIC::RAVAN | | Mon Oct 30 1989 11:32 | 16 |
| 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.15 | Thanks | KETJE::VLASIU | Try with a bigger hammer | Tue Oct 31 1989 11:22 | 7 |
| 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.16 | | SCRITH::GLINN | Andrew Glinn, MIG, REO F/J2, 830-4430 | Wed Dec 20 1989 21:13 | 12 |
|
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.17 | stack? | WJG::GUINEAU | Quantum Reality | Wed Dec 20 1989 22:31 | 6 |
|
Just a guess, but have you tried a larger stack?
1> STACK 10000
1> PROLOG whatever
|
1486.18 | Tried the stack but broke something else | SCRITH::GLINN | Andrew Glinn, MIG, REO F/J2, 830-4430 | Thu Dec 21 1989 17:14 | 14 |
|
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.19 | | WJG::GUINEAU | Quantum Reality | Fri Dec 22 1989 12:00 | 7 |
| 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.20 | SB-Prolog revisited | KETJE::VLASIU | | Mon Mar 12 1990 06:17 | 43 |
| 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.
|