include for-loop in cover snippets x 2

This commit is contained in:
John Kerl 2016-06-10 23:57:34 -04:00
parent b8db524d04
commit 44c367bd8b
5 changed files with 26 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -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])

View file

@ -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
'

View file

@ -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
'
</pre>
</div>
<p/>