Not really - in C, true is 0 and false is anything else.
The main thing I'm getting at is the stupid insistence on "strong-typing"
for its supposed advantages. What started me on this whole thread was
having to write some Pascal code where I wanted to print the value of a
Boolean, but can't, so I have to resort to crap like this:
OobPrn := 'F';
if isOob then OobPrn := 'T';
println("Out-of-bounds: '+OobPrn);
where "isOob" is a Boolean and "OobPrn" is a "shortstring".
Compare this awkwardness to the simple elegance of Roger's example - where
the "Boolean" 0s and 1s are treated like regular numbers when needed - or
to the J extension of "+." and "*.". These mean "or" and "and", when used
w/0s and 1s, but LCM (least common multiple) and GCD (greatest common
denominator) when used with integers in general - which give the same
answers when used w/0s and 1s whether you think you're doing LCM and GCD or
"or" and "and".
And I've got a start on my Wikipedia entry....
On Thu, Oct 23, 2014 at 6: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
>
--
Devon McCormick, CFA
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm