From perlmonger at pck.co.nz Tue Jul 4 02:45:41 2017 From: perlmonger at pck.co.nz (Peter Kelly) Date: Tue, 4 Jul 2017 21:45:41 +1200 Subject: [Wellington-pm] Combinatorics Message-ID: So, let me start with a confession - I stopped at sixth form maths. The programme I am trying to write this evening seeks to combine one element of set A, with one element of set B, one element of set C, etc. I don't know beforehand how many sets there will be. Each set has a different number of members. I need to test all the combinations, so that if we have sets A B C, and A has 2 items, B has 5 items, and C has 2 items, we end up with 2*5*2 combinations = 20. k possible combinations of items in a single set is conveniently available through Algorithm::Combinatorics. I've used that elsewhere in this programme but it doesn't seem to handle multiple sets. I've spent the last few hours on this, and have started a few ways. I have something written using recursion, tracking which sets have already been accessed using an arrayref, and passing around a hashref. But I am seriously bogged down in that "delete the code and start again" sort of way. Are there any better ideas that any of you can point me to? Thanks, Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at simon.green Tue Jul 4 03:00:18 2017 From: mail at simon.green (Simon Green) Date: Tue, 4 Jul 2017 22:00:18 +1200 Subject: [Wellington-pm] Combinatorics In-Reply-To: References: Message-ID: On 04/07/17 21:45, Peter Kelly wrote: > So, let me start with a confession - I stopped at sixth form maths. > > The programme I am trying to write this evening seeks to combine one > element of set A, with one element of set B, one element of set C, etc. > > I don't know beforehand how many sets there will be. Each set has a > different number of members. > > I need to test all the combinations, so that if we have sets A B C, and > A has 2 items, B has 5 items, and C has 2 items, we end up with 2*5*2 > combinations = 20. > > k possible combinations of items in a single set is conveniently > available through Algorithm::Combinatorics. I've used that elsewhere in > this programme but it doesn't seem to handle multiple sets. > > I've spent the last few hours on this, and have started a few ways. I > have something written using recursion, tracking which sets have already > been accessed using an arrayref, and passing around a hashref. But I am > seriously bogged down in that "delete the code and start again" sort of way. > > Are there any better ideas that any of you can point me to? Something like the below. I'm sure there is a more eloquent way to write it, but it does the job and sometimes that's good enough? -- Simon #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use 5.10.1; my @sets = ( [2,3,4], [3,4,5], [6,7,8], [10,12,13]); my @results = (); sub _combinate { my ($result, $group, $set, @sets) = @_; foreach my $item (@$set) { if (scalar(@sets)) { _combinate($result, [@$group, $item], @sets); } else { push @$result, [ @$group, $item ]; } } } _combinate(\@results, [], @sets); say Dumper(\@results); From perl at ewen.mcneill.gen.nz Tue Jul 4 14:08:11 2017 From: perl at ewen.mcneill.gen.nz (Ewen McNeill) Date: Wed, 5 Jul 2017 09:08:11 +1200 Subject: [Wellington-pm] Combinatorics In-Reply-To: References: Message-ID: <76e4dbf4-c8e7-d8b8-5283-3c37919872c5@ewen.mcneill.gen.nz> On 4/07/17 21:45, Peter Kelly wrote: > So, let me start with a confession - I stopped at sixth form maths. > > The programme I am trying to write this evening seeks to combine one > element of set A, with one element of set B, one element of set C, etc. So you want the Cross Product? http://search.cpan.org/~bdfoy/Set-CrossProduct-2.002/lib/Set/CrossProduct.pm (This is one of those times when "remembering what the thing you want is called" makes it _much_ easier to find :-) That module is the first Google hit for "perl cross product".) Ewen From perlmonger at pck.co.nz Tue Jul 4 23:40:59 2017 From: perlmonger at pck.co.nz (Peter Kelly) Date: Wed, 5 Jul 2017 18:40:59 +1200 Subject: [Wellington-pm] Combinatorics In-Reply-To: <76e4dbf4-c8e7-d8b8-5283-3c37919872c5@ewen.mcneill.gen.nz> References: <76e4dbf4-c8e7-d8b8-5283-3c37919872c5@ewen.mcneill.gen.nz> Message-ID: Ewen, Simon, thank you both very much. Ewen, as you say, much of the magic is in knowing what to search for. And Simon, for you, the magic is just being better at doing abstract things in your head than I am :-) P On 5 July 2017 at 09:08, Ewen McNeill wrote: > On 4/07/17 21:45, Peter Kelly wrote: > >> So, let me start with a confession - I stopped at sixth form maths. >> >> The programme I am trying to write this evening seeks to combine one >> element of set A, with one element of set B, one element of set C, etc. >> > > So you want the Cross Product? > > http://search.cpan.org/~bdfoy/Set-CrossProduct-2.002/lib/Set > /CrossProduct.pm > > (This is one of those times when "remembering what the thing you want is > called" makes it _much_ easier to find :-) That module is the first Google > hit for "perl cross product".) > > Ewen > > _______________________________________________ > Wellington-pm mailing list > Wellington-pm at pm.org > http://mail.pm.org/mailman/listinfo/wellington-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From grant at mclean.net.nz Mon Jul 10 16:25:58 2017 From: grant at mclean.net.nz (grant at mclean.net.nz) Date: Tue, 11 Jul 2017 11:25:58 +1200 (NZST) Subject: [Wellington-pm] Meeting this evening Message-ID: Hi Mongers The July meeting of Wellington Perl Mongers is on this evening - Tuesday July 11th. 6:00pm Tuesday 11th July 2017 Level 3, Catalyst House 150 Willis Street Wellington http://wellington.pm.org/ Sam Crawley will be doing a talk about his game "Crown of Conquest" which is a) written in Perl and b) Open Source. You can visit the game site here: https://crownofconquest.com/ Just a quick 'heads up' that the August meeting will be one week later than usual on the 15th (rather than the 8th). The local DevOps meetup requested the switch so that they can host some international speakers who are in town for ScaleConf - some of you may be interested in attending that session: https://www.meetup.com/Wellington-DevOps-Group/events/241268468/ Of course the up-side of this change is that if you were thinking about doing a talk at the August meeting now you have an extra week to prepare! See you this evening Grant From grant at mclean.net.nz Tue Jul 11 17:05:02 2017 From: grant at mclean.net.nz (Grant McLean) Date: Wed, 12 Jul 2017 12:05:02 +1200 Subject: [Wellington-pm] Meeting this evening In-Reply-To: References: Message-ID: <1499817902.12227.13.camel@mclean.net.nz> So what happened? What did I miss? Thanks very much Sam for volunteering to speak - I only wish I could have been there for the talk. ?My daughter will attest to the fact that I was still seething with rage when I got home - mostly over it now. Cheers Grant On Tue, 2017-07-11 at 11:25 +1200, grant at mclean.net.nz wrote: > Hi Mongers > > The July meeting of Wellington Perl Mongers is on this evening - > Tuesday July 11th. > > ????6:00pm Tuesday 11th July 2017 > ????Level 3, Catalyst House > ????150 Willis Street > ????Wellington > ????http://wellington.pm.org/ > > Sam Crawley will be doing a talk about his game "Crown of Conquest" > which is a) written in Perl and b) Open Source.??You can visit the > game > site here: https://crownofconquest.com/ > > Just a quick 'heads up' that the August meeting will be one week > later > than usual on the 15th (rather than the 8th).??The local DevOps > meetup > requested the switch so that they can host some international > speakers? > who are in town for ScaleConf - some of you may be interested in > attending that session: > > https://www.meetup.com/Wellington-DevOps-Group/events/241268468/ > > Of course the up-side of this change is that if you were thinking > about > doing a talk at the August meeting now you have an extra week to > prepare! > > See you this evening > Grant > _______________________________________________ > Wellington-pm mailing list > Wellington-pm at pm.org > http://mail.pm.org/mailman/listinfo/wellington-pm From sam at crawley.nz Tue Jul 11 17:15:57 2017 From: sam at crawley.nz (Sam Crawley) Date: Wed, 12 Jul 2017 12:15:57 +1200 Subject: [Wellington-pm] Meeting this evening In-Reply-To: <1499817902.12227.13.camel@mclean.net.nz> References: <1499817902.12227.13.camel@mclean.net.nz> Message-ID: The talk went pretty well, a lot of questions, no heckling and only minor jeering. You can look at the slides here: http://slides.com/sam_c/deck#/ Although most of the talk was looking at code, so the slides don't really tell you a lot. On 12 July 2017 at 12:05, Grant McLean wrote: > So what happened? What did I miss? > > Thanks very much Sam for volunteering to speak - I only wish I could > have been there for the talk. My daughter will attest to the fact that > I was still seething with rage when I got home - mostly over it now. > > Cheers > Grant > > > On Tue, 2017-07-11 at 11:25 +1200, grant at mclean.net.nz wrote: > > Hi Mongers > > > > The July meeting of Wellington Perl Mongers is on this evening - > > Tuesday July 11th. > > > > 6:00pm Tuesday 11th July 2017 > > Level 3, Catalyst House > > 150 Willis Street > > Wellington > > http://wellington.pm.org/ > > > > Sam Crawley will be doing a talk about his game "Crown of Conquest" > > which is a) written in Perl and b) Open Source. You can visit the > > game > > site here: https://crownofconquest.com/ > > > > Just a quick 'heads up' that the August meeting will be one week > > later > > than usual on the 15th (rather than the 8th). The local DevOps > > meetup > > requested the switch so that they can host some international > > speakers > > who are in town for ScaleConf - some of you may be interested in > > attending that session: > > > > https://www.meetup.com/Wellington-DevOps-Group/events/241268468/ > > > > Of course the up-side of this change is that if you were thinking > > about > > doing a talk at the August meeting now you have an extra week to > > prepare! > > > > See you this evening > > Grant > > _______________________________________________ > > Wellington-pm mailing list > > Wellington-pm at pm.org > > http://mail.pm.org/mailman/listinfo/wellington-pm > _______________________________________________ > Wellington-pm mailing list > Wellington-pm at pm.org > http://mail.pm.org/mailman/listinfo/wellington-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan.horne at redbone.co.nz Tue Jul 11 17:26:45 2017 From: dan.horne at redbone.co.nz (Dan Horne) Date: Wed, 12 Jul 2017 12:26:45 +1200 Subject: [Wellington-pm] Meeting this evening In-Reply-To: <1499817902.12227.13.camel@mclean.net.nz> References: <1499817902.12227.13.camel@mclean.net.nz> Message-ID: My boy enjoyed it. He immediately wanted to go home and start modding it, but I told him that he'd have to stop with that Python muck and start learning Perl. Thanks Sam On 12 July 2017 at 12:05, Grant McLean wrote: > So what happened? What did I miss? > > Thanks very much Sam for volunteering to speak - I only wish I could > have been there for the talk. My daughter will attest to the fact that > I was still seething with rage when I got home - mostly over it now. > > Cheers > Grant > > > On Tue, 2017-07-11 at 11:25 +1200, grant at mclean.net.nz wrote: > > Hi Mongers > > > > The July meeting of Wellington Perl Mongers is on this evening - > > Tuesday July 11th. > > > > 6:00pm Tuesday 11th July 2017 > > Level 3, Catalyst House > > 150 Willis Street > > Wellington > > http://wellington.pm.org/ > > > > Sam Crawley will be doing a talk about his game "Crown of Conquest" > > which is a) written in Perl and b) Open Source. You can visit the > > game > > site here: https://crownofconquest.com/ > > > > Just a quick 'heads up' that the August meeting will be one week > > later > > than usual on the 15th (rather than the 8th). The local DevOps > > meetup > > requested the switch so that they can host some international > > speakers > > who are in town for ScaleConf - some of you may be interested in > > attending that session: > > > > https://www.meetup.com/Wellington-DevOps-Group/events/241268468/ > > > > Of course the up-side of this change is that if you were thinking > > about > > doing a talk at the August meeting now you have an extra week to > > prepare! > > > > See you this evening > > Grant > > _______________________________________________ > > Wellington-pm mailing list > > Wellington-pm at pm.org > > http://mail.pm.org/mailman/listinfo/wellington-pm > _______________________________________________ > Wellington-pm mailing list > Wellington-pm at pm.org > http://mail.pm.org/mailman/listinfo/wellington-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sam at crawley.nz Tue Jul 11 17:33:39 2017 From: sam at crawley.nz (Sam Crawley) Date: Wed, 12 Jul 2017 12:33:39 +1200 Subject: [Wellington-pm] Meeting this evening In-Reply-To: References: <1499817902.12227.13.camel@mclean.net.nz> Message-ID: Good to hear. I'm happy to review pull requests, and release them onto the main game server if accepted. On 12 July 2017 at 12:26, Dan Horne wrote: > My boy enjoyed it. He immediately wanted to go home and start modding it, > but I told him that he'd have to stop with that Python muck and start > learning Perl. > > Thanks Sam > > On 12 July 2017 at 12:05, Grant McLean wrote: > >> So what happened? What did I miss? >> >> Thanks very much Sam for volunteering to speak - I only wish I could >> have been there for the talk. My daughter will attest to the fact that >> I was still seething with rage when I got home - mostly over it now. >> >> Cheers >> Grant >> >> >> On Tue, 2017-07-11 at 11:25 +1200, grant at mclean.net.nz wrote: >> > Hi Mongers >> > >> > The July meeting of Wellington Perl Mongers is on this evening - >> > Tuesday July 11th. >> > >> > 6:00pm Tuesday 11th July 2017 >> > Level 3, Catalyst House >> > 150 Willis Street >> > Wellington >> > http://wellington.pm.org/ >> > >> > Sam Crawley will be doing a talk about his game "Crown of Conquest" >> > which is a) written in Perl and b) Open Source. You can visit the >> > game >> > site here: https://crownofconquest.com/ >> > >> > Just a quick 'heads up' that the August meeting will be one week >> > later >> > than usual on the 15th (rather than the 8th). The local DevOps >> > meetup >> > requested the switch so that they can host some international >> > speakers >> > who are in town for ScaleConf - some of you may be interested in >> > attending that session: >> > >> > https://www.meetup.com/Wellington-DevOps-Group/events/241268468/ >> > >> > Of course the up-side of this change is that if you were thinking >> > about >> > doing a talk at the August meeting now you have an extra week to >> > prepare! >> > >> > See you this evening >> > Grant >> > _______________________________________________ >> > Wellington-pm mailing list >> > Wellington-pm at pm.org >> > http://mail.pm.org/mailman/listinfo/wellington-pm >> _______________________________________________ >> Wellington-pm mailing list >> Wellington-pm at pm.org >> http://mail.pm.org/mailman/listinfo/wellington-pm >> > > > _______________________________________________ > Wellington-pm mailing list > Wellington-pm at pm.org > http://mail.pm.org/mailman/listinfo/wellington-pm > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dan.horne at redbone.co.nz Tue Jul 11 17:49:25 2017 From: dan.horne at redbone.co.nz (Dan Horne) Date: Wed, 12 Jul 2017 12:49:25 +1200 Subject: [Wellington-pm] Meeting this evening In-Reply-To: References: <1499817902.12227.13.camel@mclean.net.nz> Message-ID: haha. You don't want to do that. He's only 10 and his ambitions are bigger than his abilities On 12 July 2017 at 12:33, Sam Crawley wrote: > Good to hear. I'm happy to review pull requests, and release them onto the > main game server if accepted. > > On 12 July 2017 at 12:26, Dan Horne wrote: > >> My boy enjoyed it. He immediately wanted to go home and start modding it, >> but I told him that he'd have to stop with that Python muck and start >> learning Perl. >> >> Thanks Sam >> >> On 12 July 2017 at 12:05, Grant McLean wrote: >> >>> So what happened? What did I miss? >>> >>> Thanks very much Sam for volunteering to speak - I only wish I could >>> have been there for the talk. My daughter will attest to the fact that >>> I was still seething with rage when I got home - mostly over it now. >>> >>> Cheers >>> Grant >>> >>> >>> On Tue, 2017-07-11 at 11:25 +1200, grant at mclean.net.nz wrote: >>> > Hi Mongers >>> > >>> > The July meeting of Wellington Perl Mongers is on this evening - >>> > Tuesday July 11th. >>> > >>> > 6:00pm Tuesday 11th July 2017 >>> > Level 3, Catalyst House >>> > 150 Willis Street >>> > Wellington >>> > http://wellington.pm.org/ >>> > >>> > Sam Crawley will be doing a talk about his game "Crown of Conquest" >>> > which is a) written in Perl and b) Open Source. You can visit the >>> > game >>> > site here: https://crownofconquest.com/ >>> > >>> > Just a quick 'heads up' that the August meeting will be one week >>> > later >>> > than usual on the 15th (rather than the 8th). The local DevOps >>> > meetup >>> > requested the switch so that they can host some international >>> > speakers >>> > who are in town for ScaleConf - some of you may be interested in >>> > attending that session: >>> > >>> > https://www.meetup.com/Wellington-DevOps-Group/events/241268468/ >>> > >>> > Of course the up-side of this change is that if you were thinking >>> > about >>> > doing a talk at the August meeting now you have an extra week to >>> > prepare! >>> > >>> > See you this evening >>> > Grant >>> > _______________________________________________ >>> > Wellington-pm mailing list >>> > Wellington-pm at pm.org >>> > http://mail.pm.org/mailman/listinfo/wellington-pm >>> _______________________________________________ >>> Wellington-pm mailing list >>> Wellington-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/wellington-pm >>> >> >> >> _______________________________________________ >> Wellington-pm mailing list >> Wellington-pm at pm.org >> http://mail.pm.org/mailman/listinfo/wellington-pm >> >> > > _______________________________________________ > Wellington-pm mailing list > Wellington-pm at pm.org > http://mail.pm.org/mailman/listinfo/wellington-pm > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sam at crawley.nz Tue Jul 11 17:50:48 2017 From: sam at crawley.nz (Sam Crawley) Date: Wed, 12 Jul 2017 12:50:48 +1200 Subject: [Wellington-pm] Meeting this evening In-Reply-To: References: <1499817902.12227.13.camel@mclean.net.nz> Message-ID: Hence the "if accepted" qualifier :) On 12 July 2017 at 12:49, Dan Horne wrote: > haha. You don't want to do that. He's only 10 and his ambitions are bigger > than his abilities > > On 12 July 2017 at 12:33, Sam Crawley wrote: > >> Good to hear. I'm happy to review pull requests, and release them onto >> the main game server if accepted. >> >> On 12 July 2017 at 12:26, Dan Horne wrote: >> >>> My boy enjoyed it. He immediately wanted to go home and start modding >>> it, but I told him that he'd have to stop with that Python muck and start >>> learning Perl. >>> >>> Thanks Sam >>> >>> On 12 July 2017 at 12:05, Grant McLean wrote: >>> >>>> So what happened? What did I miss? >>>> >>>> Thanks very much Sam for volunteering to speak - I only wish I could >>>> have been there for the talk. My daughter will attest to the fact that >>>> I was still seething with rage when I got home - mostly over it now. >>>> >>>> Cheers >>>> Grant >>>> >>>> >>>> On Tue, 2017-07-11 at 11:25 +1200, grant at mclean.net.nz wrote: >>>> > Hi Mongers >>>> > >>>> > The July meeting of Wellington Perl Mongers is on this evening - >>>> > Tuesday July 11th. >>>> > >>>> > 6:00pm Tuesday 11th July 2017 >>>> > Level 3, Catalyst House >>>> > 150 Willis Street >>>> > Wellington >>>> > http://wellington.pm.org/ >>>> > >>>> > Sam Crawley will be doing a talk about his game "Crown of Conquest" >>>> > which is a) written in Perl and b) Open Source. You can visit the >>>> > game >>>> > site here: https://crownofconquest.com/ >>>> > >>>> > Just a quick 'heads up' that the August meeting will be one week >>>> > later >>>> > than usual on the 15th (rather than the 8th). The local DevOps >>>> > meetup >>>> > requested the switch so that they can host some international >>>> > speakers >>>> > who are in town for ScaleConf - some of you may be interested in >>>> > attending that session: >>>> > >>>> > https://www.meetup.com/Wellington-DevOps-Group/events/241268468/ >>>> > >>>> > Of course the up-side of this change is that if you were thinking >>>> > about >>>> > doing a talk at the August meeting now you have an extra week to >>>> > prepare! >>>> > >>>> > See you this evening >>>> > Grant >>>> > _______________________________________________ >>>> > Wellington-pm mailing list >>>> > Wellington-pm at pm.org >>>> > http://mail.pm.org/mailman/listinfo/wellington-pm >>>> _______________________________________________ >>>> Wellington-pm mailing list >>>> Wellington-pm at pm.org >>>> http://mail.pm.org/mailman/listinfo/wellington-pm >>>> >>> >>> >>> _______________________________________________ >>> Wellington-pm mailing list >>> Wellington-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/wellington-pm >>> >>> >> >> _______________________________________________ >> Wellington-pm mailing list >> Wellington-pm at pm.org >> http://mail.pm.org/mailman/listinfo/wellington-pm >> >> > > _______________________________________________ > Wellington-pm mailing list > Wellington-pm at pm.org > http://mail.pm.org/mailman/listinfo/wellington-pm > > -------------- next part -------------- An HTML attachment was scrubbed... URL: