MLJ.jl
MLJ.jl copied to clipboard
Confusing Julia code in adding_models_for_general_use.md
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.
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