Date: Thu, 5 Jan 2023 11:16:22 -0500 (EST) From: Mouse <mo...@rodents-montreal.org> Message-ID: <202301051616.laa11...@stone.rodents-montreal.org>
Answering your 2 recent messages backwards: | But I don't understand why the code isn't instead something more | like | | if (! (have & REPS)) reps = 100; | if (! (have & BEGIN)) begin = 1; | if (! (have & ENDER)) ender = 100; | if (! (have & STEP)) step = 1; | ...compute t and possibly reduce reps... That wouldn't work for a usage like jot 2 - 20 5 (which should output 15 and 20) as you set begin to 1 (it wasn't given) whereas it should be calculated. | I am reminded of the aphorism that there are two ways to build a Perhaps jot is trying to do too much, that's out of my pay grade to decide, if you only need numbers, seq(1) has a simpler interface. | I'd do it myself except I don't know where to find an | authoritative spec for jot. I'd tend to assume it is the code. mo...@rodents-montreal.org said in the preceding message: | So I would expect "- 32 126" to behave like "100 32 126 1". And text which | you didn't quote says "If four [args] are specified and the given and | computed values of reps conflict, the lower value is used". But as you said 4 values weren't specified, so that doesn't apply. In practice, (ie: in the code) the end value is only ever used to calculate missing other values, the actual output comes entirely from begin, step, and reps. | Forcing users to compute the number of values they want when specifying | both begin and end strikes me as counterintuitive at best. That's never been required, you could specify s (the step) instead, and since in the cases you're interested in, that's just 1 that's kind of easy to do. With begin and and s (step) reps can be calculated (and is). | When jot didn't give I wanted, I wrote shell loop ( | i=BEGIN; while [ $i -lt END ]; do BODY; i=$(($i + 1)); done | or something like it). and in that you specified BEGIN END and step (as the constant 1). If you had done the same with jot, it would have done what you wanted, first time. kre ps: it would probably be -le rather than -lt to duplicate the meanings of begin and end in jot.