Help! trying to figure out what I am doing wrong

Discussions related to Visual Prolog
Paul Cerkez
VIP Member
Posts: 94
Joined: 6 Mar 2000 0:01

Help! trying to figure out what I am doing wrong

Unread post by Paul Cerkez » 13 Apr 2020 20:06

I have a simple program that I believe I have solved all the syntax issue except one.

I searched the Help[ and this board for error c504

As near as I can tell, I have it correct but the complier keeps throwing the c504.

error c504 : The expression has type '() -> ::string procedure', which is incompatible with the type '::string'

Code: Select all

% The declaration:   class predicates     patient : (string).  % I even made this nondeterm and I still get the C504 message.   clauses     patient(S) :-         patresponses(S),         stdio::write("you are repeating yourself."),         stdio::nl,         stdio::write(": "),         S2 = stdio::readLine,         patient(S2).     patient(S) :-         assert(patresponses(S)),         assert(temp(S)).
I am stumped, I know I am missing something simple.

Thanks,
P.
AI Rules!
P.

Paul Cerkez
VIP Member
Posts: 94
Joined: 6 Mar 2000 0:01

Re: Help! trying to figure out what I am doing wrong

Unread post by Paul Cerkez » 13 Apr 2020 21:45

I know I am missing something simple but I can't figure it out.

Could someone look this project over and tell me where I am AFU. (that c504 for one is kicking my butt, and when I do get past it, the application runs non-stop and allows no interaction.)

I know I am doing something wrong but I can't see what it is.

Right now I can't see the forest for the trees. :-(

Thanks
P.
Attachments
the Doctor.zip
(4.97 KiB) Downloaded 75 times
AI Rules!
P.

Harrison Pratt
VIP Member
Posts: 323
Joined: 5 Nov 2000 0:01

Re: Help! trying to figure out what I am doing wrong

Unread post by Harrison Pratt » 13 Apr 2020 21:53

Try this instead:

Code: Select all

        S2 = stdio::readLine()  % <== missing parentheses,
Easy mistake to make ... I've done it hundreds of times with my tired old eyes.

Harrison Pratt
VIP Member
Posts: 323
Joined: 5 Nov 2000 0:01

Re: Help! trying to figure out what I am doing wrong

Unread post by Harrison Pratt » 14 Apr 2020 20:54

Paul, is it your intent to recreate "The Shrink" in old style prolog syntax or migrate it to VIP 9x syntax?

Paul Cerkez
VIP Member
Posts: 94
Joined: 6 Mar 2000 0:01

Re: Help! trying to figure out what I am doing wrong

Unread post by Paul Cerkez » 15 Apr 2020 1:52

Harrison,
Right now I just want to get it working. :-)

That said, I do want it working as a Console app. New way or old is irrelevant to me right now. Eventually, I will go to the new syntax.

I am also looking at a PIE exercise for the students so I don't want to introduce too much at one time as this is an "intro to AI" class. :-)

They have already completed a CLIPS exercise that I am grading now (they had to extend the CLIPS fact/rule base). Looks like some did a good job. CLIPS is Forward Chaining. I want them to do a Backward Chaining (Prolog) problem (extend the fact/rule base) so they can learn the difference in the way the two tools solve problems.
AI Rules!
P.

Harrison Pratt
VIP Member
Posts: 323
Joined: 5 Nov 2000 0:01

Re: Help! trying to figure out what I am doing wrong

Unread post by Harrison Pratt » 15 Apr 2020 2:55

I'll take a look at it tomorrow.

Paul Cerkez
VIP Member
Posts: 94
Joined: 6 Mar 2000 0:01

Re: Help! trying to figure out what I am doing wrong

Unread post by Paul Cerkez » 15 Apr 2020 12:32

thanks.
AI Rules!
P.

Harrison Pratt
VIP Member
Posts: 323
Joined: 5 Nov 2000 0:01

Re: Help! trying to figure out what I am doing wrong

Unread post by Harrison Pratt » 15 Apr 2020 13:41

Paul, take a look at my notes on the zipped main.pro file. I see you don't have everything fleshed out yet -- I understand why. This is not a complete solution, but it will get you started. I tried to keep old Turbo Prolog syntax. VIP 9x code style would be much cleaner looking.
Attachments
main.zip
Tweaked and zipped main.pro
(1.7 KiB) Downloaded 75 times

Post Reply