(struct: flomap ([values : FlVector]
[components : Integer]
[width : Integer]
[height : Integer])
#:transparent
#:guard
(λ (vs c w h name)
(with-asserts ([c nonnegative-fixnum?]
[w nonnegative-fixnum?]
[h nonnegative-fixnum?])
[...] ; elided length check on vs
(values vs c w h))))
What I'd *really* like, though, is to have the fields be
Nonnegative-Fixnum in the first place, and simply have a more permissive
constructor. Is there a way to do that? As it is, `flomap-components'
always returns an Integer, but no flomap instance can actually have an
integer-valued `components' field.
Neil ⊥
____________________
Racket Users list:
http://lists.racket-lang.org/users
Could you just structure the program this way?
(struct: flomap ([values : FlVector]
[components : Nonnegative-Fixnum]
[width : Integer]
[height : Integer])
#:transparent)
(: make-flomap : FlVector Integer Integer Integer -> flomap)
(define (make-flomap v c w h)
(with-asserts ... (flomap v c w h)))
--
sam th
sa...@ccs.neu.edu
I could, but `make-flomap' is already defined and used extensively (it's
an analogue of make-flvector). Also, not using the structure name to
create instances from their field values now makes me feel dirty. :D
Neil ⊥
You should be able to fix this with a `rename-out', presumably.
> Also, not using the structure name to create
> instances from their field values now makes me feel dirty. :D
I'm not sure I can help with that. ;)
--
sam th
sa...@ccs.neu.edu