Re: [perl-python] combinatorics fun

2005-02-11 Thread bruno modulix
YYUsenet wrote: Xah Lee wrote: (snip insanities) Why are you posting this to comp.lang.python? This obviously has nothing to do with python at all. If you are trying to teach people python, claiming that "...let's do a python version. I'll post my version later today." Isn't really the proper

Re: [perl-python] combinatorics fun

2005-02-10 Thread Xah Lee
David Eppstein's code is very nice. Here's the python version of the perl code: ©# -*- coding: utf-8 -*- ©# Python © ©def combo (n): ©'''returns all possible (unordered) pairs out of n numbers 1 to n. © ©Returns a dictionary. The keys are of the form "n,m", ©and their values are tuple

Re: [perl-python] combinatorics fun

2005-02-10 Thread Haibao Tang
I am no longer resisting. As time goes, the nausea when I first saw Mr. Lee's smelly "technical posts" is starting to fade. The discussion group should have a high tolerance towards polymorphic people these days. -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] combinatorics fun

2005-02-10 Thread YYUsenet
Xah Lee wrote: a year ago i wrote this perl program as part of a larger program. as a exercise of fun, let's do a python version. I'll post my version later today. [code snipped] This is Perl-Python a-day. To subscribe, see http://xahlee.org/perl-python/python.html Xah [EMAIL PROTECTED] http://xah

Re: [perl-python] combinatorics fun

2005-02-10 Thread axel
In comp.lang.perl.misc Xah Lee <[EMAIL PROTECTED]> wrote: > a year ago i wrote this perl program as part of a larger program. > sub combo ($) { >my $max=$_[0]; >my %hh=(); >for (my $j=1; $j < $max; ++$j) { >for (my $i=1; $i <= $max; ++$i) { >my $m = (($i+$j)-1)%$ma

Re: [perl-python] combinatorics fun

2005-02-10 Thread Jack Diederich
On Thu, Feb 10, 2005 at 02:51:24PM -0800, Xah Lee wrote: > a year ago i wrote this perl program as part of a larger program. > > as a exercise of fun, let's do a python version. I'll post my version > later today. from probstat import Combination There is something deeply wrong about plugging yo

Re: [perl-python] combinatorics fun

2005-02-10 Thread David Eppstein
In article <[EMAIL PROTECTED]>, "Xah Lee" <[EMAIL PROTECTED]> wrote: > combo(n) returns a collection with elements of pairs that is all > possible combinations of 2 things from n. For example, combo(4) > returns {'3,4' => ['3',4],'1,2' => [1,2],'1,3' => [1,3],'1,4' => > [1,4],'2,3' => ['2',3],'2,

[perl-python] combinatorics fun

2005-02-10 Thread Xah Lee
a year ago i wrote this perl program as part of a larger program. as a exercise of fun, let's do a python version. I'll post my version later today. =pod combo(n) returns a collection with elements of pairs that is all possible combinations of 2 things from n. For example, combo(4) returns {'3,4