I believe the answer would be: map boolean false to zero, boolean true to one, and sum the result.
My question would be: why is boolean being treated as equivalent to bit? -- Raul On Thu, Dec 15, 2011 at 5:45 PM, Roger Hui <[email protected]> wrote: > http://keiapl.org/anec/#implementers2 > http://keiapl.org/anec/#Maple > > I believe it's a computer science thing where true and false are preferred > over 1 and 0. You can ask them how they would solve the problem in the > second anecdote above. > > > > On Thu, Dec 15, 2011 at 2:39 PM, Tracy Harms <[email protected]> wrote: > >> DWL, >> >> Alas, your review is not to be found there. At least, I couldn't find it. >> >> Last time I got into a discussion about the advantages I experience in >> having Booleans be numeric, I encountered unwavering disagreement from >> everybody who wasn't already an array programmer. >> >> --Tracy >> >> On Wed, Dec 14, 2011 at 5:19 PM, David Ward Lambert >> <[email protected]>wrote: >> >> > I reviewed NumPy 1.5, Beginner's Guide, posted at barnesandnoble dot >> > com. While Roger emphasized operations on groups of data, the book >> > glossed over this greatest benefit of numpy. Nor did the author realize >> > the possibility to interpret Booleans as numbers for direct computation. >> > I showed him how to convert an if statement within a loop to a single >> > expression. >> > >> > >> ---------------------------------------------------------------------- >> 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
