[m-rev.] for review: Implemetation of string__append_list

Ralph Becket rbeck at microsoft.com
Tue Sep 4 21:02:35 AEST 2001


> From: Yoann Dubreuil [mailto:ydu at miscrit.be]
> Sent: 04 September 2001 11:53

Index: library/string.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/string.m,v
retrieving revision 1.155
diff -u -r1.155 string.m
--- library/string.m	28 Aug 2001 12:48:50 -0000	1.155
+++ library/string.m	4 Sep 2001 10:31:52 -0000
@@ -1033,6 +1033,13 @@
 }
 ").
 
+string__append_list(Strs::in) = (Str::uo) :-
+	( Strs = [X | Xs] ->
+		Str = X ++ append_list(Xs)
+	;
+		Str = ""
+	).
+

For real functional cred you could go for

string__append_list(Strs::in) = (list__foldr((++), Strs, "")::out).

- Ralph
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list