Re: Perl Christmas Quiz

2008-12-12 Thread Abigail
On Fri, Dec 12, 2008 at 10:13:51PM +, Nicholas Clark wrote: > On Fri, Dec 12, 2008 at 11:01:08PM +0100, Philip Newton wrote: > > On Fri, Dec 12, 2008 at 15:41, Nicholas Clark wrote: > > > What are the 7 classes of unquoted string that are not barewords. I think > > > it's > > > 7. It usually

Re: Perl Christmas Quiz

2008-12-12 Thread Nicholas Clark
On Fri, Dec 12, 2008 at 11:01:08PM +0100, Philip Newton wrote: > On Fri, Dec 12, 2008 at 15:41, Nicholas Clark wrote: > > What are the 7 classes of unquoted string that are not barewords. I think > > it's > > 7. It usually requires a Damian to remember them all. Most I can get. > > What are they

Re: Perl Christmas Quiz

2008-12-12 Thread Philip Newton
On Fri, Dec 12, 2008 at 15:41, Nicholas Clark wrote: > What are the 7 classes of unquoted string that are not barewords. I think it's > 7. It usually requires a Damian to remember them all. Most I can get. What are they then? I can only think of two off the top of my head - things before 'fat co

Re: Perl Christmas Quiz

2008-12-12 Thread Piers Cawley
On Fri, Dec 12, 2008 at 12:10 PM, Paul Makepeace wrote: > SPOILERS contd > > > On Fri, Dec 12, 2008 at 11:37 AM, Joel Bernstein wrote: >> 2008/12/12 Chris Jack : > >>> 3) Write a Perl function that takes two references to arrays and returns >>> the intersect of them. If an entry appears n times

Re: Perl Christmas Quiz

2008-12-12 Thread Marcel Grünauer
On Dec 12, 2008, at 4:09 PM, Aaron Trevena wrote: I'm dealing with a piece of production code featuring the variable $btchHash, it's a hash containing all the data used in several hundred lines of spaghetti code. even adding the missing vowell doesn't make it a helpful name. "i"? Marcel -

Re: Perl Christmas Quiz

2008-12-12 Thread Sue Spence
> yes. in san jose. i still have canvas bags from tpc1! > > rumor is tpc may be back in san jose due to outgrowing the portland > convention center. san jose has a large center opposite the > fairmont. the downside is that san jose is a very dull town (especially > compared to portland). you have t

Re: Perl Christmas Quiz

2008-12-12 Thread Uri Guttman
> "J" == Jasper writes: UG> sub intersect { >> >> return keys%{{map{$_,1}grep(${{map{$_=>1...@{$_[0]}}}{$_},@{$_[1]})}} ; J> Uri, I don't believe this does the right thing with regard to multiple J> occurrences of an entry in both arrays. I may be wrong. sub intersect {

Re: Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Andy Wardley
Nicholas Clark wrote: Have you tested your code with 5.8.9-RC2 yet? Just tried it now and it works OK. Do you think it's worth perlbugging for the record? Thanks everyone. It's a long time since I found a bug in perl! A

Re: TPC or not TPC

2008-12-12 Thread Uri Guttman
> "NC" == Nicholas Clark writes: NC> On Fri, Dec 12, 2008 at 11:32:55AM -0500, Uri Guttman wrote: >> rumor is tpc may be back in san jose due to outgrowing the portland >> convention center. san jose has a large center opposite the >> fairmont. the downside is that san jose is a very

TPC or not TPC (was Re: Perl Christmas Quiz)

2008-12-12 Thread Nicholas Clark
On Fri, Dec 12, 2008 at 11:32:55AM -0500, Uri Guttman wrote: > rumor is tpc may be back in san jose due to outgrowing the portland > convention center. san jose has a large center opposite the > fairmont. the downside is that san jose is a very dull town (especially > compared to portland). you ha

Re: Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Radoslaw Zielinski
Nicholas Clark [12-12-2008 18:11]: > On Fri, Dec 12, 2008 at 06:00:04PM +0100, Radoslaw Zielinski wrote: >> Andy Wardley [12-12-2008 17:38]: >> [...] >>> Before I go digging deeper (having already lost most of the afternoon to >>> this), can someone confirm the problem for me? >> I can't reproduc

Re: Perl Christmas Quiz

2008-12-12 Thread Jasper
2008/12/12 Uri Guttman : >> "UG" == Uri Guttman writes: > >> "CJ" == Chris Jack writes: > CJ> 3) Write a Perl function that takes two references to arrays and > CJ> returns the intersect of them. If an entry appears n times in > CJ> array 1 and m times in array 2, the output should lis

Re: Perl Christmas Quiz

2008-12-12 Thread Peter Corlett
On Fri, Dec 12, 2008 at 12:29:24PM -0500, Uri Guttman wrote: [...] > return keys%{{map{$_,1}grep(${{map{$_=>1...@{$_[0]}}}{$_},@{$_[1]})}} ; > it may not win in golf but it is a single expression/statement with no > declared variables so that should earn some points. i wouldn't call > multistateme

Re: Perl Christmas Quiz

2008-12-12 Thread Uri Guttman
> "DC" == Dave Cross writes: DC> Andy Wardley wrote: >> I can pick off a few of the easy ones. >> >> [SPOILERS] >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> DC> [ snip ] >>> 13) Think of a witty and/or interesting P

Re: Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Mark Blackman
On 12 Dec 2008, at 17:05, Mark Blackman wrote: On 12 Dec 2008, at 16:38, Andy Wardley wrote: I've got a *very* strange problem with Perl segfaulting seemingly at random, but quite predictably based on things that it really shouldn't care about (like comments). [snip] Before I go digging de

Re: Perl Christmas Quiz

2008-12-12 Thread Uri Guttman
> "UG" == Uri Guttman writes: > "CJ" == Chris Jack writes: CJ> 3) Write a Perl function that takes two references to arrays and CJ> returns the intersect of them. If an entry appears n times in CJ> array 1 and m times in array 2, the output should list that entry CJ> min(n,m) tim

Re: Perl Christmas Quiz

2008-12-12 Thread Abigail
On Fri, Dec 12, 2008 at 01:18:24PM +, Hakim Cassimally wrote: > On 12/12/2008, Paul Makepeace wrote: > > SPOILERS contd > > > >> 3) Write a Perl function that takes two references to arrays and returns > > >> the intersect of them. If an entry appears n times in array 1 and m > > >> times i

Re: Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Peter Corlett
On Fri, Dec 12, 2008 at 06:00:04PM +0100, Radoslaw Zielinski wrote: [...] > BTW, what's this? > $ tar tzf broken_glass.tgz | grep _ > ./._Broken.pm > ./._Glass.pm > ./._glass.t They're how MacOS resource forks are mapped onto a Unix filesystem.

Re: Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Nicholas Clark
On Fri, Dec 12, 2008 at 06:00:04PM +0100, Radoslaw Zielinski wrote: > Andy Wardley [12-12-2008 17:38]: > [...] > > Before I go digging deeper (having already lost most of the afternoon to > > this), can someone confirm the problem for me? > > I can't reproduce this on 5.8.8 @ 64bit Linux. Breaks

Re: Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Mark Blackman
On 12 Dec 2008, at 16:38, Andy Wardley wrote: I've got a *very* strange problem with Perl segfaulting seemingly at random, but quite predictably based on things that it really shouldn't care about (like comments). [snip] Before I go digging deeper (having already lost most of the afternoon to

Re: Perl Christmas Quiz

2008-12-12 Thread Uri Guttman
> "CJ" == Chris Jack writes: CJ> 3) Write a Perl function that takes two references to arrays and CJ> returns the intersect of them. If an entry appears n times in CJ> array 1 and m times in array 2, the output should list that entry CJ> min(n,m) times. Bonus mark for one line solutio

Re: Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Dominic Thoreau
> On Fri, Dec 12, 2008 at 04:38:07PM +, Andy Wardley wrote: > >>Before I go digging deeper (having already lost most of the afternoon to >>this), can someone confirm the problem for me? replicated on mine, also 5.8.8 Platform: osname=linux, osvers=2.6.18-53.1.4.el5.bz358661.1xen, archnam

Re: Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Radoslaw Zielinski
Andy Wardley [12-12-2008 17:38]: [...] > Before I go digging deeper (having already lost most of the afternoon to > this), can someone confirm the problem for me? I can't reproduce this on 5.8.8 @ 64bit Linux. BTW, what's this? $ tar tzf broken_glass.tgz | grep _ ./._Broken.pm ./._Glass.

Re: Perl Christmas Quiz

2008-12-12 Thread Jasper
2008/12/12 Peter Corlett : > On Fri, Dec 12, 2008 at 01:18:24PM +, Hakim Cassimally wrote: > [...] >> The question isn't specific about how the output should look if it a key >> doesn't appear in both arrays, or if n==m. > > It does. It asks for the "intersect", which is the set theory way of s

Re: Perl Christmas Quiz

2008-12-12 Thread Tara Andrews
What the hell, since we've spent the last few days arguing with each other about our (and Perl's) image to newcomers: On Fri, Dec 12, 2008 at 3:00 PM, Paul Makepeace wrote: > On Fri, Dec 12, 2008 at 2:24 PM, Robin Berjon wrote: >> On Dec 12, 2008, at 13:56 , Paul Makepeace wrote: >>> >>> Do not

Re: Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Roger Burton West
On Fri, Dec 12, 2008 at 04:38:07PM +, Andy Wardley wrote: >Before I go digging deeper (having already lost most of the afternoon to >this), can someone confirm the problem for me? Not manifest on my 5.8.8. Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform:

Perl 5.8.8 segfaulting on comments! How can this be?

2008-12-12 Thread Andy Wardley
I've got a *very* strange problem with Perl segfaulting seemingly at random, but quite predictably based on things that it really shouldn't care about (like comments). It's so weird that my first thought was that it was faulty memory in my machine. But I've tried it on two machines (both macs) a

Re: Perl Christmas Quiz

2008-12-12 Thread Aaron Trevena
2008/12/12 Aaron Trevena : > 2008/12/12 Paul Makepeace : >> Fair enough, and not the place to make comments. I think I've just had >> one too many interview candidates in recent memory who have named >> their functions "func" and used variable names like "foo", "bar", etc. > > I'm dealing with a pi

Re: Perl Christmas Quiz

2008-12-12 Thread Aaron Trevena
2008/12/12 Paul Makepeace : > Fair enough, and not the place to make comments. I think I've just had > one too many interview candidates in recent memory who have named > their functions "func" and used variable names like "foo", "bar", etc. I'm dealing with a piece of production code featuring th

Re: Perl Christmas Quiz

2008-12-12 Thread Paul Makepeace
On Fri, Dec 12, 2008 at 2:24 PM, Robin Berjon wrote: > On Dec 12, 2008, at 13:56 , Paul Makepeace wrote: >> >> On Fri, Dec 12, 2008 at 12:43 PM, Fahad Khan >> wrote: >>> >>> In my baby perl. >>> >>> sub intersect >>> { >>> my ($a, $b) = @_; >>> my ($c, $d) = ({}, []); >>> foreach (@$a) { $c->{

Re: london.pm.org web site - facelifted

2008-12-12 Thread Jonathan Stowe
2008/12/12 Léon Brocard : > 2008/12/11 Andy Wardley : > >> How about this? >> >> http://wardley.org/london.pm.org/ > > This is fantastic! > > I would like to point out that my orange is #FF9900, but that's very > close indeed. > > Andy, care to put your changes live? > And if you need any help wi

Re: Perl Christmas Quiz

2008-12-12 Thread Hakim Cassimally
On 12/12/2008, Peter Corlett wrote: > On Fri, Dec 12, 2008 at 02:15:49PM +, Hakim Cassimally wrote: > > On 12/12/2008, Peter Corlett wrote: > > [...] > > >> sub intersect{my%x;$x{$_}++for(@{+shift});grep{$x{$_}&&$x{$_}...@{+shift};} > > Gah of course: though you missed the min(n,m) requirem

Re: Perl Christmas Quiz

2008-12-12 Thread Nicholas Clark
On Fri, Dec 12, 2008 at 11:37:23AM +, Joel Bernstein wrote: > > 4) How many different variable types are there in Perl? Be as sensibly > > voluminous in your answer as you are able. > > SCALAR ARRAY HASH CODE > FileHandle DirHandle Regexp > > But clearly we distinguish between numeric and s

Re: london.pm.org web site - facelifted

2008-12-12 Thread Léon Brocard
2008/12/11 Andy Wardley : > How about this? > > http://wardley.org/london.pm.org/ This is fantastic! I would like to point out that my orange is #FF9900, but that's very close indeed. Andy, care to put your changes live? Léon

Re: Perl Christmas Quiz

2008-12-12 Thread Peter Corlett
On Fri, Dec 12, 2008 at 02:15:49PM +, Hakim Cassimally wrote: > On 12/12/2008, Peter Corlett wrote: [...] >> sub intersect{my%x;$x{$_}++for(@{+shift});grep{$x{$_}&&$x{$_}...@{+shift};} > Gah of course: though you missed the min(n,m) requirement. Are you sure? Really sure? The basic algorithm

Re: Perl Christmas Quiz

2008-12-12 Thread Robin Berjon
On Dec 12, 2008, at 13:56 , Paul Makepeace wrote: On Fri, Dec 12, 2008 at 12:43 PM, Fahad Khan wrote: In my baby perl. sub intersect { my ($a, $b) = @_; my ($c, $d) = ({}, []); foreach (@$a) { $c->{$_}->[0]++} foreach (@$b) { $c->{$_}->[1]++} while( my ($k, $v) = each %$c ) {

Re: Perl Christmas Quiz

2008-12-12 Thread David Cantrell
On Fri, Dec 12, 2008 at 12:10:19PM +, Paul Makepeace wrote: > sub intersect { > ... > } use Quantum::Superpositions;@int = eigenstates(all(any(@list1), any(@list2))); Actually, I have no idea whether it'll work for the case of repeated elements in the lists, but it's a cool solution anyway,

Re: Perl Christmas Quiz

2008-12-12 Thread Hakim Cassimally
On 12/12/2008, Peter Corlett wrote: > On Fri, Dec 12, 2008 at 01:18:24PM +, Hakim Cassimally wrote: > [...] > > > The question isn't specific about how the output should look if it a key > > doesn't appear in both arrays, or if n==m. > > > It does. It asks for the "intersect", which is the s

Re: Perl Christmas Quiz

2008-12-12 Thread Paul Fenwick
Chris Jack wrote: > I was feeling bored so decided to write a Perl Christmas quiz. [SPOILERS] All answers are from the top of my head, without any research > 1) Name as many different reasons as you can that Larry Wall has given > for how Perl came to be named (includi

Re: london.pm.org web site - facelifted

2008-12-12 Thread David Cantrell
On Fri, Dec 12, 2008 at 08:12:05AM +, Joel Bernstein wrote: > 2008/12/11 Dirk Koopman : > > Robin Berjon wrote: > > We need a more ecumenical colour. > So purple rather than the more pagan orange? Yes! We should use the appropriate liturgical colour for the season! This has the advantage that

Re: Perl Christmas Quiz

2008-12-12 Thread Peter Corlett
On Fri, Dec 12, 2008 at 01:18:24PM +, Hakim Cassimally wrote: [...] > The question isn't specific about how the output should look if it a key > doesn't appear in both arrays, or if n==m. It does. It asks for the "intersect", which is the set theory way of saying "those elements that appear in

Re: Perl Christmas Quiz

2008-12-12 Thread Hakim Cassimally
On 12/12/2008, Paul Makepeace wrote: > SPOILERS contd > >> 3) Write a Perl function that takes two references to arrays and returns > >> the intersect of them. If an entry appears n times in array 1 and m times > >> in array 2, the output should list that entry min(n,m) times. Bonus mark > >>

Re: Perl Christmas Quiz

2008-12-12 Thread Paul Makepeace
On Fri, Dec 12, 2008 at 12:43 PM, Fahad Khan wrote: > >> Date: Fri, 12 Dec 2008 12:10:19 + >> From: pa...@paulm.com >> To: london.pm@london.pm.org >> Subject: Re: Perl Christmas Quiz >> >> SPOILERS contd > >> >> This isn't a set question though. Sets have unique membership, >> >> stix:~$ perl

RE: Perl Christmas Quiz

2008-12-12 Thread Fahad Khan
> Date: Fri, 12 Dec 2008 12:10:19 + > From: pa...@paulm.com > To: london.pm@london.pm.org > Subject: Re: Perl Christmas Quiz > > SPOILERS contd > > This isn't a set question though. Sets have unique membership, > > stix:~$ perl -MSet::Scalar -le '$s = Set::Scalar->new(1,1); print > $s->el

Re: Perl Christmas Quiz

2008-12-12 Thread Paul Makepeace
SPOILERS contd On Fri, Dec 12, 2008 at 11:37 AM, Joel Bernstein wrote: > 2008/12/12 Chris Jack : >> 3) Write a Perl function that takes two references to arrays and returns the >> intersect of them. If an entry appears n times in array 1 and m times in >> array 2, the output should list that

Re: Perl Christmas Quiz

2008-12-12 Thread Paul Makepeace
On Fri, Dec 12, 2008 at 11:11 AM, Andy Wardley wrote: >> 13) Think of a witty and/or interesting Perl Christmas quiz question and >> answer it. > > The Fairmont Hotel. What was the question? Where did Paul meet his future Texan employer. (Correct!) P > > > A > > > >

Re: Perl Christmas Quiz

2008-12-12 Thread Joel Bernstein
2008/12/12 Chris Jack : > 2) Name all the built in file handles in Perl. STD(IN|OUT|ERR) ARGV ARGVOUT DATA > 3) Write a Perl function that takes two references to arrays and returns the > intersect of them. If an entry appears n times in array 1 and m times in > array 2, the output should list

Re: Perl Christmas Quiz

2008-12-12 Thread Dave Cross
Andy Wardley wrote: > I can pick off a few of the easy ones. > > [SPOILERS] > > > > > > > > > > > > > > > > > > [ snip ] >> 13) Think of a witty and/or interesting Perl Christmas quiz question >> and answer it. > > The Fairmont Hotel. What was the question? Where did the fir

