using a tacit version,

itemamend =: (([: ;/(,.i.@#))@:[ { ])"1 _


a cleaner "tacit" version of filtermod.  u implemented as monad

NB. v is filter func, u is func that modifies items. then modified items 
replaced in original. 
filtermod =: 2 : 'v itemamend ] ,: v # inv  [: u v # ]' 

NB. dyadic u
filtermodud =: 2 : 'v itemamend ] ,: v # inv  [ u v # ]' 



----- Original Message -----
From: R.E. Boss <[email protected]>
To: [email protected]
Cc: 
Sent: Saturday, July 12, 2014 5:35:06 AM
Subject: Re: [Jprogramming] speaking of amend...

I have itemamend in my startup to do this.

       0 1 1 itemamend i.2 3 2 
0  1
8  9
10 11

itemamend=: 4 : 'y {~ ;/(,.i.@#)x'"1 _


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 Kip Murray
> Sent: zaterdag 12 juli 2014 5:09
> To: [email protected]
> Subject: Re: [Jprogramming] speaking of amend...
> 
>    v =: (-. , ])@[ # ,/@]
>    0 1 1 v i. 2 3 2
>  0  1
>  8  9
> 10 11
> 
> On Friday, July 11, 2014, Linda Alvord <[email protected]> wrote:
> 
> > I made it too hard because I thought I had seen carriage returns.
> >
> >     f=: 13 :'(x}i.2 3){((*/0 1{$y),2)$,y'
> >    f
> > 4 : '(x}i.2 3){((*/0 1{$y),2)$,y'
> >    0 1 1 f i.2 3 2
> >  0  1
> >  8  9
> > 10 11
> >
> > Linda
> >
> > -----Original Message-----
> > From: [email protected] <javascript:;>
> > [mailto:[email protected] <javascript:;>] On
> > Behalf Of Linda Alvord
> > Sent: Friday, July 11, 2014 10:53 PM
> > To: [email protected] <javascript:;>
> > Subject: Re: [Jprogramming] speaking of amend...
> >
> >  I'm sure I'll learn lots of better ways than this.
> >
> >  f=: 13 :'3 1 2$,(x}i.2 3){((*/0 1{$y),2)$,y'
> >    f
> > 4 : '3 1 2$,(x}i.2 3){((*/0 1{$y),2)$,y'
> >
> >    0 1 1 f i.2 3 2
> >  0  1
> >
> >  8  9
> >
> > 10 11
> >
> > Linda
> >
> > -----Original Message-----
> > From: [email protected] <javascript:;>
> > [mailto:[email protected] <javascript:;>] On
> > Behalf Of 'Pascal
> > Jasmin' via Programming
> > Sent: Friday, July 11, 2014 8:57 PM
> > To: Programming forum
> > Subject: [Jprogramming] speaking of amend...
> >
> > what verb v (or I guess adverb is ok) could I use to get
> >
> > 0 1 1 v i. 2 3 2
> >
> > 0  1
> > 8  9
> > 10 11
> >
> >
> >     i.2 3 2
> >  0  1
> >  2  3
> >  4  5
> >  6  7
> >  8  9
> > 10 11
> > ----------------------------------------------------------------------
> > 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
> >
> 
> 
> --
> 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

Reply via email to