I am getting this error "chat.pl:1:No permission to redefine imported procedure 'lists:member/2'" whenever I am trying to complie this code.Please help.
@@ThemisTheotokatos So , I found out that in this video , he is using the online prolog swi compiler. If you code in online compiler then you will not get this error ,otherwise on the compiler of your pc, you will get it. Hope , this helps.
Thank you for trying to exlpain this. I however get the following error, if I do exactly what you do: ?- member(3,[1,2,3,4]). false. ?- trace(member). % lists:member/2: [call,redo,exit,fail] % member/2: [call,redo,exit,fail] true. [debug] ?- member(3,[1,2,3,4]). T Call: (8) member(3, [1, 2, 3, 4]) T Call: (9) member(3, [2, 3, 4]) T Call: (10) member(3, [3, 4]) T Call: (11) member(3, [4]) T Call: (12) member(3, []) T Fail: (12) member(3, []) T Fail: (11) member(3, [4]) T Fail: (10) member(3, [3, 4]) T Fail: (9) member(3, [2, 3, 4]) T Fail: (8) member(3, [1, 2, 3, 4]) false. Do you know what I am doing wrong?
@@techdose4u thanks for responding These are the facts regarding member: % member(X,L) returns true if X is a member of list L L=[1,2,3,4] member(X,[X|_]). member(X,[_|T]):-member(X,T).
Prolog rules and facts:- member(X,[X|_]). member(X,[_|T]):-member(X,T). Query:- member(3,[1,2,3,4]). Output: true This code is running fine.I don't see any problem. I ran it on online prolog ide (SWISH).
how does computer get to know that member(X,[X|_]) means we have to look if X is a header in the list??
we put value using X ( upper case ) and the next atom _ which means don't read the 2 atom.
@@FarahAlmujaljel I don't even remember this shi* subject now 🤣 worst ever major ever
@@amanrubey bro so happy for you.
thank you for this prolog playlist ^^
Sir aapne abhut accha padhya hai
Thanks
👍👍👍isko jitni baar like karo kam hai.....
:)
thank you very much
welcome
I am getting this error "chat.pl:1:No permission to redefine imported procedure 'lists:member/2'" whenever I am trying to complie this code.Please help.
same. Did you fix it?
@@ThemisTheotokatos So , I found out that in this video , he is using the online prolog swi compiler. If you code in online compiler then you will not get this error ,otherwise on the compiler of your pc, you will get it. Hope , this helps.
member is a reserved name?
you are kingggggg thank you !!
unable to run this in swi prolog desktop app.
what if the list is in a predicate, like a dictionary of words. im so stuck...
Thank you for trying to exlpain this. I however get the following error, if I do exactly what you do:
?- member(3,[1,2,3,4]).
false.
?- trace(member).
% lists:member/2: [call,redo,exit,fail]
% member/2: [call,redo,exit,fail]
true.
[debug] ?- member(3,[1,2,3,4]).
T Call: (8) member(3, [1, 2, 3, 4])
T Call: (9) member(3, [2, 3, 4])
T Call: (10) member(3, [3, 4])
T Call: (11) member(3, [4])
T Call: (12) member(3, [])
T Fail: (12) member(3, [])
T Fail: (11) member(3, [4])
T Fail: (10) member(3, [3, 4])
T Fail: (9) member(3, [2, 3, 4])
T Fail: (8) member(3, [1, 2, 3, 4])
false.
Do you know what I am doing wrong?
Can you pls share your facts which you defined as database for the given query to search on. Then only we can tell about error
@@techdose4u thanks for responding
These are the facts regarding member:
% member(X,L) returns true if X is a member of list L
L=[1,2,3,4]
member(X,[X|_]).
member(X,[_|T]):-member(X,T).
Prolog rules and facts:-
member(X,[X|_]).
member(X,[_|T]):-member(X,T).
Query:-
member(3,[1,2,3,4]).
Output: true
This code is running fine.I don't see any problem. I ran it on online prolog ide (SWISH).
Where is difinition of member() function??
I am not getting your question. I have written everything. Please ask specifically.
its just a name he declared, like how you would declare a variable by 'x' for instance.
Tq
Welcome :)
oke
bhai tujhme kuch to baat h
y'all need to learn english before you try to make a video.