[m-rev.] for review: clarify behaviour of string.duplicate_char

Julien Fischer jfischer at opturion.com
Wed Jun 1 22:52:43 AEST 2022


For review by anyone.

-----------------------

Clarify behaviour of string.duplicate_char.

library/string.m:
     Describe what is returned when duplicate_char is called with
     a negative count.

Julien.

diff --git a/library/string.m b/library/string.m
index c14242a..678cc1d 100644
--- a/library/string.m
+++ b/library/string.m
@@ -214,8 +214,9 @@

      % duplicate_char(Char, Count, String):
      %
-    % Construct a string consisting of Count occurrences of Char
-    % code points in sequence.
+    % Construct a string consisting of Count occurrences of Char code points
+    % in sequence, returning the empty string if Count is less than or equal
+    % to zero.
      %
  :- func duplicate_char(char::in, int::in) = (string::uo) is det.
  :- pred duplicate_char(char::in, int::in, string::uo) is det.


More information about the reviews mailing list