I did it by adding does_not_like. I could not find a way of solving your query using in-built operators. My solution goes like this :- (It mentions the things that mary does not like) DATASET:- likes(mary,chocolate). likes(mary,wine). likes(mary,burger). likes(john,wine). likes(john,mary). likes(john,burger). likes(john,drinks). likes(john,oranges). does_not_like(mary,drinks). does_not_like(mary,oranges). does_not_like(mary,news). QUERY:- likes(john,X),does_not_like(mary,X). ANSWER:- X = drinks ; X = oranges. NOTE: If you have or find any other better solution then do let me know :)
Sir what if we need the second option in our variable. As when we initialize our variables then it always initialize with the very first possible. And now i want that how can i initialize this variable with the second possibility by ignoring the first one.
Fantastic serie of videos. I needed all of this, to pass my exam. You are a true hero, Sir!
likes(mary,chocolate).
likes(mary,wine).
likes(mary,burger).
likes(john,wine).
likes(john,mary).
likes(john,burger).
hi , your videos are excellant... easy to understand. Thank you. please videos on BFS and DFS other algorithms
Thanks but i have stopped making videos on PROLOG.
Nicely done Sir.
Is there a way of asking - What are all the things liked by John and not Mary adn vice-versa?
I did it by adding does_not_like. I could not find a way of solving your query using in-built operators. My solution goes like this :- (It mentions the things that mary does not like)
DATASET:-
likes(mary,chocolate).
likes(mary,wine).
likes(mary,burger).
likes(john,wine).
likes(john,mary).
likes(john,burger).
likes(john,drinks).
likes(john,oranges).
does_not_like(mary,drinks).
does_not_like(mary,oranges).
does_not_like(mary,news).
QUERY:-
likes(john,X),does_not_like(mary,X).
ANSWER:-
X = drinks ;
X = oranges.
NOTE: If you have or find any other better solution then do let me know :)
@@techdose4u That's great. Thanks.
@@techdose4u Good bro.
Thank you
Sir what if we need the second option in our variable. As when we initialize our variables then it always initialize with the very first possible. And now i want that how can i initialize this variable with the second possibility by ignoring the first one.
What’s the rule for PERSON(A)?
Sir i love u
I guess the things have been updated because now the and condition is '^' maybe can you please check and say
Love u
In real life also, John likes Mary and Marry does not like John.
i dont even know wtf is john and mary
John likes chicks tho
John likes chicks 💀
It's always John likes Mary never Mary likes John 😢
😂 figure it out dude
The "OR" example seems wrong, the "OR" condition should be applied on query, not on answer. The shared "OR" example seems to be of "AND" condition.