[racket-dev] Refactoring in-vector and friends

From: Noel Welsh (noelwelsh at gmail.com)
Date: Wed Dec 1 10:41:09 EST 2010

Hi all,

I spent (far too much) time this morning refactoring the definition of
in-vector to expose the building blocks to compose these
macro/functions. After refactoring the code for defining in-vector is:

  (define-:vector-like-gen :vector-gen unsafe-vector-ref)

  (define-in-vector-like in-vector
    "vector" vector? vector-length :vector-gen)

  (define-sequence-syntax *in-vector
    (lambda () #'in-vector)
    (make-in-vector-like #'vector?

This could obviously be made smaller but it sufficient to enable reuse
for in-flvector (my goal), in-f64vector etc. In doing so I split
for.rkt into three (I couldn't handle refactoring the 1000+ lines of
for.rkt; I needed something smaller to understand it all). Since this
is a moderately large change I'm looking for comments/objections
before committing. If you have objections please let me know -- if I
don't hear any I'll commit tomorrow. Diff is attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vector.diff
Type: application/octet-stream
Size: 25218 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20101201/efd6f92a/attachment.obj>

Posted on the dev mailing list.