Allowing for x>y presents additional problems I did
not anticipate. Here are some more ideas to deal with the
x>y issue and non-integer inputs.
g1 =: (>[EMAIL PROTECTED]@>:@(<[EMAIL PROTECTED]>[EMAIL PROTECTED]))/@(/:~@,)
6.2 g1 11.9
7 8 9 10 11
6.2 g1~ 11.9
7 8 9 10 11
So, g1 will produce the correct integers, but not in
the original x,y order. The verb rev and the conjunction @.
deal with this possible order, as seen in what follows.
rev =: {.@/:@,
6.2 g1`(|[EMAIL PROTECTED])@.rev 11.9
7 8 9 10 11
11.9 g1`(|[EMAIL PROTECTED])@.rev 6.2
11 10 9 8 7
6.2 g1`(|[EMAIL PROTECTED])@.rev 6.2
6.0 g1`(|[EMAIL PROTECTED])@.rev 6.0
6
Ric's verb h is very concise but it and other
solutions omit the greater endpoint from the result. Of
course h does not deal with non-integer inputs, but that may
not have been required by the original question. I got
interested in non-integer x and y because they were no
specified as m and n, for example.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm