Re: Volunteers Wanted to Organise Future Social Meetings
On Fri, Nov 22, 2013 at 12:02:32PM +, Tom Hukins wrote: > So, I'm looking for volunteers. If you'd like to organise a future > meeting please contact me off-list. I'm happy to help if you'd like > to arrange a meeting but aren't sure what you need to do. Currently we have no volunteers, which prevents us from giving plenty of advance notice for our social meetings. Volunteering only requires you to organise one social meeting: it won't be a regular responsibility. I'd be really grateful if one or more people could offer to sort out our next few social meetings so I can focus on sorting out other interesting things I'm planning for our group. Please get in touch if you would like to organise a future social meeting. I'd be extremely grateful. Thanks, Tom
Re: Bug?
If the original list is 2 elements, it's 50:50 that you'll get the original back. Is that the problem? :) On 9 December 2013 11:49, Joel Bernstein wrote: > Assuming you didn't make a typo, don't forget that the original > configuration is one possible shuffling of the set... > > > On 9 December 2013 12:23, Kieren Diment wrote: > > > In a short subroutine, this: > > > > use List::Util qw/shuffle/; > > my @list = @{$self->answer_list_orig_order}; > > @list = shuffle @list if $self->random_order; > > return \@list; > > > > does what's expected. Returns the shuffled list. > > > > This: > > > > use List::Util qw/shuffle/; > > my @list = @{$self->answer_list_orig_order}; > > @list = shuffle @list if $self->random_order; > > return \@list > > > > returns the list unshuffled. > > > > What's up with that? > > > > > -- Jasper
Re: Bug?
Assuming you didn't make a typo, don't forget that the original configuration is one possible shuffling of the set... On 9 December 2013 12:23, Kieren Diment wrote: > In a short subroutine, this: > > use List::Util qw/shuffle/; > my @list = @{$self->answer_list_orig_order}; > @list = shuffle @list if $self->random_order; > return \@list; > > does what's expected. Returns the shuffled list. > > This: > > use List::Util qw/shuffle/; > my @list = @{$self->answer_list_orig_order}; > @list = shuffle @list if $self->random_order; > return \@list > > returns the list unshuffled. > > What's up with that? > >
Re: Bug?
Works for me.. I guess there's always a possibility 'shuffle' doesn't change the order or the elements. Maybe you're just very unlucky :) Or your 'random_order' function evaluates to false for some reason. J. On 9 December 2013 11:23, Kieren Diment wrote: > In a short subroutine, this: > > use List::Util qw/shuffle/; > my @list = @{$self->answer_list_orig_order}; > @list = shuffle @list if $self->random_order; > return \@list; > > does what's expected. Returns the shuffled list. > > This: > > use List::Util qw/shuffle/; > my @list = @{$self->answer_list_orig_order}; > @list = shuffle @list if $self->random_order; > return \@list > > returns the list unshuffled. > > What's up with that? -- Jerome Eteve +44(0)7738864546 http://www.eteve.net/
Re: Bug?
Kieren Diment said: use List::Util qw/shuffle/; my @list = @{$self->answer_list_orig_order}; @list = shuffle @list if $self->random_order; return \@list returns the list unshuffled. What's up with that? What does $self->random_order return in this case? - Salve (Oslo.pm) -- #!/usr/bin/env perl sub AUTOLOAD{$AUTOLOAD=~/.*::(\d+)/;seek(DATA,$1,0);print# Salve Joshua Nilsen getc DATA}$"="'};&{'";@_=unpack("C*",unpack("u*",':50,$'.# '3!=0"59,6!`%%P\0!1)46%!F.Q`%01,`'."\n"));eval "&{'@_'}"; __END__ is near! :)
Re: Bug?
On 09/12/13 11:23, Kieren Diment wrote: In a short subroutine, this: use List::Util qw/shuffle/; my @list = @{$self->answer_list_orig_order}; @list = shuffle @list if $self->random_order; return \@list; does what's expected. Returns the shuffled list. This: use List::Util qw/shuffle/; my @list = @{$self->answer_list_orig_order}; @list = shuffle @list if $self->random_order; return \@list returns the list unshuffled. What's up with that? So the difference is just the semicolon at the end? Works for me either way. $ perl -Mstrict -wE 'sub foo { my $self = shift; use List::Util qw/shuffle/; my @list = @{$self->answer_list_orig_order}; @list = shuffle @list if $self->random_order; return \@list;} sub answer_list_orig_order { [1 .. 10] } sub random_order { 1 } say for @{ main->foo } ' 5 10 4 2 9 3 7 1 8 6 $ perl -Mstrict -wE 'sub foo { my $self = shift; use List::Util qw/shuffle/; my @list = @{$self->answer_list_orig_order}; @list = shuffle @list if $self->random_order; return \@list} sub answer_list_orig_order { [1 .. 10] } sub random_order { 1 } say for @{ main->foo } ' 2 6 9 10 5 4 3 8 7 1 Matt
Re: Bug?
On Mon, Dec 09, 2013 at 10:23:28PM +1100, Kieren Diment wrote: > In a short subroutine, this: > > use List::Util qw/shuffle/; > my @list = @{$self->answer_list_orig_order}; > @list = shuffle @list if $self->random_order; > return \@list; > > does what's expected. Returns the shuffled list. > > This: > > use List::Util qw/shuffle/; > my @list = @{$self->answer_list_orig_order}; > @list = shuffle @list if $self->random_order; > return \@list > > returns the list unshuffled. > > What's up with that? You mean, the only difference is the lack of identation, and no trailing semi-colon? Am I missing anything? Are we missing any context? Abigail
Bug?
In a short subroutine, this: use List::Util qw/shuffle/; my @list = @{$self->answer_list_orig_order}; @list = shuffle @list if $self->random_order; return \@list; does what's expected. Returns the shuffled list. This: use List::Util qw/shuffle/; my @list = @{$self->answer_list_orig_order}; @list = shuffle @list if $self->random_order; return \@list returns the list unshuffled. What's up with that?