[Israel.pm] Some Links Related to the Conference Today

Shlomi Fish shlomif at iglu.org.il
Mon Dec 31 12:43:34 PST 2007


Here are some links related to the conference which we attended today:

1. Sudoku - someone I talked with said he wrote a Sudoku solver in Perl. I 
told him that there were already several on CPAN:

* http://perl.abigail.be/Talks/Sudoku/HTML/solving-3.html
* http://search.cpan.org/search?mode=all&query=sudoku

In any case, Pinkhas wrote a Sudoku solver in JavaScript which he showed at 
the conference:

http://www.nisanov.com/sudoku/solver/suso.html

And Abigail wrote an (impractical) regex to solve Sudoku:

http://perl.abigail.be/Talks/Sudoku/HTML/title.html

Sudoku was shown to be NP-Complete for larger grids.

----------------

2. I noted that I don't play a lot of Sudoku, but I do play Nurikabe:

* http://en.wikipedia.org/wiki/Nurikabe
* http://www.logicgamesonline.com/nurikabe/

I thought of several strategies to solve it using software, but it seems like 
a difficult task to code logic similar to what human solvers can do. 

Nurikabe was also shown to be NP-Complete:

http://www.cs.umass.edu/%7Emcphailb/papers/2004nurikabeposter.pdf

----------------

3. My challenge to write a solver for a certain board of Sokoban I mentioned 
is at:

http://article.gmane.org/gmane.comp.lang.perl.qotw.discuss/2634

I'll publish my solution soon.

---------------

4. During his presentation I asked Gabor what will happen to 5.10's "state" 
variables in two different instances of the same closure function. So I built 
5.10.0 and ran the following script:

<<<<<<<<<<<<<
use strict;
use warnings;

use feature qw(:5.10);

sub counter1
{
    state $i = 0;
    return ++$i;
}

say "counter1() = ", counter1();
say "counter1() = ", counter1();

sub make_counter
{
    my $i = 0;
    return sub {
        return ++$i;
    };
}

my $c1 = make_counter();
my $c2 = make_counter();

say '$c1->() = ', $c1->();
say '$c2->() = ', $c2->();
say '$c1->() = ', $c1->();
say '$c2->() = ', $c2->();

sub make_state_counter
{
    return sub {
        state $i = 0;
        return ++$i;
    };
}

my $sc1 = make_state_counter();
my $sc2 = make_state_counter();

say '$sc1->() = ', $sc1->();
say '$sc2->() = ', $sc2->();
say '$sc1->() = ', $sc1->();
say '$sc2->() = ', $sc2->();

>>>>>>>>>>>>>>>

And it prints:

<<<<<<<<<<<<<<
counter1() = 1
counter1() = 2
$c1->() = 1
$c2->() = 1
$c1->() = 2
$c2->() = 2
$sc1->() = 1
$sc2->() = 1
$sc1->() = 2
$sc2->() = 2
>>>>>>>>>>>>>>

So it seems each instance of the closure has its own, distinct, state 
variable.

--------------------------

5. Telux - during the Tel Aviv Linux Club "Welcome to Linux" series, some 
people expressed interest in talks about the Linux/UNIX command line and 
about scripting.

We meet in Tel Aviv University. Can anyone here give such talks? I can help in 
the prepation. I'll also write a separate message with this offer.

-------------------

6. rpmdig - I discussed http://freshmeat.net/projects/rpmdig/ which is a tool 
to display recursive RPM dependencies. It's written in Perl, and among the 
gems of its code are:

* A commented out "use strict;" directive.

* The entire text of the GPLv3 licence placed inside the script, inside a huge 
single quotes string for the "display_license" function. (taking 32K out of 
the script's total 52K).

* The following loop:

<<<<<<<<
for (my $f=0; $f<=$#ARGV; $f++) {
  #$count+=1;
  if ("$ARGV[$f]" =~ /^((-q)|(--quiet))$/ ) {$vF=0; next;}
  if ("$ARGV[$f]" =~ /^((-v)|(--verbose))$/ ) {$vF=1; next;}
  if ("$ARGV[$f]" =~ /^((-vv)|(--veryverbose))$/ ) {$vF=2; next;}
  if ("$ARGV[$f]" =~ /^((-vvv)|(--debug))$/ ) {$vF=3; next;}
>>>>>>>>

----------------

7. perl5100delta which Gabor mentioned is available here:

http://search.cpan.org/~rgarcia/perl-5.10.0/pod/perl5100delta.pod

----------------

8. The necklaces of our identification tags read "O'Reilly GMT" which was also 
mentioned in the O'Reilly "New Books" booklet we received. Here it is:

http://www.oreillygmt.co.uk/

---------------

I hope you enjoyed the conference.

Regards,

	Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://www.shlomifish.org/

I'm not an actor - I just play one on T.V.



More information about the Perl mailing list