Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • 1
    $\begingroup$ +1 very cool! Perhaps for consistency you could implement dynamicPartition[Range@12, {4, 3}, None] and/or dynamicPartition[Range@12, {4, 3}, 0] as well? $\endgroup$ Commented Jun 27, 2012 at 9:44
  • 2
    $\begingroup$ @Ajasja also, I didn't want to clutter the answer further, but since additional arguments are passed to Partition more complicated specifications are possible, e.g. dynamicPartition[Range@20, {4, 3}, 2, 3, 1, "x"] $\endgroup$ Commented Jun 27, 2012 at 10:09
  • 5
    $\begingroup$ I'll just note that Wizard's dynP[] is effectively equivalent to the prize-winning solution in the 1992 Mathematica Programming Competition in Rotterdam, with a few modifications. The actual submission used Inner[] instead of MapThread[], but again, the algorithm is identical. $\endgroup$ Commented Jun 27, 2012 at 16:02
  • 2
    $\begingroup$ @J.M. I'm out of time for today but it looks like Inner is faster than MapThread. I guess this function is due for a rewrite! $\endgroup$ Commented Jun 27, 2012 at 20:36
  • 2
    $\begingroup$ @J.M. yes, truly nothing new under the sun. Here is a reference to the competition that includes the code, and an alternative. At least I learned a fair bit by working the problem out myself, even if I did it over ten years after the competition. :-) $\endgroup$ Commented Jun 28, 2012 at 20:59