The <get> Function

The following two expressions are equivalent:

<get name="x"/>
<get>x</get>

The expression <x/> has the same effect except in the case of <add> and <subtract> where these two expressions are different:

<add><x/>1</add>
<add><get>x</get>1</add>

The first changes the definition of <x>, the second does not.

Note that IDs are allowed to start with the dot (.) and hyphen (-) characters which are not valid as the first character in XML tags. Thus get must be used in the following:

<expr>
  <define name=".net">4.5.50709</define>
  <print><get>.net</get></print>
</expr>

Since <get> returns a function definition (just like <define>), it is possible to define functions of this type that take arguments and even invoke them in a somewhat circuitous manner:

<expr>
  <define name=".product" args="a b c d">
    <add>
      <multiply>
        <a/>
        <b/>
      </multiply>
      <multiply>
        <c/>
        <d/>
      </multiply>
    </add>
  </define>

  <expr>
    <define name="closure"/>
    <set name="closure">
      <get>.product</get>
    </set>
    <closure>1 2 3 4</closure>
  </expr>
</expr>

Rationale

Section 14 tells us that <get>x</get> and <x/> have the same effect in most cases (and thus presumably not all cases) and it would seem surprising if <get> were not to insulate a function in this manner.