diff --git a/_posts/2023-12-12-y-oh-y.md b/_posts/2023-12-12-y-oh-y.md index 50f7990..7ad6a55 100644 --- a/_posts/2023-12-12-y-oh-y.md +++ b/_posts/2023-12-12-y-oh-y.md @@ -99,6 +99,8 @@ Let us carefully understand why it works like this: `f error` (aka `fact0`) is a So when we invoke `fact0` with `0`, the match condition triggers a valid return; but when we invoke it with `1`, the match condition triggers a call to `omega`. In our case, the `omega` passed in is `error`, which ignores whatever argument is passed in and throws an exception instead. +(It's worth pointing out that functional programmers love _total_ functions, and so eschew exceptions because functions which throw don't return a value for all arguments like well-behaved functions do. I'm deliberately throwing an exception here to violently jar us from a state of complacence - to show that something undesirable needs to be dealt with. We'll get rid of this behaviour soon, so just excuse it for now!) + ### 3.2 Oh look, a rabbit hole! Now that we've understood why there's no mystery at all to this behaviour, let's take the next step: