[racket] Port of Plot collection to TR

From: Neil Toronto (neil.toronto at gmail.com)
Date: Thu Aug 9 15:27:09 EDT 2012

On 08/09/2012 12:52 PM, Ray Racine wrote:
> Noticed here http://www.ccs.neu.edu/home/samth/adapt/Current_Status.html

I had no idea someone had been assigned. Cool!

> That the Plot collection still awaits porting to TR.  Has any partial
> work been done, maybe languishing in a github repo somewhere, that can
> be leveraged?

Are you volunteering? :)

It's only possible now that TR has support for keyword arguments.

There's one issue that could cause problems: some renderer-producing 
functions, like `points', accept lists of vectors as arguments. If the 
data argument to `points' had a nice, general type like

    (Listof (Vectorof Real Real))

then applying `points' to

    '(#(0.0 1.0) #(1.0 2.2))

wouldn't typecheck. The problem is that TR thinks `points' might change 
that 0.0 to 0, which would make the original argument type (Listof 
(Vector Float Float)) incorrect. It thinks Bad Things could happen. 
(Technically, a vector is "invariant".)

I can think of two solutions right now:

  1. Wait for a Const type constructor or similar.

  2. Change the contract of `points' to accept lists of pairs, sequences 
or a specialized data type.

I think the contract of `points' should be changed anyway, so users can 
send it any kind of sequence. Might as well make it current-TR-friendly 
at the same time.

Neil ⊥


Posted on the users mailing list.