Re: [perl-python] generic equivalence partition

2005-02-25 Thread Paul Moore
David Eppstein <[EMAIL PROTECTED]> writes: > In article <[EMAIL PROTECTED]>, > "Xah Lee" <[EMAIL PROTECTED]> wrote: > >> parti(aList, equalFunc) >> >> given a list aList of n elements, we want to return a list that is a >> range of numbers from 1 to n, partition by the predicate function of >> e

Re: [perl-python] generic equivalence partition

2005-02-24 Thread Michael Spencer
David Eppstein wrote: In article <[EMAIL PROTECTED]>, "Xah Lee" <[EMAIL PROTECTED]> wrote: given a list aList of n elements, we want to return a list that is a range of numbers from 1 to n, partition by the predicate function of equivalence equalFunc. In the worst case, this is going to have to

Re: [perl-python] generic equivalence partition

2005-02-24 Thread David Eppstein
In article <[EMAIL PROTECTED]>, David Eppstein <[EMAIL PROTECTED]> wrote: > def parti(aList,equalFunc): > eqv = [] > for i in range(len(aList)): > print i,eqv > for L in eqv: > if equalFunc(aList[i],aList[L[0]]): > L.append(i) >

Re: [perl-python] generic equivalence partition

2005-02-24 Thread David Eppstein
In article <[EMAIL PROTECTED]>, "Xah Lee" <[EMAIL PROTECTED]> wrote: > parti(aList, equalFunc) > > given a list aList of n elements, we want to return a list that is a > range of numbers from 1 to n, partition by the predicate function of > equivalence equalFunc. (a predicate function is a funct

Re: [perl-python] generic equivalence partition

2005-02-24 Thread John Machin
On Thu, 24 Feb 2005 17:48:47 -0800, Bryan <[EMAIL PROTECTED]> wrote: >Xah Lee wrote: >> another functional exercise with lists. >> >> Here's the perl documentation. I'll post a perl and the translated >> python version in 48 hours. >> >> =pod >> >> parti(aList, equalFunc) >> >> given a list aL

Re: [perl-python] generic equivalence partition

2005-02-24 Thread Bryan
Xah Lee wrote: another functional exercise with lists. Here's the perl documentation. I'll post a perl and the translated python version in 48 hours. =pod parti(aList, equalFunc) given a list aList of n elements, we want to return a list that is a range of numbers from 1 to n, partition by the pred

[perl-python] generic equivalence partition

2005-02-24 Thread Xah Lee
another functional exercise with lists. Here's the perl documentation. I'll post a perl and the translated python version in 48 hours. =pod parti(aList, equalFunc) given a list aList of n elements, we want to return a list that is a range of numbers from 1 to n, partition by the predicate funct