Try to access first or last element and return some default value if not found.
In contrast to [at2()]
, this function provides a less stricter element
access, that is, it remains valid even if peeked elements don't exist.
peekleft(x, default = NULL)
peek(x, default = NULL)
# S3 method for Deque
peek(x, default = NULL)
# S3 method for Deque
peekleft(x, default = NULL)
a Deque
object.
value to be returned if peeked value does not exist.
The first (peekleft
) or last (peek
) element.
peek
peek at last element of a Deque
.
peekleft
peek at first element of a Deque
.
at2()
for strict element extraction