next up previous contents index
Next: Functions for Manipulating Strings Up: List of Functions Previous: Other Sequence Functions

Functions on Any Type

eql(a, b) {(a, a) tex2html_wrap_inline10570 bool :: (a in any)}
  Given two objects of the same type, eql will return t if they are equal and f otherwise. Two sequences are equal if they are the same length and their elements are elementwise equal. Two records are equal if their fields are equal.

hash(a, l) {(a, int) tex2html_wrap_inline10572 int :: (a in any)}
  Hashes the argument a and returns an integer in the range [0..l). This will always generate the same result for equal values as long as it is run on the same machine. In particular floating-point hashing can depend on the floating-point representation, which is machine dependent. There is no guarantee about the distribution of the results--returning 0 for all keys would be a valid implementation, although we expect an implementation to do much better than that.

select(flag, v1, v2) {(bool, a, a) tex2html_wrap_inline10574 a :: (a in any)}
  Returns the second argument if the flag is T and the third argument if the flag is F. This differs from an if form in that both arguments are evaluated.

identity(a) {a tex2html_wrap_inline10576 a :: (a in any)}
  Returns the identity for any type. The identity of a sequence is an empty sequence of the same type. The identity of a number is 0, the identity of a boolean is f (false), and the identity of a character is the null character. The identity of a pair is a pair of the identities of the two elements.

Jonathan Hardwick
Tue Nov 28 13:57:00 EST 1995