updating labelled fields

Jorge Adriano jadrian@mat.uc.pt
Tue, 7 May 2002 00:28:40 +0100


On Monday 06 May 2002 23:28, Hal Daume III wrote:
> I wouldn't at all mind making this addition if I had a sense that it wo=
uld
> actually be accepted and that people weren't going to go crazy over the
> syntax.  Would something like "<-" be preferred or something like "$=3D=
>"?

I'd still prefer having some way to automaticly derive 'apply' functions.
There is already nice syntax for setting a field value and I always end u=
p=20
defining 'set' functions to each and every field because I want to pass t=
hem=20
as arguments.=20

Imagine you have an STRef to a labeled datatype, lets call it "stdata". =20
You want to apply some function "g" to field "foo" of that structure.
> modifySTRef (fooAp g) stdata

Changing its value to "x"
> modifySTRef (fooSet x) stdata

With syntatic sugar only you'd have to read the reference, apply the func=
tion=20
to the field and then update it.=20

IMO, 'set field' and 'apply to field' functions are as usefull as the 'fi=
eld=20
projection' functions that are derived from the definition of the labeled=
=20
datatype. Anyway I agree that it would be nice to have special syntax for=
=20
updates. I'll use it if I have it available.=20

On Monday 06 May 2002 23:42, David Feuer wrote:
> Why not $=3D ?
Yeap very nice in deed. I'd vote for this one.

J.A.