anchor.diff:  ; This test receives an RSP, a variable and a value,
   ; and returns 2 values.
   
  -(defun psr-atribuicao-consistente-p (psr var valor)
  -	(let
  -		(
  -			(psr1 (cria-psr
  -							(PSR-listvars psr)
  -							(PSR-listdomains psr)
  -							(copy-list (psr-variavel-restricoes psr var))
  -						)
  -			)
  -			(result nil)
  -			(sz (list-length (PSR-listvalues psr)))
  +(defun psr-atribuicao-consistente-p(psr var valor)
  +	(if (equal (psr-listconstrains psr) nil)
  +		(return-from
  +			psr-atribuicao-consistente-p
  +				(values T 0)
  +		)
  +	)
  +	
  +	(let
  +		(
  +			(res nil)
  +			(aux (psr-variavel-valor psr var))
  +		)
  +		(cond
  +			(
  +				(equal aux nil) 
  +				(setf aux nil)
  +			)
   		)
   		
  -		(dotimes (i sz)
  -			(setf
  -				(nth i (PSR-listvalues psr1))
  -				(nth i (PSR-listvalues psr))
  -			)
  -		)
  -		
  -		(psr-adiciona-atribuicao! psr1 var valor)
  +		(psr-adiciona-atribuicao! psr var valor)
   		
   		(setf
  -			result
  +			res
   			(multiple-value-list
  -				(psr-variavel-consistente-p psr1 var)
  +				(psr-variavel-consistente-p psr var)
   			)
   		)
   		
  -		(values
  -			(car result)
  -			(car (cdr result))
  +		(psr-adiciona-atribuicao! psr var aux)
  +		
  +		(return-from
  +			psr-atribuicao-consistente-p
  +				(values (nth 0 res) (nth 1 res))
   		)
   	)
   )
  
positive.code: (defun psr-variavel-consistente-p (psr var)
  	(let
  		(
  			(psr1 (cria-psr
  							(PSR-listvars psr)
  							(PSR-listdomains psr)
  							(copy-list
  								(psr-variavel-restricoes psr var)
  							)
  						)
  			)
  		(sz (list-length (PSR-listvalues psr))))
  		
  		(dotimes (i sz)
  			(setf (nth i (PSR-listvalues psr1) ) (nth i (PSR-listvalues psr) ) )
  		)
  		
  		(psr-consistente-p psr1)
  	)
  )
  
  
negative.code: ; and a value for this variable, a variable v2 and a
  ; value for that variable, and returns two values.
  
  (defun psr-atribuicoes-consistentes-arco-p (psr var1 v1 var2 v2)
  	(if (equal (psr-listconstrains psr) nil)
  		(return-from
  			psr-atribuicoes-consistentes-arco-p
  				(values T 0)
  		)
  	)
  
  	(let
  		(
  			(testes 0)
  			(aux1 (psr-variavel-valor psr var1))
  			(aux2 (psr-variavel-valor psr var2))
  		)
  		
  		(if (equal aux1 nil)
  			(setf aux1 nil)
  		)
  		
  		(if (equal aux2 nil)
  			(setf aux2 nil)
  		)
  
  		(psr-adiciona-atribuicao! psr var1 v1)
  		(psr-adiciona-atribuicao! psr var2 v2)
  		
  		(dolist (r (psr-variavel-restricoes psr var1))
  			(cond
  				(
  					(membro var2 (restricao-variaveis r))
  					(incf testes)
  					(cond
  						(
  							(not (funcall (restricao-funcao-validacao r) psr))
  							(psr-adiciona-atribuicao! psr var1 aux1)
  							(psr-adiciona-atribuicao! psr var2 aux2)
  							(return-from
  								psr-atribuicoes-consistentes-arco-p
  									(values nil testes)
  							)
  						)
  				  )
  				)
  			)
  		)
  		(psr-adiciona-atribuicao! psr var1 aux1)
  		(psr-adiciona-atribuicao! psr var2 aux2)
  		(values T testes)
  	)
  )
  
  