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 4063170
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:41:30+00:00 2026-05-20T15:41:30+00:00

12 ?- 3+4*5 = X+Y. X = 3, Y = 4*5. 13 ?- 3+4*5

  • 0
12 ?- 3+4*5 = X+Y.
X = 3,
Y = 4*5.

13 ?- 3+4*5 = X*Y.
false.

16 ?- 3*4+5 = X*Y.
false.

I was expecting

13 ?- 3+4*5 = X*Y.
X = 3+4, Y = 5.

16 ?- 3*4+5 = X*Y.
X = 3, Y = 4+5.

Is there some “precedence” problem? I’m using the last swi-prolog release.

  • 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-20T15:41:30+00:00Added an answer on May 20, 2026 at 3:41 pm

    Yes, there is a precedence issue that you need to take into account.

    Prolog attaches a numeric precedence value to each operator defined, so that its parse can automatically treat, e.g., 3+4*5 the same as if parentheses had been used to state 3+(4*5).

    So your first example worked as expected, but not the second or third. There was simply no way to unify the terms, so Prolog returned false.

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

Sidebar

Related Questions

[PersonListNav pushViewController:plist animated:FALSE];Hi there! :) Googling this has returned no luck... In short, I
PHP's mkdir returns false on failure. Failure can be: Folder already exists Some other
There is a default submit button for the @FileUpload.GetHtml. But I am expecting to
I'm supporting some project, built using ADF (using JDeveloper 11.1.2.2.0) and deployed to Tomcat
I have a problem using a method defined on a model in CanCan abilities:
I've made a little C# tool for monitoring sidebar.exe (as some know there's a
I'm trying to control remote power switch by executing some php commands. There is
I am using Threadpool in a C# application that need to do some CPU-intensive
In a Flash game I am developing, there are some settings that are set
I'm having some inexplicable behaviour using jQuery 1.4.2, and I'm beginning to think that

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.