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

  • Home
  • SEARCH
  • 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 9059859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:04:43+00:00 2026-06-16T15:04:43+00:00

EDIT : More simple : I changed my code to simplify. A predicate nbarret

  • 0

EDIT : More simple :

I changed my code to simplify. A predicate “nbarret” return the numbers of stations i want.

So there is my new code, but it doesn’t change anything :

nb_stations([],0).
nb_stations([S,Li,Dir,SS],X):-nbarret(Li,S,SS,Dir,Y),X is X1 + Y.
nb_stations([S,Li,Dir,SS|Tr],X):-
     nbarret(Li,S,SS,Dir,Y),nb_stations([SS|Tr],X is X1 + Y).

In this case, i have an error :

ERROR: is/2: Arguments are not sufficiently instantiated
Exception: (8) (_G2031 is _G2270+1)is _G2711+5 ? creep
Exception: (7) nb_stations([charles_de_gaulle_etoile, m6, nation, bir_hakeim], _G2031 is _G2270+1) ? creep
Exception: (6) nb_stations([la_defense, rerA, vincennes, charles_de_gaulle_etoile, m6, nation, bir_hakeim], _G2031) ? creep

/————————————————————-/

Old code (deprecated, i keep for comprehension) :

nb_stations([S,Li,Dir,SS|Tr],X):-num_stations(S,Li,Dir1,ND,_,_),Dir=Dir1,!,
num_stations(SS,Li,Dir1,NA,_,_),Dir=Dir1,!,
calculer(ND,NA,Y),X is X1 + Y,nb_stations([SS|Tr],X).

nb_stations([S,Li,Dir,SS|Tr],X):-num_stations(S,Li,_,_,Dir2,ND),!,
num_stations(SS,Li,_,_,Dir2,NA),!,
Dir=Dir2,!,calculer(ND,NA,Y),X is X1 + Y,nb_stations([SS|Tr],X).

calculer(ND,NA,X):-X is ND - NA.

More Details :

When you call nb_stations, you have to inform a path in a List, with the departure station, the lign of the transport, the direction, and then the station you will stop. If we have more next, it will be the correspondence. In this example : nb_stations([la_defense,rerA,vincennes,charles_de_gaulle_etoile,m6,nation,bir_hakeim],X).

You start in la_defense, you take the “rerA” transport, and you take “vincennes” for the direction. Then you stop in “charles_de_gaulle_etoile”, and you take the m6 (metro), the direction is “nation”, and you are arrived in “bir_hakeim”. So my code count the number of stations i pass in this travel.

  • 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-16T15:04:44+00:00Added an answer on June 16, 2026 at 3:04 pm

    You need to change the order when X is assigned.

    nb_stations([S,Li,Dir,SS|Tr],X):-
        num_stations(S,Li,Dir1,ND,_,_),
        Dir=Dir1,!,
        num_stations(SS,Li,Dir1,NA,_,_),
        Dir=Dir1,!,
        calculer(ND,NA,Y),
        nb_stations([SS|Tr],X1),
        X is X1 + Y.   % Change here
    
    nb_stations([S,Li,Dir,SS|Tr],X):-
        num_stations(S,Li,_,_,Dir2,ND),!,
        num_stations(SS,Li,_,_,Dir2,NA),!,
        Dir=Dir2,!,
        calculer(ND,NA,Y),
        nb_stations([SS|Tr],X1),
        X is X1 + Y. % Change here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

LATER EDIT: Please mention not only game programming books, but also more scientific/simulation oriented
I've this simple code: using(FileStream fs = new FileStream(@E:\test.bin, FileMode.Open, FileAccess.Read, FileShare.Read) { byte[]
This is a really simple one but it's driving me crazy. I want to
EDIT : I substantially changed my code to resemble the actual structure of the
basically I want to encapsulate a simple component from code that I already have.
EDIT: More detailed question. I am working on batched operations in nHibernate, specifically for
edit: A more pointed question: What is the derivative of softmax to be used
Edit 2: Actually SomeEventHandler is more concise than OnSomeEventHandler : If I let Visual
[EDIT] I am changing this to more concisely explain what my problem was, after
More often than I like when designers edit some of our sites' pages, they

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.