next up previous
Next: Expressions Up: User-level Constructs Previous: Variables

Data Modification

Currently, R programs modify variables and memory locations using a variety of vaguely C-like data modification constructs: ++, -, <=<, >=>, +=, -=, '136=, <->, and others not currently documented as user-level operations.

In general, it is an error for a data modification statement to modify a variable or memory location whose value is used in any subexpressions of the statement. If this happens, program behavior thereafter will be nonsensical.



++

Integer increment statement.
Syntax:

 ( place ++)

Elements:
place ---
A variable or an expression denoting a memory reference.

Description:

The mod- integer word stored in place, which may be a variable or a memory reference, is incremented by 1.



-
(minus sign)

Unary negate statement.
Syntax:

 (-  place)

Elements:
place ---
A variable or an expression denoting a memory reference.

Description:

The integer word stored in place is negated in two's complement fashion.



<=< , >=>

Rotate left/right.
Syntax:

 ( place <=<  amount)

( place >=> amount)

Elements:
place ---
A variable or an expression denoting a memory reference.
amount ---
An expression for the amount to rotate by.

Description:

<=< rotates the bits stored in the given place to the left by the given amount. Rotating left by 1 means the bit stored in most significant bit-location moves to the least significant bit-location, and all the other bits shift over to the next, more significant position. Rotating by some other amount produces the same result as rotating by 1 amount times. >=> is the same but rotates to the right (exactly undoing <=<).



+= , -=

Add/subtract statement.
Syntax:

 ( place +=  value)

( place -= value)

Elements:
place ---
A variable, or an expression denoting a memory reference.
value ---
An expression for the value to add/subtract.

Description:

+= adds value into place, as an integer. -= subtracts value from place.



'136=

Exclusive OR.
Syntax:

 ( place '136=  value)

Elements:
place ---
A variable, or an expression denoting a memory reference.
value ---
An expression for the value to XOR.

Description:

'136= bitwise exclusive-OR's value into place.



<->

Swap.
Syntax:

 ( place <->  place)

Elements:
place, place ---
Each is a variable or an expression denoting a memory reference.

Description:

<-> swaps the contents of the two places.



next up previous
Next: Expressions Up: User-level Constructs Previous: Variables



Michael Frank
Mon Nov 3 16:33:38 EST 1997