File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 49
49
50
50
drop :: forall a. Number -> [a] -> [a]
51
51
52
+ dropWhile :: forall a. (a -> Boolean) -> [a] -> [a]
53
+
52
54
elemIndex :: forall a. (Eq a) => a -> [a] -> Number
53
55
54
56
elemLastIndex :: forall a. (Eq a) => a -> [a] -> Number
107
109
108
110
take :: forall a. Number -> [a] -> [a]
109
111
112
+ takeWhile :: forall a. (a -> Boolean) -> [a] -> [a]
113
+
110
114
updateAt :: forall a. Number -> a -> [a] -> [a]
111
115
112
116
zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ module Data.Array
41
41
, group'
42
42
, groupBy
43
43
, span
44
+ , dropWhile
45
+ , takeWhile
44
46
) where
45
47
46
48
import Control.Alt
@@ -354,6 +356,12 @@ span = go []
354
356
go acc p (x:xs) | p x = go (x:acc) p xs
355
357
go acc _ xs = { init: reverse acc, rest: xs }
356
358
359
+ takeWhile :: forall a . (a -> Boolean ) -> [a ] -> [a ]
360
+ takeWhile p xs = (span p xs).init
361
+
362
+ dropWhile :: forall a . (a -> Boolean ) -> [a ] -> [a ]
363
+ dropWhile p xs = (span p xs).rest
364
+
357
365
instance functorArray :: Functor [] where
358
366
(<$>) = map
359
367
You can’t perform that action at this time.
0 commit comments