in reply to Odometer pattern iterator (in C). (Updated.)

The only think i can say, if you are speaking about odometer, is that the example in High Order perl does contains only plain Perl (if you want to translate it to C).
sub increment_odometer { my @odometer = @_; my $wheel = $#odometer; # start at rightmost wheel until ($odometer[$wheel] < 9 || $wheel < 0) { $odometer[$wheel] = 0; $wheel--; # next wheel to the left } if ($wheel < 0) { return; # fell off the left end; no more sequences } else { $odometer[$wheel]++; # this wheel now turns one notch return @odometer; } }


.. just in case you missed this.
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.

Replies are listed 'Best First'.
Re^2: Odometer pattern iterator (in C).
by BrowserUk (Patriarch) on May 29, 2015 at 11:55 UTC

    Unfortunately, that iterate combinations_with_repeats() rather than just combinations() (See Algorithm::Combinatorics for the difference.)


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked