Hello everyone and thanks for coming yesterday! Big thanks to Jayway for hosting, to Hans and Christian for presentations and to (sorry I don't remember your name) for an insightful piece of object/closure wisdom.
I promised to send you all the C# code for the little challenge I put up. I changed it a little tiny bit so that it would be simplier to read and just included my 3rd solution. Please tell me if you want the other ones and I'll post them as well. Anyway the code is here:
http://pastebin.com/sK5NukAj
As a little recap of what I wanted:
We have a sequence of Parts (containing a Heading, a Text and a IsColumnLayout property saying whether they are to use a column layout or a wide layout). Our task is to map any given sequence of Parts into a sequence of sequence of parts, where every inner sequence contains
1) either just one part if it's a non-column layout
2) two parts with both having column layout if they're consecutive
3) one part using column layout if it has no consecutive "column partner"
An example in ASCII art (o = part w/ wide layout, | = part w/ column layout)
o
o
|
|
o
|
o
|
|
|
should be mapped to
{ o }
{ o }
{ | | }
{ o }
{ | }
{ o }
{ | | }
{ | }
Please give us a really neat functional solution!