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

Re: Perl6 Cookbook

by fishbot_v2 (Chaplain)
on Apr 11, 2005 at 18:44 UTC ( [id://446720]=note: print w/replies, xml ) Need Help??


in reply to Perl6 Cookbook

Perhaps this is -too- idiomatic, but for recipe 04-08 (You want to find elements in one array but not in another):

@aonly = gather { take when none(@b) for @a; };

Though if when is considered a statement modifier in this case, and if you can't combine statement modifiers in p6 (much as you cannot in p5), then that likely doesn't work. In that case:

@aonly = gather { for @a { take when none(@b) }};

For numeric @a, and $_ will these be equivalent:

( $_ == none( @a ) ) && say "foo"; ( $_ ~~ none( @a ) ) && say "foo";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-03-28 11:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found