% $Id: AddToEnd.oz,v 1.2 2007/11/28 18:25:36 leavens Exp leavens $ declare % A procedural style writing of this proc {AddToEnd ?L ?X ?R} choice L=nil R=X|nil [] local E Es Res in L=E|Es {AddToEnd Es X Res} R=E|Res end end end % A sugared version of the above, thinking of it as a function fun {AddToEnd2 ?L ?X} choice L=nil X|nil [] local E Es in L=E|Es E|{AddToEnd2 Es X} end end end