Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: (dws)Re: (Golf) Fragment Reassembly

by dws (Chancellor)
on May 02, 2001 at 21:20 UTC ( #77422=note: print w/ replies, xml ) Need Help??


in reply to (dws)Re: (Golf) Fragment Reassembly
in thread (Golf) Fragment Reassembly

A bit of tuning after reading japhy's Golf advice drops the score to 243

sub assemble { ## Begin Golf $w=join'',@_;t("",@_);$w} sub t{my$s=shift;$w=$s if!@_ and length$s<length$w; return if!@_;my@b=(@_,@_); map{t($_,@b[0..@_-2])}_($s,shift@b)while(@b>@_)} sub _{($a,$b)=@_;$l=length$a;for(0..$l){$x=substr($a,0,$_).$b; last if substr($x,0,$l)eq$a}$x ## End Golf } print assemble qw(GATTACA ATTACA GATT AAGAT CCC)


Comment on Re: (dws)Re: (Golf) Fragment Reassembly
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://77422]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2014-10-22 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (122 votes), past polls