Learn R Programming

rstackdeque (version 1.1.1)

empty: Check if an rstack, rdeque, or rpqueue is empty

Description

Check if an rstack, rdeque, or rpqueue is empty.

Usage

empty(x, ...)

Arguments

x
rstack, rdeque, or rpqueue to check.
...
additional arguments to be passed to or from methods (ignored).

Value

logical vector of length 1.

Details

Runs in $O(1)$ time for all types.

Examples

Run this code
s <- rstack()
print(empty(s))        ## TRUE
s <- insert_top(s, "a")
print(empty(s))        ## FALSE

Run the code above in your browser using DataLab