Modified | DDT |>| FRI.FEB,010216,20:37-4 | CoSy/Home ; CoSy/Current         ?Wha?  CoSy Comment Comments         BobA-In-Y2K.org © Bob Armstrong .

CoSy/Language/Booleans
 From  comp.lang.apl 

  ============================: SAT.DEC,971213 :============================
    From: Mike Kent             97/11/25 02:47
 Subject:         STSC "Boolean techniques" booklet?
Some time back when I worked for STSC, they had a little booklet by Bob
Smith with a title rather like "Boolean techniques".  I can't find mine
anywhere, and would very much appreciate a dogeared or photocopied
instance ...
//   Mike ......   mkent ((at)) acm [[dot]] org

 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

    From: apter@webtv.net (stevan apter)                   97/11/29 11:53
 Subject:         Re: STSC "Boolean techniques" booklet?
  Re mkr's comment:
No, we don't seem to use boolean vectors much in K, except as an
intermediate result.  Index vectors, and operations on them, are much
more common.

(~=)\, however, for finding quoted substrings, is probably an immortal
 idiom.
sa

 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

    From: randy@godin.on.ca (Randy MacDonald)             97/12/04 09:20
 Subject:         Re: STSC "Boolean techniques" booklet?
(stevan apter) wrote:
>No, we don't seem to use boolean vectors much in K, except as an
>intermediate result.  Index vectors, and operations on them, are much
>more common.
 Let's see:
  Suppose F is a function that returns booleans, and works on elements so
 that:
   (F X)/X
 doesn't give length errors. Also suppose that "I" is a function that returns
 the index set of X, so that:
   X <--> X[I X]  -- in APL
   X <--> (I X) { X  -- in J
 are you suggesting that an expression like:
   X[(F X)/I x]
 is (and should be?) more common than
    (F X) / X
--
|\/| Randy A MacDonald       | Bring me... BLUE PAGES!!!!
|\\| randy@godin.on.ca       |
     BSc(Math) UNBF '83      | APL: If you can say it, it's done.
     Natural Born APL'er     | *** GLi Info: info@godin.on.ca ***
                             | Also http://www.godin.on.ca/randy
 
 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

    From:         Bob Armstrong                 97/12/09 11:22
 Subject:         Re: STSC "Boolean techniques" booklet?

 The abstraction of the essence of a problem into boolean images ( bit maps )
 is one of the core brilliances of APL .
 ( cf : http://www.cosy.com/cosy/cal97/apl97ad.htm )

 Any general purpose language must be facile at their manipulation .

 FORTH`s definition of TRUE as -1 dooms it to inefficiency at a fundamental
 level .
-- BobA --  http://CoSy.com

 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

    From:       "ElizabethD.Rather"      97/12/09 12:40
 Subject:        Re: STSC "Boolean techniques" booklet?
 Bob Armstrong wrote:
> FORTH`s definition of TRUE as  -1  dooms it to inefficiency
> at a fundamental level .

 I hope you aren't forgetting that _any_ non-zero value will be treated as
 'true' by IF, UNTIL, WHILE, etc.; TRUE just returns a convenient
 "well-formed" flag. We have frequently used defining words to name
 individual bits to be used as flags, a technique that this convention
 enables.
Cheers,        Elizabeth
===============================================
Elizabeth D. Rather  (US & Canada) 800-55-FORTH
FORTH Inc.                      +1 310-372-8493
111 N. Sepulveda Blvd.     Fax: +1 310-318-7130
Manhattan Beach, CA 90266
http://www.forth.com
"Forth-based products and Services for real-time
applications since 1973."
===============================================

 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

    From:     rrt1001@cus.cam.ac.uk (ReubenThomas)           97/12/09 18:16
 Subject:     Re: STSC "Boolean techniques" booklet?
 In article <348D7030.21B2963@cosy.com>, Bob Armstrong   wrote:
>The abstraction of the essence of a problem
>into boolean images ( bit maps ) is one of the core
>brilliances of  APL  .

 Possibly.

>Any general purpose language must be facile at their
>manipulation .

 Probably.

>FORTH`s definition of TRUE as  -1  dooms it to inefficiency
>at a fundamental level .

 Rubbish. Forth accepts all non-zero values as true, and defining TRUE as
-1 is crucial for bitwise operations. If you want to use bitmaps with
individual bits representing different values then you need to write words
to manipulate them in Forth: this essentially is inventing a boolean data
type along with boolean operations (BAND, BOR, BXOR BINVERT?) instead of
the bitwise logical operations used by AND, OR, XOR and INVERT, which,
while they work if used with TRUE and FALSE representing boolean true and
false, are actually designed for a much wider range of applications.
The difference between Forth and APL here is that APL can deal with
bitmasks by using vectors of booleans, whereas Forth, for reasons of
simplicity, uses only one basic datatype, the cell, so bit strings are
naturally cell-wide, and individual bits are harder to access.

I think it's easier to make a case for APL being fundamentally doomed to
inefficiency by having arrays as a basic type, without having sufficiently
strong datatyping to regain efficiency.
--
http://www.cl.cam.ac.uk/users/rrt1001/ | maxim, n.  wisdom for fools

 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

    From:        Ron Kneusel                97/12/10 10:15
 Subject:        Re: STSC "Boolean techniques" booklet?
 Bob Armstrong wrote:
> FORTH`s definition of TRUE as  -1  dooms it to inefficiency
> at a fundamental level .
 The nice thing about Forth is that you can create it in your own image,
 so to speak.  Not all Forth systems use -1 as TRUE.
- Ron Kneusel
  rkneusel@mcw.edu

 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

    From:     wtanksle@sdcc10.ucsd.edu (William Tanksley)     97/12/11 16:42
 Subject:     Re: STSC "Boolean techniques" booklet?
 In article <348D7030.21B2963@cosy.com> bob@cosy.com writes:
>The abstraction of the essence of a problem
>into boolean images ( bit maps ) is one of the core
>brilliances of  APL  .

 Hmm. I thought it was useful, but not particularly so. But then I can't read
 APL that well yet; give me some time... :-)

>Any general purpose language must be facile at their
>manipulation .

 True.

>FORTH`s definition of TRUE as  -1  dooms it to inefficiency
>at a fundamental level .
 Forth defines TRUE as all bits set, not -1.  It dooms it to the greatest
 possible efficiency -- you can elmininate a large class of decisions by
 using a bitwise AND to produce either a zero or the desired number.
 For example:

( before )
( truth value ) IF 5 ELSE 0 THEN
( after )
( truth value ) 5 AND

 Of course, that assumes that the truth value is actually 0 or TRUE. If
 you're not certain, you should put a "0<>" first to reduce it to actual
 logic.
 You can't do that with TRUE defined as one.  By the way, "all bits set" in
 a one-bit-long quantity is TRUE by the Forth definition.

 Do I misread you?

-Billy

 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

    From:     kc5tja@topaz.axisinternet.com (KC5TJA)          97/12/11 17:39
 Subject:     Re: STSC "Boolean techniques" booklet?
 Bob Armstrong wrote:
>The abstraction of the essence of a problem
>into boolean images ( bit maps ) is one of the core
>brilliances of  APL  .
>( cf : http://www.cosy.com/cosy/cal97/apl97ad.htm )

 Do I smell a bit of 'flame-bait' here?

>Any general purpose language must be facile at their
>manipulation .
 What?  You're not making sense.
>FORTH`s definition of TRUE as  -1  dooms it to inefficiency
>at a fundamental level .

 What?  FORTH's use of TRUE as -1 makes it far more efficient at testing than
 C.  Furthermore, boolean decision operations only test for equality to, or
 inequallity to , zero.  It does *NOT* check explicitely for -1.
 ==========================================================================
                            -| TEAM_DOLPHIN |-
                    Chief Architect and Project Founder
                       (web page under construction)
                 PGP 5.0 Public Key Available Upon Request.

  ננננננננננננננננננננננננננננננננננננננננננננננננננננננננננננננננננננננננננ

 SAT.DEC,971213,14:19-5
   In article <348D7030.21B2963@cosy.com>  I ( bob@cosy.com ) wrote:
>FORTH`s definition of TRUE as  -1  dooms it to inefficiency
>at a fundamental level .

  Let me deal with some of the responses in a pedagogical  order :

   kc5tja@topaz.axisinternet.com  -| TEAM_DOLPHIN |-  writes :
> Do I smell a bit of 'flame-bait' here?

 I figured if I rubbed the 2 languages together I might generate a little
 light .

   (Reuben Thomas) writes :
> I think it's easier to make a case for APL being fundamentally doomed to
> inefficiency by having arrays as a basic type, without having sufficiently
> strong datatyping to regain efficiency.

 Rubbish . I`ll leave it to others on the ArrayPL side to affirm that this
 is just plain wrong . Arthur Whitney after demonstrating almost instant
 operations on 10+8 ( 10E8 ) record data bases ( on Suns ) , replied to the
 question of efficiency relative to C that you might match K if you had
 perfect C programmers .

 That`s the point . Generically operations must be done on collections .
 The more immediately one recognizes this , and builds language to facilitate
 it , the more efficient for both the programmer and the machine .
 You see this in the incorporation of pipelining and vector ops in processors
 ( eg : the 'times' repeat-instruction counter in ChuckMoore`s Novix chip ) ,
 and the many tentative unfocused reinventions of the truths of APL I have
 seen around the FORTH community .

