Code Prolog de extraitMin/3

extraitMin([X:DX|Variables],Xmin:DXmin,VariablesSansXmin) :-
length(DX,N),
extraitMin(Variables,X:DX,N,Xmin:DXmin,VariablesSansXmin).

extraitMin([],X:DX,_,X:DX,[]).
extraitMin([X:DX|Variables],Y:DY,N,Z:DZ,[Y:DY|VariablesSansZ]) :-
length(DX,M),
M<N, !,
extraitMin(Variables,X:DX,M,Z:DZ,VariablesSansZ).
extraitMin([X:DX|Variables],Y:DY,N,Z:DZ,[X:DX|VariablesSansZ]) :-
extraitMin(Variables,Y:DY,N,Z:DZ,VariablesSansZ).