Presumably the adverb ritem and its variants would produce verbs which
could be used and reused. Thus, I would be more concerned about the size
(and performance) of the verbs produced as opposed to the size (and
performance) of the producing adverbs.
From this perspective the verbs produced by ritemT have an asymptotic
disadvantage vs those produced by reitemE; however, apparently that does
not have to be necessarily the case. In other words, one can produce a
fixed tacit adverb (with no 1 : nor named arguments), say ritemTT, which
produces fixed tacit verbs that are asymptotically competitive vs those
verbs produced by ritemE.
Since this can be an exercise for fearless ;) adverbial tacit writers, see
[0], I will not spoil the fun by showing reitemTT at this point but the
following session excerpt illustrates the points discussed above:
sp=. 7!:5@:<
stp=. ([ ((<;._1 '|Sentence|Space|Time|Space * Time') , (, */&.:>@:(1
2&{))@:(] ; 7!:2@:] ; 6!:2)&>) (10{a.) -.&a:@:(<;._2@,~) ]) ".@:('0 : 0'"_)
X=. 2 4$0 [ M=. i.11111 2 4 [ Y=. 88880+i.2 4
ve =. M ritemE
vt =. M ritemT
vtt=. M ritemTT
sp each ;:'ve vt vtt' NB. The space taken by vt is ~ 4X...
┌─────────┬─────────┬─────────┐
│1.05037e6│4.19955e6│1.06291e6│
└─────────┴─────────┴─────────┘
stp 666 NB. Their space-time performance is similar...
X (I.M -:"_1 _ Y)} M
X ve Y
X vt Y
X vtt Y
)
┌──────────────────────┬───────┬───────────┬────────────┐
│Sentence │Space │Time │Space * Time│
├──────────────────────┼───────┼───────────┼────────────┤
│ X (I.M -:"_1 _ Y)} M│1069696│0.00032238 │344.849 │
├──────────────────────┼───────┼───────────┼────────────┤
│ X ve Y │1071360│0.000315637│338.161 │
├──────────────────────┼───────┼───────────┼────────────┤
│ X vt Y │1052416│0.000317053│333.672 │
├──────────────────────┼───────┼───────────┼────────────┤
│ X vtt Y │1053312│0.000326386│343.786 │
└──────────────────────┴───────┴───────────┴────────────┘
Reference
[0] [Jprogramming] Adverbial Tacit Jym
http://www.jsoftware.com/pipermail/programming/2016-March/044692.html
On Thu, Mar 10, 2016 at 9:49 AM, Raul Miller <[email protected]> wrote:
> Well... heading in the tacit direction there's this:
>
> NB. explicit verb
> ritemE=: 1 :0
> :
> x (I.m-:"_1 _ y)} m
> )
>
> NB. tacit verb
> ritemT=: 1 :0
> [`([:I. m -:"_1 _ ])`(m"_)}
> )
>
> NB. some sample data and tests
> C=:3 4$i.8
> A=:i.3 2 4
> assert 9 8 7 6 (C ritemE -: C ritemT) 0 1 2 3
> assert (100%i.2 4) (A ritemE -: A ritemT) 16+i.2 4
>
> But I do not think you can eliminate the 1 : without either
> significant verbosity or a modified interpreter.
>
> --
> Raul
>
> On Thu, Mar 10, 2016 at 1:59 AM, Ben Gorte - CITG
> <[email protected]> wrote:
> > I'm afraid I don't know how do this tacitly ...
> >
> > ritem =: 1 : (':' ; 'x (I.m-:"_1 _ y) } m')
> >
> > (2 4$0) (i.3 2 4) ritem 16+i.2 4
> > 'a' 'P&n&m&k&n&&l' ritem '&'
> >
> > ... but m is in its place and it doesn't box.
> >
> > Ben
> > ________________________________________
> > From: Programming [[email protected]] on behalf
> of Pascal Jasmin [[email protected]]
> > Sent: Thursday, March 10, 2016 00:57
> > To: [email protected]
> > Subject: Re: [Jprogramming] Replace Items
> >
> > moving around the m term to be the "searched". There's probably a
> better version that doesn't box.
> >
> >
> > ritem =: 1 : '(m -:"_ _1 ]) >@:({"0 1) (,&<~"_ _1)'
> > (2 4 $ 0) (16+i.2 4) ritem i. 3 2 4
> >
> >
> >
> > ----- Original Message -----
> > From: Kip Murray <[email protected]>
> > To: "[email protected]" <[email protected]>
> > Sent: Wednesday, March 9, 2016 5:26 PM
> > Subject: [Jprogramming] Replace Items
> >
> > Adverb ritem creates a verb which replaces by x items in array m
> that
> > match y
> >
> > Below are examples. How would you write the adverb? --Kip Murray
> >
> >
> > C
> > 0 1 2 3
> > 4 5 6 7
> > 0 1 2 3
> > 0 0 0 0 C ritem 0 1 2 3
> > 0 0 0 0
> > 4 5 6 7
> > 0 0 0 0
> > A
> > 0 1 2 3
> > 4 5 6 7
> >
> > 8 9 10 11
> > 12 13 14 15
> >
> > 16 17 18 19
> > 20 21 22 23
> > (2 4 $ 0) A ritem 16+i.2 4
> > 0 1 2 3
> > 4 5 6 7
> >
> > 8 9 10 11
> > 12 13 14 15
> >
> > 0 0 0 0
> > 0 0 0 0
> >
> >
> >
> >
> > --
> > Sent from Gmail Mobile
> > ----------------------------------------------------------------------
> > 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
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm