Re: combinations & permutation : how to generate a list of numbers

2011-05-05 Thread fakessh
Le jeudi 5 mai 2011 18:43, Paul Johnson a écrit : > On Thu, May 05, 2011 at 08:20:13AM -0700, eventual wrote: > > Hi, Concerning the game Lotto, how do I generate a list of 6 numbers out > > of 12 numbers,  eg > > > > given the 12 numbers as 1,2,3,4,5,6,7,8,9,10,11,12 > > the list of 6 numbers goes

Re: combinations & permutation : how to generate a list of numbers

2011-05-05 Thread Paul Johnson
On Thu, May 05, 2011 at 08:20:13AM -0700, eventual wrote: > Hi, Concerning the game Lotto, how do I generate a list of 6 numbers out of > 12 > numbers,  eg > > given the 12 numbers as 1,2,3,4,5,6,7,8,9,10,11,12 > the list of 6 numbers goes like this :- > 1,2,3,4,5,6 > 1,2,3,4,5,7 > 1,2,3,4,5,8

combinations & permutation : how to generate a list of numbers

2011-05-05 Thread eventual
Hi, Concerning the game Lotto, how do I generate a list of 6 numbers out of 12 numbers,  eg given the 12 numbers as 1,2,3,4,5,6,7,8,9,10,11,12 the list of 6 numbers goes like this :- 1,2,3,4,5,6 1,2,3,4,5,7 1,2,3,4,5,8 1,2,3,4,5,9 1,2,3,4,5,10 . etc etc Thanks

Re: combinations

2008-10-07 Thread Jenda Krynicky
From: Ryan <[EMAIL PROTECTED]> > While I agree that it would be a good homework assignment it's not. > What I have is a logic look up table for health records using an EAV > model (in an SQL table): > > rowID - key - value > > From a web form I select some keys and values. When subm

Re: combinations

2008-10-07 Thread Paul Johnson
On Mon, Oct 06, 2008 at 08:32:22PM -0400, Stephen Gallagher wrote: > I can come up with one example where this might be interesting. Imagine you > are a software tester and were tasked with identifying all potential > variable combinations that needed to be covered/tested. Risk m

Re: combinations

2008-10-07 Thread Stephen Gallagher
- Original Message - From: "Jason Trebilcock" <[EMAIL PROTECTED]> To: "Perl Beginners" Sent: Monday, October 6, 2008 7:57:23 PM GMT -05:00 US/Canada Eastern Subject: RE: combinations -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: M

Re: combinations

2008-10-06 Thread Ryan
e" of glob the same way you treat: my $foo if 0; and those stupid: perl -e ' ... }{ ...' tricks, as in, it works for now, but I wouldn't promise it in the future. As in, my answer started with a joke. Hence the smiley. But I did have a puzzling question about

RE: combinations

2008-10-06 Thread Jason Trebilcock
-Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2008 12:37 PM To: Perl Beginners Cc: Randal L. Schwartz; Mr. Shawn H. Corey Subject: Re: combinations What are the real-world problems that are solved using a list of combinations of sets of items

Re: combinations

2008-10-06 Thread Randal L. Schwartz
> "Rob" == Rob Dixon <[EMAIL PROTECTED]> writes: Rob> The homework aroma entices me to respond with another question - Rob> hopefully an educational one. I hadn't thought of watermarking them Rob> though - good idea :) I didn't come up with the watermark idea. Can't remember where I saw it..

Re: combinations

2008-10-06 Thread Rob Dixon
Randal L. Schwartz wrote: >> "Peter" == Peter Scott <[EMAIL PROTECTED]> writes: > > Peter> Did you see the smiley? Randal might have been more inclined to give a > Peter> less cute answer if the poster said what he wanted this for, because it > Peter> does sound like homework. > > Precisely.

Re: combinations

2008-10-06 Thread Rob Dixon
Mr. Shawn H. Corey wrote: > On Mon, 2008-10-06 at 09:02 -0700, Randal L. Schwartz wrote: >> >> As in, my answer started with a joke. Hence the smiley. But I did have a >> puzzling question about this recurring need for "all combinations" and >> always state

Re: combinations

2008-10-06 Thread Rob Dixon
gt; and those stupid: > > perl -e ' ... }{ ...' > > tricks, as in, it works for now, but I wouldn't promise it in the future. > > As in, my answer started with a joke. Hence the smiley. But I did have a > puzzling question about this recurring need for

Re: combinations

2008-10-06 Thread Mr. Shawn H. Corey
On Mon, 2008-10-06 at 09:02 -0700, Randal L. Schwartz wrote: > As in, my answer started with a joke. Hence the smiley. But I did > have a > puzzling question about this recurring need for "all combinations" and > always > stated rather abstractly, without the real

Re: combinations

2008-10-06 Thread Randal L. Schwartz
> "Peter" == Peter Scott <[EMAIL PROTECTED]> writes: Peter> Did you see the smiley? Randal might have been more inclined to give a Peter> less cute answer if the poster said what he wanted this for, because it Peter> does sound like homework. Precisely. If it smells like homework to me, I t

Re: combinations

2008-10-06 Thread Randal L. Schwartz
, but I wouldn't promise it in the future. As in, my answer started with a joke. Hence the smiley. But I did have a puzzling question about this recurring need for "all combinations" and always stated rather abstractly, without the real-world need backing it up. -- Randal

Re: combinations

2008-10-06 Thread Peter Scott
On Sun, 05 Oct 2008 19:06:35 -0400, Mr. Shawn H. Corey wrote: > On Sun, 2008-10-05 at 15:11 -0700, Randal L. Schwartz wrote: >> my @result = map [split /-/], glob "{a}-{b,c}-{d,e,f}-{a}"; >> >> :-) >> >> But seriously, why does this come up often? > > Because your solution relies on knowledge of

Re: combinations

2008-10-06 Thread Rob Dixon
Mr. Shawn H. Corey wrote: > On Sun, 2008-10-05 at 21:30 -0700, Randal L. Schwartz wrote: >> >> Eh? My question has *nothing* to do with my solution. My question >> has to do with the original question. > > And my question is why isn't these abilities of glob described in > perldoc? They are des

Re: combinations

2008-10-06 Thread Mr. Shawn H. Corey
On Sun, 2008-10-05 at 21:30 -0700, Randal L. Schwartz wrote: > Eh? My question has *nothing* to do with my solution. My question > has to do with the original question. And my question is why isn't these abilities of glob described in perldoc? -- Just my 0.0002 million dollars worth, Sh

Re: combinations

2008-10-05 Thread Randal L. Schwartz
> "Shawn" == Shawn H Corey <[EMAIL PROTECTED]> writes: Shawn> Because your solution relies on knowledge of bash which many Windows Shawn> users do not have. Eh? My question has *nothing* to do with my solution. My question has to do with the original question. -- Randal L. Schwartz - Ston

Re: combinations

2008-10-05 Thread Mr. Shawn H. Corey
On Sun, 2008-10-05 at 15:11 -0700, Randal L. Schwartz wrote: > my @result = map [split /-/], glob "{a}-{b,c}-{d,e,f}-{a}"; > > :-) > > But seriously, why does this come up often? Because your solution relies on knowledge of bash which many Windows users do not have. Also this ability of glob is

Re: combinations

2008-10-05 Thread Randal L. Schwartz
>>>>> "Ryan" == Ryan <[EMAIL PROTECTED]> writes: Ryan> my %data = ( Ryan> k1 => 'a', Ryan> k2 => ['b', 'c'], Ryan> k3 => ['d', 'e', 'f'] Ryan> k4 => 'a' Rya

Re: combinations

2008-10-05 Thread Mr. Shawn H. Corey
On Sun, 2008-10-05 at 17:33 -0400, Mr. Shawn H. Corey wrote: > sub combos { > my %data = @_; > my @keys = sort keys %data; > > return _combos( [EMAIL PROTECTED], %data ); > } > First correction: sub combos { my %data = @_; my @keys = keys %data; return _combos( [EMAIL PROTECTED], %

Re: combinations

2008-10-05 Thread Mr. Shawn H. Corey
On Sun, 2008-10-05 at 15:29 -0500, Ryan wrote: > my %data = ( > k1 => 'a', > k2 => ['b', 'c'], > k3 => ['d', 'e', 'f'] > k4 => 'a' > ); > > I want to get all the po

combinations

2008-10-05 Thread Ryan
my %data = ( k1 => 'a', k2 => ['b', 'c'], k3 => ['d', 'e', 'f'] k4 => 'a' ); I want to get all the possible combinations: k1 => a k2 => b k3 => d k4 => a k1 => a k

Re: combinations

2003-08-14 Thread Rob Dixon
sh of arrays > equivalent to a 122 x 6152 matrix that I want to run > in 'pairwise combinations' and execute the 'sum of the > difference squares' for each combination. > > In other words: > columns: y1...y122 > rows: x1...x6152 > > so... > com

Re: combinations

2003-08-14 Thread david
sh of arrays > equivalent to a 122 x 6152 matrix that I want to run > in 'pairwise combinations' and execute the 'sum of the > difference squares' for each combination. > > In other words: > columns: y1...y122 > rows: x1...x6152 > > so... > com

combinations

2003-08-04 Thread David Byrne
I am fairly new to Perl and haven't approached a scipt this complex or computation this intensive. So I would certainly appreciate any advice. I have successfully created a hash of arrays equivalent to a 122 x 6152 matrix that I want to run in 'pairwise combinations' and execute

RE: regex to capture all combinations of .. and [ ]

2003-02-28 Thread Mark Anderson
> This (perl -n -we 'print if /[\[\].]{2}/;' file) almost did the trick, but > it was also picking up lines with many .. or many flanked > in between something. So I ammended it to (as there is always a space > between the characters I am trying to pull out): > > perl -n -we 'p

Re: regex to capture all combinations of .. and [ ]

2003-02-27 Thread Aimal Pashtoonmal
re what you want but: > > > > > > /[\[\].]{2}/ > > > > > > will match any combination of two .[] > > > > > > /Stefan > > > > > > Aimal Pashtoonmal wrote: > > > > > > > > Hello, > > > > &g

Re: regex to capture all combinations of .. and [ ]

2003-02-27 Thread Stefan Lidman
Hello I am not sure what you want but: /[\[\].]{2}/ will match any combination of two .[] /Stefan Aimal Pashtoonmal wrote: > > Hello, > > I am trying to use command line grep and perl regex to capture all > combinations of the following, but I am not getting everything:

RE: regex to capture all combinations of .. and [ ]

2003-02-27 Thread Aimal Pashtoonmal
Hello, I am trying to use command line grep and perl regex to capture all combinations of the following, but I am not getting everything: somethingdigits/digits digitsdigits..digits digits..digitsdigits.digits somethingdigits/digits digitsdigits