Daniel Sockwell — 90 minutes
When I was first learning Raku, I loved the language but missed several convenience functions from the standard library in my previous language (Rust). I remember clearly missing Rust's `filter_map` – I knew that I could use a `grep` followed by a `map`, but that felt far less elegant, took more characters to write, and (potentially) iterated through the collection twice when once would do. I remember thinking "well, Raku is a young language – it probably doesn't yet have that sort of convenience method. Oh well."
But I was (very!) wrong. Raku doesn't lack a `filter_map` method because no one has had a chance to implement one – we don't have a `filter_map` function because we don't need one: `map` can return Empty, which produces exactly the same output. Put differently, Raku has two orthogonal abstractions (`map` and `Empty`) that we can combine in logical ways to get the *result* of `filter_map` without growing the library functions.
And this pattern is repeated over and over again in Raku: something that would require a special method in another language can be composed out of a few basic functions or (meta) operators in Raku. And this is a huge strength of the language – it means that learning Raku involves mastering a small (ok, small-ish) number of basic operations rather than memorizing tailor-made methods.
Yet it's also a (learnability/marketing) weakness for Raku: Raku programmers often don't realize that Raku can provide the same functionality that they're used to from another language. Put differently, searching our docs for "filter_map" won't tell you about `Empty`. This talk aims to fill that gap in two ways: by walking through 105 C++ algorithms implemented in Raku and – more importantly! – by teaching the algorithmic intuition to enable you to combine Raku primitives like this in your own code.