> Your solution is beyond my capacity to comprehend, or to appreciate.
One reason, among other reasons, for using the (tacit wicked) adverb xi is
that it often can easily produce tacit verbs when the adverb (13 :)
cannot. I do not really have to know how the original verb works; for
instance, a tacit counterpart for your new version of
foo=: 4 : '({:x)([/: *"1)&.:(({.x)&C."1)~ y'
can be produced as follows,
goo_tct=. [: X Y '({:X)([/: *"1)&.:(({.X)&C."1)~ Y' xi o ;
I did not have to spend any time thinking about the tacit conversion (did I
mention I am lazy?). The products of xi are usually competitive
(particularly for big arguments); apparently, the case at hand is not an
exception.
> I decided to test my craftmanship on tacitness and, after quite some
thinking, came up with
> foo_tct=: ([ ({.@[, {:@[(]/: *"1 ) }.@]) &.:(({., {.C."1 }.) :.
({.C.^:(_1)"1 }.)) (,~{.)~)
I knew a willing high priest could write it. ;)
stp 666
(0 3 1 2,:_1 1 _1 1) foo a
(0 3 1 2,:_1 1 _1 1) foo_tct a
(0 3 1 2,:_1 1 _1 1) goo_tct a
)
┌──────────────────────────────┬─────┬───────────┬────────────┐
│Sentence │Space│Time │Space * Time│
├──────────────────────────────┼─────┼───────────┼────────────┤
│(0 3 1 2,:_1 1 _1 1) foo a│18304│6.58107e_5 │1.2046 │
├──────────────────────────────┼─────┼───────────┼────────────┤
│(0 3 1 2,:_1 1 _1 1) foo_tct a│23744│0.000370558│8.79853 │
├──────────────────────────────┼─────┼───────────┼────────────┤
│(0 3 1 2,:_1 1 _1 1) goo_tct a│23360│9.4704e_5 │2.21229 │
└──────────────────────────────┴─────┴───────────┴────────────┘
I do not have to comprehend or deal with the actual (faulty) linear
representation of goo_tct (although I do remember, more or less, how the
products of xi work in general); unless I want to share it as a stand-alone
version,
". noun define -. CRLF
goo_tct=.
((<<2 14),(<(<,'('),(<'{:'),(<,'X'),(<,')'),(<,'['),(<'
/:'),(<,'*'),(<,'"'),(<<(,'0');1),(<'&.:'),(<'{.'),(<,'
&'),(<'C.'),(<,'~'),<,'Y'),<(<1;2),(<4;5;6;7;8),(<9),(<
(<10;2),(<11),(<12),(<7),<8),(<13),<14)&((1&({::) ,^:(0
:`(<'@.')) 2&({::))@:(<@:((0: 0&({::)@:]`(<@:(1&({::)@:]))`(
2&({::)@:])} ])@:(3 0 1&{)) 1} ])@:(((#@:(1&({::)) ~: >
@:(0&({::))) (([ # 3&({::)@:]) ,&:< [ <@:# >@:(0&({::))
@:]) ]) 3 0} ])@:(, <))@:(<@:((,'0') ,&:< ])&.>)@:;
)
As usual, because of the bug, I had to replace (,^:(0:`@.)) by
(,^:(0:`(<'@.')).
I hope it helps.
PS. Some (not me) might be afraid to use the products of xi because they
are not orthodox. A challenge to the high priests is to produce an
orthodox explicit, let alone tacit, adverb (similar to xi) capable of
generating automatically equivalent orthodox tacit verbs.
On Fri, Jan 25, 2019 at 5:42 AM R.E. Boss <[email protected]> wrote:
> Your solution is beyond my capacity to comprehend, or to appreciate.
>
> My explicit verb could easily be turned in a one-liner by
> foo=: 4 : '({:x)([/: *"1)&.:(({.x)&C."1)~ y'
> |:(0 3 1 2,:_1 1 _1 1) foo a=.3#.^:_1 i.30
> 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 1 1 1 2 2 2 0 0 0 1 1 1 2 2 2 0 0 0 1 1 1 2 2 2
> 0 0 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0 2 1 0
> 0 1 2 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2
>
> I decided to test my craftmanship on tacitness and, after quite some
> thinking, came up with
> foo_tct=: ([ ({.@[, {:@[(]/: *"1 ) }.@]) &.:(({., {.C."1 }.) :.
> ({.C.^:(_1)"1 }.)) (,~{.)~)
>
> (0 3 1 2,:_1 1 _1 1) (foo-: foo_tct) a
> 1
>
> Once more I was remembered to the fact that in the under construction,
> u&.v and u&.:v , v and its inverse are always applied monadically, v to the
> left and right parameters, and its inverse to the result of u.
> For that reason I had to add the first item at the left to the noun at the
> right.
> The inverse I also had to define properly.
>
>
> R.E. Boss
>
>
> > -----Oorspronkelijk bericht-----
> > Van: Programming <[email protected]>
> > Namens Jose Mario Quintana
> > Verzonden: donderdag 24 januari 2019 00:11
> > Aan: Programming forum <[email protected]>
> > Onderwerp: Re: [Jprogramming] Sorting on two keys
> >
> > > Well, one can argue whether an explicit verb is a one-liner or not.
> >
> >
> > Right, foo is not displayed as a one-liner,
> >
> > foo
> > 4 : 0
> > 'x1 x2'=.x
> > x2([/: *"1)&.:(x1&C."1)~ y
> > )
> >
> > as opossed to,
> >
> > ( goo=. 4 : 'x2([/: *"1)&.:(x1&C."1)~ y [ ''x1 x2''=.x ' )
> > 4 : 'x2([/: *"1)&.:(x1&C."1)~ y [ ''x1 x2''=.x '
> >
> > > At least it was too much work for me to fiddle out how to write this
> > tacitly. We have high priests for that, haven't we?
> >
> >
> > Alas, no high priest has shown up yet. It seems to be too much work for
> me
> > as well; particularly, because I regard myself as a lazy heretic anyway.
> > Nevertheless, sometimes I spend some time thinking about certain things
> to
> > avoid spending time thinking about certain things anymore. If I had to
> have a
> > tacit version of foo, I probably would employ (;) instead of (,:) as a
> delimiter
> > and use the following wicked version,
> >
>
> ...
> >
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm