Exercises in this lecture  previous -- Keyboard shortcut: 'p'        Go to the slide, where this exercise belongs -- Keyboard shortcut: 'u'  

Exercise 1.15
Group formation ***

This exercise is about group formation. Program a function called grouping that takes a list of persons as input, and returns a lists of groups of person. For simplicity, a person can be represented as a symbol or a string. The output of the function is supposed to be a list of list of persons.

The groups should be formed randomly, with (at least) gs persons per group. Let us assume that there are n persons in the input list. In case gs does not divide n, the remaining students should be distributed as equal as possible on the n / gs groups (where / is integer division). It is not acceptable that one of the groups is much larger than the remaining groups.

The group size, gs, should also be a parameter of your function.

Please consider possible border cases which need special treatment.

Also, consider seriously the algorithmic aspect of the group formation. What is your plan of attack? How will you deal with randomness? Can we deal with randomness in pure functional progamming? How will you ensure an equal distribution of persons in the groups?