Advertisement
alexarcan

Lab5 AIF

Mar 24th, 2016
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.31 KB | None | 0 0
  1. p(E,L):-L=[X|Y],
  2.     E=X.
  3. p(E,L):-L=[X,Y],
  4.     p(E,Y).
  5.  
  6. inserting(E,L,Result):-
  7.     Result=[E|L].
  8. inserting(E,[H|T],Result):-
  9.     inserting(E,T,Result2),
  10.     Result=[H|Result2].
  11.  
  12. deleting_first(E,[H|T],Result):-
  13.     E=H,
  14.     Result=T.
  15. deleting_first(E,[H|T],Result):-
  16.     deleting_first(E,T,Result2),
  17.     Result=[H|Result2],!.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement