On Wed, Mar 17, 2010 at 1:01 PM, Collin Monahan <[email protected]> wrote: > How can I define a function f such that > > f 0 1 2 4 5 > 3 > f 1 3 5 7 > 0 2 4 6 > > It should scale to a list of 6000 integers whose maximum element is 60000.
My solution at "http://www.perlmonks.org/?node=388321" hints that the solution should use 2&(f0\) where f0 lists the missing numbers between two numbers, eg. f0 3 6 should give the list 4 5. f=: [: ; 2 ([:<[>:@+[:i.<:@-~)/\ _1&, f 1 3 5 7 0 2 4 6 f 0 1 2 4 5 3 f 1 3 4 6 10 0 2 5 7 8 9 Ambrus ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
