IF-Else in Prolog
Posted 10 February 2005 - 10:32 PM
Is it possible to write grammar for If-else in Prolog?
If yes, Please can some one give me a rough idea of the grammar.
Posted 11 February 2005 - 10:16 AM
Posted 13 February 2005 - 12:35 AM
I want to write a function in prolog for the if-else statement.
if-instantiated( X,X) else if-instantiated (Y,Y) else if-instantiated( X^Y, concat(X,Y):-
If the attribute X is instantiated( holds some value) then write X, else if the attribute Y holds some value then write Y, else if both the attributes X and Y hold some values, then append X and Y and write them.
I know how to write the concat function. But I am unaware of writing the function for the above if-else rule. please help me.
Thanks in advance,
Posted 13 February 2005 - 11:14 AM
Posted 13 February 2005 - 11:58 AM
PLease could you help me in writing the function for the above rule in prolog
Posted 13 February 2005 - 03:42 PM
test(X, Y) :- ( /* test value in X */ , /* test value in Y */ -> // do something ; /* test value in X */ -> // do something else ; /* test value in Y */ -> // do something different ).
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users