mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-21 02:23:20 +00:00
doc neaten
This commit is contained in:
parent
54cacc39d6
commit
8ca1bae4f4
2 changed files with 16 additions and 40 deletions
|
|
@ -1337,35 +1337,21 @@ by design handles heterogenous data: the running <tt>@sum</tt> in
|
|||
<tt>mlr put '@sum += $x'</tt>
|
||||
should not be invalidated for records which have no <tt>x</tt>.
|
||||
|
||||
<li/> Absent out-of-stream-variable values are precisely what allow you to write not
|
||||
<tt>mlr put 'begin{@sum = 0}; @sum += $x'</tt>
|
||||
but rather
|
||||
<tt>mlr put '@sum += $x'</tt>
|
||||
— and furthermore make it possible for you to write
|
||||
<tt>mlr put '@sum[$a] += $x'</tt>
|
||||
at all.
|
||||
<li/> Absent out-of-stream-variable values are precisely what allow you to write
|
||||
<tt>mlr put '@sum += $x'</tt>. Otherwise you would have to write
|
||||
<tt>mlr put 'begin{@sum = 0}; @sum += $x'</tt> —
|
||||
which is tolerable — but for
|
||||
<tt>mlr put 'begin{...}; @sum[$a][$b] += $x'</tt>
|
||||
you’d have to pre-initialize <tt>@sum</tt> for all values of <tt>$a</tt> and <tt>$b</tt> in your
|
||||
input data stream, which is intolerable.
|
||||
|
||||
<!--
|
||||
xxx merge
|
||||
|
||||
<p/>Without uninit, for the
|
||||
former you’d need to type <tt>mlr put -q 'begin{@sum = 0}; @sum += $x';
|
||||
end{emit @sum}'</tt> (which is tolerable), but for the latter you’d need
|
||||
to know all values of <tt>$a</tt> and <tt>$b</tt> before reading your input
|
||||
data, which would be intolerable.
|
||||
-->
|
||||
|
||||
<li/> The penalty for this is that misspelled variables can be hard to find:
|
||||
<li/> The penalty for the absent feature is that misspelled variables can be hard to find:
|
||||
e.g. in <tt>mlr put 'begin{@sumx = 10}; ...; update @sumx somehow per-record; ...; end {@something = @sum * 2}'</tt>
|
||||
the accumulator is spelt <tt>@sumx</tt> in the begin-block but <tt>@sum</tt> in the end-block, where since it
|
||||
is absent, <tt>@sum*2</tt> evaluates to 2.
|
||||
|
||||
</ul>
|
||||
|
||||
<!--
|
||||
<p/>xxx keep typing up from here.
|
||||
-->
|
||||
|
||||
<!--
|
||||
xxx say what for logical/bitwise
|
||||
<p/>xxx
|
||||
|
|
|
|||
|
|
@ -4913,25 +4913,15 @@ by design handles heterogenous data: the running <tt>@sum</tt> in
|
|||
<tt>mlr put '@sum += $x'</tt>
|
||||
should not be invalidated for records which have no <tt>x</tt>.
|
||||
|
||||
<li/> Absent out-of-stream-variable values are precisely what allow you to write not
|
||||
<tt>mlr put 'begin{@sum = 0}; @sum += $x'</tt>
|
||||
but rather
|
||||
<tt>mlr put '@sum += $x'</tt>
|
||||
— and furthermore make it possible for you to write
|
||||
<tt>mlr put '@sum[$a] += $x'</tt>
|
||||
at all.
|
||||
<li/> Absent out-of-stream-variable values are precisely what allow you to write
|
||||
<tt>mlr put '@sum += $x'</tt>. Otherwise you would have to write
|
||||
<tt>mlr put 'begin{@sum = 0}; @sum += $x'</tt> —
|
||||
which is tolerable — but for
|
||||
<tt>mlr put 'begin{...}; @sum[$a][$b] += $x'</tt>
|
||||
you’d have to pre-initialize <tt>@sum</tt> for all values of <tt>$a</tt> and <tt>$b</tt> in your
|
||||
input data stream, which is intolerable.
|
||||
|
||||
<!--
|
||||
vxx merge
|
||||
|
||||
<p/>Without uninit, for the
|
||||
former you’d need to type <tt>mlr put -q 'begin{@sum = 0}; @sum += $x';
|
||||
end{emit @sum}'</tt> (which is tolerable), but for the latter you’d need
|
||||
to know all values of <tt>$a</tt> and <tt>$b</tt> before reading your input
|
||||
data, which would be intolerable.
|
||||
-->
|
||||
|
||||
<li/> The penalty for this is that misspelled variables can be hard to find:
|
||||
<li/> The penalty for the absent feature is that misspelled variables can be hard to find:
|
||||
e.g. in <tt>mlr put 'begin{@sumx = 10}; ...; update @sumx somehow per-record; ...; end {@something = @sum * 2}'</tt>
|
||||
the accumulator is spelt <tt>@sumx</tt> in the begin-block but <tt>@sum</tt> in the end-block, where since it
|
||||
is absent, <tt>@sum*2</tt> evaluates to 2.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue