▲ | jolmg 5 days ago | |||||||
> bool -> bool has 2^2=4 values Not the best example since 2*2=4 also. How about this bit of Haskell:
That's 3 ^ 2 = 9, right?
Those are 6. What would be the other 3? or should it actually be a*b=6?EDIT: Nevermind, I counted wrong. Here are the 9:
| ||||||||
▲ | ackfoobar 5 days ago | parent | next [-] | |||||||
Good point, well there's Ordering type built-in in Haskell (LT | EQ | GT). Ordering -> bool has 2^3=8 values (const true, const false, == LT, == EQ, == GT, is_lte, is_gte, ne) EDIT: now you see why I used the smallest type possible to make my point. Exponentials get big FAST (duh). | ||||||||
| ||||||||
▲ | jasperry 5 days ago | parent | prev [-] | |||||||
You didn't list all functions, just input-output pairs. Each function is a map from every possible input to an output: f1 False = Nothing, f1 True = Nothing f2 False = Nothing, f2 True = Just True ... This gives the correct 3^2 = 9 functions. |