Skip to content

Commit 085022e

Browse files
change complexity documentation for drop{,While} and take{,While}
1 parent 82a502f commit 085022e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Data/String/CodePoints.purs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,14 @@ countTail p s accum = case uncons s of
138138

139139
-- | Drops the given number of code points from the beginning of the string. If
140140
-- | the string does not have that many code points, returns the empty string.
141-
-- | Operates in space and time linear to the length of the string.
141+
-- | Operates in constant space and in time linear to the given number.
142142
drop :: Int -> String -> String
143143
drop n s = String.drop (String.length (take n s)) s
144144

145145

146146
-- | Drops the leading sequence of code points which all match the given
147-
-- | predicate from the string. Operates in space and time linear to the
148-
-- | length of the string.
147+
-- | predicate from the string. Operates in constant space and in time linear
148+
-- | to the length of the string.
149149
dropWhile :: (CodePoint -> Boolean) -> String -> String
150150
dropWhile p s = drop (count p s) s
151151

@@ -230,8 +230,8 @@ splitAt i s =
230230

231231
-- | Returns a string containing the given number of code points from the
232232
-- | beginning of the given string. If the string does not have that many code
233-
-- | points, returns the empty string. Operates in space and time linear to the
234-
-- | given number.
233+
-- | points, returns the empty string. Operates in constant space and in time
234+
-- | linear to the given number.
235235
take :: Int -> String -> String
236236
take = _take takeFallback
237237

@@ -245,8 +245,8 @@ takeFallback n s = case uncons s of
245245

246246

247247
-- | Returns a string containing the leading sequence of code points which all
248-
-- | match the given predicate from the string. Operates in space and time
249-
-- | linear to the length of the string.
248+
-- | match the given predicate from the string. Operates in constant space and
249+
-- | in time linear to the length of the string.
250250
takeWhile :: (CodePoint -> Boolean) -> String -> String
251251
takeWhile p s = take (count p s) s
252252

0 commit comments

Comments
 (0)