From 2f65f03f4472287305c5ea4eaa8f0ec57ed545ad Mon Sep 17 00:00:00 2001 From: John Kerl Date: Mon, 20 Feb 2017 22:10:31 -0500 Subject: [PATCH] example neaten --- doc/cookbook.html | 11 +++++------ doc/data/maxrows.mlr | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/doc/cookbook.html b/doc/cookbook.html index 5f7d24ff5..fe24a4b73 100644 --- a/doc/cookbook.html +++ b/doc/cookbook.html @@ -817,13 +817,12 @@ $ cat data/maxrows.mlr @maxn = max(@maxn, $n); # After all records have been read, loop through retained records -# and print those with the max n value +# and print those with the max n value. end { - for ((nr,k),v in @records) { - if (k == "n") { - if (@records[nr]["n"] == @maxn) { - emit @records[nr] - } + for (int nr in @records) { + map record = @records[nr]; + if (record["n"] == @maxn) { + emit record; } } } diff --git a/doc/data/maxrows.mlr b/doc/data/maxrows.mlr index 81c653707..f9578b6be 100644 --- a/doc/data/maxrows.mlr +++ b/doc/data/maxrows.mlr @@ -4,13 +4,12 @@ @maxn = max(@maxn, $n); # After all records have been read, loop through retained records -# and print those with the max n value +# and print those with the max n value. end { - for ((nr,k),v in @records) { - if (k == "n") { - if (@records[nr]["n"] == @maxn) { - emit @records[nr] - } + for (int nr in @records) { + map record = @records[nr]; + if (record["n"] == @maxn) { + emit record; } } }