I'm am now less certain the discrepancy represents defined behavior.
If I understand the Vocab entry for I. correctly:
NB. x is assumed to be sorted in ascending or descending order;
NB. ascending is assumed if all the items of x are the same.
NB. (1319 136 qdoj 'I.')
order =: \:~`(/:~)@:,@.(0 -: {.@:/:@:[)
taut =: dyad define
I =. x I. y
ordering =. x order y
NB. x I. y is the least non-negative j such
NB. that j{x follows y in the ordering.
NB. (1592 117 qdoj 'I.')
idx =. (<ordering) i.&> y ,&< I { ({.~ 1 + #) x
follows =. <:/ idx
NB. or #x if y follows {:x in the ordering
NB. or if x has no items.
NB. (1711 97 qdoj 'I.')
after_x =. (I = #x) *. (0 -: #x) +. (< {:)/ follows
follows +. after_x
)
check_I =: dyad define
NB. y has the shape of an item of x
NB. (1524 50 qdoj 'I.')
if. y -:&:$ {. x do.
z =. x taut y
NB. In general, the search applies to the
NB. rank 0>.(#$x)-1 cells of higher-ranked y
NB. (1810 100 qdojW 'I.')
elseif. y >:&:(#@:$) x do.
z =. x taut"(_ , 0>.(#$x)-1) y
NB. Not clear what happens here. Just toss rank error.
elseif. do.
13!:8 rank_error =. 14
end.
NB. The dyadic verb taut should be a tautology
assert. z
)
Then this is a bug:
(,4) check_I 5 6 7
1 1 1
4 check_I 5 6 7
|assertion failure: check_I
| z
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm