R/40-priority_queue-boundaries.R

Defines functions split_at.priority_queue split_around_by_predicate.priority_queue split_by_predicate.priority_queue

#SO

# theoretically someone could define a monoid that allows splitting a priority
# queue, but since the order of elements doesn't relate to priorities the
# resulting split wouldn't be well defined with respect to priorities.
# so we block splitting operations.

# Runtime: O(1).
#' @method split_by_predicate priority_queue
#' @export
#' @noRd
split_by_predicate.priority_queue <- function(x, predicate, monoid_name) {
  stop("`split_by_predicate()` is not supported for priority_queue. Cast first with `as_flexseq()`.")
}

# Runtime: O(1).
#' @method split_around_by_predicate priority_queue
#' @export
#' @noRd
split_around_by_predicate.priority_queue <- function(t, predicate, monoid_name, accumulator = NULL) {
  stop("`split_around_by_predicate()` is not supported for priority_queue. Cast first with `as_flexseq()`.")
}

# Runtime: O(1).
#' @method split_at priority_queue
#' @export
#' @noRd
split_at.priority_queue <- function(x, at, pull_index = FALSE) {
  stop("`split_at()` is not supported for priority_queue. Cast first with `as_flexseq()`.")
}

Try the Immutables package in your browser

Any scripts or data that you put into this service are public.

Immutables documentation built on April 29, 2026, 1:06 a.m.