4 ms·
Seems like a useful formalism though, at least coming from a programming background. Maybe some kind of "it's all of them at once" mental model is useful in ma
by eternityforest 3y ago
Seems like a useful formalism though, at least coming from a programming background.
Maybe some kind of "it's all of them at once" mental model is useful in math, but object oriented programming gives you a hierarchal mindset, everything is in a container of some sort, so multiple return values having a container like a set makes perfect sense and just a bunch of loose values isn't a very familiar concept.
But perhaps if you're actually doing math, things are different?
- thaumasiotes 3y agoIt's useful in many places and less useful in others. Over in the programming world, Common Lisp allows you to return multiple values without wrapping them in a container. If you want the primary value, you just treat the function as if it returned one value. If you want additional return values, you use multiple-value-bind. (I believe the general idea is along these lines: your function does a certain amount of computation, producing a set of related values. Most of the time, the caller will be interested in just one of those, which you return as the primary value. But some of the time, the caller will be interested in more than just that one value, and you have to compute the secondary values whether the caller wants them or not, so you return those too.) For a different example of formalism in math, it is conventional to say that there are two boolean logical operators, negation and implication. You can still write about conjunction and disjunction, but everyone understands that when you write "p and q are both true", what you really meant to write was "it isn't the case that the truth of p implies the falsity of q". The point of the formalism is that you can do your proofs by considering negation and implication and then ignoring everything else. (It isn't conventional to say that there's just one logical operator NAND. You might think that would be even better, but the effort saved by only considering how one operation works ends up being less than the extra effort involved in doing proofs about NAND.) The situation with functions is more or less the same thing; at many points we want to rely on the assumption that when a = b, f(a) = f(b). So we define functions that way, and functions that give multiple values have to be treated as giving a single composite value instead. But in a context where you have some value a and what you want to know is "what is f(a)?", the fact that the answer may consist of multiple values won't bother you. Now, I have never seen someone take the position that boolean conjunction and disjunction don't exist as concepts just because that is how logic is normally defined, but the analogous position seems to be more popular for multiple-valued functions.
- AmpsterMan 3y agoI can think of two simple, practical answers to your query: The expressive power of single value functions is very powerful and the constraint is not necessarily restrictive but may even drive a stronger analysis. (Where does this function have multiple returns? Is it for the whole domain? Etc) By contrast the expressive power of negation and implication are relatively low given very intuitive and well defined alternatives exist. Second, there already exist good enough paradigms for dealing with multi-valued functions. Splitting the function up into multiple functions, mapping to an ordered pair, etc. Defining a function the traditional way is more than just notational convenience. The single value constraint allows for many simplifying assumptions, enough that is worth to pay the cost when dealing with relations that you want to talk about in functional ways