[racket] TR+plot exposes idx9, idx54, etc?

From: John Clements (clements at brinckerhoff.org)
Date: Tue Apr 8 14:48:10 EDT 2014

Here’s a short piece of code that tries to plot an array:

#lang typed/racket

(require plot
         math/array)

(define fft-maxes (array #[3.2 978.9 -2397]))

(: with-indexes (Vectorof (Vector Nonnegative-Integer Real)))
(define with-indexes
  (for/vector : (Vectorof (Vector Nonnegative-Integer Real))
    ([i : Nonnegative-Integer (in-naturals)]
     [a (in-array fft-maxes)])
    (ann (vector (ann i Nonnegative-Integer) a)
         (Vector Nonnegative-Integer Real))))


(plot (lines (in-vector with-indexes)))

I have two questions.
1) Is there an easier way to pair an array with indices? This was kind of challenging.
2) When I run this, I get

Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: idX9
  from module: plot in: #%module-begin
. Type Checker: missing type for identifier;
 consider using `require/typed' to import it
  identifier: idX54
  from module: plot/no-gui in: #%module-begin
. Type Checker: Summary: 2 errors encountered in:
  #%module-begin
  #%module-begin

It seems like I shouldn’t really be trying to make up types for generated identifiers; what’s the right way to solve this?

Thanks!

John Clements



Posted on the users mailing list.