[m-rev.] for review: deconstruct by functor number

Simon Taylor staylr at gmail.com
Fri Jan 5 18:15:50 AEDT 2007


On 05-Jan-2007, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 
> On Fri, 5 Jan 2007, Simon Taylor wrote:
> >diff -u library/construct.m library/construct.m
> >--- library/construct.m
> >+++ library/construct.m
> >@@ -35,11 +35,17 @@
> >    % num_functors(TypeInfo).
> >    %
> >    % Returns the number of different functors for the top-level
> >-    % type constructor of the type specified by TypeInfo, or -1
> >+    % type constructor of the type specified by TypeInfo, or fail
> >    % if the type is not a discriminated union type.
> >    %
> 
> I suggest making the last bit a separate sentence, e.g.
> 
> 	Returns the number of different functors for the top-level
> 	type constructor of the type specified by TypeInfo.
> 	Fails if the type is not a discriminated union type.

OK.

> Also, s/TypeInfo/TypeDesc/

Most of the rest of construct.m and type_desc.m use `Type'.

Simon.

Index: construct.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/construct.m,v
retrieving revision 1.33
diff -u -u -r1.33 construct.m
--- construct.m 5 Jan 2007 02:19:41 -0000       1.33
+++ construct.m 5 Jan 2007 06:48:05 -0000
@@ -32,11 +32,11 @@
 :- type functor_number_ordinal == int.
 :- type functor_number_lex == int.
 
-    % num_functors(TypeInfo).
+    % num_functors(Type).
     %
     % Returns the number of different functors for the top-level
-    % type constructor of the type specified by TypeInfo, or fail
-    % if the type is not a discriminated union type.
+    % type constructor of the type specified by Type.
+    % Fails if the type is not a discriminated union type.
     %
     % deconstruct.functor_number/3, deconstruct.deconstruct_du/5
     % and the semidet predicates and functions in this module will
@@ -92,10 +92,10 @@
 :- func get_functor_lex(type_desc, functor_number_ordinal) =
     functor_number_lex is semidet.
 
-    % construct(TypeInfo, I, Args) = Term.
+    % construct(Type, I, Args) = Term.
     %
-    % Returns a term of the type specified by TypeInfo whose functor
-    % is functor number I of the type given by TypeInfo, and whose
+    % Returns a term of the type specified by Type whose functor
+    % is functor number I of the type given by Type, and whose
     % arguments are given by Args.  Fails if the type is not a
     % discriminated union type, or if I is out of range, or if the
     % number of arguments supplied doesn't match the arity of the selected
 
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list