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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:35:36+00:00 2026-05-31T07:35:36+00:00

Using ! and fail , I’m trying negation by failure. The method below however

  • 0

Using ! and fail, I’m trying negation by failure.

The method below however gives me the warning: Singleton variables: [X].

However, it seems to work so I’m wondering if there’s anything wrong with my method of doing it:

likes(vincent, big_kahuna_burger).
neg(X) :- X, !, fail.
neg(X).

So calling neg(likes(vincent, big_kahuna_burger)) will return false.

  • 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-31T07:35:37+00:00Added an answer on May 31, 2026 at 7:35 am

    Your implementation of neg is correct. It’s just giving you a warning because in the second rule, X is never used. If you write

    neg(X) :- X, !, fail.
    neg(_).
    

    you will get no warning.

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

Sidebar

Related Questions

Using Seq.cast seems to constantly fail, even for something as simple as the following:
using the jquery below I'm trying to submit the array paramlist to the appropriate
I want to create a nice cryptography using bitwise operators. However I fail to
Why does this code fail to display the category name Apples using the current
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Does using operator new in c# might fail (if it requires a large memory
Why might using the following fail unless called from the constructor of the class?
using the default pagination class, and following the odeigniter user manual i fail to
I'm using Delphi's fastMM memory manager and I fail when I try to use
I am using Cherrypy v3.2. I fail to find good docs about how 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.