syberia_stack: A helper interface for a stack of syberia resources.

Description Usage Arguments Details Value Examples

View source: R/resource.r

Description

This function is meant to be used by syberia for pushing and popping resource reference onto a stack, e.g., to keep track of dependencies for a given syberia model.

Usage

1

Arguments

value

ANY. Push a value onto the stac.

all

logical. Whether or not to pop and return all values from the stack. The default is FALSE.

Details

This function is meant to be used as follows. Calling syberia_stack() pops the latest value off the stack. If no value exists, the stack gets created in the syberiaStructure cache with key 'resource_stack' if it is not present, or otherwise returns NULL.

If a single unnamed value is passed, like syberia_stack("foo"), it is pushed onto the stack (if the stack does not exist in the cache, it gets created extemporaneously).

Value

the popped value(s)

Examples

1
2
3
4
5
6
## Not run: 
  syberia_stack(all = TRUE) # Create a new stack
  lapply(1:5, syberia_stack) # Push 1 through 5 onto the stack
  syberia_stack(all = TRUE) # Clear the stack and return as.list(1:5)

## End(Not run)

robertzk/syberiaStructure documentation built on May 27, 2019, 11:38 a.m.