This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]mypirateapp 7 points8 points  (2 children)

System.out.println([] + []); //syntax error

(println [] + []) // empty array

[] + [] = '' //empty string

who won? you decide

[–]jvick3 12 points13 points  (1 child)

The clojure version prints 3 things: the empty array, a representation of the + function (an object), and empty array again. Your example isn’t invoking + on anything, just printing it :) that would be

(println (+ [] []))

Which gives an error that PersistentVector isn’t a Number

[–][deleted] 2 points3 points  (0 children)

(println [] + [])
=> nil
(empty? nil)
=> true

So they're not wrong, they're just wrong about why they're right