diff --git a/www/content/tutorial.md b/www/content/tutorial.md index 778afe1dbb1..33d4cdaa4d0 100644 --- a/www/content/tutorial.md +++ b/www/content/tutorial.md @@ -698,7 +698,7 @@ We can use tags with payloads to make a list that contains a mixture of differen List.map [StrElem "A", StrElem "b", NumElem 1, StrElem "c", NumElem -3] \elem -> when elem is NumElem num -> Num.isNegative num - StrElem str -> Str.isCapitalized str + StrElem str -> Str.startsWith str "A" # returns [Bool.true, Bool.false, Bool.false, Bool.false, Bool.true] ``` @@ -708,7 +708,7 @@ Compare this with the example from earlier, which caused a compile-time error: List.map ["A", "B", "C", 1, 2, 3] Num.isNegative ``` -The version that uses tags works because we aren't trying to call `Num.isNegative` on each element. Instead, we're using a `when` to tell when we've got a string or a number, and then calling either `Num.isNegative` or `Str.isCapitalized` depending on which type we have. +The version that uses tags works because we aren't trying to call `Num.isNegative` on each element. Instead, we're using a `when` to tell when we've got a string or a number, and then calling either `Num.isNegative` or `Str.startsWith` depending on which type we have. We could take this as far as we like, adding more different tags (e.g. `BoolElem Bool.true`) and then adding more branches to the `when` to handle them appropriately.