Some thoughts...
David Rush
(21 Nov 2001 19:26 UTC)
|
Bad things Re: Some thoughts...
Jussi Piitulainen
(21 Nov 2001 20:25 UTC)
|
Re: Bad things Re: Some thoughts...
David Rush
(22 Nov 2001 16:10 UTC)
|
Access time of elements Re: Bad things []
Jussi Piitulainen
(27 Nov 2001 10:59 UTC)
|
Re: Access time of elements Re: Bad things []
Per Bothner
(27 Nov 2001 17:10 UTC)
|
Re: Access time of elements Re: Bad things []
David Rush
(27 Nov 2001 17:25 UTC)
|
Re: Access time of elements Re: Bad things []
Per Bothner
(27 Nov 2001 17:55 UTC)
|
Re: Access time of elements Re: Bad things []
David Rush
(27 Nov 2001 21:19 UTC)
|
Re: Access time of elements Re: Bad things []
Jussi Piitulainen
(28 Nov 2001 15:40 UTC)
|
Re: Access time of elements Re: Bad things []
Jussi Piitulainen
(28 Nov 2001 16:20 UTC)
|
Re: Access time of elements Re: Bad things [] Noel Welsh (28 Nov 2001 10:55 UTC)
|
Re: Access time of elements Re: Bad things []
Jussi Piitulainen
(28 Nov 2001 17:21 UTC)
|
--- Per Bothner <xxxxxx@bothner.com> wrote: > Jussi Piitulainen wrote: > > >Shall we switch, and is a vector good enough for an > index object? (I > >believe somebody asked for such packaging even > apart from efficiency.) > > > A modest but not order-or-magnitude difference on a > non-optimizing > implementation is not does not IMO justify a less > natural api. As the "somebody" in question I should explain why I feel this is a more natural api. Consider list processing in Scheme. Scheme is a 'closed world' for list processing - you never need operate on anything but lists because of fold and apply. I've written Scheme programs that have no other data structure, and I'm sure others have. Now I have two hypotheses: 1) We want a truly great language for array processing 2) We want that language to be Scheme If that is the case then there needs to be an array/function duality of the same kind we have for lists. I.e. you need to be able to pull apart arrays and use those parts to pull apart other arrays. So I advocate using arrays as indices to arrays (NB: there is no separate index object in this proposal). A simple example of why this is desireable: Imagine you have a 2-D array storing temparature measured at space and time, say samples from a number of weather stations over a period of days. temparature := array[location time] Now imagine that you want to be able to quickly find out the hotest measurement for each day (maybe you're working for the fire department and this is important information). So you have another array which indexes into the temparature array. hotest := array[time indexes] This is a 1 x 2 array, where column 0 corresponds to location and column 1 to time Now to find the hottest measurement for day 0 you would do something like this: The current proposal: (let ((location (array-ref hotest 0 0)) (time (array-ref hotest 0 1))) (array-ref temparatures location time)) My proposal: (array-ref temparatures (array-ref hotest #(0))) The first array ref returns the array-slice hotest[0:] The second uses that array slice to index into the temparatures array. In my opinion this is much cleaner code. I hope that clears things up. Noel __________________________________________________ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1