Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I still think its the former.
Given that
%data = << why dunno who them where there which this >>;
I would assume that writing *%data in any context is equivalent to writing
(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
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; }
Let me take another example and go back to part(). We could write:
my $fish = "hest"; ($sheep, $goats, $fish) := part Animal::Cat, @animals;
So the question here is, is $fish eq "hest" after this, or undef?
Alternatly we could have written
my $hest = "hest"; %result := ($sheep, $goats, fish => $hest) := part Animal::Cat, @anima +ls;
Would that give the same result?

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

In reply to Re: Re: Re: Re: Exegesis 6 - Named binding by Cine
in thread Exegesis 6 - Named binding by Cine

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-03-29 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found