Computer Science Canada Operands of Set Operators must be sets? |
Author: | Insectoid [ Fri Jul 04, 2008 9:06 am ] | ||
Post subject: | Operands of Set Operators must be sets? | ||
Erm, what does this mean? I get it when comparing a string to a part of a record that is a string. I am trying to make a database & search engine because I thought it would be fun. But I ran into a snag, as pointed out above. Here is my code so far (will be changing it to read stuff from a file later)
|
Author: | [Gandalf] [ Fri Jul 04, 2008 9:29 am ] | ||
Post subject: | RE:Operands of Set Operators must be sets? | ||
You're trying to use the in operator on a record (or actually, something even more misplaced, a string) when it only works on sets. You're basically using the in operator in a way it shouldn't be used, and for something it doesn't do. If I'm correct in assuming what you're looking for:
Should be the conditional statement. Note that this also takes care of another problem with your code... You're always checking for unitname in your procedure, which ruins the purpose of passing search as a parameter in the first place. |
Author: | Insectoid [ Fri Jul 04, 2008 10:13 am ] | ||
Post subject: | RE:Operands of Set Operators must be sets? | ||
Quote: You're trying to use the in operator on a record (or actually, something even more misplaced, a string) when it only works on sets. You're basically using the in operator in a way it shouldn't be used, and for something it doesn't do. I was actually trying to make it work for any string, so I wouldn't have to write a separate procedure for every search type, and forgot to change it back afterwords. I thought the 'in' operator was for strings...oops, thinking the wrong language, maybe that's for python...
Will this work for partial matches or only perfect matches? |
Author: | [Gandalf] [ Fri Jul 04, 2008 10:51 am ] | ||
Post subject: | Re: RE:Operands of Set Operators must be sets? | ||
insectoid @ 2008-07-04, 10:13 am wrote:
Will this work for partial matches or only perfect matches? It'll work for partial matches. That's the reason index() was used, instead of just checking for equality. |
Author: | Insectoid [ Fri Jul 04, 2008 9:09 pm ] |
Post subject: | RE:Operands of Set Operators must be sets? |
Oh, thank you, will use! |