Newsgroups:   comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!cs.utexas.edu!uunet!utcsri!geac!itcyyz!yrloc!intern
From:         pow@ipsa@ipsaint.ipsa.reuter.COM (Remote Addressee:)
Subject:      Enhancing J file capabilities
Message-ID: <1992Dec17.172751.20058@yrloc.ipsa.reuter.COM>
Sender: intern@yrloc.ipsa.reuter.COM (Intern via QUADRAM)
Reply-To:     pow@ipsa@ipsaint.ipsa.reuter.COM (Remote Addressee:)
Organization: Reuters Information Services (Canada)
Date:         17 Dec 92 17:00:05 UT
Lines: 57


-----------Message forwarded from IPSA Mailbox-------------


no. 6839150 filed 16.56.53  thu 17 dec 1992
from pow@ipsa
to   uclapl
subj Enhancing J file capabilities

@transferred from ipsa  no. 5452748 filed 16.56.43  thu 17 dec 1992

I have almost finished some J verbs to provide access to files by key
value. These might be what you're looking for. Usage is as follows.

Create <'filename'         Creates a file and initializes its directory.
(key;value)Put <'filename' Stores value in filename by key, any noun.
key Get <'filename'        Returns value stored in filename under key.
Dir <'filename'            Returns a directory showing the file's keys and
                           where they are located in filename.

                           There will be a few other verbs, e.g. Find
                           and Squeeze.

These verbs take care of growing replaces. If a Put is of a new key, the
value is padded and appended to the end of the file. If the Put is of an
existing key, it goes back in the existing slot, if it fits. If it doesn't
fit, the value is padded and appended.

The representation of J objects in a file uses 5!:5. This means that keys
can be more than the usual character strings. You can quite happily have
i.4 10 as a key. Precision of representation depends entirely on 5!:5.
Values are recreated with ". .

For your particular example, you could:

Create f=.<'NFL'
Team=. whatever...
('Miami';Team)Put f

Then later,

Team =. 'Miami' Get f
Team =. Team plus some new information
('Miami';Team)Put f

This is all a little fragile today, but if it's of interest, I'd be happy
to improve it and make it available.

Mike Powell



-----------------------------------------------------------
This posting is forwarded from an internal Reuters mailbox.
No statement or opinion contained herein should be taken as
being Reuters policy, or even as being approved by Reuters,
in any way.
