I wanted to learn more about Dotty, the new compiler that will be used for Scala 3 so I thought of using it to solve a small problem.

I decided to use an exercise I use with candidates for a Scala position as a starting point for discussion. It consists in modelling a binary tree and writing a function that acts on it.

The problem

First I ask the candidate to model a binary tree, similar to the one the figure below:

Simple binary tree

And then we work together on how to write a function that adds a unique identifier to all nodes of…

Benoit Pasquereau

Tech lead and back-end dev

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store