Problems with new file system

Problems with new file system

PostPosted by blake » Tue Jul 10, 2012 9:11 pm

I don't understand the following:




n


/Users/BLAKE/abc


n ⎕ncreate 0


¯1


(⍳25) ⎕nappend ¯1 3212


⎕nread ¯1 3212 25 0



It didn't print the array!?! I am using the 32 bit version of NARS2000 (although it shouldn't matter).



blake
 
Posts: 26
Joined: Sun Apr 18, 2010 10:08 am

Crash during save

PostPosted by blake » Wed Jul 11, 2012 9:11 am

Also, nappend didn't return the offset.

blake
 
Posts: 26
Joined: Sun Apr 18, 2010 10:08 am

Crash during save

PostPosted by forummaster » Thu Jul 12, 2012 12:56 pm

{154.372}blake wrote:
{154.372}blake wrote:
I don't understand the following:
      n
/Users/BLAKE/abc
      n ⎕ncreate 0
¯1
      (⍳25) ⎕nappend ¯1 3212
      ⎕nread ¯1 3212 25 0

    It didn't print the array!?!  I am using the 32 bit version of NARS2000 (although it shouldn't matter).

The ⎕ncreate does not specify either disk or workspace conversion types, so the default types are 'char8' (811) for disk and 'char16' (1611) for workspace. The ⎕nread specifies the disk conversion as 'int32' (3212) but not the workspace conversion type, so it uses the default of 'char16' (1611). The array was printed, but it was the equivalent of ⎕av[⍳25]. To read the same data you wrote, use
⎕nread ¯1 (3212 6412) 25 0
or
⎕nread ¯1 ('int32' 'int64') 25 0
or specify the conversion types in the ⎕ncreate (or ⎕ntie) as
n ⎕ncreate 0 2 (3212 6412)
or
n ⎕ncreate 0 2 ('int32' 'int64')

{154.372}blake wrote:
{154.372}blake wrote:
Also, nappend didn't return the offset.

I've been experimenting with what Dyalog calls 'shy' results -- the result is there, but its display property is off, in the same manner as a←⍳25 doesn't display a result, although the result clearly is there as in ⎕←a←⍳25.
forummaster
 
Posts: 534
Joined: Wed Jan 23, 2013 1:00 pm

Crash during save

PostPosted by blake » Thu Jul 12, 2012 3:14 pm

{154.374}forummaster wrote:
{154.374}forummaster wrote:
{154.372}blake wrote:
{154.372}blake wrote:
I don't understand the following:
n
/Users/BLAKE/abc
n ⎕ncreate 0
1
(⍳25) ⎕nappend 1 3212
⎕nread 1 3212 25 0

It didn't print the array!?! I am using the 32 bit version of NARS2000 (although it shouldn't matter).

The ⎕ncreate does not specify either disk or workspace conversion types, so the default types are 'char8' (811) for disk and 'char16' (1611) for workspace. The ⎕nread specifies the disk conversion as 'int32' (3212) but not the workspace conversion type, so it uses the default of 'char16' (1611). The array was printed, but it was the equivalent of ⎕av[⍳25]. To read the same data you wrote, use
⎕nread 1 (3212 6412) 25 0
or
⎕nread 1 ('int32' 'int64') 25 0
or specify the conversion types in the ⎕ncreate (or ⎕ntie) as
n ⎕ncreate 0 2 (3212 6412)
or
n ⎕ncreate 0 2 ('int32' 'int64')

{154.372}blake wrote:
{154.372}blake wrote:
Also, nappend didn't return the offset.

I've been experimenting with what Dyalog calls 'shy' results -- the result is there, but its display property is off, in the same manner as a←⍳25 doesn't display a result, although the result clearly is there as in ⎕←a←⍳25.



Please forgive me, although your response worked, I am unable to understand the conversion codes nor File vs. Workspace from the documentation you have (at wiki.nars2000.org/index.php/System_Function_Native_Files). I think a longer more explanitory text would be very helpful. Given that I am very well aware of binary formats and conversions (I have written entire file systems and database file layouts), I should be able to understand what is happening - but I don't. For example:


1. It's not entirely clear what R is (homognus array vs. nested)


2. What do the two specifications specify? Give some examples.


3. What are the native types we are starting with?


You pass two values in the nested array element of nappend. I don't know what they specify. It can't be from and to. You know what the variable is. Why would I have to specify a from type?


So, it seems that the second element can contain two values, but I can't tell what they signify.


Is there a way to turn off 'shy' results? It seems to me that regular APL does a real good job at knowing when to print a result and when not to. I'd like to turn that puppy off.


I think you have some really cool stuff. A little better documentation would go a long way.


Thanks.


Blake McBride


blake
 
Posts: 26
Joined: Sun Apr 18, 2010 10:08 am

Crash during save

PostPosted by forummaster » Fri Jul 13, 2012 5:19 pm

{154.376}blake wrote:
{154.376}blake wrote:
Please forgive me, although your response worked, I am unable to understand the conversion codes nor File vs. Workspace from the documentation you have (at wiki.nars2000.org/index.php/System_Function_Native_Files).  I think a longer more explanitory text would be very helpful.  Given that I am very well aware of binary formats and conversions (I have written entire file systems and database file layouts), I should be able to understand what is happening - but I don't.

Thanks for your comments. I've added a section at the start of the Native File Functions page to explain data conversions. Please let me know if it could be clearer.

{154.376}blake wrote:
{154.376}blake wrote:
For example:

1.  It's not entirely clear what R is (homognus array vs. nested)
2.  What do the two specifications specify?  Give some examples.  
3.  What are the native types we are starting with?

You pass two values in the nested array element of nappend.  I don't know what they specify.  It can't be from and to.  You know what the variable is.  Why would I have to specify a from type?

So, it seems that the second element can contain two values, but I can't tell what they signify.

In L ⎕NAPPEND R, R may be a numeric scalar or a one- or two-element vector. The first element is always the file tie number. The (optional) second element is the (single value) data conversion code for the data when written to the file. You are correct that the workspace datatype need not be specified as it is implicit in L.

{154.376}blake wrote:
{154.376}blake wrote:
Is there a way to turn off 'shy' results?  It seems to me that regular APL does a real good job at knowing when to print a result and when not to.  I'd like to turn that puppy off.

At the moment, there is no way to turn off shy results. I'm still experimenting with them, so let's work with it for the moment.
forummaster
 
Posts: 534
Joined: Wed Jan 23, 2013 1:00 pm


Return to File Systems

Who is online

Users browsing this forum: No registered users and 0 guests

cron