[plt-scheme] Some things about the Vector type that are not mentioned in normal documention

From: Zhu Chongkai (mathematica at citiz.net)
Date: Sun Nov 28 10:25:59 EST 2004

But IMO, implementing 2D array as vector of vectors is OK.
If Make-Vector bothers you, just use the # , for example:

'#(#(11 12)
   #(21 22))

makes a 2*2 array. Maybe quasiquote is also needed.

Zhu Chongkai 

>As a new user to Scheme, I recently tried to implement a 2D array as a
>vector of vectors in PltScheme.  Obviously things did not go well for
>me (I used Make-Vector and I filled the vector with another set of
>vectors.)
>
>Now nowheres in the included documentation, t-y-scheme or the PLT
>MzScheme language manual, is anything mentioned about this being an,
>...., issue.  Actually I still have no idea exactly what happened,
>something to do with graphs (they are mentioned once or twice in small
>print in connection with Vectors) but still, there was definitely an
>issue.
>
>The thing is, the most straight forward way to create a 2D array (well
>aside from the rather excellent SRFI 25 which has insanely nice
>notation) for a student who has just been told to "use vectors like
>arrays", is to make a vector of vectors.  From the students point of
>view (looking at a vector as being a renamed array, which is not so
>far off after they have taken linear algebra courses), this is
>logically valid, and trying to debug what appears to be logically
>valid code is rather hard!
>
>The short of it is, it would be nice if something was mentioned in at
>least one of the manuals telling the poor user "Not To Do That".
>
>(I'd ask what the heck happened, but I am sure that will be covered in
>my 2nd quarter of functional programming, but if anyone wants to hit
>me with a clueX4 so I know what to expect when it does come up.... )




Posted on the users mailing list.