4 ms·
This idea is incredibly seductive to me, but the trouble I've always had is made completely lucid in your description of "conjugates" that are "only partially l
by shubber 15y ago
This idea is incredibly seductive to me, but the trouble I've always had is made completely lucid in your description of "conjugates" that are "only partially left inverse." The issue is that so many operations that it would be nice to be able to use as a conjugation aren't actually reversible.
At best, you have situations where the flawed reversal is acceptable - the Ruby File::open("file"){} example, or the J example for computing magnitude. close(open("file")) isn't exactly as if nothing had happened.
sqrt(a2) ?= a // only if a >= 0
But, consider parsing and templating: Could you template back exactly the input that you parsed to get an internal representation? Only if every character of input is unambiguous and significant - in other words, almost never.
- oelewapperke 15y agoThe big problem in this functional description imho is that the original premise is wrong : this idiom does not -at all- call for the inverse of functions. close() is not the inverse of open(). Especially not if there have been write actions on the file. Open "dereferences" a filename into a series of bytes. Close destroys the filehandle. Both are very un-functional concepts. Even memory allocation malloc/free are hardly the reverse of eachother. Free does not leave the system in the state it was before malloc, that only happens in the most trivial case possible.