If the operator is a unary operator, just omit X and its comma.
We illustrate this function by defining a type of mutable list whose elements can be both extracted and replaced using the operator _. We also install a method for net so objects of the class can be printed.
i1 : M = new Type of MutableList o1 = M o1 : Type |
i2 : net M := m -> peek m
o2 = {*Function[stdio:2:11-2:19]*}
o2 : FunctionClosure
|
i3 : M _ ZZ := (x,i) -> x#i
o3 = {*Function[stdio:3:16-3:21]*}
o3 : FunctionClosure
|
i4 : installAssignmentMethod(symbol _, M, ZZ, (x,i,v) -> x#i = v); |
i5 : y = new M from (a..z)
o5 = M{a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z}
o5 : M
|
i6 : y_12 o6 = m o6 : Symbol |
i7 : y_12 = foo o7 = foo o7 : Symbol |
i8 : y
o8 = M{a, b, c, d, e, f, g, h, i, j, k, l, foo, n, o, p, q, r, s, t, u, v, w, x, y, z}
o8 : M
|
i9 : y_12 o9 = foo o9 : Symbol |