You are right, init is no example of elegance.
I appreciate your >. and prefer
(<@(-i.)"0 @(<.|.))@(-i.)@<:
over your
}:@((<: >. |.) <@}."0 1/ ])@(- i.)
but then your preceding <, is not easy applicable.
So my next try for init is
(<<i.1 0),~ (; <@(-i.)"0 @(<.|.)) &(-i.)/ @(,<:)
(init-:((<<i.1 0),~ (; <@(-i.)"0@(<.|.))&(-i.)/ @(,<:)))25
1
R.E. Boss
-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Miller, Raul D
Verzonden: donderdag 7 september 2006 18:10
Aan: Programming forum
Onderwerp: RE: [Jprogramming] partitions
R.E. Boss wrote:
> init=:(<<i.1 0)|.@,(<@(-i.)"0)@(],~](](>:@[EMAIL PROTECTED],(-i.)@])<:@-)
> <[EMAIL PROTECTED]:)
> p8=:[:>@{: [:(],<@(>@[ (;@([,.&.> -@(<.#){.])&.>) [EMAIL PROTECTED]@>@[
> {.]))/ init
I'm still studying your code, but I thought I'd mention that
there seems to be a shorter way of expressing init:
(<<i.1 0) ,~ }:@(< , (<: >. |.) <@}."0 1/ ])@(- i.)
This gives a different result for the case of a 0 right argument,
but the result of p8 for that case seems somewhat plausible.
(Instead of an empty result, it gives an empty partition).
FYI,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm