CentraleSupélecDépartement informatique
Plateau de Moulon
3 rue Joliot-Curie
F-91192 Gif-sur-Yvette cedex
Computing leap years in TESL

Table of contents

There are several ways of computing leap years in TESL, which illustrate different coding styles.

A year is leap is it is a multiple of 4, but not a multiple of 100, unless it is a multiple of 400.

Using pure clocks and filteringWith pure clocks

This specification of leap years relies on pure clocks and filtered by implications.

This specification can be made more readable using every and when not:

Using integer periodic clocksWith integer clocks

Instead of filtering the ticks on clock year, we can rely on tags and periodic clocks:

The result