在 2006/8/18 上午 3:31 時,Ben Morrow 寫到:
Just to make sure I've got all this straight:
=:= compares names
=== compares containers
eqv compares values
=:= evaluates both sides as lvalue -- that's VAR() -- and compare
them with ===.
=== evaluates both sides as rvalue and, for containe
Quoth [EMAIL PROTECTED] ("Mark J. Reed"):
> On 8/17/06, David Green <[EMAIL PROTECTED]> wrote:
> > >$a=[1, 2, [EMAIL PROTECTED];
> > >$c=[1, 2, [EMAIL PROTECTED];
> > >$d=[1, 2, [EMAIL PROTECTED];
> > >
> > >So $a, $c, and $d may all have the same *value*
> > >(or "snapshot", when eval
On Thu, Aug 17, 2006 at 12:00:17AM -0700, Darren Duncan wrote:
> As a lead-in, I should say that Synopsis 3 has a good and complete
> explanation of these matters and has had it for several weeks, in my
> opinion.
>
> Since you are wanting to compare two mutable Array, just use the eqv
> operat
David Green wrote:
No, look at the example I've been using. Two arrays (1, 2, [EMAIL PROTECTED]) and (1,
2, [EMAIL PROTECTED]) clearly have different (unevaluated) contents. "eqv" only tells
me whether they have the same value (when @x and @y are evaluated).
That's a different question --
On 8/17/06, David Green <[EMAIL PROTECTED]> wrote:
>$a=[1, 2, [EMAIL PROTECTED];
>$c=[1, 2, [EMAIL PROTECTED];
>$d=[1, 2, [EMAIL PROTECTED];
>
>So $a, $c, and $d may all have the same *value*
>(or "snapshot", when evaluated all the way down
>through nesting and references), i.e. they
On Thu, Aug 17, 2006 at 12:18:55PM -0600, David Green wrote:
: So perhaps what I'm looking for is more syntactic
: sugar for easily traversing nested data
: structures in different ways.
Quoth S03:
If that's not enough flexibility, there is also an C function
that can be passed addition
On 8/16/06, David Green wrote:
$a=[1, 2, [EMAIL PROTECTED];
$c=[1, 2, [EMAIL PROTECTED];
$d=[1, 2, [EMAIL PROTECTED];
$a =:= $c; #false, different variables
$a === $c; #true, same elements make up $a and $c
$a eqv $c; #true, same elements therefore
On 8/17/06, Darren Duncan wrote:
At 11:16 PM -0600 8/16/06, David Green wrote:
I just want [1,2] to be === to [1,2], or [1,2, [EMAIL PROTECTED] to be equal to
[1,2, [EMAIL PROTECTED] but !=== [1,2, [EMAIL PROTECTED] -- eqv won't work in the latter case
(regardless of Seq vs. Array -- I didn't t
On 8/17/06, Darren Duncan <[EMAIL PROTECTED]> wrote:
Generally speaking, the direct use of === is more for specialized
purposes, somewhat like the direct use of =:= is. If one can't tell
the difference between === and eqv, they most likely want snapshot
semantics anyway, and so might as well for
At 11:16 PM -0600 8/16/06, David Green wrote:
On 8/15/06, Darren Duncan wrote:
At 2:51 PM -0600 8/15/06, David Green wrote:
[...]
You are right, but we have both Seq and Array types, so depending
which one you use, you want either the === or eqv operators to do
what you want. There is no rea
On 8/16/06, David Green wrote:
$a=[1, 2, [EMAIL PROTECTED];
$c=[1, 2, [EMAIL PROTECTED];
$d=[1, 2, [EMAIL PROTECTED];
$a =:= $c; #false, different variables
$a === $c; #true, same elements make up $a and $c
$a eqv $c; #true, same elements therefore
] and $d doesn't.
Which is what makes sense to me, but S03 says "[1,2]!===[1,2]". My
position is that even if they are different "objects", that
difference is fairly useless, and should therefore be hidden (same as
it is for objects that are strings).
First of all, in
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 ;
>> $
On 8/16/06, Charles Bailey wrote:
This is where the "eternal" part starts to confuse me (not picking on
your wording, but on the semantics).
I'll pick on the wording (wording should always be picked on -- not
to be pedantic (OK, I like to be pedantic, but that's not the *only*
reason!), but b
On 8/16/06, Dr.Ruud wrote:
I also wondered why a "simple" array (for example containing only value
type objects) whould not C<===> its copy.
But with .SKID that must be easy to handle.
That's what I was wondering that started off this thread. I
understand (more or less, I think), why it *does
On Wed, Aug 16, 2006 at 04:25:13PM +0200, Dr.Ruud wrote:
: 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
"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.
>>>
>>
>> So "$x ===
On 8/16/06, Darren Duncan <[EMAIL PROTECTED]> wrote:
I'll try saying what I meant differently here:
The difference between === and eqv is that, if you have 2 symbols, $a
and $b, and $a === $b returns true, then that result is guaranteed to
be eternal if you don't assign to either symbol [or othe
On 8/16/06, Darren Duncan <[EMAIL PROTECTED]> wrote:
At 11:42 AM +0300 8/16/06, Markus Laire wrote:
>On 8/16/06, Darren Duncan <[EMAIL PROTECTED]> wrote:
>>The difference between === and eqv is that, if you have 2 symbols, $a
>>and $b, and $a === $b returns true, then that result is guaranteed to
On 8/16/06, Dr.Ruud <[EMAIL PROTECTED]> wrote:
"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.
>
So "$x ==
"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.
>
So "$x === Sy" stil holds.
--
Affijn, Ruud
"Gewoon is e
At 11:42 AM +0300 8/16/06, Markus Laire wrote:
On 8/16/06, Darren Duncan <[EMAIL PROTECTED]> wrote:
The difference between === and eqv is that, if you have 2 symbols, $a
and $b, and $a === $b returns true, then that result is guaranteed to
be eternal if you don't assign to either symbol afterwar
On 8/16/06, Darren Duncan <[EMAIL PROTECTED]> wrote:
Both the === and eqv operators test the actual values of 2
containers, but that their semantics differ in regards to mutable
containers. Given an immutable container/type, such as a number or
Str or Seq, both will always return true if the val
[1,2] only eqv [1,2] and
[1,2] generally !=== [1,2].
First of all, in Perl 6, there are no separate "arrays" and "array
refs"; we simply have the 'Array' type, which is treated as a lump on
its own.
More generally, there are no "reference" types in P
On 8/14/06, Smylers wrote:
David Green writes:
I guess my problem is that [1,2] *feels* like it should === [1,2].
You can explain that there's this mutable object stuff going on, and I
can follow that (sort of...), but it seems like an implementation
detail leaking out.
The currently defin
25 matches
Mail list logo