# VariableSet

A VariableSet is a ConnectorSet link type used to declare a set of variables. It is very similar to VariableList, differing in that the order of the variables is irrelevant.

## Contents

## Format

VariableSet <variable-1> ... <variable-n>

where <variable-i> can be typed or not.

## Motivation

In some scopes, the order of the variables in the variable declaration does not matter. For instance

BindLink VariableList VariableNode "$X" VariableNode "$Y" PresentLink InheritanceLink VariableNode "$X" VariableNode "$Y" ExtensionalInheritanceLink VariableNode "$X" VariableNode "$Y"

and

BindLink VariableList VariableNode "$Y" VariableNode "$X" PresentLink InheritanceLink VariableNode "$X" VariableNode "$Y" ExtensionalInheritanceLink VariableNode "$X" VariableNode "$Y"

have exactly the same behavior. In that sort of situations one can use VariableSet instead. For instance, if the user provides

BindLink VariableSet VariableNode "$X" VariableNode "$Y" PresentLink InheritanceLink VariableNode "$X" VariableNode "$Y" ExtensionalInheritanceLink VariableNode "$X" VariableNode "$Y"

All permutations of X and Y will yield the same scope, i.e. they will be alpha-equivalent. Likewise the scope above is equivalent to

BindLink PresentLink InheritanceLink VariableNode "$X" VariableNode "$Y" ExtensionalInheritanceLink VariableNode "$X" VariableNode "$Y"

since, where the variable declaration is missing, clearly the order does not matter.

## Examples

### Order is irrelevant

VariableSet VariableNode "$X" VariableNode "$Y"

is equivalent to

VariableSet VariableNode "$Y" VariableNode "$X"

### Typed variables

Like VariableList, variables can be typed:

VariableSet TypedVariableLink VariableNode "$X" TypeNode "ConceptNode" TypedVariableLink VariableNode "$Y" TypeNode "ConceptNode"

### Default variable declaration

The following

LambdaLink PlusLink VariableNode "$X" NumberNode 1

is equivalent to

LambdaLink VariableNode "$X" PlusLink VariableNode "$X" NumberNode 1

which is equivalent to

LambdaLink VariableSet VariableNode "$X" PlusLink VariableNode "$X" NumberNode 1

However it is NOT equivalent to

LambdaLink VariableList VariableNode "$X" PlusLink VariableNode "$X" NumberNode 1

because VariableList imposes an order while VariableSet does not. Although in this particular case, since there is only one variable, it could be equivalent, if we decide so. But for now, as currently implemented, it is not.