in reply to Re: Think for yourself.
in thread is the use of map in a void context deprecated ?
my @L = map { fix($_->[4]); fix($_->[8]); [ @$_[0,2,3,6,4,8] ] } grep { @$_ == 10 and ($_->[7] eq 'IP') and ($_->[9] eq 'local') } map { [ split ] } <F>;
i think map in void context is just fine. if i decided to place my data in a hash for later lookup i just might do so at the end of the first map (instead of returning an array of arrays). i'm sure i wouldn't try and re-craft the code to use a for just to appease.
much in the same way i use the 'useless' cat in my shell pipelines.
$ cat foo.txt | fgrep blah
it's much easier to decide to add more files to the cat (try that with <file ). or to replace the cat with another command that generates the data. why on earth would i continuously rewrite my commands when i can up-arrow and add easily to the beginning?
$ fgrep blah <foo.txt | consolidate | dump $ preproc <foo.txt | fgrep blah | consolidate | dump $ additional <foo.txt | preproc | fgrep blah | consolidate | dump # vs $ cat foo.txt | fgrep blah | consolidate | dump $ cat foo.txt | preproc | fgrep blah | consolidate | dump $ cat foo.txt bar.txt | additional | preproc | fgrep blah | consolidat +e | dump $ real_stream | additional | preproc | fgrep blah | consolidate | dump
i'll keep my useless cat and my map in void context thank you much. they're my artifacts of iterative development.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Think for yourself.
by MarkM (Curate) on Oct 06, 2003 at 05:47 UTC | |
by tilly (Archbishop) on Oct 06, 2003 at 06:12 UTC | |
Re^3: Think for yourself. (learn your tools (bash))
by Aristotle (Chancellor) on Oct 06, 2003 at 11:17 UTC | |
by zengargoyle (Deacon) on Oct 06, 2003 at 11:51 UTC |