Handling Single, Double, Triple, Quadruple Clicks in Elm

Elm has onClick and onDoubleClick event handlers, but what if you need to handle triple, quadruple or any number of clicks? We’re going to build a simple program that displays multiple boxes containing multiple rows containing multiple items. We want different behaviors for different numbers of clicks. one click: select one item two clicks: select all items in a row three clicks: select all items in a box four clicks: select all items This tutorial was written for Elm 0.

Live Coding: Swarm Behaviour in Elm

To simulate a basic swarm behaviour, you only have to implement three rules: If my closest neighbour is too far away, move toward him. If my closest neighbour is too near, move away from him. Otherwise, move in the same direction as my closest neighbour. I implemented these rules in Elm during a live coding session. You can find the result on Github.