home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.programming      Programming issues that transcend langua      57,431 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 56,771 of 57,431   
   Stefan Ram to Richard Heathfield   
   Re: A little puzzle.   
   14 Dec 22 15:43:25   
   
   From: ram@zedat.fu-berlin.de   
      
   Richard Heathfield  writes:   
   >On 14/12/2022 1:23 pm, Stefan Ram wrote:   
   >> Richard Heathfield  writes:   
   >>> Your problem is closely related to the very first question I was   
   >>> ever posed (in early 1982), by a friend who needed to be able to   
   >>> establish cleanly in a single expression whether a keypress was a   
   >>> digit (ASCII 48-57). The relevant dialect of BASIC didn't have   
   >>> anything like an isdigit function.   
   >>> The friend was on the point of giving up on me when I handed him   
   >>>                   ABS(K-52.5)<4.5   
   >>"K >= 48 AND K <= 57" also is a single expression in BASIC.   
   >The available keywords were LET, PRINT, END, FOR...NEXT, GOTO,   
   >GOSUB...RETURN, IF...THEN line number, DEF, READ, DATA, DIM, and   
   >REM. AND was not amongst them. Also available were these   
   >functions: ABS, ATN (arc tan), COS, EXP, INT, LOG, RND, SIN, SQR   
   >(root).   
      
     Sometimes, multiplication can be used for "AND".   
     I.e., "( K >= 48 )*( K <= 57 )".   
      
     Some BASIC dialects use "-1" for "True" and "0"   
     for "False", but accept any non-zero value for "True".   
      
     Pet 2001 transcript (emulator):   
      
   |LET K=50   
   |   
   |READY.   
   |IF( K >= 48 )*( K <= 57 )THEN PRINT "YES."   
   |YES.   
   |   
   |READY.   
      
     .   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca