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: Recommendations
    ... When Scheme first came out, the idea of Lexical scope was not nearly as popular as it is today. ... Traditional Lisp systems were dynamically scoped, as well as a number of other languages. ... In Lisps, most systems provide a form of macros in which the macro language is the same as the lisp language itself, enabling arbitrary, very powerful transformations. ... The above is a version of a while loop syntax written in scheme to simulate C's while loop: ...
    (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)