On Wed, 21 Sep 2016, Sven Schreiber wrote:
Am 21.09.2016 um 07:31 schrieb Riccardo (Jack) Lucchetti:
> On Tue, 20 Sep 2016, Allin Cottrell wrote:
>> That said, I can see a case for making it easier to output very simple
>> stuff such as a string followed by a scalar on the same line.
Yes, I was especially fascinated by Lee's Stata example:
di "The sample size is " e(N)
I'm ready to surrender and declare defeat, but not without a final
note that I find it sad that this level of simplicity shouldn't be
possible in hansl...
IMO, the simplicity is possible in hansl, for anyone allergic to
printf; it just takes two lines:
print "Comment on the following number:"
print number
(or "eval number" if it's an expression rather a variable)
What I learned from the discussion is that I still think hansl
could use a syntactic-sugar/one-argument version of sprintf() such
that sprintf(x) == sprintf("%g", x), when x is a scalar type.
(Could also have a new alias name instead of 'sprintf' then, but
that's not my point.)
That could be implemented without prejudice to other points if we
reckon it's worthwhile. I suppose the intended context would be
something like the following (please correct me if I don't have this
right):
<hansl>
r = 42
# variant 1
eval "Here's a number of interest: " ~ sprintf(r)
# versus variant 2
printf "Here's a number of interest: %g\n", r
</hansl>
OK, no more polls for now, but personally I doubt that many people
would find variant 1 simpler/more intuitive than variant 2.
Allin