in reply to Re: Re: Re: Re: Re: Re: Useful uses of Quantum::Superpositions?
in thread Useful uses of Quantum::Superpositions?

Sure its useful. Over at id:249381 I had to create a short function indexany() for use in the grep. If @searchCriteria were actually a disjunction then this code doesn't require the new function anymore.

# Without disjunctions sub indexany { -1 != index $_, $_[0] and return 1 for @_[1 .. $#_]; re +turn 0 } @newArray = grep indexany($_, @searchCriteria), @largeArray # With disjunctions $searchCriteria = any( @searchCriteria); @newArray = grep -1 != index($_, $searchCriteria), @largeArray;
  • Comment on Re: Re: Re: Re: Re: Re: Re: Useful uses of Quantum::Superpositions?
  • Download Code