tiny prolog problem

xs xs at adriacom.it
Sat Feb 24 18:36:54 UTC 2001


Hi there.. sorry to disturb you,may u help me?
I have a tiny problem:
I have to do a "selective" listing of all obj which have a given value as first
term,then I have to elaborate some data.... I have written this source... the
problem is this:
After I list all the obj who have -for example- value 1 as first term I want to
execute the part of source
<write('DO OTHER THINGS!')> but it doesn't work.... it exits... I am
desperate....
I have also tried to add an empty rule after fail,but it doesn't work.
I have to use "FAIL" cause I want ALL the obj with that number to be listed...
without that fail onnly the first occurrence will be listed...

obj(1,der,dse).
obj(1,dasdsasd,mn).
obj(1,rewrew,f).
obj(2,fre,fr).

menu:-write('Choose menu : 1. visu - 2. write CIAO'),nl,read(X),menu_i(X).

menu_i(1):-
        write('choose number,0. to exit'),nl,read(Num),
        Num=\=0->(listit(Num),write('DO OTHER THINGS!'));menu.

menu_i(2):-write('CIAO'),nl,menu.

listit(Num):-obj(Num,A,_),write(A),fail.



More information about the HPSG-L mailing list