Clojure noob here. Playing around with lists and vectors.
> (peek [1 2 3 4])
4
> (peek '(1 2 3 4))
1
Works as promised. Just like this does.
> (cons 1 [2 3 4])
(1 2 3 4)
> (cons 1 '(2 3 4))
(1 2 3 4)
I randomly tried to use peek on the result of cons:
> (peek (cons 1 [2 3 4]))
ClassCastException clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack clojure.lang.RT.peek (RT.java:724)
What is going on?