Welcome to SWI-Prolog (Multi-threaded, Version 5.6.20) Copyright (c) 1990-2006 University of Amsterdam. SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Please visit http://www.swi-prolog.org for details. For help, use ?- help(Topic). or ?- apropos(Word). Yes [300, 4, 50, 6, 700, 80, 90, 100, 1000, 90, 80, 70, 600, 50, 40, 3, 20, 1, 100, 2] -> [1, 2, 3, 4, 6, 20, 40, 50, 50, 70, 80, 80, 90, 90, 100, 100, 300, 600, 700, 1000]: OK Yes % halt