A sequence gives collection-processing functions a common, ordered way to visit elements. It is an abstract data type, not a particular collection implementation: traversal moves forward one element at a time, and an element cannot be reached without passing its predecessors. Sequences are persistent and immutable. They are often lazy, cached, or chunked, but none of those behaviors is required by the sequence contract. section 9.0 section 10.13
Many collections are Seqable: `seq` produces a sequential view of them, and processing functions commonly call it implicitly. A view’s traversal order belongs to the underlying collection. A map yields key–value pairs; hash maps and sets do not promise insertion order. Thus “first” means first in that collection’s traversal, not necessarily first inserted. section 9.1 section 3.5.1
Access and empty inputs
`(first '(1 2 3 4))` returns `1`, `(second '(1 2 3 4))` returns `2`, and `(last '(1 2 3 4))` returns `4`. If the requested position is absent, or the input is `nil`, these functions return `nil`. For an empty collection, `(seq [])` returns `nil`, whereas `(sequence [])` returns `()`. That makes `seq` useful as a non-empty test. section 3.5.1 section 9.1.1
Choose the operation that matches the job:
- Use `seq` for a sequential view; use `sequence` when an empty sequence should remain a sequence rather than become `nil`. `sequence` can also apply a transducer. section 9.1.1
- Use `first`, `second`, or `last` to read positions; use `filter` or `remove` to select elements into a lazy sequence. For a vector’s tail, `peek` avoids the linear traversal listed for `last` on a sequence. section 3.5.1 section 3.5.3
- Keep the desired abstraction in mind: vector and sequence operations can both work on vectors, but differ in performance, memory use, and laziness. section 12.11
Transform several collections
`(sequence (map str) [1 2 3] [:a :b :c])` returns `("1:a" "2:b" "3:c")`. With multiple input collections, `sequence` stops when the shortest input is exhausted. Unsupported collection types raise `IllegalArgumentException`. section 9.1.1
A sequence may come from a collection or from on-demand generation such as `range`. Its uniform traversal interface lets the same processing functions work across those sources; choosing a concrete collection still matters when access cost or laziness matters. section 9.0 section 12.11





















