Talk:1537: Types

Explain xkcd: It's 'cause you're dumb.
Revision as of 20:05, 12 June 2015 by (talk)
Jump to: navigation, search

Relevant: WAT talk ‎ (talk) (please sign your comments with ~~~~)

Are (6) and (7) about completing sequences?

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. (talk) (please sign your comments with ~~~~)

"+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) Seipas (talk) 12:17, 12 June 2015 (UTC)

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]. Seipas (talk) 12:23, 12 June 2015 (UTC)

Yellowish Blue: is NaN! (talk) (please sign your comments with ~~~~)

"The ironic thing is that fractions with 2 in the nominator are not the kind of numbers that typically suffer from floating point impreciseness." - This is not technically correct. Should read "fractions with 'power of 2' in the denominator. However, the 3/2 would cause precision errors. (talk) (please sign your comments with ~~~~)

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. 13:58, 12 June 2015 (UTC)

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? 12:54, 12 June 2015 (UTC)

This would make sense if it was [] + 2

It really wouldn't. Javascript returns "2" (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 [] + 2 to return [2]... ever. It might make a little bit of sense in Randall's oddly typed language, but not in any sane one. --TotempaaltJ (talk) 12:35, 12 June 2015 (UTC)

Javascript first converts [] (the empty array) to the empty string (using the rule "stringify each element and join with a comma"), then treats the operation as "" + 2, which results in conversion of the other operand to string and then concatenation. 12:46, 12 June 2015 (UTC)

line 4: asci code of N + 2 = asci code of P sirKitKat (talk) 13:07, 12 June 2015 (UTC)

My favourite xkcd in a while. =8o) Of the list I got a good laugh out of numbers 8 and 13. Jarod997 (talk) 13:11, 12 June 2015 (UTC)

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: (talk) (please sign your comments with ~~~~)

Why isn't yellowish blue just green? Djbrasier (talk) 16:18, 12 June 2015 (UTC)

line 4: I read NaP as Not a Problem. 17:00, 12 June 2015 (UTC)

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? 17:10, 12 June 2015 (UTC)

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". --JakubNarebski (talk) 17:38, 12 June 2015 (UTC)

Series of comics? I don't recall any others about Randall's new programming language... 19:13, 12 June 2015 (UTC)


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. -- Rafaeladson (talk) (please sign your comments with ~~~~)

Clearly this is what the xkcd phone's OS is written in (with some help from StackOverflow)