home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / fpc / source / p4_15bs.seq < prev    next >
Encoding:
Text File  |  1990-04-14  |  437 b   |  25 lines

  1. \ Balraj Sidhu   Set: 14D4
  2. \ Comp 462 - Forth
  3. \ Date: April 12, 1990
  4. \ Problem 4.15
  5.  
  6. create data 20 allot
  7.  
  8. : [in] ( i -- flag )
  9.         0 9 between ;
  10.  
  11. : message ( -- )
  12.         cr ." Array index out of range. " cr ;
  13.  
  14. : data@ ( i -- n )
  15.         dup [in] if 2* data + @
  16.              else message
  17.              then ;
  18.  
  19. : data! ( n i -- )
  20.         dup [in] if 2* data + !
  21.              else message
  22.              then ;
  23.  
  24.  
  25.