bendict: Manipulate bencode dictionary object.

Description Usage Arguments Details Examples

Description

Bendict class is a convenience wrapper around named list to allow custom printer.

Usage

1
2
3
4
5
6
7

Arguments

...

Key value pairs

obj

An R object

Details

bendict: Constructor similar to list(...).

is.bendict: TRUE if the object is a bendict.

is.dictlike: TRUE if object is a bendict or can be treated as such. An object is dictlike if it's a vector or list and all its names have positive length.

as.bendict: Convert to bendict object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
(x <- bendict(op = "eval", code = "log(5)"))

is.bendict(x)

as.bendict(list(A = 5, B = "C"))
as.bendict(c(A = 5, B = "C")) # same

is.dictlike(c(1, 2)) # FALSE
is.dictlike(c(A = 1, B = 2)) # TRUE
is.dictlike(c(1, B = 2)) # TRUE (not all are named)

vspinu/R-bencode documentation built on May 3, 2019, 7:08 p.m.