Here's a journey on the "scenic route":
f=: 13 :'(,:~(+: :: ])L:0)y'
]C=:f A
┌─┬─┬─┬──┐
│8│a│6│12│
├─┼─┼─┼──┤
│4│a│3│6 │
└─┴─┴─┴──┘
5!:4 <'f'
┌─ ~ ──── ,:
│ ┌─ +:
──┤ ┌─ :: ─┴─ ]
└─ L: ─┴─ 0
f
,:~ +: ::]L:0
5!:4 <'C'
── 2 4$8;'a';6;12;4;'a';3;6
C
┌─┬─┬─┬──┐
│8│a│6│12│
├─┼─┼─┼──┤
│4│a│3│6 │
└─┴─┴─┴──┘
B}C
┌─┬─┬─┬──┐
│4│a│3│12│
└─┴─┴─┴──┘
g=: 13 :'x } (,:~(+: :: ])L:0)y'
B g A
┌─┬─┬─┬──┐
│4│a│3│12│
└─┴─┴─┴──┘
g
4 : 'x } (,:~(+: :: ])L:0)y'
5!:4 <'g'
┌─ 4
── : ─┴─ ,:'x } (,:~(+: :: ])L:0)y'
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of R.E. Boss
Sent: Friday, March 28, 2014 1:57 PM
To: [email protected]
Subject: Re: [Jprogramming] apply verb to filtered list
Borrowing from Guinn:
1 0 1 0 } (,:~(+: :: ])L:0) 4;'a';3;6
+-+-+-+--+
|4|a|3|12|
+-+-+-+--+
R.E. Boss
(Add your info to http://www.jsoftware.com/jwiki/Community/Demographics )
> -----Original Message-----
> From: [email protected] [mailto:programming-
> [email protected]] On Behalf Of Pascal Jasmin
> Sent: vrijdag 28 maart 2014 2:27
> To: [email protected]
> Subject: Re: [Jprogramming] apply verb to filtered list
>
> found it:
>
> 1 0 1 (+:@:])^:[ each 4;'a'; 6
> ┌─┬─┬──┐
> │8│a│12│
> └─┴─┴──┘
>
> 1 0 1 ]`(+:@:])@.[ "0 ] 4 1 6
> 8 1 12
>
>
>
> ----- Original Message -----
> From: Pascal Jasmin <[email protected]>
> To: Programming forum <[email protected]>
> Cc:
> Sent: Thursday, March 27, 2014 8:17:06 PM
> Subject: [Jprogramming] apply verb to filtered list
>
> f =: 1 0 1
> list =: 2;'a';3
>
> as a simple example verb, +: is used. The verb is of no actual interest.
> Only
> the adverb.
>
> I would like an adverb that produces
>
> 4 1 6 -: 1 0 1 +: adv 2 1 3
> 1
>
> or more advanced,
>
> 4 ;'a'; 6 -: 1 0 1 +: adv 2;'a'; 3
>
> 1
>
> It is NOT AN OPTION to query the list as part of an each expression. Using
> the precalculated filter f is mandatory.
> ----------------------------------------------------------------------
> 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