Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle nontrivial defaults better in coef #238

Open
richfitz opened this issue Aug 25, 2021 · 0 comments
Open

Handle nontrivial defaults better in coef #238

richfitz opened this issue Aug 25, 2021 · 0 comments

Comments

@richfitz
Copy link
Member

gen <- odin({
  deriv(x) <- 1
  initial(x) <- x0
  x0 <- user(-1 / (2 + 3 * 4))
})

mod <- gen$new()
expect_equal(mod$contents()$x0, -1 / (2 + 3 * 4))

coef(mod)$default_value[[1]]

which gives

[[1]]
[1] "/"

[[2]]
[[2]][[1]]
[1] "-"

[[2]][[2]]
[1] 1


[[3]]
[[3]][[1]]
[1] "("

[[3]][[2]]
[[3]][[2]][[1]]
[1] "+"

[[3]][[2]][[2]]
[1] 2

[[3]][[2]][[3]]
[[3]][[2]][[3]][[1]]
[1] "*"

[[3]][[2]][[3]][[2]]
[1] 3

[[3]][[2]][[3]][[3]]
[1] 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant