Profile

Cover photo
Oliver Becker
70 followers|60,975 views
AboutPostsPhotosVideos

Stream

Oliver Becker

Shared publicly  - 
 
Any suggestions how to name a function that takes a list (or collection or array or sequence) and a number n and returns a list of lists by grouping the items by position modulo n?

For example: input is (a,b,c,d,e,f,g), applying the to-be-named-function with the argument 3 results in ((a,d,g), (b,e), (c,f)).

Another explanation: put the items one by one into a table having n columns:
a b c
d e f
g
Then the result is a list of the columns in this table.

And while we're at it - what would be a good name for a function the returns the list of the rows?
1
Eckhard Rotte's profile photoPeter Adolphs's profile photoAlejandro Maximiliano Araneda's profile photoOliver Becker's profile photo
7 comments
 
Thanks to all of you for your suggestions. I actually liked 'partition', however I decided to use the simpler names 'columns(numberOfColumns)' for the first function and 'rowsOf(rowSize)' for the second. Additionally there are two complementary functions 'columnsOf(columnSize)' and 'rows(numberOfRows)'. All of them create partitions of the original list, of course.
Add a comment...

Oliver Becker changed his profile photo.

Shared publicly  - 
 
Oliver Becker changed his profile photo.
2
Oliver Becker's profile photoAndreas Kuhrwahl's profile photoEckhard Rotte's profile photoChristoph Sassenberg's profile photo
5 comments
 
Sehr kleidsam!
Add a comment...
Story
Tagline
Freelance Software Developer Java/Spring/Web/XML
Links
Other profiles
Basic Information
Gender
Male