{.@\:~
----- Original Message -----
From: David Vaughan <[email protected]>
Date: Friday, September 16, 2011 15:55
Subject: Re: [Jprogramming] Consecutive Numbers in List
To: Programming forum <[email protected]>
> I'm trying to find the greatest row based on the left column.
> e.g.
>
> 1 2
> 2 5
> 4 17
> 6 41
> 1 3
> 1 5
> 3 23
> 5 53
> 1 7
> 3 31
> 1 11
> 3 41
> 1 13
> 1 17
>
> The row '6 41' would be the greatest. Using '>./' I get '6 53'.
> I've tried fiddling with the rank of '>./' but to no avail, and
> I've tried getting the index of the row, but since it isn't the
> full row, the index doesn't exist.
>
> On 16 Sep 2011, at 22:38, Raul Miller wrote:
>
> > Yes.
> >
> > --
> > Raul
> >
> > On Friday, September 16, 2011, David Vaughan
> <[email protected]>> wrote:
> >> So the 'verb' 1 applied to the noun results in 1 regardless
> of the noun?
> >>
> >> On 16 Sep 2011, at 19:53, Raul Miller wrote:
> >>
> >>> (0 0 -.~ #\\. ~.@:,.&, +/\\.) p:i.4
> >>> 1 2
> >>> 2 5
> >>> 3 10
> >>> 4 17
> >>> 1 3
> >>> 2 8
> >>> 3 15
> >>> 1 5
> >>> 2 12
> >>> 1 7
> >>> 1 p: (0 0 -.~ #\\. ~.@:,.&, +/\\.) p:i.4
> >>> 0 1
> >>> 1 1
> >>> 1 0
> >>> 0 1
> >>> 0 1
> >>> 1 0
> >>> 1 0
> >>> 0 1
> >>> 1 0
> >>> 0 1
> >>> (#~ 1 p: {:"1) (0 0 -.~ #\\. ~.@:,.&, +/\\.) p:i.4
> >>> 1 2
> >>> 2 5
> >>> 4 17
> >>> 1 3
> >>> 1 5
> >>> 1 7
> >>>
> >>> --
> >>> Raul
> >>>
> >>> On Fri, Sep 16, 2011 at 2:44 PM, David Vaughan
> >>> <[email protected]> wrote:
> >>>> Thanks, that's a great solution.
> >>>>
> >>>> I've got this set up:
> >>>>
> >>>> list
> >>>> 3 : '0 0-.~~.(,#\\.p:i.y),.,+/\\.p:i.y'
> >>>> list 4
> >>>> 1 2
> >>>> 2 5
> >>>> 3 10
> >>>> 4 17
> >>>> 1 3
> >>>> 2 8
> >>>> 3 15
> >>>> 1 5
> >>>> 2 12
> >>>> 1 7
> >>>>
> >>>> The left item is the number of primes needed to get the sum
> which is the
> > right item. I'm trying to filter out any rows where the right
> item is not
> > prime. Before, when I wasn't counting the number needed to get
> the sum, i.e.
> > I just had a list, I was using (1&p: # ]) to filter the non-
> prime values
> > out. But now with the extra rank I'm not quite sure how I can
> achieve the
> > same thing. So the desired result of 'list 4' is:
> >>>>
> >>>> list 4
> >>>> 1 2
> >>>> 2 5
> >>>> 4 17
> >>>> 1 3
> >>>> 1 5
> >>>> 1 7
> >>>>
> >>>> On 16 Sep 2011, at 18:53, Roger Hui wrote:
> >>>>
> >>>>> Prefixes of suffixes. Very neat.
> >>>>>
> >>>>> <\\. 'abcde'
> >>>>> ┌─┬──┬───┬────┬─────┐
> >>>>> │a│ab│abc│abcd│abcde│
> >>>>> ├─┼──┼───┼────┼─────┤
> >>>>> │b│bc│bcd│bcde│ │
> >>>>> ├─┼──┼───┼────┼─────┤
> >>>>> │c│cd│cde│ │ │
> >>>>> ├─┼──┼───┼────┼─────┤
> >>>>> │d│de│ │
> │ │
> >>>>> ├─┼──┼───┼────┼─────┤
> >>>>> │e│ │ │
> │ │
> >>>>> └─┴──┴───┴────┴─────┘
> >>>>>
> >>>>> Suffixes of prefixes will also work.
> >>>>>
> >>>>> <\.\ 'abcde'
> >>>>> ┌─────┬────┬───┬──┬─┐
> >>>>> │a │ │
> │ │ │
> >>>>> ├─────┼────┼───┼──┼─┤
> >>>>> │ab │b │ │ │ │
> >>>>> ├─────┼────┼───┼──┼─┤
> >>>>> │abc │bc │c │ │ │
> >>>>> ├─────┼────┼───┼──┼─┤
> >>>>> │abcd │bcd │cd │d │ │
> >>>>> ├─────┼────┼───┼──┼─┤
> >>>>> │abcde│bcde│cde│de│e│
> >>>>> └─────┴────┴───┴──┴─┘
> >>>>>
> >>>>>
> >>>>>
> >>>>> ----- Original Message -----
> >>>>> From: Marshall Lochbaum <[email protected]>
> >>>>> Date: Friday, September 16, 2011 10:44
> >>>>> Subject: Re: [Jprogramming] Consecutive Numbers in List
> >>>>> To: Programming forum <[email protected]>
> >>>>>
> >>>>>> ; <@:(+/\)\. p:i.4
> >>>>>> 2 5 10 17 3 8 15 5 12 7
> >>>>>>
> >>>>>> applies +/ on prefixes of suffixes.
> >>>>>>
> >>>>>> Marshall
> >>>>>>
> >>>>>> On Fri, Sep 16, 2011 at 12:59 PM, Roger Hui
> <[email protected]>>>>>>> wrote:
> >>>>>>> Multiple applications of the infix x +/\ y does the trick.
> >>>>>>>
> >>>>>>> f=: >:@i.@# +/\&.> <
> >>>>>>> f 2 3 5 7
> >>>>>>> ┌───────┬──────┬─────┬──┐
> >>>>>>> │2 3 5 7│5 8 12│10 15│17│
> >>>>>>> └───────┴──────┴─────┴──┘
> >>>>>>> g=: ;@f
> >>>>>>> g 2 3 5 7
> >>>>>>> 2 3 5 7 5 8 12 10 15 17
> >>>>>>>
> >>>>>>> The results of f are the 1-, 2-, 3-, and 4-infix sums.
> >>
> > ---------------------------------------------------------------
> -------
> > 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