Logo

Programming-Idioms

History of Idiom 165 > diff from v58 to v59

Edit summary for version 59 by programming-idioms.org:
[Clojure] Result x

Version 58

2020-04-30, 09:19:39

Version 59

2020-05-03, 21:41:05

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Variables
x,items
Code
(peek items)
Code
(def x (peek items))
Comments bubble
When items is a vector or queue, because last would be linear time.
Comments bubble
When items is a vector or queue, because last would be linear time.
Doc URL
https://clojure.org/reference/data_structures#Vectors
Doc URL
https://clojure.org/reference/data_structures#Vectors