Technically speaking it is correct because you are adding sizes and types. But the first 2 lines are defining types and colors, when it should have been:
…
[update]
So the reason was that the expression (def colors ...) was not instructed before. So yes, the document is technically correct (“more correct” than what I described), but it could be probably reordered so the code snippets have instructions more cohesive between them: like mixing (def types ...) (def sizes ..) with (transact ... types) (transact ... sizes) instead of types and colors with sizes and types.
It seems silly, but it could help the novice reader (audience for a tutorial).
But the code I just cloned for the tutorial doesn’t have that lambda function.
In any case, it has get-items-by-type[2] lambda function.
[1] THE DOCS PAGE OF DATOMIC /cloud/ions/ions-tutorial.html#orgf6b6d18
[2] THE GITHUB PAGE /Datomic/ion-starter/blob/efc93063578719ce5d754e0e960bfc4b7c94b0af/resources/datomic/ion-config-sample.edn#L16