4 ms·
This is exactly right. The relevant quote from the article is this: > The reason we care about Church-encoding is because not all programming languages nativel
by matt-noonan 6y ago
This is exactly right. The relevant quote from the article is this:
> The reason we care about Church-encoding is because not all programming languages natively support sum types or recursion (although most programming languages support product types in the form of records / structs).
> However, most programming languages do support functions, so if we have functions then we can use them as a “backdoor” to introduce support for sum types or recursion into our language. This is the essence of the visitor pattern: using functions to Church-encode sum types or recursion into a language that does not natively support sum types or recursion.