Find if given element is present in list using prolog

preview_player
Показать описание
This video lecture explains given an element, find whether that element is present in our list or not using prolog. This lecture includes theory explanation followed by coding in prolog ide.
If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful...CYA :)
Рекомендации по теме
Комментарии
Автор

how does computer get to know that member(X, [X|_]) means we have to look if X is a header in the list??

amanrubey
Автор

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.

abhishektanwar
Автор

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?

MisterCK
Автор

unable to run this in swi prolog desktop app.

yashshah
Автор

what if the list is in a predicate, like a dictionary of words. im so stuck...

MrNewtonJable
Автор

Where is difinition of member() function??

brijeshmakodiya
Автор

y'all need to learn english before you try to make a video.

ungureanurobert