home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / apl / 1247 < prev    next >
Encoding:
Text File  |  1992-12-18  |  2.3 KB  |  69 lines

  1. Newsgroups:   comp.lang.apl
  2. Path: sparky!uunet!utcsri!geac!itcyyz!yrloc!intern
  3. From:         pow@ipsa@ipsaint.ipsa.reuter.COM (Remote Addressee:)
  4. Subject:      Enhancing J file capabilities
  5. Message-ID: <1992Dec17.172751.20058@yrloc.ipsa.reuter.COM>
  6. Sender: intern@yrloc.ipsa.reuter.COM (Intern via QUADRAM)
  7. Reply-To:     pow@ipsa@ipsaint.ipsa.reuter.COM (Remote Addressee:)
  8. Organization: Reuters Information Services (Canada)
  9. Date:         17 Dec 92 17:00:05 UT
  10. Lines: 57
  11.  
  12.  
  13. -----------Message forwarded from IPSA Mailbox-------------
  14.  
  15.  
  16. no. 6839150 filed 16.56.53  thu 17 dec 1992
  17. from pow@ipsa
  18. to   uclapl
  19. subj Enhancing J file capabilities
  20.  
  21. @transferred from ipsa  no. 5452748 filed 16.56.43  thu 17 dec 1992
  22.  
  23. I have almost finished some J verbs to provide access to files by key
  24. value. These might be what you're looking for. Usage is as follows.
  25.  
  26. Create <'filename'         Creates a file and initializes its directory.
  27. (key;value)Put <'filename' Stores value in filename by key, any noun.
  28. key Get <'filename'        Returns value stored in filename under key.
  29. Dir <'filename'            Returns a directory showing the file's keys and
  30.                            where they are located in filename.
  31.  
  32.                            There will be a few other verbs, e.g. Find
  33.                            and Squeeze.
  34.  
  35. These verbs take care of growing replaces. If a Put is of a new key, the
  36. value is padded and appended to the end of the file. If the Put is of an
  37. existing key, it goes back in the existing slot, if it fits. If it doesn't
  38. fit, the value is padded and appended.
  39.  
  40. The representation of J objects in a file uses 5!:5. This means that keys
  41. can be more than the usual character strings. You can quite happily have
  42. i.4 10 as a key. Precision of representation depends entirely on 5!:5.
  43. Values are recreated with ". .
  44.  
  45. For your particular example, you could:
  46.  
  47. Create f=.<'NFL'
  48. Team=. whatever...
  49. ('Miami';Team)Put f
  50.  
  51. Then later,
  52.  
  53. Team =. 'Miami' Get f
  54. Team =. Team plus some new information
  55. ('Miami';Team)Put f
  56.  
  57. This is all a little fragile today, but if it's of interest, I'd be happy
  58. to improve it and make it available.
  59.  
  60. Mike Powell
  61.  
  62.  
  63.  
  64. -----------------------------------------------------------
  65. This posting is forwarded from an internal Reuters mailbox.
  66. No statement or opinion contained herein should be taken as
  67. being Reuters policy, or even as being approved by Reuters,
  68. in any way.
  69.