Can anyone recommend exercises for learning a new language. For example, something like "implement a class with these methods", or implement a function that does this. Something that is realistic, should only take an hour or two to implement for a competent programmer, requires you to learn more complicated features of a language, yet I can finish before getting bored or frustrated?
Advent of Code[1] - A set of 50 tasks, released annually, with increasing difficulty. Each task is a short, Christmas related, funny story which makes it easier to follow and complete. You can track your progress so it'll give a sense of completion and satisfaction. The drawback may be that challenges are language agnostic so they aren't crafted for learning specific features of any language.
For Rust I've seen people reference Rust Koans (https://github.com/crazymykl/rust-koans), but I haven't looked at that myself. I wanted a project that was sizeable enough to force me to use a good number of language features (but not all). I think the interpreter was a pretty good balance there, but it definitely took a time investment.
I'd also like to hear what others do to learn languages. I like to write a little RPN calculator. The program's interface might vary depending on the language: to learn browser JS, you might do a DOM-based UI; for Rust it might be a CLI; for Go or Erlang maybe a line-oriented network service.
Depending on the interface, this tends to exercise language and runtime features like: string handling and parsing, event handling, conditionals / pattern matching, etc. "Calculator" is also a big enough problem space that you can come back to it to try out more interesting language features (e.g. using Rust enums to model your calculator's operations).
Peter Norvig has a repo of such problems / solutions (he solves them in Python, and calls them "pytudes" = "python" + "etudes", although they should be solvable in any language) https://github.com/norvig/pytudes
Rosalind is a good platform to learn a new language.
Not the best to discover the most advanced features, but enough to ensure you know your structures and algorithms.