Did you know? SWI-Prolog has lots of useful PackagesSearch Documentation:
SWI-Prolog owl logoPredicate flatten/2