Re: finding common words
From: Uri Guttman (uri_at_stemsystems.com)
Date: 02/24/04
- Next message: Aaron DeLoach: "Split string on multiple character delimeters"
- Previous message: kj: "secure internet Perl programming for banking"
- In reply to: Hunter Johnson: "Re: finding common words"
- Next in thread: Hunter Johnson: "Re: finding common words"
- Reply: Hunter Johnson: "Re: finding common words"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 24 Feb 2004 19:41:36 GMT
>>>>> "HJ" == Hunter Johnson <hunter@hunterandlori.com> writes:
HJ> Uri Guttman <uri@stemsystems.com> wrote in message news:<x74qth75vw.fsf@mail.sysarch.com>...
>> i was never really upset about the efficiency issue which has been
>> changed. i didn't like the semantic problem of throwing away the list
>> that map is supposed to make. now the docs will say there is no
>> generated list in void context so that may be harder to argue. but i
>> still say that map tells the reader a list is being made so look for
>> it.
HJ> If the docs say there is no list generated, how is map going to tell
HJ> the reader that the docs are wrong?
HJ> If a reader reads something extra into what's written (like "here
HJ> comes a list" when none is coming), how is that more the writer's
HJ> problem than the reader's? Either the writer can write it
HJ> differently (using 'for' in this case) or the reader can read it
HJ> differently. I don't see how the former is the only right answer.
it is a semantic communication to the reader of the code. it is your
(the coder's) responsibility to convey as much accurate information to
the reader as possible. map in a void context is not as accurate as a
for modifier even with the optimization. sure the docs will say it won't
generate a list but its history has always been that way. map is clearer
for generating new stuff and for modifier is clearer for side effects.
remember map has the same signature as grep which also returns a
list which will confuse newbies about this issue. and just because
something works a certain way doesn't mean you have to use it. i choose
not to use map in void context and teach that as well.
uri
-- Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
- Next message: Aaron DeLoach: "Split string on multiple character delimeters"
- Previous message: kj: "secure internet Perl programming for banking"
- In reply to: Hunter Johnson: "Re: finding common words"
- Next in thread: Hunter Johnson: "Re: finding common words"
- Reply: Hunter Johnson: "Re: finding common words"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|