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

Bug with function scoping #92

Closed
Avi-Kenny opened this issue Oct 25, 2023 · 1 comment
Closed

Bug with function scoping #92

Avi-Kenny opened this issue Oct 25, 2023 · 1 comment
Assignees

Comments

@Avi-Kenny
Copy link
Owner

Two users have experienced a bug associated with function scoping. Here is a reproducible example:

run_on_cluster(
  first={
    sim <- new_sim()
    fn_level_2 <- function(nseq) { return(999) }
    fn_level_1 <- function(nseq) { fn_level_2(n) }
    sim %<>% set_script(function(){
      x <- fn_level_1(nseq=L$n)
      return(list(x=x, y=runif(1)))
    })
    sim %<>% set_levels(n=3)
    sim %<>% set_config(num_sim=10)
  },
  main={ sim %<>% run() },
  last={},
  cluster_config=list(js="slurm")
)

This works if the declaration of fn_level_2 is moved above run_on_cluster.

@Avi-Kenny Avi-Kenny self-assigned this Oct 25, 2023
@Avi-Kenny
Copy link
Owner Author

This is now fixed.

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