MENTAL
 Main Menu
 Language
 Expressions
 Shared Expressions


Shared Expressions
 SHARED
EXPRESSIONS

"Every language is a tradition, every word a shared symbol" (Borges).



Definition

Any language expression, without exception, can be shared, that is, it can belong (be common) to several expressions. One mode of sharing is self-sharing: when an expression is shared in its own context.

The sharing specification is realized by generic expressions.


Examples
  1. Sharing by name.
    The sequences x and y share the expression v.

    (v = 11)
    (x = (a ⟨v⟩ b))
    (y = (⟨v⟩ c ⟨v⟩))
    x // ev. (a 11 b)
    y // ev. (11 c 11)

    (v = 99)
    (change v)
    x // ev. (a 99 b)
    (x changes automatically)

    y // ev. (99 c 99)
    (y changes automatically)

  2. Sharing of an element of a sequence.
    The third element of a sequence y is always defined as the first element of the sequence x:

    (x = (a b c d))
    (y = (3 7 ⟨x\1⟩ 4 5))

    (the third element of y is the first element of x)
    y // ev. (3 7 to 4 5)

    (x = (u v w))
    (change x)
    y // ev. (3 7 u 4 5)
    (y changes automatically)

  3. Mutual sharing of elements between two sequences.

    (x = (a b c ⟨y\1⟩ d))
    (the fourth element of x is the first element of y)

    (y = (3 7 4 5 ⟨x\(x#)⟩))
    (the last element of y is the last element of x)

    x // ev. (a b c 3 d)
    y // ev. (3 7 4 5 d)

    (x/5 = 55)

    (we change the last element of x)
    (y/1= 11)
    (we change the first element of y)

    x // ev. (a b c 11 55)
    (x changes automatically)
    y // ev. (11 7 4 5 55)
    (y changes automatically)

  4. Self-sharing. Some elements of a sequence are defined from other elements of the same sequence.

    (x = (a b ⟨x\1⟩ ⟨x\2⟩ c))
    (the third and fourth elements of x are the first and second, respectively, of the same sequence)
    x // ev. (a b a b c)

    (x = u)

    (we change the first element of x)
    (x2 = v)
    (we change the second element of x)

    x // ev. (u v u v v c)
    (x changes automatically)

  5. Auto-sharing of several consecutive elements.

    (x = (a b c [⟨x[1...3]⟩])])
    (elements 4, 5 and 6 of x are equal to the first three).
    x // ev. (a b c a b c)

    (x = u)

    (we change the first element of x)
    (x2 = v)
    (we change the second element of x)
    x // ev. (u v c u v c)
    (x changes automatically)

  6. Sharing the contents of a set.

    (x = {a b c d})
    (y = {u v ⟨x↓⟩})

    (y consists of u, v and the contents of x)
    y // ev. {u v a b c d}

    (x = {3 4 5 5 6})

    (redefine x)
    y // ev. {u v 3 4 5 5 6}
    (new value of y)

  7. Sharing of a selection.

    (x = {1 3 5 7 9})
    (y = {u v ⟨x⇓(<6]⟩})

    (y consists of u, v and the elements less than 6 of x)
    y // ev. {u v 1 3 5}

    (x = {2 4 6 8})

    (redefines x)
    y // ev. {u v 2 4}
    (y changes automatically)

  8. Sharing by assigning a name to a shared element.

    (x = (a b c d))
    (v = ⟨x\3⟩)

    (v is always the third element of x)
    (y = (3 7 v☆3))
    (y consists of 3, 7 and three elements v)
    y // ev. (3 7 c c c c)

    (x = (e f g g h))

    (redefines x)
    y // ev. (3 7 g g g g)
    (new value of y)

    (v = ⟨x\4⟩)
    (redefine v)
    y // ev. (3 7 d d d d d)
    (new value of y)

Circular sequence

It is a sequence that "bites its own tail", i.e., the next element from the last is the first. The general form is:

⟨( xi = xi - i÷(x#)) )⟩

That is, the remainder of the division between i and the length of the sequence is always used. For example,
Shared expressions structures

Using the sharing technique, it is possible to define all kinds of structures. For example, if we symbolize a sequence by a line ending in an arrow, and a set by a circle, we can specify structures such as the following:

>