Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: noGolf: Fuzzy finder / autocompleteby Discipulus (Canon) |
on Jun 23, 2015 at 08:50 UTC ( [id://1131585]=note: print w/replies, xml ) | Need Help?? |
ah! i saw this last night and i started mumbling around a lot of permutations of regexes.. but my brain was too little to afford it. Then, before sleeping, a simpler solution (regex based) come to my mind. I'm not a Perl golfer at all and i cant even read the proposed solution: so i answer to the challenge part of the question. Anyway my Perl tends to be unreadable, so my simple solution is quite obfu.. But, in the example you gave using the 'mig' pattern, Corion, the resulting ranking of choices ( migrations django_migrations main_generator django_admin_log ) is equal to the last one in the python example, but i dont understand why 'django_migrations' comes before 'main_generator': maybe i'm wrong but in my mind 'shortest leftmost' means 'leftmost shortest' and this is the normal way to order strings.. Here is my nine lines (of relevant code) solution, using plain Perl (i'm sure it can be shortened and golfed a lot..). It handles also the correct order of similar words:
L*
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
In Section
Seekers of Perl Wisdom
|
|