I remember robert therriault having written a mechanism to display
lots of details of the shapes of things, in a jhs context if I
remember right. I'll leave it up to him to provide a pointer in that
direction.

Here's a cruder mechanism, which borrows from the apl2 display
mechanism -- stuffing the shape of each array into its formatted
representation:

thsh=:3 :0
  if. 0=L.y do. thflat y return. end.
  thflat (":@$each y) thshe"2 thsh each y
)

thflat=: 1 1}._1 _1}.":@<

thshe=:4 :0
  if. 2>#$y do.
    x=. (_2{.1 1,$x)$,x
    y=. (_2{.1 1,$y)$,y
  end.
  'ul um ur ml mm mr ll lm lr vert horz'=. 9!:6 ''
  h=. >./"1 #@> y
  w=. >./(#@>x),{:@$@> y
  shs=. {h;w
  y=. shs {.&.> y
  hs=. {.@> shs
  ws=. {:@> shs
  topdetail=. ws {.each x,each ws#each horz
  top0=. ur,~ul,}.;um,each {.topdetail
  topn=. (mr,~ml,[:}.@;mm,each ])"1 }.topdetail
  tops=. top0,topn
  bot=. lr,~ll,}.;lm,each ({:ws)#each horz
  bot,~,/tops,"1 2 (vert,.~[:;,.each/)"1 vert ,.each y
)

I have not tested this extensively, so it might fail if there is a
case I forgot to think about.  That said, here's an example of how it
looks:

   mean=:+/%#
   thsh 5!:2<'mean'
┌2────┬1┬1┐
│┌1┬1┐│%│#│
││+│/││ │ │
│└─┴─┘│ │ │
└─────┴─┴─┘
   thsh 5!:1<'mean'
┌2────────────────┐
│┌1┬3────────────┐│
││3│┌2──────┬1┬1┐││
││ ││┌1┬1──┐│%│#│││
││ │││/│┌1┐││ │ │││
││ │││ ││+│││ │ │││
││ │││ │└─┘││ │ │││
││ ││└─┴───┘│ │ │││
││ │└───────┴─┴─┘││
│└─┴─────────────┘│
└─────────────────┘

As usual, proportional spaced fonts will garble the display. If you
have this issue either run the expressions yourself, or copy and paste
the relevant content into something that gives you monospaced text if
you want to see how it really looks.

Thanks,

-- 
Raul

On Sat, Aug 15, 2020 at 1:05 AM 'robert therriault' via General
<[email protected]> wrote:
>
> Hi Arthur,
>
> I also find the leading invisible axis confusing at times. My solution was to 
> write the addon 'jig' which, in the jqt IDE, allows you to use tooltips and 
> an SVG display to make some of these issues more understandable. I also 
> created a lab that takes you through the user interface if you are 
> interested. Henry's 'dissect' is also an analytical tool that creates a 
> display with some of this information and much more.
>
> For your second issue with 5!:1 and 5!:0, this may help.
>
>     atom=.'a'
>    5!:1 'atom'
> |domain error
> |       5!:1'atom'
>    5!:1 <'atom'  NB. needs the name to be boxed
> ┌─────┐
> │┌─┬─┐│
> ││0│a││
> │└─┴─┘│
> └─────┘
>    ( 5!:1 <'atom') 5!:0 ''
> |syntax error
> |       (5!:1<'atom')5!:0''
>    ( 5!:1 <'atom') 5!:0          NB. 5!0 doesn't need an argument as it is an 
> adverb that returns the inverse of 5!:1
> a
>
> Cheers, bob
>
>
> > On Aug 14, 2020, at 20:58, Arthur Anger <[email protected]> wrote:
> >
> > One problem I have encountered is "invisible" leading unit axes.  I can 
> > find them by applying ShapeOf to an object at each boxing level, but I 
> > thought that they should show up in an Atomic Representation covering all 
> > levels. I don't find them there:
> >      atom=: 'a' [ singlet=: ,'a'
> >      ($ atom); $ singlet
> > ┌┬─┐
> > ││1│
> > └┴─┘      5!:1 'atom' ; 'singlet'
> > ┌─────┬─────┐
> > │┌─┬─┐│┌─┬─┐│
> > ││0│a│││0│a││
> > │└─┴─┘│└─┴─┘│
> > └─────┴─────┘
> > I don't see how the shape difference is captured in the Atomic 
> > Representation.  There must be yet another level of description.
> >
> > Furthermore, I expected that I could retrieve the original forms, but must 
> > not understand the documentation properly:
> >      (5!:1 'atom') 5!:0 ''
> > |domain error
> > |   (    5!:1'atom')5!:0''
> >
> > Thanks for any enlightenment.
> > --Art
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to