Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: [Perl 6] Problem with multi methods

by blazar (Canon)
on Jul 23, 2007 at 17:55 UTC ( [id://628285]=note: print w/replies, xml ) Need Help??


in reply to Re: [Perl 6] Problem with multi methods
in thread [Perl 6] Problem with multi methods

Are you sure none(self) does what you want? I'm not sure it automatically flattens the array contents.

No, I'm not really sure: actually $Larry wrote unless any(self). I gathered my version would have been the same and actually it appears to work for one method. I reverted to $Larry's choice, but it doesn't seem to make a difference:

pugs> my @array does role { ....> multi method insert ($x) { @.push($x) unless any(self) eqv $x } ....> multi method insert (@x) { @.insert($_) for @x } ....> } = 1..5; pugs> @array.insert($_) for 2..6; pugs> say @array 123456 Bool::True pugs> @array.insert(3..7); pugs> say @array 12345634567 Bool::True

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://628285]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found