Enhancing J file capabilities 
Author Message
 Enhancing J file capabilities

   Suppose I am writting an application with the following data:

   a =. 'Montana';'Simms';'Elway'
   b =. 'Tyler';'Metcalf';'Thomas'
   c =. 'Rice';'Lofton';'Duper'
   d =. 'Young';'Kreig';'Everett'

   With the verbs:

   append =. '((10{a.) ,~ 5!:3 <'''',y.,'''') 1!:3 < x.':11
   write =. '((10{a.) ,~ 5!:3 <'''',y.,'''') 1!:2 < x.':11

   Using the following instructions:

   'ftblplyrs' write 'a'

   'ftblplyrs' append 'b'

   'ftblplyrs' append 'c'

   So that:

   read 'ftblplyrs'
52xba 1 3 14c- 1 7 Montana12c- 1 5 Simms12c- 1 5 Elway
53xbb 1 3 12c- 1 5 Tyler14c- 1 7 Metcalf13c- 1 6 Thomas
50xbc 1 3 11c- 1 4 Rice13c- 1 6 Lofton12c- 1 5 Duper  

   Now, once this information is stored in the file, the user
   logs out and then back in again, and at this point is
   prompted for for a file name. In this instance he selects
   "ftblplyrs" so he can access and revise information in the file.

   Basically, I'd like to have a set of programs,
   perferably J verbs, which would let me write an
   application like I've described. That is,
   providing the file capabilities of Manugistics mainframe
   (and for what I know PC) APL.

   If (miraculously) anyone has a set of programs which does
   this and is willing to share it that would be great!

   As I imagine this is not the case, if I set out to program
   this myself, I'd like some pointers. Is the best
   way to approach it to write it C++? (If so, is there
   publically available application whose code I might reuse
   or study?) Or can I use existing J verbs, keying on
   the line feeds and appending an "erase to end of line" character
   after the end of each revision?   ( Obviously file
   locking capabilities would have to be coded in C++.)

   As an aside, can the "write", shown above be written
   so the noun variables do not have to be passed by name?

   Thanks!

   Emmett.



Thu, 01 Jun 1995 15:00:25 GMT  
 Enhancing J file capabilities
I received the following message addressing my post on J
file capabilities.  Since the message was posted through
an intermediary, it was suggested that I could respond
either via email or post.  Since I wouldn't want to
take too much of Mike Porter's time by having him
polish code on my part, I thought I'd post and hope
that other users would respond.  (The verbs were
described but not included in the message.)

Certainly the verbs described provide exactly the
capability I would find useful.

BTW, I understand Mike can browse comp.lang.apl but
at this point can not post.

Cheers, and thanks Mike,
Emmett

Quote:


>Newsgroups: comp.lang.apl

>I have just 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



Mon, 05 Jun 1995 07:12:41 GMT  
 Enhancing J file capabilities
Its *Mike Powell* thats looking into this.
I confused the name. (I regret the error.)

E.



Mon, 05 Jun 1995 10:27:57 GMT  
 Enhancing J file capabilities

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

no. 6839150 filed 16.56.53  thu 17 dec 1992

to   uclapl
subj Enhancing J file capabilities

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.



Tue, 06 Jun 1995 01:00:05 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. JS-EAI with *JS*-callback

2. js.exception 3279.js

3. J script file profile.js

4. Enhancing "ls -l" file listing abilities

5. Q: Python & Windows Enhanced Meta File (EMF)

6. Should the File Open dialog be enhanced?

7. Re : Topspeed File Capabilities

8. NB. gray.js: a J verb that generates a grayscale postscript image from a 2d array

9. lapackTest.js

10. profile.js

11. JS valueOf() in RB ?

12. JS for functional programming?

 

 
Powered by phpBB® Forum Software