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

Confusing Julia code in adding_models_for_general_use.md #1061

Closed
jcsahnwaldt opened this issue Oct 2, 2023 · 1 comment
Closed

Confusing Julia code in adding_models_for_general_use.md #1061

jcsahnwaldt opened this issue Oct 2, 2023 · 1 comment
Labels

Comments

@jcsahnwaldt
Copy link

jcsahnwaldt commented Oct 2, 2023

Line 159 of adding_models_for_general_use.md says:

clean!(clean!(model)) == clean!(model)

I guess the intention is to specify that only the first call of clean!(model) may modify model, and any subsequent calls must not make further changes to model. But clean!() doesn't return a model, it returns a string containing warnings. clean!(clean!(model)) doesn't even compile.

I'm afraid I can't suggest a good fix for the problem, because I don't know if there's a good way to express as Julia code the requirement that subsequent calls of clean!() must not change the model.

I guess this requirement also implies that subsequent calls of clean!() must return an empty string, but I'm not sure.

@ablaom
Copy link
Member

ablaom commented Oct 3, 2023

Good catch, thanks. Yes the intention is that calling clean!(model) immediately after clean!(model) should not mutate model. So,

clean!(model)
clone = deepcopy(model)
clean!(model)
@assert model == clone

@ablaom ablaom added the docs label Oct 5, 2023
ablaom added a commit that referenced this issue Oct 10, 2023
@ablaom ablaom closed this as completed Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants