On Thu, 31 Oct 2002, Mike Miller wrote: > On Wed, 30 Oct 2002 20:28:11 +0000 (GMT) > Franck PORCHER <[EMAIL PROTECTED]> wrote: > > > Let's prey that those PHP geeks quickly discover the > > true joy of working with functionnals (map and al.). > > I have often wondered about the ratio of Perl programmers > > still using the C-like <for> construct. I guess it's rather low. > > > > But <for> is a lot easier to read and debug, IMHO .... Is there a > significant performance difference in using map instead?
My experience is that in most cases, the <for> construct is used to apply the same treatment to all the elements of an array, whence the <map> construct. In those cases, the readibility is definitely altered by the index that get in the way. I think that the adoption of map is mostly cultural, depending on one's background experience with functionnal programming, basically splitting the way of thinking about collections of objects between the <array/for> construct (fortran programmers for instance) and <list/map> construct (lisp programmers). Of course, this is a quick analysis not taking into account other factors like readibility versus efficiency. In fact, regarding the efficiency of the <map> construct, I often wondered whether Perl detects <map> being ran in a void context, so as to give it an iterative interpretation, avoiding to build the output list. Does someone know about this ? Franck. > --M. > > > > > -- ==================================================== ESSENTIAL SOFTWARE - Ingénierie Informatique Solutions Linux & Open Source en Polynésie française ---------------------------------------------------- http://www.esoft.pf/ Tél: (689) 562 395 / 508 288-289 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- "Lassé des virus? Osez Linux, le choix moderne des gouvernements et des entreprises Fortune 500" ====================================================