3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-22 08:35:31 +00:00

use fold_left instead of filteri because it is not available on old

OCaml versions
This commit is contained in:
zapashcanon 2024-02-19 16:54:33 +01:00
parent b1b61c9d57
commit 2c89a49ba8
No known key found for this signature in database
GPG key ID: 8981C3C62D1D28F1

View file

@ -2086,7 +2086,14 @@ struct
let mk_roots (ctx:context) (a:rcf_num list) =
let n, r = Z3native.rcf_mk_roots ctx (List.length a) a in
List.filteri (fun i _v -> i < n) r
let _i, l =
(* keep only the first `n` elements of the list `r` *)
List.fold_left (fun (i, acc) x ->
if i = 0 then i, acc
else (i - 1, x :: acc)
) (n, []) r
in
List.rev l
let add (ctx:context) (a:rcf_num) (b:rcf_num) = Z3native.rcf_add ctx a b
let sub (ctx:context) (a:rcf_num) (b:rcf_num) = Z3native.rcf_sub ctx a b