4 iterN :: (Integer -> <e> b) -> Integer -> <e> ()
9 else do { f i ; loop (i+1) }
12 anyN :: (Integer -> <e> Boolean) -> Integer -> <e> Boolean
17 else f i || loop (i+1)
20 allN :: (Integer -> <e> Boolean) -> Integer -> <e> Boolean
25 else f i && loop (i+1)
28 mapFirstN :: (Integer -> <e> Maybe b) -> Integer -> <e> Maybe b
29 mapFirstN f n = loop 0
38 concatMapN :: (Integer -> <e> [b]) -> Integer -> <e> [b]
39 concatMapN f n = sum (mapN f n)
42 mapN :: (Integer -> <e> b) -> Integer -> <e> [b]
43 mapN f n = build (\empty cons ->
44 let loop i accum = if i==n
46 else loop (i+1) (cons accum (f i))
50 filterN :: (Integer -> <e> Boolean) -> Integer -> <e> [Integer]
51 filterN f n = build (\empty cons ->
52 let loop i accum = if i==n
61 mapMaybeN :: (Integer -> <e> Maybe b) -> Integer -> <e> [b]
62 mapMaybeN f n = build (\empty cons ->
63 let loop i accum = if i==n
65 else loop (i+1) (match f i with
66 Just v -> cons accum v
71 foldlN :: (a -> Integer -> <e> a) -> a -> Integer -> <e> a
72 foldlN f initial n = loop initial 0
76 else loop (f cur i) (i+1)