Earlier quoted context omitted.
Of course it’s not the same. There is one sensible result expected when adding two lists or strings together (since they’re linear, it would not make sense to encourage inefficient search/replace operations with an operator; and also, the containers do not require unique keys, you can simply extend them). A dict must deal with conflicting keys, and arguably each situation requires different treatment of those keys.
The sensible thing is to throw on conflicting keys.
Why Operators Are Useful
41–50 of 173 posts
Re: Why Operators Are Useful
#42Earlier quoted context omitted.
Of course it’s not the same. There is one sensible result expected when adding two lists or strings together (since they’re linear, it would not make sense to encourage inefficient search/replace operations with an operator; and also, the containers do not require unique keys, you can simply extend them). A dict must deal with conflicting keys, and arguably each situation requires different treatment of those keys.
The sensible thing is to throw on conflicting keys.
Re: Why Operators Are Useful
#43Earlier quoted context omitted.
I don't know any Lisp, but I would decode (= (* x (+ y z)) (+ (* x z) (* y z))) As x*(y + z) = x*z + y*z e.g. (+ y z) means you add y and z with highest priority.
Which is incorrect, they aren't equal.
Re: Why Operators Are Useful
#44he doesn’t make any coherent argument as to why one is more clear or preferred than the other. he simply states it and moves on with this bias. for example, when he compares 2 to 2a, i feel he doesn’t really address anything and just states his preference as the more clear one. plus, he of course seems to know nothing about lisp (or just ignores it) where you might have: (+ a (+ b c)) = (+ (+ a b) c) = (+ a b c) all…
> it is amazing to me this guy is the creator of one of the most popular languages today when he is such a poor thinker. This is unnecessary and a huge stretch given one blog post.
Re: Why Operators Are Useful
#45Earlier quoted context omitted.
Lisp is pretty ugly :) (eql (* x (+ y z)) (+ (* x y) (* x z))) I wonder if its famed sense of enlightenment is partly just overcoming the mental hurdle of it's syntax. Edit: typo fix, had x/z mixed up
You don't have to do it like that. You could do: (= (* x (+ y z)) (+ (* x z) (* y z))) Or: (= (* x (+ y z)) (+ (* x z) (* y z))) Or: (= (* x (+ y z)) (+ (* x z) (* y z))) Or: (= (+ (* x z) (* y z)) (* x (+ y z))) Or: (= (+ (* x z) (* y z)) (* (+ y z) x)) Or: (= (+ (* x z) (* y z)) (* (+ y z) x)) I think the last one makes the relationships quite clear. Writing legible equations is an art form, as is writing sexps. Ed…
Re: Why Operators Are Useful
#46Presumably d1 + d2 != d2 + d1 for some d1, d2.
If you're going to use the + operator then it should behave like it does in other contexts.
Re: Why Operators Are Useful
#47This is why I prefer ML-style syntax over Algol-style syntax.
ML-style syntax (with sugar for pattern matching) engages my visual process machinery better, such that I can scan over function definitions more at a glance, than the "literary" style of Algol syntax
Re: Why Operators Are Useful
#48This is much less confusing than (2), and leads to the observation that the parentheses are redundant, so now we can write "x + y + z" This is a non-problem if you're using Lisp. (+ x y z) accepts an arbitary number of arguments and the operator precedence problem does not exist since there is no operator precedence.
Lisp is pretty ugly :) (eql (* x (+ y z)) (+ (* x y) (* x z))) I wonder if its famed sense of enlightenment is partly just overcoming the mental hurdle of it's syntax. Edit: typo fix, had x/z mixed up
Re: Why Operators Are Useful
#49Earlier quoted context omitted.
Same with lists and strings, and it doesn't bother anybody: even for dict, it's just a matter or reading from the left to the right.
Of course it’s not the same. There is one sensible result expected when adding two lists or strings together (since they’re linear, it would not make sense to encourage inefficient search/replace operations with an operator; and also, the containers do not require unique keys, you can simply extend them). A dict must deal with conflicting keys, and arguably each situation requires different treatment of those keys.
Hence there is nothing hard or mysterious what the + operator should do. People are nit picking on this.
Re: Why Operators Are Useful
#50he doesn’t make any coherent argument as to why one is more clear or preferred than the other. he simply states it and moves on with this bias. for example, when he compares 2 to 2a, i feel he doesn’t really address anything and just states his preference as the more clear one. plus, he of course seems to know nothing about lisp (or just ignores it) where you might have: (+ a (+ b c)) = (+ (+ a b) c) = (+ a b c) all…