Good comments. > Basically, any use of ^: is problematic. That was intended and modeled on other languages with short circuit booleans (roughly, because we have conjunctions), where pass-though logic is used. Compare with JavaScript "ab" || "cd" ab "" || "cd" cd "" && "cd" // returns "" itself
!"ab" && "cd" // returns false<->!"" itself false !"" && "cd" cd But what about 0: and 1: in other forms? Well, it's sort of a mix. The main requirement is that it does not evaluate unnecessarily if decision made earlier. And it's done in shortest form. What could be used instead of ^: ? > One other minor problem with the wiki page is that it shows > boolean functions 16-31. It should rather use 0-15, since That's an interesting observation about 0-7 : 16-23 equivalence. But the rationale was a one stop reference table, and the 0-15 are trivially deducible from the 4-item binary list and tipically are not used in favor of direct *., +., etc. ----- Original Message ---- From: Mark D. Niemiec <[EMAIL PROTECTED]> To: [email protected] Sent: Friday, July 21, 2006 7:42:36 PM Subject: [Jgeneral] Re: Short Circuit Boolean Conjunction Oleg Kobchenko <[EMAIL PROTECTED]> wrote: > I was looking at Short Circuit Boolean conjunction expressions > and the adjacent binary operations table, and thought why > not have a conjunction-valued Boolean adverb, similar to > the verb-valued Boolean adverb. > Contrary to possible assumption, adverbs _can_ produce conjunctions. > 1 B NB. and / if > 2 : 'u^:v' I have discovered one error (that occurs in two places) in your table (here and in the Wiki page). Basically, any use of ^: is problematic. If v(y)=0, you want 'u*.v' to return 0 without evaluating u. However, in this case, rather than returning 0 (i.e. v(y)) it returns y itself. This is incorrect in general: u =: 1: v =: -. (u*.v) 1 0 (u^:v) 1 1 One other minor problem with the wiki page is that it shows boolean functions 16-31. It should rather use 0-15, since those apply to boolean values, whereas 16-31 perform the same operations on bits packed within an integer. While 16-23 can be used in places of 0-7 for boolean values, this is not the case for 24-31 vs. 9-15, since boolean NOT (-.) of 0 is 1, whereas binary NOT of 0 is _1. -- Mark D. Niemiec <[EMAIL PROTECTED]> ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
