in reply to Golf: Embedded In Order
Here's mine. It's très cool.
japhy -- Perl and Regex Hacker
Update -- after seeing chipmunk's code, which beats mine, I offer one minor adjustment:# 37 chars (between the {...}) sub seq{shift=~join'.*',map"\Q$_",split//,pop}
Although, should the $t by my()ed? I'm all for strict-compliant golf. Anyway, I changed the @_ access to pop, and added a needed /s modifier to both regexes. It makes it longer than chipmunk's, but doesn't break on cases involving newlines.sub seq{($t=pop)=~s/./$&.*/sg;pop=~/$t/s}
japhy -- Perl and Regex Hacker
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Golf: Embedded In Order
by chipmunk (Parson) on Apr 30, 2001 at 09:08 UTC | |
Re: Re: Golf: Embedded In Order
by petral (Curate) on May 26, 2001 at 01:41 UTC |
In Section
Meditations