Devon McCormick wrote:

> However, my feeling is this code is a bit clumsy. Can anyone think of
> a neater pair of solutions?
>
Without more constraints, it is not obvious how to improve your ncile
verb.  If you can describe the badness of a solution, this could be
posed and solved as a minimization problem. There are bad cases: for
example if there are long run-lengths in the sorted data and a lot of
bins, you may be stuck with fewer than requested bins of wildly
varying sizes.

If it's any consolation, I wrote an almost identical solution to your
ncile just from the problem description.  It's a good case for I.^_1 .

Best wishes,

John


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to