[racket] Interesting article

From: Deren Dohoda (deren.dohoda at gmail.com)
Date: Wed Aug 11 18:44:28 EDT 2010

I am a novice, self-taught programmer. Please forgive this possibly
naive question, but what's the problem? The big post I read seems to
say this one sentence: different containers are different, but they
should act the same.

But, different containers are different for a good reason.

Take a linked list. "map" is a well-known operation, taking a
procedure and a list, and returning a (possibly fresh) list with proc
applied to every element of the original list. Now, take a vector.
What does map mean? I can't answer this question.

1) Well, you chose a vector because it is mutable, so map should
really be something like map! and return void
2) Well, you chose a vector because it is random-access, so this one
exceptional O(n) operation should return a vector for otherwise
random-access use
3) Well, you only do something to every element as processing for more
doing-something-to-every-element so it should return a list with
better filter behavior
4) Well, *I* have no clue what you want, so I'll just create this view
called a "sequence" and give you that (oh yeah it just acts like a
5) Well, *I* have no clue what you want, so I'll just leave it up to
you to make your own map-like function

I can't pick between 1 through 3, because I don't know why someone is
doing something to every element of a vector (curiosity: why didn't
they use a list in the first place?). I don't believe (4) is so much a
"solution" as a way to relocate the problem to post-processing of your
containter-viewed-through-a-sequence rather than pre-processing by
selecting the right function in the first place. (Of course, (5) is
not a solution, either, but a refusal to do anything at all.)

Can someone please elaborate a bit on why this map-vs-vector-map is a
problem? I feel like I am missing something kind of basic here.

On Wed, Aug 11, 2010 at 12:46 PM, Eduardo Bellani <ebellani at gmail.com> wrote:
> Hash: SHA1
> http://programming-puzzler.blogspot.com/2010/08/racket-vs-clojure.html
> Any opinions on the subject?
> - --
> Eduardo Bellani
> omnia mutantur, nihil interit.
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> iEYEARECAAYFAkxi0/cACgkQSbLl0kCTjGnfxQCfTNJwqzEZKeStOgwoIUsqiRnr
> HLoAn3r0zWwINnluhSzwDqqCwN0qbssX
> =KaS5
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users

Posted on the users mailing list.