MyNixOS website logo
Description

High Performance Container Data Types.

Provides high performance container data types such as queues, stacks, deques, dicts and ordered dicts. Benchmarks <https://randy3k.github.io/collections/articles/benchmark.html> have shown that these containers are asymptotically more efficient than those offered by other packages.

High Performance Container Data Types

check codecov CRAN_Status_Badge

Github: https://github.com/randy3k/collections

Documentation: https://randy3k.github.io/collections/

Provides high performance container data types such as queues, stacks, deques, dicts and ordered dicts. Benchmarks https://randy3k.github.io/collections/articles/benchmark.html have shown that these containers are asymptotically more efficient than those offered by other packages.

Installation

You can install the released version of collections from CRAN with:

install.packages("collections")

Install the latest development version using

devtools::install_github("randy3k/collections")

Example

library(collections, warn.conflicts = FALSE)

Queue

q <- queue()
q$push(1)$push(2)
q$pop()
## [1] 1

Stack

s <- stack()
s$push(1)$push(2)
s$pop()
## [1] 2

Deque

dq <- deque()
dq$push(1)$pushleft(2)
dq$pop()
## [1] 1

Priority Queue

pq <- priority_queue()
pq$push("not_urgent")
pq$push("urgent", priority = 2)
pq$push("not_as_urgent", priority = 1)
pq$pop()
## [1] "urgent"
pq$pop()
## [1] "not_as_urgent"
pq$pop()
## [1] "not_urgent"

Dictionary. Comparing to R envrionments, dict() does not leak memory and supports various other types of keys.

d <- dict()
e <- new.env()
d$set(e, 1)$set(sum, 2)$set(c(1L, 2L), 3)
d$get(c(1L, 2L))
## [1] 3

Ordered Dictionary

d <- ordered_dict()
d$set("b", 1)$set("a", 2)
d$as_list()
## $b
## [1] 1
## 
## $a
## [1] 2
Metadata

Version

0.3.7

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows