[aplusdev] using mapped variable in as a function argument?
John.Mizel at MorganStanley.com
John.Mizel at MorganStanley.com
Mon Feb 11 15:20:42 EST 2002
Sasha.
A+ variables are referneced counted. A "regular" variable (not one
attached to a mapped file) won't be copied unless the function foo
modifies it.
Variables attached to files read/write behave differently. A useful debug
command is "$dbg +beam". This will show when variables are attached and
silently detached from a .m file.
So
a := iota 100
foo{x}: {
x := +/x;
b :=max x;
x[0] := 100 lamp a copy of x is made
a,b
}
a := 1 beam "file.m"
foo{x}: {
x := +/x;
b :=max x;
x[0] := 100 lamp a is ACTUALLY modified NO copy made
a,b
}
Thanks,
John
A+ variables are referenced counted so for a variable that isn't passed to
foo
On Mon, 11 Feb 2002, Alexander Skomorokhov wrote:
> One more question on memory mapped files.
> Sorry if the answer is somewhere in the manual.
>
> $mode ascii
> z:=1 beam 'file.m'
>
> foo x:{
> a:=+/x;
> b:=max x;
> a,b}
>
> When I call function as
>
> foo t
>
> Is local copy of t created as x in workspace?
>
> Thanks,
> Sasha.
>
>
--
More information about the apluslist
mailing list