[Purdue-pm] perl quotw

Michael Gribskov gribskov at purdue.edu
Wed Mar 24 08:59:15 PDT 2010


here is a test program you might use.  the data, if i did it right has 
all possible transitions from singleton to singleton, singleton to 
range, range to range, and range to singleton
use strict;

my @datalist = (    [],
                    [1, 4, 5, 6, 9, 13, 21, 22, 23, 25, 26, 27],
                    [1, 2, 3, 5, 6, 7, 9, 13, 15, 16, 17, 27],
                    [-27, -17, -16, -15, -13, -9, -7, -6, -5, -3, -2, -1],
                    [-27, -26, -25, -23, -22, -21, -13, -9, -6, -5, -4, -1],
                    [-8, -6, -5, -4, 9, 13, 21, 22, 23, 25, 26, 27],
                    [-6, -5, -4, 5, 6, 7, 9, 13, 15, 16, 17, 27],
                    [-8, -6, -5, -4, 0, 9, 13, 21, 22, 23, 25, 26, 27],
                    [-6, -5, -4, 5, 9, 6, 7, 9, 13, 15, 16, 17, 27]
                   
               );
              
my @datacomment = ( 'null list',
                    'begins with singleton, ends with range',
                    'begins with range, ends with singleton',
                    'negative numbers, begin with singleton, end with 
range',
                    'negative numbers, begin with range, end with 
singleton',
                    'negative & positive numbers, begin with singleton, 
end with range',
                    'negative & positive numbers, begin with range, end 
with singleton',
                    'negative & positive numbers & zero, begin with 
singleton, end with range',
                    'negative & positive numbers & zero, begin with 
range, end with singleton',
                  );
foreach my $d ( 0 .. $#datalist ) {
   
    my @data = @{$datalist[$d]};
    print "\ntest $d: $datacomment[$d]\n";
    print "    data = [ @data ]\n";
   
    print "      original number list: @data\n";
   
    my $numstring = formatNumberList( @data );
    print "     formatted number list: $numstring\n";
   
    my @newlist = expandNumberList( $numstring );
    print "    converted back to list: @newlist\n";

}


Joe Kline wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I forgot to add some links to the discussion thread.
>
> General quiz questions and possible problem with current quiz
> http://article.gmane.org/gmane.comp.lang.perl.qotw.discuss/719
>
> Re: General quiz questions and possible problem with current quiz
> http://article.gmane.org/gmane.comp.lang.perl.qotw.discuss/722
>
> Re: General quiz questions and possible problem with current quiz
> http://article.gmane.org/gmane.comp.lang.perl.qotw.discuss/720
>
> Re: General quiz questions and possible problem with current quiz
> http://article.gmane.org/gmane.comp.lang.perl.qotw.discuss/725
>
>
>
> General quiz questions and possible problem with current quiz
>
> http://news.gmane.org/gmane.comp.lang.perl.qotw.discuss
>
> The week 6 discussion is in page 11.
>
> joe
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.5 (GNU/Linux)
> Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org
>
> iD8DBQFLqiqAb0mzA2gRTpkRArvFAJ95Pad2Iqx/+dO1XjvGj0jFpztb/wCfVyBU
> b6t6qItdwBa//Eb/kZdxkFQ=
> =/g2R
> -----END PGP SIGNATURE-----
> _______________________________________________
> Purdue-pm mailing list
> Purdue-pm at pm.org
> http://mail.pm.org/mailman/listinfo/purdue-pm
>   


-- 
Michael Gribskov
Hockmeyer Hall of Structural Biology
Purdue University
240 S. Martin Jischke Drive
West Lafayette, IN 47907

gribskov at purdue.edu     vox: 765.494.6933     fax: 765.496-1189
calendar: http://www.google.com/calendar/embed?src=mgribskov%40gmail.com






More information about the Purdue-pm mailing list