[m-dev.] For review: minor additions to list.m and string.m
Ralph Becket
rbeck at microsoft.com
Sat Sep 9 02:54:14 AEDT 2000
Committed the following...
Estimated hours taken: .5
Small additions to list and string.
library/list.m:
Added func ++/2 as a synonym for list__append/2.
library/string.m:
Added func ++/2 as a synonym for string__append/2.
Index: list.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/list.m,v
retrieving revision 1.92
diff -u -r1.92 list.m
--- list.m 2000/07/19 03:41:54 1.92
+++ list.m 2000/09/08 15:51:52
@@ -86,7 +86,11 @@
% to a rewrite rule.
:- promise all [L,H,T] ( append([H], T, L) <=> L = [H|T] ).
+ % L1 ++ L2 = L :- list__append(L1, L2, L).
+ %
+:- func list(T) ++ list(T) = list(T).
+
% list__remove_suffix(List, Suffix, Prefix):
% The same as list__append(Prefix, Suffix, List) except that
% this is semidet whereas list__append(out, in, in) is nondet.
@@ -1321,3 +1325,9 @@
P = ( pred(X::in, Y::in, Z::out) is det :- Z = F(X, Y) ),
list__merge_and_remove_dups(P, Xs, Ys, Zs).
+%
----------------------------------------------------------------------------
%
+
+L1 ++ L2 = list__append(L1, L2).
+
+%
----------------------------------------------------------------------------
%
+%
----------------------------------------------------------------------------
%
Index: string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.127
diff -u -r1.127 string.m
--- string.m 2000/08/17 09:58:05 1.127
+++ string.m 2000/09/08 15:51:57
@@ -34,6 +34,11 @@
% that it is semidet. Use string__remove_suffix instead.
% :- mode string__append(out, in, in) is semidet.
+:- func string ++ string = string.
+% S1 ++ S2 = S :- string__append(S1, S2, S).
+%
+% Nicer syntax.
+
:- pred string__remove_suffix(string, string, string).
:- mode string__remove_suffix(in, in, out) is semidet.
% string__remove_suffix(String, Suffix, Prefix):
@@ -1874,6 +1879,10 @@
else
preceding_boundary(SepP, String, I - 1)
).
+
+%
----------------------------------------------------------------------------
%
+
+S1 ++ S2 = string__append(S1, S2).
%
----------------------------------------------------------------------------
%
%
----------------------------------------------------------------------------
%
--
Ralph Becket | MSR Cambridge | rbeck at microsoft.com
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list