Hi Linda,
The &. in the following sentence, unboxes and executes both the left and
right arguments, subtracts the right from the left, then formats and
reboxes them.
   (, {: -&.(".@>) {.)"1 E
Replacing &. with & and an explicit obverse
   (, {: <@":@-&(".@>) {.)"1 E
If we want to get rid of & then we have to apply the unbox and execute to
each of the arguments
   (, (".@>@{: <@":@- ".@>@{.))"1 E
If you want to replace the instances of @ then you'll end up with
   (, (([: ". [: > {:) ([: < [: ": -) [: ". [: > {.))"1 E
Or
   (, ([: < [: ": ([: ". [: > {:) - [: ". [: > {.))"1 E

As I said originally, if you want a simple answer (no conjunctions) then
you're probably better with a different approach, which I suspect will be
faster too because most operations act on all the rows at once.
   (] ,. [: 8!:0 [: (-/"1) _99 ". [: > 2 0 {"1 ]) E

Thanks

On Fri, Jul 8, 2016 at 4:01 AM, Linda A Alvord <[email protected]>
wrote:

> Ric,  How can I rep'ace  &.  In your portion of the code that dets the
> ages?  An inverse of ([:”.>).
>
>
>
> A=:'1809';'Philip St. George Cooke';'1895'
>
> B=:'1836';'Flora Cooke Stuart';'1923'
>
> C=:'1833';'Jeb Stuart';'1864'
>
> D=:'1834';'Jacob Sharpe';'1892'
>
> [E=:A,B,C,:D
>
> f5=:({:-&.([:".>) {.)"1
>
> f5 E
>
> ┌──┬──┬──┬──┐
>
> │86│87│31│58│
>
> └──┴──┴──┴──┘
>
> NB. u&.v y ↔ vi u v y
>
> NB. Inverse vi (([:".>)^:_1)
>
> g5=:({:(([:".>)^:_1)-([:".>) {.)"1
>
> g5 E
>
> |domain error: g5
>
> | g5 E
>
>
>
> Linda
>
>
>
> -----Original Message-----
> From: Programming [mailto:[email protected]] On
> Behalf Of Linda A Alvord
> Sent: Thursday, June 30, 2016 1:34 AM
> To: [email protected]
> Subject: Re: [Jprogramming] How many years did each person live?
>
>
>
> Ric, I guess it is like most issues.  You don't realize that you don't
> like how you did something until you try to do something else with it and
> you wish you had built it another way.  Until I want to take another step
> with this collection of data I guess I don't care. Sorry could come later.
>  That's part of the fun of using J.  You can knock down all the building
> blocks and start over.  Linda
>
>
>
> -----Original Message-----
>
> From: Programming [ <mailto:[email protected]>
> mailto:[email protected]] On Behalf Of Ric Sherlock
>
> Sent: Wednesday, June 29, 2016 11:53 PM
>
> To: Programming JForum
>
> Subject: Re: [Jprogramming] How many years did each person live?
>
>
>
> Hi Linda,
>
> Your original spec didn't include whether you wanted the answer to be
> numeric or character. Since the input data was character I decided to keep
> everything consistent. It is certainly simpler to leave it as numeric.
>
> Joe's approach of making each column a vector has a lot of benefits.
>
> Depending on how much processing you want to do.
>
>
>
> On Thu, Jun 30, 2016 at 2:09 PM, Linda A Alvord < <mailto:
> [email protected]> [email protected]>
>
> wrote:
>
>
>
> > RRic, Your solution is quite a bit simpler than mine! All data is
>
> > characters.  Linda
>
> >
>
> >
>
> > -----Original Message-----
>
> > From: Programming [ <mailto:[email protected]>
> mailto:[email protected]] On
>
> > Behalf Of Ric Sherlock
>
> > Sent: Tuesday, June 28, 2016 9:41 PM
>
> > To: Programming JForum
>
> > Subject: Re: [Jprogramming] How many years did each person live?
>
> >
>
> > Here is a reasonably concise one but I suspect not your preferred version
>
> >    f1=: (, {: -&.(" <mailto:.@%3e)%20%7b.)> .@>) {.)"1
>
> >    f1 E
>
> > ┌────┬───────────────────────┬────┬─────┐
>
> >
>
> > │1809│Philip St. George Cooke│1895│86   │
>
> >
>
> > ├────┼───────────────────────┼────┼─────┤
>
> >
>
> > │1836│Flora Cooke Stuart     │1923│87   │
>
> >
>
> > ├────┼───────────────────────┼────┼─────┤
>
> >
>
> > │1833│Jeb Stuart             │1864│31   │
>
> >
>
> > ├────┼───────────────────────┼────┼─────┤
>
> >
>
> > │1834│Jacob Sharpe           │189 │_1645│
>
> >
>
> > └────┴───────────────────────┴────┴─────┘
>
> >
>
> >
>
> > Here is a simpler explicit one.
>
> > f2=: 3 :'y ,. 8!:0 -/"1 (_99) ". > 2 0 {"1 y'
>
> >
>
> >
>
> > On Wed, Jun 29, 2016 at 12:45 PM, Linda A Alvord
>
> > < <mailto:[email protected]> [email protected]>
>
> > wrote:
>
> >
>
> > > Nowdefine a verb to add a 4th column of the life span of each person.
>
> > >
>
> > >
>
> > >
>
> > > A=:'1809';'Philip St. George Cooke';'1895'
>
> > >
>
> > >    B=:'1836';'Flora Cooke Stuart';'1923'
>
> > >
>
> > >    C=:'1833';'Jeb Stuart';'1864'
>
> > >
>
> > >    D=:'1834';'Jacob Sharpe';'189'
>
> > >
>
> > >    [E=:A,B,C,:D
>
> > >
>
> > > -----T-----------------------T----┐
>
> > > │1809│Philip St. George Cooke│1895│
>
> > > +----+-----------------------+----+
>
> > > │1836│Flora Cooke Stuart     │1923│
>
> > > +----+-----------------------+----+
>
> > > │1833│Jeb Stuart             │1864│
>
> > > +----+-----------------------+----+
>
> > > │1834│Jacob Sharpe           │189 │
>
> > > L----+-----------------------+-----
>
> > >
>
> > >
>
> > >
>
> > > Linda
>
> > >
>
> > >
>
> > >
>
> > > --------------------------------------------------------------------
>
> > > -- For information about J forums see
>
> > >  <http://www.jsoftware.com/forums.htm>
> http://www.jsoftware.com/forums.htm
>
> > ----------------------------------------------------------------------
>
> > For information about J forums see  <http://www.jsoftware.com/forums.htm>
> http://www.jsoftware.com/forums.htm
>
> > ----------------------------------------------------------------------
>
> > For information about J forums see  <http://www.jsoftware.com/forums.htm>
> http://www.jsoftware.com/forums.htm
>
> >
>
> ----------------------------------------------------------------------
>
> For information about J forums see  <http://www.jsoftware.com/forums.htm>
> http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
>
> For information about J forums see  <http://www.jsoftware.com/forums.htm>
> 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