https://www.explainxkcd.com/wiki/api.php?action=feedcontributions&user=141.101.92.42&feedformat=atomexplain xkcd - User contributions [en]2024-03-28T15:03:44ZUser contributionsMediaWiki 1.30.0https://www.explainxkcd.com/wiki/index.php?title=Talk:1537:_Types&diff=95433Talk:1537: Types2015-06-13T08:39:03Z<p>141.101.92.42: </p>
<hr />
<div>Relevant: WAT talk https://www.destroyallsoftware.com/talks/wat {{unsigned ip|108.162.254.108}}<br />
<br />
Are (6) and (7) about completing sequences?<br />
<br />
If the sequence was [1, 2, 3, ?] we would expect the ? to be a placeholder for 4. So [1, 2, 3]+2 is wrong := FALSE. But [1, 2, 3]+4 is correct := TRUE. {{unsigned ip|141.101.99.22}}<br />
<br />
"+2 appears to be applying a unary + to the number 2" : or it adds the number of the line, 10, to 2 => 12. Also, the eleventh line, "2+2" may add 2 to all the following 2, explaining line 12. (that theory is from a friend of mine) [[User:Seipas|Seipas]] ([[User talk:Seipas|talk]]) 12:17, 12 June 2015 (UTC)<br />
: Also, for the lines 6 and 7, the operation "[1,2,3]+x" may add x to the set [1,2,3] and return true if the operation succeeded or false if not. Adding 2 to the set [1,2,3] returns false because 2 is already in [1,2,3]. [[User:Seipas|Seipas]] ([[User talk:Seipas|talk]]) 12:23, 12 June 2015 (UTC)<br />
<br />
Yellowish Blue: http://www.livescience.com/17948-red-green-blue-yellow-stunning-colors.html is NaN! {{unsigned ip|108.162.221.129}}<br />
<br />
<br />
''"The ironic thing is that fractions with 2 in the nominator are not the kind of numbers that typically suffer from floating point impreciseness."''<br />
- This is not technically correct. Should read "fractions with 'power of 2' in the '''de'''nominator. However, the 3/2 would cause precision errors. {{unsigned ip|108.162.221.129}}<br />
: I don't know proper English wording for things, but 3/2=3*2^-1, so it would be represented exactly under IEEE-754 too. [[Special:Contributions/141.101.89.217|141.101.89.217]] 13:58, 12 June 2015 (UTC)<br />
<br />
Is there more to this comic, a fixed set of rules that can tie all the examples together, or does each line make its own joke independently? [[Special:Contributions/108.162.219.5|108.162.219.5]] 12:54, 12 June 2015 (UTC)<br />
<br />
;"normally"<br />
<br />
<blockquote>This would make sense if it was <code>[] + 2</code></blockquote><br />
<br />
It really wouldn't. Javascript returns <code>"2"</code> (god knows why) and Python gives an error. Don't really feel like testing many other languages, but I also think it's not really a logical assumption to make at all. Can't think of a reason for <code>[] + 2</code> to return <code>[2]</code>... ever. It ''might'' make a little bit of sense in Randall's oddly typed language, but not in any sane one. --[[User:TotempaaltJ|TotempaaltJ]] ([[User talk:TotempaaltJ|talk]]) 12:35, 12 June 2015 (UTC)<br />
<br />
: Javascript first converts <code>[]</code> (the empty array) to the empty string (using the rule "stringify each element and join with a comma"), then treats the operation as <code>"" + 2</code>, which results in conversion of the other operand to string and then concatenation. [[Special:Contributions/141.101.97.214|141.101.97.214]] 12:46, 12 June 2015 (UTC)<br />
<br />
line 4: asci code of N + 2 = asci code of P [[User:SirKitKat|sirKitKat]] ([[User talk:SirKitKat|talk]]) 13:07, 12 June 2015 (UTC)<br />
<br />
My favourite xkcd in a while. =8o) Of the list I got a good laugh out of numbers 8 and 13. [[User:Jarod997|Jarod997]] ([[User talk:Jarod997|talk]]) 13:11, 12 June 2015 (UTC)<br />
<br />
I think a lot of this is his joke about programming languages loving the number 4. 2 + "2" = "4", [1,2,3] + 4 = true, 2+2 = DONE, and the range one all seem to support this. Also reminds me of this: http://xkcd.com/221/ {{unsigned ip|173.245.52.112}}<br />
<br />
Why isn't yellowish blue just green? [[User:Djbrasier|Djbrasier]] ([[User talk:Djbrasier|talk]]) 16:18, 12 June 2015 (UTC)<br />
:Because yellow and blue don't make green. [[Special:Contributions/108.162.237.158|108.162.237.158]] 23:33, 12 June 2015 (UTC)<br />
::It does with my paint kit. Isn't that subtractive mixing. I feel like I've just traveled to a version of [[1268: Alternate Universe]], except I'm the only one here who went to kindergarten. What am I missing? [[User:Djbrasier|Djbrasier]] ([[User talk:Djbrasier|talk]]) 02:28, 13 June 2015 (UTC)<br />
:::Since this is a Programming language, it must be talking about RGB colors, where green is a base color and yellow is mixed using red and green. So a "yellowish blue" would contain all base colors, resulting in white – and that's propably why Randall's language returns NaN.[[Special:Contributions/141.101.92.42|141.101.92.42]] 08:39, 13 June 2015 (UTC)<br />
::The only {{w|color wheel}} I know has purple (not blue) opposite yellow and orange (not yellow) opposite blue. If that is incorrect, then wikipedia needs some serious editing. [[User:Djbrasier|Djbrasier]] ([[User talk:Djbrasier|talk]]) 02:31, 13 June 2015 (UTC)<br />
<br />
line 4: I read NaP as Not a Problem. [[Special:Contributions/141.101.104.12|141.101.104.12]] 17:00, 12 June 2015 (UTC)<br />
: So did I. [[User:Xynariz|Xynariz]] ([[User talk:Xynariz|talk]]) 23:12, 12 June 2015 (UTC)<br />
<br />
Line 3 is missing its prompt. There does not appear to be any relevance to the joke, nor has anyone yet explained why it should be missing. Typo? [[Special:Contributions/108.162.221.183|108.162.221.183]] 17:10, 12 June 2015 (UTC)<br />
<br />
Note that some programming languages avoid the problem of overloaded '+' operator between operands of vividly different types by using other symbols for string concatenation (be it "a"~"b" or "a"."b") and numerical addition. The real WTF is abusing '+' for string concatenation, which has very different properties from numerical addition, not being symmetrical for example: concat("aa", "bb") == "aabb", while concat("bb", "aa") == "bbaa" != "aabb". --[[User:JakubNarebski|JakubNarebski]] ([[User talk:JakubNarebski|talk]]) 17:38, 12 June 2015 (UTC)<br />
<br />
Series of comics? I don't recall any others about Randall's new programming language... [[Special:Contributions/141.101.98.29|141.101.98.29]] 19:13, 12 June 2015 (UTC)<br />
<br />
;+2<br />
I think this is a japanese language joke. The + sign can also refer to the kanji 十, which is 10 in japanese. This would explain the result being twelve. 十二, or 10 2, is twelve in japanese. {{unsigned|Rafaeladson}}<br />
<br />
I think number 5 is an escaped quote (two consecutive double quotes yields one double quote), a plus sign, and another escaped quote. The result is shown with an alternate form of escaped quotes (the apostrophe and double quote can both be used to show a string). NSIS scripting language uses this notation.[[Special:Contributions/108.162.221.180|108.162.221.180]] 20:19, 12 June 2015 (UTC)<br />
<br />
Clearly this is what the xkcd phone's OS is written in (with some help from StackOverflow) {{unsigned ip|162.158.68.113}}<br />
<br />
<br />
<br />
Great job at explaining the outputs. I clearly would have missed some interpretations without your insights. [[Special:Contributions/108.162.254.146|108.162.254.146]] 21:10, 12 June 2015 (UTC)<br />
<br />
The joke on line [10] really doesn't seem to be a Chinese/Japanese language joke. We can see that the language interacts much more directly with line numbers from the inter-line joke between lines [11] and [14], where line [12] becomes [14] because the value of 2 has become 4. This is provable by observing that the line after [14] is [13], showing that the previous line really is still line [12], it simply displays as [14] because the value of 2 has changed. This absurdly direct interaction between the code and its line number makes the joke on line [10] make a lot more sense, as a Chinese/Japanese language joke here seems much too contrived and out-of-place considering the nature of the other jokes in the comic. Not to mention, if the joke on line [10] was really concerning the code's interaction with its line number, it would set up nicely for introducing the inter-line joke between lines [11] and [14].[[Special:Contributions/188.114.106.89|188.114.106.89]] 03:35, 13 June 2015 (UTC)</div>141.101.92.42