From 44c367bd8b29f09ecb366bb0c88094e759f935ff Mon Sep 17 00:00:00 2001 From: John Kerl Date: Fri, 10 Jun 2016 23:57:34 -0400 Subject: [PATCH] include for-loop in cover snippets x 2 --- README.md | 8 ++++++++ c/mlrvers.h | 2 +- configure.ac | 2 +- doc/index-snippet.txt | 8 ++++++++ doc/index.html | 8 ++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c36878547..fbaef8bd3 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,14 @@ indices. Examples: % mlr stats1 -a min,mean,max,p10,p50,p90 -f flag,u,v data/* % mlr stats2 -a linreg-pca -f u,v -g shape data/* % mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}' data/* +% mlr --from estimates.tbl put ' + for (k,v in $*) { + if (isnumeric(v) && k =~ "^[t-z].*$") { + $sum += v; $count += 1 + } + } + $mean = $sum / $count # no assignment if count unset +' ``` This is something the Unix toolkit always could have done, and arguably always diff --git a/c/mlrvers.h b/c/mlrvers.h index 901041dcc..495a6f154 100644 --- a/c/mlrvers.h +++ b/c/mlrvers.h @@ -1,5 +1,5 @@ #ifndef MLRVERS_H #define MLRVERS_H // Manually increment on updates to https://github.com/johnkerl/miller/releases -#define MLR_VERSION "v4.0.0-dev" +#define MLR_VERSION "v4.1.0" #endif // MLRVERS_H diff --git a/configure.ac b/configure.ac index fe17daac6..8e5a2d43a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.60]) # Manually increment on updates to https://github.com/johnkerl/miller/releases -AC_INIT([mlr],[4.0.0-dev]) +AC_INIT([mlr],[4.1.0]) AC_CONFIG_SRCDIR([c/mlrmain.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([autotools]) diff --git a/doc/index-snippet.txt b/doc/index-snippet.txt index 00ae6012b..d7f112464 100644 --- a/doc/index-snippet.txt +++ b/doc/index-snippet.txt @@ -7,3 +7,11 @@ % mlr stats1 -a min,mean,max,p10,p50,p90 -f flag,u,v data/* % mlr stats2 -a linreg-pca -f u,v -g shape data/* % mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}' data/* +% mlr --from estimates.tbl put ' + for (k,v in $*) { + if (isnumeric(v) && k =~ "^[t-z].*$") { + $sum += v; $count += 1 + } + } + $mean = $sum / $count # no assignment if count unset +' diff --git a/doc/index.html b/doc/index.html index 64ada156a..adef2883c 100644 --- a/doc/index.html +++ b/doc/index.html @@ -159,6 +159,14 @@ positional indices. For example: % mlr stats1 -a min,mean,max,p10,p50,p90 -f flag,u,v data/* % mlr stats2 -a linreg-pca -f u,v -g shape data/* % mlr put -q '@sum[$a][$b] += $x; end {emit @sum, "a", "b"}' data/* +% mlr --from estimates.tbl put ' + for (k,v in $*) { + if (isnumeric(v) && k =~ "^[t-z].*$") { + $sum += v; $count += 1 + } + } + $mean = $sum / $count # no assignment if count unset +'