> If you want to use bitmaps with individual bits representing different
> values you need to write words to manipulate them in Forth: this
> essentially is inventing a boolean data type along with boolean operations
> (BAND, BOR, BXOR BINVERT?) instead of the bitwise logical operations used
> by AND, OR, XOR and INVERT,
 Seems to me the standard bitwize words ( looking @ Win32Forth ) are fine .

  wtanksle@sdcc10.ucsd.edu (William Tanksley)  -Billy  writes :
> Forth defines TRUE as all bits set, not -1.
 Yep , but it`s been a long time since I worked on a 1s complement machine .

> ( 0 or TRUE ) 5  AND
 Returns 5 or 0 . Thanks for giving me the rational . I`m not arguing that
 having " all 1s " around as a constant isn`t useful ( I think that must be
 TEAM_DOLPHIN `s point ) , even that this scalar vocabulary isn`t useful ,
 but the mindset it induces must be exceeded .

> "all bits set" in a one-bit-long quantity is TRUE by the Forth definition.
 Exactly . but a "cell" in , eg : Win32Forth ,  is a word  is 32 bits .
 1 bit suffices for the logic , the other 31 should be available for the
 next 31 dimensions of the problem . And you need words for general use which
 extend to arbitrary length objects .

   "ElizabethD.Rather" writes :
> We have frequently used defining words to name individual bits to be used
> as flags, a technique that this convention enables.
 Have you created any vocabulary which extends to arbitary length vectors so
 you can efficiently do the equivalent of  | + / Space = TEXT |  to count the
 number of words in what you are writing ?
 In APL , Larry Breed solved these problems in the `60s -- and they have been
 optimized long since .

 Cheers , --  BobA --  http://CoSy.com
Continued in CoSy/Language/Booleans971222


 CoSy NoteComputing Environment & Language ;
CoSy The
NoteComputer
 Current , WallSt , MotorBoard , Art
Feedback :
bob@cosy.com
NB : I reserve the right to post all communications I receive or generate to CoSy website for further reflection .