London.pm Dim sum Thursday 1pm: HK Diner

2008-12-16 Thread Léon Brocard
We've been out a bit west recently, so it's time to head back into
Chinatown and try a restaurant I've been meaning to visit.

London.pm dim sum is a social event where we meet up every Thursday at
1pm at a different Chinese restaurant, spend about an hour (and about
£10 cash) eating tasty dim sum (steamed and fried dumplings), then go
our separate ways.

HK Diner
22 Wardour Street
Chinatown,
London W1D 6QQ
Leicester Square Tube Station
http://maps.google.co.uk/maps?q=W1D6QQ
http://www.timeout.com/london/restaurants/reviews/9306.html
http://london.randomness.org.uk/wiki.cgi?HK_Diner%2C_W1D_6QJ

See you there!

Léon, London.pm Dim Sum Mandarin



Re: Perl Christmas Quiz

2008-12-16 Thread Abigail
On Mon, Dec 15, 2008 at 01:29:39PM +, Nicholas Clark wrote:
 On Mon, Dec 15, 2008 at 01:22:49PM +, Avleen Vig wrote:
  On Dec 15, 2008, at 10:04, James Laver james.la...@gmail.com wrote:
  
  On Sun, Dec 14, 2008 at 3:15 PM, Avleen Vig avl...@gmail.com wrote:
 
  In the spirit of sharing, I offer this solution, from your neighbours
  in the Python community:
  
  a = ['m', 'n', 'o', 'o', 'p', 'p', 'q']
  b = ['n', 'p', 'q', 'r', 'r', 's']
  
  def FindSetMatches(list1, list2):
  for i in set(list1).intersection(set(list2)):
print '%s min(%s, %s)' % (i, list1.count(i), list2.count(i))
 
  Plus I just wanted to be a snob with my four-line solution.
 
 Yes, but can Python do it in one line?
 
 (Sort of a serious question. Not knowing Python, but having this understanding
 that all constructions that C (etc) and Perl (etc) would delimit with {},
 Python does with whitespace indentation level, I'm figuring that some things
 in Python *have* to be done in multiple lines. For maintaining real world
 code, this is probably actually a feature, rather than a feature)


Putting the 'for' and the 'print' statement of the above program
on one line works fine in Python.

Not sure if there's a way to put the 'def' and the body of the sub
on the same line. Just removing the newline of the above program
gives a syntax error.


Abigail


Re: Regexps in 5.11 [was Re: Perl Christmas Quiz]

2008-12-16 Thread Nicholas Clark
On Tue, Dec 16, 2008 at 10:56:31AM +, Paul LeoNerd Evans wrote:
 On Fri, 12 Dec 2008 14:41:07 +
 Nicholas Clark n...@ccl4.org wrote:
 
  regexps internally became a first class concept in 5.11
 
 Oooh. I wonder, is that why my Devel::Refcount fails everywhere on 5.11,
 with wobblies about the reference count of qr//?

Yes, probably.
IIRC we think that it's a bug, but the same we hasn't yet found an I to
locate and fix it.

 but I'd love to get to the bottom of it. Do you know any writings or
 authoritative source on the changes?

Um. No. I did it. I didn't write anything down.
All I can say reliably is that it's some subset of the changes in

http://public.activestate.com/cgi-bin/perlbrowse?filename=regcomp.c%4032880show_filelog=Show+File+Log
http://public.activestate.com/cgi-bin/perlbrowse?filename=regexec.c%4032880show_filelog=Show+File+Log

for example http://public.activestate.com/cgi-bin/perlbrowse/p/32751

Nicholas Clark


Re: Perl Christmas Quiz

2008-12-16 Thread Paul Makepeace
On Mon, Dec 15, 2008 at 1:29 PM, Nicholas Clark n...@ccl4.org wrote:
 On Mon, Dec 15, 2008 at 01:22:49PM +, Avleen Vig wrote:
 On Dec 15, 2008, at 10:04, James Laver james.la...@gmail.com wrote:

 On Sun, Dec 14, 2008 at 3:15 PM, Avleen Vig avl...@gmail.com wrote:

 In the spirit of sharing, I offer this solution, from your neighbours
 in the Python community:
 
 a = ['m', 'n', 'o', 'o', 'p', 'p', 'q']
 b = ['n', 'p', 'q', 'r', 'r', 's']
 
 def FindSetMatches(list1, list2):
 for i in set(list1).intersection(set(list2)):
   print '%s min(%s, %s)' % (i, list1.count(i), list2.count(i))

 Plus I just wanted to be a snob with my four-line solution.

 Yes, but can Python do it in one line?

[(i,) * min(l1.count(i), l2.count(i)) for i in set(l1).intersection(set(l2))]

That produces an array of tuples of the repeated elements,

[('q',), ('p', 'p'), ('n',)]

A truly flat list is left as exercise (I battle with a reduce+lambda
hack but didn't quite win.)

P


 (Sort of a serious question. Not knowing Python, but having this understanding
 that all constructions that C (etc) and Perl (etc) would delimit with {},
 Python does with whitespace indentation level, I'm figuring that some things
 in Python *have* to be done in multiple lines. For maintaining real world
 code, this is probably actually a feature, rather than a feature)

 Nicholas Clark



Re: Perl Christmas Quiz

2008-12-16 Thread Paul LeoNerd Evans
On Fri, 12 Dec 2008 11:37:23 +
Joel Bernstein j...@fysh.org 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 string scalar values,
 so I'm wondering how exhaustive that list is...

Nono, this is an (incomplete) list of referant value types.

Variable types:

  my $scalar;
  my @array;
  my %hash;

Value types:

  undef
  non-reference; foo or 123 or 45.6
  reference:
[your list above]
GLOB

-- 
Paul LeoNerd Evans

leon...@leonerd.org.uk
ICQ# 4135350   |  Registered Linux# 179460
http://www.leonerd.org.uk/


signature.asc
Description: PGP signature


Regexps in 5.11 [was Re: Perl Christmas Quiz]

2008-12-16 Thread Paul LeoNerd Evans
On Fri, 12 Dec 2008 14:41:07 +
Nicholas Clark n...@ccl4.org wrote:

 regexps internally became a first class concept in 5.11

Oooh. I wonder, is that why my Devel::Refcount fails everywhere on 5.11,
with wobblies about the reference count of qr//?

E.g.

  http://www.nntp.perl.org/group/perl.cpan.testers/2008/08/msg2001061.html

I have a temporary hack on this currently:

SKIP: {
   if( $] = 5.011 ) {
  # Perl v5.11 seems to have odd behaviour with Regexp references. They 
start
  # off with a refcount of 2. Not sure if this is a bug in Perl, or my
  # assumption. Until P5P have worked it out, we'll skip this, but just 
print
  # a diagnostic
  diag( On Perl $], refcount(\$refs{Regexp}) is .refcount($refs{Regexp}) 
);
  skip Bleadperl, 1;
   }

   is( refcount($refs{Regexp}), 1, 'refcount(Regexp) is 1');
}

but I'd love to get to the bottom of it. Do you know any writings or
authoritative source on the changes?

-- 
Paul LeoNerd Evans

leon...@leonerd.org.uk
ICQ# 4135350   |  Registered Linux# 179460
http://www.leonerd.org.uk/


signature.asc
Description: PGP signature


Re: Perl Christmas Quiz

2008-12-16 Thread Peter Haworth
On Fri, 12 Dec 2008 16:13:18 +0100, =?ISO-8859-1?Q?Marcel_Gr=FCnauer?= wrote:
 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?

Or possibly o

-- 
Peter Haworth   p...@edison.ioppublishing.com
If you think the problem is bad now, just wait until we've solved it.
-- Arthur Kasspe


Re: Perl Christmas Quiz

2008-12-16 Thread Paul Makepeace
On Tue, Dec 16, 2008 at 2:12 PM, Avleen Vig avl...@gmail.com wrote:
 On Tue, Dec 16, 2008 at 11:35 AM, Paul Makepeace pa...@paulm.com wrote:
 Yes, but can Python do it in one line?

 [(i,) * min(l1.count(i), l2.count(i)) for i in set(l1).intersection(set(l2))]

 That produces an array of tuples of the repeated elements,

 [('q',), ('p', 'p'), ('n',)]

 A truly flat list is left as exercise (I battle with a reduce+lambda
 hack but didn't quite win.)

 I'm probably misunderstanding 'truly flat' but like this?
 [''.join(i) * min(l1.count(i), l2.count(i)) for i in
 set(l1).intersection(set(l2))]]

This concatenates the repeated elements into e.g. a single string. Try
adding some extra fields in your test data and you'll end up with
something like,

['q', 'pp', 'n']

rather than

['q', 'p', 'p', 'n']

Slightly oddly, IMO, python doesn't have a 'flatten' function.

P


Re: Perl Christmas Quiz

2008-12-16 Thread Paul LeoNerd Evans
On Mon, 15 Dec 2008 19:28:05 UT
Torsten Knorr create-s...@freenet.de wrote:

  Let them use other languages.
  We can improving it with Perl.
  In addition we are more flexible.

Soo close to Haiku:

  Let them use others
  We can improve it with Perl
  We're more flexible

-- 
Paul LeoNerd Evans

leon...@leonerd.org.uk
ICQ# 4135350   |  Registered Linux# 179460
http://www.leonerd.org.uk/


signature.asc
Description: PGP signature


Re: Perl Christmas Quiz

2008-12-16 Thread Avleen Vig
On Tue, Dec 16, 2008 at 11:35 AM, Paul Makepeace pa...@paulm.com wrote:
 Yes, but can Python do it in one line?

 [(i,) * min(l1.count(i), l2.count(i)) for i in set(l1).intersection(set(l2))]

 That produces an array of tuples of the repeated elements,

 [('q',), ('p', 'p'), ('n',)]

 A truly flat list is left as exercise (I battle with a reduce+lambda
 hack but didn't quite win.)

I'm probably misunderstanding 'truly flat' but like this?
[''.join(i) * min(l1.count(i), l2.count(i)) for i in
set(l1).intersection(set(l2))]]


Re: Perl Christmas Quiz

2008-12-16 Thread James Laver
On Tue, Dec 16, 2008 at 2:54 PM, Paul Makepeace pa...@paulm.com wrote:

 This concatenates the repeated elements into e.g. a single string. Try
 adding some extra fields in your test data and you'll end up with
 something like,

 ['q', 'pp', 'n']

 rather than

 ['q', 'p', 'p', 'n']

 Slightly oddly, IMO, python doesn't have a 'flatten' function.

 P


With all of these code-based things going on, I'm inclined to suggest
a more disturbing challenge - overcomplicating hello world

Here's my pitiful first attempt:

sub make_hello_sayer { sub { printf hello %s\n, shift; } }
my $sayer = make_hello_sayer();
$sayer-('world');

I'm looking forward to the first entry that combines regexen with some
sort of tie.

Let the games begin.

--James


Re: Perl Christmas Quiz

2008-12-16 Thread Nicholas Clark
On Tue, Dec 16, 2008 at 07:08:18PM +, James Laver wrote:

 With all of these code-based things going on, I'm inclined to suggest
 a more disturbing challenge - overcomplicating hello world

Cheap joke I know, but isn't the canonical example of this simply to write it
in Java?

What does the most golfed down Java implementation look like?

Nicholas Clark


Re: Perl Christmas Quiz

2008-12-16 Thread Greg McCarroll

On 16 Dec 2008, at 19:17, Nicholas Clark wrote:


On Tue, Dec 16, 2008 at 07:08:18PM +, James Laver wrote:


With all of these code-based things going on, I'm inclined to suggest
a more disturbing challenge - overcomplicating hello world


Cheap joke I know, but isn't the canonical example of this simply to  
write it

in Java?

What does the most golfed down Java implementation look like?



I think the OTT Perl example would have tied 'hello' and 'world'  
supply variables, would use autoloader to create the method, use a  
couple of Acme modules, a regex to correct the capitalisation and just  
to be really silly, it would use Catalyst and Moose ;-)


G.


Re: Perl Christmas Quiz

2008-12-16 Thread Ash Berlin


On 16 Dec 2008, at 19:26, Greg McCarroll wrote:


On 16 Dec 2008, at 19:17, Nicholas Clark wrote:


On Tue, Dec 16, 2008 at 07:08:18PM +, James Laver wrote:

With all of these code-based things going on, I'm inclined to  
suggest

a more disturbing challenge - overcomplicating hello world


Cheap joke I know, but isn't the canonical example of this simply  
to write it

in Java?

What does the most golfed down Java implementation look like?



I think the OTT Perl example would have tied 'hello' and 'world'  
supply variables, would use autoloader to create the method, use a  
couple of Acme modules, a regex to correct the capitalisation and  
just to be really silly, it would use Catalyst and Moose ;-)


G.


I'm sure you could do something even more foolish with Devel::Declare  
to make it just print barewords.




Re: Perl Christmas Quiz

2008-12-16 Thread Gianni Ceccarelli
On 2008-12-16 Nicholas Clark n...@ccl4.org wrote:
 Cheap joke I know, but isn't the canonical example of this simply to
 write it in Java?
 
 What does the most golfed down Java implementation look like?

class A{public static void main(String[]a){System.out.println(Hello World);}}

Save to a file called A.java, compile and run.

-- 
Dakkar - Mobilis in mobile
GPG public key fingerprint = A071 E618 DD2C 5901 9574
 6FE2 40EA 9883 7519 3F88
key id = 0x75193F88

It is well known that *things* from undesirable universes are always
seeking an entrance into this one, which is the psychic equivalent of
handy for the buses and closer to the shops.
-- Terry Pratchett, The Light Fantastic


Re: Perl Christmas Quiz

2008-12-16 Thread Roger Burton West
On Tue, Dec 16, 2008 at 07:26:50PM +, Greg McCarroll wrote:

I think the OTT Perl example would have tied 'hello' and 'world'  
supply variables, would use autoloader to create the method, use a  
couple of Acme modules, a regex to correct the capitalisation and just  
to be really silly, it would use Catalyst and Moose ;-)

Whereas the Web2.0 version displays whatever the previous user typed in
(with a round-cornered logo)?

R


Re: Perl Christmas Quiz

2008-12-16 Thread Philippe Bruhat (BooK)
On Tue, Dec 16, 2008 at 08:33:09PM +0100, Gianni Ceccarelli wrote:
 On 2008-12-16 Nicholas Clark n...@ccl4.org wrote:
  Cheap joke I know, but isn't the canonical example of this simply to
  write it in Java?
  
  What does the most golfed down Java implementation look like?
 
 class A{public static void main(String[]a){System.out.println(Hello 
 World);}}
  ^
Can't we even delete a single character from that big string? Maybe this one? ¦

-- 
 Philippe Bruhat (BooK)

 The learned man makes a mistake but once... but the truly stupid keep
 practicing until they get it right.
(Moral from Groo The Wanderer #75 (Epic))


Re: Perl Christmas Quiz

2008-12-16 Thread Ash Berlin


On 16 Dec 2008, at 21:48, Philippe Bruhat (BooK) wrote:


On Tue, Dec 16, 2008 at 08:33:09PM +0100, Gianni Ceccarelli wrote:

On 2008-12-16 Nicholas Clark n...@ccl4.org wrote:

Cheap joke I know, but isn't the canonical example of this simply to
write it in Java?

What does the most golfed down Java implementation look like?


class A{public static void main(String[]a) 
{System.out.println(Hello World);}}

 ^
Can't we even delete a single character from that big string? Maybe  
this one? ¦


hahahahah. Optional semi-colons in Java. Good one.


Re: Perl Christmas Quiz

2008-12-16 Thread Paul Makepeace
On Tue, Dec 16, 2008 at 9:48 PM, Philippe Bruhat (BooK)
philippe.bru...@free.fr wrote:
 On Tue, Dec 16, 2008 at 08:33:09PM +0100, Gianni Ceccarelli wrote:
 On 2008-12-16 Nicholas Clark n...@ccl4.org wrote:
  Cheap joke I know, but isn't the canonical example of this simply to
  write it in Java?
 
  What does the most golfed down Java implementation look like?

 class A{public static void main(String[]a){System.out.println(Hello 
 World);}}
  ^
 Can't we even delete a single character from that big string? Maybe this one? 
 ¦

; is a statement terminator, not a separator. Java inherits from C, not DWIM :-)


 --
  Philippe Bruhat (BooK)

  The learned man makes a mistake but once... but the truly stupid keep
  practicing until they get it right.
(Moral from Groo The Wanderer #75 (Epic))