in reply to Re: Re: Re: Exegesis 6 - Named binding
in thread Exegesis 6 - Named binding
I still think its the former.
Given that
Alternatly we could have written
Update: Forgot the multi keyword
Update: As broquaint pointed out below, I forgot to use the binding operator as I indented to...
Update: And the second example is completly bogus, because it would endeed result in a compile time error. Was
T I M T O W T D I
Given that
I would assume that writing *%data in any context is equivalent to writing%data = << why dunno who them where there which this >>;
So assuming we can use this as an lvalue, an assignment with a list of pairs to this would be the same as taking each pair and assigning it to the value with the specific key. So *%data = *%values should be compiled as(why => "dunno", who => "them", where => "there", which => "this")
Let me take another example and go back to part(). We could write:multi sub infix:=(List of Pair @assign is rw, List of Pair @values) re +turns List of Pair { my %assign := *@assign; for @values { %assign{.key} = .value; } return *%assign; }
So the question here is, is $fish eq "hest" after this, or undef?my $fish = "hest"; ($sheep, $goats, $fish) := part Animal::Cat, @animals;
Alternatly we could have written
Would that give the same result?my $hest = "hest"; %result := ($sheep, $goats, fish => $hest) := part Animal::Cat, @anima +ls;
Update: Forgot the multi keyword
Update: As broquaint pointed out below, I forgot to use the binding operator as I indented to...
Update: And the second example is completly bogus, because it would endeed result in a compile time error. Was
($sheep, $goats, $fish => "hest") := part Animal::Cat, @animals;
T I M T O W T D I
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Re: Exegesis 6 - Named binding
by broquaint (Abbot) on Jul 31, 2003 at 14:29 UTC |
In Section
Seekers of Perl Wisdom