Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Collapsing repetitive equality tests: || vs {} vs // (an observation)

by blogical (Pilgrim)
on Feb 26, 2007 at 14:54 UTC ( [id://602134]=note: print w/replies, xml ) Need Help??


in reply to Re: Collapsing repetitive equality tests: || vs {} vs // (an observation)
in thread Collapsing repetitive equality tests: || vs {} vs // (an observation)

Feel free to drop a link to a reference to any, as I have no idea what you're referring to (sadly, I'm not hip to that Perl 6 jazz). grep, however, I can dig. It does make the test a bit large though.

On a tangent, it would be interesting to be able to ask for the value of $_ "x back" so that we could say something like grep { $_{0} eq $_{1} } qw( a b c ) or grep { $_ eq $_{1} } qw( a b c )

Replies are listed 'Best First'.
Re^3: Collapsing repetitive equality tests: || vs {} vs // (an observation)
by rhesa (Vicar) on Feb 26, 2007 at 15:06 UTC
    any can be found in List::MoreUtils.

    I was bored a while ago, and plugged both any and grep into ikegamis benchmark script. They're slow.

      There's also any() in List::Utils.

      ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

        There's also one in Perl6::Junction :)

        if (any(qw(A B C)) eq $foo) { print 'FOO' }

        Ordinary morality is for ordinary people. -- Aleister Crowley

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-25 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found