Reputation: 326
As described in sort documentation it's supposed to return a sorted sequence of the items in collection.
Why it properly sorts [3 1 2 4] but is unable to sort [2010 2014 2018] in ascending order?
$ lein repl
nREPL server started on port 62414 on host 127.0.0.1 - nrepl://127.0.0.1:62414
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_111-b14
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> (sort [2010 1014 2018])
(1014 2010 2018)
user=> (sort [3 1 2 4])
(1 2 3 4)
UPDATE: it was a typo (1014 instead of 2014) as was pointed in answer.
Upvotes: 0
Views: 63
Reputation: 16194
Looks like you have a typo:
(sort [2010 2014 2018])
2014
instead of 1014
.
Upvotes: 4