What Do We Need?

What Do We Need?

PostPosted by forummaster » Thu Jan 15, 2009 4:20 pm

Certainly we need some way to talk with the outside world. External files are just one aspect of this. How should we communicate — individual system functions, shared variables, ...?

forummaster
 
Posts: 555
Joined: Wed Jan 23, 2013 1:00 pm

file access

PostPosted by dhdurgee » Thu Feb 05, 2009 4:23 pm

A good starting point would be the APL2 file functions, ∆fm, ∆fv and ∆file to work with native text files. Beyond that the 12 ⎕NA mapping of files onto variables would be good to handle files you would not want to manifest in the workspace and for APL variable data as well. I would suspect this interface could also be adapted to address other file types with appropriate arguments.


Beyond that I would suspect an interface to databases would probably be a good idea. Of course coming from an STSC/IPSA background I would also find the APL file machine with the usual FTIE/FREAD/etc ⎕ functions. Of course APL files in a single user system are of limited utility beyond that which could be managed via the 12 ⎕NA function. I suspect, with a little thought, they could be emulated on a file mapped to a variable. This might be a possibility for the "magic functions" you mention in another thread.


These are just the first thoughts off the top of my head.


Dave

dhdurgee
 
Posts: 5
Joined: Fri May 16, 2008 2:16 pm

What Do We Need?

PostPosted by forummaster » Sat Feb 14, 2009 6:02 pm

What about a design based upon Namespaces such as in Dyalog APL?


For example, for native files we could use something like


fh←#.⎕file.open "C:autoexec.bat" "rw" ⍝ To open the file for Reading and Writing
a←fh.data[...] ⍝ To read from the file
fh.data[...]←... ⍝ To write into the file

with other methods and properties of the file handle to (say) lock/unlock portions of the file, read its size, resize it, close it, delete it, etc.


This design has the advantage of not introducing a large number of system functions into the lexicon, and instead using methods and properties to invoke the desired operations. We're going to need to implement namespaces and classes eventually, so let's use them to design our interfaces to the outside world.

forummaster
 
Posts: 555
Joined: Wed Jan 23, 2013 1:00 pm

What Do We Need?

PostPosted by dhdurgee » Mon Feb 16, 2009 1:44 pm

Do you find that simpler than the AP 12 approach used to map files to variables in APL2? For example, if I enter the following in APL2 for OS/2:

('FR' 'E:CONFIG.SYS' '') 12 ⎕NA 'CONFIG'

I have the variable CONFIG mapped as a vector of character vectors with each line of my CONFIG.SYS file mapped to the appropriate element of the vector.
With the particular argument given above I am accessing the file read-only, but read-write access is also available with restrictions. There are also restrictions on which APL2
primitives can operate on such variables, but it is a handy approach for working with text based files.

I would also think it would be interesting to map a database table as either a vector of columns or a matrix of data.
dhdurgee
 
Posts: 5
Joined: Fri May 16, 2008 2:16 pm

What Do We Need?

PostPosted by forummaster » Mon Feb 16, 2009 2:33 pm

{10.42}dhdurgee wrote:
{10.42}dhdurgee wrote:
Do you find that simpler than the AP 12 approach used to map files to variables in APL2? For example, if I enter the following in APL2 for OS/2:

('FR' 'E:CONFIG.SYS' '') 12 ⎕NA 'CONFIG'

I have the variable CONFIG mapped as a vector of character vectors with each line of my CONFIG.SYS file mapped to the appropriate element of the vector.
With the particular argument given above I am accessing the file read-only, but read-write access is also available with restrictions. There are also restrictions on which APL2
primitives can operate on such variables, but it is a handy approach for working with text based files.

I would also think it would be interesting to map a database table as either a vector of columns or a matrix of data.


That approach may work well for the limited purpose of mapping a file to a variable, however, I'm trying to address a more general question which includes all of the other things one wants to do to/with an external file, as well as the more general topic of communication with external data -- which is where namespaces etc. really shine.


Moreover, to address your specific point, we could define a property of


fh.map←'CONFIG'


or a method of


fh.map 'CONFIG'


along with fh.unmap or ⎕ex 'CONFIG' to unmap the var.

forummaster
 
Posts: 555
Joined: Wed Jan 23, 2013 1:00 pm

What Do We Need?

PostPosted by acam » Tue Oct 27, 2009 1:30 pm

Am I right that at present there is no file access?

If so maybe the quickest/easiest way to give universal access to files would be something like Paul Chapman's DFILE system (a narrow file access to single file at a time).