Re: Perl Christmas Quiz

2008-12-12 Thread Dominic Thoreau
2008/12/12 Andy Wardley : > I can pick off a few of the easy ones. > > [SPOILERS] > > > > > > > > > > > > > > > > > > > >> 9) When will Perl 6 be released? And here I was, embittered after (some) years of tech support, and more of developing for in-house customers, thinking that the answer was: "J

Re: Perl Christmas Quiz

2008-12-12 Thread Andy Wardley
I can pick off a few of the easy ones. [SPOILERS] 6) What company was Larry Wall working for when he wrote Perl 1? JPL. 9) When will Perl 6 be released? Christmas 10) Who was the most important pioneer of Perl Poetry? Sharon Hopkins 13) Think of a witty and/or inte

Perl Christmas Quiz

2008-12-12 Thread Chris Jack
I was feeling bored so decided to write a Perl Christmas quiz. 1) Name as many different reasons as you can that Larry Wall has given for how Perl came to be named (including where he has given them). Make up a brand new reason of your own. 2) Name all the built in file handles in Perl. 3)

Re: london.pm.org web site - facelifted

2008-12-12 Thread Joel Bernstein
2008/12/11 Dirk Koopman : > Robin Berjon wrote: > We need a more ecumenical colour. So purple rather than the more pagan orange? /joel