{"id":463,"date":"2012-10-05T05:00:05","date_gmt":"2012-10-05T12:00:05","guid":{"rendered":"http:\/\/zackmdavis.net\/blog\/?p=463"},"modified":"2012-10-01T06:46:29","modified_gmt":"2012-10-01T13:46:29","slug":"colon-equals","status":"publish","type":"post","link":"http:\/\/zackmdavis.net\/blog\/2012\/10\/colon-equals\/","title":{"rendered":"Colon-Equals"},"content":{"rendered":"<p>Sometimes I think it's sad that the most popular programming languages use &quot;=&quot; for assignment rather than &quot;:=&quot; (like Pascal). Equality is a symmetrical relationship: &quot;<em>a<\/em> equals <em>b<\/em>&quot; means that <em>a<\/em> and <em>b<\/em> are the same thing or have the same value, and this is clearly the same as saying that &quot;<em>b<\/em> equals <em>a<\/em>&quot;. Assignment isn't like that: putting the value <em>b<\/em> in a box named <em>a<\/em> isn't the same as putting the value <em>a<\/em> in a box named <em>b<\/em>!\u2014surely an asymmetrical operation deserves an asymmetrical notation? Okay, so it is an extra character, but any decent editor can be configured to save you the keystroke.<\/p>\n<p>I'd like to see the colon-equals assignment symbol more often in math, too. For example, shouldn't we be writing lower indices of summation like this?\u2014<\/p>\n<p><p style='text-align:center;'><span class='MathJax_Preview'><img src='http:\/\/zackmdavis.net\/blog\/wp-content\/plugins\/latex\/cache\/tex_7c6ce75d6abe92c78f6a62fd362a9b4f.gif' style='vertical-align: middle; border: none;' class='tex' alt=\"\\sum_{j:=0}^n f(j)\" \/><\/span><script type='math\/tex;  mode=display'>\\sum_{j:=0}^n f(j)<\/script><\/p><\/p>\n<p>\u2014the rationale being that the text under the sigma <em>isn't<\/em> asserting that <em>j<\/em> <em>equals<\/em> zero, but rather that <em>j<\/em> is <em>assigned<\/em> zero as the initial index value of what is, in fact, a for loop:<\/p>\n<pre>\r\nsum = 0;\r\nfor (int j=0&#59; j&#60;=n&#59; j++)\r\n{\r\n    sum += f(j)&#59;\r\n}\r\nreturn sum;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes I think it's sad that the most popular programming languages use &quot;=&quot; for assignment rather than &quot;:=&quot; (like Pascal). Equality is a symmetrical relationship: &quot;a equals b&quot; means that a and b are the same thing or have the &hellip; <a href=\"http:\/\/zackmdavis.net\/blog\/2012\/10\/colon-equals\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20],"tags":[45],"_links":{"self":[{"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/posts\/463"}],"collection":[{"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/comments?post=463"}],"version-history":[{"count":19,"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/posts\/463\/revisions"}],"predecessor-version":[{"id":481,"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/posts\/463\/revisions\/481"}],"wp:attachment":[{"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/media?parent=463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/categories?post=463"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/zackmdavis.net\/blog\/wp-json\/wp\/v2\/tags?post=463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}