The package https://github.com/mauro3/Parameters.jl has some of the
functionality you seek. For instance, for some type PhysicalPara,
construct a new instance from a existing instance `pp` with two fields
modified:
pp2 = PhysicalPara(pp; cw=.11e-7, rw=100.)
On Sun, 2015-08-02 at 15:22, Cedric St
Both options are very interesting, thank you!
On Sunday, August 2, 2015 at 10:04:01 AM UTC-4, Isaiah wrote:
>
> See also: https://github.com/SimonDanisch/FixedSizeArrays.jl and
> https://github.com/JuliaLang/julia/issues/11902
>
> On Sun, Aug 2, 2015 at 9:51 AM, Tom Breloff > wrote:
>
>> Dependi
See also: https://github.com/SimonDanisch/FixedSizeArrays.jl and
https://github.com/JuliaLang/julia/issues/11902
On Sun, Aug 2, 2015 at 9:51 AM, Tom Breloff wrote:
> Depending on your performance needs, you could make a copy constructor
> with keyword arg overrides:
>
> immutable Foo
> x
> y
>
Depending on your performance needs, you could make a copy constructor with
keyword arg overrides:
immutable Foo
x
y
end
Foo(foo::Foo; x=foo.x, y=foo.y)
foo1 = Foo(1, 2)
foo2 = Foo(foo1; y=5)
Note: this constructor could easily be written as a macro:
@copyconstruct immutable Foo
x
y
end
In my (generally functional) code, I frequently find myself asking for "An
object like X but with Y different", eg. "that image but with the
background set to transparent" or "that dataframe but with all inactive
customers' profit set to 0". The usual idiom is:
img2 = copy(img)
img2[img2.==blac