Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Puzzle Regex: Letter Frequency Arithmetic Sequence

by vagabonding electron (Curate)
on Oct 24, 2017 at 14:16 UTC ( #1201962=note: print w/replies, xml ) Need Help??

in reply to Re: Puzzle Regex: Letter Frequency Arithmetic Sequence
in thread Puzzle Regex: Letter Frequency Arithmetic Sequence

I played a lot with your solution to understand it well, so first of all - thank you, choroba.

Just my two cents: your function frequencies_form_a_sequence assumes that the frequencies start with one. The words with letter sequencies 2,3,4 etc. will not be selected then.

Should it not be in the following form (min, max and all are from List::Util and List::MoreUtils):

sub frequencies_form_a_sequence { my ($r) = @_; my $min = min keys %$r; return 0 if $min == 1; # Just for test. my $max = max keys %$r; return 0 if $min == $max; # Probably not a sequence. my $bool = all { defined $r->{$_} } $min .. $max; }

I find the following words then (cannot pretend to know what they mean though :) ):

addda ajaja alala anana arara cocco essee esses igigi nanna pappa peepe reree susus taata tatta ululu xxiii deedeed sasararas sassarara

Replies are listed 'Best First'.
Re^3: Puzzle Regex: Letter Frequency Arithmetic Sequence
by choroba (Cardinal) on Oct 24, 2017 at 17:01 UTC
    Why not, before the update, the challenge wasn't exactly specified, so I understood it as 1 .. n.

    I'd just use exists instead of defined in the all block.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2022-12-07 15:54 GMT
Find Nodes?
    Voting Booth?

    No recent polls found