File tree Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Original file line number Diff line number Diff line change 122
122
(6 , [ " 1" ; " a1" ; " 2" ; " a2" ; " 3" ; " a3" ])
123
123
(let pf = Printf. sprintf in
124
124
fold_flat_map (fun acc x -> acc + x, [ pf " %d" x; pf " a%d" x ]) 0 [ 1 ; 2 ; 3 ])
125
- ;;
126
125
127
126
[@@@ ifge 4.12 ]
128
- t @@ fun () ->
129
- let r = Atomic. make 0 in
130
- let f x =
131
- let n = Atomic. fetch_and_add r 1 in
132
- [ n, x ]
133
- in
134
127
135
- let l = CCList. flat_map f [ " a" ; " b" ; " c" ] in
136
- assert_equal
137
- ~printer: Q.Print. (list @@ pair int string )
138
- [ 0 , " a" ; 1 , " b" ; 2 , " c" ]
139
- l;
140
- true
141
- ;;
128
+ let () =
129
+ t @@ fun () ->
130
+ let r = Atomic. make 0 in
131
+ let f x =
132
+ let n = Atomic. fetch_and_add r 1 in
133
+ [ n, x ]
134
+ in
135
+
136
+ let l = CCList. flat_map f [ " a" ; " b" ; " c" ] in
137
+ assert_equal
138
+ ~printer: Q.Print. (list @@ pair int string )
139
+ [ 0 , " a" ; 1 , " b" ; 2 , " c" ]
140
+ l;
141
+ true
142
142
143
- [@@@ endif]
143
+ [@@@ endif];;
144
144
145
145
q
146
146
Q. (list int )
@@ -219,11 +219,9 @@ t @@ fun () ->
219
219
flat_map (fun x -> [ x + 1 ; x * 2 ]) [ 10 ; 100 ] = [ 11 ; 20 ; 101 ; 200 ]
220
220
;;
221
221
222
-
223
222
t @@ fun () -> List. length (flat_map (fun x -> [ x ]) (1 -- 300_000 )) = 300_000
224
223
;;
225
- t @@ fun () ->
226
- List. length (flat_map (fun _ -> 1 -- 300_000 ) (1 -- 2 )) = 600_000
224
+ t @@ fun () -> List. length (flat_map (fun _ -> 1 -- 300_000 ) (1 -- 2 )) = 600_000
227
225
;;
228
226
229
227
eq [ 1 ; 2 ; 2 ; 3 ; 3 ; 3 ]
You can’t perform that action at this time.
0 commit comments