1/*  Part of Ciao Prolog compatibility library
    2
    3    Author:        The Ciao Development Team, ported by Edison Mera
    4    E-mail:        efmera@gmail.com
    5    WWW:           http://www.edisonm.com
    6    Copyright (C): 2013, Process Design Center, Breda, The Netherlands.
    7
    8    This program is free software; you can redistribute it and/or
    9    modify it under the terms of the GNU General Public License
   10    as published by the Free Software Foundation; either version 2
   11    of the License, or (at your option) any later version.
   12
   13    This program is distributed in the hope that it will be useful,
   14    but WITHOUT ANY WARRANTY; without even the implied warranty of
   15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16    GNU General Public License for more details.
   17
   18    You should have received a copy of the GNU General Public
   19    License along with this library; if not, write to the Free Software
   20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   21
   22    As a special exception, if you link this library with other files,
   23    compiled with a Free Software compiler, to produce an executable, this
   24    library does not by itself cause the resulting executable to be covered
   25    by the GNU General Public License. This exception does not however
   26    invalidate any other reasons why the executable file might be covered by
   27    the GNU General Public License.
   28*/
   29
   30:- module(llists, [collect_singletons/2], [assertions]).   31
   32:- reexport(library(lists), [append/2, flatten/2]).   33
   34%% :- reexport(library(clpfd), [transpose/2]). % BUG: this cause
   35%%                                             % problems, I do not know
   36%%                                             % why --EMM
   37
   38:- pred collect_singletons(+list(list), ?(list))
   39        # "Collects in a list the singletons lists appearing in a list
   40          of lists.".
   41
   42collect_singletons([],[]).
   43collect_singletons([[X]|Xss],[X|Ys]):- !,
   44	collect_singletons(Xss,Ys).
   45collect_singletons([_|Xss],Ys):-
   46	collect_singletons(Xss,Ys)