A quick comparison of the tacit versions follows:
v0 - Groeneveld
v1 - Miller
v2 - Day (fixed and slightly modified to produce the right result, as far
as I can see)
JVERSION
Engine: j805/j64/windows
Beta-12: commercial/2016-09-30T15:50:47
Library: 8.05.06
Qt IDE: 1.5.2/5.6.1
Platform: Win 64
Installer: J805 install
InstallPath: g:/program files/j
Contact: www.jsoftware.com
N=. 10&#.inv&.>12 22 24 41 15 53 34 44 44 42 23 33
v0=. ([: I. =/&>) +/&.>@{`[`]}"0 1 ]
v1=. 2&{@]`(1&({::)@])`(0&({::)@])}"1~@(([ ;"1 (<"0@] ,. {~)&>/@(]
; I.@:~:))
+//.~&.>)
v2=. }:@:((0 ,~ I.@:(=/&>) =/ i.@#) {&>"1 (~.@; +/^:(=/))&.>)
stp 666
v0 N
v1 N
v2 N
)
┌────────┬─────┬──────────┬────────────┐
│Sentence│Space│Time │Space * Time│
├────────┼─────┼──────────┼────────────┤
│v0 N │5888 │1.1093e_5 │0.0653158 │
├────────┼─────┼──────────┼────────────┤
│v1 N │7040 │3.74794e_5│0.263855 │
├────────┼─────┼──────────┼────────────┤
│v2 N │11008│4.15839e_5│0.457756 │
└────────┴─────┴──────────┴────────────┘
Groeneveld's version is neater, leaner and meaner. However, do they
products match?
(v0 -: v2)N
1
(v0 -: v1)N
0
The products of v0 and v1 look the same but they are not. The difference
can be explained by,
($each v0 N)
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│2│ │2│2│2│2│2│2│2│2│2│2│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│2│2│2│2│2│2│2│ │2│2│2│2│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│2│2│2│2│2│2│2│2│ │2│2│2│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│2│2│2│2│2│2│2│2│2│2│2│ │
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
($each v1 N)
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│2│1│2│2│2│2│2│2│2│2│2│2│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│2│2│2│2│2│2│2│1│2│2│2│2│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│2│2│2│2│2│2│2│2│1│2│2│2│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│2│2│2│2│2│2│2│2│2│2│2│1│
└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
Does the difference matter for this problem?
On Mon, Nov 7, 2016 at 1:00 PM, Skip Cave <[email protected]> wrote:
> Wow! Great answers. I didn't think this could be done without control
> statements. By now I should know that J's powerful set of primitives can
> implement most any algorithm without requiring looping statements.
>
> Mike Day's sharp eye spotted the fact that my data was derived from an
> infix sliding-window boxing of an unboxed vector. Mike's step-by-step set
> of verb definitions helped greatly in understanding what was going on.
>
> Raul's monster tacit verb is probably the most complex tacit expression I
> have ever tried to analyze. His de-construction of the verb helped in my
> understanding, but my tacit skills are still a way from being able to
> create something like this on my own. Hopefully, my study of this function
> will improve my tacit skills.
>
> Thanks for all your help,
>
> Skip
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm