R/empty.rstack.R

Defines functions empty.rstack

#' @export
#' @title Check if an rstack is empty
#' @description Check if an rstack is empty.
#' @details Runs in \eqn{O(1)} time.
#' @param x the rstack to check.
#' @param ... additional arguments to be passed to or from methods (ignored).
#' @return logical vector of length 1.
#' @seealso \code{\link{empty}} for the generic function that can be used on rstacks, rdeques, and rpqueues.
empty.rstack <- function(x, ...) {
  if(length(x) < 1) {
    return(TRUE)
  } else {
    return(FALSE)
  }
}
oneilsh/rstackdeque documentation built on May 17, 2022, 6:29 p.m.