> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Aai
> Verzonden: dinsdag 18 augustus 2009 18:38
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] minmax differences
(...)
> -->
>
> mmd17 =: 4 : 0
> ds=. (,(y-1)-+/@:])(x-2) $ y <....@%&<: x
> if. ({.={:) ds do.
> +/\0,ds
> else.
> 0,.+/\"1 (|."0 _~ i...@# ) ds
> end.
> )
(...)
> --
> Met vriendelijke groet,
> =@@i
If only the combinations with maximum differences with the maximum-minimum
difference are needed than here is a tacit solution.
mmd2=: (|&<:) ([:+/\"(1) 0,. ]+ (~.@:* ([:=/~ i...@#))) ([# <....@%~)&<:
5 mmd2 12
0 5 7 9 11
0 2 7 9 11
0 2 4 9 11
0 2 4 6 11
5 mmd17 12
0 2 4 6 11
0 2 4 9 11
0 2 7 9 11
0 5 7 9 11
11 (|....@mmd2 -: mmd17) 55
1
R.E. Boss
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm