In August I wrote, 'One problem I have encountered is "invisible" leading unit 
axes.'  Raul Miller responded with, '... Here's a cruder mechanism, which 
borrows from the apl2 display mechanism -- stuffing the shape of each array 
into its formatted representation.'  Bob Therriault then suggested his addon 
'jig' and Henry Rich's 'dissect', which display structural information when 
operating in the JQT environment.

Not wishing to spend a lot of time learning another layer of environment, I 
spent a lot of time instead on embellishing Raul's "mechanism", while gaining 
experience in the use of recursion--and noting the often disruptive prevalence 
of "invisible" leading unit axes, frequently encountered after opening boxed 
values.

My script now resides in File:CTScan.ijs, offering a computerized tomographic 
scan of all the internal components of a J data value.  It reports atop each 
subarray its depth, level, shape, and datatype.  It offers options to constrain 
analysis to limited portions of the components, and to vary the format of the 
display.  Additionally, the content-formatting routine, which performs some 
modest compaction in the display of certain types of higher-rank or nested 
arrays, can be called independently by other applications.

Here are two brief examples;  a greater variety will be found in the script's 
'help' note:

   NB. Much of this structure is unclear in the default display, unlike the 
scan--
   ] samp=: ((< (^ 1) , o. 1) ; 0 3 $ 'abc') ,: a: ; (<< i. 1 1 1 2)
┌─────────────────┬─────┐
│┌───────────────┐│     │
││2.71828 3.14159││     │
│└───────────────┘│     │
├─────────────────┼─────┤
│┌┐               │┌───┐│
│││               ││0 1││
│└┘               │└───┘│
└─────────────────┴─────┘
   1 1 1 CTScan samp
┌0\2: 2 2bx────────────────────────────┐           
│┌1\1: bx──────────┐ ┌1\0: 0 3ch┐      │           
││┌2\0: 2fl───────┐│ └──────────┘      │           
│││2.71828 3.14159││                   │           
││└───────────────┘│                   │           
│└─────────────────┘                   │           
│┌1\1: bx───┐        ┌1\1: bx─────────┐│           
││┌2\0: 0bl┐│        │┌2\0: 1 1 1 2in┐││           
│││        ││        ││0 1           │││           
││└────────┘│        │└──────────────┘││           
│└──────────┘        └────────────────┘│           
└──────────────────────────────────────┘           
   0 0 0 CTScan samp
┌0\2: 2 2bx────────────────────                    
┌1\1: bx────────┌1\0: 0 3ch                        
┌2\0: 2fl───────└──────────                        
│2.71828 3.14159                                   
└───────────────                                   
┌1\1: bx─       ┌1\1: bx───────                    
┌2\0: 0bl       ┌2\0: 1 1 1 2in                    
│               │0 1                               
└────────       └──────────────                    

Please send bug reports directly to an...@mit.edu.  Complaints and suggestions 
for possible improvements, however, may deserve wider discussion.  Thanks.
--Art
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to