chickadee » srfi-179 » make-storage-class

make-storage-class getter setter checker maker copier length defaultprocedure

Here we assume the following relationships between the arguments of make-storage-class. Assume that the "elements" of the backing store are of some "type", either heterogeneous (all Scheme types) or homogeneous (of some restricted type).

  • (maker n value) returns a linearly addressed object containing n elements of value value.
  • copier may be #f or a procedure; if a procedure then if to and from were created by maker, then (copier to at from start end) copies elements from from beginning at start (inclusive) and ending at end (exclusive) to to beginning at at. It is assumed that all the indices involved are within the domain of from and to, as needed. The order in which the elements are copied is unspecified.
  • If v is an object created by (maker n value) and 0 <== i < n, then (getter v i) returns the current value of the i'th element of v, and (checker (getter v i))> #t.
  • If v is an object created by (maker n value), 0 <== i < n, and (checker val)> #t, then (setter v i val) sets the value of the i'th element of v to val.
  • If v is an object created by (maker n value) then (length v) returns n.

If the arguments do not satisfy these conditions, then it is an error to call make-storage-class.

Note that we assume that getter and setter generally take O(1) time to execute.