Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#6 Array Chunking #9

Closed
somekindofwallflower opened this issue Jun 14, 2022 · 0 comments · Fixed by #36
Closed

#6 Array Chunking #9

somekindofwallflower opened this issue Jun 14, 2022 · 0 comments · Fixed by #36
Assignees
Labels
enhancement New feature or request

Comments

@somekindofwallflower
Copy link
Owner

somekindofwallflower commented Jun 14, 2022

Description
Given an array and chunk size, divide the array into many subarrays
where each subarray is of length size

Examples

  • chunk([1, 2, 3, 4], 2) --> [[ 1, 2], [3, 4]]
  • chunk([1, 2, 3, 4, 5], 2) --> [[ 1, 2], [3, 4], [5]]
  • chunk([1, 2, 3, 4, 5, 6, 7, 8], 3) --> [[ 1, 2, 3], [4, 5, 6], [7, 8]]
  • chunk([1, 2, 3, 4, 5], 4) --> [[ 1, 2, 3, 4], [5]]
  • chunk([1, 2, 3, 4, 5], 10) --> [[ 1, 2, 3, 4, 5]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant