[racket] Questions on Typed Racket's FlVector

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Fri Apr 6 11:13:32 EDT 2012

On Fri, Apr 6, 2012 at 10:49 AM, Ray Racine <ray.racine at gmail.com> wrote:
> Morning,
> I'm putting together an equivalent of a dataframe from R in Racket.
> To maximize performance of computation over vectors of real numbers is
> FlVector the correct type to use in Typed Racket?

Yes, flvectors in general will be more memory effcient and enable more
optimizations in Racket and Typed Racket.

> Is there some sort of performance gain by having flvector-length in addition
> to vector-length?

No, that's just how flvectors work -- they have a different function
for getting the length.

> Is the following behavior a bug?
>> (vector-length (flvector 1.2 2.3))
> stdin::43119: Type Checker: Expected Vector, but got FlVector in: (flvector
> 1.2

No, that operation is a (dynamic) error in Racket as well:

-> (vector-length (flvector))
; vector-length: expects argument of type <vector>; given: #<flvector>
sam th
samth at ccs.neu.edu

Posted on the users mailing list.