[mercury-users] Optional fields in a datatype - how to represent?
Terrence Brannon
princepawn at earthlink.net
Mon Apr 23 06:18:02 AEST 2001
Under modes, the manual does state:
To describe states of instantiation, we use information provided by
the type system. Types can be viewed as regular trees with two kinds
of nodes: or-nodes representing types and and-nodes representing
constructors. The children of an or-node are the constructors that
can be used to construct terms of that type; the children of an
and-node are the types of the arguments of the constructors. We
attach mode information to the or-nodes of type trees.
My interpretation of this statement is: "in a given Mercury program,
one either brings in datatypes with a use_module/import statement or
defines them inline. The entire set of such datatypes when applied an
or operator represents the set of possible datatypes within a
program... this is what is referred to as an or-node in the manual
text. What and-node is (and what bothers me) is a 'child' of one of
the terms or'ed together in the previous operation. The branches of an
and-node are the fields of a particular datatype. E.g.:
:- type employee
---> employee(
name :: string,
age :: int,
department :: string
).
contributes the or-node employee(name,age,department) to the or
operation and it's and-node is name, age and department."
Now, assuming my re-intepretation (and expansion by example) of the
manual is correct, then my question is: what if a field is optional?
Am I required to supply an empty value for this field?
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list