↧
Check if an Element is a Member of a List using Scheme Source Code
The following code checks if an element is a member of a listCODE (define (member? x y) (cond ((null? y) #f) ((eqv? x (car y)) #t) (else (member? x (cdr y)))))RESULT> (member_list...
View ArticleList Member Function using Prolog Source Code
The following code checks if an element is a member of a given listCODE member(X, [X|Y]). member(X, [H|L]) :- member(X, L).RESULT ?- member(b, [a,b,c]). Yes
View Article