## FAQ: Self-referencial expressions in xfst

Q: xfst treats an identifier like Z or Foo as a variable if and only if it was previously 'define'd to have a value; otherwise it treats Z has a simple symbol and Foo as a multichar symbol. What does it do with self-referencial expressions like the following?

`xfst[]: define Z  0 | a Z ;`
`xfst[]: define Foo  0 | Foo b ;`

A: Yes, the problem is that in an expression like ```define Foo 0 | Foo b ;``` there is a question, in the xfst design, of how to handle the Foo on the right-hand side. Is it a self reference or just a multichar symbol?

This is resolved somewhat awkwardly in xfst with an interface variable, 'recursive-define', that can be (re)set as needed by the user. 'recursive-define' is OFF by default, so the example

`xfst[0]: show recursive-definevariable recursive-define = OFFxfst[0]: define Z 0 | Z b ;defined Z: 144 bytes. 3 states, 2 arcs, 2 paths.xfst[0]: push Zxfst[1]: sigmaZ bSize: 2xfst[1]: `

shows clearly that the resulting network contains the symbol Z in the sigma alphabet. Now let's change the value of the interface variable and try again.

`xfst[1]: undefine ALLxfst[1]: set recursive-define ONvariable recursive-define = ONxfst[1]: define Z 0 | Z b ;defined Z: 100 bytes. 1 state, 1 arc, Circular.xfst[1]: push Zxfst[2]: sigmabSize: 1xfst[2]: print netSigma: bSize: 1Net: Flags: deterministic, pruned, minimized, epsilon_freeArity: 1fs0:  b -> fs0.`

You will recognize that with recursive definition, ```define Z 0 | Z b ;``` should be equivalent to ```define Z b*;```, which can easily be tested:

`xfst[2]: up bbxfst[2]: up bbbbxfst[2]: up bbbbbbxfst[2]: up bbbbbbbb`