Good night everyone,
I'm in the middle of some busy days trying to deliver a small project for my Logic Programming classes, where the theme is based on operations on matrices.
Well, one of those asked operations was to verify if a certain element exists in a given matrix, and I'm having some issues with it as I usually have my mind set for imperative programming.
For now, i reached this:
isElemPresent(_, []) :- !.
isElemPresent(Elem, [M|Mt]) :- isElemPresent(Elem,Mt) ; isElemPresentRow(Elem,M).
isElemPresentRow(Elem, [Elem|_]).
isElemPresentRow(Elem, [_|T]) :- isElemPresentRow(Elem, T).
I would really appreciate if someone could guide to my goal, and if possible tell what lacks on my code.