FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log inLog in 


Dynamic variable

Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog
View previous topic :: View next topic  
Author Message
ahmednadi




Joined: 15 Sep 2009
Posts: 197

PostPosted: 11 Jun 2017 21:05    Post subject: Dynamic variable Reply with quote

Dear Sir;
I would like to define a dynamic variable such as clauseX = clauseX(subclauseX,subclauseX).

subclauseX = subclauseX1(phraseX);
                    subclauseX2(phraseX,phraseX);
                    subclauseX3(phraseX,phraseX,phraseX);
                    subclauseX4(phraseX,phraseX,phraseX,phraseX);
                    subclauseX5(phraseX,phraseX,phraseX,phraseX,phraseX).

Meanwhile, when I use this variable subclauseX1(phraseX) to pick the first result in a loop and I can't add the second result subclauseX2(phraseX,phraseX) and the third subclauseX3(phraseX,phraseX,phraseX) and so on
But the outputs of each cycle in the loop should not exceed the fifth cycle. A notice should be displayed and fail.

test:(string*,string*,string*,string*,string*,phraseX,string*) determ(i,i,i,o,o,o,o).

sent:(string*,string*,clauseX) determ(i,i,o).

sent([],_,_):-!.
sent(_,[],_):-!.
sent(WLst,XLst,clauseX(Phrase)):-!,
test(WLst,XLst, WLst2, XLst2,Phrase).
sent(WLst2,XLst2,clauseX(Phrase)).

Regards;
AHMED NADY
Back to top
View user's profile Send private message
Harrison Pratt



Des Moines, Iowa USA
Joined: 05 Nov 2000
Posts: 303

PostPosted: 13 Jun 2017 19:09    Post subject: Reply with quote

You said, if I interpret correctly, that you want to check subclauseX1 through sublcauseX5. However, you have ";" (logical OR) where I believe there should be "," (logical AND) so only the first succeeding subclauseXn will be executed.

I have a feeling that you have tried to simplify the problem for the discussion group and may have some typographic errors.

subclauseX = subclauseX1(phraseX) ;
                    subclauseX2(phraseX,phraseX) ;
                    subclauseX3(phraseX,phraseX,phraseX) ;
                    subclauseX4(phraseX,phraseX,phraseX,phraseX) ;
                    subclauseX5(phraseX,phraseX,phraseX,phraseX,phraseX).

Please try re-stating your question.
Back to top
View user's profile Send private message
Thomas Linder Puls



Copenhagen, Denmark
Joined: 28 Feb 2000
Posts: 3094

PostPosted: 13 Jun 2017 20:14    Post subject: Reply with quote

I also have problems undestanding the problem.

A "strict" formatting of your code looks like this:

    sent([], _, _) :-
        !.

    sent(_, [], _) :-
        !.

    sent(WLst, XLst, clauseX(Phrase)) :-
        !,
        test(WLst, XLst, WLst2, XLst2, Phrase).

    sent(WLst2, XLst2, clauseX(Phrase)).

The two clauses seems "strange", the variable names implies that it should have been a single clause, but the use of "clauseX(Phrase)" seems to contradict this.

_________________
Regards Thomas Linder Puls
Prolog Development Center
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum