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 122122 (6 , [ " 1" ; " a1" ; " 2" ; " a2" ; " 3" ; " a3" ])
123123 (let pf = Printf. sprintf in
124124 fold_flat_map (fun acc x -> acc + x, [ pf " %d" x; pf " a%d" x ]) 0 [ 1 ; 2 ; 3 ])
125- ;;
126125
127126[@@@ 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
134127
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
142142
143- [@@@ endif]
143+ [@@@ endif];;
144144
145145q
146146 Q. (list int )
@@ -219,11 +219,9 @@ t @@ fun () ->
219219flat_map (fun x -> [ x + 1 ; x * 2 ]) [ 10 ; 100 ] = [ 11 ; 20 ; 101 ; 200 ]
220220;;
221221
222-
223222t @@ fun () -> List. length (flat_map (fun x -> [ x ]) (1 -- 300_000 )) = 300_000
224223;;
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
227225;;
228226
229227eq [ 1 ; 2 ; 2 ; 3 ; 3 ; 3 ]
You can’t perform that action at this time.
0 commit comments