Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rib([]):-!.
- rib(Lst):-
- Lst=[H|T],
- w(H),nl,
- rib(T).
- w(0):- !.
- w(K):-
- write('*'),
- K1 is K-1,w(K1).
- rec_rev(Lst1,Lst2):-
- reverse(Lst2,Lst),
- f(Lst1,Lst).
- f([],[]):-!.
- f(Lst1,Lst2):-
- Lst1=[H1|T1],
- Lst2=[H2|T2],
- (
- (list(H1),
- rec_rev(H1,H2),!,f(T1,T2)),!;
- (list(H2),
- rec_rev(H2,H1),!,f(T1,T2)),!;
- (H1=H2,!,f(T1,T2))).
Add Comment
Please, Sign In to add comment