4 ms·
Hey Zed, it's mystuff.pop(4).
by aston 17y ago
Hey Zed, it's mystuff.pop(4).
- batasrki 17y agoIs that intuitively the orthogonal method to append()? Not in my view. If I appended something, I'd want to remove it or delete it, not pop it. If I push'ed, then popping would be obvious.
- randallsquared 17y agoWell, it exists, which is what he was complaining about. One step at a time. :)
- smanek 17y agoJust to be pedantic, orthogonal means perpendicular (i.e., 'at a right angle to'). It seems like you meant opposite/complementary/inverse, etc. Sorry - people misappropriating math jargon into the mainstream is a little pet peeve of mine. I agree with your main point though.
- DanielBMarkham 17y agoInteresting. In IT, I've heard the phrase "mutually orthogonal requirements" for years now to indicate requirements that do not overlap.
- csbrooks 17y agoIt's not just that they don't overlap; it's that they don't even really relate or affect each other. In other words, one is pointing North and the other West. They aren't opposites; just different.
- Erf 17y agoThat constitutes an appropriate use of the word "orthogonal".
- maggie 17y agoBoth of you are correct. In programming languages / the IT world, object A is orthogonal to object B if object A can be used without thinking about the potential consequences to object B. In mathematics, orthogonal means perpendicular in a geometric-sense (think two vectors) but can also be used in other contexts with a different meaning.
- likpok 17y agoEven more generally, two vectors are orthogonal if their inner product is zero. This is why the word "perpenidcular" is not used, as sometimes your vectors don't really have "directions" in the intuitive sense of the word (e.g. the inner product space of functions).
- smanek 17y agoI think that comes from the ideas behind vector decomposition (remember physics 101? ;-)). When you decompose a goal into several linearly independent sub-goals - those sub-goals are said to be 'orthogonal' since they don't have any interaction/interdependence with one another.
- MaysonL 17y agoHow can things be non-mutally orthoganal?
- ii 17y agoJust to be even more pedantic, "orthogonal" means more than perpendicular. It means at least: 1. having a zero inner product 2. (a square matrix) that is the inverse of its transpose 3. linear transformation that preserves angles 4. statistically independent
- smanek 17y agolol, I was debating including definition 1 instead of saying 'perpendicular,' but I chickened out. But you are correct, sir ;-)
- jjames 17y agoJust to be more more pedantic (and silly), urban dictionary has this to say: Used to describe two things that are independent of each other. One does not imply the other. "Common sense and intelligence are orthogonal. I've seen plenty of smart people with no common sense."
- greendestiny 17y agoOrthogonal is an appropriate synonym for complementary in a lot of cases. It wasn't an appropriate usage here though. Features complement each other by not overlapping, hence being orthogonal, which is probably the only usage that most programmers hear and the source of the confusion.
- dtf 17y agopop(i) or del a[i] is remove the item at i; insert(i, x) inserts x before the item at i; append(x) adds x after the last item (which can't be done with insert). remove(x) is unordered as it operates on the item not the index, so the opposite of remove should be an unordered add (which exists in an unordered set but not in a list). The rest of his points are more valid.
- shiranaihito 17y agoComing from a Java-background, I've often found myself trying to call list.add(). I think that would be an even more natural complement to list.remove().
- rbanffy 17y agoI think the del statement as in "get rid of this" is perfectly fine. There is no need to pollute the namespace of lists (or anything, BTW) with a method to duplicate an already existing, and very fundamental, language feature.