gen.recursive {hedgehog}R Documentation

Build recursive structures in a way that guarantees termination.

Description

This will choose between the recursive and non-recursive terms, while shrinking the size of the recursive calls.

Usage

gen.recursive(tails, heads)

Arguments

tails

a list of generators which should not contain recursive terms.

heads

a list of generator which may contain recursive terms.

Examples

# Generating a tree with integer leaves
treeGen <-
  gen.recursive(
    # The non-recursive cases
    list(
      gen.int(100)
    )
  , # The recursive cases
    list(
      gen.list( treeGen )
    )
  )

[Package hedgehog version 0.1 Index]