Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
First, why do you require that the block sizes add up to the total number of items?
Otherwise what you get is not a partition according to most definitions. You can somewhat get around this by partitioning into groups and letting one group be a "trash" group that is not output. But for that you must have one distinguished group (as in ordered partition) and the rest undifferentiated (as in unordered partition), so it would be trickier.

Now that I'm thinking about it a little more, though, it may be possible to adadpt how it generates RG-sequences internally to support just that by allowing the value "0" to signify "not included in output," where every item (including the first) can take on value 0. I wouldn't be able to code it up for a while, but it seems do-able.


In reply to Re^2: Partitioning a set into parts of given sizes by blokhead
in thread Partitioning a set into parts of given sizes by blokhead

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.