Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Sa se testeze daca o lista are aspect de vale
- check_valley([]).
- check_valley(L):-change_sign(L,0).
- change_sign([_|T],1):-T=[],!.
- change_sign([H|[H1|T]],N):-
- H>H1,
- N=0,
- vale_aux([H1|T],N).
- change_sign([H|[H1|T]],N):-
- H<H1,
- N=0,
- change_sign([H1|T],1).
- change_sign([H|[H1|T]],N):-
- H<H1,
- N=1,
- change_sign([H1|T],N).
- change_sign([H|[H1|_]],N):-
- H>H1,
- N=1,
- fail.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement