Hacker News new | comments | show | ask | jobs | submit login

Very fun, but also a prime candidate for a little casual Perl golf for the bored. I've got 463 bytes not counting the hashbang and when piped the linux shared dictionary (admittedly not the best choice of input) and a command line argument for prefix/suffix matching length.

  #!/usr/bin/perl 
  $PRESUF=@ARGV?$ARGV[0]:5;while(<STDIN>){chomp;($_=lc($_)) =~ s/'.*//;next if(length($_)<$PRESUF);$BYSUF{substr($_,length($_)-$PRESUF,$PRESUF)}{$_}=1;$BYPRE{substr($_,0,$PRESUF)}{$_}=1;$D{$_}=0;}foreach $pre (keys %BYPRE) {if(exists $BYSUF{$pre}) {foreach $w1 (keys %{$BYPRE{$pre}}) {foreach $w2 (keys %{$BYSUF{$pre}}) {next if($w1 eq $w2 or $w1 =~ m/$w2/ or $w2 =~ m/$w1/);my $o = $w2.substr($w1,$PRESUF);print "$o (from '$w1' and '$w2')\n" if(++$D{$o} == 1);}}}}
So something like this would do it: cat /usr/share/dict/words | ./FILENAME.pl

Some nuggets:

chiropracticalities (from 'practicalities' and 'chiropractic')

welcomedians (from 'comedians' and 'welcomed')

foregonians (from 'oregonians' and 'forego')

peppercornstalk (from 'cornstalk' and 'peppercorn')

popcornerstone (from 'cornerstone' and 'popcorn')

microchipmunks (from 'chipmunks' and 'microchip')

confidentists (from 'dentists' and 'confident')

rodentine (from 'dentine' and 'rodent')

decadentistry (from 'dentistry' and 'decadent')




nice. yeah with a phonetic dictionary you'd get basically the same stuff we do.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: