Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Good question. Obviously only bijections are invertible. Perhaps only bijections are allowed, or perhaps the reversed version of a non-bijective function uses a subset of the original function's codomain as its domain.

It would seem that you would have to be explicit about the domain and codomain of a function to even be able to programmatically figure out an inverse function. Given the author's example of strings to integers, clearly the inverse function will be from integers to strings—but obviously the codomain can't be all strings, but rather ones that are string representations of integers. The validation logic for which strings represent integers (which is essentially the definition of the codomain of the integers->strings function) would certainly have to be explicit somewhere.



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

Search: