Do you know where your variables are? PerlMonks

### Re: Re: Re: Re: Useful uses of Quantum::Superpositions?

 on Apr 08, 2003 at 16:51 UTC ( #249002=note: print w/replies, xml ) Need Help??

Does this mean you could do something like any(1..10)+1; And if so, what does it do?
If I weren't at school, I'd try it myself.

feanor_269
• Comment on Re: Re: Re: Re: Useful uses of Quantum::Superpositions?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Useful uses of Quantum::Superpositions?
by diotalevi (Canon) on Apr 08, 2003 at 17:06 UTC

I have no idea what that would mean to transform a disjunction. Currently my universe extends only so far as to use logical operators. At least that is intuitive about what it means. Or rather - if you impose a booleanize that disjunction then it makes sense again. The boolean value of any(1..10)+1 would be true if any of the expressions 1+1,2+1...10+1 had a true value.

If you really meant to transform 1..10 then you'd just use a hyper operator but I don't know what that operator looks like anymore so I can't write it.

Re: Re: Re: Re: Re: Useful uses of Quantum::Superpositions?
by Mr. Muskrat (Canon) on Apr 08, 2003 at 17:17 UTC
It will be the same as saying any(2..11).
You mean it'll DWIM? Cool... still not sure it's that useful tho...

feanor_269

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;

That depends on what you mean ;-)

Create A New User
Node Status?
node history
Node Type: note [id://249002]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2020-11-30 23:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?