Hi, I’m trying to reuse a function to set parameters of a struct.
For example, I have a function whose the first argument should have type MyStruct
:
function set_parameter(mystruct::MyStruct)
mystruct.a = 1
end
And I want to use it to set some parameters of the following struct.
mutable struct MyStruct
???? = set_parameter(????)
b::Int
end
The reason why I’m trying to do this is to reuse the function, which is that I used to do in Python.
Is there any way to resolve this?
10 posts - 6 participants