Your adverb (reduce) reminds me of an old one of mine (seq) [0]. Compare also yours with the definition of right fold (foldr) [1], and the corresponding adverb (fr=. (((&.>)/)(@:([ , <@:])))(>@:)) shown in the Slide 115 of my J conference 2012 talk [2]:
( X=. 'X' ) X ( Y=. 'Y' ) Y u=. ('('"_ , [ , ' u '"_ , ] , ')'"_) X u Y (X u Y) ( XS=. <;._1 ' X0 X1 .. XN' ) ┌──┬──┬──┬──┐ │X0│X1│..│XN│ └──┴──┴──┴──┘ XS u seq Y (XN u (.. u (X1 u (X0 u Y)))) XS u fr Y (X0 u (X1 u (.. u (XN u Y)))) XS u (&.> reduce) Y ┌─────────────────────────────┐ │(X0 u (X1 u (.. u (XN u Y))))│ └─────────────────────────────┘ (>XS) u reduce Y (X0 u (X1 u (.. u (XN u Y)))) (>XS) u (fr ((<"1@:[)`) (`]) (`:6)) Y (X0 u (X1 u (.. u (XN u Y)))) [0] Jforum: Can all verbs be tacit? http://www.jsoftware.com/pipermail/general/2001-December/008429.html [1] Fold (higher-order function) http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29 [2] Schedule J Conference 2012 http://www.jsoftware.com/jwiki/Community/Conference2012#Schedule On Mon, Apr 27, 2015 at 10:23 PM, 'Pascal Jasmin' via Programming < programm...@jsoftware.com> wrote: > I figured you were generating these from higher level "language". The > output is a bit hard to digest though. > > Do you have a solution for making this tacit? (or version close to it ... > where items of y and x have different shapes) > > reducE =: 1 : (':'; 'o=. x for_i. y do. o =. o u i end.') > > I have this similar solution (inverted xy) with boxing: > > boxscan =: ((&.>)/)(>@:) > reduce =: 1 : '<"_1@[ ([: u boxscan ,) <@:]' > > > The list has brought this up before, but is a foreign to do this something > easy and worthwhile? > > > > ----- Original Message ----- > From: Jose Mario Quintana <jose.mario.quint...@gmail.com> > To: Programming forum <programm...@jsoftware.com> > Cc: > Sent: Monday, April 27, 2015 7:45 PM > Subject: Re: [Jprogramming] Permutations with repeats (combinations?) > > Right, this is because "I did not make any effort to simplify or to try to > optimize the tacit verbs" The tools I used to produce the tacit versions > are meant for general cases (for instance, permitting boxed arguments); > specific cases can allow for specific simplifications (and optimizations). > I did not try for three reasons: I wanted to know what would be the penalty > in performance for the row versions; I wanted to preserve Boss' melodies as > much as possible; and I was not interested or motivated to make the effort > to try. Your versions are, literally, very neat particularly when compared > to those I presented; but, my current interest is in the opposite: how to > produce effortlessly and generally tacit verbs versions of explicit verbs . > > > Knocking it up another notch: with the aid of my wicked adverb mu and other > tools, running in a Jx interpreter, it is becoming almost boring for me to > convert a fairly large class of explicit verbs and I can see already that > it could be done with even less effort. There is an overhead, which is > expected, but typically it fades away when the verbs take large amount of > data (which is key for verb, explicit or tacit, performance anyway). The > following is an execution of tacit transcriptions that are even more > closely related to the original explicit versions (the definitions of most > of these tools are not shown here but I have done so before for many of > them): > > oan=. o (an&>) > > set'X Y D K Z' > 0 1 2 3 4 > > combt2=. [tv d f. > '. . .'ln > > (K h ([: dd 'i.>:dd' mu oan o (D ff))) o (D h ([: yy xx 'yy - xx' mu oan > o ((Y,X)ff))) > Z h ([: dd '(dd$<i.0 0),<i.1 0' mu oan o (D ff)) > Z h ([: kk zz 'kk ,.&.> ,&.>/\. >:&.> zz' mu oan o ((K,Z)ff)) t (X f) > [: zz '; zz' mu oan o (Z ff) > ) > > 2 (combt2 -: comb) 5 > 1 > 100 st&> ' 2 combt2 5' ; ' 2 comb 5' > ┌───────────┬─────┬──────────────┬───────────┐ > │ 2 combt2 5│16896│0.000263358188│4.44969995 │ > ├───────────┼─────┼──────────────┼───────────┤ > │ 2 comb 5 │12032│2.78562153e_5 │0.335165982│ > └───────────┴─────┴──────────────┴───────────┘ > > 11 (combt2 -: comb) 17 > 1 > 100 st&> ' 11 combt2 17' ; ' 11 comb 17' > ┌─────────────┬───────┬─────────────┬──────────┐ > │ 11 combt2 17│5036928│0.00520454777│26214.9324│ > ├─────────────┼───────┼─────────────┼──────────┤ > │ 11 comb 17 │5032064│0.00472455783│23774.2774│ > └─────────────┴───────┴─────────────┴──────────┘ > > > set'Y A B C' > 0 1 2 3 > > cmbcombt2=. [tv f. > '. . .'ln o < > > A h ([: yy '|.#/.~ yy' mu oan o (Y ff)) > B h ([: aa '|.(] <@combt2"0 +/\) aa' mu oan o (A ff)) > C h ([: bb '; ([:,/ [,"1"1 _1 ]{"1"_ 1 [-.~"1 i.@(+&({:@$)))L:0/ bb' mu > oan o (B ff)) > [: yy ccc 'yy {~ /:"1 ccc' mu oan o ((Y,C)ff) > ) > > (cmbcombt2 -:cmbcomb) 2#>:i.2 > 1 > 10 st&> 'cmbcombt2 2#>:i.2' ; 'cmbcomb 2#>:i.2' > ┌─────────────────┬─────┬──────────────┬──────────┐ > │cmbcombt2 2#>:i.2│27136│0.000567683124│15.4046493│ > ├─────────────────┼─────┼──────────────┼──────────┤ > │cmbcomb 2#>:i.2 │17152│9.21696831e_5 │1.58089441│ > └─────────────────┴─────┴──────────────┴──────────┘ > > (cmbcombt2 -:cmbcomb) 2#>:i.5 > 1 > 10 st&> 'cmbcombt2 2#>:i.5' ; 'cmbcomb 2#>:i.5' > ┌─────────────────┬────────┬────────────┬──────────┐ > │cmbcombt2 2#>:i.5│50343808│0.0685517701│3451157.15│ > ├─────────────────┼────────┼────────────┼──────────┤ > │cmbcomb 2#>:i.5 │50340352│0.0678081433│3413485.8 │ > └─────────────────┴────────┴────────────┴──────────┘ > > (cmbcombt2 -:cmbcomb) 2#>:i.6 > 1 > 1 st&> 'cmbcombt2 2#>:i.6' ; 'cmbcomb 2#>:i.6' > ┌─────────────────┬──────────┬──────────┬─────────────┐ > │cmbcombt2 2#>:i.6│3221239680│6.6813202 │2.15221338e10│ > ├─────────────────┼──────────┼──────────┼─────────────┤ > │cmbcomb 2#>:i.6 │3221236224│6.83664885│2.20224609e10│ > └─────────────────┴──────────┴──────────┴─────────────┘ > > Both, combt2 and cmbcombt2 are tacit; yet, combt2 is fixed but cmbcombt2 > is not completely fixed because combt2 appears in ([: aa '|.(] <@combt2"0 > +/\) aa' mu) and it is not resolved. Nevertheless, a complete fixed > version can be produced with little additional effort. This verb > (cmbcombt2f) exhibits even more overhead but, again, it fades away as the > amounts of data increase: > > > (cmbcombt2f -:cmbcomb) 2#>:i.2 > 1 > 10 st&> 'cmbcombt2f 2#>:i.2' ; 'cmbcomb 2#>:i.2' > ┌──────────────────┬──────┬─────────────┬──────────┐ > │cmbcombt2f 2#>:i.2│399744│0.00108473525│433.616407│ > ├──────────────────┼──────┼─────────────┼──────────┤ > │cmbcomb 2#>:i.2 │17152 │8.74402125e_5│1.49977453│ > └──────────────────┴──────┴─────────────┴──────────┘ > > (cmbcombt2f -:cmbcomb) 2#>:i.5 > 1 > 10 st&> 'cmbcombt2f 2#>:i.5' ; 'cmbcomb 2#>:i.5' > ┌──────────────────┬────────┬────────────┬──────────┐ > │cmbcombt2f 2#>:i.5│50343808│0.0689236018│3469876.58│ > ├──────────────────┼────────┼────────────┼──────────┤ > │cmbcomb 2#>:i.5 │50340352│0.0676761215│3406839.78│ > └──────────────────┴────────┴────────────┴──────────┘ > > (cmbcombt2f -:cmbcomb) 2#>:i.6 > 1 > 1 st&> 'cmbcombt2f 2#>:i.6' ; 'cmbcomb 2#>:i.6' > ┌──────────────────┬──────────┬──────────┬─────────────┐ > │cmbcombt2f 2#>:i.6│3221239680│6.62842712│2.13517525e10│ > ├──────────────────┼──────────┼──────────┼─────────────┤ > │cmbcomb 2#>:i.6 │3221236224│6.71277742│2.16234418e10│ > └──────────────────┴──────────┴──────────┴─────────────┘ > > > > > On Mon, Apr 27, 2015 at 1:12 AM, 'Pascal Jasmin' via Programming < > programm...@jsoftware.com> wrote: > > > Here is a more literal tacit translation of comb. I'm not doing > > everything you are, but unsure why its needed. IIUC, your version puts > > everything on the right hand side of ^: > > > > combT =: ([: ; ([ ; [: i.@>: -~) ((1 {:: [) ,.&.> [: ,&.>/\. > > >:&.>@:])^:(0 {:: [) (<i.1 0),~ (< i.0 0) $~ -~) > > > > 100 timespacex&> ' 2 combT 5' ; ' 2 combt 5' > > 1.91616e_5 5888 > > 3.6608e_5 9088 > > > > > > 100 timespacex&> ' 11 combT 17' ; ' 11 combt 17' > > 0.00314064 4.13094e6 > > 0.00317854 4.13414e6 > > > > > > > > Then there is a pretty direct mapping of RE Boss's version as it doesn't > > repeat intermediate variable use. > > > > > > cmbcombT =: ({~ [: /:"1 [: ; [: ([:,/ [,"1"1 _1 ]{"1"_ 1 [-.~"1 i.@ > (+&({:@$)))L:0/ > > [: |.@:(] <@combT f."0 +/\) [: |. #/.~) > > > > 10 timespacex&> 'cmbcomb 2#>:i.5' ; 'cmbcombT 2#>:i.5' > > 0.0584915 5.03404e7 > > 0.0580249 3.38226e7 > > > > > > ----- Original Message ----- > > From: Jose Mario Quintana <jose.mario.quint...@gmail.com> > > To: Programming forum <programm...@jsoftware.com> > > Cc: > > Sent: Sunday, April 26, 2015 9:55 PM > > > > Subject: Re: [Jprogramming] Permutations with repeats (combinations?) > > > > Tacit vs. explicit seems to be a never-ending controversy. May as it be, > > the following is a brute force transcription of Boss' compositions for a > > tacit interpretation: > > > > st=. (, */&.:>@:(1 2&{))@:(] ; 7!:2@:] ; 6!:2) > > > > ". noun define -. CRLF > > > > combt=. > > > > ;@:(4&({::))@:((<@:((3&({::) ([ ,.&.> ,&.>/\.@:(>:&.>@:])) 4&({::) > > )@:]) 4} ])^:(0&({::)))@:(<@:((<i.1 0) ,~ (<i.0 0) $~ 2&({::)) 4} > > ])@:(<@:(i.@:>:@:(2&({::))) 3} ])@:(<@:(1&({::) - 0&({::)) 2} ])@: > > ('. . .'&(] , ;:@:[))@:(,&:>/@:(<^:(L. = 0:)&.>))@:(,&<) > > > > ) > > > > > > 2 (comb -: combt) 5 > > 1 > > > > 100 st&> ' 2 comb 5' ; ' 2 combt 5' > > ┌───────────┬─────┬──────────┬────────┐ > > │ 2 comb 5 │12032│6.24855e_5│0.751825│ > > ├───────────┼─────┼──────────┼────────┤ > > │ 2 combt 5│9088 │9.51077e_5│0.864338│ > > └───────────┴─────┴──────────┴────────┘ > > > > 11 (comb -: combt) 17 > > 1 > > 100 st&> ' 11 comb 17' ; ' 11 combt 17' > > ┌─────────────┬───────┬──────────┬───────┐ > > │ 11 comb 17 │5032064│0.0107722 │54206.5│ > > ├─────────────┼───────┼──────────┼───────┤ > > │ 11 combt 17│4134144│0.00735863│30421.6│ > > └─────────────┴───────┴──────────┴───────┘ > > > > > > ". noun define -. CRLF > > > > cmbcombt=. > > > > (0&({::) {~ /:"1@:(3&({::)))@:(<@:(;@:(,/@:([ ,"1"1 _1 ] {"1"_ 1 [ > > -.~"1 i.@(+&({:@$)))L:0/)@:(2&({::))) 3} ])@:(<@:(|.@:(] <@(;@:(4 > > &({::))@:((<@:((3&({::) ([ ,.&.> ,&.>/\.@:(>:&.>@:])) 4&({::))@:]) > > 4} ])^:(0&({::)))@:(<@:((<i.1 0) ,~ (<i.0 0) $~ 2&({::)) 4} ])@:( > > <@:(i.@:>:@:(2&({::))) 3} ])@:(<@:(1&({::) - 0&({::)) 2} ])@:('. . > > .'&(] , ;:@:[))@:(,&:>/@:(<^:(L. = 0:)&.>))@:(,&<))"0 +/\)@:(1&({ > > ::))) 2} ])@:(<@:(|.@:(#/.~)@:(0&({::))) 1} ])@:('. . .'&(] , ;:@: > > [)@:<) > > > > > > ) > > > > > > > > (cmbcomb -:cmbcombt) 2#>:i.5 > > 1 > > 10 st&> 'cmbcomb 2#>:i.5' ; 'cmbcombt 2#>:i.5' > > ┌────────────────┬────────┬────────┬─────────┐ > > │cmbcomb 2#>:i.5 │50340352│0.139288│7.0118e6 │ > > ├────────────────┼────────┼────────┼─────────┤ > > │cmbcombt 2#>:i.5│50339072│0.157125│7.90951e6│ > > └────────────────┴────────┴────────┴─────────┘ > > > > (cmbcomb -:cmbcombt) 2#>:i.6 > > 1 > > 1 st&> 'cmbcomb 2#>:i.6' ; 'cmbcombt 2#>:i.6' > > ┌────────────────┬──────────┬───────┬──────────┐ > > │cmbcomb 2#>:i.6 │3221236224│10.6752│3.43873e10│ > > ├────────────────┼──────────┼───────┼──────────┤ > > │cmbcombt 2#>:i.6│3221234944│11.2508│3.62415e10│ > > └────────────────┴──────────┴───────┴──────────┘ > > > > The associated performances are similar. I did not make any effort to > > simplify or to try to optimize the tacit verbs. Each assignment in the > > original explicit constructions corresponds to a form (<@:v N} ]) in the > > tacit versions with the following mappings, > > > > comb: x y d k z -> 0 1 2 3 4 > > cmbcomb: y a b c -> 0 1 2 3 > > > > Needless to say, combt is embedded in cmbcombt. > > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > > ----- Original Message ----- > From: Jose Mario Quintana <jose.mario.quint...@gmail.com> > To: Programming forum <programm...@jsoftware.com> > Cc: > Sent: Monday, April 27, 2015 7:45 PM > Subject: Re: [Jprogramming] Permutations with repeats (combinations?) > > Right, this is because "I did not make any effort to simplify or to try to > optimize the tacit verbs" The tools I used to produce the tacit versions > are meant for general cases (for instance, permitting boxed arguments); > specific cases can allow for specific simplifications (and optimizations). > I did not try for three reasons: I wanted to know what would be the penalty > in performance for the row versions; I wanted to preserve Boss' melodies as > much as possible; and I was not interested or motivated to make the effort > to try. Your versions are, literally, very neat particularly when compared > to those I presented; but, my current interest is in the opposite: how to > produce effortlessly and generally tacit verbs versions of explicit verbs . > > > Knocking it up another notch: with the aid of my wicked adverb mu and other > tools, running in a Jx interpreter, it is becoming almost boring for me to > convert a fairly large class of explicit verbs and I can see already that > it could be done with even less effort. There is an overhead, which is > expected, but typically it fades away when the verbs take large amount of > data (which is key for verb, explicit or tacit, performance anyway). The > following is an execution of tacit transcriptions that are even more > closely related to the original explicit versions (the definitions of most > of these tools are not shown here but I have done so before for many of > them): > > oan=. o (an&>) > > set'X Y D K Z' > 0 1 2 3 4 > > combt2=. [tv d f. > '. . .'ln > > (K h ([: dd 'i.>:dd' mu oan o (D ff))) o (D h ([: yy xx 'yy - xx' mu oan > o ((Y,X)ff))) > Z h ([: dd '(dd$<i.0 0),<i.1 0' mu oan o (D ff)) > Z h ([: kk zz 'kk ,.&.> ,&.>/\. >:&.> zz' mu oan o ((K,Z)ff)) t (X f) > [: zz '; zz' mu oan o (Z ff) > ) > > 2 (combt2 -: comb) 5 > 1 > 100 st&> ' 2 combt2 5' ; ' 2 comb 5' > ┌───────────┬─────┬──────────────┬───────────┐ > │ 2 combt2 5│16896│0.000263358188│4.44969995 │ > ├───────────┼─────┼──────────────┼───────────┤ > │ 2 comb 5 │12032│2.78562153e_5 │0.335165982│ > └───────────┴─────┴──────────────┴───────────┘ > > 11 (combt2 -: comb) 17 > 1 > 100 st&> ' 11 combt2 17' ; ' 11 comb 17' > ┌─────────────┬───────┬─────────────┬──────────┐ > │ 11 combt2 17│5036928│0.00520454777│26214.9324│ > ├─────────────┼───────┼─────────────┼──────────┤ > │ 11 comb 17 │5032064│0.00472455783│23774.2774│ > └─────────────┴───────┴─────────────┴──────────┘ > > > set'Y A B C' > 0 1 2 3 > > cmbcombt2=. [tv f. > '. . .'ln o < > > A h ([: yy '|.#/.~ yy' mu oan o (Y ff)) > B h ([: aa '|.(] <@combt2"0 +/\) aa' mu oan o (A ff)) > C h ([: bb '; ([:,/ [,"1"1 _1 ]{"1"_ 1 [-.~"1 i.@(+&({:@$)))L:0/ bb' mu > oan o (B ff)) > [: yy ccc 'yy {~ /:"1 ccc' mu oan o ((Y,C)ff) > ) > > (cmbcombt2 -:cmbcomb) 2#>:i.2 > 1 > 10 st&> 'cmbcombt2 2#>:i.2' ; 'cmbcomb 2#>:i.2' > ┌─────────────────┬─────┬──────────────┬──────────┐ > │cmbcombt2 2#>:i.2│27136│0.000567683124│15.4046493│ > ├─────────────────┼─────┼──────────────┼──────────┤ > │cmbcomb 2#>:i.2 │17152│9.21696831e_5 │1.58089441│ > └─────────────────┴─────┴──────────────┴──────────┘ > > (cmbcombt2 -:cmbcomb) 2#>:i.5 > 1 > 10 st&> 'cmbcombt2 2#>:i.5' ; 'cmbcomb 2#>:i.5' > ┌─────────────────┬────────┬────────────┬──────────┐ > │cmbcombt2 2#>:i.5│50343808│0.0685517701│3451157.15│ > ├─────────────────┼────────┼────────────┼──────────┤ > │cmbcomb 2#>:i.5 │50340352│0.0678081433│3413485.8 │ > └─────────────────┴────────┴────────────┴──────────┘ > > (cmbcombt2 -:cmbcomb) 2#>:i.6 > 1 > 1 st&> 'cmbcombt2 2#>:i.6' ; 'cmbcomb 2#>:i.6' > ┌─────────────────┬──────────┬──────────┬─────────────┐ > │cmbcombt2 2#>:i.6│3221239680│6.6813202 │2.15221338e10│ > ├─────────────────┼──────────┼──────────┼─────────────┤ > │cmbcomb 2#>:i.6 │3221236224│6.83664885│2.20224609e10│ > └─────────────────┴──────────┴──────────┴─────────────┘ > > Both, combt2 and cmbcombt2 are tacit; yet, combt2 is fixed but cmbcombt2 > is not completely fixed because combt2 appears in ([: aa '|.(] <@combt2"0 > +/\) aa' mu) and it is not resolved. Nevertheless, a complete fixed > version can be produced with little additional effort. This verb > (cmbcombt2f) exhibits even more overhead but, again, it fades away as the > amounts of data increase: > > > (cmbcombt2f -:cmbcomb) 2#>:i.2 > 1 > 10 st&> 'cmbcombt2f 2#>:i.2' ; 'cmbcomb 2#>:i.2' > ┌──────────────────┬──────┬─────────────┬──────────┐ > │cmbcombt2f 2#>:i.2│399744│0.00108473525│433.616407│ > ├──────────────────┼──────┼─────────────┼──────────┤ > │cmbcomb 2#>:i.2 │17152 │8.74402125e_5│1.49977453│ > └──────────────────┴──────┴─────────────┴──────────┘ > > (cmbcombt2f -:cmbcomb) 2#>:i.5 > 1 > 10 st&> 'cmbcombt2f 2#>:i.5' ; 'cmbcomb 2#>:i.5' > ┌──────────────────┬────────┬────────────┬──────────┐ > │cmbcombt2f 2#>:i.5│50343808│0.0689236018│3469876.58│ > ├──────────────────┼────────┼────────────┼──────────┤ > │cmbcomb 2#>:i.5 │50340352│0.0676761215│3406839.78│ > └──────────────────┴────────┴────────────┴──────────┘ > > (cmbcombt2f -:cmbcomb) 2#>:i.6 > 1 > 1 st&> 'cmbcombt2f 2#>:i.6' ; 'cmbcomb 2#>:i.6' > ┌──────────────────┬──────────┬──────────┬─────────────┐ > │cmbcombt2f 2#>:i.6│3221239680│6.62842712│2.13517525e10│ > ├──────────────────┼──────────┼──────────┼─────────────┤ > │cmbcomb 2#>:i.6 │3221236224│6.71277742│2.16234418e10│ > └──────────────────┴──────────┴──────────┴─────────────┘ > > > > > On Mon, Apr 27, 2015 at 1:12 AM, 'Pascal Jasmin' via Programming < > programm...@jsoftware.com> wrote: > > > Here is a more literal tacit translation of comb. I'm not doing > > everything you are, but unsure why its needed. IIUC, your version puts > > everything on the right hand side of ^: > > > > combT =: ([: ; ([ ; [: i.@>: -~) ((1 {:: [) ,.&.> [: ,&.>/\. > > >:&.>@:])^:(0 {:: [) (<i.1 0),~ (< i.0 0) $~ -~) > > > > 100 timespacex&> ' 2 combT 5' ; ' 2 combt 5' > > 1.91616e_5 5888 > > 3.6608e_5 9088 > > > > > > 100 timespacex&> ' 11 combT 17' ; ' 11 combt 17' > > 0.00314064 4.13094e6 > > 0.00317854 4.13414e6 > > > > > > > > Then there is a pretty direct mapping of RE Boss's version as it doesn't > > repeat intermediate variable use. > > > > > > cmbcombT =: ({~ [: /:"1 [: ; [: ([:,/ [,"1"1 _1 ]{"1"_ 1 [-.~"1 i.@ > (+&({:@$)))L:0/ > > [: |.@:(] <@combT f."0 +/\) [: |. #/.~) > > > > 10 timespacex&> 'cmbcomb 2#>:i.5' ; 'cmbcombT 2#>:i.5' > > 0.0584915 5.03404e7 > > 0.0580249 3.38226e7 > > > > > > ----- Original Message ----- > > From: Jose Mario Quintana <jose.mario.quint...@gmail.com> > > To: Programming forum <programm...@jsoftware.com> > > Cc: > > Sent: Sunday, April 26, 2015 9:55 PM > > > > Subject: Re: [Jprogramming] Permutations with repeats (combinations?) > > > > Tacit vs. explicit seems to be a never-ending controversy. May as it be, > > the following is a brute force transcription of Boss' compositions for a > > tacit interpretation: > > > > st=. (, */&.:>@:(1 2&{))@:(] ; 7!:2@:] ; 6!:2) > > > > ". noun define -. CRLF > > > > combt=. > > > > ;@:(4&({::))@:((<@:((3&({::) ([ ,.&.> ,&.>/\.@:(>:&.>@:])) 4&({::) > > )@:]) 4} ])^:(0&({::)))@:(<@:((<i.1 0) ,~ (<i.0 0) $~ 2&({::)) 4} > > ])@:(<@:(i.@:>:@:(2&({::))) 3} ])@:(<@:(1&({::) - 0&({::)) 2} ])@: > > ('. . .'&(] , ;:@:[))@:(,&:>/@:(<^:(L. = 0:)&.>))@:(,&<) > > > > ) > > > > > > 2 (comb -: combt) 5 > > 1 > > > > 100 st&> ' 2 comb 5' ; ' 2 combt 5' > > ┌───────────┬─────┬──────────┬────────┐ > > │ 2 comb 5 │12032│6.24855e_5│0.751825│ > > ├───────────┼─────┼──────────┼────────┤ > > │ 2 combt 5│9088 │9.51077e_5│0.864338│ > > └───────────┴─────┴──────────┴────────┘ > > > > 11 (comb -: combt) 17 > > 1 > > 100 st&> ' 11 comb 17' ; ' 11 combt 17' > > ┌─────────────┬───────┬──────────┬───────┐ > > │ 11 comb 17 │5032064│0.0107722 │54206.5│ > > ├─────────────┼───────┼──────────┼───────┤ > > │ 11 combt 17│4134144│0.00735863│30421.6│ > > └─────────────┴───────┴──────────┴───────┘ > > > > > > ". noun define -. CRLF > > > > cmbcombt=. > > > > (0&({::) {~ /:"1@:(3&({::)))@:(<@:(;@:(,/@:([ ,"1"1 _1 ] {"1"_ 1 [ > > -.~"1 i.@(+&({:@$)))L:0/)@:(2&({::))) 3} ])@:(<@:(|.@:(] <@(;@:(4 > > &({::))@:((<@:((3&({::) ([ ,.&.> ,&.>/\.@:(>:&.>@:])) 4&({::))@:]) > > 4} ])^:(0&({::)))@:(<@:((<i.1 0) ,~ (<i.0 0) $~ 2&({::)) 4} ])@:( > > <@:(i.@:>:@:(2&({::))) 3} ])@:(<@:(1&({::) - 0&({::)) 2} ])@:('. . > > .'&(] , ;:@:[))@:(,&:>/@:(<^:(L. = 0:)&.>))@:(,&<))"0 +/\)@:(1&({ > > ::))) 2} ])@:(<@:(|.@:(#/.~)@:(0&({::))) 1} ])@:('. . .'&(] , ;:@: > > [)@:<) > > > > > > ) > > > > > > > > (cmbcomb -:cmbcombt) 2#>:i.5 > > 1 > > 10 st&> 'cmbcomb 2#>:i.5' ; 'cmbcombt 2#>:i.5' > > ┌────────────────┬────────┬────────┬─────────┐ > > │cmbcomb 2#>:i.5 │50340352│0.139288│7.0118e6 │ > > ├────────────────┼────────┼────────┼─────────┤ > > │cmbcombt 2#>:i.5│50339072│0.157125│7.90951e6│ > > └────────────────┴────────┴────────┴─────────┘ > > > > (cmbcomb -:cmbcombt) 2#>:i.6 > > 1 > > 1 st&> 'cmbcomb 2#>:i.6' ; 'cmbcombt 2#>:i.6' > > ┌────────────────┬──────────┬───────┬──────────┐ > > │cmbcomb 2#>:i.6 │3221236224│10.6752│3.43873e10│ > > ├────────────────┼──────────┼───────┼──────────┤ > > │cmbcombt 2#>:i.6│3221234944│11.2508│3.62415e10│ > > └────────────────┴──────────┴───────┴──────────┘ > > > > The associated performances are similar. I did not make any effort to > > simplify or to try to optimize the tacit verbs. Each assignment in the > > original explicit constructions corresponds to a form (<@:v N} ]) in the > > tacit versions with the following mappings, > > > > comb: x y d k z -> 0 1 2 3 4 > > cmbcomb: y a b c -> 0 1 2 3 > > > > Needless to say, combt is embedded in cmbcombt. > > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm