I have the following code:
check([],[]).
check([X], [Y]) :-
X > 0,
Y is 1.
check([X], [Y]) :-
X =:= 0,
Y is 0.
check([L1|Tail], [L2|Tail2]) :-
L1 > 0,
L2 is 1,
check(Tail,Tail2).
check([L1|Tail], [L2|Tail2]) :-
L1 =:= 0,
L2 is 0,
check(Tail,Tail2).
the predicate check creates a table that replace all the items bigger than 0 into 1.
this predicate works for a simple list like this L = [3,4,5,6,0] and produces a list L1 = [1,1,1,1,0].
I need to make the predicate check to accept lists which have lists as items.
For instance : L = [[2, 3, 4], [4, 0, 6], [5, 6, 3]]. The items of the list are as many are the items of an item list. This means that if the list contains 3 items-lists ,each item-list should contain 3 items.