Logo

Programming-Idioms

History of Idiom 165 > diff from v56 to v57

Edit summary for version 57 by misha:
New Clojure implementation by user [misha]

Version 56

2020-04-27, 19:54:11

Version 57

2020-04-30, 09:17:13

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.

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