%% $Id: CommaSeparate.oz,v 1.4 2009/01/10 18:26:59 leavens Exp $ %% AUTHOR: Gary T. Leavens \insert 'AppendMap.oz' declare fun {CommaSeparate L} %% ENSURES: Result is the concatenation of each element in L, %% with each separated by ", " case L of nil then "" [] E|Es then {Append E {AppendMap Es fun {$ S} {Append ", " S} end}} end end %% Separate a list by Atom, making a virtual string fun {VSSeparateMaker Atom} %% ENSURES: Result is a virtual string of of each element in L, %% with each separated by Atom fun {$ L} case L of nil then nil [] E|Es then E # {FoldR Es fun {$ E VS} Atom#E#VS end nil} end end end VSCommaSeparate = {VSSeparateMaker ', '}