in reply to Re: Re: playing with map
in thread playing with map
UPDATE
I was asked why talking about modifying the input list
triggered comments about void context from me and tye.
Here is why. The typical bad idiom you see is to use a
grep in void context to
change the input list. Hence the alarm. Note that it is usually a bad idea to modify
the input list when not in void context, but occasionally
it may be natural to do that. For instance the input
list is temporary, and you want to both filter and modify
in an obvious way. Here is an example of a case where it
would fit:
In my experience these cases tend to be rare.return grep s/^FOR_PRINT://, <FILE>;
UPDATE 2
merlyn is right. I would have to work harder to come
up with a place where modifying the input list makes sense. Given that I am not feeling well, I don't feel like doing that, and given that I think it is a bad idea, I don't think I should bother...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re (tilly) 3: playing with map
by merlyn (Sage) on Mar 09, 2001 at 21:43 UTC |