The theorem that 2!y is equal to +/i.y is a special case of the more general theorem that (>:x)!y is equal to +/x!i.y
- Bo >________________________________ > Fra: Roger Hui <[email protected]> >Til: Programming forum <[email protected]> >Sendt: 16:41 torsdag den 6. juni 2013 >Emne: Re: [Jprogramming] Finding repeated substrings > > >There is a proof of a very similar theorem in section 1.4 of *Notation as a >Tool of Thought <http://www.jsoftware.com/papers/tot.htm>*. (The >difference is that index origin is 1 in the paper.) > > > >On Thu, Jun 6, 2013 at 6:44 AM, Raul Miller <[email protected]> wrote: > >> Caution: this code can give an incomplete result. For example, I do >> not believe it will find 'aabaab'. Rather than fix this, I'll defer to >> other solutions in this thread (which I imagine properly address this >> issue). >> >> If anyone wants to take this code and fix it, the first instance of 2 >> -~/\ ] should be replaced with a mechanism that treats all >> combinations of 2 (and not just adjacent pairs). >> >> (And on that note, I Tracy Harms recently directed my attention to a >> page with a beautiful proof that 2&! is +/@i. - that concept would be >> useful, here, I think. I wish I had recorded the url of that page. But >> the gist of my thought is that it should be possible to go from y and >> a member of i.2!y to a unique pair of two numbers in the range i.y, >> and that might be a nice way of implementing this "combinations of 2" >> function.) >> >> FYI, >> >> -- >> Raul >> >---------------------------------------------------------------------- >For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
