]OUT and ]IN Experiences?

How to move APL code to Dyalog

]OUT and ]IN Experiences?

Postby Dick Bowman on Tue Nov 01, 2011 12:04 pm

I'm not sure whether this should go to Support, but let's first assume that I'm making a DOLT ERROR...

I would like to export some code from Dyalog (13.0 - 64-bit - Unicode) to NARS2000, looks like .ATF files should be the common lingo. I can handle all those issues of language incompatibility, won't fix and so forth - would be happy to get the bare bones of some code across.

So there are four routes for the code to take...

0⊃ Trivial case NARS2000 to NARS2000
This works, I go )OUT filename, then )CLEAR, then )IN filename.
1⊃ NARS2000 to Dyalog
This also works, I go )OUT filename, switch to Dyalog, then ]IN filename (Dyalog chatters to me, tells me there are problems, but the essential code arrives.
But, of course - as of today I haven't written anything in NARS2000 that I want to transfer
2⊃ Dyalog to NARS2000
This crashes NARS2000 (sequence is ]OUT filename, switch to NARS2000, )IN filename, crash (nothing arrives)
Other people have reported similar crashes with NARS2000 and I'd like to send them a bug report

So (and this is the weird one)...

3⊃ Trivial (ought to be) case Dyalog to Dyalog
I go ]OUT filename, then )CLEAR, then ]IN filename
Which reaps me a pile of abuse and no code transferred
I've looked at workspace <atfin> and get something similar - I'm suspecting a Classic/Unicode clash here.

The <atfinout.dyalog> file reports a last-modified date of 1 April 2011, so I'll presume I have the latest.

My simple mind feels that code ought to be able to make the Dyalog-to-Dyalog round trip, so can anyone replicate this or tell me what I'm doing wrong?
Visit http://apl.dickbowman.com to read more from Dick Bowman
User avatar
Dick Bowman
 
Posts: 235
Joined: Thu Jun 18, 2009 4:55 pm

Re: ]OUT and ]IN Experiences?

Postby DanB|Dyalog on Wed Nov 02, 2011 3:51 pm

This should have gone to support but I will reply here out of interest for everyone.
The 80 column punch-card ATF format that IBM came up with eons ago is not implemented equally by all vendors.
I did not test them all but APL2000 does not produce the same results wrt strings and implicitely fns.
APL2000 and Nars2000 don't even seem to read each other's files (I tried a simple example that failed).

Dyalog produced a ws in the 90s, named ATFIN, that was modified at least once (by you I think) and another named ATFOUT to read/write such files.
2 years ago they were turned into a single .dyalog file that could be loaded via SALT.
It produced a single namespace instead of several fns and the code was made to account for the various formats APLX, APL2000, APL2 (PC and MF) produce.
That ns was put in [SALT]/lib/atfin.dyalog
Last year 2 user cmds were produced, ]in and ]out which simply load (via SALT) the above file into the ucmd ns.
Those cmds were put in file [SALT]/Spice/atfinout.dyalog along with 2 other cmds described below.

This explains why you need [SALT]/Spice in your SALT cmddir folder but the actual code is in [SALT]/lib (it could be anywhere really).

The ATF format is not a format very interesting when dealing with Dyalog code. Moreover it does not perform any translation of code/strings which makes it relatively limited in use.

The code was tested with basic code successfully then. Apparently there was a mixup somewhere and it is now broken.
I will look into that.

In the meantime, if you wish to transfer code between Dyalog APL versions I suggest you use ]inx and ]outx.
Those ucmds deal with exotic Dyalog object (like classes, []OR, etc).
There are limitations (e.g. no forms) but for the most part it works well.
These cmds also work with other APLs but for obvious reasons code FROM Dyalog must not contains dfns or classes, etc. for this to work.
OTOH APL2000 code TO Dyalog should work well and the ucmds will even perform some translation (e.g. []ELX to []TRAP) of code if requested.
Of course you will need a special ws on these APL to read or write such transfer files.
They exist "out there" (I have copies or you can get them at milinta.com) if interested.

I will post the new atfin.dyalog file shortly, stay tuned.
/Dan
DanB|Dyalog
 

Re: ]OUT and ]IN Experiences?

Postby DanB|Dyalog on Thu Nov 03, 2011 1:58 pm

Here is a new version of the [SALT]\lib\atfin.dyalog file which should work for the Dyalog<-->Dyalog case.
I tested with APL2 and it can read files created by Dyalog.
The other vendors I don't know but if past experience repeats I would expect problems even if all the Dyalog code is kosher.
You'll need V12.1 for this.
/Dan
Attachments
atfin.dyalog
(12.62 KiB) Downloaded 3164 times
DanB|Dyalog
 

Re: ]OUT and ]IN Experiences?

Postby Dick Bowman on Thu Nov 03, 2011 3:44 pm

Thankyou for that - I've checked it out and got a satisfactory Dyalog-to-Dyalog OUTandIN.

Had to mangle the file to get NARS2000 to handle it (objected to Dyalog-specific system functions, the stuff from ⎕SE and line-endings) - the )IN of NARS2000 seems quite fragile (and, not being written in APL, is a closed box to me).

But now that I've got a function and a variable to make the transition I shall make my own variant of atfin.dyalog for the specific purpose of transporting bits of my code over there (surrounding myself with a comfort blanket).

If there's any interest I'll post my modified version back here - but don't hold your breath, I'll probably find something more interesting to do than look at NARS2000 over the next few days.
Visit http://apl.dickbowman.com to read more from Dick Bowman
User avatar
Dick Bowman
 
Posts: 235
Joined: Thu Jun 18, 2009 4:55 pm


Return to Migrating from other Systems

Who is online

Users browsing this forum: No registered users and 1 guest