Re:Where does the name "algebraic data type" come from?
by Sharlin on Wednesday July 31, 2024 @12:25PM
(#41120609)
Yep, that’s one of the more mind-blowing "tricks" as it were. Maybe less moreso, but still nifty, is that
|T -> bool| = |bool|^|T| = 2^|T|
…which also happens to be the number of subsets of a set of size |T|. And indeed that’s what a predicate function is, a subset-generator; for every subset there is exactly one predicate that picks the members of that subset from the larger set.
Re:Where does the name "algebraic data type" come from?
by gpderetta on Wednesday July 31, 2024 @01:19PM
(#41121115)
That's true for any type, not just bool right? And is equivalent of to the observation that any pure function can be replaced by a lookup table.
[0] https://en.wikipedia.org/wiki/Currying