Hacker News new | past | comments | ask | show | jobs | submit login

Can you explain the term 'cartesian product' in this context? I'm familiar with the cross product from undergrad linear algebra but I haven't applied algebra to types before, and I don't understand what two sets would produce a single Int as their product.

I haven't studied much theoretical computer science so I'd love to hear some good beginner resources on this stuff.




Cartesian product: https://en.wikipedia.org/wiki/Cartesian_product

The number of variants of the AnIntPair construction is the number of distinct elements in the Int type, squared.

I used definition of algebraic data type in Haskell: http://wiki.haskell.org/Algebraic_data_type


"Cartesian product" is a fancy word for "pair". Or more generally "tuple".




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: