Re: arrays vs. vectors



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.
.



Relevant Pages

  • Re: arrays vs. vectors
    ... In Scheme it's called the ... in many other languages it's called an array, ... dimensions, you do it yourself. ...
    (comp.lang.scheme)
  • arrays vs. vectors
    ... Scheme, like most programming languages, also provides a primitive ... in many other languages it's called an array, ... When a language exists that has an array type and a vector type (e.g. ...
    (comp.lang.scheme)
  • Re: Scheme as a religion
    ... Only fifty years ago the idea of a programming language was ... programming languages and their implementations. ... similar to lisp in general and Scheme in particular --- what you ... Think about the literature and history hints I've given you ...
    (comp.lang.scheme)
  • Re: Scheme as a religion
    ... I'm a newcomer to Scheme. ... I started programming early, on Apple's Hypercard because my family had ... brand new C# had a consistency that I found lacked in other languages ... instance you can have lists of functions, or list of list of functions, ...
    (comp.lang.scheme)
  • Re: Scheme as a religion
    ... academics who seem to thoroughly enjoy criticizing the limitations of other languages while extolling the virtues of Scheme, and not so widely respected by and sometimes scoffed at those in the industry who use commercial languages like C++ and Java. ... Even some of the concepts which have since been adopted by other languages haven't always been properly implemented -- closures in Python are one example, and the arbitrary limitations on recursion in many languages is another. ... Javascript does have those, although their power is hampered by some other restrictions of Javascript, so they aren't as nearly as useful as they might otherwise be. ...
    (comp.lang.scheme)