Re: arrays vs. vectors
- From: Kon Lovett <klovett@xxxxxxxxxxx>
- Date: Sat, 28 Jan 2006 05:31:31 GMT
In article <1138391765.209714.214890@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"H." <hbe123@xxxxxxxxx> wrote:
> from brian harvey 61A lecture notes:
> "The list suffers from one important weakness. Finding the nth element
> of a list takes time theta n because you have to call cdr n-1 times.
> Scheme, like most programming languages, also provides a primitive
> aggregation mechanism without this weakness. In Scheme it's called the
> vector; in many other languages it's called an array, but it's the same
> idea. Finding the nth element of a vector takes theta 1 time."
>
> Actually I only need one sentence of this, but the one sentence
> deserves context::
> "In Scheme it's called the vector; in many other languages it's called
> the array"
>
> When a language exists that has an array type and a vector type (e.g.
> Java), how do the array and vector types in those languages correspond
> to the vector type in Scheme? Did Scheme pack everything into one type
> for which other languages need two?
See
http://srfi.schemers.org/srfi-4/srfi-4.html
http://srfi.schemers.org/srfi-43/srfi-43.html
http://srfi.schemers.org/srfi-47/srfi-47.html
http://srfi.schemers.org/srfi-63/srfi-63.html
Many Schemes have ports of these. R5RS vectors (& lists) are pitiful,
without much in the way of mutators/etc, and no >1 dim arrays (vectors
being 1 dim, as others stated).
I have only used srfi-4/43 w/ Chicken. It does have a srfi-47 (>1 dim
arrays) but I have no experience. Srfi-63 is not available, currently,
w/ Chicken.
.
- References:
- arrays vs. vectors
- From: H.
- arrays vs. vectors
- Prev by Date: Re: arrays vs. vectors
- Next by Date: Re: arrays vs. vectors
- Previous by thread: Re: arrays vs. vectors
- Next by thread: interactive scheme
- Index(es):
Relevant Pages
|