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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:58:51+00:00 2026-06-05T02:58:51+00:00

Assume that backtracking is done as shown below. Each end point show success or

  • 0

Assume that backtracking is done as shown below. Each end point show success or fail.

Ex:

    foo(X, search_key).

Backtracking :
                Root

              /   |  \
             /    |   \
            /     |    \
           /|\    |     \
          / | \   |    /|\
         /  f f   |   / | \
        /         |  f  |  f
       f          g     f

Abbreviation  f : fail
              g show first character of name

Unless no other way is found, I will not prefer to use g as argument in my next function.However, in this example, since no other way is found, I must use g as an argument in my next function.

How can I do that ?

  • 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-06-05T02:58:53+00:00Added an answer on June 5, 2026 at 2:58 am

    You’ll have to try all end points first and store them in a list (with findall(foo...) presumably), otherwise you won’t know whether a non-g occurs later.

    Then try to do the next function with the requirement that X is not g. If that fails, use g anyway.

    avoidg(X) :-
        member(A,X),
        A \= f,
        A \= g,
        write(A).
    
    avoidg(X):-
        member(A,X),
        A \= f, 
        write(A).
    

    Example:

    ?- avoidg([f,f,f,g,f,f,f]).
    g
    true 
    
     ?- avoidg([f,f,f,g,f,f,h]).
    h
    true 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume that I have this piece of code: @interface Foo : NSObject { Bar
Assume that we have multiple arrays of integers. You can consider each array as
Assume that I have a class value object defined in php, where each variable
Assume that I have a list of 100 products, each of which has a
Assume that my current point is lat = 50.000 and long = 50.000 and
Assume that the camera is located at (0,0,1) point looking into the origin. -z
Assume that I have two AVL trees and that each element from the first
Assume that foo.txt is in the index. Why doing: git reset foo.txt returns 1:
Assume that the following Perl code is given: my $user_supplied_string = &retrieved_from_untrusted_user(); $user_supplied_string =~
Assume that I want to listen to a non-common port (9090 for example) 24/7

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.