greta-dev / greta-dev/greta

Explore method dispatch to avoid if(class(thing)) do (function) else do (other_function)

Open
#705 1 comment 0 reactions 0 assignees View on GitHub
low hanging fruit refactor
Dominant language
C++
Stars
607
Forks
67
Avg merge
3d 8h
Merged PRs (30d)
1

Description

e.g., Use method dispatch inside of `calculate` to avoid

```

if (is.greta_mcmc_list(values)) {
result <- calculate_greta_mcmc_list(
target = target,
values = values,
nsim = nsim,
tf_float = tf_float,
trace_batch_size = trace_batch_size
)
} else {
result <- calculate_list(
target = target,
values = values,
nsim = nsim,
tf_float = tf_float,
env = parent.frame()
)
}
```

Thanks @maelle for the suggestion

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.