On Sat, Mar 12, 2005 at 10:26:51PM -0600, Rod Adams wrote:
: You could easily write the above as
:
:say (($n1, $n2, $n3)».as('%d')).join;
:
: What I'm not certain about is if
:
:say ($n1, $n2, $n3)».as('%d').join;
:
: does the same thing, but I think it does.
Yes, hyper only modifies
On Sat, Mar 12, 2005 at 05:12:30PM -0800, Dave Whipp wrote:
: Larry Wall wrote:
: I don't see that this buys us anything over just shortening sprintf
: to something shorter, like:
:
:print as '%03d %15s', $foo, $bar;
:
: And your argument list falls out naturally from making as a listop.
:
Without introduction, I'll just present the syntax idea:
f/%03d %15s/$foo, $bar/;
This gives s?printf to any expression with short and concise syntax,
making printf redundant, which means I won't even have to start a
discussion about sayf :)
printf %03d %15s, $foo, $bar;
vs
print
Juerd wrote:
Without introduction, I'll just present the syntax idea:
f/%03d %15s/$foo, $bar/;
This gives s?printf to any expression with short and concise syntax,
making printf redundant, which means I won't even have to start a
discussion about sayf :)
printf %03d %15s, $foo, $bar;
vs
Rod Adams skribis 2005-03-12 17:41 (-0600):
Why not just rename C sprintf to C format and ditch printf and sayf?
Because format is almost as much typing as sprintf, and in many
circumstances needs both parens and quotes:
format(%03d %15s, $foo, $bar), $baz, ...
compared to
f/%03d
Juerd [EMAIL PROTECTED] wrote:
Without introduction, I'll just present the syntax idea:
f/%03d %15s/$foo, $bar/;
Of course, this is s///-like in quoting behaviour, so f[][] or f
should work just as well. The RHS is not a string, but parsed as an
expression in list context. If this
On Sat, Mar 12, 2005 at 11:57:39PM +0100, Juerd wrote:
: Without introduction, I'll just present the syntax idea:
:
: f/%03d %15s/$foo, $bar/;
:
: This gives s?printf to any expression with short and concise syntax,
: making printf redundant, which means I won't even have to start a
:
Brent 'Dax' Royal-Gordon skribis 2005-03-12 15:51 (-0800):
Besides, I think as will do just fine, especially since you can now
interpolate method calls as well. You can even do something like this
if you want to perform bulk formatting:
say join ' ', ($n1, $n2, $n3) .as('%d');
Or, if
Larry Wall skribis 2005-03-12 15:55 (-0800):
Well, we do already have:
print $foo.as('%03d'), $bar.as('%15s')
which works on interpolated values as well. It als puts the variable
name out front, since the name is more important than the pattern in
most cases.
It puts the variable name
On Sun, Mar 13, 2005 at 12:58:50AM +0100, Juerd wrote:
: I'm really getting the feeling I'm the only one who uses sprintf because
: it *separates* and lets you write complex things on one simple line.
: That, and I use it a lot in one liners.
Then you should feel much better after you read my
Juerd wrote:
Rod Adams skribis 2005-03-12 17:41 (-0600):
Why not just rename C sprintf to C format and ditch printf and sayf?
Because format is almost as much typing as sprintf, and in many
circumstances needs both parens and quotes:
format(%03d %15s, $foo, $bar), $baz, ...
compared
Larry Wall wrote:
I don't see that this buys us anything over just shortening sprintf
to something shorter, like:
print as '%03d %15s', $foo, $bar;
And your argument list falls out naturally from making as a listop.
Plus it naturally lets you say other as-ly things:
print as MyBigInt, $foo,
Larry Wall wrote:
I don't see that this buys us anything over just shortening sprintf
to something shorter, like:
print as '%03d %15s', $foo, $bar;
And your argument list falls out naturally from making as a listop.
Plus it naturally lets you say other as-ly things:
print as MyBigInt, $foo,
On Sun, Mar 13, 2005 at 01:01:39AM +0100, Juerd wrote:
: It puts the variable name out front, which is great, but it also puts
: the second variable name a the way to the right, after the line
: noise.
print $foo.as('%03d'),
$bar.as('%15s');
Larry
Matt Diephouse wrote:
Brent 'Dax' Royal-Gordon [EMAIL PROTECTED] wrote:
Besides, I think as will do just fine, especially since you can now
interpolate method calls as well. You can even do something like this
if you want to perform bulk formatting:
say join ' ', ($n1, $n2, $n3) .as('%d');
15 matches
Mail list logo