[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Quick hack for common length



Screw optimizing for speed, let's optimize for LISP:

sub lcs {
    map { chop unless $_ eq $_[0] } @_ = sort {length $a <=> length $b} @_;
    return $_[0] eq $_[1] ? $_[0] : lcs(@_);
}

Damn, that would probably be cleaner in Python.


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe