Juerd:
Rob Kinyon:
What about @array.indices instead?
Oops, I said indexes in a former message.
AFAIK they share most of their meanings nowadays.
(My old Chambers says that indexes are books.)
Maybe a good candidate for an alias?
No doubt about it.
--
Affijn, Ruud
Gewoon is een
TSa:
Perhaps we
can live with the numerically lower end always beeing part
of the range, the larger one never,
I don't think so.
0 .. 5 == ( 0, 1, 2, 3, 4)
{ action } for 0 .. 5
is supposed to run for 0,1,2,3,4,5.
But '0 .. ^5' should not mean '( 0, 1, 2, 3, 4, 5)' just because
Ruud H.G. van Tol schreef:
[RD-interface]
See also these Haskell Hierarchical Libraries (base package)
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Set.html
http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Map.html
--
Affijn, Ruud
Gewoon is een tijger.
Larry Wall schreef:
Ruud H.G. van Tol:
Uri Guttman:
When cast into an array, you can access all the positional
arguments; Into a hash, all named arguments; Into a scalar, the
invocant; Into code, into slurpy nameless block.
The last 'into' should be 'the'.
And it has become 'its', which
Uri Guttman schreef:
you might as well attribute the s:g/Into/into/ to dr. ruud.
Right, s:g/I/i/ is all that remained. I really was amazed by your new
capitalization style.
:)
--
Affijn, Ruud
Gewoon is een tijger.
(posted via news://nntp.perl.org again)
Ruud H.G. van Tol schreef:
Juerd:
autrijus:
-foo.($arg1, $arg2);
+foo. ($arg1, $arg2);
[...]
Please reconsider.
Yes, please come up with a different character to
bridge/cross/hide/cloak/skip/zap the succeeding not allowed
whitespace.
Maybe the \, making \whitespace mean
[EMAIL PROTECTED] schreef:
+The unary prefix operator C* casts a value to an CCapture
s/\ban\b/a
@@ -1340,7 +1340,7 @@
PairTuple of two elements that serves as an one-element
idem
+my $ref = [EMAIL PROTECTED]; # $ref is an Capture object - see S02
idem
--
[EMAIL PROTECTED] schreef:
Author: autrijus
Date: Sun Apr 16 18:24:04 2006
New Revision: 8724
Modified:
doc/trunk/design/syn/S06.pod
doc/trunk/design/syn/S09.pod
Log:
* more typo cleanups promted by Dr. Ruud.
I love tradition: s/mt/mpt
;)
-The unary prefix operator C* casts a
Jonathan Lang schreef:
When is the last time that you saw an underscore-only method name?
sub _{print$_\n};
--
Affijn, Ruud
Gewoon is een tijger.
quote
Instead of /ee say:
s/pattern/{ eval doit() }/
/quote
s/eval/try/ ?
--
Affijn, Ruud
Gewoon is een tijger.
S11, near the end:
s/beings/begins/
:)
--
Affijn, Ruud
Gewoon is een tijger.
What would be the way to define-or-set that a specific hash has
non-case-sensitive keys?
Or broader: that the keys should be normalized (think NFKC()) before
usage?
Would it be easy to delegate it to the hash? (or use a hardly
noticeable wrapper)
--
Affijn, Ruud
Gewoon is een tijger.
Larry Wall schreef:
Dr.Ruud:
What would be the way to define-or-set that a specific hash has
non-case-sensitive keys?
Use a shaped hash with a key type that defines infix:===
appropriately, since object hashes are based on infix:=== rather
than infix:eq.
Suppose I want the keys
Aaron Sherman schreef:
given $_ {
when $x {...}
}
or
$_ ~~ $x
Can that be written as .~~ $x?
--
Affijn, Ruud
Gewoon is een tijger.
Mark A. Biggar schreef:
Darren Duncan:
Now, I didn't see them yet anywhere in Synopsis 3, but I strongly
recommend having negated versions of all these various types of
equality tests. Eg, !== for ===, nev for eqv, etc. They would be
used very frequently, I believe (and I have even tried
Larry Wall schreef:
Dr.Ruud:
Aaron Sherman:
$_ ~~ $x
Can that be written as .~~ $x?
No, but you might just possibly get away with writing:
.infix:~~($x)
assuming that the $_.foo($x) SMD eventually fails over to foo($_,$x)
MMD. But that doesn't seem to be much of an improvement
Darren Duncan schreef:
Dr.Ruud:
say foo if $x !== $y;
into
say foo unless $x === $y;
And how about symmetry:
say foo unless $y === $x;
Any equality or inequality operator is commutative,
If $x and $y are not of the same type, and one or both of the involved
types has its own
As sometimes Perl6 to Perl5 is explained as C++ to C:
Newsgroups: rec.arts.humor
Subject: The truth about 'C++' revealed
Date: Tuesday, December 31, 2002 5:20 AM
On the 1st of January, 1998, Bjarne Stroustrup gave an interview to the
IEEE's 'Computer' magazine.
Naturally, the editors thought he
David Green schreef:
===
...is equality-of-contents, basically meaning that the things you're
comparing contain the same [...] values.
How about strings; are normalized copies used with the === ?
http://www.unicode.org/faq/normalization.html
http://www.unicode.org/notes/tn5/
--
Affijn,
Markus Laire schreef:
my $x = 'Just Another';
my $y := $x;
$y = 'Perl Hacker';
After this, both $x and $y contain the string Perl Hacker, since
they are really just two different names for the same variable.
/quote
So $x === Sy stil holds.
--
Affijn, Ruud
Gewoon is een
Markus Laire schreef:
Dr.Ruud:
Markus Laire:
my $x = 'Just Another';
my $y := $x;
$y = 'Perl Hacker';
After this, both $x and $y contain the string Perl Hacker, since
they are really just two different names for the same variable.
/quote
So $x === Sy stil[l] holds
Larry Wall schreef:
Dr.Ruud:
Comparing strings in Perl5, using NFKD:
perl5 -MUnicode::Normalize -we '
($\, $,) = (\n, \t) ;
$x = qq{Henry IV} ;
$y = qq{Henry \x{2163}} ;
print qq{$x}, qq{$y}, length $x, length $y, $x eq $y ? 1 : 0 ;
# $x = NFKD $x ;
$y = NFKD $y ;
print qq
Stuart Cook schreef:
Larry Wall:
if 0 {
...
}
The one disadvantage of that approach is that it will break if the
commented-out code temporarily fails to compile.
How frequent does that happen?
And in that case s/if 0/\#/, as Luke mentioned.
And if the compile failure has to
Carl Mäsak schreef:
Ruud:
Carl:
But maybe a variable that implicitly carries along the loop index
would be even snazzier?
for @array - $val {
say $.\t$val;
}
Or give the block a name (label), and have an index (or several
indexes, like some that are reset by redo an some that are
Carl Mäsak schreef:
I suppose doing a map or a grep over @array.kv is possible:
pugs my @array = london bridge is falling down
(london, bridge, is, falling, down)
pugs map { Element $^a is called $^b }: @array.kv;
(Element 0 is called london,
Element 1 is called bridge,
Element 2 is
Damian Conway schreef:
[attribution repaired] Carl:
But it can hardly be blamed for clarity.
That's a little unfair.
can hardly be blamed - can easily be praised g
--
Affijn, Ruud
Gewoon is een tijger.
Damian Conway schreef:
Ruud:
Damian:
Carl:
But it can hardly be blamed for clarity.
That's a little unfair.
can hardly be blamed - can easily be praised g
Apologies to Carl if I misinterpreted. I read it as:
can hardly be blamed for (having) clarity
;-)
Nah, I was just joking;
Damian Conway schreef:
[for @array - $index, $value {...}]
No. There's no such magic. I simply screwed up. I should have written:
for @array.kv - $index, $value {...}
:-(
Ah, much clearer now. g
--
Affijn, Ruud
Gewoon is een tijger.
Paul Seamons schreef:
The following is one more interesting case.
say Ok then if $yes and $true unless $no or $false;
Without nested modifiers you'd have either:
say Ok then if $yes and $true and ! $no and ! $false;
or
say OK then unless ! $yes or ! $true or $no $or $false;
And
Paul Seamons schreef:
In the samples you gave I had to read the entire line to see
what the outcome of the code is.
I was not addressing reading skills, but just your you'd either have
... or One always needs to read the full line, but one doesn't
have to do that linearly or just from
larry schreef:
+Likewise, from the fact that list context flattens inner arrays and
+lists, it follows that a reduced assignment does no special syntactic
+dwimmery, and hence only scalar assigments are supported. Therefore
+
+[=] $x, @y, $z, 0
+[+=] $x, @y, $z, 1
+
+are
Larry Wall schreef:
Dr.Ruud:
larry:
+Likewise, from the fact that list context flattens inner arrays and
+lists, it follows that a reduced assignment does no special
syntactic +dwimmery, and hence only scalar assigments are
supported. Therefore +
+[=] $x, @y, $z, 0
+[+=] $x, @y
Mark J. Reed:
Aaron Sherman:
Proposal: A sigil followed by [...] is always a composer for that
type.
%[...] - Hash. Unicode: ?...?
@[...] - Array. Unicode: [...]
? - Seq. Unicode: ?...?
[...] - Code. Unicode: ?...?
|[...] - Capture.
Smylers schreef:
in
this particular case the particular behaviour involves _executing as
Perl code something which the programmer never intended to be code in
the first place_. That's crazily dangerous.
I wouldn't mind eval() to be off by default, so to have to put a use
eval in every block
Jonathan Lang schreef:
role R does A does B does C { ... } # unordered composition
$x does A does B does C; # ordered composition
$y does A | B | C; # unordered composition
I'd like to see it done something like:
role R does A does B does C { ... } # unordered composition
Smylers schreef:
my $whatever
= do { my $baz = $bar * 17; my $quux = $baz - 3; $baz / $quux };
($bar better not be 3/17)
Just a rewrite:
my $whatever
= do { my $quux = (my $baz = $bar * 17) - 3; $baz / $quux };
And maybe even something like:
my $whatever
= do
Smylers schreef:
Ruud H.G. van Tol:
Darren Duncan:
TSa:
set operations ... make them Bag operations to start with.
I agree with ... making Set the main type and making Bag an
extension built upon that, as complex is built upon num, etc.
I don't think that will work out. Modification of a
Luke Palmer schreef:
When do we do integer/rational math and when do we do floating point
math?
That is, is 1 different from 1.0? Should 10**500 be infinity or a 1
with 500 zeroes after it? Should 10**10**6 run out of memory? Should
say (1/3)**500 print a bunch of digits to the screen or
Joe Gottman schreef:
When you call map on a multislice, does it do deep or shallow
iteration?
And with deep, there is the choice: depth first or not.
--
Affijn, Ruud
Gewoon is een tijger.
Larry Wall schreef:
Dr.Ruud wrote:
I would expect
%hash.exists{$key}
Except $foo.bar{$key} is interpreted as $foo.bar().{$key}. Things
like exists and delete need to evaluate the key before calling
the method in question, not after.
OK.
with the shortcut
%hash.:{$key}
to test
Steve Lukas schreef:
In between, I think 'variable' is too long, so:
$code =~ s/variable/vari/g;
I don't think it is too long, since most of the times you don't need to
mention it. Could 'rw' be an alias?
my rw @heredoc_stubs is context = ();
my @heredoc_stubs is rw context = ();
my
David Green schreef:
Jonathan Lang:
(In fact, the semantics for @x[*+n] follows directly from the fact
that an array returns the count of its elements in scalar context.)
And @x[*] would be the same as @x[0..^*] or @x[0..(*-1)].
That's an elegance in its favour.
In Perl5 a + can creep in,
[EMAIL PROTECTED] schreef:
-Attempting to access an index outside a array's defined range will
fail:
+Attempting to access an index outside an array's defined range
will fail:
Idea for Perl6 test code: detecting (simple) typos in documentation.
--
Affijn, Ruud
Gewoon is een tijger.
Markus Laker schreef:
If I've got this right:
mangle $foo :a;# mangle($foo, a = 1);
mangle $foo: a;# $foo.mangle(a());
So these --
mangle $foo:a;
mangle $foo : a;
are ambiguous and, as far as I can tell from the synopses, undefined.
So what's the rule: that indirect-object
Jonathan Lang schreef:
I'm not fond of the 'ox\soxen' idea; but I could get behind something
like '\sox oxen' or 'ox\sen'.
$n ox\s en
$n\sone multiple no cat\s s fight\s s s
;)
--
Affijn, Ruud
Gewoon is een tijger.
TSa schreef:
Brandon S. Allbery:
It occurs to me that this shouldn't be new keywords, but adverbs,
i.e. ``is :strict Dog''.
Great idea!
And it leaves room for ':stricter' and ':strictest'.
;)
--
Affijn, Ruud
Gewoon is een tijger.
TSa (Thomas Sandlaß) schreef:
Larry Wall:
Another potential issue is that CATCH doesn't distinguish exceptions
coming from the current block from those coming from the subcall to
a(). So it could end up returning Failure from the current block when
you intended to force return of Failure
47 matches
Mail list logo