Indeed C handles booleans as 0 and 1 (actually more like 0 and nonzero). What make the difference for J and APL are 1 and 2 below:
0. Boolean functions have value 0 and 1 rather than true and false. 1. Functions apply to entire arrays, as in, for example, +/x>100 to compute the number of elements of vector x greater than 100. 2. A simple function precedence (“right to left”). Not having 0 leaves you out of this conversation. Having in addition 1 and 2 make for a winning combination. On Thu, Oct 23, 2014 at 3:37 PM, Jon Hough <[email protected]> wrote: > Doesn't J handle booleans the same as C, i.e. 0,1? > If not, how do APL/J handle booleans? > > --- Original Message --- > > From: "Devon McCormick" <[email protected]> > Sent: October 24, 2014 2:30 AM > To: "Chat forum" <[email protected]> > Subject: [Jchat] Characterizing how J and other APLs handle Booleans > distinctly from most languages > > Hi - > > While looking at the Wikipedia entry on "Boolean data type" recently, I > noticed that the APL family is - as usual - unrepresented. Since I was > looking here because of the maddening arbitrariness with which Booleans are > handled in other languages, it occurs to me that the much cleverer handling > of Booleans characteristic of the APL world should be given a higher > profile. > > So, any ideas on a Wikipedia entry for "APL, J" handling of Booleans? > > Thanks, > > Devon > > -- > Devon McCormick, CFA > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
