/*  fixme: now in swi (but make sure semantics are preserved)
nth1( Var, List, Elem, Dregs ) :-
	var(Var), 
	!,
	nth1var( Var, List, Elem, Dregs ).
nth1( Integer, List, Elem, Dregs ) :-
	integer( Integer ),
	Integer > 0,
	nth1int( Integer, List, Elem, Dregs ).

nth1var( 1, [H|T], H, T ).
nth1var( N, [H|T], El, [H|R] ) :-
	nth1var( PrvN, T, El, R ),
	N is PrvN + 1.

nth1int( 1, [H|T], H, T ) :- !.
nth1int( N, [H|T], Elem, [H|Dregs] ) :-
	NxN is N - 1,
	nth1int( NxN, T, Elem, Dregs ).
*/

/* now in SWI
min_list( [H|T], Min ) :-
	min_list( T, H, Min ).
min_list( [], Min, Min ).
min_list( [H|T], Acc, Min ) :-
	( H < Acc -> 
		NxAcc = H % be gentle  dont use is 
		;
		NxAcc = Acc 
	),
	min_list( T, NxAcc, Min ).
*/

/* now in SWI
max_list( [H|T], Max ) :-
	max_list( T, H, Max ).

max_list( [H|T], Acc, Max ) :-
	( H > Acc -> 
		NxAcc = H % be gentle  dont use is 
		;
		NxAcc = Acc 
	),
	max_list( T, NxAcc, Max ).
max_list( [], Max, Max ).
*/

/* now in SWI
sum_list( [H|T], Sum ) :-
	sum_list( T, H, Sum ).
sum_list( [], Sum, Sum ).
sum_list( [H|T], Acc, Sum ) :-
	NxAcc is Acc + H,
	sum_list( T, NxAcc, Sum ).
*/

/* fixme: the only remainder not in SWI ? , replace it in code and remove loading this file*/
remove_duplicates( List, Pruned ) :-
	list_to_set( List, Pruned ).