I think you are mostly right. There is not an obvious operation like the list operations for many collections. Nevertheless, we should have good defaults for making a user's life convenience.
Jay On Wed, Aug 11, 2010 at 4:44 PM, Deren Dohoda <deren.doh...@gmail.com> wrote: > 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 > list) > 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 <ebell...@gmail.com> wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> http://programming-puzzler.blogspot.com/2010/08/racket-vs-clojure.html >> >> Any opinions on the subject? >> >> - -- >> Eduardo Bellani >> >> omnia mutantur, nihil interit. >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.9 (GNU/Linux) >> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ >> >> iEYEARECAAYFAkxi0/cACgkQSbLl0kCTjGnfxQCfTNJwqzEZKeStOgwoIUsqiRnr >> HLoAn3r0zWwINnluhSzwDqqCwN0qbssX >> =KaS5 >> -----END PGP SIGNATURE----- >> _________________________________________________ >> For list-related administrative tasks: >> http://lists.racket-lang.org/listinfo/users >> > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > -- Jay McCarthy <j...@cs.byu.edu> Assistant Professor / Brigham Young University http://teammccarthy.org/jay "The glory of God is Intelligence" - D&C 93 _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users