I don't know how available the I-APL Instruction Manual is (where pages 25-29 give a complete specification and examples!). I'm pretty sure that the original text is on a BBC microcomputer disk. It would be easier to type it in again than resurrect such a machine. Are you interested?

Anthony Camacho
acam
 
Posts: 1
Joined: Tue Oct 27, 2009 12:51 pm

What Do We Need?

PostPosted by forummaster » Wed Oct 28, 2009 9:44 am

{10.114}acam wrote:
{10.114}acam wrote:
Am I right that at present there is no file access?

If so maybe the quickest/easiest way to give universal access to files would be something like Paul Chapman's DFILE system (a narrow file access to single file at a time).

I don't know how available the I-APL Instruction Manual is (where pages 25-29 give a complete specification and examples!). I'm pretty sure that the original text is on a BBC microcomputer disk. It would be easier to type it in again than resurrect such a machine. Are you interested?

At present, there is no external communication at all, file or otherwise. I'm interested in all ideas, but at the moment, I'm about to rip out the statement parser and replace it with a syntax analyzer. That'll take a while, so I won't be doing anything with file access until that's over.

Tell me more about DFILE.
forummaster
 
Posts: 555
Joined: Wed Jan 23, 2013 1:00 pm

File Access

PostPosted by Emanuel » Fri Dec 18, 2009 2:42 pm

{10.10}forummaster wrote:
{10.10}forummaster wrote:
Certainly we need some way to talk with the outside world. External files are just one aspect of this. How should we communicate — individual system functions, shared variables, ...?


Indeed we need such a facility.
Of course I will suggest yet another approach as it seems that everyone have his favorite. I regard the set of the system functions as implemented by APLX (NTIE, NREAD, NWRITE, ...) to be the most starightforawrd and clear (page 106 of the Learning APL with APLX manual). To which I would add READLN and WRITELN in order to get a line at a time rather then full files transfer.


Emanuel.

Emanuel
 
Posts: 1
Joined: Fri Dec 18, 2009 2:28 pm

What Do We Need?

PostPosted by Dick Bowman » Mon Oct 31, 2011 9:39 am

Just refreshed and updated after time away - pleased to see that the core of NARS2000 is evolving, but I am frustrated.

I would like to do "something" using NARS2000, in order for it to be meaningful I'd like for the "something" to be able to grab data out of the networkful of files and databases that I have to hand.

I can handle whatever reformatting is needed to turn what I have into simple character/binary files - that's not a problem. But I do not have the skillset to write whatever might be needed to get that data over the fence and into NARS2000.

So I'm with "blake" on the other thread - please could somebody with the skillset to write a set of very rudimentary file read/write functions (I guess) offer their services. It doesn't have to be optimal/universal/anything - that I believe will follow as and when there are lots of people using NARS2000 to explore data. For me, for now, I'd be happy with something which would just treat a character file as a vector ("read the file" means "give me a vector of all the characters including newlines and so forth").

Or - as I haven't yet refreshed my reading of the documentation - point me at a page that tells me what I need to know.

Thanks for your patience.
Dick Bowman
 
Posts: 4
Joined: Wed Jan 28, 2009 3:44 am

What Do We Need?

PostPosted by forummaster » Tue Dec 13, 2011 10:25 pm

{10.298}Dick Bowman wrote:
{10.298}Dick Bowman wrote:
Just refreshed and updated after time away - pleased to see that the core of NARS2000 is evolving, but I am frustrated.

I would like to do "something" using NARS2000, in order for it to be meaningful I'd like for the "something" to be able to grab data out of the networkful of files and databases that I have to hand.

I can handle whatever reformatting is needed to turn what I have into simple character/binary files - that's not a problem. But I do not have the skillset to write whatever might be needed to get that data over the fence and into NARS2000.

So I'm with "blake" on the other thread - please could somebody with the skillset to write a set of very rudimentary file read/write functions (I guess) offer their services. It doesn't have to be optimal/universal/anything - that I believe will follow as and when there are lots of people using NARS2000 to explore data. For me, for now, I'd be happy with something which would just treat a character file as a vector ("read the file" means "give me a vector of all the characters including newlines and so forth").

Or - as I haven't yet refreshed my reading of the documentation - point me at a page that tells me what I need to know.

Thanks for your patience.

You are right. I had put off that topic until I could do something like #.Files.create... But I see that'll take too long. Will a set of native file quad functions do, as in ⎕NCREATE, etc.?
forummaster
 
Posts: 555
Joined: Wed Jan 23, 2013 1:00 pm

Next

Return to File Systems

Who is online

Users browsing this forum: No registered users and 1 guest

cron