Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1024305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:45:34+00:00 2026-05-16T11:45:34+00:00

I am using ancient Turbo Prolog since it is included in our curriculum. Why

  • 0

I am using ancient Turbo Prolog since it is included in our curriculum. Why is this program not working?

domains
    disease, indication = symbol
    Patient = string
    Fe,Ra,He,Ch,Vo,Ru = char
predicates
    hypothesis(Patient,disease)
    symptom(Patient,indication,char)
    response(char)
    go
clauses


    go:-

        write("What is patient's name?"),
        readln(Patient),

        symptom(Patient,fever,Fe),
        symptom(Patient,rash,Ra),   
        symptom(Patient,head_ache,He),  
        symptom(Patient,chills,Ch), 


        symptom(Patient,runny_nose,Ru),
        symptom(Patient,head_ache,He),  
        symptom(Patient,vomit,Vo),


        hypothesis(Patient,Disease),
        write(Patient," probably has ", Disease , "."),nl.

    go:-
        write("Sorry unable to seem to be diagnose disease"),nl.

    symptom(Patient,Fever,Feedback) :-
        Write("Does " , Patient , " have " , Fever , "(y/n) ?"),
        response(Reply),
        Feedback = Reply.


    hypothesis(Patient, chicken_pox) :-

        Fe = Ra = He = Ch = 'y'.

    hypothesis(Patient, caner) :-
        Ru = Ra = He = Vo = 'y'.

    hypothesis(Patient, measles) :-
        Vo = Ra = Ch = Fe = He = 'y'.

    response(Reply):-
        readchar(Reply),
        write(Reply),nl.

I get the warning variable is only used at all lines which contains symtoms. Isn’t the parameter passing call by reference? When i pass Fe to symptoms the value should be copied to Fe and when i compare it in hypothesis it should work accordingly. = operator in Turbo Prolog works very strangely. When it is not bound to any variable, the statement a = 3 will assign 3 to a and when a already contains a value a = 5 will check whether a’s value is 5 or not.

Kindly help me why is the program not working?

Thanks in advance 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T11:45:35+00:00Added an answer on May 16, 2026 at 11:45 am

    The trouble is not with your symptoms/3 predicate, they will bind (unify) their 3rd argument to what response/1 gives. The problem is that these values are never passed into your hypothesis/2 procedure in go/0 so they are never used to try and generate a hypothesis. Prolog doesn’t have global variables so you have to explicitly pass all values, though you can keep things in the database which can easily cause problems if you are not careful.

    This means that in hypothesis/2 you are not testing the values of Fe, Ra, He, etc but binding local variables with the same names. This is also why you get warnings of the variables only being referenced once, you bind them but never use them. Remember they are local, all variables are local to the clause in which they occur.

    All this applies to standard prolog, I have never used Turbo Prolog.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program in C using Solaris with VERY ancient compatibility it seems.
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using CI for the first time and i'm smashing my head with this seemingly
On a quite ancient UNIX (Apple A/UX 3.0.1 for 680x0 processors) using the built-in
We're updating our ancient internal PHP application at work. Right now, we gather extensive
I am working on a display/control utility to replace an ancient dedicated hardware controller
I'm working on an older script. Someone told me that the script uses ancient
I am using MySQL with PHP5 . I got to know that ancient mysql_*
I am compiling an ancient program called SCOL (written in 1997) which comes pre-packged
I'm working on porting some ancient code (10.2 era) from NSCoding/plist based archiving to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.