[ library(shadow_cons) | The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

# shadow_var(?Var, +StoreName, -ShadowVar)

Finds the shadow variable associated with the input variable in the specified shadow constraint store. If none exists, it creates one.

Var
  A variable to be shadowed
StoreName
  The name of a shadow constraint store. This call may be the first reference to this store. It must be an atom.
ShadowVar
  The associated shadow variable

## Description

The shadow variable 'represents' the original variable in the named constraint store. This allows it to be more (or less) constrained than the original variable. When the original variable becomes instantiated, or has its domain/range narrowed, this change is propagated to the shadow variable.

### Resatisfiable

No.

### Exceptions

(4) instantiation fault
  StoreName is uninstantiated
(5) type error
  StoreName is not an atom

## Examples

        Success:
            [eclipse]: shadow_var(X,fred,Y).
            X = X{[fred - Y]}
            Y = Y
            yes.

            [eclipse]: lib(fd).
            ...
            [eclipse]:  X::1..10, shadow_var(X,fred,Y), X#<5, Y#>3.
            X = X{fd:[1..4], shadow_cons:[fred-4]}
            Y = 4

        Error:
            shadow_var(X,Var,Y).  % Error 4

## See Also

shadow_call / 2