tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: jot: producing too much output?



    Date:        Fri, 6 Jan 2023 22:07:48 -0000 (UTC)
    From:        mlelstv%serpens.de@localhost (Michael van Elst)
    Message-ID:  <tpa63k$2mq$1%serpens.de@localhost>

  | The original code (see rev 1.1) seems to be more clear on how
  | the parameters should be evaluated.

Yes, but that's even more counter-intuitive than our existing version.
In that, when just begin and end are specified, it first defaults reps
to 100, then calculates the step size so that 100 values fit between
the begin and end specified.   That's why in Mouse's case (what was
reported for the ancient code) some characters were repeated (when
doing -c) as the step size would be 0.95 (maybe 0.96, those details tend
to be beyond my immediate capacity to calculate) rather than 1, so when
converted to integers, every now and then the same value is produced as
last time  (I bet there are really 4, 5, or 6 duplicate chars (one of
those...), not just first and last).

We can easily go back to that if anyone thinks it is a good idea (this
seems to have changed as an unexplained side effect of rev 1.21 in 2008,
or at least I can't see any explicit mention of the alteration), we could
leave things as they are now, or we could kind of have the half way in
between approach, where begin and end are both used (as in 1.1) but where
we assume a step of 1 (or -1 if decreasing) rather than forcing 100 values
in that case.


mouse%Rodents-Montreal.ORG@localhost said:
  | Arguably the right thing to do here is to do the analog of what that
  | version does and list all 16 possible combinations of START, REPS,
  | ENDER, and STEP, with explicit code for each.

The technique used to write the code is about the least important detail,
what matters more is just what the "explicit code" should do in the cases
which aren't obvious.

And yes, the code as it exists now does correspond to the current man page,
but man pages tend to be written (and changed) after the code, and simply
reflect what happens, rather than what's supposed to happen.

One can also read our man page to imply the 1.1 semantics.

kre



Home | Main Index | Thread Index | Old Index