Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!cs.utexas.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!swrinde!elroy.jpl.nasa.gov!jato!csi!sam
From: sam@csi.jpl.nasa.gov (Sam Sirlin)
Subject: Re: Empty Boxes as Null?
Message-ID: <1992Nov12.213911.16319@csi.jpl.nasa.gov>
Originator: sam@kalessin
Sender: usenet@csi.jpl.nasa.gov (Network Noise Transfer Service)
Nntp-Posting-Host: kalessin
Organization: Jet Propulsion Laboratory, Pasadena, CA
References:  <1992Nov10.184152.27031@wariat.org>
Date: Thu, 12 Nov 1992 21:39:11 GMT
Lines: 38


In article <1992Nov10.184152.27031@wariat.org>, ppetto@wariat.org (Peter J. Petto) writes:
|> empty box in place of an average value.  Can anyone tell me why an
|> open empty box becomes 0 in this context, and why an open vector with
|> an empty box is of different rank than one without one?

You should get the ISI Dictionary of J, and read the section on frames
and aggreement (IIB). A short example is
   a=. 1;2;3
   b=. 1;(i.0);3
If we set 
   rank=. $@$
we get
   rank &.> a
+-+-+-+
|0|0|0|
+-+-+-+
   rank &.> b
+-+-+-+
|0|1|0|
+-+-+-+
which explains where the "extra" rank comes from when unboxing b.
Since a fill element is needed (for bringing the elements to the same
shape), and the array is numeric, why would you expect something other
than 0?

As to an empty box representing a  missing value, this seems fine, but
perhaps you could explain what you want to do. You could of course
write an unbox-but-ignore-empty-boxes function, if that's what you
want. A sloppy version that works here (assuming all usual components
are scalars) is:

   ub=. '> (0=,>rank &.> y.)#y.': 11

-- 
Sam Sirlin
Jet Propulsion Laboratory         sam@kalessin.jpl.nasa.gov

