No, it exhibits no such inconsistent behavior.

It appends zero items exactly where it should (as far as we can tell):
[insert "empty array" joke of your choice here].

  $(i.3),i.2   NB. 3 elements appended to 2 elements gives you 5 elements
5
  $(i.3),i.1   NB. 3 elements appended to 1 element gives you 4 elements
4
  $(i.3),i.0   NB. 3 elements appended to 0 elements gives you 3 elements
3
  (i.3) -: (i.3),i.0  NB. something is equivalent to the same thing
appended to nothing
1

OK, this is functionally the same as "discarding" items - in fact the common
use
of compression by a boolean is to remove the items corresponding to the
falsity
of some condition, e.g.

  (] #~ 0 ~: 3 | ]) i. 10 NB. Remove multiples of 3
1 2 4 5 7 8



On 4/18/07, Terrence Brannon <[EMAIL PROTECTED]> wrote:

On 4/18/07, Devon McCormick <[EMAIL PROTECTED]> wrote:
> Each pair returns a value:
>  '0#n' returns a 0-length value;
>  '1#n' returns a 1-length value.
> >From this, what would you suppose is the length of
>  '2#n'?

the length would be 2

but what does J do with the 0-length values? toss'em like my append
example?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm




--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to