Skip to content

Instantly share code, notes, and snippets.

@Yardboy
Created December 13, 2012 18:53
Show Gist options
  • Save Yardboy/4278677 to your computer and use it in GitHub Desktop.
Save Yardboy/4278677 to your computer and use it in GitHub Desktop.
Splitting into three, splitting into four.
# Let's say you have a collection of seven items:
['a', 'b', 'c', 'd', 'e', 'f', 'g']
# and you want to split it into three groups. What should the result be?
A.
[
['a', 'b', 'c'],
['d', 'e'],
['f', 'g']
]
# or
B.
[
['a', 'b', 'c'],
['d', 'e', 'f'],
['g']
]
# Likewise, when splitting a collection of 10 items into four groups, should the result be:
C.
[
['a', 'b', 'c'],
['d', 'e', 'f'],
['g', 'h'],
['i', 'j']
]
# or
D.
[
['a', 'b', 'c'],
['d', 'e', 'f'],
['g', 'h', 'i'],
['j']
]
# I realize there is an aspect of "it depends on what you're doing" here, but give me your "general-case" gut feeling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment