print.priority_queue: Print a Priority Queue Summary

View source: R/40-priority_queue-print.R

print.priority_queueR Documentation

Print a Priority Queue Summary

Description

Prints a compact summary with priority range and a head/tail preview.

Usage

## S3 method for class 'priority_queue'
print(x, max_elements = 4L, show_custom_monoids = FALSE, ...)

Arguments

x

A priority_queue.

max_elements

Maximum number of elements shown in the preview.

show_custom_monoids

Logical; show attached non-default monoids and their root cached measures.

...

Passed through to per-element print().

Value

Invisibly returns x.

Examples

q <- priority_queue(one = 1, two = 2, three = 3, priorities = c(20, 30, 10))
print(q, max_elements = 4)
sum_item <- measure_monoid(`+`, 0, function(entry) as.numeric(entry$value))
q3 <- add_monoids(priority_queue(1, 2, priorities = c(2, 1)), list(sum_item = sum_item))
print(q3, max_elements = 0, show_custom_monoids = TRUE)

q2 <- priority_queue(1, 2, 3, priorities = c(2, 1, 3))
print(q2, max_elements = 3)

print(priority_queue())

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