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; } } }