% ========================================================================== % $Id: list_mirror.pl,v 1.1 2014/01/21 04:50:36 jlang Exp $ % CSI2120 example Code for lecture 5 % ========================================================================== % (C)opyright: % % Jochen Lang % EECS, University of Ottawa % 800 King Edward Ave. % Ottawa, On., K1N 6N5 % Canada. % http://www.eecs.uottawa.ca/~jlang % % Creator: jlang (Jochen Lang) based on Clocksin & Mellish % Email: jlang@eecs.uottawa.ca % ========================================================================== % $Log: list_mirror.pl,v $ % Revision 1.1 2014/01/21 04:50:36 jlang % Added further list processing for lecture 5. % % ========================================================================== mirror([], []). % empty list is mirrored itself mirror([X|L1], L2) :- % Take X off the front mirror(L1,L3), % Mirror the rest L1 append(L3, [X], L2). % Put X at the back