I'm happy to finally share my implementation of 7GUIs (source) in Elm.
The last two tasks, Circle Drawer and Cells were the most challenging and interesting of the seven tasks. However, I was delighted 😄 to see how effective Elm was at modeling both tasks.
Change propagation for Cells
One of the main highlights for me was figuring out a neat and performant implementation of change propagation for Cells. I modeled it as a directed graph and to figure out the order in which to propagate the changes through the cells I used a topological sort. I also achieved a clean separation of the domain model for the spreadsheet and the UI which allowed me to easily write tests for the spreadsheet. Finally, testing allowed me to come up with a well-crafted test case that breaks naive implementations of change propagation.
Top comments (2)
I did the 7GUIs like 7 years ago when I was learning Elm, but I didn't even try to implement the Cells exercise because I didn't know where to start. I may give it a try now. There's so much interesting stuff in it :)
May I ask what is the
grammar.ebnf
file for? Did you auto generate the formula parser? or is it just part of your thought process?Go for it. There's much to be learned by attempting the Cells task.
The
grammar.ebnf
is an artifact of my process.