next up previous contents index
Next: Logical Expressions Up: Expressions Previous: Arithmetic Expressions

Relational Expressions


    You can compare values using ==, !=, <, <=, >, and <=, which have the usual meanings. For numeric and string values, each operates element-by-element when given two equal-sized vectors, or pairs a scalar with every element of a vector in turn, yielding a boolean vector as the result. Logical operators applied to arrays operate the same way but return an array rather than a vector. (See § 3.2.5, page gif.)

Other types (record, function, agent of           values may be compared for equality (==) and inequality (!=). The values are considered equal if they refer to exactly the same entity; the comparison yields a scalar boolean value. For example,

    a := [b=1, c=2]
    d := [b=1, c=2]
    e := ref a
    print a == a, a == d, a == e
prints T, F, T.   In the future, Glish may support field-by-field comparison of record values, in which case the second F printed above would instead have been T.

Thu Nov 13 16:44:05 EST 1997