[an error occurred while processing this directive]

Data Types and Operators

Because there is such flexibility in the design of the window data type, the set of data types and operators in Scout may be extended in the future. There are, however, some essential data types in Scout: integer, point, window and display. Associated with them are basic operators for integer arithmetic, vector manipulation, list manipulations, construction and selection. The following shows the basic Scout operators and functions for the four essential data types. All the operators of the Scout notation can be found in the next section.

Operators: +, -, *, /, % (remainder), - (unary minus)
Meaning: Normal integer arithmetic
Example: 10 % 3 gives 1
Constructor: {x, y}
Meaning: Construct a point
Example: {10, 20} is a point with x-coordinate 10 and y-coordinate 20
Operators: +, -
Meaning: Vector sum and vector subtraction
Example: {10, 20} - {20, 5} gives {-10, 15}
Selector: .1, .2
Meaning: Return the 1st (x-) coordinate and the 2nd (y-) coordinate respectively
Example: {10, 20}.1 gives 10
Constructor: {field-name: formula, field-name: formula, ..., field-name: formula}
Meaning: Constructing a window
Example: { type: DONALD, box: b, pict: "FIGURE1"}
Selector: .field-name
Meaning: Return the value of the field
Example: { type: DONALD, box: b, pict: "FIGURE1"}.box gives b
Constructor: < W1 / W2 / ... / Wn >
Meaning: Constructing a display, if W1 and W2 overlap, W1 overlays W2
Example: < don1 / don2 >
List function: insert(L, pos, exp)
Meaning: Insert the expression exp, at the position pos, into list L
Example: insert(<w1, w2, w3>, 2, new) gives <w1, new, w2, w3>
List function: delete(L, pos)
Meaning: Delete the posth element of list L
Example: delete(<w1, w2, w3>, 2) gives <w1, w3>
Operator: if cond then exp1 else exp2 endif
Meaning: if cond gives non-zero value (true) then returns exp1 else returns exp2, in this context, exp1 and exp2 must have the same type.
Example: if 1 then "Open" else "Close" endif gives "Open"
[an error occurred while processing this directive]