gen.recursive: Build recursive structures in a way that guarantees...

View source: R/gen.R

gen.recursiveR 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 )
    )
  )

hedgehog documentation built on Nov. 6, 2025, 1:11 a.m.