I see, thank you. I got confused because I was expecting a tacit verb; instead, I realized now, you provided a tacit combination of a tacit verb (anV) and an adverb (f2) coupled with a different syntax. The difficult problem, unless one is bending the rules (or in the border line of bending the rules), is to write a single tacit verb (f) that does the full job.
On Tue, Feb 3, 2015 at 7:37 PM, 'Pascal Jasmin' via Programming < [email protected]> wrote: > f2 =: @.0 2 > anV =: <@:((,'0') ,&< ]) > > +:`*:`(anV i.5) f2 > 0 2 4 6 8 > > > +/`*:`(anV i.5) f2 > 10 > > > > > ----- Original Message ----- > From: Jose Mario Quintana <[email protected]> > To: Programming forum <[email protected]> > Cc: > Sent: Tuesday, February 3, 2015 7:13 PM > Subject: Re: [Jprogramming] conjunction in tacit verb > > A test of the tacit solutions provided so far follows, > > NB. f0, my version... > > an=. <@:((,'0') ,&< ]) > Cloak=. ((5!:1)@:<'Cloak')Cloak=. (0:`)(,^:) > train=. (Cloak <'`:')&6 NB. `:6 verbalized > > ( f0=. train@:({.@:(0&({::)) ; an@:>@:{:) f. ) > ,^:(0:``:)&6@:({.@:(0&({::)) ; <@:((,'0') ,&< ])@:>@:{:) > > > NB. f1, Raul's version > fe=: 13 : 0 > '0:';<'@:';<((0;0){::y);<(,'"');<((,'0');1{::y);<((,'0');_) > ) > > ( f1=. ]^:] fe f. ) > ]^:] ('0:' ; [: < '@:' ; [: < ((0;0) {:: ]) ; [: < (,'"') ; [: < > (<(,'0');_) ;~ (,'0') ; 1 {:: ]) > > NB. f2, Pascal's version... > > Pascal, if you are listening, I had problems collecting the definitions > to produce your tacit solution. Can you do the honors? > > > NB. f3, Linda's version... > > ( f3=: 13 :'".(>0{>0{y),":i.$>1{y' ) > [: ". ([: > 0 { [: > 0 { ]) , [: ": [: i. [: $ [: > 1 { ] > > > > ( Y=. +:`*:;i.5 ) NB. Original sample data > ┌───────┬─────────┐ > │┌──┬──┐│0 1 2 3 4│ > ││+:│*:││ │ > │└──┴──┘│ │ > └───────┴─────────┘ > > f0 Y > 0 2 4 6 8 > f1 Y > 0 2 4 6 8 > f3 Y > 0 2 4 6 8 > > > ( Y=. (+/)`*:;i.5 ) > ┌────────────┬─────────┐ > │┌───────┬──┐│0 1 2 3 4│ > ││┌─┬───┐│*:││ │ > │││/│┌─┐││ ││ │ > │││ ││+│││ ││ │ > │││ │└─┘││ ││ │ > ││└─┴───┘│ ││ │ > │└───────┴──┘│ │ > └────────────┴─────────┘ > > f0 Y > 10 > f1 Y > 10 > > f3 Y > |domain error: f3 > | f3 Y > |[-0] > > ( Y=. (+:&>`*:;<5;6) ) > ┌───────────────┬─────┐ > │┌──────────┬──┐│┌─┬─┐│ > ││┌─┬──────┐│*:│││5│6││ > │││&│┌──┬─┐││ ││└─┴─┘│ > │││ ││+:│>│││ ││ │ > │││ │└──┴─┘││ ││ │ > ││└─┴──────┘│ ││ │ > │└──────────┴──┘│ │ > └───────────────┴─────┘ > > f0 Y > 10 12 > f1 Y > |length error: f1 > | f1 Y > |[-3] > > f3 Y > |domain error: f3 > | f3 Y > |[-0] > > > > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
