home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / TESTS / LF / SUBS.LF < prev    next >
Text File  |  1996-06-04  |  523b  |  21 lines

  1. op(500,xfy,\)?
  2.  
  3. subst(List, SubList, NewSubList, NewList) :-
  4.     app(Front, Back, List),        % non-deterministically split
  5.                     % the original list into Front
  6.                     % and Back, such that
  7.     app(SubList, Rest, Back),    % Back begins with SubList,
  8.     app(NewSubList, Rest, NewBack),    % then construct the new 
  9.                     % list by undoing the previous
  10.                     % steps with NewSubList
  11.     app(Front, NewBack, NewList).    % in place of SubList
  12.  
  13. app([], L, L).
  14. app([H|T], L, [H|R]) :- app(T, L, R).
  15.  
  16.  
  17. dlist([],S\S).
  18. dlist([H|T],[H|S]\E) :- dlist(T,S\E).
  19.  
  20.  
  21.