now, in this case, your review could recommend that Arrays contains a
menu item "How to Delete the Entire Contents of an Array" and that has
a function "zap" that....
function zap(a) {
#for(i in a) delete a[i] # uncomment for awks other than gawk
delete a
}
enjoy!
:-)
t
> --
> To unsubscribe, reply using "remove me" as the subject.
>
--
there are those who call me... tim (menzies, ph.d.)
morgantown (39.6n, -79w), usa
assoc prof csee, wvu
http://menzies.us
1-304-376-2859
PROBLEM: Handling e-mail is very very very slow, resulting in inbox overflow.
SOLUTION: Adopt the "http://four.sentenc.es" policy: no responses
longer than 4 sentences. It’s that simple. Care to try it?
For now I will point out where something uses non-standard AWK and we
can worry about it later. Perhaps an appendix or online reference for
antique AWKs. It is becoming less of an issue all the time since most
people use the newer AWKs. Darn kids, get off my lawn!! ;-)
BTW, I'm expecting the indirect functions (Arnold is working hard on
that issue) too!
Have a nice day.
On 4 Απρ, 18:15, Michael Richter <ttmrich...@gmail.com> wrote:
> On my machine I have:
>
> - gawk 3.1.6
> - mawk 1.3.3
> - jawk 1.02
> - awk (version uncertain)
>
> The first two I did not install -- they were just there by default on my
> Ubuntu system. Plain old original awk I installed out of curiosity and jawk
> I installed to ensure I have a decent awk implementation on my USB stick
> that I could run anywhere.
>
> I think that a cookbook for awk should probably give coverage in some form
> to the language family, not one particular dialect. We should pick one
> (gawk, most likely, seeing as it's the most omnipresent) as
>
And there is a way to check if an element is in an array, just use in.
~# original-awk 'BEGIN {foo[1]=2;if(1 in foo){print "Foo!"}else{print
"NO foo"}}'
Foo!
~# original-awk 'BEGIN {foo[1]=2;if(2 in foo){print "Foo!"}else{print
"NO foo"}}'
NO foo
what we have, that is different, is the seed of one of the largest awk
libraries every written
(http://awk.googlecode.com/svn/trunk/src/release/cookbook.awk) by one
of the largest awk teams every assembled (i.e. us).
what do we need to do focus ourselves on useful extensions to that
library? for example,
1) how can we get on with lots of reviewing? e.g.
a) forget all my tools and my googlecode stuff then
b) add a comment box on each page like currently at awk.info?
c) we just debate things in blog format?
2) regarding the current discussion, can we end the current discussion
with something like "isolate the gawk specific things" in functions
(like zap), run with gawk, but leave commented on code for other
gawks. e.g.
function zap(a, i) {
# for(i in a) delete a[i] # for non-gawks
delete a
}
or (another one that should work with all awks)
function zap(a, i) {
split('',a,'')
}
t
p.s. i hope that's not too aggressive a suggestion. but i chaff. i
want us to get on with it