$ pl Welcome to SWI-Prolog (Multi-threaded, Version 5.6.24) 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). ?- ['list.pro']. % list.pro compiled 0.01 sec, 4,552 bytes Yes ?- rnprint(2). 9 6 Yes ?- rnprint(2). 4 3 Yes ?- rnlist(6,X). X = [4, 5, 1, 5, 5, 6] Yes ?- rnlist(11,X), write(X). [7, 1, 6, 7, 5, 6, 5, 1, 3, 6, 9] X = [7, 1, 6, 7, 5, 6, 5, 1, 3|...] Yes ?- count(3,[1,2,3,3,4,3],X). X = 3 Yes ?- count(8,[1,2,8,8,4,8,1,8,9,1,2,3,4],X). X = 4 Yes ?- singleton_count([1,2,3,2,1,2,4,6,9,9],X). X = 3 Yes ?- singleton_count([2,3,1,2,3,4,4],X). X = 1 Yes ?- doubleton_count([2,2,3,3,4,4],X). X = 3 Yes ?- doubleton_count([2,3,4],X). X = 0 Yes ?- reverse([1,2,3],X). X = [3, 2, 1] Yes ?- reverse([g,o,d],X). X = [d, o, g] Yes ?- sarahPalindrome([r,a,c,e,c,a,r]). Yes ?- sarahPalindrome([m,c,c,a,i,n]). No ?- ['list.pro']. % list.pro compiled 0.00 sec, 232 bytes Yes ?- fact(3,X). X = 6 Yes ?- fact(7,X). X = 5040 Yes ?- halt. $ exit Process shell finished