3 ms·
Yes, but functions in Python are not that. Mathematical transformations don't support closures for one. Dictionaries are more like functions and indeed I taugh
by thanatropism 4y ago
Yes, but functions in Python are not that. Mathematical transformations don't support closures for one.
Dictionaries are more like functions and indeed I taught myself to understand hashmaps as "frozen functions" way back when. You can easily find the set-valued inverse of a function by saying
{v: [k for k in d.keys() if k[v]==v] for k, v in d.items()}
and that's close to the mathematical definition too.
- xigoi 4y ago> Mathematical transformations don't support closures for one. What? In mathematics, you often have things like “let c be a real number; let f(x) = x + c”.