///| /// A greeting to print, and how many times to print it. struct Greeting { name : String times : Int } derive(Eq) ///| /// Show is written out by hand rather than derived: `derive(Show)` is /// deprecated, and this is the form the toolchain points at instead. impl Show for Greeting with fn output(self, logger) { logger.write_string("\{self.name} × \{self.times}") } ///| /// The tone a greeting is delivered in. enum Tone { Plain Loud Question } derive(Debug) ///| /// punctuate returns the mark a tone ends on. fn punctuate(tone : Tone) -> String { match tone { Plain => "." Loud => "!" Question => "?" } } ///| /// greet prints one greeting, once per `times`. /// /// `tone` is a labelled argument with a default, so a call site may leave it /// out — and when it does not, it reads as `greet(g, tone=Loud)`. fn greet(g : Greeting, tone? : Tone = Plain) -> Unit { for i in 0..