e. is like exists in mathematics. rtn=:'YES';'NO';'MAYBE' rtn +---+--+-----+ |YES|NO|MAYBE| +---+--+-----+ rtn e. <'NO' 0 1 0 (<'NO') e. rtn 1
Your expression (first) asks if each atom of rtn exists in <'NO'. Which the second atom of rtn does. The first and third do not. I think that what you really want is the second expression which asks if <'NO' exists anywhere in rtn. Have you looked up e. in the dictionary? Lots of information there. In J it is not really necessary to do I/O all over the place to see what's going on. Don't try to do something big at first. Avoid comparing J to other languages. It can slow your understanding of J down. Play a little. On Wed, Mar 24, 2010 at 11:59 AM, Sprague, Webb (OFM) < [email protected]> wrote: > > rtn e. <'NO' > > > > will check each atom of rtn to see if the atom is > > <'NO' > > and if there are no atoms in rtn, or if the first one is <'NO', > > the test will be declared true. > > In the languages I am familiar with there would need to be an "==" or > some such in there. Is "element of" like a Boolean? > > > load 'printf' NB. Do this just once per session > > > > 'return value: %s' printf <rtn > > I will try it. > > Note to the people talking about console output -- the issue is that I > need to run a script (~1000 lines) and check the input and output at > various places, and at some point I will need to add file I/O to the > script, so this is also a baby step toward that. Plus, learning file > I/O is one of the steps to getting my bearings in a new language. > > Thx > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
