CS2322
Laboratory Problem 23
A Representation for Vectors
Consider the following accessor and constructor for vectors:
(define vector-ref
(lambda (vec i)
((cddr vec) i)))
(define vector-generator
(lambda (gen-proc)
(lambda (size)
(cons vector-tag (cons size gen-proc)))))
Define an appropriate predicate vector? and function vector-length and any other definitions so that the functions of Section 9.2 may be entered and tested. Discuss the efficiency and practicality of this representation for vectors.
Lab 23 Scheme Code