Extract or set code from a slimr_script object

code(x)

code(x) <- value

Arguments

x

A slimr_script object

value

Code to replace with.

Examples

script <- slim_script(
  slim_block_init_minimal(),
  slim_block_finish(100)
)
code(script)
#> <slimr_code[2]>
#> {initializeMutationRate(1e-07); initializeMutationType("m1", 0.5, "f", 0); initializeGenomicElementType("g1", m1, 1); initializeGenomicElement(g1, 0, 1e+05 - 1L); initializeRecombinationRate(1e-08)} {sim.simulationFinished()}
code(minimal_slimr_script())
#> <slimr_code[2]>
#> {initializeMutationRate(1e-07); initializeMutationType("m1", 0.5, "f", 0); initializeGenomicElementType("g1", m1, 1); initializeGenomicElement(g1, 0, 99999); initializeRecombinationRate(1e-08)} {sim.addSubpop("p1", 500); print("Hello world!"); sim.simulationFinished()}