/usr/share/axiom-20170501/src/algebra/REF.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | )abbrev domain REF Reference
++ Author: Stephen M. Watt
++ Description:
++ \spadtype{Reference} is for making a changeable instance
++ of something.
Reference(S) : SIG == CODE where
S : Type
SIG ==> Type with
ref : S -> %
++ ref(n) creates a pointer (reference) to the object n.
elt : % -> S
++ elt(n) returns the object n.
setelt : (%, S) -> S
++ setelt(n,m) changes the value of the object n to m.
deref : % -> S
++ deref(n) is equivalent to \spad{elt(n)}.
setref : (%, S) -> S
++ setref(n,m) same as \spad{setelt(n,m)}.
_= : (%, %) -> Boolean
++ a=b tests if \spad{a} and b are equal.
if S has SetCategory then SetCategory
CODE ==> add
Rep := Record(value: S)
p = q == EQ(p, q)$Lisp
ref v == [v]
elt p == p.value
setelt(p, v) == p.value := v
deref p == p.value
setref(p, v) == p.value := v
if S has SetCategory then
coerce p ==
prefix(message("ref"@String), [p.value::OutputForm])
|