Post Reply 
what is the easiest way to AND two lists?
11-06-2015, 10:31 PM
Post: #1
what is the easiest way to AND two lists?
I have a choose list of program options:
CHOOSE(CHS,"",{a list of menu choices})
for which I am implementing a HELP function.

Some of the menu options are so simple they need no help.
Or, at least, no help has yet been written.

I don't want to write
CHOOSE(CHS,"help",{just the ones with help written})
And keep needing to change that additional list.

Conceptually, what I am thinking of is something like
CHOOSE(CHS,"help",
{a list of menu choices: the same as for commands} AND { {True},{True},{Null},{True})
Where the null entry has the effect of eliminating the corresponding command text from the CHOOSE (but ideally leaving a blank entry, So that subsequent True entries are in the expected place).

I am wondering what the easiest way of doing this would be.

The obvious solution would involve a copied list, and a for loop either copying an item or not...
But I suspect some experts can suggest an easier syntax to achieve this.

Is there any simple syntax similar to
{"text1", "text2"} AND {false,true}
that would return
{""," text2"} ?

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
11-07-2015, 07:31 AM (This post was last modified: 11-07-2015 07:44 AM by Didier Lachieze.)
Post: #2
RE: what is the easiest way to AND two lists?
I don't know if it's the easiest way but :
L1:={"text1","text2"}
L2:={0,1}
EXECON("IFTE(&2,&1,CHAR(0))",L1,L2)
will return {"","text2")
Find all posts by this user
Quote this message in a reply
11-09-2015, 06:36 PM (This post was last modified: 11-09-2015 06:40 PM by StephenG1CMZ.)
Post: #3
RE: what is the easiest way to AND two lists?
Thanks for that Didier, that did the trick...

I liked the idea of having blank entries, so that you can use the same shortcuts as in the main menu - and the position doesn't keep changing as help pages get written.
But now that I have seen what that looks like... Keeping the same shortcuts is good in theory, but visually its not appealing with those blank entries.

I'm not sure now whether to stick with the blank entries, or whether it would be visually better to remove them completely. (My Z LIGHTS program demonstrates this...it is not useful for anything else).

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)